@prozilla-os/terminal 1.1.20 → 1.1.23

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.
Files changed (68) hide show
  1. package/dist/main.d.ts +1602 -64
  2. package/dist/main.js +744 -7
  3. package/dist/main.js.map +1 -1
  4. package/package.json +9 -8
  5. package/dist/chunks/cat-DGK7wWrK.js +0 -16
  6. package/dist/chunks/cat-DGK7wWrK.js.map +0 -1
  7. package/dist/chunks/cd-DvjkW_6o.js +0 -15
  8. package/dist/chunks/cd-DvjkW_6o.js.map +0 -1
  9. package/dist/chunks/clear-BF9eb1Dq.js +0 -14
  10. package/dist/chunks/clear-BF9eb1Dq.js.map +0 -1
  11. package/dist/chunks/cmatrix-VYovsHQW.js +0 -59
  12. package/dist/chunks/cmatrix-VYovsHQW.js.map +0 -1
  13. package/dist/chunks/compgen-3TwdgHm_.js +0 -13
  14. package/dist/chunks/compgen-3TwdgHm_.js.map +0 -1
  15. package/dist/chunks/cowsay-IfArfPSJ.js +0 -49
  16. package/dist/chunks/cowsay-IfArfPSJ.js.map +0 -1
  17. package/dist/chunks/dir-B_Ipo5xb.js +0 -11
  18. package/dist/chunks/dir-B_Ipo5xb.js.map +0 -1
  19. package/dist/chunks/echo-DX-Ar2Ut.js +0 -11
  20. package/dist/chunks/echo-DX-Ar2Ut.js.map +0 -1
  21. package/dist/chunks/eval-C7InkmFY.js +0 -14
  22. package/dist/chunks/eval-C7InkmFY.js.map +0 -1
  23. package/dist/chunks/exit-D7PPqtiE.js +0 -11
  24. package/dist/chunks/exit-D7PPqtiE.js.map +0 -1
  25. package/dist/chunks/fortune-zyxpnYNP.js +0 -59
  26. package/dist/chunks/fortune-zyxpnYNP.js.map +0 -1
  27. package/dist/chunks/help-BEgNbwLL.js +0 -17
  28. package/dist/chunks/help-BEgNbwLL.js.map +0 -1
  29. package/dist/chunks/history-l0sNRNKZ.js +0 -2
  30. package/dist/chunks/history-l0sNRNKZ.js.map +0 -1
  31. package/dist/chunks/hostname-DU1lQde2.js +0 -11
  32. package/dist/chunks/hostname-DU1lQde2.js.map +0 -1
  33. package/dist/chunks/lolcat-5-mBWD9l.js +0 -35
  34. package/dist/chunks/lolcat-5-mBWD9l.js.map +0 -1
  35. package/dist/chunks/ls-DnkSPHVM.js +0 -18
  36. package/dist/chunks/ls-DnkSPHVM.js.map +0 -1
  37. package/dist/chunks/main-CXiltWT-.js +0 -957
  38. package/dist/chunks/main-CXiltWT-.js.map +0 -1
  39. package/dist/chunks/make-DqVQDThH.js +0 -9
  40. package/dist/chunks/make-DqVQDThH.js.map +0 -1
  41. package/dist/chunks/man-D_hBUTDt.js +0 -47
  42. package/dist/chunks/man-D_hBUTDt.js.map +0 -1
  43. package/dist/chunks/mkdir-BCvMrPTX.js +0 -11
  44. package/dist/chunks/mkdir-BCvMrPTX.js.map +0 -1
  45. package/dist/chunks/neofetch-BFHOITJj.js +0 -40
  46. package/dist/chunks/neofetch-BFHOITJj.js.map +0 -1
  47. package/dist/chunks/pwd-C21tQanw.js +0 -11
  48. package/dist/chunks/pwd-C21tQanw.js.map +0 -1
  49. package/dist/chunks/reboot-C2t7a3Av.js +0 -11
  50. package/dist/chunks/reboot-C2t7a3Av.js.map +0 -1
  51. package/dist/chunks/reload-C9o_dGZw.js +0 -10
  52. package/dist/chunks/reload-C9o_dGZw.js.map +0 -1
  53. package/dist/chunks/rev-CBibYebM.js +0 -11
  54. package/dist/chunks/rev-CBibYebM.js.map +0 -1
  55. package/dist/chunks/rm-ChTrwld4.js +0 -12
  56. package/dist/chunks/rm-ChTrwld4.js.map +0 -1
  57. package/dist/chunks/rmdir-CUM4xt2w.js +0 -11
  58. package/dist/chunks/rmdir-CUM4xt2w.js.map +0 -1
  59. package/dist/chunks/sl-DrATMkz6.js +0 -166
  60. package/dist/chunks/sl-DrATMkz6.js.map +0 -1
  61. package/dist/chunks/touch-CqBIAjMe.js +0 -19
  62. package/dist/chunks/touch-CqBIAjMe.js.map +0 -1
  63. package/dist/chunks/uptime-xM-0FRzA.js +0 -11
  64. package/dist/chunks/uptime-xM-0FRzA.js.map +0 -1
  65. package/dist/chunks/whatis-vXemLo9m.js +0 -13
  66. package/dist/chunks/whatis-vXemLo9m.js.map +0 -1
  67. package/dist/chunks/whoami-CnUR69yX.js +0 -11
  68. package/dist/chunks/whoami-CnUR69yX.js.map +0 -1
