@rivm-loculus-tools/sequence-editor 1.6.5 → 1.7.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.
Files changed (54) hide show
  1. package/dist/_chunks/EngineWorker.js +7 -0
  2. package/dist/_chunks/EngineWorker.js.map +1 -0
  3. package/dist/_chunks/SequenceEditor.js +333 -294
  4. package/dist/_chunks/SequenceEditor.js.map +1 -1
  5. package/dist/_chunks/SequenceEditorEventBusService.js.map +1 -1
  6. package/dist/_chunks/SequenceEditorPageDrawer.js +1392 -195
  7. package/dist/_chunks/SequenceEditorPageDrawer.js.map +1 -1
  8. package/dist/_chunks/sequenceEditorStore.js +39 -24
  9. package/dist/_chunks/sequenceEditorStore.js.map +1 -1
  10. package/dist/_chunks/sequence_editor.js +146 -127
  11. package/dist/_chunks/sequence_editor.js.map +1 -1
  12. package/dist/assets/AlignerWorker-Cf4trdzm.js +8 -0
  13. package/dist/assets/AlignerWorker-Cf4trdzm.js.map +1 -0
  14. package/dist/assets/index-YCKQaSTQ.js +8 -0
  15. package/dist/assets/index-YCKQaSTQ.js.map +1 -0
  16. package/dist/assets/palette.schema.json +256 -0
  17. package/dist/classes/services/EditorWorkerService/EditorWorkerService.d.ts +6 -0
  18. package/dist/classes/services/EditorWorkerService/index.js +42 -2
  19. package/dist/classes/services/EditorWorkerService/index.js.map +1 -1
  20. package/dist/classes/services/SequenceEditorEventBusService/SequenceEditorEventBusService.d.ts +2 -0
  21. package/dist/classes/workers/AlignerWorker/AlignerWorker.d.ts +14 -0
  22. package/dist/classes/workers/AlignerWorker/index.d.ts +1 -0
  23. package/dist/classes/workers/AlignerWorker/index.js +19 -0
  24. package/dist/classes/workers/AlignerWorker/index.js.map +1 -0
  25. package/dist/classes/workers/EngineWorker/EngineWorker.d.ts +1 -0
  26. package/dist/classes/workers/EngineWorker/index.js +4 -1
  27. package/dist/classes/workers/EngineWorker/index.js.map +1 -1
  28. package/dist/components/ui/SequenceEditorPageDrawer/SequenceEditorPageDrawerColorForm.d.ts +17 -6
  29. package/dist/components/ui/SequenceEditorPageDrawer/SequenceEditorPageDrawerColorPicker.d.ts +10 -0
  30. package/dist/components/ui/SequenceEditorPageHeader/index.js +71 -53
  31. package/dist/components/ui/SequenceEditorPageHeader/index.js.map +1 -1
  32. package/dist/components/ui/SequenceEditorRealignModal/SequenceEditorRealignModal.d.ts +7 -0
  33. package/dist/components/ui/SequenceEditorRealignModal/index.d.ts +1 -0
  34. package/dist/components/ui/SequenceEditorRealignModal/index.js +49 -0
  35. package/dist/components/ui/SequenceEditorRealignModal/index.js.map +1 -0
  36. package/dist/constants/index.js +4 -4
  37. package/dist/constants/palette.d.ts +4 -0
  38. package/dist/constants/palette.js +85 -42
  39. package/dist/constants/palette.js.map +1 -1
  40. package/dist/models/editor.models.d.ts +9 -5
  41. package/dist/models/editor.models.js.map +1 -1
  42. package/dist/models/palette.models.d.ts +1 -0
  43. package/dist/models/palette.models.js +2 -2
  44. package/dist/models/palette.models.js.map +1 -1
  45. package/dist/stores/sequenceEditorStore/sequenceEditorStore.d.ts +6 -0
  46. package/dist/utils/EditorUtil/index.js +82 -82
  47. package/dist/utils/PaletteUtil/PaletteUtil.d.ts +4 -0
  48. package/dist/utils/PaletteUtil/index.js +35 -2
  49. package/dist/utils/PaletteUtil/index.js.map +1 -1
  50. package/dist/vite/paletteSchemaPlugin/index.d.ts +1 -0
  51. package/dist/vite/paletteSchemaPlugin/index.js +60 -0
  52. package/dist/vite/paletteSchemaPlugin/index.js.map +1 -0
  53. package/dist/vite/paletteSchemaPlugin/paletteSchemaPlugin.d.ts +2 -0
  54. package/package.json +28 -14
@@ -1,68 +1,1288 @@
1
- import { t as e } from "./sequenceEditorStore.js";
2
- import { t } from "./react.js";
3
- import { KEYBOARD_SHORTCUTS as n } from "../constants/keyboard.js";
4
- import { ALI_VIEW_CLUSTAL_X_AMINO_ACID_PALETTE as r, ALI_VIEW_DEFAULT_AMINO_ACID_PALETTE as i, ALI_VIEW_DEFAULT_NUCLEOTIDE_PALETTE as a, ALI_VIEW_FAST_NUCLEOTIDE_PALETTE as o, ALI_VIEW_SEA_VIEW_AMINO_ACID_PALETTE as s, ALI_VIEW_SEA_VIEW_NUCLEOTIDE_PALETTE as c } from "../constants/palette.js";
1
+ import { CUSTOM_PALETTE_NAME as e } from "../models/palette.models.js";
2
+ import { HEX_COLOR_REGEX as t, PaletteUtil as n } from "../utils/PaletteUtil/index.js";
3
+ import { ALI_VIEW_CLUSTAL_X_AMINO_ACID_PALETTE as r, ALI_VIEW_DEFAULT_AMINO_ACID_PALETTE as i, ALI_VIEW_DEFAULT_NUCLEOTIDE_PALETTE as a, ALI_VIEW_FAST_NUCLEOTIDE_PALETTE as o, ALI_VIEW_SEA_VIEW_AMINO_ACID_PALETTE as s, ALI_VIEW_SEA_VIEW_NUCLEOTIDE_PALETTE as c, AMINO_ACID_SYMBOLS as l, AMINO_ACID_SYMBOL_LABELS as u, NUCLEOTIDE_SYMBOLS as d, NUCLEOTIDE_SYMBOL_LABELS as f, PALETTE_SCHEMA_URL_PATH as p } from "../constants/palette.js";
4
+ import { t as m } from "./sequenceEditorStore.js";
5
+ import { t as h } from "./react.js";
6
+ import { KEYBOARD_SHORTCUTS as g } from "../constants/keyboard.js";
5
7
  import "../constants/index.js";
