@genome-spy/app 0.74.0 → 0.76.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 (66) hide show
  1. package/dist/AbortablePromiseCache-beUIcZcW.js +96 -0
  2. package/dist/agentApi-CzdacisO.js +25226 -0
  3. package/dist/agentApi.es.js +9460 -0
  4. package/dist/agentShared.es.js +4742 -0
  5. package/dist/{blosc-oa0DlI6G.js → blosc-BX4BJ8sR.js} +1 -1
  6. package/dist/componentStyles-CIXoKEp0.js +2182 -0
  7. package/dist/dialog.es.js +377 -0
  8. package/dist/{esm-n0auOe11.js → esm-BH0wx5y-.js} +1 -1
  9. package/dist/esm-BLfLaJtE.js +121 -0
  10. package/dist/{esm-D-WfYOx7.js → esm-BWsx1OJ2.js} +25 -25
  11. package/dist/{browser-Dvlo92rx.js → esm-BY4T8YoD.js} +38 -22
  12. package/dist/esm-CZvS2Ldm.js +155 -0
  13. package/dist/esm-CdIesJ1z.js +461 -0
  14. package/dist/{esm-DCCYNvaz.js → esm-Cr7pLUfG.js} +50 -50
  15. package/dist/esm-D-y0Ce1M.js +573 -0
  16. package/dist/esm-DHOMWRoL.js +1426 -0
  17. package/dist/{esm-Cmo4qEPr.js → esm-DJUb6vy0.js} +5 -5
  18. package/dist/esm-DPS6pYKF.js +1248 -0
  19. package/dist/esm-DRZ5LLNH.js +142 -0
  20. package/dist/esm-DjF6pKy5.js +369 -0
  21. package/dist/esm-PDPkTR1_.js +1015 -0
  22. package/dist/esm-s_SlArJ8.js +298 -0
  23. package/dist/index.es.js +7910 -28759
  24. package/dist/index.js +1135 -736
  25. package/dist/lit-ymUSmGBw.js +510 -0
  26. package/dist/{lz4-jZ0zyLBa.js → lz4-BSYl80V8.js} +1 -1
  27. package/dist/parquetRead-m8-8_SpH.js +1609 -0
  28. package/dist/schema.json +665 -97
  29. package/dist/style.css +1 -1
  30. package/dist/viewUtils-C5htqZCm.js +14147 -0
  31. package/dist/{zstd-C6ksIG9r.js → zstd-BAfRM3IH.js} +1 -1
  32. package/package.json +30 -5
  33. package/src/agentApi/index.d.ts +123 -0
  34. package/src/agentShared/index.d.ts +97 -0
  35. package/src/agentShared/types.d.ts +8 -0
  36. package/src/appTypes.d.ts +75 -0
  37. package/src/bookmark/databaseSchema.d.ts +33 -0
  38. package/src/charts/boxplotTypes.d.ts +15 -0
  39. package/src/charts/sampleAttributePlotTypes.d.ts +149 -0
  40. package/src/coreSpecAugmentation.d.ts +29 -0
  41. package/src/dialog/index.d.ts +5 -0
  42. package/src/embedTypes.d.ts +9 -0
  43. package/src/index.d.ts +16 -0
  44. package/src/sampleView/sampleViewTypes.d.ts +174 -0
  45. package/src/sampleView/state/payloadTypes.d.ts +400 -0
  46. package/src/sampleView/state/sampleState.d.ts +76 -0
  47. package/src/sampleView/types.d.ts +125 -0
  48. package/src/spec/appSpec.d.ts +54 -0
  49. package/src/spec/sampleView.d.ts +487 -0
  50. package/src/spec/view.d.ts +124 -0
  51. package/src/state/paramProvenanceTypes.d.ts +215 -0
  52. package/src/state/selectionExpansionTypes.d.ts +77 -0
  53. package/src/state.d.ts +97 -0
  54. package/src/types/lz-string.d.ts +24 -0
  55. package/src/types/vega-loader.d.ts +1 -0
  56. package/src/utils/colorScaleSummary.d.ts +15 -0
  57. package/src/utils/statistics/fieldSummary.d.ts +49 -0
  58. package/src/vite-env.d.ts +6 -0
  59. package/LICENSE +0 -21
  60. /package/dist/{AbortablePromiseCache-3gHJdF3E.js → AbortablePromiseCache-BDH1cqFl.js} +0 -0
  61. /package/dist/{chunk-INHXZS53-fPMmEwMt.js → chunk-INHXZS53-DwEV9sMh.js} +0 -0
  62. /package/dist/{esm-BygJiwh0.js → esm-BL9SNSnj.js} +0 -0
  63. /package/dist/{esm-B8-vSu-c.js → esm-BwW--bVV.js} +0 -0
  64. /package/dist/{esm-CGX-qz1d.js → esm-Bz_92nH0.js} +0 -0
  65. /package/dist/{esm-CuMSzCHy.js → esm-D2_c7lXY.js} +0 -0
  66. /package/dist/{parquetRead-CJe1UPsz.js → parquetRead-BuEN-6yG.js} +0 -0
