@idetik/core 0.45.4 → 0.46.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -3
- package/dist/index.d.ts +303 -247
- package/dist/index.js +756 -729
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +19 -19
- package/dist/index.umd.cjs.map +1 -1
- package/dist/types/src/core/layer.d.ts +4 -2
- package/dist/types/src/core/layer.d.ts.map +1 -1
- package/dist/types/src/core/stats.d.ts +51 -0
- package/dist/types/src/core/stats.d.ts.map +1 -0
- package/dist/types/src/core/viewport.d.ts +20 -33
- package/dist/types/src/core/viewport.d.ts.map +1 -1
- package/dist/types/src/idetik.d.ts +18 -41
- package/dist/types/src/idetik.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +3 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/objects/cameras/controls.d.ts +3 -2
- package/dist/types/src/objects/cameras/controls.d.ts.map +1 -1
- package/dist/types/src/objects/cameras/orbit_controls.d.ts +3 -2
- package/dist/types/src/objects/cameras/orbit_controls.d.ts.map +1 -1
- package/dist/types/src/objects/cameras/orthographic_camera.d.ts +5 -3
- package/dist/types/src/objects/cameras/orthographic_camera.d.ts.map +1 -1
- package/dist/types/src/objects/cameras/perspective_camera.d.ts +8 -2
- package/dist/types/src/objects/cameras/perspective_camera.d.ts.map +1 -1
- package/dist/types/test/helpers.d.ts +9 -0
- package/dist/types/test/helpers.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class dC {
|
|
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
|
-
}`,
|
|
90
|
+
}`, MC = `#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
|
-
}`,
|
|
162
|
+
}`, KC = `#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
|
-
}`,
|
|
182
|
+
}`, HC = `#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
|
-
}`,
|
|
192
|
+
}`, qC = `#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() {}`,
|
|
480
|
+
void main() {}`, lC = `#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
|
|
493
|
+
const fC = {
|
|
494
494
|
projectedLine: {
|
|
495
495
|
vertex: Xg,
|
|
496
|
-
fragment:
|
|
496
|
+
fragment: MC
|
|
497
497
|
},
|
|
498
498
|
points: {
|
|
499
499
|
vertex: jg,
|
|
500
|
-
fragment:
|
|
500
|
+
fragment: KC
|
|
501
501
|
},
|
|
502
502
|
wireframe: {
|
|
503
|
-
vertex:
|
|
504
|
-
fragment:
|
|
503
|
+
vertex: HC,
|
|
504
|
+
fragment: qC
|
|
505
505
|
},
|
|
506
506
|
floatScalarImage: {
|
|
507
507
|
vertex: UA,
|
|
@@ -546,7 +546,7 @@ const pC = {
|
|
|
546
546
|
},
|
|
547
547
|
pointsDepth: {
|
|
548
548
|
vertex: jg,
|
|
549
|
-
fragment:
|
|
549
|
+
fragment: lC
|
|
550
550
|
},
|
|
551
551
|
projectedLineDepth: {
|
|
552
552
|
vertex: Xg,
|
|
@@ -557,7 +557,7 @@ const pC = {
|
|
|
557
557
|
info: 20,
|
|
558
558
|
warn: 30,
|
|
559
559
|
error: 40
|
|
560
|
-
},
|
|
560
|
+
}, pC = {
|
|
561
561
|
debug: "\x1B[90m",
|
|
562
562
|
// gray
|
|
563
563
|
info: "\x1B[36m",
|
|
@@ -567,7 +567,7 @@ const pC = {
|
|
|
567
567
|
error: "\x1B[31m"
|
|
568
568
|
// red
|
|
569
569
|
};
|
|
570
|
-
function
|
|
570
|
+
function uC() {
|
|
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 mC() {
|
|
|
579
579
|
return "development";
|
|
580
580
|
}
|
|
581
581
|
class k {
|
|
582
|
-
static logLevel_ =
|
|
582
|
+
static logLevel_ = uC() === "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 =
|
|
600
|
+
const Q = (/* @__PURE__ */ new Date()).toISOString(), E = pC[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
|
|
617
|
+
class mC {
|
|
618
618
|
gl_;
|
|
619
619
|
program_;
|
|
620
620
|
uniformInfo_ = /* @__PURE__ */ new Map();
|
|
@@ -696,7 +696,7 @@ class TC {
|
|
|
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 (!
|
|
699
|
+
if (!xC.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 TC {
|
|
|
737
737
|
return Array.from(this.uniformInfo_.keys());
|
|
738
738
|
}
|
|
739
739
|
}
|
|
740
|
-
const
|
|
740
|
+
const TC = typeof window < "u" ? [
|
|
741
741
|
WebGL2RenderingContext.BOOL,
|
|
742
742
|
WebGL2RenderingContext.FLOAT,
|
|
743
743
|
WebGL2RenderingContext.INT,
|
|
@@ -762,10 +762,10 @@ const xC = 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
|
-
] : [],
|
|
766
|
-
|
|
765
|
+
] : [], xC = new Set(
|
|
766
|
+
TC
|
|
767
767
|
), uI = "#pragma inject_defines";
|
|
768
|
-
class
|
|
768
|
+
class WC {
|
|
769
769
|
gl_;
|
|
770
770
|
programs_ = /* @__PURE__ */ new Map();
|
|
771
771
|
constructor(A) {
|
|
@@ -774,14 +774,14 @@ class bC {
|
|
|
774
774
|
use(A) {
|
|
775
775
|
let I = this.programs_.get(A);
|
|
776
776
|
if (I === void 0) {
|
|
777
|
-
const B =
|
|
777
|
+
const B = fC[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
|
|
784
|
+
I = new mC(
|
|
785
785
|
this.gl_,
|
|
786
786
|
C,
|
|
787
787
|
Q
|
|
@@ -814,18 +814,18 @@ function _B(g) {
|
|
|
814
814
|
class YI {
|
|
815
815
|
id = _B();
|
|
816
816
|
}
|
|
817
|
-
var m = 1e-6, j = typeof Float32Array < "u" ? Float32Array : Array,
|
|
818
|
-
function
|
|
819
|
-
return g *
|
|
817
|
+
var m = 1e-6, j = typeof Float32Array < "u" ? Float32Array : Array, bC = Math.PI / 180;
|
|
818
|
+
function ZC(g) {
|
|
819
|
+
return g * bC;
|
|
820
820
|
}
|
|
821
821
|
function $B() {
|
|
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
|
|
825
|
+
function PC(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
|
|
828
|
+
function OC(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
|
}
|
|
@@ -841,18 +841,18 @@ function QI(g, A, I) {
|
|
|
841
841
|
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
842
|
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
843
|
}
|
|
844
|
-
function
|
|
844
|
+
function VC(g, A, I) {
|
|
845
845
|
var B = I[0], C = I[1], Q = I[2], E, i, o, a, s, D, h, t, e, n, F, G;
|
|
846
846
|
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
847
|
}
|
|
848
848
|
function AC(g, A) {
|
|
849
849
|
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
850
|
}
|
|
851
|
-
function
|
|
851
|
+
function vC(g, A, I, B) {
|
|
852
852
|
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
853
|
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
854
|
}
|
|
855
|
-
function
|
|
855
|
+
function XC(g, A, I, B, C) {
|
|
856
856
|
var Q = 1 / Math.tan(A / 2);
|
|
857
857
|
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
858
|
var E = 1 / (B - C);
|
|
@@ -861,19 +861,19 @@ function jC(g, A, I, B, C) {
|
|
|
861
861
|
g[10] = -1, g[14] = -2 * B;
|
|
862
862
|
return g;
|
|
863
863
|
}
|
|
864
|
-
var
|
|
865
|
-
function
|
|
864
|
+
var jC = XC;
|
|
865
|
+
function zC(g, A, I, B, C, Q, E) {
|
|
866
866
|
var i = 1 / (A - I), o = 1 / (B - C), a = 1 / (Q - E);
|
|
867
867
|
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
868
|
}
|
|
869
|
-
var
|
|
870
|
-
function
|
|
869
|
+
var _C = zC;
|
|
870
|
+
function $C(g, A, I, B) {
|
|
871
871
|
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
872
|
t > 0 && (t = 1 / Math.sqrt(t), s *= t, D *= t, h *= t);
|
|
873
873
|
var e = o * h - a * D, n = a * s - i * h, F = i * D - o * s;
|
|
874
874
|
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
875
|
}
|
|
876
|
-
function
|
|
876
|
+
function AQ(g, A) {
|
|
877
877
|
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
878
|
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
879
|
}
|
|
@@ -905,7 +905,7 @@ function aI(g, A, I) {
|
|
|
905
905
|
function Gg(g, A, I) {
|
|
906
906
|
return g[0] = A[0] - I[0], g[1] = A[1] - I[1], g[2] = A[2] - I[2], g;
|
|
907
907
|
}
|
|
908
|
-
function
|
|
908
|
+
function IQ(g, A, I) {
|
|
909
909
|
return g[0] = A[0] * I[0], g[1] = A[1] * I[1], g[2] = A[2] * I[2], g;
|
|
910
910
|
}
|
|
911
911
|
function $I(g, A, I) {
|
|
@@ -914,7 +914,7 @@ function $I(g, A, I) {
|
|
|
914
914
|
function Ag(g, A, I, B) {
|
|
915
915
|
return g[0] = A[0] + I[0] * B, g[1] = A[1] + I[1] * B, g[2] = A[2] + I[2] * B, g;
|
|
916
916
|
}
|
|
917
|
-
function
|
|
917
|
+
function gQ(g, A) {
|
|
918
918
|
var I = A[0] - g[0], B = A[1] - g[1], C = A[2] - g[2];
|
|
919
919
|
return I * I + B * B + C * C;
|
|
920
920
|
}
|
|
@@ -937,14 +937,14 @@ function gC(g, A, I) {
|
|
|
937
937
|
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
938
|
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
939
|
}
|
|
940
|
-
function
|
|
940
|
+
function BQ(g) {
|
|
941
941
|
return g[0] = 0, g[1] = 0, g[2] = 0, g;
|
|
942
942
|
}
|
|
943
943
|
function Fg(g, A) {
|
|
944
944
|
var I = g[0], B = g[1], C = g[2], Q = A[0], E = A[1], i = A[2];
|
|
945
945
|
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
946
|
}
|
|
947
|
-
var Ig = Gg,
|
|
947
|
+
var Ig = Gg, CQ = ng;
|
|
948
948
|
(function() {
|
|
949
949
|
var g = M();
|
|
950
950
|
return function(A, I, B, C, Q, E) {
|
|
@@ -958,7 +958,7 @@ function JA() {
|
|
|
958
958
|
var g = new j(4);
|
|
959
959
|
return j != Float32Array && (g[0] = 0, g[1] = 0, g[2] = 0, g[3] = 0), g;
|
|
960
960
|
}
|
|
961
|
-
function
|
|
961
|
+
function QQ(g) {
|
|
962
962
|
var A = new j(4);
|
|
963
963
|
return A[0] = g[0], A[1] = g[1], A[2] = g[2], A[3] = g[3], A;
|
|
964
964
|
}
|
|
@@ -966,13 +966,13 @@ function DI(g, A, I, B) {
|
|
|
966
966
|
var C = new j(4);
|
|
967
967
|
return C[0] = g, C[1] = A, C[2] = I, C[3] = B, C;
|
|
968
968
|
}
|
|
969
|
-
function
|
|
969
|
+
function EQ(g, A) {
|
|
970
970
|
return g[0] = A[0], g[1] = A[1], g[2] = A[2], g[3] = A[3], g;
|
|
971
971
|
}
|
|
972
|
-
function
|
|
972
|
+
function iQ(g, A, I) {
|
|
973
973
|
return g[0] = A[0] * I, g[1] = A[1] * I, g[2] = A[2] * I, g[3] = A[3] * I, g;
|
|
974
974
|
}
|
|
975
|
-
function
|
|
975
|
+
function oQ(g, A) {
|
|
976
976
|
var I = A[0], B = A[1], C = A[2], Q = A[3], E = I * I + B * B + C * C + Q * Q;
|
|
977
977
|
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
978
|
}
|
|
@@ -993,12 +993,12 @@ function hI() {
|
|
|
993
993
|
var g = new j(4);
|
|
994
994
|
return j != Float32Array && (g[0] = 0, g[1] = 0, g[2] = 0), g[3] = 1, g;
|
|
995
995
|
}
|
|
996
|
-
function
|
|
996
|
+
function aQ(g, A, I) {
|
|
997
997
|
I = I * 0.5;
|
|
998
998
|
var B = Math.sin(I);
|
|
999
999
|
return g[0] = B * A[0], g[1] = B * A[1], g[2] = B * A[2], g[3] = Math.cos(I), g;
|
|
1000
1000
|
}
|
|
1001
|
-
function
|
|
1001
|
+
function sQ(g, A, I) {
|
|
1002
1002
|
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
1003
|
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
1004
|
}
|
|
@@ -1018,12 +1018,12 @@ function rg(g, A) {
|
|
|
1018
1018
|
}
|
|
1019
1019
|
return g;
|
|
1020
1020
|
}
|
|
1021
|
-
var
|
|
1021
|
+
var DQ = QQ, hQ = EQ, dI = oQ;
|
|
1022
1022
|
(function() {
|
|
1023
1023
|
var g = M(), A = x(1, 0, 0), I = x(0, 1, 0);
|
|
1024
1024
|
return function(B, C, Q) {
|
|
1025
1025
|
var E = sI(C, Q);
|
|
1026
|
-
return E < -0.999999 ? (EI(g, A, C),
|
|
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));
|
|
1027
1027
|
};
|
|
1028
1028
|
})();
|
|
1029
1029
|
(function() {
|
|
@@ -1050,15 +1050,15 @@ function v(g, A) {
|
|
|
1050
1050
|
var I = new j(2);
|
|
1051
1051
|
return I[0] = g, I[1] = A, I;
|
|
1052
1052
|
}
|
|
1053
|
-
function
|
|
1053
|
+
function tQ(g, A) {
|
|
1054
1054
|
var I = A[0] - g[0], B = A[1] - g[1];
|
|
1055
1055
|
return Math.sqrt(I * I + B * B);
|
|
1056
1056
|
}
|
|
1057
|
-
function
|
|
1057
|
+
function yQ(g) {
|
|
1058
1058
|
var A = g[0], I = g[1];
|
|
1059
1059
|
return A * A + I * I;
|
|
1060
1060
|
}
|
|
1061
|
-
function
|
|
1061
|
+
function eQ(g, A, I, B) {
|
|
1062
1062
|
var C = A[0], Q = A[1];
|
|
1063
1063
|
return g[0] = C + B * (I[0] - C), g[1] = Q + B * (I[1] - Q), g;
|
|
1064
1064
|
}
|
|
@@ -1143,7 +1143,7 @@ class VA {
|
|
|
1143
1143
|
wg(Q, E, A), this.expandWithPoint(Q);
|
|
1144
1144
|
}
|
|
1145
1145
|
}
|
|
1146
|
-
const
|
|
1146
|
+
const nQ = {
|
|
1147
1147
|
position: 0,
|
|
1148
1148
|
normal: 1,
|
|
1149
1149
|
uv: 2,
|
|
@@ -1207,7 +1207,7 @@ class pA extends YI {
|
|
|
1207
1207
|
return this.attributes_.find((I) => I.type === A);
|
|
1208
1208
|
}
|
|
1209
1209
|
}
|
|
1210
|
-
class
|
|
1210
|
+
class GQ {
|
|
1211
1211
|
gl_;
|
|
1212
1212
|
buffers_ = /* @__PURE__ */ new Map();
|
|
1213
1213
|
currentGeometry_ = null;
|
|
@@ -1243,7 +1243,7 @@ class wQ {
|
|
|
1243
1243
|
this.gl_.bindBuffer(C, Q), this.gl_.bufferData(C, B, this.gl_.STATIC_DRAW);
|
|
1244
1244
|
const { attributes: E, strideBytes: i } = A;
|
|
1245
1245
|
E.forEach((s) => {
|
|
1246
|
-
const D =
|
|
1246
|
+
const D = nQ[s.type];
|
|
1247
1247
|
this.gl_.vertexAttribPointer(
|
|
1248
1248
|
D,
|
|
1249
1249
|
s.itemSize,
|
|
@@ -1262,7 +1262,7 @@ class wQ {
|
|
|
1262
1262
|
this.buffers_.set(A, o), this.gl_.bindVertexArray(null);
|
|
1263
1263
|
}
|
|
1264
1264
|
}
|
|
1265
|
-
function
|
|
1265
|
+
function wQ(g) {
|
|
1266
1266
|
return g === 1 || g === 2 || g === 4 || g === 8;
|
|
1267
1267
|
}
|
|
1268
1268
|
function Sg(g) {
|
|
@@ -1282,7 +1282,7 @@ function Sg(g) {
|
|
|
1282
1282
|
return "float";
|
|
1283
1283
|
throw new Error("Unsupported buffer type.");
|
|
1284
1284
|
}
|
|
1285
|
-
function
|
|
1285
|
+
function FQ(g) {
|
|
1286
1286
|
switch (g.dataFormat) {
|
|
1287
1287
|
case "scalar":
|
|
1288
1288
|
return 1;
|
|
@@ -1292,7 +1292,7 @@ function rQ(g) {
|
|
|
1292
1292
|
return 4;
|
|
1293
1293
|
}
|
|
1294
1294
|
}
|
|
1295
|
-
function
|
|
1295
|
+
function rQ(g) {
|
|
1296
1296
|
switch (g.dataType) {
|
|
1297
1297
|
case "byte":
|
|
1298
1298
|
case "unsigned_byte":
|
|
@@ -1307,13 +1307,13 @@ function SQ(g) {
|
|
|
1307
1307
|
}
|
|
1308
1308
|
}
|
|
1309
1309
|
function gg(g) {
|
|
1310
|
-
const A =
|
|
1310
|
+
const A = FQ(g) * rQ(g), I = Math.max(1, g.mipmapLevels);
|
|
1311
1311
|
let B = Math.max(1, g.width), C = Math.max(1, g.height), Q = Math.max(1, g.depth), E = 0;
|
|
1312
1312
|
for (let i = 0; i < I; ++i)
|
|
1313
1313
|
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
1314
|
return E;
|
|
1315
1315
|
}
|
|
1316
|
-
function
|
|
1316
|
+
function SQ(g) {
|
|
1317
1317
|
if (g.dataFormat === "rgb" || g.dataFormat === "rgba")
|
|
1318
1318
|
return [0, 1];
|
|
1319
1319
|
switch (g.dataType) {
|
|
@@ -1364,7 +1364,7 @@ class Rg extends YI {
|
|
|
1364
1364
|
return "Texture";
|
|
1365
1365
|
}
|
|
1366
1366
|
}
|
|
1367
|
-
class
|
|
1367
|
+
class RQ {
|
|
1368
1368
|
gl_;
|
|
1369
1369
|
textures_ = /* @__PURE__ */ new Map();
|
|
1370
1370
|
currentTexture_ = null;
|
|
@@ -1695,7 +1695,7 @@ class AA {
|
|
|
1695
1695
|
return { x: A, y: I, width: B, height: C };
|
|
1696
1696
|
}
|
|
1697
1697
|
}
|
|
1698
|
-
class
|
|
1698
|
+
class cQ {
|
|
1699
1699
|
gl_;
|
|
1700
1700
|
enabledCapabilities_ = /* @__PURE__ */ new Map();
|
|
1701
1701
|
depthMaskEnabled_ = null;
|
|
@@ -1823,7 +1823,7 @@ class NQ {
|
|
|
1823
1823
|
(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
1824
|
}
|
|
1825
1825
|
}
|
|
1826
|
-
class
|
|
1826
|
+
class NQ {
|
|
1827
1827
|
textureUnit;
|
|
1828
1828
|
gl_;
|
|
1829
1829
|
framebuffer_ = null;
|
|
@@ -1874,8 +1874,8 @@ class UQ {
|
|
|
1874
1874
|
), 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
1875
|
}
|
|
1876
1876
|
}
|
|
1877
|
-
const
|
|
1878
|
-
class
|
|
1877
|
+
const UQ = AC($(), [1, -1, 1]);
|
|
1878
|
+
class kQ extends dC {
|
|
1879
1879
|
gl_;
|
|
1880
1880
|
bindings_;
|
|
1881
1881
|
depthTarget_;
|
|
@@ -1898,7 +1898,7 @@ class LQ extends MC {
|
|
|
1898
1898
|
this.gl_ = I, k.info(
|
|
1899
1899
|
"WebGLRenderer",
|
|
1900
1900
|
`WebGL version ${I.getParameter(I.VERSION)}`
|
|
1901
|
-
), I.getExtension("EXT_color_buffer_float"), this.programs_ = new
|
|
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(
|
|
1902
1902
|
I,
|
|
1903
1903
|
this.textures_.reservePersistentUnit()
|
|
1904
1904
|
), this.resize(this.canvas.width, this.canvas.height);
|
|
@@ -1913,7 +1913,7 @@ class LQ extends MC {
|
|
|
1913
1913
|
this.renderedObjects_ = 0, this.renderedObjectsPerFrame_ = 0, this.stencilRef_ = 0;
|
|
1914
1914
|
for (const s of A.layers)
|
|
1915
1915
|
s.update(A);
|
|
1916
|
-
if (getComputedStyle(A.
|
|
1916
|
+
if (getComputedStyle(A.domElement).visibility === "hidden") return;
|
|
1917
1917
|
const I = A.getBoxRelativeTo(this.canvas), B = new AA(
|
|
1918
1918
|
v(0, 0),
|
|
1919
1919
|
v(this.width, this.height)
|
|
@@ -2003,7 +2003,7 @@ class LQ extends MC {
|
|
|
2003
2003
|
I.transform.matrix
|
|
2004
2004
|
), i = QI(
|
|
2005
2005
|
$(),
|
|
2006
|
-
|
|
2006
|
+
UQ,
|
|
2007
2007
|
Q.projectionMatrix
|
|
2008
2008
|
), o = this.currentViewportSize_, a = I.getUniforms(), D = {
|
|
2009
2009
|
...B.getUniforms(),
|
|
@@ -2118,7 +2118,7 @@ function xA(g, A) {
|
|
|
2118
2118
|
const I = g.priority ?? Number.MAX_SAFE_INTEGER, B = A.priority ?? Number.MAX_SAFE_INTEGER;
|
|
2119
2119
|
return I === B ? (g.orderKey ?? Number.MAX_SAFE_INTEGER) - (A.orderKey ?? Number.MAX_SAFE_INTEGER) : I - B;
|
|
2120
2120
|
}
|
|
2121
|
-
class
|
|
2121
|
+
class LQ {
|
|
2122
2122
|
maxConcurrent_;
|
|
2123
2123
|
pending_ = [];
|
|
2124
2124
|
running_ = /* @__PURE__ */ new Map();
|
|
@@ -2168,13 +2168,13 @@ class JQ {
|
|
|
2168
2168
|
}
|
|
2169
2169
|
}
|
|
2170
2170
|
let tI = 0, yI = 0;
|
|
2171
|
-
function
|
|
2171
|
+
function JQ(g, A) {
|
|
2172
2172
|
g.data && (tI -= g.data.byteLength, yI -= 1), g.data = A, tI += A.byteLength, yI += 1;
|
|
2173
2173
|
}
|
|
2174
2174
|
function CB(g) {
|
|
2175
2175
|
g.data && (tI -= g.data.byteLength, yI -= 1), g.data = void 0, g.texture?.releaseCpuData();
|
|
2176
2176
|
}
|
|
2177
|
-
function
|
|
2177
|
+
function YQ() {
|
|
2178
2178
|
return { cpuChunkBytes: tI, cpuChunkCount: yI };
|
|
2179
2179
|
}
|
|
2180
2180
|
function QB(g, A, I = 1e-6) {
|
|
@@ -2198,7 +2198,7 @@ function YA(g) {
|
|
|
2198
2198
|
function dA(g) {
|
|
2199
2199
|
const A = M(), I = M();
|
|
2200
2200
|
A[W[g.u]] = 1, I[W[g.v]] = 1;
|
|
2201
|
-
const B = EI(M(), A, I), C =
|
|
2201
|
+
const B = EI(M(), A, I), C = OC(
|
|
2202
2202
|
A[0],
|
|
2203
2203
|
A[1],
|
|
2204
2204
|
A[2],
|
|
@@ -2220,7 +2220,7 @@ const EB = [
|
|
|
2220
2220
|
Uint32Array,
|
|
2221
2221
|
Float32Array
|
|
2222
2222
|
];
|
|
2223
|
-
function
|
|
2223
|
+
function dQ(g) {
|
|
2224
2224
|
if (EB.some((I) => g instanceof I))
|
|
2225
2225
|
return !0;
|
|
2226
2226
|
const A = EB.map((I) => I.name);
|
|
@@ -2229,7 +2229,7 @@ function MQ(g) {
|
|
|
2229
2229
|
`Unsupported chunk data type: ${g}. Supported data types: ${A}`
|
|
2230
2230
|
), !1;
|
|
2231
2231
|
}
|
|
2232
|
-
function
|
|
2232
|
+
function MQ(g, A) {
|
|
2233
2233
|
return Math.round((A - g.translation) / g.scale);
|
|
2234
2234
|
}
|
|
2235
2235
|
function CC(g, A) {
|
|
@@ -2239,13 +2239,13 @@ function CC(g, A) {
|
|
|
2239
2239
|
I[i] = 1 / (g.scale[Q] * g.shape[Q]), B[i] = E - g.offset[Q];
|
|
2240
2240
|
}
|
|
2241
2241
|
const C = AC($(), I);
|
|
2242
|
-
return
|
|
2242
|
+
return VC(C, C, B);
|
|
2243
2243
|
}
|
|
2244
2244
|
function hA(g, A, I) {
|
|
2245
2245
|
return Math.max(A, Math.min(I, g));
|
|
2246
2246
|
}
|
|
2247
2247
|
const MI = Symbol("INTERNAL_POLICY_KEY"), QC = 1e-6;
|
|
2248
|
-
class
|
|
2248
|
+
class KQ {
|
|
2249
2249
|
store_;
|
|
2250
2250
|
policy_;
|
|
2251
2251
|
policyChanged_ = !1;
|
|
@@ -2273,7 +2273,7 @@ class HQ {
|
|
|
2273
2273
|
`Source is missing dimensions for slice plane axes "${this.axes_.u}" and "${this.axes_.v}"`
|
|
2274
2274
|
);
|
|
2275
2275
|
const i = Q.lods[0], o = E.lods[0];
|
|
2276
|
-
this.scale0_ = i.scale, this.sourceMaxSquareDistance2D_ =
|
|
2276
|
+
this.scale0_ = i.scale, this.sourceMaxSquareDistance2D_ = yQ(
|
|
2277
2277
|
v(i.size * i.scale, o.size * o.scale)
|
|
2278
2278
|
);
|
|
2279
2279
|
}
|
|
@@ -2334,7 +2334,7 @@ class HQ {
|
|
|
2334
2334
|
return;
|
|
2335
2335
|
}
|
|
2336
2336
|
const D = BC();
|
|
2337
|
-
|
|
2337
|
+
eQ(D, B.min, B.max, 0.5);
|
|
2338
2338
|
const h = this.makeViewBounds3D(B, o);
|
|
2339
2339
|
this.chunkViewStates_.forEach(TA);
|
|
2340
2340
|
const t = this.channelsOfInterest(A.c), e = this.lodRange().max, n = this.getPaddedBounds(h), F = new iB(
|
|
@@ -2537,7 +2537,7 @@ class HQ {
|
|
|
2537
2537
|
}
|
|
2538
2538
|
timeIndex(A) {
|
|
2539
2539
|
const I = this.store_.dimensions.t;
|
|
2540
|
-
return A === void 0 || I === void 0 ? 0 :
|
|
2540
|
+
return A === void 0 || I === void 0 ? 0 : MQ(I.lods[0], A);
|
|
2541
2541
|
}
|
|
2542
2542
|
getSliceAxisBounds(A) {
|
|
2543
2543
|
const I = this.store_.dimensions[this.axes_.w];
|
|
@@ -2565,7 +2565,7 @@ class HQ {
|
|
|
2565
2565
|
return this.lastViewBounds2D_ === null || !BB(this.lastViewBounds2D_.min, A.min) || !BB(this.lastViewBounds2D_.max, A.max);
|
|
2566
2566
|
}
|
|
2567
2567
|
hasViewProjectionChanged(A) {
|
|
2568
|
-
return this.lastViewProjection_ === null || !
|
|
2568
|
+
return this.lastViewProjection_ === null || !AQ(this.lastViewProjection_, A);
|
|
2569
2569
|
}
|
|
2570
2570
|
cCoordsChanged(A) {
|
|
2571
2571
|
return !this.lastCCoords_ && !A ? !1 : !this.lastCCoords_ || !A || this.lastCCoords_.length !== A.length ? !0 : !this.lastCCoords_.every((I, B) => I === A[B]);
|
|
@@ -2616,7 +2616,7 @@ function WI(g, A) {
|
|
|
2616
2616
|
function TA(g) {
|
|
2617
2617
|
g.visible = !1, g.prefetch = !1, g.priority = null, g.orderKey = null;
|
|
2618
2618
|
}
|
|
2619
|
-
class
|
|
2619
|
+
class HQ {
|
|
2620
2620
|
// Chunks indexed as chunks_[lod][t][c][z][y][x].
|
|
2621
2621
|
chunks_;
|
|
2622
2622
|
lowestResLOD_;
|
|
@@ -2697,7 +2697,7 @@ class qQ {
|
|
|
2697
2697
|
return this.lowestResLOD_;
|
|
2698
2698
|
}
|
|
2699
2699
|
addView(A, I) {
|
|
2700
|
-
const B = new
|
|
2700
|
+
const B = new KQ(this, A, I);
|
|
2701
2701
|
return this.views_.push(B), this.hasHadViews_ = !0, B;
|
|
2702
2702
|
}
|
|
2703
2703
|
get views() {
|
|
@@ -2787,7 +2787,7 @@ class qQ {
|
|
|
2787
2787
|
};
|
|
2788
2788
|
}
|
|
2789
2789
|
}
|
|
2790
|
-
function
|
|
2790
|
+
function qQ(g, A) {
|
|
2791
2791
|
const I = A.dimensions.t?.lods[0].size ?? 1, B = {
|
|
2792
2792
|
requested: new Uint32Array(I),
|
|
2793
2793
|
resident: new Uint32Array(I)
|
|
@@ -2796,20 +2796,20 @@ function lQ(g, A) {
|
|
|
2796
2796
|
const E = A.views;
|
|
2797
2797
|
for (let i = 0; i < E.length; i++)
|
|
2798
2798
|
for (const [o, a] of E[i].chunkViewStates) {
|
|
2799
|
-
if (a.priority === null ||
|
|
2799
|
+
if (a.priority === null || lQ(o, E, i)) continue;
|
|
2800
2800
|
const s = o.chunkIndex.t;
|
|
2801
2801
|
C += 1, B.requested[s] += 1, o.texture !== void 0 && (Q += 1, B.resident[s] += 1);
|
|
2802
2802
|
}
|
|
2803
2803
|
return { source: g, requested: C, resident: Q, timepoints: B };
|
|
2804
2804
|
}
|
|
2805
|
-
function
|
|
2805
|
+
function lQ(g, A, I) {
|
|
2806
2806
|
for (let B = 0; B < I; B++) {
|
|
2807
2807
|
const C = A[B].chunkViewStates.get(g);
|
|
2808
2808
|
if (C !== void 0 && C.priority !== null) return !0;
|
|
2809
2809
|
}
|
|
2810
2810
|
return !1;
|
|
2811
2811
|
}
|
|
2812
|
-
function
|
|
2812
|
+
function fQ(g, A) {
|
|
2813
2813
|
let I = 0, B = 0;
|
|
2814
2814
|
const C = { requested: 0, resident: 0 };
|
|
2815
2815
|
for (const Q of A) {
|
|
@@ -2856,8 +2856,8 @@ class cg extends Rg {
|
|
|
2856
2856
|
return B.unpackAlignment = A.rowAlignmentBytes, B;
|
|
2857
2857
|
}
|
|
2858
2858
|
}
|
|
2859
|
-
const
|
|
2860
|
-
class
|
|
2859
|
+
const pQ = 8, uQ = 4;
|
|
2860
|
+
class mQ {
|
|
2861
2861
|
stores_ = [];
|
|
2862
2862
|
queue_;
|
|
2863
2863
|
uploadTexture_;
|
|
@@ -2865,8 +2865,8 @@ class TQ {
|
|
|
2865
2865
|
getGpuResidentBytes_;
|
|
2866
2866
|
memoryLimitBytes_;
|
|
2867
2867
|
maxGpuUploadsPerUpdate_;
|
|
2868
|
-
constructor(A, I, B = () => 0, C = 1 / 0, Q =
|
|
2869
|
-
this.uploadTexture_ = A, this.disposeTexture_ = I, this.getGpuResidentBytes_ = B, this.memoryLimitBytes_ = C, this.maxGpuUploadsPerUpdate_ = Math.max(1, E), this.queue_ = new
|
|
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);
|
|
2870
2870
|
}
|
|
2871
2871
|
get memoryLimitBytes() {
|
|
2872
2872
|
return this.memoryLimitBytes_;
|
|
@@ -2881,16 +2881,16 @@ class TQ {
|
|
|
2881
2881
|
};
|
|
2882
2882
|
}
|
|
2883
2883
|
get memoryStats() {
|
|
2884
|
-
return
|
|
2884
|
+
return YQ();
|
|
2885
2885
|
}
|
|
2886
2886
|
get sourceChunkStats() {
|
|
2887
2887
|
return this.stores_.map(
|
|
2888
|
-
({ source: A, store: I }) =>
|
|
2888
|
+
({ source: A, store: I }) => qQ(A, I)
|
|
2889
2889
|
);
|
|
2890
2890
|
}
|
|
2891
2891
|
addView(A, I, B) {
|
|
2892
2892
|
let C = this.stores_.find((Q) => Q.source === A)?.store;
|
|
2893
|
-
return C || (C = new
|
|
2893
|
+
return C || (C = new HQ(A.loader.getSourceDimensionMap()), this.stores_.push({ source: A, store: C })), C.addView(I, B);
|
|
2894
2894
|
}
|
|
2895
2895
|
update() {
|
|
2896
2896
|
const A = [];
|
|
@@ -3042,6 +3042,10 @@ class KI {
|
|
|
3042
3042
|
*/
|
|
3043
3043
|
onEvent(A) {
|
|
3044
3044
|
}
|
|
3045
|
+
/** Whether the layer is attached to a viewport. */
|
|
3046
|
+
get attached() {
|
|
3047
|
+
return this.attached_;
|
|
3048
|
+
}
|
|
3045
3049
|
/**
|
|
3046
3050
|
* Lifecycle hook that is called automatically when a layer is
|
|
3047
3051
|
* is attached to a viewport. A layer can only be attached to one viewport
|
|
@@ -3156,7 +3160,7 @@ function Ng(g = {}) {
|
|
|
3156
3160
|
]
|
|
3157
3161
|
}, g));
|
|
3158
3162
|
}
|
|
3159
|
-
function
|
|
3163
|
+
function co(g = {}) {
|
|
3160
3164
|
return Ug(kg({
|
|
3161
3165
|
profile: "playback",
|
|
3162
3166
|
prefetch: { x: 0, y: 0, z: 0, t: 20 },
|
|
@@ -3169,7 +3173,7 @@ function Uo(g = {}) {
|
|
|
3169
3173
|
]
|
|
3170
3174
|
}, g));
|
|
3171
3175
|
}
|
|
3172
|
-
function
|
|
3176
|
+
function No(g = {}) {
|
|
3173
3177
|
return Ug(kg({
|
|
3174
3178
|
profile: "no-prefetch",
|
|
3175
3179
|
prefetch: { x: 0, y: 0, z: 0, t: 0 },
|
|
@@ -3183,7 +3187,7 @@ function ko(g = {}) {
|
|
|
3183
3187
|
}, g));
|
|
3184
3188
|
}
|
|
3185
3189
|
function Ug(g) {
|
|
3186
|
-
|
|
3190
|
+
TQ(g);
|
|
3187
3191
|
const A = {
|
|
3188
3192
|
x: g.prefetch.x,
|
|
3189
3193
|
y: g.prefetch.y,
|
|
@@ -3210,7 +3214,7 @@ function Ug(g) {
|
|
|
3210
3214
|
};
|
|
3211
3215
|
return Object.freeze(C);
|
|
3212
3216
|
}
|
|
3213
|
-
function
|
|
3217
|
+
function TQ(g) {
|
|
3214
3218
|
for (const [B, C] of Object.entries(g.prefetch))
|
|
3215
3219
|
if (C !== void 0 && C < 0)
|
|
3216
3220
|
throw new Error(`prefetch.${B} must be a non-negative number`);
|
|
@@ -3334,7 +3338,7 @@ class T {
|
|
|
3334
3338
|
}
|
|
3335
3339
|
const oB = 32;
|
|
3336
3340
|
function vA(g, { visible: A, color: I, contrastLimits: B, opacity: C }) {
|
|
3337
|
-
return A ??= !0, I = I === void 0 ? T.WHITE : T.from(I), C = C === void 0 ? 1 : hA(C, 0, 1), g !== null ? B =
|
|
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(
|
|
3338
3342
|
"Channel",
|
|
3339
3343
|
"No texture provided, defaulting channel contrast limits to [0, 1]."
|
|
3340
3344
|
), B = [0, 1]), {
|
|
@@ -3355,16 +3359,16 @@ function iC(g, A) {
|
|
|
3355
3359
|
`channelProps length (${g.length}) must match source channel count (${A}).`
|
|
3356
3360
|
);
|
|
3357
3361
|
}
|
|
3358
|
-
function
|
|
3362
|
+
function xQ(g, A) {
|
|
3359
3363
|
if (g === void 0)
|
|
3360
|
-
return
|
|
3364
|
+
return SQ(A);
|
|
3361
3365
|
if (g[1] <= g[0])
|
|
3362
3366
|
throw new Error(
|
|
3363
3367
|
`Contrast limits must be strictly increasing: ${g}.`
|
|
3364
3368
|
);
|
|
3365
3369
|
return g;
|
|
3366
3370
|
}
|
|
3367
|
-
class
|
|
3371
|
+
class WQ extends pA {
|
|
3368
3372
|
constructor(A) {
|
|
3369
3373
|
if (super(), A.primitive != "triangles") {
|
|
3370
3374
|
k.warn("WireframeGeometry", "Only indexed geometries are supported");
|
|
@@ -3389,7 +3393,7 @@ class bQ extends pA {
|
|
|
3389
3393
|
this.indexData_ = new Uint32Array(B);
|
|
3390
3394
|
}
|
|
3391
3395
|
}
|
|
3392
|
-
const
|
|
3396
|
+
const bQ = x(0, 1, 0);
|
|
3393
3397
|
class oC {
|
|
3394
3398
|
dirty_ = !0;
|
|
3395
3399
|
matrix_ = $();
|
|
@@ -3402,7 +3406,7 @@ class oC {
|
|
|
3402
3406
|
* @param q - The rotation to apply.
|
|
3403
3407
|
*/
|
|
3404
3408
|
addRotation(A) {
|
|
3405
|
-
|
|
3409
|
+
sQ(this.rotation_, this.rotation_, A), this.dirty_ = !0;
|
|
3406
3410
|
}
|
|
3407
3411
|
/**
|
|
3408
3412
|
* Replaces the rotation with the given quaternion.
|
|
@@ -3410,11 +3414,11 @@ class oC {
|
|
|
3410
3414
|
* @param q - The new rotation.
|
|
3411
3415
|
*/
|
|
3412
3416
|
setRotation(A) {
|
|
3413
|
-
|
|
3417
|
+
hQ(this.rotation_, A), this.dirty_ = !0;
|
|
3414
3418
|
}
|
|
3415
3419
|
/** A copy of the rotation quaternion. */
|
|
3416
3420
|
get rotation() {
|
|
3417
|
-
return
|
|
3421
|
+
return DQ(this.rotation_);
|
|
3418
3422
|
}
|
|
3419
3423
|
/**
|
|
3420
3424
|
* Adds the given offset to the translation.
|
|
@@ -3442,7 +3446,7 @@ class oC {
|
|
|
3442
3446
|
* @param vec - The scale factors to apply.
|
|
3443
3447
|
*/
|
|
3444
3448
|
addScale(A) {
|
|
3445
|
-
|
|
3449
|
+
IQ(this.scale_, this.scale_, A), this.dirty_ = !0;
|
|
3446
3450
|
}
|
|
3447
3451
|
/**
|
|
3448
3452
|
* Replaces the scale with the given vector.
|
|
@@ -3460,7 +3464,7 @@ class oC {
|
|
|
3460
3464
|
*/
|
|
3461
3465
|
targetTo(A) {
|
|
3462
3466
|
Fg(this.translation_, A) && (A = EA(A), A[2] += m);
|
|
3463
|
-
const I =
|
|
3467
|
+
const I = $C($(), this.translation_, A, bQ), B = PC($B(), I);
|
|
3464
3468
|
rg(this.rotation_, B), dI(this.rotation_, this.rotation_), this.dirty_ = !0;
|
|
3465
3469
|
}
|
|
3466
3470
|
/** A copy of the scale vector. */
|
|
@@ -3476,7 +3480,7 @@ class oC {
|
|
|
3476
3480
|
return PA($(), this.matrix);
|
|
3477
3481
|
}
|
|
3478
3482
|
computeMatrix() {
|
|
3479
|
-
|
|
3483
|
+
vC(
|
|
3480
3484
|
this.matrix_,
|
|
3481
3485
|
this.rotation_,
|
|
3482
3486
|
this.translation_,
|
|
@@ -3555,7 +3559,7 @@ class zA extends YI {
|
|
|
3555
3559
|
* changes.
|
|
3556
3560
|
*/
|
|
3557
3561
|
get wireframeGeometry() {
|
|
3558
|
-
return this.wireframeGeometry_ ??= new
|
|
3562
|
+
return this.wireframeGeometry_ ??= new WQ(this.geometry), this.wireframeGeometry_;
|
|
3559
3563
|
}
|
|
3560
3564
|
/** The assigned textures indexed by texture unit. */
|
|
3561
3565
|
get textures() {
|
|
@@ -3659,7 +3663,7 @@ class aC extends pA {
|
|
|
3659
3663
|
});
|
|
3660
3664
|
}
|
|
3661
3665
|
}
|
|
3662
|
-
class
|
|
3666
|
+
class ZQ extends zA {
|
|
3663
3667
|
/**
|
|
3664
3668
|
* A matrix mapping world space to the texture's normalized coordinate
|
|
3665
3669
|
* space. Layers derive it from the chunk's offset, scale, and shape.
|
|
@@ -3678,7 +3682,7 @@ class PQ extends zA {
|
|
|
3678
3682
|
texture: B,
|
|
3679
3683
|
channelProps: C = []
|
|
3680
3684
|
}) {
|
|
3681
|
-
super(), this.geometry = new aC(A, I, 1, 1), this.setTexture(0, B), this.channels_ = Bg(B, C), this.programName =
|
|
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";
|
|
3682
3686
|
}
|
|
3683
3687
|
/** Identifies the renderable type as `ImageRenderable`. */
|
|
3684
3688
|
get type() {
|
|
@@ -3727,7 +3731,7 @@ class PQ extends zA {
|
|
|
3727
3731
|
};
|
|
3728
3732
|
}
|
|
3729
3733
|
}
|
|
3730
|
-
function
|
|
3734
|
+
function PQ(g) {
|
|
3731
3735
|
switch (g.dataType) {
|
|
3732
3736
|
case "byte":
|
|
3733
3737
|
case "int":
|
|
@@ -3773,7 +3777,7 @@ function sC(g, A, I, B, C = 3) {
|
|
|
3773
3777
|
case "pointerup": {
|
|
3774
3778
|
if (!A) return A;
|
|
3775
3779
|
const Q = g.event, E = v(Q.clientX, Q.clientY);
|
|
3776
|
-
if (
|
|
3780
|
+
if (tQ(A, E) < C) {
|
|
3777
3781
|
if (!B) return null;
|
|
3778
3782
|
const o = g.worldRay;
|
|
3779
3783
|
return o && I(o).then((a) => {
|
|
@@ -4000,7 +4004,7 @@ class Jg extends KI {
|
|
|
4000
4004
|
return this.channelProps_ ? [this.channelProps_[A.chunkIndex.c] ?? {}] : [{}];
|
|
4001
4005
|
}
|
|
4002
4006
|
createImage(A, I) {
|
|
4003
|
-
const B = new
|
|
4007
|
+
const B = new ZQ({
|
|
4004
4008
|
width: A.shape[this.axes_.u],
|
|
4005
4009
|
height: A.shape[this.axes_.v],
|
|
4006
4010
|
texture: I,
|
|
@@ -4134,7 +4138,7 @@ class aB extends Rg {
|
|
|
4134
4138
|
return this.height_;
|
|
4135
4139
|
}
|
|
4136
4140
|
}
|
|
4137
|
-
const
|
|
4141
|
+
const OQ = [
|
|
4138
4142
|
[1, 0.5, 0.5],
|
|
4139
4143
|
[0.5, 1, 0.5],
|
|
4140
4144
|
[0.5, 0.5, 1],
|
|
@@ -4142,7 +4146,7 @@ const VQ = [
|
|
|
4142
4146
|
[1, 0.5, 1],
|
|
4143
4147
|
[1, 1, 0.5]
|
|
4144
4148
|
];
|
|
4145
|
-
function
|
|
4149
|
+
function VQ(g) {
|
|
4146
4150
|
return g = g ?? /* @__PURE__ */ new Map(), new Map(
|
|
4147
4151
|
Array.from(g.entries()).map(([A, I]) => [
|
|
4148
4152
|
A,
|
|
@@ -4150,35 +4154,35 @@ function vQ(g) {
|
|
|
4150
4154
|
])
|
|
4151
4155
|
);
|
|
4152
4156
|
}
|
|
4153
|
-
function
|
|
4154
|
-
return g = g ??
|
|
4157
|
+
function vQ(g) {
|
|
4158
|
+
return g = g ?? OQ, g.map(T.from);
|
|
4155
4159
|
}
|
|
4156
4160
|
function nI(g = {}) {
|
|
4157
4161
|
return {
|
|
4158
|
-
lookupTable:
|
|
4159
|
-
cycle:
|
|
4162
|
+
lookupTable: VQ(g.lookupTable),
|
|
4163
|
+
cycle: vQ(g.cycle)
|
|
4160
4164
|
};
|
|
4161
4165
|
}
|
|
4162
|
-
const DC = /* @__PURE__ */ new Set(["byte", "short", "int"]),
|
|
4166
|
+
const DC = /* @__PURE__ */ new Set(["byte", "short", "int"]), XQ = /* @__PURE__ */ new Set([
|
|
4163
4167
|
"unsigned_byte",
|
|
4164
4168
|
"unsigned_short",
|
|
4165
4169
|
"unsigned_int"
|
|
4166
4170
|
]);
|
|
4167
|
-
function
|
|
4171
|
+
function jQ(g) {
|
|
4168
4172
|
if (g.dataFormat !== "scalar")
|
|
4169
4173
|
throw new Error(
|
|
4170
4174
|
`Image data format must be scalar, instead found: ${g.dataFormat}`
|
|
4171
4175
|
);
|
|
4172
|
-
if (!DC.has(g.dataType) && !
|
|
4176
|
+
if (!DC.has(g.dataType) && !XQ.has(g.dataType))
|
|
4173
4177
|
throw new Error(
|
|
4174
4178
|
`Image data type must be an integer, instead found: ${g.dataType}`
|
|
4175
4179
|
);
|
|
4176
4180
|
return g;
|
|
4177
4181
|
}
|
|
4178
|
-
function
|
|
4182
|
+
function zQ(g) {
|
|
4179
4183
|
return DC.has(g.dataType) ? "intLabelImage" : "labelImage";
|
|
4180
4184
|
}
|
|
4181
|
-
class
|
|
4185
|
+
class _Q extends zA {
|
|
4182
4186
|
/**
|
|
4183
4187
|
* A matrix mapping world space to the texture's normalized coordinate
|
|
4184
4188
|
* space. Layers derive it from the chunk's offset, scale, and shape.
|
|
@@ -4193,9 +4197,9 @@ class $Q extends zA {
|
|
|
4193
4197
|
* @param props - Initialization properties.
|
|
4194
4198
|
*/
|
|
4195
4199
|
constructor(A) {
|
|
4196
|
-
super(), this.geometry = new aC(A.width, A.height, 1, 1), this.setTexture(0,
|
|
4200
|
+
super(), this.geometry = new aC(A.width, A.height, 1, 1), this.setTexture(0, jQ(A.imageData));
|
|
4197
4201
|
const I = nI(A.colorMap);
|
|
4198
|
-
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 =
|
|
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";
|
|
4199
4203
|
}
|
|
4200
4204
|
/** Identifies the renderable type as `LabelImageRenderable`. */
|
|
4201
4205
|
get type() {
|
|
@@ -4481,7 +4485,7 @@ class Yg extends KI {
|
|
|
4481
4485
|
return C ? (C.setTexture(0, I), C.setColorMap(this.colorMap_), C.setSelectedValue(this.selectedValue_), this.updateLabelChunk(C, A), C) : this.createLabel(A, I);
|
|
4482
4486
|
}
|
|
4483
4487
|
createLabel(A, I) {
|
|
4484
|
-
const B = new
|
|
4488
|
+
const B = new _Q({
|
|
4485
4489
|
width: A.shape[this.axes_.u],
|
|
4486
4490
|
height: A.shape[this.axes_.v],
|
|
4487
4491
|
imageData: I,
|
|
@@ -4513,7 +4517,7 @@ class Yg extends KI {
|
|
|
4513
4517
|
}
|
|
4514
4518
|
}
|
|
4515
4519
|
}
|
|
4516
|
-
class
|
|
4520
|
+
class $Q extends pA {
|
|
4517
4521
|
constructor(A, I, B, C, Q, E) {
|
|
4518
4522
|
super();
|
|
4519
4523
|
const i = [], o = [], a = Math.floor(C), s = Math.floor(Q), D = Math.floor(E);
|
|
@@ -4560,7 +4564,7 @@ class AE extends pA {
|
|
|
4560
4564
|
}
|
|
4561
4565
|
}
|
|
4562
4566
|
}
|
|
4563
|
-
class
|
|
4567
|
+
class AE extends zA {
|
|
4564
4568
|
/**
|
|
4565
4569
|
* World size of a voxel along each axis. Layers set it from the chunk
|
|
4566
4570
|
* scale so ray march steps account for anisotropic voxels. Defaults to
|
|
@@ -4576,7 +4580,7 @@ class IE extends zA {
|
|
|
4576
4580
|
* @param props - Initialization properties.
|
|
4577
4581
|
*/
|
|
4578
4582
|
constructor({ channelProps: A = [] } = {}) {
|
|
4579
|
-
super(), this.geometry = new
|
|
4583
|
+
super(), this.geometry = new $Q(1, 1, 1, 1, 1, 1), this.cullFaceMode = "front", this.depthTest = !1, this.channels_ = [], this.setChannelProps(A);
|
|
4580
4584
|
}
|
|
4581
4585
|
/** Identifies the renderable type as `VolumeRenderable`. */
|
|
4582
4586
|
get type() {
|
|
@@ -4598,7 +4602,7 @@ class IE extends zA {
|
|
|
4598
4602
|
addChannelTexture(A, I) {
|
|
4599
4603
|
const B = this.textures.length;
|
|
4600
4604
|
this.setTexture(B, I), this.channelToTextureIndex_.set(A, B);
|
|
4601
|
-
const C =
|
|
4605
|
+
const C = IE(I.dataType);
|
|
4602
4606
|
if (this.programName && this.programName !== C)
|
|
4603
4607
|
throw new Error(
|
|
4604
4608
|
`Volume renderable does not support multiple channels with different data types. Existing program: ${this.programName}, new channel data type: ${I.dataType} and program: ${C}`
|
|
@@ -4710,7 +4714,7 @@ class IE extends zA {
|
|
|
4710
4714
|
this.channels_[A] = C;
|
|
4711
4715
|
}
|
|
4712
4716
|
}
|
|
4713
|
-
function
|
|
4717
|
+
function IE(g) {
|
|
4714
4718
|
switch (g) {
|
|
4715
4719
|
case "byte":
|
|
4716
4720
|
case "int":
|
|
@@ -4724,8 +4728,8 @@ function gE(g) {
|
|
|
4724
4728
|
return "floatVolume";
|
|
4725
4729
|
}
|
|
4726
4730
|
}
|
|
4727
|
-
const
|
|
4728
|
-
class
|
|
4731
|
+
const gE = 2;
|
|
4732
|
+
class BE extends KI {
|
|
4729
4733
|
/** Identifies the layer type as `VolumeLayer`. */
|
|
4730
4734
|
type = "VolumeLayer";
|
|
4731
4735
|
/** Highlights rays of zero length for debugging. Defaults to `false`. */
|
|
@@ -4832,7 +4836,7 @@ class CE extends KI {
|
|
|
4832
4836
|
for (const E of I) B.updateVolumeWithChunk(E);
|
|
4833
4837
|
return B;
|
|
4834
4838
|
}
|
|
4835
|
-
const C =
|
|
4839
|
+
const C = EE(I[0]), Q = this.pool_.acquire(C) ?? new AE();
|
|
4836
4840
|
Q.setChannelProps(this.channelProps_ ?? []), this.volumeToPoolKey_.set(Q, C);
|
|
4837
4841
|
for (const E of I) Q.updateVolumeWithChunk(E);
|
|
4838
4842
|
return this.updateVolumeTransform(Q, I[0]), Q;
|
|
@@ -4856,7 +4860,7 @@ class CE extends KI {
|
|
|
4856
4860
|
updateChunks() {
|
|
4857
4861
|
if (!this.chunkStoreView_) return;
|
|
4858
4862
|
this.state !== "ready" && this.setState("ready");
|
|
4859
|
-
const A = this.chunkStoreView_.getChunksToRender(), I = this.sliceCoords_.t ?? -1, B =
|
|
4863
|
+
const A = this.chunkStoreView_.getChunksToRender(), I = this.sliceCoords_.t ?? -1, B = QE(A);
|
|
4860
4864
|
if (this.lastLoadedTime_ !== I || B.size !== this.currentVolumes_.size || this.lastNumRenderedChannelChunks_ !== A.length) {
|
|
4861
4865
|
for (const [Q, E] of this.currentVolumes_)
|
|
4862
4866
|
B.has(Q) || (this.releaseAndRemoveVolume(E), this.currentVolumes_.delete(Q));
|
|
@@ -4901,11 +4905,11 @@ class CE extends KI {
|
|
|
4901
4905
|
A.camera.getViewProjection()
|
|
4902
4906
|
);
|
|
4903
4907
|
const I = A.cameraControls?.isMoving ?? !1;
|
|
4904
|
-
this.interactiveStepSizeScale_ = I ?
|
|
4908
|
+
this.interactiveStepSizeScale_ = I ? gE : 1, this.updateChunks(), this.rebuildObjects(A.camera);
|
|
4905
4909
|
}
|
|
4906
4910
|
rebuildObjects(A) {
|
|
4907
4911
|
const I = Array.from(this.currentVolumes_.values());
|
|
4908
|
-
|
|
4912
|
+
iE(I, A), this.clearObjects();
|
|
4909
4913
|
for (const B of I)
|
|
4910
4914
|
this.addObject(B);
|
|
4911
4915
|
}
|
|
@@ -4923,34 +4927,81 @@ class CE extends KI {
|
|
|
4923
4927
|
};
|
|
4924
4928
|
}
|
|
4925
4929
|
}
|
|
4926
|
-
function
|
|
4930
|
+
function CE(g) {
|
|
4927
4931
|
const { x: A, y: I, z: B, t: C } = g.chunkIndex;
|
|
4928
4932
|
return `${A}:${I}:${B}:${C}`;
|
|
4929
4933
|
}
|
|
4930
|
-
function
|
|
4934
|
+
function QE(g) {
|
|
4931
4935
|
const A = /* @__PURE__ */ new Map();
|
|
4932
4936
|
for (const I of g) {
|
|
4933
|
-
const B =
|
|
4937
|
+
const B = CE(I);
|
|
4934
4938
|
let C = A.get(B);
|
|
4935
4939
|
C || (C = [], A.set(B, C)), C.push(I);
|
|
4936
4940
|
}
|
|
4937
4941
|
return A;
|
|
4938
4942
|
}
|
|
4939
|
-
function
|
|
4943
|
+
function EE(g) {
|
|
4940
4944
|
return [
|
|
4941
4945
|
`lod${g.lod}`,
|
|
4942
4946
|
`shape${g.shape.x}x${g.shape.y}x${g.shape.z}`,
|
|
4943
4947
|
`align${g.rowAlignmentBytes}`
|
|
4944
4948
|
].join(":");
|
|
4945
4949
|
}
|
|
4946
|
-
function
|
|
4950
|
+
function iE(g, A) {
|
|
4947
4951
|
const I = A.position, B = /* @__PURE__ */ new Map();
|
|
4948
4952
|
for (const C of g) {
|
|
4949
4953
|
const Q = C.transform.translation;
|
|
4950
|
-
B.set(C,
|
|
4954
|
+
B.set(C, gQ(I, Q));
|
|
4951
4955
|
}
|
|
4952
4956
|
g.sort((C, Q) => B.get(Q) - B.get(C));
|
|
4953
4957
|
}
|
|
4958
|
+
let oE = class {
|
|
4959
|
+
renderer_;
|
|
4960
|
+
chunkManager_;
|
|
4961
|
+
viewports_;
|
|
4962
|
+
/** @hidden */
|
|
4963
|
+
constructor(A, I, B) {
|
|
4964
|
+
this.renderer_ = A, this.chunkManager_ = I, this.viewports_ = B;
|
|
4965
|
+
}
|
|
4966
|
+
/**
|
|
4967
|
+
* CPU chunk memory shared across instances, this renderer's GPU texture
|
|
4968
|
+
* memory, and optional JS heap figures. Heap figures are not specific to
|
|
4969
|
+
* this instance. Sizes are in bytes.
|
|
4970
|
+
*/
|
|
4971
|
+
get memory() {
|
|
4972
|
+
const A = performance.memory;
|
|
4973
|
+
return {
|
|
4974
|
+
...this.chunkManager_.memoryStats,
|
|
4975
|
+
gpuTextureBytes: this.renderer_.gpuTextureBytes,
|
|
4976
|
+
gpuTextureCount: this.renderer_.gpuTextureCount,
|
|
4977
|
+
jsHeapUsedBytes: A?.usedJSHeapSize,
|
|
4978
|
+
jsHeapLimitBytes: A?.jsHeapSizeLimit
|
|
4979
|
+
};
|
|
4980
|
+
}
|
|
4981
|
+
/** Counts of queued and in-flight chunk requests for this instance. */
|
|
4982
|
+
get queue() {
|
|
4983
|
+
return this.chunkManager_.queueStats;
|
|
4984
|
+
}
|
|
4985
|
+
/**
|
|
4986
|
+
* Chunk demand and GPU residency per source, by timepoint, and loading
|
|
4987
|
+
* progress per viewport. Each read walks every view's chunk states, so poll
|
|
4988
|
+
* it at the rate you need rather than every frame.
|
|
4989
|
+
*/
|
|
4990
|
+
get chunks() {
|
|
4991
|
+
const A = [];
|
|
4992
|
+
for (const I of this.viewports_) {
|
|
4993
|
+
const B = [];
|
|
4994
|
+
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));
|
|
4997
|
+
}
|
|
4998
|
+
return { sources: this.chunkManager_.sourceChunkStats, viewports: A };
|
|
4999
|
+
}
|
|
5000
|
+
/** Objects reported by the renderer for the last viewport render. */
|
|
5001
|
+
get renderedObjects() {
|
|
5002
|
+
return this.renderer_.renderedObjects;
|
|
5003
|
+
}
|
|
5004
|
+
};
|
|
4954
5005
|
var ZA = function(g = 1) {
|
|
4955
5006
|
var A = 0, I = document.createElement("div");
|
|
4956
5007
|
I.style.cssText = "position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000", I.addEventListener("click", function(D) {
|
|
@@ -5010,269 +5061,7 @@ function aE({ scale: g } = { scale: 1.5 }) {
|
|
|
5010
5061
|
/* 0 = fps, 1 = ms, 2 = mb */
|
|
5011
5062
|
), document.body.appendChild(A.dom), A;
|
|
5012
5063
|
}
|
|
5013
|
-
|
|
5014
|
-
"pointerdown",
|
|
5015
|
-
"pointermove",
|
|
5016
|
-
"pointerup",
|
|
5017
|
-
"pointercancel",
|
|
5018
|
-
"wheel"
|
|
5019
|
-
];
|
|
5020
|
-
function sE(g) {
|
|
5021
|
-
return Cg.includes(g);
|
|
5022
|
-
}
|
|
5023
|
-
class DE {
|
|
5024
|
-
propagationStopped_ = !1;
|
|
5025
|
-
type;
|
|
5026
|
-
event;
|
|
5027
|
-
worldPos;
|
|
5028
|
-
worldRay;
|
|
5029
|
-
clipPos;
|
|
5030
|
-
constructor(A, I) {
|
|
5031
|
-
this.type = A, this.event = I;
|
|
5032
|
-
}
|
|
5033
|
-
get propagationStopped() {
|
|
5034
|
-
return this.propagationStopped_;
|
|
5035
|
-
}
|
|
5036
|
-
stopPropagation() {
|
|
5037
|
-
this.propagationStopped_ = !0;
|
|
5038
|
-
}
|
|
5039
|
-
}
|
|
5040
|
-
class hE {
|
|
5041
|
-
listeners_ = [];
|
|
5042
|
-
element_;
|
|
5043
|
-
isConnected_ = !1;
|
|
5044
|
-
constructor(A) {
|
|
5045
|
-
this.element_ = A;
|
|
5046
|
-
}
|
|
5047
|
-
addEventListener(A) {
|
|
5048
|
-
this.listeners_.push(A);
|
|
5049
|
-
}
|
|
5050
|
-
removeEventListener(A) {
|
|
5051
|
-
const I = this.listeners_.indexOf(A);
|
|
5052
|
-
if (I === -1)
|
|
5053
|
-
throw new Error(`Listener to remove could not be found: ${A}`);
|
|
5054
|
-
this.listeners_.splice(I, 1);
|
|
5055
|
-
}
|
|
5056
|
-
connect() {
|
|
5057
|
-
if (this.isConnected_) {
|
|
5058
|
-
k.warn(
|
|
5059
|
-
"EventDispatcher",
|
|
5060
|
-
"Attempted to connect already connected event dispatcher",
|
|
5061
|
-
`element id: ${this.element_.id}`
|
|
5062
|
-
);
|
|
5063
|
-
return;
|
|
5064
|
-
}
|
|
5065
|
-
this.isConnected_ = !0, Cg.forEach((A) => {
|
|
5066
|
-
this.element_.addEventListener(A, this.handleEvent, {
|
|
5067
|
-
passive: !1
|
|
5068
|
-
});
|
|
5069
|
-
});
|
|
5070
|
-
}
|
|
5071
|
-
disconnect() {
|
|
5072
|
-
if (!this.isConnected_) {
|
|
5073
|
-
k.debug(
|
|
5074
|
-
"EventDispatcher",
|
|
5075
|
-
"Attempted to disconnect already disconnected event dispatcher",
|
|
5076
|
-
`element id: ${this.element_.id}`
|
|
5077
|
-
);
|
|
5078
|
-
return;
|
|
5079
|
-
}
|
|
5080
|
-
this.isConnected_ = !1, Cg.forEach((A) => {
|
|
5081
|
-
this.element_.removeEventListener(A, this.handleEvent);
|
|
5082
|
-
});
|
|
5083
|
-
}
|
|
5084
|
-
handleEvent = (A) => {
|
|
5085
|
-
if (!sE(A.type)) {
|
|
5086
|
-
k.error("EventDispatcher", `Unsupported event type ${A.type}`);
|
|
5087
|
-
return;
|
|
5088
|
-
}
|
|
5089
|
-
const I = new DE(A.type, A);
|
|
5090
|
-
for (const B of this.listeners_)
|
|
5091
|
-
if (B(I), I.propagationStopped) break;
|
|
5092
|
-
};
|
|
5093
|
-
}
|
|
5094
|
-
const tE = 1e-12;
|
|
5095
|
-
class yE {
|
|
5096
|
-
origin;
|
|
5097
|
-
direction;
|
|
5098
|
-
constructor(A, I) {
|
|
5099
|
-
this.origin = EA(A), this.direction = IC(M(), I);
|
|
5100
|
-
}
|
|
5101
|
-
intersectWithPlane(A) {
|
|
5102
|
-
const I = sI(this.direction, A.normal);
|
|
5103
|
-
if (Math.abs(I) < tE)
|
|
5104
|
-
return null;
|
|
5105
|
-
const B = -A.signedDistanceToPoint(this.origin) / I;
|
|
5106
|
-
return Ag(M(), this.origin, this.direction, B);
|
|
5107
|
-
}
|
|
5108
|
-
}
|
|
5109
|
-
class eE {
|
|
5110
|
-
/** The viewport's unique identifier. */
|
|
5111
|
-
id;
|
|
5112
|
-
/** The host element defining the viewport's area. */
|
|
5113
|
-
element;
|
|
5114
|
-
/** The camera the viewport renders with. */
|
|
5115
|
-
camera;
|
|
5116
|
-
/** The pointer and wheel event dispatcher for the host element. */
|
|
5117
|
-
events;
|
|
5118
|
-
/** Input controls driving the camera. */
|
|
5119
|
-
cameraControls;
|
|
5120
|
-
// Carried only to relay to `layer.onAttached` / `layer.onDetached`.
|
|
5121
|
-
// To be removed when the chunk-infrastructure refactor folds chunk management
|
|
5122
|
-
// into the source and the attach lifecycle goes away.
|
|
5123
|
-
context_;
|
|
5124
|
-
layers_ = [];
|
|
5125
|
-
/** @hidden */
|
|
5126
|
-
constructor(A) {
|
|
5127
|
-
this.id = A.id, this.element = A.element, this.camera = A.camera, this.context_ = A.context, this.cameraControls = A.cameraControls, this.updateAspectRatio(), this.events = new hE(this.element), this.events.addEventListener((I) => {
|
|
5128
|
-
if (I.event instanceof PointerEvent || I.event instanceof WheelEvent) {
|
|
5129
|
-
const { clientX: B, clientY: C } = I.event, Q = v(B, C);
|
|
5130
|
-
I.clipPos = this.clientToClip(Q, 0), I.worldPos = this.camera.clipToWorld(I.clipPos);
|
|
5131
|
-
const E = this.camera.clipToWorld(this.clientToClip(Q, -1)), i = this.camera.clipToWorld(this.clientToClip(Q, 1));
|
|
5132
|
-
I.worldRay = new yE(E, Gg(M(), i, E));
|
|
5133
|
-
}
|
|
5134
|
-
for (const B of this.layers_)
|
|
5135
|
-
if (B.onEvent(I), I.propagationStopped) return;
|
|
5136
|
-
this.cameraControls?.onEvent(I);
|
|
5137
|
-
});
|
|
5138
|
-
for (const I of A.layers ?? [])
|
|
5139
|
-
this.addLayer(I);
|
|
5140
|
-
}
|
|
5141
|
-
/**
|
|
5142
|
-
* The layers rendered by this viewport in order. Layers with `occludes`
|
|
5143
|
-
* set draw before non-occluding layers regardless of stack order.
|
|
5144
|
-
*/
|
|
5145
|
-
get layers() {
|
|
5146
|
-
return this.layers_;
|
|
5147
|
-
}
|
|
5148
|
-
/**
|
|
5149
|
-
* Adds a layer to the top of the stack.
|
|
5150
|
-
*
|
|
5151
|
-
* @param layer - The layer to add.
|
|
5152
|
-
*/
|
|
5153
|
-
addLayer(A) {
|
|
5154
|
-
A.onAttached(this.context_), this.layers_.push(A);
|
|
5155
|
-
}
|
|
5156
|
-
/**
|
|
5157
|
-
* Removes a previously added layer.
|
|
5158
|
-
*
|
|
5159
|
-
* @param layer - The layer to remove.
|
|
5160
|
-
*/
|
|
5161
|
-
removeLayer(A) {
|
|
5162
|
-
const I = this.layers_.indexOf(A);
|
|
5163
|
-
if (I === -1)
|
|
5164
|
-
throw new Error(`Layer to remove not found: ${A}`);
|
|
5165
|
-
this.layers_.splice(I, 1), A.onDetached(this.context_);
|
|
5166
|
-
}
|
|
5167
|
-
/** Removes all layers from the viewport. */
|
|
5168
|
-
removeAllLayers() {
|
|
5169
|
-
for (const A of this.layers_)
|
|
5170
|
-
A.onDetached(this.context_);
|
|
5171
|
-
this.layers_ = [];
|
|
5172
|
-
}
|
|
5173
|
-
/**
|
|
5174
|
-
* Syncs the camera's aspect ratio to the host element's size. Called
|
|
5175
|
-
* automatically when the host element resizes.
|
|
5176
|
-
*/
|
|
5177
|
-
updateSize() {
|
|
5178
|
-
this.updateAspectRatio();
|
|
5179
|
-
}
|
|
5180
|
-
/**
|
|
5181
|
-
* Computes the viewport's box relative to the given canvas in device pixels.
|
|
5182
|
-
*
|
|
5183
|
-
* @param canvas - The canvas to compute the box against.
|
|
5184
|
-
* @returns The viewport's box in the canvas's coordinate space.
|
|
5185
|
-
*/
|
|
5186
|
-
getBoxRelativeTo(A) {
|
|
5187
|
-
const I = this.getBox().toRect(), B = A.getBoundingClientRect(), C = window.devicePixelRatio || 1, Q = B.left * C, E = B.top * C, i = B.height * C, o = I.x - Q, a = I.y - E, s = Math.floor(o), D = Math.floor(i - a - I.height), h = Math.floor(I.width), t = Math.floor(I.height);
|
|
5188
|
-
return new AA(
|
|
5189
|
-
v(s, D),
|
|
5190
|
-
v(s + h, D + t)
|
|
5191
|
-
);
|
|
5192
|
-
}
|
|
5193
|
-
/**
|
|
5194
|
-
* The viewport's rectangle in the drawing buffer in device pixels.
|
|
5195
|
-
*/
|
|
5196
|
-
getBufferRect() {
|
|
5197
|
-
return this.getBoxRelativeTo(this.element).toRect();
|
|
5198
|
-
}
|
|
5199
|
-
/**
|
|
5200
|
-
* Converts a client-space position to clip space. The `y` axis points
|
|
5201
|
-
* down, matching the renderer's mirrored projection.
|
|
5202
|
-
*
|
|
5203
|
-
* @param position - The client-space position to convert.
|
|
5204
|
-
* @param depth - The clip-space z value.
|
|
5205
|
-
*/
|
|
5206
|
-
clientToClip(A, I = 0) {
|
|
5207
|
-
const [B, C] = A, Q = this.element.getBoundingClientRect();
|
|
5208
|
-
return x(
|
|
5209
|
-
2 * (B - Q.x) / Q.width - 1,
|
|
5210
|
-
2 * (C - Q.y) / Q.height - 1,
|
|
5211
|
-
I
|
|
5212
|
-
);
|
|
5213
|
-
}
|
|
5214
|
-
/**
|
|
5215
|
-
* Converts a client-space position such as a pointer location to world
|
|
5216
|
-
* space.
|
|
5217
|
-
*
|
|
5218
|
-
* @param position - The client-space position to convert.
|
|
5219
|
-
* @param depth - The clip-space z value.
|
|
5220
|
-
*/
|
|
5221
|
-
clientToWorld(A, I = 0) {
|
|
5222
|
-
const B = this.clientToClip(A, I);
|
|
5223
|
-
return this.camera.clipToWorld(B);
|
|
5224
|
-
}
|
|
5225
|
-
getBox() {
|
|
5226
|
-
const A = this.element.getBoundingClientRect(), I = window.devicePixelRatio || 1, B = A.left * I, C = A.top * I, Q = A.width * I, E = A.height * I;
|
|
5227
|
-
return new AA(
|
|
5228
|
-
v(B, C),
|
|
5229
|
-
v(B + Q, C + E)
|
|
5230
|
-
);
|
|
5231
|
-
}
|
|
5232
|
-
updateAspectRatio() {
|
|
5233
|
-
const { width: A, height: I } = this.getBox().toRect();
|
|
5234
|
-
if (A <= 0 || I <= 0) {
|
|
5235
|
-
k.debug(
|
|
5236
|
-
"Viewport",
|
|
5237
|
-
`Skipping aspect ratio update for viewport ${this.id}: invalid dimensions ${A}x${I}`
|
|
5238
|
-
);
|
|
5239
|
-
return;
|
|
5240
|
-
}
|
|
5241
|
-
const B = A / I;
|
|
5242
|
-
this.camera.setAspectRatio(B);
|
|
5243
|
-
}
|
|
5244
|
-
}
|
|
5245
|
-
function hC(g, A) {
|
|
5246
|
-
for (const I of A) {
|
|
5247
|
-
if (I.id === g.id)
|
|
5248
|
-
throw new Error(
|
|
5249
|
-
`Duplicate viewport ID "${g.id}". Each viewport must have a unique ID.`
|
|
5250
|
-
);
|
|
5251
|
-
if (I.element === g.element) {
|
|
5252
|
-
const B = g.element.tagName.toLowerCase() + (g.element.id ? `#${g.element.id}` : "[element has no id]");
|
|
5253
|
-
throw new Error(
|
|
5254
|
-
`Multiple viewports cannot share the same HTML element: viewports "${I.id}" and "${g.id}" both use ${B}`
|
|
5255
|
-
);
|
|
5256
|
-
}
|
|
5257
|
-
}
|
|
5258
|
-
}
|
|
5259
|
-
function nE(g) {
|
|
5260
|
-
for (let A = 0; A < g.length; A++)
|
|
5261
|
-
hC(g[A], g.slice(0, A));
|
|
5262
|
-
}
|
|
5263
|
-
function sB(g, A, I) {
|
|
5264
|
-
const B = g.map((C) => {
|
|
5265
|
-
const Q = C.element ?? A;
|
|
5266
|
-
return {
|
|
5267
|
-
...C,
|
|
5268
|
-
element: Q,
|
|
5269
|
-
id: C.id ?? Q.id ?? _B("viewport"),
|
|
5270
|
-
context: I
|
|
5271
|
-
};
|
|
5272
|
-
});
|
|
5273
|
-
return nE(B), B.map((C) => new eE(C));
|
|
5274
|
-
}
|
|
5275
|
-
class GE {
|
|
5064
|
+
class sE {
|
|
5276
5065
|
elements_;
|
|
5277
5066
|
resizeObserver_;
|
|
5278
5067
|
mediaQuery_;
|
|
@@ -5331,16 +5120,41 @@ class GE {
|
|
|
5331
5120
|
this.elements_.splice(I, 1), this.resizeObserver_ && this.resizeObserver_.unobserve(A);
|
|
5332
5121
|
}
|
|
5333
5122
|
}
|
|
5334
|
-
const
|
|
5335
|
-
|
|
5123
|
+
const DE = 2048;
|
|
5124
|
+
function sB(g, A) {
|
|
5125
|
+
for (const B of A) {
|
|
5126
|
+
if (B.id === g.id)
|
|
5127
|
+
throw new Error(
|
|
5128
|
+
`Duplicate viewport ID "${g.id}". Each viewport must have a unique ID.`
|
|
5129
|
+
);
|
|
5130
|
+
if (B.domElement === g.domElement) {
|
|
5131
|
+
const C = g.domElement.tagName.toLowerCase() + (g.domElement.id ? `#${g.domElement.id}` : "[element has no id]");
|
|
5132
|
+
throw new Error(
|
|
5133
|
+
`Multiple viewports cannot share the same HTML element: viewports "${B.id}" and "${g.id}" both use ${C}`
|
|
5134
|
+
);
|
|
5135
|
+
}
|
|
5136
|
+
}
|
|
5137
|
+
const I = new Set(
|
|
5138
|
+
A.flatMap((B) => B.layers)
|
|
5139
|
+
);
|
|
5140
|
+
for (const B of g.layers)
|
|
5141
|
+
if (I.has(B))
|
|
5142
|
+
throw new Error(
|
|
5143
|
+
`${B.type} cannot be shared by multiple viewports simultaneously.`
|
|
5144
|
+
);
|
|
5145
|
+
}
|
|
5146
|
+
class ko {
|
|
5336
5147
|
/** The canvas element the renderer draws into. */
|
|
5337
5148
|
canvas;
|
|
5338
5149
|
/** The registered overlays that update once per frame in order. */
|
|
5339
5150
|
overlays;
|
|
5151
|
+
/** Memory, queue, chunk, and rendered-object statistics. */
|
|
5152
|
+
stats;
|
|
5340
5153
|
chunkManager_;
|
|
5341
5154
|
context_;
|
|
5342
5155
|
renderer_;
|
|
5343
5156
|
viewports_;
|
|
5157
|
+
attachments_ = /* @__PURE__ */ new Map();
|
|
5344
5158
|
stats_;
|
|
5345
5159
|
sizeObserver_;
|
|
5346
5160
|
lastAnimationId_;
|
|
@@ -5351,9 +5165,9 @@ class Lo {
|
|
|
5351
5165
|
* @param params - Initialization properties.
|
|
5352
5166
|
*/
|
|
5353
5167
|
constructor(A) {
|
|
5354
|
-
this.canvas = A.canvas, this.renderer_ = new
|
|
5355
|
-
const B = (A.memoryLimitMB ??
|
|
5356
|
-
this.chunkManager_ = new
|
|
5168
|
+
this.canvas = A.canvas, this.renderer_ = new kQ(this.canvas);
|
|
5169
|
+
const B = (A.memoryLimitMB ?? DE) * 1024 * 1024;
|
|
5170
|
+
this.chunkManager_ = new mQ(
|
|
5357
5171
|
(Q) => this.renderer_.uploadTexture(Q),
|
|
5358
5172
|
(Q) => this.renderer_.disposeTexture(Q),
|
|
5359
5173
|
() => this.renderer_.gpuTextureBytes,
|
|
@@ -5361,54 +5175,19 @@ class Lo {
|
|
|
5361
5175
|
A.maxConcurrentRequests,
|
|
5362
5176
|
A.maxGpuUploadsPerUpdate
|
|
5363
5177
|
), this.context_ = {
|
|
5364
|
-
chunkManager: this.chunkManager_
|
|
5365
|
-
}, this.viewports_ =
|
|
5366
|
-
|
|
5367
|
-
this.
|
|
5368
|
-
|
|
5369
|
-
|
|
5370
|
-
const
|
|
5371
|
-
|
|
5372
|
-
|
|
5373
|
-
|
|
5374
|
-
|
|
5375
|
-
|
|
5376
|
-
|
|
5377
|
-
});
|
|
5378
|
-
}
|
|
5379
|
-
/** Counts of queued and in-flight chunk requests. */
|
|
5380
|
-
get chunkQueueStats() {
|
|
5381
|
-
return this.chunkManager_.queueStats;
|
|
5382
|
-
}
|
|
5383
|
-
/**
|
|
5384
|
-
* Chunk demand and GPU residency per source, by timepoint, and loading
|
|
5385
|
-
* progress per viewport. Each read walks every view's chunk states and returns a
|
|
5386
|
-
* new snapshot, so poll it at the rate you need rather than every frame.
|
|
5387
|
-
*/
|
|
5388
|
-
get chunkStats() {
|
|
5389
|
-
const A = [];
|
|
5390
|
-
for (const I of this.viewports_) {
|
|
5391
|
-
const B = [];
|
|
5392
|
-
for (const C of I.layers)
|
|
5393
|
-
!(C instanceof Jg) && !(C instanceof Yg) && !(C instanceof CE) || C.chunkStoreView && B.push(C.chunkStoreView);
|
|
5394
|
-
B.length !== 0 && A.push(pQ(I.id, B));
|
|
5395
|
-
}
|
|
5396
|
-
return { sources: this.chunkManager_.sourceChunkStats, viewports: A };
|
|
5397
|
-
}
|
|
5398
|
-
/** A snapshot of current CPU/GPU/JS heap memory usage. */
|
|
5399
|
-
get memoryStats() {
|
|
5400
|
-
const A = performance.memory;
|
|
5401
|
-
return {
|
|
5402
|
-
...this.chunkManager_.memoryStats,
|
|
5403
|
-
gpuTextureBytes: this.renderer_.gpuTextureBytes,
|
|
5404
|
-
gpuTextureCount: this.renderer_.gpuTextureCount,
|
|
5405
|
-
jsHeapUsedBytes: A?.usedJSHeapSize,
|
|
5406
|
-
jsHeapLimitBytes: A?.jsHeapSizeLimit
|
|
5407
|
-
};
|
|
5408
|
-
}
|
|
5409
|
-
/** The number of objects drawn in the last rendered frame. */
|
|
5410
|
-
get renderedObjects() {
|
|
5411
|
-
return this.renderer_.renderedObjects;
|
|
5178
|
+
chunkManager: this.chunkManager_
|
|
5179
|
+
}, this.viewports_ = [];
|
|
5180
|
+
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());
|
|
5183
|
+
const C = [this.canvas];
|
|
5184
|
+
for (const Q of this.viewports_)
|
|
5185
|
+
Q.domElement !== this.canvas && C.push(Q.domElement);
|
|
5186
|
+
this.sizeObserver_ = new sE(C, () => {
|
|
5187
|
+
this.renderer_.updateSize(), this.detachRemovedLayers(), this.renderer_.beginFrame();
|
|
5188
|
+
for (const Q of this.viewports_)
|
|
5189
|
+
Q.updateSize(), this.renderViewport(Q);
|
|
5190
|
+
});
|
|
5412
5191
|
}
|
|
5413
5192
|
/** The width of the rendering surface in pixels. */
|
|
5414
5193
|
get width() {
|
|
@@ -5438,13 +5217,11 @@ class Lo {
|
|
|
5438
5217
|
/**
|
|
5439
5218
|
* Adds a viewport at runtime.
|
|
5440
5219
|
*
|
|
5441
|
-
* @param
|
|
5442
|
-
*
|
|
5443
|
-
* @returns The created viewport.
|
|
5220
|
+
* @param viewport - The viewport to add.
|
|
5221
|
+
* @returns The added viewport.
|
|
5444
5222
|
*/
|
|
5445
5223
|
addViewport(A) {
|
|
5446
|
-
|
|
5447
|
-
return hC(I, this.viewports_), this.viewports_.push(I), this.running && (I.events.connect(), I.element !== this.canvas && this.sizeObserver_.observe(I.element)), k.info("Idetik", `Added viewport "${I.id}"`), I;
|
|
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;
|
|
5448
5225
|
}
|
|
5449
5226
|
/**
|
|
5450
5227
|
* Removes a previously added viewport.
|
|
@@ -5454,10 +5231,15 @@ class Lo {
|
|
|
5454
5231
|
*/
|
|
5455
5232
|
removeViewport(A) {
|
|
5456
5233
|
const I = this.viewports_.indexOf(A);
|
|
5457
|
-
|
|
5458
|
-
|
|
5459
|
-
|
|
5460
|
-
|
|
5234
|
+
if (I === -1)
|
|
5235
|
+
return k.warn(
|
|
5236
|
+
"Idetik",
|
|
5237
|
+
`Viewport "${A.id}" not found, nothing to remove`
|
|
5238
|
+
), !1;
|
|
5239
|
+
this.running && (A.events.disconnect(), A.domElement !== this.canvas && this.sizeObserver_.unobserve(A.domElement)), this.viewports_.splice(I, 1);
|
|
5240
|
+
for (const [B, C] of this.attachments_)
|
|
5241
|
+
C === A && (B.onDetached(this.context_), this.attachments_.delete(B));
|
|
5242
|
+
return k.info("Idetik", `Removed viewport "${A.id}"`), !0;
|
|
5461
5243
|
}
|
|
5462
5244
|
/**
|
|
5463
5245
|
* Registers an overlay that updates once per frame.
|
|
@@ -5502,12 +5284,26 @@ class Lo {
|
|
|
5502
5284
|
}
|
|
5503
5285
|
return this;
|
|
5504
5286
|
}
|
|
5287
|
+
detachRemovedLayers() {
|
|
5288
|
+
for (const [A, I] of this.attachments_)
|
|
5289
|
+
(!this.viewports_.includes(I) || !I.layers.includes(A)) && (A.onDetached(this.context_), this.attachments_.delete(A));
|
|
5290
|
+
}
|
|
5291
|
+
renderViewport(A) {
|
|
5292
|
+
for (const I of A.layers)
|
|
5293
|
+
if (I.attached && this.attachments_.get(I) !== A)
|
|
5294
|
+
throw new Error(
|
|
5295
|
+
`${I.type} is already attached to another viewport or Idetik runtime.`
|
|
5296
|
+
);
|
|
5297
|
+
for (const I of A.layers)
|
|
5298
|
+
I.attached || (I.onAttached(this.context_), this.attachments_.set(I, A));
|
|
5299
|
+
this.renderer_.render(A);
|
|
5300
|
+
}
|
|
5505
5301
|
animate(A) {
|
|
5506
5302
|
this.stats_ && this.stats_.begin();
|
|
5507
5303
|
const I = Math.min(A - this.lastTimestamp_, 100) / 1e3;
|
|
5508
|
-
this.lastTimestamp_ = A, this.renderer_.beginFrame();
|
|
5304
|
+
this.lastTimestamp_ = A, this.detachRemovedLayers(), this.renderer_.beginFrame();
|
|
5509
5305
|
for (const B of this.viewports_)
|
|
5510
|
-
B.cameraControls?.onUpdate(I), this.
|
|
5306
|
+
B.cameraControls?.onUpdate(I), this.renderViewport(B);
|
|
5511
5307
|
this.chunkManager_.update();
|
|
5512
5308
|
for (const B of this.overlays)
|
|
5513
5309
|
B.update(this);
|
|
@@ -5529,7 +5325,237 @@ class Lo {
|
|
|
5529
5325
|
}
|
|
5530
5326
|
}
|
|
5531
5327
|
}
|
|
5532
|
-
|
|
5328
|
+
const Cg = [
|
|
5329
|
+
"pointerdown",
|
|
5330
|
+
"pointermove",
|
|
5331
|
+
"pointerup",
|
|
5332
|
+
"pointercancel",
|
|
5333
|
+
"wheel"
|
|
5334
|
+
];
|
|
5335
|
+
function hE(g) {
|
|
5336
|
+
return Cg.includes(g);
|
|
5337
|
+
}
|
|
5338
|
+
class tE {
|
|
5339
|
+
propagationStopped_ = !1;
|
|
5340
|
+
type;
|
|
5341
|
+
event;
|
|
5342
|
+
worldPos;
|
|
5343
|
+
worldRay;
|
|
5344
|
+
clipPos;
|
|
5345
|
+
constructor(A, I) {
|
|
5346
|
+
this.type = A, this.event = I;
|
|
5347
|
+
}
|
|
5348
|
+
get propagationStopped() {
|
|
5349
|
+
return this.propagationStopped_;
|
|
5350
|
+
}
|
|
5351
|
+
stopPropagation() {
|
|
5352
|
+
this.propagationStopped_ = !0;
|
|
5353
|
+
}
|
|
5354
|
+
}
|
|
5355
|
+
class yE {
|
|
5356
|
+
listeners_ = [];
|
|
5357
|
+
element_;
|
|
5358
|
+
isConnected_ = !1;
|
|
5359
|
+
constructor(A) {
|
|
5360
|
+
this.element_ = A;
|
|
5361
|
+
}
|
|
5362
|
+
addEventListener(A) {
|
|
5363
|
+
this.listeners_.push(A);
|
|
5364
|
+
}
|
|
5365
|
+
removeEventListener(A) {
|
|
5366
|
+
const I = this.listeners_.indexOf(A);
|
|
5367
|
+
if (I === -1)
|
|
5368
|
+
throw new Error(`Listener to remove could not be found: ${A}`);
|
|
5369
|
+
this.listeners_.splice(I, 1);
|
|
5370
|
+
}
|
|
5371
|
+
connect() {
|
|
5372
|
+
if (this.isConnected_) {
|
|
5373
|
+
k.warn(
|
|
5374
|
+
"EventDispatcher",
|
|
5375
|
+
"Attempted to connect already connected event dispatcher",
|
|
5376
|
+
`element id: ${this.element_.id}`
|
|
5377
|
+
);
|
|
5378
|
+
return;
|
|
5379
|
+
}
|
|
5380
|
+
this.isConnected_ = !0, Cg.forEach((A) => {
|
|
5381
|
+
this.element_.addEventListener(A, this.handleEvent, {
|
|
5382
|
+
passive: !1
|
|
5383
|
+
});
|
|
5384
|
+
});
|
|
5385
|
+
}
|
|
5386
|
+
disconnect() {
|
|
5387
|
+
if (!this.isConnected_) {
|
|
5388
|
+
k.debug(
|
|
5389
|
+
"EventDispatcher",
|
|
5390
|
+
"Attempted to disconnect already disconnected event dispatcher",
|
|
5391
|
+
`element id: ${this.element_.id}`
|
|
5392
|
+
);
|
|
5393
|
+
return;
|
|
5394
|
+
}
|
|
5395
|
+
this.isConnected_ = !1, Cg.forEach((A) => {
|
|
5396
|
+
this.element_.removeEventListener(A, this.handleEvent);
|
|
5397
|
+
});
|
|
5398
|
+
}
|
|
5399
|
+
handleEvent = (A) => {
|
|
5400
|
+
if (!hE(A.type)) {
|
|
5401
|
+
k.error("EventDispatcher", `Unsupported event type ${A.type}`);
|
|
5402
|
+
return;
|
|
5403
|
+
}
|
|
5404
|
+
const I = new tE(A.type, A);
|
|
5405
|
+
for (const B of this.listeners_)
|
|
5406
|
+
if (B(I), I.propagationStopped) break;
|
|
5407
|
+
};
|
|
5408
|
+
}
|
|
5409
|
+
const eE = 1e-12;
|
|
5410
|
+
class nE {
|
|
5411
|
+
origin;
|
|
5412
|
+
direction;
|
|
5413
|
+
constructor(A, I) {
|
|
5414
|
+
this.origin = EA(A), this.direction = IC(M(), I);
|
|
5415
|
+
}
|
|
5416
|
+
intersectWithPlane(A) {
|
|
5417
|
+
const I = sI(this.direction, A.normal);
|
|
5418
|
+
if (Math.abs(I) < eE)
|
|
5419
|
+
return null;
|
|
5420
|
+
const B = -A.signedDistanceToPoint(this.origin) / I;
|
|
5421
|
+
return Ag(M(), this.origin, this.direction, B);
|
|
5422
|
+
}
|
|
5423
|
+
}
|
|
5424
|
+
class Lo {
|
|
5425
|
+
/** The viewport's unique identifier. */
|
|
5426
|
+
id;
|
|
5427
|
+
/** The host element defining the viewport's area. */
|
|
5428
|
+
domElement;
|
|
5429
|
+
/** The camera the viewport renders with. */
|
|
5430
|
+
camera;
|
|
5431
|
+
/** The pointer and wheel event dispatcher for the host element. */
|
|
5432
|
+
events;
|
|
5433
|
+
/** Input controls driving the camera. */
|
|
5434
|
+
cameraControls;
|
|
5435
|
+
layers_ = [];
|
|
5436
|
+
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) => {
|
|
5438
|
+
if (I.event instanceof PointerEvent || I.event instanceof WheelEvent) {
|
|
5439
|
+
const { clientX: B, clientY: C } = I.event, Q = v(B, C);
|
|
5440
|
+
I.clipPos = this.clientToClip(Q, 0), I.worldPos = this.camera.clipToWorld(I.clipPos);
|
|
5441
|
+
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));
|
|
5443
|
+
}
|
|
5444
|
+
for (const B of this.layers_)
|
|
5445
|
+
if (B.onEvent(I), I.propagationStopped) return;
|
|
5446
|
+
this.cameraControls?.onEvent(I);
|
|
5447
|
+
});
|
|
5448
|
+
for (const I of A.layers ?? []) this.addLayer(I);
|
|
5449
|
+
}
|
|
5450
|
+
/**
|
|
5451
|
+
* The layers rendered by this viewport in order. Layers with `occludes`
|
|
5452
|
+
* set draw before non-occluding layers regardless of stack order.
|
|
5453
|
+
*/
|
|
5454
|
+
get layers() {
|
|
5455
|
+
return this.layers_;
|
|
5456
|
+
}
|
|
5457
|
+
/**
|
|
5458
|
+
* Adds a layer to the top of the stack. Throws if the viewport already
|
|
5459
|
+
* contains the layer.
|
|
5460
|
+
*
|
|
5461
|
+
* @param layer - The layer to add.
|
|
5462
|
+
*/
|
|
5463
|
+
addLayer(A) {
|
|
5464
|
+
if (this.layers_.includes(A))
|
|
5465
|
+
throw new Error(`${A.type} is already in viewport "${this.id}".`);
|
|
5466
|
+
this.layers_.push(A);
|
|
5467
|
+
}
|
|
5468
|
+
/**
|
|
5469
|
+
* Removes a previously added layer.
|
|
5470
|
+
*
|
|
5471
|
+
* @param layer - The layer to remove.
|
|
5472
|
+
*/
|
|
5473
|
+
removeLayer(A) {
|
|
5474
|
+
const I = this.layers_.indexOf(A);
|
|
5475
|
+
if (I === -1)
|
|
5476
|
+
throw new Error(`Layer to remove not found: ${A}`);
|
|
5477
|
+
this.layers_.splice(I, 1);
|
|
5478
|
+
}
|
|
5479
|
+
/** Removes all layers from the viewport. */
|
|
5480
|
+
removeAllLayers() {
|
|
5481
|
+
this.layers_ = [];
|
|
5482
|
+
}
|
|
5483
|
+
/**
|
|
5484
|
+
* Syncs the camera's aspect ratio to the host element's size. Called
|
|
5485
|
+
* automatically when the host element resizes.
|
|
5486
|
+
*/
|
|
5487
|
+
updateSize() {
|
|
5488
|
+
this.updateAspectRatio();
|
|
5489
|
+
}
|
|
5490
|
+
/**
|
|
5491
|
+
* Computes the viewport's box relative to the given element in device
|
|
5492
|
+
* pixels, with `y` flipped to match WebGL's bottom-left origin.
|
|
5493
|
+
*
|
|
5494
|
+
* @param element - The element to compute the box against, typically the
|
|
5495
|
+
* canvas.
|
|
5496
|
+
* @returns The viewport's box in the element's coordinate space.
|
|
5497
|
+
*/
|
|
5498
|
+
getBoxRelativeTo(A) {
|
|
5499
|
+
const I = this.getBox().toRect(), B = A.getBoundingClientRect(), C = window.devicePixelRatio || 1, Q = B.left * C, E = B.top * C, i = B.height * C, o = I.x - Q, a = I.y - E, s = Math.floor(o), D = Math.floor(i - a - I.height), h = Math.floor(I.width), t = Math.floor(I.height);
|
|
5500
|
+
return new AA(
|
|
5501
|
+
v(s, D),
|
|
5502
|
+
v(s + h, D + t)
|
|
5503
|
+
);
|
|
5504
|
+
}
|
|
5505
|
+
/**
|
|
5506
|
+
* The viewport's size in device pixels. Measured relative to its own host
|
|
5507
|
+
* element, so `x` and `y` are always `0`.
|
|
5508
|
+
*/
|
|
5509
|
+
getBufferRect() {
|
|
5510
|
+
return this.getBoxRelativeTo(this.domElement).toRect();
|
|
5511
|
+
}
|
|
5512
|
+
/**
|
|
5513
|
+
* Converts a client-space position to clip space. The `y` axis points
|
|
5514
|
+
* down, matching the renderer's mirrored projection.
|
|
5515
|
+
*
|
|
5516
|
+
* @param position - The client-space position to convert.
|
|
5517
|
+
* @param depth - The clip-space z value.
|
|
5518
|
+
*/
|
|
5519
|
+
clientToClip(A, I = 0) {
|
|
5520
|
+
const [B, C] = A, Q = this.domElement.getBoundingClientRect();
|
|
5521
|
+
return x(
|
|
5522
|
+
2 * (B - Q.x) / Q.width - 1,
|
|
5523
|
+
2 * (C - Q.y) / Q.height - 1,
|
|
5524
|
+
I
|
|
5525
|
+
);
|
|
5526
|
+
}
|
|
5527
|
+
/**
|
|
5528
|
+
* Converts a client-space position such as a pointer location to world
|
|
5529
|
+
* space.
|
|
5530
|
+
*
|
|
5531
|
+
* @param position - The client-space position to convert.
|
|
5532
|
+
* @param depth - The clip-space z value.
|
|
5533
|
+
*/
|
|
5534
|
+
clientToWorld(A, I = 0) {
|
|
5535
|
+
const B = this.clientToClip(A, I);
|
|
5536
|
+
return this.camera.clipToWorld(B);
|
|
5537
|
+
}
|
|
5538
|
+
getBox() {
|
|
5539
|
+
const A = this.domElement.getBoundingClientRect(), I = window.devicePixelRatio || 1, B = A.left * I, C = A.top * I, Q = A.width * I, E = A.height * I;
|
|
5540
|
+
return new AA(
|
|
5541
|
+
v(B, C),
|
|
5542
|
+
v(B + Q, C + E)
|
|
5543
|
+
);
|
|
5544
|
+
}
|
|
5545
|
+
updateAspectRatio() {
|
|
5546
|
+
const { width: A, height: I } = this.getBox().toRect();
|
|
5547
|
+
if (A <= 0 || I <= 0) {
|
|
5548
|
+
k.debug(
|
|
5549
|
+
"Viewport",
|
|
5550
|
+
`Skipping aspect ratio update for viewport ${this.id}: invalid dimensions ${A}x${I}`
|
|
5551
|
+
);
|
|
5552
|
+
return;
|
|
5553
|
+
}
|
|
5554
|
+
const B = A / I;
|
|
5555
|
+
this.camera.setAspectRatio(B);
|
|
5556
|
+
}
|
|
5557
|
+
}
|
|
5558
|
+
function GE(g, A) {
|
|
5533
5559
|
return {
|
|
5534
5560
|
...g,
|
|
5535
5561
|
...A,
|
|
@@ -5561,7 +5587,7 @@ class _A {
|
|
|
5561
5587
|
this.url = A, this.#A = I.fetch ?? ((B) => fetch(B)), this.#I = I.overrides ?? {}, this.#g = I.useSuffixRequest ?? !1;
|
|
5562
5588
|
}
|
|
5563
5589
|
#B(A, I) {
|
|
5564
|
-
return new Request(A,
|
|
5590
|
+
return new Request(A, GE(this.#I, I));
|
|
5565
5591
|
}
|
|
5566
5592
|
async get(A, I = {}) {
|
|
5567
5593
|
let B = DB(this.url, A).href, C = this.#B(B, I), Q = await this.#A(C);
|
|
@@ -5626,7 +5652,7 @@ class X extends $A {
|
|
|
5626
5652
|
super(A, { cause: I.cause }), this.path = I.path;
|
|
5627
5653
|
}
|
|
5628
5654
|
}
|
|
5629
|
-
class
|
|
5655
|
+
class wE extends $A {
|
|
5630
5656
|
_tag = "UnknownCodecError";
|
|
5631
5657
|
name = "UnknownCodecError";
|
|
5632
5658
|
codec;
|
|
@@ -5634,7 +5660,7 @@ class rE extends $A {
|
|
|
5634
5660
|
super(`Unknown codec: ${A}`), this.codec = A;
|
|
5635
5661
|
}
|
|
5636
5662
|
}
|
|
5637
|
-
class
|
|
5663
|
+
class FE extends $A {
|
|
5638
5664
|
_tag = "CodecPipelineError";
|
|
5639
5665
|
name = "CodecPipelineError";
|
|
5640
5666
|
direction;
|
|
@@ -5684,7 +5710,7 @@ class GI {
|
|
|
5684
5710
|
function Mg(g) {
|
|
5685
5711
|
return g instanceof ArrayBuffer || g instanceof SharedArrayBuffer;
|
|
5686
5712
|
}
|
|
5687
|
-
class
|
|
5713
|
+
class hC {
|
|
5688
5714
|
#A;
|
|
5689
5715
|
constructor(A, I, B) {
|
|
5690
5716
|
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));
|
|
@@ -5823,11 +5849,11 @@ class AI {
|
|
|
5823
5849
|
yield this.get(A);
|
|
5824
5850
|
}
|
|
5825
5851
|
}
|
|
5826
|
-
function
|
|
5852
|
+
function rE() {
|
|
5827
5853
|
if (typeof SharedArrayBuffer > "u")
|
|
5828
5854
|
throw new Error("SharedArrayBuffer is not available. In browsers, this requires Cross-Origin-Opener-Policy and Cross-Origin-Embedder-Policy headers to be set.");
|
|
5829
5855
|
}
|
|
5830
|
-
function
|
|
5856
|
+
function SE(g, A) {
|
|
5831
5857
|
return new SharedArrayBuffer(g);
|
|
5832
5858
|
}
|
|
5833
5859
|
function II(g) {
|
|
@@ -5867,7 +5893,7 @@ function mA(g) {
|
|
|
5867
5893
|
float16: globalThis.Float16Array,
|
|
5868
5894
|
float32: Float32Array,
|
|
5869
5895
|
float64: Float64Array,
|
|
5870
|
-
bool:
|
|
5896
|
+
bool: hC
|
|
5871
5897
|
}[g];
|
|
5872
5898
|
if (!I)
|
|
5873
5899
|
throw new X(`Unknown or unsupported dataType: ${g}`);
|
|
@@ -5881,7 +5907,7 @@ function SA(g, A) {
|
|
|
5881
5907
|
C[A[Q]] = B, B *= g[A[Q]];
|
|
5882
5908
|
return C;
|
|
5883
5909
|
}
|
|
5884
|
-
function
|
|
5910
|
+
function RE({ name: g, configuration: A }) {
|
|
5885
5911
|
if (g === "default") {
|
|
5886
5912
|
const I = A?.separator ?? "/";
|
|
5887
5913
|
return (B) => ["c", ...B].join(I);
|
|
@@ -5916,15 +5942,15 @@ function yB(g) {
|
|
|
5916
5942
|
throw new X(`Unsupported or unknown dtype: ${g}`);
|
|
5917
5943
|
return I === "|" ? { dataType: C } : { dataType: C, endian: I === "<" ? "little" : "big" };
|
|
5918
5944
|
}
|
|
5919
|
-
function
|
|
5945
|
+
function cE(g) {
|
|
5920
5946
|
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");
|
|
5921
5947
|
}
|
|
5922
|
-
function
|
|
5948
|
+
function NE(g, A = {}) {
|
|
5923
5949
|
let I = [], B = yB(g.dtype);
|
|
5924
5950
|
g.order === "F" && I.push({ name: "transpose", configuration: { order: "F" } });
|
|
5925
5951
|
for (let Q of g.filters ?? []) {
|
|
5926
5952
|
if (Q.id === "fixedscaleoffset" || Q.id === "numcodecs.fixedscaleoffset") {
|
|
5927
|
-
if (!
|
|
5953
|
+
if (!cE(Q))
|
|
5928
5954
|
throw new X(`Invalid fixedscaleoffset filter: ${JSON.stringify(Q)}`);
|
|
5929
5955
|
I.push({
|
|
5930
5956
|
name: "scale_offset",
|
|
@@ -5982,7 +6008,7 @@ function kE(g, A = {}) {
|
|
|
5982
6008
|
attributes: A
|
|
5983
6009
|
};
|
|
5984
6010
|
}
|
|
5985
|
-
function
|
|
6011
|
+
function UE(g, A = {}) {
|
|
5986
6012
|
return {
|
|
5987
6013
|
zarr_format: 3,
|
|
5988
6014
|
node_type: "group",
|
|
@@ -6004,10 +6030,10 @@ function Qg(g, A) {
|
|
|
6004
6030
|
let Q = g === "v2:object";
|
|
6005
6031
|
return A === "object" ? Q : !B && !C && !I && !Q;
|
|
6006
6032
|
}
|
|
6007
|
-
function
|
|
6033
|
+
function kE(g) {
|
|
6008
6034
|
return g?.name === "sharding_indexed";
|
|
6009
6035
|
}
|
|
6010
|
-
function
|
|
6036
|
+
function tC(g) {
|
|
6011
6037
|
if ((g.data_type === "uint64" || g.data_type === "int64") && g.fill_value != null)
|
|
6012
6038
|
return BigInt(g.fill_value);
|
|
6013
6039
|
let A = g.data_type === "float16" || g.data_type === "float32" || g.data_type === "float64";
|
|
@@ -6022,7 +6048,7 @@ function yC(g) {
|
|
|
6022
6048
|
}
|
|
6023
6049
|
return g.fill_value;
|
|
6024
6050
|
}
|
|
6025
|
-
function
|
|
6051
|
+
function yC(g, ...A) {
|
|
6026
6052
|
if (!A.some((I) => g instanceof I))
|
|
6027
6053
|
throw g;
|
|
6028
6054
|
}
|
|
@@ -6030,7 +6056,7 @@ function IA(g, A = "") {
|
|
|
6030
6056
|
if (!g)
|
|
6031
6057
|
throw new Error(A);
|
|
6032
6058
|
}
|
|
6033
|
-
async function
|
|
6059
|
+
async function eC(g, { format: A, signal: I }) {
|
|
6034
6060
|
let B;
|
|
6035
6061
|
if (g instanceof ArrayBuffer)
|
|
6036
6062
|
B = new Response(g);
|
|
@@ -6045,8 +6071,8 @@ async function nC(g, { format: A, signal: I }) {
|
|
|
6045
6071
|
throw I?.throwIfAborted(), new Error(`Failed to decode ${A}`);
|
|
6046
6072
|
}
|
|
6047
6073
|
}
|
|
6048
|
-
const eB =
|
|
6049
|
-
function
|
|
6074
|
+
const eB = LE();
|
|
6075
|
+
function LE() {
|
|
6050
6076
|
const g = new Uint32Array([305419896]);
|
|
6051
6077
|
return new Uint8Array(g.buffer, g.byteOffset, g.byteLength)[0] !== 18;
|
|
6052
6078
|
}
|
|
@@ -6087,18 +6113,18 @@ const GB = {
|
|
|
6087
6113
|
NaN: NaN,
|
|
6088
6114
|
Infinity: 1 / 0,
|
|
6089
6115
|
"-Infinity": -1 / 0
|
|
6090
|
-
},
|
|
6116
|
+
}, nC = {
|
|
6091
6117
|
float16: 2,
|
|
6092
6118
|
float32: 4,
|
|
6093
6119
|
float64: 8
|
|
6094
6120
|
};
|
|
6095
6121
|
function wI(g) {
|
|
6096
|
-
return g in
|
|
6122
|
+
return g in nC;
|
|
6097
6123
|
}
|
|
6098
6124
|
function Eg(g) {
|
|
6099
6125
|
return g === "int64" || g === "uint64";
|
|
6100
6126
|
}
|
|
6101
|
-
function
|
|
6127
|
+
function JE(g, A) {
|
|
6102
6128
|
const I = BigInt(g), B = new ArrayBuffer(A), C = new DataView(B);
|
|
6103
6129
|
if (A === 2) {
|
|
6104
6130
|
if (typeof C.getFloat16 != "function")
|
|
@@ -6120,7 +6146,7 @@ function FI(g, A) {
|
|
|
6120
6146
|
}
|
|
6121
6147
|
if (!wI(g))
|
|
6122
6148
|
throw new X(`String-encoded scalar "${A}" is not valid for non-float data type "${g}"`);
|
|
6123
|
-
return A in GB ? GB[A] :
|
|
6149
|
+
return A in GB ? GB[A] : JE(A, nC[g]);
|
|
6124
6150
|
}
|
|
6125
6151
|
const wB = /* @__PURE__ */ new Set([
|
|
6126
6152
|
"int8",
|
|
@@ -6151,7 +6177,7 @@ function FB(g, A, I) {
|
|
|
6151
6177
|
tgt: FI(I, C)
|
|
6152
6178
|
}));
|
|
6153
6179
|
}
|
|
6154
|
-
function
|
|
6180
|
+
function YE(g, A) {
|
|
6155
6181
|
for (const I of A)
|
|
6156
6182
|
if (typeof I.src == "number" && Number.isNaN(I.src)) {
|
|
6157
6183
|
if (typeof g == "number" && Number.isNaN(g))
|
|
@@ -6159,7 +6185,7 @@ function ME(g, A) {
|
|
|
6159
6185
|
} else if (g === I.src)
|
|
6160
6186
|
return I.tgt;
|
|
6161
6187
|
}
|
|
6162
|
-
function
|
|
6188
|
+
function dE(g) {
|
|
6163
6189
|
if (!Number.isFinite(g))
|
|
6164
6190
|
return g;
|
|
6165
6191
|
if (Math.abs(g - Math.trunc(g)) === 0.5) {
|
|
@@ -6168,13 +6194,13 @@ function KE(g) {
|
|
|
6168
6194
|
}
|
|
6169
6195
|
return Math.round(g);
|
|
6170
6196
|
}
|
|
6171
|
-
function
|
|
6197
|
+
function ME(g) {
|
|
6172
6198
|
return Math.sign(g) * Math.floor(Math.abs(g) + 0.5);
|
|
6173
6199
|
}
|
|
6174
6200
|
function rB(g) {
|
|
6175
6201
|
switch (g) {
|
|
6176
6202
|
case "nearest-even":
|
|
6177
|
-
return
|
|
6203
|
+
return dE;
|
|
6178
6204
|
case "towards-zero":
|
|
6179
6205
|
return Math.trunc;
|
|
6180
6206
|
case "towards-positive":
|
|
@@ -6182,7 +6208,7 @@ function rB(g) {
|
|
|
6182
6208
|
case "towards-negative":
|
|
6183
6209
|
return Math.floor;
|
|
6184
6210
|
case "nearest-away":
|
|
6185
|
-
return
|
|
6211
|
+
return ME;
|
|
6186
6212
|
}
|
|
6187
6213
|
}
|
|
6188
6214
|
function PI(g, A, I) {
|
|
@@ -6284,7 +6310,7 @@ function SB(g, A, I, B, C) {
|
|
|
6284
6310
|
else
|
|
6285
6311
|
throw new Error(`Unhandled type combination: ${g} -> ${A}`);
|
|
6286
6312
|
return C.length === 0 ? a : (D) => {
|
|
6287
|
-
const h =
|
|
6313
|
+
const h = YE(D, C);
|
|
6288
6314
|
return h !== void 0 ? h : a(D);
|
|
6289
6315
|
};
|
|
6290
6316
|
}
|
|
@@ -6301,7 +6327,7 @@ class qg {
|
|
|
6301
6327
|
return A + 4;
|
|
6302
6328
|
}
|
|
6303
6329
|
}
|
|
6304
|
-
const
|
|
6330
|
+
const KE = /* @__PURE__ */ new Set([
|
|
6305
6331
|
"int8",
|
|
6306
6332
|
"uint8",
|
|
6307
6333
|
"int16",
|
|
@@ -6334,7 +6360,7 @@ class lg {
|
|
|
6334
6360
|
this.#A = A;
|
|
6335
6361
|
}
|
|
6336
6362
|
static fromConfig(A, I) {
|
|
6337
|
-
if (!
|
|
6363
|
+
if (!KE.has(I.dataType))
|
|
6338
6364
|
throw new X(`Delta codec does not support data type: ${I.dataType}`);
|
|
6339
6365
|
return new lg(mA(I.dataType));
|
|
6340
6366
|
}
|
|
@@ -6362,14 +6388,14 @@ class fg {
|
|
|
6362
6388
|
}
|
|
6363
6389
|
encode = NA("gzip");
|
|
6364
6390
|
async decode(A) {
|
|
6365
|
-
const I = await
|
|
6391
|
+
const I = await eC(A, { format: "gzip" });
|
|
6366
6392
|
return new Uint8Array(I);
|
|
6367
6393
|
}
|
|
6368
6394
|
}
|
|
6369
|
-
function
|
|
6395
|
+
function HE(g, A) {
|
|
6370
6396
|
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;
|
|
6371
6397
|
}
|
|
6372
|
-
function
|
|
6398
|
+
function qE(g, A) {
|
|
6373
6399
|
return A instanceof Object && !Array.isArray(A) ? Object.keys(A).sort().reduce((I, B) => (I[B] = A[B], I), {}) : A;
|
|
6374
6400
|
}
|
|
6375
6401
|
class rI {
|
|
@@ -6399,7 +6425,7 @@ class rI {
|
|
|
6399
6425
|
const { indent: I, encoding: B, ensure_ascii: C, check_circular: Q, allow_nan: E, sort_keys: i } = this.#A;
|
|
6400
6426
|
IA(B === "utf-8", "JsonCodec does not yet support non-utf-8 encoding.");
|
|
6401
6427
|
const o = [];
|
|
6402
|
-
IA(Q, "JsonCodec does not yet support skipping the check for circular references during encoding."), E || o.push(
|
|
6428
|
+
IA(Q, "JsonCodec does not yet support skipping the check for circular references during encoding."), E || o.push(HE), i && o.push(qE);
|
|
6403
6429
|
const a = Array.from(A.data);
|
|
6404
6430
|
a.push("|O"), a.push(A.shape);
|
|
6405
6431
|
let s;
|
|
@@ -6424,7 +6450,7 @@ class rI {
|
|
|
6424
6450
|
return { data: B, shape: C, stride: Q };
|
|
6425
6451
|
}
|
|
6426
6452
|
}
|
|
6427
|
-
const
|
|
6453
|
+
const lE = /* @__PURE__ */ new Set([
|
|
6428
6454
|
"int8",
|
|
6429
6455
|
"uint8",
|
|
6430
6456
|
"int16",
|
|
@@ -6446,7 +6472,7 @@ class pg {
|
|
|
6446
6472
|
this.#I = A, this.#g = I, this.#A = B;
|
|
6447
6473
|
}
|
|
6448
6474
|
static fromConfig(A, I) {
|
|
6449
|
-
if (!
|
|
6475
|
+
if (!lE.has(I.dataType))
|
|
6450
6476
|
throw new X(`scale_offset codec does not support data type: ${I.dataType}`);
|
|
6451
6477
|
return new pg(FI(I.dataType, A.scale ?? 1), FI(I.dataType, A.offset ?? 0), mA(I.dataType));
|
|
6452
6478
|
}
|
|
@@ -6472,20 +6498,20 @@ class ug {
|
|
|
6472
6498
|
return new ug(A, I);
|
|
6473
6499
|
}
|
|
6474
6500
|
encode(A) {
|
|
6475
|
-
return
|
|
6501
|
+
return fE(A, this.#A);
|
|
6476
6502
|
}
|
|
6477
6503
|
decode(A) {
|
|
6478
|
-
return
|
|
6504
|
+
return pE(A, this.#A);
|
|
6479
6505
|
}
|
|
6480
6506
|
}
|
|
6481
|
-
function
|
|
6507
|
+
function fE(g, A) {
|
|
6482
6508
|
let I = g.length, B = Math.floor(I / A), C = new Uint8Array(I);
|
|
6483
6509
|
for (let Q = 0; Q < A; Q++)
|
|
6484
6510
|
for (let E = 0; E < B; E++)
|
|
6485
6511
|
C[Q * B + E] = g[E * A + Q];
|
|
6486
6512
|
return C;
|
|
6487
6513
|
}
|
|
6488
|
-
function
|
|
6514
|
+
function pE(g, A) {
|
|
6489
6515
|
let I = g.length, B = Math.floor(I / A), C = new Uint8Array(I);
|
|
6490
6516
|
for (let Q = 0; Q < A; Q++)
|
|
6491
6517
|
for (let E = 0; E < B; E++)
|
|
@@ -6493,7 +6519,7 @@ function mE(g, A) {
|
|
|
6493
6519
|
return C;
|
|
6494
6520
|
}
|
|
6495
6521
|
function cB(g) {
|
|
6496
|
-
return g instanceof
|
|
6522
|
+
return g instanceof hC || g instanceof Kg || g instanceof AI ? new Proxy(g, {
|
|
6497
6523
|
get(I, B) {
|
|
6498
6524
|
return I.get(Number(B));
|
|
6499
6525
|
},
|
|
@@ -6502,7 +6528,7 @@ function cB(g) {
|
|
|
6502
6528
|
}
|
|
6503
6529
|
}) : g;
|
|
6504
6530
|
}
|
|
6505
|
-
function
|
|
6531
|
+
function uE(g, A) {
|
|
6506
6532
|
let I;
|
|
6507
6533
|
return g.data instanceof Kg || g.data instanceof AI ? I = new g.constructor(
|
|
6508
6534
|
// @ts-expect-error
|
|
@@ -6514,8 +6540,8 @@ function TE(g, A) {
|
|
|
6514
6540
|
stride: SA(g.shape, A)
|
|
6515
6541
|
};
|
|
6516
6542
|
}
|
|
6517
|
-
function
|
|
6518
|
-
let I =
|
|
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);
|
|
6519
6545
|
for (let o = 0; o < C; o++) {
|
|
6520
6546
|
let a = 0;
|
|
6521
6547
|
for (let s = 0; s < B; s++)
|
|
@@ -6530,12 +6556,12 @@ function xE(g, A) {
|
|
|
6530
6556
|
}
|
|
6531
6557
|
return I;
|
|
6532
6558
|
}
|
|
6533
|
-
function
|
|
6559
|
+
function TE(g) {
|
|
6534
6560
|
let A = g.shape.length;
|
|
6535
6561
|
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);
|
|
6536
6562
|
}
|
|
6537
|
-
function
|
|
6538
|
-
let I =
|
|
6563
|
+
function xE(g, A) {
|
|
6564
|
+
let I = TE(g);
|
|
6539
6565
|
return IA(I.length === A.length, "Orders must match"), I.every((B, C) => B === A[C]);
|
|
6540
6566
|
}
|
|
6541
6567
|
class mg {
|
|
@@ -6560,7 +6586,7 @@ class mg {
|
|
|
6560
6586
|
return new mg(A, I);
|
|
6561
6587
|
}
|
|
6562
6588
|
encode(A) {
|
|
6563
|
-
return
|
|
6589
|
+
return xE(A, this.#I) ? A : mE(A, this.#I);
|
|
6564
6590
|
}
|
|
6565
6591
|
decode(A) {
|
|
6566
6592
|
return {
|
|
@@ -6597,25 +6623,25 @@ class Tg {
|
|
|
6597
6623
|
}
|
|
6598
6624
|
encode = NA("zlib");
|
|
6599
6625
|
async decode(A) {
|
|
6600
|
-
const I = await
|
|
6626
|
+
const I = await eC(A, { format: "deflate" });
|
|
6601
6627
|
return new Uint8Array(I);
|
|
6602
6628
|
}
|
|
6603
6629
|
}
|
|
6604
|
-
function
|
|
6630
|
+
function WE() {
|
|
6605
6631
|
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;
|
|
6606
6632
|
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);
|
|
6607
6633
|
}
|
|
6608
|
-
const
|
|
6634
|
+
const bE = WE();
|
|
6609
6635
|
function ig(g) {
|
|
6610
6636
|
let A;
|
|
6611
6637
|
function I() {
|
|
6612
|
-
return A || (A =
|
|
6638
|
+
return A || (A = ZE(g)), A;
|
|
6613
6639
|
}
|
|
6614
6640
|
async function B(C, Q, E) {
|
|
6615
6641
|
try {
|
|
6616
6642
|
return await E();
|
|
6617
6643
|
} catch (i) {
|
|
6618
|
-
throw new
|
|
6644
|
+
throw new FE({ direction: C, codec: Q, cause: i });
|
|
6619
6645
|
}
|
|
6620
6646
|
}
|
|
6621
6647
|
return {
|
|
@@ -6654,11 +6680,11 @@ function NB(g, A, I) {
|
|
|
6654
6680
|
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`);
|
|
6655
6681
|
return A.computeEncodedSize(I);
|
|
6656
6682
|
}
|
|
6657
|
-
async function
|
|
6683
|
+
async function ZE(g) {
|
|
6658
6684
|
let A = g.codecs.map(async (E) => {
|
|
6659
|
-
let i = await
|
|
6685
|
+
let i = await bE.get(E.name)?.();
|
|
6660
6686
|
if (!i)
|
|
6661
|
-
throw new
|
|
6687
|
+
throw new wE(E.name);
|
|
6662
6688
|
return { Codec: i, meta: E };
|
|
6663
6689
|
}), I = [], B, C = [], Q = { ...g };
|
|
6664
6690
|
for await (let { Codec: E, meta: i } of A) {
|
|
@@ -6684,7 +6710,7 @@ async function OE(g) {
|
|
|
6684
6710
|
}
|
|
6685
6711
|
}
|
|
6686
6712
|
if (!B) {
|
|
6687
|
-
if (!
|
|
6713
|
+
if (!PE(Q))
|
|
6688
6714
|
throw new X(`Cannot encode ${Q.dataType} to bytes without a codec`);
|
|
6689
6715
|
B = {
|
|
6690
6716
|
name: "bytes",
|
|
@@ -6697,11 +6723,11 @@ async function OE(g) {
|
|
|
6697
6723
|
bytesToBytes: C
|
|
6698
6724
|
};
|
|
6699
6725
|
}
|
|
6700
|
-
function
|
|
6726
|
+
function PE(g) {
|
|
6701
6727
|
return g.dataType !== "v2:object" && g.dataType !== "string";
|
|
6702
6728
|
}
|
|
6703
6729
|
const UB = 18446744073709551615n;
|
|
6704
|
-
function
|
|
6730
|
+
function OE(g, A, I, B) {
|
|
6705
6731
|
if (!g.store.getRange)
|
|
6706
6732
|
throw new dg("sharding requires a store with getRange");
|
|
6707
6733
|
let C = g.store.getRange.bind(g.store), Q = A.map((a, s) => a / B.chunk_shape[s]), E = ig({
|
|
@@ -6754,9 +6780,9 @@ function kB(g) {
|
|
|
6754
6780
|
return g.find((I) => I.name === "transpose")?.configuration?.order ?? "C";
|
|
6755
6781
|
}
|
|
6756
6782
|
const CI = Symbol("zarrita.context");
|
|
6757
|
-
function
|
|
6758
|
-
let { configuration: I } = A.codecs.find(
|
|
6759
|
-
encodeChunkKey:
|
|
6783
|
+
function VE(g, A) {
|
|
6784
|
+
let { configuration: I } = A.codecs.find(kE) ?? {}, B = {
|
|
6785
|
+
encodeChunkKey: RE(A.chunk_key_encoding),
|
|
6760
6786
|
TypedArray: mA(A.data_type),
|
|
6761
6787
|
fillValue: A.fill_value
|
|
6762
6788
|
};
|
|
@@ -6775,7 +6801,7 @@ function XE(g, A) {
|
|
|
6775
6801
|
getStrides(E) {
|
|
6776
6802
|
return SA(E, Q);
|
|
6777
6803
|
},
|
|
6778
|
-
getChunkBytes:
|
|
6804
|
+
getChunkBytes: OE(g, A.chunk_grid.configuration.chunk_shape, B.encodeChunkKey, I)
|
|
6779
6805
|
};
|
|
6780
6806
|
}
|
|
6781
6807
|
let C = kB(A.codecs);
|
|
@@ -6805,8 +6831,8 @@ let RI = class extends CA {
|
|
|
6805
6831
|
constructor(A, I, B) {
|
|
6806
6832
|
super(A, I), this.#A = {
|
|
6807
6833
|
...B,
|
|
6808
|
-
fill_value:
|
|
6809
|
-
}, this[CI] =
|
|
6834
|
+
fill_value: tC(B)
|
|
6835
|
+
}, this[CI] = VE(this, this.#A);
|
|
6810
6836
|
}
|
|
6811
6837
|
get attrs() {
|
|
6812
6838
|
return this.#A.attributes;
|
|
@@ -6827,7 +6853,7 @@ let RI = class extends CA {
|
|
|
6827
6853
|
return this.#A.data_type;
|
|
6828
6854
|
}
|
|
6829
6855
|
async getChunk(A, I, B) {
|
|
6830
|
-
B?.useSharedArrayBuffer &&
|
|
6856
|
+
B?.useSharedArrayBuffer && rE();
|
|
6831
6857
|
let C = this[CI], Q = await C.getChunkBytes(A, I);
|
|
6832
6858
|
if (!Q) {
|
|
6833
6859
|
let E = C.chunkShape.reduce((o, a) => o * a, 1), i;
|
|
@@ -6836,7 +6862,7 @@ let RI = class extends CA {
|
|
|
6836
6862
|
if (!("BYTES_PER_ELEMENT" in o))
|
|
6837
6863
|
console.warn("zarrita: useSharedArrayBuffer is not supported for non-buffer-backed data types."), i = new C.TypedArray(E);
|
|
6838
6864
|
else {
|
|
6839
|
-
let a =
|
|
6865
|
+
let a = SE(E * o.BYTES_PER_ELEMENT);
|
|
6840
6866
|
i = new C.TypedArray(a, 0, E);
|
|
6841
6867
|
}
|
|
6842
6868
|
} else
|
|
@@ -6870,21 +6896,21 @@ let RI = class extends CA {
|
|
|
6870
6896
|
return Qg(this.dtype, A);
|
|
6871
6897
|
}
|
|
6872
6898
|
};
|
|
6873
|
-
function
|
|
6899
|
+
function vE(g, A) {
|
|
6874
6900
|
let I = g;
|
|
6875
6901
|
for (let B of A)
|
|
6876
6902
|
I instanceof Promise ? I = I.then((C) => B(C)) : I = B(I);
|
|
6877
6903
|
return I;
|
|
6878
6904
|
}
|
|
6879
|
-
function
|
|
6880
|
-
return
|
|
6905
|
+
function XE(g, ...A) {
|
|
6906
|
+
return vE(g, A);
|
|
6881
6907
|
}
|
|
6882
|
-
async function
|
|
6908
|
+
async function GC(g) {
|
|
6883
6909
|
let A = g.store.arrayExtensions;
|
|
6884
|
-
return A?.length ? await
|
|
6910
|
+
return A?.length ? await XE(g, ...A) : g;
|
|
6885
6911
|
}
|
|
6886
|
-
let qI =
|
|
6887
|
-
function
|
|
6912
|
+
let qI = jE();
|
|
6913
|
+
function jE() {
|
|
6888
6914
|
let g = /* @__PURE__ */ new WeakMap();
|
|
6889
6915
|
function A(I) {
|
|
6890
6916
|
let B = g.get(I) ?? { v2: 0, v3: 0 };
|
|
@@ -6900,37 +6926,37 @@ function _E() {
|
|
|
6900
6926
|
}
|
|
6901
6927
|
};
|
|
6902
6928
|
}
|
|
6903
|
-
async function
|
|
6929
|
+
async function zE(g, A) {
|
|
6904
6930
|
let I = await g.store.get(g.resolve(".zattrs").path, {
|
|
6905
6931
|
signal: A
|
|
6906
6932
|
});
|
|
6907
6933
|
return I ? II(I) : {};
|
|
6908
6934
|
}
|
|
6909
|
-
async function
|
|
6935
|
+
async function _E(g, A = {}) {
|
|
6910
6936
|
let I = "store" in g ? g : new CA(g), { signal: B } = A, C = {};
|
|
6911
|
-
return (A.attrs ?? !0) && (C = await
|
|
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)));
|
|
6912
6938
|
}
|
|
6913
6939
|
async function LB(g, A, I) {
|
|
6914
6940
|
let { path: B } = g.resolve(".zarray"), C = await g.store.get(B, { signal: I });
|
|
6915
6941
|
if (!C)
|
|
6916
6942
|
throw new uA("v2 array", { path: B });
|
|
6917
|
-
return qI.increment(g.store, "v2"),
|
|
6943
|
+
return qI.increment(g.store, "v2"), GC(new RI(g.store, g.path, NE(II(C), A)));
|
|
6918
6944
|
}
|
|
6919
6945
|
async function JB(g, A, I) {
|
|
6920
6946
|
let { path: B } = g.resolve(".zgroup"), C = await g.store.get(B, { signal: I });
|
|
6921
6947
|
if (!C)
|
|
6922
6948
|
throw new uA("v2 group", { path: B });
|
|
6923
|
-
return qI.increment(g.store, "v2"), new xg(g.store, g.path,
|
|
6949
|
+
return qI.increment(g.store, "v2"), new xg(g.store, g.path, UE(II(C), A));
|
|
6924
6950
|
}
|
|
6925
|
-
async function
|
|
6951
|
+
async function $E(g, A) {
|
|
6926
6952
|
let { store: I, path: B } = g.resolve("zarr.json"), C = await g.store.get(B, { signal: A });
|
|
6927
6953
|
if (!C)
|
|
6928
6954
|
throw new uA("v3 array or group", { path: B });
|
|
6929
6955
|
let Q = II(C);
|
|
6930
|
-
return Q.node_type === "array" && (Q.fill_value =
|
|
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);
|
|
6931
6957
|
}
|
|
6932
|
-
async function
|
|
6933
|
-
let I = "store" in g ? g : new CA(g), B = await
|
|
6958
|
+
async function Ai(g, A = {}) {
|
|
6959
|
+
let I = "store" in g ? g : new CA(g), B = await $E(I, A.signal);
|
|
6934
6960
|
if (qI.increment(I.store, "v3"), A.kind === void 0 || A.kind === "array" && B instanceof RI || A.kind === "group" && B instanceof xg)
|
|
6935
6961
|
return B;
|
|
6936
6962
|
let C = B instanceof RI ? "array" : "group";
|
|
@@ -6941,11 +6967,11 @@ async function gi(g, A = {}) {
|
|
|
6941
6967
|
}
|
|
6942
6968
|
async function BA(g, A = {}) {
|
|
6943
6969
|
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;
|
|
6944
|
-
return C(g, A).catch((E) => (
|
|
6970
|
+
return C(g, A).catch((E) => (yC(E, uA, X), Q(g, A)));
|
|
6945
6971
|
}
|
|
6946
|
-
BA.v2 =
|
|
6947
|
-
BA.v3 =
|
|
6948
|
-
async function
|
|
6972
|
+
BA.v2 = _E;
|
|
6973
|
+
BA.v3 = Ai;
|
|
6974
|
+
async function Ii(g, A) {
|
|
6949
6975
|
const I = A.split("/"), B = I.pop();
|
|
6950
6976
|
if (!B)
|
|
6951
6977
|
throw new Error("Invalid path");
|
|
@@ -6962,7 +6988,7 @@ class Wg {
|
|
|
6962
6988
|
return this.#A;
|
|
6963
6989
|
}
|
|
6964
6990
|
async get(A) {
|
|
6965
|
-
const I = await
|
|
6991
|
+
const I = await Ii(this.#A, A.slice(1)).catch(
|
|
6966
6992
|
() => {
|
|
6967
6993
|
}
|
|
6968
6994
|
);
|
|
@@ -6991,7 +7017,7 @@ async function gI(g, A) {
|
|
|
6991
7017
|
throw new Error(`Failed to open Zarr group at ${g}`);
|
|
6992
7018
|
}
|
|
6993
7019
|
}
|
|
6994
|
-
async function
|
|
7020
|
+
async function gi(g, A) {
|
|
6995
7021
|
if (A === "v2")
|
|
6996
7022
|
try {
|
|
6997
7023
|
return BA.v2(g, { kind: "array", attrs: !1 });
|
|
@@ -7010,7 +7036,7 @@ async function Ci(g, A) {
|
|
|
7010
7036
|
throw new Error(`Failed to open Zarr array at ${g}`);
|
|
7011
7037
|
}
|
|
7012
7038
|
}
|
|
7013
|
-
async function
|
|
7039
|
+
async function Bi(g) {
|
|
7014
7040
|
let A;
|
|
7015
7041
|
switch (g.type) {
|
|
7016
7042
|
case "fetch": {
|
|
@@ -7031,9 +7057,9 @@ async function Qi(g) {
|
|
|
7031
7057
|
}
|
|
7032
7058
|
}
|
|
7033
7059
|
const I = g.arrayPath ? A.resolve(g.arrayPath) : A;
|
|
7034
|
-
return
|
|
7060
|
+
return gi(I, g.zarrVersion);
|
|
7035
7061
|
}
|
|
7036
|
-
function
|
|
7062
|
+
function Ci(g, A, I) {
|
|
7037
7063
|
if (g.store instanceof _A)
|
|
7038
7064
|
return {
|
|
7039
7065
|
type: "fetch",
|
|
@@ -7053,10 +7079,10 @@ function Ei(g, A, I) {
|
|
|
7053
7079
|
`Unsupported store type: ${g.store.constructor.name}`
|
|
7054
7080
|
);
|
|
7055
7081
|
}
|
|
7056
|
-
function
|
|
7057
|
-
return
|
|
7082
|
+
function Qi(g, A, I, B) {
|
|
7083
|
+
return Ei(g, A, I, B);
|
|
7058
7084
|
}
|
|
7059
|
-
function
|
|
7085
|
+
function Ei(g, A, I, B) {
|
|
7060
7086
|
const { targetShape: C, chunkIndex: Q, dimIndices: E } = B;
|
|
7061
7087
|
let i = 1;
|
|
7062
7088
|
for (let r = A.length - 1; r >= 0; r--) {
|
|
@@ -7091,7 +7117,7 @@ function oi(g, A, I, B) {
|
|
|
7091
7117
|
}
|
|
7092
7118
|
return G;
|
|
7093
7119
|
}
|
|
7094
|
-
const
|
|
7120
|
+
const wC = `function xg(B, A) {
|
|
7095
7121
|
return {
|
|
7096
7122
|
...B,
|
|
7097
7123
|
...A,
|
|
@@ -10745,8 +10771,8 @@ return ret;
|
|
|
10745
10771
|
default: IQ
|
|
10746
10772
|
});
|
|
10747
10773
|
//# sourceMappingURL=worker_kernel-CBlE4MBI.js.map
|
|
10748
|
-
`, YB = typeof self < "u" && self.Blob && new Blob(["URL.revokeObjectURL(import.meta.url);",
|
|
10749
|
-
function
|
|
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) {
|
|
10750
10776
|
let A;
|
|
10751
10777
|
try {
|
|
10752
10778
|
if (A = YB && (self.URL || self.webkitURL).createObjectURL(YB), !A) throw "";
|
|
@@ -10759,7 +10785,7 @@ function ai(g) {
|
|
|
10759
10785
|
}), I;
|
|
10760
10786
|
} catch {
|
|
10761
10787
|
return new Worker(
|
|
10762
|
-
"data:text/javascript;charset=utf-8," + encodeURIComponent(
|
|
10788
|
+
"data:text/javascript;charset=utf-8," + encodeURIComponent(wC),
|
|
10763
10789
|
{
|
|
10764
10790
|
type: "module",
|
|
10765
10791
|
name: g?.name
|
|
@@ -10767,17 +10793,17 @@ function ai(g) {
|
|
|
10767
10793
|
);
|
|
10768
10794
|
}
|
|
10769
10795
|
}
|
|
10770
|
-
const
|
|
10771
|
-
let iA = [],
|
|
10796
|
+
const oi = Math.max(1, navigator.hardwareConcurrency - 2);
|
|
10797
|
+
let iA = [], ai = 0, FC = 0;
|
|
10772
10798
|
const RA = /* @__PURE__ */ new Map(), cI = /* @__PURE__ */ new Set();
|
|
10773
|
-
function
|
|
10799
|
+
function rC(g) {
|
|
10774
10800
|
const A = iA.find((I) => I.worker === g);
|
|
10775
10801
|
return A || k.error(
|
|
10776
10802
|
"ZarrWorker",
|
|
10777
10803
|
"Worker not found in pool - this should not happen"
|
|
10778
10804
|
), A;
|
|
10779
10805
|
}
|
|
10780
|
-
function
|
|
10806
|
+
function si(g, A) {
|
|
10781
10807
|
const { id: I, success: B } = g.data, C = RA.get(I);
|
|
10782
10808
|
if (!C) {
|
|
10783
10809
|
cI.has(I) ? cI.delete(I) : k.warn(
|
|
@@ -10788,7 +10814,7 @@ function hi(g, A) {
|
|
|
10788
10814
|
return;
|
|
10789
10815
|
}
|
|
10790
10816
|
RA.delete(I), C.abortListener && C.abortSignal && C.abortSignal.removeEventListener("abort", C.abortListener);
|
|
10791
|
-
const Q =
|
|
10817
|
+
const Q = rC(A);
|
|
10792
10818
|
Q && Q.pendingCount > 0 ? Q.pendingCount-- : Q && k.error(
|
|
10793
10819
|
"ZarrWorker",
|
|
10794
10820
|
"Received message but no pending tasks - this should not happen"
|
|
@@ -10807,7 +10833,7 @@ function dB(g, A) {
|
|
|
10807
10833
|
"Worker failed - replacing worker and canceling its in-flight messages",
|
|
10808
10834
|
g.message
|
|
10809
10835
|
);
|
|
10810
|
-
const I =
|
|
10836
|
+
const I = rC(A);
|
|
10811
10837
|
if (I) {
|
|
10812
10838
|
const C = iA.indexOf(I);
|
|
10813
10839
|
iA.splice(C, 1);
|
|
@@ -10817,31 +10843,31 @@ function dB(g, A) {
|
|
|
10817
10843
|
for (const [C, Q] of RA.entries())
|
|
10818
10844
|
Q.workerId === B && (Q.reject(new Error(`Worker error: ${g.message}`)), RA.delete(C));
|
|
10819
10845
|
try {
|
|
10820
|
-
const C =
|
|
10846
|
+
const C = SC();
|
|
10821
10847
|
iA.push({
|
|
10822
10848
|
worker: C,
|
|
10823
10849
|
pendingCount: 0,
|
|
10824
|
-
workerId:
|
|
10850
|
+
workerId: FC++
|
|
10825
10851
|
}), k.debug("ZarrWorker", "Replacement worker created successfully");
|
|
10826
10852
|
} catch (C) {
|
|
10827
10853
|
k.error("ZarrWorker", "Failed to create replacement worker", C);
|
|
10828
10854
|
}
|
|
10829
10855
|
}
|
|
10830
|
-
function
|
|
10831
|
-
const g = new
|
|
10832
|
-
return g.addEventListener("message", (A) =>
|
|
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(
|
|
10833
10859
|
"messageerror",
|
|
10834
10860
|
(A) => dB(A, g)
|
|
10835
10861
|
), g;
|
|
10836
10862
|
}
|
|
10837
|
-
function
|
|
10863
|
+
function Di() {
|
|
10838
10864
|
if (iA.length === 0)
|
|
10839
10865
|
throw new Error("Worker pool is not initialized");
|
|
10840
10866
|
return iA.sort((g, A) => g.pendingCount - A.pendingCount)[0];
|
|
10841
10867
|
}
|
|
10842
|
-
async function
|
|
10868
|
+
async function hi(g, A, I, B) {
|
|
10843
10869
|
return new Promise((C, Q) => {
|
|
10844
|
-
const E =
|
|
10870
|
+
const E = Di(), i = ai++, o = {
|
|
10845
10871
|
resolve: C,
|
|
10846
10872
|
reject: Q,
|
|
10847
10873
|
workerId: E.workerId
|
|
@@ -10868,15 +10894,15 @@ async function yi(g, A, I, B) {
|
|
|
10868
10894
|
});
|
|
10869
10895
|
});
|
|
10870
10896
|
}
|
|
10871
|
-
function
|
|
10897
|
+
function ti() {
|
|
10872
10898
|
if (!(iA.length > 0))
|
|
10873
10899
|
try {
|
|
10874
|
-
for (let g = 0; g <
|
|
10875
|
-
const A =
|
|
10900
|
+
for (let g = 0; g < oi; g++) {
|
|
10901
|
+
const A = SC();
|
|
10876
10902
|
iA.push({
|
|
10877
10903
|
worker: A,
|
|
10878
10904
|
pendingCount: 0,
|
|
10879
|
-
workerId:
|
|
10905
|
+
workerId: FC++
|
|
10880
10906
|
});
|
|
10881
10907
|
}
|
|
10882
10908
|
k.debug(
|
|
@@ -10884,14 +10910,14 @@ function ei() {
|
|
|
10884
10910
|
`Initialized worker pool with ${iA.length} workers`
|
|
10885
10911
|
);
|
|
10886
10912
|
} catch {
|
|
10887
|
-
k.warn("ZarrWorker", "Failed to create workers - clearing pool"),
|
|
10913
|
+
k.warn("ZarrWorker", "Failed to create workers - clearing pool"), ei();
|
|
10888
10914
|
return;
|
|
10889
10915
|
}
|
|
10890
10916
|
}
|
|
10891
|
-
async function
|
|
10892
|
-
|
|
10917
|
+
async function yi(g, A, I, B, C) {
|
|
10918
|
+
ti();
|
|
10893
10919
|
try {
|
|
10894
|
-
return await
|
|
10920
|
+
return await hi(
|
|
10895
10921
|
A,
|
|
10896
10922
|
I,
|
|
10897
10923
|
B,
|
|
@@ -10902,11 +10928,11 @@ async function ni(g, A, I, B, C) {
|
|
|
10902
10928
|
throw Q;
|
|
10903
10929
|
k.warn("ZarrWorker", "Falling back to main thread", Q);
|
|
10904
10930
|
const E = await g.getChunk(I, C);
|
|
10905
|
-
if (!
|
|
10931
|
+
if (!dQ(E.data))
|
|
10906
10932
|
throw new Error(
|
|
10907
10933
|
`Unsupported chunk data type: ${E.data.constructor.name}`
|
|
10908
10934
|
);
|
|
10909
|
-
return
|
|
10935
|
+
return Qi(
|
|
10910
10936
|
E.data,
|
|
10911
10937
|
E.shape,
|
|
10912
10938
|
E.stride,
|
|
@@ -10914,19 +10940,19 @@ async function ni(g, A, I, B, C) {
|
|
|
10914
10940
|
);
|
|
10915
10941
|
}
|
|
10916
10942
|
}
|
|
10917
|
-
function
|
|
10943
|
+
function ei() {
|
|
10918
10944
|
for (const g of iA)
|
|
10919
10945
|
g.worker.terminate();
|
|
10920
10946
|
iA = [], RA.clear();
|
|
10921
10947
|
}
|
|
10922
|
-
class
|
|
10948
|
+
class ni {
|
|
10923
10949
|
metadata_;
|
|
10924
10950
|
arrays_;
|
|
10925
10951
|
arrayParams_;
|
|
10926
10952
|
dimensions_;
|
|
10927
10953
|
bytesPerElement_;
|
|
10928
10954
|
constructor(A) {
|
|
10929
|
-
this.metadata_ = A.metadata, this.arrays_ = A.arrays, this.arrayParams_ = A.arrayParams, this.dimensions_ =
|
|
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);
|
|
10930
10956
|
}
|
|
10931
10957
|
getSourceDimensionMap() {
|
|
10932
10958
|
return this.dimensions_;
|
|
@@ -10960,18 +10986,18 @@ class wi {
|
|
|
10960
10986
|
},
|
|
10961
10987
|
cChunkSize: E?.chunkSize,
|
|
10962
10988
|
tChunkSize: i?.chunkSize
|
|
10963
|
-
}, a = await
|
|
10989
|
+
}, a = await yi(
|
|
10964
10990
|
C,
|
|
10965
10991
|
Q,
|
|
10966
10992
|
B,
|
|
10967
10993
|
o,
|
|
10968
10994
|
{ signal: I }
|
|
10969
10995
|
), s = a.BYTES_PER_ELEMENT;
|
|
10970
|
-
if (!
|
|
10996
|
+
if (!wQ(s))
|
|
10971
10997
|
throw new Error(
|
|
10972
10998
|
"Invalid row alignment value. Possible values are 1, 2, 4, or 8"
|
|
10973
10999
|
);
|
|
10974
|
-
A.rowAlignmentBytes = s,
|
|
11000
|
+
A.rowAlignmentBytes = s, JQ(A, a);
|
|
10975
11001
|
}
|
|
10976
11002
|
}
|
|
10977
11003
|
const MB = {
|
|
@@ -10983,7 +11009,7 @@ const MB = {
|
|
|
10983
11009
|
uint32: 4,
|
|
10984
11010
|
float32: 4
|
|
10985
11011
|
};
|
|
10986
|
-
function
|
|
11012
|
+
function Gi(g) {
|
|
10987
11013
|
const A = MB[g];
|
|
10988
11014
|
if (A === void 0)
|
|
10989
11015
|
throw new Error(
|
|
@@ -10991,7 +11017,7 @@ function Fi(g) {
|
|
|
10991
11017
|
);
|
|
10992
11018
|
return A;
|
|
10993
11019
|
}
|
|
10994
|
-
function
|
|
11020
|
+
function wi(g, A) {
|
|
10995
11021
|
const I = g.axes.map((D) => D.name), B = g.axes.length, C = KB(I, "x"), Q = KB(I, "y"), E = (D, h) => {
|
|
10996
11022
|
const t = [];
|
|
10997
11023
|
for (let e = 0; e < g.datasets.length; e++) {
|
|
@@ -11003,7 +11029,7 @@ function ri(g, A) {
|
|
|
11003
11029
|
translation: L[h]
|
|
11004
11030
|
});
|
|
11005
11031
|
}
|
|
11006
|
-
if (g.axes[h].type === "space" &&
|
|
11032
|
+
if (g.axes[h].type === "space" && ri(t))
|
|
11007
11033
|
for (const e of t) e.translation -= 0.5 * e.scale;
|
|
11008
11034
|
return {
|
|
11009
11035
|
name: D,
|
|
@@ -11022,7 +11048,7 @@ function ri(g, A) {
|
|
|
11022
11048
|
const s = iI(I, "t");
|
|
11023
11049
|
return s !== -1 && (i.t = E(I[s], s)), i;
|
|
11024
11050
|
}
|
|
11025
|
-
function
|
|
11051
|
+
function Fi(g, A) {
|
|
11026
11052
|
return g.toLowerCase() === A.toLowerCase();
|
|
11027
11053
|
}
|
|
11028
11054
|
function KB(g, A) {
|
|
@@ -11034,9 +11060,9 @@ function KB(g, A) {
|
|
|
11034
11060
|
return I;
|
|
11035
11061
|
}
|
|
11036
11062
|
function iI(g, A) {
|
|
11037
|
-
return g.findIndex((I) =>
|
|
11063
|
+
return g.findIndex((I) => Fi(I, A));
|
|
11038
11064
|
}
|
|
11039
|
-
function
|
|
11065
|
+
function ri(g) {
|
|
11040
11066
|
if (g.length <= 1) return !1;
|
|
11041
11067
|
for (let A = 1; A < g.length; A++) {
|
|
11042
11068
|
const I = 0.5 * (g[A].scale - g[A - 1].scale), B = g[A].translation - g[A - 1].translation;
|
|
@@ -11269,11 +11295,11 @@ const og = (g, A) => {
|
|
|
11269
11295
|
}
|
|
11270
11296
|
return { message: I };
|
|
11271
11297
|
};
|
|
11272
|
-
let
|
|
11273
|
-
function
|
|
11274
|
-
return
|
|
11298
|
+
let Si = og;
|
|
11299
|
+
function Ri() {
|
|
11300
|
+
return Si;
|
|
11275
11301
|
}
|
|
11276
|
-
const
|
|
11302
|
+
const ci = (g) => {
|
|
11277
11303
|
const { data: A, path: I, errorMaps: B, issueData: C } = g, Q = [...I, ...C.path || []], E = {
|
|
11278
11304
|
...C,
|
|
11279
11305
|
path: Q
|
|
@@ -11295,7 +11321,7 @@ const Ui = (g) => {
|
|
|
11295
11321
|
};
|
|
11296
11322
|
};
|
|
11297
11323
|
function w(g, A) {
|
|
11298
|
-
const I =
|
|
11324
|
+
const I = Ri(), B = ci({
|
|
11299
11325
|
issueData: A,
|
|
11300
11326
|
data: g.data,
|
|
11301
11327
|
path: g.path,
|
|
@@ -11577,7 +11603,7 @@ class q {
|
|
|
11577
11603
|
});
|
|
11578
11604
|
}
|
|
11579
11605
|
brand() {
|
|
11580
|
-
return new
|
|
11606
|
+
return new Oi({
|
|
11581
11607
|
typeName: d.ZodBranded,
|
|
11582
11608
|
type: this,
|
|
11583
11609
|
...K(this._def)
|
|
@@ -11612,28 +11638,28 @@ class q {
|
|
|
11612
11638
|
return this.safeParse(null).success;
|
|
11613
11639
|
}
|
|
11614
11640
|
}
|
|
11615
|
-
const
|
|
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})+$";
|
|
11616
11642
|
let VI;
|
|
11617
|
-
const
|
|
11618
|
-
function
|
|
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) {
|
|
11619
11645
|
let A = "[0-5]\\d";
|
|
11620
11646
|
g.precision ? A = `${A}\\.\\d{${g.precision}}` : g.precision == null && (A = `${A}(\\.\\d+)?`);
|
|
11621
11647
|
const I = g.precision ? "+" : "?";
|
|
11622
11648
|
return `([01]\\d|2[0-3]):[0-5]\\d(:${A})${I}`;
|
|
11623
11649
|
}
|
|
11624
|
-
function
|
|
11625
|
-
return new RegExp(`^${
|
|
11650
|
+
function Ti(g) {
|
|
11651
|
+
return new RegExp(`^${cC(g)}$`);
|
|
11626
11652
|
}
|
|
11627
|
-
function
|
|
11628
|
-
let A = `${
|
|
11653
|
+
function xi(g) {
|
|
11654
|
+
let A = `${RC}T${cC(g)}`;
|
|
11629
11655
|
const I = [];
|
|
11630
11656
|
return I.push(g.local ? "Z?" : "Z"), g.offset && I.push("([+-]\\d{2}:?\\d{2})"), A = `${A}(${I.join("|")})`, new RegExp(`^${A}$`);
|
|
11631
11657
|
}
|
|
11632
|
-
function
|
|
11633
|
-
return !!((A === "v4" || !A) &&
|
|
11658
|
+
function Wi(g, A) {
|
|
11659
|
+
return !!((A === "v4" || !A) && Hi.test(g) || (A === "v6" || !A) && li.test(g));
|
|
11634
11660
|
}
|
|
11635
|
-
function
|
|
11636
|
-
if (!
|
|
11661
|
+
function bi(g, A) {
|
|
11662
|
+
if (!Yi.test(g))
|
|
11637
11663
|
return !1;
|
|
11638
11664
|
try {
|
|
11639
11665
|
const [I] = g.split(".");
|
|
@@ -11645,8 +11671,8 @@ function Pi(g, A) {
|
|
|
11645
11671
|
return !1;
|
|
11646
11672
|
}
|
|
11647
11673
|
}
|
|
11648
|
-
function
|
|
11649
|
-
return !!((A === "v4" || !A) &&
|
|
11674
|
+
function Zi(g, A) {
|
|
11675
|
+
return !!((A === "v4" || !A) && qi.test(g) || (A === "v6" || !A) && fi.test(g));
|
|
11650
11676
|
}
|
|
11651
11677
|
class eA extends q {
|
|
11652
11678
|
_parse(A) {
|
|
@@ -11697,43 +11723,43 @@ class eA extends q {
|
|
|
11697
11723
|
message: Q.message
|
|
11698
11724
|
}), B.dirty());
|
|
11699
11725
|
} else if (Q.kind === "email")
|
|
11700
|
-
|
|
11726
|
+
Mi.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
11701
11727
|
validation: "email",
|
|
11702
11728
|
code: y.invalid_string,
|
|
11703
11729
|
message: Q.message
|
|
11704
11730
|
}), B.dirty());
|
|
11705
11731
|
else if (Q.kind === "emoji")
|
|
11706
|
-
VI || (VI = new RegExp(
|
|
11732
|
+
VI || (VI = new RegExp(Ki, "u")), VI.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
11707
11733
|
validation: "emoji",
|
|
11708
11734
|
code: y.invalid_string,
|
|
11709
11735
|
message: Q.message
|
|
11710
11736
|
}), B.dirty());
|
|
11711
11737
|
else if (Q.kind === "uuid")
|
|
11712
|
-
|
|
11738
|
+
Li.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
11713
11739
|
validation: "uuid",
|
|
11714
11740
|
code: y.invalid_string,
|
|
11715
11741
|
message: Q.message
|
|
11716
11742
|
}), B.dirty());
|
|
11717
11743
|
else if (Q.kind === "nanoid")
|
|
11718
|
-
|
|
11744
|
+
Ji.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
11719
11745
|
validation: "nanoid",
|
|
11720
11746
|
code: y.invalid_string,
|
|
11721
11747
|
message: Q.message
|
|
11722
11748
|
}), B.dirty());
|
|
11723
11749
|
else if (Q.kind === "cuid")
|
|
11724
|
-
|
|
11750
|
+
Ni.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
11725
11751
|
validation: "cuid",
|
|
11726
11752
|
code: y.invalid_string,
|
|
11727
11753
|
message: Q.message
|
|
11728
11754
|
}), B.dirty());
|
|
11729
11755
|
else if (Q.kind === "cuid2")
|
|
11730
|
-
|
|
11756
|
+
Ui.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
11731
11757
|
validation: "cuid2",
|
|
11732
11758
|
code: y.invalid_string,
|
|
11733
11759
|
message: Q.message
|
|
11734
11760
|
}), B.dirty());
|
|
11735
11761
|
else if (Q.kind === "ulid")
|
|
11736
|
-
|
|
11762
|
+
ki.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
11737
11763
|
validation: "ulid",
|
|
11738
11764
|
code: y.invalid_string,
|
|
11739
11765
|
message: Q.message
|
|
@@ -11764,39 +11790,39 @@ class eA extends q {
|
|
|
11764
11790
|
code: y.invalid_string,
|
|
11765
11791
|
validation: { endsWith: Q.value },
|
|
11766
11792
|
message: Q.message
|
|
11767
|
-
}), B.dirty()) : Q.kind === "datetime" ?
|
|
11793
|
+
}), B.dirty()) : Q.kind === "datetime" ? xi(Q).test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
11768
11794
|
code: y.invalid_string,
|
|
11769
11795
|
validation: "datetime",
|
|
11770
11796
|
message: Q.message
|
|
11771
|
-
}), B.dirty()) : Q.kind === "date" ?
|
|
11797
|
+
}), B.dirty()) : Q.kind === "date" ? mi.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
11772
11798
|
code: y.invalid_string,
|
|
11773
11799
|
validation: "date",
|
|
11774
11800
|
message: Q.message
|
|
11775
|
-
}), B.dirty()) : Q.kind === "time" ?
|
|
11801
|
+
}), B.dirty()) : Q.kind === "time" ? Ti(Q).test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
11776
11802
|
code: y.invalid_string,
|
|
11777
11803
|
validation: "time",
|
|
11778
11804
|
message: Q.message
|
|
11779
|
-
}), B.dirty()) : Q.kind === "duration" ?
|
|
11805
|
+
}), B.dirty()) : Q.kind === "duration" ? di.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
11780
11806
|
validation: "duration",
|
|
11781
11807
|
code: y.invalid_string,
|
|
11782
11808
|
message: Q.message
|
|
11783
|
-
}), B.dirty()) : Q.kind === "ip" ?
|
|
11809
|
+
}), B.dirty()) : Q.kind === "ip" ? Wi(A.data, Q.version) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
11784
11810
|
validation: "ip",
|
|
11785
11811
|
code: y.invalid_string,
|
|
11786
11812
|
message: Q.message
|
|
11787
|
-
}), B.dirty()) : Q.kind === "jwt" ?
|
|
11813
|
+
}), B.dirty()) : Q.kind === "jwt" ? bi(A.data, Q.alg) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
11788
11814
|
validation: "jwt",
|
|
11789
11815
|
code: y.invalid_string,
|
|
11790
11816
|
message: Q.message
|
|
11791
|
-
}), B.dirty()) : Q.kind === "cidr" ?
|
|
11817
|
+
}), B.dirty()) : Q.kind === "cidr" ? Zi(A.data, Q.version) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
11792
11818
|
validation: "cidr",
|
|
11793
11819
|
code: y.invalid_string,
|
|
11794
11820
|
message: Q.message
|
|
11795
|
-
}), B.dirty()) : Q.kind === "base64" ?
|
|
11821
|
+
}), B.dirty()) : Q.kind === "base64" ? pi.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
11796
11822
|
validation: "base64",
|
|
11797
11823
|
code: y.invalid_string,
|
|
11798
11824
|
message: Q.message
|
|
11799
|
-
}), B.dirty()) : Q.kind === "base64url" ?
|
|
11825
|
+
}), B.dirty()) : Q.kind === "base64url" ? ui.test(A.data) || (C = this._getOrReturnCtx(A, C), w(C, {
|
|
11800
11826
|
validation: "base64url",
|
|
11801
11827
|
code: y.invalid_string,
|
|
11802
11828
|
message: Q.message
|
|
@@ -12031,7 +12057,7 @@ eA.create = (g) => new eA({
|
|
|
12031
12057
|
coerce: g?.coerce ?? !1,
|
|
12032
12058
|
...K(g)
|
|
12033
12059
|
});
|
|
12034
|
-
function
|
|
12060
|
+
function Pi(g, A) {
|
|
12035
12061
|
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(".", ""));
|
|
12036
12062
|
return Q % E / 10 ** C;
|
|
12037
12063
|
}
|
|
@@ -12070,7 +12096,7 @@ class KA extends q {
|
|
|
12070
12096
|
inclusive: Q.inclusive,
|
|
12071
12097
|
exact: !1,
|
|
12072
12098
|
message: Q.message
|
|
12073
|
-
}), C.dirty()) : Q.kind === "multipleOf" ?
|
|
12099
|
+
}), C.dirty()) : Q.kind === "multipleOf" ? Pi(A.data, Q.value) !== 0 && (B = this._getOrReturnCtx(A, B), w(B, {
|
|
12074
12100
|
code: y.not_multiple_of,
|
|
12075
12101
|
multipleOf: Q.value,
|
|
12076
12102
|
message: Q.message
|
|
@@ -12894,7 +12920,7 @@ class V extends q {
|
|
|
12894
12920
|
});
|
|
12895
12921
|
}
|
|
12896
12922
|
keyof() {
|
|
12897
|
-
return
|
|
12923
|
+
return NC(f.objectKeys(this.shape));
|
|
12898
12924
|
}
|
|
12899
12925
|
}
|
|
12900
12926
|
V.create = (g, A) => new V({
|
|
@@ -13252,7 +13278,7 @@ hg.create = (g, A) => new hg({
|
|
|
13252
13278
|
typeName: d.ZodLiteral,
|
|
13253
13279
|
...K(A)
|
|
13254
13280
|
});
|
|
13255
|
-
function
|
|
13281
|
+
function NC(g, A) {
|
|
13256
13282
|
return new HA({
|
|
13257
13283
|
values: g,
|
|
13258
13284
|
typeName: d.ZodEnum,
|
|
@@ -13313,7 +13339,7 @@ class HA extends q {
|
|
|
13313
13339
|
});
|
|
13314
13340
|
}
|
|
13315
13341
|
}
|
|
13316
|
-
HA.create =
|
|
13342
|
+
HA.create = NC;
|
|
13317
13343
|
class ZB extends q {
|
|
13318
13344
|
_parse(A) {
|
|
13319
13345
|
const I = f.getValidEnumValues(this._def.values), B = this._getOrReturnCtx(A);
|
|
@@ -13566,7 +13592,7 @@ PB.create = (g) => new PB({
|
|
|
13566
13592
|
typeName: d.ZodNaN,
|
|
13567
13593
|
...K(g)
|
|
13568
13594
|
});
|
|
13569
|
-
class
|
|
13595
|
+
class Oi extends q {
|
|
13570
13596
|
_parse(A) {
|
|
13571
13597
|
const { ctx: I } = this._processInputParams(A), B = I.data;
|
|
13572
13598
|
return this._def.type._parse({
|
|
@@ -13637,7 +13663,7 @@ var d;
|
|
|
13637
13663
|
(function(g) {
|
|
13638
13664
|
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";
|
|
13639
13665
|
})(d || (d = {}));
|
|
13640
|
-
const u = eA.create, H = KA.create,
|
|
13666
|
+
const u = eA.create, H = KA.create, UC = ag.create, nA = sg.create;
|
|
13641
13667
|
FA.create;
|
|
13642
13668
|
const p = DA.create, J = V.create;
|
|
13643
13669
|
kI.create;
|
|
@@ -13647,7 +13673,7 @@ const _ = hg.create, LA = HA.create;
|
|
|
13647
13673
|
JI.create;
|
|
13648
13674
|
GA.create;
|
|
13649
13675
|
lA.create;
|
|
13650
|
-
const
|
|
13676
|
+
const Vi = J({
|
|
13651
13677
|
/**The multiscale datasets for this image*/
|
|
13652
13678
|
multiscales: p(
|
|
13653
13679
|
J({
|
|
@@ -13760,7 +13786,7 @@ const Xi = J({
|
|
|
13760
13786
|
label: u().optional(),
|
|
13761
13787
|
family: u().optional(),
|
|
13762
13788
|
color: u(),
|
|
13763
|
-
active:
|
|
13789
|
+
active: UC().optional()
|
|
13764
13790
|
})
|
|
13765
13791
|
),
|
|
13766
13792
|
// The rdefs are not in the JSON schema and are not particularly well
|
|
@@ -13775,7 +13801,7 @@ const Xi = J({
|
|
|
13775
13801
|
projection: u().optional()
|
|
13776
13802
|
}).optional()
|
|
13777
13803
|
}).optional()
|
|
13778
|
-
}).describe("JSON from OME-NGFF .zattrs"),
|
|
13804
|
+
}).describe("JSON from OME-NGFF .zattrs"), vi = J({
|
|
13779
13805
|
plate: J({
|
|
13780
13806
|
/**The acquisitions for this plate*/
|
|
13781
13807
|
acquisitions: p(
|
|
@@ -13834,7 +13860,7 @@ const Xi = J({
|
|
|
13834
13860
|
})
|
|
13835
13861
|
).min(1).describe("The wells of the plate")
|
|
13836
13862
|
}).optional()
|
|
13837
|
-
}).describe("JSON from OME-NGFF .zattrs"),
|
|
13863
|
+
}).describe("JSON from OME-NGFF .zattrs"), Xi = J({
|
|
13838
13864
|
well: J({
|
|
13839
13865
|
/**The fields of view for this well*/
|
|
13840
13866
|
images: p(
|
|
@@ -13848,7 +13874,7 @@ const Xi = J({
|
|
|
13848
13874
|
/**The version of the specification*/
|
|
13849
13875
|
version: _("0.4").describe("The version of the specification").optional()
|
|
13850
13876
|
}).optional()
|
|
13851
|
-
}).describe("JSON from OME-NGFF .zattrs"),
|
|
13877
|
+
}).describe("JSON from OME-NGFF .zattrs"), ji = J({
|
|
13852
13878
|
/**The versioned OME-Zarr Metadata namespace*/
|
|
13853
13879
|
ome: J({
|
|
13854
13880
|
/**The multiscale datasets for this image*/
|
|
@@ -13960,7 +13986,7 @@ const Xi = J({
|
|
|
13960
13986
|
label: u().optional(),
|
|
13961
13987
|
family: u().optional(),
|
|
13962
13988
|
color: u().optional(),
|
|
13963
|
-
active:
|
|
13989
|
+
active: UC().optional()
|
|
13964
13990
|
})
|
|
13965
13991
|
),
|
|
13966
13992
|
// The rdefs are not in the JSON schema and are not particularly well
|
|
@@ -13978,7 +14004,7 @@ const Xi = J({
|
|
|
13978
14004
|
/**The version of the OME-Zarr Metadata*/
|
|
13979
14005
|
version: _("0.5").describe("The version of the OME-Zarr Metadata")
|
|
13980
14006
|
}).describe("The versioned OME-Zarr Metadata namespace")
|
|
13981
|
-
}).describe("The zarr.json attributes key"),
|
|
14007
|
+
}).describe("The zarr.json attributes key"), zi = J({
|
|
13982
14008
|
/**The versioned OME-Zarr Metadata namespace*/
|
|
13983
14009
|
ome: J({
|
|
13984
14010
|
plate: J({
|
|
@@ -14040,7 +14066,7 @@ const Xi = J({
|
|
|
14040
14066
|
/**The version of the OME-Zarr Metadata*/
|
|
14041
14067
|
version: _("0.5").describe("The version of the OME-Zarr Metadata")
|
|
14042
14068
|
}).describe("The versioned OME-Zarr Metadata namespace")
|
|
14043
|
-
}).describe("The zarr.json attributes key"),
|
|
14069
|
+
}).describe("The zarr.json attributes key"), _i = J({
|
|
14044
14070
|
/**The versioned OME-Zarr Metadata namespace*/
|
|
14045
14071
|
ome: J({
|
|
14046
14072
|
well: J({
|
|
@@ -14059,15 +14085,15 @@ const Xi = J({
|
|
|
14059
14085
|
/**The version of the OME-Zarr Metadata*/
|
|
14060
14086
|
version: _("0.5").describe("The version of the OME-Zarr Metadata")
|
|
14061
14087
|
}).describe("The versioned OME-Zarr Metadata namespace")
|
|
14062
|
-
}).describe("JSON from OME-Zarr zarr.json"),
|
|
14063
|
-
function
|
|
14088
|
+
}).describe("JSON from OME-Zarr zarr.json"), $i = ["0.4", "0.5"], Ao = new Set($i);
|
|
14089
|
+
function Io(g) {
|
|
14064
14090
|
if (!("ome" in g) || !(g.ome instanceof Object)) return;
|
|
14065
14091
|
const A = g.ome;
|
|
14066
|
-
if ("version" in A && typeof A.version == "string" &&
|
|
14092
|
+
if ("version" in A && typeof A.version == "string" && Ao.has(A.version))
|
|
14067
14093
|
return A.version;
|
|
14068
14094
|
}
|
|
14069
14095
|
function Zg(g) {
|
|
14070
|
-
const A =
|
|
14096
|
+
const A = Io(g);
|
|
14071
14097
|
return A === void 0 ? "0.4" : A;
|
|
14072
14098
|
}
|
|
14073
14099
|
function fA(g) {
|
|
@@ -14079,14 +14105,14 @@ function fA(g) {
|
|
|
14079
14105
|
return "v3";
|
|
14080
14106
|
}
|
|
14081
14107
|
}
|
|
14082
|
-
function
|
|
14108
|
+
function kC(g, A) {
|
|
14083
14109
|
const I = { ...g };
|
|
14084
14110
|
return delete I[A], I;
|
|
14085
14111
|
}
|
|
14086
14112
|
async function Yo(g, A) {
|
|
14087
14113
|
const I = new _A(g), B = new CA(I), C = fA(A), Q = await gI(B, C);
|
|
14088
14114
|
try {
|
|
14089
|
-
return
|
|
14115
|
+
return go(Q.attrs);
|
|
14090
14116
|
} catch {
|
|
14091
14117
|
throw Error(
|
|
14092
14118
|
`Failed to parse OME-Zarr plate:
|
|
@@ -14094,50 +14120,50 @@ ${JSON.stringify(Q.attrs)}`
|
|
|
14094
14120
|
);
|
|
14095
14121
|
}
|
|
14096
14122
|
}
|
|
14097
|
-
function
|
|
14123
|
+
function go(g) {
|
|
14098
14124
|
switch (Zg(g)) {
|
|
14099
14125
|
case "0.5":
|
|
14100
14126
|
return {
|
|
14101
|
-
|
|
14127
|
+
...zi.parse(g).ome,
|
|
14102
14128
|
originalVersion: "0.5"
|
|
14103
14129
|
};
|
|
14104
14130
|
case "0.4":
|
|
14105
14131
|
return {
|
|
14106
|
-
...
|
|
14132
|
+
...Bo(vi.parse(g)).ome,
|
|
14107
14133
|
originalVersion: "0.4"
|
|
14108
14134
|
};
|
|
14109
14135
|
}
|
|
14110
14136
|
}
|
|
14111
|
-
function
|
|
14137
|
+
function Bo(g) {
|
|
14112
14138
|
if (g.plate === void 0)
|
|
14113
14139
|
throw new Error("Plate metadata is missing in OME-Zarr v0.4 plate");
|
|
14114
14140
|
return {
|
|
14115
14141
|
ome: {
|
|
14116
|
-
plate:
|
|
14142
|
+
plate: kC(g.plate, "version"),
|
|
14117
14143
|
version: "0.5"
|
|
14118
14144
|
}
|
|
14119
14145
|
};
|
|
14120
14146
|
}
|
|
14121
|
-
function
|
|
14147
|
+
function Co(g) {
|
|
14122
14148
|
if (g.well === void 0)
|
|
14123
14149
|
throw new Error("Well metadata is missing in OME-Zarr v0.4 well");
|
|
14124
14150
|
return {
|
|
14125
14151
|
ome: {
|
|
14126
|
-
well:
|
|
14152
|
+
well: kC(g.well, "version"),
|
|
14127
14153
|
version: "0.5"
|
|
14128
14154
|
}
|
|
14129
14155
|
};
|
|
14130
14156
|
}
|
|
14131
|
-
function
|
|
14157
|
+
function Qo(g) {
|
|
14132
14158
|
switch (Zg(g)) {
|
|
14133
14159
|
case "0.5":
|
|
14134
14160
|
return {
|
|
14135
|
-
...
|
|
14161
|
+
..._i.parse(g).ome,
|
|
14136
14162
|
originalVersion: "0.5"
|
|
14137
14163
|
};
|
|
14138
14164
|
case "0.4":
|
|
14139
14165
|
return {
|
|
14140
|
-
...
|
|
14166
|
+
...Co(Xi.parse(g)).ome,
|
|
14141
14167
|
originalVersion: "0.4"
|
|
14142
14168
|
};
|
|
14143
14169
|
}
|
|
@@ -14145,7 +14171,7 @@ function io(g) {
|
|
|
14145
14171
|
async function Mo(g, A, I) {
|
|
14146
14172
|
const B = g + "/" + A, C = new _A(B), Q = new CA(C), E = fA(I), i = await gI(Q, E);
|
|
14147
14173
|
try {
|
|
14148
|
-
return
|
|
14174
|
+
return Qo(i.attrs);
|
|
14149
14175
|
} catch {
|
|
14150
14176
|
throw Error(
|
|
14151
14177
|
`Failed to parse OME-Zarr well:
|
|
@@ -14161,7 +14187,7 @@ async function Ho(g) {
|
|
|
14161
14187
|
const A = fA(g.version), I = await gI(g.location, A);
|
|
14162
14188
|
return Pg(I.attrs).omero?.rdefs;
|
|
14163
14189
|
}
|
|
14164
|
-
function
|
|
14190
|
+
function Eo(g) {
|
|
14165
14191
|
return {
|
|
14166
14192
|
ome: {
|
|
14167
14193
|
multiscales: g.multiscales,
|
|
@@ -14170,23 +14196,23 @@ function oo(g) {
|
|
|
14170
14196
|
}
|
|
14171
14197
|
};
|
|
14172
14198
|
}
|
|
14173
|
-
function
|
|
14199
|
+
function io(g) {
|
|
14174
14200
|
switch (Zg(g)) {
|
|
14175
14201
|
case "0.5":
|
|
14176
14202
|
return {
|
|
14177
|
-
...
|
|
14203
|
+
...ji.parse(g).ome,
|
|
14178
14204
|
originalVersion: "0.5"
|
|
14179
14205
|
};
|
|
14180
14206
|
case "0.4":
|
|
14181
14207
|
return {
|
|
14182
|
-
...
|
|
14208
|
+
...Eo(Vi.parse(g)).ome,
|
|
14183
14209
|
originalVersion: "0.4"
|
|
14184
14210
|
};
|
|
14185
14211
|
}
|
|
14186
14212
|
}
|
|
14187
14213
|
function Pg(g) {
|
|
14188
14214
|
try {
|
|
14189
|
-
return
|
|
14215
|
+
return io(g);
|
|
14190
14216
|
} catch {
|
|
14191
14217
|
throw Error(`Failed to parse OME-Zarr image:
|
|
14192
14218
|
${JSON.stringify(g)}`);
|
|
@@ -14213,15 +14239,15 @@ class bA {
|
|
|
14213
14239
|
throw new Error("No datasets found in the multiscale image.");
|
|
14214
14240
|
B || (B = fA(Q.originalVersion));
|
|
14215
14241
|
const o = i.datasets.map(
|
|
14216
|
-
(h) =>
|
|
14242
|
+
(h) => Ci(A, h.path, B)
|
|
14217
14243
|
), a = await Promise.all(
|
|
14218
|
-
o.map((h) =>
|
|
14244
|
+
o.map((h) => Bi(h))
|
|
14219
14245
|
), s = a[0].shape, D = i.axes;
|
|
14220
14246
|
if (D.length !== s.length)
|
|
14221
14247
|
throw new Error(
|
|
14222
14248
|
`Mismatch between number of axes (${D.length}) and array shape (${s.length})`
|
|
14223
14249
|
);
|
|
14224
|
-
return new
|
|
14250
|
+
return new ni({ metadata: i, arrays: a, arrayParams: o });
|
|
14225
14251
|
}
|
|
14226
14252
|
/**
|
|
14227
14253
|
* Returns per-axis dimension metadata for the image.
|
|
@@ -14271,7 +14297,7 @@ class bA {
|
|
|
14271
14297
|
return new bA({ location: I, version: A.version, loader: B });
|
|
14272
14298
|
}
|
|
14273
14299
|
}
|
|
14274
|
-
class
|
|
14300
|
+
class oo extends pA {
|
|
14275
14301
|
// this creates the geometry for a screen-space projected line
|
|
14276
14302
|
// each point on the input path is split into two vertices
|
|
14277
14303
|
// these are pushed in opposite directions in screen-space to create width
|
|
@@ -14320,7 +14346,7 @@ class so extends pA {
|
|
|
14320
14346
|
return I;
|
|
14321
14347
|
}
|
|
14322
14348
|
}
|
|
14323
|
-
class
|
|
14349
|
+
class ao extends zA {
|
|
14324
14350
|
color_;
|
|
14325
14351
|
width_;
|
|
14326
14352
|
/**
|
|
@@ -14395,14 +14421,14 @@ class qo extends KI {
|
|
|
14395
14421
|
}
|
|
14396
14422
|
}
|
|
14397
14423
|
function vI(g) {
|
|
14398
|
-
const { end: A, width: I, color: B } = g, C = new
|
|
14399
|
-
return new
|
|
14424
|
+
const { end: A, width: I, color: B } = g, C = new oo([[0, 0, 0], A]);
|
|
14425
|
+
return new ao({
|
|
14400
14426
|
geometry: C,
|
|
14401
14427
|
color: B,
|
|
14402
14428
|
width: I
|
|
14403
14429
|
});
|
|
14404
14430
|
}
|
|
14405
|
-
class
|
|
14431
|
+
class so extends Rg {
|
|
14406
14432
|
width_;
|
|
14407
14433
|
height_;
|
|
14408
14434
|
depth_;
|
|
@@ -14422,7 +14448,7 @@ class ho extends Rg {
|
|
|
14422
14448
|
return this.depth_;
|
|
14423
14449
|
}
|
|
14424
14450
|
}
|
|
14425
|
-
const
|
|
14451
|
+
const LC = {
|
|
14426
14452
|
circle: 0,
|
|
14427
14453
|
square: 1,
|
|
14428
14454
|
triangle: 2
|
|
@@ -14446,7 +14472,7 @@ class lo extends zA {
|
|
|
14446
14472
|
Q.b,
|
|
14447
14473
|
Q.a,
|
|
14448
14474
|
C.size,
|
|
14449
|
-
|
|
14475
|
+
LC[C.marker]
|
|
14450
14476
|
];
|
|
14451
14477
|
}), B = new pA(I, [], "points");
|
|
14452
14478
|
B.addAttribute({
|
|
@@ -14465,7 +14491,7 @@ class lo extends zA {
|
|
|
14465
14491
|
type: "marker",
|
|
14466
14492
|
itemSize: 1,
|
|
14467
14493
|
offset: B.strideBytes
|
|
14468
|
-
}), this.geometry = B, this.setTexture(0,
|
|
14494
|
+
}), this.geometry = B, this.setTexture(0, Do());
|
|
14469
14495
|
}
|
|
14470
14496
|
/** Identifies the renderable type as `PointsRenderable`. */
|
|
14471
14497
|
get type() {
|
|
@@ -14473,10 +14499,10 @@ class lo extends zA {
|
|
|
14473
14499
|
}
|
|
14474
14500
|
}
|
|
14475
14501
|
let XI;
|
|
14476
|
-
function
|
|
14477
|
-
return XI || (XI =
|
|
14502
|
+
function Do() {
|
|
14503
|
+
return XI || (XI = ho()), XI;
|
|
14478
14504
|
}
|
|
14479
|
-
function
|
|
14505
|
+
function ho() {
|
|
14480
14506
|
const g = (a) => {
|
|
14481
14507
|
const s = new Float32Array(a * a);
|
|
14482
14508
|
return s.fill(1), s;
|
|
@@ -14498,11 +14524,11 @@ function yo() {
|
|
|
14498
14524
|
triangle: I(256)
|
|
14499
14525
|
}, E = Object.keys(Q).length, i = new Float32Array(E * 65536);
|
|
14500
14526
|
for (const [a, s] of Object.entries(Q))
|
|
14501
|
-
i.set(s,
|
|
14502
|
-
const o = new
|
|
14527
|
+
i.set(s, LC[a] * 65536);
|
|
14528
|
+
const o = new so(i, 256, 256);
|
|
14503
14529
|
return o.wrapR = "clamp_to_edge", o.wrapS = "clamp_to_edge", o.wrapT = "clamp_to_edge", o;
|
|
14504
14530
|
}
|
|
14505
|
-
class
|
|
14531
|
+
class to {
|
|
14506
14532
|
planes_;
|
|
14507
14533
|
/**
|
|
14508
14534
|
* Creates a frustum from a view-projection matrix.
|
|
@@ -14566,7 +14592,7 @@ class eo {
|
|
|
14566
14592
|
return !0;
|
|
14567
14593
|
}
|
|
14568
14594
|
}
|
|
14569
|
-
class
|
|
14595
|
+
class JC extends YI {
|
|
14570
14596
|
transform_ = new oC();
|
|
14571
14597
|
/** @hidden */
|
|
14572
14598
|
projectionMatrix_ = $();
|
|
@@ -14610,7 +14636,7 @@ class YC extends YI {
|
|
|
14610
14636
|
}
|
|
14611
14637
|
/** The view frustum derived from the current view-projection. */
|
|
14612
14638
|
get frustum() {
|
|
14613
|
-
return new
|
|
14639
|
+
return new to(this.getViewProjection());
|
|
14614
14640
|
}
|
|
14615
14641
|
/**
|
|
14616
14642
|
* Moves the camera by the given world-space offset.
|
|
@@ -14639,7 +14665,7 @@ class YC extends YI {
|
|
|
14639
14665
|
I,
|
|
14640
14666
|
B
|
|
14641
14667
|
);
|
|
14642
|
-
|
|
14668
|
+
iQ(C, C, 1 / C[3]);
|
|
14643
14669
|
const Q = OA(
|
|
14644
14670
|
JA(),
|
|
14645
14671
|
C,
|
|
@@ -14664,7 +14690,7 @@ class OB {
|
|
|
14664
14690
|
);
|
|
14665
14691
|
}
|
|
14666
14692
|
}
|
|
14667
|
-
const jI = -1, VB = 0,
|
|
14693
|
+
const jI = -1, VB = 0, yo = 1, vB = 9e-3, eo = 1e-3, no = 9e-4, Go = 0.5, wo = 60;
|
|
14668
14694
|
class fo {
|
|
14669
14695
|
camera_;
|
|
14670
14696
|
orbitVelocity_ = new OB(0, 0, 0);
|
|
@@ -14686,7 +14712,7 @@ class fo {
|
|
|
14686
14712
|
I?.yaw ?? 0,
|
|
14687
14713
|
I?.pitch ?? 0
|
|
14688
14714
|
), I?.target && _I(this.currCenter_, I.target), this.dampingFactor_ = hA(
|
|
14689
|
-
I?.dampingFactor ??
|
|
14715
|
+
I?.dampingFactor ?? Go,
|
|
14690
14716
|
0,
|
|
14691
14717
|
1
|
|
14692
14718
|
), this.scrollZoom_ = I?.scrollZoom ?? "always", this.updateCamera();
|
|
@@ -14746,7 +14772,7 @@ class fo {
|
|
|
14746
14772
|
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_);
|
|
14747
14773
|
const I = Math.PI / 2 - m;
|
|
14748
14774
|
this.currPos_.theta = hA(this.currPos_.theta, -I, I), this.currPos_.radius = Math.max(0.01, this.currPos_.radius), this.updateCamera();
|
|
14749
|
-
const B = Math.pow(1 - this.dampingFactor_, A *
|
|
14775
|
+
const B = Math.pow(1 - this.dampingFactor_, A * wo);
|
|
14750
14776
|
this.orbitVelocity_.phi *= B, this.orbitVelocity_.theta *= B, this.orbitVelocity_.radius *= B, $I(this.panVelocity_, this.panVelocity_, B), this.cutoffLowVelocity();
|
|
14751
14777
|
}
|
|
14752
14778
|
onPointerDown(A) {
|
|
@@ -14755,7 +14781,7 @@ class fo {
|
|
|
14755
14781
|
}
|
|
14756
14782
|
onPointerMove(A) {
|
|
14757
14783
|
if (this.currMouseButton_ == jI) return;
|
|
14758
|
-
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_ ===
|
|
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;
|
|
14759
14785
|
Q && this.orbit(B, C), E && this.pan(B, C);
|
|
14760
14786
|
}
|
|
14761
14787
|
onWheel(A) {
|
|
@@ -14774,26 +14800,26 @@ class fo {
|
|
|
14774
14800
|
this.orbitVelocity_.phi -= A * vB, this.orbitVelocity_.theta += I * vB;
|
|
14775
14801
|
}
|
|
14776
14802
|
pan(A, I) {
|
|
14777
|
-
const B = this.currPos_.radius *
|
|
14803
|
+
const B = this.currPos_.radius * eo, C = M();
|
|
14778
14804
|
Ag(C, C, this.camera_.right, A), Ag(C, C, this.camera_.up, I), $I(C, C, B), Ig(this.panVelocity_, this.panVelocity_, C);
|
|
14779
14805
|
}
|
|
14780
14806
|
zoom(A) {
|
|
14781
|
-
this.orbitVelocity_.radius += A *
|
|
14807
|
+
this.orbitVelocity_.radius += A * no;
|
|
14782
14808
|
}
|
|
14783
14809
|
updateCamera() {
|
|
14784
14810
|
const A = aI(M(), this.currCenter_, this.currPos_.toVec3());
|
|
14785
14811
|
this.camera_.transform.setTranslation(A), this.camera_.transform.targetTo(this.currCenter_);
|
|
14786
14812
|
}
|
|
14787
14813
|
cutoffLowVelocity() {
|
|
14788
|
-
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 &&
|
|
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_);
|
|
14789
14815
|
}
|
|
14790
14816
|
}
|
|
14791
|
-
const
|
|
14792
|
-
class po extends
|
|
14817
|
+
const YC = 1.77, XB = 128, jB = 128 / YC, Fo = -1e6, ro = 1e6;
|
|
14818
|
+
class po extends JC {
|
|
14793
14819
|
// width_ and height_ should always be defined by constructor (see setFrame)
|
|
14794
14820
|
width_ = XB;
|
|
14795
14821
|
height_ = jB;
|
|
14796
|
-
viewportAspectRatio_ =
|
|
14822
|
+
viewportAspectRatio_ = YC;
|
|
14797
14823
|
viewportSize_ = [XB, jB];
|
|
14798
14824
|
axes_;
|
|
14799
14825
|
rotation_;
|
|
@@ -14804,7 +14830,7 @@ class po extends YC {
|
|
|
14804
14830
|
* @param props - Initialization properties.
|
|
14805
14831
|
*/
|
|
14806
14832
|
constructor(A) {
|
|
14807
|
-
super(), this.near_ = A.near ??
|
|
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();
|
|
14808
14834
|
}
|
|
14809
14835
|
/**
|
|
14810
14836
|
* The world-space size of the rendered view as `[width, height]`.
|
|
@@ -14894,7 +14920,7 @@ class po extends YC {
|
|
|
14894
14920
|
updateProjectionMatrix() {
|
|
14895
14921
|
const A = this.width_, I = this.height_, B = A / I;
|
|
14896
14922
|
let C = 0.5 * A, Q = 0.5 * I;
|
|
14897
|
-
this.viewportAspectRatio_ > B ? C *= this.viewportAspectRatio_ / B : Q *= B / this.viewportAspectRatio_, this.viewportSize_ = [2 * C, 2 * Q],
|
|
14923
|
+
this.viewportAspectRatio_ > B ? C *= this.viewportAspectRatio_ / B : Q *= B / this.viewportAspectRatio_, this.viewportSize_ = [2 * C, 2 * Q], _C(
|
|
14898
14924
|
this.projectionMatrix_,
|
|
14899
14925
|
-C,
|
|
14900
14926
|
C,
|
|
@@ -14978,8 +15004,8 @@ class uo {
|
|
|
14978
15004
|
!this.dragActive_ || I.button !== zB || (this.dragActive_ = !1, I.target?.releasePointerCapture?.(I.pointerId));
|
|
14979
15005
|
}
|
|
14980
15006
|
}
|
|
14981
|
-
const
|
|
14982
|
-
class mo extends
|
|
15007
|
+
const So = 60, Ro = 1.77, oI = 0.1, zI = 180 - oI;
|
|
15008
|
+
class mo extends JC {
|
|
14983
15009
|
fov_;
|
|
14984
15010
|
aspectRatio_;
|
|
14985
15011
|
/**
|
|
@@ -14989,8 +15015,8 @@ class mo extends YC {
|
|
|
14989
15015
|
*/
|
|
14990
15016
|
constructor(A = {}) {
|
|
14991
15017
|
const {
|
|
14992
|
-
fov: I =
|
|
14993
|
-
aspectRatio: B =
|
|
15018
|
+
fov: I = So,
|
|
15019
|
+
aspectRatio: B = Ro,
|
|
14994
15020
|
near: C = 0.1,
|
|
14995
15021
|
far: Q = 1e4,
|
|
14996
15022
|
position: E = x(0, 0, 0)
|
|
@@ -15036,9 +15062,9 @@ class mo extends YC {
|
|
|
15036
15062
|
}
|
|
15037
15063
|
/** @hidden */
|
|
15038
15064
|
updateProjectionMatrix() {
|
|
15039
|
-
|
|
15065
|
+
jC(
|
|
15040
15066
|
this.projectionMatrix_,
|
|
15041
|
-
|
|
15067
|
+
ZC(this.fov),
|
|
15042
15068
|
this.aspectRatio_,
|
|
15043
15069
|
this.near_,
|
|
15044
15070
|
this.far_
|
|
@@ -15049,13 +15075,13 @@ export {
|
|
|
15049
15075
|
qo as AxesLayer,
|
|
15050
15076
|
AA as Box2,
|
|
15051
15077
|
VA as Box3,
|
|
15052
|
-
|
|
15078
|
+
JC as Camera,
|
|
15053
15079
|
T as Color,
|
|
15054
|
-
|
|
15055
|
-
|
|
15080
|
+
to as Frustum,
|
|
15081
|
+
ko as Idetik,
|
|
15056
15082
|
Jg as ImageLayer,
|
|
15057
|
-
|
|
15058
|
-
|
|
15083
|
+
ZQ as ImageRenderable,
|
|
15084
|
+
_Q as LabelImageRenderable,
|
|
15059
15085
|
Yg as LabelLayer,
|
|
15060
15086
|
KI as Layer,
|
|
15061
15087
|
bA as OmeZarrImageSource,
|
|
@@ -15064,16 +15090,17 @@ export {
|
|
|
15064
15090
|
uo as PanZoomControls,
|
|
15065
15091
|
mo as PerspectiveCamera,
|
|
15066
15092
|
lo as PointsRenderable,
|
|
15067
|
-
|
|
15093
|
+
ao as ProjectedLineRenderable,
|
|
15068
15094
|
zA as RenderableObject,
|
|
15095
|
+
oE as Stats,
|
|
15069
15096
|
oC as TrsTransform,
|
|
15070
|
-
|
|
15071
|
-
|
|
15072
|
-
|
|
15097
|
+
Lo as Viewport,
|
|
15098
|
+
BE as VolumeLayer,
|
|
15099
|
+
AE as VolumeRenderable,
|
|
15073
15100
|
Ng as createExplorationPolicy,
|
|
15074
15101
|
Ug as createImageSourcePolicy,
|
|
15075
|
-
|
|
15076
|
-
|
|
15102
|
+
No as createNoPrefetchPolicy,
|
|
15103
|
+
co as createPlaybackPolicy,
|
|
15077
15104
|
Yo as loadOmeZarrPlate,
|
|
15078
15105
|
Mo as loadOmeZarrWell,
|
|
15079
15106
|
Ko as loadOmeroChannels,
|