@vitessce/zarr 3.3.5 → 3.3.7

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 (36) hide show
  1. package/dist/blosc-537fd004.js +891 -0
  2. package/dist/browser-122c4c35.js +786 -0
  3. package/dist/chunk-INHXZS53-bee20a28.js +19 -0
  4. package/dist/{deflate-a5b3ac82.js → deflate-2f7f502f.js} +1 -1
  5. package/dist/gzip-6a24f0fe.js +30 -0
  6. package/dist/{index-64325dc0.js → index-200d5108.js} +1164 -99
  7. package/dist/index.js +8 -7
  8. package/dist/{jpeg-d7680a9e.js → jpeg-3ff942a5.js} +1 -1
  9. package/dist/{lerc-e1ef6468.js → lerc-762cc666.js} +1 -1
  10. package/dist/lz4-bbd18009.js +808 -0
  11. package/dist/{lzw-b8d50e5c.js → lzw-97464fce.js} +1 -1
  12. package/dist/{packbits-d21ec38d.js → packbits-daaf8f04.js} +1 -1
  13. package/dist/{raw-bc2c5642.js → raw-8fdba750.js} +1 -1
  14. package/dist/{webimage-71c5dd88.js → webimage-e98ea52f.js} +1 -1
  15. package/dist/zlib-175cd38d.js +30 -0
  16. package/dist/zstd-ec5a40b8.js +808 -0
  17. package/dist-tsc/ZarrDataSource.d.ts +2 -1
  18. package/dist-tsc/ZarrDataSource.d.ts.map +1 -1
  19. package/dist-tsc/ZarrDataSource.js +2 -2
  20. package/dist-tsc/anndata-loaders/SampleEdgesAnndataLoader.d.ts +13 -0
  21. package/dist-tsc/anndata-loaders/SampleEdgesAnndataLoader.d.ts.map +1 -0
  22. package/dist-tsc/anndata-loaders/SampleEdgesAnndataLoader.js +34 -0
  23. package/dist-tsc/anndata-loaders/index.d.ts +1 -0
  24. package/dist-tsc/anndata-loaders/index.js +1 -0
  25. package/dist-tsc/spatialdata-loaders/SpatialDataLabelsLoader.js +1 -1
  26. package/package.json +11 -11
  27. package/src/ZarrDataSource.js +2 -2
  28. package/src/anndata-loaders/SampleEdgesAnndataLoader.js +42 -0
  29. package/src/anndata-loaders/index.js +1 -0
  30. package/src/spatialdata-loaders/SpatialDataLabelsLoader.js +1 -1
  31. package/dist/blosc-0acfcf7e.js +0 -975
  32. package/dist/gzip-dd5ab7c8.js +0 -28
  33. package/dist/lz4-abb4416a.js +0 -919
  34. package/dist/pako.esm-856454b6-c5c8cd15.js +0 -4066
  35. package/dist/zlib-cd823c38.js +0 -28
  36. package/dist/zstd-4072ca78.js +0 -919
@@ -26,7 +26,7 @@ var __privateMethod = (obj, member, method) => {
26
26
  __accessCheck(obj, member, "access private method");
27
27
  return method;
28
28
  };
29
- var _bytes, _encoder, _encode_buffer, _strides, _TypedArray, _BYTES_PER_ELEMENT, _shape, _endian, _shape2, _strides2, _metadata, _metadata2, _a2, _b, _overrides, _use_suffix_request, _merge_init, merge_init_fn;
29
+ var _bytes, _encoder, _data, _encode_buffer, _strides, _TypedArray, _BYTES_PER_ELEMENT, _shape, _endian, _shape2, _strides2, _encoder_config, _decoder_config, _metadata, _metadata2, _a2, _b, _overrides, _use_suffix_request, _merge_init, merge_init_fn, _overrides2;
30
30
  import { AbstractTwoStepLoader, LoaderResult, AbstractLoaderError } from "@vitessce/vit-s";
31
31
  import "react";
