@rivm-loculus-tools/sequence-editor 0.1.5 → 0.2.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 (72) hide show
  1. package/dist/_chunks/EditorWorkerService.js +12 -11
  2. package/dist/_chunks/EditorWorkerService.js.map +1 -1
  3. package/dist/_chunks/SequenceEditor.js +362 -495
  4. package/dist/_chunks/SequenceEditor.js.map +1 -1
  5. package/dist/_chunks/SequenceEditorPageDrawer.js +160 -49577
  6. package/dist/_chunks/SequenceEditorPageDrawer.js.map +1 -1
  7. package/dist/_chunks/comlink.js +228 -0
  8. package/dist/_chunks/comlink.js.map +1 -0
  9. package/dist/_chunks/react.js +11 -0
  10. package/dist/_chunks/react.js.map +1 -0
  11. package/dist/_chunks/sequenceEditorStore.js +40 -273
  12. package/dist/_chunks/sequenceEditorStore.js.map +1 -1
  13. package/dist/assets/index-Dn92arD_.js +8 -0
  14. package/dist/assets/index-Dn92arD_.js.map +1 -0
  15. package/dist/classes/services/EditorWorkerService/index.js +1 -2
  16. package/dist/classes/services/SequenceEditorEventBusService/index.js +16 -2
  17. package/dist/classes/services/SequenceEditorEventBusService/index.js.map +1 -0
  18. package/dist/classes/workers/EngineWorker/index.js +3 -2
  19. package/dist/classes/workers/EngineWorker/index.js.map +1 -1
  20. package/dist/components/app/App/index.js +15 -951
  21. package/dist/components/app/App/index.js.map +1 -1
  22. package/dist/components/pages/SequenceEditorErrorPage/index.js +6 -6
  23. package/dist/components/pages/SequenceEditorErrorPage/index.js.map +1 -1
  24. package/dist/components/pages/SequenceEditorMainPage/index.js +61 -2
  25. package/dist/components/pages/SequenceEditorMainPage/index.js.map +1 -0
  26. package/dist/components/ui/SequenceEditor/index.js +1 -2
  27. package/dist/components/ui/SequenceEditorPage/index.js +8 -8
  28. package/dist/components/ui/SequenceEditorPage/index.js.map +1 -1
  29. package/dist/components/ui/SequenceEditorPageDrawer/index.js +1 -2
  30. package/dist/components/ui/SequenceEditorPageHeader/index.js +60 -2
  31. package/dist/components/ui/SequenceEditorPageHeader/index.js.map +1 -0
  32. package/dist/components/ui/SequenceEditorSearchBar/index.js +27 -2
  33. package/dist/components/ui/SequenceEditorSearchBar/index.js.map +1 -0
  34. package/dist/constants/editor.js.map +1 -1
  35. package/dist/constants/keyboard.js +1 -1
  36. package/dist/constants/keyboard.js.map +1 -1
  37. package/dist/constants/palette.js.map +1 -1
  38. package/dist/models/editor.js.map +1 -1
  39. package/dist/models/model.js.map +1 -1
  40. package/dist/models/palette.js.map +1 -1
  41. package/dist/stores/sequenceEditorStore/index.js +1 -2
  42. package/dist/utils/EditorUtil/index.js +158 -150
  43. package/dist/utils/EditorUtil/index.js.map +1 -1
  44. package/dist/utils/PaletteUtil/index.js.map +1 -1
  45. package/package.json +52 -29
  46. package/dist/_chunks/Box.js +0 -6737
  47. package/dist/_chunks/Box.js.map +0 -1
  48. package/dist/_chunks/Close.js +0 -7
  49. package/dist/_chunks/Close.js.map +0 -1
  50. package/dist/_chunks/KeyboardArrowDown.js +0 -1023
  51. package/dist/_chunks/KeyboardArrowDown.js.map +0 -1
  52. package/dist/_chunks/Redo.js +0 -2559
  53. package/dist/_chunks/Redo.js.map +0 -1
  54. package/dist/_chunks/SequenceEditorEventBusService.js +0 -102
  55. package/dist/_chunks/SequenceEditorEventBusService.js.map +0 -1
  56. package/dist/_chunks/SequenceEditorMainPage.js +0 -552
  57. package/dist/_chunks/SequenceEditorMainPage.js.map +0 -1
  58. package/dist/_chunks/SequenceEditorPageHeader.js +0 -236
  59. package/dist/_chunks/SequenceEditorPageHeader.js.map +0 -1
  60. package/dist/_chunks/SequenceEditorSearchBar.js +0 -143
  61. package/dist/_chunks/SequenceEditorSearchBar.js.map +0 -1
  62. package/dist/_chunks/TestIdUtil.js +0 -4695
  63. package/dist/_chunks/TestIdUtil.js.map +0 -1
  64. package/dist/_chunks/TextField.js +0 -3083
  65. package/dist/_chunks/TextField.js.map +0 -1
  66. package/dist/_chunks/rolldown-runtime.js +0 -13
  67. package/dist/_chunks/sequence_editor.js +0 -517
  68. package/dist/_chunks/sequence_editor.js.map +0 -1
  69. package/dist/_chunks/withDialog.js +0 -289
  70. package/dist/_chunks/withDialog.js.map +0 -1
  71. package/dist/assets/index-C5rc-pJV.js +0 -8
  72. package/dist/assets/index-C5rc-pJV.js.map +0 -1
@@ -1,232 +1,105 @@
1
- import { n as e } from "./rolldown-runtime.js";
2
- import { EDITOR_DIRECTION as t } from "../models/editor.js";
3
- import { EDITOR_PATH_PROPERTIES_TYPE as n } from "../models/model.js";
4
- import { DEFAULT_GRID_GEOMETRY as r, IUPAC_KEYS as i } from "../constants/editor.js";
5
- import { n as a, t as o } from "./SequenceEditorEventBusService.js";
6
- import { KEYBOARD_SHORTCUTS as s } from "../constants/keyboard.js";
1
+ import { EDITOR_DIRECTION as e } from "../models/editor.js";
2
+ import { EDITOR_PATH_PROPERTIES_TYPE as t } from "../models/model.js";
3
+ import { DEFAULT_GRID_GEOMETRY as n, IUPAC_KEYS as r } from "../constants/editor.js";
4
+ import { SequenceEditorEventBusService as i } from "../classes/services/SequenceEditorEventBusService/index.js";
5
+ import { KEYBOARD_SHORTCUTS as a } from "../constants/keyboard.js";
7
6
  import "../constants/index.js";
