@idetik/core 0.46.1 → 0.46.2

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
@@ -1,4 +1,4 @@
1
- class dC {
1
+ class KC {
2
2
  canvas_;
3
3
  width_ = 0;
4
4
  height_ = 0;
@@ -87,7 +87,7 @@ void main() {
87
87
 
88
88
 
89
89
  gl_PointSize = 5.0;
90
- }`, MC = `#version 300 es
90
+ }`, HC = `#version 300 es
91
91
 
92
92
  precision mediump float;
93
93
 
@@ -159,7 +159,7 @@ void main() {
159
159
  gl_PointSize = a_size;
160
160
  v_color = a_color;
161
161
  v_marker = uint(a_marker);
162
- }`, KC = `#version 300 es
162
+ }`, qC = `#version 300 es
163
163
 
164
164
  precision mediump float;
165
165
 
@@ -179,7 +179,7 @@ void main() {
179
179
  discard;
180
180
  }
181
181
  fragColor = vec4(v_color.rgb, u_opacity * alpha * v_color.a);
182
- }`, HC = `#version 300 es
182
+ }`, lC = `#version 300 es
183
183
 
184
184
  layout (location = 0) in vec3 a_position;
185
185
  layout (location = 1) in vec3 a_normal;
@@ -189,7 +189,7 @@ uniform mat4 u_modelView;
189
189
 
190
190
  void main() {
191
191
  gl_Position = u_projection * u_modelView * vec4(a_position, 1.0);
192
- }`, qC = `#version 300 es
192
+ }`, fC = `#version 300 es
193
193
 
194
194
  precision mediump float;
195
195
 
@@ -477,7 +477,7 @@ void main() {
477
477
  fragColor = vec4(color.rgb, alpha);
478
478
  }`, _g = `#version 300 es
479
479
 
480
- void main() {}`, lC = `#version 300 es
480
+ void main() {}`, pC = `#version 300 es
481
481
 
482
482
  precision mediump float;
483
483
 
@@ -490,18 +490,18 @@ void main() {
490
490
  discard;
491
491
  }
492
492
  }`;
493
- const fC = {
493
+ const uC = {
494
494
  projectedLine: {
495
495
  vertex: Xg,
496
- fragment: MC
496
+ fragment: HC
497
497
  },
498
498
  points: {
499
499
  vertex: jg,
500
- fragment: KC
500
+ fragment: qC
501
501
  },
502
502
  wireframe: {
503
- vertex: HC,
504
- fragment: qC
503
+ vertex: lC,
504
+ fragment: fC
505
505
  },
506
506
  floatScalarImage: {
507
507
  vertex: UA,
@@ -546,7 +546,7 @@ const fC = {
546
546
  },
547
547
  pointsDepth: {
548
548
  vertex: jg,
549
- fragment: lC
549
+ fragment: pC
550
550
  },
551
551
  projectedLineDepth: {
552
552
  vertex: Xg,
@@ -557,7 +557,7 @@ const fC = {
557
557
  info: 20,
558
558
  warn: 30,
559
559
  error: 40
560
- }, pC = {
560
+ }, mC = {
561
561
  debug: "\x1B[90m",
562
562
  // gray
563
563
  info: "\x1B[36m",
@@ -567,7 +567,7 @@ const fC = {
567
567
  error: "\x1B[31m"
568
568
  // red
569
569
  };
570
- function uC() {
570
+ function TC() {
571
571
  const g = typeof process < "u" && typeof process.env?.NODE_ENV == "string" ? process.env.NODE_ENV : void 0;
572
572
  if (g === "production" || g === "development" || g === "test")
573
573
  return g;
@@ -579,7 +579,7 @@ function uC() {
579
579
  return "development";
580
580
  }
581
581
  class k {
582
- static logLevel_ = uC() === "production" ? "warn" : "debug";
582
+ static logLevel_ = TC() === "production" ? "warn" : "debug";
583
583
  static setLogLevel(A) {
584
584
  k.logLevel_ = A;
585
585
  }
@@ -597,7 +597,7 @@ class k {
597
597
  }
598
598
  static log(A, I, B, ...C) {
599
599
  if ($g[A] < $g[k.logLevel_]) return;
600
- const Q = (/* @__PURE__ */ new Date()).toISOString(), E = pC[A], i = `[${Q}][${A.toUpperCase()}][${I}]`, o = [`${E}${i}`, B, ...C];
600
+ const Q = (/* @__PURE__ */ new Date()).toISOString(), E = mC[A], i = `[${Q}][${A.toUpperCase()}][${I}]`, o = [`${E}${i}`, B, ...C];
601
601
  switch (A) {
602
602
  case "debug":
603
603
  console.debug(...o);
@@ -614,7 +614,7 @@ class k {
614
614
  }
615
615
  }
616
616
  }
617
- class mC {
617
+ class xC {
618
618
  gl_;
619
619
  program_;
620
620
  uniformInfo_ = /* @__PURE__ */ new Map();
@@ -696,7 +696,7 @@ class mC {
696
696
  for (let I = 0; I < A; I++) {
697
697
  const B = this.gl_.getActiveUniform(this.program_, I);
698
698
  if (B) {
699
- if (!xC.has(B.type))
699
+ if (!bC.has(B.type))
700
700
  throw new Error(
701
701
  `Unsupported uniform type "${B.type}" (GLenum) found in shader program for uniform "${B.name}"`
702
702
  );
@@ -737,7 +737,7 @@ class mC {
737
737
  return Array.from(this.uniformInfo_.keys());
738
738
  }
739
739
  }
740
- const TC = typeof window < "u" ? [
740
+ const WC = typeof window < "u" ? [
741
741
  WebGL2RenderingContext.BOOL,
742
742
  WebGL2RenderingContext.FLOAT,
743
743
  WebGL2RenderingContext.INT,
@@ -762,10 +762,10 @@ const TC = typeof window < "u" ? [
762
762
  WebGL2RenderingContext.UNSIGNED_INT_SAMPLER_3D,
763
763
  WebGL2RenderingContext.UNSIGNED_INT_SAMPLER_CUBE,
764
764
  WebGL2RenderingContext.UNSIGNED_INT_SAMPLER_2D_ARRAY
765
- ] : [], xC = new Set(
766
- TC
765
+ ] : [], bC = new Set(
766
+ WC
767
767
  ), uI = "#pragma inject_defines";
768
- class WC {
768
+ class ZC {
769
769
  gl_;
770
770
  programs_ = /* @__PURE__ */ new Map();
771
771
  constructor(A) {
@@ -774,14 +774,14 @@ class WC {
774
774
  use(A) {
775
775
  let I = this.programs_.get(A);
776
776
  if (I === void 0) {
777
- const B = fC[A], C = AB(
777
+ const B = uC[A], C = AB(
778
778
  B.vertex,
779
779
  B.vertexDefines
780
780
  ), Q = AB(
781
781
  B.fragment,
782
782
  B.fragmentDefines
783
783
  );
784
- I = new mC(
784
+ I = new xC(
785
785
  this.gl_,
786
786
  C,
787
787
  Q
@@ -807,32 +807,35 @@ ${C}`;
807
807
  return g.replace(uI, Q);
808
808
  }
809
809
  const BI = {};
