@ecmaos/kernel 0.6.3 → 0.6.4
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/.vite/manifest.json +12 -12
- package/dist/{install-7ncBAQu_.js → install-DIY-HQ9n.js} +2 -2
- package/dist/{install-7ncBAQu_.js.map → install-DIY-HQ9n.js.map} +1 -1
- package/dist/{kernel-DEdzF9cH.js → kernel-DtEbpoeV.js} +1128 -275
- package/dist/kernel-DtEbpoeV.js.map +1 -0
- package/dist/kernel.js +1 -1
- package/dist/{topbar.min-BbHcCmce.js → topbar.min-BK1fdCNA.js} +2 -2
- package/dist/{topbar.min-BbHcCmce.js.map → topbar.min-BK1fdCNA.js.map} +1 -1
- package/dist/ui.js +4 -2
- package/dist/ui.js.map +1 -1
- package/dist/{uninstall-RZVWBlfX.js → uninstall-BOyXf2bF.js} +2 -2
- package/dist/{uninstall-RZVWBlfX.js.map → uninstall-BOyXf2bF.js.map} +1 -1
- package/package.json +5 -5
- package/dist/kernel-DEdzF9cH.js.map +0 -1
|
@@ -280,9 +280,9 @@ function arrayify$6(input) {
|
|
|
280
280
|
}
|
|
281
281
|
}
|
|
282
282
|
__name(arrayify$6, "arrayify$6");
|
|
283
|
-
const csi$
|
|
284
|
-
const ansi$
|
|
285
|
-
ansi$
|
|
283
|
+
const csi$6 = "\x1B[";
|
|
284
|
+
const ansi$7 = {};
|
|
285
|
+
ansi$7.style = {
|
|
286
286
|
reset: "\x1B[0m",
|
|
287
287
|
bold: "\x1B[1m",
|
|
288
288
|
italic: "\x1B[3m",
|
|
@@ -330,29 +330,29 @@ ansi$6.style = {
|
|
|
330
330
|
"bg-brightCyan": "\x1B[106m",
|
|
331
331
|
"bg-brightWhite": "\x1B[107m"
|
|
332
332
|
};
|
|
333
|
-
ansi$
|
|
333
|
+
ansi$7.rgb = function(r, g2, b) {
|
|
334
334
|
return `\x1B[38;2;${r};${g2};${b}m`;
|
|
335
335
|
};
|
|
336
|
-
ansi$
|
|
336
|
+
ansi$7.bgRgb = function(r, g2, b) {
|
|
337
337
|
return `\x1B[48;2;${r};${g2};${b}m`;
|
|
338
338
|
};
|
|
339
|
-
ansi$
|
|
339
|
+
ansi$7.styles = function(styles2) {
|
|
340
340
|
styles2 = arrayify$6(styles2);
|
|
341
341
|
return styles2.map(function(effect) {
|
|
342
342
|
const rgbMatches = effect.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
|
|
343
343
|
const bgRgbMatches = effect.match(/bg-rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
|
|
344
344
|
if (bgRgbMatches) {
|
|
345
345
|
const [full, r, g2, b] = bgRgbMatches;
|
|
346
|
-
return ansi$
|
|
346
|
+
return ansi$7.bgRgb(r, g2, b);
|
|
347
347
|
} else if (rgbMatches) {
|
|
348
348
|
const [full, r, g2, b] = rgbMatches;
|
|
349
|
-
return ansi$
|
|
349
|
+
return ansi$7.rgb(r, g2, b);
|
|
350
350
|
} else {
|
|
351
|
-
return ansi$
|
|
351
|
+
return ansi$7.style[effect];
|
|
352
352
|
}
|
|
353
353
|
}).join("");
|
|
354
354
|
};
|
|
355
|
-
ansi$
|
|
355
|
+
ansi$7.format = function(str, styleArray) {
|
|
356
356
|
const re2 = /\[([\w\s-\(\),]+)\]{([^]*?)}/;
|
|
357
357
|
let matches;
|
|
358
358
|
str = String(str);
|
|
@@ -360,18 +360,18 @@ ansi$6.format = function(str, styleArray) {
|
|
|
360
360
|
while (matches = str.match(re2)) {
|
|
361
361
|
const inlineStyles = matches[1].split(/\s+/);
|
|
362
362
|
const inlineString = matches[2];
|
|
363
|
-
str = str.replace(matches[0], ansi$
|
|
363
|
+
str = str.replace(matches[0], ansi$7.format(inlineString, inlineStyles));
|
|
364
364
|
}
|
|
365
|
-
return styleArray && styleArray.length ? ansi$
|
|
365
|
+
return styleArray && styleArray.length ? ansi$7.styles(styleArray) + str + ansi$7.style.reset : str;
|
|
366
366
|
};
|
|
367
|
-
ansi$
|
|
367
|
+
ansi$7.cursor = {
|
|
368
368
|
/**
|
|
369
369
|
* Moves the cursor `lines` cells up. If the cursor is already at the edge of the screen, this has no effect
|
|
370
370
|
* @param [lines=1] {number}
|
|
371
371
|
* @return {string}
|
|
372
372
|
*/
|
|
373
373
|
up: /* @__PURE__ */ __name(function(lines) {
|
|
374
|
-
return csi$
|
|
374
|
+
return csi$6 + (lines || 1) + "A";
|
|
375
375
|
}, "up"),
|
|
376
376
|
/**
|
|
377
377
|
* Moves the cursor `lines` cells down. If the cursor is already at the edge of the screen, this has no effect
|
|
@@ -379,7 +379,7 @@ ansi$6.cursor = {
|
|
|
379
379
|
* @return {string}
|
|
380
380
|
*/
|
|
381
381
|
down: /* @__PURE__ */ __name(function(lines) {
|
|
382
|
-
return csi$
|
|
382
|
+
return csi$6 + (lines || 1) + "B";
|
|
383
383
|
}, "down"),
|
|
384
384
|
/**
|
|
385
385
|
* Moves the cursor `lines` cells forward. If the cursor is already at the edge of the screen, this has no effect
|
|
@@ -387,7 +387,7 @@ ansi$6.cursor = {
|
|
|
387
387
|
* @return {string}
|
|
388
388
|
*/
|
|
389
389
|
forward: /* @__PURE__ */ __name(function(lines) {
|
|
390
|
-
return csi$
|
|
390
|
+
return csi$6 + (lines || 1) + "C";
|
|
391
391
|
}, "forward"),
|
|
392
392
|
/**
|
|
393
393
|
* Moves the cursor `lines` cells back. If the cursor is already at the edge of the screen, this has no effect
|
|
@@ -395,7 +395,7 @@ ansi$6.cursor = {
|
|
|
395
395
|
* @return {string}
|
|
396
396
|
*/
|
|
397
397
|
back: /* @__PURE__ */ __name(function(lines) {
|
|
398
|
-
return csi$
|
|
398
|
+
return csi$6 + (lines || 1) + "D";
|
|
399
399
|
}, "back"),
|
|
400
400
|
/**
|
|
401
401
|
* Moves cursor to beginning of the line n lines down.
|
|
@@ -403,7 +403,7 @@ ansi$6.cursor = {
|
|
|
403
403
|
* @return {string}
|
|
404
404
|
*/
|
|
405
405
|
nextLine: /* @__PURE__ */ __name(function(lines) {
|
|
406
|
-
return csi$
|
|
406
|
+
return csi$6 + (lines || 1) + "E";
|
|
407
407
|
}, "nextLine"),
|
|
408
408
|
/**
|
|
409
409
|
* Moves cursor to beginning of the line n lines up.
|
|
@@ -411,7 +411,7 @@ ansi$6.cursor = {
|
|
|
411
411
|
* @return {string}
|
|
412
412
|
*/
|
|
413
413
|
previousLine: /* @__PURE__ */ __name(function(lines) {
|
|
414
|
-
return csi$
|
|
414
|
+
return csi$6 + (lines || 1) + "F";
|
|
415
415
|
}, "previousLine"),
|
|
416
416
|
/**
|
|
417
417
|
* Moves the cursor to column n.
|
|
@@ -419,7 +419,7 @@ ansi$6.cursor = {
|
|
|
419
419
|
* @return {string}
|
|
420
420
|
*/
|
|
421
421
|
horizontalAbsolute: /* @__PURE__ */ __name(function(n) {
|
|
422
|
-
return csi$
|
|
422
|
+
return csi$6 + n + "G";
|
|
423
423
|
}, "horizontalAbsolute"),
|
|
424
424
|
/**
|
|
425
425
|
* Moves the cursor to row n, column m. The values are 1-based, and default to 1 (top left corner) if omitted.
|
|
@@ -428,25 +428,25 @@ ansi$6.cursor = {
|
|
|
428
428
|
* @return {string}
|
|
429
429
|
*/
|
|
430
430
|
position: /* @__PURE__ */ __name(function(n, m) {
|
|
431
|
-
return csi$
|
|
431
|
+
return csi$6 + (n || 1) + ";" + (m || 1) + "H";
|
|
432
432
|
}, "position"),
|
|
433
433
|
/**
|
|
434
434
|
* Hides the cursor
|
|
435
435
|
*/
|
|
436
|
-
hide: csi$
|
|
436
|
+
hide: csi$6 + "?25l",
|
|
437
437
|
/**
|
|
438
438
|
* Shows the cursor
|
|
439
439
|
*/
|
|
440
|
-
show: csi$
|
|
440
|
+
show: csi$6 + "?25h"
|
|
441
441
|
};
|
|
442
|
-
ansi$
|
|
442
|
+
ansi$7.erase = {
|
|
443
443
|
/**
|
|
444
444
|
* Clears part of the screen. If n is 0 (or missing), clear from cursor to end of screen. If n is 1, clear from cursor to beginning of the screen. If n is 2, clear entire screen.
|
|
445
445
|
* @param n {number}
|
|
446
446
|
* @return {string}
|
|
447
447
|
*/
|
|
448
448
|
display: /* @__PURE__ */ __name(function(n) {
|
|
449
|
-
return csi$
|
|
449
|
+
return csi$6 + (n || 0) + "J";
|
|
450
450
|
}, "display"),
|
|
451
451
|
/**
|
|
452
452
|
* Erases part of the line. If n is zero (or missing), clear from cursor to the end of the line. If n is one, clear from cursor to beginning of the line. If n is two, clear entire line. Cursor position does not change.
|
|
@@ -454,7 +454,7 @@ ansi$6.erase = {
|
|
|
454
454
|
* @return {string}
|
|
455
455
|
*/
|
|
456
456
|
inLine: /* @__PURE__ */ __name(function(n) {
|
|
457
|
-
return csi$
|
|
457
|
+
return csi$6 + (n || 0) + "K";
|
|
458
458
|
}, "inLine")
|
|
459
459
|
};
|
|
460
460
|
const ANSI_BACKGROUND_OFFSET$1 = 10;
|
|
@@ -4974,15 +4974,15 @@ const warn = _shortcut$1(Level.WARN);
|
|
|
4974
4974
|
const notice = _shortcut$1(Level.NOTICE);
|
|
4975
4975
|
const info = _shortcut$1(Level.INFO);
|
|
4976
4976
|
const debug = _shortcut$1(Level.DEBUG);
|
|
4977
|
-
function ansi$
|
|
4977
|
+
function ansi$6(text, format2) {
|
|
4978
4978
|
return `\x1B[${format2}m${text}\x1B[0m`;
|
|
4979
4979
|
}
|
|
4980
|
-
__name(ansi$
|
|
4980
|
+
__name(ansi$6, "ansi$6");
|
|
4981
4981
|
function _prettyMs(entry, style) {
|
|
4982
4982
|
const text = "[" + (entry.elapsedMs / 1e3).toFixed(3).padStart(10) + "] ";
|
|
4983
4983
|
switch (style) {
|
|
4984
4984
|
case "ansi":
|
|
4985
|
-
return [ansi$
|
|
4985
|
+
return [ansi$6(text, "2;37")];
|
|
4986
4986
|
case "css":
|
|
4987
4987
|
return ["%c" + text, "opacity: 0.8; color: white;"];
|
|
4988
4988
|
default:
|
|
@@ -25667,9 +25667,9 @@ function arrayify$5(input) {
|
|
|
25667
25667
|
}
|
|
25668
25668
|
}
|
|
25669
25669
|
__name(arrayify$5, "arrayify$5");
|
|
25670
|
-
const csi$
|
|
25671
|
-
const ansi$
|
|
25672
|
-
ansi$
|
|
25670
|
+
const csi$5 = "\x1B[";
|
|
25671
|
+
const ansi$5 = {};
|
|
25672
|
+
ansi$5.style = {
|
|
25673
25673
|
reset: "\x1B[0m",
|
|
25674
25674
|
bold: "\x1B[1m",
|
|
25675
25675
|
italic: "\x1B[3m",
|
|
@@ -25717,29 +25717,29 @@ ansi$4.style = {
|
|
|
25717
25717
|
"bg-brightCyan": "\x1B[106m",
|
|
25718
25718
|
"bg-brightWhite": "\x1B[107m"
|
|
25719
25719
|
};
|
|
25720
|
-
ansi$
|
|
25720
|
+
ansi$5.rgb = function(r, g2, b) {
|
|
25721
25721
|
return `\x1B[38;2;${r};${g2};${b}m`;
|
|
25722
25722
|
};
|
|
25723
|
-
ansi$
|
|
25723
|
+
ansi$5.bgRgb = function(r, g2, b) {
|
|
25724
25724
|
return `\x1B[48;2;${r};${g2};${b}m`;
|
|
25725
25725
|
};
|
|
25726
|
-
ansi$
|
|
25726
|
+
ansi$5.styles = function(styles2) {
|
|
25727
25727
|
styles2 = arrayify$5(styles2);
|
|
25728
25728
|
return styles2.map(function(effect) {
|
|
25729
25729
|
const rgbMatches = effect.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
|
|
25730
25730
|
const bgRgbMatches = effect.match(/bg-rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
|
|
25731
25731
|
if (bgRgbMatches) {
|
|
25732
25732
|
const [full, r, g2, b] = bgRgbMatches;
|
|
25733
|
-
return ansi$
|
|
25733
|
+
return ansi$5.bgRgb(r, g2, b);
|
|
25734
25734
|
} else if (rgbMatches) {
|
|
25735
25735
|
const [full, r, g2, b] = rgbMatches;
|
|
25736
|
-
return ansi$
|
|
25736
|
+
return ansi$5.rgb(r, g2, b);
|
|
25737
25737
|
} else {
|
|
25738
|
-
return ansi$
|
|
25738
|
+
return ansi$5.style[effect];
|
|
25739
25739
|
}
|
|
25740
25740
|
}).join("");
|
|
25741
25741
|
};
|
|
25742
|
-
ansi$
|
|
25742
|
+
ansi$5.format = function(str, styleArray) {
|
|
25743
25743
|
const re2 = /\[([\w\s-\(\),]+)\]{([^]*?)}/;
|
|
25744
25744
|
let matches;
|
|
25745
25745
|
str = String(str);
|
|
@@ -25747,18 +25747,18 @@ ansi$4.format = function(str, styleArray) {
|
|
|
25747
25747
|
while (matches = str.match(re2)) {
|
|
25748
25748
|
const inlineStyles = matches[1].split(/\s+/);
|
|
25749
25749
|
const inlineString = matches[2];
|
|
25750
|
-
str = str.replace(matches[0], ansi$
|
|
25750
|
+
str = str.replace(matches[0], ansi$5.format(inlineString, inlineStyles));
|
|
25751
25751
|
}
|
|
25752
|
-
return styleArray && styleArray.length ? ansi$
|
|
25752
|
+
return styleArray && styleArray.length ? ansi$5.styles(styleArray) + str + ansi$5.style.reset : str;
|
|
25753
25753
|
};
|
|
25754
|
-
ansi$
|
|
25754
|
+
ansi$5.cursor = {
|
|
25755
25755
|
/**
|
|
25756
25756
|
* Moves the cursor `lines` cells up. If the cursor is already at the edge of the screen, this has no effect
|
|
25757
25757
|
* @param [lines=1] {number}
|
|
25758
25758
|
* @return {string}
|
|
25759
25759
|
*/
|
|
25760
25760
|
up: /* @__PURE__ */ __name(function(lines) {
|
|
25761
|
-
return csi$
|
|
25761
|
+
return csi$5 + (lines || 1) + "A";
|
|
25762
25762
|
}, "up"),
|
|
25763
25763
|
/**
|
|
25764
25764
|
* Moves the cursor `lines` cells down. If the cursor is already at the edge of the screen, this has no effect
|
|
@@ -25766,7 +25766,7 @@ ansi$4.cursor = {
|
|
|
25766
25766
|
* @return {string}
|
|
25767
25767
|
*/
|
|
25768
25768
|
down: /* @__PURE__ */ __name(function(lines) {
|
|
25769
|
-
return csi$
|
|
25769
|
+
return csi$5 + (lines || 1) + "B";
|
|
25770
25770
|
}, "down"),
|
|
25771
25771
|
/**
|
|
25772
25772
|
* Moves the cursor `lines` cells forward. If the cursor is already at the edge of the screen, this has no effect
|
|
@@ -25774,7 +25774,7 @@ ansi$4.cursor = {
|
|
|
25774
25774
|
* @return {string}
|
|
25775
25775
|
*/
|
|
25776
25776
|
forward: /* @__PURE__ */ __name(function(lines) {
|
|
25777
|
-
return csi$
|
|
25777
|
+
return csi$5 + (lines || 1) + "C";
|
|
25778
25778
|
}, "forward"),
|
|
25779
25779
|
/**
|
|
25780
25780
|
* Moves the cursor `lines` cells back. If the cursor is already at the edge of the screen, this has no effect
|
|
@@ -25782,7 +25782,7 @@ ansi$4.cursor = {
|
|
|
25782
25782
|
* @return {string}
|
|
25783
25783
|
*/
|
|
25784
25784
|
back: /* @__PURE__ */ __name(function(lines) {
|
|
25785
|
-
return csi$
|
|
25785
|
+
return csi$5 + (lines || 1) + "D";
|
|
25786
25786
|
}, "back"),
|
|
25787
25787
|
/**
|
|
25788
25788
|
* Moves cursor to beginning of the line n lines down.
|
|
@@ -25790,7 +25790,7 @@ ansi$4.cursor = {
|
|
|
25790
25790
|
* @return {string}
|
|
25791
25791
|
*/
|
|
25792
25792
|
nextLine: /* @__PURE__ */ __name(function(lines) {
|
|
25793
|
-
return csi$
|
|
25793
|
+
return csi$5 + (lines || 1) + "E";
|
|
25794
25794
|
}, "nextLine"),
|
|
25795
25795
|
/**
|
|
25796
25796
|
* Moves cursor to beginning of the line n lines up.
|
|
@@ -25798,7 +25798,7 @@ ansi$4.cursor = {
|
|
|
25798
25798
|
* @return {string}
|
|
25799
25799
|
*/
|
|
25800
25800
|
previousLine: /* @__PURE__ */ __name(function(lines) {
|
|
25801
|
-
return csi$
|
|
25801
|
+
return csi$5 + (lines || 1) + "F";
|
|
25802
25802
|
}, "previousLine"),
|
|
25803
25803
|
/**
|
|
25804
25804
|
* Moves the cursor to column n.
|
|
@@ -25806,7 +25806,7 @@ ansi$4.cursor = {
|
|
|
25806
25806
|
* @return {string}
|
|
25807
25807
|
*/
|
|
25808
25808
|
horizontalAbsolute: /* @__PURE__ */ __name(function(n) {
|
|
25809
|
-
return csi$
|
|
25809
|
+
return csi$5 + n + "G";
|
|
25810
25810
|
}, "horizontalAbsolute"),
|
|
25811
25811
|
/**
|
|
25812
25812
|
* Moves the cursor to row n, column m. The values are 1-based, and default to 1 (top left corner) if omitted.
|
|
@@ -25815,25 +25815,25 @@ ansi$4.cursor = {
|
|
|
25815
25815
|
* @return {string}
|
|
25816
25816
|
*/
|
|
25817
25817
|
position: /* @__PURE__ */ __name(function(n, m) {
|
|
25818
|
-
return csi$
|
|
25818
|
+
return csi$5 + (n || 1) + ";" + (m || 1) + "H";
|
|
25819
25819
|
}, "position"),
|
|
25820
25820
|
/**
|
|
25821
25821
|
* Hides the cursor
|
|
25822
25822
|
*/
|
|
25823
|
-
hide: csi$
|
|
25823
|
+
hide: csi$5 + "?25l",
|
|
25824
25824
|
/**
|
|
25825
25825
|
* Shows the cursor
|
|
25826
25826
|
*/
|
|
25827
|
-
show: csi$
|
|
25827
|
+
show: csi$5 + "?25h"
|
|
25828
25828
|
};
|
|
25829
|
-
ansi$
|
|
25829
|
+
ansi$5.erase = {
|
|
25830
25830
|
/**
|
|
25831
25831
|
* Clears part of the screen. If n is 0 (or missing), clear from cursor to end of screen. If n is 1, clear from cursor to beginning of the screen. If n is 2, clear entire screen.
|
|
25832
25832
|
* @param n {number}
|
|
25833
25833
|
* @return {string}
|
|
25834
25834
|
*/
|
|
25835
25835
|
display: /* @__PURE__ */ __name(function(n) {
|
|
25836
|
-
return csi$
|
|
25836
|
+
return csi$5 + (n || 0) + "J";
|
|
25837
25837
|
}, "display"),
|
|
25838
25838
|
/**
|
|
25839
25839
|
* Erases part of the line. If n is zero (or missing), clear from cursor to the end of the line. If n is one, clear from cursor to beginning of the line. If n is two, clear entire line. Cursor position does not change.
|
|
@@ -25841,7 +25841,7 @@ ansi$4.erase = {
|
|
|
25841
25841
|
* @return {string}
|
|
25842
25842
|
*/
|
|
25843
25843
|
inLine: /* @__PURE__ */ __name(function(n) {
|
|
25844
|
-
return csi$
|
|
25844
|
+
return csi$5 + (n || 0) + "K";
|
|
25845
25845
|
}, "inLine")
|
|
25846
25846
|
};
|
|
25847
25847
|
const pkg$b = {
|
|
@@ -25874,11 +25874,11 @@ Commands:
|
|
|
25874
25874
|
try {
|
|
25875
25875
|
switch (args[0]) {
|
|
25876
25876
|
case "status":
|
|
25877
|
-
terminal.writeln(`${ansi$
|
|
25878
|
-
🔌 Charging: ${battery.charging ? ansi$
|
|
25879
|
-
⏱️ Charging Time: ${battery.chargingTime === Infinity ? ansi$
|
|
25880
|
-
⌛ Discharging Time: ${battery.dischargingTime === Infinity ? ansi$
|
|
25881
|
-
📊 Level: ${ansi$
|
|
25877
|
+
terminal.writeln(`${ansi$5.style.bold}🔋 Battery Status:${ansi$5.style.reset}
|
|
25878
|
+
🔌 Charging: ${battery.charging ? ansi$5.style.green + "Yes" : ansi$5.style.red + "No"}${ansi$5.style.reset}
|
|
25879
|
+
⏱️ Charging Time: ${battery.chargingTime === Infinity ? ansi$5.style.gray + "N/A" : ansi$5.style.cyan + battery.chargingTime}${ansi$5.style.reset}
|
|
25880
|
+
⌛ Discharging Time: ${battery.dischargingTime === Infinity ? ansi$5.style.gray + "N/A" : ansi$5.style.cyan + battery.dischargingTime}${ansi$5.style.reset}
|
|
25881
|
+
📊 Level: ${ansi$5.style[battery.level > 0.5 ? "green" : battery.level > 0.2 ? "yellow" : "red"]}${(battery.level * 100).toFixed(1)}%${ansi$5.style.reset}`);
|
|
25882
25882
|
break;
|
|
25883
25883
|
case "charging":
|
|
25884
25884
|
terminal.writeln(`${battery.charging}`);
|
|
@@ -26236,9 +26236,9 @@ function arrayify$4(input) {
|
|
|
26236
26236
|
}
|
|
26237
26237
|
}
|
|
26238
26238
|
__name(arrayify$4, "arrayify$4");
|
|
26239
|
-
const csi$
|
|
26240
|
-
const ansi$
|
|
26241
|
-
ansi$
|
|
26239
|
+
const csi$4 = "\x1B[";
|
|
26240
|
+
const ansi$4 = {};
|
|
26241
|
+
ansi$4.style = {
|
|
26242
26242
|
reset: "\x1B[0m",
|
|
26243
26243
|
bold: "\x1B[1m",
|
|
26244
26244
|
italic: "\x1B[3m",
|
|
@@ -26286,29 +26286,29 @@ ansi$3.style = {
|
|
|
26286
26286
|
"bg-brightCyan": "\x1B[106m",
|
|
26287
26287
|
"bg-brightWhite": "\x1B[107m"
|
|
26288
26288
|
};
|
|
26289
|
-
ansi$
|
|
26289
|
+
ansi$4.rgb = function(r, g2, b) {
|
|
26290
26290
|
return `\x1B[38;2;${r};${g2};${b}m`;
|
|
26291
26291
|
};
|
|
26292
|
-
ansi$
|
|
26292
|
+
ansi$4.bgRgb = function(r, g2, b) {
|
|
26293
26293
|
return `\x1B[48;2;${r};${g2};${b}m`;
|
|
26294
26294
|
};
|
|
26295
|
-
ansi$
|
|
26295
|
+
ansi$4.styles = function(styles2) {
|
|
26296
26296
|
styles2 = arrayify$4(styles2);
|
|
26297
26297
|
return styles2.map(function(effect) {
|
|
26298
26298
|
const rgbMatches = effect.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
|
|
26299
26299
|
const bgRgbMatches = effect.match(/bg-rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
|
|
26300
26300
|
if (bgRgbMatches) {
|
|
26301
26301
|
const [full, r, g2, b] = bgRgbMatches;
|
|
26302
|
-
return ansi$
|
|
26302
|
+
return ansi$4.bgRgb(r, g2, b);
|
|
26303
26303
|
} else if (rgbMatches) {
|
|
26304
26304
|
const [full, r, g2, b] = rgbMatches;
|
|
26305
|
-
return ansi$
|
|
26305
|
+
return ansi$4.rgb(r, g2, b);
|
|
26306
26306
|
} else {
|
|
26307
|
-
return ansi$
|
|
26307
|
+
return ansi$4.style[effect];
|
|
26308
26308
|
}
|
|
26309
26309
|
}).join("");
|
|
26310
26310
|
};
|
|
26311
|
-
ansi$
|
|
26311
|
+
ansi$4.format = function(str, styleArray) {
|
|
26312
26312
|
const re2 = /\[([\w\s-\(\),]+)\]{([^]*?)}/;
|
|
26313
26313
|
let matches;
|
|
26314
26314
|
str = String(str);
|
|
@@ -26316,18 +26316,18 @@ ansi$3.format = function(str, styleArray) {
|
|
|
26316
26316
|
while (matches = str.match(re2)) {
|
|
26317
26317
|
const inlineStyles = matches[1].split(/\s+/);
|
|
26318
26318
|
const inlineString = matches[2];
|
|
26319
|
-
str = str.replace(matches[0], ansi$
|
|
26319
|
+
str = str.replace(matches[0], ansi$4.format(inlineString, inlineStyles));
|
|
26320
26320
|
}
|
|
26321
|
-
return styleArray && styleArray.length ? ansi$
|
|
26321
|
+
return styleArray && styleArray.length ? ansi$4.styles(styleArray) + str + ansi$4.style.reset : str;
|
|
26322
26322
|
};
|
|
26323
|
-
ansi$
|
|
26323
|
+
ansi$4.cursor = {
|
|
26324
26324
|
/**
|
|
26325
26325
|
* Moves the cursor `lines` cells up. If the cursor is already at the edge of the screen, this has no effect
|
|
26326
26326
|
* @param [lines=1] {number}
|
|
26327
26327
|
* @return {string}
|
|
26328
26328
|
*/
|
|
26329
26329
|
up: /* @__PURE__ */ __name(function(lines) {
|
|
26330
|
-
return csi$
|
|
26330
|
+
return csi$4 + (lines || 1) + "A";
|
|
26331
26331
|
}, "up"),
|
|
26332
26332
|
/**
|
|
26333
26333
|
* Moves the cursor `lines` cells down. If the cursor is already at the edge of the screen, this has no effect
|
|
@@ -26335,7 +26335,7 @@ ansi$3.cursor = {
|
|
|
26335
26335
|
* @return {string}
|
|
26336
26336
|
*/
|
|
26337
26337
|
down: /* @__PURE__ */ __name(function(lines) {
|
|
26338
|
-
return csi$
|
|
26338
|
+
return csi$4 + (lines || 1) + "B";
|
|
26339
26339
|
}, "down"),
|
|
26340
26340
|
/**
|
|
26341
26341
|
* Moves the cursor `lines` cells forward. If the cursor is already at the edge of the screen, this has no effect
|
|
@@ -26343,7 +26343,7 @@ ansi$3.cursor = {
|
|
|
26343
26343
|
* @return {string}
|
|
26344
26344
|
*/
|
|
26345
26345
|
forward: /* @__PURE__ */ __name(function(lines) {
|
|
26346
|
-
return csi$
|
|
26346
|
+
return csi$4 + (lines || 1) + "C";
|
|
26347
26347
|
}, "forward"),
|
|
26348
26348
|
/**
|
|
26349
26349
|
* Moves the cursor `lines` cells back. If the cursor is already at the edge of the screen, this has no effect
|
|
@@ -26351,7 +26351,7 @@ ansi$3.cursor = {
|
|
|
26351
26351
|
* @return {string}
|
|
26352
26352
|
*/
|
|
26353
26353
|
back: /* @__PURE__ */ __name(function(lines) {
|
|
26354
|
-
return csi$
|
|
26354
|
+
return csi$4 + (lines || 1) + "D";
|
|
26355
26355
|
}, "back"),
|
|
26356
26356
|
/**
|
|
26357
26357
|
* Moves cursor to beginning of the line n lines down.
|
|
@@ -26359,7 +26359,7 @@ ansi$3.cursor = {
|
|
|
26359
26359
|
* @return {string}
|
|
26360
26360
|
*/
|
|
26361
26361
|
nextLine: /* @__PURE__ */ __name(function(lines) {
|
|
26362
|
-
return csi$
|
|
26362
|
+
return csi$4 + (lines || 1) + "E";
|
|
26363
26363
|
}, "nextLine"),
|
|
26364
26364
|
/**
|
|
26365
26365
|
* Moves cursor to beginning of the line n lines up.
|
|
@@ -26367,7 +26367,7 @@ ansi$3.cursor = {
|
|
|
26367
26367
|
* @return {string}
|
|
26368
26368
|
*/
|
|
26369
26369
|
previousLine: /* @__PURE__ */ __name(function(lines) {
|
|
26370
|
-
return csi$
|
|
26370
|
+
return csi$4 + (lines || 1) + "F";
|
|
26371
26371
|
}, "previousLine"),
|
|
26372
26372
|
/**
|
|
26373
26373
|
* Moves the cursor to column n.
|
|
@@ -26375,7 +26375,7 @@ ansi$3.cursor = {
|
|
|
26375
26375
|
* @return {string}
|
|
26376
26376
|
*/
|
|
26377
26377
|
horizontalAbsolute: /* @__PURE__ */ __name(function(n) {
|
|
26378
|
-
return csi$
|
|
26378
|
+
return csi$4 + n + "G";
|
|
26379
26379
|
}, "horizontalAbsolute"),
|
|
26380
26380
|
/**
|
|
26381
26381
|
* Moves the cursor to row n, column m. The values are 1-based, and default to 1 (top left corner) if omitted.
|
|
@@ -26384,25 +26384,25 @@ ansi$3.cursor = {
|
|
|
26384
26384
|
* @return {string}
|
|
26385
26385
|
*/
|
|
26386
26386
|
position: /* @__PURE__ */ __name(function(n, m) {
|
|
26387
|
-
return csi$
|
|
26387
|
+
return csi$4 + (n || 1) + ";" + (m || 1) + "H";
|
|
26388
26388
|
}, "position"),
|
|
26389
26389
|
/**
|
|
26390
26390
|
* Hides the cursor
|
|
26391
26391
|
*/
|
|
26392
|
-
hide: csi$
|
|
26392
|
+
hide: csi$4 + "?25l",
|
|
26393
26393
|
/**
|
|
26394
26394
|
* Shows the cursor
|
|
26395
26395
|
*/
|
|
26396
|
-
show: csi$
|
|
26396
|
+
show: csi$4 + "?25h"
|
|
26397
26397
|
};
|
|
26398
|
-
ansi$
|
|
26398
|
+
ansi$4.erase = {
|
|
26399
26399
|
/**
|
|
26400
26400
|
* Clears part of the screen. If n is 0 (or missing), clear from cursor to end of screen. If n is 1, clear from cursor to beginning of the screen. If n is 2, clear entire screen.
|
|
26401
26401
|
* @param n {number}
|
|
26402
26402
|
* @return {string}
|
|
26403
26403
|
*/
|
|
26404
26404
|
display: /* @__PURE__ */ __name(function(n) {
|
|
26405
|
-
return csi$
|
|
26405
|
+
return csi$4 + (n || 0) + "J";
|
|
26406
26406
|
}, "display"),
|
|
26407
26407
|
/**
|
|
26408
26408
|
* Erases part of the line. If n is zero (or missing), clear from cursor to the end of the line. If n is one, clear from cursor to beginning of the line. If n is two, clear entire line. Cursor position does not change.
|
|
@@ -26410,7 +26410,7 @@ ansi$3.erase = {
|
|
|
26410
26410
|
* @return {string}
|
|
26411
26411
|
*/
|
|
26412
26412
|
inLine: /* @__PURE__ */ __name(function(n) {
|
|
26413
|
-
return csi$
|
|
26413
|
+
return csi$4 + (n || 0) + "K";
|
|
26414
26414
|
}, "inLine")
|
|
26415
26415
|
};
|
|
26416
26416
|
const pkg$9 = {
|
|
@@ -26445,16 +26445,16 @@ Commands:
|
|
|
26445
26445
|
terminal.writeln("No gamepads connected");
|
|
26446
26446
|
break;
|
|
26447
26447
|
}
|
|
26448
|
-
terminal.writeln(`${ansi$
|
|
26448
|
+
terminal.writeln(`${ansi$4.style.bold}🎮 Connected Gamepads:${ansi$4.style.reset}`);
|
|
26449
26449
|
connectedPads.forEach((gamepad2) => {
|
|
26450
26450
|
if (!gamepad2)
|
|
26451
26451
|
return;
|
|
26452
26452
|
terminal.writeln(`
|
|
26453
|
-
🎮 Index: ${ansi$
|
|
26454
|
-
📝 ID: ${ansi$
|
|
26455
|
-
🔌 Connected: ${ansi$
|
|
26456
|
-
🎯 Buttons: ${ansi$
|
|
26457
|
-
📊 Axes: ${ansi$
|
|
26453
|
+
🎮 Index: ${ansi$4.style.cyan}${gamepad2.index}${ansi$4.style.reset}
|
|
26454
|
+
📝 ID: ${ansi$4.style.cyan}${gamepad2.id}${ansi$4.style.reset}
|
|
26455
|
+
🔌 Connected: ${ansi$4.style.cyan}${gamepad2.connected}${ansi$4.style.reset}
|
|
26456
|
+
🎯 Buttons: ${ansi$4.style.cyan}${gamepad2.buttons.length}${ansi$4.style.reset}
|
|
26457
|
+
📊 Axes: ${ansi$4.style.cyan}${gamepad2.axes.length}${ansi$4.style.reset}`);
|
|
26458
26458
|
});
|
|
26459
26459
|
break;
|
|
26460
26460
|
case "info":
|
|
@@ -26469,7 +26469,7 @@ Commands:
|
|
|
26469
26469
|
terminal.writeln(`No gamepad found at index ${index}`);
|
|
26470
26470
|
return 1;
|
|
26471
26471
|
}
|
|
26472
|
-
terminal.writeln(`${ansi$
|
|
26472
|
+
terminal.writeln(`${ansi$4.style.bold}Gamepad Information:${ansi$4.style.reset}
|
|
26473
26473
|
Index: ${gamepad.index}
|
|
26474
26474
|
ID: ${gamepad.id}
|
|
26475
26475
|
Connected: ${gamepad.connected}
|
|
@@ -26529,9 +26529,9 @@ function arrayify$3(input) {
|
|
|
26529
26529
|
}
|
|
26530
26530
|
}
|
|
26531
26531
|
__name(arrayify$3, "arrayify$3");
|
|
26532
|
-
const csi$
|
|
26533
|
-
const ansi$
|
|
26534
|
-
ansi$
|
|
26532
|
+
const csi$3 = "\x1B[";
|
|
26533
|
+
const ansi$3 = {};
|
|
26534
|
+
ansi$3.style = {
|
|
26535
26535
|
reset: "\x1B[0m",
|
|
26536
26536
|
bold: "\x1B[1m",
|
|
26537
26537
|
italic: "\x1B[3m",
|
|
@@ -26579,29 +26579,29 @@ ansi$2.style = {
|
|
|
26579
26579
|
"bg-brightCyan": "\x1B[106m",
|
|
26580
26580
|
"bg-brightWhite": "\x1B[107m"
|
|
26581
26581
|
};
|
|
26582
|
-
ansi$
|
|
26582
|
+
ansi$3.rgb = function(r, g2, b) {
|
|
26583
26583
|
return `\x1B[38;2;${r};${g2};${b}m`;
|
|
26584
26584
|
};
|
|
26585
|
-
ansi$
|
|
26585
|
+
ansi$3.bgRgb = function(r, g2, b) {
|
|
26586
26586
|
return `\x1B[48;2;${r};${g2};${b}m`;
|
|
26587
26587
|
};
|
|
26588
|
-
ansi$
|
|
26588
|
+
ansi$3.styles = function(styles2) {
|
|
26589
26589
|
styles2 = arrayify$3(styles2);
|
|
26590
26590
|
return styles2.map(function(effect) {
|
|
26591
26591
|
const rgbMatches = effect.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
|
|
26592
26592
|
const bgRgbMatches = effect.match(/bg-rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
|
|
26593
26593
|
if (bgRgbMatches) {
|
|
26594
26594
|
const [full, r, g2, b] = bgRgbMatches;
|
|
26595
|
-
return ansi$
|
|
26595
|
+
return ansi$3.bgRgb(r, g2, b);
|
|
26596
26596
|
} else if (rgbMatches) {
|
|
26597
26597
|
const [full, r, g2, b] = rgbMatches;
|
|
26598
|
-
return ansi$
|
|
26598
|
+
return ansi$3.rgb(r, g2, b);
|
|
26599
26599
|
} else {
|
|
26600
|
-
return ansi$
|
|
26600
|
+
return ansi$3.style[effect];
|
|
26601
26601
|
}
|
|
26602
26602
|
}).join("");
|
|
26603
26603
|
};
|
|
26604
|
-
ansi$
|
|
26604
|
+
ansi$3.format = function(str, styleArray) {
|
|
26605
26605
|
const re2 = /\[([\w\s-\(\),]+)\]{([^]*?)}/;
|
|
26606
26606
|
let matches;
|
|
26607
26607
|
str = String(str);
|
|
@@ -26609,18 +26609,18 @@ ansi$2.format = function(str, styleArray) {
|
|
|
26609
26609
|
while (matches = str.match(re2)) {
|
|
26610
26610
|
const inlineStyles = matches[1].split(/\s+/);
|
|
26611
26611
|
const inlineString = matches[2];
|
|
26612
|
-
str = str.replace(matches[0], ansi$
|
|
26612
|
+
str = str.replace(matches[0], ansi$3.format(inlineString, inlineStyles));
|
|
26613
26613
|
}
|
|
26614
|
-
return styleArray && styleArray.length ? ansi$
|
|
26614
|
+
return styleArray && styleArray.length ? ansi$3.styles(styleArray) + str + ansi$3.style.reset : str;
|
|
26615
26615
|
};
|
|
26616
|
-
ansi$
|
|
26616
|
+
ansi$3.cursor = {
|
|
26617
26617
|
/**
|
|
26618
26618
|
* Moves the cursor `lines` cells up. If the cursor is already at the edge of the screen, this has no effect
|
|
26619
26619
|
* @param [lines=1] {number}
|
|
26620
26620
|
* @return {string}
|
|
26621
26621
|
*/
|
|
26622
26622
|
up: /* @__PURE__ */ __name(function(lines) {
|
|
26623
|
-
return csi$
|
|
26623
|
+
return csi$3 + (lines || 1) + "A";
|
|
26624
26624
|
}, "up"),
|
|
26625
26625
|
/**
|
|
26626
26626
|
* Moves the cursor `lines` cells down. If the cursor is already at the edge of the screen, this has no effect
|
|
@@ -26628,7 +26628,7 @@ ansi$2.cursor = {
|
|
|
26628
26628
|
* @return {string}
|
|
26629
26629
|
*/
|
|
26630
26630
|
down: /* @__PURE__ */ __name(function(lines) {
|
|
26631
|
-
return csi$
|
|
26631
|
+
return csi$3 + (lines || 1) + "B";
|
|
26632
26632
|
}, "down"),
|
|
26633
26633
|
/**
|
|
26634
26634
|
* Moves the cursor `lines` cells forward. If the cursor is already at the edge of the screen, this has no effect
|
|
@@ -26636,7 +26636,7 @@ ansi$2.cursor = {
|
|
|
26636
26636
|
* @return {string}
|
|
26637
26637
|
*/
|
|
26638
26638
|
forward: /* @__PURE__ */ __name(function(lines) {
|
|
26639
|
-
return csi$
|
|
26639
|
+
return csi$3 + (lines || 1) + "C";
|
|
26640
26640
|
}, "forward"),
|
|
26641
26641
|
/**
|
|
26642
26642
|
* Moves the cursor `lines` cells back. If the cursor is already at the edge of the screen, this has no effect
|
|
@@ -26644,7 +26644,7 @@ ansi$2.cursor = {
|
|
|
26644
26644
|
* @return {string}
|
|
26645
26645
|
*/
|
|
26646
26646
|
back: /* @__PURE__ */ __name(function(lines) {
|
|
26647
|
-
return csi$
|
|
26647
|
+
return csi$3 + (lines || 1) + "D";
|
|
26648
26648
|
}, "back"),
|
|
26649
26649
|
/**
|
|
26650
26650
|
* Moves cursor to beginning of the line n lines down.
|
|
@@ -26652,7 +26652,7 @@ ansi$2.cursor = {
|
|
|
26652
26652
|
* @return {string}
|
|
26653
26653
|
*/
|
|
26654
26654
|
nextLine: /* @__PURE__ */ __name(function(lines) {
|
|
26655
|
-
return csi$
|
|
26655
|
+
return csi$3 + (lines || 1) + "E";
|
|
26656
26656
|
}, "nextLine"),
|
|
26657
26657
|
/**
|
|
26658
26658
|
* Moves cursor to beginning of the line n lines up.
|
|
@@ -26660,7 +26660,7 @@ ansi$2.cursor = {
|
|
|
26660
26660
|
* @return {string}
|
|
26661
26661
|
*/
|
|
26662
26662
|
previousLine: /* @__PURE__ */ __name(function(lines) {
|
|
26663
|
-
return csi$
|
|
26663
|
+
return csi$3 + (lines || 1) + "F";
|
|
26664
26664
|
}, "previousLine"),
|
|
26665
26665
|
/**
|
|
26666
26666
|
* Moves the cursor to column n.
|
|
@@ -26668,7 +26668,7 @@ ansi$2.cursor = {
|
|
|
26668
26668
|
* @return {string}
|
|
26669
26669
|
*/
|
|
26670
26670
|
horizontalAbsolute: /* @__PURE__ */ __name(function(n) {
|
|
26671
|
-
return csi$
|
|
26671
|
+
return csi$3 + n + "G";
|
|
26672
26672
|
}, "horizontalAbsolute"),
|
|
26673
26673
|
/**
|
|
26674
26674
|
* Moves the cursor to row n, column m. The values are 1-based, and default to 1 (top left corner) if omitted.
|
|
@@ -26677,25 +26677,25 @@ ansi$2.cursor = {
|
|
|
26677
26677
|
* @return {string}
|
|
26678
26678
|
*/
|
|
26679
26679
|
position: /* @__PURE__ */ __name(function(n, m) {
|
|
26680
|
-
return csi$
|
|
26680
|
+
return csi$3 + (n || 1) + ";" + (m || 1) + "H";
|
|
26681
26681
|
}, "position"),
|
|
26682
26682
|
/**
|
|
26683
26683
|
* Hides the cursor
|
|
26684
26684
|
*/
|
|
26685
|
-
hide: csi$
|
|
26685
|
+
hide: csi$3 + "?25l",
|
|
26686
26686
|
/**
|
|
26687
26687
|
* Shows the cursor
|
|
26688
26688
|
*/
|
|
26689
|
-
show: csi$
|
|
26689
|
+
show: csi$3 + "?25h"
|
|
26690
26690
|
};
|
|
26691
|
-
ansi$
|
|
26691
|
+
ansi$3.erase = {
|
|
26692
26692
|
/**
|
|
26693
26693
|
* Clears part of the screen. If n is 0 (or missing), clear from cursor to end of screen. If n is 1, clear from cursor to beginning of the screen. If n is 2, clear entire screen.
|
|
26694
26694
|
* @param n {number}
|
|
26695
26695
|
* @return {string}
|
|
26696
26696
|
*/
|
|
26697
26697
|
display: /* @__PURE__ */ __name(function(n) {
|
|
26698
|
-
return csi$
|
|
26698
|
+
return csi$3 + (n || 0) + "J";
|
|
26699
26699
|
}, "display"),
|
|
26700
26700
|
/**
|
|
26701
26701
|
* Erases part of the line. If n is zero (or missing), clear from cursor to the end of the line. If n is one, clear from cursor to beginning of the line. If n is two, clear entire line. Cursor position does not change.
|
|
@@ -26703,7 +26703,7 @@ ansi$2.erase = {
|
|
|
26703
26703
|
* @return {string}
|
|
26704
26704
|
*/
|
|
26705
26705
|
inLine: /* @__PURE__ */ __name(function(n) {
|
|
26706
|
-
return csi$
|
|
26706
|
+
return csi$3 + (n || 0) + "K";
|
|
26707
26707
|
}, "inLine")
|
|
26708
26708
|
};
|
|
26709
26709
|
const pkg$8 = {
|
|
@@ -26736,14 +26736,14 @@ Commands:
|
|
|
26736
26736
|
const position = await new Promise((resolve2, reject) => {
|
|
26737
26737
|
navigator.geolocation.getCurrentPosition(resolve2, reject);
|
|
26738
26738
|
});
|
|
26739
|
-
terminal.writeln(`${ansi$
|
|
26740
|
-
🌍 Latitude: ${ansi$
|
|
26741
|
-
🌍 Longitude: ${ansi$
|
|
26742
|
-
📏 Accuracy: ${ansi$
|
|
26743
|
-
🏔️ Altitude: ${position.coords.altitude ? ansi$
|
|
26744
|
-
🎯 Altitude Accuracy: ${position.coords.altitudeAccuracy ? ansi$
|
|
26745
|
-
🧭 Heading: ${position.coords.heading ? ansi$
|
|
26746
|
-
🚀 Speed: ${position.coords.speed ? ansi$
|
|
26739
|
+
terminal.writeln(`${ansi$3.style.bold}📍 Current Position:${ansi$3.style.reset}
|
|
26740
|
+
🌍 Latitude: ${ansi$3.style.cyan}${position.coords.latitude}${ansi$3.style.reset}
|
|
26741
|
+
🌍 Longitude: ${ansi$3.style.cyan}${position.coords.longitude}${ansi$3.style.reset}
|
|
26742
|
+
📏 Accuracy: ${ansi$3.style.cyan}${position.coords.accuracy}m${ansi$3.style.reset}
|
|
26743
|
+
🏔️ Altitude: ${position.coords.altitude ? ansi$3.style.cyan + position.coords.altitude + "m" : ansi$3.style.gray + "N/A"}${ansi$3.style.reset}
|
|
26744
|
+
🎯 Altitude Accuracy: ${position.coords.altitudeAccuracy ? ansi$3.style.cyan + position.coords.altitudeAccuracy + "m" : ansi$3.style.gray + "N/A"}${ansi$3.style.reset}
|
|
26745
|
+
🧭 Heading: ${position.coords.heading ? ansi$3.style.cyan + position.coords.heading + "°" : ansi$3.style.gray + "N/A"}${ansi$3.style.reset}
|
|
26746
|
+
🚀 Speed: ${position.coords.speed ? ansi$3.style.cyan + position.coords.speed + "m/s" : ansi$3.style.gray + "N/A"}${ansi$3.style.reset}`);
|
|
26747
26747
|
break;
|
|
26748
26748
|
case "watch":
|
|
26749
26749
|
const watchId = navigator.geolocation.watchPosition(
|
|
@@ -27009,9 +27009,9 @@ function arrayify$2(input) {
|
|
|
27009
27009
|
}
|
|
27010
27010
|
}
|
|
27011
27011
|
__name(arrayify$2, "arrayify$2");
|
|
27012
|
-
const csi$
|
|
27013
|
-
const ansi$
|
|
27014
|
-
ansi$
|
|
27012
|
+
const csi$2 = "\x1B[";
|
|
27013
|
+
const ansi$2 = {};
|
|
27014
|
+
ansi$2.style = {
|
|
27015
27015
|
reset: "\x1B[0m",
|
|
27016
27016
|
bold: "\x1B[1m",
|
|
27017
27017
|
italic: "\x1B[3m",
|
|
@@ -27059,29 +27059,29 @@ ansi$1.style = {
|
|
|
27059
27059
|
"bg-brightCyan": "\x1B[106m",
|
|
27060
27060
|
"bg-brightWhite": "\x1B[107m"
|
|
27061
27061
|
};
|
|
27062
|
-
ansi$
|
|
27062
|
+
ansi$2.rgb = function(r, g2, b) {
|
|
27063
27063
|
return `\x1B[38;2;${r};${g2};${b}m`;
|
|
27064
27064
|
};
|
|
27065
|
-
ansi$
|
|
27065
|
+
ansi$2.bgRgb = function(r, g2, b) {
|
|
27066
27066
|
return `\x1B[48;2;${r};${g2};${b}m`;
|
|
27067
27067
|
};
|
|
27068
|
-
ansi$
|
|
27068
|
+
ansi$2.styles = function(styles2) {
|
|
27069
27069
|
styles2 = arrayify$2(styles2);
|
|
27070
27070
|
return styles2.map(function(effect) {
|
|
27071
27071
|
const rgbMatches = effect.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
|
|
27072
27072
|
const bgRgbMatches = effect.match(/bg-rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
|
|
27073
27073
|
if (bgRgbMatches) {
|
|
27074
27074
|
const [full, r, g2, b] = bgRgbMatches;
|
|
27075
|
-
return ansi$
|
|
27075
|
+
return ansi$2.bgRgb(r, g2, b);
|
|
27076
27076
|
} else if (rgbMatches) {
|
|
27077
27077
|
const [full, r, g2, b] = rgbMatches;
|
|
27078
|
-
return ansi$
|
|
27078
|
+
return ansi$2.rgb(r, g2, b);
|
|
27079
27079
|
} else {
|
|
27080
|
-
return ansi$
|
|
27080
|
+
return ansi$2.style[effect];
|
|
27081
27081
|
}
|
|
27082
27082
|
}).join("");
|
|
27083
27083
|
};
|
|
27084
|
-
ansi$
|
|
27084
|
+
ansi$2.format = function(str, styleArray) {
|
|
27085
27085
|
const re2 = /\[([\w\s-\(\),]+)\]{([^]*?)}/;
|
|
27086
27086
|
let matches;
|
|
27087
27087
|
str = String(str);
|
|
@@ -27089,18 +27089,18 @@ ansi$1.format = function(str, styleArray) {
|
|
|
27089
27089
|
while (matches = str.match(re2)) {
|
|
27090
27090
|
const inlineStyles = matches[1].split(/\s+/);
|
|
27091
27091
|
const inlineString = matches[2];
|
|
27092
|
-
str = str.replace(matches[0], ansi$
|
|
27092
|
+
str = str.replace(matches[0], ansi$2.format(inlineString, inlineStyles));
|
|
27093
27093
|
}
|
|
27094
|
-
return styleArray && styleArray.length ? ansi$
|
|
27094
|
+
return styleArray && styleArray.length ? ansi$2.styles(styleArray) + str + ansi$2.style.reset : str;
|
|
27095
27095
|
};
|
|
27096
|
-
ansi$
|
|
27096
|
+
ansi$2.cursor = {
|
|
27097
27097
|
/**
|
|
27098
27098
|
* Moves the cursor `lines` cells up. If the cursor is already at the edge of the screen, this has no effect
|
|
27099
27099
|
* @param [lines=1] {number}
|
|
27100
27100
|
* @return {string}
|
|
27101
27101
|
*/
|
|
27102
27102
|
up: /* @__PURE__ */ __name(function(lines) {
|
|
27103
|
-
return csi$
|
|
27103
|
+
return csi$2 + (lines || 1) + "A";
|
|
27104
27104
|
}, "up"),
|
|
27105
27105
|
/**
|
|
27106
27106
|
* Moves the cursor `lines` cells down. If the cursor is already at the edge of the screen, this has no effect
|
|
@@ -27108,7 +27108,7 @@ ansi$1.cursor = {
|
|
|
27108
27108
|
* @return {string}
|
|
27109
27109
|
*/
|
|
27110
27110
|
down: /* @__PURE__ */ __name(function(lines) {
|
|
27111
|
-
return csi$
|
|
27111
|
+
return csi$2 + (lines || 1) + "B";
|
|
27112
27112
|
}, "down"),
|
|
27113
27113
|
/**
|
|
27114
27114
|
* Moves the cursor `lines` cells forward. If the cursor is already at the edge of the screen, this has no effect
|
|
@@ -27116,7 +27116,7 @@ ansi$1.cursor = {
|
|
|
27116
27116
|
* @return {string}
|
|
27117
27117
|
*/
|
|
27118
27118
|
forward: /* @__PURE__ */ __name(function(lines) {
|
|
27119
|
-
return csi$
|
|
27119
|
+
return csi$2 + (lines || 1) + "C";
|
|
27120
27120
|
}, "forward"),
|
|
27121
27121
|
/**
|
|
27122
27122
|
* Moves the cursor `lines` cells back. If the cursor is already at the edge of the screen, this has no effect
|
|
@@ -27124,7 +27124,7 @@ ansi$1.cursor = {
|
|
|
27124
27124
|
* @return {string}
|
|
27125
27125
|
*/
|
|
27126
27126
|
back: /* @__PURE__ */ __name(function(lines) {
|
|
27127
|
-
return csi$
|
|
27127
|
+
return csi$2 + (lines || 1) + "D";
|
|
27128
27128
|
}, "back"),
|
|
27129
27129
|
/**
|
|
27130
27130
|
* Moves cursor to beginning of the line n lines down.
|
|
@@ -27132,7 +27132,7 @@ ansi$1.cursor = {
|
|
|
27132
27132
|
* @return {string}
|
|
27133
27133
|
*/
|
|
27134
27134
|
nextLine: /* @__PURE__ */ __name(function(lines) {
|
|
27135
|
-
return csi$
|
|
27135
|
+
return csi$2 + (lines || 1) + "E";
|
|
27136
27136
|
}, "nextLine"),
|
|
27137
27137
|
/**
|
|
27138
27138
|
* Moves cursor to beginning of the line n lines up.
|
|
@@ -27140,7 +27140,7 @@ ansi$1.cursor = {
|
|
|
27140
27140
|
* @return {string}
|
|
27141
27141
|
*/
|
|
27142
27142
|
previousLine: /* @__PURE__ */ __name(function(lines) {
|
|
27143
|
-
return csi$
|
|
27143
|
+
return csi$2 + (lines || 1) + "F";
|
|
27144
27144
|
}, "previousLine"),
|
|
27145
27145
|
/**
|
|
27146
27146
|
* Moves the cursor to column n.
|
|
@@ -27148,7 +27148,7 @@ ansi$1.cursor = {
|
|
|
27148
27148
|
* @return {string}
|
|
27149
27149
|
*/
|
|
27150
27150
|
horizontalAbsolute: /* @__PURE__ */ __name(function(n) {
|
|
27151
|
-
return csi$
|
|
27151
|
+
return csi$2 + n + "G";
|
|
27152
27152
|
}, "horizontalAbsolute"),
|
|
27153
27153
|
/**
|
|
27154
27154
|
* Moves the cursor to row n, column m. The values are 1-based, and default to 1 (top left corner) if omitted.
|
|
@@ -27157,25 +27157,25 @@ ansi$1.cursor = {
|
|
|
27157
27157
|
* @return {string}
|
|
27158
27158
|
*/
|
|
27159
27159
|
position: /* @__PURE__ */ __name(function(n, m) {
|
|
27160
|
-
return csi$
|
|
27160
|
+
return csi$2 + (n || 1) + ";" + (m || 1) + "H";
|
|
27161
27161
|
}, "position"),
|
|
27162
27162
|
/**
|
|
27163
27163
|
* Hides the cursor
|
|
27164
27164
|
*/
|
|
27165
|
-
hide: csi$
|
|
27165
|
+
hide: csi$2 + "?25l",
|
|
27166
27166
|
/**
|
|
27167
27167
|
* Shows the cursor
|
|
27168
27168
|
*/
|
|
27169
|
-
show: csi$
|
|
27169
|
+
show: csi$2 + "?25h"
|
|
27170
27170
|
};
|
|
27171
|
-
ansi$
|
|
27171
|
+
ansi$2.erase = {
|
|
27172
27172
|
/**
|
|
27173
27173
|
* Clears part of the screen. If n is 0 (or missing), clear from cursor to end of screen. If n is 1, clear from cursor to beginning of the screen. If n is 2, clear entire screen.
|
|
27174
27174
|
* @param n {number}
|
|
27175
27175
|
* @return {string}
|
|
27176
27176
|
*/
|
|
27177
27177
|
display: /* @__PURE__ */ __name(function(n) {
|
|
27178
|
-
return csi$
|
|
27178
|
+
return csi$2 + (n || 0) + "J";
|
|
27179
27179
|
}, "display"),
|
|
27180
27180
|
/**
|
|
27181
27181
|
* Erases part of the line. If n is zero (or missing), clear from cursor to the end of the line. If n is one, clear from cursor to beginning of the line. If n is two, clear entire line. Cursor position does not change.
|
|
@@ -27183,7 +27183,7 @@ ansi$1.erase = {
|
|
|
27183
27183
|
* @return {string}
|
|
27184
27184
|
*/
|
|
27185
27185
|
inLine: /* @__PURE__ */ __name(function(n) {
|
|
27186
|
-
return csi$
|
|
27186
|
+
return csi$2 + (n || 0) + "K";
|
|
27187
27187
|
}, "inLine")
|
|
27188
27188
|
};
|
|
27189
27189
|
const pkg$6 = {
|
|
@@ -27223,13 +27223,13 @@ Commands:
|
|
|
27223
27223
|
terminal.writeln("No HID devices connected");
|
|
27224
27224
|
break;
|
|
27225
27225
|
}
|
|
27226
|
-
terminal.writeln(`${ansi$
|
|
27226
|
+
terminal.writeln(`${ansi$2.style.bold}🎮 Connected HID Devices:${ansi$2.style.reset}`);
|
|
27227
27227
|
uniqueDevices.forEach((device2) => {
|
|
27228
27228
|
terminal.writeln(`
|
|
27229
|
-
📱 Device ID: ${ansi$
|
|
27230
|
-
📝 Name: ${ansi$
|
|
27231
|
-
🏢 Manufacturer: ${ansi$
|
|
27232
|
-
🔌 Connected: ${ansi$
|
|
27229
|
+
📱 Device ID: ${ansi$2.style.cyan}${device2.productId}${ansi$2.style.reset}
|
|
27230
|
+
📝 Name: ${ansi$2.style.cyan}${device2.productName}${ansi$2.style.reset}
|
|
27231
|
+
🏢 Manufacturer: ${ansi$2.style.cyan}${device2.vendorId}${ansi$2.style.reset}
|
|
27232
|
+
🔌 Connected: ${ansi$2.style.cyan}${device2.opened ? "Yes" : "No"}${ansi$2.style.reset}`);
|
|
27233
27233
|
});
|
|
27234
27234
|
break;
|
|
27235
27235
|
case "request":
|
|
@@ -27286,7 +27286,7 @@ Commands:
|
|
|
27286
27286
|
terminal.writeln(`Device with ID ${args[1]} not found`);
|
|
27287
27287
|
return 1;
|
|
27288
27288
|
}
|
|
27289
|
-
terminal.writeln(`${ansi$
|
|
27289
|
+
terminal.writeln(`${ansi$2.style.bold}Device Information:${ansi$2.style.reset}
|
|
27290
27290
|
Product ID: ${targetDevice.productId}
|
|
27291
27291
|
Vendor ID: ${targetDevice.vendorId}
|
|
27292
27292
|
Product Name: ${targetDevice.productName}
|
|
@@ -27627,9 +27627,9 @@ function arrayify$1(input) {
|
|
|
27627
27627
|
}
|
|
27628
27628
|
}
|
|
27629
27629
|
__name(arrayify$1, "arrayify$1");
|
|
27630
|
-
const csi = "\x1B[";
|
|
27631
|
-
const ansi = {};
|
|
27632
|
-
ansi.style = {
|
|
27630
|
+
const csi$1 = "\x1B[";
|
|
27631
|
+
const ansi$1 = {};
|
|
27632
|
+
ansi$1.style = {
|
|
27633
27633
|
reset: "\x1B[0m",
|
|
27634
27634
|
bold: "\x1B[1m",
|
|
27635
27635
|
italic: "\x1B[3m",
|
|
@@ -27677,29 +27677,29 @@ ansi.style = {
|
|
|
27677
27677
|
"bg-brightCyan": "\x1B[106m",
|
|
27678
27678
|
"bg-brightWhite": "\x1B[107m"
|
|
27679
27679
|
};
|
|
27680
|
-
ansi.rgb = function(r, g2, b) {
|
|
27680
|
+
ansi$1.rgb = function(r, g2, b) {
|
|
27681
27681
|
return `\x1B[38;2;${r};${g2};${b}m`;
|
|
27682
27682
|
};
|
|
27683
|
-
ansi.bgRgb = function(r, g2, b) {
|
|
27683
|
+
ansi$1.bgRgb = function(r, g2, b) {
|
|
27684
27684
|
return `\x1B[48;2;${r};${g2};${b}m`;
|
|
27685
27685
|
};
|
|
27686
|
-
ansi.styles = function(styles2) {
|
|
27686
|
+
ansi$1.styles = function(styles2) {
|
|
27687
27687
|
styles2 = arrayify$1(styles2);
|
|
27688
27688
|
return styles2.map(function(effect) {
|
|
27689
27689
|
const rgbMatches = effect.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
|
|
27690
27690
|
const bgRgbMatches = effect.match(/bg-rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
|
|
27691
27691
|
if (bgRgbMatches) {
|
|
27692
27692
|
const [full, r, g2, b] = bgRgbMatches;
|
|
27693
|
-
return ansi.bgRgb(r, g2, b);
|
|
27693
|
+
return ansi$1.bgRgb(r, g2, b);
|
|
27694
27694
|
} else if (rgbMatches) {
|
|
27695
27695
|
const [full, r, g2, b] = rgbMatches;
|
|
27696
|
-
return ansi.rgb(r, g2, b);
|
|
27696
|
+
return ansi$1.rgb(r, g2, b);
|
|
27697
27697
|
} else {
|
|
27698
|
-
return ansi.style[effect];
|
|
27698
|
+
return ansi$1.style[effect];
|
|
27699
27699
|
}
|
|
27700
27700
|
}).join("");
|
|
27701
27701
|
};
|
|
27702
|
-
ansi.format = function(str, styleArray) {
|
|
27702
|
+
ansi$1.format = function(str, styleArray) {
|
|
27703
27703
|
const re2 = /\[([\w\s-\(\),]+)\]{([^]*?)}/;
|
|
27704
27704
|
let matches;
|
|
27705
27705
|
str = String(str);
|
|
@@ -27707,18 +27707,18 @@ ansi.format = function(str, styleArray) {
|
|
|
27707
27707
|
while (matches = str.match(re2)) {
|
|
27708
27708
|
const inlineStyles = matches[1].split(/\s+/);
|
|
27709
27709
|
const inlineString = matches[2];
|
|
27710
|
-
str = str.replace(matches[0], ansi.format(inlineString, inlineStyles));
|
|
27710
|
+
str = str.replace(matches[0], ansi$1.format(inlineString, inlineStyles));
|
|
27711
27711
|
}
|
|
27712
|
-
return styleArray && styleArray.length ? ansi.styles(styleArray) + str + ansi.style.reset : str;
|
|
27712
|
+
return styleArray && styleArray.length ? ansi$1.styles(styleArray) + str + ansi$1.style.reset : str;
|
|
27713
27713
|
};
|
|
27714
|
-
ansi.cursor = {
|
|
27714
|
+
ansi$1.cursor = {
|
|
27715
27715
|
/**
|
|
27716
27716
|
* Moves the cursor `lines` cells up. If the cursor is already at the edge of the screen, this has no effect
|
|
27717
27717
|
* @param [lines=1] {number}
|
|
27718
27718
|
* @return {string}
|
|
27719
27719
|
*/
|
|
27720
27720
|
up: /* @__PURE__ */ __name(function(lines) {
|
|
27721
|
-
return csi + (lines || 1) + "A";
|
|
27721
|
+
return csi$1 + (lines || 1) + "A";
|
|
27722
27722
|
}, "up"),
|
|
27723
27723
|
/**
|
|
27724
27724
|
* Moves the cursor `lines` cells down. If the cursor is already at the edge of the screen, this has no effect
|
|
@@ -27726,7 +27726,7 @@ ansi.cursor = {
|
|
|
27726
27726
|
* @return {string}
|
|
27727
27727
|
*/
|
|
27728
27728
|
down: /* @__PURE__ */ __name(function(lines) {
|
|
27729
|
-
return csi + (lines || 1) + "B";
|
|
27729
|
+
return csi$1 + (lines || 1) + "B";
|
|
27730
27730
|
}, "down"),
|
|
27731
27731
|
/**
|
|
27732
27732
|
* Moves the cursor `lines` cells forward. If the cursor is already at the edge of the screen, this has no effect
|
|
@@ -27734,7 +27734,7 @@ ansi.cursor = {
|
|
|
27734
27734
|
* @return {string}
|
|
27735
27735
|
*/
|
|
27736
27736
|
forward: /* @__PURE__ */ __name(function(lines) {
|
|
27737
|
-
return csi + (lines || 1) + "C";
|
|
27737
|
+
return csi$1 + (lines || 1) + "C";
|
|
27738
27738
|
}, "forward"),
|
|
27739
27739
|
/**
|
|
27740
27740
|
* Moves the cursor `lines` cells back. If the cursor is already at the edge of the screen, this has no effect
|
|
@@ -27742,7 +27742,7 @@ ansi.cursor = {
|
|
|
27742
27742
|
* @return {string}
|
|
27743
27743
|
*/
|
|
27744
27744
|
back: /* @__PURE__ */ __name(function(lines) {
|
|
27745
|
-
return csi + (lines || 1) + "D";
|
|
27745
|
+
return csi$1 + (lines || 1) + "D";
|
|
27746
27746
|
}, "back"),
|
|
27747
27747
|
/**
|
|
27748
27748
|
* Moves cursor to beginning of the line n lines down.
|
|
@@ -27750,7 +27750,7 @@ ansi.cursor = {
|
|
|
27750
27750
|
* @return {string}
|
|
27751
27751
|
*/
|
|
27752
27752
|
nextLine: /* @__PURE__ */ __name(function(lines) {
|
|
27753
|
-
return csi + (lines || 1) + "E";
|
|
27753
|
+
return csi$1 + (lines || 1) + "E";
|
|
27754
27754
|
}, "nextLine"),
|
|
27755
27755
|
/**
|
|
27756
27756
|
* Moves cursor to beginning of the line n lines up.
|
|
@@ -27758,7 +27758,7 @@ ansi.cursor = {
|
|
|
27758
27758
|
* @return {string}
|
|
27759
27759
|
*/
|
|
27760
27760
|
previousLine: /* @__PURE__ */ __name(function(lines) {
|
|
27761
|
-
return csi + (lines || 1) + "F";
|
|
27761
|
+
return csi$1 + (lines || 1) + "F";
|
|
27762
27762
|
}, "previousLine"),
|
|
27763
27763
|
/**
|
|
27764
27764
|
* Moves the cursor to column n.
|
|
@@ -27766,7 +27766,7 @@ ansi.cursor = {
|
|
|
27766
27766
|
* @return {string}
|
|
27767
27767
|
*/
|
|
27768
27768
|
horizontalAbsolute: /* @__PURE__ */ __name(function(n) {
|
|
27769
|
-
return csi + n + "G";
|
|
27769
|
+
return csi$1 + n + "G";
|
|
27770
27770
|
}, "horizontalAbsolute"),
|
|
27771
27771
|
/**
|
|
27772
27772
|
* Moves the cursor to row n, column m. The values are 1-based, and default to 1 (top left corner) if omitted.
|
|
@@ -27775,25 +27775,25 @@ ansi.cursor = {
|
|
|
27775
27775
|
* @return {string}
|
|
27776
27776
|
*/
|
|
27777
27777
|
position: /* @__PURE__ */ __name(function(n, m) {
|
|
27778
|
-
return csi + (n || 1) + ";" + (m || 1) + "H";
|
|
27778
|
+
return csi$1 + (n || 1) + ";" + (m || 1) + "H";
|
|
27779
27779
|
}, "position"),
|
|
27780
27780
|
/**
|
|
27781
27781
|
* Hides the cursor
|
|
27782
27782
|
*/
|
|
27783
|
-
hide: csi + "?25l",
|
|
27783
|
+
hide: csi$1 + "?25l",
|
|
27784
27784
|
/**
|
|
27785
27785
|
* Shows the cursor
|
|
27786
27786
|
*/
|
|
27787
|
-
show: csi + "?25h"
|
|
27787
|
+
show: csi$1 + "?25h"
|
|
27788
27788
|
};
|
|
27789
|
-
ansi.erase = {
|
|
27789
|
+
ansi$1.erase = {
|
|
27790
27790
|
/**
|
|
27791
27791
|
* Clears part of the screen. If n is 0 (or missing), clear from cursor to end of screen. If n is 1, clear from cursor to beginning of the screen. If n is 2, clear entire screen.
|
|
27792
27792
|
* @param n {number}
|
|
27793
27793
|
* @return {string}
|
|
27794
27794
|
*/
|
|
27795
27795
|
display: /* @__PURE__ */ __name(function(n) {
|
|
27796
|
-
return csi + (n || 0) + "J";
|
|
27796
|
+
return csi$1 + (n || 0) + "J";
|
|
27797
27797
|
}, "display"),
|
|
27798
27798
|
/**
|
|
27799
27799
|
* Erases part of the line. If n is zero (or missing), clear from cursor to the end of the line. If n is one, clear from cursor to beginning of the line. If n is two, clear entire line. Cursor position does not change.
|
|
@@ -27801,7 +27801,7 @@ ansi.erase = {
|
|
|
27801
27801
|
* @return {string}
|
|
27802
27802
|
*/
|
|
27803
27803
|
inLine: /* @__PURE__ */ __name(function(n) {
|
|
27804
|
-
return csi + (n || 0) + "K";
|
|
27804
|
+
return csi$1 + (n || 0) + "K";
|
|
27805
27805
|
}, "inLine")
|
|
27806
27806
|
};
|
|
27807
27807
|
const pkg$3 = {
|
|
@@ -27833,7 +27833,7 @@ Commands:
|
|
|
27833
27833
|
if ("Gyroscope" in globalThis) sensors.push("gyroscope");
|
|
27834
27834
|
if ("LinearAccelerationSensor" in globalThis) sensors.push("linear");
|
|
27835
27835
|
if ("AbsoluteOrientationSensor" in globalThis) sensors.push("orientation");
|
|
27836
|
-
terminal.writeln(`${ansi.style.bold}📱 Available Sensors:${ansi.style.reset}`);
|
|
27836
|
+
terminal.writeln(`${ansi$1.style.bold}📱 Available Sensors:${ansi$1.style.reset}`);
|
|
27837
27837
|
sensors.forEach((sensor2) => terminal.writeln(` - ${sensor2}`));
|
|
27838
27838
|
break;
|
|
27839
27839
|
case "read":
|
|
@@ -28060,27 +28060,27 @@ function displaySensorData(sensor, sensorType, terminal) {
|
|
|
28060
28060
|
switch (sensorType) {
|
|
28061
28061
|
case "accelerometer":
|
|
28062
28062
|
case "linear":
|
|
28063
|
-
terminal.writeln(`${ansi.style.bold}📊 ${sensorType.charAt(0).toUpperCase() + sensorType.slice(1)} Reading:${ansi.style.reset}
|
|
28064
|
-
🕒 Time: ${ansi.style.cyan}${timestamp}${ansi.style.reset}
|
|
28065
|
-
X: ${ansi.style.cyan}${sensor.x.toFixed(2)}${ansi.style.reset} m/s²
|
|
28066
|
-
Y: ${ansi.style.cyan}${sensor.y.toFixed(2)}${ansi.style.reset} m/s²
|
|
28067
|
-
Z: ${ansi.style.cyan}${sensor.z.toFixed(2)}${ansi.style.reset} m/s²`);
|
|
28063
|
+
terminal.writeln(`${ansi$1.style.bold}📊 ${sensorType.charAt(0).toUpperCase() + sensorType.slice(1)} Reading:${ansi$1.style.reset}
|
|
28064
|
+
🕒 Time: ${ansi$1.style.cyan}${timestamp}${ansi$1.style.reset}
|
|
28065
|
+
X: ${ansi$1.style.cyan}${sensor.x.toFixed(2)}${ansi$1.style.reset} m/s²
|
|
28066
|
+
Y: ${ansi$1.style.cyan}${sensor.y.toFixed(2)}${ansi$1.style.reset} m/s²
|
|
28067
|
+
Z: ${ansi$1.style.cyan}${sensor.z.toFixed(2)}${ansi$1.style.reset} m/s²`);
|
|
28068
28068
|
break;
|
|
28069
28069
|
case "gyroscope":
|
|
28070
|
-
terminal.writeln(`${ansi.style.bold}📊 Gyroscope Reading:${ansi.style.reset}
|
|
28071
|
-
🕒 Time: ${ansi.style.cyan}${timestamp}${ansi.style.reset}
|
|
28072
|
-
X: ${ansi.style.cyan}${sensor.x.toFixed(2)}${ansi.style.reset} rad/s
|
|
28073
|
-
Y: ${ansi.style.cyan}${sensor.y.toFixed(2)}${ansi.style.reset} rad/s
|
|
28074
|
-
Z: ${ansi.style.cyan}${sensor.z.toFixed(2)}${ansi.style.reset} rad/s`);
|
|
28070
|
+
terminal.writeln(`${ansi$1.style.bold}📊 Gyroscope Reading:${ansi$1.style.reset}
|
|
28071
|
+
🕒 Time: ${ansi$1.style.cyan}${timestamp}${ansi$1.style.reset}
|
|
28072
|
+
X: ${ansi$1.style.cyan}${sensor.x.toFixed(2)}${ansi$1.style.reset} rad/s
|
|
28073
|
+
Y: ${ansi$1.style.cyan}${sensor.y.toFixed(2)}${ansi$1.style.reset} rad/s
|
|
28074
|
+
Z: ${ansi$1.style.cyan}${sensor.z.toFixed(2)}${ansi$1.style.reset} rad/s`);
|
|
28075
28075
|
break;
|
|
28076
28076
|
case "orientation":
|
|
28077
|
-
terminal.writeln(`${ansi.style.bold}📊 Orientation Reading:${ansi.style.reset}
|
|
28078
|
-
🕒 Time: ${ansi.style.cyan}${timestamp}${ansi.style.reset}
|
|
28077
|
+
terminal.writeln(`${ansi$1.style.bold}📊 Orientation Reading:${ansi$1.style.reset}
|
|
28078
|
+
🕒 Time: ${ansi$1.style.cyan}${timestamp}${ansi$1.style.reset}
|
|
28079
28079
|
Quaternion:
|
|
28080
|
-
X: ${ansi.style.cyan}${sensor.quaternion[0].toFixed(3)}${ansi.style.reset}
|
|
28081
|
-
Y: ${ansi.style.cyan}${sensor.quaternion[1].toFixed(3)}${ansi.style.reset}
|
|
28082
|
-
Z: ${ansi.style.cyan}${sensor.quaternion[2].toFixed(3)}${ansi.style.reset}
|
|
28083
|
-
W: ${ansi.style.cyan}${sensor.quaternion[3].toFixed(3)}${ansi.style.reset}`);
|
|
28080
|
+
X: ${ansi$1.style.cyan}${sensor.quaternion[0].toFixed(3)}${ansi$1.style.reset}
|
|
28081
|
+
Y: ${ansi$1.style.cyan}${sensor.quaternion[1].toFixed(3)}${ansi$1.style.reset}
|
|
28082
|
+
Z: ${ansi$1.style.cyan}${sensor.quaternion[2].toFixed(3)}${ansi$1.style.reset}
|
|
28083
|
+
W: ${ansi$1.style.cyan}${sensor.quaternion[3].toFixed(3)}${ansi$1.style.reset}`);
|
|
28084
28084
|
break;
|
|
28085
28085
|
}
|
|
28086
28086
|
}
|
|
@@ -28559,7 +28559,7 @@ const _Dom = class _Dom {
|
|
|
28559
28559
|
}
|
|
28560
28560
|
async topbar(show) {
|
|
28561
28561
|
if (!this._topbar) return;
|
|
28562
|
-
const { default: topbar } = await import("./topbar.min-
|
|
28562
|
+
const { default: topbar } = await import("./topbar.min-BK1fdCNA.js").then((n) => n.t);
|
|
28563
28563
|
this._topbarShow = show ?? !this._topbarShow;
|
|
28564
28564
|
if (this._topbarShow) topbar.show();
|
|
28565
28565
|
else topbar.hide();
|
|
@@ -59629,7 +59629,7 @@ const _TerminalCommand = class _TerminalCommand {
|
|
|
59629
59629
|
};
|
|
59630
59630
|
__name(_TerminalCommand, "TerminalCommand");
|
|
59631
59631
|
let TerminalCommand = _TerminalCommand;
|
|
59632
|
-
function createCommand$
|
|
59632
|
+
function createCommand$h(kernel, shell, terminal) {
|
|
59633
59633
|
return new TerminalCommand({
|
|
59634
59634
|
command: "cat",
|
|
59635
59635
|
description: "Concatenate files and print on the standard output",
|
|
@@ -59713,8 +59713,8 @@ function createCommand$d(kernel, shell, terminal) {
|
|
|
59713
59713
|
}, "run")
|
|
59714
59714
|
});
|
|
59715
59715
|
}
|
|
59716
|
-
__name(createCommand$
|
|
59717
|
-
function createCommand$
|
|
59716
|
+
__name(createCommand$h, "createCommand$h");
|
|
59717
|
+
function createCommand$g(kernel, shell, terminal) {
|
|
59718
59718
|
return new TerminalCommand({
|
|
59719
59719
|
command: "cd",
|
|
59720
59720
|
description: "Change the shell working directory",
|
|
@@ -59735,8 +59735,8 @@ function createCommand$c(kernel, shell, terminal) {
|
|
|
59735
59735
|
}, "run")
|
|
59736
59736
|
});
|
|
59737
59737
|
}
|
|
59738
|
-
__name(createCommand$
|
|
59739
|
-
function createCommand$
|
|
59738
|
+
__name(createCommand$g, "createCommand$g");
|
|
59739
|
+
function createCommand$f(kernel, shell, terminal) {
|
|
59740
59740
|
return new TerminalCommand({
|
|
59741
59741
|
command: "chmod",
|
|
59742
59742
|
description: "Change file mode bits",
|
|
@@ -59762,8 +59762,8 @@ function createCommand$b(kernel, shell, terminal) {
|
|
|
59762
59762
|
}, "run")
|
|
59763
59763
|
});
|
|
59764
59764
|
}
|
|
59765
|
-
__name(createCommand$
|
|
59766
|
-
function createCommand$
|
|
59765
|
+
__name(createCommand$f, "createCommand$f");
|
|
59766
|
+
function createCommand$e(kernel, shell, terminal) {
|
|
59767
59767
|
return new TerminalCommand({
|
|
59768
59768
|
command: "cp",
|
|
59769
59769
|
description: "Copy files",
|
|
@@ -59785,8 +59785,8 @@ function createCommand$a(kernel, shell, terminal) {
|
|
|
59785
59785
|
}, "run")
|
|
59786
59786
|
});
|
|
59787
59787
|
}
|
|
59788
|
-
__name(createCommand$
|
|
59789
|
-
function createCommand$
|
|
59788
|
+
__name(createCommand$e, "createCommand$e");
|
|
59789
|
+
function createCommand$d(kernel, shell, terminal) {
|
|
59790
59790
|
return new TerminalCommand({
|
|
59791
59791
|
command: "echo",
|
|
59792
59792
|
description: "Print arguments to the standard output",
|
|
@@ -59814,8 +59814,8 @@ function createCommand$9(kernel, shell, terminal) {
|
|
|
59814
59814
|
}, "run")
|
|
59815
59815
|
});
|
|
59816
59816
|
}
|
|
59817
|
-
__name(createCommand$
|
|
59818
|
-
function createCommand$
|
|
59817
|
+
__name(createCommand$d, "createCommand$d");
|
|
59818
|
+
function createCommand$c(kernel, shell, terminal) {
|
|
59819
59819
|
return new TerminalCommand({
|
|
59820
59820
|
command: "ln",
|
|
59821
59821
|
description: "Create links between files",
|
|
@@ -59907,7 +59907,7 @@ function createCommand$8(kernel, shell, terminal) {
|
|
|
59907
59907
|
}, "run")
|
|
59908
59908
|
});
|
|
59909
59909
|
}
|
|
59910
|
-
__name(createCommand$
|
|
59910
|
+
__name(createCommand$c, "createCommand$c");
|
|
59911
59911
|
var humanFormat$2 = { exports: {} };
|
|
59912
59912
|
var humanFormat$1 = humanFormat$2.exports;
|
|
59913
59913
|
var hasRequiredHumanFormat;
|
|
@@ -60188,7 +60188,7 @@ function requireHumanFormat() {
|
|
|
60188
60188
|
__name(requireHumanFormat, "requireHumanFormat");
|
|
60189
60189
|
var humanFormatExports = requireHumanFormat();
|
|
60190
60190
|
const humanFormat = /* @__PURE__ */ getDefaultExportFromCjs(humanFormatExports);
|
|
60191
|
-
function createCommand$
|
|
60191
|
+
function createCommand$b(kernel, shell, terminal) {
|
|
60192
60192
|
return new TerminalCommand({
|
|
60193
60193
|
command: "ls",
|
|
60194
60194
|
description: "List directory contents",
|
|
@@ -60353,8 +60353,8 @@ function createCommand$7(kernel, shell, terminal) {
|
|
|
60353
60353
|
}, "run")
|
|
60354
60354
|
});
|
|
60355
60355
|
}
|
|
60356
|
-
__name(createCommand$
|
|
60357
|
-
function createCommand$
|
|
60356
|
+
__name(createCommand$b, "createCommand$b");
|
|
60357
|
+
function createCommand$a(kernel, shell, terminal) {
|
|
60358
60358
|
return new TerminalCommand({
|
|
60359
60359
|
command: "mkdir",
|
|
60360
60360
|
description: "Create a directory",
|
|
@@ -60373,8 +60373,8 @@ function createCommand$6(kernel, shell, terminal) {
|
|
|
60373
60373
|
}, "run")
|
|
60374
60374
|
});
|
|
60375
60375
|
}
|
|
60376
|
-
__name(createCommand$
|
|
60377
|
-
function createCommand$
|
|
60376
|
+
__name(createCommand$a, "createCommand$a");
|
|
60377
|
+
function createCommand$9(kernel, shell, terminal) {
|
|
60378
60378
|
return new TerminalCommand({
|
|
60379
60379
|
command: "mv",
|
|
60380
60380
|
description: "Move or rename files",
|
|
@@ -60413,8 +60413,8 @@ function createCommand$5(kernel, shell, terminal) {
|
|
|
60413
60413
|
}, "run")
|
|
60414
60414
|
});
|
|
60415
60415
|
}
|
|
60416
|
-
__name(createCommand$
|
|
60417
|
-
function createCommand$
|
|
60416
|
+
__name(createCommand$9, "createCommand$9");
|
|
60417
|
+
function createCommand$8(kernel, shell, terminal) {
|
|
60418
60418
|
return new TerminalCommand({
|
|
60419
60419
|
command: "pwd",
|
|
60420
60420
|
description: "Print the shell working directory",
|
|
@@ -60430,8 +60430,8 @@ function createCommand$4(kernel, shell, terminal) {
|
|
|
60430
60430
|
}, "run")
|
|
60431
60431
|
});
|
|
60432
60432
|
}
|
|
60433
|
-
__name(createCommand$
|
|
60434
|
-
function createCommand$
|
|
60433
|
+
__name(createCommand$8, "createCommand$8");
|
|
60434
|
+
function createCommand$7(kernel, shell, terminal) {
|
|
60435
60435
|
return new TerminalCommand({
|
|
60436
60436
|
command: "rm",
|
|
60437
60437
|
description: "Remove files or directories",
|
|
@@ -60451,8 +60451,8 @@ function createCommand$3(kernel, shell, terminal) {
|
|
|
60451
60451
|
}, "run")
|
|
60452
60452
|
});
|
|
60453
60453
|
}
|
|
60454
|
-
__name(createCommand$
|
|
60455
|
-
function createCommand$
|
|
60454
|
+
__name(createCommand$7, "createCommand$7");
|
|
60455
|
+
function createCommand$6(kernel, shell, terminal) {
|
|
60456
60456
|
return new TerminalCommand({
|
|
60457
60457
|
command: "rmdir",
|
|
60458
60458
|
description: "Remove a directory",
|
|
@@ -60471,7 +60471,7 @@ function createCommand$2(kernel, shell, terminal) {
|
|
|
60471
60471
|
}, "run")
|
|
60472
60472
|
});
|
|
60473
60473
|
}
|
|
60474
|
-
__name(createCommand$
|
|
60474
|
+
__name(createCommand$6, "createCommand$6");
|
|
60475
60475
|
const MAX_32_BITS = 4294967295;
|
|
60476
60476
|
const MAX_16_BITS = 65535;
|
|
60477
60477
|
const MAX_8_BITS = 255;
|
|
@@ -65266,7 +65266,7 @@ const table = {
|
|
|
65266
65266
|
return mimeTypes;
|
|
65267
65267
|
})();
|
|
65268
65268
|
t(configure);
|
|
65269
|
-
function createCommand$
|
|
65269
|
+
function createCommand$5(kernel, shell, terminal) {
|
|
65270
65270
|
return new TerminalCommand({
|
|
65271
65271
|
command: "stat",
|
|
65272
65272
|
description: "Display information about a file or directory",
|
|
@@ -65296,8 +65296,8 @@ function createCommand$1(kernel, shell, terminal) {
|
|
|
65296
65296
|
}, "run")
|
|
65297
65297
|
});
|
|
65298
65298
|
}
|
|
65299
|
-
__name(createCommand$
|
|
65300
|
-
function createCommand(kernel, shell, terminal) {
|
|
65299
|
+
__name(createCommand$5, "createCommand$5");
|
|
65300
|
+
function createCommand$4(kernel, shell, terminal) {
|
|
65301
65301
|
return new TerminalCommand({
|
|
65302
65302
|
command: "touch",
|
|
65303
65303
|
description: "Create an empty file",
|
|
@@ -65316,23 +65316,876 @@ function createCommand(kernel, shell, terminal) {
|
|
|
65316
65316
|
}, "run")
|
|
65317
65317
|
});
|
|
65318
65318
|
}
|
|
65319
|
+
__name(createCommand$4, "createCommand$4");
|
|
65320
|
+
function createCommand$3(kernel, shell, terminal) {
|
|
65321
|
+
return new TerminalCommand({
|
|
65322
|
+
command: "hex",
|
|
65323
|
+
description: "Display file contents in hexadecimal format",
|
|
65324
|
+
kernel,
|
|
65325
|
+
shell,
|
|
65326
|
+
terminal,
|
|
65327
|
+
options: [
|
|
65328
|
+
{ name: "help", type: Boolean, description: kernel.i18n.t("Display help") },
|
|
65329
|
+
{ name: "path", type: String, typeLabel: "{underline path}", defaultOption: true, description: "The path to the file to display" }
|
|
65330
|
+
],
|
|
65331
|
+
run: /* @__PURE__ */ __name(async (argv, process2) => {
|
|
65332
|
+
const filePath = argv.path;
|
|
65333
|
+
if (!filePath) {
|
|
65334
|
+
await writelnStderr(process2, terminal, "Usage: hex <file>");
|
|
65335
|
+
return 1;
|
|
65336
|
+
}
|
|
65337
|
+
const fullPath = path$1.resolve(shell.cwd, filePath);
|
|
65338
|
+
try {
|
|
65339
|
+
const exists2 = await shell.context.fs.promises.exists(fullPath);
|
|
65340
|
+
if (!exists2) {
|
|
65341
|
+
await writelnStderr(process2, terminal, `hex: ${filePath}: No such file or directory`);
|
|
65342
|
+
return 1;
|
|
65343
|
+
}
|
|
65344
|
+
const stats = await shell.context.fs.promises.stat(fullPath);
|
|
65345
|
+
if (stats.isDirectory()) {
|
|
65346
|
+
await writelnStderr(process2, terminal, `hex: ${filePath}: Is a directory`);
|
|
65347
|
+
return 1;
|
|
65348
|
+
}
|
|
65349
|
+
const data = await shell.context.fs.promises.readFile(fullPath);
|
|
65350
|
+
const bytesPerLine = 16;
|
|
65351
|
+
for (let offset = 0; offset < data.length; offset += bytesPerLine) {
|
|
65352
|
+
const lineBytes = data.slice(offset, offset + bytesPerLine);
|
|
65353
|
+
const offsetHex = offset.toString(16).padStart(8, "0");
|
|
65354
|
+
const hexGroups = [];
|
|
65355
|
+
const asciiChars = [];
|
|
65356
|
+
for (let i = 0; i < bytesPerLine; i++) {
|
|
65357
|
+
if (i < lineBytes.length) {
|
|
65358
|
+
const byte = lineBytes[i];
|
|
65359
|
+
if (byte === void 0) continue;
|
|
65360
|
+
const hex = byte.toString(16).padStart(2, "0");
|
|
65361
|
+
if (i % 2 === 0) {
|
|
65362
|
+
hexGroups.push(hex);
|
|
65363
|
+
} else {
|
|
65364
|
+
hexGroups[hexGroups.length - 1] += hex;
|
|
65365
|
+
}
|
|
65366
|
+
if (byte >= 32 && byte <= 126) {
|
|
65367
|
+
asciiChars.push(String.fromCharCode(byte));
|
|
65368
|
+
} else {
|
|
65369
|
+
asciiChars.push(".");
|
|
65370
|
+
}
|
|
65371
|
+
} else {
|
|
65372
|
+
if (i % 2 === 0) {
|
|
65373
|
+
hexGroups.push(" ");
|
|
65374
|
+
} else {
|
|
65375
|
+
hexGroups[hexGroups.length - 1] += " ";
|
|
65376
|
+
}
|
|
65377
|
+
asciiChars.push(" ");
|
|
65378
|
+
}
|
|
65379
|
+
}
|
|
65380
|
+
const hexString = hexGroups.join(" ").padEnd(47, " ");
|
|
65381
|
+
const asciiString = asciiChars.join("");
|
|
65382
|
+
await writelnStdout(process2, terminal, `${offsetHex}: ${hexString} ${asciiString}`);
|
|
65383
|
+
}
|
|
65384
|
+
return 0;
|
|
65385
|
+
} catch (error) {
|
|
65386
|
+
await writelnStderr(process2, terminal, `hex: ${filePath}: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
65387
|
+
return 1;
|
|
65388
|
+
}
|
|
65389
|
+
}, "run")
|
|
65390
|
+
});
|
|
65391
|
+
}
|
|
65392
|
+
__name(createCommand$3, "createCommand$3");
|
|
65393
|
+
const csi = "\x1B[";
|
|
65394
|
+
const ansi = {};
|
|
65395
|
+
ansi.style = {
|
|
65396
|
+
reset: "\x1B[0m",
|
|
65397
|
+
bold: "\x1B[1m",
|
|
65398
|
+
italic: "\x1B[3m",
|
|
65399
|
+
underline: "\x1B[4m",
|
|
65400
|
+
fontDefault: "\x1B[10m",
|
|
65401
|
+
font2: "\x1B[11m",
|
|
65402
|
+
font3: "\x1B[12m",
|
|
65403
|
+
font4: "\x1B[13m",
|
|
65404
|
+
font5: "\x1B[14m",
|
|
65405
|
+
font6: "\x1B[15m",
|
|
65406
|
+
imageNegative: "\x1B[7m",
|
|
65407
|
+
imagePositive: "\x1B[27m",
|
|
65408
|
+
black: "\x1B[30m",
|
|
65409
|
+
red: "\x1B[31m",
|
|
65410
|
+
green: "\x1B[32m",
|
|
65411
|
+
yellow: "\x1B[33m",
|
|
65412
|
+
blue: "\x1B[34m",
|
|
65413
|
+
magenta: "\x1B[35m",
|
|
65414
|
+
cyan: "\x1B[36m",
|
|
65415
|
+
white: "\x1B[37m",
|
|
65416
|
+
grey: "\x1B[90m",
|
|
65417
|
+
gray: "\x1B[90m",
|
|
65418
|
+
brightRed: "\x1B[91m",
|
|
65419
|
+
brightGreen: "\x1B[92m",
|
|
65420
|
+
brightYellow: "\x1B[93m",
|
|
65421
|
+
brightBlue: "\x1B[94m",
|
|
65422
|
+
brightMagenta: "\x1B[95m",
|
|
65423
|
+
brightCyan: "\x1B[96m",
|
|
65424
|
+
brightWhite: "\x1B[97m",
|
|
65425
|
+
"bg-black": "\x1B[40m",
|
|
65426
|
+
"bg-red": "\x1B[41m",
|
|
65427
|
+
"bg-green": "\x1B[42m",
|
|
65428
|
+
"bg-yellow": "\x1B[43m",
|
|
65429
|
+
"bg-blue": "\x1B[44m",
|
|
65430
|
+
"bg-magenta": "\x1B[45m",
|
|
65431
|
+
"bg-cyan": "\x1B[46m",
|
|
65432
|
+
"bg-white": "\x1B[47m",
|
|
65433
|
+
"bg-grey": "\x1B[100m",
|
|
65434
|
+
"bg-gray": "\x1B[100m",
|
|
65435
|
+
"bg-brightRed": "\x1B[101m",
|
|
65436
|
+
"bg-brightGreen": "\x1B[102m",
|
|
65437
|
+
"bg-brightYellow": "\x1B[103m",
|
|
65438
|
+
"bg-brightBlue": "\x1B[104m",
|
|
65439
|
+
"bg-brightMagenta": "\x1B[105m",
|
|
65440
|
+
"bg-brightCyan": "\x1B[106m",
|
|
65441
|
+
"bg-brightWhite": "\x1B[107m"
|
|
65442
|
+
};
|
|
65443
|
+
ansi.rgb = function(r, g2, b) {
|
|
65444
|
+
return `\x1B[38;2;${r};${g2};${b}m`;
|
|
65445
|
+
};
|
|
65446
|
+
ansi.bgRgb = function(r, g2, b) {
|
|
65447
|
+
return `\x1B[48;2;${r};${g2};${b}m`;
|
|
65448
|
+
};
|
|
65449
|
+
ansi.styles = function(styles2) {
|
|
65450
|
+
styles2 = arrayify(styles2);
|
|
65451
|
+
return styles2.map(function(effect) {
|
|
65452
|
+
const rgbMatches = effect.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
|
|
65453
|
+
const bgRgbMatches = effect.match(/bg-rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
|
|
65454
|
+
if (bgRgbMatches) {
|
|
65455
|
+
const [full, r, g2, b] = bgRgbMatches;
|
|
65456
|
+
return ansi.bgRgb(r, g2, b);
|
|
65457
|
+
} else if (rgbMatches) {
|
|
65458
|
+
const [full, r, g2, b] = rgbMatches;
|
|
65459
|
+
return ansi.rgb(r, g2, b);
|
|
65460
|
+
} else {
|
|
65461
|
+
return ansi.style[effect];
|
|
65462
|
+
}
|
|
65463
|
+
}).join("");
|
|
65464
|
+
};
|
|
65465
|
+
ansi.format = function(str, styleArray) {
|
|
65466
|
+
const re2 = /\[([\w\s-\(\),]+)\]{([^]*?)}/;
|
|
65467
|
+
let matches;
|
|
65468
|
+
str = String(str);
|
|
65469
|
+
if (!str) return "";
|
|
65470
|
+
while (matches = str.match(re2)) {
|
|
65471
|
+
const inlineStyles = matches[1].split(/\s+/);
|
|
65472
|
+
const inlineString = matches[2];
|
|
65473
|
+
str = str.replace(matches[0], ansi.format(inlineString, inlineStyles));
|
|
65474
|
+
}
|
|
65475
|
+
return styleArray && styleArray.length ? ansi.styles(styleArray) + str + ansi.style.reset : str;
|
|
65476
|
+
};
|
|
65477
|
+
ansi.cursor = {
|
|
65478
|
+
/**
|
|
65479
|
+
* Moves the cursor `lines` cells up. If the cursor is already at the edge of the screen, this has no effect
|
|
65480
|
+
* @param [lines=1] {number}
|
|
65481
|
+
* @return {string}
|
|
65482
|
+
*/
|
|
65483
|
+
up: /* @__PURE__ */ __name(function(lines) {
|
|
65484
|
+
return csi + (lines || 1) + "A";
|
|
65485
|
+
}, "up"),
|
|
65486
|
+
/**
|
|
65487
|
+
* Moves the cursor `lines` cells down. If the cursor is already at the edge of the screen, this has no effect
|
|
65488
|
+
* @param [lines=1] {number}
|
|
65489
|
+
* @return {string}
|
|
65490
|
+
*/
|
|
65491
|
+
down: /* @__PURE__ */ __name(function(lines) {
|
|
65492
|
+
return csi + (lines || 1) + "B";
|
|
65493
|
+
}, "down"),
|
|
65494
|
+
/**
|
|
65495
|
+
* Moves the cursor `lines` cells forward. If the cursor is already at the edge of the screen, this has no effect
|
|
65496
|
+
* @param [lines=1] {number}
|
|
65497
|
+
* @return {string}
|
|
65498
|
+
*/
|
|
65499
|
+
forward: /* @__PURE__ */ __name(function(lines) {
|
|
65500
|
+
return csi + (lines || 1) + "C";
|
|
65501
|
+
}, "forward"),
|
|
65502
|
+
/**
|
|
65503
|
+
* Moves the cursor `lines` cells back. If the cursor is already at the edge of the screen, this has no effect
|
|
65504
|
+
* @param [lines=1] {number}
|
|
65505
|
+
* @return {string}
|
|
65506
|
+
*/
|
|
65507
|
+
back: /* @__PURE__ */ __name(function(lines) {
|
|
65508
|
+
return csi + (lines || 1) + "D";
|
|
65509
|
+
}, "back"),
|
|
65510
|
+
/**
|
|
65511
|
+
* Moves cursor to beginning of the line n lines down.
|
|
65512
|
+
* @param [lines=1] {number}
|
|
65513
|
+
* @return {string}
|
|
65514
|
+
*/
|
|
65515
|
+
nextLine: /* @__PURE__ */ __name(function(lines) {
|
|
65516
|
+
return csi + (lines || 1) + "E";
|
|
65517
|
+
}, "nextLine"),
|
|
65518
|
+
/**
|
|
65519
|
+
* Moves cursor to beginning of the line n lines up.
|
|
65520
|
+
* @param [lines=1] {number}
|
|
65521
|
+
* @return {string}
|
|
65522
|
+
*/
|
|
65523
|
+
previousLine: /* @__PURE__ */ __name(function(lines) {
|
|
65524
|
+
return csi + (lines || 1) + "F";
|
|
65525
|
+
}, "previousLine"),
|
|
65526
|
+
/**
|
|
65527
|
+
* Moves the cursor to column n.
|
|
65528
|
+
* @param n {number} - column number
|
|
65529
|
+
* @return {string}
|
|
65530
|
+
*/
|
|
65531
|
+
horizontalAbsolute: /* @__PURE__ */ __name(function(n) {
|
|
65532
|
+
return csi + n + "G";
|
|
65533
|
+
}, "horizontalAbsolute"),
|
|
65534
|
+
/**
|
|
65535
|
+
* Moves the cursor to row n, column m. The values are 1-based, and default to 1 (top left corner) if omitted.
|
|
65536
|
+
* @param n {number} - row number
|
|
65537
|
+
* @param m {number} - column number
|
|
65538
|
+
* @return {string}
|
|
65539
|
+
*/
|
|
65540
|
+
position: /* @__PURE__ */ __name(function(n, m) {
|
|
65541
|
+
return csi + (n || 1) + ";" + (m || 1) + "H";
|
|
65542
|
+
}, "position"),
|
|
65543
|
+
/**
|
|
65544
|
+
* Hides the cursor
|
|
65545
|
+
*/
|
|
65546
|
+
hide: csi + "?25l",
|
|
65547
|
+
/**
|
|
65548
|
+
* Shows the cursor
|
|
65549
|
+
*/
|
|
65550
|
+
show: csi + "?25h"
|
|
65551
|
+
};
|
|
65552
|
+
ansi.erase = {
|
|
65553
|
+
/**
|
|
65554
|
+
* Clears part of the screen. If n is 0 (or missing), clear from cursor to end of screen. If n is 1, clear from cursor to beginning of the screen. If n is 2, clear entire screen.
|
|
65555
|
+
* @param n {number}
|
|
65556
|
+
* @return {string}
|
|
65557
|
+
*/
|
|
65558
|
+
display: /* @__PURE__ */ __name(function(n) {
|
|
65559
|
+
return csi + (n || 0) + "J";
|
|
65560
|
+
}, "display"),
|
|
65561
|
+
/**
|
|
65562
|
+
* Erases part of the line. If n is zero (or missing), clear from cursor to the end of the line. If n is one, clear from cursor to beginning of the line. If n is two, clear entire line. Cursor position does not change.
|
|
65563
|
+
* @param n {number}
|
|
65564
|
+
* @return {string}
|
|
65565
|
+
*/
|
|
65566
|
+
inLine: /* @__PURE__ */ __name(function(n) {
|
|
65567
|
+
return csi + (n || 0) + "K";
|
|
65568
|
+
}, "inLine")
|
|
65569
|
+
};
|
|
65570
|
+
function createCommand$2(kernel, shell, terminal) {
|
|
65571
|
+
return new TerminalCommand({
|
|
65572
|
+
command: "less",
|
|
65573
|
+
description: "View file contents interactively",
|
|
65574
|
+
kernel,
|
|
65575
|
+
shell,
|
|
65576
|
+
terminal,
|
|
65577
|
+
options: [
|
|
65578
|
+
{ name: "help", type: Boolean, description: kernel.i18n.t("Display help") },
|
|
65579
|
+
{ name: "path", type: String, typeLabel: "{underline path}", defaultOption: true, description: "The path to the file to view" }
|
|
65580
|
+
],
|
|
65581
|
+
run: /* @__PURE__ */ __name(async (argv, process2) => {
|
|
65582
|
+
if (!process2) return 1;
|
|
65583
|
+
let lines = [];
|
|
65584
|
+
let currentLine = 0;
|
|
65585
|
+
let keyListener = null;
|
|
65586
|
+
let linesRendered = 0;
|
|
65587
|
+
try {
|
|
65588
|
+
if (argv.path) {
|
|
65589
|
+
const filePath = argv.path;
|
|
65590
|
+
const expandedPath = shell.expandTilde(filePath);
|
|
65591
|
+
const fullPath = path$1.resolve(shell.cwd, expandedPath);
|
|
65592
|
+
const exists2 = await shell.context.fs.promises.exists(fullPath);
|
|
65593
|
+
if (!exists2) {
|
|
65594
|
+
await writelnStderr(process2, terminal, `less: ${filePath}: No such file or directory`);
|
|
65595
|
+
return 1;
|
|
65596
|
+
}
|
|
65597
|
+
const stats = await shell.context.fs.promises.stat(fullPath);
|
|
65598
|
+
if (stats.isDirectory()) {
|
|
65599
|
+
await writelnStderr(process2, terminal, `less: ${filePath}: Is a directory`);
|
|
65600
|
+
return 1;
|
|
65601
|
+
}
|
|
65602
|
+
const content = await shell.context.fs.promises.readFile(fullPath, "utf-8");
|
|
65603
|
+
lines = content.split("\n");
|
|
65604
|
+
} else {
|
|
65605
|
+
if (!process2.stdin) {
|
|
65606
|
+
await writelnStderr(process2, terminal, "less: No input provided");
|
|
65607
|
+
return 1;
|
|
65608
|
+
}
|
|
65609
|
+
const reader = process2.stdin.getReader();
|
|
65610
|
+
const decoder2 = new TextDecoder();
|
|
65611
|
+
const chunks = [];
|
|
65612
|
+
try {
|
|
65613
|
+
while (true) {
|
|
65614
|
+
const { done, value } = await reader.read();
|
|
65615
|
+
if (done) break;
|
|
65616
|
+
chunks.push(decoder2.decode(value, { stream: true }));
|
|
65617
|
+
}
|
|
65618
|
+
chunks.push(decoder2.decode(new Uint8Array(), { stream: false }));
|
|
65619
|
+
} finally {
|
|
65620
|
+
reader.releaseLock();
|
|
65621
|
+
}
|
|
65622
|
+
const content = chunks.join("");
|
|
65623
|
+
lines = content.split("\n");
|
|
65624
|
+
}
|
|
65625
|
+
if (lines.length === 0) {
|
|
65626
|
+
return 0;
|
|
65627
|
+
}
|
|
65628
|
+
terminal.unlisten();
|
|
65629
|
+
terminal.write("\n");
|
|
65630
|
+
terminal.write(ansi.cursor.hide);
|
|
65631
|
+
const rows = terminal.rows;
|
|
65632
|
+
const displayRows = rows - 1;
|
|
65633
|
+
const render = /* @__PURE__ */ __name(() => {
|
|
65634
|
+
const maxLine = Math.max(0, lines.length - displayRows);
|
|
65635
|
+
if (currentLine > maxLine) {
|
|
65636
|
+
currentLine = maxLine;
|
|
65637
|
+
}
|
|
65638
|
+
if (currentLine < 0) {
|
|
65639
|
+
currentLine = 0;
|
|
65640
|
+
}
|
|
65641
|
+
if (linesRendered > 0) {
|
|
65642
|
+
terminal.write(ansi.cursor.up(linesRendered));
|
|
65643
|
+
}
|
|
65644
|
+
const endLine = Math.min(currentLine + displayRows, lines.length);
|
|
65645
|
+
linesRendered = 0;
|
|
65646
|
+
for (let i = currentLine; i < endLine; i++) {
|
|
65647
|
+
terminal.write(ansi.erase.inLine(2));
|
|
65648
|
+
const line3 = lines[i] || "";
|
|
65649
|
+
terminal.write(line3);
|
|
65650
|
+
linesRendered++;
|
|
65651
|
+
if (i < endLine - 1) {
|
|
65652
|
+
terminal.write("\n");
|
|
65653
|
+
}
|
|
65654
|
+
}
|
|
65655
|
+
for (let i = endLine - currentLine; i < displayRows; i++) {
|
|
65656
|
+
terminal.write("\n");
|
|
65657
|
+
terminal.write(ansi.erase.inLine(2));
|
|
65658
|
+
linesRendered++;
|
|
65659
|
+
}
|
|
65660
|
+
const percentage = lines.length > 0 ? Math.round(endLine / lines.length * 100) : 100;
|
|
65661
|
+
const statusLine = `-- ${currentLine + 1}-${endLine} / ${lines.length} (${percentage}%)`;
|
|
65662
|
+
terminal.write("\n");
|
|
65663
|
+
terminal.write(ansi.erase.inLine(2));
|
|
65664
|
+
terminal.write(statusLine);
|
|
65665
|
+
linesRendered++;
|
|
65666
|
+
}, "render");
|
|
65667
|
+
render();
|
|
65668
|
+
await new Promise((resolve2) => {
|
|
65669
|
+
keyListener = terminal.onKey(async ({ domEvent }) => {
|
|
65670
|
+
const keyName = domEvent.key;
|
|
65671
|
+
switch (keyName) {
|
|
65672
|
+
case "q":
|
|
65673
|
+
case "Q":
|
|
65674
|
+
case "Escape":
|
|
65675
|
+
if (keyListener) {
|
|
65676
|
+
keyListener.dispose();
|
|
65677
|
+
keyListener = null;
|
|
65678
|
+
}
|
|
65679
|
+
terminal.write(ansi.cursor.show);
|
|
65680
|
+
terminal.write("\n");
|
|
65681
|
+
terminal.listen();
|
|
65682
|
+
resolve2();
|
|
65683
|
+
return;
|
|
65684
|
+
case "ArrowUp":
|
|
65685
|
+
if (currentLine > 0) {
|
|
65686
|
+
currentLine--;
|
|
65687
|
+
render();
|
|
65688
|
+
}
|
|
65689
|
+
break;
|
|
65690
|
+
case "ArrowDown":
|
|
65691
|
+
case "Enter":
|
|
65692
|
+
currentLine++;
|
|
65693
|
+
render();
|
|
65694
|
+
break;
|
|
65695
|
+
case "PageDown":
|
|
65696
|
+
case " ":
|
|
65697
|
+
currentLine = Math.min(currentLine + displayRows, Math.max(0, lines.length - displayRows));
|
|
65698
|
+
render();
|
|
65699
|
+
break;
|
|
65700
|
+
case "PageUp":
|
|
65701
|
+
case "b":
|
|
65702
|
+
case "B":
|
|
65703
|
+
currentLine = Math.max(0, currentLine - displayRows);
|
|
65704
|
+
render();
|
|
65705
|
+
break;
|
|
65706
|
+
case "Home":
|
|
65707
|
+
case "g":
|
|
65708
|
+
currentLine = 0;
|
|
65709
|
+
render();
|
|
65710
|
+
break;
|
|
65711
|
+
case "End":
|
|
65712
|
+
case "G":
|
|
65713
|
+
currentLine = Math.max(0, lines.length - displayRows);
|
|
65714
|
+
render();
|
|
65715
|
+
break;
|
|
65716
|
+
}
|
|
65717
|
+
});
|
|
65718
|
+
});
|
|
65719
|
+
return 0;
|
|
65720
|
+
} catch (error) {
|
|
65721
|
+
if (keyListener) {
|
|
65722
|
+
keyListener.dispose();
|
|
65723
|
+
}
|
|
65724
|
+
terminal.write(ansi.cursor.show);
|
|
65725
|
+
terminal.write("\n");
|
|
65726
|
+
terminal.listen();
|
|
65727
|
+
await writelnStderr(process2, terminal, `less: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
65728
|
+
return 1;
|
|
65729
|
+
}
|
|
65730
|
+
}, "run")
|
|
65731
|
+
});
|
|
65732
|
+
}
|
|
65733
|
+
__name(createCommand$2, "createCommand$2");
|
|
65734
|
+
function parseSedExpression(expr) {
|
|
65735
|
+
expr = expr.trim();
|
|
65736
|
+
const substituteMatch = expr.match(/^(\d+)?(,(\d+|\$))?s\/(.+?)\/(.*?)\/([gip]*\d*)$/);
|
|
65737
|
+
if (substituteMatch) {
|
|
65738
|
+
const [, startLine, , endLine, pattern2, replacement, flags] = substituteMatch;
|
|
65739
|
+
const address = startLine ? {
|
|
65740
|
+
type: endLine ? "range" : "line",
|
|
65741
|
+
start: parseInt(startLine, 10),
|
|
65742
|
+
...endLine && { end: endLine === "$" ? Infinity : parseInt(endLine, 10) }
|
|
65743
|
+
} : void 0;
|
|
65744
|
+
return {
|
|
65745
|
+
type: "substitute",
|
|
65746
|
+
pattern: pattern2,
|
|
65747
|
+
replacement: replacement || "",
|
|
65748
|
+
flags: flags || "",
|
|
65749
|
+
address
|
|
65750
|
+
};
|
|
65751
|
+
}
|
|
65752
|
+
const simpleSubstituteMatch = expr.match(/^s\/(.+?)\/(.*?)\/([gip]*\d*)$/);
|
|
65753
|
+
if (simpleSubstituteMatch) {
|
|
65754
|
+
const [, pattern2, replacement, flags] = simpleSubstituteMatch;
|
|
65755
|
+
return {
|
|
65756
|
+
type: "substitute",
|
|
65757
|
+
pattern: pattern2,
|
|
65758
|
+
replacement: replacement || "",
|
|
65759
|
+
flags: flags || ""
|
|
65760
|
+
};
|
|
65761
|
+
}
|
|
65762
|
+
const deleteMatch = expr.match(/^(\d+)?(,(\d+|\$))?d$/);
|
|
65763
|
+
if (deleteMatch) {
|
|
65764
|
+
const [, startLine, , endLine] = deleteMatch;
|
|
65765
|
+
const address = startLine ? {
|
|
65766
|
+
type: endLine ? "range" : "line",
|
|
65767
|
+
start: parseInt(startLine, 10),
|
|
65768
|
+
...endLine && { end: endLine === "$" ? Infinity : parseInt(endLine, 10) }
|
|
65769
|
+
} : void 0;
|
|
65770
|
+
return {
|
|
65771
|
+
type: "delete",
|
|
65772
|
+
address
|
|
65773
|
+
};
|
|
65774
|
+
}
|
|
65775
|
+
const patternDeleteMatch = expr.match(/^\/(.+?)\/d$/);
|
|
65776
|
+
if (patternDeleteMatch) {
|
|
65777
|
+
return {
|
|
65778
|
+
type: "delete",
|
|
65779
|
+
address: {
|
|
65780
|
+
type: "pattern",
|
|
65781
|
+
start: patternDeleteMatch[1]
|
|
65782
|
+
}
|
|
65783
|
+
};
|
|
65784
|
+
}
|
|
65785
|
+
const printMatch = expr.match(/^\/(.+?)\/p$/);
|
|
65786
|
+
if (printMatch) {
|
|
65787
|
+
return {
|
|
65788
|
+
type: "print",
|
|
65789
|
+
address: {
|
|
65790
|
+
type: "pattern",
|
|
65791
|
+
start: printMatch[1]
|
|
65792
|
+
}
|
|
65793
|
+
};
|
|
65794
|
+
}
|
|
65795
|
+
return null;
|
|
65796
|
+
}
|
|
65797
|
+
__name(parseSedExpression, "parseSedExpression");
|
|
65798
|
+
function applySedCommand(line3, lineNum, totalLines, command) {
|
|
65799
|
+
if (command.type === "substitute") {
|
|
65800
|
+
if (!command.pattern || command.replacement === void 0) {
|
|
65801
|
+
return { result: line3, shouldPrint: false };
|
|
65802
|
+
}
|
|
65803
|
+
let shouldApply = true;
|
|
65804
|
+
if (command.address) {
|
|
65805
|
+
switch (command.address.type) {
|
|
65806
|
+
case "line":
|
|
65807
|
+
shouldApply = lineNum === command.address.start;
|
|
65808
|
+
break;
|
|
65809
|
+
case "range":
|
|
65810
|
+
const end = command.address.end === Infinity ? totalLines : command.address.end;
|
|
65811
|
+
shouldApply = lineNum >= command.address.start && lineNum <= end;
|
|
65812
|
+
break;
|
|
65813
|
+
case "pattern":
|
|
65814
|
+
try {
|
|
65815
|
+
const regex = new RegExp(command.address.start);
|
|
65816
|
+
shouldApply = regex.test(line3);
|
|
65817
|
+
} catch {
|
|
65818
|
+
return { result: line3, shouldPrint: false };
|
|
65819
|
+
}
|
|
65820
|
+
break;
|
|
65821
|
+
}
|
|
65822
|
+
}
|
|
65823
|
+
if (!shouldApply) {
|
|
65824
|
+
return { result: line3, shouldPrint: false };
|
|
65825
|
+
}
|
|
65826
|
+
const flags = command.flags || "";
|
|
65827
|
+
const global2 = flags.includes("g");
|
|
65828
|
+
const caseInsensitive = flags.includes("i");
|
|
65829
|
+
const nthMatch = flags.match(/^\d+$/) ? parseInt(flags, 10) : null;
|
|
65830
|
+
try {
|
|
65831
|
+
let regexFlags = global2 ? "g" : "";
|
|
65832
|
+
if (caseInsensitive) regexFlags += "i";
|
|
65833
|
+
if (nthMatch) {
|
|
65834
|
+
let count = 0;
|
|
65835
|
+
const regex2 = new RegExp(command.pattern, caseInsensitive ? "gi" : "g");
|
|
65836
|
+
const result2 = line3.replace(regex2, (match) => {
|
|
65837
|
+
count++;
|
|
65838
|
+
if (count === nthMatch) {
|
|
65839
|
+
return command.replacement || match;
|
|
65840
|
+
}
|
|
65841
|
+
return match;
|
|
65842
|
+
});
|
|
65843
|
+
return { result: result2, shouldPrint: false };
|
|
65844
|
+
}
|
|
65845
|
+
const regex = new RegExp(command.pattern, regexFlags || void 0);
|
|
65846
|
+
const result = line3.replace(regex, command.replacement);
|
|
65847
|
+
return { result, shouldPrint: false };
|
|
65848
|
+
} catch {
|
|
65849
|
+
return { result: line3, shouldPrint: false };
|
|
65850
|
+
}
|
|
65851
|
+
}
|
|
65852
|
+
if (command.type === "delete") {
|
|
65853
|
+
if (command.address) {
|
|
65854
|
+
switch (command.address.type) {
|
|
65855
|
+
case "line":
|
|
65856
|
+
if (lineNum === command.address.start) {
|
|
65857
|
+
return { result: null, shouldPrint: false };
|
|
65858
|
+
}
|
|
65859
|
+
break;
|
|
65860
|
+
case "range":
|
|
65861
|
+
const end = command.address.end === Infinity ? totalLines : command.address.end;
|
|
65862
|
+
if (lineNum >= command.address.start && lineNum <= end) {
|
|
65863
|
+
return { result: null, shouldPrint: false };
|
|
65864
|
+
}
|
|
65865
|
+
break;
|
|
65866
|
+
case "pattern":
|
|
65867
|
+
try {
|
|
65868
|
+
const regex = new RegExp(command.address.start);
|
|
65869
|
+
if (regex.test(line3)) {
|
|
65870
|
+
return { result: null, shouldPrint: false };
|
|
65871
|
+
}
|
|
65872
|
+
} catch {
|
|
65873
|
+
return { result: line3, shouldPrint: false };
|
|
65874
|
+
}
|
|
65875
|
+
break;
|
|
65876
|
+
}
|
|
65877
|
+
}
|
|
65878
|
+
return { result: line3, shouldPrint: false };
|
|
65879
|
+
}
|
|
65880
|
+
if (command.type === "print") {
|
|
65881
|
+
if (command.address && command.address.type === "pattern") {
|
|
65882
|
+
try {
|
|
65883
|
+
const regex = new RegExp(command.address.start);
|
|
65884
|
+
if (regex.test(line3)) {
|
|
65885
|
+
return { result: line3, shouldPrint: true };
|
|
65886
|
+
}
|
|
65887
|
+
} catch {
|
|
65888
|
+
return { result: line3, shouldPrint: false };
|
|
65889
|
+
}
|
|
65890
|
+
}
|
|
65891
|
+
return { result: line3, shouldPrint: false };
|
|
65892
|
+
}
|
|
65893
|
+
return { result: line3, shouldPrint: false };
|
|
65894
|
+
}
|
|
65895
|
+
__name(applySedCommand, "applySedCommand");
|
|
65896
|
+
function createCommand$1(kernel, shell, terminal) {
|
|
65897
|
+
return new TerminalCommand({
|
|
65898
|
+
command: "sed",
|
|
65899
|
+
description: "Stream editor for filtering and transforming text",
|
|
65900
|
+
kernel,
|
|
65901
|
+
shell,
|
|
65902
|
+
terminal,
|
|
65903
|
+
options: [
|
|
65904
|
+
{ name: "help", type: Boolean, description: kernel.i18n.t("Display help") },
|
|
65905
|
+
{ name: "expression", type: String, alias: "e", multiple: true, description: "Add the script to the commands to be executed" },
|
|
65906
|
+
{ name: "file", type: String, alias: "f", description: "Add the contents of script-file to the commands to be executed" },
|
|
65907
|
+
{ name: "inplace", type: String, alias: "i", description: "Edit files in place (makes backup if extension supplied)" },
|
|
65908
|
+
{ name: "quiet", type: Boolean, alias: "q", description: "Suppress normal output" },
|
|
65909
|
+
{ name: "path", type: String, typeLabel: "{underline path}", defaultOption: true, multiple: true, description: "Expression or input file(s)" }
|
|
65910
|
+
],
|
|
65911
|
+
run: /* @__PURE__ */ __name(async (argv, process2) => {
|
|
65912
|
+
if (!process2) return 1;
|
|
65913
|
+
let expressions = argv.expression || [];
|
|
65914
|
+
let files = argv.path || [];
|
|
65915
|
+
const inplace = argv.inplace;
|
|
65916
|
+
const quiet = argv.quiet || false;
|
|
65917
|
+
const isSedExpression = /* @__PURE__ */ __name((arg) => {
|
|
65918
|
+
if (!arg) return false;
|
|
65919
|
+
const trimmed = arg.trim();
|
|
65920
|
+
return trimmed.startsWith("s/") || trimmed.startsWith("/") || /^\d+[sd]/.test(trimmed) || /^\d+,\d*[sd]/.test(trimmed) || /^\d+s\//.test(trimmed) || /^\d+,\d*s\//.test(trimmed);
|
|
65921
|
+
}, "isSedExpression");
|
|
65922
|
+
const potentialExpressions = [];
|
|
65923
|
+
const potentialFiles = [];
|
|
65924
|
+
for (const arg of files) {
|
|
65925
|
+
if (isSedExpression(arg)) {
|
|
65926
|
+
potentialExpressions.push(arg);
|
|
65927
|
+
} else {
|
|
65928
|
+
potentialFiles.push(arg);
|
|
65929
|
+
}
|
|
65930
|
+
}
|
|
65931
|
+
if (potentialExpressions.length > 0) {
|
|
65932
|
+
expressions = [...expressions, ...potentialExpressions];
|
|
65933
|
+
files = potentialFiles;
|
|
65934
|
+
}
|
|
65935
|
+
if (expressions.length === 0 && !argv.file) {
|
|
65936
|
+
await writelnStderr(process2, terminal, "sed: No expression provided");
|
|
65937
|
+
return 1;
|
|
65938
|
+
}
|
|
65939
|
+
const commands = [];
|
|
65940
|
+
if (argv.file) {
|
|
65941
|
+
const scriptPath = path$1.resolve(shell.cwd, argv.file);
|
|
65942
|
+
const exists2 = await shell.context.fs.promises.exists(scriptPath);
|
|
65943
|
+
if (!exists2) {
|
|
65944
|
+
await writelnStderr(process2, terminal, `sed: ${argv.file}: No such file or directory`);
|
|
65945
|
+
return 1;
|
|
65946
|
+
}
|
|
65947
|
+
const scriptContent = await shell.context.fs.promises.readFile(scriptPath, "utf-8");
|
|
65948
|
+
const scriptLines = scriptContent.split("\n").filter((line3) => line3.trim() && !line3.trim().startsWith("#"));
|
|
65949
|
+
for (const line3 of scriptLines) {
|
|
65950
|
+
const cmd = parseSedExpression(line3.trim());
|
|
65951
|
+
if (cmd) commands.push(cmd);
|
|
65952
|
+
}
|
|
65953
|
+
}
|
|
65954
|
+
for (const expr of expressions) {
|
|
65955
|
+
const cmd = parseSedExpression(expr);
|
|
65956
|
+
if (cmd) {
|
|
65957
|
+
commands.push(cmd);
|
|
65958
|
+
} else {
|
|
65959
|
+
await writelnStderr(process2, terminal, `sed: Invalid expression: ${expr}`);
|
|
65960
|
+
return 1;
|
|
65961
|
+
}
|
|
65962
|
+
}
|
|
65963
|
+
if (commands.length === 0) {
|
|
65964
|
+
await writelnStderr(process2, terminal, "sed: No valid commands found");
|
|
65965
|
+
return 1;
|
|
65966
|
+
}
|
|
65967
|
+
const writer = process2.stdout.getWriter();
|
|
65968
|
+
try {
|
|
65969
|
+
const processFile = /* @__PURE__ */ __name(async (filePath) => {
|
|
65970
|
+
const exists2 = await shell.context.fs.promises.exists(filePath);
|
|
65971
|
+
if (!exists2) {
|
|
65972
|
+
await writelnStderr(process2, terminal, `sed: ${filePath}: No such file or directory`);
|
|
65973
|
+
return [];
|
|
65974
|
+
}
|
|
65975
|
+
const stats = await shell.context.fs.promises.stat(filePath);
|
|
65976
|
+
if (stats.isDirectory()) {
|
|
65977
|
+
await writelnStderr(process2, terminal, `sed: ${filePath}: Is a directory`);
|
|
65978
|
+
return [];
|
|
65979
|
+
}
|
|
65980
|
+
const content = await shell.context.fs.promises.readFile(filePath, "utf-8");
|
|
65981
|
+
return content.split("\n");
|
|
65982
|
+
}, "processFile");
|
|
65983
|
+
let inputLines = [];
|
|
65984
|
+
if (files.length > 0) {
|
|
65985
|
+
for (const file of files) {
|
|
65986
|
+
const expandedPath = shell.expandTilde(file);
|
|
65987
|
+
const fullPath = path$1.resolve(shell.cwd, expandedPath);
|
|
65988
|
+
const lines = await processFile(fullPath);
|
|
65989
|
+
inputLines.push(...lines);
|
|
65990
|
+
if (lines.length > 0 && inputLines.length > lines.length) {
|
|
65991
|
+
inputLines.push("");
|
|
65992
|
+
}
|
|
65993
|
+
}
|
|
65994
|
+
} else {
|
|
65995
|
+
if (!process2.stdin) {
|
|
65996
|
+
await writelnStderr(process2, terminal, "sed: No input provided");
|
|
65997
|
+
return 1;
|
|
65998
|
+
}
|
|
65999
|
+
const reader = process2.stdin.getReader();
|
|
66000
|
+
const decoder2 = new TextDecoder();
|
|
66001
|
+
const chunks = [];
|
|
66002
|
+
try {
|
|
66003
|
+
while (true) {
|
|
66004
|
+
const { done, value } = await reader.read();
|
|
66005
|
+
if (done) break;
|
|
66006
|
+
chunks.push(decoder2.decode(value, { stream: true }));
|
|
66007
|
+
}
|
|
66008
|
+
chunks.push(decoder2.decode(new Uint8Array(), { stream: false }));
|
|
66009
|
+
} finally {
|
|
66010
|
+
reader.releaseLock();
|
|
66011
|
+
}
|
|
66012
|
+
const content = chunks.join("");
|
|
66013
|
+
inputLines = content.split("\n");
|
|
66014
|
+
}
|
|
66015
|
+
const outputLines = [];
|
|
66016
|
+
const totalLines = inputLines.length;
|
|
66017
|
+
for (let i = 0; i < inputLines.length; i++) {
|
|
66018
|
+
let line3 = inputLines[i] || "";
|
|
66019
|
+
let lineNum = i + 1;
|
|
66020
|
+
let shouldPrint = false;
|
|
66021
|
+
for (const command of commands) {
|
|
66022
|
+
const { result, shouldPrint: print } = applySedCommand(line3, lineNum, totalLines, command);
|
|
66023
|
+
if (result === null) {
|
|
66024
|
+
line3 = null;
|
|
66025
|
+
break;
|
|
66026
|
+
}
|
|
66027
|
+
line3 = result;
|
|
66028
|
+
if (print) {
|
|
66029
|
+
shouldPrint = true;
|
|
66030
|
+
}
|
|
66031
|
+
}
|
|
66032
|
+
if (line3 !== null) {
|
|
66033
|
+
outputLines.push(line3);
|
|
66034
|
+
if (shouldPrint && !quiet) {
|
|
66035
|
+
outputLines.push(line3);
|
|
66036
|
+
}
|
|
66037
|
+
}
|
|
66038
|
+
}
|
|
66039
|
+
const output2 = outputLines.join("\n");
|
|
66040
|
+
if (inplace !== void 0 && files.length > 0) {
|
|
66041
|
+
for (const file of files) {
|
|
66042
|
+
const expandedPath = shell.expandTilde(file);
|
|
66043
|
+
const fullPath = path$1.resolve(shell.cwd, expandedPath);
|
|
66044
|
+
const fileLines = await processFile(fullPath);
|
|
66045
|
+
if (fileLines.length === 0) continue;
|
|
66046
|
+
const fileOutputLines = [];
|
|
66047
|
+
const fileTotalLines = fileLines.length;
|
|
66048
|
+
for (let i = 0; i < fileLines.length; i++) {
|
|
66049
|
+
let line3 = fileLines[i] || "";
|
|
66050
|
+
let lineNum = i + 1;
|
|
66051
|
+
let shouldPrint = false;
|
|
66052
|
+
for (const command of commands) {
|
|
66053
|
+
const { result, shouldPrint: print } = applySedCommand(line3, lineNum, fileTotalLines, command);
|
|
66054
|
+
if (result === null) {
|
|
66055
|
+
line3 = null;
|
|
66056
|
+
break;
|
|
66057
|
+
}
|
|
66058
|
+
line3 = result;
|
|
66059
|
+
if (print) {
|
|
66060
|
+
shouldPrint = true;
|
|
66061
|
+
}
|
|
66062
|
+
}
|
|
66063
|
+
if (line3 !== null) {
|
|
66064
|
+
fileOutputLines.push(line3);
|
|
66065
|
+
if (shouldPrint && !quiet) {
|
|
66066
|
+
fileOutputLines.push(line3);
|
|
66067
|
+
}
|
|
66068
|
+
}
|
|
66069
|
+
}
|
|
66070
|
+
const fileOutput = fileOutputLines.join("\n");
|
|
66071
|
+
if (inplace) {
|
|
66072
|
+
const backupPath = `${fullPath}${inplace}`;
|
|
66073
|
+
const originalContent = await shell.context.fs.promises.readFile(fullPath, "utf-8");
|
|
66074
|
+
await shell.context.fs.promises.writeFile(backupPath, originalContent);
|
|
66075
|
+
}
|
|
66076
|
+
await shell.context.fs.promises.writeFile(fullPath, fileOutput);
|
|
66077
|
+
}
|
|
66078
|
+
} else {
|
|
66079
|
+
await writer.write(new TextEncoder().encode(output2));
|
|
66080
|
+
}
|
|
66081
|
+
return 0;
|
|
66082
|
+
} catch (error) {
|
|
66083
|
+
await writelnStderr(process2, terminal, `sed: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
66084
|
+
return 1;
|
|
66085
|
+
} finally {
|
|
66086
|
+
writer.releaseLock();
|
|
66087
|
+
}
|
|
66088
|
+
}, "run")
|
|
66089
|
+
});
|
|
66090
|
+
}
|
|
66091
|
+
__name(createCommand$1, "createCommand$1");
|
|
66092
|
+
function createCommand(kernel, shell, terminal) {
|
|
66093
|
+
return new TerminalCommand({
|
|
66094
|
+
command: "tee",
|
|
66095
|
+
description: "Read from standard input and write to standard output and files",
|
|
66096
|
+
kernel,
|
|
66097
|
+
shell,
|
|
66098
|
+
terminal,
|
|
66099
|
+
options: [
|
|
66100
|
+
{ name: "help", type: Boolean, description: kernel.i18n.t("Display help") },
|
|
66101
|
+
{ name: "append", type: Boolean, alias: "a", description: "Append to the given files, do not overwrite" },
|
|
66102
|
+
{ name: "ignore-interrupts", type: Boolean, alias: "i", description: "Ignore interrupt signals" },
|
|
66103
|
+
{ name: "path", type: String, typeLabel: "{underline path}", defaultOption: true, multiple: true, description: "File(s) to write to" }
|
|
66104
|
+
],
|
|
66105
|
+
run: /* @__PURE__ */ __name(async (argv, process2) => {
|
|
66106
|
+
if (!process2) return 1;
|
|
66107
|
+
if (!process2.stdin) {
|
|
66108
|
+
await writelnStderr(process2, terminal, "tee: No input provided");
|
|
66109
|
+
return 1;
|
|
66110
|
+
}
|
|
66111
|
+
const files = argv.path || [];
|
|
66112
|
+
const append2 = argv.append || false;
|
|
66113
|
+
const ignoreInterrupts = argv["ignore-interrupts"] || false;
|
|
66114
|
+
const writer = process2.stdout.getWriter();
|
|
66115
|
+
try {
|
|
66116
|
+
const filePaths = [];
|
|
66117
|
+
for (const file of files) {
|
|
66118
|
+
const expandedPath = shell.expandTilde(file);
|
|
66119
|
+
const fullPath = path$1.resolve(shell.cwd, expandedPath);
|
|
66120
|
+
if (!append2) {
|
|
66121
|
+
try {
|
|
66122
|
+
await shell.context.fs.promises.writeFile(fullPath, "");
|
|
66123
|
+
} catch (error) {
|
|
66124
|
+
await writelnStderr(process2, terminal, `tee: ${file}: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
66125
|
+
return 1;
|
|
66126
|
+
}
|
|
66127
|
+
}
|
|
66128
|
+
filePaths.push({ path: file, fullPath });
|
|
66129
|
+
}
|
|
66130
|
+
const reader = process2.stdin.getReader();
|
|
66131
|
+
let interrupted = false;
|
|
66132
|
+
const interruptHandler = /* @__PURE__ */ __name(() => {
|
|
66133
|
+
interrupted = true;
|
|
66134
|
+
}, "interruptHandler");
|
|
66135
|
+
if (!ignoreInterrupts) {
|
|
66136
|
+
kernel.terminal.events.on(TerminalEvents.INTERRUPT, interruptHandler);
|
|
66137
|
+
}
|
|
66138
|
+
try {
|
|
66139
|
+
while (true) {
|
|
66140
|
+
if (interrupted) break;
|
|
66141
|
+
const { done, value } = await reader.read();
|
|
66142
|
+
if (done) break;
|
|
66143
|
+
await writer.write(value);
|
|
66144
|
+
for (const fileInfo of filePaths) {
|
|
66145
|
+
try {
|
|
66146
|
+
await shell.context.fs.promises.appendFile(fileInfo.fullPath, value);
|
|
66147
|
+
} catch (error) {
|
|
66148
|
+
await writelnStderr(process2, terminal, `tee: ${fileInfo.path}: ${error instanceof Error ? error.message : "Write error"}`);
|
|
66149
|
+
}
|
|
66150
|
+
}
|
|
66151
|
+
}
|
|
66152
|
+
} finally {
|
|
66153
|
+
reader.releaseLock();
|
|
66154
|
+
if (!ignoreInterrupts) {
|
|
66155
|
+
kernel.terminal.events.off(TerminalEvents.INTERRUPT, interruptHandler);
|
|
66156
|
+
}
|
|
66157
|
+
}
|
|
66158
|
+
return 0;
|
|
66159
|
+
} catch (error) {
|
|
66160
|
+
await writelnStderr(process2, terminal, `tee: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
66161
|
+
return 1;
|
|
66162
|
+
} finally {
|
|
66163
|
+
writer.releaseLock();
|
|
66164
|
+
}
|
|
66165
|
+
}, "run")
|
|
66166
|
+
});
|
|
66167
|
+
}
|
|
65319
66168
|
__name(createCommand, "createCommand");
|
|
65320
66169
|
function createAllCommands(kernel, shell, terminal) {
|
|
65321
66170
|
return {
|
|
65322
|
-
cat: createCommand$
|
|
65323
|
-
cd: createCommand$
|
|
65324
|
-
chmod: createCommand$
|
|
65325
|
-
cp: createCommand$
|
|
65326
|
-
echo: createCommand$
|
|
65327
|
-
ln: createCommand$
|
|
65328
|
-
ls: createCommand$
|
|
65329
|
-
mkdir: createCommand$
|
|
65330
|
-
mv: createCommand$
|
|
65331
|
-
pwd: createCommand$
|
|
65332
|
-
rm: createCommand$
|
|
65333
|
-
rmdir: createCommand$
|
|
65334
|
-
stat: createCommand$
|
|
65335
|
-
touch: createCommand(kernel, shell, terminal)
|
|
66171
|
+
cat: createCommand$h(kernel, shell, terminal),
|
|
66172
|
+
cd: createCommand$g(kernel, shell, terminal),
|
|
66173
|
+
chmod: createCommand$f(kernel, shell, terminal),
|
|
66174
|
+
cp: createCommand$e(kernel, shell, terminal),
|
|
66175
|
+
echo: createCommand$d(kernel, shell, terminal),
|
|
66176
|
+
ln: createCommand$c(kernel, shell, terminal),
|
|
66177
|
+
ls: createCommand$b(kernel, shell, terminal),
|
|
66178
|
+
mkdir: createCommand$a(kernel, shell, terminal),
|
|
66179
|
+
mv: createCommand$9(kernel, shell, terminal),
|
|
66180
|
+
pwd: createCommand$8(kernel, shell, terminal),
|
|
66181
|
+
rm: createCommand$7(kernel, shell, terminal),
|
|
66182
|
+
rmdir: createCommand$6(kernel, shell, terminal),
|
|
66183
|
+
stat: createCommand$5(kernel, shell, terminal),
|
|
66184
|
+
touch: createCommand$4(kernel, shell, terminal),
|
|
66185
|
+
hex: createCommand$3(kernel, shell, terminal),
|
|
66186
|
+
less: createCommand$2(kernel, shell, terminal),
|
|
66187
|
+
sed: createCommand$1(kernel, shell, terminal),
|
|
66188
|
+
tee: createCommand(kernel, shell, terminal)
|
|
65336
66189
|
};
|
|
65337
66190
|
}
|
|
65338
66191
|
__name(createAllCommands, "createAllCommands");
|
|
@@ -65436,7 +66289,7 @@ const TerminalCommands = /* @__PURE__ */ __name((kernel, shell, terminal) => {
|
|
|
65436
66289
|
{ name: "reinstall", type: Boolean, description: "Reinstall the package if it is already installed" }
|
|
65437
66290
|
],
|
|
65438
66291
|
run: /* @__PURE__ */ __name(async (argv) => {
|
|
65439
|
-
const { default: install } = await import("./install-
|
|
66292
|
+
const { default: install } = await import("./install-DIY-HQ9n.js");
|
|
65440
66293
|
return await install({ kernel, shell, terminal, args: [argv.package, argv.registry, argv.reinstall] });
|
|
65441
66294
|
}, "run")
|
|
65442
66295
|
}),
|
|
@@ -65451,7 +66304,7 @@ const TerminalCommands = /* @__PURE__ */ __name((kernel, shell, terminal) => {
|
|
|
65451
66304
|
{ name: "package", type: String, typeLabel: "{underline package}", defaultOption: true, description: "The package name and optional version (e.g. package@1.0.0). If no version is specified, all versions will be uninstalled." }
|
|
65452
66305
|
],
|
|
65453
66306
|
run: /* @__PURE__ */ __name(async (argv) => {
|
|
65454
|
-
const { default: uninstall } = await import("./uninstall-
|
|
66307
|
+
const { default: uninstall } = await import("./uninstall-BOyXf2bF.js");
|
|
65455
66308
|
return await uninstall({ kernel, shell, terminal, args: [argv.package] });
|
|
65456
66309
|
}, "run")
|
|
65457
66310
|
}),
|
|
@@ -66003,7 +66856,7 @@ const snake = /* @__PURE__ */ __name(({ kernel, terminal }) => {
|
|
|
66003
66856
|
const gameBoard = Array(height).fill(null).map(() => Array(width).fill(" "));
|
|
66004
66857
|
snake2.forEach((segment) => gameBoard[segment.y][segment.x] = segment.y === snake2[0].y && segment.x === snake2[0].x ? chalk$2.yellow("█") : chalk$2.gray("█"));
|
|
66005
66858
|
gameBoard[food.y][food.x] = chalk$2.green("●");
|
|
66006
|
-
terminal.write(ansi$
|
|
66859
|
+
terminal.write(ansi$7.erase.display(2) + ansi$7.cursor.position(2, 1));
|
|
66007
66860
|
terminal.writeln(chalk$2.blue("┌" + "─".repeat(width) + "┐"));
|
|
66008
66861
|
gameBoard.forEach((row) => terminal.writeln(chalk$2.blue("│" + row.join("") + "│")));
|
|
66009
66862
|
terminal.writeln(chalk$2.blue(`└${"─".repeat(width)}┘`));
|
|
@@ -66023,7 +66876,7 @@ const snake = /* @__PURE__ */ __name(({ kernel, terminal }) => {
|
|
|
66023
66876
|
} else snake2.pop();
|
|
66024
66877
|
return;
|
|
66025
66878
|
}, "moveSnake");
|
|
66026
|
-
terminal.write(ansi$
|
|
66879
|
+
terminal.write(ansi$7.cursor.hide);
|
|
66027
66880
|
terminal.unlisten();
|
|
66028
66881
|
renderGame();
|
|
66029
66882
|
const keyListener = terminal.onKey(({ domEvent }) => {
|
|
@@ -66063,7 +66916,7 @@ const snake = /* @__PURE__ */ __name(({ kernel, terminal }) => {
|
|
|
66063
66916
|
terminal.listen();
|
|
66064
66917
|
clearInterval(gameLoop);
|
|
66065
66918
|
terminal.writeln("Game Over!");
|
|
66066
|
-
terminal.write(ansi$
|
|
66919
|
+
terminal.write(ansi$7.cursor.show + terminal.prompt());
|
|
66067
66920
|
return;
|
|
66068
66921
|
}
|
|
66069
66922
|
if (!gameStarted) return;
|
|
@@ -66465,7 +67318,7 @@ const _Terminal = class _Terminal extends xtermExports.Terminal {
|
|
|
66465
67318
|
if (!options.kernel) throw new Error("Terminal requires a kernel");
|
|
66466
67319
|
super({ ...DefaultTerminalOptions, ...options });
|
|
66467
67320
|
__publicField(this, "_addons", /* @__PURE__ */ new Map());
|
|
66468
|
-
__publicField(this, "_ansi", ansi$
|
|
67321
|
+
__publicField(this, "_ansi", ansi$7);
|
|
66469
67322
|
__publicField(this, "_cmd", "");
|
|
66470
67323
|
__publicField(this, "_commands");
|
|
66471
67324
|
__publicField(this, "_cursorPosition", 0);
|
|
@@ -66704,18 +67557,18 @@ const _Terminal = class _Terminal extends xtermExports.Terminal {
|
|
|
66704
67557
|
resolve2(input);
|
|
66705
67558
|
break;
|
|
66706
67559
|
case "ArrowLeft":
|
|
66707
|
-
this.write(ansi$
|
|
67560
|
+
this.write(ansi$7.cursor.back());
|
|
66708
67561
|
cursor--;
|
|
66709
67562
|
break;
|
|
66710
67563
|
case "ArrowRight":
|
|
66711
|
-
this.write(ansi$
|
|
67564
|
+
this.write(ansi$7.cursor.forward());
|
|
66712
67565
|
cursor++;
|
|
66713
67566
|
break;
|
|
66714
67567
|
case "Home":
|
|
66715
|
-
this.write(ansi$
|
|
67568
|
+
this.write(ansi$7.cursor.horizontalAbsolute(0));
|
|
66716
67569
|
break;
|
|
66717
67570
|
case "End":
|
|
66718
|
-
this.write(ansi$
|
|
67571
|
+
this.write(ansi$7.cursor.horizontalAbsolute(input.length));
|
|
66719
67572
|
break;
|
|
66720
67573
|
case "Escape":
|
|
66721
67574
|
disposable.dispose();
|
|
@@ -66724,7 +67577,7 @@ const _Terminal = class _Terminal extends xtermExports.Terminal {
|
|
|
66724
67577
|
case "Backspace":
|
|
66725
67578
|
if (cursor > 0) {
|
|
66726
67579
|
input = input.slice(0, cursor - 1) + input.slice(cursor);
|
|
66727
|
-
this.write(ansi$
|
|
67580
|
+
this.write(ansi$7.cursor.horizontalAbsolute(0) + ansi$7.erase.inLine(2) + ":" + input);
|
|
66728
67581
|
cursor--;
|
|
66729
67582
|
} else this.write("\x07");
|
|
66730
67583
|
break;
|
|
@@ -66736,7 +67589,7 @@ const _Terminal = class _Terminal extends xtermExports.Terminal {
|
|
|
66736
67589
|
const charCode = domEvent.key.charCodeAt(0);
|
|
66737
67590
|
if (charCode >= 32 && charCode <= 126) {
|
|
66738
67591
|
input = input.slice(0, cursor) + domEvent.key + input.slice(cursor);
|
|
66739
|
-
if (!hide) this.write(ansi$
|
|
67592
|
+
if (!hide) this.write(ansi$7.cursor.horizontalAbsolute(0) + ansi$7.erase.inLine(2) + prompt + input);
|
|
66740
67593
|
cursor++;
|
|
66741
67594
|
}
|
|
66742
67595
|
}
|
|
@@ -66905,7 +67758,7 @@ const _Terminal = class _Terminal extends xtermExports.Terminal {
|
|
|
66905
67758
|
case "v":
|
|
66906
67759
|
return this.paste();
|
|
66907
67760
|
case "Escape":
|
|
66908
|
-
return this.write(ansi$
|
|
67761
|
+
return this.write(ansi$7.erase.display(2) + ansi$7.cursor.position() + this.prompt());
|
|
66909
67762
|
}
|
|
66910
67763
|
}
|
|
66911
67764
|
switch (keyName) {
|
|
@@ -66947,7 +67800,7 @@ const _Terminal = class _Terminal extends xtermExports.Terminal {
|
|
|
66947
67800
|
}
|
|
66948
67801
|
this._cmd = "";
|
|
66949
67802
|
this._cursorPosition = 0;
|
|
66950
|
-
this.write(ansi$
|
|
67803
|
+
this.write(ansi$7.erase.inLine(2) + this.prompt());
|
|
66951
67804
|
break;
|
|
66952
67805
|
case "Backspace":
|
|
66953
67806
|
if (this._cursorPosition > 0) {
|
|
@@ -66961,7 +67814,7 @@ const _Terminal = class _Terminal extends xtermExports.Terminal {
|
|
|
66961
67814
|
case "Delete":
|
|
66962
67815
|
if (this._cursorPosition < this._cmd.length) {
|
|
66963
67816
|
this._cmd = this._cmd.slice(0, this._cursorPosition) + this._cmd.slice(this._cursorPosition + 1);
|
|
66964
|
-
this.write(ansi$
|
|
67817
|
+
this.write(ansi$7.erase.inLine(2) + ansi$7.cursor.horizontalAbsolute(0));
|
|
66965
67818
|
if (this._multiLineMode) {
|
|
66966
67819
|
const parts = this._cmd.split("#");
|
|
66967
67820
|
if (parts.length > 1) {
|
|
@@ -67040,11 +67893,11 @@ const _Terminal = class _Terminal extends xtermExports.Terminal {
|
|
|
67040
67893
|
break;
|
|
67041
67894
|
case "Home":
|
|
67042
67895
|
this._cursorPosition = 0;
|
|
67043
|
-
this.write(ansi$
|
|
67896
|
+
this.write(ansi$7.cursor.horizontalAbsolute(this.prompt().replace(/\x1b\[[0-9;]*[a-zA-Z]/g, "").length + 1));
|
|
67044
67897
|
break;
|
|
67045
67898
|
case "End":
|
|
67046
67899
|
this._cursorPosition = this._cmd.length + 1;
|
|
67047
|
-
this.write(ansi$
|
|
67900
|
+
this.write(ansi$7.cursor.horizontalAbsolute(this.prompt().replace(/\x1b\[[0-9;]*[a-zA-Z]/g, "").length + this._cmd.length + 1));
|
|
67048
67901
|
break;
|
|
67049
67902
|
case "Tab": {
|
|
67050
67903
|
domEvent.preventDefault();
|
|
@@ -67063,7 +67916,7 @@ const _Terminal = class _Terminal extends xtermExports.Terminal {
|
|
|
67063
67916
|
await this._shell.execute(`ls ${expandedPath}`);
|
|
67064
67917
|
this.write(this.prompt() + this._cmd);
|
|
67065
67918
|
} else if (matches.length > 0) {
|
|
67066
|
-
this.write("\r" + ansi$
|
|
67919
|
+
this.write("\r" + ansi$7.erase.inLine());
|
|
67067
67920
|
this._tabCompletionIndex = (this._tabCompletionIndex + 1) % matches.length;
|
|
67068
67921
|
const newCmd = matches[this._tabCompletionIndex] || "";
|
|
67069
67922
|
this._cmd = newCmd;
|
|
@@ -67082,7 +67935,7 @@ const _Terminal = class _Terminal extends xtermExports.Terminal {
|
|
|
67082
67935
|
if (key.length === 1) {
|
|
67083
67936
|
this._cmd = this._cmd.slice(0, this._cursorPosition) + key + this._cmd.slice(this._cursorPosition);
|
|
67084
67937
|
this._cursorPosition++;
|
|
67085
|
-
this.write(ansi$
|
|
67938
|
+
this.write(ansi$7.erase.inLine(2) + ansi$7.cursor.horizontalAbsolute(0));
|
|
67086
67939
|
if (this._multiLineMode) {
|
|
67087
67940
|
const parts = this._cmd.split("#");
|
|
67088
67941
|
if (parts.length > 1) {
|
|
@@ -67157,7 +68010,7 @@ const _Terminal = class _Terminal extends xtermExports.Terminal {
|
|
|
67157
68010
|
const currentLine = this._cmd;
|
|
67158
68011
|
this._cmd = "";
|
|
67159
68012
|
this._cursorPosition = 0;
|
|
67160
|
-
this.write("\r" + ansi$
|
|
68013
|
+
this.write("\r" + ansi$7.erase.inLine(2));
|
|
67161
68014
|
return currentLine;
|
|
67162
68015
|
}
|
|
67163
68016
|
restoreCommand(cmd) {
|
|
@@ -67254,7 +68107,7 @@ const _Spinner = class _Spinner {
|
|
|
67254
68107
|
}
|
|
67255
68108
|
start() {
|
|
67256
68109
|
let index = 0;
|
|
67257
|
-
this.terminal.write(ansi$
|
|
68110
|
+
this.terminal.write(ansi$7.cursor.hide);
|
|
67258
68111
|
const interval = setInterval(() => {
|
|
67259
68112
|
const currentFrame = this.frames[index];
|
|
67260
68113
|
const fullText = `${this.prefix ? this.prefix + " " : ""}${currentFrame}${this.suffix ? " " + this.suffix : ""}`;
|
|
@@ -67272,7 +68125,7 @@ const _Spinner = class _Spinner {
|
|
|
67272
68125
|
}
|
|
67273
68126
|
stop() {
|
|
67274
68127
|
clearInterval(this.loop);
|
|
67275
|
-
this.terminal.write(ansi$
|
|
68128
|
+
this.terminal.write(ansi$7.cursor.show);
|
|
67276
68129
|
}
|
|
67277
68130
|
};
|
|
67278
68131
|
__name(_Spinner, "Spinner");
|
|
@@ -72715,7 +73568,7 @@ const _Workers = class _Workers {
|
|
|
72715
73568
|
};
|
|
72716
73569
|
__name(_Workers, "Workers");
|
|
72717
73570
|
let Workers = _Workers;
|
|
72718
|
-
const __vite_import_meta_env__ = { "AUTHOR": { "name": "Jay Mathis", "email": "code@mathis.network", "url": "https://github.com/mathiscode" }, "BASE_URL": "/", "DESCRIPTION": "ecmaOS: Micro-kernel and framework for web technologies", "DEV": false, "HOMEPAGE": "https://ecmaos.sh", "KNOWN_ISSUES": ["It's best to stick to Chromium-based browsers for the most features", "Keyboard is broken on mobile; ecmaOS is not mobile-friendly at this time", "Don't expect any sort of POSIX compliance at this stage", "Most commands/devices are very basic implementations, not complete reproductions", "stdin/stdout/stderr streams and redirection can be wonky and don't work everywhere, but are coming along", "CTRL-C will return you to a prompt, but doesn't currently interrupt a process", "Lots of unfinished work; watch your step"], "MODE": "production", "NAME": "@ecmaos/kernel", "PROD": true, "REPOSITORY": "https://github.com/ecmaos/ecmaos", "SSR": false, "TIPS": ["If it ever fails to boot, check your logs or try clearing all data", "You can run some devices that offer a CLI - e.g. '/dev/battery --help'", "Use the 'install' command to install packages - e.g. 'install @ecmaos-apps/news'", "You can install any NPM package - e.g. 'install jquery'", "Use the 'news' command to see the latest news about ecmaOS", "Type 'ls /bin' to see all built-in commands", "Type 'ls /usr/bin' to see all installed commands", "You can set your environment variables in ~/.env (try setting PROMPT to a PS1-like format)", "Try 'fetch /xkcd-os.sixel'"], "VERSION": "0.6.
|
|
73571
|
+
const __vite_import_meta_env__ = { "AUTHOR": { "name": "Jay Mathis", "email": "code@mathis.network", "url": "https://github.com/mathiscode" }, "BASE_URL": "/", "DESCRIPTION": "ecmaOS: Micro-kernel and framework for web technologies", "DEV": false, "HOMEPAGE": "https://ecmaos.sh", "KNOWN_ISSUES": ["It's best to stick to Chromium-based browsers for the most features", "Keyboard is broken on mobile; ecmaOS is not mobile-friendly at this time", "Don't expect any sort of POSIX compliance at this stage", "Most commands/devices are very basic implementations, not complete reproductions", "stdin/stdout/stderr streams and redirection can be wonky and don't work everywhere, but are coming along", "CTRL-C will return you to a prompt, but doesn't currently interrupt a process", "Lots of unfinished work; watch your step"], "MODE": "production", "NAME": "@ecmaos/kernel", "PROD": true, "REPOSITORY": "https://github.com/ecmaos/ecmaos", "SSR": false, "TIPS": ["If it ever fails to boot, check your logs or try clearing all data", "You can run some devices that offer a CLI - e.g. '/dev/battery --help'", "Use the 'install' command to install packages - e.g. 'install @ecmaos-apps/news'", "You can install any NPM package - e.g. 'install jquery'", "Use the 'news' command to see the latest news about ecmaOS", "Type 'ls /bin' to see all built-in commands", "Type 'ls /usr/bin' to see all installed commands", "You can set your environment variables in ~/.env (try setting PROMPT to a PS1-like format)", "Try 'fetch /xkcd-os.sixel'"], "VERSION": "0.6.4", "VITE_APP_SHOW_DEFAULT_LOGIN": "true", "VITE_AUTOLOGIN_PASSWORD": "root", "VITE_AUTOLOGIN_USERNAME": "root", "VITE_BOOT_DISABLE_ISSUES": "true", "VITE_BOOT_DISABLE_LOGO_CONSOLE": "false", "VITE_BOOT_DISABLE_LOGO_FIGLET": "false", "VITE_BOOT_DISABLE_TIPS": "false", "VITE_INITFS": "/initfs.tar.gz", "VITE_KERNEL_INTERVALS_PROC": "1000", "VITE_KERNEL_MODULES": "@ecmaos-modules/boilerplate@0.1.0", "VITE_METAL_SOCKET": "ws://localhost:30445/socket", "VITE_PORT": "30443", "VITE_RECOMMENDED_APPS": "@ecmaos-apps/code,@ecmaos-apps/edit,@ecmaos-apps/ai,@ecmaos-apps/webamp,@ecmaos-apps/news", "XTERM_VERSION": "5.5.0", "ZENFS_VERSION": "2.4.2" };
|
|
72719
73572
|
var define_import_meta_env_AUTHOR_default = { name: "Jay Mathis", email: "code@mathis.network", url: "https://github.com/mathiscode" };
|
|
72720
73573
|
var define_import_meta_env_KNOWN_ISSUES_default = ["It's best to stick to Chromium-based browsers for the most features", "Keyboard is broken on mobile; ecmaOS is not mobile-friendly at this time", "Don't expect any sort of POSIX compliance at this stage", "Most commands/devices are very basic implementations, not complete reproductions", "stdin/stdout/stderr streams and redirection can be wonky and don't work everywhere, but are coming along", "CTRL-C will return you to a prompt, but doesn't currently interrupt a process", "Lots of unfinished work; watch your step"];
|
|
72721
73574
|
var define_import_meta_env_TIPS_default = ["If it ever fails to boot, check your logs or try clearing all data", "You can run some devices that offer a CLI - e.g. '/dev/battery --help'", "Use the 'install' command to install packages - e.g. 'install @ecmaos-apps/news'", "You can install any NPM package - e.g. 'install jquery'", "Use the 'news' command to see the latest news about ecmaOS", "Type 'ls /bin' to see all built-in commands", "Type 'ls /usr/bin' to see all installed commands", "You can set your environment variables in ~/.env (try setting PROMPT to a PS1-like format)", "Try 'fetch /xkcd-os.sixel'"];
|
|
@@ -72760,7 +73613,7 @@ const _Kernel = class _Kernel {
|
|
|
72760
73613
|
/** Name of the kernel */
|
|
72761
73614
|
__publicField(this, "name", "@ecmaos/kernel");
|
|
72762
73615
|
/** Version string of the kernel */
|
|
72763
|
-
__publicField(this, "version", "0.6.
|
|
73616
|
+
__publicField(this, "version", "0.6.4");
|
|
72764
73617
|
/** Authentication and authorization service */
|
|
72765
73618
|
__publicField(this, "auth");
|
|
72766
73619
|
/** BIOS module providing low-level functionality */
|
|
@@ -72918,7 +73771,7 @@ const _Kernel = class _Kernel {
|
|
|
72918
73771
|
];
|
|
72919
73772
|
this.terminal.writeln(chalk$2.red.bold(`🐉 ${t2("kernel.experimental", "EXPERIMENTAL")} 🐉`));
|
|
72920
73773
|
this.terminal.writeln(
|
|
72921
|
-
`${this.terminal.createSpecialLink("https://ecmaos.sh", "@ecmaos/kernel")}@${"0.6.
|
|
73774
|
+
`${this.terminal.createSpecialLink("https://ecmaos.sh", "@ecmaos/kernel")}@${"0.6.4"}` + chalk$2.cyan(` [${dependencyLinks.map((link2) => link2.link).join(", ")}]`)
|
|
72922
73775
|
);
|
|
72923
73776
|
this.terminal.writeln(`${t2("kernel.madeBy", "Made with ❤️ by Jay Mathis")} ${this.terminal.createSpecialLink(
|
|
72924
73777
|
define_import_meta_env_AUTHOR_default?.url || "https://github.com/mathiscode",
|
|
@@ -72935,14 +73788,14 @@ const _Kernel = class _Kernel {
|
|
|
72935
73788
|
if (logoFiglet && true) {
|
|
72936
73789
|
console.log(`%c${logoFiglet}`, "color: green");
|
|
72937
73790
|
console.log(`%c${"https://github.com/ecmaos/ecmaos"}`, "color: blue; text-decoration: underline; font-size: 16px");
|
|
72938
|
-
this.log.info(`${"@ecmaos/kernel"} v${"0.6.
|
|
73791
|
+
this.log.info(`${"@ecmaos/kernel"} v${"0.6.4"}`);
|
|
72939
73792
|
}
|
|
72940
73793
|
if (Notification?.permission === "default") Notification.requestPermission();
|
|
72941
73794
|
if (Notification?.permission === "denied") this.log.warn(t2("kernel.permissionNotificationDenied", "Notification permission denied"));
|
|
72942
73795
|
this.intervals.set("title-blink", () => {
|
|
72943
73796
|
globalThis.document.title = globalThis.document.title.includes("_") ? "ecmaos# " : "ecmaos# _";
|
|
72944
73797
|
}, 600);
|
|
72945
|
-
this.toast.success(`${"@ecmaos/kernel"} v${"0.6.
|
|
73798
|
+
this.toast.success(`${"@ecmaos/kernel"} v${"0.6.4"}`);
|
|
72946
73799
|
}
|
|
72947
73800
|
await this.configure({ devices: this.options.devices || DefaultDevices, filesystem: Filesystem.options() });
|
|
72948
73801
|
const requiredPaths = [
|
|
@@ -73174,7 +74027,7 @@ const _Kernel = class _Kernel {
|
|
|
73174
74027
|
this._state = KernelState.RUNNING;
|
|
73175
74028
|
this.setupDebugGlobals();
|
|
73176
74029
|
if (!this.storage.local.getItem("ecmaos:first-boot")) {
|
|
73177
|
-
const recommendedApps = "@ecmaos-apps/code,@ecmaos-apps/webamp,@ecmaos-apps/news";
|
|
74030
|
+
const recommendedApps = "@ecmaos-apps/code,@ecmaos-apps/edit,@ecmaos-apps/ai,@ecmaos-apps/webamp,@ecmaos-apps/news";
|
|
73178
74031
|
if (recommendedApps) {
|
|
73179
74032
|
const apps = recommendedApps.split(",");
|
|
73180
74033
|
this.terminal.writeln("\n" + chalk$2.yellow.bold(this.i18n.t("kernel.recommendedApps", "Recommended apps:")));
|
|
@@ -73187,7 +74040,7 @@ const _Kernel = class _Kernel {
|
|
|
73187
74040
|
}
|
|
73188
74041
|
this.storage.local.setItem("ecmaos:first-boot", Date.now().toString());
|
|
73189
74042
|
}
|
|
73190
|
-
this.terminal.write(ansi$
|
|
74043
|
+
this.terminal.write(ansi$7.erase.inLine(2) + this.terminal.prompt());
|
|
73191
74044
|
this.terminal.focus();
|
|
73192
74045
|
this.terminal.listen();
|
|
73193
74046
|
} catch (error) {
|
|
@@ -73646,7 +74499,7 @@ const _Kernel = class _Kernel {
|
|
|
73646
74499
|
memory: "?",
|
|
73647
74500
|
platform: navigator.userAgentData?.platform || navigator?.platform || navigator.userAgent,
|
|
73648
74501
|
querystring: location.search,
|
|
73649
|
-
version: `${"@ecmaos/kernel"} ${"0.6.
|
|
74502
|
+
version: `${"@ecmaos/kernel"} ${"0.6.4"}`,
|
|
73650
74503
|
language: navigator.language,
|
|
73651
74504
|
host: location.host,
|
|
73652
74505
|
userAgent: navigator.userAgent,
|
|
@@ -73823,4 +74676,4 @@ export {
|
|
|
73823
74676
|
path$1 as p,
|
|
73824
74677
|
semver as s
|
|
73825
74678
|
};
|
|
73826
|
-
//# sourceMappingURL=kernel-
|
|
74679
|
+
//# sourceMappingURL=kernel-DtEbpoeV.js.map
|