@likec4/core 1.48.0 → 1.50.0
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/THIRD-PARTY-LICENSES.md +1034 -0
- package/dist/_chunks/Builder.view-element.mjs +2 -3284
- package/dist/_chunks/LikeC4Model.d.mts +21 -25
- package/dist/_chunks/_types.d.mts +1 -5
- package/dist/_chunks/_types2.d.mts +2 -4
- package/dist/_chunks/assignTagColors.mjs +1 -24
- package/dist/_chunks/geometry.mjs +1 -335
- package/dist/_chunks/index.d.mts +1995 -131
- package/dist/_chunks/index2.d.mts +153 -892
- package/dist/_chunks/index3.d.mts +15 -13
- package/dist/_chunks/index4.d.mts +229 -3
- package/dist/_chunks/index5.d.mts +392 -30
- package/dist/_chunks/libs/@mantine/colors-generator.mjs +2 -3403
- package/dist/_chunks/libs/@radix-ui/colors.mjs +1 -0
- package/dist/_chunks/libs/@ungap/structured-clone.mjs +1 -213
- package/dist/_chunks/libs/bail.mjs +1 -14
- package/dist/_chunks/libs/ccount.mjs +1 -25
- package/dist/_chunks/libs/character-entities-html4.mjs +1 -263
- package/dist/_chunks/libs/character-entities-legacy.mjs +1 -117
- package/dist/_chunks/libs/character-entities.mjs +2 -2136
- package/dist/_chunks/libs/comma-separated-tokens.mjs +1 -18
- package/dist/_chunks/libs/decode-named-character-reference.mjs +1 -21
- package/dist/_chunks/libs/defu.mjs +1 -42
- package/dist/_chunks/libs/devlop.mjs +1 -5
- package/dist/_chunks/libs/escape-string-regexp.mjs +1 -8
- package/dist/_chunks/libs/extend.mjs +1 -77
- package/dist/_chunks/libs/graphology-dag.mjs +1 -703
- package/dist/_chunks/libs/graphology.mjs +1 -4565
- package/dist/_chunks/libs/hast-util-sanitize.mjs +1 -863
- package/dist/_chunks/libs/hast-util-to-html.mjs +9 -2696
- package/dist/_chunks/libs/is-plain-obj.mjs +1 -9
- package/dist/_chunks/libs/longest-streak.mjs +1 -30
- package/dist/_chunks/libs/markdown-table.mjs +2 -290
- package/dist/_chunks/libs/mdast-util-find-and-replace.mjs +1 -653
- package/dist/_chunks/libs/mdast-util-from-markdown.mjs +3 -8522
- package/dist/_chunks/libs/mdast-util-gfm.mjs +15 -2393
- package/dist/_chunks/libs/mdast-util-to-hast.mjs +11 -1803
- package/dist/_chunks/libs/micromark-extension-gfm.mjs +1 -2243
- package/dist/_chunks/libs/mnemonist.d.mts +1 -91
- package/dist/_chunks/libs/mnemonist.mjs +1 -1978
- package/dist/_chunks/libs/natural-compare-lite.mjs +9 -42
- package/dist/_chunks/libs/ohash.mjs +1 -0
- package/dist/_chunks/libs/rehype-sanitize.mjs +1 -29
- package/dist/_chunks/libs/rehype-stringify.mjs +1 -34
- package/dist/_chunks/libs/remark-gfm.mjs +1 -36
- package/dist/_chunks/libs/remark-github-blockquote-alert.mjs +3 -100
- package/dist/_chunks/libs/remark-parse.mjs +1 -39
- package/dist/_chunks/libs/remark-rehype.mjs +1 -171
- package/dist/_chunks/libs/remeda.mjs +2 -702
- package/dist/_chunks/libs/trough.mjs +1 -158
- package/dist/_chunks/libs/unified.mjs +1 -2212
- package/dist/_chunks/manual-layout.mjs +1 -0
- package/dist/_chunks/model.mjs +4 -1898
- package/dist/_chunks/rolldown-runtime.mjs +1 -42
- package/dist/_chunks/types.mjs +1 -0
- package/dist/_chunks/utils.mjs +1 -483
- package/dist/builder/index.d.mts +3 -6
- package/dist/builder/index.mjs +1 -662
- package/dist/compute-view/index.d.mts +85 -13
- package/dist/compute-view/index.mjs +2 -262
- package/dist/geometry/index.d.mts +2 -2
- package/dist/geometry/index.mjs +1 -3
- package/dist/index.d.mts +7 -13
- package/dist/index.mjs +1 -27
- package/dist/model/index.d.mts +4 -11
- package/dist/model/index.mjs +1 -11
- package/dist/styles/index.d.mts +2 -7
- package/dist/styles/index.mjs +1 -30
- package/dist/types/index.d.mts +3 -9
- package/dist/types/index.mjs +1 -15
- package/dist/utils/graphology/index.d.mts +1 -1
- package/dist/utils/graphology/index.mjs +1 -3
- package/dist/utils/index.d.mts +5 -10
- package/dist/utils/index.mjs +1 -17
- package/package.json +14 -13
- package/dist/_chunks/LikeC4Styles.mjs +0 -691
- package/dist/_chunks/RichText.d.mts +0 -84
- package/dist/_chunks/RichText.mjs +0 -148
- package/dist/_chunks/_aux.d.mts +0 -289
- package/dist/_chunks/_aux.mjs +0 -18
- package/dist/_chunks/calcDriftsFromSnapshot.mjs +0 -379
- package/dist/_chunks/connection.mjs +0 -0
- package/dist/_chunks/const.d.mts +0 -43
- package/dist/_chunks/const.mjs +0 -33
- package/dist/_chunks/expression-model.d.mts +0 -192
- package/dist/_chunks/expression-model.mjs +0 -103
- package/dist/_chunks/expression.d.mts +0 -347
- package/dist/_chunks/expression.mjs +0 -107
- package/dist/_chunks/find.d.mts +0 -82
- package/dist/_chunks/find.mjs +0 -646
- package/dist/_chunks/find2.d.mts +0 -78
- package/dist/_chunks/find2.mjs +0 -287
- package/dist/_chunks/fqnRef.d.mts +0 -58
- package/dist/_chunks/fqnRef.mjs +0 -41
- package/dist/_chunks/index6.d.mts +0 -43
- package/dist/_chunks/index7.d.mts +0 -268
- package/dist/_chunks/index8.d.mts +0 -144
- package/dist/_chunks/invariant.mjs +0 -18
- package/dist/_chunks/iterable.mjs +0 -146
- package/dist/_chunks/libs/graphology-types.d.mts +0 -601
- package/dist/_chunks/libs/graphology.d.mts +0 -6
- package/dist/_chunks/mnemonist.mjs +0 -0
- package/dist/_chunks/model2.mjs +0 -0
- package/dist/_chunks/relationships-view.mjs +0 -132
- package/dist/_chunks/scalar.d.mts +0 -109
- package/dist/_chunks/scalar.mjs +0 -84
- package/dist/compute-view/relationships-view/index.d.mts +0 -16
- package/dist/compute-view/relationships-view/index.mjs +0 -7
- package/dist/model/connection/deployment/index.d.mts +0 -12
- package/dist/model/connection/deployment/index.mjs +0 -9
- package/dist/model/connection/index.d.mts +0 -14
- package/dist/model/connection/index.mjs +0 -10
- package/dist/model/connection/model/index.d.mts +0 -12
- package/dist/model/connection/model/index.mjs +0 -8
- package/dist/types/RichText.d.mts +0 -3
- package/dist/types/RichText.mjs +0 -7
- package/dist/types/_aux.d.mts +0 -3
- package/dist/types/_aux.mjs +0 -3
- package/dist/types/expression-model.d.mts +0 -6
- package/dist/types/expression-model.mjs +0 -7
- package/dist/types/expression.d.mts +0 -5
- package/dist/types/expression.mjs +0 -7
- package/dist/types/fqnRef.d.mts +0 -4
- package/dist/types/fqnRef.mjs +0 -7
- package/dist/types/scalar.d.mts +0 -2
- package/dist/types/scalar.mjs +0 -7
- package/dist/utils/iterable/index.d.mts +0 -9
- package/dist/utils/iterable/index.mjs +0 -3
- package/dist/utils/mnemonist.d.mts +0 -2
- package/dist/utils/mnemonist.mjs +0 -12
|
@@ -1,2284 +1,4 @@
|
|
|
1
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/utils/limit.js
|
|
2
|
-
const { min: min$4, max: max$4 } = Math;
|
|
3
|
-
var limit_default = (x, low = 0, high = 1) => {
|
|
4
|
-
return min$4(max$4(low, x), high);
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
//#endregion
|
|
8
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/utils/clip_rgb.js
|
|
9
|
-
var clip_rgb_default = (rgb) => {
|
|
10
|
-
rgb._clipped = false;
|
|
11
|
-
rgb._unclipped = rgb.slice(0);
|
|
12
|
-
for (let i = 0; i <= 3; i++) if (i < 3) {
|
|
13
|
-
if (rgb[i] < 0 || rgb[i] > 255) rgb._clipped = true;
|
|
14
|
-
rgb[i] = limit_default(rgb[i], 0, 255);
|
|
15
|
-
} else if (i === 3) rgb[i] = limit_default(rgb[i], 0, 1);
|
|
16
|
-
return rgb;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
//#endregion
|
|
20
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/utils/type.js
|
|
21
|
-
const classToType = {};
|
|
22
|
-
for (let name of [
|
|
23
|
-
"Boolean",
|
|
24
|
-
"Number",
|
|
25
|
-
"String",
|
|
26
|
-
"Function",
|
|
27
|
-
"Array",
|
|
28
|
-
"Date",
|
|
29
|
-
"RegExp",
|
|
30
|
-
"Undefined",
|
|
31
|
-
"Null"
|
|
32
|
-
]) classToType[`[object ${name}]`] = name.toLowerCase();
|
|
33
|
-
function type_default(obj) {
|
|
34
|
-
return classToType[Object.prototype.toString.call(obj)] || "object";
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
//#endregion
|
|
38
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/utils/unpack.js
|
|
39
|
-
var unpack_default = (args, keyOrder = null) => {
|
|
40
|
-
if (args.length >= 3) return Array.prototype.slice.call(args);
|
|
41
|
-
if (type_default(args[0]) == "object" && keyOrder) return keyOrder.split("").filter((k) => args[0][k] !== void 0).map((k) => args[0][k]);
|
|
42
|
-
return args[0].slice(0);
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
//#endregion
|
|
46
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/utils/last.js
|
|
47
|
-
var last_default = (args) => {
|
|
48
|
-
if (args.length < 2) return null;
|
|
49
|
-
const l = args.length - 1;
|
|
50
|
-
if (type_default(args[l]) == "string") return args[l].toLowerCase();
|
|
51
|
-
return null;
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
//#endregion
|
|
55
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/utils/index.js
|
|
56
|
-
const { PI: PI$2, min: min$3, max: max$3 } = Math;
|
|
57
|
-
const rnd2 = (a) => Math.round(a * 100) / 100;
|
|
58
|
-
const rnd3 = (a) => Math.round(a * 100) / 100;
|
|
59
|
-
const TWOPI = PI$2 * 2;
|
|
60
|
-
const PITHIRD = PI$2 / 3;
|
|
61
|
-
const DEG2RAD = PI$2 / 180;
|
|
62
|
-
const RAD2DEG = 180 / PI$2;
|
|
63
|
-
/**
|
|
64
|
-
* Reverse the first three elements of an array
|
|
65
|
-
*
|
|
66
|
-
* @param {any[]} arr
|
|
67
|
-
* @returns {any[]}
|
|
68
|
-
*/
|
|
69
|
-
function reverse3(arr) {
|
|
70
|
-
return [...arr.slice(0, 3).reverse(), ...arr.slice(3)];
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
//#endregion
|
|
74
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/io/input.js
|
|
75
|
-
var input_default = {
|
|
76
|
-
format: {},
|
|
77
|
-
autodetect: []
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
//#endregion
|
|
81
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/Color.js
|
|
82
|
-
var Color = class {
|
|
83
|
-
constructor(...args) {
|
|
84
|
-
const me = this;
|
|
85
|
-
if (type_default(args[0]) === "object" && args[0].constructor && args[0].constructor === this.constructor) return args[0];
|
|
86
|
-
let mode = last_default(args);
|
|
87
|
-
let autodetect = false;
|
|
88
|
-
if (!mode) {
|
|
89
|
-
autodetect = true;
|
|
90
|
-
if (!input_default.sorted) {
|
|
91
|
-
input_default.autodetect = input_default.autodetect.sort((a, b) => b.p - a.p);
|
|
92
|
-
input_default.sorted = true;
|
|
93
|
-
}
|
|
94
|
-
for (let chk of input_default.autodetect) {
|
|
95
|
-
mode = chk.test(...args);
|
|
96
|
-
if (mode) break;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
if (input_default.format[mode]) me._rgb = clip_rgb_default(input_default.format[mode].apply(null, autodetect ? args : args.slice(0, -1)));
|
|
100
|
-
else throw new Error("unknown format: " + args);
|
|
101
|
-
if (me._rgb.length === 3) me._rgb.push(1);
|
|
102
|
-
}
|
|
103
|
-
toString() {
|
|
104
|
-
if (type_default(this.hex) == "function") return this.hex();
|
|
105
|
-
return `[${this._rgb.join(",")}]`;
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
var Color_default = Color;
|
|
109
|
-
|
|
110
|
-
//#endregion
|
|
111
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/version.js
|
|
112
|
-
const version = "3.2.0";
|
|
113
|
-
|
|
114
|
-
//#endregion
|
|
115
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/chroma.js
|
|
116
|
-
const chroma = (...args) => {
|
|
117
|
-
return new Color_default(...args);
|
|
118
|
-
};
|
|
119
|
-
chroma.version = version;
|
|
120
|
-
var chroma_default = chroma;
|
|
121
|
-
|
|
122
|
-
//#endregion
|
|
123
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/colors/w3cx11.js
|
|
124
|
-
/**
|
|
125
|
-
X11 color names
|
|
126
|
-
|
|
127
|
-
http://www.w3.org/TR/css3-color/#svg-color
|
|
128
|
-
*/
|
|
129
|
-
const w3cx11 = {
|
|
130
|
-
aliceblue: "#f0f8ff",
|
|
131
|
-
antiquewhite: "#faebd7",
|
|
132
|
-
aqua: "#00ffff",
|
|
133
|
-
aquamarine: "#7fffd4",
|
|
134
|
-
azure: "#f0ffff",
|
|
135
|
-
beige: "#f5f5dc",
|
|
136
|
-
bisque: "#ffe4c4",
|
|
137
|
-
black: "#000000",
|
|
138
|
-
blanchedalmond: "#ffebcd",
|
|
139
|
-
blue: "#0000ff",
|
|
140
|
-
blueviolet: "#8a2be2",
|
|
141
|
-
brown: "#a52a2a",
|
|
142
|
-
burlywood: "#deb887",
|
|
143
|
-
cadetblue: "#5f9ea0",
|
|
144
|
-
chartreuse: "#7fff00",
|
|
145
|
-
chocolate: "#d2691e",
|
|
146
|
-
coral: "#ff7f50",
|
|
147
|
-
cornflowerblue: "#6495ed",
|
|
148
|
-
cornsilk: "#fff8dc",
|
|
149
|
-
crimson: "#dc143c",
|
|
150
|
-
cyan: "#00ffff",
|
|
151
|
-
darkblue: "#00008b",
|
|
152
|
-
darkcyan: "#008b8b",
|
|
153
|
-
darkgoldenrod: "#b8860b",
|
|
154
|
-
darkgray: "#a9a9a9",
|
|
155
|
-
darkgreen: "#006400",
|
|
156
|
-
darkgrey: "#a9a9a9",
|
|
157
|
-
darkkhaki: "#bdb76b",
|
|
158
|
-
darkmagenta: "#8b008b",
|
|
159
|
-
darkolivegreen: "#556b2f",
|
|
160
|
-
darkorange: "#ff8c00",
|
|
161
|
-
darkorchid: "#9932cc",
|
|
162
|
-
darkred: "#8b0000",
|
|
163
|
-
darksalmon: "#e9967a",
|
|
164
|
-
darkseagreen: "#8fbc8f",
|
|
165
|
-
darkslateblue: "#483d8b",
|
|
166
|
-
darkslategray: "#2f4f4f",
|
|
167
|
-
darkslategrey: "#2f4f4f",
|
|
168
|
-
darkturquoise: "#00ced1",
|
|
169
|
-
darkviolet: "#9400d3",
|
|
170
|
-
deeppink: "#ff1493",
|
|
171
|
-
deepskyblue: "#00bfff",
|
|
172
|
-
dimgray: "#696969",
|
|
173
|
-
dimgrey: "#696969",
|
|
174
|
-
dodgerblue: "#1e90ff",
|
|
175
|
-
firebrick: "#b22222",
|
|
176
|
-
floralwhite: "#fffaf0",
|
|
177
|
-
forestgreen: "#228b22",
|
|
178
|
-
fuchsia: "#ff00ff",
|
|
179
|
-
gainsboro: "#dcdcdc",
|
|
180
|
-
ghostwhite: "#f8f8ff",
|
|
181
|
-
gold: "#ffd700",
|
|
182
|
-
goldenrod: "#daa520",
|
|
183
|
-
gray: "#808080",
|
|
184
|
-
green: "#008000",
|
|
185
|
-
greenyellow: "#adff2f",
|
|
186
|
-
grey: "#808080",
|
|
187
|
-
honeydew: "#f0fff0",
|
|
188
|
-
hotpink: "#ff69b4",
|
|
189
|
-
indianred: "#cd5c5c",
|
|
190
|
-
indigo: "#4b0082",
|
|
191
|
-
ivory: "#fffff0",
|
|
192
|
-
khaki: "#f0e68c",
|
|
193
|
-
laserlemon: "#ffff54",
|
|
194
|
-
lavender: "#e6e6fa",
|
|
195
|
-
lavenderblush: "#fff0f5",
|
|
196
|
-
lawngreen: "#7cfc00",
|
|
197
|
-
lemonchiffon: "#fffacd",
|
|
198
|
-
lightblue: "#add8e6",
|
|
199
|
-
lightcoral: "#f08080",
|
|
200
|
-
lightcyan: "#e0ffff",
|
|
201
|
-
lightgoldenrod: "#fafad2",
|
|
202
|
-
lightgoldenrodyellow: "#fafad2",
|
|
203
|
-
lightgray: "#d3d3d3",
|
|
204
|
-
lightgreen: "#90ee90",
|
|
205
|
-
lightgrey: "#d3d3d3",
|
|
206
|
-
lightpink: "#ffb6c1",
|
|
207
|
-
lightsalmon: "#ffa07a",
|
|
208
|
-
lightseagreen: "#20b2aa",
|
|
209
|
-
lightskyblue: "#87cefa",
|
|
210
|
-
lightslategray: "#778899",
|
|
211
|
-
lightslategrey: "#778899",
|
|
212
|
-
lightsteelblue: "#b0c4de",
|
|
213
|
-
lightyellow: "#ffffe0",
|
|
214
|
-
lime: "#00ff00",
|
|
215
|
-
limegreen: "#32cd32",
|
|
216
|
-
linen: "#faf0e6",
|
|
217
|
-
magenta: "#ff00ff",
|
|
218
|
-
maroon: "#800000",
|
|
219
|
-
maroon2: "#7f0000",
|
|
220
|
-
maroon3: "#b03060",
|
|
221
|
-
mediumaquamarine: "#66cdaa",
|
|
222
|
-
mediumblue: "#0000cd",
|
|
223
|
-
mediumorchid: "#ba55d3",
|
|
224
|
-
mediumpurple: "#9370db",
|
|
225
|
-
mediumseagreen: "#3cb371",
|
|
226
|
-
mediumslateblue: "#7b68ee",
|
|
227
|
-
mediumspringgreen: "#00fa9a",
|
|
228
|
-
mediumturquoise: "#48d1cc",
|
|
229
|
-
mediumvioletred: "#c71585",
|
|
230
|
-
midnightblue: "#191970",
|
|
231
|
-
mintcream: "#f5fffa",
|
|
232
|
-
mistyrose: "#ffe4e1",
|
|
233
|
-
moccasin: "#ffe4b5",
|
|
234
|
-
navajowhite: "#ffdead",
|
|
235
|
-
navy: "#000080",
|
|
236
|
-
oldlace: "#fdf5e6",
|
|
237
|
-
olive: "#808000",
|
|
238
|
-
olivedrab: "#6b8e23",
|
|
239
|
-
orange: "#ffa500",
|
|
240
|
-
orangered: "#ff4500",
|
|
241
|
-
orchid: "#da70d6",
|
|
242
|
-
palegoldenrod: "#eee8aa",
|
|
243
|
-
palegreen: "#98fb98",
|
|
244
|
-
paleturquoise: "#afeeee",
|
|
245
|
-
palevioletred: "#db7093",
|
|
246
|
-
papayawhip: "#ffefd5",
|
|
247
|
-
peachpuff: "#ffdab9",
|
|
248
|
-
peru: "#cd853f",
|
|
249
|
-
pink: "#ffc0cb",
|
|
250
|
-
plum: "#dda0dd",
|
|
251
|
-
powderblue: "#b0e0e6",
|
|
252
|
-
purple: "#800080",
|
|
253
|
-
purple2: "#7f007f",
|
|
254
|
-
purple3: "#a020f0",
|
|
255
|
-
rebeccapurple: "#663399",
|
|
256
|
-
red: "#ff0000",
|
|
257
|
-
rosybrown: "#bc8f8f",
|
|
258
|
-
royalblue: "#4169e1",
|
|
259
|
-
saddlebrown: "#8b4513",
|
|
260
|
-
salmon: "#fa8072",
|
|
261
|
-
sandybrown: "#f4a460",
|
|
262
|
-
seagreen: "#2e8b57",
|
|
263
|
-
seashell: "#fff5ee",
|
|
264
|
-
sienna: "#a0522d",
|
|
265
|
-
silver: "#c0c0c0",
|
|
266
|
-
skyblue: "#87ceeb",
|
|
267
|
-
slateblue: "#6a5acd",
|
|
268
|
-
slategray: "#708090",
|
|
269
|
-
slategrey: "#708090",
|
|
270
|
-
snow: "#fffafa",
|
|
271
|
-
springgreen: "#00ff7f",
|
|
272
|
-
steelblue: "#4682b4",
|
|
273
|
-
tan: "#d2b48c",
|
|
274
|
-
teal: "#008080",
|
|
275
|
-
thistle: "#d8bfd8",
|
|
276
|
-
tomato: "#ff6347",
|
|
277
|
-
turquoise: "#40e0d0",
|
|
278
|
-
violet: "#ee82ee",
|
|
279
|
-
wheat: "#f5deb3",
|
|
280
|
-
white: "#ffffff",
|
|
281
|
-
whitesmoke: "#f5f5f5",
|
|
282
|
-
yellow: "#ffff00",
|
|
283
|
-
yellowgreen: "#9acd32"
|
|
284
|
-
};
|
|
285
|
-
var w3cx11_default = w3cx11;
|
|
286
|
-
|
|
287
|
-
//#endregion
|
|
288
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/io/hex/hex2rgb.js
|
|
289
|
-
const RE_HEX = /^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;
|
|
290
|
-
const RE_HEXA = /^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/;
|
|
291
|
-
const hex2rgb = (hex) => {
|
|
292
|
-
if (hex.match(RE_HEX)) {
|
|
293
|
-
if (hex.length === 4 || hex.length === 7) hex = hex.substr(1);
|
|
294
|
-
if (hex.length === 3) {
|
|
295
|
-
hex = hex.split("");
|
|
296
|
-
hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
|
|
297
|
-
}
|
|
298
|
-
const u = parseInt(hex, 16);
|
|
299
|
-
return [
|
|
300
|
-
u >> 16,
|
|
301
|
-
u >> 8 & 255,
|
|
302
|
-
u & 255,
|
|
303
|
-
1
|
|
304
|
-
];
|
|
305
|
-
}
|
|
306
|
-
if (hex.match(RE_HEXA)) {
|
|
307
|
-
if (hex.length === 5 || hex.length === 9) hex = hex.substr(1);
|
|
308
|
-
if (hex.length === 4) {
|
|
309
|
-
hex = hex.split("");
|
|
310
|
-
hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2] + hex[3] + hex[3];
|
|
311
|
-
}
|
|
312
|
-
const u = parseInt(hex, 16);
|
|
313
|
-
return [
|
|
314
|
-
u >> 24 & 255,
|
|
315
|
-
u >> 16 & 255,
|
|
316
|
-
u >> 8 & 255,
|
|
317
|
-
Math.round((u & 255) / 255 * 100) / 100
|
|
318
|
-
];
|
|
319
|
-
}
|
|
320
|
-
throw new Error(`unknown hex color: ${hex}`);
|
|
321
|
-
};
|
|
322
|
-
var hex2rgb_default = hex2rgb;
|
|
323
|
-
|
|
324
|
-
//#endregion
|
|
325
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/io/hex/rgb2hex.js
|
|
326
|
-
const { round: round$5 } = Math;
|
|
327
|
-
const rgb2hex = (...args) => {
|
|
328
|
-
let [r, g, b, a] = unpack_default(args, "rgba");
|
|
329
|
-
let mode = last_default(args) || "auto";
|
|
330
|
-
if (a === void 0) a = 1;
|
|
331
|
-
if (mode === "auto") mode = a < 1 ? "rgba" : "rgb";
|
|
332
|
-
r = round$5(r);
|
|
333
|
-
g = round$5(g);
|
|
334
|
-
b = round$5(b);
|
|
335
|
-
let str = "000000" + (r << 16 | g << 8 | b).toString(16);
|
|
336
|
-
str = str.substr(str.length - 6);
|
|
337
|
-
let hxa = "0" + round$5(a * 255).toString(16);
|
|
338
|
-
hxa = hxa.substr(hxa.length - 2);
|
|
339
|
-
switch (mode.toLowerCase()) {
|
|
340
|
-
case "rgba": return `#${str}${hxa}`;
|
|
341
|
-
case "argb": return `#${hxa}${str}`;
|
|
342
|
-
default: return `#${str}`;
|
|
343
|
-
}
|
|
344
|
-
};
|
|
345
|
-
var rgb2hex_default = rgb2hex;
|
|
346
|
-
|
|
347
|
-
//#endregion
|
|
348
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/io/named/index.js
|
|
349
|
-
Color_default.prototype.name = function() {
|
|
350
|
-
const hex = rgb2hex_default(this._rgb, "rgb");
|
|
351
|
-
for (let n of Object.keys(w3cx11_default)) if (w3cx11_default[n] === hex) return n.toLowerCase();
|
|
352
|
-
return hex;
|
|
353
|
-
};
|
|
354
|
-
input_default.format.named = (name) => {
|
|
355
|
-
name = name.toLowerCase();
|
|
356
|
-
if (w3cx11_default[name]) return hex2rgb_default(w3cx11_default[name]);
|
|
357
|
-
throw new Error("unknown color name: " + name);
|
|
358
|
-
};
|
|
359
|
-
input_default.autodetect.push({
|
|
360
|
-
p: 5,
|
|
361
|
-
test: (h, ...rest) => {
|
|
362
|
-
if (!rest.length && type_default(h) === "string" && w3cx11_default[h.toLowerCase()]) return "named";
|
|
363
|
-
}
|
|
364
|
-
});
|
|
365
|
-
|
|
366
|
-
//#endregion
|
|
367
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/ops/alpha.js
|
|
368
|
-
Color_default.prototype.alpha = function(a, mutate = false) {
|
|
369
|
-
if (a !== void 0 && type_default(a) === "number") {
|
|
370
|
-
if (mutate) {
|
|
371
|
-
this._rgb[3] = a;
|
|
372
|
-
return this;
|
|
373
|
-
}
|
|
374
|
-
return new Color_default([
|
|
375
|
-
this._rgb[0],
|
|
376
|
-
this._rgb[1],
|
|
377
|
-
this._rgb[2],
|
|
378
|
-
a
|
|
379
|
-
], "rgb");
|
|
380
|
-
}
|
|
381
|
-
return this._rgb[3];
|
|
382
|
-
};
|
|
383
|
-
|
|
384
|
-
//#endregion
|
|
385
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/ops/clipped.js
|
|
386
|
-
Color_default.prototype.clipped = function() {
|
|
387
|
-
return this._rgb._clipped || false;
|
|
388
|
-
};
|
|
389
|
-
|
|
390
|
-
//#endregion
|
|
391
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/io/lab/lab-constants.js
|
|
392
|
-
const labConstants = {
|
|
393
|
-
Kn: 18,
|
|
394
|
-
labWhitePoint: "d65",
|
|
395
|
-
Xn: .95047,
|
|
396
|
-
Yn: 1,
|
|
397
|
-
Zn: 1.08883,
|
|
398
|
-
t0: .137931034,
|
|
399
|
-
t1: .206896552,
|
|
400
|
-
t2: .12841855,
|
|
401
|
-
t3: .008856452,
|
|
402
|
-
kE: 216 / 24389,
|
|
403
|
-
kKE: 8,
|
|
404
|
-
kK: 24389 / 27,
|
|
405
|
-
RefWhiteRGB: {
|
|
406
|
-
X: .95047,
|
|
407
|
-
Y: 1,
|
|
408
|
-
Z: 1.08883
|
|
409
|
-
},
|
|
410
|
-
MtxRGB2XYZ: {
|
|
411
|
-
m00: .4124564390896922,
|
|
412
|
-
m01: .21267285140562253,
|
|
413
|
-
m02: .0193338955823293,
|
|
414
|
-
m10: .357576077643909,
|
|
415
|
-
m11: .715152155287818,
|
|
416
|
-
m12: .11919202588130297,
|
|
417
|
-
m20: .18043748326639894,
|
|
418
|
-
m21: .07217499330655958,
|
|
419
|
-
m22: .9503040785363679
|
|
420
|
-
},
|
|
421
|
-
MtxXYZ2RGB: {
|
|
422
|
-
m00: 3.2404541621141045,
|
|
423
|
-
m01: -.9692660305051868,
|
|
424
|
-
m02: .055643430959114726,
|
|
425
|
-
m10: -1.5371385127977166,
|
|
426
|
-
m11: 1.8760108454466942,
|
|
427
|
-
m12: -.2040259135167538,
|
|
428
|
-
m20: -.498531409556016,
|
|
429
|
-
m21: .041556017530349834,
|
|
430
|
-
m22: 1.0572251882231791
|
|
431
|
-
},
|
|
432
|
-
As: .9414285350000001,
|
|
433
|
-
Bs: 1.040417467,
|
|
434
|
-
Cs: 1.089532651,
|
|
435
|
-
MtxAdaptMa: {
|
|
436
|
-
m00: .8951,
|
|
437
|
-
m01: -.7502,
|
|
438
|
-
m02: .0389,
|
|
439
|
-
m10: .2664,
|
|
440
|
-
m11: 1.7135,
|
|
441
|
-
m12: -.0685,
|
|
442
|
-
m20: -.1614,
|
|
443
|
-
m21: .0367,
|
|
444
|
-
m22: 1.0296
|
|
445
|
-
},
|
|
446
|
-
MtxAdaptMaI: {
|
|
447
|
-
m00: .9869929054667123,
|
|
448
|
-
m01: .43230526972339456,
|
|
449
|
-
m02: -.008528664575177328,
|
|
450
|
-
m10: -.14705425642099013,
|
|
451
|
-
m11: .5183602715367776,
|
|
452
|
-
m12: .04004282165408487,
|
|
453
|
-
m20: .15996265166373125,
|
|
454
|
-
m21: .0492912282128556,
|
|
455
|
-
m22: .9684866957875502
|
|
456
|
-
}
|
|
457
|
-
};
|
|
458
|
-
var lab_constants_default = labConstants;
|
|
459
|
-
const ILLUMINANTS = new Map([
|
|
460
|
-
["a", [1.0985, .35585]],
|
|
461
|
-
["b", [1.0985, .35585]],
|
|
462
|
-
["c", [.98074, 1.18232]],
|
|
463
|
-
["d50", [.96422, .82521]],
|
|
464
|
-
["d55", [.95682, .92149]],
|
|
465
|
-
["d65", [.95047, 1.08883]],
|
|
466
|
-
["e", [
|
|
467
|
-
1,
|
|
468
|
-
1,
|
|
469
|
-
1
|
|
470
|
-
]],
|
|
471
|
-
["f2", [.99186, .67393]],
|
|
472
|
-
["f7", [.95041, 1.08747]],
|
|
473
|
-
["f11", [1.00962, .6435]],
|
|
474
|
-
["icc", [.96422, .82521]]
|
|
475
|
-
]);
|
|
476
|
-
function setLabWhitePoint(name) {
|
|
477
|
-
const ill = ILLUMINANTS.get(String(name).toLowerCase());
|
|
478
|
-
if (!ill) throw new Error("unknown Lab illuminant " + name);
|
|
479
|
-
labConstants.labWhitePoint = name;
|
|
480
|
-
labConstants.Xn = ill[0];
|
|
481
|
-
labConstants.Zn = ill[1];
|
|
482
|
-
}
|
|
483
|
-
function getLabWhitePoint() {
|
|
484
|
-
return labConstants.labWhitePoint;
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
//#endregion
|
|
488
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/io/lab/lab2rgb.js
|
|
489
|
-
const lab2rgb = (...args) => {
|
|
490
|
-
args = unpack_default(args, "lab");
|
|
491
|
-
const [L, a, b] = args;
|
|
492
|
-
const [x, y, z] = lab2xyz(L, a, b);
|
|
493
|
-
const [r, g, b_] = xyz2rgb(x, y, z);
|
|
494
|
-
return [
|
|
495
|
-
r,
|
|
496
|
-
g,
|
|
497
|
-
b_,
|
|
498
|
-
args.length > 3 ? args[3] : 1
|
|
499
|
-
];
|
|
500
|
-
};
|
|
501
|
-
const lab2xyz = (L, a, b) => {
|
|
502
|
-
const { kE, kK, kKE, Xn, Yn, Zn } = lab_constants_default;
|
|
503
|
-
const fy = (L + 16) / 116;
|
|
504
|
-
const fx = .002 * a + fy;
|
|
505
|
-
const fz = fy - .005 * b;
|
|
506
|
-
const fx3 = fx * fx * fx;
|
|
507
|
-
const fz3 = fz * fz * fz;
|
|
508
|
-
const xr = fx3 > kE ? fx3 : (116 * fx - 16) / kK;
|
|
509
|
-
const yr = L > kKE ? Math.pow((L + 16) / 116, 3) : L / kK;
|
|
510
|
-
const zr = fz3 > kE ? fz3 : (116 * fz - 16) / kK;
|
|
511
|
-
return [
|
|
512
|
-
xr * Xn,
|
|
513
|
-
yr * Yn,
|
|
514
|
-
zr * Zn
|
|
515
|
-
];
|
|
516
|
-
};
|
|
517
|
-
const compand = (linear) => {
|
|
518
|
-
const sign = Math.sign(linear);
|
|
519
|
-
linear = Math.abs(linear);
|
|
520
|
-
return (linear <= .0031308 ? linear * 12.92 : 1.055 * Math.pow(linear, 1 / 2.4) - .055) * sign;
|
|
521
|
-
};
|
|
522
|
-
const xyz2rgb = (x, y, z) => {
|
|
523
|
-
const { MtxAdaptMa, MtxAdaptMaI, MtxXYZ2RGB, RefWhiteRGB, Xn, Yn, Zn } = lab_constants_default;
|
|
524
|
-
const As = Xn * MtxAdaptMa.m00 + Yn * MtxAdaptMa.m10 + Zn * MtxAdaptMa.m20;
|
|
525
|
-
const Bs = Xn * MtxAdaptMa.m01 + Yn * MtxAdaptMa.m11 + Zn * MtxAdaptMa.m21;
|
|
526
|
-
const Cs = Xn * MtxAdaptMa.m02 + Yn * MtxAdaptMa.m12 + Zn * MtxAdaptMa.m22;
|
|
527
|
-
const Ad = RefWhiteRGB.X * MtxAdaptMa.m00 + RefWhiteRGB.Y * MtxAdaptMa.m10 + RefWhiteRGB.Z * MtxAdaptMa.m20;
|
|
528
|
-
const Bd = RefWhiteRGB.X * MtxAdaptMa.m01 + RefWhiteRGB.Y * MtxAdaptMa.m11 + RefWhiteRGB.Z * MtxAdaptMa.m21;
|
|
529
|
-
const Cd = RefWhiteRGB.X * MtxAdaptMa.m02 + RefWhiteRGB.Y * MtxAdaptMa.m12 + RefWhiteRGB.Z * MtxAdaptMa.m22;
|
|
530
|
-
const X1 = (x * MtxAdaptMa.m00 + y * MtxAdaptMa.m10 + z * MtxAdaptMa.m20) * (Ad / As);
|
|
531
|
-
const Y1 = (x * MtxAdaptMa.m01 + y * MtxAdaptMa.m11 + z * MtxAdaptMa.m21) * (Bd / Bs);
|
|
532
|
-
const Z1 = (x * MtxAdaptMa.m02 + y * MtxAdaptMa.m12 + z * MtxAdaptMa.m22) * (Cd / Cs);
|
|
533
|
-
const X2 = X1 * MtxAdaptMaI.m00 + Y1 * MtxAdaptMaI.m10 + Z1 * MtxAdaptMaI.m20;
|
|
534
|
-
const Y2 = X1 * MtxAdaptMaI.m01 + Y1 * MtxAdaptMaI.m11 + Z1 * MtxAdaptMaI.m21;
|
|
535
|
-
const Z2 = X1 * MtxAdaptMaI.m02 + Y1 * MtxAdaptMaI.m12 + Z1 * MtxAdaptMaI.m22;
|
|
536
|
-
const r = compand(X2 * MtxXYZ2RGB.m00 + Y2 * MtxXYZ2RGB.m10 + Z2 * MtxXYZ2RGB.m20);
|
|
537
|
-
const g = compand(X2 * MtxXYZ2RGB.m01 + Y2 * MtxXYZ2RGB.m11 + Z2 * MtxXYZ2RGB.m21);
|
|
538
|
-
const b = compand(X2 * MtxXYZ2RGB.m02 + Y2 * MtxXYZ2RGB.m12 + Z2 * MtxXYZ2RGB.m22);
|
|
539
|
-
return [
|
|
540
|
-
r * 255,
|
|
541
|
-
g * 255,
|
|
542
|
-
b * 255
|
|
543
|
-
];
|
|
544
|
-
};
|
|
545
|
-
var lab2rgb_default = lab2rgb;
|
|
546
|
-
|
|
547
|
-
//#endregion
|
|
548
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/io/lab/rgb2lab.js
|
|
549
|
-
const rgb2lab = (...args) => {
|
|
550
|
-
const [r, g, b, ...rest] = unpack_default(args, "rgb");
|
|
551
|
-
const [x, y, z] = rgb2xyz(r, g, b);
|
|
552
|
-
const [L, a, b_] = xyz2lab(x, y, z);
|
|
553
|
-
return [
|
|
554
|
-
L,
|
|
555
|
-
a,
|
|
556
|
-
b_,
|
|
557
|
-
...rest.length > 0 && rest[0] < 1 ? [rest[0]] : []
|
|
558
|
-
];
|
|
559
|
-
};
|
|
560
|
-
function xyz2lab(x, y, z) {
|
|
561
|
-
const { Xn, Yn, Zn, kE, kK } = lab_constants_default;
|
|
562
|
-
const xr = x / Xn;
|
|
563
|
-
const yr = y / Yn;
|
|
564
|
-
const zr = z / Zn;
|
|
565
|
-
const fx = xr > kE ? Math.pow(xr, 1 / 3) : (kK * xr + 16) / 116;
|
|
566
|
-
const fy = yr > kE ? Math.pow(yr, 1 / 3) : (kK * yr + 16) / 116;
|
|
567
|
-
const fz = zr > kE ? Math.pow(zr, 1 / 3) : (kK * zr + 16) / 116;
|
|
568
|
-
return [
|
|
569
|
-
116 * fy - 16,
|
|
570
|
-
500 * (fx - fy),
|
|
571
|
-
200 * (fy - fz)
|
|
572
|
-
];
|
|
573
|
-
}
|
|
574
|
-
function gammaAdjustSRGB(companded) {
|
|
575
|
-
const sign = Math.sign(companded);
|
|
576
|
-
companded = Math.abs(companded);
|
|
577
|
-
return (companded <= .04045 ? companded / 12.92 : Math.pow((companded + .055) / 1.055, 2.4)) * sign;
|
|
578
|
-
}
|
|
579
|
-
const rgb2xyz = (r, g, b) => {
|
|
580
|
-
r = gammaAdjustSRGB(r / 255);
|
|
581
|
-
g = gammaAdjustSRGB(g / 255);
|
|
582
|
-
b = gammaAdjustSRGB(b / 255);
|
|
583
|
-
const { MtxRGB2XYZ, MtxAdaptMa, MtxAdaptMaI, Xn, Yn, Zn, As, Bs, Cs } = lab_constants_default;
|
|
584
|
-
let x = r * MtxRGB2XYZ.m00 + g * MtxRGB2XYZ.m10 + b * MtxRGB2XYZ.m20;
|
|
585
|
-
let y = r * MtxRGB2XYZ.m01 + g * MtxRGB2XYZ.m11 + b * MtxRGB2XYZ.m21;
|
|
586
|
-
let z = r * MtxRGB2XYZ.m02 + g * MtxRGB2XYZ.m12 + b * MtxRGB2XYZ.m22;
|
|
587
|
-
const Ad = Xn * MtxAdaptMa.m00 + Yn * MtxAdaptMa.m10 + Zn * MtxAdaptMa.m20;
|
|
588
|
-
const Bd = Xn * MtxAdaptMa.m01 + Yn * MtxAdaptMa.m11 + Zn * MtxAdaptMa.m21;
|
|
589
|
-
const Cd = Xn * MtxAdaptMa.m02 + Yn * MtxAdaptMa.m12 + Zn * MtxAdaptMa.m22;
|
|
590
|
-
let X = x * MtxAdaptMa.m00 + y * MtxAdaptMa.m10 + z * MtxAdaptMa.m20;
|
|
591
|
-
let Y = x * MtxAdaptMa.m01 + y * MtxAdaptMa.m11 + z * MtxAdaptMa.m21;
|
|
592
|
-
let Z = x * MtxAdaptMa.m02 + y * MtxAdaptMa.m12 + z * MtxAdaptMa.m22;
|
|
593
|
-
X *= Ad / As;
|
|
594
|
-
Y *= Bd / Bs;
|
|
595
|
-
Z *= Cd / Cs;
|
|
596
|
-
x = X * MtxAdaptMaI.m00 + Y * MtxAdaptMaI.m10 + Z * MtxAdaptMaI.m20;
|
|
597
|
-
y = X * MtxAdaptMaI.m01 + Y * MtxAdaptMaI.m11 + Z * MtxAdaptMaI.m21;
|
|
598
|
-
z = X * MtxAdaptMaI.m02 + Y * MtxAdaptMaI.m12 + Z * MtxAdaptMaI.m22;
|
|
599
|
-
return [
|
|
600
|
-
x,
|
|
601
|
-
y,
|
|
602
|
-
z
|
|
603
|
-
];
|
|
604
|
-
};
|
|
605
|
-
var rgb2lab_default = rgb2lab;
|
|
606
|
-
|
|
607
|
-
//#endregion
|
|
608
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/io/lab/index.js
|
|
609
|
-
Color_default.prototype.lab = function() {
|
|
610
|
-
return rgb2lab_default(this._rgb);
|
|
611
|
-
};
|
|
612
|
-
const lab$1 = (...args) => new Color_default(...args, "lab");
|
|
613
|
-
Object.assign(chroma_default, {
|
|
614
|
-
lab: lab$1,
|
|
615
|
-
getLabWhitePoint,
|
|
616
|
-
setLabWhitePoint
|
|
617
|
-
});
|
|
618
|
-
input_default.format.lab = lab2rgb_default;
|
|
619
|
-
input_default.autodetect.push({
|
|
620
|
-
p: 2,
|
|
621
|
-
test: (...args) => {
|
|
622
|
-
args = unpack_default(args, "lab");
|
|
623
|
-
if (type_default(args) === "array" && args.length === 3) return "lab";
|
|
624
|
-
}
|
|
625
|
-
});
|
|
626
|
-
|
|
627
|
-
//#endregion
|
|
628
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/ops/darken.js
|
|
629
|
-
Color_default.prototype.darken = function(amount = 1) {
|
|
630
|
-
const me = this;
|
|
631
|
-
const lab = me.lab();
|
|
632
|
-
lab[0] -= lab_constants_default.Kn * amount;
|
|
633
|
-
return new Color_default(lab, "lab").alpha(me.alpha(), true);
|
|
634
|
-
};
|
|
635
|
-
Color_default.prototype.brighten = function(amount = 1) {
|
|
636
|
-
return this.darken(-amount);
|
|
637
|
-
};
|
|
638
|
-
Color_default.prototype.darker = Color_default.prototype.darken;
|
|
639
|
-
Color_default.prototype.brighter = Color_default.prototype.brighten;
|
|
640
|
-
|
|
641
|
-
//#endregion
|
|
642
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/ops/get.js
|
|
643
|
-
Color_default.prototype.get = function(mc) {
|
|
644
|
-
const [mode, channel] = mc.split(".");
|
|
645
|
-
const src = this[mode]();
|
|
646
|
-
if (channel) {
|
|
647
|
-
const i = mode.indexOf(channel) - (mode.substr(0, 2) === "ok" ? 2 : 0);
|
|
648
|
-
if (i > -1) return src[i];
|
|
649
|
-
throw new Error(`unknown channel ${channel} in mode ${mode}`);
|
|
650
|
-
} else return src;
|
|
651
|
-
};
|
|
652
|
-
|
|
653
|
-
//#endregion
|
|
654
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/ops/luminance.js
|
|
655
|
-
const { pow: pow$6 } = Math;
|
|
656
|
-
const EPS = 1e-7;
|
|
657
|
-
const MAX_ITER = 20;
|
|
658
|
-
Color_default.prototype.luminance = function(lum, mode = "rgb") {
|
|
659
|
-
if (lum !== void 0 && type_default(lum) === "number") {
|
|
660
|
-
if (lum === 0) return new Color_default([
|
|
661
|
-
0,
|
|
662
|
-
0,
|
|
663
|
-
0,
|
|
664
|
-
this._rgb[3]
|
|
665
|
-
], "rgb");
|
|
666
|
-
if (lum === 1) return new Color_default([
|
|
667
|
-
255,
|
|
668
|
-
255,
|
|
669
|
-
255,
|
|
670
|
-
this._rgb[3]
|
|
671
|
-
], "rgb");
|
|
672
|
-
let cur_lum = this.luminance();
|
|
673
|
-
let max_iter = MAX_ITER;
|
|
674
|
-
const test = (low, high) => {
|
|
675
|
-
const mid = low.interpolate(high, .5, mode);
|
|
676
|
-
const lm = mid.luminance();
|
|
677
|
-
if (Math.abs(lum - lm) < EPS || !max_iter--) return mid;
|
|
678
|
-
return lm > lum ? test(low, mid) : test(mid, high);
|
|
679
|
-
};
|
|
680
|
-
return new Color_default([...(cur_lum > lum ? test(new Color_default([
|
|
681
|
-
0,
|
|
682
|
-
0,
|
|
683
|
-
0
|
|
684
|
-
]), this) : test(this, new Color_default([
|
|
685
|
-
255,
|
|
686
|
-
255,
|
|
687
|
-
255
|
|
688
|
-
]))).rgb(), this._rgb[3]]);
|
|
689
|
-
}
|
|
690
|
-
return rgb2luminance(...this._rgb.slice(0, 3));
|
|
691
|
-
};
|
|
692
|
-
const rgb2luminance = (r, g, b) => {
|
|
693
|
-
r = luminance_x(r);
|
|
694
|
-
g = luminance_x(g);
|
|
695
|
-
b = luminance_x(b);
|
|
696
|
-
return .2126 * r + .7152 * g + .0722 * b;
|
|
697
|
-
};
|
|
698
|
-
const luminance_x = (x) => {
|
|
699
|
-
x /= 255;
|
|
700
|
-
return x <= .03928 ? x / 12.92 : pow$6((x + .055) / 1.055, 2.4);
|
|
701
|
-
};
|
|
702
|
-
|
|
703
|
-
//#endregion
|
|
704
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/interpolator/index.js
|
|
705
|
-
var interpolator_default = {};
|
|
706
|
-
|
|
707
|
-
//#endregion
|
|
708
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/generator/mix.js
|
|
709
|
-
var mix_default = (col1, col2, f = .5, ...rest) => {
|
|
710
|
-
let mode = rest[0] || "lrgb";
|
|
711
|
-
if (!interpolator_default[mode] && !rest.length) mode = Object.keys(interpolator_default)[0];
|
|
712
|
-
if (!interpolator_default[mode]) throw new Error(`interpolation mode ${mode} is not defined`);
|
|
713
|
-
if (type_default(col1) !== "object") col1 = new Color_default(col1);
|
|
714
|
-
if (type_default(col2) !== "object") col2 = new Color_default(col2);
|
|
715
|
-
return interpolator_default[mode](col1, col2, f).alpha(col1.alpha() + f * (col2.alpha() - col1.alpha()));
|
|
716
|
-
};
|
|
717
|
-
|
|
718
|
-
//#endregion
|
|
719
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/ops/mix.js
|
|
720
|
-
Color_default.prototype.mix = Color_default.prototype.interpolate = function(col2, f = .5, ...rest) {
|
|
721
|
-
return mix_default(this, col2, f, ...rest);
|
|
722
|
-
};
|
|
723
|
-
|
|
724
|
-
//#endregion
|
|
725
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/ops/premultiply.js
|
|
726
|
-
Color_default.prototype.premultiply = function(mutate = false) {
|
|
727
|
-
const rgb = this._rgb;
|
|
728
|
-
const a = rgb[3];
|
|
729
|
-
if (mutate) {
|
|
730
|
-
this._rgb = [
|
|
731
|
-
rgb[0] * a,
|
|
732
|
-
rgb[1] * a,
|
|
733
|
-
rgb[2] * a,
|
|
734
|
-
a
|
|
735
|
-
];
|
|
736
|
-
return this;
|
|
737
|
-
} else return new Color_default([
|
|
738
|
-
rgb[0] * a,
|
|
739
|
-
rgb[1] * a,
|
|
740
|
-
rgb[2] * a,
|
|
741
|
-
a
|
|
742
|
-
], "rgb");
|
|
743
|
-
};
|
|
744
|
-
|
|
745
|
-
//#endregion
|
|
746
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/io/lch/lch2lab.js
|
|
747
|
-
const { sin: sin$3, cos: cos$4 } = Math;
|
|
748
|
-
const lch2lab = (...args) => {
|
|
749
|
-
let [l, c, h] = unpack_default(args, "lch");
|
|
750
|
-
if (isNaN(h)) h = 0;
|
|
751
|
-
h = h * DEG2RAD;
|
|
752
|
-
return [
|
|
753
|
-
l,
|
|
754
|
-
cos$4(h) * c,
|
|
755
|
-
sin$3(h) * c
|
|
756
|
-
];
|
|
757
|
-
};
|
|
758
|
-
var lch2lab_default = lch2lab;
|
|
759
|
-
|
|
760
|
-
//#endregion
|
|
761
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/io/lch/lch2rgb.js
|
|
762
|
-
const lch2rgb = (...args) => {
|
|
763
|
-
args = unpack_default(args, "lch");
|
|
764
|
-
const [l, c, h] = args;
|
|
765
|
-
const [L, a, b_] = lch2lab_default(l, c, h);
|
|
766
|
-
const [r, g, b] = lab2rgb_default(L, a, b_);
|
|
767
|
-
return [
|
|
768
|
-
r,
|
|
769
|
-
g,
|
|
770
|
-
b,
|
|
771
|
-
args.length > 3 ? args[3] : 1
|
|
772
|
-
];
|
|
773
|
-
};
|
|
774
|
-
var lch2rgb_default = lch2rgb;
|
|
775
|
-
|
|
776
|
-
//#endregion
|
|
777
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/io/lch/hcl2rgb.js
|
|
778
|
-
const hcl2rgb = (...args) => {
|
|
779
|
-
return lch2rgb_default(...reverse3(unpack_default(args, "hcl")));
|
|
780
|
-
};
|
|
781
|
-
var hcl2rgb_default = hcl2rgb;
|
|
782
|
-
|
|
783
|
-
//#endregion
|
|
784
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/io/lch/lab2lch.js
|
|
785
|
-
const { sqrt: sqrt$4, atan2: atan2$2, round: round$4 } = Math;
|
|
786
|
-
const lab2lch = (...args) => {
|
|
787
|
-
const [l, a, b] = unpack_default(args, "lab");
|
|
788
|
-
const c = sqrt$4(a * a + b * b);
|
|
789
|
-
let h = (atan2$2(b, a) * RAD2DEG + 360) % 360;
|
|
790
|
-
if (round$4(c * 1e4) === 0) h = NaN;
|
|
791
|
-
return [
|
|
792
|
-
l,
|
|
793
|
-
c,
|
|
794
|
-
h
|
|
795
|
-
];
|
|
796
|
-
};
|
|
797
|
-
var lab2lch_default = lab2lch;
|
|
798
|
-
|
|
799
|
-
//#endregion
|
|
800
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/io/lch/rgb2lch.js
|
|
801
|
-
const rgb2lch = (...args) => {
|
|
802
|
-
const [r, g, b, ...rest] = unpack_default(args, "rgb");
|
|
803
|
-
const [l, a, b_] = rgb2lab_default(r, g, b);
|
|
804
|
-
const [L, c, h] = lab2lch_default(l, a, b_);
|
|
805
|
-
return [
|
|
806
|
-
L,
|
|
807
|
-
c,
|
|
808
|
-
h,
|
|
809
|
-
...rest.length > 0 && rest[0] < 1 ? [rest[0]] : []
|
|
810
|
-
];
|
|
811
|
-
};
|
|
812
|
-
var rgb2lch_default = rgb2lch;
|
|
813
|
-
|
|
814
|
-
//#endregion
|
|
815
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/io/lch/index.js
|
|
816
|
-
Color_default.prototype.lch = function() {
|
|
817
|
-
return rgb2lch_default(this._rgb);
|
|
818
|
-
};
|
|
819
|
-
Color_default.prototype.hcl = function() {
|
|
820
|
-
return reverse3(rgb2lch_default(this._rgb));
|
|
821
|
-
};
|
|
822
|
-
const lch$1 = (...args) => new Color_default(...args, "lch");
|
|
823
|
-
const hcl = (...args) => new Color_default(...args, "hcl");
|
|
824
|
-
Object.assign(chroma_default, {
|
|
825
|
-
lch: lch$1,
|
|
826
|
-
hcl
|
|
827
|
-
});
|
|
828
|
-
input_default.format.lch = lch2rgb_default;
|
|
829
|
-
input_default.format.hcl = hcl2rgb_default;
|
|
830
|
-
["lch", "hcl"].forEach((m) => input_default.autodetect.push({
|
|
831
|
-
p: 2,
|
|
832
|
-
test: (...args) => {
|
|
833
|
-
args = unpack_default(args, m);
|
|
834
|
-
if (type_default(args) === "array" && args.length === 3) return m;
|
|
835
|
-
}
|
|
836
|
-
}));
|
|
837
|
-
|
|
838
|
-
//#endregion
|
|
839
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/ops/saturate.js
|
|
840
|
-
Color_default.prototype.saturate = function(amount = 1) {
|
|
841
|
-
const me = this;
|
|
842
|
-
const lch = me.lch();
|
|
843
|
-
lch[1] += lab_constants_default.Kn * amount;
|
|
844
|
-
if (lch[1] < 0) lch[1] = 0;
|
|
845
|
-
return new Color_default(lch, "lch").alpha(me.alpha(), true);
|
|
846
|
-
};
|
|
847
|
-
Color_default.prototype.desaturate = function(amount = 1) {
|
|
848
|
-
return this.saturate(-amount);
|
|
849
|
-
};
|
|
850
|
-
|
|
851
|
-
//#endregion
|
|
852
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/ops/set.js
|
|
853
|
-
Color_default.prototype.set = function(mc, value, mutate = false) {
|
|
854
|
-
const [mode, channel] = mc.split(".");
|
|
855
|
-
const src = this[mode]();
|
|
856
|
-
if (channel) {
|
|
857
|
-
const i = mode.indexOf(channel) - (mode.substr(0, 2) === "ok" ? 2 : 0);
|
|
858
|
-
if (i > -1) {
|
|
859
|
-
if (type_default(value) == "string") switch (value.charAt(0)) {
|
|
860
|
-
case "+":
|
|
861
|
-
src[i] += +value;
|
|
862
|
-
break;
|
|
863
|
-
case "-":
|
|
864
|
-
src[i] += +value;
|
|
865
|
-
break;
|
|
866
|
-
case "*":
|
|
867
|
-
src[i] *= +value.substr(1);
|
|
868
|
-
break;
|
|
869
|
-
case "/":
|
|
870
|
-
src[i] /= +value.substr(1);
|
|
871
|
-
break;
|
|
872
|
-
default: src[i] = +value;
|
|
873
|
-
}
|
|
874
|
-
else if (type_default(value) === "number") src[i] = value;
|
|
875
|
-
else throw new Error(`unsupported value for Color.set`);
|
|
876
|
-
const out = new Color_default(src, mode);
|
|
877
|
-
if (mutate) {
|
|
878
|
-
this._rgb = out._rgb;
|
|
879
|
-
return this;
|
|
880
|
-
}
|
|
881
|
-
return out;
|
|
882
|
-
}
|
|
883
|
-
throw new Error(`unknown channel ${channel} in mode ${mode}`);
|
|
884
|
-
} else return src;
|
|
885
|
-
};
|
|
886
|
-
|
|
887
|
-
//#endregion
|
|
888
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/ops/shade.js
|
|
889
|
-
Color_default.prototype.tint = function(f = .5, ...rest) {
|
|
890
|
-
return mix_default(this, "white", f, ...rest);
|
|
891
|
-
};
|
|
892
|
-
Color_default.prototype.shade = function(f = .5, ...rest) {
|
|
893
|
-
return mix_default(this, "black", f, ...rest);
|
|
894
|
-
};
|
|
895
|
-
|
|
896
|
-
//#endregion
|
|
897
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/interpolator/rgb.js
|
|
898
|
-
const rgb$1 = (col1, col2, f) => {
|
|
899
|
-
const xyz0 = col1._rgb;
|
|
900
|
-
const xyz1 = col2._rgb;
|
|
901
|
-
return new Color_default(xyz0[0] + f * (xyz1[0] - xyz0[0]), xyz0[1] + f * (xyz1[1] - xyz0[1]), xyz0[2] + f * (xyz1[2] - xyz0[2]), "rgb");
|
|
902
|
-
};
|
|
903
|
-
interpolator_default.rgb = rgb$1;
|
|
904
|
-
|
|
905
|
-
//#endregion
|
|
906
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/interpolator/lrgb.js
|
|
907
|
-
const { sqrt: sqrt$3, pow: pow$5 } = Math;
|
|
908
|
-
const lrgb = (col1, col2, f) => {
|
|
909
|
-
const [x1, y1, z1] = col1._rgb;
|
|
910
|
-
const [x2, y2, z2] = col2._rgb;
|
|
911
|
-
return new Color_default(sqrt$3(pow$5(x1, 2) * (1 - f) + pow$5(x2, 2) * f), sqrt$3(pow$5(y1, 2) * (1 - f) + pow$5(y2, 2) * f), sqrt$3(pow$5(z1, 2) * (1 - f) + pow$5(z2, 2) * f), "rgb");
|
|
912
|
-
};
|
|
913
|
-
interpolator_default.lrgb = lrgb;
|
|
914
|
-
|
|
915
|
-
//#endregion
|
|
916
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/interpolator/lab.js
|
|
917
|
-
const lab = (col1, col2, f) => {
|
|
918
|
-
const xyz0 = col1.lab();
|
|
919
|
-
const xyz1 = col2.lab();
|
|
920
|
-
return new Color_default(xyz0[0] + f * (xyz1[0] - xyz0[0]), xyz0[1] + f * (xyz1[1] - xyz0[1]), xyz0[2] + f * (xyz1[2] - xyz0[2]), "lab");
|
|
921
|
-
};
|
|
922
|
-
interpolator_default.lab = lab;
|
|
923
|
-
|
|
924
|
-
//#endregion
|
|
925
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/interpolator/_hsx.js
|
|
926
|
-
var _hsx_default = (col1, col2, f, m) => {
|
|
927
|
-
let xyz0, xyz1;
|
|
928
|
-
if (m === "hsl") {
|
|
929
|
-
xyz0 = col1.hsl();
|
|
930
|
-
xyz1 = col2.hsl();
|
|
931
|
-
} else if (m === "hsv") {
|
|
932
|
-
xyz0 = col1.hsv();
|
|
933
|
-
xyz1 = col2.hsv();
|
|
934
|
-
} else if (m === "hcg") {
|
|
935
|
-
xyz0 = col1.hcg();
|
|
936
|
-
xyz1 = col2.hcg();
|
|
937
|
-
} else if (m === "hsi") {
|
|
938
|
-
xyz0 = col1.hsi();
|
|
939
|
-
xyz1 = col2.hsi();
|
|
940
|
-
} else if (m === "lch" || m === "hcl") {
|
|
941
|
-
m = "hcl";
|
|
942
|
-
xyz0 = col1.hcl();
|
|
943
|
-
xyz1 = col2.hcl();
|
|
944
|
-
} else if (m === "oklch") {
|
|
945
|
-
xyz0 = col1.oklch().reverse();
|
|
946
|
-
xyz1 = col2.oklch().reverse();
|
|
947
|
-
}
|
|
948
|
-
let hue0, hue1, sat0, sat1, lbv0, lbv1;
|
|
949
|
-
if (m.substr(0, 1) === "h" || m === "oklch") {
|
|
950
|
-
[hue0, sat0, lbv0] = xyz0;
|
|
951
|
-
[hue1, sat1, lbv1] = xyz1;
|
|
952
|
-
}
|
|
953
|
-
let sat, hue, lbv, dh;
|
|
954
|
-
if (!isNaN(hue0) && !isNaN(hue1)) {
|
|
955
|
-
if (hue1 > hue0 && hue1 - hue0 > 180) dh = hue1 - (hue0 + 360);
|
|
956
|
-
else if (hue1 < hue0 && hue0 - hue1 > 180) dh = hue1 + 360 - hue0;
|
|
957
|
-
else dh = hue1 - hue0;
|
|
958
|
-
hue = hue0 + f * dh;
|
|
959
|
-
} else if (!isNaN(hue0)) {
|
|
960
|
-
hue = hue0;
|
|
961
|
-
if ((lbv1 == 1 || lbv1 == 0) && m != "hsv") sat = sat0;
|
|
962
|
-
} else if (!isNaN(hue1)) {
|
|
963
|
-
hue = hue1;
|
|
964
|
-
if ((lbv0 == 1 || lbv0 == 0) && m != "hsv") sat = sat1;
|
|
965
|
-
} else hue = NaN;
|
|
966
|
-
if (sat === void 0) sat = sat0 + f * (sat1 - sat0);
|
|
967
|
-
lbv = lbv0 + f * (lbv1 - lbv0);
|
|
968
|
-
return m === "oklch" ? new Color_default([
|
|
969
|
-
lbv,
|
|
970
|
-
sat,
|
|
971
|
-
hue
|
|
972
|
-
], m) : new Color_default([
|
|
973
|
-
hue,
|
|
974
|
-
sat,
|
|
975
|
-
lbv
|
|
976
|
-
], m);
|
|
977
|
-
};
|
|
978
|
-
|
|
979
|
-
//#endregion
|
|
980
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/interpolator/lch.js
|
|
981
|
-
const lch = (col1, col2, f) => {
|
|
982
|
-
return _hsx_default(col1, col2, f, "lch");
|
|
983
|
-
};
|
|
984
|
-
interpolator_default.lch = lch;
|
|
985
|
-
interpolator_default.hcl = lch;
|
|
986
|
-
|
|
987
|
-
//#endregion
|
|
988
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/io/num/num2rgb.js
|
|
989
|
-
const num2rgb = (num) => {
|
|
990
|
-
if (type_default(num) == "number" && num >= 0 && num <= 16777215) return [
|
|
991
|
-
num >> 16,
|
|
992
|
-
num >> 8 & 255,
|
|
993
|
-
num & 255,
|
|
994
|
-
1
|
|
995
|
-
];
|
|
996
|
-
throw new Error("unknown num color: " + num);
|
|
997
|
-
};
|
|
998
|
-
var num2rgb_default = num2rgb;
|
|
999
|
-
|
|
1000
|
-
//#endregion
|
|
1001
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/io/num/rgb2num.js
|
|
1002
|
-
const rgb2num = (...args) => {
|
|
1003
|
-
const [r, g, b] = unpack_default(args, "rgb");
|
|
1004
|
-
return (r << 16) + (g << 8) + b;
|
|
1005
|
-
};
|
|
1006
|
-
var rgb2num_default = rgb2num;
|
|
1007
|
-
|
|
1008
|
-
//#endregion
|
|
1009
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/io/num/index.js
|
|
1010
|
-
Color_default.prototype.num = function() {
|
|
1011
|
-
return rgb2num_default(this._rgb);
|
|
1012
|
-
};
|
|
1013
|
-
const num$1 = (...args) => new Color_default(...args, "num");
|
|
1014
|
-
Object.assign(chroma_default, { num: num$1 });
|
|
1015
|
-
input_default.format.num = num2rgb_default;
|
|
1016
|
-
input_default.autodetect.push({
|
|
1017
|
-
p: 5,
|
|
1018
|
-
test: (...args) => {
|
|
1019
|
-
if (args.length === 1 && type_default(args[0]) === "number" && args[0] >= 0 && args[0] <= 16777215) return "num";
|
|
1020
|
-
}
|
|
1021
|
-
});
|
|
1022
|
-
|
|
1023
|
-
//#endregion
|
|
1024
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/interpolator/num.js
|
|
1025
|
-
const num = (col1, col2, f) => {
|
|
1026
|
-
const c1 = col1.num();
|
|
1027
|
-
return new Color_default(c1 + f * (col2.num() - c1), "num");
|
|
1028
|
-
};
|
|
1029
|
-
interpolator_default.num = num;
|
|
1030
|
-
|
|
1031
|
-
//#endregion
|
|
1032
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/io/hcg/hcg2rgb.js
|
|
1033
|
-
const { floor: floor$3 } = Math;
|
|
1034
|
-
const hcg2rgb = (...args) => {
|
|
1035
|
-
args = unpack_default(args, "hcg");
|
|
1036
|
-
let [h, c, _g] = args;
|
|
1037
|
-
let r, g, b;
|
|
1038
|
-
_g = _g * 255;
|
|
1039
|
-
const _c = c * 255;
|
|
1040
|
-
if (c === 0) r = g = b = _g;
|
|
1041
|
-
else {
|
|
1042
|
-
if (h === 360) h = 0;
|
|
1043
|
-
if (h > 360) h -= 360;
|
|
1044
|
-
if (h < 0) h += 360;
|
|
1045
|
-
h /= 60;
|
|
1046
|
-
const i = floor$3(h);
|
|
1047
|
-
const f = h - i;
|
|
1048
|
-
const p = _g * (1 - c);
|
|
1049
|
-
const q = p + _c * (1 - f);
|
|
1050
|
-
const t = p + _c * f;
|
|
1051
|
-
const v = p + _c;
|
|
1052
|
-
switch (i) {
|
|
1053
|
-
case 0:
|
|
1054
|
-
[r, g, b] = [
|
|
1055
|
-
v,
|
|
1056
|
-
t,
|
|
1057
|
-
p
|
|
1058
|
-
];
|
|
1059
|
-
break;
|
|
1060
|
-
case 1:
|
|
1061
|
-
[r, g, b] = [
|
|
1062
|
-
q,
|
|
1063
|
-
v,
|
|
1064
|
-
p
|
|
1065
|
-
];
|
|
1066
|
-
break;
|
|
1067
|
-
case 2:
|
|
1068
|
-
[r, g, b] = [
|
|
1069
|
-
p,
|
|
1070
|
-
v,
|
|
1071
|
-
t
|
|
1072
|
-
];
|
|
1073
|
-
break;
|
|
1074
|
-
case 3:
|
|
1075
|
-
[r, g, b] = [
|
|
1076
|
-
p,
|
|
1077
|
-
q,
|
|
1078
|
-
v
|
|
1079
|
-
];
|
|
1080
|
-
break;
|
|
1081
|
-
case 4:
|
|
1082
|
-
[r, g, b] = [
|
|
1083
|
-
t,
|
|
1084
|
-
p,
|
|
1085
|
-
v
|
|
1086
|
-
];
|
|
1087
|
-
break;
|
|
1088
|
-
case 5:
|
|
1089
|
-
[r, g, b] = [
|
|
1090
|
-
v,
|
|
1091
|
-
p,
|
|
1092
|
-
q
|
|
1093
|
-
];
|
|
1094
|
-
break;
|
|
1095
|
-
}
|
|
1096
|
-
}
|
|
1097
|
-
return [
|
|
1098
|
-
r,
|
|
1099
|
-
g,
|
|
1100
|
-
b,
|
|
1101
|
-
args.length > 3 ? args[3] : 1
|
|
1102
|
-
];
|
|
1103
|
-
};
|
|
1104
|
-
var hcg2rgb_default = hcg2rgb;
|
|
1105
|
-
|
|
1106
|
-
//#endregion
|
|
1107
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/io/hcg/rgb2hcg.js
|
|
1108
|
-
const rgb2hcg = (...args) => {
|
|
1109
|
-
const [r, g, b] = unpack_default(args, "rgb");
|
|
1110
|
-
const minRgb = min$3(r, g, b);
|
|
1111
|
-
const maxRgb = max$3(r, g, b);
|
|
1112
|
-
const delta = maxRgb - minRgb;
|
|
1113
|
-
const c = delta * 100 / 255;
|
|
1114
|
-
const _g = minRgb / (255 - delta) * 100;
|
|
1115
|
-
let h;
|
|
1116
|
-
if (delta === 0) h = NaN;
|
|
1117
|
-
else {
|
|
1118
|
-
if (r === maxRgb) h = (g - b) / delta;
|
|
1119
|
-
if (g === maxRgb) h = 2 + (b - r) / delta;
|
|
1120
|
-
if (b === maxRgb) h = 4 + (r - g) / delta;
|
|
1121
|
-
h *= 60;
|
|
1122
|
-
if (h < 0) h += 360;
|
|
1123
|
-
}
|
|
1124
|
-
return [
|
|
1125
|
-
h,
|
|
1126
|
-
c,
|
|
1127
|
-
_g
|
|
1128
|
-
];
|
|
1129
|
-
};
|
|
1130
|
-
var rgb2hcg_default = rgb2hcg;
|
|
1131
|
-
|
|
1132
|
-
//#endregion
|
|
1133
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/io/hcg/index.js
|
|
1134
|
-
Color_default.prototype.hcg = function() {
|
|
1135
|
-
return rgb2hcg_default(this._rgb);
|
|
1136
|
-
};
|
|
1137
|
-
const hcg$1 = (...args) => new Color_default(...args, "hcg");
|
|
1138
|
-
chroma_default.hcg = hcg$1;
|
|
1139
|
-
input_default.format.hcg = hcg2rgb_default;
|
|
1140
|
-
input_default.autodetect.push({
|
|
1141
|
-
p: 1,
|
|
1142
|
-
test: (...args) => {
|
|
1143
|
-
args = unpack_default(args, "hcg");
|
|
1144
|
-
if (type_default(args) === "array" && args.length === 3) return "hcg";
|
|
1145
|
-
}
|
|
1146
|
-
});
|
|
1147
|
-
|
|
1148
|
-
//#endregion
|
|
1149
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/interpolator/hcg.js
|
|
1150
|
-
const hcg = (col1, col2, f) => {
|
|
1151
|
-
return _hsx_default(col1, col2, f, "hcg");
|
|
1152
|
-
};
|
|
1153
|
-
interpolator_default.hcg = hcg;
|
|
1154
|
-
|
|
1155
|
-
//#endregion
|
|
1156
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/io/hsi/hsi2rgb.js
|
|
1157
|
-
const { cos: cos$3 } = Math;
|
|
1158
|
-
const hsi2rgb = (...args) => {
|
|
1159
|
-
args = unpack_default(args, "hsi");
|
|
1160
|
-
let [h, s, i] = args;
|
|
1161
|
-
let r, g, b;
|
|
1162
|
-
if (isNaN(h)) h = 0;
|
|
1163
|
-
if (isNaN(s)) s = 0;
|
|
1164
|
-
if (h > 360) h -= 360;
|
|
1165
|
-
if (h < 0) h += 360;
|
|
1166
|
-
h /= 360;
|
|
1167
|
-
if (h < 1 / 3) {
|
|
1168
|
-
b = (1 - s) / 3;
|
|
1169
|
-
r = (1 + s * cos$3(TWOPI * h) / cos$3(PITHIRD - TWOPI * h)) / 3;
|
|
1170
|
-
g = 1 - (b + r);
|
|
1171
|
-
} else if (h < 2 / 3) {
|
|
1172
|
-
h -= 1 / 3;
|
|
1173
|
-
r = (1 - s) / 3;
|
|
1174
|
-
g = (1 + s * cos$3(TWOPI * h) / cos$3(PITHIRD - TWOPI * h)) / 3;
|
|
1175
|
-
b = 1 - (r + g);
|
|
1176
|
-
} else {
|
|
1177
|
-
h -= 2 / 3;
|
|
1178
|
-
g = (1 - s) / 3;
|
|
1179
|
-
b = (1 + s * cos$3(TWOPI * h) / cos$3(PITHIRD - TWOPI * h)) / 3;
|
|
1180
|
-
r = 1 - (g + b);
|
|
1181
|
-
}
|
|
1182
|
-
r = limit_default(i * r * 3);
|
|
1183
|
-
g = limit_default(i * g * 3);
|
|
1184
|
-
b = limit_default(i * b * 3);
|
|
1185
|
-
return [
|
|
1186
|
-
r * 255,
|
|
1187
|
-
g * 255,
|
|
1188
|
-
b * 255,
|
|
1189
|
-
args.length > 3 ? args[3] : 1
|
|
1190
|
-
];
|
|
1191
|
-
};
|
|
1192
|
-
var hsi2rgb_default = hsi2rgb;
|
|
1193
|
-
|
|
1194
|
-
//#endregion
|
|
1195
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/io/hsi/rgb2hsi.js
|
|
1196
|
-
const { min: min$2, sqrt: sqrt$2, acos } = Math;
|
|
1197
|
-
const rgb2hsi = (...args) => {
|
|
1198
|
-
let [r, g, b] = unpack_default(args, "rgb");
|
|
1199
|
-
r /= 255;
|
|
1200
|
-
g /= 255;
|
|
1201
|
-
b /= 255;
|
|
1202
|
-
let h;
|
|
1203
|
-
const min_ = min$2(r, g, b);
|
|
1204
|
-
const i = (r + g + b) / 3;
|
|
1205
|
-
const s = i > 0 ? 1 - min_ / i : 0;
|
|
1206
|
-
if (s === 0) h = NaN;
|
|
1207
|
-
else {
|
|
1208
|
-
h = (r - g + (r - b)) / 2;
|
|
1209
|
-
h /= sqrt$2((r - g) * (r - g) + (r - b) * (g - b));
|
|
1210
|
-
h = acos(h);
|
|
1211
|
-
if (b > g) h = TWOPI - h;
|
|
1212
|
-
h /= TWOPI;
|
|
1213
|
-
}
|
|
1214
|
-
return [
|
|
1215
|
-
h * 360,
|
|
1216
|
-
s,
|
|
1217
|
-
i
|
|
1218
|
-
];
|
|
1219
|
-
};
|
|
1220
|
-
var rgb2hsi_default = rgb2hsi;
|
|
1221
|
-
|
|
1222
|
-
//#endregion
|
|
1223
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/io/hsi/index.js
|
|
1224
|
-
Color_default.prototype.hsi = function() {
|
|
1225
|
-
return rgb2hsi_default(this._rgb);
|
|
1226
|
-
};
|
|
1227
|
-
const hsi$1 = (...args) => new Color_default(...args, "hsi");
|
|
1228
|
-
chroma_default.hsi = hsi$1;
|
|
1229
|
-
input_default.format.hsi = hsi2rgb_default;
|
|
1230
|
-
input_default.autodetect.push({
|
|
1231
|
-
p: 2,
|
|
1232
|
-
test: (...args) => {
|
|
1233
|
-
args = unpack_default(args, "hsi");
|
|
1234
|
-
if (type_default(args) === "array" && args.length === 3) return "hsi";
|
|
1235
|
-
}
|
|
1236
|
-
});
|
|
1237
|
-
|
|
1238
|
-
//#endregion
|
|
1239
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/interpolator/hsi.js
|
|
1240
|
-
const hsi = (col1, col2, f) => {
|
|
1241
|
-
return _hsx_default(col1, col2, f, "hsi");
|
|
1242
|
-
};
|
|
1243
|
-
interpolator_default.hsi = hsi;
|
|
1244
|
-
|
|
1245
|
-
//#endregion
|
|
1246
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/io/hsl/hsl2rgb.js
|
|
1247
|
-
const hsl2rgb = (...args) => {
|
|
1248
|
-
args = unpack_default(args, "hsl");
|
|
1249
|
-
const [h, s, l] = args;
|
|
1250
|
-
let r, g, b;
|
|
1251
|
-
if (s === 0) r = g = b = l * 255;
|
|
1252
|
-
else {
|
|
1253
|
-
const t3 = [
|
|
1254
|
-
0,
|
|
1255
|
-
0,
|
|
1256
|
-
0
|
|
1257
|
-
];
|
|
1258
|
-
const c = [
|
|
1259
|
-
0,
|
|
1260
|
-
0,
|
|
1261
|
-
0
|
|
1262
|
-
];
|
|
1263
|
-
const t2 = l < .5 ? l * (1 + s) : l + s - l * s;
|
|
1264
|
-
const t1 = 2 * l - t2;
|
|
1265
|
-
const h_ = h / 360;
|
|
1266
|
-
t3[0] = h_ + 1 / 3;
|
|
1267
|
-
t3[1] = h_;
|
|
1268
|
-
t3[2] = h_ - 1 / 3;
|
|
1269
|
-
for (let i = 0; i < 3; i++) {
|
|
1270
|
-
if (t3[i] < 0) t3[i] += 1;
|
|
1271
|
-
if (t3[i] > 1) t3[i] -= 1;
|
|
1272
|
-
if (6 * t3[i] < 1) c[i] = t1 + (t2 - t1) * 6 * t3[i];
|
|
1273
|
-
else if (2 * t3[i] < 1) c[i] = t2;
|
|
1274
|
-
else if (3 * t3[i] < 2) c[i] = t1 + (t2 - t1) * (2 / 3 - t3[i]) * 6;
|
|
1275
|
-
else c[i] = t1;
|
|
1276
|
-
}
|
|
1277
|
-
[r, g, b] = [
|
|
1278
|
-
c[0] * 255,
|
|
1279
|
-
c[1] * 255,
|
|
1280
|
-
c[2] * 255
|
|
1281
|
-
];
|
|
1282
|
-
}
|
|
1283
|
-
if (args.length > 3) return [
|
|
1284
|
-
r,
|
|
1285
|
-
g,
|
|
1286
|
-
b,
|
|
1287
|
-
args[3]
|
|
1288
|
-
];
|
|
1289
|
-
return [
|
|
1290
|
-
r,
|
|
1291
|
-
g,
|
|
1292
|
-
b,
|
|
1293
|
-
1
|
|
1294
|
-
];
|
|
1295
|
-
};
|
|
1296
|
-
var hsl2rgb_default = hsl2rgb;
|
|
1297
|
-
|
|
1298
|
-
//#endregion
|
|
1299
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/io/hsl/rgb2hsl.js
|
|
1300
|
-
const rgb2hsl$1 = (...args) => {
|
|
1301
|
-
args = unpack_default(args, "rgba");
|
|
1302
|
-
let [r, g, b] = args;
|
|
1303
|
-
r /= 255;
|
|
1304
|
-
g /= 255;
|
|
1305
|
-
b /= 255;
|
|
1306
|
-
const minRgb = min$3(r, g, b);
|
|
1307
|
-
const maxRgb = max$3(r, g, b);
|
|
1308
|
-
const l = (maxRgb + minRgb) / 2;
|
|
1309
|
-
let s, h;
|
|
1310
|
-
if (maxRgb === minRgb) {
|
|
1311
|
-
s = 0;
|
|
1312
|
-
h = NaN;
|
|
1313
|
-
} else s = l < .5 ? (maxRgb - minRgb) / (maxRgb + minRgb) : (maxRgb - minRgb) / (2 - maxRgb - minRgb);
|
|
1314
|
-
if (r == maxRgb) h = (g - b) / (maxRgb - minRgb);
|
|
1315
|
-
else if (g == maxRgb) h = 2 + (b - r) / (maxRgb - minRgb);
|
|
1316
|
-
else if (b == maxRgb) h = 4 + (r - g) / (maxRgb - minRgb);
|
|
1317
|
-
h *= 60;
|
|
1318
|
-
if (h < 0) h += 360;
|
|
1319
|
-
if (args.length > 3 && args[3] !== void 0) return [
|
|
1320
|
-
h,
|
|
1321
|
-
s,
|
|
1322
|
-
l,
|
|
1323
|
-
args[3]
|
|
1324
|
-
];
|
|
1325
|
-
return [
|
|
1326
|
-
h,
|
|
1327
|
-
s,
|
|
1328
|
-
l
|
|
1329
|
-
];
|
|
1330
|
-
};
|
|
1331
|
-
var rgb2hsl_default = rgb2hsl$1;
|
|
1332
|
-
|
|
1333
|
-
//#endregion
|
|
1334
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/io/hsl/index.js
|
|
1335
|
-
Color_default.prototype.hsl = function() {
|
|
1336
|
-
return rgb2hsl_default(this._rgb);
|
|
1337
|
-
};
|
|
1338
|
-
const hsl$1 = (...args) => new Color_default(...args, "hsl");
|
|
1339
|
-
chroma_default.hsl = hsl$1;
|
|
1340
|
-
input_default.format.hsl = hsl2rgb_default;
|
|
1341
|
-
input_default.autodetect.push({
|
|
1342
|
-
p: 2,
|
|
1343
|
-
test: (...args) => {
|
|
1344
|
-
args = unpack_default(args, "hsl");
|
|
1345
|
-
if (type_default(args) === "array" && args.length === 3) return "hsl";
|
|
1346
|
-
}
|
|
1347
|
-
});
|
|
1348
|
-
|
|
1349
|
-
//#endregion
|
|
1350
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/interpolator/hsl.js
|
|
1351
|
-
const hsl = (col1, col2, f) => {
|
|
1352
|
-
return _hsx_default(col1, col2, f, "hsl");
|
|
1353
|
-
};
|
|
1354
|
-
interpolator_default.hsl = hsl;
|
|
1355
|
-
|
|
1356
|
-
//#endregion
|
|
1357
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/io/hsv/hsv2rgb.js
|
|
1358
|
-
const { floor: floor$2 } = Math;
|
|
1359
|
-
const hsv2rgb = (...args) => {
|
|
1360
|
-
args = unpack_default(args, "hsv");
|
|
1361
|
-
let [h, s, v] = args;
|
|
1362
|
-
let r, g, b;
|
|
1363
|
-
v *= 255;
|
|
1364
|
-
if (s === 0) r = g = b = v;
|
|
1365
|
-
else {
|
|
1366
|
-
if (h === 360) h = 0;
|
|
1367
|
-
if (h > 360) h -= 360;
|
|
1368
|
-
if (h < 0) h += 360;
|
|
1369
|
-
h /= 60;
|
|
1370
|
-
const i = floor$2(h);
|
|
1371
|
-
const f = h - i;
|
|
1372
|
-
const p = v * (1 - s);
|
|
1373
|
-
const q = v * (1 - s * f);
|
|
1374
|
-
const t = v * (1 - s * (1 - f));
|
|
1375
|
-
switch (i) {
|
|
1376
|
-
case 0:
|
|
1377
|
-
[r, g, b] = [
|
|
1378
|
-
v,
|
|
1379
|
-
t,
|
|
1380
|
-
p
|
|
1381
|
-
];
|
|
1382
|
-
break;
|
|
1383
|
-
case 1:
|
|
1384
|
-
[r, g, b] = [
|
|
1385
|
-
q,
|
|
1386
|
-
v,
|
|
1387
|
-
p
|
|
1388
|
-
];
|
|
1389
|
-
break;
|
|
1390
|
-
case 2:
|
|
1391
|
-
[r, g, b] = [
|
|
1392
|
-
p,
|
|
1393
|
-
v,
|
|
1394
|
-
t
|
|
1395
|
-
];
|
|
1396
|
-
break;
|
|
1397
|
-
case 3:
|
|
1398
|
-
[r, g, b] = [
|
|
1399
|
-
p,
|
|
1400
|
-
q,
|
|
1401
|
-
v
|
|
1402
|
-
];
|
|
1403
|
-
break;
|
|
1404
|
-
case 4:
|
|
1405
|
-
[r, g, b] = [
|
|
1406
|
-
t,
|
|
1407
|
-
p,
|
|
1408
|
-
v
|
|
1409
|
-
];
|
|
1410
|
-
break;
|
|
1411
|
-
case 5:
|
|
1412
|
-
[r, g, b] = [
|
|
1413
|
-
v,
|
|
1414
|
-
p,
|
|
1415
|
-
q
|
|
1416
|
-
];
|
|
1417
|
-
break;
|
|
1418
|
-
}
|
|
1419
|
-
}
|
|
1420
|
-
return [
|
|
1421
|
-
r,
|
|
1422
|
-
g,
|
|
1423
|
-
b,
|
|
1424
|
-
args.length > 3 ? args[3] : 1
|
|
1425
|
-
];
|
|
1426
|
-
};
|
|
1427
|
-
var hsv2rgb_default = hsv2rgb;
|
|
1428
|
-
|
|
1429
|
-
//#endregion
|
|
1430
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/io/hsv/rgb2hsv.js
|
|
1431
|
-
const { min: min$1, max: max$2 } = Math;
|
|
1432
|
-
const rgb2hsl = (...args) => {
|
|
1433
|
-
args = unpack_default(args, "rgb");
|
|
1434
|
-
let [r, g, b] = args;
|
|
1435
|
-
const min_ = min$1(r, g, b);
|
|
1436
|
-
const max_ = max$2(r, g, b);
|
|
1437
|
-
const delta = max_ - min_;
|
|
1438
|
-
let h, s, v;
|
|
1439
|
-
v = max_ / 255;
|
|
1440
|
-
if (max_ === 0) {
|
|
1441
|
-
h = NaN;
|
|
1442
|
-
s = 0;
|
|
1443
|
-
} else {
|
|
1444
|
-
s = delta / max_;
|
|
1445
|
-
if (r === max_) h = (g - b) / delta;
|
|
1446
|
-
if (g === max_) h = 2 + (b - r) / delta;
|
|
1447
|
-
if (b === max_) h = 4 + (r - g) / delta;
|
|
1448
|
-
h *= 60;
|
|
1449
|
-
if (h < 0) h += 360;
|
|
1450
|
-
}
|
|
1451
|
-
return [
|
|
1452
|
-
h,
|
|
1453
|
-
s,
|
|
1454
|
-
v
|
|
1455
|
-
];
|
|
1456
|
-
};
|
|
1457
|
-
var rgb2hsv_default = rgb2hsl;
|
|
1458
|
-
|
|
1459
|
-
//#endregion
|
|
1460
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/io/hsv/index.js
|
|
1461
|
-
Color_default.prototype.hsv = function() {
|
|
1462
|
-
return rgb2hsv_default(this._rgb);
|
|
1463
|
-
};
|
|
1464
|
-
const hsv$1 = (...args) => new Color_default(...args, "hsv");
|
|
1465
|
-
chroma_default.hsv = hsv$1;
|
|
1466
|
-
input_default.format.hsv = hsv2rgb_default;
|
|
1467
|
-
input_default.autodetect.push({
|
|
1468
|
-
p: 2,
|
|
1469
|
-
test: (...args) => {
|
|
1470
|
-
args = unpack_default(args, "hsv");
|
|
1471
|
-
if (type_default(args) === "array" && args.length === 3) return "hsv";
|
|
1472
|
-
}
|
|
1473
|
-
});
|
|
1474
|
-
|
|
1475
|
-
//#endregion
|
|
1476
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/interpolator/hsv.js
|
|
1477
|
-
const hsv = (col1, col2, f) => {
|
|
1478
|
-
return _hsx_default(col1, col2, f, "hsv");
|
|
1479
|
-
};
|
|
1480
|
-
interpolator_default.hsv = hsv;
|
|
1481
|
-
|
|
1482
|
-
//#endregion
|
|
1483
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/utils/multiply-matrices.js
|
|
1484
|
-
function multiplyMatrices(A, B) {
|
|
1485
|
-
let m = A.length;
|
|
1486
|
-
if (!Array.isArray(A[0])) A = [A];
|
|
1487
|
-
if (!Array.isArray(B[0])) B = B.map((x) => [x]);
|
|
1488
|
-
let p = B[0].length;
|
|
1489
|
-
let B_cols = B[0].map((_, i) => B.map((x) => x[i]));
|
|
1490
|
-
let product = A.map((row) => B_cols.map((col) => {
|
|
1491
|
-
if (!Array.isArray(row)) return col.reduce((a, c) => a + c * row, 0);
|
|
1492
|
-
return row.reduce((a, c, i) => a + c * (col[i] || 0), 0);
|
|
1493
|
-
}));
|
|
1494
|
-
if (m === 1) product = product[0];
|
|
1495
|
-
if (p === 1) return product.map((x) => x[0]);
|
|
1496
|
-
return product;
|
|
1497
|
-
}
|
|
1498
|
-
|
|
1499
|
-
//#endregion
|
|
1500
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/io/oklab/oklab2rgb.js
|
|
1501
|
-
const oklab2rgb = (...args) => {
|
|
1502
|
-
args = unpack_default(args, "lab");
|
|
1503
|
-
const [L, a, b, ...rest] = args;
|
|
1504
|
-
const [X, Y, Z] = OKLab_to_XYZ([
|
|
1505
|
-
L,
|
|
1506
|
-
a,
|
|
1507
|
-
b
|
|
1508
|
-
]);
|
|
1509
|
-
const [r, g, b_] = xyz2rgb(X, Y, Z);
|
|
1510
|
-
return [
|
|
1511
|
-
r,
|
|
1512
|
-
g,
|
|
1513
|
-
b_,
|
|
1514
|
-
...rest.length > 0 && rest[0] < 1 ? [rest[0]] : []
|
|
1515
|
-
];
|
|
1516
|
-
};
|
|
1517
|
-
function OKLab_to_XYZ(OKLab) {
|
|
1518
|
-
return multiplyMatrices([
|
|
1519
|
-
[
|
|
1520
|
-
1.2268798758459243,
|
|
1521
|
-
-.5578149944602171,
|
|
1522
|
-
.2813910456659647
|
|
1523
|
-
],
|
|
1524
|
-
[
|
|
1525
|
-
-.0405757452148008,
|
|
1526
|
-
1.112286803280317,
|
|
1527
|
-
-.0717110580655164
|
|
1528
|
-
],
|
|
1529
|
-
[
|
|
1530
|
-
-.0763729366746601,
|
|
1531
|
-
-.4214933324022432,
|
|
1532
|
-
1.5869240198367816
|
|
1533
|
-
]
|
|
1534
|
-
], multiplyMatrices([
|
|
1535
|
-
[
|
|
1536
|
-
1,
|
|
1537
|
-
.3963377773761749,
|
|
1538
|
-
.2158037573099136
|
|
1539
|
-
],
|
|
1540
|
-
[
|
|
1541
|
-
1,
|
|
1542
|
-
-.1055613458156586,
|
|
1543
|
-
-.0638541728258133
|
|
1544
|
-
],
|
|
1545
|
-
[
|
|
1546
|
-
1,
|
|
1547
|
-
-.0894841775298119,
|
|
1548
|
-
-1.2914855480194092
|
|
1549
|
-
]
|
|
1550
|
-
], OKLab).map((c) => c ** 3));
|
|
1551
|
-
}
|
|
1552
|
-
var oklab2rgb_default = oklab2rgb;
|
|
1553
|
-
|
|
1554
|
-
//#endregion
|
|
1555
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/io/oklab/rgb2oklab.js
|
|
1556
|
-
const rgb2oklab = (...args) => {
|
|
1557
|
-
const [r, g, b, ...rest] = unpack_default(args, "rgb");
|
|
1558
|
-
return [...XYZ_to_OKLab(rgb2xyz(r, g, b)), ...rest.length > 0 && rest[0] < 1 ? [rest[0]] : []];
|
|
1559
|
-
};
|
|
1560
|
-
function XYZ_to_OKLab(XYZ) {
|
|
1561
|
-
return multiplyMatrices([
|
|
1562
|
-
[
|
|
1563
|
-
.210454268309314,
|
|
1564
|
-
.7936177747023054,
|
|
1565
|
-
-.0040720430116193
|
|
1566
|
-
],
|
|
1567
|
-
[
|
|
1568
|
-
1.9779985324311684,
|
|
1569
|
-
-2.42859224204858,
|
|
1570
|
-
.450593709617411
|
|
1571
|
-
],
|
|
1572
|
-
[
|
|
1573
|
-
.0259040424655478,
|
|
1574
|
-
.7827717124575296,
|
|
1575
|
-
-.8086757549230774
|
|
1576
|
-
]
|
|
1577
|
-
], multiplyMatrices([
|
|
1578
|
-
[
|
|
1579
|
-
.819022437996703,
|
|
1580
|
-
.3619062600528904,
|
|
1581
|
-
-.1288737815209879
|
|
1582
|
-
],
|
|
1583
|
-
[
|
|
1584
|
-
.0329836539323885,
|
|
1585
|
-
.9292868615863434,
|
|
1586
|
-
.0361446663506424
|
|
1587
|
-
],
|
|
1588
|
-
[
|
|
1589
|
-
.0481771893596242,
|
|
1590
|
-
.2642395317527308,
|
|
1591
|
-
.6335478284694309
|
|
1592
|
-
]
|
|
1593
|
-
], XYZ).map((c) => Math.cbrt(c)));
|
|
1594
|
-
}
|
|
1595
|
-
var rgb2oklab_default = rgb2oklab;
|
|
1596
|
-
|
|
1597
|
-
//#endregion
|
|
1598
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/io/oklab/index.js
|
|
1599
|
-
Color_default.prototype.oklab = function() {
|
|
1600
|
-
return rgb2oklab_default(this._rgb);
|
|
1601
|
-
};
|
|
1602
|
-
const oklab$1 = (...args) => new Color_default(...args, "oklab");
|
|
1603
|
-
Object.assign(chroma_default, { oklab: oklab$1 });
|
|
1604
|
-
input_default.format.oklab = oklab2rgb_default;
|
|
1605
|
-
input_default.autodetect.push({
|
|
1606
|
-
p: 2,
|
|
1607
|
-
test: (...args) => {
|
|
1608
|
-
args = unpack_default(args, "oklab");
|
|
1609
|
-
if (type_default(args) === "array" && args.length === 3) return "oklab";
|
|
1610
|
-
}
|
|
1611
|
-
});
|
|
1612
|
-
|
|
1613
|
-
//#endregion
|
|
1614
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/interpolator/oklab.js
|
|
1615
|
-
const oklab = (col1, col2, f) => {
|
|
1616
|
-
const xyz0 = col1.oklab();
|
|
1617
|
-
const xyz1 = col2.oklab();
|
|
1618
|
-
return new Color_default(xyz0[0] + f * (xyz1[0] - xyz0[0]), xyz0[1] + f * (xyz1[1] - xyz0[1]), xyz0[2] + f * (xyz1[2] - xyz0[2]), "oklab");
|
|
1619
|
-
};
|
|
1620
|
-
interpolator_default.oklab = oklab;
|
|
1621
|
-
|
|
1622
|
-
//#endregion
|
|
1623
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/interpolator/oklch.js
|
|
1624
|
-
const oklch$1 = (col1, col2, f) => {
|
|
1625
|
-
return _hsx_default(col1, col2, f, "oklch");
|
|
1626
|
-
};
|
|
1627
|
-
interpolator_default.oklch = oklch$1;
|
|
1628
|
-
|
|
1629
|
-
//#endregion
|
|
1630
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/generator/average.js
|
|
1631
|
-
const { pow: pow$4, sqrt: sqrt$1, PI: PI$1, cos: cos$2, sin: sin$2, atan2: atan2$1 } = Math;
|
|
1632
|
-
var average_default = (colors, mode = "lrgb", weights = null) => {
|
|
1633
|
-
const l = colors.length;
|
|
1634
|
-
if (!weights) weights = Array.from(new Array(l)).map(() => 1);
|
|
1635
|
-
const k = l / weights.reduce(function(a, b) {
|
|
1636
|
-
return a + b;
|
|
1637
|
-
});
|
|
1638
|
-
weights.forEach((w, i) => {
|
|
1639
|
-
weights[i] *= k;
|
|
1640
|
-
});
|
|
1641
|
-
colors = colors.map((c) => new Color_default(c));
|
|
1642
|
-
if (mode === "lrgb") return _average_lrgb(colors, weights);
|
|
1643
|
-
const first = colors.shift();
|
|
1644
|
-
const xyz = first.get(mode);
|
|
1645
|
-
const cnt = [];
|
|
1646
|
-
let dx = 0;
|
|
1647
|
-
let dy = 0;
|
|
1648
|
-
for (let i = 0; i < xyz.length; i++) {
|
|
1649
|
-
xyz[i] = (xyz[i] || 0) * weights[0];
|
|
1650
|
-
cnt.push(isNaN(xyz[i]) ? 0 : weights[0]);
|
|
1651
|
-
if (mode.charAt(i) === "h" && !isNaN(xyz[i])) {
|
|
1652
|
-
const A = xyz[i] / 180 * PI$1;
|
|
1653
|
-
dx += cos$2(A) * weights[0];
|
|
1654
|
-
dy += sin$2(A) * weights[0];
|
|
1655
|
-
}
|
|
1656
|
-
}
|
|
1657
|
-
let alpha = first.alpha() * weights[0];
|
|
1658
|
-
colors.forEach((c, ci) => {
|
|
1659
|
-
const xyz2 = c.get(mode);
|
|
1660
|
-
alpha += c.alpha() * weights[ci + 1];
|
|
1661
|
-
for (let i = 0; i < xyz.length; i++) if (!isNaN(xyz2[i])) {
|
|
1662
|
-
cnt[i] += weights[ci + 1];
|
|
1663
|
-
if (mode.charAt(i) === "h") {
|
|
1664
|
-
const A = xyz2[i] / 180 * PI$1;
|
|
1665
|
-
dx += cos$2(A) * weights[ci + 1];
|
|
1666
|
-
dy += sin$2(A) * weights[ci + 1];
|
|
1667
|
-
} else xyz[i] += xyz2[i] * weights[ci + 1];
|
|
1668
|
-
}
|
|
1669
|
-
});
|
|
1670
|
-
for (let i = 0; i < xyz.length; i++) if (mode.charAt(i) === "h") {
|
|
1671
|
-
let A = atan2$1(dy / cnt[i], dx / cnt[i]) / PI$1 * 180;
|
|
1672
|
-
while (A < 0) A += 360;
|
|
1673
|
-
while (A >= 360) A -= 360;
|
|
1674
|
-
xyz[i] = A;
|
|
1675
|
-
} else xyz[i] = xyz[i] / cnt[i];
|
|
1676
|
-
alpha /= l;
|
|
1677
|
-
return new Color_default(xyz, mode).alpha(alpha > .99999 ? 1 : alpha, true);
|
|
1678
|
-
};
|
|
1679
|
-
const _average_lrgb = (colors, weights) => {
|
|
1680
|
-
const l = colors.length;
|
|
1681
|
-
const xyz = [
|
|
1682
|
-
0,
|
|
1683
|
-
0,
|
|
1684
|
-
0,
|
|
1685
|
-
0
|
|
1686
|
-
];
|
|
1687
|
-
for (let i = 0; i < colors.length; i++) {
|
|
1688
|
-
const col = colors[i];
|
|
1689
|
-
const f = weights[i] / l;
|
|
1690
|
-
const rgb = col._rgb;
|
|
1691
|
-
xyz[0] += pow$4(rgb[0], 2) * f;
|
|
1692
|
-
xyz[1] += pow$4(rgb[1], 2) * f;
|
|
1693
|
-
xyz[2] += pow$4(rgb[2], 2) * f;
|
|
1694
|
-
xyz[3] += rgb[3] * f;
|
|
1695
|
-
}
|
|
1696
|
-
xyz[0] = sqrt$1(xyz[0]);
|
|
1697
|
-
xyz[1] = sqrt$1(xyz[1]);
|
|
1698
|
-
xyz[2] = sqrt$1(xyz[2]);
|
|
1699
|
-
if (xyz[3] > .9999999) xyz[3] = 1;
|
|
1700
|
-
return new Color_default(clip_rgb_default(xyz));
|
|
1701
|
-
};
|
|
1702
|
-
|
|
1703
|
-
//#endregion
|
|
1704
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/generator/scale.js
|
|
1705
|
-
const { pow: pow$3 } = Math;
|
|
1706
|
-
function scale_default(colors) {
|
|
1707
|
-
let _mode = "rgb";
|
|
1708
|
-
let _nacol = chroma_default("#ccc");
|
|
1709
|
-
let _spread = 0;
|
|
1710
|
-
let _positions = [0, 1];
|
|
1711
|
-
let _domain = [0, 1];
|
|
1712
|
-
let _pos = [];
|
|
1713
|
-
let _padding = [0, 0];
|
|
1714
|
-
let _classes = false;
|
|
1715
|
-
let _colors = [];
|
|
1716
|
-
let _out = false;
|
|
1717
|
-
let _min = 0;
|
|
1718
|
-
let _max = 1;
|
|
1719
|
-
let _correctLightness = false;
|
|
1720
|
-
let _colorCache = {};
|
|
1721
|
-
let _useCache = true;
|
|
1722
|
-
let _gamma = 1;
|
|
1723
|
-
const setColors = function(colors) {
|
|
1724
|
-
colors = colors || ["#fff", "#000"];
|
|
1725
|
-
if (colors && type_default(colors) === "string" && chroma_default.brewer && chroma_default.brewer[colors.toLowerCase()]) colors = chroma_default.brewer[colors.toLowerCase()];
|
|
1726
|
-
if (type_default(colors) === "array") {
|
|
1727
|
-
if (colors.length === 1) colors = [colors[0], colors[0]];
|
|
1728
|
-
colors = colors.slice(0);
|
|
1729
|
-
for (let c = 0; c < colors.length; c++) colors[c] = chroma_default(colors[c]);
|
|
1730
|
-
_pos.length = 0;
|
|
1731
|
-
for (let c = 0; c < colors.length; c++) _pos.push(c / (colors.length - 1));
|
|
1732
|
-
}
|
|
1733
|
-
resetCache();
|
|
1734
|
-
return _colors = colors;
|
|
1735
|
-
};
|
|
1736
|
-
const getClass = function(value) {
|
|
1737
|
-
if (_classes != null) {
|
|
1738
|
-
const n = _classes.length - 1;
|
|
1739
|
-
let i = 0;
|
|
1740
|
-
while (i < n && value >= _classes[i]) i++;
|
|
1741
|
-
return i - 1;
|
|
1742
|
-
}
|
|
1743
|
-
return 0;
|
|
1744
|
-
};
|
|
1745
|
-
let tMapLightness = (t) => t;
|
|
1746
|
-
let tMapDomain = (t) => t;
|
|
1747
|
-
const getColor = function(val, bypassMap) {
|
|
1748
|
-
let col, t;
|
|
1749
|
-
if (bypassMap == null) bypassMap = false;
|
|
1750
|
-
if (isNaN(val) || val === null) return _nacol;
|
|
1751
|
-
if (!bypassMap) if (_classes && _classes.length > 2) t = getClass(val) / (_classes.length - 2);
|
|
1752
|
-
else if (_max !== _min) t = (val - _min) / (_max - _min);
|
|
1753
|
-
else t = 1;
|
|
1754
|
-
else t = val;
|
|
1755
|
-
t = tMapDomain(t);
|
|
1756
|
-
if (!bypassMap) t = tMapLightness(t);
|
|
1757
|
-
if (_gamma !== 1) t = pow$3(t, _gamma);
|
|
1758
|
-
t = _padding[0] + t * (1 - _padding[0] - _padding[1]);
|
|
1759
|
-
t = limit_default(t, 0, 1);
|
|
1760
|
-
const k = Math.floor(t * 1e4);
|
|
1761
|
-
if (_useCache && _colorCache[k]) col = _colorCache[k];
|
|
1762
|
-
else {
|
|
1763
|
-
if (type_default(_colors) === "array") for (let i = 0; i < _pos.length; i++) {
|
|
1764
|
-
const p = _pos[i];
|
|
1765
|
-
if (t <= p) {
|
|
1766
|
-
col = _colors[i];
|
|
1767
|
-
break;
|
|
1768
|
-
}
|
|
1769
|
-
if (t >= p && i === _pos.length - 1) {
|
|
1770
|
-
col = _colors[i];
|
|
1771
|
-
break;
|
|
1772
|
-
}
|
|
1773
|
-
if (t > p && t < _pos[i + 1]) {
|
|
1774
|
-
t = (t - p) / (_pos[i + 1] - p);
|
|
1775
|
-
col = chroma_default.interpolate(_colors[i], _colors[i + 1], t, _mode);
|
|
1776
|
-
break;
|
|
1777
|
-
}
|
|
1778
|
-
}
|
|
1779
|
-
else if (type_default(_colors) === "function") col = _colors(t);
|
|
1780
|
-
if (_useCache) _colorCache[k] = col;
|
|
1781
|
-
}
|
|
1782
|
-
return col;
|
|
1783
|
-
};
|
|
1784
|
-
var resetCache = () => _colorCache = {};
|
|
1785
|
-
setColors(colors);
|
|
1786
|
-
const f = function(v) {
|
|
1787
|
-
const c = chroma_default(getColor(v));
|
|
1788
|
-
if (_out && c[_out]) return c[_out]();
|
|
1789
|
-
else return c;
|
|
1790
|
-
};
|
|
1791
|
-
f.classes = function(classes) {
|
|
1792
|
-
if (classes != null) {
|
|
1793
|
-
if (type_default(classes) === "array") {
|
|
1794
|
-
_classes = classes;
|
|
1795
|
-
_positions = [classes[0], classes[classes.length - 1]];
|
|
1796
|
-
} else {
|
|
1797
|
-
const d = chroma_default.analyze(_positions);
|
|
1798
|
-
if (classes === 0) _classes = [d.min, d.max];
|
|
1799
|
-
else _classes = chroma_default.limits(d, "e", classes);
|
|
1800
|
-
}
|
|
1801
|
-
return f;
|
|
1802
|
-
}
|
|
1803
|
-
return _classes;
|
|
1804
|
-
};
|
|
1805
|
-
f.domain = function(domain) {
|
|
1806
|
-
if (!arguments.length) return _domain;
|
|
1807
|
-
_domain = domain.slice(0);
|
|
1808
|
-
_min = domain[0];
|
|
1809
|
-
_max = domain[domain.length - 1];
|
|
1810
|
-
_pos = [];
|
|
1811
|
-
const k = _colors.length;
|
|
1812
|
-
if (domain.length === k && _min !== _max) for (let d of Array.from(domain)) _pos.push((d - _min) / (_max - _min));
|
|
1813
|
-
else {
|
|
1814
|
-
for (let c = 0; c < k; c++) _pos.push(c / (k - 1));
|
|
1815
|
-
if (domain.length > 2) {
|
|
1816
|
-
const tOut = domain.map((d, i) => i / (domain.length - 1));
|
|
1817
|
-
const tBreaks = domain.map((d) => (d - _min) / (_max - _min));
|
|
1818
|
-
if (!tBreaks.every((val, i) => tOut[i] === val)) tMapDomain = (t) => {
|
|
1819
|
-
if (t <= 0 || t >= 1) return t;
|
|
1820
|
-
let i = 0;
|
|
1821
|
-
while (t >= tBreaks[i + 1]) i++;
|
|
1822
|
-
const f = (t - tBreaks[i]) / (tBreaks[i + 1] - tBreaks[i]);
|
|
1823
|
-
return tOut[i] + f * (tOut[i + 1] - tOut[i]);
|
|
1824
|
-
};
|
|
1825
|
-
}
|
|
1826
|
-
}
|
|
1827
|
-
_positions = [_min, _max];
|
|
1828
|
-
return f;
|
|
1829
|
-
};
|
|
1830
|
-
f.mode = function(_m) {
|
|
1831
|
-
if (!arguments.length) return _mode;
|
|
1832
|
-
_mode = _m;
|
|
1833
|
-
resetCache();
|
|
1834
|
-
return f;
|
|
1835
|
-
};
|
|
1836
|
-
f.range = function(colors, _pos) {
|
|
1837
|
-
setColors(colors, _pos);
|
|
1838
|
-
return f;
|
|
1839
|
-
};
|
|
1840
|
-
f.out = function(_o) {
|
|
1841
|
-
_out = _o;
|
|
1842
|
-
return f;
|
|
1843
|
-
};
|
|
1844
|
-
f.spread = function(val) {
|
|
1845
|
-
if (!arguments.length) return _spread;
|
|
1846
|
-
_spread = val;
|
|
1847
|
-
return f;
|
|
1848
|
-
};
|
|
1849
|
-
f.correctLightness = function(v) {
|
|
1850
|
-
if (v == null) v = true;
|
|
1851
|
-
_correctLightness = v;
|
|
1852
|
-
resetCache();
|
|
1853
|
-
if (_correctLightness) tMapLightness = function(t) {
|
|
1854
|
-
const L0 = getColor(0, true).lab()[0];
|
|
1855
|
-
const L1 = getColor(1, true).lab()[0];
|
|
1856
|
-
const pol = L0 > L1;
|
|
1857
|
-
let L_actual = getColor(t, true).lab()[0];
|
|
1858
|
-
const L_ideal = L0 + (L1 - L0) * t;
|
|
1859
|
-
let L_diff = L_actual - L_ideal;
|
|
1860
|
-
let t0 = 0;
|
|
1861
|
-
let t1 = 1;
|
|
1862
|
-
let max_iter = 20;
|
|
1863
|
-
while (Math.abs(L_diff) > .01 && max_iter-- > 0) (function() {
|
|
1864
|
-
if (pol) L_diff *= -1;
|
|
1865
|
-
if (L_diff < 0) {
|
|
1866
|
-
t0 = t;
|
|
1867
|
-
t += (t1 - t) * .5;
|
|
1868
|
-
} else {
|
|
1869
|
-
t1 = t;
|
|
1870
|
-
t += (t0 - t) * .5;
|
|
1871
|
-
}
|
|
1872
|
-
L_actual = getColor(t, true).lab()[0];
|
|
1873
|
-
return L_diff = L_actual - L_ideal;
|
|
1874
|
-
})();
|
|
1875
|
-
return t;
|
|
1876
|
-
};
|
|
1877
|
-
else tMapLightness = (t) => t;
|
|
1878
|
-
return f;
|
|
1879
|
-
};
|
|
1880
|
-
f.padding = function(p) {
|
|
1881
|
-
if (p != null) {
|
|
1882
|
-
if (type_default(p) === "number") p = [p, p];
|
|
1883
|
-
_padding = p;
|
|
1884
|
-
return f;
|
|
1885
|
-
} else return _padding;
|
|
1886
|
-
};
|
|
1887
|
-
f.colors = function(numColors, out) {
|
|
1888
|
-
if (arguments.length < 2) out = "hex";
|
|
1889
|
-
let result = [];
|
|
1890
|
-
if (arguments.length === 0) result = _colors.slice(0);
|
|
1891
|
-
else if (numColors === 1) result = [f(.5)];
|
|
1892
|
-
else if (numColors > 1) {
|
|
1893
|
-
const dm = _positions[0];
|
|
1894
|
-
const dd = _positions[1] - dm;
|
|
1895
|
-
result = __range__(0, numColors, false).map((i) => f(dm + i / (numColors - 1) * dd));
|
|
1896
|
-
} else {
|
|
1897
|
-
colors = [];
|
|
1898
|
-
let samples = [];
|
|
1899
|
-
if (_classes && _classes.length > 2) for (let i = 1, end = _classes.length, asc = 1 <= end; asc ? i < end : i > end; asc ? i++ : i--) samples.push((_classes[i - 1] + _classes[i]) * .5);
|
|
1900
|
-
else samples = _positions;
|
|
1901
|
-
result = samples.map((v) => f(v));
|
|
1902
|
-
}
|
|
1903
|
-
if (chroma_default[out]) result = result.map((c) => c[out]());
|
|
1904
|
-
return result;
|
|
1905
|
-
};
|
|
1906
|
-
f.cache = function(c) {
|
|
1907
|
-
if (c != null) {
|
|
1908
|
-
_useCache = c;
|
|
1909
|
-
return f;
|
|
1910
|
-
} else return _useCache;
|
|
1911
|
-
};
|
|
1912
|
-
f.gamma = function(g) {
|
|
1913
|
-
if (g != null) {
|
|
1914
|
-
_gamma = g;
|
|
1915
|
-
return f;
|
|
1916
|
-
} else return _gamma;
|
|
1917
|
-
};
|
|
1918
|
-
f.nodata = function(d) {
|
|
1919
|
-
if (d != null) {
|
|
1920
|
-
_nacol = chroma_default(d);
|
|
1921
|
-
return f;
|
|
1922
|
-
} else return _nacol;
|
|
1923
|
-
};
|
|
1924
|
-
return f;
|
|
1925
|
-
}
|
|
1926
|
-
function __range__(left, right, inclusive) {
|
|
1927
|
-
let range = [];
|
|
1928
|
-
let ascending = left < right;
|
|
1929
|
-
let end = !inclusive ? right : ascending ? right + 1 : right - 1;
|
|
1930
|
-
for (let i = left; ascending ? i < end : i > end; ascending ? i++ : i--) range.push(i);
|
|
1931
|
-
return range;
|
|
1932
|
-
}
|
|
1933
|
-
|
|
1934
|
-
//#endregion
|
|
1935
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/generator/bezier.js
|
|
1936
|
-
const binom_row = function(n) {
|
|
1937
|
-
let row = [1, 1];
|
|
1938
|
-
for (let i = 1; i < n; i++) {
|
|
1939
|
-
let newrow = [1];
|
|
1940
|
-
for (let j = 1; j <= row.length; j++) newrow[j] = (row[j] || 0) + row[j - 1];
|
|
1941
|
-
row = newrow;
|
|
1942
|
-
}
|
|
1943
|
-
return row;
|
|
1944
|
-
};
|
|
1945
|
-
const bezier = function(colors) {
|
|
1946
|
-
let I, lab0, lab1, lab2;
|
|
1947
|
-
colors = colors.map((c) => new Color_default(c));
|
|
1948
|
-
if (colors.length === 2) {
|
|
1949
|
-
[lab0, lab1] = colors.map((c) => c.lab());
|
|
1950
|
-
I = function(t) {
|
|
1951
|
-
return new Color_default([
|
|
1952
|
-
0,
|
|
1953
|
-
1,
|
|
1954
|
-
2
|
|
1955
|
-
].map((i) => lab0[i] + t * (lab1[i] - lab0[i])), "lab");
|
|
1956
|
-
};
|
|
1957
|
-
} else if (colors.length === 3) {
|
|
1958
|
-
[lab0, lab1, lab2] = colors.map((c) => c.lab());
|
|
1959
|
-
I = function(t) {
|
|
1960
|
-
return new Color_default([
|
|
1961
|
-
0,
|
|
1962
|
-
1,
|
|
1963
|
-
2
|
|
1964
|
-
].map((i) => (1 - t) * (1 - t) * lab0[i] + 2 * (1 - t) * t * lab1[i] + t * t * lab2[i]), "lab");
|
|
1965
|
-
};
|
|
1966
|
-
} else if (colors.length === 4) {
|
|
1967
|
-
let lab3;
|
|
1968
|
-
[lab0, lab1, lab2, lab3] = colors.map((c) => c.lab());
|
|
1969
|
-
I = function(t) {
|
|
1970
|
-
return new Color_default([
|
|
1971
|
-
0,
|
|
1972
|
-
1,
|
|
1973
|
-
2
|
|
1974
|
-
].map((i) => (1 - t) * (1 - t) * (1 - t) * lab0[i] + 3 * (1 - t) * (1 - t) * t * lab1[i] + 3 * (1 - t) * t * t * lab2[i] + t * t * t * lab3[i]), "lab");
|
|
1975
|
-
};
|
|
1976
|
-
} else if (colors.length >= 5) {
|
|
1977
|
-
let labs, row, n;
|
|
1978
|
-
labs = colors.map((c) => c.lab());
|
|
1979
|
-
n = colors.length - 1;
|
|
1980
|
-
row = binom_row(n);
|
|
1981
|
-
I = function(t) {
|
|
1982
|
-
const u = 1 - t;
|
|
1983
|
-
return new Color_default([
|
|
1984
|
-
0,
|
|
1985
|
-
1,
|
|
1986
|
-
2
|
|
1987
|
-
].map((i) => labs.reduce((sum, el, j) => sum + row[j] * u ** (n - j) * t ** j * el[i], 0)), "lab");
|
|
1988
|
-
};
|
|
1989
|
-
} else throw new RangeError("No point in running bezier with only one color.");
|
|
1990
|
-
return I;
|
|
1991
|
-
};
|
|
1992
|
-
var bezier_default = (colors) => {
|
|
1993
|
-
const f = bezier(colors);
|
|
1994
|
-
f.scale = () => scale_default(f);
|
|
1995
|
-
return f;
|
|
1996
|
-
};
|
|
1997
|
-
|
|
1998
|
-
//#endregion
|
|
1999
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/io/rgb/index.js
|
|
2000
|
-
const { round: round$3 } = Math;
|
|
2001
|
-
Color_default.prototype.rgb = function(rnd = true) {
|
|
2002
|
-
if (rnd === false) return this._rgb.slice(0, 3);
|
|
2003
|
-
return this._rgb.slice(0, 3).map(round$3);
|
|
2004
|
-
};
|
|
2005
|
-
Color_default.prototype.rgba = function(rnd = true) {
|
|
2006
|
-
return this._rgb.slice(0, 4).map((v, i) => {
|
|
2007
|
-
return i < 3 ? rnd === false ? v : round$3(v) : v;
|
|
2008
|
-
});
|
|
2009
|
-
};
|
|
2010
|
-
const rgb = (...args) => new Color_default(...args, "rgb");
|
|
2011
|
-
Object.assign(chroma_default, { rgb });
|
|
2012
|
-
input_default.format.rgb = (...args) => {
|
|
2013
|
-
const rgba = unpack_default(args, "rgba");
|
|
2014
|
-
if (rgba[3] === void 0) rgba[3] = 1;
|
|
2015
|
-
return rgba;
|
|
2016
|
-
};
|
|
2017
|
-
input_default.autodetect.push({
|
|
2018
|
-
p: 3,
|
|
2019
|
-
test: (...args) => {
|
|
2020
|
-
args = unpack_default(args, "rgba");
|
|
2021
|
-
if (type_default(args) === "array" && (args.length === 3 || args.length === 4 && type_default(args[3]) == "number" && args[3] >= 0 && args[3] <= 1)) return "rgb";
|
|
2022
|
-
}
|
|
2023
|
-
});
|
|
2024
|
-
|
|
2025
|
-
//#endregion
|
|
2026
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/generator/blend.js
|
|
2027
|
-
const blend = (bottom, top, mode) => {
|
|
2028
|
-
if (!blend[mode]) throw new Error("unknown blend mode " + mode);
|
|
2029
|
-
return blend[mode](bottom, top);
|
|
2030
|
-
};
|
|
2031
|
-
const blend_f = (f) => (bottom, top) => {
|
|
2032
|
-
const c0 = chroma_default(top).rgb();
|
|
2033
|
-
const c1 = chroma_default(bottom).rgb();
|
|
2034
|
-
return chroma_default.rgb(f(c0, c1));
|
|
2035
|
-
};
|
|
2036
|
-
const each = (f) => (c0, c1) => {
|
|
2037
|
-
const out = [];
|
|
2038
|
-
out[0] = f(c0[0], c1[0]);
|
|
2039
|
-
out[1] = f(c0[1], c1[1]);
|
|
2040
|
-
out[2] = f(c0[2], c1[2]);
|
|
2041
|
-
return out;
|
|
2042
|
-
};
|
|
2043
|
-
const normal = (a) => a;
|
|
2044
|
-
const multiply = (a, b) => a * b / 255;
|
|
2045
|
-
const darken = (a, b) => a > b ? b : a;
|
|
2046
|
-
const lighten = (a, b) => a > b ? a : b;
|
|
2047
|
-
const screen = (a, b) => 255 * (1 - (1 - a / 255) * (1 - b / 255));
|
|
2048
|
-
const overlay = (a, b) => b < 128 ? 2 * a * b / 255 : 255 * (1 - 2 * (1 - a / 255) * (1 - b / 255));
|
|
2049
|
-
const burn = (a, b) => 255 * (1 - (1 - b / 255) / (a / 255));
|
|
2050
|
-
const dodge = (a, b) => {
|
|
2051
|
-
if (a === 255) return 255;
|
|
2052
|
-
a = 255 * (b / 255) / (1 - a / 255);
|
|
2053
|
-
return a > 255 ? 255 : a;
|
|
2054
|
-
};
|
|
2055
|
-
blend.normal = blend_f(each(normal));
|
|
2056
|
-
blend.multiply = blend_f(each(multiply));
|
|
2057
|
-
blend.screen = blend_f(each(screen));
|
|
2058
|
-
blend.overlay = blend_f(each(overlay));
|
|
2059
|
-
blend.darken = blend_f(each(darken));
|
|
2060
|
-
blend.lighten = blend_f(each(lighten));
|
|
2061
|
-
blend.dodge = blend_f(each(dodge));
|
|
2062
|
-
blend.burn = blend_f(each(burn));
|
|
2063
|
-
var blend_default = blend;
|
|
2064
|
-
|
|
2065
|
-
//#endregion
|
|
2066
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/generator/cubehelix.js
|
|
2067
|
-
const { pow: pow$2, sin: sin$1, cos: cos$1 } = Math;
|
|
2068
|
-
function cubehelix_default(start = 300, rotations = -1.5, hue = 1, gamma = 1, lightness = [0, 1]) {
|
|
2069
|
-
let dh = 0, dl;
|
|
2070
|
-
if (type_default(lightness) === "array") dl = lightness[1] - lightness[0];
|
|
2071
|
-
else {
|
|
2072
|
-
dl = 0;
|
|
2073
|
-
lightness = [lightness, lightness];
|
|
2074
|
-
}
|
|
2075
|
-
const f = function(fract) {
|
|
2076
|
-
const a = TWOPI * ((start + 120) / 360 + rotations * fract);
|
|
2077
|
-
const l = pow$2(lightness[0] + dl * fract, gamma);
|
|
2078
|
-
const amp = (dh !== 0 ? hue[0] + fract * dh : hue) * l * (1 - l) / 2;
|
|
2079
|
-
const cos_a = cos$1(a);
|
|
2080
|
-
const sin_a = sin$1(a);
|
|
2081
|
-
const r = l + amp * (-.14861 * cos_a + 1.78277 * sin_a);
|
|
2082
|
-
const g = l + amp * (-.29227 * cos_a - .90649 * sin_a);
|
|
2083
|
-
const b = l + amp * (1.97294 * cos_a);
|
|
2084
|
-
return chroma_default(clip_rgb_default([
|
|
2085
|
-
r * 255,
|
|
2086
|
-
g * 255,
|
|
2087
|
-
b * 255,
|
|
2088
|
-
1
|
|
2089
|
-
]));
|
|
2090
|
-
};
|
|
2091
|
-
f.start = function(s) {
|
|
2092
|
-
if (s == null) return start;
|
|
2093
|
-
start = s;
|
|
2094
|
-
return f;
|
|
2095
|
-
};
|
|
2096
|
-
f.rotations = function(r) {
|
|
2097
|
-
if (r == null) return rotations;
|
|
2098
|
-
rotations = r;
|
|
2099
|
-
return f;
|
|
2100
|
-
};
|
|
2101
|
-
f.gamma = function(g) {
|
|
2102
|
-
if (g == null) return gamma;
|
|
2103
|
-
gamma = g;
|
|
2104
|
-
return f;
|
|
2105
|
-
};
|
|
2106
|
-
f.hue = function(h) {
|
|
2107
|
-
if (h == null) return hue;
|
|
2108
|
-
hue = h;
|
|
2109
|
-
if (type_default(hue) === "array") {
|
|
2110
|
-
dh = hue[1] - hue[0];
|
|
2111
|
-
if (dh === 0) hue = hue[1];
|
|
2112
|
-
} else dh = 0;
|
|
2113
|
-
return f;
|
|
2114
|
-
};
|
|
2115
|
-
f.lightness = function(h) {
|
|
2116
|
-
if (h == null) return lightness;
|
|
2117
|
-
if (type_default(h) === "array") {
|
|
2118
|
-
lightness = h;
|
|
2119
|
-
dl = h[1] - h[0];
|
|
2120
|
-
} else {
|
|
2121
|
-
lightness = [h, h];
|
|
2122
|
-
dl = 0;
|
|
2123
|
-
}
|
|
2124
|
-
return f;
|
|
2125
|
-
};
|
|
2126
|
-
f.scale = () => chroma_default.scale(f);
|
|
2127
|
-
f.hue(hue);
|
|
2128
|
-
return f;
|
|
2129
|
-
}
|
|
2130
|
-
|
|
2131
|
-
//#endregion
|
|
2132
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/generator/random.js
|
|
2133
|
-
const digits = "0123456789abcdef";
|
|
2134
|
-
const { floor: floor$1, random } = Math;
|
|
2135
|
-
/**
|
|
2136
|
-
* Generates a random color.
|
|
2137
|
-
* @param {() => number} rng - A random number generator function.
|
|
2138
|
-
*/
|
|
2139
|
-
var random_default = (rng = random) => {
|
|
2140
|
-
let code = "#";
|
|
2141
|
-
for (let i = 0; i < 6; i++) code += digits.charAt(floor$1(rng() * 16));
|
|
2142
|
-
return new Color_default(code, "hex");
|
|
2143
|
-
};
|
|
2144
|
-
|
|
2145
|
-
//#endregion
|
|
2146
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/utils/analyze.js
|
|
2147
|
-
const { log: log$1, pow: pow$1, floor, abs: abs$1 } = Math;
|
|
2148
|
-
function analyze(data, key = null) {
|
|
2149
|
-
const r = {
|
|
2150
|
-
min: Number.MAX_VALUE,
|
|
2151
|
-
max: Number.MAX_VALUE * -1,
|
|
2152
|
-
sum: 0,
|
|
2153
|
-
values: [],
|
|
2154
|
-
count: 0
|
|
2155
|
-
};
|
|
2156
|
-
if (type_default(data) === "object") data = Object.values(data);
|
|
2157
|
-
data.forEach((val) => {
|
|
2158
|
-
if (key && type_default(val) === "object") val = val[key];
|
|
2159
|
-
if (val !== void 0 && val !== null && !isNaN(val)) {
|
|
2160
|
-
r.values.push(val);
|
|
2161
|
-
r.sum += val;
|
|
2162
|
-
if (val < r.min) r.min = val;
|
|
2163
|
-
if (val > r.max) r.max = val;
|
|
2164
|
-
r.count += 1;
|
|
2165
|
-
}
|
|
2166
|
-
});
|
|
2167
|
-
r.domain = [r.min, r.max];
|
|
2168
|
-
r.limits = (mode, num) => limits(r, mode, num);
|
|
2169
|
-
return r;
|
|
2170
|
-
}
|
|
2171
|
-
function limits(data, mode = "equal", num = 7) {
|
|
2172
|
-
if (type_default(data) == "array") data = analyze(data);
|
|
2173
|
-
const { min, max } = data;
|
|
2174
|
-
const values = data.values.sort((a, b) => a - b);
|
|
2175
|
-
if (num === 1) return [min, max];
|
|
2176
|
-
const limits = [];
|
|
2177
|
-
if (mode.substr(0, 1) === "c") {
|
|
2178
|
-
limits.push(min);
|
|
2179
|
-
limits.push(max);
|
|
2180
|
-
}
|
|
2181
|
-
if (mode.substr(0, 1) === "e") {
|
|
2182
|
-
limits.push(min);
|
|
2183
|
-
for (let i = 1; i < num; i++) limits.push(min + i / num * (max - min));
|
|
2184
|
-
limits.push(max);
|
|
2185
|
-
} else if (mode.substr(0, 1) === "l") {
|
|
2186
|
-
if (min <= 0) throw new Error("Logarithmic scales are only possible for values > 0");
|
|
2187
|
-
const min_log = Math.LOG10E * log$1(min);
|
|
2188
|
-
const max_log = Math.LOG10E * log$1(max);
|
|
2189
|
-
limits.push(min);
|
|
2190
|
-
for (let i = 1; i < num; i++) limits.push(pow$1(10, min_log + i / num * (max_log - min_log)));
|
|
2191
|
-
limits.push(max);
|
|
2192
|
-
} else if (mode.substr(0, 1) === "q") {
|
|
2193
|
-
limits.push(min);
|
|
2194
|
-
for (let i = 1; i < num; i++) {
|
|
2195
|
-
const p = (values.length - 1) * i / num;
|
|
2196
|
-
const pb = floor(p);
|
|
2197
|
-
if (pb === p) limits.push(values[pb]);
|
|
2198
|
-
else {
|
|
2199
|
-
const pr = p - pb;
|
|
2200
|
-
limits.push(values[pb] * (1 - pr) + values[pb + 1] * pr);
|
|
2201
|
-
}
|
|
2202
|
-
}
|
|
2203
|
-
limits.push(max);
|
|
2204
|
-
} else if (mode.substr(0, 1) === "k") {
|
|
2205
|
-
let cluster;
|
|
2206
|
-
const n = values.length;
|
|
2207
|
-
const assignments = new Array(n);
|
|
2208
|
-
const clusterSizes = new Array(num);
|
|
2209
|
-
let repeat = true;
|
|
2210
|
-
let nb_iters = 0;
|
|
2211
|
-
let centroids = null;
|
|
2212
|
-
centroids = [];
|
|
2213
|
-
centroids.push(min);
|
|
2214
|
-
for (let i = 1; i < num; i++) centroids.push(min + i / num * (max - min));
|
|
2215
|
-
centroids.push(max);
|
|
2216
|
-
while (repeat) {
|
|
2217
|
-
for (let j = 0; j < num; j++) clusterSizes[j] = 0;
|
|
2218
|
-
for (let i = 0; i < n; i++) {
|
|
2219
|
-
const value = values[i];
|
|
2220
|
-
let mindist = Number.MAX_VALUE;
|
|
2221
|
-
let best;
|
|
2222
|
-
for (let j = 0; j < num; j++) {
|
|
2223
|
-
const dist = abs$1(centroids[j] - value);
|
|
2224
|
-
if (dist < mindist) {
|
|
2225
|
-
mindist = dist;
|
|
2226
|
-
best = j;
|
|
2227
|
-
}
|
|
2228
|
-
clusterSizes[best]++;
|
|
2229
|
-
assignments[i] = best;
|
|
2230
|
-
}
|
|
2231
|
-
}
|
|
2232
|
-
const newCentroids = new Array(num);
|
|
2233
|
-
for (let j = 0; j < num; j++) newCentroids[j] = null;
|
|
2234
|
-
for (let i = 0; i < n; i++) {
|
|
2235
|
-
cluster = assignments[i];
|
|
2236
|
-
if (newCentroids[cluster] === null) newCentroids[cluster] = values[i];
|
|
2237
|
-
else newCentroids[cluster] += values[i];
|
|
2238
|
-
}
|
|
2239
|
-
for (let j = 0; j < num; j++) newCentroids[j] *= 1 / clusterSizes[j];
|
|
2240
|
-
repeat = false;
|
|
2241
|
-
for (let j = 0; j < num; j++) if (newCentroids[j] !== centroids[j]) {
|
|
2242
|
-
repeat = true;
|
|
2243
|
-
break;
|
|
2244
|
-
}
|
|
2245
|
-
centroids = newCentroids;
|
|
2246
|
-
nb_iters++;
|
|
2247
|
-
if (nb_iters > 200) repeat = false;
|
|
2248
|
-
}
|
|
2249
|
-
const kClusters = {};
|
|
2250
|
-
for (let j = 0; j < num; j++) kClusters[j] = [];
|
|
2251
|
-
for (let i = 0; i < n; i++) {
|
|
2252
|
-
cluster = assignments[i];
|
|
2253
|
-
kClusters[cluster].push(values[i]);
|
|
2254
|
-
}
|
|
2255
|
-
let tmpKMeansBreaks = [];
|
|
2256
|
-
for (let j = 0; j < num; j++) {
|
|
2257
|
-
tmpKMeansBreaks.push(kClusters[j][0]);
|
|
2258
|
-
tmpKMeansBreaks.push(kClusters[j][kClusters[j].length - 1]);
|
|
2259
|
-
}
|
|
2260
|
-
tmpKMeansBreaks = tmpKMeansBreaks.sort((a, b) => a - b);
|
|
2261
|
-
limits.push(tmpKMeansBreaks[0]);
|
|
2262
|
-
for (let i = 1; i < tmpKMeansBreaks.length; i += 2) {
|
|
2263
|
-
const v = tmpKMeansBreaks[i];
|
|
2264
|
-
if (!isNaN(v) && limits.indexOf(v) === -1) limits.push(v);
|
|
2265
|
-
}
|
|
2266
|
-
}
|
|
2267
|
-
return limits;
|
|
2268
|
-
}
|
|
2269
|
-
|
|
2270
|
-
//#endregion
|
|
2271
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/utils/contrast.js
|
|
2272
|
-
var contrast_default = (a, b) => {
|
|
2273
|
-
a = new Color_default(a);
|
|
2274
|
-
b = new Color_default(b);
|
|
2275
|
-
const l1 = a.luminance();
|
|
2276
|
-
const l2 = b.luminance();
|
|
2277
|
-
return l1 > l2 ? (l1 + .05) / (l2 + .05) : (l2 + .05) / (l1 + .05);
|
|
2278
|
-
};
|
|
2279
|
-
|
|
2280
|
-
//#endregion
|
|
2281
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/utils/contrastAPCA.js
|
|
1
|
+
const{min:e,max:t}=Math;var n=(n,r=0,i=1)=>e(t(r,n),i),r=e=>{e._clipped=!1,e._unclipped=e.slice(0);for(let t=0;t<=3;t++)t<3?((e[t]<0||e[t]>255)&&(e._clipped=!0),e[t]=n(e[t],0,255)):t===3&&(e[t]=n(e[t],0,1));return e};const i={};for(let e of[`Boolean`,`Number`,`String`,`Function`,`Array`,`Date`,`RegExp`,`Undefined`,`Null`])i[`[object ${e}]`]=e.toLowerCase();function a(e){return i[Object.prototype.toString.call(e)]||`object`}var o=(e,t=null)=>e.length>=3?Array.prototype.slice.call(e):a(e[0])==`object`&&t?t.split(``).filter(t=>e[0][t]!==void 0).map(t=>e[0][t]):e[0].slice(0),s=e=>{if(e.length<2)return null;let t=e.length-1;return a(e[t])==`string`?e[t].toLowerCase():null};const{PI:c,min:l,max:u}=Math,d=e=>Math.round(e*100)/100,f=e=>Math.round(e*100)/100,p=c*2,m=c/3,h=c/180,g=180/c;function _(e){return[...e.slice(0,3).reverse(),...e.slice(3)]}var v={format:{},autodetect:[]},y=class{constructor(...e){let t=this;if(a(e[0])===`object`&&e[0].constructor&&e[0].constructor===this.constructor)return e[0];let n=s(e),i=!1;if(!n){i=!0,v.sorted||=(v.autodetect=v.autodetect.sort((e,t)=>t.p-e.p),!0);for(let t of v.autodetect)if(n=t.test(...e),n)break}if(v.format[n])t._rgb=r(v.format[n].apply(null,i?e:e.slice(0,-1)));else throw Error(`unknown format: `+e);t._rgb.length===3&&t._rgb.push(1)}toString(){return a(this.hex)==`function`?this.hex():`[${this._rgb.join(`,`)}]`}};const b=(...e)=>new y(...e);b.version=`3.2.0`;const x={aliceblue:`#f0f8ff`,antiquewhite:`#faebd7`,aqua:`#00ffff`,aquamarine:`#7fffd4`,azure:`#f0ffff`,beige:`#f5f5dc`,bisque:`#ffe4c4`,black:`#000000`,blanchedalmond:`#ffebcd`,blue:`#0000ff`,blueviolet:`#8a2be2`,brown:`#a52a2a`,burlywood:`#deb887`,cadetblue:`#5f9ea0`,chartreuse:`#7fff00`,chocolate:`#d2691e`,coral:`#ff7f50`,cornflowerblue:`#6495ed`,cornsilk:`#fff8dc`,crimson:`#dc143c`,cyan:`#00ffff`,darkblue:`#00008b`,darkcyan:`#008b8b`,darkgoldenrod:`#b8860b`,darkgray:`#a9a9a9`,darkgreen:`#006400`,darkgrey:`#a9a9a9`,darkkhaki:`#bdb76b`,darkmagenta:`#8b008b`,darkolivegreen:`#556b2f`,darkorange:`#ff8c00`,darkorchid:`#9932cc`,darkred:`#8b0000`,darksalmon:`#e9967a`,darkseagreen:`#8fbc8f`,darkslateblue:`#483d8b`,darkslategray:`#2f4f4f`,darkslategrey:`#2f4f4f`,darkturquoise:`#00ced1`,darkviolet:`#9400d3`,deeppink:`#ff1493`,deepskyblue:`#00bfff`,dimgray:`#696969`,dimgrey:`#696969`,dodgerblue:`#1e90ff`,firebrick:`#b22222`,floralwhite:`#fffaf0`,forestgreen:`#228b22`,fuchsia:`#ff00ff`,gainsboro:`#dcdcdc`,ghostwhite:`#f8f8ff`,gold:`#ffd700`,goldenrod:`#daa520`,gray:`#808080`,green:`#008000`,greenyellow:`#adff2f`,grey:`#808080`,honeydew:`#f0fff0`,hotpink:`#ff69b4`,indianred:`#cd5c5c`,indigo:`#4b0082`,ivory:`#fffff0`,khaki:`#f0e68c`,laserlemon:`#ffff54`,lavender:`#e6e6fa`,lavenderblush:`#fff0f5`,lawngreen:`#7cfc00`,lemonchiffon:`#fffacd`,lightblue:`#add8e6`,lightcoral:`#f08080`,lightcyan:`#e0ffff`,lightgoldenrod:`#fafad2`,lightgoldenrodyellow:`#fafad2`,lightgray:`#d3d3d3`,lightgreen:`#90ee90`,lightgrey:`#d3d3d3`,lightpink:`#ffb6c1`,lightsalmon:`#ffa07a`,lightseagreen:`#20b2aa`,lightskyblue:`#87cefa`,lightslategray:`#778899`,lightslategrey:`#778899`,lightsteelblue:`#b0c4de`,lightyellow:`#ffffe0`,lime:`#00ff00`,limegreen:`#32cd32`,linen:`#faf0e6`,magenta:`#ff00ff`,maroon:`#800000`,maroon2:`#7f0000`,maroon3:`#b03060`,mediumaquamarine:`#66cdaa`,mediumblue:`#0000cd`,mediumorchid:`#ba55d3`,mediumpurple:`#9370db`,mediumseagreen:`#3cb371`,mediumslateblue:`#7b68ee`,mediumspringgreen:`#00fa9a`,mediumturquoise:`#48d1cc`,mediumvioletred:`#c71585`,midnightblue:`#191970`,mintcream:`#f5fffa`,mistyrose:`#ffe4e1`,moccasin:`#ffe4b5`,navajowhite:`#ffdead`,navy:`#000080`,oldlace:`#fdf5e6`,olive:`#808000`,olivedrab:`#6b8e23`,orange:`#ffa500`,orangered:`#ff4500`,orchid:`#da70d6`,palegoldenrod:`#eee8aa`,palegreen:`#98fb98`,paleturquoise:`#afeeee`,palevioletred:`#db7093`,papayawhip:`#ffefd5`,peachpuff:`#ffdab9`,peru:`#cd853f`,pink:`#ffc0cb`,plum:`#dda0dd`,powderblue:`#b0e0e6`,purple:`#800080`,purple2:`#7f007f`,purple3:`#a020f0`,rebeccapurple:`#663399`,red:`#ff0000`,rosybrown:`#bc8f8f`,royalblue:`#4169e1`,saddlebrown:`#8b4513`,salmon:`#fa8072`,sandybrown:`#f4a460`,seagreen:`#2e8b57`,seashell:`#fff5ee`,sienna:`#a0522d`,silver:`#c0c0c0`,skyblue:`#87ceeb`,slateblue:`#6a5acd`,slategray:`#708090`,slategrey:`#708090`,snow:`#fffafa`,springgreen:`#00ff7f`,steelblue:`#4682b4`,tan:`#d2b48c`,teal:`#008080`,thistle:`#d8bfd8`,tomato:`#ff6347`,turquoise:`#40e0d0`,violet:`#ee82ee`,wheat:`#f5deb3`,white:`#ffffff`,whitesmoke:`#f5f5f5`,yellow:`#ffff00`,yellowgreen:`#9acd32`},S=/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,C=/^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/,w=e=>{if(e.match(S)){(e.length===4||e.length===7)&&(e=e.substr(1)),e.length===3&&(e=e.split(``),e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]);let t=parseInt(e,16);return[t>>16,t>>8&255,t&255,1]}if(e.match(C)){(e.length===5||e.length===9)&&(e=e.substr(1)),e.length===4&&(e=e.split(``),e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]+e[3]+e[3]);let t=parseInt(e,16);return[t>>24&255,t>>16&255,t>>8&255,Math.round((t&255)/255*100)/100]}throw Error(`unknown hex color: ${e}`)},{round:T}=Math,E=(...e)=>{let[t,n,r,i]=o(e,`rgba`),a=s(e)||`auto`;i===void 0&&(i=1),a===`auto`&&(a=i<1?`rgba`:`rgb`),t=T(t),n=T(n),r=T(r);let c=`000000`+(t<<16|n<<8|r).toString(16);c=c.substr(c.length-6);let l=`0`+T(i*255).toString(16);switch(l=l.substr(l.length-2),a.toLowerCase()){case`rgba`:return`#${c}${l}`;case`argb`:return`#${l}${c}`;default:return`#${c}`}};y.prototype.name=function(){let e=E(this._rgb,`rgb`);for(let t of Object.keys(x))if(x[t]===e)return t.toLowerCase();return e},v.format.named=e=>{if(e=e.toLowerCase(),x[e])return w(x[e]);throw Error(`unknown color name: `+e)},v.autodetect.push({p:5,test:(e,...t)=>{if(!t.length&&a(e)===`string`&&x[e.toLowerCase()])return`named`}}),y.prototype.alpha=function(e,t=!1){return e!==void 0&&a(e)===`number`?t?(this._rgb[3]=e,this):new y([this._rgb[0],this._rgb[1],this._rgb[2],e],`rgb`):this._rgb[3]},y.prototype.clipped=function(){return this._rgb._clipped||!1};const D={Kn:18,labWhitePoint:`d65`,Xn:.95047,Yn:1,Zn:1.08883,t0:.137931034,t1:.206896552,t2:.12841855,t3:.008856452,kE:216/24389,kKE:8,kK:24389/27,RefWhiteRGB:{X:.95047,Y:1,Z:1.08883},MtxRGB2XYZ:{m00:.4124564390896922,m01:.21267285140562253,m02:.0193338955823293,m10:.357576077643909,m11:.715152155287818,m12:.11919202588130297,m20:.18043748326639894,m21:.07217499330655958,m22:.9503040785363679},MtxXYZ2RGB:{m00:3.2404541621141045,m01:-.9692660305051868,m02:.055643430959114726,m10:-1.5371385127977166,m11:1.8760108454466942,m12:-.2040259135167538,m20:-.498531409556016,m21:.041556017530349834,m22:1.0572251882231791},As:.9414285350000001,Bs:1.040417467,Cs:1.089532651,MtxAdaptMa:{m00:.8951,m01:-.7502,m02:.0389,m10:.2664,m11:1.7135,m12:-.0685,m20:-.1614,m21:.0367,m22:1.0296},MtxAdaptMaI:{m00:.9869929054667123,m01:.43230526972339456,m02:-.008528664575177328,m10:-.14705425642099013,m11:.5183602715367776,m12:.04004282165408487,m20:.15996265166373125,m21:.0492912282128556,m22:.9684866957875502}},O=new Map([[`a`,[1.0985,.35585]],[`b`,[1.0985,.35585]],[`c`,[.98074,1.18232]],[`d50`,[.96422,.82521]],[`d55`,[.95682,.92149]],[`d65`,[.95047,1.08883]],[`e`,[1,1,1]],[`f2`,[.99186,.67393]],[`f7`,[.95041,1.08747]],[`f11`,[1.00962,.6435]],[`icc`,[.96422,.82521]]]);function k(e){let t=O.get(String(e).toLowerCase());if(!t)throw Error(`unknown Lab illuminant `+e);D.labWhitePoint=e,D.Xn=t[0],D.Zn=t[1]}function A(){return D.labWhitePoint}const j=(...e)=>{e=o(e,`lab`);let[t,n,r]=e,[i,a,s]=ee(t,n,r),[c,l,u]=te(i,a,s);return[c,l,u,e.length>3?e[3]:1]},ee=(e,t,n)=>{let{kE:r,kK:i,kKE:a,Xn:o,Yn:s,Zn:c}=D,l=(e+16)/116,u=.002*t+l,d=l-.005*n,f=u*u*u,p=d*d*d,m=f>r?f:(116*u-16)/i,h=e>a?((e+16)/116)**3:e/i,g=p>r?p:(116*d-16)/i;return[m*o,h*s,g*c]},M=e=>{let t=Math.sign(e);return e=Math.abs(e),(e<=.0031308?e*12.92:1.055*e**(1/2.4)-.055)*t},te=(e,t,n)=>{let{MtxAdaptMa:r,MtxAdaptMaI:i,MtxXYZ2RGB:a,RefWhiteRGB:o,Xn:s,Yn:c,Zn:l}=D,u=s*r.m00+c*r.m10+l*r.m20,d=s*r.m01+c*r.m11+l*r.m21,f=s*r.m02+c*r.m12+l*r.m22,p=o.X*r.m00+o.Y*r.m10+o.Z*r.m20,m=o.X*r.m01+o.Y*r.m11+o.Z*r.m21,h=o.X*r.m02+o.Y*r.m12+o.Z*r.m22,g=(e*r.m00+t*r.m10+n*r.m20)*(p/u),_=(e*r.m01+t*r.m11+n*r.m21)*(m/d),v=(e*r.m02+t*r.m12+n*r.m22)*(h/f),y=g*i.m00+_*i.m10+v*i.m20,b=g*i.m01+_*i.m11+v*i.m21,x=g*i.m02+_*i.m12+v*i.m22,S=M(y*a.m00+b*a.m10+x*a.m20),C=M(y*a.m01+b*a.m11+x*a.m21),w=M(y*a.m02+b*a.m12+x*a.m22);return[S*255,C*255,w*255]},N=(...e)=>{let[t,n,r,...i]=o(e,`rgb`),[a,s,c]=ie(t,n,r),[l,u,d]=ne(a,s,c);return[l,u,d,...i.length>0&&i[0]<1?[i[0]]:[]]};function ne(e,t,n){let{Xn:r,Yn:i,Zn:a,kE:o,kK:s}=D,c=e/r,l=t/i,u=n/a,d=c>o?c**(1/3):(s*c+16)/116,f=l>o?l**(1/3):(s*l+16)/116,p=u>o?u**(1/3):(s*u+16)/116;return[116*f-16,500*(d-f),200*(f-p)]}function re(e){let t=Math.sign(e);return e=Math.abs(e),(e<=.04045?e/12.92:((e+.055)/1.055)**2.4)*t}const ie=(e,t,n)=>{e=re(e/255),t=re(t/255),n=re(n/255);let{MtxRGB2XYZ:r,MtxAdaptMa:i,MtxAdaptMaI:a,Xn:o,Yn:s,Zn:c,As:l,Bs:u,Cs:d}=D,f=e*r.m00+t*r.m10+n*r.m20,p=e*r.m01+t*r.m11+n*r.m21,m=e*r.m02+t*r.m12+n*r.m22,h=o*i.m00+s*i.m10+c*i.m20,g=o*i.m01+s*i.m11+c*i.m21,_=o*i.m02+s*i.m12+c*i.m22,v=f*i.m00+p*i.m10+m*i.m20,y=f*i.m01+p*i.m11+m*i.m21,b=f*i.m02+p*i.m12+m*i.m22;return v*=h/l,y*=g/u,b*=_/d,f=v*a.m00+y*a.m10+b*a.m20,p=v*a.m01+y*a.m11+b*a.m21,m=v*a.m02+y*a.m12+b*a.m22,[f,p,m]};y.prototype.lab=function(){return N(this._rgb)};const ae=(...e)=>new y(...e,`lab`);Object.assign(b,{lab:ae,getLabWhitePoint:A,setLabWhitePoint:k}),v.format.lab=j,v.autodetect.push({p:2,test:(...e)=>{if(e=o(e,`lab`),a(e)===`array`&&e.length===3)return`lab`}}),y.prototype.darken=function(e=1){let t=this,n=t.lab();return n[0]-=D.Kn*e,new y(n,`lab`).alpha(t.alpha(),!0)},y.prototype.brighten=function(e=1){return this.darken(-e)},y.prototype.darker=y.prototype.darken,y.prototype.brighter=y.prototype.brighten,y.prototype.get=function(e){let[t,n]=e.split(`.`),r=this[t]();if(n){let e=t.indexOf(n)-(t.substr(0,2)===`ok`?2:0);if(e>-1)return r[e];throw Error(`unknown channel ${n} in mode ${t}`)}else return r};const{pow:oe}=Math;y.prototype.luminance=function(e,t=`rgb`){if(e!==void 0&&a(e)===`number`){if(e===0)return new y([0,0,0,this._rgb[3]],`rgb`);if(e===1)return new y([255,255,255,this._rgb[3]],`rgb`);let n=this.luminance(),r=20,i=(n,a)=>{let o=n.interpolate(a,.5,t),s=o.luminance();return Math.abs(e-s)<1e-7||!r--?o:s>e?i(n,o):i(o,a)};return new y([...(n>e?i(new y([0,0,0]),this):i(this,new y([255,255,255]))).rgb(),this._rgb[3]])}return se(...this._rgb.slice(0,3))};const se=(e,t,n)=>(e=ce(e),t=ce(t),n=ce(n),.2126*e+.7152*t+.0722*n),ce=e=>(e/=255,e<=.03928?e/12.92:oe((e+.055)/1.055,2.4));var P={},F=(e,t,n=.5,...r)=>{let i=r[0]||`lrgb`;if(!P[i]&&!r.length&&(i=Object.keys(P)[0]),!P[i])throw Error(`interpolation mode ${i} is not defined`);return a(e)!==`object`&&(e=new y(e)),a(t)!==`object`&&(t=new y(t)),P[i](e,t,n).alpha(e.alpha()+n*(t.alpha()-e.alpha()))};y.prototype.mix=y.prototype.interpolate=function(e,t=.5,...n){return F(this,e,t,...n)},y.prototype.premultiply=function(e=!1){let t=this._rgb,n=t[3];return e?(this._rgb=[t[0]*n,t[1]*n,t[2]*n,n],this):new y([t[0]*n,t[1]*n,t[2]*n,n],`rgb`)};const{sin:le,cos:ue}=Math,de=(...e)=>{let[t,n,r]=o(e,`lch`);return isNaN(r)&&(r=0),r*=h,[t,ue(r)*n,le(r)*n]},fe=(...e)=>{e=o(e,`lch`);let[t,n,r]=e,[i,a,s]=de(t,n,r),[c,l,u]=j(i,a,s);return[c,l,u,e.length>3?e[3]:1]},pe=(...e)=>fe(..._(o(e,`hcl`))),{sqrt:me,atan2:he,round:ge}=Math,_e=(...e)=>{let[t,n,r]=o(e,`lab`),i=me(n*n+r*r),a=(he(r,n)*g+360)%360;return ge(i*1e4)===0&&(a=NaN),[t,i,a]},ve=(...e)=>{let[t,n,r,...i]=o(e,`rgb`),[a,s,c]=N(t,n,r),[l,u,d]=_e(a,s,c);return[l,u,d,...i.length>0&&i[0]<1?[i[0]]:[]]};y.prototype.lch=function(){return ve(this._rgb)},y.prototype.hcl=function(){return _(ve(this._rgb))};const ye=(...e)=>new y(...e,`lch`),be=(...e)=>new y(...e,`hcl`);Object.assign(b,{lch:ye,hcl:be}),v.format.lch=fe,v.format.hcl=pe,[`lch`,`hcl`].forEach(e=>v.autodetect.push({p:2,test:(...t)=>{if(t=o(t,e),a(t)===`array`&&t.length===3)return e}})),y.prototype.saturate=function(e=1){let t=this,n=t.lch();return n[1]+=D.Kn*e,n[1]<0&&(n[1]=0),new y(n,`lch`).alpha(t.alpha(),!0)},y.prototype.desaturate=function(e=1){return this.saturate(-e)},y.prototype.set=function(e,t,n=!1){let[r,i]=e.split(`.`),o=this[r]();if(i){let e=r.indexOf(i)-(r.substr(0,2)===`ok`?2:0);if(e>-1){if(a(t)==`string`)switch(t.charAt(0)){case`+`:o[e]+=+t;break;case`-`:o[e]+=+t;break;case`*`:o[e]*=+t.substr(1);break;case`/`:o[e]/=+t.substr(1);break;default:o[e]=+t}else if(a(t)===`number`)o[e]=t;else throw Error(`unsupported value for Color.set`);let i=new y(o,r);return n?(this._rgb=i._rgb,this):i}throw Error(`unknown channel ${i} in mode ${r}`)}else return o},y.prototype.tint=function(e=.5,...t){return F(this,`white`,e,...t)},y.prototype.shade=function(e=.5,...t){return F(this,`black`,e,...t)};const xe=(e,t,n)=>{let r=e._rgb,i=t._rgb;return new y(r[0]+n*(i[0]-r[0]),r[1]+n*(i[1]-r[1]),r[2]+n*(i[2]-r[2]),`rgb`)};P.rgb=xe;const{sqrt:Se,pow:I}=Math,Ce=(e,t,n)=>{let[r,i,a]=e._rgb,[o,s,c]=t._rgb;return new y(Se(I(r,2)*(1-n)+I(o,2)*n),Se(I(i,2)*(1-n)+I(s,2)*n),Se(I(a,2)*(1-n)+I(c,2)*n),`rgb`)};P.lrgb=Ce;const we=(e,t,n)=>{let r=e.lab(),i=t.lab();return new y(r[0]+n*(i[0]-r[0]),r[1]+n*(i[1]-r[1]),r[2]+n*(i[2]-r[2]),`lab`)};P.lab=we;var L=(e,t,n,r)=>{let i,a;r===`hsl`?(i=e.hsl(),a=t.hsl()):r===`hsv`?(i=e.hsv(),a=t.hsv()):r===`hcg`?(i=e.hcg(),a=t.hcg()):r===`hsi`?(i=e.hsi(),a=t.hsi()):r===`lch`||r===`hcl`?(r=`hcl`,i=e.hcl(),a=t.hcl()):r===`oklch`&&(i=e.oklch().reverse(),a=t.oklch().reverse());let o,s,c,l,u,d;(r.substr(0,1)===`h`||r===`oklch`)&&([o,c,u]=i,[s,l,d]=a);let f,p,m,h;return!isNaN(o)&&!isNaN(s)?(h=s>o&&s-o>180?s-(o+360):s<o&&o-s>180?s+360-o:s-o,p=o+n*h):isNaN(o)?isNaN(s)?p=NaN:(p=s,(u==1||u==0)&&r!=`hsv`&&(f=l)):(p=o,(d==1||d==0)&&r!=`hsv`&&(f=c)),f===void 0&&(f=c+n*(l-c)),m=u+n*(d-u),r===`oklch`?new y([m,f,p],r):new y([p,f,m],r)};const Te=(e,t,n)=>L(e,t,n,`lch`);P.lch=Te,P.hcl=Te;const Ee=e=>{if(a(e)==`number`&&e>=0&&e<=16777215)return[e>>16,e>>8&255,e&255,1];throw Error(`unknown num color: `+e)},De=(...e)=>{let[t,n,r]=o(e,`rgb`);return(t<<16)+(n<<8)+r};y.prototype.num=function(){return De(this._rgb)};const Oe=(...e)=>new y(...e,`num`);Object.assign(b,{num:Oe}),v.format.num=Ee,v.autodetect.push({p:5,test:(...e)=>{if(e.length===1&&a(e[0])===`number`&&e[0]>=0&&e[0]<=16777215)return`num`}});const ke=(e,t,n)=>{let r=e.num();return new y(r+n*(t.num()-r),`num`)};P.num=ke;const{floor:Ae}=Math,je=(...e)=>{e=o(e,`hcg`);let[t,n,r]=e,i,a,s;r*=255;let c=n*255;if(n===0)i=a=s=r;else{t===360&&(t=0),t>360&&(t-=360),t<0&&(t+=360),t/=60;let e=Ae(t),o=t-e,l=r*(1-n),u=l+c*(1-o),d=l+c*o,f=l+c;switch(e){case 0:[i,a,s]=[f,d,l];break;case 1:[i,a,s]=[u,f,l];break;case 2:[i,a,s]=[l,f,d];break;case 3:[i,a,s]=[l,u,f];break;case 4:[i,a,s]=[d,l,f];break;case 5:[i,a,s]=[f,l,u];break}}return[i,a,s,e.length>3?e[3]:1]},Me=(...e)=>{let[t,n,r]=o(e,`rgb`),i=l(t,n,r),a=u(t,n,r),s=a-i,c=s*100/255,d=i/(255-s)*100,f;return s===0?f=NaN:(t===a&&(f=(n-r)/s),n===a&&(f=2+(r-t)/s),r===a&&(f=4+(t-n)/s),f*=60,f<0&&(f+=360)),[f,c,d]};y.prototype.hcg=function(){return Me(this._rgb)};const Ne=(...e)=>new y(...e,`hcg`);b.hcg=Ne,v.format.hcg=je,v.autodetect.push({p:1,test:(...e)=>{if(e=o(e,`hcg`),a(e)===`array`&&e.length===3)return`hcg`}});const Pe=(e,t,n)=>L(e,t,n,`hcg`);P.hcg=Pe;const{cos:R}=Math,Fe=(...e)=>{e=o(e,`hsi`);let[t,r,i]=e,a,s,c;return isNaN(t)&&(t=0),isNaN(r)&&(r=0),t>360&&(t-=360),t<0&&(t+=360),t/=360,t<1/3?(c=(1-r)/3,a=(1+r*R(p*t)/R(m-p*t))/3,s=1-(c+a)):t<2/3?(t-=1/3,a=(1-r)/3,s=(1+r*R(p*t)/R(m-p*t))/3,c=1-(a+s)):(t-=2/3,s=(1-r)/3,c=(1+r*R(p*t)/R(m-p*t))/3,a=1-(s+c)),a=n(i*a*3),s=n(i*s*3),c=n(i*c*3),[a*255,s*255,c*255,e.length>3?e[3]:1]},{min:Ie,sqrt:Le,acos:Re}=Math,ze=(...e)=>{let[t,n,r]=o(e,`rgb`);t/=255,n/=255,r/=255;let i,a=Ie(t,n,r),s=(t+n+r)/3,c=s>0?1-a/s:0;return c===0?i=NaN:(i=(t-n+(t-r))/2,i/=Le((t-n)*(t-n)+(t-r)*(n-r)),i=Re(i),r>n&&(i=p-i),i/=p),[i*360,c,s]};y.prototype.hsi=function(){return ze(this._rgb)};const Be=(...e)=>new y(...e,`hsi`);b.hsi=Be,v.format.hsi=Fe,v.autodetect.push({p:2,test:(...e)=>{if(e=o(e,`hsi`),a(e)===`array`&&e.length===3)return`hsi`}});const Ve=(e,t,n)=>L(e,t,n,`hsi`);P.hsi=Ve;const He=(...e)=>{e=o(e,`hsl`);let[t,n,r]=e,i,a,s;if(n===0)i=a=s=r*255;else{let e=[0,0,0],o=[0,0,0],c=r<.5?r*(1+n):r+n-r*n,l=2*r-c,u=t/360;e[0]=u+1/3,e[1]=u,e[2]=u-1/3;for(let t=0;t<3;t++)e[t]<0&&(e[t]+=1),e[t]>1&&--e[t],6*e[t]<1?o[t]=l+(c-l)*6*e[t]:2*e[t]<1?o[t]=c:3*e[t]<2?o[t]=l+(c-l)*(2/3-e[t])*6:o[t]=l;[i,a,s]=[o[0]*255,o[1]*255,o[2]*255]}return e.length>3?[i,a,s,e[3]]:[i,a,s,1]},Ue=(...e)=>{e=o(e,`rgba`);let[t,n,r]=e;t/=255,n/=255,r/=255;let i=l(t,n,r),a=u(t,n,r),s=(a+i)/2,c,d;return a===i?(c=0,d=NaN):c=s<.5?(a-i)/(a+i):(a-i)/(2-a-i),t==a?d=(n-r)/(a-i):n==a?d=2+(r-t)/(a-i):r==a&&(d=4+(t-n)/(a-i)),d*=60,d<0&&(d+=360),e.length>3&&e[3]!==void 0?[d,c,s,e[3]]:[d,c,s]};y.prototype.hsl=function(){return Ue(this._rgb)};const We=(...e)=>new y(...e,`hsl`);b.hsl=We,v.format.hsl=He,v.autodetect.push({p:2,test:(...e)=>{if(e=o(e,`hsl`),a(e)===`array`&&e.length===3)return`hsl`}});const Ge=(e,t,n)=>L(e,t,n,`hsl`);P.hsl=Ge;const{floor:Ke}=Math,qe=(...e)=>{e=o(e,`hsv`);let[t,n,r]=e,i,a,s;if(r*=255,n===0)i=a=s=r;else{t===360&&(t=0),t>360&&(t-=360),t<0&&(t+=360),t/=60;let e=Ke(t),o=t-e,c=r*(1-n),l=r*(1-n*o),u=r*(1-n*(1-o));switch(e){case 0:[i,a,s]=[r,u,c];break;case 1:[i,a,s]=[l,r,c];break;case 2:[i,a,s]=[c,r,u];break;case 3:[i,a,s]=[c,l,r];break;case 4:[i,a,s]=[u,c,r];break;case 5:[i,a,s]=[r,c,l];break}}return[i,a,s,e.length>3?e[3]:1]},{min:Je,max:Ye}=Math,Xe=(...e)=>{e=o(e,`rgb`);let[t,n,r]=e,i=Je(t,n,r),a=Ye(t,n,r),s=a-i,c,l,u;return u=a/255,a===0?(c=NaN,l=0):(l=s/a,t===a&&(c=(n-r)/s),n===a&&(c=2+(r-t)/s),r===a&&(c=4+(t-n)/s),c*=60,c<0&&(c+=360)),[c,l,u]};y.prototype.hsv=function(){return Xe(this._rgb)};const Ze=(...e)=>new y(...e,`hsv`);b.hsv=Ze,v.format.hsv=qe,v.autodetect.push({p:2,test:(...e)=>{if(e=o(e,`hsv`),a(e)===`array`&&e.length===3)return`hsv`}});const Qe=(e,t,n)=>L(e,t,n,`hsv`);P.hsv=Qe;function z(e,t){let n=e.length;Array.isArray(e[0])||(e=[e]),Array.isArray(t[0])||(t=t.map(e=>[e]));let r=t[0].length,i=t[0].map((e,n)=>t.map(e=>e[n])),a=e.map(e=>i.map(t=>Array.isArray(e)?e.reduce((e,n,r)=>e+n*(t[r]||0),0):t.reduce((t,n)=>t+n*e,0)));return n===1&&(a=a[0]),r===1?a.map(e=>e[0]):a}const $e=(...e)=>{e=o(e,`lab`);let[t,n,r,...i]=e,[a,s,c]=et([t,n,r]),[l,u,d]=te(a,s,c);return[l,u,d,...i.length>0&&i[0]<1?[i[0]]:[]]};function et(e){return z([[1.2268798758459243,-.5578149944602171,.2813910456659647],[-.0405757452148008,1.112286803280317,-.0717110580655164],[-.0763729366746601,-.4214933324022432,1.5869240198367816]],z([[1,.3963377773761749,.2158037573099136],[1,-.1055613458156586,-.0638541728258133],[1,-.0894841775298119,-1.2914855480194092]],e).map(e=>e**3))}const tt=(...e)=>{let[t,n,r,...i]=o(e,`rgb`);return[...nt(ie(t,n,r)),...i.length>0&&i[0]<1?[i[0]]:[]]};function nt(e){return z([[.210454268309314,.7936177747023054,-.0040720430116193],[1.9779985324311684,-2.42859224204858,.450593709617411],[.0259040424655478,.7827717124575296,-.8086757549230774]],z([[.819022437996703,.3619062600528904,-.1288737815209879],[.0329836539323885,.9292868615863434,.0361446663506424],[.0481771893596242,.2642395317527308,.6335478284694309]],e).map(e=>Math.cbrt(e)))}y.prototype.oklab=function(){return tt(this._rgb)};const rt=(...e)=>new y(...e,`oklab`);Object.assign(b,{oklab:rt}),v.format.oklab=$e,v.autodetect.push({p:2,test:(...e)=>{if(e=o(e,`oklab`),a(e)===`array`&&e.length===3)return`oklab`}});const it=(e,t,n)=>{let r=e.oklab(),i=t.oklab();return new y(r[0]+n*(i[0]-r[0]),r[1]+n*(i[1]-r[1]),r[2]+n*(i[2]-r[2]),`oklab`)};P.oklab=it;const at=(e,t,n)=>L(e,t,n,`oklch`);P.oklch=at;const{pow:ot,sqrt:st,PI:ct,cos:lt,sin:ut,atan2:dt}=Math;var ft=(e,t=`lrgb`,n=null)=>{let r=e.length;n||=Array.from(Array(r)).map(()=>1);let i=r/n.reduce(function(e,t){return e+t});if(n.forEach((e,t)=>{n[t]*=i}),e=e.map(e=>new y(e)),t===`lrgb`)return pt(e,n);let a=e.shift(),o=a.get(t),s=[],c=0,l=0;for(let e=0;e<o.length;e++)if(o[e]=(o[e]||0)*n[0],s.push(isNaN(o[e])?0:n[0]),t.charAt(e)===`h`&&!isNaN(o[e])){let t=o[e]/180*ct;c+=lt(t)*n[0],l+=ut(t)*n[0]}let u=a.alpha()*n[0];e.forEach((e,r)=>{let i=e.get(t);u+=e.alpha()*n[r+1];for(let e=0;e<o.length;e++)if(!isNaN(i[e]))if(s[e]+=n[r+1],t.charAt(e)===`h`){let t=i[e]/180*ct;c+=lt(t)*n[r+1],l+=ut(t)*n[r+1]}else o[e]+=i[e]*n[r+1]});for(let e=0;e<o.length;e++)if(t.charAt(e)===`h`){let t=dt(l/s[e],c/s[e])/ct*180;for(;t<0;)t+=360;for(;t>=360;)t-=360;o[e]=t}else o[e]=o[e]/s[e];return u/=r,new y(o,t).alpha(u>.99999?1:u,!0)};const pt=(e,t)=>{let n=e.length,i=[0,0,0,0];for(let r=0;r<e.length;r++){let a=e[r],o=t[r]/n,s=a._rgb;i[0]+=ot(s[0],2)*o,i[1]+=ot(s[1],2)*o,i[2]+=ot(s[2],2)*o,i[3]+=s[3]*o}return i[0]=st(i[0]),i[1]=st(i[1]),i[2]=st(i[2]),i[3]>.9999999&&(i[3]=1),new y(r(i))},{pow:mt}=Math;function B(e){let t=`rgb`,r=b(`#ccc`),i=0,o=[0,1],s=[0,1],c=[],l=[0,0],u=!1,d=[],f=!1,p=0,m=1,h=!1,g={},_=!0,v=1,y=function(e){if(e||=[`#fff`,`#000`],e&&a(e)===`string`&&b.brewer&&b.brewer[e.toLowerCase()]&&(e=b.brewer[e.toLowerCase()]),a(e)===`array`){e.length===1&&(e=[e[0],e[0]]),e=e.slice(0);for(let t=0;t<e.length;t++)e[t]=b(e[t]);c.length=0;for(let t=0;t<e.length;t++)c.push(t/(e.length-1))}return T(),d=e},x=function(e){if(u!=null){let t=u.length-1,n=0;for(;n<t&&e>=u[n];)n++;return n-1}return 0},S=e=>e,C=e=>e,w=function(e,i){let o,s;if(i??=!1,isNaN(e)||e===null)return r;s=i?e:u&&u.length>2?x(e)/(u.length-2):m===p?1:(e-p)/(m-p),s=C(s),i||(s=S(s)),v!==1&&(s=mt(s,v)),s=l[0]+s*(1-l[0]-l[1]),s=n(s,0,1);let f=Math.floor(s*1e4);if(_&&g[f])o=g[f];else{if(a(d)===`array`)for(let e=0;e<c.length;e++){let n=c[e];if(s<=n){o=d[e];break}if(s>=n&&e===c.length-1){o=d[e];break}if(s>n&&s<c[e+1]){s=(s-n)/(c[e+1]-n),o=b.interpolate(d[e],d[e+1],s,t);break}}else a(d)===`function`&&(o=d(s));_&&(g[f]=o)}return o};var T=()=>g={};y(e);let E=function(e){let t=b(w(e));return f&&t[f]?t[f]():t};return E.classes=function(e){if(e!=null){if(a(e)===`array`)u=e,o=[e[0],e[e.length-1]];else{let t=b.analyze(o);u=e===0?[t.min,t.max]:b.limits(t,`e`,e)}return E}return u},E.domain=function(e){if(!arguments.length)return s;s=e.slice(0),p=e[0],m=e[e.length-1],c=[];let t=d.length;if(e.length===t&&p!==m)for(let t of Array.from(e))c.push((t-p)/(m-p));else{for(let e=0;e<t;e++)c.push(e/(t-1));if(e.length>2){let t=e.map((t,n)=>n/(e.length-1)),n=e.map(e=>(e-p)/(m-p));n.every((e,n)=>t[n]===e)||(C=e=>{if(e<=0||e>=1)return e;let r=0;for(;e>=n[r+1];)r++;let i=(e-n[r])/(n[r+1]-n[r]);return t[r]+i*(t[r+1]-t[r])})}}return o=[p,m],E},E.mode=function(e){return arguments.length?(t=e,T(),E):t},E.range=function(e,t){return y(e,t),E},E.out=function(e){return f=e,E},E.spread=function(e){return arguments.length?(i=e,E):i},E.correctLightness=function(e){return e??=!0,h=e,T(),S=h?function(e){let t=w(0,!0).lab()[0],n=w(1,!0).lab()[0],r=t>n,i=w(e,!0).lab()[0],a=t+(n-t)*e,o=i-a,s=0,c=1,l=20;for(;Math.abs(o)>.01&&l-- >0;)(function(){return r&&(o*=-1),o<0?(s=e,e+=(c-e)*.5):(c=e,e+=(s-e)*.5),i=w(e,!0).lab()[0],o=i-a})();return e}:e=>e,E},E.padding=function(e){return e==null?l:(a(e)===`number`&&(e=[e,e]),l=e,E)},E.colors=function(t,n){arguments.length<2&&(n=`hex`);let r=[];if(arguments.length===0)r=d.slice(0);else if(t===1)r=[E(.5)];else if(t>1){let e=o[0],n=o[1]-e;r=ht(0,t,!1).map(r=>E(e+r/(t-1)*n))}else{e=[];let t=[];if(u&&u.length>2)for(let e=1,n=u.length,r=1<=n;r?e<n:e>n;r?e++:e--)t.push((u[e-1]+u[e])*.5);else t=o;r=t.map(e=>E(e))}return b[n]&&(r=r.map(e=>e[n]())),r},E.cache=function(e){return e==null?_:(_=e,E)},E.gamma=function(e){return e==null?v:(v=e,E)},E.nodata=function(e){return e==null?r:(r=b(e),E)},E}function ht(e,t,n){let r=[],i=e<t,a=n?i?t+1:t-1:t;for(let t=e;i?t<a:t>a;i?t++:t--)r.push(t);return r}const gt=function(e){let t=[1,1];for(let n=1;n<e;n++){let e=[1];for(let n=1;n<=t.length;n++)e[n]=(t[n]||0)+t[n-1];t=e}return t},_t=function(e){let t,n,r,i;if(e=e.map(e=>new y(e)),e.length===2)[n,r]=e.map(e=>e.lab()),t=function(e){return new y([0,1,2].map(t=>n[t]+e*(r[t]-n[t])),`lab`)};else if(e.length===3)[n,r,i]=e.map(e=>e.lab()),t=function(e){return new y([0,1,2].map(t=>(1-e)*(1-e)*n[t]+2*(1-e)*e*r[t]+e*e*i[t]),`lab`)};else if(e.length===4){let a;[n,r,i,a]=e.map(e=>e.lab()),t=function(e){return new y([0,1,2].map(t=>(1-e)*(1-e)*(1-e)*n[t]+3*(1-e)*(1-e)*e*r[t]+3*(1-e)*e*e*i[t]+e*e*e*a[t]),`lab`)}}else if(e.length>=5){let n,r,i;n=e.map(e=>e.lab()),i=e.length-1,r=gt(i),t=function(e){let t=1-e;return new y([0,1,2].map(a=>n.reduce((n,o,s)=>n+r[s]*t**(i-s)*e**s*o[a],0)),`lab`)}}else throw RangeError(`No point in running bezier with only one color.`);return t};var vt=e=>{let t=_t(e);return t.scale=()=>B(t),t};const{round:yt}=Math;y.prototype.rgb=function(e=!0){return e===!1?this._rgb.slice(0,3):this._rgb.slice(0,3).map(yt)},y.prototype.rgba=function(e=!0){return this._rgb.slice(0,4).map((t,n)=>n<3?e===!1?t:yt(t):t)};const bt=(...e)=>new y(...e,`rgb`);Object.assign(b,{rgb:bt}),v.format.rgb=(...e)=>{let t=o(e,`rgba`);return t[3]===void 0&&(t[3]=1),t},v.autodetect.push({p:3,test:(...e)=>{if(e=o(e,`rgba`),a(e)===`array`&&(e.length===3||e.length===4&&a(e[3])==`number`&&e[3]>=0&&e[3]<=1))return`rgb`}});const V=(e,t,n)=>{if(!V[n])throw Error(`unknown blend mode `+n);return V[n](e,t)},H=e=>(t,n)=>{let r=b(n).rgb(),i=b(t).rgb();return b.rgb(e(r,i))},U=e=>(t,n)=>{let r=[];return r[0]=e(t[0],n[0]),r[1]=e(t[1],n[1]),r[2]=e(t[2],n[2]),r},xt=e=>e,St=(e,t)=>e*t/255,Ct=(e,t)=>e>t?t:e,wt=(e,t)=>e>t?e:t,Tt=(e,t)=>255*(1-(1-e/255)*(1-t/255)),Et=(e,t)=>t<128?2*e*t/255:255*(1-2*(1-e/255)*(1-t/255)),Dt=(e,t)=>255*(1-(1-t/255)/(e/255)),Ot=(e,t)=>e===255?255:(e=t/255*255/(1-e/255),e>255?255:e);V.normal=H(U(xt)),V.multiply=H(U(St)),V.screen=H(U(Tt)),V.overlay=H(U(Et)),V.darken=H(U(Ct)),V.lighten=H(U(wt)),V.dodge=H(U(Ot)),V.burn=H(U(Dt));const{pow:kt,sin:At,cos:jt}=Math;function Mt(e=300,t=-1.5,n=1,i=1,o=[0,1]){let s=0,c;a(o)===`array`?c=o[1]-o[0]:(c=0,o=[o,o]);let l=function(a){let l=p*((e+120)/360+t*a),u=kt(o[0]+c*a,i),d=(s===0?n:n[0]+a*s)*u*(1-u)/2,f=jt(l),m=At(l),h=u+d*(-.14861*f+1.78277*m),g=u+d*(-.29227*f-.90649*m),_=u+1.97294*f*d;return b(r([h*255,g*255,_*255,1]))};return l.start=function(t){return t==null?e:(e=t,l)},l.rotations=function(e){return e==null?t:(t=e,l)},l.gamma=function(e){return e==null?i:(i=e,l)},l.hue=function(e){return e==null?n:(n=e,a(n)===`array`?(s=n[1]-n[0],s===0&&(n=n[1])):s=0,l)},l.lightness=function(e){return e==null?o:(a(e)===`array`?(o=e,c=e[1]-e[0]):(o=[e,e],c=0),l)},l.scale=()=>b.scale(l),l.hue(n),l}const{floor:Nt,random:Pt}=Math;var Ft=(e=Pt)=>{let t=`#`;for(let n=0;n<6;n++)t+=`0123456789abcdef`.charAt(Nt(e()*16));return new y(t,`hex`)};const{log:It,pow:Lt,floor:Rt,abs:zt}=Math;function Bt(e,t=null){let n={min:Number.MAX_VALUE,max:Number.MAX_VALUE*-1,sum:0,values:[],count:0};return a(e)===`object`&&(e=Object.values(e)),e.forEach(e=>{t&&a(e)===`object`&&(e=e[t]),e!=null&&!isNaN(e)&&(n.values.push(e),n.sum+=e,e<n.min&&(n.min=e),e>n.max&&(n.max=e),n.count+=1)}),n.domain=[n.min,n.max],n.limits=(e,t)=>Vt(n,e,t),n}function Vt(e,t=`equal`,n=7){a(e)==`array`&&(e=Bt(e));let{min:r,max:i}=e,o=e.values.sort((e,t)=>e-t);if(n===1)return[r,i];let s=[];if(t.substr(0,1)===`c`&&(s.push(r),s.push(i)),t.substr(0,1)===`e`){s.push(r);for(let e=1;e<n;e++)s.push(r+e/n*(i-r));s.push(i)}else if(t.substr(0,1)===`l`){if(r<=0)throw Error(`Logarithmic scales are only possible for values > 0`);let e=Math.LOG10E*It(r),t=Math.LOG10E*It(i);s.push(r);for(let r=1;r<n;r++)s.push(Lt(10,e+r/n*(t-e)));s.push(i)}else if(t.substr(0,1)===`q`){s.push(r);for(let e=1;e<n;e++){let t=(o.length-1)*e/n,r=Rt(t);if(r===t)s.push(o[r]);else{let e=t-r;s.push(o[r]*(1-e)+o[r+1]*e)}}s.push(i)}else if(t.substr(0,1)===`k`){let e,t=o.length,a=Array(t),c=Array(n),l=!0,u=0,d=null;d=[],d.push(r);for(let e=1;e<n;e++)d.push(r+e/n*(i-r));for(d.push(i);l;){for(let e=0;e<n;e++)c[e]=0;for(let e=0;e<t;e++){let t=o[e],r=Number.MAX_VALUE,i;for(let o=0;o<n;o++){let n=zt(d[o]-t);n<r&&(r=n,i=o),c[i]++,a[e]=i}}let r=Array(n);for(let e=0;e<n;e++)r[e]=null;for(let n=0;n<t;n++)e=a[n],r[e]===null?r[e]=o[n]:r[e]+=o[n];for(let e=0;e<n;e++)r[e]*=1/c[e];l=!1;for(let e=0;e<n;e++)if(r[e]!==d[e]){l=!0;break}d=r,u++,u>200&&(l=!1)}let f={};for(let e=0;e<n;e++)f[e]=[];for(let n=0;n<t;n++)e=a[n],f[e].push(o[n]);let p=[];for(let e=0;e<n;e++)p.push(f[e][0]),p.push(f[e][f[e].length-1]);p=p.sort((e,t)=>e-t),s.push(p[0]);for(let e=1;e<p.length;e+=2){let t=p[e];!isNaN(t)&&s.indexOf(t)===-1&&s.push(t)}}return s}var Ht=(e,t)=>{e=new y(e),t=new y(t);let n=e.luminance(),r=t.luminance();return n>r?(n+.05)/(r+.05):(r+.05)/(n+.05)};
|
|
2282
2
|
/**
|
|
2283
3
|
* @license
|
|
2284
4
|
*
|
|
@@ -2292,1125 +12,4 @@ var contrast_default = (a, b) => {
|
|
|
2292
12
|
* You can read more about the APCA Readability Criterion at
|
|
2293
13
|
* https://readtech.org/ARC/
|
|
2294
14
|
*/
|
|
2295
|
-
const W_offset = .027;
|
|
2296
|
-
const P_in = 5e-4;
|
|
2297
|
-
const P_out = .1;
|
|
2298
|
-
const R_scale = 1.14;
|
|
2299
|
-
const B_threshold = .022;
|
|
2300
|
-
const B_exp = 1.414;
|
|
2301
|
-
var contrastAPCA_default = (text, bg) => {
|
|
2302
|
-
text = new Color_default(text);
|
|
2303
|
-
bg = new Color_default(bg);
|
|
2304
|
-
if (text.alpha() < 1) text = mix_default(bg, text, text.alpha(), "rgb");
|
|
2305
|
-
const l_text = lum(...text.rgb());
|
|
2306
|
-
const l_bg = lum(...bg.rgb());
|
|
2307
|
-
const Y_text = l_text >= B_threshold ? l_text : l_text + Math.pow(B_threshold - l_text, B_exp);
|
|
2308
|
-
const Y_bg = l_bg >= B_threshold ? l_bg : l_bg + Math.pow(B_threshold - l_bg, B_exp);
|
|
2309
|
-
const S_norm = Math.pow(Y_bg, .56) - Math.pow(Y_text, .57);
|
|
2310
|
-
const S_rev = Math.pow(Y_bg, .65) - Math.pow(Y_text, .62);
|
|
2311
|
-
const C = Math.abs(Y_bg - Y_text) < P_in ? 0 : Y_text < Y_bg ? S_norm * R_scale : S_rev * R_scale;
|
|
2312
|
-
return (Math.abs(C) < P_out ? 0 : C > 0 ? C - W_offset : C + W_offset) * 100;
|
|
2313
|
-
};
|
|
2314
|
-
function lum(r, g, b) {
|
|
2315
|
-
return .2126729 * Math.pow(r / 255, 2.4) + .7151522 * Math.pow(g / 255, 2.4) + .072175 * Math.pow(b / 255, 2.4);
|
|
2316
|
-
}
|
|
2317
|
-
|
|
2318
|
-
//#endregion
|
|
2319
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/utils/delta-e.js
|
|
2320
|
-
const { sqrt, pow, min, max: max$1, atan2, abs, cos, sin, exp, PI } = Math;
|
|
2321
|
-
function delta_e_default(a, b, Kl = 1, Kc = 1, Kh = 1) {
|
|
2322
|
-
var rad2deg = function(rad) {
|
|
2323
|
-
return 360 * rad / (2 * PI);
|
|
2324
|
-
};
|
|
2325
|
-
var deg2rad = function(deg) {
|
|
2326
|
-
return 2 * PI * deg / 360;
|
|
2327
|
-
};
|
|
2328
|
-
a = new Color_default(a);
|
|
2329
|
-
b = new Color_default(b);
|
|
2330
|
-
const [L1, a1, b1] = Array.from(a.lab());
|
|
2331
|
-
const [L2, a2, b2] = Array.from(b.lab());
|
|
2332
|
-
const avgL = (L1 + L2) / 2;
|
|
2333
|
-
const avgC = (sqrt(pow(a1, 2) + pow(b1, 2)) + sqrt(pow(a2, 2) + pow(b2, 2))) / 2;
|
|
2334
|
-
const G = .5 * (1 - sqrt(pow(avgC, 7) / (pow(avgC, 7) + pow(25, 7))));
|
|
2335
|
-
const a1p = a1 * (1 + G);
|
|
2336
|
-
const a2p = a2 * (1 + G);
|
|
2337
|
-
const C1p = sqrt(pow(a1p, 2) + pow(b1, 2));
|
|
2338
|
-
const C2p = sqrt(pow(a2p, 2) + pow(b2, 2));
|
|
2339
|
-
const avgCp = (C1p + C2p) / 2;
|
|
2340
|
-
const arctan1 = rad2deg(atan2(b1, a1p));
|
|
2341
|
-
const arctan2 = rad2deg(atan2(b2, a2p));
|
|
2342
|
-
const h1p = arctan1 >= 0 ? arctan1 : arctan1 + 360;
|
|
2343
|
-
const h2p = arctan2 >= 0 ? arctan2 : arctan2 + 360;
|
|
2344
|
-
const avgHp = abs(h1p - h2p) > 180 ? (h1p + h2p + 360) / 2 : (h1p + h2p) / 2;
|
|
2345
|
-
const T = 1 - .17 * cos(deg2rad(avgHp - 30)) + .24 * cos(deg2rad(2 * avgHp)) + .32 * cos(deg2rad(3 * avgHp + 6)) - .2 * cos(deg2rad(4 * avgHp - 63));
|
|
2346
|
-
let deltaHp = h2p - h1p;
|
|
2347
|
-
deltaHp = abs(deltaHp) <= 180 ? deltaHp : h2p <= h1p ? deltaHp + 360 : deltaHp - 360;
|
|
2348
|
-
deltaHp = 2 * sqrt(C1p * C2p) * sin(deg2rad(deltaHp) / 2);
|
|
2349
|
-
const deltaL = L2 - L1;
|
|
2350
|
-
const deltaCp = C2p - C1p;
|
|
2351
|
-
const sl = 1 + .015 * pow(avgL - 50, 2) / sqrt(20 + pow(avgL - 50, 2));
|
|
2352
|
-
const sc = 1 + .045 * avgCp;
|
|
2353
|
-
const sh = 1 + .015 * avgCp * T;
|
|
2354
|
-
const deltaTheta = 30 * exp(-pow((avgHp - 275) / 25, 2));
|
|
2355
|
-
const Rt = -(2 * sqrt(pow(avgCp, 7) / (pow(avgCp, 7) + pow(25, 7)))) * sin(2 * deg2rad(deltaTheta));
|
|
2356
|
-
return max$1(0, min(100, sqrt(pow(deltaL / (Kl * sl), 2) + pow(deltaCp / (Kc * sc), 2) + pow(deltaHp / (Kh * sh), 2) + Rt * (deltaCp / (Kc * sc)) * (deltaHp / (Kh * sh)))));
|
|
2357
|
-
}
|
|
2358
|
-
|
|
2359
|
-
//#endregion
|
|
2360
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/utils/distance.js
|
|
2361
|
-
function distance_default(a, b, mode = "lab") {
|
|
2362
|
-
a = new Color_default(a);
|
|
2363
|
-
b = new Color_default(b);
|
|
2364
|
-
const l1 = a.get(mode);
|
|
2365
|
-
const l2 = b.get(mode);
|
|
2366
|
-
let sum_sq = 0;
|
|
2367
|
-
for (let i in l1) {
|
|
2368
|
-
const d = (l1[i] || 0) - (l2[i] || 0);
|
|
2369
|
-
sum_sq += d * d;
|
|
2370
|
-
}
|
|
2371
|
-
return Math.sqrt(sum_sq);
|
|
2372
|
-
}
|
|
2373
|
-
|
|
2374
|
-
//#endregion
|
|
2375
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/utils/valid.js
|
|
2376
|
-
var valid_default = (...args) => {
|
|
2377
|
-
try {
|
|
2378
|
-
new Color_default(...args);
|
|
2379
|
-
return true;
|
|
2380
|
-
} catch (e) {
|
|
2381
|
-
return false;
|
|
2382
|
-
}
|
|
2383
|
-
};
|
|
2384
|
-
|
|
2385
|
-
//#endregion
|
|
2386
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/utils/scales.js
|
|
2387
|
-
var scales_default = {
|
|
2388
|
-
cool() {
|
|
2389
|
-
return scale_default([chroma_default.hsl(180, 1, .9), chroma_default.hsl(250, .7, .4)]);
|
|
2390
|
-
},
|
|
2391
|
-
hot() {
|
|
2392
|
-
return scale_default([
|
|
2393
|
-
"#000",
|
|
2394
|
-
"#f00",
|
|
2395
|
-
"#ff0",
|
|
2396
|
-
"#fff"
|
|
2397
|
-
], [
|
|
2398
|
-
0,
|
|
2399
|
-
.25,
|
|
2400
|
-
.75,
|
|
2401
|
-
1
|
|
2402
|
-
]).mode("rgb");
|
|
2403
|
-
}
|
|
2404
|
-
};
|
|
2405
|
-
|
|
2406
|
-
//#endregion
|
|
2407
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/colors/colorbrewer.js
|
|
2408
|
-
/**
|
|
2409
|
-
ColorBrewer colors for chroma.js
|
|
2410
|
-
|
|
2411
|
-
Copyright (c) 2002 Cynthia Brewer, Mark Harrower, and The
|
|
2412
|
-
Pennsylvania State University.
|
|
2413
|
-
|
|
2414
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
2415
|
-
you may not use this file except in compliance with the License.
|
|
2416
|
-
You may obtain a copy of the License at
|
|
2417
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
2418
|
-
|
|
2419
|
-
Unless required by applicable law or agreed to in writing, software distributed
|
|
2420
|
-
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
2421
|
-
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
2422
|
-
specific language governing permissions and limitations under the License.
|
|
2423
|
-
*/
|
|
2424
|
-
const colorbrewer = {
|
|
2425
|
-
OrRd: [
|
|
2426
|
-
"#fff7ec",
|
|
2427
|
-
"#fee8c8",
|
|
2428
|
-
"#fdd49e",
|
|
2429
|
-
"#fdbb84",
|
|
2430
|
-
"#fc8d59",
|
|
2431
|
-
"#ef6548",
|
|
2432
|
-
"#d7301f",
|
|
2433
|
-
"#b30000",
|
|
2434
|
-
"#7f0000"
|
|
2435
|
-
],
|
|
2436
|
-
PuBu: [
|
|
2437
|
-
"#fff7fb",
|
|
2438
|
-
"#ece7f2",
|
|
2439
|
-
"#d0d1e6",
|
|
2440
|
-
"#a6bddb",
|
|
2441
|
-
"#74a9cf",
|
|
2442
|
-
"#3690c0",
|
|
2443
|
-
"#0570b0",
|
|
2444
|
-
"#045a8d",
|
|
2445
|
-
"#023858"
|
|
2446
|
-
],
|
|
2447
|
-
BuPu: [
|
|
2448
|
-
"#f7fcfd",
|
|
2449
|
-
"#e0ecf4",
|
|
2450
|
-
"#bfd3e6",
|
|
2451
|
-
"#9ebcda",
|
|
2452
|
-
"#8c96c6",
|
|
2453
|
-
"#8c6bb1",
|
|
2454
|
-
"#88419d",
|
|
2455
|
-
"#810f7c",
|
|
2456
|
-
"#4d004b"
|
|
2457
|
-
],
|
|
2458
|
-
Oranges: [
|
|
2459
|
-
"#fff5eb",
|
|
2460
|
-
"#fee6ce",
|
|
2461
|
-
"#fdd0a2",
|
|
2462
|
-
"#fdae6b",
|
|
2463
|
-
"#fd8d3c",
|
|
2464
|
-
"#f16913",
|
|
2465
|
-
"#d94801",
|
|
2466
|
-
"#a63603",
|
|
2467
|
-
"#7f2704"
|
|
2468
|
-
],
|
|
2469
|
-
BuGn: [
|
|
2470
|
-
"#f7fcfd",
|
|
2471
|
-
"#e5f5f9",
|
|
2472
|
-
"#ccece6",
|
|
2473
|
-
"#99d8c9",
|
|
2474
|
-
"#66c2a4",
|
|
2475
|
-
"#41ae76",
|
|
2476
|
-
"#238b45",
|
|
2477
|
-
"#006d2c",
|
|
2478
|
-
"#00441b"
|
|
2479
|
-
],
|
|
2480
|
-
YlOrBr: [
|
|
2481
|
-
"#ffffe5",
|
|
2482
|
-
"#fff7bc",
|
|
2483
|
-
"#fee391",
|
|
2484
|
-
"#fec44f",
|
|
2485
|
-
"#fe9929",
|
|
2486
|
-
"#ec7014",
|
|
2487
|
-
"#cc4c02",
|
|
2488
|
-
"#993404",
|
|
2489
|
-
"#662506"
|
|
2490
|
-
],
|
|
2491
|
-
YlGn: [
|
|
2492
|
-
"#ffffe5",
|
|
2493
|
-
"#f7fcb9",
|
|
2494
|
-
"#d9f0a3",
|
|
2495
|
-
"#addd8e",
|
|
2496
|
-
"#78c679",
|
|
2497
|
-
"#41ab5d",
|
|
2498
|
-
"#238443",
|
|
2499
|
-
"#006837",
|
|
2500
|
-
"#004529"
|
|
2501
|
-
],
|
|
2502
|
-
Reds: [
|
|
2503
|
-
"#fff5f0",
|
|
2504
|
-
"#fee0d2",
|
|
2505
|
-
"#fcbba1",
|
|
2506
|
-
"#fc9272",
|
|
2507
|
-
"#fb6a4a",
|
|
2508
|
-
"#ef3b2c",
|
|
2509
|
-
"#cb181d",
|
|
2510
|
-
"#a50f15",
|
|
2511
|
-
"#67000d"
|
|
2512
|
-
],
|
|
2513
|
-
RdPu: [
|
|
2514
|
-
"#fff7f3",
|
|
2515
|
-
"#fde0dd",
|
|
2516
|
-
"#fcc5c0",
|
|
2517
|
-
"#fa9fb5",
|
|
2518
|
-
"#f768a1",
|
|
2519
|
-
"#dd3497",
|
|
2520
|
-
"#ae017e",
|
|
2521
|
-
"#7a0177",
|
|
2522
|
-
"#49006a"
|
|
2523
|
-
],
|
|
2524
|
-
Greens: [
|
|
2525
|
-
"#f7fcf5",
|
|
2526
|
-
"#e5f5e0",
|
|
2527
|
-
"#c7e9c0",
|
|
2528
|
-
"#a1d99b",
|
|
2529
|
-
"#74c476",
|
|
2530
|
-
"#41ab5d",
|
|
2531
|
-
"#238b45",
|
|
2532
|
-
"#006d2c",
|
|
2533
|
-
"#00441b"
|
|
2534
|
-
],
|
|
2535
|
-
YlGnBu: [
|
|
2536
|
-
"#ffffd9",
|
|
2537
|
-
"#edf8b1",
|
|
2538
|
-
"#c7e9b4",
|
|
2539
|
-
"#7fcdbb",
|
|
2540
|
-
"#41b6c4",
|
|
2541
|
-
"#1d91c0",
|
|
2542
|
-
"#225ea8",
|
|
2543
|
-
"#253494",
|
|
2544
|
-
"#081d58"
|
|
2545
|
-
],
|
|
2546
|
-
Purples: [
|
|
2547
|
-
"#fcfbfd",
|
|
2548
|
-
"#efedf5",
|
|
2549
|
-
"#dadaeb",
|
|
2550
|
-
"#bcbddc",
|
|
2551
|
-
"#9e9ac8",
|
|
2552
|
-
"#807dba",
|
|
2553
|
-
"#6a51a3",
|
|
2554
|
-
"#54278f",
|
|
2555
|
-
"#3f007d"
|
|
2556
|
-
],
|
|
2557
|
-
GnBu: [
|
|
2558
|
-
"#f7fcf0",
|
|
2559
|
-
"#e0f3db",
|
|
2560
|
-
"#ccebc5",
|
|
2561
|
-
"#a8ddb5",
|
|
2562
|
-
"#7bccc4",
|
|
2563
|
-
"#4eb3d3",
|
|
2564
|
-
"#2b8cbe",
|
|
2565
|
-
"#0868ac",
|
|
2566
|
-
"#084081"
|
|
2567
|
-
],
|
|
2568
|
-
Greys: [
|
|
2569
|
-
"#ffffff",
|
|
2570
|
-
"#f0f0f0",
|
|
2571
|
-
"#d9d9d9",
|
|
2572
|
-
"#bdbdbd",
|
|
2573
|
-
"#969696",
|
|
2574
|
-
"#737373",
|
|
2575
|
-
"#525252",
|
|
2576
|
-
"#252525",
|
|
2577
|
-
"#000000"
|
|
2578
|
-
],
|
|
2579
|
-
YlOrRd: [
|
|
2580
|
-
"#ffffcc",
|
|
2581
|
-
"#ffeda0",
|
|
2582
|
-
"#fed976",
|
|
2583
|
-
"#feb24c",
|
|
2584
|
-
"#fd8d3c",
|
|
2585
|
-
"#fc4e2a",
|
|
2586
|
-
"#e31a1c",
|
|
2587
|
-
"#bd0026",
|
|
2588
|
-
"#800026"
|
|
2589
|
-
],
|
|
2590
|
-
PuRd: [
|
|
2591
|
-
"#f7f4f9",
|
|
2592
|
-
"#e7e1ef",
|
|
2593
|
-
"#d4b9da",
|
|
2594
|
-
"#c994c7",
|
|
2595
|
-
"#df65b0",
|
|
2596
|
-
"#e7298a",
|
|
2597
|
-
"#ce1256",
|
|
2598
|
-
"#980043",
|
|
2599
|
-
"#67001f"
|
|
2600
|
-
],
|
|
2601
|
-
Blues: [
|
|
2602
|
-
"#f7fbff",
|
|
2603
|
-
"#deebf7",
|
|
2604
|
-
"#c6dbef",
|
|
2605
|
-
"#9ecae1",
|
|
2606
|
-
"#6baed6",
|
|
2607
|
-
"#4292c6",
|
|
2608
|
-
"#2171b5",
|
|
2609
|
-
"#08519c",
|
|
2610
|
-
"#08306b"
|
|
2611
|
-
],
|
|
2612
|
-
PuBuGn: [
|
|
2613
|
-
"#fff7fb",
|
|
2614
|
-
"#ece2f0",
|
|
2615
|
-
"#d0d1e6",
|
|
2616
|
-
"#a6bddb",
|
|
2617
|
-
"#67a9cf",
|
|
2618
|
-
"#3690c0",
|
|
2619
|
-
"#02818a",
|
|
2620
|
-
"#016c59",
|
|
2621
|
-
"#014636"
|
|
2622
|
-
],
|
|
2623
|
-
Viridis: [
|
|
2624
|
-
"#440154",
|
|
2625
|
-
"#482777",
|
|
2626
|
-
"#3f4a8a",
|
|
2627
|
-
"#31678e",
|
|
2628
|
-
"#26838f",
|
|
2629
|
-
"#1f9d8a",
|
|
2630
|
-
"#6cce5a",
|
|
2631
|
-
"#b6de2b",
|
|
2632
|
-
"#fee825"
|
|
2633
|
-
],
|
|
2634
|
-
Spectral: [
|
|
2635
|
-
"#9e0142",
|
|
2636
|
-
"#d53e4f",
|
|
2637
|
-
"#f46d43",
|
|
2638
|
-
"#fdae61",
|
|
2639
|
-
"#fee08b",
|
|
2640
|
-
"#ffffbf",
|
|
2641
|
-
"#e6f598",
|
|
2642
|
-
"#abdda4",
|
|
2643
|
-
"#66c2a5",
|
|
2644
|
-
"#3288bd",
|
|
2645
|
-
"#5e4fa2"
|
|
2646
|
-
],
|
|
2647
|
-
RdYlGn: [
|
|
2648
|
-
"#a50026",
|
|
2649
|
-
"#d73027",
|
|
2650
|
-
"#f46d43",
|
|
2651
|
-
"#fdae61",
|
|
2652
|
-
"#fee08b",
|
|
2653
|
-
"#ffffbf",
|
|
2654
|
-
"#d9ef8b",
|
|
2655
|
-
"#a6d96a",
|
|
2656
|
-
"#66bd63",
|
|
2657
|
-
"#1a9850",
|
|
2658
|
-
"#006837"
|
|
2659
|
-
],
|
|
2660
|
-
RdBu: [
|
|
2661
|
-
"#67001f",
|
|
2662
|
-
"#b2182b",
|
|
2663
|
-
"#d6604d",
|
|
2664
|
-
"#f4a582",
|
|
2665
|
-
"#fddbc7",
|
|
2666
|
-
"#f7f7f7",
|
|
2667
|
-
"#d1e5f0",
|
|
2668
|
-
"#92c5de",
|
|
2669
|
-
"#4393c3",
|
|
2670
|
-
"#2166ac",
|
|
2671
|
-
"#053061"
|
|
2672
|
-
],
|
|
2673
|
-
PiYG: [
|
|
2674
|
-
"#8e0152",
|
|
2675
|
-
"#c51b7d",
|
|
2676
|
-
"#de77ae",
|
|
2677
|
-
"#f1b6da",
|
|
2678
|
-
"#fde0ef",
|
|
2679
|
-
"#f7f7f7",
|
|
2680
|
-
"#e6f5d0",
|
|
2681
|
-
"#b8e186",
|
|
2682
|
-
"#7fbc41",
|
|
2683
|
-
"#4d9221",
|
|
2684
|
-
"#276419"
|
|
2685
|
-
],
|
|
2686
|
-
PRGn: [
|
|
2687
|
-
"#40004b",
|
|
2688
|
-
"#762a83",
|
|
2689
|
-
"#9970ab",
|
|
2690
|
-
"#c2a5cf",
|
|
2691
|
-
"#e7d4e8",
|
|
2692
|
-
"#f7f7f7",
|
|
2693
|
-
"#d9f0d3",
|
|
2694
|
-
"#a6dba0",
|
|
2695
|
-
"#5aae61",
|
|
2696
|
-
"#1b7837",
|
|
2697
|
-
"#00441b"
|
|
2698
|
-
],
|
|
2699
|
-
RdYlBu: [
|
|
2700
|
-
"#a50026",
|
|
2701
|
-
"#d73027",
|
|
2702
|
-
"#f46d43",
|
|
2703
|
-
"#fdae61",
|
|
2704
|
-
"#fee090",
|
|
2705
|
-
"#ffffbf",
|
|
2706
|
-
"#e0f3f8",
|
|
2707
|
-
"#abd9e9",
|
|
2708
|
-
"#74add1",
|
|
2709
|
-
"#4575b4",
|
|
2710
|
-
"#313695"
|
|
2711
|
-
],
|
|
2712
|
-
BrBG: [
|
|
2713
|
-
"#543005",
|
|
2714
|
-
"#8c510a",
|
|
2715
|
-
"#bf812d",
|
|
2716
|
-
"#dfc27d",
|
|
2717
|
-
"#f6e8c3",
|
|
2718
|
-
"#f5f5f5",
|
|
2719
|
-
"#c7eae5",
|
|
2720
|
-
"#80cdc1",
|
|
2721
|
-
"#35978f",
|
|
2722
|
-
"#01665e",
|
|
2723
|
-
"#003c30"
|
|
2724
|
-
],
|
|
2725
|
-
RdGy: [
|
|
2726
|
-
"#67001f",
|
|
2727
|
-
"#b2182b",
|
|
2728
|
-
"#d6604d",
|
|
2729
|
-
"#f4a582",
|
|
2730
|
-
"#fddbc7",
|
|
2731
|
-
"#ffffff",
|
|
2732
|
-
"#e0e0e0",
|
|
2733
|
-
"#bababa",
|
|
2734
|
-
"#878787",
|
|
2735
|
-
"#4d4d4d",
|
|
2736
|
-
"#1a1a1a"
|
|
2737
|
-
],
|
|
2738
|
-
PuOr: [
|
|
2739
|
-
"#7f3b08",
|
|
2740
|
-
"#b35806",
|
|
2741
|
-
"#e08214",
|
|
2742
|
-
"#fdb863",
|
|
2743
|
-
"#fee0b6",
|
|
2744
|
-
"#f7f7f7",
|
|
2745
|
-
"#d8daeb",
|
|
2746
|
-
"#b2abd2",
|
|
2747
|
-
"#8073ac",
|
|
2748
|
-
"#542788",
|
|
2749
|
-
"#2d004b"
|
|
2750
|
-
],
|
|
2751
|
-
Set2: [
|
|
2752
|
-
"#66c2a5",
|
|
2753
|
-
"#fc8d62",
|
|
2754
|
-
"#8da0cb",
|
|
2755
|
-
"#e78ac3",
|
|
2756
|
-
"#a6d854",
|
|
2757
|
-
"#ffd92f",
|
|
2758
|
-
"#e5c494",
|
|
2759
|
-
"#b3b3b3"
|
|
2760
|
-
],
|
|
2761
|
-
Accent: [
|
|
2762
|
-
"#7fc97f",
|
|
2763
|
-
"#beaed4",
|
|
2764
|
-
"#fdc086",
|
|
2765
|
-
"#ffff99",
|
|
2766
|
-
"#386cb0",
|
|
2767
|
-
"#f0027f",
|
|
2768
|
-
"#bf5b17",
|
|
2769
|
-
"#666666"
|
|
2770
|
-
],
|
|
2771
|
-
Set1: [
|
|
2772
|
-
"#e41a1c",
|
|
2773
|
-
"#377eb8",
|
|
2774
|
-
"#4daf4a",
|
|
2775
|
-
"#984ea3",
|
|
2776
|
-
"#ff7f00",
|
|
2777
|
-
"#ffff33",
|
|
2778
|
-
"#a65628",
|
|
2779
|
-
"#f781bf",
|
|
2780
|
-
"#999999"
|
|
2781
|
-
],
|
|
2782
|
-
Set3: [
|
|
2783
|
-
"#8dd3c7",
|
|
2784
|
-
"#ffffb3",
|
|
2785
|
-
"#bebada",
|
|
2786
|
-
"#fb8072",
|
|
2787
|
-
"#80b1d3",
|
|
2788
|
-
"#fdb462",
|
|
2789
|
-
"#b3de69",
|
|
2790
|
-
"#fccde5",
|
|
2791
|
-
"#d9d9d9",
|
|
2792
|
-
"#bc80bd",
|
|
2793
|
-
"#ccebc5",
|
|
2794
|
-
"#ffed6f"
|
|
2795
|
-
],
|
|
2796
|
-
Dark2: [
|
|
2797
|
-
"#1b9e77",
|
|
2798
|
-
"#d95f02",
|
|
2799
|
-
"#7570b3",
|
|
2800
|
-
"#e7298a",
|
|
2801
|
-
"#66a61e",
|
|
2802
|
-
"#e6ab02",
|
|
2803
|
-
"#a6761d",
|
|
2804
|
-
"#666666"
|
|
2805
|
-
],
|
|
2806
|
-
Paired: [
|
|
2807
|
-
"#a6cee3",
|
|
2808
|
-
"#1f78b4",
|
|
2809
|
-
"#b2df8a",
|
|
2810
|
-
"#33a02c",
|
|
2811
|
-
"#fb9a99",
|
|
2812
|
-
"#e31a1c",
|
|
2813
|
-
"#fdbf6f",
|
|
2814
|
-
"#ff7f00",
|
|
2815
|
-
"#cab2d6",
|
|
2816
|
-
"#6a3d9a",
|
|
2817
|
-
"#ffff99",
|
|
2818
|
-
"#b15928"
|
|
2819
|
-
],
|
|
2820
|
-
Pastel2: [
|
|
2821
|
-
"#b3e2cd",
|
|
2822
|
-
"#fdcdac",
|
|
2823
|
-
"#cbd5e8",
|
|
2824
|
-
"#f4cae4",
|
|
2825
|
-
"#e6f5c9",
|
|
2826
|
-
"#fff2ae",
|
|
2827
|
-
"#f1e2cc",
|
|
2828
|
-
"#cccccc"
|
|
2829
|
-
],
|
|
2830
|
-
Pastel1: [
|
|
2831
|
-
"#fbb4ae",
|
|
2832
|
-
"#b3cde3",
|
|
2833
|
-
"#ccebc5",
|
|
2834
|
-
"#decbe4",
|
|
2835
|
-
"#fed9a6",
|
|
2836
|
-
"#ffffcc",
|
|
2837
|
-
"#e5d8bd",
|
|
2838
|
-
"#fddaec",
|
|
2839
|
-
"#f2f2f2"
|
|
2840
|
-
]
|
|
2841
|
-
};
|
|
2842
|
-
const colorbrewerTypes = Object.keys(colorbrewer);
|
|
2843
|
-
const typeMap = new Map(colorbrewerTypes.map((key) => [key.toLowerCase(), key]));
|
|
2844
|
-
const colorbrewerProxy = typeof Proxy === "function" ? new Proxy(colorbrewer, {
|
|
2845
|
-
get(target, prop) {
|
|
2846
|
-
const lower = prop.toLowerCase();
|
|
2847
|
-
if (typeMap.has(lower)) return target[typeMap.get(lower)];
|
|
2848
|
-
},
|
|
2849
|
-
getOwnPropertyNames() {
|
|
2850
|
-
return Object.getOwnPropertyNames(colorbrewerTypes);
|
|
2851
|
-
}
|
|
2852
|
-
}) : colorbrewer;
|
|
2853
|
-
var colorbrewer_default = colorbrewerProxy;
|
|
2854
|
-
|
|
2855
|
-
//#endregion
|
|
2856
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/io/cmyk/cmyk2rgb.js
|
|
2857
|
-
const cmyk2rgb = (...args) => {
|
|
2858
|
-
args = unpack_default(args, "cmyk");
|
|
2859
|
-
const [c, m, y, k] = args;
|
|
2860
|
-
const alpha = args.length > 4 ? args[4] : 1;
|
|
2861
|
-
if (k === 1) return [
|
|
2862
|
-
0,
|
|
2863
|
-
0,
|
|
2864
|
-
0,
|
|
2865
|
-
alpha
|
|
2866
|
-
];
|
|
2867
|
-
return [
|
|
2868
|
-
c >= 1 ? 0 : 255 * (1 - c) * (1 - k),
|
|
2869
|
-
m >= 1 ? 0 : 255 * (1 - m) * (1 - k),
|
|
2870
|
-
y >= 1 ? 0 : 255 * (1 - y) * (1 - k),
|
|
2871
|
-
alpha
|
|
2872
|
-
];
|
|
2873
|
-
};
|
|
2874
|
-
var cmyk2rgb_default = cmyk2rgb;
|
|
2875
|
-
|
|
2876
|
-
//#endregion
|
|
2877
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/io/cmyk/rgb2cmyk.js
|
|
2878
|
-
const { max } = Math;
|
|
2879
|
-
const rgb2cmyk = (...args) => {
|
|
2880
|
-
let [r, g, b] = unpack_default(args, "rgb");
|
|
2881
|
-
r = r / 255;
|
|
2882
|
-
g = g / 255;
|
|
2883
|
-
b = b / 255;
|
|
2884
|
-
const k = 1 - max(r, max(g, b));
|
|
2885
|
-
const f = k < 1 ? 1 / (1 - k) : 0;
|
|
2886
|
-
return [
|
|
2887
|
-
(1 - r - k) * f,
|
|
2888
|
-
(1 - g - k) * f,
|
|
2889
|
-
(1 - b - k) * f,
|
|
2890
|
-
k
|
|
2891
|
-
];
|
|
2892
|
-
};
|
|
2893
|
-
var rgb2cmyk_default = rgb2cmyk;
|
|
2894
|
-
|
|
2895
|
-
//#endregion
|
|
2896
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/io/cmyk/index.js
|
|
2897
|
-
Color_default.prototype.cmyk = function() {
|
|
2898
|
-
return rgb2cmyk_default(this._rgb);
|
|
2899
|
-
};
|
|
2900
|
-
const cmyk = (...args) => new Color_default(...args, "cmyk");
|
|
2901
|
-
Object.assign(chroma_default, { cmyk });
|
|
2902
|
-
input_default.format.cmyk = cmyk2rgb_default;
|
|
2903
|
-
input_default.autodetect.push({
|
|
2904
|
-
p: 2,
|
|
2905
|
-
test: (...args) => {
|
|
2906
|
-
args = unpack_default(args, "cmyk");
|
|
2907
|
-
if (type_default(args) === "array" && args.length === 4) return "cmyk";
|
|
2908
|
-
}
|
|
2909
|
-
});
|
|
2910
|
-
|
|
2911
|
-
//#endregion
|
|
2912
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/io/css/hsl2css.js
|
|
2913
|
-
const hsl2css = (...args) => {
|
|
2914
|
-
const hsla = unpack_default(args, "hsla");
|
|
2915
|
-
let mode = last_default(args) || "lsa";
|
|
2916
|
-
hsla[0] = rnd2(hsla[0] || 0) + "deg";
|
|
2917
|
-
hsla[1] = rnd2(hsla[1] * 100) + "%";
|
|
2918
|
-
hsla[2] = rnd2(hsla[2] * 100) + "%";
|
|
2919
|
-
if (mode === "hsla" || hsla.length > 3 && hsla[3] < 1) {
|
|
2920
|
-
hsla[3] = "/ " + (hsla.length > 3 ? hsla[3] : 1);
|
|
2921
|
-
mode = "hsla";
|
|
2922
|
-
} else hsla.length = 3;
|
|
2923
|
-
return `${mode.substr(0, 3)}(${hsla.join(" ")})`;
|
|
2924
|
-
};
|
|
2925
|
-
var hsl2css_default = hsl2css;
|
|
2926
|
-
|
|
2927
|
-
//#endregion
|
|
2928
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/io/css/lab2css.js
|
|
2929
|
-
const lab2css = (...args) => {
|
|
2930
|
-
const laba = unpack_default(args, "lab");
|
|
2931
|
-
let mode = last_default(args) || "lab";
|
|
2932
|
-
laba[0] = rnd2(laba[0]) + "%";
|
|
2933
|
-
laba[1] = rnd2(laba[1]);
|
|
2934
|
-
laba[2] = rnd2(laba[2]);
|
|
2935
|
-
if (mode === "laba" || laba.length > 3 && laba[3] < 1) laba[3] = "/ " + (laba.length > 3 ? laba[3] : 1);
|
|
2936
|
-
else laba.length = 3;
|
|
2937
|
-
return `lab(${laba.join(" ")})`;
|
|
2938
|
-
};
|
|
2939
|
-
var lab2css_default = lab2css;
|
|
2940
|
-
|
|
2941
|
-
//#endregion
|
|
2942
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/io/css/lch2css.js
|
|
2943
|
-
const lch2css = (...args) => {
|
|
2944
|
-
const lcha = unpack_default(args, "lch");
|
|
2945
|
-
let mode = last_default(args) || "lab";
|
|
2946
|
-
lcha[0] = rnd2(lcha[0]) + "%";
|
|
2947
|
-
lcha[1] = rnd2(lcha[1]);
|
|
2948
|
-
lcha[2] = isNaN(lcha[2]) ? "none" : rnd2(lcha[2]) + "deg";
|
|
2949
|
-
if (mode === "lcha" || lcha.length > 3 && lcha[3] < 1) lcha[3] = "/ " + (lcha.length > 3 ? lcha[3] : 1);
|
|
2950
|
-
else lcha.length = 3;
|
|
2951
|
-
return `lch(${lcha.join(" ")})`;
|
|
2952
|
-
};
|
|
2953
|
-
var lch2css_default = lch2css;
|
|
2954
|
-
|
|
2955
|
-
//#endregion
|
|
2956
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/io/css/oklab2css.js
|
|
2957
|
-
const oklab2css = (...args) => {
|
|
2958
|
-
const laba = unpack_default(args, "lab");
|
|
2959
|
-
laba[0] = rnd2(laba[0] * 100) + "%";
|
|
2960
|
-
laba[1] = rnd3(laba[1]);
|
|
2961
|
-
laba[2] = rnd3(laba[2]);
|
|
2962
|
-
if (laba.length > 3 && laba[3] < 1) laba[3] = "/ " + (laba.length > 3 ? laba[3] : 1);
|
|
2963
|
-
else laba.length = 3;
|
|
2964
|
-
return `oklab(${laba.join(" ")})`;
|
|
2965
|
-
};
|
|
2966
|
-
var oklab2css_default = oklab2css;
|
|
2967
|
-
|
|
2968
|
-
//#endregion
|
|
2969
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/io/oklch/rgb2oklch.js
|
|
2970
|
-
const rgb2oklch = (...args) => {
|
|
2971
|
-
const [r, g, b, ...rest] = unpack_default(args, "rgb");
|
|
2972
|
-
const [l, a, b_] = rgb2oklab_default(r, g, b);
|
|
2973
|
-
const [L, c, h] = lab2lch_default(l, a, b_);
|
|
2974
|
-
return [
|
|
2975
|
-
L,
|
|
2976
|
-
c,
|
|
2977
|
-
h,
|
|
2978
|
-
...rest.length > 0 && rest[0] < 1 ? [rest[0]] : []
|
|
2979
|
-
];
|
|
2980
|
-
};
|
|
2981
|
-
var rgb2oklch_default = rgb2oklch;
|
|
2982
|
-
|
|
2983
|
-
//#endregion
|
|
2984
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/io/css/oklch2css.js
|
|
2985
|
-
const oklch2css = (...args) => {
|
|
2986
|
-
const lcha = unpack_default(args, "lch");
|
|
2987
|
-
lcha[0] = rnd2(lcha[0] * 100) + "%";
|
|
2988
|
-
lcha[1] = rnd3(lcha[1]);
|
|
2989
|
-
lcha[2] = isNaN(lcha[2]) ? "none" : rnd2(lcha[2]) + "deg";
|
|
2990
|
-
if (lcha.length > 3 && lcha[3] < 1) lcha[3] = "/ " + (lcha.length > 3 ? lcha[3] : 1);
|
|
2991
|
-
else lcha.length = 3;
|
|
2992
|
-
return `oklch(${lcha.join(" ")})`;
|
|
2993
|
-
};
|
|
2994
|
-
var oklch2css_default = oklch2css;
|
|
2995
|
-
|
|
2996
|
-
//#endregion
|
|
2997
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/io/css/rgb2css.js
|
|
2998
|
-
const { round: round$2 } = Math;
|
|
2999
|
-
const rgb2css = (...args) => {
|
|
3000
|
-
const rgba = unpack_default(args, "rgba");
|
|
3001
|
-
let mode = last_default(args) || "rgb";
|
|
3002
|
-
if (mode.substr(0, 3) === "hsl") return hsl2css_default(rgb2hsl_default(rgba), mode);
|
|
3003
|
-
if (mode.substr(0, 3) === "lab") {
|
|
3004
|
-
const prevWhitePoint = getLabWhitePoint();
|
|
3005
|
-
setLabWhitePoint("d50");
|
|
3006
|
-
const cssColor = lab2css_default(rgb2lab_default(rgba), mode);
|
|
3007
|
-
setLabWhitePoint(prevWhitePoint);
|
|
3008
|
-
return cssColor;
|
|
3009
|
-
}
|
|
3010
|
-
if (mode.substr(0, 3) === "lch") {
|
|
3011
|
-
const prevWhitePoint = getLabWhitePoint();
|
|
3012
|
-
setLabWhitePoint("d50");
|
|
3013
|
-
const cssColor = lch2css_default(rgb2lch_default(rgba), mode);
|
|
3014
|
-
setLabWhitePoint(prevWhitePoint);
|
|
3015
|
-
return cssColor;
|
|
3016
|
-
}
|
|
3017
|
-
if (mode.substr(0, 5) === "oklab") return oklab2css_default(rgb2oklab_default(rgba));
|
|
3018
|
-
if (mode.substr(0, 5) === "oklch") return oklch2css_default(rgb2oklch_default(rgba));
|
|
3019
|
-
rgba[0] = round$2(rgba[0]);
|
|
3020
|
-
rgba[1] = round$2(rgba[1]);
|
|
3021
|
-
rgba[2] = round$2(rgba[2]);
|
|
3022
|
-
if (mode === "rgba" || rgba.length > 3 && rgba[3] < 1) {
|
|
3023
|
-
rgba[3] = "/ " + (rgba.length > 3 ? rgba[3] : 1);
|
|
3024
|
-
mode = "rgba";
|
|
3025
|
-
}
|
|
3026
|
-
return `${mode.substr(0, 3)}(${rgba.slice(0, mode === "rgb" ? 3 : 4).join(" ")})`;
|
|
3027
|
-
};
|
|
3028
|
-
var rgb2css_default = rgb2css;
|
|
3029
|
-
|
|
3030
|
-
//#endregion
|
|
3031
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/io/oklch/oklch2rgb.js
|
|
3032
|
-
const oklch2rgb = (...args) => {
|
|
3033
|
-
args = unpack_default(args, "lch");
|
|
3034
|
-
const [l, c, h, ...rest] = args;
|
|
3035
|
-
const [L, a, b_] = lch2lab_default(l, c, h);
|
|
3036
|
-
const [r, g, b] = oklab2rgb_default(L, a, b_);
|
|
3037
|
-
return [
|
|
3038
|
-
r,
|
|
3039
|
-
g,
|
|
3040
|
-
b,
|
|
3041
|
-
...rest.length > 0 && rest[0] < 1 ? [rest[0]] : []
|
|
3042
|
-
];
|
|
3043
|
-
};
|
|
3044
|
-
var oklch2rgb_default = oklch2rgb;
|
|
3045
|
-
|
|
3046
|
-
//#endregion
|
|
3047
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/io/css/css2rgb.js
|
|
3048
|
-
const INT_OR_PCT = /((?:-?\d+)|(?:-?\d+(?:\.\d+)?)%|none)/.source;
|
|
3049
|
-
const FLOAT_OR_PCT = /((?:-?(?:\d+(?:\.\d*)?|\.\d+)%?)|none)/.source;
|
|
3050
|
-
const PCT = /((?:-?(?:\d+(?:\.\d*)?|\.\d+)%)|none)/.source;
|
|
3051
|
-
const RE_S = /\s*/.source;
|
|
3052
|
-
const SEP = /\s+/.source;
|
|
3053
|
-
const COMMA = /\s*,\s*/.source;
|
|
3054
|
-
const ANLGE = /((?:-?(?:\d+(?:\.\d*)?|\.\d+)(?:deg)?)|none)/.source;
|
|
3055
|
-
const ALPHA = /\s*(?:\/\s*((?:[01]|[01]?\.\d+)|\d+(?:\.\d+)?%))?/.source;
|
|
3056
|
-
const RE_RGB = new RegExp("^rgba?\\(" + RE_S + [
|
|
3057
|
-
INT_OR_PCT,
|
|
3058
|
-
INT_OR_PCT,
|
|
3059
|
-
INT_OR_PCT
|
|
3060
|
-
].join(SEP) + ALPHA + "\\)$");
|
|
3061
|
-
const RE_RGB_LEGACY = new RegExp("^rgb\\(" + RE_S + [
|
|
3062
|
-
INT_OR_PCT,
|
|
3063
|
-
INT_OR_PCT,
|
|
3064
|
-
INT_OR_PCT
|
|
3065
|
-
].join(COMMA) + RE_S + "\\)$");
|
|
3066
|
-
const RE_RGBA_LEGACY = new RegExp("^rgba\\(" + RE_S + [
|
|
3067
|
-
INT_OR_PCT,
|
|
3068
|
-
INT_OR_PCT,
|
|
3069
|
-
INT_OR_PCT,
|
|
3070
|
-
FLOAT_OR_PCT
|
|
3071
|
-
].join(COMMA) + RE_S + "\\)$");
|
|
3072
|
-
const RE_HSL = new RegExp("^hsla?\\(" + RE_S + [
|
|
3073
|
-
ANLGE,
|
|
3074
|
-
PCT,
|
|
3075
|
-
PCT
|
|
3076
|
-
].join(SEP) + ALPHA + "\\)$");
|
|
3077
|
-
const RE_HSL_LEGACY = new RegExp("^hsl?\\(" + RE_S + [
|
|
3078
|
-
ANLGE,
|
|
3079
|
-
PCT,
|
|
3080
|
-
PCT
|
|
3081
|
-
].join(COMMA) + RE_S + "\\)$");
|
|
3082
|
-
const RE_HSLA_LEGACY = /^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/;
|
|
3083
|
-
const RE_LAB = new RegExp("^lab\\(" + RE_S + [
|
|
3084
|
-
FLOAT_OR_PCT,
|
|
3085
|
-
FLOAT_OR_PCT,
|
|
3086
|
-
FLOAT_OR_PCT
|
|
3087
|
-
].join(SEP) + ALPHA + "\\)$");
|
|
3088
|
-
const RE_LCH = new RegExp("^lch\\(" + RE_S + [
|
|
3089
|
-
FLOAT_OR_PCT,
|
|
3090
|
-
FLOAT_OR_PCT,
|
|
3091
|
-
ANLGE
|
|
3092
|
-
].join(SEP) + ALPHA + "\\)$");
|
|
3093
|
-
const RE_OKLAB = new RegExp("^oklab\\(" + RE_S + [
|
|
3094
|
-
FLOAT_OR_PCT,
|
|
3095
|
-
FLOAT_OR_PCT,
|
|
3096
|
-
FLOAT_OR_PCT
|
|
3097
|
-
].join(SEP) + ALPHA + "\\)$");
|
|
3098
|
-
const RE_OKLCH = new RegExp("^oklch\\(" + RE_S + [
|
|
3099
|
-
FLOAT_OR_PCT,
|
|
3100
|
-
FLOAT_OR_PCT,
|
|
3101
|
-
ANLGE
|
|
3102
|
-
].join(SEP) + ALPHA + "\\)$");
|
|
3103
|
-
const { round: round$1 } = Math;
|
|
3104
|
-
const roundRGB = (rgb) => {
|
|
3105
|
-
return rgb.map((v, i) => i <= 2 ? limit_default(round$1(v), 0, 255) : v);
|
|
3106
|
-
};
|
|
3107
|
-
const percentToAbsolute = (pct, min = 0, max = 100, signed = false) => {
|
|
3108
|
-
if (typeof pct === "string" && pct.endsWith("%")) {
|
|
3109
|
-
pct = parseFloat(pct.substring(0, pct.length - 1)) / 100;
|
|
3110
|
-
if (signed) pct = min + (pct + 1) * .5 * (max - min);
|
|
3111
|
-
else pct = min + pct * (max - min);
|
|
3112
|
-
}
|
|
3113
|
-
return +pct;
|
|
3114
|
-
};
|
|
3115
|
-
const noneToValue = (v, noneValue) => {
|
|
3116
|
-
return v === "none" ? noneValue : v;
|
|
3117
|
-
};
|
|
3118
|
-
const css2rgb = (css) => {
|
|
3119
|
-
css = css.toLowerCase().trim();
|
|
3120
|
-
if (css === "transparent") return [
|
|
3121
|
-
0,
|
|
3122
|
-
0,
|
|
3123
|
-
0,
|
|
3124
|
-
0
|
|
3125
|
-
];
|
|
3126
|
-
let m;
|
|
3127
|
-
if (input_default.format.named) try {
|
|
3128
|
-
return input_default.format.named(css);
|
|
3129
|
-
} catch (e) {}
|
|
3130
|
-
if ((m = css.match(RE_RGB)) || (m = css.match(RE_RGB_LEGACY))) {
|
|
3131
|
-
let rgb = m.slice(1, 4);
|
|
3132
|
-
for (let i = 0; i < 3; i++) rgb[i] = +percentToAbsolute(noneToValue(rgb[i], 0), 0, 255);
|
|
3133
|
-
rgb = roundRGB(rgb);
|
|
3134
|
-
const alpha = m[4] !== void 0 ? +percentToAbsolute(m[4], 0, 1) : 1;
|
|
3135
|
-
rgb[3] = alpha;
|
|
3136
|
-
return rgb;
|
|
3137
|
-
}
|
|
3138
|
-
if (m = css.match(RE_RGBA_LEGACY)) {
|
|
3139
|
-
const rgb = m.slice(1, 5);
|
|
3140
|
-
for (let i = 0; i < 4; i++) rgb[i] = +percentToAbsolute(rgb[i], 0, 255);
|
|
3141
|
-
return rgb;
|
|
3142
|
-
}
|
|
3143
|
-
if ((m = css.match(RE_HSL)) || (m = css.match(RE_HSL_LEGACY))) {
|
|
3144
|
-
const hsl = m.slice(1, 4);
|
|
3145
|
-
hsl[0] = +noneToValue(hsl[0].replace("deg", ""), 0);
|
|
3146
|
-
hsl[1] = +percentToAbsolute(noneToValue(hsl[1], 0), 0, 100) * .01;
|
|
3147
|
-
hsl[2] = +percentToAbsolute(noneToValue(hsl[2], 0), 0, 100) * .01;
|
|
3148
|
-
const rgb = roundRGB(hsl2rgb_default(hsl));
|
|
3149
|
-
rgb[3] = m[4] !== void 0 ? +percentToAbsolute(m[4], 0, 1) : 1;
|
|
3150
|
-
return rgb;
|
|
3151
|
-
}
|
|
3152
|
-
if (m = css.match(RE_HSLA_LEGACY)) {
|
|
3153
|
-
const hsl = m.slice(1, 4);
|
|
3154
|
-
hsl[1] *= .01;
|
|
3155
|
-
hsl[2] *= .01;
|
|
3156
|
-
const rgb = hsl2rgb_default(hsl);
|
|
3157
|
-
for (let i = 0; i < 3; i++) rgb[i] = round$1(rgb[i]);
|
|
3158
|
-
rgb[3] = +m[4];
|
|
3159
|
-
return rgb;
|
|
3160
|
-
}
|
|
3161
|
-
if (m = css.match(RE_LAB)) {
|
|
3162
|
-
const lab = m.slice(1, 4);
|
|
3163
|
-
lab[0] = percentToAbsolute(noneToValue(lab[0], 0), 0, 100);
|
|
3164
|
-
lab[1] = percentToAbsolute(noneToValue(lab[1], 0), -125, 125, true);
|
|
3165
|
-
lab[2] = percentToAbsolute(noneToValue(lab[2], 0), -125, 125, true);
|
|
3166
|
-
const wp = getLabWhitePoint();
|
|
3167
|
-
setLabWhitePoint("d50");
|
|
3168
|
-
const rgb = roundRGB(lab2rgb_default(lab));
|
|
3169
|
-
setLabWhitePoint(wp);
|
|
3170
|
-
rgb[3] = m[4] !== void 0 ? +percentToAbsolute(m[4], 0, 1) : 1;
|
|
3171
|
-
return rgb;
|
|
3172
|
-
}
|
|
3173
|
-
if (m = css.match(RE_LCH)) {
|
|
3174
|
-
const lch = m.slice(1, 4);
|
|
3175
|
-
lch[0] = percentToAbsolute(lch[0], 0, 100);
|
|
3176
|
-
lch[1] = percentToAbsolute(noneToValue(lch[1], 0), 0, 150, false);
|
|
3177
|
-
lch[2] = +noneToValue(lch[2].replace("deg", ""), 0);
|
|
3178
|
-
const wp = getLabWhitePoint();
|
|
3179
|
-
setLabWhitePoint("d50");
|
|
3180
|
-
const rgb = roundRGB(lch2rgb_default(lch));
|
|
3181
|
-
setLabWhitePoint(wp);
|
|
3182
|
-
rgb[3] = m[4] !== void 0 ? +percentToAbsolute(m[4], 0, 1) : 1;
|
|
3183
|
-
return rgb;
|
|
3184
|
-
}
|
|
3185
|
-
if (m = css.match(RE_OKLAB)) {
|
|
3186
|
-
const oklab = m.slice(1, 4);
|
|
3187
|
-
oklab[0] = percentToAbsolute(noneToValue(oklab[0], 0), 0, 1);
|
|
3188
|
-
oklab[1] = percentToAbsolute(noneToValue(oklab[1], 0), -.4, .4, true);
|
|
3189
|
-
oklab[2] = percentToAbsolute(noneToValue(oklab[2], 0), -.4, .4, true);
|
|
3190
|
-
const rgb = roundRGB(oklab2rgb_default(oklab));
|
|
3191
|
-
rgb[3] = m[4] !== void 0 ? +percentToAbsolute(m[4], 0, 1) : 1;
|
|
3192
|
-
return rgb;
|
|
3193
|
-
}
|
|
3194
|
-
if (m = css.match(RE_OKLCH)) {
|
|
3195
|
-
const oklch = m.slice(1, 4);
|
|
3196
|
-
oklch[0] = percentToAbsolute(noneToValue(oklch[0], 0), 0, 1);
|
|
3197
|
-
oklch[1] = percentToAbsolute(noneToValue(oklch[1], 0), 0, .4, false);
|
|
3198
|
-
oklch[2] = +noneToValue(oklch[2].replace("deg", ""), 0);
|
|
3199
|
-
const rgb = roundRGB(oklch2rgb_default(oklch));
|
|
3200
|
-
rgb[3] = m[4] !== void 0 ? +percentToAbsolute(m[4], 0, 1) : 1;
|
|
3201
|
-
return rgb;
|
|
3202
|
-
}
|
|
3203
|
-
};
|
|
3204
|
-
css2rgb.test = (s) => {
|
|
3205
|
-
return RE_RGB.test(s) || RE_HSL.test(s) || RE_LAB.test(s) || RE_LCH.test(s) || RE_OKLAB.test(s) || RE_OKLCH.test(s) || RE_RGB_LEGACY.test(s) || RE_RGBA_LEGACY.test(s) || RE_HSL_LEGACY.test(s) || RE_HSLA_LEGACY.test(s) || s === "transparent";
|
|
3206
|
-
};
|
|
3207
|
-
var css2rgb_default = css2rgb;
|
|
3208
|
-
|
|
3209
|
-
//#endregion
|
|
3210
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/io/css/index.js
|
|
3211
|
-
Color_default.prototype.css = function(mode) {
|
|
3212
|
-
return rgb2css_default(this._rgb, mode);
|
|
3213
|
-
};
|
|
3214
|
-
const css = (...args) => new Color_default(...args, "css");
|
|
3215
|
-
chroma_default.css = css;
|
|
3216
|
-
input_default.format.css = css2rgb_default;
|
|
3217
|
-
input_default.autodetect.push({
|
|
3218
|
-
p: 5,
|
|
3219
|
-
test: (h, ...rest) => {
|
|
3220
|
-
if (!rest.length && type_default(h) === "string" && css2rgb_default.test(h)) return "css";
|
|
3221
|
-
}
|
|
3222
|
-
});
|
|
3223
|
-
|
|
3224
|
-
//#endregion
|
|
3225
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/io/gl/index.js
|
|
3226
|
-
input_default.format.gl = (...args) => {
|
|
3227
|
-
const rgb = unpack_default(args, "rgba");
|
|
3228
|
-
rgb[0] *= 255;
|
|
3229
|
-
rgb[1] *= 255;
|
|
3230
|
-
rgb[2] *= 255;
|
|
3231
|
-
return rgb;
|
|
3232
|
-
};
|
|
3233
|
-
const gl = (...args) => new Color_default(...args, "gl");
|
|
3234
|
-
chroma_default.gl = gl;
|
|
3235
|
-
Color_default.prototype.gl = function() {
|
|
3236
|
-
const rgb = this._rgb;
|
|
3237
|
-
return [
|
|
3238
|
-
rgb[0] / 255,
|
|
3239
|
-
rgb[1] / 255,
|
|
3240
|
-
rgb[2] / 255,
|
|
3241
|
-
rgb[3]
|
|
3242
|
-
];
|
|
3243
|
-
};
|
|
3244
|
-
|
|
3245
|
-
//#endregion
|
|
3246
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/io/hex/index.js
|
|
3247
|
-
Color_default.prototype.hex = function(mode) {
|
|
3248
|
-
return rgb2hex_default(this._rgb, mode);
|
|
3249
|
-
};
|
|
3250
|
-
const hex = (...args) => new Color_default(...args, "hex");
|
|
3251
|
-
chroma_default.hex = hex;
|
|
3252
|
-
input_default.format.hex = hex2rgb_default;
|
|
3253
|
-
input_default.autodetect.push({
|
|
3254
|
-
p: 4,
|
|
3255
|
-
test: (h, ...rest) => {
|
|
3256
|
-
if (!rest.length && type_default(h) === "string" && [
|
|
3257
|
-
3,
|
|
3258
|
-
4,
|
|
3259
|
-
5,
|
|
3260
|
-
6,
|
|
3261
|
-
7,
|
|
3262
|
-
8,
|
|
3263
|
-
9
|
|
3264
|
-
].indexOf(h.length) >= 0) return "hex";
|
|
3265
|
-
}
|
|
3266
|
-
});
|
|
3267
|
-
|
|
3268
|
-
//#endregion
|
|
3269
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/io/temp/temperature2rgb.js
|
|
3270
|
-
const { log } = Math;
|
|
3271
|
-
const temperature2rgb = (kelvin) => {
|
|
3272
|
-
const temp = kelvin / 100;
|
|
3273
|
-
let r, g, b;
|
|
3274
|
-
if (temp < 66) {
|
|
3275
|
-
r = 255;
|
|
3276
|
-
g = temp < 6 ? 0 : -155.25485562709179 - .44596950469579133 * (g = temp - 2) + 104.49216199393888 * log(g);
|
|
3277
|
-
b = temp < 20 ? 0 : -254.76935184120902 + .8274096064007395 * (b = temp - 10) + 115.67994401066147 * log(b);
|
|
3278
|
-
} else {
|
|
3279
|
-
r = 351.97690566805693 + .114206453784165 * (r = temp - 55) - 40.25366309332127 * log(r);
|
|
3280
|
-
g = 325.4494125711974 + .07943456536662342 * (g = temp - 50) - 28.0852963507957 * log(g);
|
|
3281
|
-
b = 255;
|
|
3282
|
-
}
|
|
3283
|
-
return [
|
|
3284
|
-
r,
|
|
3285
|
-
g,
|
|
3286
|
-
b,
|
|
3287
|
-
1
|
|
3288
|
-
];
|
|
3289
|
-
};
|
|
3290
|
-
var temperature2rgb_default = temperature2rgb;
|
|
3291
|
-
|
|
3292
|
-
//#endregion
|
|
3293
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/io/temp/rgb2temperature.js
|
|
3294
|
-
const { round } = Math;
|
|
3295
|
-
const rgb2temperature = (...args) => {
|
|
3296
|
-
const rgb = unpack_default(args, "rgb");
|
|
3297
|
-
const r = rgb[0], b = rgb[2];
|
|
3298
|
-
let minTemp = 1e3;
|
|
3299
|
-
let maxTemp = 4e4;
|
|
3300
|
-
const eps = .4;
|
|
3301
|
-
let temp;
|
|
3302
|
-
while (maxTemp - minTemp > eps) {
|
|
3303
|
-
temp = (maxTemp + minTemp) * .5;
|
|
3304
|
-
const rgb = temperature2rgb_default(temp);
|
|
3305
|
-
if (rgb[2] / rgb[0] >= b / r) maxTemp = temp;
|
|
3306
|
-
else minTemp = temp;
|
|
3307
|
-
}
|
|
3308
|
-
return round(temp);
|
|
3309
|
-
};
|
|
3310
|
-
var rgb2temperature_default = rgb2temperature;
|
|
3311
|
-
|
|
3312
|
-
//#endregion
|
|
3313
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/io/temp/index.js
|
|
3314
|
-
Color_default.prototype.temp = Color_default.prototype.kelvin = Color_default.prototype.temperature = function() {
|
|
3315
|
-
return rgb2temperature_default(this._rgb);
|
|
3316
|
-
};
|
|
3317
|
-
const temp = (...args) => new Color_default(...args, "temp");
|
|
3318
|
-
Object.assign(chroma_default, {
|
|
3319
|
-
temp,
|
|
3320
|
-
kelvin: temp,
|
|
3321
|
-
temperature: temp
|
|
3322
|
-
});
|
|
3323
|
-
input_default.format.temp = input_default.format.kelvin = input_default.format.temperature = temperature2rgb_default;
|
|
3324
|
-
|
|
3325
|
-
//#endregion
|
|
3326
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/src/io/oklch/index.js
|
|
3327
|
-
Color_default.prototype.oklch = function() {
|
|
3328
|
-
return rgb2oklch_default(this._rgb);
|
|
3329
|
-
};
|
|
3330
|
-
const oklch = (...args) => new Color_default(...args, "oklch");
|
|
3331
|
-
Object.assign(chroma_default, { oklch });
|
|
3332
|
-
input_default.format.oklch = oklch2rgb_default;
|
|
3333
|
-
input_default.autodetect.push({
|
|
3334
|
-
p: 2,
|
|
3335
|
-
test: (...args) => {
|
|
3336
|
-
args = unpack_default(args, "oklch");
|
|
3337
|
-
if (type_default(args) === "array" && args.length === 3) return "oklch";
|
|
3338
|
-
}
|
|
3339
|
-
});
|
|
3340
|
-
|
|
3341
|
-
//#endregion
|
|
3342
|
-
//#region ../../node_modules/.pnpm/chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840c5155f1e299d91bd40b2a8eb0f3e4c0c62d1c/node_modules/chroma-js/index.js
|
|
3343
|
-
Object.assign(chroma_default, {
|
|
3344
|
-
analyze,
|
|
3345
|
-
average: average_default,
|
|
3346
|
-
bezier: bezier_default,
|
|
3347
|
-
blend: blend_default,
|
|
3348
|
-
brewer: colorbrewer_default,
|
|
3349
|
-
Color: Color_default,
|
|
3350
|
-
colors: w3cx11_default,
|
|
3351
|
-
contrast: contrast_default,
|
|
3352
|
-
contrastAPCA: contrastAPCA_default,
|
|
3353
|
-
cubehelix: cubehelix_default,
|
|
3354
|
-
deltaE: delta_e_default,
|
|
3355
|
-
distance: distance_default,
|
|
3356
|
-
input: input_default,
|
|
3357
|
-
interpolate: mix_default,
|
|
3358
|
-
limits,
|
|
3359
|
-
mix: mix_default,
|
|
3360
|
-
random: random_default,
|
|
3361
|
-
scale: scale_default,
|
|
3362
|
-
scales: scales_default,
|
|
3363
|
-
valid: valid_default
|
|
3364
|
-
});
|
|
3365
|
-
var chroma_js_default = chroma_default;
|
|
3366
|
-
|
|
3367
|
-
//#endregion
|
|
3368
|
-
//#region ../../node_modules/.pnpm/@mantine+colors-generator@8.3.13_chroma-js@3.2.0_patch_hash=d987322bee5bda6851d8538d840_5f8f37723442888f47e0bba4bb8659dc/node_modules/@mantine/colors-generator/esm/generate-colors.mjs
|
|
3369
|
-
const LIGHTNESS_MAP = [
|
|
3370
|
-
.96,
|
|
3371
|
-
.907,
|
|
3372
|
-
.805,
|
|
3373
|
-
.697,
|
|
3374
|
-
.605,
|
|
3375
|
-
.547,
|
|
3376
|
-
.518,
|
|
3377
|
-
.445,
|
|
3378
|
-
.395,
|
|
3379
|
-
.34
|
|
3380
|
-
];
|
|
3381
|
-
const SATURATION_MAP = [
|
|
3382
|
-
.32,
|
|
3383
|
-
.16,
|
|
3384
|
-
.08,
|
|
3385
|
-
.04,
|
|
3386
|
-
0,
|
|
3387
|
-
0,
|
|
3388
|
-
.04,
|
|
3389
|
-
.08,
|
|
3390
|
-
.16,
|
|
3391
|
-
.32
|
|
3392
|
-
];
|
|
3393
|
-
function getClosestLightness(colorObject) {
|
|
3394
|
-
const lightnessGoal = colorObject.get("hsl.l");
|
|
3395
|
-
return LIGHTNESS_MAP.reduce((prev, curr) => Math.abs(curr - lightnessGoal) < Math.abs(prev - lightnessGoal) ? curr : prev);
|
|
3396
|
-
}
|
|
3397
|
-
function generateColorsMap(color) {
|
|
3398
|
-
const colorObject = chroma_js_default(color);
|
|
3399
|
-
const closestLightness = getClosestLightness(colorObject);
|
|
3400
|
-
const baseColorIndex = LIGHTNESS_MAP.findIndex((l) => l === closestLightness);
|
|
3401
|
-
const colors = LIGHTNESS_MAP.map((l) => colorObject.set("hsl.l", l)).map((c) => chroma_js_default(c)).map((c, i) => {
|
|
3402
|
-
const saturationDelta = SATURATION_MAP[i] - SATURATION_MAP[baseColorIndex];
|
|
3403
|
-
return saturationDelta >= 0 ? c.saturate(saturationDelta) : c.desaturate(saturationDelta * -1);
|
|
3404
|
-
});
|
|
3405
|
-
colors[baseColorIndex] = chroma_js_default(color);
|
|
3406
|
-
return {
|
|
3407
|
-
baseColorIndex,
|
|
3408
|
-
colors
|
|
3409
|
-
};
|
|
3410
|
-
}
|
|
3411
|
-
function generateColors(color) {
|
|
3412
|
-
return generateColorsMap(color).colors.map((c) => c.hex());
|
|
3413
|
-
}
|
|
3414
|
-
|
|
3415
|
-
//#endregion
|
|
3416
|
-
export { chroma_js_default as n, generateColors as t };
|
|
15
|
+
const Ut=.027,Wt=1.14,W=.022,Gt=1.414;var Kt=(e,t)=>{e=new y(e),t=new y(t),e.alpha()<1&&(e=F(t,e,e.alpha(),`rgb`));let n=qt(...e.rgb()),r=qt(...t.rgb()),i=n>=W?n:n+(W-n)**+Gt,a=r>=W?r:r+(W-r)**+Gt,o=a**.56-i**.57,s=a**.65-i**.62,c=Math.abs(a-i)<5e-4?0:i<a?o*Wt:s*Wt;return(Math.abs(c)<.1?0:c>0?c-Ut:c+Ut)*100};function qt(e,t,n){return .2126729*(e/255)**2.4+.7151522*(t/255)**2.4+.072175*(n/255)**2.4}const{sqrt:G,pow:K,min:Jt,max:Yt,atan2:Xt,abs:Zt,cos:q,sin:Qt,exp:$t,PI:en}=Math;function tn(e,t,n=1,r=1,i=1){var a=function(e){return 360*e/(2*en)},o=function(e){return 2*en*e/360};e=new y(e),t=new y(t);let[s,c,l]=Array.from(e.lab()),[u,d,f]=Array.from(t.lab()),p=(s+u)/2,m=(G(K(c,2)+K(l,2))+G(K(d,2)+K(f,2)))/2,h=.5*(1-G(K(m,7)/(K(m,7)+K(25,7)))),g=c*(1+h),_=d*(1+h),v=G(K(g,2)+K(l,2)),b=G(K(_,2)+K(f,2)),x=(v+b)/2,S=a(Xt(l,g)),C=a(Xt(f,_)),w=S>=0?S:S+360,T=C>=0?C:C+360,E=Zt(w-T)>180?(w+T+360)/2:(w+T)/2,D=1-.17*q(o(E-30))+.24*q(o(2*E))+.32*q(o(3*E+6))-.2*q(o(4*E-63)),O=T-w;O=Zt(O)<=180?O:T<=w?O+360:O-360,O=2*G(v*b)*Qt(o(O)/2);let k=u-s,A=b-v,j=1+.015*K(p-50,2)/G(20+K(p-50,2)),ee=1+.045*x,M=1+.015*x*D,te=30*$t(-K((E-275)/25,2)),N=-(2*G(K(x,7)/(K(x,7)+K(25,7))))*Qt(2*o(te));return Yt(0,Jt(100,G(K(k/(n*j),2)+K(A/(r*ee),2)+K(O/(i*M),2)+N*(A/(r*ee))*(O/(i*M)))))}function nn(e,t,n=`lab`){e=new y(e),t=new y(t);let r=e.get(n),i=t.get(n),a=0;for(let e in r){let t=(r[e]||0)-(i[e]||0);a+=t*t}return Math.sqrt(a)}var rn=(...e)=>{try{return new y(...e),!0}catch{return!1}},an={cool(){return B([b.hsl(180,1,.9),b.hsl(250,.7,.4)])},hot(){return B([`#000`,`#f00`,`#ff0`,`#fff`],[0,.25,.75,1]).mode(`rgb`)}};const on={OrRd:[`#fff7ec`,`#fee8c8`,`#fdd49e`,`#fdbb84`,`#fc8d59`,`#ef6548`,`#d7301f`,`#b30000`,`#7f0000`],PuBu:[`#fff7fb`,`#ece7f2`,`#d0d1e6`,`#a6bddb`,`#74a9cf`,`#3690c0`,`#0570b0`,`#045a8d`,`#023858`],BuPu:[`#f7fcfd`,`#e0ecf4`,`#bfd3e6`,`#9ebcda`,`#8c96c6`,`#8c6bb1`,`#88419d`,`#810f7c`,`#4d004b`],Oranges:[`#fff5eb`,`#fee6ce`,`#fdd0a2`,`#fdae6b`,`#fd8d3c`,`#f16913`,`#d94801`,`#a63603`,`#7f2704`],BuGn:[`#f7fcfd`,`#e5f5f9`,`#ccece6`,`#99d8c9`,`#66c2a4`,`#41ae76`,`#238b45`,`#006d2c`,`#00441b`],YlOrBr:[`#ffffe5`,`#fff7bc`,`#fee391`,`#fec44f`,`#fe9929`,`#ec7014`,`#cc4c02`,`#993404`,`#662506`],YlGn:[`#ffffe5`,`#f7fcb9`,`#d9f0a3`,`#addd8e`,`#78c679`,`#41ab5d`,`#238443`,`#006837`,`#004529`],Reds:[`#fff5f0`,`#fee0d2`,`#fcbba1`,`#fc9272`,`#fb6a4a`,`#ef3b2c`,`#cb181d`,`#a50f15`,`#67000d`],RdPu:[`#fff7f3`,`#fde0dd`,`#fcc5c0`,`#fa9fb5`,`#f768a1`,`#dd3497`,`#ae017e`,`#7a0177`,`#49006a`],Greens:[`#f7fcf5`,`#e5f5e0`,`#c7e9c0`,`#a1d99b`,`#74c476`,`#41ab5d`,`#238b45`,`#006d2c`,`#00441b`],YlGnBu:[`#ffffd9`,`#edf8b1`,`#c7e9b4`,`#7fcdbb`,`#41b6c4`,`#1d91c0`,`#225ea8`,`#253494`,`#081d58`],Purples:[`#fcfbfd`,`#efedf5`,`#dadaeb`,`#bcbddc`,`#9e9ac8`,`#807dba`,`#6a51a3`,`#54278f`,`#3f007d`],GnBu:[`#f7fcf0`,`#e0f3db`,`#ccebc5`,`#a8ddb5`,`#7bccc4`,`#4eb3d3`,`#2b8cbe`,`#0868ac`,`#084081`],Greys:[`#ffffff`,`#f0f0f0`,`#d9d9d9`,`#bdbdbd`,`#969696`,`#737373`,`#525252`,`#252525`,`#000000`],YlOrRd:[`#ffffcc`,`#ffeda0`,`#fed976`,`#feb24c`,`#fd8d3c`,`#fc4e2a`,`#e31a1c`,`#bd0026`,`#800026`],PuRd:[`#f7f4f9`,`#e7e1ef`,`#d4b9da`,`#c994c7`,`#df65b0`,`#e7298a`,`#ce1256`,`#980043`,`#67001f`],Blues:[`#f7fbff`,`#deebf7`,`#c6dbef`,`#9ecae1`,`#6baed6`,`#4292c6`,`#2171b5`,`#08519c`,`#08306b`],PuBuGn:[`#fff7fb`,`#ece2f0`,`#d0d1e6`,`#a6bddb`,`#67a9cf`,`#3690c0`,`#02818a`,`#016c59`,`#014636`],Viridis:[`#440154`,`#482777`,`#3f4a8a`,`#31678e`,`#26838f`,`#1f9d8a`,`#6cce5a`,`#b6de2b`,`#fee825`],Spectral:[`#9e0142`,`#d53e4f`,`#f46d43`,`#fdae61`,`#fee08b`,`#ffffbf`,`#e6f598`,`#abdda4`,`#66c2a5`,`#3288bd`,`#5e4fa2`],RdYlGn:[`#a50026`,`#d73027`,`#f46d43`,`#fdae61`,`#fee08b`,`#ffffbf`,`#d9ef8b`,`#a6d96a`,`#66bd63`,`#1a9850`,`#006837`],RdBu:[`#67001f`,`#b2182b`,`#d6604d`,`#f4a582`,`#fddbc7`,`#f7f7f7`,`#d1e5f0`,`#92c5de`,`#4393c3`,`#2166ac`,`#053061`],PiYG:[`#8e0152`,`#c51b7d`,`#de77ae`,`#f1b6da`,`#fde0ef`,`#f7f7f7`,`#e6f5d0`,`#b8e186`,`#7fbc41`,`#4d9221`,`#276419`],PRGn:[`#40004b`,`#762a83`,`#9970ab`,`#c2a5cf`,`#e7d4e8`,`#f7f7f7`,`#d9f0d3`,`#a6dba0`,`#5aae61`,`#1b7837`,`#00441b`],RdYlBu:[`#a50026`,`#d73027`,`#f46d43`,`#fdae61`,`#fee090`,`#ffffbf`,`#e0f3f8`,`#abd9e9`,`#74add1`,`#4575b4`,`#313695`],BrBG:[`#543005`,`#8c510a`,`#bf812d`,`#dfc27d`,`#f6e8c3`,`#f5f5f5`,`#c7eae5`,`#80cdc1`,`#35978f`,`#01665e`,`#003c30`],RdGy:[`#67001f`,`#b2182b`,`#d6604d`,`#f4a582`,`#fddbc7`,`#ffffff`,`#e0e0e0`,`#bababa`,`#878787`,`#4d4d4d`,`#1a1a1a`],PuOr:[`#7f3b08`,`#b35806`,`#e08214`,`#fdb863`,`#fee0b6`,`#f7f7f7`,`#d8daeb`,`#b2abd2`,`#8073ac`,`#542788`,`#2d004b`],Set2:[`#66c2a5`,`#fc8d62`,`#8da0cb`,`#e78ac3`,`#a6d854`,`#ffd92f`,`#e5c494`,`#b3b3b3`],Accent:[`#7fc97f`,`#beaed4`,`#fdc086`,`#ffff99`,`#386cb0`,`#f0027f`,`#bf5b17`,`#666666`],Set1:[`#e41a1c`,`#377eb8`,`#4daf4a`,`#984ea3`,`#ff7f00`,`#ffff33`,`#a65628`,`#f781bf`,`#999999`],Set3:[`#8dd3c7`,`#ffffb3`,`#bebada`,`#fb8072`,`#80b1d3`,`#fdb462`,`#b3de69`,`#fccde5`,`#d9d9d9`,`#bc80bd`,`#ccebc5`,`#ffed6f`],Dark2:[`#1b9e77`,`#d95f02`,`#7570b3`,`#e7298a`,`#66a61e`,`#e6ab02`,`#a6761d`,`#666666`],Paired:[`#a6cee3`,`#1f78b4`,`#b2df8a`,`#33a02c`,`#fb9a99`,`#e31a1c`,`#fdbf6f`,`#ff7f00`,`#cab2d6`,`#6a3d9a`,`#ffff99`,`#b15928`],Pastel2:[`#b3e2cd`,`#fdcdac`,`#cbd5e8`,`#f4cae4`,`#e6f5c9`,`#fff2ae`,`#f1e2cc`,`#cccccc`],Pastel1:[`#fbb4ae`,`#b3cde3`,`#ccebc5`,`#decbe4`,`#fed9a6`,`#ffffcc`,`#e5d8bd`,`#fddaec`,`#f2f2f2`]},sn=Object.keys(on),cn=new Map(sn.map(e=>[e.toLowerCase(),e])),ln=typeof Proxy==`function`?new Proxy(on,{get(e,t){let n=t.toLowerCase();if(cn.has(n))return e[cn.get(n)]},getOwnPropertyNames(){return Object.getOwnPropertyNames(sn)}}):on,un=(...e)=>{e=o(e,`cmyk`);let[t,n,r,i]=e,a=e.length>4?e[4]:1;return i===1?[0,0,0,a]:[t>=1?0:255*(1-t)*(1-i),n>=1?0:255*(1-n)*(1-i),r>=1?0:255*(1-r)*(1-i),a]},{max:dn}=Math,fn=(...e)=>{let[t,n,r]=o(e,`rgb`);t/=255,n/=255,r/=255;let i=1-dn(t,dn(n,r)),a=i<1?1/(1-i):0;return[(1-t-i)*a,(1-n-i)*a,(1-r-i)*a,i]};y.prototype.cmyk=function(){return fn(this._rgb)};const pn=(...e)=>new y(...e,`cmyk`);Object.assign(b,{cmyk:pn}),v.format.cmyk=un,v.autodetect.push({p:2,test:(...e)=>{if(e=o(e,`cmyk`),a(e)===`array`&&e.length===4)return`cmyk`}});const mn=(...e)=>{let t=o(e,`hsla`),n=s(e)||`lsa`;return t[0]=d(t[0]||0)+`deg`,t[1]=d(t[1]*100)+`%`,t[2]=d(t[2]*100)+`%`,n===`hsla`||t.length>3&&t[3]<1?(t[3]=`/ `+(t.length>3?t[3]:1),n=`hsla`):t.length=3,`${n.substr(0,3)}(${t.join(` `)})`},hn=(...e)=>{let t=o(e,`lab`),n=s(e)||`lab`;return t[0]=d(t[0])+`%`,t[1]=d(t[1]),t[2]=d(t[2]),n===`laba`||t.length>3&&t[3]<1?t[3]=`/ `+(t.length>3?t[3]:1):t.length=3,`lab(${t.join(` `)})`},gn=(...e)=>{let t=o(e,`lch`),n=s(e)||`lab`;return t[0]=d(t[0])+`%`,t[1]=d(t[1]),t[2]=isNaN(t[2])?`none`:d(t[2])+`deg`,n===`lcha`||t.length>3&&t[3]<1?t[3]=`/ `+(t.length>3?t[3]:1):t.length=3,`lch(${t.join(` `)})`},_n=(...e)=>{let t=o(e,`lab`);return t[0]=d(t[0]*100)+`%`,t[1]=f(t[1]),t[2]=f(t[2]),t.length>3&&t[3]<1?t[3]=`/ `+(t.length>3?t[3]:1):t.length=3,`oklab(${t.join(` `)})`},vn=(...e)=>{let[t,n,r,...i]=o(e,`rgb`),[a,s,c]=tt(t,n,r),[l,u,d]=_e(a,s,c);return[l,u,d,...i.length>0&&i[0]<1?[i[0]]:[]]},yn=(...e)=>{let t=o(e,`lch`);return t[0]=d(t[0]*100)+`%`,t[1]=f(t[1]),t[2]=isNaN(t[2])?`none`:d(t[2])+`deg`,t.length>3&&t[3]<1?t[3]=`/ `+(t.length>3?t[3]:1):t.length=3,`oklch(${t.join(` `)})`},{round:bn}=Math,xn=(...e)=>{let t=o(e,`rgba`),n=s(e)||`rgb`;if(n.substr(0,3)===`hsl`)return mn(Ue(t),n);if(n.substr(0,3)===`lab`){let e=A();k(`d50`);let r=hn(N(t),n);return k(e),r}if(n.substr(0,3)===`lch`){let e=A();k(`d50`);let r=gn(ve(t),n);return k(e),r}return n.substr(0,5)===`oklab`?_n(tt(t)):n.substr(0,5)===`oklch`?yn(vn(t)):(t[0]=bn(t[0]),t[1]=bn(t[1]),t[2]=bn(t[2]),(n===`rgba`||t.length>3&&t[3]<1)&&(t[3]=`/ `+(t.length>3?t[3]:1),n=`rgba`),`${n.substr(0,3)}(${t.slice(0,n===`rgb`?3:4).join(` `)})`)},Sn=(...e)=>{e=o(e,`lch`);let[t,n,r,...i]=e,[a,s,c]=de(t,n,r),[l,u,d]=$e(a,s,c);return[l,u,d,...i.length>0&&i[0]<1?[i[0]]:[]]},J=`((?:-?\\d+)|(?:-?\\d+(?:\\.\\d+)?)%|none)`,Y=`((?:-?(?:\\d+(?:\\.\\d*)?|\\.\\d+)%?)|none)`,Cn=`((?:-?(?:\\d+(?:\\.\\d*)?|\\.\\d+)%)|none)`,wn=`\\s*,\\s*`,Tn=`((?:-?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:deg)?)|none)`,X=`\\s*(?:\\/\\s*((?:[01]|[01]?\\.\\d+)|\\d+(?:\\.\\d+)?%))?`,En=RegExp(`^rgba?\\(\\s*`+[J,J,J].join(`\\s+`)+X+`\\)$`),Dn=RegExp(`^rgb\\(\\s*`+[J,J,J].join(wn)+`\\s*\\)$`),On=RegExp(`^rgba\\(\\s*`+[J,J,J,Y].join(wn)+`\\s*\\)$`),kn=RegExp(`^hsla?\\(\\s*`+[Tn,Cn,Cn].join(`\\s+`)+X+`\\)$`),An=RegExp(`^hsl?\\(\\s*`+[Tn,Cn,Cn].join(wn)+`\\s*\\)$`),jn=/^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,Mn=RegExp(`^lab\\(\\s*`+[Y,Y,Y].join(`\\s+`)+X+`\\)$`),Nn=RegExp(`^lch\\(\\s*`+[Y,Y,Tn].join(`\\s+`)+X+`\\)$`),Pn=RegExp(`^oklab\\(\\s*`+[Y,Y,Y].join(`\\s+`)+X+`\\)$`),Fn=RegExp(`^oklch\\(\\s*`+[Y,Y,Tn].join(`\\s+`)+X+`\\)$`),{round:In}=Math,Z=e=>e.map((e,t)=>t<=2?n(In(e),0,255):e),Q=(e,t=0,n=100,r=!1)=>(typeof e==`string`&&e.endsWith(`%`)&&(e=parseFloat(e.substring(0,e.length-1))/100,e=r?t+(e+1)*.5*(n-t):t+e*(n-t)),+e),$=(e,t)=>e===`none`?t:e,Ln=e=>{if(e=e.toLowerCase().trim(),e===`transparent`)return[0,0,0,0];let t;if(v.format.named)try{return v.format.named(e)}catch{}if((t=e.match(En))||(t=e.match(Dn))){let e=t.slice(1,4);for(let t=0;t<3;t++)e[t]=+Q($(e[t],0),0,255);e=Z(e);let n=t[4]===void 0?1:+Q(t[4],0,1);return e[3]=n,e}if(t=e.match(On)){let e=t.slice(1,5);for(let t=0;t<4;t++)e[t]=+Q(e[t],0,255);return e}if((t=e.match(kn))||(t=e.match(An))){let e=t.slice(1,4);e[0]=+$(e[0].replace(`deg`,``),0),e[1]=Q($(e[1],0),0,100)*.01,e[2]=Q($(e[2],0),0,100)*.01;let n=Z(He(e));return n[3]=t[4]===void 0?1:+Q(t[4],0,1),n}if(t=e.match(jn)){let e=t.slice(1,4);e[1]*=.01,e[2]*=.01;let n=He(e);for(let e=0;e<3;e++)n[e]=In(n[e]);return n[3]=+t[4],n}if(t=e.match(Mn)){let e=t.slice(1,4);e[0]=Q($(e[0],0),0,100),e[1]=Q($(e[1],0),-125,125,!0),e[2]=Q($(e[2],0),-125,125,!0);let n=A();k(`d50`);let r=Z(j(e));return k(n),r[3]=t[4]===void 0?1:+Q(t[4],0,1),r}if(t=e.match(Nn)){let e=t.slice(1,4);e[0]=Q(e[0],0,100),e[1]=Q($(e[1],0),0,150,!1),e[2]=+$(e[2].replace(`deg`,``),0);let n=A();k(`d50`);let r=Z(fe(e));return k(n),r[3]=t[4]===void 0?1:+Q(t[4],0,1),r}if(t=e.match(Pn)){let e=t.slice(1,4);e[0]=Q($(e[0],0),0,1),e[1]=Q($(e[1],0),-.4,.4,!0),e[2]=Q($(e[2],0),-.4,.4,!0);let n=Z($e(e));return n[3]=t[4]===void 0?1:+Q(t[4],0,1),n}if(t=e.match(Fn)){let e=t.slice(1,4);e[0]=Q($(e[0],0),0,1),e[1]=Q($(e[1],0),0,.4,!1),e[2]=+$(e[2].replace(`deg`,``),0);let n=Z(Sn(e));return n[3]=t[4]===void 0?1:+Q(t[4],0,1),n}};Ln.test=e=>En.test(e)||kn.test(e)||Mn.test(e)||Nn.test(e)||Pn.test(e)||Fn.test(e)||Dn.test(e)||On.test(e)||An.test(e)||jn.test(e)||e===`transparent`,y.prototype.css=function(e){return xn(this._rgb,e)};const Rn=(...e)=>new y(...e,`css`);b.css=Rn,v.format.css=Ln,v.autodetect.push({p:5,test:(e,...t)=>{if(!t.length&&a(e)===`string`&&Ln.test(e))return`css`}}),v.format.gl=(...e)=>{let t=o(e,`rgba`);return t[0]*=255,t[1]*=255,t[2]*=255,t};const zn=(...e)=>new y(...e,`gl`);b.gl=zn,y.prototype.gl=function(){let e=this._rgb;return[e[0]/255,e[1]/255,e[2]/255,e[3]]},y.prototype.hex=function(e){return E(this._rgb,e)};const Bn=(...e)=>new y(...e,`hex`);b.hex=Bn,v.format.hex=w,v.autodetect.push({p:4,test:(e,...t)=>{if(!t.length&&a(e)===`string`&&[3,4,5,6,7,8,9].indexOf(e.length)>=0)return`hex`}});const{log:Vn}=Math,Hn=e=>{let t=e/100,n,r,i;return t<66?(n=255,r=t<6?0:-155.25485562709179-.44596950469579133*(r=t-2)+104.49216199393888*Vn(r),i=t<20?0:-254.76935184120902+.8274096064007395*(i=t-10)+115.67994401066147*Vn(i)):(n=351.97690566805693+.114206453784165*(n=t-55)-40.25366309332127*Vn(n),r=325.4494125711974+.07943456536662342*(r=t-50)-28.0852963507957*Vn(r),i=255),[n,r,i,1]},{round:Un}=Math,Wn=(...e)=>{let t=o(e,`rgb`),n=t[0],r=t[2],i=1e3,a=4e4,s;for(;a-i>.4;){s=(a+i)*.5;let e=Hn(s);e[2]/e[0]>=r/n?a=s:i=s}return Un(s)};y.prototype.temp=y.prototype.kelvin=y.prototype.temperature=function(){return Wn(this._rgb)};const Gn=(...e)=>new y(...e,`temp`);Object.assign(b,{temp:Gn,kelvin:Gn,temperature:Gn}),v.format.temp=v.format.kelvin=v.format.temperature=Hn,y.prototype.oklch=function(){return vn(this._rgb)};const Kn=(...e)=>new y(...e,`oklch`);Object.assign(b,{oklch:Kn}),v.format.oklch=Sn,v.autodetect.push({p:2,test:(...e)=>{if(e=o(e,`oklch`),a(e)===`array`&&e.length===3)return`oklch`}}),Object.assign(b,{analyze:Bt,average:ft,bezier:vt,blend:V,brewer:ln,Color:y,colors:x,contrast:Ht,contrastAPCA:Kt,cubehelix:Mt,deltaE:tn,distance:nn,input:v,interpolate:F,limits:Vt,mix:F,random:Ft,scale:B,scales:an,valid:rn});var qn=b;const Jn=[.96,.907,.805,.697,.605,.547,.518,.445,.395,.34],Yn=[.32,.16,.08,.04,0,0,.04,.08,.16,.32];function Xn(e){let t=e.get(`hsl.l`);return Jn.reduce((e,n)=>Math.abs(n-t)<Math.abs(e-t)?n:e)}function Zn(e){let t=qn(e),n=Xn(t),r=Jn.findIndex(e=>e===n),i=Jn.map(e=>t.set(`hsl.l`,e)).map(e=>qn(e)).map((e,t)=>{let n=Yn[t]-Yn[r];return n>=0?e.saturate(n):e.desaturate(n*-1)});return i[r]=qn(e),{baseColorIndex:r,colors:i}}function Qn(e){return Zn(e).colors.map(e=>e.hex())}export{qn as n,Qn as t};
|