@@ -0,0 +1,377 @@
1
+ import { a as e, n as t, o as n, t as r } from "./lit-ymUSmGBw.js";
2
+ import { n as i, r as a, t as o } from "./componentStyles-CIXoKEp0.js";
3
+ //#region src/components/generic/baseDialog.js
4
+ var s = new Set([
5
+ "text",
6
+ "search",
7
+ "email",
8
+ "url",
9
+ "password",
10
+ "tel",
11
+ "number",
12
+ "date",
13
+ "time",
14
+ "datetime-local",
15
+ "month",
16
+ "week"
17
+ ]), c = class extends r {
18
+ static properties = {
19
+ dialogTitle: {},
20
+ modal: { type: Boolean }
21
+ };
22
+ #e;
23
+ static styles = [
24
+ i,
25
+ o,
26
+ n`
27
+ dialog {
28
+ font-family: var(--gs-font-family, sans-serif);
29
+ font-size: var(--gs-font-size, 14px);
30
+ padding: 0;
31
+
32
+ box-shadow: 0px 3px 15px 0px rgba(0, 0, 0, 0.21);
33
+ background: white;
34
+ border-radius: 3px;
35
+ border: none;
36
+ min-width: 300px;
37
+
38
+ opacity: 1;
39
+ transform: translate(0, 0);
40
+ transition:
41
+ opacity 0.2s ease-in-out,
42
+ transform 0.2s ease-in-out;
43
+
44
+ @starting-style {
45
+ opacity: 0;
46
+ transform: translate(0, -15px);
47
+ }
48
+ }
49
+
50
+ dialog.closing {
51
+ opacity: 0;
52
+ transform: translate(0, -15px);
53
+ }
54
+
55
+ dialog::backdrop {
56
+ background-color: rgb(75, 75, 75);
57
+ opacity: 0.4;
58
+ transition: opacity 0.3s ease-in-out;
59
+
60
+ @starting-style {
61
+ opacity: 0;
62
+ }
63
+ }
64
+
65
+ dialog.closing::backdrop {
66
+ opacity: 0;
67
+ }
68
+
69
+ header,
70
+ section,
71
+ footer {
72
+ padding: var(--gs-basic-spacing, 10px);
73
+ }
74
+
75
+ header {
76
+ font-weight: bold;
77
+ padding-bottom: 0;
78
+ }
79
+
80
+ section {
81
+ > :first-child {
82
+ margin-top: 0;
83
+ }
84
+
85
+ > :last-child {
86
+ margin-bottom: 0;
87
+ }
88
+ }
89
+
90
+ footer {
91
+ border-top: 1px solid var(--gs-dialog-stroke-color, #d0d0d0);
92
+ padding: var(--gs-basic-spacing, 10px);
93
+
94
+ > div {
95
+ display: flex;
96
+ justify-content: flex-end;
97
+ gap: var(--gs-basic-spacing, 10px);
98
+ }
99
+ }
100
+
101
+ footer .btn.btn-primary {
102
+ --gs-dialog-primary-bg: var(--gs-theme-primary, #6c82ab);
103
+ --gs-dialog-primary-bg-hi: oklch(
104
+ from var(--gs-dialog-primary-bg) calc(l + 0.07) c h
105
+ );
106
+ --gs-dialog-primary-bg-lo: oklch(
107
+ from var(--gs-dialog-primary-bg) calc(l - 0.07) c h
108
+ );
109
+ background-color: var(--gs-dialog-primary-bg);
110
+ background-image: linear-gradient(
111
+ to bottom,
112
+ var(--gs-dialog-primary-bg-hi),
113
+ var(--gs-dialog-primary-bg-lo)
114
+ );
115
+ border-color: oklch(
116
+ from var(--gs-dialog-primary-bg) calc(l - 0.08) c h
117
+ );
118
+ color: var(--gs-theme-on-primary, #ffffff);
119
+ text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
120
+ }
121
+
122
+ footer .btn.btn-primary:hover:not(:disabled) {
123
+ background-image: linear-gradient(
124
+ to bottom,
125
+ oklch(from var(--gs-dialog-primary-bg) calc(l + 0.1) c h),
126
+ oklch(from var(--gs-dialog-primary-bg) calc(l - 0.04) c h)
127
+ );
128
+ }
129
+
130
+ footer .btn.btn-primary svg {
131
+ filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.2));
132
+ }
133
+
134
+ footer .btn.btn-primary:disabled {
135
+ background-color: oklch(
136
+ from var(--gs-dialog-primary-bg) calc(l + 0.08) c h
137
+ );
138
+ background-image: none;
139
+ border-color: oklch(
140
+ from var(--gs-dialog-primary-bg) calc(l - 0.02) c h
141
+ );
142
+ color: oklch(
143
+ from var(--gs-theme-on-primary, #ffffff) l c h / 0.6
144
+ );
145
+ text-shadow: none;
146
+ }
147
+
148
+ footer .btn.btn-primary:disabled svg {
149
+ filter: none;
150
+ }
151
+ `
152
+ ];
153
+ constructor() {
154
+ super(), this.dialogTitle = null, this.modal = !0, this.addEventListener("keydown", (e) => {
155
+ this.#t(e), e.stopPropagation();
156
+ });
157
+ }
158
+ #t(e) {
159
+ if (!e.defaultPrevented && e.key == "Enter" && !e.isComposing && !e.altKey && !e.ctrlKey && !e.metaKey) {
160
+ let t = e.composedPath().find((e) => e instanceof HTMLElement);
161
+ if (this.#n(t)) {
162
+ let t = this.#r();
163
+ t && (e.preventDefault(), t.click());
164
+ }
165
+ }
166
+ }
167
+ #n(e) {
168
+ let t = this.renderRoot instanceof ShadowRoot ? this.renderRoot : null, n = e ?? t?.activeElement;
169
+ if (!n) return !0;
170
+ let r = n.closest("input");
171
+ if (!r) return !1;
172
+ let i = (r.type || "text").toLowerCase();
173
+ return s.has(i);
174
+ }
175
+ #r() {
176
+ return this.renderRoot.querySelector("footer button[data-primary]:not(:disabled)");
177
+ }
178
+ firstUpdated() {
179
+ this.#e = this.renderRoot.querySelector("dialog"), this.modal ? this.#e.showModal() : this.#e.show(), this.#i();
180
+ }
181
+ #i() {
182
+ let e = this.renderRoot.querySelector("[autofocus]");
183
+ e && (queueMicrotask(() => {
184
+ this.isConnected && e.focus();
185
+ }), requestAnimationFrame(() => {
186
+ this.isConnected && e.focus();
187
+ }));
188
+ }
189
+ finish(e) {
190
+ this.dispatchEvent(new CustomEvent("gs-dialog-finished", {
191
+ detail: e,
192
+ bubbles: !0,
193
+ composed: !0
194
+ }));
195
+ }
196
+ #a(e) {
197
+ e.preventDefault(), this.finish({
198
+ ok: !1,
199
+ reason: "cancel"
200
+ }), this.triggerClose();
201
+ }
202
+ triggerClose() {
203
+ this.#e.addEventListener("transitionend", () => {
204
+ this.#e.close(), this.dispatchEvent(new CustomEvent("gs-dialog-closed", {
205
+ bubbles: !0,
206
+ composed: !0
207
+ }));
208
+ }), this.#e.classList.add("closing"), this.renderRoot.querySelector(".non-modal-backdrop")?.classList.add("closing");
209
+ }
210
+ onCloseButtonClick() {
211
+ "requestClose" in this.#e ? this.#e.requestClose() : (this.finish({
212
+ ok: !1,
213
+ reason: "cancel"
214
+ }), this.triggerClose());
215
+ }
216
+ renderHeader() {
217
+ return e`${this.dialogTitle ? e`${this.dialogTitle}` : t}`;
218
+ }
219
+ renderBody() {
220
+ return e``;
221
+ }
222
+ renderFooter() {
223
+ let n = this.renderButtons();
224
+ return n?.length ? e`<div>${n}</div>` : t;
225
+ }
226
+ renderButtons() {
227
+ return [this.makeCloseButton()];
228
+ }
229
+ makeButton(n, r, i = {}) {
230
+ let { iconDef: o, disabled: s = !1, preventMouseDown: c = !1, isPrimary: l = !1 } = i, u = n == "Next", d = ["btn"];
231
+ return u && d.push("reverse"), l && d.push("btn-primary"), e`<button
232
+ class=${d.join(" ")}
233
+ type="button"
234
+ title=${n}
235
+ ?disabled=${s}
236
+ ?data-primary=${l}
237
+ @mousedown=${c ? (e) => e.preventDefault() : void 0}
238
+ @click=${async () => {
239
+ await r() || this.triggerClose();
240
+ }}
241
+ >
242
+ ${o ? a(o).node[0] : t} ${n}
243
+ </button>`;
244
+ }
245
+ makeCloseButton(e = "Close") {
246
+ return this.makeButton(e, () => this.onCloseButtonClick(), { preventMouseDown: !0 });
247
+ }
248
+ render() {
249
+ let n = this.renderHeader(), r = this.renderFooter();
250
+ return e`
251
+ ${this.modal ? t : e`<div class="non-modal-backdrop"></div>`}
252
+ <dialog
253
+ @cancel=${(e) => this.#a(e)}
254
+ >
255
+ ${n ? e`<header>${n}</header>` : t}
256
+ <section>${this.renderBody()}</section>
257
+ ${r ? e`<footer>${r}</footer>` : t}
258
+ </dialog>
259
+ `;
260
+ }
261
+ };
262
+ function l(e, t) {
263
+ return f(e, t).promise;
264
+ }
265
+ function u(e, t, n) {
266
+ return l(e, t).then(n);
267
+ }
268
+ function d(e, t) {
269
+ return u(e, t, (e) => !!e.ok);
270
+ }
271
+ function f(e, t) {
272
+ let n = document.createElement(e);
273
+ t && t(n);
274
+ let r = new Promise((e) => {
275
+ n.addEventListener("gs-dialog-finished", (t) => {
276
+ e(t.detail);
277
+ }, { once: !0 });
278
+ });
279
+ return n.addEventListener("gs-dialog-closed", () => {
280
+ n.remove();
281
+ }), document.body.appendChild(n), {
282
+ element: n,
283
+ promise: r
284
+ };
285
+ }
286
+ //#endregion
287
+ //#region src/components/generic/messageDialog.js
288
+ var p = {
289
+ warning: {
290
+ prefix: "fas",
291
+ iconName: "triangle-exclamation",
292
+ icon: [
293
+ 512,
294
+ 512,
295
+ [
296
+ 9888,
297
+ "exclamation-triangle",
298
+ "warning"
299
+ ],
300
+ "f071",
301
+ "M256 32c14.2 0 27.3 7.5 34.5 19.8l216 368c7.3 12.4 7.3 27.7 .2 40.1S486.3 480 472 480L40 480c-14.3 0-27.6-7.7-34.7-20.1s-7-27.8 .2-40.1l216-368C228.7 39.5 241.8 32 256 32zm0 128c-13.3 0-24 10.7-24 24l0 112c0 13.3 10.7 24 24 24s24-10.7 24-24l0-112c0-13.3-10.7-24-24-24zm32 224a32 32 0 1 0 -64 0 32 32 0 1 0 64 0z"
302
+ ]
303
+ },
304
+ error: {
305
+ prefix: "fas",
306
+ iconName: "circle-xmark",
307
+ icon: [
308
+ 512,
309
+ 512,
310
+ [
311
+ 61532,
312
+ "times-circle",
313
+ "xmark-circle"
314
+ ],
315
+ "f057",
316
+ "M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM175 175c9.4-9.4 24.6-9.4 33.9 0l47 47 47-47c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9l-47 47 47 47c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0l-47-47-47 47c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9l47-47-47-47c-9.4-9.4-9.4-24.6 0-33.9z"
317
+ ]
318
+ },
319
+ info: {
320
+ prefix: "fas",
321
+ iconName: "circle-info",
322
+ icon: [
323
+ 512,
324
+ 512,
325
+ ["info-circle"],
326
+ "f05a",
327
+ "M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM216 336l24 0 0-64-24 0c-13.3 0-24-10.7-24-24s10.7-24 24-24l48 0c13.3 0 24 10.7 24 24l0 88 8 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-80 0c-13.3 0-24-10.7-24-24s10.7-24 24-24zm40-208a32 32 0 1 1 0 64 32 32 0 1 1 0-64z"
328
+ ]
329
+ }
330
+ }, m = class extends c {
331
+ static properties = {
332
+ ...super.properties,
333
+ message: {},
334
+ type: { type: String },
335
+ confirm: { type: Boolean }
336
+ };
337
+ static styles = [...super.styles, n`
338
+ .message-flex {
339
+ display: flex;
340
+ flex-direction: row;
341
+ align-items: center;
342
+ gap: calc(var(--gs-basic-spacing) * 2);
343
+ padding: var(--gs-basic-spacing);
344
+ box-sizing: border-box;
345
+ max-width: 400px;
346
+ }
347
+
348
+ .icon svg {
349
+ height: 3em;
350
+ }
351
+ `];
352
+ constructor() {
353
+ super(), this.message = "", this.type = "info", this.confirm = !1;
354
+ }
355
+ renderButtons() {
356
+ return this.confirm ? [this.makeCloseButton("Cancel"), this.makeButton("OK", () => {
357
+ this.finish({ ok: !0 }), this.triggerClose();
358
+ }, { isPrimary: !0 })] : super.renderButtons();
359
+ }
360
+ renderBody() {
361
+ if (this.type) {
362
+ let n = p[this.type];
363
+ return e`<div class="message-flex">
364
+ ${n ? e`<div class="icon">${a(n).node[0]}</div>` : t}
365
+ <div class="message">${this.message}</div>
366
+ </div>`;
367
+ } else return e`${this.message}`;
368
+ }
369
+ };
370
+ customElements.define("gs-message-dialog", m);
371
+ function h(e, t = {}) {
372
+ return d("gs-message-dialog", (n) => {
373
+ n.message = e, n.dialogTitle = t.title, n.type = t.type, n.confirm = t.confirm;
374
+ });
375
+ }
376
+ //#endregion
377
+ export { c as BaseDialog, l as showDialog, h as showMessageDialog };
@@ -1,5 +1,5 @@
1
1
  import { t as e } from "./esm-BDFRLEuD.js";
