@protonradio/proton-ui 0.6.18-beta.2 → 0.6.18-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +12 -13
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +2162 -9862
- package/dist/index.es.js.map +1 -1
- package/dist/utils-C8gwYqRQ.js +2 -0
- package/dist/utils-C8gwYqRQ.js.map +1 -0
- package/dist/utils-D71ZKfny.mjs +114 -0
- package/dist/utils-D71ZKfny.mjs.map +1 -0
- package/dist/utils.cjs.js +1 -1
- package/dist/utils.es.js +1 -1
- package/package.json +2 -1
- package/dist/index-C_MMhG34.mjs +0 -1759
- package/dist/index-C_MMhG34.mjs.map +0 -1
- package/dist/index-DdgXcT07.js +0 -14
- package/dist/index-DdgXcT07.js.map +0 -1
package/dist/index-C_MMhG34.mjs
DELETED
|
@@ -1,1759 +0,0 @@
|
|
|
1
|
-
import { B as Mt, G as v } from "./colors-Dwh4VIMR.mjs";
|
|
2
|
-
const { min: je, max: He } = Math, J = (t, e = 0, n = 1) => je(He(e, t), n), Tt = (t) => {
|
|
3
|
-
t._clipped = !1, t._unclipped = t.slice(0);
|
|
4
|
-
for (let e = 0; e <= 3; e++)
|
|
5
|
-
e < 3 ? ((t[e] < 0 || t[e] > 255) && (t._clipped = !0), t[e] = J(t[e], 0, 255)) : e === 3 && (t[e] = J(t[e], 0, 1));
|
|
6
|
-
return t;
|
|
7
|
-
}, fe = {};
|
|
8
|
-
for (let t of [
|
|
9
|
-
"Boolean",
|
|
10
|
-
"Number",
|
|
11
|
-
"String",
|
|
12
|
-
"Function",
|
|
13
|
-
"Array",
|
|
14
|
-
"Date",
|
|
15
|
-
"RegExp",
|
|
16
|
-
"Undefined",
|
|
17
|
-
"Null"
|
|
18
|
-
])
|
|
19
|
-
fe[`[object ${t}]`] = t.toLowerCase();
|
|
20
|
-
function E(t) {
|
|
21
|
-
return fe[Object.prototype.toString.call(t)] || "object";
|
|
22
|
-
}
|
|
23
|
-
const M = (t, e = null) => t.length >= 3 ? Array.prototype.slice.call(t) : E(t[0]) == "object" && e ? e.split("").filter((n) => t[0][n] !== void 0).map((n) => t[0][n]) : t[0].slice(0), ct = (t) => {
|
|
24
|
-
if (t.length < 2) return null;
|
|
25
|
-
const e = t.length - 1;
|
|
26
|
-
return E(t[e]) == "string" ? t[e].toLowerCase() : null;
|
|
27
|
-
}, { PI: yt, min: ae, max: le } = Math, j = (t) => Math.round(t * 100) / 100, xt = (t) => Math.round(t * 100) / 100, X = yt * 2, At = yt / 3, Be = yt / 180, ze = 180 / yt;
|
|
28
|
-
function ie(t) {
|
|
29
|
-
return [...t.slice(0, 3).reverse(), ...t.slice(3)];
|
|
30
|
-
}
|
|
31
|
-
const y = {
|
|
32
|
-
format: {},
|
|
33
|
-
autodetect: []
|
|
34
|
-
};
|
|
35
|
-
class i {
|
|
36
|
-
constructor(...e) {
|
|
37
|
-
const n = this;
|
|
38
|
-
if (E(e[0]) === "object" && e[0].constructor && e[0].constructor === this.constructor)
|
|
39
|
-
return e[0];
|
|
40
|
-
let r = ct(e), o = !1;
|
|
41
|
-
if (!r) {
|
|
42
|
-
o = !0, y.sorted || (y.autodetect = y.autodetect.sort((c, s) => s.p - c.p), y.sorted = !0);
|
|
43
|
-
for (let c of y.autodetect)
|
|
44
|
-
if (r = c.test(...e), r) break;
|
|
45
|
-
}
|
|
46
|
-
if (y.format[r]) {
|
|
47
|
-
const c = y.format[r].apply(
|
|
48
|
-
null,
|
|
49
|
-
o ? e : e.slice(0, -1)
|
|
50
|
-
);
|
|
51
|
-
n._rgb = Tt(c);
|
|
52
|
-
} else
|
|
53
|
-
throw new Error("unknown format: " + e);
|
|
54
|
-
n._rgb.length === 3 && n._rgb.push(1);
|
|
55
|
-
}
|
|
56
|
-
toString() {
|
|
57
|
-
return E(this.hex) == "function" ? this.hex() : `[${this._rgb.join(",")}]`;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
const Ue = "3.1.2", k = (...t) => new i(...t);
|
|
61
|
-
k.version = Ue;
|
|
62
|
-
const rt = {
|
|
63
|
-
aliceblue: "#f0f8ff",
|
|
64
|
-
antiquewhite: "#faebd7",
|
|
65
|
-
aqua: "#00ffff",
|
|
66
|
-
aquamarine: "#7fffd4",
|
|
67
|
-
azure: "#f0ffff",
|
|
68
|
-
beige: "#f5f5dc",
|
|
69
|
-
bisque: "#ffe4c4",
|
|
70
|
-
black: "#000000",
|
|
71
|
-
blanchedalmond: "#ffebcd",
|
|
72
|
-
blue: "#0000ff",
|
|
73
|
-
blueviolet: "#8a2be2",
|
|
74
|
-
brown: "#a52a2a",
|
|
75
|
-
burlywood: "#deb887",
|
|
76
|
-
cadetblue: "#5f9ea0",
|
|
77
|
-
chartreuse: "#7fff00",
|
|
78
|
-
chocolate: "#d2691e",
|
|
79
|
-
coral: "#ff7f50",
|
|
80
|
-
cornflowerblue: "#6495ed",
|
|
81
|
-
cornsilk: "#fff8dc",
|
|
82
|
-
crimson: "#dc143c",
|
|
83
|
-
cyan: "#00ffff",
|
|
84
|
-
darkblue: "#00008b",
|
|
85
|
-
darkcyan: "#008b8b",
|
|
86
|
-
darkgoldenrod: "#b8860b",
|
|
87
|
-
darkgray: "#a9a9a9",
|
|
88
|
-
darkgreen: "#006400",
|
|
89
|
-
darkgrey: "#a9a9a9",
|
|
90
|
-
darkkhaki: "#bdb76b",
|
|
91
|
-
darkmagenta: "#8b008b",
|
|
92
|
-
darkolivegreen: "#556b2f",
|
|
93
|
-
darkorange: "#ff8c00",
|
|
94
|
-
darkorchid: "#9932cc",
|
|
95
|
-
darkred: "#8b0000",
|
|
96
|
-
darksalmon: "#e9967a",
|
|
97
|
-
darkseagreen: "#8fbc8f",
|
|
98
|
-
darkslateblue: "#483d8b",
|
|
99
|
-
darkslategray: "#2f4f4f",
|
|
100
|
-
darkslategrey: "#2f4f4f",
|
|
101
|
-
darkturquoise: "#00ced1",
|
|
102
|
-
darkviolet: "#9400d3",
|
|
103
|
-
deeppink: "#ff1493",
|
|
104
|
-
deepskyblue: "#00bfff",
|
|
105
|
-
dimgray: "#696969",
|
|
106
|
-
dimgrey: "#696969",
|
|
107
|
-
dodgerblue: "#1e90ff",
|
|
108
|
-
firebrick: "#b22222",
|
|
109
|
-
floralwhite: "#fffaf0",
|
|
110
|
-
forestgreen: "#228b22",
|
|
111
|
-
fuchsia: "#ff00ff",
|
|
112
|
-
gainsboro: "#dcdcdc",
|
|
113
|
-
ghostwhite: "#f8f8ff",
|
|
114
|
-
gold: "#ffd700",
|
|
115
|
-
goldenrod: "#daa520",
|
|
116
|
-
gray: "#808080",
|
|
117
|
-
green: "#008000",
|
|
118
|
-
greenyellow: "#adff2f",
|
|
119
|
-
grey: "#808080",
|
|
120
|
-
honeydew: "#f0fff0",
|
|
121
|
-
hotpink: "#ff69b4",
|
|
122
|
-
indianred: "#cd5c5c",
|
|
123
|
-
indigo: "#4b0082",
|
|
124
|
-
ivory: "#fffff0",
|
|
125
|
-
khaki: "#f0e68c",
|
|
126
|
-
laserlemon: "#ffff54",
|
|
127
|
-
lavender: "#e6e6fa",
|
|
128
|
-
lavenderblush: "#fff0f5",
|
|
129
|
-
lawngreen: "#7cfc00",
|
|
130
|
-
lemonchiffon: "#fffacd",
|
|
131
|
-
lightblue: "#add8e6",
|
|
132
|
-
lightcoral: "#f08080",
|
|
133
|
-
lightcyan: "#e0ffff",
|
|
134
|
-
lightgoldenrod: "#fafad2",
|
|
135
|
-
lightgoldenrodyellow: "#fafad2",
|
|
136
|
-
lightgray: "#d3d3d3",
|
|
137
|
-
lightgreen: "#90ee90",
|
|
138
|
-
lightgrey: "#d3d3d3",
|
|
139
|
-
lightpink: "#ffb6c1",
|
|
140
|
-
lightsalmon: "#ffa07a",
|
|
141
|
-
lightseagreen: "#20b2aa",
|
|
142
|
-
lightskyblue: "#87cefa",
|
|
143
|
-
lightslategray: "#778899",
|
|
144
|
-
lightslategrey: "#778899",
|
|
145
|
-
lightsteelblue: "#b0c4de",
|
|
146
|
-
lightyellow: "#ffffe0",
|
|
147
|
-
lime: "#00ff00",
|
|
148
|
-
limegreen: "#32cd32",
|
|
149
|
-
linen: "#faf0e6",
|
|
150
|
-
magenta: "#ff00ff",
|
|
151
|
-
maroon: "#800000",
|
|
152
|
-
maroon2: "#7f0000",
|
|
153
|
-
maroon3: "#b03060",
|
|
154
|
-
mediumaquamarine: "#66cdaa",
|
|
155
|
-
mediumblue: "#0000cd",
|
|
156
|
-
mediumorchid: "#ba55d3",
|
|
157
|
-
mediumpurple: "#9370db",
|
|
158
|
-
mediumseagreen: "#3cb371",
|
|
159
|
-
mediumslateblue: "#7b68ee",
|
|
160
|
-
mediumspringgreen: "#00fa9a",
|
|
161
|
-
mediumturquoise: "#48d1cc",
|
|
162
|
-
mediumvioletred: "#c71585",
|
|
163
|
-
midnightblue: "#191970",
|
|
164
|
-
mintcream: "#f5fffa",
|
|
165
|
-
mistyrose: "#ffe4e1",
|
|
166
|
-
moccasin: "#ffe4b5",
|
|
167
|
-
navajowhite: "#ffdead",
|
|
168
|
-
navy: "#000080",
|
|
169
|
-
oldlace: "#fdf5e6",
|
|
170
|
-
olive: "#808000",
|
|
171
|
-
olivedrab: "#6b8e23",
|
|
172
|
-
orange: "#ffa500",
|
|
173
|
-
orangered: "#ff4500",
|
|
174
|
-
orchid: "#da70d6",
|
|
175
|
-
palegoldenrod: "#eee8aa",
|
|
176
|
-
palegreen: "#98fb98",
|
|
177
|
-
paleturquoise: "#afeeee",
|
|
178
|
-
palevioletred: "#db7093",
|
|
179
|
-
papayawhip: "#ffefd5",
|
|
180
|
-
peachpuff: "#ffdab9",
|
|
181
|
-
peru: "#cd853f",
|
|
182
|
-
pink: "#ffc0cb",
|
|
183
|
-
plum: "#dda0dd",
|
|
184
|
-
powderblue: "#b0e0e6",
|
|
185
|
-
purple: "#800080",
|
|
186
|
-
purple2: "#7f007f",
|
|
187
|
-
purple3: "#a020f0",
|
|
188
|
-
rebeccapurple: "#663399",
|
|
189
|
-
red: "#ff0000",
|
|
190
|
-
rosybrown: "#bc8f8f",
|
|
191
|
-
royalblue: "#4169e1",
|
|
192
|
-
saddlebrown: "#8b4513",
|
|
193
|
-
salmon: "#fa8072",
|
|
194
|
-
sandybrown: "#f4a460",
|
|
195
|
-
seagreen: "#2e8b57",
|
|
196
|
-
seashell: "#fff5ee",
|
|
197
|
-
sienna: "#a0522d",
|
|
198
|
-
silver: "#c0c0c0",
|
|
199
|
-
skyblue: "#87ceeb",
|
|
200
|
-
slateblue: "#6a5acd",
|
|
201
|
-
slategray: "#708090",
|
|
202
|
-
slategrey: "#708090",
|
|
203
|
-
snow: "#fffafa",
|
|
204
|
-
springgreen: "#00ff7f",
|
|
205
|
-
steelblue: "#4682b4",
|
|
206
|
-
tan: "#d2b48c",
|
|
207
|
-
teal: "#008080",
|
|
208
|
-
thistle: "#d8bfd8",
|
|
209
|
-
tomato: "#ff6347",
|
|
210
|
-
turquoise: "#40e0d0",
|
|
211
|
-
violet: "#ee82ee",
|
|
212
|
-
wheat: "#f5deb3",
|
|
213
|
-
white: "#ffffff",
|
|
214
|
-
whitesmoke: "#f5f5f5",
|
|
215
|
-
yellow: "#ffff00",
|
|
216
|
-
yellowgreen: "#9acd32"
|
|
217
|
-
}, Ke = /^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/, Xe = /^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/, ue = (t) => {
|
|
218
|
-
if (t.match(Ke)) {
|
|
219
|
-
(t.length === 4 || t.length === 7) && (t = t.substr(1)), t.length === 3 && (t = t.split(""), t = t[0] + t[0] + t[1] + t[1] + t[2] + t[2]);
|
|
220
|
-
const e = parseInt(t, 16), n = e >> 16, r = e >> 8 & 255, o = e & 255;
|
|
221
|
-
return [n, r, o, 1];
|
|
222
|
-
}
|
|
223
|
-
if (t.match(Xe)) {
|
|
224
|
-
(t.length === 5 || t.length === 9) && (t = t.substr(1)), t.length === 4 && (t = t.split(""), t = t[0] + t[0] + t[1] + t[1] + t[2] + t[2] + t[3] + t[3]);
|
|
225
|
-
const e = parseInt(t, 16), n = e >> 24 & 255, r = e >> 16 & 255, o = e >> 8 & 255, c = Math.round((e & 255) / 255 * 100) / 100;
|
|
226
|
-
return [n, r, o, c];
|
|
227
|
-
}
|
|
228
|
-
throw new Error(`unknown hex color: ${t}`);
|
|
229
|
-
}, { round: ht } = Math, be = (...t) => {
|
|
230
|
-
let [e, n, r, o] = M(t, "rgba"), c = ct(t) || "auto";
|
|
231
|
-
o === void 0 && (o = 1), c === "auto" && (c = o < 1 ? "rgba" : "rgb"), e = ht(e), n = ht(n), r = ht(r);
|
|
232
|
-
let f = "000000" + (e << 16 | n << 8 | r).toString(16);
|
|
233
|
-
f = f.substr(f.length - 6);
|
|
234
|
-
let a = "0" + ht(o * 255).toString(16);
|
|
235
|
-
switch (a = a.substr(a.length - 2), c.toLowerCase()) {
|
|
236
|
-
case "rgba":
|
|
237
|
-
return `#${f}${a}`;
|
|
238
|
-
case "argb":
|
|
239
|
-
return `#${a}${f}`;
|
|
240
|
-
default:
|
|
241
|
-
return `#${f}`;
|
|
242
|
-
}
|
|
243
|
-
};
|
|
244
|
-
i.prototype.name = function() {
|
|
245
|
-
const t = be(this._rgb, "rgb");
|
|
246
|
-
for (let e of Object.keys(rt))
|
|
247
|
-
if (rt[e] === t) return e.toLowerCase();
|
|
248
|
-
return t;
|
|
249
|
-
};
|
|
250
|
-
y.format.named = (t) => {
|
|
251
|
-
if (t = t.toLowerCase(), rt[t]) return ue(rt[t]);
|
|
252
|
-
throw new Error("unknown color name: " + t);
|
|
253
|
-
};
|
|
254
|
-
y.autodetect.push({
|
|
255
|
-
p: 5,
|
|
256
|
-
test: (t, ...e) => {
|
|
257
|
-
if (!e.length && E(t) === "string" && rt[t.toLowerCase()])
|
|
258
|
-
return "named";
|
|
259
|
-
}
|
|
260
|
-
});
|
|
261
|
-
i.prototype.alpha = function(t, e = !1) {
|
|
262
|
-
return t !== void 0 && E(t) === "number" ? e ? (this._rgb[3] = t, this) : new i([this._rgb[0], this._rgb[1], this._rgb[2], t], "rgb") : this._rgb[3];
|
|
263
|
-
};
|
|
264
|
-
i.prototype.clipped = function() {
|
|
265
|
-
return this._rgb._clipped || !1;
|
|
266
|
-
};
|
|
267
|
-
const U = {
|
|
268
|
-
// Corresponds roughly to RGB brighter/darker
|
|
269
|
-
Kn: 18,
|
|
270
|
-
// D65 standard referent
|
|
271
|
-
labWhitePoint: "d65",
|
|
272
|
-
Xn: 0.95047,
|
|
273
|
-
Yn: 1,
|
|
274
|
-
Zn: 1.08883,
|
|
275
|
-
t0: 0.137931034,
|
|
276
|
-
// 4 / 29
|
|
277
|
-
t1: 0.206896552,
|
|
278
|
-
// 6 / 29
|
|
279
|
-
t2: 0.12841855,
|
|
280
|
-
// 3 * t1 * t1
|
|
281
|
-
t3: 8856452e-9,
|
|
282
|
-
// t1 * t1 * t1,
|
|
283
|
-
kE: 216 / 24389,
|
|
284
|
-
kKE: 8,
|
|
285
|
-
kK: 24389 / 27,
|
|
286
|
-
RefWhiteRGB: {
|
|
287
|
-
// sRGB
|
|
288
|
-
X: 0.95047,
|
|
289
|
-
Y: 1,
|
|
290
|
-
Z: 1.08883
|
|
291
|
-
},
|
|
292
|
-
MtxRGB2XYZ: {
|
|
293
|
-
m00: 0.4124564390896922,
|
|
294
|
-
m01: 0.21267285140562253,
|
|
295
|
-
m02: 0.0193338955823293,
|
|
296
|
-
m10: 0.357576077643909,
|
|
297
|
-
m11: 0.715152155287818,
|
|
298
|
-
m12: 0.11919202588130297,
|
|
299
|
-
m20: 0.18043748326639894,
|
|
300
|
-
m21: 0.07217499330655958,
|
|
301
|
-
m22: 0.9503040785363679
|
|
302
|
-
},
|
|
303
|
-
MtxXYZ2RGB: {
|
|
304
|
-
m00: 3.2404541621141045,
|
|
305
|
-
m01: -0.9692660305051868,
|
|
306
|
-
m02: 0.055643430959114726,
|
|
307
|
-
m10: -1.5371385127977166,
|
|
308
|
-
m11: 1.8760108454466942,
|
|
309
|
-
m12: -0.2040259135167538,
|
|
310
|
-
m20: -0.498531409556016,
|
|
311
|
-
m21: 0.041556017530349834,
|
|
312
|
-
m22: 1.0572251882231791
|
|
313
|
-
},
|
|
314
|
-
// used in rgb2xyz
|
|
315
|
-
As: 0.9414285350000001,
|
|
316
|
-
Bs: 1.040417467,
|
|
317
|
-
Cs: 1.089532651,
|
|
318
|
-
MtxAdaptMa: {
|
|
319
|
-
m00: 0.8951,
|
|
320
|
-
m01: -0.7502,
|
|
321
|
-
m02: 0.0389,
|
|
322
|
-
m10: 0.2664,
|
|
323
|
-
m11: 1.7135,
|
|
324
|
-
m12: -0.0685,
|
|
325
|
-
m20: -0.1614,
|
|
326
|
-
m21: 0.0367,
|
|
327
|
-
m22: 1.0296
|
|
328
|
-
},
|
|
329
|
-
MtxAdaptMaI: {
|
|
330
|
-
m00: 0.9869929054667123,
|
|
331
|
-
m01: 0.43230526972339456,
|
|
332
|
-
m02: -0.008528664575177328,
|
|
333
|
-
m10: -0.14705425642099013,
|
|
334
|
-
m11: 0.5183602715367776,
|
|
335
|
-
m12: 0.04004282165408487,
|
|
336
|
-
m20: 0.15996265166373125,
|
|
337
|
-
m21: 0.0492912282128556,
|
|
338
|
-
m22: 0.9684866957875502
|
|
339
|
-
}
|
|
340
|
-
}, qe = /* @__PURE__ */ new Map([
|
|
341
|
-
// ASTM E308-01
|
|
342
|
-
["a", [1.0985, 0.35585]],
|
|
343
|
-
// Wyszecki & Stiles, p. 769
|
|
344
|
-
["b", [1.0985, 0.35585]],
|
|
345
|
-
// C ASTM E308-01
|
|
346
|
-
["c", [0.98074, 1.18232]],
|
|
347
|
-
// D50 (ASTM E308-01)
|
|
348
|
-
["d50", [0.96422, 0.82521]],
|
|
349
|
-
// D55 (ASTM E308-01)
|
|
350
|
-
["d55", [0.95682, 0.92149]],
|
|
351
|
-
// D65 (ASTM E308-01)
|
|
352
|
-
["d65", [0.95047, 1.08883]],
|
|
353
|
-
// E (ASTM E308-01)
|
|
354
|
-
["e", [1, 1, 1]],
|
|
355
|
-
// F2 (ASTM E308-01)
|
|
356
|
-
["f2", [0.99186, 0.67393]],
|
|
357
|
-
// F7 (ASTM E308-01)
|
|
358
|
-
["f7", [0.95041, 1.08747]],
|
|
359
|
-
// F11 (ASTM E308-01)
|
|
360
|
-
["f11", [1.00962, 0.6435]],
|
|
361
|
-
["icc", [0.96422, 0.82521]]
|
|
362
|
-
]);
|
|
363
|
-
function q(t) {
|
|
364
|
-
const e = qe.get(String(t).toLowerCase());
|
|
365
|
-
if (!e)
|
|
366
|
-
throw new Error("unknown Lab illuminant " + t);
|
|
367
|
-
U.labWhitePoint = t, U.Xn = e[0], U.Zn = e[1];
|
|
368
|
-
}
|
|
369
|
-
function it() {
|
|
370
|
-
return U.labWhitePoint;
|
|
371
|
-
}
|
|
372
|
-
const vt = (...t) => {
|
|
373
|
-
t = M(t, "lab");
|
|
374
|
-
const [e, n, r] = t, [o, c, s] = Ze(e, n, r), [f, a, l] = he(o, c, s);
|
|
375
|
-
return [f, a, l, t.length > 3 ? t[3] : 1];
|
|
376
|
-
}, Ze = (t, e, n) => {
|
|
377
|
-
const { kE: r, kK: o, kKE: c, Xn: s, Yn: f, Zn: a } = U, l = (t + 16) / 116, b = 2e-3 * e + l, d = l - 5e-3 * n, h = b * b * b, p = d * d * d, R = h > r ? h : (116 * b - 16) / o, N = t > c ? Math.pow((t + 16) / 116, 3) : t / o, _ = p > r ? p : (116 * d - 16) / o, g = R * s, x = N * f, C = _ * a;
|
|
378
|
-
return [g, x, C];
|
|
379
|
-
}, Et = (t) => {
|
|
380
|
-
const e = Math.sign(t);
|
|
381
|
-
return t = Math.abs(t), (t <= 31308e-7 ? t * 12.92 : 1.055 * Math.pow(t, 1 / 2.4) - 0.055) * e;
|
|
382
|
-
}, he = (t, e, n) => {
|
|
383
|
-
const { MtxAdaptMa: r, MtxAdaptMaI: o, MtxXYZ2RGB: c, RefWhiteRGB: s, Xn: f, Yn: a, Zn: l } = U, b = f * r.m00 + a * r.m10 + l * r.m20, d = f * r.m01 + a * r.m11 + l * r.m21, h = f * r.m02 + a * r.m12 + l * r.m22, p = s.X * r.m00 + s.Y * r.m10 + s.Z * r.m20, R = s.X * r.m01 + s.Y * r.m11 + s.Z * r.m21, N = s.X * r.m02 + s.Y * r.m12 + s.Z * r.m22, _ = (t * r.m00 + e * r.m10 + n * r.m20) * (p / b), g = (t * r.m01 + e * r.m11 + n * r.m21) * (R / d), x = (t * r.m02 + e * r.m12 + n * r.m22) * (N / h), C = _ * o.m00 + g * o.m10 + x * o.m20, P = _ * o.m01 + g * o.m11 + x * o.m21, D = _ * o.m02 + g * o.m12 + x * o.m22, L = Et(
|
|
384
|
-
C * c.m00 + P * c.m10 + D * c.m20
|
|
385
|
-
), u = Et(
|
|
386
|
-
C * c.m01 + P * c.m11 + D * c.m21
|
|
387
|
-
), m = Et(
|
|
388
|
-
C * c.m02 + P * c.m12 + D * c.m22
|
|
389
|
-
);
|
|
390
|
-
return [L * 255, u * 255, m * 255];
|
|
391
|
-
}, jt = (...t) => {
|
|
392
|
-
const [e, n, r, ...o] = M(t, "rgb"), [c, s, f] = de(e, n, r), [a, l, b] = Fe(c, s, f);
|
|
393
|
-
return [a, l, b, ...o.length > 0 && o[0] < 1 ? [o[0]] : []];
|
|
394
|
-
};
|
|
395
|
-
function Fe(t, e, n) {
|
|
396
|
-
const { Xn: r, Yn: o, Zn: c, kE: s, kK: f } = U, a = t / r, l = e / o, b = n / c, d = a > s ? Math.pow(a, 1 / 3) : (f * a + 16) / 116, h = l > s ? Math.pow(l, 1 / 3) : (f * l + 16) / 116, p = b > s ? Math.pow(b, 1 / 3) : (f * b + 16) / 116;
|
|
397
|
-
return [116 * h - 16, 500 * (d - h), 200 * (h - p)];
|
|
398
|
-
}
|
|
399
|
-
function Lt(t) {
|
|
400
|
-
const e = Math.sign(t);
|
|
401
|
-
return t = Math.abs(t), (t <= 0.04045 ? t / 12.92 : Math.pow((t + 0.055) / 1.055, 2.4)) * e;
|
|
402
|
-
}
|
|
403
|
-
const de = (t, e, n) => {
|
|
404
|
-
t = Lt(t / 255), e = Lt(e / 255), n = Lt(n / 255);
|
|
405
|
-
const { MtxRGB2XYZ: r, MtxAdaptMa: o, MtxAdaptMaI: c, Xn: s, Yn: f, Zn: a, As: l, Bs: b, Cs: d } = U;
|
|
406
|
-
let h = t * r.m00 + e * r.m10 + n * r.m20, p = t * r.m01 + e * r.m11 + n * r.m21, R = t * r.m02 + e * r.m12 + n * r.m22;
|
|
407
|
-
const N = s * o.m00 + f * o.m10 + a * o.m20, _ = s * o.m01 + f * o.m11 + a * o.m21, g = s * o.m02 + f * o.m12 + a * o.m22;
|
|
408
|
-
let x = h * o.m00 + p * o.m10 + R * o.m20, C = h * o.m01 + p * o.m11 + R * o.m21, P = h * o.m02 + p * o.m12 + R * o.m22;
|
|
409
|
-
return x *= N / l, C *= _ / b, P *= g / d, h = x * c.m00 + C * c.m10 + P * c.m20, p = x * c.m01 + C * c.m11 + P * c.m21, R = x * c.m02 + C * c.m12 + P * c.m22, [h, p, R];
|
|
410
|
-
};
|
|
411
|
-
i.prototype.lab = function() {
|
|
412
|
-
return jt(this._rgb);
|
|
413
|
-
};
|
|
414
|
-
const We = (...t) => new i(...t, "lab");
|
|
415
|
-
Object.assign(k, { lab: We, getLabWhitePoint: it, setLabWhitePoint: q });
|
|
416
|
-
y.format.lab = vt;
|
|
417
|
-
y.autodetect.push({
|
|
418
|
-
p: 2,
|
|
419
|
-
test: (...t) => {
|
|
420
|
-
if (t = M(t, "lab"), E(t) === "array" && t.length === 3)
|
|
421
|
-
return "lab";
|
|
422
|
-
}
|
|
423
|
-
});
|
|
424
|
-
i.prototype.darken = function(t = 1) {
|
|
425
|
-
const e = this, n = e.lab();
|
|
426
|
-
return n[0] -= U.Kn * t, new i(n, "lab").alpha(e.alpha(), !0);
|
|
427
|
-
};
|
|
428
|
-
i.prototype.brighten = function(t = 1) {
|
|
429
|
-
return this.darken(-t);
|
|
430
|
-
};
|
|
431
|
-
i.prototype.darker = i.prototype.darken;
|
|
432
|
-
i.prototype.brighter = i.prototype.brighten;
|
|
433
|
-
i.prototype.get = function(t) {
|
|
434
|
-
const [e, n] = t.split("."), r = this[e]();
|
|
435
|
-
if (n) {
|
|
436
|
-
const o = e.indexOf(n) - (e.substr(0, 2) === "ok" ? 2 : 0);
|
|
437
|
-
if (o > -1) return r[o];
|
|
438
|
-
throw new Error(`unknown channel ${n} in mode ${e}`);
|
|
439
|
-
} else
|
|
440
|
-
return r;
|
|
441
|
-
};
|
|
442
|
-
const { pow: Ve } = Math, Je = 1e-7, Qe = 20;
|
|
443
|
-
i.prototype.luminance = function(t, e = "rgb") {
|
|
444
|
-
if (t !== void 0 && E(t) === "number") {
|
|
445
|
-
if (t === 0)
|
|
446
|
-
return new i([0, 0, 0, this._rgb[3]], "rgb");
|
|
447
|
-
if (t === 1)
|
|
448
|
-
return new i([255, 255, 255, this._rgb[3]], "rgb");
|
|
449
|
-
let n = this.luminance(), r = Qe;
|
|
450
|
-
const o = (s, f) => {
|
|
451
|
-
const a = s.interpolate(f, 0.5, e), l = a.luminance();
|
|
452
|
-
return Math.abs(t - l) < Je || !r-- ? a : l > t ? o(s, a) : o(a, f);
|
|
453
|
-
}, c = (n > t ? o(new i([0, 0, 0]), this) : o(this, new i([255, 255, 255]))).rgb();
|
|
454
|
-
return new i([...c, this._rgb[3]]);
|
|
455
|
-
}
|
|
456
|
-
return tn(...this._rgb.slice(0, 3));
|
|
457
|
-
};
|
|
458
|
-
const tn = (t, e, n) => (t = $t(t), e = $t(e), n = $t(n), 0.2126 * t + 0.7152 * e + 0.0722 * n), $t = (t) => (t /= 255, t <= 0.03928 ? t / 12.92 : Ve((t + 0.055) / 1.055, 2.4)), O = {}, ot = (t, e, n = 0.5, ...r) => {
|
|
459
|
-
let o = r[0] || "lrgb";
|
|
460
|
-
if (!O[o] && !r.length && (o = Object.keys(O)[0]), !O[o])
|
|
461
|
-
throw new Error(`interpolation mode ${o} is not defined`);
|
|
462
|
-
return E(t) !== "object" && (t = new i(t)), E(e) !== "object" && (e = new i(e)), O[o](t, e, n).alpha(
|
|
463
|
-
t.alpha() + n * (e.alpha() - t.alpha())
|
|
464
|
-
);
|
|
465
|
-
};
|
|
466
|
-
i.prototype.mix = i.prototype.interpolate = function(t, e = 0.5, ...n) {
|
|
467
|
-
return ot(this, t, e, ...n);
|
|
468
|
-
};
|
|
469
|
-
i.prototype.premultiply = function(t = !1) {
|
|
470
|
-
const e = this._rgb, n = e[3];
|
|
471
|
-
return t ? (this._rgb = [e[0] * n, e[1] * n, e[2] * n, n], this) : new i([e[0] * n, e[1] * n, e[2] * n, n], "rgb");
|
|
472
|
-
};
|
|
473
|
-
const { sin: en, cos: nn } = Math, pe = (...t) => {
|
|
474
|
-
let [e, n, r] = M(t, "lch");
|
|
475
|
-
return isNaN(r) && (r = 0), r = r * Be, [e, nn(r) * n, en(r) * n];
|
|
476
|
-
}, Ht = (...t) => {
|
|
477
|
-
t = M(t, "lch");
|
|
478
|
-
const [e, n, r] = t, [o, c, s] = pe(e, n, r), [f, a, l] = vt(o, c, s);
|
|
479
|
-
return [f, a, l, t.length > 3 ? t[3] : 1];
|
|
480
|
-
}, rn = (...t) => {
|
|
481
|
-
const e = ie(M(t, "hcl"));
|
|
482
|
-
return Ht(...e);
|
|
483
|
-
}, { sqrt: on, atan2: cn, round: sn } = Math, me = (...t) => {
|
|
484
|
-
const [e, n, r] = M(t, "lab"), o = on(n * n + r * r);
|
|
485
|
-
let c = (cn(r, n) * ze + 360) % 360;
|
|
486
|
-
return sn(o * 1e4) === 0 && (c = Number.NaN), [e, o, c];
|
|
487
|
-
}, Bt = (...t) => {
|
|
488
|
-
const [e, n, r, ...o] = M(t, "rgb"), [c, s, f] = jt(e, n, r), [a, l, b] = me(c, s, f);
|
|
489
|
-
return [a, l, b, ...o.length > 0 && o[0] < 1 ? [o[0]] : []];
|
|
490
|
-
};
|
|
491
|
-
i.prototype.lch = function() {
|
|
492
|
-
return Bt(this._rgb);
|
|
493
|
-
};
|
|
494
|
-
i.prototype.hcl = function() {
|
|
495
|
-
return ie(Bt(this._rgb));
|
|
496
|
-
};
|
|
497
|
-
const fn = (...t) => new i(...t, "lch"), an = (...t) => new i(...t, "hcl");
|
|
498
|
-
Object.assign(k, { lch: fn, hcl: an });
|
|
499
|
-
y.format.lch = Ht;
|
|
500
|
-
y.format.hcl = rn;
|
|
501
|
-
["lch", "hcl"].forEach(
|
|
502
|
-
(t) => y.autodetect.push({
|
|
503
|
-
p: 2,
|
|
504
|
-
test: (...e) => {
|
|
505
|
-
if (e = M(e, t), E(e) === "array" && e.length === 3)
|
|
506
|
-
return t;
|
|
507
|
-
}
|
|
508
|
-
})
|
|
509
|
-
);
|
|
510
|
-
i.prototype.saturate = function(t = 1) {
|
|
511
|
-
const e = this, n = e.lch();
|
|
512
|
-
return n[1] += U.Kn * t, n[1] < 0 && (n[1] = 0), new i(n, "lch").alpha(e.alpha(), !0);
|
|
513
|
-
};
|
|
514
|
-
i.prototype.desaturate = function(t = 1) {
|
|
515
|
-
return this.saturate(-t);
|
|
516
|
-
};
|
|
517
|
-
i.prototype.set = function(t, e, n = !1) {
|
|
518
|
-
const [r, o] = t.split("."), c = this[r]();
|
|
519
|
-
if (o) {
|
|
520
|
-
const s = r.indexOf(o) - (r.substr(0, 2) === "ok" ? 2 : 0);
|
|
521
|
-
if (s > -1) {
|
|
522
|
-
if (E(e) == "string")
|
|
523
|
-
switch (e.charAt(0)) {
|
|
524
|
-
case "+":
|
|
525
|
-
c[s] += +e;
|
|
526
|
-
break;
|
|
527
|
-
case "-":
|
|
528
|
-
c[s] += +e;
|
|
529
|
-
break;
|
|
530
|
-
case "*":
|
|
531
|
-
c[s] *= +e.substr(1);
|
|
532
|
-
break;
|
|
533
|
-
case "/":
|
|
534
|
-
c[s] /= +e.substr(1);
|
|
535
|
-
break;
|
|
536
|
-
default:
|
|
537
|
-
c[s] = +e;
|
|
538
|
-
}
|
|
539
|
-
else if (E(e) === "number")
|
|
540
|
-
c[s] = e;
|
|
541
|
-
else
|
|
542
|
-
throw new Error("unsupported value for Color.set");
|
|
543
|
-
const f = new i(c, r);
|
|
544
|
-
return n ? (this._rgb = f._rgb, this) : f;
|
|
545
|
-
}
|
|
546
|
-
throw new Error(`unknown channel ${o} in mode ${r}`);
|
|
547
|
-
} else
|
|
548
|
-
return c;
|
|
549
|
-
};
|
|
550
|
-
i.prototype.tint = function(t = 0.5, ...e) {
|
|
551
|
-
return ot(this, "white", t, ...e);
|
|
552
|
-
};
|
|
553
|
-
i.prototype.shade = function(t = 0.5, ...e) {
|
|
554
|
-
return ot(this, "black", t, ...e);
|
|
555
|
-
};
|
|
556
|
-
const ln = (t, e, n) => {
|
|
557
|
-
const r = t._rgb, o = e._rgb;
|
|
558
|
-
return new i(
|
|
559
|
-
r[0] + n * (o[0] - r[0]),
|
|
560
|
-
r[1] + n * (o[1] - r[1]),
|
|
561
|
-
r[2] + n * (o[2] - r[2]),
|
|
562
|
-
"rgb"
|
|
563
|
-
);
|
|
564
|
-
};
|
|
565
|
-
O.rgb = ln;
|
|
566
|
-
const { sqrt: Yt, pow: tt } = Math, un = (t, e, n) => {
|
|
567
|
-
const [r, o, c] = t._rgb, [s, f, a] = e._rgb;
|
|
568
|
-
return new i(
|
|
569
|
-
Yt(tt(r, 2) * (1 - n) + tt(s, 2) * n),
|
|
570
|
-
Yt(tt(o, 2) * (1 - n) + tt(f, 2) * n),
|
|
571
|
-
Yt(tt(c, 2) * (1 - n) + tt(a, 2) * n),
|
|
572
|
-
"rgb"
|
|
573
|
-
);
|
|
574
|
-
};
|
|
575
|
-
O.lrgb = un;
|
|
576
|
-
const bn = (t, e, n) => {
|
|
577
|
-
const r = t.lab(), o = e.lab();
|
|
578
|
-
return new i(
|
|
579
|
-
r[0] + n * (o[0] - r[0]),
|
|
580
|
-
r[1] + n * (o[1] - r[1]),
|
|
581
|
-
r[2] + n * (o[2] - r[2]),
|
|
582
|
-
"lab"
|
|
583
|
-
);
|
|
584
|
-
};
|
|
585
|
-
O.lab = bn;
|
|
586
|
-
const st = (t, e, n, r) => {
|
|
587
|
-
let o, c;
|
|
588
|
-
r === "hsl" ? (o = t.hsl(), c = e.hsl()) : r === "hsv" ? (o = t.hsv(), c = e.hsv()) : r === "hcg" ? (o = t.hcg(), c = e.hcg()) : r === "hsi" ? (o = t.hsi(), c = e.hsi()) : r === "lch" || r === "hcl" ? (r = "hcl", o = t.hcl(), c = e.hcl()) : r === "oklch" && (o = t.oklch().reverse(), c = e.oklch().reverse());
|
|
589
|
-
let s, f, a, l, b, d;
|
|
590
|
-
(r.substr(0, 1) === "h" || r === "oklch") && ([s, a, b] = o, [f, l, d] = c);
|
|
591
|
-
let h, p, R, N;
|
|
592
|
-
return !isNaN(s) && !isNaN(f) ? (f > s && f - s > 180 ? N = f - (s + 360) : f < s && s - f > 180 ? N = f + 360 - s : N = f - s, p = s + n * N) : isNaN(s) ? isNaN(f) ? p = Number.NaN : (p = f, (b == 1 || b == 0) && r != "hsv" && (h = l)) : (p = s, (d == 1 || d == 0) && r != "hsv" && (h = a)), h === void 0 && (h = a + n * (l - a)), R = b + n * (d - b), r === "oklch" ? new i([R, h, p], r) : new i([p, h, R], r);
|
|
593
|
-
}, ge = (t, e, n) => st(t, e, n, "lch");
|
|
594
|
-
O.lch = ge;
|
|
595
|
-
O.hcl = ge;
|
|
596
|
-
const hn = (t) => {
|
|
597
|
-
if (E(t) == "number" && t >= 0 && t <= 16777215) {
|
|
598
|
-
const e = t >> 16, n = t >> 8 & 255, r = t & 255;
|
|
599
|
-
return [e, n, r, 1];
|
|
600
|
-
}
|
|
601
|
-
throw new Error("unknown num color: " + t);
|
|
602
|
-
}, dn = (...t) => {
|
|
603
|
-
const [e, n, r] = M(t, "rgb");
|
|
604
|
-
return (e << 16) + (n << 8) + r;
|
|
605
|
-
};
|
|
606
|
-
i.prototype.num = function() {
|
|
607
|
-
return dn(this._rgb);
|
|
608
|
-
};
|
|
609
|
-
const pn = (...t) => new i(...t, "num");
|
|
610
|
-
Object.assign(k, { num: pn });
|
|
611
|
-
y.format.num = hn;
|
|
612
|
-
y.autodetect.push({
|
|
613
|
-
p: 5,
|
|
614
|
-
test: (...t) => {
|
|
615
|
-
if (t.length === 1 && E(t[0]) === "number" && t[0] >= 0 && t[0] <= 16777215)
|
|
616
|
-
return "num";
|
|
617
|
-
}
|
|
618
|
-
});
|
|
619
|
-
const mn = (t, e, n) => {
|
|
620
|
-
const r = t.num(), o = e.num();
|
|
621
|
-
return new i(r + n * (o - r), "num");
|
|
622
|
-
};
|
|
623
|
-
O.num = mn;
|
|
624
|
-
const { floor: gn } = Math, _n = (...t) => {
|
|
625
|
-
t = M(t, "hcg");
|
|
626
|
-
let [e, n, r] = t, o, c, s;
|
|
627
|
-
r = r * 255;
|
|
628
|
-
const f = n * 255;
|
|
629
|
-
if (n === 0)
|
|
630
|
-
o = c = s = r;
|
|
631
|
-
else {
|
|
632
|
-
e === 360 && (e = 0), e > 360 && (e -= 360), e < 0 && (e += 360), e /= 60;
|
|
633
|
-
const a = gn(e), l = e - a, b = r * (1 - n), d = b + f * (1 - l), h = b + f * l, p = b + f;
|
|
634
|
-
switch (a) {
|
|
635
|
-
case 0:
|
|
636
|
-
[o, c, s] = [p, h, b];
|
|
637
|
-
break;
|
|
638
|
-
case 1:
|
|
639
|
-
[o, c, s] = [d, p, b];
|
|
640
|
-
break;
|
|
641
|
-
case 2:
|
|
642
|
-
[o, c, s] = [b, p, h];
|
|
643
|
-
break;
|
|
644
|
-
case 3:
|
|
645
|
-
[o, c, s] = [b, d, p];
|
|
646
|
-
break;
|
|
647
|
-
case 4:
|
|
648
|
-
[o, c, s] = [h, b, p];
|
|
649
|
-
break;
|
|
650
|
-
case 5:
|
|
651
|
-
[o, c, s] = [p, b, d];
|
|
652
|
-
break;
|
|
653
|
-
}
|
|
654
|
-
}
|
|
655
|
-
return [o, c, s, t.length > 3 ? t[3] : 1];
|
|
656
|
-
}, wn = (...t) => {
|
|
657
|
-
const [e, n, r] = M(t, "rgb"), o = ae(e, n, r), c = le(e, n, r), s = c - o, f = s * 100 / 255, a = o / (255 - s) * 100;
|
|
658
|
-
let l;
|
|
659
|
-
return s === 0 ? l = Number.NaN : (e === c && (l = (n - r) / s), n === c && (l = 2 + (r - e) / s), r === c && (l = 4 + (e - n) / s), l *= 60, l < 0 && (l += 360)), [l, f, a];
|
|
660
|
-
};
|
|
661
|
-
i.prototype.hcg = function() {
|
|
662
|
-
return wn(this._rgb);
|
|
663
|
-
};
|
|
664
|
-
const yn = (...t) => new i(...t, "hcg");
|
|
665
|
-
k.hcg = yn;
|
|
666
|
-
y.format.hcg = _n;
|
|
667
|
-
y.autodetect.push({
|
|
668
|
-
p: 1,
|
|
669
|
-
test: (...t) => {
|
|
670
|
-
if (t = M(t, "hcg"), E(t) === "array" && t.length === 3)
|
|
671
|
-
return "hcg";
|
|
672
|
-
}
|
|
673
|
-
});
|
|
674
|
-
const Rn = (t, e, n) => st(t, e, n, "hcg");
|
|
675
|
-
O.hcg = Rn;
|
|
676
|
-
const { cos: et } = Math, kn = (...t) => {
|
|
677
|
-
t = M(t, "hsi");
|
|
678
|
-
let [e, n, r] = t, o, c, s;
|
|
679
|
-
return isNaN(e) && (e = 0), isNaN(n) && (n = 0), e > 360 && (e -= 360), e < 0 && (e += 360), e /= 360, e < 1 / 3 ? (s = (1 - n) / 3, o = (1 + n * et(X * e) / et(At - X * e)) / 3, c = 1 - (s + o)) : e < 2 / 3 ? (e -= 1 / 3, o = (1 - n) / 3, c = (1 + n * et(X * e) / et(At - X * e)) / 3, s = 1 - (o + c)) : (e -= 2 / 3, c = (1 - n) / 3, s = (1 + n * et(X * e) / et(At - X * e)) / 3, o = 1 - (c + s)), o = J(r * o * 3), c = J(r * c * 3), s = J(r * s * 3), [o * 255, c * 255, s * 255, t.length > 3 ? t[3] : 1];
|
|
680
|
-
}, { min: Mn, sqrt: An, acos: En } = Math, Ln = (...t) => {
|
|
681
|
-
let [e, n, r] = M(t, "rgb");
|
|
682
|
-
e /= 255, n /= 255, r /= 255;
|
|
683
|
-
let o;
|
|
684
|
-
const c = Mn(e, n, r), s = (e + n + r) / 3, f = s > 0 ? 1 - c / s : 0;
|
|
685
|
-
return f === 0 ? o = NaN : (o = (e - n + (e - r)) / 2, o /= An((e - n) * (e - n) + (e - r) * (n - r)), o = En(o), r > n && (o = X - o), o /= X), [o * 360, f, s];
|
|
686
|
-
};
|
|
687
|
-
i.prototype.hsi = function() {
|
|
688
|
-
return Ln(this._rgb);
|
|
689
|
-
};
|
|
690
|
-
const $n = (...t) => new i(...t, "hsi");
|
|
691
|
-
k.hsi = $n;
|
|
692
|
-
y.format.hsi = kn;
|
|
693
|
-
y.autodetect.push({
|
|
694
|
-
p: 2,
|
|
695
|
-
test: (...t) => {
|
|
696
|
-
if (t = M(t, "hsi"), E(t) === "array" && t.length === 3)
|
|
697
|
-
return "hsi";
|
|
698
|
-
}
|
|
699
|
-
});
|
|
700
|
-
const Yn = (t, e, n) => st(t, e, n, "hsi");
|
|
701
|
-
O.hsi = Yn;
|
|
702
|
-
const Ct = (...t) => {
|
|
703
|
-
t = M(t, "hsl");
|
|
704
|
-
const [e, n, r] = t;
|
|
705
|
-
let o, c, s;
|
|
706
|
-
if (n === 0)
|
|
707
|
-
o = c = s = r * 255;
|
|
708
|
-
else {
|
|
709
|
-
const f = [0, 0, 0], a = [0, 0, 0], l = r < 0.5 ? r * (1 + n) : r + n - r * n, b = 2 * r - l, d = e / 360;
|
|
710
|
-
f[0] = d + 1 / 3, f[1] = d, f[2] = d - 1 / 3;
|
|
711
|
-
for (let h = 0; h < 3; h++)
|
|
712
|
-
f[h] < 0 && (f[h] += 1), f[h] > 1 && (f[h] -= 1), 6 * f[h] < 1 ? a[h] = b + (l - b) * 6 * f[h] : 2 * f[h] < 1 ? a[h] = l : 3 * f[h] < 2 ? a[h] = b + (l - b) * (2 / 3 - f[h]) * 6 : a[h] = b;
|
|
713
|
-
[o, c, s] = [a[0] * 255, a[1] * 255, a[2] * 255];
|
|
714
|
-
}
|
|
715
|
-
return t.length > 3 ? [o, c, s, t[3]] : [o, c, s, 1];
|
|
716
|
-
}, _e = (...t) => {
|
|
717
|
-
t = M(t, "rgba");
|
|
718
|
-
let [e, n, r] = t;
|
|
719
|
-
e /= 255, n /= 255, r /= 255;
|
|
720
|
-
const o = ae(e, n, r), c = le(e, n, r), s = (c + o) / 2;
|
|
721
|
-
let f, a;
|
|
722
|
-
return c === o ? (f = 0, a = Number.NaN) : f = s < 0.5 ? (c - o) / (c + o) : (c - o) / (2 - c - o), e == c ? a = (n - r) / (c - o) : n == c ? a = 2 + (r - e) / (c - o) : r == c && (a = 4 + (e - n) / (c - o)), a *= 60, a < 0 && (a += 360), t.length > 3 && t[3] !== void 0 ? [a, f, s, t[3]] : [a, f, s];
|
|
723
|
-
};
|
|
724
|
-
i.prototype.hsl = function() {
|
|
725
|
-
return _e(this._rgb);
|
|
726
|
-
};
|
|
727
|
-
const Nn = (...t) => new i(...t, "hsl");
|
|
728
|
-
k.hsl = Nn;
|
|
729
|
-
y.format.hsl = Ct;
|
|
730
|
-
y.autodetect.push({
|
|
731
|
-
p: 2,
|
|
732
|
-
test: (...t) => {
|
|
733
|
-
if (t = M(t, "hsl"), E(t) === "array" && t.length === 3)
|
|
734
|
-
return "hsl";
|
|
735
|
-
}
|
|
736
|
-
});
|
|
737
|
-
const In = (t, e, n) => st(t, e, n, "hsl");
|
|
738
|
-
O.hsl = In;
|
|
739
|
-
const { floor: Pn } = Math, Gn = (...t) => {
|
|
740
|
-
t = M(t, "hsv");
|
|
741
|
-
let [e, n, r] = t, o, c, s;
|
|
742
|
-
if (r *= 255, n === 0)
|
|
743
|
-
o = c = s = r;
|
|
744
|
-
else {
|
|
745
|
-
e === 360 && (e = 0), e > 360 && (e -= 360), e < 0 && (e += 360), e /= 60;
|
|
746
|
-
const f = Pn(e), a = e - f, l = r * (1 - n), b = r * (1 - n * a), d = r * (1 - n * (1 - a));
|
|
747
|
-
switch (f) {
|
|
748
|
-
case 0:
|
|
749
|
-
[o, c, s] = [r, d, l];
|
|
750
|
-
break;
|
|
751
|
-
case 1:
|
|
752
|
-
[o, c, s] = [b, r, l];
|
|
753
|
-
break;
|
|
754
|
-
case 2:
|
|
755
|
-
[o, c, s] = [l, r, d];
|
|
756
|
-
break;
|
|
757
|
-
case 3:
|
|
758
|
-
[o, c, s] = [l, b, r];
|
|
759
|
-
break;
|
|
760
|
-
case 4:
|
|
761
|
-
[o, c, s] = [d, l, r];
|
|
762
|
-
break;
|
|
763
|
-
case 5:
|
|
764
|
-
[o, c, s] = [r, l, b];
|
|
765
|
-
break;
|
|
766
|
-
}
|
|
767
|
-
}
|
|
768
|
-
return [o, c, s, t.length > 3 ? t[3] : 1];
|
|
769
|
-
}, { min: Sn, max: xn } = Math, Cn = (...t) => {
|
|
770
|
-
t = M(t, "rgb");
|
|
771
|
-
let [e, n, r] = t;
|
|
772
|
-
const o = Sn(e, n, r), c = xn(e, n, r), s = c - o;
|
|
773
|
-
let f, a, l;
|
|
774
|
-
return l = c / 255, c === 0 ? (f = Number.NaN, a = 0) : (a = s / c, e === c && (f = (n - r) / s), n === c && (f = 2 + (r - e) / s), r === c && (f = 4 + (e - n) / s), f *= 60, f < 0 && (f += 360)), [f, a, l];
|
|
775
|
-
};
|
|
776
|
-
i.prototype.hsv = function() {
|
|
777
|
-
return Cn(this._rgb);
|
|
778
|
-
};
|
|
779
|
-
const Dn = (...t) => new i(...t, "hsv");
|
|
780
|
-
k.hsv = Dn;
|
|
781
|
-
y.format.hsv = Gn;
|
|
782
|
-
y.autodetect.push({
|
|
783
|
-
p: 2,
|
|
784
|
-
test: (...t) => {
|
|
785
|
-
if (t = M(t, "hsv"), E(t) === "array" && t.length === 3)
|
|
786
|
-
return "hsv";
|
|
787
|
-
}
|
|
788
|
-
});
|
|
789
|
-
const On = (t, e, n) => st(t, e, n, "hsv");
|
|
790
|
-
O.hsv = On;
|
|
791
|
-
function gt(t, e) {
|
|
792
|
-
let n = t.length;
|
|
793
|
-
Array.isArray(t[0]) || (t = [t]), Array.isArray(e[0]) || (e = e.map((s) => [s]));
|
|
794
|
-
let r = e[0].length, o = e[0].map((s, f) => e.map((a) => a[f])), c = t.map(
|
|
795
|
-
(s) => o.map((f) => Array.isArray(s) ? s.reduce((a, l, b) => a + l * (f[b] || 0), 0) : f.reduce((a, l) => a + l * s, 0))
|
|
796
|
-
);
|
|
797
|
-
return n === 1 && (c = c[0]), r === 1 ? c.map((s) => s[0]) : c;
|
|
798
|
-
}
|
|
799
|
-
const zt = (...t) => {
|
|
800
|
-
t = M(t, "lab");
|
|
801
|
-
const [e, n, r, ...o] = t, [c, s, f] = Tn([e, n, r]), [a, l, b] = he(c, s, f);
|
|
802
|
-
return [a, l, b, ...o.length > 0 && o[0] < 1 ? [o[0]] : []];
|
|
803
|
-
};
|
|
804
|
-
function Tn(t) {
|
|
805
|
-
var e = [
|
|
806
|
-
[1.2268798758459243, -0.5578149944602171, 0.2813910456659647],
|
|
807
|
-
[-0.0405757452148008, 1.112286803280317, -0.0717110580655164],
|
|
808
|
-
[-0.0763729366746601, -0.4214933324022432, 1.5869240198367816]
|
|
809
|
-
], n = [
|
|
810
|
-
[1, 0.3963377773761749, 0.2158037573099136],
|
|
811
|
-
[1, -0.1055613458156586, -0.0638541728258133],
|
|
812
|
-
[1, -0.0894841775298119, -1.2914855480194092]
|
|
813
|
-
], r = gt(n, t);
|
|
814
|
-
return gt(
|
|
815
|
-
e,
|
|
816
|
-
r.map((o) => o ** 3)
|
|
817
|
-
);
|
|
818
|
-
}
|
|
819
|
-
const Ut = (...t) => {
|
|
820
|
-
const [e, n, r, ...o] = M(t, "rgb"), c = de(e, n, r);
|
|
821
|
-
return [...vn(c), ...o.length > 0 && o[0] < 1 ? [o[0]] : []];
|
|
822
|
-
};
|
|
823
|
-
function vn(t) {
|
|
824
|
-
const e = [
|
|
825
|
-
[0.819022437996703, 0.3619062600528904, -0.1288737815209879],
|
|
826
|
-
[0.0329836539323885, 0.9292868615863434, 0.0361446663506424],
|
|
827
|
-
[0.0481771893596242, 0.2642395317527308, 0.6335478284694309]
|
|
828
|
-
], n = [
|
|
829
|
-
[0.210454268309314, 0.7936177747023054, -0.0040720430116193],
|
|
830
|
-
[1.9779985324311684, -2.42859224204858, 0.450593709617411],
|
|
831
|
-
[0.0259040424655478, 0.7827717124575296, -0.8086757549230774]
|
|
832
|
-
], r = gt(e, t);
|
|
833
|
-
return gt(
|
|
834
|
-
n,
|
|
835
|
-
r.map((o) => Math.cbrt(o))
|
|
836
|
-
);
|
|
837
|
-
}
|
|
838
|
-
i.prototype.oklab = function() {
|
|
839
|
-
return Ut(this._rgb);
|
|
840
|
-
};
|
|
841
|
-
const jn = (...t) => new i(...t, "oklab");
|
|
842
|
-
Object.assign(k, { oklab: jn });
|
|
843
|
-
y.format.oklab = zt;
|
|
844
|
-
y.autodetect.push({
|
|
845
|
-
p: 2,
|
|
846
|
-
test: (...t) => {
|
|
847
|
-
if (t = M(t, "oklab"), E(t) === "array" && t.length === 3)
|
|
848
|
-
return "oklab";
|
|
849
|
-
}
|
|
850
|
-
});
|
|
851
|
-
const Hn = (t, e, n) => {
|
|
852
|
-
const r = t.oklab(), o = e.oklab();
|
|
853
|
-
return new i(
|
|
854
|
-
r[0] + n * (o[0] - r[0]),
|
|
855
|
-
r[1] + n * (o[1] - r[1]),
|
|
856
|
-
r[2] + n * (o[2] - r[2]),
|
|
857
|
-
"oklab"
|
|
858
|
-
);
|
|
859
|
-
};
|
|
860
|
-
O.oklab = Hn;
|
|
861
|
-
const Bn = (t, e, n) => st(t, e, n, "oklch");
|
|
862
|
-
O.oklch = Bn;
|
|
863
|
-
const { pow: Nt, sqrt: It, PI: Pt, cos: Zt, sin: Ft, atan2: zn } = Math, Un = (t, e = "lrgb", n = null) => {
|
|
864
|
-
const r = t.length;
|
|
865
|
-
n || (n = Array.from(new Array(r)).map(() => 1));
|
|
866
|
-
const o = r / n.reduce(function(d, h) {
|
|
867
|
-
return d + h;
|
|
868
|
-
});
|
|
869
|
-
if (n.forEach((d, h) => {
|
|
870
|
-
n[h] *= o;
|
|
871
|
-
}), t = t.map((d) => new i(d)), e === "lrgb")
|
|
872
|
-
return Kn(t, n);
|
|
873
|
-
const c = t.shift(), s = c.get(e), f = [];
|
|
874
|
-
let a = 0, l = 0;
|
|
875
|
-
for (let d = 0; d < s.length; d++)
|
|
876
|
-
if (s[d] = (s[d] || 0) * n[0], f.push(isNaN(s[d]) ? 0 : n[0]), e.charAt(d) === "h" && !isNaN(s[d])) {
|
|
877
|
-
const h = s[d] / 180 * Pt;
|
|
878
|
-
a += Zt(h) * n[0], l += Ft(h) * n[0];
|
|
879
|
-
}
|
|
880
|
-
let b = c.alpha() * n[0];
|
|
881
|
-
t.forEach((d, h) => {
|
|
882
|
-
const p = d.get(e);
|
|
883
|
-
b += d.alpha() * n[h + 1];
|
|
884
|
-
for (let R = 0; R < s.length; R++)
|
|
885
|
-
if (!isNaN(p[R]))
|
|
886
|
-
if (f[R] += n[h + 1], e.charAt(R) === "h") {
|
|
887
|
-
const N = p[R] / 180 * Pt;
|
|
888
|
-
a += Zt(N) * n[h + 1], l += Ft(N) * n[h + 1];
|
|
889
|
-
} else
|
|
890
|
-
s[R] += p[R] * n[h + 1];
|
|
891
|
-
});
|
|
892
|
-
for (let d = 0; d < s.length; d++)
|
|
893
|
-
if (e.charAt(d) === "h") {
|
|
894
|
-
let h = zn(l / f[d], a / f[d]) / Pt * 180;
|
|
895
|
-
for (; h < 0; ) h += 360;
|
|
896
|
-
for (; h >= 360; ) h -= 360;
|
|
897
|
-
s[d] = h;
|
|
898
|
-
} else
|
|
899
|
-
s[d] = s[d] / f[d];
|
|
900
|
-
return b /= r, new i(s, e).alpha(b > 0.99999 ? 1 : b, !0);
|
|
901
|
-
}, Kn = (t, e) => {
|
|
902
|
-
const n = t.length, r = [0, 0, 0, 0];
|
|
903
|
-
for (let o = 0; o < t.length; o++) {
|
|
904
|
-
const c = t[o], s = e[o] / n, f = c._rgb;
|
|
905
|
-
r[0] += Nt(f[0], 2) * s, r[1] += Nt(f[1], 2) * s, r[2] += Nt(f[2], 2) * s, r[3] += f[3] * s;
|
|
906
|
-
}
|
|
907
|
-
return r[0] = It(r[0]), r[1] = It(r[1]), r[2] = It(r[2]), r[3] > 0.9999999 && (r[3] = 1), new i(Tt(r));
|
|
908
|
-
}, { pow: Xn } = Math;
|
|
909
|
-
function _t(t) {
|
|
910
|
-
let e = "rgb", n = k("#ccc"), r = 0, o = [0, 1], c = [], s = [0, 0], f = !1, a = [], l = !1, b = 0, d = 1, h = !1, p = {}, R = !0, N = 1;
|
|
911
|
-
const _ = function(u) {
|
|
912
|
-
if (u = u || ["#fff", "#000"], u && E(u) === "string" && k.brewer && k.brewer[u.toLowerCase()] && (u = k.brewer[u.toLowerCase()]), E(u) === "array") {
|
|
913
|
-
u.length === 1 && (u = [u[0], u[0]]), u = u.slice(0);
|
|
914
|
-
for (let m = 0; m < u.length; m++)
|
|
915
|
-
u[m] = k(u[m]);
|
|
916
|
-
c.length = 0;
|
|
917
|
-
for (let m = 0; m < u.length; m++)
|
|
918
|
-
c.push(m / (u.length - 1));
|
|
919
|
-
}
|
|
920
|
-
return D(), a = u;
|
|
921
|
-
}, g = function(u) {
|
|
922
|
-
if (f != null) {
|
|
923
|
-
const m = f.length - 1;
|
|
924
|
-
let A = 0;
|
|
925
|
-
for (; A < m && u >= f[A]; )
|
|
926
|
-
A++;
|
|
927
|
-
return A - 1;
|
|
928
|
-
}
|
|
929
|
-
return 0;
|
|
930
|
-
};
|
|
931
|
-
let x = (u) => u, C = (u) => u;
|
|
932
|
-
const P = function(u, m) {
|
|
933
|
-
let A, w;
|
|
934
|
-
if (m == null && (m = !1), isNaN(u) || u === null)
|
|
935
|
-
return n;
|
|
936
|
-
m ? w = u : f && f.length > 2 ? w = g(u) / (f.length - 2) : d !== b ? w = (u - b) / (d - b) : w = 1, w = C(w), m || (w = x(w)), N !== 1 && (w = Xn(w, N)), w = s[0] + w * (1 - s[0] - s[1]), w = J(w, 0, 1);
|
|
937
|
-
const Y = Math.floor(w * 1e4);
|
|
938
|
-
if (R && p[Y])
|
|
939
|
-
A = p[Y];
|
|
940
|
-
else {
|
|
941
|
-
if (E(a) === "array")
|
|
942
|
-
for (let $ = 0; $ < c.length; $++) {
|
|
943
|
-
const I = c[$];
|
|
944
|
-
if (w <= I) {
|
|
945
|
-
A = a[$];
|
|
946
|
-
break;
|
|
947
|
-
}
|
|
948
|
-
if (w >= I && $ === c.length - 1) {
|
|
949
|
-
A = a[$];
|
|
950
|
-
break;
|
|
951
|
-
}
|
|
952
|
-
if (w > I && w < c[$ + 1]) {
|
|
953
|
-
w = (w - I) / (c[$ + 1] - I), A = k.interpolate(
|
|
954
|
-
a[$],
|
|
955
|
-
a[$ + 1],
|
|
956
|
-
w,
|
|
957
|
-
e
|
|
958
|
-
);
|
|
959
|
-
break;
|
|
960
|
-
}
|
|
961
|
-
}
|
|
962
|
-
else E(a) === "function" && (A = a(w));
|
|
963
|
-
R && (p[Y] = A);
|
|
964
|
-
}
|
|
965
|
-
return A;
|
|
966
|
-
};
|
|
967
|
-
var D = () => p = {};
|
|
968
|
-
_(t);
|
|
969
|
-
const L = function(u) {
|
|
970
|
-
const m = k(P(u));
|
|
971
|
-
return l && m[l] ? m[l]() : m;
|
|
972
|
-
};
|
|
973
|
-
return L.classes = function(u) {
|
|
974
|
-
if (u != null) {
|
|
975
|
-
if (E(u) === "array")
|
|
976
|
-
f = u, o = [u[0], u[u.length - 1]];
|
|
977
|
-
else {
|
|
978
|
-
const m = k.analyze(o);
|
|
979
|
-
u === 0 ? f = [m.min, m.max] : f = k.limits(m, "e", u);
|
|
980
|
-
}
|
|
981
|
-
return L;
|
|
982
|
-
}
|
|
983
|
-
return f;
|
|
984
|
-
}, L.domain = function(u) {
|
|
985
|
-
if (!arguments.length)
|
|
986
|
-
return o;
|
|
987
|
-
b = u[0], d = u[u.length - 1], c = [];
|
|
988
|
-
const m = a.length;
|
|
989
|
-
if (u.length === m && b !== d)
|
|
990
|
-
for (let A of Array.from(u))
|
|
991
|
-
c.push((A - b) / (d - b));
|
|
992
|
-
else {
|
|
993
|
-
for (let A = 0; A < m; A++)
|
|
994
|
-
c.push(A / (m - 1));
|
|
995
|
-
if (u.length > 2) {
|
|
996
|
-
const A = u.map((Y, $) => $ / (u.length - 1)), w = u.map((Y) => (Y - b) / (d - b));
|
|
997
|
-
w.every((Y, $) => A[$] === Y) || (C = (Y) => {
|
|
998
|
-
if (Y <= 0 || Y >= 1) return Y;
|
|
999
|
-
let $ = 0;
|
|
1000
|
-
for (; Y >= w[$ + 1]; ) $++;
|
|
1001
|
-
const I = (Y - w[$]) / (w[$ + 1] - w[$]);
|
|
1002
|
-
return A[$] + I * (A[$ + 1] - A[$]);
|
|
1003
|
-
});
|
|
1004
|
-
}
|
|
1005
|
-
}
|
|
1006
|
-
return o = [b, d], L;
|
|
1007
|
-
}, L.mode = function(u) {
|
|
1008
|
-
return arguments.length ? (e = u, D(), L) : e;
|
|
1009
|
-
}, L.range = function(u, m) {
|
|
1010
|
-
return _(u), L;
|
|
1011
|
-
}, L.out = function(u) {
|
|
1012
|
-
return l = u, L;
|
|
1013
|
-
}, L.spread = function(u) {
|
|
1014
|
-
return arguments.length ? (r = u, L) : r;
|
|
1015
|
-
}, L.correctLightness = function(u) {
|
|
1016
|
-
return u == null && (u = !0), h = u, D(), h ? x = function(m) {
|
|
1017
|
-
const A = P(0, !0).lab()[0], w = P(1, !0).lab()[0], Y = A > w;
|
|
1018
|
-
let $ = P(m, !0).lab()[0];
|
|
1019
|
-
const I = A + (w - A) * m;
|
|
1020
|
-
let V = $ - I, lt = 0, ut = 1, bt = 20;
|
|
1021
|
-
for (; Math.abs(V) > 0.01 && bt-- > 0; )
|
|
1022
|
-
(function() {
|
|
1023
|
-
return Y && (V *= -1), V < 0 ? (lt = m, m += (ut - m) * 0.5) : (ut = m, m += (lt - m) * 0.5), $ = P(m, !0).lab()[0], V = $ - I;
|
|
1024
|
-
})();
|
|
1025
|
-
return m;
|
|
1026
|
-
} : x = (m) => m, L;
|
|
1027
|
-
}, L.padding = function(u) {
|
|
1028
|
-
return u != null ? (E(u) === "number" && (u = [u, u]), s = u, L) : s;
|
|
1029
|
-
}, L.colors = function(u, m) {
|
|
1030
|
-
arguments.length < 2 && (m = "hex");
|
|
1031
|
-
let A = [];
|
|
1032
|
-
if (arguments.length === 0)
|
|
1033
|
-
A = a.slice(0);
|
|
1034
|
-
else if (u === 1)
|
|
1035
|
-
A = [L(0.5)];
|
|
1036
|
-
else if (u > 1) {
|
|
1037
|
-
const w = o[0], Y = o[1] - w;
|
|
1038
|
-
A = qn(0, u).map(
|
|
1039
|
-
($) => L(w + $ / (u - 1) * Y)
|
|
1040
|
-
);
|
|
1041
|
-
} else {
|
|
1042
|
-
t = [];
|
|
1043
|
-
let w = [];
|
|
1044
|
-
if (f && f.length > 2)
|
|
1045
|
-
for (let Y = 1, $ = f.length, I = 1 <= $; I ? Y < $ : Y > $; I ? Y++ : Y--)
|
|
1046
|
-
w.push((f[Y - 1] + f[Y]) * 0.5);
|
|
1047
|
-
else
|
|
1048
|
-
w = o;
|
|
1049
|
-
A = w.map((Y) => L(Y));
|
|
1050
|
-
}
|
|
1051
|
-
return k[m] && (A = A.map((w) => w[m]())), A;
|
|
1052
|
-
}, L.cache = function(u) {
|
|
1053
|
-
return u != null ? (R = u, L) : R;
|
|
1054
|
-
}, L.gamma = function(u) {
|
|
1055
|
-
return u != null ? (N = u, L) : N;
|
|
1056
|
-
}, L.nodata = function(u) {
|
|
1057
|
-
return u != null ? (n = k(u), L) : n;
|
|
1058
|
-
}, L;
|
|
1059
|
-
}
|
|
1060
|
-
function qn(t, e, n) {
|
|
1061
|
-
let r = [], o = t < e, c = e;
|
|
1062
|
-
for (let s = t; o ? s < c : s > c; o ? s++ : s--)
|
|
1063
|
-
r.push(s);
|
|
1064
|
-
return r;
|
|
1065
|
-
}
|
|
1066
|
-
const Zn = function(t) {
|
|
1067
|
-
let e = [1, 1];
|
|
1068
|
-
for (let n = 1; n < t; n++) {
|
|
1069
|
-
let r = [1];
|
|
1070
|
-
for (let o = 1; o <= e.length; o++)
|
|
1071
|
-
r[o] = (e[o] || 0) + e[o - 1];
|
|
1072
|
-
e = r;
|
|
1073
|
-
}
|
|
1074
|
-
return e;
|
|
1075
|
-
}, Fn = function(t) {
|
|
1076
|
-
let e, n, r, o;
|
|
1077
|
-
if (t = t.map((c) => new i(c)), t.length === 2)
|
|
1078
|
-
[n, r] = t.map((c) => c.lab()), e = function(c) {
|
|
1079
|
-
const s = [0, 1, 2].map((f) => n[f] + c * (r[f] - n[f]));
|
|
1080
|
-
return new i(s, "lab");
|
|
1081
|
-
};
|
|
1082
|
-
else if (t.length === 3)
|
|
1083
|
-
[n, r, o] = t.map((c) => c.lab()), e = function(c) {
|
|
1084
|
-
const s = [0, 1, 2].map(
|
|
1085
|
-
(f) => (1 - c) * (1 - c) * n[f] + 2 * (1 - c) * c * r[f] + c * c * o[f]
|
|
1086
|
-
);
|
|
1087
|
-
return new i(s, "lab");
|
|
1088
|
-
};
|
|
1089
|
-
else if (t.length === 4) {
|
|
1090
|
-
let c;
|
|
1091
|
-
[n, r, o, c] = t.map((s) => s.lab()), e = function(s) {
|
|
1092
|
-
const f = [0, 1, 2].map(
|
|
1093
|
-
(a) => (1 - s) * (1 - s) * (1 - s) * n[a] + 3 * (1 - s) * (1 - s) * s * r[a] + 3 * (1 - s) * s * s * o[a] + s * s * s * c[a]
|
|
1094
|
-
);
|
|
1095
|
-
return new i(f, "lab");
|
|
1096
|
-
};
|
|
1097
|
-
} else if (t.length >= 5) {
|
|
1098
|
-
let c, s, f;
|
|
1099
|
-
c = t.map((a) => a.lab()), f = t.length - 1, s = Zn(f), e = function(a) {
|
|
1100
|
-
const l = 1 - a, b = [0, 1, 2].map(
|
|
1101
|
-
(d) => c.reduce(
|
|
1102
|
-
(h, p, R) => h + s[R] * l ** (f - R) * a ** R * p[d],
|
|
1103
|
-
0
|
|
1104
|
-
)
|
|
1105
|
-
);
|
|
1106
|
-
return new i(b, "lab");
|
|
1107
|
-
};
|
|
1108
|
-
} else
|
|
1109
|
-
throw new RangeError("No point in running bezier with only one color.");
|
|
1110
|
-
return e;
|
|
1111
|
-
}, Wn = (t) => {
|
|
1112
|
-
const e = Fn(t);
|
|
1113
|
-
return e.scale = () => _t(e), e;
|
|
1114
|
-
}, { round: we } = Math;
|
|
1115
|
-
i.prototype.rgb = function(t = !0) {
|
|
1116
|
-
return t === !1 ? this._rgb.slice(0, 3) : this._rgb.slice(0, 3).map(we);
|
|
1117
|
-
};
|
|
1118
|
-
i.prototype.rgba = function(t = !0) {
|
|
1119
|
-
return this._rgb.slice(0, 4).map((e, n) => n < 3 ? t === !1 ? e : we(e) : e);
|
|
1120
|
-
};
|
|
1121
|
-
const Vn = (...t) => new i(...t, "rgb");
|
|
1122
|
-
Object.assign(k, { rgb: Vn });
|
|
1123
|
-
y.format.rgb = (...t) => {
|
|
1124
|
-
const e = M(t, "rgba");
|
|
1125
|
-
return e[3] === void 0 && (e[3] = 1), e;
|
|
1126
|
-
};
|
|
1127
|
-
y.autodetect.push({
|
|
1128
|
-
p: 3,
|
|
1129
|
-
test: (...t) => {
|
|
1130
|
-
if (t = M(t, "rgba"), E(t) === "array" && (t.length === 3 || t.length === 4 && E(t[3]) == "number" && t[3] >= 0 && t[3] <= 1))
|
|
1131
|
-
return "rgb";
|
|
1132
|
-
}
|
|
1133
|
-
});
|
|
1134
|
-
const z = (t, e, n) => {
|
|
1135
|
-
if (!z[n])
|
|
1136
|
-
throw new Error("unknown blend mode " + n);
|
|
1137
|
-
return z[n](t, e);
|
|
1138
|
-
}, F = (t) => (e, n) => {
|
|
1139
|
-
const r = k(n).rgb(), o = k(e).rgb();
|
|
1140
|
-
return k.rgb(t(r, o));
|
|
1141
|
-
}, W = (t) => (e, n) => {
|
|
1142
|
-
const r = [];
|
|
1143
|
-
return r[0] = t(e[0], n[0]), r[1] = t(e[1], n[1]), r[2] = t(e[2], n[2]), r;
|
|
1144
|
-
}, Jn = (t) => t, Qn = (t, e) => t * e / 255, t0 = (t, e) => t > e ? e : t, e0 = (t, e) => t > e ? t : e, n0 = (t, e) => 255 * (1 - (1 - t / 255) * (1 - e / 255)), r0 = (t, e) => e < 128 ? 2 * t * e / 255 : 255 * (1 - 2 * (1 - t / 255) * (1 - e / 255)), o0 = (t, e) => 255 * (1 - (1 - e / 255) / (t / 255)), c0 = (t, e) => t === 255 ? 255 : (t = 255 * (e / 255) / (1 - t / 255), t > 255 ? 255 : t);
|
|
1145
|
-
z.normal = F(W(Jn));
|
|
1146
|
-
z.multiply = F(W(Qn));
|
|
1147
|
-
z.screen = F(W(n0));
|
|
1148
|
-
z.overlay = F(W(r0));
|
|
1149
|
-
z.darken = F(W(t0));
|
|
1150
|
-
z.lighten = F(W(e0));
|
|
1151
|
-
z.dodge = F(W(c0));
|
|
1152
|
-
z.burn = F(W(o0));
|
|
1153
|
-
const { pow: s0, sin: f0, cos: a0 } = Math;
|
|
1154
|
-
function l0(t = 300, e = -1.5, n = 1, r = 1, o = [0, 1]) {
|
|
1155
|
-
let c = 0, s;
|
|
1156
|
-
E(o) === "array" ? s = o[1] - o[0] : (s = 0, o = [o, o]);
|
|
1157
|
-
const f = function(a) {
|
|
1158
|
-
const l = X * ((t + 120) / 360 + e * a), b = s0(o[0] + s * a, r), h = (c !== 0 ? n[0] + a * c : n) * b * (1 - b) / 2, p = a0(l), R = f0(l), N = b + h * (-0.14861 * p + 1.78277 * R), _ = b + h * (-0.29227 * p - 0.90649 * R), g = b + h * (1.97294 * p);
|
|
1159
|
-
return k(Tt([N * 255, _ * 255, g * 255, 1]));
|
|
1160
|
-
};
|
|
1161
|
-
return f.start = function(a) {
|
|
1162
|
-
return a == null ? t : (t = a, f);
|
|
1163
|
-
}, f.rotations = function(a) {
|
|
1164
|
-
return a == null ? e : (e = a, f);
|
|
1165
|
-
}, f.gamma = function(a) {
|
|
1166
|
-
return a == null ? r : (r = a, f);
|
|
1167
|
-
}, f.hue = function(a) {
|
|
1168
|
-
return a == null ? n : (n = a, E(n) === "array" ? (c = n[1] - n[0], c === 0 && (n = n[1])) : c = 0, f);
|
|
1169
|
-
}, f.lightness = function(a) {
|
|
1170
|
-
return a == null ? o : (E(a) === "array" ? (o = a, s = a[1] - a[0]) : (o = [a, a], s = 0), f);
|
|
1171
|
-
}, f.scale = () => k.scale(f), f.hue(n), f;
|
|
1172
|
-
}
|
|
1173
|
-
const i0 = "0123456789abcdef", { floor: u0, random: b0 } = Math, h0 = () => {
|
|
1174
|
-
let t = "#";
|
|
1175
|
-
for (let e = 0; e < 6; e++)
|
|
1176
|
-
t += i0.charAt(u0(b0() * 16));
|
|
1177
|
-
return new i(t, "hex");
|
|
1178
|
-
}, { log: Wt, pow: d0, floor: p0, abs: m0 } = Math;
|
|
1179
|
-
function ye(t, e = null) {
|
|
1180
|
-
const n = {
|
|
1181
|
-
min: Number.MAX_VALUE,
|
|
1182
|
-
max: Number.MAX_VALUE * -1,
|
|
1183
|
-
sum: 0,
|
|
1184
|
-
values: [],
|
|
1185
|
-
count: 0
|
|
1186
|
-
};
|
|
1187
|
-
return E(t) === "object" && (t = Object.values(t)), t.forEach((r) => {
|
|
1188
|
-
e && E(r) === "object" && (r = r[e]), r != null && !isNaN(r) && (n.values.push(r), n.sum += r, r < n.min && (n.min = r), r > n.max && (n.max = r), n.count += 1);
|
|
1189
|
-
}), n.domain = [n.min, n.max], n.limits = (r, o) => Re(n, r, o), n;
|
|
1190
|
-
}
|
|
1191
|
-
function Re(t, e = "equal", n = 7) {
|
|
1192
|
-
E(t) == "array" && (t = ye(t));
|
|
1193
|
-
const { min: r, max: o } = t, c = t.values.sort((f, a) => f - a);
|
|
1194
|
-
if (n === 1)
|
|
1195
|
-
return [r, o];
|
|
1196
|
-
const s = [];
|
|
1197
|
-
if (e.substr(0, 1) === "c" && (s.push(r), s.push(o)), e.substr(0, 1) === "e") {
|
|
1198
|
-
s.push(r);
|
|
1199
|
-
for (let f = 1; f < n; f++)
|
|
1200
|
-
s.push(r + f / n * (o - r));
|
|
1201
|
-
s.push(o);
|
|
1202
|
-
} else if (e.substr(0, 1) === "l") {
|
|
1203
|
-
if (r <= 0)
|
|
1204
|
-
throw new Error(
|
|
1205
|
-
"Logarithmic scales are only possible for values > 0"
|
|
1206
|
-
);
|
|
1207
|
-
const f = Math.LOG10E * Wt(r), a = Math.LOG10E * Wt(o);
|
|
1208
|
-
s.push(r);
|
|
1209
|
-
for (let l = 1; l < n; l++)
|
|
1210
|
-
s.push(d0(10, f + l / n * (a - f)));
|
|
1211
|
-
s.push(o);
|
|
1212
|
-
} else if (e.substr(0, 1) === "q") {
|
|
1213
|
-
s.push(r);
|
|
1214
|
-
for (let f = 1; f < n; f++) {
|
|
1215
|
-
const a = (c.length - 1) * f / n, l = p0(a);
|
|
1216
|
-
if (l === a)
|
|
1217
|
-
s.push(c[l]);
|
|
1218
|
-
else {
|
|
1219
|
-
const b = a - l;
|
|
1220
|
-
s.push(c[l] * (1 - b) + c[l + 1] * b);
|
|
1221
|
-
}
|
|
1222
|
-
}
|
|
1223
|
-
s.push(o);
|
|
1224
|
-
} else if (e.substr(0, 1) === "k") {
|
|
1225
|
-
let f;
|
|
1226
|
-
const a = c.length, l = new Array(a), b = new Array(n);
|
|
1227
|
-
let d = !0, h = 0, p = null;
|
|
1228
|
-
p = [], p.push(r);
|
|
1229
|
-
for (let _ = 1; _ < n; _++)
|
|
1230
|
-
p.push(r + _ / n * (o - r));
|
|
1231
|
-
for (p.push(o); d; ) {
|
|
1232
|
-
for (let g = 0; g < n; g++)
|
|
1233
|
-
b[g] = 0;
|
|
1234
|
-
for (let g = 0; g < a; g++) {
|
|
1235
|
-
const x = c[g];
|
|
1236
|
-
let C = Number.MAX_VALUE, P;
|
|
1237
|
-
for (let D = 0; D < n; D++) {
|
|
1238
|
-
const L = m0(p[D] - x);
|
|
1239
|
-
L < C && (C = L, P = D), b[P]++, l[g] = P;
|
|
1240
|
-
}
|
|
1241
|
-
}
|
|
1242
|
-
const _ = new Array(n);
|
|
1243
|
-
for (let g = 0; g < n; g++)
|
|
1244
|
-
_[g] = null;
|
|
1245
|
-
for (let g = 0; g < a; g++)
|
|
1246
|
-
f = l[g], _[f] === null ? _[f] = c[g] : _[f] += c[g];
|
|
1247
|
-
for (let g = 0; g < n; g++)
|
|
1248
|
-
_[g] *= 1 / b[g];
|
|
1249
|
-
d = !1;
|
|
1250
|
-
for (let g = 0; g < n; g++)
|
|
1251
|
-
if (_[g] !== p[g]) {
|
|
1252
|
-
d = !0;
|
|
1253
|
-
break;
|
|
1254
|
-
}
|
|
1255
|
-
p = _, h++, h > 200 && (d = !1);
|
|
1256
|
-
}
|
|
1257
|
-
const R = {};
|
|
1258
|
-
for (let _ = 0; _ < n; _++)
|
|
1259
|
-
R[_] = [];
|
|
1260
|
-
for (let _ = 0; _ < a; _++)
|
|
1261
|
-
f = l[_], R[f].push(c[_]);
|
|
1262
|
-
let N = [];
|
|
1263
|
-
for (let _ = 0; _ < n; _++)
|
|
1264
|
-
N.push(R[_][0]), N.push(R[_][R[_].length - 1]);
|
|
1265
|
-
N = N.sort((_, g) => _ - g), s.push(N[0]);
|
|
1266
|
-
for (let _ = 1; _ < N.length; _ += 2) {
|
|
1267
|
-
const g = N[_];
|
|
1268
|
-
!isNaN(g) && s.indexOf(g) === -1 && s.push(g);
|
|
1269
|
-
}
|
|
1270
|
-
}
|
|
1271
|
-
return s;
|
|
1272
|
-
}
|
|
1273
|
-
const g0 = (t, e) => {
|
|
1274
|
-
t = new i(t), e = new i(e);
|
|
1275
|
-
const n = t.luminance(), r = e.luminance();
|
|
1276
|
-
return n > r ? (n + 0.05) / (r + 0.05) : (r + 0.05) / (n + 0.05);
|
|
1277
|
-
};
|
|
1278
|
-
/**
|
|
1279
|
-
* @license
|
|
1280
|
-
*
|
|
1281
|
-
* The APCA contrast prediction algorithm is based of the formulas published
|
|
1282
|
-
* in the APCA-1.0.98G specification by Myndex. The specification is available at:
|
|
1283
|
-
* https://raw.githubusercontent.com/Myndex/apca-w3/master/images/APCAw3_0.1.17_APCA0.0.98G.svg
|
|
1284
|
-
*
|
|
1285
|
-
* Note that the APCA implementation is still beta, so please update to
|
|
1286
|
-
* future versions of chroma.js when they become available.
|
|
1287
|
-
*
|
|
1288
|
-
* You can read more about the APCA Readability Criterion at
|
|
1289
|
-
* https://readtech.org/ARC/
|
|
1290
|
-
*/
|
|
1291
|
-
const Vt = 0.027, _0 = 5e-4, w0 = 0.1, Jt = 1.14, dt = 0.022, Qt = 1.414, y0 = (t, e) => {
|
|
1292
|
-
t = new i(t), e = new i(e), t.alpha() < 1 && (t = ot(e, t, t.alpha(), "rgb"));
|
|
1293
|
-
const n = te(...t.rgb()), r = te(...e.rgb()), o = n >= dt ? n : n + Math.pow(dt - n, Qt), c = r >= dt ? r : r + Math.pow(dt - r, Qt), s = Math.pow(c, 0.56) - Math.pow(o, 0.57), f = Math.pow(c, 0.65) - Math.pow(o, 0.62), a = Math.abs(c - o) < _0 ? 0 : o < c ? s * Jt : f * Jt;
|
|
1294
|
-
return (Math.abs(a) < w0 ? 0 : a > 0 ? a - Vt : a + Vt) * 100;
|
|
1295
|
-
};
|
|
1296
|
-
function te(t, e, n) {
|
|
1297
|
-
return 0.2126729 * Math.pow(t / 255, 2.4) + 0.7151522 * Math.pow(e / 255, 2.4) + 0.072175 * Math.pow(n / 255, 2.4);
|
|
1298
|
-
}
|
|
1299
|
-
const { sqrt: K, pow: G, min: R0, max: k0, atan2: ee, abs: ne, cos: pt, sin: re, exp: M0, PI: oe } = Math;
|
|
1300
|
-
function A0(t, e, n = 1, r = 1, o = 1) {
|
|
1301
|
-
var c = function(kt) {
|
|
1302
|
-
return 360 * kt / (2 * oe);
|
|
1303
|
-
}, s = function(kt) {
|
|
1304
|
-
return 2 * oe * kt / 360;
|
|
1305
|
-
};
|
|
1306
|
-
t = new i(t), e = new i(e);
|
|
1307
|
-
const [f, a, l] = Array.from(t.lab()), [b, d, h] = Array.from(e.lab()), p = (f + b) / 2, R = K(G(a, 2) + G(l, 2)), N = K(G(d, 2) + G(h, 2)), _ = (R + N) / 2, g = 0.5 * (1 - K(G(_, 7) / (G(_, 7) + G(25, 7)))), x = a * (1 + g), C = d * (1 + g), P = K(G(x, 2) + G(l, 2)), D = K(G(C, 2) + G(h, 2)), L = (P + D) / 2, u = c(ee(l, x)), m = c(ee(h, C)), A = u >= 0 ? u : u + 360, w = m >= 0 ? m : m + 360, Y = ne(A - w) > 180 ? (A + w + 360) / 2 : (A + w) / 2, $ = 1 - 0.17 * pt(s(Y - 30)) + 0.24 * pt(s(2 * Y)) + 0.32 * pt(s(3 * Y + 6)) - 0.2 * pt(s(4 * Y - 63));
|
|
1308
|
-
let I = w - A;
|
|
1309
|
-
I = ne(I) <= 180 ? I : w <= A ? I + 360 : I - 360, I = 2 * K(P * D) * re(s(I) / 2);
|
|
1310
|
-
const V = b - f, lt = D - P, ut = 1 + 0.015 * G(p - 50, 2) / K(20 + G(p - 50, 2)), bt = 1 + 0.045 * L, qt = 1 + 0.015 * L * $, Oe = 30 * M0(-G((Y - 275) / 25, 2)), Te = -(2 * K(G(L, 7) / (G(L, 7) + G(25, 7)))) * re(2 * s(Oe)), ve = K(
|
|
1311
|
-
G(V / (n * ut), 2) + G(lt / (r * bt), 2) + G(I / (o * qt), 2) + Te * (lt / (r * bt)) * (I / (o * qt))
|
|
1312
|
-
);
|
|
1313
|
-
return k0(0, R0(100, ve));
|
|
1314
|
-
}
|
|
1315
|
-
function E0(t, e, n = "lab") {
|
|
1316
|
-
t = new i(t), e = new i(e);
|
|
1317
|
-
const r = t.get(n), o = e.get(n);
|
|
1318
|
-
let c = 0;
|
|
1319
|
-
for (let s in r) {
|
|
1320
|
-
const f = (r[s] || 0) - (o[s] || 0);
|
|
1321
|
-
c += f * f;
|
|
1322
|
-
}
|
|
1323
|
-
return Math.sqrt(c);
|
|
1324
|
-
}
|
|
1325
|
-
const L0 = (...t) => {
|
|
1326
|
-
try {
|
|
1327
|
-
return new i(...t), !0;
|
|
1328
|
-
} catch {
|
|
1329
|
-
return !1;
|
|
1330
|
-
}
|
|
1331
|
-
}, $0 = {
|
|
1332
|
-
cool() {
|
|
1333
|
-
return _t([k.hsl(180, 1, 0.9), k.hsl(250, 0.7, 0.4)]);
|
|
1334
|
-
},
|
|
1335
|
-
hot() {
|
|
1336
|
-
return _t(["#000", "#f00", "#ff0", "#fff"]).mode(
|
|
1337
|
-
"rgb"
|
|
1338
|
-
);
|
|
1339
|
-
}
|
|
1340
|
-
}, Dt = {
|
|
1341
|
-
// sequential
|
|
1342
|
-
OrRd: ["#fff7ec", "#fee8c8", "#fdd49e", "#fdbb84", "#fc8d59", "#ef6548", "#d7301f", "#b30000", "#7f0000"],
|
|
1343
|
-
PuBu: ["#fff7fb", "#ece7f2", "#d0d1e6", "#a6bddb", "#74a9cf", "#3690c0", "#0570b0", "#045a8d", "#023858"],
|
|
1344
|
-
BuPu: ["#f7fcfd", "#e0ecf4", "#bfd3e6", "#9ebcda", "#8c96c6", "#8c6bb1", "#88419d", "#810f7c", "#4d004b"],
|
|
1345
|
-
Oranges: ["#fff5eb", "#fee6ce", "#fdd0a2", "#fdae6b", "#fd8d3c", "#f16913", "#d94801", "#a63603", "#7f2704"],
|
|
1346
|
-
BuGn: ["#f7fcfd", "#e5f5f9", "#ccece6", "#99d8c9", "#66c2a4", "#41ae76", "#238b45", "#006d2c", "#00441b"],
|
|
1347
|
-
YlOrBr: ["#ffffe5", "#fff7bc", "#fee391", "#fec44f", "#fe9929", "#ec7014", "#cc4c02", "#993404", "#662506"],
|
|
1348
|
-
YlGn: ["#ffffe5", "#f7fcb9", "#d9f0a3", "#addd8e", "#78c679", "#41ab5d", "#238443", "#006837", "#004529"],
|
|
1349
|
-
Reds: ["#fff5f0", "#fee0d2", "#fcbba1", "#fc9272", "#fb6a4a", "#ef3b2c", "#cb181d", "#a50f15", "#67000d"],
|
|
1350
|
-
RdPu: ["#fff7f3", "#fde0dd", "#fcc5c0", "#fa9fb5", "#f768a1", "#dd3497", "#ae017e", "#7a0177", "#49006a"],
|
|
1351
|
-
Greens: ["#f7fcf5", "#e5f5e0", "#c7e9c0", "#a1d99b", "#74c476", "#41ab5d", "#238b45", "#006d2c", "#00441b"],
|
|
1352
|
-
YlGnBu: ["#ffffd9", "#edf8b1", "#c7e9b4", "#7fcdbb", "#41b6c4", "#1d91c0", "#225ea8", "#253494", "#081d58"],
|
|
1353
|
-
Purples: ["#fcfbfd", "#efedf5", "#dadaeb", "#bcbddc", "#9e9ac8", "#807dba", "#6a51a3", "#54278f", "#3f007d"],
|
|
1354
|
-
GnBu: ["#f7fcf0", "#e0f3db", "#ccebc5", "#a8ddb5", "#7bccc4", "#4eb3d3", "#2b8cbe", "#0868ac", "#084081"],
|
|
1355
|
-
Greys: ["#ffffff", "#f0f0f0", "#d9d9d9", "#bdbdbd", "#969696", "#737373", "#525252", "#252525", "#000000"],
|
|
1356
|
-
YlOrRd: ["#ffffcc", "#ffeda0", "#fed976", "#feb24c", "#fd8d3c", "#fc4e2a", "#e31a1c", "#bd0026", "#800026"],
|
|
1357
|
-
PuRd: ["#f7f4f9", "#e7e1ef", "#d4b9da", "#c994c7", "#df65b0", "#e7298a", "#ce1256", "#980043", "#67001f"],
|
|
1358
|
-
Blues: ["#f7fbff", "#deebf7", "#c6dbef", "#9ecae1", "#6baed6", "#4292c6", "#2171b5", "#08519c", "#08306b"],
|
|
1359
|
-
PuBuGn: ["#fff7fb", "#ece2f0", "#d0d1e6", "#a6bddb", "#67a9cf", "#3690c0", "#02818a", "#016c59", "#014636"],
|
|
1360
|
-
Viridis: ["#440154", "#482777", "#3f4a8a", "#31678e", "#26838f", "#1f9d8a", "#6cce5a", "#b6de2b", "#fee825"],
|
|
1361
|
-
// diverging
|
|
1362
|
-
Spectral: ["#9e0142", "#d53e4f", "#f46d43", "#fdae61", "#fee08b", "#ffffbf", "#e6f598", "#abdda4", "#66c2a5", "#3288bd", "#5e4fa2"],
|
|
1363
|
-
RdYlGn: ["#a50026", "#d73027", "#f46d43", "#fdae61", "#fee08b", "#ffffbf", "#d9ef8b", "#a6d96a", "#66bd63", "#1a9850", "#006837"],
|
|
1364
|
-
RdBu: ["#67001f", "#b2182b", "#d6604d", "#f4a582", "#fddbc7", "#f7f7f7", "#d1e5f0", "#92c5de", "#4393c3", "#2166ac", "#053061"],
|
|
1365
|
-
PiYG: ["#8e0152", "#c51b7d", "#de77ae", "#f1b6da", "#fde0ef", "#f7f7f7", "#e6f5d0", "#b8e186", "#7fbc41", "#4d9221", "#276419"],
|
|
1366
|
-
PRGn: ["#40004b", "#762a83", "#9970ab", "#c2a5cf", "#e7d4e8", "#f7f7f7", "#d9f0d3", "#a6dba0", "#5aae61", "#1b7837", "#00441b"],
|
|
1367
|
-
RdYlBu: ["#a50026", "#d73027", "#f46d43", "#fdae61", "#fee090", "#ffffbf", "#e0f3f8", "#abd9e9", "#74add1", "#4575b4", "#313695"],
|
|
1368
|
-
BrBG: ["#543005", "#8c510a", "#bf812d", "#dfc27d", "#f6e8c3", "#f5f5f5", "#c7eae5", "#80cdc1", "#35978f", "#01665e", "#003c30"],
|
|
1369
|
-
RdGy: ["#67001f", "#b2182b", "#d6604d", "#f4a582", "#fddbc7", "#ffffff", "#e0e0e0", "#bababa", "#878787", "#4d4d4d", "#1a1a1a"],
|
|
1370
|
-
PuOr: ["#7f3b08", "#b35806", "#e08214", "#fdb863", "#fee0b6", "#f7f7f7", "#d8daeb", "#b2abd2", "#8073ac", "#542788", "#2d004b"],
|
|
1371
|
-
// qualitative
|
|
1372
|
-
Set2: ["#66c2a5", "#fc8d62", "#8da0cb", "#e78ac3", "#a6d854", "#ffd92f", "#e5c494", "#b3b3b3"],
|
|
1373
|
-
Accent: ["#7fc97f", "#beaed4", "#fdc086", "#ffff99", "#386cb0", "#f0027f", "#bf5b17", "#666666"],
|
|
1374
|
-
Set1: ["#e41a1c", "#377eb8", "#4daf4a", "#984ea3", "#ff7f00", "#ffff33", "#a65628", "#f781bf", "#999999"],
|
|
1375
|
-
Set3: ["#8dd3c7", "#ffffb3", "#bebada", "#fb8072", "#80b1d3", "#fdb462", "#b3de69", "#fccde5", "#d9d9d9", "#bc80bd", "#ccebc5", "#ffed6f"],
|
|
1376
|
-
Dark2: ["#1b9e77", "#d95f02", "#7570b3", "#e7298a", "#66a61e", "#e6ab02", "#a6761d", "#666666"],
|
|
1377
|
-
Paired: ["#a6cee3", "#1f78b4", "#b2df8a", "#33a02c", "#fb9a99", "#e31a1c", "#fdbf6f", "#ff7f00", "#cab2d6", "#6a3d9a", "#ffff99", "#b15928"],
|
|
1378
|
-
Pastel2: ["#b3e2cd", "#fdcdac", "#cbd5e8", "#f4cae4", "#e6f5c9", "#fff2ae", "#f1e2cc", "#cccccc"],
|
|
1379
|
-
Pastel1: ["#fbb4ae", "#b3cde3", "#ccebc5", "#decbe4", "#fed9a6", "#ffffcc", "#e5d8bd", "#fddaec", "#f2f2f2"]
|
|
1380
|
-
}, ke = Object.keys(Dt), ce = new Map(ke.map((t) => [t.toLowerCase(), t])), Y0 = typeof Proxy == "function" ? new Proxy(Dt, {
|
|
1381
|
-
get(t, e) {
|
|
1382
|
-
const n = e.toLowerCase();
|
|
1383
|
-
if (ce.has(n))
|
|
1384
|
-
return t[ce.get(n)];
|
|
1385
|
-
},
|
|
1386
|
-
getOwnPropertyNames() {
|
|
1387
|
-
return Object.getOwnPropertyNames(ke);
|
|
1388
|
-
}
|
|
1389
|
-
}) : Dt, N0 = (...t) => {
|
|
1390
|
-
t = M(t, "cmyk");
|
|
1391
|
-
const [e, n, r, o] = t, c = t.length > 4 ? t[4] : 1;
|
|
1392
|
-
return o === 1 ? [0, 0, 0, c] : [
|
|
1393
|
-
e >= 1 ? 0 : 255 * (1 - e) * (1 - o),
|
|
1394
|
-
// r
|
|
1395
|
-
n >= 1 ? 0 : 255 * (1 - n) * (1 - o),
|
|
1396
|
-
// g
|
|
1397
|
-
r >= 1 ? 0 : 255 * (1 - r) * (1 - o),
|
|
1398
|
-
// b
|
|
1399
|
-
c
|
|
1400
|
-
];
|
|
1401
|
-
}, { max: se } = Math, I0 = (...t) => {
|
|
1402
|
-
let [e, n, r] = M(t, "rgb");
|
|
1403
|
-
e = e / 255, n = n / 255, r = r / 255;
|
|
1404
|
-
const o = 1 - se(e, se(n, r)), c = o < 1 ? 1 / (1 - o) : 0, s = (1 - e - o) * c, f = (1 - n - o) * c, a = (1 - r - o) * c;
|
|
1405
|
-
return [s, f, a, o];
|
|
1406
|
-
};
|
|
1407
|
-
i.prototype.cmyk = function() {
|
|
1408
|
-
return I0(this._rgb);
|
|
1409
|
-
};
|
|
1410
|
-
const P0 = (...t) => new i(...t, "cmyk");
|
|
1411
|
-
Object.assign(k, { cmyk: P0 });
|
|
1412
|
-
y.format.cmyk = N0;
|
|
1413
|
-
y.autodetect.push({
|
|
1414
|
-
p: 2,
|
|
1415
|
-
test: (...t) => {
|
|
1416
|
-
if (t = M(t, "cmyk"), E(t) === "array" && t.length === 4)
|
|
1417
|
-
return "cmyk";
|
|
1418
|
-
}
|
|
1419
|
-
});
|
|
1420
|
-
const G0 = (...t) => {
|
|
1421
|
-
const e = M(t, "hsla");
|
|
1422
|
-
let n = ct(t) || "lsa";
|
|
1423
|
-
return e[0] = j(e[0] || 0) + "deg", e[1] = j(e[1] * 100) + "%", e[2] = j(e[2] * 100) + "%", n === "hsla" || e.length > 3 && e[3] < 1 ? (e[3] = "/ " + (e.length > 3 ? e[3] : 1), n = "hsla") : e.length = 3, `${n.substr(0, 3)}(${e.join(" ")})`;
|
|
1424
|
-
}, S0 = (...t) => {
|
|
1425
|
-
const e = M(t, "lab");
|
|
1426
|
-
let n = ct(t) || "lab";
|
|
1427
|
-
return e[0] = j(e[0]) + "%", e[1] = j(e[1]), e[2] = j(e[2]), n === "laba" || e.length > 3 && e[3] < 1 ? e[3] = "/ " + (e.length > 3 ? e[3] : 1) : e.length = 3, `lab(${e.join(" ")})`;
|
|
1428
|
-
}, x0 = (...t) => {
|
|
1429
|
-
const e = M(t, "lch");
|
|
1430
|
-
let n = ct(t) || "lab";
|
|
1431
|
-
return e[0] = j(e[0]) + "%", e[1] = j(e[1]), e[2] = isNaN(e[2]) ? "none" : j(e[2]) + "deg", n === "lcha" || e.length > 3 && e[3] < 1 ? e[3] = "/ " + (e.length > 3 ? e[3] : 1) : e.length = 3, `lch(${e.join(" ")})`;
|
|
1432
|
-
}, C0 = (...t) => {
|
|
1433
|
-
const e = M(t, "lab");
|
|
1434
|
-
return e[0] = j(e[0] * 100) + "%", e[1] = xt(e[1]), e[2] = xt(e[2]), e.length > 3 && e[3] < 1 ? e[3] = "/ " + (e.length > 3 ? e[3] : 1) : e.length = 3, `oklab(${e.join(" ")})`;
|
|
1435
|
-
}, Me = (...t) => {
|
|
1436
|
-
const [e, n, r, ...o] = M(t, "rgb"), [c, s, f] = Ut(e, n, r), [a, l, b] = me(c, s, f);
|
|
1437
|
-
return [a, l, b, ...o.length > 0 && o[0] < 1 ? [o[0]] : []];
|
|
1438
|
-
}, D0 = (...t) => {
|
|
1439
|
-
const e = M(t, "lch");
|
|
1440
|
-
return e[0] = j(e[0] * 100) + "%", e[1] = xt(e[1]), e[2] = isNaN(e[2]) ? "none" : j(e[2]) + "deg", e.length > 3 && e[3] < 1 ? e[3] = "/ " + (e.length > 3 ? e[3] : 1) : e.length = 3, `oklch(${e.join(" ")})`;
|
|
1441
|
-
}, { round: Gt } = Math, O0 = (...t) => {
|
|
1442
|
-
const e = M(t, "rgba");
|
|
1443
|
-
let n = ct(t) || "rgb";
|
|
1444
|
-
if (n.substr(0, 3) === "hsl")
|
|
1445
|
-
return G0(_e(e), n);
|
|
1446
|
-
if (n.substr(0, 3) === "lab") {
|
|
1447
|
-
const r = it();
|
|
1448
|
-
q("d50");
|
|
1449
|
-
const o = S0(jt(e), n);
|
|
1450
|
-
return q(r), o;
|
|
1451
|
-
}
|
|
1452
|
-
if (n.substr(0, 3) === "lch") {
|
|
1453
|
-
const r = it();
|
|
1454
|
-
q("d50");
|
|
1455
|
-
const o = x0(Bt(e), n);
|
|
1456
|
-
return q(r), o;
|
|
1457
|
-
}
|
|
1458
|
-
return n.substr(0, 5) === "oklab" ? C0(Ut(e)) : n.substr(0, 5) === "oklch" ? D0(Me(e)) : (e[0] = Gt(e[0]), e[1] = Gt(e[1]), e[2] = Gt(e[2]), (n === "rgba" || e.length > 3 && e[3] < 1) && (e[3] = "/ " + (e.length > 3 ? e[3] : 1), n = "rgba"), `${n.substr(0, 3)}(${e.slice(0, n === "rgb" ? 3 : 4).join(" ")})`);
|
|
1459
|
-
}, Ae = (...t) => {
|
|
1460
|
-
t = M(t, "lch");
|
|
1461
|
-
const [e, n, r, ...o] = t, [c, s, f] = pe(e, n, r), [a, l, b] = zt(c, s, f);
|
|
1462
|
-
return [a, l, b, ...o.length > 0 && o[0] < 1 ? [o[0]] : []];
|
|
1463
|
-
}, Z = /((?:-?\d+)|(?:-?\d+(?:\.\d+)?)%|none)/.source, B = /((?:-?(?:\d+(?:\.\d*)?|\.\d+)%?)|none)/.source, wt = /((?:-?(?:\d+(?:\.\d*)?|\.\d+)%)|none)/.source, H = /\s*/.source, ft = /\s+/.source, Kt = /\s*,\s*/.source, Rt = /((?:-?(?:\d+(?:\.\d*)?|\.\d+)(?:deg)?)|none)/.source, at = /\s*(?:\/\s*((?:[01]|[01]?\.\d+)|\d+(?:\.\d+)?%))?/.source, Ee = new RegExp(
|
|
1464
|
-
"^rgba?\\(" + H + [Z, Z, Z].join(ft) + at + "\\)$"
|
|
1465
|
-
), Le = new RegExp(
|
|
1466
|
-
"^rgb\\(" + H + [Z, Z, Z].join(Kt) + H + "\\)$"
|
|
1467
|
-
), $e = new RegExp(
|
|
1468
|
-
"^rgba\\(" + H + [Z, Z, Z, B].join(Kt) + H + "\\)$"
|
|
1469
|
-
), Ye = new RegExp(
|
|
1470
|
-
"^hsla?\\(" + H + [Rt, wt, wt].join(ft) + at + "\\)$"
|
|
1471
|
-
), Ne = new RegExp(
|
|
1472
|
-
"^hsl?\\(" + H + [Rt, wt, wt].join(Kt) + H + "\\)$"
|
|
1473
|
-
), Ie = /^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/, Pe = new RegExp(
|
|
1474
|
-
"^lab\\(" + H + [B, B, B].join(ft) + at + "\\)$"
|
|
1475
|
-
), Ge = new RegExp(
|
|
1476
|
-
"^lch\\(" + H + [B, B, Rt].join(ft) + at + "\\)$"
|
|
1477
|
-
), Se = new RegExp(
|
|
1478
|
-
"^oklab\\(" + H + [B, B, B].join(ft) + at + "\\)$"
|
|
1479
|
-
), xe = new RegExp(
|
|
1480
|
-
"^oklch\\(" + H + [B, B, Rt].join(ft) + at + "\\)$"
|
|
1481
|
-
), { round: Ce } = Math, nt = (t) => t.map((e, n) => n <= 2 ? J(Ce(e), 0, 255) : e), S = (t, e = 0, n = 100, r = !1) => (typeof t == "string" && t.endsWith("%") && (t = parseFloat(t.substring(0, t.length - 1)) / 100, r ? t = e + (t + 1) * 0.5 * (n - e) : t = e + t * (n - e)), +t), T = (t, e) => t === "none" ? e : t, Xt = (t) => {
|
|
1482
|
-
if (t = t.toLowerCase().trim(), t === "transparent")
|
|
1483
|
-
return [0, 0, 0, 0];
|
|
1484
|
-
let e;
|
|
1485
|
-
if (y.format.named)
|
|
1486
|
-
try {
|
|
1487
|
-
return y.format.named(t);
|
|
1488
|
-
} catch {
|
|
1489
|
-
}
|
|
1490
|
-
if ((e = t.match(Ee)) || (e = t.match(Le))) {
|
|
1491
|
-
let n = e.slice(1, 4);
|
|
1492
|
-
for (let o = 0; o < 3; o++)
|
|
1493
|
-
n[o] = +S(T(n[o], 0), 0, 255);
|
|
1494
|
-
n = nt(n);
|
|
1495
|
-
const r = e[4] !== void 0 ? +S(e[4], 0, 1) : 1;
|
|
1496
|
-
return n[3] = r, n;
|
|
1497
|
-
}
|
|
1498
|
-
if (e = t.match($e)) {
|
|
1499
|
-
const n = e.slice(1, 5);
|
|
1500
|
-
for (let r = 0; r < 4; r++)
|
|
1501
|
-
n[r] = +S(n[r], 0, 255);
|
|
1502
|
-
return n;
|
|
1503
|
-
}
|
|
1504
|
-
if ((e = t.match(Ye)) || (e = t.match(Ne))) {
|
|
1505
|
-
const n = e.slice(1, 4);
|
|
1506
|
-
n[0] = +T(n[0].replace("deg", ""), 0), n[1] = +S(T(n[1], 0), 0, 100) * 0.01, n[2] = +S(T(n[2], 0), 0, 100) * 0.01;
|
|
1507
|
-
const r = nt(Ct(n)), o = e[4] !== void 0 ? +S(e[4], 0, 1) : 1;
|
|
1508
|
-
return r[3] = o, r;
|
|
1509
|
-
}
|
|
1510
|
-
if (e = t.match(Ie)) {
|
|
1511
|
-
const n = e.slice(1, 4);
|
|
1512
|
-
n[1] *= 0.01, n[2] *= 0.01;
|
|
1513
|
-
const r = Ct(n);
|
|
1514
|
-
for (let o = 0; o < 3; o++)
|
|
1515
|
-
r[o] = Ce(r[o]);
|
|
1516
|
-
return r[3] = +e[4], r;
|
|
1517
|
-
}
|
|
1518
|
-
if (e = t.match(Pe)) {
|
|
1519
|
-
const n = e.slice(1, 4);
|
|
1520
|
-
n[0] = S(T(n[0], 0), 0, 100), n[1] = S(T(n[1], 0), -125, 125, !0), n[2] = S(T(n[2], 0), -125, 125, !0);
|
|
1521
|
-
const r = it();
|
|
1522
|
-
q("d50");
|
|
1523
|
-
const o = nt(vt(n));
|
|
1524
|
-
q(r);
|
|
1525
|
-
const c = e[4] !== void 0 ? +S(e[4], 0, 1) : 1;
|
|
1526
|
-
return o[3] = c, o;
|
|
1527
|
-
}
|
|
1528
|
-
if (e = t.match(Ge)) {
|
|
1529
|
-
const n = e.slice(1, 4);
|
|
1530
|
-
n[0] = S(n[0], 0, 100), n[1] = S(T(n[1], 0), 0, 150, !1), n[2] = +T(n[2].replace("deg", ""), 0);
|
|
1531
|
-
const r = it();
|
|
1532
|
-
q("d50");
|
|
1533
|
-
const o = nt(Ht(n));
|
|
1534
|
-
q(r);
|
|
1535
|
-
const c = e[4] !== void 0 ? +S(e[4], 0, 1) : 1;
|
|
1536
|
-
return o[3] = c, o;
|
|
1537
|
-
}
|
|
1538
|
-
if (e = t.match(Se)) {
|
|
1539
|
-
const n = e.slice(1, 4);
|
|
1540
|
-
n[0] = S(T(n[0], 0), 0, 1), n[1] = S(T(n[1], 0), -0.4, 0.4, !0), n[2] = S(T(n[2], 0), -0.4, 0.4, !0);
|
|
1541
|
-
const r = nt(zt(n)), o = e[4] !== void 0 ? +S(e[4], 0, 1) : 1;
|
|
1542
|
-
return r[3] = o, r;
|
|
1543
|
-
}
|
|
1544
|
-
if (e = t.match(xe)) {
|
|
1545
|
-
const n = e.slice(1, 4);
|
|
1546
|
-
n[0] = S(T(n[0], 0), 0, 1), n[1] = S(T(n[1], 0), 0, 0.4, !1), n[2] = +T(n[2].replace("deg", ""), 0);
|
|
1547
|
-
const r = nt(Ae(n)), o = e[4] !== void 0 ? +S(e[4], 0, 1) : 1;
|
|
1548
|
-
return r[3] = o, r;
|
|
1549
|
-
}
|
|
1550
|
-
};
|
|
1551
|
-
Xt.test = (t) => (
|
|
1552
|
-
// modern
|
|
1553
|
-
Ee.test(t) || Ye.test(t) || Pe.test(t) || Ge.test(t) || Se.test(t) || xe.test(t) || // legacy
|
|
1554
|
-
Le.test(t) || $e.test(t) || Ne.test(t) || Ie.test(t) || t === "transparent"
|
|
1555
|
-
);
|
|
1556
|
-
i.prototype.css = function(t) {
|
|
1557
|
-
return O0(this._rgb, t);
|
|
1558
|
-
};
|
|
1559
|
-
const T0 = (...t) => new i(...t, "css");
|
|
1560
|
-
k.css = T0;
|
|
1561
|
-
y.format.css = Xt;
|
|
1562
|
-
y.autodetect.push({
|
|
1563
|
-
p: 5,
|
|
1564
|
-
test: (t, ...e) => {
|
|
1565
|
-
if (!e.length && E(t) === "string" && Xt.test(t))
|
|
1566
|
-
return "css";
|
|
1567
|
-
}
|
|
1568
|
-
});
|
|
1569
|
-
y.format.gl = (...t) => {
|
|
1570
|
-
const e = M(t, "rgba");
|
|
1571
|
-
return e[0] *= 255, e[1] *= 255, e[2] *= 255, e;
|
|
1572
|
-
};
|
|
1573
|
-
const v0 = (...t) => new i(...t, "gl");
|
|
1574
|
-
k.gl = v0;
|
|
1575
|
-
i.prototype.gl = function() {
|
|
1576
|
-
const t = this._rgb;
|
|
1577
|
-
return [t[0] / 255, t[1] / 255, t[2] / 255, t[3]];
|
|
1578
|
-
};
|
|
1579
|
-
i.prototype.hex = function(t) {
|
|
1580
|
-
return be(this._rgb, t);
|
|
1581
|
-
};
|
|
1582
|
-
const j0 = (...t) => new i(...t, "hex");
|
|
1583
|
-
k.hex = j0;
|
|
1584
|
-
y.format.hex = ue;
|
|
1585
|
-
y.autodetect.push({
|
|
1586
|
-
p: 4,
|
|
1587
|
-
test: (t, ...e) => {
|
|
1588
|
-
if (!e.length && E(t) === "string" && [3, 4, 5, 6, 7, 8, 9].indexOf(t.length) >= 0)
|
|
1589
|
-
return "hex";
|
|
1590
|
-
}
|
|
1591
|
-
});
|
|
1592
|
-
const { log: mt } = Math, De = (t) => {
|
|
1593
|
-
const e = t / 100;
|
|
1594
|
-
let n, r, o;
|
|
1595
|
-
return e < 66 ? (n = 255, r = e < 6 ? 0 : -155.25485562709179 - 0.44596950469579133 * (r = e - 2) + 104.49216199393888 * mt(r), o = e < 20 ? 0 : -254.76935184120902 + 0.8274096064007395 * (o = e - 10) + 115.67994401066147 * mt(o)) : (n = 351.97690566805693 + 0.114206453784165 * (n = e - 55) - 40.25366309332127 * mt(n), r = 325.4494125711974 + 0.07943456536662342 * (r = e - 50) - 28.0852963507957 * mt(r), o = 255), [n, r, o, 1];
|
|
1596
|
-
}, { round: H0 } = Math, B0 = (...t) => {
|
|
1597
|
-
const e = M(t, "rgb"), n = e[0], r = e[2];
|
|
1598
|
-
let o = 1e3, c = 4e4;
|
|
1599
|
-
const s = 0.4;
|
|
1600
|
-
let f;
|
|
1601
|
-
for (; c - o > s; ) {
|
|
1602
|
-
f = (c + o) * 0.5;
|
|
1603
|
-
const a = De(f);
|
|
1604
|
-
a[2] / a[0] >= r / n ? c = f : o = f;
|
|
1605
|
-
}
|
|
1606
|
-
return H0(f);
|
|
1607
|
-
};
|
|
1608
|
-
i.prototype.temp = i.prototype.kelvin = i.prototype.temperature = function() {
|
|
1609
|
-
return B0(this._rgb);
|
|
1610
|
-
};
|
|
1611
|
-
const St = (...t) => new i(...t, "temp");
|
|
1612
|
-
Object.assign(k, { temp: St, kelvin: St, temperature: St });
|
|
1613
|
-
y.format.temp = y.format.kelvin = y.format.temperature = De;
|
|
1614
|
-
i.prototype.oklch = function() {
|
|
1615
|
-
return Me(this._rgb);
|
|
1616
|
-
};
|
|
1617
|
-
const z0 = (...t) => new i(...t, "oklch");
|
|
1618
|
-
Object.assign(k, { oklch: z0 });
|
|
1619
|
-
y.format.oklch = Ae;
|
|
1620
|
-
y.autodetect.push({
|
|
1621
|
-
p: 2,
|
|
1622
|
-
test: (...t) => {
|
|
1623
|
-
if (t = M(t, "oklch"), E(t) === "array" && t.length === 3)
|
|
1624
|
-
return "oklch";
|
|
1625
|
-
}
|
|
1626
|
-
});
|
|
1627
|
-
Object.assign(k, {
|
|
1628
|
-
analyze: ye,
|
|
1629
|
-
average: Un,
|
|
1630
|
-
bezier: Wn,
|
|
1631
|
-
blend: z,
|
|
1632
|
-
brewer: Y0,
|
|
1633
|
-
Color: i,
|
|
1634
|
-
colors: rt,
|
|
1635
|
-
contrast: g0,
|
|
1636
|
-
contrastAPCA: y0,
|
|
1637
|
-
cubehelix: l0,
|
|
1638
|
-
deltaE: A0,
|
|
1639
|
-
distance: E0,
|
|
1640
|
-
input: y,
|
|
1641
|
-
interpolate: ot,
|
|
1642
|
-
limits: Re,
|
|
1643
|
-
mix: ot,
|
|
1644
|
-
random: h0,
|
|
1645
|
-
scale: _t,
|
|
1646
|
-
scales: $0,
|
|
1647
|
-
valid: L0
|
|
1648
|
-
});
|
|
1649
|
-
const V0 = {
|
|
1650
|
-
BRAND: {
|
|
1651
|
-
PRIMARY: Mt.PRIMARY,
|
|
1652
|
-
PRIMARY_LIGHT: Mt.PRIMARY_LIGHT,
|
|
1653
|
-
SECONDARY: Mt.SECONDARY
|
|
1654
|
-
},
|
|
1655
|
-
PRIMARY: {
|
|
1656
|
-
PRIMARY_SUPER_DARK: v.GRAY_SUPER_DARK,
|
|
1657
|
-
PRIMARY_DARK: v.GRAY_DARK,
|
|
1658
|
-
PRIMARY_MEDIUM: v.GRAY_MEDIUM,
|
|
1659
|
-
PRIMARY_MEDIUM_LIGHT: v.GRAY_MEDIUM_LIGHT,
|
|
1660
|
-
PRIMARY_LIGHT: v.GRAY_LIGHT,
|
|
1661
|
-
PRIMARY_LIGHTEST: v.GRAY_LIGHTEST,
|
|
1662
|
-
PRIMARY_SUPER_LIGHT: v.GRAY_SUPER_LIGHT
|
|
1663
|
-
},
|
|
1664
|
-
SECONDARY: {
|
|
1665
|
-
SECONDARY_SUPER_DARK: v.GRAY_SUPER_DARK,
|
|
1666
|
-
SECONDARY_DARK: v.GRAY_DARK,
|
|
1667
|
-
SECONDARY_MEDIUM: v.GRAY_MEDIUM,
|
|
1668
|
-
SECONDARY_MEDIUM_LIGHT: v.GRAY_MEDIUM_LIGHT,
|
|
1669
|
-
SECONDARY_LIGHT: v.GRAY_LIGHT,
|
|
1670
|
-
SECONDARY_LIGHTEST: v.GRAY_LIGHTEST,
|
|
1671
|
-
SECONDARY_SUPER_LIGHT: v.GRAY_SUPER_LIGHT
|
|
1672
|
-
}
|
|
1673
|
-
// Success, Warning & Danger palettes go here...
|
|
1674
|
-
}, Ot = (t, e) => e === void 0 ? `rgb(${t[0]}, ${t[1]}, ${t[2]})` : `rgba(${t[0]}, ${t[1]}, ${t[2]}, ${e})`, Q = ([t, e, n]) => t * 0.2126 + e * 0.7152 + n * 0.0722, U0 = (t) => t.map((e) => 255 - e), K0 = (t, e) => {
|
|
1675
|
-
const n = Q(t), r = Q(e);
|
|
1676
|
-
return (Math.max(n, r) + 0.05) / (Math.min(n, r) + 0.05);
|
|
1677
|
-
}, J0 = (t, e = 4.5) => {
|
|
1678
|
-
const n = U0(t);
|
|
1679
|
-
if (K0(t, n) >= e) return n;
|
|
1680
|
-
const o = Q(t), c = o < 128;
|
|
1681
|
-
if (c && o > 255 / e)
|
|
1682
|
-
return [255, 255, 255];
|
|
1683
|
-
const s = Q(n), f = (Math.min(o, s) + 0.05) * e - (Math.max(o, s) + 0.05);
|
|
1684
|
-
return c ? n.map(
|
|
1685
|
-
(a) => Math.min(255, Math.round(a + f))
|
|
1686
|
-
) : n.map(
|
|
1687
|
-
(a) => Math.max(0, Math.round(a - f))
|
|
1688
|
-
);
|
|
1689
|
-
}, Q0 = (t, e = !0) => {
|
|
1690
|
-
const n = k.scale(["#FFFFFF", t, "#000000"]).mode("hsv").colors(12).map(
|
|
1691
|
-
(c) => Ot(
|
|
1692
|
-
e ? X0(k(c).rgb()) : k(c).rgb()
|
|
1693
|
-
)
|
|
1694
|
-
), r = k(t).set("hsv.h", "+180").saturate(1).rgb(), o = k.scale(["#FFFFFF", r, "#000000"]).mode("hsv").colors(12).map((c) => Ot(k(c).rgb()));
|
|
1695
|
-
return {
|
|
1696
|
-
BRAND: {
|
|
1697
|
-
PRIMARY: n[5],
|
|
1698
|
-
PRIMARY_LIGHT: n[3],
|
|
1699
|
-
SECONDARY: o[4]
|
|
1700
|
-
},
|
|
1701
|
-
PRIMARY: {
|
|
1702
|
-
PRIMARY_SUPER_DARK: n[10],
|
|
1703
|
-
PRIMARY_DARK: n[9],
|
|
1704
|
-
PRIMARY_MEDIUM: n[7],
|
|
1705
|
-
PRIMARY_MEDIUM_LIGHT: n[6],
|
|
1706
|
-
PRIMARY_LIGHT: n[5],
|
|
1707
|
-
PRIMARY_LIGHTEST: n[4],
|
|
1708
|
-
PRIMARY_SUPER_LIGHT: n[3]
|
|
1709
|
-
},
|
|
1710
|
-
SECONDARY: {
|
|
1711
|
-
SECONDARY_SUPER_DARK: o[10],
|
|
1712
|
-
SECONDARY_DARK: o[9],
|
|
1713
|
-
SECONDARY_MEDIUM: o[7],
|
|
1714
|
-
SECONDARY_MEDIUM_LIGHT: o[6],
|
|
1715
|
-
SECONDARY_LIGHT: o[5],
|
|
1716
|
-
SECONDARY_LIGHTEST: o[4],
|
|
1717
|
-
SECONDARY_SUPER_LIGHT: o[3]
|
|
1718
|
-
}
|
|
1719
|
-
};
|
|
1720
|
-
}, X0 = (t) => {
|
|
1721
|
-
let e = k(Ot(t)), n = Q(t), r = 0;
|
|
1722
|
-
const o = 6;
|
|
1723
|
-
for (; n < 100 && r < o; )
|
|
1724
|
-
r++, e = e.brighten(0.5), n = Q(e.rgb());
|
|
1725
|
-
for (; n > 160 && r < o; )
|
|
1726
|
-
r++, e = e.darken(0.5), n = Q(e.rgb());
|
|
1727
|
-
return e.rgb();
|
|
1728
|
-
}, q0 = (t) => typeof t == "string" || t instanceof String;
|
|
1729
|
-
function tr(...t) {
|
|
1730
|
-
return t.filter(q0).join(" ");
|
|
1731
|
-
}
|
|
1732
|
-
const Z0 = (t) => {
|
|
1733
|
-
if (/^https?:\/\//.test(t)) {
|
|
1734
|
-
const e = document.createElement("a");
|
|
1735
|
-
return e.href = t, e.hostname;
|
|
1736
|
-
}
|
|
1737
|
-
return window.location.hostname;
|
|
1738
|
-
}, er = (t) => {
|
|
1739
|
-
const e = window.location.hostname, n = Z0(t);
|
|
1740
|
-
return e !== n;
|
|
1741
|
-
}, nr = (t, e) => {
|
|
1742
|
-
if (t.metaKey || t.altKey || t.ctrlKey || t.shiftKey || t.button && t.button !== 0)
|
|
1743
|
-
return;
|
|
1744
|
-
t.preventDefault();
|
|
1745
|
-
const n = e.startsWith("/") ? e : `/${e}`;
|
|
1746
|
-
window.history.pushState({}, "", n), window.dispatchEvent(new PopStateEvent("popstate"));
|
|
1747
|
-
};
|
|
1748
|
-
export {
|
|
1749
|
-
V0 as D,
|
|
1750
|
-
k as a,
|
|
1751
|
-
Ot as b,
|
|
1752
|
-
tr as c,
|
|
1753
|
-
J0 as d,
|
|
1754
|
-
Q0 as g,
|
|
1755
|
-
nr as h,
|
|
1756
|
-
er as i,
|
|
1757
|
-
Q as l
|
|
1758
|
-
};
|
|
1759
|
-
//# sourceMappingURL=index-C_MMhG34.mjs.map
|