@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,48 +1,46 @@
1
- import { DEFAULT_GRID_GEOMETRY as e } from "../../constants/editor.js";
2
- import { EDITOR_DIRECTION as t, EDITOR_PATH_PROPERTIES_TYPE as n, MATRIX_TYPE as r } from "../../models/editor.models.js";
3
- import { PaletteUtil as i } from "../PaletteUtil/index.js";
1
+ import { StringUtil as e } from "@gen-epix/ui-core/utils/StringUtil";
2
+ import { FastaUtil as t } from "@rivm-loculus-tools/common-frontend/utils/FastaUtil";
3
+ import { EDITOR_DIRECTION as n, EDITOR_PATH_PROPERTIES_TYPE as r, MATRIX_TYPE as i, READING_MODE as a } from "../../models/editor.models.js";
4
+ import { DEFAULT_GRID_GEOMETRY as o } from "../../constants/editor.js";
5
+ import { PaletteUtil as s } from "../PaletteUtil/index.js";
4
6
  import "../../constants/index.js";
5
- import { StringUtil as a } from "@gen-epix/ui-core/utils/StringUtil";
6
- import { FastaUtil as o } from "@rivm-loculus-tools/common-frontend/utils/FastaUtil";
7
7
  // \0rolldown/runtime.js
8
- var s = Object.create, c = Object.defineProperty, l = Object.getOwnPropertyDescriptor, u = Object.getOwnPropertyNames, d = Object.getPrototypeOf, f = Object.prototype.hasOwnProperty, p = (e, t) => () => (t || (e((t = { exports: {} }).exports, t, t.exports), e = null), t.exports), m = (e, t, n, r) => {
9
- if (t && typeof t == "object" || typeof t == "function") for (var i = u(t), a = 0, o = i.length, s; a < o; a++) s = i[a], !f.call(e, s) && s !== n && c(e, s, {
8
+ var c = Object.create, l = Object.defineProperty, u = Object.getOwnPropertyDescriptor, d = Object.getOwnPropertyNames, f = Object.getPrototypeOf, p = Object.prototype.hasOwnProperty, m = (e, t) => () => (t || (e((t = { exports: {} }).exports, t, t.exports), e = null), t.exports), h = (e, t, n, r) => {
9
+ if (t && typeof t == "object" || typeof t == "function") for (var i = d(t), a = 0, o = i.length, s; a < o; a++) s = i[a], !p.call(e, s) && s !== n && l(e, s, {
10
10
  get: ((e) => t[e]).bind(null, s),
11
- enumerable: !(r = l(t, s)) || r.enumerable
11
+ enumerable: !(r = u(t, s)) || r.enumerable
12
12
  });
13
13
  return e;
14
- }, h = (e, t, n) => (n = e == null ? {} : s(d(e)), m(t || !e || !e.__esModule || !f.call(e, "default") ? c(n, "default", {
14
+ }, g = (e, t, n) => (n = e == null ? {} : c(f(e)), h(t || !e || !e.__esModule || !p.call(e, "default") ? l(n, "default", {
15
15
  value: e,
16
16
  enumerable: !0
17
- }) : n, e)), g = /* @__PURE__ */ p(((e, t) => {
17
+ }) : n, e)), _ = /* @__PURE__ */ m(((e, t) => {
18
18
  var n = Math.floor;
19
- function r(e, t) {
19
+ t.exports = function(e, t) {
20
20
  var r = "";
21
- if (!e || t < 1 || t > 9007199254740991) return r;
21
+ if (!e || t < 1 || t > 0x1fffffffffffff) return r;
22
22
  do
23
23
  t % 2 && (r += e), t = n(t / 2), t && (e += e);
24
24
  while (t);
25
25
  return r;
26
- }
27
- t.exports = r;
28
- })), _ = /* @__PURE__ */ p(((e, t) => {
26
+ };
27
+ })), v = /* @__PURE__ */ m(((e, t) => {
29
28
  t.exports = typeof global == "object" && global && global.Object === Object && global;
30
- })), v = /* @__PURE__ */ p(((e, t) => {
31
- var n = _(), r = typeof self == "object" && self && self.Object === Object && self;
29
+ })), y = /* @__PURE__ */ m(((e, t) => {
30
+ var n = v(), r = typeof self == "object" && self && self.Object === Object && self;
32
31
  t.exports = n || r || Function("return this")();
33
- })), y = /* @__PURE__ */ p(((e, t) => {
34
- t.exports = v().Symbol;
35
- })), b = /* @__PURE__ */ p(((e, t) => {
36
- function n(e, t) {
32
+ })), b = /* @__PURE__ */ m(((e, t) => {
33
+ t.exports = y().Symbol;
34
+ })), x = /* @__PURE__ */ m(((e, t) => {
35
+ t.exports = function(e, t) {
37
36
  for (var n = -1, r = e == null ? 0 : e.length, i = Array(r); ++n < r;) i[n] = t(e[n], n, e);
38
37
  return i;
39
- }
40
- t.exports = n;
41
- })), x = /* @__PURE__ */ p(((e, t) => {
38
+ };
39
+ })), S = /* @__PURE__ */ m(((e, t) => {
42
40
  t.exports = Array.isArray;
43
- })), S = /* @__PURE__ */ p(((e, t) => {
44
- var n = y(), r = Object.prototype, i = r.hasOwnProperty, a = r.toString, o = n ? n.toStringTag : void 0;
45
- function s(e) {
41
+ })), C = /* @__PURE__ */ m(((e, t) => {
42
+ var n = b(), r = Object.prototype, i = r.hasOwnProperty, a = r.toString, o = n ? n.toStringTag : void 0;
43
+ t.exports = function(e) {
46
44
  var t = i.call(e, o), n = e[o];
47
45
  try {
48
46
  e[o] = void 0;
@@ -50,33 +48,28 @@ var s = Object.create, c = Object.defineProperty, l = Object.getOwnPropertyDescr
50
48
  } catch {}
51
49
  var s = a.call(e);
52
50
  return r && (t ? e[o] = n : delete e[o]), s;
53
- }
54
- t.exports = s;
55
- })), C = /* @__PURE__ */ p(((e, t) => {
51
+ };
52
+ })), w = /* @__PURE__ */ m(((e, t) => {
56
53
  var n = Object.prototype.toString;
57
- function r(e) {
54
+ t.exports = function(e) {
58
55
  return n.call(e);
59
- }
60
- t.exports = r;
61
- })), w = /* @__PURE__ */ p(((e, t) => {
62
- var n = y(), r = S(), i = C(), a = "[object Null]", o = "[object Undefined]", s = n ? n.toStringTag : void 0;
63
- function c(e) {
56
+ };
57
+ })), T = /* @__PURE__ */ m(((e, t) => {
58
+ var n = b(), r = C(), i = w(), a = "[object Null]", o = "[object Undefined]", s = n ? n.toStringTag : void 0;
59
+ t.exports = function(e) {
64
60
  return e == null ? e === void 0 ? o : a : s && s in Object(e) ? r(e) : i(e);
65
- }
66
- t.exports = c;
67
- })), T = /* @__PURE__ */ p(((e, t) => {
68
- function n(e) {
61
+ };
62
+ })), E = /* @__PURE__ */ m(((e, t) => {
63
+ t.exports = function(e) {
69
64
  return typeof e == "object" && !!e;
70
- }
71
- t.exports = n;
72
- })), E = /* @__PURE__ */ p(((e, t) => {
73
- var n = w(), r = T(), i = "[object Symbol]";
74
- function a(e) {
65
+ };
66
+ })), D = /* @__PURE__ */ m(((e, t) => {
67
+ var n = T(), r = E(), i = "[object Symbol]";
68
+ t.exports = function(e) {
75
69
  return typeof e == "symbol" || r(e) && n(e) == i;
76
- }
77
- t.exports = a;
78
- })), D = /* @__PURE__ */ p(((e, t) => {
79
- var n = y(), r = b(), i = x(), a = E(), o = 1 / 0, s = n ? n.prototype : void 0, c = s ? s.toString : void 0;
70
+ };
71
+ })), O = /* @__PURE__ */ m(((e, t) => {
72
+ var n = b(), r = x(), i = S(), a = D(), o = 1 / 0, s = n ? n.prototype : void 0, c = s ? s.toString : void 0;
80
73
  function l(e) {
81
74
  if (typeof e == "string") return e;
82
75
  if (i(e)) return r(e, l) + "";
@@ -85,37 +78,33 @@ var s = Object.create, c = Object.defineProperty, l = Object.getOwnPropertyDescr
85
78
  return t == "0" && 1 / e == -o ? "-0" : t;
86
79
  }
87
80
  t.exports = l;
88
- })), O = /* @__PURE__ */ p(((e, t) => {
89
- function n(e, t, n) {
81
+ })), k = /* @__PURE__ */ m(((e, t) => {
82
+ t.exports = function(e, t, n) {
90
83
  var r = -1, i = e.length;
91
84
  t < 0 && (t = -t > i ? 0 : i + t), n = n > i ? i : n, n < 0 && (n += i), i = t > n ? 0 : n - t >>> 0, t >>>= 0;
92
85
  for (var a = Array(i); ++r < i;) a[r] = e[r + t];
93
86
  return a;
94
- }
95
- t.exports = n;
96
- })), k = /* @__PURE__ */ p(((e, t) => {
97
- var n = O();
98
- function r(e, t, r) {
87
+ };
88
+ })), A = /* @__PURE__ */ m(((e, t) => {
89
+ var n = k();
90
+ t.exports = function(e, t, r) {
99
91
  var i = e.length;
100
92
  return r = r === void 0 ? i : r, !t && r >= i ? e : n(e, t, r);
101
- }
102
- t.exports = r;
103
- })), A = /* @__PURE__ */ p(((e, t) => {
93
+ };
94
+ })), j = /* @__PURE__ */ m(((e, t) => {
104
95
  var n = RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");
105
- function r(e) {
96
+ t.exports = function(e) {
106
97
  return n.test(e);
107
- }
108
- t.exports = r;
109
- })), j = /* @__PURE__ */ p(((e, t) => {
110
- function n(e) {
98
+ };
99
+ })), M = /* @__PURE__ */ m(((e, t) => {
100
+ t.exports = function(e) {
111
101
  return function(t) {
112
102
  return t?.[e];
113
103
  };
114
- }
115
- t.exports = n;
116
- })), M = /* @__PURE__ */ p(((e, t) => {
117
- t.exports = j()("length");
118
- })), N = /* @__PURE__ */ p(((e, t) => {
104
+ };
105
+ })), N = /* @__PURE__ */ m(((e, t) => {
106
+ t.exports = M()("length");
107
+ })), P = /* @__PURE__ */ m(((e, t) => {
119
108
  var n = "\\ud800-\\udfff", r = "\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff", i = "\\ufe0e\\ufe0f", a = "[" + n + "]", o = "[" + r + "]", s = "\\ud83c[\\udffb-\\udfff]", c = "(?:" + o + "|" + s + ")", l = "[^" + n + "]", u = "(?:\\ud83c[\\udde6-\\uddff]){2}", d = "[\\ud800-\\udbff][\\udc00-\\udfff]", f = "\\u200d", p = c + "?", m = "[" + i + "]?", h = "(?:" + f + "(?:" + [
120
109
  l,
121
110
  u,
@@ -127,23 +116,20 @@ var s = Object.create, c = Object.defineProperty, l = Object.getOwnPropertyDescr
127
116
  d,
128
117
  a
129
118
  ].join("|") + ")", v = RegExp(s + "(?=" + s + ")|" + _ + g, "g");
130
- function y(e) {
119
+ t.exports = function(e) {
131
120
  for (var t = v.lastIndex = 0; v.test(e);) ++t;
132
121
  return t;
133
- }
134
- t.exports = y;
135
- })), P = /* @__PURE__ */ p(((e, t) => {
136
- var n = M(), r = A(), i = N();
137
- function a(e) {
122
+ };
123
+ })), F = /* @__PURE__ */ m(((e, t) => {
124
+ var n = N(), r = j(), i = P();
125
+ t.exports = function(e) {
138
126
  return r(e) ? i(e) : n(e);
139
- }
140
- t.exports = a;
141
- })), F = /* @__PURE__ */ p(((e, t) => {
142
- function n(e) {
127
+ };
128
+ })), I = /* @__PURE__ */ m(((e, t) => {
129
+ t.exports = function(e) {
143
130
  return e.split("");
144
- }
145
- t.exports = n;
146
- })), I = /* @__PURE__ */ p(((e, t) => {
131
+ };
132
+ })), L = /* @__PURE__ */ m(((e, t) => {
147
133
  var n = "\\ud800-\\udfff", r = "\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff", i = "\\ufe0e\\ufe0f", a = "[" + n + "]", o = "[" + r + "]", s = "\\ud83c[\\udffb-\\udfff]", c = "(?:" + o + "|" + s + ")", l = "[^" + n + "]", u = "(?:\\ud83c[\\udde6-\\uddff]){2}", d = "[\\ud800-\\udbff][\\udc00-\\udfff]", f = "\\u200d", p = c + "?", m = "[" + i + "]?", h = "(?:" + f + "(?:" + [
148
134
  l,
149
135
  u,
@@ -155,48 +141,42 @@ var s = Object.create, c = Object.defineProperty, l = Object.getOwnPropertyDescr
155
141
  d,
156
142
  a
157
143
  ].join("|") + ")", v = RegExp(s + "(?=" + s + ")|" + _ + g, "g");
158
- function y(e) {
144
+ t.exports = function(e) {
159
145
  return e.match(v) || [];
160
- }
161
- t.exports = y;
162
- })), L = /* @__PURE__ */ p(((e, t) => {
163
- var n = F(), r = A(), i = I();
164
- function a(e) {
146
+ };
147
+ })), R = /* @__PURE__ */ m(((e, t) => {
148
+ var n = I(), r = j(), i = L();
149
+ t.exports = function(e) {
165
150
  return r(e) ? i(e) : n(e);
166
- }
167
- t.exports = a;
168
- })), R = /* @__PURE__ */ p(((e, t) => {
169
- var n = g(), r = D(), i = k(), a = A(), o = P(), s = L(), c = Math.ceil;
170
- function l(e, t) {
151
+ };
152
+ })), z = /* @__PURE__ */ m(((e, t) => {
153
+ var n = _(), r = O(), i = A(), a = j(), o = F(), s = R(), c = Math.ceil;
154
+ t.exports = function(e, t) {
171
155
  t = t === void 0 ? " " : r(t);
172
156
  var l = t.length;
173
157
  if (l < 2) return l ? n(t, e) : t;
174
158
  var u = n(t, c(e / o(t)));
175
159
  return a(t) ? i(s(u), 0, e).join("") : u.slice(0, e);
176
- }
177
- t.exports = l;
178
- })), z = /* @__PURE__ */ p(((e, t) => {
160
+ };
161
+ })), B = /* @__PURE__ */ m(((e, t) => {
179
162
  var n = /\s/;
180
- function r(e) {
163
+ t.exports = function(e) {
181
164
  for (var t = e.length; t-- && n.test(e.charAt(t)););
182
165
  return t;
183
- }
184
- t.exports = r;
185
- })), B = /* @__PURE__ */ p(((e, t) => {
186
- var n = z(), r = /^\s+/;
187
- function i(e) {
166
+ };
167
+ })), V = /* @__PURE__ */ m(((e, t) => {
168
+ var n = B(), r = /^\s+/;
169
+ t.exports = function(e) {
188
170
  return e && e.slice(0, n(e) + 1).replace(r, "");
189
- }
190
- t.exports = i;
191
- })), V = /* @__PURE__ */ p(((e, t) => {
192
- function n(e) {
171
+ };
172
+ })), H = /* @__PURE__ */ m(((e, t) => {
173
+ t.exports = function(e) {
193
174
  var t = typeof e;
194
175
  return e != null && (t == "object" || t == "function");
195
- }
196
- t.exports = n;
197
- })), H = /* @__PURE__ */ p(((e, t) => {
198
- var n = B(), r = V(), i = E(), a = NaN, o = /^[-+]0x[0-9a-f]+$/i, s = /^0b[01]+$/i, c = /^0o[0-7]+$/i, l = parseInt;
199
- function u(e) {
176
+ };
177
+ })), U = /* @__PURE__ */ m(((e, t) => {
178
+ var n = V(), r = H(), i = D(), a = NaN, o = /^[-+]0x[0-9a-f]+$/i, s = /^0b[01]+$/i, c = /^0o[0-7]+$/i, l = parseInt;
179
+ t.exports = function(e) {
200
180
  if (typeof e == "number") return e;
201
181
  if (i(e)) return a;
202
182
  if (r(e)) {
@@ -207,152 +187,164 @@ var s = Object.create, c = Object.defineProperty, l = Object.getOwnPropertyDescr
207
187
  e = n(e);
208
188
  var u = s.test(e);
209
189
  return u || c.test(e) ? l(e.slice(2), u ? 2 : 8) : o.test(e) ? a : +e;
210
- }
211
- t.exports = u;
212
- })), U = /* @__PURE__ */ p(((e, t) => {
213
- var n = H(), r = 1 / 0, i = 17976931348623157e292;
214
- function a(e) {
190
+ };
191
+ })), W = /* @__PURE__ */ m(((e, t) => {
192
+ var n = U(), r = 1 / 0, i = 17976931348623157e292;
193
+ t.exports = function(e) {
215
194
  return e ? (e = n(e), e === r || e === -r ? (e < 0 ? -1 : 1) * i : e === e ? e : 0) : e === 0 ? e : 0;
216
- }
217
- t.exports = a;
218
- })), W = /* @__PURE__ */ p(((e, t) => {
219
- var n = U();
220
- function r(e) {
195
+ };
196
+ })), G = /* @__PURE__ */ m(((e, t) => {
197
+ var n = W();
198
+ t.exports = function(e) {
221
199
  var t = n(e), r = t % 1;
222
200
  return t === t ? r ? t - r : t : 0;
223
- }
224
- t.exports = r;
225
- })), G = /* @__PURE__ */ p(((e, t) => {
226
- var n = D();
227
- function r(e) {
201
+ };
202
+ })), K = /* @__PURE__ */ m(((e, t) => {
203
+ var n = O();
204
+ t.exports = function(e) {
228
205
  return e == null ? "" : n(e);
229
- }
230
- t.exports = r;
231
- })), K = /* @__PURE__ */ h((/* @__PURE__ */ p(((e, t) => {
232
- var n = R(), r = P(), i = W(), a = G();
233
- function o(e, t, o) {
206
+ };
207
+ })), q = /* @__PURE__ */ g((/* @__PURE__ */ m(((e, t) => {
208
+ var n = z(), r = F(), i = G(), a = K();
209
+ t.exports = function(e, t, o) {
234
210
  e = a(e), t = i(t);
235
211
  var s = t ? r(e) : 0;
236
212
  return t && s < t ? n(t - s, o) + e : e;
237
- }
238
- t.exports = o;
239
- })))(), 1), q = class s {
240
- static drawCanvas({ canvasElement: e, devicePixelRatio: t, geometry: a, meta: o, palette: c, rowNames: l, rowNamesStartRow: u, scrollLeft: d, scrollTop: f, searchResult: p, searchResultHighlightedIndex: m, selection: h, viewport: g, viewportHeight: _, viewportWidth: v }) {
241
- let y = {
213
+ };
214
+ })))(), 1), J = class c {
215
+ static drawCanvas({ aminoAcidPalette: e, canvasElement: t, devicePixelRatio: n, geometry: a, meta: o, nucleotidePalette: s, readingFrame: l, readingMode: u, rowNames: d, rowNamesStartRow: f, scrollLeft: p, scrollTop: m, searchResult: h, searchResultHighlightedIndex: g, selection: _, viewport: v, viewportHeight: y, viewportWidth: b }) {
216
+ let x = {
242
217
  cells: { pathPropertiesMap: /* @__PURE__ */ new Map() },
243
218
  divider: { pathPropertiesMap: /* @__PURE__ */ new Map() },
244
219
  labels: { pathPropertiesMap: /* @__PURE__ */ new Map() },
245
220
  ruler: { pathPropertiesMap: /* @__PURE__ */ new Map() }
246
221
  };
247
- if (!e) return y;
248
- let b = e.getContext("2d");
249
- if (!b) return y;
250
- let x = o.sequenceCount.toString().length, S = (e) => h?.rows?.includes(e) ?? !1, C = (e, t) => !!(h?.cells && t >= h.cells.startCol && t <= h.cells.endCol && e >= h.cells.startRow && e <= h.cells.endRow) || !!h?.cols?.includes(t) || !!S(e), w = p && m !== null ? s.searchHitAt(p, m) : null;
251
- return s.draw(e, t, () => {
252
- b.clearRect(0, 0, e.width, e.height);
253
- let { cellHeight: t, cellWidth: o, dividerWidth: m, labelWidth: T, rulerHeight: E } = a, D = T + m, { bytes: O, cols: k, rows: A, startCol: j, startRow: M } = g, N = (p?.positions.length ?? 0) > 0, P = N ? new Uint8Array(A * k) : null, F = w ? new Uint8Array(A * k) : null, I = N ? new Uint8Array(A) : null, L = w ? new Uint8Array(A) : null, R = N ? new Path2D() : null, z = w ? new Path2D() : null, B = !1, V = !1, H = (e, t) => {
254
- if (!p) return;
255
- let n = Math.max(1, p.query.length), i = e.row - M;
256
- if (i < 0 || i >= A) return;
257
- if (e.matrix_type === r.RECORD_NAME) {
258
- t.fill(1, i * k, (i + 1) * k);
222
+ if (!t) return x;
223
+ let S = t.getContext("2d");
224
+ if (!S) return x;
225
+ let C = o.sequenceCount.toString().length, w = (e) => _?.rows?.includes(e) ?? !1, T = (e, t) => !!(_?.cells && t >= _.cells.startCol && t <= _.cells.endCol && e >= _.cells.startRow && e <= _.cells.endRow) || !!_?.cols?.includes(t) || !!w(e), E = h && g !== null ? c.searchHitAt(h, g) : null;
226
+ return c.draw(t, n, () => {
227
+ S.clearRect(0, 0, t.width, t.height);
228
+ let { cellHeight: n, cellWidth: g, dividerWidth: D, labelWidth: O, rulerHeight: k } = a, A = O + D, { aminoAcidCodonOverlay: j, bytes: M, cols: N, rows: P, startCol: F, startRow: I } = v, L = c.getCellRenderConfig({
229
+ aminoAcidCodonOverlay: j,
230
+ aminoAcidPalette: e,
231
+ meta: o,
232
+ nucleotidePalette: s,
233
+ readingFrame: l,
234
+ readingMode: u
235
+ }), R = (h?.positions.length ?? 0) > 0, z = R ? new Uint8Array(P * N) : null, B = E ? new Uint8Array(P * N) : null, V = R ? new Uint8Array(P) : null, H = E ? new Uint8Array(P) : null, U = R ? new Path2D() : null, W = E ? new Path2D() : null, G = (e, t) => {
236
+ if (!h) return;
237
+ let n = Math.max(1, h.query.length), r = e.row - I;
238
+ if (r < 0 || r >= P) return;
239
+ if (e.matrix_type === i.RECORD_NAME) {
240
+ t.fill(1, r * N, (r + 1) * N);
259
241
  return;
260
242
  }
261
- let a = Math.max(j, e.col), o = Math.min(j + k, e.col + n);
262
- if (a >= o || !s.searchHitContainsCell(e, p.query, e.row, a)) return;
263
- let c = i * k + a - j;
264
- t.fill(1, c, c + o - a);
265
- }, U = (e, t) => {
266
- e.matrix_type === r.RECORD_NAME && e.row >= M && e.row < M + A && (t[e.row - M] = 1);
243
+ let a = Math.max(F, e.col), o = Math.min(F + N, e.col + n);
244
+ if (a >= o || !c.searchHitContainsCell(e, h.query, e.row, a)) return;
245
+ let s = r * N + a - F;
246
+ t.fill(1, s, s + o - a);
247
+ }, K = (e, t) => {
248
+ e.matrix_type === i.RECORD_NAME && e.row >= I && e.row < I + P && (t[e.row - I] = 1);
267
249
  };
268
- p && P && (p.positions.forEach((e) => H(e, P)), p.positions.forEach((e) => {
269
- I && U(e, I);
270
- }), w && F && (H(w, F), L && U(w, L))), b.font = "12px monospace", b.textAlign = "center", b.textBaseline = "middle";
271
- for (let e = 0; e < A; e++) {
272
- let r = (M + e) * t + E - f;
273
- if (!(r + t < E || r > _)) for (let a = 0; a < k; a++) {
274
- let s = (j + a) * o + D - d;
275
- if (s + o < D || s > v) continue;
276
- let l = O[e * k + a], u = j + a, f = M + e, p = l ?? "", m = String.fromCharCode(p), h = i.paletteEntryFor(c, m), g = h.background;
277
- l === null ? g = "#e9eef2" : m === " " && (g = "#f7f8f9");
278
- let _ = h.foreground;
279
- C(f, u) && (g = h.backgroundSelected, _ = h.foregroundSelected);
280
- let x = e * k + a, S = P?.[x] === 1, w = F?.[x] === 1, T = new Path2D();
281
- T.rect(s, r, o, t), T.closePath(), y.cells.pathPropertiesMap.set(T, {
282
- col: u,
283
- row: f,
284
- type: n.CELL
285
- }), b.fillStyle = g, b.fill(T), (w || L?.[e] === 1) && (b.fillStyle = "rgba(255, 193, 7, 0.35)", b.fillRect(s + 2, r + 2, Math.max(0, o - 4), Math.max(0, t - 4))), b.fillStyle = _, b.fillText(m, s + o / 2, r + t / 2), (S || I?.[e] === 1) && R && (B = !0, R.rect(s + .5, r + .5, o - 1, t - 1), (w || L?.[e] === 1) && z && (V = !0, z.rect(s + 1, r + 1, o - 2, t - 2)));
286
- }
287
- }
288
- B && R && (b.strokeStyle = "#000000", b.lineWidth = 1, b.stroke(R)), V && z && (b.lineWidth = 2, b.stroke(z)), b.fillStyle = "#edf2f6", b.fillRect(0, 0, v, E), b.font = "12px monospace", b.textBaseline = "middle";
289
- let W = [];
290
- b.strokeStyle = "#9fb3c8", b.lineWidth = 1, b.beginPath();
291
- for (let e = 0; e < k; e++) {
292
- let t = (j + e + 1) % 10 == 0;
293
- t && W.push(e);
294
- let r = (j + e) * o + D - d, i = new Path2D();
295
- i.rect(r, 0, o, E), i.closePath(), y.ruler.pathPropertiesMap.set(i, {
296
- col: j + e,
297
- type: n.RULER
250
+ h && z && (h.positions.forEach((e) => G(e, z)), h.positions.forEach((e) => {
251
+ V && K(e, V);
252
+ }), E && B && (G(E, B), H && K(E, H)));
253
+ let J = c.drawCells({
254
+ bytes: M,
255
+ cellHeight: n,
256
+ cellRenderConfig: L,
257
+ cellWidth: g,
258
+ cols: N,
259
+ context: S,
260
+ editorAssembly: x,
261
+ gridStart: A,
262
+ isCellSelected: T,
263
+ rows: P,
264
+ rulerHeight: k,
265
+ scrollLeft: p,
266
+ scrollTop: m,
267
+ searchRenderState: {
268
+ highlightedSearchMatchFlags: B,
269
+ highlightedSearchMatchPath: W,
270
+ highlightedSearchRowFlags: H,
271
+ searchMatchFlags: z,
272
+ searchMatchPath: U,
273
+ searchRowFlags: V
274
+ },
275
+ startCol: F,
276
+ startRow: I,
277
+ viewportHeight: y,
278
+ viewportWidth: b
279
+ });
280
+ J.hasSearchMatches && U && (S.strokeStyle = "#000000", S.lineWidth = 1, S.stroke(U)), J.hasHighlightedSearchMatches && W && (S.lineWidth = 2, S.stroke(W)), S.fillStyle = "#edf2f6", S.fillRect(0, 0, b, k), S.font = "12px monospace", S.textBaseline = "middle";
281
+ let Y = [];
282
+ S.strokeStyle = "#9fb3c8", S.lineWidth = 1, S.beginPath();
283
+ for (let e = 0; e < N; e++) {
284
+ let t = (F + e + 1) % 10 == 0;
285
+ t && Y.push(e);
286
+ let n = (F + e) * g + A - p, i = new Path2D();
287
+ i.rect(n, 0, g, k), i.closePath(), x.ruler.pathPropertiesMap.set(i, {
288
+ col: F + e,
289
+ type: r.RULER
298
290
  });
299
- let a = r + .5, s = t ? 8 : 4;
300
- b.moveTo(a, E), b.lineTo(a, E - s);
291
+ let a = n + .5, o = t ? 8 : 4;
292
+ S.moveTo(a, k), S.lineTo(a, k - o);
301
293
  }
302
- b.stroke(), b.fillStyle = "#486581", b.textAlign = "center", W.forEach((e) => {
303
- let t = (j + e) * o + D - d, n = String(j + e + 1), r = b.measureText(n).width;
304
- t - r / 2 < D || t + r / 2 > v || b.fillText(n, t, E / 2);
305
- }), b.textAlign = "start", b.strokeStyle = "#bcccdc", b.lineWidth = 1, b.beginPath(), b.moveTo(D + .5, 0), b.lineTo(D + .5, _), b.moveTo(0, E + .5), b.lineTo(v, E + .5), b.stroke(), b.fillStyle = "#edf2f6", b.fillRect(0, 0, D, E), b.fillStyle = "#d9e2ec", b.fillRect(T, 0, m, _);
306
- let G = new Path2D();
307
- G.rect(T, 0, m, _), G.closePath(), y.divider.pathPropertiesMap.set(G, { type: n.DIVIDER }), b.fillStyle = "#f8fafb", b.fillRect(0, E, T, _ - E), b.font = "12px monospace", b.textBaseline = "middle", b.save(), b.beginPath(), b.rect(0, E, T, _ - E), b.clip();
308
- for (let e = 0; e < A; e++) {
309
- let r = (M + e) * t + E - f;
310
- if (r + t < E || r > _) continue;
294
+ S.stroke(), S.fillStyle = "#486581", S.textAlign = "center", Y.forEach((e) => {
295
+ let t = (F + e) * g + A - p, n = String(F + e + 1), r = S.measureText(n).width;
296
+ t - r / 2 < A || t + r / 2 > b || S.fillText(n, t, k / 2);
297
+ }), S.textAlign = "start", S.strokeStyle = "#bcccdc", S.lineWidth = 1, S.beginPath(), S.moveTo(A + .5, 0), S.lineTo(A + .5, y), S.moveTo(0, k + .5), S.lineTo(b, k + .5), S.stroke(), S.fillStyle = "#edf2f6", S.fillRect(0, 0, A, k), S.fillStyle = "#d9e2ec", S.fillRect(O, 0, D, y);
298
+ let X = new Path2D();
299
+ X.rect(O, 0, D, y), X.closePath(), x.divider.pathPropertiesMap.set(X, { type: r.DIVIDER }), S.fillStyle = "#f8fafb", S.fillRect(0, k, O, y - k), S.font = "12px monospace", S.textBaseline = "middle", S.save(), S.beginPath(), S.rect(0, k, O, y - k), S.clip();
300
+ for (let e = 0; e < P; e++) {
301
+ let t = (I + e) * n + k - m;
302
+ if (t + n < k || t > y) continue;
311
303
  let i = new Path2D();
312
- i.rect(0, r, T, t), i.closePath(), y.labels.pathPropertiesMap.set(i, {
313
- row: M + e,
314
- type: n.LABEL
304
+ i.rect(0, t, O, n), i.closePath(), x.labels.pathPropertiesMap.set(i, {
305
+ row: I + e,
306
+ type: r.LABEL
315
307
  });
316
- let a = M + e - u, o = M + e, s = I?.[e] === 1, c = L?.[e] === 1, d = !!h?.cols || !!(h?.cells && o >= h.cells.startRow && o <= h.cells.endRow) || S(o);
317
- b.fillStyle = d ? "#1565c0" : "#f8fafb", b.fillRect(0, r, T, t), s && (b.fillStyle = "#ffecb3", b.fillRect(0, r, T, t)), c && (b.fillStyle = "rgba(255, 193, 7, 0.35)", b.fillRect(2, r + 2, Math.max(0, T - 4), Math.max(0, t - 4))), b.fillStyle = d ? "#ffffff" : "#334e68", b.fillText(`${(0, K.default)(String(M + e + 1), x, "0")}: ${l[a] ?? ""}`, 8, r + t / 2);
308
+ let a = I + e - f, o = I + e, s = V?.[e] === 1, c = H?.[e] === 1, l = !!_?.cols || !!(_?.cells && o >= _.cells.startRow && o <= _.cells.endRow) || w(o);
309
+ S.fillStyle = l ? "#1565c0" : "#f8fafb", S.fillRect(0, t, O, n), s && (S.fillStyle = "#ffecb3", S.fillRect(0, t, O, n)), c && (S.fillStyle = "rgba(255, 193, 7, 0.35)", S.fillRect(2, t + 2, Math.max(0, O - 4), Math.max(0, n - 4))), S.fillStyle = l ? "#ffffff" : "#334e68", S.fillText(`${(0, q.default)(String(I + e + 1), C, "0")}: ${d[a] ?? ""}`, 8, t + n / 2);
318
310
  }
319
- b.restore();
320
- }), y;
311
+ S.restore();
312
+ }), x;
321
313
  }
322
- static getExpandedSelection(e, n, r, i) {
314
+ static getExpandedSelection(e, t, r, i) {
323
315
  let a = e.cells;
324
316
  if (a) {
325
- if (r === t.LEFT) {
326
- let e = n.cells;
317
+ if (r === n.LEFT) {
318
+ let e = t.cells;
327
319
  if (!e) return null;
328
- let t = a.startCol < e.startCol || a.endCol <= e.startCol, r = t ? a.startCol - 1 : a.startCol, i = t ? a.endCol : a.endCol - 1;
320
+ let n = a.startCol < e.startCol || a.endCol <= e.startCol, r = n ? a.startCol - 1 : a.startCol, i = n ? a.endCol : a.endCol - 1;
329
321
  return r < 0 ? null : { cells: {
330
322
  ...a,
331
323
  endCol: i,
332
324
  startCol: r
333
325
  } };
334
326
  }
335
- if (r === t.RIGHT) {
336
- let e = n.cells;
327
+ if (r === n.RIGHT) {
328
+ let e = t.cells;
337
329
  if (!e) return null;
338
- let t = a.startCol < e.startCol ? a.startCol + 1 : a.startCol, r = a.startCol < e.startCol ? a.endCol : a.endCol + 1;
330
+ let n = a.startCol < e.startCol ? a.startCol + 1 : a.startCol, r = a.startCol < e.startCol ? a.endCol : a.endCol + 1;
339
331
  return r >= i.alignmentWidth ? null : { cells: {
340
332
  ...a,
341
333
  endCol: r,
342
- startCol: t
334
+ startCol: n
343
335
  } };
344
336
  }
345
- if (r === t.UP) {
346
- let e = n.cells;
337
+ if (r === n.UP) {
338
+ let e = t.cells;
347
339
  if (!e) return null;
348
- let t = a.startRow < e.startRow || a.endRow <= e.startRow, r = t ? a.startRow - 1 : a.startRow, i = t ? a.endRow : a.endRow - 1;
340
+ let n = a.startRow < e.startRow || a.endRow <= e.startRow, r = n ? a.startRow - 1 : a.startRow, i = n ? a.endRow : a.endRow - 1;
349
341
  return r < 0 ? null : { cells: {
350
342
  ...a,
351
343
  endRow: i,
352
344
  startRow: r
353
345
  } };
354
346
  }
355
- let e = n.cells;
347
+ let e = t.cells;
356
348
  if (!e) return null;
357
349
  let o = a.startRow < e.startRow ? a.startRow + 1 : a.startRow, s = a.startRow < e.startRow ? a.endRow : a.endRow + 1;
358
350
  return s >= i.sequenceCount ? null : { cells: {
@@ -363,18 +355,18 @@ var s = Object.create, c = Object.defineProperty, l = Object.getOwnPropertyDescr
363
355
  }
364
356
  let o = e.cols;
365
357
  if (o) {
366
- if (o.length === 0 || r !== t.LEFT && r !== t.RIGHT) return null;
367
- let e = Math.min(...o), a = Math.max(...o), s = n.cols;
358
+ if (o.length === 0 || r !== n.LEFT && r !== n.RIGHT) return null;
359
+ let e = Math.min(...o), a = Math.max(...o), s = t.cols;
368
360
  if (!s || s.length === 0) return null;
369
361
  let c = Math.min(...s);
370
- return r === t.LEFT ? a > c ? { cols: o.slice(0, -1) } : e > 0 ? { cols: [e - 1, ...o] } : null : e < c ? { cols: o.slice(1) } : a < i.alignmentWidth - 1 ? { cols: [...o, a + 1] } : null;
362
+ return r === n.LEFT ? a > c ? { cols: o.slice(0, -1) } : e > 0 ? { cols: [e - 1, ...o] } : null : e < c ? { cols: o.slice(1) } : a < i.alignmentWidth - 1 ? { cols: [...o, a + 1] } : null;
371
363
  }
372
364
  return e.rows ? e : null;
373
365
  }
374
- static getMovedRowsEndSelection(e, n, r) {
366
+ static getMovedRowsEndSelection(e, t, r) {
375
367
  if (!e || !r) return null;
376
- let i = n === t.UP ? 0 : r.sequenceCount;
377
- return s.getMovedRowsGroupedSelection(e, i, r);
368
+ let i = t === n.UP ? 0 : r.sequenceCount;
369
+ return c.getMovedRowsGroupedSelection(e, i, r);
378
370
  }
379
371
  static getMovedRowsGroupedSelection(e, t, n) {
380
372
  if (!e || !n) return null;
@@ -394,13 +386,13 @@ var s = Object.create, c = Object.defineProperty, l = Object.getOwnPropertyDescr
394
386
  }
395
387
  return null;
396
388
  }
397
- static getMovedRowsRelativeSelection(e, n, r) {
389
+ static getMovedRowsRelativeSelection(e, t, r) {
398
390
  if (!e || !r) return null;
399
391
  let i = e.cells;
400
392
  if (i) {
401
- let a = n === t.UP && i.startRow > 0, o = n === t.DOWN && i.endRow < r.sequenceCount - 1;
393
+ let a = t === n.UP && i.startRow > 0, o = t === n.DOWN && i.endRow < r.sequenceCount - 1;
402
394
  if (!a && !o) return e;
403
- let s = n === t.UP ? -1 : 1;
395
+ let s = t === n.UP ? -1 : 1;
404
396
  return { cells: {
405
397
  ...i,
406
398
  endRow: i.endRow + s,
@@ -410,8 +402,8 @@ var s = Object.create, c = Object.defineProperty, l = Object.getOwnPropertyDescr
410
402
  let a = e.rows;
411
403
  if (a && a.length > 0) {
412
404
  let e = [...new Set(a)].sort((e, t) => e - t), i = e.length;
413
- if (n === t.UP) return { rows: e.map((e, t) => Math.max(t, e - 1)) };
414
- if (n === t.DOWN) {
405
+ if (t === n.UP) return { rows: e.map((e, t) => Math.max(t, e - 1)) };
406
+ if (t === n.DOWN) {
415
407
  let t = r.sequenceCount - i;
416
408
  return { rows: e.map((e, n) => Math.min(t + n, e + 1)) };
417
409
  }
@@ -419,10 +411,10 @@ var s = Object.create, c = Object.defineProperty, l = Object.getOwnPropertyDescr
419
411
  }
420
412
  return null;
421
413
  }
422
- static getMovedSelection(e, n, r) {
414
+ static getMovedSelection(e, t, r) {
423
415
  if (!e || !r) return null;
424
- let i = n === t.LEFT || n === t.UP ? -1 : 1, a = (e, t, n) => i < 0 ? e > 0 : t < n - 1, o = e.cells;
425
- if (o) return n === t.LEFT || n === t.RIGHT ? a(o.startCol, o.endCol, r.alignmentWidth) ? { cells: {
416
+ let i = t === n.LEFT || t === n.UP ? -1 : 1, a = (e, t, n) => i < 0 ? e > 0 : t < n - 1, o = e.cells;
417
+ if (o) return t === n.LEFT || t === n.RIGHT ? a(o.startCol, o.endCol, r.alignmentWidth) ? { cells: {
426
418
  endCol: o.endCol + i,
427
419
  endRow: o.endRow,
428
420
  startCol: o.startCol + i,
@@ -433,10 +425,10 @@ var s = Object.create, c = Object.defineProperty, l = Object.getOwnPropertyDescr
433
425
  startCol: o.startCol,
434
426
  startRow: o.startRow + i
435
427
  } } : null;
436
- let c = e.cols;
437
- if (c) return n !== t.LEFT && n !== t.RIGHT || c.length === 0 || !a(Math.min(...c), Math.max(...c), r.alignmentWidth) ? null : { cols: c.map((e) => e + i) };
428
+ let s = e.cols;
429
+ if (s) return t !== n.LEFT && t !== n.RIGHT || s.length === 0 || !a(Math.min(...s), Math.max(...s), r.alignmentWidth) ? null : { cols: s.map((e) => e + i) };
438
430
  let l = e.rows;
439
- return l ? n !== t.UP && n !== t.DOWN || l.length === 0 ? null : s.getMovedRowsRelativeSelection(e, n, r) : null;
431
+ return l ? t !== n.UP && t !== n.DOWN || l.length === 0 ? null : c.getMovedRowsRelativeSelection(e, t, r) : null;
440
432
  }
441
433
  static getMutateArguments(e, t, n = 0) {
442
434
  let r = e?.cells;
@@ -459,7 +451,7 @@ var s = Object.create, c = Object.defineProperty, l = Object.getOwnPropertyDescr
459
451
  };
460
452
  }
461
453
  static getPathPropertiesFromCanvas(e) {
462
- let { canvas: t, devicePixelRatio: n, editorAssembly: r, event: i } = e, a = s.getCanvasContext(t), o = t.getBoundingClientRect(), c = t.width / o.width, l = t.height / o.height, u = (i.clientX - o.left) * c / n, d = (i.clientY - o.top) * l / n;
454
+ let { canvas: t, devicePixelRatio: n, editorAssembly: r, event: i } = e, a = c.getCanvasContext(t), o = t.getBoundingClientRect(), s = t.width / o.width, l = t.height / o.height, u = (i.clientX - o.left) * s / n, d = (i.clientY - o.top) * l / n;
463
455
  for (let [e, t] of r.ruler.pathPropertiesMap) if (a.isPointInPath(e, u, d)) return t;
464
456
  for (let [e, t] of r.labels.pathPropertiesMap) if (a.isPointInPath(e, u, d)) return t;
465
457
  for (let [e, t] of r.divider.pathPropertiesMap) if (a.isPointInPath(e, u, d)) return t;
@@ -485,10 +477,10 @@ var s = Object.create, c = Object.defineProperty, l = Object.getOwnPropertyDescr
485
477
  startRow: e.cells.startRow + n.length
486
478
  } } : null;
487
479
  }
488
- static getPostUpsertSelection(e, n) {
480
+ static getPostUpsertSelection(e, t) {
489
481
  if (!e) return null;
490
- if (n !== t.LEFT && n !== t.RIGHT) return e;
491
- let r = n === t.LEFT ? -1 : 1, i = e.cells;
482
+ if (t !== n.LEFT && t !== n.RIGHT) return e;
483
+ let r = t === n.LEFT ? -1 : 1, i = e.cells;
492
484
  if (i) {
493
485
  let t = i.startCol + r, n = i.endCol + r;
494
486
  return t < 0 ? e : { cells: {
@@ -506,47 +498,47 @@ var s = Object.create, c = Object.defineProperty, l = Object.getOwnPropertyDescr
506
498
  let o = e.rows;
507
499
  return o ? { rows: o } : null;
508
500
  }
509
- static getRowsToMove(e, n, r) {
501
+ static getRowsToMove(e, t, r) {
510
502
  let i = e?.cells, a = e?.rows ?? (i ? Array.from({ length: i.endRow - i.startRow + 1 }, (e, t) => i.startRow + t) : void 0);
511
503
  if (!a || a.length === 0) return;
512
504
  let o = [...new Set(a)].sort((e, t) => e - t), s = o.length;
513
505
  if (s !== 0 && s !== r.sequenceCount) {
514
- if (n === t.UP) {
506
+ if (t === n.UP) {
515
507
  if (o.every((e, t) => e === t)) return;
516
- } else if (n === t.DOWN && o.every((e, t) => e === r.sequenceCount - s + t)) return;
508
+ } else if (t === n.DOWN && o.every((e, t) => e === r.sequenceCount - s + t)) return;
517
509
  return a;
518
510
  }
519
511
  }
520
- static getSelectedFasta(e, t) {
521
- if (!t) return "";
522
- let n = o.parseFasta(e);
523
- if (n.error) throw Error(n.error);
524
- let r = (e) => [...new Set(e)].filter((e) => Number.isInteger(e) && e >= 0 && e < n.sequences.length).sort((e, t) => e - t).map((e) => n.sequences[e].sequence), i;
525
- if (t.cells) {
526
- let { endCol: e, endRow: n, startCol: a, startRow: o } = t.cells, s = Math.min(o, n), c = Math.max(o, n), l = Math.min(a, e), u = Math.max(a, e);
527
- i = r(Array.from({ length: c - s + 1 }, (e, t) => s + t)).map((e) => e.slice(l, u + 1));
528
- } else if (t.cols) {
529
- let e = [...new Set(t.cols)].filter((e) => Number.isInteger(e) && e >= 0).sort((e, t) => e - t);
512
+ static getSelectedFasta(n, r) {
513
+ if (!r) return "";
514
+ let i = t.parseFasta(n);
515
+ if (i.error) throw Error(i.error);
516
+ let a = (e) => [...new Set(e)].filter((e) => Number.isInteger(e) && e >= 0 && e < i.sequences.length).sort((e, t) => e - t).map((e) => i.sequences[e].sequence), o;
517
+ if (r.cells) {
518
+ let { endCol: e, endRow: t, startCol: n, startRow: i } = r.cells, s = Math.min(i, t), c = Math.max(i, t), l = Math.min(n, e), u = Math.max(n, e);
519
+ o = a(Array.from({ length: c - s + 1 }, (e, t) => s + t)).map((e) => e.slice(l, u + 1));
520
+ } else if (r.cols) {
521
+ let e = [...new Set(r.cols)].filter((e) => Number.isInteger(e) && e >= 0).sort((e, t) => e - t);
530
522
  if (e.length === 0) return "";
531
- i = r(Array.from({ length: n.sequences.length }, (e, t) => t)).map((t) => e.map((e) => t[e] ?? "").join(""));
532
- } else i = r(t.rows ?? []);
533
- return i.map((e) => `>${a.createUuid()}\n${e}\n`).join("");
523
+ o = a(Array.from({ length: i.sequences.length }, (e, t) => t)).map((t) => e.map((e) => t[e] ?? "").join(""));
524
+ } else o = a(r.rows ?? []);
525
+ return o.map((t) => `>${e.createUuid()}\n${t}\n`).join("");
534
526
  }
535
527
  static getSelectionFromPathProperties(e) {
536
- let { endPath: t, startPath: r } = e;
537
- if (r.type === n.RULER && (t.type === n.RULER || t.type === n.CELL)) {
538
- let e = Math.min(r.col, t.col), n = Math.max(r.col, t.col);
539
- return { cols: Array.from({ length: n - e + 1 }, (t, n) => e + n) };
528
+ let { endPath: t, startPath: n } = e;
529
+ if (n.type === r.RULER && (t.type === r.RULER || t.type === r.CELL)) {
530
+ let e = Math.min(n.col, t.col), r = Math.max(n.col, t.col);
531
+ return { cols: Array.from({ length: r - e + 1 }, (t, n) => e + n) };
540
532
  }
541
- if (r.type === n.CELL && t.type === n.CELL) return { cells: {
542
- endCol: Math.max(r.col, t.col),
543
- endRow: Math.max(r.row, t.row),
544
- startCol: Math.min(r.col, t.col),
545
- startRow: Math.min(r.row, t.row)
533
+ if (n.type === r.CELL && t.type === r.CELL) return { cells: {
534
+ endCol: Math.max(n.col, t.col),
535
+ endRow: Math.max(n.row, t.row),
536
+ startCol: Math.min(n.col, t.col),
537
+ startRow: Math.min(n.row, t.row)
546
538
  } };
547
- if (r.type === n.LABEL && t.type === n.LABEL) {
548
- let e = Math.min(r.row, t.row), n = Math.max(r.row, t.row);
549
- return { rows: Array.from({ length: n - e + 1 }, (t, n) => e + n) };
539
+ if (n.type === r.LABEL && t.type === r.LABEL) {
540
+ let e = Math.min(n.row, t.row), r = Math.max(n.row, t.row);
541
+ return { rows: Array.from({ length: r - e + 1 }, (t, n) => e + n) };
550
542
  }
551
543
  }
552
544
  static getStatusBarSelectionStats(e, t = null) {
@@ -599,14 +591,14 @@ var s = Object.create, c = Object.defineProperty, l = Object.getOwnPropertyDescr
599
591
  rows: a
600
592
  };
601
593
  }
602
- static getVisibleGridRange(t) {
603
- let { geometry: n = e, numCols: r, numRows: i, scrollLeft: a, scrollTop: o, viewportHeight: s, viewportWidth: c } = t, l = n.labelWidth + n.dividerWidth, u = Math.max(0, Math.floor(a / n.cellWidth)), d = Math.min(r, u + Math.max(1, Math.ceil((c - l) / n.cellWidth) + 1)), f = Math.max(0, Math.floor(Math.max(0, o - n.rulerHeight) / n.cellHeight)), p = Math.min(i, f + Math.max(1, Math.ceil((s - n.rulerHeight) / n.cellHeight) + 1));
594
+ static getVisibleGridRange(e) {
595
+ let { geometry: t = o, numCols: n, numRows: r, scrollLeft: i, scrollTop: a, viewportHeight: s, viewportWidth: c } = e, l = t.labelWidth + t.dividerWidth, u = Math.max(0, Math.floor(i / t.cellWidth)), d = Math.min(n, u + Math.max(1, Math.ceil((c - l) / t.cellWidth) + 1)), f = Math.max(0, Math.floor(Math.max(0, a - t.rulerHeight) / t.cellHeight)), p = Math.min(r, f + Math.max(1, Math.ceil((s - t.rulerHeight) / t.cellHeight) + 1));
604
596
  return {
605
597
  cache: {
606
- endCol: Math.min(r, d + n.numOverscanCols),
607
- endRow: Math.min(i, p + n.numOverscanRows),
608
- startCol: Math.max(0, u - n.numOverscanCols),
609
- startRow: Math.max(0, f - n.numOverscanRows)
598
+ endCol: Math.min(n, d + t.numOverscanCols),
599
+ endRow: Math.min(r, p + t.numOverscanRows),
600
+ startCol: Math.max(0, u - t.numOverscanCols),
601
+ startRow: Math.max(0, f - t.numOverscanRows)
610
602
  },
611
603
  visible: {
612
604
  endCol: d,
@@ -628,8 +620,8 @@ var s = Object.create, c = Object.defineProperty, l = Object.getOwnPropertyDescr
628
620
  });
629
621
  }
630
622
  static scrollToSearchResult(e) {
631
- let { geometry: t, scrollContainer: n, searchResult: r, searchResultHighlightedIndex: i } = e, a = r && i !== null ? s.searchHitAt(r, i) : null;
632
- a && s.scrollToPosition({
623
+ let { geometry: t, scrollContainer: n, searchResult: r, searchResultHighlightedIndex: i } = e, a = r && i !== null ? c.searchHitAt(r, i) : null;
624
+ a && c.scrollToPosition({
633
625
  geometry: t,
634
626
  scrollContainer: n,
635
627
  x: a.col + 1,
@@ -637,21 +629,114 @@ var s = Object.create, c = Object.defineProperty, l = Object.getOwnPropertyDescr
637
629
  });
638
630
  }
639
631
  static draw(e, t, n) {
640
- let r = s.getCanvasContext(e);
632
+ let r = c.getCanvasContext(e);
641
633
  r.setTransform(t, 0, 0, t, 0, 0), n(r), r.setTransform(1, 0, 0, 1, 0, 0);
642
634
  }
635
+ static drawCell({ bytes: e, cellHeight: t, cellRenderConfig: n, cellWidth: i, col: a, cols: o, context: s, editorAssembly: l, highlightedSearchMatchFlags: u, highlightedSearchMatchPath: d, highlightedSearchRowFlags: f, isCellSelected: p, row: m, searchMatchFlags: h, searchMatchPath: g, searchRowFlags: _, startCol: v, startRow: y, x: b, y: x }) {
636
+ let S = v + a, C = y + m, { colorByte: w, colors: T, label: E } = c.getCellRenderData({
637
+ bytes: e,
638
+ cellCol: S,
639
+ cellRenderConfig: n,
640
+ cellRow: C,
641
+ col: a,
642
+ cols: o,
643
+ row: m,
644
+ startCol: v
645
+ }), D = T.background;
646
+ w === void 0 ? D = "#e9eef2" : E === " " && (D = "#f7f8f9");
647
+ let O = T.foreground;
648
+ p(C, S) && (D = T.backgroundSelected, O = T.foregroundSelected);
649
+ let k = m * o + a, A = h?.[k] === 1, j = u?.[k] === 1, M = new Path2D();
650
+ M.rect(b, x, i, t), M.closePath(), l.cells.pathPropertiesMap.set(M, {
651
+ col: S,
652
+ row: C,
653
+ type: r.CELL
654
+ }), s.fillStyle = D;
655
+ let N = Math.floor(b), P = Math.floor(x), F = Math.ceil(b + i), I = Math.ceil(x + t);
656
+ s.fillRect(N, P, F - N, I - P), (j || f?.[m] === 1) && (s.fillStyle = "rgba(255, 193, 7, 0.35)", s.fillRect(b + 2, x + 2, Math.max(0, i - 4), Math.max(0, t - 4))), s.fillStyle = O, s.textAlign = "center", s.textBaseline = "middle", s.fillText(E, b + i / 2, x + t / 2);
657
+ let L = !1;
658
+ return (A || _?.[m] === 1) && g && (g.rect(b + .5, x + .5, i - 1, t - 1), (j || f?.[m] === 1) && d && (L = !0, d.rect(b + 1, x + 1, i - 2, t - 2))), {
659
+ hasHighlightedSearchMatches: L,
660
+ hasSearchMatches: A || _?.[m] === 1
661
+ };
662
+ }
663
+ static drawCells({ bytes: e, cellHeight: t, cellRenderConfig: n, cellWidth: r, cols: i, context: a, editorAssembly: o, gridStart: s, isCellSelected: l, rows: u, rulerHeight: d, scrollLeft: f, scrollTop: p, searchRenderState: m, startCol: h, startRow: g, viewportHeight: _, viewportWidth: v }) {
664
+ let y = !1, b = !1, { highlightedSearchMatchFlags: x, highlightedSearchMatchPath: S, highlightedSearchRowFlags: C, searchMatchFlags: w, searchMatchPath: T, searchRowFlags: E } = m;
665
+ for (let m = 0; m < u; m++) {
666
+ let u = (g + m) * t + d - p;
667
+ if (!(u + t < d || u > _)) for (let d = 0; d < i; d++) {
668
+ let p = (h + d) * r + s - f;
669
+ if (p + r < s || p > v) continue;
670
+ let _ = c.drawCell({
671
+ bytes: e,
672
+ cellHeight: t,
673
+ cellRenderConfig: n,
674
+ cellWidth: r,
675
+ col: d,
676
+ cols: i,
677
+ context: a,
678
+ editorAssembly: o,
679
+ highlightedSearchMatchFlags: x,
680
+ highlightedSearchMatchPath: S,
681
+ highlightedSearchRowFlags: C,
682
+ isCellSelected: l,
683
+ row: m,
684
+ searchMatchFlags: w,
685
+ searchMatchPath: T,
686
+ searchRowFlags: E,
687
+ startCol: h,
688
+ startRow: g,
689
+ x: p,
690
+ y: u
691
+ });
692
+ b ||= _.hasSearchMatches, y ||= _.hasHighlightedSearchMatches;
693
+ }
694
+ }
695
+ return {
696
+ hasHighlightedSearchMatches: y,
697
+ hasSearchMatches: b
698
+ };
699
+ }
643
700
  static getCanvasContext(e) {
644
701
  let t = e.getContext("2d");
645
702
  if (!t) throw Error("Failed to acquire 2D canvas context.");
646
703
  return t;
647
704
  }
705
+ static getCellRenderConfig({ aminoAcidCodonOverlay: e, aminoAcidPalette: t, meta: n, nucleotidePalette: r, readingFrame: i, readingMode: o }) {
706
+ let s = o ?? a.NUCLEOTIDE, c = e && s !== a.NUCLEOTIDE ? s : a.NUCLEOTIDE;
707
+ return {
708
+ aminoAcidCodonOverlay: e,
709
+ aminoAcidPalette: t,
710
+ meta: n,
711
+ nucleotidePalette: r,
712
+ readingFrame: i ?? 1,
713
+ readingMode: c
714
+ };
715
+ }
716
+ static getCellRenderData({ bytes: e, cellCol: t, cellRenderConfig: n, cellRow: r, col: i, cols: o, row: c }) {
717
+ let { aminoAcidCodonOverlay: l, aminoAcidPalette: u, meta: d, nucleotidePalette: f, readingFrame: p, readingMode: m } = n, h = e[c * o + i], g;
718
+ l && r < d.sequenceCount && t < d.alignmentWidth && (g = l[r * d.alignmentWidth + t]);
719
+ let _ = m === a.AMINO_ACIDS || m === a.NUCLEOTIDE_PLUS_AMINO_ACIDS, v = _ ? g : h, y = h;
720
+ m === a.AMINO_ACIDS && (y = g, g !== void 0 && t >= p - 1 && (t - (p - 1)) % 3 != 1 && (y = void 0));
721
+ let b = y === void 0 ? "" : String.fromCharCode(y), x = v === void 0 ? "" : String.fromCharCode(v), S = _ ? u : f, C = m === a.NUCLEOTIDE_PLUS_AMINO_ACIDS ? f : S, w = s.paletteEntryFor(S, x), T = s.paletteEntryFor(C, y === void 0 ? "" : String.fromCharCode(y));
722
+ return {
723
+ colorByte: v,
724
+ colors: {
725
+ background: w.background,
726
+ backgroundSelected: w.backgroundSelected,
727
+ foreground: T.foreground,
728
+ foregroundSelected: T.foregroundSelected
729
+ },
730
+ label: b
731
+ };
732
+ }
648
733
  static searchHitAt(e, t) {
649
734
  return e?.positions[t] ?? null;
650
735
  }
651
- static searchHitContainsCell(e, t, n, i) {
652
- return e.matrix_type === r.NUCLEOTIDE && e.row === n && i >= e.col && i < e.col + Math.max(1, t.length);
736
+ static searchHitContainsCell(e, t, n, r) {
737
+ return e.matrix_type === i.NUCLEOTIDE && e.row === n && r >= e.col && r < e.col + Math.max(1, t.length);
653
738
  }
654
739
  };
655
- export { q as EditorUtil };
740
+ export { J as EditorUtil };
656
741
 
657
742
  //# sourceMappingURL=index.js.map