2
- import { t } from "./browser-Dvlo92rx.js";
2
+ import { n as t } from "./esm-DRZ5LLNH.js";
3
3
  //#region ../core/node_modules/@gmod/indexedfasta/esm/indexedFasta.js
4
4
  function n(e, t, n, r) {
5
5
  return e + t * Math.floor(r / n) + r % n;
@@ -0,0 +1,121 @@
1
+ import { t as e } from "./esm-DPS6pYKF.js";
2
+ import { n as t } from "./esm-BY4T8YoD.js";
3
+ //#region ../core/node_modules/@gmod/indexedfasta/esm/indexedFasta.js
4
+ function n(e, t, n, r) {
5
+ return e + t * Math.floor(r / n) + r % n;
6
+ }
7
+ async function r(e, t = {}) {
8
+ let n = new TextDecoder("utf8").decode(await e.readFile(t)), r = [], i = [], a = [], o = [], s = [], c = {}, l = 0, u = n.length, d = 0;
9
+ for (; l < u;) {
10
+ let e = n.indexOf("\n", l);
11
+ e === -1 && (e = u);
12
+ let t = n.slice(l, e);
13
+ if (t.endsWith("\r") && (t = t.slice(0, -1)), t = t.trim(), l = e + 1, t.length === 0) continue;
14
+ let f = t.indexOf(" "), p = t.indexOf(" ", f + 1), m = t.indexOf(" ", p + 1), h = t.indexOf(" ", m + 1), g = t.slice(0, f);
15
+ if (g.startsWith(">")) throw Error("found > in sequence name, might have supplied FASTA file for the FASTA index");
16
+ r.push(g), a.push(+t.slice(f + 1, p)), i.push(+t.slice(p + 1, m)), o.push(+t.slice(m + 1, h)), s.push(+t.slice(h + 1)), c[g] = d, d++;
17
+ }
18
+ return {
19
+ names: r,
20
+ nameToIndex: c,
21
+ offsets: i,
22
+ lengths: a,
23
+ lineLengths: o,
24
+ lineBytes: s
25
+ };
26
+ }
27
+ var i = class {
28
+ constructor({ fasta: e, fai: n, path: r, faiPath: i }) {
29
+ if (e) this.fasta = e;
30
+ else if (r) this.fasta = new t(r);
31
+ else throw Error("Need to pass filehandle for fasta or path to localfile");
32
+ if (n) this.fai = n;
33
+ else if (i) this.fai = new t(i);
34
+ else if (r) this.fai = new t(`${r}.fai`);
35
+ else throw Error("Need to pass filehandle for or path to localfile");
36
+ }
37
+ async _getIndexes(e) {
38
+ return this.indexes ||= r(this.fai, e).catch((e) => {
39
+ throw this.indexes = void 0, e;
40
+ }), this.indexes;
41
+ }
42
+ async getSequenceNames(e) {
43
+ return (await this._getIndexes(e)).names;
44
+ }
45
+ async getSequenceSizes(e) {
46
+ let t = await this._getIndexes(e);
47
+ if (!t.sizesCache) {
48
+ let e = {};
49
+ for (let n = 0; n < t.names.length; n++) e[t.names[n]] = t.lengths[n];
50
+ t.sizesCache = e;
51
+ }
52
+ return t.sizesCache;
53
+ }
54
+ async getSequenceSize(e, t) {
55
+ let n = await this._getIndexes(t), r = n.nameToIndex[e];
56
+ return r === void 0 ? void 0 : n.lengths[r];
57
+ }
58
+ async hasReferenceSequence(e, t) {
59
+ return (await this._getIndexes(t)).nameToIndex[e] !== void 0;
60
+ }
61
+ async getResiduesByName(e, t, n, r) {
62
+ let i = await this._getIndexes(r), a = i.nameToIndex[e];
63
+ if (a !== void 0) return this._fetchFromIndex(i.offsets[a], i.lineBytes[a], i.lineLengths[a], i.lengths[a], t, n, r);
64
+ }
65
+ async getSequence(e, t, n, r) {
66
+ return this.getResiduesByName(e, t, n, r);
67
+ }
68
+ async _fetchFromIndex(e, t, r, i, a = 0, o, s) {
69
+ let c = o;
70
+ if (a < 0) throw TypeError("regionStart cannot be less than 0");
71
+ if ((c === void 0 || c > i) && (c = i), a >= c) return "";
72
+ let l = n(e, t, r, a), u = n(e, t, r, c) - l, d = new TextDecoder("utf8").decode(await this.fasta.read(u, l, s)).replace(/\s+/g, "");
73
+ if (/[^\x20-\x7e]/.test(d.slice(0, 1e3))) throw Error("Non-ASCII characters detected in sequence. The file may be gzip compressed. Use BgzipIndexedFasta for bgzip files, or decompress the file.");
74
+ return d;
75
+ }
76
+ }, a = class extends i {
77
+ constructor({ fasta: n, path: r, fai: i, faiPath: a, gzi: o, gziPath: s }) {
78
+ super({
79
+ fasta: n,
80
+ path: r,
81
+ fai: i,
82
+ faiPath: a
83
+ }), n && o ? this.fasta = new e({
84
+ filehandle: n,
85
+ gziFilehandle: o
86
+ }) : r && s && (this.fasta = new e({
87
+ filehandle: new t(r),
88
+ gziFilehandle: new t(s)
89
+ }));
90
+ }
91
+ };
92
+ //#endregion
93
+ //#region ../core/node_modules/@gmod/indexedfasta/esm/index.js
94
+ function o(e) {
95
+ return e.split(">").filter((e) => /\S/.test(e)).map((e) => {
96
+ let [t, ...n] = e.split("\n"), [r, ...i] = t.split(" "), a = n.join("").replace(/\s/g, "");
97
+ return {
98
+ id: r,
99
+ description: i.join(" "),
100
+ sequence: a
101
+ };
102
+ });
103
+ }
104
+ var s = class {
105
+ constructor({ fasta: e, path: n }) {
106
+ if (e) this.fasta = e;
107
+ else if (n) this.fasta = new t(n);
108
+ else throw Error("Need to pass fasta or path");
109
+ this.data = this.fasta.readFile().then((e) => o(new TextDecoder("utf8").decode(e)));
110
+ }
111
+ async fetch(e, t, n) {
112
+ let r = (await this.data).find((t) => t.id === e), i = n - t;
113
+ if (!r) throw Error(`no sequence with id ${e} exists`);
114
+ return r.sequence.slice(t, i);
115
+ }
116
+ async getSequenceNames() {
117
+ return (await this.data).map((e) => e.id);
118
+ }
119
+ };
120
+ //#endregion
121
+ export { a as BgzipIndexedFasta, s as FetchableSmallFasta, i as IndexedFasta, o as parseSmallFasta };
@@ -1,7 +1,7 @@
1
- import { t as e } from "./esm-CGX-qz1d.js";
2
- import { n as t, r as n } from "./esm-BDFRLEuD.js";
3
- import { r, t as i } from "./browser-Dvlo92rx.js";
4
- import { t as a } from "./AbortablePromiseCache-3gHJdF3E.js";
1
+ import { n as e, r as t } from "./esm-BDFRLEuD.js";
2
+ import { t as n } from "./esm-CZvS2Ldm.js";
3
+ import { n as r, r as i } from "./esm-DRZ5LLNH.js";
4
+ import { t as a } from "./AbortablePromiseCache-beUIcZcW.js";
5
5
  //#region ../../node_modules/@gmod/tabix/esm/chunk.js
6
6
  var o = class {
7
7
  constructor(e, t, n, r) {
@@ -132,8 +132,8 @@ var b = class extends s {
132
132
  coordinateType: i
133
133
  };
134
134
  }
135
- async _parse(e = {}) {
136
- let n = await t(await this.filehandle.readFile(e)), r = new DataView(n.buffer), i;
135
+ async _parse(t = {}) {
136
+ let n = await e(await this.filehandle.readFile(t)), r = new DataView(n.buffer), i;
137
137
  if (r.getUint32(0, !0) === h) i = 1;
138
138
  else if (r.getUint32(0, !0) === g) i = 2;
139
139
  else throw Error("Not a CSI file");
@@ -226,8 +226,8 @@ var w = class extends s {
226
226
  let n = await this.parse(t), r = n.refNameToId[e];
227
227
  return r === void 0 || !n.indices[r] ? -1 : n.indices[r].stats?.lineCount ?? -1;
228
228
  }
229
- async _parse(e = {}) {
230
- let n = await t(await this.filehandle.readFile(e)), r = new DataView(n.buffer);
229
+ async _parse(t = {}) {
230
+ let n = await e(await this.filehandle.readFile(t)), r = new DataView(n.buffer);
231
231
  if (r.getUint32(0, !0) !== x) throw Error("Not a TBI file");
232
232
  let i = r.getUint32(4, !0), a = r.getUint32(8, !0), s = a & 65536 ? "zero-based-half-open" : "1-based-closed", c = {
233
233
  0: "generic",
@@ -305,12 +305,12 @@ var w = class extends s {
305
305
  return f(l, d);
306
306
  }
307
307
  }, T = class {
308
- constructor({ path: t, filehandle: n, url: o, tbiPath: s, tbiUrl: c, tbiFilehandle: l, csiPath: u, csiUrl: d, csiFilehandle: f, renameRefSeqs: p, chunkCacheSize: m = 5 * 2 ** 20 }) {
309
- this.cache = new e({ maxSize: 1e3 });
308
+ constructor({ path: e, filehandle: t, url: o, tbiPath: s, tbiUrl: c, tbiFilehandle: l, csiPath: u, csiUrl: d, csiFilehandle: f, renameRefSeqs: p, chunkCacheSize: m = 5 * 2 ** 20 }) {
309
+ this.cache = new n({ maxSize: 1e3 });
310
310
  let h = p ?? ((e) => e);
311
- if (n) this.filehandle = n;
312
- else if (t) this.filehandle = new i(t);
313
- else if (o) this.filehandle = new r(o);
311
+ if (t) this.filehandle = t;
312
+ else if (e) this.filehandle = new r(e);
313
+ else if (o) this.filehandle = new i(o);
314
314
  else throw TypeError("must provide either filehandle or path");
315
315
  if (l) this.index = new w({
316
316
  filehandle: l,
@@ -321,23 +321,23 @@ var w = class extends s {
321
321
  renameRefSeqs: h
322
322
  });
323
323
  else if (s) this.index = new w({
324
- filehandle: new i(s),
324
+ filehandle: new r(s),
325
325
  renameRefSeqs: h
326
326
  });
327
327
  else if (u) this.index = new b({
328
- filehandle: new i(u),
328
+ filehandle: new r(u),
329
329
  renameRefSeqs: h
330
330
  });
331
- else if (t) this.index = new w({
332
- filehandle: new i(`${t}.tbi`),
331
+ else if (e) this.index = new w({
332
+ filehandle: new r(`${e}.tbi`),
333
333
  renameRefSeqs: h
334
334
  });
335
- else if (d) this.index = new b({ filehandle: new r(d) });
336
- else if (c) this.index = new w({ filehandle: new r(c) });
337
- else if (o) this.index = new w({ filehandle: new r(`${o}.tbi`) });
335
+ else if (d) this.index = new b({ filehandle: new i(d) });
336
+ else if (c) this.index = new w({ filehandle: new i(c) });
337
+ else if (o) this.index = new w({ filehandle: new i(`${o}.tbi`) });
338
338
  else throw TypeError("must provide one of tbiFilehandle, tbiPath, csiFilehandle, csiPath, tbiUrl, csiUrl");
339
339
  this.renameRefSeq = h, this.hasCustomRenameRefSeq = p !== void 0, this.chunkCache = new a({
340
- cache: new e({ maxSize: Math.floor(m / 65536) }),
340
+ cache: new n({ maxSize: Math.floor(m / 65536) }),
341
341
  fill: (e, t) => this.readChunk(e, { signal: t })
342
342
  });
343
343
  }
@@ -386,8 +386,8 @@ var w = class extends s {
386
386
  async getMetadata(e = {}) {
387
387
  return this.index.getMetadata(e);
388
388
  }
389
- async getHeaderBuffer(e = {}) {
390
- let { firstDataLine: n, metaChar: r, maxBlockSize: i } = await this.getMetadata(e), a = (n?.blockPosition || 0) + i, o = await t(await this.filehandle.read(a, 0, e));
389
+ async getHeaderBuffer(t = {}) {
390
+ let { firstDataLine: n, metaChar: r, maxBlockSize: i } = await this.getMetadata(t), a = (n?.blockPosition || 0) + i, o = await e(await this.filehandle.read(a, 0, t));
391
391
  if (r) {
392
392
  let e = -1, t = r.charCodeAt(0);
393
393
  for (let n = 0, r = o.length; n < r; n++) {
@@ -453,8 +453,8 @@ var w = class extends s {
453
453
  async lineCount(e, t = {}) {
454
454
  return this.index.lineCount(e, t);
455
455
  }
456
- async readChunk(e, t = {}) {
457
- return n(await this.filehandle.read(e.fetchedSize(), e.minv.blockPosition, t), e, this.cache);
456
+ async readChunk(e, n = {}) {
457
+ return t(await this.filehandle.read(e.fetchedSize(), e.minv.blockPosition, n), e, this.cache);
458
458
  }
459
459
  };
460
460
  //#endregion