omezarr-tilesource 0.0.2 → 0.0.3
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.
- package/README.md +6 -2
- package/dist/omezarr-tilesource.js +235 -235
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,11 +5,15 @@
|
|
|
5
5
|
[](https://github.com/TissUUmaps/OMEZarrTileSource/pulls)
|
|
6
6
|
[](https://github.com/TissUUmaps/OMEZarrTileSource/actions/workflows/pages.yml)
|
|
7
7
|
[](https://github.com/TissUUmaps/OMEZarrTileSource/actions/workflows/publish.yml)
|
|
8
|
-
[](https://www.npmjs.com/package/omezarr-tilesource)
|
|
9
9
|
[](LICENSE)
|
|
10
10
|
|
|
11
11
|
An OpenSeadragon tile source for the OME-Zarr bioimage file format
|
|
12
12
|
|
|
13
|
+
## Prerequisites
|
|
14
|
+
|
|
15
|
+
OpenSeadragon 5 or newer
|
|
16
|
+
|
|
13
17
|
## Installation
|
|
14
18
|
|
|
15
19
|
Using npm:
|
|
@@ -42,7 +46,7 @@ const viewer = OpenSeadragon(
|
|
|
42
46
|
// t: undefined,
|
|
43
47
|
// c: undefined,
|
|
44
48
|
// z: undefined
|
|
45
|
-
}
|
|
49
|
+
},
|
|
46
50
|
// direct instantiation with a URL string (works with any OME-Zarr storage backend)
|
|
47
51
|
new OMEZarrTileSource(url),
|
|
48
52
|
// direct instantiation with an options object (no prior enabling required)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import G from "openseadragon";
|
|
2
2
|
function C1(t) {
|
|
3
3
|
return t.slice(1);
|
|
4
4
|
}
|
|
@@ -11,7 +11,7 @@ function k1(t, e, r, n = {}) {
|
|
|
11
11
|
}
|
|
12
12
|
}), fetch(t, n);
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function A2(t, e) {
|
|
15
15
|
return {
|
|
16
16
|
...t,
|
|
17
17
|
...e,
|
|
@@ -38,7 +38,7 @@ async function P1(t) {
|
|
|
38
38
|
throw new Error(`Unexpected response status ${t.status} ${t.statusText}`);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
async function
|
|
41
|
+
async function L2(t, e, r, n) {
|
|
42
42
|
if (n)
|
|
43
43
|
return fetch(t, {
|
|
44
44
|
...r,
|
|
@@ -50,7 +50,7 @@ async function z2(t, e, r, n) {
|
|
|
50
50
|
let s = i.headers.get("Content-Length"), a = Number(s);
|
|
51
51
|
return k1(t, a - e, a, r);
|
|
52
52
|
}
|
|
53
|
-
class
|
|
53
|
+
class T2 {
|
|
54
54
|
url;
|
|
55
55
|
#e;
|
|
56
56
|
#t;
|
|
@@ -58,7 +58,7 @@ class S2 {
|
|
|
58
58
|
this.url = e, this.#e = r.overrides ?? {}, this.#t = r.useSuffixRequest ?? !1;
|
|
59
59
|
}
|
|
60
60
|
#r(e) {
|
|
61
|
-
return
|
|
61
|
+
return A2(this.#e, e);
|
|
62
62
|
}
|
|
63
63
|
async get(e, r = {}) {
|
|
64
64
|
let n = D1(this.url, e).href, i = await fetch(n, this.#r(r));
|
|
@@ -66,7 +66,7 @@ class S2 {
|
|
|
66
66
|
}
|
|
67
67
|
async getRange(e, r, n = {}) {
|
|
68
68
|
let i = D1(this.url, e), s = this.#r(n), a;
|
|
69
|
-
return "suffixLength" in r ? a = await
|
|
69
|
+
return "suffixLength" in r ? a = await L2(i, r.suffixLength, s, this.#t) : a = await k1(i, r.offset, r.length, s), P1(a);
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
class s2 {
|
|
@@ -153,7 +153,7 @@ class A1 {
|
|
|
153
153
|
yield this.get(e);
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
|
-
class
|
|
156
|
+
class t1 {
|
|
157
157
|
#e;
|
|
158
158
|
chars;
|
|
159
159
|
constructor(e, r, n, i) {
|
|
@@ -162,7 +162,7 @@ class e1 {
|
|
|
162
162
|
else if (r instanceof ArrayBuffer)
|
|
163
163
|
i && (i *= e), this.#e = new Int32Array(r, n, i);
|
|
164
164
|
else {
|
|
165
|
-
const s = r, a = new
|
|
165
|
+
const s = r, a = new t1(e, 1);
|
|
166
166
|
this.#e = new Int32Array((function* () {
|
|
167
167
|
for (let o of s)
|
|
168
168
|
a.set(0, o), yield* a.#e;
|
|
@@ -208,7 +208,7 @@ class e1 {
|
|
|
208
208
|
yield this.get(e);
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
|
-
function
|
|
211
|
+
function r1(t) {
|
|
212
212
|
const e = new TextDecoder().decode(t);
|
|
213
213
|
return JSON.parse(e);
|
|
214
214
|
}
|
|
@@ -225,7 +225,7 @@ function a2(t) {
|
|
|
225
225
|
let e = t.match(/v2:([US])(\d+)/);
|
|
226
226
|
if (e) {
|
|
227
227
|
let [, n, i] = e;
|
|
228
|
-
return (n === "U" ?
|
|
228
|
+
return (n === "U" ? t1 : A1).bind(null, Number(i));
|
|
229
229
|
}
|
|
230
230
|
let r = {
|
|
231
231
|
int8: Int8Array,
|
|
@@ -251,7 +251,7 @@ function W(t, e) {
|
|
|
251
251
|
i[e[s]] = n, n *= t[e[s]];
|
|
252
252
|
return i;
|
|
253
253
|
}
|
|
254
|
-
function
|
|
254
|
+
function z2({ name: t, configuration: e }) {
|
|
255
255
|
if (t === "default") {
|
|
256
256
|
const r = e?.separator ?? "/";
|
|
257
257
|
return (n) => ["c", ...n].join(r);
|
|
@@ -262,7 +262,7 @@ function U2({ name: t, configuration: e }) {
|
|
|
262
262
|
}
|
|
263
263
|
throw new Error(`Unknown chunk key encoding: ${t}`);
|
|
264
264
|
}
|
|
265
|
-
function
|
|
265
|
+
function S2(t) {
|
|
266
266
|
if (t === "|O")
|
|
267
267
|
return { data_type: "v2:object" };
|
|
268
268
|
let e = t.match(/^([<|>])(.*)$/);
|
|
@@ -283,8 +283,8 @@ function $2(t) {
|
|
|
283
283
|
}[n] ?? (n.startsWith("S") || n.startsWith("U") ? `v2:${n}` : void 0);
|
|
284
284
|
return L(i, `Unsupported or unknown dtype: ${t}`), r === "|" ? { data_type: i } : { data_type: i, endian: r === "<" ? "little" : "big" };
|
|
285
285
|
}
|
|
286
|
-
function
|
|
287
|
-
let r = [], n =
|
|
286
|
+
function U2(t, e = {}) {
|
|
287
|
+
let r = [], n = S2(t.dtype);
|
|
288
288
|
t.order === "F" && r.push({ name: "transpose", configuration: { order: "F" } }), "endian" in n && n.endian === "big" && r.push({ name: "bytes", configuration: { endian: "big" } });
|
|
289
289
|
for (let { id: i, ...s } of t.filters ?? [])
|
|
290
290
|
r.push({ name: i, configuration: s });
|
|
@@ -314,14 +314,14 @@ function I2(t, e = {}) {
|
|
|
314
314
|
attributes: e
|
|
315
315
|
};
|
|
316
316
|
}
|
|
317
|
-
function
|
|
317
|
+
function $2(t, e = {}) {
|
|
318
318
|
return {
|
|
319
319
|
zarr_format: 3,
|
|
320
320
|
node_type: "group",
|
|
321
321
|
attributes: e
|
|
322
322
|
};
|
|
323
323
|
}
|
|
324
|
-
function
|
|
324
|
+
function I2(t, e) {
|
|
325
325
|
if (e !== "number" && e !== "bigint" && e !== "boolean" && e !== "object" && e !== "string")
|
|
326
326
|
return t === e;
|
|
327
327
|
let r = t === "bool";
|
|
@@ -336,7 +336,7 @@ function M2(t, e) {
|
|
|
336
336
|
let s = t === "v2:object";
|
|
337
337
|
return e === "object" ? s : !n && !i && !r && !s;
|
|
338
338
|
}
|
|
339
|
-
function
|
|
339
|
+
function B2(t) {
|
|
340
340
|
return t?.name === "sharding_indexed";
|
|
341
341
|
}
|
|
342
342
|
function o2(t) {
|
|
@@ -383,15 +383,15 @@ class L1 {
|
|
|
383
383
|
return e;
|
|
384
384
|
}
|
|
385
385
|
}
|
|
386
|
-
const W1 =
|
|
387
|
-
function
|
|
386
|
+
const W1 = M2();
|
|
387
|
+
function M2() {
|
|
388
388
|
const t = new Uint32Array([305419896]);
|
|
389
389
|
return new Uint8Array(t.buffer, t.byteOffset, t.byteLength)[0] !== 18;
|
|
390
390
|
}
|
|
391
391
|
function H1(t) {
|
|
392
392
|
return "BYTES_PER_ELEMENT" in t ? t.BYTES_PER_ELEMENT : 4;
|
|
393
393
|
}
|
|
394
|
-
class
|
|
394
|
+
class d1 {
|
|
395
395
|
kind = "array_to_bytes";
|
|
396
396
|
#e;
|
|
397
397
|
#t;
|
|
@@ -404,7 +404,7 @@ class f1 {
|
|
|
404
404
|
this.#r = n.BYTES_PER_ELEMENT;
|
|
405
405
|
}
|
|
406
406
|
static fromConfig(e, r) {
|
|
407
|
-
return new
|
|
407
|
+
return new d1(e, r);
|
|
408
408
|
}
|
|
409
409
|
encode(e) {
|
|
410
410
|
let r = new Uint8Array(e.data.buffer);
|
|
@@ -443,10 +443,10 @@ class z1 {
|
|
|
443
443
|
return new Uint8Array(r);
|
|
444
444
|
}
|
|
445
445
|
}
|
|
446
|
-
function
|
|
446
|
+
function F2(t, e) {
|
|
447
447
|
return L(!Number.isNaN(e), "JsonCodec allow_nan is false but NaN was encountered during encoding."), L(e !== Number.POSITIVE_INFINITY, "JsonCodec allow_nan is false but Infinity was encountered during encoding."), L(e !== Number.NEGATIVE_INFINITY, "JsonCodec allow_nan is false but -Infinity was encountered during encoding."), e;
|
|
448
448
|
}
|
|
449
|
-
function
|
|
449
|
+
function R2(t, e) {
|
|
450
450
|
return e instanceof Object && !Array.isArray(e) ? Object.keys(e).sort().reduce((r, n) => (r[n] = e[n], r), {}) : e;
|
|
451
451
|
}
|
|
452
452
|
class S1 {
|
|
@@ -476,7 +476,7 @@ class S1 {
|
|
|
476
476
|
const { indent: r, encoding: n, ensure_ascii: i, check_circular: s, allow_nan: a, sort_keys: o } = this.#e;
|
|
477
477
|
L(n === "utf-8", "JsonCodec does not yet support non-utf-8 encoding.");
|
|
478
478
|
const c = [];
|
|
479
|
-
L(s, "JsonCodec does not yet support skipping the check for circular references during encoding."), a || c.push(
|
|
479
|
+
L(s, "JsonCodec does not yet support skipping the check for circular references during encoding."), a || c.push(F2), o && c.push(R2);
|
|
480
480
|
const f = Array.from(e.data);
|
|
481
481
|
f.push("|O"), f.push(e.shape);
|
|
482
482
|
let l;
|
|
@@ -495,14 +495,14 @@ class S1 {
|
|
|
495
495
|
decode(e) {
|
|
496
496
|
const { strict: r } = this.#t;
|
|
497
497
|
L(r, "JsonCodec does not yet support non-strict decoding.");
|
|
498
|
-
const n =
|
|
498
|
+
const n = r1(e), i = n.pop();
|
|
499
499
|
n.pop(), L(i, "0D not implemented for JsonCodec.");
|
|
500
500
|
const s = W(i, "C");
|
|
501
501
|
return { data: n, shape: i, stride: s };
|
|
502
502
|
}
|
|
503
503
|
}
|
|
504
504
|
function Y1(t) {
|
|
505
|
-
return t instanceof s2 || t instanceof A1 || t instanceof
|
|
505
|
+
return t instanceof s2 || t instanceof A1 || t instanceof t1 ? new Proxy(t, {
|
|
506
506
|
get(r, n) {
|
|
507
507
|
return r.get(Number(n));
|
|
508
508
|
},
|
|
@@ -511,9 +511,9 @@ function Y1(t) {
|
|
|
511
511
|
}
|
|
512
512
|
}) : t;
|
|
513
513
|
}
|
|
514
|
-
function
|
|
514
|
+
function N2(t, e) {
|
|
515
515
|
let r;
|
|
516
|
-
return t.data instanceof A1 || t.data instanceof
|
|
516
|
+
return t.data instanceof A1 || t.data instanceof t1 ? r = new t.constructor(
|
|
517
517
|
// @ts-expect-error
|
|
518
518
|
t.data.length,
|
|
519
519
|
t.data.chars
|
|
@@ -523,8 +523,8 @@ function O2(t, e) {
|
|
|
523
523
|
stride: W(t.shape, e)
|
|
524
524
|
};
|
|
525
525
|
}
|
|
526
|
-
function
|
|
527
|
-
let r =
|
|
526
|
+
function C2(t, e) {
|
|
527
|
+
let r = N2(t, e), n = t.shape.length, i = t.data.length, s = Array(n).fill(0), a = Y1(t.data), o = Y1(r.data);
|
|
528
528
|
for (let c = 0; c < i; c++) {
|
|
529
529
|
let f = 0;
|
|
530
530
|
for (let l = 0; l < n; l++)
|
|
@@ -539,12 +539,12 @@ function D2(t, e) {
|
|
|
539
539
|
}
|
|
540
540
|
return r;
|
|
541
541
|
}
|
|
542
|
-
function
|
|
542
|
+
function O2(t) {
|
|
543
543
|
let e = t.shape.length;
|
|
544
544
|
return L(e === t.stride.length, "Shape and stride must have the same length."), t.stride.map((r, n) => ({ stride: r, index: n })).sort((r, n) => n.stride - r.stride).map((r) => r.index);
|
|
545
545
|
}
|
|
546
|
-
function
|
|
547
|
-
let r =
|
|
546
|
+
function D2(t, e) {
|
|
547
|
+
let r = O2(t);
|
|
548
548
|
return L(r.length === e.length, "Orders must match"), r.every((n, i) => n === e[i]);
|
|
549
549
|
}
|
|
550
550
|
class U1 {
|
|
@@ -569,7 +569,7 @@ class U1 {
|
|
|
569
569
|
return new U1(e, r);
|
|
570
570
|
}
|
|
571
571
|
encode(e) {
|
|
572
|
-
return
|
|
572
|
+
return D2(e, this.#t) ? e : C2(e, this.#t);
|
|
573
573
|
}
|
|
574
574
|
decode(e) {
|
|
575
575
|
return {
|
|
@@ -614,10 +614,10 @@ class I1 {
|
|
|
614
614
|
return new Uint8Array(r);
|
|
615
615
|
}
|
|
616
616
|
}
|
|
617
|
-
function
|
|
618
|
-
return (/* @__PURE__ */ new Map()).set("blosc", () => import("./blosc-D1xNXZJs.js").then((t) => t.default)).set("lz4", () => import("./lz4-1Ws5oVWR.js").then((t) => t.default)).set("zstd", () => import("./zstd-C4EcZnjq.js").then((t) => t.default)).set("gzip", () => z1).set("zlib", () => I1).set("transpose", () => U1).set("bytes", () =>
|
|
617
|
+
function P2() {
|
|
618
|
+
return (/* @__PURE__ */ new Map()).set("blosc", () => import("./blosc-D1xNXZJs.js").then((t) => t.default)).set("lz4", () => import("./lz4-1Ws5oVWR.js").then((t) => t.default)).set("zstd", () => import("./zstd-C4EcZnjq.js").then((t) => t.default)).set("gzip", () => z1).set("zlib", () => I1).set("transpose", () => U1).set("bytes", () => d1).set("crc32c", () => T1).set("vlen-utf8", () => $1).set("json2", () => S1).set("bitround", () => L1);
|
|
619
619
|
}
|
|
620
|
-
const
|
|
620
|
+
const j2 = P2();
|
|
621
621
|
function w1(t) {
|
|
622
622
|
let e;
|
|
623
623
|
return {
|
|
@@ -643,7 +643,7 @@ function w1(t) {
|
|
|
643
643
|
}
|
|
644
644
|
async function J1(t) {
|
|
645
645
|
let e = t.codecs.map(async (s) => {
|
|
646
|
-
let a = await
|
|
646
|
+
let a = await j2.get(s.name)?.();
|
|
647
647
|
return L(a, `Unknown codec: ${s.name}`), { Codec: a, meta: s };
|
|
648
648
|
}), r = [], n, i = [];
|
|
649
649
|
for await (let { Codec: s, meta: a } of e) {
|
|
@@ -659,12 +659,12 @@ async function J1(t) {
|
|
|
659
659
|
i.push(o);
|
|
660
660
|
}
|
|
661
661
|
}
|
|
662
|
-
return n || (L(
|
|
662
|
+
return n || (L(W2(t), `Cannot encode ${t.data_type} to bytes without a codec`), n = d1.fromConfig({ endian: "little" }, t)), { array_to_array: r, array_to_bytes: n, bytes_to_bytes: i };
|
|
663
663
|
}
|
|
664
|
-
function
|
|
664
|
+
function W2(t) {
|
|
665
665
|
return t.data_type !== "v2:object";
|
|
666
666
|
}
|
|
667
|
-
class
|
|
667
|
+
class n1 extends Error {
|
|
668
668
|
constructor(e, r = {}) {
|
|
669
669
|
super(`Node not found: ${e}`, r), this.name = "NodeNotFoundError";
|
|
670
670
|
}
|
|
@@ -675,7 +675,7 @@ class B1 extends Error {
|
|
|
675
675
|
}
|
|
676
676
|
}
|
|
677
677
|
const q1 = 18446744073709551615n;
|
|
678
|
-
function
|
|
678
|
+
function H2(t, e, r, n) {
|
|
679
679
|
L(t.store.getRange, "Store does not support range requests");
|
|
680
680
|
let i = t.store.getRange.bind(t.store), s = e.map((c, f) => c / n.chunk_shape[f]), a = w1({
|
|
681
681
|
data_type: "uint64",
|
|
@@ -726,13 +726,13 @@ class M1 extends q {
|
|
|
726
726
|
function G1(t) {
|
|
727
727
|
return t.find((r) => r.name === "transpose")?.configuration?.order ?? "C";
|
|
728
728
|
}
|
|
729
|
-
const
|
|
730
|
-
function
|
|
731
|
-
return t[
|
|
729
|
+
const X = Symbol("zarrita.context");
|
|
730
|
+
function Y2(t) {
|
|
731
|
+
return t[X];
|
|
732
732
|
}
|
|
733
|
-
function
|
|
734
|
-
let { configuration: r } = e.codecs.find(
|
|
735
|
-
encode_chunk_key:
|
|
733
|
+
function J2(t, e) {
|
|
734
|
+
let { configuration: r } = e.codecs.find(B2) ?? {}, n = {
|
|
735
|
+
encode_chunk_key: z2(e.chunk_key_encoding),
|
|
736
736
|
TypedArray: a2(e.data_type),
|
|
737
737
|
fill_value: e.fill_value
|
|
738
738
|
};
|
|
@@ -750,7 +750,7 @@ function G2(t, e) {
|
|
|
750
750
|
get_strides(a) {
|
|
751
751
|
return W(a, s);
|
|
752
752
|
},
|
|
753
|
-
get_chunk_bytes:
|
|
753
|
+
get_chunk_bytes: H2(t, e.chunk_grid.configuration.chunk_shape, n.encode_chunk_key, r)
|
|
754
754
|
};
|
|
755
755
|
}
|
|
756
756
|
let i = G1(e.codecs);
|
|
@@ -772,15 +772,15 @@ function G2(t, e) {
|
|
|
772
772
|
}
|
|
773
773
|
};
|
|
774
774
|
}
|
|
775
|
-
let
|
|
775
|
+
let l1 = class extends q {
|
|
776
776
|
kind = "array";
|
|
777
777
|
#e;
|
|
778
|
-
[
|
|
778
|
+
[X];
|
|
779
779
|
constructor(e, r, n) {
|
|
780
780
|
super(e, r), this.#e = {
|
|
781
781
|
...n,
|
|
782
782
|
fill_value: o2(n)
|
|
783
|
-
}, this[
|
|
783
|
+
}, this[X] = J2(this, n);
|
|
784
784
|
}
|
|
785
785
|
get attrs() {
|
|
786
786
|
return this.#e.attributes;
|
|
@@ -789,13 +789,13 @@ let c1 = class extends q {
|
|
|
789
789
|
return this.#e.shape;
|
|
790
790
|
}
|
|
791
791
|
get chunks() {
|
|
792
|
-
return this[
|
|
792
|
+
return this[X].chunk_shape;
|
|
793
793
|
}
|
|
794
794
|
get dtype() {
|
|
795
795
|
return this.#e.data_type;
|
|
796
796
|
}
|
|
797
797
|
async getChunk(e, r) {
|
|
798
|
-
let n = this[
|
|
798
|
+
let n = this[X], i = await n.get_chunk_bytes(e, r);
|
|
799
799
|
if (!i) {
|
|
800
800
|
let s = n.chunk_shape.reduce((o, c) => o * c, 1), a = new n.TypedArray(s);
|
|
801
801
|
return a.fill(n.fill_value), {
|
|
@@ -824,15 +824,15 @@ let c1 = class extends q {
|
|
|
824
824
|
* ```
|
|
825
825
|
*/
|
|
826
826
|
is(e) {
|
|
827
|
-
return
|
|
827
|
+
return I2(this.dtype, e);
|
|
828
828
|
}
|
|
829
829
|
};
|
|
830
|
-
function*
|
|
830
|
+
function* q2(t, e, r = 1) {
|
|
831
831
|
e === void 0 && (e = t, t = 0);
|
|
832
832
|
for (let n = t; n < e; n += r)
|
|
833
833
|
yield n;
|
|
834
834
|
}
|
|
835
|
-
function*
|
|
835
|
+
function* G2(...t) {
|
|
836
836
|
if (t.length === 0)
|
|
837
837
|
return;
|
|
838
838
|
const e = t.map((n) => n[Symbol.iterator]()), r = e.map((n) => n.next());
|
|
@@ -847,21 +847,21 @@ function* K2(...t) {
|
|
|
847
847
|
r[n] = e[n].next();
|
|
848
848
|
}
|
|
849
849
|
}
|
|
850
|
-
function
|
|
850
|
+
function X2({ start: t, stop: e, step: r }, n) {
|
|
851
851
|
if (r === 0)
|
|
852
852
|
throw new Error("slice step cannot be zero");
|
|
853
853
|
r = r ?? 1;
|
|
854
854
|
const i = r < 0, [s, a] = i ? [-1, n - 1] : [0, n];
|
|
855
855
|
return t === null ? t = i ? a : s : t < 0 ? (t += n, t < s && (t = s)) : t > a && (t = a), e === null ? e = i ? s : a : e < 0 ? (e += n, e < s && (e = s)) : e > a && (e = a), [t, e, r];
|
|
856
856
|
}
|
|
857
|
-
function
|
|
857
|
+
function u1(t, e, r = null) {
|
|
858
858
|
return e === void 0 && (e = t, t = null), {
|
|
859
859
|
start: t,
|
|
860
860
|
stop: e,
|
|
861
861
|
step: r
|
|
862
862
|
};
|
|
863
863
|
}
|
|
864
|
-
function
|
|
864
|
+
function K2() {
|
|
865
865
|
const t = [];
|
|
866
866
|
return {
|
|
867
867
|
add: (e) => t.push(e()),
|
|
@@ -873,28 +873,28 @@ class F1 extends Error {
|
|
|
873
873
|
super(e), this.name = "IndexError";
|
|
874
874
|
}
|
|
875
875
|
}
|
|
876
|
-
function
|
|
876
|
+
function Q2(t, e) {
|
|
877
877
|
throw new F1(`too many indicies for array; expected ${e.length}, got ${t.length}`);
|
|
878
878
|
}
|
|
879
|
-
function
|
|
879
|
+
function Z2(t) {
|
|
880
880
|
throw new F1(`index out of bounds for dimension with length ${t}`);
|
|
881
881
|
}
|
|
882
|
-
function
|
|
882
|
+
function V2() {
|
|
883
883
|
throw new F1("only slices with step >= 1 are supported");
|
|
884
884
|
}
|
|
885
|
-
function
|
|
886
|
-
t.length > e.length &&
|
|
885
|
+
function e5(t, e) {
|
|
886
|
+
t.length > e.length && Q2(t, e);
|
|
887
887
|
}
|
|
888
|
-
function
|
|
889
|
-
return t = Math.trunc(t), t < 0 && (t = e + t), (t >= e || t < 0) &&
|
|
888
|
+
function t5(t, e) {
|
|
889
|
+
return t = Math.trunc(t), t < 0 && (t = e + t), (t >= e || t < 0) && Z2(e), t;
|
|
890
890
|
}
|
|
891
|
-
class
|
|
891
|
+
class r5 {
|
|
892
892
|
dim_sel;
|
|
893
893
|
dim_len;
|
|
894
894
|
dim_chunk_len;
|
|
895
895
|
nitems;
|
|
896
896
|
constructor({ dim_sel: e, dim_len: r, dim_chunk_len: n }) {
|
|
897
|
-
e =
|
|
897
|
+
e = t5(e, r), this.dim_sel = e, this.dim_len = r, this.dim_chunk_len = n, this.nitems = 1;
|
|
898
898
|
}
|
|
899
899
|
*[Symbol.iterator]() {
|
|
900
900
|
const e = Math.floor(this.dim_sel / this.dim_chunk_len), r = e * this.dim_chunk_len, n = this.dim_sel - r;
|
|
@@ -910,12 +910,12 @@ class X1 {
|
|
|
910
910
|
nitems;
|
|
911
911
|
nchunks;
|
|
912
912
|
constructor({ dim_sel: e, dim_len: r, dim_chunk_len: n }) {
|
|
913
|
-
const [i, s, a] =
|
|
914
|
-
this.start = i, this.stop = s, this.step = a, this.step < 1 &&
|
|
913
|
+
const [i, s, a] = X2(e, r);
|
|
914
|
+
this.start = i, this.stop = s, this.step = a, this.step < 1 && V2(), this.dim_len = r, this.dim_chunk_len = n, this.nitems = Math.max(0, Math.ceil((this.stop - this.start) / this.step)), this.nchunks = Math.ceil(this.dim_len / this.dim_chunk_len);
|
|
915
915
|
}
|
|
916
916
|
*[Symbol.iterator]() {
|
|
917
917
|
const e = Math.floor(this.start / this.dim_chunk_len), r = Math.ceil(this.stop / this.dim_chunk_len);
|
|
918
|
-
for (const n of
|
|
918
|
+
for (const n of q2(e, r)) {
|
|
919
919
|
const i = n * this.dim_chunk_len, s = Math.min(this.dim_len, (n + 1) * this.dim_chunk_len), a = s - i;
|
|
920
920
|
let o = 0, c = 0;
|
|
921
921
|
if (this.start < i) {
|
|
@@ -936,15 +936,15 @@ class X1 {
|
|
|
936
936
|
}
|
|
937
937
|
}
|
|
938
938
|
}
|
|
939
|
-
function
|
|
939
|
+
function n5(t, e) {
|
|
940
940
|
let r = [];
|
|
941
|
-
return t === null ? r = e.map((n) =>
|
|
941
|
+
return t === null ? r = e.map((n) => u1(null)) : Array.isArray(t) && (r = t.map((n) => n ?? u1(null))), e5(r, e), r;
|
|
942
942
|
}
|
|
943
|
-
class
|
|
943
|
+
class i5 {
|
|
944
944
|
dim_indexers;
|
|
945
945
|
shape;
|
|
946
946
|
constructor({ selection: e, shape: r, chunk_shape: n }) {
|
|
947
|
-
this.dim_indexers =
|
|
947
|
+
this.dim_indexers = n5(e, r).map((i, s) => new (typeof i == "number" ? r5 : X1)({
|
|
948
948
|
// @ts-expect-error ts inference not strong enough to know correct chunk
|
|
949
949
|
dim_sel: i,
|
|
950
950
|
dim_len: r[s],
|
|
@@ -952,27 +952,27 @@ class a5 {
|
|
|
952
952
|
})), this.shape = this.dim_indexers.filter((i) => i instanceof X1).map((i) => i.nitems);
|
|
953
953
|
}
|
|
954
954
|
*[Symbol.iterator]() {
|
|
955
|
-
for (const e of
|
|
955
|
+
for (const e of G2(...this.dim_indexers)) {
|
|
956
956
|
const r = e.map((i) => i.dim_chunk_ix), n = e.map((i) => "dim_out_sel" in i ? { from: i.dim_chunk_sel, to: i.dim_out_sel } : { from: i.dim_chunk_sel, to: null });
|
|
957
957
|
yield { chunk_coords: r, mapping: n };
|
|
958
958
|
}
|
|
959
959
|
}
|
|
960
960
|
}
|
|
961
|
-
function
|
|
961
|
+
function s5(t, e) {
|
|
962
962
|
return "get" in t ? t.get(e) : t[e];
|
|
963
963
|
}
|
|
964
|
-
async function
|
|
965
|
-
let i =
|
|
964
|
+
async function a5(t, e, r, n) {
|
|
965
|
+
let i = Y2(t), s = new i5({
|
|
966
966
|
selection: e,
|
|
967
967
|
shape: t.shape,
|
|
968
968
|
chunk_shape: t.chunks
|
|
969
|
-
}), a = n.prepare(new i.TypedArray(s.shape.reduce((c, f) => c * f, 1)), s.shape, i.get_strides(s.shape)), o = r.create_queue?.() ??
|
|
969
|
+
}), a = n.prepare(new i.TypedArray(s.shape.reduce((c, f) => c * f, 1)), s.shape, i.get_strides(s.shape)), o = r.create_queue?.() ?? K2();
|
|
970
970
|
for (const { chunk_coords: c, mapping: f } of s)
|
|
971
971
|
o.add(async () => {
|
|
972
972
|
let { data: l, shape: h, stride: d } = await t.getChunk(c, r.opts), u = n.prepare(l, h, d);
|
|
973
973
|
n.set_from_chunk(a, u, f);
|
|
974
974
|
});
|
|
975
|
-
return await o.onIdle(), s.shape.length === 0 ?
|
|
975
|
+
return await o.onIdle(), s.shape.length === 0 ? s5(a.data, 0) : a;
|
|
976
976
|
}
|
|
977
977
|
function R1(t, e = 0, r) {
|
|
978
978
|
let n = r ?? t.length - e;
|
|
@@ -1002,30 +1002,30 @@ function m1(t) {
|
|
|
1002
1002
|
bytes_per_element: t.data.BYTES_PER_ELEMENT
|
|
1003
1003
|
};
|
|
1004
1004
|
}
|
|
1005
|
-
function
|
|
1005
|
+
function o5(t) {
|
|
1006
1006
|
return "chars" in t ? t.constructor.bind(null, t.chars) : t.constructor;
|
|
1007
1007
|
}
|
|
1008
|
-
function
|
|
1008
|
+
function c5(t, e) {
|
|
1009
1009
|
if (globalThis.Array.isArray(t.data))
|
|
1010
1010
|
return R1([e]);
|
|
1011
|
-
let r =
|
|
1011
|
+
let r = o5(t.data), n = new r([e]);
|
|
1012
1012
|
return new Uint8Array(n.buffer, n.byteOffset, n.byteLength);
|
|
1013
1013
|
}
|
|
1014
|
-
const
|
|
1014
|
+
const l5 = {
|
|
1015
1015
|
prepare(t, e, r) {
|
|
1016
1016
|
return { data: t, shape: e, stride: r };
|
|
1017
1017
|
},
|
|
1018
1018
|
set_scalar(t, e, r) {
|
|
1019
1019
|
let n = m1(t);
|
|
1020
|
-
b1(n, e,
|
|
1020
|
+
b1(n, e, c5(t, r), n.bytes_per_element);
|
|
1021
1021
|
},
|
|
1022
1022
|
set_from_chunk(t, e, r) {
|
|
1023
1023
|
let n = m1(t);
|
|
1024
|
-
|
|
1024
|
+
a1(n, m1(e), n.bytes_per_element, r);
|
|
1025
1025
|
}
|
|
1026
1026
|
};
|
|
1027
|
-
async function
|
|
1028
|
-
return
|
|
1027
|
+
async function u5(t, e = null, r = {}) {
|
|
1028
|
+
return a5(t, e, r, l5);
|
|
1029
1029
|
}
|
|
1030
1030
|
function u2(t, e, r) {
|
|
1031
1031
|
return r < 0 && e < t ? Math.floor((t - e - 1) / -r) + 1 : t < e ? Math.floor((e - t - 1) / r) + 1 : 0;
|
|
@@ -1052,14 +1052,14 @@ function b1(t, e, r, n) {
|
|
|
1052
1052
|
b1({ data: u, stride: o }, s, r, n);
|
|
1053
1053
|
}
|
|
1054
1054
|
}
|
|
1055
|
-
function
|
|
1055
|
+
function a1(t, e, r, n) {
|
|
1056
1056
|
const [i, ...s] = n, [a, ...o] = t.stride, [c, ...f] = e.stride;
|
|
1057
1057
|
if (i.from === null) {
|
|
1058
1058
|
if (s.length === 0) {
|
|
1059
1059
|
t.data.set(e.data.subarray(0, r), i.to * r);
|
|
1060
1060
|
return;
|
|
1061
1061
|
}
|
|
1062
|
-
|
|
1062
|
+
a1({
|
|
1063
1063
|
data: t.data.subarray(a * i.to * r),
|
|
1064
1064
|
stride: o
|
|
1065
1065
|
}, e, r, s);
|
|
@@ -1071,7 +1071,7 @@ function s1(t, e, r, n) {
|
|
|
1071
1071
|
t.data.set(e.data.subarray(_, _ + r), 0);
|
|
1072
1072
|
return;
|
|
1073
1073
|
}
|
|
1074
|
-
|
|
1074
|
+
a1(t, {
|
|
1075
1075
|
data: e.data.subarray(c * i.from * r),
|
|
1076
1076
|
stride: f
|
|
1077
1077
|
}, r, s);
|
|
@@ -1091,7 +1091,7 @@ function s1(t, e, r, n) {
|
|
|
1091
1091
|
return;
|
|
1092
1092
|
}
|
|
1093
1093
|
for (let _ = 0; _ < p; _++)
|
|
1094
|
-
|
|
1094
|
+
a1({
|
|
1095
1095
|
data: t.data.subarray(a * (l + _ * d) * r),
|
|
1096
1096
|
stride: o
|
|
1097
1097
|
}, {
|
|
@@ -1099,8 +1099,8 @@ function s1(t, e, r, n) {
|
|
|
1099
1099
|
stride: f
|
|
1100
1100
|
}, r, s);
|
|
1101
1101
|
}
|
|
1102
|
-
let
|
|
1103
|
-
function
|
|
1102
|
+
let h1 = f5();
|
|
1103
|
+
function f5() {
|
|
1104
1104
|
let t = /* @__PURE__ */ new WeakMap();
|
|
1105
1105
|
function e(r) {
|
|
1106
1106
|
let n = t.get(r) ?? { v2: 0, v3: 0 };
|
|
@@ -1116,53 +1116,53 @@ function h5() {
|
|
|
1116
1116
|
}
|
|
1117
1117
|
};
|
|
1118
1118
|
}
|
|
1119
|
-
async function
|
|
1119
|
+
async function d5(t) {
|
|
1120
1120
|
let e = await t.store.get(t.resolve(".zattrs").path);
|
|
1121
|
-
return e ?
|
|
1121
|
+
return e ? r1(e) : {};
|
|
1122
1122
|
}
|
|
1123
|
-
async function
|
|
1123
|
+
async function h5(t, e = {}) {
|
|
1124
1124
|
let r = "store" in t ? t : new q(t), n = {};
|
|
1125
|
-
return (e.attrs ?? !0) && (n = await
|
|
1125
|
+
return (e.attrs ?? !0) && (n = await d5(r)), e.kind === "array" ? K1(r, n) : e.kind === "group" ? Q1(r, n) : K1(r, n).catch((i) => (c2(i, n1), Q1(r, n)));
|
|
1126
1126
|
}
|
|
1127
1127
|
async function K1(t, e) {
|
|
1128
1128
|
let { path: r } = t.resolve(".zarray"), n = await t.store.get(r);
|
|
1129
1129
|
if (!n)
|
|
1130
|
-
throw new
|
|
1130
|
+
throw new n1("v2 array", {
|
|
1131
1131
|
cause: new B1(r)
|
|
1132
1132
|
});
|
|
1133
|
-
return
|
|
1133
|
+
return h1.increment(t.store, "v2"), new l1(t.store, t.path, U2(r1(n), e));
|
|
1134
1134
|
}
|
|
1135
1135
|
async function Q1(t, e) {
|
|
1136
1136
|
let { path: r } = t.resolve(".zgroup"), n = await t.store.get(r);
|
|
1137
1137
|
if (!n)
|
|
1138
|
-
throw new
|
|
1138
|
+
throw new n1("v2 group", {
|
|
1139
1139
|
cause: new B1(r)
|
|
1140
1140
|
});
|
|
1141
|
-
return
|
|
1141
|
+
return h1.increment(t.store, "v2"), new M1(t.store, t.path, $2(r1(n), e));
|
|
1142
1142
|
}
|
|
1143
|
-
async function
|
|
1143
|
+
async function p5(t) {
|
|
1144
1144
|
let { store: e, path: r } = t.resolve("zarr.json"), n = await t.store.get(r);
|
|
1145
1145
|
if (!n)
|
|
1146
|
-
throw new
|
|
1146
|
+
throw new n1("v3 array or group", {
|
|
1147
1147
|
cause: new B1(r)
|
|
1148
1148
|
});
|
|
1149
|
-
let i =
|
|
1150
|
-
return i.node_type === "array" && (i.fill_value = o2(i)), i.node_type === "array" ? new
|
|
1149
|
+
let i = r1(n);
|
|
1150
|
+
return i.node_type === "array" && (i.fill_value = o2(i)), i.node_type === "array" ? new l1(e, t.path, i) : new M1(e, t.path, i);
|
|
1151
1151
|
}
|
|
1152
|
-
async function
|
|
1153
|
-
let r = "store" in t ? t : new q(t), n = await
|
|
1154
|
-
if (
|
|
1152
|
+
async function m5(t, e = {}) {
|
|
1153
|
+
let r = "store" in t ? t : new q(t), n = await p5(r);
|
|
1154
|
+
if (h1.increment(r.store, "v3"), e.kind === void 0 || e.kind === "array" && n instanceof l1 || e.kind === "group" && n instanceof M1)
|
|
1155
1155
|
return n;
|
|
1156
|
-
let i = n instanceof
|
|
1156
|
+
let i = n instanceof l1 ? "array" : "group";
|
|
1157
1157
|
throw new Error(`Expected node of kind ${e.kind}, found ${i}.`);
|
|
1158
1158
|
}
|
|
1159
1159
|
async function O(t, e = {}) {
|
|
1160
|
-
let r = "store" in t ? t.store : t, n =
|
|
1161
|
-
return i(t, e).catch((a) => (c2(a,
|
|
1160
|
+
let r = "store" in t ? t.store : t, n = h1.version_max(r), i = n === "v2" ? O.v2 : O.v3, s = n === "v2" ? O.v3 : O.v2;
|
|
1161
|
+
return i(t, e).catch((a) => (c2(a, n1), s(t, e)));
|
|
1162
1162
|
}
|
|
1163
|
-
O.v2 =
|
|
1164
|
-
O.v3 =
|
|
1165
|
-
function
|
|
1163
|
+
O.v2 = h5;
|
|
1164
|
+
O.v3 = m5;
|
|
1165
|
+
function g5(t) {
|
|
1166
1166
|
let e = Z1.find((r) => r.name === t);
|
|
1167
1167
|
return e?.rgb || Z1[0].rgb;
|
|
1168
1168
|
}
|
|
@@ -13481,7 +13481,7 @@ const Z1 = [
|
|
|
13481
13481
|
[255, 255, 255]
|
|
13482
13482
|
]
|
|
13483
13483
|
}
|
|
13484
|
-
],
|
|
13484
|
+
], K = 3, D = {
|
|
13485
13485
|
cyan: "#00FFFF",
|
|
13486
13486
|
yellow: "#FFFF00",
|
|
13487
13487
|
magenta: "#FF00FF",
|
|
@@ -13489,28 +13489,28 @@ const Z1 = [
|
|
|
13489
13489
|
green: "#00FF00",
|
|
13490
13490
|
blue: "#0000FF",
|
|
13491
13491
|
white: "#FFFFFF"
|
|
13492
|
-
},
|
|
13492
|
+
}, y5 = [D.magenta, D.green], _5 = [D.red, D.green, D.blue], V1 = Object.values(D).slice(0, -2);
|
|
13493
13493
|
function f2(t) {
|
|
13494
13494
|
t.startsWith("#") && (t = t.slice(1));
|
|
13495
13495
|
const e = parseInt(t.slice(0, 2), 16), r = parseInt(t.slice(2, 4), 16), n = parseInt(t.slice(4, 6), 16);
|
|
13496
13496
|
return [e, r, n];
|
|
13497
13497
|
}
|
|
13498
|
-
function
|
|
13498
|
+
function w5(t) {
|
|
13499
13499
|
let e;
|
|
13500
|
-
return t <=
|
|
13501
|
-
...Array(
|
|
13502
|
-
...Array(t -
|
|
13500
|
+
return t <= K ? e = Array(t).fill(!0) : e = [
|
|
13501
|
+
...Array(K).fill(!0),
|
|
13502
|
+
...Array(t - K).fill(!1)
|
|
13503
13503
|
], e;
|
|
13504
13504
|
}
|
|
13505
|
-
function
|
|
13505
|
+
function b5(t, e) {
|
|
13506
13506
|
let r = [];
|
|
13507
13507
|
if (t == 1)
|
|
13508
13508
|
r = [D.white];
|
|
13509
13509
|
else if (t == 2)
|
|
13510
|
-
r =
|
|
13510
|
+
r = y5;
|
|
13511
13511
|
else if (t === 3)
|
|
13512
|
-
r =
|
|
13513
|
-
else if (t <=
|
|
13512
|
+
r = _5;
|
|
13513
|
+
else if (t <= K)
|
|
13514
13514
|
r = V1.slice(0, t);
|
|
13515
13515
|
else {
|
|
13516
13516
|
r = Array(t).fill(D.white);
|
|
@@ -13529,10 +13529,10 @@ function d2(t) {
|
|
|
13529
13529
|
}
|
|
13530
13530
|
return [n, r];
|
|
13531
13531
|
}
|
|
13532
|
-
function
|
|
13532
|
+
function v5(t, e, r, n, i, s = !1) {
|
|
13533
13533
|
const a = t[0].shape, o = a[0], c = a[1], f = o * c;
|
|
13534
13534
|
e || (e = t.map(d2));
|
|
13535
|
-
const l = n?.map((y) => y &&
|
|
13535
|
+
const l = n?.map((y) => y && g5(y));
|
|
13536
13536
|
let h = performance.now(), d = new Uint8ClampedArray(4 * o * c).fill(0), u = 0;
|
|
13537
13537
|
for (let y = 0; y < t.length; y++) {
|
|
13538
13538
|
u = 0;
|
|
@@ -13554,11 +13554,11 @@ function E5(t, e, r, n, i, s = !1) {
|
|
|
13554
13554
|
}
|
|
13555
13555
|
if (performance.now() - h < 100 && s) {
|
|
13556
13556
|
let y = 5;
|
|
13557
|
-
|
|
13557
|
+
E5(d, y)[y - 1] < 1 && (d = x5(d, 2));
|
|
13558
13558
|
}
|
|
13559
13559
|
return d;
|
|
13560
13560
|
}
|
|
13561
|
-
function
|
|
13561
|
+
function x5(t, e) {
|
|
13562
13562
|
for (let r = 0; r < t.length / 4; r++)
|
|
13563
13563
|
for (let n = 0; n < 3; n++) {
|
|
13564
13564
|
let i = t[r * 4 + n];
|
|
@@ -13566,7 +13566,7 @@ function k5(t, e) {
|
|
|
13566
13566
|
}
|
|
13567
13567
|
return t;
|
|
13568
13568
|
}
|
|
13569
|
-
function
|
|
13569
|
+
function E5(t, e = 5) {
|
|
13570
13570
|
let r = new Array(e).fill(0);
|
|
13571
13571
|
const n = 256 / e;
|
|
13572
13572
|
let i = t.length / 4;
|
|
@@ -13578,34 +13578,34 @@ function A5(t, e = 5) {
|
|
|
13578
13578
|
}
|
|
13579
13579
|
return r = r.map((s) => 100 * s / i), r;
|
|
13580
13580
|
}
|
|
13581
|
-
function
|
|
13581
|
+
function k5(t, e, r, n, i) {
|
|
13582
13582
|
return t.map((s) => e.map((a, o) => {
|
|
13583
13583
|
let c = a, f = r[o];
|
|
13584
13584
|
if (f == "c") return s;
|
|
13585
13585
|
if (f in n) {
|
|
13586
13586
|
let l = n[f];
|
|
13587
13587
|
if (Array.isArray(l))
|
|
13588
|
-
return
|
|
13588
|
+
return u1(
|
|
13589
13589
|
Math.floor(l[0] / c * a),
|
|
13590
13590
|
Math.floor(l[1] / c * a)
|
|
13591
13591
|
);
|
|
13592
13592
|
if (Number.isInteger(l))
|
|
13593
13593
|
return l !== void 0 ? Math.floor(l / c * a) : void 0;
|
|
13594
13594
|
}
|
|
13595
|
-
return f == "x" || f == "y" ?
|
|
13595
|
+
return f == "x" || f == "y" ? u1(0, a) : f == "z" || f == "t" ? parseInt(a / 2 + "") : 0;
|
|
13596
13596
|
}));
|
|
13597
13597
|
}
|
|
13598
|
-
async function
|
|
13598
|
+
async function A5(t, e, r, n = {}, i = !1, s) {
|
|
13599
13599
|
var a, o;
|
|
13600
13600
|
let c = t.shape, f = e?.map((k) => k.name || k.toString()) || ["t", "c", "z", "y", "x"], l = f.indexOf("c"), h = c[l] || 1, d, u, y, g;
|
|
13601
13601
|
if (r) {
|
|
13602
13602
|
let k = 0;
|
|
13603
|
-
d = r.channels.map((T) => (T.active == null && (T.active = !0), k += T.active ? 1 : 0, T.active && k <=
|
|
13603
|
+
d = r.channels.map((T) => (T.active == null && (T.active = !0), k += T.active ? 1 : 0, T.active && k <= K)), u = r.channels.map((T) => f2(T.color)), y = r.channels.map((T) => "lut" in T ? T.lut : void 0);
|
|
13604
13604
|
} else
|
|
13605
|
-
d =
|
|
13605
|
+
d = w5(h), u = b5(h, d);
|
|
13606
13606
|
let p = d.reduce((k, T, $) => (T && k.push($), k), []);
|
|
13607
13607
|
u = p.map((k) => u[k]), g = p.map((k) => !!(r != null && r.channels[k].inverted)), y !== void 0 && (y = y.filter((k, T) => p.includes(T))), n.z == null && (n.z = (a = r?.rdefs) == null ? void 0 : a.defaultZ), n.t == null && (n.t = (o = r?.rdefs) == null ? void 0 : o.defaultT);
|
|
13608
|
-
let _ =
|
|
13608
|
+
let _ = k5(p, c, f, n).map((k) => u5(t, k)), v = await Promise.all(_), b = p.map((k, T) => {
|
|
13609
13609
|
var $, H;
|
|
13610
13610
|
if (r && r.channels[k]) {
|
|
13611
13611
|
let I = r.channels[k];
|
|
@@ -13613,13 +13613,13 @@ async function T5(t, e, r, n = {}, i = !1, s) {
|
|
|
13613
13613
|
return [I.window.start, I.window.end];
|
|
13614
13614
|
}
|
|
13615
13615
|
return d2(v[T]);
|
|
13616
|
-
}), x =
|
|
13616
|
+
}), x = v5(v, b, u, y, g, i);
|
|
13617
13617
|
const w = document.createElement("canvas"), E = v[0].shape[0], U = v[0].shape[1];
|
|
13618
13618
|
w.width = U, w.height = E;
|
|
13619
13619
|
const C = w.getContext("2d");
|
|
13620
13620
|
return C ? (C.putImageData(new ImageData(x, U, E), 0, 0), w.toDataURL("image/png")) : "";
|
|
13621
13621
|
}
|
|
13622
|
-
function
|
|
13622
|
+
function L5(t) {
|
|
13623
13623
|
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
13624
13624
|
}
|
|
13625
13625
|
var h2 = { exports: {} }, A = h2.exports = {}, B, M;
|
|
@@ -13656,7 +13656,7 @@ function p2(t) {
|
|
|
13656
13656
|
}
|
|
13657
13657
|
}
|
|
13658
13658
|
}
|
|
13659
|
-
function
|
|
13659
|
+
function T5(t) {
|
|
13660
13660
|
if (M === clearTimeout)
|
|
13661
13661
|
return clearTimeout(t);
|
|
13662
13662
|
if ((M === x1 || !M) && clearTimeout)
|
|
@@ -13671,20 +13671,20 @@ function S5(t) {
|
|
|
13671
13671
|
}
|
|
13672
13672
|
}
|
|
13673
13673
|
}
|
|
13674
|
-
var R = [], Y = !1, P,
|
|
13675
|
-
function
|
|
13676
|
-
!Y || !P || (Y = !1, P.length ? R = P.concat(R) :
|
|
13674
|
+
var R = [], Y = !1, P, o1 = -1;
|
|
13675
|
+
function z5() {
|
|
13676
|
+
!Y || !P || (Y = !1, P.length ? R = P.concat(R) : o1 = -1, R.length && m2());
|
|
13677
13677
|
}
|
|
13678
13678
|
function m2() {
|
|
13679
13679
|
if (!Y) {
|
|
13680
|
-
var t = p2(
|
|
13680
|
+
var t = p2(z5);
|
|
13681
13681
|
Y = !0;
|
|
13682
13682
|
for (var e = R.length; e; ) {
|
|
13683
|
-
for (P = R, R = []; ++
|
|
13684
|
-
P && P[
|
|
13685
|
-
|
|
13683
|
+
for (P = R, R = []; ++o1 < e; )
|
|
13684
|
+
P && P[o1].run();
|
|
13685
|
+
o1 = -1, e = R.length;
|
|
13686
13686
|
}
|
|
13687
|
-
P = null, Y = !1,
|
|
13687
|
+
P = null, Y = !1, T5(t);
|
|
13688
13688
|
}
|
|
13689
13689
|
}
|
|
13690
13690
|
A.nextTick = function(t) {
|
|
@@ -13732,8 +13732,8 @@ A.chdir = function(t) {
|
|
|
13732
13732
|
A.umask = function() {
|
|
13733
13733
|
return 0;
|
|
13734
13734
|
};
|
|
13735
|
-
var
|
|
13736
|
-
const
|
|
13735
|
+
var S5 = h2.exports;
|
|
13736
|
+
const s1 = /* @__PURE__ */ L5(S5);
|
|
13737
13737
|
function y2(t) {
|
|
13738
13738
|
return t.arrayBuffer ? t.arrayBuffer() : new Promise((e, r) => {
|
|
13739
13739
|
const n = new FileReader();
|
|
@@ -13742,23 +13742,23 @@ function y2(t) {
|
|
|
13742
13742
|
}), n.addEventListener("error", r), n.readAsArrayBuffer(t);
|
|
13743
13743
|
});
|
|
13744
13744
|
}
|
|
13745
|
-
async function
|
|
13745
|
+
async function U5(t) {
|
|
13746
13746
|
const e = await y2(t);
|
|
13747
13747
|
return new Uint8Array(e);
|
|
13748
13748
|
}
|
|
13749
13749
|
function _2(t) {
|
|
13750
13750
|
return typeof Blob < "u" && t instanceof Blob;
|
|
13751
13751
|
}
|
|
13752
|
-
function
|
|
13752
|
+
function e1(t) {
|
|
13753
13753
|
return typeof SharedArrayBuffer < "u" && t instanceof SharedArrayBuffer;
|
|
13754
13754
|
}
|
|
13755
|
-
const
|
|
13756
|
-
function
|
|
13755
|
+
const $5 = typeof s1 < "u" && s1.versions && typeof s1.versions.node < "u" && typeof s1.versions.electron > "u";
|
|
13756
|
+
function I5(t) {
|
|
13757
13757
|
return t.byteOffset === 0 && t.byteLength === t.buffer.byteLength;
|
|
13758
13758
|
}
|
|
13759
13759
|
class e2 {
|
|
13760
13760
|
constructor(e) {
|
|
13761
|
-
this.typedArray = e instanceof ArrayBuffer ||
|
|
13761
|
+
this.typedArray = e instanceof ArrayBuffer || e1(e) ? new Uint8Array(e) : new Uint8Array(e.buffer, e.byteOffset, e.byteLength);
|
|
13762
13762
|
}
|
|
13763
13763
|
async getLength() {
|
|
13764
13764
|
return this.typedArray.byteLength;
|
|
@@ -13782,10 +13782,10 @@ let t2 = class {
|
|
|
13782
13782
|
return this.blob.slice(e, e + r, n);
|
|
13783
13783
|
}
|
|
13784
13784
|
};
|
|
13785
|
-
function
|
|
13785
|
+
function B5(t, e) {
|
|
13786
13786
|
var r = Uint8Array;
|
|
13787
13787
|
if (t[0] == 3 && t[1] == 0) return e || new r(0);
|
|
13788
|
-
var n =
|
|
13788
|
+
var n = F5, i = w2, s = M5, a = b2, o = e == null;
|
|
13789
13789
|
o && (e = new r(t.length >>> 2 << 3));
|
|
13790
13790
|
for (var c = 0, f = 0, l = 0, h = 0, d = 0, u = 0, y = 0, g = 0, p = 0, _, v; c == 0; ) {
|
|
13791
13791
|
if (c = n(t, p, 1), f = n(t, p + 1, 2), p += 3, f == 0) {
|
|
@@ -13802,11 +13802,11 @@ function F5(t, e) {
|
|
|
13802
13802
|
var U = i(t, p + w * 3, 3);
|
|
13803
13803
|
m.itree[(m.ordr[w] << 1) + 1] = U, U > E && (E = U);
|
|
13804
13804
|
}
|
|
13805
|
-
p += 3 * d,
|
|
13805
|
+
p += 3 * d, Q(m.itree, E), Z(m.itree, E, m.imap), _ = m.lmap, v = m.dmap, p = s(m.imap, (1 << E) - 1, l + h, t, p, m.ttree);
|
|
13806
13806
|
var C = r2(m.ttree, 0, l, m.ltree);
|
|
13807
13807
|
u = (1 << C) - 1;
|
|
13808
13808
|
var k = r2(m.ttree, l, h, m.dtree);
|
|
13809
|
-
y = (1 << k) - 1,
|
|
13809
|
+
y = (1 << k) - 1, Q(m.ltree, C), Z(m.ltree, C, _), Q(m.dtree, k), Z(m.dtree, k, v);
|
|
13810
13810
|
}
|
|
13811
13811
|
for (; ; ) {
|
|
13812
13812
|
var T = _[a(t, p) & u];
|
|
@@ -13824,9 +13824,9 @@ function F5(t, e) {
|
|
|
13824
13824
|
}
|
|
13825
13825
|
var N1 = v[a(t, p) & y];
|
|
13826
13826
|
p += N1 & 15;
|
|
13827
|
-
var k2 = N1 >>> 4,
|
|
13828
|
-
for (p +=
|
|
13829
|
-
e[g] = e[g++ -
|
|
13827
|
+
var k2 = N1 >>> 4, p1 = m.ddef[k2], i1 = (p1 >>> 4) + n(t, p, p1 & 15);
|
|
13828
|
+
for (p += p1 & 15, o && (e = g1(e, g + (1 << 17))); g < H; )
|
|
13829
|
+
e[g] = e[g++ - i1], e[g] = e[g++ - i1], e[g] = e[g++ - i1], e[g] = e[g++ - i1];
|
|
13830
13830
|
g = H;
|
|
13831
13831
|
}
|
|
13832
13832
|
}
|
|
@@ -13839,7 +13839,7 @@ function g1(t, e) {
|
|
|
13839
13839
|
var n = new Uint8Array(Math.max(r << 1, e));
|
|
13840
13840
|
return n.set(t, 0), n;
|
|
13841
13841
|
}
|
|
13842
|
-
function
|
|
13842
|
+
function M5(t, e, r, n, i, s) {
|
|
13843
13843
|
for (var a = w2, o = b2, c = 0; c < r; ) {
|
|
13844
13844
|
var f = t[o(n, i) & e];
|
|
13845
13845
|
i += f & 15;
|
|
@@ -13864,7 +13864,7 @@ function r2(t, e, r, n) {
|
|
|
13864
13864
|
n[s << 1] = 0, n[(s << 1) + 1] = 0, s++;
|
|
13865
13865
|
return i;
|
|
13866
13866
|
}
|
|
13867
|
-
function
|
|
13867
|
+
function Q(t, e) {
|
|
13868
13868
|
for (var r = t.length, n, i, s, a, o, c = m.bl_count, a = 0; a <= e; a++) c[a] = 0;
|
|
13869
13869
|
for (a = 1; a < r; a += 2) c[t[a]]++;
|
|
13870
13870
|
var f = m.next_code;
|
|
@@ -13873,7 +13873,7 @@ function K(t, e) {
|
|
|
13873
13873
|
for (s = 0; s < r; s += 2)
|
|
13874
13874
|
o = t[s + 1], o != 0 && (t[s] = f[o], f[o]++);
|
|
13875
13875
|
}
|
|
13876
|
-
function
|
|
13876
|
+
function Z(t, e, r) {
|
|
13877
13877
|
for (var n = t.length, i = m.rev15, s = 0; s < n; s += 2) if (t[s + 1] != 0)
|
|
13878
13878
|
for (var a = s >> 1, o = t[s + 1], c = a << 4 | o, f = e - o, l = t[s] << f, h = l + (1 << f); l != h; ) {
|
|
13879
13879
|
var d = i[l] >>> 15 - e;
|
|
@@ -13889,7 +13889,7 @@ function n2(t, e) {
|
|
|
13889
13889
|
function w2(t, e, r) {
|
|
13890
13890
|
return (t[e >>> 3] | t[(e >>> 3) + 1] << 8) >>> (e & 7) & (1 << r) - 1;
|
|
13891
13891
|
}
|
|
13892
|
-
function
|
|
13892
|
+
function F5(t, e, r) {
|
|
13893
13893
|
return (t[e >>> 3] | t[(e >>> 3) + 1] << 8 | t[(e >>> 3) + 2] << 16) >>> (e & 7) & (1 << r) - 1;
|
|
13894
13894
|
}
|
|
13895
13895
|
function b2(t, e) {
|
|
@@ -13938,7 +13938,7 @@ const m = (function() {
|
|
|
13938
13938
|
}
|
|
13939
13939
|
for (var e = 0; e < 32; e++)
|
|
13940
13940
|
m.ldef[e] = m.of0[e] << 3 | m.exb[e], m.ddef[e] = m.df0[e] << 4 | m.dxb[e];
|
|
13941
|
-
n(m.fltree, 144, 8), n(m.fltree, 112, 9), n(m.fltree, 24, 7), n(m.fltree, 8, 8),
|
|
13941
|
+
n(m.fltree, 144, 8), n(m.fltree, 112, 9), n(m.fltree, 24, 7), n(m.fltree, 8, 8), Q(m.fltree, 9), Z(m.fltree, 9, m.flmap), n2(m.fltree, 9), n(m.fdtree, 32, 5), Q(m.fdtree, 5), Z(m.fdtree, 5, m.fdmap), n2(m.fdtree, 5), n(m.itree, 19, 0), n(m.ltree, 286, 0), n(m.dtree, 30, 0), n(m.ttree, 320, 0);
|
|
13942
13942
|
})();
|
|
13943
13943
|
(function() {
|
|
13944
13944
|
for (var t = new Uint32Array(256), e = 0; e < 256; e++) {
|
|
@@ -13948,16 +13948,16 @@ const m = (function() {
|
|
|
13948
13948
|
}
|
|
13949
13949
|
return t;
|
|
13950
13950
|
})();
|
|
13951
|
-
function
|
|
13952
|
-
return
|
|
13951
|
+
function R5(t, e) {
|
|
13952
|
+
return B5(t, e);
|
|
13953
13953
|
}
|
|
13954
13954
|
const i2 = {
|
|
13955
13955
|
numWorkers: 1,
|
|
13956
13956
|
workerURL: "",
|
|
13957
13957
|
useWorkers: !1
|
|
13958
13958
|
};
|
|
13959
|
-
let
|
|
13960
|
-
const
|
|
13959
|
+
let N5 = 0;
|
|
13960
|
+
const c1 = [];
|
|
13961
13961
|
function y1(t) {
|
|
13962
13962
|
return new Promise((e, r) => {
|
|
13963
13963
|
const n = new Worker(t);
|
|
@@ -13966,12 +13966,12 @@ function y1(t) {
|
|
|
13966
13966
|
}, n.onerror = r;
|
|
13967
13967
|
});
|
|
13968
13968
|
}
|
|
13969
|
-
function
|
|
13969
|
+
function C5(t, e) {
|
|
13970
13970
|
return t.require ? t.require(e) : {};
|
|
13971
13971
|
}
|
|
13972
13972
|
(function() {
|
|
13973
|
-
if (
|
|
13974
|
-
const { Worker: t } =
|
|
13973
|
+
if ($5) {
|
|
13974
|
+
const { Worker: t } = C5(module, "worker_threads");
|
|
13975
13975
|
return {
|
|
13976
13976
|
async createWorker(e) {
|
|
13977
13977
|
return new t(e);
|
|
@@ -14022,43 +14022,43 @@ function D5(t, e) {
|
|
|
14022
14022
|
}
|
|
14023
14023
|
};
|
|
14024
14024
|
})();
|
|
14025
|
-
function
|
|
14025
|
+
function O5(t, e, r, n) {
|
|
14026
14026
|
const i = new Uint8Array(e);
|
|
14027
|
-
|
|
14027
|
+
R5(t, i), n(r ? new Blob([i], { type: r }) : i.buffer);
|
|
14028
14028
|
}
|
|
14029
|
-
async function
|
|
14030
|
-
if (
|
|
14031
|
-
for (;
|
|
14032
|
-
const { src: t, uncompressedSize: e, type: r, resolve: n } =
|
|
14029
|
+
async function D5() {
|
|
14030
|
+
if (c1.length !== 0)
|
|
14031
|
+
for (; c1.length; ) {
|
|
14032
|
+
const { src: t, uncompressedSize: e, type: r, resolve: n } = c1.shift();
|
|
14033
14033
|
let i = t;
|
|
14034
|
-
_2(t) && (i = await
|
|
14034
|
+
_2(t) && (i = await U5(t)), O5(i, e, r, n);
|
|
14035
14035
|
}
|
|
14036
14036
|
}
|
|
14037
14037
|
function v2(t, e, r) {
|
|
14038
14038
|
return new Promise((n, i) => {
|
|
14039
|
-
|
|
14039
|
+
c1.push({ src: t, uncompressedSize: e, type: r, resolve: n, reject: i, id: N5++ }), D5();
|
|
14040
14040
|
});
|
|
14041
14041
|
}
|
|
14042
|
-
function
|
|
14042
|
+
function P5(t, e) {
|
|
14043
14043
|
const r = t & 31, n = (t >> 5 & 15) - 1, i = (t >> 9 & 127) + 1980, s = 0, a = (e & 31) * 2, o = e >> 5 & 63, c = e >> 11 & 31;
|
|
14044
14044
|
return new Date(i, n, r, c, o, a, s);
|
|
14045
14045
|
}
|
|
14046
|
-
class
|
|
14046
|
+
class j5 {
|
|
14047
14047
|
constructor(e, r) {
|
|
14048
|
-
this._reader = e, this._rawEntry = r, this.name = r.name, this.nameBytes = r.nameBytes, this.size = r.uncompressedSize, this.compressedSize = r.compressedSize, this.comment = r.comment, this.commentBytes = r.commentBytes, this.compressionMethod = r.compressionMethod, this.lastModDate =
|
|
14048
|
+
this._reader = e, this._rawEntry = r, this.name = r.name, this.nameBytes = r.nameBytes, this.size = r.uncompressedSize, this.compressedSize = r.compressedSize, this.comment = r.comment, this.commentBytes = r.commentBytes, this.compressionMethod = r.compressionMethod, this.lastModDate = P5(r.lastModFileDate, r.lastModFileTime), this.isDirectory = r.uncompressedSize === 0 && r.name.endsWith("/"), this.encrypted = !!(r.generalPurposeBitFlag & 1), this.externalFileAttributes = r.externalFileAttributes, this.versionMadeBy = r.versionMadeBy;
|
|
14049
14049
|
}
|
|
14050
14050
|
// returns a promise that returns a Blob for this entry
|
|
14051
14051
|
async blob(e = "application/octet-stream") {
|
|
14052
|
-
return await
|
|
14052
|
+
return await V5(this._reader, this._rawEntry, e);
|
|
14053
14053
|
}
|
|
14054
14054
|
// returns a promise that returns an ArrayBuffer for this entry
|
|
14055
14055
|
async arrayBuffer() {
|
|
14056
|
-
return await
|
|
14056
|
+
return await Z5(this._reader, this._rawEntry);
|
|
14057
14057
|
}
|
|
14058
14058
|
// returns text, assumes the text is valid utf8. If you want more options decode arrayBuffer yourself
|
|
14059
14059
|
async text() {
|
|
14060
14060
|
const e = await this.arrayBuffer();
|
|
14061
|
-
return
|
|
14061
|
+
return V(new Uint8Array(e));
|
|
14062
14062
|
}
|
|
14063
14063
|
// returns text with JSON.parse called on it. If you want more options decode arrayBuffer yourself
|
|
14064
14064
|
async json() {
|
|
@@ -14066,14 +14066,14 @@ class H5 {
|
|
|
14066
14066
|
return JSON.parse(e);
|
|
14067
14067
|
}
|
|
14068
14068
|
}
|
|
14069
|
-
const _1 = 22,
|
|
14069
|
+
const _1 = 22, W5 = 65535, H5 = 101010256, Y5 = 101075792;
|
|
14070
14070
|
async function J(t, e, r) {
|
|
14071
14071
|
return await t.read(e, r);
|
|
14072
14072
|
}
|
|
14073
14073
|
async function E1(t, e, r, n) {
|
|
14074
14074
|
return t.sliceAsBlob ? await t.sliceAsBlob(e, r, n) : await t.read(e, r);
|
|
14075
14075
|
}
|
|
14076
|
-
const
|
|
14076
|
+
const J5 = {
|
|
14077
14077
|
unsigned() {
|
|
14078
14078
|
return 0;
|
|
14079
14079
|
}
|
|
@@ -14087,14 +14087,14 @@ function S(t, e) {
|
|
|
14087
14087
|
function j(t, e) {
|
|
14088
14088
|
return S(t, e) + S(t, e + 4) * 4294967296;
|
|
14089
14089
|
}
|
|
14090
|
-
const
|
|
14091
|
-
function
|
|
14092
|
-
return
|
|
14090
|
+
const q5 = new TextDecoder();
|
|
14091
|
+
function V(t, e) {
|
|
14092
|
+
return e1(t.buffer) && (t = new Uint8Array(t)), q5.decode(t);
|
|
14093
14093
|
}
|
|
14094
|
-
async function
|
|
14095
|
-
const r = Math.min(_1 +
|
|
14094
|
+
async function G5(t, e) {
|
|
14095
|
+
const r = Math.min(_1 + W5, e), n = e - r, i = await J(t, n, r);
|
|
14096
14096
|
for (let s = r - _1; s >= 0; --s) {
|
|
14097
|
-
if (S(i, s) !==
|
|
14097
|
+
if (S(i, s) !== H5)
|
|
14098
14098
|
continue;
|
|
14099
14099
|
const a = new Uint8Array(i.buffer, i.byteOffset + s, i.byteLength - s), o = z(a, 4);
|
|
14100
14100
|
if (o !== 0)
|
|
@@ -14102,29 +14102,29 @@ async function K5(t, e) {
|
|
|
14102
14102
|
const c = z(a, 10), f = S(a, 12), l = S(a, 16), h = z(a, 20), d = a.length - _1;
|
|
14103
14103
|
if (h !== d)
|
|
14104
14104
|
throw new Error(`invalid comment length. expected: ${d}, actual: ${h}`);
|
|
14105
|
-
const u = new Uint8Array(a.buffer, a.byteOffset + 22, h), y =
|
|
14106
|
-
return c === 65535 || l === 4294967295 ? await
|
|
14105
|
+
const u = new Uint8Array(a.buffer, a.byteOffset + 22, h), y = V(u);
|
|
14106
|
+
return c === 65535 || l === 4294967295 ? await K5(t, n + s, y, u) : await x2(t, l, f, c, y, u);
|
|
14107
14107
|
}
|
|
14108
14108
|
throw new Error("could not find end of central directory. maybe not zip file");
|
|
14109
14109
|
}
|
|
14110
|
-
const
|
|
14111
|
-
async function
|
|
14110
|
+
const X5 = 117853008;
|
|
14111
|
+
async function K5(t, e, r, n) {
|
|
14112
14112
|
const i = e - 20, s = await J(t, i, 20);
|
|
14113
|
-
if (S(s, 0) !==
|
|
14113
|
+
if (S(s, 0) !== X5)
|
|
14114
14114
|
throw new Error("invalid zip64 end of central directory locator signature");
|
|
14115
14115
|
const a = j(s, 8), o = await J(t, a, 56);
|
|
14116
|
-
if (S(o, 0) !==
|
|
14116
|
+
if (S(o, 0) !== Y5)
|
|
14117
14117
|
throw new Error("invalid zip64 end of central directory record signature");
|
|
14118
14118
|
const c = j(o, 32), f = j(o, 40), l = j(o, 48);
|
|
14119
14119
|
return x2(t, l, f, c, r, n);
|
|
14120
14120
|
}
|
|
14121
|
-
const
|
|
14121
|
+
const Q5 = 33639248;
|
|
14122
14122
|
async function x2(t, e, r, n, i, s) {
|
|
14123
14123
|
let a = 0;
|
|
14124
14124
|
const o = await J(t, e, r), c = [];
|
|
14125
14125
|
for (let l = 0; l < n; ++l) {
|
|
14126
14126
|
const h = o.subarray(a, a + 46), d = S(h, 0);
|
|
14127
|
-
if (d !==
|
|
14127
|
+
if (d !== Q5)
|
|
14128
14128
|
throw new Error(`invalid central directory file header signature: 0x${d.toString(16)}`);
|
|
14129
14129
|
const u = {
|
|
14130
14130
|
// 4 - Version made by
|
|
@@ -14163,7 +14163,7 @@ async function x2(t, e, r, n, i, s) {
|
|
|
14163
14163
|
throw new Error("strong encryption is not supported");
|
|
14164
14164
|
a += 46;
|
|
14165
14165
|
const y = o.subarray(a, a + u.fileNameLength + u.extraFieldLength + u.fileCommentLength);
|
|
14166
|
-
u.nameBytes = y.slice(0, u.fileNameLength), u.name =
|
|
14166
|
+
u.nameBytes = y.slice(0, u.fileNameLength), u.name = V(u.nameBytes);
|
|
14167
14167
|
const g = u.fileNameLength + u.extraFieldLength, p = y.slice(u.fileNameLength, g);
|
|
14168
14168
|
u.extraFields = [];
|
|
14169
14169
|
let _ = 0;
|
|
@@ -14176,7 +14176,7 @@ async function x2(t, e, r, n, i, s) {
|
|
|
14176
14176
|
data: p.slice(w, E)
|
|
14177
14177
|
}), _ = E;
|
|
14178
14178
|
}
|
|
14179
|
-
if (u.commentBytes = y.slice(g, g + u.fileCommentLength), u.comment =
|
|
14179
|
+
if (u.commentBytes = y.slice(g, g + u.fileCommentLength), u.comment = V(u.commentBytes), a += y.length, u.uncompressedSize === 4294967295 || u.compressedSize === 4294967295 || u.relativeOffsetOfLocalHeader === 4294967295) {
|
|
14180
14180
|
const b = u.extraFields.find((E) => E.id === 1);
|
|
14181
14181
|
if (!b)
|
|
14182
14182
|
throw new Error("expected zip64 extended information extra field");
|
|
@@ -14200,8 +14200,8 @@ async function x2(t, e, r, n, i, s) {
|
|
|
14200
14200
|
}
|
|
14201
14201
|
const v = u.extraFields.find((b) => b.id === 28789 && b.data.length >= 6 && // too short to be meaningful
|
|
14202
14202
|
b.data[0] === 1 && // Version 1 byte version of this extra field, currently 1
|
|
14203
|
-
S(b.data, 1),
|
|
14204
|
-
if (v && (u.fileName =
|
|
14203
|
+
S(b.data, 1), J5.unsigned(u.nameBytes));
|
|
14204
|
+
if (v && (u.fileName = V(v.data.slice(5))), u.compressionMethod === 0) {
|
|
14205
14205
|
let b = u.uncompressedSize;
|
|
14206
14206
|
if ((u.generalPurposeBitFlag & 1) !== 0 && (b += 12), u.compressedSize !== b)
|
|
14207
14207
|
throw new Error(`compressed size mismatch for stored file: ${u.compressedSize} != ${b}`);
|
|
@@ -14213,7 +14213,7 @@ async function x2(t, e, r, n, i, s) {
|
|
|
14213
14213
|
comment: i,
|
|
14214
14214
|
commentBytes: s
|
|
14215
14215
|
},
|
|
14216
|
-
entries: c.map((l) => new
|
|
14216
|
+
entries: c.map((l) => new j5(t, l))
|
|
14217
14217
|
};
|
|
14218
14218
|
}
|
|
14219
14219
|
async function E2(t, e) {
|
|
@@ -14238,31 +14238,31 @@ async function E2(t, e) {
|
|
|
14238
14238
|
fileDataStart: f
|
|
14239
14239
|
};
|
|
14240
14240
|
}
|
|
14241
|
-
async function
|
|
14241
|
+
async function Z5(t, e) {
|
|
14242
14242
|
const { decompress: r, fileDataStart: n } = await E2(t, e);
|
|
14243
14243
|
if (!r) {
|
|
14244
14244
|
const a = await J(t, n, e.compressedSize);
|
|
14245
|
-
return
|
|
14245
|
+
return I5(a) ? a.buffer : a.slice().buffer;
|
|
14246
14246
|
}
|
|
14247
14247
|
const i = await E1(t, n, e.compressedSize);
|
|
14248
14248
|
return await v2(i, e.uncompressedSize);
|
|
14249
14249
|
}
|
|
14250
|
-
async function
|
|
14250
|
+
async function V5(t, e, r) {
|
|
14251
14251
|
const { decompress: n, fileDataStart: i } = await E2(t, e);
|
|
14252
14252
|
if (!n) {
|
|
14253
14253
|
const o = await E1(t, i, e.compressedSize, r);
|
|
14254
|
-
return _2(o) ? o : new Blob([
|
|
14254
|
+
return _2(o) ? o : new Blob([e1(o.buffer) ? new Uint8Array(o) : o], { type: r });
|
|
14255
14255
|
}
|
|
14256
14256
|
const s = await E1(t, i, e.compressedSize);
|
|
14257
14257
|
return await v2(s, e.uncompressedSize, r);
|
|
14258
14258
|
}
|
|
14259
|
-
async function
|
|
14259
|
+
async function e0(t) {
|
|
14260
14260
|
let e;
|
|
14261
14261
|
if (typeof Blob < "u" && t instanceof Blob)
|
|
14262
14262
|
e = new t2(t);
|
|
14263
14263
|
else if (t instanceof ArrayBuffer || t && t.buffer && t.buffer instanceof ArrayBuffer)
|
|
14264
14264
|
e = new e2(t);
|
|
14265
|
-
else if (
|
|
14265
|
+
else if (e1(t) || e1(t.buffer))
|
|
14266
14266
|
e = new e2(t);
|
|
14267
14267
|
else if (typeof t == "string") {
|
|
14268
14268
|
const n = await fetch(t);
|
|
@@ -14277,16 +14277,16 @@ async function r0(t) {
|
|
|
14277
14277
|
const r = await e.getLength();
|
|
14278
14278
|
if (r > Number.MAX_SAFE_INTEGER)
|
|
14279
14279
|
throw new Error(`file too large. size: ${r}. Only file sizes up 4503599627370496 bytes are supported`);
|
|
14280
|
-
return await
|
|
14280
|
+
return await G5(e, r);
|
|
14281
14281
|
}
|
|
14282
|
-
async function
|
|
14283
|
-
const { zip: e, entries: r } = await
|
|
14282
|
+
async function t0(t) {
|
|
14283
|
+
const { zip: e, entries: r } = await e0(t);
|
|
14284
14284
|
return {
|
|
14285
14285
|
zip: e,
|
|
14286
14286
|
entries: Object.fromEntries(r.map((n) => [n.name, n]))
|
|
14287
14287
|
};
|
|
14288
14288
|
}
|
|
14289
|
-
class
|
|
14289
|
+
class r0 {
|
|
14290
14290
|
blob;
|
|
14291
14291
|
constructor(e) {
|
|
14292
14292
|
this.blob = e;
|
|
@@ -14299,7 +14299,7 @@ class i0 {
|
|
|
14299
14299
|
return new Uint8Array(await n.arrayBuffer());
|
|
14300
14300
|
}
|
|
14301
14301
|
}
|
|
14302
|
-
class
|
|
14302
|
+
class n0 {
|
|
14303
14303
|
url;
|
|
14304
14304
|
length;
|
|
14305
14305
|
#e;
|
|
@@ -14324,10 +14324,10 @@ class s0 {
|
|
|
14324
14324
|
return O1(n.ok, `failed http request ${this.url}, status: ${n.status} offset: ${e} size: ${r}: ${n.statusText}`), new Uint8Array(await n.arrayBuffer());
|
|
14325
14325
|
}
|
|
14326
14326
|
}
|
|
14327
|
-
class
|
|
14327
|
+
class f1 {
|
|
14328
14328
|
info;
|
|
14329
14329
|
constructor(e, r = {}) {
|
|
14330
|
-
this.info =
|
|
14330
|
+
this.info = t0(e).then((n) => (r.transformEntries && (n.entries = r.transformEntries(n.entries)), n));
|
|
14331
14331
|
}
|
|
14332
14332
|
async get(e) {
|
|
14333
14333
|
let r = (await this.info).entries[C1(e)];
|
|
@@ -14338,18 +14338,18 @@ class u1 {
|
|
|
14338
14338
|
return C1(e) in (await this.info).entries;
|
|
14339
14339
|
}
|
|
14340
14340
|
static fromUrl(e, r = {}) {
|
|
14341
|
-
return new
|
|
14341
|
+
return new f1(new n0(e, r), r);
|
|
14342
14342
|
}
|
|
14343
14343
|
static fromBlob(e, r = {}) {
|
|
14344
|
-
return new
|
|
14344
|
+
return new f1(new r0(e), r);
|
|
14345
14345
|
}
|
|
14346
14346
|
}
|
|
14347
|
-
class F extends
|
|
14347
|
+
class F extends G.TileSource {
|
|
14348
14348
|
static DUMMY_XHR = new XMLHttpRequest();
|
|
14349
|
-
// properties inherited from/required by TileSource
|
|
14349
|
+
// properties inherited from/required by OpenSeadragon.TileSource
|
|
14350
14350
|
url;
|
|
14351
14351
|
aspectRatio = 1;
|
|
14352
|
-
dimensions = new
|
|
14352
|
+
dimensions = new G.Point(10, 10);
|
|
14353
14353
|
maxLevel = 0;
|
|
14354
14354
|
ready = !1;
|
|
14355
14355
|
zip;
|
|
@@ -14386,7 +14386,7 @@ class F extends L2 {
|
|
|
14386
14386
|
}
|
|
14387
14387
|
getImageInfo(e) {
|
|
14388
14388
|
console.debug(`getting image info for ${e}`);
|
|
14389
|
-
const r = this.zip || this.zip === void 0 && e.endsWith(".ozx") ?
|
|
14389
|
+
const r = this.zip || this.zip === void 0 && e.endsWith(".ozx") ? f1.fromUrl(e) : new T2(e);
|
|
14390
14390
|
O(r, { kind: "group" }).then(async (n) => {
|
|
14391
14391
|
console.debug(`opened group for ${e}: ${n}`);
|
|
14392
14392
|
const { multiscale: i, omero: s } = F._getMultiscale(n), a = F._getAxisIndices(i), o = await Promise.all(
|
|
@@ -14396,9 +14396,9 @@ class F extends L2 {
|
|
|
14396
14396
|
);
|
|
14397
14397
|
console.debug(`opened ${o.length} arrays for ${e}`);
|
|
14398
14398
|
const c = o[0].shape[a.x], f = o[0].shape[a.y];
|
|
14399
|
-
this._omero = s, this._multiscale = i, this._axisIndices = a, this._arrays = o, this.aspectRatio = c / f, this.dimensions = new
|
|
14399
|
+
this._omero = s, this._multiscale = i, this._axisIndices = a, this._arrays = o, this.aspectRatio = c / f, this.dimensions = new G.Point(c, f), this.maxLevel = o.length - 1, this.ready = !0, console.debug(`ready for ${e}`), this.raiseEvent("ready", { tileSource: this });
|
|
14400
14400
|
}).catch((n) => {
|
|
14401
|
-
this._omero = void 0, this._multiscale = void 0, this._axisIndices = void 0, this._arrays = void 0, this.aspectRatio = 1, this.dimensions = new
|
|
14401
|
+
this._omero = void 0, this._multiscale = void 0, this._axisIndices = void 0, this._arrays = void 0, this.aspectRatio = 1, this.dimensions = new G.Point(10, 10), this.maxLevel = 0, this.ready = !1;
|
|
14402
14402
|
const i = `failed to get image info for ${e}: ${n}`;
|
|
14403
14403
|
console.error(i), this.raiseEvent("open-failed", { message: i, source: e });
|
|
14404
14404
|
});
|
|
@@ -14437,7 +14437,7 @@ class F extends L2 {
|
|
|
14437
14437
|
const r = new AbortController();
|
|
14438
14438
|
e.userData.abortController = r;
|
|
14439
14439
|
const n = new URLSearchParams(
|
|
14440
|
-
// @ts-ignore ImageJob.src
|
|
14440
|
+
// @ts-ignore OpenSeadragon.ImageJob.src
|
|
14441
14441
|
e.src
|
|
14442
14442
|
), i = +n.get("level"), s = +n.get("x"), a = +n.get("y");
|
|
14443
14443
|
try {
|
|
@@ -14447,7 +14447,7 @@ class F extends L2 {
|
|
|
14447
14447
|
`downloading tile for level=${i}, x=${s}, y=${a} from dataset ${this.maxLevel - i}`
|
|
14448
14448
|
);
|
|
14449
14449
|
const o = this.getTileWidth(i), c = this.getTileHeight(i), f = this._arrays[this.maxLevel - i], l = f.shape[this._axisIndices.x], h = f.shape[this._axisIndices.y];
|
|
14450
|
-
|
|
14450
|
+
A5(f, this._multiscale.axes, this._omero, {
|
|
14451
14451
|
x: [s * o, Math.min((s + 1) * o, l)],
|
|
14452
14452
|
y: [a * c, Math.min((a + 1) * c, h)],
|
|
14453
14453
|
z: this.z,
|
|
@@ -14480,7 +14480,7 @@ class F extends L2 {
|
|
|
14480
14480
|
downloadTileAbort(e) {
|
|
14481
14481
|
e.userData.abortController !== void 0 && (e.userData.abortController.abort(), e.userData.abortController = void 0), e.userData.img !== void 0 && (e.userData.img.src = "", e.userData.img = void 0);
|
|
14482
14482
|
}
|
|
14483
|
-
static enable(e =
|
|
14483
|
+
static enable(e = G) {
|
|
14484
14484
|
e.OMEZarrTileSource = F;
|
|
14485
14485
|
}
|
|
14486
14486
|
// TODO https://github.com/BioNGFF/ome-zarr.js/pull/27
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omezarr-tilesource",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "An OpenSeadragon tile source for the OME-Zarr bioimage file format",
|
|
5
5
|
"homepage": "https://github.com/TissUUmaps/OMEZarrTileSource#readme",
|
|
6
6
|
"bugs": "https://github.com/TissUUmaps/OMEZarrTileSource/issues",
|