32
32
  function _mergeNamespaces(n3, m) {
@@ -49,14 +49,14 @@ function _mergeNamespaces(n3, m) {
49
49
  return Object.freeze(Object.defineProperty(n3, Symbol.toStringTag, { value: "Module" }));
50
50
  }
51
51
  class NodeNotFoundError extends Error {
52
- constructor(msg) {
53
- super(msg);
52
+ constructor(context, options = {}) {
53
+ super(`Node not found: ${context}`, options);
54
54
  this.name = "NodeNotFoundError";
55
55
  }
56
56
  }
57
57
  class KeyError extends Error {
58
- constructor(msg) {
59
- super(msg);
58
+ constructor(path) {
59
+ super(`Missing key: ${path}`);
60
60
  this.name = "KeyError";
61
61
  }
62
62
  }
@@ -167,56 +167,56 @@ class ByteStringArray {
167
167
  _encoder = new WeakMap();
168
168
  const _UnicodeStringArray = class {
169
169
  constructor(chars, x2, byteOffset, length2) {
170
- __publicField(this, "_data");
170
+ __privateAdd(this, _data, void 0);
171
171
  __publicField(this, "chars");
172
172
  __privateAdd(this, _encode_buffer, void 0);
173
173
  this.chars = chars;
174
174
  if (typeof x2 === "number") {
175
- this._data = new Int32Array(x2 * chars);
175
+ __privateSet(this, _data, new Int32Array(x2 * chars));
176
176
  } else if (x2 instanceof ArrayBuffer) {
177
177
  if (length2)
178
178
  length2 *= chars;
179
- this._data = new Int32Array(x2, byteOffset, length2);
179
+ __privateSet(this, _data, new Int32Array(x2, byteOffset, length2));
180
180
  } else {
181
181
  const values = x2;
182
182
  const d = new _UnicodeStringArray(chars, 1);
183
- this._data = new Int32Array(function* () {
183
+ __privateSet(this, _data, new Int32Array(function* () {
184
184
  for (let str of values) {
185
185
  d.set(0, str);
186
- yield* d._data;
186
+ yield* __privateGet(d, _data);
187
187
  }
188
- }());
188
+ }()));
189
189
  }
190
190
  __privateSet(this, _encode_buffer, new Int32Array(chars));
191
191
  }
192
192
  get BYTES_PER_ELEMENT() {
193
- return this._data.BYTES_PER_ELEMENT * this.chars;
193
+ return __privateGet(this, _data).BYTES_PER_ELEMENT * this.chars;
194
194
  }
195
195
  get byteLength() {
196
- return this._data.byteLength;
196
+ return __privateGet(this, _data).byteLength;
197
197
  }
198
198
  get byteOffset() {
199
- return this._data.byteOffset;
199
+ return __privateGet(this, _data).byteOffset;
200
200
  }
201
201
  /** @type {ArrayBuffer} */
202
202
  get buffer() {
203
- return this._data.buffer;
203
+ return __privateGet(this, _data).buffer;
204
204
  }
205
205
  /** @type {number} */
206
206
  get length() {
207
- return this._data.length / this.chars;
207
+ return __privateGet(this, _data).length / this.chars;
208
208
  }
209
209
  get(idx) {
210
210
  const offset = this.chars * idx;
211
211
  let result = "";
212
212
  for (let i2 = 0; i2 < this.chars; i2++) {
213
- result += String.fromCodePoint(this._data[offset + i2]);
213
+ result += String.fromCodePoint(__privateGet(this, _data)[offset + i2]);
214
214
  }
215
215
  return result.replace(/\u0000/g, "");
216
216
  }
217
217
  set(idx, value) {
218
218
  const offset = this.chars * idx;
219
- const view = this._data.subarray(offset, offset + this.chars);
219
+ const view = __privateGet(this, _data).subarray(offset, offset + this.chars);
220
220
  view.fill(0);
221
221
  for (let i2 = 0; i2 < this.chars; i2++) {
222
222
  view[i2] = value.codePointAt(i2) ?? 0;
@@ -224,9 +224,9 @@ const _UnicodeStringArray = class {
224
224
  }
225
225
  fill(value) {
226
226
  this.set(0, value);
227
- let encoded = this._data.subarray(0, this.chars);
227
+ let encoded = __privateGet(this, _data).subarray(0, this.chars);
228
228
  for (let i2 = 1; i2 < this.length; i2++) {
229
- this._data.set(encoded, i2 * this.chars);
229
+ __privateGet(this, _data).set(encoded, i2 * this.chars);
230
230
  }
231
231
  }
232
232
  *[Symbol.iterator]() {
@@ -236,6 +236,7 @@ const _UnicodeStringArray = class {
236
236
  }
237
237
  };
238
238
  let UnicodeStringArray = _UnicodeStringArray;
239
+ _data = new WeakMap();
239
240
  _encode_buffer = new WeakMap();
240
241
  function json_decode_object(bytes) {
241
242
  const str = new TextDecoder().decode(bytes);
@@ -601,8 +602,115 @@ const _VLenUTF8 = class {
601
602
  let VLenUTF8 = _VLenUTF8;
602
603
  _shape2 = new WeakMap();
603
604
  _strides2 = new WeakMap();
605
+ function throw_on_nan_replacer(_key, value) {
606
+ if (value !== value) {
607
+ throw new Error("JsonCodec allow_nan is false but NaN was encountered during encoding.");
608
+ }
609
+ if (value === Infinity) {
610
+ throw new Error("JsonCodec allow_nan is false but Infinity was encountered during encoding.");
611
+ }
612
+ if (value === -Infinity) {
613
+ throw new Error("JsonCodec allow_nan is false but -Infinity was encountered during encoding.");
614
+ }
615
+ return value;
616
+ }
617
+ function sort_keys_replacer(_key, value) {
618
+ return value instanceof Object && !(value instanceof Array) ? Object.keys(value).sort().reduce((sorted, key) => {
619
+ sorted[key] = value[key];
620
+ return sorted;
621
+ }, {}) : value;
622
+ }
623
+ const _JsonCodec = class {
624
+ constructor(configuration) {
625
+ __publicField(this, "configuration");
626
+ __publicField(this, "kind", "array_to_bytes");
627
+ __privateAdd(this, _encoder_config, void 0);
628
+ __privateAdd(this, _decoder_config, void 0);
629
+ this.configuration = configuration;
630
+ const { encoding = "utf-8", skipkeys = false, ensure_ascii = true, check_circular = true, allow_nan = true, sort_keys = true, indent, strict = true } = configuration;
631
+ let separators = configuration.separators;
632
+ if (!separators) {
633
+ if (!indent) {
634
+ separators = [",", ":"];
635
+ } else {
636
+ separators = [", ", ": "];
637
+ }
638
+ }
639
+ __privateSet(this, _encoder_config, {
640
+ encoding,
641
+ skipkeys,
642
+ ensure_ascii,
643
+ check_circular,
644
+ allow_nan,
645
+ indent,
646
+ separators,
647
+ sort_keys
648
+ });
649
+ __privateSet(this, _decoder_config, { strict });
650
+ }
651
+ static fromConfig(configuration) {
652
+ return new _JsonCodec(configuration);
653
+ }
654
+ encode(buf) {
655
+ const { indent, encoding, ensure_ascii, check_circular, allow_nan, sort_keys } = __privateGet(this, _encoder_config);
656
+ if (encoding !== "utf-8") {
657
+ throw new Error("JsonCodec does not yet support non-utf-8 encoding.");
658
+ }
659
+ const replacer_functions = [];
660
+ if (!check_circular) {
661
+ throw new Error("JsonCodec does not yet support skipping the check for circular references during encoding.");
662
+ }
663
+ if (!allow_nan) {
664
+ replacer_functions.push(throw_on_nan_replacer);
665
+ }
666
+ if (sort_keys) {
667
+ replacer_functions.push(sort_keys_replacer);
668
+ }
669
+ const items = Array.from(buf.data);
670
+ items.push("|O");
671
+ items.push(buf.shape);
672
+ let replacer = void 0;
673
+ if (replacer_functions.length) {
674
+ replacer = function(key, value) {
675
+ let new_value = value;
676
+ replacer_functions.forEach((sub_replacer) => {
677
+ new_value = sub_replacer(key, new_value);
678
+ });
679
+ return new_value;
680
+ };
681
+ }
682
+ let json_str = JSON.stringify(items, replacer, indent);
683
+ if (ensure_ascii) {
684
+ json_str = json_str.replace(/[\u007F-\uFFFF]/g, function(chr) {
685
+ const full_str = "0000" + chr.charCodeAt(0).toString(16);
686
+ const sub_str = full_str.substring(full_str.length - 4);
687
+ return "\\u" + sub_str;
688
+ });
689
+ }
690
+ return new TextEncoder().encode(json_str);
691
+ }
692
+ decode(bytes) {
693
+ const { strict } = __privateGet(this, _decoder_config);
694
+ if (!strict) {
695
+ throw new Error("JsonCodec does not yet support non-strict decoding.");
696
+ }
697
+ const items = json_decode_object(bytes);
698
+ const shape = items.pop();
699
+ items.pop();
700
+ if (!shape) {
701
+ throw new Error("0D not implemented for JsonCodec.");
702
+ } else {
703
+ const stride = get_strides(shape, "C");
704
+ const data = items;
705
+ return { data, shape, stride };
706
+ }
707
+ }
708
+ };
709
+ let JsonCodec = _JsonCodec;
710
+ _encoder_config = new WeakMap();
711
+ _decoder_config = new WeakMap();
604
712
  function create_default_registry() {
605
- return (/* @__PURE__ */ new Map()).set("blosc", () => import("./blosc-0acfcf7e.js").then((m) => m.default)).set("gzip", () => import("./gzip-dd5ab7c8.js").then((m) => m.default)).set("lz4", () => import("./lz4-abb4416a.js").then((m) => m.default)).set("zlib", () => import("./zlib-cd823c38.js").then((m) => m.default)).set("zstd", () => import("./zstd-4072ca78.js").then((m) => m.default)).set("transpose", () => TransposeCodec).set("bytes", () => BytesCodec).set("crc32c", () => Crc32cCodec).set("vlen-utf8", () => VLenUTF8);
713
+ return (/* @__PURE__ */ new Map()).set("blosc", () => import("./blosc-537fd004.js").then((m) => m.default)).set("gzip", () => import("./gzip-6a24f0fe.js").then((m) => m.default)).set("lz4", () => import("./lz4-bbd18009.js").then((m) => m.default)).set("zlib", () => import("./zlib-175cd38d.js").then((m) => m.default)).set("zstd", () => import("./zstd-ec5a40b8.js").then((m) => m.default)).set("transpose", () => TransposeCodec).set("bytes", () => BytesCodec).set("crc32c", () => Crc32cCodec).set("vlen-utf8", () => VLenUTF8).set("json2", () => JsonCodec);
606
714
  }
607
715
  const registry$2 = create_default_registry();
608
716
  function create_codec_pipeline(chunk_metadata) {
@@ -848,6 +956,7 @@ let Array$1 = (_b = class extends Location {
848
956
  return is_dtype(this.dtype, query);
849
957
  }
850
958
  }, _a2 = CONTEXT_MARKER, _metadata2 = new WeakMap(), _b);
959
+ let VERSION_COUNTER = create_version_counter();
851
960
  function create_version_counter() {
852
961
  let version_counts = /* @__PURE__ */ new WeakMap();
853
962
  function get_counts(store) {
@@ -865,7 +974,6 @@ function create_version_counter() {
865
974
  }
866
975
  };
867
976
  }
868
- let VERSION_COUNTER = create_version_counter();
869
977
  async function load_attrs(location) {
870
978
  let meta_bytes = await location.store.get(location.resolve(".zattrs").path);
871
979
  if (!meta_bytes)
@@ -891,7 +999,9 @@ async function open_array_v2(location, attrs) {
891
999
  let { path } = location.resolve(".zarray");
892
1000
  let meta2 = await location.store.get(path);
893
1001
  if (!meta2) {
894
- throw new NodeNotFoundError(path);
1002
+ throw new NodeNotFoundError("v2 array", {
1003
+ cause: new KeyError(path)
1004
+ });
895
1005
  }
896
1006
  VERSION_COUNTER.increment(location.store, "v2");
897
1007
  return new Array$1(location.store, location.path, v2_to_v3_array_metadata(json_decode_object(meta2), attrs));
@@ -900,7 +1010,9 @@ async function open_group_v2(location, attrs) {
900
1010
  let { path } = location.resolve(".zgroup");
901
1011
  let meta2 = await location.store.get(path);
902
1012
  if (!meta2) {
903
- throw new NodeNotFoundError(path);
1013
+ throw new NodeNotFoundError("v2 group", {
1014
+ cause: new KeyError(path)
1015
+ });
904
1016
  }
905
1017
  VERSION_COUNTER.increment(location.store, "v2");
906
1018
  return new Group(location.store, location.path, v2_to_v3_group_metadata(json_decode_object(meta2), attrs));
@@ -909,7 +1021,9 @@ async function _open_v3(location) {
909
1021
  let { store, path } = location.resolve("zarr.json");
910
1022
  let meta2 = await location.store.get(path);
911
1023
  if (!meta2) {
912
- throw new NodeNotFoundError(path);
1024
+ throw new NodeNotFoundError("v3 array or group", {
1025
+ cause: new KeyError(path)
1026
+ });
913
1027
  }
914
1028
  let meta_doc = json_decode_object(meta2);
915
1029
  if (meta_doc.node_type === "array" && (meta_doc.data_type === "uint64" || meta_doc.data_type === "int64") && meta_doc.fill_value != void 0) {
@@ -931,8 +1045,8 @@ async function open_v3(location, options = {}) {
931
1045
  throw new Error(`Expected node of kind ${options.kind}, found ${kind}.`);
932
1046
  }
933
1047
  async function open(location, options = {}) {
934
- const store = "store" in location ? location.store : location;
935
- const version_max = VERSION_COUNTER.version_max(store);
1048
+ let store = "store" in location ? location.store : location;
1049
+ let version_max = VERSION_COUNTER.version_max(store);
936
1050
  let open_primary = version_max === "v2" ? open.v2 : open.v3;
937
1051
  let open_secondary = version_max === "v2" ? open.v3 : open.v2;
938
1052
  return open_primary(location, options).catch((err2) => {
@@ -976,7 +1090,7 @@ function* product$1(...iterables) {
976
1090
  results[i2] = iterators[i2].next();
977
1091
  }
978
1092
  }
979
- function slice_indices(start, stop, step, length2) {
1093
+ function slice_indices({ start, stop, step }, length2) {
980
1094
  if (step === 0) {
981
1095
  throw new Error("slice step cannot be zero");
982
1096
  }
@@ -1017,10 +1131,7 @@ function slice$3(start, stop, step = null) {
1017
1131
  return {
1018
1132
  start,
1019
1133
  stop,
1020
- step,
1021
- indices(length2) {
1022
- return slice_indices(this.start, this.stop, this.step, length2);
1023
- }
1134
+ step
1024
1135
  };
1025
1136
  }
1026
1137
  function create_queue() {
@@ -1088,7 +1199,7 @@ class SliceDimIndexer {
1088
1199
  __publicField(this, "dim_chunk_len");
1089
1200
  __publicField(this, "nitems");
1090
1201
  __publicField(this, "nchunks");
1091
- const [start, stop, step] = dim_sel.indices(dim_len);
1202
+ const [start, stop, step] = slice_indices(dim_sel, dim_len);
1092
1203
  this.start = start;
1093
1204
  this.stop = stop;
1094
1205
  this.step = step;
@@ -1174,25 +1285,20 @@ function unwrap(arr, idx) {
1174
1285
  }
1175
1286
  async function get$2(arr, selection, opts2, setter2) {
1176
1287
  var _a3;
1177
- const context = get_context(arr);
1178
- const indexer = new BasicIndexer({
1288
+ let context = get_context(arr);
1289
+ let indexer = new BasicIndexer({
1179
1290
  selection,
1180
1291
  shape: arr.shape,
1181
1292
  chunk_shape: arr.chunks
1182
1293
  });
1183
- const out = setter2.prepare(new context.TypedArray(indexer.shape.reduce((a2, b) => a2 * b, 1)), indexer.shape, context.get_strides(indexer.shape, opts2.order));
1184
- const queue = ((_a3 = opts2.create_queue) == null ? void 0 : _a3.call(opts2)) ?? create_queue();
1294
+ let out = setter2.prepare(new context.TypedArray(indexer.shape.reduce((a2, b) => a2 * b, 1)), indexer.shape, context.get_strides(indexer.shape, opts2.order));
1295
+ let queue = ((_a3 = opts2.create_queue) == null ? void 0 : _a3.call(opts2)) ?? create_queue();
1185
1296
  for (const { chunk_coords, mapping } of indexer) {
1186
- queue.add(() => arr.getChunk(chunk_coords, opts2.opts).then(({ data, shape, stride }) => {
1187
- const chunk = setter2.prepare(data, shape, stride);
1297
+ queue.add(async () => {
1298
+ let { data, shape, stride } = await arr.getChunk(chunk_coords, opts2.opts);
1299
+ let chunk = setter2.prepare(data, shape, stride);
1188
1300
  setter2.set_from_chunk(out, chunk, mapping);
1189
- }).catch((err2) => {
1190
- if (!(err2 instanceof KeyError))
1191
- throw err2;
1192
- if (context.fill_value) {
1193
- setter2.set_scalar(out, mapping.map((m) => m.to).filter((s2) => s2 !== null), context.fill_value);
1194
- }
1195
- }));
1301
+ });
1196
1302
  }
1197
1303
  await queue.onIdle();
1198
1304
  return indexer.shape.length === 0 ? unwrap(out.data, 0) : out;
@@ -1345,6 +1451,9 @@ function set_from_chunk_binary(dest, src2, bytes_per_element2, projections) {
1345
1451
  }, bytes_per_element2, projs);
1346
1452
  }
1347
1453
  }
1454
+ function strip_prefix(path) {
1455
+ return path.slice(1);
1456
+ }
1348
1457
  function fetch_range(url, offset, length2, opts2 = {}) {
1349
1458
  if (offset !== void 0 && length2 !== void 0) {
1350
1459
  opts2 = {
@@ -1357,6 +1466,16 @@ function fetch_range(url, offset, length2, opts2 = {}) {
1357
1466
  }
1358
1467
  return fetch(url, opts2);
1359
1468
  }
1469
+ function merge_init(storeOverrides, requestOverrides) {
1470
+ return {
1471
+ ...storeOverrides,
1472
+ ...requestOverrides,
1473
+ headers: {
1474
+ ...storeOverrides.headers,
1475
+ ...requestOverrides.headers
1476
+ }
1477
+ };
1478
+ }
1360
1479
  function resolve(root2, path) {
1361
1480
  const base = typeof root2 === "string" ? new URL(root2) : root2;
1362
1481
  if (!base.pathname.endsWith("/")) {
@@ -1421,14 +1540,7 @@ _overrides = new WeakMap();
1421
1540
  _use_suffix_request = new WeakMap();
1422
1541
  _merge_init = new WeakSet();
1423
1542
  merge_init_fn = function(overrides) {
1424
- return {
1425
- ...__privateGet(this, _overrides),
1426
- ...overrides,
1427
- headers: {
1428
- ...__privateGet(this, _overrides).headers,
1429
- ...overrides.headers
1430
- }
1431
- };
1543
+ return merge_init(__privateGet(this, _overrides), overrides);
1432
1544
  };
1433
1545
  const FetchStore$1 = FetchStore;
1434
1546
  function getV2DataType(dtype) {
@@ -1470,16 +1582,909 @@ function createZarrArrayAdapter(arr) {
1470
1582
  }
1471
1583
  });
1472
1584
  }
1473
- function zarrOpenRoot(url, requestInit2) {
1474
- const store = new FetchStore$1(url, { overrides: requestInit2 });
1585
+ const fs$q = {};
1586
+ const node = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1587
+ __proto__: null,
1588
+ default: fs$q
1589
+ }, Symbol.toStringTag, { value: "Module" }));
1590
+ function readBlobAsArrayBuffer(blob) {
1591
+ if (blob.arrayBuffer) {
1592
+ return blob.arrayBuffer();
1593
+ }
1594
+ return new Promise((resolve2, reject) => {
1595
+ const reader = new FileReader();
1596
+ reader.addEventListener("loadend", () => {
1597
+ resolve2(reader.result);
1598
+ });
1599
+ reader.addEventListener("error", reject);
1600
+ reader.readAsArrayBuffer(blob);
1601
+ });
1602
+ }
1603
+ async function readBlobAsUint8Array(blob) {
1604
+ const arrayBuffer2 = await readBlobAsArrayBuffer(blob);
1605
+ return new Uint8Array(arrayBuffer2);
1606
+ }
1607
+ function isBlob$1(v) {
1608
+ return typeof Blob !== "undefined" && v instanceof Blob;
1609
+ }
1610
+ function isSharedArrayBuffer(b) {
1611
+ return typeof SharedArrayBuffer !== "undefined" && b instanceof SharedArrayBuffer;
1612
+ }
1613
+ const isNode$1 = typeof process !== "undefined" && process.versions && typeof process.versions.node !== "undefined" && typeof process.versions.electron === "undefined";
1614
+ function isTypedArraySameAsArrayBuffer(typedArray) {
1615
+ return typedArray.byteOffset === 0 && typedArray.byteLength === typedArray.buffer.byteLength;
1616
+ }
1617
+ class ArrayBufferReader {
1618
+ constructor(arrayBufferOrView) {
1619
+ this.typedArray = arrayBufferOrView instanceof ArrayBuffer || isSharedArrayBuffer(arrayBufferOrView) ? new Uint8Array(arrayBufferOrView) : new Uint8Array(arrayBufferOrView.buffer, arrayBufferOrView.byteOffset, arrayBufferOrView.byteLength);
1620
+ }
1621
+ async getLength() {
1622
+ return this.typedArray.byteLength;
1623
+ }
1624
+ async read(offset, length2) {
1625
+ return new Uint8Array(this.typedArray.buffer, this.typedArray.byteOffset + offset, length2);
1626
+ }
1627
+ }
1628
+ let BlobReader$1 = class BlobReader {
1629
+ constructor(blob) {
1630
+ this.blob = blob;
1631
+ }
1632
+ async getLength() {
1633
+ return this.blob.size;
1634
+ }
1635
+ async read(offset, length2) {
1636
+ const blob = this.blob.slice(offset, offset + length2);
1637
+ const arrayBuffer2 = await readBlobAsArrayBuffer(blob);
1638
+ return new Uint8Array(arrayBuffer2);
1639
+ }
1640
+ async sliceAsBlob(offset, length2, type = "") {
1641
+ return this.blob.slice(offset, offset + length2, type);
1642
+ }
1643
+ };
1644
+ function inflate$3(data, buf) {
1645
+ var u8 = Uint8Array;
1646
+ if (data[0] == 3 && data[1] == 0)
1647
+ return buf ? buf : new u8(0);
1648
+ var bitsF = _bitsF, bitsE = _bitsE, decodeTiny = _decodeTiny, get17 = _get17;
1649
+ var noBuf = buf == null;
1650
+ if (noBuf)
1651
+ buf = new u8(data.length >>> 2 << 3);
1652
+ var BFINAL = 0, BTYPE = 0, HLIT = 0, HDIST = 0, HCLEN = 0, ML = 0, MD = 0;
1653
+ var off = 0, pos = 0;
1654
+ var lmap, dmap;
1655
+ while (BFINAL == 0) {
1656
+ BFINAL = bitsF(data, pos, 1);
1657
+ BTYPE = bitsF(data, pos + 1, 2);
1658
+ pos += 3;
1659
+ if (BTYPE == 0) {
1660
+ if ((pos & 7) != 0)
1661
+ pos += 8 - (pos & 7);
1662
+ var p8 = (pos >>> 3) + 4, len2 = data[p8 - 4] | data[p8 - 3] << 8;
1663
+ if (noBuf)
1664
+ buf = _check(buf, off + len2);
1665
+ buf.set(new u8(data.buffer, data.byteOffset + p8, len2), off);
1666
+ pos = p8 + len2 << 3;
1667
+ off += len2;
1668
+ continue;
1669
+ }
1670
+ if (noBuf)
1671
+ buf = _check(buf, off + (1 << 17));
1672
+ if (BTYPE == 1) {
1673
+ lmap = U.flmap;
1674
+ dmap = U.fdmap;
1675
+ ML = (1 << 9) - 1;
1676
+ MD = (1 << 5) - 1;
1677
+ }
1678
+ if (BTYPE == 2) {
1679
+ HLIT = bitsE(data, pos, 5) + 257;
1680
+ HDIST = bitsE(data, pos + 5, 5) + 1;
1681
+ HCLEN = bitsE(data, pos + 10, 4) + 4;
1682
+ pos += 14;
1683
+ for (var i2 = 0; i2 < 38; i2 += 2) {
1684
+ U.itree[i2] = 0;
1685
+ U.itree[i2 + 1] = 0;
1686
+ }
1687
+ var tl = 1;
1688
+ for (var i2 = 0; i2 < HCLEN; i2++) {
1689
+ var l2 = bitsE(data, pos + i2 * 3, 3);
1690
+ U.itree[(U.ordr[i2] << 1) + 1] = l2;
1691
+ if (l2 > tl)
1692
+ tl = l2;
1693
+ }
1694
+ pos += 3 * HCLEN;
1695
+ makeCodes(U.itree, tl);
1696
+ codes2map(U.itree, tl, U.imap);
1697
+ lmap = U.lmap;
1698
+ dmap = U.dmap;
1699
+ pos = decodeTiny(U.imap, (1 << tl) - 1, HLIT + HDIST, data, pos, U.ttree);
1700
+ var mx0 = _copyOut(U.ttree, 0, HLIT, U.ltree);
1701
+ ML = (1 << mx0) - 1;
1702
+ var mx1 = _copyOut(U.ttree, HLIT, HDIST, U.dtree);
1703
+ MD = (1 << mx1) - 1;
1704
+ makeCodes(U.ltree, mx0);
1705
+ codes2map(U.ltree, mx0, lmap);
1706
+ makeCodes(U.dtree, mx1);
1707
+ codes2map(U.dtree, mx1, dmap);
1708
+ }
1709
+ while (true) {
1710
+ var code = lmap[get17(data, pos) & ML];
1711
+ pos += code & 15;
1712
+ var lit = code >>> 4;
1713
+ if (lit >>> 8 == 0) {
1714
+ buf[off++] = lit;
1715
+ } else if (lit == 256) {
1716
+ break;
1717
+ } else {
1718
+ var end = off + lit - 254;
1719
+ if (lit > 264) {
1720
+ var ebs = U.ldef[lit - 257];
1721
+ end = off + (ebs >>> 3) + bitsE(data, pos, ebs & 7);
1722
+ pos += ebs & 7;
1723
+ }
1724
+ var dcode = dmap[get17(data, pos) & MD];
1725
+ pos += dcode & 15;
1726
+ var dlit = dcode >>> 4;
1727
+ var dbs = U.ddef[dlit], dst = (dbs >>> 4) + bitsF(data, pos, dbs & 15);
1728
+ pos += dbs & 15;
1729
+ if (noBuf)
1730
+ buf = _check(buf, off + (1 << 17));
1731
+ while (off < end) {
1732
+ buf[off] = buf[off++ - dst];
1733
+ buf[off] = buf[off++ - dst];
1734
+ buf[off] = buf[off++ - dst];
1735
+ buf[off] = buf[off++ - dst];
1736
+ }
1737
+ off = end;
1738
+ }
1739
+ }
1740
+ }
1741
+ return buf.length == off ? buf : buf.slice(0, off);
1742
+ }
1743
+ function _check(buf, len2) {
1744
+ var bl = buf.length;
1745
+ if (len2 <= bl)
1746
+ return buf;
1747
+ var nbuf = new Uint8Array(Math.max(bl << 1, len2));
1748
+ nbuf.set(buf, 0);
1749
+ return nbuf;
1750
+ }
1751
+ function _decodeTiny(lmap, LL, len2, data, pos, tree) {
1752
+ var bitsE = _bitsE, get17 = _get17;
1753
+ var i2 = 0;
1754
+ while (i2 < len2) {
1755
+ var code = lmap[get17(data, pos) & LL];
1756
+ pos += code & 15;
1757
+ var lit = code >>> 4;
1758
+ if (lit <= 15) {
1759
+ tree[i2] = lit;
1760
+ i2++;
1761
+ } else {
1762
+ var ll = 0, n3 = 0;
1763
+ if (lit == 16) {
1764
+ n3 = 3 + bitsE(data, pos, 2);
1765
+ pos += 2;
1766
+ ll = tree[i2 - 1];
1767
+ } else if (lit == 17) {
1768
+ n3 = 3 + bitsE(data, pos, 3);
1769
+ pos += 3;
1770
+ } else if (lit == 18) {
1771
+ n3 = 11 + bitsE(data, pos, 7);
1772
+ pos += 7;
1773
+ }
1774
+ var ni = i2 + n3;
1775
+ while (i2 < ni) {
1776
+ tree[i2] = ll;
1777
+ i2++;
1778
+ }
1779
+ }
1780
+ }
1781
+ return pos;
1782
+ }
1783
+ function _copyOut(src2, off, len2, tree) {
1784
+ var mx = 0, i2 = 0, tl = tree.length >>> 1;
1785
+ while (i2 < len2) {
1786
+ var v = src2[i2 + off];
1787
+ tree[i2 << 1] = 0;
1788
+ tree[(i2 << 1) + 1] = v;
1789
+ if (v > mx)
1790
+ mx = v;
1791
+ i2++;
1792
+ }
1793
+ while (i2 < tl) {
1794
+ tree[i2 << 1] = 0;
1795
+ tree[(i2 << 1) + 1] = 0;
1796
+ i2++;
1797
+ }
1798
+ return mx;
1799
+ }
1800
+ function makeCodes(tree, MAX_BITS2) {
1801
+ var max_code = tree.length;
1802
+ var code, bits, n3, i2, len2;
1803
+ var bl_count = U.bl_count;
1804
+ for (var i2 = 0; i2 <= MAX_BITS2; i2++)
1805
+ bl_count[i2] = 0;
1806
+ for (i2 = 1; i2 < max_code; i2 += 2)
1807
+ bl_count[tree[i2]]++;
1808
+ var next_code = U.next_code;
1809
+ code = 0;
1810
+ bl_count[0] = 0;
1811
+ for (bits = 1; bits <= MAX_BITS2; bits++) {
1812
+ code = code + bl_count[bits - 1] << 1;
1813
+ next_code[bits] = code;
1814
+ }
1815
+ for (n3 = 0; n3 < max_code; n3 += 2) {
1816
+ len2 = tree[n3 + 1];
1817
+ if (len2 != 0) {
1818
+ tree[n3] = next_code[len2];
1819
+ next_code[len2]++;
1820
+ }
1821
+ }
1822
+ }
1823
+ function codes2map(tree, MAX_BITS2, map2) {
1824
+ var max_code = tree.length;
1825
+ var r15 = U.rev15;
1826
+ for (var i2 = 0; i2 < max_code; i2 += 2)
1827
+ if (tree[i2 + 1] != 0) {
1828
+ var lit = i2 >> 1;
1829
+ var cl = tree[i2 + 1], val = lit << 4 | cl;
1830
+ var rest = MAX_BITS2 - cl, i0 = tree[i2] << rest, i1 = i0 + (1 << rest);
1831
+ while (i0 != i1) {
1832
+ var p02 = r15[i0] >>> 15 - MAX_BITS2;
1833
+ map2[p02] = val;
1834
+ i0++;
1835
+ }
1836
+ }
1837
+ }
1838
+ function revCodes(tree, MAX_BITS2) {
1839
+ var r15 = U.rev15, imb = 15 - MAX_BITS2;
1840
+ for (var i2 = 0; i2 < tree.length; i2 += 2) {
1841
+ var i0 = tree[i2] << MAX_BITS2 - tree[i2 + 1];
1842
+ tree[i2] = r15[i0] >>> imb;
1843
+ }
1844
+ }
1845
+ function _bitsE(dt, pos, length2) {
1846
+ return (dt[pos >>> 3] | dt[(pos >>> 3) + 1] << 8) >>> (pos & 7) & (1 << length2) - 1;
1847
+ }
1848
+ function _bitsF(dt, pos, length2) {
1849
+ return (dt[pos >>> 3] | dt[(pos >>> 3) + 1] << 8 | dt[(pos >>> 3) + 2] << 16) >>> (pos & 7) & (1 << length2) - 1;
1850
+ }
1851
+ function _get17(dt, pos) {
1852
+ return (dt[pos >>> 3] | dt[(pos >>> 3) + 1] << 8 | dt[(pos >>> 3) + 2] << 16) >>> (pos & 7);
1853
+ }
1854
+ const U = function() {
1855
+ var u16 = Uint16Array, u32 = Uint32Array;
1856
+ return {
1857
+ next_code: new u16(16),
1858
+ bl_count: new u16(16),
1859
+ ordr: [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15],
1860
+ of0: [3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 999, 999, 999],
1861
+ exb: [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 0, 0, 0],
1862
+ ldef: new u16(32),
1863
+ df0: [1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577, 65535, 65535],
1864
+ dxb: [0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 0, 0],
1865
+ ddef: new u32(32),
1866
+ flmap: new u16(512),
1867
+ fltree: [],
1868
+ fdmap: new u16(32),
1869
+ fdtree: [],
1870
+ lmap: new u16(32768),
1871
+ ltree: [],
1872
+ ttree: [],
1873
+ dmap: new u16(32768),
1874
+ dtree: [],
1875
+ imap: new u16(512),
1876
+ itree: [],
1877
+ //rev9 : new u16( 512)
1878
+ rev15: new u16(1 << 15),
1879
+ lhst: new u32(286),
1880
+ dhst: new u32(30),
1881
+ ihst: new u32(19),
1882
+ lits: new u32(15e3),
1883
+ strt: new u16(1 << 16),
1884
+ prev: new u16(1 << 15)
1885
+ };
1886
+ }();
1887
+ (function() {
1888
+ var len2 = 1 << 15;
1889
+ for (var i2 = 0; i2 < len2; i2++) {
1890
+ var x2 = i2;
1891
+ x2 = (x2 & 2863311530) >>> 1 | (x2 & 1431655765) << 1;
1892
+ x2 = (x2 & 3435973836) >>> 2 | (x2 & 858993459) << 2;
1893
+ x2 = (x2 & 4042322160) >>> 4 | (x2 & 252645135) << 4;
1894
+ x2 = (x2 & 4278255360) >>> 8 | (x2 & 16711935) << 8;
1895
+ U.rev15[i2] = (x2 >>> 16 | x2 << 16) >>> 17;
1896
+ }
1897
+ function pushV(tgt, n3, sv) {
1898
+ while (n3-- != 0)
1899
+ tgt.push(0, sv);
1900
+ }
1901
+ for (var i2 = 0; i2 < 32; i2++) {
1902
+ U.ldef[i2] = U.of0[i2] << 3 | U.exb[i2];
1903
+ U.ddef[i2] = U.df0[i2] << 4 | U.dxb[i2];
1904
+ }
1905
+ pushV(U.fltree, 144, 8);
1906
+ pushV(U.fltree, 255 - 143, 9);
1907
+ pushV(U.fltree, 279 - 255, 7);
1908
+ pushV(U.fltree, 287 - 279, 8);
1909
+ makeCodes(U.fltree, 9);
1910
+ codes2map(U.fltree, 9, U.flmap);
1911
+ revCodes(U.fltree, 9);
1912
+ pushV(U.fdtree, 32, 5);
1913
+ makeCodes(U.fdtree, 5);
1914
+ codes2map(U.fdtree, 5, U.fdmap);
1915
+ revCodes(U.fdtree, 5);
1916
+ pushV(U.itree, 19, 0);
1917
+ pushV(U.ltree, 286, 0);
1918
+ pushV(U.dtree, 30, 0);
1919
+ pushV(U.ttree, 320, 0);
1920
+ })();
1921
+ const crc = {
1922
+ table: function() {
1923
+ var tab = new Uint32Array(256);
1924
+ for (var n3 = 0; n3 < 256; n3++) {
1925
+ var c = n3;
1926
+ for (var k = 0; k < 8; k++) {
1927
+ if (c & 1)
1928
+ c = 3988292384 ^ c >>> 1;
1929
+ else
1930
+ c = c >>> 1;
1931
+ }
1932
+ tab[n3] = c;
1933
+ }
1934
+ return tab;
1935
+ }(),
1936
+ update: function(c, buf, off, len2) {
1937
+ for (var i2 = 0; i2 < len2; i2++)
1938
+ c = crc.table[(c ^ buf[off + i2]) & 255] ^ c >>> 8;
1939
+ return c;
1940
+ },
1941
+ crc: function(b, o2, l2) {
1942
+ return crc.update(4294967295, b, o2, l2) ^ 4294967295;
1943
+ }
1944
+ };
1945
+ function inflateRaw$2(file, buf) {
1946
+ return inflate$3(file, buf);
1947
+ }
1948
+ const config$3 = {
1949
+ numWorkers: 1,
1950
+ workerURL: "",
1951
+ useWorkers: false
1952
+ };
1953
+ let nextId = 0;
1954
+ const waitingForWorkerQueue = [];
1955
+ function startWorker(url) {
1956
+ return new Promise((resolve2, reject) => {
1957
+ const worker = new Worker(url);
1958
+ worker.onmessage = (e2) => {
1959
+ if (e2.data === "start") {
1960
+ worker.onerror = void 0;
1961
+ worker.onmessage = void 0;
1962
+ resolve2(worker);
1963
+ } else {
1964
+ reject(new Error(`unexpected message: ${e2.data}`));
1965
+ }
1966
+ };
1967
+ worker.onerror = reject;
1968
+ });
1969
+ }
1970
+ function dynamicRequire(mod2, request) {
1971
+ return mod2.require ? mod2.require(request) : {};
1972
+ }
1973
+ (function() {
1974
+ if (isNode$1) {
1975
+ const { Worker: Worker3 } = dynamicRequire(module, "worker_threads");
1976
+ return {
1977
+ async createWorker(url) {
1978
+ return new Worker3(url);
1979
+ },
1980
+ addEventListener(worker, fn) {
1981
+ worker.on("message", (data) => {
1982
+ fn({ target: worker, data });
1983
+ });
1984
+ },
1985
+ async terminate(worker) {
1986
+ await worker.terminate();
1987
+ }
1988
+ };
1989
+ } else {
1990
+ return {
1991
+ async createWorker(url) {
1992
+ try {
1993
+ const worker = await startWorker(url);
1994
+ return worker;
1995
+ } catch (e2) {
1996
+ console.warn("could not load worker:", url);
1997
+ }
1998
+ let text;
1999
+ try {
2000
+ const req = await fetch(url, { mode: "cors" });
2001
+ if (!req.ok) {
2002
+ throw new Error(`could not load: ${url}`);
2003
+ }
2004
+ text = await req.text();
2005
+ url = URL.createObjectURL(new Blob([text], { type: "application/javascript" }));
2006
+ const worker = await startWorker(url);
2007
+ config$3.workerURL = url;
2008
+ return worker;
2009
+ } catch (e2) {
2010
+ console.warn("could not load worker via fetch:", url);
2011
+ }
2012
+ if (text !== void 0) {
2013
+ try {
2014
+ url = `data:application/javascript;base64,${btoa(text)}`;
2015
+ const worker = await startWorker(url);
2016
+ config$3.workerURL = url;
2017
+ return worker;
2018
+ } catch (e2) {
2019
+ console.warn("could not load worker via dataURI");
2020
+ }
2021
+ }
2022
+ console.warn("workers will not be used");
2023
+ throw new Error("can not start workers");
2024
+ },
2025
+ addEventListener(worker, fn) {
2026
+ worker.addEventListener("message", fn);
2027
+ },
2028
+ async terminate(worker) {
2029
+ worker.terminate();
2030
+ }
2031
+ };
2032
+ }
2033
+ })();
2034
+ function inflateRawLocal(src2, uncompressedSize, type, resolve2) {
2035
+ const dst = new Uint8Array(uncompressedSize);
2036
+ inflateRaw$2(src2, dst);
2037
+ resolve2(type ? new Blob([dst], { type }) : dst.buffer);
2038
+ }
2039
+ async function processWaitingForWorkerQueue() {
2040
+ if (waitingForWorkerQueue.length === 0) {
2041
+ return;
2042
+ }
2043
+ while (waitingForWorkerQueue.length) {
2044
+ const { src: src2, uncompressedSize, type, resolve: resolve2 } = waitingForWorkerQueue.shift();
2045
+ let data = src2;
2046
+ if (isBlob$1(src2)) {
2047
+ data = await readBlobAsUint8Array(src2);
2048
+ }
2049
+ inflateRawLocal(data, uncompressedSize, type, resolve2);
2050
+ }
2051
+ }
2052
+ function inflateRawAsync(src2, uncompressedSize, type) {
2053
+ return new Promise((resolve2, reject) => {
2054
+ waitingForWorkerQueue.push({ src: src2, uncompressedSize, type, resolve: resolve2, reject, id: nextId++ });
2055
+ processWaitingForWorkerQueue();
2056
+ });
2057
+ }
2058
+ function dosDateTimeToDate(date, time) {
2059
+ const day = date & 31;
2060
+ const month = (date >> 5 & 15) - 1;
2061
+ const year = (date >> 9 & 127) + 1980;
2062
+ const millisecond = 0;
2063
+ const second = (time & 31) * 2;
2064
+ const minute = time >> 5 & 63;
2065
+ const hour = time >> 11 & 31;
2066
+ return new Date(year, month, day, hour, minute, second, millisecond);
2067
+ }
2068
+ class ZipEntry {
2069
+ constructor(reader, rawEntry) {
2070
+ this._reader = reader;
2071
+ this._rawEntry = rawEntry;
2072
+ this.name = rawEntry.name;
2073
+ this.nameBytes = rawEntry.nameBytes;
2074
+ this.size = rawEntry.uncompressedSize;
2075
+ this.compressedSize = rawEntry.compressedSize;
2076
+ this.comment = rawEntry.comment;
2077
+ this.commentBytes = rawEntry.commentBytes;
2078
+ this.compressionMethod = rawEntry.compressionMethod;
2079
+ this.lastModDate = dosDateTimeToDate(rawEntry.lastModFileDate, rawEntry.lastModFileTime);
2080
+ this.isDirectory = rawEntry.uncompressedSize === 0 && rawEntry.name.endsWith("/");
2081
+ this.encrypted = !!(rawEntry.generalPurposeBitFlag & 1);
2082
+ this.externalFileAttributes = rawEntry.externalFileAttributes;
2083
+ this.versionMadeBy = rawEntry.versionMadeBy;
2084
+ }
2085
+ // returns a promise that returns a Blob for this entry
2086
+ async blob(type = "application/octet-stream") {
2087
+ return await readEntryDataAsBlob(this._reader, this._rawEntry, type);
2088
+ }
2089
+ // returns a promise that returns an ArrayBuffer for this entry
2090
+ async arrayBuffer() {
2091
+ return await readEntryDataAsArrayBuffer(this._reader, this._rawEntry);
2092
+ }
2093
+ // returns text, assumes the text is valid utf8. If you want more options decode arrayBuffer yourself
2094
+ async text() {
2095
+ const buffer2 = await this.arrayBuffer();
2096
+ return decodeBuffer(new Uint8Array(buffer2));
2097
+ }
2098
+ // returns text with JSON.parse called on it. If you want more options decode arrayBuffer yourself
2099
+ async json() {
2100
+ const text = await this.text();
2101
+ return JSON.parse(text);
2102
+ }
2103
+ }
2104
+ const EOCDR_WITHOUT_COMMENT_SIZE = 22;
2105
+ const MAX_COMMENT_SIZE = 65535;
2106
+ const EOCDR_SIGNATURE = 101010256;
2107
+ const ZIP64_EOCDR_SIGNATURE = 101075792;
2108
+ async function readAs(reader, offset, length2) {
2109
+ return await reader.read(offset, length2);
2110
+ }
2111
+ async function readAsBlobOrTypedArray(reader, offset, length2, type) {
2112
+ if (reader.sliceAsBlob) {
2113
+ return await reader.sliceAsBlob(offset, length2, type);
2114
+ }
2115
+ return await reader.read(offset, length2);
2116
+ }
2117
+ const crc$1 = {
2118
+ unsigned() {
2119
+ return 0;
2120
+ }
2121
+ };
2122
+ function getUint16LE(uint8View, offset) {
2123
+ return uint8View[offset] + uint8View[offset + 1] * 256;
2124
+ }
2125
+ function getUint32LE(uint8View, offset) {
2126
+ return uint8View[offset] + uint8View[offset + 1] * 256 + uint8View[offset + 2] * 65536 + uint8View[offset + 3] * 16777216;
2127
+ }
2128
+ function getUint64LE(uint8View, offset) {
2129
+ return getUint32LE(uint8View, offset) + getUint32LE(uint8View, offset + 4) * 4294967296;
2130
+ }
2131
+ const utf8Decoder = new TextDecoder();
2132
+ function decodeBuffer(uint8View, isUTF8) {
2133
+ if (isSharedArrayBuffer(uint8View.buffer)) {
2134
+ uint8View = new Uint8Array(uint8View);
2135
+ }
2136
+ return utf8Decoder.decode(uint8View);
2137
+ }
2138
+ async function findEndOfCentralDirector(reader, totalLength) {
2139
+ const size2 = Math.min(EOCDR_WITHOUT_COMMENT_SIZE + MAX_COMMENT_SIZE, totalLength);
2140
+ const readStart = totalLength - size2;
2141
+ const data = await readAs(reader, readStart, size2);
2142
+ for (let i2 = size2 - EOCDR_WITHOUT_COMMENT_SIZE; i2 >= 0; --i2) {
2143
+ if (getUint32LE(data, i2) !== EOCDR_SIGNATURE) {
2144
+ continue;
2145
+ }
2146
+ const eocdr = new Uint8Array(data.buffer, data.byteOffset + i2, data.byteLength - i2);
2147
+ const diskNumber = getUint16LE(eocdr, 4);
2148
+ if (diskNumber !== 0) {
2149
+ throw new Error(`multi-volume zip files are not supported. This is volume: ${diskNumber}`);
2150
+ }
2151
+ const entryCount = getUint16LE(eocdr, 10);
2152
+ const centralDirectorySize = getUint32LE(eocdr, 12);
2153
+ const centralDirectoryOffset = getUint32LE(eocdr, 16);
2154
+ const commentLength = getUint16LE(eocdr, 20);
2155
+ const expectedCommentLength = eocdr.length - EOCDR_WITHOUT_COMMENT_SIZE;
2156
+ if (commentLength !== expectedCommentLength) {
2157
+ throw new Error(`invalid comment length. expected: ${expectedCommentLength}, actual: ${commentLength}`);
2158
+ }
2159
+ const commentBytes = new Uint8Array(eocdr.buffer, eocdr.byteOffset + 22, commentLength);
2160
+ const comment = decodeBuffer(commentBytes);
2161
+ if (entryCount === 65535 || centralDirectoryOffset === 4294967295) {
2162
+ return await readZip64CentralDirectory(reader, readStart + i2, comment, commentBytes);
2163
+ } else {
2164
+ return await readEntries(reader, centralDirectoryOffset, centralDirectorySize, entryCount, comment, commentBytes);
2165
+ }
2166
+ }
2167
+ throw new Error("could not find end of central directory. maybe not zip file");
2168
+ }
2169
+ const END_OF_CENTRAL_DIRECTORY_LOCATOR_SIGNATURE = 117853008;
2170
+ async function readZip64CentralDirectory(reader, offset, comment, commentBytes) {
2171
+ const zip64EocdlOffset = offset - 20;
2172
+ const eocdl = await readAs(reader, zip64EocdlOffset, 20);
2173
+ if (getUint32LE(eocdl, 0) !== END_OF_CENTRAL_DIRECTORY_LOCATOR_SIGNATURE) {
2174
+ throw new Error("invalid zip64 end of central directory locator signature");
2175
+ }
2176
+ const zip64EocdrOffset = getUint64LE(eocdl, 8);
2177
+ const zip64Eocdr = await readAs(reader, zip64EocdrOffset, 56);
2178
+ if (getUint32LE(zip64Eocdr, 0) !== ZIP64_EOCDR_SIGNATURE) {
2179
+ throw new Error("invalid zip64 end of central directory record signature");
2180
+ }
2181
+ const entryCount = getUint64LE(zip64Eocdr, 32);
2182
+ const centralDirectorySize = getUint64LE(zip64Eocdr, 40);
2183
+ const centralDirectoryOffset = getUint64LE(zip64Eocdr, 48);
2184
+ return readEntries(reader, centralDirectoryOffset, centralDirectorySize, entryCount, comment, commentBytes);
2185
+ }
2186
+ const CENTRAL_DIRECTORY_FILE_HEADER_SIGNATURE = 33639248;
2187
+ async function readEntries(reader, centralDirectoryOffset, centralDirectorySize, rawEntryCount, comment, commentBytes) {
2188
+ let readEntryCursor = 0;
2189
+ const allEntriesBuffer = await readAs(reader, centralDirectoryOffset, centralDirectorySize);
2190
+ const rawEntries = [];
2191
+ for (let e2 = 0; e2 < rawEntryCount; ++e2) {
2192
+ const buffer2 = allEntriesBuffer.subarray(readEntryCursor, readEntryCursor + 46);
2193
+ const signature = getUint32LE(buffer2, 0);
2194
+ if (signature !== CENTRAL_DIRECTORY_FILE_HEADER_SIGNATURE) {
2195
+ throw new Error(`invalid central directory file header signature: 0x${signature.toString(16)}`);
2196
+ }
2197
+ const rawEntry = {
2198
+ // 4 - Version made by
2199
+ versionMadeBy: getUint16LE(buffer2, 4),
2200
+ // 6 - Version needed to extract (minimum)
2201
+ versionNeededToExtract: getUint16LE(buffer2, 6),
2202
+ // 8 - General purpose bit flag
2203
+ generalPurposeBitFlag: getUint16LE(buffer2, 8),
2204
+ // 10 - Compression method
2205
+ compressionMethod: getUint16LE(buffer2, 10),
2206
+ // 12 - File last modification time
2207
+ lastModFileTime: getUint16LE(buffer2, 12),
2208
+ // 14 - File last modification date
2209
+ lastModFileDate: getUint16LE(buffer2, 14),
2210
+ // 16 - CRC-32
2211
+ crc32: getUint32LE(buffer2, 16),
2212
+ // 20 - Compressed size
2213
+ compressedSize: getUint32LE(buffer2, 20),
2214
+ // 24 - Uncompressed size
2215
+ uncompressedSize: getUint32LE(buffer2, 24),
2216
+ // 28 - File name length (n)
2217
+ fileNameLength: getUint16LE(buffer2, 28),
2218
+ // 30 - Extra field length (m)
2219
+ extraFieldLength: getUint16LE(buffer2, 30),
2220
+ // 32 - File comment length (k)
2221
+ fileCommentLength: getUint16LE(buffer2, 32),
2222
+ // 34 - Disk number where file starts
2223
+ // 36 - Internal file attributes
2224
+ internalFileAttributes: getUint16LE(buffer2, 36),
2225
+ // 38 - External file attributes
2226
+ externalFileAttributes: getUint32LE(buffer2, 38),
2227
+ // 42 - Relative offset of local file header
2228
+ relativeOffsetOfLocalHeader: getUint32LE(buffer2, 42)
2229
+ };
2230
+ if (rawEntry.generalPurposeBitFlag & 64) {
2231
+ throw new Error("strong encryption is not supported");
2232
+ }
2233
+ readEntryCursor += 46;
2234
+ const data = allEntriesBuffer.subarray(readEntryCursor, readEntryCursor + rawEntry.fileNameLength + rawEntry.extraFieldLength + rawEntry.fileCommentLength);
2235
+ rawEntry.nameBytes = data.slice(0, rawEntry.fileNameLength);
2236
+ rawEntry.name = decodeBuffer(rawEntry.nameBytes);
2237
+ const fileCommentStart = rawEntry.fileNameLength + rawEntry.extraFieldLength;
2238
+ const extraFieldBuffer = data.slice(rawEntry.fileNameLength, fileCommentStart);
2239
+ rawEntry.extraFields = [];
2240
+ let i2 = 0;
2241
+ while (i2 < extraFieldBuffer.length - 3) {
2242
+ const headerId = getUint16LE(extraFieldBuffer, i2 + 0);
2243
+ const dataSize = getUint16LE(extraFieldBuffer, i2 + 2);
2244
+ const dataStart = i2 + 4;
2245
+ const dataEnd = dataStart + dataSize;
2246
+ if (dataEnd > extraFieldBuffer.length) {
2247
+ throw new Error("extra field length exceeds extra field buffer size");
2248
+ }
2249
+ rawEntry.extraFields.push({
2250
+ id: headerId,
2251
+ data: extraFieldBuffer.slice(dataStart, dataEnd)
2252
+ });
2253
+ i2 = dataEnd;
2254
+ }
2255
+ rawEntry.commentBytes = data.slice(fileCommentStart, fileCommentStart + rawEntry.fileCommentLength);
2256
+ rawEntry.comment = decodeBuffer(rawEntry.commentBytes);
2257
+ readEntryCursor += data.length;
2258
+ if (rawEntry.uncompressedSize === 4294967295 || rawEntry.compressedSize === 4294967295 || rawEntry.relativeOffsetOfLocalHeader === 4294967295) {
2259
+ const zip64ExtraField = rawEntry.extraFields.find((e3) => e3.id === 1);
2260
+ if (!zip64ExtraField) {
2261
+ throw new Error("expected zip64 extended information extra field");
2262
+ }
2263
+ const zip64EiefBuffer = zip64ExtraField.data;
2264
+ let index2 = 0;
2265
+ if (rawEntry.uncompressedSize === 4294967295) {
2266
+ if (index2 + 8 > zip64EiefBuffer.length) {
2267
+ throw new Error("zip64 extended information extra field does not include uncompressed size");
2268
+ }
2269
+ rawEntry.uncompressedSize = getUint64LE(zip64EiefBuffer, index2);
2270
+ index2 += 8;
2271
+ }
2272
+ if (rawEntry.compressedSize === 4294967295) {
2273
+ if (index2 + 8 > zip64EiefBuffer.length) {
2274
+ throw new Error("zip64 extended information extra field does not include compressed size");
2275
+ }
2276
+ rawEntry.compressedSize = getUint64LE(zip64EiefBuffer, index2);
2277
+ index2 += 8;
2278
+ }
2279
+ if (rawEntry.relativeOffsetOfLocalHeader === 4294967295) {
2280
+ if (index2 + 8 > zip64EiefBuffer.length) {
2281
+ throw new Error("zip64 extended information extra field does not include relative header offset");
2282
+ }
2283
+ rawEntry.relativeOffsetOfLocalHeader = getUint64LE(zip64EiefBuffer, index2);
2284
+ index2 += 8;
2285
+ }
2286
+ }
2287
+ const nameField = rawEntry.extraFields.find((e3) => e3.id === 28789 && e3.data.length >= 6 && // too short to be meaningful
2288
+ e3.data[0] === 1 && // Version 1 byte version of this extra field, currently 1
2289
+ getUint32LE(e3.data, 1), crc$1.unsigned(rawEntry.nameBytes));
2290
+ if (nameField) {
2291
+ rawEntry.fileName = decodeBuffer(nameField.data.slice(5));
2292
+ }
2293
+ if (rawEntry.compressionMethod === 0) {
2294
+ let expectedCompressedSize = rawEntry.uncompressedSize;
2295
+ if ((rawEntry.generalPurposeBitFlag & 1) !== 0) {
2296
+ expectedCompressedSize += 12;
2297
+ }
2298
+ if (rawEntry.compressedSize !== expectedCompressedSize) {
2299
+ throw new Error(`compressed size mismatch for stored file: ${rawEntry.compressedSize} != ${expectedCompressedSize}`);
2300
+ }
2301
+ }
2302
+ rawEntries.push(rawEntry);
2303
+ }
2304
+ const zip = {
2305
+ comment,
2306
+ commentBytes
2307
+ };
2308
+ return {
2309
+ zip,
2310
+ entries: rawEntries.map((e2) => new ZipEntry(reader, e2))
2311
+ };
2312
+ }
2313
+ async function readEntryDataHeader(reader, rawEntry) {
2314
+ if (rawEntry.generalPurposeBitFlag & 1) {
2315
+ throw new Error("encrypted entries not supported");
2316
+ }
2317
+ const buffer2 = await readAs(reader, rawEntry.relativeOffsetOfLocalHeader, 30);
2318
+ const totalLength = await reader.getLength();
2319
+ const signature = getUint32LE(buffer2, 0);
2320
+ if (signature !== 67324752) {
2321
+ throw new Error(`invalid local file header signature: 0x${signature.toString(16)}`);
2322
+ }
2323
+ const fileNameLength = getUint16LE(buffer2, 26);
2324
+ const extraFieldLength = getUint16LE(buffer2, 28);
2325
+ const localFileHeaderEnd = rawEntry.relativeOffsetOfLocalHeader + buffer2.length + fileNameLength + extraFieldLength;
2326
+ let decompress;
2327
+ if (rawEntry.compressionMethod === 0) {
2328
+ decompress = false;
2329
+ } else if (rawEntry.compressionMethod === 8) {
2330
+ decompress = true;
2331
+ } else {
2332
+ throw new Error(`unsupported compression method: ${rawEntry.compressionMethod}`);
2333
+ }
2334
+ const fileDataStart = localFileHeaderEnd;
2335
+ const fileDataEnd = fileDataStart + rawEntry.compressedSize;
2336
+ if (rawEntry.compressedSize !== 0) {
2337
+ if (fileDataEnd > totalLength) {
2338
+ throw new Error(`file data overflows file bounds: ${fileDataStart} + ${rawEntry.compressedSize} > ${totalLength}`);
2339
+ }
2340
+ }
2341
+ return {
2342
+ decompress,
2343
+ fileDataStart
2344
+ };
2345
+ }
2346
+ async function readEntryDataAsArrayBuffer(reader, rawEntry) {
2347
+ const { decompress, fileDataStart } = await readEntryDataHeader(reader, rawEntry);
2348
+ if (!decompress) {
2349
+ const dataView = await readAs(reader, fileDataStart, rawEntry.compressedSize);
2350
+ return isTypedArraySameAsArrayBuffer(dataView) ? dataView.buffer : dataView.slice().buffer;
2351
+ }
2352
+ const typedArrayOrBlob = await readAsBlobOrTypedArray(reader, fileDataStart, rawEntry.compressedSize);
2353
+ const result = await inflateRawAsync(typedArrayOrBlob, rawEntry.uncompressedSize);
2354
+ return result;
2355
+ }
2356
+ async function readEntryDataAsBlob(reader, rawEntry, type) {
2357
+ const { decompress, fileDataStart } = await readEntryDataHeader(reader, rawEntry);
2358
+ if (!decompress) {
2359
+ const typedArrayOrBlob2 = await readAsBlobOrTypedArray(reader, fileDataStart, rawEntry.compressedSize, type);
2360
+ if (isBlob$1(typedArrayOrBlob2)) {
2361
+ return typedArrayOrBlob2;
2362
+ }
2363
+ return new Blob([isSharedArrayBuffer(typedArrayOrBlob2.buffer) ? new Uint8Array(typedArrayOrBlob2) : typedArrayOrBlob2], { type });
2364
+ }
2365
+ const typedArrayOrBlob = await readAsBlobOrTypedArray(reader, fileDataStart, rawEntry.compressedSize);
2366
+ const result = await inflateRawAsync(typedArrayOrBlob, rawEntry.uncompressedSize, type);
2367
+ return result;
2368
+ }
2369
+ async function unzipRaw(source) {
2370
+ let reader;
2371
+ if (typeof Blob !== "undefined" && source instanceof Blob) {
2372
+ reader = new BlobReader$1(source);
2373
+ } else if (source instanceof ArrayBuffer || source && source.buffer && source.buffer instanceof ArrayBuffer) {
2374
+ reader = new ArrayBufferReader(source);
2375
+ } else if (isSharedArrayBuffer(source) || isSharedArrayBuffer(source.buffer)) {
2376
+ reader = new ArrayBufferReader(source);
2377
+ } else if (typeof source === "string") {
2378
+ const req = await fetch(source);
2379
+ if (!req.ok) {
2380
+ throw new Error(`failed http request ${source}, status: ${req.status}: ${req.statusText}`);
2381
+ }
2382
+ const blob = await req.blob();
2383
+ reader = new BlobReader$1(blob);
2384
+ } else if (typeof source.getLength === "function" && typeof source.read === "function") {
2385
+ reader = source;
2386
+ } else {
2387
+ throw new Error("unsupported source type");
2388
+ }
2389
+ const totalLength = await reader.getLength();
2390
+ if (totalLength > Number.MAX_SAFE_INTEGER) {
2391
+ throw new Error(`file too large. size: ${totalLength}. Only file sizes up 4503599627370496 bytes are supported`);
2392
+ }
2393
+ return await findEndOfCentralDirector(reader, totalLength);
2394
+ }
2395
+ async function unzip(source) {
2396
+ const { zip, entries } = await unzipRaw(source);
2397
+ return {
2398
+ zip,
2399
+ entries: Object.fromEntries(entries.map((v) => [v.name, v]))
2400
+ };
2401
+ }
2402
+ class BlobReader2 {
2403
+ constructor(blob) {
2404
+ __publicField(this, "blob");
2405
+ this.blob = blob;
2406
+ }
2407
+ async getLength() {
2408
+ return this.blob.size;
2409
+ }
2410
+ async read(offset, length2) {
2411
+ const blob = this.blob.slice(offset, offset + length2);
2412
+ return new Uint8Array(await blob.arrayBuffer());
2413
+ }
2414
+ }
2415
+ class HTTPRangeReader {
2416
+ constructor(url, opts2 = {}) {
2417
+ __publicField(this, "url");
2418
+ __publicField(this, "length");
2419
+ __privateAdd(this, _overrides2, void 0);
2420
+ this.url = url;
2421
+ __privateSet(this, _overrides2, opts2.overrides ?? {});
2422
+ }
2423
+ async getLength() {
2424
+ if (this.length === void 0) {
2425
+ const req = await fetch(this.url, {
2426
+ ...__privateGet(this, _overrides2),
2427
+ method: "HEAD"
2428
+ });
2429
+ if (!req.ok) {
2430
+ throw new Error(`failed http request ${this.url}, status: ${req.status}: ${req.statusText}`);
2431
+ }
2432
+ this.length = parseInt(req.headers.get("content-length"));
2433
+ if (Number.isNaN(this.length)) {
2434
+ throw Error("could not get length");
2435
+ }
2436
+ }
2437
+ return this.length;
2438
+ }
2439
+ async read(offset, size2) {
2440
+ if (size2 === 0) {
2441
+ return new Uint8Array(0);
2442
+ }
2443
+ const req = await fetch_range(this.url, offset, size2, __privateGet(this, _overrides2));
2444
+ if (!req.ok) {
2445
+ throw new Error(`failed http request ${this.url}, status: ${req.status} offset: ${offset} size: ${size2}: ${req.statusText}`);
2446
+ }
2447
+ return new Uint8Array(await req.arrayBuffer());
2448
+ }
2449
+ }
2450
+ _overrides2 = new WeakMap();
2451
+ class ZipFileStore {
2452
+ constructor(reader) {
2453
+ __publicField(this, "info");
2454
+ this.info = unzip(reader);
2455
+ }
2456
+ async get(key) {
2457
+ let entry = (await this.info).entries[strip_prefix(key)];
2458
+ if (!entry)
2459
+ return;
2460
+ return new Uint8Array(await entry.arrayBuffer());
2461
+ }
2462
+ async has(key) {
2463
+ return strip_prefix(key) in (await this.info).entries;
2464
+ }
2465
+ static fromUrl(href, opts2 = {}) {
2466
+ return new ZipFileStore(new HTTPRangeReader(href, opts2));
2467
+ }
2468
+ static fromBlob(blob) {
2469
+ return new ZipFileStore(new BlobReader2(blob));
2470
+ }
2471
+ }
2472
+ const ZipFileStore$1 = ZipFileStore;
2473
+ function zarrOpenRoot(url, fileType, requestInit2) {
2474
+ let store;
2475
+ if (fileType && fileType.endsWith(".zip")) {
2476
+ store = ZipFileStore$1.fromUrl(url, { overrides: requestInit2 });
2477
+ } else {
2478
+ store = new FetchStore$1(url, { overrides: requestInit2 });
2479
+ }
1475
2480
  return root$3(store);
1476
2481
  }
1477
2482
  class ZarrDataSource {
1478
- constructor({ url, requestInit: requestInit2, store }) {
2483
+ constructor({ url, requestInit: requestInit2, store, fileType }) {
1479
2484
  if (store) {
1480
2485
  this.storeRoot = root$3(store);
1481
2486
  } else {
1482
- this.storeRoot = zarrOpenRoot(url, requestInit2);
2487
+ this.storeRoot = zarrOpenRoot(url, fileType, requestInit2);
1483
2488
  }
1484
2489
  }
1485
2490
  getStoreRoot(path) {
@@ -2368,11 +3373,14 @@ const DataType$2 = {
2368
3373
  GENOMIC_PROFILES: "genomic-profiles",
2369
3374
  OBS_SPOTS: "obsSpots",
2370
3375
  OBS_POINTS: "obsPoints",
2371
- OBS_LOCATIONS: "obsLocations"
3376
+ OBS_LOCATIONS: "obsLocations",
3377
+ SAMPLE_SETS: "sampleSets",
3378
+ SAMPLE_EDGES: "sampleEdges"
2372
3379
  };
2373
3380
  const FileType$1 = {
2374
3381
  // Joint file types
2375
3382
  ANNDATA_ZARR: "anndata.zarr",
3383
+ ANNDATA_ZARR_ZIP: "anndata.zarr.zip",
2376
3384
  SPATIALDATA_ZARR: "spatialdata.zarr",
2377
3385
  // Atomic file types
2378
3386
  OBS_EMBEDDING_CSV: "obsEmbedding.csv",
@@ -2385,6 +3393,7 @@ const FileType$1 = {
2385
3393
  OBS_SEGMENTATIONS_JSON: "obsSegmentations.json",
2386
3394
  OBS_SETS_CSV: "obsSets.csv",
2387
3395
  OBS_SETS_JSON: "obsSets.json",
3396
+ SAMPLE_SETS_CSV: "sampleSets.csv",
2388
3397
  // OME-Zarr
2389
3398
  IMAGE_OME_ZARR: "image.ome-zarr",
2390
3399
  OBS_SEGMENTATIONS_OME_ZARR: "obsSegmentations.ome-zarr",
@@ -2399,6 +3408,19 @@ const FileType$1 = {
2399
3408
  OBS_SEGMENTATIONS_ANNDATA_ZARR: "obsSegmentations.anndata.zarr",
2400
3409
  OBS_LABELS_ANNDATA_ZARR: "obsLabels.anndata.zarr",
2401
3410
  FEATURE_LABELS_ANNDATA_ZARR: "featureLabels.anndata.zarr",
3411
+ SAMPLE_EDGES_ANNDATA_ZARR: "sampleEdges.anndata.zarr",
3412
+ // AnnData - zipped
3413
+ OBS_FEATURE_MATRIX_ANNDATA_ZARR_ZIP: "obsFeatureMatrix.anndata.zarr.zip",
3414
+ OBS_FEATURE_COLUMNS_ANNDATA_ZARR_ZIP: "obsFeatureColumns.anndata.zarr.zip",
3415
+ OBS_SETS_ANNDATA_ZARR_ZIP: "obsSets.anndata.zarr.zip",
3416
+ OBS_EMBEDDING_ANNDATA_ZARR_ZIP: "obsEmbedding.anndata.zarr.zip",
3417
+ OBS_SPOTS_ANNDATA_ZARR_ZIP: "obsSpots.anndata.zarr.zip",
3418
+ OBS_POINTS_ANNDATA_ZARR_ZIP: "obsPoints.anndata.zarr.zip",
3419
+ OBS_LOCATIONS_ANNDATA_ZARR_ZIP: "obsLocations.anndata.zarr.zip",
3420
+ OBS_SEGMENTATIONS_ANNDATA_ZARR_ZIP: "obsSegmentations.anndata.zarr.zip",
3421
+ OBS_LABELS_ANNDATA_ZARR_ZIP: "obsLabels.anndata.zarr.zip",
3422
+ FEATURE_LABELS_ANNDATA_ZARR_ZIP: "featureLabels.anndata.zarr.zip",
3423
+ SAMPLE_EDGES_ANNDATA_ZARR_ZIP: "sampleEdges.anndata.zarr.zip",
2402
3424
  // SpatialData
2403
3425
  IMAGE_SPATIALDATA_ZARR: "image.spatialdata.zarr",
2404
3426
  LABELS_SPATIALDATA_ZARR: "labels.spatialdata.zarr",
@@ -2406,6 +3428,7 @@ const FileType$1 = {
2406
3428
  OBS_FEATURE_MATRIX_SPATIALDATA_ZARR: "obsFeatureMatrix.spatialdata.zarr",
2407
3429
  OBS_SETS_SPATIALDATA_ZARR: "obsSets.spatialdata.zarr",
2408
3430
  OBS_SPOTS_SPATIALDATA_ZARR: "obsSpots.spatialdata.zarr",
3431
+ FEATURE_LABELS_SPATIALDATA_ZARR: "featureLabels.spatialdata.zarr",
2409
3432
  // TODO:
2410
3433
  // OBS_POINTS_SPATIALDATA_ZARR: 'obsPoints.spatialdata.zarr',
2411
3434
  // OBS_LOCATIONS_SPATIALDATA_ZARR: 'obsLocations.spatialdata.zarr',
@@ -2562,7 +3585,10 @@ const CoordinationType$1 = {
2562
3585
  LEGEND_VISIBLE: "legendVisible",
2563
3586
  SPATIAL_CHANNEL_LABELS_VISIBLE: "spatialChannelLabelsVisible",
2564
3587
  SPATIAL_CHANNEL_LABELS_ORIENTATION: "spatialChannelLabelsOrientation",
2565
- SPATIAL_CHANNEL_LABEL_SIZE: "spatialChannelLabelSize"
3588
+ SPATIAL_CHANNEL_LABEL_SIZE: "spatialChannelLabelSize",
3589
+ // Multi-sample / comparative
3590
+ SAMPLE_TYPE: "sampleType",
3591
+ SAMPLE_SET_SELECTION: "sampleSetSelection"
2566
3592
  };
2567
3593
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
2568
3594
  function getDefaultExportFromCjs(x2) {
@@ -22705,11 +23731,6 @@ var createDivide = /* @__PURE__ */ factory(name$7, dependencies, (_ref) => {
22705
23731
  }
22706
23732
  }, divideScalar2.signatures));
22707
23733
  });
22708
- const fs$q = {};
22709
- const node = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
22710
- __proto__: null,
22711
- default: fs$q
22712
- }, Symbol.toStringTag, { value: "Module" }));
22713
23734
  const require$$0$6 = /* @__PURE__ */ getAugmentedNamespace(node);
22714
23735
  var Complex = /* @__PURE__ */ createComplexClass({});
22715
23736
  var BigNumber = /* @__PURE__ */ createBigNumberClass({
@@ -89966,14 +90987,14 @@ var jsts_min = { exports: {} };
89966
90987
  return 1e-15;
89967
90988
  }, Object.defineProperties(q, B2);
89968
90989
  var V = function() {
89969
- }, U = { X: { configurable: true }, Y: { configurable: true }, Z: { configurable: true }, M: { configurable: true } };
89970
- U.X.get = function() {
90990
+ }, U2 = { X: { configurable: true }, Y: { configurable: true }, Z: { configurable: true }, M: { configurable: true } };
90991
+ U2.X.get = function() {
89971
90992
  return 0;
89972
- }, U.Y.get = function() {
90993
+ }, U2.Y.get = function() {
89973
90994
  return 1;
89974
- }, U.Z.get = function() {
90995
+ }, U2.Z.get = function() {
89975
90996
  return 2;
89976
- }, U.M.get = function() {
90997
+ }, U2.M.get = function() {
89977
90998
  return 3;
89978
90999
  }, V.prototype.setOrdinate = function(t3, e3, n4) {
89979
91000
  }, V.prototype.size = function() {
@@ -89991,7 +91012,7 @@ var jsts_min = { exports: {} };
89991
91012
  return [x2];
89992
91013
  }, V.prototype.getClass = function() {
89993
91014
  return V;
89994
- }, Object.defineProperties(V, U);
91015
+ }, Object.defineProperties(V, U2);
89995
91016
  var z2 = function() {
89996
91017
  }, X = function(t3) {
89997
91018
  function e3() {
@@ -122082,16 +123103,16 @@ function addDecoder(cases, importFn) {
122082
123103
  }
122083
123104
  cases.forEach((c) => registry$1.set(c, importFn));
122084
123105
  }
122085
- addDecoder([void 0, 1], () => import("./raw-bc2c5642.js").then((m) => m.default));
122086
- addDecoder(5, () => import("./lzw-b8d50e5c.js").then((m) => m.default));
123106
+ addDecoder([void 0, 1], () => import("./raw-8fdba750.js").then((m) => m.default));
123107
+ addDecoder(5, () => import("./lzw-97464fce.js").then((m) => m.default));
122087
123108
  addDecoder(6, () => {
122088
123109
  throw new Error("old style JPEG compression is not supported.");
122089
123110
  });
122090
- addDecoder(7, () => import("./jpeg-d7680a9e.js").then((m) => m.default));
122091
- addDecoder([8, 32946], () => import("./deflate-a5b3ac82.js").then((m) => m.default));
122092
- addDecoder(32773, () => import("./packbits-d21ec38d.js").then((m) => m.default));
122093
- addDecoder(34887, () => import("./lerc-e1ef6468.js").then((m) => m.default));
122094
- addDecoder(50001, () => import("./webimage-71c5dd88.js").then((m) => m.default));
123111
+ addDecoder(7, () => import("./jpeg-3ff942a5.js").then((m) => m.default));
123112
+ addDecoder([8, 32946], () => import("./deflate-2f7f502f.js").then((m) => m.default));
123113
+ addDecoder(32773, () => import("./packbits-daaf8f04.js").then((m) => m.default));
123114
+ addDecoder(34887, () => import("./lerc-762cc666.js").then((m) => m.default));
123115
+ addDecoder(50001, () => import("./webimage-e98ea52f.js").then((m) => m.default));
122095
123116
  function decodeRowAcc(row, stride) {
122096
123117
  let length2 = row.length - stride;
122097
123118
  let offset = 0;
@@ -124508,14 +125529,14 @@ const makeTable = () => {
124508
125529
  return table;
124509
125530
  };
124510
125531
  const crcTable = new Uint32Array(makeTable());
124511
- const crc32 = (crc, buf, len2, pos) => {
125532
+ const crc32 = (crc2, buf, len2, pos) => {
124512
125533
  const t2 = crcTable;
124513
125534
  const end = pos + len2;
124514
- crc ^= -1;
125535
+ crc2 ^= -1;
124515
125536
  for (let i2 = pos; i2 < end; i2++) {
124516
- crc = crc >>> 8 ^ t2[(crc ^ buf[i2]) & 255];
125537
+ crc2 = crc2 >>> 8 ^ t2[(crc2 ^ buf[i2]) & 255];
124517
125538
  }
124518
- return crc ^ -1;
125539
+ return crc2 ^ -1;
124519
125540
  };
124520
125541
  var crc32_1 = crc32;
124521
125542
  var messages = {
@@ -128274,7 +129295,7 @@ var blosc_codec = function() {
128274
129295
  if (h.length !== d.length)
128275
129296
  throw new La("Mismatched type converter count");
128276
129297
  for (var l2 = 0; l2 < d.length; ++l2)
128277
- U(d[l2], h[l2]);
129298
+ U2(d[l2], h[l2]);
128278
129299
  }
128279
129300
  var d = [];
128280
129301
  d.forEach(function(h) {
@@ -128290,7 +129311,7 @@ var blosc_codec = function() {
128290
129311
  });
128291
129312
  0 === g2.length && c(e2);
128292
129313
  }
128293
- function U(a2, b, c) {
129314
+ function U2(a2, b, c) {
128294
129315
  c = c || {};
128295
129316
  if (!("argPackAdvance" in b))
128296
129317
  throw new TypeError("registerType registeredInstance requires argPackAdvance");
@@ -128485,7 +129506,7 @@ var blosc_codec = function() {
128485
129506
  }, z: function(a2, b, c, d, e2) {
128486
129507
  var g2 = Fa(c);
128487
129508
  b = P2(b);
128488
- U(a2, { name: b, fromWireType: function(k) {
129509
+ U2(a2, { name: b, fromWireType: function(k) {
128489
129510
  return !!k;
128490
129511
  }, toWireType: function(k, h) {
128491
129512
  return h ? d : e2;
@@ -128502,7 +129523,7 @@ var blosc_codec = function() {
128502
129523
  }, M: null });
128503
129524
  }, y: function(a2, b) {
128504
129525
  b = P2(b);
128505
- U(a2, { name: b, fromWireType: function(c) {
129526
+ U2(a2, { name: b, fromWireType: function(c) {
128506
129527
  var d = V[c].value;
128507
129528
  Qa(c);
128508
129529
  return d;
@@ -128512,7 +129533,7 @@ var blosc_codec = function() {
128512
129533
  }, h: function(a2, b, c) {
128513
129534
  c = Fa(c);
128514
129535
  b = P2(b);
128515
- U(a2, { name: b, fromWireType: function(d) {
129536
+ U2(a2, { name: b, fromWireType: function(d) {
128516
129537
  return d;
128517
129538
  }, toWireType: function(d, e2) {
128518
129539
  if ("number" !== typeof e2 && "boolean" !== typeof e2)
@@ -128580,7 +129601,7 @@ var blosc_codec = function() {
128580
129601
  };
128581
129602
  }
128582
129603
  var l2 = -1 != b.indexOf("unsigned");
128583
- U(a2, { name: b, fromWireType: g2, toWireType: function(n3, p) {
129604
+ U2(a2, { name: b, fromWireType: g2, toWireType: function(n3, p) {
128584
129605
  if ("number" !== typeof p && "boolean" !== typeof p)
128585
129606
  throw new TypeError('Cannot convert "' + Ta(p) + '" to ' + this.name);
128586
129607
  if (p < d || p > e2)
@@ -128599,11 +129620,11 @@ var blosc_codec = function() {
128599
129620
  }
128600
129621
  var e2 = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array][b];
128601
129622
  c = P2(c);
128602
- U(a2, { name: c, fromWireType: d, argPackAdvance: 8, readValueFromPointer: d }, { U: true });
129623
+ U2(a2, { name: c, fromWireType: d, argPackAdvance: 8, readValueFromPointer: d }, { U: true });
128603
129624
  }, i: function(a2, b) {
128604
129625
  b = P2(b);
128605
129626
  var c = "std::string" === b;
128606
- U(a2, { name: b, fromWireType: function(d) {
129627
+ U2(a2, { name: b, fromWireType: function(d) {
128607
129628
  var e2 = G2[d >> 2];
128608
129629
  if (c)
128609
129630
  for (var g2 = d + 4, k = 0; k <= e2; ++k) {
@@ -128670,7 +129691,7 @@ var blosc_codec = function() {
128670
129691
  4 === b && (d = na, e2 = oa, g2 = pa, k = function() {
128671
129692
  return G2;
128672
129693
  }, h = 2);
128673
- U(a2, { name: c, fromWireType: function(l2) {
129694
+ U2(a2, { name: c, fromWireType: function(l2) {
128674
129695
  for (var n3 = G2[l2 >> 2], p = k(), q, x2 = l2 + 4, B2 = 0; B2 <= n3; ++B2) {
128675
129696
  var m = l2 + 4 + B2 * b;
128676
129697
  if (B2 == n3 || 0 == p[m >> h])
@@ -128690,7 +129711,7 @@ var blosc_codec = function() {
128690
129711
  } });
128691
129712
  }, A: function(a2, b) {
128692
129713
  b = P2(b);
128693
- U(a2, {
129714
+ U2(a2, {
128694
129715
  aa: true,
128695
129716
  name: b,
128696
129717
  argPackAdvance: 0,
@@ -141735,6 +142756,17 @@ z.object({
141735
142756
  scoreColumn: z.string().optional()
141736
142757
  }))
141737
142758
  });
142759
+ z.object({
142760
+ sampleIndex: z.string(),
142761
+ sampleSets: z.array(z.object({
142762
+ name: z.string(),
142763
+ column: z.union([
142764
+ z.string(),
142765
+ z.array(z.string())
142766
+ ]),
142767
+ scoreColumn: z.string().optional()
142768
+ }))
142769
+ });
141738
142770
  z.object({
141739
142771
  obsLabels: z.union([
141740
142772
  annDataObsLabels,
@@ -148703,6 +149735,38 @@ class ObsFeatureColumnsAnndataLoader extends AbstractTwoStepLoader {
148703
149735
  )));
148704
149736
  }
148705
149737
  }
149738
+ class SampleEdgesAnndataLoader extends AbstractTwoStepLoader {
149739
+ /**
149740
+ * Class method for loading observation string labels.
149741
+ * @returns {Promise} A promise for the array.
149742
+ */
149743
+ loadLabels() {
149744
+ const { path } = this.options;
149745
+ if (this.labels) {
149746
+ return this.labels;
149747
+ }
149748
+ if (!this.labels) {
149749
+ this.labels = this.dataSource._loadColumn(path);
149750
+ return this.labels;
149751
+ }
149752
+ this.labels = Promise.resolve(null);
149753
+ return this.labels;
149754
+ }
149755
+ async load() {
149756
+ const { path } = this.options;
149757
+ const superResult = await super.load().catch((reason) => Promise.resolve(reason));
149758
+ if (superResult instanceof AbstractLoaderError) {
149759
+ return Promise.reject(superResult);
149760
+ }
149761
+ return Promise.all([
149762
+ this.dataSource.loadObsIndex(path),
149763
+ this.loadLabels()
149764
+ ]).then(([obsIndex, sampleIds]) => Promise.resolve(new LoaderResult(
149765
+ { obsIndex, sampleIds },
149766
+ null
149767
+ )));
149768
+ }
149769
+ }
148706
149770
  class ImageWrapper {
148707
149771
  constructor(vivLoader, options) {
148708
149772
  __publicField(this, "vivLoader");
@@ -149186,7 +150250,7 @@ class SpatialDataLabelsLoader extends SpatialDataImageLoader {
149186
150250
  };
149187
150251
  const imageWrapper = result.data.obsSegmentations.instance;
149188
150252
  const channelObjects = imageWrapper.getChannelObjects();
149189
- const channelCoordination = channelObjects.slice(0, 5).map((channelObj, i2) => ({
150253
+ const channelCoordination = channelObjects.slice(0, 7).map((channelObj, i2) => ({
149190
150254
  spatialTargetC: i2,
149191
150255
  // obsType: channelObj.name,
149192
150256
  spatialChannelColor: (channelObj.defaultColor || channelObj.autoDefaultColor).slice(0, 3),
@@ -149329,10 +150393,11 @@ export {
149329
150393
  ObsSetsAnndataLoader as i,
149330
150394
  ObsLabelsAnndataLoader as j,
149331
150395
  ObsFeatureColumnsAnndataLoader as k,
149332
- OmeZarrLoader as l,
149333
- OmeZarrAsObsSegmentationsLoader as m,
149334
- SpatialDataImageLoader as n,
149335
- SpatialDataLabelsLoader as o,
149336
- SpatialDataObsSpotsLoader as p,
149337
- SpatialDataObsSetsLoader as q
150396
+ SampleEdgesAnndataLoader as l,
150397
+ OmeZarrLoader as m,
150398
+ OmeZarrAsObsSegmentationsLoader as n,
150399
+ SpatialDataImageLoader as o,
150400
+ SpatialDataLabelsLoader as p,
150401
+ SpatialDataObsSpotsLoader as q,
150402
+ SpatialDataObsSetsLoader as r
149338
150403
  };