810
- function _B(g) {
810
+ function AC(g) {
811
811
  const A = g ?? "";
812
812
  return BI[A] = (BI[A] ?? 0) + 1, g ? `${g}-${BI[A]}` : String(BI[A]);
813
813
  }
814
814
  class YI {
815
- id = _B();
815
+ id = AC();
816
816
  }
817
- var m = 1e-6, j = typeof Float32Array < "u" ? Float32Array : Array, bC = Math.PI / 180;
818
- function ZC(g) {
819
- return g * bC;
817
+ var m = 1e-6, j = typeof Float32Array < "u" ? Float32Array : Array, PC = Math.PI / 180;
818
+ function OC(g) {
819
+ return g * PC;
820
820
  }
821
- function $B() {
821
+ function IC() {
822
822
  var g = new j(9);
823
823
  return j != 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;
824
824
  }
825
- function PC(g, A) {
825
+ function VC(g, A) {
826
826
  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;
827
827
  }
828
- function OC(g, A, I, B, C, Q, E, i, o) {
828
+ function vC(g, A, I, B, C, Q, E, i, o) {
829
829
  var a = new j(9);
830
830
  return a[0] = g, a[1] = A, a[2] = I, a[3] = B, a[4] = C, a[5] = Q, a[6] = E, a[7] = i, a[8] = o, a;
831
831
  }
832
- function $() {
832
+ function _() {
833
833
  var g = new j(16);
834
834
  return j != Float32Array && (g[1] = 0, g[2] = 0, g[3] = 0, g[4] = 0, g[6] = 0, g[7] = 0, g[8] = 0, g[9] = 0, g[11] = 0, g[12] = 0, g[13] = 0, g[14] = 0), g[0] = 1, g[5] = 1, g[10] = 1, g[15] = 1, g;
835
835
  }
836
+ function IB(g, A) {
837
+ return g[0] = A[0], g[1] = A[1], g[2] = A[2], g[3] = A[3], g[4] = A[4], g[5] = A[5], g[6] = A[6], g[7] = A[7], g[8] = A[8], g[9] = A[9], g[10] = A[10], g[11] = A[11], g[12] = A[12], g[13] = A[13], g[14] = A[14], g[15] = A[15], g;
838
+ }
836
839
  function PA(g, A) {
837
840
  var I = A[0], B = A[1], C = A[2], Q = A[3], E = A[4], i = A[5], o = A[6], a = A[7], s = A[8], D = A[9], h = A[10], t = A[11], e = A[12], n = A[13], F = A[14], G = A[15], L = I * i - B * E, N = I * o - C * E, S = I * a - Q * E, r = B * o - C * i, U = B * a - Q * i, l = C * a - Q * o, Z = s * n - D * e, O = s * F - h * e, b = s * G - t * e, z = D * F - h * n, oA = D * G - t * n, aA = h * G - t * F, P = L * aA - N * oA + S * z + r * b - U * O + l * Z;
838
841
  return P ? (P = 1 / P, g[0] = (i * aA - o * oA + a * z) * P, g[1] = (C * oA - B * aA - Q * z) * P, g[2] = (n * l - F * U + G * r) * P, g[3] = (h * U - D * l - t * r) * P, g[4] = (o * b - E * aA - a * O) * P, g[5] = (I * aA - C * b + Q * O) * P, g[6] = (F * S - e * l - G * N) * P, g[7] = (s * l - h * S + t * N) * P, g[8] = (E * oA - i * b + a * Z) * P, g[9] = (B * b - I * oA - Q * Z) * P, g[10] = (e * U - n * S + G * L) * P, g[11] = (D * S - s * U - t * L) * P, g[12] = (i * O - E * z - o * Z) * P, g[13] = (I * z - B * O + C * Z) * P, g[14] = (n * N - e * r - F * L) * P, g[15] = (s * r - D * N + h * L) * P, g) : null;
@@ -841,18 +844,18 @@ function QI(g, A, I) {
841
844
  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], D = A[8], h = A[9], t = A[10], e = A[11], n = A[12], F = A[13], G = A[14], L = A[15], N = I[0], S = I[1], r = I[2], U = I[3];
842
845
  return g[0] = N * B + S * i + r * D + U * n, g[1] = N * C + S * o + r * h + U * F, g[2] = N * Q + S * a + r * t + U * G, g[3] = N * E + S * s + r * e + U * L, N = I[4], S = I[5], r = I[6], U = I[7], g[4] = N * B + S * i + r * D + U * n, g[5] = N * C + S * o + r * h + U * F, g[6] = N * Q + S * a + r * t + U * G, g[7] = N * E + S * s + r * e + U * L, N = I[8], S = I[9], r = I[10], U = I[11], g[8] = N * B + S * i + r * D + U * n, g[9] = N * C + S * o + r * h + U * F, g[10] = N * Q + S * a + r * t + U * G, g[11] = N * E + S * s + r * e + U * L, N = I[12], S = I[13], r = I[14], U = I[15], g[12] = N * B + S * i + r * D + U * n, g[13] = N * C + S * o + r * h + U * F, g[14] = N * Q + S * a + r * t + U * G, g[15] = N * E + S * s + r * e + U * L, g;
843
846
  }
844
- function VC(g, A, I) {
847
+ function XC(g, A, I) {
845
848
  var B = I[0], C = I[1], Q = I[2], E, i, o, a, s, D, h, t, e, n, F, G;
846
849
  return A === g ? (g[12] = A[0] * B + A[4] * C + A[8] * Q + A[12], g[13] = A[1] * B + A[5] * C + A[9] * Q + A[13], g[14] = A[2] * B + A[6] * C + A[10] * Q + A[14], g[15] = A[3] * B + A[7] * C + A[11] * Q + A[15]) : (E = A[0], i = A[1], o = A[2], a = A[3], s = A[4], D = A[5], h = A[6], t = A[7], e = A[8], n = A[9], F = A[10], G = A[11], g[0] = E, g[1] = i, g[2] = o, g[3] = a, g[4] = s, g[5] = D, g[6] = h, g[7] = t, g[8] = e, g[9] = n, g[10] = F, g[11] = G, g[12] = E * B + s * C + e * Q + A[12], g[13] = i * B + D * C + n * Q + A[13], g[14] = o * B + h * C + F * Q + A[14], g[15] = a * B + t * C + G * Q + A[15]), g;
847
850
  }
848
- function AC(g, A) {
851
+ function gC(g, A) {
849
852
  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;
850
853
  }
851
- function vC(g, A, I, B) {
854
+ function jC(g, A, I, B) {
852
855
  var C = A[0], Q = A[1], E = A[2], i = A[3], o = C + C, a = Q + Q, s = E + E, D = C * o, h = C * a, t = C * s, e = Q * a, n = Q * s, F = E * s, G = i * o, L = i * a, N = i * s, S = B[0], r = B[1], U = B[2];
853
856
  return g[0] = (1 - (e + F)) * S, g[1] = (h + N) * S, g[2] = (t - L) * S, g[3] = 0, g[4] = (h - N) * r, g[5] = (1 - (D + F)) * r, g[6] = (n + G) * r, g[7] = 0, g[8] = (t + L) * U, g[9] = (n - G) * U, g[10] = (1 - (D + e)) * U, g[11] = 0, g[12] = I[0], g[13] = I[1], g[14] = I[2], g[15] = 1, g;
854
857
  }
855
- function XC(g, A, I, B, C) {
858
+ function zC(g, A, I, B, C) {
856
859
  var Q = 1 / Math.tan(A / 2);
857
860
  if (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) {
858
861
  var E = 1 / (B - C);
@@ -861,19 +864,22 @@ function XC(g, A, I, B, C) {
861
864
  g[10] = -1, g[14] = -2 * B;
862
865
  return g;
863
866
  }
864
- var jC = XC;
865
- function zC(g, A, I, B, C, Q, E) {
867
+ var _C = zC;
868
+ function $C(g, A, I, B, C, Q, E) {
866
869
  var i = 1 / (A - I), o = 1 / (B - C), a = 1 / (Q - E);
867
870
  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;
868
871
  }
869
- var _C = zC;
870
- function $C(g, A, I, B) {
872
+ var AQ = $C;
873
+ function IQ(g, A, I, B) {
871
874
  var C = A[0], Q = A[1], E = A[2], i = B[0], o = B[1], a = B[2], s = C - I[0], D = Q - I[1], h = E - I[2], t = s * s + D * D + h * h;
872
875
  t > 0 && (t = 1 / Math.sqrt(t), s *= t, D *= t, h *= t);
873
876
  var e = o * h - a * D, n = a * s - i * h, F = i * D - o * s;
874
877
  return t = e * e + n * n + F * F, t > 0 && (t = 1 / Math.sqrt(t), e *= t, n *= t, F *= t), g[0] = e, g[1] = n, g[2] = F, g[3] = 0, g[4] = D * F - h * n, g[5] = h * e - s * F, g[6] = s * n - D * e, g[7] = 0, g[8] = s, g[9] = D, g[10] = h, g[11] = 0, g[12] = C, g[13] = Q, g[14] = E, g[15] = 1, g;
875
878
  }
876
- function AQ(g, A) {
879
+ function gB(g, A) {
880
+ return g[0] === A[0] && g[1] === A[1] && g[2] === A[2] && g[3] === A[3] && g[4] === A[4] && g[5] === A[5] && g[6] === A[6] && g[7] === A[7] && g[8] === A[8] && g[9] === A[9] && g[10] === A[10] && g[11] === A[11] && g[12] === A[12] && g[13] === A[13] && g[14] === A[14] && g[15] === A[15];
881
+ }
882
+ function gQ(g, A) {
877
883
  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], D = g[9], h = g[10], t = g[11], e = g[12], n = g[13], F = g[14], G = g[15], L = A[0], N = A[1], S = A[2], r = A[3], U = A[4], l = A[5], Z = A[6], O = A[7], b = A[8], z = A[9], oA = A[10], aA = A[11], P = A[12], Og = A[13], Vg = A[14], vg = A[15];
878
884
  return Math.abs(I - L) <= m * Math.max(1, Math.abs(I), Math.abs(L)) && Math.abs(B - N) <= m * Math.max(1, Math.abs(B), Math.abs(N)) && Math.abs(C - S) <= m * Math.max(1, Math.abs(C), Math.abs(S)) && Math.abs(Q - r) <= m * Math.max(1, Math.abs(Q), Math.abs(r)) && Math.abs(E - U) <= m * Math.max(1, Math.abs(E), Math.abs(U)) && Math.abs(i - l) <= m * Math.max(1, Math.abs(i), Math.abs(l)) && Math.abs(o - Z) <= m * Math.max(1, Math.abs(o), Math.abs(Z)) && Math.abs(a - O) <= m * Math.max(1, Math.abs(a), Math.abs(O)) && Math.abs(s - b) <= m * Math.max(1, Math.abs(s), Math.abs(b)) && Math.abs(D - z) <= m * Math.max(1, Math.abs(D), Math.abs(z)) && Math.abs(h - oA) <= m * Math.max(1, Math.abs(h), Math.abs(oA)) && Math.abs(t - aA) <= m * Math.max(1, Math.abs(t), Math.abs(aA)) && Math.abs(e - P) <= m * Math.max(1, Math.abs(e), Math.abs(P)) && Math.abs(n - Og) <= m * Math.max(1, Math.abs(n), Math.abs(Og)) && Math.abs(F - Vg) <= m * Math.max(1, Math.abs(F), Math.abs(Vg)) && Math.abs(G - vg) <= m * Math.max(1, Math.abs(G), Math.abs(vg));
879
885
  }
@@ -905,7 +911,7 @@ function aI(g, A, I) {
905
911
  function Gg(g, A, I) {
906
912
  return g[0] = A[0] - I[0], g[1] = A[1] - I[1], g[2] = A[2] - I[2], g;
907
913
  }
908
- function IQ(g, A, I) {
914
+ function BQ(g, A, I) {
909
915
  return g[0] = A[0] * I[0], g[1] = A[1] * I[1], g[2] = A[2] * I[2], g;
910
916
  }
911
917
  function $I(g, A, I) {
@@ -914,11 +920,11 @@ function $I(g, A, I) {
914
920
  function Ag(g, A, I, B) {
915
921
  return g[0] = A[0] + I[0] * B, g[1] = A[1] + I[1] * B, g[2] = A[2] + I[2] * B, g;
916
922
  }
917
- function gQ(g, A) {
923
+ function CQ(g, A) {
918
924
  var I = A[0] - g[0], B = A[1] - g[1], C = A[2] - g[2];
919
925
  return I * I + B * B + C * C;
920
926
  }
921
- function IC(g, A) {
927
+ function BC(g, A) {
922
928
  var I = A[0], B = A[1], C = A[2], Q = I * I + B * B + C * C;
923
929
  return Q > 0 && (Q = 1 / Math.sqrt(Q)), g[0] = A[0] * Q, g[1] = A[1] * Q, g[2] = A[2] * Q, g;
924
930
  }
@@ -933,18 +939,18 @@ function wg(g, A, I) {
933
939
  var B = A[0], C = A[1], Q = A[2], E = I[3] * B + I[7] * C + I[11] * Q + I[15];
934
940
  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;
935
941
  }
936
- function gC(g, A, I) {
942
+ function CC(g, A, I) {
937
943
  var B = I[0], C = I[1], Q = I[2], E = I[3], i = A[0], o = A[1], a = A[2], s = C * a - Q * o, D = Q * i - B * a, h = B * o - C * i;
938
944
  return s = s + s, D = D + D, h = h + h, g[0] = i + E * s + C * h - Q * D, g[1] = o + E * D + Q * s - B * h, g[2] = a + E * h + B * D - C * s, g;
939
945
  }
940
- function BQ(g) {
946
+ function QQ(g) {
941
947
  return g[0] = 0, g[1] = 0, g[2] = 0, g;
942
948
  }
943
949
  function Fg(g, A) {
944
950
  var I = g[0], B = g[1], C = g[2], Q = A[0], E = A[1], i = A[2];
945
951
  return Math.abs(I - Q) <= m * Math.max(1, Math.abs(I), Math.abs(Q)) && Math.abs(B - E) <= m * Math.max(1, Math.abs(B), Math.abs(E)) && Math.abs(C - i) <= m * Math.max(1, Math.abs(C), Math.abs(i));
946
952
  }
947
- var Ig = Gg, CQ = ng;
953
+ var Ig = Gg, EQ = ng;
948
954
  (function() {
949
955
  var g = M();
950
956
  return function(A, I, B, C, Q, E) {
@@ -958,7 +964,7 @@ function JA() {
958
964
  var g = new j(4);
959
965
  return j != Float32Array && (g[0] = 0, g[1] = 0, g[2] = 0, g[3] = 0), g;
960
966
  }
961
- function QQ(g) {
967
+ function iQ(g) {
962
968
  var A = new j(4);
963
969
  return A[0] = g[0], A[1] = g[1], A[2] = g[2], A[3] = g[3], A;
964
970
  }
@@ -966,13 +972,13 @@ function DI(g, A, I, B) {
966
972
  var C = new j(4);
967
973
  return C[0] = g, C[1] = A, C[2] = I, C[3] = B, C;
968
974
  }
969
- function EQ(g, A) {
975
+ function oQ(g, A) {
970
976
  return g[0] = A[0], g[1] = A[1], g[2] = A[2], g[3] = A[3], g;
971
977
  }
972
- function iQ(g, A, I) {
978
+ function aQ(g, A, I) {
973
979
  return g[0] = A[0] * I, g[1] = A[1] * I, g[2] = A[2] * I, g[3] = A[3] * I, g;
974
980
  }
975
- function oQ(g, A) {
981
+ function sQ(g, A) {
976
982
  var I = A[0], B = A[1], C = A[2], Q = A[3], E = I * I + B * B + C * C + Q * Q;
977
983
  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;
978
984
  }
@@ -993,12 +999,12 @@ function hI() {
993
999
  var g = new j(4);
994
1000
  return j != Float32Array && (g[0] = 0, g[1] = 0, g[2] = 0), g[3] = 1, g;
995
1001
  }
996
- function aQ(g, A, I) {
1002
+ function DQ(g, A, I) {
997
1003
  I = I * 0.5;
998
1004
  var B = Math.sin(I);
999
1005
  return g[0] = B * A[0], g[1] = B * A[1], g[2] = B * A[2], g[3] = Math.cos(I), g;
1000
1006
  }
1001
- function sQ(g, A, I) {
1007
+ function hQ(g, A, I) {
1002
1008
  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];
1003
1009
  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;
1004
1010
  }
@@ -1018,12 +1024,12 @@ function rg(g, A) {
1018
1024
  }
1019
1025
  return g;
1020
1026
  }
1021
- var DQ = QQ, hQ = EQ, dI = oQ;
1027
+ var tQ = iQ, yQ = oQ, dI = sQ;
1022
1028
  (function() {
1023
1029
  var g = M(), A = x(1, 0, 0), I = x(0, 1, 0);
1024
1030
  return function(B, C, Q) {
1025
1031
  var E = sI(C, Q);
1026
- return E < -0.999999 ? (EI(g, A, C), CQ(g) < 1e-6 && EI(g, I, C), IC(g, g), aQ(B, g, Math.PI), B) : E > 0.999999 ? (B[0] = 0, B[1] = 0, B[2] = 0, B[3] = 1, B) : (EI(g, C, Q), B[0] = g[0], B[1] = g[1], B[2] = g[2], B[3] = 1 + E, dI(B, B));
1032
+ return E < -0.999999 ? (EI(g, A, C), EQ(g) < 1e-6 && EI(g, I, C), BC(g, g), DQ(B, g, Math.PI), B) : E > 0.999999 ? (B[0] = 0, B[1] = 0, B[2] = 0, B[3] = 1, B) : (EI(g, C, Q), B[0] = g[0], B[1] = g[1], B[2] = g[2], B[3] = 1 + E, dI(B, B));
1027
1033
  };
1028
1034
  })();
1029
1035
  (function() {
@@ -1033,16 +1039,16 @@ var DQ = QQ, hQ = EQ, dI = oQ;
1033
1039
  };
1034
1040
  })();
1035
1041
  (function() {
1036
- var g = $B();
1042
+ var g = IC();
1037
1043
  return function(A, I, B, C) {
1038
1044
  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], dI(A, rg(A, g));
1039
1045
  };
1040
1046
  })();
1041
- function BC() {
1047
+ function QC() {
1042
1048
  var g = new j(2);
1043
1049
  return j != Float32Array && (g[0] = 0, g[1] = 0), g;
1044
1050
  }
1045
- function IB(g) {
1051
+ function BB(g) {
1046
1052
  var A = new j(2);
1047
1053
  return A[0] = g[0], A[1] = g[1], A;
1048
1054
  }
@@ -1050,27 +1056,27 @@ function v(g, A) {
1050
1056
  var I = new j(2);
1051
1057
  return I[0] = g, I[1] = A, I;
1052
1058
  }
1053
- function tQ(g, A) {
1059
+ function eQ(g, A) {
1054
1060
  var I = A[0] - g[0], B = A[1] - g[1];
1055
1061
  return Math.sqrt(I * I + B * B);
1056
1062
  }
1057
- function yQ(g) {
1063
+ function nQ(g) {
1058
1064
  var A = g[0], I = g[1];
1059
1065
  return A * A + I * I;
1060
1066
  }
1061
- function eQ(g, A, I, B) {
1067
+ function GQ(g, A, I, B) {
1062
1068
  var C = A[0], Q = A[1];
1063
1069
  return g[0] = C + B * (I[0] - C), g[1] = Q + B * (I[1] - Q), g;
1064
1070
  }
1065
- function gB(g, A) {
1071
+ function CB(g, A) {
1066
1072
  return g[0] === A[0] && g[1] === A[1];
1067
1073
  }
1068
- function BB(g, A) {
1074
+ function QB(g, A) {
1069
1075
  var I = g[0], B = g[1], C = A[0], Q = A[1];
1070
1076
  return Math.abs(I - C) <= m * Math.max(1, Math.abs(I), Math.abs(C)) && Math.abs(B - Q) <= m * Math.max(1, Math.abs(B), Math.abs(Q));
1071
1077
  }
1072
1078
  (function() {
1073
- var g = BC();
1079
+ var g = QC();
1074
1080
  return function(A, I, B, C, Q, E) {
1075
1081
  var i, o;
1076
1082
  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)
@@ -1143,7 +1149,7 @@ class VA {
1143
1149
  wg(Q, E, A), this.expandWithPoint(Q);
1144
1150
  }
1145
1151
  }
1146
- const nQ = {
1152
+ const wQ = {
1147
1153
  position: 0,
1148
1154
  normal: 1,
1149
1155
  uv: 2,
@@ -1207,7 +1213,7 @@ class pA extends YI {
1207
1213
  return this.attributes_.find((I) => I.type === A);
1208
1214
  }
1209
1215
  }
1210
- class GQ {
1216
+ class FQ {
1211
1217
  gl_;
1212
1218
  buffers_ = /* @__PURE__ */ new Map();
1213
1219
  currentGeometry_ = null;
@@ -1243,7 +1249,7 @@ class GQ {
1243
1249
  this.gl_.bindBuffer(C, Q), this.gl_.bufferData(C, B, this.gl_.STATIC_DRAW);
1244
1250
  const { attributes: E, strideBytes: i } = A;
1245
1251
  E.forEach((s) => {
1246
- const D = nQ[s.type];
1252
+ const D = wQ[s.type];
1247
1253
  this.gl_.vertexAttribPointer(
1248
1254
  D,
1249
1255
  s.itemSize,
@@ -1262,7 +1268,7 @@ class GQ {
1262
1268
  this.buffers_.set(A, o), this.gl_.bindVertexArray(null);
1263
1269
  }
1264
1270
  }
1265
- function wQ(g) {
1271
+ function rQ(g) {
1266
1272
  return g === 1 || g === 2 || g === 4 || g === 8;
1267
1273
  }
1268
1274
  function Sg(g) {
@@ -1282,7 +1288,7 @@ function Sg(g) {
1282
1288
  return "float";
1283
1289
  throw new Error("Unsupported buffer type.");
1284
1290
  }
1285
- function FQ(g) {
1291
+ function SQ(g) {
1286
1292
  switch (g.dataFormat) {
1287
1293
  case "scalar":
1288
1294
  return 1;
@@ -1292,7 +1298,7 @@ function FQ(g) {
1292
1298
  return 4;
1293
1299
  }
1294
1300
  }
1295
- function rQ(g) {
1301
+ function RQ(g) {
1296
1302
  switch (g.dataType) {
1297
1303
  case "byte":
1298
1304
  case "unsigned_byte":
@@ -1307,13 +1313,13 @@ function rQ(g) {
1307
1313
  }
1308
1314
  }
1309
1315
  function gg(g) {
1310
- const A = FQ(g) * rQ(g), I = Math.max(1, g.mipmapLevels);
1316
+ const A = SQ(g) * RQ(g), I = Math.max(1, g.mipmapLevels);
1311
1317
  let B = Math.max(1, g.width), C = Math.max(1, g.height), Q = Math.max(1, g.depth), E = 0;
1312
1318
  for (let i = 0; i < I; ++i)
1313
1319
  E += A * Q * B * C, B = Math.max(1, B >> 1), C = Math.max(1, C >> 1), g.type === "Texture3D" && (Q = Math.max(1, Q >> 1));
1314
1320
  return E;
1315
1321
  }
1316
- function SQ(g) {
1322
+ function cQ(g) {
1317
1323
  if (g.dataFormat === "rgb" || g.dataFormat === "rgba")
1318
1324
  return [0, 1];
1319
1325
  switch (g.dataType) {
@@ -1364,7 +1370,7 @@ class Rg extends YI {
1364
1370
  return "Texture";
1365
1371
  }
1366
1372
  }
1367
- class RQ {
1373
+ class NQ {
1368
1374
  gl_;
1369
1375
  textures_ = /* @__PURE__ */ new Map();
1370
1376
  currentTexture_ = null;
@@ -1653,7 +1659,7 @@ class AA {
1653
1659
  * @param max - The maximum corner.
1654
1660
  */
1655
1661
  constructor(A, I) {
1656
- this.min = A ? IB(A) : v(1 / 0, 1 / 0), this.max = I ? IB(I) : v(-1 / 0, -1 / 0);
1662
+ this.min = A ? BB(A) : v(1 / 0, 1 / 0), this.max = I ? BB(I) : v(-1 / 0, -1 / 0);
1657
1663
  }
1658
1664
  /** Returns a deep copy of the box. */
1659
1665
  clone() {
@@ -1680,7 +1686,7 @@ class AA {
1680
1686
  * @param b - The second box.
1681
1687
  */
1682
1688
  static equals(A, I) {
1683
- return gB(A.min, I.min) && gB(A.max, I.max);
1689
+ return CB(A.min, I.min) && CB(A.max, I.max);
1684
1690
  }
1685
1691
  /** Returns a copy with both corners floored componentwise. */
1686
1692
  floor() {
@@ -1695,7 +1701,7 @@ class AA {
1695
1701
  return { x: A, y: I, width: B, height: C };
1696
1702
  }
1697
1703
  }
1698
- class cQ {
1704
+ class UQ {
1699
1705
  gl_;
1700
1706
  enabledCapabilities_ = /* @__PURE__ */ new Map();
1701
1707
  depthMaskEnabled_ = null;
@@ -1823,7 +1829,7 @@ class cQ {
1823
1829
  (this.stencilFunc_ !== A || this.stencilRef_ !== I || this.stencilFuncMask_ !== B) && (this.gl_.stencilFunc(A, I, B), this.stencilFunc_ = A, this.stencilRef_ = I, this.stencilFuncMask_ = B);
1824
1830
  }
1825
1831
  }
1826
- class NQ {
1832
+ class kQ {
1827
1833
  textureUnit;
1828
1834
  gl_;
1829
1835
  framebuffer_ = null;
@@ -1874,8 +1880,8 @@ class NQ {
1874
1880
  ), B.texParameteri(B.TEXTURE_2D, B.TEXTURE_MIN_FILTER, B.NEAREST), B.texParameteri(B.TEXTURE_2D, B.TEXTURE_MAG_FILTER, B.NEAREST), B.texParameteri(B.TEXTURE_2D, B.TEXTURE_WRAP_S, B.CLAMP_TO_EDGE), B.texParameteri(B.TEXTURE_2D, B.TEXTURE_WRAP_T, B.CLAMP_TO_EDGE), C;
1875
1881
  }
1876
1882
  }
1877
- const UQ = AC($(), [1, -1, 1]);
1878
- class kQ extends dC {
1883
+ const LQ = gC(_(), [1, -1, 1]);
1884
+ class JQ extends KC {
1879
1885
  gl_;
1880
1886
  bindings_;
1881
1887
  depthTarget_;
@@ -1898,7 +1904,7 @@ class kQ extends dC {
1898
1904
  this.gl_ = I, k.info(
1899
1905
  "WebGLRenderer",
1900
1906
  `WebGL version ${I.getParameter(I.VERSION)}`
1901
- ), I.getExtension("EXT_color_buffer_float"), this.programs_ = new WC(I), this.bindings_ = new GQ(I), this.textures_ = new RQ(I), this.state_ = new cQ(I), this.depthTarget_ = new NQ(
1907
+ ), I.getExtension("EXT_color_buffer_float"), this.programs_ = new ZC(I), this.bindings_ = new FQ(I), this.textures_ = new NQ(I), this.state_ = new UQ(I), this.depthTarget_ = new kQ(
1902
1908
  I,
1903
1909
  this.textures_.reservePersistentUnit()
1904
1910
  ), this.resize(this.canvas.width, this.canvas.height);
@@ -1910,10 +1916,7 @@ class kQ extends dC {
1910
1916
  return this.textures_.textureCount;
1911
1917
  }
1912
1918
  render(A) {
1913
- this.renderedObjects_ = 0, this.renderedObjectsPerFrame_ = 0, this.stencilRef_ = 0;
1914
- for (const s of A.layers)
1915
- s.update(A);
1916
- if (getComputedStyle(A.domElement).visibility === "hidden") return;
1919
+ if (this.renderedObjects_ = 0, this.renderedObjectsPerFrame_ = 0, this.stencilRef_ = 0, getComputedStyle(A.domElement).visibility === "hidden") return;
1917
1920
  const I = A.getBoxRelativeTo(this.canvas), B = new AA(
1918
1921
  v(0, 0),
1919
1922
  v(this.width, this.height)
@@ -1998,12 +2001,12 @@ class kQ extends dC {
1998
2001
  }
1999
2002
  drawGeometry(A, I, B, C, Q) {
2000
2003
  const E = QI(
2001
- $(),
2004
+ _(),
2002
2005
  Q.viewMatrix,
2003
2006
  I.transform.matrix
2004
2007
  ), i = QI(
2005
- $(),
2006
- UQ,
2008
+ _(),
2009
+ LQ,
2007
2010
  Q.projectionMatrix
2008
2011
  ), o = this.currentViewportSize_, a = I.getUniforms(), D = {
2009
2012
  ...B.getUniforms(),
@@ -2035,7 +2038,7 @@ class kQ extends dC {
2035
2038
  C.setUniform(n, this.depthTarget_.textureUnit);
2036
2039
  break;
2037
2040
  case "u_mvpInverse": {
2038
- const F = QI($(), i, E), G = PA($(), F);
2041
+ const F = QI(_(), i, E), G = PA(_(), F);
2039
2042
  C.setUniform(n, G);
2040
2043
  break;
2041
2044
  }
@@ -2046,7 +2049,7 @@ class kQ extends dC {
2046
2049
  );
2047
2050
  break;
2048
2051
  case "u_cameraPositionModel": {
2049
- const F = PA($(), E), G = DI(0, 0, 0, 1), L = OA(
2052
+ const F = PA(_(), E), G = DI(0, 0, 0, 1), L = OA(
2050
2053
  JA(),
2051
2054
  G,
2052
2055
  F
@@ -2118,7 +2121,7 @@ function xA(g, A) {
2118
2121
  const I = g.priority ?? Number.MAX_SAFE_INTEGER, B = A.priority ?? Number.MAX_SAFE_INTEGER;
2119
2122
  return I === B ? (g.orderKey ?? Number.MAX_SAFE_INTEGER) - (A.orderKey ?? Number.MAX_SAFE_INTEGER) : I - B;
2120
2123
  }
2121
- class LQ {
2124
+ class YQ {
2122
2125
  maxConcurrent_;
2123
2126
  pending_ = [];
2124
2127
  running_ = /* @__PURE__ */ new Map();
@@ -2168,16 +2171,16 @@ class LQ {
2168
2171
  }
2169
2172
  }
2170
2173
  let tI = 0, yI = 0;
2171
- function JQ(g, A) {
2174
+ function dQ(g, A) {
2172
2175
  g.data && (tI -= g.data.byteLength, yI -= 1), g.data = A, tI += A.byteLength, yI += 1;
2173
2176
  }
2174
- function CB(g) {
2177
+ function EB(g) {
2175
2178
  g.data && (tI -= g.data.byteLength, yI -= 1), g.data = void 0, g.texture?.releaseCpuData();
2176
2179
  }
2177
- function YQ() {
2180
+ function MQ() {
2178
2181
  return { cpuChunkBytes: tI, cpuChunkCount: yI };
2179
2182
  }
2180
- function QB(g, A, I = 1e-6) {
2183
+ function iB(g, A, I = 1e-6) {
2181
2184
  return Math.abs(g - A) <= I;
2182
2185
  }
2183
2186
  const W = {
@@ -2198,7 +2201,7 @@ function YA(g) {
2198
2201
  function dA(g) {
2199
2202
  const A = M(), I = M();
2200
2203
  A[W[g.u]] = 1, I[W[g.v]] = 1;
2201
- const B = EI(M(), A, I), C = OC(
2204
+ const B = EI(M(), A, I), C = vC(
2202
2205
  A[0],
2203
2206
  A[1],
2204
2207
  A[2],
@@ -2211,7 +2214,7 @@ function dA(g) {
2211
2214
  ), Q = rg(hI(), C);
2212
2215
  return dI(Q, Q);
2213
2216
  }
2214
- const EB = [
2217
+ const oB = [
2215
2218
  Int8Array,
2216
2219
  Int16Array,
2217
2220
  Int32Array,
@@ -2220,32 +2223,32 @@ const EB = [
2220
2223
  Uint32Array,
2221
2224
  Float32Array
2222
2225
  ];
2223
- function dQ(g) {
2224
- if (EB.some((I) => g instanceof I))
2226
+ function KQ(g) {
2227
+ if (oB.some((I) => g instanceof I))
2225
2228
  return !0;
2226
- const A = EB.map((I) => I.name);
2229
+ const A = oB.map((I) => I.name);
2227
2230
  return k.debug(
2228
2231
  "Chunk",
2229
2232
  `Unsupported chunk data type: ${g}. Supported data types: ${A}`
2230
2233
  ), !1;
2231
2234
  }
2232
- function MQ(g, A) {
2235
+ function HQ(g, A) {
2233
2236
  return Math.round((A - g.translation) / g.scale);
2234
2237
  }
2235
- function CC(g, A) {
2238
+ function EC(g, A) {
2236
2239
  const I = M(), B = M();
2237
2240
  for (const Q of ["x", "y", "z"]) {
2238
2241
  const E = Q === A.w ? 0.5 * g.scale[Q] : 0, i = W[Q];
2239
2242
  I[i] = 1 / (g.scale[Q] * g.shape[Q]), B[i] = E - g.offset[Q];
2240
2243
  }
2241
- const C = AC($(), I);
2242
- return VC(C, C, B);
2244
+ const C = gC(_(), I);
2245
+ return XC(C, C, B);
2243
2246
  }
2244
2247
  function hA(g, A, I) {
2245
2248
  return Math.max(A, Math.min(I, g));
2246
2249
  }
2247
- const MI = Symbol("INTERNAL_POLICY_KEY"), QC = 1e-6;
2248
- class KQ {
2250
+ const MI = Symbol("INTERNAL_POLICY_KEY"), iC = 1e-6;
2251
+ class qQ {
2249
2252
  store_;
2250
2253
  policy_;
2251
2254
  policyChanged_ = !1;
@@ -2273,7 +2276,7 @@ class KQ {
2273
2276
  `Source is missing dimensions for slice plane axes "${this.axes_.u}" and "${this.axes_.v}"`
2274
2277
  );
2275
2278
  const i = Q.lods[0], o = E.lods[0];
2276
- this.scale0_ = i.scale, this.sourceMaxSquareDistance2D_ = yQ(
2279
+ this.scale0_ = i.scale, this.sourceMaxSquareDistance2D_ = nQ(
2277
2280
  v(i.size * i.scale, o.size * o.scale)
2278
2281
  );
2279
2282
  }
@@ -2312,7 +2315,7 @@ class KQ {
2312
2315
  return A;
2313
2316
  }
2314
2317
  residentChunksForSlice() {
2315
- const A = this.timeIndex(this.lastTCoord_), I = new Set(this.channelsOfInterest(this.lastCCoords_)), { min: B, max: C } = this.lodRange(), Q = new iB(
2318
+ const A = this.timeIndex(this.lastTCoord_), I = new Set(this.channelsOfInterest(this.lastCCoords_)), { min: B, max: C } = this.lodRange(), Q = new aB(
2316
2319
  this.axes_,
2317
2320
  this.lastSliceCoordW_,
2318
2321
  this.lastViewBounds2D_,
@@ -2333,11 +2336,11 @@ class KQ {
2333
2336
  ), this.mode_ = null, this.chunkViewStates_.forEach(TA);
2334
2337
  return;
2335
2338
  }
2336
- const D = BC();
2337
- eQ(D, B.min, B.max, 0.5);
2339
+ const D = QC();
2340
+ GQ(D, B.min, B.max, 0.5);
2338
2341
  const h = this.makeViewBounds3D(B, o);
2339
2342
  this.chunkViewStates_.forEach(TA);
2340
- const t = this.channelsOfInterest(A.c), e = this.lodRange().max, n = this.getPaddedBounds(h), F = new iB(
2343
+ const t = this.channelsOfInterest(A.c), e = this.lodRange().max, n = this.getPaddedBounds(h), F = new aB(
2341
2344
  this.axes_,
2342
2345
  A[this.axes_.w],
2343
2346
  B,
@@ -2537,7 +2540,7 @@ class KQ {
2537
2540
  }
2538
2541
  timeIndex(A) {
2539
2542
  const I = this.store_.dimensions.t;
2540
- return A === void 0 || I === void 0 ? 0 : MQ(I.lods[0], A);
2543
+ return A === void 0 || I === void 0 ? 0 : HQ(I.lods[0], A);
2541
2544
  }
2542
2545
  getSliceAxisBounds(A) {
2543
2546
  const I = this.store_.dimensions[this.axes_.w];
@@ -2562,10 +2565,10 @@ class KQ {
2562
2565
  return B[W[this.axes_.u]] = A.min[0], C[W[this.axes_.u]] = A.max[0], B[W[this.axes_.v]] = A.min[1], C[W[this.axes_.v]] = A.max[1], B[W[this.axes_.w]] = I[0], C[W[this.axes_.w]] = I[1], new VA(B, C);
2563
2566
  }
2564
2567
  viewBounds2DChanged(A) {
2565
- return this.lastViewBounds2D_ === null || !BB(this.lastViewBounds2D_.min, A.min) || !BB(this.lastViewBounds2D_.max, A.max);
2568
+ return this.lastViewBounds2D_ === null || !QB(this.lastViewBounds2D_.min, A.min) || !QB(this.lastViewBounds2D_.max, A.max);
2566
2569
  }
2567
2570
  hasViewProjectionChanged(A) {
2568
- return this.lastViewProjection_ === null || !AQ(this.lastViewProjection_, A);
2571
+ return this.lastViewProjection_ === null || !gQ(this.lastViewProjection_, A);
2569
2572
  }
2570
2573
  cCoordsChanged(A) {
2571
2574
  return !this.lastCCoords_ && !A ? !1 : !this.lastCCoords_ || !A || this.lastCCoords_.length !== A.length ? !0 : !this.lastCCoords_.every((I, B) => I === A[B]);
@@ -2585,7 +2588,7 @@ class KQ {
2585
2588
  return E * E + i * i;
2586
2589
  }
2587
2590
  }
2588
- class iB {
2591
+ class aB {
2589
2592
  axes_;
2590
2593
  viewRect_;
2591
2594
  chunkRect_ = new AA();
@@ -2605,10 +2608,10 @@ class iB {
2605
2608
  }
2606
2609
  }
2607
2610
  function TI(g) {
2608
- return Math.floor(g + QC);
2611
+ return Math.floor(g + iC);
2609
2612
  }
2610
2613
  function xI(g) {
2611
- return Math.ceil(g - QC);
2614
+ return Math.ceil(g - iC);
2612
2615
  }
2613
2616
  function WI(g, A) {
2614
2617
  return g.offset[A] + g.shape[A] * g.scale[A];
@@ -2616,7 +2619,7 @@ function WI(g, A) {
2616
2619
  function TA(g) {
2617
2620
  g.visible = !1, g.prefetch = !1, g.priority = null, g.orderKey = null;
2618
2621
  }
2619
- class HQ {
2622
+ class lQ {
2620
2623
  // Chunks indexed as chunks_[lod][t][c][z][y][x].
2621
2624
  chunks_;
2622
2625
  lowestResLOD_;
@@ -2697,7 +2700,7 @@ class HQ {
2697
2700
  return this.lowestResLOD_;
2698
2701
  }
2699
2702
  addView(A, I) {
2700
- const B = new KQ(this, A, I);
2703
+ const B = new qQ(this, A, I);
2701
2704
  return this.views_.push(B), this.hasHadViews_ = !0, B;
2702
2705
  }
2703
2706
  get views() {
@@ -2745,7 +2748,7 @@ class HQ {
2745
2748
  const A = this.dimensions_.x, I = this.dimensions_.y;
2746
2749
  for (let B = 1; B < this.dimensions_.numLods; B++) {
2747
2750
  const C = A.lods[B].scale / A.lods[B - 1].scale, Q = I.lods[B].scale / I.lods[B - 1].scale;
2748
- if (!QB(C, 2, 0.02) || !QB(Q, 2, 0.02))
2751
+ if (!iB(C, 2, 0.02) || !iB(Q, 2, 0.02))
2749
2752
  throw new Error(
2750
2753
  `Invalid downsampling factor between levels ${B - 1} → ${B}: expected (2× in X and Y), but got (${C.toFixed(2)}×, ${Q.toFixed(2)}×) from scale [${A.lods[B - 1].scale}, ${I.lods[B - 1].scale}] → [${A.lods[B].scale}, ${I.lods[B].scale}]`
2751
2754
  );
@@ -2787,7 +2790,7 @@ class HQ {
2787
2790
  };
2788
2791
  }
2789
2792
  }
2790
- function qQ(g, A) {
2793
+ function fQ(g, A) {
2791
2794
  const I = A.dimensions.t?.lods[0].size ?? 1, B = {
2792
2795
  requested: new Uint32Array(I),
2793
2796
  resident: new Uint32Array(I)
@@ -2796,20 +2799,20 @@ function qQ(g, A) {
2796
2799
  const E = A.views;
2797
2800
  for (let i = 0; i < E.length; i++)
2798
2801
  for (const [o, a] of E[i].chunkViewStates) {
2799
- if (a.priority === null || lQ(o, E, i)) continue;
2802
+ if (a.priority === null || pQ(o, E, i)) continue;
2800
2803
  const s = o.chunkIndex.t;
2801
2804
  C += 1, B.requested[s] += 1, o.texture !== void 0 && (Q += 1, B.resident[s] += 1);
2802
2805
  }
2803
2806
  return { source: g, requested: C, resident: Q, timepoints: B };
2804
2807
  }
2805
- function lQ(g, A, I) {
2808
+ function pQ(g, A, I) {
2806
2809
  for (let B = 0; B < I; B++) {
2807
2810
  const C = A[B].chunkViewStates.get(g);
2808
2811
  if (C !== void 0 && C.priority !== null) return !0;
2809
2812
  }
2810
2813
  return !1;
2811
2814
  }
2812
- function fQ(g, A) {
2815
+ function uQ(g, A) {
2813
2816
  let I = 0, B = 0;
2814
2817
  const C = { requested: 0, resident: 0 };
2815
2818
  for (const Q of A) {
@@ -2856,8 +2859,8 @@ class cg extends Rg {
2856
2859
  return B.unpackAlignment = A.rowAlignmentBytes, B;
2857
2860
  }
2858
2861
  }
2859
- const pQ = 8, uQ = 4;
2860
- class mQ {
2862
+ const mQ = 8, TQ = 4;
2863
+ class xQ {
2861
2864
  stores_ = [];
2862
2865
  queue_;
2863
2866
  uploadTexture_;
@@ -2865,8 +2868,8 @@ class mQ {
2865
2868
  getGpuResidentBytes_;
2866
2869
  memoryLimitBytes_;
2867
2870
  maxGpuUploadsPerUpdate_;
2868
- constructor(A, I, B = () => 0, C = 1 / 0, Q = pQ, E = uQ) {
2869
- this.uploadTexture_ = A, this.disposeTexture_ = I, this.getGpuResidentBytes_ = B, this.memoryLimitBytes_ = C, this.maxGpuUploadsPerUpdate_ = Math.max(1, E), this.queue_ = new LQ(Q);
2871
+ constructor(A, I, B = () => 0, C = 1 / 0, Q = mQ, E = TQ) {
2872
+ this.uploadTexture_ = A, this.disposeTexture_ = I, this.getGpuResidentBytes_ = B, this.memoryLimitBytes_ = C, this.maxGpuUploadsPerUpdate_ = Math.max(1, E), this.queue_ = new YQ(Q);
2870
2873
  }
2871
2874
  get memoryLimitBytes() {
2872
2875
  return this.memoryLimitBytes_;
@@ -2881,16 +2884,16 @@ class mQ {
2881
2884
  };
2882
2885
  }
2883
2886
  get memoryStats() {
2884
- return YQ();
2887
+ return MQ();
2885
2888
  }
2886
2889
  get sourceChunkStats() {
2887
2890
  return this.stores_.map(
2888
- ({ source: A, store: I }) => qQ(A, I)
2891
+ ({ source: A, store: I }) => fQ(A, I)
2889
2892
  );
2890
2893
  }
2891
2894
  addView(A, I, B) {
2892
2895
  let C = this.stores_.find((Q) => Q.source === A)?.store;
2893
- return C || (C = new HQ(A.loader.getSourceDimensionMap()), this.stores_.push({ source: A, store: C })), C.addView(I, B);
2896
+ return C || (C = new lQ(A.loader.getSourceDimensionMap()), this.stores_.push({ source: A, store: C })), C.addView(I, B);
2894
2897
  }
2895
2898
  update() {
2896
2899
  const A = [];
@@ -2915,7 +2918,7 @@ class mQ {
2915
2918
  A.releasedAt ??= performance.now();
2916
2919
  return;
2917
2920
  }
2918
- CB(A), A.state === "loaded" && (A.state = "unloaded");
2921
+ EB(A), A.state === "loaded" && (A.state = "unloaded");
2919
2922
  }
2920
2923
  enqueueWithinBudget(A) {
2921
2924
  if (A.length === 0) return;
@@ -2971,7 +2974,7 @@ class mQ {
2971
2974
  const C = Math.min(B.length, this.maxGpuUploadsPerUpdate_);
2972
2975
  for (let Q = 0; Q < C; Q++) {
2973
2976
  const E = B[Q], i = cg.createWithChunk(E);
2974
- this.uploadTexture_(i), A.setChunkTexture(E, i), CB(E);
2977
+ this.uploadTexture_(i), A.setChunkTexture(E, i), EB(E);
2975
2978
  }
2976
2979
  }
2977
2980
  disposeChunkTexture(A, I) {
@@ -2980,28 +2983,16 @@ class mQ {
2980
2983
  }
2981
2984
  }
2982
2985
  class KI {
2983
- /**
2984
- * How the layer's output blends with previously drawn content. Also
2985
- * applies to blending between objects within the layer.
2986
- */
2987
- blendMode;
2988
- /**
2989
- * Whether the layer writes depth and hides content drawn behind it.
2990
- *
2991
- * Occluding layers render a depth pass and always draw before
2992
- * non-occluding layers regardless of their order in the viewport. When
2993
- * not set explicitly this value is inferred from `blendMode` at
2994
- * construction only. Reassigning {@link blendMode} later does not update
2995
- * it.
2996
- */
2997
- occludes;
2998
2986
  /** Set to `true` by subclasses whose shaders read scene depth. */
2999
2987
  requiresSceneDepth_ = !1;
3000
2988
  coverageGroups_ = /* @__PURE__ */ new Map();
3001
2989
  state_ = "initialized";
3002
2990
  attached_ = !1;
3003
2991
  callbacks_ = [];
2992
+ renderStateChanged_ = !0;
3004
2993
  opacity_;
2994
+ blendMode_;
2995
+ occludes_;
3005
2996
  /**
3006
2997
  * Creates a layer with the given presentation state.
3007
2998
  *
@@ -3012,7 +3003,7 @@ class KI {
3012
3003
  blendMode: I = "none",
3013
3004
  occludes: B
3014
3005
  } = {}) {
3015
- this.opacity_ = hA(A, 0, 1), this.blendMode = I, this.occludes = B ?? I === "none";
3006
+ this.opacity_ = hA(A, 0, 1), this.blendMode_ = I, this.occludes_ = B ?? I === "none";
3016
3007
  }
3017
3008
  /**
3018
3009
  * Whether the layer's shaders read scene depth. When `true` the renderer
@@ -3022,6 +3013,31 @@ class KI {
3022
3013
  get requiresSceneDepth() {
3023
3014
  return this.requiresSceneDepth_;
3024
3015
  }
3016
+ /**
3017
+ * How the layer's output blends with previously drawn content.
3018
+ */
3019
+ get blendMode() {
3020
+ return this.blendMode_;
3021
+ }
3022
+ /** @param value - The blending mode to use. */
3023
+ set blendMode(A) {
3024
+ A !== this.blendMode_ && (this.blendMode_ = A, this.invalidate());
3025
+ }
3026
+ /**
3027
+ * Whether the layer writes depth and hides content drawn behind it.
3028
+ *
3029
+ * Occluding layers render a depth pass and always draw before
3030
+ * non-occluding layers regardless of their order in the viewport. When
3031
+ * not set explicitly this value is inferred from `blendMode` at
3032
+ * construction only. Reassigning {@link blendMode} later does not update it.
3033
+ */
3034
+ get occludes() {
3035
+ return this.occludes_;
3036
+ }
3037
+ /** @param value - Whether the layer writes depth. */
3038
+ set occludes(A) {
3039
+ A !== this.occludes_ && (this.occludes_ = A, this.invalidate());
3040
+ }
3025
3041
  /** The layer's opacity in `[0, 1]`. Values outside are clamped. */
3026
3042
  get opacity() {
3027
3043
  return this.opacity_;
@@ -3031,7 +3047,21 @@ class KI {
3031
3047
  (A < 0 || A > 1) && k.warn(
3032
3048
  "Layer",
3033
3049
  `Opacity out of bounds: ${A} — clamping to [0.0, 1.0]`
3034
- ), this.opacity_ = hA(A, 0, 1);
3050
+ );
3051
+ const I = hA(A, 0, 1);
3052
+ I !== this.opacity_ && (this.opacity_ = I, this.invalidate());
3053
+ }
3054
+ /**
3055
+ * Marks the layer's rendered output as changed. Call from setters or
3056
+ * asynchronous callbacks when a change happens outside {@link update}.
3057
+ * The runtime checks this flag on its next update.
3058
+ */
3059
+ invalidate() {
3060
+ this.renderStateChanged_ = !0;
3061
+ }
3062
+ /** @hidden */
3063
+ renderStateChanged() {
3064
+ return this.renderStateChanged_ ? (this.renderStateChanged_ = !1, !0) : !1;
3035
3065
  }
3036
3066
  /**
3037
3067
  * Handles a pointer or wheel event from the owning viewport. Called
@@ -3115,7 +3145,7 @@ class KI {
3115
3145
  */
3116
3146
  setState(A) {
3117
3147
  const I = this.state_;
3118
- this.state_ = A, this.callbacks_.forEach((B) => B(A, I));
3148
+ this.state_ = A, A !== I && this.invalidate(), this.callbacks_.forEach((B) => B(A, I));
3119
3149
  }
3120
3150
  /**
3121
3151
  * Registers a renderable object for drawing. Objects in the same
@@ -3140,7 +3170,7 @@ class KI {
3140
3170
  return {};
3141
3171
  }
3142
3172
  }
3143
- const EC = [
3173
+ const oC = [
3144
3174
  "fallbackVisible",
3145
3175
  "prefetchTime",
3146
3176
  "visibleCurrent",
@@ -3160,7 +3190,7 @@ function Ng(g = {}) {
3160
3190
  ]
3161
3191
  }, g));
3162
3192
  }
3163
- function co(g = {}) {
3193
+ function Uo(g = {}) {
3164
3194
  return Ug(kg({
3165
3195
  profile: "playback",
3166
3196
  prefetch: { x: 0, y: 0, z: 0, t: 20 },
@@ -3173,7 +3203,7 @@ function co(g = {}) {
3173
3203
  ]
3174
3204
  }, g));
3175
3205
  }
3176
- function No(g = {}) {
3206
+ function ko(g = {}) {
3177
3207
  return Ug(kg({
3178
3208
  profile: "no-prefetch",
3179
3209
  prefetch: { x: 0, y: 0, z: 0, t: 0 },
@@ -3187,14 +3217,14 @@ function No(g = {}) {
3187
3217
  }, g));
3188
3218
  }
3189
3219
  function Ug(g) {
3190
- TQ(g);
3220
+ WQ(g);
3191
3221
  const A = {
3192
3222
  x: g.prefetch.x,
3193
3223
  y: g.prefetch.y,
3194
3224
  z: g.prefetch.z ?? 0,
3195
3225
  t: g.prefetch.t ?? 0
3196
3226
  }, I = Object.freeze(
3197
- EC.reduce(
3227
+ oC.reduce(
3198
3228
  (Q, E) => {
3199
3229
  const i = g.priorityOrder.indexOf(E);
3200
3230
  return Q[E] = i, Q;
@@ -3214,7 +3244,7 @@ function Ug(g) {
3214
3244
  };
3215
3245
  return Object.freeze(C);
3216
3246
  }
3217
- function TQ(g) {
3247
+ function WQ(g) {
3218
3248
  for (const [B, C] of Object.entries(g.prefetch))
3219
3249
  if (C !== void 0 && C < 0)
3220
3250
  throw new Error(`prefetch.${B} must be a non-negative number`);
@@ -3222,7 +3252,7 @@ function TQ(g) {
3222
3252
  if (A?.min !== void 0 && A?.max !== void 0 && A.min > A.max)
3223
3253
  throw new Error("lod.min must be <= lod.max");
3224
3254
  const I = g.priorityOrder;
3225
- if (I.length !== EC.length || new Set(I).size !== I.length)
3255
+ if (I.length !== oC.length || new Set(I).size !== I.length)
3226
3256
  throw new Error("priorityOrder must include all categories exactly once");
3227
3257
  }
3228
3258
  function kg(g, A = {}) {
@@ -3336,9 +3366,9 @@ class T {
3336
3366
  return I.length === 1 ? "0" + I : I;
3337
3367
  }
3338
3368
  }
3339
- const oB = 32;
3369
+ const sB = 32;
3340
3370
  function vA(g, { visible: A, color: I, contrastLimits: B, opacity: C }) {
3341
- return A ??= !0, I = I === void 0 ? T.WHITE : T.from(I), C = C === void 0 ? 1 : hA(C, 0, 1), g !== null ? B = xQ(B, g) : B === void 0 && (k.debug(
3371
+ return A ??= !0, I = I === void 0 ? T.WHITE : T.from(I), C = C === void 0 ? 1 : hA(C, 0, 1), g !== null ? B = bQ(B, g) : B === void 0 && (k.debug(
3342
3372
  "Channel",
3343
3373
  "No texture provided, defaulting channel contrast limits to [0, 1]."
3344
3374
  ), B = [0, 1]), {
@@ -3349,26 +3379,26 @@ function vA(g, { visible: A, color: I, contrastLimits: B, opacity: C }) {
3349
3379
  };
3350
3380
  }
3351
3381
  function Bg(g, A) {
3352
- if (A.length > oB)
3353
- throw new Error(`Maximum number of channels is ${oB}`);
3382
+ if (A.length > sB)
3383
+ throw new Error(`Maximum number of channels is ${sB}`);
3354
3384
  return A.map((I) => vA(g, I));
3355
3385
  }
3356
- function iC(g, A) {
3386
+ function aC(g, A) {
3357
3387
  if (g && g.length !== A)
3358
3388
  throw new Error(
3359
3389
  `channelProps length (${g.length}) must match source channel count (${A}).`
3360
3390
  );
3361
3391
  }
3362
- function xQ(g, A) {
3392
+ function bQ(g, A) {
3363
3393
  if (g === void 0)
3364
- return SQ(A);
3394
+ return cQ(A);
3365
3395
  if (g[1] <= g[0])
3366
3396
  throw new Error(
3367
3397
  `Contrast limits must be strictly increasing: ${g}.`
3368
3398
  );
3369
3399
  return g;
3370
3400
  }
3371
- class WQ extends pA {
3401
+ class ZQ extends pA {
3372
3402
  constructor(A) {
3373
3403
  if (super(), A.primitive != "triangles") {
3374
3404
  k.warn("WireframeGeometry", "Only indexed geometries are supported");
@@ -3393,10 +3423,10 @@ class WQ extends pA {
3393
3423
  this.indexData_ = new Uint32Array(B);
3394
3424
  }
3395
3425
  }
3396
- const bQ = x(0, 1, 0);
3397
- class oC {
3426
+ const PQ = x(0, 1, 0);
3427
+ class sC {
3398
3428
  dirty_ = !0;
3399
- matrix_ = $();
3429
+ matrix_ = _();
3400
3430
  rotation_ = hI();
3401
3431
  translation_ = M();
3402
3432
  scale_ = x(1, 1, 1);
@@ -3406,7 +3436,7 @@ class oC {
3406
3436
  * @param q - The rotation to apply.
3407
3437
  */
3408
3438
  addRotation(A) {
3409
- sQ(this.rotation_, this.rotation_, A), this.dirty_ = !0;
3439
+ hQ(this.rotation_, this.rotation_, A), this.dirty_ = !0;
3410
3440
  }
3411
3441
  /**
3412
3442
  * Replaces the rotation with the given quaternion.
@@ -3414,11 +3444,11 @@ class oC {
3414
3444
  * @param q - The new rotation.
3415
3445
  */
3416
3446
  setRotation(A) {
3417
- hQ(this.rotation_, A), this.dirty_ = !0;
3447
+ yQ(this.rotation_, A), this.dirty_ = !0;
3418
3448
  }
3419
3449
  /** A copy of the rotation quaternion. */
3420
3450
  get rotation() {
3421
- return DQ(this.rotation_);
3451
+ return tQ(this.rotation_);
3422
3452
  }
3423
3453
  /**
3424
3454
  * Adds the given offset to the translation.
@@ -3446,7 +3476,7 @@ class oC {
3446
3476
  * @param vec - The scale factors to apply.
3447
3477
  */
3448
3478
  addScale(A) {
3449
- IQ(this.scale_, this.scale_, A), this.dirty_ = !0;
3479
+ BQ(this.scale_, this.scale_, A), this.dirty_ = !0;
3450
3480
  }
3451
3481
  /**
3452
3482
  * Replaces the scale with the given vector.
@@ -3464,7 +3494,7 @@ class oC {
3464
3494
  */
3465
3495
  targetTo(A) {
3466
3496
  Fg(this.translation_, A) && (A = EA(A), A[2] += m);
3467
- const I = $C($(), this.translation_, A, bQ), B = PC($B(), I);
3497
+ const I = IQ(_(), this.translation_, A, PQ), B = VC(IC(), I);
3468
3498
  rg(this.rotation_, B), dI(this.rotation_, this.rotation_), this.dirty_ = !0;
3469
3499
  }
3470
3500
  /** A copy of the scale vector. */
@@ -3477,10 +3507,10 @@ class oC {
3477
3507
  }
3478
3508
  /** The inverse of the composed transform matrix. */
3479
3509
  get inverse() {
3480
- return PA($(), this.matrix);
3510
+ return PA(_(), this.matrix);
3481
3511
  }
3482
3512
  computeMatrix() {
3483
- vC(
3513
+ jC(
3484
3514
  this.matrix_,
3485
3515
  this.rotation_,
3486
3516
  this.translation_,
@@ -3503,7 +3533,7 @@ class zA extends YI {
3503
3533
  depthTest = !0;
3504
3534
  textures_ = [];
3505
3535
  staleTextures_ = [];
3506
- transform_ = new oC();
3536
+ transform_ = new sC();
3507
3537
  geometry_ = new pA();
3508
3538
  wireframeGeometry_ = null;
3509
3539
  programName_ = null;
@@ -3559,7 +3589,7 @@ class zA extends YI {
3559
3589
  * changes.
3560
3590
  */
3561
3591
  get wireframeGeometry() {
3562
- return this.wireframeGeometry_ ??= new WQ(this.geometry), this.wireframeGeometry_;
3592
+ return this.wireframeGeometry_ ??= new ZQ(this.geometry), this.wireframeGeometry_;
3563
3593
  }
3564
3594
  /** The assigned textures indexed by texture unit. */
3565
3595
  get textures() {
@@ -3632,7 +3662,7 @@ class zA extends YI {
3632
3662
  return {};
3633
3663
  }
3634
3664
  }
3635
- class aC extends pA {
3665
+ class DC extends pA {
3636
3666
  constructor(A, I, B, C) {
3637
3667
  super();
3638
3668
  const Q = [], E = [], i = B, o = C, a = i + 1, s = o + 1, D = A / i, h = I / o;
@@ -3663,12 +3693,12 @@ class aC extends pA {
3663
3693
  });
3664
3694
  }
3665
3695
  }
3666
- class ZQ extends zA {
3696
+ class OQ extends zA {
3667
3697
  /**
3668
3698
  * A matrix mapping world space to the texture's normalized coordinate
3669
3699
  * space. Layers derive it from the chunk's offset, scale, and shape.
3670
3700
  */
3671
- worldToTexCoord = $();
3701
+ worldToTexCoord = _();
3672
3702
  channels_;
3673
3703
  /**
3674
3704
  * Creates an image renderable drawing the given texture. The texture's
@@ -3682,7 +3712,7 @@ class ZQ extends zA {
3682
3712
  texture: B,
3683
3713
  channelProps: C = []
3684
3714
  }) {
3685
- super(), this.geometry = new aC(A, I, 1, 1), this.setTexture(0, B), this.channels_ = Bg(B, C), this.programName = PQ(B), this.depthProgramName = "meshDepth";
3715
+ super(), this.geometry = new DC(A, I, 1, 1), this.setTexture(0, B), this.channels_ = Bg(B, C), this.programName = VQ(B), this.depthProgramName = "meshDepth";
3686
3716
  }
3687
3717
  /** Identifies the renderable type as `ImageRenderable`. */
3688
3718
  get type() {
@@ -3731,7 +3761,7 @@ class ZQ extends zA {
3731
3761
  };
3732
3762
  }
3733
3763
  }
3734
- function PQ(g) {
3764
+ function VQ(g) {
3735
3765
  switch (g.dataType) {
3736
3766
  case "byte":
3737
3767
  case "int":
@@ -3768,7 +3798,7 @@ class sA {
3768
3798
  }
3769
3799
  }
3770
3800
  }
3771
- function sC(g, A, I, B, C = 3) {
3801
+ function hC(g, A, I, B, C = 3) {
3772
3802
  switch (g.type) {
3773
3803
  case "pointerdown": {
3774
3804
  const Q = g.event;
@@ -3777,7 +3807,7 @@ function sC(g, A, I, B, C = 3) {
3777
3807
  case "pointerup": {
3778
3808
  if (!A) return A;
3779
3809
  const Q = g.event, E = v(Q.clientX, Q.clientY);
3780
- if (tQ(A, E) < C) {
3810
+ if (eQ(A, E) < C) {
3781
3811
  if (!B) return null;
3782
3812
  const o = g.worldRay;
3783
3813
  return o && I(o).then((a) => {
@@ -3860,7 +3890,7 @@ class Jg extends KI {
3860
3890
  this.source_,
3861
3891
  this.policy_,
3862
3892
  this.axes_
3863
- ), iC(
3893
+ ), aC(
3864
3894
  this.channelProps_,
3865
3895
  this.chunkStoreView_.channelCount
3866
3896
  );
@@ -3875,7 +3905,7 @@ class Jg extends KI {
3875
3905
  * @param viewport - The viewport being rendered.
3876
3906
  */
3877
3907
  update(A) {
3878
- if (!A || !this.chunkStoreView_) return;
3908
+ if (!A || !this.chunkStoreView_) return !0;
3879
3909
  const I = A.camera, B = I.type === "OrthographicCamera" ? I.getWorldViewRect() : this.chunkStoreView_.getWholePlaneRect();
3880
3910
  this.chunkStoreView_.updateChunksForImage(this.sliceCoords_, {
3881
3911
  worldViewRect: B,
@@ -3883,6 +3913,7 @@ class Jg extends KI {
3883
3913
  }), this.updateChunks();
3884
3914
  for (const [C, Q] of this.visibleChunks_)
3885
3915
  this.updateSlicePosition(Q, C);
3916
+ return !0;
3886
3917
  }
3887
3918
  /** The slice plane the layer displays. */
3888
3919
  get orientation() {
@@ -3943,7 +3974,7 @@ class Jg extends KI {
3943
3974
  * @param event - The event with clip and world coordinates attached.
3944
3975
  */
3945
3976
  onEvent(A) {
3946
- this.pointerDownPos_ = sC(
3977
+ this.pointerDownPos_ = hC(
3947
3978
  A,
3948
3979
  this.pointerDownPos_,
3949
3980
  (I) => this.pickAtRay(I),
@@ -3953,7 +3984,7 @@ class Jg extends KI {
3953
3984
  async pickAtRay(A) {
3954
3985
  const I = this.visibleChunks_.values().next();
3955
3986
  if (I.done) return null;
3956
- const B = I.value.transform, C = gC(
3987
+ const B = I.value.transform, C = CC(
3957
3988
  M(),
3958
3989
  x(0, 0, 1),
3959
3990
  B.rotation
@@ -4004,7 +4035,7 @@ class Jg extends KI {
4004
4035
  return this.channelProps_ ? [this.channelProps_[A.chunkIndex.c] ?? {}] : [{}];
4005
4036
  }
4006
4037
  createImage(A, I) {
4007
- const B = new ZQ({
4038
+ const B = new OQ({
4008
4039
  width: A.shape[this.axes_.u],
4009
4040
  height: A.shape[this.axes_.v],
4010
4041
  texture: I,
@@ -4026,7 +4057,7 @@ class Jg extends KI {
4026
4057
  updateImageChunk(A, I) {
4027
4058
  this.debugMode_ ? (A.wireframeEnabled = !0, A.wireframeColor = this.wireframeColors_[I.lod % this.wireframeColors_.length]) : A.wireframeEnabled = !1;
4028
4059
  const { u: B, v: C } = this.axes_;
4029
- A.transform.setScale([I.scale[B], I.scale[C], 1]), A.transform.setRotation(this.planeRotation_), this.updateSlicePosition(A, I), A.worldToTexCoord = CC(I, this.axes_);
4060
+ A.transform.setScale([I.scale[B], I.scale[C], 1]), A.transform.setRotation(this.planeRotation_), this.updateSlicePosition(A, I), A.worldToTexCoord = EC(I, this.axes_);
4030
4061
  }
4031
4062
  /**
4032
4063
  * Reads the data value at a world position from the resident chunks.
@@ -4122,7 +4153,7 @@ function eI(g, A) {
4122
4153
  `align${g.rowAlignmentBytes}`
4123
4154
  ].join(":");
4124
4155
  }
4125
- class aB extends Rg {
4156
+ class DB extends Rg {
4126
4157
  width_;
4127
4158
  height_;
4128
4159
  constructor(A, I, B) {
@@ -4138,7 +4169,7 @@ class aB extends Rg {
4138
4169
  return this.height_;
4139
4170
  }
4140
4171
  }
4141
- const OQ = [
4172
+ const vQ = [
4142
4173
  [1, 0.5, 0.5],
4143
4174
  [0.5, 1, 0.5],
4144
4175
  [0.5, 0.5, 1],
@@ -4146,7 +4177,7 @@ const OQ = [
4146
4177
  [1, 0.5, 1],
4147
4178
  [1, 1, 0.5]
4148
4179
  ];
4149
- function VQ(g) {
4180
+ function XQ(g) {
4150
4181
  return g = g ?? /* @__PURE__ */ new Map(), new Map(
4151
4182
  Array.from(g.entries()).map(([A, I]) => [
4152
4183
  A,
@@ -4154,40 +4185,40 @@ function VQ(g) {
4154
4185
  ])
4155
4186
  );
4156
4187
  }
4157
- function vQ(g) {
4158
- return g = g ?? OQ, g.map(T.from);
4188
+ function jQ(g) {
4189
+ return g = g ?? vQ, g.map(T.from);
4159
4190
  }
4160
4191
  function nI(g = {}) {
4161
4192
  return {
4162
- lookupTable: VQ(g.lookupTable),
4163
- cycle: vQ(g.cycle)
4193
+ lookupTable: XQ(g.lookupTable),
4194
+ cycle: jQ(g.cycle)
4164
4195
  };
4165
4196
  }
4166
- const DC = /* @__PURE__ */ new Set(["byte", "short", "int"]), XQ = /* @__PURE__ */ new Set([
4197
+ const tC = /* @__PURE__ */ new Set(["byte", "short", "int"]), zQ = /* @__PURE__ */ new Set([
4167
4198
  "unsigned_byte",
4168
4199
  "unsigned_short",
4169
4200
  "unsigned_int"
4170
4201
  ]);
4171
- function jQ(g) {
4202
+ function _Q(g) {
4172
4203
  if (g.dataFormat !== "scalar")
4173
4204
  throw new Error(
4174
4205
  `Image data format must be scalar, instead found: ${g.dataFormat}`
4175
4206
  );
4176
- if (!DC.has(g.dataType) && !XQ.has(g.dataType))
4207
+ if (!tC.has(g.dataType) && !zQ.has(g.dataType))
4177
4208
  throw new Error(
4178
4209
  `Image data type must be an integer, instead found: ${g.dataType}`
4179
4210
  );
4180
4211
  return g;
4181
4212
  }
4182
- function zQ(g) {
4183
- return DC.has(g.dataType) ? "intLabelImage" : "labelImage";
4213
+ function $Q(g) {
4214
+ return tC.has(g.dataType) ? "intLabelImage" : "labelImage";
4184
4215
  }
4185
- class _Q extends zA {
4216
+ class AE extends zA {
4186
4217
  /**
4187
4218
  * A matrix mapping world space to the texture's normalized coordinate
4188
4219
  * space. Layers derive it from the chunk's offset, scale, and shape.
4189
4220
  */
4190
- worldToTexCoord = $();
4221
+ worldToTexCoord = _();
4191
4222
  outlineSelected_;
4192
4223
  selectedValue_;
4193
4224
  /**
@@ -4197,9 +4228,9 @@ class _Q extends zA {
4197
4228
  * @param props - Initialization properties.
4198
4229
  */
4199
4230
  constructor(A) {
4200
- super(), this.geometry = new aC(A.width, A.height, 1, 1), this.setTexture(0, jQ(A.imageData));
4231
+ super(), this.geometry = new DC(A.width, A.height, 1, 1), this.setTexture(0, _Q(A.imageData));
4201
4232
  const I = nI(A.colorMap);
4202
- this.setTexture(1, this.makeColorCycleTexture(I.cycle)), this.setTexture(2, this.makeColorLookupTableTexture(I.lookupTable)), this.outlineSelected_ = A.outlineSelected ?? !1, this.selectedValue_ = A.selectedValue ?? null, this.programName = zQ(A.imageData), this.depthProgramName = "meshDepth";
4233
+ this.setTexture(1, this.makeColorCycleTexture(I.cycle)), this.setTexture(2, this.makeColorLookupTableTexture(I.lookupTable)), this.outlineSelected_ = A.outlineSelected ?? !1, this.selectedValue_ = A.selectedValue ?? null, this.programName = $Q(A.imageData), this.depthProgramName = "meshDepth";
4203
4234
  }
4204
4235
  /** Identifies the renderable type as `LabelImageRenderable`. */
4205
4236
  get type() {
@@ -4242,13 +4273,13 @@ class _Q extends zA {
4242
4273
  makeColorCycleTexture(A) {
4243
4274
  const I = new Uint8Array(
4244
4275
  A.flatMap((C) => C.rgba).map((C) => Math.round(C * 255))
4245
- ), B = new aB(I, A.length, 1);
4276
+ ), B = new DB(I, A.length, 1);
4246
4277
  return B.dataFormat = "rgba", B;
4247
4278
  }
4248
4279
  makeColorLookupTableTexture(A) {
4249
4280
  A === void 0 ? A = /* @__PURE__ */ new Map([[0, T.TRANSPARENT]]) : A.has(0) || (A = new Map([[0, T.TRANSPARENT], ...A]));
4250
4281
  const I = Array.from(A.keys()), B = Array.from(A.values()).map((E) => E.packed), C = A.size, Q = new Uint32Array(C * 2);
4251
- return Q.set(I, 0), Q.set(B, C), new aB(Q, C, 2);
4282
+ return Q.set(I, 0), Q.set(B, C), new DB(Q, C, 2);
4252
4283
  }
4253
4284
  }
4254
4285
  class Yg extends KI {
@@ -4311,7 +4342,7 @@ class Yg extends KI {
4311
4342
  * @param viewport - The viewport being rendered.
4312
4343
  */
4313
4344
  update(A) {
4314
- if (!A || !this.chunkStoreView_) return;
4345
+ if (!A || !this.chunkStoreView_) return !0;
4315
4346
  const I = A.camera, B = I.type === "OrthographicCamera" ? I.getWorldViewRect() : this.chunkStoreView_.getWholePlaneRect();
4316
4347
  this.chunkStoreView_.updateChunksForImage(this.sliceCoords_, {
4317
4348
  worldViewRect: B,
@@ -4319,6 +4350,7 @@ class Yg extends KI {
4319
4350
  }), this.updateChunks();
4320
4351
  for (const [C, Q] of this.visibleChunks_)
4321
4352
  this.updateSlicePosition(Q, C);
4353
+ return !0;
4322
4354
  }
4323
4355
  /** The slice plane the layer displays. */
4324
4356
  get orientation() {
@@ -4366,7 +4398,7 @@ class Yg extends KI {
4366
4398
  * @param event - The event with clip and world coordinates attached.
4367
4399
  */
4368
4400
  onEvent(A) {
4369
- this.pointerDownPos_ = sC(
4401
+ this.pointerDownPos_ = hC(
4370
4402
  A,
4371
4403
  this.pointerDownPos_,
4372
4404
  (I) => this.pickAtRay(I),
@@ -4378,7 +4410,7 @@ class Yg extends KI {
4378
4410
  async pickAtRay(A) {
4379
4411
  const I = this.visibleChunks_.values().next();
4380
4412
  if (I.done) return null;
4381
- const B = I.value.transform, C = gC(
4413
+ const B = I.value.transform, C = CC(
4382
4414
  M(),
4383
4415
  x(0, 0, 1),
4384
4416
  B.rotation
@@ -4485,7 +4517,7 @@ class Yg extends KI {
4485
4517
  return C ? (C.setTexture(0, I), C.setColorMap(this.colorMap_), C.setSelectedValue(this.selectedValue_), this.updateLabelChunk(C, A), C) : this.createLabel(A, I);
4486
4518
  }
4487
4519
  createLabel(A, I) {
4488
- const B = new _Q({
4520
+ const B = new AE({
4489
4521
  width: A.shape[this.axes_.u],
4490
4522
  height: A.shape[this.axes_.v],
4491
4523
  imageData: I,
@@ -4508,7 +4540,7 @@ class Yg extends KI {
4508
4540
  }
4509
4541
  updateLabelChunk(A, I) {
4510
4542
  const { u: B, v: C } = this.axes_;
4511
- A.transform.setScale([I.scale[B], I.scale[C], 1]), A.transform.setRotation(this.planeRotation_), this.updateSlicePosition(A, I), A.worldToTexCoord = CC(I, this.axes_);
4543
+ A.transform.setScale([I.scale[B], I.scale[C], 1]), A.transform.setRotation(this.planeRotation_), this.updateSlicePosition(A, I), A.worldToTexCoord = EC(I, this.axes_);
4512
4544
  }
4513
4545
  releaseAndRemoveChunks(A) {
4514
4546
  for (const I of A) {
@@ -4517,7 +4549,7 @@ class Yg extends KI {
4517
4549
  }
4518
4550
  }
4519
4551
  }
4520
- class $Q extends pA {
4552
+ class IE extends pA {
4521
4553
  constructor(A, I, B, C, Q, E) {
4522
4554
  super();
4523
4555
  const i = [], o = [], a = Math.floor(C), s = Math.floor(Q), D = Math.floor(E);
@@ -4564,7 +4596,7 @@ class $Q extends pA {
4564
4596
  }
4565
4597
  }
4566
4598
  }
4567
- class AE extends zA {
4599
+ class gE extends zA {
4568
4600
  /**
4569
4601
  * World size of a voxel along each axis. Layers set it from the chunk
4570
4602
  * scale so ray march steps account for anisotropic voxels. Defaults to
@@ -4580,7 +4612,7 @@ class AE extends zA {
4580
4612
  * @param props - Initialization properties.
4581
4613
  */
4582
4614
  constructor({ channelProps: A = [] } = {}) {
4583
- super(), this.geometry = new $Q(1, 1, 1, 1, 1, 1), this.cullFaceMode = "front", this.depthTest = !1, this.channels_ = [], this.setChannelProps(A);
4615
+ super(), this.geometry = new IE(1, 1, 1, 1, 1, 1), this.cullFaceMode = "front", this.depthTest = !1, this.channels_ = [], this.setChannelProps(A);
4584
4616
  }
4585
4617
  /** Identifies the renderable type as `VolumeRenderable`. */
4586
4618
  get type() {
@@ -4602,7 +4634,7 @@ class AE extends zA {
4602
4634
  addChannelTexture(A, I) {
4603
4635
  const B = this.textures.length;
4604
4636
  this.setTexture(B, I), this.channelToTextureIndex_.set(A, B);
4605
- const C = IE(I.dataType);
4637
+ const C = BE(I.dataType);
4606
4638
  if (this.programName && this.programName !== C)
4607
4639
  throw new Error(
4608
4640
  `Volume renderable does not support multiple channels with different data types. Existing program: ${this.programName}, new channel data type: ${I.dataType} and program: ${C}`
@@ -4714,7 +4746,7 @@ class AE extends zA {
4714
4746
  this.channels_[A] = C;
4715
4747
  }
4716
4748
  }
4717
- function IE(g) {
4749
+ function BE(g) {
4718
4750
  switch (g) {
4719
4751
  case "byte":
4720
4752
  case "int":
@@ -4728,8 +4760,8 @@ function IE(g) {
4728
4760
  return "floatVolume";
4729
4761
  }
4730
4762
  }
4731
- const gE = 2;
4732
- class BE extends KI {
4763
+ const CE = 2;
4764
+ class QE extends KI {
4733
4765
  /** Identifies the layer type as `VolumeLayer`. */
4734
4766
  type = "VolumeLayer";
4735
4767
  /** Highlights rays of zero length for debugging. Defaults to `false`. */
@@ -4836,7 +4868,7 @@ class BE extends KI {
4836
4868
  for (const E of I) B.updateVolumeWithChunk(E);
4837
4869
  return B;
4838
4870
  }
4839
- const C = EE(I[0]), Q = this.pool_.acquire(C) ?? new AE();
4871
+ const C = oE(I[0]), Q = this.pool_.acquire(C) ?? new gE();
4840
4872
  Q.setChannelProps(this.channelProps_ ?? []), this.volumeToPoolKey_.set(Q, C);
4841
4873
  for (const E of I) Q.updateVolumeWithChunk(E);
4842
4874
  return this.updateVolumeTransform(Q, I[0]), Q;
@@ -4846,7 +4878,7 @@ class BE extends KI {
4846
4878
  this.chunkStoreView_ = A.chunkManager.addView(
4847
4879
  this.source_,
4848
4880
  this.policy_
4849
- ), iC(
4881
+ ), aC(
4850
4882
  this.channelProps_,
4851
4883
  this.chunkStoreView_.channelCount
4852
4884
  );
@@ -4860,7 +4892,7 @@ class BE extends KI {
4860
4892
  updateChunks() {
4861
4893
  if (!this.chunkStoreView_) return;
4862
4894
  this.state !== "ready" && this.setState("ready");
4863
- const A = this.chunkStoreView_.getChunksToRender(), I = this.sliceCoords_.t ?? -1, B = QE(A);
4895
+ const A = this.chunkStoreView_.getChunksToRender(), I = this.sliceCoords_.t ?? -1, B = iE(A);
4864
4896
  if (this.lastLoadedTime_ !== I || B.size !== this.currentVolumes_.size || this.lastNumRenderedChannelChunks_ !== A.length) {
4865
4897
  for (const [Q, E] of this.currentVolumes_)
4866
4898
  B.has(Q) || (this.releaseAndRemoveVolume(E), this.currentVolumes_.delete(Q));
@@ -4899,17 +4931,17 @@ class BE extends KI {
4899
4931
  * @param viewport - The viewport being rendered.
4900
4932
  */
4901
4933
  update(A) {
4902
- if (!A || !this.chunkStoreView_) return;
4934
+ if (!A || !this.chunkStoreView_) return !0;
4903
4935
  this.chunkStoreView_.updateChunksForVolume(
4904
4936
  this.sliceCoords_,
4905
4937
  A.camera.getViewProjection()
4906
4938
  );
4907
4939
  const I = A.cameraControls?.isMoving ?? !1;
4908
- this.interactiveStepSizeScale_ = I ? gE : 1, this.updateChunks(), this.rebuildObjects(A.camera);
4940
+ return this.interactiveStepSizeScale_ = I ? CE : 1, this.updateChunks(), this.rebuildObjects(A.camera), !0;
4909
4941
  }
4910
4942
  rebuildObjects(A) {
4911
4943
  const I = Array.from(this.currentVolumes_.values());
4912
- iE(I, A), this.clearObjects();
4944
+ aE(I, A), this.clearObjects();
4913
4945
  for (const B of I)
4914
4946
  this.addObject(B);
4915
4947
  }
@@ -4927,35 +4959,35 @@ class BE extends KI {
4927
4959
  };
4928
4960
  }
4929
4961
  }
4930
- function CE(g) {
4962
+ function EE(g) {
4931
4963
  const { x: A, y: I, z: B, t: C } = g.chunkIndex;
4932
4964
  return `${A}:${I}:${B}:${C}`;
4933
4965
  }
4934
- function QE(g) {
4966
+ function iE(g) {
4935
4967
  const A = /* @__PURE__ */ new Map();
4936
4968
  for (const I of g) {
4937
- const B = CE(I);
4969
+ const B = EE(I);
4938
4970
  let C = A.get(B);
4939
4971
  C || (C = [], A.set(B, C)), C.push(I);
4940
4972
  }
4941
4973
  return A;
4942
4974
  }
4943
- function EE(g) {
4975
+ function oE(g) {
4944
4976
  return [
4945
4977
  `lod${g.lod}`,
4946
4978
  `shape${g.shape.x}x${g.shape.y}x${g.shape.z}`,
4947
4979
  `align${g.rowAlignmentBytes}`
4948
4980
  ].join(":");
4949
4981
  }
4950
- function iE(g, A) {
4982
+ function aE(g, A) {
4951
4983
  const I = A.position, B = /* @__PURE__ */ new Map();
4952
4984
  for (const C of g) {
4953
4985
  const Q = C.transform.translation;
4954
- B.set(C, gQ(I, Q));
4986
+ B.set(C, CQ(I, Q));
4955
4987
  }
4956
4988
  g.sort((C, Q) => B.get(Q) - B.get(C));
4957
4989
  }
4958
- let oE = class {
4990
+ let sE = class {
4959
4991
  renderer_;
4960
4992
  chunkManager_;
4961
4993
  viewports_;
@@ -4992,8 +5024,8 @@ let oE = class {
4992
5024
  for (const I of this.viewports_) {
4993
5025
  const B = [];
4994
5026
  for (const C of I.layers)
4995
- !(C instanceof Jg) && !(C instanceof Yg) && !(C instanceof BE) || C.chunkStoreView && B.push(C.chunkStoreView);
4996
- B.length !== 0 && A.push(fQ(I.id, B));
5027
+ !(C instanceof Jg) && !(C instanceof Yg) && !(C instanceof QE) || C.chunkStoreView && B.push(C.chunkStoreView);
5028
+ B.length !== 0 && A.push(uQ(I.id, B));
4997
5029
  }
4998
5030
  return { sources: this.chunkManager_.sourceChunkStats, viewports: A };
4999
5031
  }
@@ -5054,14 +5086,14 @@ ZA.Panel = function(g, A, I, B) {
5054
5086
  }
5055
5087
  };
5056
5088
  };
5057
- function aE({ scale: g } = { scale: 1.5 }) {
5089
+ function DE({ scale: g } = { scale: 1.5 }) {
5058
5090
  const A = new ZA(g);
5059
5091
  return A.showPanel(
5060
5092
  0
5061
5093
  /* 0 = fps, 1 = ms, 2 = mb */
5062
5094
  ), document.body.appendChild(A.dom), A;
5063
5095
  }
5064
- class sE {
5096
+ class hE {
5065
5097
  elements_;
5066
5098
  resizeObserver_;
5067
5099
  mediaQuery_;
@@ -5120,8 +5152,8 @@ class sE {
5120
5152
  this.elements_.splice(I, 1), this.resizeObserver_ && this.resizeObserver_.unobserve(A);
5121
5153
  }
5122
5154
  }
5123
- const DE = 2048;
5124
- function sB(g, A) {
5155
+ const tE = 2048;
5156
+ function hB(g, A) {
5125
5157
  for (const B of A) {
5126
5158
  if (B.id === g.id)
5127
5159
  throw new Error(
@@ -5143,7 +5175,7 @@ function sB(g, A) {
5143
5175
  `${B.type} cannot be shared by multiple viewports simultaneously.`
5144
5176
  );
5145
5177
  }
5146
- class ko {
5178
+ class Jo {
5147
5179
  /** The canvas element the renderer draws into. */
5148
5180
  canvas;
5149
5181
  /** The registered overlays that update once per frame in order. */
@@ -5159,15 +5191,17 @@ class ko {
5159
5191
  sizeObserver_;
5160
5192
  lastAnimationId_;
5161
5193
  lastTimestamp_ = 0;
5194
+ renderRequested_ = !1;
5195
+ renderInvalidated_ = !0;
5162
5196
  /**
5163
5197
  * Creates an Idetik runtime for the given canvas.
5164
5198
  *
5165
5199
  * @param params - Initialization properties.
5166
5200
  */
5167
5201
  constructor(A) {
5168
- this.canvas = A.canvas, this.renderer_ = new kQ(this.canvas);
5169
- const B = (A.memoryLimitMB ?? DE) * 1024 * 1024;
5170
- this.chunkManager_ = new mQ(
5202
+ this.canvas = A.canvas, this.renderer_ = new JQ(this.canvas);
5203
+ const B = (A.memoryLimitMB ?? tE) * 1024 * 1024;
5204
+ this.chunkManager_ = new xQ(
5171
5205
  (Q) => this.renderer_.uploadTexture(Q),
5172
5206
  (Q) => this.renderer_.disposeTexture(Q),
5173
5207
  () => this.renderer_.gpuTextureBytes,
@@ -5178,15 +5212,16 @@ class ko {
5178
5212
  chunkManager: this.chunkManager_
5179
5213
  }, this.viewports_ = [];
5180
5214
  for (const Q of A.viewports ?? [])
5181
- sB(Q, this.viewports_), this.viewports_.push(Q);
5182
- this.overlays = [...A.overlays ?? []], this.stats = new oE(this.renderer_, this.chunkManager_, this.viewports_), A.showStats && (this.stats_ = aE());
5215
+ hB(Q, this.viewports_), this.viewports_.push(Q);
5216
+ this.overlays = [...A.overlays ?? []], this.stats = new sE(this.renderer_, this.chunkManager_, this.viewports_), A.showStats && (this.stats_ = DE());
5183
5217
  const C = [this.canvas];
5184
5218
  for (const Q of this.viewports_)
5185
5219
  Q.domElement !== this.canvas && C.push(Q.domElement);
5186
- this.sizeObserver_ = new sE(C, () => {
5187
- this.renderer_.updateSize(), this.detachRemovedLayers(), this.renderer_.beginFrame();
5220
+ this.sizeObserver_ = new hE(C, () => {
5221
+ this.renderer_.updateSize(), this.detachRemovedLayers();
5188
5222
  for (const Q of this.viewports_)
5189
- Q.updateSize(), this.renderViewport(Q);
5223
+ Q.updateSize(), this.updateViewport(Q);
5224
+ this.draw();
5190
5225
  });
5191
5226
  }
5192
5227
  /** The width of the rendering surface in pixels. */
@@ -5221,7 +5256,7 @@ class ko {
5221
5256
  * @returns The added viewport.
5222
5257
  */
5223
5258
  addViewport(A) {
5224
- return sB(A, this.viewports_), A.updateSize(), this.viewports_.push(A), this.running && (A.events.connect(), A.domElement !== this.canvas && this.sizeObserver_.observe(A.domElement)), k.info("Idetik", `Added viewport "${A.id}"`), A;
5259
+ return hB(A, this.viewports_), A.updateSize(), this.viewports_.push(A), this.invalidate(), this.running && (A.events.connect(), A.domElement !== this.canvas && this.sizeObserver_.observe(A.domElement)), k.info("Idetik", `Added viewport "${A.id}"`), A;
5225
5260
  }
5226
5261
  /**
5227
5262
  * Removes a previously added viewport.
@@ -5239,7 +5274,7 @@ class ko {
5239
5274
  this.running && (A.events.disconnect(), A.domElement !== this.canvas && this.sizeObserver_.unobserve(A.domElement)), this.viewports_.splice(I, 1);
5240
5275
  for (const [B, C] of this.attachments_)
5241
5276
  C === A && (B.onDetached(this.context_), this.attachments_.delete(B));
5242
- return k.info("Idetik", `Removed viewport "${A.id}"`), !0;
5277
+ return this.invalidate(), k.info("Idetik", `Removed viewport "${A.id}"`), !0;
5243
5278
  }
5244
5279
  /**
5245
5280
  * Registers an overlay that updates once per frame.
@@ -5267,6 +5302,13 @@ class ko {
5267
5302
  setMemoryLimitMB(A) {
5268
5303
  this.chunkManager_.memoryLimitBytes = A * 1024 * 1024;
5269
5304
  }
5305
+ /**
5306
+ * Explicitly requests a draw on the next animation frame while running,
5307
+ * even if no internal state has changed.
5308
+ */
5309
+ requestRender() {
5310
+ this.renderRequested_ = !0;
5311
+ }
5270
5312
  /**
5271
5313
  * Starts the render loop and connects input handlers.
5272
5314
  *
@@ -5276,6 +5318,7 @@ class ko {
5276
5318
  if (k.info("Idetik", "Idetik runtime starting"), this.running)
5277
5319
  k.warn("Idetik", "Idetik runtime already started");
5278
5320
  else {
5321
+ this.invalidate();
5279
5322
  for (const A of this.viewports_)
5280
5323
  A.events.connect();
5281
5324
  this.sizeObserver_.connect(), this.lastAnimationId_ = requestAnimationFrame((A) => {
@@ -5288,7 +5331,25 @@ class ko {
5288
5331
  for (const [A, I] of this.attachments_)
5289
5332
  (!this.viewports_.includes(I) || !I.layers.includes(A)) && (A.onDetached(this.context_), this.attachments_.delete(A));
5290
5333
  }
5291
- renderViewport(A) {
5334
+ animate(A) {
5335
+ this.stats_?.begin();
5336
+ const I = Math.min(A - this.lastTimestamp_, 100) / 1e3;
5337
+ this.lastTimestamp_ = A, this.detachRemovedLayers();
5338
+ for (const B of this.viewports_)
5339
+ B.cameraControls?.onUpdate(I);
5340
+ for (const B of this.viewports_)
5341
+ this.updateViewport(B);
5342
+ (this.renderRequested_ || this.renderInvalidated_) && this.draw(), this.chunkManager_.update();
5343
+ for (const B of this.overlays)
5344
+ B.update(this);
5345
+ this.stats_?.end(), this.lastAnimationId_ = requestAnimationFrame(
5346
+ (B) => this.animate(B)
5347
+ );
5348
+ }
5349
+ invalidate() {
5350
+ this.renderInvalidated_ = !0;
5351
+ }
5352
+ updateViewport(A) {
5292
5353
  for (const I of A.layers)
5293
5354
  if (I.attached && this.attachments_.get(I) !== A)
5294
5355
  throw new Error(
@@ -5296,20 +5357,16 @@ class ko {
5296
5357
  );
5297
5358
  for (const I of A.layers)
5298
5359
  I.attached || (I.onAttached(this.context_), this.attachments_.set(I, A));
5299
- this.renderer_.render(A);
5360
+ for (const I of A.layers) {
5361
+ const B = I.update(A), C = I.renderStateChanged();
5362
+ (B || C) && this.invalidate();
5363
+ }
5364
+ A.renderStateChanged(this.canvas) && this.invalidate();
5300
5365
  }
5301
- animate(A) {
5302
- this.stats_ && this.stats_.begin();
5303
- const I = Math.min(A - this.lastTimestamp_, 100) / 1e3;
5304
- this.lastTimestamp_ = A, this.detachRemovedLayers(), this.renderer_.beginFrame();
5305
- for (const B of this.viewports_)
5306
- B.cameraControls?.onUpdate(I), this.renderViewport(B);
5307
- this.chunkManager_.update();
5308
- for (const B of this.overlays)
5309
- B.update(this);
5310
- this.stats_ && this.stats_.end(), this.lastAnimationId_ = requestAnimationFrame(
5311
- (B) => this.animate(B)
5312
- );
5366
+ draw() {
5367
+ this.renderRequested_ = !1, this.renderInvalidated_ = !1, this.renderer_.beginFrame();
5368
+ for (const A of this.viewports_)
5369
+ this.renderer_.render(A);
5313
5370
  }
5314
5371
  /**
5315
5372
  * Stops the render loop and disconnects input handlers.
@@ -5332,10 +5389,10 @@ const Cg = [
5332
5389
  "pointercancel",
5333
5390
  "wheel"
5334
5391
  ];
5335
- function hE(g) {
5392
+ function yE(g) {
5336
5393
  return Cg.includes(g);
5337
5394
  }
5338
- class tE {
5395
+ class eE {
5339
5396
  propagationStopped_ = !1;
5340
5397
  type;
5341
5398
  event;
@@ -5352,7 +5409,7 @@ class tE {
5352
5409
  this.propagationStopped_ = !0;
5353
5410
  }
5354
5411
  }
5355
- class yE {
5412
+ class nE {
5356
5413
  listeners_ = [];
5357
5414
  element_;
5358
5415
  isConnected_ = !1;
@@ -5397,31 +5454,31 @@ class yE {
5397
5454
  });
5398
5455
  }
5399
5456
  handleEvent = (A) => {
5400
- if (!hE(A.type)) {
5457
+ if (!yE(A.type)) {
5401
5458
  k.error("EventDispatcher", `Unsupported event type ${A.type}`);
5402
5459
  return;
5403
5460
  }
5404
- const I = new tE(A.type, A);
5461
+ const I = new eE(A.type, A);
5405
5462
  for (const B of this.listeners_)
5406
5463
  if (B(I), I.propagationStopped) break;
5407
5464
  };
5408
5465
  }
5409
- const eE = 1e-12;
5410
- class nE {
5466
+ const GE = 1e-12;
5467
+ class wE {
5411
5468
  origin;
5412
5469
  direction;
5413
5470
  constructor(A, I) {
5414
- this.origin = EA(A), this.direction = IC(M(), I);
5471
+ this.origin = EA(A), this.direction = BC(M(), I);
5415
5472
  }
5416
5473
  intersectWithPlane(A) {
5417
5474
  const I = sI(this.direction, A.normal);
5418
- if (Math.abs(I) < eE)
5475
+ if (Math.abs(I) < GE)
5419
5476
  return null;
5420
5477
  const B = -A.signedDistanceToPoint(this.origin) / I;
5421
5478
  return Ag(M(), this.origin, this.direction, B);
5422
5479
  }
5423
5480
  }
5424
- class Lo {
5481
+ class Yo {
5425
5482
  /** The viewport's unique identifier. */
5426
5483
  id;
5427
5484
  /** The host element defining the viewport's area. */
@@ -5433,13 +5490,18 @@ class Lo {
5433
5490
  /** Input controls driving the camera. */
5434
5491
  cameraControls;
5435
5492
  layers_ = [];
5493
+ layersChanged_ = !0;
5494
+ lastRenderBox_;
5495
+ lastVisibility_;
5496
+ lastCameraTransform_ = _();
5497
+ lastProjection_ = _();
5436
5498
  constructor(A) {
5437
- this.id = A.id || A.domElement.id || _B("viewport"), this.domElement = A.domElement, this.camera = A.camera, this.cameraControls = A.cameraControls, this.updateAspectRatio(), this.events = new yE(this.domElement), this.events.addEventListener((I) => {
5499
+ this.id = A.id || A.domElement.id || AC("viewport"), this.domElement = A.domElement, this.camera = A.camera, this.cameraControls = A.cameraControls, this.updateAspectRatio(), this.events = new nE(this.domElement), this.events.addEventListener((I) => {
5438
5500
  if (I.event instanceof PointerEvent || I.event instanceof WheelEvent) {
5439
5501
  const { clientX: B, clientY: C } = I.event, Q = v(B, C);
5440
5502
  I.clipPos = this.clientToClip(Q, 0), I.worldPos = this.camera.clipToWorld(I.clipPos);
5441
5503
  const E = this.camera.clipToWorld(this.clientToClip(Q, -1)), i = this.camera.clipToWorld(this.clientToClip(Q, 1));
5442
- I.worldRay = new nE(E, Gg(M(), i, E));
5504
+ I.worldRay = new wE(E, Gg(M(), i, E));
5443
5505
  }
5444
5506
  for (const B of this.layers_)
5445
5507
  if (B.onEvent(I), I.propagationStopped) return;
@@ -5463,7 +5525,7 @@ class Lo {
5463
5525
  addLayer(A) {
5464
5526
  if (this.layers_.includes(A))
5465
5527
  throw new Error(`${A.type} is already in viewport "${this.id}".`);
5466
- this.layers_.push(A);
5528
+ this.layers_.push(A), this.layersChanged_ = !0;
5467
5529
  }
5468
5530
  /**
5469
5531
  * Removes a previously added layer.
@@ -5474,11 +5536,16 @@ class Lo {
5474
5536
  const I = this.layers_.indexOf(A);
5475
5537
  if (I === -1)
5476
5538
  throw new Error(`Layer to remove not found: ${A}`);
5477
- this.layers_.splice(I, 1);
5539
+ this.layers_.splice(I, 1), this.layersChanged_ = !0;
5478
5540
  }
5479
5541
  /** Removes all layers from the viewport. */
5480
5542
  removeAllLayers() {
5481
- this.layers_ = [];
5543
+ this.layers_.length !== 0 && (this.layers_ = [], this.layersChanged_ = !0);
5544
+ }
5545
+ /** @hidden */
5546
+ renderStateChanged(A) {
5547
+ const I = this.getBoxRelativeTo(A), B = getComputedStyle(this.domElement).visibility, C = this.camera.transform.matrix, Q = this.camera.projectionMatrix, E = !this.lastRenderBox_ || !AA.equals(I, this.lastRenderBox_) || B !== this.lastVisibility_, i = !gB(C, this.lastCameraTransform_) || !gB(Q, this.lastProjection_);
5548
+ return this.layersChanged_ || E || i ? (this.layersChanged_ = !1, this.lastRenderBox_ = I, this.lastVisibility_ = B, IB(this.lastCameraTransform_, C), IB(this.lastProjection_, Q), !0) : !1;
5482
5549
  }
5483
5550
  /**
5484
5551
  * Syncs the camera's aspect ratio to the host element's size. Called
@@ -5555,7 +5622,7 @@ class Lo {
5555
5622
  this.camera.setAspectRatio(B);
5556
5623
  }
5557
5624
  }
5558
- function GE(g, A) {
5625
+ function FE(g, A) {
5559
5626
  return {
5560
5627
  ...g,
5561
5628
  ...A,
@@ -5565,13 +5632,13 @@ function GE(g, A) {
5565
5632
  }
5566
5633
  };
5567
5634
  }
5568
- function DB(g, A) {
5635
+ function tB(g, A) {
5569
5636
  const I = typeof g == "string" ? new URL(g) : g;
5570
5637
  I.pathname.endsWith("/") || (I.pathname += "/");
5571
5638
  const B = new URL(A.slice(1), I);
5572
5639
  return B.search = I.search, B;
5573
5640
  }
5574
- async function hB(g) {
5641
+ async function yB(g) {
5575
5642
  if (g.status !== 404) {
5576
5643
  if (g.status === 200 || g.status === 206)
5577
5644
  return new Uint8Array(await g.arrayBuffer());
@@ -5587,14 +5654,14 @@ class _A {
5587
5654
  this.url = A, this.#A = I.fetch ?? ((B) => fetch(B)), this.#I = I.overrides ?? {}, this.#g = I.useSuffixRequest ?? !1;
5588
5655
  }
5589
5656
  #B(A, I) {
5590
- return new Request(A, GE(this.#I, I));
5657
+ return new Request(A, FE(this.#I, I));
5591
5658
  }
5592
5659
  async get(A, I = {}) {
5593
- let B = DB(this.url, A).href, C = this.#B(B, I), Q = await this.#A(C);
5594
- return hB(Q);
5660
+ let B = tB(this.url, A).href, C = this.#B(B, I), Q = await this.#A(C);
5661
+ return yB(Q);
5595
5662
  }
5596
5663
  async getRange(A, I, B = {}) {
5597
- let C = DB(this.url, A), Q;
5664
+ let C = tB(this.url, A), Q;
5598
5665
  if ("suffixLength" in I)
5599
5666
  Q = await this.#C(C, I.suffixLength, B);
5600
5667
  else {
@@ -5607,7 +5674,7 @@ class _A {
5607
5674
  }, i = this.#B(C, E);
5608
5675
  Q = await this.#A(i);
5609
5676
  }
5610
- return hB(Q);
5677
+ return yB(Q);
5611
5678
  }
5612
5679
  async #C(A, I, B) {
5613
5680
  if (this.#g) {
@@ -5652,7 +5719,7 @@ class X extends $A {
5652
5719
  super(A, { cause: I.cause }), this.path = I.path;
5653
5720
  }
5654
5721
  }
5655
- class wE extends $A {
5722
+ class rE extends $A {
5656
5723
  _tag = "UnknownCodecError";
5657
5724
  name = "UnknownCodecError";
5658
5725
  codec;
@@ -5660,7 +5727,7 @@ class wE extends $A {
5660
5727
  super(`Unknown codec: ${A}`), this.codec = A;
5661
5728
  }
5662
5729
  }
5663
- class FE extends $A {
5730
+ class SE extends $A {
5664
5731
  _tag = "CodecPipelineError";
5665
5732
  name = "CodecPipelineError";
5666
5733
  direction;
@@ -5710,7 +5777,7 @@ class GI {
5710
5777
  function Mg(g) {
5711
5778
  return g instanceof ArrayBuffer || g instanceof SharedArrayBuffer;
5712
5779
  }
5713
- class hC {
5780
+ class yC {
5714
5781
  #A;
5715
5782
  constructor(A, I, B) {
5716
5783
  typeof A == "number" ? this.#A = new Uint8Array(A) : Mg(A) ? this.#A = new Uint8Array(A, I, B) : this.#A = new Uint8Array(Array.from(A, (C) => C ? 1 : 0));
@@ -5849,11 +5916,11 @@ class AI {
5849
5916
  yield this.get(A);
5850
5917
  }
5851
5918
  }
5852
- function rE() {
5919
+ function RE() {
5853
5920
  if (typeof SharedArrayBuffer > "u")
5854
5921
  throw new Error("SharedArrayBuffer is not available. In browsers, this requires Cross-Origin-Opener-Policy and Cross-Origin-Embedder-Policy headers to be set.");
5855
5922
  }
5856
- function SE(g, A) {
5923
+ function cE(g, A) {
5857
5924
  return new SharedArrayBuffer(g);
5858
5925
  }
5859
5926
  function II(g) {
@@ -5864,7 +5931,7 @@ function II(g) {
5864
5931
  throw new X("Failed to decode JSON", { cause: I });
5865
5932
  }
5866
5933
  }
5867
- function tB(g, A) {
5934
+ function eB(g, A) {
5868
5935
  const I = A / 2, B = A - 1;
5869
5936
  let C = 0;
5870
5937
  for (let Q = 0; Q < g.length; Q += A)
@@ -5893,7 +5960,7 @@ function mA(g) {
5893
5960
  float16: globalThis.Float16Array,
5894
5961
  float32: Float32Array,
5895
5962
  float64: Float64Array,
5896
- bool: hC
5963
+ bool: yC
5897
5964
  }[g];
5898
5965
  if (!I)
5899
5966
  throw new X(`Unknown or unsupported dataType: ${g}`);
@@ -5907,7 +5974,7 @@ function SA(g, A) {
5907
5974
  C[A[Q]] = B, B *= g[A[Q]];
5908
5975
  return C;
5909
5976
  }
5910
- function RE({ name: g, configuration: A }) {
5977
+ function NE({ name: g, configuration: A }) {
5911
5978
  if (g === "default") {
5912
5979
  const I = A?.separator ?? "/";
5913
5980
  return (B) => ["c", ...B].join(I);
@@ -5918,7 +5985,7 @@ function RE({ name: g, configuration: A }) {
5918
5985
  }
5919
5986
  throw new X(`Unknown chunk key encoding: ${g}`);
5920
5987
  }
5921
- function yB(g) {
5988
+ function nB(g) {
5922
5989
  if (g === "|O")
5923
5990
  return { dataType: "v2:object" };
5924
5991
  let A = g.match(/^([<|>])(.*)$/);
@@ -5942,15 +6009,15 @@ function yB(g) {
5942
6009
  throw new X(`Unsupported or unknown dtype: ${g}`);
5943
6010
  return I === "|" ? { dataType: C } : { dataType: C, endian: I === "<" ? "little" : "big" };
5944
6011
  }
5945
- function cE(g) {
6012
+ function UE(g) {
5946
6013
  return (g.id === "fixedscaleoffset" || g.id === "numcodecs.fixedscaleoffset") && typeof g.scale == "number" && typeof g.offset == "number" && (g.astype === void 0 || typeof g.astype == "string") && (g.dtype === void 0 || typeof g.dtype == "string");
5947
6014
  }
5948
- function NE(g, A = {}) {
5949
- let I = [], B = yB(g.dtype);
6015
+ function kE(g, A = {}) {
6016
+ let I = [], B = nB(g.dtype);
5950
6017
  g.order === "F" && I.push({ name: "transpose", configuration: { order: "F" } });
5951
6018
  for (let Q of g.filters ?? []) {
5952
6019
  if (Q.id === "fixedscaleoffset" || Q.id === "numcodecs.fixedscaleoffset") {
5953
- if (!cE(Q))
6020
+ if (!UE(Q))
5954
6021
  throw new X(`Invalid fixedscaleoffset filter: ${JSON.stringify(Q)}`);
5955
6022
  I.push({
5956
6023
  name: "scale_offset",
@@ -5961,7 +6028,7 @@ function NE(g, A = {}) {
5961
6028
  });
5962
6029
  let o = Q.astype ?? Q.dtype;
5963
6030
  if (o !== void 0 && o !== g.dtype) {
5964
- let a = yB(o).dataType;
6031
+ let a = nB(o).dataType;
5965
6032
  if (!Qg(a, "number") && !Qg(a, "bigint"))
5966
6033
  throw new X(`fixedscaleoffset astype must be a numeric data type, got ${o}`);
5967
6034
  I.push({
@@ -6008,7 +6075,7 @@ function NE(g, A = {}) {
6008
6075
  attributes: A
6009
6076
  };
6010
6077
  }
6011
- function UE(g, A = {}) {
6078
+ function LE(g, A = {}) {
6012
6079
  return {
6013
6080
  zarr_format: 3,
6014
6081
  node_type: "group",
@@ -6030,10 +6097,10 @@ function Qg(g, A) {
6030
6097
  let Q = g === "v2:object";
6031
6098
  return A === "object" ? Q : !B && !C && !I && !Q;
6032
6099
  }
6033
- function kE(g) {
6100
+ function JE(g) {
6034
6101
  return g?.name === "sharding_indexed";
6035
6102
  }
6036
- function tC(g) {
6103
+ function eC(g) {
6037
6104
  if ((g.data_type === "uint64" || g.data_type === "int64") && g.fill_value != null)
6038
6105
  return BigInt(g.fill_value);
6039
6106
  let A = g.data_type === "float16" || g.data_type === "float32" || g.data_type === "float64";
@@ -6048,7 +6115,7 @@ function tC(g) {
6048
6115
  }
6049
6116
  return g.fill_value;
6050
6117
  }
6051
- function yC(g, ...A) {
6118
+ function nC(g, ...A) {
6052
6119
  if (!A.some((I) => g instanceof I))
6053
6120
  throw g;
6054
6121
  }
@@ -6056,7 +6123,7 @@ function IA(g, A = "") {
6056
6123
  if (!g)
6057
6124
  throw new Error(A);
6058
6125
  }
6059
- async function eC(g, { format: A, signal: I }) {
6126
+ async function GC(g, { format: A, signal: I }) {
6060
6127
  let B;
6061
6128
  if (g instanceof ArrayBuffer)
6062
6129
  B = new Response(g);
@@ -6071,12 +6138,12 @@ async function eC(g, { format: A, signal: I }) {
6071
6138
  throw I?.throwIfAborted(), new Error(`Failed to decode ${A}`);
6072
6139
  }
6073
6140
  }
6074
- const eB = LE();
6075
- function LE() {
6141
+ const GB = YE();
6142
+ function YE() {
6076
6143
  const g = new Uint32Array([305419896]);
6077
6144
  return new Uint8Array(g.buffer, g.byteOffset, g.byteLength)[0] !== 18;
6078
6145
  }
6079
- function nB(g) {
6146
+ function wB(g) {
6080
6147
  return "BYTES_PER_ELEMENT" in g ? g.BYTES_PER_ELEMENT : 4;
6081
6148
  }
6082
6149
  class HI {
@@ -6096,35 +6163,35 @@ class HI {
6096
6163
  }
6097
6164
  encode(A) {
6098
6165
  let I = new Uint8Array(A.data.buffer);
6099
- return eB && this.#C === "big" && tB(I, nB(this.#I)), I;
6166
+ return GB && this.#C === "big" && eB(I, wB(this.#I)), I;
6100
6167
  }
6101
6168
  computeEncodedSize(A) {
6102
6169
  return A;
6103
6170
  }
6104
6171
  decode(A) {
6105
- return eB && this.#C === "big" && tB(A, nB(this.#I)), {
6172
+ return GB && this.#C === "big" && eB(A, wB(this.#I)), {
6106
6173
  data: new this.#I(A.buffer, A.byteOffset, A.byteLength / this.#g),
6107
6174
  shape: this.#B,
6108
6175
  stride: this.#A
6109
6176
  };
6110
6177
  }
6111
6178
  }
6112
- const GB = {
6179
+ const FB = {
6113
6180
  NaN: NaN,
6114
6181
  Infinity: 1 / 0,
6115
6182
  "-Infinity": -1 / 0
6116
- }, nC = {
6183
+ }, wC = {
6117
6184
  float16: 2,
6118
6185
  float32: 4,
6119
6186
  float64: 8
6120
6187
  };
6121
6188
  function wI(g) {
6122
- return g in nC;
6189
+ return g in wC;
6123
6190
  }
6124
6191
  function Eg(g) {
6125
6192
  return g === "int64" || g === "uint64";
6126
6193
  }
6127
- function JE(g, A) {
6194
+ function dE(g, A) {
6128
6195
  const I = BigInt(g), B = new ArrayBuffer(A), C = new DataView(B);
6129
6196
  if (A === 2) {
6130
6197
  if (typeof C.getFloat16 != "function")
@@ -6146,9 +6213,9 @@ function FI(g, A) {
6146
6213
  }
6147
6214
  if (!wI(g))
6148
6215
  throw new X(`String-encoded scalar "${A}" is not valid for non-float data type "${g}"`);
6149
- return A in GB ? GB[A] : JE(A, nC[g]);
6216
+ return A in FB ? FB[A] : dE(A, wC[g]);
6150
6217
  }
6151
- const wB = /* @__PURE__ */ new Set([
6218
+ const rB = /* @__PURE__ */ new Set([
6152
6219
  "int8",
6153
6220
  "uint8",
6154
6221
  "int16",
@@ -6171,13 +6238,13 @@ const wB = /* @__PURE__ */ new Set([
6171
6238
  int64: [-(2n ** 63n), 2n ** 63n - 1n],
6172
6239
  uint64: [0n, 2n ** 64n - 1n]
6173
6240
  };
6174
- function FB(g, A, I) {
6241
+ function SB(g, A, I) {
6175
6242
  return g.map(([B, C]) => ({
6176
6243
  src: FI(A, B),
6177
6244
  tgt: FI(I, C)
6178
6245
  }));
6179
6246
  }
6180
- function YE(g, A) {
6247
+ function ME(g, A) {
6181
6248
  for (const I of A)
6182
6249
  if (typeof I.src == "number" && Number.isNaN(I.src)) {
6183
6250
  if (typeof g == "number" && Number.isNaN(g))
@@ -6185,7 +6252,7 @@ function YE(g, A) {
6185
6252
  } else if (g === I.src)
6186
6253
  return I.tgt;
6187
6254
  }
6188
- function dE(g) {
6255
+ function KE(g) {
6189
6256
  if (!Number.isFinite(g))
6190
6257
  return g;
6191
6258
  if (Math.abs(g - Math.trunc(g)) === 0.5) {
@@ -6194,13 +6261,13 @@ function dE(g) {
6194
6261
  }
6195
6262
  return Math.round(g);
6196
6263
  }
6197
- function ME(g) {
6264
+ function HE(g) {
6198
6265
  return Math.sign(g) * Math.floor(Math.abs(g) + 0.5);
6199
6266
  }
6200
- function rB(g) {
6267
+ function RB(g) {
6201
6268
  switch (g) {
6202
6269
  case "nearest-even":
6203
- return dE;
6270
+ return KE;
6204
6271
  case "towards-zero":
6205
6272
  return Math.trunc;
6206
6273
  case "towards-positive":
@@ -6208,7 +6275,7 @@ function rB(g) {
6208
6275
  case "towards-negative":
6209
6276
  return Math.floor;
6210
6277
  case "nearest-away":
6211
- return ME;
6278
+ return HE;
6212
6279
  }
6213
6280
  }
6214
6281
  function PI(g, A, I) {
@@ -6248,7 +6315,7 @@ class Hg {
6248
6315
  #g;
6249
6316
  #B;
6250
6317
  constructor(A, I, B, C, Q, E) {
6251
- this.#A = I, this.#I = mA(A), this.#g = SB(I, A, B, C, Q), this.#B = SB(A, I, B, C, E);
6318
+ this.#A = I, this.#I = mA(A), this.#g = cB(I, A, B, C, Q), this.#B = cB(A, I, B, C, E);
6252
6319
  }
6253
6320
  /** Return updated metadata reflecting the type and fill value after encoding. */
6254
6321
  getEncodedMeta(A) {
@@ -6257,11 +6324,11 @@ class Hg {
6257
6324
  }
6258
6325
  static fromConfig(A, I) {
6259
6326
  const B = I.dataType, C = A.data_type;
6260
- if (!wB.has(B))
6327
+ if (!rB.has(B))
6261
6328
  throw new X(`cast_value codec does not support array data type: ${B}`);
6262
- if (!wB.has(C))
6329
+ if (!rB.has(C))
6263
6330
  throw new X(`cast_value codec does not support encoded data type: ${C}`);
6264
- const Q = A.rounding ?? "nearest-even", E = A.scalar_map?.decode ? FB(A.scalar_map.decode, C, B) : [], i = A.scalar_map?.encode ? FB(A.scalar_map.encode, B, C) : [];
6331
+ const Q = A.rounding ?? "nearest-even", E = A.scalar_map?.decode ? SB(A.scalar_map.decode, C, B) : [], i = A.scalar_map?.encode ? SB(A.scalar_map.encode, B, C) : [];
6265
6332
  return new Hg(B, C, Q, A.out_of_range, E, i);
6266
6333
  }
6267
6334
  encode = NA("cast_value");
@@ -6272,7 +6339,7 @@ class Hg {
6272
6339
  return { data: B, shape: A.shape, stride: A.stride };
6273
6340
  }
6274
6341
  }
6275
- function SB(g, A, I, B, C) {
6342
+ function cB(g, A, I, B, C) {
6276
6343
  const Q = wI(g), E = Eg(g), i = wI(A), o = Eg(A);
6277
6344
  let a;
6278
6345
  if (Q && i) {
@@ -6280,14 +6347,14 @@ function SB(g, A, I, B, C) {
6280
6347
  throw new X(`cast_value float -> float only supports "nearest-even" rounding, got "${I}"`);
6281
6348
  a = (D) => D;
6282
6349
  } else if (Q && !i && !o) {
6283
- const D = rB(I), h = PI(...bI[A], B);
6350
+ const D = RB(I), h = PI(...bI[A], B);
6284
6351
  a = (t) => {
6285
6352
  if (!Number.isFinite(t))
6286
6353
  throw new Error(`Cannot cast ${t} to integer type without scalar_map`);
6287
6354
  return h(D(t));
6288
6355
  };
6289
6356
  } else if (Q && o) {
6290
- const D = rB(I), h = OI(...ZI[A], B);
6357
+ const D = RB(I), h = OI(...ZI[A], B);
6291
6358
  a = (t) => {
6292
6359
  if (!Number.isFinite(t))
6293
6360
  throw new Error(`Cannot cast ${t} to integer type without scalar_map`);
@@ -6310,7 +6377,7 @@ function SB(g, A, I, B, C) {
6310
6377
  else
6311
6378
  throw new Error(`Unhandled type combination: ${g} -> ${A}`);
6312
6379
  return C.length === 0 ? a : (D) => {
6313
- const h = YE(D, C);
6380
+ const h = ME(D, C);
6314
6381
  return h !== void 0 ? h : a(D);
6315
6382
  };
6316
6383
  }
@@ -6327,7 +6394,7 @@ class qg {
6327
6394
  return A + 4;
6328
6395
  }
6329
6396
  }
6330
- const KE = /* @__PURE__ */ new Set([
6397
+ const qE = /* @__PURE__ */ new Set([
6331
6398
  "int8",
6332
6399
  "uint8",
6333
6400
  "int16",
@@ -6340,7 +6407,7 @@ const KE = /* @__PURE__ */ new Set([
6340
6407
  "float32",
6341
6408
  "float64"
6342
6409
  ]);
6343
- function RB(g, A) {
6410
+ function NB(g, A) {
6344
6411
  const I = g.length;
6345
6412
  let B = I === 0 || A[I - 1] === 1;
6346
6413
  for (let Q = I - 2; Q >= 0 && B; Q--)
@@ -6360,12 +6427,12 @@ class lg {
6360
6427
  this.#A = A;
6361
6428
  }
6362
6429
  static fromConfig(A, I) {
6363
- if (!KE.has(I.dataType))
6430
+ if (!qE.has(I.dataType))
6364
6431
  throw new X(`Delta codec does not support data type: ${I.dataType}`);
6365
6432
  return new lg(mA(I.dataType));
6366
6433
  }
6367
6434
  encode(A) {
6368
- RB(A.shape, A.stride);
6435
+ NB(A.shape, A.stride);
6369
6436
  const I = A.data, B = new this.#A(I.length);
6370
6437
  B[0] = I[0];
6371
6438
  for (let C = 1; C < I.length; C++)
@@ -6373,7 +6440,7 @@ class lg {
6373
6440
  return { data: B, shape: A.shape, stride: A.stride };
6374
6441
  }
6375
6442
  decode(A) {
6376
- RB(A.shape, A.stride);
6443
+ NB(A.shape, A.stride);
6377
6444
  const I = A.data, B = new this.#A(I.length);
6378
6445
  B[0] = I[0];
6379
6446
  for (let C = 1; C < I.length; C++)
@@ -6388,14 +6455,14 @@ class fg {
6388
6455
  }
6389
6456
  encode = NA("gzip");
6390
6457
  async decode(A) {
6391
- const I = await eC(A, { format: "gzip" });
6458
+ const I = await GC(A, { format: "gzip" });
6392
6459
  return new Uint8Array(I);
6393
6460
  }
6394
6461
  }
6395
- function HE(g, A) {
6462
+ function lE(g, A) {
6396
6463
  return IA(!Number.isNaN(A), "JsonCodec allow_nan is false but NaN was encountered during encoding."), IA(A !== Number.POSITIVE_INFINITY, "JsonCodec allow_nan is false but Infinity was encountered during encoding."), IA(A !== Number.NEGATIVE_INFINITY, "JsonCodec allow_nan is false but -Infinity was encountered during encoding."), A;
6397
6464
  }
6398
- function qE(g, A) {
6465
+ function fE(g, A) {
6399
6466
  return A instanceof Object && !Array.isArray(A) ? Object.keys(A).sort().reduce((I, B) => (I[B] = A[B], I), {}) : A;
6400
6467
  }
6401
6468
  class rI {
@@ -6425,7 +6492,7 @@ class rI {
6425
6492
  const { indent: I, encoding: B, ensure_ascii: C, check_circular: Q, allow_nan: E, sort_keys: i } = this.#A;
6426
6493
  IA(B === "utf-8", "JsonCodec does not yet support non-utf-8 encoding.");
6427
6494
  const o = [];
6428
- IA(Q, "JsonCodec does not yet support skipping the check for circular references during encoding."), E || o.push(HE), i && o.push(qE);
6495
+ IA(Q, "JsonCodec does not yet support skipping the check for circular references during encoding."), E || o.push(lE), i && o.push(fE);
6429
6496
  const a = Array.from(A.data);
6430
6497
  a.push("|O"), a.push(A.shape);
6431
6498
  let s;
@@ -6450,7 +6517,7 @@ class rI {
6450
6517
  return { data: B, shape: C, stride: Q };
6451
6518
  }
6452
6519
  }
6453
- const lE = /* @__PURE__ */ new Set([
6520
+ const pE = /* @__PURE__ */ new Set([
6454
6521
  "int8",
6455
6522
  "uint8",
6456
6523
  "int16",
@@ -6472,7 +6539,7 @@ class pg {
6472
6539
  this.#I = A, this.#g = I, this.#A = B;
6473
6540
  }
6474
6541
  static fromConfig(A, I) {
6475
- if (!lE.has(I.dataType))
6542
+ if (!pE.has(I.dataType))
6476
6543
  throw new X(`scale_offset codec does not support data type: ${I.dataType}`);
6477
6544
  return new pg(FI(I.dataType, A.scale ?? 1), FI(I.dataType, A.offset ?? 0), mA(I.dataType));
6478
6545
  }
@@ -6498,28 +6565,28 @@ class ug {
6498
6565
  return new ug(A, I);
6499
6566
  }
6500
6567
  encode(A) {
6501
- return fE(A, this.#A);
6568
+ return uE(A, this.#A);
6502
6569
  }
6503
6570
  decode(A) {
6504
- return pE(A, this.#A);
6571
+ return mE(A, this.#A);
6505
6572
  }
6506
6573
  }
6507
- function fE(g, A) {
6574
+ function uE(g, A) {
6508
6575
  let I = g.length, B = Math.floor(I / A), C = new Uint8Array(I);
6509
6576
  for (let Q = 0; Q < A; Q++)
6510
6577
  for (let E = 0; E < B; E++)
6511
6578
  C[Q * B + E] = g[E * A + Q];
6512
6579
  return C;
6513
6580
  }
6514
- function pE(g, A) {
6581
+ function mE(g, A) {
6515
6582
  let I = g.length, B = Math.floor(I / A), C = new Uint8Array(I);
6516
6583
  for (let Q = 0; Q < A; Q++)
6517
6584
  for (let E = 0; E < B; E++)
6518
6585
  C[E * A + Q] = g[Q * B + E];
6519
6586
  return C;
6520
6587
  }
6521
- function cB(g) {
6522
- return g instanceof hC || g instanceof Kg || g instanceof AI ? new Proxy(g, {
6588
+ function UB(g) {
6589
+ return g instanceof yC || g instanceof Kg || g instanceof AI ? new Proxy(g, {
6523
6590
  get(I, B) {
6524
6591
  return I.get(Number(B));
6525
6592
  },
@@ -6528,7 +6595,7 @@ function cB(g) {
6528
6595
  }
6529
6596
  }) : g;
6530
6597
  }
6531
- function uE(g, A) {
6598
+ function TE(g, A) {
6532
6599
  let I;
6533
6600
  return g.data instanceof Kg || g.data instanceof AI ? I = new g.constructor(
6534
6601
  // @ts-expect-error
@@ -6540,8 +6607,8 @@ function uE(g, A) {
6540
6607
  stride: SA(g.shape, A)
6541
6608
  };
6542
6609
  }
6543
- function mE(g, A) {
6544
- let I = uE(g, A), B = g.shape.length, C = g.data.length, Q = Array(B).fill(0), E = cB(g.data), i = cB(I.data);
6610
+ function xE(g, A) {
6611
+ let I = TE(g, A), B = g.shape.length, C = g.data.length, Q = Array(B).fill(0), E = UB(g.data), i = UB(I.data);
6545
6612
  for (let o = 0; o < C; o++) {
6546
6613
  let a = 0;
6547
6614
  for (let s = 0; s < B; s++)
@@ -6556,12 +6623,12 @@ function mE(g, A) {
6556
6623
  }
6557
6624
  return I;
6558
6625
  }
6559
- function TE(g) {
6626
+ function WE(g) {
6560
6627
  let A = g.shape.length;
6561
6628
  return IA(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);
6562
6629
  }
6563
- function xE(g, A) {
6564
- let I = TE(g);
6630
+ function bE(g, A) {
6631
+ let I = WE(g);
6565
6632
  return IA(I.length === A.length, "Orders must match"), I.every((B, C) => B === A[C]);
6566
6633
  }
6567
6634
  class mg {
@@ -6586,7 +6653,7 @@ class mg {
6586
6653
  return new mg(A, I);
6587
6654
  }
6588
6655
  encode(A) {
6589
- return xE(A, this.#I) ? A : mE(A, this.#I);
6656
+ return bE(A, this.#I) ? A : xE(A, this.#I);
6590
6657
  }
6591
6658
  decode(A) {
6592
6659
  return {
@@ -6623,25 +6690,25 @@ class Tg {
6623
6690
  }
6624
6691
  encode = NA("zlib");
6625
6692
  async decode(A) {
6626
- const I = await eC(A, { format: "deflate" });
6693
+ const I = await GC(A, { format: "deflate" });
6627
6694
  return new Uint8Array(I);
6628
6695
  }
6629
6696
  }
6630
- function WE() {
6697
+ function ZE() {
6631
6698
  let g = () => import("./blosc-D1xNXZJs.js").then((Q) => Q.default), A = () => import("./lz4-1Ws5oVWR.js").then((Q) => Q.default), I = () => import("./zstd-C4EcZnjq.js").then((Q) => Q.default), B = () => fg, C = () => Tg;
6632
6699
  return (/* @__PURE__ */ new Map()).set("blosc", g).set("lz4", A).set("zstd", I).set("gzip", B).set("zlib", C).set("transpose", () => mg).set("bytes", () => HI).set("crc32c", () => qg).set("vlen-utf8", () => SI).set("json2", () => rI).set("bitround", () => GI).set("cast_value", () => Hg).set("scale_offset", () => pg).set("numcodecs.blosc", g).set("numcodecs.lz4", A).set("numcodecs.zstd", I).set("numcodecs.gzip", B).set("numcodecs.zlib", C).set("numcodecs.vlen-utf8", () => SI).set("numcodecs.shuffle", () => ug).set("numcodecs.delta", () => lg).set("numcodecs.bitround", () => GI).set("numcodecs.json2", () => rI);
6633
6700
  }
6634
- const bE = WE();
6701
+ const PE = ZE();
6635
6702
  function ig(g) {
6636
6703
  let A;
6637
6704
  function I() {
6638
- return A || (A = ZE(g)), A;
6705
+ return A || (A = OE(g)), A;
6639
6706
  }
6640
6707
  async function B(C, Q, E) {
6641
6708
  try {
6642
6709
  return await E();
6643
6710
  } catch (i) {
6644
- throw new FE({ direction: C, codec: Q, cause: i });
6711
+ throw new SE({ direction: C, codec: Q, cause: i });
6645
6712
  }
6646
6713
  }
6647
6714
  return {
@@ -6668,23 +6735,23 @@ function ig(g) {
6668
6735
  return E;
6669
6736
  },
6670
6737
  async computeEncodedSize(C) {
6671
- let Q = await I(), E = NB(Q.arrayToBytes.name, Q.arrayToBytes.codec, C);
6738
+ let Q = await I(), E = kB(Q.arrayToBytes.name, Q.arrayToBytes.codec, C);
6672
6739
  for (const { name: i, codec: o } of Q.bytesToBytes)
6673
- E = NB(i, o, E);
6740
+ E = kB(i, o, E);
6674
6741
  return E;
6675
6742
  }
6676
6743
  };
6677
6744
  }
6678
- function NB(g, A, I) {
6745
+ function kB(g, A, I) {
6679
6746
  if (!A.computeEncodedSize)
6680
6747
  throw new X(`Codec "${g}" cannot compute its encoded size; it is not a fixed-size codec and cannot be used in a sharding index pipeline`);
6681
6748
  return A.computeEncodedSize(I);
6682
6749
  }
6683
- async function ZE(g) {
6750
+ async function OE(g) {
6684
6751
  let A = g.codecs.map(async (E) => {
6685
- let i = await bE.get(E.name)?.();
6752
+ let i = await PE.get(E.name)?.();
6686
6753
  if (!i)
6687
- throw new wE(E.name);
6754
+ throw new rE(E.name);
6688
6755
  return { Codec: i, meta: E };
6689
6756
  }), I = [], B, C = [], Q = { ...g };
6690
6757
  for await (let { Codec: E, meta: i } of A) {
@@ -6710,7 +6777,7 @@ async function ZE(g) {
6710
6777
  }
6711
6778
  }
6712
6779
  if (!B) {
6713
- if (!PE(Q))
6780
+ if (!VE(Q))
6714
6781
  throw new X(`Cannot encode ${Q.dataType} to bytes without a codec`);
6715
6782
  B = {
6716
6783
  name: "bytes",
@@ -6723,11 +6790,11 @@ async function ZE(g) {
6723
6790
  bytesToBytes: C
6724
6791
  };
6725
6792
  }
6726
- function PE(g) {
6793
+ function VE(g) {
6727
6794
  return g.dataType !== "v2:object" && g.dataType !== "string";
6728
6795
  }
6729
- const UB = 18446744073709551615n;
6730
- function OE(g, A, I, B) {
6796
+ const LB = 18446744073709551615n;
6797
+ function vE(g, A, I, B) {
6731
6798
  if (!g.store.getRange)
6732
6799
  throw new dg("sharding requires a store with getRange");
6733
6800
  let C = g.store.getRange.bind(g.store), Q = A.map((a, s) => a / B.chunk_shape[s]), E = ig({
@@ -6748,7 +6815,7 @@ function OE(g, A, I, B) {
6748
6815
  if (t === null)
6749
6816
  return;
6750
6817
  let { data: e, shape: n, stride: F } = t, G = a.map((S, r) => S % n[r]).reduce((S, r, U) => S + r * F[U], 0), L = e[G], N = e[G + 1];
6751
- if (!(L === UB && N === UB))
6818
+ if (!(L === LB && N === LB))
6752
6819
  return C(h, {
6753
6820
  offset: Number(L),
6754
6821
  length: Number(N)
@@ -6776,18 +6843,18 @@ class xg extends CA {
6776
6843
  return this.#A.attributes;
6777
6844
  }
6778
6845
  }
6779
- function kB(g) {
6846
+ function JB(g) {
6780
6847
  return g.find((I) => I.name === "transpose")?.configuration?.order ?? "C";
6781
6848
  }
6782
6849
  const CI = Symbol("zarrita.context");
6783
- function VE(g, A) {
6784
- let { configuration: I } = A.codecs.find(kE) ?? {}, B = {
6785
- encodeChunkKey: RE(A.chunk_key_encoding),
6850
+ function XE(g, A) {
6851
+ let { configuration: I } = A.codecs.find(JE) ?? {}, B = {
6852
+ encodeChunkKey: NE(A.chunk_key_encoding),
6786
6853
  TypedArray: mA(A.data_type),
6787
6854
  fillValue: A.fill_value
6788
6855
  };
6789
6856
  if (I) {
6790
- let Q = kB(I.codecs);
6857
+ let Q = JB(I.codecs);
6791
6858
  return {
6792
6859
  ...B,
6793
6860
  kind: "sharded",
@@ -6801,10 +6868,10 @@ function VE(g, A) {
6801
6868
  getStrides(E) {
6802
6869
  return SA(E, Q);
6803
6870
  },
6804
- getChunkBytes: OE(g, A.chunk_grid.configuration.chunk_shape, B.encodeChunkKey, I)
6871
+ getChunkBytes: vE(g, A.chunk_grid.configuration.chunk_shape, B.encodeChunkKey, I)
6805
6872
  };
6806
6873
  }
6807
- let C = kB(A.codecs);
6874
+ let C = JB(A.codecs);
6808
6875
  return {
6809
6876
  ...B,
6810
6877
  kind: "regular",
@@ -6831,8 +6898,8 @@ let RI = class extends CA {
6831
6898
  constructor(A, I, B) {
6832
6899
  super(A, I), this.#A = {
6833
6900
  ...B,
6834
- fill_value: tC(B)
6835
- }, this[CI] = VE(this, this.#A);
6901
+ fill_value: eC(B)
6902
+ }, this[CI] = XE(this, this.#A);
6836
6903
  }
6837
6904
  get attrs() {
6838
6905
  return this.#A.attributes;
@@ -6853,7 +6920,7 @@ let RI = class extends CA {
6853
6920
  return this.#A.data_type;
6854
6921
  }
6855
6922
  async getChunk(A, I, B) {
6856
- B?.useSharedArrayBuffer && rE();
6923
+ B?.useSharedArrayBuffer && RE();
6857
6924
  let C = this[CI], Q = await C.getChunkBytes(A, I);
6858
6925
  if (!Q) {
6859
6926
  let E = C.chunkShape.reduce((o, a) => o * a, 1), i;
@@ -6862,7 +6929,7 @@ let RI = class extends CA {
6862
6929
  if (!("BYTES_PER_ELEMENT" in o))
6863
6930
  console.warn("zarrita: useSharedArrayBuffer is not supported for non-buffer-backed data types."), i = new C.TypedArray(E);
6864
6931
  else {
6865
- let a = SE(E * o.BYTES_PER_ELEMENT);
6932
+ let a = cE(E * o.BYTES_PER_ELEMENT);
6866
6933
  i = new C.TypedArray(a, 0, E);
6867
6934
  }
6868
6935
  } else
@@ -6896,21 +6963,21 @@ let RI = class extends CA {
6896
6963
  return Qg(this.dtype, A);
6897
6964
  }
6898
6965
  };
6899
- function vE(g, A) {
6966
+ function jE(g, A) {
6900
6967
  let I = g;
6901
6968
  for (let B of A)
6902
6969
  I instanceof Promise ? I = I.then((C) => B(C)) : I = B(I);
6903
6970
  return I;
6904
6971
  }
6905
- function XE(g, ...A) {
6906
- return vE(g, A);
6972
+ function zE(g, ...A) {
6973
+ return jE(g, A);
6907
6974
  }
6908
- async function GC(g) {
6975
+ async function FC(g) {
6909
6976
  let A = g.store.arrayExtensions;
6910
- return A?.length ? await XE(g, ...A) : g;
6977
+ return A?.length ? await zE(g, ...A) : g;
6911
6978
  }
6912
- let qI = jE();
6913
- function jE() {
6979
+ let qI = _E();
6980
+ function _E() {
6914
6981
  let g = /* @__PURE__ */ new WeakMap();
6915
6982
  function A(I) {
6916
6983
  let B = g.get(I) ?? { v2: 0, v3: 0 };
@@ -6926,37 +6993,37 @@ function jE() {
6926
6993
  }
6927
6994
  };
6928
6995
  }
6929
- async function zE(g, A) {
6996
+ async function $E(g, A) {
6930
6997
  let I = await g.store.get(g.resolve(".zattrs").path, {
6931
6998
  signal: A
6932
6999
  });
6933
7000
  return I ? II(I) : {};
6934
7001
  }
6935
- async function _E(g, A = {}) {
7002
+ async function Ai(g, A = {}) {
6936
7003
  let I = "store" in g ? g : new CA(g), { signal: B } = A, C = {};
6937
- return (A.attrs ?? !0) && (C = await zE(I, B)), B?.throwIfAborted(), A.kind === "array" ? LB(I, C, B) : A.kind === "group" ? JB(I, C, B) : LB(I, C, B).catch((Q) => (yC(Q, uA, X), JB(I, C, B)));
7004
+ return (A.attrs ?? !0) && (C = await $E(I, B)), B?.throwIfAborted(), A.kind === "array" ? YB(I, C, B) : A.kind === "group" ? dB(I, C, B) : YB(I, C, B).catch((Q) => (nC(Q, uA, X), dB(I, C, B)));
6938
7005
  }
6939
- async function LB(g, A, I) {
7006
+ async function YB(g, A, I) {
6940
7007
  let { path: B } = g.resolve(".zarray"), C = await g.store.get(B, { signal: I });
6941
7008
  if (!C)
6942
7009
  throw new uA("v2 array", { path: B });
6943
- return qI.increment(g.store, "v2"), GC(new RI(g.store, g.path, NE(II(C), A)));
7010
+ return qI.increment(g.store, "v2"), FC(new RI(g.store, g.path, kE(II(C), A)));
6944
7011
  }
6945
- async function JB(g, A, I) {
7012
+ async function dB(g, A, I) {
6946
7013
  let { path: B } = g.resolve(".zgroup"), C = await g.store.get(B, { signal: I });
6947
7014
  if (!C)
6948
7015
  throw new uA("v2 group", { path: B });
6949
- return qI.increment(g.store, "v2"), new xg(g.store, g.path, UE(II(C), A));
7016
+ return qI.increment(g.store, "v2"), new xg(g.store, g.path, LE(II(C), A));
6950
7017
  }
6951
- async function $E(g, A) {
7018
+ async function Ii(g, A) {
6952
7019
  let { store: I, path: B } = g.resolve("zarr.json"), C = await g.store.get(B, { signal: A });
6953
7020
  if (!C)
6954
7021
  throw new uA("v3 array or group", { path: B });
6955
7022
  let Q = II(C);
6956
- return Q.node_type === "array" && (Q.fill_value = tC(Q)), Q.node_type === "array" ? GC(new RI(I, g.path, Q)) : new xg(I, g.path, Q);
7023
+ return Q.node_type === "array" && (Q.fill_value = eC(Q)), Q.node_type === "array" ? FC(new RI(I, g.path, Q)) : new xg(I, g.path, Q);
6957
7024
  }
6958
- async function Ai(g, A = {}) {
6959
- let I = "store" in g ? g : new CA(g), B = await $E(I, A.signal);
7025
+ async function gi(g, A = {}) {
7026
+ let I = "store" in g ? g : new CA(g), B = await Ii(I, A.signal);
6960
7027
  if (qI.increment(I.store, "v3"), A.kind === void 0 || A.kind === "array" && B instanceof RI || A.kind === "group" && B instanceof xg)
6961
7028
  return B;
6962
7029
  let C = B instanceof RI ? "array" : "group";
@@ -6967,11 +7034,11 @@ async function Ai(g, A = {}) {
6967
7034
  }
6968
7035
  async function BA(g, A = {}) {
6969
7036
  let I = "store" in g ? g.store : g, B = qI.versionMax(I), C = B === "v2" ? BA.v2 : BA.v3, Q = B === "v2" ? BA.v3 : BA.v2;
6970
- return C(g, A).catch((E) => (yC(E, uA, X), Q(g, A)));
7037
+ return C(g, A).catch((E) => (nC(E, uA, X), Q(g, A)));
6971
7038
  }
6972
- BA.v2 = _E;
6973
- BA.v3 = Ai;
6974
- async function Ii(g, A) {
7039
+ BA.v2 = Ai;
7040
+ BA.v3 = gi;
7041
+ async function Bi(g, A) {
6975
7042
  const I = A.split("/"), B = I.pop();
6976
7043
  if (!B)
6977
7044
  throw new Error("Invalid path");
@@ -6988,7 +7055,7 @@ class Wg {
6988
7055
  return this.#A;
6989
7056
  }
6990
7057
  async get(A) {
6991
- const I = await Ii(this.#A, A.slice(1)).catch(
7058
+ const I = await Bi(this.#A, A.slice(1)).catch(
6992
7059
  () => {
6993
7060
  }
6994
7061
  );
@@ -7017,7 +7084,7 @@ async function gI(g, A) {
7017
7084
  throw new Error(`Failed to open Zarr group at ${g}`);
7018
7085
  }
7019
7086
  }
7020
- async function gi(g, A) {
7087
+ async function Ci(g, A) {
7021
7088
  if (A === "v2")
7022
7089
  try {
7023
7090
  return BA.v2(g, { kind: "array", attrs: !1 });
@@ -7036,7 +7103,7 @@ async function gi(g, A) {
7036
7103
  throw new Error(`Failed to open Zarr array at ${g}`);
7037
7104
  }
7038
7105
  }
7039
- async function Bi(g) {
7106
+ async function Qi(g) {
7040
7107
  let A;
7041
7108
  switch (g.type) {
7042
7109
  case "fetch": {
@@ -7057,9 +7124,9 @@ async function Bi(g) {
7057
7124
  }
7058
7125
  }
7059
7126
  const I = g.arrayPath ? A.resolve(g.arrayPath) : A;
7060
- return gi(I, g.zarrVersion);
7127
+ return Ci(I, g.zarrVersion);
7061
7128
  }
7062
- function Ci(g, A, I) {
7129
+ function Ei(g, A, I) {
7063
7130
  if (g.store instanceof _A)
7064
7131
  return {
7065
7132
  type: "fetch",
@@ -7079,10 +7146,10 @@ function Ci(g, A, I) {
7079
7146
  `Unsupported store type: ${g.store.constructor.name}`
7080
7147
  );
7081
7148
  }
7082
- function Qi(g, A, I, B) {
7083
- return Ei(g, A, I, B);
7149
+ function ii(g, A, I, B) {
7150
+ return oi(g, A, I, B);
7084
7151
  }
7085
- function Ei(g, A, I, B) {
7152
+ function oi(g, A, I, B) {
7086
7153
  const { targetShape: C, chunkIndex: Q, dimIndices: E } = B;
7087
7154
  let i = 1;
7088
7155
  for (let r = A.length - 1; r >= 0; r--) {
@@ -7117,7 +7184,7 @@ function Ei(g, A, I, B) {
7117
7184
  }
7118
7185
  return G;
7119
7186
  }
7120
- const wC = `function xg(B, A) {
7187
+ const rC = `function xg(B, A) {
7121
7188
  return {
7122
7189
  ...B,
7123
7190
  ...A,
@@ -10771,11 +10838,11 @@ return ret;
10771
10838
  default: IQ
10772
10839
  });
10773
10840
  //# sourceMappingURL=worker_kernel-CBlE4MBI.js.map
10774
- `, YB = typeof self < "u" && self.Blob && new Blob(["URL.revokeObjectURL(import.meta.url);", wC], { type: "text/javascript;charset=utf-8" });
10775
- function ii(g) {
10841
+ `, MB = typeof self < "u" && self.Blob && new Blob(["URL.revokeObjectURL(import.meta.url);", rC], { type: "text/javascript;charset=utf-8" });
10842
+ function ai(g) {
10776
10843
  let A;
10777
10844
  try {
10778
- if (A = YB && (self.URL || self.webkitURL).createObjectURL(YB), !A) throw "";
10845
+ if (A = MB && (self.URL || self.webkitURL).createObjectURL(MB), !A) throw "";
10779
10846
  const I = new Worker(A, {
10780
10847
  type: "module",
10781
10848
  name: g?.name
@@ -10785,7 +10852,7 @@ function ii(g) {
10785
10852
  }), I;
10786
10853
  } catch {
10787
10854
  return new Worker(
10788
- "data:text/javascript;charset=utf-8," + encodeURIComponent(wC),
10855
+ "data:text/javascript;charset=utf-8," + encodeURIComponent(rC),
10789
10856
  {
10790
10857
  type: "module",
10791
10858
  name: g?.name
@@ -10793,17 +10860,17 @@ function ii(g) {
10793
10860
  );
10794
10861
  }
10795
10862
  }
10796
- const oi = Math.max(1, navigator.hardwareConcurrency - 2);
10797
- let iA = [], ai = 0, FC = 0;
10863
+ const si = Math.max(1, navigator.hardwareConcurrency - 2);
10864
+ let iA = [], Di = 0, SC = 0;
10798
10865
  const RA = /* @__PURE__ */ new Map(), cI = /* @__PURE__ */ new Set();
10799
- function rC(g) {
10866
+ function RC(g) {
10800
10867
  const A = iA.find((I) => I.worker === g);
10801
10868
  return A || k.error(
10802
10869
  "ZarrWorker",
10803
10870
  "Worker not found in pool - this should not happen"
10804
10871
  ), A;
10805
10872
  }
10806
- function si(g, A) {
10873
+ function hi(g, A) {
10807
10874
  const { id: I, success: B } = g.data, C = RA.get(I);
10808
10875
  if (!C) {
10809
10876
  cI.has(I) ? cI.delete(I) : k.warn(
@@ -10814,13 +10881,13 @@ function si(g, A) {
10814
10881
  return;
10815
10882
  }
10816
10883
  RA.delete(I), C.abortListener && C.abortSignal && C.abortSignal.removeEventListener("abort", C.abortListener);
10817
- const Q = rC(A);
10884
+ const Q = RC(A);
10818
10885
  Q && Q.pendingCount > 0 ? Q.pendingCount-- : Q && k.error(
10819
10886
  "ZarrWorker",
10820
10887
  "Received message but no pending tasks - this should not happen"
10821
10888
  ), B && g.data.type === "getChunk" ? C.resolve(g.data.data) : B || C.reject(new Error(g.data.error || "Unknown worker error"));
10822
10889
  }
10823
- function dB(g, A) {
10890
+ function KB(g, A) {
10824
10891
  if (g instanceof MessageEvent) {
10825
10892
  k.error(
10826
10893
  "ZarrWorker",
@@ -10833,7 +10900,7 @@ function dB(g, A) {
10833
10900
  "Worker failed - replacing worker and canceling its in-flight messages",
10834
10901
  g.message
10835
10902
  );
10836
- const I = rC(A);
10903
+ const I = RC(A);
10837
10904
  if (I) {
10838
10905
  const C = iA.indexOf(I);
10839
10906
  iA.splice(C, 1);
@@ -10843,31 +10910,31 @@ function dB(g, A) {
10843
10910
  for (const [C, Q] of RA.entries())
10844
10911
  Q.workerId === B && (Q.reject(new Error(`Worker error: ${g.message}`)), RA.delete(C));
10845
10912
  try {
10846
- const C = SC();
10913
+ const C = cC();
10847
10914
  iA.push({
10848
10915
  worker: C,
10849
10916
  pendingCount: 0,
10850
- workerId: FC++
10917
+ workerId: SC++
10851
10918
  }), k.debug("ZarrWorker", "Replacement worker created successfully");
10852
10919
  } catch (C) {
10853
10920
  k.error("ZarrWorker", "Failed to create replacement worker", C);
10854
10921
  }
10855
10922
  }
10856
- function SC() {
10857
- const g = new ii();
10858
- return g.addEventListener("message", (A) => si(A, g)), g.addEventListener("error", (A) => dB(A, g)), g.addEventListener(
10923
+ function cC() {
10924
+ const g = new ai();
10925
+ return g.addEventListener("message", (A) => hi(A, g)), g.addEventListener("error", (A) => KB(A, g)), g.addEventListener(
10859
10926
  "messageerror",
10860
- (A) => dB(A, g)
10927
+ (A) => KB(A, g)
10861
10928
  ), g;
10862
10929
  }
10863
- function Di() {
10930
+ function ti() {
10864
10931
  if (iA.length === 0)
10865
10932
  throw new Error("Worker pool is not initialized");
10866
10933
  return iA.sort((g, A) => g.pendingCount - A.pendingCount)[0];
10867
10934
  }
10868
- async function hi(g, A, I, B) {
10935
+ async function yi(g, A, I, B) {
10869
10936
  return new Promise((C, Q) => {
10870
- const E = Di(), i = ai++, o = {
10937
+ const E = ti(), i = Di++, o = {
10871
10938
  resolve: C,
10872
10939
  reject: Q,
10873
10940
  workerId: E.workerId
@@ -10894,15 +10961,15 @@ async function hi(g, A, I, B) {
10894
10961
  });
10895
10962
  });
10896
10963
  }
10897
- function ti() {
10964
+ function ei() {
10898
10965
  if (!(iA.length > 0))
10899
10966
  try {
10900
- for (let g = 0; g < oi; g++) {
10901
- const A = SC();
10967
+ for (let g = 0; g < si; g++) {
10968
+ const A = cC();
10902
10969
  iA.push({
10903
10970
  worker: A,
10904
10971
  pendingCount: 0,
10905
- workerId: FC++
10972
+ workerId: SC++
10906
10973
  });
10907
10974
  }
10908
10975
  k.debug(
@@ -10910,14 +10977,14 @@ function ti() {
10910
10977
  `Initialized worker pool with ${iA.length} workers`
10911
10978
  );
10912
10979
  } catch {
10913
- k.warn("ZarrWorker", "Failed to create workers - clearing pool"), ei();
10980
+ k.warn("ZarrWorker", "Failed to create workers - clearing pool"), Gi();
10914
10981
  return;
10915
10982
  }
10916
10983
  }
10917
- async function yi(g, A, I, B, C) {
10918
- ti();
10984
+ async function ni(g, A, I, B, C) {
10985
+ ei();
10919
10986
  try {
10920
- return await hi(
10987
+ return await yi(
10921
10988
  A,
10922
10989
  I,
10923
10990
  B,
@@ -10928,11 +10995,11 @@ async function yi(g, A, I, B, C) {
10928
10995
  throw Q;
10929
10996
  k.warn("ZarrWorker", "Falling back to main thread", Q);
10930
10997
  const E = await g.getChunk(I, C);
10931
- if (!dQ(E.data))
10998
+ if (!KQ(E.data))
10932
10999
  throw new Error(
10933
11000
  `Unsupported chunk data type: ${E.data.constructor.name}`
10934
11001
  );
10935
- return Qi(
11002
+ return ii(
10936
11003
  E.data,
10937
11004
  E.shape,
10938
11005
  E.stride,
@@ -10940,19 +11007,19 @@ async function yi(g, A, I, B, C) {
10940
11007
  );
10941
11008
  }
10942
11009
  }
10943
- function ei() {
11010
+ function Gi() {
10944
11011
  for (const g of iA)
10945
11012
  g.worker.terminate();
10946
11013
  iA = [], RA.clear();
10947
11014
  }
10948
- class ni {
11015
+ class wi {
10949
11016
  metadata_;
10950
11017
  arrays_;
10951
11018
  arrayParams_;
10952
11019
  dimensions_;
10953
11020
  bytesPerElement_;
10954
11021
  constructor(A) {
10955
- this.metadata_ = A.metadata, this.arrays_ = A.arrays, this.arrayParams_ = A.arrayParams, this.dimensions_ = wi(this.metadata_, this.arrays_), this.bytesPerElement_ = Gi(this.arrays_[0].dtype);
11022
+ this.metadata_ = A.metadata, this.arrays_ = A.arrays, this.arrayParams_ = A.arrayParams, this.dimensions_ = ri(this.metadata_, this.arrays_), this.bytesPerElement_ = Fi(this.arrays_[0].dtype);
10956
11023
  }
10957
11024
  getSourceDimensionMap() {
10958
11025
  return this.dimensions_;
@@ -10986,21 +11053,21 @@ class ni {
10986
11053
  },
10987
11054
  cChunkSize: E?.chunkSize,
10988
11055
  tChunkSize: i?.chunkSize
10989
- }, a = await yi(
11056
+ }, a = await ni(
10990
11057
  C,
10991
11058
  Q,
10992
11059
  B,
10993
11060
  o,
10994
11061
  { signal: I }
10995
11062
  ), s = a.BYTES_PER_ELEMENT;
10996
- if (!wQ(s))
11063
+ if (!rQ(s))
10997
11064
  throw new Error(
10998
11065
  "Invalid row alignment value. Possible values are 1, 2, 4, or 8"
10999
11066
  );
11000
- A.rowAlignmentBytes = s, JQ(A, a);
11067
+ A.rowAlignmentBytes = s, dQ(A, a);
11001
11068
  }
11002
11069
  }
11003
- const MB = {
11070
+ const HB = {
11004
11071
  int8: 1,
11005
11072
  uint8: 1,
11006
11073
  int16: 2,
@@ -11009,16 +11076,16 @@ const MB = {
11009
11076
  uint32: 4,
11010
11077
  float32: 4
11011
11078
  };
11012
- function Gi(g) {
11013
- const A = MB[g];
11079
+ function Fi(g) {
11080
+ const A = HB[g];
11014
11081
  if (A === void 0)
11015
11082
  throw new Error(
11016
- `Unsupported zarr dtype "${g}". Supported dtypes: ${Object.keys(MB).join(", ")}`
11083
+ `Unsupported zarr dtype "${g}". Supported dtypes: ${Object.keys(HB).join(", ")}`
11017
11084
  );
11018
11085
  return A;
11019
11086
  }
11020
- function wi(g, A) {
11021
- const I = g.axes.map((D) => D.name), B = g.axes.length, C = KB(I, "x"), Q = KB(I, "y"), E = (D, h) => {
11087
+ function ri(g, A) {
11088
+ const I = g.axes.map((D) => D.name), B = g.axes.length, C = qB(I, "x"), Q = qB(I, "y"), E = (D, h) => {
11022
11089
  const t = [];
11023
11090
  for (let e = 0; e < g.datasets.length; e++) {
11024
11091
  const n = g.datasets[e], F = A[e], G = n.coordinateTransformations[0].scale, L = n.coordinateTransformations.length === 2 ? n.coordinateTransformations[1].translation : new Array(B).fill(0);
@@ -11029,7 +11096,7 @@ function wi(g, A) {
11029
11096
  translation: L[h]
11030
11097
  });
11031
11098
  }
11032
- if (g.axes[h].type === "space" && ri(t))
11099
+ if (g.axes[h].type === "space" && Ri(t))
11033
11100
  for (const e of t) e.translation -= 0.5 * e.scale;
11034
11101
  return {
11035
11102
  name: D,
@@ -11048,10 +11115,10 @@ function wi(g, A) {
11048
11115
  const s = iI(I, "t");
11049
11116
  return s !== -1 && (i.t = E(I[s], s)), i;
11050
11117
  }
11051
- function Fi(g, A) {
11118
+ function Si(g, A) {
11052
11119
  return g.toLowerCase() === A.toLowerCase();
11053
11120
  }
11054
- function KB(g, A) {
11121
+ function qB(g, A) {
11055
11122
  const I = iI(g, A);
11056
11123
  if (I === -1)
11057
11124
  throw new Error(
@@ -11060,9 +11127,9 @@ function KB(g, A) {
11060
11127
  return I;
11061
11128
  }
11062
11129
  function iI(g, A) {
11063
- return g.findIndex((I) => Fi(I, A));
11130
+ return g.findIndex((I) => Si(I, A));
11064
11131
  }
11065
- function ri(g) {
11132
+ function Ri(g) {
11066
11133
  if (g.length <= 1) return !1;
11067
11134
  for (let A = 1; A < g.length; A++) {
11068
11135
  const I = 0.5 * (g[A].scale - g[A - 1].scale), B = g[A].translation - g[A - 1].translation;
@@ -11107,14 +11174,14 @@ var f;
11107
11174
  }
11108
11175
  g.joinValues = B, g.jsonStringifyReplacer = (C, Q) => typeof Q == "bigint" ? Q.toString() : Q;
11109
11176
  })(f || (f = {}));
11110
- var HB;
11177
+ var lB;
11111
11178
  (function(g) {
11112
11179
  g.mergeShapes = (A, I) => ({
11113
11180
  ...A,
11114
11181
  ...I
11115
11182
  // second overwrites first
11116
11183
  });
11117
- })(HB || (HB = {}));
11184
+ })(lB || (lB = {}));
11118
11185
  const R = f.arrayToEnum([
11119
11186
  "string",
11120
11187
  "nan",
@@ -11295,11 +11362,11 @@ const og = (g, A) => {
11295
11362
  }
11296
11363
  return { message: I };
11297
11364
  };
11298
- let Si = og;
11299
- function Ri() {
11300
- return Si;
11365
+ let ci = og;
11366
+ function Ni() {
11367
+ return ci;
11301
11368
  }
11302
- const ci = (g) => {
11369
+ const Ui = (g) => {
11303
11370
  const { data: A, path: I, errorMaps: B, issueData: C } = g, Q = [...I, ...C.path || []], E = {
11304
11371
  ...C,
11305
11372
  path: Q
@@ -11321,7 +11388,7 @@ const ci = (g) => {
11321
11388
  };
11322
11389
  };
11323
11390
  function w(g, A) {
11324
- const I = Ri(), B = ci({
11391
+ const I = Ni(), B = Ui({
11325
11392
  issueData: A,
11326
11393
  data: g.data,
11327
11394
  path: g.path,
@@ -11381,7 +11448,7 @@ class gA {
11381
11448
  }
11382
11449
  const Y = Object.freeze({
11383
11450
  status: "aborted"
11384
- }), WA = (g) => ({ status: "dirty", value: g }), QA = (g) => ({ status: "valid", value: g }), qB = (g) => g.status === "aborted", lB = (g) => g.status === "dirty", MA = (g) => g.status === "valid", NI = (g) => typeof Promise < "u" && g instanceof Promise;
11451
+ }), WA = (g) => ({ status: "dirty", value: g }), QA = (g) => ({ status: "valid", value: g }), fB = (g) => g.status === "aborted", pB = (g) => g.status === "dirty", MA = (g) => g.status === "valid", NI = (g) => typeof Promise < "u" && g instanceof Promise;
11385
11452
  var c;
11386
11453
  (function(g) {
11387
11454
  g.errToObj = (A) => typeof A == "string" ? { message: A } : A || {}, g.toString = (A) => typeof A == "string" ? A : A?.message;
@@ -11394,7 +11461,7 @@ class wA {
11394
11461
  return this._cachedPath.length || (Array.isArray(this._key) ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
11395
11462
  }
11396
11463
  }
11397
- const fB = (g, A) => {
11464
+ const uB = (g, A) => {
11398
11465
  if (MA(A))
11399
11466
  return { success: !0, data: A.value };
11400
11467
  if (!g.common.issues.length)
@@ -11479,7 +11546,7 @@ class q {
11479
11546
  data: A,
11480
11547
  parsedType: yA(A)
11481
11548
  }, C = this._parseSync({ data: A, path: B.path, parent: B });
11482
- return fB(B, C);
11549
+ return uB(B, C);
11483
11550
  }
11484
11551
  "~validate"(A) {
11485
11552
  const I = {
@@ -11532,7 +11599,7 @@ class q {
11532
11599
  data: A,
11533
11600
  parsedType: yA(A)
11534
11601
  }, C = this._parse({ data: A, path: B.path, parent: B }), Q = await (NI(C) ? C : Promise.resolve(C));
11535
- return fB(B, Q);
11602
+ return uB(B, Q);
11536
11603
  }
11537
11604
  refine(A, I) {
11538
11605
  const B = (C) => typeof I == "string" || typeof I > "u" ? { message: I } : typeof I == "function" ? I(C) : I;
@@ -11603,7 +11670,7 @@ class q {
11603
11670
  });
11604
11671
  }
11605
11672
  brand() {
11606
- return new Oi({
11673
+ return new vi({
11607
11674
  typeName: d.ZodBranded,
11608
11675
  type: this,
11609
11676
  ...K(this._def)
@@ -11638,28 +11705,28 @@ class q {
11638
11705
  return this.safeParse(null).success;
11639
11706
  }
11640
11707
  }
11641
- const Ni = /^c[^\s-]{8,}$/i, Ui = /^[0-9a-z]+$/, ki = /^[0-9A-HJKMNP-TV-Z]{26}$/i, Li = /^[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, Ji = /^[a-z0-9_-]{21}$/i, Yi = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, di = /^[-+]?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)?)??$/, Mi = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Ki = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
11708
+ const ki = /^c[^\s-]{8,}$/i, Li = /^[0-9a-z]+$/, Ji = /^[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, di = /^[a-z0-9_-]{21}$/i, Mi = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, Ki = /^[-+]?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)?)??$/, Hi = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, qi = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
11642
11709
  let VI;
11643
- const Hi = /^(?:(?: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])$/, qi = /^(?:(?: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])$/, li = /^(([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]))$/, fi = /^(([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])$/, pi = /^([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}(=)?))?$/, RC = "((\\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])))", mi = new RegExp(`^${RC}$`);
11644
- function cC(g) {
11710
+ const li = /^(?:(?: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])$/, 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])\/(3[0-2]|[12]?[0-9])$/, pi = /^(([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]))$/, ui = /^(([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])$/, mi = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Ti = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, NC = "((\\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])))", xi = new RegExp(`^${NC}$`);
11711
+ function UC(g) {
11645
11712
  let A = "[0-5]\\d";
11646
11713
  g.precision ? A = `${A}\\.\\d{${g.precision}}` : g.precision == null && (A = `${A}(\\.\\d+)?`);
11647
11714
  const I = g.precision ? "+" : "?";
11648
11715
  return `([01]\\d|2[0-3]):[0-5]\\d(:${A})${I}`;
11649
11716
  }
11650
- function Ti(g) {
11651
- return new RegExp(`^${cC(g)}$`);
11717
+ function Wi(g) {
11718
+ return new RegExp(`^${UC(g)}$`);
11652
11719
  }
11653
- function xi(g) {
11654
- let A = `${RC}T${cC(g)}`;
11720
+ function bi(g) {
11721
+ let A = `${NC}T${UC(g)}`;
11655
11722
  const I = [];
11656
11723
  return I.push(g.local ? "Z?" : "Z"), g.offset && I.push("([+-]\\d{2}:?\\d{2})"), A = `${A}(${I.join("|")})`, new RegExp(`^${A}$`);
11657
11724
  }
11658
- function Wi(g, A) {
11659
- return !!((A === "v4" || !A) && Hi.test(g) || (A === "v6" || !A) && li.test(g));
11725
+ function Zi(g, A) {
11726
+ return !!((A === "v4" || !A) && li.test(g) || (A === "v6" || !A) && pi.test(g));
11660
11727
  }
11661
- function bi(g, A) {
11662
- if (!Yi.test(g))
11728
+ function Pi(g, A) {
11729
+ if (!Mi.test(g))
11663
11730
  return !1;
11664
11731
  try {
11665
11732
  const [I] = g.split(".");
@@ -11671,8 +11738,8 @@ function bi(g, A) {
11671
11738
  return !1;
11672
11739
  }
11673
11740
  }
11674
- function Zi(g, A) {
11675
- return !!((A === "v4" || !A) && qi.test(g) || (A === "v6" || !A) && fi.test(g));
11741
+ function Oi(g, A) {
11742
+ return !!((A === "v4" || !A) && fi.test(g) || (A === "v6" || !A) && ui.test(g));
11676
11743
  }
11677
11744
  class eA extends q {
11678
11745
  _parse(A) {
@@ -11723,43 +11790,43 @@ class eA extends q {
11723
11790
  message: Q.message
11724
11791
  }), B.dirty());
11725
11792
  } else if (Q.kind === "email")
11726
- Mi.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
11793
+ Hi.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
11727
11794
  validation: "email",
11728
11795
  code: y.invalid_string,
11729
11796
  message: Q.message
11730
11797
  }), B.dirty());
11731
11798
  else if (Q.kind === "emoji")
11732
- VI || (VI = new RegExp(Ki, "u")), VI.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
11799
+ VI || (VI = new RegExp(qi, "u")), VI.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
11733
11800
  validation: "emoji",
11734
11801
  code: y.invalid_string,
11735
11802
  message: Q.message
11736
11803
  }), B.dirty());
11737
11804
  else if (Q.kind === "uuid")
11738
- Li.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
11805
+ Yi.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
11739
11806
  validation: "uuid",
11740
11807
  code: y.invalid_string,
11741
11808
  message: Q.message
11742
11809
  }), B.dirty());
11743
11810
  else if (Q.kind === "nanoid")
11744
- Ji.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
11811
+ di.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
11745
11812
  validation: "nanoid",
11746
11813
  code: y.invalid_string,
11747
11814
  message: Q.message
11748
11815
  }), B.dirty());
11749
11816
  else if (Q.kind === "cuid")
11750
- Ni.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
11817
+ ki.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
11751
11818
  validation: "cuid",
11752
11819
  code: y.invalid_string,
11753
11820
  message: Q.message
11754
11821
  }), B.dirty());
11755
11822
  else if (Q.kind === "cuid2")
11756
- Ui.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
11823
+ Li.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
11757
11824
  validation: "cuid2",
11758
11825
  code: y.invalid_string,
11759
11826
  message: Q.message
11760
11827
  }), B.dirty());
11761
11828
  else if (Q.kind === "ulid")
11762
- ki.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
11829
+ Ji.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
11763
11830
  validation: "ulid",
11764
11831
  code: y.invalid_string,
11765
11832
  message: Q.message
@@ -11790,39 +11857,39 @@ class eA extends q {
11790
11857
  code: y.invalid_string,
11791
11858
  validation: { endsWith: Q.value },
11792
11859
  message: Q.message
11793
- }), B.dirty()) : Q.kind === "datetime" ? xi(Q).test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
11860
+ }), B.dirty()) : Q.kind === "datetime" ? bi(Q).test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
11794
11861
  code: y.invalid_string,
11795
11862
  validation: "datetime",
11796
11863
  message: Q.message
11797
- }), B.dirty()) : Q.kind === "date" ? mi.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
11864
+ }), B.dirty()) : Q.kind === "date" ? xi.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
11798
11865
  code: y.invalid_string,
11799
11866
  validation: "date",
11800
11867
  message: Q.message
11801
- }), B.dirty()) : Q.kind === "time" ? Ti(Q).test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
11868
+ }), B.dirty()) : Q.kind === "time" ? Wi(Q).test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
11802
11869
  code: y.invalid_string,
11803
11870
  validation: "time",
11804
11871
  message: Q.message
11805
- }), B.dirty()) : Q.kind === "duration" ? di.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
11872
+ }), B.dirty()) : Q.kind === "duration" ? Ki.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
11806
11873
  validation: "duration",
11807
11874
  code: y.invalid_string,
11808
11875
  message: Q.message
11809
- }), B.dirty()) : Q.kind === "ip" ? Wi(A.data, Q.version) || (C = this._getOrReturnCtx(A, C), w(C, {
11876
+ }), B.dirty()) : Q.kind === "ip" ? Zi(A.data, Q.version) || (C = this._getOrReturnCtx(A, C), w(C, {
11810
11877
  validation: "ip",
11811
11878
  code: y.invalid_string,
11812
11879
  message: Q.message
11813
- }), B.dirty()) : Q.kind === "jwt" ? bi(A.data, Q.alg) || (C = this._getOrReturnCtx(A, C), w(C, {
11880
+ }), B.dirty()) : Q.kind === "jwt" ? Pi(A.data, Q.alg) || (C = this._getOrReturnCtx(A, C), w(C, {
11814
11881
  validation: "jwt",
11815
11882
  code: y.invalid_string,
11816
11883
  message: Q.message
11817
- }), B.dirty()) : Q.kind === "cidr" ? Zi(A.data, Q.version) || (C = this._getOrReturnCtx(A, C), w(C, {
11884
+ }), B.dirty()) : Q.kind === "cidr" ? Oi(A.data, Q.version) || (C = this._getOrReturnCtx(A, C), w(C, {
11818
11885
  validation: "cidr",
11819
11886
  code: y.invalid_string,
11820
11887
  message: Q.message
11821
- }), B.dirty()) : Q.kind === "base64" ? pi.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
11888
+ }), B.dirty()) : Q.kind === "base64" ? mi.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
11822
11889
  validation: "base64",
11823
11890
  code: y.invalid_string,
11824
11891
  message: Q.message
11825
- }), B.dirty()) : Q.kind === "base64url" ? ui.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
11892
+ }), B.dirty()) : Q.kind === "base64url" ? Ti.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
11826
11893
  validation: "base64url",
11827
11894
  code: y.invalid_string,
11828
11895
  message: Q.message
@@ -12057,7 +12124,7 @@ eA.create = (g) => new eA({
12057
12124
  coerce: g?.coerce ?? !1,
12058
12125
  ...K(g)
12059
12126
  });
12060
- function Pi(g, A) {
12127
+ function Vi(g, A) {
12061
12128
  const I = (g.toString().split(".")[1] || "").length, B = (A.toString().split(".")[1] || "").length, C = I > B ? I : B, Q = Number.parseInt(g.toFixed(C).replace(".", "")), E = Number.parseInt(A.toFixed(C).replace(".", ""));
12062
12129
  return Q % E / 10 ** C;
12063
12130
  }
@@ -12096,7 +12163,7 @@ class KA extends q {
12096
12163
  inclusive: Q.inclusive,
12097
12164
  exact: !1,
12098
12165
  message: Q.message
12099
- }), C.dirty()) : Q.kind === "multipleOf" ? Pi(A.data, Q.value) !== 0 && (B = this._getOrReturnCtx(A, B), w(B, {
12166
+ }), C.dirty()) : Q.kind === "multipleOf" ? Vi(A.data, Q.value) !== 0 && (B = this._getOrReturnCtx(A, B), w(B, {
12100
12167
  code: y.not_multiple_of,
12101
12168
  multipleOf: Q.value,
12102
12169
  message: Q.message
@@ -12462,7 +12529,7 @@ UI.create = (g) => new UI({
12462
12529
  typeName: d.ZodDate,
12463
12530
  ...K(g)
12464
12531
  });
12465
- class pB extends q {
12532
+ class mB extends q {
12466
12533
  _parse(A) {
12467
12534
  if (this._getType(A) !== R.symbol) {
12468
12535
  const B = this._getOrReturnCtx(A);
@@ -12475,11 +12542,11 @@ class pB extends q {
12475
12542
  return QA(A.data);
12476
12543
  }
12477
12544
  }
12478
- pB.create = (g) => new pB({
12545
+ mB.create = (g) => new mB({
12479
12546
  typeName: d.ZodSymbol,
12480
12547
  ...K(g)
12481
12548
  });
12482
- class uB extends q {
12549
+ class TB extends q {
12483
12550
  _parse(A) {
12484
12551
  if (this._getType(A) !== R.undefined) {
12485
12552
  const B = this._getOrReturnCtx(A);
@@ -12492,11 +12559,11 @@ class uB extends q {
12492
12559
  return QA(A.data);
12493
12560
  }
12494
12561
  }
12495
- uB.create = (g) => new uB({
12562
+ TB.create = (g) => new TB({
12496
12563
  typeName: d.ZodUndefined,
12497
12564
  ...K(g)
12498
12565
  });
12499
- class mB extends q {
12566
+ class xB extends q {
12500
12567
  _parse(A) {
12501
12568
  if (this._getType(A) !== R.null) {
12502
12569
  const B = this._getOrReturnCtx(A);
@@ -12509,7 +12576,7 @@ class mB extends q {
12509
12576
  return QA(A.data);
12510
12577
  }
12511
12578
  }
12512
- mB.create = (g) => new mB({
12579
+ xB.create = (g) => new xB({
12513
12580
  typeName: d.ZodNull,
12514
12581
  ...K(g)
12515
12582
  });
@@ -12525,7 +12592,7 @@ sg.create = (g) => new sg({
12525
12592
  typeName: d.ZodAny,
12526
12593
  ...K(g)
12527
12594
  });
12528
- class TB extends q {
12595
+ class WB extends q {
12529
12596
  constructor() {
12530
12597
  super(...arguments), this._unknown = !0;
12531
12598
  }
@@ -12533,7 +12600,7 @@ class TB extends q {
12533
12600
  return QA(A.data);
12534
12601
  }
12535
12602
  }
12536
- TB.create = (g) => new TB({
12603
+ WB.create = (g) => new WB({
12537
12604
  typeName: d.ZodUnknown,
12538
12605
  ...K(g)
12539
12606
  });
@@ -12551,7 +12618,7 @@ FA.create = (g) => new FA({
12551
12618
  typeName: d.ZodNever,
12552
12619
  ...K(g)
12553
12620
  });
12554
- class xB extends q {
12621
+ class bB extends q {
12555
12622
  _parse(A) {
12556
12623
  if (this._getType(A) !== R.undefined) {
12557
12624
  const B = this._getOrReturnCtx(A);
@@ -12564,7 +12631,7 @@ class xB extends q {
12564
12631
  return QA(A.data);
12565
12632
  }
12566
12633
  }
12567
- xB.create = (g) => new xB({
12634
+ bB.create = (g) => new bB({
12568
12635
  typeName: d.ZodVoid,
12569
12636
  ...K(g)
12570
12637
  });
@@ -12920,7 +12987,7 @@ class V extends q {
12920
12987
  });
12921
12988
  }
12922
12989
  keyof() {
12923
- return NC(f.objectKeys(this.shape));
12990
+ return kC(f.objectKeys(this.shape));
12924
12991
  }
12925
12992
  }
12926
12993
  V.create = (g, A) => new V({
@@ -13046,10 +13113,10 @@ function Dg(g, A) {
13046
13113
  class LI extends q {
13047
13114
  _parse(A) {
13048
13115
  const { status: I, ctx: B } = this._processInputParams(A), C = (Q, E) => {
13049
- if (qB(Q) || qB(E))
13116
+ if (fB(Q) || fB(E))
13050
13117
  return Y;
13051
13118
  const i = Dg(Q.value, E.value);
13052
- return i.valid ? ((lB(Q) || lB(E)) && I.dirty(), { status: I.value, value: i.data }) : (w(B, {
13119
+ return i.valid ? ((pB(Q) || pB(E)) && I.dirty(), { status: I.value, value: i.data }) : (w(B, {
13053
13120
  code: y.invalid_intersection_types
13054
13121
  }), Y);
13055
13122
  };
@@ -13131,7 +13198,7 @@ cA.create = (g, A) => {
13131
13198
  ...K(A)
13132
13199
  });
13133
13200
  };
13134
- class WB extends q {
13201
+ class ZB extends q {
13135
13202
  get keySchema() {
13136
13203
  return this._def.keyType;
13137
13204
  }
@@ -13173,7 +13240,7 @@ class WB extends q {
13173
13240
  }
13174
13241
  }
13175
13242
  }
13176
- WB.create = (g, A, I) => new WB({
13243
+ ZB.create = (g, A, I) => new ZB({
13177
13244
  valueType: A,
13178
13245
  keyType: g,
13179
13246
  typeName: d.ZodMap,
@@ -13243,7 +13310,7 @@ jA.create = (g, A) => new jA({
13243
13310
  typeName: d.ZodSet,
13244
13311
  ...K(A)
13245
13312
  });
13246
- class bB extends q {
13313
+ class PB extends q {
13247
13314
  get schema() {
13248
13315
  return this._def.getter();
13249
13316
  }
@@ -13252,7 +13319,7 @@ class bB extends q {
13252
13319
  return this._def.getter()._parse({ data: I.data, path: I.path, parent: I });
13253
13320
  }
13254
13321
  }
13255
- bB.create = (g, A) => new bB({
13322
+ PB.create = (g, A) => new PB({
13256
13323
  getter: g,
13257
13324
  typeName: d.ZodLazy,
13258
13325
  ...K(A)
@@ -13278,7 +13345,7 @@ hg.create = (g, A) => new hg({
13278
13345
  typeName: d.ZodLiteral,
13279
13346
  ...K(A)
13280
13347
  });
13281
- function NC(g, A) {
13348
+ function kC(g, A) {
13282
13349
  return new HA({
13283
13350
  values: g,
13284
13351
  typeName: d.ZodEnum,
@@ -13339,8 +13406,8 @@ class HA extends q {
13339
13406
  });
13340
13407
  }
13341
13408
  }
13342
- HA.create = NC;
13343
- class ZB extends q {
13409
+ HA.create = kC;
13410
+ class OB extends q {
13344
13411
  _parse(A) {
13345
13412
  const I = f.getValidEnumValues(this._def.values), B = this._getOrReturnCtx(A);
13346
13413
  if (B.parsedType !== R.string && B.parsedType !== R.number) {
@@ -13365,7 +13432,7 @@ class ZB extends q {
13365
13432
  return this._def.values;
13366
13433
  }
13367
13434
  }
13368
- ZB.create = (g, A) => new ZB({
13435
+ OB.create = (g, A) => new OB({
13369
13436
  values: g,
13370
13437
  typeName: d.ZodNativeEnum,
13371
13438
  ...K(A)
@@ -13575,7 +13642,7 @@ yg.create = (g, A) => new yg({
13575
13642
  catchValue: typeof A.catch == "function" ? A.catch : () => A.catch,
13576
13643
  ...K(A)
13577
13644
  });
13578
- class PB extends q {
13645
+ class VB extends q {
13579
13646
  _parse(A) {
13580
13647
  if (this._getType(A) !== R.nan) {
13581
13648
  const B = this._getOrReturnCtx(A);
@@ -13588,11 +13655,11 @@ class PB extends q {
13588
13655
  return { status: "valid", value: A.data };
13589
13656
  }
13590
13657
  }
13591
- PB.create = (g) => new PB({
13658
+ VB.create = (g) => new VB({
13592
13659
  typeName: d.ZodNaN,
13593
13660
  ...K(g)
13594
13661
  });
13595
- class Oi extends q {
13662
+ class vi extends q {
13596
13663
  _parse(A) {
13597
13664
  const { ctx: I } = this._processInputParams(A), B = I.data;
13598
13665
  return this._def.type._parse({
@@ -13663,17 +13730,17 @@ var d;
13663
13730
  (function(g) {
13664
13731
  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";
13665
13732
  })(d || (d = {}));
13666
- const u = eA.create, H = KA.create, UC = ag.create, nA = sg.create;
13733
+ const u = eA.create, H = KA.create, LC = ag.create, nA = sg.create;
13667
13734
  FA.create;
13668
13735
  const p = DA.create, J = V.create;
13669
13736
  kI.create;
13670
13737
  LI.create;
13671
13738
  cA.create;
13672
- const _ = hg.create, LA = HA.create;
13739
+ const $ = hg.create, LA = HA.create;
13673
13740
  JI.create;
13674
13741
  GA.create;
13675
13742
  lA.create;
13676
- const Vi = J({
13743
+ const Xi = J({
13677
13744
  /**The multiscale datasets for this image*/
13678
13745
  multiscales: p(
13679
13746
  J({
@@ -13685,11 +13752,11 @@ const Vi = J({
13685
13752
  nA().superRefine((g, A) => {
13686
13753
  const I = [
13687
13754
  J({
13688
- type: _("scale"),
13755
+ type: $("scale"),
13689
13756
  scale: p(H()).min(2)
13690
13757
  }),
13691
13758
  J({
13692
- type: _("translation"),
13759
+ type: $("translation"),
13693
13760
  translation: p(H()).min(2)
13694
13761
  })
13695
13762
  ], B = I.reduce(
@@ -13708,7 +13775,7 @@ const Vi = J({
13708
13775
  ).min(1)
13709
13776
  })
13710
13777
  ).min(1),
13711
- version: _("0.4").optional(),
13778
+ version: $("0.4").optional(),
13712
13779
  axes: p(
13713
13780
  nA().superRefine((g, A) => {
13714
13781
  const I = [
@@ -13741,11 +13808,11 @@ const Vi = J({
13741
13808
  nA().superRefine((g, A) => {
13742
13809
  const I = [
13743
13810
  J({
13744
- type: _("scale"),
13811
+ type: $("scale"),
13745
13812
  scale: p(H()).min(2)
13746
13813
  }),
13747
13814
  J({
13748
- type: _("translation"),
13815
+ type: $("translation"),
13749
13816
  translation: p(H()).min(2)
13750
13817
  }),
13751
13818
  // The JSON schema and my reading of the spec is that while
@@ -13756,7 +13823,7 @@ const Vi = J({
13756
13823
  // See the following PR for more context:
13757
13824
  // https://github.com/ome/ngff/pull/152
13758
13825
  J({
13759
- type: _("identity")
13826
+ type: $("identity")
13760
13827
  })
13761
13828
  ], B = I.reduce(
13762
13829
  (C, Q) => ((E) => E.error ? [...C, E.error] : C)(
@@ -13786,7 +13853,7 @@ const Vi = J({
13786
13853
  label: u().optional(),
13787
13854
  family: u().optional(),
13788
13855
  color: u(),
13789
- active: UC().optional()
13856
+ active: LC().optional()
13790
13857
  })
13791
13858
  ),
13792
13859
  // The rdefs are not in the JSON schema and are not particularly well
@@ -13801,7 +13868,7 @@ const Vi = J({
13801
13868
  projection: u().optional()
13802
13869
  }).optional()
13803
13870
  }).optional()
13804
- }).describe("JSON from OME-NGFF .zattrs"), vi = J({
13871
+ }).describe("JSON from OME-NGFF .zattrs"), ji = J({
13805
13872
  plate: J({
13806
13873
  /**The acquisitions for this plate*/
13807
13874
  acquisitions: p(
@@ -13829,7 +13896,7 @@ const Vi = J({
13829
13896
  })
13830
13897
  ).describe("The acquisitions for this plate").optional(),
13831
13898
  /**The version of the specification*/
13832
- version: _("0.4").describe("The version of the specification").optional(),
13899
+ version: $("0.4").describe("The version of the specification").optional(),
13833
13900
  /**The maximum number of fields per view across all wells*/
13834
13901
  field_count: H().int().gt(0).describe("The maximum number of fields per view across all wells").optional(),
13835
13902
  /**The name of the plate*/
@@ -13860,7 +13927,7 @@ const Vi = J({
13860
13927
  })
13861
13928
  ).min(1).describe("The wells of the plate")
13862
13929
  }).optional()
13863
- }).describe("JSON from OME-NGFF .zattrs"), Xi = J({
13930
+ }).describe("JSON from OME-NGFF .zattrs"), zi = J({
13864
13931
  well: J({
13865
13932
  /**The fields of view for this well*/
13866
13933
  images: p(
@@ -13872,9 +13939,9 @@ const Vi = J({
13872
13939
  })
13873
13940
  ).min(1).describe("The fields of view for this well"),
13874
13941
  /**The version of the specification*/
13875
- version: _("0.4").describe("The version of the specification").optional()
13942
+ version: $("0.4").describe("The version of the specification").optional()
13876
13943
  }).optional()
13877
- }).describe("JSON from OME-NGFF .zattrs"), ji = J({
13944
+ }).describe("JSON from OME-NGFF .zattrs"), _i = J({
13878
13945
  /**The versioned OME-Zarr Metadata namespace*/
13879
13946
  ome: J({
13880
13947
  /**The multiscale datasets for this image*/
@@ -13888,11 +13955,11 @@ const Vi = J({
13888
13955
  nA().superRefine((g, A) => {
13889
13956
  const I = [
13890
13957
  J({
13891
- type: _("scale"),
13958
+ type: $("scale"),
13892
13959
  scale: p(H()).min(2)
13893
13960
  }),
13894
13961
  J({
13895
- type: _("translation"),
13962
+ type: $("translation"),
13896
13963
  translation: p(H()).min(2)
13897
13964
  })
13898
13965
  ], B = I.reduce(
@@ -13941,11 +14008,11 @@ const Vi = J({
13941
14008
  nA().superRefine((g, A) => {
13942
14009
  const I = [
13943
14010
  J({
13944
- type: _("scale"),
14011
+ type: $("scale"),
13945
14012
  scale: p(H()).min(2)
13946
14013
  }),
13947
14014
  J({
13948
- type: _("translation"),
14015
+ type: $("translation"),
13949
14016
  translation: p(H()).min(2)
13950
14017
  }),
13951
14018
  // The JSON schema and my reading of the spec is that while
@@ -13956,7 +14023,7 @@ const Vi = J({
13956
14023
  // See the following PR for more context:
13957
14024
  // https://github.com/ome/ngff/pull/152
13958
14025
  J({
13959
- type: _("identity")
14026
+ type: $("identity")
13960
14027
  })
13961
14028
  ], B = I.reduce(
13962
14029
  (C, Q) => ((E) => E.error ? [...C, E.error] : C)(
@@ -13986,7 +14053,7 @@ const Vi = J({
13986
14053
  label: u().optional(),
13987
14054
  family: u().optional(),
13988
14055
  color: u().optional(),
13989
- active: UC().optional()
14056
+ active: LC().optional()
13990
14057
  })
13991
14058
  ),
13992
14059
  // The rdefs are not in the JSON schema and are not particularly well
@@ -14002,9 +14069,9 @@ const Vi = J({
14002
14069
  }).optional()
14003
14070
  }).optional(),
14004
14071
  /**The version of the OME-Zarr Metadata*/
14005
- version: _("0.5").describe("The version of the OME-Zarr Metadata")
14072
+ version: $("0.5").describe("The version of the OME-Zarr Metadata")
14006
14073
  }).describe("The versioned OME-Zarr Metadata namespace")
14007
- }).describe("The zarr.json attributes key"), zi = J({
14074
+ }).describe("The zarr.json attributes key"), $i = J({
14008
14075
  /**The versioned OME-Zarr Metadata namespace*/
14009
14076
  ome: J({
14010
14077
  plate: J({
@@ -14064,9 +14131,9 @@ const Vi = J({
14064
14131
  ).min(1).describe("The wells of the plate")
14065
14132
  }),
14066
14133
  /**The version of the OME-Zarr Metadata*/
14067
- version: _("0.5").describe("The version of the OME-Zarr Metadata")
14134
+ version: $("0.5").describe("The version of the OME-Zarr Metadata")
14068
14135
  }).describe("The versioned OME-Zarr Metadata namespace")
14069
- }).describe("The zarr.json attributes key"), _i = J({
14136
+ }).describe("The zarr.json attributes key"), Ao = J({
14070
14137
  /**The versioned OME-Zarr Metadata namespace*/
14071
14138
  ome: J({
14072
14139
  well: J({
@@ -14083,17 +14150,17 @@ const Vi = J({
14083
14150
  ).min(1).describe("The fields of view for this well")
14084
14151
  }),
14085
14152
  /**The version of the OME-Zarr Metadata*/
14086
- version: _("0.5").describe("The version of the OME-Zarr Metadata")
14153
+ version: $("0.5").describe("The version of the OME-Zarr Metadata")
14087
14154
  }).describe("The versioned OME-Zarr Metadata namespace")
14088
- }).describe("JSON from OME-Zarr zarr.json"), $i = ["0.4", "0.5"], Ao = new Set($i);
14089
- function Io(g) {
14155
+ }).describe("JSON from OME-Zarr zarr.json"), Io = ["0.4", "0.5"], go = new Set(Io);
14156
+ function Bo(g) {
14090
14157
  if (!("ome" in g) || !(g.ome instanceof Object)) return;
14091
14158
  const A = g.ome;
14092
- if ("version" in A && typeof A.version == "string" && Ao.has(A.version))
14159
+ if ("version" in A && typeof A.version == "string" && go.has(A.version))
14093
14160
  return A.version;
14094
14161
  }
14095
14162
  function Zg(g) {
14096
- const A = Io(g);
14163
+ const A = Bo(g);
14097
14164
  return A === void 0 ? "0.4" : A;
14098
14165
  }
14099
14166
  function fA(g) {
@@ -14105,14 +14172,14 @@ function fA(g) {
14105
14172
  return "v3";
14106
14173
  }
14107
14174
  }
14108
- function kC(g, A) {
14175
+ function JC(g, A) {
14109
14176
  const I = { ...g };
14110
14177
  return delete I[A], I;
14111
14178
  }
14112
- async function Yo(g, A) {
14179
+ async function Ko(g, A) {
14113
14180
  const I = new _A(g), B = new CA(I), C = fA(A), Q = await gI(B, C);
14114
14181
  try {
14115
- return go(Q.attrs);
14182
+ return Co(Q.attrs);
14116
14183
  } catch {
14117
14184
  throw Error(
14118
14185
  `Failed to parse OME-Zarr plate:
@@ -14120,58 +14187,58 @@ ${JSON.stringify(Q.attrs)}`
14120
14187
  );
14121
14188
  }
14122
14189
  }
14123
- function go(g) {
14190
+ function Co(g) {
14124
14191
  switch (Zg(g)) {
14125
14192
  case "0.5":
14126
14193
  return {
14127
- ...zi.parse(g).ome,
14194
+ ...$i.parse(g).ome,
14128
14195
  originalVersion: "0.5"
14129
14196
  };
14130
14197
  case "0.4":
14131
14198
  return {
14132
- ...Bo(vi.parse(g)).ome,
14199
+ ...Qo(ji.parse(g)).ome,
14133
14200
  originalVersion: "0.4"
14134
14201
  };
14135
14202
  }
14136
14203
  }
14137
- function Bo(g) {
14204
+ function Qo(g) {
14138
14205
  if (g.plate === void 0)
14139
14206
  throw new Error("Plate metadata is missing in OME-Zarr v0.4 plate");
14140
14207
  return {
14141
14208
  ome: {
14142
- plate: kC(g.plate, "version"),
14209
+ plate: JC(g.plate, "version"),
14143
14210
  version: "0.5"
14144
14211
  }
14145
14212
  };
14146
14213
  }
14147
- function Co(g) {
14214
+ function Eo(g) {
14148
14215
  if (g.well === void 0)
14149
14216
  throw new Error("Well metadata is missing in OME-Zarr v0.4 well");
14150
14217
  return {
14151
14218
  ome: {
14152
- well: kC(g.well, "version"),
14219
+ well: JC(g.well, "version"),
14153
14220
  version: "0.5"
14154
14221
  }
14155
14222
  };
14156
14223
  }
14157
- function Qo(g) {
14224
+ function io(g) {
14158
14225
  switch (Zg(g)) {
14159
14226
  case "0.5":
14160
14227
  return {
14161
- ..._i.parse(g).ome,
14228
+ ...Ao.parse(g).ome,
14162
14229
  originalVersion: "0.5"
14163
14230
  };
14164
14231
  case "0.4":
14165
14232
  return {
14166
- ...Co(Xi.parse(g)).ome,
14233
+ ...Eo(zi.parse(g)).ome,
14167
14234
  originalVersion: "0.4"
14168
14235
  };
14169
14236
  }
14170
14237
  }
14171
- async function Mo(g, A, I) {
14238
+ async function Ho(g, A, I) {
14172
14239
  const B = g + "/" + A, C = new _A(B), Q = new CA(C), E = fA(I), i = await gI(Q, E);
14173
14240
  try {
14174
- return Qo(i.attrs);
14241
+ return io(i.attrs);
14175
14242
  } catch {
14176
14243
  throw Error(
14177
14244
  `Failed to parse OME-Zarr well:
@@ -14179,15 +14246,15 @@ ${JSON.stringify(i.attrs)}`
14179
14246
  );
14180
14247
  }
14181
14248
  }
14182
- async function Ko(g) {
14249
+ async function qo(g) {
14183
14250
  const A = fA(g.version), I = await gI(g.location, A);
14184
14251
  return Pg(I.attrs).omero?.channels ?? [];
14185
14252
  }
14186
- async function Ho(g) {
14253
+ async function lo(g) {
14187
14254
  const A = fA(g.version), I = await gI(g.location, A);
14188
14255
  return Pg(I.attrs).omero?.rdefs;
14189
14256
  }
14190
- function Eo(g) {
14257
+ function oo(g) {
14191
14258
  return {
14192
14259
  ome: {
14193
14260
  multiscales: g.multiscales,
@@ -14196,23 +14263,23 @@ function Eo(g) {
14196
14263
  }
14197
14264
  };
14198
14265
  }
14199
- function io(g) {
14266
+ function ao(g) {
14200
14267
  switch (Zg(g)) {
14201
14268
  case "0.5":
14202
14269
  return {
14203
- ...ji.parse(g).ome,
14270
+ ..._i.parse(g).ome,
14204
14271
  originalVersion: "0.5"
14205
14272
  };
14206
14273
  case "0.4":
14207
14274
  return {
14208
- ...Eo(Vi.parse(g)).ome,
14275
+ ...oo(Xi.parse(g)).ome,
14209
14276
  originalVersion: "0.4"
14210
14277
  };
14211
14278
  }
14212
14279
  }
14213
14280
  function Pg(g) {
14214
14281
  try {
14215
- return io(g);
14282
+ return ao(g);
14216
14283
  } catch {
14217
14284
  throw Error(`Failed to parse OME-Zarr image:
14218
14285
  ${JSON.stringify(g)}`);
@@ -14239,15 +14306,15 @@ class bA {
14239
14306
  throw new Error("No datasets found in the multiscale image.");
14240
14307
  B || (B = fA(Q.originalVersion));
14241
14308
  const o = i.datasets.map(
14242
- (h) => Ci(A, h.path, B)
14309
+ (h) => Ei(A, h.path, B)
14243
14310
  ), a = await Promise.all(
14244
- o.map((h) => Bi(h))
14311
+ o.map((h) => Qi(h))
14245
14312
  ), s = a[0].shape, D = i.axes;
14246
14313
  if (D.length !== s.length)
14247
14314
  throw new Error(
14248
14315
  `Mismatch between number of axes (${D.length}) and array shape (${s.length})`
14249
14316
  );
14250
- return new ni({ metadata: i, arrays: a, arrayParams: o });
14317
+ return new wi({ metadata: i, arrays: a, arrayParams: o });
14251
14318
  }
14252
14319
  /**
14253
14320
  * Returns per-axis dimension metadata for the image.
@@ -14297,7 +14364,7 @@ class bA {
14297
14364
  return new bA({ location: I, version: A.version, loader: B });
14298
14365
  }
14299
14366
  }
14300
- class oo extends pA {
14367
+ class so extends pA {
14301
14368
  // this creates the geometry for a screen-space projected line
14302
14369
  // each point on the input path is split into two vertices
14303
14370
  // these are pushed in opposite directions in screen-space to create width
@@ -14346,7 +14413,7 @@ class oo extends pA {
14346
14413
  return I;
14347
14414
  }
14348
14415
  }
14349
- class ao extends zA {
14416
+ class Do extends zA {
14350
14417
  color_;
14351
14418
  width_;
14352
14419
  /**
@@ -14385,7 +14452,7 @@ class ao extends zA {
14385
14452
  };
14386
14453
  }
14387
14454
  }
14388
- class qo extends KI {
14455
+ class fo extends KI {
14389
14456
  /** Identifies the layer type as `AxesLayer`. */
14390
14457
  type = "AxesLayer";
14391
14458
  /**
@@ -14418,17 +14485,18 @@ class qo extends KI {
14418
14485
  }
14419
14486
  /** Performs no per-frame work. The axes are built at construction. */
14420
14487
  update() {
14488
+ return !0;
14421
14489
  }
14422
14490
  }
14423
14491
  function vI(g) {
14424
- const { end: A, width: I, color: B } = g, C = new oo([[0, 0, 0], A]);
14425
- return new ao({
14492
+ const { end: A, width: I, color: B } = g, C = new so([[0, 0, 0], A]);
14493
+ return new Do({
14426
14494
  geometry: C,
14427
14495
  color: B,
14428
14496
  width: I
14429
14497
  });
14430
14498
  }
14431
- class so extends Rg {
14499
+ class ho extends Rg {
14432
14500
  width_;
14433
14501
  height_;
14434
14502
  depth_;
@@ -14448,12 +14516,12 @@ class so extends Rg {
14448
14516
  return this.depth_;
14449
14517
  }
14450
14518
  }
14451
- const LC = {
14519
+ const YC = {
14452
14520
  circle: 0,
14453
14521
  square: 1,
14454
14522
  triangle: 2
14455
14523
  };
14456
- class lo extends zA {
14524
+ class po extends zA {
14457
14525
  /**
14458
14526
  * Creates a renderable drawing one marker per entry.
14459
14527
  *
@@ -14472,7 +14540,7 @@ class lo extends zA {
14472
14540
  Q.b,
14473
14541
  Q.a,
14474
14542
  C.size,
14475
- LC[C.marker]
14543
+ YC[C.marker]
14476
14544
  ];
14477
14545
  }), B = new pA(I, [], "points");
14478
14546
  B.addAttribute({
@@ -14491,7 +14559,7 @@ class lo extends zA {
14491
14559
  type: "marker",
14492
14560
  itemSize: 1,
14493
14561
  offset: B.strideBytes
14494
- }), this.geometry = B, this.setTexture(0, Do());
14562
+ }), this.geometry = B, this.setTexture(0, to());
14495
14563
  }
14496
14564
  /** Identifies the renderable type as `PointsRenderable`. */
14497
14565
  get type() {
@@ -14499,10 +14567,10 @@ class lo extends zA {
14499
14567
  }
14500
14568
  }
14501
14569
  let XI;
14502
- function Do() {
14503
- return XI || (XI = ho()), XI;
14570
+ function to() {
14571
+ return XI || (XI = yo()), XI;
14504
14572
  }
14505
- function ho() {
14573
+ function yo() {
14506
14574
  const g = (a) => {
14507
14575
  const s = new Float32Array(a * a);
14508
14576
  return s.fill(1), s;
@@ -14524,11 +14592,11 @@ function ho() {
14524
14592
  triangle: I(256)
14525
14593
  }, E = Object.keys(Q).length, i = new Float32Array(E * 65536);
14526
14594
  for (const [a, s] of Object.entries(Q))
14527
- i.set(s, LC[a] * 65536);
14528
- const o = new so(i, 256, 256);
14595
+ i.set(s, YC[a] * 65536);
14596
+ const o = new ho(i, 256, 256);
14529
14597
  return o.wrapR = "clamp_to_edge", o.wrapS = "clamp_to_edge", o.wrapT = "clamp_to_edge", o;
14530
14598
  }
14531
- class to {
14599
+ class eo {
14532
14600
  planes_;
14533
14601
  /**
14534
14602
  * Creates a frustum from a view-projection matrix.
@@ -14592,10 +14660,10 @@ class to {
14592
14660
  return !0;
14593
14661
  }
14594
14662
  }
14595
- class JC extends YI {
14596
- transform_ = new oC();
14663
+ class dC extends YI {
14664
+ transform_ = new sC();
14597
14665
  /** @hidden */
14598
- projectionMatrix_ = $();
14666
+ projectionMatrix_ = _();
14599
14667
  /** @hidden */
14600
14668
  near_ = 0;
14601
14669
  /** @hidden */
@@ -14632,11 +14700,11 @@ class JC extends YI {
14632
14700
  * @returns The projection matrix multiplied by the view matrix.
14633
14701
  */
14634
14702
  getViewProjection() {
14635
- return QI($(), this.projectionMatrix, this.viewMatrix);
14703
+ return QI(_(), this.projectionMatrix, this.viewMatrix);
14636
14704
  }
14637
14705
  /** The view frustum derived from the current view-projection. */
14638
14706
  get frustum() {
14639
- return new to(this.getViewProjection());
14707
+ return new eo(this.getViewProjection());
14640
14708
  }
14641
14709
  /**
14642
14710
  * Moves the camera by the given world-space offset.
@@ -14658,14 +14726,14 @@ class JC extends YI {
14658
14726
  */
14659
14727
  clipToWorld(A) {
14660
14728
  const I = DI(A[0], A[1], A[2], 1), B = PA(
14661
- $(),
14729
+ _(),
14662
14730
  this.projectionMatrix_
14663
14731
  ), C = OA(
14664
14732
  JA(),
14665
14733
  I,
14666
14734
  B
14667
14735
  );
14668
- iQ(C, C, 1 / C[3]);
14736
+ aQ(C, C, 1 / C[3]);
14669
14737
  const Q = OA(
14670
14738
  JA(),
14671
14739
  C,
@@ -14674,7 +14742,7 @@ class JC extends YI {
14674
14742
  return x(Q[0], Q[1], Q[2]);
14675
14743
  }
14676
14744
  }
14677
- class OB {
14745
+ class vB {
14678
14746
  radius;
14679
14747
  phi;
14680
14748
  theta;
@@ -14690,10 +14758,10 @@ class OB {
14690
14758
  );
14691
14759
  }
14692
14760
  }
14693
- const jI = -1, VB = 0, yo = 1, vB = 9e-3, eo = 1e-3, no = 9e-4, Go = 0.5, wo = 60;
14694
- class fo {
14761
+ const jI = -1, XB = 0, no = 1, jB = 9e-3, Go = 1e-3, wo = 9e-4, Fo = 0.5, ro = 60;
14762
+ class uo {
14695
14763
  camera_;
14696
- orbitVelocity_ = new OB(0, 0, 0);
14764
+ orbitVelocity_ = new vB(0, 0, 0);
14697
14765
  panVelocity_ = M();
14698
14766
  currPos_;
14699
14767
  currCenter_ = M();
@@ -14707,12 +14775,12 @@ class fo {
14707
14775
  * @param params - Initialization properties.
14708
14776
  */
14709
14777
  constructor(A, I) {
14710
- this.camera_ = A, this.currPos_ = new OB(
14778
+ this.camera_ = A, this.currPos_ = new vB(
14711
14779
  I?.radius ?? 1,
14712
14780
  I?.yaw ?? 0,
14713
14781
  I?.pitch ?? 0
14714
14782
  ), I?.target && _I(this.currCenter_, I.target), this.dampingFactor_ = hA(
14715
- I?.dampingFactor ?? Go,
14783
+ I?.dampingFactor ?? Fo,
14716
14784
  0,
14717
14785
  1
14718
14786
  ), this.scrollZoom_ = I?.scrollZoom ?? "always", this.updateCamera();
@@ -14772,7 +14840,7 @@ class fo {
14772
14840
  this.currPos_.phi += this.orbitVelocity_.phi, this.currPos_.theta += this.orbitVelocity_.theta, this.currPos_.radius += this.orbitVelocity_.radius * this.currPos_.radius, aI(this.currCenter_, this.currCenter_, this.panVelocity_);
14773
14841
  const I = Math.PI / 2 - m;
14774
14842
  this.currPos_.theta = hA(this.currPos_.theta, -I, I), this.currPos_.radius = Math.max(0.01, this.currPos_.radius), this.updateCamera();
14775
- const B = Math.pow(1 - this.dampingFactor_, A * wo);
14843
+ const B = Math.pow(1 - this.dampingFactor_, A * ro);
14776
14844
  this.orbitVelocity_.phi *= B, this.orbitVelocity_.theta *= B, this.orbitVelocity_.radius *= B, $I(this.panVelocity_, this.panVelocity_, B), this.cutoffLowVelocity();
14777
14845
  }
14778
14846
  onPointerDown(A) {
@@ -14781,7 +14849,7 @@ class fo {
14781
14849
  }
14782
14850
  onPointerMove(A) {
14783
14851
  if (this.currMouseButton_ == jI) return;
14784
- const I = A.event, B = I.movementX ?? 0, C = I.movementY ?? 0, Q = this.currMouseButton_ === VB && !I.shiftKey, E = this.currMouseButton_ === VB && I.shiftKey || this.currMouseButton_ === yo;
14852
+ const I = A.event, B = I.movementX ?? 0, C = I.movementY ?? 0, Q = this.currMouseButton_ === XB && !I.shiftKey, E = this.currMouseButton_ === XB && I.shiftKey || this.currMouseButton_ === no;
14785
14853
  Q && this.orbit(B, C), E && this.pan(B, C);
14786
14854
  }
14787
14855
  onWheel(A) {
@@ -14797,30 +14865,30 @@ class fo {
14797
14865
  I.target?.releasePointerCapture?.(I.pointerId);
14798
14866
  }
14799
14867
  orbit(A, I) {
14800
- this.orbitVelocity_.phi -= A * vB, this.orbitVelocity_.theta += I * vB;
14868
+ this.orbitVelocity_.phi -= A * jB, this.orbitVelocity_.theta += I * jB;
14801
14869
  }
14802
14870
  pan(A, I) {
14803
- const B = this.currPos_.radius * eo, C = M();
14871
+ const B = this.currPos_.radius * Go, C = M();
14804
14872
  Ag(C, C, this.camera_.right, A), Ag(C, C, this.camera_.up, I), $I(C, C, B), Ig(this.panVelocity_, this.panVelocity_, C);
14805
14873
  }
14806
14874
  zoom(A) {
14807
- this.orbitVelocity_.radius += A * no;
14875
+ this.orbitVelocity_.radius += A * wo;
14808
14876
  }
14809
14877
  updateCamera() {
14810
14878
  const A = aI(M(), this.currCenter_, this.currPos_.toVec3());
14811
14879
  this.camera_.transform.setTranslation(A), this.camera_.transform.targetTo(this.currCenter_);
14812
14880
  }
14813
14881
  cutoffLowVelocity() {
14814
- Math.abs(this.orbitVelocity_.phi) < m && (this.orbitVelocity_.phi = 0), Math.abs(this.orbitVelocity_.theta) < m && (this.orbitVelocity_.theta = 0), Math.abs(this.orbitVelocity_.radius) < m && (this.orbitVelocity_.radius = 0), ng(this.panVelocity_) < m && BQ(this.panVelocity_);
14882
+ Math.abs(this.orbitVelocity_.phi) < m && (this.orbitVelocity_.phi = 0), Math.abs(this.orbitVelocity_.theta) < m && (this.orbitVelocity_.theta = 0), Math.abs(this.orbitVelocity_.radius) < m && (this.orbitVelocity_.radius = 0), ng(this.panVelocity_) < m && QQ(this.panVelocity_);
14815
14883
  }
14816
14884
  }
14817
- const YC = 1.77, XB = 128, jB = 128 / YC, Fo = -1e6, ro = 1e6;
14818
- class po extends JC {
14885
+ const MC = 1.77, zB = 128, _B = 128 / MC, So = -1e6, Ro = 1e6;
14886
+ class mo extends dC {
14819
14887
  // width_ and height_ should always be defined by constructor (see setFrame)
14820
- width_ = XB;
14821
- height_ = jB;
14822
- viewportAspectRatio_ = YC;
14823
- viewportSize_ = [XB, jB];
14888
+ width_ = zB;
14889
+ height_ = _B;
14890
+ viewportAspectRatio_ = MC;
14891
+ viewportSize_ = [zB, _B];
14824
14892
  axes_;
14825
14893
  rotation_;
14826
14894
  orientation_;
@@ -14830,7 +14898,7 @@ class po extends JC {
14830
14898
  * @param props - Initialization properties.
14831
14899
  */
14832
14900
  constructor(A) {
14833
- super(), this.near_ = A.near ?? Fo, this.far_ = A.far ?? ro, this.orientation_ = A.orientation ?? "XY", this.axes_ = YA(this.orientation_), this.rotation_ = dA(this.axes_), this.setFrame(A), this.updateProjectionMatrix();
14901
+ super(), this.near_ = A.near ?? So, this.far_ = A.far ?? Ro, this.orientation_ = A.orientation ?? "XY", this.axes_ = YA(this.orientation_), this.rotation_ = dA(this.axes_), this.setFrame(A), this.updateProjectionMatrix();
14834
14902
  }
14835
14903
  /**
14836
14904
  * The world-space size of the rendered view as `[width, height]`.
@@ -14908,7 +14976,7 @@ class po extends JC {
14908
14976
  */
14909
14977
  getWorldViewRect() {
14910
14978
  let A = DI(-1, -1, 0, 1), I = DI(1, 1, 0, 1);
14911
- const B = PA($(), this.getViewProjection());
14979
+ const B = PA(_(), this.getViewProjection());
14912
14980
  A = OA(JA(), A, B), I = OA(JA(), I, B);
14913
14981
  const C = W[this.axes_.u], Q = W[this.axes_.v];
14914
14982
  return new AA(
@@ -14920,7 +14988,7 @@ class po extends JC {
14920
14988
  updateProjectionMatrix() {
14921
14989
  const A = this.width_, I = this.height_, B = A / I;
14922
14990
  let C = 0.5 * A, Q = 0.5 * I;
14923
- this.viewportAspectRatio_ > B ? C *= this.viewportAspectRatio_ / B : Q *= B / this.viewportAspectRatio_, this.viewportSize_ = [2 * C, 2 * Q], _C(
14991
+ this.viewportAspectRatio_ > B ? C *= this.viewportAspectRatio_ / B : Q *= B / this.viewportAspectRatio_, this.viewportSize_ = [2 * C, 2 * Q], AQ(
14924
14992
  this.projectionMatrix_,
14925
14993
  -C,
14926
14994
  C,
@@ -14931,8 +14999,8 @@ class po extends JC {
14931
14999
  );
14932
15000
  }
14933
15001
  }
14934
- const zB = 0;
14935
- class uo {
15002
+ const $B = 0;
15003
+ class To {
14936
15004
  camera_;
14937
15005
  scrollZoom_;
14938
15006
  dragActive_ = !1;
@@ -14992,7 +15060,7 @@ class uo {
14992
15060
  }
14993
15061
  onPointerDown(A) {
14994
15062
  const I = A.event;
14995
- !A.worldPos || I.button !== zB || (this.dragStart_ = EA(A.worldPos), this.dragActive_ = !0, I.target?.setPointerCapture?.(I.pointerId));
15063
+ !A.worldPos || I.button !== $B || (this.dragStart_ = EA(A.worldPos), this.dragActive_ = !0, I.target?.setPointerCapture?.(I.pointerId));
14996
15064
  }
14997
15065
  onPointerMove(A) {
14998
15066
  if (!this.dragActive_ || !A.worldPos) return;
@@ -15001,11 +15069,11 @@ class uo {
15001
15069
  }
15002
15070
  onPointerEnd(A) {
15003
15071
  const I = A.event;
15004
- !this.dragActive_ || I.button !== zB || (this.dragActive_ = !1, I.target?.releasePointerCapture?.(I.pointerId));
15072
+ !this.dragActive_ || I.button !== $B || (this.dragActive_ = !1, I.target?.releasePointerCapture?.(I.pointerId));
15005
15073
  }
15006
15074
  }
15007
- const So = 60, Ro = 1.77, oI = 0.1, zI = 180 - oI;
15008
- class mo extends JC {
15075
+ const co = 60, No = 1.77, oI = 0.1, zI = 180 - oI;
15076
+ class xo extends dC {
15009
15077
  fov_;
15010
15078
  aspectRatio_;
15011
15079
  /**
@@ -15015,8 +15083,8 @@ class mo extends JC {
15015
15083
  */
15016
15084
  constructor(A = {}) {
15017
15085
  const {
15018
- fov: I = So,
15019
- aspectRatio: B = Ro,
15086
+ fov: I = co,
15087
+ aspectRatio: B = No,
15020
15088
  near: C = 0.1,
15021
15089
  far: Q = 1e4,
15022
15090
  position: E = x(0, 0, 0)
@@ -15062,9 +15130,9 @@ class mo extends JC {
15062
15130
  }
15063
15131
  /** @hidden */
15064
15132
  updateProjectionMatrix() {
15065
- jC(
15133
+ _C(
15066
15134
  this.projectionMatrix_,
15067
- ZC(this.fov),
15135
+ OC(this.fov),
15068
15136
  this.aspectRatio_,
15069
15137
  this.near_,
15070
15138
  this.far_
@@ -15072,38 +15140,38 @@ class mo extends JC {
15072
15140
  }
15073
15141
  }
15074
15142
  export {
15075
- qo as AxesLayer,
15143
+ fo as AxesLayer,
15076
15144
  AA as Box2,
15077
15145
  VA as Box3,
15078
- JC as Camera,
15146
+ dC as Camera,
15079
15147
  T as Color,
15080
- to as Frustum,
15081
- ko as Idetik,
15148
+ eo as Frustum,
15149
+ Jo as Idetik,
15082
15150
  Jg as ImageLayer,
15083
- ZQ as ImageRenderable,
15084
- _Q as LabelImageRenderable,
15151
+ OQ as ImageRenderable,
15152
+ AE as LabelImageRenderable,
15085
15153
  Yg as LabelLayer,
15086
15154
  KI as Layer,
15087
15155
  bA as OmeZarrImageSource,
15088
- fo as OrbitControls,
15089
- po as OrthographicCamera,
15090
- uo as PanZoomControls,
15091
- mo as PerspectiveCamera,
15092
- lo as PointsRenderable,
15093
- ao as ProjectedLineRenderable,
15156
+ uo as OrbitControls,
15157
+ mo as OrthographicCamera,
15158
+ To as PanZoomControls,
15159
+ xo as PerspectiveCamera,
15160
+ po as PointsRenderable,
15161
+ Do as ProjectedLineRenderable,
15094
15162
  zA as RenderableObject,
15095
- oE as Stats,
15096
- oC as TrsTransform,
15097
- Lo as Viewport,
15098
- BE as VolumeLayer,
15099
- AE as VolumeRenderable,
15163
+ sE as Stats,
15164
+ sC as TrsTransform,
15165
+ Yo as Viewport,
15166
+ QE as VolumeLayer,
15167
+ gE as VolumeRenderable,
15100
15168
  Ng as createExplorationPolicy,
15101
15169
  Ug as createImageSourcePolicy,
15102
- No as createNoPrefetchPolicy,
15103
- co as createPlaybackPolicy,
15104
- Yo as loadOmeZarrPlate,
15105
- Mo as loadOmeZarrWell,
15106
- Ko as loadOmeroChannels,
15107
- Ho as loadOmeroDefaults
15170
+ ko as createNoPrefetchPolicy,
15171
+ Uo as createPlaybackPolicy,
15172
+ Ko as loadOmeZarrPlate,
15173
+ Ho as loadOmeZarrWell,
15174
+ qo as loadOmeroChannels,
15175
+ lo as loadOmeroDefaults
15108
15176
  };
15109
15177
  //# sourceMappingURL=index.js.map