@rivm-loculus-tools/sequence-editor 1.9.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 (72) hide show
  1. package/dist/_chunks/EngineErrorUtil.js.map +1 -1
  2. package/dist/_chunks/EngineWorker.js +1 -1
  3. package/dist/_chunks/EngineWorker.js.map +1 -1
  4. package/dist/_chunks/SequenceEditor.js +520 -488
  5. package/dist/_chunks/SequenceEditor.js.map +1 -1
  6. package/dist/_chunks/SequenceEditorEventBusService.js +5 -5
  7. package/dist/_chunks/SequenceEditorEventBusService.js.map +1 -1
  8. package/dist/_chunks/SequenceEditorPageDrawer.js +462 -693
  9. package/dist/_chunks/SequenceEditorPageDrawer.js.map +1 -1
  10. package/dist/_chunks/react.js +1 -1
  11. package/dist/_chunks/react.js.map +1 -1
  12. package/dist/_chunks/sequenceEditorStore.js +84 -85
  13. package/dist/_chunks/sequenceEditorStore.js.map +1 -1
  14. package/dist/_chunks/sequence_editor.js +131 -104
  15. package/dist/_chunks/sequence_editor.js.map +1 -1
  16. package/dist/assets/AlignerWorker-DkAbHwjR.js +8 -0
  17. package/dist/assets/AlignerWorker-DkAbHwjR.js.map +1 -0
  18. package/dist/assets/index-CKWZNkQe.js +8 -0
  19. package/dist/assets/index-CKWZNkQe.js.map +1 -0
  20. package/dist/classes/services/EditorWorkerService/EditorWorkerService.d.ts +18 -19
  21. package/dist/classes/services/EditorWorkerService/index.js +76 -99
  22. package/dist/classes/services/EditorWorkerService/index.js.map +1 -1
  23. package/dist/classes/services/SequenceEditorEventBusService/SequenceEditorEventBusService.d.ts +2 -0
  24. package/dist/classes/workers/AlignerWorker/index.js.map +1 -1
  25. package/dist/classes/workers/EngineWorker/EngineWorker.d.ts +19 -17
  26. package/dist/classes/workers/EngineWorker/index.js +78 -30
  27. package/dist/classes/workers/EngineWorker/index.js.map +1 -1
  28. package/dist/components/app/SequenceEditorApp/index.js +10 -10
  29. package/dist/components/app/SequenceEditorApp/index.js.map +1 -1
  30. package/dist/components/ui/SequenceActionsBar/SequenceActionsBar.d.ts +1 -0
  31. package/dist/components/ui/SequenceActionsBar/index.d.ts +1 -0
  32. package/dist/components/ui/SequenceActionsBar/index.js +113 -0
  33. package/dist/components/ui/SequenceActionsBar/index.js.map +1 -0
  34. package/dist/components/ui/SequenceEditorMenu/SequenceEditorMenu.d.ts +1 -0
  35. package/dist/components/ui/SequenceEditorMenu/index.d.ts +1 -0
  36. package/dist/components/ui/SequenceEditorMenu/index.js +198 -0
  37. package/dist/components/ui/SequenceEditorMenu/index.js.map +1 -0
  38. package/dist/components/ui/SequenceEditorPageHeader/index.js +86 -1
  39. package/dist/components/ui/SequenceEditorPageHeader/index.js.map +1 -0
  40. package/dist/components/ui/SequenceEditorRealignModal/index.js +13 -13
  41. package/dist/components/ui/SequenceEditorRealignModal/index.js.map +1 -1
  42. package/dist/components/ui/SequenceEditorSearchBar/index.js +25 -21
  43. package/dist/components/ui/SequenceEditorSearchBar/index.js.map +1 -1
  44. package/dist/constants/keyboard.js +26 -26
  45. package/dist/constants/keyboard.js.map +1 -1
  46. package/dist/constants/palette.js +147 -147
  47. package/dist/constants/palette.js.map +1 -1
  48. package/dist/models/config.models.d.ts +1 -0
  49. package/dist/models/editor.models.d.ts +34 -26
  50. package/dist/models/editor.models.js +3 -1
  51. package/dist/models/editor.models.js.map +1 -1
  52. package/dist/models/palette.models.js.map +1 -1
  53. package/dist/pages/SequenceEditorMainPage/index.js +20 -20
  54. package/dist/pages/SequenceEditorMainPage/index.js.map +1 -1
  55. package/dist/stores/sequenceEditorStore/sequenceEditorStore.d.ts +4 -2
  56. package/dist/theme/demoTheme/index.js +5 -5
  57. package/dist/theme/demoTheme/index.js.map +1 -1
  58. package/dist/utils/EditorUtil/EditorUtil.d.ts +10 -3
  59. package/dist/utils/EditorUtil/index.js +360 -275
  60. package/dist/utils/EditorUtil/index.js.map +1 -1
  61. package/dist/utils/PaletteUtil/index.js.map +1 -1
  62. package/dist/utils/SequenceEditorStandardConfigUtil/index.js +6 -6
  63. package/dist/utils/SequenceEditorStandardConfigUtil/index.js.map +1 -1
  64. package/dist/vite/paletteSchemaPlugin/index.js.map +1 -1
  65. package/package.json +22 -22
  66. package/dist/_chunks/SequenceEditorPageHeader.js +0 -123
  67. package/dist/_chunks/SequenceEditorPageHeader.js.map +0 -1
  68. package/dist/assets/AlignerWorker-cbSDVRKB.js +0 -8
  69. package/dist/assets/AlignerWorker-cbSDVRKB.js.map +0 -1
  70. package/dist/assets/index--BqOy4u7.js +0 -8
  71. package/dist/assets/index--BqOy4u7.js.map +0 -1
  72. package/dist/components/ui/SequenceEditorPageDrawer/SequenceEditorPageDrawerKeyboardShortcuts.d.ts +0 -1
@@ -1,9 +1,10 @@
1
- import { CUSTOM_PALETTE_NAME as e } from "../models/palette.models.js";
2
- import { ALI_VIEW_DEFAULT_AMINO_ACID_PALETTE as t, ALI_VIEW_DEFAULT_NUCLEOTIDE_PALETTE as n } from "../constants/palette.js";
1
+ import { createFastaDataStoreActions as e, createFastaDataStoreInitialState as t } from "@rivm-loculus-tools/common-frontend/stores/fastaDataStore";
2
+ import { READING_MODE as n } from "../models/editor.models.js";
3
3
  import "../constants/index.js";
