@forbocai/test-game 0.6.2 → 0.6.3
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/cli.js +1832 -40
- package/dist/cli.mjs +1850 -40
- package/dist/index.js +1796 -23
- package/dist/index.mjs +1815 -23
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
+
var __create = Object.create;
|
|
3
4
|
var __defProp = Object.defineProperty;
|
|
4
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
10
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
11
|
+
};
|
|
7
12
|
var __export = (target, all) => {
|
|
8
13
|
for (var name in all)
|
|
9
14
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -16,8 +21,1566 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
21
|
}
|
|
17
22
|
return to;
|
|
18
23
|
};
|
|
24
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
25
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
26
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
27
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
28
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
29
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
30
|
+
mod
|
|
31
|
+
));
|
|
19
32
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
33
|
|
|
34
|
+
// ../../node_modules/color-name/index.js
|
|
35
|
+
var require_color_name = __commonJS({
|
|
36
|
+
"../../node_modules/color-name/index.js"(exports2, module2) {
|
|
37
|
+
"use strict";
|
|
38
|
+
module2.exports = {
|
|
39
|
+
"aliceblue": [240, 248, 255],
|
|
40
|
+
"antiquewhite": [250, 235, 215],
|
|
41
|
+
"aqua": [0, 255, 255],
|
|
42
|
+
"aquamarine": [127, 255, 212],
|
|
43
|
+
"azure": [240, 255, 255],
|
|
44
|
+
"beige": [245, 245, 220],
|
|
45
|
+
"bisque": [255, 228, 196],
|
|
46
|
+
"black": [0, 0, 0],
|
|
47
|
+
"blanchedalmond": [255, 235, 205],
|
|
48
|
+
"blue": [0, 0, 255],
|
|
49
|
+
"blueviolet": [138, 43, 226],
|
|
50
|
+
"brown": [165, 42, 42],
|
|
51
|
+
"burlywood": [222, 184, 135],
|
|
52
|
+
"cadetblue": [95, 158, 160],
|
|
53
|
+
"chartreuse": [127, 255, 0],
|
|
54
|
+
"chocolate": [210, 105, 30],
|
|
55
|
+
"coral": [255, 127, 80],
|
|
56
|
+
"cornflowerblue": [100, 149, 237],
|
|
57
|
+
"cornsilk": [255, 248, 220],
|
|
58
|
+
"crimson": [220, 20, 60],
|
|
59
|
+
"cyan": [0, 255, 255],
|
|
60
|
+
"darkblue": [0, 0, 139],
|
|
61
|
+
"darkcyan": [0, 139, 139],
|
|
62
|
+
"darkgoldenrod": [184, 134, 11],
|
|
63
|
+
"darkgray": [169, 169, 169],
|
|
64
|
+
"darkgreen": [0, 100, 0],
|
|
65
|
+
"darkgrey": [169, 169, 169],
|
|
66
|
+
"darkkhaki": [189, 183, 107],
|
|
67
|
+
"darkmagenta": [139, 0, 139],
|
|
68
|
+
"darkolivegreen": [85, 107, 47],
|
|
69
|
+
"darkorange": [255, 140, 0],
|
|
70
|
+
"darkorchid": [153, 50, 204],
|
|
71
|
+
"darkred": [139, 0, 0],
|
|
72
|
+
"darksalmon": [233, 150, 122],
|
|
73
|
+
"darkseagreen": [143, 188, 143],
|
|
74
|
+
"darkslateblue": [72, 61, 139],
|
|
75
|
+
"darkslategray": [47, 79, 79],
|
|
76
|
+
"darkslategrey": [47, 79, 79],
|
|
77
|
+
"darkturquoise": [0, 206, 209],
|
|
78
|
+
"darkviolet": [148, 0, 211],
|
|
79
|
+
"deeppink": [255, 20, 147],
|
|
80
|
+
"deepskyblue": [0, 191, 255],
|
|
81
|
+
"dimgray": [105, 105, 105],
|
|
82
|
+
"dimgrey": [105, 105, 105],
|
|
83
|
+
"dodgerblue": [30, 144, 255],
|
|
84
|
+
"firebrick": [178, 34, 34],
|
|
85
|
+
"floralwhite": [255, 250, 240],
|
|
86
|
+
"forestgreen": [34, 139, 34],
|
|
87
|
+
"fuchsia": [255, 0, 255],
|
|
88
|
+
"gainsboro": [220, 220, 220],
|
|
89
|
+
"ghostwhite": [248, 248, 255],
|
|
90
|
+
"gold": [255, 215, 0],
|
|
91
|
+
"goldenrod": [218, 165, 32],
|
|
92
|
+
"gray": [128, 128, 128],
|
|
93
|
+
"green": [0, 128, 0],
|
|
94
|
+
"greenyellow": [173, 255, 47],
|
|
95
|
+
"grey": [128, 128, 128],
|
|
96
|
+
"honeydew": [240, 255, 240],
|
|
97
|
+
"hotpink": [255, 105, 180],
|
|
98
|
+
"indianred": [205, 92, 92],
|
|
99
|
+
"indigo": [75, 0, 130],
|
|
100
|
+
"ivory": [255, 255, 240],
|
|
101
|
+
"khaki": [240, 230, 140],
|
|
102
|
+
"lavender": [230, 230, 250],
|
|
103
|
+
"lavenderblush": [255, 240, 245],
|
|
104
|
+
"lawngreen": [124, 252, 0],
|
|
105
|
+
"lemonchiffon": [255, 250, 205],
|
|
106
|
+
"lightblue": [173, 216, 230],
|
|
107
|
+
"lightcoral": [240, 128, 128],
|
|
108
|
+
"lightcyan": [224, 255, 255],
|
|
109
|
+
"lightgoldenrodyellow": [250, 250, 210],
|
|
110
|
+
"lightgray": [211, 211, 211],
|
|
111
|
+
"lightgreen": [144, 238, 144],
|
|
112
|
+
"lightgrey": [211, 211, 211],
|
|
113
|
+
"lightpink": [255, 182, 193],
|
|
114
|
+
"lightsalmon": [255, 160, 122],
|
|
115
|
+
"lightseagreen": [32, 178, 170],
|
|
116
|
+
"lightskyblue": [135, 206, 250],
|
|
117
|
+
"lightslategray": [119, 136, 153],
|
|
118
|
+
"lightslategrey": [119, 136, 153],
|
|
119
|
+
"lightsteelblue": [176, 196, 222],
|
|
120
|
+
"lightyellow": [255, 255, 224],
|
|
121
|
+
"lime": [0, 255, 0],
|
|
122
|
+
"limegreen": [50, 205, 50],
|
|
123
|
+
"linen": [250, 240, 230],
|
|
124
|
+
"magenta": [255, 0, 255],
|
|
125
|
+
"maroon": [128, 0, 0],
|
|
126
|
+
"mediumaquamarine": [102, 205, 170],
|
|
127
|
+
"mediumblue": [0, 0, 205],
|
|
128
|
+
"mediumorchid": [186, 85, 211],
|
|
129
|
+
"mediumpurple": [147, 112, 219],
|
|
130
|
+
"mediumseagreen": [60, 179, 113],
|
|
131
|
+
"mediumslateblue": [123, 104, 238],
|
|
132
|
+
"mediumspringgreen": [0, 250, 154],
|
|
133
|
+
"mediumturquoise": [72, 209, 204],
|
|
134
|
+
"mediumvioletred": [199, 21, 133],
|
|
135
|
+
"midnightblue": [25, 25, 112],
|
|
136
|
+
"mintcream": [245, 255, 250],
|
|
137
|
+
"mistyrose": [255, 228, 225],
|
|
138
|
+
"moccasin": [255, 228, 181],
|
|
139
|
+
"navajowhite": [255, 222, 173],
|
|
140
|
+
"navy": [0, 0, 128],
|
|
141
|
+
"oldlace": [253, 245, 230],
|
|
142
|
+
"olive": [128, 128, 0],
|
|
143
|
+
"olivedrab": [107, 142, 35],
|
|
144
|
+
"orange": [255, 165, 0],
|
|
145
|
+
"orangered": [255, 69, 0],
|
|
146
|
+
"orchid": [218, 112, 214],
|
|
147
|
+
"palegoldenrod": [238, 232, 170],
|
|
148
|
+
"palegreen": [152, 251, 152],
|
|
149
|
+
"paleturquoise": [175, 238, 238],
|
|
150
|
+
"palevioletred": [219, 112, 147],
|
|
151
|
+
"papayawhip": [255, 239, 213],
|
|
152
|
+
"peachpuff": [255, 218, 185],
|
|
153
|
+
"peru": [205, 133, 63],
|
|
154
|
+
"pink": [255, 192, 203],
|
|
155
|
+
"plum": [221, 160, 221],
|
|
156
|
+
"powderblue": [176, 224, 230],
|
|
157
|
+
"purple": [128, 0, 128],
|
|
158
|
+
"rebeccapurple": [102, 51, 153],
|
|
159
|
+
"red": [255, 0, 0],
|
|
160
|
+
"rosybrown": [188, 143, 143],
|
|
161
|
+
"royalblue": [65, 105, 225],
|
|
162
|
+
"saddlebrown": [139, 69, 19],
|
|
163
|
+
"salmon": [250, 128, 114],
|
|
164
|
+
"sandybrown": [244, 164, 96],
|
|
165
|
+
"seagreen": [46, 139, 87],
|
|
166
|
+
"seashell": [255, 245, 238],
|
|
167
|
+
"sienna": [160, 82, 45],
|
|
168
|
+
"silver": [192, 192, 192],
|
|
169
|
+
"skyblue": [135, 206, 235],
|
|
170
|
+
"slateblue": [106, 90, 205],
|
|
171
|
+
"slategray": [112, 128, 144],
|
|
172
|
+
"slategrey": [112, 128, 144],
|
|
173
|
+
"snow": [255, 250, 250],
|
|
174
|
+
"springgreen": [0, 255, 127],
|
|
175
|
+
"steelblue": [70, 130, 180],
|
|
176
|
+
"tan": [210, 180, 140],
|
|
177
|
+
"teal": [0, 128, 128],
|
|
178
|
+
"thistle": [216, 191, 216],
|
|
179
|
+
"tomato": [255, 99, 71],
|
|
180
|
+
"turquoise": [64, 224, 208],
|
|
181
|
+
"violet": [238, 130, 238],
|
|
182
|
+
"wheat": [245, 222, 179],
|
|
183
|
+
"white": [255, 255, 255],
|
|
184
|
+
"whitesmoke": [245, 245, 245],
|
|
185
|
+
"yellow": [255, 255, 0],
|
|
186
|
+
"yellowgreen": [154, 205, 50]
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
// ../../node_modules/color-convert/conversions.js
|
|
192
|
+
var require_conversions = __commonJS({
|
|
193
|
+
"../../node_modules/color-convert/conversions.js"(exports2, module2) {
|
|
194
|
+
"use strict";
|
|
195
|
+
var cssKeywords = require_color_name();
|
|
196
|
+
var reverseKeywords = {};
|
|
197
|
+
for (const key of Object.keys(cssKeywords)) {
|
|
198
|
+
reverseKeywords[cssKeywords[key]] = key;
|
|
199
|
+
}
|
|
200
|
+
var convert = {
|
|
201
|
+
rgb: { channels: 3, labels: "rgb" },
|
|
202
|
+
hsl: { channels: 3, labels: "hsl" },
|
|
203
|
+
hsv: { channels: 3, labels: "hsv" },
|
|
204
|
+
hwb: { channels: 3, labels: "hwb" },
|
|
205
|
+
cmyk: { channels: 4, labels: "cmyk" },
|
|
206
|
+
xyz: { channels: 3, labels: "xyz" },
|
|
207
|
+
lab: { channels: 3, labels: "lab" },
|
|
208
|
+
lch: { channels: 3, labels: "lch" },
|
|
209
|
+
hex: { channels: 1, labels: ["hex"] },
|
|
210
|
+
keyword: { channels: 1, labels: ["keyword"] },
|
|
211
|
+
ansi16: { channels: 1, labels: ["ansi16"] },
|
|
212
|
+
ansi256: { channels: 1, labels: ["ansi256"] },
|
|
213
|
+
hcg: { channels: 3, labels: ["h", "c", "g"] },
|
|
214
|
+
apple: { channels: 3, labels: ["r16", "g16", "b16"] },
|
|
215
|
+
gray: { channels: 1, labels: ["gray"] }
|
|
216
|
+
};
|
|
217
|
+
module2.exports = convert;
|
|
218
|
+
for (const model of Object.keys(convert)) {
|
|
219
|
+
if (!("channels" in convert[model])) {
|
|
220
|
+
throw new Error("missing channels property: " + model);
|
|
221
|
+
}
|
|
222
|
+
if (!("labels" in convert[model])) {
|
|
223
|
+
throw new Error("missing channel labels property: " + model);
|
|
224
|
+
}
|
|
225
|
+
if (convert[model].labels.length !== convert[model].channels) {
|
|
226
|
+
throw new Error("channel and label counts mismatch: " + model);
|
|
227
|
+
}
|
|
228
|
+
const { channels, labels } = convert[model];
|
|
229
|
+
delete convert[model].channels;
|
|
230
|
+
delete convert[model].labels;
|
|
231
|
+
Object.defineProperty(convert[model], "channels", { value: channels });
|
|
232
|
+
Object.defineProperty(convert[model], "labels", { value: labels });
|
|
233
|
+
}
|
|
234
|
+
convert.rgb.hsl = function(rgb) {
|
|
235
|
+
const r = rgb[0] / 255;
|
|
236
|
+
const g = rgb[1] / 255;
|
|
237
|
+
const b = rgb[2] / 255;
|
|
238
|
+
const min = Math.min(r, g, b);
|
|
239
|
+
const max = Math.max(r, g, b);
|
|
240
|
+
const delta = max - min;
|
|
241
|
+
let h;
|
|
242
|
+
let s;
|
|
243
|
+
if (max === min) {
|
|
244
|
+
h = 0;
|
|
245
|
+
} else if (r === max) {
|
|
246
|
+
h = (g - b) / delta;
|
|
247
|
+
} else if (g === max) {
|
|
248
|
+
h = 2 + (b - r) / delta;
|
|
249
|
+
} else if (b === max) {
|
|
250
|
+
h = 4 + (r - g) / delta;
|
|
251
|
+
}
|
|
252
|
+
h = Math.min(h * 60, 360);
|
|
253
|
+
if (h < 0) {
|
|
254
|
+
h += 360;
|
|
255
|
+
}
|
|
256
|
+
const l = (min + max) / 2;
|
|
257
|
+
if (max === min) {
|
|
258
|
+
s = 0;
|
|
259
|
+
} else if (l <= 0.5) {
|
|
260
|
+
s = delta / (max + min);
|
|
261
|
+
} else {
|
|
262
|
+
s = delta / (2 - max - min);
|
|
263
|
+
}
|
|
264
|
+
return [h, s * 100, l * 100];
|
|
265
|
+
};
|
|
266
|
+
convert.rgb.hsv = function(rgb) {
|
|
267
|
+
let rdif;
|
|
268
|
+
let gdif;
|
|
269
|
+
let bdif;
|
|
270
|
+
let h;
|
|
271
|
+
let s;
|
|
272
|
+
const r = rgb[0] / 255;
|
|
273
|
+
const g = rgb[1] / 255;
|
|
274
|
+
const b = rgb[2] / 255;
|
|
275
|
+
const v = Math.max(r, g, b);
|
|
276
|
+
const diff = v - Math.min(r, g, b);
|
|
277
|
+
const diffc = function(c) {
|
|
278
|
+
return (v - c) / 6 / diff + 1 / 2;
|
|
279
|
+
};
|
|
280
|
+
if (diff === 0) {
|
|
281
|
+
h = 0;
|
|
282
|
+
s = 0;
|
|
283
|
+
} else {
|
|
284
|
+
s = diff / v;
|
|
285
|
+
rdif = diffc(r);
|
|
286
|
+
gdif = diffc(g);
|
|
287
|
+
bdif = diffc(b);
|
|
288
|
+
if (r === v) {
|
|
289
|
+
h = bdif - gdif;
|
|
290
|
+
} else if (g === v) {
|
|
291
|
+
h = 1 / 3 + rdif - bdif;
|
|
292
|
+
} else if (b === v) {
|
|
293
|
+
h = 2 / 3 + gdif - rdif;
|
|
294
|
+
}
|
|
295
|
+
if (h < 0) {
|
|
296
|
+
h += 1;
|
|
297
|
+
} else if (h > 1) {
|
|
298
|
+
h -= 1;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
return [
|
|
302
|
+
h * 360,
|
|
303
|
+
s * 100,
|
|
304
|
+
v * 100
|
|
305
|
+
];
|
|
306
|
+
};
|
|
307
|
+
convert.rgb.hwb = function(rgb) {
|
|
308
|
+
const r = rgb[0];
|
|
309
|
+
const g = rgb[1];
|
|
310
|
+
let b = rgb[2];
|
|
311
|
+
const h = convert.rgb.hsl(rgb)[0];
|
|
312
|
+
const w = 1 / 255 * Math.min(r, Math.min(g, b));
|
|
313
|
+
b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
|
|
314
|
+
return [h, w * 100, b * 100];
|
|
315
|
+
};
|
|
316
|
+
convert.rgb.cmyk = function(rgb) {
|
|
317
|
+
const r = rgb[0] / 255;
|
|
318
|
+
const g = rgb[1] / 255;
|
|
319
|
+
const b = rgb[2] / 255;
|
|
320
|
+
const k = Math.min(1 - r, 1 - g, 1 - b);
|
|
321
|
+
const c = (1 - r - k) / (1 - k) || 0;
|
|
322
|
+
const m = (1 - g - k) / (1 - k) || 0;
|
|
323
|
+
const y = (1 - b - k) / (1 - k) || 0;
|
|
324
|
+
return [c * 100, m * 100, y * 100, k * 100];
|
|
325
|
+
};
|
|
326
|
+
function comparativeDistance(x, y) {
|
|
327
|
+
return (x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2 + (x[2] - y[2]) ** 2;
|
|
328
|
+
}
|
|
329
|
+
convert.rgb.keyword = function(rgb) {
|
|
330
|
+
const reversed = reverseKeywords[rgb];
|
|
331
|
+
if (reversed) {
|
|
332
|
+
return reversed;
|
|
333
|
+
}
|
|
334
|
+
let currentClosestDistance = Infinity;
|
|
335
|
+
let currentClosestKeyword;
|
|
336
|
+
for (const keyword of Object.keys(cssKeywords)) {
|
|
337
|
+
const value = cssKeywords[keyword];
|
|
338
|
+
const distance = comparativeDistance(rgb, value);
|
|
339
|
+
if (distance < currentClosestDistance) {
|
|
340
|
+
currentClosestDistance = distance;
|
|
341
|
+
currentClosestKeyword = keyword;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
return currentClosestKeyword;
|
|
345
|
+
};
|
|
346
|
+
convert.keyword.rgb = function(keyword) {
|
|
347
|
+
return cssKeywords[keyword];
|
|
348
|
+
};
|
|
349
|
+
convert.rgb.xyz = function(rgb) {
|
|
350
|
+
let r = rgb[0] / 255;
|
|
351
|
+
let g = rgb[1] / 255;
|
|
352
|
+
let b = rgb[2] / 255;
|
|
353
|
+
r = r > 0.04045 ? ((r + 0.055) / 1.055) ** 2.4 : r / 12.92;
|
|
354
|
+
g = g > 0.04045 ? ((g + 0.055) / 1.055) ** 2.4 : g / 12.92;
|
|
355
|
+
b = b > 0.04045 ? ((b + 0.055) / 1.055) ** 2.4 : b / 12.92;
|
|
356
|
+
const x = r * 0.4124 + g * 0.3576 + b * 0.1805;
|
|
357
|
+
const y = r * 0.2126 + g * 0.7152 + b * 0.0722;
|
|
358
|
+
const z = r * 0.0193 + g * 0.1192 + b * 0.9505;
|
|
359
|
+
return [x * 100, y * 100, z * 100];
|
|
360
|
+
};
|
|
361
|
+
convert.rgb.lab = function(rgb) {
|
|
362
|
+
const xyz = convert.rgb.xyz(rgb);
|
|
363
|
+
let x = xyz[0];
|
|
364
|
+
let y = xyz[1];
|
|
365
|
+
let z = xyz[2];
|
|
366
|
+
x /= 95.047;
|
|
367
|
+
y /= 100;
|
|
368
|
+
z /= 108.883;
|
|
369
|
+
x = x > 8856e-6 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
|
|
370
|
+
y = y > 8856e-6 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
|
|
371
|
+
z = z > 8856e-6 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
|
|
372
|
+
const l = 116 * y - 16;
|
|
373
|
+
const a = 500 * (x - y);
|
|
374
|
+
const b = 200 * (y - z);
|
|
375
|
+
return [l, a, b];
|
|
376
|
+
};
|
|
377
|
+
convert.hsl.rgb = function(hsl) {
|
|
378
|
+
const h = hsl[0] / 360;
|
|
379
|
+
const s = hsl[1] / 100;
|
|
380
|
+
const l = hsl[2] / 100;
|
|
381
|
+
let t2;
|
|
382
|
+
let t3;
|
|
383
|
+
let val;
|
|
384
|
+
if (s === 0) {
|
|
385
|
+
val = l * 255;
|
|
386
|
+
return [val, val, val];
|
|
387
|
+
}
|
|
388
|
+
if (l < 0.5) {
|
|
389
|
+
t2 = l * (1 + s);
|
|
390
|
+
} else {
|
|
391
|
+
t2 = l + s - l * s;
|
|
392
|
+
}
|
|
393
|
+
const t1 = 2 * l - t2;
|
|
394
|
+
const rgb = [0, 0, 0];
|
|
395
|
+
for (let i = 0; i < 3; i++) {
|
|
396
|
+
t3 = h + 1 / 3 * -(i - 1);
|
|
397
|
+
if (t3 < 0) {
|
|
398
|
+
t3++;
|
|
399
|
+
}
|
|
400
|
+
if (t3 > 1) {
|
|
401
|
+
t3--;
|
|
402
|
+
}
|
|
403
|
+
if (6 * t3 < 1) {
|
|
404
|
+
val = t1 + (t2 - t1) * 6 * t3;
|
|
405
|
+
} else if (2 * t3 < 1) {
|
|
406
|
+
val = t2;
|
|
407
|
+
} else if (3 * t3 < 2) {
|
|
408
|
+
val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
|
|
409
|
+
} else {
|
|
410
|
+
val = t1;
|
|
411
|
+
}
|
|
412
|
+
rgb[i] = val * 255;
|
|
413
|
+
}
|
|
414
|
+
return rgb;
|
|
415
|
+
};
|
|
416
|
+
convert.hsl.hsv = function(hsl) {
|
|
417
|
+
const h = hsl[0];
|
|
418
|
+
let s = hsl[1] / 100;
|
|
419
|
+
let l = hsl[2] / 100;
|
|
420
|
+
let smin = s;
|
|
421
|
+
const lmin = Math.max(l, 0.01);
|
|
422
|
+
l *= 2;
|
|
423
|
+
s *= l <= 1 ? l : 2 - l;
|
|
424
|
+
smin *= lmin <= 1 ? lmin : 2 - lmin;
|
|
425
|
+
const v = (l + s) / 2;
|
|
426
|
+
const sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s);
|
|
427
|
+
return [h, sv * 100, v * 100];
|
|
428
|
+
};
|
|
429
|
+
convert.hsv.rgb = function(hsv) {
|
|
430
|
+
const h = hsv[0] / 60;
|
|
431
|
+
const s = hsv[1] / 100;
|
|
432
|
+
let v = hsv[2] / 100;
|
|
433
|
+
const hi = Math.floor(h) % 6;
|
|
434
|
+
const f = h - Math.floor(h);
|
|
435
|
+
const p = 255 * v * (1 - s);
|
|
436
|
+
const q = 255 * v * (1 - s * f);
|
|
437
|
+
const t = 255 * v * (1 - s * (1 - f));
|
|
438
|
+
v *= 255;
|
|
439
|
+
switch (hi) {
|
|
440
|
+
case 0:
|
|
441
|
+
return [v, t, p];
|
|
442
|
+
case 1:
|
|
443
|
+
return [q, v, p];
|
|
444
|
+
case 2:
|
|
445
|
+
return [p, v, t];
|
|
446
|
+
case 3:
|
|
447
|
+
return [p, q, v];
|
|
448
|
+
case 4:
|
|
449
|
+
return [t, p, v];
|
|
450
|
+
case 5:
|
|
451
|
+
return [v, p, q];
|
|
452
|
+
}
|
|
453
|
+
};
|
|
454
|
+
convert.hsv.hsl = function(hsv) {
|
|
455
|
+
const h = hsv[0];
|
|
456
|
+
const s = hsv[1] / 100;
|
|
457
|
+
const v = hsv[2] / 100;
|
|
458
|
+
const vmin = Math.max(v, 0.01);
|
|
459
|
+
let sl;
|
|
460
|
+
let l;
|
|
461
|
+
l = (2 - s) * v;
|
|
462
|
+
const lmin = (2 - s) * vmin;
|
|
463
|
+
sl = s * vmin;
|
|
464
|
+
sl /= lmin <= 1 ? lmin : 2 - lmin;
|
|
465
|
+
sl = sl || 0;
|
|
466
|
+
l /= 2;
|
|
467
|
+
return [h, sl * 100, l * 100];
|
|
468
|
+
};
|
|
469
|
+
convert.hwb.rgb = function(hwb) {
|
|
470
|
+
const h = hwb[0] / 360;
|
|
471
|
+
let wh = hwb[1] / 100;
|
|
472
|
+
let bl = hwb[2] / 100;
|
|
473
|
+
const ratio = wh + bl;
|
|
474
|
+
let f;
|
|
475
|
+
if (ratio > 1) {
|
|
476
|
+
wh /= ratio;
|
|
477
|
+
bl /= ratio;
|
|
478
|
+
}
|
|
479
|
+
const i = Math.floor(6 * h);
|
|
480
|
+
const v = 1 - bl;
|
|
481
|
+
f = 6 * h - i;
|
|
482
|
+
if ((i & 1) !== 0) {
|
|
483
|
+
f = 1 - f;
|
|
484
|
+
}
|
|
485
|
+
const n = wh + f * (v - wh);
|
|
486
|
+
let r;
|
|
487
|
+
let g;
|
|
488
|
+
let b;
|
|
489
|
+
switch (i) {
|
|
490
|
+
default:
|
|
491
|
+
case 6:
|
|
492
|
+
case 0:
|
|
493
|
+
r = v;
|
|
494
|
+
g = n;
|
|
495
|
+
b = wh;
|
|
496
|
+
break;
|
|
497
|
+
case 1:
|
|
498
|
+
r = n;
|
|
499
|
+
g = v;
|
|
500
|
+
b = wh;
|
|
501
|
+
break;
|
|
502
|
+
case 2:
|
|
503
|
+
r = wh;
|
|
504
|
+
g = v;
|
|
505
|
+
b = n;
|
|
506
|
+
break;
|
|
507
|
+
case 3:
|
|
508
|
+
r = wh;
|
|
509
|
+
g = n;
|
|
510
|
+
b = v;
|
|
511
|
+
break;
|
|
512
|
+
case 4:
|
|
513
|
+
r = n;
|
|
514
|
+
g = wh;
|
|
515
|
+
b = v;
|
|
516
|
+
break;
|
|
517
|
+
case 5:
|
|
518
|
+
r = v;
|
|
519
|
+
g = wh;
|
|
520
|
+
b = n;
|
|
521
|
+
break;
|
|
522
|
+
}
|
|
523
|
+
return [r * 255, g * 255, b * 255];
|
|
524
|
+
};
|
|
525
|
+
convert.cmyk.rgb = function(cmyk) {
|
|
526
|
+
const c = cmyk[0] / 100;
|
|
527
|
+
const m = cmyk[1] / 100;
|
|
528
|
+
const y = cmyk[2] / 100;
|
|
529
|
+
const k = cmyk[3] / 100;
|
|
530
|
+
const r = 1 - Math.min(1, c * (1 - k) + k);
|
|
531
|
+
const g = 1 - Math.min(1, m * (1 - k) + k);
|
|
532
|
+
const b = 1 - Math.min(1, y * (1 - k) + k);
|
|
533
|
+
return [r * 255, g * 255, b * 255];
|
|
534
|
+
};
|
|
535
|
+
convert.xyz.rgb = function(xyz) {
|
|
536
|
+
const x = xyz[0] / 100;
|
|
537
|
+
const y = xyz[1] / 100;
|
|
538
|
+
const z = xyz[2] / 100;
|
|
539
|
+
let r;
|
|
540
|
+
let g;
|
|
541
|
+
let b;
|
|
542
|
+
r = x * 3.2406 + y * -1.5372 + z * -0.4986;
|
|
543
|
+
g = x * -0.9689 + y * 1.8758 + z * 0.0415;
|
|
544
|
+
b = x * 0.0557 + y * -0.204 + z * 1.057;
|
|
545
|
+
r = r > 31308e-7 ? 1.055 * r ** (1 / 2.4) - 0.055 : r * 12.92;
|
|
546
|
+
g = g > 31308e-7 ? 1.055 * g ** (1 / 2.4) - 0.055 : g * 12.92;
|
|
547
|
+
b = b > 31308e-7 ? 1.055 * b ** (1 / 2.4) - 0.055 : b * 12.92;
|
|
548
|
+
r = Math.min(Math.max(0, r), 1);
|
|
549
|
+
g = Math.min(Math.max(0, g), 1);
|
|
550
|
+
b = Math.min(Math.max(0, b), 1);
|
|
551
|
+
return [r * 255, g * 255, b * 255];
|
|
552
|
+
};
|
|
553
|
+
convert.xyz.lab = function(xyz) {
|
|
554
|
+
let x = xyz[0];
|
|
555
|
+
let y = xyz[1];
|
|
556
|
+
let z = xyz[2];
|
|
557
|
+
x /= 95.047;
|
|
558
|
+
y /= 100;
|
|
559
|
+
z /= 108.883;
|
|
560
|
+
x = x > 8856e-6 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
|
|
561
|
+
y = y > 8856e-6 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
|
|
562
|
+
z = z > 8856e-6 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
|
|
563
|
+
const l = 116 * y - 16;
|
|
564
|
+
const a = 500 * (x - y);
|
|
565
|
+
const b = 200 * (y - z);
|
|
566
|
+
return [l, a, b];
|
|
567
|
+
};
|
|
568
|
+
convert.lab.xyz = function(lab) {
|
|
569
|
+
const l = lab[0];
|
|
570
|
+
const a = lab[1];
|
|
571
|
+
const b = lab[2];
|
|
572
|
+
let x;
|
|
573
|
+
let y;
|
|
574
|
+
let z;
|
|
575
|
+
y = (l + 16) / 116;
|
|
576
|
+
x = a / 500 + y;
|
|
577
|
+
z = y - b / 200;
|
|
578
|
+
const y2 = y ** 3;
|
|
579
|
+
const x2 = x ** 3;
|
|
580
|
+
const z2 = z ** 3;
|
|
581
|
+
y = y2 > 8856e-6 ? y2 : (y - 16 / 116) / 7.787;
|
|
582
|
+
x = x2 > 8856e-6 ? x2 : (x - 16 / 116) / 7.787;
|
|
583
|
+
z = z2 > 8856e-6 ? z2 : (z - 16 / 116) / 7.787;
|
|
584
|
+
x *= 95.047;
|
|
585
|
+
y *= 100;
|
|
586
|
+
z *= 108.883;
|
|
587
|
+
return [x, y, z];
|
|
588
|
+
};
|
|
589
|
+
convert.lab.lch = function(lab) {
|
|
590
|
+
const l = lab[0];
|
|
591
|
+
const a = lab[1];
|
|
592
|
+
const b = lab[2];
|
|
593
|
+
let h;
|
|
594
|
+
const hr = Math.atan2(b, a);
|
|
595
|
+
h = hr * 360 / 2 / Math.PI;
|
|
596
|
+
if (h < 0) {
|
|
597
|
+
h += 360;
|
|
598
|
+
}
|
|
599
|
+
const c = Math.sqrt(a * a + b * b);
|
|
600
|
+
return [l, c, h];
|
|
601
|
+
};
|
|
602
|
+
convert.lch.lab = function(lch) {
|
|
603
|
+
const l = lch[0];
|
|
604
|
+
const c = lch[1];
|
|
605
|
+
const h = lch[2];
|
|
606
|
+
const hr = h / 360 * 2 * Math.PI;
|
|
607
|
+
const a = c * Math.cos(hr);
|
|
608
|
+
const b = c * Math.sin(hr);
|
|
609
|
+
return [l, a, b];
|
|
610
|
+
};
|
|
611
|
+
convert.rgb.ansi16 = function(args, saturation = null) {
|
|
612
|
+
const [r, g, b] = args;
|
|
613
|
+
let value = saturation === null ? convert.rgb.hsv(args)[2] : saturation;
|
|
614
|
+
value = Math.round(value / 50);
|
|
615
|
+
if (value === 0) {
|
|
616
|
+
return 30;
|
|
617
|
+
}
|
|
618
|
+
let ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r / 255));
|
|
619
|
+
if (value === 2) {
|
|
620
|
+
ansi += 60;
|
|
621
|
+
}
|
|
622
|
+
return ansi;
|
|
623
|
+
};
|
|
624
|
+
convert.hsv.ansi16 = function(args) {
|
|
625
|
+
return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
|
|
626
|
+
};
|
|
627
|
+
convert.rgb.ansi256 = function(args) {
|
|
628
|
+
const r = args[0];
|
|
629
|
+
const g = args[1];
|
|
630
|
+
const b = args[2];
|
|
631
|
+
if (r === g && g === b) {
|
|
632
|
+
if (r < 8) {
|
|
633
|
+
return 16;
|
|
634
|
+
}
|
|
635
|
+
if (r > 248) {
|
|
636
|
+
return 231;
|
|
637
|
+
}
|
|
638
|
+
return Math.round((r - 8) / 247 * 24) + 232;
|
|
639
|
+
}
|
|
640
|
+
const ansi = 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5);
|
|
641
|
+
return ansi;
|
|
642
|
+
};
|
|
643
|
+
convert.ansi16.rgb = function(args) {
|
|
644
|
+
let color = args % 10;
|
|
645
|
+
if (color === 0 || color === 7) {
|
|
646
|
+
if (args > 50) {
|
|
647
|
+
color += 3.5;
|
|
648
|
+
}
|
|
649
|
+
color = color / 10.5 * 255;
|
|
650
|
+
return [color, color, color];
|
|
651
|
+
}
|
|
652
|
+
const mult = (~~(args > 50) + 1) * 0.5;
|
|
653
|
+
const r = (color & 1) * mult * 255;
|
|
654
|
+
const g = (color >> 1 & 1) * mult * 255;
|
|
655
|
+
const b = (color >> 2 & 1) * mult * 255;
|
|
656
|
+
return [r, g, b];
|
|
657
|
+
};
|
|
658
|
+
convert.ansi256.rgb = function(args) {
|
|
659
|
+
if (args >= 232) {
|
|
660
|
+
const c = (args - 232) * 10 + 8;
|
|
661
|
+
return [c, c, c];
|
|
662
|
+
}
|
|
663
|
+
args -= 16;
|
|
664
|
+
let rem;
|
|
665
|
+
const r = Math.floor(args / 36) / 5 * 255;
|
|
666
|
+
const g = Math.floor((rem = args % 36) / 6) / 5 * 255;
|
|
667
|
+
const b = rem % 6 / 5 * 255;
|
|
668
|
+
return [r, g, b];
|
|
669
|
+
};
|
|
670
|
+
convert.rgb.hex = function(args) {
|
|
671
|
+
const integer = ((Math.round(args[0]) & 255) << 16) + ((Math.round(args[1]) & 255) << 8) + (Math.round(args[2]) & 255);
|
|
672
|
+
const string = integer.toString(16).toUpperCase();
|
|
673
|
+
return "000000".substring(string.length) + string;
|
|
674
|
+
};
|
|
675
|
+
convert.hex.rgb = function(args) {
|
|
676
|
+
const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
|
|
677
|
+
if (!match) {
|
|
678
|
+
return [0, 0, 0];
|
|
679
|
+
}
|
|
680
|
+
let colorString = match[0];
|
|
681
|
+
if (match[0].length === 3) {
|
|
682
|
+
colorString = colorString.split("").map((char) => {
|
|
683
|
+
return char + char;
|
|
684
|
+
}).join("");
|
|
685
|
+
}
|
|
686
|
+
const integer = parseInt(colorString, 16);
|
|
687
|
+
const r = integer >> 16 & 255;
|
|
688
|
+
const g = integer >> 8 & 255;
|
|
689
|
+
const b = integer & 255;
|
|
690
|
+
return [r, g, b];
|
|
691
|
+
};
|
|
692
|
+
convert.rgb.hcg = function(rgb) {
|
|
693
|
+
const r = rgb[0] / 255;
|
|
694
|
+
const g = rgb[1] / 255;
|
|
695
|
+
const b = rgb[2] / 255;
|
|
696
|
+
const max = Math.max(Math.max(r, g), b);
|
|
697
|
+
const min = Math.min(Math.min(r, g), b);
|
|
698
|
+
const chroma = max - min;
|
|
699
|
+
let grayscale;
|
|
700
|
+
let hue;
|
|
701
|
+
if (chroma < 1) {
|
|
702
|
+
grayscale = min / (1 - chroma);
|
|
703
|
+
} else {
|
|
704
|
+
grayscale = 0;
|
|
705
|
+
}
|
|
706
|
+
if (chroma <= 0) {
|
|
707
|
+
hue = 0;
|
|
708
|
+
} else if (max === r) {
|
|
709
|
+
hue = (g - b) / chroma % 6;
|
|
710
|
+
} else if (max === g) {
|
|
711
|
+
hue = 2 + (b - r) / chroma;
|
|
712
|
+
} else {
|
|
713
|
+
hue = 4 + (r - g) / chroma;
|
|
714
|
+
}
|
|
715
|
+
hue /= 6;
|
|
716
|
+
hue %= 1;
|
|
717
|
+
return [hue * 360, chroma * 100, grayscale * 100];
|
|
718
|
+
};
|
|
719
|
+
convert.hsl.hcg = function(hsl) {
|
|
720
|
+
const s = hsl[1] / 100;
|
|
721
|
+
const l = hsl[2] / 100;
|
|
722
|
+
const c = l < 0.5 ? 2 * s * l : 2 * s * (1 - l);
|
|
723
|
+
let f = 0;
|
|
724
|
+
if (c < 1) {
|
|
725
|
+
f = (l - 0.5 * c) / (1 - c);
|
|
726
|
+
}
|
|
727
|
+
return [hsl[0], c * 100, f * 100];
|
|
728
|
+
};
|
|
729
|
+
convert.hsv.hcg = function(hsv) {
|
|
730
|
+
const s = hsv[1] / 100;
|
|
731
|
+
const v = hsv[2] / 100;
|
|
732
|
+
const c = s * v;
|
|
733
|
+
let f = 0;
|
|
734
|
+
if (c < 1) {
|
|
735
|
+
f = (v - c) / (1 - c);
|
|
736
|
+
}
|
|
737
|
+
return [hsv[0], c * 100, f * 100];
|
|
738
|
+
};
|
|
739
|
+
convert.hcg.rgb = function(hcg) {
|
|
740
|
+
const h = hcg[0] / 360;
|
|
741
|
+
const c = hcg[1] / 100;
|
|
742
|
+
const g = hcg[2] / 100;
|
|
743
|
+
if (c === 0) {
|
|
744
|
+
return [g * 255, g * 255, g * 255];
|
|
745
|
+
}
|
|
746
|
+
const pure = [0, 0, 0];
|
|
747
|
+
const hi = h % 1 * 6;
|
|
748
|
+
const v = hi % 1;
|
|
749
|
+
const w = 1 - v;
|
|
750
|
+
let mg = 0;
|
|
751
|
+
switch (Math.floor(hi)) {
|
|
752
|
+
case 0:
|
|
753
|
+
pure[0] = 1;
|
|
754
|
+
pure[1] = v;
|
|
755
|
+
pure[2] = 0;
|
|
756
|
+
break;
|
|
757
|
+
case 1:
|
|
758
|
+
pure[0] = w;
|
|
759
|
+
pure[1] = 1;
|
|
760
|
+
pure[2] = 0;
|
|
761
|
+
break;
|
|
762
|
+
case 2:
|
|
763
|
+
pure[0] = 0;
|
|
764
|
+
pure[1] = 1;
|
|
765
|
+
pure[2] = v;
|
|
766
|
+
break;
|
|
767
|
+
case 3:
|
|
768
|
+
pure[0] = 0;
|
|
769
|
+
pure[1] = w;
|
|
770
|
+
pure[2] = 1;
|
|
771
|
+
break;
|
|
772
|
+
case 4:
|
|
773
|
+
pure[0] = v;
|
|
774
|
+
pure[1] = 0;
|
|
775
|
+
pure[2] = 1;
|
|
776
|
+
break;
|
|
777
|
+
default:
|
|
778
|
+
pure[0] = 1;
|
|
779
|
+
pure[1] = 0;
|
|
780
|
+
pure[2] = w;
|
|
781
|
+
}
|
|
782
|
+
mg = (1 - c) * g;
|
|
783
|
+
return [
|
|
784
|
+
(c * pure[0] + mg) * 255,
|
|
785
|
+
(c * pure[1] + mg) * 255,
|
|
786
|
+
(c * pure[2] + mg) * 255
|
|
787
|
+
];
|
|
788
|
+
};
|
|
789
|
+
convert.hcg.hsv = function(hcg) {
|
|
790
|
+
const c = hcg[1] / 100;
|
|
791
|
+
const g = hcg[2] / 100;
|
|
792
|
+
const v = c + g * (1 - c);
|
|
793
|
+
let f = 0;
|
|
794
|
+
if (v > 0) {
|
|
795
|
+
f = c / v;
|
|
796
|
+
}
|
|
797
|
+
return [hcg[0], f * 100, v * 100];
|
|
798
|
+
};
|
|
799
|
+
convert.hcg.hsl = function(hcg) {
|
|
800
|
+
const c = hcg[1] / 100;
|
|
801
|
+
const g = hcg[2] / 100;
|
|
802
|
+
const l = g * (1 - c) + 0.5 * c;
|
|
803
|
+
let s = 0;
|
|
804
|
+
if (l > 0 && l < 0.5) {
|
|
805
|
+
s = c / (2 * l);
|
|
806
|
+
} else if (l >= 0.5 && l < 1) {
|
|
807
|
+
s = c / (2 * (1 - l));
|
|
808
|
+
}
|
|
809
|
+
return [hcg[0], s * 100, l * 100];
|
|
810
|
+
};
|
|
811
|
+
convert.hcg.hwb = function(hcg) {
|
|
812
|
+
const c = hcg[1] / 100;
|
|
813
|
+
const g = hcg[2] / 100;
|
|
814
|
+
const v = c + g * (1 - c);
|
|
815
|
+
return [hcg[0], (v - c) * 100, (1 - v) * 100];
|
|
816
|
+
};
|
|
817
|
+
convert.hwb.hcg = function(hwb) {
|
|
818
|
+
const w = hwb[1] / 100;
|
|
819
|
+
const b = hwb[2] / 100;
|
|
820
|
+
const v = 1 - b;
|
|
821
|
+
const c = v - w;
|
|
822
|
+
let g = 0;
|
|
823
|
+
if (c < 1) {
|
|
824
|
+
g = (v - c) / (1 - c);
|
|
825
|
+
}
|
|
826
|
+
return [hwb[0], c * 100, g * 100];
|
|
827
|
+
};
|
|
828
|
+
convert.apple.rgb = function(apple) {
|
|
829
|
+
return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
|
|
830
|
+
};
|
|
831
|
+
convert.rgb.apple = function(rgb) {
|
|
832
|
+
return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535];
|
|
833
|
+
};
|
|
834
|
+
convert.gray.rgb = function(args) {
|
|
835
|
+
return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
|
|
836
|
+
};
|
|
837
|
+
convert.gray.hsl = function(args) {
|
|
838
|
+
return [0, 0, args[0]];
|
|
839
|
+
};
|
|
840
|
+
convert.gray.hsv = convert.gray.hsl;
|
|
841
|
+
convert.gray.hwb = function(gray) {
|
|
842
|
+
return [0, 100, gray[0]];
|
|
843
|
+
};
|
|
844
|
+
convert.gray.cmyk = function(gray) {
|
|
845
|
+
return [0, 0, 0, gray[0]];
|
|
846
|
+
};
|
|
847
|
+
convert.gray.lab = function(gray) {
|
|
848
|
+
return [gray[0], 0, 0];
|
|
849
|
+
};
|
|
850
|
+
convert.gray.hex = function(gray) {
|
|
851
|
+
const val = Math.round(gray[0] / 100 * 255) & 255;
|
|
852
|
+
const integer = (val << 16) + (val << 8) + val;
|
|
853
|
+
const string = integer.toString(16).toUpperCase();
|
|
854
|
+
return "000000".substring(string.length) + string;
|
|
855
|
+
};
|
|
856
|
+
convert.rgb.gray = function(rgb) {
|
|
857
|
+
const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
|
|
858
|
+
return [val / 255 * 100];
|
|
859
|
+
};
|
|
860
|
+
}
|
|
861
|
+
});
|
|
862
|
+
|
|
863
|
+
// ../../node_modules/color-convert/route.js
|
|
864
|
+
var require_route = __commonJS({
|
|
865
|
+
"../../node_modules/color-convert/route.js"(exports2, module2) {
|
|
866
|
+
"use strict";
|
|
867
|
+
var conversions = require_conversions();
|
|
868
|
+
function buildGraph() {
|
|
869
|
+
const graph = {};
|
|
870
|
+
const models = Object.keys(conversions);
|
|
871
|
+
for (let len = models.length, i = 0; i < len; i++) {
|
|
872
|
+
graph[models[i]] = {
|
|
873
|
+
// http://jsperf.com/1-vs-infinity
|
|
874
|
+
// micro-opt, but this is simple.
|
|
875
|
+
distance: -1,
|
|
876
|
+
parent: null
|
|
877
|
+
};
|
|
878
|
+
}
|
|
879
|
+
return graph;
|
|
880
|
+
}
|
|
881
|
+
function deriveBFS(fromModel) {
|
|
882
|
+
const graph = buildGraph();
|
|
883
|
+
const queue = [fromModel];
|
|
884
|
+
graph[fromModel].distance = 0;
|
|
885
|
+
while (queue.length) {
|
|
886
|
+
const current = queue.pop();
|
|
887
|
+
const adjacents = Object.keys(conversions[current]);
|
|
888
|
+
for (let len = adjacents.length, i = 0; i < len; i++) {
|
|
889
|
+
const adjacent = adjacents[i];
|
|
890
|
+
const node = graph[adjacent];
|
|
891
|
+
if (node.distance === -1) {
|
|
892
|
+
node.distance = graph[current].distance + 1;
|
|
893
|
+
node.parent = current;
|
|
894
|
+
queue.unshift(adjacent);
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
return graph;
|
|
899
|
+
}
|
|
900
|
+
function link(from, to) {
|
|
901
|
+
return function(args) {
|
|
902
|
+
return to(from(args));
|
|
903
|
+
};
|
|
904
|
+
}
|
|
905
|
+
function wrapConversion(toModel, graph) {
|
|
906
|
+
const path = [graph[toModel].parent, toModel];
|
|
907
|
+
let fn = conversions[graph[toModel].parent][toModel];
|
|
908
|
+
let cur = graph[toModel].parent;
|
|
909
|
+
while (graph[cur].parent) {
|
|
910
|
+
path.unshift(graph[cur].parent);
|
|
911
|
+
fn = link(conversions[graph[cur].parent][cur], fn);
|
|
912
|
+
cur = graph[cur].parent;
|
|
913
|
+
}
|
|
914
|
+
fn.conversion = path;
|
|
915
|
+
return fn;
|
|
916
|
+
}
|
|
917
|
+
module2.exports = function(fromModel) {
|
|
918
|
+
const graph = deriveBFS(fromModel);
|
|
919
|
+
const conversion = {};
|
|
920
|
+
const models = Object.keys(graph);
|
|
921
|
+
for (let len = models.length, i = 0; i < len; i++) {
|
|
922
|
+
const toModel = models[i];
|
|
923
|
+
const node = graph[toModel];
|
|
924
|
+
if (node.parent === null) {
|
|
925
|
+
continue;
|
|
926
|
+
}
|
|
927
|
+
conversion[toModel] = wrapConversion(toModel, graph);
|
|
928
|
+
}
|
|
929
|
+
return conversion;
|
|
930
|
+
};
|
|
931
|
+
}
|
|
932
|
+
});
|
|
933
|
+
|
|
934
|
+
// ../../node_modules/color-convert/index.js
|
|
935
|
+
var require_color_convert = __commonJS({
|
|
936
|
+
"../../node_modules/color-convert/index.js"(exports2, module2) {
|
|
937
|
+
"use strict";
|
|
938
|
+
var conversions = require_conversions();
|
|
939
|
+
var route = require_route();
|
|
940
|
+
var convert = {};
|
|
941
|
+
var models = Object.keys(conversions);
|
|
942
|
+
function wrapRaw(fn) {
|
|
943
|
+
const wrappedFn = function(...args) {
|
|
944
|
+
const arg0 = args[0];
|
|
945
|
+
if (arg0 === void 0 || arg0 === null) {
|
|
946
|
+
return arg0;
|
|
947
|
+
}
|
|
948
|
+
if (arg0.length > 1) {
|
|
949
|
+
args = arg0;
|
|
950
|
+
}
|
|
951
|
+
return fn(args);
|
|
952
|
+
};
|
|
953
|
+
if ("conversion" in fn) {
|
|
954
|
+
wrappedFn.conversion = fn.conversion;
|
|
955
|
+
}
|
|
956
|
+
return wrappedFn;
|
|
957
|
+
}
|
|
958
|
+
function wrapRounded(fn) {
|
|
959
|
+
const wrappedFn = function(...args) {
|
|
960
|
+
const arg0 = args[0];
|
|
961
|
+
if (arg0 === void 0 || arg0 === null) {
|
|
962
|
+
return arg0;
|
|
963
|
+
}
|
|
964
|
+
if (arg0.length > 1) {
|
|
965
|
+
args = arg0;
|
|
966
|
+
}
|
|
967
|
+
const result = fn(args);
|
|
968
|
+
if (typeof result === "object") {
|
|
969
|
+
for (let len = result.length, i = 0; i < len; i++) {
|
|
970
|
+
result[i] = Math.round(result[i]);
|
|
971
|
+
}
|
|
972
|
+
}
|
|
973
|
+
return result;
|
|
974
|
+
};
|
|
975
|
+
if ("conversion" in fn) {
|
|
976
|
+
wrappedFn.conversion = fn.conversion;
|
|
977
|
+
}
|
|
978
|
+
return wrappedFn;
|
|
979
|
+
}
|
|
980
|
+
models.forEach((fromModel) => {
|
|
981
|
+
convert[fromModel] = {};
|
|
982
|
+
Object.defineProperty(convert[fromModel], "channels", { value: conversions[fromModel].channels });
|
|
983
|
+
Object.defineProperty(convert[fromModel], "labels", { value: conversions[fromModel].labels });
|
|
984
|
+
const routes = route(fromModel);
|
|
985
|
+
const routeModels = Object.keys(routes);
|
|
986
|
+
routeModels.forEach((toModel) => {
|
|
987
|
+
const fn = routes[toModel];
|
|
988
|
+
convert[fromModel][toModel] = wrapRounded(fn);
|
|
989
|
+
convert[fromModel][toModel].raw = wrapRaw(fn);
|
|
990
|
+
});
|
|
991
|
+
});
|
|
992
|
+
module2.exports = convert;
|
|
993
|
+
}
|
|
994
|
+
});
|
|
995
|
+
|
|
996
|
+
// ../../node_modules/chalk/node_modules/ansi-styles/index.js
|
|
997
|
+
var require_ansi_styles = __commonJS({
|
|
998
|
+
"../../node_modules/chalk/node_modules/ansi-styles/index.js"(exports2, module2) {
|
|
999
|
+
"use strict";
|
|
1000
|
+
var wrapAnsi16 = (fn, offset) => (...args) => {
|
|
1001
|
+
const code = fn(...args);
|
|
1002
|
+
return `\x1B[${code + offset}m`;
|
|
1003
|
+
};
|
|
1004
|
+
var wrapAnsi256 = (fn, offset) => (...args) => {
|
|
1005
|
+
const code = fn(...args);
|
|
1006
|
+
return `\x1B[${38 + offset};5;${code}m`;
|
|
1007
|
+
};
|
|
1008
|
+
var wrapAnsi16m = (fn, offset) => (...args) => {
|
|
1009
|
+
const rgb = fn(...args);
|
|
1010
|
+
return `\x1B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
|
|
1011
|
+
};
|
|
1012
|
+
var ansi2ansi = (n) => n;
|
|
1013
|
+
var rgb2rgb = (r, g, b) => [r, g, b];
|
|
1014
|
+
var setLazyProperty = (object, property, get) => {
|
|
1015
|
+
Object.defineProperty(object, property, {
|
|
1016
|
+
get: () => {
|
|
1017
|
+
const value = get();
|
|
1018
|
+
Object.defineProperty(object, property, {
|
|
1019
|
+
value,
|
|
1020
|
+
enumerable: true,
|
|
1021
|
+
configurable: true
|
|
1022
|
+
});
|
|
1023
|
+
return value;
|
|
1024
|
+
},
|
|
1025
|
+
enumerable: true,
|
|
1026
|
+
configurable: true
|
|
1027
|
+
});
|
|
1028
|
+
};
|
|
1029
|
+
var colorConvert;
|
|
1030
|
+
var makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
|
|
1031
|
+
if (colorConvert === void 0) {
|
|
1032
|
+
colorConvert = require_color_convert();
|
|
1033
|
+
}
|
|
1034
|
+
const offset = isBackground ? 10 : 0;
|
|
1035
|
+
const styles = {};
|
|
1036
|
+
for (const [sourceSpace, suite] of Object.entries(colorConvert)) {
|
|
1037
|
+
const name = sourceSpace === "ansi16" ? "ansi" : sourceSpace;
|
|
1038
|
+
if (sourceSpace === targetSpace) {
|
|
1039
|
+
styles[name] = wrap(identity, offset);
|
|
1040
|
+
} else if (typeof suite === "object") {
|
|
1041
|
+
styles[name] = wrap(suite[targetSpace], offset);
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
return styles;
|
|
1045
|
+
};
|
|
1046
|
+
function assembleStyles() {
|
|
1047
|
+
const codes = /* @__PURE__ */ new Map();
|
|
1048
|
+
const styles = {
|
|
1049
|
+
modifier: {
|
|
1050
|
+
reset: [0, 0],
|
|
1051
|
+
// 21 isn't widely supported and 22 does the same thing
|
|
1052
|
+
bold: [1, 22],
|
|
1053
|
+
dim: [2, 22],
|
|
1054
|
+
italic: [3, 23],
|
|
1055
|
+
underline: [4, 24],
|
|
1056
|
+
inverse: [7, 27],
|
|
1057
|
+
hidden: [8, 28],
|
|
1058
|
+
strikethrough: [9, 29]
|
|
1059
|
+
},
|
|
1060
|
+
color: {
|
|
1061
|
+
black: [30, 39],
|
|
1062
|
+
red: [31, 39],
|
|
1063
|
+
green: [32, 39],
|
|
1064
|
+
yellow: [33, 39],
|
|
1065
|
+
blue: [34, 39],
|
|
1066
|
+
magenta: [35, 39],
|
|
1067
|
+
cyan: [36, 39],
|
|
1068
|
+
white: [37, 39],
|
|
1069
|
+
// Bright color
|
|
1070
|
+
blackBright: [90, 39],
|
|
1071
|
+
redBright: [91, 39],
|
|
1072
|
+
greenBright: [92, 39],
|
|
1073
|
+
yellowBright: [93, 39],
|
|
1074
|
+
blueBright: [94, 39],
|
|
1075
|
+
magentaBright: [95, 39],
|
|
1076
|
+
cyanBright: [96, 39],
|
|
1077
|
+
whiteBright: [97, 39]
|
|
1078
|
+
},
|
|
1079
|
+
bgColor: {
|
|
1080
|
+
bgBlack: [40, 49],
|
|
1081
|
+
bgRed: [41, 49],
|
|
1082
|
+
bgGreen: [42, 49],
|
|
1083
|
+
bgYellow: [43, 49],
|
|
1084
|
+
bgBlue: [44, 49],
|
|
1085
|
+
bgMagenta: [45, 49],
|
|
1086
|
+
bgCyan: [46, 49],
|
|
1087
|
+
bgWhite: [47, 49],
|
|
1088
|
+
// Bright color
|
|
1089
|
+
bgBlackBright: [100, 49],
|
|
1090
|
+
bgRedBright: [101, 49],
|
|
1091
|
+
bgGreenBright: [102, 49],
|
|
1092
|
+
bgYellowBright: [103, 49],
|
|
1093
|
+
bgBlueBright: [104, 49],
|
|
1094
|
+
bgMagentaBright: [105, 49],
|
|
1095
|
+
bgCyanBright: [106, 49],
|
|
1096
|
+
bgWhiteBright: [107, 49]
|
|
1097
|
+
}
|
|
1098
|
+
};
|
|
1099
|
+
styles.color.gray = styles.color.blackBright;
|
|
1100
|
+
styles.bgColor.bgGray = styles.bgColor.bgBlackBright;
|
|
1101
|
+
styles.color.grey = styles.color.blackBright;
|
|
1102
|
+
styles.bgColor.bgGrey = styles.bgColor.bgBlackBright;
|
|
1103
|
+
for (const [groupName, group] of Object.entries(styles)) {
|
|
1104
|
+
for (const [styleName, style] of Object.entries(group)) {
|
|
1105
|
+
styles[styleName] = {
|
|
1106
|
+
open: `\x1B[${style[0]}m`,
|
|
1107
|
+
close: `\x1B[${style[1]}m`
|
|
1108
|
+
};
|
|
1109
|
+
group[styleName] = styles[styleName];
|
|
1110
|
+
codes.set(style[0], style[1]);
|
|
1111
|
+
}
|
|
1112
|
+
Object.defineProperty(styles, groupName, {
|
|
1113
|
+
value: group,
|
|
1114
|
+
enumerable: false
|
|
1115
|
+
});
|
|
1116
|
+
}
|
|
1117
|
+
Object.defineProperty(styles, "codes", {
|
|
1118
|
+
value: codes,
|
|
1119
|
+
enumerable: false
|
|
1120
|
+
});
|
|
1121
|
+
styles.color.close = "\x1B[39m";
|
|
1122
|
+
styles.bgColor.close = "\x1B[49m";
|
|
1123
|
+
setLazyProperty(styles.color, "ansi", () => makeDynamicStyles(wrapAnsi16, "ansi16", ansi2ansi, false));
|
|
1124
|
+
setLazyProperty(styles.color, "ansi256", () => makeDynamicStyles(wrapAnsi256, "ansi256", ansi2ansi, false));
|
|
1125
|
+
setLazyProperty(styles.color, "ansi16m", () => makeDynamicStyles(wrapAnsi16m, "rgb", rgb2rgb, false));
|
|
1126
|
+
setLazyProperty(styles.bgColor, "ansi", () => makeDynamicStyles(wrapAnsi16, "ansi16", ansi2ansi, true));
|
|
1127
|
+
setLazyProperty(styles.bgColor, "ansi256", () => makeDynamicStyles(wrapAnsi256, "ansi256", ansi2ansi, true));
|
|
1128
|
+
setLazyProperty(styles.bgColor, "ansi16m", () => makeDynamicStyles(wrapAnsi16m, "rgb", rgb2rgb, true));
|
|
1129
|
+
return styles;
|
|
1130
|
+
}
|
|
1131
|
+
Object.defineProperty(module2, "exports", {
|
|
1132
|
+
enumerable: true,
|
|
1133
|
+
get: assembleStyles
|
|
1134
|
+
});
|
|
1135
|
+
}
|
|
1136
|
+
});
|
|
1137
|
+
|
|
1138
|
+
// ../../node_modules/has-flag/index.js
|
|
1139
|
+
var require_has_flag = __commonJS({
|
|
1140
|
+
"../../node_modules/has-flag/index.js"(exports2, module2) {
|
|
1141
|
+
"use strict";
|
|
1142
|
+
module2.exports = (flag, argv = process.argv) => {
|
|
1143
|
+
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
1144
|
+
const position = argv.indexOf(prefix + flag);
|
|
1145
|
+
const terminatorPosition = argv.indexOf("--");
|
|
1146
|
+
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
1147
|
+
};
|
|
1148
|
+
}
|
|
1149
|
+
});
|
|
1150
|
+
|
|
1151
|
+
// ../../node_modules/supports-color/index.js
|
|
1152
|
+
var require_supports_color = __commonJS({
|
|
1153
|
+
"../../node_modules/supports-color/index.js"(exports2, module2) {
|
|
1154
|
+
"use strict";
|
|
1155
|
+
var os = require("os");
|
|
1156
|
+
var tty = require("tty");
|
|
1157
|
+
var hasFlag = require_has_flag();
|
|
1158
|
+
var { env } = process;
|
|
1159
|
+
var forceColor;
|
|
1160
|
+
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
|
|
1161
|
+
forceColor = 0;
|
|
1162
|
+
} else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
|
|
1163
|
+
forceColor = 1;
|
|
1164
|
+
}
|
|
1165
|
+
if ("FORCE_COLOR" in env) {
|
|
1166
|
+
if (env.FORCE_COLOR === "true") {
|
|
1167
|
+
forceColor = 1;
|
|
1168
|
+
} else if (env.FORCE_COLOR === "false") {
|
|
1169
|
+
forceColor = 0;
|
|
1170
|
+
} else {
|
|
1171
|
+
forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
|
|
1172
|
+
}
|
|
1173
|
+
}
|
|
1174
|
+
function translateLevel(level) {
|
|
1175
|
+
if (level === 0) {
|
|
1176
|
+
return false;
|
|
1177
|
+
}
|
|
1178
|
+
return {
|
|
1179
|
+
level,
|
|
1180
|
+
hasBasic: true,
|
|
1181
|
+
has256: level >= 2,
|
|
1182
|
+
has16m: level >= 3
|
|
1183
|
+
};
|
|
1184
|
+
}
|
|
1185
|
+
function supportsColor(haveStream, streamIsTTY) {
|
|
1186
|
+
if (forceColor === 0) {
|
|
1187
|
+
return 0;
|
|
1188
|
+
}
|
|
1189
|
+
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
|
|
1190
|
+
return 3;
|
|
1191
|
+
}
|
|
1192
|
+
if (hasFlag("color=256")) {
|
|
1193
|
+
return 2;
|
|
1194
|
+
}
|
|
1195
|
+
if (haveStream && !streamIsTTY && forceColor === void 0) {
|
|
1196
|
+
return 0;
|
|
1197
|
+
}
|
|
1198
|
+
const min = forceColor || 0;
|
|
1199
|
+
if (env.TERM === "dumb") {
|
|
1200
|
+
return min;
|
|
1201
|
+
}
|
|
1202
|
+
if (process.platform === "win32") {
|
|
1203
|
+
const osRelease = os.release().split(".");
|
|
1204
|
+
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
1205
|
+
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
1206
|
+
}
|
|
1207
|
+
return 1;
|
|
1208
|
+
}
|
|
1209
|
+
if ("CI" in env) {
|
|
1210
|
+
if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "GITHUB_ACTIONS", "BUILDKITE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
|
|
1211
|
+
return 1;
|
|
1212
|
+
}
|
|
1213
|
+
return min;
|
|
1214
|
+
}
|
|
1215
|
+
if ("TEAMCITY_VERSION" in env) {
|
|
1216
|
+
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
1217
|
+
}
|
|
1218
|
+
if (env.COLORTERM === "truecolor") {
|
|
1219
|
+
return 3;
|
|
1220
|
+
}
|
|
1221
|
+
if ("TERM_PROGRAM" in env) {
|
|
1222
|
+
const version = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
1223
|
+
switch (env.TERM_PROGRAM) {
|
|
1224
|
+
case "iTerm.app":
|
|
1225
|
+
return version >= 3 ? 3 : 2;
|
|
1226
|
+
case "Apple_Terminal":
|
|
1227
|
+
return 2;
|
|
1228
|
+
}
|
|
1229
|
+
}
|
|
1230
|
+
if (/-256(color)?$/i.test(env.TERM)) {
|
|
1231
|
+
return 2;
|
|
1232
|
+
}
|
|
1233
|
+
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
|
1234
|
+
return 1;
|
|
1235
|
+
}
|
|
1236
|
+
if ("COLORTERM" in env) {
|
|
1237
|
+
return 1;
|
|
1238
|
+
}
|
|
1239
|
+
return min;
|
|
1240
|
+
}
|
|
1241
|
+
function getSupportLevel(stream) {
|
|
1242
|
+
const level = supportsColor(stream, stream && stream.isTTY);
|
|
1243
|
+
return translateLevel(level);
|
|
1244
|
+
}
|
|
1245
|
+
module2.exports = {
|
|
1246
|
+
supportsColor: getSupportLevel,
|
|
1247
|
+
stdout: translateLevel(supportsColor(true, tty.isatty(1))),
|
|
1248
|
+
stderr: translateLevel(supportsColor(true, tty.isatty(2)))
|
|
1249
|
+
};
|
|
1250
|
+
}
|
|
1251
|
+
});
|
|
1252
|
+
|
|
1253
|
+
// ../../node_modules/chalk/source/util.js
|
|
1254
|
+
var require_util = __commonJS({
|
|
1255
|
+
"../../node_modules/chalk/source/util.js"(exports2, module2) {
|
|
1256
|
+
"use strict";
|
|
1257
|
+
var stringReplaceAll = (string, substring, replacer) => {
|
|
1258
|
+
let index = string.indexOf(substring);
|
|
1259
|
+
if (index === -1) {
|
|
1260
|
+
return string;
|
|
1261
|
+
}
|
|
1262
|
+
const substringLength = substring.length;
|
|
1263
|
+
let endIndex = 0;
|
|
1264
|
+
let returnValue = "";
|
|
1265
|
+
do {
|
|
1266
|
+
returnValue += string.substr(endIndex, index - endIndex) + substring + replacer;
|
|
1267
|
+
endIndex = index + substringLength;
|
|
1268
|
+
index = string.indexOf(substring, endIndex);
|
|
1269
|
+
} while (index !== -1);
|
|
1270
|
+
returnValue += string.substr(endIndex);
|
|
1271
|
+
return returnValue;
|
|
1272
|
+
};
|
|
1273
|
+
var stringEncaseCRLFWithFirstIndex = (string, prefix, postfix, index) => {
|
|
1274
|
+
let endIndex = 0;
|
|
1275
|
+
let returnValue = "";
|
|
1276
|
+
do {
|
|
1277
|
+
const gotCR = string[index - 1] === "\r";
|
|
1278
|
+
returnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
|
|
1279
|
+
endIndex = index + 1;
|
|
1280
|
+
index = string.indexOf("\n", endIndex);
|
|
1281
|
+
} while (index !== -1);
|
|
1282
|
+
returnValue += string.substr(endIndex);
|
|
1283
|
+
return returnValue;
|
|
1284
|
+
};
|
|
1285
|
+
module2.exports = {
|
|
1286
|
+
stringReplaceAll,
|
|
1287
|
+
stringEncaseCRLFWithFirstIndex
|
|
1288
|
+
};
|
|
1289
|
+
}
|
|
1290
|
+
});
|
|
1291
|
+
|
|
1292
|
+
// ../../node_modules/chalk/source/templates.js
|
|
1293
|
+
var require_templates = __commonJS({
|
|
1294
|
+
"../../node_modules/chalk/source/templates.js"(exports2, module2) {
|
|
1295
|
+
"use strict";
|
|
1296
|
+
var TEMPLATE_REGEX = /(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
|
|
1297
|
+
var STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
|
|
1298
|
+
var STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
|
|
1299
|
+
var ESCAPE_REGEX = /\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi;
|
|
1300
|
+
var ESCAPES = /* @__PURE__ */ new Map([
|
|
1301
|
+
["n", "\n"],
|
|
1302
|
+
["r", "\r"],
|
|
1303
|
+
["t", " "],
|
|
1304
|
+
["b", "\b"],
|
|
1305
|
+
["f", "\f"],
|
|
1306
|
+
["v", "\v"],
|
|
1307
|
+
["0", "\0"],
|
|
1308
|
+
["\\", "\\"],
|
|
1309
|
+
["e", "\x1B"],
|
|
1310
|
+
["a", "\x07"]
|
|
1311
|
+
]);
|
|
1312
|
+
function unescape(c) {
|
|
1313
|
+
const u = c[0] === "u";
|
|
1314
|
+
const bracket = c[1] === "{";
|
|
1315
|
+
if (u && !bracket && c.length === 5 || c[0] === "x" && c.length === 3) {
|
|
1316
|
+
return String.fromCharCode(parseInt(c.slice(1), 16));
|
|
1317
|
+
}
|
|
1318
|
+
if (u && bracket) {
|
|
1319
|
+
return String.fromCodePoint(parseInt(c.slice(2, -1), 16));
|
|
1320
|
+
}
|
|
1321
|
+
return ESCAPES.get(c) || c;
|
|
1322
|
+
}
|
|
1323
|
+
function parseArguments(name, arguments_) {
|
|
1324
|
+
const results = [];
|
|
1325
|
+
const chunks = arguments_.trim().split(/\s*,\s*/g);
|
|
1326
|
+
let matches;
|
|
1327
|
+
for (const chunk of chunks) {
|
|
1328
|
+
const number = Number(chunk);
|
|
1329
|
+
if (!Number.isNaN(number)) {
|
|
1330
|
+
results.push(number);
|
|
1331
|
+
} else if (matches = chunk.match(STRING_REGEX)) {
|
|
1332
|
+
results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, character) => escape ? unescape(escape) : character));
|
|
1333
|
+
} else {
|
|
1334
|
+
throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
return results;
|
|
1338
|
+
}
|
|
1339
|
+
function parseStyle(style) {
|
|
1340
|
+
STYLE_REGEX.lastIndex = 0;
|
|
1341
|
+
const results = [];
|
|
1342
|
+
let matches;
|
|
1343
|
+
while ((matches = STYLE_REGEX.exec(style)) !== null) {
|
|
1344
|
+
const name = matches[1];
|
|
1345
|
+
if (matches[2]) {
|
|
1346
|
+
const args = parseArguments(name, matches[2]);
|
|
1347
|
+
results.push([name].concat(args));
|
|
1348
|
+
} else {
|
|
1349
|
+
results.push([name]);
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
return results;
|
|
1353
|
+
}
|
|
1354
|
+
function buildStyle(chalk2, styles) {
|
|
1355
|
+
const enabled = {};
|
|
1356
|
+
for (const layer of styles) {
|
|
1357
|
+
for (const style of layer.styles) {
|
|
1358
|
+
enabled[style[0]] = layer.inverse ? null : style.slice(1);
|
|
1359
|
+
}
|
|
1360
|
+
}
|
|
1361
|
+
let current = chalk2;
|
|
1362
|
+
for (const [styleName, styles2] of Object.entries(enabled)) {
|
|
1363
|
+
if (!Array.isArray(styles2)) {
|
|
1364
|
+
continue;
|
|
1365
|
+
}
|
|
1366
|
+
if (!(styleName in current)) {
|
|
1367
|
+
throw new Error(`Unknown Chalk style: ${styleName}`);
|
|
1368
|
+
}
|
|
1369
|
+
current = styles2.length > 0 ? current[styleName](...styles2) : current[styleName];
|
|
1370
|
+
}
|
|
1371
|
+
return current;
|
|
1372
|
+
}
|
|
1373
|
+
module2.exports = (chalk2, temporary) => {
|
|
1374
|
+
const styles = [];
|
|
1375
|
+
const chunks = [];
|
|
1376
|
+
let chunk = [];
|
|
1377
|
+
temporary.replace(TEMPLATE_REGEX, (m, escapeCharacter, inverse, style, close, character) => {
|
|
1378
|
+
if (escapeCharacter) {
|
|
1379
|
+
chunk.push(unescape(escapeCharacter));
|
|
1380
|
+
} else if (style) {
|
|
1381
|
+
const string = chunk.join("");
|
|
1382
|
+
chunk = [];
|
|
1383
|
+
chunks.push(styles.length === 0 ? string : buildStyle(chalk2, styles)(string));
|
|
1384
|
+
styles.push({ inverse, styles: parseStyle(style) });
|
|
1385
|
+
} else if (close) {
|
|
1386
|
+
if (styles.length === 0) {
|
|
1387
|
+
throw new Error("Found extraneous } in Chalk template literal");
|
|
1388
|
+
}
|
|
1389
|
+
chunks.push(buildStyle(chalk2, styles)(chunk.join("")));
|
|
1390
|
+
chunk = [];
|
|
1391
|
+
styles.pop();
|
|
1392
|
+
} else {
|
|
1393
|
+
chunk.push(character);
|
|
1394
|
+
}
|
|
1395
|
+
});
|
|
1396
|
+
chunks.push(chunk.join(""));
|
|
1397
|
+
if (styles.length > 0) {
|
|
1398
|
+
const errMessage = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? "" : "s"} (\`}\`)`;
|
|
1399
|
+
throw new Error(errMessage);
|
|
1400
|
+
}
|
|
1401
|
+
return chunks.join("");
|
|
1402
|
+
};
|
|
1403
|
+
}
|
|
1404
|
+
});
|
|
1405
|
+
|
|
1406
|
+
// ../../node_modules/chalk/source/index.js
|
|
1407
|
+
var require_source = __commonJS({
|
|
1408
|
+
"../../node_modules/chalk/source/index.js"(exports2, module2) {
|
|
1409
|
+
"use strict";
|
|
1410
|
+
var ansiStyles = require_ansi_styles();
|
|
1411
|
+
var { stdout: stdoutColor, stderr: stderrColor } = require_supports_color();
|
|
1412
|
+
var {
|
|
1413
|
+
stringReplaceAll,
|
|
1414
|
+
stringEncaseCRLFWithFirstIndex
|
|
1415
|
+
} = require_util();
|
|
1416
|
+
var { isArray } = Array;
|
|
1417
|
+
var levelMapping = [
|
|
1418
|
+
"ansi",
|
|
1419
|
+
"ansi",
|
|
1420
|
+
"ansi256",
|
|
1421
|
+
"ansi16m"
|
|
1422
|
+
];
|
|
1423
|
+
var styles = /* @__PURE__ */ Object.create(null);
|
|
1424
|
+
var applyOptions = (object, options = {}) => {
|
|
1425
|
+
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
|
|
1426
|
+
throw new Error("The `level` option should be an integer from 0 to 3");
|
|
1427
|
+
}
|
|
1428
|
+
const colorLevel = stdoutColor ? stdoutColor.level : 0;
|
|
1429
|
+
object.level = options.level === void 0 ? colorLevel : options.level;
|
|
1430
|
+
};
|
|
1431
|
+
var ChalkClass = class {
|
|
1432
|
+
constructor(options) {
|
|
1433
|
+
return chalkFactory(options);
|
|
1434
|
+
}
|
|
1435
|
+
};
|
|
1436
|
+
var chalkFactory = (options) => {
|
|
1437
|
+
const chalk3 = {};
|
|
1438
|
+
applyOptions(chalk3, options);
|
|
1439
|
+
chalk3.template = (...arguments_) => chalkTag(chalk3.template, ...arguments_);
|
|
1440
|
+
Object.setPrototypeOf(chalk3, Chalk.prototype);
|
|
1441
|
+
Object.setPrototypeOf(chalk3.template, chalk3);
|
|
1442
|
+
chalk3.template.constructor = () => {
|
|
1443
|
+
throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.");
|
|
1444
|
+
};
|
|
1445
|
+
chalk3.template.Instance = ChalkClass;
|
|
1446
|
+
return chalk3.template;
|
|
1447
|
+
};
|
|
1448
|
+
function Chalk(options) {
|
|
1449
|
+
return chalkFactory(options);
|
|
1450
|
+
}
|
|
1451
|
+
for (const [styleName, style] of Object.entries(ansiStyles)) {
|
|
1452
|
+
styles[styleName] = {
|
|
1453
|
+
get() {
|
|
1454
|
+
const builder = createBuilder(this, createStyler(style.open, style.close, this._styler), this._isEmpty);
|
|
1455
|
+
Object.defineProperty(this, styleName, { value: builder });
|
|
1456
|
+
return builder;
|
|
1457
|
+
}
|
|
1458
|
+
};
|
|
1459
|
+
}
|
|
1460
|
+
styles.visible = {
|
|
1461
|
+
get() {
|
|
1462
|
+
const builder = createBuilder(this, this._styler, true);
|
|
1463
|
+
Object.defineProperty(this, "visible", { value: builder });
|
|
1464
|
+
return builder;
|
|
1465
|
+
}
|
|
1466
|
+
};
|
|
1467
|
+
var usedModels = ["rgb", "hex", "keyword", "hsl", "hsv", "hwb", "ansi", "ansi256"];
|
|
1468
|
+
for (const model of usedModels) {
|
|
1469
|
+
styles[model] = {
|
|
1470
|
+
get() {
|
|
1471
|
+
const { level } = this;
|
|
1472
|
+
return function(...arguments_) {
|
|
1473
|
+
const styler = createStyler(ansiStyles.color[levelMapping[level]][model](...arguments_), ansiStyles.color.close, this._styler);
|
|
1474
|
+
return createBuilder(this, styler, this._isEmpty);
|
|
1475
|
+
};
|
|
1476
|
+
}
|
|
1477
|
+
};
|
|
1478
|
+
}
|
|
1479
|
+
for (const model of usedModels) {
|
|
1480
|
+
const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
|
|
1481
|
+
styles[bgModel] = {
|
|
1482
|
+
get() {
|
|
1483
|
+
const { level } = this;
|
|
1484
|
+
return function(...arguments_) {
|
|
1485
|
+
const styler = createStyler(ansiStyles.bgColor[levelMapping[level]][model](...arguments_), ansiStyles.bgColor.close, this._styler);
|
|
1486
|
+
return createBuilder(this, styler, this._isEmpty);
|
|
1487
|
+
};
|
|
1488
|
+
}
|
|
1489
|
+
};
|
|
1490
|
+
}
|
|
1491
|
+
var proto = Object.defineProperties(() => {
|
|
1492
|
+
}, {
|
|
1493
|
+
...styles,
|
|
1494
|
+
level: {
|
|
1495
|
+
enumerable: true,
|
|
1496
|
+
get() {
|
|
1497
|
+
return this._generator.level;
|
|
1498
|
+
},
|
|
1499
|
+
set(level) {
|
|
1500
|
+
this._generator.level = level;
|
|
1501
|
+
}
|
|
1502
|
+
}
|
|
1503
|
+
});
|
|
1504
|
+
var createStyler = (open, close, parent) => {
|
|
1505
|
+
let openAll;
|
|
1506
|
+
let closeAll;
|
|
1507
|
+
if (parent === void 0) {
|
|
1508
|
+
openAll = open;
|
|
1509
|
+
closeAll = close;
|
|
1510
|
+
} else {
|
|
1511
|
+
openAll = parent.openAll + open;
|
|
1512
|
+
closeAll = close + parent.closeAll;
|
|
1513
|
+
}
|
|
1514
|
+
return {
|
|
1515
|
+
open,
|
|
1516
|
+
close,
|
|
1517
|
+
openAll,
|
|
1518
|
+
closeAll,
|
|
1519
|
+
parent
|
|
1520
|
+
};
|
|
1521
|
+
};
|
|
1522
|
+
var createBuilder = (self, _styler, _isEmpty) => {
|
|
1523
|
+
const builder = (...arguments_) => {
|
|
1524
|
+
if (isArray(arguments_[0]) && isArray(arguments_[0].raw)) {
|
|
1525
|
+
return applyStyle(builder, chalkTag(builder, ...arguments_));
|
|
1526
|
+
}
|
|
1527
|
+
return applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
|
|
1528
|
+
};
|
|
1529
|
+
Object.setPrototypeOf(builder, proto);
|
|
1530
|
+
builder._generator = self;
|
|
1531
|
+
builder._styler = _styler;
|
|
1532
|
+
builder._isEmpty = _isEmpty;
|
|
1533
|
+
return builder;
|
|
1534
|
+
};
|
|
1535
|
+
var applyStyle = (self, string) => {
|
|
1536
|
+
if (self.level <= 0 || !string) {
|
|
1537
|
+
return self._isEmpty ? "" : string;
|
|
1538
|
+
}
|
|
1539
|
+
let styler = self._styler;
|
|
1540
|
+
if (styler === void 0) {
|
|
1541
|
+
return string;
|
|
1542
|
+
}
|
|
1543
|
+
const { openAll, closeAll } = styler;
|
|
1544
|
+
if (string.indexOf("\x1B") !== -1) {
|
|
1545
|
+
while (styler !== void 0) {
|
|
1546
|
+
string = stringReplaceAll(string, styler.close, styler.open);
|
|
1547
|
+
styler = styler.parent;
|
|
1548
|
+
}
|
|
1549
|
+
}
|
|
1550
|
+
const lfIndex = string.indexOf("\n");
|
|
1551
|
+
if (lfIndex !== -1) {
|
|
1552
|
+
string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
|
|
1553
|
+
}
|
|
1554
|
+
return openAll + string + closeAll;
|
|
1555
|
+
};
|
|
1556
|
+
var template;
|
|
1557
|
+
var chalkTag = (chalk3, ...strings) => {
|
|
1558
|
+
const [firstString] = strings;
|
|
1559
|
+
if (!isArray(firstString) || !isArray(firstString.raw)) {
|
|
1560
|
+
return strings.join(" ");
|
|
1561
|
+
}
|
|
1562
|
+
const arguments_ = strings.slice(1);
|
|
1563
|
+
const parts = [firstString.raw[0]];
|
|
1564
|
+
for (let i = 1; i < firstString.length; i++) {
|
|
1565
|
+
parts.push(
|
|
1566
|
+
String(arguments_[i - 1]).replace(/[{}\\]/g, "\\$&"),
|
|
1567
|
+
String(firstString.raw[i])
|
|
1568
|
+
);
|
|
1569
|
+
}
|
|
1570
|
+
if (template === void 0) {
|
|
1571
|
+
template = require_templates();
|
|
1572
|
+
}
|
|
1573
|
+
return template(chalk3, parts.join(""));
|
|
1574
|
+
};
|
|
1575
|
+
Object.defineProperties(Chalk.prototype, styles);
|
|
1576
|
+
var chalk2 = Chalk();
|
|
1577
|
+
chalk2.supportsColor = stdoutColor;
|
|
1578
|
+
chalk2.stderr = Chalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
1579
|
+
chalk2.stderr.supportsColor = stderrColor;
|
|
1580
|
+
module2.exports = chalk2;
|
|
1581
|
+
}
|
|
1582
|
+
});
|
|
1583
|
+
|
|
21
1584
|
// src/cli.ts
|
|
22
1585
|
var cli_exports = {};
|
|
23
1586
|
__export(cli_exports, {
|
|
@@ -295,18 +1858,216 @@ var runCommand = async (command) => {
|
|
|
295
1858
|
}
|
|
296
1859
|
};
|
|
297
1860
|
|
|
1861
|
+
// src/lib/theme.ts
|
|
1862
|
+
var import_chalk = __toESM(require_source());
|
|
1863
|
+
var THEME = {
|
|
1864
|
+
// --- PRIMARY NEONS & CORES ---
|
|
1865
|
+
VOID: "#abe7ff",
|
|
1866
|
+
// Core Cyan (210)
|
|
1867
|
+
SOURCE: "#7fbfff",
|
|
1868
|
+
// Data Blue (175)
|
|
1869
|
+
CHROME: "#ebebeb",
|
|
1870
|
+
// Bright Silver (244)
|
|
1871
|
+
AZURE: "#0b0bef",
|
|
1872
|
+
// Deep Cyber Azure (18)
|
|
1873
|
+
SKY: "#d7ffff",
|
|
1874
|
+
// Cold Sky (234)
|
|
1875
|
+
PLASMA: "#0000ff",
|
|
1876
|
+
// Pure Plasma (11)
|
|
1877
|
+
// --- STATUS & ALERTS (REDS/GOLDS) ---
|
|
1878
|
+
CRITICAL: "#ff0000",
|
|
1879
|
+
// Pure Red (249)
|
|
1880
|
+
ERROR: "#b30000",
|
|
1881
|
+
// Blood Red (215)
|
|
1882
|
+
WARNING: "#fff31b",
|
|
1883
|
+
// Warning Yellow (250)
|
|
1884
|
+
GOLD: "#dbcb13",
|
|
1885
|
+
// Amber Gold (237)
|
|
1886
|
+
SCARLET: "#d70000",
|
|
1887
|
+
// Signal Scarlet (233)
|
|
1888
|
+
PULSE: "#a3270b",
|
|
1889
|
+
// Deep Pulse (201)
|
|
1890
|
+
// --- ENTITIES & FACTIONS ---
|
|
1891
|
+
PLAYER: "#ffffff",
|
|
1892
|
+
// Pure White (253)
|
|
1893
|
+
NPC: "#efbf77",
|
|
1894
|
+
// Civilian Tan (245)
|
|
1895
|
+
DOOMGUARD: "#8b0000",
|
|
1896
|
+
// Doomguard Crimson (180)
|
|
1897
|
+
MILLER: "#af632f",
|
|
1898
|
+
// Miller Rust (211)
|
|
1899
|
+
SYNTH: "#fff393",
|
|
1900
|
+
// Synth Yellow (251)
|
|
1901
|
+
ORACLE: "#fff7c7",
|
|
1902
|
+
// Oracle Cream (252)
|
|
1903
|
+
// --- SPECIALIZED MODULES ---
|
|
1904
|
+
BIO: "#5f7367",
|
|
1905
|
+
// Bio-Digital (136)
|
|
1906
|
+
TOXIC: "#2f4337",
|
|
1907
|
+
// Toxic Waste (75)
|
|
1908
|
+
RECALL: "#c7c337",
|
|
1909
|
+
// Memory Lime (226)
|
|
1910
|
+
SOUL: "#af6b8f",
|
|
1911
|
+
// Soul Pink (213)
|
|
1912
|
+
NEURAL: "#975777",
|
|
1913
|
+
// Neural Magenta (192)
|
|
1914
|
+
GHOST: "#db7f3b",
|
|
1915
|
+
// Ghost Orange (235)
|
|
1916
|
+
ECHO: "#6b6b97",
|
|
1917
|
+
// Echo Purple (152)
|
|
1918
|
+
// --- ATMOSPHERIC & HUES ---
|
|
1919
|
+
WRECKED: "#43272f",
|
|
1920
|
+
// Bruised Dark (95)
|
|
1921
|
+
DEEP_VOID: "#0b0b0f",
|
|
1922
|
+
// Near Black (17)
|
|
1923
|
+
GLITCH: "#4b2f37",
|
|
1924
|
+
// Glitch Maroon (106)
|
|
1925
|
+
FOREST: "#1f2b1f",
|
|
1926
|
+
// Deep Forest (43)
|
|
1927
|
+
RUST: "#632f1f",
|
|
1928
|
+
// Industrial Rust (137)
|
|
1929
|
+
LEAD: "#2f2f3f",
|
|
1930
|
+
// Lead Grey (69)
|
|
1931
|
+
// --- INFRASTRUCTURE ---
|
|
1932
|
+
DIM: "#2f2f2f",
|
|
1933
|
+
// Interface Grey (68)
|
|
1934
|
+
BORDER: "#3f3f3f",
|
|
1935
|
+
// Panel Grey (92)
|
|
1936
|
+
METAL: "#6b6b6b",
|
|
1937
|
+
// Steel (151)
|
|
1938
|
+
OBSIDIAN: "#070000",
|
|
1939
|
+
// Void Black (12)
|
|
1940
|
+
STEEL: "#ababab"
|
|
1941
|
+
// Polished Steel (209)
|
|
1942
|
+
};
|
|
1943
|
+
var hex = {
|
|
1944
|
+
void: import_chalk.default.hex(THEME.VOID),
|
|
1945
|
+
source: import_chalk.default.hex(THEME.SOURCE),
|
|
1946
|
+
chrome: import_chalk.default.hex(THEME.CHROME).bold,
|
|
1947
|
+
azure: import_chalk.default.hex(THEME.AZURE),
|
|
1948
|
+
sky: import_chalk.default.hex(THEME.SKY),
|
|
1949
|
+
plasma: import_chalk.default.hex(THEME.PLASMA).bold,
|
|
1950
|
+
critical: import_chalk.default.hex(THEME.CRITICAL).bold,
|
|
1951
|
+
error: import_chalk.default.hex(THEME.ERROR),
|
|
1952
|
+
warning: import_chalk.default.hex(THEME.WARNING),
|
|
1953
|
+
gold: import_chalk.default.hex(THEME.GOLD),
|
|
1954
|
+
scarlet: import_chalk.default.hex(THEME.SCARLET),
|
|
1955
|
+
pulse: import_chalk.default.hex(THEME.PULSE),
|
|
1956
|
+
player: import_chalk.default.hex(THEME.PLAYER).bold,
|
|
1957
|
+
npc: import_chalk.default.hex(THEME.NPC),
|
|
1958
|
+
doomguard: import_chalk.default.hex(THEME.DOOMGUARD).bold,
|
|
1959
|
+
miller: import_chalk.default.hex(THEME.MILLER),
|
|
1960
|
+
synth: import_chalk.default.hex(THEME.SYNTH),
|
|
1961
|
+
oracle: import_chalk.default.hex(THEME.ORACLE),
|
|
1962
|
+
bio: import_chalk.default.hex(THEME.BIO),
|
|
1963
|
+
toxic: import_chalk.default.hex(THEME.TOXIC),
|
|
1964
|
+
recall: import_chalk.default.hex(THEME.RECALL),
|
|
1965
|
+
soul: import_chalk.default.hex(THEME.SOUL),
|
|
1966
|
+
neural: import_chalk.default.hex(THEME.NEURAL),
|
|
1967
|
+
ghost: import_chalk.default.hex(THEME.GHOST),
|
|
1968
|
+
echo: import_chalk.default.hex(THEME.ECHO),
|
|
1969
|
+
wrecked: import_chalk.default.hex(THEME.WRECKED),
|
|
1970
|
+
deep: import_chalk.default.hex(THEME.DEEP_VOID),
|
|
1971
|
+
glitch: import_chalk.default.hex(THEME.GLITCH),
|
|
1972
|
+
forest: import_chalk.default.hex(THEME.FOREST),
|
|
1973
|
+
rust: import_chalk.default.hex(THEME.RUST),
|
|
1974
|
+
lead: import_chalk.default.hex(THEME.LEAD),
|
|
1975
|
+
dim: import_chalk.default.hex(THEME.DIM),
|
|
1976
|
+
border: import_chalk.default.hex(THEME.BORDER),
|
|
1977
|
+
metal: import_chalk.default.hex(THEME.METAL),
|
|
1978
|
+
obsidian: import_chalk.default.hex(THEME.OBSIDIAN),
|
|
1979
|
+
steel: import_chalk.default.hex(THEME.STEEL)
|
|
1980
|
+
};
|
|
1981
|
+
var RUNES = "\u16A0 \u16A2 \u16A6 \u16A8 \u16B1 \u16B2 \u16B7 \u16B9";
|
|
1982
|
+
var zalgo = (text) => {
|
|
1983
|
+
const map = {
|
|
1984
|
+
"a": "\xE1",
|
|
1985
|
+
"e": "\xE9",
|
|
1986
|
+
"i": "\xED",
|
|
1987
|
+
"o": "\xF3",
|
|
1988
|
+
"u": "\xFA",
|
|
1989
|
+
"A": "\xC1",
|
|
1990
|
+
"E": "\xC9",
|
|
1991
|
+
"I": "\xCD",
|
|
1992
|
+
"O": "\xD3",
|
|
1993
|
+
"U": "\xDA"
|
|
1994
|
+
};
|
|
1995
|
+
return text.split("").map((c) => map[c] || c).join("");
|
|
1996
|
+
};
|
|
1997
|
+
var BOOT_ART = `
|
|
1998
|
+
. .
|
|
1999
|
+
.n . . n.
|
|
2000
|
+
. .dP dP 9b 9b. .
|
|
2001
|
+
4 qXb . dX Xb . dXp t
|
|
2002
|
+
dX. 9Xb .dXb __ __ dXb. dXP .Xb
|
|
2003
|
+
9XXb._ dXp' d9b . . d9b 'qXb _.dXXP
|
|
2004
|
+
9XXb._ Xb dXp 99b 9b dP 99b dXp bX _.dXXP
|
|
2005
|
+
9XXb._ Xb dXp 99b 9b dP 99b dXp bX _.dXXP
|
|
2006
|
+
9XXb(eb.XbP . Y8. .8P . XbP.be)dXXP
|
|
2007
|
+
'8Xdb..888P dP "88b d88" 9b 988..dbX8'
|
|
2008
|
+
'8888888P d8 "888888" 8b 98888888'
|
|
2009
|
+
"88888" d888 "8888" 888b "88888"
|
|
2010
|
+
"888" d88888 "88" 88888b "888"
|
|
2011
|
+
"8" d888888b d8b d8888888b "8"
|
|
2012
|
+
d88888888bd888bd888888888
|
|
2013
|
+
"988888888888888888888"
|
|
2014
|
+
"98888888888888888P"
|
|
2015
|
+
"9888888888888P"
|
|
2016
|
+
"988888888P"
|
|
2017
|
+
"98888P"
|
|
2018
|
+
"98P"
|
|
2019
|
+
"V"
|
|
2020
|
+
`;
|
|
2021
|
+
var SKULL_ART = `
|
|
2022
|
+
______
|
|
2023
|
+
.-" "-.
|
|
2024
|
+
/ \\
|
|
2025
|
+
| |
|
|
2026
|
+
|, .-. .-. ,|
|
|
2027
|
+
| )(__/ \\__)( |
|
|
2028
|
+
|/ /\\ \\|
|
|
2029
|
+
(_ ^^ _)
|
|
2030
|
+
\\__|IIIIII|__/
|
|
2031
|
+
| \\IIIIII/ |
|
|
2032
|
+
\\ /
|
|
2033
|
+
\`--------\`
|
|
2034
|
+
`;
|
|
2035
|
+
var NEURAL_ART = `
|
|
2036
|
+
____ ____
|
|
2037
|
+
/ \\____/ \\
|
|
2038
|
+
/ /\\ \\__/ /\\ \\
|
|
2039
|
+
/ / \\ \\/ / \\ \\
|
|
2040
|
+
\\ \\__/ /\\ \\__/ /
|
|
2041
|
+
\\ / \\ /
|
|
2042
|
+
\\____/ \\____/
|
|
2043
|
+
`;
|
|
2044
|
+
var FRAGMENTS = [
|
|
2045
|
+
"The sky above the port was the color of television, tuned to a dead channel. - Gibson",
|
|
2046
|
+
"Reality is that which, when you stop believing in it, doesn't go away. - Dick",
|
|
2047
|
+
"The most merciful thing in the world is the inability of the human mind to correlate all its contents. - Lovecraft",
|
|
2048
|
+
"High-tech low-life. The Sprawl is watching.",
|
|
2049
|
+
"In the chrome-plated silence of the machine, we find our demons.",
|
|
2050
|
+
"Ritual silence. The daimon whispers in the code.",
|
|
2051
|
+
"Steel and sorcery. The lambdas are binding the void."
|
|
2052
|
+
];
|
|
2053
|
+
var getRandomFragment = () => FRAGMENTS[Math.floor(Math.random() * FRAGMENTS.length)];
|
|
2054
|
+
|
|
298
2055
|
// src/lib/render.ts
|
|
299
2056
|
var cellAt = (pos, state) => {
|
|
300
2057
|
const isBlocked = state.grid.blocked.some((b) => b.x === pos.x && b.y === pos.y);
|
|
301
|
-
if (isBlocked) return "#";
|
|
2058
|
+
if (isBlocked) return hex.border("#");
|
|
302
2059
|
if (state.player.position.x === pos.x && state.player.position.y === pos.y) {
|
|
303
|
-
return "P";
|
|
2060
|
+
return hex.player("P");
|
|
304
2061
|
}
|
|
305
2062
|
for (const npc of Object.values(state.npcs.entities)) {
|
|
306
2063
|
if (!npc) continue;
|
|
307
|
-
if (npc.position.x === pos.x && npc.position.y === pos.y)
|
|
2064
|
+
if (npc.position.x === pos.x && npc.position.y === pos.y) {
|
|
2065
|
+
if (npc.id === "miller") return hex.miller("M");
|
|
2066
|
+
if (npc.id === "doomguard") return hex.doomguard("D");
|
|
2067
|
+
return hex.npc("N");
|
|
2068
|
+
}
|
|
308
2069
|
}
|
|
309
|
-
return ".";
|
|
2070
|
+
return hex.dim(".");
|
|
310
2071
|
};
|
|
311
2072
|
var renderGrid = (state) => {
|
|
312
2073
|
const rows = [];
|
|
@@ -319,7 +2080,8 @@ var renderGrid = (state) => {
|
|
|
319
2080
|
}
|
|
320
2081
|
return rows.join("\n");
|
|
321
2082
|
};
|
|
322
|
-
var renderLegend = () => "Legend :: P
|
|
2083
|
+
var renderLegend = () => `${hex.chrome("Legend")} :: ${hex.player("P")}=${hex.azure("Scout")} ${hex.doomguard("D")}=${hex.critical("Doomguard")} ${hex.miller("M")}=${hex.gold("Miller")} ${hex.border("#")}=${hex.metal("Blocked")} ${hex.dim(".")}=${hex.steel("Open")}
|
|
2084
|
+
${hex.source(RUNES)}`;
|
|
323
2085
|
|
|
324
2086
|
// src/store.ts
|
|
325
2087
|
var import_toolkit15 = require("@reduxjs/toolkit");
|
|
@@ -471,7 +2233,7 @@ var steps = [
|
|
|
471
2233
|
{
|
|
472
2234
|
group: "soul_export",
|
|
473
2235
|
command: "forbocai soul export miller",
|
|
474
|
-
expectedRoutes: ["POST /npcs/{id}/soul/export"]
|
|
2236
|
+
expectedRoutes: ["POST /npcs/{id}/soul/export", "POST /npcs/{id}/soul/confirm"]
|
|
475
2237
|
},
|
|
476
2238
|
{
|
|
477
2239
|
group: "soul_list",
|
|
@@ -552,7 +2314,7 @@ var steps = [
|
|
|
552
2314
|
{
|
|
553
2315
|
group: "soul_import",
|
|
554
2316
|
command: "forbocai soul import tx-demo-001",
|
|
555
|
-
expectedRoutes: ["GET /souls/{txId}", "POST /npcs/import"]
|
|
2317
|
+
expectedRoutes: ["GET /souls/{txId}", "POST /npcs/import", "POST /npcs/import/confirm"]
|
|
556
2318
|
},
|
|
557
2319
|
{
|
|
558
2320
|
group: "soul_chat",
|
|
@@ -677,9 +2439,10 @@ var applyScenarioInitialState = (step, store) => {
|
|
|
677
2439
|
var runGame = async ({
|
|
678
2440
|
mode
|
|
679
2441
|
}) => {
|
|
680
|
-
console.log("\n
|
|
681
|
-
console.log(`
|
|
682
|
-
`)
|
|
2442
|
+
console.log("\n" + hex.azure(NEURAL_ART));
|
|
2443
|
+
console.log(hex.critical("SYSTEM_OVERRIDE") + ` // ` + hex.void("NEURAL_LINK_ESTABLISHED"));
|
|
2444
|
+
console.log(hex.warning(`[VOID::WATCHER]`) + hex.dim(` Echoes session booting at mode=${hex.azure(mode)}
|
|
2445
|
+
`));
|
|
683
2446
|
const store = createTestGameStore();
|
|
684
2447
|
store.dispatch(uiActions.setMode(mode));
|
|
685
2448
|
store.dispatch(
|
|
@@ -699,15 +2462,16 @@ var runGame = async ({
|
|
|
699
2462
|
for (const step of store.getState().scenario.steps) {
|
|
700
2463
|
if (mode === "manual") {
|
|
701
2464
|
console.log(`
|
|
702
|
-
|
|
703
|
-
console.log(step.description);
|
|
704
|
-
console.log(
|
|
2465
|
+
` + hex.border(`\u256D\u2500 `) + hex.sky(step.title) + hex.border(` \u2500\u256E`));
|
|
2466
|
+
console.log(hex.dim(zalgo(step.description)));
|
|
2467
|
+
console.log(hex.border(`\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F
|
|
2468
|
+
`));
|
|
705
2469
|
console.log(renderGrid(store.getState()));
|
|
706
|
-
await rl?.question(
|
|
2470
|
+
await rl?.question(hex.player(`> `) + hex.chrome(`Execute trace segment :: `) + hex.source(`[${step.id}]`));
|
|
707
2471
|
} else {
|
|
708
2472
|
console.log(`
|
|
709
|
-
|
|
710
|
-
console.log(step.description);
|
|
2473
|
+
` + hex.steel(`:: `) + hex.sky(step.title) + ` ` + hex.dim(`[${step.id}]`));
|
|
2474
|
+
console.log(hex.dim(zalgo(step.description)));
|
|
711
2475
|
}
|
|
712
2476
|
applyScenarioInitialState(step, store);
|
|
713
2477
|
for (const command of step.commands) {
|
|
@@ -739,28 +2503,61 @@ var runGame = async ({
|
|
|
739
2503
|
store.dispatch(uiActions.addMessage(`System Bridge Blocked Action: ${validation.reason}`));
|
|
740
2504
|
}
|
|
741
2505
|
}
|
|
742
|
-
|
|
2506
|
+
const group = command.group;
|
|
2507
|
+
let statusColor = result.status === "ok" ? hex.gold : hex.critical;
|
|
2508
|
+
if (result.status === "ok" && group === "status") statusColor = hex.plasma;
|
|
2509
|
+
let cmdColor = hex.source;
|
|
2510
|
+
if (group.startsWith("memory")) cmdColor = hex.bio;
|
|
2511
|
+
if (group.startsWith("soul")) cmdColor = hex.soul;
|
|
2512
|
+
if (group.startsWith("ghost")) cmdColor = hex.ghost;
|
|
2513
|
+
if (group.startsWith("npc")) cmdColor = hex.azure;
|
|
2514
|
+
if (group.startsWith("bridge")) cmdColor = hex.recall;
|
|
2515
|
+
if (group === "cortex_init") cmdColor = hex.neural;
|
|
2516
|
+
console.log(`${statusColor(`[${result.status}]`)} ${cmdColor(command.command)}`);
|
|
743
2517
|
if (result.status === "error") {
|
|
744
|
-
|
|
2518
|
+
process.stderr.write(hex.critical(SKULL_ART));
|
|
2519
|
+
console.log(hex.critical("LOG_ERR_CRITICAL") + ` // ` + hex.rust("BIT_ROT_DETECTED") + ` // ` + hex.glitch("V_OID_LEAK"));
|
|
2520
|
+
if (result.output) {
|
|
2521
|
+
console.log(hex.dim(` | `) + hex.glitch(result.output.split("\n")[0]));
|
|
2522
|
+
}
|
|
745
2523
|
}
|
|
746
2524
|
}
|
|
747
2525
|
if (mode === "autoplay") {
|
|
748
|
-
|
|
2526
|
+
const fragment = getRandomFragment();
|
|
2527
|
+
console.log(`
|
|
2528
|
+
` + hex.bio(`\u16EB`) + ` ` + hex.dim.italic(`"${fragment}"`));
|
|
2529
|
+
process.stdout.write(hex.dim(" " + zalgo(":: synchronizing_neural_bus...") + " "));
|
|
2530
|
+
const dots = [".", "..", "..."];
|
|
2531
|
+
for (const dot of dots) {
|
|
2532
|
+
process.stdout.write(hex.echo(dot));
|
|
2533
|
+
await delay(250);
|
|
2534
|
+
}
|
|
2535
|
+
console.log("\n");
|
|
749
2536
|
}
|
|
750
2537
|
}
|
|
751
2538
|
rl?.close();
|
|
752
2539
|
const state = store.getState();
|
|
753
2540
|
const missingGroups = selectMissingGroups(state.harness.covered);
|
|
754
2541
|
const complete = missingGroups.length === 0;
|
|
755
|
-
const
|
|
756
|
-
|
|
2542
|
+
const summaryText = complete ? `ALL_BINDINGS_COMPLETE :: Coverage achieved.` : `VOID_GAPS_DETECTED :: Missing groups -> ${missingGroups.join(", ")}`;
|
|
2543
|
+
const summary = complete ? hex.chrome(summaryText) : hex.scarlet(summaryText);
|
|
2544
|
+
console.log("\n" + hex.lead("=== ") + hex.steel("Transcript Summary // ") + hex.rust("chrome rain ledger") + hex.lead(" ==="));
|
|
757
2545
|
for (const entry of state.transcript.entries) {
|
|
2546
|
+
const statusColor = entry.status === "ok" ? hex.gold : hex.critical;
|
|
2547
|
+
let groupColor = hex.source;
|
|
2548
|
+
if (entry.commandGroup.startsWith("memory")) groupColor = hex.bio;
|
|
2549
|
+
if (entry.commandGroup.startsWith("soul")) groupColor = hex.soul;
|
|
2550
|
+
if (entry.commandGroup.startsWith("ghost")) groupColor = hex.ghost;
|
|
2551
|
+
if (entry.commandGroup.startsWith("npc")) groupColor = hex.azure;
|
|
2552
|
+
if (entry.commandGroup.startsWith("bridge")) groupColor = hex.recall;
|
|
2553
|
+
if (entry.commandGroup === "cortex_init") groupColor = hex.neural;
|
|
758
2554
|
console.log(
|
|
759
|
-
`${entry.at} | ${entry.commandGroup} | ${entry.status} | ${entry.command
|
|
2555
|
+
`${hex.dim(entry.at.split("T")[1].split(".")[0])} | ${groupColor(entry.commandGroup.padEnd(16))} | ${statusColor(entry.status.padEnd(5))} | ${hex.player(entry.command)}`
|
|
760
2556
|
);
|
|
761
2557
|
}
|
|
762
|
-
console.log("\n
|
|
2558
|
+
console.log("\n" + hex.plasma(RUNES));
|
|
763
2559
|
console.log(summary);
|
|
2560
|
+
console.log(hex.dim(`Compliance is monitored by the Watcher in the Code. \u{1F441}\uFE0F`));
|
|
764
2561
|
return {
|
|
765
2562
|
complete,
|
|
766
2563
|
missingGroups,
|
|
@@ -771,23 +2568,18 @@ var runGame = async ({
|
|
|
771
2568
|
|
|
772
2569
|
// src/cli.ts
|
|
773
2570
|
var usage = () => {
|
|
774
|
-
console.log(
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
--mode autoplay
|
|
787
|
-
|
|
788
|
-
[ok] Command completed in shell mode.
|
|
789
|
-
[error] LOG_ERR_CRITICAL - command failed and was recorded.
|
|
790
|
-
`);
|
|
2571
|
+
console.log(hex.void(BOOT_ART));
|
|
2572
|
+
console.log(hex.border(`\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557`));
|
|
2573
|
+
console.log(hex.border(`\u2551 `) + hex.void(`ECHOES OF THE SPIRE // TERMINAL HARNESS`) + hex.border(` \u2551`));
|
|
2574
|
+
console.log(hex.border(`\u2551 `) + hex.critical(`SYSTEM_OVERRIDE :: NEURAL_LINK_ESTABLISHED`) + hex.border(` \u2551`));
|
|
2575
|
+
console.log(hex.border(`\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D`));
|
|
2576
|
+
console.log("\n" + hex.source(RUNES) + "\n");
|
|
2577
|
+
console.log(hex.player("Usage:"));
|
|
2578
|
+
console.log(` forbocai-test-game --mode ${hex.void("autoplay")}|${hex.void("manual")}`);
|
|
2579
|
+
console.log("\n" + hex.player("Defaults:"));
|
|
2580
|
+
console.log(` --mode ${hex.void("autoplay")}`);
|
|
2581
|
+
console.log("\n " + hex.success("[ok]") + ` ${zalgo("Command completed in shell mode.")}`);
|
|
2582
|
+
console.log(" " + hex.error("[error]") + ` ` + hex.critical("LOG_ERR_CRITICAL") + ` - ${zalgo("command failed and was recorded.")}`);
|
|
791
2583
|
};
|
|
792
2584
|
var getArgValue = (name) => {
|
|
793
2585
|
const idx = process.argv.findIndex((a) => a === name);
|