@vitessce/gl 3.2.2 → 3.3.1

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.
@@ -731,9 +731,9 @@ function concatenateTypedArrays(...typedArrays) {
731
731
  const sumLength = arrays.reduce((acc, value) => acc + value.length, 0);
732
732
  const result = new TypedArrayConstructor(sumLength);
733
733
  let offset = 0;
734
- for (const array2 of arrays) {
735
- result.set(array2, offset);
736
- offset += array2.length;
734
+ for (const array of arrays) {
735
+ result.set(array, offset);
736
+ offset += array.length;
737
737
  }
738
738
  return result;
739
739
  }
@@ -2475,7 +2475,7 @@ async function parseWithLoader(loader, data, options, context) {
2475
2475
  assert$b(!loader.parseSync);
2476
2476
  throw new Error("".concat(loader.id, " loader - no parser found and worker is disabled"));
2477
2477
  }
2478
- async function load$1(url, loaders, options, context) {
2478
+ async function load(url, loaders, options, context) {
2479
2479
  if (!Array.isArray(loaders) && !isLoaderObject(loaders)) {
2480
2480
  options = loaders;
2481
2481
  loaders = void 0;
@@ -2970,7 +2970,7 @@ const jsonLoader = {
2970
2970
  testText: isJSON,
2971
2971
  parseTextSync: JSON.parse
2972
2972
  };
2973
- const version = "8.8.20";
2973
+ const version = "8.8.27";
2974
2974
  const existingVersion = globalThis.deck && globalThis.deck.VERSION;
2975
2975
  if (existingVersion && existingVersion !== version) {
2976
2976
  throw new Error("deck.gl - multiple versions detected: ".concat(existingVersion, " vs ").concat(version));
@@ -3664,8 +3664,8 @@ const drawFramebuffer = (gl, value) => {
3664
3664
  const readFramebuffer = (gl, value) => {
3665
3665
  return gl.bindFramebuffer(36008, value);
3666
3666
  };
3667
- function isArray$4(array2) {
3668
- return Array.isArray(array2) || ArrayBuffer.isView(array2);
3667
+ function isArray$4(array) {
3668
+ return Array.isArray(array) || ArrayBuffer.isView(array);
3669
3669
  }
3670
3670
  const GL_PARAMETER_SETTERS = {
3671
3671
  [3042]: enable,
@@ -4169,9 +4169,8 @@ function cssToDeviceRatio(gl) {
4169
4169
  luma: luma2
4170
4170
  } = gl;
4171
4171
  if (gl.canvas && luma2) {
4172
- const {
4173
- clientWidth
4174
- } = luma2.canvasSizeInfo;
4172
+ const cachedSize = luma2.canvasSizeInfo;
4173
+ const clientWidth = "clientWidth" in cachedSize ? cachedSize.clientWidth : gl.canvas.clientWidth;
4175
4174
  return clientWidth ? gl.drawingBufferWidth / clientWidth : 1;
4176
4175
  }
4177
4176
  return 1;
@@ -4427,7 +4426,7 @@ function setDevicePixelRatio(gl, devicePixelRatio, options) {
4427
4426
  });
4428
4427
  }
4429
4428
  }
4430
- const VERSION$7 = "8.5.16";
4429
+ const VERSION$7 = "8.5.21";
4431
4430
  const STARTUP_MESSAGE = "set luma.log.level=1 (or higher) to trace rendering";
4432
4431
  class StatsManager {
4433
4432
  constructor() {
@@ -4548,7 +4547,6 @@ let Resource$1 = class Resource {
4548
4547
  this._handle = this._createHandle();
4549
4548
  }
4550
4549
  this.byteLength = 0;
4551
- this._initStats();
4552
4550
  this._addStats();
4553
4551
  }
4554
4552
  toString() {
@@ -4684,9 +4682,6 @@ let Resource$1 = class Resource {
4684
4682
  this.gl.luma = this.gl.luma || {};
4685
4683
  return this.gl.luma;
4686
4684
  }
4687
- _initStats() {
4688
- this.gl.stats = this.gl.stats || new StatsManager();
4689
- }
4690
4685
  _addStats() {
4691
4686
  const name2 = this[Symbol.toStringTag];
4692
4687
  const stats = lumaStats.get("Resource Counts");
@@ -4701,27 +4696,29 @@ let Resource$1 = class Resource {
4701
4696
  }
4702
4697
  _trackAllocatedMemory(bytes) {
4703
4698
  let name2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this[Symbol.toStringTag];
4704
- this._doTrackAllocatedMemory(bytes, name2);
4705
- this._doTrackAllocatedMemory(bytes, name2, this.gl.stats.get("Memory Usage"));
4699
+ this._trackAllocatedMemoryForContext(bytes, name2);
4700
+ this._trackAllocatedMemoryForContext(bytes, name2, this.gl.canvas && this.gl.canvas.id);
4701
+ this.byteLength = bytes;
4706
4702
  }
4707
- _doTrackAllocatedMemory(bytes) {
4703
+ _trackAllocatedMemoryForContext(bytes) {
4708
4704
  let name2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this[Symbol.toStringTag];
4709
- let stats = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : lumaStats.get("Memory Usage");
4705
+ let id = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "";
4706
+ const stats = lumaStats.get("Memory Usage".concat(id));
4710
4707
  stats.get("GPU Memory").addCount(bytes);
4711
4708
  stats.get("".concat(name2, " Memory")).addCount(bytes);
4712
- this.byteLength = bytes;
4713
4709
  }
4714
4710
  _trackDeallocatedMemory() {
4715
4711
  let name2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this[Symbol.toStringTag];
4716
- this._doTrackDeallocatedMemory(name2);
4717
- this._doTrackDeallocatedMemory(name2, this.gl.stats.get("Memory Usage"));
4712
+ this._trackDeallocatedMemoryForContext(name2);
4713
+ this._trackDeallocatedMemoryForContext(name2, this.gl.canvas && this.gl.canvas.id);
4714
+ this.byteLength = 0;
4718
4715
  }
4719
- _doTrackDeallocatedMemory() {
4716
+ _trackDeallocatedMemoryForContext() {
4720
4717
  let name2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this[Symbol.toStringTag];
4721
- let stats = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : lumaStats.get("Memory Usage");
4718
+ let id = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
4719
+ const stats = lumaStats.get("Memory Usage".concat(id));
4722
4720
  stats.get("GPU Memory").subtractCount(this.byteLength);
4723
4721
  stats.get("".concat(name2, " Memory")).subtractCount(this.byteLength);
4724
- this.byteLength = 0;
4725
4722
  }
4726
4723
  };
4727
4724
  const ERR_TYPE_DEDUCTION = "Failed to deduce GL constant from typed array";
@@ -8663,16 +8660,16 @@ class VertexArrayObject extends Resource$1 {
8663
8660
  VertexArrayObject.MAX_ATTRIBUTES = VertexArrayObject.MAX_ATTRIBUTES || gl.getParameter(34921);
8664
8661
  return VertexArrayObject.MAX_ATTRIBUTES;
8665
8662
  }
8666
- static setConstant(gl, location, array2) {
8667
- switch (array2.constructor) {
8663
+ static setConstant(gl, location, array) {
8664
+ switch (array.constructor) {
8668
8665
  case Float32Array:
8669
- VertexArrayObject._setConstantFloatArray(gl, location, array2);
8666
+ VertexArrayObject._setConstantFloatArray(gl, location, array);
8670
8667
  break;
8671
8668
  case Int32Array:
8672
- VertexArrayObject._setConstantIntArray(gl, location, array2);
8669
+ VertexArrayObject._setConstantIntArray(gl, location, array);
8673
8670
  break;
8674
8671
  case Uint32Array:
8675
- VertexArrayObject._setConstantUintArray(gl, location, array2);
8672
+ VertexArrayObject._setConstantUintArray(gl, location, array);
8676
8673
  break;
8677
8674
  default:
8678
8675
  assert$8(false);
@@ -8796,57 +8793,57 @@ class VertexArrayObject extends Resource$1 {
8796
8793
  }
8797
8794
  return true;
8798
8795
  }
8799
- static _setConstantFloatArray(gl, location, array2) {
8800
- switch (array2.length) {
8796
+ static _setConstantFloatArray(gl, location, array) {
8797
+ switch (array.length) {
8801
8798
  case 1:
8802
- gl.vertexAttrib1fv(location, array2);
8799
+ gl.vertexAttrib1fv(location, array);
8803
8800
  break;
8804
8801
  case 2:
8805
- gl.vertexAttrib2fv(location, array2);
8802
+ gl.vertexAttrib2fv(location, array);
8806
8803
  break;
8807
8804
  case 3:
8808
- gl.vertexAttrib3fv(location, array2);
8805
+ gl.vertexAttrib3fv(location, array);
8809
8806
  break;
8810
8807
  case 4:
8811
- gl.vertexAttrib4fv(location, array2);
8808
+ gl.vertexAttrib4fv(location, array);
8812
8809
  break;
8813
8810
  default:
8814
8811
  assert$8(false);
8815
8812
  }
8816
8813
  }
8817
- static _setConstantIntArray(gl, location, array2) {
8814
+ static _setConstantIntArray(gl, location, array) {
8818
8815
  assert$8(isWebGL2$1(gl));
8819
- switch (array2.length) {
8816
+ switch (array.length) {
8820
8817
  case 1:
8821
- gl.vertexAttribI1iv(location, array2);
8818
+ gl.vertexAttribI1iv(location, array);
8822
8819
  break;
8823
8820
  case 2:
8824
- gl.vertexAttribI2iv(location, array2);
8821
+ gl.vertexAttribI2iv(location, array);
8825
8822
  break;
8826
8823
  case 3:
8827
- gl.vertexAttribI3iv(location, array2);
8824
+ gl.vertexAttribI3iv(location, array);
8828
8825
  break;
8829
8826
  case 4:
8830
- gl.vertexAttribI4iv(location, array2);
8827
+ gl.vertexAttribI4iv(location, array);
8831
8828
  break;
8832
8829
  default:
8833
8830
  assert$8(false);
8834
8831
  }
8835
8832
  }
8836
- static _setConstantUintArray(gl, location, array2) {
8833
+ static _setConstantUintArray(gl, location, array) {
8837
8834
  assert$8(isWebGL2$1(gl));
8838
- switch (array2.length) {
8835
+ switch (array.length) {
8839
8836
  case 1:
8840
- gl.vertexAttribI1uiv(location, array2);
8837
+ gl.vertexAttribI1uiv(location, array);
8841
8838
  break;
8842
8839
  case 2:
8843
- gl.vertexAttribI2uiv(location, array2);
8840
+ gl.vertexAttribI2uiv(location, array);
8844
8841
  break;
8845
8842
  case 3:
8846
- gl.vertexAttribI3uiv(location, array2);
8843
+ gl.vertexAttribI3uiv(location, array);
8847
8844
  break;
8848
8845
  case 4:
8849
- gl.vertexAttribI4uiv(location, array2);
8846
+ gl.vertexAttribI4uiv(location, array);
8850
8847
  break;
8851
8848
  default:
8852
8849
  assert$8(false);
@@ -9219,7 +9216,7 @@ function formatValue$1(v) {
9219
9216
  let opts2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
9220
9217
  const EPSILON2 = 1e-16;
9221
9218
  const {
9222
- isInteger: isInteger2 = false
9219
+ isInteger = false
9223
9220
  } = opts2;
9224
9221
  if (Array.isArray(v) || ArrayBuffer.isView(v)) {
9225
9222
  return formatArrayValue(v, opts2);
@@ -9228,9 +9225,9 @@ function formatValue$1(v) {
9228
9225
  return String(v);
9229
9226
  }
9230
9227
  if (Math.abs(v) < EPSILON2) {
9231
- return isInteger2 ? "0" : "0.";
9228
+ return isInteger ? "0" : "0.";
9232
9229
  }
9233
- if (isInteger2) {
9230
+ if (isInteger) {
9234
9231
  return v.toFixed(0);
9235
9232
  }
9236
9233
  if (Math.abs(v) > 100 && Math.abs(v) < 1e4) {
@@ -9376,14 +9373,14 @@ function getDebugTableRow(vertexArray, attribute, accessor, header) {
9376
9373
  let size = 1;
9377
9374
  let verts = 0;
9378
9375
  let bytes = 0;
9379
- let isInteger2;
9376
+ let isInteger;
9380
9377
  let marker2;
9381
9378
  let value;
9382
9379
  if (accessor) {
9383
9380
  type = accessor.type;
9384
9381
  size = accessor.size;
9385
9382
  type = String(type).replace("Array", "");
9386
- isInteger2 = type.indexOf("nt") !== -1;
9383
+ isInteger = type.indexOf("nt") !== -1;
9387
9384
  }
9388
9385
  if (attribute instanceof Buffer$3) {
9389
9386
  const buffer2 = attribute;
@@ -9400,13 +9397,13 @@ function getDebugTableRow(vertexArray, attribute, accessor, header) {
9400
9397
  const instanced = accessor.divisor > 0;
9401
9398
  format = "".concat(instanced ? "I " : "P ", " ").concat(verts, " (x").concat(size, "=").concat(bytes, " bytes ").concat(getKey(gl, type), ")");
9402
9399
  } else {
9403
- isInteger2 = true;
9400
+ isInteger = true;
9404
9401
  format = "".concat(bytes, " bytes");
9405
9402
  }
9406
9403
  return {
9407
9404
  [header]: "".concat(marker2).concat(formatValue$1(value, {
9408
9405
  size,
9409
- isInteger: isInteger2
9406
+ isInteger
9410
9407
  })),
9411
9408
  "Format ": format
9412
9409
  };
@@ -9414,11 +9411,11 @@ function getDebugTableRow(vertexArray, attribute, accessor, header) {
9414
9411
  value = attribute;
9415
9412
  size = attribute.length;
9416
9413
  type = String(attribute.constructor.name).replace("Array", "");
9417
- isInteger2 = type.indexOf("nt") !== -1;
9414
+ isInteger = type.indexOf("nt") !== -1;
9418
9415
  return {
9419
9416
  [header]: "".concat(formatValue$1(value, {
9420
9417
  size,
9421
- isInteger: isInteger2
9418
+ isInteger
9422
9419
  }), " (constant)"),
9423
9420
  "Format ": "".concat(size, "x").concat(type, " (constant)")
9424
9421
  };
@@ -10737,8 +10734,8 @@ function formatValue(value, {
10737
10734
  function isArray$3(value) {
10738
10735
  return Array.isArray(value) || ArrayBuffer.isView(value) && !(value instanceof DataView);
10739
10736
  }
10740
- function clone$6(array2) {
10741
- return "clone" in array2 ? array2.clone() : array2.slice();
10737
+ function clone$6(array) {
10738
+ return "clone" in array ? array.clone() : array.slice();
10742
10739
  }
10743
10740
  function toRadians(degrees2) {
10744
10741
  return radians$1(degrees2);
@@ -10852,14 +10849,14 @@ function withEpsilon(epsilon3, func) {
10852
10849
  function round$1(value) {
10853
10850
  return Math.round(value / config.EPSILON) * config.EPSILON;
10854
10851
  }
10855
- function duplicateArray(array2) {
10856
- return array2.clone ? array2.clone() : new Array(array2.length);
10852
+ function duplicateArray(array) {
10853
+ return array.clone ? array.clone() : new Array(array.length);
10857
10854
  }
10858
10855
  function map(value, func, result) {
10859
10856
  if (isArray$3(value)) {
10860
- const array2 = value;
10861
- result = result || duplicateArray(array2);
10862
- for (let i2 = 0; i2 < result.length && i2 < array2.length; ++i2) {
10857
+ const array = value;
10858
+ result = result || duplicateArray(array);
10859
+ for (let i2 = 0; i2 < result.length && i2 < array.length; ++i2) {
10863
10860
  result[i2] = func(value[i2], i2, result);
10864
10861
  }
10865
10862
  return result;
@@ -10891,9 +10888,9 @@ class MathArray extends _extendableBuiltin(Array) {
10891
10888
  clone() {
10892
10889
  return new this.constructor().copy(this);
10893
10890
  }
10894
- fromArray(array2, offset = 0) {
10891
+ fromArray(array, offset = 0) {
10895
10892
  for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
10896
- this[i2] = array2[i2 + offset];
10893
+ this[i2] = array[i2 + offset];
10897
10894
  }
10898
10895
  return this.check();
10899
10896
  }
@@ -10928,23 +10925,23 @@ class MathArray extends _extendableBuiltin(Array) {
10928
10925
  }
10929
10926
  return "".concat(opts2.printTypes ? this.constructor.name : "", "[").concat(string, "]");
10930
10927
  }
10931
- equals(array2) {
10932
- if (!array2 || this.length !== array2.length) {
10928
+ equals(array) {
10929
+ if (!array || this.length !== array.length) {
10933
10930
  return false;
10934
10931
  }
10935
10932
  for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
10936
- if (!equals$3(this[i2], array2[i2])) {
10933
+ if (!equals$3(this[i2], array[i2])) {
10937
10934
  return false;
10938
10935
  }
10939
10936
  }
10940
10937
  return true;
10941
10938
  }
10942
- exactEquals(array2) {
10943
- if (!array2 || this.length !== array2.length) {
10939
+ exactEquals(array) {
10940
+ if (!array || this.length !== array.length) {
10944
10941
  return false;
10945
10942
  }
10946
10943
  for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
10947
- if (this[i2] !== array2[i2]) {
10944
+ if (this[i2] !== array[i2]) {
10948
10945
  return false;
10949
10946
  }
10950
10947
  }
@@ -11132,11 +11129,11 @@ class Vector extends MathArray {
11132
11129
  return checkNumber(length2);
11133
11130
  }
11134
11131
  dot(mathArray) {
11135
- let product2 = 0;
11132
+ let product = 0;
11136
11133
  for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
11137
- product2 += this[i2] * mathArray[i2];
11134
+ product += this[i2] * mathArray[i2];
11138
11135
  }
11139
- return checkNumber(product2);
11136
+ return checkNumber(product);
11140
11137
  }
11141
11138
  normalize() {
11142
11139
  const length2 = this.magnitude();
@@ -11204,7 +11201,7 @@ if (!Math.hypot)
11204
11201
  }
11205
11202
  return Math.sqrt(y2);
11206
11203
  };
11207
- function create$5() {
11204
+ function create$4() {
11208
11205
  var out = new ARRAY_TYPE(2);
11209
11206
  if (ARRAY_TYPE != Float32Array) {
11210
11207
  out[0] = 0;
@@ -11269,7 +11266,7 @@ function transformMat4$2(out, a2, m) {
11269
11266
  }
11270
11267
  var sub$1 = subtract$1;
11271
11268
  (function() {
11272
- var vec = create$5();
11269
+ var vec = create$4();
11273
11270
  return function(a2, stride, offset, count2, fn, arg) {
11274
11271
  var i2, l2;
11275
11272
  if (!stride) {
@@ -11357,9 +11354,9 @@ class Vector2 extends Vector {
11357
11354
  this[1] = y2;
11358
11355
  return this.check();
11359
11356
  }
11360
- copy(array2) {
11361
- this[0] = array2[0];
11362
- this[1] = array2[1];
11357
+ copy(array) {
11358
+ this[0] = array[0];
11359
+ this[1] = array[1];
11363
11360
  return this.check();
11364
11361
  }
11365
11362
  fromObject(object2) {
@@ -11409,7 +11406,7 @@ class Vector2 extends Vector {
11409
11406
  return this.check();
11410
11407
  }
11411
11408
  }
11412
- function create$4() {
11409
+ function create$3() {
11413
11410
  var out = new ARRAY_TYPE(3);
11414
11411
  if (ARRAY_TYPE != Float32Array) {
11415
11412
  out[0] = 0;
@@ -11575,7 +11572,7 @@ var mul = multiply$3;
11575
11572
  var len = length$4;
11576
11573
  var sqrLen = squaredLength$2;
11577
11574
  (function() {
11578
- var vec = create$4();
11575
+ var vec = create$3();
11579
11576
  return function(a2, stride, offset, count2, fn, arg) {
11580
11577
  var i2, l2;
11581
11578
  if (!stride) {
@@ -11632,10 +11629,10 @@ class Vector3 extends Vector {
11632
11629
  this[2] = z2;
11633
11630
  return this.check();
11634
11631
  }
11635
- copy(array2) {
11636
- this[0] = array2[0];
11637
- this[1] = array2[1];
11638
- this[2] = array2[2];
11632
+ copy(array) {
11633
+ this[0] = array[0];
11634
+ this[1] = array[1];
11635
+ this[2] = array[2];
11639
11636
  return this.check();
11640
11637
  }
11641
11638
  fromObject(object2) {
@@ -11749,11 +11746,11 @@ class Vector4 extends Vector {
11749
11746
  this[3] = w2;
11750
11747
  return this.check();
11751
11748
  }
11752
- copy(array2) {
11753
- this[0] = array2[0];
11754
- this[1] = array2[1];
11755
- this[2] = array2[2];
11756
- this[3] = array2[3];
11749
+ copy(array) {
11750
+ this[0] = array[0];
11751
+ this[1] = array[1];
11752
+ this[2] = array[2];
11753
+ this[3] = array[3];
11757
11754
  return this.check();
11758
11755
  }
11759
11756
  fromObject(object2) {
@@ -11856,7 +11853,7 @@ class Matrix extends MathArray {
11856
11853
  return this;
11857
11854
  }
11858
11855
  }
11859
- function create$3() {
11856
+ function create$2() {
11860
11857
  var out = new ARRAY_TYPE(9);
11861
11858
  if (ARRAY_TYPE != Float32Array) {
11862
11859
  out[1] = 0;
@@ -12033,26 +12030,26 @@ class Matrix3 extends Matrix {
12033
12030
  get INDICES() {
12034
12031
  return INDICES$1;
12035
12032
  }
12036
- constructor(array2, ...args) {
12033
+ constructor(array, ...args) {
12037
12034
  super(-0, -0, -0, -0, -0, -0, -0, -0, -0);
12038
- if (arguments.length === 1 && Array.isArray(array2)) {
12039
- this.copy(array2);
12035
+ if (arguments.length === 1 && Array.isArray(array)) {
12036
+ this.copy(array);
12040
12037
  } else if (args.length > 0) {
12041
- this.copy([array2, ...args]);
12038
+ this.copy([array, ...args]);
12042
12039
  } else {
12043
12040
  this.identity();
12044
12041
  }
12045
12042
  }
12046
- copy(array2) {
12047
- this[0] = array2[0];
12048
- this[1] = array2[1];
12049
- this[2] = array2[2];
12050
- this[3] = array2[3];
12051
- this[4] = array2[4];
12052
- this[5] = array2[5];
12053
- this[6] = array2[6];
12054
- this[7] = array2[7];
12055
- this[8] = array2[8];
12043
+ copy(array) {
12044
+ this[0] = array[0];
12045
+ this[1] = array[1];
12046
+ this[2] = array[2];
12047
+ this[3] = array[3];
12048
+ this[4] = array[4];
12049
+ this[5] = array[5];
12050
+ this[6] = array[6];
12051
+ this[7] = array[7];
12052
+ this[8] = array[8];
12056
12053
  return this.check();
12057
12054
  }
12058
12055
  identity() {
@@ -12732,7 +12729,7 @@ function equals$2(a2, b) {
12732
12729
  var b12 = b[12], b13 = b[13], b14 = b[14], b15 = b[15];
12733
12730
  return Math.abs(a0 - b0) <= EPSILON$3 * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON$3 * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a22 - b2) <= EPSILON$3 * Math.max(1, Math.abs(a22), Math.abs(b2)) && Math.abs(a3 - b3) <= EPSILON$3 * Math.max(1, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= EPSILON$3 * Math.max(1, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= EPSILON$3 * Math.max(1, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= EPSILON$3 * Math.max(1, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= EPSILON$3 * Math.max(1, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= EPSILON$3 * Math.max(1, Math.abs(a8), Math.abs(b8)) && Math.abs(a9 - b9) <= EPSILON$3 * Math.max(1, Math.abs(a9), Math.abs(b9)) && Math.abs(a10 - b10) <= EPSILON$3 * Math.max(1, Math.abs(a10), Math.abs(b10)) && Math.abs(a11 - b11) <= EPSILON$3 * Math.max(1, Math.abs(a11), Math.abs(b11)) && Math.abs(a12 - b12) <= EPSILON$3 * Math.max(1, Math.abs(a12), Math.abs(b12)) && Math.abs(a13 - b13) <= EPSILON$3 * Math.max(1, Math.abs(a13), Math.abs(b13)) && Math.abs(a14 - b14) <= EPSILON$3 * Math.max(1, Math.abs(a14), Math.abs(b14)) && Math.abs(a15 - b15) <= EPSILON$3 * Math.max(1, Math.abs(a15), Math.abs(b15));
12734
12731
  }
12735
- function create$2() {
12732
+ function create$1() {
12736
12733
  var out = new ARRAY_TYPE(4);
12737
12734
  if (ARRAY_TYPE != Float32Array) {
12738
12735
  out[0] = 0;
@@ -12821,7 +12818,7 @@ function transformQuat(out, a2, q) {
12821
12818
  return out;
12822
12819
  }
12823
12820
  (function() {
12824
- var vec = create$2();
12821
+ var vec = create$1();
12825
12822
  return function(a2, stride, offset, count2, fn, arg) {
12826
12823
  var i2, l2;
12827
12824
  if (!stride) {
@@ -12889,31 +12886,31 @@ class Matrix4 extends Matrix {
12889
12886
  get INDICES() {
12890
12887
  return INDICES;
12891
12888
  }
12892
- constructor(array2) {
12889
+ constructor(array) {
12893
12890
  super(-0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0);
12894
- if (arguments.length === 1 && Array.isArray(array2)) {
12895
- this.copy(array2);
12891
+ if (arguments.length === 1 && Array.isArray(array)) {
12892
+ this.copy(array);
12896
12893
  } else {
12897
12894
  this.identity();
12898
12895
  }
12899
12896
  }
12900
- copy(array2) {
12901
- this[0] = array2[0];
12902
- this[1] = array2[1];
12903
- this[2] = array2[2];
12904
- this[3] = array2[3];
12905
- this[4] = array2[4];
12906
- this[5] = array2[5];
12907
- this[6] = array2[6];
12908
- this[7] = array2[7];
12909
- this[8] = array2[8];
12910
- this[9] = array2[9];
12911
- this[10] = array2[10];
12912
- this[11] = array2[11];
12913
- this[12] = array2[12];
12914
- this[13] = array2[13];
12915
- this[14] = array2[14];
12916
- this[15] = array2[15];
12897
+ copy(array) {
12898
+ this[0] = array[0];
12899
+ this[1] = array[1];
12900
+ this[2] = array[2];
12901
+ this[3] = array[3];
12902
+ this[4] = array[4];
12903
+ this[5] = array[5];
12904
+ this[6] = array[6];
12905
+ this[7] = array[7];
12906
+ this[8] = array[8];
12907
+ this[9] = array[9];
12908
+ this[10] = array[10];
12909
+ this[11] = array[11];
12910
+ this[12] = array[12];
12911
+ this[13] = array[13];
12912
+ this[14] = array[14];
12913
+ this[15] = array[15];
12917
12914
  return this.check();
12918
12915
  }
12919
12916
  set(m00, m10, m20, m30, m01, m11, m21, m31, m02, m12, m22, m32, m03, m13, m23, m33) {
@@ -13257,7 +13254,7 @@ function computeInfinitePerspectiveOffCenter(result, left, right, bottom, top, n
13257
13254
  result[15] = 0;
13258
13255
  return result;
13259
13256
  }
13260
- function create$1() {
13257
+ function create() {
13261
13258
  var out = new ARRAY_TYPE(4);
13262
13259
  if (ARRAY_TYPE != Float32Array) {
13263
13260
  out[0] = 0;
@@ -13409,7 +13406,7 @@ var length$2 = length$3;
13409
13406
  var squaredLength = squaredLength$1;
13410
13407
  var normalize$2 = normalize$3;
13411
13408
  var rotationTo = function() {
13412
- var tmpvec3 = create$4();
13409
+ var tmpvec3 = create$3();
13413
13410
  var xUnitVec3 = fromValues(1, 0, 0);
13414
13411
  var yUnitVec3 = fromValues(0, 1, 0);
13415
13412
  return function(out, a2, b) {
@@ -13438,8 +13435,8 @@ var rotationTo = function() {
13438
13435
  };
13439
13436
  }();
13440
13437
  (function() {
13441
- var temp1 = create$1();
13442
- var temp2 = create$1();
13438
+ var temp1 = create();
13439
+ var temp2 = create();
13443
13440
  return function(out, a2, b, c, d, t2) {
13444
13441
  slerp(temp1, a2, d, t2);
13445
13442
  slerp(temp2, b, c, t2);
@@ -13448,7 +13445,7 @@ var rotationTo = function() {
13448
13445
  };
13449
13446
  })();
13450
13447
  (function() {
13451
- var matr = create$3();
13448
+ var matr = create$2();
13452
13449
  return function(out, view, right, up) {
13453
13450
  matr[0] = right[0];
13454
13451
  matr[3] = right[1];
@@ -13472,11 +13469,11 @@ class Quaternion extends MathArray {
13472
13469
  this.set(x2, y2, z2, w2);
13473
13470
  }
13474
13471
  }
13475
- copy(array2) {
13476
- this[0] = array2[0];
13477
- this[1] = array2[1];
13478
- this[2] = array2[2];
13479
- this[3] = array2[3];
13472
+ copy(array) {
13473
+ this[0] = array[0];
13474
+ this[1] = array[1];
13475
+ this[2] = array[2];
13476
+ this[3] = array[3];
13480
13477
  return this.check();
13481
13478
  }
13482
13479
  set(x2, y2, z2, w2) {
@@ -13837,11 +13834,11 @@ class Euler extends MathArray {
13837
13834
  fromObject(object2) {
13838
13835
  throw new Error("not implemented");
13839
13836
  }
13840
- copy(array2) {
13841
- this[0] = array2[0];
13842
- this[1] = array2[1];
13843
- this[2] = array2[2];
13844
- this[3] = Number.isFinite(array2[3]) || this.order;
13837
+ copy(array) {
13838
+ this[0] = array[0];
13839
+ this[1] = array[1];
13840
+ this[2] = array[2];
13841
+ this[3] = Number.isFinite(array[3]) || this.order;
13845
13842
  return this.check();
13846
13843
  }
13847
13844
  set(x2 = 0, y2 = 0, z2 = 0, order) {
@@ -13854,18 +13851,18 @@ class Euler extends MathArray {
13854
13851
  validate() {
13855
13852
  return validateOrder(this[3]) && Number.isFinite(this[0]) && Number.isFinite(this[1]) && Number.isFinite(this[2]);
13856
13853
  }
13857
- toArray(array2 = [], offset = 0) {
13858
- array2[offset] = this[0];
13859
- array2[offset + 1] = this[1];
13860
- array2[offset + 2] = this[2];
13861
- return array2;
13854
+ toArray(array = [], offset = 0) {
13855
+ array[offset] = this[0];
13856
+ array[offset + 1] = this[1];
13857
+ array[offset + 2] = this[2];
13858
+ return array;
13862
13859
  }
13863
- toArray4(array2 = [], offset = 0) {
13864
- array2[offset] = this[0];
13865
- array2[offset + 1] = this[1];
13866
- array2[offset + 2] = this[2];
13867
- array2[offset + 3] = this[3];
13868
- return array2;
13860
+ toArray4(array = [], offset = 0) {
13861
+ array[offset] = this[0];
13862
+ array[offset + 1] = this[1];
13863
+ array[offset + 2] = this[2];
13864
+ array[offset + 3] = this[3];
13865
+ return array;
13869
13866
  }
13870
13867
  toVector3(result = [-0, -0, -0]) {
13871
13868
  result[0] = this[0];
@@ -13954,12 +13951,12 @@ class Euler extends MathArray {
13954
13951
  fromVector3(v, order) {
13955
13952
  return this.set(v[0], v[1], v[2], Number.isFinite(order) ? order : this[3]);
13956
13953
  }
13957
- fromArray(array2, offset = 0) {
13958
- this[0] = array2[0 + offset];
13959
- this[1] = array2[1 + offset];
13960
- this[2] = array2[2 + offset];
13961
- if (array2[3] !== void 0) {
13962
- this[3] = array2[3];
13954
+ fromArray(array, offset = 0) {
13955
+ this[0] = array[0 + offset];
13956
+ this[1] = array[1 + offset];
13957
+ this[2] = array[2 + offset];
13958
+ if (array[3] !== void 0) {
13959
+ this[3] = array[3];
13963
13960
  }
13964
13961
  return this.check();
13965
13962
  }
@@ -15706,8 +15703,8 @@ class TextureTransform {
15706
15703
  return;
15707
15704
  }
15708
15705
  const elementIds = new Float32Array(elementCount);
15709
- elementIds.forEach((_, index2, array2) => {
15710
- array2[index2] = index2;
15706
+ elementIds.forEach((_, index2, array) => {
15707
+ array[index2] = index2;
15711
15708
  });
15712
15709
  if (!this.elementIDBuffer) {
15713
15710
  this.elementIDBuffer = new Buffer$3(this.gl, {
@@ -17937,6 +17934,7 @@ const picking = {
17937
17934
  inject: {
17938
17935
  "vs:DECKGL_FILTER_GL_POSITION": "\n // for picking depth values\n picking_setPickingAttribute(position.z / position.w);\n ",
17939
17936
  "vs:DECKGL_FILTER_COLOR": "\n picking_setPickingColor(geometry.pickingColor);\n ",
17937
+ "fs:#decl": "\nuniform bool picking_uAttribute;\n ",
17940
17938
  "fs:DECKGL_FILTER_COLOR": {
17941
17939
  order: 99,
17942
17940
  injection: "\n // use highlight color if this fragment belongs to the selected object.\n color = picking_filterHighlightColor(color);\n\n // use picking color if rendering to picking FBO.\n color = picking_filterPickingColor(color);\n "
@@ -18564,11 +18562,11 @@ class TypedArrayManager {
18564
18562
  const byteLength = Type2.BYTES_PER_ELEMENT * sizeToAllocate;
18565
18563
  const i2 = pool.findIndex((b) => b.byteLength >= byteLength);
18566
18564
  if (i2 >= 0) {
18567
- const array2 = new Type2(pool.splice(i2, 1)[0], 0, sizeToAllocate);
18565
+ const array = new Type2(pool.splice(i2, 1)[0], 0, sizeToAllocate);
18568
18566
  if (initialize) {
18569
- array2.fill(0);
18567
+ array.fill(0);
18570
18568
  }
18571
- return array2;
18569
+ return array;
18572
18570
  }
18573
18571
  return new Type2(sizeToAllocate);
18574
18572
  }
@@ -18747,6 +18745,9 @@ class Viewport {
18747
18745
  this.projectFlat = this.projectFlat.bind(this);
18748
18746
  this.unprojectFlat = this.unprojectFlat.bind(this);
18749
18747
  }
18748
+ get subViewports() {
18749
+ return null;
18750
+ }
18750
18751
  get metersPerPixel() {
18751
18752
  return this.distanceScales.metersPerUnit[2] / this.scale;
18752
18753
  }
@@ -19515,16 +19516,16 @@ const COMPONENT_SYMBOL = Symbol.for("component");
19515
19516
  const ASYNC_DEFAULTS_SYMBOL = Symbol.for("asyncPropDefaults");
19516
19517
  const ASYNC_ORIGINAL_SYMBOL = Symbol.for("asyncPropOriginal");
19517
19518
  const ASYNC_RESOLVED_SYMBOL = Symbol.for("asyncPropResolved");
19518
- function flatten(array2, filter = () => true) {
19519
- if (!Array.isArray(array2)) {
19520
- return filter(array2) ? [array2] : [];
19519
+ function flatten(array, filter = () => true) {
19520
+ if (!Array.isArray(array)) {
19521
+ return filter(array) ? [array] : [];
19521
19522
  }
19522
- return flattenArray(array2, filter, []);
19523
+ return flattenArray(array, filter, []);
19523
19524
  }
19524
- function flattenArray(array2, filter, result) {
19525
+ function flattenArray(array, filter, result) {
19525
19526
  let index2 = -1;
19526
- while (++index2 < array2.length) {
19527
- const value = array2[index2];
19527
+ while (++index2 < array.length) {
19528
+ const value = array[index2];
19528
19529
  if (Array.isArray(value)) {
19529
19530
  flattenArray(value, filter, result);
19530
19531
  } else if (filter(value)) {
@@ -19594,7 +19595,7 @@ class Resource2 {
19594
19595
  const loadCount = ++this._loadCount;
19595
19596
  let loader = data;
19596
19597
  if (typeof data === "string") {
19597
- loader = load$1(data);
19598
+ loader = load(data);
19598
19599
  }
19599
19600
  if (loader instanceof Promise) {
19600
19601
  this.isLoaded = false;
@@ -25246,9 +25247,9 @@ const MOUSE_INPUT_MAP = {
25246
25247
  mousemove: INPUT_MOVE,
25247
25248
  mouseup: INPUT_END
25248
25249
  };
25249
- function some(array2, predict) {
25250
- for (let i2 = 0; i2 < array2.length; i2++) {
25251
- if (predict(array2[i2])) {
25250
+ function some(array, predict) {
25251
+ for (let i2 = 0; i2 < array.length; i2++) {
25252
+ if (predict(array[i2])) {
25252
25253
  return true;
25253
25254
  }
25254
25255
  }
@@ -27671,7 +27672,7 @@ class Attribute extends DataColumn {
27671
27672
  const {
27672
27673
  startIndices
27673
27674
  } = this;
27674
- const vertexIndex = startIndices ? startIndices[row] : row;
27675
+ const vertexIndex = startIndices ? row < startIndices.length ? startIndices[row] : this.numInstances : row;
27675
27676
  return vertexIndex * this.size;
27676
27677
  }
27677
27678
  getShaderAttributes() {
@@ -29534,7 +29535,7 @@ const defaultProps$L = {
29534
29535
  if (!inResourceManager && !loadOptions) {
29535
29536
  resourceManager.add({
29536
29537
  resourceId: url,
29537
- data: load$1(url, loaders),
29538
+ data: load(url, loaders),
29538
29539
  persistent: false
29539
29540
  });
29540
29541
  inResourceManager = true;
@@ -29550,7 +29551,7 @@ const defaultProps$L = {
29550
29551
  requestId: propName
29551
29552
  });
29552
29553
  }
29553
- return load$1(url, loaders, loadOptions);
29554
+ return load(url, loaders, loadOptions);
29554
29555
  },
29555
29556
  compare: false
29556
29557
  },
@@ -30315,7 +30316,7 @@ class Layer extends Component {
30315
30316
  if (Array.isArray(highlightColor)) {
30316
30317
  parameters.pickingHighlightColor = highlightColor;
30317
30318
  }
30318
- if (Number.isInteger(highlightedObjectIndex)) {
30319
+ if (forceUpdate || highlightedObjectIndex !== oldProps.highlightedObjectIndex) {
30319
30320
  parameters.pickingSelectedColor = Number.isFinite(highlightedObjectIndex) && highlightedObjectIndex >= 0 ? this.encodePickingColor(highlightedObjectIndex) : null;
30320
30321
  }
30321
30322
  this.setModuleParameters(parameters);
@@ -31678,7 +31679,7 @@ function interpolateQuad(quad, ut, vt) {
31678
31679
  }
31679
31680
  const vs$g = "\n#define SHADER_NAME bitmap-layer-vertex-shader\n\nattribute vec2 texCoords;\nattribute vec3 positions;\nattribute vec3 positions64Low;\n\nvarying vec2 vTexCoord;\nvarying vec2 vTexPos;\n\nuniform float coordinateConversion;\n\nconst vec3 pickingColor = vec3(1.0, 0.0, 0.0);\n\nvoid main(void) {\n geometry.worldPosition = positions;\n geometry.uv = texCoords;\n geometry.pickingColor = pickingColor;\n\n gl_Position = project_position_to_clipspace(positions, positions64Low, vec3(0.0), geometry.position);\n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n\n vTexCoord = texCoords;\n\n if (coordinateConversion < -0.5) {\n vTexPos = geometry.position.xy + project_uCommonOrigin.xy;\n } else if (coordinateConversion > 0.5) {\n vTexPos = geometry.worldPosition.xy;\n }\n\n vec4 color = vec4(0.0);\n DECKGL_FILTER_COLOR(color, geometry);\n}\n";
31680
31681
  const packUVsIntoRGB = "\nvec3 packUVsIntoRGB(vec2 uv) {\n // Extract the top 8 bits. We want values to be truncated down so we can add a fraction\n vec2 uv8bit = floor(uv * 256.);\n\n // Calculate the normalized remainders of u and v parts that do not fit into 8 bits\n // Scale and clamp to 0-1 range\n vec2 uvFraction = fract(uv * 256.);\n vec2 uvFraction4bit = floor(uvFraction * 16.);\n\n // Remainder can be encoded in blue channel, encode as 4 bits for pixel coordinates\n float fractions = uvFraction4bit.x + uvFraction4bit.y * 16.;\n\n return vec3(uv8bit, fractions) / 255.;\n}\n";
31681
- const fs$i = "\n#define SHADER_NAME bitmap-layer-fragment-shader\n\n#ifdef GL_ES\nprecision highp float;\n#endif\n\nuniform sampler2D bitmapTexture;\n\nvarying vec2 vTexCoord;\nvarying vec2 vTexPos;\n\nuniform float desaturate;\nuniform vec4 transparentColor;\nuniform vec3 tintColor;\nuniform float opacity;\n\nuniform float coordinateConversion;\nuniform vec4 bounds;\n\n/* projection utils */\nconst float TILE_SIZE = 512.0;\nconst float PI = 3.1415926536;\nconst float WORLD_SCALE = TILE_SIZE / PI / 2.0;\n\n// from degrees to Web Mercator\nvec2 lnglat_to_mercator(vec2 lnglat) {\n float x = lnglat.x;\n float y = clamp(lnglat.y, -89.9, 89.9);\n return vec2(\n radians(x) + PI,\n PI + log(tan(PI * 0.25 + radians(y) * 0.5))\n ) * WORLD_SCALE;\n}\n\n// from Web Mercator to degrees\nvec2 mercator_to_lnglat(vec2 xy) {\n xy /= WORLD_SCALE;\n return degrees(vec2(\n xy.x - PI,\n atan(exp(xy.y - PI)) * 2.0 - PI * 0.5\n ));\n}\n/* End projection utils */\n\n// apply desaturation\nvec3 color_desaturate(vec3 color) {\n float luminance = (color.r + color.g + color.b) * 0.333333333;\n return mix(color, vec3(luminance), desaturate);\n}\n\n// apply tint\nvec3 color_tint(vec3 color) {\n return color * tintColor;\n}\n\n// blend with background color\nvec4 apply_opacity(vec3 color, float alpha) {\n return mix(transparentColor, vec4(color, 1.0), alpha);\n}\n\nvec2 getUV(vec2 pos) {\n return vec2(\n (pos.x - bounds[0]) / (bounds[2] - bounds[0]),\n (pos.y - bounds[3]) / (bounds[1] - bounds[3])\n );\n}\n\n".concat(packUVsIntoRGB, "\n\nvoid main(void) {\n vec2 uv = vTexCoord;\n if (coordinateConversion < -0.5) {\n vec2 lnglat = mercator_to_lnglat(vTexPos);\n uv = getUV(lnglat);\n } else if (coordinateConversion > 0.5) {\n vec2 commonPos = lnglat_to_mercator(vTexPos);\n uv = getUV(commonPos);\n }\n vec4 bitmapColor = texture2D(bitmapTexture, uv);\n\n gl_FragColor = apply_opacity(color_tint(color_desaturate(bitmapColor.rgb)), bitmapColor.a * opacity);\n\n geometry.uv = uv;\n DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n\n if (picking_uActive) {\n // Since instance information is not used, we can use picking color for pixel index\n gl_FragColor.rgb = packUVsIntoRGB(uv);\n }\n}\n");
31682
+ const fs$i = "\n#define SHADER_NAME bitmap-layer-fragment-shader\n\n#ifdef GL_ES\nprecision highp float;\n#endif\n\nuniform sampler2D bitmapTexture;\n\nvarying vec2 vTexCoord;\nvarying vec2 vTexPos;\n\nuniform float desaturate;\nuniform vec4 transparentColor;\nuniform vec3 tintColor;\nuniform float opacity;\n\nuniform float coordinateConversion;\nuniform vec4 bounds;\n\n/* projection utils */\nconst float TILE_SIZE = 512.0;\nconst float PI = 3.1415926536;\nconst float WORLD_SCALE = TILE_SIZE / PI / 2.0;\n\n// from degrees to Web Mercator\nvec2 lnglat_to_mercator(vec2 lnglat) {\n float x = lnglat.x;\n float y = clamp(lnglat.y, -89.9, 89.9);\n return vec2(\n radians(x) + PI,\n PI + log(tan(PI * 0.25 + radians(y) * 0.5))\n ) * WORLD_SCALE;\n}\n\n// from Web Mercator to degrees\nvec2 mercator_to_lnglat(vec2 xy) {\n xy /= WORLD_SCALE;\n return degrees(vec2(\n xy.x - PI,\n atan(exp(xy.y - PI)) * 2.0 - PI * 0.5\n ));\n}\n/* End projection utils */\n\n// apply desaturation\nvec3 color_desaturate(vec3 color) {\n float luminance = (color.r + color.g + color.b) * 0.333333333;\n return mix(color, vec3(luminance), desaturate);\n}\n\n// apply tint\nvec3 color_tint(vec3 color) {\n return color * tintColor;\n}\n\n// blend with background color\nvec4 apply_opacity(vec3 color, float alpha) {\n return mix(transparentColor, vec4(color, 1.0), alpha);\n}\n\nvec2 getUV(vec2 pos) {\n return vec2(\n (pos.x - bounds[0]) / (bounds[2] - bounds[0]),\n (pos.y - bounds[3]) / (bounds[1] - bounds[3])\n );\n}\n\n".concat(packUVsIntoRGB, "\n\nvoid main(void) {\n vec2 uv = vTexCoord;\n if (coordinateConversion < -0.5) {\n vec2 lnglat = mercator_to_lnglat(vTexPos);\n uv = getUV(lnglat);\n } else if (coordinateConversion > 0.5) {\n vec2 commonPos = lnglat_to_mercator(vTexPos);\n uv = getUV(commonPos);\n }\n vec4 bitmapColor = texture2D(bitmapTexture, uv);\n\n gl_FragColor = apply_opacity(color_tint(color_desaturate(bitmapColor.rgb)), bitmapColor.a * opacity);\n\n geometry.uv = uv;\n DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n\n if (picking_uActive && !picking_uAttribute) {\n // Since instance information is not used, we can use picking color for pixel index\n gl_FragColor.rgb = packUVsIntoRGB(uv);\n }\n}\n");
31682
31683
  const defaultProps$I = {
31683
31684
  image: {
31684
31685
  type: "image",
@@ -32166,7 +32167,7 @@ class IconManager {
32166
32167
  const ctx = this._canvas.getContext("2d");
32167
32168
  for (const icon of icons) {
32168
32169
  this._pendingCount++;
32169
- load$1(icon.url, ImageLoader, this._loadOptions).then((imageData) => {
32170
+ load(icon.url, ImageLoader, this._loadOptions).then((imageData) => {
32170
32171
  const id = getIconId(icon);
32171
32172
  const {
32172
32173
  x: x2,
@@ -39821,18 +39822,22 @@ function getBoundingBox(viewport, zRange, extent2) {
39821
39822
  }
39822
39823
  function getCullBounds({
39823
39824
  viewport,
39824
- z: z2,
39825
+ z: z2 = 0,
39825
39826
  cullRect
39826
39827
  }) {
39827
- const x2 = cullRect.x - viewport.x;
39828
- const y2 = cullRect.y - viewport.y;
39829
- const {
39830
- width,
39831
- height
39832
- } = cullRect;
39828
+ const subViewports = viewport.subViewports || [viewport];
39829
+ return subViewports.map((v) => getCullBoundsInViewport(v, z2, cullRect));
39830
+ }
39831
+ function getCullBoundsInViewport(viewport, z2, cullRect) {
39833
39832
  if (!Array.isArray(z2)) {
39833
+ const x2 = cullRect.x - viewport.x;
39834
+ const y2 = cullRect.y - viewport.y;
39835
+ const {
39836
+ width,
39837
+ height
39838
+ } = cullRect;
39834
39839
  const unprojectOption = {
39835
- targetZ: z2 || 0
39840
+ targetZ: z2
39836
39841
  };
39837
39842
  const topLeft = viewport.unproject([x2, y2], unprojectOption);
39838
39843
  const topRight = viewport.unproject([x2 + width, y2], unprojectOption);
@@ -39840,16 +39845,8 @@ function getCullBounds({
39840
39845
  const bottomRight = viewport.unproject([x2 + width, y2 + height], unprojectOption);
39841
39846
  return [Math.min(topLeft[0], topRight[0], bottomLeft[0], bottomRight[0]), Math.min(topLeft[1], topRight[1], bottomLeft[1], bottomRight[1]), Math.max(topLeft[0], topRight[0], bottomLeft[0], bottomRight[0]), Math.max(topLeft[1], topRight[1], bottomLeft[1], bottomRight[1])];
39842
39847
  }
39843
- const bounds0 = getCullBounds({
39844
- viewport,
39845
- z: z2[0],
39846
- cullRect
39847
- });
39848
- const bounds1 = getCullBounds({
39849
- viewport,
39850
- z: z2[1],
39851
- cullRect
39852
- });
39848
+ const bounds0 = getCullBoundsInViewport(viewport, z2[0], cullRect);
39849
+ const bounds1 = getCullBoundsInViewport(viewport, z2[1], cullRect);
39853
39850
  return [Math.min(bounds0[0], bounds1[0]), Math.min(bounds0[1], bounds1[1]), Math.max(bounds0[2], bounds1[2]), Math.max(bounds0[3], bounds1[3])];
39854
39851
  }
39855
39852
  function getIndexingCoords(bbox2, scale2, modelMatrixInverse) {
@@ -40079,7 +40076,7 @@ class Tileset2D {
40079
40076
  return false;
40080
40077
  }
40081
40078
  if (cullRect && this._viewport) {
40082
- const [minX, minY, maxX, maxY] = getCullBounds({
40079
+ const boundsArr = this._getCullBounds({
40083
40080
  viewport: this._viewport,
40084
40081
  z: this._zRange,
40085
40082
  cullRect
@@ -40087,12 +40084,20 @@ class Tileset2D {
40087
40084
  const {
40088
40085
  bbox: bbox2
40089
40086
  } = tile;
40090
- if ("west" in bbox2) {
40091
- return bbox2.west < maxX && bbox2.east > minX && bbox2.south < maxY && bbox2.north > minY;
40087
+ for (const [minX, minY, maxX, maxY] of boundsArr) {
40088
+ let overlaps;
40089
+ if ("west" in bbox2) {
40090
+ overlaps = bbox2.west < maxX && bbox2.east > minX && bbox2.south < maxY && bbox2.north > minY;
40091
+ } else {
40092
+ const y02 = Math.min(bbox2.top, bbox2.bottom);
40093
+ const y12 = Math.max(bbox2.top, bbox2.bottom);
40094
+ overlaps = bbox2.left < maxX && bbox2.right > minX && y02 < maxY && y12 > minY;
40095
+ }
40096
+ if (overlaps) {
40097
+ return true;
40098
+ }
40092
40099
  }
40093
- const y02 = Math.min(bbox2.top, bbox2.bottom);
40094
- const y12 = Math.max(bbox2.top, bbox2.bottom);
40095
- return bbox2.left < maxX && bbox2.right > minX && y02 < maxY && y12 > minY;
40100
+ return false;
40096
40101
  }
40097
40102
  return true;
40098
40103
  }
@@ -40541,14 +40546,19 @@ class TileLayer extends CompositeLayer {
40541
40546
  info,
40542
40547
  sourceLayer
40543
40548
  }) {
40549
+ const sourceTile = sourceLayer.props.tile;
40544
40550
  if (info.picked) {
40545
- info.tile = sourceLayer.props.tile;
40551
+ info.tile = sourceTile;
40546
40552
  }
40553
+ info.sourceTile = sourceTile;
40547
40554
  return info;
40548
40555
  }
40549
40556
  _updateAutoHighlight(info) {
40550
- if (info.sourceLayer) {
40551
- info.sourceLayer.updateAutoHighlight(info);
40557
+ const sourceTile = info.sourceTile;
40558
+ if (sourceTile && sourceTile.layers) {
40559
+ for (const layer of sourceTile.layers) {
40560
+ layer.updateAutoHighlight(info);
40561
+ }
40552
40562
  }
40553
40563
  }
40554
40564
  renderLayers() {
@@ -40933,8 +40943,8 @@ var libh3 = function(libh32) {
40933
40943
  return stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite);
40934
40944
  }
40935
40945
  typeof TextDecoder !== "undefined" ? new TextDecoder("utf-16le") : void 0;
40936
- function writeArrayToMemory(array2, buffer3) {
40937
- HEAP8.set(array2, buffer3);
40946
+ function writeArrayToMemory(array, buffer3) {
40947
+ HEAP8.set(array, buffer3);
40938
40948
  }
40939
40949
  function alignUp(x2, multiple) {
40940
40950
  if (x2 % multiple > 0) {
@@ -52866,6 +52876,9 @@ class ScenegraphNode {
52866
52876
  toString() {
52867
52877
  return "{type: ScenegraphNode, id: ".concat(this.id, ")}");
52868
52878
  }
52879
+ getBounds() {
52880
+ return null;
52881
+ }
52869
52882
  setPosition(position) {
52870
52883
  assert$8(position.length === 3, "setPosition requires vector argument");
52871
52884
  this.position = position;
@@ -53016,6 +53029,34 @@ class GroupNode extends ScenegraphNode {
53016
53029
  this.removeAll();
53017
53030
  super.delete();
53018
53031
  }
53032
+ getBounds() {
53033
+ const result = [[Infinity, Infinity, Infinity], [-Infinity, -Infinity, -Infinity]];
53034
+ this.traverse((node, _ref) => {
53035
+ let {
53036
+ worldMatrix
53037
+ } = _ref;
53038
+ const bounds2 = node.getBounds();
53039
+ if (!bounds2) {
53040
+ return;
53041
+ }
53042
+ const [min, max] = bounds2;
53043
+ const center2 = new Vector3(min).add(max).divide([2, 2, 2]);
53044
+ worldMatrix.transformAsPoint(center2, center2);
53045
+ const halfSize = new Vector3(max).subtract(min).divide([2, 2, 2]);
53046
+ worldMatrix.transformAsVector(halfSize, halfSize);
53047
+ for (let v = 0; v < 8; v++) {
53048
+ const position = new Vector3(v & 1 ? -1 : 1, v & 2 ? -1 : 1, v & 4 ? -1 : 1).multiply(halfSize).add(center2);
53049
+ for (let i2 = 0; i2 < 3; i2++) {
53050
+ result[0][i2] = Math.min(result[0][i2], position[i2]);
53051
+ result[1][i2] = Math.max(result[1][i2], position[i2]);
53052
+ }
53053
+ }
53054
+ });
53055
+ if (!Number.isFinite(result[0][0])) {
53056
+ return null;
53057
+ }
53058
+ return result;
53059
+ }
53019
53060
  traverse(visitor) {
53020
53061
  let {
53021
53062
  worldMatrix = new Matrix4()
@@ -53060,13 +53101,13 @@ function accessorToJsArray(accessor) {
53060
53101
  buffer: buffer2,
53061
53102
  byteOffset
53062
53103
  } = accessor.bufferView.data;
53063
- const array2 = new ArrayType(buffer2, byteOffset + (accessor.byteOffset || 0), length2);
53104
+ const array = new ArrayType(buffer2, byteOffset + (accessor.byteOffset || 0), length2);
53064
53105
  if (components === 1) {
53065
- accessor._animation = Array.from(array2);
53106
+ accessor._animation = Array.from(array);
53066
53107
  } else {
53067
53108
  const slicedArray = [];
53068
- for (let i2 = 0; i2 < array2.length; i2 += components) {
53069
- slicedArray.push(Array.from(array2.slice(i2, i2 + components)));
53109
+ for (let i2 = 0; i2 < array.length; i2 += components) {
53110
+ slicedArray.push(Array.from(array.slice(i2, i2 + components)));
53070
53111
  }
53071
53112
  accessor._animation = slicedArray;
53072
53113
  }
@@ -53265,6 +53306,7 @@ class ModelNode extends ScenegraphNode {
53265
53306
  } else {
53266
53307
  this.model = new Model(gl, props2);
53267
53308
  }
53309
+ this.bounds = null;
53268
53310
  this.managedResources = props2.managedResources || [];
53269
53311
  }
53270
53312
  setProps(props2) {
@@ -53272,6 +53314,9 @@ class ModelNode extends ScenegraphNode {
53272
53314
  this._setModelNodeProps(props2);
53273
53315
  return this;
53274
53316
  }
53317
+ getBounds() {
53318
+ return this.bounds;
53319
+ }
53275
53320
  delete() {
53276
53321
  if (this.model) {
53277
53322
  this.model.delete();
@@ -53456,17 +53501,21 @@ function createGLTFModel(gl, options) {
53456
53501
  const managedResources = [];
53457
53502
  managedResources.push(...materialParser.generatedTextures);
53458
53503
  managedResources.push(...Object.values(attributes).map((attribute) => attribute.buffer));
53459
- const model = new ModelNode(gl, Object.assign({
53504
+ const model = new ModelNode(gl, {
53460
53505
  id,
53461
53506
  drawMode,
53462
53507
  vertexCount,
53463
53508
  modules: [pbr],
53464
- defines: materialParser.defines,
53465
53509
  parameters: materialParser.parameters,
53466
53510
  vs: addVersionToShader(gl, vs$7),
53467
53511
  fs: addVersionToShader(gl, fs$7),
53468
- managedResources
53469
- }, modelOptions));
53512
+ managedResources,
53513
+ ...modelOptions,
53514
+ defines: {
53515
+ ...materialParser.defines,
53516
+ ...modelOptions.defines
53517
+ }
53518
+ });
53470
53519
  model.setProps({
53471
53520
  attributes
53472
53521
  });
@@ -53561,13 +53610,15 @@ class GLTFInstantiator {
53561
53610
  log$2.warn("getVertexCount() not found")();
53562
53611
  }
53563
53612
  createPrimitive(gltfPrimitive, i2, gltfMesh) {
53564
- return createGLTFModel(this.gl, Object.assign({
53613
+ const model = createGLTFModel(this.gl, Object.assign({
53565
53614
  id: gltfPrimitive.name || "".concat(gltfMesh.name || gltfMesh.id, "-primitive-").concat(i2),
53566
53615
  drawMode: gltfPrimitive.mode || 4,
53567
53616
  vertexCount: gltfPrimitive.indices ? gltfPrimitive.indices.count : this.getVertexCount(gltfPrimitive.attributes),
53568
53617
  attributes: this.createAttributes(gltfPrimitive.attributes, gltfPrimitive.indices),
53569
53618
  material: gltfPrimitive.material
53570
53619
  }, this.options));
53620
+ model.bounds = [gltfPrimitive.attributes.POSITION.min, gltfPrimitive.attributes.POSITION.max];
53621
+ return model;
53571
53622
  }
53572
53623
  createAttributes(attributes, indices) {
53573
53624
  const loadedAttributes = {};
@@ -54237,13 +54288,13 @@ class GLTFScenegraph {
54237
54288
  getBuffer(index2) {
54238
54289
  return this.getObject("buffers", index2);
54239
54290
  }
54240
- getObject(array2, index2) {
54291
+ getObject(array, index2) {
54241
54292
  if (typeof index2 === "object") {
54242
54293
  return index2;
54243
54294
  }
54244
- const object2 = this.json[array2] && this.json[array2][index2];
54295
+ const object2 = this.json[array] && this.json[array][index2];
54245
54296
  if (!object2) {
54246
- throw new Error("glTF file error: Could not find ".concat(array2, "[").concat(index2, "]"));
54297
+ throw new Error("glTF file error: Could not find ".concat(array, "[").concat(index2, "]"));
54247
54298
  }
54248
54299
  return object2;
54249
54300
  }
@@ -54498,12 +54549,12 @@ class GLTFScenegraph {
54498
54549
  this.gltf.binary = arrayBuffer2;
54499
54550
  this.sourceBuffers = [arrayBuffer2];
54500
54551
  }
54501
- _removeStringFromArray(array2, string) {
54552
+ _removeStringFromArray(array, string) {
54502
54553
  let found = true;
54503
54554
  while (found) {
54504
- const index2 = array2.indexOf(string);
54555
+ const index2 = array.indexOf(string);
54505
54556
  if (index2 > -1) {
54506
- array2.splice(index2, 1);
54557
+ array.splice(index2, 1);
54507
54558
  } else {
54508
54559
  found = false;
54509
54560
  }
@@ -55084,8 +55135,8 @@ class FixedSizeList extends DataType$2 {
55084
55135
  return "FixedSizeList[".concat(this.listSize, "]<").concat(this.valueType, ">");
55085
55136
  }
55086
55137
  }
55087
- function getArrowTypeFromTypedArray(array2) {
55088
- switch (array2.constructor) {
55138
+ function getArrowTypeFromTypedArray(array) {
55139
+ switch (array.constructor) {
55089
55140
  case Int8Array:
55090
55141
  return new Int8();
55091
55142
  case Uint8Array:
@@ -55622,17 +55673,17 @@ function getAccessorData(attribute) {
55622
55673
  count: count2
55623
55674
  };
55624
55675
  }
55625
- function toTypedArray(array2, ArrayType, convertTypedArrays = false) {
55626
- if (!array2) {
55676
+ function toTypedArray(array, ArrayType, convertTypedArrays = false) {
55677
+ if (!array) {
55627
55678
  return null;
55628
55679
  }
55629
- if (Array.isArray(array2)) {
55630
- return new ArrayType(array2);
55680
+ if (Array.isArray(array)) {
55681
+ return new ArrayType(array);
55631
55682
  }
55632
- if (convertTypedArrays && !(array2 instanceof ArrayType)) {
55633
- return new ArrayType(array2);
55683
+ if (convertTypedArrays && !(array instanceof ArrayType)) {
55684
+ return new ArrayType(array);
55634
55685
  }
55635
- return array2;
55686
+ return array;
55636
55687
  }
55637
55688
  const KHR_DRACO_MESH_COMPRESSION = "KHR_draco_mesh_compression";
55638
55689
  const name$3 = KHR_DRACO_MESH_COMPRESSION;
@@ -56267,13 +56318,13 @@ class GLTFPostProcessor {
56267
56318
  getBuffer(index2) {
56268
56319
  return this._get("buffers", index2);
56269
56320
  }
56270
- _get(array2, index2) {
56321
+ _get(array, index2) {
56271
56322
  if (typeof index2 === "object") {
56272
56323
  return index2;
56273
56324
  }
56274
- const object2 = this.json[array2] && this.json[array2][index2];
56325
+ const object2 = this.json[array] && this.json[array][index2];
56275
56326
  if (!object2) {
56276
- console.warn("glTF file error: Could not find ".concat(array2, "[").concat(index2, "]"));
56327
+ console.warn("glTF file error: Could not find ".concat(array, "[").concat(index2, "]"));
56277
56328
  }
56278
56329
  return object2;
56279
56330
  }
@@ -56685,8 +56736,8 @@ async function loadImage(gltf, image2, index2, options, context) {
56685
56736
  arrayBuffer2 = await response.arrayBuffer();
56686
56737
  }
56687
56738
  if (Number.isFinite(image2.bufferView)) {
56688
- const array2 = getTypedArrayForBufferView(gltf.json, gltf.buffers, image2.bufferView);
56689
- arrayBuffer2 = sliceArrayBuffer(array2.buffer, array2.byteOffset, array2.byteLength);
56739
+ const array = getTypedArrayForBufferView(gltf.json, gltf.buffers, image2.bufferView);
56740
+ arrayBuffer2 = sliceArrayBuffer(array.buffer, array.byteOffset, array.byteLength);
56690
56741
  }
56691
56742
  assert$3(arrayBuffer2, "glTF image has no data");
56692
56743
  let parsedImage = await parse2(arrayBuffer2, [ImageLoader, BasisLoader], {
@@ -58593,7 +58644,7 @@ class TileHeader {
58593
58644
  ...this._getLoaderSpecificOptions(loader.id)
58594
58645
  }
58595
58646
  };
58596
- this.content = await load$1(contentUrl, loader, options);
58647
+ this.content = await load(contentUrl, loader, options);
58597
58648
  if (this.tileset.options.contentLoader) {
58598
58649
  await this.tileset.options.contentLoader(this);
58599
58650
  }
@@ -58982,7 +59033,7 @@ class I3STilesetTraverser extends TilesetTraverser {
58982
59033
  loadContent: false
58983
59034
  }
58984
59035
  };
58985
- return await load$1(nodeUrl, loader, options);
59036
+ return await load(nodeUrl, loader, options);
58986
59037
  }
58987
59038
  _onTileLoad(header, tile, extendedId) {
58988
59039
  const childTile = new TileHeader(tile.tileset, header, tile, extendedId);
@@ -59789,11 +59840,11 @@ class Tile3DFeatureTable {
59789
59840
  }
59790
59841
  return typedArray;
59791
59842
  }
59792
- _getTypedArrayFromArray(propertyName, componentType, array2) {
59843
+ _getTypedArrayFromArray(propertyName, componentType, array) {
59793
59844
  const cachedTypedArrays = this._cachedTypedArrays;
59794
59845
  let typedArray = cachedTypedArrays[propertyName];
59795
59846
  if (!typedArray) {
59796
- typedArray = GLType.createTypedArray(componentType, array2);
59847
+ typedArray = GLType.createTypedArray(componentType, array);
59797
59848
  cachedTypedArrays[propertyName] = typedArray;
59798
59849
  }
59799
59850
  return typedArray;
@@ -61049,7 +61100,7 @@ async function parseImplicitTiles(params) {
61049
61100
  if (isChildSubtreeAvailable) {
61050
61101
  const subtreePath = "".concat(basePath, "/").concat(subtreesUriTemplate);
61051
61102
  const childSubtreeUrl = replaceContentUrlTemplate(subtreePath, lev, x2, y2, z2);
61052
- const childSubtree = await load$1(childSubtreeUrl, Tile3DSubtreeLoader);
61103
+ const childSubtree = await load(childSubtreeUrl, Tile3DSubtreeLoader);
61053
61104
  subtree = childSubtree;
61054
61105
  globalData.mortonIndex = childTileMortonIndex;
61055
61106
  globalData.x = childTileX;
@@ -61272,7 +61323,7 @@ async function normalizeImplicitTileHeaders(tileset) {
61272
61323
  } = implicitTilingExtension;
61273
61324
  const subtreeUrl = replaceContentUrlTemplate(subtreesUriTemplate, 0, 0, 0, 0);
61274
61325
  const rootSubtreeUrl = resolveUri(subtreeUrl, basePath);
61275
- const rootSubtree = await load$1(rootSubtreeUrl, Tile3DSubtreeLoader);
61326
+ const rootSubtree = await load(rootSubtreeUrl, Tile3DSubtreeLoader);
61276
61327
  const contentUrlTemplate = resolveUri(tileset.root.content.uri, basePath);
61277
61328
  const refine = tileset.root.refine;
61278
61329
  const rootLodMetricValue = tileset.root.geometricError;
@@ -61495,15 +61546,11 @@ class Tile3DLayer extends CompositeLayer {
61495
61546
  info,
61496
61547
  sourceLayer
61497
61548
  }) {
61498
- const {
61499
- layerMap
61500
- } = this.state;
61501
- const layerId = sourceLayer && sourceLayer.id;
61502
- if (layerId) {
61503
- const substr = layerId.substring(this.id.length + 1);
61504
- const tileId = substr.substring(substr.indexOf("-") + 1);
61505
- info.object = layerMap[tileId] && layerMap[tileId].tile;
61549
+ const sourceTile = sourceLayer && sourceLayer.props.tile;
61550
+ if (info.picked) {
61551
+ info.object = sourceTile;
61506
61552
  }
61553
+ info.sourceTile = sourceTile;
61507
61554
  return info;
61508
61555
  }
61509
61556
  filterSubLayer({
@@ -61519,8 +61566,10 @@ class Tile3DLayer extends CompositeLayer {
61519
61566
  return tile.selected && tile.viewportIds.includes(viewportId);
61520
61567
  }
61521
61568
  _updateAutoHighlight(info) {
61522
- if (info.sourceLayer) {
61523
- info.sourceLayer.updateAutoHighlight(info);
61569
+ const sourceTile = info.sourceTile;
61570
+ const layerCache = this.state.layerMap[sourceTile === null || sourceTile === void 0 ? void 0 : sourceTile.id];
61571
+ if (layerCache && layerCache.layer) {
61572
+ layerCache.layer.updateAutoHighlight(info);
61524
61573
  }
61525
61574
  }
61526
61575
  async _loadTileset(tilesetUrl) {
@@ -61546,7 +61595,7 @@ class Tile3DLayer extends CompositeLayer {
61546
61595
  }
61547
61596
  Object.assign(options, preloadOptions);
61548
61597
  }
61549
- const tilesetJson = await load$1(tilesetUrl, loader, options.loadOptions);
61598
+ const tilesetJson = await load(tilesetUrl, loader, options.loadOptions);
61550
61599
  const tileset3d = new Tileset3D(tilesetJson, {
61551
61600
  onTileLoad: this._onTileLoad.bind(this),
61552
61601
  onTileUnload: this._onTileUnload.bind(this),
@@ -64867,9 +64916,9 @@ function getGlobalFeatureId(geomData, featureIndex) {
64867
64916
  }
64868
64917
  return geomData.__ids[featureIndex];
64869
64918
  }
64870
- function findIndex(array2, predicate, startIndex, endIndex) {
64919
+ function findIndex(array, predicate, startIndex, endIndex) {
64871
64920
  for (let i2 = startIndex; i2 < endIndex; i2++) {
64872
- if (predicate(array2[i2], i2)) {
64921
+ if (predicate(array[i2], i2)) {
64873
64922
  return i2;
64874
64923
  }
64875
64924
  }
@@ -68778,7 +68827,7 @@ function bearing(start, end, options) {
68778
68827
  var b = Math.cos(lat1) * Math.sin(lat2) - Math.sin(lat1) * Math.cos(lat2) * Math.cos(lon2 - lon1);
68779
68828
  return helpers_1$g.radiansToDegrees(Math.atan2(a2, b));
68780
68829
  }
68781
- var _default$7 = js$s.default = bearing;
68830
+ var _default$4 = js$s.default = bearing;
68782
68831
  function calculateFinalBearing(start, end) {
68783
68832
  var bear = bearing(end, start);
68784
68833
  bear = (bear + 180) % 360;
@@ -68801,7 +68850,7 @@ function distance$1(from, to, options) {
68801
68850
  var a2 = Math.pow(Math.sin(dLat / 2), 2) + Math.pow(Math.sin(dLon / 2), 2) * Math.cos(lat1) * Math.cos(lat2);
68802
68851
  return helpers_1$f.radiansToLength(2 * Math.atan2(Math.sqrt(a2), Math.sqrt(1 - a2)), options.units);
68803
68852
  }
68804
- var _default$6 = js$q.default = distance$1;
68853
+ var _default$2 = js$q.default = distance$1;
68805
68854
  var js$p = {};
68806
68855
  Object.defineProperty(js$p, "__esModule", { value: true });
68807
68856
  var helpers_1$e = js$u;
@@ -68821,7 +68870,7 @@ function destination(origin, distance2, bearing2, options) {
68821
68870
  var lat = helpers_1$e.radiansToDegrees(latitude2);
68822
68871
  return helpers_1$e.point([lng, lat], options.properties);
68823
68872
  }
68824
- var _default$5 = js$p.default = destination;
68873
+ var _default$1 = js$p.default = destination;
68825
68874
  var js$o = {};
68826
68875
  const require$$0$5 = /* @__PURE__ */ getAugmentedNamespace(es$2);
68827
68876
  const require$$2$3 = /* @__PURE__ */ getAugmentedNamespace(es);
@@ -68902,7 +68951,7 @@ function intersects$4(line1, line2) {
68902
68951
  }
68903
68952
  return null;
68904
68953
  }
68905
- var _default$4 = js$o.default = lineIntersect$1;
68954
+ var _default = js$o.default = lineIntersect$1;
68906
68955
  function nearestPointOnLine$2(lines, pt, options) {
68907
68956
  if (options === void 0) {
68908
68957
  options = {};
@@ -68915,23 +68964,23 @@ function nearestPointOnLine$2(lines, pt, options) {
68915
68964
  var coords = getCoords_1(line);
68916
68965
  for (var i2 = 0; i2 < coords.length - 1; i2++) {
68917
68966
  var start = js$u.point(coords[i2]);
68918
- start.properties.dist = _default$6(pt, start, options);
68967
+ start.properties.dist = _default$2(pt, start, options);
68919
68968
  var stop_1 = js$u.point(coords[i2 + 1]);
68920
- stop_1.properties.dist = _default$6(pt, stop_1, options);
68921
- var sectionLength = _default$6(start, stop_1, options);
68969
+ stop_1.properties.dist = _default$2(pt, stop_1, options);
68970
+ var sectionLength = _default$2(start, stop_1, options);
68922
68971
  var heightDistance = Math.max(start.properties.dist, stop_1.properties.dist);
68923
- var direction = _default$7(start, stop_1);
68924
- var perpendicularPt1 = _default$5(pt, heightDistance, direction + 90, options);
68925
- var perpendicularPt2 = _default$5(pt, heightDistance, direction - 90, options);
68926
- var intersect2 = _default$4(js$u.lineString([
68972
+ var direction = _default$4(start, stop_1);
68973
+ var perpendicularPt1 = _default$1(pt, heightDistance, direction + 90, options);
68974
+ var perpendicularPt2 = _default$1(pt, heightDistance, direction - 90, options);
68975
+ var intersect2 = _default(js$u.lineString([
68927
68976
  perpendicularPt1.geometry.coordinates,
68928
68977
  perpendicularPt2.geometry.coordinates
68929
68978
  ]), js$u.lineString([start.geometry.coordinates, stop_1.geometry.coordinates]));
68930
68979
  var intersectPt = null;
68931
68980
  if (intersect2.features.length > 0) {
68932
68981
  intersectPt = intersect2.features[0];
68933
- intersectPt.properties.dist = _default$6(pt, intersectPt, options);
68934
- intersectPt.properties.location = length2 + _default$6(start, intersectPt, options);
68982
+ intersectPt.properties.dist = _default$2(pt, intersectPt, options);
68983
+ intersectPt.properties.location = length2 + _default$2(start, intersectPt, options);
68935
68984
  }
68936
68985
  if (start.properties.dist < closestPt.properties.dist) {
68937
68986
  closestPt = start;
@@ -81197,16 +81246,16 @@ function clipPolygon(segments, compareIntersection2, startInside, interpolate2,
81197
81246
  stream.lineEnd();
81198
81247
  }
81199
81248
  }
81200
- function link(array2) {
81201
- if (!(n2 = array2.length))
81249
+ function link(array) {
81250
+ if (!(n2 = array.length))
81202
81251
  return;
81203
- var n2, i2 = 0, a2 = array2[0], b;
81252
+ var n2, i2 = 0, a2 = array[0], b;
81204
81253
  while (++i2 < n2) {
81205
- a2.n = b = array2[i2];
81254
+ a2.n = b = array[i2];
81206
81255
  b.p = a2;
81207
81256
  a2 = b;
81208
81257
  }
81209
- a2.n = b = array2[0];
81258
+ a2.n = b = array[0];
81210
81259
  b.p = a2;
81211
81260
  }
81212
81261
  function ascending(a2, b) {
@@ -81261,15 +81310,15 @@ function range$4(start, stop, step) {
81261
81310
  return range2;
81262
81311
  }
81263
81312
  function merge(arrays) {
81264
- var n2 = arrays.length, m, i2 = -1, j = 0, merged, array2;
81313
+ var n2 = arrays.length, m, i2 = -1, j = 0, merged, array;
81265
81314
  while (++i2 < n2)
81266
81315
  j += arrays[i2].length;
81267
81316
  merged = new Array(j);
81268
81317
  while (--n2 >= 0) {
81269
- array2 = arrays[n2];
81270
- m = array2.length;
81318
+ array = arrays[n2];
81319
+ m = array.length;
81271
81320
  while (--m >= 0) {
81272
- merged[--j] = array2[m];
81321
+ merged[--j] = array[m];
81273
81322
  }
81274
81323
  }
81275
81324
  return merged;
@@ -86922,13 +86971,13 @@ function toDeckColor$2(color) {
86922
86971
  }
86923
86972
  return [color[0] * 255, color[1] * 255, color[2] * 255, color[3] * 255];
86924
86973
  }
86925
- function recursivelyTraverseNestedArrays$2(array2, prefix, fn) {
86926
- if (!Array.isArray(array2[0])) {
86974
+ function recursivelyTraverseNestedArrays$2(array, prefix, fn) {
86975
+ if (!Array.isArray(array[0])) {
86927
86976
  return true;
86928
86977
  }
86929
- for (var i2 = 0; i2 < array2.length; i2++) {
86930
- if (recursivelyTraverseNestedArrays$2(array2[i2], [].concat(_toConsumableArray$h(prefix), [i2]), fn)) {
86931
- fn(array2, prefix);
86978
+ for (var i2 = 0; i2 < array.length; i2++) {
86979
+ if (recursivelyTraverseNestedArrays$2(array[i2], [].concat(_toConsumableArray$h(prefix), [i2]), fn)) {
86980
+ fn(array, prefix);
86932
86981
  break;
86933
86982
  }
86934
86983
  }
@@ -100236,13 +100285,13 @@ function toDeckColor$1(color) {
100236
100285
  }
100237
100286
  return [color[0] * 255, color[1] * 255, color[2] * 255, color[3] * 255];
100238
100287
  }
100239
- function recursivelyTraverseNestedArrays$1(array2, prefix, fn) {
100240
- if (!Array.isArray(array2[0])) {
100288
+ function recursivelyTraverseNestedArrays$1(array, prefix, fn) {
100289
+ if (!Array.isArray(array[0])) {
100241
100290
  return true;
100242
100291
  }
100243
- for (var i2 = 0; i2 < array2.length; i2++) {
100244
- if (recursivelyTraverseNestedArrays$1(array2[i2], [].concat(_toConsumableArray$1(prefix), [i2]), fn)) {
100245
- fn(array2, prefix);
100292
+ for (var i2 = 0; i2 < array.length; i2++) {
100293
+ if (recursivelyTraverseNestedArrays$1(array[i2], [].concat(_toConsumableArray$1(prefix), [i2]), fn)) {
100294
+ fn(array, prefix);
100246
100295
  break;
100247
100296
  }
100248
100297
  }
@@ -100451,13 +100500,13 @@ function toDeckColor(color) {
100451
100500
  }
100452
100501
  return [color[0] * 255, color[1] * 255, color[2] * 255, color[3] * 255];
100453
100502
  }
100454
- function recursivelyTraverseNestedArrays(array2, prefix, fn) {
100455
- if (!Array.isArray(array2[0])) {
100503
+ function recursivelyTraverseNestedArrays(array, prefix, fn) {
100504
+ if (!Array.isArray(array[0])) {
100456
100505
  return true;
100457
100506
  }
100458
- for (var i2 = 0; i2 < array2.length; i2++) {
100459
- if (recursivelyTraverseNestedArrays(array2[i2], [].concat(_toConsumableArray(prefix), [i2]), fn)) {
100460
- fn(array2, prefix);
100507
+ for (var i2 = 0; i2 < array.length; i2++) {
100508
+ if (recursivelyTraverseNestedArrays(array[i2], [].concat(_toConsumableArray(prefix), [i2]), fn)) {
100509
+ fn(array, prefix);
100461
100510
  break;
100462
100511
  }
100463
100512
  }
@@ -103333,12 +103382,12 @@ const SafeIteratorPrototype = ObjectCreate(null, {
103333
103382
  }
103334
103383
  }
103335
103384
  });
103336
- function safeIfNeeded(array2) {
103337
- if (array2[SymbolIterator] === NativeArrayPrototypeSymbolIterator) {
103338
- return array2;
103385
+ function safeIfNeeded(array) {
103386
+ if (array[SymbolIterator] === NativeArrayPrototypeSymbolIterator) {
103387
+ return array;
103339
103388
  }
103340
103389
  const safe = ObjectCreate(SafeIteratorPrototype);
103341
- WeakMapPrototypeSet(arrayIterators, safe, ArrayPrototypeSymbolIterator(array2));
103390
+ WeakMapPrototypeSet(arrayIterators, safe, ArrayPrototypeSymbolIterator(array));
103342
103391
  return safe;
103343
103392
  }
103344
103393
  const generators = new NativeWeakMap();
@@ -103903,29 +103952,29 @@ async function getDecoder(fileDirectory) {
103903
103952
  const Decoder = await importFn();
103904
103953
  return new Decoder(fileDirectory);
103905
103954
  }
103906
- addDecoder([void 0, 1], () => import("./raw-7701dc0d.js").then((m) => m.default));
103907
- addDecoder(5, () => import("./lzw-e748554e.js").then((m) => m.default));
103955
+ addDecoder([void 0, 1], () => import("./raw-c78b844f.js").then((m) => m.default));
103956
+ addDecoder(5, () => import("./lzw-04637fdd.js").then((m) => m.default));
103908
103957
  addDecoder(6, () => {
103909
103958
  throw new Error("old style JPEG compression is not supported.");
103910
103959
  });
103911
- addDecoder(7, () => import("./jpeg-d84c376b.js").then((m) => m.default));
103912
- addDecoder([8, 32946], () => import("./deflate-2292d6bb.js").then((m) => m.default));
103913
- addDecoder(32773, () => import("./packbits-17d3eaf3.js").then((m) => m.default));
103914
- addDecoder(34887, () => import("./lerc-abfff89b.js").then((m) => m.default));
103915
- addDecoder(50001, () => import("./webimage-6b6fefe4.js").then((m) => m.default));
103916
- function copyNewSize(array2, width, height, samplesPerPixel = 1) {
103917
- return new (Object.getPrototypeOf(array2)).constructor(width * height * samplesPerPixel);
103960
+ addDecoder(7, () => import("./jpeg-201a0839.js").then((m) => m.default));
103961
+ addDecoder([8, 32946], () => import("./deflate-73d5335b.js").then((m) => m.default));
103962
+ addDecoder(32773, () => import("./packbits-c3fd53d2.js").then((m) => m.default));
103963
+ addDecoder(34887, () => import("./lerc-4c2149fc.js").then((m) => m.default));
103964
+ addDecoder(50001, () => import("./webimage-2dd56bbe.js").then((m) => m.default));
103965
+ function copyNewSize(array, width, height, samplesPerPixel = 1) {
103966
+ return new (Object.getPrototypeOf(array)).constructor(width * height * samplesPerPixel);
103918
103967
  }
103919
103968
  function resampleNearest(valueArrays, inWidth, inHeight, outWidth, outHeight) {
103920
103969
  const relX = inWidth / outWidth;
103921
103970
  const relY = inHeight / outHeight;
103922
- return valueArrays.map((array2) => {
103923
- const newArray = copyNewSize(array2, outWidth, outHeight);
103971
+ return valueArrays.map((array) => {
103972
+ const newArray = copyNewSize(array, outWidth, outHeight);
103924
103973
  for (let y2 = 0; y2 < outHeight; ++y2) {
103925
103974
  const cy = Math.min(Math.round(relY * y2), inHeight - 1);
103926
103975
  for (let x2 = 0; x2 < outWidth; ++x2) {
103927
103976
  const cx = Math.min(Math.round(relX * x2), inWidth - 1);
103928
- const value = array2[cy * inWidth + cx];
103977
+ const value = array[cy * inWidth + cx];
103929
103978
  newArray[y2 * outWidth + x2] = value;
103930
103979
  }
103931
103980
  }
@@ -103938,8 +103987,8 @@ function lerp(v0, v12, t2) {
103938
103987
  function resampleBilinear(valueArrays, inWidth, inHeight, outWidth, outHeight) {
103939
103988
  const relX = inWidth / outWidth;
103940
103989
  const relY = inHeight / outHeight;
103941
- return valueArrays.map((array2) => {
103942
- const newArray = copyNewSize(array2, outWidth, outHeight);
103990
+ return valueArrays.map((array) => {
103991
+ const newArray = copyNewSize(array, outWidth, outHeight);
103943
103992
  for (let y2 = 0; y2 < outHeight; ++y2) {
103944
103993
  const rawY = relY * y2;
103945
103994
  const yl = Math.floor(rawY);
@@ -103949,10 +103998,10 @@ function resampleBilinear(valueArrays, inWidth, inHeight, outWidth, outHeight) {
103949
103998
  const tx = rawX % 1;
103950
103999
  const xl = Math.floor(rawX);
103951
104000
  const xh = Math.min(Math.ceil(rawX), inWidth - 1);
103952
- const ll = array2[yl * inWidth + xl];
103953
- const hl = array2[yl * inWidth + xh];
103954
- const lh = array2[yh * inWidth + xl];
103955
- const hh = array2[yh * inWidth + xh];
104001
+ const ll = array[yl * inWidth + xl];
104002
+ const hl = array[yl * inWidth + xh];
104003
+ const lh = array[yh * inWidth + xl];
104004
+ const hh = array[yh * inWidth + xh];
103956
104005
  const value = lerp(
103957
104006
  lerp(ll, hl, tx),
103958
104007
  lerp(lh, hh, tx),
@@ -104045,10 +104094,10 @@ function resampleInterleaved(valueArray2, inWidth, inHeight, outWidth, outHeight
104045
104094
  throw new Error(`Unsupported resampling method: '${method}'`);
104046
104095
  }
104047
104096
  }
104048
- function sum(array2, start, end) {
104097
+ function sum(array, start, end) {
104049
104098
  let s2 = 0;
104050
104099
  for (let i2 = start; i2 < end; ++i2) {
104051
- s2 += array2[i2];
104100
+ s2 += array[i2];
104052
104101
  }
104053
104102
  return s2;
104054
104103
  }
@@ -107970,77 +108019,6 @@ const registry = /* @__PURE__ */ new Map();
107970
108019
  function addCodec(id, importFn) {
107971
108020
  registry.set(id, importFn);
107972
108021
  }
107973
- async function getCodec(config2) {
107974
- if (!registry.has(config2.id)) {
107975
- throw new Error(`Compression codec ${config2.id} is not supported by Zarr.js yet.`);
107976
- }
107977
- const codec = await registry.get(config2.id)();
107978
- return codec.fromConfig(config2);
107979
- }
107980
- function createProxy(mapping) {
107981
- return new Proxy(mapping, {
107982
- set(target, key, value, _receiver) {
107983
- return target.setItem(key, value);
107984
- },
107985
- get(target, key, _receiver) {
107986
- return target.getItem(key);
107987
- },
107988
- deleteProperty(target, key) {
107989
- return target.deleteItem(key);
107990
- },
107991
- has(target, key) {
107992
- return target.containsItem(key);
107993
- }
107994
- });
107995
- }
107996
- function isZarrError(err2) {
107997
- return typeof err2 === "object" && err2 !== null && "__zarr__" in err2;
107998
- }
107999
- function isKeyError(o2) {
108000
- return isZarrError(o2) && o2.__zarr__ === "KeyError";
108001
- }
108002
- class ContainsArrayError extends Error {
108003
- constructor(path) {
108004
- super(`path ${path} contains an array`);
108005
- this.__zarr__ = "ContainsArrayError";
108006
- Object.setPrototypeOf(this, ContainsArrayError.prototype);
108007
- }
108008
- }
108009
- class ContainsGroupError extends Error {
108010
- constructor(path) {
108011
- super(`path ${path} contains a group`);
108012
- this.__zarr__ = "ContainsGroupError";
108013
- Object.setPrototypeOf(this, ContainsGroupError.prototype);
108014
- }
108015
- }
108016
- class GroupNotFoundError extends Error {
108017
- constructor(path) {
108018
- super(`ground not found at path ${path}`);
108019
- this.__zarr__ = "GroupNotFoundError";
108020
- Object.setPrototypeOf(this, GroupNotFoundError.prototype);
108021
- }
108022
- }
108023
- class PermissionError extends Error {
108024
- constructor(message) {
108025
- super(message);
108026
- this.__zarr__ = "PermissionError";
108027
- Object.setPrototypeOf(this, PermissionError.prototype);
108028
- }
108029
- }
108030
- class KeyError extends Error {
108031
- constructor(key) {
108032
- super(`key ${key} not present`);
108033
- this.__zarr__ = "KeyError";
108034
- Object.setPrototypeOf(this, KeyError.prototype);
108035
- }
108036
- }
108037
- class TooManyIndicesError extends RangeError {
108038
- constructor(selection, shape) {
108039
- super(`too many indices for array; expected ${shape.length}, got ${selection.length}`);
108040
- this.__zarr__ = "TooManyIndicesError";
108041
- Object.setPrototypeOf(this, TooManyIndicesError.prototype);
108042
- }
108043
- }
108044
108022
  class BoundsCheckError extends RangeError {
108045
108023
  constructor(message) {
108046
108024
  super(message);
@@ -108055,27 +108033,6 @@ class InvalidSliceError extends RangeError {
108055
108033
  Object.setPrototypeOf(this, InvalidSliceError.prototype);
108056
108034
  }
108057
108035
  }
108058
- class NegativeStepError extends Error {
108059
- constructor() {
108060
- super(`Negative step size is not supported when indexing.`);
108061
- this.__zarr__ = "NegativeStepError";
108062
- Object.setPrototypeOf(this, NegativeStepError.prototype);
108063
- }
108064
- }
108065
- class ValueError extends Error {
108066
- constructor(message) {
108067
- super(message);
108068
- this.__zarr__ = "ValueError";
108069
- Object.setPrototypeOf(this, ValueError.prototype);
108070
- }
108071
- }
108072
- class HTTPError extends Error {
108073
- constructor(code) {
108074
- super(code);
108075
- this.__zarr__ = "HTTPError";
108076
- Object.setPrototypeOf(this, HTTPError.prototype);
108077
- }
108078
- }
108079
108036
  function slice(start, stop = void 0, step = null) {
108080
108037
  if (start === void 0) {
108081
108038
  throw new InvalidSliceError(start, stop, step, "The first argument must not be undefined");
@@ -108094,1125 +108051,12 @@ function slice(start, stop = void 0, step = null) {
108094
108051
  _slice: true
108095
108052
  };
108096
108053
  }
108097
- function adjustIndices(start, stop, step, length2) {
108098
- if (start < 0) {
108099
- start += length2;
108100
- if (start < 0) {
108101
- start = step < 0 ? -1 : 0;
108102
- }
108103
- } else if (start >= length2) {
108104
- start = step < 0 ? length2 - 1 : length2;
108105
- }
108106
- if (stop < 0) {
108107
- stop += length2;
108108
- if (stop < 0) {
108109
- stop = step < 0 ? -1 : 0;
108110
- }
108111
- } else if (stop >= length2) {
108112
- stop = step < 0 ? length2 - 1 : length2;
108113
- }
108114
- if (step < 0) {
108115
- if (stop < start) {
108116
- const length3 = Math.floor((start - stop - 1) / -step + 1);
108117
- return [start, stop, step, length3];
108118
- }
108119
- } else {
108120
- if (start < stop) {
108121
- const length3 = Math.floor((stop - start - 1) / step + 1);
108122
- return [start, stop, step, length3];
108123
- }
108124
- }
108125
- return [start, stop, step, 0];
108126
- }
108127
- function sliceIndices(slice2, length2) {
108128
- let start;
108129
- let stop;
108130
- let step;
108131
- if (slice2.step === null) {
108132
- step = 1;
108133
- } else {
108134
- step = slice2.step;
108135
- }
108136
- if (slice2.start === null) {
108137
- start = step < 0 ? Number.MAX_SAFE_INTEGER : 0;
108138
- } else {
108139
- start = slice2.start;
108140
- if (start < 0) {
108141
- start += length2;
108142
- }
108143
- }
108144
- if (slice2.stop === null) {
108145
- stop = step < 0 ? -Number.MAX_SAFE_INTEGER : Number.MAX_SAFE_INTEGER;
108146
- } else {
108147
- stop = slice2.stop;
108148
- if (stop < 0) {
108149
- stop += length2;
108150
- }
108151
- }
108152
- const s2 = adjustIndices(start, stop, step, length2);
108153
- start = s2[0];
108154
- stop = s2[1];
108155
- step = s2[2];
108156
- length2 = s2[3];
108157
- if (step === 0)
108158
- throw new Error("Step size 0 is invalid");
108159
- return [start, stop, step, length2];
108160
- }
108161
- function ensureArray$1(selection) {
108162
- if (!Array.isArray(selection)) {
108163
- return [selection];
108164
- }
108165
- return selection;
108166
- }
108167
- function checkSelectionLength(selection, shape) {
108168
- if (selection.length > shape.length) {
108169
- throw new TooManyIndicesError(selection, shape);
108170
- }
108171
- }
108172
- function selectionToSliceIndices(selection, shape) {
108173
- const sliceIndicesResult = [];
108174
- const outShape = [];
108175
- for (let i2 = 0; i2 < selection.length; i2++) {
108176
- const s2 = selection[i2];
108177
- if (typeof s2 === "number") {
108178
- sliceIndicesResult.push(s2);
108179
- } else {
108180
- const x2 = sliceIndices(s2, shape[i2]);
108181
- const dimLength = x2[3];
108182
- outShape.push(dimLength);
108183
- sliceIndicesResult.push(x2);
108184
- }
108185
- }
108186
- return [sliceIndicesResult, outShape];
108187
- }
108188
- function normalizeArraySelection(selection, shape, convertIntegerSelectionToSlices = false) {
108189
- selection = replaceEllipsis(selection, shape);
108190
- for (let i2 = 0; i2 < selection.length; i2++) {
108191
- const dimSelection = selection[i2];
108192
- if (typeof dimSelection === "number") {
108193
- if (convertIntegerSelectionToSlices) {
108194
- selection[i2] = slice(dimSelection, dimSelection + 1, 1);
108195
- } else {
108196
- selection[i2] = normalizeIntegerSelection(dimSelection, shape[i2]);
108197
- }
108198
- } else if (isIntegerArray(dimSelection)) {
108199
- throw new TypeError("Integer array selections are not supported (yet)");
108200
- } else if (dimSelection === ":" || dimSelection === null) {
108201
- selection[i2] = slice(null, null, 1);
108202
- }
108203
- }
108204
- return selection;
108205
- }
108206
- function replaceEllipsis(selection, shape) {
108207
- selection = ensureArray$1(selection);
108208
- let ellipsisIndex = -1;
108209
- let numEllipsis = 0;
108210
- for (let i2 = 0; i2 < selection.length; i2++) {
108211
- if (selection[i2] === "...") {
108212
- ellipsisIndex = i2;
108213
- numEllipsis += 1;
108214
- }
108215
- }
108216
- if (numEllipsis > 1) {
108217
- throw new RangeError("an index can only have a single ellipsis ('...')");
108218
- }
108219
- if (numEllipsis === 1) {
108220
- const numItemsLeft = ellipsisIndex;
108221
- const numItemsRight = selection.length - (numItemsLeft + 1);
108222
- const numItems = selection.length - 1;
108223
- if (numItems >= shape.length) {
108224
- selection = selection.filter((x2) => x2 !== "...");
108225
- } else {
108226
- const numNewItems = shape.length - numItems;
108227
- let newItem = selection.slice(0, numItemsLeft).concat(new Array(numNewItems).fill(null));
108228
- if (numItemsRight > 0) {
108229
- newItem = newItem.concat(selection.slice(selection.length - numItemsRight));
108230
- }
108231
- selection = newItem;
108232
- }
108233
- }
108234
- if (selection.length < shape.length) {
108235
- const numMissing = shape.length - selection.length;
108236
- selection = selection.concat(new Array(numMissing).fill(null));
108237
- }
108238
- checkSelectionLength(selection, shape);
108239
- return selection;
108240
- }
108241
- function normalizeIntegerSelection(dimSelection, dimLength) {
108242
- if (dimSelection < 0) {
108243
- dimSelection = dimLength + dimSelection;
108244
- }
108245
- if (dimSelection >= dimLength || dimSelection < 0) {
108246
- throw new BoundsCheckError(`index out of bounds for dimension with length ${dimLength}`);
108247
- }
108248
- return dimSelection;
108249
- }
108250
- function isInteger(s2) {
108251
- return typeof s2 === "number";
108252
- }
108253
- function isIntegerArray(s2) {
108254
- if (!Array.isArray(s2)) {
108255
- return false;
108256
- }
108257
- for (const e2 of s2) {
108258
- if (typeof e2 !== "number") {
108259
- return false;
108260
- }
108261
- }
108262
- return true;
108263
- }
108264
- function isSlice(s2) {
108265
- if (s2 !== null && s2["_slice"] === true) {
108266
- return true;
108267
- }
108268
- return false;
108269
- }
108270
- function isContiguousSlice(s2) {
108271
- return isSlice(s2) && (s2.step === null || s2.step === 1);
108272
- }
108273
- function isContiguousSelection(selection) {
108274
- selection = ensureArray$1(selection);
108275
- for (let i2 = 0; i2 < selection.length; i2++) {
108276
- const s2 = selection[i2];
108277
- if (!(isIntegerArray(s2) || isContiguousSlice(s2) || s2 === "...")) {
108278
- return false;
108279
- }
108280
- }
108281
- return true;
108282
- }
108283
- function* product(...iterables) {
108284
- if (iterables.length === 0) {
108285
- return;
108286
- }
108287
- const iterators = iterables.map((it) => it());
108288
- const results = iterators.map((it) => it.next());
108289
- for (let i2 = 0; ; ) {
108290
- if (results[i2].done) {
108291
- iterators[i2] = iterables[i2]();
108292
- results[i2] = iterators[i2].next();
108293
- if (++i2 >= iterators.length) {
108294
- return;
108295
- }
108296
- } else {
108297
- yield results.map(({ value }) => value);
108298
- i2 = 0;
108299
- }
108300
- results[i2] = iterators[i2].next();
108301
- }
108302
- }
108303
- class BasicIndexer {
108304
- constructor(selection, array2) {
108305
- selection = normalizeArraySelection(selection, array2.shape);
108306
- this.dimIndexers = [];
108307
- const arrayShape = array2.shape;
108308
- for (let i2 = 0; i2 < arrayShape.length; i2++) {
108309
- let dimSelection = selection[i2];
108310
- const dimLength = arrayShape[i2];
108311
- const dimChunkLength = array2.chunks[i2];
108312
- if (dimSelection === null) {
108313
- dimSelection = slice(null);
108314
- }
108315
- if (isInteger(dimSelection)) {
108316
- this.dimIndexers.push(new IntDimIndexer(dimSelection, dimLength, dimChunkLength));
108317
- } else if (isSlice(dimSelection)) {
108318
- this.dimIndexers.push(new SliceDimIndexer(dimSelection, dimLength, dimChunkLength));
108319
- } else {
108320
- throw new RangeError(`Unspported selection item for basic indexing; expected integer or slice, got ${dimSelection}`);
108321
- }
108322
- }
108323
- this.shape = [];
108324
- for (const d of this.dimIndexers) {
108325
- if (d instanceof SliceDimIndexer) {
108326
- this.shape.push(d.numItems);
108327
- }
108328
- }
108329
- this.dropAxes = null;
108330
- }
108331
- *iter() {
108332
- const dimIndexerIterables = this.dimIndexers.map((x2) => () => x2.iter());
108333
- const dimIndexerProduct = product(...dimIndexerIterables);
108334
- for (const dimProjections of dimIndexerProduct) {
108335
- const chunkCoords = [];
108336
- const chunkSelection = [];
108337
- const outSelection = [];
108338
- for (const p of dimProjections) {
108339
- chunkCoords.push(p.dimChunkIndex);
108340
- chunkSelection.push(p.dimChunkSelection);
108341
- if (p.dimOutSelection !== null) {
108342
- outSelection.push(p.dimOutSelection);
108343
- }
108344
- }
108345
- yield {
108346
- chunkCoords,
108347
- chunkSelection,
108348
- outSelection
108349
- };
108350
- }
108351
- }
108352
- }
108353
- class IntDimIndexer {
108354
- constructor(dimSelection, dimLength, dimChunkLength) {
108355
- dimSelection = normalizeIntegerSelection(dimSelection, dimLength);
108356
- this.dimSelection = dimSelection;
108357
- this.dimLength = dimLength;
108358
- this.dimChunkLength = dimChunkLength;
108359
- this.numItems = 1;
108360
- }
108361
- *iter() {
108362
- const dimChunkIndex = Math.floor(this.dimSelection / this.dimChunkLength);
108363
- const dimOffset = dimChunkIndex * this.dimChunkLength;
108364
- const dimChunkSelection = this.dimSelection - dimOffset;
108365
- const dimOutSelection = null;
108366
- yield {
108367
- dimChunkIndex,
108368
- dimChunkSelection,
108369
- dimOutSelection
108370
- };
108371
- }
108372
- }
108373
- class SliceDimIndexer {
108374
- constructor(dimSelection, dimLength, dimChunkLength) {
108375
- const [start, stop, step] = sliceIndices(dimSelection, dimLength);
108376
- this.start = start;
108377
- this.stop = stop;
108378
- this.step = step;
108379
- if (this.step < 1) {
108380
- throw new NegativeStepError();
108381
- }
108382
- this.dimLength = dimLength;
108383
- this.dimChunkLength = dimChunkLength;
108384
- this.numItems = Math.max(0, Math.ceil((this.stop - this.start) / this.step));
108385
- this.numChunks = Math.ceil(this.dimLength / this.dimChunkLength);
108386
- }
108387
- *iter() {
108388
- const dimChunkIndexFrom = Math.floor(this.start / this.dimChunkLength);
108389
- const dimChunkIndexTo = Math.ceil(this.stop / this.dimChunkLength);
108390
- for (let dimChunkIndex = dimChunkIndexFrom; dimChunkIndex < dimChunkIndexTo; dimChunkIndex++) {
108391
- const dimOffset = dimChunkIndex * this.dimChunkLength;
108392
- const dimLimit = Math.min(this.dimLength, (dimChunkIndex + 1) * this.dimChunkLength);
108393
- const dimChunkLength = dimLimit - dimOffset;
108394
- let dimChunkSelStart;
108395
- let dimChunkSelStop;
108396
- let dimOutOffset;
108397
- if (this.start < dimOffset) {
108398
- dimChunkSelStart = 0;
108399
- const remainder = (dimOffset - this.start) % this.step;
108400
- if (remainder > 0) {
108401
- dimChunkSelStart += this.step - remainder;
108402
- }
108403
- dimOutOffset = Math.ceil((dimOffset - this.start) / this.step);
108404
- } else {
108405
- dimChunkSelStart = this.start - dimOffset;
108406
- dimOutOffset = 0;
108407
- }
108408
- if (this.stop > dimLimit) {
108409
- dimChunkSelStop = dimChunkLength;
108410
- } else {
108411
- dimChunkSelStop = this.stop - dimOffset;
108412
- }
108413
- const dimChunkSelection = slice(dimChunkSelStart, dimChunkSelStop, this.step);
108414
- const dimChunkNumItems = Math.ceil((dimChunkSelStop - dimChunkSelStart) / this.step);
108415
- const dimOutSelection = slice(dimOutOffset, dimOutOffset + dimChunkNumItems);
108416
- yield {
108417
- dimChunkIndex,
108418
- dimChunkSelection,
108419
- dimOutSelection
108420
- };
108421
- }
108422
- }
108423
- }
108424
- const IS_NODE$1 = typeof process !== "undefined" && process.versions && process.versions.node;
108425
- function normalizeStoragePath(path) {
108426
- if (path === null) {
108427
- return "";
108428
- }
108429
- if (path instanceof String) {
108430
- path = path.valueOf();
108431
- }
108432
- path = path.replace(/\\/g, "/");
108433
- while (path.length > 0 && path[0] === "/") {
108434
- path = path.slice(1);
108435
- }
108436
- while (path.length > 0 && path[path.length - 1] === "/") {
108437
- path = path.slice(0, path.length - 1);
108438
- }
108439
- path = path.replace(/\/\/+/g, "/");
108440
- const segments = path.split("/");
108441
- for (const s2 of segments) {
108442
- if (s2 === "." || s2 === "..") {
108443
- throw Error("path containing '.' or '..' segment not allowed");
108444
- }
108445
- }
108446
- return path;
108447
- }
108448
- function normalizeShape(shape) {
108449
- if (typeof shape === "number") {
108450
- shape = [shape];
108451
- }
108452
- return shape.map((x2) => Math.floor(x2));
108453
- }
108454
- function normalizeChunks(chunks, shape) {
108455
- if (chunks === null || chunks === true) {
108456
- throw new Error("Chunk guessing is not supported yet");
108457
- }
108458
- if (chunks === false) {
108459
- return shape;
108460
- }
108461
- if (typeof chunks === "number") {
108462
- chunks = [chunks];
108463
- }
108464
- if (chunks.length < shape.length) {
108465
- chunks = chunks.concat(shape.slice(chunks.length));
108466
- }
108467
- return chunks.map((x2, idx) => {
108468
- if (x2 === -1 || x2 === null) {
108469
- return shape[idx];
108470
- } else {
108471
- return Math.floor(x2);
108472
- }
108473
- });
108474
- }
108475
- function normalizeOrder(order) {
108476
- order = order.toUpperCase();
108477
- return order;
108478
- }
108479
- function normalizeDtype(dtype) {
108480
- return dtype;
108481
- }
108482
- function normalizeFillValue(fillValue) {
108483
- return fillValue;
108484
- }
108485
- function isTotalSlice(item, shape) {
108486
- if (item === null) {
108487
- return true;
108488
- }
108489
- if (!Array.isArray(item)) {
108490
- item = [item];
108491
- }
108492
- for (let i2 = 0; i2 < Math.min(item.length, shape.length); i2++) {
108493
- const it = item[i2];
108494
- if (it === null)
108495
- continue;
108496
- if (isSlice(it)) {
108497
- const s2 = it;
108498
- const isStepOne = s2.step === 1 || s2.step === null;
108499
- if (s2.start === null && s2.stop === null && isStepOne) {
108500
- continue;
108501
- }
108502
- if (s2.stop - s2.start === shape[i2] && isStepOne) {
108503
- continue;
108504
- }
108505
- return false;
108506
- }
108507
- return false;
108508
- }
108509
- return true;
108510
- }
108511
- function arrayEquals1D(a2, b) {
108512
- if (a2.length !== b.length) {
108513
- return false;
108514
- }
108515
- for (let i2 = 0; i2 < a2.length; i2++) {
108516
- if (a2[i2] !== b[i2]) {
108517
- return false;
108518
- }
108519
- }
108520
- return true;
108521
- }
108522
- function getStrides(shape) {
108523
- const ndim = shape.length;
108524
- const strides = Array(ndim);
108525
- let step = 1;
108526
- for (let i2 = ndim - 1; i2 >= 0; i2--) {
108527
- strides[i2] = step;
108528
- step *= shape[i2];
108529
- }
108530
- return strides;
108531
- }
108532
- function joinUrlParts(...args) {
108533
- return args.map((part, i2) => {
108534
- if (i2 === 0) {
108535
- return part.trim().replace(/[\/]*$/g, "");
108536
- } else {
108537
- return part.trim().replace(/(^[\/]*|[\/]*$)/g, "");
108538
- }
108539
- }).filter((x2) => x2.length).join("/");
108540
- }
108541
- function byteSwapInplace(src2) {
108542
- const b = src2.BYTES_PER_ELEMENT;
108543
- if (b === 1)
108544
- return;
108545
- if (IS_NODE$1) {
108546
- const bytes = Buffer.from(src2.buffer, src2.byteOffset, src2.length * b);
108547
- if (b === 2)
108548
- bytes.swap16();
108549
- if (b === 4)
108550
- bytes.swap32();
108551
- if (b === 8)
108552
- bytes.swap64();
108553
- return;
108554
- }
108555
- const flipper = new Uint8Array(src2.buffer, src2.byteOffset, src2.length * b);
108556
- const numFlips = b / 2;
108557
- const endByteIndex = b - 1;
108558
- let t2;
108559
- for (let i2 = 0; i2 < flipper.length; i2 += b) {
108560
- for (let j = 0; j < numFlips; j++) {
108561
- t2 = flipper[i2 + j];
108562
- flipper[i2 + j] = flipper[i2 + endByteIndex - j];
108563
- flipper[i2 + endByteIndex - j] = t2;
108564
- }
108565
- }
108566
- }
108567
- function byteSwap(src2) {
108568
- const copy2 = src2.slice();
108569
- byteSwapInplace(copy2);
108570
- return copy2;
108571
- }
108572
- const ARRAY_META_KEY = ".zarray";
108573
- const GROUP_META_KEY = ".zgroup";
108574
- const ATTRS_META_KEY = ".zattrs";
108575
- async function containsArray(store, path = null) {
108576
- path = normalizeStoragePath(path);
108577
- const prefix = pathToPrefix(path);
108578
- const key = prefix + ARRAY_META_KEY;
108579
- return store.containsItem(key);
108580
- }
108581
- async function containsGroup(store, path = null) {
108582
- path = normalizeStoragePath(path);
108583
- const prefix = pathToPrefix(path);
108584
- const key = prefix + GROUP_META_KEY;
108585
- return store.containsItem(key);
108586
- }
108587
- function pathToPrefix(path) {
108588
- if (path.length > 0) {
108589
- return path + "/";
108590
- }
108591
- return "";
108592
- }
108593
- async function requireParentGroup(store, path, chunkStore, overwrite) {
108594
- if (path.length === 0) {
108595
- return;
108596
- }
108597
- const segments = path.split("/");
108598
- let p = "";
108599
- for (const s2 of segments.slice(0, segments.length - 1)) {
108600
- p += s2;
108601
- if (await containsArray(store, p)) {
108602
- await initGroupMetadata(store, p, overwrite);
108603
- } else if (!await containsGroup(store, p)) {
108604
- await initGroupMetadata(store, p);
108605
- }
108606
- p += "/";
108607
- }
108608
- }
108609
- async function initGroupMetadata(store, path = null, overwrite = false) {
108610
- path = normalizeStoragePath(path);
108611
- if (overwrite) {
108612
- throw Error("Group overwriting not implemented yet :(");
108613
- } else if (await containsArray(store, path)) {
108614
- throw new ContainsArrayError(path);
108615
- } else if (await containsGroup(store, path)) {
108616
- throw new ContainsGroupError(path);
108617
- }
108618
- const metadata = { zarr_format: 2 };
108619
- const key = pathToPrefix(path) + GROUP_META_KEY;
108620
- await store.setItem(key, JSON.stringify(metadata));
108621
- }
108622
- async function initGroup(store, path = null, chunkStore = null, overwrite = false) {
108623
- path = normalizeStoragePath(path);
108624
- await requireParentGroup(store, path, chunkStore, overwrite);
108625
- await initGroupMetadata(store, path, overwrite);
108626
- }
108627
- async function initArrayMetadata(store, shape, chunks, dtype, path, compressor, fillValue, order, overwrite, chunkStore, filters, dimensionSeparator) {
108628
- if (overwrite) {
108629
- throw Error("Array overwriting not implemented yet :(");
108630
- } else if (await containsArray(store, path)) {
108631
- throw new ContainsArrayError(path);
108632
- } else if (await containsGroup(store, path)) {
108633
- throw new ContainsGroupError(path);
108634
- }
108635
- dtype = normalizeDtype(dtype);
108636
- shape = normalizeShape(shape);
108637
- chunks = normalizeChunks(chunks, shape);
108638
- order = normalizeOrder(order);
108639
- fillValue = normalizeFillValue(fillValue);
108640
- if (filters !== null && filters.length > 0) {
108641
- throw Error("Filters are not supported yet");
108642
- }
108643
- let serializedFillValue = fillValue;
108644
- if (typeof fillValue === "number") {
108645
- if (Number.isNaN(fillValue))
108646
- serializedFillValue = "NaN";
108647
- if (Number.POSITIVE_INFINITY === fillValue)
108648
- serializedFillValue = "Infinity";
108649
- if (Number.NEGATIVE_INFINITY === fillValue)
108650
- serializedFillValue = "-Infinity";
108651
- }
108652
- filters = null;
108653
- const metadata = {
108654
- zarr_format: 2,
108655
- shape,
108656
- chunks,
108657
- dtype,
108658
- fill_value: serializedFillValue,
108659
- order,
108660
- compressor,
108661
- filters
108662
- };
108663
- if (dimensionSeparator) {
108664
- metadata.dimension_separator = dimensionSeparator;
108665
- }
108666
- const metaKey = pathToPrefix(path) + ARRAY_META_KEY;
108667
- await store.setItem(metaKey, JSON.stringify(metadata));
108668
- }
108669
- async function initArray(store, shape, chunks, dtype, path = null, compressor = null, fillValue = null, order = "C", overwrite = false, chunkStore = null, filters = null, dimensionSeparator) {
108670
- path = normalizeStoragePath(path);
108671
- await requireParentGroup(store, path, chunkStore, overwrite);
108672
- await initArrayMetadata(store, shape, chunks, dtype, path, compressor, fillValue, order, overwrite, chunkStore, filters, dimensionSeparator);
108673
- }
108674
- function parseMetadata(s2) {
108675
- if (typeof s2 !== "string") {
108676
- if (IS_NODE$1 && Buffer.isBuffer(s2)) {
108677
- return JSON.parse(s2.toString());
108678
- } else if (s2 instanceof ArrayBuffer) {
108679
- const utf8Decoder = new TextDecoder();
108680
- const bytes = new Uint8Array(s2);
108681
- return JSON.parse(utf8Decoder.decode(bytes));
108682
- } else {
108683
- return s2;
108684
- }
108685
- }
108686
- return JSON.parse(s2);
108687
- }
108688
- class Attributes {
108689
- constructor(store, key, readOnly, cache2 = true) {
108690
- this.store = store;
108691
- this.key = key;
108692
- this.readOnly = readOnly;
108693
- this.cache = cache2;
108694
- this.cachedValue = null;
108695
- }
108696
- /**
108697
- * Retrieve all attributes as a JSON object.
108698
- */
108699
- async asObject() {
108700
- if (this.cache && this.cachedValue !== null) {
108701
- return this.cachedValue;
108702
- }
108703
- const o2 = await this.getNoSync();
108704
- if (this.cache) {
108705
- this.cachedValue = o2;
108706
- }
108707
- return o2;
108708
- }
108709
- async getNoSync() {
108710
- try {
108711
- const data = await this.store.getItem(this.key);
108712
- return parseMetadata(data);
108713
- } catch (error2) {
108714
- return {};
108715
- }
108716
- }
108717
- async setNoSync(key, value) {
108718
- const d = await this.getNoSync();
108719
- d[key] = value;
108720
- await this.putNoSync(d);
108721
- return true;
108722
- }
108723
- async putNoSync(m) {
108724
- await this.store.setItem(this.key, JSON.stringify(m));
108725
- if (this.cache) {
108726
- this.cachedValue = m;
108727
- }
108728
- }
108729
- async delNoSync(key) {
108730
- const d = await this.getNoSync();
108731
- delete d[key];
108732
- await this.putNoSync(d);
108733
- return true;
108734
- }
108735
- /**
108736
- * Overwrite all attributes with the provided object in a single operation
108737
- */
108738
- async put(d) {
108739
- if (this.readOnly) {
108740
- throw new PermissionError("attributes are read-only");
108741
- }
108742
- return this.putNoSync(d);
108743
- }
108744
- async setItem(key, value) {
108745
- if (this.readOnly) {
108746
- throw new PermissionError("attributes are read-only");
108747
- }
108748
- return this.setNoSync(key, value);
108749
- }
108750
- async getItem(key) {
108751
- return (await this.asObject())[key];
108752
- }
108753
- async deleteItem(key) {
108754
- if (this.readOnly) {
108755
- throw new PermissionError("attributes are read-only");
108756
- }
108757
- return this.delNoSync(key);
108758
- }
108759
- async containsItem(key) {
108760
- return (await this.asObject())[key] !== void 0;
108761
- }
108762
- proxy() {
108763
- return createProxy(this);
108764
- }
108765
- }
108766
- const DTYPE_TYPEDARRAY_MAPPING = {
108767
- "|b": Int8Array,
108768
- "|B": Uint8Array,
108769
- "|u1": Uint8Array,
108770
- "|i1": Int8Array,
108771
- "<b": Int8Array,
108772
- "<B": Uint8Array,
108773
- "<u1": Uint8Array,
108774
- "<i1": Int8Array,
108775
- "<u2": Uint16Array,
108776
- "<i2": Int16Array,
108777
- "<u4": Uint32Array,
108778
- "<i4": Int32Array,
108779
- "<f4": Float32Array,
108780
- "<f8": Float64Array,
108781
- ">b": Int8Array,
108782
- ">B": Uint8Array,
108783
- ">u1": Uint8Array,
108784
- ">i1": Int8Array,
108785
- ">u2": Uint16Array,
108786
- ">i2": Int16Array,
108787
- ">u4": Uint32Array,
108788
- ">i4": Int32Array,
108789
- ">f4": Float32Array,
108790
- ">f8": Float64Array
108791
- };
108792
- function getTypedArrayCtr(dtype) {
108793
- const ctr = DTYPE_TYPEDARRAY_MAPPING[dtype];
108794
- if (!ctr) {
108795
- throw Error(`Dtype not recognized or not supported in zarr.js, got ${dtype}.`);
108796
- }
108797
- return ctr;
108798
- }
108799
- function getTypedArrayDtypeString(t2) {
108800
- if (t2 instanceof Uint8Array)
108801
- return "|u1";
108802
- if (t2 instanceof Int8Array)
108803
- return "|i1";
108804
- if (t2 instanceof Uint16Array)
108805
- return "<u2";
108806
- if (t2 instanceof Int16Array)
108807
- return "<i2";
108808
- if (t2 instanceof Uint32Array)
108809
- return "<u4";
108810
- if (t2 instanceof Int32Array)
108811
- return "<i4";
108812
- if (t2 instanceof Float32Array)
108813
- return "<f4";
108814
- if (t2 instanceof Float64Array)
108815
- return "<f8";
108816
- throw new ValueError("Mapping for TypedArray to Dtypestring not known");
108817
- }
108818
- function getNestedArrayConstructor(arr) {
108819
- if (arr.byteLength !== void 0) {
108820
- return arr.constructor;
108821
- }
108822
- return getNestedArrayConstructor(arr[0]);
108823
- }
108824
- function sliceNestedArray(arr, shape, selection) {
108825
- const normalizedSelection = normalizeArraySelection(selection, shape);
108826
- const [sliceIndices2, outShape] = selectionToSliceIndices(normalizedSelection, shape);
108827
- const outArray = _sliceNestedArray(arr, shape, sliceIndices2);
108828
- return [outArray, outShape];
108829
- }
108830
- function _sliceNestedArray(arr, shape, selection) {
108831
- const currentSlice = selection[0];
108832
- if (typeof currentSlice === "number") {
108833
- if (shape.length === 1) {
108834
- return arr[currentSlice];
108835
- } else {
108836
- return _sliceNestedArray(arr[currentSlice], shape.slice(1), selection.slice(1));
108837
- }
108838
- }
108839
- const [from, to, step, outputSize] = currentSlice;
108840
- if (outputSize === 0) {
108841
- return new (getNestedArrayConstructor(arr))(0);
108842
- }
108843
- if (shape.length === 1) {
108844
- if (step === 1) {
108845
- return arr.slice(from, to);
108846
- }
108847
- const newArrData = new arr.constructor(outputSize);
108848
- for (let i2 = 0; i2 < outputSize; i2++) {
108849
- newArrData[i2] = arr[from + i2 * step];
108850
- }
108851
- return newArrData;
108852
- }
108853
- let newArr = new Array(outputSize);
108854
- for (let i2 = 0; i2 < outputSize; i2++) {
108855
- newArr[i2] = _sliceNestedArray(arr[from + i2 * step], shape.slice(1), selection.slice(1));
108856
- }
108857
- if (outputSize > 0 && typeof newArr[0] === "number") {
108858
- const typedArrayConstructor = arr[0].constructor;
108859
- newArr = typedArrayConstructor.from(newArr);
108860
- }
108861
- return newArr;
108862
- }
108863
- function setNestedArrayToScalar(dstArr, value, destShape, selection) {
108864
- const normalizedSelection = normalizeArraySelection(selection, destShape, true);
108865
- const [sliceIndices2, _outShape] = selectionToSliceIndices(normalizedSelection, destShape);
108866
- _setNestedArrayToScalar(dstArr, value, destShape, sliceIndices2);
108867
- }
108868
- function setNestedArray(dstArr, sourceArr, destShape, sourceShape, selection) {
108869
- const normalizedSelection = normalizeArraySelection(selection, destShape, false);
108870
- const [sliceIndices2, outShape] = selectionToSliceIndices(normalizedSelection, destShape);
108871
- if (JSON.stringify(outShape) !== JSON.stringify(sourceShape)) {
108872
- throw new ValueError(`Shape mismatch in target and source NestedArray: ${outShape} and ${sourceShape}`);
108873
- }
108874
- _setNestedArray(dstArr, sourceArr, destShape, sliceIndices2);
108875
- }
108876
- function _setNestedArray(dstArr, sourceArr, shape, selection) {
108877
- const currentSlice = selection[0];
108878
- if (typeof sourceArr === "number") {
108879
- _setNestedArrayToScalar(dstArr, sourceArr, shape, selection.map((x2) => typeof x2 === "number" ? [x2, x2 + 1, 1, 1] : x2));
108880
- return;
108881
- }
108882
- if (typeof currentSlice === "number") {
108883
- _setNestedArray(dstArr[currentSlice], sourceArr, shape.slice(1), selection.slice(1));
108884
- return;
108885
- }
108886
- const [from, _to, step, outputSize] = currentSlice;
108887
- if (shape.length === 1) {
108888
- if (step === 1) {
108889
- dstArr.set(sourceArr, from);
108890
- } else {
108891
- for (let i2 = 0; i2 < outputSize; i2++) {
108892
- dstArr[from + i2 * step] = sourceArr[i2];
108893
- }
108894
- }
108895
- return;
108896
- }
108897
- for (let i2 = 0; i2 < outputSize; i2++) {
108898
- _setNestedArray(dstArr[from + i2 * step], sourceArr[i2], shape.slice(1), selection.slice(1));
108899
- }
108900
- }
108901
- function _setNestedArrayToScalar(dstArr, value, shape, selection) {
108902
- const currentSlice = selection[0];
108903
- const [from, to, step, outputSize] = currentSlice;
108904
- if (shape.length === 1) {
108905
- if (step === 1) {
108906
- dstArr.fill(value, from, to);
108907
- } else {
108908
- for (let i2 = 0; i2 < outputSize; i2++) {
108909
- dstArr[from + i2 * step] = value;
108910
- }
108911
- }
108912
- return;
108913
- }
108914
- for (let i2 = 0; i2 < outputSize; i2++) {
108915
- _setNestedArrayToScalar(dstArr[from + i2 * step], value, shape.slice(1), selection.slice(1));
108916
- }
108917
- }
108918
- function flattenNestedArray(arr, shape, constr) {
108919
- if (constr === void 0) {
108920
- constr = getNestedArrayConstructor(arr);
108921
- }
108922
- const size = shape.reduce((x2, y2) => x2 * y2, 1);
108923
- const outArr = new constr(size);
108924
- _flattenNestedArray(arr, shape, outArr, 0);
108925
- return outArr;
108926
- }
108927
- function _flattenNestedArray(arr, shape, outArr, offset) {
108928
- if (shape.length === 1) {
108929
- outArr.set(arr, offset);
108930
- return;
108931
- }
108932
- if (shape.length === 2) {
108933
- for (let i2 = 0; i2 < shape[0]; i2++) {
108934
- outArr.set(arr[i2], offset + shape[1] * i2);
108935
- }
108936
- return arr;
108937
- }
108938
- const nextShape = shape.slice(1);
108939
- const mult = nextShape.reduce((x2, y2) => x2 * y2, 1);
108940
- for (let i2 = 0; i2 < shape[0]; i2++) {
108941
- _flattenNestedArray(arr[i2], nextShape, outArr, offset + mult * i2);
108942
- }
108943
- return arr;
108944
- }
108945
- class NestedArray {
108946
- constructor(data, shape, dtype) {
108947
- const dataIsTypedArray = data !== null && !!data.BYTES_PER_ELEMENT;
108948
- if (shape === void 0) {
108949
- if (!dataIsTypedArray) {
108950
- throw new ValueError("Shape argument is required unless you pass in a TypedArray");
108951
- }
108952
- shape = [data.length];
108953
- }
108954
- if (dtype === void 0) {
108955
- if (!dataIsTypedArray) {
108956
- throw new ValueError("Dtype argument is required unless you pass in a TypedArray");
108957
- }
108958
- dtype = getTypedArrayDtypeString(data);
108959
- }
108960
- shape = normalizeShape(shape);
108961
- this.shape = shape;
108962
- this.dtype = dtype;
108963
- if (dataIsTypedArray && shape.length !== 1) {
108964
- data = data.buffer;
108965
- }
108966
- if (this.shape.length === 0) {
108967
- this.data = new (getTypedArrayCtr(dtype))(1);
108968
- } else if (
108969
- // tslint:disable-next-line: strict-type-predicates
108970
- IS_NODE$1 && Buffer.isBuffer(data) || data instanceof ArrayBuffer || data === null || data.toString().startsWith("[object ArrayBuffer]")
108971
- ) {
108972
- const numShapeElements = shape.reduce((x2, y2) => x2 * y2, 1);
108973
- if (data === null) {
108974
- data = new ArrayBuffer(numShapeElements * parseInt(dtype[dtype.length - 1], 10));
108975
- }
108976
- const numDataElements = data.byteLength / parseInt(dtype[dtype.length - 1], 10);
108977
- if (numShapeElements !== numDataElements) {
108978
- throw new Error(`Buffer has ${numDataElements} of dtype ${dtype}, shape is too large or small ${shape} (flat=${numShapeElements})`);
108979
- }
108980
- const typeConstructor = getTypedArrayCtr(dtype);
108981
- this.data = createNestedArray(data, typeConstructor, shape);
108982
- } else {
108983
- this.data = data;
108984
- }
108985
- }
108986
- get(selection) {
108987
- const [sliceResult, outShape] = sliceNestedArray(this.data, this.shape, selection);
108988
- if (outShape.length === 0) {
108989
- return sliceResult;
108990
- } else {
108991
- return new NestedArray(sliceResult, outShape, this.dtype);
108992
- }
108993
- }
108994
- set(selection = null, value) {
108995
- if (selection === null) {
108996
- selection = [slice(null)];
108997
- }
108998
- if (typeof value === "number") {
108999
- if (this.shape.length === 0) {
109000
- this.data[0] = value;
109001
- } else {
109002
- setNestedArrayToScalar(this.data, value, this.shape, selection);
109003
- }
109004
- } else {
109005
- setNestedArray(this.data, value.data, this.shape, value.shape, selection);
109006
- }
109007
- }
109008
- flatten() {
109009
- if (this.shape.length === 1) {
109010
- return this.data;
109011
- }
109012
- return flattenNestedArray(this.data, this.shape, getTypedArrayCtr(this.dtype));
109013
- }
109014
- /**
109015
- * Currently only supports a single integer as the size, TODO: support start, stop, step.
109016
- */
109017
- static arange(size, dtype = "<i4") {
109018
- const constr = getTypedArrayCtr(dtype);
109019
- const data = rangeTypedArray([size], constr);
109020
- return new NestedArray(data, [size], dtype);
109021
- }
109022
- }
109023
- function rangeTypedArray(shape, tContructor) {
109024
- const size = shape.reduce((x2, y2) => x2 * y2, 1);
109025
- const data = new tContructor(size);
109026
- data.set([...Array(size).keys()]);
109027
- return data;
109028
- }
109029
- function createNestedArray(data, t2, shape, offset = 0) {
109030
- if (shape.length === 1) {
109031
- return new t2(data.slice(offset, offset + shape[0] * t2.BYTES_PER_ELEMENT));
109032
- }
109033
- const arr = new Array(shape[0]);
109034
- if (shape.length === 2) {
109035
- for (let i2 = 0; i2 < shape[0]; i2++) {
109036
- arr[i2] = new t2(data.slice(offset + shape[1] * i2 * t2.BYTES_PER_ELEMENT, offset + shape[1] * (i2 + 1) * t2.BYTES_PER_ELEMENT));
109037
- }
109038
- return arr;
109039
- }
109040
- const nextShape = shape.slice(1);
109041
- const mult = nextShape.reduce((x2, y2) => x2 * y2, 1);
109042
- for (let i2 = 0; i2 < shape[0]; i2++) {
109043
- arr[i2] = createNestedArray(data, t2, nextShape, offset + mult * i2 * t2.BYTES_PER_ELEMENT);
109044
- }
109045
- return arr;
109046
- }
109047
- function setRawArrayToScalar(dstArr, dstStrides, dstShape, dstSelection, value) {
109048
- const normalizedSelection = normalizeArraySelection(dstSelection, dstShape, true);
109049
- const [sliceIndices2] = selectionToSliceIndices(normalizedSelection, dstShape);
109050
- _setRawArrayToScalar(value, dstArr, dstStrides, sliceIndices2);
109051
- }
109052
- function setRawArray(dstArr, dstStrides, dstShape, dstSelection, sourceArr, sourceStrides, sourceShape) {
109053
- const normalizedDstSelection = normalizeArraySelection(dstSelection, dstShape, false);
109054
- const [dstSliceIndices, outShape] = selectionToSliceIndices(normalizedDstSelection, dstShape);
109055
- if (JSON.stringify(outShape) !== JSON.stringify(sourceShape)) {
109056
- throw new ValueError(`Shape mismatch in target and source RawArray: ${outShape} and ${sourceShape}`);
109057
- }
109058
- _setRawArray(dstArr, dstStrides, dstSliceIndices, sourceArr, sourceStrides);
109059
- }
109060
- function setRawArrayFromChunkItem(dstArr, dstStrides, dstShape, dstSelection, sourceArr, sourceStrides, sourceShape, sourceSelection) {
109061
- const normalizedDstSelection = normalizeArraySelection(dstSelection, dstShape, true);
109062
- const [dstSliceIndices] = selectionToSliceIndices(normalizedDstSelection, dstShape);
109063
- const normalizedSourceSelection = normalizeArraySelection(sourceSelection, sourceShape, false);
109064
- const [sourceSliceIndicies] = selectionToSliceIndices(normalizedSourceSelection, sourceShape);
109065
- _setRawArrayFromChunkItem(dstArr, dstStrides, dstSliceIndices, sourceArr, sourceStrides, sourceSliceIndicies);
109066
- }
109067
- function _setRawArrayToScalar(value, dstArr, dstStrides, dstSliceIndices) {
109068
- const [currentDstSlice, ...nextDstSliceIndices] = dstSliceIndices;
109069
- const [currentDstStride, ...nextDstStrides] = dstStrides;
109070
- const [from, _to, step, outputSize] = currentDstSlice;
109071
- if (dstStrides.length === 1) {
109072
- if (step === 1 && currentDstStride === 1) {
109073
- dstArr.fill(value, from, from + outputSize);
109074
- } else {
109075
- for (let i2 = 0; i2 < outputSize; i2++) {
109076
- dstArr[currentDstStride * (from + step * i2)] = value;
109077
- }
109078
- }
109079
- return;
109080
- }
109081
- for (let i2 = 0; i2 < outputSize; i2++) {
109082
- _setRawArrayToScalar(value, dstArr.subarray(currentDstStride * (from + step * i2)), nextDstStrides, nextDstSliceIndices);
109083
- }
109084
- }
109085
- function _setRawArray(dstArr, dstStrides, dstSliceIndices, sourceArr, sourceStrides) {
109086
- if (dstSliceIndices.length === 0) {
109087
- dstArr.set(sourceArr);
109088
- return;
109089
- }
109090
- const [currentDstSlice, ...nextDstSliceIndices] = dstSliceIndices;
109091
- const [currentDstStride, ...nextDstStrides] = dstStrides;
109092
- if (typeof currentDstSlice === "number") {
109093
- _setRawArray(dstArr.subarray(currentDstSlice * currentDstStride), nextDstStrides, nextDstSliceIndices, sourceArr, sourceStrides);
109094
- return;
109095
- }
109096
- const [currentSourceStride, ...nextSourceStrides] = sourceStrides;
109097
- const [from, _to, step, outputSize] = currentDstSlice;
109098
- if (dstStrides.length === 1) {
109099
- if (step === 1 && currentDstStride === 1 && currentSourceStride === 1) {
109100
- dstArr.set(sourceArr.subarray(0, outputSize), from);
109101
- } else {
109102
- for (let i2 = 0; i2 < outputSize; i2++) {
109103
- dstArr[currentDstStride * (from + step * i2)] = sourceArr[currentSourceStride * i2];
109104
- }
109105
- }
109106
- return;
109107
- }
109108
- for (let i2 = 0; i2 < outputSize; i2++) {
109109
- _setRawArray(dstArr.subarray(currentDstStride * (from + i2 * step)), nextDstStrides, nextDstSliceIndices, sourceArr.subarray(currentSourceStride * i2), nextSourceStrides);
109110
- }
109111
- }
109112
- function _setRawArrayFromChunkItem(dstArr, dstStrides, dstSliceIndices, sourceArr, sourceStrides, sourceSliceIndices) {
109113
- if (sourceSliceIndices.length === 0) {
109114
- dstArr.set(sourceArr.subarray(0, dstArr.length));
109115
- return;
109116
- }
109117
- const [currentDstSlice, ...nextDstSliceIndices] = dstSliceIndices;
109118
- const [currentSourceSlice, ...nextSourceSliceIndices] = sourceSliceIndices;
109119
- const [currentDstStride, ...nextDstStrides] = dstStrides;
109120
- const [currentSourceStride, ...nextSourceStrides] = sourceStrides;
109121
- if (typeof currentSourceSlice === "number") {
109122
- _setRawArrayFromChunkItem(
109123
- // Don't update destination offset/slices, just source
109124
- dstArr,
109125
- dstStrides,
109126
- dstSliceIndices,
109127
- sourceArr.subarray(currentSourceStride * currentSourceSlice),
109128
- nextSourceStrides,
109129
- nextSourceSliceIndices
109130
- );
109131
- return;
109132
- }
109133
- const [from, _to, step, outputSize] = currentDstSlice;
109134
- const [sfrom, _sto, sstep, _soutputSize] = currentSourceSlice;
109135
- if (dstStrides.length === 1 && sourceStrides.length === 1) {
109136
- if (step === 1 && currentDstStride === 1 && sstep === 1 && currentSourceStride === 1) {
109137
- dstArr.set(sourceArr.subarray(sfrom, sfrom + outputSize), from);
109138
- } else {
109139
- for (let i2 = 0; i2 < outputSize; i2++) {
109140
- dstArr[currentDstStride * (from + step * i2)] = sourceArr[currentSourceStride * (sfrom + sstep * i2)];
109141
- }
109142
- }
109143
- return;
109144
- }
109145
- for (let i2 = 0; i2 < outputSize; i2++) {
109146
- _setRawArrayFromChunkItem(dstArr.subarray(currentDstStride * (from + i2 * step)), nextDstStrides, nextDstSliceIndices, sourceArr.subarray(currentSourceStride * (sfrom + i2 * sstep)), nextSourceStrides, nextSourceSliceIndices);
109147
- }
109148
- }
109149
- class RawArray {
109150
- constructor(data, shape, dtype, strides) {
109151
- const dataIsTypedArray = data !== null && !!data.BYTES_PER_ELEMENT;
109152
- if (shape === void 0) {
109153
- if (!dataIsTypedArray) {
109154
- throw new ValueError("Shape argument is required unless you pass in a TypedArray");
109155
- }
109156
- shape = [data.length];
109157
- }
109158
- shape = normalizeShape(shape);
109159
- if (dtype === void 0) {
109160
- if (!dataIsTypedArray) {
109161
- throw new ValueError("Dtype argument is required unless you pass in a TypedArray");
109162
- }
109163
- dtype = getTypedArrayDtypeString(data);
109164
- }
109165
- if (strides === void 0) {
109166
- strides = getStrides(shape);
109167
- }
109168
- this.shape = shape;
109169
- this.dtype = dtype;
109170
- this.strides = strides;
109171
- if (dataIsTypedArray && shape.length !== 1) {
109172
- data = data.buffer;
109173
- }
109174
- if (this.shape.length === 0) {
109175
- this.data = new (getTypedArrayCtr(dtype))(1);
109176
- } else if (
109177
- // tslint:disable-next-line: strict-type-predicates
109178
- IS_NODE$1 && Buffer.isBuffer(data) || data instanceof ArrayBuffer || data === null || data.toString().startsWith("[object ArrayBuffer]")
109179
- ) {
109180
- const numShapeElements = shape.reduce((x2, y2) => x2 * y2, 1);
109181
- if (data === null) {
109182
- data = new ArrayBuffer(numShapeElements * parseInt(dtype[dtype.length - 1], 10));
109183
- }
109184
- const numDataElements = data.byteLength / parseInt(dtype[dtype.length - 1], 10);
109185
- if (numShapeElements !== numDataElements) {
109186
- throw new Error(`Buffer has ${numDataElements} of dtype ${dtype}, shape is too large or small ${shape} (flat=${numShapeElements})`);
109187
- }
109188
- const typeConstructor = getTypedArrayCtr(dtype);
109189
- this.data = new typeConstructor(data);
109190
- } else {
109191
- this.data = data;
109192
- }
109193
- }
109194
- set(selection = null, value, chunkSelection) {
109195
- if (selection === null) {
109196
- selection = [slice(null)];
109197
- }
109198
- if (typeof value === "number") {
109199
- if (this.shape.length === 0) {
109200
- this.data[0] = value;
109201
- } else {
109202
- setRawArrayToScalar(this.data, this.strides, this.shape, selection, value);
109203
- }
109204
- } else if (value instanceof RawArray && chunkSelection) {
109205
- setRawArrayFromChunkItem(this.data, this.strides, this.shape, selection, value.data, value.strides, value.shape, chunkSelection);
109206
- } else {
109207
- setRawArray(this.data, this.strides, this.shape, selection, value.data, value.strides, value.shape);
109208
- }
109209
- }
109210
- }
108054
+ typeof process !== "undefined" && process.versions && process.versions.node;
109211
108055
  function createCommonjsModule(fn) {
109212
108056
  var module2 = { exports: {} };
109213
108057
  return fn(module2, module2.exports), module2.exports;
109214
108058
  }
109215
- var eventemitter3 = createCommonjsModule(function(module2) {
108059
+ createCommonjsModule(function(module2) {
109216
108060
  var has2 = Object.prototype.hasOwnProperty, prefix = "~";
109217
108061
  function Events() {
109218
108062
  }
@@ -109426,11 +108270,11 @@ const pTimeout = (promise, milliseconds, fallback) => new Promise((resolve, reje
109426
108270
  return;
109427
108271
  }
109428
108272
  const message = typeof fallback === "string" ? fallback : `Promise timed out after ${milliseconds} milliseconds`;
109429
- const timeoutError2 = fallback instanceof Error ? fallback : new TimeoutError(message);
108273
+ const timeoutError = fallback instanceof Error ? fallback : new TimeoutError(message);
109430
108274
  if (typeof promise.cancel === "function") {
109431
108275
  promise.cancel();
109432
108276
  }
109433
- reject(timeoutError2);
108277
+ reject(timeoutError);
109434
108278
  }, milliseconds);
109435
108279
  pFinally(
109436
108280
  // eslint-disable-next-line promise/prefer-await-to-then
@@ -109445,1140 +108289,14 @@ var _default$3 = pTimeout;
109445
108289
  var TimeoutError_1 = TimeoutError;
109446
108290
  pTimeout_1.default = _default$3;
109447
108291
  pTimeout_1.TimeoutError = TimeoutError_1;
109448
- function lowerBound(array2, value, comparator2) {
109449
- let first = 0;
109450
- let count2 = array2.length;
109451
- while (count2 > 0) {
109452
- const step = count2 / 2 | 0;
109453
- let it = first + step;
109454
- if (comparator2(array2[it], value) <= 0) {
109455
- first = ++it;
109456
- count2 -= step + 1;
109457
- } else {
109458
- count2 = step;
109459
- }
109460
- }
109461
- return first;
109462
- }
109463
- var _default$2 = lowerBound;
109464
- var lowerBound_1 = /* @__PURE__ */ Object.defineProperty({
109465
- default: _default$2
109466
- }, "__esModule", { value: true });
109467
- class PriorityQueue {
109468
- constructor() {
109469
- this._queue = [];
109470
- }
109471
- enqueue(run, options) {
109472
- options = Object.assign({ priority: 0 }, options);
109473
- const element = {
109474
- priority: options.priority,
109475
- run
109476
- };
109477
- if (this.size && this._queue[this.size - 1].priority >= options.priority) {
109478
- this._queue.push(element);
109479
- return;
109480
- }
109481
- const index2 = lowerBound_1.default(this._queue, element, (a2, b) => b.priority - a2.priority);
109482
- this._queue.splice(index2, 0, element);
109483
- }
109484
- dequeue() {
109485
- const item = this._queue.shift();
109486
- return item && item.run;
109487
- }
109488
- get size() {
109489
- return this._queue.length;
109490
- }
109491
- }
109492
- var _default$1 = PriorityQueue;
109493
- var priorityQueue = /* @__PURE__ */ Object.defineProperty({
109494
- default: _default$1
109495
- }, "__esModule", { value: true });
109496
- const empty$1 = () => {
109497
- };
109498
- const timeoutError = new pTimeout_1.default.TimeoutError();
109499
- class PQueue extends eventemitter3 {
109500
- constructor(options) {
109501
- super();
109502
- this._intervalCount = 0;
109503
- this._intervalEnd = 0;
109504
- this._pendingCount = 0;
109505
- this._resolveEmpty = empty$1;
109506
- this._resolveIdle = empty$1;
109507
- options = Object.assign(
109508
- { carryoverConcurrencyCount: false, intervalCap: Infinity, interval: 0, concurrency: Infinity, autoStart: true, queueClass: priorityQueue.default },
109509
- options
109510
- // TODO: Remove this `as`.
109511
- );
109512
- if (!(typeof options.intervalCap === "number" && options.intervalCap >= 1)) {
109513
- throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${options.intervalCap}\` (${typeof options.intervalCap})`);
109514
- }
109515
- if (options.interval === void 0 || !(Number.isFinite(options.interval) && options.interval >= 0)) {
109516
- throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${options.interval}\` (${typeof options.interval})`);
109517
- }
109518
- this._carryoverConcurrencyCount = options.carryoverConcurrencyCount;
109519
- this._isIntervalIgnored = options.intervalCap === Infinity || options.interval === 0;
109520
- this._intervalCap = options.intervalCap;
109521
- this._interval = options.interval;
109522
- this._queue = new options.queueClass();
109523
- this._queueClass = options.queueClass;
109524
- this.concurrency = options.concurrency;
109525
- this._timeout = options.timeout;
109526
- this._throwOnTimeout = options.throwOnTimeout === true;
109527
- this._isPaused = options.autoStart === false;
109528
- }
109529
- get _doesIntervalAllowAnother() {
109530
- return this._isIntervalIgnored || this._intervalCount < this._intervalCap;
109531
- }
109532
- get _doesConcurrentAllowAnother() {
109533
- return this._pendingCount < this._concurrency;
109534
- }
109535
- _next() {
109536
- this._pendingCount--;
109537
- this._tryToStartAnother();
109538
- }
109539
- _resolvePromises() {
109540
- this._resolveEmpty();
109541
- this._resolveEmpty = empty$1;
109542
- if (this._pendingCount === 0) {
109543
- this._resolveIdle();
109544
- this._resolveIdle = empty$1;
109545
- }
109546
- }
109547
- _onResumeInterval() {
109548
- this._onInterval();
109549
- this._initializeIntervalIfNeeded();
109550
- this._timeoutId = void 0;
109551
- }
109552
- _isIntervalPaused() {
109553
- const now2 = Date.now();
109554
- if (this._intervalId === void 0) {
109555
- const delay = this._intervalEnd - now2;
109556
- if (delay < 0) {
109557
- this._intervalCount = this._carryoverConcurrencyCount ? this._pendingCount : 0;
109558
- } else {
109559
- if (this._timeoutId === void 0) {
109560
- this._timeoutId = setTimeout(() => {
109561
- this._onResumeInterval();
109562
- }, delay);
109563
- }
109564
- return true;
109565
- }
109566
- }
109567
- return false;
109568
- }
109569
- _tryToStartAnother() {
109570
- if (this._queue.size === 0) {
109571
- if (this._intervalId) {
109572
- clearInterval(this._intervalId);
109573
- }
109574
- this._intervalId = void 0;
109575
- this._resolvePromises();
109576
- return false;
109577
- }
109578
- if (!this._isPaused) {
109579
- const canInitializeInterval = !this._isIntervalPaused();
109580
- if (this._doesIntervalAllowAnother && this._doesConcurrentAllowAnother) {
109581
- this.emit("active");
109582
- this._queue.dequeue()();
109583
- if (canInitializeInterval) {
109584
- this._initializeIntervalIfNeeded();
109585
- }
109586
- return true;
109587
- }
109588
- }
109589
- return false;
109590
- }
109591
- _initializeIntervalIfNeeded() {
109592
- if (this._isIntervalIgnored || this._intervalId !== void 0) {
109593
- return;
109594
- }
109595
- this._intervalId = setInterval(() => {
109596
- this._onInterval();
109597
- }, this._interval);
109598
- this._intervalEnd = Date.now() + this._interval;
109599
- }
109600
- _onInterval() {
109601
- if (this._intervalCount === 0 && this._pendingCount === 0 && this._intervalId) {
109602
- clearInterval(this._intervalId);
109603
- this._intervalId = void 0;
109604
- }
109605
- this._intervalCount = this._carryoverConcurrencyCount ? this._pendingCount : 0;
109606
- this._processQueue();
109607
- }
109608
- /**
109609
- Executes all queued functions until it reaches the limit.
109610
- */
109611
- _processQueue() {
109612
- while (this._tryToStartAnother()) {
109613
- }
109614
- }
109615
- get concurrency() {
109616
- return this._concurrency;
109617
- }
109618
- set concurrency(newConcurrency) {
109619
- if (!(typeof newConcurrency === "number" && newConcurrency >= 1)) {
109620
- throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${newConcurrency}\` (${typeof newConcurrency})`);
109621
- }
109622
- this._concurrency = newConcurrency;
109623
- this._processQueue();
109624
- }
109625
- /**
109626
- Adds a sync or async task to the queue. Always returns a promise.
109627
- */
109628
- async add(fn, options = {}) {
109629
- return new Promise((resolve, reject) => {
109630
- const run = async () => {
109631
- this._pendingCount++;
109632
- this._intervalCount++;
109633
- try {
109634
- const operation = this._timeout === void 0 && options.timeout === void 0 ? fn() : pTimeout_1.default(Promise.resolve(fn()), options.timeout === void 0 ? this._timeout : options.timeout, () => {
109635
- if (options.throwOnTimeout === void 0 ? this._throwOnTimeout : options.throwOnTimeout) {
109636
- reject(timeoutError);
109637
- }
109638
- return void 0;
109639
- });
109640
- resolve(await operation);
109641
- } catch (error2) {
109642
- reject(error2);
109643
- }
109644
- this._next();
109645
- };
109646
- this._queue.enqueue(run, options);
109647
- this._tryToStartAnother();
109648
- });
109649
- }
109650
- /**
109651
- Same as `.add()`, but accepts an array of sync or async functions.
109652
-
109653
- @returns A promise that resolves when all functions are resolved.
109654
- */
109655
- async addAll(functions, options) {
109656
- return Promise.all(functions.map(async (function_) => this.add(function_, options)));
109657
- }
109658
- /**
109659
- Start (or resume) executing enqueued tasks within concurrency limit. No need to call this if queue is not paused (via `options.autoStart = false` or by `.pause()` method.)
109660
- */
109661
- start() {
109662
- if (!this._isPaused) {
109663
- return this;
109664
- }
109665
- this._isPaused = false;
109666
- this._processQueue();
109667
- return this;
109668
- }
109669
- /**
109670
- Put queue execution on hold.
109671
- */
109672
- pause() {
109673
- this._isPaused = true;
109674
- }
109675
- /**
109676
- Clear the queue.
109677
- */
109678
- clear() {
109679
- this._queue = new this._queueClass();
109680
- }
109681
- /**
109682
- Can be called multiple times. Useful if you for example add additional items at a later time.
109683
-
109684
- @returns A promise that settles when the queue becomes empty.
109685
- */
109686
- async onEmpty() {
109687
- if (this._queue.size === 0) {
109688
- return;
109689
- }
109690
- return new Promise((resolve) => {
109691
- const existingResolve = this._resolveEmpty;
109692
- this._resolveEmpty = () => {
109693
- existingResolve();
109694
- resolve();
109695
- };
109696
- });
109697
- }
109698
- /**
109699
- The difference with `.onEmpty` is that `.onIdle` guarantees that all work from the queue has finished. `.onEmpty` merely signals that the queue is empty, but it could mean that some promises haven't completed yet.
109700
-
109701
- @returns A promise that settles when the queue becomes empty, and all promises have completed; `queue.size === 0 && queue.pending === 0`.
109702
- */
109703
- async onIdle() {
109704
- if (this._pendingCount === 0 && this._queue.size === 0) {
109705
- return;
109706
- }
109707
- return new Promise((resolve) => {
109708
- const existingResolve = this._resolveIdle;
109709
- this._resolveIdle = () => {
109710
- existingResolve();
109711
- resolve();
109712
- };
109713
- });
109714
- }
109715
- /**
109716
- Size of the queue.
109717
- */
109718
- get size() {
109719
- return this._queue.size;
109720
- }
109721
- /**
109722
- Number of pending promises.
109723
- */
109724
- get pending() {
109725
- return this._pendingCount;
109726
- }
109727
- /**
109728
- Whether the queue is currently paused.
109729
- */
109730
- get isPaused() {
109731
- return this._isPaused;
109732
- }
109733
- /**
109734
- Set the timeout for future operations.
109735
- */
109736
- set timeout(milliseconds) {
109737
- this._timeout = milliseconds;
109738
- }
109739
- get timeout() {
109740
- return this._timeout;
109741
- }
109742
- }
109743
- var _default = PQueue;
109744
- class ZarrArray {
109745
- /**
109746
- * Instantiate an array from an initialized store.
109747
- * @param store Array store, already initialized.
109748
- * @param path Storage path.
109749
- * @param metadata The initial value for the metadata
109750
- * @param readOnly True if array should be protected against modification.
109751
- * @param chunkStore Separate storage for chunks. If not provided, `store` will be used for storage of both chunks and metadata.
109752
- * @param cacheMetadata If true (default), array configuration metadata will be cached for the lifetime of the object.
109753
- * If false, array metadata will be reloaded prior to all data access and modification operations (may incur overhead depending on storage and data access pattern).
109754
- * @param cacheAttrs If true (default), user attributes will be cached for attribute read operations.
109755
- * If false, user attributes are reloaded from the store prior to all attribute read operations.
109756
- */
109757
- constructor(store, path = null, metadata, readOnly = false, chunkStore = null, cacheMetadata = true, cacheAttrs = true) {
109758
- this.store = store;
109759
- this._chunkStore = chunkStore;
109760
- this.path = normalizeStoragePath(path);
109761
- this.keyPrefix = pathToPrefix(this.path);
109762
- this.readOnly = readOnly;
109763
- this.cacheMetadata = cacheMetadata;
109764
- this.cacheAttrs = cacheAttrs;
109765
- this.meta = metadata;
109766
- if (this.meta.compressor !== null) {
109767
- this.compressor = getCodec(this.meta.compressor);
109768
- } else {
109769
- this.compressor = null;
109770
- }
109771
- const attrKey = this.keyPrefix + ATTRS_META_KEY;
109772
- this.attrs = new Attributes(this.store, attrKey, this.readOnly, cacheAttrs);
109773
- }
109774
- /**
109775
- * A `Store` providing the underlying storage for array chunks.
109776
- */
109777
- get chunkStore() {
109778
- if (this._chunkStore) {
109779
- return this._chunkStore;
109780
- }
109781
- return this.store;
109782
- }
109783
- /**
109784
- * Array name following h5py convention.
109785
- */
109786
- get name() {
109787
- if (this.path.length > 0) {
109788
- if (this.path[0] !== "/") {
109789
- return "/" + this.path;
109790
- }
109791
- return this.path;
109792
- }
109793
- return null;
109794
- }
109795
- /**
109796
- * Final component of name.
109797
- */
109798
- get basename() {
109799
- const name2 = this.name;
109800
- if (name2 === null) {
109801
- return null;
109802
- }
109803
- const parts = name2.split("/");
109804
- return parts[parts.length - 1];
109805
- }
109806
- /**
109807
- * "A list of integers describing the length of each dimension of the array.
109808
- */
109809
- get shape() {
109810
- return this.meta.shape;
109811
- }
109812
- /**
109813
- * A list of integers describing the length of each dimension of a chunk of the array.
109814
- */
109815
- get chunks() {
109816
- return this.meta.chunks;
109817
- }
109818
- /**
109819
- * Integer describing how many element a chunk contains
109820
- */
109821
- get chunkSize() {
109822
- return this.chunks.reduce((x2, y2) => x2 * y2, 1);
109823
- }
109824
- /**
109825
- * The NumPy data type.
109826
- */
109827
- get dtype() {
109828
- return this.meta.dtype;
109829
- }
109830
- /**
109831
- * A value used for uninitialized portions of the array.
109832
- */
109833
- get fillValue() {
109834
- const fillTypeValue = this.meta.fill_value;
109835
- if (fillTypeValue === "NaN") {
109836
- return NaN;
109837
- } else if (fillTypeValue === "Infinity") {
109838
- return Infinity;
109839
- } else if (fillTypeValue === "-Infinity") {
109840
- return -Infinity;
109841
- }
109842
- return this.meta.fill_value;
109843
- }
109844
- /**
109845
- * Number of dimensions.
109846
- */
109847
- get nDims() {
109848
- return this.meta.shape.length;
109849
- }
109850
- /**
109851
- * The total number of elements in the array.
109852
- */
109853
- get size() {
109854
- return this.meta.shape.reduce((x2, y2) => x2 * y2, 1);
109855
- }
109856
- get length() {
109857
- return this.shape[0];
109858
- }
109859
- get _chunkDataShape() {
109860
- if (this.shape === []) {
109861
- return [1];
109862
- } else {
109863
- const s2 = [];
109864
- for (let i2 = 0; i2 < this.shape.length; i2++) {
109865
- s2[i2] = Math.ceil(this.shape[i2] / this.chunks[i2]);
109866
- }
109867
- return s2;
109868
- }
109869
- }
109870
- /**
109871
- * A tuple of integers describing the number of chunks along each
109872
- * dimension of the array.
109873
- */
109874
- get chunkDataShape() {
109875
- return this._chunkDataShape;
109876
- }
109877
- /**
109878
- * Total number of chunks.
109879
- */
109880
- get numChunks() {
109881
- return this.chunkDataShape.reduce((x2, y2) => x2 * y2, 1);
109882
- }
109883
- /**
109884
- * Instantiate an array from an initialized store.
109885
- * @param store Array store, already initialized.
109886
- * @param path Storage path.
109887
- * @param readOnly True if array should be protected against modification.
109888
- * @param chunkStore Separate storage for chunks. If not provided, `store` will be used for storage of both chunks and metadata.
109889
- * @param cacheMetadata If true (default), array configuration metadata will be cached for the lifetime of the object.
109890
- * If false, array metadata will be reloaded prior to all data access and modification operations (may incur overhead depending on storage and data access pattern).
109891
- * @param cacheAttrs If true (default), user attributes will be cached for attribute read operations.
109892
- * If false, user attributes are reloaded from the store prior to all attribute read operations.
109893
- */
109894
- static async create(store, path = null, readOnly = false, chunkStore = null, cacheMetadata = true, cacheAttrs = true) {
109895
- const metadata = await this.loadMetadataForConstructor(store, path);
109896
- return new ZarrArray(store, path, metadata, readOnly, chunkStore, cacheMetadata, cacheAttrs);
109897
- }
109898
- static async loadMetadataForConstructor(store, path) {
109899
- try {
109900
- path = normalizeStoragePath(path);
109901
- const keyPrefix = pathToPrefix(path);
109902
- const metaStoreValue = await store.getItem(keyPrefix + ARRAY_META_KEY);
109903
- return parseMetadata(metaStoreValue);
109904
- } catch (error2) {
109905
- if (await containsGroup(store, path)) {
109906
- throw new ContainsGroupError(path !== null && path !== void 0 ? path : "");
109907
- }
109908
- throw new Error("Failed to load metadata for ZarrArray:" + error2.toString());
109909
- }
109910
- }
109911
- /**
109912
- * (Re)load metadata from store
109913
- */
109914
- async reloadMetadata() {
109915
- const metaKey = this.keyPrefix + ARRAY_META_KEY;
109916
- const metaStoreValue = this.store.getItem(metaKey);
109917
- this.meta = parseMetadata(await metaStoreValue);
109918
- return this.meta;
109919
- }
109920
- async refreshMetadata() {
109921
- if (!this.cacheMetadata) {
109922
- await this.reloadMetadata();
109923
- }
109924
- }
109925
- get(selection = null, opts2 = {}) {
109926
- return this.getBasicSelection(selection, false, opts2);
109927
- }
109928
- getRaw(selection = null, opts2 = {}) {
109929
- return this.getBasicSelection(selection, true, opts2);
109930
- }
109931
- async getBasicSelection(selection, asRaw = false, { concurrencyLimit = 10, progressCallback } = {}) {
109932
- if (!this.cacheMetadata) {
109933
- await this.reloadMetadata();
109934
- }
109935
- if (this.shape === []) {
109936
- throw new Error("Shape [] indexing is not supported yet");
109937
- } else {
109938
- return this.getBasicSelectionND(selection, asRaw, concurrencyLimit, progressCallback);
109939
- }
109940
- }
109941
- getBasicSelectionND(selection, asRaw, concurrencyLimit, progressCallback) {
109942
- const indexer = new BasicIndexer(selection, this);
109943
- return this.getSelection(indexer, asRaw, concurrencyLimit, progressCallback);
109944
- }
109945
- async getSelection(indexer, asRaw, concurrencyLimit, progressCallback) {
109946
- const outDtype = this.dtype;
109947
- const outShape = indexer.shape;
109948
- const outSize = indexer.shape.reduce((x2, y2) => x2 * y2, 1);
109949
- if (asRaw && outSize === this.chunkSize) {
109950
- const itr = indexer.iter();
109951
- const proj = itr.next();
109952
- if (proj.done === false && itr.next().done === true) {
109953
- const chunkProjection = proj.value;
109954
- const out2 = await this.decodeDirectToRawArray(chunkProjection, outShape, outSize);
109955
- return out2;
109956
- }
109957
- }
109958
- const out = asRaw ? new RawArray(null, outShape, outDtype) : new NestedArray(null, outShape, outDtype);
109959
- if (outSize === 0) {
109960
- return out;
109961
- }
109962
- const queue = new _default({ concurrency: concurrencyLimit });
109963
- if (progressCallback) {
109964
- let progress = 0;
109965
- let queueSize = 0;
109966
- for (const _ of indexer.iter())
109967
- queueSize += 1;
109968
- progressCallback({ progress: 0, queueSize });
109969
- for (const proj of indexer.iter()) {
109970
- (async () => {
109971
- await queue.add(() => this.chunkGetItem(proj.chunkCoords, proj.chunkSelection, out, proj.outSelection, indexer.dropAxes));
109972
- progress += 1;
109973
- progressCallback({ progress, queueSize });
109974
- })();
109975
- }
109976
- } else {
109977
- for (const proj of indexer.iter()) {
109978
- queue.add(() => this.chunkGetItem(proj.chunkCoords, proj.chunkSelection, out, proj.outSelection, indexer.dropAxes));
109979
- }
109980
- }
109981
- await queue.onIdle();
109982
- if (out.shape.length === 0) {
109983
- return out.data[0];
109984
- }
109985
- return out;
109986
- }
109987
- /**
109988
- * Obtain part or whole of a chunk.
109989
- * @param chunkCoords Indices of the chunk.
109990
- * @param chunkSelection Location of region within the chunk to extract.
109991
- * @param out Array to store result in.
109992
- * @param outSelection Location of region within output array to store results in.
109993
- * @param dropAxes Axes to squeeze out of the chunk.
109994
- */
109995
- async chunkGetItem(chunkCoords, chunkSelection, out, outSelection, dropAxes) {
109996
- if (chunkCoords.length !== this._chunkDataShape.length) {
109997
- throw new ValueError(`Inconsistent shapes: chunkCoordsLength: ${chunkCoords.length}, cDataShapeLength: ${this.chunkDataShape.length}`);
109998
- }
109999
- const cKey = this.chunkKey(chunkCoords);
110000
- try {
110001
- const cdata = await this.chunkStore.getItem(cKey);
110002
- const decodedChunk = await this.decodeChunk(cdata);
110003
- if (out instanceof NestedArray) {
110004
- if (isContiguousSelection(outSelection) && isTotalSlice(chunkSelection, this.chunks) && !this.meta.filters) {
110005
- out.set(outSelection, this.toNestedArray(decodedChunk));
110006
- return;
110007
- }
110008
- const chunk = this.toNestedArray(decodedChunk);
110009
- const tmp = chunk.get(chunkSelection);
110010
- if (dropAxes !== null) {
110011
- throw new Error("Drop axes is not supported yet");
110012
- }
110013
- out.set(outSelection, tmp);
110014
- } else {
110015
- out.set(outSelection, this.chunkBufferToRawArray(decodedChunk), chunkSelection);
110016
- }
110017
- } catch (error2) {
110018
- if (isKeyError(error2)) {
110019
- if (this.fillValue !== null) {
110020
- out.set(outSelection, this.fillValue);
110021
- }
110022
- } else {
110023
- throw error2;
110024
- }
110025
- }
110026
- }
110027
- async getRawChunk(chunkCoords, opts2) {
110028
- if (chunkCoords.length !== this.shape.length) {
110029
- throw new Error(`Chunk coordinates ${chunkCoords.join(".")} do not correspond to shape ${this.shape}.`);
110030
- }
110031
- try {
110032
- for (let i2 = 0; i2 < chunkCoords.length; i2++) {
110033
- const dimLength = Math.ceil(this.shape[i2] / this.chunks[i2]);
110034
- chunkCoords[i2] = normalizeIntegerSelection(chunkCoords[i2], dimLength);
110035
- }
110036
- } catch (error2) {
110037
- if (error2 instanceof BoundsCheckError) {
110038
- throw new BoundsCheckError(`index ${chunkCoords.join(".")} is out of bounds for shape: ${this.shape} and chunks ${this.chunks}`);
110039
- } else {
110040
- throw error2;
110041
- }
110042
- }
110043
- const cKey = this.chunkKey(chunkCoords);
110044
- const cdata = this.chunkStore.getItem(cKey, opts2 === null || opts2 === void 0 ? void 0 : opts2.storeOptions);
110045
- const buffer2 = await this.decodeChunk(await cdata);
110046
- const outShape = this.chunks.filter((d) => d !== 1);
110047
- return new RawArray(buffer2, outShape, this.dtype);
110048
- }
110049
- chunkKey(chunkCoords) {
110050
- var _a2;
110051
- const sep = (_a2 = this.meta.dimension_separator) !== null && _a2 !== void 0 ? _a2 : ".";
110052
- return this.keyPrefix + chunkCoords.join(sep);
110053
- }
110054
- ensureByteArray(chunkData) {
110055
- if (typeof chunkData === "string") {
110056
- return new Uint8Array(Buffer.from(chunkData).buffer);
110057
- }
110058
- return new Uint8Array(chunkData);
110059
- }
110060
- toTypedArray(buffer2) {
110061
- return new (getTypedArrayCtr(this.dtype))(buffer2);
110062
- }
110063
- toNestedArray(data) {
110064
- const buffer2 = this.ensureByteArray(data).buffer;
110065
- return new NestedArray(buffer2, this.chunks, this.dtype);
110066
- }
110067
- async decodeChunk(chunkData) {
110068
- let bytes = this.ensureByteArray(chunkData);
110069
- if (this.compressor !== null) {
110070
- bytes = await (await this.compressor).decode(bytes);
110071
- }
110072
- if (this.dtype.includes(">")) {
110073
- byteSwapInplace(this.toTypedArray(bytes.buffer));
110074
- }
110075
- return bytes.buffer;
110076
- }
110077
- chunkBufferToRawArray(buffer2) {
110078
- return new RawArray(buffer2, this.chunks, this.dtype);
110079
- }
110080
- async decodeDirectToRawArray({ chunkCoords }, outShape, outSize) {
110081
- const cKey = this.chunkKey(chunkCoords);
110082
- try {
110083
- const cdata = await this.chunkStore.getItem(cKey);
110084
- return new RawArray(await this.decodeChunk(cdata), outShape, this.dtype);
110085
- } catch (error2) {
110086
- if (isKeyError(error2)) {
110087
- const data = new (getTypedArrayCtr(this.dtype))(outSize);
110088
- return new RawArray(data.fill(this.fillValue), outShape);
110089
- } else {
110090
- throw error2;
110091
- }
110092
- }
110093
- }
110094
- async set(selection = null, value, opts2 = {}) {
110095
- await this.setBasicSelection(selection, value, opts2);
110096
- }
110097
- async setBasicSelection(selection, value, { concurrencyLimit = 10, progressCallback } = {}) {
110098
- if (this.readOnly) {
110099
- throw new PermissionError("Object is read only");
110100
- }
110101
- if (!this.cacheMetadata) {
110102
- await this.reloadMetadata();
110103
- }
110104
- if (this.shape === []) {
110105
- throw new Error("Shape [] indexing is not supported yet");
110106
- } else {
110107
- await this.setBasicSelectionND(selection, value, concurrencyLimit, progressCallback);
110108
- }
110109
- }
110110
- async setBasicSelectionND(selection, value, concurrencyLimit, progressCallback) {
110111
- const indexer = new BasicIndexer(selection, this);
110112
- await this.setSelection(indexer, value, concurrencyLimit, progressCallback);
110113
- }
110114
- getChunkValue(proj, indexer, value, selectionShape) {
110115
- let chunkValue;
110116
- if (selectionShape === []) {
110117
- chunkValue = value;
110118
- } else if (typeof value === "number") {
110119
- chunkValue = value;
110120
- } else {
110121
- chunkValue = value.get(proj.outSelection);
110122
- if (indexer.dropAxes !== null) {
110123
- throw new Error("Handling drop axes not supported yet");
110124
- }
110125
- }
110126
- return chunkValue;
110127
- }
110128
- async setSelection(indexer, value, concurrencyLimit, progressCallback) {
110129
- const selectionShape = indexer.shape;
110130
- if (selectionShape === [])
110131
- ;
110132
- else if (typeof value === "number")
110133
- ;
110134
- else if (value instanceof NestedArray) {
110135
- if (!arrayEquals1D(value.shape, selectionShape)) {
110136
- throw new ValueError(`Shape mismatch in source NestedArray and set selection: ${value.shape} and ${selectionShape}`);
110137
- }
110138
- } else {
110139
- throw new Error("Unknown data type for setting :(");
110140
- }
110141
- const queue = new _default({ concurrency: concurrencyLimit });
110142
- if (progressCallback) {
110143
- let queueSize = 0;
110144
- for (const _ of indexer.iter())
110145
- queueSize += 1;
110146
- let progress = 0;
110147
- progressCallback({ progress: 0, queueSize });
110148
- for (const proj of indexer.iter()) {
110149
- const chunkValue = this.getChunkValue(proj, indexer, value, selectionShape);
110150
- (async () => {
110151
- await queue.add(() => this.chunkSetItem(proj.chunkCoords, proj.chunkSelection, chunkValue));
110152
- progress += 1;
110153
- progressCallback({ progress, queueSize });
110154
- })();
110155
- }
110156
- } else {
110157
- for (const proj of indexer.iter()) {
110158
- const chunkValue = this.getChunkValue(proj, indexer, value, selectionShape);
110159
- queue.add(() => this.chunkSetItem(proj.chunkCoords, proj.chunkSelection, chunkValue));
110160
- }
110161
- }
110162
- await queue.onIdle();
110163
- }
110164
- async chunkSetItem(chunkCoords, chunkSelection, value) {
110165
- const chunkKey = this.chunkKey(chunkCoords);
110166
- let chunk = null;
110167
- const dtypeConstr = getTypedArrayCtr(this.dtype);
110168
- const chunkSize = this.chunkSize;
110169
- if (isTotalSlice(chunkSelection, this.chunks)) {
110170
- if (typeof value === "number") {
110171
- chunk = new dtypeConstr(chunkSize);
110172
- chunk.fill(value);
110173
- } else {
110174
- chunk = value.flatten();
110175
- }
110176
- } else {
110177
- let chunkData2;
110178
- try {
110179
- const chunkStoreData = await this.chunkStore.getItem(chunkKey);
110180
- const dBytes = await this.decodeChunk(chunkStoreData);
110181
- chunkData2 = this.toTypedArray(dBytes);
110182
- } catch (error2) {
110183
- if (isKeyError(error2)) {
110184
- chunkData2 = new dtypeConstr(chunkSize);
110185
- if (this.fillValue !== null) {
110186
- chunkData2.fill(this.fillValue);
110187
- }
110188
- } else {
110189
- throw error2;
110190
- }
110191
- }
110192
- const chunkNestedArray = new NestedArray(chunkData2, this.chunks, this.dtype);
110193
- chunkNestedArray.set(chunkSelection, value);
110194
- chunk = chunkNestedArray.flatten();
110195
- }
110196
- const chunkData = await this.encodeChunk(chunk);
110197
- this.chunkStore.setItem(chunkKey, chunkData);
110198
- }
110199
- async encodeChunk(chunk) {
110200
- if (this.dtype.includes(">")) {
110201
- chunk = byteSwap(chunk);
110202
- }
110203
- if (this.compressor !== null) {
110204
- const bytes = new Uint8Array(chunk.buffer);
110205
- const cbytes = await (await this.compressor).encode(bytes);
110206
- return cbytes.buffer;
110207
- }
110208
- return chunk.buffer;
110209
- }
110210
- }
110211
- class MemoryStore {
110212
- constructor(root2 = {}) {
110213
- this.root = root2;
110214
- }
110215
- proxy() {
110216
- return createProxy(this);
110217
- }
110218
- getParent(item) {
110219
- let parent = this.root;
110220
- const segments = item.split("/");
110221
- for (const k of segments.slice(0, segments.length - 1)) {
110222
- parent = parent[k];
110223
- if (!parent) {
110224
- throw Error(item);
110225
- }
110226
- }
110227
- return [parent, segments[segments.length - 1]];
110228
- }
110229
- requireParent(item) {
110230
- let parent = this.root;
110231
- const segments = item.split("/");
110232
- for (const k of segments.slice(0, segments.length - 1)) {
110233
- if (parent[k] === void 0) {
110234
- parent[k] = {};
110235
- }
110236
- parent = parent[k];
110237
- }
110238
- return [parent, segments[segments.length - 1]];
110239
- }
110240
- getItem(item) {
110241
- const [parent, key] = this.getParent(item);
110242
- const value = parent[key];
110243
- if (value === void 0) {
110244
- throw new KeyError(item);
110245
- }
110246
- return value;
110247
- }
110248
- setItem(item, value) {
110249
- const [parent, key] = this.requireParent(item);
110250
- parent[key] = value;
110251
- return true;
110252
- }
110253
- deleteItem(item) {
110254
- const [parent, key] = this.getParent(item);
110255
- return delete parent[key];
110256
- }
110257
- containsItem(item) {
110258
- try {
110259
- return this.getItem(item) !== void 0;
110260
- } catch (e2) {
110261
- return false;
110262
- }
110263
- }
110264
- keys() {
110265
- throw new Error("Method not implemented.");
110266
- }
110267
- }
108292
+ new pTimeout_1.default.TimeoutError();
110268
108293
  var HTTPMethod;
110269
108294
  (function(HTTPMethod2) {
110270
108295
  HTTPMethod2["HEAD"] = "HEAD";
110271
108296
  HTTPMethod2["GET"] = "GET";
110272
108297
  HTTPMethod2["PUT"] = "PUT";
110273
108298
  })(HTTPMethod || (HTTPMethod = {}));
110274
- const DEFAULT_METHODS = [HTTPMethod.HEAD, HTTPMethod.GET, HTTPMethod.PUT];
110275
- class HTTPStore {
110276
- constructor(url, options = {}) {
110277
- this.url = url;
110278
- const { fetchOptions = {}, supportedMethods = DEFAULT_METHODS } = options;
110279
- this.fetchOptions = fetchOptions;
110280
- this.supportedMethods = new Set(supportedMethods);
110281
- }
110282
- keys() {
110283
- throw new Error("Method not implemented.");
110284
- }
110285
- async getItem(item, opts2) {
110286
- const url = joinUrlParts(this.url, item);
110287
- const value = await fetch(url, { ...this.fetchOptions, ...opts2 });
110288
- if (value.status === 404) {
110289
- throw new KeyError(item);
110290
- } else if (value.status !== 200) {
110291
- throw new HTTPError(String(value.status));
110292
- }
110293
- if (IS_NODE$1) {
110294
- return Buffer.from(await value.arrayBuffer());
110295
- } else {
110296
- return value.arrayBuffer();
110297
- }
110298
- }
110299
- async setItem(item, value) {
110300
- if (!this.supportedMethods.has(HTTPMethod.PUT)) {
110301
- throw new Error("HTTP PUT no a supported method for store.");
110302
- }
110303
- const url = joinUrlParts(this.url, item);
110304
- if (typeof value === "string") {
110305
- value = new TextEncoder().encode(value).buffer;
110306
- }
110307
- const set = await fetch(url, { ...this.fetchOptions, method: HTTPMethod.PUT, body: value });
110308
- return set.status.toString()[0] === "2";
110309
- }
110310
- deleteItem(_item) {
110311
- throw new Error("Method not implemented.");
110312
- }
110313
- async containsItem(item) {
110314
- const url = joinUrlParts(this.url, item);
110315
- const method = this.supportedMethods.has(HTTPMethod.HEAD) ? HTTPMethod.HEAD : HTTPMethod.GET;
110316
- const value = await fetch(url, { ...this.fetchOptions, method });
110317
- return value.status === 200;
110318
- }
110319
- }
110320
- async function create({ shape, chunks = true, dtype = "<i4", compressor = null, fillValue = null, order = "C", store, overwrite = false, path, chunkStore, filters, cacheMetadata = true, cacheAttrs = true, readOnly = false, dimensionSeparator }) {
110321
- store = normalizeStoreArgument(store);
110322
- await initArray(store, shape, chunks, dtype, path, compressor, fillValue, order, overwrite, chunkStore, filters, dimensionSeparator);
110323
- const z2 = await ZarrArray.create(store, path, readOnly, chunkStore, cacheMetadata, cacheAttrs);
110324
- return z2;
110325
- }
110326
- async function empty(shape, opts2 = {}) {
110327
- opts2.fillValue = null;
110328
- return create({ shape, ...opts2 });
110329
- }
110330
- async function zeros(shape, opts2 = {}) {
110331
- opts2.fillValue = 0;
110332
- return create({ shape, ...opts2 });
110333
- }
110334
- async function ones(shape, opts2 = {}) {
110335
- opts2.fillValue = 1;
110336
- return create({ shape, ...opts2 });
110337
- }
110338
- async function full(shape, fillValue, opts2 = {}) {
110339
- opts2.fillValue = fillValue;
110340
- return create({ shape, ...opts2 });
110341
- }
110342
- async function array(data, opts2 = {}) {
110343
- let shape = null;
110344
- if (data instanceof NestedArray) {
110345
- shape = data.shape;
110346
- opts2.dtype = opts2.dtype === void 0 ? data.dtype : opts2.dtype;
110347
- } else {
110348
- shape = data.byteLength;
110349
- }
110350
- const wasReadOnly = opts2.readOnly === void 0 ? false : opts2.readOnly;
110351
- opts2.readOnly = false;
110352
- const z2 = await create({ shape, ...opts2 });
110353
- await z2.set(null, data);
110354
- z2.readOnly = wasReadOnly;
110355
- return z2;
110356
- }
110357
- function normalizeStoreArgument(store) {
110358
- if (store === void 0) {
110359
- return new MemoryStore();
110360
- } else if (typeof store === "string") {
110361
- return new HTTPStore(store);
110362
- }
110363
- return store;
110364
- }
110365
- class Group {
110366
- constructor(store, path = null, metadata, readOnly = false, chunkStore = null, cacheAttrs = true) {
110367
- this.store = store;
110368
- this._chunkStore = chunkStore;
110369
- this.path = normalizeStoragePath(path);
110370
- this.keyPrefix = pathToPrefix(this.path);
110371
- this.readOnly = readOnly;
110372
- this.meta = metadata;
110373
- const attrKey = this.keyPrefix + ATTRS_META_KEY;
110374
- this.attrs = new Attributes(this.store, attrKey, this.readOnly, cacheAttrs);
110375
- }
110376
- /**
110377
- * Group name following h5py convention.
110378
- */
110379
- get name() {
110380
- if (this.path.length > 0) {
110381
- if (this.path[0] !== "/") {
110382
- return "/" + this.path;
110383
- }
110384
- return this.path;
110385
- }
110386
- return "/";
110387
- }
110388
- /**
110389
- * Final component of name.
110390
- */
110391
- get basename() {
110392
- const parts = this.name.split("/");
110393
- return parts[parts.length - 1];
110394
- }
110395
- /**
110396
- * A `Store` providing the underlying storage for array chunks.
110397
- */
110398
- get chunkStore() {
110399
- if (this._chunkStore) {
110400
- return this._chunkStore;
110401
- }
110402
- return this.store;
110403
- }
110404
- static async create(store, path = null, readOnly = false, chunkStore = null, cacheAttrs = true) {
110405
- const metadata = await this.loadMetadataForConstructor(store, path);
110406
- return new Group(store, path, metadata, readOnly, chunkStore, cacheAttrs);
110407
- }
110408
- static async loadMetadataForConstructor(store, path) {
110409
- path = normalizeStoragePath(path);
110410
- const keyPrefix = pathToPrefix(path);
110411
- try {
110412
- const metaStoreValue = await store.getItem(keyPrefix + GROUP_META_KEY);
110413
- return parseMetadata(metaStoreValue);
110414
- } catch (error2) {
110415
- if (await containsArray(store, path)) {
110416
- throw new ContainsArrayError(path);
110417
- }
110418
- throw new GroupNotFoundError(path);
110419
- }
110420
- }
110421
- itemPath(item) {
110422
- const absolute = typeof item === "string" && item.length > 0 && item[0] === "/";
110423
- const path = normalizeStoragePath(item);
110424
- if (!absolute && this.path.length > 0) {
110425
- return this.keyPrefix + path;
110426
- }
110427
- return path;
110428
- }
110429
- /**
110430
- * Create a sub-group.
110431
- */
110432
- async createGroup(name2, overwrite = false) {
110433
- if (this.readOnly) {
110434
- throw new PermissionError("group is read only");
110435
- }
110436
- const path = this.itemPath(name2);
110437
- await initGroup(this.store, path, this._chunkStore, overwrite);
110438
- return Group.create(this.store, path, this.readOnly, this._chunkStore, this.attrs.cache);
110439
- }
110440
- /**
110441
- * Obtain a sub-group, creating one if it doesn't exist.
110442
- */
110443
- async requireGroup(name2, overwrite = false) {
110444
- if (this.readOnly) {
110445
- throw new PermissionError("group is read only");
110446
- }
110447
- const path = this.itemPath(name2);
110448
- if (!await containsGroup(this.store, path)) {
110449
- await initGroup(this.store, path, this._chunkStore, overwrite);
110450
- }
110451
- return Group.create(this.store, path, this.readOnly, this._chunkStore, this.attrs.cache);
110452
- }
110453
- getOptsForArrayCreation(name2, opts2 = {}) {
110454
- const path = this.itemPath(name2);
110455
- opts2.path = path;
110456
- if (opts2.cacheAttrs === void 0) {
110457
- opts2.cacheAttrs = this.attrs.cache;
110458
- }
110459
- opts2.store = this.store;
110460
- opts2.chunkStore = this.chunkStore;
110461
- return opts2;
110462
- }
110463
- /**
110464
- * Creates an array
110465
- */
110466
- array(name2, data, opts2, overwrite) {
110467
- if (this.readOnly) {
110468
- throw new PermissionError("group is read only");
110469
- }
110470
- opts2 = this.getOptsForArrayCreation(name2, opts2);
110471
- opts2.overwrite = overwrite === void 0 ? opts2.overwrite : overwrite;
110472
- return array(data, opts2);
110473
- }
110474
- empty(name2, shape, opts2 = {}) {
110475
- if (this.readOnly) {
110476
- throw new PermissionError("group is read only");
110477
- }
110478
- opts2 = this.getOptsForArrayCreation(name2, opts2);
110479
- return empty(shape, opts2);
110480
- }
110481
- zeros(name2, shape, opts2 = {}) {
110482
- if (this.readOnly) {
110483
- throw new PermissionError("group is read only");
110484
- }
110485
- opts2 = this.getOptsForArrayCreation(name2, opts2);
110486
- return zeros(shape, opts2);
110487
- }
110488
- ones(name2, shape, opts2 = {}) {
110489
- if (this.readOnly) {
110490
- throw new PermissionError("group is read only");
110491
- }
110492
- opts2 = this.getOptsForArrayCreation(name2, opts2);
110493
- return ones(shape, opts2);
110494
- }
110495
- full(name2, shape, fillValue, opts2 = {}) {
110496
- if (this.readOnly) {
110497
- throw new PermissionError("group is read only");
110498
- }
110499
- opts2 = this.getOptsForArrayCreation(name2, opts2);
110500
- return full(shape, fillValue, opts2);
110501
- }
110502
- createDataset(name2, shape, data, opts2) {
110503
- if (this.readOnly) {
110504
- throw new PermissionError("group is read only");
110505
- }
110506
- opts2 = this.getOptsForArrayCreation(name2, opts2);
110507
- let z2;
110508
- if (data === void 0) {
110509
- if (shape === void 0) {
110510
- throw new ValueError("Shape must be set if no data is passed to CreateDataset");
110511
- }
110512
- z2 = create({ shape, ...opts2 });
110513
- } else {
110514
- z2 = array(data, opts2);
110515
- }
110516
- return z2;
110517
- }
110518
- async getItem(item) {
110519
- const path = this.itemPath(item);
110520
- if (await containsArray(this.store, path)) {
110521
- return ZarrArray.create(this.store, path, this.readOnly, this.chunkStore, void 0, this.attrs.cache);
110522
- } else if (await containsGroup(this.store, path)) {
110523
- return Group.create(this.store, path, this.readOnly, this._chunkStore, this.attrs.cache);
110524
- }
110525
- throw new KeyError(item);
110526
- }
110527
- async setItem(item, value) {
110528
- await this.array(item, value, {}, true);
110529
- return true;
110530
- }
110531
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
110532
- async deleteItem(_item) {
110533
- if (this.readOnly) {
110534
- throw new PermissionError("group is read only");
110535
- }
110536
- throw new Error("Method not implemented.");
110537
- }
110538
- async containsItem(item) {
110539
- const path = this.itemPath(item);
110540
- return await containsArray(this.store, path) || containsGroup(this.store, path);
110541
- }
110542
- proxy() {
110543
- return createProxy(this);
110544
- }
110545
- }
110546
- async function openGroup(store, path = null, mode = "a", chunkStore, cacheAttrs = true) {
110547
- store = normalizeStoreArgument(store);
110548
- if (chunkStore !== void 0) {
110549
- chunkStore = normalizeStoreArgument(store);
110550
- }
110551
- path = normalizeStoragePath(path);
110552
- if (mode === "r" || mode === "r+") {
110553
- if (!await containsGroup(store, path)) {
110554
- if (await containsArray(store, path)) {
110555
- throw new ContainsArrayError(path);
110556
- }
110557
- throw new GroupNotFoundError(path);
110558
- }
110559
- } else if (mode === "w") {
110560
- await initGroup(store, path, chunkStore, true);
110561
- } else if (mode === "a") {
110562
- if (!await containsGroup(store, path)) {
110563
- if (await containsArray(store, path)) {
110564
- throw new ContainsArrayError(path);
110565
- }
110566
- await initGroup(store, path, chunkStore);
110567
- }
110568
- } else if (mode === "w-" || mode === "x") {
110569
- if (await containsArray(store, path)) {
110570
- throw new ContainsArrayError(path);
110571
- } else if (await containsGroup(store, path)) {
110572
- throw new ContainsGroupError(path);
110573
- } else {
110574
- await initGroup(store, path, chunkStore);
110575
- }
110576
- } else {
110577
- throw new ValueError(`Invalid mode argument: ${mode}`);
110578
- }
110579
- const readOnly = mode === "r";
110580
- return Group.create(store, path, readOnly, chunkStore, cacheAttrs);
110581
- }
108299
+ [HTTPMethod.HEAD, HTTPMethod.GET, HTTPMethod.PUT];
110582
108300
  /*! pako 2.0.3 https://github.com/nodeca/pako @license (MIT AND Zlib) */
110583
108301
  const Z_FIXED = 4;
110584
108302
  const Z_BINARY = 0;
@@ -116128,41 +113846,6 @@ async function loadOmeTiff(source, opts2 = {}) {
116128
113846
  const loaders = await load$3(tiff, pool);
116129
113847
  return images === "all" ? loaders : loaders[0];
116130
113848
  }
116131
- function isAxis(axisOrLabel) {
116132
- return typeof axisOrLabel[0] !== "string";
116133
- }
116134
- function castLabels(dimnames) {
116135
- return dimnames;
116136
- }
116137
- async function loadMultiscales(store, path = "") {
116138
- const grp = await openGroup(store, path);
116139
- const rootAttrs = await grp.attrs.asObject();
116140
- let paths = ["0"];
116141
- let labels = castLabels(["t", "c", "z", "y", "x"]);
116142
- if ("multiscales" in rootAttrs) {
116143
- const { datasets, axes } = rootAttrs.multiscales[0];
116144
- paths = datasets.map((d) => d.path);
116145
- if (axes) {
116146
- if (isAxis(axes)) {
116147
- labels = castLabels(axes.map((axis) => axis.name));
116148
- } else {
116149
- labels = castLabels(axes);
116150
- }
116151
- }
116152
- }
116153
- const data = paths.map((path2) => grp.getItem(path2));
116154
- return {
116155
- data: await Promise.all(data),
116156
- rootAttrs,
116157
- labels
116158
- };
116159
- }
116160
- function guessTileSize(arr) {
116161
- const interleaved = isInterleaved(arr.shape);
116162
- const [yChunk, xChunk] = arr.chunks.slice(interleaved ? -3 : -2);
116163
- const size = Math.min(yChunk, xChunk);
116164
- return prevPowerOf2(size);
116165
- }
116166
113849
  function getIndexer(labels) {
116167
113850
  const size = labels.length;
116168
113851
  const dims = getDims(labels);
@@ -116261,22 +113944,6 @@ class ZarrPixelSource {
116261
113944
  }
116262
113945
  }
116263
113946
  }
116264
- async function load(store) {
116265
- const { data, rootAttrs, labels } = await loadMultiscales(store);
116266
- const tileSize = guessTileSize(data[0]);
116267
- const pyramid = data.map((arr) => new ZarrPixelSource(arr, labels, tileSize));
116268
- return {
116269
- data: pyramid,
116270
- metadata: rootAttrs
116271
- };
116272
- }
116273
- async function loadOmeZarr(source, options = {}) {
116274
- const store = new HTTPStore(source, options);
116275
- if ((options == null ? void 0 : options.type) !== "multiscales") {
116276
- throw Error("Only multiscale OME-Zarr is supported.");
116277
- }
116278
- return load(store);
116279
- }
116280
113947
  const MAX_COLOR_INTENSITY = 255;
116281
113948
  const DEFAULT_COLOR_OFF = [0, 0, 0];
116282
113949
  const MAX_CHANNELS$1 = 6;
@@ -120955,13 +118622,13 @@ var baseCreate = function() {
120955
118622
  };
120956
118623
  }();
120957
118624
  const baseCreate$1 = baseCreate;
120958
- function copyArray(source, array2) {
118625
+ function copyArray(source, array) {
120959
118626
  var index2 = -1, length2 = source.length;
120960
- array2 || (array2 = Array(length2));
118627
+ array || (array = Array(length2));
120961
118628
  while (++index2 < length2) {
120962
- array2[index2] = source[index2];
118629
+ array[index2] = source[index2];
120963
118630
  }
120964
- return array2;
118631
+ return array;
120965
118632
  }
120966
118633
  var defineProperty = function() {
120967
118634
  try {
@@ -120972,14 +118639,14 @@ var defineProperty = function() {
120972
118639
  }
120973
118640
  }();
120974
118641
  const defineProperty$1 = defineProperty;
120975
- function arrayEach(array2, iteratee) {
120976
- var index2 = -1, length2 = array2 == null ? 0 : array2.length;
118642
+ function arrayEach(array, iteratee) {
118643
+ var index2 = -1, length2 = array == null ? 0 : array.length;
120977
118644
  while (++index2 < length2) {
120978
- if (iteratee(array2[index2], index2, array2) === false) {
118645
+ if (iteratee(array[index2], index2, array) === false) {
120979
118646
  break;
120980
118647
  }
120981
118648
  }
120982
- return array2;
118649
+ return array;
120983
118650
  }
120984
118651
  var MAX_SAFE_INTEGER$3 = 9007199254740991;
120985
118652
  var reIsUint = /^(?:0|[1-9]\d*)$/;
@@ -121229,10 +118896,10 @@ function listCacheClear() {
121229
118896
  this.__data__ = [];
121230
118897
  this.size = 0;
121231
118898
  }
121232
- function assocIndexOf(array2, key) {
121233
- var length2 = array2.length;
118899
+ function assocIndexOf(array, key) {
118900
+ var length2 = array.length;
121234
118901
  while (length2--) {
121235
- if (eq$4(array2[length2][0], key)) {
118902
+ if (eq$4(array[length2][0], key)) {
121236
118903
  return length2;
121237
118904
  }
121238
118905
  }
@@ -121332,12 +118999,12 @@ MapCache.prototype["delete"] = mapCacheDelete;
121332
118999
  MapCache.prototype.get = mapCacheGet;
121333
119000
  MapCache.prototype.has = mapCacheHas;
121334
119001
  MapCache.prototype.set = mapCacheSet;
121335
- function arrayPush(array2, values2) {
121336
- var index2 = -1, length2 = values2.length, offset = array2.length;
119002
+ function arrayPush(array, values2) {
119003
+ var index2 = -1, length2 = values2.length, offset = array.length;
121337
119004
  while (++index2 < length2) {
121338
- array2[offset + index2] = values2[index2];
119005
+ array[offset + index2] = values2[index2];
121339
119006
  }
121340
- return array2;
119007
+ return array;
121341
119008
  }
121342
119009
  var getPrototype = overArg(Object.getPrototypeOf, Object);
121343
119010
  const getPrototype$1 = getPrototype;
@@ -121399,11 +119066,11 @@ function cloneBuffer(buffer2, isDeep) {
121399
119066
  buffer2.copy(result);
121400
119067
  return result;
121401
119068
  }
121402
- function arrayFilter(array2, predicate) {
121403
- var index2 = -1, length2 = array2 == null ? 0 : array2.length, resIndex = 0, result = [];
119069
+ function arrayFilter(array, predicate) {
119070
+ var index2 = -1, length2 = array == null ? 0 : array.length, resIndex = 0, result = [];
121404
119071
  while (++index2 < length2) {
121405
- var value = array2[index2];
121406
- if (predicate(value, index2, array2)) {
119072
+ var value = array[index2];
119073
+ if (predicate(value, index2, array)) {
121407
119074
  result[resIndex++] = value;
121408
119075
  }
121409
119076
  }
@@ -121484,11 +119151,11 @@ if (DataView$2 && getTag(new DataView$2(new ArrayBuffer(1))) != dataViewTag$2 ||
121484
119151
  const getTag$1 = getTag;
121485
119152
  var objectProto = Object.prototype;
121486
119153
  var hasOwnProperty = objectProto.hasOwnProperty;
121487
- function initCloneArray(array2) {
121488
- var length2 = array2.length, result = new array2.constructor(length2);
121489
- if (length2 && typeof array2[0] == "string" && hasOwnProperty.call(array2, "index")) {
121490
- result.index = array2.index;
121491
- result.input = array2.input;
119154
+ function initCloneArray(array) {
119155
+ var length2 = array.length, result = new array.constructor(length2);
119156
+ if (length2 && typeof array[0] == "string" && hasOwnProperty.call(array, "index")) {
119157
+ result.index = array.index;
119158
+ result.input = array.input;
121492
119159
  }
121493
119160
  return result;
121494
119161
  }
@@ -122189,8 +119856,8 @@ var util;
122189
119856
  return void 0;
122190
119857
  };
122191
119858
  util2.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && isFinite(val) && Math.floor(val) === val;
122192
- function joinValues(array2, separator = " | ") {
122193
- return array2.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
119859
+ function joinValues(array, separator = " | ") {
119860
+ return array.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
122194
119861
  }
122195
119862
  util2.joinValues = joinValues;
122196
119863
  util2.jsonStringifyReplacer = (_, value) => {
@@ -128698,6 +126365,7 @@ const DataType$1 = {
128698
126365
  const FileType$1 = {
128699
126366
  // Joint file types
128700
126367
  ANNDATA_ZARR: "anndata.zarr",
126368
+ SPATIALDATA_ZARR: "spatialdata.zarr",
128701
126369
  // Atomic file types
128702
126370
  OBS_EMBEDDING_CSV: "obsEmbedding.csv",
128703
126371
  OBS_SPOTS_CSV: "obsSpots.csv",
@@ -128720,6 +126388,16 @@ const FileType$1 = {
128720
126388
  OBS_SEGMENTATIONS_ANNDATA_ZARR: "obsSegmentations.anndata.zarr",
128721
126389
  OBS_LABELS_ANNDATA_ZARR: "obsLabels.anndata.zarr",
128722
126390
  FEATURE_LABELS_ANNDATA_ZARR: "featureLabels.anndata.zarr",
126391
+ // SpatialData
126392
+ IMAGE_SPATIALDATA_ZARR: "image.spatialdata.zarr",
126393
+ LABELS_SPATIALDATA_ZARR: "labels.spatialdata.zarr",
126394
+ SHAPES_SPATIALDATA_ZARR: "shapes.spatialdata.zarr",
126395
+ OBS_FEATURE_MATRIX_SPATIALDATA_ZARR: "obsFeatureMatrix.spatialdata.zarr",
126396
+ OBS_SETS_SPATIALDATA_ZARR: "obsSets.spatialdata.zarr",
126397
+ OBS_SPOTS_SPATIALDATA_ZARR: "obsSpots.spatialdata.zarr",
126398
+ // TODO:
126399
+ // OBS_POINTS_SPATIALDATA_ZARR: 'obsPoints.spatialdata.zarr',
126400
+ // OBS_LOCATIONS_SPATIALDATA_ZARR: 'obsLocations.spatialdata.zarr',
128723
126401
  // MuData
128724
126402
  OBS_FEATURE_MATRIX_MUDATA_ZARR: "obsFeatureMatrix.mudata.zarr",
128725
126403
  OBS_SETS_MUDATA_ZARR: "obsSets.mudata.zarr",
@@ -129156,9 +126834,30 @@ z.object({
129156
126834
  offsetsUrl: z.string().optional(),
129157
126835
  coordinateTransformations: omeCoordinateTransformations.optional()
129158
126836
  });
129159
- z.object({
126837
+ const imageOmeZarrSchema = z.object({
129160
126838
  coordinateTransformations: omeCoordinateTransformations.optional()
129161
126839
  });
126840
+ imageOmeZarrSchema.extend({
126841
+ path: z.string()
126842
+ });
126843
+ z.object({
126844
+ path: z.string()
126845
+ });
126846
+ z.object({
126847
+ path: z.string()
126848
+ });
126849
+ z.object({
126850
+ path: z.string(),
126851
+ tablePath: z.string().optional().describe("The path to a table which annotates the spots. If available but not specified, the spot identifiers may not be aligned with associated tabular data as expected.")
126852
+ });
126853
+ annDataObsFeatureMatrix.extend({
126854
+ region: z.string().describe("The name of a region to use to filter instances (i.e., rows) in the table").optional()
126855
+ });
126856
+ z.object({
126857
+ region: z.string().describe("The name of a region to use to filter instances (i.e., rows) in the table").optional(),
126858
+ tablePath: z.string().optional().describe("The path to a table which contains the index for the set values."),
126859
+ obsSets: annDataObsSets
126860
+ });
129162
126861
  z.object({
129163
126862
  obsIndex: z.string(),
129164
126863
  obsEmbedding: z.array(z.string()).length(2)
@@ -130839,34 +128538,34 @@ var json2csv_umd = { exports: {} };
130839
128538
  }
130840
128539
  return that;
130841
128540
  }
130842
- function fromArrayLike(that, array2) {
130843
- var length2 = array2.length < 0 ? 0 : checked(array2.length) | 0;
128541
+ function fromArrayLike(that, array) {
128542
+ var length2 = array.length < 0 ? 0 : checked(array.length) | 0;
130844
128543
  that = createBuffer(that, length2);
130845
128544
  for (var i2 = 0; i2 < length2; i2 += 1) {
130846
- that[i2] = array2[i2] & 255;
128545
+ that[i2] = array[i2] & 255;
130847
128546
  }
130848
128547
  return that;
130849
128548
  }
130850
- function fromArrayBuffer(that, array2, byteOffset, length2) {
130851
- array2.byteLength;
130852
- if (byteOffset < 0 || array2.byteLength < byteOffset) {
128549
+ function fromArrayBuffer(that, array, byteOffset, length2) {
128550
+ array.byteLength;
128551
+ if (byteOffset < 0 || array.byteLength < byteOffset) {
130853
128552
  throw new RangeError("'offset' is out of bounds");
130854
128553
  }
130855
- if (array2.byteLength < byteOffset + (length2 || 0)) {
128554
+ if (array.byteLength < byteOffset + (length2 || 0)) {
130856
128555
  throw new RangeError("'length' is out of bounds");
130857
128556
  }
130858
128557
  if (byteOffset === void 0 && length2 === void 0) {
130859
- array2 = new Uint8Array(array2);
128558
+ array = new Uint8Array(array);
130860
128559
  } else if (length2 === void 0) {
130861
- array2 = new Uint8Array(array2, byteOffset);
128560
+ array = new Uint8Array(array, byteOffset);
130862
128561
  } else {
130863
- array2 = new Uint8Array(array2, byteOffset, length2);
128562
+ array = new Uint8Array(array, byteOffset, length2);
130864
128563
  }
130865
128564
  if (Buffer3.TYPED_ARRAY_SUPPORT) {
130866
- that = array2;
128565
+ that = array;
130867
128566
  that.__proto__ = Buffer3.prototype;
130868
128567
  } else {
130869
- that = fromArrayLike(that, array2);
128568
+ that = fromArrayLike(that, array);
130870
128569
  }
130871
128570
  return that;
130872
128571
  }
@@ -132273,9 +129972,9 @@ var json2csv_umd = { exports: {} };
132273
129972
  runTimeout(drainQueue);
132274
129973
  }
132275
129974
  }
132276
- function Item(fun, array2) {
129975
+ function Item(fun, array) {
132277
129976
  this.fun = fun;
132278
- this.array = array2;
129977
+ this.array = array;
132279
129978
  }
132280
129979
  Item.prototype.run = function() {
132281
129980
  this.fun.apply(null, this.array);
@@ -132450,9 +130149,9 @@ var json2csv_umd = { exports: {} };
132450
130149
  function stylizeNoColor(str, styleType) {
132451
130150
  return str;
132452
130151
  }
132453
- function arrayToHash(array2) {
130152
+ function arrayToHash(array) {
132454
130153
  var hash = {};
132455
- array2.forEach(function(val, idx) {
130154
+ array.forEach(function(val, idx) {
132456
130155
  hash[val] = true;
132457
130156
  });
132458
130157
  return hash;
@@ -132494,9 +130193,9 @@ var json2csv_umd = { exports: {} };
132494
130193
  return formatError(value);
132495
130194
  }
132496
130195
  }
132497
- var base = "", array2 = false, braces = ["{", "}"];
130196
+ var base = "", array = false, braces = ["{", "}"];
132498
130197
  if (isArray$12(value)) {
132499
- array2 = true;
130198
+ array = true;
132500
130199
  braces = ["[", "]"];
132501
130200
  }
132502
130201
  if (isFunction2(value)) {
@@ -132512,7 +130211,7 @@ var json2csv_umd = { exports: {} };
132512
130211
  if (isError(value)) {
132513
130212
  base = " " + formatError(value);
132514
130213
  }
132515
- if (keys4.length === 0 && (!array2 || value.length == 0)) {
130214
+ if (keys4.length === 0 && (!array || value.length == 0)) {
132516
130215
  return braces[0] + base + braces[1];
132517
130216
  }
132518
130217
  if (recurseTimes < 0) {
@@ -132524,11 +130223,11 @@ var json2csv_umd = { exports: {} };
132524
130223
  }
132525
130224
  ctx.seen.push(value);
132526
130225
  var output;
132527
- if (array2) {
130226
+ if (array) {
132528
130227
  output = formatArray(ctx, value, recurseTimes, visibleKeys, keys4);
132529
130228
  } else {
132530
130229
  output = keys4.map(function(key) {
132531
- return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array2);
130230
+ return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
132532
130231
  });
132533
130232
  }
132534
130233
  ctx.seen.pop();
@@ -132581,7 +130280,7 @@ var json2csv_umd = { exports: {} };
132581
130280
  });
132582
130281
  return output;
132583
130282
  }
132584
- function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array2) {
130283
+ function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
132585
130284
  var name2, str, desc;
132586
130285
  desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
132587
130286
  if (desc.get) {
@@ -132606,7 +130305,7 @@ var json2csv_umd = { exports: {} };
132606
130305
  str = formatValue2(ctx, desc.value, recurseTimes - 1);
132607
130306
  }
132608
130307
  if (str.indexOf("\n") > -1) {
132609
- if (array2) {
130308
+ if (array) {
132610
130309
  str = str.split("\n").map(function(line) {
132611
130310
  return " " + line;
132612
130311
  }).join("\n").substr(2);
@@ -132621,7 +130320,7 @@ var json2csv_umd = { exports: {} };
132621
130320
  }
132622
130321
  }
132623
130322
  if (isUndefined(name2)) {
132624
- if (array2 && key.match(/^\d+$/)) {
130323
+ if (array && key.match(/^\d+$/)) {
132625
130324
  return str;
132626
130325
  }
132627
130326
  name2 = JSON.stringify("" + key);
@@ -134443,10 +132142,10 @@ var json2csv_umd = { exports: {} };
134443
132142
  MapCache2.prototype.get = mapCacheGet2;
134444
132143
  MapCache2.prototype.has = mapCacheHas2;
134445
132144
  MapCache2.prototype.set = mapCacheSet2;
134446
- function assocIndexOf2(array2, key) {
134447
- var length2 = array2.length;
132145
+ function assocIndexOf2(array, key) {
132146
+ var length2 = array.length;
134448
132147
  while (length2--) {
134449
- if (eq2(array2[length2][0], key)) {
132148
+ if (eq2(array[length2][0], key)) {
134450
132149
  return length2;
134451
132150
  }
134452
132151
  }
@@ -135716,9 +133415,9 @@ const schemePlasma = [[13, 8, 135], [16, 7, 136], [19, 7, 137], [22, 7, 138], [2
135716
133415
  function rgbSpline(spline) {
135717
133416
  return (colors) => {
135718
133417
  const n2 = colors.length;
135719
- let r2 = new Array(n2);
135720
- let g2 = new Array(n2);
135721
- let b = new Array(n2);
133418
+ const r2 = new Array(n2);
133419
+ const g2 = new Array(n2);
133420
+ const b = new Array(n2);
135722
133421
  let i2;
135723
133422
  let color;
135724
133423
  for (i2 = 0; i2 < n2; ++i2) {
@@ -135727,10 +133426,10 @@ function rgbSpline(spline) {
135727
133426
  g2[i2] = color[1] || 0;
135728
133427
  b[i2] = color[2] || 0;
135729
133428
  }
135730
- r2 = spline(r2);
135731
- g2 = spline(g2);
135732
- b = spline(b);
135733
- return (t2) => [r2(t2), g2(t2), b(t2)];
133429
+ const rFunc = spline(r2);
133430
+ const gFunc = spline(g2);
133431
+ const bFunc = spline(b);
133432
+ return (t2) => [rFunc(t2), gFunc(t2), bFunc(t2)];
135734
133433
  };
135735
133434
  }
135736
133435
  function basis(values2) {
@@ -136403,8 +134102,7 @@ const viv = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty(
136403
134102
  ZarrPixelSource,
136404
134103
  getChannelStats,
136405
134104
  getDefaultInitialViewState,
136406
- loadOmeTiff,
136407
- loadOmeZarr
134105
+ loadOmeTiff
136408
134106
  }, Symbol.toStringTag, { value: "Module" }));
136409
134107
  const luma = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
136410
134108
  __proto__: null,