4
- import { createFastaDataStoreActions as r, createFastaDataStoreInitialState as i } from "@rivm-loculus-tools/common-frontend/stores/fastaDataStore";
5
- // ../../../../node_modules/.pnpm/zustand@5.0.16_@types+react@19.3.0_react@19.3.1_use-sync-external-store@1.7.0_react@19.3.1_/node_modules/zustand/esm/vanilla.mjs
6
- var a = (e) => {
4
+ import { ALI_VIEW_DEFAULT_AMINO_ACID_PALETTE as r, ALI_VIEW_DEFAULT_NUCLEOTIDE_PALETTE as i } from "../constants/palette.js";
5
+ import { CUSTOM_PALETTE_NAME as a } from "../models/palette.models.js";
6
+ // ../../../../node_modules/.pnpm/zustand@5.1.0_@types+react@19.3.3_react@19.3.1_use-sync-external-store@1.7.0_react@19.3.1_/node_modules/zustand/esm/vanilla.mjs
7
+ var o = (e) => {
7
8
  let t, n = /* @__PURE__ */ new Set(), r = (e, r) => {
8
9
  let i = typeof e == "function" ? e(t) : e;
9
10
  if (!Object.is(i, t)) {
@@ -17,9 +18,9 @@ var a = (e) => {
17
18
  subscribe: (e) => (n.add(e), () => n.delete(e))
18
19
  }, o = t = e(r, i, a);
19
20
  return a;
20
- }, o = ((e) => e ? a(e) : a);
21
- // ../../../../node_modules/.pnpm/zustand@5.0.16_@types+react@19.3.0_react@19.3.1_use-sync-external-store@1.7.0_react@19.3.1_/node_modules/zustand/esm/middleware.mjs
22
- function s(e, t) {
21
+ }, s = ((e) => e ? o(e) : o);
22
+ // ../../../../node_modules/.pnpm/zustand@5.1.0_@types+react@19.3.3_react@19.3.1_use-sync-external-store@1.7.0_react@19.3.1_/node_modules/zustand/esm/middleware.mjs
23
+ function c(e, t) {
23
24
  let n;
24
25
  try {
25
26
  n = e();
@@ -29,36 +30,26 @@ function s(e, t) {
29
30
  return {
30
31
  getItem: (e) => {
31
32
  let r = (e) => e === null ? null : JSON.parse(e, t?.reviver), i = n.getItem(e) ?? null;
32
- return i instanceof Promise ? i.then(r) : r(i);
33
+ return l(i) ? i.then(r) : r(i);
33
34
  },
34
35
  setItem: (e, r) => n.setItem(e, JSON.stringify(r, t?.replacer)),
35
36
  removeItem: (e) => n.removeItem(e)
36
37
  };
37
38
  }
38
- var c = (e) => (t) => {
39
+ var l = (e) => typeof e?.then == "function", u = (e) => ({ then(t) {
40
+ return t ? d(t)(e) : this;
41
+ } }), d = (e) => (t) => {
39
42
  try {
40
43
  let n = e(t);
41
- return n instanceof Promise ? n : {
42
- then(e) {
43
- return c(e)(n);
44
- },
45
- catch(e) {
46
- return this;
47
- }
48
- };
44
+ return l(n) ? n : u(n);
49
45
  } catch (e) {
50
- return {
51
- then(e) {
52
- return this;
53
- },
54
- catch(t) {
55
- return c(t)(e);
56
- }
57
- };
46
+ return { then(t, n) {
47
+ return n ? d(n)(e) : this;
48
+ } };
58
49
  }
59
- }, l = (e, t) => (n, r, i) => {
50
+ }, f = (e, t) => (n, r, i) => {
60
51
  let a = {
61
- storage: s(() => window.localStorage),
52
+ storage: c(() => window.localStorage),
62
53
  partialize: (e) => e,
63
54
  version: 0,
64
55
  merge: (e, t) => ({
@@ -66,44 +57,44 @@ var c = (e) => (t) => {
66
57
  ...e
67
58
  }),
68
59
  ...t
69
- }, o = !1, l = 0, u = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set(), f = a.storage;
70
- if (!f) return e((...e) => {
60
+ }, o = !1, s = 0, u = /* @__PURE__ */ new Set(), f = /* @__PURE__ */ new Set(), p = a.storage;
61
+ if (!p) return e((...e) => {
71
62
  console.warn(`[zustand persist middleware] Unable to update item '${a.name}', the given storage is currently unavailable.`), n(...e);
72
63
  }, r, i);
73
- let p = () => {
64
+ let m = () => {
74
65
  let e = a.partialize({ ...r() });
75
- return f.setItem(a.name, {
66
+ return p.setItem(a.name, {
76
67
  state: e,
77
68
  version: a.version
78
69
  });
79
- }, m = i.setState;
80
- i.setState = (...e) => (m(...e), p());
81
- let h = e((...e) => (n(...e), p()), r, i);
82
- i.getInitialState = () => h;
83
- let g, _ = () => {
84
- if (!f) return;
85
- let e = ++l;
86
- o = !1, u.forEach((e) => e(r() ?? h));
87
- let t = a.onRehydrateStorage?.call(a, r() ?? h) || void 0;
88
- return c(f.getItem.bind(f))(a.name).then((e) => {
70
+ }, h = i.setState;
71
+ i.setState = (...e) => (h(...e), m());
72
+ let g = e((...e) => (n(...e), m()), r, i);
73
+ i.getInitialState = () => g;
74
+ let _, v = () => {
75
+ if (!p) return;
76
+ let e = ++s;
77
+ o = !1, u.forEach((e) => e(r() ?? g));
78
+ let t = a.onRehydrateStorage?.call(a, r() ?? g) || void 0;
79
+ return d(p.getItem.bind(p))(a.name).then((e) => {
89
80
  if (e) {
90
81
  if (typeof e.version == "number" && e.version !== a.version) {
91
82
  if (a.migrate) {
92
83
  let t = a.migrate(e.state, e.version);
93
- return t instanceof Promise ? t.then((e) => [!0, e]) : [!0, t];
84
+ return l(t) ? t.then((e) => [!0, e]) : [!0, t];
94
85
  }
95
86
  console.error("State loaded from storage couldn't be migrated since no migrate function was provided");
96
87
  } else return [!1, e.state];
97
88
  }
98
89
  return [!1, void 0];
99
90
  }).then((t) => {
100
- if (e !== l) return;
91
+ if (e !== s) return;
101
92
  let [i, o] = t;
102
- if (g = a.merge(o, r() ?? h), n(g, !0), i) return p();
93
+ if (_ = a.merge(o, r() ?? g), n(_, !0), i) return m();
103
94
  }).then(() => {
104
- e === l && (t?.(r(), void 0), g = r(), o = !0, d.forEach((e) => e(g)));
105
- }).catch((n) => {
106
- e === l && t?.(void 0, n);
95
+ e === s && (t?.(r(), void 0), _ = r(), o = !0, f.forEach((e) => e(_)));
96
+ }).then(() => void 0, (n) => {
97
+ e === s && t?.(void 0, n);
107
98
  });
108
99
  };
109
100
  return i.persist = {
@@ -111,69 +102,77 @@ var c = (e) => (t) => {
111
102
  a = {
112
103
  ...a,
113
104
  ...e
114
- }, e.storage && (f = e.storage);
105
+ }, e.storage && (p = e.storage);
115
106
  },
116
107
  clearStorage: () => {
117
- ++l, f?.removeItem(a.name);
108
+ ++s, p?.removeItem(a.name);
118
109
  },
119
110
  getOptions: () => a,
120
- rehydrate: () => _(),
111
+ rehydrate: () => {
112
+ try {
113
+ return Promise.resolve(v());
114
+ } catch (e) {
115
+ return Promise.reject(e);
116
+ }
117
+ },
121
118
  hasHydrated: () => o,
122
119
  onHydrate: (e) => (u.add(e), () => {
123
120
  u.delete(e);
124
121
  }),
125
- onFinishHydration: (e) => (d.add(e), () => {
126
- d.delete(e);
122
+ onFinishHydration: (e) => (f.add(e), () => {
123
+ f.delete(e);
127
124
  })
128
- }, a.skipHydration || _(), g || h;
129
- }, u = () => ({
130
- ...i(),
131
- aminoAcidPalette: t,
125
+ }, a.skipHydration || v(), _ || g;
126
+ }, p = () => ({
127
+ ...t(),
128
+ aminoAcidPalette: r,
132
129
  customAminoAcidPalette: {
133
- name: e,
134
- paletteColors: { ...t.paletteColors }
130
+ name: a,
131
+ paletteColors: { ...r.paletteColors }
135
132
  },
136
133
  customNucleotidePalette: {
137
- name: e,
138
- paletteColors: { ...n.paletteColors }
134
+ name: a,
135
+ paletteColors: { ...i.paletteColors }
139
136
  },
140
137
  engineMeta: null,
141
138
  isRealigning: !1,
142
139
  latestMessage: null,
143
- nucleotidePalette: n,
140
+ nucleotidePalette: i,
141
+ readingFrame: 1,
142
+ readingMode: n.NUCLEOTIDE,
144
143
  searchQuery: "",
145
144
  searchResult: null,
146
145
  searchResultHighlightedIndex: null,
147
146
  selection: null
148
- }), d = o()(l((e, t) => {
149
- let n = u(), i = r({
150
- get: t,
151
- set: e
147
+ }), m = s()(f((t, n) => {
148
+ let r = p(), i = e({
149
+ get: n,
150
+ set: t
152
151
  });
153
152
  return {
154
- ...n,
153
+ ...r,
155
154
  ...i,
156
155
  resetDataset: () => {
157
- let { setSearchQuery: e } = t();
156
+ let { setSearchQuery: e } = n();
158
157
  i.resetDataset(), e("");
159
158
  },
160
- setAminoAcidPalette: (t) => e({ aminoAcidPalette: t }),
161
- setCustomAminoAcidPalette: (t) => e({ customAminoAcidPalette: t }),
162
- setCustomNucleotidePalette: (t) => e({ customNucleotidePalette: t }),
163
- setEngineMeta: (t) => e({ engineMeta: t }),
164
- setIsRealigning: (t) => e({ isRealigning: t }),
165
- setLatestMessage: (t) => e({ latestMessage: t }),
166
- setNucleotidePalette: (t) => e({ nucleotidePalette: t }),
167
- setSearchQuery: (n) => {
168
- let { setSearchResult: r, setSearchResultHighlightedIndex: i } = t();
169
- e({ searchQuery: n }), n || (i(null), r(null));
159
+ setAminoAcidPalette: (e) => t({ aminoAcidPalette: e }),
160
+ setCustomAminoAcidPalette: (e) => t({ customAminoAcidPalette: e }),
161
+ setCustomNucleotidePalette: (e) => t({ customNucleotidePalette: e }),
162
+ setEngineMeta: (e) => t({ engineMeta: e }),
163
+ setIsRealigning: (e) => t({ isRealigning: e }),
164
+ setLatestMessage: (e) => t({ latestMessage: e }),
165
+ setNucleotidePalette: (e) => t({ nucleotidePalette: e }),
166
+ setSearchQuery: (e) => {
167
+ let { setSearchResult: r, setSearchResultHighlightedIndex: i } = n();
168
+ t({ searchQuery: e }), e || (i(null), r(null));
170
169
  },
171
- setSearchResult: (n) => {
172
- let { setSearchResultHighlightedIndex: r } = t();
173
- e({ searchResult: n }), r(null);
170
+ setSearchResult: (e) => {
171
+ let { setSearchResultHighlightedIndex: r } = n();
172
+ t({ searchResult: e }), r(null);
174
173
  },
175
- setSearchResultHighlightedIndex: (t) => e({ searchResultHighlightedIndex: t }),
176
- setSelection: (t) => e({ selection: t })
174
+ setSearchResultHighlightedIndex: (e) => t({ searchResultHighlightedIndex: e }),
175
+ setSelection: (e) => t({ selection: e })
177
176
  };
178
177
  }, {
179
178
  name: "LOCULUS-SEQUENCE-EDITOR-Configuration",
@@ -183,9 +182,9 @@ var c = (e) => (t) => {
183
182
  customNucleotidePalette: e.customNucleotidePalette,
184
183
  nucleotidePalette: e.nucleotidePalette
185
184
  }),
186
- storage: s(() => localStorage),
185
+ storage: c(() => localStorage),
187
186
  version: 1
188
187
  }));
189
- export { d as t };
188
+ export { m as t };
190
189
 
191
190
  //# sourceMappingURL=sequenceEditorStore.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sequenceEditorStore.js","names":["createStoreImpl","state","listeners","setState","nextState","partial","previousState","replace","listener","getState","api","initialState","createState","createStore","createJSONStorage","storage","getStorage","parse","str2","options","str","name","newValue","toThenable","result","fn","input","onFulfilled","onRejected","persist","currentState","persistedState","baseOptions","hasHydrated","hydrationVersion","hydrationListeners","finishHydrationListeners","config","args","set","get","setItem","savedSetState","configResult","stateFromStorage","hydrate","currentVersion","cb","postRehydrationCallback","deserializedStorageValue","migration","migrated","migratedState","migrationResult","e","newOptions","createSequenceEditorStoreInitialState","createFastaDataStoreInitialState","ALI_VIEW_DEFAULT_AMINO_ACID_PALETTE","CUSTOM_PALETTE_NAME","ALI_VIEW_DEFAULT_NUCLEOTIDE_PALETTE","sequenceEditorStore","fastaDataStoreActions","createFastaDataStoreActions","setSearchQuery","palette","message","setSearchResultsHighlightedIndex","query","setSearchResult","results","index"],"sources":["../../../../../../node_modules/.pnpm/zustand@5.0.16_@types+react@19.3.0_react@19.3.1_use-sync-external-store@1.7.0_react@19.3.1_/node_modules/zustand/esm/vanilla.mjs","../../../../../../node_modules/.pnpm/zustand@5.0.16_@types+react@19.3.0_react@19.3.1_use-sync-external-store@1.7.0_react@19.3.1_/node_modules/zustand/esm/middleware.mjs","../../src/stores/sequenceEditorStore/sequenceEditorStore.ts"],"sourcesContent":["const createStoreImpl = (createState) => {\n let state;\n const listeners = /* @__PURE__ */ new Set();\n const setState = (partial, replace) => {\n const nextState = typeof partial === \"function\" ? partial(state) : partial;\n if (!Object.is(nextState, state)) {\n const previousState = state;\n state = (replace != null ? replace : typeof nextState !== \"object\" || nextState === null) ? nextState : Object.assign({}, state, nextState);\n listeners.forEach((listener) => listener(state, previousState));\n }\n };\n const getState = () => state;\n const getInitialState = () => initialState;\n const subscribe = (listener) => {\n listeners.add(listener);\n return () => listeners.delete(listener);\n };\n const api = { setState, getState, getInitialState, subscribe };\n const initialState = state = createState(setState, getState, api);\n return api;\n};\nconst createStore = ((createState) => createState ? createStoreImpl(createState) : createStoreImpl);\n\nexport { createStore };\n","const reduxImpl = (reducer, initial) => (set, _get, api) => {\n api.dispatch = (action) => {\n set((state) => reducer(state, action), false, action);\n return action;\n };\n api.dispatchFromDevtools = true;\n return { dispatch: (...args) => api.dispatch(...args), ...initial };\n};\nconst redux = reduxImpl;\n\nconst shouldDispatchFromDevtools = (api) => !!api.dispatchFromDevtools && typeof api.dispatch === \"function\";\nconst trackedConnections = /* @__PURE__ */ new Map();\nconst getTrackedConnectionState = (name) => {\n const api = trackedConnections.get(name);\n if (!api) return {};\n return Object.fromEntries(\n Object.entries(api.stores).map(([key, api2]) => [key, api2.getState()])\n );\n};\nconst extractConnectionInformation = (store, extensionConnector, options) => {\n if (store === void 0) {\n return {\n type: \"untracked\",\n connection: extensionConnector.connect(options)\n };\n }\n const existingConnection = trackedConnections.get(options.name);\n if (existingConnection) {\n return { type: \"tracked\", store, ...existingConnection };\n }\n const newConnection = {\n connection: extensionConnector.connect(options),\n stores: {}\n };\n trackedConnections.set(options.name, newConnection);\n return { type: \"tracked\", store, ...newConnection };\n};\nconst removeStoreFromTrackedConnections = (name, store, api) => {\n if (store === void 0) return;\n const connectionInfo = trackedConnections.get(name);\n if ((connectionInfo == null ? void 0 : connectionInfo.stores[store]) !== api) return;\n delete connectionInfo.stores[store];\n if (Object.keys(connectionInfo.stores).length === 0) {\n trackedConnections.delete(name);\n }\n};\nconst v8StackLineRe = /^at (?:new |async )?(.+?) \\(/;\nconst geckoStackLineRe = /^([^@]+)@/;\nfunction findCallerName(stack) {\n var _a, _b, _c;\n if (!stack) return void 0;\n const traceLines = stack.split(\"\\n\");\n const apiSetStateLineIndex = traceLines.findIndex(\n (traceLine) => traceLine.includes(\"api.setState\")\n );\n if (apiSetStateLineIndex < 0) return void 0;\n const callerLine = ((_a = traceLines[apiSetStateLineIndex + 1]) == null ? void 0 : _a.trim()) || \"\";\n return ((_b = v8StackLineRe.exec(callerLine)) == null ? void 0 : _b[1]) || ((_c = geckoStackLineRe.exec(callerLine)) == null ? void 0 : _c[1]);\n}\nconst devtoolsImpl = (fn, devtoolsOptions = {}) => (set, get, api) => {\n const { enabled, anonymousActionType, store, ...options } = devtoolsOptions;\n let extensionConnector;\n try {\n extensionConnector = (enabled != null ? enabled : (import.meta.env ? import.meta.env.MODE : void 0) !== \"production\") && window.__REDUX_DEVTOOLS_EXTENSION__;\n } catch (e) {\n }\n if (!extensionConnector) {\n return fn(set, get, api);\n }\n const { connection, ...connectionInformation } = extractConnectionInformation(store, extensionConnector, options);\n let isRecording = true;\n api.setState = ((state, replace, nameOrAction) => {\n const r = set(state, replace);\n if (!isRecording) return r;\n const action = nameOrAction === void 0 ? {\n type: anonymousActionType || findCallerName(new Error().stack) || \"anonymous\"\n } : typeof nameOrAction === \"string\" ? { type: nameOrAction } : nameOrAction;\n if (store === void 0) {\n connection == null ? void 0 : connection.send(action, get());\n return r;\n }\n connection == null ? void 0 : connection.send(\n {\n ...action,\n type: `${store}/${action.type}`\n },\n {\n ...getTrackedConnectionState(options.name),\n [store]: api.getState()\n }\n );\n return r;\n });\n let unsubscribeFromStore;\n api.devtools = {\n cleanup: () => {\n unsubscribeFromStore == null ? void 0 : unsubscribeFromStore();\n unsubscribeFromStore = void 0;\n removeStoreFromTrackedConnections(options.name, store, api);\n if ((store === void 0 || !trackedConnections.has(options.name)) && connection && typeof connection.unsubscribe === \"function\") {\n connection.unsubscribe();\n }\n }\n };\n const setStateFromDevtools = (...a) => {\n const originalIsRecording = isRecording;\n isRecording = false;\n set(...a);\n isRecording = originalIsRecording;\n };\n const initialState = fn(api.setState, get, api);\n if (connectionInformation.type === \"untracked\") {\n connection == null ? void 0 : connection.init(initialState);\n } else {\n connectionInformation.stores[connectionInformation.store] = api;\n connection == null ? void 0 : connection.init(\n Object.fromEntries(\n Object.entries(connectionInformation.stores).map(([key, store2]) => [\n key,\n key === connectionInformation.store ? initialState : store2.getState()\n ])\n )\n );\n }\n if (shouldDispatchFromDevtools(api)) {\n let didWarnAboutReservedActionType = false;\n const originalDispatch = api.dispatch;\n api.dispatch = (...args) => {\n if ((import.meta.env ? import.meta.env.MODE : void 0) !== \"production\" && args[0].type === \"__setState\" && !didWarnAboutReservedActionType) {\n console.warn(\n '[zustand devtools middleware] \"__setState\" action type is reserved to set state from the devtools. Avoid using it.'\n );\n didWarnAboutReservedActionType = true;\n }\n originalDispatch(...args);\n };\n }\n unsubscribeFromStore = connection.subscribe((message) => {\n var _a;\n const reviver = typeof options.serialize === \"object\" ? options.serialize.reviver : void 0;\n switch (message.type) {\n case \"ACTION\":\n if (typeof message.payload !== \"string\") {\n console.error(\n \"[zustand devtools middleware] Unsupported action format\"\n );\n return;\n }\n return parseJsonThen(\n message.payload,\n reviver,\n (action) => {\n if (action.type === \"__setState\") {\n if (store === void 0) {\n setStateFromDevtools(action.state);\n return;\n }\n if (Object.keys(action.state).length !== 1) {\n console.error(\n `\n [zustand devtools middleware] Unsupported __setState action format.\n When using 'store' option in devtools(), the 'state' should have only one key, which is a value of 'store' that was passed in devtools(),\n and value of this only key should be a state object. Example: { \"type\": \"__setState\", \"state\": { \"abc123Store\": { \"foo\": \"bar\" } } }\n `\n );\n }\n const stateFromDevtools = action.state[store];\n if (stateFromDevtools === void 0 || stateFromDevtools === null) {\n return;\n }\n if (JSON.stringify(api.getState()) !== JSON.stringify(stateFromDevtools)) {\n setStateFromDevtools(stateFromDevtools);\n }\n return;\n }\n if (shouldDispatchFromDevtools(api)) {\n api.dispatch(action);\n }\n }\n );\n case \"DISPATCH\":\n switch (message.payload.type) {\n case \"RESET\":\n setStateFromDevtools(initialState);\n if (store === void 0) {\n return connection == null ? void 0 : connection.init(api.getState());\n }\n return connection == null ? void 0 : connection.init(getTrackedConnectionState(options.name));\n case \"COMMIT\":\n if (store === void 0) {\n connection == null ? void 0 : connection.init(api.getState());\n return;\n }\n return connection == null ? void 0 : connection.init(getTrackedConnectionState(options.name));\n case \"ROLLBACK\":\n return parseJsonThen(message.state, reviver, (state) => {\n if (store === void 0) {\n setStateFromDevtools(state);\n connection == null ? void 0 : connection.init(api.getState());\n return;\n }\n setStateFromDevtools(state[store]);\n connection == null ? void 0 : connection.init(getTrackedConnectionState(options.name));\n });\n case \"JUMP_TO_STATE\":\n case \"JUMP_TO_ACTION\":\n return parseJsonThen(message.state, reviver, (state) => {\n if (store === void 0) {\n setStateFromDevtools(state);\n return;\n }\n if (JSON.stringify(api.getState()) !== JSON.stringify(state[store])) {\n setStateFromDevtools(state[store]);\n }\n });\n case \"IMPORT_STATE\": {\n const { nextLiftedState } = message.payload;\n const lastComputedState = (_a = nextLiftedState.computedStates.slice(-1)[0]) == null ? void 0 : _a.state;\n if (!lastComputedState) return;\n if (store === void 0) {\n setStateFromDevtools(lastComputedState);\n } else {\n setStateFromDevtools(lastComputedState[store]);\n }\n connection == null ? void 0 : connection.send(\n null,\n // FIXME no-any\n nextLiftedState\n );\n return;\n }\n case \"PAUSE_RECORDING\":\n return isRecording = !isRecording;\n }\n return;\n }\n });\n return initialState;\n};\nconst devtools = devtoolsImpl;\nconst parseJsonThen = (stringified, reviver, fn) => {\n let parsed;\n try {\n parsed = JSON.parse(stringified, reviver);\n } catch (e) {\n console.error(\n \"[zustand devtools middleware] Could not parse the received json\",\n e\n );\n }\n if (parsed !== void 0) fn(parsed);\n};\n\nconst subscribeWithSelectorImpl = (fn) => (set, get, api) => {\n const origSubscribe = api.subscribe;\n api.subscribe = ((selector, optListener, options) => {\n let listener = selector;\n if (optListener) {\n const equalityFn = (options == null ? void 0 : options.equalityFn) || Object.is;\n let currentSlice = selector(api.getState());\n listener = (state) => {\n const nextSlice = selector(state);\n if (!equalityFn(currentSlice, nextSlice)) {\n const previousSlice = currentSlice;\n optListener(currentSlice = nextSlice, previousSlice);\n }\n };\n if (options == null ? void 0 : options.fireImmediately) {\n optListener(currentSlice, currentSlice);\n }\n }\n return origSubscribe(listener);\n });\n const initialState = fn(set, get, api);\n return initialState;\n};\nconst subscribeWithSelector = subscribeWithSelectorImpl;\n\nfunction combine(initialState, create) {\n return (...args) => Object.assign({}, initialState, create(...args));\n}\n\nfunction createJSONStorage(getStorage, options) {\n let storage;\n try {\n storage = getStorage();\n } catch (e) {\n return;\n }\n const persistStorage = {\n getItem: (name) => {\n var _a;\n const parse = (str2) => {\n if (str2 === null) {\n return null;\n }\n return JSON.parse(str2, options == null ? void 0 : options.reviver);\n };\n const str = (_a = storage.getItem(name)) != null ? _a : null;\n if (str instanceof Promise) {\n return str.then(parse);\n }\n return parse(str);\n },\n setItem: (name, newValue) => storage.setItem(name, JSON.stringify(newValue, options == null ? void 0 : options.replacer)),\n removeItem: (name) => storage.removeItem(name)\n };\n return persistStorage;\n}\nconst toThenable = (fn) => (input) => {\n try {\n const result = fn(input);\n if (result instanceof Promise) {\n return result;\n }\n return {\n then(onFulfilled) {\n return toThenable(onFulfilled)(result);\n },\n catch(_onRejected) {\n return this;\n }\n };\n } catch (e) {\n return {\n then(_onFulfilled) {\n return this;\n },\n catch(onRejected) {\n return toThenable(onRejected)(e);\n }\n };\n }\n};\nconst persistImpl = (config, baseOptions) => (set, get, api) => {\n let options = {\n storage: createJSONStorage(() => window.localStorage),\n partialize: (state) => state,\n version: 0,\n merge: (persistedState, currentState) => ({\n ...currentState,\n ...persistedState\n }),\n ...baseOptions\n };\n let hasHydrated = false;\n let hydrationVersion = 0;\n const hydrationListeners = /* @__PURE__ */ new Set();\n const finishHydrationListeners = /* @__PURE__ */ new Set();\n let storage = options.storage;\n if (!storage) {\n return config(\n (...args) => {\n console.warn(\n `[zustand persist middleware] Unable to update item '${options.name}', the given storage is currently unavailable.`\n );\n set(...args);\n },\n get,\n api\n );\n }\n const setItem = () => {\n const state = options.partialize({ ...get() });\n return storage.setItem(options.name, {\n state,\n version: options.version\n });\n };\n const savedSetState = api.setState;\n api.setState = (...args) => {\n savedSetState(...args);\n return setItem();\n };\n const configResult = config(\n (...args) => {\n set(...args);\n return setItem();\n },\n get,\n api\n );\n api.getInitialState = () => configResult;\n let stateFromStorage;\n const hydrate = () => {\n var _a, _b;\n if (!storage) return;\n const currentVersion = ++hydrationVersion;\n hasHydrated = false;\n hydrationListeners.forEach((cb) => {\n var _a2;\n return cb((_a2 = get()) != null ? _a2 : configResult);\n });\n const postRehydrationCallback = ((_b = options.onRehydrateStorage) == null ? void 0 : _b.call(options, (_a = get()) != null ? _a : configResult)) || void 0;\n return toThenable(storage.getItem.bind(storage))(options.name).then((deserializedStorageValue) => {\n if (deserializedStorageValue) {\n if (typeof deserializedStorageValue.version === \"number\" && deserializedStorageValue.version !== options.version) {\n if (options.migrate) {\n const migration = options.migrate(\n deserializedStorageValue.state,\n deserializedStorageValue.version\n );\n if (migration instanceof Promise) {\n return migration.then((result) => [true, result]);\n }\n return [true, migration];\n }\n console.error(\n `State loaded from storage couldn't be migrated since no migrate function was provided`\n );\n } else {\n return [false, deserializedStorageValue.state];\n }\n }\n return [false, void 0];\n }).then((migrationResult) => {\n var _a2;\n if (currentVersion !== hydrationVersion) {\n return;\n }\n const [migrated, migratedState] = migrationResult;\n stateFromStorage = options.merge(\n migratedState,\n (_a2 = get()) != null ? _a2 : configResult\n );\n set(stateFromStorage, true);\n if (migrated) {\n return setItem();\n }\n }).then(() => {\n if (currentVersion !== hydrationVersion) {\n return;\n }\n postRehydrationCallback == null ? void 0 : postRehydrationCallback(get(), void 0);\n stateFromStorage = get();\n hasHydrated = true;\n finishHydrationListeners.forEach((cb) => cb(stateFromStorage));\n }).catch((e) => {\n if (currentVersion !== hydrationVersion) {\n return;\n }\n postRehydrationCallback == null ? void 0 : postRehydrationCallback(void 0, e);\n });\n };\n api.persist = {\n setOptions: (newOptions) => {\n options = {\n ...options,\n ...newOptions\n };\n if (newOptions.storage) {\n storage = newOptions.storage;\n }\n },\n clearStorage: () => {\n ++hydrationVersion;\n storage == null ? void 0 : storage.removeItem(options.name);\n },\n getOptions: () => options,\n rehydrate: () => hydrate(),\n hasHydrated: () => hasHydrated,\n onHydrate: (cb) => {\n hydrationListeners.add(cb);\n return () => {\n hydrationListeners.delete(cb);\n };\n },\n onFinishHydration: (cb) => {\n finishHydrationListeners.add(cb);\n return () => {\n finishHydrationListeners.delete(cb);\n };\n }\n };\n if (!options.skipHydration) {\n hydrate();\n }\n return stateFromStorage || configResult;\n};\nconst persist = persistImpl;\n\nfunction ssrSafe(config, isSSR = typeof window === \"undefined\") {\n return (set, get, api) => {\n if (!isSSR) {\n return config(set, get, api);\n }\n const ssrSet = () => {\n throw new Error(\"Cannot set state of Zustand store in SSR\");\n };\n api.setState = ssrSet;\n return config(ssrSet, get, api);\n };\n}\n\nexport { combine, createJSONStorage, devtools, persist, redux, subscribeWithSelector, ssrSafe as unstable_ssrSafe };\n","import { createStore } from 'zustand';\nimport {\n createJSONStorage,\n persist,\n} from 'zustand/middleware';\nimport type {\n FastaDataStoreActions,\n FastaDataStoreState,\n} from '@rivm-loculus-tools/common-frontend/stores/fastaDataStore';\nimport {\n createFastaDataStoreActions,\n createFastaDataStoreInitialState,\n} from '@rivm-loculus-tools/common-frontend/stores/fastaDataStore';\n\nimport type {\n EditorSelection,\n EngineMeta,\n EngineSearchResult,\n} from '../../models/editor.models';\nimport {\n ALI_VIEW_DEFAULT_AMINO_ACID_PALETTE,\n ALI_VIEW_DEFAULT_NUCLEOTIDE_PALETTE,\n} from '../../constants';\nimport { CUSTOM_PALETTE_NAME } from '../../models/palette.models';\nimport type {\n AminoAcidPalette,\n NucleotidePalette,\n} from '../../models/palette.models';\n\nexport type SequenceEditorStore = SequenceEditorStoreActions & SequenceEditorStoreState;\n\nexport interface SequenceEditorStoreActions extends FastaDataStoreActions {\n setAminoAcidPalette: (palette: AminoAcidPalette) => void;\n setCustomAminoAcidPalette: (palette: AminoAcidPalette) => void;\n setCustomNucleotidePalette: (palette: NucleotidePalette) => void;\n setEngineMeta: (meta: EngineMeta | null) => void;\n setIsRealigning: (isRealigning: boolean) => void;\n setLatestMessage: (message: null | string) => void;\n setNucleotidePalette: (palette: NucleotidePalette) => void;\n setSearchQuery: (query: string) => void;\n setSearchResult: (results: EngineSearchResult | null) => void;\n setSearchResultHighlightedIndex: (index: null | number) => void;\n setSelection: (selection: EditorSelection | null) => void;\n}\n\nexport interface SequenceEditorStoreState extends FastaDataStoreState {\n aminoAcidPalette: AminoAcidPalette;\n customAminoAcidPalette: AminoAcidPalette;\n customNucleotidePalette: NucleotidePalette;\n engineMeta: EngineMeta | null;\n isRealigning: boolean;\n latestMessage: null | string;\n nucleotidePalette: NucleotidePalette;\n searchQuery: string;\n searchResult: EngineSearchResult | null;\n searchResultHighlightedIndex: null | number;\n selection: EditorSelection | null;\n}\n\nconst createSequenceEditorStoreInitialState = (): SequenceEditorStoreState => ({\n ...createFastaDataStoreInitialState(),\n aminoAcidPalette: ALI_VIEW_DEFAULT_AMINO_ACID_PALETTE,\n customAminoAcidPalette: {\n name: CUSTOM_PALETTE_NAME,\n paletteColors: { ...ALI_VIEW_DEFAULT_AMINO_ACID_PALETTE.paletteColors },\n },\n customNucleotidePalette: {\n name: CUSTOM_PALETTE_NAME,\n paletteColors: { ...ALI_VIEW_DEFAULT_NUCLEOTIDE_PALETTE.paletteColors },\n },\n engineMeta: null,\n isRealigning: false,\n latestMessage: null,\n nucleotidePalette: ALI_VIEW_DEFAULT_NUCLEOTIDE_PALETTE,\n searchQuery: '',\n searchResult: null,\n searchResultHighlightedIndex: null,\n selection: null,\n});\n\nexport const sequenceEditorStore = createStore<SequenceEditorStore>()(\n persist(\n (set, get) => {\n const initialState = createSequenceEditorStoreInitialState();\n const fastaDataStoreActions = createFastaDataStoreActions({ get, set });\n\n return {\n ...initialState,\n ...fastaDataStoreActions,\n resetDataset: () => {\n const { setSearchQuery } = get();\n fastaDataStoreActions.resetDataset();\n setSearchQuery('');\n },\n setAminoAcidPalette: (palette: AminoAcidPalette) => set({ aminoAcidPalette: palette }),\n setCustomAminoAcidPalette: (palette: AminoAcidPalette) => set({ customAminoAcidPalette: palette }),\n setCustomNucleotidePalette: (palette: NucleotidePalette) => set({ customNucleotidePalette: palette }),\n setEngineMeta: (engineMeta: EngineMeta | null) => set({ engineMeta }),\n setIsRealigning: (isRealigning: boolean) => set({ isRealigning }),\n setLatestMessage: (message: null | string) => set({ latestMessage: message }),\n setNucleotidePalette: (palette: NucleotidePalette) => set({ nucleotidePalette: palette }),\n setSearchQuery: (query: string) => {\n const { setSearchResult, setSearchResultHighlightedIndex: setSearchResultsHighlightedIndex } = get();\n set({ searchQuery: query });\n if (!query) {\n setSearchResultsHighlightedIndex(null);\n setSearchResult(null);\n }\n },\n setSearchResult: (results: EngineSearchResult | null) => {\n const { setSearchResultHighlightedIndex: setSearchResultsHighlightedIndex } = get();\n set({ searchResult: results });\n setSearchResultsHighlightedIndex(null);\n },\n setSearchResultHighlightedIndex: (index: null | number) => set({ searchResultHighlightedIndex: index }),\n setSelection: (selection: EditorSelection | null) => set({ selection }),\n };\n },\n {\n name: 'LOCULUS-SEQUENCE-EDITOR-Configuration',\n partialize: (state) => ({\n aminoAcidPalette: state.aminoAcidPalette,\n customAminoAcidPalette: state.customAminoAcidPalette,\n customNucleotidePalette: state.customNucleotidePalette,\n nucleotidePalette: state.nucleotidePalette,\n }),\n storage: createJSONStorage(() => localStorage),\n version: 1,\n },\n ),\n);\n"],"ignoreList":[0,1],"mappings":";;;;;AAAA,IAAMA,KAAmB,MAAgB;CACvC,IAAIC,GACEC,oBAA4B,IAAI,IAAI,GACpCC,KAAY,GAAS,MAAY;EACrC,IAAMC,IAAY,OAAOC,KAAY,aAAaA,EAAQJ,CAAK,IAAII;EACnE,IAAI,CAAC,OAAO,GAAGD,GAAWH,CAAK,GAAG;GAChC,IAAMK,IAAgBL;GAEtB,AADA,IAASM,MAA4B,OAAOH,KAAc,aAAYA,KAAsBA,IAAY,OAAO,OAAO,CAAC,GAAGH,GAAOG,CAAS,GAC1IF,EAAU,SAAS,MAAaM,EAASP,GAAOK,CAAa,CAAC;EAChE;CACF,GACMG,UAAiBR,GAMjBS,IAAM;EAAE;EAAU;EAAU,uBALJC;EAKqB,YAJhC,OACjBT,EAAU,IAAIM,CAAQ,SACTN,EAAU,OAAOM,CAAQ;CAEqB,GACvDG,IAAe,IAAQC,EAAYT,GAAUM,GAAUC,CAAG;CAChE,OAAOA;AACT,GACMG,MAAgB,MAAgBD,IAAcZ,EAAgBY,CAAW,IAAIZ;;ACqQnF,SAASc,EAAkB,GAAY,GAAS;CAC9C,IAAIC;CACJ,IAAI;EACF,IAAUC,EAAW;CACvB,QAAY;EACV;CACF;CAmBA,OAAO;EAjBL,UAAU,MAAS;GAEjB,IAAMC,KAAS,MACTC,MAAS,OACJ,OAEF,KAAK,MAAMA,GAAMC,GAAmC,OAAO,GAE9DC,IAAYL,EAAQ,QAAQM,CAAI,KAAkB;GAIxD,OA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,EAAe,EAAE;EACnB;EACA,sBAAsB,MAA8BzB,EAAI,EAAE,kBAAkB0B,EAAQ,CAAC;EACrF,4BAA4B,MAA8B1B,EAAI,EAAE,wBAAwB0B,EAAQ,CAAC;EACjG,6BAA6B,MAA+B1B,EAAI,EAAE,yBAAyB0B,EAAQ,CAAC;EACpG,gBAAgB,MAAkC1B,EAAI,EAAE,cAAW,CAAC;EACpE,kBAAkB,MAA0BA,EAAI,EAAE,gBAAa,CAAC;EAChE,mBAAmB,MAA2BA,EAAI,EAAE,eAAe2B,EAAQ,CAAC;EAC5E,uBAAuB,MAA+B3B,EAAI,EAAE,mBAAmB0B,EAAQ,CAAC;EACxF,iBAAiB,MAAkB;GACjC,IAAM,EAAE,oBAAiB,iCAAiCE,MAAqC3B,EAAI;GAEnG,AADAD,EAAI,EAAE,aAAa6B,EAAM,CAAC,GACrBA,MACHD,EAAiC,IAAI,GACrCE,EAAgB,IAAI;EAExB;EACA,kBAAkB,MAAuC;GACvD,IAAM,EAAE,iCAAiCF,MAAqC3B,EAAI;GAElF,AADAD,EAAI,EAAE,cAAc+B,EAAQ,CAAC,GAC7BH,EAAiC,IAAI;EACvC;EACA,kCAAkC,MAAyB5B,EAAI,EAAE,8BAA8BgC,EAAM,CAAC;EACtG,eAAe,MAAsChC,EAAI,EAAE,aAAU,CAAC;CACxE;AACF,GACA;CACE,MAAM;CACN,aAAa,OAAW;EACtB,kBAAkBtC,EAAM;EACxB,wBAAwBA,EAAM;EAC9B,yBAAyBA,EAAM;EAC/B,mBAAmBA,EAAM;CAC3B;CACA,SAASa,QAAwB,YAAY;CAC7C,SAAS;AACX,CACF,CACF"}
1
+ {"version":3,"file":"sequenceEditorStore.js","names":["createFastaDataStoreActions","createFastaDataStoreInitialState","READING_MODE","ALI_VIEW_DEFAULT_AMINO_ACID_PALETTE","ALI_VIEW_DEFAULT_NUCLEOTIDE_PALETTE","CUSTOM_PALETTE_NAME","createStoreImpl","createState","state","listeners","setState","partial","replace","nextState","previousState","listener","getState","api","initialState","createStore","createJSONStorage","getStorage","options","storage","name","parse","str2","str","isPromiseLike","newValue","value","toSyncThenable","onFulfilled","toThenable","fn","input","result","error","_onFulfilled","onRejected","persist","config","baseOptions","set","get","persistedState","currentState","hasHydrated","hydrationVersion","hydrationListeners","finishHydrationListeners","args","setItem","savedSetState","configResult","stateFromStorage","hydrate","currentVersion","cb","postRehydrationCallback","deserializedStorageValue","migration","migrationResult","migrated","migratedState","e","newOptions","createSequenceEditorStoreInitialState","sequenceEditorStore","fastaDataStoreActions","setSearchQuery","palette","engineMeta","isRealigning","message","query","setSearchResult","setSearchResultsHighlightedIndex","results","index","selection"],"sources":["../../../../../../node_modules/.pnpm/zustand@5.1.0_@types+react@19.3.3_react@19.3.1_use-sync-external-store@1.7.0_react@19.3.1_/node_modules/zustand/esm/vanilla.mjs","../../../../../../node_modules/.pnpm/zustand@5.1.0_@types+react@19.3.3_react@19.3.1_use-sync-external-store@1.7.0_react@19.3.1_/node_modules/zustand/esm/middleware.mjs","../../src/stores/sequenceEditorStore/sequenceEditorStore.ts"],"sourcesContent":["const createStoreImpl = (createState) => {\n let state;\n const listeners = /* @__PURE__ */ new Set();\n const setState = (partial, replace) => {\n const nextState = typeof partial === \"function\" ? partial(state) : partial;\n if (!Object.is(nextState, state)) {\n const previousState = state;\n state = (replace != null ? replace : typeof nextState !== \"object\" || nextState === null) ? nextState : Object.assign({}, state, nextState);\n listeners.forEach((listener) => listener(state, previousState));\n }\n };\n const getState = () => state;\n const getInitialState = () => initialState;\n const subscribe = (listener) => {\n listeners.add(listener);\n return () => listeners.delete(listener);\n };\n const api = { setState, getState, getInitialState, subscribe };\n const initialState = state = createState(setState, getState, api);\n return api;\n};\nconst createStore = ((createState) => createState ? createStoreImpl(createState) : createStoreImpl);\n\nexport { createStore };\n","const reduxImpl = (reducer, initial) => (set, _get, api) => {\n api.dispatch = (action) => {\n set((state) => reducer(state, action), false, action);\n return action;\n };\n api.dispatchFromDevtools = true;\n return { dispatch: (...args) => api.dispatch(...args), ...initial };\n};\nconst redux = reduxImpl;\n\nconst shouldDispatchFromDevtools = (api) => !!api.dispatchFromDevtools && typeof api.dispatch === \"function\";\nconst trackedConnections = /* @__PURE__ */ new Map();\nconst getTrackedConnectionState = (name) => {\n const api = trackedConnections.get(name);\n if (!api) return {};\n return Object.fromEntries(\n Object.entries(api.stores).map(([key, api2]) => [key, api2.getState()])\n );\n};\nconst extractConnectionInformation = (store, extensionConnector, options) => {\n if (store === void 0) {\n return {\n type: \"untracked\",\n connection: extensionConnector.connect(options)\n };\n }\n const existingConnection = trackedConnections.get(options.name);\n if (existingConnection) {\n return { type: \"tracked\", store, ...existingConnection };\n }\n const newConnection = {\n connection: extensionConnector.connect(options),\n stores: {}\n };\n trackedConnections.set(options.name, newConnection);\n return { type: \"tracked\", store, ...newConnection };\n};\nconst removeStoreFromTrackedConnections = (name, store, api) => {\n if (store === void 0) return;\n const connectionInfo = trackedConnections.get(name);\n if ((connectionInfo == null ? void 0 : connectionInfo.stores[store]) !== api) return;\n delete connectionInfo.stores[store];\n if (Object.keys(connectionInfo.stores).length === 0) {\n trackedConnections.delete(name);\n }\n};\nconst v8StackLineRe = /^at (?:new |async )?(.+?) \\(/;\nconst geckoStackLineRe = /^([^@]+)@/;\nfunction findCallerName(stack) {\n var _a, _b, _c;\n if (!stack) return void 0;\n const traceLines = stack.split(\"\\n\");\n const apiSetStateLineIndex = traceLines.findIndex(\n (traceLine) => traceLine.includes(\"api.setState\")\n );\n if (apiSetStateLineIndex < 0) return void 0;\n const callerLine = ((_a = traceLines[apiSetStateLineIndex + 1]) == null ? void 0 : _a.trim()) || \"\";\n return ((_b = v8StackLineRe.exec(callerLine)) == null ? void 0 : _b[1]) || ((_c = geckoStackLineRe.exec(callerLine)) == null ? void 0 : _c[1]);\n}\nconst devtoolsImpl = (fn, devtoolsOptions = {}) => (set, get, api) => {\n const { enabled, anonymousActionType, store, actionCreators, ...options } = devtoolsOptions;\n let extensionConnector;\n try {\n extensionConnector = (enabled != null ? enabled : (import.meta.env ? import.meta.env.MODE : void 0) !== \"production\") && window.__REDUX_DEVTOOLS_EXTENSION__;\n } catch (e) {\n }\n if (!extensionConnector) {\n return fn(set, get, api);\n }\n let connection = void 0;\n let isRecording = true;\n api.setState = ((state, replace, nameOrAction) => {\n const r = set(state, replace);\n if (!isRecording) return r;\n const action = nameOrAction === void 0 ? {\n type: anonymousActionType || findCallerName(new Error().stack) || \"anonymous\"\n } : typeof nameOrAction === \"string\" ? { type: nameOrAction } : nameOrAction;\n if (store === void 0) {\n connection == null ? void 0 : connection.send(action, get());\n return r;\n }\n connection == null ? void 0 : connection.send(\n {\n ...action,\n type: `${store}/${action.type}`\n },\n {\n ...getTrackedConnectionState(options.name),\n [store]: api.getState()\n }\n );\n return r;\n });\n let unsubscribeFromStore;\n api.devtools = {\n cleanup: () => {\n unsubscribeFromStore == null ? void 0 : unsubscribeFromStore();\n unsubscribeFromStore = void 0;\n removeStoreFromTrackedConnections(options.name, store, api);\n if ((store === void 0 || !trackedConnections.has(options.name)) && connection && typeof connection.unsubscribe === \"function\") {\n connection.unsubscribe();\n }\n }\n };\n const setStateFromDevtools = (...a) => {\n const originalIsRecording = isRecording;\n isRecording = false;\n set(...a);\n isRecording = originalIsRecording;\n };\n const initialState = fn(api.setState, get, api);\n const actionCreatorObjects = actionCreators && getActionCreatorObjects(initialState, actionCreators);\n const connectionInformation = extractConnectionInformation(\n store,\n extensionConnector,\n { ...options, actionCreators: actionCreatorObjects }\n );\n connection = connectionInformation.connection;\n const findActionCreator = (name) => {\n const actionCreator = actionCreatorObjects == null ? void 0 : actionCreatorObjects.find(\n (candidate) => candidate.name === name\n );\n if (!actionCreator && actionCreators && store === void 0) {\n console.error(\n `[zustand devtools middleware] Action type \"${name}\" not found in actionCreators`\n );\n }\n return actionCreator;\n };\n if (connectionInformation.type === \"untracked\") {\n connection == null ? void 0 : connection.init(initialState);\n } else {\n connectionInformation.stores[connectionInformation.store] = api;\n connection == null ? void 0 : connection.init(\n Object.fromEntries(\n Object.entries(connectionInformation.stores).map(([key, store2]) => [\n key,\n key === connectionInformation.store ? initialState : store2.getState()\n ])\n )\n );\n }\n if (shouldDispatchFromDevtools(api)) {\n let didWarnAboutReservedActionType = false;\n const originalDispatch = api.dispatch;\n api.dispatch = (...args) => {\n if ((import.meta.env ? import.meta.env.MODE : void 0) !== \"production\" && args[0].type === \"__setState\" && !didWarnAboutReservedActionType) {\n console.warn(\n '[zustand devtools middleware] \"__setState\" action type is reserved to set state from the devtools. Avoid using it.'\n );\n didWarnAboutReservedActionType = true;\n }\n originalDispatch(...args);\n };\n }\n unsubscribeFromStore = connection.subscribe((message) => {\n var _a;\n const reviver = typeof options.serialize === \"object\" ? options.serialize.reviver : void 0;\n switch (message.type) {\n case \"ACTION\": {\n if (typeof message.payload !== \"string\") {\n if (shouldDispatchFromDevtools(api)) {\n console.error(\n '[zustand devtools middleware] The action dropdown is not supported with the redux middleware. Dispatch a custom action in JSON format instead, e.g. { \"type\": \"increment\" }'\n );\n return;\n }\n if (!actionCreators) {\n console.error(\n \"[zustand devtools middleware] Unsupported action format\"\n );\n return;\n }\n const actionCreator2 = findActionCreator(message.payload.name);\n if (!actionCreator2) return;\n const args2 = parseDropdownArgs(message.payload, reviver);\n if (!args2) return;\n return actionCreator2.func(...args2);\n }\n let action;\n try {\n action = JSON.parse(message.payload, reviver);\n } catch (e) {\n let errorMessage = `[zustand devtools middleware] Malformed JSON. When dispatching custom actions, please format the payload as a JSON string.\n Examples:`;\n if (shouldDispatchFromDevtools(api)) {\n errorMessage += `\n - { \"type\": \"increment\", \"amount\": 1 }\n - { \"type\": \"reset\" }\n `;\n } else {\n errorMessage += `\n - { \"type\": \"increment\" }\n - { \"type\": \"increment\", \"args\": [1] }\n If you have args with default values or want to be \\`undefined\\`, prefer using the object syntax so you can omit them.\n - { \"type\": \"increment\", \"args\": { \"amount\": 1 } }\n `;\n }\n console.error(errorMessage.replace(/\\n\\s+/g, \"\\n\"));\n return;\n }\n if (action.type === \"__setState\") {\n if (store === void 0) {\n if (!(\"state\" in action)) {\n console.warn(\n `\n [zustand devtools middleware] Calling __setState without a state property.\n This may not be what you intended, you should explicitly set the state you want to set.\n Example: { \"type\": \"__setState\", \"state\": { \"foo\": \"bar\" } }\n `.replace(/\\n\\s+/g, \"\\n\")\n );\n return;\n }\n setStateFromDevtools(action.state);\n return;\n }\n if (Object.keys(action.state).length !== 1) {\n console.error(\n `\n [zustand devtools middleware] Unsupported __setState action format.\n When using 'store' option in devtools(), the 'state' should have only one key, which is a value of 'store' that was passed in devtools(),\n and value of this only key should be a state object. Example: { \"type\": \"__setState\", \"state\": { \"abc123Store\": { \"foo\": \"bar\" } } }\n `.replace(/\\n\\s+/g, \"\\n\")\n );\n }\n const stateFromDevtools = action.state[store];\n if (stateFromDevtools === void 0 || stateFromDevtools === null) {\n return;\n }\n if (JSON.stringify(api.getState()) !== JSON.stringify(stateFromDevtools)) {\n setStateFromDevtools(stateFromDevtools);\n }\n return;\n }\n if (shouldDispatchFromDevtools(api)) {\n api.dispatch(action);\n return;\n }\n const actionCreator = findActionCreator(action.type);\n if (!actionCreator) return;\n const args = action.args;\n return actionCreator.func(\n ...Array.isArray(args) ? args : actionCreator.args.map((name) => args == null ? void 0 : args[name])\n );\n }\n case \"DISPATCH\":\n switch (message.payload.type) {\n case \"RESET\":\n setStateFromDevtools(initialState);\n if (store === void 0) {\n return connection == null ? void 0 : connection.init(api.getState());\n }\n return connection == null ? void 0 : connection.init(getTrackedConnectionState(options.name));\n case \"COMMIT\":\n if (store === void 0) {\n connection == null ? void 0 : connection.init(api.getState());\n return;\n }\n return connection == null ? void 0 : connection.init(getTrackedConnectionState(options.name));\n case \"ROLLBACK\":\n return parseJsonThen(message.state, reviver, (state) => {\n if (store === void 0) {\n setStateFromDevtools(state);\n connection == null ? void 0 : connection.init(api.getState());\n return;\n }\n setStateFromDevtools(state[store]);\n connection == null ? void 0 : connection.init(getTrackedConnectionState(options.name));\n });\n case \"JUMP_TO_STATE\":\n case \"JUMP_TO_ACTION\":\n return parseJsonThen(message.state, reviver, (state) => {\n if (store === void 0) {\n setStateFromDevtools(state);\n return;\n }\n if (JSON.stringify(api.getState()) !== JSON.stringify(state[store])) {\n setStateFromDevtools(state[store]);\n }\n });\n case \"IMPORT_STATE\": {\n const { nextLiftedState } = message.payload;\n const lastComputedState = (_a = nextLiftedState.computedStates.slice(-1)[0]) == null ? void 0 : _a.state;\n if (!lastComputedState) return;\n if (store === void 0) {\n setStateFromDevtools(lastComputedState);\n } else {\n setStateFromDevtools(lastComputedState[store]);\n }\n connection == null ? void 0 : connection.send(\n null,\n // FIXME no-any\n nextLiftedState\n );\n return;\n }\n case \"PAUSE_RECORDING\":\n return isRecording = !isRecording;\n }\n return;\n }\n });\n return initialState;\n};\nconst devtools = devtoolsImpl;\nconst parseJsonThen = (stringified, reviver, fn) => {\n let parsed;\n try {\n parsed = JSON.parse(stringified, reviver);\n } catch (e) {\n console.error(\n \"[zustand devtools middleware] Could not parse the received json\",\n e\n );\n }\n if (parsed !== void 0) fn(parsed);\n};\nfunction maskToRegex(mask) {\n const escaped = mask.replace(/[.+?^${}()|[\\]\\\\]/g, \"\\\\$&\").replace(/\\*\\*|\\*/g, (wildcard) => wildcard === \"**\" ? \".*\" : \"[^.]*\");\n return new RegExp(`^${escaped}$`);\n}\nconst isPlainObject = (value) => typeof value === \"object\" && value !== null && Object.getPrototypeOf(value) === Object.prototype;\nconst getStateFunctions = (state, walked = /* @__PURE__ */ new Map()) => {\n var _a;\n if (!isPlainObject(state)) return [];\n const known = walked.get(state);\n if (known) return known;\n walked.set(state, []);\n const functions = [];\n for (const key of Object.keys(state)) {\n const value = (_a = Object.getOwnPropertyDescriptor(state, key)) == null ? void 0 : _a.value;\n if (typeof value === \"function\") {\n functions.push([key, value]);\n } else {\n for (const [path, func] of getStateFunctions(value, walked)) {\n functions.push([`${key}.${path}`, func]);\n }\n }\n }\n walked.set(state, functions);\n return functions;\n};\nconst sourceTokenRe = /\"(?:\\\\.|[^\"\\\\])*\"|'(?:\\\\.|[^'\\\\])*'|`(?:\\\\.|[^`\\\\])*`|\\/\\*[\\s\\S]*?\\*\\/|\\/\\/.*|[\\s\\S]/g;\nconst getParamNames = (func) => {\n var _a, _b;\n const tokens = ((_a = func.toString().match(sourceTokenRe)) != null ? _a : []).filter(\n (token) => !/^\\/[/*]/.test(token)\n );\n const arrowParam = (_b = /^(?:async\\s+)?([^\\s(=]+)\\s*=>/.exec(tokens.join(\"\"))) == null ? void 0 : _b[1];\n if (arrowParam) return [arrowParam];\n const params = [\"\"];\n let depth = 0;\n let inDefaultValue = false;\n for (const token of tokens.slice(tokens.indexOf(\"(\") + 1)) {\n if (depth === 0) {\n if (token === \")\") break;\n if (token === \",\") {\n params.push(\"\");\n inDefaultValue = false;\n continue;\n }\n if (token === \"=\") inDefaultValue = true;\n }\n if (\"([{\".includes(token)) depth++;\n if (\")]}\".includes(token)) depth--;\n if (!inDefaultValue) params[params.length - 1] += token;\n }\n return params.map((param) => param.trim()).filter((param) => param && !param.startsWith(\"...\"));\n};\nconst createActionCreatorObject = (name, func) => ({ name, func, args: getParamNames(func) });\nfunction getActionCreatorObjects(state, actionCreators) {\n const actions = /* @__PURE__ */ new Map();\n const matchers = Object.entries(actionCreators).map(([key, picked]) => ({\n matcher: maskToRegex(key),\n picked,\n key\n })).sort((a, b) => {\n const aIsDoubleWildcard = a.key.includes(\"**\");\n const bIsDoubleWildcard = b.key.includes(\"**\");\n if (aIsDoubleWildcard !== bIsDoubleWildcard) {\n return aIsDoubleWildcard ? -1 : 1;\n }\n const aIsSingleWildcard = a.key.includes(\"*\") && !aIsDoubleWildcard;\n const bIsSingleWildcard = b.key.includes(\"*\") && !bIsDoubleWildcard;\n if (aIsSingleWildcard !== bIsSingleWildcard) {\n return aIsSingleWildcard ? -1 : 1;\n }\n return a.key.length - b.key.length;\n });\n for (const [name, func] of getStateFunctions(state)) {\n for (const { matcher, picked } of matchers) {\n if (matcher.test(name)) {\n if (picked === false) {\n actions.delete(name);\n continue;\n }\n actions.set(name, createActionCreatorObject(name, func));\n }\n }\n }\n for (const [name, picked] of Object.entries(actionCreators)) {\n if (typeof picked === \"function\") {\n actions.set(name, createActionCreatorObject(name, picked));\n }\n }\n return Array.from(actions.values());\n}\nconst parseDropdownArgs = ({ args, rest }, reviver) => {\n var _a;\n const parse = (arg) => arg ? JSON.parse(arg, reviver) : void 0;\n try {\n const restArgs = (_a = parse(rest)) != null ? _a : [];\n if (!Array.isArray(restArgs)) throw new Error(\"...rest is not an array\");\n return [...args.map(parse), ...restArgs];\n } catch (e) {\n console.error(\n '[zustand devtools middleware] Could not parse the arguments from the action dropdown. Each one must be JSON, e.g. 5, \"foo\" or { \"by\": 5 }, and ...rest a JSON array.',\n e\n );\n return void 0;\n }\n};\n\nconst subscribeWithSelectorImpl = (fn) => (set, get, api) => {\n const origSubscribe = api.subscribe;\n api.subscribe = ((selector, optListener, options) => {\n let listener = selector;\n if (optListener) {\n const equalityFn = (options == null ? void 0 : options.equalityFn) || Object.is;\n let currentSlice = selector(api.getState());\n listener = (state) => {\n const nextSlice = selector(state);\n if (!equalityFn(currentSlice, nextSlice)) {\n const previousSlice = currentSlice;\n optListener(currentSlice = nextSlice, previousSlice);\n }\n };\n if (options == null ? void 0 : options.fireImmediately) {\n optListener(currentSlice, currentSlice);\n }\n }\n return origSubscribe(listener);\n });\n const initialState = fn(set, get, api);\n return initialState;\n};\nconst subscribeWithSelector = subscribeWithSelectorImpl;\n\nfunction combine(initialState, create) {\n return (...args) => Object.assign({}, initialState, create(...args));\n}\n\nfunction createJSONStorage(getStorage, options) {\n let storage;\n try {\n storage = getStorage();\n } catch (e) {\n return;\n }\n const persistStorage = {\n getItem: (name) => {\n var _a;\n const parse = (str2) => {\n if (str2 === null) {\n return null;\n }\n return JSON.parse(str2, options == null ? void 0 : options.reviver);\n };\n const str = (_a = storage.getItem(name)) != null ? _a : null;\n if (isPromiseLike(str)) {\n return str.then(parse);\n }\n return parse(str);\n },\n setItem: (name, newValue) => storage.setItem(name, JSON.stringify(newValue, options == null ? void 0 : options.replacer)),\n removeItem: (name) => storage.removeItem(name)\n };\n return persistStorage;\n}\nconst isPromiseLike = (value) => typeof (value == null ? void 0 : value.then) === \"function\";\nconst toSyncThenable = (value) => ({\n then(onFulfilled) {\n return onFulfilled ? toThenable(onFulfilled)(value) : this;\n }\n});\nconst toThenable = (fn) => (input) => {\n try {\n const result = fn(input);\n return isPromiseLike(result) ? result : toSyncThenable(result);\n } catch (error) {\n return {\n then(_onFulfilled, onRejected) {\n return onRejected ? toThenable(onRejected)(error) : this;\n }\n };\n }\n};\nconst persistImpl = (config, baseOptions) => (set, get, api) => {\n let options = {\n storage: createJSONStorage(() => window.localStorage),\n partialize: (state) => state,\n version: 0,\n merge: (persistedState, currentState) => ({\n ...currentState,\n ...persistedState\n }),\n ...baseOptions\n };\n let hasHydrated = false;\n let hydrationVersion = 0;\n const hydrationListeners = /* @__PURE__ */ new Set();\n const finishHydrationListeners = /* @__PURE__ */ new Set();\n let storage = options.storage;\n if (!storage) {\n return config(\n (...args) => {\n console.warn(\n `[zustand persist middleware] Unable to update item '${options.name}', the given storage is currently unavailable.`\n );\n set(...args);\n },\n get,\n api\n );\n }\n const setItem = () => {\n const state = options.partialize({ ...get() });\n return storage.setItem(options.name, {\n state,\n version: options.version\n });\n };\n const savedSetState = api.setState;\n api.setState = (...args) => {\n savedSetState(...args);\n return setItem();\n };\n const configResult = config(\n (...args) => {\n set(...args);\n return setItem();\n },\n get,\n api\n );\n api.getInitialState = () => configResult;\n let stateFromStorage;\n const hydrate = () => {\n var _a, _b;\n if (!storage) return;\n const currentVersion = ++hydrationVersion;\n hasHydrated = false;\n hydrationListeners.forEach((cb) => {\n var _a2;\n return cb((_a2 = get()) != null ? _a2 : configResult);\n });\n const postRehydrationCallback = ((_b = options.onRehydrateStorage) == null ? void 0 : _b.call(options, (_a = get()) != null ? _a : configResult)) || void 0;\n return toThenable(storage.getItem.bind(storage))(options.name).then((deserializedStorageValue) => {\n if (deserializedStorageValue) {\n if (typeof deserializedStorageValue.version === \"number\" && deserializedStorageValue.version !== options.version) {\n if (options.migrate) {\n const migration = options.migrate(\n deserializedStorageValue.state,\n deserializedStorageValue.version\n );\n if (isPromiseLike(migration)) {\n return migration.then((result) => [true, result]);\n }\n return [true, migration];\n }\n console.error(\n `State loaded from storage couldn't be migrated since no migrate function was provided`\n );\n } else {\n return [false, deserializedStorageValue.state];\n }\n }\n return [false, void 0];\n }).then((migrationResult) => {\n var _a2;\n if (currentVersion !== hydrationVersion) {\n return;\n }\n const [migrated, migratedState] = migrationResult;\n stateFromStorage = options.merge(\n migratedState,\n (_a2 = get()) != null ? _a2 : configResult\n );\n set(stateFromStorage, true);\n if (migrated) {\n return setItem();\n }\n }).then(() => {\n if (currentVersion !== hydrationVersion) {\n return;\n }\n postRehydrationCallback == null ? void 0 : postRehydrationCallback(get(), void 0);\n stateFromStorage = get();\n hasHydrated = true;\n finishHydrationListeners.forEach((cb) => cb(stateFromStorage));\n }).then(\n () => void 0,\n (e) => {\n if (currentVersion !== hydrationVersion) {\n return;\n }\n postRehydrationCallback == null ? void 0 : postRehydrationCallback(void 0, e);\n }\n );\n };\n api.persist = {\n setOptions: (newOptions) => {\n options = {\n ...options,\n ...newOptions\n };\n if (newOptions.storage) {\n storage = newOptions.storage;\n }\n },\n clearStorage: () => {\n ++hydrationVersion;\n storage == null ? void 0 : storage.removeItem(options.name);\n },\n getOptions: () => options,\n rehydrate: () => {\n try {\n return Promise.resolve(hydrate());\n } catch (error) {\n return Promise.reject(error);\n }\n },\n hasHydrated: () => hasHydrated,\n onHydrate: (cb) => {\n hydrationListeners.add(cb);\n return () => {\n hydrationListeners.delete(cb);\n };\n },\n onFinishHydration: (cb) => {\n finishHydrationListeners.add(cb);\n return () => {\n finishHydrationListeners.delete(cb);\n };\n }\n };\n if (!options.skipHydration) {\n hydrate();\n }\n return stateFromStorage || configResult;\n};\nconst persist = persistImpl;\n\nfunction ssrSafe(config, isSSR = typeof window === \"undefined\") {\n return (set, get, api) => {\n if (!isSSR) {\n return config(set, get, api);\n }\n const ssrSet = () => {\n throw new Error(\"Cannot set state of Zustand store in SSR\");\n };\n api.setState = ssrSet;\n return config(ssrSet, get, api);\n };\n}\n\nexport { combine, createJSONStorage, devtools, persist, redux, subscribeWithSelector, ssrSafe as unstable_ssrSafe };\n","import { createStore } from 'zustand';\nimport {\n createJSONStorage,\n persist,\n} from 'zustand/middleware';\nimport type {\n FastaDataStoreActions,\n FastaDataStoreState,\n} from '@rivm-loculus-tools/common-frontend/stores/fastaDataStore';\nimport {\n createFastaDataStoreActions,\n createFastaDataStoreInitialState,\n} from '@rivm-loculus-tools/common-frontend/stores/fastaDataStore';\n\nimport { READING_MODE } from '../../models/editor.models';\nimport type {\n EditorSelection,\n EngineMeta,\n EngineSearchResult,\n} from '../../models/editor.models';\nimport {\n ALI_VIEW_DEFAULT_AMINO_ACID_PALETTE,\n ALI_VIEW_DEFAULT_NUCLEOTIDE_PALETTE,\n} from '../../constants';\nimport { CUSTOM_PALETTE_NAME } from '../../models/palette.models';\nimport type {\n AminoAcidPalette,\n NucleotidePalette,\n} from '../../models/palette.models';\n\nexport type SequenceEditorStore = SequenceEditorStoreActions & SequenceEditorStoreState;\n\nexport interface SequenceEditorStoreActions extends FastaDataStoreActions {\n setAminoAcidPalette: (palette: AminoAcidPalette) => void;\n setCustomAminoAcidPalette: (palette: AminoAcidPalette) => void;\n setCustomNucleotidePalette: (palette: NucleotidePalette) => void;\n setEngineMeta: (meta: EngineMeta | null) => void;\n setIsRealigning: (isRealigning: boolean) => void;\n setLatestMessage: (message: null | string) => void;\n setNucleotidePalette: (palette: NucleotidePalette) => void;\n setSearchQuery: (query: string) => void;\n setSearchResult: (results: EngineSearchResult | null) => void;\n setSearchResultHighlightedIndex: (index: null | number) => void;\n setSelection: (selection: EditorSelection | null) => void;\n}\n\nexport interface SequenceEditorStoreState extends FastaDataStoreState {\n aminoAcidPalette: AminoAcidPalette;\n customAminoAcidPalette: AminoAcidPalette;\n customNucleotidePalette: NucleotidePalette;\n engineMeta: EngineMeta | null;\n isRealigning: boolean;\n latestMessage: null | string;\n nucleotidePalette: NucleotidePalette;\n readingFrame: 1 | 2 | 3;\n readingMode: READING_MODE;\n searchQuery: string;\n searchResult: EngineSearchResult | null;\n searchResultHighlightedIndex: null | number;\n selection: EditorSelection | null;\n}\n\nconst createSequenceEditorStoreInitialState = (): SequenceEditorStoreState => ({\n ...createFastaDataStoreInitialState(),\n aminoAcidPalette: ALI_VIEW_DEFAULT_AMINO_ACID_PALETTE,\n customAminoAcidPalette: {\n name: CUSTOM_PALETTE_NAME,\n paletteColors: { ...ALI_VIEW_DEFAULT_AMINO_ACID_PALETTE.paletteColors },\n },\n customNucleotidePalette: {\n name: CUSTOM_PALETTE_NAME,\n paletteColors: { ...ALI_VIEW_DEFAULT_NUCLEOTIDE_PALETTE.paletteColors },\n },\n engineMeta: null,\n isRealigning: false,\n latestMessage: null,\n nucleotidePalette: ALI_VIEW_DEFAULT_NUCLEOTIDE_PALETTE,\n readingFrame: 1,\n readingMode: READING_MODE.NUCLEOTIDE,\n searchQuery: '',\n searchResult: null,\n searchResultHighlightedIndex: null,\n selection: null,\n});\n\nexport const sequenceEditorStore = createStore<SequenceEditorStore>()(\n persist(\n (set, get) => {\n const initialState = createSequenceEditorStoreInitialState();\n const fastaDataStoreActions = createFastaDataStoreActions({ get, set });\n\n return {\n ...initialState,\n ...fastaDataStoreActions,\n resetDataset: () => {\n const { setSearchQuery } = get();\n fastaDataStoreActions.resetDataset();\n setSearchQuery('');\n },\n setAminoAcidPalette: (palette: AminoAcidPalette) => set({ aminoAcidPalette: palette }),\n setCustomAminoAcidPalette: (palette: AminoAcidPalette) => set({ customAminoAcidPalette: palette }),\n setCustomNucleotidePalette: (palette: NucleotidePalette) => set({ customNucleotidePalette: palette }),\n setEngineMeta: (engineMeta: EngineMeta | null) => set({ engineMeta }),\n setIsRealigning: (isRealigning: boolean) => set({ isRealigning }),\n setLatestMessage: (message: null | string) => set({ latestMessage: message }),\n setNucleotidePalette: (palette: NucleotidePalette) => set({ nucleotidePalette: palette }),\n setSearchQuery: (query: string) => {\n const { setSearchResult, setSearchResultHighlightedIndex: setSearchResultsHighlightedIndex } = get();\n set({ searchQuery: query });\n if (!query) {\n setSearchResultsHighlightedIndex(null);\n setSearchResult(null);\n }\n },\n setSearchResult: (results: EngineSearchResult | null) => {\n const { setSearchResultHighlightedIndex: setSearchResultsHighlightedIndex } = get();\n set({ searchResult: results });\n setSearchResultsHighlightedIndex(null);\n },\n setSearchResultHighlightedIndex: (index: null | number) => set({ searchResultHighlightedIndex: index }),\n setSelection: (selection: EditorSelection | null) => set({ selection }),\n };\n },\n {\n name: 'LOCULUS-SEQUENCE-EDITOR-Configuration',\n partialize: (state) => ({\n aminoAcidPalette: state.aminoAcidPalette,\n customAminoAcidPalette: state.customAminoAcidPalette,\n customNucleotidePalette: state.customNucleotidePalette,\n nucleotidePalette: state.nucleotidePalette,\n }),\n storage: createJSONStorage(() => localStorage),\n version: 1,\n },\n ),\n);\n"],"ignoreList":[0,1],"mappings":";;;;;;AAAA,IAAMM,KAAmBC,MAAgB;CACvC,IAAIC,GACEC,oBAA4B,IAAI,IAAI,GACpCC,KAAYC,GAASC,MAAY;EACrC,IAAMC,IAAY,OAAOF,KAAY,aAAaA,EAAQH,CAAK,IAAIG;EACnE,IAAI,CAAC,OAAO,GAAGE,GAAWL,CAAK,GAAG;GAChC,IAAMM,IAAgBN;GACtBA,IAASI,MAA4B,OAAOC,KAAc,aAAYA,KAAsBA,IAAY,OAAO,OAAO,CAAC,GAAGL,GAAOK,CAAS,GAC1IJ,EAAU,SAASM,MAAaA,EAASP,GAAOM,CAAa,CAAC;EAChE;CACF,GACME,UAAiBR,GAMjBS,IAAM;EAAEP;EAAUM;EAAU,uBALJE;EAKqB,YAJhCH,OACjBN,EAAU,IAAIM,CAAQ,SACTN,EAAU,OAAOM,CAAQ;CAEqB,GACvDG,IA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