@genome-spy/app 0.73.0 → 0.75.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 (38) hide show
  1. package/dist/AbortablePromiseCache-3gHJdF3E.js +96 -0
  2. package/dist/blosc-oa0DlI6G.js +692 -0
  3. package/dist/browser-Dvlo92rx.js +126 -0
  4. package/dist/chunk-CPXzm0be.js +11 -0
  5. package/dist/chunk-INHXZS53-fPMmEwMt.js +13 -0
  6. package/dist/esm-B8-vSu-c.js +369 -0
  7. package/dist/esm-BDFRLEuD.js +1248 -0
  8. package/dist/esm-BygJiwh0.js +573 -0
  9. package/dist/esm-CGX-qz1d.js +155 -0
  10. package/dist/esm-Cmo4qEPr.js +1015 -0
  11. package/dist/esm-CuMSzCHy.js +298 -0
  12. package/dist/esm-D-WfYOx7.js +461 -0
  13. package/dist/esm-DCCYNvaz.js +1426 -0
  14. package/dist/esm-n0auOe11.js +121 -0
  15. package/dist/index.es.js +41252 -52718
  16. package/dist/index.js +1093 -1099
  17. package/dist/lz4-jZ0zyLBa.js +626 -0
  18. package/dist/parquetRead-CJe1UPsz.js +1609 -0
  19. package/dist/schema.json +11293 -5027
  20. package/dist/style.css +2 -1
  21. package/dist/zstd-C6ksIG9r.js +583 -0
  22. package/package.json +14 -5
  23. package/dist/AbortablePromiseCache-Dj0vzLnp.js +0 -149
  24. package/dist/blosc-D1xNXZJs.js +0 -719
  25. package/dist/browser-0iNU5Wit.js +0 -138
  26. package/dist/chunk-INHXZS53-DiyuLb3Z.js +0 -14
  27. package/dist/index-BUsSzlHg.js +0 -1771
  28. package/dist/index-BYsZN7b0.js +0 -1597
  29. package/dist/index-C7wOh6y1.js +0 -657
  30. package/dist/index-CRaQAuki.js +0 -326
  31. package/dist/index-D9v1PCj9.js +0 -507
  32. package/dist/index-GDOuv_D5.js +0 -266
  33. package/dist/index-Gt44EOIH.js +0 -628
  34. package/dist/inflate-GtwLkvSP.js +0 -1048
  35. package/dist/lz4-1Ws5oVWR.js +0 -640
  36. package/dist/parquetRead-BnAGCa4_.js +0 -1663
  37. package/dist/unzip-Bac01w6X.js +0 -1492
  38. package/dist/zstd-C4EcZnjq.js +0 -603
