@jam-comments/server-utilities 1.0.0 → 1.0.1
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/index.d.ts +0 -1
- package/dist/index.es.js +588 -995
- package/dist/index.umd.js +2 -6
- package/package.json +4 -3
- package/dist/utils.d.ts +0 -9
package/dist/index.es.js
CHANGED
|
@@ -1,22 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
1
|
const getBaseUrl = () => {
|
|
21
2
|
var _a;
|
|
22
3
|
if (typeof process !== "undefined" && ((_a = process.env) == null ? void 0 : _a.JAM_COMMENTS_BASE_URL)) {
|
|
@@ -28,12 +9,14 @@ const markupFetcher = (platform) => {
|
|
|
28
9
|
return async ({
|
|
29
10
|
path,
|
|
30
11
|
domain,
|
|
31
|
-
apiKey
|
|
12
|
+
apiKey,
|
|
13
|
+
embedScript = false
|
|
32
14
|
}) => {
|
|
33
15
|
const params = new URLSearchParams({
|
|
34
16
|
path,
|
|
35
17
|
domain,
|
|
36
|
-
force_embed: "1"
|
|
18
|
+
force_embed: "1",
|
|
19
|
+
embed_script: embedScript ? "1" : "0"
|
|
37
20
|
});
|
|
38
21
|
const response = await fetch(`${getBaseUrl()}/api/markup?${params}`, {
|
|
39
22
|
method: "GET",
|
|
@@ -52,8 +35,16 @@ const markupFetcher = (platform) => {
|
|
|
52
35
|
return await response.text();
|
|
53
36
|
};
|
|
54
37
|
};
|
|
55
|
-
var
|
|
56
|
-
var
|
|
38
|
+
var chalk$1 = { exports: {} };
|
|
39
|
+
var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
|
|
40
|
+
var escapeStringRegexp = function(str) {
|
|
41
|
+
if (typeof str !== "string") {
|
|
42
|
+
throw new TypeError("Expected a string");
|
|
43
|
+
}
|
|
44
|
+
return str.replace(matchOperatorsRe, "\\$&");
|
|
45
|
+
};
|
|
46
|
+
var ansiStyles = { exports: {} };
|
|
47
|
+
var conversions$2 = { exports: {} };
|
|
57
48
|
var colorName = {
|
|
58
49
|
"aliceblue": [240, 248, 255],
|
|
59
50
|
"antiquewhite": [250, 235, 215],
|
|
@@ -204,12 +195,14 @@ var colorName = {
|
|
|
204
195
|
"yellow": [255, 255, 0],
|
|
205
196
|
"yellowgreen": [154, 205, 50]
|
|
206
197
|
};
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
for (
|
|
210
|
-
|
|
198
|
+
var cssKeywords = colorName;
|
|
199
|
+
var reverseKeywords = {};
|
|
200
|
+
for (var key in cssKeywords) {
|
|
201
|
+
if (cssKeywords.hasOwnProperty(key)) {
|
|
202
|
+
reverseKeywords[cssKeywords[key]] = key;
|
|
203
|
+
}
|
|
211
204
|
}
|
|
212
|
-
|
|
205
|
+
var convert$1 = conversions$2.exports = {
|
|
213
206
|
rgb: { channels: 3, labels: "rgb" },
|
|
214
207
|
hsl: { channels: 3, labels: "hsl" },
|
|
215
208
|
hsv: { channels: 3, labels: "hsv" },
|
|
@@ -226,32 +219,35 @@ const convert$1 = {
|
|
|
226
219
|
apple: { channels: 3, labels: ["r16", "g16", "b16"] },
|
|
227
220
|
gray: { channels: 1, labels: ["gray"] }
|
|
228
221
|
};
|
|
229
|
-
var
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
222
|
+
for (var model in convert$1) {
|
|
223
|
+
if (convert$1.hasOwnProperty(model)) {
|
|
224
|
+
if (!("channels" in convert$1[model])) {
|
|
225
|
+
throw new Error("missing channels property: " + model);
|
|
226
|
+
}
|
|
227
|
+
if (!("labels" in convert$1[model])) {
|
|
228
|
+
throw new Error("missing channel labels property: " + model);
|
|
229
|
+
}
|
|
230
|
+
if (convert$1[model].labels.length !== convert$1[model].channels) {
|
|
231
|
+
throw new Error("channel and label counts mismatch: " + model);
|
|
232
|
+
}
|
|
233
|
+
var channels = convert$1[model].channels;
|
|
234
|
+
var labels = convert$1[model].labels;
|
|
235
|
+
delete convert$1[model].channels;
|
|
236
|
+
delete convert$1[model].labels;
|
|
237
|
+
Object.defineProperty(convert$1[model], "channels", { value: channels });
|
|
238
|
+
Object.defineProperty(convert$1[model], "labels", { value: labels });
|
|
239
239
|
}
|
|
240
|
-
const { channels, labels } = convert$1[model];
|
|
241
|
-
delete convert$1[model].channels;
|
|
242
|
-
delete convert$1[model].labels;
|
|
243
|
-
Object.defineProperty(convert$1[model], "channels", { value: channels });
|
|
244
|
-
Object.defineProperty(convert$1[model], "labels", { value: labels });
|
|
245
240
|
}
|
|
246
241
|
convert$1.rgb.hsl = function(rgb) {
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
242
|
+
var r = rgb[0] / 255;
|
|
243
|
+
var g = rgb[1] / 255;
|
|
244
|
+
var b = rgb[2] / 255;
|
|
245
|
+
var min = Math.min(r, g, b);
|
|
246
|
+
var max = Math.max(r, g, b);
|
|
247
|
+
var delta = max - min;
|
|
248
|
+
var h;
|
|
249
|
+
var s;
|
|
250
|
+
var l;
|
|
255
251
|
if (max === min) {
|
|
256
252
|
h = 0;
|
|
257
253
|
} else if (r === max) {
|
|
@@ -265,7 +261,7 @@ convert$1.rgb.hsl = function(rgb) {
|
|
|
265
261
|
if (h < 0) {
|
|
266
262
|
h += 360;
|
|
267
263
|
}
|
|
268
|
-
|
|
264
|
+
l = (min + max) / 2;
|
|
269
265
|
if (max === min) {
|
|
270
266
|
s = 0;
|
|
271
267
|
} else if (l <= 0.5) {
|
|
@@ -276,22 +272,21 @@ convert$1.rgb.hsl = function(rgb) {
|
|
|
276
272
|
return [h, s * 100, l * 100];
|
|
277
273
|
};
|
|
278
274
|
convert$1.rgb.hsv = function(rgb) {
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
275
|
+
var rdif;
|
|
276
|
+
var gdif;
|
|
277
|
+
var bdif;
|
|
278
|
+
var h;
|
|
279
|
+
var s;
|
|
280
|
+
var r = rgb[0] / 255;
|
|
281
|
+
var g = rgb[1] / 255;
|
|
282
|
+
var b = rgb[2] / 255;
|
|
283
|
+
var v = Math.max(r, g, b);
|
|
284
|
+
var diff = v - Math.min(r, g, b);
|
|
285
|
+
var diffc = function(c) {
|
|
290
286
|
return (v - c) / 6 / diff + 1 / 2;
|
|
291
287
|
};
|
|
292
288
|
if (diff === 0) {
|
|
293
|
-
h = 0;
|
|
294
|
-
s = 0;
|
|
289
|
+
h = s = 0;
|
|
295
290
|
} else {
|
|
296
291
|
s = diff / v;
|
|
297
292
|
rdif = diffc(r);
|
|
@@ -317,40 +312,46 @@ convert$1.rgb.hsv = function(rgb) {
|
|
|
317
312
|
];
|
|
318
313
|
};
|
|
319
314
|
convert$1.rgb.hwb = function(rgb) {
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
315
|
+
var r = rgb[0];
|
|
316
|
+
var g = rgb[1];
|
|
317
|
+
var b = rgb[2];
|
|
318
|
+
var h = convert$1.rgb.hsl(rgb)[0];
|
|
319
|
+
var w = 1 / 255 * Math.min(r, Math.min(g, b));
|
|
325
320
|
b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
|
|
326
321
|
return [h, w * 100, b * 100];
|
|
327
322
|
};
|
|
328
323
|
convert$1.rgb.cmyk = function(rgb) {
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
324
|
+
var r = rgb[0] / 255;
|
|
325
|
+
var g = rgb[1] / 255;
|
|
326
|
+
var b = rgb[2] / 255;
|
|
327
|
+
var c;
|
|
328
|
+
var m;
|
|
329
|
+
var y;
|
|
330
|
+
var k;
|
|
331
|
+
k = Math.min(1 - r, 1 - g, 1 - b);
|
|
332
|
+
c = (1 - r - k) / (1 - k) || 0;
|
|
333
|
+
m = (1 - g - k) / (1 - k) || 0;
|
|
334
|
+
y = (1 - b - k) / (1 - k) || 0;
|
|
336
335
|
return [c * 100, m * 100, y * 100, k * 100];
|
|
337
336
|
};
|
|
338
337
|
function comparativeDistance(x, y) {
|
|
339
|
-
return (x[0] - y[0]
|
|
338
|
+
return Math.pow(x[0] - y[0], 2) + Math.pow(x[1] - y[1], 2) + Math.pow(x[2] - y[2], 2);
|
|
340
339
|
}
|
|
341
340
|
convert$1.rgb.keyword = function(rgb) {
|
|
342
|
-
|
|
341
|
+
var reversed = reverseKeywords[rgb];
|
|
343
342
|
if (reversed) {
|
|
344
343
|
return reversed;
|
|
345
344
|
}
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
for (
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
currentClosestDistance
|
|
353
|
-
|
|
345
|
+
var currentClosestDistance = Infinity;
|
|
346
|
+
var currentClosestKeyword;
|
|
347
|
+
for (var keyword in cssKeywords) {
|
|
348
|
+
if (cssKeywords.hasOwnProperty(keyword)) {
|
|
349
|
+
var value = cssKeywords[keyword];
|
|
350
|
+
var distance = comparativeDistance(rgb, value);
|
|
351
|
+
if (distance < currentClosestDistance) {
|
|
352
|
+
currentClosestDistance = distance;
|
|
353
|
+
currentClosestKeyword = keyword;
|
|
354
|
+
}
|
|
354
355
|
}
|
|
355
356
|
}
|
|
356
357
|
return currentClosestKeyword;
|
|
@@ -359,40 +360,45 @@ convert$1.keyword.rgb = function(keyword) {
|
|
|
359
360
|
return cssKeywords[keyword];
|
|
360
361
|
};
|
|
361
362
|
convert$1.rgb.xyz = function(rgb) {
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
r = r > 0.04045 ? ((r + 0.055) / 1.055
|
|
366
|
-
g = g > 0.04045 ? ((g + 0.055) / 1.055
|
|
367
|
-
b = b > 0.04045 ? ((b + 0.055) / 1.055
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
363
|
+
var r = rgb[0] / 255;
|
|
364
|
+
var g = rgb[1] / 255;
|
|
365
|
+
var b = rgb[2] / 255;
|
|
366
|
+
r = r > 0.04045 ? Math.pow((r + 0.055) / 1.055, 2.4) : r / 12.92;
|
|
367
|
+
g = g > 0.04045 ? Math.pow((g + 0.055) / 1.055, 2.4) : g / 12.92;
|
|
368
|
+
b = b > 0.04045 ? Math.pow((b + 0.055) / 1.055, 2.4) : b / 12.92;
|
|
369
|
+
var x = r * 0.4124 + g * 0.3576 + b * 0.1805;
|
|
370
|
+
var y = r * 0.2126 + g * 0.7152 + b * 0.0722;
|
|
371
|
+
var z = r * 0.0193 + g * 0.1192 + b * 0.9505;
|
|
371
372
|
return [x * 100, y * 100, z * 100];
|
|
372
373
|
};
|
|
373
374
|
convert$1.rgb.lab = function(rgb) {
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
375
|
+
var xyz = convert$1.rgb.xyz(rgb);
|
|
376
|
+
var x = xyz[0];
|
|
377
|
+
var y = xyz[1];
|
|
378
|
+
var z = xyz[2];
|
|
379
|
+
var l;
|
|
380
|
+
var a;
|
|
381
|
+
var b;
|
|
378
382
|
x /= 95.047;
|
|
379
383
|
y /= 100;
|
|
380
384
|
z /= 108.883;
|
|
381
|
-
x = x > 8856e-6 ? x
|
|
382
|
-
y = y > 8856e-6 ? y
|
|
383
|
-
z = z > 8856e-6 ? z
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
385
|
+
x = x > 8856e-6 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116;
|
|
386
|
+
y = y > 8856e-6 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116;
|
|
387
|
+
z = z > 8856e-6 ? Math.pow(z, 1 / 3) : 7.787 * z + 16 / 116;
|
|
388
|
+
l = 116 * y - 16;
|
|
389
|
+
a = 500 * (x - y);
|
|
390
|
+
b = 200 * (y - z);
|
|
387
391
|
return [l, a, b];
|
|
388
392
|
};
|
|
389
393
|
convert$1.hsl.rgb = function(hsl) {
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
394
|
+
var h = hsl[0] / 360;
|
|
395
|
+
var s = hsl[1] / 100;
|
|
396
|
+
var l = hsl[2] / 100;
|
|
397
|
+
var t1;
|
|
398
|
+
var t2;
|
|
399
|
+
var t3;
|
|
400
|
+
var rgb;
|
|
401
|
+
var val;
|
|
396
402
|
if (s === 0) {
|
|
397
403
|
val = l * 255;
|
|
398
404
|
return [val, val, val];
|
|
@@ -402,9 +408,9 @@ convert$1.hsl.rgb = function(hsl) {
|
|
|
402
408
|
} else {
|
|
403
409
|
t2 = l + s - l * s;
|
|
404
410
|
}
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
for (
|
|
411
|
+
t1 = 2 * l - t2;
|
|
412
|
+
rgb = [0, 0, 0];
|
|
413
|
+
for (var i = 0; i < 3; i++) {
|
|
408
414
|
t3 = h + 1 / 3 * -(i - 1);
|
|
409
415
|
if (t3 < 0) {
|
|
410
416
|
t3++;
|
|
@@ -426,27 +432,29 @@ convert$1.hsl.rgb = function(hsl) {
|
|
|
426
432
|
return rgb;
|
|
427
433
|
};
|
|
428
434
|
convert$1.hsl.hsv = function(hsl) {
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
435
|
+
var h = hsl[0];
|
|
436
|
+
var s = hsl[1] / 100;
|
|
437
|
+
var l = hsl[2] / 100;
|
|
438
|
+
var smin = s;
|
|
439
|
+
var lmin = Math.max(l, 0.01);
|
|
440
|
+
var sv;
|
|
441
|
+
var v;
|
|
434
442
|
l *= 2;
|
|
435
443
|
s *= l <= 1 ? l : 2 - l;
|
|
436
444
|
smin *= lmin <= 1 ? lmin : 2 - lmin;
|
|
437
|
-
|
|
438
|
-
|
|
445
|
+
v = (l + s) / 2;
|
|
446
|
+
sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s);
|
|
439
447
|
return [h, sv * 100, v * 100];
|
|
440
448
|
};
|
|
441
449
|
convert$1.hsv.rgb = function(hsv) {
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
+
var h = hsv[0] / 60;
|
|
451
|
+
var s = hsv[1] / 100;
|
|
452
|
+
var v = hsv[2] / 100;
|
|
453
|
+
var hi = Math.floor(h) % 6;
|
|
454
|
+
var f = h - Math.floor(h);
|
|
455
|
+
var p = 255 * v * (1 - s);
|
|
456
|
+
var q = 255 * v * (1 - s * f);
|
|
457
|
+
var t = 255 * v * (1 - s * (1 - f));
|
|
450
458
|
v *= 255;
|
|
451
459
|
switch (hi) {
|
|
452
460
|
case 0:
|
|
@@ -464,14 +472,15 @@ convert$1.hsv.rgb = function(hsv) {
|
|
|
464
472
|
}
|
|
465
473
|
};
|
|
466
474
|
convert$1.hsv.hsl = function(hsv) {
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
475
|
+
var h = hsv[0];
|
|
476
|
+
var s = hsv[1] / 100;
|
|
477
|
+
var v = hsv[2] / 100;
|
|
478
|
+
var vmin = Math.max(v, 0.01);
|
|
479
|
+
var lmin;
|
|
480
|
+
var sl;
|
|
481
|
+
var l;
|
|
473
482
|
l = (2 - s) * v;
|
|
474
|
-
|
|
483
|
+
lmin = (2 - s) * vmin;
|
|
475
484
|
sl = s * vmin;
|
|
476
485
|
sl /= lmin <= 1 ? lmin : 2 - lmin;
|
|
477
486
|
sl = sl || 0;
|
|
@@ -479,25 +488,28 @@ convert$1.hsv.hsl = function(hsv) {
|
|
|
479
488
|
return [h, sl * 100, l * 100];
|
|
480
489
|
};
|
|
481
490
|
convert$1.hwb.rgb = function(hwb) {
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
491
|
+
var h = hwb[0] / 360;
|
|
492
|
+
var wh = hwb[1] / 100;
|
|
493
|
+
var bl = hwb[2] / 100;
|
|
494
|
+
var ratio = wh + bl;
|
|
495
|
+
var i;
|
|
496
|
+
var v;
|
|
497
|
+
var f;
|
|
498
|
+
var n;
|
|
487
499
|
if (ratio > 1) {
|
|
488
500
|
wh /= ratio;
|
|
489
501
|
bl /= ratio;
|
|
490
502
|
}
|
|
491
|
-
|
|
492
|
-
|
|
503
|
+
i = Math.floor(6 * h);
|
|
504
|
+
v = 1 - bl;
|
|
493
505
|
f = 6 * h - i;
|
|
494
506
|
if ((i & 1) !== 0) {
|
|
495
507
|
f = 1 - f;
|
|
496
508
|
}
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
509
|
+
n = wh + f * (v - wh);
|
|
510
|
+
var r;
|
|
511
|
+
var g;
|
|
512
|
+
var b;
|
|
501
513
|
switch (i) {
|
|
502
514
|
default:
|
|
503
515
|
case 6:
|
|
@@ -535,61 +547,67 @@ convert$1.hwb.rgb = function(hwb) {
|
|
|
535
547
|
return [r * 255, g * 255, b * 255];
|
|
536
548
|
};
|
|
537
549
|
convert$1.cmyk.rgb = function(cmyk) {
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
550
|
+
var c = cmyk[0] / 100;
|
|
551
|
+
var m = cmyk[1] / 100;
|
|
552
|
+
var y = cmyk[2] / 100;
|
|
553
|
+
var k = cmyk[3] / 100;
|
|
554
|
+
var r;
|
|
555
|
+
var g;
|
|
556
|
+
var b;
|
|
557
|
+
r = 1 - Math.min(1, c * (1 - k) + k);
|
|
558
|
+
g = 1 - Math.min(1, m * (1 - k) + k);
|
|
559
|
+
b = 1 - Math.min(1, y * (1 - k) + k);
|
|
545
560
|
return [r * 255, g * 255, b * 255];
|
|
546
561
|
};
|
|
547
562
|
convert$1.xyz.rgb = function(xyz) {
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
563
|
+
var x = xyz[0] / 100;
|
|
564
|
+
var y = xyz[1] / 100;
|
|
565
|
+
var z = xyz[2] / 100;
|
|
566
|
+
var r;
|
|
567
|
+
var g;
|
|
568
|
+
var b;
|
|
554
569
|
r = x * 3.2406 + y * -1.5372 + z * -0.4986;
|
|
555
570
|
g = x * -0.9689 + y * 1.8758 + z * 0.0415;
|
|
556
571
|
b = x * 0.0557 + y * -0.204 + z * 1.057;
|
|
557
|
-
r = r > 31308e-7 ? 1.055 * r
|
|
558
|
-
g = g > 31308e-7 ? 1.055 * g
|
|
559
|
-
b = b > 31308e-7 ? 1.055 * b
|
|
572
|
+
r = r > 31308e-7 ? 1.055 * Math.pow(r, 1 / 2.4) - 0.055 : r * 12.92;
|
|
573
|
+
g = g > 31308e-7 ? 1.055 * Math.pow(g, 1 / 2.4) - 0.055 : g * 12.92;
|
|
574
|
+
b = b > 31308e-7 ? 1.055 * Math.pow(b, 1 / 2.4) - 0.055 : b * 12.92;
|
|
560
575
|
r = Math.min(Math.max(0, r), 1);
|
|
561
576
|
g = Math.min(Math.max(0, g), 1);
|
|
562
577
|
b = Math.min(Math.max(0, b), 1);
|
|
563
578
|
return [r * 255, g * 255, b * 255];
|
|
564
579
|
};
|
|
565
580
|
convert$1.xyz.lab = function(xyz) {
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
581
|
+
var x = xyz[0];
|
|
582
|
+
var y = xyz[1];
|
|
583
|
+
var z = xyz[2];
|
|
584
|
+
var l;
|
|
585
|
+
var a;
|
|
586
|
+
var b;
|
|
569
587
|
x /= 95.047;
|
|
570
588
|
y /= 100;
|
|
571
589
|
z /= 108.883;
|
|
572
|
-
x = x > 8856e-6 ? x
|
|
573
|
-
y = y > 8856e-6 ? y
|
|
574
|
-
z = z > 8856e-6 ? z
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
590
|
+
x = x > 8856e-6 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116;
|
|
591
|
+
y = y > 8856e-6 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116;
|
|
592
|
+
z = z > 8856e-6 ? Math.pow(z, 1 / 3) : 7.787 * z + 16 / 116;
|
|
593
|
+
l = 116 * y - 16;
|
|
594
|
+
a = 500 * (x - y);
|
|
595
|
+
b = 200 * (y - z);
|
|
578
596
|
return [l, a, b];
|
|
579
597
|
};
|
|
580
598
|
convert$1.lab.xyz = function(lab) {
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
599
|
+
var l = lab[0];
|
|
600
|
+
var a = lab[1];
|
|
601
|
+
var b = lab[2];
|
|
602
|
+
var x;
|
|
603
|
+
var y;
|
|
604
|
+
var z;
|
|
587
605
|
y = (l + 16) / 116;
|
|
588
606
|
x = a / 500 + y;
|
|
589
607
|
z = y - b / 200;
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
608
|
+
var y2 = Math.pow(y, 3);
|
|
609
|
+
var x2 = Math.pow(x, 3);
|
|
610
|
+
var z2 = Math.pow(z, 3);
|
|
593
611
|
y = y2 > 8856e-6 ? y2 : (y - 16 / 116) / 7.787;
|
|
594
612
|
x = x2 > 8856e-6 ? x2 : (x - 16 / 116) / 7.787;
|
|
595
613
|
z = z2 > 8856e-6 ? z2 : (z - 16 / 116) / 7.787;
|
|
@@ -599,35 +617,42 @@ convert$1.lab.xyz = function(lab) {
|
|
|
599
617
|
return [x, y, z];
|
|
600
618
|
};
|
|
601
619
|
convert$1.lab.lch = function(lab) {
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
620
|
+
var l = lab[0];
|
|
621
|
+
var a = lab[1];
|
|
622
|
+
var b = lab[2];
|
|
623
|
+
var hr;
|
|
624
|
+
var h;
|
|
625
|
+
var c;
|
|
626
|
+
hr = Math.atan2(b, a);
|
|
607
627
|
h = hr * 360 / 2 / Math.PI;
|
|
608
628
|
if (h < 0) {
|
|
609
629
|
h += 360;
|
|
610
630
|
}
|
|
611
|
-
|
|
631
|
+
c = Math.sqrt(a * a + b * b);
|
|
612
632
|
return [l, c, h];
|
|
613
633
|
};
|
|
614
634
|
convert$1.lch.lab = function(lch) {
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
635
|
+
var l = lch[0];
|
|
636
|
+
var c = lch[1];
|
|
637
|
+
var h = lch[2];
|
|
638
|
+
var a;
|
|
639
|
+
var b;
|
|
640
|
+
var hr;
|
|
641
|
+
hr = h / 360 * 2 * Math.PI;
|
|
642
|
+
a = c * Math.cos(hr);
|
|
643
|
+
b = c * Math.sin(hr);
|
|
621
644
|
return [l, a, b];
|
|
622
645
|
};
|
|
623
|
-
convert$1.rgb.ansi16 = function(args
|
|
624
|
-
|
|
625
|
-
|
|
646
|
+
convert$1.rgb.ansi16 = function(args) {
|
|
647
|
+
var r = args[0];
|
|
648
|
+
var g = args[1];
|
|
649
|
+
var b = args[2];
|
|
650
|
+
var value = 1 in arguments ? arguments[1] : convert$1.rgb.hsv(args)[2];
|
|
626
651
|
value = Math.round(value / 50);
|
|
627
652
|
if (value === 0) {
|
|
628
653
|
return 30;
|
|
629
654
|
}
|
|
630
|
-
|
|
655
|
+
var ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r / 255));
|
|
631
656
|
if (value === 2) {
|
|
632
657
|
ansi += 60;
|
|
633
658
|
}
|
|
@@ -637,9 +662,9 @@ convert$1.hsv.ansi16 = function(args) {
|
|
|
637
662
|
return convert$1.rgb.ansi16(convert$1.hsv.rgb(args), args[2]);
|
|
638
663
|
};
|
|
639
664
|
convert$1.rgb.ansi256 = function(args) {
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
665
|
+
var r = args[0];
|
|
666
|
+
var g = args[1];
|
|
667
|
+
var b = args[2];
|
|
643
668
|
if (r === g && g === b) {
|
|
644
669
|
if (r < 8) {
|
|
645
670
|
return 16;
|
|
@@ -649,11 +674,11 @@ convert$1.rgb.ansi256 = function(args) {
|
|
|
649
674
|
}
|
|
650
675
|
return Math.round((r - 8) / 247 * 24) + 232;
|
|
651
676
|
}
|
|
652
|
-
|
|
677
|
+
var ansi = 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5);
|
|
653
678
|
return ansi;
|
|
654
679
|
};
|
|
655
680
|
convert$1.ansi16.rgb = function(args) {
|
|
656
|
-
|
|
681
|
+
var color = args % 10;
|
|
657
682
|
if (color === 0 || color === 7) {
|
|
658
683
|
if (args > 50) {
|
|
659
684
|
color += 3.5;
|
|
@@ -661,55 +686,55 @@ convert$1.ansi16.rgb = function(args) {
|
|
|
661
686
|
color = color / 10.5 * 255;
|
|
662
687
|
return [color, color, color];
|
|
663
688
|
}
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
689
|
+
var mult = (~~(args > 50) + 1) * 0.5;
|
|
690
|
+
var r = (color & 1) * mult * 255;
|
|
691
|
+
var g = (color >> 1 & 1) * mult * 255;
|
|
692
|
+
var b = (color >> 2 & 1) * mult * 255;
|
|
668
693
|
return [r, g, b];
|
|
669
694
|
};
|
|
670
695
|
convert$1.ansi256.rgb = function(args) {
|
|
671
696
|
if (args >= 232) {
|
|
672
|
-
|
|
697
|
+
var c = (args - 232) * 10 + 8;
|
|
673
698
|
return [c, c, c];
|
|
674
699
|
}
|
|
675
700
|
args -= 16;
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
701
|
+
var rem;
|
|
702
|
+
var r = Math.floor(args / 36) / 5 * 255;
|
|
703
|
+
var g = Math.floor((rem = args % 36) / 6) / 5 * 255;
|
|
704
|
+
var b = rem % 6 / 5 * 255;
|
|
680
705
|
return [r, g, b];
|
|
681
706
|
};
|
|
682
707
|
convert$1.rgb.hex = function(args) {
|
|
683
|
-
|
|
684
|
-
|
|
708
|
+
var integer = ((Math.round(args[0]) & 255) << 16) + ((Math.round(args[1]) & 255) << 8) + (Math.round(args[2]) & 255);
|
|
709
|
+
var string = integer.toString(16).toUpperCase();
|
|
685
710
|
return "000000".substring(string.length) + string;
|
|
686
711
|
};
|
|
687
712
|
convert$1.hex.rgb = function(args) {
|
|
688
|
-
|
|
713
|
+
var match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
|
|
689
714
|
if (!match) {
|
|
690
715
|
return [0, 0, 0];
|
|
691
716
|
}
|
|
692
|
-
|
|
717
|
+
var colorString = match[0];
|
|
693
718
|
if (match[0].length === 3) {
|
|
694
|
-
colorString = colorString.split("").map((char)
|
|
719
|
+
colorString = colorString.split("").map(function(char) {
|
|
695
720
|
return char + char;
|
|
696
721
|
}).join("");
|
|
697
722
|
}
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
723
|
+
var integer = parseInt(colorString, 16);
|
|
724
|
+
var r = integer >> 16 & 255;
|
|
725
|
+
var g = integer >> 8 & 255;
|
|
726
|
+
var b = integer & 255;
|
|
702
727
|
return [r, g, b];
|
|
703
728
|
};
|
|
704
729
|
convert$1.rgb.hcg = function(rgb) {
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
730
|
+
var r = rgb[0] / 255;
|
|
731
|
+
var g = rgb[1] / 255;
|
|
732
|
+
var b = rgb[2] / 255;
|
|
733
|
+
var max = Math.max(Math.max(r, g), b);
|
|
734
|
+
var min = Math.min(Math.min(r, g), b);
|
|
735
|
+
var chroma = max - min;
|
|
736
|
+
var grayscale;
|
|
737
|
+
var hue;
|
|
713
738
|
if (chroma < 1) {
|
|
714
739
|
grayscale = min / (1 - chroma);
|
|
715
740
|
} else {
|
|
@@ -722,44 +747,49 @@ convert$1.rgb.hcg = function(rgb) {
|
|
|
722
747
|
} else if (max === g) {
|
|
723
748
|
hue = 2 + (b - r) / chroma;
|
|
724
749
|
} else {
|
|
725
|
-
hue = 4 + (r - g) / chroma;
|
|
750
|
+
hue = 4 + (r - g) / chroma + 4;
|
|
726
751
|
}
|
|
727
752
|
hue /= 6;
|
|
728
753
|
hue %= 1;
|
|
729
754
|
return [hue * 360, chroma * 100, grayscale * 100];
|
|
730
755
|
};
|
|
731
756
|
convert$1.hsl.hcg = function(hsl) {
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
757
|
+
var s = hsl[1] / 100;
|
|
758
|
+
var l = hsl[2] / 100;
|
|
759
|
+
var c = 1;
|
|
760
|
+
var f = 0;
|
|
761
|
+
if (l < 0.5) {
|
|
762
|
+
c = 2 * s * l;
|
|
763
|
+
} else {
|
|
764
|
+
c = 2 * s * (1 - l);
|
|
765
|
+
}
|
|
736
766
|
if (c < 1) {
|
|
737
767
|
f = (l - 0.5 * c) / (1 - c);
|
|
738
768
|
}
|
|
739
769
|
return [hsl[0], c * 100, f * 100];
|
|
740
770
|
};
|
|
741
771
|
convert$1.hsv.hcg = function(hsv) {
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
772
|
+
var s = hsv[1] / 100;
|
|
773
|
+
var v = hsv[2] / 100;
|
|
774
|
+
var c = s * v;
|
|
775
|
+
var f = 0;
|
|
746
776
|
if (c < 1) {
|
|
747
777
|
f = (v - c) / (1 - c);
|
|
748
778
|
}
|
|
749
779
|
return [hsv[0], c * 100, f * 100];
|
|
750
780
|
};
|
|
751
781
|
convert$1.hcg.rgb = function(hcg) {
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
782
|
+
var h = hcg[0] / 360;
|
|
783
|
+
var c = hcg[1] / 100;
|
|
784
|
+
var g = hcg[2] / 100;
|
|
755
785
|
if (c === 0) {
|
|
756
786
|
return [g * 255, g * 255, g * 255];
|
|
757
787
|
}
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
788
|
+
var pure = [0, 0, 0];
|
|
789
|
+
var hi = h % 1 * 6;
|
|
790
|
+
var v = hi % 1;
|
|
791
|
+
var w = 1 - v;
|
|
792
|
+
var mg = 0;
|
|
763
793
|
switch (Math.floor(hi)) {
|
|
764
794
|
case 0:
|
|
765
795
|
pure[0] = 1;
|
|
@@ -799,20 +829,20 @@ convert$1.hcg.rgb = function(hcg) {
|
|
|
799
829
|
];
|
|
800
830
|
};
|
|
801
831
|
convert$1.hcg.hsv = function(hcg) {
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
832
|
+
var c = hcg[1] / 100;
|
|
833
|
+
var g = hcg[2] / 100;
|
|
834
|
+
var v = c + g * (1 - c);
|
|
835
|
+
var f = 0;
|
|
806
836
|
if (v > 0) {
|
|
807
837
|
f = c / v;
|
|
808
838
|
}
|
|
809
839
|
return [hcg[0], f * 100, v * 100];
|
|
810
840
|
};
|
|
811
841
|
convert$1.hcg.hsl = function(hcg) {
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
842
|
+
var c = hcg[1] / 100;
|
|
843
|
+
var g = hcg[2] / 100;
|
|
844
|
+
var l = g * (1 - c) + 0.5 * c;
|
|
845
|
+
var s = 0;
|
|
816
846
|
if (l > 0 && l < 0.5) {
|
|
817
847
|
s = c / (2 * l);
|
|
818
848
|
} else if (l >= 0.5 && l < 1) {
|
|
@@ -821,17 +851,17 @@ convert$1.hcg.hsl = function(hcg) {
|
|
|
821
851
|
return [hcg[0], s * 100, l * 100];
|
|
822
852
|
};
|
|
823
853
|
convert$1.hcg.hwb = function(hcg) {
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
854
|
+
var c = hcg[1] / 100;
|
|
855
|
+
var g = hcg[2] / 100;
|
|
856
|
+
var v = c + g * (1 - c);
|
|
827
857
|
return [hcg[0], (v - c) * 100, (1 - v) * 100];
|
|
828
858
|
};
|
|
829
859
|
convert$1.hwb.hcg = function(hwb) {
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
860
|
+
var w = hwb[1] / 100;
|
|
861
|
+
var b = hwb[2] / 100;
|
|
862
|
+
var v = 1 - b;
|
|
863
|
+
var c = v - w;
|
|
864
|
+
var g = 0;
|
|
835
865
|
if (c < 1) {
|
|
836
866
|
g = (v - c) / (1 - c);
|
|
837
867
|
}
|
|
@@ -846,10 +876,9 @@ convert$1.rgb.apple = function(rgb) {
|
|
|
846
876
|
convert$1.gray.rgb = function(args) {
|
|
847
877
|
return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
|
|
848
878
|
};
|
|
849
|
-
convert$1.gray.hsl = function(args) {
|
|
879
|
+
convert$1.gray.hsl = convert$1.gray.hsv = function(args) {
|
|
850
880
|
return [0, 0, args[0]];
|
|
851
881
|
};
|
|
852
|
-
convert$1.gray.hsv = convert$1.gray.hsl;
|
|
853
882
|
convert$1.gray.hwb = function(gray) {
|
|
854
883
|
return [0, 100, gray[0]];
|
|
855
884
|
};
|
|
@@ -860,20 +889,20 @@ convert$1.gray.lab = function(gray) {
|
|
|
860
889
|
return [gray[0], 0, 0];
|
|
861
890
|
};
|
|
862
891
|
convert$1.gray.hex = function(gray) {
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
892
|
+
var val = Math.round(gray[0] / 100 * 255) & 255;
|
|
893
|
+
var integer = (val << 16) + (val << 8) + val;
|
|
894
|
+
var string = integer.toString(16).toUpperCase();
|
|
866
895
|
return "000000".substring(string.length) + string;
|
|
867
896
|
};
|
|
868
897
|
convert$1.rgb.gray = function(rgb) {
|
|
869
|
-
|
|
898
|
+
var val = (rgb[0] + rgb[1] + rgb[2]) / 3;
|
|
870
899
|
return [val / 255 * 100];
|
|
871
900
|
};
|
|
872
|
-
|
|
901
|
+
var conversions$1 = conversions$2.exports;
|
|
873
902
|
function buildGraph() {
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
for (
|
|
903
|
+
var graph = {};
|
|
904
|
+
var models2 = Object.keys(conversions$1);
|
|
905
|
+
for (var len = models2.length, i = 0; i < len; i++) {
|
|
877
906
|
graph[models2[i]] = {
|
|
878
907
|
distance: -1,
|
|
879
908
|
parent: null
|
|
@@ -882,15 +911,15 @@ function buildGraph() {
|
|
|
882
911
|
return graph;
|
|
883
912
|
}
|
|
884
913
|
function deriveBFS(fromModel) {
|
|
885
|
-
|
|
886
|
-
|
|
914
|
+
var graph = buildGraph();
|
|
915
|
+
var queue = [fromModel];
|
|
887
916
|
graph[fromModel].distance = 0;
|
|
888
917
|
while (queue.length) {
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
for (
|
|
892
|
-
|
|
893
|
-
|
|
918
|
+
var current = queue.pop();
|
|
919
|
+
var adjacents = Object.keys(conversions$1[current]);
|
|
920
|
+
for (var len = adjacents.length, i = 0; i < len; i++) {
|
|
921
|
+
var adjacent = adjacents[i];
|
|
922
|
+
var node = graph[adjacent];
|
|
894
923
|
if (node.distance === -1) {
|
|
895
924
|
node.distance = graph[current].distance + 1;
|
|
896
925
|
node.parent = current;
|
|
@@ -906,9 +935,9 @@ function link(from, to) {
|
|
|
906
935
|
};
|
|
907
936
|
}
|
|
908
937
|
function wrapConversion(toModel, graph) {
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
938
|
+
var path = [graph[toModel].parent, toModel];
|
|
939
|
+
var fn = conversions$1[graph[toModel].parent][toModel];
|
|
940
|
+
var cur = graph[toModel].parent;
|
|
912
941
|
while (graph[cur].parent) {
|
|
913
942
|
path.unshift(graph[cur].parent);
|
|
914
943
|
fn = link(conversions$1[graph[cur].parent][cur], fn);
|
|
@@ -918,12 +947,12 @@ function wrapConversion(toModel, graph) {
|
|
|
918
947
|
return fn;
|
|
919
948
|
}
|
|
920
949
|
var route$1 = function(fromModel) {
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
for (
|
|
925
|
-
|
|
926
|
-
|
|
950
|
+
var graph = deriveBFS(fromModel);
|
|
951
|
+
var conversion = {};
|
|
952
|
+
var models2 = Object.keys(graph);
|
|
953
|
+
for (var len = models2.length, i = 0; i < len; i++) {
|
|
954
|
+
var toModel = models2[i];
|
|
955
|
+
var node = graph[toModel];
|
|
927
956
|
if (node.parent === null) {
|
|
928
957
|
continue;
|
|
929
958
|
}
|
|
@@ -931,18 +960,17 @@ var route$1 = function(fromModel) {
|
|
|
931
960
|
}
|
|
932
961
|
return conversion;
|
|
933
962
|
};
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
963
|
+
var conversions = conversions$2.exports;
|
|
964
|
+
var route = route$1;
|
|
965
|
+
var convert = {};
|
|
966
|
+
var models = Object.keys(conversions);
|
|
938
967
|
function wrapRaw(fn) {
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
return arg0;
|
|
968
|
+
var wrappedFn = function(args) {
|
|
969
|
+
if (args === void 0 || args === null) {
|
|
970
|
+
return args;
|
|
943
971
|
}
|
|
944
|
-
if (
|
|
945
|
-
args =
|
|
972
|
+
if (arguments.length > 1) {
|
|
973
|
+
args = Array.prototype.slice.call(arguments);
|
|
946
974
|
}
|
|
947
975
|
return fn(args);
|
|
948
976
|
};
|
|
@@ -952,17 +980,16 @@ function wrapRaw(fn) {
|
|
|
952
980
|
return wrappedFn;
|
|
953
981
|
}
|
|
954
982
|
function wrapRounded(fn) {
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
return arg0;
|
|
983
|
+
var wrappedFn = function(args) {
|
|
984
|
+
if (args === void 0 || args === null) {
|
|
985
|
+
return args;
|
|
959
986
|
}
|
|
960
|
-
if (
|
|
961
|
-
args =
|
|
987
|
+
if (arguments.length > 1) {
|
|
988
|
+
args = Array.prototype.slice.call(arguments);
|
|
962
989
|
}
|
|
963
|
-
|
|
990
|
+
var result = fn(args);
|
|
964
991
|
if (typeof result === "object") {
|
|
965
|
-
for (
|
|
992
|
+
for (var len = result.length, i = 0; i < len; i++) {
|
|
966
993
|
result[i] = Math.round(result[i]);
|
|
967
994
|
}
|
|
968
995
|
}
|
|
@@ -973,69 +1000,36 @@ function wrapRounded(fn) {
|
|
|
973
1000
|
}
|
|
974
1001
|
return wrappedFn;
|
|
975
1002
|
}
|
|
976
|
-
models.forEach((fromModel)
|
|
1003
|
+
models.forEach(function(fromModel) {
|
|
977
1004
|
convert[fromModel] = {};
|
|
978
1005
|
Object.defineProperty(convert[fromModel], "channels", { value: conversions[fromModel].channels });
|
|
979
1006
|
Object.defineProperty(convert[fromModel], "labels", { value: conversions[fromModel].labels });
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
routeModels.forEach((toModel)
|
|
983
|
-
|
|
1007
|
+
var routes = route(fromModel);
|
|
1008
|
+
var routeModels = Object.keys(routes);
|
|
1009
|
+
routeModels.forEach(function(toModel) {
|
|
1010
|
+
var fn = routes[toModel];
|
|
984
1011
|
convert[fromModel][toModel] = wrapRounded(fn);
|
|
985
1012
|
convert[fromModel][toModel].raw = wrapRaw(fn);
|
|
986
1013
|
});
|
|
987
1014
|
});
|
|
988
1015
|
var colorConvert = convert;
|
|
989
1016
|
(function(module) {
|
|
990
|
-
const
|
|
991
|
-
|
|
1017
|
+
const colorConvert$1 = colorConvert;
|
|
1018
|
+
const wrapAnsi16 = (fn, offset) => function() {
|
|
1019
|
+
const code = fn.apply(colorConvert$1, arguments);
|
|
992
1020
|
return `\x1B[${code + offset}m`;
|
|
993
1021
|
};
|
|
994
|
-
const wrapAnsi256 = (fn, offset) => (
|
|
995
|
-
const code = fn(
|
|
1022
|
+
const wrapAnsi256 = (fn, offset) => function() {
|
|
1023
|
+
const code = fn.apply(colorConvert$1, arguments);
|
|
996
1024
|
return `\x1B[${38 + offset};5;${code}m`;
|
|
997
1025
|
};
|
|
998
|
-
const wrapAnsi16m = (fn, offset) => (
|
|
999
|
-
const rgb = fn(
|
|
1026
|
+
const wrapAnsi16m = (fn, offset) => function() {
|
|
1027
|
+
const rgb = fn.apply(colorConvert$1, arguments);
|
|
1000
1028
|
return `\x1B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
|
|
1001
1029
|
};
|
|
1002
|
-
const ansi2ansi = (n) => n;
|
|
1003
|
-
const rgb2rgb = (r, g, b) => [r, g, b];
|
|
1004
|
-
const setLazyProperty = (object, property, get) => {
|
|
1005
|
-
Object.defineProperty(object, property, {
|
|
1006
|
-
get: () => {
|
|
1007
|
-
const value = get();
|
|
1008
|
-
Object.defineProperty(object, property, {
|
|
1009
|
-
value,
|
|
1010
|
-
enumerable: true,
|
|
1011
|
-
configurable: true
|
|
1012
|
-
});
|
|
1013
|
-
return value;
|
|
1014
|
-
},
|
|
1015
|
-
enumerable: true,
|
|
1016
|
-
configurable: true
|
|
1017
|
-
});
|
|
1018
|
-
};
|
|
1019
|
-
let colorConvert$1;
|
|
1020
|
-
const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
|
|
1021
|
-
if (colorConvert$1 === void 0) {
|
|
1022
|
-
colorConvert$1 = colorConvert;
|
|
1023
|
-
}
|
|
1024
|
-
const offset = isBackground ? 10 : 0;
|
|
1025
|
-
const styles2 = {};
|
|
1026
|
-
for (const [sourceSpace, suite] of Object.entries(colorConvert$1)) {
|
|
1027
|
-
const name = sourceSpace === "ansi16" ? "ansi" : sourceSpace;
|
|
1028
|
-
if (sourceSpace === targetSpace) {
|
|
1029
|
-
styles2[name] = wrap(identity, offset);
|
|
1030
|
-
} else if (typeof suite === "object") {
|
|
1031
|
-
styles2[name] = wrap(suite[targetSpace], offset);
|
|
1032
|
-
}
|
|
1033
|
-
}
|
|
1034
|
-
return styles2;
|
|
1035
|
-
};
|
|
1036
1030
|
function assembleStyles() {
|
|
1037
1031
|
const codes = /* @__PURE__ */ new Map();
|
|
1038
|
-
const
|
|
1032
|
+
const styles = {
|
|
1039
1033
|
modifier: {
|
|
1040
1034
|
reset: [0, 0],
|
|
1041
1035
|
bold: [1, 22],
|
|
@@ -1055,7 +1049,7 @@ var colorConvert = convert;
|
|
|
1055
1049
|
magenta: [35, 39],
|
|
1056
1050
|
cyan: [36, 39],
|
|
1057
1051
|
white: [37, 39],
|
|
1058
|
-
|
|
1052
|
+
gray: [90, 39],
|
|
1059
1053
|
redBright: [91, 39],
|
|
1060
1054
|
greenBright: [92, 39],
|
|
1061
1055
|
yellowBright: [93, 39],
|
|
@@ -1083,83 +1077,85 @@ var colorConvert = convert;
|
|
|
1083
1077
|
bgWhiteBright: [107, 49]
|
|
1084
1078
|
}
|
|
1085
1079
|
};
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
styles2[styleName] = {
|
|
1080
|
+
styles.color.grey = styles.color.gray;
|
|
1081
|
+
for (const groupName of Object.keys(styles)) {
|
|
1082
|
+
const group = styles[groupName];
|
|
1083
|
+
for (const styleName of Object.keys(group)) {
|
|
1084
|
+
const style = group[styleName];
|
|
1085
|
+
styles[styleName] = {
|
|
1093
1086
|
open: `\x1B[${style[0]}m`,
|
|
1094
1087
|
close: `\x1B[${style[1]}m`
|
|
1095
1088
|
};
|
|
1096
|
-
group[styleName] =
|
|
1089
|
+
group[styleName] = styles[styleName];
|
|
1097
1090
|
codes.set(style[0], style[1]);
|
|
1098
1091
|
}
|
|
1099
|
-
Object.defineProperty(
|
|
1092
|
+
Object.defineProperty(styles, groupName, {
|
|
1100
1093
|
value: group,
|
|
1101
1094
|
enumerable: false
|
|
1102
1095
|
});
|
|
1096
|
+
Object.defineProperty(styles, "codes", {
|
|
1097
|
+
value: codes,
|
|
1098
|
+
enumerable: false
|
|
1099
|
+
});
|
|
1103
1100
|
}
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1101
|
+
const ansi2ansi = (n) => n;
|
|
1102
|
+
const rgb2rgb = (r, g, b) => [r, g, b];
|
|
1103
|
+
styles.color.close = "\x1B[39m";
|
|
1104
|
+
styles.bgColor.close = "\x1B[49m";
|
|
1105
|
+
styles.color.ansi = {
|
|
1106
|
+
ansi: wrapAnsi16(ansi2ansi, 0)
|
|
1107
|
+
};
|
|
1108
|
+
styles.color.ansi256 = {
|
|
1109
|
+
ansi256: wrapAnsi256(ansi2ansi, 0)
|
|
1110
|
+
};
|
|
1111
|
+
styles.color.ansi16m = {
|
|
1112
|
+
rgb: wrapAnsi16m(rgb2rgb, 0)
|
|
1113
|
+
};
|
|
1114
|
+
styles.bgColor.ansi = {
|
|
1115
|
+
ansi: wrapAnsi16(ansi2ansi, 10)
|
|
1116
|
+
};
|
|
1117
|
+
styles.bgColor.ansi256 = {
|
|
1118
|
+
ansi256: wrapAnsi256(ansi2ansi, 10)
|
|
1119
|
+
};
|
|
1120
|
+
styles.bgColor.ansi16m = {
|
|
1121
|
+
rgb: wrapAnsi16m(rgb2rgb, 10)
|
|
1122
|
+
};
|
|
1123
|
+
for (let key of Object.keys(colorConvert$1)) {
|
|
1124
|
+
if (typeof colorConvert$1[key] !== "object") {
|
|
1125
|
+
continue;
|
|
1126
|
+
}
|
|
1127
|
+
const suite = colorConvert$1[key];
|
|
1128
|
+
if (key === "ansi16") {
|
|
1129
|
+
key = "ansi";
|
|
1130
|
+
}
|
|
1131
|
+
if ("ansi16" in suite) {
|
|
1132
|
+
styles.color.ansi[key] = wrapAnsi16(suite.ansi16, 0);
|
|
1133
|
+
styles.bgColor.ansi[key] = wrapAnsi16(suite.ansi16, 10);
|
|
1134
|
+
}
|
|
1135
|
+
if ("ansi256" in suite) {
|
|
1136
|
+
styles.color.ansi256[key] = wrapAnsi256(suite.ansi256, 0);
|
|
1137
|
+
styles.bgColor.ansi256[key] = wrapAnsi256(suite.ansi256, 10);
|
|
1138
|
+
}
|
|
1139
|
+
if ("rgb" in suite) {
|
|
1140
|
+
styles.color.ansi16m[key] = wrapAnsi16m(suite.rgb, 0);
|
|
1141
|
+
styles.bgColor.ansi16m[key] = wrapAnsi16m(suite.rgb, 10);
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1144
|
+
return styles;
|
|
1117
1145
|
}
|
|
1118
1146
|
Object.defineProperty(module, "exports", {
|
|
1119
1147
|
enumerable: true,
|
|
1120
1148
|
get: assembleStyles
|
|
1121
1149
|
});
|
|
1122
|
-
})(ansiStyles
|
|
1150
|
+
})(ansiStyles);
|
|
1123
1151
|
var browser = {
|
|
1124
1152
|
stdout: false,
|
|
1125
1153
|
stderr: false
|
|
1126
1154
|
};
|
|
1127
|
-
const
|
|
1128
|
-
let index = string.indexOf(substring);
|
|
1129
|
-
if (index === -1) {
|
|
1130
|
-
return string;
|
|
1131
|
-
}
|
|
1132
|
-
const substringLength = substring.length;
|
|
1133
|
-
let endIndex = 0;
|
|
1134
|
-
let returnValue = "";
|
|
1135
|
-
do {
|
|
1136
|
-
returnValue += string.substr(endIndex, index - endIndex) + substring + replacer;
|
|
1137
|
-
endIndex = index + substringLength;
|
|
1138
|
-
index = string.indexOf(substring, endIndex);
|
|
1139
|
-
} while (index !== -1);
|
|
1140
|
-
returnValue += string.substr(endIndex);
|
|
1141
|
-
return returnValue;
|
|
1142
|
-
};
|
|
1143
|
-
const stringEncaseCRLFWithFirstIndex$1 = (string, prefix, postfix, index) => {
|
|
1144
|
-
let endIndex = 0;
|
|
1145
|
-
let returnValue = "";
|
|
1146
|
-
do {
|
|
1147
|
-
const gotCR = string[index - 1] === "\r";
|
|
1148
|
-
returnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
|
|
1149
|
-
endIndex = index + 1;
|
|
1150
|
-
index = string.indexOf("\n", endIndex);
|
|
1151
|
-
} while (index !== -1);
|
|
1152
|
-
returnValue += string.substr(endIndex);
|
|
1153
|
-
return returnValue;
|
|
1154
|
-
};
|
|
1155
|
-
var util = {
|
|
1156
|
-
stringReplaceAll: stringReplaceAll$1,
|
|
1157
|
-
stringEncaseCRLFWithFirstIndex: stringEncaseCRLFWithFirstIndex$1
|
|
1158
|
-
};
|
|
1159
|
-
const 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;
|
|
1155
|
+
const TEMPLATE_REGEX = /(?:\\(u[a-f\d]{4}|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
|
|
1160
1156
|
const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
|
|
1161
1157
|
const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
|
|
1162
|
-
const ESCAPE_REGEX = /\\(u
|
|
1158
|
+
const ESCAPE_REGEX = /\\(u[a-f\d]{4}|x[a-f\d]{2}|.)|([^\\])/gi;
|
|
1163
1159
|
const ESCAPES = /* @__PURE__ */ new Map([
|
|
1164
1160
|
["n", "\n"],
|
|
1165
1161
|
["r", "\r"],
|
|
@@ -1172,27 +1168,21 @@ const ESCAPES = /* @__PURE__ */ new Map([
|
|
|
1172
1168
|
["e", "\x1B"],
|
|
1173
1169
|
["a", "\x07"]
|
|
1174
1170
|
]);
|
|
1175
|
-
function unescape
|
|
1176
|
-
|
|
1177
|
-
const bracket = c[1] === "{";
|
|
1178
|
-
if (u && !bracket && c.length === 5 || c[0] === "x" && c.length === 3) {
|
|
1171
|
+
function unescape(c) {
|
|
1172
|
+
if (c[0] === "u" && c.length === 5 || c[0] === "x" && c.length === 3) {
|
|
1179
1173
|
return String.fromCharCode(parseInt(c.slice(1), 16));
|
|
1180
1174
|
}
|
|
1181
|
-
if (u && bracket) {
|
|
1182
|
-
return String.fromCodePoint(parseInt(c.slice(2, -1), 16));
|
|
1183
|
-
}
|
|
1184
1175
|
return ESCAPES.get(c) || c;
|
|
1185
1176
|
}
|
|
1186
|
-
function parseArguments(name,
|
|
1177
|
+
function parseArguments(name, args) {
|
|
1187
1178
|
const results = [];
|
|
1188
|
-
const chunks =
|
|
1179
|
+
const chunks = args.trim().split(/\s*,\s*/g);
|
|
1189
1180
|
let matches;
|
|
1190
1181
|
for (const chunk of chunks) {
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
results.push(number);
|
|
1182
|
+
if (!isNaN(chunk)) {
|
|
1183
|
+
results.push(Number(chunk));
|
|
1194
1184
|
} else if (matches = chunk.match(STRING_REGEX)) {
|
|
1195
|
-
results.push(matches[2].replace(ESCAPE_REGEX, (m, escape,
|
|
1185
|
+
results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, chr) => escape ? unescape(escape) : chr));
|
|
1196
1186
|
} else {
|
|
1197
1187
|
throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
|
|
1198
1188
|
}
|
|
@@ -1214,622 +1204,225 @@ function parseStyle(style) {
|
|
|
1214
1204
|
}
|
|
1215
1205
|
return results;
|
|
1216
1206
|
}
|
|
1217
|
-
function buildStyle(chalk2,
|
|
1207
|
+
function buildStyle(chalk2, styles) {
|
|
1218
1208
|
const enabled = {};
|
|
1219
|
-
for (const layer of
|
|
1209
|
+
for (const layer of styles) {
|
|
1220
1210
|
for (const style of layer.styles) {
|
|
1221
1211
|
enabled[style[0]] = layer.inverse ? null : style.slice(1);
|
|
1222
1212
|
}
|
|
1223
1213
|
}
|
|
1224
1214
|
let current = chalk2;
|
|
1225
|
-
for (const
|
|
1226
|
-
if (
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1215
|
+
for (const styleName of Object.keys(enabled)) {
|
|
1216
|
+
if (Array.isArray(enabled[styleName])) {
|
|
1217
|
+
if (!(styleName in current)) {
|
|
1218
|
+
throw new Error(`Unknown Chalk style: ${styleName}`);
|
|
1219
|
+
}
|
|
1220
|
+
if (enabled[styleName].length > 0) {
|
|
1221
|
+
current = current[styleName].apply(current, enabled[styleName]);
|
|
1222
|
+
} else {
|
|
1223
|
+
current = current[styleName];
|
|
1224
|
+
}
|
|
1231
1225
|
}
|
|
1232
|
-
current = styles3.length > 0 ? current[styleName](...styles3) : current[styleName];
|
|
1233
1226
|
}
|
|
1234
1227
|
return current;
|
|
1235
1228
|
}
|
|
1236
|
-
var templates = (chalk2,
|
|
1237
|
-
const
|
|
1229
|
+
var templates = (chalk2, tmp) => {
|
|
1230
|
+
const styles = [];
|
|
1238
1231
|
const chunks = [];
|
|
1239
1232
|
let chunk = [];
|
|
1240
|
-
|
|
1241
|
-
if (
|
|
1242
|
-
chunk.push(unescape
|
|
1233
|
+
tmp.replace(TEMPLATE_REGEX, (m, escapeChar, inverse, style, close, chr) => {
|
|
1234
|
+
if (escapeChar) {
|
|
1235
|
+
chunk.push(unescape(escapeChar));
|
|
1243
1236
|
} else if (style) {
|
|
1244
|
-
const
|
|
1237
|
+
const str = chunk.join("");
|
|
1245
1238
|
chunk = [];
|
|
1246
|
-
chunks.push(
|
|
1247
|
-
|
|
1239
|
+
chunks.push(styles.length === 0 ? str : buildStyle(chalk2, styles)(str));
|
|
1240
|
+
styles.push({ inverse, styles: parseStyle(style) });
|
|
1248
1241
|
} else if (close) {
|
|
1249
|
-
if (
|
|
1242
|
+
if (styles.length === 0) {
|
|
1250
1243
|
throw new Error("Found extraneous } in Chalk template literal");
|
|
1251
1244
|
}
|
|
1252
|
-
chunks.push(buildStyle(chalk2,
|
|
1245
|
+
chunks.push(buildStyle(chalk2, styles)(chunk.join("")));
|
|
1253
1246
|
chunk = [];
|
|
1254
|
-
|
|
1247
|
+
styles.pop();
|
|
1255
1248
|
} else {
|
|
1256
|
-
chunk.push(
|
|
1249
|
+
chunk.push(chr);
|
|
1257
1250
|
}
|
|
1258
1251
|
});
|
|
1259
1252
|
chunks.push(chunk.join(""));
|
|
1260
|
-
if (
|
|
1261
|
-
const
|
|
1262
|
-
throw new Error(
|
|
1253
|
+
if (styles.length > 0) {
|
|
1254
|
+
const errMsg = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? "" : "s"} (\`}\`)`;
|
|
1255
|
+
throw new Error(errMsg);
|
|
1263
1256
|
}
|
|
1264
1257
|
return chunks.join("");
|
|
1265
1258
|
};
|
|
1266
|
-
|
|
1267
|
-
const
|
|
1268
|
-
const
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
const
|
|
1273
|
-
const
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
constructor(options) {
|
|
1289
|
-
return chalkFactory(options);
|
|
1290
|
-
}
|
|
1291
|
-
}
|
|
1292
|
-
const chalkFactory = (options) => {
|
|
1293
|
-
const chalk2 = {};
|
|
1294
|
-
applyOptions(chalk2, options);
|
|
1295
|
-
chalk2.template = (...arguments_) => chalkTag(chalk2.template, ...arguments_);
|
|
1296
|
-
Object.setPrototypeOf(chalk2, Chalk.prototype);
|
|
1297
|
-
Object.setPrototypeOf(chalk2.template, chalk2);
|
|
1298
|
-
chalk2.template.constructor = () => {
|
|
1299
|
-
throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.");
|
|
1300
|
-
};
|
|
1301
|
-
chalk2.template.Instance = ChalkClass;
|
|
1302
|
-
return chalk2.template;
|
|
1303
|
-
};
|
|
1304
|
-
function Chalk(options) {
|
|
1305
|
-
return chalkFactory(options);
|
|
1306
|
-
}
|
|
1307
|
-
for (const [styleName, style] of Object.entries(ansiStyles)) {
|
|
1308
|
-
styles[styleName] = {
|
|
1309
|
-
get() {
|
|
1310
|
-
const builder = createBuilder(this, createStyler(style.open, style.close, this._styler), this._isEmpty);
|
|
1311
|
-
Object.defineProperty(this, styleName, { value: builder });
|
|
1312
|
-
return builder;
|
|
1313
|
-
}
|
|
1314
|
-
};
|
|
1315
|
-
}
|
|
1316
|
-
styles.visible = {
|
|
1317
|
-
get() {
|
|
1318
|
-
const builder = createBuilder(this, this._styler, true);
|
|
1319
|
-
Object.defineProperty(this, "visible", { value: builder });
|
|
1320
|
-
return builder;
|
|
1321
|
-
}
|
|
1322
|
-
};
|
|
1323
|
-
const usedModels = ["rgb", "hex", "keyword", "hsl", "hsv", "hwb", "ansi", "ansi256"];
|
|
1324
|
-
for (const model of usedModels) {
|
|
1325
|
-
styles[model] = {
|
|
1326
|
-
get() {
|
|
1327
|
-
const { level } = this;
|
|
1328
|
-
return function(...arguments_) {
|
|
1329
|
-
const styler = createStyler(ansiStyles.color[levelMapping[level]][model](...arguments_), ansiStyles.color.close, this._styler);
|
|
1330
|
-
return createBuilder(this, styler, this._isEmpty);
|
|
1331
|
-
};
|
|
1332
|
-
}
|
|
1333
|
-
};
|
|
1334
|
-
}
|
|
1335
|
-
for (const model of usedModels) {
|
|
1336
|
-
const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
|
|
1337
|
-
styles[bgModel] = {
|
|
1338
|
-
get() {
|
|
1339
|
-
const { level } = this;
|
|
1340
|
-
return function(...arguments_) {
|
|
1341
|
-
const styler = createStyler(ansiStyles.bgColor[levelMapping[level]][model](...arguments_), ansiStyles.bgColor.close, this._styler);
|
|
1342
|
-
return createBuilder(this, styler, this._isEmpty);
|
|
1259
|
+
(function(module) {
|
|
1260
|
+
const escapeStringRegexp$1 = escapeStringRegexp;
|
|
1261
|
+
const ansiStyles$1 = ansiStyles.exports;
|
|
1262
|
+
const stdoutColor = browser.stdout;
|
|
1263
|
+
const template = templates;
|
|
1264
|
+
const isSimpleWindowsTerm = process.platform === "win32" && !({}.TERM || "").toLowerCase().startsWith("xterm");
|
|
1265
|
+
const levelMapping = ["ansi", "ansi", "ansi256", "ansi16m"];
|
|
1266
|
+
const skipModels = /* @__PURE__ */ new Set(["gray"]);
|
|
1267
|
+
const styles = /* @__PURE__ */ Object.create(null);
|
|
1268
|
+
function applyOptions(obj, options) {
|
|
1269
|
+
options = options || {};
|
|
1270
|
+
const scLevel = 0;
|
|
1271
|
+
obj.level = options.level === void 0 ? scLevel : options.level;
|
|
1272
|
+
obj.enabled = "enabled" in options ? options.enabled : obj.level > 0;
|
|
1273
|
+
}
|
|
1274
|
+
function Chalk(options) {
|
|
1275
|
+
if (!this || !(this instanceof Chalk) || this.template) {
|
|
1276
|
+
const chalk2 = {};
|
|
1277
|
+
applyOptions(chalk2, options);
|
|
1278
|
+
chalk2.template = function() {
|
|
1279
|
+
const args = [].slice.call(arguments);
|
|
1280
|
+
return chalkTag.apply(null, [chalk2.template].concat(args));
|
|
1343
1281
|
};
|
|
1282
|
+
Object.setPrototypeOf(chalk2, Chalk.prototype);
|
|
1283
|
+
Object.setPrototypeOf(chalk2.template, chalk2);
|
|
1284
|
+
chalk2.template.constructor = Chalk;
|
|
1285
|
+
return chalk2.template;
|
|
1344
1286
|
}
|
|
1345
|
-
|
|
1346
|
-
}
|
|
1347
|
-
const proto = Object.defineProperties(() => {
|
|
1348
|
-
}, __spreadProps(__spreadValues({}, styles), {
|
|
1349
|
-
level: {
|
|
1350
|
-
enumerable: true,
|
|
1351
|
-
get() {
|
|
1352
|
-
return this._generator.level;
|
|
1353
|
-
},
|
|
1354
|
-
set(level) {
|
|
1355
|
-
this._generator.level = level;
|
|
1356
|
-
}
|
|
1357
|
-
}
|
|
1358
|
-
}));
|
|
1359
|
-
const createStyler = (open, close, parent) => {
|
|
1360
|
-
let openAll;
|
|
1361
|
-
let closeAll;
|
|
1362
|
-
if (parent === void 0) {
|
|
1363
|
-
openAll = open;
|
|
1364
|
-
closeAll = close;
|
|
1365
|
-
} else {
|
|
1366
|
-
openAll = parent.openAll + open;
|
|
1367
|
-
closeAll = close + parent.closeAll;
|
|
1287
|
+
applyOptions(this, options);
|
|
1368
1288
|
}
|
|
1369
|
-
|
|
1370
|
-
open
|
|
1371
|
-
close,
|
|
1372
|
-
openAll,
|
|
1373
|
-
closeAll,
|
|
1374
|
-
parent
|
|
1375
|
-
};
|
|
1376
|
-
};
|
|
1377
|
-
const createBuilder = (self2, _styler, _isEmpty) => {
|
|
1378
|
-
const builder = (...arguments_) => {
|
|
1379
|
-
if (isArray(arguments_[0]) && isArray(arguments_[0].raw)) {
|
|
1380
|
-
return applyStyle(builder, chalkTag(builder, ...arguments_));
|
|
1381
|
-
}
|
|
1382
|
-
return applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
|
|
1383
|
-
};
|
|
1384
|
-
Object.setPrototypeOf(builder, proto);
|
|
1385
|
-
builder._generator = self2;
|
|
1386
|
-
builder._styler = _styler;
|
|
1387
|
-
builder._isEmpty = _isEmpty;
|
|
1388
|
-
return builder;
|
|
1389
|
-
};
|
|
1390
|
-
const applyStyle = (self2, string) => {
|
|
1391
|
-
if (self2.level <= 0 || !string) {
|
|
1392
|
-
return self2._isEmpty ? "" : string;
|
|
1289
|
+
if (isSimpleWindowsTerm) {
|
|
1290
|
+
ansiStyles$1.blue.open = "\x1B[94m";
|
|
1393
1291
|
}
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1292
|
+
for (const key of Object.keys(ansiStyles$1)) {
|
|
1293
|
+
ansiStyles$1[key].closeRe = new RegExp(escapeStringRegexp$1(ansiStyles$1[key].close), "g");
|
|
1294
|
+
styles[key] = {
|
|
1295
|
+
get() {
|
|
1296
|
+
const codes = ansiStyles$1[key];
|
|
1297
|
+
return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, key);
|
|
1298
|
+
}
|
|
1299
|
+
};
|
|
1397
1300
|
}
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
string = stringReplaceAll(string, styler.close, styler.open);
|
|
1402
|
-
styler = styler.parent;
|
|
1301
|
+
styles.visible = {
|
|
1302
|
+
get() {
|
|
1303
|
+
return build.call(this, this._styles || [], true, "visible");
|
|
1403
1304
|
}
|
|
1404
|
-
}
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
}
|
|
1409
|
-
return openAll + string + closeAll;
|
|
1410
|
-
};
|
|
1411
|
-
let template;
|
|
1412
|
-
const chalkTag = (chalk2, ...strings) => {
|
|
1413
|
-
const [firstString] = strings;
|
|
1414
|
-
if (!isArray(firstString) || !isArray(firstString.raw)) {
|
|
1415
|
-
return strings.join(" ");
|
|
1416
|
-
}
|
|
1417
|
-
const arguments_ = strings.slice(1);
|
|
1418
|
-
const parts = [firstString.raw[0]];
|
|
1419
|
-
for (let i = 1; i < firstString.length; i++) {
|
|
1420
|
-
parts.push(String(arguments_[i - 1]).replace(/[{}\\]/g, "\\$&"), String(firstString.raw[i]));
|
|
1421
|
-
}
|
|
1422
|
-
if (template === void 0) {
|
|
1423
|
-
template = templates;
|
|
1424
|
-
}
|
|
1425
|
-
return template(chalk2, parts.join(""));
|
|
1426
|
-
};
|
|
1427
|
-
Object.defineProperties(Chalk.prototype, styles);
|
|
1428
|
-
const chalk = Chalk();
|
|
1429
|
-
chalk.supportsColor = stdoutColor;
|
|
1430
|
-
chalk.stderr = Chalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
1431
|
-
chalk.stderr.supportsColor = stderrColor;
|
|
1432
|
-
var source = chalk;
|
|
1433
|
-
const log = (message) => {
|
|
1434
|
-
console.log(`${source.magenta("JamComments:")} ${message}`);
|
|
1435
|
-
};
|
|
1436
|
-
const logError = (message) => {
|
|
1437
|
-
console.error(`JamComments: ${message}`);
|
|
1438
|
-
};
|
|
1439
|
-
var requiresPort = function required(port2, protocol) {
|
|
1440
|
-
protocol = protocol.split(":")[0];
|
|
1441
|
-
port2 = +port2;
|
|
1442
|
-
if (!port2)
|
|
1443
|
-
return false;
|
|
1444
|
-
switch (protocol) {
|
|
1445
|
-
case "http":
|
|
1446
|
-
case "ws":
|
|
1447
|
-
return port2 !== 80;
|
|
1448
|
-
case "https":
|
|
1449
|
-
case "wss":
|
|
1450
|
-
return port2 !== 443;
|
|
1451
|
-
case "ftp":
|
|
1452
|
-
return port2 !== 21;
|
|
1453
|
-
case "gopher":
|
|
1454
|
-
return port2 !== 70;
|
|
1455
|
-
case "file":
|
|
1456
|
-
return false;
|
|
1457
|
-
}
|
|
1458
|
-
return port2 !== 0;
|
|
1459
|
-
};
|
|
1460
|
-
var querystringify$1 = {};
|
|
1461
|
-
var has = Object.prototype.hasOwnProperty, undef;
|
|
1462
|
-
function decode(input) {
|
|
1463
|
-
try {
|
|
1464
|
-
return decodeURIComponent(input.replace(/\+/g, " "));
|
|
1465
|
-
} catch (e) {
|
|
1466
|
-
return null;
|
|
1467
|
-
}
|
|
1468
|
-
}
|
|
1469
|
-
function encode(input) {
|
|
1470
|
-
try {
|
|
1471
|
-
return encodeURIComponent(input);
|
|
1472
|
-
} catch (e) {
|
|
1473
|
-
return null;
|
|
1474
|
-
}
|
|
1475
|
-
}
|
|
1476
|
-
function querystring(query) {
|
|
1477
|
-
var parser = /([^=?#&]+)=?([^&]*)/g, result = {}, part;
|
|
1478
|
-
while (part = parser.exec(query)) {
|
|
1479
|
-
var key = decode(part[1]), value = decode(part[2]);
|
|
1480
|
-
if (key === null || value === null || key in result)
|
|
1305
|
+
};
|
|
1306
|
+
ansiStyles$1.color.closeRe = new RegExp(escapeStringRegexp$1(ansiStyles$1.color.close), "g");
|
|
1307
|
+
for (const model of Object.keys(ansiStyles$1.color.ansi)) {
|
|
1308
|
+
if (skipModels.has(model)) {
|
|
1481
1309
|
continue;
|
|
1482
|
-
result[key] = value;
|
|
1483
|
-
}
|
|
1484
|
-
return result;
|
|
1485
|
-
}
|
|
1486
|
-
function querystringify(obj, prefix) {
|
|
1487
|
-
prefix = prefix || "";
|
|
1488
|
-
var pairs = [], value, key;
|
|
1489
|
-
if (typeof prefix !== "string")
|
|
1490
|
-
prefix = "?";
|
|
1491
|
-
for (key in obj) {
|
|
1492
|
-
if (has.call(obj, key)) {
|
|
1493
|
-
value = obj[key];
|
|
1494
|
-
if (!value && (value === null || value === undef || isNaN(value))) {
|
|
1495
|
-
value = "";
|
|
1496
|
-
}
|
|
1497
|
-
key = encode(key);
|
|
1498
|
-
value = encode(value);
|
|
1499
|
-
if (key === null || value === null)
|
|
1500
|
-
continue;
|
|
1501
|
-
pairs.push(key + "=" + value);
|
|
1502
1310
|
}
|
|
1311
|
+
styles[model] = {
|
|
1312
|
+
get() {
|
|
1313
|
+
const level = this.level;
|
|
1314
|
+
return function() {
|
|
1315
|
+
const open = ansiStyles$1.color[levelMapping[level]][model].apply(null, arguments);
|
|
1316
|
+
const codes = {
|
|
1317
|
+
open,
|
|
1318
|
+
close: ansiStyles$1.color.close,
|
|
1319
|
+
closeRe: ansiStyles$1.color.closeRe
|
|
1320
|
+
};
|
|
1321
|
+
return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
|
|
1322
|
+
};
|
|
1323
|
+
}
|
|
1324
|
+
};
|
|
1503
1325
|
}
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
var required2 = requiresPort, qs = querystringify$1, controlOrWhitespace = /^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/, CRHTLF = /[\n\r\t]/g, slashes = /^[A-Za-z][A-Za-z0-9+-.]*:\/\//, port = /:\d+$/, protocolre = /^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i, windowsDriveLetter = /^[a-zA-Z]:/;
|
|
1509
|
-
function trimLeft(str) {
|
|
1510
|
-
return (str ? str : "").toString().replace(controlOrWhitespace, "");
|
|
1511
|
-
}
|
|
1512
|
-
var rules = [
|
|
1513
|
-
["#", "hash"],
|
|
1514
|
-
["?", "query"],
|
|
1515
|
-
function sanitize(address, url) {
|
|
1516
|
-
return isSpecial(url.protocol) ? address.replace(/\\/g, "/") : address;
|
|
1517
|
-
},
|
|
1518
|
-
["/", "pathname"],
|
|
1519
|
-
["@", "auth", 1],
|
|
1520
|
-
[NaN, "host", void 0, 1, 1],
|
|
1521
|
-
[/:(\d*)$/, "port", void 0, 1],
|
|
1522
|
-
[NaN, "hostname", void 0, 1, 1]
|
|
1523
|
-
];
|
|
1524
|
-
var ignore = { hash: 1, query: 1 };
|
|
1525
|
-
function lolcation(loc) {
|
|
1526
|
-
var globalVar;
|
|
1527
|
-
if (typeof window !== "undefined")
|
|
1528
|
-
globalVar = window;
|
|
1529
|
-
else if (typeof commonjsGlobal !== "undefined")
|
|
1530
|
-
globalVar = commonjsGlobal;
|
|
1531
|
-
else if (typeof self !== "undefined")
|
|
1532
|
-
globalVar = self;
|
|
1533
|
-
else
|
|
1534
|
-
globalVar = {};
|
|
1535
|
-
var location = globalVar.location || {};
|
|
1536
|
-
loc = loc || location;
|
|
1537
|
-
var finaldestination = {}, type = typeof loc, key;
|
|
1538
|
-
if (loc.protocol === "blob:") {
|
|
1539
|
-
finaldestination = new Url(unescape(loc.pathname), {});
|
|
1540
|
-
} else if (type === "string") {
|
|
1541
|
-
finaldestination = new Url(loc, {});
|
|
1542
|
-
for (key in ignore)
|
|
1543
|
-
delete finaldestination[key];
|
|
1544
|
-
} else if (type === "object") {
|
|
1545
|
-
for (key in loc) {
|
|
1546
|
-
if (key in ignore)
|
|
1547
|
-
continue;
|
|
1548
|
-
finaldestination[key] = loc[key];
|
|
1549
|
-
}
|
|
1550
|
-
if (finaldestination.slashes === void 0) {
|
|
1551
|
-
finaldestination.slashes = slashes.test(loc.href);
|
|
1326
|
+
ansiStyles$1.bgColor.closeRe = new RegExp(escapeStringRegexp$1(ansiStyles$1.bgColor.close), "g");
|
|
1327
|
+
for (const model of Object.keys(ansiStyles$1.bgColor.ansi)) {
|
|
1328
|
+
if (skipModels.has(model)) {
|
|
1329
|
+
continue;
|
|
1552
1330
|
}
|
|
1331
|
+
const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
|
|
1332
|
+
styles[bgModel] = {
|
|
1333
|
+
get() {
|
|
1334
|
+
const level = this.level;
|
|
1335
|
+
return function() {
|
|
1336
|
+
const open = ansiStyles$1.bgColor[levelMapping[level]][model].apply(null, arguments);
|
|
1337
|
+
const codes = {
|
|
1338
|
+
open,
|
|
1339
|
+
close: ansiStyles$1.bgColor.close,
|
|
1340
|
+
closeRe: ansiStyles$1.bgColor.closeRe
|
|
1341
|
+
};
|
|
1342
|
+
return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
|
|
1343
|
+
};
|
|
1344
|
+
}
|
|
1345
|
+
};
|
|
1553
1346
|
}
|
|
1554
|
-
|
|
1555
|
-
}
|
|
1556
|
-
function
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1347
|
+
const proto = Object.defineProperties(() => {
|
|
1348
|
+
}, styles);
|
|
1349
|
+
function build(_styles, _empty, key) {
|
|
1350
|
+
const builder = function() {
|
|
1351
|
+
return applyStyle.apply(builder, arguments);
|
|
1352
|
+
};
|
|
1353
|
+
builder._styles = _styles;
|
|
1354
|
+
builder._empty = _empty;
|
|
1355
|
+
const self = this;
|
|
1356
|
+
Object.defineProperty(builder, "level", {
|
|
1357
|
+
enumerable: true,
|
|
1358
|
+
get() {
|
|
1359
|
+
return self.level;
|
|
1360
|
+
},
|
|
1361
|
+
set(level) {
|
|
1362
|
+
self.level = level;
|
|
1363
|
+
}
|
|
1364
|
+
});
|
|
1365
|
+
Object.defineProperty(builder, "enabled", {
|
|
1366
|
+
enumerable: true,
|
|
1367
|
+
get() {
|
|
1368
|
+
return self.enabled;
|
|
1369
|
+
},
|
|
1370
|
+
set(enabled) {
|
|
1371
|
+
self.enabled = enabled;
|
|
1372
|
+
}
|
|
1373
|
+
});
|
|
1374
|
+
builder.hasGrey = this.hasGrey || key === "gray" || key === "grey";
|
|
1375
|
+
builder.__proto__ = proto;
|
|
1376
|
+
return builder;
|
|
1584
1377
|
}
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1378
|
+
function applyStyle() {
|
|
1379
|
+
const args = arguments;
|
|
1380
|
+
const argsLen = args.length;
|
|
1381
|
+
let str = String(arguments[0]);
|
|
1382
|
+
if (argsLen === 0) {
|
|
1383
|
+
return "";
|
|
1588
1384
|
}
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
rest = rest.slice(2);
|
|
1385
|
+
if (argsLen > 1) {
|
|
1386
|
+
for (let a = 1; a < argsLen; a++) {
|
|
1387
|
+
str += " " + args[a];
|
|
1388
|
+
}
|
|
1594
1389
|
}
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
}
|
|
1598
|
-
return {
|
|
1599
|
-
protocol,
|
|
1600
|
-
slashes: forwardSlashes || isSpecial(protocol),
|
|
1601
|
-
slashesCount,
|
|
1602
|
-
rest
|
|
1603
|
-
};
|
|
1604
|
-
}
|
|
1605
|
-
function resolve(relative, base) {
|
|
1606
|
-
if (relative === "")
|
|
1607
|
-
return base;
|
|
1608
|
-
var path = (base || "/").split("/").slice(0, -1).concat(relative.split("/")), i = path.length, last = path[i - 1], unshift = false, up = 0;
|
|
1609
|
-
while (i--) {
|
|
1610
|
-
if (path[i] === ".") {
|
|
1611
|
-
path.splice(i, 1);
|
|
1612
|
-
} else if (path[i] === "..") {
|
|
1613
|
-
path.splice(i, 1);
|
|
1614
|
-
up++;
|
|
1615
|
-
} else if (up) {
|
|
1616
|
-
if (i === 0)
|
|
1617
|
-
unshift = true;
|
|
1618
|
-
path.splice(i, 1);
|
|
1619
|
-
up--;
|
|
1390
|
+
if (!this.enabled || this.level <= 0 || !str) {
|
|
1391
|
+
return this._empty ? "" : str;
|
|
1620
1392
|
}
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
if (last === "." || last === "..")
|
|
1625
|
-
path.push("");
|
|
1626
|
-
return path.join("/");
|
|
1627
|
-
}
|
|
1628
|
-
function Url(address, location, parser) {
|
|
1629
|
-
address = trimLeft(address);
|
|
1630
|
-
address = address.replace(CRHTLF, "");
|
|
1631
|
-
if (!(this instanceof Url)) {
|
|
1632
|
-
return new Url(address, location, parser);
|
|
1633
|
-
}
|
|
1634
|
-
var relative, extracted, parse, instruction, index, key, instructions = rules.slice(), type = typeof location, url = this, i = 0;
|
|
1635
|
-
if (type !== "object" && type !== "string") {
|
|
1636
|
-
parser = location;
|
|
1637
|
-
location = null;
|
|
1638
|
-
}
|
|
1639
|
-
if (parser && typeof parser !== "function")
|
|
1640
|
-
parser = qs.parse;
|
|
1641
|
-
location = lolcation(location);
|
|
1642
|
-
extracted = extractProtocol(address || "", location);
|
|
1643
|
-
relative = !extracted.protocol && !extracted.slashes;
|
|
1644
|
-
url.slashes = extracted.slashes || relative && location.slashes;
|
|
1645
|
-
url.protocol = extracted.protocol || location.protocol || "";
|
|
1646
|
-
address = extracted.rest;
|
|
1647
|
-
if (extracted.protocol === "file:" && (extracted.slashesCount !== 2 || windowsDriveLetter.test(address)) || !extracted.slashes && (extracted.protocol || extracted.slashesCount < 2 || !isSpecial(url.protocol))) {
|
|
1648
|
-
instructions[3] = [/(.*)/, "pathname"];
|
|
1649
|
-
}
|
|
1650
|
-
for (; i < instructions.length; i++) {
|
|
1651
|
-
instruction = instructions[i];
|
|
1652
|
-
if (typeof instruction === "function") {
|
|
1653
|
-
address = instruction(address, url);
|
|
1654
|
-
continue;
|
|
1393
|
+
const originalDim = ansiStyles$1.dim.open;
|
|
1394
|
+
if (isSimpleWindowsTerm && this.hasGrey) {
|
|
1395
|
+
ansiStyles$1.dim.open = "";
|
|
1655
1396
|
}
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
url[key] = address;
|
|
1660
|
-
} else if (typeof parse === "string") {
|
|
1661
|
-
index = parse === "@" ? address.lastIndexOf(parse) : address.indexOf(parse);
|
|
1662
|
-
if (~index) {
|
|
1663
|
-
if (typeof instruction[2] === "number") {
|
|
1664
|
-
url[key] = address.slice(0, index);
|
|
1665
|
-
address = address.slice(index + instruction[2]);
|
|
1666
|
-
} else {
|
|
1667
|
-
url[key] = address.slice(index);
|
|
1668
|
-
address = address.slice(0, index);
|
|
1669
|
-
}
|
|
1670
|
-
}
|
|
1671
|
-
} else if (index = parse.exec(address)) {
|
|
1672
|
-
url[key] = index[1];
|
|
1673
|
-
address = address.slice(0, index.index);
|
|
1397
|
+
for (const code of this._styles.slice().reverse()) {
|
|
1398
|
+
str = code.open + str.replace(code.closeRe, code.open) + code.close;
|
|
1399
|
+
str = str.replace(/\r?\n/g, `${code.close}$&${code.open}`);
|
|
1674
1400
|
}
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
url[key] = url[key].toLowerCase();
|
|
1401
|
+
ansiStyles$1.dim.open = originalDim;
|
|
1402
|
+
return str;
|
|
1678
1403
|
}
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
url.pathname = resolve(url.pathname, location.pathname);
|
|
1683
|
-
}
|
|
1684
|
-
if (url.pathname.charAt(0) !== "/" && isSpecial(url.protocol)) {
|
|
1685
|
-
url.pathname = "/" + url.pathname;
|
|
1686
|
-
}
|
|
1687
|
-
if (!required2(url.port, url.protocol)) {
|
|
1688
|
-
url.host = url.hostname;
|
|
1689
|
-
url.port = "";
|
|
1690
|
-
}
|
|
1691
|
-
url.username = url.password = "";
|
|
1692
|
-
if (url.auth) {
|
|
1693
|
-
index = url.auth.indexOf(":");
|
|
1694
|
-
if (~index) {
|
|
1695
|
-
url.username = url.auth.slice(0, index);
|
|
1696
|
-
url.username = encodeURIComponent(decodeURIComponent(url.username));
|
|
1697
|
-
url.password = url.auth.slice(index + 1);
|
|
1698
|
-
url.password = encodeURIComponent(decodeURIComponent(url.password));
|
|
1699
|
-
} else {
|
|
1700
|
-
url.username = encodeURIComponent(decodeURIComponent(url.auth));
|
|
1404
|
+
function chalkTag(chalk2, strings) {
|
|
1405
|
+
if (!Array.isArray(strings)) {
|
|
1406
|
+
return [].slice.call(arguments, 1).join(" ");
|
|
1701
1407
|
}
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
function set(part, value, fn) {
|
|
1708
|
-
var url = this;
|
|
1709
|
-
switch (part) {
|
|
1710
|
-
case "query":
|
|
1711
|
-
if (typeof value === "string" && value.length) {
|
|
1712
|
-
value = (fn || qs.parse)(value);
|
|
1713
|
-
}
|
|
1714
|
-
url[part] = value;
|
|
1715
|
-
break;
|
|
1716
|
-
case "port":
|
|
1717
|
-
url[part] = value;
|
|
1718
|
-
if (!required2(value, url.protocol)) {
|
|
1719
|
-
url.host = url.hostname;
|
|
1720
|
-
url[part] = "";
|
|
1721
|
-
} else if (value) {
|
|
1722
|
-
url.host = url.hostname + ":" + value;
|
|
1723
|
-
}
|
|
1724
|
-
break;
|
|
1725
|
-
case "hostname":
|
|
1726
|
-
url[part] = value;
|
|
1727
|
-
if (url.port)
|
|
1728
|
-
value += ":" + url.port;
|
|
1729
|
-
url.host = value;
|
|
1730
|
-
break;
|
|
1731
|
-
case "host":
|
|
1732
|
-
url[part] = value;
|
|
1733
|
-
if (port.test(value)) {
|
|
1734
|
-
value = value.split(":");
|
|
1735
|
-
url.port = value.pop();
|
|
1736
|
-
url.hostname = value.join(":");
|
|
1737
|
-
} else {
|
|
1738
|
-
url.hostname = value;
|
|
1739
|
-
url.port = "";
|
|
1740
|
-
}
|
|
1741
|
-
break;
|
|
1742
|
-
case "protocol":
|
|
1743
|
-
url.protocol = value.toLowerCase();
|
|
1744
|
-
url.slashes = !fn;
|
|
1745
|
-
break;
|
|
1746
|
-
case "pathname":
|
|
1747
|
-
case "hash":
|
|
1748
|
-
if (value) {
|
|
1749
|
-
var char = part === "pathname" ? "/" : "#";
|
|
1750
|
-
url[part] = value.charAt(0) !== char ? char + value : value;
|
|
1751
|
-
} else {
|
|
1752
|
-
url[part] = value;
|
|
1753
|
-
}
|
|
1754
|
-
break;
|
|
1755
|
-
case "username":
|
|
1756
|
-
case "password":
|
|
1757
|
-
url[part] = encodeURIComponent(value);
|
|
1758
|
-
break;
|
|
1759
|
-
case "auth":
|
|
1760
|
-
var index = value.indexOf(":");
|
|
1761
|
-
if (~index) {
|
|
1762
|
-
url.username = value.slice(0, index);
|
|
1763
|
-
url.username = encodeURIComponent(decodeURIComponent(url.username));
|
|
1764
|
-
url.password = value.slice(index + 1);
|
|
1765
|
-
url.password = encodeURIComponent(decodeURIComponent(url.password));
|
|
1766
|
-
} else {
|
|
1767
|
-
url.username = encodeURIComponent(decodeURIComponent(value));
|
|
1768
|
-
}
|
|
1769
|
-
}
|
|
1770
|
-
for (var i = 0; i < rules.length; i++) {
|
|
1771
|
-
var ins = rules[i];
|
|
1772
|
-
if (ins[4])
|
|
1773
|
-
url[ins[1]] = url[ins[1]].toLowerCase();
|
|
1774
|
-
}
|
|
1775
|
-
url.auth = url.password ? url.username + ":" + url.password : url.username;
|
|
1776
|
-
url.origin = url.protocol !== "file:" && isSpecial(url.protocol) && url.host ? url.protocol + "//" + url.host : "null";
|
|
1777
|
-
url.href = url.toString();
|
|
1778
|
-
return url;
|
|
1779
|
-
}
|
|
1780
|
-
function toString(stringify) {
|
|
1781
|
-
if (!stringify || typeof stringify !== "function")
|
|
1782
|
-
stringify = qs.stringify;
|
|
1783
|
-
var query, url = this, host = url.host, protocol = url.protocol;
|
|
1784
|
-
if (protocol && protocol.charAt(protocol.length - 1) !== ":")
|
|
1785
|
-
protocol += ":";
|
|
1786
|
-
var result = protocol + (url.protocol && url.slashes || isSpecial(url.protocol) ? "//" : "");
|
|
1787
|
-
if (url.username) {
|
|
1788
|
-
result += url.username;
|
|
1789
|
-
if (url.password)
|
|
1790
|
-
result += ":" + url.password;
|
|
1791
|
-
result += "@";
|
|
1792
|
-
} else if (url.password) {
|
|
1793
|
-
result += ":" + url.password;
|
|
1794
|
-
result += "@";
|
|
1795
|
-
} else if (url.protocol !== "file:" && isSpecial(url.protocol) && !host && url.pathname !== "/") {
|
|
1796
|
-
result += "@";
|
|
1797
|
-
}
|
|
1798
|
-
if (host[host.length - 1] === ":" || port.test(url.hostname) && !url.port) {
|
|
1799
|
-
host += ":";
|
|
1800
|
-
}
|
|
1801
|
-
result += host + url.pathname;
|
|
1802
|
-
query = typeof url.query === "object" ? stringify(url.query) : url.query;
|
|
1803
|
-
if (query)
|
|
1804
|
-
result += query.charAt(0) !== "?" ? "?" + query : query;
|
|
1805
|
-
if (url.hash)
|
|
1806
|
-
result += url.hash;
|
|
1807
|
-
return result;
|
|
1808
|
-
}
|
|
1809
|
-
Url.prototype = { set, toString };
|
|
1810
|
-
Url.extractProtocol = extractProtocol;
|
|
1811
|
-
Url.location = lolcation;
|
|
1812
|
-
Url.trimLeft = trimLeft;
|
|
1813
|
-
Url.qs = qs;
|
|
1814
|
-
var urlParse = Url;
|
|
1815
|
-
const parsePath = (urlOrPath) => {
|
|
1816
|
-
const pathName = new urlParse(urlOrPath)["pathname"] || "";
|
|
1817
|
-
return pathName.replace(/^(\/{1,})|\/{1,}$/g, "");
|
|
1818
|
-
};
|
|
1819
|
-
const filterByUrl = (comments, urlOrPath) => {
|
|
1820
|
-
const pagePath = parsePath(urlOrPath);
|
|
1821
|
-
return comments.filter((comment) => {
|
|
1822
|
-
if (!comment.path) {
|
|
1823
|
-
return false;
|
|
1408
|
+
const args = [].slice.call(arguments, 2);
|
|
1409
|
+
const parts = [strings.raw[0]];
|
|
1410
|
+
for (let i = 1; i < strings.length; i++) {
|
|
1411
|
+
parts.push(String(args[i - 1]).replace(/[{}\\]/g, "\\$&"));
|
|
1412
|
+
parts.push(String(strings.raw[i]));
|
|
1824
1413
|
}
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1414
|
+
return template(chalk2, parts.join(""));
|
|
1415
|
+
}
|
|
1416
|
+
Object.defineProperties(Chalk.prototype, styles);
|
|
1417
|
+
module.exports = Chalk();
|
|
1418
|
+
module.exports.supportsColor = stdoutColor;
|
|
1419
|
+
module.exports.default = module.exports;
|
|
1420
|
+
})(chalk$1);
|
|
1421
|
+
var chalk = chalk$1.exports;
|
|
1422
|
+
const log = (message) => {
|
|
1423
|
+
console.log(`${chalk.magenta("JamComments:")} ${message}`);
|
|
1828
1424
|
};
|
|
1829
|
-
const
|
|
1830
|
-
|
|
1831
|
-
return content;
|
|
1832
|
-
}
|
|
1833
|
-
return content.split(/(?:\r\n|\r|\n)/).filter((text) => !!text).map((text) => `<p>${text.trim()}</p>`).join("");
|
|
1425
|
+
const logError = (message) => {
|
|
1426
|
+
console.error(`JamComments: ${message}`);
|
|
1834
1427
|
};
|
|
1835
|
-
export {
|
|
1428
|
+
export { log, logError, markupFetcher };
|