@rivm-loculus-tools/sequence-editor 0.1.3 → 0.1.5

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