@rivm-loculus-tools/sequence-editor 1.10.0 → 1.11.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 (70) hide show
  1. package/dist/_chunks/EngineErrorUtil.js.map +1 -1
  2. package/dist/_chunks/EngineWorker.js +1 -1
  3. package/dist/_chunks/SequenceEditor.js +545 -526
  4. package/dist/_chunks/SequenceEditor.js.map +1 -1
  5. package/dist/_chunks/SequenceEditorEventBusService.js +5 -5
  6. package/dist/_chunks/SequenceEditorEventBusService.js.map +1 -1
  7. package/dist/_chunks/SequenceEditorPageDrawer.js +462 -693
  8. package/dist/_chunks/SequenceEditorPageDrawer.js.map +1 -1
  9. package/dist/_chunks/react.js +1 -1
  10. package/dist/_chunks/react.js.map +1 -1
  11. package/dist/_chunks/sequenceEditorStore.js +61 -58
  12. package/dist/_chunks/sequenceEditorStore.js.map +1 -1
  13. package/dist/_chunks/sequence_editor.js +131 -104
  14. package/dist/_chunks/sequence_editor.js.map +1 -1
  15. package/dist/assets/AlignerWorker-DkAbHwjR.js +8 -0
  16. package/dist/assets/AlignerWorker-DkAbHwjR.js.map +1 -0
  17. package/dist/assets/index-CKWZNkQe.js +8 -0
  18. package/dist/assets/index-CKWZNkQe.js.map +1 -0
  19. package/dist/classes/services/EditorWorkerService/EditorWorkerService.d.ts +18 -19
  20. package/dist/classes/services/EditorWorkerService/index.js +67 -90
  21. package/dist/classes/services/EditorWorkerService/index.js.map +1 -1
  22. package/dist/classes/services/SequenceEditorEventBusService/SequenceEditorEventBusService.d.ts +1 -0
  23. package/dist/classes/workers/AlignerWorker/index.js.map +1 -1
  24. package/dist/classes/workers/EngineWorker/EngineWorker.d.ts +19 -17
  25. package/dist/classes/workers/EngineWorker/index.js +78 -30
  26. package/dist/classes/workers/EngineWorker/index.js.map +1 -1
  27. package/dist/components/app/SequenceEditorApp/index.js +10 -10
  28. package/dist/components/app/SequenceEditorApp/index.js.map +1 -1
  29. package/dist/components/ui/SequenceActionsBar/SequenceActionsBar.d.ts +1 -0
  30. package/dist/components/ui/SequenceActionsBar/index.d.ts +1 -0
  31. package/dist/components/ui/SequenceActionsBar/index.js +113 -0
  32. package/dist/components/ui/SequenceActionsBar/index.js.map +1 -0
  33. package/dist/components/ui/SequenceEditorMenu/SequenceEditorMenu.d.ts +1 -0
  34. package/dist/components/ui/SequenceEditorMenu/index.d.ts +1 -0
  35. package/dist/components/ui/SequenceEditorMenu/index.js +198 -0
  36. package/dist/components/ui/SequenceEditorMenu/index.js.map +1 -0
  37. package/dist/components/ui/SequenceEditorPageHeader/index.js +86 -1
  38. package/dist/components/ui/SequenceEditorPageHeader/index.js.map +1 -0
  39. package/dist/components/ui/SequenceEditorRealignModal/index.js +13 -13
  40. package/dist/components/ui/SequenceEditorRealignModal/index.js.map +1 -1
  41. package/dist/components/ui/SequenceEditorSearchBar/index.js +25 -21
  42. package/dist/components/ui/SequenceEditorSearchBar/index.js.map +1 -1
  43. package/dist/constants/keyboard.js +26 -26
  44. package/dist/constants/keyboard.js.map +1 -1
  45. package/dist/constants/palette.js +20 -20
  46. package/dist/constants/palette.js.map +1 -1
  47. package/dist/models/editor.models.d.ts +34 -26
  48. package/dist/models/editor.models.js +3 -1
  49. package/dist/models/editor.models.js.map +1 -1
  50. package/dist/models/palette.models.js.map +1 -1
  51. package/dist/pages/SequenceEditorMainPage/index.js +19 -19
  52. package/dist/pages/SequenceEditorMainPage/index.js.map +1 -1
  53. package/dist/stores/sequenceEditorStore/sequenceEditorStore.d.ts +3 -1
  54. package/dist/theme/demoTheme/index.js +5 -5
  55. package/dist/theme/demoTheme/index.js.map +1 -1
  56. package/dist/utils/EditorUtil/EditorUtil.d.ts +10 -3
  57. package/dist/utils/EditorUtil/index.js +360 -275
  58. package/dist/utils/EditorUtil/index.js.map +1 -1
  59. package/dist/utils/PaletteUtil/index.js.map +1 -1
  60. package/dist/utils/SequenceEditorStandardConfigUtil/index.js +6 -6
  61. package/dist/utils/SequenceEditorStandardConfigUtil/index.js.map +1 -1
  62. package/dist/vite/paletteSchemaPlugin/index.js.map +1 -1
  63. package/package.json +17 -17
  64. package/dist/_chunks/SequenceEditorPageHeader.js +0 -135
  65. package/dist/_chunks/SequenceEditorPageHeader.js.map +0 -1
  66. package/dist/assets/AlignerWorker-ag-D8qid.js +0 -8
  67. package/dist/assets/AlignerWorker-ag-D8qid.js.map +0 -1
  68. package/dist/assets/index-CN_G9YrF.js +0 -8
  69. package/dist/assets/index-CN_G9YrF.js.map +0 -1
  70. package/dist/components/ui/SequenceEditorPageDrawer/SequenceEditorPageDrawerKeyboardShortcuts.d.ts +0 -1
@@ -1,34 +1,31 @@
1
1
  import { PALETTE_SCHEMA_URL_PATH as e } from "../constants/paletteSchemaData.js";
2
- import { t } from "./react.js";
3
- import { t as n } from "./sequenceEditorStore.js";
4
- import { KEYBOARD_SHORTCUTS as r } from "../constants/keyboard.js";
2
+ import t, { useCallback as n, useEffect as r, useId as i, useMemo as a, useRef as o, useState as s } from "react";
3
+ import { Accordion as c, AccordionDetails as l, AccordionSummary as u, Alert as d, Box as f, Button as p, Typography as m } from "@mui/material";
4
+ import h from "@mui/icons-material/ExpandMore";
5
+ import g from "@mui/icons-material/TuneOutlined";
6
+ import _ from "@mui/icons-material/PaletteOutlined";
7
+ import { t as v } from "./react.js";
8
+ import { PageCommonDrawer as y } from "@rivm-loculus-tools/common-frontend/components/ui/PageCommonDrawer";
9
+ import { t as b } from "./sequenceEditorStore.js";
5
10
  import "../constants/index.js";
6
- import { CUSTOM_PALETTE_NAME as i } from "../models/palette.models.js";
7
- import { HEX_COLOR_REGEX as a, PaletteUtil as o } from "../utils/PaletteUtil/index.js";
8
- import { ALI_VIEW_CLUSTAL_X_AMINO_ACID_PALETTE as s, ALI_VIEW_DEFAULT_AMINO_ACID_PALETTE as c, ALI_VIEW_DEFAULT_NUCLEOTIDE_PALETTE as l, ALI_VIEW_FAST_NUCLEOTIDE_PALETTE as u, ALI_VIEW_SEA_VIEW_AMINO_ACID_PALETTE as d, ALI_VIEW_SEA_VIEW_NUCLEOTIDE_PALETTE as f, AMINO_ACID_SYMBOLS as p, AMINO_ACID_SYMBOL_LABELS as m, NUCLEOTIDE_SYMBOLS as h, NUCLEOTIDE_SYMBOL_LABELS as g } from "../constants/palette.js";
9
- import _, { useCallback as v, useEffect as y, useId as b, useMemo as x, useRef as S, useState as C } from "react";
10
- 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";
11
- import N from "@mui/icons-material/ExpandMore";
12
- import ee from "@mui/icons-material/TuneOutlined";
13
- import te from "@mui/icons-material/PaletteOutlined";
14
- import ne from "@mui/icons-material/KeyboardOutlined";
15
- import { PageCommonDrawer as re } from "@rivm-loculus-tools/common-frontend/components/ui/PageCommonDrawer";
16
- import { GenericForm as P } from "@gen-epix/ui-core-form/components/helpers/GenericForm";
17
- import { FORM_FIELD_DEFINITION_TYPE as F } from "@gen-epix/ui-core-form/models/form.models";
18
- import { useForm as I } from "react-hook-form";
19
- import { UrlUtil as ie } from "@rivm-loculus-tools/common-frontend/utils/UrlUtil";
20
- import { DownloadUtil as ae } from "@gen-epix/ui-core/utils/DownloadUtil";
21
- import oe from "@mui/material/Button";
11
+ import { CUSTOM_PALETTE_NAME as x } from "../models/palette.models.js";
12
+ import { HEX_COLOR_REGEX as S, PaletteUtil as C } from "../utils/PaletteUtil/index.js";
13
+ import { GenericForm as w } from "@gen-epix/ui-core-form/components/helpers/GenericForm";
14
+ import { FORM_FIELD_DEFINITION_TYPE as T } from "@gen-epix/ui-core-form/models/form.models";
15
+ import { useForm as E } from "react-hook-form";
16
+ import { UrlUtil as D } from "@rivm-loculus-tools/common-frontend/utils/UrlUtil";
17
+ import { DownloadUtil as O } from "@gen-epix/ui-core/utils/DownloadUtil";
18
+ import { ALI_VIEW_CLUSTAL_X_AMINO_ACID_PALETTE as k, ALI_VIEW_DEFAULT_AMINO_ACID_PALETTE as A, ALI_VIEW_DEFAULT_NUCLEOTIDE_PALETTE as j, ALI_VIEW_FAST_NUCLEOTIDE_PALETTE as ee, ALI_VIEW_SEA_VIEW_AMINO_ACID_PALETTE as M, ALI_VIEW_SEA_VIEW_NUCLEOTIDE_PALETTE as N, AMINO_ACID_SYMBOLS as te, AMINO_ACID_SYMBOL_LABELS as ne, NUCLEOTIDE_SYMBOLS as P, NUCLEOTIDE_SYMBOL_LABELS as F } from "../constants/palette.js";
19
+ import I from "@mui/material/Button";
22
20
  import { styled as L } from "@mui/material/styles";