8
- import { EditorUtil as c } from "../utils/EditorUtil/index.js";
9
- import { t as l } from "./sequenceEditorStore.js";
10
- import { Dt as u, It as d, Lt as f, P as p, nt as m, t as h } from "./Box.js";
11
- import { t as g } from "./TextField.js";
12
- import { t as _ } from "./withDialog.js";
13
- import { t as v } from "./SequenceEditorSearchBar.js";
14
- import { t as y } from "./EditorWorkerService.js";
15
- //#region ../../../../node_modules/.pnpm/@gen-epix+ui-core@3.8.1_react@19.3.0/node_modules/@gen-epix/ui-core/dist/classes/Subject/index.js
16
- var b = /* @__PURE__ */ e(f()), x = class {
17
- data;
18
- subscriptions = [];
19
- constructor(e) {
20
- this.data = e;
21
- }
22
- next(e) {
23
- let t = this.data;
24
- this.data = e, this.subscriptions.forEach((n) => {
25
- n(e, t);
26
- });
27
- }
28
- subscribe(e) {
29
- return this.subscriptions.push(e), () => {
30
- this.subscriptions = this.subscriptions.filter((t) => t !== e);
31
- };
32
- }
33
- };
34
- //#endregion
7
+ import { EditorUtil as o } from "../utils/EditorUtil/index.js";
8
+ import { t as s } from "./sequenceEditorStore.js";
9
+ import { t as c } from "./react.js";
10
+ import { SequenceEditorSearchBar as l } from "../components/ui/SequenceEditorSearchBar/index.js";
11
+ import { t as u } from "./EditorWorkerService.js";
12
+ import { useCallback as d, useEffect as f, useMemo as p, useRef as m, useState as h } from "react";
13
+ import { jsx as g, jsxs as _ } from "react/jsx-runtime";
14
+ import { Box as v, TextField as y, darken as b, useTheme as x } from "@mui/material";
15
+ import { Subject as S } from "@gen-epix/ui-core/classes/Subject";
16
+ import { DevicePixelRatioService as C } from "@gen-epix/ui-core/classes/services/DevicePixelRatioService";
17
+ import { KeyboardShortcutService as w } from "@gen-epix/ui-core/classes/services/KeyboardShortcutService";
18
+ import { withDialog as T } from "@gen-epix/ui-core-components/hoc/withDialog";
35
19
  //#region ../../../../node_modules/.pnpm/use-debounce@10.1.1_react@19.3.0/node_modules/use-debounce/dist/index.module.js