6
- import { useCallback as l, useEffect as u, useId as d, useMemo as f, useState as p } from "react";
7
- import { Accordion as m, AccordionDetails as h, AccordionSummary as g, Box as _, ListItemButton as v, ListItemText as y, Typography as b } from "@mui/material";
8
- import x from "@mui/icons-material/ExpandMore";
9
- import S from "@mui/icons-material/TuneOutlined";
10
- import C from "@mui/icons-material/PaletteOutlined";
11
- import w from "@mui/icons-material/InvertColors";
12
- import T from "@mui/icons-material/KeyboardOutlined";
13
- import { PageCommonDrawer as E } from "@rivm-loculus-tools/common-frontend/components/ui/PageCommonDrawer";
14
- import { useForm as D } from "react-hook-form";
15
- import { GenericForm as O } from "@gen-epix/ui-core-form/components/helpers/GenericForm";
16
- import { FORM_FIELD_DEFINITION_TYPE as k } from "@gen-epix/ui-core-form/models/form.models";
17
- import { Fragment as A, jsx as j, jsxs as M } from "react/jsx-runtime";
18
- import { KeyboardArrowDown as N, KeyboardArrowLeft as P, KeyboardArrowRight as F, KeyboardArrowUp as I, KeyboardCommandKey as L, KeyboardControlKey as R, KeyboardOptionKey as z, SpaceBar as B } from "@mui/icons-material";
19
- // src/components/ui/SequenceEditorPageDrawer/SequenceEditorPageDrawerColorForm.tsx
20
- var V = ({ currentPalette: e, onPaletteChange: t, palettes: n }) => {
21
- let r = d(), i = l((e) => {
22
- let r = n.find((t) => t.name === e);
23
- r && t(r);
24
- }, [t, n]), a = f(() => n.map((e) => ({
8
+ import _, { useCallback as v, useEffect as y, useId as b, useMemo as x, useRef as S, useState as C } from "react";
9
+ import { Accordion as w, AccordionDetails as T, AccordionSummary as E, Alert as D, Box as O, Button as k, ListItemButton as A, ListItemText as j, Typography as M } from "@mui/material";
10
+ import N from "@mui/icons-material/ExpandMore";
11
+ import ee from "@mui/icons-material/TuneOutlined";
12
+ import te from "@mui/icons-material/PaletteOutlined";
13
+ import ne from "@mui/icons-material/KeyboardOutlined";
14
+ import { PageCommonDrawer as re } from "@rivm-loculus-tools/common-frontend/components/ui/PageCommonDrawer";
15
+ import { GenericForm as P } from "@gen-epix/ui-core-form/components/helpers/GenericForm";
16
+ import { FORM_FIELD_DEFINITION_TYPE as F } from "@gen-epix/ui-core-form/models/form.models";
17
+ import { useForm as I } from "react-hook-form";
18
+ import { UrlUtil as ie } from "@rivm-loculus-tools/common-frontend/utils/UrlUtil";
19
+ import { DownloadUtil as ae } from "@gen-epix/ui-core/utils/DownloadUtil";
20
+ import oe from "@mui/material/Button";
21
+ import { styled as L } from "@mui/material/styles";
22
+ import { Fragment as se, jsx as R, jsxs as z } from "react/jsx-runtime";
23
+ import ce from "@mui/material/Popover";
24
+ import le from "@mui/material/Slider";
25
+ import B from "@mui/material/Box";
26
+ import ue from "@mui/material/TextField";
27
+ import de from "@mui/material/InputAdornment";
28
+ import { KeyboardArrowDown as fe, KeyboardArrowLeft as pe, KeyboardArrowRight as me, KeyboardArrowUp as he, KeyboardCommandKey as ge, KeyboardControlKey as _e, KeyboardOptionKey as ve, SpaceBar as ye } from "@mui/icons-material";
29
+ // ../../../../node_modules/.pnpm/mui-color-input@9.0.0_@emotion+react@11.14.0_@types+react@19.3.0_react@19.3.1_supports-_69246ccacf42d29a103ebbeb04dd67cb/node_modules/mui-color-input/dist/mui-color-input.es.js
30
+ var be = "linear-gradient(45deg, #ccc 25%, transparent 25%), linear-gradient(135deg, #ccc 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #ccc 75%), linear-gradient(135deg, transparent 75%, #ccc 75%) /*! @noflip */", xe = "linear-gradient(to top, #000000, transparent), linear-gradient(to right, #ffffff, transparent) /*! @noflip */", Se = { Button: L(oe)(() => ({
31
+ backgroundSize: "8px 8px",
32
+ backgroundPosition: "0 0, 4px 0, 4px -4px, 0px 4px",
33
+ transition: "none",
34
+ boxShadow: "0 4px 6px rgba(50, 50, 93, 0.11), 0 1px 3px rgba(0, 0, 0, 0.08)",
35
+ border: 0,
36
+ borderRadius: 4,
37
+ width: "24px",
38
+ aspectRatio: "1 / 1",
39
+ height: "24px",
40
+ minWidth: 0
41
+ })) }, Ce = (e) => {
42
+ let { bgColor: t, className: n, disablePopover: r, isBgColorValid: i, ...a } = e;
43
+ return /* @__PURE__ */ R(Se.Button, {
44
+ disableTouchRipple: !0,
45
+ style: {
46
+ backgroundColor: i ? t : void 0,
47
+ backgroundImage: i ? void 0 : be,
48
+ cursor: r ? "default" : void 0
49
+ },
50
+ className: `MuiColorInput-Button ${n || ""}`,
51
+ variant: "text",
52
+ disableElevation: !1,
53
+ ...a
54
+ });
55
+ }, we = { Container: L("div")(() => ({
56
+ width: 300,
57
+ padding: 8
58
+ })) }, Te = ({ children: e, className: t, position: n = "start", ...r }) => /* @__PURE__ */ R(ce, {
59
+ className: `MuiColorInput-Popover ${t || ""}`,
60
+ anchorOrigin: {
61
+ vertical: "bottom",
62
+ horizontal: n === "start" ? "left" : "right"
63
+ },
64
+ transformOrigin: {
65
+ vertical: "top",
66
+ horizontal: n === "start" ? "left" : "right"
67
+ },
68
+ ...r,
69
+ children: /* @__PURE__ */ R(we.Container, { children: e })
70
+ }), Ee = { Slider: L(le, { shouldForwardProp: (e) => e !== "$rgbaFrom" && e !== "$rgbaTo" })(() => ({
71
+ height: 8,
72
+ "& .MuiSlider-rail": {
73
+ opacity: 1,
74
+ background: "linear-gradient(to right, rgba(var(--rgb-r), var(--rgb-g), var(--rgb-b), 0) 0%, rgba(var(--rgb-r), var(--rgb-g), var(--rgb-b), 1) 100%)"
75
+ },
76
+ "& .MuiSlider-track": {
77
+ color: "transparent",
78
+ border: 0
79
+ },
80
+ "& .MuiSlider-thumb": {
81
+ backgroundColor: "#ffffff",
82
+ border: "3px solid currentColor"
83
+ }
84
+ })) }, De = (e) => {
85
+ let { rgbColor: t, style: n, className: r, ...i } = e, a = {
86
+ "--rgb-r": t.r,
87
+ "--rgb-g": t.g,
88
+ "--rgb-b": t.b,
89
+ ...n
90
+ };
91
+ return /* @__PURE__ */ R(Ee.Slider, {
92
+ className: `MuiColorInput-AlphaSlider ${r || ""}`,
93
+ style: a,
94
+ ...i
95
+ });
96
+ }, V = {
97
+ up: "ArrowUp",
98
+ down: "ArrowDown",
99
+ left: "ArrowLeft",
100
+ right: "ArrowRight"
101
+ }, Oe = {
102
+ ArrowUp: {
103
+ type: "hsvV",
104
+ value: 1
105
+ },
106
+ ArrowDown: {
107
+ type: "hsvV",
108
+ value: -1
109
+ },
110
+ ArrowLeft: {
111
+ type: "hsvS",
112
+ value: -1
113
+ },
114
+ ArrowRight: {
115
+ type: "hsvS",
116
+ value: 1
117
+ }
118
+ };
119
+ function ke(e) {
120
+ return e === V.up || e === V.down || e === V.left || e === V.right;
121
+ }
122
+ function H(e, t, n) {
123
+ return Math.max(t, Math.min(e, n));
124
+ }
125
+ function Ae(e) {
126
+ return typeof e == "number";
127
+ }
128
+ function je(e, t, n) {
129
+ let r = e.toLocaleString("en", {
130
+ useGrouping: !1,
131
+ minimumFractionDigits: t,
132
+ maximumFractionDigits: n
133
+ });
134
+ return Number(r);
135
+ }
136
+ function Me(e, t, n) {
137
+ let r = e.getBoundingClientRect(), i = t - r.left, a = n - r.top;
138
+ return {
139
+ x: H(i / r.width, 0, 1),
140
+ y: H(1 - a / r.height, 0, 1)
141
+ };
142
+ }
143
+ function Ne(e) {
144
+ let t = _.useRef(void 0);
145
+ return _.useLayoutEffect(() => {
146
+ t.current = e;
147
+ }), _.useCallback((...e) => t.current?.(...e), []);
148
+ }
149
+ var Pe = {
150
+ Space: L("div")(() => ({
151
+ width: "100%",
152
+ height: "180px",
153
+ boxSizing: "border-box",
154
+ outline: 0,
155
+ position: "relative",
156
+ backgroundImage: xe
157
+ })),
158
+ Thumb: L("div")(() => ({
159
+ position: "absolute",
160
+ border: "3px solid #ffffff",
161
+ borderRadius: "50%",
162
+ width: "20px",
163
+ height: "20px",
164
+ marginLeft: "-10px /*! @noflip */",
165
+ marginBottom: "-10px /*! @noflip */",
166
+ outline: 0,
167
+ boxSizing: "border-box",
168
+ willChange: "left, bottom",
169
+ transition: "box-shadow 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms",
170
+ "&:hover": { boxShadow: "0px 0px 0px 4px rgba(255 255 255 / 0.16)" },
171
+ "&.MuiColorInput-Thumb-active": { boxShadow: "0px 0px 0px 8px rgba(255 255 255 / 0.16)" },
172
+ "@media (hover: none)": { boxShadow: "none" }
173
+ }))
174
+ }, Fe = (e) => {
175
+ let { hsv: t, onChange: n, currentHue: r } = e, i = _.useRef(!1), a = _.useRef(null), [o, s] = _.useState(!1), c = Ne((e, t) => {
176
+ if (!a.current) return;
177
+ let { x: r, y: i } = Me(a.current, e, t);
178
+ n({
179
+ s: r,
180
+ v: i
181
+ }), a.current && document.activeElement !== a.current && a.current.focus();
182
+ }), l = _.useCallback(() => {
183
+ i.current && (i.current = !1, s(!1));
184
+ }, []), u = _.useCallback((e) => {
185
+ i.current && c(e.clientX, e.clientY);
186
+ }, []);
187
+ _.useEffect(() => (document.addEventListener("pointermove", u, !1), document.addEventListener("pointerup", l, !1), () => {
188
+ document.removeEventListener("pointermove", u, !1), document.removeEventListener("pointerup", l, !1);
189
+ }), [l, u]);
190
+ let d = (e) => {
191
+ e.preventDefault(), i.current = !0, c(e.clientX, e.clientY), s(!0);
192
+ }, f = (e) => {
193
+ if (ke(e.key)) {
194
+ e.preventDefault();
195
+ let { type: r, value: i } = Oe[e.key], a = e.shiftKey ? 10 : 1, o = H((r === "hsvS" ? t.s : t.v) + i * a * .01, 0, 1);
196
+ s(!0), n({
197
+ s: r === "hsvS" ? o : t.s,
198
+ v: r === "hsvV" ? o : t.v
199
+ });
200
+ }
201
+ }, p = t.s * 100, m = t.v * 100;
202
+ return /* @__PURE__ */ R(Pe.Space, {
203
+ onPointerDown: d,
204
+ ref: a,
205
+ className: "MuiColorInput-ColorSpace",
206
+ style: {
207
+ backgroundColor: `hsl(${r} 100% 50%)`,
208
+ touchAction: "none"
209
+ },
210
+ role: "slider",
211
+ "aria-valuetext": `Saturation ${je(p, 0, 0)}%, Brightness ${je(m, 0, 0)}%`,
212
+ onKeyDown: f,
213
+ tabIndex: 0,
214
+ children: /* @__PURE__ */ R(Pe.Thumb, {
215
+ "aria-label": "Color space thumb",
216
+ className: o ? "MuiColorInput-Thumb-active" : "",
217
+ style: {
218
+ left: `${p}%`,
219
+ bottom: `${m}%`
220
+ }
221
+ })
222
+ });
223
+ }, Ie = { Slider: L(le)(() => ({
224
+ height: 8,
225
+ "& .MuiSlider-rail": {
226
+ opacity: 1,
227
+ background: "linear-gradient(to right, rgb(255, 0, 0) 0%, rgb(255, 255, 0) 17%, rgb(0, 255, 0) 33%, rgb(0, 255, 255) 50%, rgb(0, 0, 255) 67%, rgb(255, 0, 255) 83%, rgb(255, 0, 0) 100%) /*! @noflip */"
228
+ },
229
+ "& .MuiSlider-track": {
230
+ color: "transparent",
231
+ border: 0
232
+ },
233
+ "& .MuiSlider-thumb": {
234
+ backgroundColor: "#ffffff",
235
+ border: "3px solid currentColor"
236
+ }
237
+ })) }, Le = (e) => {
238
+ let { className: t, ...n } = e;
239
+ return /* @__PURE__ */ R(Ie.Slider, {
240
+ className: `MuiColorInput-HueSlider ${t || ""}`,
241
+ ...n
242
+ });
243
+ };
244
+ function U(e, t) {
245
+ Re(e) && (e = "100%");
246
+ let n = ze(e);
247
+ return e = t === 360 ? e : Math.min(t, Math.max(0, parseFloat(e))), n && (e = parseInt(String(e * t), 10) / 100), Math.abs(e - t) < 1e-6 ? 1 : (e = t === 360 ? (e < 0 ? e % t + t : e % t) / parseFloat(String(t)) : e % t / parseFloat(String(t)), e);
248
+ }
249
+ function W(e) {
250
+ return Math.min(1, Math.max(0, e));
251
+ }
252
+ function Re(e) {
253
+ return typeof e == "string" && e.indexOf(".") !== -1 && parseFloat(e) === 1;
254
+ }
255
+ function ze(e) {
256
+ return typeof e == "string" && e.indexOf("%") !== -1;
257
+ }
258
+ function Be(e) {
259
+ return e = parseFloat(e), (isNaN(e) || e < 0 || e > 1) && (e = 1), e;
260
+ }
261
+ function G(e) {
262
+ return Number(e) <= 1 ? `${Number(e) * 100}%` : e;
263
+ }
264
+ function K(e) {
265
+ return e.length === 1 ? "0" + e : String(e);
266
+ }
267
+ function Ve(e, t, n) {
268
+ return {
269
+ r: U(e, 255) * 255,
270
+ g: U(t, 255) * 255,
271
+ b: U(n, 255) * 255
272
+ };
273
+ }
274
+ function He(e, t, n) {
275
+ e = U(e, 255), t = U(t, 255), n = U(n, 255);
276
+ let r = Math.max(e, t, n), i = Math.min(e, t, n), a = 0, o = 0, s = (r + i) / 2;
277
+ if (r === i) o = 0, a = 0;
278
+ else {
279
+ let c = r - i;
280
+ switch (o = s > .5 ? c / (2 - r - i) : c / (r + i), r) {
281
+ case e:
282
+ a = (t - n) / c + (t < n ? 6 : 0);
283
+ break;
284
+ case t:
285
+ a = (n - e) / c + 2;
286
+ break;
287
+ case n: a = (e - t) / c + 4;
288
+ }
289
+ a /= 6;
290
+ }
291
+ return {
292
+ h: a,
293
+ s: o,
294
+ l: s
295
+ };
296
+ }
297
+ function Ue(e, t, n) {
298
+ return n < 0 && (n += 1), n > 1 && --n, n < 1 / 6 ? e + (t - e) * (6 * n) : n < 1 / 2 ? t : n < 2 / 3 ? e + (t - e) * (2 / 3 - n) * 6 : e;
299
+ }
300
+ function We(e, t, n) {
301
+ let r, i, a;
302
+ if (e = U(e, 360), t = U(t, 100), n = U(n, 100), t === 0) i = n, a = n, r = n;
303
+ else {
304
+ let o = n < .5 ? n * (1 + t) : n + t - n * t, s = 2 * n - o;
305
+ r = Ue(s, o, e + 1 / 3), i = Ue(s, o, e), a = Ue(s, o, e - 1 / 3);
306
+ }
307
+ return {
308
+ r: r * 255,
309
+ g: i * 255,
310
+ b: a * 255
311
+ };
312
+ }
313
+ function Ge(e, t, n) {
314
+ e = U(e, 255), t = U(t, 255), n = U(n, 255);
315
+ let r = Math.max(e, t, n), i = Math.min(e, t, n), a = 0, o = r, s = r - i, c = r === 0 ? 0 : s / r;
316
+ if (r === i) a = 0;
317
+ else {
318
+ switch (r) {
319
+ case e:
320
+ a = (t - n) / s + (t < n ? 6 : 0);
321
+ break;
322
+ case t:
323
+ a = (n - e) / s + 2;
324
+ break;
325
+ case n: a = (e - t) / s + 4;
326
+ }
327
+ a /= 6;
328
+ }
329
+ return {
330
+ h: a,
331
+ s: c,
332
+ v: o
333
+ };
334
+ }
335
+ function Ke(e, t, n) {
336
+ e = U(e, 360) * 6, t = U(t, 100), n = U(n, 100);
337
+ let r = Math.floor(e), i = e - r, a = n * (1 - t), o = n * (1 - i * t), s = n * (1 - (1 - i) * t), c = r % 6, l = [
338
+ n,
339
+ o,
340
+ a,
341
+ a,
342
+ s,
343
+ n
344
+ ][c], u = [
345
+ s,
346
+ n,
347
+ n,
348
+ o,
349
+ a,
350
+ a
351
+ ][c], d = [
352
+ a,
353
+ a,
354
+ s,
355
+ n,
356
+ n,
357
+ o
358
+ ][c];
359
+ return {
360
+ r: l * 255,
361
+ g: u * 255,
362
+ b: d * 255
363
+ };
364
+ }
365
+ function qe(e, t, n, r) {
366
+ let i = [
367
+ K(Math.round(e).toString(16)),
368
+ K(Math.round(t).toString(16)),
369
+ K(Math.round(n).toString(16))
370
+ ];
371
+ return r && i[0].startsWith(i[0].charAt(1)) && i[1].startsWith(i[1].charAt(1)) && i[2].startsWith(i[2].charAt(1)) ? i[0].charAt(0) + i[1].charAt(0) + i[2].charAt(0) : i.join("");
372
+ }
373
+ function Je(e, t, n, r, i) {
374
+ let a = [
375
+ K(Math.round(e).toString(16)),
376
+ K(Math.round(t).toString(16)),
377
+ K(Math.round(n).toString(16)),
378
+ K(Ze(r))
379
+ ];
380
+ return i && a[0].startsWith(a[0].charAt(1)) && a[1].startsWith(a[1].charAt(1)) && a[2].startsWith(a[2].charAt(1)) && a[3].startsWith(a[3].charAt(1)) ? a[0].charAt(0) + a[1].charAt(0) + a[2].charAt(0) + a[3].charAt(0) : a.join("");
381
+ }
382
+ function Ye(e, t, n, r) {
383
+ let i = e / 100, a = t / 100, o = n / 100, s = r / 100;
384
+ return {
385
+ r: 255 * (1 - i) * (1 - s),
386
+ g: 255 * (1 - a) * (1 - s),
387
+ b: 255 * (1 - o) * (1 - s)
388
+ };
389
+ }
390
+ function Xe(e, t, n) {
391
+ let r = 1 - e / 255, i = 1 - t / 255, a = 1 - n / 255, o = Math.min(r, i, a);
392
+ return o === 1 ? (r = 0, i = 0, a = 0) : (r = (r - o) / (1 - o) * 100, i = (i - o) / (1 - o) * 100, a = (a - o) / (1 - o) * 100), o *= 100, {
393
+ c: Math.round(r),
394
+ m: Math.round(i),
395
+ y: Math.round(a),
396
+ k: Math.round(o)
397
+ };
398
+ }
399
+ function Ze(e) {
400
+ return Math.round(parseFloat(e) * 255).toString(16);
401
+ }
402
+ function Qe(e) {
403
+ return q(e) / 255;
404
+ }
405
+ function q(e) {
406
+ return parseInt(e, 16);
407
+ }
408
+ function $e(e) {
409
+ return {
410
+ r: e >> 16,
411
+ g: (e & 65280) >> 8,
412
+ b: e & 255
413
+ };
414
+ }
415
+ var et = {
416
+ aliceblue: "#f0f8ff",
417
+ antiquewhite: "#faebd7",
418
+ aqua: "#00ffff",
419
+ aquamarine: "#7fffd4",
420
+ azure: "#f0ffff",
421
+ beige: "#f5f5dc",
422
+ bisque: "#ffe4c4",
423
+ black: "#000000",
424
+ blanchedalmond: "#ffebcd",
425
+ blue: "#0000ff",
426
+ blueviolet: "#8a2be2",
427
+ brown: "#a52a2a",
428
+ burlywood: "#deb887",
429
+ cadetblue: "#5f9ea0",
430
+ chartreuse: "#7fff00",
431
+ chocolate: "#d2691e",
432
+ coral: "#ff7f50",
433
+ cornflowerblue: "#6495ed",
434
+ cornsilk: "#fff8dc",
435
+ crimson: "#dc143c",
436
+ cyan: "#00ffff",
437
+ darkblue: "#00008b",
438
+ darkcyan: "#008b8b",
439
+ darkgoldenrod: "#b8860b",
440
+ darkgray: "#a9a9a9",
441
+ darkgreen: "#006400",
442
+ darkgrey: "#a9a9a9",
443
+ darkkhaki: "#bdb76b",
444
+ darkmagenta: "#8b008b",
445
+ darkolivegreen: "#556b2f",
446
+ darkorange: "#ff8c00",
447
+ darkorchid: "#9932cc",
448
+ darkred: "#8b0000",
449
+ darksalmon: "#e9967a",
450
+ darkseagreen: "#8fbc8f",
451
+ darkslateblue: "#483d8b",
452
+ darkslategray: "#2f4f4f",
453
+ darkslategrey: "#2f4f4f",
454
+ darkturquoise: "#00ced1",
455
+ darkviolet: "#9400d3",
456
+ deeppink: "#ff1493",
457
+ deepskyblue: "#00bfff",
458
+ dimgray: "#696969",
459
+ dimgrey: "#696969",
460
+ dodgerblue: "#1e90ff",
461
+ firebrick: "#b22222",
462
+ floralwhite: "#fffaf0",
463
+ forestgreen: "#228b22",
464
+ fuchsia: "#ff00ff",
465
+ gainsboro: "#dcdcdc",
466
+ ghostwhite: "#f8f8ff",
467
+ goldenrod: "#daa520",
468
+ gold: "#ffd700",
469
+ gray: "#808080",
470
+ green: "#008000",
471
+ greenyellow: "#adff2f",
472
+ grey: "#808080",
473
+ honeydew: "#f0fff0",
474
+ hotpink: "#ff69b4",
475
+ indianred: "#cd5c5c",
476
+ indigo: "#4b0082",
477
+ ivory: "#fffff0",
478
+ khaki: "#f0e68c",
479
+ lavenderblush: "#fff0f5",
480
+ lavender: "#e6e6fa",
481
+ lawngreen: "#7cfc00",
482
+ lemonchiffon: "#fffacd",
483
+ lightblue: "#add8e6",
484
+ lightcoral: "#f08080",
485
+ lightcyan: "#e0ffff",
486
+ lightgoldenrodyellow: "#fafad2",
487
+ lightgray: "#d3d3d3",
488
+ lightgreen: "#90ee90",
489
+ lightgrey: "#d3d3d3",
490
+ lightpink: "#ffb6c1",
491
+ lightsalmon: "#ffa07a",
492
+ lightseagreen: "#20b2aa",
493
+ lightskyblue: "#87cefa",
494
+ lightslategray: "#778899",
495
+ lightslategrey: "#778899",
496
+ lightsteelblue: "#b0c4de",
497
+ lightyellow: "#ffffe0",
498
+ lime: "#00ff00",
499
+ limegreen: "#32cd32",
500
+ linen: "#faf0e6",
501
+ magenta: "#ff00ff",
502
+ maroon: "#800000",
503
+ mediumaquamarine: "#66cdaa",
504
+ mediumblue: "#0000cd",
505
+ mediumorchid: "#ba55d3",
506
+ mediumpurple: "#9370db",
507
+ mediumseagreen: "#3cb371",
508
+ mediumslateblue: "#7b68ee",
509
+ mediumspringgreen: "#00fa9a",
510
+ mediumturquoise: "#48d1cc",
511
+ mediumvioletred: "#c71585",
512
+ midnightblue: "#191970",
513
+ mintcream: "#f5fffa",
514
+ mistyrose: "#ffe4e1",
515
+ moccasin: "#ffe4b5",
516
+ navajowhite: "#ffdead",
517
+ navy: "#000080",
518
+ oldlace: "#fdf5e6",
519
+ olive: "#808000",
520
+ olivedrab: "#6b8e23",
521
+ orange: "#ffa500",
522
+ orangered: "#ff4500",
523
+ orchid: "#da70d6",
524
+ palegoldenrod: "#eee8aa",
525
+ palegreen: "#98fb98",
526
+ paleturquoise: "#afeeee",
527
+ palevioletred: "#db7093",
528
+ papayawhip: "#ffefd5",
529
+ peachpuff: "#ffdab9",
530
+ peru: "#cd853f",
531
+ pink: "#ffc0cb",
532
+ plum: "#dda0dd",
533
+ powderblue: "#b0e0e6",
534
+ purple: "#800080",
535
+ rebeccapurple: "#663399",
536
+ red: "#ff0000",
537
+ rosybrown: "#bc8f8f",
538
+ royalblue: "#4169e1",
539
+ saddlebrown: "#8b4513",
540
+ salmon: "#fa8072",
541
+ sandybrown: "#f4a460",
542
+ seagreen: "#2e8b57",
543
+ seashell: "#fff5ee",
544
+ sienna: "#a0522d",
545
+ silver: "#c0c0c0",
546
+ skyblue: "#87ceeb",
547
+ slateblue: "#6a5acd",
548
+ slategray: "#708090",
549
+ slategrey: "#708090",
550
+ snow: "#fffafa",
551
+ springgreen: "#00ff7f",
552
+ steelblue: "#4682b4",
553
+ tan: "#d2b48c",
554
+ teal: "#008080",
555
+ thistle: "#d8bfd8",
556
+ tomato: "#ff6347",
557
+ turquoise: "#40e0d0",
558
+ violet: "#ee82ee",
559
+ wheat: "#f5deb3",
560
+ white: "#ffffff",
561
+ whitesmoke: "#f5f5f5",
562
+ yellow: "#ffff00",
563
+ yellowgreen: "#9acd32"
564
+ };
565
+ function tt(e) {
566
+ let t = {
567
+ r: 0,
568
+ g: 0,
569
+ b: 0
570
+ }, n = 1, r = null, i = null, a = null, o = !1, s = !1;
571
+ return typeof e == "string" && (e = it(e)), typeof e == "object" && (X(e.r) && X(e.g) && X(e.b) ? (t = Ve(e.r, e.g, e.b), o = !0, s = String(e.r).substr(-1) === "%" ? "prgb" : "rgb") : X(e.h) && X(e.s) && X(e.v) ? (r = G(e.s), i = G(e.v), t = Ke(e.h, r, i), o = !0, s = "hsv") : X(e.h) && X(e.s) && X(e.l) ? (r = G(e.s), a = G(e.l), t = We(e.h, r, a), o = !0, s = "hsl") : X(e.c) && X(e.m) && X(e.y) && X(e.k) && (t = Ye(e.c, e.m, e.y, e.k), o = !0, s = "cmyk"), Object.prototype.hasOwnProperty.call(e, "a") && (n = e.a)), n = Be(n), {
572
+ ok: o,
573
+ format: e.format || s,
574
+ r: Math.min(255, Math.max(t.r, 0)),
575
+ g: Math.min(255, Math.max(t.g, 0)),
576
+ b: Math.min(255, Math.max(t.b, 0)),
577
+ a: n
578
+ };
579
+ }
580
+ var nt = "(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)", rt = "[\\s|\\(]+(" + nt + ")[,|\\s]+((?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?))[,|\\s]+((?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?))\\s*\\)?", J = "[\\s|\\(]+(" + nt + ")[,|\\s]+((?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?))[,|\\s]+((?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?))[,|\\s]+((?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?))\\s*\\)?", Y = {
581
+ CSS_UNIT: new RegExp(nt),
582
+ rgb: RegExp("rgb" + rt),
583
+ rgba: RegExp("rgba" + J),
584
+ hsl: RegExp("hsl" + rt),
585
+ hsla: RegExp("hsla" + J),
586
+ hsv: RegExp("hsv" + rt),
587
+ hsva: RegExp("hsva" + J),
588
+ cmyk: RegExp("cmyk" + J),
589
+ hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
590
+ hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
591
+ hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
592
+ hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
593
+ };
594
+ function it(e) {
595
+ if (e = e.trim().toLowerCase(), e.length === 0) return !1;
596
+ let t = !1;
597
+ if (et[e]) e = et[e], t = !0;
598
+ else if (e === "transparent") return {
599
+ r: 0,
600
+ g: 0,
601
+ b: 0,
602
+ a: 0,
603
+ format: "name"
604
+ };
605
+ let n = Y.rgb.exec(e);
606
+ return n ? {
607
+ r: n[1],
608
+ g: n[2],
609
+ b: n[3]
610
+ } : (n = Y.rgba.exec(e), n ? {
611
+ r: n[1],
612
+ g: n[2],
613
+ b: n[3],
614
+ a: n[4]
615
+ } : (n = Y.hsl.exec(e), n ? {
616
+ h: n[1],
617
+ s: n[2],
618
+ l: n[3]
619
+ } : (n = Y.hsla.exec(e), n ? {
620
+ h: n[1],
621
+ s: n[2],
622
+ l: n[3],
623
+ a: n[4]
624
+ } : (n = Y.hsv.exec(e), n ? {
625
+ h: n[1],
626
+ s: n[2],
627
+ v: n[3]
628
+ } : (n = Y.hsva.exec(e), n ? {
629
+ h: n[1],
630
+ s: n[2],
631
+ v: n[3],
632
+ a: n[4]
633
+ } : (n = Y.cmyk.exec(e), n ? {
634
+ c: n[1],
635
+ m: n[2],
636
+ y: n[3],
637
+ k: n[4]
638
+ } : (n = Y.hex8.exec(e), n ? {
639
+ r: q(n[1]),
640
+ g: q(n[2]),
641
+ b: q(n[3]),
642
+ a: Qe(n[4]),
643
+ format: t ? "name" : "hex8"
644
+ } : (n = Y.hex6.exec(e), n ? {
645
+ r: q(n[1]),
646
+ g: q(n[2]),
647
+ b: q(n[3]),
648
+ format: t ? "name" : "hex"
649
+ } : (n = Y.hex4.exec(e), n ? {
650
+ r: q(n[1] + n[1]),
651
+ g: q(n[2] + n[2]),
652
+ b: q(n[3] + n[3]),
653
+ a: Qe(n[4] + n[4]),
654
+ format: t ? "name" : "hex8"
655
+ } : (n = Y.hex3.exec(e), n ? {
656
+ r: q(n[1] + n[1]),
657
+ g: q(n[2] + n[2]),
658
+ b: q(n[3] + n[3]),
659
+ format: t ? "name" : "hex"
660
+ } : !1))))))))));
661
+ }
662
+ function X(e) {
663
+ return typeof e == "number" ? !Number.isNaN(e) : Y.CSS_UNIT.test(e);
664
+ }
665
+ var Z = class e {
666
+ constructor(t = "", n = {}) {
667
+ if (t instanceof e) return t;
668
+ typeof t == "number" && (t = $e(t)), this.originalInput = t;
669
+ let r = tt(t);
670
+ this.originalInput = t, this.r = r.r, this.g = r.g, this.b = r.b, this.a = r.a, this.roundA = Math.round(100 * this.a) / 100, this.format = n.format ?? r.format, this.gradientType = n.gradientType, this.r < 1 && (this.r = Math.round(this.r)), this.g < 1 && (this.g = Math.round(this.g)), this.b < 1 && (this.b = Math.round(this.b)), this.isValid = r.ok;
671
+ }
672
+ isDark() {
673
+ return this.getBrightness() < 128;
674
+ }
675
+ isLight() {
676
+ return !this.isDark();
677
+ }
678
+ getBrightness() {
679
+ let e = this.toRgb();
680
+ return (e.r * 299 + e.g * 587 + e.b * 114) / 1e3;
681
+ }
682
+ getLuminance() {
683
+ let e = this.toRgb(), t, n, r, i = e.r / 255, a = e.g / 255, o = e.b / 255;
684
+ return t = i <= .03928 ? i / 12.92 : ((i + .055) / 1.055) ** 2.4, n = a <= .03928 ? a / 12.92 : ((a + .055) / 1.055) ** 2.4, r = o <= .03928 ? o / 12.92 : ((o + .055) / 1.055) ** 2.4, .2126 * t + .7152 * n + .0722 * r;
685
+ }
686
+ getAlpha() {
687
+ return this.a;
688
+ }
689
+ setAlpha(e) {
690
+ return this.a = Be(e), this.roundA = Math.round(100 * this.a) / 100, this;
691
+ }
692
+ isMonochrome() {
693
+ let { s: e } = this.toHsl();
694
+ return e === 0;
695
+ }
696
+ toHsv() {
697
+ let e = Ge(this.r, this.g, this.b);
698
+ return {
699
+ h: e.h * 360,
700
+ s: e.s,
701
+ v: e.v,
702
+ a: this.a
703
+ };
704
+ }
705
+ toHsvString() {
706
+ let e = Ge(this.r, this.g, this.b), t = Math.round(e.h * 360), n = Math.round(e.s * 100), r = Math.round(e.v * 100);
707
+ return this.a === 1 ? `hsv(${t}, ${n}%, ${r}%)` : `hsva(${t}, ${n}%, ${r}%, ${this.roundA})`;
708
+ }
709
+ toHsl() {
710
+ let e = He(this.r, this.g, this.b);
711
+ return {
712
+ h: e.h * 360,
713
+ s: e.s,
714
+ l: e.l,
715
+ a: this.a
716
+ };
717
+ }
718
+ toHslString() {
719
+ let e = He(this.r, this.g, this.b), t = Math.round(e.h * 360), n = Math.round(e.s * 100), r = Math.round(e.l * 100);
720
+ return this.a === 1 ? `hsl(${t}, ${n}%, ${r}%)` : `hsla(${t}, ${n}%, ${r}%, ${this.roundA})`;
721
+ }
722
+ toHex(e = !1) {
723
+ return qe(this.r, this.g, this.b, e);
724
+ }
725
+ toHexString(e = !1) {
726
+ return "#" + this.toHex(e);
727
+ }
728
+ toHex8(e = !1) {
729
+ return Je(this.r, this.g, this.b, this.a, e);
730
+ }
731
+ toHex8String(e = !1) {
732
+ return "#" + this.toHex8(e);
733
+ }
734
+ toHexShortString(e = !1) {
735
+ return this.a === 1 ? this.toHexString(e) : this.toHex8String(e);
736
+ }
737
+ toRgb() {
738
+ return {
739
+ r: Math.round(this.r),
740
+ g: Math.round(this.g),
741
+ b: Math.round(this.b),
742
+ a: this.a
743
+ };
744
+ }
745
+ toRgbString() {
746
+ let e = Math.round(this.r), t = Math.round(this.g), n = Math.round(this.b);
747
+ return this.a === 1 ? `rgb(${e}, ${t}, ${n})` : `rgba(${e}, ${t}, ${n}, ${this.roundA})`;
748
+ }
749
+ toPercentageRgb() {
750
+ let e = (e) => `${Math.round(U(e, 255) * 100)}%`;
751
+ return {
752
+ r: e(this.r),
753
+ g: e(this.g),
754
+ b: e(this.b),
755
+ a: this.a
756
+ };
757
+ }
758
+ toPercentageRgbString() {
759
+ let e = (e) => Math.round(U(e, 255) * 100);
760
+ return this.a === 1 ? `rgb(${e(this.r)}%, ${e(this.g)}%, ${e(this.b)}%)` : `rgba(${e(this.r)}%, ${e(this.g)}%, ${e(this.b)}%, ${this.roundA})`;
761
+ }
762
+ toCmyk() {
763
+ return { ...Xe(this.r, this.g, this.b) };
764
+ }
765
+ toCmykString() {
766
+ let { c: e, m: t, y: n, k: r } = Xe(this.r, this.g, this.b);
767
+ return `cmyk(${e}, ${t}, ${n}, ${r})`;
768
+ }
769
+ toName() {
770
+ if (this.a === 0) return "transparent";
771
+ if (this.a < 1) return !1;
772
+ let e = "#" + qe(this.r, this.g, this.b, !1);
773
+ for (let [t, n] of Object.entries(et)) if (e === n) return t;
774
+ return !1;
775
+ }
776
+ toString(e) {
777
+ let t = !!e;
778
+ e ??= this.format;
779
+ let n = !1, r = this.a < 1 && this.a >= 0;
780
+ return !t && r && (e.startsWith("hex") || e === "name") ? e === "name" && this.a === 0 ? this.toName() : this.toRgbString() : (e === "rgb" && (n = this.toRgbString()), e === "prgb" && (n = this.toPercentageRgbString()), (e === "hex" || e === "hex6") && (n = this.toHexString()), e === "hex3" && (n = this.toHexString(!0)), e === "hex4" && (n = this.toHex8String(!0)), e === "hex8" && (n = this.toHex8String()), e === "name" && (n = this.toName()), e === "hsl" && (n = this.toHslString()), e === "hsv" && (n = this.toHsvString()), e === "cmyk" && (n = this.toCmykString()), n || this.toHexString());
781
+ }
782
+ toNumber() {
783
+ return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b);
784
+ }
785
+ clone() {
786
+ return new e(this.toString());
787
+ }
788
+ lighten(t = 10) {
789
+ let n = this.toHsl();
790
+ return n.l += t / 100, n.l = W(n.l), new e(n);
791
+ }
792
+ brighten(t = 10) {
793
+ let n = this.toRgb();
794
+ return n.r = Math.max(0, Math.min(255, n.r - Math.round(255 * -(t / 100)))), n.g = Math.max(0, Math.min(255, n.g - Math.round(255 * -(t / 100)))), n.b = Math.max(0, Math.min(255, n.b - Math.round(255 * -(t / 100)))), new e(n);
795
+ }
796
+ darken(t = 10) {
797
+ let n = this.toHsl();
798
+ return n.l -= t / 100, n.l = W(n.l), new e(n);
799
+ }
800
+ tint(e = 10) {
801
+ return this.mix("white", e);
802
+ }
803
+ shade(e = 10) {
804
+ return this.mix("black", e);
805
+ }
806
+ desaturate(t = 10) {
807
+ let n = this.toHsl();
808
+ return n.s -= t / 100, n.s = W(n.s), new e(n);
809
+ }
810
+ saturate(t = 10) {
811
+ let n = this.toHsl();
812
+ return n.s += t / 100, n.s = W(n.s), new e(n);
813
+ }
814
+ greyscale() {
815
+ return this.desaturate(100);
816
+ }
817
+ spin(t) {
818
+ let n = this.toHsl(), r = (n.h + t) % 360;
819
+ return n.h = r < 0 ? 360 + r : r, new e(n);
820
+ }
821
+ mix(t, n = 50) {
822
+ let r = this.toRgb(), i = new e(t).toRgb(), a = n / 100;
823
+ return new e({
824
+ r: (i.r - r.r) * a + r.r,
825
+ g: (i.g - r.g) * a + r.g,
826
+ b: (i.b - r.b) * a + r.b,
827
+ a: (i.a - r.a) * a + r.a
828
+ });
829
+ }
830
+ analogous(t = 6, n = 30) {
831
+ let r = this.toHsl(), i = 360 / n, a = [this];
832
+ for (r.h = (r.h - (i * t >> 1) + 720) % 360; --t;) r.h = (r.h + i) % 360, a.push(new e(r));
833
+ return a;
834
+ }
835
+ complement() {
836
+ let t = this.toHsl();
837
+ return t.h = (t.h + 180) % 360, new e(t);
838
+ }
839
+ monochromatic(t = 6) {
840
+ let n = this.toHsv(), { h: r } = n, { s: i } = n, { v: a } = n, o = [], s = 1 / t;
841
+ for (; t--;) o.push(new e({
842
+ h: r,
843
+ s: i,
844
+ v: a
845
+ })), a = (a + s) % 1;
846
+ return o;
847
+ }
848
+ splitcomplement() {
849
+ let t = this.toHsl(), { h: n } = t;
850
+ return [
851
+ this,
852
+ new e({
853
+ h: (n + 72) % 360,
854
+ s: t.s,
855
+ l: t.l
856
+ }),
857
+ new e({
858
+ h: (n + 216) % 360,
859
+ s: t.s,
860
+ l: t.l
861
+ })
862
+ ];
863
+ }
864
+ onBackground(t) {
865
+ let n = this.toRgb(), r = new e(t).toRgb(), i = n.a + r.a * (1 - n.a);
866
+ return new e({
867
+ r: (n.r * n.a + r.r * r.a * (1 - n.a)) / i,
868
+ g: (n.g * n.a + r.g * r.a * (1 - n.a)) / i,
869
+ b: (n.b * n.a + r.b * r.a * (1 - n.a)) / i,
870
+ a: i
871
+ });
872
+ }
873
+ triad() {
874
+ return this.polyad(3);
875
+ }
876
+ tetrad() {
877
+ return this.polyad(4);
878
+ }
879
+ polyad(t) {
880
+ let n = this.toHsl(), { h: r } = n, i = [this], a = 360 / t;
881
+ for (let o = 1; o < t; o++) i.push(new e({
882
+ h: (r + o * a) % 360,
883
+ s: n.s,
884
+ l: n.l
885
+ }));
886
+ return i;
887
+ }
888
+ equals(t) {
889
+ let n = new e(t);
890
+ return this.format === "cmyk" || n.format === "cmyk" ? this.toCmykString() === n.toCmykString() : this.toRgbString() === n.toRgbString();
891
+ }
892
+ };
893
+ function at(e) {
894
+ return typeof e == "string";
895
+ }
896
+ function Q(e, t) {
897
+ return e.isValid ? e.toString(t) : e.originalInput.toString();
898
+ }
899
+ function $(e, t) {
900
+ return new Z(e, t);
901
+ }
902
+ function ot(e) {
903
+ return at(e) ? e : new Z(e).toString();
904
+ }
905
+ var st = (e) => {
906
+ let { currentColor: t, format: n, onChange: r, isAlphaHidden: i } = e, [a, o] = _.useState(t.toHsv());
907
+ return /* @__PURE__ */ z(B, {
908
+ className: "MuiColorInput-PopoverBody",
909
+ children: [
910
+ /* @__PURE__ */ R(Fe, {
911
+ currentHue: a.h,
912
+ hsv: a,
913
+ onChange: ({ s: e, v: i }) => {
914
+ let s = new Z({
915
+ h: a.h,
916
+ a: t.toHsv().a,
917
+ s: e,
918
+ v: i
919
+ });
920
+ o((t) => ({
921
+ ...t,
922
+ s: e,
923
+ v: i
924
+ })), r?.(Q(s, n));
925
+ }
926
+ }),
927
+ /* @__PURE__ */ R(B, {
928
+ sx: {
929
+ mt: "10px",
930
+ px: "3px"
931
+ },
932
+ children: /* @__PURE__ */ R(Le, {
933
+ min: 0,
934
+ max: 100,
935
+ step: 1,
936
+ onChange: (e, i) => {
937
+ if (!Ae(i)) return;
938
+ let s = H(360 * i / 100, 0, 359);
939
+ o((e) => ({
940
+ ...e,
941
+ h: s
942
+ }));
943
+ let c = new Z({
944
+ ...a,
945
+ a: t.toHsv().a,
946
+ h: s
947
+ });
948
+ r?.(Q(c, n));
949
+ },
950
+ "aria-label": "hue",
951
+ value: a.h * 100 / 360
952
+ })
953
+ }),
954
+ i ? null : /* @__PURE__ */ R(B, {
955
+ sx: {
956
+ mt: "10px",
957
+ px: "3px"
958
+ },
959
+ children: /* @__PURE__ */ R(De, {
960
+ min: 0,
961
+ max: 1,
962
+ step: .01,
963
+ "aria-label": "alpha",
964
+ rgbColor: t.toRgb(),
965
+ onChange: (e, i) => {
966
+ if (!Ae(i)) return;
967
+ let a = t.clone().setAlpha(i);
968
+ r?.(Q(a, n));
969
+ },
970
+ value: t.getAlpha()
971
+ })
972
+ })
973
+ ]
974
+ });
975
+ }, ct = _.forwardRef((e, t) => {
976
+ let { className: n, ...r } = e;
977
+ return /* @__PURE__ */ R(ue, {
978
+ className: `MuiColorInput-TextField ${n || ""}`,
979
+ ref: t,
980
+ ...r
981
+ });
982
+ });
983
+ function lt(e) {
984
+ return typeof e == "object" && !Array.isArray(e) && e !== null;
985
+ }
986
+ function ut(e, t) {
987
+ typeof t == "function" ? t(e) : t && lt(t) && "current" in t && (t.current = e);
988
+ }
989
+ var dt = _.forwardRef(({ value: e, format: t, onChange: n, adornmentPosition: r = "start", PopoverProps: i, Adornment: a = Ce, fallbackValue: o, isAlphaHidden: s, disablePopover: c, ...l }, u) => {
990
+ let { onBlur: d, slotProps: f, ...p } = l, { onClose: m, ...h } = i || {}, g = p.disabled || !1, v = _.useRef(null), y = _.useRef(null), [b, x] = _.useState(null), S = t || "rgb", C = $(e, { format: S }), [w, T] = _.useState(e), [E, D] = _.useState(e), O = (e) => {
991
+ e.preventDefault(), e.stopPropagation(), !g && !c && x(v.current);
992
+ }, k = (e) => {
993
+ let t = new Z(e);
994
+ n?.(e, {
995
+ hex: t.isValid ? t.toHexString() : "",
996
+ hsv: t.isValid ? t.toHsvString() : "",
997
+ hsl: t.isValid ? t.toHslString() : "",
998
+ rgb: t.isValid ? t.toRgbString() : "",
999
+ hex8: t.isValid ? t.toHex8String() : ""
1000
+ });
1001
+ }, A = (e) => {
1002
+ let t = e.target.value;
1003
+ if (T(t), t === "") D(""), k("");
1004
+ else {
1005
+ let e = Q(new Z(t), S);
1006
+ D(e), k(e);
1007
+ }
1008
+ }, j = (...e) => {
1009
+ m?.(...e), x(null), queueMicrotask(() => {
1010
+ y.current?.focus();
1011
+ });
1012
+ }, M = (e) => {
1013
+ d?.(e);
1014
+ let t = new Z(w);
1015
+ if (t.isValid) t.format !== S && T(Q(t, S));
1016
+ else {
1017
+ if (w === "") return;
1018
+ if (o) {
1019
+ let e = Q(new Z(o), S);
1020
+ T(e), D(e), k(e);
1021
+ }
1022
+ }
1023
+ }, N = _.useRef(S);
1024
+ _.useEffect(() => {
1025
+ let t = N.current !== S;
1026
+ if (N.current = S, t) {
1027
+ let e = $(w);
1028
+ if (e.isValid) {
1029
+ let t = Q(e, S);
1030
+ T(t), D(t);
1031
+ }
1032
+ }
1033
+ if (e === E) return;
1034
+ let n = $(e), r = $(E);
1035
+ if (!(n.isValid && r.isValid && n.equals(r))) {
1036
+ let e = n.originalInput;
1037
+ D(e), T(e);
1038
+ }
1039
+ }, [
1040
+ e,
1041
+ E,
1042
+ S
1043
+ ]);
1044
+ let ee = (e) => {
1045
+ T(e), D(e), k(e);
1046
+ }, te = (e) => {
1047
+ v.current = e, ut(e, u);
1048
+ }, ne = (e) => {
1049
+ y.current = e, ut(e, y);
1050
+ }, re = !!b, P = re ? "color-popover" : void 0, F = /* @__PURE__ */ R(de, {
1051
+ position: r,
1052
+ children: /* @__PURE__ */ R(a, {
1053
+ disabled: g,
1054
+ "aria-describedby": P,
1055
+ disablePopover: c || !1,
1056
+ component: c ? "span" : void 0,
1057
+ bgColor: C.toString(),
1058
+ isBgColorValid: !!(w !== "" && C.isValid),
1059
+ onClick: c ? void 0 : O
1060
+ })
1061
+ }), { input: I, ...ie } = f || {}, ae = {
1062
+ startAdornment: r === "start" ? F : void 0,
1063
+ endAdornment: r === "end" ? F : void 0,
1064
+ ...I
1065
+ };
1066
+ return /* @__PURE__ */ z(se, { children: [/* @__PURE__ */ R(ct, {
1067
+ ref: te,
1068
+ spellCheck: "false",
1069
+ type: "text",
1070
+ autoComplete: "off",
1071
+ onChange: A,
1072
+ value: ot(w),
1073
+ onBlur: M,
1074
+ inputRef: ne,
1075
+ disabled: g,
1076
+ slotProps: {
1077
+ input: ae,
1078
+ ...ie
1079
+ },
1080
+ ...p
1081
+ }), c ? null : /* @__PURE__ */ R(Te, {
1082
+ id: P,
1083
+ open: re,
1084
+ position: r,
1085
+ anchorEl: b,
1086
+ onClose: j,
1087
+ ...h,
1088
+ children: /* @__PURE__ */ R(st, {
1089
+ onChange: ee,
1090
+ currentColor: C,
1091
+ format: S,
1092
+ isAlphaHidden: s
1093
+ })
1094
+ })] });
1095
+ }), ft = ({ field: e, label: t, onColorChange: n, symbol: r, value: i }) => {
1096
+ let a = v((t) => {
1097
+ n(r, e, t);
1098
+ }, [
1099
+ e,
1100
+ n,
1101
+ r
1102
+ ]);
1103
+ return /* @__PURE__ */ R(dt, {
1104
+ format: "hex",
1105
+ isAlphaHidden: !0,
1106
+ label: t,
1107
+ onChange: a,
1108
+ size: "small",
1109
+ value: i
1110
+ });
1111
+ }, pt = [
1112
+ "background",
1113
+ "foreground",
1114
+ "backgroundSelected",
1115
+ "foregroundSelected"
1116
+ ], mt = {
1117
+ background: "Background",
1118
+ backgroundSelected: "Selected background",
1119
+ foreground: "Text",
1120
+ foregroundSelected: "Selected text"
1121
+ }, ht = ({ currentPalette: n, customPalette: r, exportFileName: i, label: a, onPaletteChange: o, palettes: s, parsePalette: c, symbolLabels: l, symbols: u }) => {
1122
+ let d = b(), f = S(null), [m, h] = C(null), g = v((e) => {
1123
+ let t = e === "Custom" ? r : s.find((t) => t.name === e);
1124
+ t && o(t);
1125
+ }, [
1126
+ r,
1127
+ o,
1128
+ s
1129
+ ]), _ = x(() => [...s.map((e) => ({
25
1130
  label: e.name,
26
1131
  value: e.name
27
- })), [n]), o = f(() => [{
28
- definition: k.RADIO_GROUP,
29
- label: "Color palette",
1132
+ })), {
1133
+ label: e,
1134
+ value: e
1135
+ }], [s]), y = x(() => [{
1136
+ definition: F.RADIO_GROUP,
1137
+ label: a,
30
1138
  name: "palette",
31
- onChange: i,
32
- options: a,
1139
+ onChange: g,
1140
+ options: _,
33
1141
  required: !0
34
- }], [i, a]), s = f(() => ({ palette: e.name }), [e.name]), c = D({ values: s }), { handleSubmit: u } = c, p = l((e) => {}, []);
35
- return /* @__PURE__ */ j(O, {
36
- formFieldDefinitions: o,
37
- formId: r,
38
- formMethods: c,
39
- onSubmit: u(p)
1142
+ }], [
1143
+ a,
1144
+ g,
1145
+ _
1146
+ ]), w = x(() => ({ palette: n.name }), [n.name]), T = I({ values: w }), { handleSubmit: E } = T, A = v((e) => {}, []), j = v((e, n, i) => {
1147
+ t.test(i) && o({
1148
+ ...r,
1149
+ paletteColors: {
1150
+ ...r.paletteColors,
1151
+ [e]: {
1152
+ ...r.paletteColors[e],
1153
+ [n]: i
1154
+ }
1155
+ }
1156
+ });
1157
+ }, [r, o]), N = v(async (t) => {
1158
+ let n = t.currentTarget, r = n.files?.[0];
1159
+ if (n.value = "", r) try {
1160
+ o({
1161
+ ...c(JSON.parse(await r.text())),
1162
+ name: e
1163
+ }), h(null);
1164
+ } catch (e) {
1165
+ let t = e instanceof Error ? e.message : "Unexpected error while reading the file.";
1166
+ h(`Could not import palette: ${t}`);
1167
+ }
1168
+ }, [o, c]), ee = v(() => {
1169
+ let e = {
1170
+ ...n,
1171
+ $schema: new URL(p, ie.getBaseURLWithPath()).href
1172
+ }, t = new Blob([JSON.stringify(e, null, 2)], { type: "application/json" }), r = URL.createObjectURL(t);
1173
+ ae.createDownloadUrl(r, i), URL.revokeObjectURL(r);
1174
+ }, [n, i]), te = v(() => {
1175
+ f.current?.click();
1176
+ }, []);
1177
+ return /* @__PURE__ */ z(O, {
1178
+ sx: { "& + &": { mt: 2 } },
1179
+ children: [
1180
+ /* @__PURE__ */ R(P, {
1181
+ formFieldDefinitions: y,
1182
+ formId: d,
1183
+ formMethods: T,
1184
+ onSubmit: E(A)
1185
+ }),
1186
+ /* @__PURE__ */ z(O, {
1187
+ sx: {
1188
+ display: "flex",
1189
+ gap: 1,
1190
+ mt: 1
1191
+ },
1192
+ children: [
1193
+ /* @__PURE__ */ R(k, {
1194
+ onClick: te,
1195
+ size: "small",
1196
+ variant: "outlined",
1197
+ children: "Import"
1198
+ }),
1199
+ /* @__PURE__ */ R(k, {
1200
+ onClick: ee,
1201
+ size: "small",
1202
+ variant: "outlined",
1203
+ children: "Export"
1204
+ }),
1205
+ /* @__PURE__ */ R("input", {
1206
+ accept: ".json,application/json",
1207
+ "aria-label": `Import ${a} JSON`,
1208
+ onChange: N,
1209
+ ref: f,
1210
+ style: { display: "none" },
1211
+ type: "file"
1212
+ })
1213
+ ]
1214
+ }),
1215
+ m && /* @__PURE__ */ R(D, {
1216
+ severity: "error",
1217
+ sx: { mt: 1 },
1218
+ children: m
1219
+ }),
1220
+ n.name === "Custom" && /* @__PURE__ */ R(O, {
1221
+ sx: {
1222
+ display: "flex",
1223
+ flexDirection: "column",
1224
+ gap: 1,
1225
+ mt: 2
1226
+ },
1227
+ children: u.map((e) => {
1228
+ let t = String(e), n = `${l[e]} (${t})`, i = r.paletteColors[e];
1229
+ return /* @__PURE__ */ z(O, {
1230
+ sx: {
1231
+ borderBottom: "1px solid",
1232
+ borderColor: "divider",
1233
+ pb: 1
1234
+ },
1235
+ children: [/* @__PURE__ */ R(M, {
1236
+ sx: {
1237
+ fontWeight: 600,
1238
+ mb: 1
1239
+ },
1240
+ variant: "body2",
1241
+ children: n
1242
+ }), /* @__PURE__ */ R(O, {
1243
+ sx: {
1244
+ display: "grid",
1245
+ gap: 1,
1246
+ gridTemplateColumns: "repeat(2, minmax(0, 1fr))"
1247
+ },
1248
+ children: pt.map((t) => /* @__PURE__ */ R(ft, {
1249
+ field: t,
1250
+ label: `${n} ${mt[t]}`,
1251
+ onColorChange: j,
1252
+ symbol: e,
1253
+ value: i[t]
1254
+ }, t))
1255
+ })]
1256
+ }, t);
1257
+ })
1258
+ })
1259
+ ]
40
1260
  });
41
- }, H = /* @__PURE__ */ new Map([
1261
+ }, gt = /* @__PURE__ */ new Map([
42
1262
  ["Alt", "Alt"],
43
1263
  ["AltGraph", "AltGr"],
44
1264
  ["Control", "Ctrl"],
45
1265
  ["Meta", "Cmd"],
46
1266
  ["Shift", "Shift"]
47
- ]), U = /* @__PURE__ */ new Map([
48
- ["Alt", z],
49
- ["Control", R],
50
- ["Meta", L]
51
- ]), W = /* @__PURE__ */ new Map([
1267
+ ]), _t = /* @__PURE__ */ new Map([
1268
+ ["Alt", ve],
1269
+ ["Control", _e],
1270
+ ["Meta", ge]
1271
+ ]), vt = /* @__PURE__ */ new Map([
52
1272
  ["ArrowDown", {
53
- icon: N,
1273
+ icon: fe,
54
1274
  label: "Arrow down"
55
1275
  }],
56
1276
  ["ArrowLeft", {
57
- icon: P,
1277
+ icon: pe,
58
1278
  label: "Arrow left"
59
1279
  }],
60
1280
  ["ArrowRight", {
61
- icon: F,
1281
+ icon: me,
62
1282
  label: "Arrow right"
63
1283
  }],
64
1284
  ["ArrowUp", {
65
- icon: I,
1285
+ icon: he,
66
1286
  label: "Arrow up"
67
1287
  }],
68
1288
  ["Backspace", { label: "Backspace" }],
@@ -72,67 +1292,67 @@ var V = ({ currentPalette: e, onPaletteChange: t, palettes: n }) => {
72
1292
  ["PageDown", { label: "Page down" }],
73
1293
  ["PageUp", { label: "Page up" }],
74
1294
  ["Space", {
75
- icon: B,
1295
+ icon: ye,
76
1296
  label: "Space"
77
1297
  }]
78
- ]), G = typeof navigator < "u" && /Mac|iPhone|iPad|iPod/.test(navigator.platform), K = [
1298
+ ]), yt = typeof navigator < "u" && /Mac|iPhone|iPad|iPod/.test(navigator.platform), bt = [
79
1299
  {
80
1300
  name: "Selection",
81
1301
  shortcuts: [
82
- n.moveSelectionLeft,
83
- n.moveSelectionRight,
84
- n.moveSelectionUp,
85
- n.moveSelectionDown,
86
- n.expandSelectionLeft,
87
- n.expandSelectionRight,
88
- n.expandSelectionUp,
89
- n.expandSelectionDown,
90
- n.moveCellLeft,
91
- n.moveCellRight
1302
+ g.moveSelectionLeft,
1303
+ g.moveSelectionRight,
1304
+ g.moveSelectionUp,
1305
+ g.moveSelectionDown,
1306
+ g.expandSelectionLeft,
1307
+ g.expandSelectionRight,
1308
+ g.expandSelectionUp,
1309
+ g.expandSelectionDown,
1310
+ g.moveCellLeft,
1311
+ g.moveCellRight
92
1312
  ]
93
1313
  },
94
1314
  {
95
1315
  name: "Rows",
96
1316
  shortcuts: [
97
- n.moveRowUp,
98
- n.moveRowDown,
99
- n.moveRowToStart,
100
- n.moveRowToEnd
1317
+ g.moveRowUp,
1318
+ g.moveRowDown,
1319
+ g.moveRowToStart,
1320
+ g.moveRowToEnd
101
1321
  ]
102
1322
  },
103
1323
  {
104
1324
  name: "Navigation",
105
1325
  shortcuts: [
106
- n.scrollToLineStart,
107
- n.scrollToLineEnd,
108
- n.scrollPageUp,
109
- n.scrollPageDown,
110
- n.gotoPosition
1326
+ g.scrollToLineStart,
1327
+ g.scrollToLineEnd,
1328
+ g.scrollPageUp,
1329
+ g.scrollPageDown,
1330
+ g.gotoPosition
111
1331
  ]
112
1332
  },
113
1333
  {
114
1334
  name: "Editing",
115
1335
  shortcuts: [
116
- n.insertGap,
117
- n.deleteBackward,
118
- n.deleteSelection,
119
- n.deleteBase,
120
- n.undo,
121
- n.redo
1336
+ g.insertGap,
1337
+ g.deleteBackward,
1338
+ g.deleteSelection,
1339
+ g.deleteBase,
1340
+ g.undo,
1341
+ g.redo
122
1342
  ]
123
1343
  }
124
- ], q = (e) => {
125
- let t = G ? "Meta" : "Control";
1344
+ ], xt = (e) => {
1345
+ let t = yt ? "Meta" : "Control";
126
1346
  return e.find((e) => e.includes(t)) ?? e[0] ?? [];
127
- }, J = (e) => {
128
- let { code: t, key: n, modifiers: r = [] } = e.shortcut, i = t ? W.get(t) ?? { label: t } : { label: n?.toUpperCase() ?? "" };
129
- return [...q(r).map((e) => ({
130
- icon: U.get(e),
131
- label: G && e === "Alt" ? "Option" : H.get(e) ?? e
1347
+ }, St = (e) => {
1348
+ let { code: t, key: n, modifiers: r = [] } = e.shortcut, i = t ? vt.get(t) ?? { label: t } : { label: n?.toUpperCase() ?? "" };
1349
+ return [...xt(r).map((e) => ({
1350
+ icon: _t.get(e),
1351
+ label: yt && e === "Alt" ? "Option" : gt.get(e) ?? e
132
1352
  })), i];
133
- }, Y = (e) => {
134
- let t = J(e);
135
- return /* @__PURE__ */ j(_, {
1353
+ }, Ct = (e) => {
1354
+ let t = St(e);
1355
+ return /* @__PURE__ */ R(O, {
136
1356
  "aria-label": t.map(({ label: e }) => e).join(" "),
137
1357
  sx: {
138
1358
  alignItems: "center",
@@ -140,7 +1360,7 @@ var V = ({ currentPalette: e, onPaletteChange: t, palettes: n }) => {
140
1360
  flexShrink: 0,
141
1361
  gap: .5
142
1362
  },
143
- children: /* @__PURE__ */ j(_, {
1363
+ children: /* @__PURE__ */ R(O, {
144
1364
  sx: {
145
1365
  alignItems: "center",
146
1366
  display: "flex",
@@ -148,7 +1368,7 @@ var V = ({ currentPalette: e, onPaletteChange: t, palettes: n }) => {
148
1368
  },
149
1369
  children: t.map((e) => {
150
1370
  let t = e.icon;
151
- return /* @__PURE__ */ j(_, {
1371
+ return /* @__PURE__ */ R(O, {
152
1372
  "aria-label": e.label,
153
1373
  component: "kbd",
154
1374
  sx: {
@@ -169,7 +1389,7 @@ var V = ({ currentPalette: e, onPaletteChange: t, palettes: n }) => {
169
1389
  py: .5,
170
1390
  textAlign: "center"
171
1391
  },
172
- children: t ? /* @__PURE__ */ j(t, {
1392
+ children: t ? /* @__PURE__ */ R(t, {
173
1393
  "aria-hidden": !0,
174
1394
  fontSize: "inherit"
175
1395
  }) : e.label
@@ -177,19 +1397,19 @@ var V = ({ currentPalette: e, onPaletteChange: t, palettes: n }) => {
177
1397
  })
178
1398
  })
179
1399
  });
180
- }, X = (e) => {
181
- let t = Object.values(n).find(({ description: t }) => t === e.currentTarget.dataset.shortcut);
1400
+ }, wt = (e) => {
1401
+ let t = Object.values(g).find(({ description: t }) => t === e.currentTarget.dataset.shortcut);
182
1402
  if (!t) return;
183
- let { code: r, key: i, modifiers: a = [] } = t.shortcut, o = q(a);
1403
+ let { code: n, key: r, modifiers: i = [] } = t.shortcut, a = xt(i);
184
1404
  t.callback(new KeyboardEvent("keydown", {
185
- altKey: o.includes("Alt"),
186
- code: r ?? "",
187
- ctrlKey: o.includes("Control"),
188
- key: i ?? r ?? "",
189
- metaKey: o.includes("Meta"),
190
- shiftKey: o.includes("Shift")
1405
+ altKey: a.includes("Alt"),
1406
+ code: n ?? "",
1407
+ ctrlKey: a.includes("Control"),
1408
+ key: r ?? n ?? "",
1409
+ metaKey: a.includes("Meta"),
1410
+ shiftKey: a.includes("Shift")
191
1411
  }));
192
- }, Z = () => /* @__PURE__ */ j(_, {
1412
+ }, Tt = () => /* @__PURE__ */ R(O, {
193
1413
  sx: {
194
1414
  display: "flex",
195
1415
  flexDirection: "column",
@@ -197,7 +1417,7 @@ var V = ({ currentPalette: e, onPaletteChange: t, palettes: n }) => {
197
1417
  px: 2,
198
1418
  py: 2.5
199
1419
  },
200
- children: K.map((e) => /* @__PURE__ */ M(_, { children: [/* @__PURE__ */ j(b, {
1420
+ children: bt.map((e) => /* @__PURE__ */ z(O, { children: [/* @__PURE__ */ R(M, {
201
1421
  sx: {
202
1422
  color: "text.secondary",
203
1423
  fontWeight: 700,
@@ -206,15 +1426,15 @@ var V = ({ currentPalette: e, onPaletteChange: t, palettes: n }) => {
206
1426
  },
207
1427
  variant: "caption",
208
1428
  children: e.name
209
- }), /* @__PURE__ */ j(_, {
1429
+ }), /* @__PURE__ */ R(O, {
210
1430
  sx: {
211
1431
  display: "flex",
212
1432
  flexDirection: "column",
213
1433
  gap: .5
214
1434
  },
215
- children: e.shortcuts.map((e) => /* @__PURE__ */ M(v, {
1435
+ children: e.shortcuts.map((e) => /* @__PURE__ */ z(A, {
216
1436
  "data-shortcut": e.description,
217
- onClick: X,
1437
+ onClick: wt,
218
1438
  sx: {
219
1439
  borderRadius: 1,
220
1440
  gap: 1,
@@ -222,35 +1442,35 @@ var V = ({ currentPalette: e, onPaletteChange: t, palettes: n }) => {
222
1442
  px: 1,
223
1443
  py: .75
224
1444
  },
225
- children: [/* @__PURE__ */ j(y, {
1445
+ children: [/* @__PURE__ */ R(j, {
226
1446
  primary: e.description,
227
1447
  sx: { "& .MuiListItemText-primary": { typography: "body2" } }
228
- }), Y(e)]
1448
+ }), Ct(e)]
229
1449
  }, e.description))
230
1450
  })] }, e.name))
231
- }), Q = () => {
232
- let n = t(e, (e) => e.parsedMetadata), d = t(e, (e) => e.aminoAcidPalette), v = t(e, (e) => e.nucleotidePalette), y = t(e, (e) => e.setAminoAcidPalette), D = t(e, (e) => e.setNucleotidePalette), O = t(e, (e) => e.meta), [k, N] = p([]), P = l((e) => {
233
- N((t) => t.includes(e) ? t.filter((t) => t !== e) : [...t, e]);
234
- }, []), F = l((e) => {
235
- N((t) => t.filter((t) => t !== e));
236
- }, []), I = l(() => P("NUCLEOTIDE_COLORS"), [P]), L = l(() => P("AMINO_ACID_COLORS"), [P]), R = l(() => P("METADATA"), [P]), z = l(() => P("KEYBOARD_SHORTCUTS"), [P]);
237
- u(() => {
238
- n || F("METADATA");
239
- }, [F, n]);
240
- let B = l((e) => {
241
- D(e);
242
- }, [D]), H = l((e) => {
243
- y(e);
244
- }, [y]), U = f(() => [
1451
+ }), Et = () => {
1452
+ let e = h(m, (e) => e.parsedMetadata), t = h(m, (e) => e.aminoAcidPalette), p = h(m, (e) => e.customAminoAcidPalette), g = h(m, (e) => e.customNucleotidePalette), _ = h(m, (e) => e.nucleotidePalette), b = h(m, (e) => e.setAminoAcidPalette), S = h(m, (e) => e.setCustomAminoAcidPalette), D = h(m, (e) => e.setCustomNucleotidePalette), k = h(m, (e) => e.setNucleotidePalette), A = h(m, (e) => e.meta), [j, P] = C([]), F = v((e) => {
1453
+ P((t) => t.includes(e) ? t.filter((t) => t !== e) : [...t, e]);
1454
+ }, []), I = v((e) => {
1455
+ P((t) => t.filter((t) => t !== e));
1456
+ }, []), ie = v(() => F("COLORS"), [F]), ae = v(() => F("METADATA"), [F]), oe = v(() => F("KEYBOARD_SHORTCUTS"), [F]);
1457
+ y(() => {
1458
+ e || I("METADATA");
1459
+ }, [I, e]);
1460
+ let L = v((e) => {
1461
+ k(e), e.name === "Custom" && D(e);
1462
+ }, [D, k]), ce = v((e) => {
1463
+ b(e), e.name === "Custom" && S(e);
1464
+ }, [b, S]), le = x(() => [
245
1465
  a,
246
1466
  o,
247
1467
  c
248
- ], []), W = f(() => [
1468
+ ], []), B = x(() => [
249
1469
  i,
250
1470
  s,
251
1471
  r
252
1472
  ], []);
253
- return /* @__PURE__ */ M(E, { children: [/* @__PURE__ */ j(_, {
1473
+ return /* @__PURE__ */ z(re, { children: [/* @__PURE__ */ R(O, {
254
1474
  sx: {
255
1475
  borderBottom: "1px solid",
256
1476
  borderColor: "divider",
@@ -259,155 +1479,132 @@ var V = ({ currentPalette: e, onPaletteChange: t, palettes: n }) => {
259
1479
  gap: 1.5,
260
1480
  p: 2
261
1481
  },
262
- children: O && /* @__PURE__ */ M(A, { children: [/* @__PURE__ */ j(b, {
1482
+ children: A && /* @__PURE__ */ z(se, { children: [/* @__PURE__ */ R(M, {
263
1483
  sx: { fontWeight: 600 },
264
1484
  variant: "body2",
265
1485
  children: "Alignment dimensions"
266
- }), /* @__PURE__ */ j(b, {
1486
+ }), /* @__PURE__ */ R(M, {
267
1487
  sx: { fontWeight: 400 },
268
1488
  variant: "body2",
269
- children: `${O.sequenceCount} sequences x ${O.alignmentWidth} bases`
1489
+ children: `${A.sequenceCount} sequences x ${A.alignmentWidth} bases`
270
1490
  })] })
271
- }), /* @__PURE__ */ M(_, {
1491
+ }), /* @__PURE__ */ z(O, {
272
1492
  sx: { pb: 3 },
273
1493
  children: [
274
- /* @__PURE__ */ M(m, {
1494
+ /* @__PURE__ */ z(w, {
275
1495
  disableGutters: !0,
276
1496
  elevation: 0,
277
- expanded: k.includes("KEYBOARD_SHORTCUTS"),
278
- onChange: z,
1497
+ expanded: j.includes("KEYBOARD_SHORTCUTS"),
1498
+ onChange: oe,
279
1499
  sx: {
280
1500
  borderBottom: "1px solid",
281
1501
  borderColor: "divider"
282
1502
  },
283
- children: [/* @__PURE__ */ j(g, {
284
- expandIcon: /* @__PURE__ */ j(x, {}),
285
- children: /* @__PURE__ */ M(_, {
1503
+ children: [/* @__PURE__ */ R(E, {
1504
+ expandIcon: /* @__PURE__ */ R(N, {}),
1505
+ children: /* @__PURE__ */ z(O, {
286
1506
  sx: {
287
1507
  alignItems: "center",
288
1508
  display: "flex",
289
1509
  gap: 1
290
1510
  },
291
- children: [/* @__PURE__ */ j(T, {
1511
+ children: [/* @__PURE__ */ R(ne, {
292
1512
  color: "primary",
293
1513
  fontSize: "small"
294
- }), /* @__PURE__ */ j(b, {
1514
+ }), /* @__PURE__ */ R(M, {
295
1515
  sx: { fontWeight: 600 },
296
1516
  variant: "body2",
297
1517
  children: "Keyboard shortcuts"
298
1518
  })]
299
1519
  })
300
- }), /* @__PURE__ */ j(h, {
1520
+ }), /* @__PURE__ */ R(T, {
301
1521
  sx: { p: 0 },
302
- children: /* @__PURE__ */ j(Z, {})
1522
+ children: /* @__PURE__ */ R(Tt, {})
303
1523
  })]
304
1524
  }),
305
- /* @__PURE__ */ M(m, {
1525
+ /* @__PURE__ */ z(w, {
306
1526
  disableGutters: !0,
307
1527
  elevation: 0,
308
- expanded: k.includes("NUCLEOTIDE_COLORS"),
309
- onChange: I,
1528
+ expanded: j.includes("COLORS"),
1529
+ onChange: ie,
310
1530
  sx: {
311
1531
  borderBottom: "1px solid",
312
1532
  borderColor: "divider"
313
1533
  },
314
- children: [/* @__PURE__ */ j(g, {
315
- expandIcon: /* @__PURE__ */ j(x, {}),
316
- children: /* @__PURE__ */ M(_, {
1534
+ children: [/* @__PURE__ */ R(E, {
1535
+ expandIcon: /* @__PURE__ */ R(N, {}),
1536
+ children: /* @__PURE__ */ z(O, {
317
1537
  sx: {
318
1538
  alignItems: "center",
319
1539
  display: "flex",
320
1540
  gap: 1
321
1541
  },
322
- children: [/* @__PURE__ */ j(C, {
1542
+ children: [/* @__PURE__ */ R(te, {
323
1543
  color: "primary",
324
1544
  fontSize: "small"
325
- }), /* @__PURE__ */ j(b, {
1545
+ }), /* @__PURE__ */ R(M, {
326
1546
  sx: { fontWeight: 600 },
327
1547
  variant: "body2",
328
- children: "Nucleotide Colors"
1548
+ children: "Colors"
329
1549
  })]
330
1550
  })
331
- }), /* @__PURE__ */ j(h, {
1551
+ }), /* @__PURE__ */ z(T, {
332
1552
  sx: {
333
1553
  pb: 2,
334
1554
  pt: 0,
335
1555
  px: 2
336
1556
  },
337
- children: /* @__PURE__ */ j(V, {
338
- currentPalette: v,
339
- onPaletteChange: B,
340
- palettes: U
341
- })
342
- })]
343
- }),
344
- /* @__PURE__ */ M(m, {
345
- disableGutters: !0,
346
- elevation: 0,
347
- expanded: k.includes("AMINO_ACID_COLORS"),
348
- onChange: L,
349
- sx: {
350
- borderBottom: "1px solid",
351
- borderColor: "divider"
352
- },
353
- children: [/* @__PURE__ */ j(g, {
354
- expandIcon: /* @__PURE__ */ j(x, {}),
355
- children: /* @__PURE__ */ M(_, {
356
- sx: {
357
- alignItems: "center",
358
- display: "flex",
359
- gap: 1
360
- },
361
- children: [/* @__PURE__ */ j(w, {
362
- color: "primary",
363
- fontSize: "small"
364
- }), /* @__PURE__ */ j(b, {
365
- sx: { fontWeight: 600 },
366
- variant: "body2",
367
- children: "Amino-acid colors"
368
- })]
369
- })
370
- }), /* @__PURE__ */ j(h, {
371
- sx: {
372
- pb: 2,
373
- pt: 0,
374
- px: 2
375
- },
376
- children: /* @__PURE__ */ j(V, {
377
- currentPalette: d,
378
- onPaletteChange: H,
379
- palettes: W
380
- })
1557
+ children: [/* @__PURE__ */ R(ht, {
1558
+ currentPalette: _,
1559
+ customPalette: g,
1560
+ exportFileName: "nucleotide-palette.json",
1561
+ label: "Nucleotide colors",
1562
+ onPaletteChange: L,
1563
+ palettes: le,
1564
+ parsePalette: n.parseNucleotidePalette,
1565
+ symbolLabels: f,
1566
+ symbols: d
1567
+ }), /* @__PURE__ */ R(ht, {
1568
+ currentPalette: t,
1569
+ customPalette: p,
1570
+ exportFileName: "amino-acid-palette.json",
1571
+ label: "Amino-acid colors",
1572
+ onPaletteChange: ce,
1573
+ palettes: B,
1574
+ parsePalette: n.parseAminoAcidPalette,
1575
+ symbolLabels: u,
1576
+ symbols: l
1577
+ })]
381
1578
  })]
382
1579
  }),
383
- /* @__PURE__ */ M(m, {
384
- disabled: !n,
1580
+ /* @__PURE__ */ z(w, {
1581
+ disabled: !e,
385
1582
  disableGutters: !0,
386
1583
  elevation: 0,
387
- expanded: k.includes("METADATA"),
388
- onChange: R,
1584
+ expanded: j.includes("METADATA"),
1585
+ onChange: ae,
389
1586
  sx: {
390
1587
  borderBottom: "1px solid",
391
1588
  borderColor: "divider"
392
1589
  },
393
- children: [/* @__PURE__ */ j(g, {
394
- expandIcon: /* @__PURE__ */ j(x, {}),
395
- children: /* @__PURE__ */ M(_, {
1590
+ children: [/* @__PURE__ */ R(E, {
1591
+ expandIcon: /* @__PURE__ */ R(N, {}),
1592
+ children: /* @__PURE__ */ z(O, {
396
1593
  sx: {
397
1594
  alignItems: "center",
398
1595
  display: "flex",
399
1596
  gap: 1
400
1597
  },
401
- children: [/* @__PURE__ */ j(S, {
1598
+ children: [/* @__PURE__ */ R(ee, {
402
1599
  color: "primary",
403
1600
  fontSize: "small"
404
- }), /* @__PURE__ */ j(b, {
1601
+ }), /* @__PURE__ */ R(M, {
405
1602
  sx: { fontWeight: 600 },
406
1603
  variant: "body2",
407
1604
  children: "Metadata"
408
1605
  })]
409
1606
  })
410
- }), /* @__PURE__ */ j(h, {
1607
+ }), /* @__PURE__ */ R(T, {
411
1608
  sx: {
412
1609
  pb: 2,
413
1610
  pt: 0,
@@ -419,6 +1616,6 @@ var V = ({ currentPalette: e, onPaletteChange: t, palettes: n }) => {
419
1616
  ]
420
1617
  })] });
421
1618
  };
422
- export { Q as t };
1619
+ export { Et as t };
423
1620
 
424
1621
  //# sourceMappingURL=SequenceEditorPageDrawer.js.map