@idetik/core 0.13.3 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -66,7 +66,7 @@ class l {
66
66
  return I.length === 1 ? "0" + I : I;
67
67
  }
68
68
  }
69
- class oC {
69
+ class sC {
70
70
  canvas_;
71
71
  width_ = 0;
72
72
  height_ = 0;
@@ -100,7 +100,7 @@ class oC {
100
100
  this.backgroundColor_ = l.from(A);
101
101
  }
102
102
  }
103
- var aC = `#version 300 es
103
+ var DC = `#version 300 es
104
104
 
105
105
  const float PI = 3.14159265;
106
106
 
@@ -166,7 +166,7 @@ void main() {
166
166
 
167
167
 
168
168
  gl_PointSize = 5.0;
169
- }`, sC = `#version 300 es
169
+ }`, hC = `#version 300 es
170
170
 
171
171
  precision mediump float;
172
172
 
@@ -253,7 +253,7 @@ void main() {
253
253
  rgbColor += value * Color[i];
254
254
  }
255
255
  fragColor = vec4(rgbColor, u_opacity);
256
- }`, DC = `#version 300 es
256
+ }`, tC = `#version 300 es
257
257
 
258
258
  precision mediump float;
259
259
 
@@ -273,7 +273,7 @@ void main() {
273
273
  gl_PointSize = inSize;
274
274
  color = inColor;
275
275
  marker = uint(inMarker);
276
- }`, hC = `#version 300 es
276
+ }`, yC = `#version 300 es
277
277
 
278
278
  precision mediump float;
279
279
 
@@ -293,7 +293,7 @@ void main() {
293
293
  discard;
294
294
  }
295
295
  fragColor = vec4(color.rgb, u_opacity * alpha * color.a);
296
- }`, tC = `#version 300 es
296
+ }`, eC = `#version 300 es
297
297
 
298
298
  layout (location = 0) in vec3 inPosition;
299
299
  layout (location = 1) in vec3 inNormal;
@@ -303,7 +303,7 @@ uniform mat4 ModelView;
303
303
 
304
304
  void main() {
305
305
  gl_Position = Projection * ModelView * vec4(inPosition, 1.0);
306
- }`, yC = `#version 300 es
306
+ }`, GC = `#version 300 es
307
307
 
308
308
  precision mediump float;
309
309
 
@@ -468,7 +468,7 @@ void main() {
468
468
  }
469
469
 
470
470
  fragColor = accumulatedColor;
471
- }`, eC = `#version 300 es
471
+ }`, nC = `#version 300 es
472
472
 
473
473
  precision mediump float;
474
474
  precision highp int;
@@ -558,19 +558,19 @@ void main() {
558
558
 
559
559
  fragColor = vec4(color.rgb, alpha);
560
560
  }`;
561
- const GC = {
561
+ const wC = {
562
562
  projectedLine: {
563
- vertex: aC,
564
- fragment: sC
565
- },
566
- points: {
567
563
  vertex: DC,
568
564
  fragment: hC
569
565
  },
570
- wireframe: {
566
+ points: {
571
567
  vertex: tC,
572
568
  fragment: yC
573
569
  },
570
+ wireframe: {
571
+ vertex: eC,
572
+ fragment: GC
573
+ },
574
574
  floatScalarImage: {
575
575
  vertex: rA,
576
576
  fragment: ZI
@@ -601,7 +601,7 @@ const GC = {
601
601
  },
602
602
  labelImage: {
603
603
  vertex: rA,
604
- fragment: eC
604
+ fragment: nC
605
605
  },
606
606
  floatVolume: {
607
607
  vertex: OI,
@@ -622,7 +622,7 @@ const GC = {
622
622
  info: 20,
623
623
  warn: 30,
624
624
  error: 40
625
- }, nC = {
625
+ }, FC = {
626
626
  debug: "\x1B[90m",
627
627
  // gray
628
628
  info: "\x1B[36m",
@@ -632,7 +632,7 @@ const GC = {
632
632
  error: "\x1B[31m"
633
633
  // red
634
634
  };
635
- function wC() {
635
+ function rC() {
636
636
  const g = typeof process < "u" && typeof process.env?.NODE_ENV == "string" ? process.env.NODE_ENV : void 0;
637
637
  if (g === "production" || g === "development" || g === "test")
638
638
  return g;
@@ -644,7 +644,7 @@ function wC() {
644
644
  return "development";
645
645
  }
646
646
  class U {
647
- static logLevel_ = wC() === "production" ? "warn" : "debug";
647
+ static logLevel_ = rC() === "production" ? "warn" : "debug";
648
648
  static setLogLevel(A) {
649
649
  U.logLevel_ = A;
650
650
  }
@@ -662,7 +662,7 @@ class U {
662
662
  }
663
663
  static log(A, I, B, ...C) {
664
664
  if (Zg[A] < Zg[U.logLevel_]) return;
665
- const Q = (/* @__PURE__ */ new Date()).toISOString(), E = nC[A], i = `[${Q}][${A.toUpperCase()}][${I}]`, o = [`${E}${i}`, B, ...C];
665
+ const Q = (/* @__PURE__ */ new Date()).toISOString(), E = FC[A], i = `[${Q}][${A.toUpperCase()}][${I}]`, o = [`${E}${i}`, B, ...C];
666
666
  switch (A) {
667
667
  case "debug":
668
668
  console.debug(...o);
@@ -679,7 +679,7 @@ class U {
679
679
  }
680
680
  }
681
681
  }
682
- class FC {
682
+ class SC {
683
683
  gl_;
684
684
  program_;
685
685
  uniformInfo_ = /* @__PURE__ */ new Map();
@@ -761,7 +761,7 @@ class FC {
761
761
  for (let I = 0; I < A; I++) {
762
762
  const B = this.gl_.getActiveUniform(this.program_, I);
763
763
  if (B) {
764
- if (!SC.has(B.type))
764
+ if (!NC.has(B.type))
765
765
  throw new Error(
766
766
  `Unsupported uniform type "${B.type}" (GLenum) found in shader program for uniform "${B.name}"`
767
767
  );
@@ -802,7 +802,7 @@ class FC {
802
802
  return Array.from(this.uniformInfo_.keys());
803
803
  }
804
804
  }
805
- const rC = typeof window < "u" ? [
805
+ const RC = typeof window < "u" ? [
806
806
  WebGL2RenderingContext.BOOL,
807
807
  WebGL2RenderingContext.FLOAT,
808
808
  WebGL2RenderingContext.INT,
@@ -827,10 +827,10 @@ const rC = typeof window < "u" ? [
827
827
  WebGL2RenderingContext.UNSIGNED_INT_SAMPLER_3D,
828
828
  WebGL2RenderingContext.UNSIGNED_INT_SAMPLER_CUBE,
829
829
  WebGL2RenderingContext.UNSIGNED_INT_SAMPLER_2D_ARRAY
830
- ] : [], SC = new Set(
831
- rC
830
+ ] : [], NC = new Set(
831
+ RC
832
832
  ), vI = "#pragma inject_defines";
833
- class RC {
833
+ class cC {
834
834
  gl_;
835
835
  programs_ = /* @__PURE__ */ new Map();
836
836
  constructor(A) {
@@ -839,14 +839,14 @@ class RC {
839
839
  use(A) {
840
840
  let I = this.programs_.get(A);
841
841
  if (I === void 0) {
842
- const B = GC[A], C = Pg(
842
+ const B = wC[A], C = Pg(
843
843
  B.vertex,
844
844
  B.vertexDefines
845
845
  ), Q = Pg(
846
846
  B.fragment,
847
847
  B.fragmentDefines
848
848
  );
849
- I = new FC(
849
+ I = new SC(
850
850
  this.gl_,
851
851
  C,
852
852
  Q
@@ -1129,27 +1129,27 @@ const v = [
1129
1129
  "fe",
1130
1130
  "ff"
1131
1131
  ];
1132
- function LB() {
1132
+ function JB() {
1133
1133
  const g = Math.random() * 4294967295 | 0, A = Math.random() * 4294967295 | 0, I = Math.random() * 4294967295 | 0, B = Math.random() * 4294967295 | 0;
1134
1134
  return (v[g & 255] + v[g >> 8 & 255] + v[g >> 16 & 255] + v[g >> 24 & 255] + "-" + v[A & 255] + v[A >> 8 & 255] + "-" + v[A >> 16 & 15 | 64] + v[A >> 24 & 255] + "-" + v[I & 63 | 128] + v[I >> 8 & 255] + "-" + v[I >> 16 & 255] + v[I >> 24 & 255] + v[B & 255] + v[B >> 8 & 255] + v[B >> 16 & 255] + v[B >> 24 & 255]).toLowerCase();
1135
1135
  }
1136
1136
  class yg {
1137
- uuid = LB();
1137
+ uuid = JB();
1138
1138
  }
1139
- var p = 1e-6, b = typeof Float32Array < "u" ? Float32Array : Array, NC = Math.PI / 180;
1140
- function cC(g) {
1141
- return g * NC;
1139
+ var p = 1e-6, b = typeof Float32Array < "u" ? Float32Array : Array, UC = Math.PI / 180;
1140
+ function kC(g) {
1141
+ return g * UC;
1142
1142
  }
1143
1143
  Math.hypot || (Math.hypot = function() {
1144
1144
  for (var g = 0, A = arguments.length; A--; )
1145
1145
  g += arguments[A] * arguments[A];
1146
1146
  return Math.sqrt(g);
1147
1147
  });
1148
- function JB() {
1148
+ function YB() {
1149
1149
  var g = new b(9);
1150
1150
  return b != Float32Array && (g[1] = 0, g[2] = 0, g[3] = 0, g[5] = 0, g[6] = 0, g[7] = 0), g[0] = 1, g[4] = 1, g[8] = 1, g;
1151
1151
  }
1152
- function UC(g, A) {
1152
+ function LC(g, A) {
1153
1153
  return g[0] = A[0], g[1] = A[1], g[2] = A[2], g[3] = A[4], g[4] = A[5], g[5] = A[6], g[6] = A[8], g[7] = A[9], g[8] = A[10], g;
1154
1154
  }
1155
1155
  function _() {
@@ -1164,30 +1164,30 @@ function zA(g, A, I) {
1164
1164
  var B = A[0], C = A[1], Q = A[2], E = A[3], i = A[4], o = A[5], a = A[6], s = A[7], h = A[8], t = A[9], y = A[10], n = A[11], w = A[12], r = A[13], G = A[14], c = A[15], N = I[0], d = I[1], L = I[2], k = I[3];
1165
1165
  return g[0] = N * B + d * i + L * h + k * w, g[1] = N * C + d * o + L * t + k * r, g[2] = N * Q + d * a + L * y + k * G, g[3] = N * E + d * s + L * n + k * c, N = I[4], d = I[5], L = I[6], k = I[7], g[4] = N * B + d * i + L * h + k * w, g[5] = N * C + d * o + L * t + k * r, g[6] = N * Q + d * a + L * y + k * G, g[7] = N * E + d * s + L * n + k * c, N = I[8], d = I[9], L = I[10], k = I[11], g[8] = N * B + d * i + L * h + k * w, g[9] = N * C + d * o + L * t + k * r, g[10] = N * Q + d * a + L * y + k * G, g[11] = N * E + d * s + L * n + k * c, N = I[12], d = I[13], L = I[14], k = I[15], g[12] = N * B + d * i + L * h + k * w, g[13] = N * C + d * o + L * t + k * r, g[14] = N * Q + d * a + L * y + k * G, g[15] = N * E + d * s + L * n + k * c, g;
1166
1166
  }
1167
- function kC(g, A) {
1167
+ function JC(g, A) {
1168
1168
  return g[0] = A[0], g[1] = 0, g[2] = 0, g[3] = 0, g[4] = 0, g[5] = A[1], g[6] = 0, g[7] = 0, g[8] = 0, g[9] = 0, g[10] = A[2], g[11] = 0, g[12] = 0, g[13] = 0, g[14] = 0, g[15] = 1, g;
1169
1169
  }
1170
- function LC(g, A, I, B) {
1170
+ function YC(g, A, I, B) {
1171
1171
  var C = A[0], Q = A[1], E = A[2], i = A[3], o = C + C, a = Q + Q, s = E + E, h = C * o, t = C * a, y = C * s, n = Q * a, w = Q * s, r = E * s, G = i * o, c = i * a, N = i * s, d = B[0], L = B[1], k = B[2];
1172
1172
  return g[0] = (1 - (n + r)) * d, g[1] = (t + N) * d, g[2] = (y - c) * d, g[3] = 0, g[4] = (t - N) * L, g[5] = (1 - (h + r)) * L, g[6] = (w + G) * L, g[7] = 0, g[8] = (y + c) * k, g[9] = (w - G) * k, g[10] = (1 - (h + n)) * k, g[11] = 0, g[12] = I[0], g[13] = I[1], g[14] = I[2], g[15] = 1, g;
1173
1173
  }
1174
- function JC(g, A, I, B, C) {
1174
+ function dC(g, A, I, B, C) {
1175
1175
  var Q = 1 / Math.tan(A / 2), E;
1176
1176
  return g[0] = Q / I, g[1] = 0, g[2] = 0, g[3] = 0, g[4] = 0, g[5] = Q, g[6] = 0, g[7] = 0, g[8] = 0, g[9] = 0, g[11] = -1, g[12] = 0, g[13] = 0, g[15] = 0, C != null && C !== 1 / 0 ? (E = 1 / (B - C), g[10] = (C + B) * E, g[14] = 2 * C * B * E) : (g[10] = -1, g[14] = -2 * B), g;
1177
1177
  }
1178
- var YC = JC;
1179
- function dC(g, A, I, B, C, Q, E) {
1178
+ var MC = dC;
1179
+ function KC(g, A, I, B, C, Q, E) {
1180
1180
  var i = 1 / (A - I), o = 1 / (B - C), a = 1 / (Q - E);
1181
1181
  return g[0] = -2 * i, g[1] = 0, g[2] = 0, g[3] = 0, g[4] = 0, g[5] = -2 * o, g[6] = 0, g[7] = 0, g[8] = 0, g[9] = 0, g[10] = 2 * a, g[11] = 0, g[12] = (A + I) * i, g[13] = (C + B) * o, g[14] = (E + Q) * a, g[15] = 1, g;
1182
1182
  }
1183
- var MC = dC;
1184
- function KC(g, A, I, B) {
1183
+ var HC = KC;
1184
+ function qC(g, A, I, B) {
1185
1185
  var C = A[0], Q = A[1], E = A[2], i = B[0], o = B[1], a = B[2], s = C - I[0], h = Q - I[1], t = E - I[2], y = s * s + h * h + t * t;
1186
1186
  y > 0 && (y = 1 / Math.sqrt(y), s *= y, h *= y, t *= y);
1187
1187
  var n = o * t - a * h, w = a * s - i * t, r = i * h - o * s;
1188
1188
  return y = n * n + w * w + r * r, y > 0 && (y = 1 / Math.sqrt(y), n *= y, w *= y, r *= y), g[0] = n, g[1] = w, g[2] = r, g[3] = 0, g[4] = h * r - t * w, g[5] = t * n - s * r, g[6] = s * w - h * n, g[7] = 0, g[8] = s, g[9] = h, g[10] = t, g[11] = 0, g[12] = C, g[13] = Q, g[14] = E, g[15] = 1, g;
1189
1189
  }
1190
- function HC(g, A) {
1190
+ function lC(g, A) {
1191
1191
  var I = g[0], B = g[1], C = g[2], Q = g[3], E = g[4], i = g[5], o = g[6], a = g[7], s = g[8], h = g[9], t = g[10], y = g[11], n = g[12], w = g[13], r = g[14], G = g[15], c = A[0], N = A[1], d = A[2], L = A[3], k = A[4], T = A[5], P = A[6], O = A[7], Z = A[8], V = A[9], iA = A[10], oA = A[11], u = A[12], xg = A[13], Wg = A[14], bg = A[15];
1192
1192
  return Math.abs(I - c) <= p * Math.max(1, Math.abs(I), Math.abs(c)) && Math.abs(B - N) <= p * Math.max(1, Math.abs(B), Math.abs(N)) && Math.abs(C - d) <= p * Math.max(1, Math.abs(C), Math.abs(d)) && Math.abs(Q - L) <= p * Math.max(1, Math.abs(Q), Math.abs(L)) && Math.abs(E - k) <= p * Math.max(1, Math.abs(E), Math.abs(k)) && Math.abs(i - T) <= p * Math.max(1, Math.abs(i), Math.abs(T)) && Math.abs(o - P) <= p * Math.max(1, Math.abs(o), Math.abs(P)) && Math.abs(a - O) <= p * Math.max(1, Math.abs(a), Math.abs(O)) && Math.abs(s - Z) <= p * Math.max(1, Math.abs(s), Math.abs(Z)) && Math.abs(h - V) <= p * Math.max(1, Math.abs(h), Math.abs(V)) && Math.abs(t - iA) <= p * Math.max(1, Math.abs(t), Math.abs(iA)) && Math.abs(y - oA) <= p * Math.max(1, Math.abs(y), Math.abs(oA)) && Math.abs(n - u) <= p * Math.max(1, Math.abs(n), Math.abs(u)) && Math.abs(w - xg) <= p * Math.max(1, Math.abs(w), Math.abs(xg)) && Math.abs(r - Wg) <= p * Math.max(1, Math.abs(r), Math.abs(Wg)) && Math.abs(G - bg) <= p * Math.max(1, Math.abs(G), Math.abs(bg));
1193
1193
  }
@@ -1216,10 +1216,10 @@ function SA(g, A, I, B) {
1216
1216
  function lA(g, A, I) {
1217
1217
  return g[0] = A[0] + I[0], g[1] = A[1] + I[1], g[2] = A[2] + I[2], g;
1218
1218
  }
1219
- function qC(g, A, I) {
1219
+ function fC(g, A, I) {
1220
1220
  return g[0] = A[0] - I[0], g[1] = A[1] - I[1], g[2] = A[2] - I[2], g;
1221
1221
  }
1222
- function lC(g, A, I) {
1222
+ function pC(g, A, I) {
1223
1223
  return g[0] = A[0] * I[0], g[1] = A[1] * I[1], g[2] = A[2] * I[2], g;
1224
1224
  }
1225
1225
  function fA(g, A, I) {
@@ -1236,18 +1236,18 @@ function Vg(g, A) {
1236
1236
  var I = A[0] - g[0], B = A[1] - g[1], C = A[2] - g[2];
1237
1237
  return I * I + B * B + C * C;
1238
1238
  }
1239
- function fC(g, A) {
1239
+ function mC(g, A) {
1240
1240
  var I = A[0], B = A[1], C = A[2], Q = I * I + B * B + C * C;
1241
1241
  return Q > 0 && (Q = 1 / Math.sqrt(Q)), g[0] = A[0] * Q, g[1] = A[1] * Q, g[2] = A[2] * Q, g;
1242
1242
  }
1243
- function YB(g, A) {
1243
+ function dB(g, A) {
1244
1244
  return g[0] * A[0] + g[1] * A[1] + g[2] * A[2];
1245
1245
  }
1246
1246
  function XI(g, A, I) {
1247
1247
  var B = A[0], C = A[1], Q = A[2], E = I[0], i = I[1], o = I[2];
1248
1248
  return g[0] = C * o - Q * i, g[1] = Q * E - B * o, g[2] = B * i - C * E, g;
1249
1249
  }
1250
- function pC(g, A, I, B, C, Q) {
1250
+ function uC(g, A, I, B, C, Q) {
1251
1251
  var E = 1 - Q, i = E * E, o = Q * Q, a = i * E, s = 3 * Q * i, h = 3 * o * E, t = o * Q;
1252
1252
  return g[0] = A[0] * a + I[0] * s + B[0] * h + C[0] * t, g[1] = A[1] * a + I[1] * s + B[1] * h + C[1] * t, g[2] = A[2] * a + I[2] * s + B[2] * h + C[2] * t, g;
1253
1253
  }
@@ -1255,14 +1255,14 @@ function uI(g, A, I) {
1255
1255
  var B = A[0], C = A[1], Q = A[2], E = I[3] * B + I[7] * C + I[11] * Q + I[15];
1256
1256
  return E = E || 1, g[0] = (I[0] * B + I[4] * C + I[8] * Q + I[12]) / E, g[1] = (I[1] * B + I[5] * C + I[9] * Q + I[13]) / E, g[2] = (I[2] * B + I[6] * C + I[10] * Q + I[14]) / E, g;
1257
1257
  }
1258
- function mC(g) {
1258
+ function TC(g) {
1259
1259
  return g[0] = 0, g[1] = 0, g[2] = 0, g;
1260
1260
  }
1261
- function dB(g, A) {
1261
+ function MB(g, A) {
1262
1262
  var I = g[0], B = g[1], C = g[2], Q = A[0], E = A[1], i = A[2];
1263
1263
  return Math.abs(I - Q) <= p * Math.max(1, Math.abs(I), Math.abs(Q)) && Math.abs(B - E) <= p * Math.max(1, Math.abs(B), Math.abs(E)) && Math.abs(C - i) <= p * Math.max(1, Math.abs(C), Math.abs(i));
1264
1264
  }
1265
- var UI = qC, uC = eg;
1265
+ var UI = fC, xC = eg;
1266
1266
  (function() {
1267
1267
  var g = f();
1268
1268
  return function(A, I, B, C, Q, E) {
@@ -1276,7 +1276,7 @@ function pA() {
1276
1276
  var g = new b(4);
1277
1277
  return b != Float32Array && (g[0] = 0, g[1] = 0, g[2] = 0, g[3] = 0), g;
1278
1278
  }
1279
- function TC(g) {
1279
+ function WC(g) {
1280
1280
  var A = new b(4);
1281
1281
  return A[0] = g[0], A[1] = g[1], A[2] = g[2], A[3] = g[3], A;
1282
1282
  }
@@ -1284,13 +1284,13 @@ function kI(g, A, I, B) {
1284
1284
  var C = new b(4);
1285
1285
  return C[0] = g, C[1] = A, C[2] = I, C[3] = B, C;
1286
1286
  }
1287
- function xC(g, A) {
1287
+ function bC(g, A) {
1288
1288
  return g[0] = A[0], g[1] = A[1], g[2] = A[2], g[3] = A[3], g;
1289
1289
  }
1290
- function WC(g, A, I) {
1290
+ function ZC(g, A, I) {
1291
1291
  return g[0] = A[0] * I, g[1] = A[1] * I, g[2] = A[2] * I, g[3] = A[3] * I, g;
1292
1292
  }
1293
- function bC(g, A) {
1293
+ function PC(g, A) {
1294
1294
  var I = A[0], B = A[1], C = A[2], Q = A[3], E = I * I + B * B + C * C + Q * Q;
1295
1295
  return E > 0 && (E = 1 / Math.sqrt(E)), g[0] = I * E, g[1] = B * E, g[2] = C * E, g[3] = Q * E, g;
1296
1296
  }
@@ -1311,12 +1311,12 @@ function Cg() {
1311
1311
  var g = new b(4);
1312
1312
  return b != Float32Array && (g[0] = 0, g[1] = 0, g[2] = 0), g[3] = 1, g;
1313
1313
  }
1314
- function ZC(g, A, I) {
1314
+ function OC(g, A, I) {
1315
1315
  I = I * 0.5;
1316
1316
  var B = Math.sin(I);
1317
1317
  return g[0] = B * A[0], g[1] = B * A[1], g[2] = B * A[2], g[3] = Math.cos(I), g;
1318
1318
  }
1319
- function PC(g, A, I) {
1319
+ function VC(g, A, I) {
1320
1320
  var B = A[0], C = A[1], Q = A[2], E = A[3], i = I[0], o = I[1], a = I[2], s = I[3];
1321
1321
  return g[0] = B * s + E * i + C * a - Q * o, g[1] = C * s + E * o + Q * i - B * a, g[2] = Q * s + E * a + B * o - C * i, g[3] = E * s - B * i - C * o - Q * a, g;
1322
1322
  }
@@ -1324,7 +1324,7 @@ function jI(g, A, I, B) {
1324
1324
  var C = A[0], Q = A[1], E = A[2], i = A[3], o = I[0], a = I[1], s = I[2], h = I[3], t, y, n, w, r;
1325
1325
  return y = C * o + Q * a + E * s + i * h, y < 0 && (y = -y, o = -o, a = -a, s = -s, h = -h), 1 - y > p ? (t = Math.acos(y), n = Math.sin(t), w = Math.sin((1 - B) * t) / n, r = Math.sin(B * t) / n) : (w = 1 - B, r = B), g[0] = w * C + r * o, g[1] = w * Q + r * a, g[2] = w * E + r * s, g[3] = w * i + r * h, g;
1326
1326
  }
1327
- function MB(g, A) {
1327
+ function KB(g, A) {
1328
1328
  var I = A[0] + A[4] + A[8], B;
1329
1329
  if (I > 0)
1330
1330
  B = Math.sqrt(I + 1), g[3] = 0.5 * B, B = 0.5 / B, g[0] = (A[5] - A[7]) * B, g[1] = (A[6] - A[2]) * B, g[2] = (A[1] - A[3]) * B;
@@ -1336,12 +1336,12 @@ function MB(g, A) {
1336
1336
  }
1337
1337
  return g;
1338
1338
  }
1339
- var OC = TC, VC = xC, Gg = bC;
1339
+ var vC = WC, XC = bC, Gg = PC;
1340
1340
  (function() {
1341
1341
  var g = f(), A = q(1, 0, 0), I = q(0, 1, 0);
1342
1342
  return function(B, C, Q) {
1343
- var E = YB(C, Q);
1344
- return E < -0.999999 ? (XI(g, A, C), uC(g) < 1e-6 && XI(g, I, C), fC(g, g), ZC(B, g, Math.PI), B) : E > 0.999999 ? (B[0] = 0, B[1] = 0, B[2] = 0, B[3] = 1, B) : (XI(g, C, Q), B[0] = g[0], B[1] = g[1], B[2] = g[2], B[3] = 1 + E, Gg(B, B));
1343
+ var E = dB(C, Q);
1344
+ return E < -0.999999 ? (XI(g, A, C), xC(g) < 1e-6 && XI(g, I, C), mC(g, g), OC(B, g, Math.PI), B) : E > 0.999999 ? (B[0] = 0, B[1] = 0, B[2] = 0, B[3] = 1, B) : (XI(g, C, Q), B[0] = g[0], B[1] = g[1], B[2] = g[2], B[3] = 1 + E, Gg(B, B));
1345
1345
  };
1346
1346
  })();
1347
1347
  (function() {
@@ -1351,12 +1351,12 @@ var OC = TC, VC = xC, Gg = bC;
1351
1351
  };
1352
1352
  })();
1353
1353
  (function() {
1354
- var g = JB();
1354
+ var g = YB();
1355
1355
  return function(A, I, B, C) {
1356
- return g[0] = B[0], g[3] = B[1], g[6] = B[2], g[1] = C[0], g[4] = C[1], g[7] = C[2], g[2] = -I[0], g[5] = -I[1], g[8] = -I[2], Gg(A, MB(A, g));
1356
+ return g[0] = B[0], g[3] = B[1], g[6] = B[2], g[1] = C[0], g[4] = C[1], g[7] = C[2], g[2] = -I[0], g[5] = -I[1], g[8] = -I[2], Gg(A, KB(A, g));
1357
1357
  };
1358
1358
  })();
1359
- function KB() {
1359
+ function HB() {
1360
1360
  var g = new b(2);
1361
1361
  return b != Float32Array && (g[0] = 0, g[1] = 0), g;
1362
1362
  }
@@ -1368,15 +1368,15 @@ function W(g, A) {
1368
1368
  var I = new b(2);
1369
1369
  return I[0] = g, I[1] = A, I;
1370
1370
  }
1371
- function vC(g, A) {
1371
+ function jC(g, A) {
1372
1372
  var I = A[0] - g[0], B = A[1] - g[1];
1373
1373
  return Math.hypot(I, B);
1374
1374
  }
1375
- function XC(g) {
1375
+ function zC(g) {
1376
1376
  var A = g[0], I = g[1];
1377
1377
  return A * A + I * I;
1378
1378
  }
1379
- function jC(g, A, I, B) {
1379
+ function _C(g, A, I, B) {
1380
1380
  var C = A[0], Q = A[1];
1381
1381
  return g[0] = C + B * (I[0] - C), g[1] = Q + B * (I[1] - Q), g;
1382
1382
  }
@@ -1388,7 +1388,7 @@ function zI(g, A) {
1388
1388
  return Math.abs(I - C) <= p * Math.max(1, Math.abs(I), Math.abs(C)) && Math.abs(B - Q) <= p * Math.max(1, Math.abs(B), Math.abs(Q));
1389
1389
  }
1390
1390
  (function() {
1391
- var g = KB();
1391
+ var g = HB();
1392
1392
  return function(A, I, B, C, Q, E) {
1393
1393
  var i, o;
1394
1394
  for (I || (I = 2), B || (B = 0), C ? o = Math.min(C * I + B, A.length) : o = A.length, i = B; i < o; i += I)
@@ -1438,7 +1438,7 @@ class RA {
1438
1438
  uI(Q, E, A), this.expandWithPoint(Q);
1439
1439
  }
1440
1440
  }
1441
- const zC = {
1441
+ const $C = {
1442
1442
  position: 0,
1443
1443
  normal: 1,
1444
1444
  uv: 2,
@@ -1502,7 +1502,7 @@ class bA extends yg {
1502
1502
  return this.attributes_.find((I) => I.type === A);
1503
1503
  }
1504
1504
  }
1505
- class _C {
1505
+ class AQ {
1506
1506
  gl_;
1507
1507
  buffers_ = /* @__PURE__ */ new Map();
1508
1508
  currentGeometry_ = null;
@@ -1538,7 +1538,7 @@ class _C {
1538
1538
  this.gl_.bindBuffer(C, Q), this.gl_.bufferData(C, B, this.gl_.STATIC_DRAW);
1539
1539
  const { attributes: E, strideBytes: i } = A;
1540
1540
  E.forEach((s) => {
1541
- const h = zC[s.type];
1541
+ const h = $C[s.type];
1542
1542
  this.gl_.vertexAttribPointer(
1543
1543
  h,
1544
1544
  s.itemSize,
@@ -1557,7 +1557,7 @@ class _C {
1557
1557
  this.buffers_.set(A, o), this.gl_.bindVertexArray(null);
1558
1558
  }
1559
1559
  }
1560
- class $C {
1560
+ class IQ {
1561
1561
  gl_;
1562
1562
  textures_ = /* @__PURE__ */ new Map();
1563
1563
  currentTexture_ = null;
@@ -1837,7 +1837,7 @@ class AA {
1837
1837
  return { x: A, y: I, width: B, height: C };
1838
1838
  }
1839
1839
  }
1840
- class AQ {
1840
+ class gQ {
1841
1841
  gl_;
1842
1842
  enabledCapabilities_ = /* @__PURE__ */ new Map();
1843
1843
  depthMaskEnabled_ = null;
@@ -1937,8 +1937,8 @@ class AQ {
1937
1937
  A ? this.enable(this.gl_.STENCIL_TEST) : this.disable(this.gl_.STENCIL_TEST);
1938
1938
  }
1939
1939
  }
1940
- const IQ = kC(_(), [1, -1, 1]);
1941
- class gQ extends oC {
1940
+ const BQ = JC(_(), [1, -1, 1]);
1941
+ class CQ extends sC {
1942
1942
  gl_;
1943
1943
  programs_;
1944
1944
  bindings_;
@@ -1957,33 +1957,26 @@ class gQ extends oC {
1957
1957
  this.gl_ = I, U.info(
1958
1958
  "WebGLRenderer",
1959
1959
  `WebGL version ${I.getParameter(I.VERSION)}`
1960
- ), this.programs_ = new RC(I), this.bindings_ = new _C(I), this.textures_ = new $C(I), this.state_ = new AQ(I), this.initStencil(), this.resize(this.canvas.width, this.canvas.height);
1960
+ ), this.programs_ = new cC(I), this.bindings_ = new AQ(I), this.textures_ = new IQ(I), this.state_ = new gQ(I), this.initStencil(), this.resize(this.canvas.width, this.canvas.height);
1961
1961
  }
1962
1962
  render(A) {
1963
- const I = A.getBoxRelativeTo(this.canvas), B = new AA(
1963
+ let I = getComputedStyle(A.element).visibility !== "hidden";
1964
+ const B = A.getBoxRelativeTo(this.canvas), C = new AA(
1964
1965
  W(0, 0),
1965
1966
  W(this.width, this.height)
1966
1967
  );
1967
- if (AA.equals(I.floor(), B.floor()))
1968
- this.state_.setScissorTest(!1);
1969
- else if (AA.intersects(I, B))
1970
- this.state_.setScissor(I), this.state_.setScissorTest(!0);
1971
- else {
1972
- U.warn(
1973
- "WebGLRenderer",
1974
- `Viewport ${A.id} is entirely outside canvas bounds, skipping render`
1975
- );
1976
- return;
1977
- }
1978
- this.state_.setViewport(I), this.renderedObjectsPerFrame_ = 0, this.clear();
1979
- const { opaque: C, transparent: Q } = A.layerManager.partitionLayers();
1968
+ AA.equals(B.floor(), C.floor()) ? this.state_.setScissorTest(!1) : AA.intersects(B, C) ? (this.state_.setScissor(B), this.state_.setScissorTest(!0)) : (U.warn(
1969
+ "WebGLRenderer",
1970
+ `Viewport ${A.id} is entirely outside canvas bounds, skipping render`
1971
+ ), I = !1), this.state_.setViewport(B), this.renderedObjectsPerFrame_ = 0, I && this.clear();
1972
+ const { opaque: Q, transparent: E } = A.layerManager.partitionLayers();
1980
1973
  this.state_.setDepthMask(!0);
1981
- const E = A.camera.frustum, i = { viewport: A };
1982
- for (const o of C)
1983
- o.update(i), o.state === "ready" && this.renderLayer(o, A.camera, E);
1974
+ const i = A.camera.frustum, o = { viewport: A };
1975
+ for (const a of Q)
1976
+ a.update(o), a.state === "ready" && I && this.renderLayer(a, A.camera, i);
1984
1977
  this.state_.setDepthMask(!1);
1985
- for (const o of Q)
1986
- o.update(i), o.state === "ready" && this.renderLayer(o, A.camera, E);
1978
+ for (const a of E)
1979
+ a.update(o), a.state === "ready" && I && this.renderLayer(a, A.camera, i);
1987
1980
  this.state_.setDepthMask(!0), this.renderedObjects_ = this.renderedObjectsPerFrame_;
1988
1981
  }
1989
1982
  get textureInfo() {
@@ -2028,7 +2021,7 @@ class gQ extends oC {
2028
2021
  I.transform.matrix
2029
2022
  ), i = zA(
2030
2023
  _(),
2031
- IQ,
2024
+ BQ,
2032
2025
  Q.projectionMatrix
2033
2026
  ), o = [this.canvas.width, this.canvas.height], a = I.getUniforms(), h = {
2034
2027
  ...B.getUniforms(),
@@ -2095,12 +2088,12 @@ class gQ extends oC {
2095
2088
  this.gl_.clearColor(...this.backgroundColor.rgba), this.gl_.clear(this.gl_.COLOR_BUFFER_BIT | this.gl_.DEPTH_BUFFER_BIT), this.state_.setDepthTesting(!0), this.gl_.depthFunc(this.gl_.LEQUAL);
2096
2089
  }
2097
2090
  }
2098
- const BQ = 8;
2099
- class CQ {
2091
+ const QQ = 8;
2092
+ class EQ {
2100
2093
  maxConcurrent_;
2101
2094
  pending_ = [];
2102
2095
  running_ = /* @__PURE__ */ new Map();
2103
- constructor(A = BQ) {
2096
+ constructor(A = QQ) {
2104
2097
  this.maxConcurrent_ = Math.max(1, A);
2105
2098
  }
2106
2099
  enqueue(A, I) {
@@ -2166,7 +2159,7 @@ function zg(g) {
2166
2159
  `Unsupported chunk data type: ${g}. Supported data types: ${A}`
2167
2160
  ), !1;
2168
2161
  }
2169
- function QQ(g, A) {
2162
+ function iQ(g, A) {
2170
2163
  return Math.round((A - g.translation) / g.scale);
2171
2164
  }
2172
2165
  function Qg(g, A, I = 1e-6) {
@@ -2176,7 +2169,7 @@ function cA(g, A, I) {
2176
2169
  return Math.max(A, Math.min(I, g));
2177
2170
  }
2178
2171
  const ng = Symbol("INTERNAL_POLICY_KEY");
2179
- class EQ {
2172
+ class oQ {
2180
2173
  store_;
2181
2174
  policy_;
2182
2175
  policyChanged_ = !1;
@@ -2195,7 +2188,7 @@ class EQ {
2195
2188
  this.policy_.profile
2196
2189
  );
2197
2190
  const B = this.store_.dimensions, C = B.x.lods[0], Q = B.y.lods[0];
2198
- this.sourceMaxSquareDistance2D_ = XC(
2191
+ this.sourceMaxSquareDistance2D_ = zC(
2199
2192
  W(C.size * C.scale, Q.size * Q.scale)
2200
2193
  );
2201
2194
  }
@@ -2244,8 +2237,8 @@ class EQ {
2244
2237
  ), this.chunkViewStates_.clear();
2245
2238
  return;
2246
2239
  }
2247
- const w = KB();
2248
- jC(w, Q.min, Q.max, 0.5);
2240
+ const w = HB();
2241
+ _C(w, Q.min, Q.max, 0.5);
2249
2242
  const [r, G] = this.getZBounds(A), c = new RA(
2250
2243
  q(Q.min[0], Q.min[1], r),
2251
2244
  q(Q.max[0], Q.max[1], G)
@@ -2443,7 +2436,7 @@ class EQ {
2443
2436
  return this.lastViewBounds2D_ === null || !zI(this.lastViewBounds2D_.min, A.min) || !zI(this.lastViewBounds2D_.max, A.max);
2444
2437
  }
2445
2438
  hasViewProjectionChanged(A) {
2446
- return this.lastViewProjection_ === null || !HC(this.lastViewProjection_, A);
2439
+ return this.lastViewProjection_ === null || !lC(this.lastViewProjection_, A);
2447
2440
  }
2448
2441
  zBoundsChanged(A) {
2449
2442
  return !this.lastZBounds_ || !zI(this.lastZBounds_, A);
@@ -2475,7 +2468,7 @@ class EQ {
2475
2468
  function _I(g) {
2476
2469
  g.visible = !1, g.prefetch = !1, g.priority = null, g.orderKey = null;
2477
2470
  }
2478
- class iQ {
2471
+ class aQ {
2479
2472
  chunks_;
2480
2473
  loader_;
2481
2474
  lowestResLOD_;
@@ -2533,7 +2526,7 @@ class iQ {
2533
2526
  return this.chunks_[A];
2534
2527
  }
2535
2528
  getTimeIndex(A) {
2536
- return A.t === void 0 || this.dimensions_.t === void 0 ? 0 : QQ(this.dimensions_.t.lods[0], A.t);
2529
+ return A.t === void 0 || this.dimensions_.t === void 0 ? 0 : iQ(this.dimensions_.t.lods[0], A.t);
2537
2530
  }
2538
2531
  get lodCount() {
2539
2532
  return this.lowestResLOD_ + 1;
@@ -2548,7 +2541,7 @@ class iQ {
2548
2541
  return this.loader_.loadChunkData(A, I);
2549
2542
  }
2550
2543
  createView(A) {
2551
- const I = new EQ(this, A);
2544
+ const I = new oQ(this, A);
2552
2545
  return this.views_.push(I), this.hasHadViews_ = !0, I;
2553
2546
  }
2554
2547
  get views() {
@@ -2650,10 +2643,10 @@ class iQ {
2650
2643
  };
2651
2644
  }
2652
2645
  }
2653
- class oQ {
2646
+ class sQ {
2654
2647
  stores_ = /* @__PURE__ */ new Map();
2655
2648
  pendingStores_ = /* @__PURE__ */ new Map();
2656
- queue_ = new CQ();
2649
+ queue_ = new EQ();
2657
2650
  async addView(A, I) {
2658
2651
  return (await this.getOrCreateStore(A)).createView(I);
2659
2652
  }
@@ -2666,7 +2659,7 @@ class oQ {
2666
2659
  return B;
2667
2660
  const Q = (async () => {
2668
2661
  const i = await A.open();
2669
- return new iQ(i);
2662
+ return new aQ(i);
2670
2663
  })();
2671
2664
  this.pendingStores_.set(A, Q);
2672
2665
  const E = await Q;
@@ -2738,14 +2731,14 @@ XA.Panel = function(g, A, I, B) {
2738
2731
  }
2739
2732
  };
2740
2733
  };
2741
- function aQ({ scale: g } = { scale: 1.5 }) {
2734
+ function DQ({ scale: g } = { scale: 1.5 }) {
2742
2735
  const A = new XA(g);
2743
2736
  return A.showPanel(
2744
2737
  0
2745
2738
  /* 0 = fps, 1 = ms, 2 = mb */
2746
2739
  ), document.body.appendChild(A.dom), A;
2747
2740
  }
2748
- class sQ {
2741
+ class hQ {
2749
2742
  layers_ = [];
2750
2743
  callbacks_ = [];
2751
2744
  context_;
@@ -2802,10 +2795,10 @@ const Eg = [
2802
2795
  "pointercancel",
2803
2796
  "wheel"
2804
2797
  ];
2805
- function DQ(g) {
2798
+ function tQ(g) {
2806
2799
  return Eg.includes(g);
2807
2800
  }
2808
- class hQ {
2801
+ class yQ {
2809
2802
  propagationStopped_ = !1;
2810
2803
  type;
2811
2804
  event;
@@ -2821,7 +2814,7 @@ class hQ {
2821
2814
  this.propagationStopped_ = !0;
2822
2815
  }
2823
2816
  }
2824
- class tQ {
2817
+ class eQ {
2825
2818
  listeners_ = [];
2826
2819
  element_;
2827
2820
  isConnected_ = !1;
@@ -2860,16 +2853,16 @@ class tQ {
2860
2853
  });
2861
2854
  }
2862
2855
  handleEvent = (A) => {
2863
- if (!DQ(A.type)) {
2856
+ if (!tQ(A.type)) {
2864
2857
  U.error("EventDispatcher", `Unsupported event type ${A.type}`);
2865
2858
  return;
2866
2859
  }
2867
- const I = new hQ(A.type, A);
2860
+ const I = new yQ(A.type, A);
2868
2861
  for (const B of this.listeners_)
2869
2862
  if (B(I), I.propagationStopped) break;
2870
2863
  };
2871
2864
  }
2872
- class yQ {
2865
+ class GQ {
2873
2866
  id;
2874
2867
  element;
2875
2868
  camera;
@@ -2877,7 +2870,7 @@ class yQ {
2877
2870
  events;
2878
2871
  cameraControls;
2879
2872
  constructor(A) {
2880
- this.id = A.id, this.element = A.element, this.camera = A.camera, this.layerManager = A.layerManager, this.cameraControls = A.cameraControls, this.updateAspectRatio(), this.events = new tQ(this.element), this.events.addEventListener((I) => {
2873
+ this.id = A.id, this.element = A.element, this.camera = A.camera, this.layerManager = A.layerManager, this.cameraControls = A.cameraControls, this.updateAspectRatio(), this.events = new eQ(this.element), this.events.addEventListener((I) => {
2881
2874
  if (I.event instanceof PointerEvent || I.event instanceof WheelEvent) {
2882
2875
  const { clientX: B, clientY: C } = I.event, Q = W(B, C);
2883
2876
  I.clipPos = this.clientToClip(Q, 0), I.worldPos = this.camera.clipToWorld(I.clipPos);
@@ -2931,42 +2924,44 @@ class yQ {
2931
2924
  this.camera.setAspectRatio(B);
2932
2925
  }
2933
2926
  }
2934
- function eQ(g) {
2935
- const A = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new Set();
2936
- for (const B of g) {
2937
- if (I.has(B.id))
2927
+ function qB(g, A) {
2928
+ for (const I of A) {
2929
+ if (I.id === g.id)
2938
2930
  throw new Error(
2939
- `Duplicate viewport ID "${B.id}". Each viewport must have a unique ID.`
2931
+ `Duplicate viewport ID "${g.id}". Each viewport must have a unique ID.`
2940
2932
  );
2941
- if (I.add(B.id), A.has(B.element)) {
2942
- const C = A.get(B.element), Q = B.element.tagName.toLowerCase() + (B.element.id ? `#${B.element.id}` : "[element has no id]");
2933
+ if (I.element === g.element) {
2934
+ const B = g.element.tagName.toLowerCase() + (g.element.id ? `#${g.element.id}` : "[element has no id]");
2943
2935
  throw new Error(
2944
- `Multiple viewports cannot share the same HTML element: viewports "${C}" and "${B.id}" both use ${Q}`
2936
+ `Multiple viewports cannot share the same HTML element: viewports "${I.id}" and "${g.id}" both use ${B}`
2945
2937
  );
2946
2938
  }