@@ -1,957 +0,0 @@
1
- var He = Object.defineProperty;
2
- var pe = (t) => {
3
- throw TypeError(t);
4
- };
5
- var je = (t, e, s) => e in t ? He(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s;
6
- var S = (t, e, s) => je(t, typeof e != "symbol" ? e + "" : e, s), de = (t, e, s) => e.has(t) || pe("Cannot " + s);
7
- var _e = (t, e, s) => (de(t, e, "read from private field"), s ? s.call(t) : e.get(t)), ve = (t, e, s) => e.has(t) ? pe("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, s), be = (t, e, s, n) => (de(t, e, "write to private field"), n ? n.call(t, s) : e.set(t, s), s);
8
- import { useSystemManager as Fe, useVirtualRoot as qe, useSettingsManager as Je, App as Ve, AppsConfig as We } from "@prozilla-os/core";
9
- import { jsx as N, jsxs as Y } from "react/jsx-runtime";
10
- import * as G from "react";
11
- import { forwardRef as ze, useState as T, useRef as ye, useEffect as z } from "react";
12
- import { ANSI as v, EventEmitter as Ge, clamp as Be, removeFromArray as we } from "@prozilla-os/shared";
13
- const Ke = "_Terminal_1n5va_1", Ue = "_Prefix_1n5va_26", Xe = "_Input_1n5va_32", Ze = "_Output_1n5va_32", Qe = "_blink_1n5va_1", M = {
14
- Terminal: Ke,
15
- Prefix: Ue,
16
- Input: Xe,
17
- Output: Ze,
18
- "Input-container": "_Input-container_1n5va_47",
19
- blink: Qe,
20
- "ansi-black-fg": "_ansi-black-fg_1n5va_99",
21
- "ansi-red-fg": "_ansi-red-fg_1n5va_100",
22
- "ansi-green-fg": "_ansi-green-fg_1n5va_101",
23
- "ansi-yellow-fg": "_ansi-yellow-fg_1n5va_102",
24
- "ansi-blue-fg": "_ansi-blue-fg_1n5va_103",
25
- "ansi-magenta-fg": "_ansi-magenta-fg_1n5va_104",
26
- "ansi-cyan-fg": "_ansi-cyan-fg_1n5va_105",
27
- "ansi-white-fg": "_ansi-white-fg_1n5va_106",
28
- "ansi-bright-black-fg": "_ansi-bright-black-fg_1n5va_108",
29
- "ansi-bright-red-fg": "_ansi-bright-red-fg_1n5va_109",
30
- "ansi-bright-green-fg": "_ansi-bright-green-fg_1n5va_110",
31
- "ansi-bright-yellow-fg": "_ansi-bright-yellow-fg_1n5va_111",
32
- "ansi-bright-blue-fg": "_ansi-bright-blue-fg_1n5va_112",
33
- "ansi-bright-magenta-fg": "_ansi-bright-magenta-fg_1n5va_113",
34
- "ansi-bright-cyan-fg": "_ansi-bright-cyan-fg_1n5va_114",
35
- "ansi-bright-white-fg": "_ansi-bright-white-fg_1n5va_115",
36
- "ansi-black-bg": "_ansi-black-bg_1n5va_117",
37
- "ansi-red-bg": "_ansi-red-bg_1n5va_118",
38
- "ansi-green-bg": "_ansi-green-bg_1n5va_119",
39
- "ansi-yellow-bg": "_ansi-yellow-bg_1n5va_120",
40
- "ansi-blue-bg": "_ansi-blue-bg_1n5va_121",
41
- "ansi-magenta-bg": "_ansi-magenta-bg_1n5va_122",
42
- "ansi-cyan-bg": "_ansi-cyan-bg_1n5va_123",
43
- "ansi-white-bg": "_ansi-white-bg_1n5va_124",
44
- "ansi-dim": "_ansi-dim_1n5va_126"
45
- };
46
- function Ye(t) {
47
- return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
48
- }
49
- var ke = /* @__PURE__ */ function() {
50
- function t(e, s) {
51
- for (var n = 0; n < s.length; n++) {
52
- var f = s[n];
53
- f.enumerable = f.enumerable || !1, f.configurable = !0, "value" in f && (f.writable = !0), Object.defineProperty(e, f.key, f);
54
- }
55
- }
56
- return function(e, s, n) {
57
- return s && t(e.prototype, s), n && t(e, n), e;
58
- };
59
- }();
60
- function et(t, e) {
61
- if (!(t instanceof e))
62
- throw new TypeError("Cannot call a class as a function");
63
- }
64
- var L = [[{ color: "0, 0, 0", class: "ansi-black" }, { color: "187, 0, 0", class: "ansi-red" }, { color: "0, 187, 0", class: "ansi-green" }, { color: "187, 187, 0", class: "ansi-yellow" }, { color: "0, 0, 187", class: "ansi-blue" }, { color: "187, 0, 187", class: "ansi-magenta" }, { color: "0, 187, 187", class: "ansi-cyan" }, { color: "255,255,255", class: "ansi-white" }], [{ color: "85, 85, 85", class: "ansi-bright-black" }, { color: "255, 85, 85", class: "ansi-bright-red" }, { color: "0, 255, 0", class: "ansi-bright-green" }, { color: "255, 255, 85", class: "ansi-bright-yellow" }, { color: "85, 85, 255", class: "ansi-bright-blue" }, { color: "255, 85, 255", class: "ansi-bright-magenta" }, { color: "85, 255, 255", class: "ansi-bright-cyan" }, { color: "255, 255, 255", class: "ansi-bright-white" }]], tt = /(https?:\/\/(?:[A-Za-z0-9#;/?:@=+$',_.!~*()[\]-]|&amp;|%[A-Fa-f0-9]{2})+)/gm, st = function() {
65
- ke(t, null, [{
66
- key: "escapeForHtml",
67
- /**
68
- * Anser.escapeForHtml
69
- * Escape the input HTML.
70
- *
71
- * This does the minimum escaping of text to make it compliant with HTML.
72
- * In particular, the '&','<', and '>' characters are escaped. This should
73
- * be run prior to `ansiToHtml`.
74
- *
75
- * @name Anser.escapeForHtml
76
- * @function
77
- * @param {String} txt The input text (containing the ANSI snippets).
78
- * @returns {String} The escaped html.
79
- */
80
- value: function(s) {
81
- return new t().escapeForHtml(s);
82
- }
83
- /**
84
- * Anser.linkify
85
- * Adds the links in the HTML.
86
- *
87
- * This replaces any links in the text with anchor tags that display the
88
- * link. You should apply this after you have run `ansiToHtml` on the text.
89
- *
90
- * @name Anser.linkify
91
- * @function
92
- * @param {String} txt The input text.
93
- * @returns {String} The HTML containing the <a> tags (unescaped).
94
- */
95
- }, {
96
- key: "linkify",
97
- value: function(s) {
98
- return new t().linkify(s);
99
- }
100
- /**
101
- * Anser.ansiToHtml
102
- * This replaces ANSI terminal escape codes with SPAN tags that wrap the
103
- * content.
104
- *
105
- * This function only interprets ANSI SGR (Select Graphic Rendition) codes
106
- * that can be represented in HTML.
107
- * For example, cursor movement codes are ignored and hidden from output.
108
- * The default style uses colors that are very close to the prescribed
109
- * standard. The standard assumes that the text will have a black
110
- * background. These colors are set as inline styles on the SPAN tags.
111
- *
112
- * Another option is to set `use_classes: true` in the options argument.
113
- * This will instead set classes on the spans so the colors can be set via
114
- * CSS. The class names used are of the format `ansi-*-fg/bg` and
115
- * `ansi-bright-*-fg/bg` where `*` is the color name,
116
- * i.e black/red/green/yellow/blue/magenta/cyan/white.
117
- *
118
- * @name Anser.ansiToHtml
119
- * @function
120
- * @param {String} txt The input text.
121
- * @param {Object} options The options passed to the ansiToHTML method.
122
- * @returns {String} The HTML output.
123
- */
124
- }, {
125
- key: "ansiToHtml",
126
- value: function(s, n) {
127
- return new t().ansiToHtml(s, n);
128
- }
129
- /**
130
- * Anser.ansiToJson
131
- * Converts ANSI input into JSON output.
132
- *
133
- * @name Anser.ansiToJson
134
- * @function
135
- * @param {String} txt The input text.
136
- * @param {Object} options The options passed to the ansiToHTML method.
137
- * @returns {String} The HTML output.
138
- */
139
- }, {
140
- key: "ansiToJson",
141
- value: function(s, n) {
142
- return new t().ansiToJson(s, n);
143
- }
144
- /**
145
- * Anser.ansiToText
146
- * Converts ANSI input into text output.
147
- *
148
- * @name Anser.ansiToText
149
- * @function
150
- * @param {String} txt The input text.
151
- * @returns {String} The text output.
152
- */
153
- }, {
154
- key: "ansiToText",
155
- value: function(s) {
156
- return new t().ansiToText(s);
157
- }
158
- /**
159
- * Anser
160
- * The `Anser` class.
161
- *
162
- * @name Anser
163
- * @function
164
- * @returns {Anser}
165
- */
166
- }]);
167
- function t() {
168
- et(this, t), this.fg = this.bg = this.fg_truecolor = this.bg_truecolor = null, this.bright = 0, this.decorations = [];
169
- }
170
- return ke(t, [{
171
- key: "setupPalette",
172
- value: function() {
173
- this.PALETTE_COLORS = [];
174
- for (var s = 0; s < 2; ++s)
175
- for (var n = 0; n < 8; ++n)
176
- this.PALETTE_COLORS.push(L[s][n].color);
177
- for (var f = [0, 95, 135, 175, 215, 255], y = function(a, b, k) {
178
- return f[a] + ", " + f[b] + ", " + f[k];
179
- }, i = 0; i < 6; ++i)
180
- for (var u = 0; u < 6; ++u)
181
- for (var c = 0; c < 6; ++c)
182
- this.PALETTE_COLORS.push(y(i, u, c));
183
- for (var o = 8, r = 0; r < 24; ++r, o += 10)
184
- this.PALETTE_COLORS.push(y(o, o, o));
185
- }
186
- /**
187
- * escapeForHtml
188
- * Escapes the input text.
189
- *
190
- * @name escapeForHtml
191
- * @function
192
- * @param {String} txt The input text.
193
- * @returns {String} The escpaed HTML output.
194
- */
195
- }, {
196
- key: "escapeForHtml",
197
- value: function(s) {
198
- return s.replace(/[&<>\"]/gm, function(n) {
199
- return n == "&" ? "&amp;" : n == '"' ? "&quot;" : n == "<" ? "&lt;" : n == ">" ? "&gt;" : "";
200
- });
201
- }
202
- /**
203
- * linkify
204
- * Adds HTML link elements.
205
- *
206
- * @name linkify
207
- * @function
208
- * @param {String} txt The input text.
209
- * @returns {String} The HTML output containing link elements.
210
- */
211
- }, {
212
- key: "linkify",
213
- value: function(s) {
214
- return s.replace(tt, function(n) {
215
- return '<a href="' + n + '">' + n + "</a>";
216
- });
217
- }
218
- /**
219
- * ansiToHtml
220
- * Converts ANSI input into HTML output.
221
- *
222
- * @name ansiToHtml
223
- * @function
224
- * @param {String} txt The input text.
225
- * @param {Object} options The options passed ot the `process` method.
226
- * @returns {String} The HTML output.
227
- */
228
- }, {
229
- key: "ansiToHtml",
230
- value: function(s, n) {
231
- return this.process(s, n, !0);
232
- }
233
- /**
234
- * ansiToJson
235
- * Converts ANSI input into HTML output.
236
- *
237
- * @name ansiToJson
238
- * @function
239
- * @param {String} txt The input text.
240
- * @param {Object} options The options passed ot the `process` method.
241
- * @returns {String} The JSON output.
242
- */
243
- }, {
244
- key: "ansiToJson",
245
- value: function(s, n) {
246
- return n = n || {}, n.json = !0, n.clearLine = !1, this.process(s, n, !0);
247
- }
248
- /**
249
- * ansiToText
250
- * Converts ANSI input into HTML output.
251
- *
252
- * @name ansiToText
253
- * @function
254
- * @param {String} txt The input text.
255
- * @returns {String} The text output.
256
- */
257
- }, {
258
- key: "ansiToText",
259
- value: function(s) {
260
- return this.process(s, {}, !1);
261
- }
262
- /**
263
- * process
264
- * Processes the input.
265
- *
266
- * @name process
267
- * @function
268
- * @param {String} txt The input text.
269
- * @param {Object} options An object passed to `processChunk` method, extended with:
270
- *
271
- * - `json` (Boolean): If `true`, the result will be an object.
272
- * - `use_classes` (Boolean): If `true`, HTML classes will be appended to the HTML output.
273
- *
274
- * @param {Boolean} markup
275
- */
276
- }, {
277
- key: "process",
278
- value: function(s, n, f) {
279
- var y = this, i = this, u = s.split(/\033\[/), c = u.shift();
280
- n == null && (n = {}), n.clearLine = /\r/.test(s);
281
- var o = u.map(function(_) {
282
- return y.processChunk(_, n, f);
283
- });
284
- if (n && n.json) {
285
- var r = i.processChunkJson("");
286
- return r.content = c, r.clearLine = n.clearLine, o.unshift(r), n.remove_empty && (o = o.filter(function(_) {
287
- return !_.isEmpty();
288
- })), o;
289
- } else
290
- o.unshift(c);
291
- return o.join("");
292
- }
293
- /**
294
- * processChunkJson
295
- * Processes the current chunk into json output.
296
- *
297
- * @name processChunkJson
298
- * @function
299
- * @param {String} text The input text.
300
- * @param {Object} options An object containing the following fields:
301
- *
302
- * - `json` (Boolean): If `true`, the result will be an object.
303
- * - `use_classes` (Boolean): If `true`, HTML classes will be appended to the HTML output.
304
- *
305
- * @param {Boolean} markup If false, the colors will not be parsed.
306
- * @return {Object} The result object:
307
- *
308
- * - `content` (String): The text.
309
- * - `fg` (String|null): The foreground color.
310
- * - `bg` (String|null): The background color.
311
- * - `fg_truecolor` (String|null): The foreground true color (if 16m color is enabled).
312
- * - `bg_truecolor` (String|null): The background true color (if 16m color is enabled).
313
- * - `clearLine` (Boolean): `true` if a carriageReturn \r was fount at end of line.
314
- * - `was_processed` (Bolean): `true` if the colors were processed, `false` otherwise.
315
- * - `isEmpty` (Function): A function returning `true` if the content is empty, or `false` otherwise.
316
- *
317
- */
318
- }, {
319
- key: "processChunkJson",
320
- value: function(s, n, f) {
321
- n = typeof n > "u" ? {} : n;
322
- var y = n.use_classes = typeof n.use_classes < "u" && n.use_classes, i = n.key = y ? "class" : "color", u = {
323
- content: s,
324
- fg: null,
325
- bg: null,
326
- fg_truecolor: null,
327
- bg_truecolor: null,
328
- isInverted: !1,
329
- clearLine: n.clearLine,
330
- decoration: null,
331
- decorations: [],
332
- was_processed: !1,
333
- isEmpty: function() {
334
- return !u.content;
335
- }
336
- }, c = s.match(/^([!\x3c-\x3f]*)([\d;]*)([\x20-\x2c]*[\x40-\x7e])([\s\S]*)/m);
337
- if (!c) return u;
338
- u.content = c[4];
339
- var o = c[2].split(";");
340
- if (c[1] !== "" || c[3] !== "m" || !f)
341
- return u;
342
- for (var r = this; o.length > 0; ) {
343
- var _ = o.shift(), a = parseInt(_);
344
- if (isNaN(a) || a === 0)
345
- r.fg = r.bg = null, r.decorations = [];
346
- else if (a === 1)
347
- r.decorations.push("bold");
348
- else if (a === 2)
349
- r.decorations.push("dim");
350
- else if (a === 3)
351
- r.decorations.push("italic");
352
- else if (a === 4)
353
- r.decorations.push("underline");
354
- else if (a === 5)
355
- r.decorations.push("blink");
356
- else if (a === 7)
357
- r.decorations.push("reverse");
358
- else if (a === 8)
359
- r.decorations.push("hidden");
360
- else if (a === 9)
361
- r.decorations.push("strikethrough");
362
- else if (a === 21)
363
- r.removeDecoration("bold");
364
- else if (a === 22)
365
- r.removeDecoration("bold"), r.removeDecoration("dim");
366
- else if (a === 23)
367
- r.removeDecoration("italic");
368
- else if (a === 24)
369
- r.removeDecoration("underline");
370
- else if (a === 25)
371
- r.removeDecoration("blink");
372
- else if (a === 27)
373
- r.removeDecoration("reverse");
374
- else if (a === 28)
375
- r.removeDecoration("hidden");
376
- else if (a === 29)
377
- r.removeDecoration("strikethrough");
378
- else if (a === 39)
379
- r.fg = null;
380
- else if (a === 49)
381
- r.bg = null;
382
- else if (a >= 30 && a < 38)
383
- r.fg = L[0][a % 10][i];
384
- else if (a >= 90 && a < 98)
385
- r.fg = L[1][a % 10][i];
386
- else if (a >= 40 && a < 48)
387
- r.bg = L[0][a % 10][i];
388
- else if (a >= 100 && a < 108)
389
- r.bg = L[1][a % 10][i];
390
- else if (a === 38 || a === 48) {
391
- var b = a === 38;
392
- if (o.length >= 1) {
393
- var k = o.shift();
394
- if (k === "5" && o.length >= 1) {
395
- var h = parseInt(o.shift());
396
- if (h >= 0 && h <= 255)
397
- if (!y)
398
- this.PALETTE_COLORS || r.setupPalette(), b ? r.fg = this.PALETTE_COLORS[h] : r.bg = this.PALETTE_COLORS[h];
399
- else {
400
- var E = h >= 16 ? "ansi-palette-" + h : L[h > 7 ? 1 : 0][h % 8].class;
401
- b ? r.fg = E : r.bg = E;
402
- }
403
- } else if (k === "2" && o.length >= 3) {
404
- var $ = parseInt(o.shift()), R = parseInt(o.shift()), D = parseInt(o.shift());
405
- if ($ >= 0 && $ <= 255 && R >= 0 && R <= 255 && D >= 0 && D <= 255) {
406
- var A = $ + ", " + R + ", " + D;
407
- y ? b ? (r.fg = "ansi-truecolor", r.fg_truecolor = A) : (r.bg = "ansi-truecolor", r.bg_truecolor = A) : b ? r.fg = A : r.bg = A;
408
- }
409
- }
410
- }
411
- }
412
- }
413
- return r.fg === null && r.bg === null && r.decorations.length === 0 || (u.fg = r.fg, u.bg = r.bg, u.fg_truecolor = r.fg_truecolor, u.bg_truecolor = r.bg_truecolor, u.decorations = r.decorations, u.decoration = r.decorations.slice(-1).pop() || null, u.was_processed = !0), u;
414
- }
415
- /**
416
- * processChunk
417
- * Processes the current chunk of text.
418
- *
419
- * @name processChunk
420
- * @function
421
- * @param {String} text The input text.
422
- * @param {Object} options An object containing the following fields:
423
- *
424
- * - `json` (Boolean): If `true`, the result will be an object.
425
- * - `use_classes` (Boolean): If `true`, HTML classes will be appended to the HTML output.
426
- *
427
- * @param {Boolean} markup If false, the colors will not be parsed.
428
- * @return {Object|String} The result (object if `json` is wanted back or string otherwise).
429
- */
430
- }, {
431
- key: "processChunk",
432
- value: function(s, n, f) {
433
- var y = this;
434
- n = n || {};
435
- var i = this.processChunkJson(s, n, f), u = n.use_classes;
436
- if (i.decorations = i.decorations.filter(function(b) {
437
- if (b === "reverse") {
438
- i.fg || (i.fg = L[0][7][u ? "class" : "color"]), i.bg || (i.bg = L[0][0][u ? "class" : "color"]);
439
- var k = i.fg;
440
- i.fg = i.bg, i.bg = k;
441
- var h = i.fg_truecolor;
442
- return i.fg_truecolor = i.bg_truecolor, i.bg_truecolor = h, i.isInverted = !0, !1;
443
- }
444
- return !0;
445
- }), n.json)
446
- return i;
447
- if (i.isEmpty())
448
- return "";
449
- if (!i.was_processed)
450
- return i.content;
451
- var c = [], o = [], r = [], _ = {}, a = function(k) {
452
- var h = [], E = void 0;
453
- for (E in k)
454
- k.hasOwnProperty(E) && h.push("data-" + E + '="' + y.escapeForHtml(k[E]) + '"');
455
- return h.length > 0 ? " " + h.join(" ") : "";
456
- };
457
- return i.isInverted && (_["ansi-is-inverted"] = "true"), i.fg && (u ? (c.push(i.fg + "-fg"), i.fg_truecolor !== null && (_["ansi-truecolor-fg"] = i.fg_truecolor, i.fg_truecolor = null)) : c.push("color:rgb(" + i.fg + ")")), i.bg && (u ? (c.push(i.bg + "-bg"), i.bg_truecolor !== null && (_["ansi-truecolor-bg"] = i.bg_truecolor, i.bg_truecolor = null)) : c.push("background-color:rgb(" + i.bg + ")")), i.decorations.forEach(function(b) {
458
- if (u) {
459
- o.push("ansi-" + b);
460
- return;
461
- }
462
- b === "bold" ? o.push("font-weight:bold") : b === "dim" ? o.push("opacity:0.5") : b === "italic" ? o.push("font-style:italic") : b === "hidden" ? o.push("visibility:hidden") : b === "strikethrough" ? r.push("line-through") : r.push(b);
463
- }), r.length && o.push("text-decoration:" + r.join(" ")), u ? '<span class="' + c.concat(o).join(" ") + '"' + a(_) + ">" + i.content + "</span>" : '<span style="' + c.concat(o).join(";") + '"' + a(_) + ">" + i.content + "</span>";
464
- }
465
- }, {
466
- key: "removeDecoration",
467
- value: function(s) {
468
- var n = this.decorations.indexOf(s);
469
- n >= 0 && this.decorations.splice(n, 1);
470
- }
471
- }]), t;
472
- }(), nt = st;
473
- const rt = /* @__PURE__ */ Ye(nt);
474
- var ee = { exports: {} };
475
- function te(t) {
476
- if (!t) return "";
477
- if (!/\r/.test(t)) return t;
478
- for (t = t.replace(/\r+\n/gm, `
479
- `); /\r./.test(t); )
480
- t = t.replace(/^([^\r\n]*)\r+([^\r\n]+)/gm, function(e, s, n) {
481
- return n + s.slice(n.length);
482
- });
483
- return t;
484
- }
485
- function it(t) {
486
- for (var e = 0, s = 0; s < t.length; s++)
487
- t[e].length <= t[s].length && (e = s);
488
- return e;
489
- }
490
- function Ce(t) {
491
- if (!/\r/.test(t)) return t;
492
- for (var e = t.split("\r"), s = []; e.length > 0; ) {
493
- var n = it(e);
494
- s.push(e[n]), e = e.slice(n + 1);
495
- }
496
- return s.join("\r");
497
- }
498
- function at(t) {
499
- if (!t) return "";
500
- if (!/\r/.test(t)) return t;
501
- if (!/\n/.test(t)) return Ce(t);
502
- t = t.replace(/\r+\n/gm, `
503
- `);
504
- var e = t.lastIndexOf(`
505
- `);
506
- return te(t.slice(0, e)) + `
507
- ` + Ce(t.slice(e + 1));
508
- }
509
- ee.exports = te;
510
- var ot = ee.exports.escapeCarriageReturn = te;
511
- ee.exports.escapeCarriageReturnSafe = at;
512
- function lt(t, e) {
513
- return t = ot(ht(t)), rt.ansiToJson(t, {
514
- json: !0,
515
- // eslint-disable-next-line @typescript-eslint/naming-convention
516
- remove_empty: !0,
517
- // eslint-disable-next-line @typescript-eslint/naming-convention
518
- use_classes: e
519
- });
520
- }
521
- function ct(t) {
522
- const e = [];
523
- return t.bg && e.push(M[`${t.bg}-bg`]), t.fg && e.push(M[`${t.fg}-fg`]), t.decoration && e.push(M[`ansi-${t.decoration}`]), e.length === 0 ? null : e.join(" ");
524
- }
525
- function ut(t) {
526
- const e = {};
527
- switch (t.bg && (e.backgroundColor = `rgb(${t.bg})`), t.fg && (e.color = `rgb(${t.fg})`), t.decoration) {
528
- case "bold":
529
- e.fontWeight = "bold";
530
- break;
531
- case "dim":
532
- e.opacity = "0.5";
533
- break;
534
- case "italic":
535
- e.fontStyle = "italic";
536
- break;
537
- case "hidden":
538
- e.visibility = "hidden";
539
- break;
540
- case "strikethrough":
541
- e.textDecoration = "line-through";
542
- break;
543
- case "underline":
544
- e.textDecoration = "underline";
545
- break;
546
- case "blink":
547
- e.textDecoration = "blink";
548
- break;
549
- }
550
- return e;
551
- }
552
- function ft(t, e, s, n) {
553
- const f = e ? null : ut(s), y = e ? ct(s) : null;
554
- if (!t)
555
- return G.createElement(
556
- "pre",
557
- { style: f, key: n, className: y },
558
- s.content
559
- );
560
- const i = [], u = /(\s|^)(https?:\/\/(?:www\.|(?!www))[^\s.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/g;
561
- let c = 0, o;
562
- for (; (o = u.exec(s.content)) !== null; ) {
563
- const [, r, _] = o, a = o.index + r.length;
564
- a > c && i.push(s.content.substring(c, a));
565
- const b = _.startsWith("www.") ? `http://${_}` : _;
566
- i.push(
567
- G.createElement(
568
- "a",
569
- {
570
- key: c,
571
- href: b,
572
- target: "_blank"
573
- },
574
- `${_}`
575
- )
576
- ), c = u.lastIndex;
577
- }
578
- return c < s.content.length && i.push(s.content.substring(c)), G.createElement("span", { style: f, key: n, className: y }, i);
579
- }
580
- function Se(t) {
581
- const { className: e, useClasses: s, children: n, linkify: f } = t;
582
- return G.createElement(
583
- "code",
584
- { className: e },
585
- lt(n ?? "", s ?? !1).map(
586
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
587
- ft.bind(null, f ?? !1, s ?? !1)
588
- )
589
- );
590
- }
591
- function ht(t) {
592
- let e = t;
593
- do
594
- t = e, e = t.replace(/[^\n]\x08/gm, "");
595
- while (e.length < t.length);
596
- return t;
597
- }
598
- const Oe = ze(({ text: t }, e) => {
599
- const s = t == null ? void 0 : t.split(`
600
- `);
601
- return /* @__PURE__ */ N("div", { ref: e, children: s == null ? void 0 : s.map(
602
- (n, f) => /* @__PURE__ */ N(Se, { className: M.Output, useClasses: !0, children: n === "" ? " " : n }, f)
603
- ) });
604
- });
605
- function gt({ value: t, prefix: e, onChange: s, onKeyUp: n, onKeyDown: f, inputRef: y }) {
606
- const [i, u] = T(0), c = () => {
607
- var r;
608
- const o = (r = y.current) == null ? void 0 : r.selectionStart;
609
- o != null && u(o);
610
- };
611
- return /* @__PURE__ */ Y("span", { className: M.Input, children: [
612
- e && /* @__PURE__ */ N(Se, { className: M.Prefix, useClasses: !0, children: e }),
613
- /* @__PURE__ */ Y("span", { className: M["Input-container"], style: { "--cursor-offset": i }, children: [
614
- /* @__PURE__ */ N("span", { "aria-hidden": "true", children: t }),
615
- /* @__PURE__ */ N(
616
- "input",
617
- {
618
- id: "input",
619
- value: t,
620
- "aria-label": "Command input",
621
- onChange: (o) => {
622
- s(o), c();
623
- },
624
- ref: y,
625
- onKeyUp: (o) => {
626
- n == null || n(o);
627
- },
628
- onKeyDown: (o) => {
629
- f == null || f(o), c();
630
- },
631
- onClick: c,
632
- onTouchEnd: c,
633
- onSelect: c,
634
- onCut: c,
635
- onCopy: c,
636
- onPaste: c,
637
- spellCheck: !1,
638
- autoComplete: "off",
639
- autoFocus: !0
640
- }
641
- )
642
- ] })
643
- ] });
644
- }
645
- const Z = "user", Q = "prozilla-os", kt = 50, Ee = `${v.fg.cyan + v.decoration.dim}$APP_NAME - Made by Prozilla${v.reset}
646
- ${v.decoration.dim}Type 'help' for a list of commands.${v.reset}
647
- `, O = v.fg.cyan, Ct = `
648
- :.
649
- -==.
650
- .=====:
651
- ---::..:=======-.
652
- :===+=----------::..
653
- =+=---------------:..
654
- --------------------:.
655
- .:-+=----${v.fg.white}*###*${O}--${v.fg.white}*####=${O}---.
656
- :==+----${v.fg.white}#%+${O}-${v.fg.white}+%#${O}-${v.fg.white}##%*+${O}----:.
657
- .=----${v.fg.white}#%+${O}-${v.fg.white}+%#${O}-${v.fg.white}*+${O}-${v.fg.white}%#+${O}---:.
658
- ==----${v.fg.white}*###*${O}--${v.fg.white}*###*${O}----.
659
- ==+-------------------:.
660
- ...::---------------:.
661
- .::---------::..
662
- ....::... `, mt = {
663
- new: "new",
664
- start: "start",
665
- stop: "stop"
666
- };
667
- class P extends Ge {
668
- constructor() {
669
- super(...arguments);
670
- S(this, "enabled", !1);
671
- }
672
- start(s) {
673
- return this.enabled ? this : (s == null || s(this), this.enabled = !0, this.emit("start"), this);
674
- }
675
- stop() {
676
- return this.enabled ? (this.enabled = !1, this.emit("stop"), this) : this;
677
- }
678
- send(s) {
679
- return this.enabled && this.emit("new", s), this;
680
- }
681
- }
682
- S(P, "EVENT_NAMES", mt);
683
- function q(t, e) {
684
- return `${v.fg.red}${t}: ${e}${v.reset}`;
685
- }
686
- function Ot(t) {
687
- return t.replace(/\u001b\[([0-9]+)m/gm, "");
688
- }
689
- let B = [];
690
- const $e = /* @__PURE__ */ Object.assign({ "./commands/cat.ts": () => import("./cat-DGK7wWrK.js"), "./commands/cd.ts": () => import("./cd-DvjkW_6o.js"), "./commands/clear.ts": () => import("./clear-BF9eb1Dq.js"), "./commands/cmatrix.ts": () => import("./cmatrix-VYovsHQW.js"), "./commands/compgen.ts": () => import("./compgen-3TwdgHm_.js"), "./commands/cowsay.ts": () => import("./cowsay-IfArfPSJ.js"), "./commands/dir.ts": () => import("./dir-B_Ipo5xb.js"), "./commands/echo.ts": () => import("./echo-DX-Ar2Ut.js"), "./commands/eval.ts": () => import("./eval-C7InkmFY.js"), "./commands/exit.ts": () => import("./exit-D7PPqtiE.js"), "./commands/fortune.ts": () => import("./fortune-zyxpnYNP.js"), "./commands/help.ts": () => import("./help-BEgNbwLL.js"), "./commands/history.ts": () => import("./history-l0sNRNKZ.js"), "./commands/hostname.ts": () => import("./hostname-DU1lQde2.js"), "./commands/lolcat.ts": () => import("./lolcat-5-mBWD9l.js"), "./commands/ls.ts": () => import("./ls-DnkSPHVM.js"), "./commands/make.ts": () => import("./make-DqVQDThH.js"), "./commands/man.ts": () => import("./man-D_hBUTDt.js"), "./commands/mkdir.ts": () => import("./mkdir-BCvMrPTX.js"), "./commands/neofetch.ts": () => import("./neofetch-BFHOITJj.js"), "./commands/pwd.ts": () => import("./pwd-C21tQanw.js"), "./commands/reboot.ts": () => import("./reboot-C2t7a3Av.js"), "./commands/reload.ts": () => import("./reload-C9o_dGZw.js"), "./commands/rev.ts": () => import("./rev-CBibYebM.js"), "./commands/rm.ts": () => import("./rm-ChTrwld4.js"), "./commands/rmdir.ts": () => import("./rmdir-CUM4xt2w.js"), "./commands/sl.ts": () => import("./sl-DrATMkz6.js"), "./commands/touch.ts": () => import("./touch-CqBIAjMe.js"), "./commands/uptime.ts": () => import("./uptime-xM-0FRzA.js"), "./commands/whatis.ts": () => import("./whatis-vXemLo9m.js"), "./commands/whoami.ts": () => import("./whoami-CnUR69yX.js") }), Te = () => {
691
- B = [];
692
- for (const t in $e)
693
- $e[t]().then((e) => {
694
- const s = Object.keys(e)[0], n = e[s];
695
- n != null && (n.name || n.setName(s.toLowerCase()), B.push(n));
696
- });
697
- };
698
- Te();
699
- class se {
700
- static addCommand(e) {
701
- this.COMMANDS.push(e);
702
- }
703
- static find(e) {
704
- return this.COMMANDS.find((s) => s.name == e);
705
- }
706
- static search(e) {
707
- return this.COMMANDS.filter((s) => s.name.match(e));
708
- }
709
- static reload() {
710
- Te(), this.COMMANDS = B;
711
- }
712
- }
713
- S(se, "COMMANDS", B);
714
- function pt({ app: t, path: e, input: s, setTitle: n, close: f, active: y, focus: i }) {
715
- const u = Fe(), [c, o] = T(0), [r, _] = T(s ?? ""), [a, b] = T([{
716
- text: t ? Ee.replace("$APP_NAME", t.name) : Ee,
717
- isInput: !1
718
- }]), k = qe(), [h, E] = T(k == null ? void 0 : k.navigate(e ?? "~")), $ = ye(null), [R, D] = T(0), [A, K] = T(null), [U, ne] = T(null), x = ye(null), [re, ie] = T(!1), Ae = Je();
719
- z(() => {
720
- h != null && (n == null || n(`${Z}@${Q}: ${h.root ? "/" : h.path}`));
721
- }, [h == null ? void 0 : h.path, h == null ? void 0 : h.root, n]), z(() => {
722
- !$.current || !y || $.current.focus();
723
- }, [$, y]);
724
- const ae = () => {
725
- x.current.scrollTop = x.current.scrollHeight;
726
- };
727
- z(() => {
728
- re || x.current == null || U == null || (ae(), ie(!0));
729
- }, [re, U, x]), z(() => {
730
- x.current == null || A != null || ae();
731
- }, [r]);
732
- const oe = `${v.fg.cyan + Z}@${Q + v.reset}:${v.fg.blue + (h != null && h.root || h == null ? "/" : h == null ? void 0 : h.path) + v.reset}$ `, le = a, X = (l) => {
733
- le.push(l), b(le);
734
- }, V = (l) => {
735
- X({
736
- text: l,
737
- isInput: !1
738
- });
739
- }, Ie = (l, p) => {
740
- K(l), ie(!1);
741
- const g = (d) => {
742
- y && (d.ctrlKey || d.metaKey) && d.key === "c" && l.stop();
743
- };
744
- let m = null;
745
- l.on(P.EVENT_NAMES.new, (d) => {
746
- (async () => {
747
- let w = d;
748
- for (const I of p)
749
- w instanceof P || (w = await ce(w ? `${I} ${w}` : I));
750
- if (w instanceof P) {
751
- l.stop(), V(v.fg.red + "Stream failed");
752
- return;
753
- }
754
- m = w, ne(w);
755
- })();
756
- }), l.on(P.EVENT_NAMES.stop, () => {
757
- document.removeEventListener("keydown", g), V(m), K(null), ne(null);
758
- }), document.addEventListener("keydown", g);
759
- }, ce = async (l) => {
760
- var he;
761
- const p = l.indexOf(" ") + 1, g = p <= 0 ? "" : l.substr(p), m = Date.now();
762
- if (l = l.trim(), l === "") return;
763
- let d = l.match(/(?:[^\s"]+|"[^"]*")+/g);
764
- if (d == null) return;
765
- d[0].toLowerCase() === "sudo" && d.length >= 2 && d.shift();
766
- const w = (he = d.shift()) == null ? void 0 : he.toLowerCase();
767
- if (w == null) return;
768
- const I = se.find(w);
769
- if (!I) return q(w, "Command not found");
770
- d = d.map((C) => C.startsWith('"') && C.endsWith('"') ? C.slice(1, -1) : C);
771
- const H = [], fe = {};
772
- if (d.filter((C) => C.startsWith("-")).forEach((C) => {
773
- const ge = (F) => {
774
- if (H.includes(F))
775
- return;
776
- H.push(F);
777
- const j = I.getOption(H[H.length - 1]);
778
- if (j != null && j.isInput) {
779
- const me = d[d.indexOf(C) + 1];
780
- fe[j.short] = me, we(me, d);
781
- }
782
- };
783
- if (C.startsWith("--")) {
784
- const F = C.substring(2).toLowerCase();
785
- ge(F);
786
- } else
787
- C.substring(1).split("").forEach((j) => {
788
- ge(j);
789
- });
790
- we(C, d);
791
- }), I.requireArgs && d.length === 0)
792
- return q(w, `Incorrect usage: ${w} requires at least 1 argument`);
793
- if (I.requireOptions && H.length === 0)
794
- return q(w, `Incorrect usage: ${w} requires at least 1 option`);
795
- let W = null;
796
- try {
797
- if (W = await I.execute(d, {
798
- promptOutput: V,
799
- pushHistory: X,
800
- virtualRoot: k,
801
- currentDirectory: h,
802
- setCurrentDirectory: E,
803
- username: Z,
804
- hostname: Q,
805
- rawInputValue: g,
806
- options: H,
807
- exit: f,
808
- inputs: fe,
809
- timestamp: m,
810
- settingsManager: Ae,
811
- systemManager: u,
812
- app: t
813
- }), W == null)
814
- return q(w, "Command failed");
815
- if (!W.blank)
816
- return W;
817
- } catch (C) {
818
- return console.error(C), q(w, "Command failed");
819
- }
820
- }, Le = () => {
821
- _(""), D(0);
822
- }, Ne = async (l) => {
823
- X({
824
- text: oe + l,
825
- isInput: !0,
826
- value: l
827
- });
828
- let p = l.split(" | ");
829
- const g = [];
830
- let m = null;
831
- for (const d of p)
832
- m instanceof P || (m = await ce(m ? `${d} ${m}` : d), g.push(d));
833
- Le(), p = p.filter((d) => !g.includes(d)), m && (m instanceof P ? Ie(m, p) : V(`${m}
834
- `));
835
- }, ue = (l) => {
836
- const p = a.filter(({ isInput: m }) => m), g = Be(R + l, 0, p.length);
837
- if (g === R) {
838
- l < 0 && _("");
839
- return;
840
- }
841
- _(g === 0 ? "" : p[p.length - g].value ?? ""), D(g);
842
- }, Me = (l) => {
843
- const p = l.target.value, { key: g } = l;
844
- g === "Enter" ? (Ne(p), o((m) => m + 1)) : g === "ArrowUp" ? (l.preventDefault(), ue(1)) : g === "ArrowDown" ? (l.preventDefault(), ue(-1)) : !A && (l.ctrlKey || l.metaKey) && g === "c" && _((m) => m + "^C");
845
- }, Pe = (l) => {
846
- const p = l.target.value;
847
- return _(p);
848
- }, Re = () => {
849
- const l = a.slice(-16);
850
- let p = 0;
851
- return l.forEach((g, m) => {
852
- g.clear && (p = m + 1);
853
- }), l.slice(p).map(({ text: g }, m) => /* @__PURE__ */ N(Oe, { text: g }, m));
854
- }, De = (l) => {
855
- var p, g;
856
- i == null || i(l), l.button === 2 && (l.preventDefault(), (g = (p = navigator.clipboard).readText) == null || g.call(p).then((m) => {
857
- _(r + m);
858
- }).catch((m) => {
859
- console.error(m);
860
- }));
861
- }, xe = (l) => {
862
- l.preventDefault();
863
- };
864
- return /* @__PURE__ */ Y(
865
- "div",
866
- {
867
- ref: x,
868
- className: M.Terminal,
869
- onMouseDown: De,
870
- onContextMenu: xe,
871
- onClick: (l) => {
872
- var p, g;
873
- ((p = window.getSelection()) == null ? void 0 : p.toString()) === "" && (l.preventDefault(), (g = $.current) == null || g.focus());
874
- },
875
- children: [
876
- Re(),
877
- A ? /* @__PURE__ */ N(Oe, { text: U ?? "" }) : /* @__PURE__ */ N(
878
- gt,
879
- {
880
- value: r,
881
- prefix: oe,
882
- onKeyDown: Me,
883
- onChange: Pe,
884
- inputRef: $
885
- },
886
- c
887
- )
888
- ]
889
- }
890
- );
891
- }
892
- class dt extends Ve {
893
- constructor() {
894
- super("Terminal", "terminal", pt), this.setIconUrl("https://os.prozilla.dev/assets/apps/icons/terminal.svg"), this.setRole(We.APP_ROLES.terminal), this.setCategory("Utilities & tools");
895
- }
896
- addCommands(e) {
897
- return e.forEach((s) => this.addCommand(s)), this;
898
- }
899
- addCommand(e) {
900
- return se.addCommand(e), this;
901
- }
902
- }
903
- var J;
904
- class Et {
905
- constructor() {
906
- ve(this, J);
907
- S(this, "options", []);
908
- S(this, "manual");
909
- S(this, "requireArgs");
910
- S(this, "requireOptions");
911
- S(this, "execute", () => {
912
- });
913
- }
914
- setName(e) {
915
- var s;
916
- return be(this, J, e), e && !((s = this.manual) != null && s.usage) && (this.manual || (this.manual = {}), this.manual.usage = e), this;
917
- }
918
- get name() {
919
- return _e(this, J) ?? "";
920
- }
921
- setExecute(e) {
922
- return this.execute = e, this;
923
- }
924
- setRequireArgs(e) {
925
- return this.requireArgs = e, this;
926
- }
927
- setRequireOptions(e) {
928
- return this.requireOptions = e, this;
929
- }
930
- setManual({ purpose: e, usage: s, description: n, options: f }) {
931
- return this.manual = { purpose: e, usage: s, description: n, options: f }, this;
932
- }
933
- addOption({ short: e, long: s, isInput: n }) {
934
- return this.options.push({ short: e, long: s, isInput: n }), this;
935
- }
936
- getOption(e) {
937
- let s = null;
938
- return this.options.forEach((n) => {
939
- (n.short === e || n.long === e) && (s = n);
940
- }), s;
941
- }
942
- }
943
- J = new WeakMap();
944
- const $t = new dt();
945
- export {
946
- O as A,
947
- Et as C,
948
- kt as M,
949
- P as S,
950
- dt as T,
951
- se as a,
952
- Ct as b,
953
- q as f,
954
- Ot as r,
955
- $t as t
956
- };
957
- //# sourceMappingURL=main-CXiltWT-.js.map