@@ -1,1771 +0,0 @@
1
- import { RemoteFile as Re, LocalFile as De } from "./browser-0iNU5Wit.js";
2
- import { A as ue } from "./AbortablePromiseCache-Dj0vzLnp.js";
3
- import { i as Ne } from "./inflate-GtwLkvSP.js";
4
- function Le(t) {
5
- return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
6
- }
7
- const fe = BigInt(32);
8
- function Me(t, r, e) {
9
- const n = +!!e, i = +!e;
10
- return BigInt(t.getInt32(r, e) * i + t.getInt32(r + 4, e) * n) << fe | BigInt(t.getUint32(r, e) * n + t.getUint32(r + 4, e) * i);
11
- }
12
- function He(t, r, e) {
13
- const n = t.getUint32(r, e), i = t.getUint32(r + 4, e), o = +!!e, s = +!e;
14
- return BigInt(n * s + i * o) << fe | BigInt(n * o + i * s);
15
- }
16
- "getBigInt64" in DataView || (DataView.prototype.getBigInt64 = function(t, r) {
17
- return Me(this, t, r);
18
- });
19
- "getBigUint64" in DataView || (DataView.prototype.getBigUint64 = function(t, r) {
20
- return He(this, t, r);
21
- });
22
- var J = function(t, r) {
23
- return J = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, n) {
24
- e.__proto__ = n;
25
- } || function(e, n) {
26
- for (var i in n) Object.prototype.hasOwnProperty.call(n, i) && (e[i] = n[i]);
27
- }, J(t, r);
28
- };
29
- function X(t, r) {
30
- if (typeof r != "function" && r !== null)
31
- throw new TypeError("Class extends value " + String(r) + " is not a constructor or null");
32
- J(t, r);
33
- function e() {
34
- this.constructor = t;
35
- }
36
- t.prototype = r === null ? Object.create(r) : (e.prototype = r.prototype, new e());
37
- }
38
- function $e(t, r, e, n) {
39
- function i(o) {
40
- return o instanceof e ? o : new e(function(s) {
41
- s(o);
42
- });
43
- }
44
- return new (e || (e = Promise))(function(o, s) {
45
- function u(h) {
46
- try {
47
- c(n.next(h));
48
- } catch (d) {
49
- s(d);
50
- }
51
- }
52
- function a(h) {
53
- try {
54
- c(n.throw(h));
55
- } catch (d) {
56
- s(d);
57
- }
58
- }
59
- function c(h) {
60
- h.done ? o(h.value) : i(h.value).then(u, a);
61
- }
62
- c((n = n.apply(t, r || [])).next());
63
- });
64
- }
65
- function le(t, r) {
66
- var e = { label: 0, sent: function() {
67
- if (o[0] & 1) throw o[1];
68
- return o[1];
69
- }, trys: [], ops: [] }, n, i, o, s = Object.create((typeof Iterator == "function" ? Iterator : Object).prototype);
70
- return s.next = u(0), s.throw = u(1), s.return = u(2), typeof Symbol == "function" && (s[Symbol.iterator] = function() {
71
- return this;
72
- }), s;
73
- function u(c) {
74
- return function(h) {
75
- return a([c, h]);
76
- };
77
- }
78
- function a(c) {
79
- if (n) throw new TypeError("Generator is already executing.");
80
- for (; s && (s = 0, c[0] && (e = 0)), e; ) try {
81
- if (n = 1, i && (o = c[0] & 2 ? i.return : c[0] ? i.throw || ((o = i.return) && o.call(i), 0) : i.next) && !(o = o.call(i, c[1])).done) return o;
82
- switch (i = 0, o && (c = [c[0] & 2, o.value]), c[0]) {
83
- case 0:
84
- case 1:
85
- o = c;
86
- break;
87
- case 4:
88
- return e.label++, { value: c[1], done: !1 };
89
- case 5:
90
- e.label++, i = c[1], c = [0];
91
- continue;
92
- case 7:
93
- c = e.ops.pop(), e.trys.pop();
94
- continue;
95
- default:
96
- if (o = e.trys, !(o = o.length > 0 && o[o.length - 1]) && (c[0] === 6 || c[0] === 2)) {
97
- e = 0;
98
- continue;
99
- }
100
- if (c[0] === 3 && (!o || c[1] > o[0] && c[1] < o[3])) {
101
- e.label = c[1];
102
- break;
103
- }
104
- if (c[0] === 6 && e.label < o[1]) {
105
- e.label = o[1], o = c;
106
- break;
107
- }
108
- if (o && e.label < o[2]) {
109
- e.label = o[2], e.ops.push(c);
110
- break;
111
- }
112
- o[2] && e.ops.pop(), e.trys.pop();
113
- continue;
114
- }
115
- c = r.call(t, e);
116
- } catch (h) {
117
- c = [6, h], i = 0;
118
- } finally {
119
- n = o = 0;
120
- }
121
- if (c[0] & 5) throw c[1];
122
- return { value: c[0] ? c[1] : void 0, done: !0 };
123
- }
124
- }
125
- function N(t) {
126
- var r = typeof Symbol == "function" && Symbol.iterator, e = r && t[r], n = 0;
127
- if (e) return e.call(t);
128
- if (t && typeof t.length == "number") return {
129
- next: function() {
130
- return t && n >= t.length && (t = void 0), { value: t && t[n++], done: !t };
131
- }
132
- };
133
- throw new TypeError(r ? "Object is not iterable." : "Symbol.iterator is not defined.");
134
- }
135
- function Z(t, r) {
136
- var e = typeof Symbol == "function" && t[Symbol.iterator];
137
- if (!e) return t;
138
- var n = e.call(t), i, o = [], s;
139
- try {
140
- for (; (r === void 0 || r-- > 0) && !(i = n.next()).done; ) o.push(i.value);
141
- } catch (u) {
142
- s = { error: u };
143
- } finally {
144
- try {
145
- i && !i.done && (e = n.return) && e.call(n);
146
- } finally {
147
- if (s) throw s.error;
148
- }
149
- }
150
- return o;
151
- }
152
- function K(t, r, e) {
153
- if (e || arguments.length === 2) for (var n = 0, i = r.length, o; n < i; n++)
154
- (o || !(n in r)) && (o || (o = Array.prototype.slice.call(r, 0, n)), o[n] = r[n]);
155
- return t.concat(o || Array.prototype.slice.call(r));
156
- }
157
- function z(t) {
158
- return this instanceof z ? (this.v = t, this) : new z(t);
159
- }
160
- function je(t, r, e) {
161
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
162
- var n = e.apply(t, r || []), i, o = [];
163
- return i = Object.create((typeof AsyncIterator == "function" ? AsyncIterator : Object).prototype), u("next"), u("throw"), u("return", s), i[Symbol.asyncIterator] = function() {
164
- return this;
165
- }, i;
166
- function s(f) {
167
- return function(m) {
168
- return Promise.resolve(m).then(f, d);
169
- };
170
- }
171
- function u(f, m) {
172
- n[f] && (i[f] = function(l) {
173
- return new Promise(function(B, w) {
174
- o.push([f, l, B, w]) > 1 || a(f, l);
175
- });
176
- }, m && (i[f] = m(i[f])));
177
- }
178
- function a(f, m) {
179
- try {
180
- c(n[f](m));
181
- } catch (l) {
182
- b(o[0][3], l);
183
- }
184
- }
185
- function c(f) {
186
- f.value instanceof z ? Promise.resolve(f.value.v).then(h, d) : b(o[0][2], f);
187
- }
188
- function h(f) {
189
- a("next", f);
190
- }
191
- function d(f) {
192
- a("throw", f);
193
- }
194
- function b(f, m) {
195
- f(m), o.shift(), o.length && a(o[0][0], o[0][1]);
196
- }
197
- }
198
- function Ge(t) {
199
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
200
- var r = t[Symbol.asyncIterator], e;
201
- return r ? r.call(t) : (t = typeof N == "function" ? N(t) : t[Symbol.iterator](), e = {}, n("next"), n("throw"), n("return"), e[Symbol.asyncIterator] = function() {
202
- return this;
203
- }, e);
204
- function n(o) {
205
- e[o] = t[o] && function(s) {
206
- return new Promise(function(u, a) {
207
- s = t[o](s), i(u, a, s.done, s.value);
208
- });
209
- };
210
- }
211
- function i(o, s, u, a) {
212
- Promise.resolve(a).then(function(c) {
213
- o({ value: c, done: u });
214
- }, s);
215
- }
216
- }
217
- function O(t) {
218
- return typeof t == "function";
219
- }
220
- function he(t) {
221
- var r = function(n) {
222
- Error.call(n), n.stack = new Error().stack;
223
- }, e = t(r);
224
- return e.prototype = Object.create(Error.prototype), e.prototype.constructor = e, e;
225
- }
226
- var q = he(function(t) {
227
- return function(e) {
228
- t(this), this.message = e ? e.length + ` errors occurred during unsubscription:
229
- ` + e.map(function(n, i) {
230
- return i + 1 + ") " + n.toString();
231
- }).join(`
232
- `) : "", this.name = "UnsubscriptionError", this.errors = e;
233
- };
234
- });
235
- function ne(t, r) {
236
- if (t) {
237
- var e = t.indexOf(r);
238
- 0 <= e && t.splice(e, 1);
239
- }
240
- }
241
- var ee = (function() {
242
- function t(r) {
243
- this.initialTeardown = r, this.closed = !1, this._parentage = null, this._finalizers = null;
244
- }
245
- return t.prototype.unsubscribe = function() {
246
- var r, e, n, i, o;
247
- if (!this.closed) {
248
- this.closed = !0;
249
- var s = this._parentage;
250
- if (s)
251
- if (this._parentage = null, Array.isArray(s))
252
- try {
253
- for (var u = N(s), a = u.next(); !a.done; a = u.next()) {
254
- var c = a.value;
255
- c.remove(this);
256
- }
257
- } catch (l) {
258
- r = { error: l };
259
- } finally {
260
- try {
261
- a && !a.done && (e = u.return) && e.call(u);
262
- } finally {
263
- if (r) throw r.error;
264
- }
265
- }
266
- else
267
- s.remove(this);
268
- var h = this.initialTeardown;
269
- if (O(h))
270
- try {
271
- h();
272
- } catch (l) {
273
- o = l instanceof q ? l.errors : [l];
274
- }
275
- var d = this._finalizers;
276
- if (d) {
277
- this._finalizers = null;
278
- try {
279
- for (var b = N(d), f = b.next(); !f.done; f = b.next()) {
280
- var m = f.value;
281
- try {
282
- ie(m);
283
- } catch (l) {
284
- o = o ?? [], l instanceof q ? o = K(K([], Z(o)), Z(l.errors)) : o.push(l);
285
- }
286
- }
287
- } catch (l) {
288
- n = { error: l };
289
- } finally {
290
- try {
291
- f && !f.done && (i = b.return) && i.call(b);
292
- } finally {
293
- if (n) throw n.error;
294
- }
295
- }
296
- }
297
- if (o)
298
- throw new q(o);
299
- }
300
- }, t.prototype.add = function(r) {
301
- var e;
302
- if (r && r !== this)
303
- if (this.closed)
304
- ie(r);
305
- else {
306
- if (r instanceof t) {
307
- if (r.closed || r._hasParent(this))
308
- return;
309
- r._addParent(this);
310
- }
311
- (this._finalizers = (e = this._finalizers) !== null && e !== void 0 ? e : []).push(r);
312
- }
313
- }, t.prototype._hasParent = function(r) {
314
- var e = this._parentage;
315
- return e === r || Array.isArray(e) && e.includes(r);
316
- }, t.prototype._addParent = function(r) {
317
- var e = this._parentage;
318
- this._parentage = Array.isArray(e) ? (e.push(r), e) : e ? [e, r] : r;
319
- }, t.prototype._removeParent = function(r) {
320
- var e = this._parentage;
321
- e === r ? this._parentage = null : Array.isArray(e) && ne(e, r);
322
- }, t.prototype.remove = function(r) {
323
- var e = this._finalizers;
324
- e && ne(e, r), r instanceof t && r._removeParent(this);
325
- }, t.EMPTY = (function() {
326
- var r = new t();
327
- return r.closed = !0, r;
328
- })(), t;
329
- })();
330
- ee.EMPTY;
331
- function de(t) {
332
- return t instanceof ee || t && "closed" in t && O(t.remove) && O(t.add) && O(t.unsubscribe);
333
- }
334
- function ie(t) {
335
- O(t) ? t() : t.unsubscribe();
336
- }
337
- var We = {
338
- Promise: void 0
339
- }, qe = {
340
- setTimeout: function(t, r) {
341
- for (var e = [], n = 2; n < arguments.length; n++)
342
- e[n - 2] = arguments[n];
343
- return setTimeout.apply(void 0, K([t, r], Z(e)));
344
- },
345
- clearTimeout: function(t) {
346
- return clearTimeout(t);
347
- },
348
- delegate: void 0
349
- };
350
- function me(t) {
351
- qe.setTimeout(function() {
352
- throw t;
353
- });
354
- }
355
- function oe() {
356
- }
357
- function Ye(t) {
358
- t();
359
- }
360
- var te = (function(t) {
361
- X(r, t);
362
- function r(e) {
363
- var n = t.call(this) || this;
364
- return n.isStopped = !1, e ? (n.destination = e, de(e) && e.add(n)) : n.destination = Ze, n;
365
- }
366
- return r.create = function(e, n, i) {
367
- return new $(e, n, i);
368
- }, r.prototype.next = function(e) {
369
- this.isStopped || this._next(e);
370
- }, r.prototype.error = function(e) {
371
- this.isStopped || (this.isStopped = !0, this._error(e));
372
- }, r.prototype.complete = function() {
373
- this.isStopped || (this.isStopped = !0, this._complete());
374
- }, r.prototype.unsubscribe = function() {
375
- this.closed || (this.isStopped = !0, t.prototype.unsubscribe.call(this), this.destination = null);
376
- }, r.prototype._next = function(e) {
377
- this.destination.next(e);
378
- }, r.prototype._error = function(e) {
379
- try {
380
- this.destination.error(e);
381
- } finally {
382
- this.unsubscribe();
383
- }
384
- }, r.prototype._complete = function() {
385
- try {
386
- this.destination.complete();
387
- } finally {
388
- this.unsubscribe();
389
- }
390
- }, r;
391
- })(ee), Qe = (function() {
392
- function t(r) {
393
- this.partialObserver = r;
394
- }
395
- return t.prototype.next = function(r) {
396
- var e = this.partialObserver;
397
- if (e.next)
398
- try {
399
- e.next(r);
400
- } catch (n) {
401
- M(n);
402
- }
403
- }, t.prototype.error = function(r) {
404
- var e = this.partialObserver;
405
- if (e.error)
406
- try {
407
- e.error(r);
408
- } catch (n) {
409
- M(n);
410
- }
411
- else
412
- M(r);
413
- }, t.prototype.complete = function() {
414
- var r = this.partialObserver;
415
- if (r.complete)
416
- try {
417
- r.complete();
418
- } catch (e) {
419
- M(e);
420
- }
421
- }, t;
422
- })(), $ = (function(t) {
423
- X(r, t);
424
- function r(e, n, i) {
425
- var o = t.call(this) || this, s;
426
- return O(e) || !e ? s = {
427
- next: e ?? void 0,
428
- error: n ?? void 0,
429
- complete: i ?? void 0
430
- } : s = e, o.destination = new Qe(s), o;
431
- }
432
- return r;
433
- })(te);
434
- function M(t) {
435
- me(t);
436
- }
437
- function Je(t) {
438
- throw t;
439
- }
440
- var Ze = {
441
- closed: !0,
442
- next: oe,
443
- error: Je,
444
- complete: oe
445
- }, re = (function() {
446
- return typeof Symbol == "function" && Symbol.observable || "@@observable";
447
- })();
448
- function ge(t) {
449
- return t;
450
- }
451
- function Ke(t) {
452
- return t.length === 0 ? ge : t.length === 1 ? t[0] : function(e) {
453
- return t.reduce(function(n, i) {
454
- return i(n);
455
- }, e);
456
- };
457
- }
458
- var _ = (function() {
459
- function t(r) {
460
- r && (this._subscribe = r);
461
- }
462
- return t.prototype.lift = function(r) {
463
- var e = new t();
464
- return e.source = this, e.operator = r, e;
465
- }, t.prototype.subscribe = function(r, e, n) {
466
- var i = this, o = et(r) ? r : new $(r, e, n);
467
- return Ye(function() {
468
- var s = i, u = s.operator, a = s.source;
469
- o.add(u ? u.call(o, a) : a ? i._subscribe(o) : i._trySubscribe(o));
470
- }), o;
471
- }, t.prototype._trySubscribe = function(r) {
472
- try {
473
- return this._subscribe(r);
474
- } catch (e) {
475
- r.error(e);
476
- }
477
- }, t.prototype.forEach = function(r, e) {
478
- var n = this;
479
- return e = se(e), new e(function(i, o) {
480
- var s = new $({
481
- next: function(u) {
482
- try {
483
- r(u);
484
- } catch (a) {
485
- o(a), s.unsubscribe();
486
- }
487
- },
488
- error: o,
489
- complete: i
490
- });
491
- n.subscribe(s);
492
- });
493
- }, t.prototype._subscribe = function(r) {
494
- var e;
495
- return (e = this.source) === null || e === void 0 ? void 0 : e.subscribe(r);
496
- }, t.prototype[re] = function() {
497
- return this;
498
- }, t.prototype.pipe = function() {
499
- for (var r = [], e = 0; e < arguments.length; e++)
500
- r[e] = arguments[e];
501
- return Ke(r)(this);
502
- }, t.prototype.toPromise = function(r) {
503
- var e = this;
504
- return r = se(r), new r(function(n, i) {
505
- var o;
506
- e.subscribe(function(s) {
507
- return o = s;
508
- }, function(s) {
509
- return i(s);
510
- }, function() {
511
- return n(o);
512
- });
513
- });
514
- }, t.create = function(r) {
515
- return new t(r);
516
- }, t;
517
- })();
518
- function se(t) {
519
- var r;
520
- return (r = t ?? We.Promise) !== null && r !== void 0 ? r : Promise;
521
- }
522
- function Xe(t) {
523
- return t && O(t.next) && O(t.error) && O(t.complete);
524
- }
525
- function et(t) {
526
- return t && t instanceof te || Xe(t) && de(t);
527
- }
528
- function tt(t) {
529
- return O(t?.lift);
530
- }
531
- function R(t) {
532
- return function(r) {
533
- if (tt(r))
534
- return r.lift(function(e) {
535
- try {
536
- return t(e, this);
537
- } catch (n) {
538
- this.error(n);
539
- }
540
- });
541
- throw new TypeError("Unable to lift unknown Observable type");
542
- };
543
- }
544
- function L(t, r, e, n, i) {
545
- return new rt(t, r, e, n, i);
546
- }
547
- var rt = (function(t) {
548
- X(r, t);
549
- function r(e, n, i, o, s, u) {
550
- var a = t.call(this, e) || this;
551
- return a.onFinalize = s, a.shouldUnsubscribe = u, a._next = n ? function(c) {
552
- try {
553
- n(c);
554
- } catch (h) {
555
- e.error(h);
556
- }
557
- } : t.prototype._next, a._error = o ? function(c) {
558
- try {
559
- o(c);
560
- } catch (h) {
561
- e.error(h);
562
- } finally {
563
- this.unsubscribe();
564
- }
565
- } : t.prototype._error, a._complete = i ? function() {
566
- try {
567
- i();
568
- } catch (c) {
569
- e.error(c);
570
- } finally {
571
- this.unsubscribe();
572
- }
573
- } : t.prototype._complete, a;
574
- }
575
- return r.prototype.unsubscribe = function() {
576
- var e;
577
- if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {
578
- var n = this.closed;
579
- t.prototype.unsubscribe.call(this), !n && ((e = this.onFinalize) === null || e === void 0 || e.call(this));
580
- }
581
- }, r;
582
- })(te), nt = new _(function(t) {
583
- return t.complete();
584
- });
585
- function it(t) {
586
- return t && O(t.schedule);
587
- }
588
- function ye(t) {
589
- return t[t.length - 1];
590
- }
591
- function ot(t) {
592
- return it(ye(t)) ? t.pop() : void 0;
593
- }
594
- function st(t, r) {
595
- return typeof ye(t) == "number" ? t.pop() : r;
596
- }
597
- var be = (function(t) {
598
- return t && typeof t.length == "number" && typeof t != "function";
599
- });
600
- function pe(t) {
601
- return O(t?.then);
602
- }
603
- function we(t) {
604
- return O(t[re]);
605
- }
606
- function ve(t) {
607
- return Symbol.asyncIterator && O(t?.[Symbol.asyncIterator]);
608
- }
609
- function Se(t) {
610
- return new TypeError("You provided " + (t !== null && typeof t == "object" ? "an invalid object" : "'" + t + "'") + " where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.");
611
- }
612
- function ct() {
613
- return typeof Symbol != "function" || !Symbol.iterator ? "@@iterator" : Symbol.iterator;
614
- }
615
- var xe = ct();
616
- function Ie(t) {
617
- return O(t?.[xe]);
618
- }
619
- function Be(t) {
620
- return je(this, arguments, function() {
621
- var e, n, i, o;
622
- return le(this, function(s) {
623
- switch (s.label) {
624
- case 0:
625
- e = t.getReader(), s.label = 1;
626
- case 1:
627
- s.trys.push([1, , 9, 10]), s.label = 2;
628
- case 2:
629
- return [4, z(e.read())];
630
- case 3:
631
- return n = s.sent(), i = n.value, o = n.done, o ? [4, z(void 0)] : [3, 5];
632
- case 4:
633
- return [2, s.sent()];
634
- case 5:
635
- return [4, z(i)];
636
- case 6:
637
- return [4, s.sent()];
638
- case 7:
639
- return s.sent(), [3, 2];
640
- case 8:
641
- return [3, 10];
642
- case 9:
643
- return e.releaseLock(), [7];
644
- case 10:
645
- return [2];
646
- }
647
- });
648
- });
649
- }
650
- function Ue(t) {
651
- return O(t?.getReader);
652
- }
653
- function D(t) {
654
- if (t instanceof _)
655
- return t;
656
- if (t != null) {
657
- if (we(t))
658
- return at(t);
659
- if (be(t))
660
- return ut(t);
661
- if (pe(t))
662
- return ft(t);
663
- if (ve(t))
664
- return Oe(t);
665
- if (Ie(t))
666
- return lt(t);
667
- if (Ue(t))
668
- return ht(t);
669
- }
670
- throw Se(t);
671
- }
672
- function at(t) {
673
- return new _(function(r) {
674
- var e = t[re]();
675
- if (O(e.subscribe))
676
- return e.subscribe(r);
677
- throw new TypeError("Provided object does not correctly implement Symbol.observable");
678
- });
679
- }
680
- function ut(t) {
681
- return new _(function(r) {
682
- for (var e = 0; e < t.length && !r.closed; e++)
683
- r.next(t[e]);
684
- r.complete();
685
- });
686
- }
687
- function ft(t) {
688
- return new _(function(r) {
689
- t.then(function(e) {
690
- r.closed || (r.next(e), r.complete());
691
- }, function(e) {
692
- return r.error(e);
693
- }).then(null, me);
694
- });
695
- }
696
- function lt(t) {
697
- return new _(function(r) {
698
- var e, n;
699
- try {
700
- for (var i = N(t), o = i.next(); !o.done; o = i.next()) {
701
- var s = o.value;
702
- if (r.next(s), r.closed)
703
- return;
704
- }
705
- } catch (u) {
706
- e = { error: u };
707
- } finally {
708
- try {
709
- o && !o.done && (n = i.return) && n.call(i);
710
- } finally {
711
- if (e) throw e.error;
712
- }
713
- }
714
- r.complete();
715
- });
716
- }
717
- function Oe(t) {
718
- return new _(function(r) {
719
- dt(t, r).catch(function(e) {
720
- return r.error(e);
721
- });
722
- });
723
- }
724
- function ht(t) {
725
- return Oe(Be(t));
726
- }
727
- function dt(t, r) {
728
- var e, n, i, o;
729
- return $e(this, void 0, void 0, function() {
730
- var s, u;
731
- return le(this, function(a) {
732
- switch (a.label) {
733
- case 0:
734
- a.trys.push([0, 5, 6, 11]), e = Ge(t), a.label = 1;
735
- case 1:
736
- return [4, e.next()];
737
- case 2:
738
- if (n = a.sent(), !!n.done) return [3, 4];
739
- if (s = n.value, r.next(s), r.closed)
740
- return [2];
741
- a.label = 3;
742
- case 3:
743
- return [3, 1];
744
- case 4:
745
- return [3, 11];
746
- case 5:
747
- return u = a.sent(), i = { error: u }, [3, 11];
748
- case 6:
749
- return a.trys.push([6, , 9, 10]), n && !n.done && (o = e.return) ? [4, o.call(e)] : [3, 8];
750
- case 7:
751
- a.sent(), a.label = 8;
752
- case 8:
753
- return [3, 10];
754
- case 9:
755
- if (i) throw i.error;
756
- return [7];
757
- case 10:
758
- return [7];
759
- case 11:
760
- return r.complete(), [2];
761
- }
762
- });
763
- });
764
- }
765
- function V(t, r, e, n, i) {
766
- n === void 0 && (n = 0), i === void 0 && (i = !1);
767
- var o = r.schedule(function() {
768
- e(), i ? t.add(this.schedule(null, n)) : this.unsubscribe();
769
- }, n);
770
- if (t.add(o), !i)
771
- return o;
772
- }
773
- function ke(t, r) {
774
- return r === void 0 && (r = 0), R(function(e, n) {
775
- e.subscribe(L(n, function(i) {
776
- return V(n, t, function() {
777
- return n.next(i);
778
- }, r);
779
- }, function() {
780
- return V(n, t, function() {
781
- return n.complete();
782
- }, r);
783
- }, function(i) {
784
- return V(n, t, function() {
785
- return n.error(i);
786
- }, r);
787
- }));
788
- });
789
- }
790
- function Ee(t, r) {
791
- return r === void 0 && (r = 0), R(function(e, n) {
792
- n.add(t.schedule(function() {
793
- return e.subscribe(n);
794
- }, r));
795
- });
796
- }
797
- function mt(t, r) {
798
- return D(t).pipe(Ee(r), ke(r));
799
- }
800
- function gt(t, r) {
801
- return D(t).pipe(Ee(r), ke(r));
802
- }
803
- function yt(t, r) {
804
- return new _(function(e) {
805
- var n = 0;
806
- return r.schedule(function() {
807
- n === t.length ? e.complete() : (e.next(t[n++]), e.closed || this.schedule());
808
- });
809
- });
810
- }
811
- function bt(t, r) {
812
- return new _(function(e) {
813
- var n;
814
- return V(e, r, function() {
815
- n = t[xe](), V(e, r, function() {
816
- var i, o, s;
817
- try {
818
- i = n.next(), o = i.value, s = i.done;
819
- } catch (u) {
820
- e.error(u);
821
- return;
822
- }
823
- s ? e.complete() : e.next(o);
824
- }, 0, !0);
825
- }), function() {
826
- return O(n?.return) && n.return();
827
- };
828
- });
829
- }
830
- function Te(t, r) {
831
- if (!t)
832
- throw new Error("Iterable cannot be null");
833
- return new _(function(e) {
834
- V(e, r, function() {
835
- var n = t[Symbol.asyncIterator]();
836
- V(e, r, function() {
837
- n.next().then(function(i) {
838
- i.done ? e.complete() : e.next(i.value);
839
- });
840
- }, 0, !0);
841
- });
842
- });
843
- }
844
- function pt(t, r) {
845
- return Te(Be(t), r);
846
- }
847
- function wt(t, r) {
848
- if (t != null) {
849
- if (we(t))
850
- return mt(t, r);
851
- if (be(t))
852
- return yt(t, r);
853
- if (pe(t))
854
- return gt(t, r);
855
- if (ve(t))
856
- return Te(t, r);
857
- if (Ie(t))
858
- return bt(t, r);
859
- if (Ue(t))
860
- return pt(t, r);
861
- }
862
- throw Se(t);
863
- }
864
- function vt(t, r) {
865
- return r ? wt(t, r) : D(t);
866
- }
867
- var St = he(function(t) {
868
- return function() {
869
- t(this), this.name = "EmptyError", this.message = "no elements in sequence";
870
- };
871
- });
872
- function _e(t, r) {
873
- return new Promise(function(e, n) {
874
- var i = new $({
875
- next: function(o) {
876
- e(o), i.unsubscribe();
877
- },
878
- error: n,
879
- complete: function() {
880
- n(new St());
881
- }
882
- });
883
- t.subscribe(i);
884
- });
885
- }
886
- function Ce(t, r) {
887
- return R(function(e, n) {
888
- var i = 0;
889
- e.subscribe(L(n, function(o) {
890
- n.next(t.call(r, o, i++));
891
- }));
892
- });
893
- }
894
- function xt(t, r, e, n, i, o, s, u) {
895
- var a = [], c = 0, h = 0, d = !1, b = function() {
896
- d && !a.length && !c && r.complete();
897
- }, f = function(l) {
898
- return c < n ? m(l) : a.push(l);
899
- }, m = function(l) {
900
- c++;
901
- var B = !1;
902
- D(e(l, h++)).subscribe(L(r, function(w) {
903
- r.next(w);
904
- }, function() {
905
- B = !0;
906
- }, void 0, function() {
907
- if (B)
908
- try {
909
- c--;
910
- for (var w = function() {
911
- var S = a.shift();
912
- s || m(S);
913
- }; a.length && c < n; )
914
- w();
915
- b();
916
- } catch (S) {
917
- r.error(S);
918
- }
919
- }));
920
- };
921
- return t.subscribe(L(r, f, function() {
922
- d = !0, b();
923
- })), function() {
924
- };
925
- }
926
- function Pe(t, r, e) {
927
- return e === void 0 && (e = 1 / 0), O(r) ? Pe(function(n, i) {
928
- return Ce(function(o, s) {
929
- return r(n, o, i, s);
930
- })(D(t(n, i)));
931
- }, e) : (typeof r == "number" && (e = r), R(function(n, i) {
932
- return xt(n, i, t, e);
933
- }));
934
- }
935
- function It(t) {
936
- return t === void 0 && (t = 1 / 0), Pe(ge, t);
937
- }
938
- function Bt() {
939
- for (var t = [], r = 0; r < arguments.length; r++)
940
- t[r] = arguments[r];
941
- var e = ot(t), n = st(t, 1 / 0), i = t;
942
- return i.length ? i.length === 1 ? D(i[0]) : It(n)(vt(i, e)) : nt;
943
- }
944
- function Ut(t, r, e, n, i) {
945
- return function(o, s) {
946
- var u = e, a = r, c = 0;
947
- o.subscribe(L(s, function(h) {
948
- var d = c++;
949
- a = u ? t(a, h, d) : (u = !0, h);
950
- }, (function() {
951
- u && s.next(a), s.complete();
952
- })));
953
- };
954
- }
955
- function Ve(t, r) {
956
- return R(Ut(t, r, arguments.length >= 2, !1, !0));
957
- }
958
- var Ot = function(t, r) {
959
- return t.push(r), t;
960
- };
961
- function kt() {
962
- return R(function(t, r) {
963
- Ve(Ot, [])(t).subscribe(r);
964
- });
965
- }
966
- var Y, ce;
967
- function Et() {
968
- if (ce) return Y;
969
- ce = 1;
970
- class t {
971
- constructor(e = {}) {
972
- if (!(e.maxSize && e.maxSize > 0))
973
- throw new TypeError("`maxSize` must be a number greater than 0");
974
- this.maxSize = e.maxSize, this.cache = /* @__PURE__ */ new Map(), this.oldCache = /* @__PURE__ */ new Map(), this._size = 0;
975
- }
976
- _set(e, n) {
977
- this.cache.set(e, n), this._size++, this._size >= this.maxSize && (this._size = 0, this.oldCache = this.cache, this.cache = /* @__PURE__ */ new Map());
978
- }
979
- get(e) {
980
- if (this.cache.has(e))
981
- return this.cache.get(e);
982
- if (this.oldCache.has(e)) {
983
- const n = this.oldCache.get(e);
984
- return this.oldCache.delete(e), this._set(e, n), n;
985
- }
986
- }
987
- set(e, n) {
988
- return this.cache.has(e) ? this.cache.set(e, n) : this._set(e, n), this;
989
- }
990
- has(e) {
991
- return this.cache.has(e) || this.oldCache.has(e);
992
- }
993
- peek(e) {
994
- if (this.cache.has(e))
995
- return this.cache.get(e);
996
- if (this.oldCache.has(e))
997
- return this.oldCache.get(e);
998
- }
999
- delete(e) {
1000
- const n = this.cache.delete(e);
1001
- return n && this._size--, this.oldCache.delete(e) || n;
1002
- }
1003
- clear() {
1004
- this.cache.clear(), this.oldCache.clear(), this._size = 0;
1005
- }
1006
- *keys() {
1007
- for (const [e] of this)
1008
- yield e;
1009
- }
1010
- *values() {
1011
- for (const [, e] of this)
1012
- yield e;
1013
- }
1014
- *[Symbol.iterator]() {
1015
- for (const e of this.cache)
1016
- yield e;
1017
- for (const e of this.oldCache) {
1018
- const [n] = e;
1019
- this.cache.has(n) || (yield e);
1020
- }
1021
- }
1022
- get size() {
1023
- let e = 0;
1024
- for (const n of this.oldCache.keys())
1025
- this.cache.has(n) || e++;
1026
- return this._size + e;
1027
- }
1028
- }
1029
- return Y = t, Y;
1030
- }
1031
- var Tt = Et();
1032
- const Ae = /* @__PURE__ */ Le(Tt);
1033
- class F {
1034
- ranges;
1035
- constructor(r) {
1036
- this.ranges = r;
1037
- }
1038
- get min() {
1039
- return this.ranges[0].min;
1040
- }
1041
- get max() {
1042
- return this.ranges.at(-1).max;
1043
- }
1044
- contains(r) {
1045
- for (const e of this.ranges)
1046
- if (e.min <= r && e.max >= r)
1047
- return !0;
1048
- return !1;
1049
- }
1050
- isContiguous() {
1051
- return this.ranges.length > 1;
1052
- }
1053
- getRanges() {
1054
- return this.ranges.map((r) => new F([{ min: r.min, max: r.max }]));
1055
- }
1056
- toString() {
1057
- return this.ranges.map((r) => `[${r.min}-${r.max}]`).join(",");
1058
- }
1059
- union(r) {
1060
- const e = [...this.getRanges(), ...r.getRanges()].sort((o, s) => o.min < s.min ? -1 : o.min > s.min ? 1 : o.max < s.max ? -1 : s.max > o.max ? 1 : 0), n = [];
1061
- let i = e[0];
1062
- for (const o of e)
1063
- o.min > i.max + 1 ? (n.push(i), i = o) : o.max > i.max && (i = new F([{ min: i.min, max: o.max }]));
1064
- return n.push(i), n.length === 1 ? n[0] : new F(n);
1065
- }
1066
- }
1067
- function _t(t) {
1068
- return Ne(t.subarray(2), void 0);
1069
- }
1070
- class Ct extends Error {
1071
- code;
1072
- constructor(r) {
1073
- super(r), this.code = "ERR_ABORTED";
1074
- }
1075
- }
1076
- function Pt(t) {
1077
- t.sort((i, o) => i.offset - o.offset);
1078
- const r = [];
1079
- let e, n;
1080
- for (const i of t)
1081
- e && n && i.offset - n <= 2e3 ? (e.length = e.length + i.length - n + i.offset, e.blocks.push(i)) : r.push(e = {
1082
- blocks: [i],
1083
- length: i.length,
1084
- offset: i.offset
1085
- }), n = e.offset + e.length;
1086
- return r;
1087
- }
1088
- function H(t) {
1089
- if (t && t.aborted)
1090
- if (typeof DOMException > "u") {
1091
- const r = new Ct("aborted");
1092
- throw r.code = "ERR_ABORTED", r;
1093
- } else
1094
- throw new DOMException("aborted", "AbortError");
1095
- }
1096
- const Vt = typeof TextDecoder < "u" ? new TextDecoder("utf8") : void 0;
1097
- function Q(t, r, e, n) {
1098
- return t < n && r >= e;
1099
- }
1100
- class ze {
1101
- bbi;
1102
- refsByName;
1103
- cirTreeOffset;
1104
- isCompressed;
1105
- blockType;
1106
- cirTreePromise;
1107
- featureCache = new ue({
1108
- cache: new Ae({ maxSize: 1e3 }),
1109
- fill: async ({ length: r, offset: e }, n) => this.bbi.read(r, e, { signal: n })
1110
- });
1111
- constructor(r, e, n, i, o) {
1112
- if (this.bbi = r, this.refsByName = e, this.cirTreeOffset = n, this.isCompressed = i, this.blockType = o, !(n >= 0))
1113
- throw new Error("invalid cirTreeOffset!");
1114
- }
1115
- async readWigData(r, e, n, i, o) {
1116
- try {
1117
- const s = this.refsByName[r];
1118
- s === void 0 && i.complete();
1119
- const u = { chrId: s, start: e, end: n };
1120
- this.cirTreePromise || (this.cirTreePromise = this.bbi.read(48, this.cirTreeOffset, o));
1121
- const a = await this.cirTreePromise, h = new DataView(a.buffer).getUint32(4, !0);
1122
- let d = [], b = 0;
1123
- const f = (w, S, x) => {
1124
- try {
1125
- const p = w.subarray(S), g = new DataView(p.buffer, p.byteOffset, p.length);
1126
- let y = 0;
1127
- const U = g.getUint8(y);
1128
- y += 2;
1129
- const T = g.getUint16(y, !0);
1130
- if (y += 2, U === 1) {
1131
- const k = [];
1132
- for (let I = 0; I < T; I++) {
1133
- const E = g.getUint32(y, !0);
1134
- y += 4;
1135
- const C = g.getUint32(y, !0);
1136
- y += 4;
1137
- const P = g.getUint32(y, !0);
1138
- y += 4;
1139
- const j = g.getUint32(y, !0);
1140
- y += 4;
1141
- const G = Number(g.getBigUint64(y, !0));
1142
- y += 8;
1143
- const W = Number(g.getBigUint64(y, !0));
1144
- y += 8, k.push({
1145
- startChrom: E,
1146
- startBase: C,
1147
- endBase: j,
1148
- endChrom: P,
1149
- blockOffset: G,
1150
- blockSize: W,
1151
- offset: y
1152
- });
1153
- }
1154
- d = d.concat(k.filter((I) => m(I)).map((I) => ({
1155
- offset: I.blockOffset,
1156
- length: I.blockSize
1157
- })));
1158
- } else if (U === 0) {
1159
- const k = [];
1160
- for (let E = 0; E < T; E++) {
1161
- const C = g.getUint32(y, !0);
1162
- y += 4;
1163
- const P = g.getUint32(y, !0);
1164
- y += 4;
1165
- const j = g.getUint32(y, !0);
1166
- y += 4;
1167
- const G = g.getUint32(y, !0);
1168
- y += 4;
1169
- const W = Number(g.getBigUint64(y, !0));
1170
- y += 8, k.push({
1171
- startChrom: C,
1172
- startBase: P,
1173
- endChrom: j,
1174
- endBase: G,
1175
- blockOffset: W,
1176
- offset: y
1177
- });
1178
- }
1179
- const I = k.filter((E) => m(E)).map((E) => E.blockOffset);
1180
- I.length > 0 && B(I, x + 1);
1181
- }
1182
- } catch (v) {
1183
- i.error(v);
1184
- }
1185
- }, m = (w) => {
1186
- const { startChrom: S, startBase: x, endChrom: v, endBase: p } = w;
1187
- return (S < s || S === s && x <= n) && (v > s || v === s && p >= e);
1188
- }, l = async (w, S, x) => {
1189
- try {
1190
- const v = S.max - S.min, p = S.min, g = await this.featureCache.get(`${v}_${p}`, { length: v, offset: p }, o?.signal);
1191
- for (const y of w)
1192
- S.contains(y) && (f(g, y - p, x), b -= 1, b === 0 && this.readFeatures(i, d, {
1193
- ...o,
1194
- request: u
1195
- }).catch((U) => {
1196
- i.error(U);
1197
- }));
1198
- } catch (v) {
1199
- i.error(v);
1200
- }
1201
- }, B = (w, S) => {
1202
- try {
1203
- b += w.length;
1204
- const x = 4 + h * 32;
1205
- let v = new F([
1206
- {
1207
- min: w[0],
1208
- max: w[0] + x
1209
- }
1210
- ]);
1211
- for (let p = 1; p < w.length; p += 1) {
1212
- const g = new F([
1213
- {
1214
- min: w[p],
1215
- max: w[p] + x
1216
- }
1217
- ]);
1218
- v = v.union(g);
1219
- }
1220
- v.getRanges().map((p) => l(w, p, S));
1221
- } catch (x) {
1222
- i.error(x);
1223
- }
1224
- };
1225
- B([this.cirTreeOffset + 48], 1);
1226
- return;
1227
- } catch (s) {
1228
- i.error(s);
1229
- }
1230
- }
1231
- parseSummaryBlock(r, e, n) {
1232
- const i = [];
1233
- let o = e;
1234
- const s = new DataView(r.buffer, r.byteOffset, r.length);
1235
- for (; o < r.byteLength; ) {
1236
- const u = s.getUint32(o, !0);
1237
- o += 4;
1238
- const a = s.getUint32(o, !0);
1239
- o += 4;
1240
- const c = s.getUint32(o, !0);
1241
- o += 4;
1242
- const h = s.getUint32(o, !0);
1243
- o += 4;
1244
- const d = s.getFloat32(o, !0);
1245
- o += 4;
1246
- const b = s.getFloat32(o, !0);
1247
- o += 4;
1248
- const f = s.getFloat32(o, !0);
1249
- o += 4, o += 4, (!n || u === n.chrId && Q(a, c, n.start, n.end)) && i.push({
1250
- start: a,
1251
- end: c,
1252
- maxScore: b,
1253
- minScore: d,
1254
- summary: !0,
1255
- score: f / (h || 1)
1256
- });
1257
- }
1258
- return i;
1259
- }
1260
- parseBigBedBlock(r, e, n, i) {
1261
- const o = [];
1262
- let s = e;
1263
- const u = r, a = new DataView(u.buffer, u.byteOffset, u.length);
1264
- for (; s < r.byteLength; ) {
1265
- const c = s, h = a.getUint32(s, !0);
1266
- s += 4;
1267
- const d = a.getInt32(s, !0);
1268
- s += 4;
1269
- const b = a.getInt32(s, !0);
1270
- s += 4;
1271
- let f = s;
1272
- for (; f < r.length && r[f] !== 0; f++)
1273
- ;
1274
- const m = r.subarray(s, f), l = Vt?.decode(m) ?? m.toString();
1275
- s = f + 1, o.push({
1276
- chromId: h,
1277
- start: d,
1278
- end: b,
1279
- rest: l,
1280
- uniqueId: `bb-${n + c}`
1281
- });
1282
- }
1283
- return i ? o.filter((c) => Q(c.start, c.end, i.start, i.end)) : o;
1284
- }
1285
- parseBigWigBlock(r, e, n) {
1286
- const i = r.subarray(e), o = new DataView(i.buffer, i.byteOffset, i.length);
1287
- let s = 0;
1288
- s += 4;
1289
- const u = o.getInt32(s, !0);
1290
- s += 8;
1291
- const a = o.getUint32(s, !0);
1292
- s += 4;
1293
- const c = o.getUint32(s, !0);
1294
- s += 4;
1295
- const h = o.getUint8(s);
1296
- s += 2;
1297
- const d = o.getUint16(s, !0);
1298
- s += 2;
1299
- const b = new Array(d);
1300
- switch (h) {
1301
- case 1: {
1302
- for (let f = 0; f < d; f++) {
1303
- const m = o.getInt32(s, !0);
1304
- s += 4;
1305
- const l = o.getInt32(s, !0);
1306
- s += 4;
1307
- const B = o.getFloat32(s, !0);
1308
- s += 4, b[f] = {
1309
- start: m,
1310
- end: l,
1311
- score: B
1312
- };
1313
- }
1314
- break;
1315
- }
1316
- case 2: {
1317
- for (let f = 0; f < d; f++) {
1318
- const m = o.getInt32(s, !0);
1319
- s += 4;
1320
- const l = o.getFloat32(s, !0);
1321
- s += 4, b[f] = {
1322
- score: l,
1323
- start: m,
1324
- end: m + c
1325
- };
1326
- }
1327
- break;
1328
- }
1329
- case 3: {
1330
- for (let f = 0; f < d; f++) {
1331
- const m = o.getFloat32(s, !0);
1332
- s += 4;
1333
- const l = u + f * a;
1334
- b[f] = {
1335
- score: m,
1336
- start: l,
1337
- end: l + c
1338
- };
1339
- }
1340
- break;
1341
- }
1342
- }
1343
- return n ? b.filter((f) => Q(f.start, f.end, n.start, n.end)) : b;
1344
- }
1345
- async readFeatures(r, e, n = {}) {
1346
- try {
1347
- const { blockType: i, isCompressed: o } = this, { signal: s, request: u } = n, a = Pt(e);
1348
- H(s), await Promise.all(a.map(async (c) => {
1349
- H(s);
1350
- const { length: h, offset: d } = c, b = await this.featureCache.get(`${h}_${d}`, c, s);
1351
- for (const f of c.blocks) {
1352
- H(s);
1353
- let m = b.subarray(f.offset - c.offset);
1354
- switch (o && (m = _t(m)), H(s), i) {
1355
- case "summary": {
1356
- r.next(this.parseSummaryBlock(m, 0, u));
1357
- break;
1358
- }
1359
- case "bigwig": {
1360
- r.next(this.parseBigWigBlock(m, 0, u));
1361
- break;
1362
- }
1363
- case "bigbed": {
1364
- r.next(this.parseBigBedBlock(m, 0, f.offset * 256, u));
1365
- break;
1366
- }
1367
- default:
1368
- console.warn(`Don't know what to do with ${i}`);
1369
- }
1370
- }
1371
- })), r.complete();
1372
- } catch (i) {
1373
- r.error(i);
1374
- }
1375
- }
1376
- }
1377
- const At = -2003829722, ae = -2021002517;
1378
- function A(t) {
1379
- return new DataView(t.buffer, t.byteOffset, t.length);
1380
- }
1381
- class Fe {
1382
- bbi;
1383
- headerP;
1384
- renameRefSeqs;
1385
- getHeader(r) {
1386
- return this.headerP || (this.headerP = this._getHeader(r).catch((e) => {
1387
- throw this.headerP = void 0, e;
1388
- })), this.headerP;
1389
- }
1390
- /*
1391
- * @param filehandle - a filehandle from generic-filehandle2
1392
- *
1393
- * @param path - a Local file path as a string
1394
- *
1395
- * @param url - a URL string
1396
- *
1397
- * @param renameRefSeqs - an optional method to rename the internal reference
1398
- * sequences using a mapping function
1399
- */
1400
- constructor(r) {
1401
- const { filehandle: e, renameRefSeqs: n = (s) => s, path: i, url: o } = r;
1402
- if (this.renameRefSeqs = n, e)
1403
- this.bbi = e;
1404
- else if (o)
1405
- this.bbi = new Re(o);
1406
- else if (i)
1407
- this.bbi = new De(i);
1408
- else
1409
- throw new Error("no file given");
1410
- }
1411
- async _getHeader(r) {
1412
- const e = await this._getMainHeader(r), n = await this._readChromTree(e, r);
1413
- return {
1414
- ...e,
1415
- ...n
1416
- };
1417
- }
1418
- async _getMainHeader(r, e = 2e3) {
1419
- const n = await this.bbi.read(e, 0, r), i = A(n), o = i.getInt32(0, !0);
1420
- if (o !== At && o !== ae)
1421
- throw new Error("not a BigWig/BigBed file");
1422
- let s = 0;
1423
- const u = i.getInt32(s, !0);
1424
- s += 4;
1425
- const a = i.getUint16(s, !0);
1426
- s += 2;
1427
- const c = i.getUint16(s, !0);
1428
- s += 2;
1429
- const h = Number(i.getBigUint64(s, !0));
1430
- s += 8;
1431
- const d = Number(i.getBigUint64(s, !0));
1432
- s += 8;
1433
- const b = Number(i.getBigUint64(s, !0));
1434
- s += 8;
1435
- const f = i.getUint16(s, !0);
1436
- s += 2;
1437
- const m = i.getUint16(s, !0);
1438
- s += 2;
1439
- const l = Number(i.getBigUint64(s, !0));
1440
- s += 8;
1441
- const B = Number(i.getBigUint64(s, !0));
1442
- s += 8;
1443
- const w = i.getUint32(s, !0);
1444
- s += 4;
1445
- const S = Number(i.getBigUint64(s, !0));
1446
- s += 8;
1447
- const x = [];
1448
- for (let y = 0; y < c; y++) {
1449
- const U = i.getUint32(s, !0);
1450
- s += 4;
1451
- const T = i.getUint32(s, !0);
1452
- s += 4;
1453
- const k = Number(i.getBigUint64(s, !0));
1454
- s += 8;
1455
- const I = Number(i.getBigUint64(s, !0));
1456
- s += 8, x.push({
1457
- reductionLevel: U,
1458
- reserved: T,
1459
- dataOffset: k,
1460
- indexOffset: I
1461
- });
1462
- }
1463
- const v = u === ae ? "bigbed" : "bigwig";
1464
- if (l > e || B > e - 40)
1465
- return this._getMainHeader(r, e * 2);
1466
- let p;
1467
- if (B) {
1468
- const y = n.subarray(B);
1469
- let U = 0;
1470
- const T = A(y), k = Number(T.getBigUint64(U, !0));
1471
- U += 8;
1472
- const I = T.getFloat64(U, !0);
1473
- U += 8;
1474
- const E = T.getFloat64(U, !0);
1475
- U += 8;
1476
- const C = T.getFloat64(U, !0);
1477
- U += 8;
1478
- const P = T.getFloat64(U, !0);
1479
- U += 8, p = {
1480
- scoreMin: I,
1481
- scoreMax: E,
1482
- scoreSum: C,
1483
- scoreSumSquares: P,
1484
- basesCovered: k
1485
- };
1486
- } else
1487
- throw new Error("no stats");
1488
- const g = new TextDecoder("utf8");
1489
- return {
1490
- zoomLevels: x,
1491
- magic: u,
1492
- extHeaderOffset: S,
1493
- numZoomLevels: c,
1494
- fieldCount: f,
1495
- totalSummary: p,
1496
- definedFieldCount: m,
1497
- uncompressBufSize: w,
1498
- asOffset: l,
1499
- chromTreeOffset: h,
1500
- totalSummaryOffset: B,
1501
- unzoomedDataOffset: d,
1502
- unzoomedIndexOffset: b,
1503
- fileType: v,
1504
- version: a,
1505
- autoSql: l ? g.decode(n.subarray(l, n.indexOf(0, l))) : ""
1506
- };
1507
- }
1508
- async _readChromTree(r, e) {
1509
- const n = [], i = {}, o = r.chromTreeOffset, s = A(await this.bbi.read(32, o, e));
1510
- let u = 0;
1511
- u += 4, u += 4;
1512
- const a = s.getUint32(u, !0);
1513
- u += 4;
1514
- const c = s.getUint32(u, !0);
1515
- u += 4, u += 8;
1516
- const h = new TextDecoder("utf8"), d = async (b) => {
1517
- const f = await this.bbi.read(4, b), m = A(f);
1518
- let l = 0;
1519
- const B = m.getUint8(l);
1520
- l += 1, l += 1;
1521
- const w = m.getUint16(l, !0);
1522
- if (l += 2, B) {
1523
- const S = await this.bbi.read(w * (a + c), b + l), x = A(S);
1524
- l = 0;
1525
- for (let v = 0; v < w; v++) {
1526
- const p = h.decode(S.subarray(l, l + a)).replaceAll("\0", "");
1527
- l += a;
1528
- const g = x.getUint32(l, !0);
1529
- l += 4;
1530
- const y = x.getUint32(l, !0);
1531
- l += 4, i[this.renameRefSeqs(p)] = g, n[g] = {
1532
- name: p,
1533
- id: g,
1534
- length: y
1535
- };
1536
- }
1537
- } else {
1538
- const S = [], x = A(await this.bbi.read(w * (a + 8), b + l));
1539
- l = 0;
1540
- for (let v = 0; v < w; v++) {
1541
- l += a;
1542
- const p = Number(x.getBigUint64(l, !0));
1543
- l += 8, S.push(d(p));
1544
- }
1545
- await Promise.all(S);
1546
- }
1547
- };
1548
- return await d(o + 32), {
1549
- refsByName: i,
1550
- refsByNumber: n
1551
- };
1552
- }
1553
- /*
1554
- * fetches the "unzoomed" view of the bigwig data. this is the default for bigbed
1555
- * @param abortSignal - a signal to optionally abort this operation
1556
- */
1557
- async getUnzoomedView(r) {
1558
- const { unzoomedIndexOffset: e, refsByName: n, uncompressBufSize: i, fileType: o } = await this.getHeader(r);
1559
- return new ze(this.bbi, n, e, i > 0, o);
1560
- }
1561
- /**
1562
- * Gets features from a BigWig file
1563
- *
1564
- * @param refName - The chromosome name
1565
- *
1566
- * @param start - The start of a region
1567
- *
1568
- * @param end - The end of a region
1569
- *
1570
- * @param opts - An object containing basesPerSpan (e.g. pixels per basepair)
1571
- * or scale used to infer the zoomLevel to use
1572
- */
1573
- async getFeatureStream(r, e, n, i) {
1574
- await this.getHeader(i);
1575
- const o = this.renameRefSeqs(r);
1576
- let s;
1577
- const { basesPerSpan: u, scale: a } = i || {};
1578
- return u ? s = await this.getView(1 / u, i) : a ? s = await this.getView(a, i) : s = await this.getView(1, i), new _((c) => {
1579
- s.readWigData(o, e, n, c, i).catch((h) => {
1580
- c.error(h);
1581
- });
1582
- });
1583
- }
1584
- async getFeatures(r, e, n, i) {
1585
- const o = await this.getFeatureStream(r, e, n, i);
1586
- return (await _e(o.pipe(kt()))).flat();
1587
- }
1588
- }
1589
- class Nt extends Fe {
1590
- /**
1591
- * Retrieves a BlockView of a specific zoomLevel
1592
- *
1593
- * @param scale - number
1594
- *
1595
- * @param opts - An object containing basesPerSpan (e.g. pixels per basepair)
1596
- * or scale used to infer the zoomLevel to use
1597
- */
1598
- async getView(r, e) {
1599
- const { zoomLevels: n, refsByName: i, uncompressBufSize: o } = await this.getHeader(e), s = 1 / r, u = n.length - 1;
1600
- for (let a = u; a >= 0; a -= 1) {
1601
- const c = n[a];
1602
- if (c && c.reductionLevel <= 2 * s)
1603
- return new ze(this.bbi, i, c.indexOffset, o > 0, "summary");
1604
- }
1605
- return this.getUnzoomedView(e);
1606
- }
1607
- }
1608
- function zt(t) {
1609
- return t.filter((r) => !!r);
1610
- }
1611
- class Lt extends Fe {
1612
- readIndicesCache = new ue({
1613
- cache: new Ae({ maxSize: 1 }),
1614
- fill: (r, e) => this._readIndices({ ...r, signal: e })
1615
- });
1616
- readIndices(r = {}) {
1617
- const { signal: e, ...n } = r;
1618
- return this.readIndicesCache.get(JSON.stringify(n), r, e);
1619
- }
1620
- /*
1621
- * retrieve unzoomed view for any scale
1622
- */
1623
- async getView(r, e) {
1624
- return this.getUnzoomedView(e);
1625
- }
1626
- /*
1627
- * parse the bigbed extraIndex fields
1628
- *
1629
- *
1630
- * @return a Promise for an array of Index data structure since there can be
1631
- * multiple extraIndexes in a bigbed, see bedToBigBed documentation
1632
- */
1633
- async _readIndices(r) {
1634
- const { extHeaderOffset: e } = await this.getHeader(r), n = await this.bbi.read(64, e), i = new DataView(n.buffer, n.byteOffset, n.length);
1635
- let o = 0;
1636
- o += 2;
1637
- const s = i.getUint16(o, !0);
1638
- o += 2;
1639
- const u = Number(i.getBigUint64(o, !0));
1640
- if (o += 8, s === 0)
1641
- return [];
1642
- const a = 20, c = a * s, h = await this.bbi.read(c, u), d = [];
1643
- for (let b = 0; b < s; b += 1) {
1644
- const f = h.subarray(b * a), m = new DataView(f.buffer, f.byteOffset, f.length);
1645
- let l = 0;
1646
- const B = m.getInt16(l, !0);
1647
- l += 2;
1648
- const w = m.getInt16(l, !0);
1649
- l += 2;
1650
- const S = Number(m.getBigUint64(l, !0));
1651
- l += 12;
1652
- const x = m.getInt16(l, !0);
1653
- d.push({
1654
- type: B,
1655
- fieldcount: w,
1656
- offset: S,
1657
- field: x
1658
- });
1659
- }
1660
- return d;
1661
- }
1662
- /*
1663
- * perform a search in the bigbed extraIndex to find which blocks in the
1664
- * bigbed data to look for the actual feature data
1665
- *
1666
- * @param name - the name to search for
1667
- *
1668
- * @param opts - a SearchOptions argument with optional signal
1669
- *
1670
- * @return a Promise for an array of bigbed block Loc entries
1671
- */
1672
- async searchExtraIndexBlocks(r, e = {}) {
1673
- const n = await this.readIndices(e);
1674
- if (n.length === 0)
1675
- return [];
1676
- const i = new TextDecoder("utf8"), o = n.map(async (s) => {
1677
- const { offset: u, field: a } = s, c = await this.bbi.read(32, u, e), h = new DataView(c.buffer, c.byteOffset, c.length);
1678
- let d = 0;
1679
- d += 4;
1680
- const b = h.getInt32(d, !0);
1681
- d += 4;
1682
- const f = h.getInt32(d, !0);
1683
- d += 4;
1684
- const m = h.getInt32(d, !0);
1685
- d += 4, d += 8;
1686
- const l = async (B) => {
1687
- const w = B, S = 4 + b * (f + m), v = await this.bbi.read(S, w, e), p = new DataView(v.buffer, v.byteOffset, v.length);
1688
- let g = 0;
1689
- const y = p.getInt8(g);
1690
- g += 2;
1691
- const U = p.getInt16(g, !0);
1692
- g += 2;
1693
- const T = [];
1694
- if (y === 0) {
1695
- const k = [];
1696
- for (let E = 0; E < U; E++) {
1697
- const C = i.decode(v.subarray(g, g + f)).replaceAll("\0", "");
1698
- g += f;
1699
- const P = Number(p.getBigUint64(g, !0));
1700
- g += 8, k.push({
1701
- key: C,
1702
- offset: P
1703
- });
1704
- }
1705
- let I = 0;
1706
- for (const { key: E, offset: C } of k) {
1707
- if (r.localeCompare(E) < 0 && I)
1708
- return l(I);
1709
- I = C;
1710
- }
1711
- return l(I);
1712
- } else if (y === 1) {
1713
- for (let k = 0; k < U; k++) {
1714
- const I = i.decode(v.subarray(g, g + f)).replaceAll("\0", "");
1715
- g += f;
1716
- const E = Number(p.getBigUint64(g, !0));
1717
- g += 8;
1718
- const C = p.getUint32(g, !0);
1719
- g += 4;
1720
- const P = p.getUint32(g, !0);
1721
- g += 4, T.push({
1722
- key: I,
1723
- offset: E,
1724
- length: C,
1725
- reserved: P
1726
- });
1727
- }
1728
- for (const k of T)
1729
- if (k.key === r)
1730
- return {
1731
- ...k,
1732
- field: a
1733
- };
1734
- return;
1735
- }
1736
- };
1737
- return l(u + 32);
1738
- });
1739
- return zt(await Promise.all(o));
1740
- }
1741
- /*
1742
- * retrieve the features from the bigbed data that were found through the
1743
- * lookup of the extraIndex note that there can be multiple extraIndex, see
1744
- * the BigBed specification and the -extraIndex argument to bedToBigBed
1745
- *
1746
- * @param name - the name to search for
1747
- *
1748
- * @param opts - options object with optional AboutSignal
1749
- *
1750
- * @return array of Feature
1751
- */
1752
- async searchExtraIndex(r, e = {}) {
1753
- const n = await this.searchExtraIndexBlocks(r, e);
1754
- if (n.length === 0)
1755
- return [];
1756
- const i = await this.getUnzoomedView(e), o = n.map((u) => new _((a) => {
1757
- i.readFeatures(a, [u], e).catch((c) => {
1758
- a.error(c);
1759
- });
1760
- }).pipe(Ve((a, c) => a.concat(c)), Ce((a) => {
1761
- for (const c of a)
1762
- c.field = u.field;
1763
- return a;
1764
- })));
1765
- return (await _e(Bt(...o))).filter((u) => u.rest?.split(" ")[(u.field || 0) - 3] === r);
1766
- }
1767
- }
1768
- export {
1769
- Lt as BigBed,
1770
- Nt as BigWig
1771
- };