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