@idetik/core 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/worker_kernel-BYKAkuPZ.js.map +1 -1
- package/dist/index.d.ts +164 -153
- package/dist/index.js +992 -916
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +18 -18
- package/dist/index.umd.cjs.map +1 -1
- package/dist/types/examples/chunk_streaming/chunk_info_overlay.d.ts.map +1 -1
- package/dist/types/src/core/chunk_manager.d.ts +12 -7
- package/dist/types/src/core/chunk_manager.d.ts.map +1 -1
- package/dist/types/src/core/chunk_store.d.ts +18 -0
- package/dist/types/src/core/chunk_store.d.ts.map +1 -0
- package/dist/types/src/core/chunk_store_view.d.ts +38 -0
- package/dist/types/src/core/chunk_store_view.d.ts.map +1 -0
- package/dist/types/src/core/layer.d.ts +6 -2
- package/dist/types/src/core/layer.d.ts.map +1 -1
- package/dist/types/src/core/layer_manager.d.ts.map +1 -1
- package/dist/types/src/core/renderable_object.d.ts +4 -0
- package/dist/types/src/core/renderable_object.d.ts.map +1 -1
- package/dist/types/src/data/chunk.d.ts +7 -5
- package/dist/types/src/data/chunk.d.ts.map +1 -1
- package/dist/types/src/data/ome_zarr/image_source.d.ts +1 -12
- package/dist/types/src/data/ome_zarr/image_source.d.ts.map +1 -1
- package/dist/types/src/data/zarr/open.d.ts +1 -4
- package/dist/types/src/data/zarr/open.d.ts.map +1 -1
- package/dist/types/src/idetik.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +0 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/layers/chunked_image_layer.d.ts +8 -7
- package/dist/types/src/layers/chunked_image_layer.d.ts.map +1 -1
- package/dist/types/src/objects/renderable/volume_renderable.d.ts.map +1 -1
- package/dist/types/src/renderers/WebGLState.d.ts +4 -0
- package/dist/types/src/renderers/WebGLState.d.ts.map +1 -1
- package/dist/types/src/renderers/webgl_renderer.d.ts.map +1 -1
- package/dist/types/src/utilities/logger.d.ts +1 -1
- package/dist/types/src/utilities/logger.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/types/examples/s3_private_data/aws_auth.d.ts +0 -17
- package/dist/types/examples/s3_private_data/aws_auth.d.ts.map +0 -1
- package/dist/types/examples/s3_private_data/main.d.ts +0 -2
- package/dist/types/examples/s3_private_data/main.d.ts.map +0 -1
- package/dist/types/src/core/chunk_manager_source.d.ts +0 -49
- package/dist/types/src/core/chunk_manager_source.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -527,25 +527,25 @@ function AQ() {
|
|
|
527
527
|
}
|
|
528
528
|
return "development";
|
|
529
529
|
}
|
|
530
|
-
class
|
|
530
|
+
class c {
|
|
531
531
|
static logLevel_ = AQ() === "production" ? "warn" : "debug";
|
|
532
532
|
static setLogLevel(A) {
|
|
533
|
-
|
|
533
|
+
c.logLevel_ = A;
|
|
534
534
|
}
|
|
535
535
|
static debug(A, I, ...B) {
|
|
536
|
-
|
|
536
|
+
c.log("debug", A, I, ...B);
|
|
537
537
|
}
|
|
538
538
|
static info(A, I, ...B) {
|
|
539
|
-
|
|
539
|
+
c.log("info", A, I, ...B);
|
|
540
540
|
}
|
|
541
541
|
static warn(A, I, ...B) {
|
|
542
|
-
|
|
542
|
+
c.log("warn", A, I, ...B);
|
|
543
543
|
}
|
|
544
544
|
static error(A, I, ...B) {
|
|
545
|
-
|
|
545
|
+
c.log("error", A, I, ...B);
|
|
546
546
|
}
|
|
547
547
|
static log(A, I, B, ...Q) {
|
|
548
|
-
if (Mg[A] < Mg[
|
|
548
|
+
if (Mg[A] < Mg[c.logLevel_]) return;
|
|
549
549
|
const C = (/* @__PURE__ */ new Date()).toISOString(), E = $B[A], i = `[${C}][${A.toUpperCase()}][${I}]`, o = [`${E}${i}`, B, ...Q];
|
|
550
550
|
switch (A) {
|
|
551
551
|
case "debug":
|
|
@@ -641,7 +641,7 @@ class IQ {
|
|
|
641
641
|
`Unsupported uniform type "${B.type}" (GLenum) found in shader program for uniform "${B.name}"`
|
|
642
642
|
);
|
|
643
643
|
const Q = this.gl_.getUniformLocation(this.program_, B.name);
|
|
644
|
-
Q && (this.uniformInfo_.set(B.name, [Q, B]),
|
|
644
|
+
Q && (this.uniformInfo_.set(B.name, [Q, B]), c.debug(
|
|
645
645
|
"WebGLShaderProgram",
|
|
646
646
|
"Uniform found:",
|
|
647
647
|
B.name,
|
|
@@ -742,7 +742,7 @@ function Kg(g, A) {
|
|
|
742
742
|
${Q}`;
|
|
743
743
|
return g.replace(uI, C);
|
|
744
744
|
}
|
|
745
|
-
const
|
|
745
|
+
const W = [
|
|
746
746
|
"00",
|
|
747
747
|
"01",
|
|
748
748
|
"02",
|
|
@@ -1002,12 +1002,12 @@ const Z = [
|
|
|
1002
1002
|
];
|
|
1003
1003
|
function DB() {
|
|
1004
1004
|
const g = Math.random() * 4294967295 | 0, A = Math.random() * 4294967295 | 0, I = Math.random() * 4294967295 | 0, B = Math.random() * 4294967295 | 0;
|
|
1005
|
-
return (
|
|
1005
|
+
return (W[g & 255] + W[g >> 8 & 255] + W[g >> 16 & 255] + W[g >> 24 & 255] + "-" + W[A & 255] + W[A >> 8 & 255] + "-" + W[A >> 16 & 15 | 64] + W[A >> 24 & 255] + "-" + W[I & 63 | 128] + W[I >> 8 & 255] + "-" + W[I >> 16 & 255] + W[I >> 24 & 255] + W[B & 255] + W[B >> 8 & 255] + W[B >> 16 & 255] + W[B >> 24 & 255]).toLowerCase();
|
|
1006
1006
|
}
|
|
1007
1007
|
class Eg {
|
|
1008
1008
|
uuid = DB();
|
|
1009
1009
|
}
|
|
1010
|
-
var rA = 1e-6,
|
|
1010
|
+
var rA = 1e-6, T = typeof Float32Array < "u" ? Float32Array : Array, CQ = Math.PI / 180;
|
|
1011
1011
|
function EQ(g) {
|
|
1012
1012
|
return g * CQ;
|
|
1013
1013
|
}
|
|
@@ -1017,30 +1017,30 @@ Math.hypot || (Math.hypot = function() {
|
|
|
1017
1017
|
return Math.sqrt(g);
|
|
1018
1018
|
});
|
|
1019
1019
|
function sB() {
|
|
1020
|
-
var g = new
|
|
1021
|
-
return
|
|
1020
|
+
var g = new T(9);
|
|
1021
|
+
return T != 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;
|
|
1022
1022
|
}
|
|
1023
1023
|
function iQ(g, A) {
|
|
1024
1024
|
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;
|
|
1025
1025
|
}
|
|
1026
1026
|
function AA() {
|
|
1027
|
-
var g = new
|
|
1028
|
-
return
|
|
1027
|
+
var g = new T(16);
|
|
1028
|
+
return T != Float32Array && (g[1] = 0, g[2] = 0, g[3] = 0, g[4] = 0, g[6] = 0, g[7] = 0, g[8] = 0, g[9] = 0, g[11] = 0, g[12] = 0, g[13] = 0, g[14] = 0), g[0] = 1, g[5] = 1, g[10] = 1, g[15] = 1, g;
|
|
1029
1029
|
}
|
|
1030
1030
|
function ig(g, A) {
|
|
1031
|
-
var I = A[0], B = A[1], Q = A[2], C = A[3], E = A[4], i = A[5], o = A[6], a = A[7], D = A[8], h = A[9], y = A[10], G = A[11],
|
|
1032
|
-
return
|
|
1031
|
+
var I = A[0], B = A[1], Q = A[2], C = A[3], E = A[4], i = A[5], o = A[6], a = A[7], D = A[8], h = A[9], y = A[10], G = A[11], S = A[12], R = A[13], e = A[14], F = A[15], M = I * i - B * E, N = I * o - Q * E, K = I * a - C * E, J = B * o - Q * i, L = B * a - C * i, O = Q * a - C * o, V = D * R - h * S, X = D * e - y * S, b = D * F - G * S, Z = h * e - y * R, wA = h * F - G * R, FA = y * F - G * e, m = M * FA - N * wA + K * Z + J * b - L * X + O * V;
|
|
1032
|
+
return m ? (m = 1 / m, g[0] = (i * FA - o * wA + a * Z) * m, g[1] = (Q * wA - B * FA - C * Z) * m, g[2] = (R * O - e * L + F * J) * m, g[3] = (y * L - h * O - G * J) * m, g[4] = (o * b - E * FA - a * X) * m, g[5] = (I * FA - Q * b + C * X) * m, g[6] = (e * K - S * O - F * N) * m, g[7] = (D * O - y * K + G * N) * m, g[8] = (E * wA - i * b + a * V) * m, g[9] = (B * b - I * wA - C * V) * m, g[10] = (S * L - R * K + F * M) * m, g[11] = (h * K - D * L - G * M) * m, g[12] = (i * X - E * Z - o * V) * m, g[13] = (I * Z - B * X + Q * V) * m, g[14] = (R * N - S * J - e * M) * m, g[15] = (D * J - h * N + y * M) * m, g) : null;
|
|
1033
1033
|
}
|
|
1034
1034
|
function FI(g, A, I) {
|
|
1035
|
-
var B = A[0], Q = A[1], C = A[2], E = A[3], i = A[4], o = A[5], a = A[6], D = A[7], h = A[8], y = A[9], G = A[10],
|
|
1036
|
-
return g[0] =
|
|
1035
|
+
var B = A[0], Q = A[1], C = A[2], E = A[3], i = A[4], o = A[5], a = A[6], D = A[7], h = A[8], y = A[9], G = A[10], S = A[11], R = A[12], e = A[13], F = A[14], M = A[15], N = I[0], K = I[1], J = I[2], L = I[3];
|
|
1036
|
+
return g[0] = N * B + K * i + J * h + L * R, g[1] = N * Q + K * o + J * y + L * e, g[2] = N * C + K * a + J * G + L * F, g[3] = N * E + K * D + J * S + L * M, N = I[4], K = I[5], J = I[6], L = I[7], g[4] = N * B + K * i + J * h + L * R, g[5] = N * Q + K * o + J * y + L * e, g[6] = N * C + K * a + J * G + L * F, g[7] = N * E + K * D + J * S + L * M, N = I[8], K = I[9], J = I[10], L = I[11], g[8] = N * B + K * i + J * h + L * R, g[9] = N * Q + K * o + J * y + L * e, g[10] = N * C + K * a + J * G + L * F, g[11] = N * E + K * D + J * S + L * M, N = I[12], K = I[13], J = I[14], L = I[15], g[12] = N * B + K * i + J * h + L * R, g[13] = N * Q + K * o + J * y + L * e, g[14] = N * C + K * a + J * G + L * F, g[15] = N * E + K * D + J * S + L * M, g;
|
|
1037
1037
|
}
|
|
1038
1038
|
function oQ(g, A) {
|
|
1039
1039
|
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;
|
|
1040
1040
|
}
|
|
1041
1041
|
function aQ(g, A, I, B) {
|
|
1042
|
-
var Q = A[0], C = A[1], E = A[2], i = A[3], o = Q + Q, a = C + C, D = E + E, h = Q * o, y = Q * a, G = Q * D,
|
|
1043
|
-
return g[0] = (1 - (
|
|
1042
|
+
var Q = A[0], C = A[1], E = A[2], i = A[3], o = Q + Q, a = C + C, D = E + E, h = Q * o, y = Q * a, G = Q * D, S = C * a, R = C * D, e = E * D, F = i * o, M = i * a, N = i * D, K = B[0], J = B[1], L = B[2];
|
|
1043
|
+
return g[0] = (1 - (S + e)) * K, g[1] = (y + N) * K, g[2] = (G - M) * K, g[3] = 0, g[4] = (y - N) * J, g[5] = (1 - (h + e)) * J, g[6] = (R + F) * J, g[7] = 0, g[8] = (G + M) * L, g[9] = (R - F) * L, g[10] = (1 - (h + S)) * L, g[11] = 0, g[12] = I[0], g[13] = I[1], g[14] = I[2], g[15] = 1, g;
|
|
1044
1044
|
}
|
|
1045
1045
|
function DQ(g, A, I, B, Q) {
|
|
1046
1046
|
var C = 1 / Math.tan(A / 2), E;
|
|
@@ -1055,15 +1055,15 @@ var yQ = hQ;
|
|
|
1055
1055
|
function tQ(g, A, I, B) {
|
|
1056
1056
|
var Q = A[0], C = A[1], E = A[2], i = B[0], o = B[1], a = B[2], D = Q - I[0], h = C - I[1], y = E - I[2], G = D * D + h * h + y * y;
|
|
1057
1057
|
G > 0 && (G = 1 / Math.sqrt(G), D *= G, h *= G, y *= G);
|
|
1058
|
-
var
|
|
1059
|
-
return G =
|
|
1058
|
+
var S = o * y - a * h, R = a * D - i * y, e = i * h - o * D;
|
|
1059
|
+
return G = S * S + R * R + e * e, G > 0 && (G = 1 / Math.sqrt(G), S *= G, R *= G, e *= G), g[0] = S, g[1] = R, g[2] = e, g[3] = 0, g[4] = h * e - y * R, g[5] = y * S - D * e, g[6] = D * R - h * S, g[7] = 0, g[8] = D, g[9] = h, g[10] = y, g[11] = 0, g[12] = Q, g[13] = C, g[14] = E, g[15] = 1, g;
|
|
1060
1060
|
}
|
|
1061
1061
|
function p() {
|
|
1062
|
-
var g = new
|
|
1063
|
-
return
|
|
1062
|
+
var g = new T(3);
|
|
1063
|
+
return T != Float32Array && (g[0] = 0, g[1] = 0, g[2] = 0), g;
|
|
1064
1064
|
}
|
|
1065
1065
|
function IA(g) {
|
|
1066
|
-
var A = new
|
|
1066
|
+
var A = new T(3);
|
|
1067
1067
|
return A[0] = g[0], A[1] = g[1], A[2] = g[2], A;
|
|
1068
1068
|
}
|
|
1069
1069
|
function hB(g) {
|
|
@@ -1071,7 +1071,7 @@ function hB(g) {
|
|
|
1071
1071
|
return Math.hypot(A, I, B);
|
|
1072
1072
|
}
|
|
1073
1073
|
function q(g, A, I) {
|
|
1074
|
-
var B = new
|
|
1074
|
+
var B = new T(3);
|
|
1075
1075
|
return B[0] = g, B[1] = A, B[2] = I, B;
|
|
1076
1076
|
}
|
|
1077
1077
|
function bA(g, A) {
|
|
@@ -1133,15 +1133,15 @@ var VI = GQ, rQ = hB;
|
|
|
1133
1133
|
};
|
|
1134
1134
|
})();
|
|
1135
1135
|
function PA() {
|
|
1136
|
-
var g = new
|
|
1137
|
-
return
|
|
1136
|
+
var g = new T(4);
|
|
1137
|
+
return T != Float32Array && (g[0] = 0, g[1] = 0, g[2] = 0, g[3] = 0), g;
|
|
1138
1138
|
}
|
|
1139
1139
|
function SQ(g) {
|
|
1140
|
-
var A = new
|
|
1140
|
+
var A = new T(4);
|
|
1141
1141
|
return A[0] = g[0], A[1] = g[1], A[2] = g[2], A[3] = g[3], A;
|
|
1142
1142
|
}
|
|
1143
1143
|
function vI(g, A, I, B) {
|
|
1144
|
-
var Q = new
|
|
1144
|
+
var Q = new T(4);
|
|
1145
1145
|
return Q[0] = g, Q[1] = A, Q[2] = I, Q[3] = B, Q;
|
|
1146
1146
|
}
|
|
1147
1147
|
function RQ(g, A) {
|
|
@@ -1168,8 +1168,8 @@ function nI(g, A, I) {
|
|
|
1168
1168
|
};
|
|
1169
1169
|
})();
|
|
1170
1170
|
function XI() {
|
|
1171
|
-
var g = new
|
|
1172
|
-
return
|
|
1171
|
+
var g = new T(4);
|
|
1172
|
+
return T != Float32Array && (g[0] = 0, g[1] = 0, g[2] = 0), g[3] = 1, g;
|
|
1173
1173
|
}
|
|
1174
1174
|
function UQ(g, A, I) {
|
|
1175
1175
|
I = I * 0.5;
|
|
@@ -1181,8 +1181,8 @@ function kQ(g, A, I) {
|
|
|
1181
1181
|
return g[0] = B * D + E * i + Q * a - C * o, g[1] = Q * D + E * o + C * i - B * a, g[2] = C * D + E * a + B * o - Q * i, g[3] = E * D - B * i - Q * o - C * a, g;
|
|
1182
1182
|
}
|
|
1183
1183
|
function WI(g, A, I, B) {
|
|
1184
|
-
var Q = A[0], C = A[1], E = A[2], i = A[3], o = I[0], a = I[1], D = I[2], h = I[3], y, G,
|
|
1185
|
-
return G = Q * o + C * a + E * D + i * h, G < 0 && (G = -G, o = -o, a = -a, D = -D, h = -h), 1 - G > rA ? (y = Math.acos(G),
|
|
1184
|
+
var Q = A[0], C = A[1], E = A[2], i = A[3], o = I[0], a = I[1], D = I[2], h = I[3], y, G, S, R, e;
|
|
1185
|
+
return G = Q * o + C * a + E * D + i * h, G < 0 && (G = -G, o = -o, a = -a, D = -D, h = -h), 1 - G > rA ? (y = Math.acos(G), S = Math.sin(y), R = Math.sin((1 - B) * y) / S, e = Math.sin(B * y) / S) : (R = 1 - B, e = B), g[0] = R * Q + e * o, g[1] = R * C + e * a, g[2] = R * E + e * D, g[3] = R * i + e * h, g;
|
|
1186
1186
|
}
|
|
1187
1187
|
function wB(g, A) {
|
|
1188
1188
|
var I = A[0] + A[4] + A[8], B;
|
|
@@ -1217,15 +1217,15 @@ var LQ = SQ, JQ = RQ, og = cQ;
|
|
|
1217
1217
|
};
|
|
1218
1218
|
})();
|
|
1219
1219
|
function FB() {
|
|
1220
|
-
var g = new
|
|
1221
|
-
return
|
|
1220
|
+
var g = new T(2);
|
|
1221
|
+
return T != Float32Array && (g[0] = 0, g[1] = 0), g;
|
|
1222
1222
|
}
|
|
1223
1223
|
function qg(g) {
|
|
1224
|
-
var A = new
|
|
1224
|
+
var A = new T(2);
|
|
1225
1225
|
return A[0] = g[0], A[1] = g[1], A;
|
|
1226
1226
|
}
|
|
1227
|
-
function
|
|
1228
|
-
var I = new
|
|
1227
|
+
function u(g, A) {
|
|
1228
|
+
var I = new T(2);
|
|
1229
1229
|
return I[0] = g, I[1] = A, I;
|
|
1230
1230
|
}
|
|
1231
1231
|
function YQ(g, A) {
|
|
@@ -1531,7 +1531,7 @@ class qQ {
|
|
|
1531
1531
|
getFilter(A, I) {
|
|
1532
1532
|
const { dataFormat: B, dataType: Q } = I;
|
|
1533
1533
|
if (B === "scalar" && Q !== "float" && A !== "nearest")
|
|
1534
|
-
return
|
|
1534
|
+
return c.warn(
|
|
1535
1535
|
"WebGLTexture",
|
|
1536
1536
|
"Integer values are not filterable. Using gl.NEAREST instead."
|
|
1537
1537
|
), this.gl_.NEAREST;
|
|
@@ -1671,7 +1671,7 @@ class j {
|
|
|
1671
1671
|
* the first element, and avoids biasing toward (0,0).
|
|
1672
1672
|
*/
|
|
1673
1673
|
constructor(A, I) {
|
|
1674
|
-
this.min = A ? qg(A) :
|
|
1674
|
+
this.min = A ? qg(A) : u(1 / 0, 1 / 0), this.max = I ? qg(I) : u(-1 / 0, -1 / 0);
|
|
1675
1675
|
}
|
|
1676
1676
|
clone() {
|
|
1677
1677
|
return new j(this.min, this.max);
|
|
@@ -1688,8 +1688,8 @@ class j {
|
|
|
1688
1688
|
}
|
|
1689
1689
|
floor() {
|
|
1690
1690
|
return new j(
|
|
1691
|
-
|
|
1692
|
-
|
|
1691
|
+
u(Math.floor(this.min[0]), Math.floor(this.min[1])),
|
|
1692
|
+
u(Math.floor(this.max[0]), Math.floor(this.max[1]))
|
|
1693
1693
|
);
|
|
1694
1694
|
}
|
|
1695
1695
|
toRect() {
|
|
@@ -1706,6 +1706,7 @@ class lQ {
|
|
|
1706
1706
|
currentBlendingMode_ = null;
|
|
1707
1707
|
currentViewport_ = null;
|
|
1708
1708
|
currentScissor_ = null;
|
|
1709
|
+
currentCullingMode_ = null;
|
|
1709
1710
|
constructor(A) {
|
|
1710
1711
|
this.gl_ = A;
|
|
1711
1712
|
}
|
|
@@ -1767,6 +1768,28 @@ class lQ {
|
|
|
1767
1768
|
const { x: B, y: Q, width: C, height: E } = I.toRect();
|
|
1768
1769
|
this.gl_.scissor(B, Q, C, E), this.currentScissor_ = I;
|
|
1769
1770
|
}
|
|
1771
|
+
setCullFace(A) {
|
|
1772
|
+
A ? this.enable(this.gl_.CULL_FACE) : this.disable(this.gl_.CULL_FACE);
|
|
1773
|
+
}
|
|
1774
|
+
setCullFaceMode(A) {
|
|
1775
|
+
if (this.currentCullingMode_ !== A) {
|
|
1776
|
+
if (A === "none")
|
|
1777
|
+
this.setCullFace(!1);
|
|
1778
|
+
else
|
|
1779
|
+
switch (this.setCullFace(!0), A) {
|
|
1780
|
+
case "front":
|
|
1781
|
+
this.gl_.cullFace(this.gl_.FRONT);
|
|
1782
|
+
break;
|
|
1783
|
+
case "back":
|
|
1784
|
+
this.gl_.cullFace(this.gl_.BACK);
|
|
1785
|
+
break;
|
|
1786
|
+
case "both":
|
|
1787
|
+
this.gl_.cullFace(this.gl_.FRONT_AND_BACK);
|
|
1788
|
+
break;
|
|
1789
|
+
}
|
|
1790
|
+
this.currentCullingMode_ = A;
|
|
1791
|
+
}
|
|
1792
|
+
}
|
|
1770
1793
|
}
|
|
1771
1794
|
const fQ = oQ(AA(), [1, -1, 1]);
|
|
1772
1795
|
class pQ extends ZB {
|
|
@@ -1782,22 +1805,22 @@ class pQ extends ZB {
|
|
|
1782
1805
|
antialias: !0
|
|
1783
1806
|
}), !this.gl_)
|
|
1784
1807
|
throw new Error("Failed to initialize WebGL2 context");
|
|
1785
|
-
|
|
1808
|
+
c.info(
|
|
1786
1809
|
"WebGLRenderer",
|
|
1787
1810
|
`WebGL version ${this.gl.getParameter(this.gl.VERSION)}`
|
|
1788
1811
|
), this.programs_ = new QQ(this.gl), this.bindings_ = new HQ(this.gl), this.textures_ = new qQ(this.gl), this.state_ = new lQ(this.gl), this.resize(this.canvas.width, this.canvas.height);
|
|
1789
1812
|
}
|
|
1790
1813
|
render(A) {
|
|
1791
1814
|
const I = A.getBoxRelativeTo(this.canvas), B = new j(
|
|
1792
|
-
|
|
1793
|
-
|
|
1815
|
+
u(0, 0),
|
|
1816
|
+
u(this.width, this.height)
|
|
1794
1817
|
);
|
|
1795
1818
|
if (j.equals(I.floor(), B.floor()))
|
|
1796
1819
|
this.state_.setScissorTest(!1);
|
|
1797
1820
|
else if (j.intersects(I, B))
|
|
1798
1821
|
this.state_.setScissor(I), this.state_.setScissorTest(!0);
|
|
1799
1822
|
else {
|
|
1800
|
-
|
|
1823
|
+
c.warn(
|
|
1801
1824
|
"WebGLRenderer",
|
|
1802
1825
|
`Viewport ${A.id} is entirely outside canvas bounds, skipping render`
|
|
1803
1826
|
);
|
|
@@ -1806,12 +1829,12 @@ class pQ extends ZB {
|
|
|
1806
1829
|
this.state_.setViewport(I), this.renderedObjectsPerFrame_ = 0, this.clear();
|
|
1807
1830
|
const { opaque: Q, transparent: C } = A.layerManager.partitionLayers();
|
|
1808
1831
|
this.state_.setDepthMask(!0);
|
|
1809
|
-
const E = A.camera.frustum;
|
|
1810
|
-
for (const
|
|
1811
|
-
|
|
1832
|
+
const E = A.camera.frustum, i = { viewport: A };
|
|
1833
|
+
for (const o of Q)
|
|
1834
|
+
o.update(i), o.state === "ready" && this.renderLayer(o, A.camera, E);
|
|
1812
1835
|
this.state_.setDepthMask(!1);
|
|
1813
|
-
for (const
|
|
1814
|
-
|
|
1836
|
+
for (const o of C)
|
|
1837
|
+
o.update(i), o.state === "ready" && this.renderLayer(o, A.camera, E);
|
|
1815
1838
|
this.state_.setDepthMask(!0), this.renderedObjects_ = this.renderedObjectsPerFrame_;
|
|
1816
1839
|
}
|
|
1817
1840
|
get textureInfo() {
|
|
@@ -1824,7 +1847,7 @@ class pQ extends ZB {
|
|
|
1824
1847
|
}
|
|
1825
1848
|
renderObject(A, I, B) {
|
|
1826
1849
|
const Q = A.objects[I];
|
|
1827
|
-
this.bindings_.bindGeometry(Q.geometry), Q.popStaleTextures().forEach((E) => {
|
|
1850
|
+
this.state_.setCullFaceMode(Q.cullFaceMode), this.bindings_.bindGeometry(Q.geometry), Q.popStaleTextures().forEach((E) => {
|
|
1828
1851
|
this.textures_.disposeTexture(E);
|
|
1829
1852
|
}), Q.textures.forEach((E, i) => {
|
|
1830
1853
|
this.textures_.bindTexture(E, i);
|
|
@@ -1888,8 +1911,8 @@ class pQ extends ZB {
|
|
|
1888
1911
|
}
|
|
1889
1912
|
resize(A, I) {
|
|
1890
1913
|
const B = new j(
|
|
1891
|
-
|
|
1892
|
-
|
|
1914
|
+
u(0, 0),
|
|
1915
|
+
u(A, I)
|
|
1893
1916
|
);
|
|
1894
1917
|
this.state_.setViewport(B);
|
|
1895
1918
|
}
|
|
@@ -1917,11 +1940,11 @@ class uQ {
|
|
|
1917
1940
|
cancel(A) {
|
|
1918
1941
|
const I = this.pending_.findIndex((Q) => Q.chunk === A);
|
|
1919
1942
|
if (I >= 0) {
|
|
1920
|
-
this.pending_.splice(I, 1),
|
|
1943
|
+
this.pending_.splice(I, 1), c.debug("ChunkQueue", "Cancelled pending request");
|
|
1921
1944
|
return;
|
|
1922
1945
|
}
|
|
1923
1946
|
const B = this.running_.get(A);
|
|
1924
|
-
B && (B.controller.abort(),
|
|
1947
|
+
B && (B.controller.abort(), c.debug("ChunkQueue", "Cancelled fetch request"));
|
|
1925
1948
|
}
|
|
1926
1949
|
get pendingCount() {
|
|
1927
1950
|
return this.pending_.length;
|
|
@@ -1945,7 +1968,7 @@ class uQ {
|
|
|
1945
1968
|
I.state === "loading" && (I.state = "loaded");
|
|
1946
1969
|
},
|
|
1947
1970
|
(E) => {
|
|
1948
|
-
I.state === "loading" && (I.state = "unloaded"), E.name !== "AbortError" &&
|
|
1971
|
+
I.state === "loading" && (I.state = "unloaded"), E.name !== "AbortError" && c.error("ChunkQueue", String(E));
|
|
1949
1972
|
}
|
|
1950
1973
|
).finally(() => {
|
|
1951
1974
|
this.running_.delete(I), this.pump();
|
|
@@ -1966,7 +1989,7 @@ function pg(g) {
|
|
|
1966
1989
|
if (fg.some((I) => g instanceof I))
|
|
1967
1990
|
return !0;
|
|
1968
1991
|
const A = fg.map((I) => I.name);
|
|
1969
|
-
return
|
|
1992
|
+
return c.debug(
|
|
1970
1993
|
"Chunk",
|
|
1971
1994
|
`Unsupported chunk data type: ${g}. Supported data types: ${A}`
|
|
1972
1995
|
), !1;
|
|
@@ -1977,98 +2000,63 @@ function TQ(g, A) {
|
|
|
1977
2000
|
function jI(g, A, I = 1e-6) {
|
|
1978
2001
|
return Math.abs(g - A) <= I;
|
|
1979
2002
|
}
|
|
1980
|
-
function OA(g, A, I) {
|
|
1981
|
-
return Math.max(A, Math.min(I, g));
|
|
1982
|
-
}
|
|
1983
|
-
const nB = Symbol("INTERNAL_POLICY_KEY");
|
|
1984
2003
|
class WQ {
|
|
1985
2004
|
chunks_;
|
|
1986
2005
|
loader_;
|
|
1987
2006
|
lowestResLOD_;
|
|
1988
|
-
sliceCoords_;
|
|
1989
2007
|
dimensions_;
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
W(E.size * E.scale, i.size * i.scale)
|
|
2007
|
-
), this.chunks_ = Array.from({ length: Q }, () => []);
|
|
2008
|
-
for (let o = 0; o < Q; ++o) {
|
|
2009
|
-
const a = this.chunks_[o];
|
|
2010
|
-
for (let D = 0; D < this.dimensions_.numLods; ++D) {
|
|
2011
|
-
const h = this.dimensions_.x.lods[D], y = this.dimensions_.y.lods[D], G = this.dimensions_.z?.lods[D], R = h.chunkSize, S = y.chunkSize, e = G?.chunkSize ?? 1, n = Math.ceil(h.size / R), M = Math.ceil(y.size / S), k = Math.ceil((G?.size ?? 1) / e);
|
|
2012
|
-
for (let J = 0; J < n; ++J) {
|
|
2013
|
-
const K = h.translation + J * h.chunkSize * h.scale;
|
|
2014
|
-
for (let c = 0; c < M; ++c) {
|
|
2015
|
-
const b = y.translation + c * y.chunkSize * y.scale;
|
|
2016
|
-
for (let m = 0; m < k; ++m) {
|
|
2017
|
-
const v = G !== void 0 ? G.translation + m * e * G.scale : 0;
|
|
2018
|
-
for (let u = 0; u < C; ++u)
|
|
2019
|
-
a.push({
|
|
2008
|
+
constructor(A) {
|
|
2009
|
+
this.loader_ = A, this.dimensions_ = this.loader_.getSourceDimensionMap(), this.lowestResLOD_ = this.dimensions_.numLods - 1, this.validateXYScaleRatios();
|
|
2010
|
+
const { size: I } = this.getAndValidateTimeDimension(), { size: B } = this.getAndValidateChannelDimension();
|
|
2011
|
+
this.chunks_ = Array.from({ length: I }, () => []);
|
|
2012
|
+
for (let Q = 0; Q < I; ++Q) {
|
|
2013
|
+
const C = this.chunks_[Q];
|
|
2014
|
+
for (let E = 0; E < this.dimensions_.numLods; ++E) {
|
|
2015
|
+
const i = this.dimensions_.x.lods[E], o = this.dimensions_.y.lods[E], a = this.dimensions_.z?.lods[E], D = i.chunkSize, h = o.chunkSize, y = a?.chunkSize ?? 1, G = Math.ceil(i.size / D), S = Math.ceil(o.size / h), R = Math.ceil((a?.size ?? 1) / y);
|
|
2016
|
+
for (let e = 0; e < B; ++e)
|
|
2017
|
+
for (let F = 0; F < G; ++F) {
|
|
2018
|
+
const M = i.translation + F * i.chunkSize * i.scale;
|
|
2019
|
+
for (let N = 0; N < S; ++N) {
|
|
2020
|
+
const K = o.translation + N * o.chunkSize * o.scale;
|
|
2021
|
+
for (let J = 0; J < R; ++J) {
|
|
2022
|
+
const L = a !== void 0 ? a.translation + J * y * a.scale : 0;
|
|
2023
|
+
C.push({
|
|
2020
2024
|
state: "unloaded",
|
|
2021
|
-
lod:
|
|
2025
|
+
lod: E,
|
|
2022
2026
|
visible: !1,
|
|
2023
2027
|
prefetch: !1,
|
|
2024
2028
|
priority: null,
|
|
2025
2029
|
orderKey: null,
|
|
2026
2030
|
shape: {
|
|
2027
|
-
x: Math.min(
|
|
2028
|
-
y: Math.min(
|
|
2029
|
-
z: Math.min(
|
|
2031
|
+
x: Math.min(D, i.size - F * D),
|
|
2032
|
+
y: Math.min(h, o.size - N * h),
|
|
2033
|
+
z: Math.min(y, (a?.size ?? 1) - J * y),
|
|
2030
2034
|
c: 1
|
|
2031
2035
|
},
|
|
2032
2036
|
rowAlignmentBytes: 1,
|
|
2033
|
-
chunkIndex: { x:
|
|
2037
|
+
chunkIndex: { x: F, y: N, z: J, c: e, t: Q },
|
|
2034
2038
|
scale: {
|
|
2035
|
-
x:
|
|
2036
|
-
y:
|
|
2037
|
-
z:
|
|
2039
|
+
x: i.scale,
|
|
2040
|
+
y: o.scale,
|
|
2041
|
+
z: a?.scale ?? 1
|
|
2038
2042
|
},
|
|
2039
2043
|
offset: {
|
|
2040
|
-
x:
|
|
2041
|
-
y:
|
|
2042
|
-
z:
|
|
2044
|
+
x: M,
|
|
2045
|
+
y: K,
|
|
2046
|
+
z: L
|
|
2043
2047
|
}
|
|
2044
2048
|
});
|
|
2049
|
+
}
|
|
2045
2050
|
}
|
|
2046
2051
|
}
|
|
2047
|
-
}
|
|
2048
2052
|
}
|
|
2049
2053
|
}
|
|
2050
2054
|
}
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
(Q) => Q.lod === this.currentLOD_ && Q.visible && Q.state === "loaded"
|
|
2054
|
-
);
|
|
2055
|
-
return this.currentLOD_ === this.lowestResLOD_ ? I : [...A.filter(
|
|
2056
|
-
(Q) => Q.lod === this.lowestResLOD_ && Q.visible && Q.state === "loaded"
|
|
2057
|
-
), ...I];
|
|
2058
|
-
}
|
|
2059
|
-
getChunksAtCurrentTime() {
|
|
2060
|
-
return this.chunks_[this.getCurrentTimeIndex()];
|
|
2061
|
-
}
|
|
2062
|
-
getCurrentTimeIndex() {
|
|
2063
|
-
return this.sliceCoords_.t === void 0 || this.dimensions_.t === void 0 ? 0 : TQ(this.dimensions_.t.lods[0], this.sliceCoords_.t);
|
|
2064
|
-
}
|
|
2065
|
-
allVisibleLowestLODLoaded() {
|
|
2066
|
-
return this.getChunksAtCurrentTime().filter((A) => A.visible && A.lod === this.lowestResLOD_).every((A) => A.state === "loaded");
|
|
2055
|
+
getChunksAtTime(A) {
|
|
2056
|
+
return this.chunks_[A];
|
|
2067
2057
|
}
|
|
2068
|
-
|
|
2069
|
-
this.
|
|
2070
|
-
const B = this.getZBounds(), C = this.policyChanged_ || this.viewBounds2DChanged(I) || this.zBoundsChanged(B) || this.lastTCoord_ !== this.sliceCoords_.t ? this.updateAndCollectChunkChangesForCurrentLod(I) : [];
|
|
2071
|
-
return this.policyChanged_ = !1, this.lastViewBounds2D_ = I.clone(), this.lastZBounds_ = B, this.lastTCoord_ = this.sliceCoords_.t, C;
|
|
2058
|
+
getTimeIndex(A) {
|
|
2059
|
+
return A.t === void 0 || this.dimensions_.t === void 0 ? 0 : TQ(this.dimensions_.t.lods[0], A.t);
|
|
2072
2060
|
}
|
|
2073
2061
|
get lodCount() {
|
|
2074
2062
|
return this.lowestResLOD_ + 1;
|
|
@@ -2076,128 +2064,12 @@ class WQ {
|
|
|
2076
2064
|
get dimensions() {
|
|
2077
2065
|
return this.dimensions_;
|
|
2078
2066
|
}
|
|
2079
|
-
|
|
2080
|
-
return this.
|
|
2081
|
-
}
|
|
2082
|
-
setImageSourcePolicy(A, I) {
|
|
2083
|
-
if (I !== nB)
|
|
2084
|
-
throw new Error("Unauthorized policy mutation");
|
|
2085
|
-
this.policy_ !== A && (this.policy_ = A, this.policyChanged_ = !0, N.info(
|
|
2086
|
-
"ChunkManagerSource",
|
|
2087
|
-
"Using image source policy:",
|
|
2088
|
-
this.policy_.profile
|
|
2089
|
-
));
|
|
2067
|
+
getLowestResLOD() {
|
|
2068
|
+
return this.lowestResLOD_;
|
|
2090
2069
|
}
|
|
2091
2070
|
loadChunkData(A, I) {
|
|
2092
2071
|
return this.loader_.loadChunkData(A, I);
|
|
2093
2072
|
}
|
|
2094
|
-
setLOD(A) {
|
|
2095
|
-
const I = this.dimensions_.x.lods[0].scale, Q = this.policy_.lod.bias - Math.log2(I) - A, C = Math.floor(Q), E = Math.max(
|
|
2096
|
-
0,
|
|
2097
|
-
Math.min(this.lowestResLOD_, this.policy_.lod.min)
|
|
2098
|
-
), i = Math.max(
|
|
2099
|
-
E,
|
|
2100
|
-
Math.min(this.lowestResLOD_, this.policy_.lod.max)
|
|
2101
|
-
), o = OA(C, E, i);
|
|
2102
|
-
o !== this.currentLOD_ && (this.currentLOD_ = o);
|
|
2103
|
-
}
|
|
2104
|
-
updateAndCollectChunkChangesForCurrentLod(A) {
|
|
2105
|
-
if (this.chunks_.length === 0)
|
|
2106
|
-
return N.warn(
|
|
2107
|
-
"ChunkManagerSource",
|
|
2108
|
-
"updateChunkVisibility called with no chunks initialized"
|
|
2109
|
-
), [];
|
|
2110
|
-
const I = FB();
|
|
2111
|
-
KQ(I, A.min, A.max, 0.5);
|
|
2112
|
-
const [B, Q] = this.getZBounds(), C = new eA(
|
|
2113
|
-
q(A.min[0], A.min[1], B),
|
|
2114
|
-
q(A.max[0], A.max[1], Q)
|
|
2115
|
-
), E = [], i = this.getCurrentTimeIndex();
|
|
2116
|
-
if (this.sliceCoords_.t !== void 0) {
|
|
2117
|
-
const a = this.disposeStaleTimeChunks(i);
|
|
2118
|
-
E.push(...a);
|
|
2119
|
-
}
|
|
2120
|
-
const o = this.updateChunksAtTimeIndex(
|
|
2121
|
-
i,
|
|
2122
|
-
C,
|
|
2123
|
-
I
|
|
2124
|
-
);
|
|
2125
|
-
if (E.push(...o), this.sliceCoords_.t !== void 0) {
|
|
2126
|
-
const a = this.markTimeChunksForPrefetch(
|
|
2127
|
-
i,
|
|
2128
|
-
C,
|
|
2129
|
-
I
|
|
2130
|
-
);
|
|
2131
|
-
E.push(...a);
|
|
2132
|
-
}
|
|
2133
|
-
return E;
|
|
2134
|
-
}
|
|
2135
|
-
disposeStaleTimeChunks(A) {
|
|
2136
|
-
const I = [];
|
|
2137
|
-
for (const B of this.tIndicesWithQueuedChunks_) {
|
|
2138
|
-
const Q = B - A;
|
|
2139
|
-
if (Q >= 0 && Q <= this.policy_.prefetch.t) continue;
|
|
2140
|
-
const C = this.chunks_[B];
|
|
2141
|
-
for (const E of C)
|
|
2142
|
-
this.disposeChunk(E), I.push(E);
|
|
2143
|
-
this.tIndicesWithQueuedChunks_.delete(B);
|
|
2144
|
-
}
|
|
2145
|
-
return I;
|
|
2146
|
-
}
|
|
2147
|
-
updateChunksAtTimeIndex(A, I, B) {
|
|
2148
|
-
const Q = this.getPaddedBounds(I), C = this.chunks_[A];
|
|
2149
|
-
this.tIndicesWithQueuedChunks_.add(A);
|
|
2150
|
-
for (const E of C) {
|
|
2151
|
-
const i = this.isChunkWithinBounds(E, I), o = this.isChunkChannelInSlice(E), a = !i && o && this.isChunkWithinBounds(E, Q), D = E.lod === this.currentLOD_, h = E.lod === this.lowestResLOD_, y = E.state === "loaded";
|
|
2152
|
-
E.visible = i, E.prefetch = a && D && !y, E.priority = this.computePriority(
|
|
2153
|
-
h,
|
|
2154
|
-
D,
|
|
2155
|
-
i,
|
|
2156
|
-
E.prefetch,
|
|
2157
|
-
o
|
|
2158
|
-
), E.priority !== null && E.state === "unloaded" ? E.state = "queued" : E.priority === null && E.state === "queued" && (E.state = "unloaded", E.orderKey = null), E.priority !== null && (E.orderKey = this.squareDistance2D(E, B)), this.shouldDispose(
|
|
2159
|
-
y,
|
|
2160
|
-
h,
|
|
2161
|
-
D,
|
|
2162
|
-
i,
|
|
2163
|
-
a,
|
|
2164
|
-
o
|
|
2165
|
-
) && this.disposeChunk(E);
|
|
2166
|
-
}
|
|
2167
|
-
return C;
|
|
2168
|
-
}
|
|
2169
|
-
markTimeChunksForPrefetch(A, I, B) {
|
|
2170
|
-
const Q = Math.min(
|
|
2171
|
-
this.chunks_.length - 1,
|
|
2172
|
-
A + this.policy_.prefetch.t
|
|
2173
|
-
), C = [];
|
|
2174
|
-
for (let E = A + 1; E <= Q; ++E)
|
|
2175
|
-
for (const i of this.chunks_[E]) {
|
|
2176
|
-
if (i.state !== "unloaded" || i.lod !== this.lowestResLOD_ || !this.isChunkChannelInSlice(i) || !this.isChunkWithinBounds(i, I)) continue;
|
|
2177
|
-
i.prefetch = !0, i.priority = this.policy_.priorityMap.prefetchTime;
|
|
2178
|
-
const o = this.squareDistance2D(i, B), a = OA(
|
|
2179
|
-
o / this.sourceMaxSquareDistance2D_,
|
|
2180
|
-
0,
|
|
2181
|
-
1 - Number.EPSILON
|
|
2182
|
-
);
|
|
2183
|
-
i.orderKey = E - A + a, i.state = "queued", this.tIndicesWithQueuedChunks_.add(E), C.push(i);
|
|
2184
|
-
}
|
|
2185
|
-
return C;
|
|
2186
|
-
}
|
|
2187
|
-
isChunkChannelInSlice(A) {
|
|
2188
|
-
return this.sliceCoords_.c === void 0 || this.sliceCoords_.c === A.chunkIndex.c;
|
|
2189
|
-
}
|
|
2190
|
-
shouldDispose(A, I, B, Q, C, E) {
|
|
2191
|
-
return A ? E ? I ? !1 : B ? !Q && !C : !0 : !0 : !1;
|
|
2192
|
-
}
|
|
2193
|
-
disposeChunk(A) {
|
|
2194
|
-
A.data = void 0, A.state = "unloaded", A.priority = null, A.orderKey = null, A.prefetch = !1;
|
|
2195
|
-
}
|
|
2196
|
-
computePriority(A, I, B, Q, C) {
|
|
2197
|
-
if (!C) return null;
|
|
2198
|
-
const E = this.policy_.priorityMap;
|
|
2199
|
-
return A && B ? E.fallbackVisible : I && B ? E.visibleCurrent : A ? E.fallbackBackground : I && Q ? E.prefetchSpace : null;
|
|
2200
|
-
}
|
|
2201
2073
|
validateXYScaleRatios() {
|
|
2202
2074
|
const A = this.dimensions_.x, I = this.dimensions_.y;
|
|
2203
2075
|
for (let B = 1; B < this.dimensions_.numLods; B++) {
|
|
@@ -2214,12 +2086,12 @@ class WQ {
|
|
|
2214
2086
|
if (!I) continue;
|
|
2215
2087
|
if (I.chunkSize !== 1)
|
|
2216
2088
|
throw new Error(
|
|
2217
|
-
`
|
|
2089
|
+
`ChunkStore only supports a chunk size of 1 in t. Found ${I.chunkSize} at LOD ${A}`
|
|
2218
2090
|
);
|
|
2219
2091
|
const B = this.dimensions_.t?.lods[A - 1];
|
|
2220
2092
|
if (B && I.size !== B.size)
|
|
2221
2093
|
throw new Error(
|
|
2222
|
-
`
|
|
2094
|
+
`ChunkStore does not support downsampling in t. Found ${B.size} at LOD ${A - 1} → ${I.size} at LOD ${A}`
|
|
2223
2095
|
);
|
|
2224
2096
|
}
|
|
2225
2097
|
return {
|
|
@@ -2232,26 +2104,183 @@ class WQ {
|
|
|
2232
2104
|
if (!I) continue;
|
|
2233
2105
|
if (I.chunkSize !== 1)
|
|
2234
2106
|
throw new Error(
|
|
2235
|
-
`
|
|
2107
|
+
`ChunkStore only supports a chunk size of 1 in c. Found ${I.chunkSize} at LOD ${A}`
|
|
2236
2108
|
);
|
|
2237
2109
|
if (I.scale !== 1)
|
|
2238
2110
|
throw new Error(
|
|
2239
|
-
`
|
|
2111
|
+
`ChunkStore does not support scale in c. Found ${I.scale} at LOD ${A}`
|
|
2240
2112
|
);
|
|
2241
2113
|
if (I.translation !== 0)
|
|
2242
2114
|
throw new Error(
|
|
2243
|
-
`
|
|
2115
|
+
`ChunkStore does not support translation in c. Found ${I.translation} at LOD ${A}`
|
|
2244
2116
|
);
|
|
2245
2117
|
const B = this.dimensions_.c?.lods[A - 1];
|
|
2246
2118
|
if (B && I.size !== B.size)
|
|
2247
2119
|
throw new Error(
|
|
2248
|
-
`
|
|
2120
|
+
`ChunkStore does not support downsampling in c. Found ${B.size} at LOD ${A - 1} → ${I.size} at LOD ${A}`
|
|
2249
2121
|
);
|
|
2250
2122
|
}
|
|
2251
2123
|
return {
|
|
2252
2124
|
size: this.dimensions_.c?.lods[0].size ?? 1
|
|
2253
2125
|
};
|
|
2254
2126
|
}
|
|
2127
|
+
}
|
|
2128
|
+
function OA(g, A, I) {
|
|
2129
|
+
return Math.max(A, Math.min(I, g));
|
|
2130
|
+
}
|
|
2131
|
+
const nB = Symbol("INTERNAL_POLICY_KEY");
|
|
2132
|
+
class xQ {
|
|
2133
|
+
store_;
|
|
2134
|
+
policy_;
|
|
2135
|
+
policyChanged_ = !1;
|
|
2136
|
+
currentLOD_ = 0;
|
|
2137
|
+
lastViewBounds2D_ = null;
|
|
2138
|
+
lastZBounds_;
|
|
2139
|
+
lastTCoord_;
|
|
2140
|
+
sourceMaxSquareDistance2D_;
|
|
2141
|
+
chunkViewStates_ = /* @__PURE__ */ new Map();
|
|
2142
|
+
constructor(A, I) {
|
|
2143
|
+
this.store_ = A, this.policy_ = I, c.info(
|
|
2144
|
+
"ChunkStoreView",
|
|
2145
|
+
"Using image source policy:",
|
|
2146
|
+
this.policy_.profile
|
|
2147
|
+
);
|
|
2148
|
+
const B = this.store_.dimensions, Q = B.x.lods[0], C = B.y.lods[0];
|
|
2149
|
+
this.sourceMaxSquareDistance2D_ = MQ(
|
|
2150
|
+
u(Q.size * Q.scale, C.size * C.scale)
|
|
2151
|
+
);
|
|
2152
|
+
}
|
|
2153
|
+
get store() {
|
|
2154
|
+
return this.store_;
|
|
2155
|
+
}
|
|
2156
|
+
get chunkViewStates() {
|
|
2157
|
+
return this.chunkViewStates_;
|
|
2158
|
+
}
|
|
2159
|
+
getChunksToRender(A) {
|
|
2160
|
+
const I = this.store_.getTimeIndex(A), B = this.store_.getChunksAtTime(I), Q = B.filter(
|
|
2161
|
+
(i) => i.lod === this.currentLOD_ && this.chunkViewStates_.get(i)?.visible === !0 && i.state === "loaded"
|
|
2162
|
+
), C = this.store_.getLowestResLOD();
|
|
2163
|
+
return this.currentLOD_ === C ? Q : [...B.filter(
|
|
2164
|
+
(i) => i.lod === C && this.chunkViewStates_.get(i)?.visible === !0 && i.state === "loaded"
|
|
2165
|
+
), ...Q];
|
|
2166
|
+
}
|
|
2167
|
+
updateChunkStates(A, I) {
|
|
2168
|
+
const B = I.camera;
|
|
2169
|
+
if (B.type !== "OrthographicCamera")
|
|
2170
|
+
throw new Error(
|
|
2171
|
+
"ChunkStoreView currently supports only orthographic cameras. Update the implementation before using a perspective camera."
|
|
2172
|
+
);
|
|
2173
|
+
const C = B.getWorldViewRect(), E = Math.abs(C.max[0] - C.min[0]), i = I.element, o = I.getBoxRelativeTo(i).toRect().width, a = E / o, D = Math.log2(1 / a);
|
|
2174
|
+
this.setLOD(D);
|
|
2175
|
+
const h = this.getZBounds(A);
|
|
2176
|
+
(this.policyChanged_ || this.viewBounds2DChanged(C) || this.zBoundsChanged(h) || this.lastTCoord_ !== A.t) && (this.updateChunkViewStates(A, C), this.policyChanged_ = !1, this.lastViewBounds2D_ = C.clone(), this.lastZBounds_ = h, this.lastTCoord_ = A.t);
|
|
2177
|
+
}
|
|
2178
|
+
allVisibleLowestLODLoaded(A) {
|
|
2179
|
+
const I = this.store_.getTimeIndex(A), B = this.store_.getChunksAtTime(I).filter((Q) => Q.visible && Q.lod === this.store_.getLowestResLOD());
|
|
2180
|
+
return B.length > 0 && B.every((Q) => Q.state === "loaded");
|
|
2181
|
+
}
|
|
2182
|
+
get currentLOD() {
|
|
2183
|
+
return this.currentLOD_;
|
|
2184
|
+
}
|
|
2185
|
+
maybeForgetChunk(A) {
|
|
2186
|
+
const I = this.chunkViewStates_.get(A);
|
|
2187
|
+
I && (I.visible || I.prefetch || I.priority !== null) || this.chunkViewStates_.delete(A);
|
|
2188
|
+
}
|
|
2189
|
+
setImageSourcePolicy(A, I) {
|
|
2190
|
+
if (I !== nB)
|
|
2191
|
+
throw new Error("Unauthorized policy mutation");
|
|
2192
|
+
this.policy_ !== A && (this.policy_ = A, this.policyChanged_ = !0, c.info(
|
|
2193
|
+
"ChunkStoreView",
|
|
2194
|
+
"Using image source policy:",
|
|
2195
|
+
this.policy_.profile
|
|
2196
|
+
));
|
|
2197
|
+
}
|
|
2198
|
+
setLOD(A) {
|
|
2199
|
+
const B = this.store_.dimensions.x.lods[0].scale, C = this.policy_.lod.bias - Math.log2(B) - A, E = Math.floor(C), i = this.store_.getLowestResLOD(), o = Math.max(
|
|
2200
|
+
0,
|
|
2201
|
+
Math.min(i, this.policy_.lod.min)
|
|
2202
|
+
), a = Math.max(
|
|
2203
|
+
o,
|
|
2204
|
+
Math.min(i, this.policy_.lod.max)
|
|
2205
|
+
), D = OA(E, o, a);
|
|
2206
|
+
D !== this.currentLOD_ && (this.currentLOD_ = D);
|
|
2207
|
+
}
|
|
2208
|
+
updateChunkViewStates(A, I) {
|
|
2209
|
+
const B = this.store_.getTimeIndex(A);
|
|
2210
|
+
if (this.store_.getChunksAtTime(B).length === 0) {
|
|
2211
|
+
c.warn(
|
|
2212
|
+
"ChunkStoreView",
|
|
2213
|
+
"updateChunkViewStates called with no chunks initialized"
|
|
2214
|
+
), this.chunkViewStates_.clear();
|
|
2215
|
+
return;
|
|
2216
|
+
}
|
|
2217
|
+
const C = FB();
|
|
2218
|
+
KQ(C, I.min, I.max, 0.5);
|
|
2219
|
+
const [E, i] = this.getZBounds(A), o = new eA(
|
|
2220
|
+
q(I.min[0], I.min[1], E),
|
|
2221
|
+
q(I.max[0], I.max[1], i)
|
|
2222
|
+
);
|
|
2223
|
+
this.chunkViewStates_.forEach(bQ), this.updateChunksAtTimeIndex(
|
|
2224
|
+
B,
|
|
2225
|
+
A,
|
|
2226
|
+
o,
|
|
2227
|
+
C
|
|
2228
|
+
), A.t !== void 0 && this.markTimeChunksForPrefetch(
|
|
2229
|
+
B,
|
|
2230
|
+
o,
|
|
2231
|
+
C
|
|
2232
|
+
);
|
|
2233
|
+
}
|
|
2234
|
+
isChunkChannelInSlice(A, I) {
|
|
2235
|
+
return I.c === void 0 || I.c === A.chunkIndex.c;
|
|
2236
|
+
}
|
|
2237
|
+
updateChunksAtTimeIndex(A, I, B, Q) {
|
|
2238
|
+
const C = this.getPaddedBounds(B), E = this.store_.getChunksAtTime(A);
|
|
2239
|
+
for (const i of E) {
|
|
2240
|
+
const o = this.isChunkWithinBounds(i, B), a = this.isChunkChannelInSlice(i, I), D = i.lod === this.currentLOD_, h = i.lod === this.store_.getLowestResLOD(), y = !o && a && D && this.isChunkWithinBounds(i, C), G = o && a, S = this.computePriority(
|
|
2241
|
+
h,
|
|
2242
|
+
D,
|
|
2243
|
+
o,
|
|
2244
|
+
y,
|
|
2245
|
+
a
|
|
2246
|
+
);
|
|
2247
|
+
if (S !== null) {
|
|
2248
|
+
const R = this.squareDistance2D(i, Q);
|
|
2249
|
+
this.chunkViewStates_.set(i, {
|
|
2250
|
+
visible: G,
|
|
2251
|
+
prefetch: y,
|
|
2252
|
+
priority: S,
|
|
2253
|
+
orderKey: R
|
|
2254
|
+
});
|
|
2255
|
+
}
|
|
2256
|
+
}
|
|
2257
|
+
}
|
|
2258
|
+
markTimeChunksForPrefetch(A, I, B) {
|
|
2259
|
+
const Q = this.store_.dimensions.t?.lods[0].size ?? 1, C = Math.min(
|
|
2260
|
+
Q - 1,
|
|
2261
|
+
A + this.policy_.prefetch.t
|
|
2262
|
+
);
|
|
2263
|
+
for (let E = A + 1; E <= C; ++E)
|
|
2264
|
+
for (const i of this.store_.getChunksAtTime(E)) {
|
|
2265
|
+
if (i.lod !== this.store_.getLowestResLOD() || !this.isChunkWithinBounds(i, I)) continue;
|
|
2266
|
+
const o = this.policy_.priorityMap.prefetchTime, a = this.squareDistance2D(i, B), D = OA(
|
|
2267
|
+
a / this.sourceMaxSquareDistance2D_,
|
|
2268
|
+
0,
|
|
2269
|
+
1 - Number.EPSILON
|
|
2270
|
+
), h = E - A + D;
|
|
2271
|
+
this.chunkViewStates_.set(i, {
|
|
2272
|
+
visible: !1,
|
|
2273
|
+
prefetch: !0,
|
|
2274
|
+
priority: o,
|
|
2275
|
+
orderKey: h
|
|
2276
|
+
});
|
|
2277
|
+
}
|
|
2278
|
+
}
|
|
2279
|
+
computePriority(A, I, B, Q, C) {
|
|
2280
|
+
if (!C) return null;
|
|
2281
|
+
const E = this.policy_.priorityMap;
|
|
2282
|
+
return A && B ? E.fallbackVisible : I && B ? E.visibleCurrent : A ? E.fallbackBackground : I && Q ? E.prefetchSpace : null;
|
|
2283
|
+
}
|
|
2255
2284
|
isChunkWithinBounds(A, I) {
|
|
2256
2285
|
const B = new eA(
|
|
2257
2286
|
q(A.offset.x, A.offset.y, A.offset.z),
|
|
@@ -2263,19 +2292,19 @@ class WQ {
|
|
|
2263
2292
|
);
|
|
2264
2293
|
return eA.intersects(B, I);
|
|
2265
2294
|
}
|
|
2266
|
-
getZBounds() {
|
|
2267
|
-
const
|
|
2268
|
-
if (
|
|
2269
|
-
const
|
|
2295
|
+
getZBounds(A) {
|
|
2296
|
+
const I = this.store_.dimensions.z;
|
|
2297
|
+
if (I === void 0 || A.z === void 0) return [0, 1];
|
|
2298
|
+
const B = I.lods[this.currentLOD_], Q = B.size, C = B.scale, E = B.translation, i = Math.floor((A.z - E) / C), o = B.chunkSize, a = Math.max(
|
|
2270
2299
|
0,
|
|
2271
2300
|
Math.min(
|
|
2272
|
-
Math.floor(
|
|
2273
|
-
Math.ceil(
|
|
2301
|
+
Math.floor(i / o),
|
|
2302
|
+
Math.ceil(Q / o) - 1
|
|
2274
2303
|
)
|
|
2275
2304
|
);
|
|
2276
2305
|
return [
|
|
2277
|
-
|
|
2278
|
-
|
|
2306
|
+
E + a * o * C,
|
|
2307
|
+
E + (a + 1) * o * C
|
|
2279
2308
|
];
|
|
2280
2309
|
}
|
|
2281
2310
|
viewBounds2DChanged(A) {
|
|
@@ -2285,18 +2314,18 @@ class WQ {
|
|
|
2285
2314
|
return !this.lastZBounds_ || !xI(this.lastZBounds_, A);
|
|
2286
2315
|
}
|
|
2287
2316
|
getPaddedBounds(A) {
|
|
2288
|
-
const I = this.
|
|
2289
|
-
let
|
|
2290
|
-
return
|
|
2317
|
+
const I = this.store_.dimensions, B = I.x.lods[this.currentLOD_], Q = I.y.lods[this.currentLOD_], C = I.z?.lods[this.currentLOD_], E = B.chunkSize * B.scale * this.policy_.prefetch.x, i = Q.chunkSize * Q.scale * this.policy_.prefetch.y;
|
|
2318
|
+
let o = 0;
|
|
2319
|
+
return C && (o = C.chunkSize * C.scale * this.policy_.prefetch.z), new eA(
|
|
2291
2320
|
q(
|
|
2292
|
-
A.min[0] -
|
|
2293
|
-
A.min[1] -
|
|
2294
|
-
A.min[2] -
|
|
2321
|
+
A.min[0] - E,
|
|
2322
|
+
A.min[1] - i,
|
|
2323
|
+
A.min[2] - o
|
|
2295
2324
|
),
|
|
2296
2325
|
q(
|
|
2297
|
-
A.max[0] +
|
|
2298
|
-
A.max[1] +
|
|
2299
|
-
A.max[2] +
|
|
2326
|
+
A.max[0] + E,
|
|
2327
|
+
A.max[1] + i,
|
|
2328
|
+
A.max[2] + o
|
|
2300
2329
|
)
|
|
2301
2330
|
);
|
|
2302
2331
|
}
|
|
@@ -2308,44 +2337,92 @@ class WQ {
|
|
|
2308
2337
|
return Q * Q + C * C;
|
|
2309
2338
|
}
|
|
2310
2339
|
}
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2340
|
+
function bQ(g) {
|
|
2341
|
+
g.visible = !1, g.prefetch = !1, g.priority = null, g.orderKey = null;
|
|
2342
|
+
}
|
|
2343
|
+
class ZQ {
|
|
2344
|
+
stores_ = /* @__PURE__ */ new Map();
|
|
2345
|
+
pendingStores_ = /* @__PURE__ */ new Map();
|
|
2346
|
+
views_ = /* @__PURE__ */ new Map();
|
|
2314
2347
|
queue_ = new uQ();
|
|
2315
|
-
async
|
|
2316
|
-
const
|
|
2317
|
-
|
|
2318
|
-
return Q;
|
|
2319
|
-
const E = (async () => {
|
|
2320
|
-
const i = await A.open(), o = new WQ(
|
|
2321
|
-
i,
|
|
2322
|
-
I,
|
|
2323
|
-
B
|
|
2324
|
-
);
|
|
2325
|
-
return this.sources_.set(A, o), this.pendingSources_.delete(A), o;
|
|
2326
|
-
})();
|
|
2327
|
-
return this.pendingSources_.set(A, E), E;
|
|
2348
|
+
async addView(A, I) {
|
|
2349
|
+
const B = await this.addSource(A), Q = new xQ(B, I);
|
|
2350
|
+
return this.views_.set(B, (this.views_.get(B) ?? []).concat(Q)), Q;
|
|
2328
2351
|
}
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
if (
|
|
2352
|
+
removeView(A) {
|
|
2353
|
+
const I = A.store, B = this.getSourceForStore(I), Q = this.views_.get(I);
|
|
2354
|
+
if (!Q)
|
|
2355
|
+
throw new Error("Cannot remove view: store not managed by ChunkManager");
|
|
2356
|
+
const C = Q.indexOf(A);
|
|
2357
|
+
if (C === -1)
|
|
2332
2358
|
throw new Error(
|
|
2333
|
-
|
|
2359
|
+
`Cannot remove view: view not found in store's view list (source: ${B})`
|
|
2334
2360
|
);
|
|
2335
|
-
const
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2361
|
+
const E = Array.from(A.chunkViewStates.keys());
|
|
2362
|
+
Q.splice(C, 1);
|
|
2363
|
+
for (const i of E)
|
|
2364
|
+
this.aggregateChunkViewStates(i, I);
|
|
2365
|
+
Q.length === 0 && (this.stores_.delete(B), this.views_.delete(I));
|
|
2366
|
+
}
|
|
2367
|
+
async addSource(A) {
|
|
2368
|
+
const I = this.stores_.get(A) ?? this.pendingStores_.get(A);
|
|
2369
|
+
if (I)
|
|
2370
|
+
return I;
|
|
2371
|
+
const Q = (async () => {
|
|
2372
|
+
const C = await A.open(), E = new WQ(C);
|
|
2373
|
+
return this.stores_.set(A, E), this.pendingStores_.delete(A), E;
|
|
2374
|
+
})();
|
|
2375
|
+
return this.pendingStores_.set(A, Q), Q;
|
|
2376
|
+
}
|
|
2377
|
+
getSourceForStore(A) {
|
|
2378
|
+
for (const [I, B] of this.stores_)
|
|
2379
|
+
if (B === A)
|
|
2380
|
+
return I;
|
|
2381
|
+
throw new Error("Source not found for the given store.");
|
|
2382
|
+
}
|
|
2383
|
+
update() {
|
|
2384
|
+
for (const [A, I] of this.stores_) {
|
|
2385
|
+
const B = this.updateAndCollectChunkChanges(I);
|
|
2386
|
+
for (const Q of B)
|
|
2387
|
+
Q.priority === null ? this.queue_.cancel(Q) : Q.state === "queued" && this.queue_.enqueue(
|
|
2388
|
+
Q,
|
|
2389
|
+
(C) => I.loadChunkData(Q, C)
|
|
2345
2390
|
);
|
|
2346
2391
|
}
|
|
2347
2392
|
this.queue_.flush();
|
|
2348
2393
|
}
|
|
2394
|
+
updateAndCollectChunkChanges(A) {
|
|
2395
|
+
const I = this.views_.get(A);
|
|
2396
|
+
if (!I) return /* @__PURE__ */ new Set();
|
|
2397
|
+
const B = /* @__PURE__ */ new Set();
|
|
2398
|
+
for (const Q of I)
|
|
2399
|
+
for (const [C, E] of Q.chunkViewStates)
|
|
2400
|
+
B.add(C);
|
|
2401
|
+
for (const Q of B)
|
|
2402
|
+
this.aggregateChunkViewStates(Q, A);
|
|
2403
|
+
return B;
|
|
2404
|
+
}
|
|
2405
|
+
aggregateChunkViewStates(A, I) {
|
|
2406
|
+
const B = this.views_.get(I);
|
|
2407
|
+
if (!B) return;
|
|
2408
|
+
let Q = !1, C = !1, E = null, i = null;
|
|
2409
|
+
for (const h of B) {
|
|
2410
|
+
const y = h.chunkViewStates.get(A);
|
|
2411
|
+
y && (y.visible && (Q = !0), y.prefetch && (C = !0), y.priority !== null && (E === null || y.priority < E) && (E = y.priority, i = y.orderKey), !y.visible && !y.prefetch && y.priority === null && h.maybeForgetChunk(A));
|
|
2412
|
+
}
|
|
2413
|
+
if (A.visible = Q, A.prefetch = C, A.priority = E, A.orderKey = i, A.priority !== null && A.state === "unloaded") {
|
|
2414
|
+
A.state = "queued";
|
|
2415
|
+
return;
|
|
2416
|
+
}
|
|
2417
|
+
if (A.priority === null && A.state === "queued") {
|
|
2418
|
+
A.state = "unloaded";
|
|
2419
|
+
return;
|
|
2420
|
+
}
|
|
2421
|
+
A.state === "loaded" && !A.visible && !A.prefetch && (A.data = void 0, A.state = "unloaded", A.priority = null, A.orderKey = null, A.prefetch = !1, c.debug(
|
|
2422
|
+
"ChunkManager",
|
|
2423
|
+
`Disposing chunk ${JSON.stringify(A.chunkIndex)} in LOD ${A.lod}`
|
|
2424
|
+
));
|
|
2425
|
+
}
|
|
2349
2426
|
}
|
|
2350
2427
|
var ZA = function(g = 1) {
|
|
2351
2428
|
var A = 0, I = document.createElement("div");
|
|
@@ -2389,24 +2466,24 @@ var ZA = function(g = 1) {
|
|
|
2389
2466
|
};
|
|
2390
2467
|
};
|
|
2391
2468
|
ZA.Panel = function(g, A, I, B) {
|
|
2392
|
-
var Q = 1 / 0, C = 0, E = Math.round, i = E(window.devicePixelRatio || 1), o = E(80 * i * B), a = E(48 * i * B), D = E(3 * i * B), h = E(2 * i * B), y = E(3 * i * B), G = E(15 * i * B),
|
|
2469
|
+
var Q = 1 / 0, C = 0, E = Math.round, i = E(window.devicePixelRatio || 1), o = E(80 * i * B), a = E(48 * i * B), D = E(3 * i * B), h = E(2 * i * B), y = E(3 * i * B), G = E(15 * i * B), S = E(74 * i * B), R = E(30 * i * B), e = document.createElement("canvas");
|
|
2393
2470
|
e.width = o, e.height = a, e.style.cssText = `width:${E(B * 80)}px;height:${E(B * 48)}px`;
|
|
2394
|
-
var
|
|
2395
|
-
return
|
|
2471
|
+
var F = e.getContext("2d");
|
|
2472
|
+
return F.font = "bold " + E(9 * i * B) + "px Helvetica,Arial,sans-serif", F.textBaseline = "top", F.fillStyle = I, F.fillRect(0, 0, o, a), F.fillStyle = A, F.fillText(g, D, h), F.fillRect(y, G, S, R), F.fillStyle = I, F.globalAlpha = 0.9, F.fillRect(y, G, S, R), {
|
|
2396
2473
|
dom: e,
|
|
2397
|
-
update: function(M,
|
|
2398
|
-
Q = Math.min(Q, M), C = Math.max(C, M),
|
|
2474
|
+
update: function(M, N) {
|
|
2475
|
+
Q = Math.min(Q, M), C = Math.max(C, M), F.fillStyle = I, F.globalAlpha = 1, F.fillRect(0, 0, o, G), F.fillStyle = A, F.fillText(E(M) + " " + g + " (" + E(Q) + "-" + E(C) + ")", D, h), F.drawImage(e, y + i, G, S - i, R, y, G, S - i, R), F.fillRect(y + S - i, G, i, R), F.fillStyle = I, F.globalAlpha = 0.9, F.fillRect(y + S - i, G, i, E((1 - M / N) * R));
|
|
2399
2476
|
}
|
|
2400
2477
|
};
|
|
2401
2478
|
};
|
|
2402
|
-
function
|
|
2479
|
+
function PQ({ scale: g } = { scale: 1.5 }) {
|
|
2403
2480
|
const A = new ZA(g);
|
|
2404
2481
|
return A.showPanel(
|
|
2405
2482
|
0
|
|
2406
2483
|
/* 0 = fps, 1 = ms, 2 = mb */
|
|
2407
2484
|
), document.body.appendChild(A.dom), A;
|
|
2408
2485
|
}
|
|
2409
|
-
class
|
|
2486
|
+
class OQ {
|
|
2410
2487
|
layers_ = [];
|
|
2411
2488
|
callbacks_ = [];
|
|
2412
2489
|
context_;
|
|
@@ -2420,7 +2497,7 @@ class ZQ {
|
|
|
2420
2497
|
return { opaque: A, transparent: I };
|
|
2421
2498
|
}
|
|
2422
2499
|
add(A) {
|
|
2423
|
-
this.layers_ = [...this.layers_, A],
|
|
2500
|
+
this.layers_ = [...this.layers_, A], A.onAttached(this.context_), this.notifyLayersChanged();
|
|
2424
2501
|
}
|
|
2425
2502
|
remove(A) {
|
|
2426
2503
|
const I = this.layers_.indexOf(A);
|
|
@@ -2430,11 +2507,11 @@ class ZQ {
|
|
|
2430
2507
|
}
|
|
2431
2508
|
removeByIndex(A) {
|
|
2432
2509
|
const I = this.layers_[A];
|
|
2433
|
-
I && I.onDetached(), this.layers_ = this.layers_.filter((B, Q) => Q !== A), this.notifyLayersChanged();
|
|
2510
|
+
I && I.onDetached(this.context_), this.layers_ = this.layers_.filter((B, Q) => Q !== A), this.notifyLayersChanged();
|
|
2434
2511
|
}
|
|
2435
2512
|
removeAll() {
|
|
2436
2513
|
for (const A of this.layers_)
|
|
2437
|
-
A.onDetached();
|
|
2514
|
+
A.onDetached(this.context_);
|
|
2438
2515
|
this.layers_ = [], this.notifyLayersChanged();
|
|
2439
2516
|
}
|
|
2440
2517
|
get layers() {
|
|
@@ -2463,10 +2540,10 @@ const zI = [
|
|
|
2463
2540
|
"pointercancel",
|
|
2464
2541
|
"wheel"
|
|
2465
2542
|
];
|
|
2466
|
-
function
|
|
2543
|
+
function VQ(g) {
|
|
2467
2544
|
return zI.includes(g);
|
|
2468
2545
|
}
|
|
2469
|
-
class
|
|
2546
|
+
class vQ {
|
|
2470
2547
|
propagationStopped_ = !1;
|
|
2471
2548
|
type;
|
|
2472
2549
|
event;
|
|
@@ -2482,7 +2559,7 @@ class OQ {
|
|
|
2482
2559
|
this.propagationStopped_ = !0;
|
|
2483
2560
|
}
|
|
2484
2561
|
}
|
|
2485
|
-
class
|
|
2562
|
+
class XQ {
|
|
2486
2563
|
listeners_ = [];
|
|
2487
2564
|
element_;
|
|
2488
2565
|
isConnected_ = !1;
|
|
@@ -2494,7 +2571,7 @@ class VQ {
|
|
|
2494
2571
|
}
|
|
2495
2572
|
connect() {
|
|
2496
2573
|
if (this.isConnected_) {
|
|
2497
|
-
|
|
2574
|
+
c.warn(
|
|
2498
2575
|
"EventDispatcher",
|
|
2499
2576
|
"Attempted to connect already connected event dispatcher",
|
|
2500
2577
|
`element id: ${this.element_.id}`
|
|
@@ -2509,7 +2586,7 @@ class VQ {
|
|
|
2509
2586
|
}
|
|
2510
2587
|
disconnect() {
|
|
2511
2588
|
if (!this.isConnected_) {
|
|
2512
|
-
|
|
2589
|
+
c.debug(
|
|
2513
2590
|
"EventDispatcher",
|
|
2514
2591
|
"Attempted to disconnect already disconnected event dispatcher",
|
|
2515
2592
|
`element id: ${this.element_.id}`
|
|
@@ -2521,16 +2598,16 @@ class VQ {
|
|
|
2521
2598
|
});
|
|
2522
2599
|
}
|
|
2523
2600
|
handleEvent = (A) => {
|
|
2524
|
-
if (!
|
|
2525
|
-
|
|
2601
|
+
if (!VQ(A.type)) {
|
|
2602
|
+
c.error("EventDispatcher", `Unsupported event type ${A.type}`);
|
|
2526
2603
|
return;
|
|
2527
2604
|
}
|
|
2528
|
-
const I = new
|
|
2605
|
+
const I = new vQ(A.type, A);
|
|
2529
2606
|
for (const B of this.listeners_)
|
|
2530
2607
|
if (B(I), I.propagationStopped) break;
|
|
2531
2608
|
};
|
|
2532
2609
|
}
|
|
2533
|
-
class
|
|
2610
|
+
class jQ {
|
|
2534
2611
|
id;
|
|
2535
2612
|
element;
|
|
2536
2613
|
camera;
|
|
@@ -2538,9 +2615,9 @@ class vQ {
|
|
|
2538
2615
|
events;
|
|
2539
2616
|
cameraControls;
|
|
2540
2617
|
constructor(A) {
|
|
2541
|
-
this.id = A.id, this.element = A.element, this.camera = A.camera, this.layerManager = A.layerManager, this.cameraControls = A.cameraControls, this.updateAspectRatio(), this.events = new
|
|
2618
|
+
this.id = A.id, this.element = A.element, this.camera = A.camera, this.layerManager = A.layerManager, this.cameraControls = A.cameraControls, this.updateAspectRatio(), this.events = new XQ(this.element), this.events.addEventListener((I) => {
|
|
2542
2619
|
if (I.event instanceof PointerEvent || I.event instanceof WheelEvent) {
|
|
2543
|
-
const { clientX: B, clientY: Q } = I.event, C =
|
|
2620
|
+
const { clientX: B, clientY: Q } = I.event, C = u(B, Q);
|
|
2544
2621
|
I.clipPos = this.clientToClip(C, 0), I.worldPos = this.camera.clipToWorld(I.clipPos);
|
|
2545
2622
|
}
|
|
2546
2623
|
for (const B of this.layerManager.layers)
|
|
@@ -2556,8 +2633,8 @@ class vQ {
|
|
|
2556
2633
|
getBoxRelativeTo(A) {
|
|
2557
2634
|
const I = this.getBox().toRect(), B = A.getBoundingClientRect(), Q = window.devicePixelRatio || 1, C = B.left * Q, E = B.top * Q, i = B.height * Q, o = I.x - C, a = I.y - E, D = Math.floor(o), h = Math.floor(i - a - I.height), y = Math.floor(I.width), G = Math.floor(I.height);
|
|
2558
2635
|
return new j(
|
|
2559
|
-
|
|
2560
|
-
|
|
2636
|
+
u(D, h),
|
|
2637
|
+
u(D + y, h + G)
|
|
2561
2638
|
);
|
|
2562
2639
|
}
|
|
2563
2640
|
clientToClip(A, I = 0) {
|
|
@@ -2575,14 +2652,14 @@ class vQ {
|
|
|
2575
2652
|
getBox() {
|
|
2576
2653
|
const A = this.element.getBoundingClientRect(), I = window.devicePixelRatio || 1, B = A.left * I, Q = A.top * I, C = A.width * I, E = A.height * I;
|
|
2577
2654
|
return new j(
|
|
2578
|
-
|
|
2579
|
-
|
|
2655
|
+
u(B, Q),
|
|
2656
|
+
u(B + C, Q + E)
|
|
2580
2657
|
);
|
|
2581
2658
|
}
|
|
2582
2659
|
updateAspectRatio() {
|
|
2583
2660
|
const { width: A, height: I } = this.getBox().toRect();
|
|
2584
2661
|
if (A <= 0 || I <= 0) {
|
|
2585
|
-
|
|
2662
|
+
c.debug(
|
|
2586
2663
|
"Viewport",
|
|
2587
2664
|
`Skipping aspect ratio update for viewport ${this.id}: invalid dimensions ${A}x${I}`
|
|
2588
2665
|
);
|
|
@@ -2592,7 +2669,7 @@ class vQ {
|
|
|
2592
2669
|
this.camera.setAspectRatio(B);
|
|
2593
2670
|
}
|
|
2594
2671
|
}
|
|
2595
|
-
function
|
|
2672
|
+
function zQ(g) {
|
|
2596
2673
|
const A = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new Set();
|
|
2597
2674
|
for (const B of g) {
|
|
2598
2675
|
if (I.has(B.id))
|
|
@@ -2608,19 +2685,19 @@ function XQ(g) {
|
|
|
2608
2685
|
A.set(B.element, B.id);
|
|
2609
2686
|
}
|
|
2610
2687
|
}
|
|
2611
|
-
function
|
|
2688
|
+
function _Q(g, A, I) {
|
|
2612
2689
|
const B = g.map((Q) => {
|
|
2613
2690
|
const C = Q.element ?? A;
|
|
2614
2691
|
return {
|
|
2615
2692
|
...Q,
|
|
2616
2693
|
element: C,
|
|
2617
2694
|
id: Q.id ?? C.id ?? DB(),
|
|
2618
|
-
layerManager: new
|
|
2695
|
+
layerManager: new OQ(I)
|
|
2619
2696
|
};
|
|
2620
2697
|
});
|
|
2621
|
-
return
|
|
2698
|
+
return zQ(B), B.map((Q) => new jQ(Q));
|
|
2622
2699
|
}
|
|
2623
|
-
class
|
|
2700
|
+
class $Q {
|
|
2624
2701
|
elements_;
|
|
2625
2702
|
resizeObserver_;
|
|
2626
2703
|
mediaQuery_;
|
|
@@ -2631,7 +2708,7 @@ class zQ {
|
|
|
2631
2708
|
}
|
|
2632
2709
|
connect() {
|
|
2633
2710
|
if (this.resizeObserver_) {
|
|
2634
|
-
|
|
2711
|
+
c.warn(
|
|
2635
2712
|
"PixelSizeObserver",
|
|
2636
2713
|
"Attempted to connect already connected observer"
|
|
2637
2714
|
);
|
|
@@ -2659,7 +2736,7 @@ class zQ {
|
|
|
2659
2736
|
}
|
|
2660
2737
|
disconnect() {
|
|
2661
2738
|
if (!this.resizeObserver_) {
|
|
2662
|
-
|
|
2739
|
+
c.warn(
|
|
2663
2740
|
"PixelSizeObserver",
|
|
2664
2741
|
"Attempted to disconnect already disconnected observer"
|
|
2665
2742
|
);
|
|
@@ -2668,7 +2745,7 @@ class zQ {
|
|
|
2668
2745
|
this.resizeObserver_?.disconnect(), this.mediaQuery_ && this.onMediaQueryChange_ && this.mediaQuery_.removeEventListener("change", this.onMediaQueryChange_);
|
|
2669
2746
|
}
|
|
2670
2747
|
}
|
|
2671
|
-
class
|
|
2748
|
+
class ao {
|
|
2672
2749
|
lastAnimationId_;
|
|
2673
2750
|
chunkManager_;
|
|
2674
2751
|
context_;
|
|
@@ -2729,17 +2806,17 @@ class io {
|
|
|
2729
2806
|
constructor(A) {
|
|
2730
2807
|
if (this.canvas = A.canvas, A.viewports.length === 0)
|
|
2731
2808
|
throw new Error("At least one viewport config must be specified.");
|
|
2732
|
-
this.renderer_ = new pQ(this.canvas), this.chunkManager_ = new
|
|
2809
|
+
this.renderer_ = new pQ(this.canvas), this.chunkManager_ = new ZQ(), this.context_ = {
|
|
2733
2810
|
chunkManager: this.chunkManager_
|
|
2734
|
-
}, this.viewports_ =
|
|
2811
|
+
}, this.viewports_ = _Q(
|
|
2735
2812
|
A.viewports,
|
|
2736
2813
|
this.canvas,
|
|
2737
2814
|
this.context_
|
|
2738
|
-
), this.overlays = A.overlays ?? [], A.showStats && (this.stats_ =
|
|
2815
|
+
), this.overlays = A.overlays ?? [], A.showStats && (this.stats_ = PQ());
|
|
2739
2816
|
const I = [this.canvas];
|
|
2740
2817
|
for (const B of this.viewports_)
|
|
2741
2818
|
B.element !== this.canvas && I.push(B.element);
|
|
2742
|
-
this.sizeObserver_ = new
|
|
2819
|
+
this.sizeObserver_ = new $Q(I);
|
|
2743
2820
|
}
|
|
2744
2821
|
get renderedObjects() {
|
|
2745
2822
|
return this.renderer_.renderedObjects;
|
|
@@ -2760,21 +2837,19 @@ class io {
|
|
|
2760
2837
|
return this.viewports_.find((I) => I.id === A);
|
|
2761
2838
|
}
|
|
2762
2839
|
start() {
|
|
2763
|
-
if (
|
|
2840
|
+
if (c.info("Idetik", "Idetik runtime starting"), this.lastAnimationId_ === void 0) {
|
|
2764
2841
|
for (const A of this.viewports_)
|
|
2765
2842
|
A.events.connect();
|
|
2766
2843
|
this.sizeObserver_.connect(), this.animate();
|
|
2767
2844
|
} else
|
|
2768
|
-
|
|
2845
|
+
c.warn("Idetik", "Idetik runtime already started");
|
|
2769
2846
|
return this;
|
|
2770
2847
|
}
|
|
2771
2848
|
animate(A) {
|
|
2772
2849
|
this.stats_ && this.stats_.begin(), this.sizeObserver_.getAndResetChanged() && this.updateSize();
|
|
2773
2850
|
for (const I of this.viewports_)
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
I.getBoxRelativeTo(this.canvas).toRect().width
|
|
2777
|
-
), this.renderer_.render(I);
|
|
2851
|
+
this.renderer_.render(I);
|
|
2852
|
+
this.chunkManager_.update();
|
|
2778
2853
|
for (const I of this.overlays)
|
|
2779
2854
|
I.update(this, A);
|
|
2780
2855
|
this.stats_ && this.stats_.end(), this.lastAnimationId_ = requestAnimationFrame(
|
|
@@ -2782,8 +2857,8 @@ class io {
|
|
|
2782
2857
|
);
|
|
2783
2858
|
}
|
|
2784
2859
|
stop() {
|
|
2785
|
-
if (
|
|
2786
|
-
|
|
2860
|
+
if (c.info("Idetik", "Idetik runtime stopping"), this.lastAnimationId_ === void 0)
|
|
2861
|
+
c.warn("Idetik", "Idetik runtime not started");
|
|
2787
2862
|
else {
|
|
2788
2863
|
this.sizeObserver_.disconnect();
|
|
2789
2864
|
for (const A of this.viewports_)
|
|
@@ -2797,14 +2872,14 @@ class io {
|
|
|
2797
2872
|
A.updateSize();
|
|
2798
2873
|
}
|
|
2799
2874
|
}
|
|
2800
|
-
class
|
|
2875
|
+
class AC extends pA {
|
|
2801
2876
|
constructor(A) {
|
|
2802
2877
|
if (super(), A.primitive != "triangles") {
|
|
2803
|
-
|
|
2878
|
+
c.warn("WireframeGeometry", "Only indexed geometries are supported");
|
|
2804
2879
|
return;
|
|
2805
2880
|
}
|
|
2806
2881
|
if (A.indexData.length == 0) {
|
|
2807
|
-
|
|
2882
|
+
c.warn(
|
|
2808
2883
|
"WireframeGeometry",
|
|
2809
2884
|
"Only triangulated geometries are supported"
|
|
2810
2885
|
);
|
|
@@ -2822,8 +2897,8 @@ class _Q extends pA {
|
|
|
2822
2897
|
this.indexData_ = new Uint32Array(B);
|
|
2823
2898
|
}
|
|
2824
2899
|
}
|
|
2825
|
-
const
|
|
2826
|
-
class
|
|
2900
|
+
const IC = q(0, 1, 0);
|
|
2901
|
+
class gC {
|
|
2827
2902
|
dirty_ = !0;
|
|
2828
2903
|
matrix_ = AA();
|
|
2829
2904
|
rotation_ = XI();
|
|
@@ -2855,7 +2930,7 @@ class AC {
|
|
|
2855
2930
|
}
|
|
2856
2931
|
targetTo(A) {
|
|
2857
2932
|
eQ(this.translation_, A) && (A = IA(A), A[2] += rA);
|
|
2858
|
-
const I = tQ(AA(), this.translation_, A,
|
|
2933
|
+
const I = tQ(AA(), this.translation_, A, IC), B = iQ(sB(), I);
|
|
2859
2934
|
wB(this.rotation_, B), og(this.rotation_, this.rotation_), this.dirty_ = !0;
|
|
2860
2935
|
}
|
|
2861
2936
|
get scale() {
|
|
@@ -2881,10 +2956,11 @@ class mA extends Eg {
|
|
|
2881
2956
|
wireframeColor = l.WHITE;
|
|
2882
2957
|
textures_ = [];
|
|
2883
2958
|
staleTextures_ = [];
|
|
2884
|
-
transform_ = new
|
|
2959
|
+
transform_ = new gC();
|
|
2885
2960
|
geometry_ = new pA();
|
|
2886
2961
|
wireframeGeometry_ = null;
|
|
2887
2962
|
programName_ = null;
|
|
2963
|
+
cullFaceMode_ = "none";
|
|
2888
2964
|
setTexture(A, I) {
|
|
2889
2965
|
const B = this.textures_[A];
|
|
2890
2966
|
B !== void 0 && this.staleTextures_.push(B), this.textures_[A] = I;
|
|
@@ -2897,7 +2973,7 @@ class mA extends Eg {
|
|
|
2897
2973
|
return this.geometry_;
|
|
2898
2974
|
}
|
|
2899
2975
|
get wireframeGeometry() {
|
|
2900
|
-
return this.wireframeGeometry_ ??= new
|
|
2976
|
+
return this.wireframeGeometry_ ??= new AC(this.geometry), this.wireframeGeometry_;
|
|
2901
2977
|
}
|
|
2902
2978
|
get textures() {
|
|
2903
2979
|
return this.textures_;
|
|
@@ -2920,6 +2996,12 @@ class mA extends Eg {
|
|
|
2920
2996
|
set programName(A) {
|
|
2921
2997
|
this.programName_ = A;
|
|
2922
2998
|
}
|
|
2999
|
+
get cullFaceMode() {
|
|
3000
|
+
return this.cullFaceMode_;
|
|
3001
|
+
}
|
|
3002
|
+
set cullFaceMode(A) {
|
|
3003
|
+
this.cullFaceMode_ = A;
|
|
3004
|
+
}
|
|
2923
3005
|
/**
|
|
2924
3006
|
* Get uniforms for shader program. Override in derived classes that need custom uniforms.
|
|
2925
3007
|
* @returns Object containing uniform name-value pairs
|
|
@@ -2948,7 +3030,7 @@ class JA {
|
|
|
2948
3030
|
}
|
|
2949
3031
|
}
|
|
2950
3032
|
}
|
|
2951
|
-
class
|
|
3033
|
+
class BC {
|
|
2952
3034
|
planes_;
|
|
2953
3035
|
constructor(A) {
|
|
2954
3036
|
this.planes_ = [
|
|
@@ -3016,7 +3098,7 @@ class eB extends mA {
|
|
|
3016
3098
|
return q(A[4], A[5], A[6]);
|
|
3017
3099
|
}
|
|
3018
3100
|
get frustum() {
|
|
3019
|
-
return new
|
|
3101
|
+
return new BC(
|
|
3020
3102
|
FI(AA(), this.projectionMatrix, this.viewMatrix)
|
|
3021
3103
|
);
|
|
3022
3104
|
}
|
|
@@ -3045,7 +3127,7 @@ class eB extends mA {
|
|
|
3045
3127
|
}
|
|
3046
3128
|
}
|
|
3047
3129
|
const rB = 1.77, mg = 128, ug = 128 / rB;
|
|
3048
|
-
class
|
|
3130
|
+
class Do extends eB {
|
|
3049
3131
|
// width_ and height_ should always be defined by constructor (see setFrame)
|
|
3050
3132
|
width_ = mg;
|
|
3051
3133
|
height_ = ug;
|
|
@@ -3082,8 +3164,8 @@ class oo extends eB {
|
|
|
3082
3164
|
this.viewMatrix
|
|
3083
3165
|
), Q = ig(AA(), B);
|
|
3084
3166
|
return A = nI(PA(), A, Q), I = nI(PA(), I, Q), new j(
|
|
3085
|
-
|
|
3086
|
-
|
|
3167
|
+
u(A[0], A[1]),
|
|
3168
|
+
u(I[0], I[1])
|
|
3087
3169
|
);
|
|
3088
3170
|
}
|
|
3089
3171
|
updateProjectionMatrix() {
|
|
@@ -3100,14 +3182,14 @@ class oo extends eB {
|
|
|
3100
3182
|
);
|
|
3101
3183
|
}
|
|
3102
3184
|
}
|
|
3103
|
-
const
|
|
3104
|
-
class
|
|
3185
|
+
const QC = 60, CC = 1.77, tI = 0.1, bI = 180 - tI;
|
|
3186
|
+
class so extends eB {
|
|
3105
3187
|
fov_;
|
|
3106
3188
|
aspectRatio_;
|
|
3107
3189
|
constructor(A = {}) {
|
|
3108
3190
|
const {
|
|
3109
|
-
fov: I =
|
|
3110
|
-
aspectRatio: B =
|
|
3191
|
+
fov: I = QC,
|
|
3192
|
+
aspectRatio: B = CC,
|
|
3111
3193
|
near: Q = 0.1,
|
|
3112
3194
|
far: C = 1e4,
|
|
3113
3195
|
position: E = q(0, 0, 0)
|
|
@@ -3143,7 +3225,7 @@ class ao extends eB {
|
|
|
3143
3225
|
}
|
|
3144
3226
|
}
|
|
3145
3227
|
const Tg = 0;
|
|
3146
|
-
class
|
|
3228
|
+
class ho {
|
|
3147
3229
|
camera_;
|
|
3148
3230
|
dragActive_ = !1;
|
|
3149
3231
|
dragStart_ = p();
|
|
@@ -3202,7 +3284,7 @@ class GA {
|
|
|
3202
3284
|
opacity: I = 1,
|
|
3203
3285
|
blendMode: B = "normal"
|
|
3204
3286
|
} = {}) {
|
|
3205
|
-
(I < 0 || I > 1) &&
|
|
3287
|
+
(I < 0 || I > 1) && c.warn(
|
|
3206
3288
|
"Layer",
|
|
3207
3289
|
`Layer opacity out of bounds: ${I} — clamping to [0.0, 1.0]`
|
|
3208
3290
|
), this.transparent = A, this.opacity_ = OA(I, 0, 1), this.blendMode = B;
|
|
@@ -3211,7 +3293,7 @@ class GA {
|
|
|
3211
3293
|
return this.opacity_;
|
|
3212
3294
|
}
|
|
3213
3295
|
set opacity(A) {
|
|
3214
|
-
(A < 0 || A > 1) &&
|
|
3296
|
+
(A < 0 || A > 1) && c.warn(
|
|
3215
3297
|
"Layer",
|
|
3216
3298
|
`Opacity out of bounds: ${A} — clamping to [0.0, 1.0]`
|
|
3217
3299
|
), this.opacity_ = OA(A, 0, 1);
|
|
@@ -3224,7 +3306,7 @@ class GA {
|
|
|
3224
3306
|
// placeholder implementations.
|
|
3225
3307
|
async onAttached(A) {
|
|
3226
3308
|
}
|
|
3227
|
-
onDetached() {
|
|
3309
|
+
onDetached(A) {
|
|
3228
3310
|
}
|
|
3229
3311
|
get objects() {
|
|
3230
3312
|
return this.objects_;
|
|
@@ -3362,7 +3444,7 @@ class ag extends mA {
|
|
|
3362
3444
|
};
|
|
3363
3445
|
}
|
|
3364
3446
|
}
|
|
3365
|
-
class
|
|
3447
|
+
class yo extends GA {
|
|
3366
3448
|
type = "AxesLayer";
|
|
3367
3449
|
constructor(A) {
|
|
3368
3450
|
super();
|
|
@@ -3398,7 +3480,7 @@ function ZI(g) {
|
|
|
3398
3480
|
width: I
|
|
3399
3481
|
});
|
|
3400
3482
|
}
|
|
3401
|
-
class
|
|
3483
|
+
class to extends GA {
|
|
3402
3484
|
type = "ProjectedLineLayer";
|
|
3403
3485
|
paths_ = [];
|
|
3404
3486
|
constructor(A = []) {
|
|
@@ -3415,10 +3497,10 @@ class ho extends GA {
|
|
|
3415
3497
|
// TODO: this is temporary - we may want to generalize this to all layers
|
|
3416
3498
|
// for now it is used to set the initial camera position to be centered on the tracks
|
|
3417
3499
|
get extent() {
|
|
3418
|
-
return
|
|
3500
|
+
return EC(this.paths_.flat());
|
|
3419
3501
|
}
|
|
3420
3502
|
}
|
|
3421
|
-
function
|
|
3503
|
+
function EC(g) {
|
|
3422
3504
|
function A(o) {
|
|
3423
3505
|
const a = g.map((D) => D[o]);
|
|
3424
3506
|
return [Math.min(...a), Math.max(...a)];
|
|
@@ -3426,7 +3508,7 @@ function QC(g) {
|
|
|
3426
3508
|
const [I, B] = A(0), [Q, C] = A(1), [E, i] = A(2);
|
|
3427
3509
|
return { xMin: I, xMax: B, yMin: Q, yMax: C, zMin: E, zMax: i };
|
|
3428
3510
|
}
|
|
3429
|
-
class
|
|
3511
|
+
class Go extends GA {
|
|
3430
3512
|
type = "TracksLayer";
|
|
3431
3513
|
tracks_ = [];
|
|
3432
3514
|
constructor(A = []) {
|
|
@@ -3436,7 +3518,7 @@ class yo extends GA {
|
|
|
3436
3518
|
this.tracks_.push(A);
|
|
3437
3519
|
let I;
|
|
3438
3520
|
if (A.interpolation) {
|
|
3439
|
-
const i =
|
|
3521
|
+
const i = oC({
|
|
3440
3522
|
path: A.path,
|
|
3441
3523
|
pointsPerSegment: A.interpolation.pointsPerSegment,
|
|
3442
3524
|
tangentFactor: A.interpolation.tangentFactor
|
|
@@ -3467,10 +3549,10 @@ class yo extends GA {
|
|
|
3467
3549
|
// for now it is used to set the initial camera position to be centered on the tracks
|
|
3468
3550
|
get extent() {
|
|
3469
3551
|
const A = this.tracks_.map((I) => I.path);
|
|
3470
|
-
return
|
|
3552
|
+
return iC(A.flat());
|
|
3471
3553
|
}
|
|
3472
3554
|
}
|
|
3473
|
-
function
|
|
3555
|
+
function iC(g) {
|
|
3474
3556
|
function A(o) {
|
|
3475
3557
|
const a = g.map((D) => D[o]);
|
|
3476
3558
|
return [Math.min(...a), Math.max(...a)];
|
|
@@ -3478,12 +3560,12 @@ function CC(g) {
|
|
|
3478
3560
|
const [I, B] = A(0), [Q, C] = A(1), [E, i] = A(2);
|
|
3479
3561
|
return { xMin: I, xMax: B, yMin: Q, yMax: C, zMin: E, zMax: i };
|
|
3480
3562
|
}
|
|
3481
|
-
function
|
|
3563
|
+
function oC({
|
|
3482
3564
|
path: g,
|
|
3483
3565
|
pointsPerSegment: A,
|
|
3484
3566
|
tangentFactor: I = 1 / 3
|
|
3485
3567
|
}) {
|
|
3486
|
-
const B =
|
|
3568
|
+
const B = aC(g), Q = Array((g.length - 1) * A);
|
|
3487
3569
|
for (let C = 0; C < g.length - 1; C++) {
|
|
3488
3570
|
const E = g[C], i = g[C + 1], o = IA(B[C]);
|
|
3489
3571
|
dg(o, E, o, I);
|
|
@@ -3496,7 +3578,7 @@ function EC({
|
|
|
3496
3578
|
}
|
|
3497
3579
|
return Q;
|
|
3498
3580
|
}
|
|
3499
|
-
function
|
|
3581
|
+
function aC(g) {
|
|
3500
3582
|
if (g.length < 2)
|
|
3501
3583
|
throw new Error("Path must contain at least 2 points");
|
|
3502
3584
|
const A = Array(g.length), I = p(), B = p();
|
|
@@ -3511,16 +3593,16 @@ class SB extends pA {
|
|
|
3511
3593
|
super();
|
|
3512
3594
|
const C = [], E = [], i = B, o = Q, a = i + 1, D = o + 1, h = A / i, y = I / o;
|
|
3513
3595
|
for (let G = 0; G < D; ++G) {
|
|
3514
|
-
const
|
|
3515
|
-
for (let
|
|
3516
|
-
const e =
|
|
3517
|
-
C.push(...
|
|
3596
|
+
const S = G * y;
|
|
3597
|
+
for (let R = 0; R < a; ++R) {
|
|
3598
|
+
const e = R * h, F = R / i, M = G / o, N = [e, S, 0], K = [0, 0, 1], J = [F, M];
|
|
3599
|
+
C.push(...N, ...K, ...J);
|
|
3518
3600
|
}
|
|
3519
3601
|
}
|
|
3520
3602
|
for (let G = 0; G < o; ++G)
|
|
3521
|
-
for (let
|
|
3522
|
-
const
|
|
3523
|
-
E.push(
|
|
3603
|
+
for (let S = 0; S < i; ++S) {
|
|
3604
|
+
const R = S + a * G, e = S + a * (G + 1), F = S + 1 + a * (G + 1), M = S + 1 + a * G;
|
|
3605
|
+
E.push(R, e, M), E.push(e, F, M);
|
|
3524
3606
|
}
|
|
3525
3607
|
this.vertexData_ = new Float32Array(C), this.indexData_ = new Uint32Array(E), this.addAttribute({
|
|
3526
3608
|
type: "position",
|
|
@@ -3557,7 +3639,7 @@ function dA(g) {
|
|
|
3557
3639
|
return "float";
|
|
3558
3640
|
throw new Error("Unsupported buffer type.");
|
|
3559
3641
|
}
|
|
3560
|
-
function
|
|
3642
|
+
function DC(g) {
|
|
3561
3643
|
if (g.dataFormat === "rgb" || g.dataFormat === "rgba")
|
|
3562
3644
|
return [0, 1];
|
|
3563
3645
|
switch (g.dataType) {
|
|
@@ -3594,7 +3676,7 @@ class Dg extends Eg {
|
|
|
3594
3676
|
}
|
|
3595
3677
|
const xg = 32;
|
|
3596
3678
|
function _I(g, { visible: A, color: I, contrastLimits: B }) {
|
|
3597
|
-
return A === void 0 && (A = !0), I === void 0 ? I = l.WHITE : I = l.from(I), g !== null ? B =
|
|
3679
|
+
return A === void 0 && (A = !0), I === void 0 ? I = l.WHITE : I = l.from(I), g !== null ? B = sC(B, g) : B === void 0 && (c.debug(
|
|
3598
3680
|
"Channel",
|
|
3599
3681
|
"No texture provided, defaulting channel contrast limits to [0, 1]."
|
|
3600
3682
|
), B = [0, 1]), {
|
|
@@ -3615,9 +3697,9 @@ function bg(g, A) {
|
|
|
3615
3697
|
}
|
|
3616
3698
|
return A.map((I) => _I(g, I));
|
|
3617
3699
|
}
|
|
3618
|
-
function
|
|
3700
|
+
function sC(g, A) {
|
|
3619
3701
|
if (g === void 0)
|
|
3620
|
-
return
|
|
3702
|
+
return DC(A);
|
|
3621
3703
|
if (g[1] <= g[0])
|
|
3622
3704
|
throw new Error(
|
|
3623
3705
|
`Contrast limits must be strictly increasing: ${g}.`
|
|
@@ -3627,7 +3709,7 @@ function aC(g, A) {
|
|
|
3627
3709
|
class sg extends mA {
|
|
3628
3710
|
channels_;
|
|
3629
3711
|
constructor(A, I, B, Q = []) {
|
|
3630
|
-
super(), this.geometry = new SB(A, I, 1, 1), this.setTexture(0, B), this.channels_ = bg(B, Q), this.programName =
|
|
3712
|
+
super(), this.geometry = new SB(A, I, 1, 1), this.setTexture(0, B), this.channels_ = bg(B, Q), this.programName = hC(B);
|
|
3631
3713
|
}
|
|
3632
3714
|
get type() {
|
|
3633
3715
|
return "ImageRenderable";
|
|
@@ -3670,14 +3752,14 @@ class sg extends mA {
|
|
|
3670
3752
|
}
|
|
3671
3753
|
}
|
|
3672
3754
|
}
|
|
3673
|
-
function
|
|
3755
|
+
function hC(g) {
|
|
3674
3756
|
if (g.type === "Texture2D")
|
|
3675
|
-
return
|
|
3757
|
+
return yC(g.dataType);
|
|
3676
3758
|
if (g.type === "Texture2DArray")
|
|
3677
|
-
return
|
|
3759
|
+
return tC(g.dataType);
|
|
3678
3760
|
throw new Error(`Unsupported image texture type: ${g.type}`);
|
|
3679
3761
|
}
|
|
3680
|
-
function
|
|
3762
|
+
function yC(g) {
|
|
3681
3763
|
switch (g) {
|
|
3682
3764
|
case "byte":
|
|
3683
3765
|
case "int":
|
|
@@ -3691,7 +3773,7 @@ function sC(g) {
|
|
|
3691
3773
|
return "floatScalarImage";
|
|
3692
3774
|
}
|
|
3693
3775
|
}
|
|
3694
|
-
function
|
|
3776
|
+
function tC(g) {
|
|
3695
3777
|
switch (g) {
|
|
3696
3778
|
case "byte":
|
|
3697
3779
|
case "int":
|
|
@@ -3757,11 +3839,11 @@ function hg(g, A, I, B, Q = 3) {
|
|
|
3757
3839
|
switch (g.type) {
|
|
3758
3840
|
case "pointerdown": {
|
|
3759
3841
|
const C = g.event;
|
|
3760
|
-
return
|
|
3842
|
+
return u(C.clientX, C.clientY);
|
|
3761
3843
|
}
|
|
3762
3844
|
case "pointerup": {
|
|
3763
3845
|
if (!A) return A;
|
|
3764
|
-
const C = g.event, E =
|
|
3846
|
+
const C = g.event, E = u(C.clientX, C.clientY);
|
|
3765
3847
|
if (YQ(A, E) < Q) {
|
|
3766
3848
|
if (!B) return null;
|
|
3767
3849
|
const o = g.worldPos;
|
|
@@ -3779,15 +3861,15 @@ function hg(g, A, I, B, Q = 3) {
|
|
|
3779
3861
|
return A;
|
|
3780
3862
|
}
|
|
3781
3863
|
}
|
|
3782
|
-
class
|
|
3864
|
+
class GC {
|
|
3783
3865
|
bins_ = /* @__PURE__ */ new Map();
|
|
3784
3866
|
acquire(A) {
|
|
3785
3867
|
const B = this.bins_.get(A)?.pop();
|
|
3786
|
-
return B &&
|
|
3868
|
+
return B && c.debug("RenderablePool", "Renderable object acquired"), B;
|
|
3787
3869
|
}
|
|
3788
3870
|
release(A, I) {
|
|
3789
3871
|
let B = this.bins_.get(A);
|
|
3790
|
-
B || (B = [], this.bins_.set(A, B)), B.push(I),
|
|
3872
|
+
B || (B = [], this.bins_.set(A, B)), B.push(I), c.debug("RenderablePool", "Renderable object released");
|
|
3791
3873
|
}
|
|
3792
3874
|
clearAll(A) {
|
|
3793
3875
|
if (A) for (const I of this.bins_.values()) I.forEach(A);
|
|
@@ -3800,12 +3882,12 @@ class RB extends GA {
|
|
|
3800
3882
|
sliceCoords_;
|
|
3801
3883
|
onPickValue_;
|
|
3802
3884
|
visibleChunks_ = /* @__PURE__ */ new Map();
|
|
3803
|
-
pool_ = new
|
|
3885
|
+
pool_ = new GC();
|
|
3804
3886
|
initialChannelProps_;
|
|
3805
3887
|
channelChangeCallbacks_ = [];
|
|
3806
3888
|
policy_;
|
|
3807
3889
|
channelProps_;
|
|
3808
|
-
|
|
3890
|
+
chunkStoreView_;
|
|
3809
3891
|
pointerDownPos_ = null;
|
|
3810
3892
|
zPrevPointWorld_;
|
|
3811
3893
|
debugMode_ = !1;
|
|
@@ -3829,27 +3911,28 @@ class RB extends GA {
|
|
|
3829
3911
|
super(E), this.setState("initialized"), this.source_ = A, this.policy_ = B, this.sliceCoords_ = I, this.channelProps_ = Q, this.initialChannelProps_ = Q, this.onPickValue_ = C;
|
|
3830
3912
|
}
|
|
3831
3913
|
async onAttached(A) {
|
|
3832
|
-
if (this.
|
|
3914
|
+
if (this.chunkStoreView_)
|
|
3833
3915
|
throw new Error(
|
|
3834
|
-
"ChunkedImageLayer
|
|
3916
|
+
"ChunkedImageLayer cannot be attached to multiple contexts simultaneously."
|
|
3835
3917
|
);
|
|
3836
|
-
this.
|
|
3918
|
+
this.chunkStoreView_ = await A.chunkManager.addView(
|
|
3837
3919
|
this.source_,
|
|
3838
|
-
this.sliceCoords_,
|
|
3839
3920
|
this.policy_
|
|
3840
3921
|
);
|
|
3841
3922
|
}
|
|
3842
|
-
onDetached() {
|
|
3843
|
-
this.
|
|
3923
|
+
onDetached(A) {
|
|
3924
|
+
this.releaseAndRemoveChunks(this.visibleChunks_.keys()), this.clearObjects(), this.chunkStoreView_ && (A.chunkManager.removeView(this.chunkStoreView_), this.chunkStoreView_ = void 0);
|
|
3844
3925
|
}
|
|
3845
|
-
update() {
|
|
3846
|
-
this.updateChunks(), this.resliceIfZChanged();
|
|
3926
|
+
update(A) {
|
|
3927
|
+
!A || !this.chunkStoreView_ || (this.chunkStoreView_.updateChunkStates(this.sliceCoords_, A.viewport), this.updateChunks(), this.resliceIfZChanged());
|
|
3847
3928
|
}
|
|
3848
3929
|
updateChunks() {
|
|
3849
|
-
if (!this.
|
|
3930
|
+
if (!this.chunkStoreView_ || (this.state !== "ready" && this.setState("ready"), this.visibleChunks_.size > 0 && !this.chunkStoreView_.allVisibleLowestLODLoaded(this.sliceCoords_) && !this.isPresentationStale()))
|
|
3850
3931
|
return;
|
|
3851
3932
|
this.lastPresentationTimeStamp_ = performance.now(), this.lastPresentationTimeCoord_ = this.sliceCoords_.t;
|
|
3852
|
-
const A = this.
|
|
3933
|
+
const A = this.chunkStoreView_.getChunksToRender(
|
|
3934
|
+
this.sliceCoords_
|
|
3935
|
+
), I = new Set(A), B = Array.from(this.visibleChunks_.keys()).filter(
|
|
3853
3936
|
(Q) => !I.has(Q)
|
|
3854
3937
|
);
|
|
3855
3938
|
this.releaseAndRemoveChunks(B), this.clearObjects();
|
|
@@ -3884,8 +3967,12 @@ class RB extends GA {
|
|
|
3884
3967
|
this.onPickValue_
|
|
3885
3968
|
);
|
|
3886
3969
|
}
|
|
3887
|
-
|
|
3888
|
-
|
|
3970
|
+
// exposed for use in chunk info overlay
|
|
3971
|
+
get chunkStoreView() {
|
|
3972
|
+
return this.chunkStoreView_;
|
|
3973
|
+
}
|
|
3974
|
+
get sliceCoords() {
|
|
3975
|
+
return this.sliceCoords_;
|
|
3889
3976
|
}
|
|
3890
3977
|
get source() {
|
|
3891
3978
|
return this.source_;
|
|
@@ -3894,7 +3981,7 @@ class RB extends GA {
|
|
|
3894
3981
|
return this.policy_;
|
|
3895
3982
|
}
|
|
3896
3983
|
set imageSourcePolicy(A) {
|
|
3897
|
-
this.policy_ !== A && (this.policy_ = A, this.
|
|
3984
|
+
this.policy_ !== A && (this.policy_ = A, this.chunkStoreView_ && this.chunkStoreView_.setImageSourcePolicy(
|
|
3898
3985
|
A,
|
|
3899
3986
|
nB
|
|
3900
3987
|
));
|
|
@@ -3902,7 +3989,7 @@ class RB extends GA {
|
|
|
3902
3989
|
slicePlane(A, I) {
|
|
3903
3990
|
if (!A.data) return;
|
|
3904
3991
|
const B = (I - A.offset.z) / A.scale.z, Q = Math.round(B), C = OA(Q, 0, A.shape.z - 1);
|
|
3905
|
-
jI(B, C, 1 + 1e-6) ||
|
|
3992
|
+
jI(B, C, 1 + 1e-6) || c.error("ImageLayer", "slicePlane zValue outside extent");
|
|
3906
3993
|
const E = A.shape.x * A.shape.y, i = E * C;
|
|
3907
3994
|
return A.data.slice(i, i + E);
|
|
3908
3995
|
}
|
|
@@ -3924,7 +4011,7 @@ class RB extends GA {
|
|
|
3924
4011
|
getDataForImage(A) {
|
|
3925
4012
|
const I = this.sliceCoords_?.z !== void 0 ? this.slicePlane(A, this.sliceCoords_.z) : A.data;
|
|
3926
4013
|
if (!I) {
|
|
3927
|
-
|
|
4014
|
+
c.warn("ChunkedImageLayer", "No data for image");
|
|
3928
4015
|
return;
|
|
3929
4016
|
}
|
|
3930
4017
|
return I;
|
|
@@ -3933,7 +4020,7 @@ class RB extends GA {
|
|
|
3933
4020
|
this.debugMode_ ? (A.wireframeEnabled = !0, A.wireframeColor = this.wireframeColors_[I.lod % this.wireframeColors_.length]) : A.wireframeEnabled = !1, A.transform.setScale([I.scale.x, I.scale.y, 1]), A.transform.setTranslation([I.offset.x, I.offset.y, 0]);
|
|
3934
4021
|
}
|
|
3935
4022
|
getValueAtWorld(A) {
|
|
3936
|
-
const I = this.
|
|
4023
|
+
const I = this.chunkStoreView_?.currentLOD ?? 0;
|
|
3937
4024
|
for (const [B, Q] of this.visibleChunks_) {
|
|
3938
4025
|
if (B.lod !== I) continue;
|
|
3939
4026
|
const C = this.getValueFromChunk(B, Q, A);
|
|
@@ -4056,7 +4143,7 @@ class yg extends Dg {
|
|
|
4056
4143
|
return B.unpackAlignment = A.rowAlignmentBytes, B;
|
|
4057
4144
|
}
|
|
4058
4145
|
}
|
|
4059
|
-
class
|
|
4146
|
+
class wC extends pA {
|
|
4060
4147
|
constructor(A, I, B, Q, C, E) {
|
|
4061
4148
|
super();
|
|
4062
4149
|
const i = [], o = [], a = Math.floor(Q), D = Math.floor(C), h = Math.floor(E);
|
|
@@ -4075,43 +4162,43 @@ class tC extends pA {
|
|
|
4075
4162
|
});
|
|
4076
4163
|
}
|
|
4077
4164
|
buildFace(A, I, B, Q, C, E, i, o, a, D, h, y, G) {
|
|
4078
|
-
const
|
|
4079
|
-
for (let
|
|
4080
|
-
const
|
|
4081
|
-
for (let
|
|
4082
|
-
const
|
|
4083
|
-
|
|
4084
|
-
const
|
|
4085
|
-
|
|
4086
|
-
const wA =
|
|
4165
|
+
const S = E / a, R = i / D, e = E / 2, F = i / 2, M = o / 2 * h, N = a + 1, K = D + 1, J = y.length / 8;
|
|
4166
|
+
for (let L = 0; L < K; L++) {
|
|
4167
|
+
const O = -F + L * R;
|
|
4168
|
+
for (let V = 0; V < N; V++) {
|
|
4169
|
+
const X = -e + V * S, b = { x: 0, y: 0, z: 0 };
|
|
4170
|
+
b[A] = X * Q, b[I] = O * C, b[B] = M;
|
|
4171
|
+
const Z = { x: 0, y: 0, z: 0 };
|
|
4172
|
+
Z[B] = h;
|
|
4173
|
+
const wA = V / a, FA = 1 - L / D;
|
|
4087
4174
|
y.push(
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4175
|
+
b.x,
|
|
4176
|
+
b.y,
|
|
4177
|
+
b.z,
|
|
4178
|
+
Z.x,
|
|
4179
|
+
Z.y,
|
|
4180
|
+
Z.z,
|
|
4094
4181
|
wA,
|
|
4095
4182
|
FA
|
|
4096
4183
|
);
|
|
4097
4184
|
}
|
|
4098
4185
|
}
|
|
4099
|
-
for (let
|
|
4100
|
-
for (let
|
|
4101
|
-
const
|
|
4102
|
-
h === 1 ? G.push(
|
|
4186
|
+
for (let L = 0; L < D; L++)
|
|
4187
|
+
for (let O = 0; O < a; O++) {
|
|
4188
|
+
const V = J + O + N * L, X = J + O + N * (L + 1), b = J + (O + 1) + N * (L + 1), Z = J + (O + 1) + N * L;
|
|
4189
|
+
h === 1 ? G.push(V, X, Z, X, b, Z) : G.push(V, Z, X, X, Z, b);
|
|
4103
4190
|
}
|
|
4104
4191
|
}
|
|
4105
4192
|
}
|
|
4106
|
-
class
|
|
4193
|
+
class FC extends mA {
|
|
4107
4194
|
constructor(A, I, B, Q) {
|
|
4108
|
-
super(), this.geometry = new
|
|
4195
|
+
super(), this.geometry = new wC(A, I, B, 1, 1, 1), this.cullFaceMode = "back", this.setTexture(0, Q), this.programName = nC(Q.dataType);
|
|
4109
4196
|
}
|
|
4110
4197
|
get type() {
|
|
4111
4198
|
return "VolumeRenderable";
|
|
4112
4199
|
}
|
|
4113
4200
|
}
|
|
4114
|
-
function
|
|
4201
|
+
function nC(g) {
|
|
4115
4202
|
switch (g) {
|
|
4116
4203
|
case "byte":
|
|
4117
4204
|
case "int":
|
|
@@ -4125,19 +4212,19 @@ function wC(g) {
|
|
|
4125
4212
|
return "floatVolume";
|
|
4126
4213
|
}
|
|
4127
4214
|
}
|
|
4128
|
-
class
|
|
4215
|
+
class wo extends GA {
|
|
4129
4216
|
type = "VolumeLayer";
|
|
4130
4217
|
constructor() {
|
|
4131
4218
|
super();
|
|
4132
4219
|
const A = new Int8Array([127, 0, 0, 127, 127, 0, 0, 127]), I = new yg(A, 2, 2, 2);
|
|
4133
4220
|
I.unpackAlignment = 1;
|
|
4134
|
-
const B = new
|
|
4221
|
+
const B = new FC(1, 1, 1, I);
|
|
4135
4222
|
B.wireframeEnabled = !0, this.addObject(B), this.setState("ready");
|
|
4136
4223
|
}
|
|
4137
4224
|
update() {
|
|
4138
4225
|
}
|
|
4139
4226
|
}
|
|
4140
|
-
class
|
|
4227
|
+
class Fo extends GA {
|
|
4141
4228
|
type = "ImageLayer";
|
|
4142
4229
|
source_;
|
|
4143
4230
|
region_;
|
|
@@ -4284,7 +4371,7 @@ class VA extends Dg {
|
|
|
4284
4371
|
return Q.unpackAlignment = A.rowAlignmentBytes, Q;
|
|
4285
4372
|
}
|
|
4286
4373
|
}
|
|
4287
|
-
const
|
|
4374
|
+
const eC = [
|
|
4288
4375
|
[1, 0.5, 0.5],
|
|
4289
4376
|
[0.5, 1, 0.5],
|
|
4290
4377
|
[0.5, 0.5, 1],
|
|
@@ -4292,7 +4379,7 @@ const FC = [
|
|
|
4292
4379
|
[1, 0.5, 1],
|
|
4293
4380
|
[1, 1, 0.5]
|
|
4294
4381
|
];
|
|
4295
|
-
function
|
|
4382
|
+
function rC(g) {
|
|
4296
4383
|
return g = g ?? /* @__PURE__ */ new Map(), new Map(
|
|
4297
4384
|
Array.from(g.entries()).map(([A, I]) => [
|
|
4298
4385
|
A,
|
|
@@ -4300,37 +4387,37 @@ function nC(g) {
|
|
|
4300
4387
|
])
|
|
4301
4388
|
);
|
|
4302
4389
|
}
|
|
4303
|
-
function
|
|
4304
|
-
return g = g ??
|
|
4390
|
+
function SC(g) {
|
|
4391
|
+
return g = g ?? eC, g.map(l.from);
|
|
4305
4392
|
}
|
|
4306
4393
|
class Pg {
|
|
4307
4394
|
lookupTable;
|
|
4308
4395
|
cycle;
|
|
4309
4396
|
constructor(A = {}) {
|
|
4310
|
-
this.lookupTable =
|
|
4397
|
+
this.lookupTable = rC(A.lookupTable), this.cycle = SC(A.cycle);
|
|
4311
4398
|
}
|
|
4312
4399
|
}
|
|
4313
|
-
const
|
|
4400
|
+
const RC = /* @__PURE__ */ new Set([
|
|
4314
4401
|
"unsigned_byte",
|
|
4315
4402
|
"unsigned_short",
|
|
4316
4403
|
"unsigned_int"
|
|
4317
4404
|
]);
|
|
4318
|
-
function
|
|
4405
|
+
function NC(g) {
|
|
4319
4406
|
if (g.dataFormat !== "scalar")
|
|
4320
4407
|
throw new Error(
|
|
4321
4408
|
`Image data format must be scalar, instead found: ${g.dataFormat}`
|
|
4322
4409
|
);
|
|
4323
|
-
if (!
|
|
4410
|
+
if (!RC.has(g.dataType))
|
|
4324
4411
|
throw new Error(
|
|
4325
4412
|
`Image data type must be unsigned, instead found: ${g.dataType}`
|
|
4326
4413
|
);
|
|
4327
4414
|
return g;
|
|
4328
4415
|
}
|
|
4329
|
-
class
|
|
4416
|
+
class cC extends mA {
|
|
4330
4417
|
outlineSelected_;
|
|
4331
4418
|
selectedValue_;
|
|
4332
4419
|
constructor(A) {
|
|
4333
|
-
super(), this.geometry = new SB(A.width, A.height, 1, 1), this.setTexture(0,
|
|
4420
|
+
super(), this.geometry = new SB(A.width, A.height, 1, 1), this.setTexture(0, NC(A.imageData));
|
|
4334
4421
|
const I = this.makeColorCycleTexture(A.colorMap.cycle);
|
|
4335
4422
|
this.setTexture(1, I);
|
|
4336
4423
|
const B = this.makeColorLookupTableTexture(
|
|
@@ -4368,7 +4455,7 @@ class RC extends mA {
|
|
|
4368
4455
|
return C.set(I, 0), C.set(B, Q), new VA(C, Q, 2);
|
|
4369
4456
|
}
|
|
4370
4457
|
}
|
|
4371
|
-
class
|
|
4458
|
+
class no extends GA {
|
|
4372
4459
|
type = "LabelImageLayer";
|
|
4373
4460
|
source_;
|
|
4374
4461
|
region_;
|
|
@@ -4433,7 +4520,7 @@ class wo extends GA {
|
|
|
4433
4520
|
}
|
|
4434
4521
|
createImage(A) {
|
|
4435
4522
|
this.imageChunk_ = A;
|
|
4436
|
-
const I = new
|
|
4523
|
+
const I = new cC({
|
|
4437
4524
|
width: A.shape.x,
|
|
4438
4525
|
height: A.shape.y,
|
|
4439
4526
|
imageData: VA.createWithChunk(A),
|
|
@@ -4462,7 +4549,7 @@ class KI extends Error {
|
|
|
4462
4549
|
super(A), this.name = "AbortError", Object.setPrototypeOf(this, KI.prototype);
|
|
4463
4550
|
}
|
|
4464
4551
|
}
|
|
4465
|
-
class
|
|
4552
|
+
class UC {
|
|
4466
4553
|
maxConcurrent_;
|
|
4467
4554
|
pending_ = [];
|
|
4468
4555
|
abortController_ = new AbortController();
|
|
@@ -4506,12 +4593,12 @@ class NC {
|
|
|
4506
4593
|
return this.pending_.length;
|
|
4507
4594
|
}
|
|
4508
4595
|
}
|
|
4509
|
-
class
|
|
4596
|
+
class kC {
|
|
4510
4597
|
source_;
|
|
4511
4598
|
region_;
|
|
4512
4599
|
seriesDimensionName_;
|
|
4513
4600
|
seriesIndex_;
|
|
4514
|
-
scheduler_ = new
|
|
4601
|
+
scheduler_ = new UC(16);
|
|
4515
4602
|
lod_;
|
|
4516
4603
|
loader_ = null;
|
|
4517
4604
|
seriesAttributes_;
|
|
@@ -4542,11 +4629,11 @@ class cC {
|
|
|
4542
4629
|
const I = this.loadingToken_;
|
|
4543
4630
|
if (I) {
|
|
4544
4631
|
if (I.index === A && !I.canceled)
|
|
4545
|
-
return
|
|
4632
|
+
return c.debug(
|
|
4546
4633
|
"ImageSeriesLoader",
|
|
4547
4634
|
"Ignoring duplicate active setIndex request"
|
|
4548
4635
|
), { success: !1, reason: "duplicate" };
|
|
4549
|
-
|
|
4636
|
+
c.debug(
|
|
4550
4637
|
"ImageSeriesLoader",
|
|
4551
4638
|
`Cancelling setIndex request for index ${I.index}, new requested index is ${A}`
|
|
4552
4639
|
), I.canceled = !0;
|
|
@@ -4606,7 +4693,7 @@ class cC {
|
|
|
4606
4693
|
if (Q.status === "rejected") {
|
|
4607
4694
|
if (Q.reason instanceof KI)
|
|
4608
4695
|
return Promise.reject(Q.reason);
|
|
4609
|
-
|
|
4696
|
+
c.error(
|
|
4610
4697
|
"ImageSeriesLoader",
|
|
4611
4698
|
`Error loading slice: ${Q.reason}`
|
|
4612
4699
|
);
|
|
@@ -4616,7 +4703,7 @@ class cC {
|
|
|
4616
4703
|
return this.loader_ ??= await this.source_.open(), this.loader_;
|
|
4617
4704
|
}
|
|
4618
4705
|
}
|
|
4619
|
-
class
|
|
4706
|
+
class eo extends GA {
|
|
4620
4707
|
type = "ImageSeriesLayer";
|
|
4621
4708
|
seriesLoader_;
|
|
4622
4709
|
initialChannelProps_;
|
|
@@ -4633,7 +4720,7 @@ class Fo extends GA {
|
|
|
4633
4720
|
lod: C,
|
|
4634
4721
|
...E
|
|
4635
4722
|
}) {
|
|
4636
|
-
super(E), this.setState("initialized"), this.channelProps_ = Q, this.initialChannelProps_ = Q, this.seriesLoader_ = new
|
|
4723
|
+
super(E), this.setState("initialized"), this.channelProps_ = Q, this.initialChannelProps_ = Q, this.seriesLoader_ = new kC({
|
|
4637
4724
|
source: A,
|
|
4638
4725
|
region: I,
|
|
4639
4726
|
seriesDimensionName: B,
|
|
@@ -4884,7 +4971,7 @@ function Og(g, A) {
|
|
|
4884
4971
|
for (let E = 0; E < I; E += 1)
|
|
4885
4972
|
Q = g[C + E], g[C + E] = g[C + B - E], g[C + B - E] = Q;
|
|
4886
4973
|
}
|
|
4887
|
-
const
|
|
4974
|
+
const LC = {
|
|
4888
4975
|
int8: Int8Array,
|
|
4889
4976
|
int16: Int16Array,
|
|
4890
4977
|
int32: Int32Array,
|
|
@@ -4896,36 +4983,36 @@ const UC = {
|
|
|
4896
4983
|
float32: Float32Array,
|
|
4897
4984
|
float64: Float64Array,
|
|
4898
4985
|
bool: NB
|
|
4899
|
-
},
|
|
4986
|
+
}, JC = /v2:([US])(\d+)/;
|
|
4900
4987
|
function cB(g) {
|
|
4901
4988
|
if (g === "v2:object")
|
|
4902
4989
|
return globalThis.Array;
|
|
4903
|
-
let A = g.match(
|
|
4990
|
+
let A = g.match(JC);
|
|
4904
4991
|
if (A) {
|
|
4905
4992
|
let [, B, Q] = A;
|
|
4906
4993
|
return (B === "U" ? aI : wg).bind(null, Number(Q));
|
|
4907
4994
|
}
|
|
4908
|
-
let I =
|
|
4995
|
+
let I = LC[g];
|
|
4909
4996
|
if (!I)
|
|
4910
4997
|
throw new Error(`Unknown or unsupported data_type: ${g}`);
|
|
4911
4998
|
return I;
|
|
4912
4999
|
}
|
|
4913
5000
|
function RA(g, A) {
|
|
4914
|
-
return (A === "C" ?
|
|
5001
|
+
return (A === "C" ? YC : MC)(g);
|
|
4915
5002
|
}
|
|
4916
|
-
function
|
|
5003
|
+
function YC(g) {
|
|
4917
5004
|
const A = g.length, I = globalThis.Array(A);
|
|
4918
5005
|
for (let B = A - 1, Q = 1; B >= 0; B--)
|
|
4919
5006
|
I[B] = Q, Q *= g[B];
|
|
4920
5007
|
return I;
|
|
4921
5008
|
}
|
|
4922
|
-
function
|
|
5009
|
+
function MC(g) {
|
|
4923
5010
|
const A = g.length, I = globalThis.Array(A);
|
|
4924
5011
|
for (let B = 0, Q = 1; B < A; B++)
|
|
4925
5012
|
I[B] = Q, Q *= g[B];
|
|
4926
5013
|
return I;
|
|
4927
5014
|
}
|
|
4928
|
-
function
|
|
5015
|
+
function KC({ name: g, configuration: A }) {
|
|
4929
5016
|
if (g === "default") {
|
|
4930
5017
|
const I = A?.separator ?? "/";
|
|
4931
5018
|
return (B) => ["c", ...B].join(I);
|
|
@@ -4939,11 +5026,11 @@ function YC({ name: g, configuration: A }) {
|
|
|
4939
5026
|
function $I(g) {
|
|
4940
5027
|
return g.find((I) => I.name === "transpose")?.configuration?.order === "F" ? "F" : "C";
|
|
4941
5028
|
}
|
|
4942
|
-
const
|
|
4943
|
-
function
|
|
5029
|
+
const dC = /^([<|>])(.*)$/;
|
|
5030
|
+
function HC(g) {
|
|
4944
5031
|
if (g === "|O")
|
|
4945
5032
|
return { data_type: "v2:object" };
|
|
4946
|
-
let A = g.match(
|
|
5033
|
+
let A = g.match(dC);
|
|
4947
5034
|
if (!A)
|
|
4948
5035
|
throw new Error(`Invalid dtype: ${g}`);
|
|
4949
5036
|
let [, I, B] = A, Q = {
|
|
@@ -4963,8 +5050,8 @@ function KC(g) {
|
|
|
4963
5050
|
throw new Error(`Unsupported or unknown dtype: ${g}`);
|
|
4964
5051
|
return I === "|" ? { data_type: Q } : { data_type: Q, endian: I === "<" ? "little" : "big" };
|
|
4965
5052
|
}
|
|
4966
|
-
function
|
|
4967
|
-
let I = [], B =
|
|
5053
|
+
function qC(g, A = {}) {
|
|
5054
|
+
let I = [], B = HC(g.dtype);
|
|
4968
5055
|
g.order === "F" && I.push({ name: "transpose", configuration: { order: "F" } }), "endian" in B && B.endian === "big" && I.push({ name: "bytes", configuration: { endian: "big" } });
|
|
4969
5056
|
for (let { id: Q, ...C } of g.filters ?? [])
|
|
4970
5057
|
I.push({ name: Q, configuration: C });
|
|
@@ -4994,14 +5081,14 @@ function dC(g, A = {}) {
|
|
|
4994
5081
|
attributes: A
|
|
4995
5082
|
};
|
|
4996
5083
|
}
|
|
4997
|
-
function
|
|
5084
|
+
function lC(g, A = {}) {
|
|
4998
5085
|
return {
|
|
4999
5086
|
zarr_format: 3,
|
|
5000
5087
|
node_type: "group",
|
|
5001
5088
|
attributes: A
|
|
5002
5089
|
};
|
|
5003
5090
|
}
|
|
5004
|
-
function
|
|
5091
|
+
function fC(g, A) {
|
|
5005
5092
|
if (A !== "number" && A !== "bigint" && A !== "boolean" && A !== "object" && A !== "string")
|
|
5006
5093
|
return g === A;
|
|
5007
5094
|
let I = g === "bool";
|
|
@@ -5016,14 +5103,14 @@ function qC(g, A) {
|
|
|
5016
5103
|
let C = g === "v2:object";
|
|
5017
5104
|
return A === "object" ? C : !B && !Q && !I && !C;
|
|
5018
5105
|
}
|
|
5019
|
-
function
|
|
5106
|
+
function pC(g) {
|
|
5020
5107
|
return g?.name === "sharding_indexed";
|
|
5021
5108
|
}
|
|
5022
5109
|
function UB(g) {
|
|
5023
5110
|
return (g.data_type === "uint64" || g.data_type === "int64") && g.fill_value != null ? BigInt(g.fill_value) : g.fill_value;
|
|
5024
5111
|
}
|
|
5025
|
-
const Vg =
|
|
5026
|
-
function
|
|
5112
|
+
const Vg = mC();
|
|
5113
|
+
function mC() {
|
|
5027
5114
|
const g = new Uint32Array([305419896]);
|
|
5028
5115
|
return new Uint8Array(g.buffer, g.byteOffset, g.byteLength)[0] !== 18;
|
|
5029
5116
|
}
|
|
@@ -5069,7 +5156,7 @@ class Fg {
|
|
|
5069
5156
|
return new Uint8Array(A.buffer, A.byteOffset, A.byteLength - 4);
|
|
5070
5157
|
}
|
|
5071
5158
|
}
|
|
5072
|
-
function
|
|
5159
|
+
function uC(g, A) {
|
|
5073
5160
|
if (Number.isNaN(A))
|
|
5074
5161
|
throw new Error("JsonCodec allow_nan is false but NaN was encountered during encoding.");
|
|
5075
5162
|
if (A === Number.POSITIVE_INFINITY)
|
|
@@ -5078,7 +5165,7 @@ function pC(g, A) {
|
|
|
5078
5165
|
throw new Error("JsonCodec allow_nan is false but -Infinity was encountered during encoding.");
|
|
5079
5166
|
return A;
|
|
5080
5167
|
}
|
|
5081
|
-
function
|
|
5168
|
+
function TC(g, A) {
|
|
5082
5169
|
return A instanceof Object && !Array.isArray(A) ? Object.keys(A).sort().reduce((I, B) => (I[B] = A[B], I), {}) : A;
|
|
5083
5170
|
}
|
|
5084
5171
|
class ng {
|
|
@@ -5111,15 +5198,15 @@ class ng {
|
|
|
5111
5198
|
const o = [];
|
|
5112
5199
|
if (!C)
|
|
5113
5200
|
throw new Error("JsonCodec does not yet support skipping the check for circular references during encoding.");
|
|
5114
|
-
E || o.push(
|
|
5201
|
+
E || o.push(uC), i && o.push(TC);
|
|
5115
5202
|
const a = Array.from(A.data);
|
|
5116
5203
|
a.push("|O"), a.push(A.shape);
|
|
5117
5204
|
let D;
|
|
5118
5205
|
o.length && (D = (y, G) => {
|
|
5119
|
-
let
|
|
5120
|
-
for (let
|
|
5121
|
-
|
|
5122
|
-
return
|
|
5206
|
+
let S = G;
|
|
5207
|
+
for (let R of o)
|
|
5208
|
+
S = R(y, S);
|
|
5209
|
+
return S;
|
|
5123
5210
|
});
|
|
5124
5211
|
let h = JSON.stringify(a, D, I);
|
|
5125
5212
|
return Q && (h = h.replace(/[\u007F-\uFFFF]/g, (y) => {
|
|
@@ -5148,7 +5235,7 @@ function Xg(g) {
|
|
|
5148
5235
|
}
|
|
5149
5236
|
}) : g;
|
|
5150
5237
|
}
|
|
5151
|
-
function
|
|
5238
|
+
function WC(g, A) {
|
|
5152
5239
|
let I;
|
|
5153
5240
|
return g.data instanceof wg || g.data instanceof aI ? I = new g.constructor(
|
|
5154
5241
|
// @ts-expect-error
|
|
@@ -5160,8 +5247,8 @@ function uC(g, A) {
|
|
|
5160
5247
|
stride: RA(g.shape, A)
|
|
5161
5248
|
};
|
|
5162
5249
|
}
|
|
5163
|
-
function
|
|
5164
|
-
let I =
|
|
5250
|
+
function xC(g, A) {
|
|
5251
|
+
let I = WC(g, A), B = g.shape.length, Q = g.data.length, C = Array(B).fill(0), E = Xg(g.data), i = Xg(I.data);
|
|
5165
5252
|
for (let o = 0; o < Q; o++) {
|
|
5166
5253
|
let a = 0;
|
|
5167
5254
|
for (let D = 0; D < B; D++)
|
|
@@ -5176,7 +5263,7 @@ function TC(g, A) {
|
|
|
5176
5263
|
}
|
|
5177
5264
|
return I;
|
|
5178
5265
|
}
|
|
5179
|
-
function
|
|
5266
|
+
function bC(g) {
|
|
5180
5267
|
if (!g.stride)
|
|
5181
5268
|
return "C";
|
|
5182
5269
|
let A = RA(g.shape, "C");
|
|
@@ -5192,7 +5279,7 @@ class eg {
|
|
|
5192
5279
|
return new eg(A);
|
|
5193
5280
|
}
|
|
5194
5281
|
encode(A) {
|
|
5195
|
-
return
|
|
5282
|
+
return bC(A) === this.configuration?.order ? A : xC(A, this.configuration?.order ?? "C");
|
|
5196
5283
|
}
|
|
5197
5284
|
decode(A) {
|
|
5198
5285
|
return A;
|
|
@@ -5220,10 +5307,10 @@ class rg {
|
|
|
5220
5307
|
return { data: Q, shape: this.#A, stride: this.#I };
|
|
5221
5308
|
}
|
|
5222
5309
|
}
|
|
5223
|
-
function
|
|
5310
|
+
function ZC() {
|
|
5224
5311
|
return (/* @__PURE__ */ new Map()).set("blosc", () => import("./blosc-BOWv2fO7.js").then((g) => g.default)).set("gzip", () => import("./gzip-DchmmbTG.js").then((g) => g.default)).set("lz4", () => import("./lz4-DUlZKApi.js").then((g) => g.default)).set("zlib", () => import("./zlib-Din1wO0I.js").then((g) => g.default)).set("zstd", () => import("./zstd-DnzmycJs.js").then((g) => g.default)).set("transpose", () => eg).set("bytes", () => dI).set("crc32c", () => Fg).set("vlen-utf8", () => rg).set("json2", () => ng).set("bitround", () => Gg);
|
|
5225
5312
|
}
|
|
5226
|
-
const
|
|
5313
|
+
const PC = ZC();
|
|
5227
5314
|
function Ag(g) {
|
|
5228
5315
|
let A;
|
|
5229
5316
|
return {
|
|
@@ -5249,7 +5336,7 @@ function Ag(g) {
|
|
|
5249
5336
|
}
|
|
5250
5337
|
async function jg(g) {
|
|
5251
5338
|
let A = g.codecs.map(async (C) => {
|
|
5252
|
-
let E = await
|
|
5339
|
+
let E = await PC.get(C.name)?.();
|
|
5253
5340
|
if (!E)
|
|
5254
5341
|
throw new Error(`Unknown codec: ${C.name}`);
|
|
5255
5342
|
return { Codec: E, meta: C };
|
|
@@ -5268,17 +5355,17 @@ async function jg(g) {
|
|
|
5268
5355
|
}
|
|
5269
5356
|
}
|
|
5270
5357
|
if (!B) {
|
|
5271
|
-
if (!
|
|
5358
|
+
if (!OC(g))
|
|
5272
5359
|
throw new Error(`Cannot encode ${g.data_type} to bytes without a codec`);
|
|
5273
5360
|
B = dI.fromConfig({ endian: "little" }, g);
|
|
5274
5361
|
}
|
|
5275
5362
|
return { array_to_array: I, array_to_bytes: B, bytes_to_bytes: Q };
|
|
5276
5363
|
}
|
|
5277
|
-
function
|
|
5364
|
+
function OC(g) {
|
|
5278
5365
|
return g.data_type !== "v2:object";
|
|
5279
5366
|
}
|
|
5280
5367
|
const zg = 18446744073709551615n;
|
|
5281
|
-
function
|
|
5368
|
+
function VC(g, A, I, B) {
|
|
5282
5369
|
if (g.store.getRange === void 0)
|
|
5283
5370
|
throw new Error("Store does not support range requests");
|
|
5284
5371
|
let Q = g.store.getRange.bind(g.store), C = A.map((o, a) => o / B.chunk_shape[a]), E = Ag({
|
|
@@ -5287,22 +5374,22 @@ function PC(g, A, I, B) {
|
|
|
5287
5374
|
codecs: B.index_codecs
|
|
5288
5375
|
}), i = {};
|
|
5289
5376
|
return async (o) => {
|
|
5290
|
-
let a = o.map((M,
|
|
5377
|
+
let a = o.map((M, N) => Math.floor(M / C[N])), D = g.resolve(I(a)).path, h;
|
|
5291
5378
|
if (D in i)
|
|
5292
5379
|
h = i[D];
|
|
5293
5380
|
else {
|
|
5294
|
-
let M = 4,
|
|
5295
|
-
suffixLength:
|
|
5381
|
+
let M = 4, N = 16 * C.reduce((J, L) => J * L, 1), K = await Q(D, {
|
|
5382
|
+
suffixLength: N + M
|
|
5296
5383
|
});
|
|
5297
|
-
h = i[D] =
|
|
5384
|
+
h = i[D] = K ? await E.decode(K) : null;
|
|
5298
5385
|
}
|
|
5299
5386
|
if (h === null)
|
|
5300
5387
|
return;
|
|
5301
|
-
let { data: y, shape: G, stride:
|
|
5302
|
-
if (!(e === zg &&
|
|
5388
|
+
let { data: y, shape: G, stride: S } = h, R = o.map((M, N) => M % G[N]).reduce((M, N, K) => M + N * S[K], 0), e = y[R], F = y[R + 1];
|
|
5389
|
+
if (!(e === zg && F === zg))
|
|
5303
5390
|
return Q(D, {
|
|
5304
5391
|
offset: Number(e),
|
|
5305
|
-
length: Number(
|
|
5392
|
+
length: Number(F)
|
|
5306
5393
|
});
|
|
5307
5394
|
};
|
|
5308
5395
|
}
|
|
@@ -5328,12 +5415,12 @@ class Sg extends _ {
|
|
|
5328
5415
|
}
|
|
5329
5416
|
}
|
|
5330
5417
|
const TA = Symbol("zarrita.context");
|
|
5331
|
-
function
|
|
5418
|
+
function vC(g) {
|
|
5332
5419
|
return g[TA];
|
|
5333
5420
|
}
|
|
5334
|
-
function
|
|
5335
|
-
let { configuration: I } = A.codecs.find(
|
|
5336
|
-
encode_chunk_key:
|
|
5421
|
+
function XC(g, A) {
|
|
5422
|
+
let { configuration: I } = A.codecs.find(pC) ?? {}, B = {
|
|
5423
|
+
encode_chunk_key: KC(A.chunk_key_encoding),
|
|
5337
5424
|
TypedArray: cB(A.data_type),
|
|
5338
5425
|
fill_value: A.fill_value
|
|
5339
5426
|
};
|
|
@@ -5351,7 +5438,7 @@ function VC(g, A) {
|
|
|
5351
5438
|
get_strides(E, i) {
|
|
5352
5439
|
return RA(E, i ?? C);
|
|
5353
5440
|
},
|
|
5354
|
-
get_chunk_bytes:
|
|
5441
|
+
get_chunk_bytes: VC(g, A.chunk_grid.configuration.chunk_shape, B.encode_chunk_key, I)
|
|
5355
5442
|
};
|
|
5356
5443
|
}
|
|
5357
5444
|
let Q = $I(A.codecs);
|
|
@@ -5381,7 +5468,7 @@ let rI = class extends _ {
|
|
|
5381
5468
|
super(A, I), this.#A = {
|
|
5382
5469
|
...B,
|
|
5383
5470
|
fill_value: UB(B)
|
|
5384
|
-
}, this[TA] =
|
|
5471
|
+
}, this[TA] = XC(this, B);
|
|
5385
5472
|
}
|
|
5386
5473
|
get attrs() {
|
|
5387
5474
|
return this.#A.attributes;
|
|
@@ -5425,10 +5512,10 @@ let rI = class extends _ {
|
|
|
5425
5512
|
* ```
|
|
5426
5513
|
*/
|
|
5427
5514
|
is(A) {
|
|
5428
|
-
return
|
|
5515
|
+
return fC(this.dtype, A);
|
|
5429
5516
|
}
|
|
5430
|
-
}, HI =
|
|
5431
|
-
function
|
|
5517
|
+
}, HI = jC();
|
|
5518
|
+
function jC() {
|
|
5432
5519
|
let g = /* @__PURE__ */ new WeakMap();
|
|
5433
5520
|
function A(I) {
|
|
5434
5521
|
let B = g.get(I) ?? { v2: 0, v3: 0 };
|
|
@@ -5444,13 +5531,13 @@ function vC() {
|
|
|
5444
5531
|
}
|
|
5445
5532
|
};
|
|
5446
5533
|
}
|
|
5447
|
-
async function
|
|
5534
|
+
async function zC(g) {
|
|
5448
5535
|
let A = await g.store.get(g.resolve(".zattrs").path);
|
|
5449
5536
|
return A ? DI(A) : {};
|
|
5450
5537
|
}
|
|
5451
|
-
async function
|
|
5538
|
+
async function _C(g, A = {}) {
|
|
5452
5539
|
let I = "store" in g ? g : new _(g), B = {};
|
|
5453
|
-
return (A.attrs ?? !0) && (B = await
|
|
5540
|
+
return (A.attrs ?? !0) && (B = await zC(I)), A.kind === "array" ? _g(I, B) : A.kind === "group" ? $g(I, B) : _g(I, B).catch((Q) => {
|
|
5454
5541
|
if (Q instanceof oI)
|
|
5455
5542
|
return $g(I, B);
|
|
5456
5543
|
throw Q;
|
|
@@ -5462,7 +5549,7 @@ async function _g(g, A) {
|
|
|
5462
5549
|
throw new oI("v2 array", {
|
|
5463
5550
|
cause: new tg(I)
|
|
5464
5551
|
});
|
|
5465
|
-
return HI.increment(g.store, "v2"), new rI(g.store, g.path,
|
|
5552
|
+
return HI.increment(g.store, "v2"), new rI(g.store, g.path, qC(DI(B), A));
|
|
5466
5553
|
}
|
|
5467
5554
|
async function $g(g, A) {
|
|
5468
5555
|
let { path: I } = g.resolve(".zgroup"), B = await g.store.get(I);
|
|
@@ -5470,9 +5557,9 @@ async function $g(g, A) {
|
|
|
5470
5557
|
throw new oI("v2 group", {
|
|
5471
5558
|
cause: new tg(I)
|
|
5472
5559
|
});
|
|
5473
|
-
return HI.increment(g.store, "v2"), new Sg(g.store, g.path,
|
|
5560
|
+
return HI.increment(g.store, "v2"), new Sg(g.store, g.path, lC(DI(B), A));
|
|
5474
5561
|
}
|
|
5475
|
-
async function
|
|
5562
|
+
async function $C(g) {
|
|
5476
5563
|
let { store: A, path: I } = g.resolve("zarr.json"), B = await g.store.get(I);
|
|
5477
5564
|
if (!B)
|
|
5478
5565
|
throw new oI("v3 array or group", {
|
|
@@ -5481,8 +5568,8 @@ async function zC(g) {
|
|
|
5481
5568
|
let Q = DI(B);
|
|
5482
5569
|
return Q.node_type === "array" && (Q.fill_value = UB(Q)), Q.node_type === "array" ? new rI(A, g.path, Q) : new Sg(A, g.path, Q);
|
|
5483
5570
|
}
|
|
5484
|
-
async function
|
|
5485
|
-
let I = "store" in g ? g : new _(g), B = await
|
|
5571
|
+
async function AE(g, A = {}) {
|
|
5572
|
+
let I = "store" in g ? g : new _(g), B = await $C(I);
|
|
5486
5573
|
if (HI.increment(I.store, "v3"), A.kind === void 0 || A.kind === "array" && B instanceof rI || A.kind === "group" && B instanceof Sg)
|
|
5487
5574
|
return B;
|
|
5488
5575
|
let Q = B instanceof rI ? "array" : "group";
|
|
@@ -5496,8 +5583,8 @@ async function z(g, A = {}) {
|
|
|
5496
5583
|
throw E;
|
|
5497
5584
|
});
|
|
5498
5585
|
}
|
|
5499
|
-
z.v2 =
|
|
5500
|
-
z.v3 =
|
|
5586
|
+
z.v2 = _C;
|
|
5587
|
+
z.v3 = AE;
|
|
5501
5588
|
function kB(g, A, I, B = {}) {
|
|
5502
5589
|
return A !== void 0 && I !== void 0 && (B = {
|
|
5503
5590
|
...B,
|
|
@@ -5507,7 +5594,7 @@ function kB(g, A, I, B = {}) {
|
|
|
5507
5594
|
}
|
|
5508
5595
|
}), fetch(g, B);
|
|
5509
5596
|
}
|
|
5510
|
-
function
|
|
5597
|
+
function IE(g, A) {
|
|
5511
5598
|
return {
|
|
5512
5599
|
...g,
|
|
5513
5600
|
...A,
|
|
@@ -5530,7 +5617,7 @@ async function IB(g) {
|
|
|
5530
5617
|
throw new Error(`Unexpected response status ${g.status} ${g.statusText}`);
|
|
5531
5618
|
}
|
|
5532
5619
|
}
|
|
5533
|
-
async function
|
|
5620
|
+
async function gE(g, A, I, B) {
|
|
5534
5621
|
if (B)
|
|
5535
5622
|
return fetch(g, {
|
|
5536
5623
|
...I,
|
|
@@ -5550,7 +5637,7 @@ class sI {
|
|
|
5550
5637
|
this.url = A, this.#A = I.overrides ?? {}, this.#I = I.useSuffixRequest ?? !1;
|
|
5551
5638
|
}
|
|
5552
5639
|
#g(A) {
|
|
5553
|
-
return
|
|
5640
|
+
return IE(this.#A, A);
|
|
5554
5641
|
}
|
|
5555
5642
|
async get(A, I = {}) {
|
|
5556
5643
|
let B = AB(this.url, A).href, Q = await fetch(B, this.#g(I));
|
|
@@ -5558,15 +5645,15 @@ class sI {
|
|
|
5558
5645
|
}
|
|
5559
5646
|
async getRange(A, I, B = {}) {
|
|
5560
5647
|
let Q = AB(this.url, A), C = this.#g(B), E;
|
|
5561
|
-
return "suffixLength" in I ? E = await
|
|
5648
|
+
return "suffixLength" in I ? E = await gE(Q, I.suffixLength, C, this.#I) : E = await kB(Q, I.offset, I.length, C), IB(E);
|
|
5562
5649
|
}
|
|
5563
5650
|
}
|
|
5564
|
-
function*
|
|
5651
|
+
function* BE(g, A, I = 1) {
|
|
5565
5652
|
A === void 0 && (A = g, g = 0);
|
|
5566
5653
|
for (let B = g; B < A; B += I)
|
|
5567
5654
|
yield B;
|
|
5568
5655
|
}
|
|
5569
|
-
function*
|
|
5656
|
+
function* QE(...g) {
|
|
5570
5657
|
if (g.length === 0)
|
|
5571
5658
|
return;
|
|
5572
5659
|
const A = g.map((B) => B[Symbol.iterator]()), I = A.map((B) => B.next());
|
|
@@ -5581,7 +5668,7 @@ function* gE(...g) {
|
|
|
5581
5668
|
I[B] = A[B].next();
|
|
5582
5669
|
}
|
|
5583
5670
|
}
|
|
5584
|
-
function
|
|
5671
|
+
function CE({ start: g, stop: A, step: I }, B) {
|
|
5585
5672
|
if (I === 0)
|
|
5586
5673
|
throw new Error("slice step cannot be zero");
|
|
5587
5674
|
I = I ?? 1;
|
|
@@ -5595,7 +5682,7 @@ function SI(g, A, I = null) {
|
|
|
5595
5682
|
step: I
|
|
5596
5683
|
};
|
|
5597
5684
|
}
|
|
5598
|
-
function
|
|
5685
|
+
function EE() {
|
|
5599
5686
|
const g = [];
|
|
5600
5687
|
return {
|
|
5601
5688
|
add: (A) => g.push(A()),
|
|
@@ -5607,28 +5694,28 @@ class Rg extends Error {
|
|
|
5607
5694
|
super(A), this.name = "IndexError";
|
|
5608
5695
|
}
|
|
5609
5696
|
}
|
|
5610
|
-
function
|
|
5697
|
+
function iE(g, A) {
|
|
5611
5698
|
throw new Rg(`too many indicies for array; expected ${A.length}, got ${g.length}`);
|
|
5612
5699
|
}
|
|
5613
|
-
function
|
|
5700
|
+
function oE(g) {
|
|
5614
5701
|
throw new Rg(`index out of bounds for dimension with length ${g}`);
|
|
5615
5702
|
}
|
|
5616
|
-
function
|
|
5703
|
+
function aE() {
|
|
5617
5704
|
throw new Rg("only slices with step >= 1 are supported");
|
|
5618
5705
|
}
|
|
5619
|
-
function
|
|
5620
|
-
g.length > A.length &&
|
|
5706
|
+
function DE(g, A) {
|
|
5707
|
+
g.length > A.length && iE(g, A);
|
|
5621
5708
|
}
|
|
5622
|
-
function
|
|
5623
|
-
return g = Math.trunc(g), g < 0 && (g = A + g), (g >= A || g < 0) &&
|
|
5709
|
+
function sE(g, A) {
|
|
5710
|
+
return g = Math.trunc(g), g < 0 && (g = A + g), (g >= A || g < 0) && oE(A), g;
|
|
5624
5711
|
}
|
|
5625
|
-
class
|
|
5712
|
+
class hE {
|
|
5626
5713
|
dim_sel;
|
|
5627
5714
|
dim_len;
|
|
5628
5715
|
dim_chunk_len;
|
|
5629
5716
|
nitems;
|
|
5630
5717
|
constructor({ dim_sel: A, dim_len: I, dim_chunk_len: B }) {
|
|
5631
|
-
A =
|
|
5718
|
+
A = sE(A, I), this.dim_sel = A, this.dim_len = I, this.dim_chunk_len = B, this.nitems = 1;
|
|
5632
5719
|
}
|
|
5633
5720
|
*[Symbol.iterator]() {
|
|
5634
5721
|
const A = Math.floor(this.dim_sel / this.dim_chunk_len), I = A * this.dim_chunk_len, B = this.dim_sel - I;
|
|
@@ -5644,12 +5731,12 @@ class gB {
|
|
|
5644
5731
|
nitems;
|
|
5645
5732
|
nchunks;
|
|
5646
5733
|
constructor({ dim_sel: A, dim_len: I, dim_chunk_len: B }) {
|
|
5647
|
-
const [Q, C, E] =
|
|
5648
|
-
this.start = Q, this.stop = C, this.step = E, this.step < 1 &&
|
|
5734
|
+
const [Q, C, E] = CE(A, I);
|
|
5735
|
+
this.start = Q, this.stop = C, this.step = E, this.step < 1 && aE(), this.dim_len = I, this.dim_chunk_len = B, this.nitems = Math.max(0, Math.ceil((this.stop - this.start) / this.step)), this.nchunks = Math.ceil(this.dim_len / this.dim_chunk_len);
|
|
5649
5736
|
}
|
|
5650
5737
|
*[Symbol.iterator]() {
|
|
5651
5738
|
const A = Math.floor(this.start / this.dim_chunk_len), I = Math.ceil(this.stop / this.dim_chunk_len);
|
|
5652
|
-
for (const B of
|
|
5739
|
+
for (const B of BE(A, I)) {
|
|
5653
5740
|
const Q = B * this.dim_chunk_len, C = Math.min(this.dim_len, (B + 1) * this.dim_chunk_len), E = C - Q;
|
|
5654
5741
|
let i = 0, o = 0;
|
|
5655
5742
|
if (this.start < Q) {
|
|
@@ -5670,15 +5757,15 @@ class gB {
|
|
|
5670
5757
|
}
|
|
5671
5758
|
}
|
|
5672
5759
|
}
|
|
5673
|
-
function
|
|
5760
|
+
function yE(g, A) {
|
|
5674
5761
|
let I = [];
|
|
5675
|
-
return g === null ? I = A.map((B) => SI(null)) : Array.isArray(g) && (I = g.map((B) => B ?? SI(null))),
|
|
5762
|
+
return g === null ? I = A.map((B) => SI(null)) : Array.isArray(g) && (I = g.map((B) => B ?? SI(null))), DE(I, A), I;
|
|
5676
5763
|
}
|
|
5677
|
-
class
|
|
5764
|
+
class tE {
|
|
5678
5765
|
dim_indexers;
|
|
5679
5766
|
shape;
|
|
5680
5767
|
constructor({ selection: A, shape: I, chunk_shape: B }) {
|
|
5681
|
-
this.dim_indexers =
|
|
5768
|
+
this.dim_indexers = yE(A, I).map((Q, C) => new (typeof Q == "number" ? hE : gB)({
|
|
5682
5769
|
// @ts-expect-error ts inference not strong enough to know correct chunk
|
|
5683
5770
|
dim_sel: Q,
|
|
5684
5771
|
dim_len: I[C],
|
|
@@ -5686,27 +5773,27 @@ class hE {
|
|
|
5686
5773
|
})), this.shape = this.dim_indexers.filter((Q) => Q instanceof gB).map((Q) => Q.nitems);
|
|
5687
5774
|
}
|
|
5688
5775
|
*[Symbol.iterator]() {
|
|
5689
|
-
for (const A of
|
|
5776
|
+
for (const A of QE(...this.dim_indexers)) {
|
|
5690
5777
|
const I = A.map((Q) => Q.dim_chunk_ix), B = A.map((Q) => "dim_out_sel" in Q ? { from: Q.dim_chunk_sel, to: Q.dim_out_sel } : { from: Q.dim_chunk_sel, to: null });
|
|
5691
5778
|
yield { chunk_coords: I, mapping: B };
|
|
5692
5779
|
}
|
|
5693
5780
|
}
|
|
5694
5781
|
}
|
|
5695
|
-
function
|
|
5782
|
+
function GE(g, A) {
|
|
5696
5783
|
return "get" in g ? g.get(A) : g[A];
|
|
5697
5784
|
}
|
|
5698
|
-
async function
|
|
5699
|
-
let Q =
|
|
5785
|
+
async function wE(g, A, I, B) {
|
|
5786
|
+
let Q = vC(g), C = new tE({
|
|
5700
5787
|
selection: A,
|
|
5701
5788
|
shape: g.shape,
|
|
5702
5789
|
chunk_shape: g.chunks
|
|
5703
|
-
}), E = B.prepare(new Q.TypedArray(C.shape.reduce((o, a) => o * a, 1)), C.shape, Q.get_strides(C.shape, I.order)), i = I.create_queue?.() ??
|
|
5790
|
+
}), E = B.prepare(new Q.TypedArray(C.shape.reduce((o, a) => o * a, 1)), C.shape, Q.get_strides(C.shape, I.order)), i = I.create_queue?.() ?? EE();
|
|
5704
5791
|
for (const { chunk_coords: o, mapping: a } of C)
|
|
5705
5792
|
i.add(async () => {
|
|
5706
5793
|
let { data: D, shape: h, stride: y } = await g.getChunk(o, I.opts), G = B.prepare(D, h, y);
|
|
5707
5794
|
B.set_from_chunk(E, G, a);
|
|
5708
5795
|
});
|
|
5709
|
-
return await i.onIdle(), C.shape.length === 0 ?
|
|
5796
|
+
return await i.onIdle(), C.shape.length === 0 ? GE(E.data, 0) : E;
|
|
5710
5797
|
}
|
|
5711
5798
|
function Ng(g, A = 0, I) {
|
|
5712
5799
|
let B = I ?? g.length - A;
|
|
@@ -5736,30 +5823,30 @@ function PI(g) {
|
|
|
5736
5823
|
bytes_per_element: g.data.BYTES_PER_ELEMENT
|
|
5737
5824
|
};
|
|
5738
5825
|
}
|
|
5739
|
-
function
|
|
5826
|
+
function FE(g) {
|
|
5740
5827
|
return "chars" in g ? g.constructor.bind(null, g.chars) : g.constructor;
|
|
5741
5828
|
}
|
|
5742
|
-
function
|
|
5829
|
+
function nE(g, A) {
|
|
5743
5830
|
if (globalThis.Array.isArray(g.data))
|
|
5744
5831
|
return Ng([A]);
|
|
5745
|
-
let I =
|
|
5832
|
+
let I = FE(g.data), B = new I([A]);
|
|
5746
5833
|
return new Uint8Array(B.buffer, B.byteOffset, B.byteLength);
|
|
5747
5834
|
}
|
|
5748
|
-
const
|
|
5835
|
+
const eE = {
|
|
5749
5836
|
prepare(g, A, I) {
|
|
5750
5837
|
return { data: g, shape: A, stride: I };
|
|
5751
5838
|
},
|
|
5752
5839
|
set_scalar(g, A, I) {
|
|
5753
5840
|
let B = PI(g);
|
|
5754
|
-
Ig(B, A,
|
|
5841
|
+
Ig(B, A, nE(g, I), B.bytes_per_element);
|
|
5755
5842
|
},
|
|
5756
5843
|
set_from_chunk(g, A, I) {
|
|
5757
5844
|
let B = PI(g);
|
|
5758
5845
|
GI(B, PI(A), B.bytes_per_element, I);
|
|
5759
5846
|
}
|
|
5760
5847
|
};
|
|
5761
|
-
async function
|
|
5762
|
-
return
|
|
5848
|
+
async function rE(g, A = null, I = {}) {
|
|
5849
|
+
return wE(g, A, I, eE);
|
|
5763
5850
|
}
|
|
5764
5851
|
function LB(g, A, I) {
|
|
5765
5852
|
return I < 0 && A < g ? Math.floor((g - A - 1) / -I) + 1 : g < A ? Math.floor((A - g - 1) / I) + 1 : 0;
|
|
@@ -5801,8 +5888,8 @@ function GI(g, A, I, B) {
|
|
|
5801
5888
|
}
|
|
5802
5889
|
if (Q.to === null) {
|
|
5803
5890
|
if (C.length === 0) {
|
|
5804
|
-
let
|
|
5805
|
-
g.data.set(A.data.subarray(
|
|
5891
|
+
let F = Q.from * I;
|
|
5892
|
+
g.data.set(A.data.subarray(F, F + I), 0);
|
|
5806
5893
|
return;
|
|
5807
5894
|
}
|
|
5808
5895
|
GI(g, {
|
|
@@ -5811,29 +5898,29 @@ function GI(g, A, I, B) {
|
|
|
5811
5898
|
}, I, C);
|
|
5812
5899
|
return;
|
|
5813
5900
|
}
|
|
5814
|
-
const [D, h, y] = Q.to, [G,
|
|
5901
|
+
const [D, h, y] = Q.to, [G, S, R] = Q.from, e = LB(D, h, y);
|
|
5815
5902
|
if (C.length === 0) {
|
|
5816
|
-
if (y === 1 &&
|
|
5817
|
-
let
|
|
5818
|
-
g.data.set(A.data.subarray(
|
|
5903
|
+
if (y === 1 && R === 1 && E === 1 && o === 1) {
|
|
5904
|
+
let F = G * I, M = e * I;
|
|
5905
|
+
g.data.set(A.data.subarray(F, F + M), D * I);
|
|
5819
5906
|
return;
|
|
5820
5907
|
}
|
|
5821
|
-
for (let
|
|
5822
|
-
let M = o * (G +
|
|
5823
|
-
g.data.set(A.data.subarray(M, M + I), E * (D + y *
|
|
5908
|
+
for (let F = 0; F < e; F++) {
|
|
5909
|
+
let M = o * (G + R * F) * I;
|
|
5910
|
+
g.data.set(A.data.subarray(M, M + I), E * (D + y * F) * I);
|
|
5824
5911
|
}
|
|
5825
5912
|
return;
|
|
5826
5913
|
}
|
|
5827
|
-
for (let
|
|
5914
|
+
for (let F = 0; F < e; F++)
|
|
5828
5915
|
GI({
|
|
5829
|
-
data: g.data.subarray(E * (D +
|
|
5916
|
+
data: g.data.subarray(E * (D + F * y) * I),
|
|
5830
5917
|
stride: i
|
|
5831
5918
|
}, {
|
|
5832
|
-
data: A.data.subarray(o * (G +
|
|
5919
|
+
data: A.data.subarray(o * (G + F * R) * I),
|
|
5833
5920
|
stride: a
|
|
5834
5921
|
}, I, C);
|
|
5835
5922
|
}
|
|
5836
|
-
async function
|
|
5923
|
+
async function SE(g, A) {
|
|
5837
5924
|
const I = A.split("/"), B = I.pop();
|
|
5838
5925
|
if (!B)
|
|
5839
5926
|
throw new Error("Invalid path");
|
|
@@ -5850,7 +5937,7 @@ class cg {
|
|
|
5850
5937
|
return this.#A;
|
|
5851
5938
|
}
|
|
5852
5939
|
async get(A) {
|
|
5853
|
-
const I = await
|
|
5940
|
+
const I = await SE(this.#A, A.slice(1)).catch(
|
|
5854
5941
|
() => {
|
|
5855
5942
|
}
|
|
5856
5943
|
);
|
|
@@ -5879,7 +5966,7 @@ async function hI(g, A) {
|
|
|
5879
5966
|
throw new Error(`Failed to open Zarr group at ${g}`);
|
|
5880
5967
|
}
|
|
5881
5968
|
}
|
|
5882
|
-
async function
|
|
5969
|
+
async function RE(g, A) {
|
|
5883
5970
|
if (A === "v2")
|
|
5884
5971
|
try {
|
|
5885
5972
|
return z.v2(g, { kind: "array", attrs: !1 });
|
|
@@ -5898,7 +5985,7 @@ async function rE(g, A) {
|
|
|
5898
5985
|
throw new Error(`Failed to open Zarr array at ${g}`);
|
|
5899
5986
|
}
|
|
5900
5987
|
}
|
|
5901
|
-
async function
|
|
5988
|
+
async function NE(g) {
|
|
5902
5989
|
let A;
|
|
5903
5990
|
switch (g.type) {
|
|
5904
5991
|
case "fetch": {
|
|
@@ -5920,16 +6007,15 @@ async function SE(g) {
|
|
|
5920
6007
|
}
|
|
5921
6008
|
}
|
|
5922
6009
|
const I = g.arrayPath ? A.resolve(g.arrayPath) : A;
|
|
5923
|
-
return
|
|
6010
|
+
return RE(I, g.zarrVersion);
|
|
5924
6011
|
}
|
|
5925
|
-
function
|
|
6012
|
+
function cE(g, A, I) {
|
|
5926
6013
|
if (g.store instanceof sI)
|
|
5927
6014
|
return {
|
|
5928
6015
|
type: "fetch",
|
|
5929
6016
|
arrayPath: A,
|
|
5930
6017
|
zarrVersion: I,
|
|
5931
|
-
url: g.store.url.toString()
|
|
5932
|
-
fetchOptions: B
|
|
6018
|
+
url: g.store.url.toString()
|
|
5933
6019
|
};
|
|
5934
6020
|
if (g.store instanceof cg)
|
|
5935
6021
|
return {
|
|
@@ -9488,7 +9574,7 @@ return ret;
|
|
|
9488
9574
|
});
|
|
9489
9575
|
//# sourceMappingURL=worker_kernel-BYKAkuPZ.js.map
|
|
9490
9576
|
`, BB = typeof self < "u" && self.Blob && new Blob(["URL.revokeObjectURL(import.meta.url);", JB], { type: "text/javascript;charset=utf-8" });
|
|
9491
|
-
function
|
|
9577
|
+
function UE(g) {
|
|
9492
9578
|
let A;
|
|
9493
9579
|
try {
|
|
9494
9580
|
if (A = BB && (self.URL || self.webkitURL).createObjectURL(BB), !A) throw "";
|
|
@@ -9509,20 +9595,20 @@ function NE(g) {
|
|
|
9509
9595
|
);
|
|
9510
9596
|
}
|
|
9511
9597
|
}
|
|
9512
|
-
const
|
|
9513
|
-
let gA = [],
|
|
9598
|
+
const kE = Math.min(navigator.hardwareConcurrency, 8);
|
|
9599
|
+
let gA = [], LE = 0, YB = 0;
|
|
9514
9600
|
const NA = /* @__PURE__ */ new Map(), RI = /* @__PURE__ */ new Set();
|
|
9515
9601
|
function MB(g) {
|
|
9516
9602
|
const A = gA.find((I) => I.worker === g);
|
|
9517
|
-
return A ||
|
|
9603
|
+
return A || c.error(
|
|
9518
9604
|
"ZarrWorker",
|
|
9519
9605
|
"Worker not found in pool - this should not happen"
|
|
9520
9606
|
), A;
|
|
9521
9607
|
}
|
|
9522
|
-
function
|
|
9608
|
+
function JE(g, A) {
|
|
9523
9609
|
const { id: I, success: B } = g.data, Q = NA.get(I);
|
|
9524
9610
|
if (!Q) {
|
|
9525
|
-
RI.has(I) ? RI.delete(I) :
|
|
9611
|
+
RI.has(I) ? RI.delete(I) : c.warn(
|
|
9526
9612
|
"ZarrWorker",
|
|
9527
9613
|
`Received response for unknown message ID ${I}:`,
|
|
9528
9614
|
g.data
|
|
@@ -9531,20 +9617,20 @@ function kE(g, A) {
|
|
|
9531
9617
|
}
|
|
9532
9618
|
NA.delete(I), Q.abortListener && Q.abortSignal && Q.abortSignal.removeEventListener("abort", Q.abortListener);
|
|
9533
9619
|
const C = MB(A);
|
|
9534
|
-
C && C.pendingCount > 0 ? C.pendingCount-- : C &&
|
|
9620
|
+
C && C.pendingCount > 0 ? C.pendingCount-- : C && c.error(
|
|
9535
9621
|
"ZarrWorker",
|
|
9536
9622
|
"Received message but no pending tasks - this should not happen"
|
|
9537
9623
|
), B && g.data.type === "getChunk" ? Q.resolve(g.data.chunk) : B || Q.reject(new Error(g.data.error || "Unknown worker error"));
|
|
9538
9624
|
}
|
|
9539
9625
|
function QB(g, A) {
|
|
9540
9626
|
if (g instanceof MessageEvent) {
|
|
9541
|
-
|
|
9627
|
+
c.error(
|
|
9542
9628
|
"ZarrWorker",
|
|
9543
9629
|
"Message serialization error occurred - worker remains active"
|
|
9544
9630
|
);
|
|
9545
9631
|
return;
|
|
9546
9632
|
}
|
|
9547
|
-
|
|
9633
|
+
c.error(
|
|
9548
9634
|
"ZarrWorker",
|
|
9549
9635
|
"Worker failed - replacing worker and canceling its in-flight messages",
|
|
9550
9636
|
g.message
|
|
@@ -9564,26 +9650,26 @@ function QB(g, A) {
|
|
|
9564
9650
|
worker: Q,
|
|
9565
9651
|
pendingCount: 0,
|
|
9566
9652
|
workerId: YB++
|
|
9567
|
-
}),
|
|
9653
|
+
}), c.debug("ZarrWorker", "Replacement worker created successfully");
|
|
9568
9654
|
} catch (Q) {
|
|
9569
|
-
|
|
9655
|
+
c.error("ZarrWorker", "Failed to create replacement worker", Q);
|
|
9570
9656
|
}
|
|
9571
9657
|
}
|
|
9572
9658
|
function KB() {
|
|
9573
|
-
const g = new
|
|
9574
|
-
return g.addEventListener("message", (A) =>
|
|
9659
|
+
const g = new UE();
|
|
9660
|
+
return g.addEventListener("message", (A) => JE(A, g)), g.addEventListener("error", (A) => QB(A, g)), g.addEventListener(
|
|
9575
9661
|
"messageerror",
|
|
9576
9662
|
(A) => QB(A, g)
|
|
9577
9663
|
), g;
|
|
9578
9664
|
}
|
|
9579
|
-
function
|
|
9665
|
+
function YE() {
|
|
9580
9666
|
if (gA.length === 0)
|
|
9581
9667
|
throw new Error("Worker pool is not initialized");
|
|
9582
9668
|
return gA.sort((g, A) => g.pendingCount - A.pendingCount)[0];
|
|
9583
9669
|
}
|
|
9584
|
-
async function
|
|
9670
|
+
async function ME(g, A, I) {
|
|
9585
9671
|
return new Promise((B, Q) => {
|
|
9586
|
-
const C =
|
|
9672
|
+
const C = YE(), E = LE++, i = {
|
|
9587
9673
|
resolve: B,
|
|
9588
9674
|
reject: Q,
|
|
9589
9675
|
workerId: C.workerId
|
|
@@ -9609,10 +9695,10 @@ async function JE(g, A, I) {
|
|
|
9609
9695
|
});
|
|
9610
9696
|
});
|
|
9611
9697
|
}
|
|
9612
|
-
function
|
|
9698
|
+
function KE() {
|
|
9613
9699
|
if (!(gA.length > 0))
|
|
9614
9700
|
try {
|
|
9615
|
-
for (let g = 0; g <
|
|
9701
|
+
for (let g = 0; g < kE; g++) {
|
|
9616
9702
|
const A = KB();
|
|
9617
9703
|
gA.push({
|
|
9618
9704
|
worker: A,
|
|
@@ -9620,31 +9706,31 @@ function YE() {
|
|
|
9620
9706
|
workerId: YB++
|
|
9621
9707
|
});
|
|
9622
9708
|
}
|
|
9623
|
-
|
|
9709
|
+
c.debug(
|
|
9624
9710
|
"ZarrWorker",
|
|
9625
9711
|
`Initialized worker pool with ${gA.length} workers`
|
|
9626
9712
|
);
|
|
9627
9713
|
} catch {
|
|
9628
|
-
|
|
9714
|
+
c.warn("ZarrWorker", "Failed to create workers - clearing pool"), HE();
|
|
9629
9715
|
return;
|
|
9630
9716
|
}
|
|
9631
9717
|
}
|
|
9632
|
-
async function
|
|
9633
|
-
|
|
9718
|
+
async function dE(g, A, I, B) {
|
|
9719
|
+
KE();
|
|
9634
9720
|
try {
|
|
9635
|
-
return await
|
|
9721
|
+
return await ME(A, I, B);
|
|
9636
9722
|
} catch (Q) {
|
|
9637
9723
|
if (Q instanceof DOMException && Q.name === "AbortError")
|
|
9638
9724
|
throw Q;
|
|
9639
|
-
return
|
|
9725
|
+
return c.warn("ZarrWorker", "Falling back to main thread", Q), await g.getChunk(I, B);
|
|
9640
9726
|
}
|
|
9641
9727
|
}
|
|
9642
|
-
function
|
|
9728
|
+
function HE() {
|
|
9643
9729
|
for (const g of gA)
|
|
9644
9730
|
g.worker.terminate();
|
|
9645
9731
|
gA = [], NA.clear();
|
|
9646
9732
|
}
|
|
9647
|
-
class
|
|
9733
|
+
class qE {
|
|
9648
9734
|
promises_ = [];
|
|
9649
9735
|
scheduler_;
|
|
9650
9736
|
constructor(A) {
|
|
@@ -9657,14 +9743,14 @@ class dE {
|
|
|
9657
9743
|
return Promise.all(this.promises_.map((A) => this.scheduler_.submit(A)));
|
|
9658
9744
|
}
|
|
9659
9745
|
}
|
|
9660
|
-
class
|
|
9746
|
+
class lE {
|
|
9661
9747
|
metadata_;
|
|
9662
9748
|
arrays_;
|
|
9663
9749
|
arrayParams_;
|
|
9664
9750
|
loaderAttributes_;
|
|
9665
9751
|
dimensions_;
|
|
9666
9752
|
constructor(A) {
|
|
9667
|
-
this.metadata_ = A.metadata, this.arrays_ = A.arrays, this.arrayParams_ = A.arrayParams, this.loaderAttributes_ =
|
|
9753
|
+
this.metadata_ = A.metadata, this.arrays_ = A.arrays, this.arrayParams_ = A.arrayParams, this.loaderAttributes_ = fE(this.metadata_, this.arrays_), this.dimensions_ = pE(this.loaderAttributes_);
|
|
9668
9754
|
}
|
|
9669
9755
|
getSourceDimensionMap() {
|
|
9670
9756
|
return this.dimensions_;
|
|
@@ -9672,7 +9758,7 @@ class HE {
|
|
|
9672
9758
|
async loadChunkData(A, I) {
|
|
9673
9759
|
const B = [];
|
|
9674
9760
|
B[this.dimensions_.x.index] = A.chunkIndex.x, B[this.dimensions_.y.index] = A.chunkIndex.y, this.dimensions_.z && (B[this.dimensions_.z.index] = A.chunkIndex.z), this.dimensions_.c && (B[this.dimensions_.c.index] = A.chunkIndex.c), this.dimensions_.t && (B[this.dimensions_.t.index] = A.chunkIndex.t);
|
|
9675
|
-
const Q = this.arrays_[A.lod], C = this.arrayParams_[A.lod], E = await
|
|
9761
|
+
const Q = this.arrays_[A.lod], C = this.arrayParams_[A.lod], E = await dE(Q, C, B, {
|
|
9676
9762
|
signal: I
|
|
9677
9763
|
});
|
|
9678
9764
|
if (!pg(E.data))
|
|
@@ -9722,10 +9808,10 @@ class HE {
|
|
|
9722
9808
|
const Q = this.loaderAttributes_[I], C = this.regionToIndices(A, Q), { scale: E, translation: i } = Q, o = this.arrays_[I];
|
|
9723
9809
|
let a = {};
|
|
9724
9810
|
B !== void 0 && (a = {
|
|
9725
|
-
create_queue: () => new
|
|
9811
|
+
create_queue: () => new qE(B),
|
|
9726
9812
|
opts: { signal: B.abortSignal }
|
|
9727
9813
|
});
|
|
9728
|
-
const D = await
|
|
9814
|
+
const D = await rE(o, C, a);
|
|
9729
9815
|
if (!pg(D.data))
|
|
9730
9816
|
throw new Error(
|
|
9731
9817
|
`Subarray has an unsupported data type, data=${D.data.constructor.name}`
|
|
@@ -9740,9 +9826,9 @@ class HE {
|
|
|
9740
9826
|
"Invalid row alignment value. Possible values are 1, 2, 4, or 8"
|
|
9741
9827
|
);
|
|
9742
9828
|
const y = (e) => {
|
|
9743
|
-
const
|
|
9744
|
-
return typeof
|
|
9745
|
-
}, G = y(C.length - 1),
|
|
9829
|
+
const F = C[e];
|
|
9830
|
+
return typeof F == "number" ? F * E[e] + i[e] : F.start === null ? i[e] : F.start * E[e] + i[e];
|
|
9831
|
+
}, G = y(C.length - 1), S = y(C.length - 2);
|
|
9746
9832
|
return {
|
|
9747
9833
|
state: "loaded",
|
|
9748
9834
|
lod: I,
|
|
@@ -9764,7 +9850,7 @@ class HE {
|
|
|
9764
9850
|
y: E[C.length - 2],
|
|
9765
9851
|
z: 1
|
|
9766
9852
|
},
|
|
9767
|
-
offset: { x: G, y:
|
|
9853
|
+
offset: { x: G, y: S, z: 0 }
|
|
9768
9854
|
};
|
|
9769
9855
|
}
|
|
9770
9856
|
getAttributes() {
|
|
@@ -9786,7 +9872,7 @@ class HE {
|
|
|
9786
9872
|
return E;
|
|
9787
9873
|
}
|
|
9788
9874
|
}
|
|
9789
|
-
function
|
|
9875
|
+
function fE(g, A) {
|
|
9790
9876
|
const I = [], B = g.axes.length;
|
|
9791
9877
|
for (let Q = 0; Q < g.datasets.length; Q++) {
|
|
9792
9878
|
const C = g.datasets[Q], E = A[Q], i = C.coordinateTransformations[0].scale, o = C.coordinateTransformations.length === 2 ? C.coordinateTransformations[1].translation : new Array(B).fill(0);
|
|
@@ -9801,7 +9887,7 @@ function qE(g, A) {
|
|
|
9801
9887
|
}
|
|
9802
9888
|
return I;
|
|
9803
9889
|
}
|
|
9804
|
-
function
|
|
9890
|
+
function pE(g) {
|
|
9805
9891
|
const A = g[0].dimensionNames, I = CB(A, "x"), B = CB(A, "y"), Q = {
|
|
9806
9892
|
x: uA(A[I], I, g),
|
|
9807
9893
|
y: uA(A[B], B, g),
|
|
@@ -9825,7 +9911,7 @@ function uA(g, A, I) {
|
|
|
9825
9911
|
}))
|
|
9826
9912
|
};
|
|
9827
9913
|
}
|
|
9828
|
-
function
|
|
9914
|
+
function mE(g, A) {
|
|
9829
9915
|
return g.toLowerCase() === A.toLowerCase();
|
|
9830
9916
|
}
|
|
9831
9917
|
function CB(g, A) {
|
|
@@ -9837,7 +9923,7 @@ function CB(g, A) {
|
|
|
9837
9923
|
return I;
|
|
9838
9924
|
}
|
|
9839
9925
|
function wI(g, A) {
|
|
9840
|
-
return g.findIndex((I) =>
|
|
9926
|
+
return g.findIndex((I) => mE(I, A));
|
|
9841
9927
|
}
|
|
9842
9928
|
function EB(g) {
|
|
9843
9929
|
let A = 1;
|
|
@@ -9893,7 +9979,7 @@ var gg;
|
|
|
9893
9979
|
// second overwrites first
|
|
9894
9980
|
});
|
|
9895
9981
|
})(gg || (gg = {}));
|
|
9896
|
-
const
|
|
9982
|
+
const n = H.arrayToEnum([
|
|
9897
9983
|
"string",
|
|
9898
9984
|
"nan",
|
|
9899
9985
|
"number",
|
|
@@ -9917,23 +10003,23 @@ const F = H.arrayToEnum([
|
|
|
9917
10003
|
]), aA = (g) => {
|
|
9918
10004
|
switch (typeof g) {
|
|
9919
10005
|
case "undefined":
|
|
9920
|
-
return
|
|
10006
|
+
return n.undefined;
|
|
9921
10007
|
case "string":
|
|
9922
|
-
return
|
|
10008
|
+
return n.string;
|
|
9923
10009
|
case "number":
|
|
9924
|
-
return isNaN(g) ?
|
|
10010
|
+
return isNaN(g) ? n.nan : n.number;
|
|
9925
10011
|
case "boolean":
|
|
9926
|
-
return
|
|
10012
|
+
return n.boolean;
|
|
9927
10013
|
case "function":
|
|
9928
|
-
return
|
|
10014
|
+
return n.function;
|
|
9929
10015
|
case "bigint":
|
|
9930
|
-
return
|
|
10016
|
+
return n.bigint;
|
|
9931
10017
|
case "symbol":
|
|
9932
|
-
return
|
|
10018
|
+
return n.symbol;
|
|
9933
10019
|
case "object":
|
|
9934
|
-
return Array.isArray(g) ?
|
|
10020
|
+
return Array.isArray(g) ? n.array : g === null ? n.null : g.then && typeof g.then == "function" && g.catch && typeof g.catch == "function" ? n.promise : typeof Map < "u" && g instanceof Map ? n.map : typeof Set < "u" && g instanceof Set ? n.set : typeof Date < "u" && g instanceof Date ? n.date : n.object;
|
|
9935
10021
|
default:
|
|
9936
|
-
return
|
|
10022
|
+
return n.unknown;
|
|
9937
10023
|
}
|
|
9938
10024
|
}, t = H.arrayToEnum([
|
|
9939
10025
|
"invalid_type",
|
|
@@ -9952,8 +10038,8 @@ const F = H.arrayToEnum([
|
|
|
9952
10038
|
"invalid_intersection_types",
|
|
9953
10039
|
"not_multiple_of",
|
|
9954
10040
|
"not_finite"
|
|
9955
|
-
]),
|
|
9956
|
-
class
|
|
10041
|
+
]), uE = (g) => JSON.stringify(g, null, 2).replace(/"([^"]+)":/g, "$1:");
|
|
10042
|
+
class v extends Error {
|
|
9957
10043
|
get errors() {
|
|
9958
10044
|
return this.issues;
|
|
9959
10045
|
}
|
|
@@ -9990,7 +10076,7 @@ class X extends Error {
|
|
|
9990
10076
|
return Q(this), B;
|
|
9991
10077
|
}
|
|
9992
10078
|
static assert(A) {
|
|
9993
|
-
if (!(A instanceof
|
|
10079
|
+
if (!(A instanceof v))
|
|
9994
10080
|
throw new Error(`Not a ZodError: ${A}`);
|
|
9995
10081
|
}
|
|
9996
10082
|
toString() {
|
|
@@ -10012,12 +10098,12 @@ class X extends Error {
|
|
|
10012
10098
|
return this.flatten();
|
|
10013
10099
|
}
|
|
10014
10100
|
}
|
|
10015
|
-
|
|
10101
|
+
v.create = (g) => new v(g);
|
|
10016
10102
|
const HA = (g, A) => {
|
|
10017
10103
|
let I;
|
|
10018
10104
|
switch (g.code) {
|
|
10019
10105
|
case t.invalid_type:
|
|
10020
|
-
g.received ===
|
|
10106
|
+
g.received === n.undefined ? I = "Required" : I = `Expected ${g.expected}, received ${g.received}`;
|
|
10021
10107
|
break;
|
|
10022
10108
|
case t.invalid_literal:
|
|
10023
10109
|
I = `Invalid literal value, expected ${JSON.stringify(g.expected, H.jsonStringifyReplacer)}`;
|
|
@@ -10070,7 +10156,7 @@ const HA = (g, A) => {
|
|
|
10070
10156
|
return { message: I };
|
|
10071
10157
|
};
|
|
10072
10158
|
let dB = HA;
|
|
10073
|
-
function
|
|
10159
|
+
function TE(g) {
|
|
10074
10160
|
dB = g;
|
|
10075
10161
|
}
|
|
10076
10162
|
function NI() {
|
|
@@ -10096,7 +10182,7 @@ const cI = (g) => {
|
|
|
10096
10182
|
path: C,
|
|
10097
10183
|
message: i
|
|
10098
10184
|
};
|
|
10099
|
-
},
|
|
10185
|
+
}, WE = [];
|
|
10100
10186
|
function w(g, A) {
|
|
10101
10187
|
const I = NI(), B = cI({
|
|
10102
10188
|
issueData: A,
|
|
@@ -10115,7 +10201,7 @@ function w(g, A) {
|
|
|
10115
10201
|
});
|
|
10116
10202
|
g.common.issues.push(B);
|
|
10117
10203
|
}
|
|
10118
|
-
class
|
|
10204
|
+
class x {
|
|
10119
10205
|
constructor() {
|
|
10120
10206
|
this.value = "valid";
|
|
10121
10207
|
}
|
|
@@ -10129,7 +10215,7 @@ class P {
|
|
|
10129
10215
|
const B = [];
|
|
10130
10216
|
for (const Q of I) {
|
|
10131
10217
|
if (Q.status === "aborted")
|
|
10132
|
-
return
|
|
10218
|
+
return k;
|
|
10133
10219
|
Q.status === "dirty" && A.dirty(), B.push(Q.value);
|
|
10134
10220
|
}
|
|
10135
10221
|
return { status: A.value, value: B };
|
|
@@ -10143,22 +10229,22 @@ class P {
|
|
|
10143
10229
|
value: E
|
|
10144
10230
|
});
|
|
10145
10231
|
}
|
|
10146
|
-
return
|
|
10232
|
+
return x.mergeObjectSync(A, B);
|
|
10147
10233
|
}
|
|
10148
10234
|
static mergeObjectSync(A, I) {
|
|
10149
10235
|
const B = {};
|
|
10150
10236
|
for (const Q of I) {
|
|
10151
10237
|
const { key: C, value: E } = Q;
|
|
10152
10238
|
if (C.status === "aborted" || E.status === "aborted")
|
|
10153
|
-
return
|
|
10239
|
+
return k;
|
|
10154
10240
|
C.status === "dirty" && A.dirty(), E.status === "dirty" && A.dirty(), C.value !== "__proto__" && (typeof E.value < "u" || Q.alwaysSet) && (B[C.value] = E.value);
|
|
10155
10241
|
}
|
|
10156
10242
|
return { status: A.value, value: B };
|
|
10157
10243
|
}
|
|
10158
10244
|
}
|
|
10159
|
-
const
|
|
10245
|
+
const k = Object.freeze({
|
|
10160
10246
|
status: "aborted"
|
|
10161
|
-
}), MA = (g) => ({ status: "dirty", value: g }),
|
|
10247
|
+
}), MA = (g) => ({ status: "dirty", value: g }), P = (g) => ({ status: "valid", value: g }), Bg = (g) => g.status === "aborted", Qg = (g) => g.status === "dirty", cA = (g) => g.status === "valid", vA = (g) => typeof Promise < "u" && g instanceof Promise;
|
|
10162
10248
|
function UI(g, A, I, B) {
|
|
10163
10249
|
if (typeof A == "function" ? g !== A || !0 : !A.has(g)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10164
10250
|
return A.get(g);
|
|
@@ -10190,7 +10276,7 @@ const iB = (g, A) => {
|
|
|
10190
10276
|
get error() {
|
|
10191
10277
|
if (this._error)
|
|
10192
10278
|
return this._error;
|
|
10193
|
-
const I = new
|
|
10279
|
+
const I = new v(g.common.issues);
|
|
10194
10280
|
return this._error = I, this._error;
|
|
10195
10281
|
}
|
|
10196
10282
|
};
|
|
@@ -10226,7 +10312,7 @@ class d {
|
|
|
10226
10312
|
}
|
|
10227
10313
|
_processInputParams(A) {
|
|
10228
10314
|
return {
|
|
10229
|
-
status: new
|
|
10315
|
+
status: new x(),
|
|
10230
10316
|
ctx: {
|
|
10231
10317
|
common: A.parent.common,
|
|
10232
10318
|
data: A.data,
|
|
@@ -10427,14 +10513,14 @@ class d {
|
|
|
10427
10513
|
return this.safeParse(null).success;
|
|
10428
10514
|
}
|
|
10429
10515
|
}
|
|
10430
|
-
const
|
|
10516
|
+
const xE = /^c[^\s-]{8,}$/i, bE = /^[0-9a-z]+$/, ZE = /^[0-9A-HJKMNP-TV-Z]{26}$/i, PE = /^[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, OE = /^[a-z0-9_-]{21}$/i, VE = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, vE = /^[-+]?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)?)??$/, XE = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, jE = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
10431
10517
|
let OI;
|
|
10432
|
-
const
|
|
10518
|
+
const zE = /^(?:(?: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])$/, _E = /^(?:(?: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])$/, $E = /^(([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]))$/, Ai = /^(([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])$/, Ii = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, gi = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, qB = "((\\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])))", Bi = new RegExp(`^${qB}$`);
|
|
10433
10519
|
function lB(g) {
|
|
10434
10520
|
let A = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
|
|
10435
10521
|
return g.precision ? A = `${A}\\.\\d{${g.precision}}` : g.precision == null && (A = `${A}(\\.\\d+)?`), A;
|
|
10436
10522
|
}
|
|
10437
|
-
function
|
|
10523
|
+
function Qi(g) {
|
|
10438
10524
|
return new RegExp(`^${lB(g)}$`);
|
|
10439
10525
|
}
|
|
10440
10526
|
function fB(g) {
|
|
@@ -10442,11 +10528,11 @@ function fB(g) {
|
|
|
10442
10528
|
const I = [];
|
|
10443
10529
|
return I.push(g.local ? "Z?" : "Z"), g.offset && I.push("([+-]\\d{2}:?\\d{2})"), A = `${A}(${I.join("|")})`, new RegExp(`^${A}$`);
|
|
10444
10530
|
}
|
|
10445
|
-
function
|
|
10446
|
-
return !!((A === "v4" || !A) &&
|
|
10531
|
+
function Ci(g, A) {
|
|
10532
|
+
return !!((A === "v4" || !A) && zE.test(g) || (A === "v6" || !A) && $E.test(g));
|
|
10447
10533
|
}
|
|
10448
|
-
function
|
|
10449
|
-
if (!
|
|
10534
|
+
function Ei(g, A) {
|
|
10535
|
+
if (!VE.test(g))
|
|
10450
10536
|
return !1;
|
|
10451
10537
|
try {
|
|
10452
10538
|
const [I] = g.split("."), B = I.replace(/-/g, "+").replace(/_/g, "/").padEnd(I.length + (4 - I.length % 4) % 4, "="), Q = JSON.parse(atob(B));
|
|
@@ -10455,20 +10541,20 @@ function Qi(g, A) {
|
|
|
10455
10541
|
return !1;
|
|
10456
10542
|
}
|
|
10457
10543
|
}
|
|
10458
|
-
function
|
|
10459
|
-
return !!((A === "v4" || !A) &&
|
|
10544
|
+
function ii(g, A) {
|
|
10545
|
+
return !!((A === "v4" || !A) && _E.test(g) || (A === "v6" || !A) && Ai.test(g));
|
|
10460
10546
|
}
|
|
10461
10547
|
class $ extends d {
|
|
10462
10548
|
_parse(A) {
|
|
10463
|
-
if (this._def.coerce && (A.data = String(A.data)), this._getType(A) !==
|
|
10549
|
+
if (this._def.coerce && (A.data = String(A.data)), this._getType(A) !== n.string) {
|
|
10464
10550
|
const C = this._getOrReturnCtx(A);
|
|
10465
10551
|
return w(C, {
|
|
10466
10552
|
code: t.invalid_type,
|
|
10467
|
-
expected:
|
|
10553
|
+
expected: n.string,
|
|
10468
10554
|
received: C.parsedType
|
|
10469
|
-
}),
|
|
10555
|
+
}), k;
|
|
10470
10556
|
}
|
|
10471
|
-
const B = new
|
|
10557
|
+
const B = new x();
|
|
10472
10558
|
let Q;
|
|
10473
10559
|
for (const C of this._def.checks)
|
|
10474
10560
|
if (C.kind === "min")
|
|
@@ -10507,43 +10593,43 @@ class $ extends d {
|
|
|
10507
10593
|
message: C.message
|
|
10508
10594
|
}), B.dirty());
|
|
10509
10595
|
} else if (C.kind === "email")
|
|
10510
|
-
|
|
10596
|
+
XE.test(A.data) || (Q = this._getOrReturnCtx(A, Q), w(Q, {
|
|
10511
10597
|
validation: "email",
|
|
10512
10598
|
code: t.invalid_string,
|
|
10513
10599
|
message: C.message
|
|
10514
10600
|
}), B.dirty());
|
|
10515
10601
|
else if (C.kind === "emoji")
|
|
10516
|
-
OI || (OI = new RegExp(
|
|
10602
|
+
OI || (OI = new RegExp(jE, "u")), OI.test(A.data) || (Q = this._getOrReturnCtx(A, Q), w(Q, {
|
|
10517
10603
|
validation: "emoji",
|
|
10518
10604
|
code: t.invalid_string,
|
|
10519
10605
|
message: C.message
|
|
10520
10606
|
}), B.dirty());
|
|
10521
10607
|
else if (C.kind === "uuid")
|
|
10522
|
-
|
|
10608
|
+
PE.test(A.data) || (Q = this._getOrReturnCtx(A, Q), w(Q, {
|
|
10523
10609
|
validation: "uuid",
|
|
10524
10610
|
code: t.invalid_string,
|
|
10525
10611
|
message: C.message
|
|
10526
10612
|
}), B.dirty());
|
|
10527
10613
|
else if (C.kind === "nanoid")
|
|
10528
|
-
|
|
10614
|
+
OE.test(A.data) || (Q = this._getOrReturnCtx(A, Q), w(Q, {
|
|
10529
10615
|
validation: "nanoid",
|
|
10530
10616
|
code: t.invalid_string,
|
|
10531
10617
|
message: C.message
|
|
10532
10618
|
}), B.dirty());
|
|
10533
10619
|
else if (C.kind === "cuid")
|
|
10534
|
-
|
|
10620
|
+
xE.test(A.data) || (Q = this._getOrReturnCtx(A, Q), w(Q, {
|
|
10535
10621
|
validation: "cuid",
|
|
10536
10622
|
code: t.invalid_string,
|
|
10537
10623
|
message: C.message
|
|
10538
10624
|
}), B.dirty());
|
|
10539
10625
|
else if (C.kind === "cuid2")
|
|
10540
|
-
|
|
10626
|
+
bE.test(A.data) || (Q = this._getOrReturnCtx(A, Q), w(Q, {
|
|
10541
10627
|
validation: "cuid2",
|
|
10542
10628
|
code: t.invalid_string,
|
|
10543
10629
|
message: C.message
|
|
10544
10630
|
}), B.dirty());
|
|
10545
10631
|
else if (C.kind === "ulid")
|
|
10546
|
-
|
|
10632
|
+
ZE.test(A.data) || (Q = this._getOrReturnCtx(A, Q), w(Q, {
|
|
10547
10633
|
validation: "ulid",
|
|
10548
10634
|
code: t.invalid_string,
|
|
10549
10635
|
message: C.message
|
|
@@ -10578,35 +10664,35 @@ class $ extends d {
|
|
|
10578
10664
|
code: t.invalid_string,
|
|
10579
10665
|
validation: "datetime",
|
|
10580
10666
|
message: C.message
|
|
10581
|
-
}), B.dirty()) : C.kind === "date" ?
|
|
10667
|
+
}), B.dirty()) : C.kind === "date" ? Bi.test(A.data) || (Q = this._getOrReturnCtx(A, Q), w(Q, {
|
|
10582
10668
|
code: t.invalid_string,
|
|
10583
10669
|
validation: "date",
|
|
10584
10670
|
message: C.message
|
|
10585
|
-
}), B.dirty()) : C.kind === "time" ?
|
|
10671
|
+
}), B.dirty()) : C.kind === "time" ? Qi(C).test(A.data) || (Q = this._getOrReturnCtx(A, Q), w(Q, {
|
|
10586
10672
|
code: t.invalid_string,
|
|
10587
10673
|
validation: "time",
|
|
10588
10674
|
message: C.message
|
|
10589
|
-
}), B.dirty()) : C.kind === "duration" ?
|
|
10675
|
+
}), B.dirty()) : C.kind === "duration" ? vE.test(A.data) || (Q = this._getOrReturnCtx(A, Q), w(Q, {
|
|
10590
10676
|
validation: "duration",
|
|
10591
10677
|
code: t.invalid_string,
|
|
10592
10678
|
message: C.message
|
|
10593
|
-
}), B.dirty()) : C.kind === "ip" ?
|
|
10679
|
+
}), B.dirty()) : C.kind === "ip" ? Ci(A.data, C.version) || (Q = this._getOrReturnCtx(A, Q), w(Q, {
|
|
10594
10680
|
validation: "ip",
|
|
10595
10681
|
code: t.invalid_string,
|
|
10596
10682
|
message: C.message
|
|
10597
|
-
}), B.dirty()) : C.kind === "jwt" ?
|
|
10683
|
+
}), B.dirty()) : C.kind === "jwt" ? Ei(A.data, C.alg) || (Q = this._getOrReturnCtx(A, Q), w(Q, {
|
|
10598
10684
|
validation: "jwt",
|
|
10599
10685
|
code: t.invalid_string,
|
|
10600
10686
|
message: C.message
|
|
10601
|
-
}), B.dirty()) : C.kind === "cidr" ?
|
|
10687
|
+
}), B.dirty()) : C.kind === "cidr" ? ii(A.data, C.version) || (Q = this._getOrReturnCtx(A, Q), w(Q, {
|
|
10602
10688
|
validation: "cidr",
|
|
10603
10689
|
code: t.invalid_string,
|
|
10604
10690
|
message: C.message
|
|
10605
|
-
}), B.dirty()) : C.kind === "base64" ?
|
|
10691
|
+
}), B.dirty()) : C.kind === "base64" ? Ii.test(A.data) || (Q = this._getOrReturnCtx(A, Q), w(Q, {
|
|
10606
10692
|
validation: "base64",
|
|
10607
10693
|
code: t.invalid_string,
|
|
10608
10694
|
message: C.message
|
|
10609
|
-
}), B.dirty()) : C.kind === "base64url" ?
|
|
10695
|
+
}), B.dirty()) : C.kind === "base64url" ? gi.test(A.data) || (Q = this._getOrReturnCtx(A, Q), w(Q, {
|
|
10610
10696
|
validation: "base64url",
|
|
10611
10697
|
code: t.invalid_string,
|
|
10612
10698
|
message: C.message
|
|
@@ -10845,7 +10931,7 @@ $.create = (g) => {
|
|
|
10845
10931
|
...Y(g)
|
|
10846
10932
|
});
|
|
10847
10933
|
};
|
|
10848
|
-
function
|
|
10934
|
+
function oi(g, A) {
|
|
10849
10935
|
const I = (g.toString().split(".")[1] || "").length, B = (A.toString().split(".")[1] || "").length, Q = I > B ? I : B, C = parseInt(g.toFixed(Q).replace(".", "")), E = parseInt(A.toFixed(Q).replace(".", ""));
|
|
10850
10936
|
return C % E / Math.pow(10, Q);
|
|
10851
10937
|
}
|
|
@@ -10854,16 +10940,16 @@ class sA extends d {
|
|
|
10854
10940
|
super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
|
|
10855
10941
|
}
|
|
10856
10942
|
_parse(A) {
|
|
10857
|
-
if (this._def.coerce && (A.data = Number(A.data)), this._getType(A) !==
|
|
10943
|
+
if (this._def.coerce && (A.data = Number(A.data)), this._getType(A) !== n.number) {
|
|
10858
10944
|
const C = this._getOrReturnCtx(A);
|
|
10859
10945
|
return w(C, {
|
|
10860
10946
|
code: t.invalid_type,
|
|
10861
|
-
expected:
|
|
10947
|
+
expected: n.number,
|
|
10862
10948
|
received: C.parsedType
|
|
10863
|
-
}),
|
|
10949
|
+
}), k;
|
|
10864
10950
|
}
|
|
10865
10951
|
let B;
|
|
10866
|
-
const Q = new
|
|
10952
|
+
const Q = new x();
|
|
10867
10953
|
for (const C of this._def.checks)
|
|
10868
10954
|
C.kind === "int" ? H.isInteger(A.data) || (B = this._getOrReturnCtx(A, B), w(B, {
|
|
10869
10955
|
code: t.invalid_type,
|
|
@@ -10884,7 +10970,7 @@ class sA extends d {
|
|
|
10884
10970
|
inclusive: C.inclusive,
|
|
10885
10971
|
exact: !1,
|
|
10886
10972
|
message: C.message
|
|
10887
|
-
}), Q.dirty()) : C.kind === "multipleOf" ?
|
|
10973
|
+
}), Q.dirty()) : C.kind === "multipleOf" ? oi(A.data, C.value) !== 0 && (B = this._getOrReturnCtx(A, B), w(B, {
|
|
10888
10974
|
code: t.not_multiple_of,
|
|
10889
10975
|
multipleOf: C.value,
|
|
10890
10976
|
message: C.message
|
|
@@ -11032,10 +11118,10 @@ class hA extends d {
|
|
|
11032
11118
|
} catch {
|
|
11033
11119
|
return this._getInvalidInput(A);
|
|
11034
11120
|
}
|
|
11035
|
-
if (this._getType(A) !==
|
|
11121
|
+
if (this._getType(A) !== n.bigint)
|
|
11036
11122
|
return this._getInvalidInput(A);
|
|
11037
11123
|
let B;
|
|
11038
|
-
const Q = new
|
|
11124
|
+
const Q = new x();
|
|
11039
11125
|
for (const C of this._def.checks)
|
|
11040
11126
|
C.kind === "min" ? (C.inclusive ? A.data < C.value : A.data <= C.value) && (B = this._getOrReturnCtx(A, B), w(B, {
|
|
11041
11127
|
code: t.too_small,
|
|
@@ -11060,9 +11146,9 @@ class hA extends d {
|
|
|
11060
11146
|
const I = this._getOrReturnCtx(A);
|
|
11061
11147
|
return w(I, {
|
|
11062
11148
|
code: t.invalid_type,
|
|
11063
|
-
expected:
|
|
11149
|
+
expected: n.bigint,
|
|
11064
11150
|
received: I.parsedType
|
|
11065
|
-
}),
|
|
11151
|
+
}), k;
|
|
11066
11152
|
}
|
|
11067
11153
|
gte(A, I) {
|
|
11068
11154
|
return this.setLimit("min", A, !0, r.toString(I));
|
|
@@ -11159,15 +11245,15 @@ hA.create = (g) => {
|
|
|
11159
11245
|
};
|
|
11160
11246
|
class XA extends d {
|
|
11161
11247
|
_parse(A) {
|
|
11162
|
-
if (this._def.coerce && (A.data = !!A.data), this._getType(A) !==
|
|
11248
|
+
if (this._def.coerce && (A.data = !!A.data), this._getType(A) !== n.boolean) {
|
|
11163
11249
|
const B = this._getOrReturnCtx(A);
|
|
11164
11250
|
return w(B, {
|
|
11165
11251
|
code: t.invalid_type,
|
|
11166
|
-
expected:
|
|
11252
|
+
expected: n.boolean,
|
|
11167
11253
|
received: B.parsedType
|
|
11168
|
-
}),
|
|
11254
|
+
}), k;
|
|
11169
11255
|
}
|
|
11170
|
-
return
|
|
11256
|
+
return P(A.data);
|
|
11171
11257
|
}
|
|
11172
11258
|
}
|
|
11173
11259
|
XA.create = (g) => new XA({
|
|
@@ -11177,21 +11263,21 @@ XA.create = (g) => new XA({
|
|
|
11177
11263
|
});
|
|
11178
11264
|
class UA extends d {
|
|
11179
11265
|
_parse(A) {
|
|
11180
|
-
if (this._def.coerce && (A.data = new Date(A.data)), this._getType(A) !==
|
|
11266
|
+
if (this._def.coerce && (A.data = new Date(A.data)), this._getType(A) !== n.date) {
|
|
11181
11267
|
const C = this._getOrReturnCtx(A);
|
|
11182
11268
|
return w(C, {
|
|
11183
11269
|
code: t.invalid_type,
|
|
11184
|
-
expected:
|
|
11270
|
+
expected: n.date,
|
|
11185
11271
|
received: C.parsedType
|
|
11186
|
-
}),
|
|
11272
|
+
}), k;
|
|
11187
11273
|
}
|
|
11188
11274
|
if (isNaN(A.data.getTime())) {
|
|
11189
11275
|
const C = this._getOrReturnCtx(A);
|
|
11190
11276
|
return w(C, {
|
|
11191
11277
|
code: t.invalid_date
|
|
11192
|
-
}),
|
|
11278
|
+
}), k;
|
|
11193
11279
|
}
|
|
11194
|
-
const B = new
|
|
11280
|
+
const B = new x();
|
|
11195
11281
|
let Q;
|
|
11196
11282
|
for (const C of this._def.checks)
|
|
11197
11283
|
C.kind === "min" ? A.data.getTime() < C.value && (Q = this._getOrReturnCtx(A, Q), w(Q, {
|
|
@@ -11255,15 +11341,15 @@ UA.create = (g) => new UA({
|
|
|
11255
11341
|
});
|
|
11256
11342
|
class kI extends d {
|
|
11257
11343
|
_parse(A) {
|
|
11258
|
-
if (this._getType(A) !==
|
|
11344
|
+
if (this._getType(A) !== n.symbol) {
|
|
11259
11345
|
const B = this._getOrReturnCtx(A);
|
|
11260
11346
|
return w(B, {
|
|
11261
11347
|
code: t.invalid_type,
|
|
11262
|
-
expected:
|
|
11348
|
+
expected: n.symbol,
|
|
11263
11349
|
received: B.parsedType
|
|
11264
|
-
}),
|
|
11350
|
+
}), k;
|
|
11265
11351
|
}
|
|
11266
|
-
return
|
|
11352
|
+
return P(A.data);
|
|
11267
11353
|
}
|
|
11268
11354
|
}
|
|
11269
11355
|
kI.create = (g) => new kI({
|
|
@@ -11272,15 +11358,15 @@ kI.create = (g) => new kI({
|
|
|
11272
11358
|
});
|
|
11273
11359
|
class jA extends d {
|
|
11274
11360
|
_parse(A) {
|
|
11275
|
-
if (this._getType(A) !==
|
|
11361
|
+
if (this._getType(A) !== n.undefined) {
|
|
11276
11362
|
const B = this._getOrReturnCtx(A);
|
|
11277
11363
|
return w(B, {
|
|
11278
11364
|
code: t.invalid_type,
|
|
11279
|
-
expected:
|
|
11365
|
+
expected: n.undefined,
|
|
11280
11366
|
received: B.parsedType
|
|
11281
|
-
}),
|
|
11367
|
+
}), k;
|
|
11282
11368
|
}
|
|
11283
|
-
return
|
|
11369
|
+
return P(A.data);
|
|
11284
11370
|
}
|
|
11285
11371
|
}
|
|
11286
11372
|
jA.create = (g) => new jA({
|
|
@@ -11289,15 +11375,15 @@ jA.create = (g) => new jA({
|
|
|
11289
11375
|
});
|
|
11290
11376
|
class zA extends d {
|
|
11291
11377
|
_parse(A) {
|
|
11292
|
-
if (this._getType(A) !==
|
|
11378
|
+
if (this._getType(A) !== n.null) {
|
|
11293
11379
|
const B = this._getOrReturnCtx(A);
|
|
11294
11380
|
return w(B, {
|
|
11295
11381
|
code: t.invalid_type,
|
|
11296
|
-
expected:
|
|
11382
|
+
expected: n.null,
|
|
11297
11383
|
received: B.parsedType
|
|
11298
|
-
}),
|
|
11384
|
+
}), k;
|
|
11299
11385
|
}
|
|
11300
|
-
return
|
|
11386
|
+
return P(A.data);
|
|
11301
11387
|
}
|
|
11302
11388
|
}
|
|
11303
11389
|
zA.create = (g) => new zA({
|
|
@@ -11309,7 +11395,7 @@ class qA extends d {
|
|
|
11309
11395
|
super(...arguments), this._any = !0;
|
|
11310
11396
|
}
|
|
11311
11397
|
_parse(A) {
|
|
11312
|
-
return
|
|
11398
|
+
return P(A.data);
|
|
11313
11399
|
}
|
|
11314
11400
|
}
|
|
11315
11401
|
qA.create = (g) => new qA({
|
|
@@ -11321,7 +11407,7 @@ class SA extends d {
|
|
|
11321
11407
|
super(...arguments), this._unknown = !0;
|
|
11322
11408
|
}
|
|
11323
11409
|
_parse(A) {
|
|
11324
|
-
return
|
|
11410
|
+
return P(A.data);
|
|
11325
11411
|
}
|
|
11326
11412
|
}
|
|
11327
11413
|
SA.create = (g) => new SA({
|
|
@@ -11333,9 +11419,9 @@ class DA extends d {
|
|
|
11333
11419
|
const I = this._getOrReturnCtx(A);
|
|
11334
11420
|
return w(I, {
|
|
11335
11421
|
code: t.invalid_type,
|
|
11336
|
-
expected:
|
|
11422
|
+
expected: n.never,
|
|
11337
11423
|
received: I.parsedType
|
|
11338
|
-
}),
|
|
11424
|
+
}), k;
|
|
11339
11425
|
}
|
|
11340
11426
|
}
|
|
11341
11427
|
DA.create = (g) => new DA({
|
|
@@ -11344,15 +11430,15 @@ DA.create = (g) => new DA({
|
|
|
11344
11430
|
});
|
|
11345
11431
|
class LI extends d {
|
|
11346
11432
|
_parse(A) {
|
|
11347
|
-
if (this._getType(A) !==
|
|
11433
|
+
if (this._getType(A) !== n.undefined) {
|
|
11348
11434
|
const B = this._getOrReturnCtx(A);
|
|
11349
11435
|
return w(B, {
|
|
11350
11436
|
code: t.invalid_type,
|
|
11351
|
-
expected:
|
|
11437
|
+
expected: n.void,
|
|
11352
11438
|
received: B.parsedType
|
|
11353
|
-
}),
|
|
11439
|
+
}), k;
|
|
11354
11440
|
}
|
|
11355
|
-
return
|
|
11441
|
+
return P(A.data);
|
|
11356
11442
|
}
|
|
11357
11443
|
}
|
|
11358
11444
|
LI.create = (g) => new LI({
|
|
@@ -11362,12 +11448,12 @@ LI.create = (g) => new LI({
|
|
|
11362
11448
|
class BA extends d {
|
|
11363
11449
|
_parse(A) {
|
|
11364
11450
|
const { ctx: I, status: B } = this._processInputParams(A), Q = this._def;
|
|
11365
|
-
if (I.parsedType !==
|
|
11451
|
+
if (I.parsedType !== n.array)
|
|
11366
11452
|
return w(I, {
|
|
11367
11453
|
code: t.invalid_type,
|
|
11368
|
-
expected:
|
|
11454
|
+
expected: n.array,
|
|
11369
11455
|
received: I.parsedType
|
|
11370
|
-
}),
|
|
11456
|
+
}), k;
|
|
11371
11457
|
if (Q.exactLength !== null) {
|
|
11372
11458
|
const E = I.data.length > Q.exactLength.value, i = I.data.length < Q.exactLength.value;
|
|
11373
11459
|
(E || i) && (w(I, {
|
|
@@ -11395,9 +11481,9 @@ class BA extends d {
|
|
|
11395
11481
|
exact: !1,
|
|
11396
11482
|
message: Q.maxLength.message
|
|
11397
11483
|
}), B.dirty()), I.common.async)
|
|
11398
|
-
return Promise.all([...I.data].map((E, i) => Q.type._parseAsync(new EA(I, E, I.path, i)))).then((E) =>
|
|
11484
|
+
return Promise.all([...I.data].map((E, i) => Q.type._parseAsync(new EA(I, E, I.path, i)))).then((E) => x.mergeArray(B, E));
|
|
11399
11485
|
const C = [...I.data].map((E, i) => Q.type._parseSync(new EA(I, E, I.path, i)));
|
|
11400
|
-
return
|
|
11486
|
+
return x.mergeArray(B, C);
|
|
11401
11487
|
}
|
|
11402
11488
|
get element() {
|
|
11403
11489
|
return this._def.type;
|
|
@@ -11459,13 +11545,13 @@ class f extends d {
|
|
|
11459
11545
|
return this._cached = { shape: A, keys: I };
|
|
11460
11546
|
}
|
|
11461
11547
|
_parse(A) {
|
|
11462
|
-
if (this._getType(A) !==
|
|
11548
|
+
if (this._getType(A) !== n.object) {
|
|
11463
11549
|
const a = this._getOrReturnCtx(A);
|
|
11464
11550
|
return w(a, {
|
|
11465
11551
|
code: t.invalid_type,
|
|
11466
|
-
expected:
|
|
11552
|
+
expected: n.object,
|
|
11467
11553
|
received: a.parsedType
|
|
11468
|
-
}),
|
|
11554
|
+
}), k;
|
|
11469
11555
|
}
|
|
11470
11556
|
const { status: B, ctx: Q } = this._processInputParams(A), { shape: C, keys: E } = this._getCached(), i = [];
|
|
11471
11557
|
if (!(this._def.catchall instanceof DA && this._def.unknownKeys === "strip"))
|
|
@@ -11519,7 +11605,7 @@ class f extends d {
|
|
|
11519
11605
|
});
|
|
11520
11606
|
}
|
|
11521
11607
|
return a;
|
|
11522
|
-
}).then((a) =>
|
|
11608
|
+
}).then((a) => x.mergeObjectSync(B, a)) : x.mergeObjectSync(B, o);
|
|
11523
11609
|
}
|
|
11524
11610
|
get shape() {
|
|
11525
11611
|
return this._def.shape();
|
|
@@ -11745,11 +11831,11 @@ class _A extends d {
|
|
|
11745
11831
|
for (const i of C)
|
|
11746
11832
|
if (i.result.status === "dirty")
|
|
11747
11833
|
return I.common.issues.push(...i.ctx.common.issues), i.result;
|
|
11748
|
-
const E = C.map((i) => new
|
|
11834
|
+
const E = C.map((i) => new v(i.ctx.common.issues));
|
|
11749
11835
|
return w(I, {
|
|
11750
11836
|
code: t.invalid_union,
|
|
11751
11837
|
unionErrors: E
|
|
11752
|
-
}),
|
|
11838
|
+
}), k;
|
|
11753
11839
|
}
|
|
11754
11840
|
if (I.common.async)
|
|
11755
11841
|
return Promise.all(B.map(async (C) => {
|
|
@@ -11792,11 +11878,11 @@ class _A extends d {
|
|
|
11792
11878
|
}
|
|
11793
11879
|
if (C)
|
|
11794
11880
|
return I.common.issues.push(...C.ctx.common.issues), C.result;
|
|
11795
|
-
const i = E.map((o) => new
|
|
11881
|
+
const i = E.map((o) => new v(o));
|
|
11796
11882
|
return w(I, {
|
|
11797
11883
|
code: t.invalid_union,
|
|
11798
11884
|
unionErrors: i
|
|
11799
|
-
}),
|
|
11885
|
+
}), k;
|
|
11800
11886
|
}
|
|
11801
11887
|
}
|
|
11802
11888
|
get options() {
|
|
@@ -11812,12 +11898,12 @@ const oA = (g) => g instanceof II ? oA(g.schema) : g instanceof QA ? oA(g.innerT
|
|
|
11812
11898
|
class qI extends d {
|
|
11813
11899
|
_parse(A) {
|
|
11814
11900
|
const { ctx: I } = this._processInputParams(A);
|
|
11815
|
-
if (I.parsedType !==
|
|
11901
|
+
if (I.parsedType !== n.object)
|
|
11816
11902
|
return w(I, {
|
|
11817
11903
|
code: t.invalid_type,
|
|
11818
|
-
expected:
|
|
11904
|
+
expected: n.object,
|
|
11819
11905
|
received: I.parsedType
|
|
11820
|
-
}),
|
|
11906
|
+
}), k;
|
|
11821
11907
|
const B = this.discriminator, Q = I.data[B], C = this.optionsMap.get(Q);
|
|
11822
11908
|
return C ? I.common.async ? C._parseAsync({
|
|
11823
11909
|
data: I.data,
|
|
@@ -11831,7 +11917,7 @@ class qI extends d {
|
|
|
11831
11917
|
code: t.invalid_union_discriminator,
|
|
11832
11918
|
options: Array.from(this.optionsMap.keys()),
|
|
11833
11919
|
path: [B]
|
|
11834
|
-
}),
|
|
11920
|
+
}), k);
|
|
11835
11921
|
}
|
|
11836
11922
|
get discriminator() {
|
|
11837
11923
|
return this._def.discriminator;
|
|
@@ -11875,7 +11961,7 @@ function Cg(g, A) {
|
|
|
11875
11961
|
const I = aA(g), B = aA(A);
|
|
11876
11962
|
if (g === A)
|
|
11877
11963
|
return { valid: !0, data: g };
|
|
11878
|
-
if (I ===
|
|
11964
|
+
if (I === n.object && B === n.object) {
|
|
11879
11965
|
const Q = H.objectKeys(A), C = H.objectKeys(g).filter((i) => Q.indexOf(i) !== -1), E = { ...g, ...A };
|
|
11880
11966
|
for (const i of C) {
|
|
11881
11967
|
const o = Cg(g[i], A[i]);
|
|
@@ -11884,7 +11970,7 @@ function Cg(g, A) {
|
|
|
11884
11970
|
E[i] = o.data;
|
|
11885
11971
|
}
|
|
11886
11972
|
return { valid: !0, data: E };
|
|
11887
|
-
} else if (I ===
|
|
11973
|
+
} else if (I === n.array && B === n.array) {
|
|
11888
11974
|
if (g.length !== A.length)
|
|
11889
11975
|
return { valid: !1 };
|
|
11890
11976
|
const Q = [];
|
|
@@ -11895,17 +11981,17 @@ function Cg(g, A) {
|
|
|
11895
11981
|
Q.push(o.data);
|
|
11896
11982
|
}
|
|
11897
11983
|
return { valid: !0, data: Q };
|
|
11898
|
-
} else return I ===
|
|
11984
|
+
} else return I === n.date && B === n.date && +g == +A ? { valid: !0, data: g } : { valid: !1 };
|
|
11899
11985
|
}
|
|
11900
11986
|
class $A extends d {
|
|
11901
11987
|
_parse(A) {
|
|
11902
11988
|
const { status: I, ctx: B } = this._processInputParams(A), Q = (C, E) => {
|
|
11903
11989
|
if (Bg(C) || Bg(E))
|
|
11904
|
-
return
|
|
11990
|
+
return k;
|
|
11905
11991
|
const i = Cg(C.value, E.value);
|
|
11906
11992
|
return i.valid ? ((Qg(C) || Qg(E)) && I.dirty(), { status: I.value, value: i.data }) : (w(B, {
|
|
11907
11993
|
code: t.invalid_intersection_types
|
|
11908
|
-
}),
|
|
11994
|
+
}), k);
|
|
11909
11995
|
};
|
|
11910
11996
|
return B.common.async ? Promise.all([
|
|
11911
11997
|
this._def.left._parseAsync({
|
|
@@ -11938,12 +12024,12 @@ $A.create = (g, A, I) => new $A({
|
|
|
11938
12024
|
class iA extends d {
|
|
11939
12025
|
_parse(A) {
|
|
11940
12026
|
const { status: I, ctx: B } = this._processInputParams(A);
|
|
11941
|
-
if (B.parsedType !==
|
|
12027
|
+
if (B.parsedType !== n.array)
|
|
11942
12028
|
return w(B, {
|
|
11943
12029
|
code: t.invalid_type,
|
|
11944
|
-
expected:
|
|
12030
|
+
expected: n.array,
|
|
11945
12031
|
received: B.parsedType
|
|
11946
|
-
}),
|
|
12032
|
+
}), k;
|
|
11947
12033
|
if (B.data.length < this._def.items.length)
|
|
11948
12034
|
return w(B, {
|
|
11949
12035
|
code: t.too_small,
|
|
@@ -11951,7 +12037,7 @@ class iA extends d {
|
|
|
11951
12037
|
inclusive: !0,
|
|
11952
12038
|
exact: !1,
|
|
11953
12039
|
type: "array"
|
|
11954
|
-
}),
|
|
12040
|
+
}), k;
|
|
11955
12041
|
!this._def.rest && B.data.length > this._def.items.length && (w(B, {
|
|
11956
12042
|
code: t.too_big,
|
|
11957
12043
|
maximum: this._def.items.length,
|
|
@@ -11963,7 +12049,7 @@ class iA extends d {
|
|
|
11963
12049
|
const o = this._def.items[i] || this._def.rest;
|
|
11964
12050
|
return o ? o._parse(new EA(B, E, B.path, i)) : null;
|
|
11965
12051
|
}).filter((E) => !!E);
|
|
11966
|
-
return B.common.async ? Promise.all(C).then((E) =>
|
|
12052
|
+
return B.common.async ? Promise.all(C).then((E) => x.mergeArray(I, E)) : x.mergeArray(I, C);
|
|
11967
12053
|
}
|
|
11968
12054
|
get items() {
|
|
11969
12055
|
return this._def.items;
|
|
@@ -11994,12 +12080,12 @@ class AI extends d {
|
|
|
11994
12080
|
}
|
|
11995
12081
|
_parse(A) {
|
|
11996
12082
|
const { status: I, ctx: B } = this._processInputParams(A);
|
|
11997
|
-
if (B.parsedType !==
|
|
12083
|
+
if (B.parsedType !== n.object)
|
|
11998
12084
|
return w(B, {
|
|
11999
12085
|
code: t.invalid_type,
|
|
12000
|
-
expected:
|
|
12086
|
+
expected: n.object,
|
|
12001
12087
|
received: B.parsedType
|
|
12002
|
-
}),
|
|
12088
|
+
}), k;
|
|
12003
12089
|
const Q = [], C = this._def.keyType, E = this._def.valueType;
|
|
12004
12090
|
for (const i in B.data)
|
|
12005
12091
|
Q.push({
|
|
@@ -12007,7 +12093,7 @@ class AI extends d {
|
|
|
12007
12093
|
value: E._parse(new EA(B, B.data[i], B.path, i)),
|
|
12008
12094
|
alwaysSet: i in B.data
|
|
12009
12095
|
});
|
|
12010
|
-
return B.common.async ?
|
|
12096
|
+
return B.common.async ? x.mergeObjectAsync(I, Q) : x.mergeObjectSync(I, Q);
|
|
12011
12097
|
}
|
|
12012
12098
|
get element() {
|
|
12013
12099
|
return this._def.valueType;
|
|
@@ -12035,12 +12121,12 @@ class JI extends d {
|
|
|
12035
12121
|
}
|
|
12036
12122
|
_parse(A) {
|
|
12037
12123
|
const { status: I, ctx: B } = this._processInputParams(A);
|
|
12038
|
-
if (B.parsedType !==
|
|
12124
|
+
if (B.parsedType !== n.map)
|
|
12039
12125
|
return w(B, {
|
|
12040
12126
|
code: t.invalid_type,
|
|
12041
|
-
expected:
|
|
12127
|
+
expected: n.map,
|
|
12042
12128
|
received: B.parsedType
|
|
12043
|
-
}),
|
|
12129
|
+
}), k;
|
|
12044
12130
|
const Q = this._def.keyType, C = this._def.valueType, E = [...B.data.entries()].map(([i, o], a) => ({
|
|
12045
12131
|
key: Q._parse(new EA(B, i, B.path, [a, "key"])),
|
|
12046
12132
|
value: C._parse(new EA(B, o, B.path, [a, "value"]))
|
|
@@ -12051,7 +12137,7 @@ class JI extends d {
|
|
|
12051
12137
|
for (const o of E) {
|
|
12052
12138
|
const a = await o.key, D = await o.value;
|
|
12053
12139
|
if (a.status === "aborted" || D.status === "aborted")
|
|
12054
|
-
return
|
|
12140
|
+
return k;
|
|
12055
12141
|
(a.status === "dirty" || D.status === "dirty") && I.dirty(), i.set(a.value, D.value);
|
|
12056
12142
|
}
|
|
12057
12143
|
return { status: I.value, value: i };
|
|
@@ -12061,7 +12147,7 @@ class JI extends d {
|
|
|
12061
12147
|
for (const o of E) {
|
|
12062
12148
|
const a = o.key, D = o.value;
|
|
12063
12149
|
if (a.status === "aborted" || D.status === "aborted")
|
|
12064
|
-
return
|
|
12150
|
+
return k;
|
|
12065
12151
|
(a.status === "dirty" || D.status === "dirty") && I.dirty(), i.set(a.value, D.value);
|
|
12066
12152
|
}
|
|
12067
12153
|
return { status: I.value, value: i };
|
|
@@ -12077,12 +12163,12 @@ JI.create = (g, A, I) => new JI({
|
|
|
12077
12163
|
class kA extends d {
|
|
12078
12164
|
_parse(A) {
|
|
12079
12165
|
const { status: I, ctx: B } = this._processInputParams(A);
|
|
12080
|
-
if (B.parsedType !==
|
|
12166
|
+
if (B.parsedType !== n.set)
|
|
12081
12167
|
return w(B, {
|
|
12082
12168
|
code: t.invalid_type,
|
|
12083
|
-
expected:
|
|
12169
|
+
expected: n.set,
|
|
12084
12170
|
received: B.parsedType
|
|
12085
|
-
}),
|
|
12171
|
+
}), k;
|
|
12086
12172
|
const Q = this._def;
|
|
12087
12173
|
Q.minSize !== null && B.data.size < Q.minSize.value && (w(B, {
|
|
12088
12174
|
code: t.too_small,
|
|
@@ -12104,7 +12190,7 @@ class kA extends d {
|
|
|
12104
12190
|
const a = /* @__PURE__ */ new Set();
|
|
12105
12191
|
for (const D of o) {
|
|
12106
12192
|
if (D.status === "aborted")
|
|
12107
|
-
return
|
|
12193
|
+
return k;
|
|
12108
12194
|
D.status === "dirty" && I.dirty(), a.add(D.value);
|
|
12109
12195
|
}
|
|
12110
12196
|
return { status: I.value, value: a };
|
|
@@ -12144,12 +12230,12 @@ class KA extends d {
|
|
|
12144
12230
|
}
|
|
12145
12231
|
_parse(A) {
|
|
12146
12232
|
const { ctx: I } = this._processInputParams(A);
|
|
12147
|
-
if (I.parsedType !==
|
|
12233
|
+
if (I.parsedType !== n.function)
|
|
12148
12234
|
return w(I, {
|
|
12149
12235
|
code: t.invalid_type,
|
|
12150
|
-
expected:
|
|
12236
|
+
expected: n.function,
|
|
12151
12237
|
received: I.parsedType
|
|
12152
|
-
}),
|
|
12238
|
+
}), k;
|
|
12153
12239
|
function B(i, o) {
|
|
12154
12240
|
return cI({
|
|
12155
12241
|
data: i,
|
|
@@ -12185,8 +12271,8 @@ class KA extends d {
|
|
|
12185
12271
|
const C = { errorMap: I.common.contextualErrorMap }, E = I.data;
|
|
12186
12272
|
if (this._def.returns instanceof lA) {
|
|
12187
12273
|
const i = this;
|
|
12188
|
-
return
|
|
12189
|
-
const a = new
|
|
12274
|
+
return P(async function(...o) {
|
|
12275
|
+
const a = new v([]), D = await i._def.args.parseAsync(o, C).catch((G) => {
|
|
12190
12276
|
throw a.addIssue(B(o, G)), a;
|
|
12191
12277
|
}), h = await Reflect.apply(E, this, D);
|
|
12192
12278
|
return await i._def.returns._def.type.parseAsync(h, C).catch((G) => {
|
|
@@ -12195,13 +12281,13 @@ class KA extends d {
|
|
|
12195
12281
|
});
|
|
12196
12282
|
} else {
|
|
12197
12283
|
const i = this;
|
|
12198
|
-
return
|
|
12284
|
+
return P(function(...o) {
|
|
12199
12285
|
const a = i._def.args.safeParse(o, C);
|
|
12200
12286
|
if (!a.success)
|
|
12201
|
-
throw new
|
|
12287
|
+
throw new v([B(o, a.error)]);
|
|
12202
12288
|
const D = Reflect.apply(E, this, a.data), h = i._def.returns.safeParse(D, C);
|
|
12203
12289
|
if (!h.success)
|
|
12204
|
-
throw new
|
|
12290
|
+
throw new v([Q(D, h.error)]);
|
|
12205
12291
|
return h.data;
|
|
12206
12292
|
});
|
|
12207
12293
|
}
|
|
@@ -12261,7 +12347,7 @@ class gI extends d {
|
|
|
12261
12347
|
received: I.data,
|
|
12262
12348
|
code: t.invalid_literal,
|
|
12263
12349
|
expected: this._def.value
|
|
12264
|
-
}),
|
|
12350
|
+
}), k;
|
|
12265
12351
|
}
|
|
12266
12352
|
return { status: "valid", value: A.data };
|
|
12267
12353
|
}
|
|
@@ -12292,7 +12378,7 @@ class yA extends d {
|
|
|
12292
12378
|
expected: H.joinValues(B),
|
|
12293
12379
|
received: I.parsedType,
|
|
12294
12380
|
code: t.invalid_type
|
|
12295
|
-
}),
|
|
12381
|
+
}), k;
|
|
12296
12382
|
}
|
|
12297
12383
|
if (UI(this, WA) || HB(this, WA, new Set(this._def.values)), !UI(this, WA).has(A.data)) {
|
|
12298
12384
|
const I = this._getOrReturnCtx(A), B = this._def.values;
|
|
@@ -12300,9 +12386,9 @@ class yA extends d {
|
|
|
12300
12386
|
received: I.data,
|
|
12301
12387
|
code: t.invalid_enum_value,
|
|
12302
12388
|
options: B
|
|
12303
|
-
}),
|
|
12389
|
+
}), k;
|
|
12304
12390
|
}
|
|
12305
|
-
return
|
|
12391
|
+
return P(A.data);
|
|
12306
12392
|
}
|
|
12307
12393
|
get options() {
|
|
12308
12394
|
return this._def.values;
|
|
@@ -12346,13 +12432,13 @@ class BI extends d {
|
|
|
12346
12432
|
}
|
|
12347
12433
|
_parse(A) {
|
|
12348
12434
|
const I = H.getValidEnumValues(this._def.values), B = this._getOrReturnCtx(A);
|
|
12349
|
-
if (B.parsedType !==
|
|
12435
|
+
if (B.parsedType !== n.string && B.parsedType !== n.number) {
|
|
12350
12436
|
const Q = H.objectValues(I);
|
|
12351
12437
|
return w(B, {
|
|
12352
12438
|
expected: H.joinValues(Q),
|
|
12353
12439
|
received: B.parsedType,
|
|
12354
12440
|
code: t.invalid_type
|
|
12355
|
-
}),
|
|
12441
|
+
}), k;
|
|
12356
12442
|
}
|
|
12357
12443
|
if (UI(this, xA) || HB(this, xA, new Set(H.getValidEnumValues(this._def.values))), !UI(this, xA).has(A.data)) {
|
|
12358
12444
|
const Q = H.objectValues(I);
|
|
@@ -12360,9 +12446,9 @@ class BI extends d {
|
|
|
12360
12446
|
received: B.data,
|
|
12361
12447
|
code: t.invalid_enum_value,
|
|
12362
12448
|
options: Q
|
|
12363
|
-
}),
|
|
12449
|
+
}), k;
|
|
12364
12450
|
}
|
|
12365
|
-
return
|
|
12451
|
+
return P(A.data);
|
|
12366
12452
|
}
|
|
12367
12453
|
get enum() {
|
|
12368
12454
|
return this._def.values;
|
|
@@ -12380,14 +12466,14 @@ class lA extends d {
|
|
|
12380
12466
|
}
|
|
12381
12467
|
_parse(A) {
|
|
12382
12468
|
const { ctx: I } = this._processInputParams(A);
|
|
12383
|
-
if (I.parsedType !==
|
|
12469
|
+
if (I.parsedType !== n.promise && I.common.async === !1)
|
|
12384
12470
|
return w(I, {
|
|
12385
12471
|
code: t.invalid_type,
|
|
12386
|
-
expected:
|
|
12472
|
+
expected: n.promise,
|
|
12387
12473
|
received: I.parsedType
|
|
12388
|
-
}),
|
|
12389
|
-
const B = I.parsedType ===
|
|
12390
|
-
return
|
|
12474
|
+
}), k;
|
|
12475
|
+
const B = I.parsedType === n.promise ? I.data : Promise.resolve(I.data);
|
|
12476
|
+
return P(B.then((Q) => this._def.type.parseAsync(Q, {
|
|
12391
12477
|
path: I.path,
|
|
12392
12478
|
errorMap: I.common.contextualErrorMap
|
|
12393
12479
|
})));
|
|
@@ -12419,23 +12505,23 @@ class QA extends d {
|
|
|
12419
12505
|
if (B.common.async)
|
|
12420
12506
|
return Promise.resolve(E).then(async (i) => {
|
|
12421
12507
|
if (I.value === "aborted")
|
|
12422
|
-
return
|
|
12508
|
+
return k;
|
|
12423
12509
|
const o = await this._def.schema._parseAsync({
|
|
12424
12510
|
data: i,
|
|
12425
12511
|
path: B.path,
|
|
12426
12512
|
parent: B
|
|
12427
12513
|
});
|
|
12428
|
-
return o.status === "aborted" ?
|
|
12514
|
+
return o.status === "aborted" ? k : o.status === "dirty" || I.value === "dirty" ? MA(o.value) : o;
|
|
12429
12515
|
});
|
|
12430
12516
|
{
|
|
12431
12517
|
if (I.value === "aborted")
|
|
12432
|
-
return
|
|
12518
|
+
return k;
|
|
12433
12519
|
const i = this._def.schema._parseSync({
|
|
12434
12520
|
data: E,
|
|
12435
12521
|
path: B.path,
|
|
12436
12522
|
parent: B
|
|
12437
12523
|
});
|
|
12438
|
-
return i.status === "aborted" ?
|
|
12524
|
+
return i.status === "aborted" ? k : i.status === "dirty" || I.value === "dirty" ? MA(i.value) : i;
|
|
12439
12525
|
}
|
|
12440
12526
|
}
|
|
12441
12527
|
if (Q.type === "refinement") {
|
|
@@ -12453,9 +12539,9 @@ class QA extends d {
|
|
|
12453
12539
|
path: B.path,
|
|
12454
12540
|
parent: B
|
|
12455
12541
|
});
|
|
12456
|
-
return i.status === "aborted" ?
|
|
12542
|
+
return i.status === "aborted" ? k : (i.status === "dirty" && I.dirty(), E(i.value), { status: I.value, value: i.value });
|
|
12457
12543
|
} else
|
|
12458
|
-
return this._def.schema._parseAsync({ data: B.data, path: B.path, parent: B }).then((i) => i.status === "aborted" ?
|
|
12544
|
+
return this._def.schema._parseAsync({ data: B.data, path: B.path, parent: B }).then((i) => i.status === "aborted" ? k : (i.status === "dirty" && I.dirty(), E(i.value).then(() => ({ status: I.value, value: i.value }))));
|
|
12459
12545
|
}
|
|
12460
12546
|
if (Q.type === "transform")
|
|
12461
12547
|
if (B.common.async === !1) {
|
|
@@ -12489,7 +12575,7 @@ QA.createWithPreprocess = (g, A, I) => new QA({
|
|
|
12489
12575
|
});
|
|
12490
12576
|
class CA extends d {
|
|
12491
12577
|
_parse(A) {
|
|
12492
|
-
return this._getType(A) ===
|
|
12578
|
+
return this._getType(A) === n.undefined ? P(void 0) : this._def.innerType._parse(A);
|
|
12493
12579
|
}
|
|
12494
12580
|
unwrap() {
|
|
12495
12581
|
return this._def.innerType;
|
|
@@ -12502,7 +12588,7 @@ CA.create = (g, A) => new CA({
|
|
|
12502
12588
|
});
|
|
12503
12589
|
class tA extends d {
|
|
12504
12590
|
_parse(A) {
|
|
12505
|
-
return this._getType(A) ===
|
|
12591
|
+
return this._getType(A) === n.null ? P(null) : this._def.innerType._parse(A);
|
|
12506
12592
|
}
|
|
12507
12593
|
unwrap() {
|
|
12508
12594
|
return this._def.innerType;
|
|
@@ -12517,7 +12603,7 @@ class QI extends d {
|
|
|
12517
12603
|
_parse(A) {
|
|
12518
12604
|
const { ctx: I } = this._processInputParams(A);
|
|
12519
12605
|
let B = I.data;
|
|
12520
|
-
return I.parsedType ===
|
|
12606
|
+
return I.parsedType === n.undefined && (B = this._def.defaultValue()), this._def.innerType._parse({
|
|
12521
12607
|
data: B,
|
|
12522
12608
|
path: I.path,
|
|
12523
12609
|
parent: I
|
|
@@ -12552,7 +12638,7 @@ class CI extends d {
|
|
|
12552
12638
|
status: "valid",
|
|
12553
12639
|
value: C.status === "valid" ? C.value : this._def.catchValue({
|
|
12554
12640
|
get error() {
|
|
12555
|
-
return new
|
|
12641
|
+
return new v(B.common.issues);
|
|
12556
12642
|
},
|
|
12557
12643
|
input: B.data
|
|
12558
12644
|
})
|
|
@@ -12560,7 +12646,7 @@ class CI extends d {
|
|
|
12560
12646
|
status: "valid",
|
|
12561
12647
|
value: Q.status === "valid" ? Q.value : this._def.catchValue({
|
|
12562
12648
|
get error() {
|
|
12563
|
-
return new
|
|
12649
|
+
return new v(B.common.issues);
|
|
12564
12650
|
},
|
|
12565
12651
|
input: B.data
|
|
12566
12652
|
})
|
|
@@ -12578,13 +12664,13 @@ CI.create = (g, A) => new CI({
|
|
|
12578
12664
|
});
|
|
12579
12665
|
class YI extends d {
|
|
12580
12666
|
_parse(A) {
|
|
12581
|
-
if (this._getType(A) !==
|
|
12667
|
+
if (this._getType(A) !== n.nan) {
|
|
12582
12668
|
const B = this._getOrReturnCtx(A);
|
|
12583
12669
|
return w(B, {
|
|
12584
12670
|
code: t.invalid_type,
|
|
12585
|
-
expected:
|
|
12671
|
+
expected: n.nan,
|
|
12586
12672
|
received: B.parsedType
|
|
12587
|
-
}),
|
|
12673
|
+
}), k;
|
|
12588
12674
|
}
|
|
12589
12675
|
return { status: "valid", value: A.data };
|
|
12590
12676
|
}
|
|
@@ -12593,7 +12679,7 @@ YI.create = (g) => new YI({
|
|
|
12593
12679
|
typeName: U.ZodNaN,
|
|
12594
12680
|
...Y(g)
|
|
12595
12681
|
});
|
|
12596
|
-
const
|
|
12682
|
+
const ai = Symbol("zod_brand");
|
|
12597
12683
|
class Ug extends d {
|
|
12598
12684
|
_parse(A) {
|
|
12599
12685
|
const { ctx: I } = this._processInputParams(A), B = I.data;
|
|
@@ -12617,7 +12703,7 @@ class yI extends d {
|
|
|
12617
12703
|
path: B.path,
|
|
12618
12704
|
parent: B
|
|
12619
12705
|
});
|
|
12620
|
-
return C.status === "aborted" ?
|
|
12706
|
+
return C.status === "aborted" ? k : C.status === "dirty" ? (I.dirty(), MA(C.value)) : this._def.out._parseAsync({
|
|
12621
12707
|
data: C.value,
|
|
12622
12708
|
path: B.path,
|
|
12623
12709
|
parent: B
|
|
@@ -12629,7 +12715,7 @@ class yI extends d {
|
|
|
12629
12715
|
path: B.path,
|
|
12630
12716
|
parent: B
|
|
12631
12717
|
});
|
|
12632
|
-
return Q.status === "aborted" ?
|
|
12718
|
+
return Q.status === "aborted" ? k : Q.status === "dirty" ? (I.dirty(), {
|
|
12633
12719
|
status: "dirty",
|
|
12634
12720
|
value: Q.value
|
|
12635
12721
|
}) : this._def.out._parseSync({
|
|
@@ -12683,16 +12769,16 @@ function mB(g, A = {}, I) {
|
|
|
12683
12769
|
}
|
|
12684
12770
|
}) : qA.create();
|
|
12685
12771
|
}
|
|
12686
|
-
const
|
|
12772
|
+
const Di = {
|
|
12687
12773
|
object: f.lazycreate
|
|
12688
12774
|
};
|
|
12689
12775
|
var U;
|
|
12690
12776
|
(function(g) {
|
|
12691
12777
|
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";
|
|
12692
12778
|
})(U || (U = {}));
|
|
12693
|
-
const
|
|
12779
|
+
const si = (g, A = {
|
|
12694
12780
|
message: `Input not instance of ${g.name}`
|
|
12695
|
-
}) => mB((I) => I instanceof g, A), uB = $.create, TB = sA.create,
|
|
12781
|
+
}) => mB((I) => I instanceof g, A), uB = $.create, TB = sA.create, hi = YI.create, yi = hA.create, WB = XA.create, ti = UA.create, Gi = kI.create, wi = jA.create, Fi = zA.create, ni = qA.create, ei = SA.create, ri = DA.create, Si = LI.create, Ri = BA.create, Ni = f.create, ci = f.strictCreate, Ui = _A.create, ki = qI.create, Li = $A.create, Ji = iA.create, Yi = AI.create, Mi = JI.create, Ki = kA.create, di = KA.create, Hi = II.create, qi = gI.create, li = yA.create, fi = BI.create, pi = lA.create, aB = QA.create, mi = CA.create, ui = tA.create, Ti = QA.createWithPreprocess, Wi = yI.create, xi = () => uB().optional(), bi = () => TB().optional(), Zi = () => WB().optional(), Pi = {
|
|
12696
12782
|
string: (g) => $.create({ ...g, coerce: !0 }),
|
|
12697
12783
|
number: (g) => sA.create({ ...g, coerce: !0 }),
|
|
12698
12784
|
boolean: (g) => XA.create({
|
|
@@ -12701,19 +12787,19 @@ const ai = (g, A = {
|
|
|
12701
12787
|
}),
|
|
12702
12788
|
bigint: (g) => hA.create({ ...g, coerce: !0 }),
|
|
12703
12789
|
date: (g) => UA.create({ ...g, coerce: !0 })
|
|
12704
|
-
},
|
|
12790
|
+
}, Oi = k;
|
|
12705
12791
|
var s = /* @__PURE__ */ Object.freeze({
|
|
12706
12792
|
__proto__: null,
|
|
12707
12793
|
defaultErrorMap: HA,
|
|
12708
|
-
setErrorMap:
|
|
12794
|
+
setErrorMap: TE,
|
|
12709
12795
|
getErrorMap: NI,
|
|
12710
12796
|
makeIssue: cI,
|
|
12711
|
-
EMPTY_PATH:
|
|
12797
|
+
EMPTY_PATH: WE,
|
|
12712
12798
|
addIssueToContext: w,
|
|
12713
|
-
ParseStatus:
|
|
12714
|
-
INVALID:
|
|
12799
|
+
ParseStatus: x,
|
|
12800
|
+
INVALID: k,
|
|
12715
12801
|
DIRTY: MA,
|
|
12716
|
-
OK:
|
|
12802
|
+
OK: P,
|
|
12717
12803
|
isAborted: Bg,
|
|
12718
12804
|
isDirty: Qg,
|
|
12719
12805
|
isValid: cA,
|
|
@@ -12724,7 +12810,7 @@ var s = /* @__PURE__ */ Object.freeze({
|
|
|
12724
12810
|
get objectUtil() {
|
|
12725
12811
|
return gg;
|
|
12726
12812
|
},
|
|
12727
|
-
ZodParsedType:
|
|
12813
|
+
ZodParsedType: n,
|
|
12728
12814
|
getParsedType: aA,
|
|
12729
12815
|
ZodType: d,
|
|
12730
12816
|
datetimeRegex: fB,
|
|
@@ -12762,63 +12848,63 @@ var s = /* @__PURE__ */ Object.freeze({
|
|
|
12762
12848
|
ZodDefault: QI,
|
|
12763
12849
|
ZodCatch: CI,
|
|
12764
12850
|
ZodNaN: YI,
|
|
12765
|
-
BRAND:
|
|
12851
|
+
BRAND: ai,
|
|
12766
12852
|
ZodBranded: Ug,
|
|
12767
12853
|
ZodPipeline: yI,
|
|
12768
12854
|
ZodReadonly: EI,
|
|
12769
12855
|
custom: mB,
|
|
12770
12856
|
Schema: d,
|
|
12771
12857
|
ZodSchema: d,
|
|
12772
|
-
late:
|
|
12858
|
+
late: Di,
|
|
12773
12859
|
get ZodFirstPartyTypeKind() {
|
|
12774
12860
|
return U;
|
|
12775
12861
|
},
|
|
12776
|
-
coerce:
|
|
12777
|
-
any:
|
|
12778
|
-
array:
|
|
12779
|
-
bigint:
|
|
12862
|
+
coerce: Pi,
|
|
12863
|
+
any: ni,
|
|
12864
|
+
array: Ri,
|
|
12865
|
+
bigint: yi,
|
|
12780
12866
|
boolean: WB,
|
|
12781
|
-
date:
|
|
12782
|
-
discriminatedUnion:
|
|
12867
|
+
date: ti,
|
|
12868
|
+
discriminatedUnion: ki,
|
|
12783
12869
|
effect: aB,
|
|
12784
|
-
enum:
|
|
12785
|
-
function:
|
|
12786
|
-
instanceof:
|
|
12787
|
-
intersection:
|
|
12788
|
-
lazy:
|
|
12789
|
-
literal:
|
|
12790
|
-
map:
|
|
12791
|
-
nan:
|
|
12792
|
-
nativeEnum:
|
|
12793
|
-
never:
|
|
12794
|
-
null:
|
|
12795
|
-
nullable:
|
|
12870
|
+
enum: li,
|
|
12871
|
+
function: di,
|
|
12872
|
+
instanceof: si,
|
|
12873
|
+
intersection: Li,
|
|
12874
|
+
lazy: Hi,
|
|
12875
|
+
literal: qi,
|
|
12876
|
+
map: Mi,
|
|
12877
|
+
nan: hi,
|
|
12878
|
+
nativeEnum: fi,
|
|
12879
|
+
never: ri,
|
|
12880
|
+
null: Fi,
|
|
12881
|
+
nullable: ui,
|
|
12796
12882
|
number: TB,
|
|
12797
|
-
object:
|
|
12798
|
-
oboolean:
|
|
12799
|
-
onumber:
|
|
12800
|
-
optional:
|
|
12801
|
-
ostring:
|
|
12802
|
-
pipeline:
|
|
12803
|
-
preprocess:
|
|
12804
|
-
promise:
|
|
12805
|
-
record:
|
|
12806
|
-
set:
|
|
12807
|
-
strictObject:
|
|
12883
|
+
object: Ni,
|
|
12884
|
+
oboolean: Zi,
|
|
12885
|
+
onumber: bi,
|
|
12886
|
+
optional: mi,
|
|
12887
|
+
ostring: xi,
|
|
12888
|
+
pipeline: Wi,
|
|
12889
|
+
preprocess: Ti,
|
|
12890
|
+
promise: pi,
|
|
12891
|
+
record: Yi,
|
|
12892
|
+
set: Ki,
|
|
12893
|
+
strictObject: ci,
|
|
12808
12894
|
string: uB,
|
|
12809
|
-
symbol:
|
|
12895
|
+
symbol: Gi,
|
|
12810
12896
|
transformer: aB,
|
|
12811
|
-
tuple:
|
|
12812
|
-
undefined:
|
|
12813
|
-
union:
|
|
12814
|
-
unknown:
|
|
12815
|
-
void:
|
|
12816
|
-
NEVER:
|
|
12897
|
+
tuple: Ji,
|
|
12898
|
+
undefined: wi,
|
|
12899
|
+
union: Ui,
|
|
12900
|
+
unknown: ei,
|
|
12901
|
+
void: Si,
|
|
12902
|
+
NEVER: Oi,
|
|
12817
12903
|
ZodIssueCode: t,
|
|
12818
|
-
quotelessJson:
|
|
12819
|
-
ZodError:
|
|
12904
|
+
quotelessJson: uE,
|
|
12905
|
+
ZodError: v
|
|
12820
12906
|
});
|
|
12821
|
-
const
|
|
12907
|
+
const Vi = s.object({
|
|
12822
12908
|
/**The multiscale datasets for this image*/
|
|
12823
12909
|
multiscales: s.array(
|
|
12824
12910
|
s.object({
|
|
@@ -12946,7 +13032,7 @@ const Pi = s.object({
|
|
|
12946
13032
|
projection: s.string().optional()
|
|
12947
13033
|
}).optional()
|
|
12948
13034
|
}).optional()
|
|
12949
|
-
}).describe("JSON from OME-NGFF .zattrs"),
|
|
13035
|
+
}).describe("JSON from OME-NGFF .zattrs"), vi = s.object({
|
|
12950
13036
|
plate: s.object({
|
|
12951
13037
|
/**The acquisitions for this plate*/
|
|
12952
13038
|
acquisitions: s.array(
|
|
@@ -13005,7 +13091,7 @@ const Pi = s.object({
|
|
|
13005
13091
|
})
|
|
13006
13092
|
).min(1).describe("The wells of the plate")
|
|
13007
13093
|
}).optional()
|
|
13008
|
-
}).describe("JSON from OME-NGFF .zattrs"),
|
|
13094
|
+
}).describe("JSON from OME-NGFF .zattrs"), Xi = s.object({
|
|
13009
13095
|
well: s.object({
|
|
13010
13096
|
/**The fields of view for this well*/
|
|
13011
13097
|
images: s.array(
|
|
@@ -13019,7 +13105,7 @@ const Pi = s.object({
|
|
|
13019
13105
|
/**The version of the specification*/
|
|
13020
13106
|
version: s.literal("0.4").describe("The version of the specification").optional()
|
|
13021
13107
|
}).optional()
|
|
13022
|
-
}).describe("JSON from OME-NGFF .zattrs"),
|
|
13108
|
+
}).describe("JSON from OME-NGFF .zattrs"), ji = s.object({
|
|
13023
13109
|
/**The versioned OME-Zarr Metadata namespace*/
|
|
13024
13110
|
ome: s.object({
|
|
13025
13111
|
/**The multiscale datasets for this image*/
|
|
@@ -13149,7 +13235,7 @@ const Pi = s.object({
|
|
|
13149
13235
|
/**The version of the OME-Zarr Metadata*/
|
|
13150
13236
|
version: s.literal("0.5").describe("The version of the OME-Zarr Metadata")
|
|
13151
13237
|
}).describe("The versioned OME-Zarr Metadata namespace")
|
|
13152
|
-
}).describe("The zarr.json attributes key"),
|
|
13238
|
+
}).describe("The zarr.json attributes key"), zi = s.object({
|
|
13153
13239
|
/**The versioned OME-Zarr Metadata namespace*/
|
|
13154
13240
|
ome: s.object({
|
|
13155
13241
|
plate: s.object({
|
|
@@ -13211,7 +13297,7 @@ const Pi = s.object({
|
|
|
13211
13297
|
/**The version of the OME-Zarr Metadata*/
|
|
13212
13298
|
version: s.literal("0.5").describe("The version of the OME-Zarr Metadata")
|
|
13213
13299
|
}).describe("The versioned OME-Zarr Metadata namespace")
|
|
13214
|
-
}).describe("The zarr.json attributes key"),
|
|
13300
|
+
}).describe("The zarr.json attributes key"), _i = s.object({
|
|
13215
13301
|
/**The versioned OME-Zarr Metadata namespace*/
|
|
13216
13302
|
ome: s.object({
|
|
13217
13303
|
well: s.object({
|
|
@@ -13230,15 +13316,15 @@ const Pi = s.object({
|
|
|
13230
13316
|
/**The version of the OME-Zarr Metadata*/
|
|
13231
13317
|
version: s.literal("0.5").describe("The version of the OME-Zarr Metadata")
|
|
13232
13318
|
}).describe("The versioned OME-Zarr Metadata namespace")
|
|
13233
|
-
}).describe("JSON from OME-Zarr zarr.json"),
|
|
13234
|
-
function
|
|
13319
|
+
}).describe("JSON from OME-Zarr zarr.json"), $i = ["0.4", "0.5"], Ao = new Set($i);
|
|
13320
|
+
function Io(g) {
|
|
13235
13321
|
if (!("ome" in g) || !(g.ome instanceof Object)) return;
|
|
13236
13322
|
const A = g.ome;
|
|
13237
|
-
if ("version" in A && typeof A.version == "string" &&
|
|
13323
|
+
if ("version" in A && typeof A.version == "string" && Ao.has(A.version))
|
|
13238
13324
|
return A.version;
|
|
13239
13325
|
}
|
|
13240
13326
|
function kg(g) {
|
|
13241
|
-
const A =
|
|
13327
|
+
const A = Io(g);
|
|
13242
13328
|
return A === void 0 ? "0.4" : A;
|
|
13243
13329
|
}
|
|
13244
13330
|
function fA(g) {
|
|
@@ -13254,10 +13340,10 @@ function xB(g, A) {
|
|
|
13254
13340
|
const I = { ...g };
|
|
13255
13341
|
return delete I[A], I;
|
|
13256
13342
|
}
|
|
13257
|
-
async function
|
|
13343
|
+
async function So(g, A) {
|
|
13258
13344
|
const I = new _(new sI(g)), B = fA(A), Q = await hI(I, B);
|
|
13259
13345
|
try {
|
|
13260
|
-
return
|
|
13346
|
+
return go(Q.attrs);
|
|
13261
13347
|
} catch {
|
|
13262
13348
|
throw Error(
|
|
13263
13349
|
`Failed to parse OME-Zarr plate:
|
|
@@ -13265,21 +13351,21 @@ ${JSON.stringify(Q.attrs)}`
|
|
|
13265
13351
|
);
|
|
13266
13352
|
}
|
|
13267
13353
|
}
|
|
13268
|
-
function
|
|
13354
|
+
function go(g) {
|
|
13269
13355
|
switch (kg(g)) {
|
|
13270
13356
|
case "0.5":
|
|
13271
13357
|
return {
|
|
13272
|
-
...
|
|
13358
|
+
...zi.parse(g).ome,
|
|
13273
13359
|
originalVersion: "0.5"
|
|
13274
13360
|
};
|
|
13275
13361
|
case "0.4":
|
|
13276
13362
|
return {
|
|
13277
|
-
...
|
|
13363
|
+
...Bo(vi.parse(g)).ome,
|
|
13278
13364
|
originalVersion: "0.4"
|
|
13279
13365
|
};
|
|
13280
13366
|
}
|
|
13281
13367
|
}
|
|
13282
|
-
function
|
|
13368
|
+
function Bo(g) {
|
|
13283
13369
|
if (g.plate === void 0)
|
|
13284
13370
|
throw new Error("Plate metadata is missing in OME-Zarr v0.4 plate");
|
|
13285
13371
|
return {
|
|
@@ -13289,7 +13375,7 @@ function Io(g) {
|
|
|
13289
13375
|
}
|
|
13290
13376
|
};
|
|
13291
13377
|
}
|
|
13292
|
-
function
|
|
13378
|
+
function Qo(g) {
|
|
13293
13379
|
if (g.well === void 0)
|
|
13294
13380
|
throw new Error("Well metadata is missing in OME-Zarr v0.4 well");
|
|
13295
13381
|
return {
|
|
@@ -13299,24 +13385,24 @@ function go(g) {
|
|
|
13299
13385
|
}
|
|
13300
13386
|
};
|
|
13301
13387
|
}
|
|
13302
|
-
function
|
|
13388
|
+
function Co(g) {
|
|
13303
13389
|
switch (kg(g)) {
|
|
13304
13390
|
case "0.5":
|
|
13305
13391
|
return {
|
|
13306
|
-
...
|
|
13392
|
+
..._i.parse(g).ome,
|
|
13307
13393
|
originalVersion: "0.5"
|
|
13308
13394
|
};
|
|
13309
13395
|
case "0.4":
|
|
13310
13396
|
return {
|
|
13311
|
-
...
|
|
13397
|
+
...Qo(Xi.parse(g)).ome,
|
|
13312
13398
|
originalVersion: "0.4"
|
|
13313
13399
|
};
|
|
13314
13400
|
}
|
|
13315
13401
|
}
|
|
13316
|
-
async function
|
|
13402
|
+
async function Ro(g, A, I) {
|
|
13317
13403
|
const B = new _(new sI(g + "/" + A)), Q = fA(I), C = await hI(B, Q);
|
|
13318
13404
|
try {
|
|
13319
|
-
return
|
|
13405
|
+
return Co(C.attrs);
|
|
13320
13406
|
} catch {
|
|
13321
13407
|
throw Error(
|
|
13322
13408
|
`Failed to parse OME-Zarr well:
|
|
@@ -13324,15 +13410,15 @@ ${JSON.stringify(C.attrs)}`
|
|
|
13324
13410
|
);
|
|
13325
13411
|
}
|
|
13326
13412
|
}
|
|
13327
|
-
async function
|
|
13413
|
+
async function No(g) {
|
|
13328
13414
|
const A = fA(g.version), I = await hI(g.location, A);
|
|
13329
13415
|
return Lg(I.attrs).omero?.channels ?? [];
|
|
13330
13416
|
}
|
|
13331
|
-
async function
|
|
13417
|
+
async function co(g) {
|
|
13332
13418
|
const A = fA(g.version), I = await hI(g.location, A);
|
|
13333
13419
|
return Lg(I.attrs).omero?.rdefs;
|
|
13334
13420
|
}
|
|
13335
|
-
function
|
|
13421
|
+
function Eo(g) {
|
|
13336
13422
|
return {
|
|
13337
13423
|
ome: {
|
|
13338
13424
|
multiscales: g.multiscales,
|
|
@@ -13341,43 +13427,33 @@ function Qo(g) {
|
|
|
13341
13427
|
}
|
|
13342
13428
|
};
|
|
13343
13429
|
}
|
|
13344
|
-
function
|
|
13430
|
+
function io(g) {
|
|
13345
13431
|
switch (kg(g)) {
|
|
13346
13432
|
case "0.5":
|
|
13347
13433
|
return {
|
|
13348
|
-
...
|
|
13434
|
+
...ji.parse(g).ome,
|
|
13349
13435
|
originalVersion: "0.5"
|
|
13350
13436
|
};
|
|
13351
13437
|
case "0.4":
|
|
13352
13438
|
return {
|
|
13353
|
-
...
|
|
13439
|
+
...Eo(Vi.parse(g)).ome,
|
|
13354
13440
|
originalVersion: "0.4"
|
|
13355
13441
|
};
|
|
13356
13442
|
}
|
|
13357
13443
|
}
|
|
13358
13444
|
function Lg(g) {
|
|
13359
13445
|
try {
|
|
13360
|
-
return
|
|
13446
|
+
return io(g);
|
|
13361
13447
|
} catch {
|
|
13362
13448
|
throw Error(`Failed to parse OME-Zarr image:
|
|
13363
13449
|
${JSON.stringify(g)}`);
|
|
13364
13450
|
}
|
|
13365
13451
|
}
|
|
13366
|
-
class
|
|
13452
|
+
class Uo {
|
|
13367
13453
|
location;
|
|
13368
13454
|
version;
|
|
13369
|
-
fetchOptions;
|
|
13370
|
-
// Implementation signature that handles both overloads above.
|
|
13371
|
-
// For URLs: 2nd param can be version or fetchOptions, 3rd param is fetchOptions
|
|
13372
|
-
// For FileSystemDirectoryHandle: 2nd param is version, 3rd param is path
|
|
13373
13455
|
constructor(A, I, B) {
|
|
13374
|
-
|
|
13375
|
-
const Q = typeof I == "string" ? I : void 0, C = typeof I == "object" ? I : B;
|
|
13376
|
-
this.location = new _(new sI(A, C)), this.version = Q, this.fetchOptions = C;
|
|
13377
|
-
} else {
|
|
13378
|
-
const Q = typeof I == "string" ? I : void 0, C = typeof B == "string" ? B : void 0;
|
|
13379
|
-
this.location = new _(new cg(A), C), this.version = Q, this.fetchOptions = void 0;
|
|
13380
|
-
}
|
|
13456
|
+
this.location = typeof A == "string" ? new _(new sI(A)) : new _(new cg(A), B), this.version = I;
|
|
13381
13457
|
}
|
|
13382
13458
|
async open() {
|
|
13383
13459
|
let A = fA(this.version);
|
|
@@ -13391,15 +13467,15 @@ class No {
|
|
|
13391
13467
|
throw new Error("No datasets found in the multiscale image.");
|
|
13392
13468
|
A || (A = fA(B.originalVersion));
|
|
13393
13469
|
const E = C.datasets.map(
|
|
13394
|
-
(D) =>
|
|
13470
|
+
(D) => cE(this.location, D.path, A)
|
|
13395
13471
|
), i = await Promise.all(
|
|
13396
|
-
E.map((D) =>
|
|
13472
|
+
E.map((D) => NE(D))
|
|
13397
13473
|
), o = i[0].shape, a = C.axes;
|
|
13398
13474
|
if (a.length !== o.length)
|
|
13399
13475
|
throw new Error(
|
|
13400
13476
|
`Mismatch between number of axes (${a.length}) and array shape (${o.length})`
|
|
13401
13477
|
);
|
|
13402
|
-
return new
|
|
13478
|
+
return new lE({
|
|
13403
13479
|
metadata: C,
|
|
13404
13480
|
arrays: i,
|
|
13405
13481
|
arrayParams: E
|
|
@@ -13414,7 +13490,7 @@ const bB = [
|
|
|
13414
13490
|
"prefetchSpace"
|
|
13415
13491
|
];
|
|
13416
13492
|
function Jg(g) {
|
|
13417
|
-
|
|
13493
|
+
oo(g);
|
|
13418
13494
|
const A = {
|
|
13419
13495
|
x: g.prefetch.x,
|
|
13420
13496
|
y: g.prefetch.y,
|
|
@@ -13441,7 +13517,7 @@ function Jg(g) {
|
|
|
13441
13517
|
};
|
|
13442
13518
|
return Object.freeze(Q);
|
|
13443
13519
|
}
|
|
13444
|
-
function
|
|
13520
|
+
function ko(g = {}) {
|
|
13445
13521
|
return Jg(Yg({
|
|
13446
13522
|
profile: "exploration",
|
|
13447
13523
|
prefetch: { x: 1, y: 1, z: 1, t: 0 },
|
|
@@ -13454,7 +13530,7 @@ function co(g = {}) {
|
|
|
13454
13530
|
]
|
|
13455
13531
|
}, g));
|
|
13456
13532
|
}
|
|
13457
|
-
function
|
|
13533
|
+
function Lo(g = {}) {
|
|
13458
13534
|
return Jg(Yg({
|
|
13459
13535
|
profile: "playback",
|
|
13460
13536
|
prefetch: { x: 0, y: 0, z: 0, t: 20 },
|
|
@@ -13467,7 +13543,7 @@ function Uo(g = {}) {
|
|
|
13467
13543
|
]
|
|
13468
13544
|
}, g));
|
|
13469
13545
|
}
|
|
13470
|
-
function
|
|
13546
|
+
function Jo(g = {}) {
|
|
13471
13547
|
return Jg(Yg({
|
|
13472
13548
|
profile: "no-prefetch",
|
|
13473
13549
|
prefetch: { x: 0, y: 0, z: 0, t: 0 },
|
|
@@ -13480,7 +13556,7 @@ function ko(g = {}) {
|
|
|
13480
13556
|
]
|
|
13481
13557
|
}, g));
|
|
13482
13558
|
}
|
|
13483
|
-
function
|
|
13559
|
+
function oo(g) {
|
|
13484
13560
|
for (const [B, Q] of Object.entries(g.prefetch))
|
|
13485
13561
|
if (Q !== void 0 && Q < 0)
|
|
13486
13562
|
throw new Error(`prefetch.${B} must be a non-negative number`);
|
|
@@ -13499,7 +13575,7 @@ function Yg(g, A = {}) {
|
|
|
13499
13575
|
priorityOrder: A.priorityOrder ?? g.priorityOrder
|
|
13500
13576
|
};
|
|
13501
13577
|
}
|
|
13502
|
-
class
|
|
13578
|
+
class Yo {
|
|
13503
13579
|
radius;
|
|
13504
13580
|
phi;
|
|
13505
13581
|
theta;
|
|
@@ -13515,7 +13591,7 @@ class Lo {
|
|
|
13515
13591
|
);
|
|
13516
13592
|
}
|
|
13517
13593
|
}
|
|
13518
|
-
class
|
|
13594
|
+
class Mo extends mA {
|
|
13519
13595
|
atlas_;
|
|
13520
13596
|
constructor(A, I) {
|
|
13521
13597
|
super(), this.programName = "points", this.atlas_ = I, A.forEach((C) => {
|
|
@@ -13559,40 +13635,40 @@ class Jo extends mA {
|
|
|
13559
13635
|
}
|
|
13560
13636
|
}
|
|
13561
13637
|
export {
|
|
13562
|
-
|
|
13638
|
+
yo as AxesLayer,
|
|
13563
13639
|
j as Box2,
|
|
13564
13640
|
eA as Box3,
|
|
13565
13641
|
RB as ChunkedImageLayer,
|
|
13566
13642
|
l as Color,
|
|
13567
|
-
|
|
13568
|
-
|
|
13569
|
-
|
|
13570
|
-
|
|
13571
|
-
|
|
13643
|
+
BC as Frustum,
|
|
13644
|
+
ao as Idetik,
|
|
13645
|
+
Fo as ImageLayer,
|
|
13646
|
+
eo as ImageSeriesLayer,
|
|
13647
|
+
no as LabelImageLayer,
|
|
13572
13648
|
GA as Layer,
|
|
13573
|
-
|
|
13574
|
-
|
|
13575
|
-
|
|
13576
|
-
|
|
13577
|
-
|
|
13649
|
+
OQ as LayerManager,
|
|
13650
|
+
Uo as OmeZarrImageSource,
|
|
13651
|
+
Do as OrthographicCamera,
|
|
13652
|
+
ho as PanZoomControls,
|
|
13653
|
+
so as PerspectiveCamera,
|
|
13578
13654
|
JA as Plane,
|
|
13579
|
-
|
|
13580
|
-
|
|
13581
|
-
|
|
13655
|
+
Mo as Points,
|
|
13656
|
+
to as ProjectedLineLayer,
|
|
13657
|
+
Yo as Spherical,
|
|
13582
13658
|
iI as Texture2DArray,
|
|
13583
13659
|
yg as Texture3D,
|
|
13584
|
-
|
|
13585
|
-
|
|
13586
|
-
|
|
13660
|
+
Go as TracksLayer,
|
|
13661
|
+
jQ as Viewport,
|
|
13662
|
+
wo as VolumeLayer,
|
|
13587
13663
|
pQ as WebGLRenderer,
|
|
13588
|
-
|
|
13664
|
+
ko as createExplorationPolicy,
|
|
13589
13665
|
Jg as createImageSourcePolicy,
|
|
13590
|
-
|
|
13591
|
-
|
|
13592
|
-
|
|
13593
|
-
|
|
13594
|
-
|
|
13595
|
-
|
|
13596
|
-
|
|
13666
|
+
Jo as createNoPrefetchPolicy,
|
|
13667
|
+
Lo as createPlaybackPolicy,
|
|
13668
|
+
So as loadOmeZarrPlate,
|
|
13669
|
+
Ro as loadOmeZarrWell,
|
|
13670
|
+
No as loadOmeroChannels,
|
|
13671
|
+
co as loadOmeroDefaults,
|
|
13672
|
+
_Q as parseViewportConfigs
|
|
13597
13673
|
};
|
|
13598
13674
|
//# sourceMappingURL=index.js.map
|