23
- import { Fragment as se, jsx as R, jsxs as z } from "react/jsx-runtime";
24
- import ce from "@mui/material/Popover";
25
- import le from "@mui/material/Slider";
26
- import B from "@mui/material/Box";
27
- import ue from "@mui/material/TextField";
28
- import de from "@mui/material/InputAdornment";
29
- 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";
30
- // ../../../../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
31
- 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)(() => ({
21
+ import { Fragment as re, jsx as R, jsxs as z } from "react/jsx-runtime";
22
+ import ie from "@mui/material/Popover";
23
+ import B from "@mui/material/Slider";
24
+ import V from "@mui/material/Box";
25
+ import ae from "@mui/material/TextField";
26
+ import oe from "@mui/material/InputAdornment";
27
+ // ../../../../node_modules/.pnpm/mui-color-input@9.0.0_@emotion+react@11.14.0_@types+react@19.3.3_react@19.3.1_supports-_56859a76a17503377890b9bb13a43295/node_modules/mui-color-input/dist/mui-color-input.es.js
28
+ var se = "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 */", ce = "linear-gradient(to top, #000000, transparent), linear-gradient(to right, #ffffff, transparent) /*! @noflip */", le = { Button: L(I)(() => ({
32
29
  backgroundSize: "8px 8px",
33
30
  backgroundPosition: "0 0, 4px 0, 4px -4px, 0px 4px",
34
31
  transition: "none",
@@ -39,13 +36,13 @@ var be = "linear-gradient(45deg, #ccc 25%, transparent 25%), linear-gradient(135
39
36
  aspectRatio: "1 / 1",
40
37
  height: "24px",
41
38
  minWidth: 0
42
- })) }, Ce = (e) => {
39
+ })) }, ue = (e) => {
43
40
  let { bgColor: t, className: n, disablePopover: r, isBgColorValid: i, ...a } = e;
44
- return /* @__PURE__ */ R(Se.Button, {
41
+ return /* @__PURE__ */ R(le.Button, {
45
42
  disableTouchRipple: !0,
46
43
  style: {
47
44
  backgroundColor: i ? t : void 0,
48
- backgroundImage: i ? void 0 : be,
45
+ backgroundImage: i ? void 0 : se,
49
46
  cursor: r ? "default" : void 0
50
47
  },
51
48
  className: `MuiColorInput-Button ${n || ""}`,
@@ -53,10 +50,10 @@ var be = "linear-gradient(45deg, #ccc 25%, transparent 25%), linear-gradient(135
53
50
  disableElevation: !1,
54
51
  ...a
55
52
  });
56
- }, we = { Container: L("div")(() => ({
53
+ }, de = { Container: L("div")(() => ({
57
54
  width: 300,
58
55
  padding: 8
59
- })) }, Te = ({ children: e, className: t, position: n = "start", ...r }) => /* @__PURE__ */ R(ce, {
56
+ })) }, fe = ({ children: e, className: t, position: n = "start", ...r }) => /* @__PURE__ */ R(ie, {
60
57
  className: `MuiColorInput-Popover ${t || ""}`,
61
58
  anchorOrigin: {
62
59
  vertical: "bottom",
@@ -67,8 +64,8 @@ var be = "linear-gradient(45deg, #ccc 25%, transparent 25%), linear-gradient(135
67
64
  horizontal: n === "start" ? "left" : "right"
68
65
  },
69
66
  ...r,
70
- children: /* @__PURE__ */ R(we.Container, { children: e })
71
- }), Ee = { Slider: L(le, { shouldForwardProp: (e) => e !== "$rgbaFrom" && e !== "$rgbaTo" })(() => ({
67
+ children: /* @__PURE__ */ R(de.Container, { children: e })
68
+ }), pe = { Slider: L(B, { shouldForwardProp: (e) => e !== "$rgbaFrom" && e !== "$rgbaTo" })(() => ({
72
69
  height: 8,
73
70
  "& .MuiSlider-rail": {
74
71
  opacity: 1,
@@ -82,24 +79,24 @@ var be = "linear-gradient(45deg, #ccc 25%, transparent 25%), linear-gradient(135
82
79
  backgroundColor: "#ffffff",
83
80
  border: "3px solid currentColor"
84
81
  }
85
- })) }, De = (e) => {
82
+ })) }, me = (e) => {
86
83
  let { rgbColor: t, style: n, className: r, ...i } = e, a = {
87
84
  "--rgb-r": t.r,
88
85
  "--rgb-g": t.g,
89
86
  "--rgb-b": t.b,
90
87
  ...n
91
88
  };
92
- return /* @__PURE__ */ R(Ee.Slider, {
89
+ return /* @__PURE__ */ R(pe.Slider, {
93
90
  className: `MuiColorInput-AlphaSlider ${r || ""}`,
94
91
  style: a,
95
92
  ...i
96
93
  });
97
- }, V = {
94
+ }, H = {
98
95
  up: "ArrowUp",
99
96
  down: "ArrowDown",
100
97
  left: "ArrowLeft",
101
98
  right: "ArrowRight"
102
- }, Oe = {
99
+ }, he = {
103
100
  ArrowUp: {
104
101
  type: "hsvV",
105
102
  value: 1
@@ -117,16 +114,16 @@ var be = "linear-gradient(45deg, #ccc 25%, transparent 25%), linear-gradient(135
117
114
  value: 1
118
115
  }
119
116
  };
120
- function ke(e) {
121
- return e === V.up || e === V.down || e === V.left || e === V.right;
117
+ function ge(e) {
118
+ return e === H.up || e === H.down || e === H.left || e === H.right;
122
119
  }
123
- function H(e, t, n) {
120
+ function U(e, t, n) {
124
121
  return Math.max(t, Math.min(e, n));
125
122
  }
126
- function Ae(e) {
123
+ function _e(e) {
127
124
  return typeof e == "number";
128
125
  }
129
- function je(e, t, n) {
126
+ function ve(e, t, n) {
130
127
  let r = e.toLocaleString("en", {
131
128
  useGrouping: !1,
132
129
  minimumFractionDigits: t,
@@ -134,27 +131,27 @@ function je(e, t, n) {
134
131
  });
135
132
  return Number(r);
136
133
  }
137
- function Me(e, t, n) {
134
+ function ye(e, t, n) {
138
135
  let r = e.getBoundingClientRect(), i = t - r.left, a = n - r.top;
139
136
  return {
140
- x: H(i / r.width, 0, 1),
141
- y: H(1 - a / r.height, 0, 1)
137
+ x: U(i / r.width, 0, 1),
138
+ y: U(1 - a / r.height, 0, 1)
142
139
  };
143
140
  }
144
- function Ne(e) {
145
- let t = _.useRef(void 0);
146
- return _.useLayoutEffect(() => {
147
- t.current = e;
148
- }), _.useCallback((...e) => t.current?.(...e), []);
141
+ function be(e) {
142
+ let n = t.useRef(void 0);
143
+ return t.useLayoutEffect(() => {
144
+ n.current = e;
145
+ }), t.useCallback((...e) => n.current?.(...e), []);
149
146
  }
150
- var Pe = {
147
+ var xe = {
151
148
  Space: L("div")(() => ({
152
149
  width: "100%",
153
150
  height: "180px",
154
151
  boxSizing: "border-box",
155
152
  outline: 0,
156
153
  position: "relative",
157
- backgroundImage: xe
154
+ backgroundImage: ce
158
155
  })),
159
156
  Thumb: L("div")(() => ({
160
157
  position: "absolute",
@@ -172,56 +169,56 @@ var Pe = {
172
169
  "&.MuiColorInput-Thumb-active": { boxShadow: "0px 0px 0px 8px rgba(255 255 255 / 0.16)" },
173
170
  "@media (hover: none)": { boxShadow: "none" }
174
171
  }))
175
- }, Fe = (e) => {
176
- let { hsv: t, onChange: n, currentHue: r } = e, i = _.useRef(!1), a = _.useRef(null), [o, s] = _.useState(!1), c = Ne((e, t) => {
177
- if (!a.current) return;
178
- let { x: r, y: i } = Me(a.current, e, t);
179
- n({
180
- s: r,
172
+ }, Se = (e) => {
173
+ let { hsv: n, onChange: r, currentHue: i } = e, a = t.useRef(!1), o = t.useRef(null), [s, c] = t.useState(!1), l = be((e, t) => {
174
+ if (!o.current) return;
175
+ let { x: n, y: i } = ye(o.current, e, t);
176
+ r({
177
+ s: n,
181
178
  v: i
182
- }), a.current && document.activeElement !== a.current && a.current.focus();
183
- }), l = _.useCallback(() => {
184
- i.current && (i.current = !1, s(!1));
185
- }, []), u = _.useCallback((e) => {
186
- i.current && c(e.clientX, e.clientY);
179
+ }), o.current && document.activeElement !== o.current && o.current.focus();
180
+ }), u = t.useCallback(() => {
181
+ a.current && (a.current = !1, c(!1));
182
+ }, []), d = t.useCallback((e) => {
183
+ a.current && l(e.clientX, e.clientY);
187
184
  }, []);
188
- _.useEffect(() => (document.addEventListener("pointermove", u, !1), document.addEventListener("pointerup", l, !1), () => {
189
- document.removeEventListener("pointermove", u, !1), document.removeEventListener("pointerup", l, !1);
190
- }), [l, u]);
191
- let d = (e) => {
192
- e.preventDefault(), i.current = !0, c(e.clientX, e.clientY), s(!0);
193
- }, f = (e) => {
194
- if (ke(e.key)) {
185
+ t.useEffect(() => (document.addEventListener("pointermove", d, !1), document.addEventListener("pointerup", u, !1), () => {
186
+ document.removeEventListener("pointermove", d, !1), document.removeEventListener("pointerup", u, !1);
187
+ }), [u, d]);
188
+ let f = (e) => {
189
+ e.preventDefault(), a.current = !0, l(e.clientX, e.clientY), c(!0);
190
+ }, p = (e) => {
191
+ if (ge(e.key)) {
195
192
  e.preventDefault();
196
- 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);
197
- s(!0), n({
198
- s: r === "hsvS" ? o : t.s,
199
- v: r === "hsvV" ? o : t.v
193
+ let { type: t, value: i } = he[e.key], a = e.shiftKey ? 10 : 1, o = U((t === "hsvS" ? n.s : n.v) + i * a * .01, 0, 1);
194
+ c(!0), r({
195
+ s: t === "hsvS" ? o : n.s,
196
+ v: t === "hsvV" ? o : n.v
200
197
  });
201
198
  }
202
- }, p = t.s * 100, m = t.v * 100;
203
- return /* @__PURE__ */ R(Pe.Space, {
204
- onPointerDown: d,
205
- ref: a,
199
+ }, m = n.s * 100, h = n.v * 100;
200
+ return /* @__PURE__ */ R(xe.Space, {
201
+ onPointerDown: f,
202
+ ref: o,
206
203
  className: "MuiColorInput-ColorSpace",
207
204
  style: {
208
- backgroundColor: `hsl(${r} 100% 50%)`,
205
+ backgroundColor: `hsl(${i} 100% 50%)`,
209
206
  touchAction: "none"
210
207
  },
211
208
  role: "slider",
212
- "aria-valuetext": `Saturation ${je(p, 0, 0)}%, Brightness ${je(m, 0, 0)}%`,
213
- onKeyDown: f,
209
+ "aria-valuetext": `Saturation ${ve(m, 0, 0)}%, Brightness ${ve(h, 0, 0)}%`,
210
+ onKeyDown: p,
214
211
  tabIndex: 0,
215
- children: /* @__PURE__ */ R(Pe.Thumb, {
212
+ children: /* @__PURE__ */ R(xe.Thumb, {
216
213
  "aria-label": "Color space thumb",
217
- className: o ? "MuiColorInput-Thumb-active" : "",
214
+ className: s ? "MuiColorInput-Thumb-active" : "",
218
215
  style: {
219
- left: `${p}%`,
220
- bottom: `${m}%`
216
+ left: `${m}%`,
217
+ bottom: `${h}%`
221
218
  }
222
219
  })
223
220
  });
224
- }, Ie = { Slider: L(le)(() => ({
221
+ }, Ce = { Slider: L(B)(() => ({
225
222
  height: 8,
226
223
  "& .MuiSlider-rail": {
227
224
  opacity: 1,
@@ -235,45 +232,45 @@ var Pe = {
235
232
  backgroundColor: "#ffffff",
236
233
  border: "3px solid currentColor"
237
234
  }
238
- })) }, Le = (e) => {
235
+ })) }, we = (e) => {
239
236
  let { className: t, ...n } = e;
240
- return /* @__PURE__ */ R(Ie.Slider, {
237
+ return /* @__PURE__ */ R(Ce.Slider, {
241
238
  className: `MuiColorInput-HueSlider ${t || ""}`,
242
239
  ...n
243
240
  });
244
241
  };
245
- function U(e, t) {
246
- Re(e) && (e = "100%");
247
- let n = ze(e);
242
+ function W(e, t) {
243
+ Te(e) && (e = "100%");
244
+ let n = Ee(e);
248
245
  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);
249
246
  }
250
- function W(e) {
247
+ function G(e) {
251
248
  return Math.min(1, Math.max(0, e));
252
249
  }
253
- function Re(e) {
250
+ function Te(e) {
254
251
  return typeof e == "string" && e.indexOf(".") !== -1 && parseFloat(e) === 1;
255
252
  }
256
- function ze(e) {
253
+ function Ee(e) {
257
254
  return typeof e == "string" && e.indexOf("%") !== -1;
258
255
  }
259
- function Be(e) {
256
+ function De(e) {
260
257
  return e = parseFloat(e), (isNaN(e) || e < 0 || e > 1) && (e = 1), e;
261
258
  }
262
- function G(e) {
259
+ function K(e) {
263
260
  return Number(e) <= 1 ? `${Number(e) * 100}%` : e;
264
261
  }
265
- function K(e) {
262
+ function q(e) {
266
263
  return e.length === 1 ? "0" + e : String(e);
267
264
  }
268
- function Ve(e, t, n) {
265
+ function Oe(e, t, n) {
269
266
  return {
270
- r: U(e, 255) * 255,
271
- g: U(t, 255) * 255,
272
- b: U(n, 255) * 255
267
+ r: W(e, 255) * 255,
268
+ g: W(t, 255) * 255,
269
+ b: W(n, 255) * 255
273
270
  };
274
271
  }
275
- function He(e, t, n) {
276
- e = U(e, 255), t = U(t, 255), n = U(n, 255);
272
+ function ke(e, t, n) {
273
+ e = W(e, 255), t = W(t, 255), n = W(n, 255);
277
274
  let r = Math.max(e, t, n), i = Math.min(e, t, n), a = 0, o = 0, s = (r + i) / 2;
278
275
  if (r === i) o = 0, a = 0;
279
276
  else {
@@ -295,15 +292,15 @@ function He(e, t, n) {
295
292
  l: s
296
293
  };
297
294
  }
298
- function Ue(e, t, n) {
295
+ function Ae(e, t, n) {
299
296
  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;
300
297
  }
301
- function We(e, t, n) {
298
+ function je(e, t, n) {
302
299
  let r, i, a;
303
- if (e = U(e, 360), t = U(t, 100), n = U(n, 100), t === 0) i = n, a = n, r = n;
300
+ if (e = W(e, 360), t = W(t, 100), n = W(n, 100), t === 0) i = n, a = n, r = n;
304
301
  else {
305
302
  let o = n < .5 ? n * (1 + t) : n + t - n * t, s = 2 * n - o;
306
- r = Ue(s, o, e + 1 / 3), i = Ue(s, o, e), a = Ue(s, o, e - 1 / 3);
303
+ r = Ae(s, o, e + 1 / 3), i = Ae(s, o, e), a = Ae(s, o, e - 1 / 3);
307
304
  }
308
305
  return {
309
306
  r: r * 255,
@@ -311,8 +308,8 @@ function We(e, t, n) {
311
308
  b: a * 255
312
309
  };
313
310
  }
314
- function Ge(e, t, n) {
315
- e = U(e, 255), t = U(t, 255), n = U(n, 255);
311
+ function Me(e, t, n) {
312
+ e = W(e, 255), t = W(t, 255), n = W(n, 255);
316
313
  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;
317
314
  if (r === i) a = 0;
318
315
  else {
@@ -333,8 +330,8 @@ function Ge(e, t, n) {
333
330
  v: o
334
331
  };
335
332
  }
336
- function Ke(e, t, n) {
337
- e = U(e, 360) * 6, t = U(t, 100), n = U(n, 100);
333
+ function Ne(e, t, n) {
334
+ e = W(e, 360) * 6, t = W(t, 100), n = W(n, 100);
338
335
  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 = [
339
336
  n,
340
337
  o,
@@ -363,24 +360,24 @@ function Ke(e, t, n) {
363
360
  b: d * 255
364
361
  };
365
362
  }
366
- function qe(e, t, n, r) {
363
+ function Pe(e, t, n, r) {
367
364
  let i = [
368
- K(Math.round(e).toString(16)),
369
- K(Math.round(t).toString(16)),
370
- K(Math.round(n).toString(16))
365
+ q(Math.round(e).toString(16)),
366
+ q(Math.round(t).toString(16)),
367
+ q(Math.round(n).toString(16))
371
368
  ];
372
369
  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("");
373
370
  }
374
- function Je(e, t, n, r, i) {
371
+ function Fe(e, t, n, r, i) {
375
372
  let a = [
376
- K(Math.round(e).toString(16)),
377
- K(Math.round(t).toString(16)),
378
- K(Math.round(n).toString(16)),
379
- K(Ze(r))
373
+ q(Math.round(e).toString(16)),
374
+ q(Math.round(t).toString(16)),
375
+ q(Math.round(n).toString(16)),
376
+ q(Re(r))
380
377
  ];
381
378
  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("");
382
379
  }
383
- function Ye(e, t, n, r) {
380
+ function Ie(e, t, n, r) {
384
381
  let i = e / 100, a = t / 100, o = n / 100, s = r / 100;
385
382
  return {
386
383
  r: 255 * (1 - i) * (1 - s),
@@ -388,7 +385,7 @@ function Ye(e, t, n, r) {
388
385
  b: 255 * (1 - o) * (1 - s)
389
386
  };
390
387
  }
391
- function Xe(e, t, n) {
388
+ function Le(e, t, n) {
392
389
  let r = 1 - e / 255, i = 1 - t / 255, a = 1 - n / 255, o = Math.min(r, i, a);
393
390
  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, {
394
391
  c: Math.round(r),
@@ -397,23 +394,23 @@ function Xe(e, t, n) {
397
394
  k: Math.round(o)
398
395
  };
399
396
  }
400
- function Ze(e) {
397
+ function Re(e) {
401
398
  return Math.round(parseFloat(e) * 255).toString(16);
402
399
  }
403
- function Qe(e) {
404
- return q(e) / 255;
400
+ function ze(e) {
401
+ return J(e) / 255;
405
402
  }
406
- function q(e) {
403
+ function J(e) {
407
404
  return parseInt(e, 16);
408
405
  }
409
- function $e(e) {
406
+ function Be(e) {
410
407
  return {
411
408
  r: e >> 16,
412
409
  g: (e & 65280) >> 8,
413
410
  b: e & 255
414
411
  };
415
412
  }
416
- var et = {
413
+ var Ve = {
417
414
  aliceblue: "#f0f8ff",
418
415
  antiquewhite: "#faebd7",
419
416
  aqua: "#00ffff",
@@ -563,13 +560,13 @@ var et = {
563
560
  yellow: "#ffff00",
564
561
  yellowgreen: "#9acd32"
565
562
  };
566
- function tt(e) {
563
+ function He(e) {
567
564
  let t = {
568
565
  r: 0,
569
566
  g: 0,
570
567
  b: 0
571
568
  }, n = 1, r = null, i = null, a = null, o = !1, s = !1;
572
- 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), {
569
+ return typeof e == "string" && (e = Ge(e)), typeof e == "object" && (Z(e.r) && Z(e.g) && Z(e.b) ? (t = Oe(e.r, e.g, e.b), o = !0, s = String(e.r).substr(-1) === "%" ? "prgb" : "rgb") : Z(e.h) && Z(e.s) && Z(e.v) ? (r = K(e.s), i = K(e.v), t = Ne(e.h, r, i), o = !0, s = "hsv") : Z(e.h) && Z(e.s) && Z(e.l) ? (r = K(e.s), a = K(e.l), t = je(e.h, r, a), o = !0, s = "hsl") : Z(e.c) && Z(e.m) && Z(e.y) && Z(e.k) && (t = Ie(e.c, e.m, e.y, e.k), o = !0, s = "cmyk"), Object.prototype.hasOwnProperty.call(e, "a") && (n = e.a)), n = De(n), {
573
570
  ok: o,
574
571
  format: e.format || s,
575
572
  r: Math.min(255, Math.max(t.r, 0)),
@@ -578,24 +575,24 @@ function tt(e) {
578
575
  a: n
579
576
  };
580
577
  }
581
- 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 = {
582
- CSS_UNIT: new RegExp(nt),
583
- rgb: RegExp("rgb" + rt),
584
- rgba: RegExp("rgba" + J),
585
- hsl: RegExp("hsl" + rt),
586
- hsla: RegExp("hsla" + J),
587
- hsv: RegExp("hsv" + rt),
588
- hsva: RegExp("hsva" + J),
589
- cmyk: RegExp("cmyk" + J),
578
+ var Ue = "(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)", We = "[\\s|\\(]+(" + Ue + ")[,|\\s]+((?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?))[,|\\s]+((?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?))\\s*\\)?", Y = "[\\s|\\(]+(" + Ue + ")[,|\\s]+((?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?))[,|\\s]+((?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?))[,|\\s]+((?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?))\\s*\\)?", X = {
579
+ CSS_UNIT: new RegExp(Ue),
580
+ rgb: RegExp("rgb" + We),
581
+ rgba: RegExp("rgba" + Y),
582
+ hsl: RegExp("hsl" + We),
583
+ hsla: RegExp("hsla" + Y),
584
+ hsv: RegExp("hsv" + We),
585
+ hsva: RegExp("hsva" + Y),
586
+ cmyk: RegExp("cmyk" + Y),
590
587
  hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
591
588
  hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
592
589
  hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
593
590
  hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
594
591
  };
595
- function it(e) {
592
+ function Ge(e) {
596
593
  if (e = e.trim().toLowerCase(), e.length === 0) return !1;
597
594
  let t = !1;
598
- if (et[e]) e = et[e], t = !0;
595
+ if (Ve[e]) e = Ve[e], t = !0;
599
596
  else if (e === "transparent") return {
600
597
  r: 0,
601
598
  g: 0,
@@ -603,71 +600,71 @@ function it(e) {
603
600
  a: 0,
604
601
  format: "name"
605
602
  };
606
- let n = Y.rgb.exec(e);
603
+ let n = X.rgb.exec(e);
607
604
  return n ? {
608
605
  r: n[1],
609
606
  g: n[2],
610
607
  b: n[3]
611
- } : (n = Y.rgba.exec(e), n ? {
608
+ } : (n = X.rgba.exec(e), n ? {
612
609
  r: n[1],
613
610
  g: n[2],
614
611
  b: n[3],
615
612
  a: n[4]
616
- } : (n = Y.hsl.exec(e), n ? {
613
+ } : (n = X.hsl.exec(e), n ? {
617
614
  h: n[1],
618
615
  s: n[2],
619
616
  l: n[3]
620
- } : (n = Y.hsla.exec(e), n ? {
617
+ } : (n = X.hsla.exec(e), n ? {
621
618
  h: n[1],
622
619
  s: n[2],
623
620
  l: n[3],
624
621
  a: n[4]
625
- } : (n = Y.hsv.exec(e), n ? {
622
+ } : (n = X.hsv.exec(e), n ? {
626
623
  h: n[1],
627
624
  s: n[2],
628
625
  v: n[3]
629
- } : (n = Y.hsva.exec(e), n ? {
626
+ } : (n = X.hsva.exec(e), n ? {
630
627
  h: n[1],
631
628
  s: n[2],
632
629
  v: n[3],
633
630
  a: n[4]
634
- } : (n = Y.cmyk.exec(e), n ? {
631
+ } : (n = X.cmyk.exec(e), n ? {
635
632
  c: n[1],
636
633
  m: n[2],
637
634
  y: n[3],
638
635
  k: n[4]
639
- } : (n = Y.hex8.exec(e), n ? {
640
- r: q(n[1]),
641
- g: q(n[2]),
642
- b: q(n[3]),
643
- a: Qe(n[4]),
636
+ } : (n = X.hex8.exec(e), n ? {
637
+ r: J(n[1]),
638
+ g: J(n[2]),
639
+ b: J(n[3]),
640
+ a: ze(n[4]),
644
641
  format: t ? "name" : "hex8"
645
- } : (n = Y.hex6.exec(e), n ? {
646
- r: q(n[1]),
647
- g: q(n[2]),
648
- b: q(n[3]),
642
+ } : (n = X.hex6.exec(e), n ? {
643
+ r: J(n[1]),
644
+ g: J(n[2]),
645
+ b: J(n[3]),
649
646
  format: t ? "name" : "hex"
650
- } : (n = Y.hex4.exec(e), n ? {
651
- r: q(n[1] + n[1]),
652
- g: q(n[2] + n[2]),
653
- b: q(n[3] + n[3]),
654
- a: Qe(n[4] + n[4]),
647
+ } : (n = X.hex4.exec(e), n ? {
648
+ r: J(n[1] + n[1]),
649
+ g: J(n[2] + n[2]),
650
+ b: J(n[3] + n[3]),
651
+ a: ze(n[4] + n[4]),
655
652
  format: t ? "name" : "hex8"
656
- } : (n = Y.hex3.exec(e), n ? {
657
- r: q(n[1] + n[1]),
658
- g: q(n[2] + n[2]),
659
- b: q(n[3] + n[3]),
653
+ } : (n = X.hex3.exec(e), n ? {
654
+ r: J(n[1] + n[1]),
655
+ g: J(n[2] + n[2]),
656
+ b: J(n[3] + n[3]),
660
657
  format: t ? "name" : "hex"
661
658
  } : !1))))))))));
662
659
  }
663
- function X(e) {
664
- return typeof e == "number" ? !Number.isNaN(e) : Y.CSS_UNIT.test(e);
660
+ function Z(e) {
661
+ return typeof e == "number" ? !Number.isNaN(e) : X.CSS_UNIT.test(e);
665
662
  }
666
- var Z = class e {
663
+ var Q = class e {
667
664
  constructor(t = "", n = {}) {
668
665
  if (t instanceof e) return t;
669
- typeof t == "number" && (t = $e(t)), this.originalInput = t;
670
- let r = tt(t);
666
+ typeof t == "number" && (t = Be(t)), this.originalInput = t;
667
+ let r = He(t);
671
668
  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;
672
669
  }
673
670
  isDark() {
@@ -688,14 +685,14 @@ var Z = class e {
688
685
  return this.a;
689
686
  }
690
687
  setAlpha(e) {
691
- return this.a = Be(e), this.roundA = Math.round(100 * this.a) / 100, this;
688
+ return this.a = De(e), this.roundA = Math.round(100 * this.a) / 100, this;
692
689
  }
693
690
  isMonochrome() {
694
691
  let { s: e } = this.toHsl();
695
692
  return e === 0;
696
693
  }
697
694
  toHsv() {
698
- let e = Ge(this.r, this.g, this.b);
695
+ let e = Me(this.r, this.g, this.b);
699
696
  return {
700
697
  h: e.h * 360,
701
698
  s: e.s,
@@ -704,11 +701,11 @@ var Z = class e {
704
701
  };
705
702
  }
706
703
  toHsvString() {
707
- 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);
704
+ let e = Me(this.r, this.g, this.b), t = Math.round(e.h * 360), n = Math.round(e.s * 100), r = Math.round(e.v * 100);
708
705
  return this.a === 1 ? `hsv(${t}, ${n}%, ${r}%)` : `hsva(${t}, ${n}%, ${r}%, ${this.roundA})`;
709
706
  }
710
707
  toHsl() {
711
- let e = He(this.r, this.g, this.b);
708
+ let e = ke(this.r, this.g, this.b);
712
709
  return {
713
710
  h: e.h * 360,
714
711
  s: e.s,
@@ -717,17 +714,17 @@ var Z = class e {
717
714
  };
718
715
  }
719
716
  toHslString() {
720
- 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);
717
+ let e = ke(this.r, this.g, this.b), t = Math.round(e.h * 360), n = Math.round(e.s * 100), r = Math.round(e.l * 100);
721
718
  return this.a === 1 ? `hsl(${t}, ${n}%, ${r}%)` : `hsla(${t}, ${n}%, ${r}%, ${this.roundA})`;
722
719
  }
723
720
  toHex(e = !1) {
724
- return qe(this.r, this.g, this.b, e);
721
+ return Pe(this.r, this.g, this.b, e);
725
722
  }
726
723
  toHexString(e = !1) {
727
724
  return "#" + this.toHex(e);
728
725
  }
729
726
  toHex8(e = !1) {
730
- return Je(this.r, this.g, this.b, this.a, e);
727
+ return Fe(this.r, this.g, this.b, this.a, e);
731
728
  }
732
729
  toHex8String(e = !1) {
733
730
  return "#" + this.toHex8(e);
@@ -748,7 +745,7 @@ var Z = class e {
748
745
  return this.a === 1 ? `rgb(${e}, ${t}, ${n})` : `rgba(${e}, ${t}, ${n}, ${this.roundA})`;
749
746
  }
750
747
  toPercentageRgb() {
751
- let e = (e) => `${Math.round(U(e, 255) * 100)}%`;
748
+ let e = (e) => `${Math.round(W(e, 255) * 100)}%`;
752
749
  return {
753
750
  r: e(this.r),
754
751
  g: e(this.g),
@@ -757,21 +754,21 @@ var Z = class e {
757
754
  };
758
755
  }
759
756
  toPercentageRgbString() {
760
- let e = (e) => Math.round(U(e, 255) * 100);
757
+ let e = (e) => Math.round(W(e, 255) * 100);
761
758
  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})`;
762
759
  }
763
760
  toCmyk() {
764
- return { ...Xe(this.r, this.g, this.b) };
761
+ return { ...Le(this.r, this.g, this.b) };
765
762
  }
766
763
  toCmykString() {
767
- let { c: e, m: t, y: n, k: r } = Xe(this.r, this.g, this.b);
764
+ let { c: e, m: t, y: n, k: r } = Le(this.r, this.g, this.b);
768
765
  return `cmyk(${e}, ${t}, ${n}, ${r})`;
769
766
  }
770
767
  toName() {
771
768
  if (this.a === 0) return "transparent";
772
769
  if (this.a < 1) return !1;
773
- let e = "#" + qe(this.r, this.g, this.b, !1);
774
- for (let [t, n] of Object.entries(et)) if (e === n) return t;
770
+ let e = "#" + Pe(this.r, this.g, this.b, !1);
771
+ for (let [t, n] of Object.entries(Ve)) if (e === n) return t;
775
772
  return !1;
776
773
  }
777
774
  toString(e) {
@@ -788,7 +785,7 @@ var Z = class e {
788
785
  }
789
786
  lighten(t = 10) {
790
787
  let n = this.toHsl();
791
- return n.l += t / 100, n.l = W(n.l), new e(n);
788
+ return n.l += t / 100, n.l = G(n.l), new e(n);
792
789
  }
793
790
  brighten(t = 10) {
794
791
  let n = this.toRgb();
@@ -796,7 +793,7 @@ var Z = class e {
796
793
  }
797
794
  darken(t = 10) {
798
795
  let n = this.toHsl();
799
- return n.l -= t / 100, n.l = W(n.l), new e(n);
796
+ return n.l -= t / 100, n.l = G(n.l), new e(n);
800
797
  }
801
798
  tint(e = 10) {
802
799
  return this.mix("white", e);
@@ -806,11 +803,11 @@ var Z = class e {
806
803
  }
807
804
  desaturate(t = 10) {
808
805
  let n = this.toHsl();
809
- return n.s -= t / 100, n.s = W(n.s), new e(n);
806
+ return n.s -= t / 100, n.s = G(n.s), new e(n);
810
807
  }
811
808
  saturate(t = 10) {
812
809
  let n = this.toHsl();
813
- return n.s += t / 100, n.s = W(n.s), new e(n);
810
+ return n.s += t / 100, n.s = G(n.s), new e(n);
814
811
  }
815
812
  greyscale() {
816
813
  return this.desaturate(100);
@@ -891,108 +888,108 @@ var Z = class e {
891
888
  return this.format === "cmyk" || n.format === "cmyk" ? this.toCmykString() === n.toCmykString() : this.toRgbString() === n.toRgbString();
892
889
  }
893
890
  };
894
- function at(e) {
891
+ function Ke(e) {
895
892
  return typeof e == "string";
896
893
  }
897
- function Q(e, t) {
894
+ function $(e, t) {
898
895
  return e.isValid ? e.toString(t) : e.originalInput.toString();
899
896
  }
900
- function ot(e, t) {
901
- return new Z(e, t);
897
+ function qe(e, t) {
898
+ return new Q(e, t);
902
899
  }
903
- function st(e) {
904
- return at(e) ? e : new Z(e).toString();
900
+ function Je(e) {
901
+ return Ke(e) ? e : new Q(e).toString();
905
902
  }
906
- var ct = (e) => {
907
- let { currentColor: t, format: n, onChange: r, isAlphaHidden: i } = e, [a, o] = _.useState(t.toHsv());
908
- return /* @__PURE__ */ z(B, {
903
+ var Ye = (e) => {
904
+ let { currentColor: n, format: r, onChange: i, isAlphaHidden: a } = e, [o, s] = t.useState(n.toHsv());
905
+ return /* @__PURE__ */ z(V, {
909
906
  className: "MuiColorInput-PopoverBody",
910
907
  children: [
911
- /* @__PURE__ */ R(Fe, {
912
- currentHue: a.h,
913
- hsv: a,
914
- onChange: ({ s: e, v: i }) => {
915
- let s = new Z({
916
- h: a.h,
917
- a: t.toHsv().a,
908
+ /* @__PURE__ */ R(Se, {
909
+ currentHue: o.h,
910
+ hsv: o,
911
+ onChange: ({ s: e, v: t }) => {
912
+ let a = new Q({
913
+ h: o.h,
914
+ a: n.toHsv().a,
918
915
  s: e,
919
- v: i
916
+ v: t
920
917
  });
921
- o((t) => ({
922
- ...t,
918
+ s((n) => ({
919
+ ...n,
923
920
  s: e,
924
- v: i
925
- })), r?.(Q(s, n));
921
+ v: t
922
+ })), i?.($(a, r));
926
923
  }
927
924
  }),
928
- /* @__PURE__ */ R(B, {
925
+ /* @__PURE__ */ R(V, {
929
926
  sx: {
930
927
  mt: "10px",
931
928
  px: "3px"
932
929
  },
933
- children: /* @__PURE__ */ R(Le, {
930
+ children: /* @__PURE__ */ R(we, {
934
931
  min: 0,
935
932
  max: 100,
936
933
  step: 1,
937
- onChange: (e, i) => {
938
- if (!Ae(i)) return;
939
- let s = H(360 * i / 100, 0, 359);
940
- o((e) => ({
934
+ onChange: (e, t) => {
935
+ if (!_e(t)) return;
936
+ let a = U(360 * t / 100, 0, 359);
937
+ s((e) => ({
941
938
  ...e,
942
- h: s
939
+ h: a
943
940
  }));
944
- let c = new Z({
945
- ...a,
946
- a: t.toHsv().a,
947
- h: s
941
+ let c = new Q({
942
+ ...o,
943
+ a: n.toHsv().a,
944
+ h: a
948
945
  });
949
- r?.(Q(c, n));
946
+ i?.($(c, r));
950
947
  },
951
948
  "aria-label": "hue",
952
- value: a.h * 100 / 360
949
+ value: o.h * 100 / 360
953
950
  })
954
951
  }),
955
- i ? null : /* @__PURE__ */ R(B, {
952
+ a ? null : /* @__PURE__ */ R(V, {
956
953
  sx: {
957
954
  mt: "10px",
958
955
  px: "3px"
959
956
  },
960
- children: /* @__PURE__ */ R(De, {
957
+ children: /* @__PURE__ */ R(me, {
961
958
  min: 0,
962
959
  max: 1,
963
960
  step: .01,
964
961
  "aria-label": "alpha",
965
- rgbColor: t.toRgb(),
966
- onChange: (e, i) => {
967
- if (!Ae(i)) return;
968
- let a = t.clone().setAlpha(i);
969
- r?.(Q(a, n));
962
+ rgbColor: n.toRgb(),
963
+ onChange: (e, t) => {
964
+ if (!_e(t)) return;
965
+ let a = n.clone().setAlpha(t);
966
+ i?.($(a, r));
970
967
  },
971
- value: t.getAlpha()
968
+ value: n.getAlpha()
972
969
  })
973
970
  })
974
971
  ]
975
972
  });
976
- }, lt = _.forwardRef((e, t) => {
973
+ }, Xe = t.forwardRef((e, t) => {
977
974
  let { className: n, ...r } = e;
978
- return /* @__PURE__ */ R(ue, {
975
+ return /* @__PURE__ */ R(ae, {
979
976
  className: `MuiColorInput-TextField ${n || ""}`,
980
977
  ref: t,
981
978
  ...r
982
979
  });
983
980
  });
984
- function ut(e) {
981
+ function Ze(e) {
985
982
  return typeof e == "object" && !Array.isArray(e) && e !== null;
986
983
  }
987
- function dt(e, t) {
988
- typeof t == "function" ? t(e) : t && ut(t) && "current" in t && (t.current = e);
984
+ function Qe(e, t) {
985
+ typeof t == "function" ? t(e) : t && Ze(t) && "current" in t && (t.current = e);
989
986
  }
990
- var ft = _.forwardRef(({ value: e, format: t, onChange: n, adornmentPosition: r = "start", PopoverProps: i, Adornment: a = Ce, fallbackValue: o, isAlphaHidden: s, disablePopover: c, ...l }, u) => {
991
- 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 = ot(e, { format: S }), [w, T] = _.useState(e), [E, D] = _.useState(e), O = (e) => {
992
- e.preventDefault(), e.stopPropagation(), !g && !c && x(v.current);
987
+ var $e = t.forwardRef(({ value: e, format: n, onChange: r, adornmentPosition: i = "start", PopoverProps: a, Adornment: o = ue, fallbackValue: s, isAlphaHidden: c, disablePopover: l, ...u }, d) => {
988
+ let { onBlur: f, slotProps: p, ...m } = u, { onClose: h, ...g } = a || {}, _ = m.disabled || !1, v = t.useRef(null), y = t.useRef(null), [b, x] = t.useState(null), S = n || "rgb", C = qe(e, { format: S }), [w, T] = t.useState(e), [E, D] = t.useState(e), O = (e) => {
989
+ e.preventDefault(), e.stopPropagation(), !_ && !l && x(v.current);
993
990
  }, k = (e) => {
994
- let t = new Z(e);
995
- n?.(e, {
991
+ let t = new Q(e);
992
+ r?.(e, {
996
993
  hex: t.isValid ? t.toHexString() : "",
997
994
  hsv: t.isValid ? t.toHsvString() : "",
998
995
  hsl: t.isValid ? t.toHslString() : "",
@@ -1003,36 +1000,36 @@ var ft = _.forwardRef(({ value: e, format: t, onChange: n, adornmentPosition: r
1003
1000
  let t = e.target.value;
1004
1001
  if (T(t), t === "") D(""), k("");
1005
1002
  else {
1006
- let e = Q(new Z(t), S);
1003
+ let e = $(new Q(t), S);
1007
1004
  D(e), k(e);
1008
1005
  }
1009
1006
  }, j = (...e) => {
1010
- m?.(...e), x(null), queueMicrotask(() => {
1007
+ h?.(...e), x(null), queueMicrotask(() => {
1011
1008
  y.current?.focus();
1012
1009
  });
1013
- }, M = (e) => {
1014
- d?.(e);
1015
- let t = new Z(w);
1016
- if (t.isValid) t.format !== S && T(Q(t, S));
1010
+ }, ee = (e) => {
1011
+ f?.(e);
1012
+ let t = new Q(w);
1013
+ if (t.isValid) t.format !== S && T($(t, S));
1017
1014
  else {
1018
1015
  if (w === "") return;
1019
- if (o) {
1020
- let e = Q(new Z(o), S);
1016
+ if (s) {
1017
+ let e = $(new Q(s), S);
1021
1018
  T(e), D(e), k(e);
1022
1019
  }
1023
1020
  }
1024
- }, N = _.useRef(S);
1025
- _.useEffect(() => {
1026
- let t = N.current !== S;
1027
- if (N.current = S, t) {
1028
- let e = ot(w);
1021
+ }, M = t.useRef(S);
1022
+ t.useEffect(() => {
1023
+ let t = M.current !== S;
1024
+ if (M.current = S, t) {
1025
+ let e = qe(w);
1029
1026
  if (e.isValid) {
1030
- let t = Q(e, S);
1027
+ let t = $(e, S);
1031
1028
  T(t), D(t);
1032
1029
  }
1033
1030
  }
1034
1031
  if (e === E) return;
1035
- let n = ot(e), r = ot(E);
1032
+ let n = qe(e), r = qe(E);
1036
1033
  if (!(n.isValid && r.isValid && n.equals(r))) {
1037
1034
  let e = n.originalInput;
1038
1035
  D(e), T(e);
@@ -1042,214 +1039,214 @@ var ft = _.forwardRef(({ value: e, format: t, onChange: n, adornmentPosition: r
1042
1039
  E,
1043
1040
  S
1044
1041
  ]);
1045
- let ee = (e) => {
1042
+ let N = (e) => {
1046
1043
  T(e), D(e), k(e);
1047
1044
  }, te = (e) => {
1048
- v.current = e, dt(e, u);
1045
+ v.current = e, Qe(e, d);
1049
1046
  }, ne = (e) => {
1050
- y.current = e, dt(e, y);
1051
- }, re = !!b, P = re ? "color-popover" : void 0, F = /* @__PURE__ */ R(de, {
1052
- position: r,
1053
- children: /* @__PURE__ */ R(a, {
1054
- disabled: g,
1055
- "aria-describedby": P,
1056
- disablePopover: c || !1,
1057
- component: c ? "span" : void 0,
1047
+ y.current = e, Qe(e, y);
1048
+ }, P = !!b, F = P ? "color-popover" : void 0, I = /* @__PURE__ */ R(oe, {
1049
+ position: i,
1050
+ children: /* @__PURE__ */ R(o, {
1051
+ disabled: _,
1052
+ "aria-describedby": F,
1053
+ disablePopover: l || !1,
1054
+ component: l ? "span" : void 0,
1058
1055
  bgColor: C.toString(),
1059
1056
  isBgColorValid: !!(w !== "" && C.isValid),
1060
- onClick: c ? void 0 : O
1057
+ onClick: l ? void 0 : O
1061
1058
  })
1062
- }), { input: I, ...ie } = f || {}, ae = {
1063
- startAdornment: r === "start" ? F : void 0,
1064
- endAdornment: r === "end" ? F : void 0,
1065
- ...I
1059
+ }), { input: L, ...ie } = p || {}, B = {
1060
+ startAdornment: i === "start" ? I : void 0,
1061
+ endAdornment: i === "end" ? I : void 0,
1062
+ ...L
1066
1063
  };
1067
- return /* @__PURE__ */ z(se, { children: [/* @__PURE__ */ R(lt, {
1064
+ return /* @__PURE__ */ z(re, { children: [/* @__PURE__ */ R(Xe, {
1068
1065
  ref: te,
1069
1066
  spellCheck: "false",
1070
1067
  type: "text",
1071
1068
  autoComplete: "off",
1072
1069
  onChange: A,
1073
- value: st(w),
1074
- onBlur: M,
1070
+ value: Je(w),
1071
+ onBlur: ee,
1075
1072
  inputRef: ne,
1076
- disabled: g,
1073
+ disabled: _,
1077
1074
  slotProps: {
1078
- input: ae,
1075
+ input: B,
1079
1076
  ...ie
1080
1077
  },
1081
- ...p
1082
- }), c ? null : /* @__PURE__ */ R(Te, {
1083
- id: P,
1084
- open: re,
1085
- position: r,
1078
+ ...m
1079
+ }), l ? null : /* @__PURE__ */ R(fe, {
1080
+ id: F,
1081
+ open: P,
1082
+ position: i,
1086
1083
  anchorEl: b,
1087
1084
  onClose: j,
1088
- ...h,
1089
- children: /* @__PURE__ */ R(ct, {
1090
- onChange: ee,
1085
+ ...g,
1086
+ children: /* @__PURE__ */ R(Ye, {
1087
+ onChange: N,
1091
1088
  currentColor: C,
1092
1089
  format: S,
1093
- isAlphaHidden: s
1090
+ isAlphaHidden: c
1094
1091
  })
1095
1092
  })] });
1096
- }), pt = ({ field: e, label: t, onColorChange: n, symbol: r, value: i }) => {
1097
- let a = v((t) => {
1098
- n(r, e, t);
1093
+ }), et = ({ field: e, label: t, onColorChange: r, symbol: i, value: a }) => {
1094
+ let o = n((t) => {
1095
+ r(i, e, t);
1099
1096
  }, [
1100
1097
  e,
1101
- n,
1102
- r
1098
+ r,
1099
+ i
1103
1100
  ]);
1104
- return /* @__PURE__ */ R(ft, {
1101
+ return /* @__PURE__ */ R($e, {
1105
1102
  format: "hex",
1106
1103
  isAlphaHidden: !0,
1107
1104
  label: t,
1108
- onChange: a,
1105
+ onChange: o,
1109
1106
  size: "small",
1110
- value: i
1107
+ value: a
1111
1108
  });
1112
- }, mt = [
1109
+ }, tt = [
1113
1110
  "background",
1114
1111
  "foreground",
1115
1112
  "backgroundSelected",
1116
1113
  "foregroundSelected"
1117
- ], ht = {
1114
+ ], nt = {
1118
1115
  background: "Background",
1119
1116
  backgroundSelected: "Selected background",
1120
1117
  foreground: "Text",
1121
1118
  foregroundSelected: "Selected text"
1122
- }, gt = ({ currentPalette: t, customPalette: n, exportFileName: r, label: o, onPaletteChange: s, palettes: c, parsePalette: l, symbolLabels: u, symbols: d }) => {
1123
- let f = b(), p = S(null), [m, h] = C(null), g = v((e) => {
1124
- let t = e === "Custom" ? n : c.find((t) => t.name === e);
1125
- t && s(t);
1119
+ }, rt = ({ currentPalette: t, customPalette: r, exportFileName: c, label: l, onPaletteChange: u, palettes: h, parsePalette: g, symbolLabels: _, symbols: v }) => {
1120
+ let y = i(), b = o(null), [C, k] = s(null), A = n((e) => {
1121
+ let t = e === "Custom" ? r : h.find((t) => t.name === e);
1122
+ t && u(t);
1126
1123
  }, [
1127
- n,
1128
- s,
1129
- c
1130
- ]), _ = x(() => [...c.map((e) => ({
1124
+ r,
1125
+ u,
1126
+ h
1127
+ ]), j = a(() => [...h.map((e) => ({
1131
1128
  label: e.name,
1132
1129
  value: e.name
1133
1130
  })), {
1134
- label: i,
1135
- value: i
1136
- }], [c]), y = x(() => [{
1137
- definition: F.RADIO_GROUP,
1138
- label: o,
1131
+ label: x,
1132
+ value: x
1133
+ }], [h]), ee = a(() => [{
1134
+ definition: T.RADIO_GROUP,
1135
+ label: l,
1139
1136
  name: "palette",
1140
- onChange: g,
1141
- options: _,
1137
+ onChange: A,
1138
+ options: j,
1142
1139
  required: !0
1143
1140
  }], [
1144
- o,
1145
- g,
1146
- _
1147
- ]), w = x(() => ({ palette: t.name }), [t.name]), T = I({ values: w }), { handleSubmit: E } = T, A = v((e) => {}, []), j = v((e, t, r) => {
1148
- a.test(r) && s({
1149
- ...n,
1141
+ l,
1142
+ A,
1143
+ j
1144
+ ]), M = a(() => ({ palette: t.name }), [t.name]), N = E({ values: M }), { handleSubmit: te } = N, ne = n((e) => {}, []), P = n((e, t, n) => {
1145
+ S.test(n) && u({
1146
+ ...r,
1150
1147
  paletteColors: {
1151
- ...n.paletteColors,
1148
+ ...r.paletteColors,
1152
1149
  [e]: {
1153
- ...n.paletteColors[e],
1154
- [t]: r
1150
+ ...r.paletteColors[e],
1151
+ [t]: n
1155
1152
  }
1156
1153
  }
1157
1154
  });
1158
- }, [n, s]), N = v(async (e) => {
1155
+ }, [r, u]), F = n(async (e) => {
1159
1156
  let t = e.currentTarget, n = t.files?.[0];
1160
1157
  if (t.value = "", n) try {
1161
- s({
1162
- ...l(JSON.parse(await n.text())),
1163
- name: i
1164
- }), h(null);
1158
+ u({
1159
+ ...g(JSON.parse(await n.text())),
1160
+ name: x
1161
+ }), k(null);
1165
1162
  } catch (e) {
1166
1163
  let t = e instanceof Error ? e.message : "Unexpected error while reading the file.";
1167
- h(`Could not import palette: ${t}`);
1164
+ k(`Could not import palette: ${t}`);
1168
1165
  }
1169
- }, [s, l]), ee = v(() => {
1166
+ }, [u, g]), I = n(() => {
1170
1167
  let n = {
1171
1168
  ...t,
1172
- $schema: ie.getBaseURLWithPath() + e
1173
- }, i = new Blob([JSON.stringify(n, null, 2)], { type: "application/json" }), a = URL.createObjectURL(i);
1174
- ae.createDownloadUrl(a, r), URL.revokeObjectURL(a);
1175
- }, [t, r]), te = v(() => {
1176
- p.current?.click();
1169
+ $schema: D.getBaseURLWithPath() + e
1170
+ }, r = new Blob([JSON.stringify(n, null, 2)], { type: "application/json" }), i = URL.createObjectURL(r);
1171
+ O.createDownloadUrl(i, c), URL.revokeObjectURL(i);
1172
+ }, [t, c]), L = n(() => {
1173
+ b.current?.click();
1177
1174
  }, []);
1178
- return /* @__PURE__ */ z(O, {
1175
+ return /* @__PURE__ */ z(f, {
1179
1176
  sx: { "& + &": { mt: 2 } },
1180
1177
  children: [
1181
- /* @__PURE__ */ R(P, {
1182
- formFieldDefinitions: y,
1183
- formId: f,
1184
- formMethods: T,
1185
- onSubmit: E(A)
1178
+ /* @__PURE__ */ R(w, {
1179
+ formFieldDefinitions: ee,
1180
+ formId: y,
1181
+ formMethods: N,
1182
+ onSubmit: te(ne)
1186
1183
  }),
1187
- /* @__PURE__ */ z(O, {
1184
+ /* @__PURE__ */ z(f, {
1188
1185
  sx: {
1189
1186
  display: "flex",
1190
1187
  gap: 1,
1191
1188
  mt: 1
1192
1189
  },
1193
1190
  children: [
1194
- /* @__PURE__ */ R(k, {
1195
- onClick: te,
1191
+ /* @__PURE__ */ R(p, {
1192
+ onClick: L,
1196
1193
  size: "small",
1197
1194
  variant: "outlined",
1198
1195
  children: "Import"
1199
1196
  }),
1200
- /* @__PURE__ */ R(k, {
1201
- onClick: ee,
1197
+ /* @__PURE__ */ R(p, {
1198
+ onClick: I,
1202
1199
  size: "small",
1203
1200
  variant: "outlined",
1204
1201
  children: "Export"
1205
1202
  }),
1206
1203
  /* @__PURE__ */ R("input", {
1207
1204
  accept: ".json,application/json",
1208
- "aria-label": `Import ${o} JSON`,
1209
- onChange: N,
1210
- ref: p,
1205
+ "aria-label": `Import ${l} JSON`,
1206
+ onChange: F,
1207
+ ref: b,
1211
1208
  style: { display: "none" },
1212
1209
  type: "file"
1213
1210
  })
1214
1211
  ]
1215
1212
  }),
1216
- m && /* @__PURE__ */ R(D, {
1213
+ C && /* @__PURE__ */ R(d, {
1217
1214
  severity: "error",
1218
1215
  sx: { mt: 1 },
1219
- children: m
1216
+ children: C
1220
1217
  }),
1221
- t.name === "Custom" && /* @__PURE__ */ R(O, {
1218
+ t.name === "Custom" && /* @__PURE__ */ R(f, {
1222
1219
  sx: {
1223
1220
  display: "flex",
1224
1221
  flexDirection: "column",
1225
1222
  gap: 1,
1226
1223
  mt: 2
1227
1224
  },
1228
- children: d.map((e) => {
1229
- let t = String(e), r = `${u[e]} (${t})`, i = n.paletteColors[e];
1230
- return /* @__PURE__ */ z(O, {
1225
+ children: v.map((e) => {
1226
+ let t = String(e), n = `${_[e]} (${t})`, i = r.paletteColors[e];
1227
+ return /* @__PURE__ */ z(f, {
1231
1228
  sx: {
1232
1229
  borderBottom: "1px solid",
1233
1230
  borderColor: "divider",
1234
1231
  pb: 1
1235
1232
  },
1236
- children: [/* @__PURE__ */ R(M, {
1233
+ children: [/* @__PURE__ */ R(m, {
1237
1234
  sx: {
1238
1235
  fontWeight: 600,
1239
1236
  mb: 1
1240
1237
  },
1241
1238
  variant: "body2",
1242
- children: r
1243
- }), /* @__PURE__ */ R(O, {
1239
+ children: n
1240
+ }), /* @__PURE__ */ R(f, {
1244
1241
  sx: {
1245
1242
  display: "grid",
1246
1243
  gap: 1,
1247
1244
  gridTemplateColumns: "repeat(2, minmax(0, 1fr))"
1248
1245
  },
1249
- children: mt.map((t) => /* @__PURE__ */ R(pt, {
1246
+ children: tt.map((t) => /* @__PURE__ */ R(et, {
1250
1247
  field: t,
1251
- label: `${r} ${ht[t]}`,
1252
- onColorChange: j,
1248
+ label: `${n} ${nt[t]}`,
1249
+ onColorChange: P,
1253
1250
  symbol: e,
1254
1251
  value: i[t]
1255
1252
  }, t))
@@ -1259,223 +1256,29 @@ var ft = _.forwardRef(({ value: e, format: t, onChange: n, adornmentPosition: r
1259
1256
  })
1260
1257
  ]
1261
1258
  });
1262
- }, _t = /* @__PURE__ */ new Map([
1263
- ["Alt", "Alt"],
1264
- ["AltGraph", "AltGr"],
1265
- ["Control", "Ctrl"],
1266
- ["Meta", "Cmd"],
1267
- ["Shift", "Shift"]
1268
- ]), vt = /* @__PURE__ */ new Map([
1269
- ["Alt", ve],
1270
- ["Control", _e],
1271
- ["Meta", ge]
1272
- ]), yt = /* @__PURE__ */ new Map([
1273
- ["ArrowDown", {
1274
- icon: fe,
1275
- label: "Arrow down"
1276
- }],
1277
- ["ArrowLeft", {
1278
- icon: pe,
1279
- label: "Arrow left"
1280
- }],
1281
- ["ArrowRight", {
1282
- icon: me,
1283
- label: "Arrow right"
1284
- }],
1285
- ["ArrowUp", {
1286
- icon: he,
1287
- label: "Arrow up"
1288
- }],
1289
- ["Backspace", { label: "Backspace" }],
1290
- ["Delete", { label: "Delete" }],
1291
- ["End", { label: "End" }],
1292
- ["Home", { label: "Home" }],
1293
- ["PageDown", { label: "Page down" }],
1294
- ["PageUp", { label: "Page up" }],
1295
- ["Space", {
1296
- icon: ye,
1297
- label: "Space"
1298
- }]
1299
- ]), $ = typeof navigator < "u" && /^(Mac|iPhone|iPad|iPod)/i.test(navigator.userAgentData?.platform ?? navigator.platform), bt = [
1300
- {
1301
- name: "Selection",
1302
- shortcuts: [
1303
- r.moveSelectionLeft,
1304
- r.moveSelectionRight,
1305
- r.moveSelectionUp,
1306
- r.moveSelectionDown,
1307
- r.expandSelectionLeft,
1308
- r.expandSelectionRight,
1309
- r.expandSelectionUp,
1310
- r.expandSelectionDown,
1311
- r.moveCellLeft,
1312
- r.moveCellRight,
1313
- r.copySelection
1314
- ]
1315
- },
1316
- {
1317
- name: "Rows",
1318
- shortcuts: [
1319
- r.moveRowUp,
1320
- r.moveRowDown,
1321
- r.moveRowToStart,
1322
- r.moveRowToEnd,
1323
- r.deleteRows,
1324
- r.deleteRowsMac
1325
- ]
1326
- },
1327
- {
1328
- name: "Navigation",
1329
- shortcuts: [
1330
- r.scrollToLineStart,
1331
- r.scrollToLineEnd,
1332
- r.scrollPageUp,
1333
- r.scrollPageDown,
1334
- r.gotoPosition
1335
- ]
1336
- },
1337
- {
1338
- name: "Editing",
1339
- shortcuts: [
1340
- r.insertGap,
1341
- r.deleteBackward,
1342
- r.deleteSelection,
1343
- r.deleteBase,
1344
- r.undo,
1345
- r.redo,
1346
- r.pasteFasta
1347
- ]
1348
- }
1349
- ], xt = (e) => {
1350
- let t = $ ? "Meta" : "Control";
1351
- return e.find((e) => e.includes(t)) ?? e[0] ?? [];
1352
- }, St = (e) => {
1353
- let { code: t, key: n, modifiers: r = [] } = e.shortcut, i = t ? yt.get(t) ?? { label: t } : { label: n?.toUpperCase() ?? "" };
1354
- return [...xt(r).map((e) => ({
1355
- icon: vt.get(e),
1356
- label: $ && e === "Alt" ? "Option" : _t.get(e) ?? e
1357
- })), i];
1358
- }, Ct = (e) => {
1359
- let t = St(e);
1360
- return /* @__PURE__ */ R(O, {
1361
- "aria-label": t.map(({ label: e }) => e).join(" "),
1362
- sx: {
1363
- alignItems: "center",
1364
- display: "flex",
1365
- flexShrink: 0,
1366
- gap: .5
1367
- },
1368
- children: /* @__PURE__ */ R(O, {
1369
- sx: {
1370
- alignItems: "center",
1371
- display: "flex",
1372
- gap: .5
1373
- },
1374
- children: t.map((e) => {
1375
- let t = e.icon;
1376
- return /* @__PURE__ */ R(O, {
1377
- "aria-label": e.label,
1378
- component: "kbd",
1379
- sx: {
1380
- alignItems: "center",
1381
- backgroundColor: "action.hover",
1382
- border: "1px solid",
1383
- borderColor: "divider",
1384
- borderRadius: .75,
1385
- boxShadow: "0 1px 0 rgba(0, 0, 0, 0.2)",
1386
- color: "text.primary",
1387
- display: "flex",
1388
- fontFamily: "monospace",
1389
- fontSize: "0.7rem",
1390
- justifyContent: "center",
1391
- lineHeight: 1,
1392
- minWidth: e.label.length === 1 ? 24 : "auto",
1393
- px: .75,
1394
- py: .5,
1395
- textAlign: "center"
1396
- },
1397
- children: t ? /* @__PURE__ */ R(t, {
1398
- "aria-hidden": !0,
1399
- fontSize: "inherit"
1400
- }) : e.label
1401
- }, e.label);
1402
- })
1403
- })
1404
- });
1405
- }, wt = (e) => {
1406
- let t = Object.values(r).find(({ description: t }) => t === e.currentTarget.dataset.shortcut);
1407
- if (!t) return;
1408
- let { code: n, key: i, modifiers: a = [] } = t.shortcut, o = xt(a);
1409
- t.callback(new KeyboardEvent("keydown", {
1410
- altKey: o.includes("Alt"),
1411
- code: n ?? "",
1412
- ctrlKey: o.includes("Control"),
1413
- key: i ?? n ?? "",
1414
- metaKey: o.includes("Meta"),
1415
- shiftKey: o.includes("Shift")
1416
- }));
1417
- }, Tt = () => /* @__PURE__ */ R(O, {
1418
- sx: {
1419
- display: "flex",
1420
- flexDirection: "column",
1421
- gap: 2,
1422
- px: 2,
1423
- py: 2.5
1424
- },
1425
- children: bt.map((e) => /* @__PURE__ */ z(O, { children: [/* @__PURE__ */ R(M, {
1426
- sx: {
1427
- color: "text.secondary",
1428
- fontWeight: 700,
1429
- mb: .5,
1430
- textTransform: "uppercase"
1431
- },
1432
- variant: "caption",
1433
- children: e.name
1434
- }), /* @__PURE__ */ R(O, {
1435
- sx: {
1436
- display: "flex",
1437
- flexDirection: "column",
1438
- gap: .5
1439
- },
1440
- children: e.shortcuts.filter((e) => (!e.macOnly || $) && (!e.nonMacOnly || !$)).map((e) => /* @__PURE__ */ z(A, {
1441
- "data-shortcut": e.description,
1442
- onClick: wt,
1443
- sx: {
1444
- borderRadius: 1,
1445
- gap: 1,
1446
- justifyContent: "space-between",
1447
- px: 1,
1448
- py: .75
1449
- },
1450
- children: [/* @__PURE__ */ R(j, {
1451
- primary: e.description,
1452
- sx: { "& .MuiListItemText-primary": { typography: "body2" } }
1453
- }), Ct(e)]
1454
- }, e.description))
1455
- })] }, e.name))
1456
- }), Et = () => {
1457
- let e = t(n, (e) => e.parsedMetadata), r = t(n, (e) => e.aminoAcidPalette), i = t(n, (e) => e.customAminoAcidPalette), a = t(n, (e) => e.customNucleotidePalette), _ = t(n, (e) => e.nucleotidePalette), b = t(n, (e) => e.setAminoAcidPalette), S = t(n, (e) => e.setCustomAminoAcidPalette), D = t(n, (e) => e.setCustomNucleotidePalette), k = t(n, (e) => e.setNucleotidePalette), A = t(n, (e) => e.engineMeta), [j, P] = C([]), F = v((e) => {
1458
- P((t) => t.includes(e) ? t.filter((t) => t !== e) : [...t, e]);
1459
- }, []), I = v((e) => {
1460
- P((t) => t.filter((t) => t !== e));
1461
- }, []), ie = v(() => F("COLORS"), [F]), ae = v(() => F("METADATA"), [F]), oe = v(() => F("KEYBOARD_SHORTCUTS"), [F]);
1462
- y(() => {
1259
+ }, it = () => {
1260
+ let e = v(b, (e) => e.parsedMetadata), t = v(b, (e) => e.aminoAcidPalette), i = v(b, (e) => e.customAminoAcidPalette), o = v(b, (e) => e.customNucleotidePalette), d = v(b, (e) => e.nucleotidePalette), p = v(b, (e) => e.setAminoAcidPalette), x = v(b, (e) => e.setCustomAminoAcidPalette), S = v(b, (e) => e.setCustomNucleotidePalette), w = v(b, (e) => e.setNucleotidePalette), T = v(b, (e) => e.engineMeta), [E, D] = s([]), O = n((e) => {
1261
+ D((t) => t.includes(e) ? t.filter((t) => t !== e) : [...t, e]);
1262
+ }, []), I = n((e) => {
1263
+ D((t) => t.filter((t) => t !== e));
1264
+ }, []), L = n(() => O("COLORS"), [O]), ie = n(() => O("METADATA"), [O]);
1265
+ r(() => {
1463
1266
  e || I("METADATA");
1464
1267
  }, [I, e]);
1465
- let L = v((e) => {
1466
- k(e), e.name === "Custom" && D(e);
1467
- }, [D, k]), ce = v((e) => {
1468
- b(e), e.name === "Custom" && S(e);
1469
- }, [b, S]), le = x(() => [
1470
- l,
1471
- u,
1472
- f
1473
- ], []), B = x(() => [
1474
- c,
1475
- d,
1476
- s
1268
+ let B = n((e) => {
1269
+ w(e), e.name === "Custom" && S(e);
1270
+ }, [S, w]), V = n((e) => {
1271
+ p(e), e.name === "Custom" && x(e);
1272
+ }, [p, x]), ae = a(() => [
1273
+ j,
1274
+ ee,
1275
+ N
1276
+ ], []), oe = a(() => [
1277
+ A,
1278
+ M,
1279
+ k
1477
1280
  ], []);
1478
- return /* @__PURE__ */ z(re, { children: [/* @__PURE__ */ R(O, {
1281
+ return /* @__PURE__ */ z(y, { children: [/* @__PURE__ */ R(f, {
1479
1282
  sx: {
1480
1283
  borderBottom: "1px solid",
1481
1284
  borderColor: "divider",
@@ -1484,143 +1287,109 @@ var ft = _.forwardRef(({ value: e, format: t, onChange: n, adornmentPosition: r
1484
1287
  gap: 1.5,
1485
1288
  p: 2
1486
1289
  },
1487
- children: A && /* @__PURE__ */ z(se, { children: [/* @__PURE__ */ R(M, {
1290
+ children: T && /* @__PURE__ */ z(re, { children: [/* @__PURE__ */ R(m, {
1488
1291
  sx: { fontWeight: 600 },
1489
1292
  variant: "body2",
1490
1293
  children: "Alignment dimensions"
1491
- }), /* @__PURE__ */ R(M, {
1294
+ }), /* @__PURE__ */ R(m, {
1492
1295
  sx: { fontWeight: 400 },
1493
1296
  variant: "body2",
1494
- children: `${A.sequenceCount} sequences x ${A.alignmentWidth} bases`
1297
+ children: `${T.sequenceCount} sequences x ${T.alignmentWidth} bases`
1495
1298
  })] })
1496
- }), /* @__PURE__ */ z(O, {
1299
+ }), /* @__PURE__ */ z(f, {
1497
1300
  sx: { pb: 3 },
1498
- children: [
1499
- /* @__PURE__ */ z(w, {
1500
- disableGutters: !0,
1501
- elevation: 0,
1502
- expanded: j.includes("KEYBOARD_SHORTCUTS"),
1503
- onChange: oe,
1301
+ children: [/* @__PURE__ */ z(c, {
1302
+ disableGutters: !0,
1303
+ elevation: 0,
1304
+ expanded: E.includes("COLORS"),
1305
+ onChange: L,
1306
+ sx: {
1307
+ borderBottom: "1px solid",
1308
+ borderColor: "divider"
1309
+ },
1310
+ children: [/* @__PURE__ */ R(u, {
1311
+ expandIcon: /* @__PURE__ */ R(h, {}),
1312
+ children: /* @__PURE__ */ z(f, {
1313
+ sx: {
1314
+ alignItems: "center",
1315
+ display: "flex",
1316
+ gap: 1
1317
+ },
1318
+ children: [/* @__PURE__ */ R(_, {
1319
+ color: "primary",
1320
+ fontSize: "small"
1321
+ }), /* @__PURE__ */ R(m, {
1322
+ sx: { fontWeight: 600 },
1323
+ variant: "body2",
1324
+ children: "Colors"
1325
+ })]
1326
+ })
1327
+ }), /* @__PURE__ */ z(l, {
1504
1328
  sx: {
1505
- borderBottom: "1px solid",
1506
- borderColor: "divider"
1329
+ pb: 2,
1330
+ pt: 0,
1331
+ px: 2
1507
1332
  },
1508
- children: [/* @__PURE__ */ R(E, {
1509
- expandIcon: /* @__PURE__ */ R(N, {}),
1510
- children: /* @__PURE__ */ z(O, {
1511
- sx: {
1512
- alignItems: "center",
1513
- display: "flex",
1514
- gap: 1
1515
- },
1516
- children: [/* @__PURE__ */ R(ne, {
1517
- color: "primary",
1518
- fontSize: "small"
1519
- }), /* @__PURE__ */ R(M, {
1520
- sx: { fontWeight: 600 },
1521
- variant: "body2",
1522
- children: "Keyboard shortcuts"
1523
- })]
1524
- })
1525
- }), /* @__PURE__ */ R(T, {
1526
- sx: { p: 0 },
1527
- children: /* @__PURE__ */ R(Tt, {})
1333
+ children: [/* @__PURE__ */ R(rt, {
1334
+ currentPalette: d,
1335
+ customPalette: o,
1336
+ exportFileName: "nucleotide-palette.json",
1337
+ label: "Nucleotide colors",
1338
+ onPaletteChange: B,
1339
+ palettes: ae,
1340
+ parsePalette: C.parseNucleotidePalette,
1341
+ symbolLabels: F,
1342
+ symbols: P
1343
+ }), /* @__PURE__ */ R(rt, {
1344
+ currentPalette: t,
1345
+ customPalette: i,
1346
+ exportFileName: "amino-acid-palette.json",
1347
+ label: "Amino-acid colors",
1348
+ onPaletteChange: V,
1349
+ palettes: oe,
1350
+ parsePalette: C.parseAminoAcidPalette,
1351
+ symbolLabels: ne,
1352
+ symbols: te
1528
1353
  })]
1529
- }),
1530
- /* @__PURE__ */ z(w, {
1531
- disableGutters: !0,
1532
- elevation: 0,
1533
- expanded: j.includes("COLORS"),
1534
- onChange: ie,
1535
- sx: {
1536
- borderBottom: "1px solid",
1537
- borderColor: "divider"
1538
- },
1539
- children: [/* @__PURE__ */ R(E, {
1540
- expandIcon: /* @__PURE__ */ R(N, {}),
1541
- children: /* @__PURE__ */ z(O, {
1542
- sx: {
1543
- alignItems: "center",
1544
- display: "flex",
1545
- gap: 1
1546
- },
1547
- children: [/* @__PURE__ */ R(te, {
1548
- color: "primary",
1549
- fontSize: "small"
1550
- }), /* @__PURE__ */ R(M, {
1551
- sx: { fontWeight: 600 },
1552
- variant: "body2",
1553
- children: "Colors"
1554
- })]
1555
- })
1556
- }), /* @__PURE__ */ z(T, {
1354
+ })]
1355
+ }), /* @__PURE__ */ z(c, {
1356
+ disabled: !e,
1357
+ disableGutters: !0,
1358
+ elevation: 0,
1359
+ expanded: E.includes("METADATA"),
1360
+ onChange: ie,
1361
+ sx: {
1362
+ borderBottom: "1px solid",
1363
+ borderColor: "divider"
1364
+ },
1365
+ children: [/* @__PURE__ */ R(u, {
1366
+ expandIcon: /* @__PURE__ */ R(h, {}),
1367
+ children: /* @__PURE__ */ z(f, {
1557
1368
  sx: {
1558
- pb: 2,
1559
- pt: 0,
1560
- px: 2
1369
+ alignItems: "center",
1370
+ display: "flex",
1371
+ gap: 1
1561
1372
  },
1562
- children: [/* @__PURE__ */ R(gt, {
1563
- currentPalette: _,
1564
- customPalette: a,
1565
- exportFileName: "nucleotide-palette.json",
1566
- label: "Nucleotide colors",
1567
- onPaletteChange: L,
1568
- palettes: le,
1569
- parsePalette: o.parseNucleotidePalette,
1570
- symbolLabels: g,
1571
- symbols: h
1572
- }), /* @__PURE__ */ R(gt, {
1573
- currentPalette: r,
1574
- customPalette: i,
1575
- exportFileName: "amino-acid-palette.json",
1576
- label: "Amino-acid colors",
1577
- onPaletteChange: ce,
1578
- palettes: B,
1579
- parsePalette: o.parseAminoAcidPalette,
1580
- symbolLabels: m,
1581
- symbols: p
1373
+ children: [/* @__PURE__ */ R(g, {
1374
+ color: "primary",
1375
+ fontSize: "small"
1376
+ }), /* @__PURE__ */ R(m, {
1377
+ sx: { fontWeight: 600 },
1378
+ variant: "body2",
1379
+ children: "Metadata"
1582
1380
  })]
1583
- })]
1584
- }),
1585
- /* @__PURE__ */ z(w, {
1586
- disabled: !e,
1587
- disableGutters: !0,
1588
- elevation: 0,
1589
- expanded: j.includes("METADATA"),
1590
- onChange: ae,
1381
+ })
1382
+ }), /* @__PURE__ */ R(l, {
1591
1383
  sx: {
1592
- borderBottom: "1px solid",
1593
- borderColor: "divider"
1384
+ pb: 2,
1385
+ pt: 0,
1386
+ px: 2
1594
1387
  },
1595
- children: [/* @__PURE__ */ R(E, {
1596
- expandIcon: /* @__PURE__ */ R(N, {}),
1597
- children: /* @__PURE__ */ z(O, {
1598
- sx: {
1599
- alignItems: "center",
1600
- display: "flex",
1601
- gap: 1
1602
- },
1603
- children: [/* @__PURE__ */ R(ee, {
1604
- color: "primary",
1605
- fontSize: "small"
1606
- }), /* @__PURE__ */ R(M, {
1607
- sx: { fontWeight: 600 },
1608
- variant: "body2",
1609
- children: "Metadata"
1610
- })]
1611
- })
1612
- }), /* @__PURE__ */ R(T, {
1613
- sx: {
1614
- pb: 2,
1615
- pt: 0,
1616
- px: 2
1617
- },
1618
- children: "Metadata"
1619
- })]
1620
- })
1621
- ]
1388
+ children: "Metadata"
1389
+ })]
1390
+ })]
1622
1391
  })] });
1623
1392
  };
1624
- export { Et as t };
1393
+ export { it as t };
1625
1394
 
1626
1395
  //# sourceMappingURL=SequenceEditorPageDrawer.js.map