@rivm-loculus-tools/sequence-editor 0.1.4 → 0.1.7

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 (127) hide show
  1. package/dist/_chunks/EditorWorkerService.js +127 -0
  2. package/dist/_chunks/EditorWorkerService.js.map +1 -0
  3. package/dist/_chunks/SequenceEditor.js +733 -0
  4. package/dist/_chunks/SequenceEditor.js.map +1 -0
  5. package/dist/_chunks/SequenceEditorPageDrawer.js +425 -0
  6. package/dist/_chunks/SequenceEditorPageDrawer.js.map +1 -0
  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 +174 -0
  12. package/dist/_chunks/sequenceEditorStore.js.map +1 -0
  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/EditorWorkerService.d.ts +27 -0
  16. package/dist/classes/services/EditorWorkerService/index.js +2 -0
  17. package/dist/classes/services/SequenceEditorEventBusService/SequenceEditorEventBusService.d.ts +25 -0
  18. package/dist/classes/services/SequenceEditorEventBusService/index.js +16 -0
  19. package/dist/classes/services/SequenceEditorEventBusService/index.js.map +1 -0
  20. package/dist/classes/workers/EngineWorker/EngineWorker.d.ts +46 -0
  21. package/dist/classes/workers/EngineWorker/index.js +111 -0
  22. package/dist/classes/workers/EngineWorker/index.js.map +1 -0
  23. package/dist/components/app/App/App.d.ts +1 -0
  24. package/dist/components/app/App/index.js +21 -0
  25. package/dist/components/app/App/index.js.map +1 -0
  26. package/dist/components/pages/EmptyWorkspace.d.ts +3 -0
  27. package/dist/components/pages/SequenceEditorErrorPage/SequenceEditorErrorPage.d.ts +3 -0
  28. package/dist/components/pages/SequenceEditorErrorPage/index.js +12 -0
  29. package/dist/components/pages/SequenceEditorErrorPage/index.js.map +1 -0
  30. package/dist/components/pages/SequenceEditorMainPage/SequenceEditorMainPage.d.ts +1 -0
  31. package/dist/components/pages/SequenceEditorMainPage/index.js +61 -0
  32. package/dist/components/pages/SequenceEditorMainPage/index.js.map +1 -0
  33. package/dist/components/ui/SequenceEditor/SequenceEditor.d.ts +1 -0
  34. package/dist/components/ui/SequenceEditor/SequenceEditorGotoPositionDialog.d.ts +8 -0
  35. package/dist/components/ui/SequenceEditor/SequenceEditorStatusBar.d.ts +1 -0
  36. package/dist/components/ui/SequenceEditor/index.js +2 -0
  37. package/dist/components/ui/SequenceEditorPage/SequenceEditorPage.d.ts +5 -0
  38. package/dist/components/ui/SequenceEditorPage/index.js +15 -0
  39. package/dist/components/ui/SequenceEditorPage/index.js.map +1 -0
  40. package/dist/components/ui/SequenceEditorPageDrawer/SequenceEditorPageDrawer.d.ts +1 -0
  41. package/dist/components/ui/SequenceEditorPageDrawer/SequenceEditorPageDrawerColorForm.d.ts +7 -0
  42. package/dist/components/ui/SequenceEditorPageDrawer/SequenceEditorPageDrawerKeyboardShortcuts.d.ts +1 -0
  43. package/dist/components/ui/SequenceEditorPageDrawer/index.js +2 -0
  44. package/dist/components/ui/SequenceEditorPageHeader/SequenceEditorPageHeader.d.ts +1 -0
  45. package/dist/components/ui/SequenceEditorPageHeader/index.js +60 -0
  46. package/dist/components/ui/SequenceEditorPageHeader/index.js.map +1 -0
  47. package/dist/components/ui/SequenceEditorSearchBar/SequenceEditorSearchBar.d.ts +1 -0
  48. package/dist/components/ui/SequenceEditorSearchBar/index.js +27 -0
  49. package/dist/components/ui/SequenceEditorSearchBar/index.js.map +1 -0
  50. package/dist/constants/editor.d.ts +4 -0
  51. package/dist/constants/editor.js +14 -0
  52. package/dist/constants/editor.js.map +1 -0
  53. package/dist/constants/index.js +4 -0
  54. package/dist/constants/keyboard.d.ts +10 -0
  55. package/dist/constants/keyboard.js +179 -0
  56. package/dist/constants/keyboard.js.map +1 -0
  57. package/dist/constants/palette.d.ts +15 -0
  58. package/dist/constants/palette.js +196 -0
  59. package/dist/constants/palette.js.map +1 -0
  60. package/dist/models/editor.d.ts +6 -0
  61. package/dist/models/editor.js +8 -0
  62. package/dist/models/editor.js.map +1 -0
  63. package/dist/models/model.d.ts +250 -0
  64. package/dist/models/model.js +10 -0
  65. package/dist/models/model.js.map +1 -0
  66. package/dist/models/palette.d.ts +61 -0
  67. package/dist/models/palette.js +10 -0
  68. package/dist/models/palette.js.map +1 -0
  69. package/dist/stores/sequenceEditorStore/index.js +2 -0
  70. package/dist/stores/sequenceEditorStore/sequenceEditorStore.d.ts +36 -0
  71. package/dist/utils/EditorUtil/EditorUtil.d.ts +96 -0
  72. package/dist/utils/EditorUtil/index.js +552 -0
  73. package/dist/utils/EditorUtil/index.js.map +1 -0
  74. package/dist/utils/EngineErrorUtil/EngineErrorUtil.d.ts +4 -0
  75. package/dist/utils/PaletteUtil/PaletteUtil.d.ts +6 -0
  76. package/dist/utils/PaletteUtil/index.js +19 -0
  77. package/dist/utils/PaletteUtil/index.js.map +1 -0
  78. package/package.json +47 -21
  79. package/.gitkeep +0 -0
  80. package/CHANGELOG.md +0 -37
  81. package/eslint.config.js +0 -16
  82. package/scripts/update-exports.js +0 -9
  83. package/src/classes/services/EditorWorkerService/EditorWorkerService.ts +0 -163
  84. package/src/classes/services/SequenceEditorEventBusService/SequenceEditorEventBusService.ts +0 -37
  85. package/src/classes/workers/EngineWorker/EngineWorker.ts +0 -196
  86. package/src/components/app/App/App.tsx +0 -22
  87. package/src/components/pages/EmptyWorkspace.tsx +0 -43
  88. package/src/components/pages/SequenceEditorErrorPage/SequenceEditorErrorPage.tsx +0 -16
  89. package/src/components/pages/SequenceEditorMainPage/SequenceEditorMainPage.tsx +0 -76
  90. package/src/components/ui/SequenceEditor/SequenceEditor.tsx +0 -896
  91. package/src/components/ui/SequenceEditor/SequenceEditorGotoPositionDialog.tsx +0 -108
  92. package/src/components/ui/SequenceEditor/SequenceEditorStatusBar.tsx +0 -72
  93. package/src/components/ui/SequenceEditorPage/SequenceEditorPage.tsx +0 -23
  94. package/src/components/ui/SequenceEditorPageDrawer/SequenceEditorPageDrawer.tsx +0 -234
  95. package/src/components/ui/SequenceEditorPageDrawer/SequenceEditorPageDrawerColorForm.tsx +0 -73
  96. package/src/components/ui/SequenceEditorPageDrawer/SequenceEditorPageDrawerKeyboardShortcuts.tsx +0 -230
  97. package/src/components/ui/SequenceEditorPageHeader/SequenceEditorPageHeader.tsx +0 -71
  98. package/src/components/ui/SequenceEditorSearchBar/SequenceEditorSearchBar.tsx +0 -35
  99. package/src/constants/editor.ts +0 -15
  100. package/src/constants/keyboard.ts +0 -154
  101. package/src/constants/palette.ts +0 -227
  102. package/src/models/editor.ts +0 -6
  103. package/src/models/model.ts +0 -295
  104. package/src/models/palette.ts +0 -68
  105. package/src/stores/sequenceEditorStore/sequenceEditorStore.ts +0 -103
  106. package/src/utils/EditorUtil/EditorUtil.ts +0 -892
  107. package/src/utils/EngineErrorUtil/EngineErrorUtil.ts +0 -25
  108. package/src/utils/PaletteUtil/PaletteUtil.ts +0 -31
  109. package/tsconfig.build.json +0 -14
  110. package/tsconfig.json +0 -32
  111. package/vite.config.ts +0 -177
  112. /package/{src/classes/services/EditorWorkerService/index.ts → dist/classes/services/EditorWorkerService/index.d.ts} +0 -0
  113. /package/{src/classes/services/SequenceEditorEventBusService/index.ts → dist/classes/services/SequenceEditorEventBusService/index.d.ts} +0 -0
  114. /package/{src/classes/workers/EngineWorker/index.ts → dist/classes/workers/EngineWorker/index.d.ts} +0 -0
  115. /package/{src/components/app/App/index.ts → dist/components/app/App/index.d.ts} +0 -0
  116. /package/{src/components/pages/SequenceEditorErrorPage/index.ts → dist/components/pages/SequenceEditorErrorPage/index.d.ts} +0 -0
  117. /package/{src/components/pages/SequenceEditorMainPage/index.ts → dist/components/pages/SequenceEditorMainPage/index.d.ts} +0 -0
  118. /package/{src/components/ui/SequenceEditor/index.ts → dist/components/ui/SequenceEditor/index.d.ts} +0 -0
  119. /package/{src/components/ui/SequenceEditorPage/index.ts → dist/components/ui/SequenceEditorPage/index.d.ts} +0 -0
  120. /package/{src/components/ui/SequenceEditorPageDrawer/index.ts → dist/components/ui/SequenceEditorPageDrawer/index.d.ts} +0 -0
  121. /package/{src/components/ui/SequenceEditorPageHeader/index.ts → dist/components/ui/SequenceEditorPageHeader/index.d.ts} +0 -0
  122. /package/{src/components/ui/SequenceEditorSearchBar/index.ts → dist/components/ui/SequenceEditorSearchBar/index.d.ts} +0 -0
  123. /package/{src/constants/index.ts → dist/constants/index.d.ts} +0 -0
  124. /package/{src/models/index.ts → dist/models/index.d.ts} +0 -0
  125. /package/{src/stores/sequenceEditorStore/index.ts → dist/stores/sequenceEditorStore/index.d.ts} +0 -0
  126. /package/{src/utils/EditorUtil/index.ts → dist/utils/EditorUtil/index.d.ts} +0 -0
  127. /package/{src/utils/PaletteUtil/index.ts → dist/utils/PaletteUtil/index.d.ts} +0 -0