2947
- A.set(B.element, B.id);
2948
2939
  }
2949
2940
  }
2950
- function GQ(g, A, I) {
2941
+ function nQ(g) {
2942
+ for (let A = 0; A < g.length; A++)
2943
+ qB(g[A], g.slice(0, A));
2944
+ }
2945
+ function _g(g, A, I) {
2951
2946
  const B = g.map((C) => {
2952
2947
  const Q = C.element ?? A;
2953
2948
  return {
2954
2949
  ...C,
2955
2950
  element: Q,
2956
- id: C.id ?? Q.id ?? LB(),
2957
- layerManager: new sQ(I)
2951
+ id: C.id ?? Q.id ?? JB(),
2952
+ layerManager: new hQ(I)
2958
2953
  };
2959
2954
  });
2960
- return eQ(B), B.map((C) => new yQ(C));
2955
+ return nQ(B), B.map((C) => new GQ(C));
2961
2956
  }
2962
- class nQ {
2957
+ class wQ {
2963
2958
  elements_;
2964
2959
  resizeObserver_;
2965
2960
  mediaQuery_;
2966
2961
  onMediaQueryChange_;
2967
2962
  onChange_;
2968
2963
  constructor(A = [], I) {
2969
- this.elements_ = A, this.onChange_ = I;
2964
+ this.elements_ = [...A], this.onChange_ = I;
2970
2965
  }
2971
2966
  connect() {
2972
2967
  if (this.resizeObserver_) {
@@ -3002,8 +2997,23 @@ class nQ {
3002
2997
  }
3003
2998
  this.resizeObserver_?.disconnect(), this.mediaQuery_ && this.onMediaQueryChange_ && this.mediaQuery_.removeEventListener("change", this.onMediaQueryChange_);
3004
2999
  }
3000
+ observe(A) {
3001
+ if (this.elements_.includes(A)) {
3002
+ U.warn("PixelSizeObserver", "Element already being observed");
3003
+ return;
3004
+ }
3005
+ this.elements_.push(A), this.resizeObserver_ && this.resizeObserver_.observe(A);
3006
+ }
3007
+ unobserve(A) {
3008
+ const I = this.elements_.indexOf(A);
3009
+ if (I === -1) {
3010
+ U.warn("PixelSizeObserver", "Element not being observed");
3011
+ return;
3012
+ }
3013
+ this.elements_.splice(I, 1), this.resizeObserver_ && this.resizeObserver_.unobserve(A);
3014
+ }
3005
3015
  }
3006
- class Ko {
3016
+ class Ho {
3007
3017
  chunkManager_;
3008
3018
  context_;
3009
3019
  renderer_;
@@ -3020,7 +3030,7 @@ class Ko {
3020
3030
  *
3021
3031
  * @param params - Configuration parameters for the Idetik instance
3022
3032
  * @param params.canvas - HTMLCanvasElement to render to
3023
- * @param params.viewports - Array of viewport configurations. (At least one required.)
3033
+ * @param params.viewports - Optional array of viewport configurations.
3024
3034
  * Each viewport renders with its own camera, layers, and controls.
3025
3035
  * The `element` property is optional and defaults to the canvas if not provided.
3026
3036
  * Elements must be unique across viewports.
@@ -3060,23 +3070,20 @@ class Ko {
3060
3070
  * ]
3061
3071
  * });
3062
3072
  *
3063
- * @throws {Error} If viewports array is empty or not provided
3064
3073
  * @throws {Error} If viewports have duplicate IDs or shared elements
3065
3074
  */
3066
3075
  constructor(A) {
3067
- if (this.canvas = A.canvas, A.viewports.length === 0)
3068
- throw new Error("At least one viewport config must be specified.");
3069
- this.renderer_ = new gQ(this.canvas), this.chunkManager_ = new oQ(), this.context_ = {
3076
+ this.canvas = A.canvas, this.renderer_ = new CQ(this.canvas), this.chunkManager_ = new sQ(), this.context_ = {
3070
3077
  chunkManager: this.chunkManager_
3071
- }, this.viewports_ = GQ(
3072
- A.viewports,
3078
+ }, this.viewports_ = _g(
3079
+ A.viewports ?? [],
3073
3080
  this.canvas,
3074
3081
  this.context_
3075
- ), this.overlays = A.overlays ?? [], A.showStats && (this.stats_ = aQ());
3082
+ ), this.overlays = A.overlays ?? [], A.showStats && (this.stats_ = DQ());
3076
3083
  const I = [this.canvas];
3077
3084
  for (const B of this.viewports_)
3078
3085
  B.element !== this.canvas && I.push(B.element);
3079
- this.sizeObserver_ = new nQ(I, () => {
3086
+ this.sizeObserver_ = new wQ(I, () => {
3080
3087
  this.renderer_.updateSize();
3081
3088
  for (const B of this.viewports_)
3082
3089
  B.updateSize(), this.renderer_.render(B);
@@ -3097,18 +3104,37 @@ class Ko {
3097
3104
  get viewports() {
3098
3105
  return this.viewports_;
3099
3106
  }
3107
+ get running() {
3108
+ return this.lastAnimationId_ !== void 0;
3109
+ }
3100
3110
  getViewport(A) {
3101
3111
  return this.viewports_.find((I) => I.id === A);
3102
3112
  }
3113
+ addViewport(A) {
3114
+ const [I] = _g(
3115
+ [A],
3116
+ this.canvas,
3117
+ this.context_
3118
+ );
3119
+ return qB(I, this.viewports_), this.viewports_.push(I), this.running && (I.events.connect(), I.element !== this.canvas && this.sizeObserver_.observe(I.element)), U.info("Idetik", `Added viewport "${I.id}"`), I;
3120
+ }
3121
+ removeViewport(A) {
3122
+ const I = this.viewports_.indexOf(A);
3123
+ return I === -1 ? (U.warn(
3124
+ "Idetik",
3125
+ `Viewport "${A.id}" not found, nothing to remove`
3126
+ ), !1) : (this.running && (A.events.disconnect(), A.element !== this.canvas && this.sizeObserver_.unobserve(A.element)), this.viewports_.splice(I, 1), U.info("Idetik", `Removed viewport "${A.id}"`), !0);
3127
+ }
3103
3128
  start() {
3104
- if (U.info("Idetik", "Idetik runtime starting"), this.lastAnimationId_ === void 0) {
3129
+ if (U.info("Idetik", "Idetik runtime starting"), this.running)
3130
+ U.warn("Idetik", "Idetik runtime already started");
3131
+ else {
3105
3132
  for (const A of this.viewports_)
3106
3133
  A.events.connect();
3107
3134
  this.sizeObserver_.connect(), this.lastAnimationId_ = requestAnimationFrame((A) => {
3108
3135
  this.lastTimestamp_ = A, this.animate(A);
3109
3136
  });
3110
- } else
3111
- U.warn("Idetik", "Idetik runtime already started");
3137
+ }
3112
3138
  return this;
3113
3139
  }
3114
3140
  animate(A) {
@@ -3125,7 +3151,7 @@ class Ko {
3125
3151
  );
3126
3152
  }
3127
3153
  stop() {
3128
- if (U.info("Idetik", "Idetik runtime stopping"), this.lastAnimationId_ === void 0)
3154
+ if (U.info("Idetik", "Idetik runtime stopping"), !this.running)
3129
3155
  U.warn("Idetik", "Idetik runtime not started");
3130
3156
  else {
3131
3157
  this.sizeObserver_.disconnect();
@@ -3135,7 +3161,7 @@ class Ko {
3135
3161
  }
3136
3162
  }
3137
3163
  }
3138
- class wQ extends bA {
3164
+ class FQ extends bA {
3139
3165
  constructor(A) {
3140
3166
  if (super(), A.primitive != "triangles") {
3141
3167
  U.warn("WireframeGeometry", "Only indexed geometries are supported");
@@ -3160,21 +3186,21 @@ class wQ extends bA {
3160
3186
  this.indexData_ = new Uint32Array(B);
3161
3187
  }
3162
3188
  }
3163
- const FQ = q(0, 1, 0);
3164
- class rQ {
3189
+ const rQ = q(0, 1, 0);
3190
+ class SQ {
3165
3191
  dirty_ = !0;
3166
3192
  matrix_ = _();
3167
3193
  rotation_ = Cg();
3168
3194
  translation_ = f();
3169
3195
  scale_ = q(1, 1, 1);
3170
3196
  addRotation(A) {
3171
- PC(this.rotation_, this.rotation_, A), this.dirty_ = !0;
3197
+ VC(this.rotation_, this.rotation_, A), this.dirty_ = !0;
3172
3198
  }
3173
3199
  setRotation(A) {
3174
- VC(this.rotation_, A), this.dirty_ = !0;
3200
+ XC(this.rotation_, A), this.dirty_ = !0;
3175
3201
  }
3176
3202
  get rotation() {
3177
- return OC(this.rotation_);
3203
+ return vC(this.rotation_);
3178
3204
  }
3179
3205
  addTranslation(A) {
3180
3206
  lA(this.translation_, this.translation_, A), this.dirty_ = !0;
@@ -3186,15 +3212,15 @@ class rQ {
3186
3212
  return BA(this.translation_);
3187
3213
  }
3188
3214
  addScale(A) {
3189
- lC(this.scale_, this.scale_, A), this.dirty_ = !0;
3215
+ pC(this.scale_, this.scale_, A), this.dirty_ = !0;
3190
3216
  }
3191
3217
  setScale(A) {
3192
3218
  HA(this.scale_, A), this.dirty_ = !0;
3193
3219
  }
3194
3220
  targetTo(A) {
3195
- dB(this.translation_, A) && (A = BA(A), A[2] += p);
3196
- const I = KC(_(), this.translation_, A, FQ), B = UC(JB(), I);
3197
- MB(this.rotation_, B), Gg(this.rotation_, this.rotation_), this.dirty_ = !0;
3221
+ MB(this.translation_, A) && (A = BA(A), A[2] += p);
3222
+ const I = qC(_(), this.translation_, A, rQ), B = LC(YB(), I);
3223
+ KB(this.rotation_, B), Gg(this.rotation_, this.rotation_), this.dirty_ = !0;
3198
3224
  }
3199
3225
  get scale() {
3200
3226
  return BA(this.scale_);
@@ -3206,7 +3232,7 @@ class rQ {
3206
3232
  return mI(_(), this.matrix);
3207
3233
  }
3208
3234
  computeMatrix() {
3209
- LC(
3235
+ YC(
3210
3236
  this.matrix_,
3211
3237
  this.rotation_,
3212
3238
  this.translation_,
@@ -3220,7 +3246,7 @@ class ZA extends yg {
3220
3246
  depthTest = !0;
3221
3247
  textures_ = [];
3222
3248
  staleTextures_ = [];
3223
- transform_ = new rQ();
3249
+ transform_ = new SQ();
3224
3250
  geometry_ = new bA();
3225
3251
  wireframeGeometry_ = null;
3226
3252
  programName_ = null;
@@ -3237,7 +3263,7 @@ class ZA extends yg {
3237
3263
  return this.geometry_;
3238
3264
  }
3239
3265
  get wireframeGeometry() {
3240
- return this.wireframeGeometry_ ??= new wQ(this.geometry), this.wireframeGeometry_;
3266
+ return this.wireframeGeometry_ ??= new FQ(this.geometry), this.wireframeGeometry_;
3241
3267
  }
3242
3268
  get textures() {
3243
3269
  return this.textures_;
@@ -3282,7 +3308,7 @@ class dA {
3282
3308
  this.normal = BA(A), this.signedDistance = I;
3283
3309
  }
3284
3310
  signedDistanceToPoint(A) {
3285
- return YB(this.normal, A) + this.signedDistance;
3311
+ return dB(this.normal, A) + this.signedDistance;
3286
3312
  }
3287
3313
  normalize() {
3288
3314
  const A = eg(this.normal);
@@ -3292,7 +3318,7 @@ class dA {
3292
3318
  }
3293
3319
  }
3294
3320
  }
3295
- class SQ {
3321
+ class RQ {
3296
3322
  planes_;
3297
3323
  constructor(A) {
3298
3324
  this.planes_ = [
@@ -3338,7 +3364,7 @@ class SQ {
3338
3364
  return !0;
3339
3365
  }
3340
3366
  }
3341
- class HB extends ZA {
3367
+ class lB extends ZA {
3342
3368
  projectionMatrix_ = _();
3343
3369
  near_ = 0;
3344
3370
  far_ = 0;
@@ -3360,7 +3386,7 @@ class HB extends ZA {
3360
3386
  return q(A[4], A[5], A[6]);
3361
3387
  }
3362
3388
  get frustum() {
3363
- return new SQ(
3389
+ return new RQ(
3364
3390
  zA(_(), this.projectionMatrix, this.viewMatrix)
3365
3391
  );
3366
3392
  }
@@ -3379,7 +3405,7 @@ class HB extends ZA {
3379
3405
  I,
3380
3406
  B
3381
3407
  );
3382
- WC(C, C, 1 / C[3]);
3408
+ ZC(C, C, 1 / C[3]);
3383
3409
  const Q = _A(
3384
3410
  pA(),
3385
3411
  C,
@@ -3388,13 +3414,13 @@ class HB extends ZA {
3388
3414
  return q(Q[0], Q[1], Q[2]);
3389
3415
  }
3390
3416
  }
3391
- const qB = 1.77, _g = 128, $g = 128 / qB;
3392
- class Ho extends HB {
3417
+ const fB = 1.77, $g = 128, AB = 128 / fB;
3418
+ class qo extends lB {
3393
3419
  // width_ and height_ should always be defined by constructor (see setFrame)
3394
- width_ = _g;
3395
- height_ = $g;
3396
- viewportAspectRatio_ = qB;
3397
- viewportSize_ = [_g, $g];
3420
+ width_ = $g;
3421
+ height_ = AB;
3422
+ viewportAspectRatio_ = fB;
3423
+ viewportSize_ = [$g, AB];
3398
3424
  constructor(A, I, B, C, Q = 0, E = 100) {
3399
3425
  super(), this.near_ = Q, this.far_ = E, this.setFrame(A, I, C, B), this.updateProjectionMatrix();
3400
3426
  }
@@ -3433,7 +3459,7 @@ class Ho extends HB {
3433
3459
  updateProjectionMatrix() {
3434
3460
  const A = this.width_, I = this.height_, B = A / I;
3435
3461
  let C = 0.5 * A, Q = 0.5 * I;
3436
- this.viewportAspectRatio_ > B ? C *= this.viewportAspectRatio_ / B : Q *= B / this.viewportAspectRatio_, this.viewportSize_ = [2 * C, 2 * Q], MC(
3462
+ this.viewportAspectRatio_ > B ? C *= this.viewportAspectRatio_ / B : Q *= B / this.viewportAspectRatio_, this.viewportSize_ = [2 * C, 2 * Q], HC(
3437
3463
  this.projectionMatrix_,
3438
3464
  -C,
3439
3465
  C,
@@ -3444,14 +3470,14 @@ class Ho extends HB {
3444
3470
  );
3445
3471
  }
3446
3472
  }
3447
- const RQ = 60, NQ = 1.77, rI = 0.1, $I = 180 - rI;
3448
- class qo extends HB {
3473
+ const NQ = 60, cQ = 1.77, rI = 0.1, $I = 180 - rI;
3474
+ class lo extends lB {
3449
3475
  fov_;
3450
3476
  aspectRatio_;
3451
3477
  constructor(A = {}) {
3452
3478
  const {
3453
- fov: I = RQ,
3454
- aspectRatio: B = NQ,
3479
+ fov: I = NQ,
3480
+ aspectRatio: B = cQ,
3455
3481
  near: C = 0.1,
3456
3482
  far: Q = 1e4,
3457
3483
  position: E = q(0, 0, 0)
@@ -3477,17 +3503,17 @@ class qo extends HB {
3477
3503
  this.fov_ = Math.max(rI, Math.min($I, this.fov_ / A)), this.updateProjectionMatrix();
3478
3504
  }
3479
3505
  updateProjectionMatrix() {
3480
- YC(
3506
+ MC(
3481
3507
  this.projectionMatrix_,
3482
- cC(this.fov),
3508
+ kC(this.fov),
3483
3509
  this.aspectRatio_,
3484
3510
  this.near_,
3485
3511
  this.far_
3486
3512
  );
3487
3513
  }
3488
3514
  }
3489
- const AB = 0;
3490
- class lo {
3515
+ const IB = 0;
3516
+ class fo {
3491
3517
  camera_;
3492
3518
  dragActive_ = !1;
3493
3519
  dragStart_ = f();
@@ -3527,7 +3553,7 @@ class lo {
3527
3553
  }
3528
3554
  onPointerDown(A) {
3529
3555
  const I = A.event;
3530
- !A.worldPos || I.button !== AB || (this.dragStart_ = BA(A.worldPos), this.dragActive_ = !0, I.target?.setPointerCapture?.(I.pointerId));
3556
+ !A.worldPos || I.button !== IB || (this.dragStart_ = BA(A.worldPos), this.dragActive_ = !0, I.target?.setPointerCapture?.(I.pointerId));
3531
3557
  }
3532
3558
  onPointerMove(A) {
3533
3559
  if (!this.dragActive_ || !A.worldPos) return;
@@ -3536,10 +3562,10 @@ class lo {
3536
3562
  }
3537
3563
  onPointerEnd(A) {
3538
3564
  const I = A.event;
3539
- !this.dragActive_ || I.button !== AB || (this.dragActive_ = !1, I.target?.releasePointerCapture?.(I.pointerId));
3565
+ !this.dragActive_ || I.button !== IB || (this.dragActive_ = !1, I.target?.releasePointerCapture?.(I.pointerId));
3540
3566
  }
3541
3567
  }
3542
- class IB {
3568
+ class gB {
3543
3569
  radius;
3544
3570
  phi;
3545
3571
  theta;
@@ -3555,22 +3581,22 @@ class IB {
3555
3581
  );
3556
3582
  }
3557
3583
  }
3558
- const Ag = -1, gB = 0, cQ = 1, BB = 9e-3, UQ = 1e-3, kQ = 9e-4, LQ = 0.5, JQ = 60;
3559
- class fo {
3584
+ const Ag = -1, BB = 0, UQ = 1, CB = 9e-3, kQ = 1e-3, LQ = 9e-4, JQ = 0.5, YQ = 60;
3585
+ class po {
3560
3586
  camera_;
3561
- orbitVelocity_ = new IB(0, 0, 0);
3587
+ orbitVelocity_ = new gB(0, 0, 0);
3562
3588
  panVelocity_ = f();
3563
3589
  currPos_;
3564
3590
  currCenter_ = f();
3565
3591
  dampingFactor_;
3566
3592
  currMouseButton_ = Ag;
3567
3593
  constructor(A, I) {
3568
- this.camera_ = A, this.currPos_ = new IB(
3594
+ this.camera_ = A, this.currPos_ = new gB(
3569
3595
  I?.radius ?? 1,
3570
3596
  I?.yaw ?? 0,
3571
3597
  I?.pitch ?? 0
3572
3598
  ), I?.target && HA(this.currCenter_, I.target), this.dampingFactor_ = cA(
3573
- I?.dampingFactor ?? LQ,
3599
+ I?.dampingFactor ?? JQ,
3574
3600
  0,
3575
3601
  1
3576
3602
  ), this.updateCamera();
@@ -3596,12 +3622,12 @@ class fo {
3596
3622
  }
3597
3623
  }
3598
3624
  onUpdate(A) {
3599
- if (this.orbitVelocity_.phi === 0 && this.orbitVelocity_.theta === 0 && this.orbitVelocity_.radius === 0 && dB(this.panVelocity_, q(0, 0, 0)))
3625
+ if (this.orbitVelocity_.phi === 0 && this.orbitVelocity_.theta === 0 && this.orbitVelocity_.radius === 0 && MB(this.panVelocity_, q(0, 0, 0)))
3600
3626
  return;
3601
3627
  this.currPos_.phi += this.orbitVelocity_.phi, this.currPos_.theta += this.orbitVelocity_.theta, this.currPos_.radius += this.orbitVelocity_.radius * this.currPos_.radius, lA(this.currCenter_, this.currCenter_, this.panVelocity_);
3602
3628
  const I = Math.PI / 2 - p;
3603
3629
  this.currPos_.theta = cA(this.currPos_.theta, -I, I), this.currPos_.radius = Math.max(0.01, this.currPos_.radius), this.updateCamera();
3604
- const B = Math.pow(1 - this.dampingFactor_, A * JQ);
3630
+ const B = Math.pow(1 - this.dampingFactor_, A * YQ);
3605
3631
  this.orbitVelocity_.phi *= B, this.orbitVelocity_.theta *= B, this.orbitVelocity_.radius *= B, fA(this.panVelocity_, this.panVelocity_, B), this.cutoffLowVelocity();
3606
3632
  }
3607
3633
  onPointerDown(A) {
@@ -3610,7 +3636,7 @@ class fo {
3610
3636
  }
3611
3637
  onPointerMove(A) {
3612
3638
  if (this.currMouseButton_ == Ag) return;
3613
- const I = A.event, B = I.movementX ?? 0, C = I.movementY ?? 0, Q = this.currMouseButton_ === gB && !I.shiftKey, E = this.currMouseButton_ === gB && I.shiftKey || this.currMouseButton_ === cQ;
3639
+ const I = A.event, B = I.movementX ?? 0, C = I.movementY ?? 0, Q = this.currMouseButton_ === BB && !I.shiftKey, E = this.currMouseButton_ === BB && I.shiftKey || this.currMouseButton_ === UQ;
3614
3640
  Q && this.orbit(B, C), E && this.pan(B, C);
3615
3641
  }
3616
3642
  onWheel(A) {
@@ -3625,21 +3651,21 @@ class fo {
3625
3651
  I.target?.releasePointerCapture?.(I.pointerId);
3626
3652
  }
3627
3653
  orbit(A, I) {
3628
- this.orbitVelocity_.phi -= A * BB, this.orbitVelocity_.theta += I * BB;
3654
+ this.orbitVelocity_.phi -= A * CB, this.orbitVelocity_.theta += I * CB;
3629
3655
  }
3630
3656
  pan(A, I) {
3631
- const B = this.currPos_.radius * UQ, C = f();
3657
+ const B = this.currPos_.radius * kQ, C = f();
3632
3658
  cI(C, C, this.camera_.right, A), cI(C, C, this.camera_.up, I), fA(C, C, B), UI(this.panVelocity_, this.panVelocity_, C);
3633
3659
  }
3634
3660
  zoom(A) {
3635
- this.orbitVelocity_.radius += A * kQ;
3661
+ this.orbitVelocity_.radius += A * LQ;
3636
3662
  }
3637
3663
  updateCamera() {
3638
3664
  const A = lA(f(), this.currCenter_, this.currPos_.toVec3());
3639
3665
  this.camera_.transform.setTranslation(A), this.camera_.transform.targetTo(this.currCenter_);
3640
3666
  }
3641
3667
  cutoffLowVelocity() {
3642
- Math.abs(this.orbitVelocity_.phi) < p && (this.orbitVelocity_.phi = 0), Math.abs(this.orbitVelocity_.theta) < p && (this.orbitVelocity_.theta = 0), Math.abs(this.orbitVelocity_.radius) < p && (this.orbitVelocity_.radius = 0), eg(this.panVelocity_) < p && mC(this.panVelocity_);
3668
+ Math.abs(this.orbitVelocity_.phi) < p && (this.orbitVelocity_.phi = 0), Math.abs(this.orbitVelocity_.theta) < p && (this.orbitVelocity_.theta = 0), Math.abs(this.orbitVelocity_.radius) < p && (this.orbitVelocity_.radius = 0), eg(this.panVelocity_) < p && TC(this.panVelocity_);
3643
3669
  }
3644
3670
  }
3645
3671
  class FA {
@@ -3824,7 +3850,7 @@ class wg extends ZA {
3824
3850
  };
3825
3851
  }
3826
3852
  }
3827
- class po extends FA {
3853
+ class mo extends FA {
3828
3854
  type = "AxesLayer";
3829
3855
  constructor(A) {
3830
3856
  super();
@@ -3860,7 +3886,7 @@ function Ig(g) {
3860
3886
  width: I
3861
3887
  });
3862
3888
  }
3863
- class mo extends FA {
3889
+ class uo extends FA {
3864
3890
  type = "ProjectedLineLayer";
3865
3891
  paths_ = [];
3866
3892
  constructor(A = []) {
@@ -3877,10 +3903,10 @@ class mo extends FA {
3877
3903
  // TODO: this is temporary - we may want to generalize this to all layers
3878
3904
  // for now it is used to set the initial camera position to be centered on the tracks
3879
3905
  get extent() {
3880
- return YQ(this.paths_.flat());
3906
+ return dQ(this.paths_.flat());
3881
3907
  }
3882
3908
  }
3883
- function YQ(g) {
3909
+ function dQ(g) {
3884
3910
  function A(o) {
3885
3911
  const a = g.map((s) => s[o]);
3886
3912
  return [Math.min(...a), Math.max(...a)];
@@ -3888,7 +3914,7 @@ function YQ(g) {
3888
3914
  const [I, B] = A(0), [C, Q] = A(1), [E, i] = A(2);
3889
3915
  return { xMin: I, xMax: B, yMin: C, yMax: Q, zMin: E, zMax: i };
3890
3916
  }
3891
- class uo extends FA {
3917
+ class To extends FA {
3892
3918
  type = "TracksLayer";
3893
3919
  tracks_ = [];
3894
3920
  constructor(A = []) {
@@ -3898,7 +3924,7 @@ class uo extends FA {
3898
3924
  this.tracks_.push(A);
3899
3925
  let I;
3900
3926
  if (A.interpolation) {
3901
- const i = MQ({
3927
+ const i = KQ({
3902
3928
  path: A.path,
3903
3929
  pointsPerSegment: A.interpolation.pointsPerSegment,
3904
3930
  tangentFactor: A.interpolation.tangentFactor
@@ -3929,10 +3955,10 @@ class uo extends FA {
3929
3955
  // for now it is used to set the initial camera position to be centered on the tracks
3930
3956
  get extent() {
3931
3957
  const A = this.tracks_.map((I) => I.path);
3932
- return dQ(A.flat());
3958
+ return MQ(A.flat());
3933
3959
  }
3934
3960
  }
3935
- function dQ(g) {
3961
+ function MQ(g) {
3936
3962
  function A(o) {
3937
3963
  const a = g.map((s) => s[o]);
3938
3964
  return [Math.min(...a), Math.max(...a)];
@@ -3940,12 +3966,12 @@ function dQ(g) {
3940
3966
  const [I, B] = A(0), [C, Q] = A(1), [E, i] = A(2);
3941
3967
  return { xMin: I, xMax: B, yMin: C, yMax: Q, zMin: E, zMax: i };
3942
3968
  }
3943
- function MQ({
3969
+ function KQ({
3944
3970
  path: g,
3945
3971
  pointsPerSegment: A,
3946
3972
  tangentFactor: I = 1 / 3
3947
3973
  }) {
3948
- const B = KQ(g), C = Array((g.length - 1) * A);
3974
+ const B = HQ(g), C = Array((g.length - 1) * A);
3949
3975
  for (let Q = 0; Q < g.length - 1; Q++) {
3950
3976
  const E = g[Q], i = g[Q + 1], o = BA(B[Q]);
3951
3977
  cI(o, E, o, I);
@@ -3953,12 +3979,12 @@ function MQ({
3953
3979
  cI(a, i, a, -I);
3954
3980
  for (let s = 0; s < A; s++) {
3955
3981
  const h = s / A, t = C[Q * A + s] = f();
3956
- pC(t, E, o, a, i, h);
3982
+ uC(t, E, o, a, i, h);
3957
3983
  }
3958
3984
  }
3959
3985
  return C;
3960
3986
  }
3961
- function KQ(g) {
3987
+ function HQ(g) {
3962
3988
  if (g.length < 2)
3963
3989
  throw new Error("Path must contain at least 2 points");
3964
3990
  const A = Array(g.length), I = f(), B = f();
@@ -3968,7 +3994,7 @@ function KQ(g) {
3968
3994
  }
3969
3995
  return A;
3970
3996
  }
3971
- class lB extends bA {
3997
+ class pB extends bA {
3972
3998
  constructor(A, I, B, C) {
3973
3999
  super();
3974
4000
  const Q = [], E = [], i = B, o = C, a = i + 1, s = o + 1, h = A / i, t = I / o;
@@ -3999,7 +4025,7 @@ class lB extends bA {
3999
4025
  });
4000
4026
  }
4001
4027
  }
4002
- function CB(g) {
4028
+ function QB(g) {
4003
4029
  return g === 1 || g === 2 || g === 4 || g === 8;
4004
4030
  }
4005
4031
  function mA(g) {
@@ -4019,7 +4045,7 @@ function mA(g) {
4019
4045
  return "float";
4020
4046
  throw new Error("Unsupported buffer type.");
4021
4047
  }
4022
- function HQ(g) {
4048
+ function qQ(g) {
4023
4049
  if (g.dataFormat === "rgb" || g.dataFormat === "rgba")
4024
4050
  return [0, 1];
4025
4051
  switch (g.dataType) {
@@ -4054,9 +4080,9 @@ class Fg extends yg {
4054
4080
  return "Texture";
4055
4081
  }
4056
4082
  }
4057
- const QB = 32;
4083
+ const EB = 32;
4058
4084
  function $A(g, { visible: A, color: I, contrastLimits: B }) {
4059
- return A === void 0 && (A = !0), I === void 0 ? I = l.WHITE : I = l.from(I), g !== null ? B = qQ(B, g) : B === void 0 && (U.debug(
4085
+ return A === void 0 && (A = !0), I === void 0 ? I = l.WHITE : I = l.from(I), g !== null ? B = lQ(B, g) : B === void 0 && (U.debug(
4060
4086
  "Channel",
4061
4087
  "No texture provided, defaulting channel contrast limits to [0, 1]."
4062
4088
  ), B = [0, 1]), {
@@ -4066,8 +4092,8 @@ function $A(g, { visible: A, color: I, contrastLimits: B }) {
4066
4092
  };
4067
4093
  }
4068
4094
  function ig(g, A) {
4069
- if (A.length > QB)
4070
- throw new Error(`Maximum number of channels is ${QB}`);
4095
+ if (A.length > EB)
4096
+ throw new Error(`Maximum number of channels is ${EB}`);
4071
4097
  if (g?.type === "Texture2DArray") {
4072
4098
  const I = g.depth;
4073
4099
  if (A.length !== I)
@@ -4077,9 +4103,9 @@ function ig(g, A) {
4077
4103
  }
4078
4104
  return A.map((I) => $A(g, I));
4079
4105
  }
4080
- function qQ(g, A) {
4106
+ function lQ(g, A) {
4081
4107
  if (g === void 0)
4082
- return HQ(A);
4108
+ return qQ(A);
4083
4109
  if (g[1] <= g[0])
4084
4110
  throw new Error(
4085
4111
  `Contrast limits must be strictly increasing: ${g}.`
@@ -4089,7 +4115,7 @@ function qQ(g, A) {
4089
4115
  class rg extends ZA {
4090
4116
  channels_;
4091
4117
  constructor(A, I, B, C = []) {
4092
- super(), this.geometry = new lB(A, I, 1, 1), this.setTexture(0, B), this.channels_ = ig(B, C), this.programName = lQ(B);
4118
+ super(), this.geometry = new pB(A, I, 1, 1), this.setTexture(0, B), this.channels_ = ig(B, C), this.programName = fQ(B);
4093
4119
  }
4094
4120
  get type() {
4095
4121
  return "ImageRenderable";
@@ -4134,14 +4160,14 @@ class rg extends ZA {
4134
4160
  }
4135
4161
  }
4136
4162
  }
4137
- function lQ(g) {
4163
+ function fQ(g) {
4138
4164
  if (g.type === "Texture2D")
4139
- return fQ(g.dataType);
4140
- if (g.type === "Texture2DArray")
4141
4165
  return pQ(g.dataType);
4166
+ if (g.type === "Texture2DArray")
4167
+ return mQ(g.dataType);
4142
4168
  throw new Error(`Unsupported image texture type: ${g.type}`);
4143
4169
  }
4144
- function fQ(g) {
4170
+ function pQ(g) {
4145
4171
  switch (g) {
4146
4172
  case "byte":
4147
4173
  case "int":
@@ -4155,7 +4181,7 @@ function fQ(g) {
4155
4181
  return "floatScalarImage";
4156
4182
  }
4157
4183
  }
4158
- function pQ(g) {
4184
+ function mQ(g) {
4159
4185
  switch (g) {
4160
4186
  case "byte":
4161
4187
  case "int":
@@ -4226,7 +4252,7 @@ function Sg(g, A, I, B, C = 3) {
4226
4252
  case "pointerup": {
4227
4253
  if (!A) return A;
4228
4254
  const Q = g.event, E = W(Q.clientX, Q.clientY);
4229
- if (vC(A, E) < C) {
4255
+ if (jC(A, E) < C) {
4230
4256
  if (!B) return null;
4231
4257
  const o = g.worldPos;
4232
4258
  if (o) {
@@ -4243,7 +4269,7 @@ function Sg(g, A, I, B, C = 3) {
4243
4269
  return A;
4244
4270
  }
4245
4271
  }
4246
- class fB {
4272
+ class mB {
4247
4273
  bins_ = /* @__PURE__ */ new Map();
4248
4274
  acquire(A) {
4249
4275
  const B = this.bins_.get(A)?.pop();
@@ -4258,13 +4284,13 @@ class fB {
4258
4284
  this.bins_.clear();
4259
4285
  }
4260
4286
  }
4261
- class pB extends FA {
4287
+ class uB extends FA {
4262
4288
  type = "ChunkedImageLayer";
4263
4289
  source_;
4264
4290
  sliceCoords_;
4265
4291
  onPickValue_;
4266
4292
  visibleChunks_ = /* @__PURE__ */ new Map();
4267
- pool_ = new fB();
4293
+ pool_ = new mB();
4268
4294
  initialChannelProps_;
4269
4295
  channelChangeCallbacks_ = [];
4270
4296
  policy_;
@@ -4334,7 +4360,7 @@ class pB extends FA {
4334
4360
  return this.lastPresentationTimeCoord_;
4335
4361
  }
4336
4362
  isPresentationStale() {
4337
- return this.lastPresentationTimeStamp_ === void 0 ? !1 : performance.now() - this.lastPresentationTimeStamp_ > pB.STALE_PRESENTATION_MS_;
4363
+ return this.lastPresentationTimeStamp_ === void 0 ? !1 : performance.now() - this.lastPresentationTimeStamp_ > uB.STALE_PRESENTATION_MS_;
4338
4364
  }
4339
4365
  resliceIfZChanged() {
4340
4366
  const A = this.sliceCoords_.z;
@@ -4384,7 +4410,7 @@ class pB extends FA {
4384
4410
  getImageForChunk(A) {
4385
4411
  const I = this.visibleChunks_.get(A);
4386
4412
  if (I) return I;
4387
- const B = this.pool_.acquire(EB(A));
4413
+ const B = this.pool_.acquire(iB(A));
4388
4414
  return B ? (B.textures[0].updateWithChunk(A, this.getDataForImage(A)), this.updateImageChunk(B, A), this.channelProps_ && B.setChannelProps(this.channelProps_), B) : this.createImage(A);
4389
4415
  }
4390
4416
  createImage(A) {
@@ -4467,18 +4493,18 @@ class pB extends FA {
4467
4493
  releaseAndRemoveChunks(A) {
4468
4494
  for (const I of A) {
4469
4495
  const B = this.visibleChunks_.get(I);
4470
- B && (this.pool_.release(EB(I), B), this.visibleChunks_.delete(I));
4496
+ B && (this.pool_.release(iB(I), B), this.visibleChunks_.delete(I));
4471
4497
  }
4472
4498
  }
4473
4499
  }
4474
- function EB(g) {
4500
+ function iB(g) {
4475
4501
  return [
4476
4502
  `lod${g.lod}`,
4477
4503
  `shape${g.shape.x}x${g.shape.y}`,
4478
4504
  `align${g.rowAlignmentBytes}`
4479
4505
  ].join(":");
4480
4506
  }
4481
- class mQ extends bA {
4507
+ class uQ extends bA {
4482
4508
  constructor(A, I, B, C, Q, E) {
4483
4509
  super();
4484
4510
  const i = [], o = [], a = Math.floor(C), s = Math.floor(Q), h = Math.floor(E);
@@ -4578,13 +4604,13 @@ class jA extends Fg {
4578
4604
  return B.unpackAlignment = A.rowAlignmentBytes, B;
4579
4605
  }
4580
4606
  }
4581
- class uQ extends ZA {
4607
+ class TQ extends ZA {
4582
4608
  voxelScale = q(1, 1, 1);
4583
4609
  channels_;
4584
4610
  channelToTextureIndex_ = /* @__PURE__ */ new Map();
4585
4611
  loadedChannels_ = /* @__PURE__ */ new Set();
4586
4612
  constructor() {
4587
- super(), this.geometry = new mQ(1, 1, 1, 1, 1, 1), this.cullFaceMode = "front", this.depthTest = !1, this.channels_ = [];
4613
+ super(), this.geometry = new uQ(1, 1, 1, 1, 1, 1), this.cullFaceMode = "front", this.depthTest = !1, this.channels_ = [];
4588
4614
  }
4589
4615
  get type() {
4590
4616
  return "VolumeRenderable";
@@ -4596,7 +4622,7 @@ class uQ extends ZA {
4596
4622
  addChannelTexture(A, I) {
4597
4623
  const B = jA.createWithChunk(I), C = this.textures.length;
4598
4624
  this.setTexture(C, B), this.channelToTextureIndex_.set(A, C);
4599
- const Q = TQ(B.dataType);
4625
+ const Q = xQ(B.dataType);
4600
4626
  if (this.programName && this.programName !== Q)
4601
4627
  throw new Error(
4602
4628
  `Volume renderable does not support multiple channels with different data types. Existing program: ${this.programName}, new channel data type: ${B.dataType} and program: ${Q}`
@@ -4684,7 +4710,7 @@ class uQ extends ZA {
4684
4710
  this.channels_[A] = C;
4685
4711
  }
4686
4712
  }
4687
- function TQ(g) {
4713
+ function xQ(g) {
4688
4714
  switch (g) {
4689
4715
  case "byte":
4690
4716
  case "int":
@@ -4698,7 +4724,7 @@ function TQ(g) {
4698
4724
  return "floatVolume";
4699
4725
  }
4700
4726
  }
4701
- function xQ(g, A) {
4727
+ function WQ(g, A) {
4702
4728
  const I = A.position, B = f(), C = f();
4703
4729
  return g.sort((Q, E) => {
4704
4730
  lA(B, Q.boundingBox.max, Q.boundingBox.min), fA(B, B, 0.5), lA(C, E.boundingBox.max, E.boundingBox.min), fA(C, C, 0.5);
@@ -4706,14 +4732,14 @@ function xQ(g, A) {
4706
4732
  return i - o;
4707
4733
  }), g;
4708
4734
  }
4709
- const WQ = 2;
4710
- class To extends FA {
4735
+ const bQ = 2;
4736
+ class xo extends FA {
4711
4737
  type = "VolumeLayer";
4712
4738
  source_;
4713
4739
  sliceCoords_;
4714
4740
  currentVolumes_ = /* @__PURE__ */ new Map();
4715
4741
  volumeToPoolKey_ = /* @__PURE__ */ new Map();
4716
- pool_ = new fB();
4742
+ pool_ = new mB();
4717
4743
  initialChannelProps_;
4718
4744
  channelChangeCallbacks_ = [];
4719
4745
  sourcePolicy_;
@@ -4776,7 +4802,7 @@ class To extends FA {
4776
4802
  for (const E of I) B.updateVolumeWithChunk(E);
4777
4803
  return B;
4778
4804
  }
4779
- const C = PQ(I[0]), Q = this.pool_.acquire(C) ?? new uQ();
4805
+ const C = OQ(I[0]), Q = this.pool_.acquire(C) ?? new TQ();
4780
4806
  Q.setChannelProps(this.channelProps_ ?? []), this.volumeToPoolKey_.set(Q, C);
4781
4807
  for (const E of I) Q.updateVolumeWithChunk(E);
4782
4808
  return this.updateVolumeTransform(Q, I[0]), Q;
@@ -4794,7 +4820,7 @@ class To extends FA {
4794
4820
  if (!this.chunkStoreView_) return;
4795
4821
  const A = this.chunkStoreView_.getChunksToRender(
4796
4822
  this.sliceCoords_
4797
- ), I = this.sliceCoords_.t ?? -1, B = ZQ(A), C = this.lastLoadedTime_ !== I || B.size !== this.currentVolumes_.size || this.lastNumRenderedChannelChunks_ !== A.length;
4823
+ ), I = this.sliceCoords_.t ?? -1, B = PQ(A), C = this.lastLoadedTime_ !== I || B.size !== this.currentVolumes_.size || this.lastNumRenderedChannelChunks_ !== A.length;
4798
4824
  if (this.lastNumRenderedChannelChunks_ = A.length, !C) return;
4799
4825
  const Q = Array.from(this.currentVolumes_.entries()).filter(([E]) => !B.has(E)).map(([, E]) => E);
4800
4826
  this.releaseAndRemoveVolumes(Q), this.currentVolumes_.clear(), this.clearObjects();
@@ -4837,7 +4863,7 @@ class To extends FA {
4837
4863
  A.viewport
4838
4864
  );
4839
4865
  const I = A.viewport.cameraControls?.isMoving ?? !1;
4840
- this.interactiveStepSizeScale_ = I ? WQ : 1, this.updateChunks(), xQ(this.objects, A.viewport.camera);
4866
+ this.interactiveStepSizeScale_ = I ? bQ : 1, this.updateChunks(), WQ(this.objects, A.viewport.camera);
4841
4867
  }
4842
4868
  getUniforms() {
4843
4869
  return {
@@ -4848,27 +4874,27 @@ class To extends FA {
4848
4874
  };
4849
4875
  }
4850
4876
  }
4851
- function bQ(g) {
4877
+ function ZQ(g) {
4852
4878
  const { x: A, y: I, z: B, t: C } = g.chunkIndex;
4853
4879
  return `${A}:${I}:${B}:${C}`;
4854
4880
  }
4855
- function ZQ(g) {
4881
+ function PQ(g) {
4856
4882
  const A = /* @__PURE__ */ new Map();
4857
4883
  for (const I of g) {
4858
- const B = bQ(I);
4884
+ const B = ZQ(I);
4859
4885
  let C = A.get(B);
4860
4886
  C || (C = [], A.set(B, C)), C.push(I);
4861
4887
  }
4862
4888
  return A;
4863
4889
  }
4864
- function PQ(g) {
4890
+ function OQ(g) {
4865
4891
  return [
4866
4892
  `lod${g.lod}`,
4867
4893
  `shape${g.shape.x}x${g.shape.y}x${g.shape.z}`,
4868
4894
  `align${g.rowAlignmentBytes}`
4869
4895
  ].join(":");
4870
4896
  }
4871
- class xo extends FA {
4897
+ class Wo extends FA {
4872
4898
  type = "ImageLayer";
4873
4899
  source_;
4874
4900
  region_;
@@ -5015,7 +5041,7 @@ class AI extends Fg {
5015
5041
  return C.unpackAlignment = A.rowAlignmentBytes, C;
5016
5042
  }
5017
5043
  }
5018
- const OQ = [
5044
+ const VQ = [
5019
5045
  [1, 0.5, 0.5],
5020
5046
  [0.5, 1, 0.5],
5021
5047
  [0.5, 0.5, 1],
@@ -5023,7 +5049,7 @@ const OQ = [
5023
5049
  [1, 0.5, 1],
5024
5050
  [1, 1, 0.5]
5025
5051
  ];
5026
- function VQ(g) {
5052
+ function vQ(g) {
5027
5053
  return g = g ?? /* @__PURE__ */ new Map(), new Map(
5028
5054
  Array.from(g.entries()).map(([A, I]) => [
5029
5055
  A,
@@ -5031,37 +5057,37 @@ function VQ(g) {
5031
5057
  ])
5032
5058
  );
5033
5059
  }
5034
- function vQ(g) {
5035
- return g = g ?? OQ, g.map(l.from);
5060
+ function XQ(g) {
5061
+ return g = g ?? VQ, g.map(l.from);
5036
5062
  }
5037
- class iB {
5063
+ class oB {
5038
5064
  lookupTable;
5039
5065
  cycle;
5040
5066
  constructor(A = {}) {
5041
- this.lookupTable = VQ(A.lookupTable), this.cycle = vQ(A.cycle);
5067
+ this.lookupTable = vQ(A.lookupTable), this.cycle = XQ(A.cycle);
5042
5068
  }
5043
5069
  }
5044
- const XQ = /* @__PURE__ */ new Set([
5070
+ const jQ = /* @__PURE__ */ new Set([
5045
5071
  "unsigned_byte",
5046
5072
  "unsigned_short",
5047
5073
  "unsigned_int"
5048
5074
  ]);
5049
- function jQ(g) {
5075
+ function zQ(g) {
5050
5076
  if (g.dataFormat !== "scalar")
5051
5077
  throw new Error(
5052
5078
  `Image data format must be scalar, instead found: ${g.dataFormat}`
5053
5079
  );
5054
- if (!XQ.has(g.dataType))
5080
+ if (!jQ.has(g.dataType))
5055
5081
  throw new Error(
5056
5082
  `Image data type must be unsigned, instead found: ${g.dataType}`
5057
5083
  );
5058
5084
  return g;
5059
5085
  }
5060
- class zQ extends ZA {
5086
+ class _Q extends ZA {
5061
5087
  outlineSelected_;
5062
5088
  selectedValue_;
5063
5089
  constructor(A) {
5064
- super(), this.geometry = new lB(A.width, A.height, 1, 1), this.setTexture(0, jQ(A.imageData));
5090
+ super(), this.geometry = new pB(A.width, A.height, 1, 1), this.setTexture(0, zQ(A.imageData));
5065
5091
  const I = this.makeColorCycleTexture(A.colorMap.cycle);
5066
5092
  this.setTexture(1, I);
5067
5093
  const B = this.makeColorLookupTableTexture(
@@ -5099,7 +5125,7 @@ class zQ extends ZA {
5099
5125
  return Q.set(I, 0), Q.set(B, C), new AI(Q, C, 2);
5100
5126
  }
5101
5127
  }
5102
- class Wo extends FA {
5128
+ class bo extends FA {
5103
5129
  type = "LabelImageLayer";
5104
5130
  source_;
5105
5131
  region_;
@@ -5120,7 +5146,7 @@ class Wo extends FA {
5120
5146
  outlineSelected: E = !1,
5121
5147
  ...i
5122
5148
  }) {
5123
- super(i), this.setState("initialized"), this.source_ = A, this.region_ = I, this.colorMap_ = new iB(B), this.onPickValue_ = C, this.lod_ = Q, this.outlineSelected_ = E;
5149
+ super(i), this.setState("initialized"), this.source_ = A, this.region_ = I, this.colorMap_ = new oB(B), this.onPickValue_ = C, this.lod_ = Q, this.outlineSelected_ = E;
5124
5150
  }
5125
5151
  update() {
5126
5152
  switch (this.state) {
@@ -5140,7 +5166,7 @@ class Wo extends FA {
5140
5166
  return this.colorMap_;
5141
5167
  }
5142
5168
  setColorMap(A) {
5143
- this.colorMap_ = new iB(A), this.image_ && this.image_.setColorMap(this.colorMap_);
5169
+ this.colorMap_ = new oB(A), this.image_ && this.image_.setColorMap(this.colorMap_);
5144
5170
  }
5145
5171
  setSelectedValue(A) {
5146
5172
  this.selectedValue_ = A, this.image_ && this.image_.setSelectedValue(this.selectedValue_);
@@ -5164,7 +5190,7 @@ class Wo extends FA {
5164
5190
  }
5165
5191
  createImage(A) {
5166
5192
  this.imageChunk_ = A;
5167
- const I = new zQ({
5193
+ const I = new _Q({
5168
5194
  width: A.shape.x,
5169
5195
  height: A.shape.y,
5170
5196
  imageData: AI.createWithChunk(A),
@@ -5193,7 +5219,7 @@ class TI extends Error {
5193
5219
  super(A), this.name = "AbortError", Object.setPrototypeOf(this, TI.prototype);
5194
5220
  }
5195
5221
  }
5196
- class _Q {
5222
+ class $Q {
5197
5223
  maxConcurrent_;
5198
5224
  pending_ = [];
5199
5225
  abortController_ = new AbortController();
@@ -5237,12 +5263,12 @@ class _Q {
5237
5263
  return this.pending_.length;
5238
5264
  }
5239
5265
  }
5240
- class $Q {
5266
+ class AE {
5241
5267
  source_;
5242
5268
  region_;
5243
5269
  seriesDimensionName_;
5244
5270
  seriesIndex_;
5245
- scheduler_ = new _Q(16);
5271
+ scheduler_ = new $Q(16);
5246
5272
  lod_;
5247
5273
  loader_ = null;
5248
5274
  seriesAttributes_;
@@ -5355,7 +5381,7 @@ class $Q {
5355
5381
  return this.loader_ ??= await this.source_.open(), this.loader_;
5356
5382
  }
5357
5383
  }
5358
- class bo extends FA {
5384
+ class Zo extends FA {
5359
5385
  type = "ImageSeriesLayer";
5360
5386
  seriesLoader_;
5361
5387
  initialChannelProps_;
@@ -5372,7 +5398,7 @@ class bo extends FA {
5372
5398
  lod: Q,
5373
5399
  ...E
5374
5400
  }) {
5375
- super(E), this.setState("initialized"), this.channelProps_ = C, this.initialChannelProps_ = C, this.seriesLoader_ = new $Q({
5401
+ super(E), this.setState("initialized"), this.channelProps_ = C, this.initialChannelProps_ = C, this.seriesLoader_ = new AE({
5376
5402
  source: A,
5377
5403
  region: I,
5378
5404
  seriesDimensionName: B,
@@ -5438,7 +5464,7 @@ class bo extends FA {
5438
5464
  return C.transform.setScale([A.scale.x, A.scale.y, 1]), C.transform.setTranslation([A.offset.x, A.offset.y, 0]), C;
5439
5465
  }
5440
5466
  }
5441
- function mB(g, A, I, B = {}) {
5467
+ function TB(g, A, I, B = {}) {
5442
5468
  return A !== void 0 && I !== void 0 && (B = {
5443
5469
  ...B,
5444
5470
  headers: {
@@ -5447,7 +5473,7 @@ function mB(g, A, I, B = {}) {
5447
5473
  }
5448
5474
  }), fetch(g, B);
5449
5475
  }
5450
- function AE(g, A) {
5476
+ function IE(g, A) {
5451
5477
  return {
5452
5478
  ...g,
5453
5479
  ...A,
@@ -5457,20 +5483,20 @@ function AE(g, A) {
5457
5483
  }
5458
5484
  };
5459
5485
  }
5460
- function oB(g, A) {
5486
+ function aB(g, A) {
5461
5487
  const I = typeof g == "string" ? new URL(g) : g;
5462
5488
  I.pathname.endsWith("/") || (I.pathname += "/");
5463
5489
  const B = new URL(A.slice(1), I);
5464
5490
  return B.search = I.search, B;
5465
5491
  }
5466
- async function aB(g) {
5492
+ async function sB(g) {
5467
5493
  if (g.status !== 404) {
5468
5494
  if (g.status === 200 || g.status === 206)
5469
5495
  return new Uint8Array(await g.arrayBuffer());
5470
5496
  throw new Error(`Unexpected response status ${g.status} ${g.statusText}`);
5471
5497
  }
5472
5498
  }
5473
- async function IE(g, A, I, B) {
5499
+ async function gE(g, A, I, B) {
5474
5500
  if (B)
5475
5501
  return fetch(g, {
5476
5502
  ...I,
@@ -5480,7 +5506,7 @@ async function IE(g, A, I, B) {
5480
5506
  if (!C.ok)
5481
5507
  return C;
5482
5508
  let Q = C.headers.get("Content-Length"), E = Number(Q);
5483
- return mB(g, E - A, E, I);
5509
+ return TB(g, E - A, E, I);
5484
5510
  }
5485
5511
  class PA {
5486
5512
  url;
@@ -5490,18 +5516,18 @@ class PA {
5490
5516
  this.url = A, this.#A = I.overrides ?? {}, this.#I = I.useSuffixRequest ?? !1;
5491
5517
  }
5492
5518
  #g(A) {
5493
- return AE(this.#A, A);
5519
+ return IE(this.#A, A);
5494
5520
  }
5495
5521
  async get(A, I = {}) {
5496
- let B = oB(this.url, A).href, C = await fetch(B, this.#g(I));
5497
- return aB(C);
5522
+ let B = aB(this.url, A).href, C = await fetch(B, this.#g(I));
5523
+ return sB(C);
5498
5524
  }
5499
5525
  async getRange(A, I, B = {}) {
5500
- let C = oB(this.url, A), Q = this.#g(B), E;
5501
- return "suffixLength" in I ? E = await IE(C, I.suffixLength, Q, this.#I) : E = await mB(C, I.offset, I.length, Q), aB(E);
5526
+ let C = aB(this.url, A), Q = this.#g(B), E;
5527
+ return "suffixLength" in I ? E = await gE(C, I.suffixLength, Q, this.#I) : E = await TB(C, I.offset, I.length, Q), sB(E);
5502
5528
  }
5503
5529
  }
5504
- class uB {
5530
+ class xB {
5505
5531
  #A;
5506
5532
  constructor(A, I, B) {
5507
5533
  typeof A == "number" ? this.#A = new Uint8Array(A) : A instanceof ArrayBuffer ? this.#A = new Uint8Array(A, I, B) : this.#A = new Uint8Array(Array.from(A, (C) => C ? 1 : 0));
@@ -5644,14 +5670,14 @@ function GI(g) {
5644
5670
  const A = new TextDecoder().decode(g);
5645
5671
  return JSON.parse(A);
5646
5672
  }
5647
- function sB(g, A) {
5673
+ function DB(g, A) {
5648
5674
  const I = A / 2, B = A - 1;
5649
5675
  let C = 0;
5650
5676
  for (let Q = 0; Q < g.length; Q += A)
5651
5677
  for (let E = 0; E < I; E += 1)
5652
5678
  C = g[Q + E], g[Q + E] = g[Q + B - E], g[Q + B - E] = C;
5653
5679
  }
5654
- function TB(g) {
5680
+ function WB(g) {
5655
5681
  if (g === "v2:object")
5656
5682
  return globalThis.Array;
5657
5683
  let A = g.match(/v2:([US])(\d+)/);
@@ -5671,7 +5697,7 @@ function TB(g) {
5671
5697
  float16: globalThis.Float16Array,
5672
5698
  float32: Float32Array,
5673
5699
  float64: Float64Array,
5674
- bool: uB
5700
+ bool: xB
5675
5701
  }[g];
5676
5702
  return x(I, `Unknown or unsupported data_type: ${g}`), I;
5677
5703
  }
@@ -5683,7 +5709,7 @@ function UA(g, A) {
5683
5709
  C[A[Q]] = B, B *= g[A[Q]];
5684
5710
  return C;
5685
5711
  }
5686
- function gE({ name: g, configuration: A }) {
5712
+ function BE({ name: g, configuration: A }) {
5687
5713
  if (g === "default") {
5688
5714
  const I = A?.separator ?? "/";
5689
5715
  return (B) => ["c", ...B].join(I);
@@ -5694,7 +5720,7 @@ function gE({ name: g, configuration: A }) {
5694
5720
  }
5695
5721
  throw new Error(`Unknown chunk key encoding: ${g}`);
5696
5722
  }
5697
- function BE(g) {
5723
+ function CE(g) {
5698
5724
  if (g === "|O")
5699
5725
  return { data_type: "v2:object" };
5700
5726
  let A = g.match(/^([<|>])(.*)$/);
@@ -5715,8 +5741,8 @@ function BE(g) {
5715
5741
  }[B] ?? (B.startsWith("S") || B.startsWith("U") ? `v2:${B}` : void 0);
5716
5742
  return x(C, `Unsupported or unknown dtype: ${g}`), I === "|" ? { data_type: C } : { data_type: C, endian: I === "<" ? "little" : "big" };
5717
5743
  }
5718
- function CE(g, A = {}) {
5719
- let I = [], B = BE(g.dtype);
5744
+ function QE(g, A = {}) {
5745
+ let I = [], B = CE(g.dtype);
5720
5746
  g.order === "F" && I.push({ name: "transpose", configuration: { order: "F" } }), "endian" in B && B.endian === "big" && I.push({ name: "bytes", configuration: { endian: "big" } });
5721
5747
  for (let { id: C, ...Q } of g.filters ?? [])
5722
5748
  I.push({ name: C, configuration: Q });
@@ -5746,14 +5772,14 @@ function CE(g, A = {}) {
5746
5772
  attributes: A
5747
5773
  };
5748
5774
  }
5749
- function QE(g, A = {}) {
5775
+ function EE(g, A = {}) {
5750
5776
  return {
5751
5777
  zarr_format: 3,
5752
5778
  node_type: "group",
5753
5779
  attributes: A
5754
5780
  };
5755
5781
  }
5756
- function EE(g, A) {
5782
+ function iE(g, A) {
5757
5783
  if (A !== "number" && A !== "bigint" && A !== "boolean" && A !== "object" && A !== "string")
5758
5784
  return g === A;
5759
5785
  let I = g === "bool";
@@ -5768,13 +5794,13 @@ function EE(g, A) {
5768
5794
  let Q = g === "v2:object";
5769
5795
  return A === "object" ? Q : !B && !C && !I && !Q;
5770
5796
  }
5771
- function iE(g) {
5797
+ function oE(g) {
5772
5798
  return g?.name === "sharding_indexed";
5773
5799
  }
5774
- function xB(g) {
5800
+ function bB(g) {
5775
5801
  return (g.data_type === "uint64" || g.data_type === "int64") && g.fill_value != null ? BigInt(g.fill_value) : g.fill_value;
5776
5802
  }
5777
- function WB(g, ...A) {
5803
+ function ZB(g, ...A) {
5778
5804
  if (!A.some((I) => g instanceof I))
5779
5805
  throw g;
5780
5806
  }
@@ -5782,7 +5808,7 @@ function x(g, A = "") {
5782
5808
  if (!g)
5783
5809
  throw new Error(A);
5784
5810
  }
5785
- async function bB(g, { format: A, signal: I }) {
5811
+ async function PB(g, { format: A, signal: I }) {
5786
5812
  const B = g instanceof Response ? g : new Response(g);
5787
5813
  x(B.body, "Response does not contain body.");
5788
5814
  try {
@@ -5815,12 +5841,12 @@ class Ng {
5815
5841
  return A;
5816
5842
  }
5817
5843
  }
5818
- const DB = oE();
5819
- function oE() {
5844
+ const hB = aE();
5845
+ function aE() {
5820
5846
  const g = new Uint32Array([305419896]);
5821
5847
  return new Uint8Array(g.buffer, g.byteOffset, g.byteLength)[0] !== 18;
5822
5848
  }
5823
- function hB(g) {
5849
+ function tB(g) {
5824
5850
  return "BYTES_PER_ELEMENT" in g ? g.BYTES_PER_ELEMENT : 4;
5825
5851
  }
5826
5852
  class xI {
@@ -5831,7 +5857,7 @@ class xI {
5831
5857
  #C;
5832
5858
  #B;
5833
5859
  constructor(A, I) {
5834
- this.#B = A?.endian, this.#I = TB(I.data_type), this.#C = I.shape, this.#A = UA(I.shape, "C");
5860
+ this.#B = A?.endian, this.#I = WB(I.data_type), this.#C = I.shape, this.#A = UA(I.shape, "C");
5835
5861
  const B = new this.#I(0);
5836
5862
  this.#g = B.BYTES_PER_ELEMENT;
5837
5863
  }
@@ -5840,10 +5866,10 @@ class xI {
5840
5866
  }
5841
5867
  encode(A) {
5842
5868
  let I = new Uint8Array(A.data.buffer);
5843
- return DB && this.#B === "big" && sB(I, hB(this.#I)), I;
5869
+ return hB && this.#B === "big" && DB(I, tB(this.#I)), I;
5844
5870
  }
5845
5871
  decode(A) {
5846
- return DB && this.#B === "big" && sB(A, hB(this.#I)), {
5872
+ return hB && this.#B === "big" && DB(A, tB(this.#I)), {
5847
5873
  data: new this.#I(A.buffer, A.byteOffset, A.byteLength / this.#g),
5848
5874
  shape: this.#C,
5849
5875
  stride: this.#A
@@ -5871,14 +5897,14 @@ class Ug {
5871
5897
  throw new Error("Gzip encoding is not enabled by default. Please register a custom codec with `numcodecs/gzip`.");
5872
5898
  }
5873
5899
  async decode(A) {
5874
- const I = await bB(A, { format: "gzip" });
5900
+ const I = await PB(A, { format: "gzip" });
5875
5901
  return new Uint8Array(I);
5876
5902
  }
5877
5903
  }
5878
- function aE(g, A) {
5904
+ function sE(g, A) {
5879
5905
  return x(!Number.isNaN(A), "JsonCodec allow_nan is false but NaN was encountered during encoding."), x(A !== Number.POSITIVE_INFINITY, "JsonCodec allow_nan is false but Infinity was encountered during encoding."), x(A !== Number.NEGATIVE_INFINITY, "JsonCodec allow_nan is false but -Infinity was encountered during encoding."), A;
5880
5906
  }
5881
- function sE(g, A) {
5907
+ function DE(g, A) {
5882
5908
  return A instanceof Object && !Array.isArray(A) ? Object.keys(A).sort().reduce((I, B) => (I[B] = A[B], I), {}) : A;
5883
5909
  }
5884
5910
  class kg {
@@ -5908,7 +5934,7 @@ class kg {
5908
5934
  const { indent: I, encoding: B, ensure_ascii: C, check_circular: Q, allow_nan: E, sort_keys: i } = this.#A;
5909
5935
  x(B === "utf-8", "JsonCodec does not yet support non-utf-8 encoding.");
5910
5936
  const o = [];
5911
- x(Q, "JsonCodec does not yet support skipping the check for circular references during encoding."), E || o.push(aE), i && o.push(sE);
5937
+ x(Q, "JsonCodec does not yet support skipping the check for circular references during encoding."), E || o.push(sE), i && o.push(DE);
5912
5938
  const a = Array.from(A.data);
5913
5939
  a.push("|O"), a.push(A.shape);
5914
5940
  let s;
@@ -5933,8 +5959,8 @@ class kg {
5933
5959
  return { data: B, shape: C, stride: Q };
5934
5960
  }
5935
5961
  }
5936
- function tB(g) {
5937
- return g instanceof uB || g instanceof Rg || g instanceof eI ? new Proxy(g, {
5962
+ function yB(g) {
5963
+ return g instanceof xB || g instanceof Rg || g instanceof eI ? new Proxy(g, {
5938
5964
  get(I, B) {
5939
5965
  return I.get(Number(B));
5940
5966
  },
@@ -5943,7 +5969,7 @@ function tB(g) {
5943
5969
  }
5944
5970
  }) : g;
5945
5971
  }
5946
- function DE(g, A) {
5972
+ function hE(g, A) {
5947
5973
  let I;
5948
5974
  return g.data instanceof Rg || g.data instanceof eI ? I = new g.constructor(
5949
5975
  // @ts-expect-error
@@ -5955,8 +5981,8 @@ function DE(g, A) {
5955
5981
  stride: UA(g.shape, A)
5956
5982
  };
5957
5983
  }
5958
- function hE(g, A) {
5959
- let I = DE(g, A), B = g.shape.length, C = g.data.length, Q = Array(B).fill(0), E = tB(g.data), i = tB(I.data);
5984
+ function tE(g, A) {
5985
+ let I = hE(g, A), B = g.shape.length, C = g.data.length, Q = Array(B).fill(0), E = yB(g.data), i = yB(I.data);
5960
5986
  for (let o = 0; o < C; o++) {
5961
5987
  let a = 0;
5962
5988
  for (let s = 0; s < B; s++)
@@ -5971,12 +5997,12 @@ function hE(g, A) {
5971
5997
  }
5972
5998
  return I;
5973
5999
  }
5974
- function tE(g) {
6000
+ function yE(g) {
5975
6001
  let A = g.shape.length;
5976
6002
  return x(A === g.stride.length, "Shape and stride must have the same length."), g.stride.map((I, B) => ({ stride: I, index: B })).sort((I, B) => B.stride - I.stride).map((I) => I.index);
5977
6003
  }
5978
- function yE(g, A) {
5979
- let I = tE(g);
6004
+ function eE(g, A) {
6005
+ let I = yE(g);
5980
6006
  return x(I.length === A.length, "Orders must match"), I.every((B, C) => B === A[C]);
5981
6007
  }
5982
6008
  class Lg {
@@ -6001,7 +6027,7 @@ class Lg {
6001
6027
  return new Lg(A, I);
6002
6028
  }
6003
6029
  encode(A) {
6004
- return yE(A, this.#I) ? A : hE(A, this.#I);
6030
+ return eE(A, this.#I) ? A : tE(A, this.#I);
6005
6031
  }
6006
6032
  decode(A) {
6007
6033
  return {
@@ -6042,19 +6068,19 @@ class Yg {
6042
6068
  throw new Error("Zlib encoding is not enabled by default. Please register a codec with `numcodecs/zlib`.");
6043
6069
  }
6044
6070
  async decode(A) {
6045
- const I = await bB(A, { format: "deflate" });
6071
+ const I = await PB(A, { format: "deflate" });
6046
6072
  return new Uint8Array(I);
6047
6073
  }
6048
6074
  }
6049
- function eE() {
6075
+ function GE() {
6050
6076
  return (/* @__PURE__ */ new Map()).set("blosc", () => import("./blosc-BOWv2fO7.js").then((g) => g.default)).set("lz4", () => import("./lz4-DUlZKApi.js").then((g) => g.default)).set("zstd", () => import("./zstd-DnzmycJs.js").then((g) => g.default)).set("gzip", () => Ug).set("zlib", () => Yg).set("transpose", () => Lg).set("bytes", () => xI).set("crc32c", () => cg).set("vlen-utf8", () => Jg).set("json2", () => kg).set("bitround", () => Ng);
6051
6077
  }
6052
- const GE = eE();
6078
+ const nE = GE();
6053
6079
  function og(g) {
6054
6080
  let A;
6055
6081
  return {
6056
6082
  async encode(I) {
6057
- A || (A = await yB(g));
6083
+ A || (A = await eB(g));
6058
6084
  for (const C of A.array_to_array)
6059
6085
  I = await C.encode(I);
6060
6086
  let B = await A.array_to_bytes.encode(I);
@@ -6063,7 +6089,7 @@ function og(g) {
6063
6089
  return B;
6064
6090
  },
6065
6091
  async decode(I) {
6066
- A || (A = await yB(g));
6092
+ A || (A = await eB(g));
6067
6093
  for (let C = A.bytes_to_bytes.length - 1; C >= 0; C--)
6068
6094
  I = await A.bytes_to_bytes[C].decode(I);
6069
6095
  let B = await A.array_to_bytes.decode(I);
@@ -6073,9 +6099,9 @@ function og(g) {
6073
6099
  }
6074
6100
  };
6075
6101
  }
6076
- async function yB(g) {
6102
+ async function eB(g) {
6077
6103
  let A = g.codecs.map(async (Q) => {
6078
- let E = await GE.get(Q.name)?.();
6104
+ let E = await nE.get(Q.name)?.();
6079
6105
  return x(E, `Unknown codec: ${Q.name}`), { Codec: E, meta: Q };
6080
6106
  }), I = [], B, C = [];
6081
6107
  for await (let { Codec: Q, meta: E } of A) {
@@ -6091,9 +6117,9 @@ async function yB(g) {
6091
6117
  C.push(i);
6092
6118
  }
6093
6119
  }
6094
- return B || (x(nE(g), `Cannot encode ${g.data_type} to bytes without a codec`), B = xI.fromConfig({ endian: "little" }, g)), { array_to_array: I, array_to_bytes: B, bytes_to_bytes: C };
6120
+ return B || (x(wE(g), `Cannot encode ${g.data_type} to bytes without a codec`), B = xI.fromConfig({ endian: "little" }, g)), { array_to_array: I, array_to_bytes: B, bytes_to_bytes: C };
6095
6121
  }
6096
- function nE(g) {
6122
+ function wE(g) {
6097
6123
  return g.data_type !== "v2:object";
6098
6124
  }
6099
6125
  class nI extends Error {
@@ -6106,8 +6132,8 @@ class dg extends Error {
6106
6132
  super(`Missing key: ${A}`), this.name = "KeyError";
6107
6133
  }
6108
6134
  }
6109
- const eB = 18446744073709551615n;
6110
- function wE(g, A, I, B) {
6135
+ const GB = 18446744073709551615n;
6136
+ function FE(g, A, I, B) {
6111
6137
  x(g.store.getRange, "Store does not support range requests");
6112
6138
  let C = g.store.getRange.bind(g.store), Q = A.map((o, a) => o / B.chunk_shape[a]), E = og({
6113
6139
  data_type: "uint64",
@@ -6127,7 +6153,7 @@ function wE(g, A, I, B) {
6127
6153
  if (h === null)
6128
6154
  return;
6129
6155
  let { data: t, shape: y, stride: n } = h, w = o.map((c, N) => c % y[N]).reduce((c, N, d) => c + N * n[d], 0), r = t[w], G = t[w + 1];
6130
- if (!(r === eB && G === eB))
6156
+ if (!(r === GB && G === GB))
6131
6157
  return C(s, {
6132
6158
  offset: Number(r),
6133
6159
  length: Number(G)
@@ -6155,21 +6181,21 @@ class Mg extends z {
6155
6181
  return this.#A.attributes;
6156
6182
  }
6157
6183
  }
6158
- function GB(g) {
6184
+ function nB(g) {
6159
6185
  return g.find((I) => I.name === "transpose")?.configuration?.order ?? "C";
6160
6186
  }
6161
6187
  const OA = Symbol("zarrita.context");
6162
- function FE(g) {
6188
+ function rE(g) {
6163
6189
  return g[OA];
6164
6190
  }
6165
- function rE(g, A) {
6166
- let { configuration: I } = A.codecs.find(iE) ?? {}, B = {
6167
- encode_chunk_key: gE(A.chunk_key_encoding),
6168
- TypedArray: TB(A.data_type),
6191
+ function SE(g, A) {
6192
+ let { configuration: I } = A.codecs.find(oE) ?? {}, B = {
6193
+ encode_chunk_key: BE(A.chunk_key_encoding),
6194
+ TypedArray: WB(A.data_type),
6169
6195
  fill_value: A.fill_value
6170
6196
  };
6171
6197
  if (I) {
6172
- let Q = GB(I.codecs);
6198
+ let Q = nB(I.codecs);
6173
6199
  return {
6174
6200
  ...B,
6175
6201
  kind: "sharded",
@@ -6182,10 +6208,10 @@ function rE(g, A) {
6182
6208
  get_strides(E) {
6183
6209
  return UA(E, Q);
6184
6210
  },
6185
- get_chunk_bytes: wE(g, A.chunk_grid.configuration.chunk_shape, B.encode_chunk_key, I)
6211
+ get_chunk_bytes: FE(g, A.chunk_grid.configuration.chunk_shape, B.encode_chunk_key, I)
6186
6212
  };
6187
6213
  }
6188
- let C = GB(A.codecs);
6214
+ let C = nB(A.codecs);
6189
6215
  return {
6190
6216
  ...B,
6191
6217
  kind: "regular",
@@ -6211,8 +6237,8 @@ let JI = class extends z {
6211
6237
  constructor(A, I, B) {
6212
6238
  super(A, I), this.#A = {
6213
6239
  ...B,
6214
- fill_value: xB(B)
6215
- }, this[OA] = rE(this, B);
6240
+ fill_value: bB(B)
6241
+ }, this[OA] = SE(this, B);
6216
6242
  }
6217
6243
  get attrs() {
6218
6244
  return this.#A.attributes;
@@ -6256,15 +6282,15 @@ let JI = class extends z {
6256
6282
  * ```
6257
6283
  */
6258
6284
  is(A) {
6259
- return EE(this.dtype, A);
6285
+ return iE(this.dtype, A);
6260
6286
  }
6261
6287
  };
6262
- function* SE(g, A, I = 1) {
6288
+ function* RE(g, A, I = 1) {
6263
6289
  A === void 0 && (A = g, g = 0);
6264
6290
  for (let B = g; B < A; B += I)
6265
6291
  yield B;
6266
6292
  }
6267
- function* RE(...g) {
6293
+ function* NE(...g) {
6268
6294
  if (g.length === 0)
6269
6295
  return;
6270
6296
  const A = g.map((B) => B[Symbol.iterator]()), I = A.map((B) => B.next());
@@ -6279,7 +6305,7 @@ function* RE(...g) {
6279
6305
  I[B] = A[B].next();
6280
6306
  }
6281
6307
  }
6282
- function NE({ start: g, stop: A, step: I }, B) {
6308
+ function cE({ start: g, stop: A, step: I }, B) {
6283
6309
  if (I === 0)
6284
6310
  throw new Error("slice step cannot be zero");
6285
6311
  I = I ?? 1;
@@ -6293,7 +6319,7 @@ function YI(g, A, I = null) {
6293
6319
  step: I
6294
6320
  };
6295
6321
  }
6296
- function cE() {
6322
+ function UE() {
6297
6323
  const g = [];
6298
6324
  return {
6299
6325
  add: (A) => g.push(A()),
@@ -6305,35 +6331,35 @@ class Kg extends Error {
6305
6331
  super(A), this.name = "IndexError";
6306
6332
  }
6307
6333
  }
6308
- function UE(g, A) {
6334
+ function kE(g, A) {
6309
6335
  throw new Kg(`too many indicies for array; expected ${A.length}, got ${g.length}`);
6310
6336
  }
6311
- function kE(g) {
6337
+ function LE(g) {
6312
6338
  throw new Kg(`index out of bounds for dimension with length ${g}`);
6313
6339
  }
6314
- function LE() {
6340
+ function JE() {
6315
6341
  throw new Kg("only slices with step >= 1 are supported");
6316
6342
  }
6317
- function JE(g, A) {
6318
- g.length > A.length && UE(g, A);
6319
- }
6320
6343
  function YE(g, A) {
6321
- return g = Math.trunc(g), g < 0 && (g = A + g), (g >= A || g < 0) && kE(A), g;
6344
+ g.length > A.length && kE(g, A);
6345
+ }
6346
+ function dE(g, A) {
6347
+ return g = Math.trunc(g), g < 0 && (g = A + g), (g >= A || g < 0) && LE(A), g;
6322
6348
  }
6323
- class dE {
6349
+ class ME {
6324
6350
  dim_sel;
6325
6351
  dim_len;
6326
6352
  dim_chunk_len;
6327
6353
  nitems;
6328
6354
  constructor({ dim_sel: A, dim_len: I, dim_chunk_len: B }) {
6329
- A = YE(A, I), this.dim_sel = A, this.dim_len = I, this.dim_chunk_len = B, this.nitems = 1;
6355
+ A = dE(A, I), this.dim_sel = A, this.dim_len = I, this.dim_chunk_len = B, this.nitems = 1;
6330
6356
  }
6331
6357
  *[Symbol.iterator]() {
6332
6358
  const A = Math.floor(this.dim_sel / this.dim_chunk_len), I = A * this.dim_chunk_len, B = this.dim_sel - I;
6333
6359
  yield { dim_chunk_ix: A, dim_chunk_sel: B };
6334
6360
  }
6335
6361
  }
6336
- class nB {
6362
+ class wB {
6337
6363
  start;
6338
6364
  stop;
6339
6365
  step;
@@ -6342,12 +6368,12 @@ class nB {
6342
6368
  nitems;
6343
6369
  nchunks;
6344
6370
  constructor({ dim_sel: A, dim_len: I, dim_chunk_len: B }) {
6345
- const [C, Q, E] = NE(A, I);
6346
- this.start = C, this.stop = Q, this.step = E, this.step < 1 && LE(), this.dim_len = I, this.dim_chunk_len = B, this.nitems = Math.max(0, Math.ceil((this.stop - this.start) / this.step)), this.nchunks = Math.ceil(this.dim_len / this.dim_chunk_len);
6371
+ const [C, Q, E] = cE(A, I);
6372
+ this.start = C, this.stop = Q, this.step = E, this.step < 1 && JE(), this.dim_len = I, this.dim_chunk_len = B, this.nitems = Math.max(0, Math.ceil((this.stop - this.start) / this.step)), this.nchunks = Math.ceil(this.dim_len / this.dim_chunk_len);
6347
6373
  }
6348
6374
  *[Symbol.iterator]() {
6349
6375
  const A = Math.floor(this.start / this.dim_chunk_len), I = Math.ceil(this.stop / this.dim_chunk_len);
6350
- for (const B of SE(A, I)) {
6376
+ for (const B of RE(A, I)) {
6351
6377
  const C = B * this.dim_chunk_len, Q = Math.min(this.dim_len, (B + 1) * this.dim_chunk_len), E = Q - C;
6352
6378
  let i = 0, o = 0;
6353
6379
  if (this.start < C) {
@@ -6368,43 +6394,43 @@ class nB {
6368
6394
  }
6369
6395
  }
6370
6396
  }
6371
- function ME(g, A) {
6397
+ function KE(g, A) {
6372
6398
  let I = [];
6373
- return g === null ? I = A.map((B) => YI(null)) : Array.isArray(g) && (I = g.map((B) => B ?? YI(null))), JE(I, A), I;
6399
+ return g === null ? I = A.map((B) => YI(null)) : Array.isArray(g) && (I = g.map((B) => B ?? YI(null))), YE(I, A), I;
6374
6400
  }
6375
- class KE {
6401
+ class HE {
6376
6402
  dim_indexers;
6377
6403
  shape;
6378
6404
  constructor({ selection: A, shape: I, chunk_shape: B }) {
6379
- this.dim_indexers = ME(A, I).map((C, Q) => new (typeof C == "number" ? dE : nB)({
6405
+ this.dim_indexers = KE(A, I).map((C, Q) => new (typeof C == "number" ? ME : wB)({
6380
6406
  // @ts-expect-error ts inference not strong enough to know correct chunk
6381
6407
  dim_sel: C,
6382
6408
  dim_len: I[Q],
6383
6409
  dim_chunk_len: B[Q]
6384
- })), this.shape = this.dim_indexers.filter((C) => C instanceof nB).map((C) => C.nitems);
6410
+ })), this.shape = this.dim_indexers.filter((C) => C instanceof wB).map((C) => C.nitems);
6385
6411
  }
6386
6412
  *[Symbol.iterator]() {
6387
- for (const A of RE(...this.dim_indexers)) {
6413
+ for (const A of NE(...this.dim_indexers)) {
6388
6414
  const I = A.map((C) => C.dim_chunk_ix), B = A.map((C) => "dim_out_sel" in C ? { from: C.dim_chunk_sel, to: C.dim_out_sel } : { from: C.dim_chunk_sel, to: null });
6389
6415
  yield { chunk_coords: I, mapping: B };
6390
6416
  }
6391
6417
  }
6392
6418
  }
6393
- function HE(g, A) {
6419
+ function qE(g, A) {
6394
6420
  return "get" in g ? g.get(A) : g[A];
6395
6421
  }
6396
- async function qE(g, A, I, B) {
6397
- let C = FE(g), Q = new KE({
6422
+ async function lE(g, A, I, B) {
6423
+ let C = rE(g), Q = new HE({
6398
6424
  selection: A,
6399
6425
  shape: g.shape,
6400
6426
  chunk_shape: g.chunks
6401
- }), E = B.prepare(new C.TypedArray(Q.shape.reduce((o, a) => o * a, 1)), Q.shape, C.get_strides(Q.shape)), i = I.create_queue?.() ?? cE();
6427
+ }), E = B.prepare(new C.TypedArray(Q.shape.reduce((o, a) => o * a, 1)), Q.shape, C.get_strides(Q.shape)), i = I.create_queue?.() ?? UE();
6402
6428
  for (const { chunk_coords: o, mapping: a } of Q)
6403
6429
  i.add(async () => {
6404
6430
  let { data: s, shape: h, stride: t } = await g.getChunk(o, I.opts), y = B.prepare(s, h, t);
6405
6431
  B.set_from_chunk(E, y, a);
6406
6432
  });
6407
- return await i.onIdle(), Q.shape.length === 0 ? HE(E.data, 0) : E;
6433
+ return await i.onIdle(), Q.shape.length === 0 ? qE(E.data, 0) : E;
6408
6434
  }
6409
6435
  function Hg(g, A = 0, I) {
6410
6436
  let B = I ?? g.length - A;
@@ -6434,32 +6460,32 @@ function gg(g) {
6434
6460
  bytes_per_element: g.data.BYTES_PER_ELEMENT
6435
6461
  };
6436
6462
  }
6437
- function lE(g) {
6463
+ function fE(g) {
6438
6464
  return "chars" in g ? g.constructor.bind(null, g.chars) : g.constructor;
6439
6465
  }
6440
- function fE(g, A) {
6466
+ function pE(g, A) {
6441
6467
  if (globalThis.Array.isArray(g.data))
6442
6468
  return Hg([A]);
6443
- let I = lE(g.data), B = new I([A]);
6469
+ let I = fE(g.data), B = new I([A]);
6444
6470
  return new Uint8Array(B.buffer, B.byteOffset, B.byteLength);
6445
6471
  }
6446
- const pE = {
6472
+ const mE = {
6447
6473
  prepare(g, A, I) {
6448
6474
  return { data: g, shape: A, stride: I };
6449
6475
  },
6450
6476
  set_scalar(g, A, I) {
6451
6477
  let B = gg(g);
6452
- ag(B, A, fE(g, I), B.bytes_per_element);
6478
+ ag(B, A, pE(g, I), B.bytes_per_element);
6453
6479
  },
6454
6480
  set_from_chunk(g, A, I) {
6455
6481
  let B = gg(g);
6456
6482
  SI(B, gg(A), B.bytes_per_element, I);
6457
6483
  }
6458
6484
  };
6459
- async function mE(g, A = null, I = {}) {
6460
- return qE(g, A, I, pE);
6485
+ async function uE(g, A = null, I = {}) {
6486
+ return lE(g, A, I, mE);
6461
6487
  }
6462
- function ZB(g, A, I) {
6488
+ function OB(g, A, I) {
6463
6489
  return I < 0 && A < g ? Math.floor((g - A - 1) / -I) + 1 : g < A ? Math.floor((A - g - 1) / I) + 1 : 0;
6464
6490
  }
6465
6491
  function ag(g, A, I, B) {
@@ -6473,7 +6499,7 @@ function ag(g, A, I, B) {
6473
6499
  ag({ data: t, stride: i }, Q, I, B);
6474
6500
  return;
6475
6501
  }
6476
- const [o, a, s] = C, h = ZB(o, a, s);
6502
+ const [o, a, s] = C, h = OB(o, a, s);
6477
6503
  if (Q.length === 0) {
6478
6504
  for (let t = 0; t < h; t++)
6479
6505
  g.data.set(I, E * (o + s * t) * B);
@@ -6509,7 +6535,7 @@ function SI(g, A, I, B) {
6509
6535
  }, I, Q);
6510
6536
  return;
6511
6537
  }
6512
- const [s, h, t] = C.to, [y, n, w] = C.from, r = ZB(s, h, t);
6538
+ const [s, h, t] = C.to, [y, n, w] = C.from, r = OB(s, h, t);
6513
6539
  if (Q.length === 0) {
6514
6540
  if (t === 1 && w === 1 && E === 1 && o === 1) {
6515
6541
  let G = y * I, c = r * I;
@@ -6531,8 +6557,8 @@ function SI(g, A, I, B) {
6531
6557
  stride: a
6532
6558
  }, I, Q);
6533
6559
  }
6534
- let WI = uE();
6535
- function uE() {
6560
+ let WI = TE();
6561
+ function TE() {
6536
6562
  let g = /* @__PURE__ */ new WeakMap();
6537
6563
  function A(I) {
6538
6564
  let B = g.get(I) ?? { v2: 0, v3: 0 };
@@ -6548,41 +6574,41 @@ function uE() {
6548
6574
  }
6549
6575
  };
6550
6576
  }
6551
- async function TE(g) {
6577
+ async function xE(g) {
6552
6578
  let A = await g.store.get(g.resolve(".zattrs").path);
6553
6579
  return A ? GI(A) : {};
6554
6580
  }
6555
- async function xE(g, A = {}) {
6581
+ async function WE(g, A = {}) {
6556
6582
  let I = "store" in g ? g : new z(g), B = {};
6557
- return (A.attrs ?? !0) && (B = await TE(I)), A.kind === "array" ? wB(I, B) : A.kind === "group" ? FB(I, B) : wB(I, B).catch((C) => (WB(C, nI), FB(I, B)));
6583
+ return (A.attrs ?? !0) && (B = await xE(I)), A.kind === "array" ? FB(I, B) : A.kind === "group" ? rB(I, B) : FB(I, B).catch((C) => (ZB(C, nI), rB(I, B)));
6558
6584
  }
6559
- async function wB(g, A) {
6585
+ async function FB(g, A) {
6560
6586
  let { path: I } = g.resolve(".zarray"), B = await g.store.get(I);
6561
6587
  if (!B)
6562
6588
  throw new nI("v2 array", {
6563
6589
  cause: new dg(I)
6564
6590
  });
6565
- return WI.increment(g.store, "v2"), new JI(g.store, g.path, CE(GI(B), A));
6591
+ return WI.increment(g.store, "v2"), new JI(g.store, g.path, QE(GI(B), A));
6566
6592
  }
6567
- async function FB(g, A) {
6593
+ async function rB(g, A) {
6568
6594
  let { path: I } = g.resolve(".zgroup"), B = await g.store.get(I);
6569
6595
  if (!B)
6570
6596
  throw new nI("v2 group", {
6571
6597
  cause: new dg(I)
6572
6598
  });
6573
- return WI.increment(g.store, "v2"), new Mg(g.store, g.path, QE(GI(B), A));
6599
+ return WI.increment(g.store, "v2"), new Mg(g.store, g.path, EE(GI(B), A));
6574
6600
  }
6575
- async function WE(g) {
6601
+ async function bE(g) {
6576
6602
  let { store: A, path: I } = g.resolve("zarr.json"), B = await g.store.get(I);
6577
6603
  if (!B)
6578
6604
  throw new nI("v3 array or group", {
6579
6605
  cause: new dg(I)
6580
6606
  });
6581
6607
  let C = GI(B);
6582
- return C.node_type === "array" && (C.fill_value = xB(C)), C.node_type === "array" ? new JI(A, g.path, C) : new Mg(A, g.path, C);
6608
+ return C.node_type === "array" && (C.fill_value = bB(C)), C.node_type === "array" ? new JI(A, g.path, C) : new Mg(A, g.path, C);
6583
6609
  }
6584
- async function bE(g, A = {}) {
6585
- let I = "store" in g ? g : new z(g), B = await WE(I);
6610
+ async function ZE(g, A = {}) {
6611
+ let I = "store" in g ? g : new z(g), B = await bE(I);
6586
6612
  if (WI.increment(I.store, "v3"), A.kind === void 0 || A.kind === "array" && B instanceof JI || A.kind === "group" && B instanceof Mg)
6587
6613
  return B;
6588
6614
  let C = B instanceof JI ? "array" : "group";
@@ -6590,11 +6616,11 @@ async function bE(g, A = {}) {
6590
6616
  }
6591
6617
  async function IA(g, A = {}) {
6592
6618
  let I = "store" in g ? g.store : g, B = WI.version_max(I), C = B === "v2" ? IA.v2 : IA.v3, Q = B === "v2" ? IA.v3 : IA.v2;
6593
- return C(g, A).catch((E) => (WB(E, nI), Q(g, A)));
6619
+ return C(g, A).catch((E) => (ZB(E, nI), Q(g, A)));
6594
6620
  }
6595
- IA.v2 = xE;
6596
- IA.v3 = bE;
6597
- async function ZE(g, A) {
6621
+ IA.v2 = WE;
6622
+ IA.v3 = ZE;
6623
+ async function PE(g, A) {
6598
6624
  const I = A.split("/"), B = I.pop();
6599
6625
  if (!B)
6600
6626
  throw new Error("Invalid path");
@@ -6611,7 +6637,7 @@ class qg {
6611
6637
  return this.#A;
6612
6638
  }
6613
6639
  async get(A) {
6614
- const I = await ZE(this.#A, A.slice(1)).catch(
6640
+ const I = await PE(this.#A, A.slice(1)).catch(
6615
6641
  () => {
6616
6642
  }
6617
6643
  );
@@ -6621,7 +6647,7 @@ class qg {
6621
6647
  return new Uint8Array(C);
6622
6648
  }
6623
6649
  }
6624
- function PE() {
6650
+ function OE() {
6625
6651
  if (typeof window > "u")
6626
6652
  return;
6627
6653
  const g = window.location.hostname;
@@ -6638,7 +6664,7 @@ class lg extends PA {
6638
6664
  overrides;
6639
6665
  useSuffixRequest;
6640
6666
  constructor(A) {
6641
- PE(), super(A.url, {
6667
+ OE(), super(A.url, {
6642
6668
  overrides: A.overrides,
6643
6669
  useSuffixRequest: A.useSuffixRequest
6644
6670
  }), this.credentials = A.credentials, this.region = A.region, this.overrides = A.overrides, this.useSuffixRequest = A.useSuffixRequest;
@@ -6776,7 +6802,7 @@ async function wI(g, A) {
6776
6802
  throw new Error(`Failed to open Zarr group at ${g}`);
6777
6803
  }
6778
6804
  }
6779
- async function OE(g, A) {
6805
+ async function VE(g, A) {
6780
6806
  if (A === "v2")
6781
6807
  try {
6782
6808
  return IA.v2(g, { kind: "array", attrs: !1 });
@@ -6795,7 +6821,7 @@ async function OE(g, A) {
6795
6821
  throw new Error(`Failed to open Zarr array at ${g}`);
6796
6822
  }
6797
6823
  }
6798
- async function VE(g) {
6824
+ async function vE(g) {
6799
6825
  let A;
6800
6826
  switch (g.type) {
6801
6827
  case "fetch": {
@@ -6821,9 +6847,9 @@ async function VE(g) {
6821
6847
  }
6822
6848
  }
6823
6849
  const I = g.arrayPath ? A.resolve(g.arrayPath) : A;
6824
- return OE(I, g.zarrVersion);
6850
+ return VE(I, g.zarrVersion);
6825
6851
  }
6826
- function vE(g, A, I) {
6852
+ function XE(g, A, I) {
6827
6853
  if (g.store instanceof lg)
6828
6854
  return {
6829
6855
  type: "s3",
@@ -6854,7 +6880,7 @@ function vE(g, A, I) {
6854
6880
  `Unsupported store type: ${g.store.constructor.name}`
6855
6881
  );
6856
6882
  }
6857
- const PB = `function Bg(i, A, g, E = {}) {
6883
+ const VB = `function Bg(i, A, g, E = {}) {
6858
6884
  return A !== void 0 && g !== void 0 && (E = {
6859
6885
  ...E,
6860
6886
  headers: {
@@ -9997,11 +10023,11 @@ return ret;
9997
10023
  default: FB
9998
10024
  });
9999
10025
  //# sourceMappingURL=worker_kernel-uaRPnPAm.js.map
10000
- `, rB = typeof self < "u" && self.Blob && new Blob(["URL.revokeObjectURL(import.meta.url);", PB], { type: "text/javascript;charset=utf-8" });
10001
- function XE(g) {
10026
+ `, SB = typeof self < "u" && self.Blob && new Blob(["URL.revokeObjectURL(import.meta.url);", VB], { type: "text/javascript;charset=utf-8" });
10027
+ function jE(g) {
10002
10028
  let A;
10003
10029
  try {
10004
- if (A = rB && (self.URL || self.webkitURL).createObjectURL(rB), !A) throw "";
10030
+ if (A = SB && (self.URL || self.webkitURL).createObjectURL(SB), !A) throw "";
10005
10031
  const I = new Worker(A, {
10006
10032
  type: "module",
10007
10033
  name: g?.name
@@ -10011,7 +10037,7 @@ function XE(g) {
10011
10037
  }), I;
10012
10038
  } catch {
10013
10039
  return new Worker(
10014
- "data:text/javascript;charset=utf-8," + encodeURIComponent(PB),
10040
+ "data:text/javascript;charset=utf-8," + encodeURIComponent(VB),
10015
10041
  {
10016
10042
  type: "module",
10017
10043
  name: g?.name
@@ -10019,17 +10045,17 @@ function XE(g) {
10019
10045
  );
10020
10046
  }
10021
10047
  }
10022
- const jE = Math.min(navigator.hardwareConcurrency, 8);
10023
- let CA = [], zE = 0, OB = 0;
10048
+ const zE = Math.min(navigator.hardwareConcurrency, 8);
10049
+ let CA = [], _E = 0, vB = 0;
10024
10050
  const kA = /* @__PURE__ */ new Map(), dI = /* @__PURE__ */ new Set();
10025
- function VB(g) {
10051
+ function XB(g) {
10026
10052
  const A = CA.find((I) => I.worker === g);
10027
10053
  return A || U.error(
10028
10054
  "ZarrWorker",
10029
10055
  "Worker not found in pool - this should not happen"
10030
10056
  ), A;
10031
10057
  }
10032
- function _E(g, A) {
10058
+ function $E(g, A) {
10033
10059
  const { id: I, success: B } = g.data, C = kA.get(I);
10034
10060
  if (!C) {
10035
10061
  dI.has(I) ? dI.delete(I) : U.warn(
@@ -10040,13 +10066,13 @@ function _E(g, A) {
10040
10066
  return;
10041
10067
  }
10042
10068
  kA.delete(I), C.abortListener && C.abortSignal && C.abortSignal.removeEventListener("abort", C.abortListener);
10043
- const Q = VB(A);
10069
+ const Q = XB(A);
10044
10070
  Q && Q.pendingCount > 0 ? Q.pendingCount-- : Q && U.error(
10045
10071
  "ZarrWorker",
10046
10072
  "Received message but no pending tasks - this should not happen"
10047
10073
  ), B && g.data.type === "getChunk" ? C.resolve(g.data.chunk) : B || C.reject(new Error(g.data.error || "Unknown worker error"));
10048
10074
  }
10049
- function SB(g, A) {
10075
+ function RB(g, A) {
10050
10076
  if (g instanceof MessageEvent) {
10051
10077
  U.error(
10052
10078
  "ZarrWorker",
@@ -10059,7 +10085,7 @@ function SB(g, A) {
10059
10085
  "Worker failed - replacing worker and canceling its in-flight messages",
10060
10086
  g.message
10061
10087
  );
10062
- const I = VB(A);
10088
+ const I = XB(A);
10063
10089
  if (I) {
10064
10090
  const C = CA.indexOf(I);
10065
10091
  CA.splice(C, 1);
@@ -10069,31 +10095,31 @@ function SB(g, A) {
10069
10095
  for (const [C, Q] of kA.entries())
10070
10096
  Q.workerId === B && (Q.reject(new Error(`Worker error: ${g.message}`)), kA.delete(C));
10071
10097
  try {
10072
- const C = vB();
10098
+ const C = jB();
10073
10099
  CA.push({
10074
10100
  worker: C,
10075
10101
  pendingCount: 0,
10076
- workerId: OB++
10102
+ workerId: vB++
10077
10103
  }), U.debug("ZarrWorker", "Replacement worker created successfully");
10078
10104
  } catch (C) {
10079
10105
  U.error("ZarrWorker", "Failed to create replacement worker", C);
10080
10106
  }
10081
10107
  }
10082
- function vB() {
10083
- const g = new XE();
10084
- return g.addEventListener("message", (A) => _E(A, g)), g.addEventListener("error", (A) => SB(A, g)), g.addEventListener(
10108
+ function jB() {
10109
+ const g = new jE();
10110
+ return g.addEventListener("message", (A) => $E(A, g)), g.addEventListener("error", (A) => RB(A, g)), g.addEventListener(
10085
10111
  "messageerror",
10086
- (A) => SB(A, g)
10112
+ (A) => RB(A, g)
10087
10113
  ), g;
10088
10114
  }
10089
- function $E() {
10115
+ function Ai() {
10090
10116
  if (CA.length === 0)
10091
10117
  throw new Error("Worker pool is not initialized");
10092
10118
  return CA.sort((g, A) => g.pendingCount - A.pendingCount)[0];
10093
10119
  }
10094
- async function Ai(g, A, I) {
10120
+ async function Ii(g, A, I) {
10095
10121
  return new Promise((B, C) => {
10096
- const Q = $E(), E = zE++, i = {
10122
+ const Q = Ai(), E = _E++, i = {
10097
10123
  resolve: B,
10098
10124
  reject: C,
10099
10125
  workerId: Q.workerId
@@ -10119,15 +10145,15 @@ async function Ai(g, A, I) {
10119
10145
  });
10120
10146
  });
10121
10147
  }
10122
- function Ii() {
10148
+ function gi() {
10123
10149
  if (!(CA.length > 0))
10124
10150
  try {
10125
- for (let g = 0; g < jE; g++) {
10126
- const A = vB();
10151
+ for (let g = 0; g < zE; g++) {
10152
+ const A = jB();
10127
10153
  CA.push({
10128
10154
  worker: A,
10129
10155
  pendingCount: 0,
10130
- workerId: OB++
10156
+ workerId: vB++
10131
10157
  });
10132
10158
  }
10133
10159
  U.debug(
@@ -10135,26 +10161,26 @@ function Ii() {
10135
10161
  `Initialized worker pool with ${CA.length} workers`
10136
10162
  );
10137
10163
  } catch {
10138
- U.warn("ZarrWorker", "Failed to create workers - clearing pool"), Bi();
10164
+ U.warn("ZarrWorker", "Failed to create workers - clearing pool"), Ci();
10139
10165
  return;
10140
10166
  }
10141
10167
  }
10142
- async function gi(g, A, I, B) {
10143
- Ii();
10168
+ async function Bi(g, A, I, B) {
10169
+ gi();
10144
10170
  try {
10145
- return await Ai(A, I, B);
10171
+ return await Ii(A, I, B);
10146
10172
  } catch (C) {
10147
10173
  if (C instanceof DOMException && C.name === "AbortError")
10148
10174
  throw C;
10149
10175
  return U.warn("ZarrWorker", "Falling back to main thread", C), await g.getChunk(I, B);
10150
10176
  }
10151
10177
  }
10152
- function Bi() {
10178
+ function Ci() {
10153
10179
  for (const g of CA)
10154
10180
  g.worker.terminate();
10155
10181
  CA = [], kA.clear();
10156
10182
  }
10157
- class Ci {
10183
+ class Qi {
10158
10184
  promises_ = [];
10159
10185
  scheduler_;
10160
10186
  constructor(A) {
@@ -10167,13 +10193,13 @@ class Ci {
10167
10193
  return Promise.all(this.promises_.map((A) => this.scheduler_.submit(A)));
10168
10194
  }
10169
10195
  }
10170
- class Qi {
10196
+ class Ei {
10171
10197
  metadata_;
10172
10198
  arrays_;
10173
10199
  arrayParams_;
10174
10200
  dimensions_;
10175
10201
  constructor(A) {
10176
- this.metadata_ = A.metadata, this.arrays_ = A.arrays, this.arrayParams_ = A.arrayParams, this.dimensions_ = Ei(this.metadata_, this.arrays_);
10202
+ this.metadata_ = A.metadata, this.arrays_ = A.arrays, this.arrayParams_ = A.arrayParams, this.dimensions_ = ii(this.metadata_, this.arrays_);
10177
10203
  }
10178
10204
  getSourceDimensionMap() {
10179
10205
  return this.dimensions_;
@@ -10181,14 +10207,14 @@ class Qi {
10181
10207
  async loadChunkData(A, I) {
10182
10208
  const B = [];
10183
10209
  B[this.dimensions_.x.index] = A.chunkIndex.x, B[this.dimensions_.y.index] = A.chunkIndex.y, this.dimensions_.z && (B[this.dimensions_.z.index] = A.chunkIndex.z), this.dimensions_.c && (B[this.dimensions_.c.index] = A.chunkIndex.c), this.dimensions_.t && (B[this.dimensions_.t.index] = A.chunkIndex.t);
10184
- const C = this.arrays_[A.lod], Q = this.arrayParams_[A.lod], E = await gi(C, Q, B, {
10210
+ const C = this.arrays_[A.lod], Q = this.arrayParams_[A.lod], E = await Bi(C, Q, B, {
10185
10211
  signal: I
10186
10212
  });
10187
10213
  if (!zg(E.data))
10188
10214
  throw new Error(
10189
10215
  `Received chunk has an unsupported data type, data=${E.data.constructor.name}`
10190
10216
  );
10191
- NB(E);
10217
+ cB(E);
10192
10218
  const i = {
10193
10219
  x: E.shape[this.dimensions_.x.index],
10194
10220
  y: E.shape[this.dimensions_.y.index],
@@ -10204,7 +10230,7 @@ class Qi {
10204
10230
  E.stride
10205
10231
  ) : A.data = E.data;
10206
10232
  const s = A.data.BYTES_PER_ELEMENT;
10207
- if (!CB(s))
10233
+ if (!QB(s))
10208
10234
  throw new Error(
10209
10235
  "Invalid row alignment value. Possible values are 1, 2, 4, or 8"
10210
10236
  );
@@ -10231,20 +10257,20 @@ class Qi {
10231
10257
  const C = this.regionToIndices(A, I), Q = this.arrays_[I];
10232
10258
  let E = {};
10233
10259
  B !== void 0 && (E = {
10234
- create_queue: () => new Ci(B),
10260
+ create_queue: () => new Qi(B),
10235
10261
  opts: { signal: B.abortSignal }
10236
10262
  });
10237
- const i = await mE(Q, C, E);
10263
+ const i = await uE(Q, C, E);
10238
10264
  if (!zg(i.data))
10239
10265
  throw new Error(
10240
10266
  `Subarray has an unsupported data type, data=${i.data.constructor.name}`
10241
10267
  );
10242
- if (NB(i), i.shape.length !== 2 && i.shape.length !== 3)
10268
+ if (cB(i), i.shape.length !== 2 && i.shape.length !== 3)
10243
10269
  throw new Error(
10244
10270
  `Expected to receive a 2D or 3D subarray. Instead chunk has shape ${i.shape}`
10245
10271
  );
10246
10272
  const o = i.data.BYTES_PER_ELEMENT;
10247
- if (!CB(o))
10273
+ if (!QB(o))
10248
10274
  throw new Error(
10249
10275
  "Invalid row alignment value. Possible values are 1, 2, 4, or 8"
10250
10276
  );
@@ -10282,7 +10308,7 @@ class Qi {
10282
10308
  this.dimensions_.t
10283
10309
  ].filter((Q) => Q !== void 0).sort((Q, E) => Q.index - E.index), C = [];
10284
10310
  for (const Q of B) {
10285
- const E = A.find((s) => XB(s.dimension, Q.name));
10311
+ const E = A.find((s) => zB(s.dimension, Q.name));
10286
10312
  if (!E)
10287
10313
  throw new Error(`Region does not contain a slice for ${Q.name}`);
10288
10314
  const i = Q.lods[I];
@@ -10296,8 +10322,8 @@ class Qi {
10296
10322
  return C;
10297
10323
  }
10298
10324
  }
10299
- function Ei(g, A) {
10300
- const I = g.axes.map((h) => h.name), B = g.axes.length, C = RB(I, "x"), Q = RB(I, "y"), E = (h, t) => {
10325
+ function ii(g, A) {
10326
+ const I = g.axes.map((h) => h.name), B = g.axes.length, C = NB(I, "x"), Q = NB(I, "y"), E = (h, t) => {
10301
10327
  const y = [];
10302
10328
  for (let n = 0; n < g.datasets.length; n++) {
10303
10329
  const w = g.datasets[n], r = A[n], G = w.coordinateTransformations[0].scale, c = w.coordinateTransformations.length === 2 ? w.coordinateTransformations[1].translation : new Array(B).fill(0);
@@ -10325,10 +10351,10 @@ function Ei(g, A) {
10325
10351
  const s = RI(I, "t");
10326
10352
  return s !== -1 && (i.t = E(I[s], s)), i;
10327
10353
  }
10328
- function XB(g, A) {
10354
+ function zB(g, A) {
10329
10355
  return g.toLowerCase() === A.toLowerCase();
10330
10356
  }
10331
- function RB(g, A) {
10357
+ function NB(g, A) {
10332
10358
  const I = RI(g, A);
10333
10359
  if (I === -1)
10334
10360
  throw new Error(
@@ -10337,9 +10363,9 @@ function RB(g, A) {
10337
10363
  return I;
10338
10364
  }
10339
10365
  function RI(g, A) {
10340
- return g.findIndex((I) => XB(I, A));
10366
+ return g.findIndex((I) => zB(I, A));
10341
10367
  }
10342
- function NB(g) {
10368
+ function cB(g) {
10343
10369
  let A = 1;
10344
10370
  for (let I = g.shape.length - 1; I >= 0; I--) {
10345
10371
  if (g.stride[I] !== A)
@@ -10452,7 +10478,7 @@ const S = H.arrayToEnum([
10452
10478
  "invalid_intersection_types",
10453
10479
  "not_multiple_of",
10454
10480
  "not_finite"
10455
- ]), ii = (g) => JSON.stringify(g, null, 2).replace(/"([^"]+)":/g, "$1:");
10481
+ ]), oi = (g) => JSON.stringify(g, null, 2).replace(/"([^"]+)":/g, "$1:");
10456
10482
  class $ extends Error {
10457
10483
  get errors() {
10458
10484
  return this.issues;
@@ -10569,12 +10595,12 @@ const uA = (g, A) => {
10569
10595
  }
10570
10596
  return { message: I };
10571
10597
  };
10572
- let jB = uA;
10573
- function oi(g) {
10574
- jB = g;
10598
+ let _B = uA;
10599
+ function ai(g) {
10600
+ _B = g;
10575
10601
  }
10576
10602
  function MI() {
10577
- return jB;
10603
+ return _B;
10578
10604
  }
10579
10605
  const KI = (g) => {
10580
10606
  const { data: A, path: I, errorMaps: B, issueData: C } = g, Q = [...I, ...C.path || []], E = {
@@ -10596,7 +10622,7 @@ const KI = (g) => {
10596
10622
  path: Q,
10597
10623
  message: i
10598
10624
  };
10599
- }, ai = [];
10625
+ }, si = [];
10600
10626
  function F(g, A) {
10601
10627
  const I = MI(), B = KI({
10602
10628
  issueData: A,
@@ -10663,7 +10689,7 @@ function HI(g, A, I, B) {
10663
10689
  if (typeof A == "function" ? g !== A || !0 : !A.has(g)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10664
10690
  return A.get(g);
10665
10691
  }
10666
- function zB(g, A, I, B, C) {
10692
+ function $B(g, A, I, B, C) {
10667
10693
  if (typeof A == "function" ? g !== A || !0 : !A.has(g)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
10668
10694
  return A.set(g, I), I;
10669
10695
  }
@@ -10680,7 +10706,7 @@ class sA {
10680
10706
  return this._cachedPath.length || (this._key instanceof Array ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
10681
10707
  }
10682
10708
  }
10683
- const cB = (g, A) => {
10709
+ const UB = (g, A) => {
10684
10710
  if (LA(A))
10685
10711
  return { success: !0, data: A.value };
10686
10712
  if (!g.common.issues.length)
@@ -10767,7 +10793,7 @@ class K {
10767
10793
  data: A,
10768
10794
  parsedType: tA(A)
10769
10795
  }, Q = this._parseSync({ data: A, path: C.path, parent: C });
10770
- return cB(C, Q);
10796
+ return UB(C, Q);
10771
10797
  }
10772
10798
  "~validate"(A) {
10773
10799
  var I, B;
@@ -10821,7 +10847,7 @@ class K {
10821
10847
  data: A,
10822
10848
  parsedType: tA(A)
10823
10849
  }, C = this._parse({ data: A, path: B.path, parent: B }), Q = await (II(C) ? C : Promise.resolve(C));
10824
- return cB(B, Q);
10850
+ return UB(B, Q);
10825
10851
  }
10826
10852
  refine(A, I) {
10827
10853
  const B = (C) => typeof I == "string" || typeof I > "u" ? { message: I } : typeof I == "function" ? I(C) : I;
@@ -10927,26 +10953,26 @@ class K {
10927
10953
  return this.safeParse(null).success;
10928
10954
  }
10929
10955
  }
10930
- const si = /^c[^\s-]{8,}$/i, Di = /^[0-9a-z]+$/, hi = /^[0-9A-HJKMNP-TV-Z]{26}$/i, ti = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, yi = /^[a-z0-9_-]{21}$/i, ei = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, Gi = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, ni = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, wi = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
10956
+ const Di = /^c[^\s-]{8,}$/i, hi = /^[0-9a-z]+$/, ti = /^[0-9A-HJKMNP-TV-Z]{26}$/i, yi = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, ei = /^[a-z0-9_-]{21}$/i, Gi = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, ni = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, wi = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Fi = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
10931
10957
  let Bg;
10932
- const Fi = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, ri = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, Si = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, Ri = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, Ni = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, ci = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, _B = "((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))", Ui = new RegExp(`^${_B}$`);
10933
- function $B(g) {
10958
+ const ri = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, Si = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, Ri = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, Ni = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, ci = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Ui = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, AC = "((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))", ki = new RegExp(`^${AC}$`);
10959
+ function IC(g) {
10934
10960
  let A = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
10935
10961
  return g.precision ? A = `${A}\\.\\d{${g.precision}}` : g.precision == null && (A = `${A}(\\.\\d+)?`), A;
10936
10962
  }
10937
- function ki(g) {
10938
- return new RegExp(`^${$B(g)}$`);
10963
+ function Li(g) {
10964
+ return new RegExp(`^${IC(g)}$`);
10939
10965
  }
10940
- function AC(g) {
10941
- let A = `${_B}T${$B(g)}`;
10966
+ function gC(g) {
10967
+ let A = `${AC}T${IC(g)}`;
10942
10968
  const I = [];
10943
10969
  return I.push(g.local ? "Z?" : "Z"), g.offset && I.push("([+-]\\d{2}:?\\d{2})"), A = `${A}(${I.join("|")})`, new RegExp(`^${A}$`);
10944
10970
  }
10945
- function Li(g, A) {
10946
- return !!((A === "v4" || !A) && Fi.test(g) || (A === "v6" || !A) && Si.test(g));
10947
- }
10948
10971
  function Ji(g, A) {
10949
- if (!ei.test(g))
10972
+ return !!((A === "v4" || !A) && ri.test(g) || (A === "v6" || !A) && Ri.test(g));
10973
+ }
10974
+ function Yi(g, A) {
10975
+ if (!Gi.test(g))
10950
10976
  return !1;
10951
10977
  try {
10952
10978
  const [I] = g.split("."), B = I.replace(/-/g, "+").replace(/_/g, "/").padEnd(I.length + (4 - I.length % 4) % 4, "="), C = JSON.parse(atob(B));
@@ -10955,8 +10981,8 @@ function Ji(g, A) {
10955
10981
  return !1;
10956
10982
  }
10957
10983
  }
10958
- function Yi(g, A) {
10959
- return !!((A === "v4" || !A) && ri.test(g) || (A === "v6" || !A) && Ri.test(g));
10984
+ function di(g, A) {
10985
+ return !!((A === "v4" || !A) && Si.test(g) || (A === "v6" || !A) && Ni.test(g));
10960
10986
  }
10961
10987
  class gA extends K {
10962
10988
  _parse(A) {
@@ -11007,43 +11033,43 @@ class gA extends K {
11007
11033
  message: Q.message
11008
11034
  }), B.dirty());
11009
11035
  } else if (Q.kind === "email")
11010
- ni.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11036
+ wi.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11011
11037
  validation: "email",
11012
11038
  code: e.invalid_string,
11013
11039
  message: Q.message
11014
11040
  }), B.dirty());
11015
11041
  else if (Q.kind === "emoji")
11016
- Bg || (Bg = new RegExp(wi, "u")), Bg.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11042
+ Bg || (Bg = new RegExp(Fi, "u")), Bg.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11017
11043
  validation: "emoji",
11018
11044
  code: e.invalid_string,
11019
11045
  message: Q.message
11020
11046
  }), B.dirty());
11021
11047
  else if (Q.kind === "uuid")
11022
- ti.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11048
+ yi.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11023
11049
  validation: "uuid",
11024
11050
  code: e.invalid_string,
11025
11051
  message: Q.message
11026
11052
  }), B.dirty());
11027
11053
  else if (Q.kind === "nanoid")
11028
- yi.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11054
+ ei.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11029
11055
  validation: "nanoid",
11030
11056
  code: e.invalid_string,
11031
11057
  message: Q.message
11032
11058
  }), B.dirty());
11033
11059
  else if (Q.kind === "cuid")
11034
- si.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11060
+ Di.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11035
11061
  validation: "cuid",
11036
11062
  code: e.invalid_string,
11037
11063
  message: Q.message
11038
11064
  }), B.dirty());
11039
11065
  else if (Q.kind === "cuid2")
11040
- Di.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11066
+ hi.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11041
11067
  validation: "cuid2",
11042
11068
  code: e.invalid_string,
11043
11069
  message: Q.message
11044
11070
  }), B.dirty());
11045
11071
  else if (Q.kind === "ulid")
11046
- hi.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11072
+ ti.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11047
11073
  validation: "ulid",
11048
11074
  code: e.invalid_string,
11049
11075
  message: Q.message
@@ -11074,39 +11100,39 @@ class gA extends K {
11074
11100
  code: e.invalid_string,
11075
11101
  validation: { endsWith: Q.value },
11076
11102
  message: Q.message
11077
- }), B.dirty()) : Q.kind === "datetime" ? AC(Q).test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11103
+ }), B.dirty()) : Q.kind === "datetime" ? gC(Q).test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11078
11104
  code: e.invalid_string,
11079
11105
  validation: "datetime",
11080
11106
  message: Q.message
11081
- }), B.dirty()) : Q.kind === "date" ? Ui.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11107
+ }), B.dirty()) : Q.kind === "date" ? ki.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11082
11108
  code: e.invalid_string,
11083
11109
  validation: "date",
11084
11110
  message: Q.message
11085
- }), B.dirty()) : Q.kind === "time" ? ki(Q).test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11111
+ }), B.dirty()) : Q.kind === "time" ? Li(Q).test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11086
11112
  code: e.invalid_string,
11087
11113
  validation: "time",
11088
11114
  message: Q.message
11089
- }), B.dirty()) : Q.kind === "duration" ? Gi.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11115
+ }), B.dirty()) : Q.kind === "duration" ? ni.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11090
11116
  validation: "duration",
11091
11117
  code: e.invalid_string,
11092
11118
  message: Q.message
11093
- }), B.dirty()) : Q.kind === "ip" ? Li(A.data, Q.version) || (C = this._getOrReturnCtx(A, C), F(C, {
11119
+ }), B.dirty()) : Q.kind === "ip" ? Ji(A.data, Q.version) || (C = this._getOrReturnCtx(A, C), F(C, {
11094
11120
  validation: "ip",
11095
11121
  code: e.invalid_string,
11096
11122
  message: Q.message
11097
- }), B.dirty()) : Q.kind === "jwt" ? Ji(A.data, Q.alg) || (C = this._getOrReturnCtx(A, C), F(C, {
11123
+ }), B.dirty()) : Q.kind === "jwt" ? Yi(A.data, Q.alg) || (C = this._getOrReturnCtx(A, C), F(C, {
11098
11124
  validation: "jwt",
11099
11125
  code: e.invalid_string,
11100
11126
  message: Q.message
11101
- }), B.dirty()) : Q.kind === "cidr" ? Yi(A.data, Q.version) || (C = this._getOrReturnCtx(A, C), F(C, {
11127
+ }), B.dirty()) : Q.kind === "cidr" ? di(A.data, Q.version) || (C = this._getOrReturnCtx(A, C), F(C, {
11102
11128
  validation: "cidr",
11103
11129
  code: e.invalid_string,
11104
11130
  message: Q.message
11105
- }), B.dirty()) : Q.kind === "base64" ? Ni.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11131
+ }), B.dirty()) : Q.kind === "base64" ? ci.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11106
11132
  validation: "base64",
11107
11133
  code: e.invalid_string,
11108
11134
  message: Q.message
11109
- }), B.dirty()) : Q.kind === "base64url" ? ci.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11135
+ }), B.dirty()) : Q.kind === "base64url" ? Ui.test(A.data) || (C = this._getOrReturnCtx(A, C), F(C, {
11110
11136
  validation: "base64url",
11111
11137
  code: e.invalid_string,
11112
11138
  message: Q.message
@@ -11345,7 +11371,7 @@ gA.create = (g) => {
11345
11371
  ...M(g)
11346
11372
  });
11347
11373
  };
11348
- function di(g, A) {
11374
+ function Mi(g, A) {
11349
11375
  const I = (g.toString().split(".")[1] || "").length, B = (A.toString().split(".")[1] || "").length, C = I > B ? I : B, Q = parseInt(g.toFixed(C).replace(".", "")), E = parseInt(A.toFixed(C).replace(".", ""));
11350
11376
  return Q % E / Math.pow(10, C);
11351
11377
  }
@@ -11384,7 +11410,7 @@ class eA extends K {
11384
11410
  inclusive: Q.inclusive,
11385
11411
  exact: !1,
11386
11412
  message: Q.message
11387
- }), C.dirty()) : Q.kind === "multipleOf" ? di(A.data, Q.value) !== 0 && (B = this._getOrReturnCtx(A, B), F(B, {
11413
+ }), C.dirty()) : Q.kind === "multipleOf" ? Mi(A.data, Q.value) !== 0 && (B = this._getOrReturnCtx(A, B), F(B, {
11388
11414
  code: e.not_multiple_of,
11389
11415
  multipleOf: Q.value,
11390
11416
  message: Q.message
@@ -12211,7 +12237,7 @@ class m extends K {
12211
12237
  });
12212
12238
  }
12213
12239
  keyof() {
12214
- return IC(H.objectKeys(this.shape));
12240
+ return BC(H.objectKeys(this.shape));
12215
12241
  }
12216
12242
  }
12217
12243
  m.create = (g, A) => new m({
@@ -12774,7 +12800,7 @@ aI.create = (g, A) => new aI({
12774
12800
  typeName: J.ZodLiteral,
12775
12801
  ...M(A)
12776
12802
  });
12777
- function IC(g, A) {
12803
+ function BC(g, A) {
12778
12804
  return new nA({
12779
12805
  values: g,
12780
12806
  typeName: J.ZodEnum,
@@ -12794,7 +12820,7 @@ class nA extends K {
12794
12820
  code: e.invalid_type
12795
12821
  }), Y;
12796
12822
  }
12797
- if (HI(this, VA) || zB(this, VA, new Set(this._def.values)), !HI(this, VA).has(A.data)) {
12823
+ if (HI(this, VA) || $B(this, VA, new Set(this._def.values)), !HI(this, VA).has(A.data)) {
12798
12824
  const I = this._getOrReturnCtx(A), B = this._def.values;
12799
12825
  return F(I, {
12800
12826
  received: I.data,
@@ -12839,7 +12865,7 @@ class nA extends K {
12839
12865
  }
12840
12866
  }
12841
12867
  VA = /* @__PURE__ */ new WeakMap();
12842
- nA.create = IC;
12868
+ nA.create = BC;
12843
12869
  class sI extends K {
12844
12870
  constructor() {
12845
12871
  super(...arguments), vA.set(this, void 0);
@@ -12854,7 +12880,7 @@ class sI extends K {
12854
12880
  code: e.invalid_type
12855
12881
  }), Y;
12856
12882
  }
12857
- if (HI(this, vA) || zB(this, vA, new Set(H.getValidEnumValues(this._def.values))), !HI(this, vA).has(A.data)) {
12883
+ if (HI(this, vA) || $B(this, vA, new Set(H.getValidEnumValues(this._def.values))), !HI(this, vA).has(A.data)) {
12858
12884
  const C = H.objectValues(I);
12859
12885
  return F(B, {
12860
12886
  received: B.data,
@@ -13093,7 +13119,7 @@ pI.create = (g) => new pI({
13093
13119
  typeName: J.ZodNaN,
13094
13120
  ...M(g)
13095
13121
  });
13096
- const Mi = Symbol("zod_brand");
13122
+ const Ki = Symbol("zod_brand");
13097
13123
  class fg extends K {
13098
13124
  _parse(A) {
13099
13125
  const { ctx: I } = this._processInputParams(A), B = I.data;
@@ -13161,11 +13187,11 @@ tI.create = (g, A) => new tI({
13161
13187
  typeName: J.ZodReadonly,
13162
13188
  ...M(A)
13163
13189
  });
13164
- function UB(g, A) {
13190
+ function kB(g, A) {
13165
13191
  const I = typeof g == "function" ? g(A) : typeof g == "string" ? { message: g } : g;
13166
13192
  return typeof I == "string" ? { message: I } : I;
13167
13193
  }
13168
- function gC(g, A = {}, I) {
13194
+ function CC(g, A = {}, I) {
13169
13195
  return g ? TA.create().superRefine((B, C) => {
13170
13196
  var Q, E;
13171
13197
  const i = g(B);
@@ -13173,26 +13199,26 @@ function gC(g, A = {}, I) {
13173
13199
  return i.then((o) => {
13174
13200
  var a, s;
13175
13201
  if (!o) {
13176
- const h = UB(A, B), t = (s = (a = h.fatal) !== null && a !== void 0 ? a : I) !== null && s !== void 0 ? s : !0;
13202
+ const h = kB(A, B), t = (s = (a = h.fatal) !== null && a !== void 0 ? a : I) !== null && s !== void 0 ? s : !0;
13177
13203
  C.addIssue({ code: "custom", ...h, fatal: t });
13178
13204
  }
13179
13205
  });
13180
13206
  if (!i) {
13181
- const o = UB(A, B), a = (E = (Q = o.fatal) !== null && Q !== void 0 ? Q : I) !== null && E !== void 0 ? E : !0;
13207
+ const o = kB(A, B), a = (E = (Q = o.fatal) !== null && Q !== void 0 ? Q : I) !== null && E !== void 0 ? E : !0;
13182
13208
  C.addIssue({ code: "custom", ...o, fatal: a });
13183
13209
  }
13184
13210
  }) : TA.create();
13185
13211
  }
13186
- const Ki = {
13212
+ const Hi = {
13187
13213
  object: m.lazycreate
13188
13214
  };
13189
13215
  var J;
13190
13216
  (function(g) {
13191
13217
  g.ZodString = "ZodString", g.ZodNumber = "ZodNumber", g.ZodNaN = "ZodNaN", g.ZodBigInt = "ZodBigInt", g.ZodBoolean = "ZodBoolean", g.ZodDate = "ZodDate", g.ZodSymbol = "ZodSymbol", g.ZodUndefined = "ZodUndefined", g.ZodNull = "ZodNull", g.ZodAny = "ZodAny", g.ZodUnknown = "ZodUnknown", g.ZodNever = "ZodNever", g.ZodVoid = "ZodVoid", g.ZodArray = "ZodArray", g.ZodObject = "ZodObject", g.ZodUnion = "ZodUnion", g.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", g.ZodIntersection = "ZodIntersection", g.ZodTuple = "ZodTuple", g.ZodRecord = "ZodRecord", g.ZodMap = "ZodMap", g.ZodSet = "ZodSet", g.ZodFunction = "ZodFunction", g.ZodLazy = "ZodLazy", g.ZodLiteral = "ZodLiteral", g.ZodEnum = "ZodEnum", g.ZodEffects = "ZodEffects", g.ZodNativeEnum = "ZodNativeEnum", g.ZodOptional = "ZodOptional", g.ZodNullable = "ZodNullable", g.ZodDefault = "ZodDefault", g.ZodCatch = "ZodCatch", g.ZodPromise = "ZodPromise", g.ZodBranded = "ZodBranded", g.ZodPipeline = "ZodPipeline", g.ZodReadonly = "ZodReadonly";
13192
13218
  })(J || (J = {}));
13193
- const Hi = (g, A = {
13219
+ const qi = (g, A = {
13194
13220
  message: `Input not instance of ${g.name}`
13195
- }) => gC((I) => I instanceof g, A), BC = gA.create, CC = eA.create, qi = pI.create, li = GA.create, QC = gI.create, fi = JA.create, pi = qI.create, mi = BI.create, ui = CI.create, Ti = TA.create, xi = NA.create, Wi = yA.create, bi = lI.create, Zi = QA.create, Pi = m.create, Oi = m.strictCreate, Vi = QI.create, vi = bI.create, Xi = EI.create, ji = DA.create, zi = iI.create, _i = fI.create, $i = YA.create, Ao = qA.create, Io = oI.create, go = aI.create, Bo = nA.create, Co = sI.create, Qo = xA.create, kB = EA.create, Eo = aA.create, io = wA.create, oo = EA.createWithPreprocess, ao = FI.create, so = () => BC().optional(), Do = () => CC().optional(), ho = () => QC().optional(), to = {
13221
+ }) => CC((I) => I instanceof g, A), QC = gA.create, EC = eA.create, li = pI.create, fi = GA.create, iC = gI.create, pi = JA.create, mi = qI.create, ui = BI.create, Ti = CI.create, xi = TA.create, Wi = NA.create, bi = yA.create, Zi = lI.create, Pi = QA.create, Oi = m.create, Vi = m.strictCreate, vi = QI.create, Xi = bI.create, ji = EI.create, zi = DA.create, _i = iI.create, $i = fI.create, Ao = YA.create, Io = qA.create, go = oI.create, Bo = aI.create, Co = nA.create, Qo = sI.create, Eo = xA.create, LB = EA.create, io = aA.create, oo = wA.create, ao = EA.createWithPreprocess, so = FI.create, Do = () => QC().optional(), ho = () => EC().optional(), to = () => iC().optional(), yo = {
13196
13222
  string: (g) => gA.create({ ...g, coerce: !0 }),
13197
13223
  number: (g) => eA.create({ ...g, coerce: !0 }),
13198
13224
  boolean: (g) => gI.create({
@@ -13201,14 +13227,14 @@ const Hi = (g, A = {
13201
13227
  }),
13202
13228
  bigint: (g) => GA.create({ ...g, coerce: !0 }),
13203
13229
  date: (g) => JA.create({ ...g, coerce: !0 })
13204
- }, yo = Y;
13230
+ }, eo = Y;
13205
13231
  var D = /* @__PURE__ */ Object.freeze({
13206
13232
  __proto__: null,
13207
13233
  defaultErrorMap: uA,
13208
- setErrorMap: oi,
13234
+ setErrorMap: ai,
13209
13235
  getErrorMap: MI,
13210
13236
  makeIssue: KI,
13211
- EMPTY_PATH: ai,
13237
+ EMPTY_PATH: si,
13212
13238
  addIssueToContext: F,
13213
13239
  ParseStatus: X,
13214
13240
  INVALID: Y,
@@ -13227,7 +13253,7 @@ var D = /* @__PURE__ */ Object.freeze({
13227
13253
  ZodParsedType: S,
13228
13254
  getParsedType: tA,
13229
13255
  ZodType: K,
13230
- datetimeRegex: AC,
13256
+ datetimeRegex: gC,
13231
13257
  ZodString: gA,
13232
13258
  ZodNumber: eA,
13233
13259
  ZodBigInt: GA,
@@ -13262,63 +13288,63 @@ var D = /* @__PURE__ */ Object.freeze({
13262
13288
  ZodDefault: DI,
13263
13289
  ZodCatch: hI,
13264
13290
  ZodNaN: pI,
13265
- BRAND: Mi,
13291
+ BRAND: Ki,
13266
13292
  ZodBranded: fg,
13267
13293
  ZodPipeline: FI,
13268
13294
  ZodReadonly: tI,
13269
- custom: gC,
13295
+ custom: CC,
13270
13296
  Schema: K,
13271
13297
  ZodSchema: K,
13272
- late: Ki,
13298
+ late: Hi,
13273
13299
  get ZodFirstPartyTypeKind() {
13274
13300
  return J;
13275
13301
  },
13276
- coerce: to,
13277
- any: Ti,
13278
- array: Zi,
13279
- bigint: li,
13280
- boolean: QC,
13281
- date: fi,
13282
- discriminatedUnion: vi,
13283
- effect: kB,
13284
- enum: Bo,
13285
- function: Ao,
13286
- instanceof: Hi,
13287
- intersection: Xi,
13288
- lazy: Io,
13289
- literal: go,
13290
- map: _i,
13291
- nan: qi,
13292
- nativeEnum: Co,
13293
- never: Wi,
13294
- null: ui,
13295
- nullable: io,
13296
- number: CC,
13297
- object: Pi,
13298
- oboolean: ho,
13299
- onumber: Do,
13300
- optional: Eo,
13301
- ostring: so,
13302
- pipeline: ao,
13303
- preprocess: oo,
13304
- promise: Qo,
13305
- record: zi,
13306
- set: $i,
13307
- strictObject: Oi,
13308
- string: BC,
13309
- symbol: pi,
13310
- transformer: kB,
13311
- tuple: ji,
13312
- undefined: mi,
13313
- union: Vi,
13314
- unknown: xi,
13315
- void: bi,
13316
- NEVER: yo,
13302
+ coerce: yo,
13303
+ any: xi,
13304
+ array: Pi,
13305
+ bigint: fi,
13306
+ boolean: iC,
13307
+ date: pi,
13308
+ discriminatedUnion: Xi,
13309
+ effect: LB,
13310
+ enum: Co,
13311
+ function: Io,
13312
+ instanceof: qi,
13313
+ intersection: ji,
13314
+ lazy: go,
13315
+ literal: Bo,
13316
+ map: $i,
13317
+ nan: li,
13318
+ nativeEnum: Qo,
13319
+ never: bi,
13320
+ null: Ti,
13321
+ nullable: oo,
13322
+ number: EC,
13323
+ object: Oi,
13324
+ oboolean: to,
13325
+ onumber: ho,
13326
+ optional: io,
13327
+ ostring: Do,
13328
+ pipeline: so,
13329
+ preprocess: ao,
13330
+ promise: Eo,
13331
+ record: _i,
13332
+ set: Ao,
13333
+ strictObject: Vi,
13334
+ string: QC,
13335
+ symbol: mi,
13336
+ transformer: LB,
13337
+ tuple: zi,
13338
+ undefined: ui,
13339
+ union: vi,
13340
+ unknown: Wi,
13341
+ void: Zi,
13342
+ NEVER: eo,
13317
13343
  ZodIssueCode: e,
13318
- quotelessJson: ii,
13344
+ quotelessJson: oi,
13319
13345
  ZodError: $
13320
13346
  });
13321
- const eo = D.object({
13347
+ const Go = D.object({
13322
13348
  /**The multiscale datasets for this image*/
13323
13349
  multiscales: D.array(
13324
13350
  D.object({
@@ -13446,7 +13472,7 @@ const eo = D.object({
13446
13472
  projection: D.string().optional()
13447
13473
  }).optional()
13448
13474
  }).optional()
13449
- }).describe("JSON from OME-NGFF .zattrs"), Go = D.object({
13475
+ }).describe("JSON from OME-NGFF .zattrs"), no = D.object({
13450
13476
  plate: D.object({
13451
13477
  /**The acquisitions for this plate*/
13452
13478
  acquisitions: D.array(
@@ -13505,7 +13531,7 @@ const eo = D.object({
13505
13531
  })
13506
13532
  ).min(1).describe("The wells of the plate")
13507
13533
  }).optional()
13508
- }).describe("JSON from OME-NGFF .zattrs"), no = D.object({
13534
+ }).describe("JSON from OME-NGFF .zattrs"), wo = D.object({
13509
13535
  well: D.object({
13510
13536
  /**The fields of view for this well*/
13511
13537
  images: D.array(
@@ -13519,7 +13545,7 @@ const eo = D.object({
13519
13545
  /**The version of the specification*/
13520
13546
  version: D.literal("0.4").describe("The version of the specification").optional()
13521
13547
  }).optional()
13522
- }).describe("JSON from OME-NGFF .zattrs"), wo = D.object({
13548
+ }).describe("JSON from OME-NGFF .zattrs"), Fo = D.object({
13523
13549
  /**The versioned OME-Zarr Metadata namespace*/
13524
13550
  ome: D.object({
13525
13551
  /**The multiscale datasets for this image*/
@@ -13649,7 +13675,7 @@ const eo = D.object({
13649
13675
  /**The version of the OME-Zarr Metadata*/
13650
13676
  version: D.literal("0.5").describe("The version of the OME-Zarr Metadata")
13651
13677
  }).describe("The versioned OME-Zarr Metadata namespace")
13652
- }).describe("The zarr.json attributes key"), Fo = D.object({
13678
+ }).describe("The zarr.json attributes key"), ro = D.object({
13653
13679
  /**The versioned OME-Zarr Metadata namespace*/
13654
13680
  ome: D.object({
13655
13681
  plate: D.object({
@@ -13711,7 +13737,7 @@ const eo = D.object({
13711
13737
  /**The version of the OME-Zarr Metadata*/
13712
13738
  version: D.literal("0.5").describe("The version of the OME-Zarr Metadata")
13713
13739
  }).describe("The versioned OME-Zarr Metadata namespace")
13714
- }).describe("The zarr.json attributes key"), ro = D.object({
13740
+ }).describe("The zarr.json attributes key"), So = D.object({
13715
13741
  /**The versioned OME-Zarr Metadata namespace*/
13716
13742
  ome: D.object({
13717
13743
  well: D.object({
@@ -13730,15 +13756,15 @@ const eo = D.object({
13730
13756
  /**The version of the OME-Zarr Metadata*/
13731
13757
  version: D.literal("0.5").describe("The version of the OME-Zarr Metadata")
13732
13758
  }).describe("The versioned OME-Zarr Metadata namespace")
13733
- }).describe("JSON from OME-Zarr zarr.json"), So = ["0.4", "0.5"], Ro = new Set(So);
13734
- function No(g) {
13759
+ }).describe("JSON from OME-Zarr zarr.json"), Ro = ["0.4", "0.5"], No = new Set(Ro);
13760
+ function co(g) {
13735
13761
  if (!("ome" in g) || !(g.ome instanceof Object)) return;
13736
13762
  const A = g.ome;
13737
- if ("version" in A && typeof A.version == "string" && Ro.has(A.version))
13763
+ if ("version" in A && typeof A.version == "string" && No.has(A.version))
13738
13764
  return A.version;
13739
13765
  }
13740
13766
  function pg(g) {
13741
- const A = No(g);
13767
+ const A = co(g);
13742
13768
  return A === void 0 ? "0.4" : A;
13743
13769
  }
13744
13770
  function WA(g) {
@@ -13750,14 +13776,14 @@ function WA(g) {
13750
13776
  return "v3";
13751
13777
  }
13752
13778
  }
13753
- function EC(g, A) {
13779
+ function oC(g, A) {
13754
13780
  const I = { ...g };
13755
13781
  return delete I[A], I;
13756
13782
  }
13757
- async function Po(g, A) {
13783
+ async function Oo(g, A) {
13758
13784
  const I = new PA(g), B = new z(I), C = WA(A), Q = await wI(B, C);
13759
13785
  try {
13760
- return co(Q.attrs);
13786
+ return Uo(Q.attrs);
13761
13787
  } catch {
13762
13788
  throw Error(
13763
13789
  `Failed to parse OME-Zarr plate:
@@ -13765,58 +13791,58 @@ ${JSON.stringify(Q.attrs)}`
13765
13791
  );
13766
13792
  }
13767
13793
  }
13768
- function co(g) {
13794
+ function Uo(g) {
13769
13795
  switch (pg(g)) {
13770
13796
  case "0.5":
13771
13797
  return {
13772
- ...Fo.parse(g).ome,
13798
+ ...ro.parse(g).ome,
13773
13799
  originalVersion: "0.5"
13774
13800
  };
13775
13801
  case "0.4":
13776
13802
  return {
13777
- ...Uo(Go.parse(g)).ome,
13803
+ ...ko(no.parse(g)).ome,
13778
13804
  originalVersion: "0.4"
13779
13805
  };
13780
13806
  }
13781
13807
  }
13782
- function Uo(g) {
13808
+ function ko(g) {
13783
13809
  if (g.plate === void 0)
13784
13810
  throw new Error("Plate metadata is missing in OME-Zarr v0.4 plate");
13785
13811
  return {
13786
13812
  ome: {
13787
- plate: EC(g.plate, "version"),
13813
+ plate: oC(g.plate, "version"),
13788
13814
  version: "0.5"
13789
13815
  }
13790
13816
  };
13791
13817
  }
13792
- function ko(g) {
13818
+ function Lo(g) {
13793
13819
  if (g.well === void 0)
13794
13820
  throw new Error("Well metadata is missing in OME-Zarr v0.4 well");
13795
13821
  return {
13796
13822
  ome: {
13797
- well: EC(g.well, "version"),
13823
+ well: oC(g.well, "version"),
13798
13824
  version: "0.5"
13799
13825
  }
13800
13826
  };
13801
13827
  }
13802
- function Lo(g) {
13828
+ function Jo(g) {
13803
13829
  switch (pg(g)) {
13804
13830
  case "0.5":
13805
13831
  return {
13806
- ...ro.parse(g).ome,
13832
+ ...So.parse(g).ome,
13807
13833
  originalVersion: "0.5"
13808
13834
  };
13809
13835
  case "0.4":
13810
13836
  return {
13811
- ...ko(no.parse(g)).ome,
13837
+ ...Lo(wo.parse(g)).ome,
13812
13838
  originalVersion: "0.4"
13813
13839
  };
13814
13840
  }
13815
13841
  }
13816
- async function Oo(g, A, I) {
13842
+ async function Vo(g, A, I) {
13817
13843
  const B = g + "/" + A, C = new PA(B), Q = new z(C), E = WA(I), i = await wI(Q, E);
13818
13844
  try {
13819
- return Lo(i.attrs);
13845
+ return Jo(i.attrs);
13820
13846
  } catch {
13821
13847
  throw Error(
13822
13848
  `Failed to parse OME-Zarr well:
@@ -13824,15 +13850,15 @@ ${JSON.stringify(i.attrs)}`
13824
13850
  );
13825
13851
  }
13826
13852
  }
13827
- async function Vo(g) {
13853
+ async function vo(g) {
13828
13854
  const A = WA(g.version), I = await wI(g.location, A);
13829
13855
  return mg(I.attrs).omero?.channels ?? [];
13830
13856
  }
13831
- async function vo(g) {
13857
+ async function Xo(g) {
13832
13858
  const A = WA(g.version), I = await wI(g.location, A);
13833
13859
  return mg(I.attrs).omero?.rdefs;
13834
13860
  }
13835
- function Jo(g) {
13861
+ function Yo(g) {
13836
13862
  return {
13837
13863
  ome: {
13838
13864
  multiscales: g.multiscales,
@@ -13841,23 +13867,23 @@ function Jo(g) {
13841
13867
  }
13842
13868
  };
13843
13869
  }
13844
- function Yo(g) {
13870
+ function Mo(g) {
13845
13871
  switch (pg(g)) {
13846
13872
  case "0.5":
13847
13873
  return {
13848
- ...wo.parse(g).ome,
13874
+ ...Fo.parse(g).ome,
13849
13875
  originalVersion: "0.5"
13850
13876
  };
13851
13877
  case "0.4":
13852
13878
  return {
13853
- ...Jo(eo.parse(g)).ome,
13879
+ ...Yo(Go.parse(g)).ome,
13854
13880
  originalVersion: "0.4"
13855
13881
  };
13856
13882
  }
13857
13883
  }
13858
13884
  function mg(g) {
13859
13885
  try {
13860
- return Yo(g);
13886
+ return Mo(g);
13861
13887
  } catch {
13862
13888
  throw Error(`Failed to parse OME-Zarr image:
13863
13889
  ${JSON.stringify(g)}`);
@@ -13881,15 +13907,15 @@ class NI {
13881
13907
  throw new Error("No datasets found in the multiscale image.");
13882
13908
  A || (A = WA(B.originalVersion));
13883
13909
  const E = Q.datasets.map(
13884
- (s) => vE(this.location, s.path, A)
13910
+ (s) => XE(this.location, s.path, A)
13885
13911
  ), i = await Promise.all(
13886
- E.map((s) => VE(s))
13912
+ E.map((s) => vE(s))
13887
13913
  ), o = i[0].shape, a = Q.axes;
13888
13914
  if (a.length !== o.length)
13889
13915
  throw new Error(
13890
13916
  `Mismatch between number of axes (${a.length}) and array shape (${o.length})`
13891
13917
  );
13892
- return new Qi({
13918
+ return new Ei({
13893
13919
  metadata: Q,
13894
13920
  arrays: i,
13895
13921
  arrayParams: E
@@ -13942,7 +13968,7 @@ class NI {
13942
13968
  });
13943
13969
  }
13944
13970
  }
13945
- const iC = [
13971
+ const aC = [
13946
13972
  "fallbackVisible",
13947
13973
  "prefetchTime",
13948
13974
  "visibleCurrent",
@@ -13950,14 +13976,14 @@ const iC = [
13950
13976
  "prefetchSpace"
13951
13977
  ];
13952
13978
  function ug(g) {
13953
- Mo(g);
13979
+ Ko(g);
13954
13980
  const A = {
13955
13981
  x: g.prefetch.x,
13956
13982
  y: g.prefetch.y,
13957
13983
  z: g.prefetch.z ?? 0,
13958
13984
  t: g.prefetch.t ?? 0
13959
13985
  }, I = Object.freeze(
13960
- iC.reduce(
13986
+ aC.reduce(
13961
13987
  (Q, E) => {
13962
13988
  const i = g.priorityOrder.indexOf(E);
13963
13989
  return Q[E] = i, Q;
@@ -13977,7 +14003,7 @@ function ug(g) {
13977
14003
  };
13978
14004
  return Object.freeze(C);
13979
14005
  }
13980
- function Xo(g = {}) {
14006
+ function jo(g = {}) {
13981
14007
  return ug(Tg({
13982
14008
  profile: "exploration",
13983
14009
  prefetch: { x: 1, y: 1, z: 1, t: 0 },
@@ -13990,7 +14016,7 @@ function Xo(g = {}) {
13990
14016
  ]
13991
14017
  }, g));
13992
14018
  }
13993
- function jo(g = {}) {
14019
+ function zo(g = {}) {
13994
14020
  return ug(Tg({
13995
14021
  profile: "playback",
13996
14022
  prefetch: { x: 0, y: 0, z: 0, t: 20 },
@@ -14003,7 +14029,7 @@ function jo(g = {}) {
14003
14029
  ]
14004
14030
  }, g));
14005
14031
  }
14006
- function zo(g = {}) {
14032
+ function _o(g = {}) {
14007
14033
  return ug(Tg({
14008
14034
  profile: "no-prefetch",
14009
14035
  prefetch: { x: 0, y: 0, z: 0, t: 0 },
@@ -14016,7 +14042,7 @@ function zo(g = {}) {
14016
14042
  ]
14017
14043
  }, g));
14018
14044
  }
14019
- function Mo(g) {
14045
+ function Ko(g) {
14020
14046
  for (const [B, C] of Object.entries(g.prefetch))
14021
14047
  if (C !== void 0 && C < 0)
14022
14048
  throw new Error(`prefetch.${B} must be a non-negative number`);
@@ -14024,7 +14050,7 @@ function Mo(g) {
14024
14050
  if (A?.min !== void 0 && A?.max !== void 0 && A.min > A.max)
14025
14051
  throw new Error("lod.min must be <= lod.max");
14026
14052
  const I = g.priorityOrder;
14027
- if (I.length !== iC.length || new Set(I).size !== I.length)
14053
+ if (I.length !== aC.length || new Set(I).size !== I.length)
14028
14054
  throw new Error("priorityOrder must include all categories exactly once");
14029
14055
  }
14030
14056
  function Tg(g, A = {}) {
@@ -14035,7 +14061,7 @@ function Tg(g, A = {}) {
14035
14061
  priorityOrder: A.priorityOrder ?? g.priorityOrder
14036
14062
  };
14037
14063
  }
14038
- class _o extends ZA {
14064
+ class $o extends ZA {
14039
14065
  atlas_;
14040
14066
  constructor(A, I) {
14041
14067
  super(), this.programName = "points", this.atlas_ = I, A.forEach((Q) => {
@@ -14079,41 +14105,42 @@ class _o extends ZA {
14079
14105
  }
14080
14106
  }
14081
14107
  export {
14082
- po as AxesLayer,
14108
+ mo as AxesLayer,
14083
14109
  AA as Box2,
14084
14110
  RA as Box3,
14085
- pB as ChunkedImageLayer,
14111
+ uB as ChunkedImageLayer,
14086
14112
  l as Color,
14087
- SQ as Frustum,
14088
- Ko as Idetik,
14089
- xo as ImageLayer,
14090
- bo as ImageSeriesLayer,
14091
- Wo as LabelImageLayer,
14113
+ RQ as Frustum,
14114
+ Ho as Idetik,
14115
+ Wo as ImageLayer,
14116
+ Zo as ImageSeriesLayer,
14117
+ bo as LabelImageLayer,
14092
14118
  FA as Layer,
14093
- sQ as LayerManager,
14119
+ hQ as LayerManager,
14094
14120
  NI as OmeZarrImageSource,
14095
- fo as OrbitControls,
14096
- Ho as OrthographicCamera,
14097
- lo as PanZoomControls,
14098
- qo as PerspectiveCamera,
14121
+ po as OrbitControls,
14122
+ qo as OrthographicCamera,
14123
+ fo as PanZoomControls,
14124
+ lo as PerspectiveCamera,
14099
14125
  dA as Plane,
14100
- _o as Points,
14101
- mo as ProjectedLineLayer,
14102
- IB as Spherical,
14126
+ $o as Points,
14127
+ uo as ProjectedLineLayer,
14128
+ gB as Spherical,
14103
14129
  yI as Texture2DArray,
14104
14130
  jA as Texture3D,
14105
- uo as TracksLayer,
14106
- yQ as Viewport,
14107
- To as VolumeLayer,
14108
- gQ as WebGLRenderer,
14109
- Xo as createExplorationPolicy,
14131
+ To as TracksLayer,
14132
+ GQ as Viewport,
14133
+ xo as VolumeLayer,
14134
+ CQ as WebGLRenderer,
14135
+ jo as createExplorationPolicy,
14110
14136
  ug as createImageSourcePolicy,
14111
- zo as createNoPrefetchPolicy,
14112
- jo as createPlaybackPolicy,
14113
- Po as loadOmeZarrPlate,
14114
- Oo as loadOmeZarrWell,
14115
- Vo as loadOmeroChannels,
14116
- vo as loadOmeroDefaults,
14117
- GQ as parseViewportConfigs
14137
+ _o as createNoPrefetchPolicy,
14138
+ zo as createPlaybackPolicy,
14139
+ Oo as loadOmeZarrPlate,
14140
+ Vo as loadOmeZarrWell,
14141
+ vo as loadOmeroChannels,
14142
+ Xo as loadOmeroDefaults,
14143
+ _g as parseViewportConfigs,
14144
+ qB as validateNewViewport
14118
14145
  };
14119
14146
  //# sourceMappingURL=index.js.map