36
- function S(e, t, n, r) {
37
- var i = this, a = (0, b.useRef)(null), o = (0, b.useRef)(0), s = (0, b.useRef)(0), c = (0, b.useRef)(null), l = (0, b.useRef)([]), u = (0, b.useRef)(), d = (0, b.useRef)(), f = (0, b.useRef)(e), p = (0, b.useRef)(!0), m = (0, b.useRef)(), h = (0, b.useRef)();
38
- f.current = e;
39
- var g = typeof window < "u", _ = !t && t !== 0 && g;
20
+ function E(e, t, n, r) {
21
+ var i = this, a = m(null), o = m(0), s = m(0), c = m(null), l = m([]), u = m(), d = m(), h = m(e), g = m(!0), _ = m(), v = m();
22
+ h.current = e;
23
+ var y = typeof window < "u", b = !t && t !== 0 && y;
40
24
  if (typeof e != "function") throw TypeError("Expected a function");
41
25
  t = +t || 0;
42
- var v = !!(n ||= {}).leading, y = !("trailing" in n) || !!n.trailing, x = !!n.flushOnExit && y, S = "maxWait" in n, C = "debounceOnServer" in n && !!n.debounceOnServer, w = S ? Math.max(+n.maxWait || 0, t) : null, T = (0, b.useMemo)(function() {
26
+ var x = !!(n ||= {}).leading, S = !("trailing" in n) || !!n.trailing, C = !!n.flushOnExit && S, w = "maxWait" in n, T = "debounceOnServer" in n && !!n.debounceOnServer, E = w ? Math.max(+n.maxWait || 0, t) : null, D = p(function() {
43
27
  var e = function(e) {
44
28
  var t = l.current, n = u.current;
45
- return l.current = u.current = null, o.current = e, s.current = s.current || e, d.current = f.current.apply(n, t);
29
+ return l.current = u.current = null, o.current = e, s.current = s.current || e, d.current = h.current.apply(n, t);
46
30
  }, n = function(e, t) {
47
- _ && cancelAnimationFrame(c.current), c.current = _ ? requestAnimationFrame(e) : setTimeout(e, t);
48
- }, b = function(e) {
49
- if (!p.current) return !1;
31
+ b && cancelAnimationFrame(c.current), c.current = b ? requestAnimationFrame(e) : setTimeout(e, t);
32
+ }, f = function(e) {
33
+ if (!g.current) return !1;
50
34
  var n = e - a.current;
51
- return !a.current || n >= t || n < 0 || S && e - o.current >= w;
52
- }, T = function(t) {
53
- return c.current = null, y && l.current ? e(t) : (l.current = u.current = null, d.current);
54
- }, E = function e() {
35
+ return !a.current || n >= t || n < 0 || w && e - o.current >= E;
36
+ }, p = function(t) {
37
+ return c.current = null, S && l.current ? e(t) : (l.current = u.current = null, d.current);
38
+ }, m = function e() {
55
39
  var r = Date.now();
56
- if (v && s.current === o.current && D(), b(r)) return T(r);
57
- if (p.current) {
40
+ if (x && s.current === o.current && D(), f(r)) return p(r);
41
+ if (g.current) {
58
42
  var i = t - (r - a.current);
59
- n(e, S ? Math.min(i, w - (r - o.current)) : i);
43
+ n(e, w ? Math.min(i, E - (r - o.current)) : i);
60
44
  }
61
45
  }, D = function() {
62
46
  r && r({});
63
47
  }, O = function() {
64
- if (g || C) {
65
- var r, s = Date.now(), f = b(s);
66
- if (l.current = [].slice.call(arguments), u.current = i, a.current = s, x && !m.current && (m.current = function() {
67
- globalThis.document?.visibilityState === "hidden" && h.current.flush();
68
- }, (r = globalThis.document) == null || r.addEventListener == null || r.addEventListener("visibilitychange", m.current)), f) {
69
- if (!c.current && p.current) return o.current = a.current, n(E, t), v ? e(a.current) : d.current;
70
- if (S) return n(E, t), e(a.current);
48
+ if (y || T) {
49
+ var r, s = Date.now(), p = f(s);
50
+ if (l.current = [].slice.call(arguments), u.current = i, a.current = s, C && !_.current && (_.current = function() {
51
+ globalThis.document?.visibilityState === "hidden" && v.current.flush();
52
+ }, (r = globalThis.document) == null || r.addEventListener == null || r.addEventListener("visibilitychange", _.current)), p) {
53
+ if (!c.current && g.current) return o.current = a.current, n(m, t), x ? e(a.current) : d.current;
54
+ if (w) return n(m, t), e(a.current);
71
55
  }
72
- return c.current || n(E, t), d.current;
56
+ return c.current || n(m, t), d.current;
73
57
  }
74
58
  };
75
59
  return O.cancel = function() {
76
60
  var e = c.current;
77
- e && (_ ? cancelAnimationFrame(c.current) : clearTimeout(c.current)), o.current = 0, l.current = a.current = u.current = c.current = null, e && r && r({});
61
+ e && (b ? cancelAnimationFrame(c.current) : clearTimeout(c.current)), o.current = 0, l.current = a.current = u.current = c.current = null, e && r && r({});
78
62
  }, O.isPending = function() {
79
63
  return !!c.current;
80
64
  }, O.flush = function() {
81
- return c.current ? T(Date.now()) : d.current;
65
+ return c.current ? p(Date.now()) : d.current;
82
66
  }, O;
83
67
  }, [
84
- v,
85
- S,
86
- t,
87
- w,
88
- y,
89
68
  x,
90
- _,
91
- g,
69
+ w,
70
+ t,
71
+ E,
72
+ S,
92
73
  C,
74
+ b,
75
+ y,
76
+ T,
93
77
  r
94
78
  ]);
95
- return h.current = T, (0, b.useEffect)(function() {
96
- return p.current = !0, function() {
79
+ return v.current = D, f(function() {
80
+ return g.current = !0, function() {
97
81
  var e;
98
- x && h.current.flush(), m.current &&= ((e = globalThis.document) == null || e.removeEventListener == null || e.removeEventListener("visibilitychange", m.current), null), p.current = !1;
82
+ C && v.current.flush(), _.current &&= ((e = globalThis.document) == null || e.removeEventListener == null || e.removeEventListener("visibilitychange", _.current), null), g.current = !1;
99
83
  };
100
- }, [x]), T;
84
+ }, [C]), D;
101
85
  }
102
86
  //#endregion
103
- //#region ../../../../node_modules/.pnpm/@gen-epix+ui-core@3.8.1_react@19.3.0/node_modules/@gen-epix/ui-core/dist/classes/services/WindowService/index.js
104
- var C = class e {
105
- static __instance;
106
- get body() {
107
- return this.document ? this.document.body : null;
108
- }
109
- get document() {
110
- return this.window ? this.window.document : null;
111
- }
112
- get window() {
113
- return globalThis;
114
- }
115
- constructor() {}
116
- static getInstance() {
117
- return e.__instance = a.getHmrSingleton("windowService", e.__instance, () => new e()), e.__instance;
118
- }
119
- }, w = class {
120
- get data() {
121
- return this.subject.data;
122
- }
123
- subject;
124
- constructor(e) {
125
- this.subject = e;
126
- }
127
- next(e) {
128
- return this.subject.next(e);
129
- }
130
- subscribe(e) {
131
- return this.subject.subscribe(e);
132
- }
133
- }, T = class e extends w {
134
- static __instance;
135
- constructor() {
136
- super(new x(C.getInstance().window.devicePixelRatio));
137
- let e = () => {
138
- let t = C.getInstance().window, n = t.matchMedia(`(resolution: ${t.devicePixelRatio}dppx)`), r = () => {
139
- this.subject.next(t.devicePixelRatio), n.removeEventListener("change", r), e();
140
- };
141
- n.addEventListener("change", r);
142
- };
143
- e();
144
- }
145
- static getInstance() {
146
- return e.__instance = a.getHmrSingleton("devicePixelRatioService", e.__instance, () => new e()), e.__instance;
147
- }
148
- }, E = [
149
- "form",
150
- "input",
151
- "label",
152
- "select",
153
- "textarea",
154
- "button",
155
- "fieldset",
156
- "legend",
157
- "datalist",
158
- "output",
159
- "option",
160
- "optgroup"
161
- ], D = [
162
- "Alt",
163
- "AltGraph",
164
- "Control",
165
- "Meta",
166
- "Shift"
167
- ], O = class e {
168
- static __instance;
169
- configs = [];
170
- constructor() {
171
- window.addEventListener("keydown", this.handleWindowKeyDown);
172
- }
173
- static getInstance() {
174
- return e.__instance = a.getHmrSingleton("keyboardShortcutService", e.__instance, () => new e()), e.__instance;
175
- }
176
- static shouldIgnoreShortcut(e) {
177
- let t = document.activeElement;
178
- if (e?.contains(t)) return !1;
179
- let n = t;
180
- for (; n;) {
181
- if (E.includes(n.tagName.toLowerCase())) return !0;
182
- n = n.parentElement;
183
- }
184
- return !1;
185
- }
186
- registerShortcut({ callback: e, code: t, element: n, key: r, modifiers: i }) {
187
- let a = {
188
- callback: e,
189
- code: t,
190
- element: n,
191
- key: r,
192
- modifiers: i
193
- };
194
- return this.configs.push(a), (n ?? window).addEventListener("keydown", n ? this.handleElementKeyDown : this.handleWindowKeyDown), () => {
195
- let e = this.configs.indexOf(a);
196
- e !== -1 && (this.configs.splice(e, 1), this.configs.some((e) => e.element === n) || (n ?? window).removeEventListener("keydown", n ? this.handleElementKeyDown : this.handleWindowKeyDown));
197
- };
198
- }
199
- handleElementKeyDown = (e) => {
200
- this.handleKeyDown(e, e.currentTarget);
201
- };
202
- handleKeyDown = (t, n) => {
203
- for (let r of this.configs) {
204
- let { callback: i, code: a, key: o, modifiers: s } = r;
205
- if (n === r.element && !(o && t.key !== o || a && t.code !== a) && (s?.length ? s : [[]]).some((e) => D.every((n) => e.includes(n) === t.getModifierState(n)))) {
206
- if (e.shouldIgnoreShortcut(n)) return;
207
- i(t);
208
- return;
209
- }
210
- }
211
- };
212
- handleWindowKeyDown = (e) => {
213
- this.handleKeyDown(e, void 0);
214
- };
215
- }, k = u(), ee = () => {
216
- let e = p(), t = d(l, (e) => e.latestMessage), n = d(l, (e) => e.meta), r = d(l, (e) => e.selection), i = (0, b.useMemo)(() => c.getStatusBarSelectionStats(r, n), [n, r]);
217
- return /* @__PURE__ */ (0, k.jsx)(h, {
87
+ //#region src/components/ui/SequenceEditor/SequenceEditorStatusBar.tsx
88
+ var D = () => {
89
+ let e = x(), t = c(s, (e) => e.latestMessage), n = c(s, (e) => e.meta), r = c(s, (e) => e.selection), i = p(() => o.getStatusBarSelectionStats(r, n), [n, r]);
90
+ return /* @__PURE__ */ g(v, {
218
91
  sx: {
219
- backgroundColor: m(e.palette.background.paper, .1),
220
- borderTop: `1px solid ${m(e.palette.background.paper, .2)}`,
92
+ backgroundColor: b(e.palette.background.paper, .1),
93
+ borderTop: `1px solid ${b(e.palette.background.paper, .2)}`,
221
94
  fontSize: e.typography.caption,
222
95
  height: "100%",
223
96
  width: "100%"
224
97
  },
225
- children: /* @__PURE__ */ (0, k.jsxs)(h, {
98
+ children: /* @__PURE__ */ _(v, {
226
99
  sx: {
227
100
  "& > div": {
228
101
  alignItems: "center",
229
- borderLeft: `1px solid ${m(e.palette.background.paper, .2)}`,
102
+ borderLeft: `1px solid ${b(e.palette.background.paper, .2)}`,
230
103
  display: "flex",
231
104
  paddingLeft: e.spacing(1)
232
105
  },
@@ -238,23 +111,23 @@ var C = class e {
238
111
  paddingRight: e.spacing(1)
239
112
  },
240
113
  children: [
241
- /* @__PURE__ */ (0, k.jsx)(h, { children: t ?? "" }),
242
- /* @__PURE__ */ (0, k.jsx)(h, { children: `Pos: ${i.pos}` }),
243
- /* @__PURE__ */ (0, k.jsx)(h, { children: `Selected seqs: ${i.selectedSeqs}` }),
244
- /* @__PURE__ */ (0, k.jsx)(h, { children: `Cols: ${i.cols}` }),
245
- /* @__PURE__ */ (0, k.jsx)(h, { children: `Total selected chars: ${i.totalSelectedChars}` }),
246
- /* @__PURE__ */ (0, k.jsx)(h, { children: `Alignment: ${n?.alignmentWidth ?? "0"} sequences ${n?.sequenceCount ?? "0"} pos.` })
114
+ /* @__PURE__ */ g(v, { children: t ?? "" }),
115
+ /* @__PURE__ */ g(v, { children: `Pos: ${i.pos}` }),
116
+ /* @__PURE__ */ g(v, { children: `Selected seqs: ${i.selectedSeqs}` }),
117
+ /* @__PURE__ */ g(v, { children: `Cols: ${i.cols}` }),
118
+ /* @__PURE__ */ g(v, { children: `Total selected chars: ${i.totalSelectedChars}` }),
119
+ /* @__PURE__ */ g(v, { children: `Alignment: ${n?.sequenceCount ?? "0"} sequences, ${n?.alignmentWidth ?? "0"} positions` })
247
120
  ]
248
121
  })
249
122
  });
250
- }, A = /^(?:\d+|,\d+|\d+,\d+)$/, te = _(({ onActionsChange: e, onClose: t, onGotoPosition: n }) => {
251
- let [r, i] = (0, b.useState)(""), a = (0, b.useRef)(null), o = r === "" || A.test(r);
252
- (0, b.useEffect)(() => {
123
+ }, O = /^(?:\d+|,\d+|\d+,\d+)$/, ee = T(({ onActionsChange: e, onClose: t, onGotoPosition: n }) => {
124
+ let [r, i] = h(""), a = m(null), o = r === "" || O.test(r);
125
+ f(() => {
253
126
  a.current?.focus();
254
127
  }, []);
255
- let s = (0, b.useCallback)((e) => {
128
+ let s = d((e) => {
256
129
  i(e.target.value);
257
- }, []), c = (0, b.useCallback)(() => {
130
+ }, []), c = d(() => {
258
131
  if (!o) return;
259
132
  let [e, i] = r.split(",");
260
133
  n(e ? Number(e) : null, i ? Number(i) : null), t?.();
@@ -263,10 +136,10 @@ var C = class e {
263
136
  t,
264
137
  n,
265
138
  r
266
- ]), l = (0, b.useCallback)((e) => {
139
+ ]), l = d((e) => {
267
140
  e.key === "Enter" && (e.preventDefault(), c());
268
141
  }, [c]);
269
- return (0, b.useEffect)(() => {
142
+ return f(() => {
270
143
  let n = [];
271
144
  n.push({
272
145
  color: "secondary",
@@ -285,7 +158,7 @@ var C = class e {
285
158
  e,
286
159
  t,
287
160
  c
288
- ]), /* @__PURE__ */ (0, k.jsx)(g, {
161
+ ]), /* @__PURE__ */ g(y, {
289
162
  error: !o,
290
163
  fullWidth: !0,
291
164
  helperText: "Use x, ,y, or x,y.",
@@ -301,25 +174,25 @@ var C = class e {
301
174
  fullWidth: !0,
302
175
  maxWidth: "xs",
303
176
  testId: "SequenceEditorGotoPositionDialog"
304
- }), j = () => {
305
- let e = d(l, (e) => e.rawFasta), a = d(l, (e) => e.setLatestMessage), u = d(l, (e) => e.setMeta), f = d(l, (e) => e.setSelection), m = (0, b.useRef)(null), g = (0, b.useMemo)(() => y.getInstance(), []), _ = (0, b.useRef)(null), C = (0, b.useRef)(null), w = (0, b.useRef)(null), E = (0, b.useRef)(null), D = (0, b.useRef)(null), A = (0, b.useRef)(null), [j, ne] = (0, b.useState)({
177
+ }), k = () => {
178
+ let y = c(s, (e) => e.rawFasta), b = c(s, (e) => e.setLatestMessage), T = c(s, (e) => e.setMeta), O = c(s, (e) => e.setSelection), k = m(null), A = p(() => u.getInstance(), []), j = m(null), M = m(null), N = m(null), P = m(null), F = m(null), I = m(null), [L, te] = h({
306
179
  height: 0,
307
180
  width: 0
308
- }), [M, N] = (0, b.useState)(() => T.getInstance().data), [P, re] = (0, b.useState)(0), [ie, ae] = (0, b.useState)(0), F = (0, b.useMemo)(() => new x({
181
+ }), [ne, re] = h(() => C.getInstance().data), [ie, ae] = h(0), [oe, se] = h(0), R = p(() => new S({
309
182
  scrollLeft: 0,
310
183
  scrollTop: 0
311
- }), []), I = (0, b.useRef)(j), L = (0, b.useMemo)(() => new x(null), []), R = (0, b.useMemo)(() => new x(null), []), z = (0, b.useRef)(null), B = (0, b.useRef)(null), V = (0, b.useMemo)(() => new x(r), []), H = (0, b.useMemo)(() => new x(null), []), U = (0, b.useRef)(null), W = (0, b.useRef)(0), G = (0, b.useRef)(null), K = (0, b.useRef)(!1), q = p(), J = (0, b.useCallback)(() => {
312
- let e = V.data, t = L.data;
184
+ }), []), ce = m(L), z = p(() => new S(null), []), B = p(() => new S(null), []), V = m(null), H = m(null), U = p(() => new S(n), []), W = p(() => new S(null), []), G = m(null), K = m(0), q = m(null), J = m(!1), Y = x(), X = d(() => {
185
+ let e = U.data, t = z.data;
313
186
  if (!e || !t) return;
314
187
  let n = e.labelWidth + e.cellWidth + t.alignmentWidth * e.cellWidth, r = e.rulerHeight + t.sequenceCount * e.cellHeight;
315
- ae(n), re(r);
316
- }, [V, L]), Y = (0, b.useCallback)(async () => {
317
- let e = await y.getInstance().getMetaData();
318
- L.next(e);
319
- }, [L]), X = (0, b.useCallback)(() => {
320
- let e = V.data, t = L.data;
188
+ se(n), ae(r);
189
+ }, [U, z]), Z = d(async () => {
190
+ let e = await u.getInstance().getMetaData();
191
+ z.next(e);
192
+ }, [z]), Q = d(() => {
193
+ let e = U.data, t = z.data;
321
194
  if (!t || !e) return;
322
- let { scrollLeft: n, scrollTop: r } = F.data, { height: i, width: a } = I.current, o = c.getVisibleGridRange({
195
+ let { scrollLeft: n, scrollTop: r } = R.data, { height: i, width: a } = ce.current, s = o.getVisibleGridRange({
323
196
  geometry: e,
324
197
  numCols: t.alignmentWidth,
325
198
  numRows: t.sequenceCount,
@@ -328,327 +201,327 @@ var C = class e {
328
201
  viewportHeight: i,
329
202
  viewportWidth: a
330
203
  });
331
- R.next({
204
+ B.next({
332
205
  geometry: e,
333
206
  scrollLeft: n,
334
207
  scrollTop: r,
335
208
  viewportHeight: i,
336
209
  viewportWidth: a,
337
- visibleGridRange: o
210
+ visibleGridRange: s
338
211
  });
339
212
  }, [
340
- V,
341
- L,
342
- F,
343
- R
344
- ]), Z = S((e, t) => {
345
- ne({
213
+ U,
214
+ z,
215
+ R,
216
+ B
217
+ ]), le = E((e, t) => {
218
+ te({
346
219
  height: t,
347
220
  width: e
348
221
  });
349
222
  }, 0, { trailing: !0 });
350
- (0, b.useEffect)(() => {
351
- I.current = j, X();
352
- }, [j, X]);
353
- let Q = j.width > 0 ? j.width / 2 : 120;
354
- (0, b.useEffect)(() => {
355
- let e = [L.subscribe((e) => {
356
- u(e);
357
- }), H.subscribe((e) => {
358
- f(e);
223
+ f(() => {
224
+ ce.current = L, Q();
225
+ }, [L, Q]);
226
+ let $ = L.width > 0 ? L.width / 2 : 120;
227
+ f(() => {
228
+ let e = [z.subscribe((e) => {
229
+ T(e);
230
+ }), W.subscribe((e) => {
231
+ O(e);
359
232
  })];
360
233
  return () => {
361
- e.forEach((e) => e()), a(null), u(null), f(null);
234
+ e.forEach((e) => e()), b(null), T(null), O(null);
362
235
  };
363
236
  }, [
364
- L,
365
- H,
366
- a,
367
- u,
368
- f
369
- ]), (0, b.useEffect)(() => {
370
- if (j.width <= 0) return;
371
- let e = V.data;
372
- e.labelWidth > Q && V.next({
237
+ z,
238
+ W,
239
+ b,
240
+ T,
241
+ O
242
+ ]), f(() => {
243
+ if (L.width <= 0) return;
244
+ let e = U.data;
245
+ e.labelWidth > $ && U.next({
373
246
  ...e,
374
- labelWidth: Q
247
+ labelWidth: $
375
248
  });
376
249
  }, [
377
- j.width,
378
- V,
379
- Q
380
- ]), (0, b.useEffect)(() => {
381
- let e = A.current;
250
+ L.width,
251
+ U,
252
+ $
253
+ ]), f(() => {
254
+ let e = I.current;
382
255
  if (!e) return;
383
256
  let t = new ResizeObserver(([e]) => {
384
257
  if (!e) return;
385
258
  let t = Math.max(1, e.contentRect.height), n = Math.max(1, e.contentRect.width);
386
- Z(n, t);
259
+ le(n, t);
387
260
  });
388
261
  return t.observe(e), () => t.disconnect();
389
- }, [g, Z]), (0, b.useEffect)(() => {
262
+ }, [A, le]), f(() => {
390
263
  (async () => {
391
- z.current = null, B.current = null, F.next({
264
+ V.current = null, H.current = null, R.next({
392
265
  scrollLeft: 0,
393
266
  scrollTop: 0
394
- }), H.next(null), await g.initialize(), await g.loadFasta(e), await Y(), X();
267
+ }), W.next(null), await A.initialize(), await A.loadFasta(y), await Z(), Q();
395
268
  })().catch((e) => {
396
269
  console.error(e);
397
270
  });
398
271
  }, [
399
- g,
400
- e,
401
- F,
402
- H,
403
- Y,
404
- X
405
- ]), (0, b.useEffect)(() => {
272
+ A,
273
+ y,
274
+ R,
275
+ W,
276
+ Z,
277
+ Q
278
+ ]), f(() => {
406
279
  let e = null, t = !0, n = null, r = null, i = async () => {
407
- if (t && !K.current) {
408
- K.current = !0;
280
+ if (t && !J.current) {
281
+ J.current = !0;
409
282
  try {
410
- for (; t && G.current;) {
411
- let i = G.current;
412
- G.current = null;
413
- let a = W.current;
414
- if (!B.current || !c.isWithinGridRange({
415
- cachedGridRange: B.current.range,
283
+ for (; t && q.current;) {
284
+ let i = q.current;
285
+ q.current = null;
286
+ let a = K.current;
287
+ if (!H.current || !o.isWithinGridRange({
288
+ cachedGridRange: H.current.range,
416
289
  visibleGridRange: i.visibleGridRange.visible
417
290
  })) {
418
291
  let e = [];
419
- for (let t = i.visibleGridRange.cache.startRow; t <= i.visibleGridRange.cache.endRow; t++) e.push(await g.name(t));
292
+ for (let t = i.visibleGridRange.cache.startRow; t <= i.visibleGridRange.cache.endRow; t++) e.push(await A.name(t));
420
293
  if (!t) return;
421
- B.current = {
294
+ H.current = {
422
295
  range: i.visibleGridRange.cache,
423
296
  rowNames: e
424
297
  };
425
298
  }
426
- if (!z.current || !c.isWithinGridRange({
427
- cachedGridRange: z.current.range,
299
+ if (!V.current || !o.isWithinGridRange({
300
+ cachedGridRange: V.current.range,
428
301
  visibleGridRange: i.visibleGridRange.visible
429
302
  })) {
430
- let e = await y.getInstance().viewport({
303
+ let e = await u.getInstance().viewport({
431
304
  endCol: i.visibleGridRange.cache.endCol,
432
305
  endRow: i.visibleGridRange.cache.endRow,
433
306
  startCol: i.visibleGridRange.cache.startCol,
434
307
  startRow: i.visibleGridRange.cache.startRow
435
308
  });
436
309
  if (!t) return;
437
- z.current = {
310
+ V.current = {
438
311
  range: i.visibleGridRange.cache,
439
312
  viewportResult: e
440
313
  };
441
314
  }
442
- a === W.current && (e !== null && cancelAnimationFrame(e), e = requestAnimationFrame(() => {
443
- t && a === W.current && _.current && l.getState().nucleotidePalette && z.current && L.data && B.current && (C.current = c.drawCanvas({
444
- canvasElement: _.current,
445
- devicePixelRatio: T.getInstance().data,
315
+ a === K.current && (e !== null && cancelAnimationFrame(e), e = requestAnimationFrame(() => {
316
+ t && a === K.current && j.current && s.getState().nucleotidePalette && V.current && z.data && H.current && (M.current = o.drawCanvas({
317
+ canvasElement: j.current,
318
+ devicePixelRatio: C.getInstance().data,
446
319
  geometry: i.geometry,
447
- meta: L.data,
448
- palette: l.getState().nucleotidePalette,
449
- rowNames: B.current.rowNames,
450
- rowNamesStartRow: B.current.range.startRow,
320
+ meta: z.data,
321
+ palette: s.getState().nucleotidePalette,
322
+ rowNames: H.current.rowNames,
323
+ rowNamesStartRow: H.current.range.startRow,
451
324
  scrollLeft: i.scrollLeft,
452
325
  scrollTop: i.scrollTop,
453
326
  searchResult: n,
454
327
  searchResultHighlightedIndex: r,
455
- selection: H.data,
456
- viewport: z.current.viewportResult,
328
+ selection: W.data,
329
+ viewport: V.current.viewportResult,
457
330
  viewportHeight: i.viewportHeight,
458
331
  viewportWidth: i.viewportWidth
459
332
  }));
460
333
  }));
461
334
  }
462
335
  } finally {
463
- K.current = !1, t && G.current && i();
336
+ J.current = !1, t && q.current && i();
464
337
  }
465
338
  }
466
- }, a = [l.subscribe((e, t) => {
339
+ }, a = [s.subscribe((e, t) => {
467
340
  let i = !1;
468
- e.searchResult !== t.searchResult && (n = e.searchResult, i = !0), e.searchResultHighlightedIndex !== t.searchResultHighlightedIndex && (r = e.searchResultHighlightedIndex, c.scrollToSearchResult({
469
- geometry: V.data,
470
- scrollContainer: A.current,
341
+ e.searchResult !== t.searchResult && (n = e.searchResult, i = !0), e.searchResultHighlightedIndex !== t.searchResultHighlightedIndex && (r = e.searchResultHighlightedIndex, o.scrollToSearchResult({
342
+ geometry: U.data,
343
+ scrollContainer: I.current,
471
344
  searchResult: e.searchResult,
472
345
  searchResultHighlightedIndex: e.searchResultHighlightedIndex
473
- }), i = !0), i && X();
474
- }), R.subscribe((e) => {
475
- e && (G.current = e, W.current += 1, i());
346
+ }), i = !0), i && Q();
347
+ }), B.subscribe((e) => {
348
+ e && (q.current = e, K.current += 1, i());
476
349
  })];
477
350
  return () => {
478
- t = !1, G.current = null, e !== null && cancelAnimationFrame(e), W.current += 1, a.forEach((e) => e());
351
+ t = !1, q.current = null, e !== null && cancelAnimationFrame(e), K.current += 1, a.forEach((e) => e());
479
352
  };
480
353
  }, [
481
- g,
482
- V,
483
- L,
484
- H,
485
- X,
486
- R
487
- ]), (0, b.useEffect)(() => {
354
+ A,
355
+ U,
356
+ z,
357
+ W,
358
+ Q,
359
+ B
360
+ ]), f(() => {
488
361
  let e = [
489
- l.subscribe((e, t) => {
490
- e.nucleotidePalette?.name !== t.nucleotidePalette?.name && X();
362
+ s.subscribe((e, t) => {
363
+ e.nucleotidePalette?.name !== t.nucleotidePalette?.name && Q();
491
364
  }),
492
- V.subscribe(() => {
493
- J(), X();
365
+ U.subscribe(() => {
366
+ X(), Q();
494
367
  }),
495
- F.subscribe(() => X()),
496
- L.subscribe((e) => {
497
- e && (J(), X());
368
+ R.subscribe(() => Q()),
369
+ z.subscribe((e) => {
370
+ e && (X(), Q());
498
371
  }),
499
- H.subscribe(() => X()),
500
- T.getInstance().subscribe((e) => {
501
- N(e), J(), X();
372
+ W.subscribe(() => Q()),
373
+ C.getInstance().subscribe((e) => {
374
+ re(e), X(), Q();
502
375
  })
503
376
  ];
504
377
  return () => {
505
378
  e.forEach((e) => e());
506
379
  };
507
380
  }, [
508
- g,
509
- V,
510
- L,
511
- F,
512
- H,
513
- J,
514
- X
515
- ]), (0, b.useEffect)(() => {
381
+ A,
382
+ U,
383
+ z,
384
+ R,
385
+ W,
386
+ X,
387
+ Q
388
+ ]), f(() => {
516
389
  let e = (e) => {
517
390
  let t = e.key.toUpperCase();
518
- i.has(t) && (e.preventDefault(), o.getInstance().emit("onMutateSelection", t));
519
- }, t = (e) => O.getInstance().registerShortcut({
391
+ r.has(t) && (e.preventDefault(), i.getInstance().emit("onMutateSelection", t));
392
+ }, t = (e) => w.getInstance().registerShortcut({
520
393
  callback: e.callback,
521
- element: D.current,
394
+ element: F.current,
522
395
  ...e.shortcut
523
396
  }), n = [
524
- t(s.expandSelectionLeft),
525
- t(s.expandSelectionRight),
526
- t(s.expandSelectionUp),
527
- t(s.expandSelectionDown),
528
- t(s.moveSelectionLeft),
529
- t(s.moveSelectionRight),
530
- t(s.moveSelectionUp),
531
- t(s.moveSelectionDown),
532
- t(s.moveRowUp),
533
- t(s.moveRowDown),
534
- t(s.moveRowToStart),
535
- t(s.moveRowToEnd),
536
- t(s.moveCellLeft),
537
- t(s.moveCellRight),
538
- t(s.scrollToLineStart),
539
- t(s.scrollToLineEnd),
540
- t(s.scrollPageUp),
541
- t(s.scrollPageDown),
542
- t(s.insertGap),
543
- t(s.deleteBackward),
544
- t(s.deleteSelection),
545
- t(s.deleteBase),
546
- t(s.undo),
547
- t(s.redo),
548
- t(s.gotoPosition),
549
- O.getInstance().registerShortcut({
397
+ t(a.expandSelectionLeft),
398
+ t(a.expandSelectionRight),
399
+ t(a.expandSelectionUp),
400
+ t(a.expandSelectionDown),
401
+ t(a.moveSelectionLeft),
402
+ t(a.moveSelectionRight),
403
+ t(a.moveSelectionUp),
404
+ t(a.moveSelectionDown),
405
+ t(a.moveRowUp),
406
+ t(a.moveRowDown),
407
+ t(a.moveRowToStart),
408
+ t(a.moveRowToEnd),
409
+ t(a.moveCellLeft),
410
+ t(a.moveCellRight),
411
+ t(a.scrollToLineStart),
412
+ t(a.scrollToLineEnd),
413
+ t(a.scrollPageUp),
414
+ t(a.scrollPageDown),
415
+ t(a.insertGap),
416
+ t(a.deleteBackward),
417
+ t(a.deleteSelection),
418
+ t(a.deleteBase),
419
+ t(a.undo),
420
+ t(a.redo),
421
+ t(a.gotoPosition),
422
+ w.getInstance().registerShortcut({
550
423
  callback: e,
551
- element: D.current
424
+ element: F.current
552
425
  }),
553
- O.getInstance().registerShortcut({
426
+ w.getInstance().registerShortcut({
554
427
  callback: e,
555
- element: D.current,
428
+ element: F.current,
556
429
  modifiers: [["Shift"]]
557
430
  })
558
431
  ];
559
432
  return () => {
560
433
  n.forEach((e) => e());
561
434
  };
562
- }, []), (0, b.useEffect)(() => {
563
- let e = async (e) => {
435
+ }, []), f(() => {
436
+ let t = async (e) => {
564
437
  let { command: t, getSelectionPostCommand: n } = e;
565
438
  try {
566
- if (await t(), z.current = null, B.current = null, await Y(), X(), n) {
439
+ if (await t(), V.current = null, H.current = null, await Z(), Q(), n) {
567
440
  let e = n();
568
- H.next(e), U.current = e;
441
+ W.next(e), G.current = e;
569
442
  }
570
443
  } catch (e) {
571
444
  console.error("Failed to post command:", e);
572
445
  }
573
- }, n = async (t) => {
574
- if (!L.data) return;
575
- let n = c.getMutateArguments(H.data, L.data);
576
- n && await e({ command: async () => {
577
- for (let e = n.startCol; e <= n.endCol; e += 1) await g.mutate(n.rows, e, t);
446
+ }, n = async (e) => {
447
+ if (!z.data) return;
448
+ let n = o.getMutateArguments(W.data, z.data);
449
+ n && await t({ command: async () => {
450
+ for (let t = n.startCol; t <= n.endCol; t += 1) await A.mutate(n.rows, t, e);
578
451
  } });
579
452
  }, r = (e) => {
580
- if (!L.data) return;
581
- let t = c.getMovedSelection(H.data, e, L.data);
453
+ if (!z.data) return;
454
+ let t = o.getMovedSelection(W.data, e, z.data);
582
455
  if (t) {
583
- if (H.next(t), U.current) {
584
- let t = c.getMovedSelection(U.current, e, L.data);
585
- U.current = t;
586
- } else U.current = t;
456
+ if (W.next(t), G.current) {
457
+ let t = o.getMovedSelection(G.current, e, z.data);
458
+ G.current = t;
459
+ } else G.current = t;
587
460
  }
588
- }, i = (e) => {
589
- if (!L.data || !U.current || !H.data) return;
590
- let t = c.getExpandedSelection(H.data, U.current, e, L.data);
591
- t && H.next(t);
592
- }, a = async (e) => {}, s = async (n) => {
593
- if (!L.data) return;
594
- let r = c.getRowsToMove(H.data, n, L.data);
595
- r && await e({
461
+ }, a = (e) => {
462
+ if (!z.data || !G.current || !W.data) return;
463
+ let t = o.getExpandedSelection(W.data, G.current, e, z.data);
464
+ t && W.next(t);
465
+ }, c = async (e) => {}, l = async (n) => {
466
+ if (!z.data) return;
467
+ let r = o.getRowsToMove(W.data, n, z.data);
468
+ r && await t({
596
469
  command: async () => {
597
- n === t.UP ? await g.moveRowsUp(r) : await g.moveRowsDown(r);
470
+ n === e.UP ? await A.moveRowsUp(r) : await A.moveRowsDown(r);
598
471
  },
599
- getSelectionPostCommand: () => c.getMovedSelection(H.data, n, L.data)
472
+ getSelectionPostCommand: () => o.getMovedSelection(W.data, n, z.data)
600
473
  });
601
- }, u = async (e) => {}, d = o.getInstance(), f = [
474
+ }, u = async (e) => {}, d = i.getInstance(), f = [
602
475
  d.addEventListener("onSearch", async (e) => {
603
476
  if (!e) return;
604
- let t = await g.search(e, !1);
605
- l.getState().setSearchResult(t);
477
+ let t = await A.search(e, !1);
478
+ s.getState().setSearchResult(t);
606
479
  }),
607
- d.addEventListener("onExpandSelection", (e) => i(e)),
608
- d.addEventListener("onGotoPosition", () => m.current?.open({})),
480
+ d.addEventListener("onExpandSelection", (e) => a(e)),
481
+ d.addEventListener("onGotoPosition", () => k.current?.open({})),
609
482
  d.addEventListener("onMoveSelection", (e) => r(e)),
610
483
  d.addEventListener("onMoveRows", (e) => {
611
- s(e);
484
+ l(e);
612
485
  }),
613
486
  d.addEventListener("onMoveRowsEnd", (e) => {
614
- a(e);
487
+ c(e);
615
488
  }),
616
489
  d.addEventListener("onMoveCells", (e) => {
617
490
  u(e);
618
491
  }),
619
492
  d.addEventListener("onScrollToLineStart", () => {
620
- let e = A.current;
493
+ let e = I.current;
621
494
  e && (e.scrollLeft = 0);
622
495
  }),
623
496
  d.addEventListener("onScrollToLineEnd", () => {
624
- let e = A.current;
497
+ let e = I.current;
625
498
  e && (e.scrollLeft = e.scrollWidth - e.clientWidth);
626
499
  }),
627
500
  d.addEventListener("onScrollPageUp", () => {
628
- let e = A.current;
501
+ let e = I.current;
629
502
  e && (e.scrollTop = Math.max(0, e.scrollTop - e.clientHeight));
630
503
  }),
631
504
  d.addEventListener("onScrollPageDown", () => {
632
- let e = A.current;
505
+ let e = I.current;
633
506
  e && (e.scrollTop = Math.min(e.scrollHeight - e.clientHeight, e.scrollTop + e.clientHeight));
634
507
  }),
635
508
  d.addEventListener("onInsert", () => {
636
509
  (async () => {
637
- if (!L.data) return;
638
- let n = c.getUpsertArguments(H.data, L.data);
639
- n && await e({
640
- command: async () => g.insert(n.rows, n.col),
641
- getSelectionPostCommand: () => c.getPostUpsertSelection(H.data, t.RIGHT)
510
+ if (!z.data) return;
511
+ let n = o.getUpsertArguments(W.data, z.data);
512
+ n && await t({
513
+ command: async () => A.insert(n.rows, n.col),
514
+ getSelectionPostCommand: () => o.getPostUpsertSelection(W.data, e.RIGHT)
642
515
  });
643
516
  })();
644
517
  }),
645
518
  d.addEventListener("onDeleteBackward", () => {
646
519
  (async () => {
647
- if (!L.data) return;
648
- let n = c.getUpsertArguments(H.data, L.data, -1);
649
- n && await e({
650
- command: async () => g.delete(n.rows, n.col),
651
- getSelectionPostCommand: () => c.getPostUpsertSelection(H.data, t.LEFT)
520
+ if (!z.data) return;
521
+ let n = o.getUpsertArguments(W.data, z.data, -1);
522
+ n && await t({
523
+ command: async () => A.delete(n.rows, n.col),
524
+ getSelectionPostCommand: () => o.getPostUpsertSelection(W.data, e.LEFT)
652
525
  });
653
526
  })();
654
527
  }),
@@ -656,14 +529,14 @@ var C = class e {
656
529
  n(e);
657
530
  }),
658
531
  d.addEventListener("onUndo", () => {
659
- e({
660
- command: async () => g.undo(),
532
+ t({
533
+ command: async () => A.undo(),
661
534
  getSelectionPostCommand: () => null
662
535
  });
663
536
  }),
664
537
  d.addEventListener("onRedo", () => {
665
- e({
666
- command: async () => g.redo(),
538
+ t({
539
+ command: async () => A.redo(),
667
540
  getSelectionPostCommand: () => null
668
541
  });
669
542
  })
@@ -672,113 +545,107 @@ var C = class e {
672
545
  f.forEach((e) => e());
673
546
  };
674
547
  }, [
675
- g,
676
- H,
677
- Y,
678
- X,
679
- L
680
- ]), (0, b.useEffect)(() => {
681
- X();
682
- }, [X]);
683
- let oe = (0, b.useCallback)((e) => {
548
+ A,
549
+ W,
550
+ Z,
551
+ Q,
552
+ z
553
+ ]), f(() => {
554
+ Q();
555
+ }, [Q]);
556
+ let ue = d((e) => {
684
557
  let t = e.currentTarget;
685
- F.next({
558
+ R.next({
686
559
  scrollLeft: t.scrollLeft,
687
560
  scrollTop: t.scrollTop
688
561
  });
689
- }, [F]), se = (0, b.useCallback)((e) => {
690
- D.current?.focus();
691
- let t = e.currentTarget, r = t.getBoundingClientRect(), i = e.clientX >= r.left + t.clientWidth, a = e.clientY >= r.top + t.clientHeight;
562
+ }, [R]), de = d((e) => {
563
+ F.current?.focus();
564
+ let n = e.currentTarget, r = n.getBoundingClientRect(), i = e.clientX >= r.left + n.clientWidth, a = e.clientY >= r.top + n.clientHeight;
692
565
  if (i || a) return;
693
- let o = _.current, s = C.current, l = T.getInstance().data;
694
- if (!o || !s) return;
695
- let u = c.getPathPropertiesFromCanvas({
696
- canvas: o,
566
+ let s = j.current, c = M.current, l = C.getInstance().data;
567
+ if (!s || !c) return;
568
+ let u = o.getPathPropertiesFromCanvas({
569
+ canvas: s,
697
570
  devicePixelRatio: l,
698
- editorAssembly: s,
571
+ editorAssembly: c,
699
572
  event: e.nativeEvent
700
573
  });
701
574
  if (u) {
702
- if (u.type !== n.DIVIDER) {
703
- if (u.type === n.LABEL && (e.metaKey || e.ctrlKey)) {
704
- let t = H.data?.rows ?? [], n = t.includes(u.row) ? t.filter((e) => e !== u.row) : [...t, u.row].sort((e, t) => e - t);
705
- if (e.preventDefault(), E.current = null, n.length === 0) {
706
- H.next(null), U.current = null;
575
+ if (u.type !== t.DIVIDER) {
576
+ if (u.type === t.LABEL && (e.metaKey || e.ctrlKey)) {
577
+ let t = W.data?.rows ?? [], n = t.includes(u.row) ? t.filter((e) => e !== u.row) : [...t, u.row].sort((e, t) => e - t);
578
+ if (e.preventDefault(), P.current = null, n.length === 0) {
579
+ W.next(null), G.current = null;
707
580
  return;
708
581
  }
709
- H.next({ rows: n }), U.current = { rows: n };
582
+ W.next({ rows: n }), G.current = { rows: n };
710
583
  return;
711
584
  }
712
- let t = c.getSelectionFromPathProperties({
585
+ let n = o.getSelectionFromPathProperties({
713
586
  endPath: u,
714
587
  startPath: u
715
588
  });
716
- if (!t) return;
717
- e.preventDefault(), E.current = u, H.next(t), U.current = t;
718
- return;
719
- }
720
- e.preventDefault(), E.current = null, w.current = {
721
- startLabelWidth: V.data.labelWidth,
589
+ if (!n) return;
590
+ e.preventDefault(), P.current = u, W.next(n), G.current = n;
591
+ } else e.preventDefault(), P.current = null, N.current = {
592
+ startLabelWidth: U.data.labelWidth,
722
593
  startX: e.clientX
723
594
  };
724
595
  }
725
- }, [V, H]), ce = (0, b.useCallback)((e) => {
726
- let t = _.current, r = D.current, i = T.getInstance().data, a = w.current;
727
- if (!r || !t) return;
596
+ }, [U, W]), fe = d((e) => {
597
+ let n = j.current, r = F.current, i = C.getInstance().data, a = N.current;
598
+ if (!r || !n) return;
728
599
  if (a) {
729
- let t = Math.min(Q, Math.max(120, a.startLabelWidth + e.clientX - a.startX));
730
- V.next({
731
- ...V.data,
600
+ let t = Math.min($, Math.max(120, a.startLabelWidth + e.clientX - a.startX));
601
+ U.next({
602
+ ...U.data,
732
603
  labelWidth: t
733
604
  }), r.style.cursor = "col-resize";
734
605
  return;
735
606
  }
736
- let o = E.current;
737
- if (o) {
738
- let n = C.current;
739
- if (!n) return;
740
- let r = c.getPathPropertiesFromCanvas({
741
- canvas: t,
607
+ let s = P.current;
608
+ if (s) {
609
+ let t = M.current;
610
+ if (!t) return;
611
+ let r = o.getPathPropertiesFromCanvas({
612
+ canvas: n,
742
613
  devicePixelRatio: i,
743
- editorAssembly: n,
614
+ editorAssembly: t,
744
615
  event: e.nativeEvent
745
616
  });
746
617
  if (!r) return;
747
- let a = c.getSelectionFromPathProperties({
618
+ let a = o.getSelectionFromPathProperties({
748
619
  endPath: r,
749
- startPath: o
620
+ startPath: s
750
621
  });
751
- a && (H.next(a), U.current = a);
622
+ a && (W.next(a), G.current = a);
752
623
  return;
753
624
  }
754
- let s = C.current;
755
- if (!s) return;
756
- let l = c.getPathPropertiesFromCanvas({
757
- canvas: t,
625
+ let c = M.current;
626
+ if (!c) return;
627
+ let l = o.getPathPropertiesFromCanvas({
628
+ canvas: n,
758
629
  devicePixelRatio: i,
759
- editorAssembly: s,
630
+ editorAssembly: c,
760
631
  event: e.nativeEvent
761
632
  });
762
- if (!l) {
763
- r.style.cursor = "default";
764
- return;
765
- }
766
- l.type === n.DIVIDER ? r.style.cursor = "col-resize" : r.style.cursor = "default";
633
+ l && l.type === t.DIVIDER ? r.style.cursor = "col-resize" : r.style.cursor = "default";
767
634
  }, [
768
- V,
769
- Q,
770
- H
771
- ]), le = (0, b.useCallback)(() => {
772
- w.current = null, E.current = null;
773
- }, []), $ = (0, b.useCallback)((e, t) => {
774
- c.scrollToPosition({
775
- geometry: V.data,
776
- scrollContainer: A.current,
635
+ U,
636
+ $,
637
+ W
638
+ ]), pe = d(() => {
639
+ N.current = null, P.current = null;
640
+ }, []), me = d((e, t) => {
641
+ o.scrollToPosition({
642
+ geometry: U.data,
643
+ scrollContainer: I.current,
777
644
  x: e,
778
645
  y: t
779
646
  });
780
- }, [V]), ue = Math.max(1, Math.floor(j.width * M)), de = Math.max(1, Math.floor(j.height * M));
781
- return /* @__PURE__ */ (0, k.jsxs)(h, {
647
+ }, [U]), he = Math.max(1, Math.floor(L.width * ne)), ge = Math.max(1, Math.floor(L.height * ne));
648
+ return /* @__PURE__ */ _(v, {
782
649
  sx: {
783
650
  display: "grid",
784
651
  gridTemplateRows: "max-content auto",
@@ -787,23 +654,23 @@ var C = class e {
787
654
  width: "100%"
788
655
  },
789
656
  children: [
790
- /* @__PURE__ */ (0, k.jsx)(v, {}),
791
- /* @__PURE__ */ (0, k.jsxs)(h, {
792
- onMouseUp: le,
793
- ref: D,
657
+ /* @__PURE__ */ g(l, {}),
658
+ /* @__PURE__ */ _(v, {
659
+ onMouseUp: pe,
660
+ ref: F,
794
661
  sx: {
795
- height: `calc(100% - ${q.spacing(3)})`,
796
- marginBottom: q.spacing(3),
662
+ height: `calc(100% - ${Y.spacing(3)})`,
663
+ marginBottom: Y.spacing(3),
797
664
  position: "relative",
798
665
  width: "100%"
799
666
  },
800
667
  tabIndex: 0,
801
668
  children: [
802
- /* @__PURE__ */ (0, k.jsx)(h, {
803
- onMouseDown: se,
804
- onMouseMove: ce,
805
- onScroll: oe,
806
- ref: A,
669
+ /* @__PURE__ */ g(v, {
670
+ onMouseDown: de,
671
+ onMouseMove: fe,
672
+ onScroll: ue,
673
+ ref: I,
807
674
  sx: {
808
675
  height: "100%",
809
676
  overflowX: "scroll",
@@ -812,49 +679,49 @@ var C = class e {
812
679
  width: "100%",
813
680
  zIndex: 1
814
681
  },
815
- children: /* @__PURE__ */ (0, k.jsx)(h, { sx: {
816
- height: `${Math.max(P, j.height)}px`,
682
+ children: /* @__PURE__ */ g(v, { sx: {
683
+ height: `${Math.max(ie, L.height)}px`,
817
684
  pointerEvents: "none",
818
- width: `${Math.max(ie, j.width)}px`
685
+ width: `${Math.max(oe, L.width)}px`
819
686
  } })
820
687
  }),
821
- /* @__PURE__ */ (0, k.jsx)("canvas", {
822
- height: de,
823
- ref: _,
688
+ /* @__PURE__ */ g("canvas", {
689
+ height: ge,
690
+ ref: j,
824
691
  style: {
825
692
  display: "block",
826
- height: `${j.height}px`,
693
+ height: `${L.height}px`,
827
694
  imageRendering: "pixelated",
828
695
  left: 0,
829
696
  pointerEvents: "auto",
830
697
  position: "absolute",
831
698
  top: 0,
832
- width: `${j.width}px`,
699
+ width: `${L.width}px`,
833
700
  zIndex: 0
834
701
  },
835
- width: ue
702
+ width: he
836
703
  }),
837
- /* @__PURE__ */ (0, k.jsx)(h, {
704
+ /* @__PURE__ */ g(v, {
838
705
  sx: {
839
- bottom: q.spacing(-3),
840
- height: q.spacing(3),
706
+ bottom: Y.spacing(-3),
707
+ height: Y.spacing(3),
841
708
  left: 0,
842
709
  position: "absolute",
843
710
  width: "100%",
844
711
  zIndex: 2
845
712
  },
846
- children: /* @__PURE__ */ (0, k.jsx)(ee, {})
713
+ children: /* @__PURE__ */ g(D, {})
847
714
  })
848
715
  ]
849
716
  }),
850
- /* @__PURE__ */ (0, k.jsx)(te, {
851
- onGotoPosition: $,
852
- ref: m
717
+ /* @__PURE__ */ g(ee, {
718
+ onGotoPosition: me,
719
+ ref: k
853
720
  })
854
721
  ]
855
722
  });
856
723
  };
857
724
  //#endregion
858
- export { C as n, j as t };
725
+ export { k as t };
859
726
 
860
727
  //# sourceMappingURL=SequenceEditor.js.map