@@ -0,0 +1,552 @@
1
+ import { PaletteUtil as e } from "../PaletteUtil/index.js";
2
+ import { EDITOR_DIRECTION as t } from "../../models/editor.js";
3
+ import { EDITOR_PATH_PROPERTIES_TYPE as n, MATRIX_TYPE as r } from "../../models/model.js";
4
+ import { DEFAULT_GRID_GEOMETRY as i } from "../../constants/editor.js";
5
+ import "../../constants/index.js";
6
+ //#region \0rolldown/runtime.js
7
+ var a = Object.create, o = Object.defineProperty, s = Object.getOwnPropertyDescriptor, c = Object.getOwnPropertyNames, l = Object.getPrototypeOf, u = Object.prototype.hasOwnProperty, d = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), f = (e, t, n, r) => {
8
+ if (t && typeof t == "object" || typeof t == "function") for (var i = c(t), a = 0, l = i.length, d; a < l; a++) d = i[a], !u.call(e, d) && d !== n && o(e, d, {
9
+ get: ((e) => t[e]).bind(null, d),
10
+ enumerable: !(r = s(t, d)) || r.enumerable
11
+ });
12
+ return e;
13
+ }, p = (e, t, n) => (n = e == null ? {} : a(l(e)), f(t || !e || !e.__esModule || !u.call(e, "default") ? o(n, "default", {
14
+ value: e,
15
+ enumerable: !0
16
+ }) : n, e)), m = /* @__PURE__ */ d(((e, t) => {
17
+ var n = Math.floor;
18
+ function r(e, t) {
19
+ var r = "";
20
+ if (!e || t < 1 || t > 9007199254740991) return r;
21
+ do
22
+ t % 2 && (r += e), t = n(t / 2), t && (e += e);
23
+ while (t);
24
+ return r;
25
+ }
26
+ t.exports = r;
27
+ })), h = /* @__PURE__ */ d(((e, t) => {
28
+ t.exports = typeof global == "object" && global && global.Object === Object && global;
29
+ })), g = /* @__PURE__ */ d(((e, t) => {
30
+ var n = h(), r = typeof self == "object" && self && self.Object === Object && self;
31
+ t.exports = n || r || Function("return this")();
32
+ })), _ = /* @__PURE__ */ d(((e, t) => {
33
+ t.exports = g().Symbol;
34
+ })), v = /* @__PURE__ */ d(((e, t) => {
35
+ function n(e, t) {
36
+ for (var n = -1, r = e == null ? 0 : e.length, i = Array(r); ++n < r;) i[n] = t(e[n], n, e);
37
+ return i;
38
+ }
39
+ t.exports = n;
40
+ })), y = /* @__PURE__ */ d(((e, t) => {
41
+ t.exports = Array.isArray;
42
+ })), b = /* @__PURE__ */ d(((e, t) => {
43
+ var n = _(), r = Object.prototype, i = r.hasOwnProperty, a = r.toString, o = n ? n.toStringTag : void 0;
44
+ function s(e) {
45
+ var t = i.call(e, o), n = e[o];
46
+ try {
47
+ e[o] = void 0;
48
+ var r = !0;
49
+ } catch {}
50
+ var s = a.call(e);
51
+ return r && (t ? e[o] = n : delete e[o]), s;
52
+ }
53
+ t.exports = s;
54
+ })), x = /* @__PURE__ */ d(((e, t) => {
55
+ var n = Object.prototype.toString;
56
+ function r(e) {
57
+ return n.call(e);
58
+ }
59
+ t.exports = r;
60
+ })), S = /* @__PURE__ */ d(((e, t) => {
61
+ var n = _(), r = b(), i = x(), a = "[object Null]", o = "[object Undefined]", s = n ? n.toStringTag : void 0;
62
+ function c(e) {
63
+ return e == null ? e === void 0 ? o : a : s && s in Object(e) ? r(e) : i(e);
64
+ }
65
+ t.exports = c;
66
+ })), C = /* @__PURE__ */ d(((e, t) => {
67
+ function n(e) {
68
+ return typeof e == "object" && !!e;
69
+ }
70
+ t.exports = n;
71
+ })), w = /* @__PURE__ */ d(((e, t) => {
72
+ var n = S(), r = C(), i = "[object Symbol]";
73
+ function a(e) {
74
+ return typeof e == "symbol" || r(e) && n(e) == i;
75
+ }
76
+ t.exports = a;
77
+ })), T = /* @__PURE__ */ d(((e, t) => {
78
+ var n = _(), r = v(), i = y(), a = w(), o = 1 / 0, s = n ? n.prototype : void 0, c = s ? s.toString : void 0;
79
+ function l(e) {
80
+ if (typeof e == "string") return e;
81
+ if (i(e)) return r(e, l) + "";
82
+ if (a(e)) return c ? c.call(e) : "";
83
+ var t = e + "";
84
+ return t == "0" && 1 / e == -o ? "-0" : t;
85
+ }
86
+ t.exports = l;
87
+ })), E = /* @__PURE__ */ d(((e, t) => {
88
+ function n(e, t, n) {
89
+ var r = -1, i = e.length;
90
+ 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;
91
+ for (var a = Array(i); ++r < i;) a[r] = e[r + t];
92
+ return a;
93
+ }
94
+ t.exports = n;
95
+ })), D = /* @__PURE__ */ d(((e, t) => {
96
+ var n = E();
97
+ function r(e, t, r) {
98
+ var i = e.length;
99
+ return r = r === void 0 ? i : r, !t && r >= i ? e : n(e, t, r);
100
+ }
101
+ t.exports = r;
102
+ })), O = /* @__PURE__ */ d(((e, t) => {
103
+ var n = RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");
104
+ function r(e) {
105
+ return n.test(e);
106
+ }
107
+ t.exports = r;
108
+ })), k = /* @__PURE__ */ d(((e, t) => {
109
+ function n(e) {
110
+ return function(t) {
111
+ return t?.[e];
112
+ };
113
+ }
114
+ t.exports = n;
115
+ })), A = /* @__PURE__ */ d(((e, t) => {
116
+ t.exports = k()("length");
117
+ })), j = /* @__PURE__ */ d(((e, t) => {
118
+ 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 + "(?:" + [
119
+ l,
120
+ u,
121
+ d
122
+ ].join("|") + ")" + m + p + ")*", g = m + p + h, _ = "(?:" + [
123
+ l + o + "?",
124
+ o,
125
+ u,
126
+ d,
127
+ a
128
+ ].join("|") + ")", v = RegExp(s + "(?=" + s + ")|" + _ + g, "g");
129
+ function y(e) {
130
+ for (var t = v.lastIndex = 0; v.test(e);) ++t;
131
+ return t;
132
+ }
133
+ t.exports = y;
134
+ })), M = /* @__PURE__ */ d(((e, t) => {
135
+ var n = A(), r = O(), i = j();
136
+ function a(e) {
137
+ return r(e) ? i(e) : n(e);
138
+ }
139
+ t.exports = a;
140
+ })), N = /* @__PURE__ */ d(((e, t) => {
141
+ function n(e) {
142
+ return e.split("");
143
+ }
144
+ t.exports = n;
145
+ })), P = /* @__PURE__ */ d(((e, t) => {
146
+ 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 + "(?:" + [
147
+ l,
148
+ u,
149
+ d
150
+ ].join("|") + ")" + m + p + ")*", g = m + p + h, _ = "(?:" + [
151
+ l + o + "?",
152
+ o,
153
+ u,
154
+ d,
155
+ a
156
+ ].join("|") + ")", v = RegExp(s + "(?=" + s + ")|" + _ + g, "g");
157
+ function y(e) {
158
+ return e.match(v) || [];
159
+ }
160
+ t.exports = y;
161
+ })), F = /* @__PURE__ */ d(((e, t) => {
162
+ var n = N(), r = O(), i = P();
163
+ function a(e) {
164
+ return r(e) ? i(e) : n(e);
165
+ }
166
+ t.exports = a;
167
+ })), I = /* @__PURE__ */ d(((e, t) => {
168
+ var n = m(), r = T(), i = D(), a = O(), o = M(), s = F(), c = Math.ceil;
169
+ function l(e, t) {
170
+ t = t === void 0 ? " " : r(t);
171
+ var l = t.length;
172
+ if (l < 2) return l ? n(t, e) : t;
173
+ var u = n(t, c(e / o(t)));
174
+ return a(t) ? i(s(u), 0, e).join("") : u.slice(0, e);
175
+ }
176
+ t.exports = l;
177
+ })), L = /* @__PURE__ */ d(((e, t) => {
178
+ var n = /\s/;
179
+ function r(e) {
180
+ for (var t = e.length; t-- && n.test(e.charAt(t)););
181
+ return t;
182
+ }
183
+ t.exports = r;
184
+ })), R = /* @__PURE__ */ d(((e, t) => {
185
+ var n = L(), r = /^\s+/;
186
+ function i(e) {
187
+ return e && e.slice(0, n(e) + 1).replace(r, "");
188
+ }
189
+ t.exports = i;
190
+ })), z = /* @__PURE__ */ d(((e, t) => {
191
+ function n(e) {
192
+ var t = typeof e;
193
+ return e != null && (t == "object" || t == "function");
194
+ }
195
+ t.exports = n;
196
+ })), B = /* @__PURE__ */ d(((e, t) => {
197
+ var n = R(), r = z(), i = w(), a = NaN, o = /^[-+]0x[0-9a-f]+$/i, s = /^0b[01]+$/i, c = /^0o[0-7]+$/i, l = parseInt;
198
+ function u(e) {
199
+ if (typeof e == "number") return e;
200
+ if (i(e)) return a;
201
+ if (r(e)) {
202
+ var t = typeof e.valueOf == "function" ? e.valueOf() : e;
203
+ e = r(t) ? t + "" : t;
204
+ }
205
+ if (typeof e != "string") return e === 0 ? e : +e;
206
+ e = n(e);
207
+ var u = s.test(e);
208
+ return u || c.test(e) ? l(e.slice(2), u ? 2 : 8) : o.test(e) ? a : +e;
209
+ }
210
+ t.exports = u;
211
+ })), V = /* @__PURE__ */ d(((e, t) => {
212
+ var n = B(), r = 1 / 0, i = 17976931348623157e292;
213
+ function a(e) {
214
+ return e ? (e = n(e), e === r || e === -r ? (e < 0 ? -1 : 1) * i : e === e ? e : 0) : e === 0 ? e : 0;
215
+ }
216
+ t.exports = a;
217
+ })), H = /* @__PURE__ */ d(((e, t) => {
218
+ var n = V();
219
+ function r(e) {
220
+ var t = n(e), r = t % 1;
221
+ return t === t ? r ? t - r : t : 0;
222
+ }
223
+ t.exports = r;
224
+ })), U = /* @__PURE__ */ d(((e, t) => {
225
+ var n = T();
226
+ function r(e) {
227
+ return e == null ? "" : n(e);
228
+ }
229
+ t.exports = r;
230
+ })), W = /* @__PURE__ */ p((/* @__PURE__ */ d(((e, t) => {
231
+ var n = I(), r = M(), i = H(), a = U();
232
+ function o(e, t, o) {
233
+ e = a(e), t = i(t);
234
+ var s = t ? r(e) : 0;
235
+ return t && s < t ? n(t - s, o) + e : e;
236
+ }
237
+ t.exports = o;
238
+ })))(), 1), G = class a {
239
+ static drawCanvas({ canvasElement: t, devicePixelRatio: r, geometry: i, meta: o, palette: s, rowNames: c, rowNamesStartRow: l, scrollLeft: u, scrollTop: d, searchResult: f, searchResultHighlightedIndex: p, selection: m, viewport: h, viewportHeight: g, viewportWidth: _ }) {
240
+ let v = {
241
+ cells: { pathPropertiesMap: /* @__PURE__ */ new Map() },
242
+ divider: { pathPropertiesMap: /* @__PURE__ */ new Map() },
243
+ labels: { pathPropertiesMap: /* @__PURE__ */ new Map() },
244
+ ruler: { pathPropertiesMap: /* @__PURE__ */ new Map() }
245
+ };
246
+ if (!t) return v;
247
+ let y = t.getContext("2d");
248
+ if (!y) return v;
249
+ let b = o.sequenceCount.toString().length, x = (e) => m?.rows?.includes(e) ?? !1, S = (e, t) => !!(m?.cells && t >= m.cells.startCol && t <= m.cells.endCol && e >= m.cells.startRow && e <= m.cells.endRow) || !!m?.cols?.includes(t) || !!x(e), C = f && p !== null ? a.searchHitAt(f, p) : null;
250
+ return a.draw(t, r, () => {
251
+ y.clearRect(0, 0, t.width, t.height);
252
+ let { cellHeight: r, cellWidth: o, dividerWidth: p, labelWidth: w, rulerHeight: T } = i, E = w + p, { bytes: D, cols: O, rows: k, startCol: A, startRow: j } = h, M = (f?.positions.length ?? 0) > 0, N = M ? new Uint8Array(k * O) : null, P = C ? new Uint8Array(k * O) : null, F = M ? new Path2D() : null, I = C ? new Path2D() : null, L = !1, R = !1, z = (e, t) => {
253
+ if (!f) return;
254
+ let n = Math.max(1, f.query.length), r = Math.max(A, e.col), i = Math.min(A + O, e.col + n), o = e.row - j;
255
+ if (o < 0 || o >= k || r >= i || !a.searchHitContainsCell(e, f.query, e.row, r)) return;
256
+ let s = o * O + r - A;
257
+ t.fill(1, s, s + i - r);
258
+ };
259
+ f && N && (f.positions.forEach((e) => z(e, N)), C && P && z(C, P)), y.font = "12px monospace", y.textAlign = "center", y.textBaseline = "middle";
260
+ for (let t = 0; t < k; t++) {
261
+ let i = (j + t) * r + T - d;
262
+ if (!(i + r < T || i > g)) for (let a = 0; a < O; a++) {
263
+ let c = (A + a) * o + E - u;
264
+ if (c + o < E || c > _) continue;
265
+ let l = D[t * O + a], d = A + a, f = j + t, p = l ?? "", m = String.fromCharCode(p), h = e.paletteEntryFor(s, m), g = h.background;
266
+ l === null ? g = "#e9eef2" : m === " " && (g = "#f7f8f9");
267
+ let b = h.foreground;
268
+ S(f, d) && (g = h.backgroundSelected, b = h.foregroundSelected);
269
+ let x = t * O + a, C = N?.[x] === 1, w = P?.[x] === 1, T = new Path2D();
270
+ T.rect(c, i, o, r), T.closePath(), v.cells.pathPropertiesMap.set(T, {
271
+ col: d,
272
+ row: f,
273
+ type: n.CELL
274
+ }), y.fillStyle = g, y.fill(T), w && (y.fillStyle = "rgba(255, 193, 7, 0.35)", y.fillRect(c + 2, i + 2, Math.max(0, o - 4), Math.max(0, r - 4))), y.fillStyle = b, y.fillText(m, c + o / 2, i + r / 2), C && F && (L = !0, F.rect(c + .5, i + .5, o - 1, r - 1), w && I && (R = !0, I.rect(c + 1, i + 1, o - 2, r - 2)));
275
+ }
276
+ }
277
+ L && F && (y.strokeStyle = "#000000", y.lineWidth = 1, y.stroke(F)), R && I && (y.lineWidth = 2, y.stroke(I)), y.fillStyle = "#edf2f6", y.fillRect(0, 0, _, T), y.font = "12px monospace", y.textBaseline = "middle";
278
+ let B = [];
279
+ y.strokeStyle = "#9fb3c8", y.lineWidth = 1, y.beginPath();
280
+ for (let e = 0; e < O; e++) {
281
+ let t = (A + e + 1) % 10 == 0;
282
+ t && B.push(e);
283
+ let r = (A + e) * o + E - u, i = new Path2D();
284
+ i.rect(r, 0, o, T), i.closePath(), v.ruler.pathPropertiesMap.set(i, {
285
+ col: A + e,
286
+ type: n.RULER
287
+ });
288
+ let a = r + .5, s = t ? 8 : 4;
289
+ y.moveTo(a, T), y.lineTo(a, T - s);
290
+ }
291
+ y.stroke(), y.fillStyle = "#486581", y.textAlign = "center", B.forEach((e) => {
292
+ let t = (A + e) * o + E - u, n = String(A + e + 1), r = y.measureText(n).width;
293
+ t - r / 2 < E || t + r / 2 > _ || y.fillText(n, t, T / 2);
294
+ }), y.textAlign = "start", y.strokeStyle = "#bcccdc", y.lineWidth = 1, y.beginPath(), y.moveTo(E + .5, 0), y.lineTo(E + .5, g), y.moveTo(0, T + .5), y.lineTo(_, T + .5), y.stroke(), y.fillStyle = "#edf2f6", y.fillRect(0, 0, E, T), y.fillStyle = "#d9e2ec", y.fillRect(w, 0, p, g);
295
+ let V = new Path2D();
296
+ V.rect(w, 0, p, g), V.closePath(), v.divider.pathPropertiesMap.set(V, { type: n.DIVIDER }), y.fillStyle = "#f8fafb", y.fillRect(0, T, w, g - T), y.font = "12px monospace", y.textBaseline = "middle", y.save(), y.beginPath(), y.rect(0, T, w, g - T), y.clip();
297
+ for (let e = 0; e < k; e++) {
298
+ let t = (j + e) * r + T - d;
299
+ if (t + r < T || t > g) continue;
300
+ let i = new Path2D();
301
+ i.rect(0, t, w, r), i.closePath(), v.labels.pathPropertiesMap.set(i, {
302
+ row: j + e,
303
+ type: n.LABEL
304
+ });
305
+ let a = j + e - l, o = j + e, s = !!m?.cols || !!(m?.cells && o >= m.cells.startRow && o <= m.cells.endRow) || x(o);
306
+ y.fillStyle = s ? "#1565c0" : "#f8fafb", y.fillRect(0, t, w, r), y.fillStyle = s ? "#ffffff" : "#334e68", y.fillText(`${(0, W.default)(String(j + e + 1), b, "0")}: ${c[a] ?? ""}`, 8, t + r / 2);
307
+ }
308
+ y.restore();
309
+ }), v;
310
+ }
311
+ static getExpandedSelection(e, n, r, i) {
312
+ let a = e.cells;
313
+ if (a) {
314
+ if (r === t.LEFT) {
315
+ let e = n.cells;
316
+ if (!e) return null;
317
+ let t = a.startCol < e.startCol || a.endCol <= e.startCol, r = t ? a.startCol - 1 : a.startCol, i = t ? a.endCol : a.endCol - 1;
318
+ return r < 0 ? null : { cells: {
319
+ ...a,
320
+ endCol: i,
321
+ startCol: r
322
+ } };
323
+ }
324
+ if (r === t.RIGHT) {
325
+ let e = n.cells;
326
+ if (!e) return null;
327
+ let t = a.startCol < e.startCol ? a.startCol + 1 : a.startCol, r = a.startCol < e.startCol ? a.endCol : a.endCol + 1;
328
+ return r >= i.alignmentWidth ? null : { cells: {
329
+ ...a,
330
+ endCol: r,
331
+ startCol: t
332
+ } };
333
+ }
334
+ if (r === t.UP) {
335
+ let e = n.cells;
336
+ if (!e) return null;
337
+ let t = a.startRow < e.startRow || a.endRow <= e.startRow, r = t ? a.startRow - 1 : a.startRow, i = t ? a.endRow : a.endRow - 1;
338
+ return r < 0 ? null : { cells: {
339
+ ...a,
340
+ endRow: i,
341
+ startRow: r
342
+ } };
343
+ }
344
+ let e = n.cells;
345
+ if (!e) return null;
346
+ let o = a.startRow < e.startRow ? a.startRow + 1 : a.startRow, s = a.startRow < e.startRow ? a.endRow : a.endRow + 1;
347
+ return s >= i.sequenceCount ? null : { cells: {
348
+ ...a,
349
+ endRow: s,
350
+ startRow: o
351
+ } };
352
+ }
353
+ let o = e.cols;
354
+ if (o) {
355
+ if (o.length === 0 || r !== t.LEFT && r !== t.RIGHT) return null;
356
+ let e = Math.min(...o), a = Math.max(...o), s = n.cols;
357
+ if (!s || s.length === 0) return null;
358
+ let c = Math.min(...s);
359
+ 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;
360
+ }
361
+ return e.rows ? e : null;
362
+ }
363
+ static getMovedSelection(e, n, r) {
364
+ if (!e) return null;
365
+ let i = n === t.LEFT || n === t.UP ? -1 : 1, a = (e, t, n) => i < 0 ? e > 0 : t < n - 1, o = e.cells;
366
+ if (o) return n === t.LEFT || n === t.RIGHT ? a(o.startCol, o.endCol, r.alignmentWidth) ? { cells: {
367
+ endCol: o.endCol + i,
368
+ endRow: o.endRow,
369
+ startCol: o.startCol + i,
370
+ startRow: o.startRow
371
+ } } : null : a(o.startRow, o.endRow, r.sequenceCount) ? { cells: {
372
+ endCol: o.endCol,
373
+ endRow: o.endRow + i,
374
+ startCol: o.startCol,
375
+ startRow: o.startRow + i
376
+ } } : null;
377
+ let s = e.cols;
378
+ if (s) return n !== t.LEFT && n !== t.RIGHT || s.length === 0 || !a(Math.min(...s), Math.max(...s), r.alignmentWidth) ? null : { cols: s.map((e) => e + i) };
379
+ let c = e.rows;
380
+ return c ? n !== t.UP && n !== t.DOWN || c.length === 0 || !a(Math.min(...c), Math.max(...c), r.sequenceCount) ? null : { rows: c.map((e) => e + i) } : null;
381
+ }
382
+ static getMutateArguments(e, t, n = 0) {
383
+ let r = e?.cells;
384
+ if (r) return {
385
+ endCol: r.endCol + n,
386
+ rows: Array.from({ length: r.endRow - r.startRow + 1 }, (e, t) => r.startRow + t),
387
+ startCol: r.startCol + n
388
+ };
389
+ let i = e?.cols;
390
+ if (i) return {
391
+ endCol: i[i.length - 1] + n,
392
+ rows: Array.from({ length: t.sequenceCount }, (e, t) => t),
393
+ startCol: i[0] + n
394
+ };
395
+ let a = e?.rows;
396
+ if (a) return {
397
+ endCol: t.alignmentWidth - 1 + n,
398
+ rows: a,
399
+ startCol: 0 + n
400
+ };
401
+ }
402
+ static getPathPropertiesFromCanvas(e) {
403
+ let { canvas: t, devicePixelRatio: n, editorAssembly: r, event: i } = e, o = a.getCanvasContext(t), s = t.getBoundingClientRect(), c = t.width / s.width, l = t.height / s.height, u = (i.clientX - s.left) * c / n, d = (i.clientY - s.top) * l / n;
404
+ for (let [e, t] of r.cells.pathPropertiesMap) if (o.isPointInPath(e, u, d)) return t;
405
+ for (let [e, t] of r.ruler.pathPropertiesMap) if (o.isPointInPath(e, u, d)) return t;
406
+ for (let [e, t] of r.labels.pathPropertiesMap) if (o.isPointInPath(e, u, d)) return t;
407
+ for (let [e, t] of r.divider.pathPropertiesMap) if (o.isPointInPath(e, u, d)) return t;
408
+ }
409
+ static getPostUpsertSelection(e, n) {
410
+ if (!e) return null;
411
+ let r = n === t.LEFT ? -1 : 1, i = e.cells;
412
+ if (i) return { cells: {
413
+ endCol: i.endCol + r,
414
+ endRow: i.endRow,
415
+ startCol: i.startCol + r,
416
+ startRow: i.startRow
417
+ } };
418
+ let a = e.cols;
419
+ if (a) return { cols: a.map((e) => e + r) };
420
+ let o = e.rows;
421
+ return o ? { rows: o } : null;
422
+ }
423
+ static getRowsToMove(e, n, r) {
424
+ let i = e?.cells, a = e?.rows ?? (i ? Array.from({ length: i.endRow - i.startRow + 1 }, (e, t) => i.startRow + t) : void 0);
425
+ if (!a || a.length === 0) return;
426
+ let o = Math.min(...a), s = Math.max(...a);
427
+ if ((n !== t.UP || o !== 0) && (n !== t.DOWN || s !== r.sequenceCount - 1)) return a;
428
+ }
429
+ static getSelectionFromPathProperties(e) {
430
+ let { endPath: t, startPath: r } = e;
431
+ if (r.type === n.RULER && (t.type === n.RULER || t.type === n.CELL)) {
432
+ let e = Math.min(r.col, t.col), n = Math.max(r.col, t.col);
433
+ return { cols: Array.from({ length: n - e + 1 }, (t, n) => e + n) };
434
+ }
435
+ if (r.type === n.CELL && t.type === n.CELL) return { cells: {
436
+ endCol: Math.max(r.col, t.col),
437
+ endRow: Math.max(r.row, t.row),
438
+ startCol: Math.min(r.col, t.col),
439
+ startRow: Math.min(r.row, t.row)
440
+ } };
441
+ if (r.type === n.LABEL && t.type === n.LABEL) {
442
+ let e = Math.min(r.row, t.row), n = Math.max(r.row, t.row);
443
+ return { rows: Array.from({ length: n - e + 1 }, (t, n) => e + n) };
444
+ }
445
+ }
446
+ static getStatusBarSelectionStats(e, t = null) {
447
+ if (!e) return {
448
+ cols: 0,
449
+ pos: 0,
450
+ selectedSeqs: 0,
451
+ totalSelectedChars: 0
452
+ };
453
+ if (e.cells) {
454
+ let t = e.cells.endCol - e.cells.startCol + 1, n = e.cells.endRow - e.cells.startRow + 1;
455
+ return {
456
+ cols: t,
457
+ pos: e.cells.startCol + 1,
458
+ selectedSeqs: n,
459
+ totalSelectedChars: t * n
460
+ };
461
+ }
462
+ if (e.cols) {
463
+ let n = e.cols.length, r = t?.sequenceCount ?? 0;
464
+ return {
465
+ cols: n,
466
+ pos: e.cols[0] === void 0 ? 0 : e.cols[0] + 1,
467
+ selectedSeqs: r,
468
+ totalSelectedChars: n * r
469
+ };
470
+ }
471
+ let n = e.rows?.length ?? 0, r = t?.alignmentWidth ?? 0;
472
+ return {
473
+ cols: r,
474
+ pos: 0,
475
+ selectedSeqs: n,
476
+ totalSelectedChars: r * n
477
+ };
478
+ }
479
+ static getUpsertArguments(e, t, n = 0) {
480
+ let r = e?.cells;
481
+ if (r) return {
482
+ col: r.startCol + n,
483
+ rows: Array.from({ length: r.endRow - r.startRow + 1 }, (e, t) => r.startRow + t)
484
+ };
485
+ let i = e?.cols;
486
+ if (i) return {
487
+ col: i[0] + n,
488
+ rows: Array.from({ length: t.sequenceCount }, (e, t) => t)
489
+ };
490
+ let a = e?.rows;
491
+ if (a) return {
492
+ col: 0 + n,
493
+ rows: a
494
+ };
495
+ }
496
+ static getVisibleGridRange(e) {
497
+ let { geometry: t = i, numCols: n, numRows: r, scrollLeft: a, scrollTop: o, viewportHeight: s, viewportWidth: c } = e, l = t.labelWidth + t.dividerWidth, u = Math.max(0, Math.floor(a / 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, o - t.rulerHeight) / t.cellHeight)), p = Math.min(r, f + Math.max(1, Math.ceil((s - t.rulerHeight) / t.cellHeight) + 1));
498
+ return {
499
+ cache: {
500
+ endCol: Math.min(n, d + t.numOverscanCols),
501
+ endRow: Math.min(r, p + t.numOverscanRows),
502
+ startCol: Math.max(0, u - t.numOverscanCols),
503
+ startRow: Math.max(0, f - t.numOverscanRows)
504
+ },
505
+ visible: {
506
+ endCol: d,
507
+ endRow: p,
508
+ startCol: u,
509
+ startRow: f
510
+ }
511
+ };
512
+ }
513
+ static isWithinGridRange(e) {
514
+ let { cachedGridRange: t, visibleGridRange: n } = e;
515
+ return n.startCol >= t.startCol && n.endCol <= t.endCol && n.startRow >= t.startRow && n.endRow <= t.endRow;
516
+ }
517
+ static scrollToPosition(e) {
518
+ let { geometry: t, scrollContainer: n, x: r, y: i } = e;
519
+ n && n.scrollTo({
520
+ left: r === null ? n.scrollLeft : Math.max(0, r - 1) * t.cellWidth,
521
+ top: i === null ? n.scrollTop : Math.max(0, i - 1) * t.cellHeight
522
+ });
523
+ }
524
+ static scrollToSearchResult(e) {
525
+ let { geometry: t, scrollContainer: n, searchResult: r, searchResultHighlightedIndex: i } = e, o = r && i !== null ? a.searchHitAt(r, i) : null;
526
+ o && a.scrollToPosition({
527
+ geometry: t,
528
+ scrollContainer: n,
529
+ x: o.col + 1,
530
+ y: o.row + 1
531
+ });
532
+ }
533
+ static draw(e, t, n) {
534
+ let r = a.getCanvasContext(e);
535
+ r.setTransform(t, 0, 0, t, 0, 0), n(r), r.setTransform(1, 0, 0, 1, 0, 0);
536
+ }
537
+ static getCanvasContext(e) {
538
+ let t = e.getContext("2d");
539
+ if (!t) throw Error("Failed to acquire 2D canvas context.");
540
+ return t;
541
+ }
542
+ static searchHitAt(e, t) {
543
+ return e?.positions[t] ?? null;
544
+ }
545
+ static searchHitContainsCell(e, t, n, i) {
546
+ return e.matrix_type === r.NUCLEOTIDE && e.row === n && i >= e.col && i < e.col + Math.max(1, t.length);
547
+ }
548
+ };
549
+ //#endregion
550
+ export { G as EditorUtil };
551
+
552
+ //# sourceMappingURL=index.js.map