merge-tsconfigs 0.0.2
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/LICENSE +21 -0
- package/README.md +3 -0
- package/dist/index.cjs +2921 -0
- package/dist/index.d.ts +37 -0
- package/dist/index.js +2910 -0
- package/package.json +109 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,2921 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
9
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
+
};
|
|
11
|
+
var __export = (target, all) => {
|
|
12
|
+
for (var name in all)
|
|
13
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
14
|
+
};
|
|
15
|
+
var __copyProps = (to, from, except, desc) => {
|
|
16
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
+
for (let key of __getOwnPropNames(from))
|
|
18
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
19
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
22
|
+
};
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// node_modules/.pnpm/color-name@1.1.4/node_modules/color-name/index.js
|
|
30
|
+
var require_color_name = __commonJS({
|
|
31
|
+
"node_modules/.pnpm/color-name@1.1.4/node_modules/color-name/index.js"(exports, module2) {
|
|
32
|
+
"use strict";
|
|
33
|
+
module2.exports = {
|
|
34
|
+
"aliceblue": [240, 248, 255],
|
|
35
|
+
"antiquewhite": [250, 235, 215],
|
|
36
|
+
"aqua": [0, 255, 255],
|
|
37
|
+
"aquamarine": [127, 255, 212],
|
|
38
|
+
"azure": [240, 255, 255],
|
|
39
|
+
"beige": [245, 245, 220],
|
|
40
|
+
"bisque": [255, 228, 196],
|
|
41
|
+
"black": [0, 0, 0],
|
|
42
|
+
"blanchedalmond": [255, 235, 205],
|
|
43
|
+
"blue": [0, 0, 255],
|
|
44
|
+
"blueviolet": [138, 43, 226],
|
|
45
|
+
"brown": [165, 42, 42],
|
|
46
|
+
"burlywood": [222, 184, 135],
|
|
47
|
+
"cadetblue": [95, 158, 160],
|
|
48
|
+
"chartreuse": [127, 255, 0],
|
|
49
|
+
"chocolate": [210, 105, 30],
|
|
50
|
+
"coral": [255, 127, 80],
|
|
51
|
+
"cornflowerblue": [100, 149, 237],
|
|
52
|
+
"cornsilk": [255, 248, 220],
|
|
53
|
+
"crimson": [220, 20, 60],
|
|
54
|
+
"cyan": [0, 255, 255],
|
|
55
|
+
"darkblue": [0, 0, 139],
|
|
56
|
+
"darkcyan": [0, 139, 139],
|
|
57
|
+
"darkgoldenrod": [184, 134, 11],
|
|
58
|
+
"darkgray": [169, 169, 169],
|
|
59
|
+
"darkgreen": [0, 100, 0],
|
|
60
|
+
"darkgrey": [169, 169, 169],
|
|
61
|
+
"darkkhaki": [189, 183, 107],
|
|
62
|
+
"darkmagenta": [139, 0, 139],
|
|
63
|
+
"darkolivegreen": [85, 107, 47],
|
|
64
|
+
"darkorange": [255, 140, 0],
|
|
65
|
+
"darkorchid": [153, 50, 204],
|
|
66
|
+
"darkred": [139, 0, 0],
|
|
67
|
+
"darksalmon": [233, 150, 122],
|
|
68
|
+
"darkseagreen": [143, 188, 143],
|
|
69
|
+
"darkslateblue": [72, 61, 139],
|
|
70
|
+
"darkslategray": [47, 79, 79],
|
|
71
|
+
"darkslategrey": [47, 79, 79],
|
|
72
|
+
"darkturquoise": [0, 206, 209],
|
|
73
|
+
"darkviolet": [148, 0, 211],
|
|
74
|
+
"deeppink": [255, 20, 147],
|
|
75
|
+
"deepskyblue": [0, 191, 255],
|
|
76
|
+
"dimgray": [105, 105, 105],
|
|
77
|
+
"dimgrey": [105, 105, 105],
|
|
78
|
+
"dodgerblue": [30, 144, 255],
|
|
79
|
+
"firebrick": [178, 34, 34],
|
|
80
|
+
"floralwhite": [255, 250, 240],
|
|
81
|
+
"forestgreen": [34, 139, 34],
|
|
82
|
+
"fuchsia": [255, 0, 255],
|
|
83
|
+
"gainsboro": [220, 220, 220],
|
|
84
|
+
"ghostwhite": [248, 248, 255],
|
|
85
|
+
"gold": [255, 215, 0],
|
|
86
|
+
"goldenrod": [218, 165, 32],
|
|
87
|
+
"gray": [128, 128, 128],
|
|
88
|
+
"green": [0, 128, 0],
|
|
89
|
+
"greenyellow": [173, 255, 47],
|
|
90
|
+
"grey": [128, 128, 128],
|
|
91
|
+
"honeydew": [240, 255, 240],
|
|
92
|
+
"hotpink": [255, 105, 180],
|
|
93
|
+
"indianred": [205, 92, 92],
|
|
94
|
+
"indigo": [75, 0, 130],
|
|
95
|
+
"ivory": [255, 255, 240],
|
|
96
|
+
"khaki": [240, 230, 140],
|
|
97
|
+
"lavender": [230, 230, 250],
|
|
98
|
+
"lavenderblush": [255, 240, 245],
|
|
99
|
+
"lawngreen": [124, 252, 0],
|
|
100
|
+
"lemonchiffon": [255, 250, 205],
|
|
101
|
+
"lightblue": [173, 216, 230],
|
|
102
|
+
"lightcoral": [240, 128, 128],
|
|
103
|
+
"lightcyan": [224, 255, 255],
|
|
104
|
+
"lightgoldenrodyellow": [250, 250, 210],
|
|
105
|
+
"lightgray": [211, 211, 211],
|
|
106
|
+
"lightgreen": [144, 238, 144],
|
|
107
|
+
"lightgrey": [211, 211, 211],
|
|
108
|
+
"lightpink": [255, 182, 193],
|
|
109
|
+
"lightsalmon": [255, 160, 122],
|
|
110
|
+
"lightseagreen": [32, 178, 170],
|
|
111
|
+
"lightskyblue": [135, 206, 250],
|
|
112
|
+
"lightslategray": [119, 136, 153],
|
|
113
|
+
"lightslategrey": [119, 136, 153],
|
|
114
|
+
"lightsteelblue": [176, 196, 222],
|
|
115
|
+
"lightyellow": [255, 255, 224],
|
|
116
|
+
"lime": [0, 255, 0],
|
|
117
|
+
"limegreen": [50, 205, 50],
|
|
118
|
+
"linen": [250, 240, 230],
|
|
119
|
+
"magenta": [255, 0, 255],
|
|
120
|
+
"maroon": [128, 0, 0],
|
|
121
|
+
"mediumaquamarine": [102, 205, 170],
|
|
122
|
+
"mediumblue": [0, 0, 205],
|
|
123
|
+
"mediumorchid": [186, 85, 211],
|
|
124
|
+
"mediumpurple": [147, 112, 219],
|
|
125
|
+
"mediumseagreen": [60, 179, 113],
|
|
126
|
+
"mediumslateblue": [123, 104, 238],
|
|
127
|
+
"mediumspringgreen": [0, 250, 154],
|
|
128
|
+
"mediumturquoise": [72, 209, 204],
|
|
129
|
+
"mediumvioletred": [199, 21, 133],
|
|
130
|
+
"midnightblue": [25, 25, 112],
|
|
131
|
+
"mintcream": [245, 255, 250],
|
|
132
|
+
"mistyrose": [255, 228, 225],
|
|
133
|
+
"moccasin": [255, 228, 181],
|
|
134
|
+
"navajowhite": [255, 222, 173],
|
|
135
|
+
"navy": [0, 0, 128],
|
|
136
|
+
"oldlace": [253, 245, 230],
|
|
137
|
+
"olive": [128, 128, 0],
|
|
138
|
+
"olivedrab": [107, 142, 35],
|
|
139
|
+
"orange": [255, 165, 0],
|
|
140
|
+
"orangered": [255, 69, 0],
|
|
141
|
+
"orchid": [218, 112, 214],
|
|
142
|
+
"palegoldenrod": [238, 232, 170],
|
|
143
|
+
"palegreen": [152, 251, 152],
|
|
144
|
+
"paleturquoise": [175, 238, 238],
|
|
145
|
+
"palevioletred": [219, 112, 147],
|
|
146
|
+
"papayawhip": [255, 239, 213],
|
|
147
|
+
"peachpuff": [255, 218, 185],
|
|
148
|
+
"peru": [205, 133, 63],
|
|
149
|
+
"pink": [255, 192, 203],
|
|
150
|
+
"plum": [221, 160, 221],
|
|
151
|
+
"powderblue": [176, 224, 230],
|
|
152
|
+
"purple": [128, 0, 128],
|
|
153
|
+
"rebeccapurple": [102, 51, 153],
|
|
154
|
+
"red": [255, 0, 0],
|
|
155
|
+
"rosybrown": [188, 143, 143],
|
|
156
|
+
"royalblue": [65, 105, 225],
|
|
157
|
+
"saddlebrown": [139, 69, 19],
|
|
158
|
+
"salmon": [250, 128, 114],
|
|
159
|
+
"sandybrown": [244, 164, 96],
|
|
160
|
+
"seagreen": [46, 139, 87],
|
|
161
|
+
"seashell": [255, 245, 238],
|
|
162
|
+
"sienna": [160, 82, 45],
|
|
163
|
+
"silver": [192, 192, 192],
|
|
164
|
+
"skyblue": [135, 206, 235],
|
|
165
|
+
"slateblue": [106, 90, 205],
|
|
166
|
+
"slategray": [112, 128, 144],
|
|
167
|
+
"slategrey": [112, 128, 144],
|
|
168
|
+
"snow": [255, 250, 250],
|
|
169
|
+
"springgreen": [0, 255, 127],
|
|
170
|
+
"steelblue": [70, 130, 180],
|
|
171
|
+
"tan": [210, 180, 140],
|
|
172
|
+
"teal": [0, 128, 128],
|
|
173
|
+
"thistle": [216, 191, 216],
|
|
174
|
+
"tomato": [255, 99, 71],
|
|
175
|
+
"turquoise": [64, 224, 208],
|
|
176
|
+
"violet": [238, 130, 238],
|
|
177
|
+
"wheat": [245, 222, 179],
|
|
178
|
+
"white": [255, 255, 255],
|
|
179
|
+
"whitesmoke": [245, 245, 245],
|
|
180
|
+
"yellow": [255, 255, 0],
|
|
181
|
+
"yellowgreen": [154, 205, 50]
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
// node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/conversions.js
|
|
187
|
+
var require_conversions = __commonJS({
|
|
188
|
+
"node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/conversions.js"(exports, module2) {
|
|
189
|
+
var cssKeywords = require_color_name();
|
|
190
|
+
var reverseKeywords = {};
|
|
191
|
+
for (const key of Object.keys(cssKeywords)) {
|
|
192
|
+
reverseKeywords[cssKeywords[key]] = key;
|
|
193
|
+
}
|
|
194
|
+
var convert = {
|
|
195
|
+
rgb: { channels: 3, labels: "rgb" },
|
|
196
|
+
hsl: { channels: 3, labels: "hsl" },
|
|
197
|
+
hsv: { channels: 3, labels: "hsv" },
|
|
198
|
+
hwb: { channels: 3, labels: "hwb" },
|
|
199
|
+
cmyk: { channels: 4, labels: "cmyk" },
|
|
200
|
+
xyz: { channels: 3, labels: "xyz" },
|
|
201
|
+
lab: { channels: 3, labels: "lab" },
|
|
202
|
+
lch: { channels: 3, labels: "lch" },
|
|
203
|
+
hex: { channels: 1, labels: ["hex"] },
|
|
204
|
+
keyword: { channels: 1, labels: ["keyword"] },
|
|
205
|
+
ansi16: { channels: 1, labels: ["ansi16"] },
|
|
206
|
+
ansi256: { channels: 1, labels: ["ansi256"] },
|
|
207
|
+
hcg: { channels: 3, labels: ["h", "c", "g"] },
|
|
208
|
+
apple: { channels: 3, labels: ["r16", "g16", "b16"] },
|
|
209
|
+
gray: { channels: 1, labels: ["gray"] }
|
|
210
|
+
};
|
|
211
|
+
module2.exports = convert;
|
|
212
|
+
for (const model of Object.keys(convert)) {
|
|
213
|
+
if (!("channels" in convert[model])) {
|
|
214
|
+
throw new Error("missing channels property: " + model);
|
|
215
|
+
}
|
|
216
|
+
if (!("labels" in convert[model])) {
|
|
217
|
+
throw new Error("missing channel labels property: " + model);
|
|
218
|
+
}
|
|
219
|
+
if (convert[model].labels.length !== convert[model].channels) {
|
|
220
|
+
throw new Error("channel and label counts mismatch: " + model);
|
|
221
|
+
}
|
|
222
|
+
const { channels, labels } = convert[model];
|
|
223
|
+
delete convert[model].channels;
|
|
224
|
+
delete convert[model].labels;
|
|
225
|
+
Object.defineProperty(convert[model], "channels", { value: channels });
|
|
226
|
+
Object.defineProperty(convert[model], "labels", { value: labels });
|
|
227
|
+
}
|
|
228
|
+
convert.rgb.hsl = function(rgb) {
|
|
229
|
+
const r = rgb[0] / 255;
|
|
230
|
+
const g = rgb[1] / 255;
|
|
231
|
+
const b = rgb[2] / 255;
|
|
232
|
+
const min = Math.min(r, g, b);
|
|
233
|
+
const max = Math.max(r, g, b);
|
|
234
|
+
const delta = max - min;
|
|
235
|
+
let h;
|
|
236
|
+
let s;
|
|
237
|
+
if (max === min) {
|
|
238
|
+
h = 0;
|
|
239
|
+
} else if (r === max) {
|
|
240
|
+
h = (g - b) / delta;
|
|
241
|
+
} else if (g === max) {
|
|
242
|
+
h = 2 + (b - r) / delta;
|
|
243
|
+
} else if (b === max) {
|
|
244
|
+
h = 4 + (r - g) / delta;
|
|
245
|
+
}
|
|
246
|
+
h = Math.min(h * 60, 360);
|
|
247
|
+
if (h < 0) {
|
|
248
|
+
h += 360;
|
|
249
|
+
}
|
|
250
|
+
const l = (min + max) / 2;
|
|
251
|
+
if (max === min) {
|
|
252
|
+
s = 0;
|
|
253
|
+
} else if (l <= 0.5) {
|
|
254
|
+
s = delta / (max + min);
|
|
255
|
+
} else {
|
|
256
|
+
s = delta / (2 - max - min);
|
|
257
|
+
}
|
|
258
|
+
return [h, s * 100, l * 100];
|
|
259
|
+
};
|
|
260
|
+
convert.rgb.hsv = function(rgb) {
|
|
261
|
+
let rdif;
|
|
262
|
+
let gdif;
|
|
263
|
+
let bdif;
|
|
264
|
+
let h;
|
|
265
|
+
let s;
|
|
266
|
+
const r = rgb[0] / 255;
|
|
267
|
+
const g = rgb[1] / 255;
|
|
268
|
+
const b = rgb[2] / 255;
|
|
269
|
+
const v = Math.max(r, g, b);
|
|
270
|
+
const diff = v - Math.min(r, g, b);
|
|
271
|
+
const diffc = function(c) {
|
|
272
|
+
return (v - c) / 6 / diff + 1 / 2;
|
|
273
|
+
};
|
|
274
|
+
if (diff === 0) {
|
|
275
|
+
h = 0;
|
|
276
|
+
s = 0;
|
|
277
|
+
} else {
|
|
278
|
+
s = diff / v;
|
|
279
|
+
rdif = diffc(r);
|
|
280
|
+
gdif = diffc(g);
|
|
281
|
+
bdif = diffc(b);
|
|
282
|
+
if (r === v) {
|
|
283
|
+
h = bdif - gdif;
|
|
284
|
+
} else if (g === v) {
|
|
285
|
+
h = 1 / 3 + rdif - bdif;
|
|
286
|
+
} else if (b === v) {
|
|
287
|
+
h = 2 / 3 + gdif - rdif;
|
|
288
|
+
}
|
|
289
|
+
if (h < 0) {
|
|
290
|
+
h += 1;
|
|
291
|
+
} else if (h > 1) {
|
|
292
|
+
h -= 1;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
return [
|
|
296
|
+
h * 360,
|
|
297
|
+
s * 100,
|
|
298
|
+
v * 100
|
|
299
|
+
];
|
|
300
|
+
};
|
|
301
|
+
convert.rgb.hwb = function(rgb) {
|
|
302
|
+
const r = rgb[0];
|
|
303
|
+
const g = rgb[1];
|
|
304
|
+
let b = rgb[2];
|
|
305
|
+
const h = convert.rgb.hsl(rgb)[0];
|
|
306
|
+
const w = 1 / 255 * Math.min(r, Math.min(g, b));
|
|
307
|
+
b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
|
|
308
|
+
return [h, w * 100, b * 100];
|
|
309
|
+
};
|
|
310
|
+
convert.rgb.cmyk = function(rgb) {
|
|
311
|
+
const r = rgb[0] / 255;
|
|
312
|
+
const g = rgb[1] / 255;
|
|
313
|
+
const b = rgb[2] / 255;
|
|
314
|
+
const k = Math.min(1 - r, 1 - g, 1 - b);
|
|
315
|
+
const c = (1 - r - k) / (1 - k) || 0;
|
|
316
|
+
const m = (1 - g - k) / (1 - k) || 0;
|
|
317
|
+
const y = (1 - b - k) / (1 - k) || 0;
|
|
318
|
+
return [c * 100, m * 100, y * 100, k * 100];
|
|
319
|
+
};
|
|
320
|
+
function comparativeDistance(x, y) {
|
|
321
|
+
return (x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2 + (x[2] - y[2]) ** 2;
|
|
322
|
+
}
|
|
323
|
+
convert.rgb.keyword = function(rgb) {
|
|
324
|
+
const reversed = reverseKeywords[rgb];
|
|
325
|
+
if (reversed) {
|
|
326
|
+
return reversed;
|
|
327
|
+
}
|
|
328
|
+
let currentClosestDistance = Infinity;
|
|
329
|
+
let currentClosestKeyword;
|
|
330
|
+
for (const keyword of Object.keys(cssKeywords)) {
|
|
331
|
+
const value = cssKeywords[keyword];
|
|
332
|
+
const distance = comparativeDistance(rgb, value);
|
|
333
|
+
if (distance < currentClosestDistance) {
|
|
334
|
+
currentClosestDistance = distance;
|
|
335
|
+
currentClosestKeyword = keyword;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
return currentClosestKeyword;
|
|
339
|
+
};
|
|
340
|
+
convert.keyword.rgb = function(keyword) {
|
|
341
|
+
return cssKeywords[keyword];
|
|
342
|
+
};
|
|
343
|
+
convert.rgb.xyz = function(rgb) {
|
|
344
|
+
let r = rgb[0] / 255;
|
|
345
|
+
let g = rgb[1] / 255;
|
|
346
|
+
let b = rgb[2] / 255;
|
|
347
|
+
r = r > 0.04045 ? ((r + 0.055) / 1.055) ** 2.4 : r / 12.92;
|
|
348
|
+
g = g > 0.04045 ? ((g + 0.055) / 1.055) ** 2.4 : g / 12.92;
|
|
349
|
+
b = b > 0.04045 ? ((b + 0.055) / 1.055) ** 2.4 : b / 12.92;
|
|
350
|
+
const x = r * 0.4124 + g * 0.3576 + b * 0.1805;
|
|
351
|
+
const y = r * 0.2126 + g * 0.7152 + b * 0.0722;
|
|
352
|
+
const z = r * 0.0193 + g * 0.1192 + b * 0.9505;
|
|
353
|
+
return [x * 100, y * 100, z * 100];
|
|
354
|
+
};
|
|
355
|
+
convert.rgb.lab = function(rgb) {
|
|
356
|
+
const xyz = convert.rgb.xyz(rgb);
|
|
357
|
+
let x = xyz[0];
|
|
358
|
+
let y = xyz[1];
|
|
359
|
+
let z = xyz[2];
|
|
360
|
+
x /= 95.047;
|
|
361
|
+
y /= 100;
|
|
362
|
+
z /= 108.883;
|
|
363
|
+
x = x > 8856e-6 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
|
|
364
|
+
y = y > 8856e-6 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
|
|
365
|
+
z = z > 8856e-6 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
|
|
366
|
+
const l = 116 * y - 16;
|
|
367
|
+
const a = 500 * (x - y);
|
|
368
|
+
const b = 200 * (y - z);
|
|
369
|
+
return [l, a, b];
|
|
370
|
+
};
|
|
371
|
+
convert.hsl.rgb = function(hsl) {
|
|
372
|
+
const h = hsl[0] / 360;
|
|
373
|
+
const s = hsl[1] / 100;
|
|
374
|
+
const l = hsl[2] / 100;
|
|
375
|
+
let t2;
|
|
376
|
+
let t3;
|
|
377
|
+
let val;
|
|
378
|
+
if (s === 0) {
|
|
379
|
+
val = l * 255;
|
|
380
|
+
return [val, val, val];
|
|
381
|
+
}
|
|
382
|
+
if (l < 0.5) {
|
|
383
|
+
t2 = l * (1 + s);
|
|
384
|
+
} else {
|
|
385
|
+
t2 = l + s - l * s;
|
|
386
|
+
}
|
|
387
|
+
const t1 = 2 * l - t2;
|
|
388
|
+
const rgb = [0, 0, 0];
|
|
389
|
+
for (let i = 0; i < 3; i++) {
|
|
390
|
+
t3 = h + 1 / 3 * -(i - 1);
|
|
391
|
+
if (t3 < 0) {
|
|
392
|
+
t3++;
|
|
393
|
+
}
|
|
394
|
+
if (t3 > 1) {
|
|
395
|
+
t3--;
|
|
396
|
+
}
|
|
397
|
+
if (6 * t3 < 1) {
|
|
398
|
+
val = t1 + (t2 - t1) * 6 * t3;
|
|
399
|
+
} else if (2 * t3 < 1) {
|
|
400
|
+
val = t2;
|
|
401
|
+
} else if (3 * t3 < 2) {
|
|
402
|
+
val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
|
|
403
|
+
} else {
|
|
404
|
+
val = t1;
|
|
405
|
+
}
|
|
406
|
+
rgb[i] = val * 255;
|
|
407
|
+
}
|
|
408
|
+
return rgb;
|
|
409
|
+
};
|
|
410
|
+
convert.hsl.hsv = function(hsl) {
|
|
411
|
+
const h = hsl[0];
|
|
412
|
+
let s = hsl[1] / 100;
|
|
413
|
+
let l = hsl[2] / 100;
|
|
414
|
+
let smin = s;
|
|
415
|
+
const lmin = Math.max(l, 0.01);
|
|
416
|
+
l *= 2;
|
|
417
|
+
s *= l <= 1 ? l : 2 - l;
|
|
418
|
+
smin *= lmin <= 1 ? lmin : 2 - lmin;
|
|
419
|
+
const v = (l + s) / 2;
|
|
420
|
+
const sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s);
|
|
421
|
+
return [h, sv * 100, v * 100];
|
|
422
|
+
};
|
|
423
|
+
convert.hsv.rgb = function(hsv) {
|
|
424
|
+
const h = hsv[0] / 60;
|
|
425
|
+
const s = hsv[1] / 100;
|
|
426
|
+
let v = hsv[2] / 100;
|
|
427
|
+
const hi = Math.floor(h) % 6;
|
|
428
|
+
const f = h - Math.floor(h);
|
|
429
|
+
const p = 255 * v * (1 - s);
|
|
430
|
+
const q = 255 * v * (1 - s * f);
|
|
431
|
+
const t = 255 * v * (1 - s * (1 - f));
|
|
432
|
+
v *= 255;
|
|
433
|
+
switch (hi) {
|
|
434
|
+
case 0:
|
|
435
|
+
return [v, t, p];
|
|
436
|
+
case 1:
|
|
437
|
+
return [q, v, p];
|
|
438
|
+
case 2:
|
|
439
|
+
return [p, v, t];
|
|
440
|
+
case 3:
|
|
441
|
+
return [p, q, v];
|
|
442
|
+
case 4:
|
|
443
|
+
return [t, p, v];
|
|
444
|
+
case 5:
|
|
445
|
+
return [v, p, q];
|
|
446
|
+
}
|
|
447
|
+
};
|
|
448
|
+
convert.hsv.hsl = function(hsv) {
|
|
449
|
+
const h = hsv[0];
|
|
450
|
+
const s = hsv[1] / 100;
|
|
451
|
+
const v = hsv[2] / 100;
|
|
452
|
+
const vmin = Math.max(v, 0.01);
|
|
453
|
+
let sl;
|
|
454
|
+
let l;
|
|
455
|
+
l = (2 - s) * v;
|
|
456
|
+
const lmin = (2 - s) * vmin;
|
|
457
|
+
sl = s * vmin;
|
|
458
|
+
sl /= lmin <= 1 ? lmin : 2 - lmin;
|
|
459
|
+
sl = sl || 0;
|
|
460
|
+
l /= 2;
|
|
461
|
+
return [h, sl * 100, l * 100];
|
|
462
|
+
};
|
|
463
|
+
convert.hwb.rgb = function(hwb) {
|
|
464
|
+
const h = hwb[0] / 360;
|
|
465
|
+
let wh = hwb[1] / 100;
|
|
466
|
+
let bl = hwb[2] / 100;
|
|
467
|
+
const ratio = wh + bl;
|
|
468
|
+
let f;
|
|
469
|
+
if (ratio > 1) {
|
|
470
|
+
wh /= ratio;
|
|
471
|
+
bl /= ratio;
|
|
472
|
+
}
|
|
473
|
+
const i = Math.floor(6 * h);
|
|
474
|
+
const v = 1 - bl;
|
|
475
|
+
f = 6 * h - i;
|
|
476
|
+
if ((i & 1) !== 0) {
|
|
477
|
+
f = 1 - f;
|
|
478
|
+
}
|
|
479
|
+
const n = wh + f * (v - wh);
|
|
480
|
+
let r;
|
|
481
|
+
let g;
|
|
482
|
+
let b;
|
|
483
|
+
switch (i) {
|
|
484
|
+
default:
|
|
485
|
+
case 6:
|
|
486
|
+
case 0:
|
|
487
|
+
r = v;
|
|
488
|
+
g = n;
|
|
489
|
+
b = wh;
|
|
490
|
+
break;
|
|
491
|
+
case 1:
|
|
492
|
+
r = n;
|
|
493
|
+
g = v;
|
|
494
|
+
b = wh;
|
|
495
|
+
break;
|
|
496
|
+
case 2:
|
|
497
|
+
r = wh;
|
|
498
|
+
g = v;
|
|
499
|
+
b = n;
|
|
500
|
+
break;
|
|
501
|
+
case 3:
|
|
502
|
+
r = wh;
|
|
503
|
+
g = n;
|
|
504
|
+
b = v;
|
|
505
|
+
break;
|
|
506
|
+
case 4:
|
|
507
|
+
r = n;
|
|
508
|
+
g = wh;
|
|
509
|
+
b = v;
|
|
510
|
+
break;
|
|
511
|
+
case 5:
|
|
512
|
+
r = v;
|
|
513
|
+
g = wh;
|
|
514
|
+
b = n;
|
|
515
|
+
break;
|
|
516
|
+
}
|
|
517
|
+
return [r * 255, g * 255, b * 255];
|
|
518
|
+
};
|
|
519
|
+
convert.cmyk.rgb = function(cmyk) {
|
|
520
|
+
const c = cmyk[0] / 100;
|
|
521
|
+
const m = cmyk[1] / 100;
|
|
522
|
+
const y = cmyk[2] / 100;
|
|
523
|
+
const k = cmyk[3] / 100;
|
|
524
|
+
const r = 1 - Math.min(1, c * (1 - k) + k);
|
|
525
|
+
const g = 1 - Math.min(1, m * (1 - k) + k);
|
|
526
|
+
const b = 1 - Math.min(1, y * (1 - k) + k);
|
|
527
|
+
return [r * 255, g * 255, b * 255];
|
|
528
|
+
};
|
|
529
|
+
convert.xyz.rgb = function(xyz) {
|
|
530
|
+
const x = xyz[0] / 100;
|
|
531
|
+
const y = xyz[1] / 100;
|
|
532
|
+
const z = xyz[2] / 100;
|
|
533
|
+
let r;
|
|
534
|
+
let g;
|
|
535
|
+
let b;
|
|
536
|
+
r = x * 3.2406 + y * -1.5372 + z * -0.4986;
|
|
537
|
+
g = x * -0.9689 + y * 1.8758 + z * 0.0415;
|
|
538
|
+
b = x * 0.0557 + y * -0.204 + z * 1.057;
|
|
539
|
+
r = r > 31308e-7 ? 1.055 * r ** (1 / 2.4) - 0.055 : r * 12.92;
|
|
540
|
+
g = g > 31308e-7 ? 1.055 * g ** (1 / 2.4) - 0.055 : g * 12.92;
|
|
541
|
+
b = b > 31308e-7 ? 1.055 * b ** (1 / 2.4) - 0.055 : b * 12.92;
|
|
542
|
+
r = Math.min(Math.max(0, r), 1);
|
|
543
|
+
g = Math.min(Math.max(0, g), 1);
|
|
544
|
+
b = Math.min(Math.max(0, b), 1);
|
|
545
|
+
return [r * 255, g * 255, b * 255];
|
|
546
|
+
};
|
|
547
|
+
convert.xyz.lab = function(xyz) {
|
|
548
|
+
let x = xyz[0];
|
|
549
|
+
let y = xyz[1];
|
|
550
|
+
let z = xyz[2];
|
|
551
|
+
x /= 95.047;
|
|
552
|
+
y /= 100;
|
|
553
|
+
z /= 108.883;
|
|
554
|
+
x = x > 8856e-6 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
|
|
555
|
+
y = y > 8856e-6 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
|
|
556
|
+
z = z > 8856e-6 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
|
|
557
|
+
const l = 116 * y - 16;
|
|
558
|
+
const a = 500 * (x - y);
|
|
559
|
+
const b = 200 * (y - z);
|
|
560
|
+
return [l, a, b];
|
|
561
|
+
};
|
|
562
|
+
convert.lab.xyz = function(lab) {
|
|
563
|
+
const l = lab[0];
|
|
564
|
+
const a = lab[1];
|
|
565
|
+
const b = lab[2];
|
|
566
|
+
let x;
|
|
567
|
+
let y;
|
|
568
|
+
let z;
|
|
569
|
+
y = (l + 16) / 116;
|
|
570
|
+
x = a / 500 + y;
|
|
571
|
+
z = y - b / 200;
|
|
572
|
+
const y2 = y ** 3;
|
|
573
|
+
const x2 = x ** 3;
|
|
574
|
+
const z2 = z ** 3;
|
|
575
|
+
y = y2 > 8856e-6 ? y2 : (y - 16 / 116) / 7.787;
|
|
576
|
+
x = x2 > 8856e-6 ? x2 : (x - 16 / 116) / 7.787;
|
|
577
|
+
z = z2 > 8856e-6 ? z2 : (z - 16 / 116) / 7.787;
|
|
578
|
+
x *= 95.047;
|
|
579
|
+
y *= 100;
|
|
580
|
+
z *= 108.883;
|
|
581
|
+
return [x, y, z];
|
|
582
|
+
};
|
|
583
|
+
convert.lab.lch = function(lab) {
|
|
584
|
+
const l = lab[0];
|
|
585
|
+
const a = lab[1];
|
|
586
|
+
const b = lab[2];
|
|
587
|
+
let h;
|
|
588
|
+
const hr = Math.atan2(b, a);
|
|
589
|
+
h = hr * 360 / 2 / Math.PI;
|
|
590
|
+
if (h < 0) {
|
|
591
|
+
h += 360;
|
|
592
|
+
}
|
|
593
|
+
const c = Math.sqrt(a * a + b * b);
|
|
594
|
+
return [l, c, h];
|
|
595
|
+
};
|
|
596
|
+
convert.lch.lab = function(lch) {
|
|
597
|
+
const l = lch[0];
|
|
598
|
+
const c = lch[1];
|
|
599
|
+
const h = lch[2];
|
|
600
|
+
const hr = h / 360 * 2 * Math.PI;
|
|
601
|
+
const a = c * Math.cos(hr);
|
|
602
|
+
const b = c * Math.sin(hr);
|
|
603
|
+
return [l, a, b];
|
|
604
|
+
};
|
|
605
|
+
convert.rgb.ansi16 = function(args, saturation = null) {
|
|
606
|
+
const [r, g, b] = args;
|
|
607
|
+
let value = saturation === null ? convert.rgb.hsv(args)[2] : saturation;
|
|
608
|
+
value = Math.round(value / 50);
|
|
609
|
+
if (value === 0) {
|
|
610
|
+
return 30;
|
|
611
|
+
}
|
|
612
|
+
let ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r / 255));
|
|
613
|
+
if (value === 2) {
|
|
614
|
+
ansi += 60;
|
|
615
|
+
}
|
|
616
|
+
return ansi;
|
|
617
|
+
};
|
|
618
|
+
convert.hsv.ansi16 = function(args) {
|
|
619
|
+
return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
|
|
620
|
+
};
|
|
621
|
+
convert.rgb.ansi256 = function(args) {
|
|
622
|
+
const r = args[0];
|
|
623
|
+
const g = args[1];
|
|
624
|
+
const b = args[2];
|
|
625
|
+
if (r === g && g === b) {
|
|
626
|
+
if (r < 8) {
|
|
627
|
+
return 16;
|
|
628
|
+
}
|
|
629
|
+
if (r > 248) {
|
|
630
|
+
return 231;
|
|
631
|
+
}
|
|
632
|
+
return Math.round((r - 8) / 247 * 24) + 232;
|
|
633
|
+
}
|
|
634
|
+
const ansi = 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5);
|
|
635
|
+
return ansi;
|
|
636
|
+
};
|
|
637
|
+
convert.ansi16.rgb = function(args) {
|
|
638
|
+
let color = args % 10;
|
|
639
|
+
if (color === 0 || color === 7) {
|
|
640
|
+
if (args > 50) {
|
|
641
|
+
color += 3.5;
|
|
642
|
+
}
|
|
643
|
+
color = color / 10.5 * 255;
|
|
644
|
+
return [color, color, color];
|
|
645
|
+
}
|
|
646
|
+
const mult = (~~(args > 50) + 1) * 0.5;
|
|
647
|
+
const r = (color & 1) * mult * 255;
|
|
648
|
+
const g = (color >> 1 & 1) * mult * 255;
|
|
649
|
+
const b = (color >> 2 & 1) * mult * 255;
|
|
650
|
+
return [r, g, b];
|
|
651
|
+
};
|
|
652
|
+
convert.ansi256.rgb = function(args) {
|
|
653
|
+
if (args >= 232) {
|
|
654
|
+
const c = (args - 232) * 10 + 8;
|
|
655
|
+
return [c, c, c];
|
|
656
|
+
}
|
|
657
|
+
args -= 16;
|
|
658
|
+
let rem;
|
|
659
|
+
const r = Math.floor(args / 36) / 5 * 255;
|
|
660
|
+
const g = Math.floor((rem = args % 36) / 6) / 5 * 255;
|
|
661
|
+
const b = rem % 6 / 5 * 255;
|
|
662
|
+
return [r, g, b];
|
|
663
|
+
};
|
|
664
|
+
convert.rgb.hex = function(args) {
|
|
665
|
+
const integer = ((Math.round(args[0]) & 255) << 16) + ((Math.round(args[1]) & 255) << 8) + (Math.round(args[2]) & 255);
|
|
666
|
+
const string = integer.toString(16).toUpperCase();
|
|
667
|
+
return "000000".substring(string.length) + string;
|
|
668
|
+
};
|
|
669
|
+
convert.hex.rgb = function(args) {
|
|
670
|
+
const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
|
|
671
|
+
if (!match) {
|
|
672
|
+
return [0, 0, 0];
|
|
673
|
+
}
|
|
674
|
+
let colorString = match[0];
|
|
675
|
+
if (match[0].length === 3) {
|
|
676
|
+
colorString = colorString.split("").map((char) => {
|
|
677
|
+
return char + char;
|
|
678
|
+
}).join("");
|
|
679
|
+
}
|
|
680
|
+
const integer = parseInt(colorString, 16);
|
|
681
|
+
const r = integer >> 16 & 255;
|
|
682
|
+
const g = integer >> 8 & 255;
|
|
683
|
+
const b = integer & 255;
|
|
684
|
+
return [r, g, b];
|
|
685
|
+
};
|
|
686
|
+
convert.rgb.hcg = function(rgb) {
|
|
687
|
+
const r = rgb[0] / 255;
|
|
688
|
+
const g = rgb[1] / 255;
|
|
689
|
+
const b = rgb[2] / 255;
|
|
690
|
+
const max = Math.max(Math.max(r, g), b);
|
|
691
|
+
const min = Math.min(Math.min(r, g), b);
|
|
692
|
+
const chroma = max - min;
|
|
693
|
+
let grayscale;
|
|
694
|
+
let hue;
|
|
695
|
+
if (chroma < 1) {
|
|
696
|
+
grayscale = min / (1 - chroma);
|
|
697
|
+
} else {
|
|
698
|
+
grayscale = 0;
|
|
699
|
+
}
|
|
700
|
+
if (chroma <= 0) {
|
|
701
|
+
hue = 0;
|
|
702
|
+
} else if (max === r) {
|
|
703
|
+
hue = (g - b) / chroma % 6;
|
|
704
|
+
} else if (max === g) {
|
|
705
|
+
hue = 2 + (b - r) / chroma;
|
|
706
|
+
} else {
|
|
707
|
+
hue = 4 + (r - g) / chroma;
|
|
708
|
+
}
|
|
709
|
+
hue /= 6;
|
|
710
|
+
hue %= 1;
|
|
711
|
+
return [hue * 360, chroma * 100, grayscale * 100];
|
|
712
|
+
};
|
|
713
|
+
convert.hsl.hcg = function(hsl) {
|
|
714
|
+
const s = hsl[1] / 100;
|
|
715
|
+
const l = hsl[2] / 100;
|
|
716
|
+
const c = l < 0.5 ? 2 * s * l : 2 * s * (1 - l);
|
|
717
|
+
let f = 0;
|
|
718
|
+
if (c < 1) {
|
|
719
|
+
f = (l - 0.5 * c) / (1 - c);
|
|
720
|
+
}
|
|
721
|
+
return [hsl[0], c * 100, f * 100];
|
|
722
|
+
};
|
|
723
|
+
convert.hsv.hcg = function(hsv) {
|
|
724
|
+
const s = hsv[1] / 100;
|
|
725
|
+
const v = hsv[2] / 100;
|
|
726
|
+
const c = s * v;
|
|
727
|
+
let f = 0;
|
|
728
|
+
if (c < 1) {
|
|
729
|
+
f = (v - c) / (1 - c);
|
|
730
|
+
}
|
|
731
|
+
return [hsv[0], c * 100, f * 100];
|
|
732
|
+
};
|
|
733
|
+
convert.hcg.rgb = function(hcg) {
|
|
734
|
+
const h = hcg[0] / 360;
|
|
735
|
+
const c = hcg[1] / 100;
|
|
736
|
+
const g = hcg[2] / 100;
|
|
737
|
+
if (c === 0) {
|
|
738
|
+
return [g * 255, g * 255, g * 255];
|
|
739
|
+
}
|
|
740
|
+
const pure = [0, 0, 0];
|
|
741
|
+
const hi = h % 1 * 6;
|
|
742
|
+
const v = hi % 1;
|
|
743
|
+
const w = 1 - v;
|
|
744
|
+
let mg = 0;
|
|
745
|
+
switch (Math.floor(hi)) {
|
|
746
|
+
case 0:
|
|
747
|
+
pure[0] = 1;
|
|
748
|
+
pure[1] = v;
|
|
749
|
+
pure[2] = 0;
|
|
750
|
+
break;
|
|
751
|
+
case 1:
|
|
752
|
+
pure[0] = w;
|
|
753
|
+
pure[1] = 1;
|
|
754
|
+
pure[2] = 0;
|
|
755
|
+
break;
|
|
756
|
+
case 2:
|
|
757
|
+
pure[0] = 0;
|
|
758
|
+
pure[1] = 1;
|
|
759
|
+
pure[2] = v;
|
|
760
|
+
break;
|
|
761
|
+
case 3:
|
|
762
|
+
pure[0] = 0;
|
|
763
|
+
pure[1] = w;
|
|
764
|
+
pure[2] = 1;
|
|
765
|
+
break;
|
|
766
|
+
case 4:
|
|
767
|
+
pure[0] = v;
|
|
768
|
+
pure[1] = 0;
|
|
769
|
+
pure[2] = 1;
|
|
770
|
+
break;
|
|
771
|
+
default:
|
|
772
|
+
pure[0] = 1;
|
|
773
|
+
pure[1] = 0;
|
|
774
|
+
pure[2] = w;
|
|
775
|
+
}
|
|
776
|
+
mg = (1 - c) * g;
|
|
777
|
+
return [
|
|
778
|
+
(c * pure[0] + mg) * 255,
|
|
779
|
+
(c * pure[1] + mg) * 255,
|
|
780
|
+
(c * pure[2] + mg) * 255
|
|
781
|
+
];
|
|
782
|
+
};
|
|
783
|
+
convert.hcg.hsv = function(hcg) {
|
|
784
|
+
const c = hcg[1] / 100;
|
|
785
|
+
const g = hcg[2] / 100;
|
|
786
|
+
const v = c + g * (1 - c);
|
|
787
|
+
let f = 0;
|
|
788
|
+
if (v > 0) {
|
|
789
|
+
f = c / v;
|
|
790
|
+
}
|
|
791
|
+
return [hcg[0], f * 100, v * 100];
|
|
792
|
+
};
|
|
793
|
+
convert.hcg.hsl = function(hcg) {
|
|
794
|
+
const c = hcg[1] / 100;
|
|
795
|
+
const g = hcg[2] / 100;
|
|
796
|
+
const l = g * (1 - c) + 0.5 * c;
|
|
797
|
+
let s = 0;
|
|
798
|
+
if (l > 0 && l < 0.5) {
|
|
799
|
+
s = c / (2 * l);
|
|
800
|
+
} else if (l >= 0.5 && l < 1) {
|
|
801
|
+
s = c / (2 * (1 - l));
|
|
802
|
+
}
|
|
803
|
+
return [hcg[0], s * 100, l * 100];
|
|
804
|
+
};
|
|
805
|
+
convert.hcg.hwb = function(hcg) {
|
|
806
|
+
const c = hcg[1] / 100;
|
|
807
|
+
const g = hcg[2] / 100;
|
|
808
|
+
const v = c + g * (1 - c);
|
|
809
|
+
return [hcg[0], (v - c) * 100, (1 - v) * 100];
|
|
810
|
+
};
|
|
811
|
+
convert.hwb.hcg = function(hwb) {
|
|
812
|
+
const w = hwb[1] / 100;
|
|
813
|
+
const b = hwb[2] / 100;
|
|
814
|
+
const v = 1 - b;
|
|
815
|
+
const c = v - w;
|
|
816
|
+
let g = 0;
|
|
817
|
+
if (c < 1) {
|
|
818
|
+
g = (v - c) / (1 - c);
|
|
819
|
+
}
|
|
820
|
+
return [hwb[0], c * 100, g * 100];
|
|
821
|
+
};
|
|
822
|
+
convert.apple.rgb = function(apple) {
|
|
823
|
+
return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
|
|
824
|
+
};
|
|
825
|
+
convert.rgb.apple = function(rgb) {
|
|
826
|
+
return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535];
|
|
827
|
+
};
|
|
828
|
+
convert.gray.rgb = function(args) {
|
|
829
|
+
return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
|
|
830
|
+
};
|
|
831
|
+
convert.gray.hsl = function(args) {
|
|
832
|
+
return [0, 0, args[0]];
|
|
833
|
+
};
|
|
834
|
+
convert.gray.hsv = convert.gray.hsl;
|
|
835
|
+
convert.gray.hwb = function(gray) {
|
|
836
|
+
return [0, 100, gray[0]];
|
|
837
|
+
};
|
|
838
|
+
convert.gray.cmyk = function(gray) {
|
|
839
|
+
return [0, 0, 0, gray[0]];
|
|
840
|
+
};
|
|
841
|
+
convert.gray.lab = function(gray) {
|
|
842
|
+
return [gray[0], 0, 0];
|
|
843
|
+
};
|
|
844
|
+
convert.gray.hex = function(gray) {
|
|
845
|
+
const val = Math.round(gray[0] / 100 * 255) & 255;
|
|
846
|
+
const integer = (val << 16) + (val << 8) + val;
|
|
847
|
+
const string = integer.toString(16).toUpperCase();
|
|
848
|
+
return "000000".substring(string.length) + string;
|
|
849
|
+
};
|
|
850
|
+
convert.rgb.gray = function(rgb) {
|
|
851
|
+
const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
|
|
852
|
+
return [val / 255 * 100];
|
|
853
|
+
};
|
|
854
|
+
}
|
|
855
|
+
});
|
|
856
|
+
|
|
857
|
+
// node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/route.js
|
|
858
|
+
var require_route = __commonJS({
|
|
859
|
+
"node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/route.js"(exports, module2) {
|
|
860
|
+
var conversions = require_conversions();
|
|
861
|
+
function buildGraph() {
|
|
862
|
+
const graph = {};
|
|
863
|
+
const models = Object.keys(conversions);
|
|
864
|
+
for (let len = models.length, i = 0; i < len; i++) {
|
|
865
|
+
graph[models[i]] = {
|
|
866
|
+
distance: -1,
|
|
867
|
+
parent: null
|
|
868
|
+
};
|
|
869
|
+
}
|
|
870
|
+
return graph;
|
|
871
|
+
}
|
|
872
|
+
function deriveBFS(fromModel) {
|
|
873
|
+
const graph = buildGraph();
|
|
874
|
+
const queue = [fromModel];
|
|
875
|
+
graph[fromModel].distance = 0;
|
|
876
|
+
while (queue.length) {
|
|
877
|
+
const current = queue.pop();
|
|
878
|
+
const adjacents = Object.keys(conversions[current]);
|
|
879
|
+
for (let len = adjacents.length, i = 0; i < len; i++) {
|
|
880
|
+
const adjacent = adjacents[i];
|
|
881
|
+
const node = graph[adjacent];
|
|
882
|
+
if (node.distance === -1) {
|
|
883
|
+
node.distance = graph[current].distance + 1;
|
|
884
|
+
node.parent = current;
|
|
885
|
+
queue.unshift(adjacent);
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
return graph;
|
|
890
|
+
}
|
|
891
|
+
function link(from, to) {
|
|
892
|
+
return function(args) {
|
|
893
|
+
return to(from(args));
|
|
894
|
+
};
|
|
895
|
+
}
|
|
896
|
+
function wrapConversion(toModel, graph) {
|
|
897
|
+
const path = [graph[toModel].parent, toModel];
|
|
898
|
+
let fn = conversions[graph[toModel].parent][toModel];
|
|
899
|
+
let cur = graph[toModel].parent;
|
|
900
|
+
while (graph[cur].parent) {
|
|
901
|
+
path.unshift(graph[cur].parent);
|
|
902
|
+
fn = link(conversions[graph[cur].parent][cur], fn);
|
|
903
|
+
cur = graph[cur].parent;
|
|
904
|
+
}
|
|
905
|
+
fn.conversion = path;
|
|
906
|
+
return fn;
|
|
907
|
+
}
|
|
908
|
+
module2.exports = function(fromModel) {
|
|
909
|
+
const graph = deriveBFS(fromModel);
|
|
910
|
+
const conversion = {};
|
|
911
|
+
const models = Object.keys(graph);
|
|
912
|
+
for (let len = models.length, i = 0; i < len; i++) {
|
|
913
|
+
const toModel = models[i];
|
|
914
|
+
const node = graph[toModel];
|
|
915
|
+
if (node.parent === null) {
|
|
916
|
+
continue;
|
|
917
|
+
}
|
|
918
|
+
conversion[toModel] = wrapConversion(toModel, graph);
|
|
919
|
+
}
|
|
920
|
+
return conversion;
|
|
921
|
+
};
|
|
922
|
+
}
|
|
923
|
+
});
|
|
924
|
+
|
|
925
|
+
// node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/index.js
|
|
926
|
+
var require_color_convert = __commonJS({
|
|
927
|
+
"node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/index.js"(exports, module2) {
|
|
928
|
+
var conversions = require_conversions();
|
|
929
|
+
var route = require_route();
|
|
930
|
+
var convert = {};
|
|
931
|
+
var models = Object.keys(conversions);
|
|
932
|
+
function wrapRaw(fn) {
|
|
933
|
+
const wrappedFn = function(...args) {
|
|
934
|
+
const arg0 = args[0];
|
|
935
|
+
if (arg0 === void 0 || arg0 === null) {
|
|
936
|
+
return arg0;
|
|
937
|
+
}
|
|
938
|
+
if (arg0.length > 1) {
|
|
939
|
+
args = arg0;
|
|
940
|
+
}
|
|
941
|
+
return fn(args);
|
|
942
|
+
};
|
|
943
|
+
if ("conversion" in fn) {
|
|
944
|
+
wrappedFn.conversion = fn.conversion;
|
|
945
|
+
}
|
|
946
|
+
return wrappedFn;
|
|
947
|
+
}
|
|
948
|
+
function wrapRounded(fn) {
|
|
949
|
+
const wrappedFn = function(...args) {
|
|
950
|
+
const arg0 = args[0];
|
|
951
|
+
if (arg0 === void 0 || arg0 === null) {
|
|
952
|
+
return arg0;
|
|
953
|
+
}
|
|
954
|
+
if (arg0.length > 1) {
|
|
955
|
+
args = arg0;
|
|
956
|
+
}
|
|
957
|
+
const result = fn(args);
|
|
958
|
+
if (typeof result === "object") {
|
|
959
|
+
for (let len = result.length, i = 0; i < len; i++) {
|
|
960
|
+
result[i] = Math.round(result[i]);
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
return result;
|
|
964
|
+
};
|
|
965
|
+
if ("conversion" in fn) {
|
|
966
|
+
wrappedFn.conversion = fn.conversion;
|
|
967
|
+
}
|
|
968
|
+
return wrappedFn;
|
|
969
|
+
}
|
|
970
|
+
models.forEach((fromModel) => {
|
|
971
|
+
convert[fromModel] = {};
|
|
972
|
+
Object.defineProperty(convert[fromModel], "channels", { value: conversions[fromModel].channels });
|
|
973
|
+
Object.defineProperty(convert[fromModel], "labels", { value: conversions[fromModel].labels });
|
|
974
|
+
const routes = route(fromModel);
|
|
975
|
+
const routeModels = Object.keys(routes);
|
|
976
|
+
routeModels.forEach((toModel) => {
|
|
977
|
+
const fn = routes[toModel];
|
|
978
|
+
convert[fromModel][toModel] = wrapRounded(fn);
|
|
979
|
+
convert[fromModel][toModel].raw = wrapRaw(fn);
|
|
980
|
+
});
|
|
981
|
+
});
|
|
982
|
+
module2.exports = convert;
|
|
983
|
+
}
|
|
984
|
+
});
|
|
985
|
+
|
|
986
|
+
// node_modules/.pnpm/ansi-styles@4.3.0/node_modules/ansi-styles/index.js
|
|
987
|
+
var require_ansi_styles = __commonJS({
|
|
988
|
+
"node_modules/.pnpm/ansi-styles@4.3.0/node_modules/ansi-styles/index.js"(exports, module2) {
|
|
989
|
+
"use strict";
|
|
990
|
+
var wrapAnsi16 = (fn, offset) => (...args) => {
|
|
991
|
+
const code = fn(...args);
|
|
992
|
+
return `\x1B[${code + offset}m`;
|
|
993
|
+
};
|
|
994
|
+
var wrapAnsi256 = (fn, offset) => (...args) => {
|
|
995
|
+
const code = fn(...args);
|
|
996
|
+
return `\x1B[${38 + offset};5;${code}m`;
|
|
997
|
+
};
|
|
998
|
+
var wrapAnsi16m = (fn, offset) => (...args) => {
|
|
999
|
+
const rgb = fn(...args);
|
|
1000
|
+
return `\x1B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
|
|
1001
|
+
};
|
|
1002
|
+
var ansi2ansi = (n) => n;
|
|
1003
|
+
var rgb2rgb = (r, g, b) => [r, g, b];
|
|
1004
|
+
var 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
|
+
var colorConvert;
|
|
1020
|
+
var makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
|
|
1021
|
+
if (colorConvert === void 0) {
|
|
1022
|
+
colorConvert = require_color_convert();
|
|
1023
|
+
}
|
|
1024
|
+
const offset = isBackground ? 10 : 0;
|
|
1025
|
+
const styles = {};
|
|
1026
|
+
for (const [sourceSpace, suite] of Object.entries(colorConvert)) {
|
|
1027
|
+
const name = sourceSpace === "ansi16" ? "ansi" : sourceSpace;
|
|
1028
|
+
if (sourceSpace === targetSpace) {
|
|
1029
|
+
styles[name] = wrap(identity, offset);
|
|
1030
|
+
} else if (typeof suite === "object") {
|
|
1031
|
+
styles[name] = wrap(suite[targetSpace], offset);
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
return styles;
|
|
1035
|
+
};
|
|
1036
|
+
function assembleStyles() {
|
|
1037
|
+
const codes = /* @__PURE__ */ new Map();
|
|
1038
|
+
const styles = {
|
|
1039
|
+
modifier: {
|
|
1040
|
+
reset: [0, 0],
|
|
1041
|
+
bold: [1, 22],
|
|
1042
|
+
dim: [2, 22],
|
|
1043
|
+
italic: [3, 23],
|
|
1044
|
+
underline: [4, 24],
|
|
1045
|
+
inverse: [7, 27],
|
|
1046
|
+
hidden: [8, 28],
|
|
1047
|
+
strikethrough: [9, 29]
|
|
1048
|
+
},
|
|
1049
|
+
color: {
|
|
1050
|
+
black: [30, 39],
|
|
1051
|
+
red: [31, 39],
|
|
1052
|
+
green: [32, 39],
|
|
1053
|
+
yellow: [33, 39],
|
|
1054
|
+
blue: [34, 39],
|
|
1055
|
+
magenta: [35, 39],
|
|
1056
|
+
cyan: [36, 39],
|
|
1057
|
+
white: [37, 39],
|
|
1058
|
+
blackBright: [90, 39],
|
|
1059
|
+
redBright: [91, 39],
|
|
1060
|
+
greenBright: [92, 39],
|
|
1061
|
+
yellowBright: [93, 39],
|
|
1062
|
+
blueBright: [94, 39],
|
|
1063
|
+
magentaBright: [95, 39],
|
|
1064
|
+
cyanBright: [96, 39],
|
|
1065
|
+
whiteBright: [97, 39]
|
|
1066
|
+
},
|
|
1067
|
+
bgColor: {
|
|
1068
|
+
bgBlack: [40, 49],
|
|
1069
|
+
bgRed: [41, 49],
|
|
1070
|
+
bgGreen: [42, 49],
|
|
1071
|
+
bgYellow: [43, 49],
|
|
1072
|
+
bgBlue: [44, 49],
|
|
1073
|
+
bgMagenta: [45, 49],
|
|
1074
|
+
bgCyan: [46, 49],
|
|
1075
|
+
bgWhite: [47, 49],
|
|
1076
|
+
bgBlackBright: [100, 49],
|
|
1077
|
+
bgRedBright: [101, 49],
|
|
1078
|
+
bgGreenBright: [102, 49],
|
|
1079
|
+
bgYellowBright: [103, 49],
|
|
1080
|
+
bgBlueBright: [104, 49],
|
|
1081
|
+
bgMagentaBright: [105, 49],
|
|
1082
|
+
bgCyanBright: [106, 49],
|
|
1083
|
+
bgWhiteBright: [107, 49]
|
|
1084
|
+
}
|
|
1085
|
+
};
|
|
1086
|
+
styles.color.gray = styles.color.blackBright;
|
|
1087
|
+
styles.bgColor.bgGray = styles.bgColor.bgBlackBright;
|
|
1088
|
+
styles.color.grey = styles.color.blackBright;
|
|
1089
|
+
styles.bgColor.bgGrey = styles.bgColor.bgBlackBright;
|
|
1090
|
+
for (const [groupName, group] of Object.entries(styles)) {
|
|
1091
|
+
for (const [styleName, style] of Object.entries(group)) {
|
|
1092
|
+
styles[styleName] = {
|
|
1093
|
+
open: `\x1B[${style[0]}m`,
|
|
1094
|
+
close: `\x1B[${style[1]}m`
|
|
1095
|
+
};
|
|
1096
|
+
group[styleName] = styles[styleName];
|
|
1097
|
+
codes.set(style[0], style[1]);
|
|
1098
|
+
}
|
|
1099
|
+
Object.defineProperty(styles, groupName, {
|
|
1100
|
+
value: group,
|
|
1101
|
+
enumerable: false
|
|
1102
|
+
});
|
|
1103
|
+
}
|
|
1104
|
+
Object.defineProperty(styles, "codes", {
|
|
1105
|
+
value: codes,
|
|
1106
|
+
enumerable: false
|
|
1107
|
+
});
|
|
1108
|
+
styles.color.close = "\x1B[39m";
|
|
1109
|
+
styles.bgColor.close = "\x1B[49m";
|
|
1110
|
+
setLazyProperty(styles.color, "ansi", () => makeDynamicStyles(wrapAnsi16, "ansi16", ansi2ansi, false));
|
|
1111
|
+
setLazyProperty(styles.color, "ansi256", () => makeDynamicStyles(wrapAnsi256, "ansi256", ansi2ansi, false));
|
|
1112
|
+
setLazyProperty(styles.color, "ansi16m", () => makeDynamicStyles(wrapAnsi16m, "rgb", rgb2rgb, false));
|
|
1113
|
+
setLazyProperty(styles.bgColor, "ansi", () => makeDynamicStyles(wrapAnsi16, "ansi16", ansi2ansi, true));
|
|
1114
|
+
setLazyProperty(styles.bgColor, "ansi256", () => makeDynamicStyles(wrapAnsi256, "ansi256", ansi2ansi, true));
|
|
1115
|
+
setLazyProperty(styles.bgColor, "ansi16m", () => makeDynamicStyles(wrapAnsi16m, "rgb", rgb2rgb, true));
|
|
1116
|
+
return styles;
|
|
1117
|
+
}
|
|
1118
|
+
Object.defineProperty(module2, "exports", {
|
|
1119
|
+
enumerable: true,
|
|
1120
|
+
get: assembleStyles
|
|
1121
|
+
});
|
|
1122
|
+
}
|
|
1123
|
+
});
|
|
1124
|
+
|
|
1125
|
+
// node_modules/.pnpm/has-flag@4.0.0/node_modules/has-flag/index.js
|
|
1126
|
+
var require_has_flag = __commonJS({
|
|
1127
|
+
"node_modules/.pnpm/has-flag@4.0.0/node_modules/has-flag/index.js"(exports, module2) {
|
|
1128
|
+
"use strict";
|
|
1129
|
+
module2.exports = (flag, argv = process.argv) => {
|
|
1130
|
+
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
1131
|
+
const position = argv.indexOf(prefix + flag);
|
|
1132
|
+
const terminatorPosition = argv.indexOf("--");
|
|
1133
|
+
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
1134
|
+
};
|
|
1135
|
+
}
|
|
1136
|
+
});
|
|
1137
|
+
|
|
1138
|
+
// node_modules/.pnpm/supports-color@7.2.0/node_modules/supports-color/index.js
|
|
1139
|
+
var require_supports_color = __commonJS({
|
|
1140
|
+
"node_modules/.pnpm/supports-color@7.2.0/node_modules/supports-color/index.js"(exports, module2) {
|
|
1141
|
+
"use strict";
|
|
1142
|
+
var os = require("os");
|
|
1143
|
+
var tty = require("tty");
|
|
1144
|
+
var hasFlag = require_has_flag();
|
|
1145
|
+
var { env } = process;
|
|
1146
|
+
var forceColor;
|
|
1147
|
+
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
|
|
1148
|
+
forceColor = 0;
|
|
1149
|
+
} else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
|
|
1150
|
+
forceColor = 1;
|
|
1151
|
+
}
|
|
1152
|
+
if ("FORCE_COLOR" in env) {
|
|
1153
|
+
if (env.FORCE_COLOR === "true") {
|
|
1154
|
+
forceColor = 1;
|
|
1155
|
+
} else if (env.FORCE_COLOR === "false") {
|
|
1156
|
+
forceColor = 0;
|
|
1157
|
+
} else {
|
|
1158
|
+
forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
function translateLevel(level) {
|
|
1162
|
+
if (level === 0) {
|
|
1163
|
+
return false;
|
|
1164
|
+
}
|
|
1165
|
+
return {
|
|
1166
|
+
level,
|
|
1167
|
+
hasBasic: true,
|
|
1168
|
+
has256: level >= 2,
|
|
1169
|
+
has16m: level >= 3
|
|
1170
|
+
};
|
|
1171
|
+
}
|
|
1172
|
+
function supportsColor(haveStream, streamIsTTY) {
|
|
1173
|
+
if (forceColor === 0) {
|
|
1174
|
+
return 0;
|
|
1175
|
+
}
|
|
1176
|
+
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
|
|
1177
|
+
return 3;
|
|
1178
|
+
}
|
|
1179
|
+
if (hasFlag("color=256")) {
|
|
1180
|
+
return 2;
|
|
1181
|
+
}
|
|
1182
|
+
if (haveStream && !streamIsTTY && forceColor === void 0) {
|
|
1183
|
+
return 0;
|
|
1184
|
+
}
|
|
1185
|
+
const min = forceColor || 0;
|
|
1186
|
+
if (env.TERM === "dumb") {
|
|
1187
|
+
return min;
|
|
1188
|
+
}
|
|
1189
|
+
if (process.platform === "win32") {
|
|
1190
|
+
const osRelease = os.release().split(".");
|
|
1191
|
+
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
1192
|
+
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
1193
|
+
}
|
|
1194
|
+
return 1;
|
|
1195
|
+
}
|
|
1196
|
+
if ("CI" in env) {
|
|
1197
|
+
if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "GITHUB_ACTIONS", "BUILDKITE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
|
|
1198
|
+
return 1;
|
|
1199
|
+
}
|
|
1200
|
+
return min;
|
|
1201
|
+
}
|
|
1202
|
+
if ("TEAMCITY_VERSION" in env) {
|
|
1203
|
+
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
1204
|
+
}
|
|
1205
|
+
if (env.COLORTERM === "truecolor") {
|
|
1206
|
+
return 3;
|
|
1207
|
+
}
|
|
1208
|
+
if ("TERM_PROGRAM" in env) {
|
|
1209
|
+
const version = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
1210
|
+
switch (env.TERM_PROGRAM) {
|
|
1211
|
+
case "iTerm.app":
|
|
1212
|
+
return version >= 3 ? 3 : 2;
|
|
1213
|
+
case "Apple_Terminal":
|
|
1214
|
+
return 2;
|
|
1215
|
+
}
|
|
1216
|
+
}
|
|
1217
|
+
if (/-256(color)?$/i.test(env.TERM)) {
|
|
1218
|
+
return 2;
|
|
1219
|
+
}
|
|
1220
|
+
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
|
1221
|
+
return 1;
|
|
1222
|
+
}
|
|
1223
|
+
if ("COLORTERM" in env) {
|
|
1224
|
+
return 1;
|
|
1225
|
+
}
|
|
1226
|
+
return min;
|
|
1227
|
+
}
|
|
1228
|
+
function getSupportLevel(stream) {
|
|
1229
|
+
const level = supportsColor(stream, stream && stream.isTTY);
|
|
1230
|
+
return translateLevel(level);
|
|
1231
|
+
}
|
|
1232
|
+
module2.exports = {
|
|
1233
|
+
supportsColor: getSupportLevel,
|
|
1234
|
+
stdout: translateLevel(supportsColor(true, tty.isatty(1))),
|
|
1235
|
+
stderr: translateLevel(supportsColor(true, tty.isatty(2)))
|
|
1236
|
+
};
|
|
1237
|
+
}
|
|
1238
|
+
});
|
|
1239
|
+
|
|
1240
|
+
// node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/util.js
|
|
1241
|
+
var require_util = __commonJS({
|
|
1242
|
+
"node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/util.js"(exports, module2) {
|
|
1243
|
+
"use strict";
|
|
1244
|
+
var stringReplaceAll = (string, substring, replacer) => {
|
|
1245
|
+
let index = string.indexOf(substring);
|
|
1246
|
+
if (index === -1) {
|
|
1247
|
+
return string;
|
|
1248
|
+
}
|
|
1249
|
+
const substringLength = substring.length;
|
|
1250
|
+
let endIndex = 0;
|
|
1251
|
+
let returnValue = "";
|
|
1252
|
+
do {
|
|
1253
|
+
returnValue += string.substr(endIndex, index - endIndex) + substring + replacer;
|
|
1254
|
+
endIndex = index + substringLength;
|
|
1255
|
+
index = string.indexOf(substring, endIndex);
|
|
1256
|
+
} while (index !== -1);
|
|
1257
|
+
returnValue += string.substr(endIndex);
|
|
1258
|
+
return returnValue;
|
|
1259
|
+
};
|
|
1260
|
+
var stringEncaseCRLFWithFirstIndex = (string, prefix, postfix, index) => {
|
|
1261
|
+
let endIndex = 0;
|
|
1262
|
+
let returnValue = "";
|
|
1263
|
+
do {
|
|
1264
|
+
const gotCR = string[index - 1] === "\r";
|
|
1265
|
+
returnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
|
|
1266
|
+
endIndex = index + 1;
|
|
1267
|
+
index = string.indexOf("\n", endIndex);
|
|
1268
|
+
} while (index !== -1);
|
|
1269
|
+
returnValue += string.substr(endIndex);
|
|
1270
|
+
return returnValue;
|
|
1271
|
+
};
|
|
1272
|
+
module2.exports = {
|
|
1273
|
+
stringReplaceAll,
|
|
1274
|
+
stringEncaseCRLFWithFirstIndex
|
|
1275
|
+
};
|
|
1276
|
+
}
|
|
1277
|
+
});
|
|
1278
|
+
|
|
1279
|
+
// node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/templates.js
|
|
1280
|
+
var require_templates = __commonJS({
|
|
1281
|
+
"node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/templates.js"(exports, module2) {
|
|
1282
|
+
"use strict";
|
|
1283
|
+
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;
|
|
1284
|
+
var STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
|
|
1285
|
+
var STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
|
|
1286
|
+
var ESCAPE_REGEX = /\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi;
|
|
1287
|
+
var ESCAPES = /* @__PURE__ */ new Map([
|
|
1288
|
+
["n", "\n"],
|
|
1289
|
+
["r", "\r"],
|
|
1290
|
+
["t", " "],
|
|
1291
|
+
["b", "\b"],
|
|
1292
|
+
["f", "\f"],
|
|
1293
|
+
["v", "\v"],
|
|
1294
|
+
["0", "\0"],
|
|
1295
|
+
["\\", "\\"],
|
|
1296
|
+
["e", "\x1B"],
|
|
1297
|
+
["a", "\x07"]
|
|
1298
|
+
]);
|
|
1299
|
+
function unescape(c) {
|
|
1300
|
+
const u = c[0] === "u";
|
|
1301
|
+
const bracket = c[1] === "{";
|
|
1302
|
+
if (u && !bracket && c.length === 5 || c[0] === "x" && c.length === 3) {
|
|
1303
|
+
return String.fromCharCode(parseInt(c.slice(1), 16));
|
|
1304
|
+
}
|
|
1305
|
+
if (u && bracket) {
|
|
1306
|
+
return String.fromCodePoint(parseInt(c.slice(2, -1), 16));
|
|
1307
|
+
}
|
|
1308
|
+
return ESCAPES.get(c) || c;
|
|
1309
|
+
}
|
|
1310
|
+
function parseArguments(name, arguments_) {
|
|
1311
|
+
const results = [];
|
|
1312
|
+
const chunks = arguments_.trim().split(/\s*,\s*/g);
|
|
1313
|
+
let matches;
|
|
1314
|
+
for (const chunk of chunks) {
|
|
1315
|
+
const number = Number(chunk);
|
|
1316
|
+
if (!Number.isNaN(number)) {
|
|
1317
|
+
results.push(number);
|
|
1318
|
+
} else if (matches = chunk.match(STRING_REGEX)) {
|
|
1319
|
+
results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, character) => escape ? unescape(escape) : character));
|
|
1320
|
+
} else {
|
|
1321
|
+
throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
|
|
1322
|
+
}
|
|
1323
|
+
}
|
|
1324
|
+
return results;
|
|
1325
|
+
}
|
|
1326
|
+
function parseStyle(style) {
|
|
1327
|
+
STYLE_REGEX.lastIndex = 0;
|
|
1328
|
+
const results = [];
|
|
1329
|
+
let matches;
|
|
1330
|
+
while ((matches = STYLE_REGEX.exec(style)) !== null) {
|
|
1331
|
+
const name = matches[1];
|
|
1332
|
+
if (matches[2]) {
|
|
1333
|
+
const args = parseArguments(name, matches[2]);
|
|
1334
|
+
results.push([name].concat(args));
|
|
1335
|
+
} else {
|
|
1336
|
+
results.push([name]);
|
|
1337
|
+
}
|
|
1338
|
+
}
|
|
1339
|
+
return results;
|
|
1340
|
+
}
|
|
1341
|
+
function buildStyle(chalk, styles) {
|
|
1342
|
+
const enabled = {};
|
|
1343
|
+
for (const layer of styles) {
|
|
1344
|
+
for (const style of layer.styles) {
|
|
1345
|
+
enabled[style[0]] = layer.inverse ? null : style.slice(1);
|
|
1346
|
+
}
|
|
1347
|
+
}
|
|
1348
|
+
let current = chalk;
|
|
1349
|
+
for (const [styleName, styles2] of Object.entries(enabled)) {
|
|
1350
|
+
if (!Array.isArray(styles2)) {
|
|
1351
|
+
continue;
|
|
1352
|
+
}
|
|
1353
|
+
if (!(styleName in current)) {
|
|
1354
|
+
throw new Error(`Unknown Chalk style: ${styleName}`);
|
|
1355
|
+
}
|
|
1356
|
+
current = styles2.length > 0 ? current[styleName](...styles2) : current[styleName];
|
|
1357
|
+
}
|
|
1358
|
+
return current;
|
|
1359
|
+
}
|
|
1360
|
+
module2.exports = (chalk, temporary) => {
|
|
1361
|
+
const styles = [];
|
|
1362
|
+
const chunks = [];
|
|
1363
|
+
let chunk = [];
|
|
1364
|
+
temporary.replace(TEMPLATE_REGEX, (m, escapeCharacter, inverse, style, close, character) => {
|
|
1365
|
+
if (escapeCharacter) {
|
|
1366
|
+
chunk.push(unescape(escapeCharacter));
|
|
1367
|
+
} else if (style) {
|
|
1368
|
+
const string = chunk.join("");
|
|
1369
|
+
chunk = [];
|
|
1370
|
+
chunks.push(styles.length === 0 ? string : buildStyle(chalk, styles)(string));
|
|
1371
|
+
styles.push({ inverse, styles: parseStyle(style) });
|
|
1372
|
+
} else if (close) {
|
|
1373
|
+
if (styles.length === 0) {
|
|
1374
|
+
throw new Error("Found extraneous } in Chalk template literal");
|
|
1375
|
+
}
|
|
1376
|
+
chunks.push(buildStyle(chalk, styles)(chunk.join("")));
|
|
1377
|
+
chunk = [];
|
|
1378
|
+
styles.pop();
|
|
1379
|
+
} else {
|
|
1380
|
+
chunk.push(character);
|
|
1381
|
+
}
|
|
1382
|
+
});
|
|
1383
|
+
chunks.push(chunk.join(""));
|
|
1384
|
+
if (styles.length > 0) {
|
|
1385
|
+
const errMessage = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? "" : "s"} (\`}\`)`;
|
|
1386
|
+
throw new Error(errMessage);
|
|
1387
|
+
}
|
|
1388
|
+
return chunks.join("");
|
|
1389
|
+
};
|
|
1390
|
+
}
|
|
1391
|
+
});
|
|
1392
|
+
|
|
1393
|
+
// node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/index.js
|
|
1394
|
+
var require_source = __commonJS({
|
|
1395
|
+
"node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/index.js"(exports, module2) {
|
|
1396
|
+
"use strict";
|
|
1397
|
+
var ansiStyles = require_ansi_styles();
|
|
1398
|
+
var { stdout: stdoutColor, stderr: stderrColor } = require_supports_color();
|
|
1399
|
+
var {
|
|
1400
|
+
stringReplaceAll,
|
|
1401
|
+
stringEncaseCRLFWithFirstIndex
|
|
1402
|
+
} = require_util();
|
|
1403
|
+
var { isArray } = Array;
|
|
1404
|
+
var levelMapping = [
|
|
1405
|
+
"ansi",
|
|
1406
|
+
"ansi",
|
|
1407
|
+
"ansi256",
|
|
1408
|
+
"ansi16m"
|
|
1409
|
+
];
|
|
1410
|
+
var styles = /* @__PURE__ */ Object.create(null);
|
|
1411
|
+
var applyOptions = (object, options = {}) => {
|
|
1412
|
+
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
|
|
1413
|
+
throw new Error("The `level` option should be an integer from 0 to 3");
|
|
1414
|
+
}
|
|
1415
|
+
const colorLevel = stdoutColor ? stdoutColor.level : 0;
|
|
1416
|
+
object.level = options.level === void 0 ? colorLevel : options.level;
|
|
1417
|
+
};
|
|
1418
|
+
var ChalkClass = class {
|
|
1419
|
+
constructor(options) {
|
|
1420
|
+
return chalkFactory(options);
|
|
1421
|
+
}
|
|
1422
|
+
};
|
|
1423
|
+
var chalkFactory = (options) => {
|
|
1424
|
+
const chalk2 = {};
|
|
1425
|
+
applyOptions(chalk2, options);
|
|
1426
|
+
chalk2.template = (...arguments_) => chalkTag(chalk2.template, ...arguments_);
|
|
1427
|
+
Object.setPrototypeOf(chalk2, Chalk.prototype);
|
|
1428
|
+
Object.setPrototypeOf(chalk2.template, chalk2);
|
|
1429
|
+
chalk2.template.constructor = () => {
|
|
1430
|
+
throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.");
|
|
1431
|
+
};
|
|
1432
|
+
chalk2.template.Instance = ChalkClass;
|
|
1433
|
+
return chalk2.template;
|
|
1434
|
+
};
|
|
1435
|
+
function Chalk(options) {
|
|
1436
|
+
return chalkFactory(options);
|
|
1437
|
+
}
|
|
1438
|
+
for (const [styleName, style] of Object.entries(ansiStyles)) {
|
|
1439
|
+
styles[styleName] = {
|
|
1440
|
+
get() {
|
|
1441
|
+
const builder = createBuilder(this, createStyler(style.open, style.close, this._styler), this._isEmpty);
|
|
1442
|
+
Object.defineProperty(this, styleName, { value: builder });
|
|
1443
|
+
return builder;
|
|
1444
|
+
}
|
|
1445
|
+
};
|
|
1446
|
+
}
|
|
1447
|
+
styles.visible = {
|
|
1448
|
+
get() {
|
|
1449
|
+
const builder = createBuilder(this, this._styler, true);
|
|
1450
|
+
Object.defineProperty(this, "visible", { value: builder });
|
|
1451
|
+
return builder;
|
|
1452
|
+
}
|
|
1453
|
+
};
|
|
1454
|
+
var usedModels = ["rgb", "hex", "keyword", "hsl", "hsv", "hwb", "ansi", "ansi256"];
|
|
1455
|
+
for (const model of usedModels) {
|
|
1456
|
+
styles[model] = {
|
|
1457
|
+
get() {
|
|
1458
|
+
const { level } = this;
|
|
1459
|
+
return function(...arguments_) {
|
|
1460
|
+
const styler = createStyler(ansiStyles.color[levelMapping[level]][model](...arguments_), ansiStyles.color.close, this._styler);
|
|
1461
|
+
return createBuilder(this, styler, this._isEmpty);
|
|
1462
|
+
};
|
|
1463
|
+
}
|
|
1464
|
+
};
|
|
1465
|
+
}
|
|
1466
|
+
for (const model of usedModels) {
|
|
1467
|
+
const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
|
|
1468
|
+
styles[bgModel] = {
|
|
1469
|
+
get() {
|
|
1470
|
+
const { level } = this;
|
|
1471
|
+
return function(...arguments_) {
|
|
1472
|
+
const styler = createStyler(ansiStyles.bgColor[levelMapping[level]][model](...arguments_), ansiStyles.bgColor.close, this._styler);
|
|
1473
|
+
return createBuilder(this, styler, this._isEmpty);
|
|
1474
|
+
};
|
|
1475
|
+
}
|
|
1476
|
+
};
|
|
1477
|
+
}
|
|
1478
|
+
var proto = Object.defineProperties(() => {
|
|
1479
|
+
}, {
|
|
1480
|
+
...styles,
|
|
1481
|
+
level: {
|
|
1482
|
+
enumerable: true,
|
|
1483
|
+
get() {
|
|
1484
|
+
return this._generator.level;
|
|
1485
|
+
},
|
|
1486
|
+
set(level) {
|
|
1487
|
+
this._generator.level = level;
|
|
1488
|
+
}
|
|
1489
|
+
}
|
|
1490
|
+
});
|
|
1491
|
+
var createStyler = (open, close, parent) => {
|
|
1492
|
+
let openAll;
|
|
1493
|
+
let closeAll;
|
|
1494
|
+
if (parent === void 0) {
|
|
1495
|
+
openAll = open;
|
|
1496
|
+
closeAll = close;
|
|
1497
|
+
} else {
|
|
1498
|
+
openAll = parent.openAll + open;
|
|
1499
|
+
closeAll = close + parent.closeAll;
|
|
1500
|
+
}
|
|
1501
|
+
return {
|
|
1502
|
+
open,
|
|
1503
|
+
close,
|
|
1504
|
+
openAll,
|
|
1505
|
+
closeAll,
|
|
1506
|
+
parent
|
|
1507
|
+
};
|
|
1508
|
+
};
|
|
1509
|
+
var createBuilder = (self2, _styler, _isEmpty) => {
|
|
1510
|
+
const builder = (...arguments_) => {
|
|
1511
|
+
if (isArray(arguments_[0]) && isArray(arguments_[0].raw)) {
|
|
1512
|
+
return applyStyle(builder, chalkTag(builder, ...arguments_));
|
|
1513
|
+
}
|
|
1514
|
+
return applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
|
|
1515
|
+
};
|
|
1516
|
+
Object.setPrototypeOf(builder, proto);
|
|
1517
|
+
builder._generator = self2;
|
|
1518
|
+
builder._styler = _styler;
|
|
1519
|
+
builder._isEmpty = _isEmpty;
|
|
1520
|
+
return builder;
|
|
1521
|
+
};
|
|
1522
|
+
var applyStyle = (self2, string) => {
|
|
1523
|
+
if (self2.level <= 0 || !string) {
|
|
1524
|
+
return self2._isEmpty ? "" : string;
|
|
1525
|
+
}
|
|
1526
|
+
let styler = self2._styler;
|
|
1527
|
+
if (styler === void 0) {
|
|
1528
|
+
return string;
|
|
1529
|
+
}
|
|
1530
|
+
const { openAll, closeAll } = styler;
|
|
1531
|
+
if (string.indexOf("\x1B") !== -1) {
|
|
1532
|
+
while (styler !== void 0) {
|
|
1533
|
+
string = stringReplaceAll(string, styler.close, styler.open);
|
|
1534
|
+
styler = styler.parent;
|
|
1535
|
+
}
|
|
1536
|
+
}
|
|
1537
|
+
const lfIndex = string.indexOf("\n");
|
|
1538
|
+
if (lfIndex !== -1) {
|
|
1539
|
+
string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
|
|
1540
|
+
}
|
|
1541
|
+
return openAll + string + closeAll;
|
|
1542
|
+
};
|
|
1543
|
+
var template;
|
|
1544
|
+
var chalkTag = (chalk2, ...strings) => {
|
|
1545
|
+
const [firstString] = strings;
|
|
1546
|
+
if (!isArray(firstString) || !isArray(firstString.raw)) {
|
|
1547
|
+
return strings.join(" ");
|
|
1548
|
+
}
|
|
1549
|
+
const arguments_ = strings.slice(1);
|
|
1550
|
+
const parts = [firstString.raw[0]];
|
|
1551
|
+
for (let i = 1; i < firstString.length; i++) {
|
|
1552
|
+
parts.push(
|
|
1553
|
+
String(arguments_[i - 1]).replace(/[{}\\]/g, "\\$&"),
|
|
1554
|
+
String(firstString.raw[i])
|
|
1555
|
+
);
|
|
1556
|
+
}
|
|
1557
|
+
if (template === void 0) {
|
|
1558
|
+
template = require_templates();
|
|
1559
|
+
}
|
|
1560
|
+
return template(chalk2, parts.join(""));
|
|
1561
|
+
};
|
|
1562
|
+
Object.defineProperties(Chalk.prototype, styles);
|
|
1563
|
+
var chalk = Chalk();
|
|
1564
|
+
chalk.supportsColor = stdoutColor;
|
|
1565
|
+
chalk.stderr = Chalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
1566
|
+
chalk.stderr.supportsColor = stderrColor;
|
|
1567
|
+
module2.exports = chalk;
|
|
1568
|
+
}
|
|
1569
|
+
});
|
|
1570
|
+
|
|
1571
|
+
// node_modules/.pnpm/tinycolor2@1.5.2/node_modules/tinycolor2/cjs/tinycolor.js
|
|
1572
|
+
var require_tinycolor = __commonJS({
|
|
1573
|
+
"node_modules/.pnpm/tinycolor2@1.5.2/node_modules/tinycolor2/cjs/tinycolor.js"(exports, module2) {
|
|
1574
|
+
(function(global, factory) {
|
|
1575
|
+
typeof exports === "object" && typeof module2 !== "undefined" ? module2.exports = factory() : typeof define === "function" && define.amd ? define(factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, global.tinycolor = factory());
|
|
1576
|
+
})(exports, function() {
|
|
1577
|
+
"use strict";
|
|
1578
|
+
const trimLeft = /^\s+/;
|
|
1579
|
+
const trimRight = /\s+$/;
|
|
1580
|
+
function tinycolor(color, opts) {
|
|
1581
|
+
color = color ? color : "";
|
|
1582
|
+
opts = opts || {};
|
|
1583
|
+
if (color instanceof tinycolor) {
|
|
1584
|
+
return color;
|
|
1585
|
+
}
|
|
1586
|
+
if (!(this instanceof tinycolor)) {
|
|
1587
|
+
return new tinycolor(color, opts);
|
|
1588
|
+
}
|
|
1589
|
+
var rgb = inputToRGB(color);
|
|
1590
|
+
this._originalInput = color, this._r = rgb.r, this._g = rgb.g, this._b = rgb.b, this._a = rgb.a, this._roundA = Math.round(100 * this._a) / 100, this._format = opts.format || rgb.format;
|
|
1591
|
+
this._gradientType = opts.gradientType;
|
|
1592
|
+
if (this._r < 1)
|
|
1593
|
+
this._r = Math.round(this._r);
|
|
1594
|
+
if (this._g < 1)
|
|
1595
|
+
this._g = Math.round(this._g);
|
|
1596
|
+
if (this._b < 1)
|
|
1597
|
+
this._b = Math.round(this._b);
|
|
1598
|
+
this._ok = rgb.ok;
|
|
1599
|
+
}
|
|
1600
|
+
tinycolor.prototype = {
|
|
1601
|
+
isDark: function() {
|
|
1602
|
+
return this.getBrightness() < 128;
|
|
1603
|
+
},
|
|
1604
|
+
isLight: function() {
|
|
1605
|
+
return !this.isDark();
|
|
1606
|
+
},
|
|
1607
|
+
isValid: function() {
|
|
1608
|
+
return this._ok;
|
|
1609
|
+
},
|
|
1610
|
+
getOriginalInput: function() {
|
|
1611
|
+
return this._originalInput;
|
|
1612
|
+
},
|
|
1613
|
+
getFormat: function() {
|
|
1614
|
+
return this._format;
|
|
1615
|
+
},
|
|
1616
|
+
getAlpha: function() {
|
|
1617
|
+
return this._a;
|
|
1618
|
+
},
|
|
1619
|
+
getBrightness: function() {
|
|
1620
|
+
var rgb = this.toRgb();
|
|
1621
|
+
return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3;
|
|
1622
|
+
},
|
|
1623
|
+
getLuminance: function() {
|
|
1624
|
+
var rgb = this.toRgb();
|
|
1625
|
+
var RsRGB, GsRGB, BsRGB, R, G, B;
|
|
1626
|
+
RsRGB = rgb.r / 255;
|
|
1627
|
+
GsRGB = rgb.g / 255;
|
|
1628
|
+
BsRGB = rgb.b / 255;
|
|
1629
|
+
if (RsRGB <= 0.03928)
|
|
1630
|
+
R = RsRGB / 12.92;
|
|
1631
|
+
else
|
|
1632
|
+
R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
|
|
1633
|
+
if (GsRGB <= 0.03928)
|
|
1634
|
+
G = GsRGB / 12.92;
|
|
1635
|
+
else
|
|
1636
|
+
G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
|
|
1637
|
+
if (BsRGB <= 0.03928)
|
|
1638
|
+
B = BsRGB / 12.92;
|
|
1639
|
+
else
|
|
1640
|
+
B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
|
|
1641
|
+
return 0.2126 * R + 0.7152 * G + 0.0722 * B;
|
|
1642
|
+
},
|
|
1643
|
+
setAlpha: function(value) {
|
|
1644
|
+
this._a = boundAlpha(value);
|
|
1645
|
+
this._roundA = Math.round(100 * this._a) / 100;
|
|
1646
|
+
return this;
|
|
1647
|
+
},
|
|
1648
|
+
toHsv: function() {
|
|
1649
|
+
var hsv = rgbToHsv(this._r, this._g, this._b);
|
|
1650
|
+
return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this._a };
|
|
1651
|
+
},
|
|
1652
|
+
toHsvString: function() {
|
|
1653
|
+
var hsv = rgbToHsv(this._r, this._g, this._b);
|
|
1654
|
+
var h = Math.round(hsv.h * 360), s = Math.round(hsv.s * 100), v = Math.round(hsv.v * 100);
|
|
1655
|
+
return this._a == 1 ? "hsv(" + h + ", " + s + "%, " + v + "%)" : "hsva(" + h + ", " + s + "%, " + v + "%, " + this._roundA + ")";
|
|
1656
|
+
},
|
|
1657
|
+
toHsl: function() {
|
|
1658
|
+
var hsl = rgbToHsl(this._r, this._g, this._b);
|
|
1659
|
+
return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this._a };
|
|
1660
|
+
},
|
|
1661
|
+
toHslString: function() {
|
|
1662
|
+
var hsl = rgbToHsl(this._r, this._g, this._b);
|
|
1663
|
+
var h = Math.round(hsl.h * 360), s = Math.round(hsl.s * 100), l = Math.round(hsl.l * 100);
|
|
1664
|
+
return this._a == 1 ? "hsl(" + h + ", " + s + "%, " + l + "%)" : "hsla(" + h + ", " + s + "%, " + l + "%, " + this._roundA + ")";
|
|
1665
|
+
},
|
|
1666
|
+
toHex: function(allow3Char) {
|
|
1667
|
+
return rgbToHex(this._r, this._g, this._b, allow3Char);
|
|
1668
|
+
},
|
|
1669
|
+
toHexString: function(allow3Char) {
|
|
1670
|
+
return "#" + this.toHex(allow3Char);
|
|
1671
|
+
},
|
|
1672
|
+
toHex8: function(allow4Char) {
|
|
1673
|
+
return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char);
|
|
1674
|
+
},
|
|
1675
|
+
toHex8String: function(allow4Char) {
|
|
1676
|
+
return "#" + this.toHex8(allow4Char);
|
|
1677
|
+
},
|
|
1678
|
+
toRgb: function() {
|
|
1679
|
+
return {
|
|
1680
|
+
r: Math.round(this._r),
|
|
1681
|
+
g: Math.round(this._g),
|
|
1682
|
+
b: Math.round(this._b),
|
|
1683
|
+
a: this._a
|
|
1684
|
+
};
|
|
1685
|
+
},
|
|
1686
|
+
toRgbString: function() {
|
|
1687
|
+
return this._a == 1 ? "rgb(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ")" : "rgba(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ", " + this._roundA + ")";
|
|
1688
|
+
},
|
|
1689
|
+
toPercentageRgb: function() {
|
|
1690
|
+
return {
|
|
1691
|
+
r: Math.round(bound01(this._r, 255) * 100) + "%",
|
|
1692
|
+
g: Math.round(bound01(this._g, 255) * 100) + "%",
|
|
1693
|
+
b: Math.round(bound01(this._b, 255) * 100) + "%",
|
|
1694
|
+
a: this._a
|
|
1695
|
+
};
|
|
1696
|
+
},
|
|
1697
|
+
toPercentageRgbString: function() {
|
|
1698
|
+
return this._a == 1 ? "rgb(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%)" : "rgba(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")";
|
|
1699
|
+
},
|
|
1700
|
+
toName: function() {
|
|
1701
|
+
if (this._a === 0) {
|
|
1702
|
+
return "transparent";
|
|
1703
|
+
}
|
|
1704
|
+
if (this._a < 1) {
|
|
1705
|
+
return false;
|
|
1706
|
+
}
|
|
1707
|
+
return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false;
|
|
1708
|
+
},
|
|
1709
|
+
toFilter: function(secondColor) {
|
|
1710
|
+
var hex8String = "#" + rgbaToArgbHex(this._r, this._g, this._b, this._a);
|
|
1711
|
+
var secondHex8String = hex8String;
|
|
1712
|
+
var gradientType = this._gradientType ? "GradientType = 1, " : "";
|
|
1713
|
+
if (secondColor) {
|
|
1714
|
+
var s = tinycolor(secondColor);
|
|
1715
|
+
secondHex8String = "#" + rgbaToArgbHex(s._r, s._g, s._b, s._a);
|
|
1716
|
+
}
|
|
1717
|
+
return "progid:DXImageTransform.Microsoft.gradient(" + gradientType + "startColorstr=" + hex8String + ",endColorstr=" + secondHex8String + ")";
|
|
1718
|
+
},
|
|
1719
|
+
toString: function(format) {
|
|
1720
|
+
var formatSet = !!format;
|
|
1721
|
+
format = format || this._format;
|
|
1722
|
+
var formattedString = false;
|
|
1723
|
+
var hasAlpha = this._a < 1 && this._a >= 0;
|
|
1724
|
+
var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "hex4" || format === "hex8" || format === "name");
|
|
1725
|
+
if (needsAlphaFormat) {
|
|
1726
|
+
if (format === "name" && this._a === 0) {
|
|
1727
|
+
return this.toName();
|
|
1728
|
+
}
|
|
1729
|
+
return this.toRgbString();
|
|
1730
|
+
}
|
|
1731
|
+
if (format === "rgb") {
|
|
1732
|
+
formattedString = this.toRgbString();
|
|
1733
|
+
}
|
|
1734
|
+
if (format === "prgb") {
|
|
1735
|
+
formattedString = this.toPercentageRgbString();
|
|
1736
|
+
}
|
|
1737
|
+
if (format === "hex" || format === "hex6") {
|
|
1738
|
+
formattedString = this.toHexString();
|
|
1739
|
+
}
|
|
1740
|
+
if (format === "hex3") {
|
|
1741
|
+
formattedString = this.toHexString(true);
|
|
1742
|
+
}
|
|
1743
|
+
if (format === "hex4") {
|
|
1744
|
+
formattedString = this.toHex8String(true);
|
|
1745
|
+
}
|
|
1746
|
+
if (format === "hex8") {
|
|
1747
|
+
formattedString = this.toHex8String();
|
|
1748
|
+
}
|
|
1749
|
+
if (format === "name") {
|
|
1750
|
+
formattedString = this.toName();
|
|
1751
|
+
}
|
|
1752
|
+
if (format === "hsl") {
|
|
1753
|
+
formattedString = this.toHslString();
|
|
1754
|
+
}
|
|
1755
|
+
if (format === "hsv") {
|
|
1756
|
+
formattedString = this.toHsvString();
|
|
1757
|
+
}
|
|
1758
|
+
return formattedString || this.toHexString();
|
|
1759
|
+
},
|
|
1760
|
+
clone: function() {
|
|
1761
|
+
return tinycolor(this.toString());
|
|
1762
|
+
},
|
|
1763
|
+
_applyModification: function(fn, args) {
|
|
1764
|
+
var color = fn.apply(null, [this].concat([].slice.call(args)));
|
|
1765
|
+
this._r = color._r;
|
|
1766
|
+
this._g = color._g;
|
|
1767
|
+
this._b = color._b;
|
|
1768
|
+
this.setAlpha(color._a);
|
|
1769
|
+
return this;
|
|
1770
|
+
},
|
|
1771
|
+
lighten: function() {
|
|
1772
|
+
return this._applyModification(lighten, arguments);
|
|
1773
|
+
},
|
|
1774
|
+
brighten: function() {
|
|
1775
|
+
return this._applyModification(brighten, arguments);
|
|
1776
|
+
},
|
|
1777
|
+
darken: function() {
|
|
1778
|
+
return this._applyModification(darken, arguments);
|
|
1779
|
+
},
|
|
1780
|
+
desaturate: function() {
|
|
1781
|
+
return this._applyModification(desaturate, arguments);
|
|
1782
|
+
},
|
|
1783
|
+
saturate: function() {
|
|
1784
|
+
return this._applyModification(saturate, arguments);
|
|
1785
|
+
},
|
|
1786
|
+
greyscale: function() {
|
|
1787
|
+
return this._applyModification(greyscale, arguments);
|
|
1788
|
+
},
|
|
1789
|
+
spin: function() {
|
|
1790
|
+
return this._applyModification(spin, arguments);
|
|
1791
|
+
},
|
|
1792
|
+
_applyCombination: function(fn, args) {
|
|
1793
|
+
return fn.apply(null, [this].concat([].slice.call(args)));
|
|
1794
|
+
},
|
|
1795
|
+
analogous: function() {
|
|
1796
|
+
return this._applyCombination(analogous, arguments);
|
|
1797
|
+
},
|
|
1798
|
+
complement: function() {
|
|
1799
|
+
return this._applyCombination(complement, arguments);
|
|
1800
|
+
},
|
|
1801
|
+
monochromatic: function() {
|
|
1802
|
+
return this._applyCombination(monochromatic, arguments);
|
|
1803
|
+
},
|
|
1804
|
+
splitcomplement: function() {
|
|
1805
|
+
return this._applyCombination(splitcomplement, arguments);
|
|
1806
|
+
},
|
|
1807
|
+
triad: function() {
|
|
1808
|
+
return this._applyCombination(polyad, [3]);
|
|
1809
|
+
},
|
|
1810
|
+
tetrad: function() {
|
|
1811
|
+
return this._applyCombination(polyad, [4]);
|
|
1812
|
+
}
|
|
1813
|
+
};
|
|
1814
|
+
tinycolor.fromRatio = function(color, opts) {
|
|
1815
|
+
if (typeof color == "object") {
|
|
1816
|
+
var newColor = {};
|
|
1817
|
+
for (var i in color) {
|
|
1818
|
+
if (color.hasOwnProperty(i)) {
|
|
1819
|
+
if (i === "a") {
|
|
1820
|
+
newColor[i] = color[i];
|
|
1821
|
+
} else {
|
|
1822
|
+
newColor[i] = convertToPercentage(color[i]);
|
|
1823
|
+
}
|
|
1824
|
+
}
|
|
1825
|
+
}
|
|
1826
|
+
color = newColor;
|
|
1827
|
+
}
|
|
1828
|
+
return tinycolor(color, opts);
|
|
1829
|
+
};
|
|
1830
|
+
function inputToRGB(color) {
|
|
1831
|
+
var rgb = { r: 0, g: 0, b: 0 };
|
|
1832
|
+
var a = 1;
|
|
1833
|
+
var s = null;
|
|
1834
|
+
var v = null;
|
|
1835
|
+
var l = null;
|
|
1836
|
+
var ok = false;
|
|
1837
|
+
var format = false;
|
|
1838
|
+
if (typeof color == "string") {
|
|
1839
|
+
color = stringInputToObject(color);
|
|
1840
|
+
}
|
|
1841
|
+
if (typeof color == "object") {
|
|
1842
|
+
if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
|
|
1843
|
+
rgb = rgbToRgb(color.r, color.g, color.b);
|
|
1844
|
+
ok = true;
|
|
1845
|
+
format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
|
|
1846
|
+
} else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
|
|
1847
|
+
s = convertToPercentage(color.s);
|
|
1848
|
+
v = convertToPercentage(color.v);
|
|
1849
|
+
rgb = hsvToRgb(color.h, s, v);
|
|
1850
|
+
ok = true;
|
|
1851
|
+
format = "hsv";
|
|
1852
|
+
} else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
|
|
1853
|
+
s = convertToPercentage(color.s);
|
|
1854
|
+
l = convertToPercentage(color.l);
|
|
1855
|
+
rgb = hslToRgb(color.h, s, l);
|
|
1856
|
+
ok = true;
|
|
1857
|
+
format = "hsl";
|
|
1858
|
+
}
|
|
1859
|
+
if (color.hasOwnProperty("a")) {
|
|
1860
|
+
a = color.a;
|
|
1861
|
+
}
|
|
1862
|
+
}
|
|
1863
|
+
a = boundAlpha(a);
|
|
1864
|
+
return {
|
|
1865
|
+
ok,
|
|
1866
|
+
format: color.format || format,
|
|
1867
|
+
r: Math.min(255, Math.max(rgb.r, 0)),
|
|
1868
|
+
g: Math.min(255, Math.max(rgb.g, 0)),
|
|
1869
|
+
b: Math.min(255, Math.max(rgb.b, 0)),
|
|
1870
|
+
a
|
|
1871
|
+
};
|
|
1872
|
+
}
|
|
1873
|
+
function rgbToRgb(r, g, b) {
|
|
1874
|
+
return {
|
|
1875
|
+
r: bound01(r, 255) * 255,
|
|
1876
|
+
g: bound01(g, 255) * 255,
|
|
1877
|
+
b: bound01(b, 255) * 255
|
|
1878
|
+
};
|
|
1879
|
+
}
|
|
1880
|
+
function rgbToHsl(r, g, b) {
|
|
1881
|
+
r = bound01(r, 255);
|
|
1882
|
+
g = bound01(g, 255);
|
|
1883
|
+
b = bound01(b, 255);
|
|
1884
|
+
var max = Math.max(r, g, b), min = Math.min(r, g, b);
|
|
1885
|
+
var h, s, l = (max + min) / 2;
|
|
1886
|
+
if (max == min) {
|
|
1887
|
+
h = s = 0;
|
|
1888
|
+
} else {
|
|
1889
|
+
var d = max - min;
|
|
1890
|
+
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
1891
|
+
switch (max) {
|
|
1892
|
+
case r:
|
|
1893
|
+
h = (g - b) / d + (g < b ? 6 : 0);
|
|
1894
|
+
break;
|
|
1895
|
+
case g:
|
|
1896
|
+
h = (b - r) / d + 2;
|
|
1897
|
+
break;
|
|
1898
|
+
case b:
|
|
1899
|
+
h = (r - g) / d + 4;
|
|
1900
|
+
break;
|
|
1901
|
+
}
|
|
1902
|
+
h /= 6;
|
|
1903
|
+
}
|
|
1904
|
+
return { h, s, l };
|
|
1905
|
+
}
|
|
1906
|
+
function hslToRgb(h, s, l) {
|
|
1907
|
+
var r, g, b;
|
|
1908
|
+
h = bound01(h, 360);
|
|
1909
|
+
s = bound01(s, 100);
|
|
1910
|
+
l = bound01(l, 100);
|
|
1911
|
+
function hue2rgb(p2, q2, t) {
|
|
1912
|
+
if (t < 0)
|
|
1913
|
+
t += 1;
|
|
1914
|
+
if (t > 1)
|
|
1915
|
+
t -= 1;
|
|
1916
|
+
if (t < 1 / 6)
|
|
1917
|
+
return p2 + (q2 - p2) * 6 * t;
|
|
1918
|
+
if (t < 1 / 2)
|
|
1919
|
+
return q2;
|
|
1920
|
+
if (t < 2 / 3)
|
|
1921
|
+
return p2 + (q2 - p2) * (2 / 3 - t) * 6;
|
|
1922
|
+
return p2;
|
|
1923
|
+
}
|
|
1924
|
+
if (s === 0) {
|
|
1925
|
+
r = g = b = l;
|
|
1926
|
+
} else {
|
|
1927
|
+
var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
1928
|
+
var p = 2 * l - q;
|
|
1929
|
+
r = hue2rgb(p, q, h + 1 / 3);
|
|
1930
|
+
g = hue2rgb(p, q, h);
|
|
1931
|
+
b = hue2rgb(p, q, h - 1 / 3);
|
|
1932
|
+
}
|
|
1933
|
+
return { r: r * 255, g: g * 255, b: b * 255 };
|
|
1934
|
+
}
|
|
1935
|
+
function rgbToHsv(r, g, b) {
|
|
1936
|
+
r = bound01(r, 255);
|
|
1937
|
+
g = bound01(g, 255);
|
|
1938
|
+
b = bound01(b, 255);
|
|
1939
|
+
var max = Math.max(r, g, b), min = Math.min(r, g, b);
|
|
1940
|
+
var h, s, v = max;
|
|
1941
|
+
var d = max - min;
|
|
1942
|
+
s = max === 0 ? 0 : d / max;
|
|
1943
|
+
if (max == min) {
|
|
1944
|
+
h = 0;
|
|
1945
|
+
} else {
|
|
1946
|
+
switch (max) {
|
|
1947
|
+
case r:
|
|
1948
|
+
h = (g - b) / d + (g < b ? 6 : 0);
|
|
1949
|
+
break;
|
|
1950
|
+
case g:
|
|
1951
|
+
h = (b - r) / d + 2;
|
|
1952
|
+
break;
|
|
1953
|
+
case b:
|
|
1954
|
+
h = (r - g) / d + 4;
|
|
1955
|
+
break;
|
|
1956
|
+
}
|
|
1957
|
+
h /= 6;
|
|
1958
|
+
}
|
|
1959
|
+
return { h, s, v };
|
|
1960
|
+
}
|
|
1961
|
+
function hsvToRgb(h, s, v) {
|
|
1962
|
+
h = bound01(h, 360) * 6;
|
|
1963
|
+
s = bound01(s, 100);
|
|
1964
|
+
v = bound01(v, 100);
|
|
1965
|
+
var i = Math.floor(h), f = h - i, p = v * (1 - s), q = v * (1 - f * s), t = v * (1 - (1 - f) * s), mod = i % 6, r = [v, q, p, p, t, v][mod], g = [t, v, v, q, p, p][mod], b = [p, p, t, v, v, q][mod];
|
|
1966
|
+
return { r: r * 255, g: g * 255, b: b * 255 };
|
|
1967
|
+
}
|
|
1968
|
+
function rgbToHex(r, g, b, allow3Char) {
|
|
1969
|
+
var hex = [
|
|
1970
|
+
pad2(Math.round(r).toString(16)),
|
|
1971
|
+
pad2(Math.round(g).toString(16)),
|
|
1972
|
+
pad2(Math.round(b).toString(16))
|
|
1973
|
+
];
|
|
1974
|
+
if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {
|
|
1975
|
+
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
|
|
1976
|
+
}
|
|
1977
|
+
return hex.join("");
|
|
1978
|
+
}
|
|
1979
|
+
function rgbaToHex(r, g, b, a, allow4Char) {
|
|
1980
|
+
var hex = [
|
|
1981
|
+
pad2(Math.round(r).toString(16)),
|
|
1982
|
+
pad2(Math.round(g).toString(16)),
|
|
1983
|
+
pad2(Math.round(b).toString(16)),
|
|
1984
|
+
pad2(convertDecimalToHex(a))
|
|
1985
|
+
];
|
|
1986
|
+
if (allow4Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1) && hex[3].charAt(0) == hex[3].charAt(1)) {
|
|
1987
|
+
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
|
|
1988
|
+
}
|
|
1989
|
+
return hex.join("");
|
|
1990
|
+
}
|
|
1991
|
+
function rgbaToArgbHex(r, g, b, a) {
|
|
1992
|
+
var hex = [
|
|
1993
|
+
pad2(convertDecimalToHex(a)),
|
|
1994
|
+
pad2(Math.round(r).toString(16)),
|
|
1995
|
+
pad2(Math.round(g).toString(16)),
|
|
1996
|
+
pad2(Math.round(b).toString(16))
|
|
1997
|
+
];
|
|
1998
|
+
return hex.join("");
|
|
1999
|
+
}
|
|
2000
|
+
tinycolor.equals = function(color1, color2) {
|
|
2001
|
+
if (!color1 || !color2)
|
|
2002
|
+
return false;
|
|
2003
|
+
return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString();
|
|
2004
|
+
};
|
|
2005
|
+
tinycolor.random = function() {
|
|
2006
|
+
return tinycolor.fromRatio({
|
|
2007
|
+
r: Math.random(),
|
|
2008
|
+
g: Math.random(),
|
|
2009
|
+
b: Math.random()
|
|
2010
|
+
});
|
|
2011
|
+
};
|
|
2012
|
+
function desaturate(color, amount) {
|
|
2013
|
+
amount = amount === 0 ? 0 : amount || 10;
|
|
2014
|
+
var hsl = tinycolor(color).toHsl();
|
|
2015
|
+
hsl.s -= amount / 100;
|
|
2016
|
+
hsl.s = clamp01(hsl.s);
|
|
2017
|
+
return tinycolor(hsl);
|
|
2018
|
+
}
|
|
2019
|
+
function saturate(color, amount) {
|
|
2020
|
+
amount = amount === 0 ? 0 : amount || 10;
|
|
2021
|
+
var hsl = tinycolor(color).toHsl();
|
|
2022
|
+
hsl.s += amount / 100;
|
|
2023
|
+
hsl.s = clamp01(hsl.s);
|
|
2024
|
+
return tinycolor(hsl);
|
|
2025
|
+
}
|
|
2026
|
+
function greyscale(color) {
|
|
2027
|
+
return tinycolor(color).desaturate(100);
|
|
2028
|
+
}
|
|
2029
|
+
function lighten(color, amount) {
|
|
2030
|
+
amount = amount === 0 ? 0 : amount || 10;
|
|
2031
|
+
var hsl = tinycolor(color).toHsl();
|
|
2032
|
+
hsl.l += amount / 100;
|
|
2033
|
+
hsl.l = clamp01(hsl.l);
|
|
2034
|
+
return tinycolor(hsl);
|
|
2035
|
+
}
|
|
2036
|
+
function brighten(color, amount) {
|
|
2037
|
+
amount = amount === 0 ? 0 : amount || 10;
|
|
2038
|
+
var rgb = tinycolor(color).toRgb();
|
|
2039
|
+
rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
|
|
2040
|
+
rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));
|
|
2041
|
+
rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
|
|
2042
|
+
return tinycolor(rgb);
|
|
2043
|
+
}
|
|
2044
|
+
function darken(color, amount) {
|
|
2045
|
+
amount = amount === 0 ? 0 : amount || 10;
|
|
2046
|
+
var hsl = tinycolor(color).toHsl();
|
|
2047
|
+
hsl.l -= amount / 100;
|
|
2048
|
+
hsl.l = clamp01(hsl.l);
|
|
2049
|
+
return tinycolor(hsl);
|
|
2050
|
+
}
|
|
2051
|
+
function spin(color, amount) {
|
|
2052
|
+
var hsl = tinycolor(color).toHsl();
|
|
2053
|
+
var hue = (hsl.h + amount) % 360;
|
|
2054
|
+
hsl.h = hue < 0 ? 360 + hue : hue;
|
|
2055
|
+
return tinycolor(hsl);
|
|
2056
|
+
}
|
|
2057
|
+
function complement(color) {
|
|
2058
|
+
var hsl = tinycolor(color).toHsl();
|
|
2059
|
+
hsl.h = (hsl.h + 180) % 360;
|
|
2060
|
+
return tinycolor(hsl);
|
|
2061
|
+
}
|
|
2062
|
+
function polyad(color, number) {
|
|
2063
|
+
if (isNaN(number) || number <= 0) {
|
|
2064
|
+
throw new Error("Argument to polyad must be a positive number");
|
|
2065
|
+
}
|
|
2066
|
+
var hsl = tinycolor(color).toHsl();
|
|
2067
|
+
var result = [tinycolor(color)];
|
|
2068
|
+
var step = 360 / number;
|
|
2069
|
+
for (var i = 1; i < number; i++) {
|
|
2070
|
+
result.push(tinycolor({ h: (hsl.h + i * step) % 360, s: hsl.s, l: hsl.l }));
|
|
2071
|
+
}
|
|
2072
|
+
return result;
|
|
2073
|
+
}
|
|
2074
|
+
function splitcomplement(color) {
|
|
2075
|
+
var hsl = tinycolor(color).toHsl();
|
|
2076
|
+
var h = hsl.h;
|
|
2077
|
+
return [
|
|
2078
|
+
tinycolor(color),
|
|
2079
|
+
tinycolor({ h: (h + 72) % 360, s: hsl.s, l: hsl.l }),
|
|
2080
|
+
tinycolor({ h: (h + 216) % 360, s: hsl.s, l: hsl.l })
|
|
2081
|
+
];
|
|
2082
|
+
}
|
|
2083
|
+
function analogous(color, results, slices) {
|
|
2084
|
+
results = results || 6;
|
|
2085
|
+
slices = slices || 30;
|
|
2086
|
+
var hsl = tinycolor(color).toHsl();
|
|
2087
|
+
var part = 360 / slices;
|
|
2088
|
+
var ret = [tinycolor(color)];
|
|
2089
|
+
for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results; ) {
|
|
2090
|
+
hsl.h = (hsl.h + part) % 360;
|
|
2091
|
+
ret.push(tinycolor(hsl));
|
|
2092
|
+
}
|
|
2093
|
+
return ret;
|
|
2094
|
+
}
|
|
2095
|
+
function monochromatic(color, results) {
|
|
2096
|
+
results = results || 6;
|
|
2097
|
+
var hsv = tinycolor(color).toHsv();
|
|
2098
|
+
var h = hsv.h, s = hsv.s, v = hsv.v;
|
|
2099
|
+
var ret = [];
|
|
2100
|
+
var modification = 1 / results;
|
|
2101
|
+
while (results--) {
|
|
2102
|
+
ret.push(tinycolor({ h, s, v }));
|
|
2103
|
+
v = (v + modification) % 1;
|
|
2104
|
+
}
|
|
2105
|
+
return ret;
|
|
2106
|
+
}
|
|
2107
|
+
tinycolor.mix = function(color1, color2, amount) {
|
|
2108
|
+
amount = amount === 0 ? 0 : amount || 50;
|
|
2109
|
+
var rgb1 = tinycolor(color1).toRgb();
|
|
2110
|
+
var rgb2 = tinycolor(color2).toRgb();
|
|
2111
|
+
var p = amount / 100;
|
|
2112
|
+
var rgba = {
|
|
2113
|
+
r: (rgb2.r - rgb1.r) * p + rgb1.r,
|
|
2114
|
+
g: (rgb2.g - rgb1.g) * p + rgb1.g,
|
|
2115
|
+
b: (rgb2.b - rgb1.b) * p + rgb1.b,
|
|
2116
|
+
a: (rgb2.a - rgb1.a) * p + rgb1.a
|
|
2117
|
+
};
|
|
2118
|
+
return tinycolor(rgba);
|
|
2119
|
+
};
|
|
2120
|
+
tinycolor.readability = function(color1, color2) {
|
|
2121
|
+
var c1 = tinycolor(color1);
|
|
2122
|
+
var c2 = tinycolor(color2);
|
|
2123
|
+
return (Math.max(c1.getLuminance(), c2.getLuminance()) + 0.05) / (Math.min(c1.getLuminance(), c2.getLuminance()) + 0.05);
|
|
2124
|
+
};
|
|
2125
|
+
tinycolor.isReadable = function(color1, color2, wcag2) {
|
|
2126
|
+
var readability = tinycolor.readability(color1, color2);
|
|
2127
|
+
var wcag2Parms, out;
|
|
2128
|
+
out = false;
|
|
2129
|
+
wcag2Parms = validateWCAG2Parms(wcag2);
|
|
2130
|
+
switch (wcag2Parms.level + wcag2Parms.size) {
|
|
2131
|
+
case "AAsmall":
|
|
2132
|
+
case "AAAlarge":
|
|
2133
|
+
out = readability >= 4.5;
|
|
2134
|
+
break;
|
|
2135
|
+
case "AAlarge":
|
|
2136
|
+
out = readability >= 3;
|
|
2137
|
+
break;
|
|
2138
|
+
case "AAAsmall":
|
|
2139
|
+
out = readability >= 7;
|
|
2140
|
+
break;
|
|
2141
|
+
}
|
|
2142
|
+
return out;
|
|
2143
|
+
};
|
|
2144
|
+
tinycolor.mostReadable = function(baseColor, colorList, args) {
|
|
2145
|
+
var bestColor = null;
|
|
2146
|
+
var bestScore = 0;
|
|
2147
|
+
var readability;
|
|
2148
|
+
var includeFallbackColors, level, size;
|
|
2149
|
+
args = args || {};
|
|
2150
|
+
includeFallbackColors = args.includeFallbackColors;
|
|
2151
|
+
level = args.level;
|
|
2152
|
+
size = args.size;
|
|
2153
|
+
for (var i = 0; i < colorList.length; i++) {
|
|
2154
|
+
readability = tinycolor.readability(baseColor, colorList[i]);
|
|
2155
|
+
if (readability > bestScore) {
|
|
2156
|
+
bestScore = readability;
|
|
2157
|
+
bestColor = tinycolor(colorList[i]);
|
|
2158
|
+
}
|
|
2159
|
+
}
|
|
2160
|
+
if (tinycolor.isReadable(baseColor, bestColor, {
|
|
2161
|
+
level,
|
|
2162
|
+
size
|
|
2163
|
+
}) || !includeFallbackColors) {
|
|
2164
|
+
return bestColor;
|
|
2165
|
+
} else {
|
|
2166
|
+
args.includeFallbackColors = false;
|
|
2167
|
+
return tinycolor.mostReadable(baseColor, ["#fff", "#000"], args);
|
|
2168
|
+
}
|
|
2169
|
+
};
|
|
2170
|
+
var names = tinycolor.names = {
|
|
2171
|
+
aliceblue: "f0f8ff",
|
|
2172
|
+
antiquewhite: "faebd7",
|
|
2173
|
+
aqua: "0ff",
|
|
2174
|
+
aquamarine: "7fffd4",
|
|
2175
|
+
azure: "f0ffff",
|
|
2176
|
+
beige: "f5f5dc",
|
|
2177
|
+
bisque: "ffe4c4",
|
|
2178
|
+
black: "000",
|
|
2179
|
+
blanchedalmond: "ffebcd",
|
|
2180
|
+
blue: "00f",
|
|
2181
|
+
blueviolet: "8a2be2",
|
|
2182
|
+
brown: "a52a2a",
|
|
2183
|
+
burlywood: "deb887",
|
|
2184
|
+
burntsienna: "ea7e5d",
|
|
2185
|
+
cadetblue: "5f9ea0",
|
|
2186
|
+
chartreuse: "7fff00",
|
|
2187
|
+
chocolate: "d2691e",
|
|
2188
|
+
coral: "ff7f50",
|
|
2189
|
+
cornflowerblue: "6495ed",
|
|
2190
|
+
cornsilk: "fff8dc",
|
|
2191
|
+
crimson: "dc143c",
|
|
2192
|
+
cyan: "0ff",
|
|
2193
|
+
darkblue: "00008b",
|
|
2194
|
+
darkcyan: "008b8b",
|
|
2195
|
+
darkgoldenrod: "b8860b",
|
|
2196
|
+
darkgray: "a9a9a9",
|
|
2197
|
+
darkgreen: "006400",
|
|
2198
|
+
darkgrey: "a9a9a9",
|
|
2199
|
+
darkkhaki: "bdb76b",
|
|
2200
|
+
darkmagenta: "8b008b",
|
|
2201
|
+
darkolivegreen: "556b2f",
|
|
2202
|
+
darkorange: "ff8c00",
|
|
2203
|
+
darkorchid: "9932cc",
|
|
2204
|
+
darkred: "8b0000",
|
|
2205
|
+
darksalmon: "e9967a",
|
|
2206
|
+
darkseagreen: "8fbc8f",
|
|
2207
|
+
darkslateblue: "483d8b",
|
|
2208
|
+
darkslategray: "2f4f4f",
|
|
2209
|
+
darkslategrey: "2f4f4f",
|
|
2210
|
+
darkturquoise: "00ced1",
|
|
2211
|
+
darkviolet: "9400d3",
|
|
2212
|
+
deeppink: "ff1493",
|
|
2213
|
+
deepskyblue: "00bfff",
|
|
2214
|
+
dimgray: "696969",
|
|
2215
|
+
dimgrey: "696969",
|
|
2216
|
+
dodgerblue: "1e90ff",
|
|
2217
|
+
firebrick: "b22222",
|
|
2218
|
+
floralwhite: "fffaf0",
|
|
2219
|
+
forestgreen: "228b22",
|
|
2220
|
+
fuchsia: "f0f",
|
|
2221
|
+
gainsboro: "dcdcdc",
|
|
2222
|
+
ghostwhite: "f8f8ff",
|
|
2223
|
+
gold: "ffd700",
|
|
2224
|
+
goldenrod: "daa520",
|
|
2225
|
+
gray: "808080",
|
|
2226
|
+
green: "008000",
|
|
2227
|
+
greenyellow: "adff2f",
|
|
2228
|
+
grey: "808080",
|
|
2229
|
+
honeydew: "f0fff0",
|
|
2230
|
+
hotpink: "ff69b4",
|
|
2231
|
+
indianred: "cd5c5c",
|
|
2232
|
+
indigo: "4b0082",
|
|
2233
|
+
ivory: "fffff0",
|
|
2234
|
+
khaki: "f0e68c",
|
|
2235
|
+
lavender: "e6e6fa",
|
|
2236
|
+
lavenderblush: "fff0f5",
|
|
2237
|
+
lawngreen: "7cfc00",
|
|
2238
|
+
lemonchiffon: "fffacd",
|
|
2239
|
+
lightblue: "add8e6",
|
|
2240
|
+
lightcoral: "f08080",
|
|
2241
|
+
lightcyan: "e0ffff",
|
|
2242
|
+
lightgoldenrodyellow: "fafad2",
|
|
2243
|
+
lightgray: "d3d3d3",
|
|
2244
|
+
lightgreen: "90ee90",
|
|
2245
|
+
lightgrey: "d3d3d3",
|
|
2246
|
+
lightpink: "ffb6c1",
|
|
2247
|
+
lightsalmon: "ffa07a",
|
|
2248
|
+
lightseagreen: "20b2aa",
|
|
2249
|
+
lightskyblue: "87cefa",
|
|
2250
|
+
lightslategray: "789",
|
|
2251
|
+
lightslategrey: "789",
|
|
2252
|
+
lightsteelblue: "b0c4de",
|
|
2253
|
+
lightyellow: "ffffe0",
|
|
2254
|
+
lime: "0f0",
|
|
2255
|
+
limegreen: "32cd32",
|
|
2256
|
+
linen: "faf0e6",
|
|
2257
|
+
magenta: "f0f",
|
|
2258
|
+
maroon: "800000",
|
|
2259
|
+
mediumaquamarine: "66cdaa",
|
|
2260
|
+
mediumblue: "0000cd",
|
|
2261
|
+
mediumorchid: "ba55d3",
|
|
2262
|
+
mediumpurple: "9370db",
|
|
2263
|
+
mediumseagreen: "3cb371",
|
|
2264
|
+
mediumslateblue: "7b68ee",
|
|
2265
|
+
mediumspringgreen: "00fa9a",
|
|
2266
|
+
mediumturquoise: "48d1cc",
|
|
2267
|
+
mediumvioletred: "c71585",
|
|
2268
|
+
midnightblue: "191970",
|
|
2269
|
+
mintcream: "f5fffa",
|
|
2270
|
+
mistyrose: "ffe4e1",
|
|
2271
|
+
moccasin: "ffe4b5",
|
|
2272
|
+
navajowhite: "ffdead",
|
|
2273
|
+
navy: "000080",
|
|
2274
|
+
oldlace: "fdf5e6",
|
|
2275
|
+
olive: "808000",
|
|
2276
|
+
olivedrab: "6b8e23",
|
|
2277
|
+
orange: "ffa500",
|
|
2278
|
+
orangered: "ff4500",
|
|
2279
|
+
orchid: "da70d6",
|
|
2280
|
+
palegoldenrod: "eee8aa",
|
|
2281
|
+
palegreen: "98fb98",
|
|
2282
|
+
paleturquoise: "afeeee",
|
|
2283
|
+
palevioletred: "db7093",
|
|
2284
|
+
papayawhip: "ffefd5",
|
|
2285
|
+
peachpuff: "ffdab9",
|
|
2286
|
+
peru: "cd853f",
|
|
2287
|
+
pink: "ffc0cb",
|
|
2288
|
+
plum: "dda0dd",
|
|
2289
|
+
powderblue: "b0e0e6",
|
|
2290
|
+
purple: "800080",
|
|
2291
|
+
rebeccapurple: "663399",
|
|
2292
|
+
red: "f00",
|
|
2293
|
+
rosybrown: "bc8f8f",
|
|
2294
|
+
royalblue: "4169e1",
|
|
2295
|
+
saddlebrown: "8b4513",
|
|
2296
|
+
salmon: "fa8072",
|
|
2297
|
+
sandybrown: "f4a460",
|
|
2298
|
+
seagreen: "2e8b57",
|
|
2299
|
+
seashell: "fff5ee",
|
|
2300
|
+
sienna: "a0522d",
|
|
2301
|
+
silver: "c0c0c0",
|
|
2302
|
+
skyblue: "87ceeb",
|
|
2303
|
+
slateblue: "6a5acd",
|
|
2304
|
+
slategray: "708090",
|
|
2305
|
+
slategrey: "708090",
|
|
2306
|
+
snow: "fffafa",
|
|
2307
|
+
springgreen: "00ff7f",
|
|
2308
|
+
steelblue: "4682b4",
|
|
2309
|
+
tan: "d2b48c",
|
|
2310
|
+
teal: "008080",
|
|
2311
|
+
thistle: "d8bfd8",
|
|
2312
|
+
tomato: "ff6347",
|
|
2313
|
+
turquoise: "40e0d0",
|
|
2314
|
+
violet: "ee82ee",
|
|
2315
|
+
wheat: "f5deb3",
|
|
2316
|
+
white: "fff",
|
|
2317
|
+
whitesmoke: "f5f5f5",
|
|
2318
|
+
yellow: "ff0",
|
|
2319
|
+
yellowgreen: "9acd32"
|
|
2320
|
+
};
|
|
2321
|
+
var hexNames = tinycolor.hexNames = flip(names);
|
|
2322
|
+
function flip(o) {
|
|
2323
|
+
var flipped = {};
|
|
2324
|
+
for (var i in o) {
|
|
2325
|
+
if (o.hasOwnProperty(i)) {
|
|
2326
|
+
flipped[o[i]] = i;
|
|
2327
|
+
}
|
|
2328
|
+
}
|
|
2329
|
+
return flipped;
|
|
2330
|
+
}
|
|
2331
|
+
function boundAlpha(a) {
|
|
2332
|
+
a = parseFloat(a);
|
|
2333
|
+
if (isNaN(a) || a < 0 || a > 1) {
|
|
2334
|
+
a = 1;
|
|
2335
|
+
}
|
|
2336
|
+
return a;
|
|
2337
|
+
}
|
|
2338
|
+
function bound01(n, max) {
|
|
2339
|
+
if (isOnePointZero(n))
|
|
2340
|
+
n = "100%";
|
|
2341
|
+
var processPercent = isPercentage(n);
|
|
2342
|
+
n = Math.min(max, Math.max(0, parseFloat(n)));
|
|
2343
|
+
if (processPercent) {
|
|
2344
|
+
n = parseInt(n * max, 10) / 100;
|
|
2345
|
+
}
|
|
2346
|
+
if (Math.abs(n - max) < 1e-6) {
|
|
2347
|
+
return 1;
|
|
2348
|
+
}
|
|
2349
|
+
return n % max / parseFloat(max);
|
|
2350
|
+
}
|
|
2351
|
+
function clamp01(val) {
|
|
2352
|
+
return Math.min(1, Math.max(0, val));
|
|
2353
|
+
}
|
|
2354
|
+
function parseIntFromHex(val) {
|
|
2355
|
+
return parseInt(val, 16);
|
|
2356
|
+
}
|
|
2357
|
+
function isOnePointZero(n) {
|
|
2358
|
+
return typeof n == "string" && n.indexOf(".") != -1 && parseFloat(n) === 1;
|
|
2359
|
+
}
|
|
2360
|
+
function isPercentage(n) {
|
|
2361
|
+
return typeof n === "string" && n.indexOf("%") != -1;
|
|
2362
|
+
}
|
|
2363
|
+
function pad2(c) {
|
|
2364
|
+
return c.length == 1 ? "0" + c : "" + c;
|
|
2365
|
+
}
|
|
2366
|
+
function convertToPercentage(n) {
|
|
2367
|
+
if (n <= 1) {
|
|
2368
|
+
n = n * 100 + "%";
|
|
2369
|
+
}
|
|
2370
|
+
return n;
|
|
2371
|
+
}
|
|
2372
|
+
function convertDecimalToHex(d) {
|
|
2373
|
+
return Math.round(parseFloat(d) * 255).toString(16);
|
|
2374
|
+
}
|
|
2375
|
+
function convertHexToDecimal(h) {
|
|
2376
|
+
return parseIntFromHex(h) / 255;
|
|
2377
|
+
}
|
|
2378
|
+
var matchers = function() {
|
|
2379
|
+
var CSS_INTEGER = "[-\\+]?\\d+%?";
|
|
2380
|
+
var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
|
|
2381
|
+
var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")";
|
|
2382
|
+
var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
|
|
2383
|
+
var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
|
|
2384
|
+
return {
|
|
2385
|
+
CSS_UNIT: new RegExp(CSS_UNIT),
|
|
2386
|
+
rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
|
|
2387
|
+
rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
|
|
2388
|
+
hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
|
|
2389
|
+
hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
|
|
2390
|
+
hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
|
|
2391
|
+
hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
|
|
2392
|
+
hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
|
2393
|
+
hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
|
|
2394
|
+
hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
|
2395
|
+
hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
|
|
2396
|
+
};
|
|
2397
|
+
}();
|
|
2398
|
+
function isValidCSSUnit(color) {
|
|
2399
|
+
return !!matchers.CSS_UNIT.exec(color);
|
|
2400
|
+
}
|
|
2401
|
+
function stringInputToObject(color) {
|
|
2402
|
+
color = color.replace(trimLeft, "").replace(trimRight, "").toLowerCase();
|
|
2403
|
+
var named = false;
|
|
2404
|
+
if (names[color]) {
|
|
2405
|
+
color = names[color];
|
|
2406
|
+
named = true;
|
|
2407
|
+
} else if (color == "transparent") {
|
|
2408
|
+
return { r: 0, g: 0, b: 0, a: 0, format: "name" };
|
|
2409
|
+
}
|
|
2410
|
+
var match;
|
|
2411
|
+
if (match = matchers.rgb.exec(color)) {
|
|
2412
|
+
return { r: match[1], g: match[2], b: match[3] };
|
|
2413
|
+
}
|
|
2414
|
+
if (match = matchers.rgba.exec(color)) {
|
|
2415
|
+
return { r: match[1], g: match[2], b: match[3], a: match[4] };
|
|
2416
|
+
}
|
|
2417
|
+
if (match = matchers.hsl.exec(color)) {
|
|
2418
|
+
return { h: match[1], s: match[2], l: match[3] };
|
|
2419
|
+
}
|
|
2420
|
+
if (match = matchers.hsla.exec(color)) {
|
|
2421
|
+
return { h: match[1], s: match[2], l: match[3], a: match[4] };
|
|
2422
|
+
}
|
|
2423
|
+
if (match = matchers.hsv.exec(color)) {
|
|
2424
|
+
return { h: match[1], s: match[2], v: match[3] };
|
|
2425
|
+
}
|
|
2426
|
+
if (match = matchers.hsva.exec(color)) {
|
|
2427
|
+
return { h: match[1], s: match[2], v: match[3], a: match[4] };
|
|
2428
|
+
}
|
|
2429
|
+
if (match = matchers.hex8.exec(color)) {
|
|
2430
|
+
return {
|
|
2431
|
+
r: parseIntFromHex(match[1]),
|
|
2432
|
+
g: parseIntFromHex(match[2]),
|
|
2433
|
+
b: parseIntFromHex(match[3]),
|
|
2434
|
+
a: convertHexToDecimal(match[4]),
|
|
2435
|
+
format: named ? "name" : "hex8"
|
|
2436
|
+
};
|
|
2437
|
+
}
|
|
2438
|
+
if (match = matchers.hex6.exec(color)) {
|
|
2439
|
+
return {
|
|
2440
|
+
r: parseIntFromHex(match[1]),
|
|
2441
|
+
g: parseIntFromHex(match[2]),
|
|
2442
|
+
b: parseIntFromHex(match[3]),
|
|
2443
|
+
format: named ? "name" : "hex"
|
|
2444
|
+
};
|
|
2445
|
+
}
|
|
2446
|
+
if (match = matchers.hex4.exec(color)) {
|
|
2447
|
+
return {
|
|
2448
|
+
r: parseIntFromHex(match[1] + "" + match[1]),
|
|
2449
|
+
g: parseIntFromHex(match[2] + "" + match[2]),
|
|
2450
|
+
b: parseIntFromHex(match[3] + "" + match[3]),
|
|
2451
|
+
a: convertHexToDecimal(match[4] + "" + match[4]),
|
|
2452
|
+
format: named ? "name" : "hex8"
|
|
2453
|
+
};
|
|
2454
|
+
}
|
|
2455
|
+
if (match = matchers.hex3.exec(color)) {
|
|
2456
|
+
return {
|
|
2457
|
+
r: parseIntFromHex(match[1] + "" + match[1]),
|
|
2458
|
+
g: parseIntFromHex(match[2] + "" + match[2]),
|
|
2459
|
+
b: parseIntFromHex(match[3] + "" + match[3]),
|
|
2460
|
+
format: named ? "name" : "hex"
|
|
2461
|
+
};
|
|
2462
|
+
}
|
|
2463
|
+
return false;
|
|
2464
|
+
}
|
|
2465
|
+
function validateWCAG2Parms(parms) {
|
|
2466
|
+
var level, size;
|
|
2467
|
+
parms = parms || { level: "AA", size: "small" };
|
|
2468
|
+
level = (parms.level || "AA").toUpperCase();
|
|
2469
|
+
size = (parms.size || "small").toLowerCase();
|
|
2470
|
+
if (level !== "AA" && level !== "AAA") {
|
|
2471
|
+
level = "AA";
|
|
2472
|
+
}
|
|
2473
|
+
if (size !== "small" && size !== "large") {
|
|
2474
|
+
size = "small";
|
|
2475
|
+
}
|
|
2476
|
+
return { level, size };
|
|
2477
|
+
}
|
|
2478
|
+
return tinycolor;
|
|
2479
|
+
});
|
|
2480
|
+
}
|
|
2481
|
+
});
|
|
2482
|
+
|
|
2483
|
+
// node_modules/.pnpm/tinygradient@1.1.5/node_modules/tinygradient/index.js
|
|
2484
|
+
var require_tinygradient = __commonJS({
|
|
2485
|
+
"node_modules/.pnpm/tinygradient@1.1.5/node_modules/tinygradient/index.js"(exports, module2) {
|
|
2486
|
+
var tinycolor = require_tinycolor();
|
|
2487
|
+
var RGBA_MAX = { r: 256, g: 256, b: 256, a: 1 };
|
|
2488
|
+
var HSVA_MAX = { h: 360, s: 1, v: 1, a: 1 };
|
|
2489
|
+
function stepize(start, end, steps) {
|
|
2490
|
+
let step = {};
|
|
2491
|
+
for (let k in start) {
|
|
2492
|
+
if (start.hasOwnProperty(k)) {
|
|
2493
|
+
step[k] = steps === 0 ? 0 : (end[k] - start[k]) / steps;
|
|
2494
|
+
}
|
|
2495
|
+
}
|
|
2496
|
+
return step;
|
|
2497
|
+
}
|
|
2498
|
+
function interpolate(step, start, i, max) {
|
|
2499
|
+
let color = {};
|
|
2500
|
+
for (let k in start) {
|
|
2501
|
+
if (start.hasOwnProperty(k)) {
|
|
2502
|
+
color[k] = step[k] * i + start[k];
|
|
2503
|
+
color[k] = color[k] < 0 ? color[k] + max[k] : max[k] !== 1 ? color[k] % max[k] : color[k];
|
|
2504
|
+
}
|
|
2505
|
+
}
|
|
2506
|
+
return color;
|
|
2507
|
+
}
|
|
2508
|
+
function interpolateRgb(stop1, stop2, steps) {
|
|
2509
|
+
const start = stop1.color.toRgb();
|
|
2510
|
+
const end = stop2.color.toRgb();
|
|
2511
|
+
const step = stepize(start, end, steps);
|
|
2512
|
+
let gradient2 = [stop1.color];
|
|
2513
|
+
for (let i = 1; i < steps; i++) {
|
|
2514
|
+
const color = interpolate(step, start, i, RGBA_MAX);
|
|
2515
|
+
gradient2.push(tinycolor(color));
|
|
2516
|
+
}
|
|
2517
|
+
return gradient2;
|
|
2518
|
+
}
|
|
2519
|
+
function interpolateHsv(stop1, stop2, steps, mode) {
|
|
2520
|
+
const start = stop1.color.toHsv();
|
|
2521
|
+
const end = stop2.color.toHsv();
|
|
2522
|
+
if (start.s === 0 || end.s === 0) {
|
|
2523
|
+
return interpolateRgb(stop1, stop2, steps);
|
|
2524
|
+
}
|
|
2525
|
+
let trigonometric;
|
|
2526
|
+
if (typeof mode === "boolean") {
|
|
2527
|
+
trigonometric = mode;
|
|
2528
|
+
} else {
|
|
2529
|
+
const trigShortest = start.h < end.h && end.h - start.h < 180 || start.h > end.h && start.h - end.h > 180;
|
|
2530
|
+
trigonometric = mode === "long" && trigShortest || mode === "short" && !trigShortest;
|
|
2531
|
+
}
|
|
2532
|
+
const step = stepize(start, end, steps);
|
|
2533
|
+
let gradient2 = [stop1.color];
|
|
2534
|
+
let diff;
|
|
2535
|
+
if (start.h <= end.h && !trigonometric || start.h >= end.h && trigonometric) {
|
|
2536
|
+
diff = end.h - start.h;
|
|
2537
|
+
} else if (trigonometric) {
|
|
2538
|
+
diff = 360 - end.h + start.h;
|
|
2539
|
+
} else {
|
|
2540
|
+
diff = 360 - start.h + end.h;
|
|
2541
|
+
}
|
|
2542
|
+
step.h = Math.pow(-1, trigonometric ? 1 : 0) * Math.abs(diff) / steps;
|
|
2543
|
+
for (let i = 1; i < steps; i++) {
|
|
2544
|
+
const color = interpolate(step, start, i, HSVA_MAX);
|
|
2545
|
+
gradient2.push(tinycolor(color));
|
|
2546
|
+
}
|
|
2547
|
+
return gradient2;
|
|
2548
|
+
}
|
|
2549
|
+
function computeSubsteps(stops, steps) {
|
|
2550
|
+
const l = stops.length;
|
|
2551
|
+
steps = parseInt(steps, 10);
|
|
2552
|
+
if (isNaN(steps) || steps < 2) {
|
|
2553
|
+
throw new Error("Invalid number of steps (< 2)");
|
|
2554
|
+
}
|
|
2555
|
+
if (steps < l) {
|
|
2556
|
+
throw new Error("Number of steps cannot be inferior to number of stops");
|
|
2557
|
+
}
|
|
2558
|
+
let substeps = [];
|
|
2559
|
+
for (let i = 1; i < l; i++) {
|
|
2560
|
+
const step = (steps - 1) * (stops[i].pos - stops[i - 1].pos);
|
|
2561
|
+
substeps.push(Math.max(1, Math.round(step)));
|
|
2562
|
+
}
|
|
2563
|
+
let totalSubsteps = 1;
|
|
2564
|
+
for (let n = l - 1; n--; )
|
|
2565
|
+
totalSubsteps += substeps[n];
|
|
2566
|
+
while (totalSubsteps !== steps) {
|
|
2567
|
+
if (totalSubsteps < steps) {
|
|
2568
|
+
const min = Math.min.apply(null, substeps);
|
|
2569
|
+
substeps[substeps.indexOf(min)]++;
|
|
2570
|
+
totalSubsteps++;
|
|
2571
|
+
} else {
|
|
2572
|
+
const max = Math.max.apply(null, substeps);
|
|
2573
|
+
substeps[substeps.indexOf(max)]--;
|
|
2574
|
+
totalSubsteps--;
|
|
2575
|
+
}
|
|
2576
|
+
}
|
|
2577
|
+
return substeps;
|
|
2578
|
+
}
|
|
2579
|
+
function computeAt(stops, pos, method, max) {
|
|
2580
|
+
if (pos < 0 || pos > 1) {
|
|
2581
|
+
throw new Error("Position must be between 0 and 1");
|
|
2582
|
+
}
|
|
2583
|
+
let start, end;
|
|
2584
|
+
for (let i = 0, l = stops.length; i < l - 1; i++) {
|
|
2585
|
+
if (pos >= stops[i].pos && pos < stops[i + 1].pos) {
|
|
2586
|
+
start = stops[i];
|
|
2587
|
+
end = stops[i + 1];
|
|
2588
|
+
break;
|
|
2589
|
+
}
|
|
2590
|
+
}
|
|
2591
|
+
if (!start) {
|
|
2592
|
+
start = end = stops[stops.length - 1];
|
|
2593
|
+
}
|
|
2594
|
+
const step = stepize(start.color[method](), end.color[method](), (end.pos - start.pos) * 100);
|
|
2595
|
+
const color = interpolate(step, start.color[method](), (pos - start.pos) * 100, max);
|
|
2596
|
+
return tinycolor(color);
|
|
2597
|
+
}
|
|
2598
|
+
var TinyGradient = class {
|
|
2599
|
+
constructor(stops) {
|
|
2600
|
+
if (stops.length < 2) {
|
|
2601
|
+
throw new Error("Invalid number of stops (< 2)");
|
|
2602
|
+
}
|
|
2603
|
+
const havingPositions = stops[0].pos !== void 0;
|
|
2604
|
+
let l = stops.length;
|
|
2605
|
+
let p = -1;
|
|
2606
|
+
let lastColorLess = false;
|
|
2607
|
+
this.stops = stops.map((stop, i) => {
|
|
2608
|
+
const hasPosition = stop.pos !== void 0;
|
|
2609
|
+
if (havingPositions ^ hasPosition) {
|
|
2610
|
+
throw new Error("Cannot mix positionned and not posionned color stops");
|
|
2611
|
+
}
|
|
2612
|
+
if (hasPosition) {
|
|
2613
|
+
const hasColor = stop.color !== void 0;
|
|
2614
|
+
if (!hasColor && (lastColorLess || i === 0 || i === l - 1)) {
|
|
2615
|
+
throw new Error("Cannot define two consecutive position-only stops");
|
|
2616
|
+
}
|
|
2617
|
+
lastColorLess = !hasColor;
|
|
2618
|
+
stop = {
|
|
2619
|
+
color: hasColor ? tinycolor(stop.color) : null,
|
|
2620
|
+
colorLess: !hasColor,
|
|
2621
|
+
pos: stop.pos
|
|
2622
|
+
};
|
|
2623
|
+
if (stop.pos < 0 || stop.pos > 1) {
|
|
2624
|
+
throw new Error("Color stops positions must be between 0 and 1");
|
|
2625
|
+
} else if (stop.pos < p) {
|
|
2626
|
+
throw new Error("Color stops positions are not ordered");
|
|
2627
|
+
}
|
|
2628
|
+
p = stop.pos;
|
|
2629
|
+
} else {
|
|
2630
|
+
stop = {
|
|
2631
|
+
color: tinycolor(stop.color !== void 0 ? stop.color : stop),
|
|
2632
|
+
pos: i / (l - 1)
|
|
2633
|
+
};
|
|
2634
|
+
}
|
|
2635
|
+
return stop;
|
|
2636
|
+
});
|
|
2637
|
+
if (this.stops[0].pos !== 0) {
|
|
2638
|
+
this.stops.unshift({
|
|
2639
|
+
color: this.stops[0].color,
|
|
2640
|
+
pos: 0
|
|
2641
|
+
});
|
|
2642
|
+
l++;
|
|
2643
|
+
}
|
|
2644
|
+
if (this.stops[l - 1].pos !== 1) {
|
|
2645
|
+
this.stops.push({
|
|
2646
|
+
color: this.stops[l - 1].color,
|
|
2647
|
+
pos: 1
|
|
2648
|
+
});
|
|
2649
|
+
}
|
|
2650
|
+
}
|
|
2651
|
+
reverse() {
|
|
2652
|
+
let stops = [];
|
|
2653
|
+
this.stops.forEach(function(stop) {
|
|
2654
|
+
stops.push({
|
|
2655
|
+
color: stop.color,
|
|
2656
|
+
pos: 1 - stop.pos
|
|
2657
|
+
});
|
|
2658
|
+
});
|
|
2659
|
+
return new TinyGradient(stops.reverse());
|
|
2660
|
+
}
|
|
2661
|
+
loop() {
|
|
2662
|
+
let stops1 = [];
|
|
2663
|
+
let stops2 = [];
|
|
2664
|
+
this.stops.forEach((stop) => {
|
|
2665
|
+
stops1.push({
|
|
2666
|
+
color: stop.color,
|
|
2667
|
+
pos: stop.pos / 2
|
|
2668
|
+
});
|
|
2669
|
+
});
|
|
2670
|
+
this.stops.slice(0, -1).forEach((stop) => {
|
|
2671
|
+
stops2.push({
|
|
2672
|
+
color: stop.color,
|
|
2673
|
+
pos: 1 - stop.pos / 2
|
|
2674
|
+
});
|
|
2675
|
+
});
|
|
2676
|
+
return new TinyGradient(stops1.concat(stops2.reverse()));
|
|
2677
|
+
}
|
|
2678
|
+
rgb(steps) {
|
|
2679
|
+
const substeps = computeSubsteps(this.stops, steps);
|
|
2680
|
+
let gradient2 = [];
|
|
2681
|
+
this.stops.forEach((stop, i) => {
|
|
2682
|
+
if (stop.colorLess) {
|
|
2683
|
+
stop.color = interpolateRgb(this.stops[i - 1], this.stops[i + 1], 2)[1];
|
|
2684
|
+
}
|
|
2685
|
+
});
|
|
2686
|
+
for (let i = 0, l = this.stops.length; i < l - 1; i++) {
|
|
2687
|
+
const rgb = interpolateRgb(this.stops[i], this.stops[i + 1], substeps[i]);
|
|
2688
|
+
gradient2.splice(gradient2.length, 0, ...rgb);
|
|
2689
|
+
}
|
|
2690
|
+
gradient2.push(this.stops[this.stops.length - 1].color);
|
|
2691
|
+
return gradient2;
|
|
2692
|
+
}
|
|
2693
|
+
hsv(steps, mode) {
|
|
2694
|
+
const substeps = computeSubsteps(this.stops, steps);
|
|
2695
|
+
let gradient2 = [];
|
|
2696
|
+
this.stops.forEach((stop, i) => {
|
|
2697
|
+
if (stop.colorLess) {
|
|
2698
|
+
stop.color = interpolateHsv(this.stops[i - 1], this.stops[i + 1], 2, mode)[1];
|
|
2699
|
+
}
|
|
2700
|
+
});
|
|
2701
|
+
for (let i = 0, l = this.stops.length; i < l - 1; i++) {
|
|
2702
|
+
const hsv = interpolateHsv(this.stops[i], this.stops[i + 1], substeps[i], mode);
|
|
2703
|
+
gradient2.splice(gradient2.length, 0, ...hsv);
|
|
2704
|
+
}
|
|
2705
|
+
gradient2.push(this.stops[this.stops.length - 1].color);
|
|
2706
|
+
return gradient2;
|
|
2707
|
+
}
|
|
2708
|
+
css(mode, direction) {
|
|
2709
|
+
mode = mode || "linear";
|
|
2710
|
+
direction = direction || (mode === "linear" ? "to right" : "ellipse at center");
|
|
2711
|
+
let css = mode + "-gradient(" + direction;
|
|
2712
|
+
this.stops.forEach(function(stop) {
|
|
2713
|
+
css += ", " + (stop.colorLess ? "" : stop.color.toRgbString() + " ") + stop.pos * 100 + "%";
|
|
2714
|
+
});
|
|
2715
|
+
css += ")";
|
|
2716
|
+
return css;
|
|
2717
|
+
}
|
|
2718
|
+
rgbAt(pos) {
|
|
2719
|
+
return computeAt(this.stops, pos, "toRgb", RGBA_MAX);
|
|
2720
|
+
}
|
|
2721
|
+
hsvAt(pos) {
|
|
2722
|
+
return computeAt(this.stops, pos, "toHsv", HSVA_MAX);
|
|
2723
|
+
}
|
|
2724
|
+
};
|
|
2725
|
+
module2.exports = function(stops) {
|
|
2726
|
+
if (arguments.length === 1) {
|
|
2727
|
+
if (!Array.isArray(arguments[0])) {
|
|
2728
|
+
throw new Error('"stops" is not an array');
|
|
2729
|
+
}
|
|
2730
|
+
stops = arguments[0];
|
|
2731
|
+
} else {
|
|
2732
|
+
stops = Array.prototype.slice.call(arguments);
|
|
2733
|
+
}
|
|
2734
|
+
return new TinyGradient(stops);
|
|
2735
|
+
};
|
|
2736
|
+
}
|
|
2737
|
+
});
|
|
2738
|
+
|
|
2739
|
+
// node_modules/.pnpm/gradient-string@2.0.2/node_modules/gradient-string/index.js
|
|
2740
|
+
var require_gradient_string = __commonJS({
|
|
2741
|
+
"node_modules/.pnpm/gradient-string@2.0.2/node_modules/gradient-string/index.js"(exports, module2) {
|
|
2742
|
+
"use strict";
|
|
2743
|
+
var chalk = require_source();
|
|
2744
|
+
var tinygradient = require_tinygradient();
|
|
2745
|
+
var forbiddenChars = /\s/g;
|
|
2746
|
+
function InitGradient(...args) {
|
|
2747
|
+
const grad = tinygradient.apply(this, args);
|
|
2748
|
+
const ret = (str, opts) => applyGradient(str ? str.toString() : "", grad, opts);
|
|
2749
|
+
ret.multiline = (str, opts) => multilineGradient(str ? str.toString() : "", grad, opts);
|
|
2750
|
+
return ret;
|
|
2751
|
+
}
|
|
2752
|
+
var getColors = (gradient2, options, count) => options.interpolation.toLowerCase() === "hsv" ? gradient2.hsv(count, options.hsvSpin.toLowerCase()) : gradient2.rgb(count);
|
|
2753
|
+
function applyGradient(str, gradient2, opts) {
|
|
2754
|
+
const options = validateOptions(opts);
|
|
2755
|
+
const colorsCount = Math.max(str.replace(forbiddenChars, "").length, gradient2.stops.length);
|
|
2756
|
+
const colors = getColors(gradient2, options, colorsCount);
|
|
2757
|
+
let result = "";
|
|
2758
|
+
for (const s of str) {
|
|
2759
|
+
result += s.match(forbiddenChars) ? s : chalk.hex(colors.shift().toHex())(s);
|
|
2760
|
+
}
|
|
2761
|
+
return result;
|
|
2762
|
+
}
|
|
2763
|
+
function multilineGradient(str, gradient2, opts) {
|
|
2764
|
+
const options = validateOptions(opts);
|
|
2765
|
+
const lines = str.split("\n");
|
|
2766
|
+
const maxLength = Math.max.apply(null, lines.map((l) => l.length).concat([gradient2.stops.length]));
|
|
2767
|
+
const colors = getColors(gradient2, options, maxLength);
|
|
2768
|
+
const results = [];
|
|
2769
|
+
for (const line of lines) {
|
|
2770
|
+
const lineColors = colors.slice(0);
|
|
2771
|
+
let lineResult = "";
|
|
2772
|
+
for (const l of line) {
|
|
2773
|
+
lineResult += chalk.hex(lineColors.shift().toHex())(l);
|
|
2774
|
+
}
|
|
2775
|
+
results.push(lineResult);
|
|
2776
|
+
}
|
|
2777
|
+
return results.join("\n");
|
|
2778
|
+
}
|
|
2779
|
+
function validateOptions(opts) {
|
|
2780
|
+
const options = { interpolation: "rgb", hsvSpin: "short", ...opts };
|
|
2781
|
+
if (opts !== void 0 && typeof opts !== "object") {
|
|
2782
|
+
throw new TypeError(`Expected \`options\` to be an \`object\`, got \`${typeof opts}\``);
|
|
2783
|
+
}
|
|
2784
|
+
if (typeof options.interpolation !== "string") {
|
|
2785
|
+
throw new TypeError(`Expected \`options.interpolation\` to be a \`string\`, got \`${typeof options.interpolation}\``);
|
|
2786
|
+
}
|
|
2787
|
+
if (options.interpolation.toLowerCase() === "hsv" && typeof options.hsvSpin !== "string") {
|
|
2788
|
+
throw new TypeError(`Expected \`options.hsvSpin\` to be a \`string\`, got \`${typeof options.hsvSpin}\``);
|
|
2789
|
+
}
|
|
2790
|
+
return options;
|
|
2791
|
+
}
|
|
2792
|
+
var aliases = {
|
|
2793
|
+
atlas: { colors: ["#feac5e", "#c779d0", "#4bc0c8"], options: {} },
|
|
2794
|
+
cristal: { colors: ["#bdfff3", "#4ac29a"], options: {} },
|
|
2795
|
+
teen: { colors: ["#77a1d3", "#79cbca", "#e684ae"], options: {} },
|
|
2796
|
+
mind: { colors: ["#473b7b", "#3584a7", "#30d2be"], options: {} },
|
|
2797
|
+
morning: { colors: ["#ff5f6d", "#ffc371"], options: { interpolation: "hsv" } },
|
|
2798
|
+
vice: { colors: ["#5ee7df", "#b490ca"], options: { interpolation: "hsv" } },
|
|
2799
|
+
passion: { colors: ["#f43b47", "#453a94"], options: {} },
|
|
2800
|
+
fruit: { colors: ["#ff4e50", "#f9d423"], options: {} },
|
|
2801
|
+
instagram: { colors: ["#833ab4", "#fd1d1d", "#fcb045"], options: {} },
|
|
2802
|
+
retro: { colors: ["#3f51b1", "#5a55ae", "#7b5fac", "#8f6aae", "#a86aa4", "#cc6b8e", "#f18271", "#f3a469", "#f7c978"], options: {} },
|
|
2803
|
+
summer: { colors: ["#fdbb2d", "#22c1c3"], options: {} },
|
|
2804
|
+
rainbow: { colors: ["#ff0000", "#ff0100"], options: { interpolation: "hsv", hsvSpin: "long" } },
|
|
2805
|
+
pastel: { colors: ["#74ebd5", "#74ecd5"], options: { interpolation: "hsv", hsvSpin: "long" } }
|
|
2806
|
+
};
|
|
2807
|
+
module2.exports = InitGradient;
|
|
2808
|
+
for (const a in aliases) {
|
|
2809
|
+
module2.exports[a] = (str) => new InitGradient(aliases[a].colors)(str, aliases[a].options);
|
|
2810
|
+
module2.exports[a].multiline = (str) => new InitGradient(aliases[a].colors).multiline(str, aliases[a].options);
|
|
2811
|
+
}
|
|
2812
|
+
}
|
|
2813
|
+
});
|
|
2814
|
+
|
|
2815
|
+
// src/index.ts
|
|
2816
|
+
var src_exports = {};
|
|
2817
|
+
__export(src_exports, {
|
|
2818
|
+
default: () => src_default,
|
|
2819
|
+
logger: () => logger,
|
|
2820
|
+
mergeConfigContent: () => mergeConfigContent,
|
|
2821
|
+
mergeTsConfigs: () => mergeTsConfigs,
|
|
2822
|
+
resolveJSON: () => resolveJSON,
|
|
2823
|
+
script: () => script
|
|
2824
|
+
});
|
|
2825
|
+
module.exports = __toCommonJS(src_exports);
|
|
2826
|
+
|
|
2827
|
+
// src/scripts.ts
|
|
2828
|
+
var import_fs = require("fs");
|
|
2829
|
+
var import_gradient_string = __toESM(require_gradient_string(), 1);
|
|
2830
|
+
var logger = ({ isDebugging = false, emoji = `\u{1F6E3}\uFE0F`, gap = ` => `, name = "merge-tsconfigs" }) => (type) => (section) => (message) => (err) => {
|
|
2831
|
+
const debugMsg = isDebugging ? "debugging:" : "";
|
|
2832
|
+
const sectionMsg = section.length ? `${section}:` : "";
|
|
2833
|
+
const firstLine = `${name}:${debugMsg}${sectionMsg}`;
|
|
2834
|
+
const secondLine = message ? `${emoji}${gap}${message}` : "";
|
|
2835
|
+
if (type === "error") {
|
|
2836
|
+
console.error(import_gradient_string.default.passion(firstLine));
|
|
2837
|
+
if (secondLine)
|
|
2838
|
+
console.error(secondLine);
|
|
2839
|
+
if (err)
|
|
2840
|
+
console.error(err);
|
|
2841
|
+
} else if (type === "debug") {
|
|
2842
|
+
console.debug(import_gradient_string.default.passion(firstLine));
|
|
2843
|
+
if (secondLine)
|
|
2844
|
+
console.debug(secondLine);
|
|
2845
|
+
} else if (type === "info") {
|
|
2846
|
+
console.info(import_gradient_string.default.teen(firstLine));
|
|
2847
|
+
if (secondLine)
|
|
2848
|
+
console.info(secondLine);
|
|
2849
|
+
} else {
|
|
2850
|
+
console.log(import_gradient_string.default.teen(firstLine));
|
|
2851
|
+
if (secondLine)
|
|
2852
|
+
console.log(secondLine);
|
|
2853
|
+
}
|
|
2854
|
+
};
|
|
2855
|
+
function resolveJSON(path, debug = false) {
|
|
2856
|
+
try {
|
|
2857
|
+
const json = JSON.parse((0, import_fs.readFileSync)(path, "utf8"));
|
|
2858
|
+
return json;
|
|
2859
|
+
} catch (err) {
|
|
2860
|
+
if (debug)
|
|
2861
|
+
logger({ isDebugging: debug })("error")("resolveJSON")("There was an error:")(err);
|
|
2862
|
+
return {};
|
|
2863
|
+
}
|
|
2864
|
+
}
|
|
2865
|
+
var mergeConfigContent = (tsconfigs, debug = false) => tsconfigs.reduce((acc = {}, tsconfig) => {
|
|
2866
|
+
let tsconfigJSON = resolveJSON(tsconfig, true);
|
|
2867
|
+
if (tsconfigJSON?.extends) {
|
|
2868
|
+
const parentTsconfig = resolveJSON(tsconfigJSON.extends, true);
|
|
2869
|
+
if (parentTsconfig?.extends) {
|
|
2870
|
+
logger({ isDebugging: false })("error")("mergeConfigContent")("Parent tsconfig:merge-tsconfigs only handles extending from a parent, consider extending tsconfigs less.")(parentTsconfig);
|
|
2871
|
+
}
|
|
2872
|
+
tsconfigJSON = {
|
|
2873
|
+
...parentTsconfig,
|
|
2874
|
+
...tsconfigJSON
|
|
2875
|
+
};
|
|
2876
|
+
}
|
|
2877
|
+
if (!tsconfigJSON) {
|
|
2878
|
+
if (debug)
|
|
2879
|
+
logger({ isDebugging: debug })("error")("mergeConfigContent")("There was an error:")(tsconfigJSON);
|
|
2880
|
+
return acc;
|
|
2881
|
+
}
|
|
2882
|
+
return {
|
|
2883
|
+
...acc,
|
|
2884
|
+
...tsconfigJSON
|
|
2885
|
+
};
|
|
2886
|
+
}, {});
|
|
2887
|
+
var mergeTsConfigs = ({
|
|
2888
|
+
tsconfigs = [],
|
|
2889
|
+
debug = false
|
|
2890
|
+
}) => {
|
|
2891
|
+
if (tsconfigs.length === 0) {
|
|
2892
|
+
if (debug)
|
|
2893
|
+
logger({ isDebugging: debug })("error")("mergeTsConfig")("No tsconfig files were provided.")(null);
|
|
2894
|
+
return;
|
|
2895
|
+
}
|
|
2896
|
+
const updatedTsconfig = mergeConfigContent(tsconfigs, debug);
|
|
2897
|
+
if (debug)
|
|
2898
|
+
logger({ isDebugging: debug })("debug")("mergeTsConfig")("Updated tsconfig:")(updatedTsconfig);
|
|
2899
|
+
return {
|
|
2900
|
+
...updatedTsconfig
|
|
2901
|
+
};
|
|
2902
|
+
};
|
|
2903
|
+
var script = mergeTsConfigs;
|
|
2904
|
+
var scripts_default = mergeTsConfigs;
|
|
2905
|
+
|
|
2906
|
+
// src/program.ts
|
|
2907
|
+
var import_commander = require("commander");
|
|
2908
|
+
import_commander.program.name("merge-tsconfigs").description(
|
|
2909
|
+
"Codependency, for code dependency. Checks `coDependencies` in package.json files to ensure dependencies are up-to-date"
|
|
2910
|
+
).argument("[files...]", "files to check").option("-t, --isTestingCLI", "enable CLI only testing").option("--isTesting", "enable running fn tests w/o overwriting");
|
|
2911
|
+
|
|
2912
|
+
// src/index.ts
|
|
2913
|
+
var src_default = scripts_default;
|
|
2914
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
2915
|
+
0 && (module.exports = {
|
|
2916
|
+
logger,
|
|
2917
|
+
mergeConfigContent,
|
|
2918
|
+
mergeTsConfigs,
|
|
2919
|
+
resolveJSON,
|
|
2920
|
+
script
|
|
2921
|
+
});
|