@fxi/zartigl 0.13.1 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/catalog.js +1 -1
- package/dist/{engine-Bhb-WayM.js → engine-CiDquHYk.js} +315 -282
- package/dist/engine.js +31 -31
- package/dist/{index-DsKvU_FK.js → index-Cd7Nk4ve.js} +119 -117
- package/dist/zartigl.d.ts +11 -1
- package/dist/zartigl.js +573 -523
- package/package.json +2 -2
package/dist/zartigl.js
CHANGED
|
@@ -1,42 +1,48 @@
|
|
|
1
|
-
import { m as ae, p as
|
|
2
|
-
import { T as
|
|
3
|
-
import {
|
|
4
|
-
import { B as
|
|
5
|
-
import { f as
|
|
6
|
-
import { inflate as
|
|
7
|
-
import
|
|
8
|
-
const
|
|
9
|
-
function
|
|
10
|
-
return Math.max(-
|
|
11
|
-
}
|
|
12
|
-
function
|
|
13
|
-
const e =
|
|
1
|
+
import { m as ae, p as ft, s as pt, a as qe, b as Gt, r as ze, c as Ot, d as he, e as Bt, f as gt, g as $t } from "./index-Cd7Nk4ve.js";
|
|
2
|
+
import { T as qt, g as Wt, r as Xt, d as Ht, c as W, a as Yt, b as ge, e as Zt, f as J, h as Se, i as O, G as jt, j as We, F as Qt, s as vt, v as Q, k as K, l as Ge, m as Oe, n as yt, o as Xe, p as Ce, q as Kt, t as ke, u as Jt, w as _t, x as z, y as He, z as we, A as ei, B as ti, C as ii, D as Ye, E as ai, H as Fe, I as si, J as xt, K as ri, L as ni, M as oi, N as li } from "./engine-CiDquHYk.js";
|
|
3
|
+
import { O as Ua, P as Va } from "./engine-CiDquHYk.js";
|
|
4
|
+
import { B as ci, a as hi, b as ui, c as di, d as bt, r as St, e as mi, g as fi } from "./backdrop-Dceb4d8E.js";
|
|
5
|
+
import { f as za, i as Ga } from "./backdrop-Dceb4d8E.js";
|
|
6
|
+
import { inflate as pi } from "pako";
|
|
7
|
+
import gi from "numcodecs/blosc";
|
|
8
|
+
const Ie = 85, vi = 89.9;
|
|
9
|
+
function Ue(s) {
|
|
10
|
+
return Math.max(-Ie, Math.min(Ie, s));
|
|
11
|
+
}
|
|
12
|
+
function Ze(s) {
|
|
13
|
+
const e = Ue(s), t = Math.sin(e * Math.PI / 180);
|
|
14
14
|
return 0.5 - Math.log((1 + t) / (1 - t)) / (4 * Math.PI);
|
|
15
15
|
}
|
|
16
16
|
function ve(s) {
|
|
17
17
|
return (s + 180) / 360;
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function yi(s) {
|
|
20
20
|
return ((s + 180) % 360 + 360) % 360 - 180;
|
|
21
21
|
}
|
|
22
|
-
function
|
|
23
|
-
|
|
22
|
+
function ye(s, e) {
|
|
23
|
+
if (s.getProjection?.()?.type !== "globe")
|
|
24
|
+
return !1;
|
|
25
|
+
const t = e?.projectionTransition;
|
|
26
|
+
return typeof t == "number" ? t > 0 : !0;
|
|
27
|
+
}
|
|
28
|
+
function _i(s, e) {
|
|
29
|
+
const t = yi(s) * Math.PI / 180, i = e * Math.PI / 180, a = Math.cos(i);
|
|
24
30
|
return [
|
|
25
31
|
Math.sin(t) * a,
|
|
26
32
|
Math.sin(i),
|
|
27
33
|
Math.cos(t) * a
|
|
28
34
|
];
|
|
29
35
|
}
|
|
30
|
-
function
|
|
36
|
+
function xi(s) {
|
|
31
37
|
return {
|
|
32
38
|
west: -180,
|
|
33
39
|
east: 180,
|
|
34
|
-
south:
|
|
35
|
-
north:
|
|
40
|
+
south: Ue(s.getSouth()),
|
|
41
|
+
north: Ue(s.getNorth())
|
|
36
42
|
};
|
|
37
43
|
}
|
|
38
|
-
function
|
|
39
|
-
const i = t ?
|
|
44
|
+
function bi(s, e = 1, t = !1) {
|
|
45
|
+
const i = t ? vi : Ie, a = (d) => Math.max(-i, Math.min(i, d)), r = a(s.getSouth()), n = a(s.getNorth()), c = Math.max(0, n - r) * Math.max(0, e);
|
|
40
46
|
return {
|
|
41
47
|
west: -180,
|
|
42
48
|
east: 180,
|
|
@@ -44,10 +50,10 @@ function yi(s, e = 1, t = !1) {
|
|
|
44
50
|
north: a(n + c)
|
|
45
51
|
};
|
|
46
52
|
}
|
|
47
|
-
function
|
|
53
|
+
function Si(s, e, t = 1e-6) {
|
|
48
54
|
return s.south <= e.south + t && s.north >= e.north - t;
|
|
49
55
|
}
|
|
50
|
-
function
|
|
56
|
+
function wi(s, e = !1) {
|
|
51
57
|
const t = s.getWest(), i = s.getEast(), a = ve(t), r = ve(i), n = a - Math.floor(a), o = r - a >= 1 ? { minX: 0, maxX: 1 } : { minX: n, maxX: n + r - a };
|
|
52
58
|
return e ? {
|
|
53
59
|
...o,
|
|
@@ -55,11 +61,11 @@ function xi(s, e = !1) {
|
|
|
55
61
|
maxY: (Math.min(s.getNorth(), 90) + 90) / 180
|
|
56
62
|
} : {
|
|
57
63
|
...o,
|
|
58
|
-
minY:
|
|
59
|
-
maxY:
|
|
64
|
+
minY: Ze(s.getNorth()),
|
|
65
|
+
maxY: Ze(s.getSouth())
|
|
60
66
|
};
|
|
61
67
|
}
|
|
62
|
-
function
|
|
68
|
+
function Be(s, e) {
|
|
63
69
|
if (e)
|
|
64
70
|
return [0];
|
|
65
71
|
const t = ve(s.getWest()), i = ve(s.getEast()), a = [];
|
|
@@ -77,7 +83,7 @@ const ue = [
|
|
|
77
83
|
"u_velocity_flip_y",
|
|
78
84
|
"u_velocity_next_flip_y"
|
|
79
85
|
];
|
|
80
|
-
function
|
|
86
|
+
function Te(s, e, t) {
|
|
81
87
|
s.uniform1i(e.u_velocity_next, t.b.unit), s.uniform2f(e.u_velocity_next_min, ...t.b.min), s.uniform2f(e.u_velocity_next_max, ...t.b.max), s.uniform1f(e.u_velocity_mix, t.mix), s.uniform1f(e.u_velocity_physical, t.a.physical ? 1 : 0), s.uniform1f(e.u_velocity_next_physical, t.b.physical ? 1 : 0), s.uniform1f(e.u_velocity_flip_y, t.a.northToSouth ? 1 : 0), s.uniform1f(e.u_velocity_next_flip_y, t.b.northToSouth ? 1 : 0);
|
|
82
88
|
}
|
|
83
89
|
var de = `#version 300 es
|
|
@@ -89,7 +95,7 @@ out vec2 v_tex_coord;
|
|
|
89
95
|
void main() {
|
|
90
96
|
v_tex_coord = a_position * 0.5 + 0.5;
|
|
91
97
|
gl_Position = vec4(a_position, 0.0, 1.0);
|
|
92
|
-
}`,
|
|
98
|
+
}`, Ti = `#version 300 es
|
|
93
99
|
precision highp float;
|
|
94
100
|
|
|
95
101
|
uint pcg(uint v) {
|
|
@@ -359,7 +365,7 @@ void main() {
|
|
|
359
365
|
fract(newPos.y * 255.0)
|
|
360
366
|
);
|
|
361
367
|
#endif
|
|
362
|
-
}`,
|
|
368
|
+
}`, Mi = `precision highp float;
|
|
363
369
|
|
|
364
370
|
attribute float a_index;
|
|
365
371
|
attribute float a_is_curr;
|
|
@@ -591,7 +597,7 @@ void main() {
|
|
|
591
597
|
vec2 worldPos = vec2((pos.x + u_world_offset) * u_world_size, pos.y * u_world_size);
|
|
592
598
|
gl_Position = u_matrix * vec4(worldPos, 0.0, 1.0);
|
|
593
599
|
}
|
|
594
|
-
}`,
|
|
600
|
+
}`, Ri = `precision mediump float;
|
|
595
601
|
|
|
596
602
|
uniform sampler2D u_color_ramp;
|
|
597
603
|
uniform float u_particle_contrast;
|
|
@@ -630,7 +636,7 @@ void main() {
|
|
|
630
636
|
}
|
|
631
637
|
|
|
632
638
|
gl_FragColor = vec4(color.rgb, color.a * u_opacity);
|
|
633
|
-
}`,
|
|
639
|
+
}`, Pi = `#version 300 es
|
|
634
640
|
precision mediump float;
|
|
635
641
|
|
|
636
642
|
uniform sampler2D u_screen;
|
|
@@ -647,7 +653,7 @@ void main() {
|
|
|
647
653
|
float alpha = floor(color.a * 255.0 * u_opacity) / 255.0;
|
|
648
654
|
|
|
649
655
|
o_color = vec4(color.rgb * step(1.0 / 255.0, alpha), alpha);
|
|
650
|
-
}`,
|
|
656
|
+
}`, Ei = `#version 300 es
|
|
651
657
|
precision mediump float;
|
|
652
658
|
|
|
653
659
|
uniform sampler2D u_screen;
|
|
@@ -718,7 +724,7 @@ void main() {
|
|
|
718
724
|
}
|
|
719
725
|
vec3 rgb = u_grade_on > 0.5 ? gradeColor(color.rgb, u_grade) : color.rgb;
|
|
720
726
|
o_color = vec4(rgb, color.a);
|
|
721
|
-
}`,
|
|
727
|
+
}`, Li = `#version 300 es
|
|
722
728
|
precision mediump float;
|
|
723
729
|
|
|
724
730
|
uniform sampler2D u_screen;
|
|
@@ -755,7 +761,7 @@ vec4 addGlow(vec4 trail, sampler2D glowTex, vec2 uv, float gain) {
|
|
|
755
761
|
|
|
756
762
|
void main() {
|
|
757
763
|
o_color = glowGather(u_screen, ivec2(gl_FragCoord.xy));
|
|
758
|
-
}`,
|
|
764
|
+
}`, wt = `precision highp float;
|
|
759
765
|
|
|
760
766
|
attribute vec2 a_grid_uv;
|
|
761
767
|
|
|
@@ -786,7 +792,7 @@ void main() {
|
|
|
786
792
|
|
|
787
793
|
v_geo_uv = a_grid_uv;
|
|
788
794
|
gl_Position = u_matrix * vec4(worldPos, 0.0, 1.0);
|
|
789
|
-
}`,
|
|
795
|
+
}`, Di = `precision mediump float;
|
|
790
796
|
|
|
791
797
|
uniform sampler2D u_field;
|
|
792
798
|
uniform sampler2D u_color_ramp;
|
|
@@ -885,7 +891,7 @@ void main() {
|
|
|
885
891
|
vec4 color = texture2D(u_color_ramp, vec2(t, 0.5));
|
|
886
892
|
color.rgb = applyVibrance(color.rgb, u_vibrance);
|
|
887
893
|
gl_FragColor = vec4(color.rgb, color.a * u_opacity);
|
|
888
|
-
}`,
|
|
894
|
+
}`, Tt = `precision highp float;
|
|
889
895
|
|
|
890
896
|
attribute vec2 a_grid_uv;
|
|
891
897
|
|
|
@@ -893,8 +899,13 @@ uniform mat4 u_matrix;
|
|
|
893
899
|
uniform vec4 u_geo_bounds;
|
|
894
900
|
uniform vec4 u_clipping_plane;
|
|
895
901
|
|
|
902
|
+
uniform float u_projection_transition;
|
|
903
|
+
uniform mat4 u_fallback_matrix;
|
|
904
|
+
|
|
896
905
|
varying vec2 v_geo_uv;
|
|
897
906
|
|
|
907
|
+
const float PI = 3.14159265358979323846;
|
|
908
|
+
|
|
898
909
|
void main() {
|
|
899
910
|
float lng = mix(u_geo_bounds.x, u_geo_bounds.z, a_grid_uv.x);
|
|
900
911
|
float lat = mix(u_geo_bounds.y, u_geo_bounds.w, a_grid_uv.y);
|
|
@@ -910,8 +921,20 @@ void main() {
|
|
|
910
921
|
v_geo_uv = a_grid_uv;
|
|
911
922
|
vec4 position = u_matrix * vec4(ecef, 1.0);
|
|
912
923
|
position.z = (1.0 - (dot(ecef, u_clipping_plane.xyz) + u_clipping_plane.w)) * position.w;
|
|
924
|
+
if (u_projection_transition < 0.999) {
|
|
925
|
+
|
|
926
|
+
float sinLat = sin(radians(clamp(lat, -85.0, 85.0)));
|
|
927
|
+
vec2 merc = vec2(
|
|
928
|
+
(lng + 180.0) / 360.0,
|
|
929
|
+
0.5 - log((1.0 + sinLat) / (1.0 - sinLat)) / (4.0 * PI)
|
|
930
|
+
);
|
|
931
|
+
vec4 flatPosition = u_fallback_matrix * vec4(merc, 0.0, 1.0);
|
|
932
|
+
float globeness = clamp((u_projection_transition - 0.2) / 0.8, 0.0, 1.0);
|
|
933
|
+
position.z = mix(0.0, position.z, globeness);
|
|
934
|
+
position.xyw = mix(flatPosition.xyw, position.xyw, u_projection_transition);
|
|
935
|
+
}
|
|
913
936
|
gl_Position = position;
|
|
914
|
-
}`,
|
|
937
|
+
}`, Ai = `precision mediump float;
|
|
915
938
|
|
|
916
939
|
uniform sampler2D u_field;
|
|
917
940
|
uniform sampler2D u_color_ramp;
|
|
@@ -1001,8 +1024,8 @@ void main() {
|
|
|
1001
1024
|
color.rgb = applyVibrance(color.rgb, u_vibrance);
|
|
1002
1025
|
gl_FragColor = vec4(color.rgb, color.a * u_opacity);
|
|
1003
1026
|
}`;
|
|
1004
|
-
const
|
|
1005
|
-
function
|
|
1027
|
+
const Me = [0, 0, 0, 0], B = 512, H = B * B, Y = 128, ee = 64, Ci = 1, ki = 0.92, Fi = 0.1, je = 0.98;
|
|
1028
|
+
function Ii(s) {
|
|
1006
1029
|
if (Number.isNaN(s))
|
|
1007
1030
|
return 32256;
|
|
1008
1031
|
if (s === 1 / 0)
|
|
@@ -1019,7 +1042,7 @@ function Ci(s) {
|
|
|
1019
1042
|
const i = Math.floor(Math.log2(t)), a = t / 2 ** i - 1;
|
|
1020
1043
|
return e | i + 15 << 10 | Math.round(a * 1024);
|
|
1021
1044
|
}
|
|
1022
|
-
const
|
|
1045
|
+
const Ui = {
|
|
1023
1046
|
particleDensity: 0.05,
|
|
1024
1047
|
speed: 1,
|
|
1025
1048
|
fadeOpacity: 0.996,
|
|
@@ -1028,26 +1051,26 @@ const ki = {
|
|
|
1028
1051
|
opacity: 1,
|
|
1029
1052
|
logScale: !1,
|
|
1030
1053
|
vibrance: 0,
|
|
1031
|
-
colorGrade:
|
|
1032
|
-
backdrop:
|
|
1054
|
+
colorGrade: hi,
|
|
1055
|
+
backdrop: ci,
|
|
1033
1056
|
glow: 0,
|
|
1034
1057
|
scalarMode: !1,
|
|
1035
1058
|
particleState: "auto",
|
|
1036
1059
|
rgba8MaxParticleZoom: 4
|
|
1037
1060
|
};
|
|
1038
|
-
class
|
|
1061
|
+
class Mt {
|
|
1039
1062
|
constructor(e) {
|
|
1040
|
-
this.numParticles = 0, this.prevBounds = null, this.redistributionBoost = 0, this.frame = Math.floor(Math.random() * 2 ** 30), this.webglInfo = null, this.lastRgba8ParticlesSuppressed = !1, this.screenWidth = 0, this.screenHeight = 0, this.glowTexture = null, this.glowFramebuffer = null, this.rasterGridIndexCount = 0, this.renderMode = "raster+particles", this.params = { ...
|
|
1063
|
+
this.numParticles = 0, this.prevBounds = null, this.redistributionBoost = 0, this.frame = Math.floor(Math.random() * 2 ** 30), this.webglInfo = null, this.lastRgba8ParticlesSuppressed = !1, this.screenWidth = 0, this.screenHeight = 0, this.glowTexture = null, this.glowFramebuffer = null, this.rasterGridIndexCount = 0, this.renderMode = "raster+particles", this.params = { ...Ui, ...e }, this.trailFade = new qt(this.params.fadeOpacity);
|
|
1041
1064
|
}
|
|
1042
1065
|
init(e) {
|
|
1043
|
-
this.gl = e, this.webglInfo =
|
|
1066
|
+
this.gl = e, this.webglInfo = Wt(e), this.stateFormat = this.params.particleState === "rgba8" ? Xt(e) : Ht(e);
|
|
1044
1067
|
const t = this.stateFormat.kind !== "rgba8-packed" ? `#define USE_FLOAT_STATE 1
|
|
1045
1068
|
` : "";
|
|
1046
1069
|
this.updateProgram = W(
|
|
1047
1070
|
e,
|
|
1048
1071
|
de,
|
|
1049
|
-
|
|
1050
|
-
), this.drawProgram = W(e, t +
|
|
1072
|
+
Ti.replace(/^(#version[^\n]*\n)/, `$1${t}`)
|
|
1073
|
+
), this.drawProgram = W(e, t + Mi, Ri), this.fadeProgram = W(e, de, Pi), this.compositeProgram = W(e, de, Ei), this.glowProgram = W(e, de, Li), this.gridProgram = W(e, wt, Di), this.gridGlobeProgram = W(e, Tt, Ai), this.updateLocs = this.getUniforms(this.updateProgram, [
|
|
1051
1074
|
"u_particles",
|
|
1052
1075
|
...ue,
|
|
1053
1076
|
"u_velocity",
|
|
@@ -1118,6 +1141,8 @@ class wt {
|
|
|
1118
1141
|
"u_matrix",
|
|
1119
1142
|
"u_geo_bounds",
|
|
1120
1143
|
"u_clipping_plane",
|
|
1144
|
+
"u_projection_transition",
|
|
1145
|
+
"u_fallback_matrix",
|
|
1121
1146
|
"u_field_min",
|
|
1122
1147
|
"u_field_max",
|
|
1123
1148
|
"u_u_min",
|
|
@@ -1129,7 +1154,7 @@ class wt {
|
|
|
1129
1154
|
"u_vibrance",
|
|
1130
1155
|
"u_scalar_mode",
|
|
1131
1156
|
"u_solid"
|
|
1132
|
-
]), this.quadBuffer =
|
|
1157
|
+
]), this.quadBuffer = Yt(e), this.initRasterGrid(), this.colorRampTexture = ge(e, this.params.colorRamp), this.initParticleState();
|
|
1133
1158
|
}
|
|
1134
1159
|
getUniforms(e, t) {
|
|
1135
1160
|
const i = {};
|
|
@@ -1149,7 +1174,7 @@ class wt {
|
|
|
1149
1174
|
if (this.stateFormat?.kind === "float16") {
|
|
1150
1175
|
const a = new Uint16Array(t);
|
|
1151
1176
|
for (let r = 0; r < t; r++)
|
|
1152
|
-
a[r] =
|
|
1177
|
+
a[r] = Ii(Math.random());
|
|
1153
1178
|
return a;
|
|
1154
1179
|
}
|
|
1155
1180
|
const i = new Uint8Array(t);
|
|
@@ -1158,7 +1183,7 @@ class wt {
|
|
|
1158
1183
|
return i;
|
|
1159
1184
|
}
|
|
1160
1185
|
createStateTexture(e) {
|
|
1161
|
-
return
|
|
1186
|
+
return Zt(
|
|
1162
1187
|
this.gl,
|
|
1163
1188
|
this.gl.NEAREST,
|
|
1164
1189
|
e,
|
|
@@ -1172,8 +1197,8 @@ class wt {
|
|
|
1172
1197
|
const e = this.gl, t = this.makeStateData(), i = this.createStateTexture(t), a = this.createStateTexture(t), r = J(e, i), n = J(e, a);
|
|
1173
1198
|
this.particleStateTextures = [i, a], this.particleFramebuffers = [r, n];
|
|
1174
1199
|
const o = new Float32Array(H * 2), c = new Float32Array(H * 2);
|
|
1175
|
-
for (let
|
|
1176
|
-
o[
|
|
1200
|
+
for (let d = 0; d < H; d++)
|
|
1201
|
+
o[d * 2] = d, o[d * 2 + 1] = d, c[d * 2] = 0, c[d * 2 + 1] = 1;
|
|
1177
1202
|
this.particleIndexBuffer = e.createBuffer(), e.bindBuffer(e.ARRAY_BUFFER, this.particleIndexBuffer), e.bufferData(e.ARRAY_BUFFER, o, e.STATIC_DRAW), this.particleIsCurrBuffer = e.createBuffer(), e.bindBuffer(e.ARRAY_BUFFER, this.particleIsCurrBuffer), e.bufferData(e.ARRAY_BUFFER, c, e.STATIC_DRAW);
|
|
1178
1203
|
}
|
|
1179
1204
|
initRasterGrid() {
|
|
@@ -1191,8 +1216,8 @@ class wt {
|
|
|
1191
1216
|
const n = Y + 1;
|
|
1192
1217
|
for (let o = 0; o < ee; o++)
|
|
1193
1218
|
for (let c = 0; c < Y; c++) {
|
|
1194
|
-
const
|
|
1195
|
-
a[r++] =
|
|
1219
|
+
const d = o * n + c, l = d + 1, u = d + n, f = u + 1;
|
|
1220
|
+
a[r++] = d, a[r++] = u, a[r++] = l, a[r++] = l, a[r++] = u, a[r++] = f;
|
|
1196
1221
|
}
|
|
1197
1222
|
this.rasterGridBuffer = e.createBuffer(), e.bindBuffer(e.ARRAY_BUFFER, this.rasterGridBuffer), e.bufferData(e.ARRAY_BUFFER, t, e.STATIC_DRAW), this.rasterGridIndexBuffer = e.createBuffer(), e.bindBuffer(e.ELEMENT_ARRAY_BUFFER, this.rasterGridIndexBuffer), e.bufferData(e.ELEMENT_ARRAY_BUFFER, a, e.STATIC_DRAW), this.rasterGridIndexCount = a.length;
|
|
1198
1223
|
}
|
|
@@ -1211,14 +1236,14 @@ class wt {
|
|
|
1211
1236
|
return;
|
|
1212
1237
|
const i = this.gl;
|
|
1213
1238
|
this.screenWidth = e, this.screenHeight = t, this.screenTextures && (i.deleteTexture(this.screenTextures[0]), i.deleteTexture(this.screenTextures[1]), i.deleteFramebuffer(this.screenFramebuffers[0]), i.deleteFramebuffer(this.screenFramebuffers[1])), this.deleteGlowTarget();
|
|
1214
|
-
const a = new Uint8Array(e * t * 4), r =
|
|
1239
|
+
const a = new Uint8Array(e * t * 4), r = Se(i, i.NEAREST, a, e, t), n = Se(i, i.NEAREST, a, e, t), o = J(i, r), c = J(i, n);
|
|
1215
1240
|
this.screenTextures = [r, n], this.screenFramebuffers = [o, c];
|
|
1216
1241
|
}
|
|
1217
1242
|
/**
|
|
1218
1243
|
* Run one simulation step: update positions, fade trails, draw particles.
|
|
1219
1244
|
* Must be called within the MapLibre render callback.
|
|
1220
1245
|
*/
|
|
1221
|
-
render(e, t, i, a, r, n, o, c,
|
|
1246
|
+
render(e, t, i, a, r, n, o, c, d = !1, l = [0, 0, 1], u, f) {
|
|
1222
1247
|
const m = { unit: e, min: t, max: i }, p = f ?? { a: m, b: m, mix: 0 }, h = this.gl;
|
|
1223
1248
|
if (this.screenWidth === 0 || this.screenHeight === 0)
|
|
1224
1249
|
return;
|
|
@@ -1229,13 +1254,13 @@ class wt {
|
|
|
1229
1254
|
const T = !x && (this.renderMode === "particles" || this.renderMode === "raster+particles"), M = x || this.renderMode === "raster" || this.renderMode === "raster+particles";
|
|
1230
1255
|
let y = !1;
|
|
1231
1256
|
if (T) {
|
|
1232
|
-
h.disable(h.BLEND), h.useProgram(this.updateProgram), h.viewport(0, 0, B, B), O(h, this.particleStateTextures[0], 0), h.uniform1i(this.updateLocs.u_particles, 0),
|
|
1257
|
+
h.disable(h.BLEND), h.useProgram(this.updateProgram), h.viewport(0, 0, B, B), O(h, this.particleStateTextures[0], 0), h.uniform1i(this.updateLocs.u_particles, 0), Te(h, this.updateLocs, p), h.uniform1i(this.updateLocs.u_velocity, p.a.unit), h.uniform2f(this.updateLocs.u_velocity_min, ...p.a.min), h.uniform2f(this.updateLocs.u_velocity_max, ...p.a.max), h.uniform1f(this.updateLocs.u_speed, this.params.speed), h.uniform1f(this.updateLocs.u_world_size, n), h.uniform1ui(this.updateLocs.u_frame, this.frame), this.frame = this.frame + 1 >>> 0;
|
|
1233
1258
|
const E = r.maxX - r.minX;
|
|
1234
1259
|
if (this.prevBounds) {
|
|
1235
1260
|
const F = this.prevBounds.maxX - this.prevBounds.minX, P = this.prevBounds.maxY - this.prevBounds.minY, L = 1e-6, b = (r.minX + r.maxX) * 0.5, A = (r.minY + r.maxY) * 0.5, N = (this.prevBounds.minX + this.prevBounds.maxX) * 0.5, C = (this.prevBounds.minY + this.prevBounds.maxY) * 0.5, I = Math.abs(E - F) / Math.max(F, L), w = Math.abs(b - N) / Math.max(F, L) + Math.abs(A - C) / Math.max(P, L), U = Math.min(1, I + w);
|
|
1236
1261
|
this.redistributionBoost = Math.max(
|
|
1237
|
-
this.redistributionBoost *
|
|
1238
|
-
U *
|
|
1262
|
+
this.redistributionBoost * ki,
|
|
1263
|
+
U * Ci
|
|
1239
1264
|
);
|
|
1240
1265
|
}
|
|
1241
1266
|
this.prevBounds = {
|
|
@@ -1246,7 +1271,7 @@ class wt {
|
|
|
1246
1271
|
};
|
|
1247
1272
|
const k = Math.min(
|
|
1248
1273
|
this.params.dropRate + this.redistributionBoost,
|
|
1249
|
-
|
|
1274
|
+
Fi
|
|
1250
1275
|
);
|
|
1251
1276
|
h.uniform1f(this.updateLocs.u_drop_rate, k), h.uniform1f(
|
|
1252
1277
|
this.updateLocs.u_drop_rate_bump,
|
|
@@ -1257,7 +1282,7 @@ class wt {
|
|
|
1257
1282
|
r.minY,
|
|
1258
1283
|
r.maxX,
|
|
1259
1284
|
r.maxY
|
|
1260
|
-
), h.uniform1f(this.updateLocs.u_is_globe,
|
|
1285
|
+
), h.uniform1f(this.updateLocs.u_is_globe, d ? 1 : 0), c && h.uniform4f(
|
|
1261
1286
|
this.updateLocs.u_geo_bounds,
|
|
1262
1287
|
c.west,
|
|
1263
1288
|
c.south,
|
|
@@ -1265,7 +1290,7 @@ class wt {
|
|
|
1265
1290
|
c.north
|
|
1266
1291
|
), h.uniform1f(
|
|
1267
1292
|
this.updateLocs.u_valid_threshold,
|
|
1268
|
-
|
|
1293
|
+
je
|
|
1269
1294
|
), h.bindFramebuffer(h.FRAMEBUFFER, this.particleFramebuffers[1]), this.drawQuad(), y = !0;
|
|
1270
1295
|
}
|
|
1271
1296
|
h.viewport(0, 0, this.screenWidth, this.screenHeight), h.bindFramebuffer(h.FRAMEBUFFER, this.screenFramebuffers[1]), h.useProgram(this.fadeProgram), h.disable(h.BLEND), O(h, this.screenTextures[0], 0), h.uniform1i(this.fadeLocs.u_screen, 0), h.uniform1f(
|
|
@@ -1273,17 +1298,17 @@ class wt {
|
|
|
1273
1298
|
this.updateTrailFadeOpacity(performance.now())
|
|
1274
1299
|
), this.drawQuad();
|
|
1275
1300
|
const v = (E) => {
|
|
1276
|
-
c && (
|
|
1301
|
+
c && (d && u ? this.renderGridGlobe(
|
|
1277
1302
|
e,
|
|
1278
1303
|
t,
|
|
1279
1304
|
i,
|
|
1280
1305
|
a,
|
|
1281
1306
|
c,
|
|
1282
|
-
|
|
1307
|
+
u,
|
|
1283
1308
|
1,
|
|
1284
1309
|
E,
|
|
1285
1310
|
p
|
|
1286
|
-
) :
|
|
1311
|
+
) : d || this.renderGrid(
|
|
1287
1312
|
e,
|
|
1288
1313
|
t,
|
|
1289
1314
|
i,
|
|
@@ -1296,13 +1321,13 @@ class wt {
|
|
|
1296
1321
|
p
|
|
1297
1322
|
));
|
|
1298
1323
|
};
|
|
1299
|
-
if (M && v(
|
|
1324
|
+
if (M && v(Me), T) {
|
|
1300
1325
|
h.useProgram(this.drawProgram), h.enable(h.BLEND), h.blendFuncSeparate(
|
|
1301
1326
|
h.SRC_ALPHA,
|
|
1302
1327
|
h.ONE_MINUS_SRC_ALPHA,
|
|
1303
1328
|
h.ONE,
|
|
1304
1329
|
h.ONE_MINUS_SRC_ALPHA
|
|
1305
|
-
), O(h, this.particleStateTextures[1], 0), h.uniform1i(this.drawLocs.u_particles, 0), O(h, this.particleStateTextures[0], 3), h.uniform1i(this.drawLocs.u_prev_particles, 3),
|
|
1330
|
+
), O(h, this.particleStateTextures[1], 0), h.uniform1i(this.drawLocs.u_particles, 0), O(h, this.particleStateTextures[0], 3), h.uniform1i(this.drawLocs.u_prev_particles, 3), Te(h, this.drawLocs, p), h.uniform1i(this.drawLocs.u_velocity, p.a.unit), h.uniform2f(this.drawLocs.u_velocity_min, ...p.a.min), h.uniform2f(this.drawLocs.u_velocity_max, ...p.a.max), c && h.uniform4f(
|
|
1306
1331
|
this.drawLocs.u_geo_bounds,
|
|
1307
1332
|
c.west,
|
|
1308
1333
|
c.south,
|
|
@@ -1316,8 +1341,8 @@ class wt {
|
|
|
1316
1341
|
this.params.logScale ? 1 : 0
|
|
1317
1342
|
), h.uniform1f(this.drawLocs.u_vibrance, this.params.vibrance), h.uniform1f(
|
|
1318
1343
|
this.drawLocs.u_valid_threshold,
|
|
1319
|
-
|
|
1320
|
-
), h.uniform1f(this.drawLocs.u_is_globe,
|
|
1344
|
+
je
|
|
1345
|
+
), h.uniform1f(this.drawLocs.u_is_globe, d ? 1 : 0), h.uniform3f(
|
|
1321
1346
|
this.drawLocs.u_globe_center,
|
|
1322
1347
|
l[0],
|
|
1323
1348
|
l[1],
|
|
@@ -1336,95 +1361,95 @@ class wt {
|
|
|
1336
1361
|
h.disableVertexAttribArray(E), h.disableVertexAttribArray(k), h.disable(h.BLEND);
|
|
1337
1362
|
}
|
|
1338
1363
|
h.bindFramebuffer(h.FRAMEBUFFER, g), h.viewport(0, 0, this.screenWidth, this.screenHeight);
|
|
1339
|
-
const _ =
|
|
1364
|
+
const _ = ui(this.params.backdrop);
|
|
1340
1365
|
_[3] > 0 && v(_);
|
|
1341
1366
|
const S = this.params.glow > 0 ? this.renderGlow(g) : null, R = this.params.colorGrade;
|
|
1342
1367
|
h.useProgram(this.compositeProgram), O(h, this.screenTextures[1], 0), h.uniform1i(this.compositeLocs.u_screen, 0), O(h, S ?? this.screenTextures[1], 1), h.uniform1i(this.compositeLocs.u_glow_tex, 1), h.uniform1f(
|
|
1343
1368
|
this.compositeLocs.u_glow,
|
|
1344
|
-
S ?
|
|
1345
|
-
), h.uniform1f(this.compositeLocs.u_grade_on, R.enabled ? 1 : 0), h.uniform4f(this.compositeLocs.u_grade, ...
|
|
1369
|
+
S ? jt * this.params.glow : 0
|
|
1370
|
+
), h.uniform1f(this.compositeLocs.u_grade_on, R.enabled ? 1 : 0), h.uniform4f(this.compositeLocs.u_grade, ...di(R)), h.enable(h.BLEND), h.blendFunc(h.SRC_ALPHA, h.ONE_MINUS_SRC_ALPHA), this.drawQuad(), h.disable(h.BLEND), y && (this.particleStateTextures.reverse(), this.particleFramebuffers.reverse()), this.screenTextures.reverse(), this.screenFramebuffers.reverse();
|
|
1346
1371
|
}
|
|
1347
1372
|
/**
|
|
1348
1373
|
* Reduce the latest trails into the glow texture (glow.glsl), then rebind
|
|
1349
1374
|
* `framebuffer` with the full viewport.
|
|
1350
1375
|
*/
|
|
1351
1376
|
renderGlow(e) {
|
|
1352
|
-
const t = this.gl, i = Math.ceil(this.screenWidth /
|
|
1353
|
-
return this.glowTexture || (this.glowTexture =
|
|
1377
|
+
const t = this.gl, i = Math.ceil(this.screenWidth / We), a = Math.ceil(this.screenHeight / We);
|
|
1378
|
+
return this.glowTexture || (this.glowTexture = Se(t, t.LINEAR, null, i, a), this.glowFramebuffer = J(t, this.glowTexture)), t.bindFramebuffer(t.FRAMEBUFFER, this.glowFramebuffer), t.viewport(0, 0, i, a), t.disable(t.BLEND), t.useProgram(this.glowProgram), O(t, this.screenTextures[1], 0), t.uniform1i(this.glowLocs.u_screen, 0), this.drawQuad(), t.bindFramebuffer(t.FRAMEBUFFER, e), t.viewport(0, 0, this.screenWidth, this.screenHeight), this.glowTexture;
|
|
1354
1379
|
}
|
|
1355
1380
|
deleteGlowTarget() {
|
|
1356
1381
|
this.glowTexture && (this.gl.deleteTexture(this.glowTexture), this.gl.deleteFramebuffer(this.glowFramebuffer), this.glowTexture = null, this.glowFramebuffer = null);
|
|
1357
1382
|
}
|
|
1358
|
-
renderGrid(e, t, i, a, r, n, o, c = 1,
|
|
1359
|
-
const
|
|
1360
|
-
|
|
1383
|
+
renderGrid(e, t, i, a, r, n, o, c = 1, d = Me, l) {
|
|
1384
|
+
const u = this.gl;
|
|
1385
|
+
u.useProgram(this.gridProgram), u.disable(u.DEPTH_TEST), u.disable(u.STENCIL_TEST), u.disable(u.BLEND), this.setGridFieldUniforms(
|
|
1361
1386
|
this.gridLocs,
|
|
1362
1387
|
e,
|
|
1363
1388
|
t,
|
|
1364
1389
|
i,
|
|
1365
1390
|
c,
|
|
1366
|
-
|
|
1391
|
+
d,
|
|
1367
1392
|
l
|
|
1368
|
-
),
|
|
1393
|
+
), u.uniformMatrix4fv(
|
|
1369
1394
|
this.gridLocs.u_matrix,
|
|
1370
1395
|
!1,
|
|
1371
1396
|
a instanceof Float32Array ? a : new Float32Array(Array.from(a))
|
|
1372
|
-
),
|
|
1397
|
+
), u.uniform4f(
|
|
1373
1398
|
this.gridLocs.u_geo_bounds,
|
|
1374
1399
|
o.west,
|
|
1375
1400
|
o.south,
|
|
1376
1401
|
o.east,
|
|
1377
1402
|
o.north
|
|
1378
|
-
),
|
|
1403
|
+
), u.uniform1f(this.gridLocs.u_world_size, r), u.enable(u.BLEND), u.blendFunc(u.SRC_ALPHA, u.ONE_MINUS_SRC_ALPHA), this.bindRasterGrid(this.gridProgram);
|
|
1379
1404
|
for (const f of n)
|
|
1380
|
-
|
|
1381
|
-
|
|
1405
|
+
u.uniform1f(this.gridLocs.u_world_offset, f), u.drawElements(
|
|
1406
|
+
u.TRIANGLES,
|
|
1382
1407
|
this.rasterGridIndexCount,
|
|
1383
|
-
|
|
1408
|
+
u.UNSIGNED_SHORT,
|
|
1384
1409
|
0
|
|
1385
1410
|
);
|
|
1386
|
-
this.unbindRasterGrid(this.gridProgram),
|
|
1411
|
+
this.unbindRasterGrid(this.gridProgram), u.disable(u.BLEND);
|
|
1387
1412
|
}
|
|
1388
|
-
renderGridGlobe(e, t, i, a, r, n, o = 1, c =
|
|
1389
|
-
const
|
|
1390
|
-
|
|
1413
|
+
renderGridGlobe(e, t, i, a, r, n, o = 1, c = Me, d, l = Qt) {
|
|
1414
|
+
const u = this.gl;
|
|
1415
|
+
u.useProgram(this.gridGlobeProgram), vt(u, this.gridGlobeLocs, l), u.disable(u.DEPTH_TEST), u.disable(u.STENCIL_TEST), u.disable(u.BLEND), this.setGridFieldUniforms(
|
|
1391
1416
|
this.gridGlobeLocs,
|
|
1392
1417
|
e,
|
|
1393
1418
|
t,
|
|
1394
1419
|
i,
|
|
1395
1420
|
o,
|
|
1396
1421
|
c,
|
|
1397
|
-
|
|
1398
|
-
),
|
|
1422
|
+
d
|
|
1423
|
+
), u.uniformMatrix4fv(
|
|
1399
1424
|
this.gridGlobeLocs.u_matrix,
|
|
1400
1425
|
!1,
|
|
1401
1426
|
a instanceof Float32Array ? a : new Float32Array(Array.from(a))
|
|
1402
|
-
),
|
|
1427
|
+
), u.uniform4f(
|
|
1403
1428
|
this.gridGlobeLocs.u_geo_bounds,
|
|
1404
1429
|
r.west,
|
|
1405
1430
|
r.south,
|
|
1406
1431
|
r.east,
|
|
1407
1432
|
r.north
|
|
1408
|
-
),
|
|
1433
|
+
), u.uniform4f(
|
|
1409
1434
|
this.gridGlobeLocs.u_clipping_plane,
|
|
1410
1435
|
n[0],
|
|
1411
1436
|
n[1],
|
|
1412
1437
|
n[2],
|
|
1413
1438
|
n[3]
|
|
1414
|
-
),
|
|
1415
|
-
|
|
1439
|
+
), u.enable(u.BLEND), u.blendFunc(u.SRC_ALPHA, u.ONE_MINUS_SRC_ALPHA), this.bindRasterGrid(this.gridGlobeProgram), u.drawElements(
|
|
1440
|
+
u.TRIANGLES,
|
|
1416
1441
|
this.rasterGridIndexCount,
|
|
1417
|
-
|
|
1442
|
+
u.UNSIGNED_SHORT,
|
|
1418
1443
|
0
|
|
1419
|
-
), this.unbindRasterGrid(this.gridGlobeProgram),
|
|
1444
|
+
), this.unbindRasterGrid(this.gridGlobeProgram), u.disable(u.BLEND);
|
|
1420
1445
|
}
|
|
1421
1446
|
setGridFieldUniforms(e, t, i, a, r, n, o) {
|
|
1422
|
-
const c = this.gl,
|
|
1423
|
-
|
|
1424
|
-
const
|
|
1447
|
+
const c = this.gl, d = { unit: t, min: i, max: a }, l = o ?? { a: d, b: d, mix: 0 };
|
|
1448
|
+
Te(c, e, l), c.uniform1i(e.u_field, l.a.unit), c.uniform4f(e.u_solid, ...n), O(c, this.colorRampTexture, 2), c.uniform1i(e.u_color_ramp, 2);
|
|
1449
|
+
const u = Math.sqrt(
|
|
1425
1450
|
Math.max(Math.abs(i[0]), Math.abs(a[0])) ** 2 + Math.max(Math.abs(i[1]), Math.abs(a[1])) ** 2
|
|
1426
1451
|
);
|
|
1427
|
-
c.uniform1f(e.u_field_min, 0), c.uniform1f(e.u_field_max,
|
|
1452
|
+
c.uniform1f(e.u_field_min, 0), c.uniform1f(e.u_field_max, u > 0 ? u : 1), c.uniform1f(e.u_u_min, l.a.min[0]), c.uniform1f(e.u_u_max, l.a.max[0]), c.uniform1f(e.u_v_min, l.a.min[1]), c.uniform1f(e.u_v_max, l.a.max[1]), c.uniform1f(e.u_opacity, this.params.opacity * r), c.uniform1f(e.u_log_scale, this.params.logScale ? 1 : 0), c.uniform1f(e.u_vibrance, this.params.vibrance), c.uniform1f(e.u_scalar_mode, this.params.scalarMode ? 1 : 0);
|
|
1428
1453
|
}
|
|
1429
1454
|
bindRasterGrid(e) {
|
|
1430
1455
|
const t = this.gl, i = t.getAttribLocation(e, "a_grid_uv");
|
|
@@ -1490,11 +1515,11 @@ class wt {
|
|
|
1490
1515
|
}
|
|
1491
1516
|
/** Partial values take the vibrant preset; see resolveColorGrade. */
|
|
1492
1517
|
setColorGrade(e) {
|
|
1493
|
-
this.params.colorGrade =
|
|
1518
|
+
this.params.colorGrade = bt(e);
|
|
1494
1519
|
}
|
|
1495
1520
|
/** Missing values take the defaults; see resolveBackdrop. */
|
|
1496
1521
|
setBackdrop(e) {
|
|
1497
|
-
this.params.backdrop =
|
|
1522
|
+
this.params.backdrop = St(e);
|
|
1498
1523
|
}
|
|
1499
1524
|
/** Halo strength, clamped to [0, 1]; 0 frees the glow texture. */
|
|
1500
1525
|
setGlow(e) {
|
|
@@ -1579,7 +1604,7 @@ class wt {
|
|
|
1579
1604
|
e.deleteBuffer(this.quadBuffer), e.deleteBuffer(this.particleIndexBuffer), e.deleteBuffer(this.particleIsCurrBuffer), e.deleteTexture(this.colorRampTexture);
|
|
1580
1605
|
}
|
|
1581
1606
|
}
|
|
1582
|
-
class
|
|
1607
|
+
class Rt {
|
|
1583
1608
|
constructor() {
|
|
1584
1609
|
this.gl = null, this.texture = null, this.width = 0, this.height = 0, this.uMin = 0, this.uMax = 0, this.vMin = 0, this.vMax = 0, this.geoBounds = { west: -180, south: -90, east: 180, north: 90 }, this.scalarMode = !1, this.linearFilter = !0;
|
|
1585
1610
|
}
|
|
@@ -1593,9 +1618,9 @@ class Tt {
|
|
|
1593
1618
|
* fields may use a fixed color domain so fragments never decode physical values.
|
|
1594
1619
|
*/
|
|
1595
1620
|
update(e, t = null) {
|
|
1596
|
-
const i = this.gl, { u: a, v: r, width: n, height: o, uMin: c, uMax:
|
|
1597
|
-
this.scalarMode = e.scalarMode ?? !1, this.width = n, this.height = o, this.uMin = c, this.uMax =
|
|
1598
|
-
const f = this.scalarMode && t ? t[0] : c, p = (this.scalarMode && t ? t[1] :
|
|
1621
|
+
const i = this.gl, { u: a, v: r, width: n, height: o, uMin: c, uMax: d, vMin: l, vMax: u } = e;
|
|
1622
|
+
this.scalarMode = e.scalarMode ?? !1, this.width = n, this.height = o, this.uMin = c, this.uMax = d, this.vMin = l, this.vMax = u, this.geoBounds = e.bounds;
|
|
1623
|
+
const f = this.scalarMode && t ? t[0] : c, p = (this.scalarMode && t ? t[1] : d) - f || 1, h = u - l || 1, g = new Uint8Array(n * o * 4);
|
|
1599
1624
|
for (let y = 0; y < n * o; y++) {
|
|
1600
1625
|
const v = a[y], _ = r[y];
|
|
1601
1626
|
this.scalarMode ? isNaN(v) ? (g[y * 4] = 0, g[y * 4 + 1] = 0, g[y * 4 + 2] = 0, g[y * 4 + 3] = 0) : (g[y * 4] = Math.round(
|
|
@@ -1617,7 +1642,7 @@ class Tt {
|
|
|
1617
1642
|
console.log(
|
|
1618
1643
|
`[zartigl] Velocity texture: ${n}x${o}, valid=${x} (${(100 * x / (n * o)).toFixed(
|
|
1619
1644
|
1
|
|
1620
|
-
)}%), nodata=${T}, uRange=[${c.toFixed(4)}, ${
|
|
1645
|
+
)}%), nodata=${T}, uRange=[${c.toFixed(4)}, ${d.toFixed(4)}], vRange=[${l.toFixed(4)}, ${u.toFixed(4)}]`
|
|
1621
1646
|
), this.texture || (this.texture = i.createTexture());
|
|
1622
1647
|
const M = this.linearFilter ? i.LINEAR : i.NEAREST;
|
|
1623
1648
|
i.bindTexture(i.TEXTURE_2D, this.texture), i.texParameteri(i.TEXTURE_2D, i.TEXTURE_WRAP_S, i.CLAMP_TO_EDGE), i.texParameteri(i.TEXTURE_2D, i.TEXTURE_WRAP_T, i.CLAMP_TO_EDGE), i.texParameteri(i.TEXTURE_2D, i.TEXTURE_MIN_FILTER, M), i.texParameteri(i.TEXTURE_2D, i.TEXTURE_MAG_FILTER, M), i.pixelStorei(i.UNPACK_ALIGNMENT, 1), i.texImage2D(
|
|
@@ -1657,7 +1682,7 @@ class Tt {
|
|
|
1657
1682
|
this.gl && this.texture && (this.gl.deleteTexture(this.texture), this.texture = null);
|
|
1658
1683
|
}
|
|
1659
1684
|
}
|
|
1660
|
-
function
|
|
1685
|
+
function Pt(s, e, t, i, a, r, n) {
|
|
1661
1686
|
const o = new Float32Array(t * i).fill(NaN), c = new Float32Array(t * i).fill(NaN);
|
|
1662
1687
|
for (const m of s)
|
|
1663
1688
|
for (let p = 0; p < m.latSize; p++)
|
|
@@ -1671,36 +1696,36 @@ function Mt(s, e, t, i, a, r, n) {
|
|
|
1671
1696
|
const g = p * m.lonChunkSize + h, x = (m.latStart + p) * i + (m.lonStart + h);
|
|
1672
1697
|
c[x] = m.data[g];
|
|
1673
1698
|
}
|
|
1674
|
-
let
|
|
1699
|
+
let d = 1 / 0, l = -1 / 0, u = 1 / 0, f = -1 / 0;
|
|
1675
1700
|
for (let m = 0; m < o.length; m++)
|
|
1676
|
-
isNaN(o[m]) || (o[m] <
|
|
1677
|
-
return isFinite(
|
|
1701
|
+
isNaN(o[m]) || (o[m] < d && (d = o[m]), o[m] > l && (l = o[m])), isNaN(c[m]) || (c[m] < u && (u = c[m]), c[m] > f && (f = c[m]));
|
|
1702
|
+
return isFinite(d) || (d = -1), isFinite(l) || (l = 1), isFinite(u) || (u = -1), isFinite(f) || (f = 1), {
|
|
1678
1703
|
u: o,
|
|
1679
1704
|
v: c,
|
|
1680
1705
|
width: i,
|
|
1681
1706
|
height: t,
|
|
1682
|
-
uMin:
|
|
1707
|
+
uMin: d,
|
|
1683
1708
|
uMax: l,
|
|
1684
|
-
vMin:
|
|
1709
|
+
vMin: u,
|
|
1685
1710
|
vMax: f,
|
|
1686
1711
|
bounds: a ?? { west: -180, south: -90, east: 180, north: 90 },
|
|
1687
1712
|
latDescending: r,
|
|
1688
1713
|
scalarMode: n
|
|
1689
1714
|
};
|
|
1690
1715
|
}
|
|
1691
|
-
const
|
|
1716
|
+
const Re = [
|
|
1692
1717
|
"depth",
|
|
1693
1718
|
"elevation",
|
|
1694
1719
|
"level",
|
|
1695
1720
|
"altitude",
|
|
1696
1721
|
"pressure_level"
|
|
1697
1722
|
];
|
|
1698
|
-
class
|
|
1723
|
+
class Qe extends Error {
|
|
1699
1724
|
constructor(e, t) {
|
|
1700
1725
|
super(`Chunk fetch failed: ${e} ${t}`), this.name = "ZarrChunkFetchError", this.status = e, this.url = t;
|
|
1701
1726
|
}
|
|
1702
1727
|
}
|
|
1703
|
-
class
|
|
1728
|
+
class _e {
|
|
1704
1729
|
constructor(e, t = 200) {
|
|
1705
1730
|
this.meta = null, this.coords = null, this.initPromise = null, this.verticalName = "depth", this.timeUnits = "", this.timeCalendar = "standard", this.cache = /* @__PURE__ */ new Map(), this.abortControllers = /* @__PURE__ */ new Map(), this.bloscCodecCache = /* @__PURE__ */ new Map(), this.root = e.replace(/\/$/, ""), this.maxCacheSize = t;
|
|
1706
1731
|
}
|
|
@@ -1752,7 +1777,7 @@ class ye {
|
|
|
1752
1777
|
let a = t ? i[0] : NaN, r = a;
|
|
1753
1778
|
for (let o = 1; o < i.length; o++)
|
|
1754
1779
|
a = Math.min(a, i[o]), r = Math.max(r, i[o]);
|
|
1755
|
-
const n =
|
|
1780
|
+
const n = Oi(i);
|
|
1756
1781
|
return {
|
|
1757
1782
|
min: a,
|
|
1758
1783
|
max: r,
|
|
@@ -1824,7 +1849,7 @@ class ye {
|
|
|
1824
1849
|
throw new Error(
|
|
1825
1850
|
`Unsupported Zarr time units: ${this.timeUnits || "<missing>"}`
|
|
1826
1851
|
);
|
|
1827
|
-
const i =
|
|
1852
|
+
const i = zi(t[2]);
|
|
1828
1853
|
if (!Number.isFinite(i))
|
|
1829
1854
|
throw new Error(`Invalid Zarr time epoch: ${t[2]}`);
|
|
1830
1855
|
const a = t[1].toLowerCase(), r = a.startsWith("ms") || a.startsWith("milli") ? 1 : a.startsWith("s") ? 1e3 : a.startsWith("min") ? 6e4 : a.startsWith("h") ? 36e5 : 864e5;
|
|
@@ -1838,20 +1863,20 @@ class ye {
|
|
|
1838
1863
|
async sampleVariableAt(e, t) {
|
|
1839
1864
|
const i = this.getDimensions(e), a = this.getChunkShape(e), r = this.getShape(e), n = new Array(i.length).fill(0), o = new Array(i.length).fill(0);
|
|
1840
1865
|
for (let l = 0; l < i.length; l++) {
|
|
1841
|
-
const
|
|
1866
|
+
const u = i[l];
|
|
1842
1867
|
let f = 0;
|
|
1843
|
-
|
|
1868
|
+
u === "time" ? f = t.timeIdx : u === "latitude" ? f = t.latIdx : u === "longitude" ? f = t.lonIdx : (u === this.verticalName || Re.includes(u)) && (f = t.depthIdx), f = Math.max(0, Math.min(r[l] - 1, f)), n[l] = Math.floor(f / a[l]), o[l] = f - n[l] * a[l];
|
|
1844
1869
|
}
|
|
1845
1870
|
let c;
|
|
1846
1871
|
try {
|
|
1847
1872
|
c = await this.fetchChunk(e, n);
|
|
1848
1873
|
} catch (l) {
|
|
1849
|
-
if (l instanceof
|
|
1874
|
+
if (l instanceof Qe && (l.status === 403 || l.status === 404))
|
|
1850
1875
|
return NaN;
|
|
1851
1876
|
throw l;
|
|
1852
1877
|
}
|
|
1853
|
-
const
|
|
1854
|
-
return
|
|
1878
|
+
const d = this.getFlatOffset(e, o);
|
|
1879
|
+
return d < c.length ? c[d] : NaN;
|
|
1855
1880
|
}
|
|
1856
1881
|
getFlatOffset(e, t) {
|
|
1857
1882
|
const i = this.getArrayMeta(e), a = i.chunks;
|
|
@@ -1874,12 +1899,12 @@ class ye {
|
|
|
1874
1899
|
const t = this.getCoords(), i = this.findNearestLongitudeIndex(e.longitude), a = this.findNearestIndex(t.latitude, e.latitude), r = this.findDepthIndex(e.depth ?? 0), n = Math.max(0, e.timeStartIndex ?? 0), o = Math.min(
|
|
1875
1900
|
t.time.length - 1,
|
|
1876
1901
|
e.timeEndIndex ?? t.time.length - 1
|
|
1877
|
-
), c = Math.max(1, Math.floor(e.stride ?? 1)),
|
|
1902
|
+
), c = Math.max(1, Math.floor(e.stride ?? 1)), d = Math.max(
|
|
1878
1903
|
0,
|
|
1879
1904
|
Math.floor(e.stopAfterMissingSamples ?? 0)
|
|
1880
1905
|
);
|
|
1881
1906
|
let l = 0;
|
|
1882
|
-
const
|
|
1907
|
+
const u = [];
|
|
1883
1908
|
for (let f = n; f <= o; f += c) {
|
|
1884
1909
|
const m = {};
|
|
1885
1910
|
for (const g of e.variables)
|
|
@@ -1890,21 +1915,21 @@ class ye {
|
|
|
1890
1915
|
lonIdx: i
|
|
1891
1916
|
});
|
|
1892
1917
|
const p = this.zarrTimeToMs(t.time[f]);
|
|
1893
|
-
if (
|
|
1918
|
+
if (u.push({
|
|
1894
1919
|
axisValue: p,
|
|
1895
1920
|
time: p,
|
|
1896
1921
|
depth: t.vertical[r],
|
|
1897
1922
|
values: m
|
|
1898
1923
|
}), l = e.variables.every(
|
|
1899
1924
|
(g) => !Number.isFinite(m[g])
|
|
1900
|
-
) ? l + 1 : 0,
|
|
1925
|
+
) ? l + 1 : 0, d > 0 && l >= d)
|
|
1901
1926
|
break;
|
|
1902
1927
|
}
|
|
1903
1928
|
return {
|
|
1904
1929
|
longitude: t.longitude[i],
|
|
1905
1930
|
latitude: t.latitude[a],
|
|
1906
1931
|
depth: t.vertical[r],
|
|
1907
|
-
points:
|
|
1932
|
+
points: u
|
|
1908
1933
|
};
|
|
1909
1934
|
}
|
|
1910
1935
|
async sampleVerticalProfile(e) {
|
|
@@ -1915,7 +1940,7 @@ class ye {
|
|
|
1915
1940
|
);
|
|
1916
1941
|
let o = 0;
|
|
1917
1942
|
const c = [];
|
|
1918
|
-
let
|
|
1943
|
+
let d = Array.from(
|
|
1919
1944
|
{ length: t.vertical.length },
|
|
1920
1945
|
(f, m) => m
|
|
1921
1946
|
).sort(
|
|
@@ -1923,13 +1948,13 @@ class ye {
|
|
|
1923
1948
|
);
|
|
1924
1949
|
const l = Math.max(
|
|
1925
1950
|
1,
|
|
1926
|
-
Math.floor(e.maxDepths ??
|
|
1927
|
-
),
|
|
1951
|
+
Math.floor(e.maxDepths ?? d.length)
|
|
1952
|
+
), u = Math.max(
|
|
1928
1953
|
1,
|
|
1929
|
-
Math.floor(e.stride ?? Math.ceil(
|
|
1954
|
+
Math.floor(e.stride ?? Math.ceil(d.length / l))
|
|
1930
1955
|
);
|
|
1931
|
-
|
|
1932
|
-
for (const f of
|
|
1956
|
+
d = d.filter((f, m) => m % u === 0).slice(0, l);
|
|
1957
|
+
for (const f of d) {
|
|
1933
1958
|
const m = {};
|
|
1934
1959
|
for (const g of e.variables)
|
|
1935
1960
|
m[g] = await this.sampleVariableAt(g, {
|
|
@@ -1964,10 +1989,10 @@ class ye {
|
|
|
1964
1989
|
* Get chunk indices that intersect a geographic bounding box.
|
|
1965
1990
|
*/
|
|
1966
1991
|
getChunksForBounds(e, t, i, a) {
|
|
1967
|
-
const r = this.getCoords(), n = this.getChunkShape(e), o = this.getDimensions(e), c = o.indexOf("latitude"),
|
|
1992
|
+
const r = this.getCoords(), n = this.getChunkShape(e), o = this.getDimensions(e), c = o.indexOf("latitude"), d = o.indexOf("longitude"), l = n[c], u = n[d], f = r.latitude, m = r.longitude, p = this.findNearestIndex(f, a.north), h = this.findNearestIndex(f, a.south), g = this.findNearestIndex(m, a.west), x = this.findNearestIndex(m, a.east), T = Math.min(p, h), M = Math.max(p, h), y = Math.min(g, x), v = Math.max(g, x), _ = Math.floor(T / l), S = Math.floor(M / l), R = Math.floor(y / u), E = Math.floor(v / u), k = this.getShape(e), F = k[c], P = k[d], L = [];
|
|
1968
1993
|
for (let b = _; b <= S; b++)
|
|
1969
1994
|
for (let A = R; A <= E; A++) {
|
|
1970
|
-
const N = b * l, C = A *
|
|
1995
|
+
const N = b * l, C = A * u, I = Math.min(l, F - N), w = Math.min(u, P - C);
|
|
1971
1996
|
L.push({
|
|
1972
1997
|
timeIdx: t,
|
|
1973
1998
|
depthIdx: i,
|
|
@@ -2001,7 +2026,7 @@ class ye {
|
|
|
2001
2026
|
let h = 0;
|
|
2002
2027
|
if (p === "time")
|
|
2003
2028
|
h = t.timeIndex;
|
|
2004
|
-
else if (p === this.verticalName ||
|
|
2029
|
+
else if (p === this.verticalName || Re.includes(p))
|
|
2005
2030
|
h = t.verticalIndex;
|
|
2006
2031
|
else if (p === "latitude") {
|
|
2007
2032
|
o[m] = t.latitudeChunkIndex;
|
|
@@ -2012,17 +2037,17 @@ class ye {
|
|
|
2012
2037
|
}
|
|
2013
2038
|
o[m] = Math.floor(h / a[m]), c[m] = h % a[m];
|
|
2014
2039
|
}
|
|
2015
|
-
const
|
|
2040
|
+
const d = await this.fetchChunkResult(e, o), l = a[r], u = a[n], f = new Float32Array(l * u);
|
|
2016
2041
|
f.fill(NaN);
|
|
2017
2042
|
for (let m = 0; m < l; m++) {
|
|
2018
2043
|
c[r] = m;
|
|
2019
|
-
for (let p = 0; p <
|
|
2044
|
+
for (let p = 0; p < u; p++) {
|
|
2020
2045
|
c[n] = p;
|
|
2021
2046
|
const h = this.getFlatOffset(e, c);
|
|
2022
|
-
h <
|
|
2047
|
+
h < d.data.length && (f[m * u + p] = d.data[h]);
|
|
2023
2048
|
}
|
|
2024
2049
|
}
|
|
2025
|
-
return { ...
|
|
2050
|
+
return { ...d, data: f };
|
|
2026
2051
|
}
|
|
2027
2052
|
async fetchChunkResult(e, t) {
|
|
2028
2053
|
const i = this.getDimensionSeparator(e), a = t.join(i), r = `${e}/${a}`, n = `${this.root}/${e}/${a}`;
|
|
@@ -2033,21 +2058,21 @@ class ye {
|
|
|
2033
2058
|
this.abortControllers.set(r, o);
|
|
2034
2059
|
const c = this.getArrayMeta(e);
|
|
2035
2060
|
try {
|
|
2036
|
-
const
|
|
2037
|
-
if (!
|
|
2038
|
-
if (
|
|
2061
|
+
const d = await fetch(n, { signal: o.signal });
|
|
2062
|
+
if (!d.ok) {
|
|
2063
|
+
if (d.status === 403 || d.status === 404)
|
|
2039
2064
|
return {
|
|
2040
|
-
data:
|
|
2065
|
+
data: Ni(c),
|
|
2041
2066
|
missing: !0,
|
|
2042
|
-
status:
|
|
2067
|
+
status: d.status,
|
|
2043
2068
|
url: n
|
|
2044
2069
|
};
|
|
2045
|
-
throw new
|
|
2070
|
+
throw new Qe(d.status, n);
|
|
2046
2071
|
}
|
|
2047
|
-
const l = new Uint8Array(await
|
|
2072
|
+
const l = new Uint8Array(await d.arrayBuffer()), u = Vi(
|
|
2048
2073
|
await this.decompress(l, c, e)
|
|
2049
2074
|
);
|
|
2050
|
-
return this.cacheChunk(r,
|
|
2075
|
+
return this.cacheChunk(r, u), { data: u, missing: !1, url: n };
|
|
2051
2076
|
} finally {
|
|
2052
2077
|
this.abortControllers.get(r) === o && this.abortControllers.delete(r);
|
|
2053
2078
|
}
|
|
@@ -2067,7 +2092,7 @@ class ye {
|
|
|
2067
2092
|
getBloscCodec(e) {
|
|
2068
2093
|
const t = e.compressor, i = `${t.cname ?? "lz4"}-${t.clevel ?? 5}-${t.shuffle ?? 1}-${t.blocksize ?? 0}`;
|
|
2069
2094
|
let a = this.bloscCodecCache.get(i);
|
|
2070
|
-
return a || (a =
|
|
2095
|
+
return a || (a = gi.fromConfig({
|
|
2071
2096
|
id: "blosc",
|
|
2072
2097
|
cname: t.cname ?? "lz4",
|
|
2073
2098
|
clevel: t.clevel ?? 5,
|
|
@@ -2081,7 +2106,7 @@ class ye {
|
|
|
2081
2106
|
switch (t.compressor.id) {
|
|
2082
2107
|
case "zlib":
|
|
2083
2108
|
case "gzip":
|
|
2084
|
-
a =
|
|
2109
|
+
a = pi(e);
|
|
2085
2110
|
break;
|
|
2086
2111
|
case "blosc": {
|
|
2087
2112
|
a = await this.getBloscCodec(t).decode(e);
|
|
@@ -2125,9 +2150,9 @@ class ye {
|
|
|
2125
2150
|
a.buffer,
|
|
2126
2151
|
a.byteOffset,
|
|
2127
2152
|
a.byteLength
|
|
2128
|
-
),
|
|
2129
|
-
r = new Float64Array(
|
|
2130
|
-
for (let l = 0; l <
|
|
2153
|
+
), d = a.byteLength / 8;
|
|
2154
|
+
r = new Float64Array(d);
|
|
2155
|
+
for (let l = 0; l < d; l++)
|
|
2131
2156
|
r[l] = Number(c.getBigInt64(l * 8, !0));
|
|
2132
2157
|
} else
|
|
2133
2158
|
throw new Error(`Unsupported dtype: ${n}`);
|
|
@@ -2136,24 +2161,24 @@ class ye {
|
|
|
2136
2161
|
for (let c = 0; c < r.length; c++)
|
|
2137
2162
|
r[c] === o && (r[c] = NaN);
|
|
2138
2163
|
if (i) {
|
|
2139
|
-
const c = this.getAttrs(i),
|
|
2140
|
-
if (
|
|
2141
|
-
const
|
|
2164
|
+
const c = this.getAttrs(i), d = c.scale_factor, l = c.add_offset;
|
|
2165
|
+
if (d != null || l != null) {
|
|
2166
|
+
const u = d ?? 1, f = l ?? 0;
|
|
2142
2167
|
for (let m = 0; m < r.length; m++)
|
|
2143
|
-
isNaN(r[m]) || (r[m] = r[m] *
|
|
2168
|
+
isNaN(r[m]) || (r[m] = r[m] * u + f);
|
|
2144
2169
|
}
|
|
2145
2170
|
}
|
|
2146
2171
|
return r;
|
|
2147
2172
|
}
|
|
2148
2173
|
async loadCoordinates() {
|
|
2149
2174
|
const e = async (c) => {
|
|
2150
|
-
const
|
|
2151
|
-
for (let g = 0; g <
|
|
2175
|
+
const d = this.getArrayMeta(c), l = d.shape[0], u = Math.ceil(l / d.chunks[0]), f = [];
|
|
2176
|
+
for (let g = 0; g < u; g++) {
|
|
2152
2177
|
const x = `${this.root}/${c}/${g}`, T = await fetch(x);
|
|
2153
2178
|
if (!T.ok)
|
|
2154
2179
|
throw new Error(`Failed to fetch coord ${c}/${g}`);
|
|
2155
2180
|
const M = new Uint8Array(await T.arrayBuffer());
|
|
2156
|
-
f.push(await this.decompress(M,
|
|
2181
|
+
f.push(await this.decompress(M, d));
|
|
2157
2182
|
}
|
|
2158
2183
|
if (f.length === 1)
|
|
2159
2184
|
return f[0].length > l ? f[0].subarray(0, l) : f[0];
|
|
@@ -2167,9 +2192,9 @@ class ye {
|
|
|
2167
2192
|
return p;
|
|
2168
2193
|
};
|
|
2169
2194
|
let t = null;
|
|
2170
|
-
for (const c of
|
|
2171
|
-
const
|
|
2172
|
-
if (this.meta.metadata[
|
|
2195
|
+
for (const c of Re) {
|
|
2196
|
+
const d = `${c}/.zarray`;
|
|
2197
|
+
if (this.meta.metadata[d] && "dtype" in this.meta.metadata[d]) {
|
|
2173
2198
|
t = c;
|
|
2174
2199
|
break;
|
|
2175
2200
|
}
|
|
@@ -2191,26 +2216,26 @@ class ye {
|
|
|
2191
2216
|
};
|
|
2192
2217
|
}
|
|
2193
2218
|
}
|
|
2194
|
-
function
|
|
2219
|
+
function Vi(s) {
|
|
2195
2220
|
return s instanceof Float32Array ? s : Float32Array.from(s);
|
|
2196
2221
|
}
|
|
2197
|
-
function
|
|
2222
|
+
function Ni(s) {
|
|
2198
2223
|
const e = s.chunks.reduce((i, a) => i * a, 1), t = new Float32Array(e);
|
|
2199
2224
|
return t.fill(NaN), t;
|
|
2200
2225
|
}
|
|
2201
|
-
function
|
|
2226
|
+
function zi(s) {
|
|
2202
2227
|
const t = s.trim().replace(/\s+\([^)]*\)\s*$/, "").match(
|
|
2203
2228
|
/^(\d{4})-(\d{2})-(\d{2})(?:(?:T|\s+)(\d{2})(?::(\d{2})(?::(\d{2})(?:\.(\d{1,9}))?)?)?)?(?:\s*(Z|[+-]\d{2}:?\d{2}))?$/i
|
|
2204
2229
|
);
|
|
2205
2230
|
if (!t)
|
|
2206
2231
|
return NaN;
|
|
2207
|
-
const i = Number(t[1]), a = Number(t[2]), r = Number(t[3]), n = Number(t[4] ?? 0), o = Number(t[5] ?? 0), c = Number(t[6] ?? 0),
|
|
2232
|
+
const i = Number(t[1]), a = Number(t[2]), r = Number(t[3]), n = Number(t[4] ?? 0), o = Number(t[5] ?? 0), c = Number(t[6] ?? 0), d = Number((t[7] ?? "").padEnd(3, "0").slice(0, 3)), l = t[8] ?? "Z";
|
|
2208
2233
|
if (a < 1 || a > 12 || n > 23 || o > 59 || c > 59)
|
|
2209
2234
|
return NaN;
|
|
2210
|
-
const
|
|
2211
|
-
|
|
2212
|
-
const f =
|
|
2213
|
-
if (
|
|
2235
|
+
const u = /* @__PURE__ */ new Date(0);
|
|
2236
|
+
u.setUTCFullYear(i, a - 1, r), u.setUTCHours(n, o, c, d);
|
|
2237
|
+
const f = u.getTime();
|
|
2238
|
+
if (u.getUTCFullYear() !== i || u.getUTCMonth() !== a - 1 || u.getUTCDate() !== r || u.getUTCHours() !== n || u.getUTCMinutes() !== o || u.getUTCSeconds() !== c || u.getUTCMilliseconds() !== d)
|
|
2214
2239
|
return NaN;
|
|
2215
2240
|
if (/^z$/i.test(l))
|
|
2216
2241
|
return f;
|
|
@@ -2223,7 +2248,7 @@ function Ui(s) {
|
|
|
2223
2248
|
const g = (p * 60 + h) * 6e4;
|
|
2224
2249
|
return f - (m[1] === "+" ? g : -g);
|
|
2225
2250
|
}
|
|
2226
|
-
function
|
|
2251
|
+
function Gi(s) {
|
|
2227
2252
|
if (typeof s != "number" || !Number.isFinite(s) || s <= 0)
|
|
2228
2253
|
return s;
|
|
2229
2254
|
const e = [
|
|
@@ -2245,7 +2270,7 @@ function Vi(s) {
|
|
|
2245
2270
|
return t;
|
|
2246
2271
|
return Math.round(s);
|
|
2247
2272
|
}
|
|
2248
|
-
function
|
|
2273
|
+
function Oi(s) {
|
|
2249
2274
|
if (s.length < 2)
|
|
2250
2275
|
return;
|
|
2251
2276
|
const e = s[1] - s[0];
|
|
@@ -2255,28 +2280,28 @@ function Ni(s) {
|
|
|
2255
2280
|
for (let i = 2; i < s.length; i++)
|
|
2256
2281
|
if (Math.abs(s[i] - s[i - 1] - e) > t)
|
|
2257
2282
|
return;
|
|
2258
|
-
return
|
|
2283
|
+
return Gi(e);
|
|
2259
2284
|
}
|
|
2260
|
-
class
|
|
2285
|
+
class xe extends Error {
|
|
2261
2286
|
constructor(e, t, i) {
|
|
2262
2287
|
super(
|
|
2263
2288
|
t.length > 0 ? "Remote data is not available yet; the selected frame may still be publishing." : "The selected frame contains no renderable data."
|
|
2264
2289
|
), this.name = "ZartiglFrameUnavailableError", this.time = e, this.statuses = [...new Set(t)].sort((a, r) => a - r), this.urls = [...new Set(i)];
|
|
2265
2290
|
}
|
|
2266
2291
|
}
|
|
2267
|
-
function
|
|
2292
|
+
function Bi(s) {
|
|
2268
2293
|
for (const e of s)
|
|
2269
2294
|
if (Number.isFinite(e))
|
|
2270
2295
|
return !0;
|
|
2271
2296
|
return !1;
|
|
2272
2297
|
}
|
|
2273
|
-
function
|
|
2298
|
+
function $i(s, e) {
|
|
2274
2299
|
for (let t = 0; t < Math.min(s.length, e.length); t++)
|
|
2275
2300
|
if (Number.isFinite(s[t]) && Number.isFinite(e[t]))
|
|
2276
2301
|
return !0;
|
|
2277
2302
|
return !1;
|
|
2278
2303
|
}
|
|
2279
|
-
function
|
|
2304
|
+
function Et(s) {
|
|
2280
2305
|
return {
|
|
2281
2306
|
phase: "blocked",
|
|
2282
2307
|
time: s.time,
|
|
@@ -2286,7 +2311,7 @@ function Rt(s) {
|
|
|
2286
2311
|
}
|
|
2287
2312
|
class me {
|
|
2288
2313
|
constructor(e) {
|
|
2289
|
-
this.type = "custom", this.renderingMode = "3d", this.map = null, this.gl = null, this.activeData = null, this.initialized = !1, this.suspended = !1, this.loading = !1, this.reloadQueued = !1, this.generation = 0, this.requestId = 0, this.pendingReadyTime = null, this.frameCache = /* @__PURE__ */ new Map(), this.inflight = /* @__PURE__ */ new Set(), this.listeners = /* @__PURE__ */ new Map(), this.textureUnit = 1, this.moveEndHandler = null, this.id = e.id, this.variable = e.variable, this.time = e.time ?? 0, this.depth = e.depth ?? 0, this.unit = e.unit ?? "", this.colorDomain = Q(e.colorDomain ?? null), this.zarrSource = e.zarrSource ?? new
|
|
2314
|
+
this.type = "custom", this.renderingMode = "3d", this.map = null, this.gl = null, this.activeData = null, this.initialized = !1, this.suspended = !1, this.loading = !1, this.reloadQueued = !1, this.generation = 0, this.requestId = 0, this.pendingReadyTime = null, this.frameCache = /* @__PURE__ */ new Map(), this.inflight = /* @__PURE__ */ new Set(), this.listeners = /* @__PURE__ */ new Map(), this.textureUnit = 1, this.moveEndHandler = null, this.id = e.id, this.variable = e.variable, this.time = e.time ?? 0, this.depth = e.depth ?? 0, this.unit = e.unit ?? "", this.colorDomain = Q(e.colorDomain ?? null), this.zarrSource = e.zarrSource ?? new _e(e.source), this.activeField = new Rt(), this.simulation = new Mt({
|
|
2290
2315
|
colorRamp: e.colorRamp,
|
|
2291
2316
|
opacity: e.opacity ?? 1,
|
|
2292
2317
|
logScale: e.logScale ?? !1,
|
|
@@ -2318,31 +2343,34 @@ class me {
|
|
|
2318
2343
|
const i = K(e);
|
|
2319
2344
|
if (this.suspended || !this.map || !this.activeData || !this.activeField.hasData())
|
|
2320
2345
|
return;
|
|
2321
|
-
const a =
|
|
2346
|
+
const a = Ge(i);
|
|
2322
2347
|
try {
|
|
2323
2348
|
const r = i.canvas;
|
|
2324
2349
|
this.simulation.resize(r.width, r.height), i.bindFramebuffer(i.FRAMEBUFFER, a.framebuffer), i.viewport(0, 0, r.width, r.height);
|
|
2325
|
-
const n = this.map.getBounds(), o = this.map
|
|
2326
|
-
this.activeField.bind(this.textureUnit),
|
|
2350
|
+
const n = this.map.getBounds(), o = t.defaultProjectionData, c = ye(this.map, o), d = 512 * Math.pow(2, this.map.getZoom());
|
|
2351
|
+
this.activeField.bind(this.textureUnit), c ? this.simulation.renderGridGlobe(
|
|
2327
2352
|
this.textureUnit,
|
|
2328
2353
|
[this.activeData.uMin, this.activeData.vMin],
|
|
2329
2354
|
[this.activeData.uMax, this.activeData.vMax],
|
|
2330
2355
|
t.modelViewProjectionMatrix,
|
|
2331
2356
|
this.activeField.geoBounds,
|
|
2332
|
-
|
|
2333
|
-
1
|
|
2357
|
+
o.clippingPlane,
|
|
2358
|
+
1,
|
|
2359
|
+
void 0,
|
|
2360
|
+
void 0,
|
|
2361
|
+
o
|
|
2334
2362
|
) : this.simulation.renderGrid(
|
|
2335
2363
|
this.textureUnit,
|
|
2336
2364
|
[this.activeData.uMin, this.activeData.vMin],
|
|
2337
2365
|
[this.activeData.uMax, this.activeData.vMax],
|
|
2338
2366
|
t.modelViewProjectionMatrix,
|
|
2339
|
-
|
|
2340
|
-
|
|
2367
|
+
d,
|
|
2368
|
+
Be(n, !1),
|
|
2341
2369
|
this.activeField.geoBounds,
|
|
2342
2370
|
1
|
|
2343
2371
|
);
|
|
2344
2372
|
} finally {
|
|
2345
|
-
|
|
2373
|
+
Oe(i, a);
|
|
2346
2374
|
}
|
|
2347
2375
|
if (this.pendingReadyTime != null) {
|
|
2348
2376
|
const r = this.pendingReadyTime;
|
|
@@ -2475,7 +2503,7 @@ class me {
|
|
|
2475
2503
|
const n = r instanceof Error ? r : new Error(String(r));
|
|
2476
2504
|
e === this.generation && t === this.requestId && (this.emit(
|
|
2477
2505
|
"status",
|
|
2478
|
-
n instanceof
|
|
2506
|
+
n instanceof xe ? Et(n) : { phase: "error", time: a, error: n }
|
|
2479
2507
|
), this.emit("error", n));
|
|
2480
2508
|
}
|
|
2481
2509
|
} finally {
|
|
@@ -2493,7 +2521,7 @@ class me {
|
|
|
2493
2521
|
r,
|
|
2494
2522
|
n,
|
|
2495
2523
|
a
|
|
2496
|
-
), c = this.zarrSource.getDimensions(this.variable),
|
|
2524
|
+
), c = this.zarrSource.getDimensions(this.variable), d = c.indexOf("latitude"), l = c.indexOf("longitude"), u = this.zarrSource.getChunkShape(this.variable);
|
|
2497
2525
|
let f = 0;
|
|
2498
2526
|
const m = o.length, p = [], h = [];
|
|
2499
2527
|
t?.(f, m);
|
|
@@ -2510,11 +2538,11 @@ class me {
|
|
|
2510
2538
|
);
|
|
2511
2539
|
return A.missing && (A.status != null && p.push(A.status), h.push(A.url)), f++, t?.(f, m), {
|
|
2512
2540
|
data: A.data,
|
|
2513
|
-
latStart: b.latIdx * d
|
|
2514
|
-
lonStart: b.lonIdx *
|
|
2541
|
+
latStart: b.latIdx * u[d],
|
|
2542
|
+
lonStart: b.lonIdx * u[l],
|
|
2515
2543
|
latSize: b.latSize,
|
|
2516
2544
|
lonSize: b.lonSize,
|
|
2517
|
-
lonChunkSize:
|
|
2545
|
+
lonChunkSize: u[l]
|
|
2518
2546
|
};
|
|
2519
2547
|
})
|
|
2520
2548
|
), x = Math.min(...g.map((b) => b.latStart)), T = Math.max(...g.map((b) => b.latStart + b.latSize)), M = Math.min(...g.map((b) => b.lonStart)), y = Math.max(...g.map((b) => b.lonStart + b.lonSize)), v = T - x, _ = y - M, S = g.map((b) => ({
|
|
@@ -2526,7 +2554,7 @@ class me {
|
|
|
2526
2554
|
east: R.longitude[k],
|
|
2527
2555
|
south: Math.min(R.latitude[x], R.latitude[E]),
|
|
2528
2556
|
north: Math.max(R.latitude[x], R.latitude[E])
|
|
2529
|
-
}, P = R.latitude[x] > R.latitude[E], L =
|
|
2557
|
+
}, P = R.latitude[x] > R.latitude[E], L = Pt(
|
|
2530
2558
|
S,
|
|
2531
2559
|
[],
|
|
2532
2560
|
v,
|
|
@@ -2535,8 +2563,8 @@ class me {
|
|
|
2535
2563
|
P,
|
|
2536
2564
|
!0
|
|
2537
2565
|
);
|
|
2538
|
-
if (!
|
|
2539
|
-
throw new
|
|
2566
|
+
if (!Bi(L.u))
|
|
2567
|
+
throw new xe(
|
|
2540
2568
|
this.timeToMs(e),
|
|
2541
2569
|
p,
|
|
2542
2570
|
h
|
|
@@ -2548,8 +2576,8 @@ class me {
|
|
|
2548
2576
|
this.emit("status", { phase: "rendering", time: i }), this.activeData = e, this.activeField.update(e, this.colorDomain), this.activeField.setFilter(!1), this.emit("loaded", this.computeFieldMeta(e, t)), this.pendingReadyTime = i, this.map?.triggerRepaint();
|
|
2549
2577
|
}
|
|
2550
2578
|
sampleActiveData(e, t, i) {
|
|
2551
|
-
const { west: a, east: r, south: n, north: o } = e.bounds, c = r - a,
|
|
2552
|
-
if (e.width <= 0 || e.height <= 0 || c <= 0 ||
|
|
2579
|
+
const { west: a, east: r, south: n, north: o } = e.bounds, c = r - a, d = o - n;
|
|
2580
|
+
if (e.width <= 0 || e.height <= 0 || c <= 0 || d <= 0)
|
|
2553
2581
|
return {
|
|
2554
2582
|
longitude: t,
|
|
2555
2583
|
latitude: i,
|
|
@@ -2568,13 +2596,13 @@ class me {
|
|
|
2568
2596
|
time: this.timeToMs(this.time),
|
|
2569
2597
|
depth: this.depth
|
|
2570
2598
|
};
|
|
2571
|
-
const
|
|
2599
|
+
const u = (l - a) / c, f = e.latDescending ? (o - i) / d : (i - n) / d, m = Math.max(
|
|
2572
2600
|
0,
|
|
2573
|
-
Math.min(e.width - 1, Math.round(
|
|
2601
|
+
Math.min(e.width - 1, Math.round(u * (e.width - 1)))
|
|
2574
2602
|
), p = Math.max(
|
|
2575
2603
|
0,
|
|
2576
2604
|
Math.min(e.height - 1, Math.round(f * (e.height - 1)))
|
|
2577
|
-
), h = e.u[p * e.width + m] ?? NaN, g = a + m / Math.max(1, e.width - 1) * c, x = e.latDescending ? o - p / Math.max(1, e.height - 1) *
|
|
2605
|
+
), h = e.u[p * e.width + m] ?? NaN, g = a + m / Math.max(1, e.width - 1) * c, x = e.latDescending ? o - p / Math.max(1, e.height - 1) * d : n + p / Math.max(1, e.height - 1) * d;
|
|
2578
2606
|
return {
|
|
2579
2607
|
longitude: g,
|
|
2580
2608
|
latitude: x,
|
|
@@ -2604,7 +2632,7 @@ class me {
|
|
|
2604
2632
|
a(...t);
|
|
2605
2633
|
}
|
|
2606
2634
|
}
|
|
2607
|
-
function
|
|
2635
|
+
function qi(s, e, t) {
|
|
2608
2636
|
if (!Number.isFinite(s) || !Number.isFinite(e))
|
|
2609
2637
|
return { u: NaN, v: NaN };
|
|
2610
2638
|
const i = t.direction_convention !== t.output_direction ? 180 : 0, a = (s + i) * Math.PI / 180;
|
|
@@ -2613,15 +2641,15 @@ function Oi(s, e, t) {
|
|
|
2613
2641
|
v: e * Math.cos(a)
|
|
2614
2642
|
};
|
|
2615
2643
|
}
|
|
2616
|
-
function
|
|
2644
|
+
function La(s) {
|
|
2617
2645
|
return [s.direction_variable, s.magnitude_variable];
|
|
2618
2646
|
}
|
|
2619
|
-
const
|
|
2647
|
+
const Wi = 0.7;
|
|
2620
2648
|
class D {
|
|
2621
2649
|
constructor(e) {
|
|
2622
|
-
if (this.type = "custom", this.renderingMode = "3d", this.map = null, this.gl = null, this.initialized = !1, this.suspended = !1, this.loading = !1, this.reloadQueued = !1, this.reloadQueuedResetParticles = !1, this.generation = 0, this.requestId = 0, this.pendingReadyTime = null, this.velocityTexUnit = 1, this.moveStartHandler = null, this.moveHandler = null, this.moveEndHandler = null, this.frameCache = /* @__PURE__ */ new Map(), this.inflight = /* @__PURE__ */ new Set(), this.listeners = /* @__PURE__ */ new Map(), this.id = e.id, this.geoVideoManifest = e.geoVideo?.manifest, this.geoVideoManifest && this.geoVideoManifest.encoding.kind !== "vector-luma")
|
|
2650
|
+
if (this.type = "custom", this.renderingMode = "3d", this.map = null, this.gl = null, this.initialized = !1, this.suspended = !1, this.loading = !1, this.reloadQueued = !1, this.reloadQueuedResetParticles = !1, this.globeRendering = null, this.generation = 0, this.requestId = 0, this.pendingReadyTime = null, this.velocityTexUnit = 1, this.moveStartHandler = null, this.moveHandler = null, this.moveEndHandler = null, this.frameCache = /* @__PURE__ */ new Map(), this.inflight = /* @__PURE__ */ new Set(), this.listeners = /* @__PURE__ */ new Map(), this.id = e.id, this.geoVideoManifest = e.geoVideo?.manifest, this.geoVideoManifest && this.geoVideoManifest.encoding.kind !== "vector-luma")
|
|
2623
2651
|
throw new Error("Vector GeoVideo requires a vector-luma manifest");
|
|
2624
|
-
this.playback = e.geoVideo ? new
|
|
2652
|
+
this.playback = e.geoVideo ? new yt(
|
|
2625
2653
|
{ ...e.geoVideo, time: e.time },
|
|
2626
2654
|
() => this.map?.triggerRepaint(),
|
|
2627
2655
|
(t, ...i) => {
|
|
@@ -2639,16 +2667,16 @@ class D {
|
|
|
2639
2667
|
}
|
|
2640
2668
|
t === "timeChange" && (this.time = i[0]), this.emit(t, ...i);
|
|
2641
2669
|
}
|
|
2642
|
-
) : null, this.variableU = e.variableU ?? "uo", this.variableV = e.variableV ?? "vo", this.vectorDerivation = e.vectorDerivation, this.unit = e.unit ?? "m/s", this.time = e.time ?? 0, this.depth = e.depth ?? 0, this.zarrSourceValue = this.playback ? null : e.zarrSource ?? new
|
|
2670
|
+
) : null, this.variableU = e.variableU ?? "uo", this.variableV = e.variableV ?? "vo", this.vectorDerivation = e.vectorDerivation, this.unit = e.unit ?? "m/s", this.time = e.time ?? 0, this.depth = e.depth ?? 0, this.zarrSourceValue = this.playback ? null : e.zarrSource ?? new _e(e.source), this.velocityField = new Rt(), this.simulation = new Mt({
|
|
2643
2671
|
particleDensity: e.particleDensity ?? 0.05,
|
|
2644
2672
|
speed: e.speed ?? 1,
|
|
2645
|
-
fadeOpacity:
|
|
2673
|
+
fadeOpacity: Xe(e.fade ?? Wi),
|
|
2646
2674
|
colorRamp: e.colorRamp,
|
|
2647
2675
|
opacity: e.opacity ?? 1,
|
|
2648
2676
|
logScale: e.logScale ?? !1,
|
|
2649
2677
|
vibrance: e.vibrance ?? 0,
|
|
2650
|
-
colorGrade:
|
|
2651
|
-
backdrop:
|
|
2678
|
+
colorGrade: bt(e.colorGrade),
|
|
2679
|
+
backdrop: St(e.backdrop),
|
|
2652
2680
|
glow: e.glow ?? 0,
|
|
2653
2681
|
particleState: e.particleState ?? "auto",
|
|
2654
2682
|
rgba8MaxParticleZoom: e.rgba8MaxParticleZoom ?? 4
|
|
@@ -2696,9 +2724,9 @@ class D {
|
|
|
2696
2724
|
};
|
|
2697
2725
|
}
|
|
2698
2726
|
isViewportCovered() {
|
|
2699
|
-
return !this.map || !this.velocityField.hasData() ? !1 :
|
|
2727
|
+
return !this.map || !this.velocityField.hasData() ? !1 : Si(
|
|
2700
2728
|
this.velocityField.geoBounds,
|
|
2701
|
-
|
|
2729
|
+
xi(this.map.getBounds())
|
|
2702
2730
|
);
|
|
2703
2731
|
}
|
|
2704
2732
|
reloadIfViewportUncovered() {
|
|
@@ -2715,20 +2743,20 @@ class D {
|
|
|
2715
2743
|
* The map's current viewport is used to determine the lat bounds of the request.
|
|
2716
2744
|
*/
|
|
2717
2745
|
async fetchVelocityData(e, t) {
|
|
2718
|
-
const i = this.map.getBounds(), a = this.map
|
|
2746
|
+
const i = this.map.getBounds(), a = this.globeRendering ?? ye(this.map), r = bi(i, 1, a), n = this.zarrSource.findTimeIndex(e), o = this.zarrSource.findDepthIndex(this.depth);
|
|
2719
2747
|
console.log(
|
|
2720
2748
|
`[zartigl] Loading velocity: depth=${this.depth} → depthIdx=${o}, actual depth value=${this.zarrSource.getCoords().vertical[o]}, timeIdx=${n}`
|
|
2721
2749
|
);
|
|
2722
|
-
const c = this.vectorDerivation?.direction_variable ?? this.variableU,
|
|
2750
|
+
const c = this.vectorDerivation?.direction_variable ?? this.variableU, d = this.zarrSource.getChunksForBounds(
|
|
2723
2751
|
c,
|
|
2724
2752
|
n,
|
|
2725
2753
|
o,
|
|
2726
2754
|
r
|
|
2727
|
-
), l = this.zarrSource.getDimensions(c),
|
|
2755
|
+
), l = this.zarrSource.getDimensions(c), u = l.indexOf("latitude"), f = l.indexOf("longitude");
|
|
2728
2756
|
let m = 0;
|
|
2729
|
-
const p =
|
|
2757
|
+
const p = d.length * 2, h = [], g = [];
|
|
2730
2758
|
t?.(m, p);
|
|
2731
|
-
const x = (w) =>
|
|
2759
|
+
const x = (w) => d.map(async (U) => {
|
|
2732
2760
|
const X = await this.zarrSource.fetchSpatialChunkResult(w, {
|
|
2733
2761
|
timeIndex: U.timeIdx,
|
|
2734
2762
|
verticalIndex: U.depthIdx,
|
|
@@ -2739,13 +2767,13 @@ class D {
|
|
|
2739
2767
|
const oe = this.zarrSource.getChunkShape(w), le = oe[f];
|
|
2740
2768
|
return {
|
|
2741
2769
|
data: X.data,
|
|
2742
|
-
latStart: U.latIdx * oe[
|
|
2770
|
+
latStart: U.latIdx * oe[u],
|
|
2743
2771
|
lonStart: U.lonIdx * le,
|
|
2744
2772
|
latSize: U.latSize,
|
|
2745
2773
|
lonSize: U.lonSize,
|
|
2746
2774
|
lonChunkSize: le
|
|
2747
2775
|
};
|
|
2748
|
-
}), [T, M] = this.vectorDerivation ?
|
|
2776
|
+
}), [T, M] = this.vectorDerivation ? Xi(
|
|
2749
2777
|
await Promise.all(
|
|
2750
2778
|
x(this.vectorDerivation.direction_variable)
|
|
2751
2779
|
),
|
|
@@ -2769,7 +2797,7 @@ class D {
|
|
|
2769
2797
|
east: P.longitude[b],
|
|
2770
2798
|
south: Math.min(P.latitude[y], P.latitude[L]),
|
|
2771
2799
|
north: Math.max(P.latitude[y], P.latitude[L])
|
|
2772
|
-
}, N = P.latitude[y] > P.latitude[L], C =
|
|
2800
|
+
}, N = P.latitude[y] > P.latitude[L], C = Pt(
|
|
2773
2801
|
k,
|
|
2774
2802
|
F,
|
|
2775
2803
|
R,
|
|
@@ -2777,8 +2805,8 @@ class D {
|
|
|
2777
2805
|
A,
|
|
2778
2806
|
N
|
|
2779
2807
|
), I = this.zarrSource.getValueDomain?.();
|
|
2780
|
-
if (I != null && I > 0 && (C.uMin = -I, C.uMax = I, C.vMin = -I, C.vMax = I),
|
|
2781
|
-
throw new
|
|
2808
|
+
if (I != null && I > 0 && (C.uMin = -I, C.uMax = I, C.vMin = -I, C.vMax = I), !$i(C.u, C.v))
|
|
2809
|
+
throw new xe(
|
|
2782
2810
|
this.timeToMs(e),
|
|
2783
2811
|
h,
|
|
2784
2812
|
g
|
|
@@ -2804,12 +2832,12 @@ class D {
|
|
|
2804
2832
|
else {
|
|
2805
2833
|
const o = await this.fetchVelocityData(
|
|
2806
2834
|
a,
|
|
2807
|
-
(c,
|
|
2835
|
+
(c, d) => {
|
|
2808
2836
|
t === this.generation && i === this.requestId && this.emit("status", {
|
|
2809
2837
|
phase: "fetching",
|
|
2810
2838
|
time: r,
|
|
2811
2839
|
completed: c,
|
|
2812
|
-
total:
|
|
2840
|
+
total: d
|
|
2813
2841
|
});
|
|
2814
2842
|
}
|
|
2815
2843
|
);
|
|
@@ -2825,7 +2853,7 @@ class D {
|
|
|
2825
2853
|
const o = n instanceof Error ? n : new Error(String(n));
|
|
2826
2854
|
console.error("[zartigl] Failed to load velocity:", o), t === this.generation && i === this.requestId && (this.emit(
|
|
2827
2855
|
"status",
|
|
2828
|
-
o instanceof
|
|
2856
|
+
o instanceof xe ? Et(o) : { phase: "error", time: r, error: o }
|
|
2829
2857
|
), this.emit("error", o));
|
|
2830
2858
|
}
|
|
2831
2859
|
} finally {
|
|
@@ -2843,52 +2871,61 @@ class D {
|
|
|
2843
2871
|
if (this.playback ? !r || !n : !this.initialized || !this.velocityField.hasData())
|
|
2844
2872
|
return;
|
|
2845
2873
|
n?.setFilter(this.simulation.renderMode !== "raster");
|
|
2846
|
-
const o = n?.manifest.encoding.kind === "vector-luma" ? n.manifest.encoding.valueDomain : 0, c = n ? [-o, -o] : [this.velocityField.uMin, this.velocityField.vMin],
|
|
2874
|
+
const o = n?.manifest.encoding.kind === "vector-luma" ? n.manifest.encoding.valueDomain : 0, c = n ? [-o, -o] : [this.velocityField.uMin, this.velocityField.vMin], d = n ? [o, o] : [this.velocityField.uMax, this.velocityField.vMax], l = n ? {
|
|
2847
2875
|
west: n.bounds[0],
|
|
2848
2876
|
south: n.bounds[1],
|
|
2849
2877
|
east: n.bounds[2],
|
|
2850
2878
|
north: n.bounds[3]
|
|
2851
|
-
} : this.velocityField.geoBounds,
|
|
2879
|
+
} : this.velocityField.geoBounds, u = r ? {
|
|
2852
2880
|
a: {
|
|
2853
2881
|
unit: 1,
|
|
2854
2882
|
min: c,
|
|
2855
|
-
max:
|
|
2883
|
+
max: d,
|
|
2856
2884
|
physical: !0,
|
|
2857
2885
|
northToSouth: !0
|
|
2858
2886
|
},
|
|
2859
2887
|
b: {
|
|
2860
2888
|
unit: 4,
|
|
2861
2889
|
min: c,
|
|
2862
|
-
max:
|
|
2890
|
+
max: d,
|
|
2863
2891
|
physical: !0,
|
|
2864
2892
|
northToSouth: !0
|
|
2865
2893
|
},
|
|
2866
2894
|
mix: r[2]
|
|
2867
|
-
} : void 0, f =
|
|
2895
|
+
} : void 0, f = Ge(i), m = r ? [1, 4].map((p) => (i.activeTexture(i.TEXTURE0 + p), i.getParameter(i.TEXTURE_BINDING_2D))) : [];
|
|
2868
2896
|
try {
|
|
2869
2897
|
const p = i.canvas;
|
|
2870
2898
|
this.simulation.resize(p.width, p.height), i.bindFramebuffer(i.FRAMEBUFFER, f.framebuffer), r ? (i.activeTexture(i.TEXTURE1), i.bindTexture(i.TEXTURE_2D, r[0]), i.activeTexture(i.TEXTURE4), i.bindTexture(i.TEXTURE_2D, r[1])) : this.velocityField.bind(this.velocityTexUnit);
|
|
2871
|
-
const h = this.map
|
|
2899
|
+
const h = ye(this.map, t.defaultProjectionData);
|
|
2900
|
+
if (this.globeRendering !== null && this.globeRendering !== h) {
|
|
2901
|
+
if (this.globeRendering = h, !this.playback) {
|
|
2902
|
+
this.loadViewportVelocity({ resetParticles: !0 });
|
|
2903
|
+
return;
|
|
2904
|
+
}
|
|
2905
|
+
this.simulation.resetParticles();
|
|
2906
|
+
}
|
|
2907
|
+
this.globeRendering = h;
|
|
2908
|
+
const g = this.map.getBounds(), x = wi(g, h), T = Be(g, h);
|
|
2872
2909
|
i.disable(i.DEPTH_TEST), i.disable(i.STENCIL_TEST);
|
|
2873
2910
|
const M = 512 * Math.pow(2, this.map.getZoom()), y = this.map.getCenter();
|
|
2874
2911
|
this.simulation.render(
|
|
2875
2912
|
this.velocityTexUnit,
|
|
2876
2913
|
c,
|
|
2877
|
-
|
|
2914
|
+
d,
|
|
2878
2915
|
a,
|
|
2879
2916
|
x,
|
|
2880
2917
|
M,
|
|
2881
2918
|
T,
|
|
2882
2919
|
l,
|
|
2883
2920
|
h,
|
|
2884
|
-
|
|
2921
|
+
_i(y.lng, y.lat),
|
|
2885
2922
|
t.defaultProjectionData.clippingPlane,
|
|
2886
|
-
...
|
|
2923
|
+
...u ? [u] : []
|
|
2887
2924
|
);
|
|
2888
2925
|
} finally {
|
|
2889
2926
|
m.forEach((p, h) => {
|
|
2890
2927
|
i.activeTexture(i.TEXTURE0 + (h === 0 ? 1 : 4)), i.bindTexture(i.TEXTURE_2D, p);
|
|
2891
|
-
}),
|
|
2928
|
+
}), Oe(i, f);
|
|
2892
2929
|
}
|
|
2893
2930
|
if (this.pendingReadyTime != null) {
|
|
2894
2931
|
const p = this.pendingReadyTime;
|
|
@@ -3010,7 +3047,7 @@ class D {
|
|
|
3010
3047
|
this.simulation.setSpeed(e);
|
|
3011
3048
|
}
|
|
3012
3049
|
setFade(e) {
|
|
3013
|
-
this.simulation.setFadeOpacity(
|
|
3050
|
+
this.simulation.setFadeOpacity(Xe(e));
|
|
3014
3051
|
}
|
|
3015
3052
|
setParticleDensity(e) {
|
|
3016
3053
|
this.simulation.setParticleDensity(e);
|
|
@@ -3069,23 +3106,23 @@ class D {
|
|
|
3069
3106
|
a(...t);
|
|
3070
3107
|
}
|
|
3071
3108
|
}
|
|
3072
|
-
function
|
|
3109
|
+
function Xi(s, e, t) {
|
|
3073
3110
|
const i = [], a = [];
|
|
3074
3111
|
for (let r = 0; r < s.length; r++) {
|
|
3075
|
-
const n = s[r], o = e[r], c = new Float32Array(n.data.length),
|
|
3112
|
+
const n = s[r], o = e[r], c = new Float32Array(n.data.length), d = new Float32Array(n.data.length);
|
|
3076
3113
|
for (let l = 0; l < n.data.length; l++) {
|
|
3077
|
-
const
|
|
3114
|
+
const u = qi(
|
|
3078
3115
|
n.data[l],
|
|
3079
3116
|
o.data[l],
|
|
3080
3117
|
t
|
|
3081
3118
|
);
|
|
3082
|
-
c[l] =
|
|
3119
|
+
c[l] = u.u, d[l] = u.v;
|
|
3083
3120
|
}
|
|
3084
|
-
i.push({ ...n, data: c }), a.push({ ...n, data:
|
|
3121
|
+
i.push({ ...n, data: c }), a.push({ ...n, data: d });
|
|
3085
3122
|
}
|
|
3086
3123
|
return [i, a];
|
|
3087
3124
|
}
|
|
3088
|
-
var
|
|
3125
|
+
var Ke = `precision mediump float;
|
|
3089
3126
|
|
|
3090
3127
|
uniform sampler2D u_color;
|
|
3091
3128
|
uniform sampler2D u_color_next;
|
|
@@ -3147,7 +3184,7 @@ void main() {
|
|
|
3147
3184
|
const Z = 128, te = 64;
|
|
3148
3185
|
class G {
|
|
3149
3186
|
constructor(e) {
|
|
3150
|
-
this.type = "custom", this.renderingMode = "3d", this.map = null, this.gl = null, this.manifest = null, this.colorRampTexture = null, this.mercatorProgram = null, this.globeProgram = null, this.vertexBuffer = null, this.indexBuffer = null, this.indexCount = 0, this.abortController = null, this.listeners = /* @__PURE__ */ new Map(), this.id = e.id, this.source = e.manifest, this.opacity = e.opacity ?? 1, this.playback = new
|
|
3187
|
+
this.type = "custom", this.renderingMode = "3d", this.map = null, this.gl = null, this.manifest = null, this.colorRampTexture = null, this.mercatorProgram = null, this.globeProgram = null, this.vertexBuffer = null, this.indexBuffer = null, this.indexCount = 0, this.abortController = null, this.listeners = /* @__PURE__ */ new Map(), this.id = e.id, this.source = e.manifest, this.opacity = e.opacity ?? 1, this.playback = new yt(
|
|
3151
3188
|
e,
|
|
3152
3189
|
() => this.map?.triggerRepaint(),
|
|
3153
3190
|
(t, ...i) => this.emit(t, ...i)
|
|
@@ -3157,7 +3194,7 @@ class G {
|
|
|
3157
3194
|
const i = K(t);
|
|
3158
3195
|
this.map = e, this.gl = i, this.abortController = new AbortController(), this.emit("loading"), this.emit("status", { phase: "metadata" });
|
|
3159
3196
|
try {
|
|
3160
|
-
if (this.manifest = await
|
|
3197
|
+
if (this.manifest = await Ce(
|
|
3161
3198
|
this.source,
|
|
3162
3199
|
this.abortController.signal
|
|
3163
3200
|
), this.abortController?.signal.aborted || !this.map)
|
|
@@ -3189,9 +3226,9 @@ class G {
|
|
|
3189
3226
|
const n = r.manifest;
|
|
3190
3227
|
if (!a || !r.maskTexture)
|
|
3191
3228
|
return;
|
|
3192
|
-
const o =
|
|
3229
|
+
const o = Ge(i), c = [0, 1, 2, 3].map((d) => (i.activeTexture(i.TEXTURE0 + d), i.getParameter(i.TEXTURE_BINDING_2D)));
|
|
3193
3230
|
try {
|
|
3194
|
-
const
|
|
3231
|
+
const d = !!this.map && ye(this.map, t.defaultProjectionData), l = d ? this.globeProgram : this.mercatorProgram;
|
|
3195
3232
|
if (!l || !this.map)
|
|
3196
3233
|
return;
|
|
3197
3234
|
i.useProgram(l), i.disable(i.DEPTH_TEST), i.disable(i.STENCIL_TEST), i.enable(i.BLEND), i.blendFunc(i.SRC_ALPHA, i.ONE_MINUS_SRC_ALPHA), i.activeTexture(i.TEXTURE0), i.bindTexture(i.TEXTURE_2D, a[0]), i.uniform1i(i.getUniformLocation(l, "u_color"), 0), i.activeTexture(i.TEXTURE3), i.bindTexture(i.TEXTURE_2D, a[1]), i.uniform1i(i.getUniformLocation(l, "u_color_next"), 3), i.uniform1f(i.getUniformLocation(l, "u_mix"), a[2]), i.activeTexture(i.TEXTURE1), i.bindTexture(i.TEXTURE_2D, r.maskTexture), i.uniform1i(i.getUniformLocation(l, "u_mask"), 1), i.activeTexture(i.TEXTURE2), i.bindTexture(i.TEXTURE_2D, this.colorRampTexture), i.uniform1i(i.getUniformLocation(l, "u_color_ramp"), 2), i.uniform1f(i.getUniformLocation(l, "u_opacity"), this.opacity), i.uniform1f(i.getUniformLocation(l, "u_scalar_luma"), 1), i.uniform1f(
|
|
@@ -3201,7 +3238,7 @@ class G {
|
|
|
3201
3238
|
i.getUniformLocation(l, "u_mask_threshold"),
|
|
3202
3239
|
n.mask.threshold
|
|
3203
3240
|
);
|
|
3204
|
-
const { codeRange:
|
|
3241
|
+
const { codeRange: u, valueRange: f, transfer: m } = Kt(
|
|
3205
3242
|
n.encoding
|
|
3206
3243
|
);
|
|
3207
3244
|
i.uniform1f(
|
|
@@ -3211,7 +3248,7 @@ class G {
|
|
|
3211
3248
|
const p = this.colorDomain ?? f;
|
|
3212
3249
|
i.uniform2f(
|
|
3213
3250
|
i.getUniformLocation(l, "u_code_range"),
|
|
3214
|
-
...
|
|
3251
|
+
...u
|
|
3215
3252
|
), i.uniform2f(
|
|
3216
3253
|
i.getUniformLocation(l, "u_value_range"),
|
|
3217
3254
|
...f
|
|
@@ -3235,16 +3272,29 @@ class G {
|
|
|
3235
3272
|
g,
|
|
3236
3273
|
M,
|
|
3237
3274
|
T
|
|
3238
|
-
), this.bindGrid(i, l),
|
|
3275
|
+
), this.bindGrid(i, l), d) {
|
|
3239
3276
|
const y = t.defaultProjectionData.clippingPlane;
|
|
3240
3277
|
i.uniform4f(
|
|
3241
3278
|
i.getUniformLocation(l, "u_clipping_plane"),
|
|
3242
3279
|
...y
|
|
3280
|
+
), vt(
|
|
3281
|
+
i,
|
|
3282
|
+
{
|
|
3283
|
+
u_projection_transition: i.getUniformLocation(
|
|
3284
|
+
l,
|
|
3285
|
+
"u_projection_transition"
|
|
3286
|
+
),
|
|
3287
|
+
u_fallback_matrix: i.getUniformLocation(
|
|
3288
|
+
l,
|
|
3289
|
+
"u_fallback_matrix"
|
|
3290
|
+
)
|
|
3291
|
+
},
|
|
3292
|
+
t.defaultProjectionData
|
|
3243
3293
|
), i.drawElements(i.TRIANGLES, this.indexCount, i.UNSIGNED_SHORT, 0);
|
|
3244
3294
|
} else {
|
|
3245
3295
|
const y = 512 * Math.pow(2, this.map.getZoom());
|
|
3246
3296
|
i.uniform1f(i.getUniformLocation(l, "u_world_size"), y);
|
|
3247
|
-
for (const v of
|
|
3297
|
+
for (const v of Be(
|
|
3248
3298
|
this.map.getBounds(),
|
|
3249
3299
|
!1
|
|
3250
3300
|
))
|
|
@@ -3255,9 +3305,9 @@ class G {
|
|
|
3255
3305
|
}
|
|
3256
3306
|
this.unbindGrid(i, l);
|
|
3257
3307
|
} finally {
|
|
3258
|
-
c.forEach((
|
|
3259
|
-
i.activeTexture(i.TEXTURE0 + l), i.bindTexture(i.TEXTURE_2D,
|
|
3260
|
-
}),
|
|
3308
|
+
c.forEach((d, l) => {
|
|
3309
|
+
i.activeTexture(i.TEXTURE0 + l), i.bindTexture(i.TEXTURE_2D, d);
|
|
3310
|
+
}), Oe(i, o);
|
|
3261
3311
|
}
|
|
3262
3312
|
}
|
|
3263
3313
|
onRemove() {
|
|
@@ -3296,7 +3346,7 @@ class G {
|
|
|
3296
3346
|
setColorRamp(e) {
|
|
3297
3347
|
this.colorRamp = e, this.gl && (this.colorRampTexture && this.gl.deleteTexture(this.colorRampTexture), this.colorRampTexture = ge(
|
|
3298
3348
|
this.gl,
|
|
3299
|
-
|
|
3349
|
+
ke(e)
|
|
3300
3350
|
)), this.map?.triggerRepaint();
|
|
3301
3351
|
}
|
|
3302
3352
|
setLogScale(e) {
|
|
@@ -3336,7 +3386,7 @@ class G {
|
|
|
3336
3386
|
id: this.id,
|
|
3337
3387
|
initialized: !!e?.currentPair,
|
|
3338
3388
|
playing: this.playback.isPlaying(),
|
|
3339
|
-
currentTime: e ? e.manifest.timeline.kind === "snapshot-loop" ? (this.playback.time - e.times[0]) / 1e3 :
|
|
3389
|
+
currentTime: e ? e.manifest.timeline.kind === "snapshot-loop" ? (this.playback.time - e.times[0]) / 1e3 : Jt(e.manifest, this.playback.time) : 0,
|
|
3340
3390
|
manifestId: this.manifest?.id,
|
|
3341
3391
|
mediaUrl: this.manifest?.media.url,
|
|
3342
3392
|
preloadedMediaUrl: this.playback.preloadedMediaUrl,
|
|
@@ -3360,9 +3410,9 @@ class G {
|
|
|
3360
3410
|
return this.listeners.get(e)?.delete(t), this;
|
|
3361
3411
|
}
|
|
3362
3412
|
initGl(e) {
|
|
3363
|
-
this.mercatorProgram = W(e,
|
|
3413
|
+
this.mercatorProgram = W(e, wt, Ke), this.globeProgram = W(e, Tt, Ke), this.colorRampTexture = ge(
|
|
3364
3414
|
e,
|
|
3365
|
-
|
|
3415
|
+
ke(this.colorRamp)
|
|
3366
3416
|
);
|
|
3367
3417
|
const t = new Float32Array(
|
|
3368
3418
|
(Z + 1) * (te + 1) * 2
|
|
@@ -3376,8 +3426,8 @@ class G {
|
|
|
3376
3426
|
const n = Z + 1;
|
|
3377
3427
|
for (let o = 0; o < te; o++)
|
|
3378
3428
|
for (let c = 0; c < Z; c++) {
|
|
3379
|
-
const
|
|
3380
|
-
a[r++] =
|
|
3429
|
+
const d = o * n + c, l = d + 1, u = d + n, f = u + 1;
|
|
3430
|
+
a[r++] = d, a[r++] = u, a[r++] = l, a[r++] = l, a[r++] = u, a[r++] = f;
|
|
3381
3431
|
}
|
|
3382
3432
|
if (this.vertexBuffer = e.createBuffer(), this.indexBuffer = e.createBuffer(), !this.vertexBuffer || !this.indexBuffer)
|
|
3383
3433
|
throw new Error("Failed to create GeoVideo grid");
|
|
@@ -3395,28 +3445,28 @@ class G {
|
|
|
3395
3445
|
i(...t);
|
|
3396
3446
|
}
|
|
3397
3447
|
}
|
|
3398
|
-
function
|
|
3448
|
+
function $e(s) {
|
|
3399
3449
|
return typeof s == "string" ? s : new Date(s).toISOString();
|
|
3400
3450
|
}
|
|
3401
3451
|
function j(s) {
|
|
3402
3452
|
return encodeURIComponent(String(s));
|
|
3403
3453
|
}
|
|
3404
|
-
function
|
|
3454
|
+
function Lt(s, e) {
|
|
3405
3455
|
return e === "depth" ? -Math.abs(s) : s;
|
|
3406
3456
|
}
|
|
3407
|
-
function
|
|
3457
|
+
function Hi(s) {
|
|
3408
3458
|
let e = s.template.replace(/\{TileMatrix\}/gi, "{z}").replace(/\{TileRow\}/gi, "{y}").replace(/\{TileCol\}/gi, "{x}");
|
|
3409
3459
|
return s.tileMatrixSet != null && (e = e.replace(
|
|
3410
3460
|
/\{TileMatrixSet\}/gi,
|
|
3411
3461
|
j(s.tileMatrixSet)
|
|
3412
|
-
)), s.style != null && (e = e.replace(/\{Style\}/gi, j(s.style))), s.time != null && (e = e.replace(/\{time\}/gi, j(
|
|
3462
|
+
)), s.style != null && (e = e.replace(/\{Style\}/gi, j(s.style))), s.time != null && (e = e.replace(/\{time\}/gi, j($e(s.time)))), s.depth != null && (e = e.replace(
|
|
3413
3463
|
/\{elevation\}/gi,
|
|
3414
|
-
j(
|
|
3464
|
+
j(Lt(s.depth, s.verticalLabel))
|
|
3415
3465
|
)), [...e.matchAll(/\{([^{}]+)\}/g)].some(
|
|
3416
3466
|
(t) => !/^(?:z|y|x)$/i.test(t[1])
|
|
3417
3467
|
) ? void 0 : e;
|
|
3418
3468
|
}
|
|
3419
|
-
function
|
|
3469
|
+
function Je(s) {
|
|
3420
3470
|
const e = [
|
|
3421
3471
|
["SERVICE", "WMTS"],
|
|
3422
3472
|
["VERSION", "1.0.0"],
|
|
@@ -3428,16 +3478,16 @@ function Ke(s) {
|
|
|
3428
3478
|
["TILEROW", "{y}"],
|
|
3429
3479
|
["TILECOL", "{x}"]
|
|
3430
3480
|
];
|
|
3431
|
-
s.style && e.push(["STYLE", s.style]), s.time != null && e.push(["time",
|
|
3481
|
+
s.style && e.push(["STYLE", s.style]), s.time != null && e.push(["time", $e(s.time)]), s.depth != null && e.push([
|
|
3432
3482
|
"elevation",
|
|
3433
|
-
String(
|
|
3483
|
+
String(Lt(s.depth, s.verticalLabel))
|
|
3434
3484
|
]);
|
|
3435
3485
|
const t = e.map(
|
|
3436
3486
|
([i, a]) => `${i}=${a.startsWith("{") ? a : j(a)}`
|
|
3437
3487
|
).join("&");
|
|
3438
3488
|
return `${s.baseUrl}?${t}`;
|
|
3439
3489
|
}
|
|
3440
|
-
function
|
|
3490
|
+
function Yi(s) {
|
|
3441
3491
|
const e = [
|
|
3442
3492
|
["SERVICE", "WMTS"],
|
|
3443
3493
|
["REQUEST", "GetLegend"],
|
|
@@ -3446,32 +3496,32 @@ function Wi(s) {
|
|
|
3446
3496
|
];
|
|
3447
3497
|
return s.style && e.push(["STYLE", s.style]), `${s.baseUrl}?${e.map(([t, i]) => `${t}=${j(i)}`).join("&")}`;
|
|
3448
3498
|
}
|
|
3449
|
-
function
|
|
3499
|
+
function Zi(s) {
|
|
3450
3500
|
return s.sourceConfig.type === "wmts" ? "scalar-wmts" : s.sourceConfig.type === "geovideo" ? s.entry.kind === "vector" ? "vector-geovideo" : "scalar-geovideo" : s.entry.kind === "vector" ? "vector-zarr" : "scalar-zarr";
|
|
3451
3501
|
}
|
|
3452
|
-
function
|
|
3502
|
+
function ji(s) {
|
|
3453
3503
|
return s.variables.kind === "scalar" ? s.variables.value : "scalar";
|
|
3454
3504
|
}
|
|
3455
|
-
function
|
|
3505
|
+
function Qi(s) {
|
|
3456
3506
|
return s.variables.kind === "vector" ? s.variables.u ?? "uo" : "uo";
|
|
3457
3507
|
}
|
|
3458
|
-
function
|
|
3508
|
+
function Ki(s) {
|
|
3459
3509
|
return s.variables.kind === "vector" ? s.variables.v ?? "vo" : "vo";
|
|
3460
3510
|
}
|
|
3461
|
-
function
|
|
3511
|
+
function Ji(s) {
|
|
3462
3512
|
return s.variables.kind === "vector" ? s.variables.derivation : void 0;
|
|
3463
3513
|
}
|
|
3464
|
-
class
|
|
3514
|
+
class ea {
|
|
3465
3515
|
constructor(e) {
|
|
3466
|
-
if (this.type = "custom", this.renderingMode = "3d", this.delegate = null, this.map = null, this.suspended = !1, this.listeners = /* @__PURE__ */ new Map(), this.options = e, this.id = e.id, this.metadata = e.metadata ? { ...e.metadata } : void 0, this.backend =
|
|
3516
|
+
if (this.type = "custom", this.renderingMode = "3d", this.delegate = null, this.map = null, this.suspended = !1, this.listeners = /* @__PURE__ */ new Map(), this.options = e, this.id = e.id, this.metadata = e.metadata ? { ...e.metadata } : void 0, this.backend = Zi(e), this.rasterSourceId = `${e.id}-wmts-source`, this.rasterLayerId = `${e.id}-wmts`, this.time = e.time ?? 0, this.depth = e.depth ?? 0, this.opacity = e.opacity ?? 1, this.backend === "vector-zarr") {
|
|
3467
3517
|
const t = e.sourceConfig;
|
|
3468
3518
|
this.delegate = new D({
|
|
3469
3519
|
...e,
|
|
3470
3520
|
source: t.endpoints.field,
|
|
3471
3521
|
zarrSource: e.zarrSource,
|
|
3472
|
-
variableU:
|
|
3473
|
-
variableV:
|
|
3474
|
-
vectorDerivation:
|
|
3522
|
+
variableU: Qi(t),
|
|
3523
|
+
variableV: Ki(t),
|
|
3524
|
+
vectorDerivation: Ji(t),
|
|
3475
3525
|
unit: e.unit ?? ""
|
|
3476
3526
|
});
|
|
3477
3527
|
} else if (this.backend === "vector-geovideo") {
|
|
@@ -3498,7 +3548,7 @@ class Qi {
|
|
|
3498
3548
|
id: e.id,
|
|
3499
3549
|
source: t.endpoints.field,
|
|
3500
3550
|
zarrSource: e.zarrSource,
|
|
3501
|
-
variable:
|
|
3551
|
+
variable: ji(t),
|
|
3502
3552
|
time: e.time,
|
|
3503
3553
|
depth: e.depth,
|
|
3504
3554
|
colorRamp: e.colorRamp,
|
|
@@ -3708,14 +3758,14 @@ class Qi {
|
|
|
3708
3758
|
return;
|
|
3709
3759
|
this.removeWmts();
|
|
3710
3760
|
const e = this.options.sourceConfig, t = e.tileUrlTemplate ? [
|
|
3711
|
-
|
|
3761
|
+
Hi({
|
|
3712
3762
|
template: e.tileUrlTemplate,
|
|
3713
3763
|
tileMatrixSet: e.tileMatrixSet,
|
|
3714
3764
|
style: e.style,
|
|
3715
3765
|
time: this.time,
|
|
3716
3766
|
depth: this.depth,
|
|
3717
3767
|
verticalLabel: this.options.verticalLabel
|
|
3718
|
-
}) ??
|
|
3768
|
+
}) ?? Je({
|
|
3719
3769
|
baseUrl: e.baseUrl ?? new URL(e.capabilitiesUrl).origin,
|
|
3720
3770
|
layer: e.layer,
|
|
3721
3771
|
tileMatrixSet: e.tileMatrixSet ?? "EPSG:3857",
|
|
@@ -3726,7 +3776,7 @@ class Qi {
|
|
|
3726
3776
|
verticalLabel: this.options.verticalLabel
|
|
3727
3777
|
})
|
|
3728
3778
|
] : [
|
|
3729
|
-
|
|
3779
|
+
Je({
|
|
3730
3780
|
baseUrl: e.baseUrl ?? new URL(e.capabilitiesUrl).origin,
|
|
3731
3781
|
layer: e.layer,
|
|
3732
3782
|
tileMatrixSet: e.tileMatrixSet ?? "EPSG:3857",
|
|
@@ -3760,7 +3810,7 @@ class Qi {
|
|
|
3760
3810
|
min: 0,
|
|
3761
3811
|
max: 0,
|
|
3762
3812
|
unit: this.options.unit ?? "",
|
|
3763
|
-
time:
|
|
3813
|
+
time: $e(this.time),
|
|
3764
3814
|
depth: this.depth
|
|
3765
3815
|
}), this.emit("status", { phase: "ready", time: e });
|
|
3766
3816
|
}
|
|
@@ -3779,19 +3829,19 @@ class Qi {
|
|
|
3779
3829
|
return i && this.map?.getLayer(i) ? i : void 0;
|
|
3780
3830
|
}
|
|
3781
3831
|
}
|
|
3782
|
-
function
|
|
3832
|
+
function Pe(s, e) {
|
|
3783
3833
|
return s.match(new RegExp(`\\b${e}=["']([^"']+)["']`, "i"))?.[1].replace(/&/g, "&").replace(/"/g, '"').replace(/'/g, "'");
|
|
3784
3834
|
}
|
|
3785
|
-
function
|
|
3835
|
+
function ta(s, e, t) {
|
|
3786
3836
|
const i = s.replace(/\{TileMatrix\}/gi, "{z}").replace(/\{TileRow\}/gi, "{y}").replace(/\{TileCol\}/gi, "{x}").replace(/\{TileMatrixSet\}/gi, e), a = t == null ? i : i.replace(/\{Style\}/gi, t);
|
|
3787
3837
|
return [...a.matchAll(/\{([^{}]+)\}/g)].some(
|
|
3788
3838
|
(n) => !/^(?:z|y|x|Time|Elevation)$/i.test(n[1])
|
|
3789
3839
|
) ? void 0 : a;
|
|
3790
3840
|
}
|
|
3791
|
-
function
|
|
3841
|
+
function Dt(s) {
|
|
3792
3842
|
return s.replace(/<[^>]+>/g, "").trim();
|
|
3793
3843
|
}
|
|
3794
|
-
function
|
|
3844
|
+
function be(s, e) {
|
|
3795
3845
|
const t = new RegExp(
|
|
3796
3846
|
`<(?:(?:\\w+):)?${e}\\b[^>]*>([\\s\\S]*?)<\\/(?:(?:\\w+):)?${e}>`,
|
|
3797
3847
|
"gi"
|
|
@@ -3799,30 +3849,30 @@ function xe(s, e) {
|
|
|
3799
3849
|
return [...s.matchAll(t)].map((i) => i[1]);
|
|
3800
3850
|
}
|
|
3801
3851
|
function se(s, e) {
|
|
3802
|
-
return
|
|
3852
|
+
return be(s, e).map(Dt).find(Boolean);
|
|
3803
3853
|
}
|
|
3804
|
-
function
|
|
3854
|
+
function et(s, e) {
|
|
3805
3855
|
const t = e.match(
|
|
3806
3856
|
/^P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/
|
|
3807
3857
|
);
|
|
3808
3858
|
if (!t || !t.slice(1).some((m) => Number(m) > 0))
|
|
3809
3859
|
return;
|
|
3810
|
-
const i = new Date(s), a = i.getUTCFullYear() + Number(t[1] ?? 0), r = i.getUTCMonth() + Number(t[2] ?? 0), n = i.getUTCDate(), o = i.getUTCHours(), c = i.getUTCMinutes(),
|
|
3811
|
-
Date.UTC(a, r, 1, o, c,
|
|
3860
|
+
const i = new Date(s), a = i.getUTCFullYear() + Number(t[1] ?? 0), r = i.getUTCMonth() + Number(t[2] ?? 0), n = i.getUTCDate(), o = i.getUTCHours(), c = i.getUTCMinutes(), d = i.getUTCSeconds(), l = i.getUTCMilliseconds(), u = new Date(
|
|
3861
|
+
Date.UTC(a, r, 1, o, c, d, l)
|
|
3812
3862
|
), f = new Date(
|
|
3813
|
-
Date.UTC(
|
|
3863
|
+
Date.UTC(u.getUTCFullYear(), u.getUTCMonth() + 1, 0)
|
|
3814
3864
|
).getUTCDate();
|
|
3815
|
-
return
|
|
3865
|
+
return u.setUTCDate(Math.min(n, f)), u.setUTCDate(u.getUTCDate() + Number(t[3] ?? 0)), u.setUTCHours(u.getUTCHours() + Number(t[4] ?? 0)), u.setUTCMinutes(u.getUTCMinutes() + Number(t[5] ?? 0)), u.setUTCSeconds(u.getUTCSeconds() + Number(t[6] ?? 0)), u.getTime();
|
|
3816
3866
|
}
|
|
3817
|
-
function
|
|
3867
|
+
function ia(s) {
|
|
3818
3868
|
const e = [];
|
|
3819
3869
|
for (const t of s.flatMap((i) => i.split(","))) {
|
|
3820
3870
|
const i = t.trim().split("/");
|
|
3821
3871
|
if (i.length === 3) {
|
|
3822
|
-
const r = Date.parse(i[0]), n = Date.parse(i[1]), o =
|
|
3872
|
+
const r = Date.parse(i[0]), n = Date.parse(i[1]), o = et(r, i[2]);
|
|
3823
3873
|
if (Number.isFinite(r) && Number.isFinite(n) && o && o > r)
|
|
3824
|
-
for (let c = r,
|
|
3825
|
-
e.push(c), c =
|
|
3874
|
+
for (let c = r, d = 0; c <= n && d < 1e5; d += 1)
|
|
3875
|
+
e.push(c), c = et(c, i[2]);
|
|
3826
3876
|
continue;
|
|
3827
3877
|
}
|
|
3828
3878
|
const a = Date.parse(t.trim());
|
|
@@ -3830,14 +3880,14 @@ function Ji(s) {
|
|
|
3830
3880
|
}
|
|
3831
3881
|
return [...new Set(e)].sort((t, i) => t - i);
|
|
3832
3882
|
}
|
|
3833
|
-
function
|
|
3834
|
-
for (const t of
|
|
3883
|
+
function tt(s, e) {
|
|
3884
|
+
for (const t of be(s, "Dimension"))
|
|
3835
3885
|
if (se(t, "Identifier")?.toLowerCase() === e.toLowerCase())
|
|
3836
|
-
return
|
|
3886
|
+
return be(t, "Value").map(Dt);
|
|
3837
3887
|
return [];
|
|
3838
3888
|
}
|
|
3839
|
-
function
|
|
3840
|
-
const t =
|
|
3889
|
+
function aa(s, e) {
|
|
3890
|
+
const t = be(s, "Layer").find(
|
|
3841
3891
|
(h) => se(h, "Identifier") === e.layer
|
|
3842
3892
|
);
|
|
3843
3893
|
if (!t)
|
|
@@ -3845,7 +3895,7 @@ function ea(s, e) {
|
|
|
3845
3895
|
const i = e.tileMatrixSet ?? se(t, "TileMatrixSet") ?? "";
|
|
3846
3896
|
if (!/3857|GoogleMapsCompatible/i.test(i))
|
|
3847
3897
|
throw new Error(`Unsupported WMTS tile matrix set: ${i || "missing"}`);
|
|
3848
|
-
const a =
|
|
3898
|
+
const a = ia(tt(t, "time")), r = a.length ? {
|
|
3849
3899
|
min: a[0],
|
|
3850
3900
|
max: a[a.length - 1],
|
|
3851
3901
|
size: a.length,
|
|
@@ -3854,22 +3904,22 @@ function ea(s, e) {
|
|
|
3854
3904
|
step: a.length > 1 && a.every(
|
|
3855
3905
|
(h, g) => g === 0 || h - a[g - 1] === a[1] - a[0]
|
|
3856
3906
|
) ? a[1] - a[0] : void 0
|
|
3857
|
-
} : { min: 0, max: 0, size: 1, values: [0], units: "static" }, n =
|
|
3907
|
+
} : { min: 0, max: 0, size: 1, values: [0], units: "static" }, n = tt(t, "elevation").flatMap((h) => h.split(",")).map(Number).filter(Number.isFinite), o = n.length ? { name: "elevation", label: "elevation", values: n } : null, c = s.match(
|
|
3858
3908
|
/GetTile[\s\S]*?(?:xlink:href|href)=["']([^"']+)/i
|
|
3859
3909
|
)?.[1], l = [
|
|
3860
3910
|
...t.matchAll(/<(?:(?:\w+):)?ResourceURL\b([^>]*)\/?\s*>/gi)
|
|
3861
3911
|
].find(
|
|
3862
|
-
(h) =>
|
|
3863
|
-
),
|
|
3912
|
+
(h) => Pe(h[1], "resourceType")?.toLowerCase() === "tile"
|
|
3913
|
+
), u = l ? Pe(l[1], "template") : void 0, f = [
|
|
3864
3914
|
...t.matchAll(
|
|
3865
3915
|
/<(?:(?:\w+):)?Style\b([^>]*)>([\s\S]*?)<\/(?:(?:\w+):)?Style>/gi
|
|
3866
3916
|
)
|
|
3867
3917
|
], m = f.find(
|
|
3868
|
-
(h) =>
|
|
3918
|
+
(h) => Pe(h[1], "isDefault")?.toLowerCase() === "true"
|
|
3869
3919
|
), p = e.style ?? se(m?.[2] ?? f[0]?.[2] ?? "", "Identifier");
|
|
3870
3920
|
return {
|
|
3871
3921
|
baseUrl: e.baseUrl ?? c ?? new URL(e.capabilitiesUrl).origin,
|
|
3872
|
-
tileUrlTemplate: e.tileUrlTemplate ?? (
|
|
3922
|
+
tileUrlTemplate: e.tileUrlTemplate ?? (u ? ta(u, i, p) : void 0),
|
|
3873
3923
|
tileMatrixSet: i,
|
|
3874
3924
|
format: e.format ?? se(t, "Format") ?? "image/png",
|
|
3875
3925
|
style: p,
|
|
@@ -3877,15 +3927,15 @@ function ea(s, e) {
|
|
|
3877
3927
|
vertical: o
|
|
3878
3928
|
};
|
|
3879
3929
|
}
|
|
3880
|
-
async function
|
|
3930
|
+
async function sa(s, e) {
|
|
3881
3931
|
const t = await fetch(s.capabilitiesUrl, { signal: e });
|
|
3882
3932
|
if (!t.ok)
|
|
3883
3933
|
throw new Error(
|
|
3884
3934
|
`WMTS capabilities request failed (${t.status}): ${s.capabilitiesUrl}`
|
|
3885
3935
|
);
|
|
3886
|
-
return
|
|
3936
|
+
return aa(await t.text(), s);
|
|
3887
3937
|
}
|
|
3888
|
-
const
|
|
3938
|
+
const ra = [
|
|
3889
3939
|
0.25,
|
|
3890
3940
|
0.5,
|
|
3891
3941
|
1,
|
|
@@ -3894,8 +3944,8 @@ const ia = [
|
|
|
3894
3944
|
8,
|
|
3895
3945
|
16,
|
|
3896
3946
|
32
|
|
3897
|
-
],
|
|
3898
|
-
function
|
|
3947
|
+
], it = [0.25, 0.5, 1, 2];
|
|
3948
|
+
function at(s, e) {
|
|
3899
3949
|
if (s.length === 0)
|
|
3900
3950
|
return e;
|
|
3901
3951
|
let t = s[0], i;
|
|
@@ -3903,7 +3953,7 @@ function it(s, e) {
|
|
|
3903
3953
|
a < t && (t = a), a <= e && (i === void 0 || a > i) && (i = a);
|
|
3904
3954
|
return i ?? t;
|
|
3905
3955
|
}
|
|
3906
|
-
function
|
|
3956
|
+
function na(s) {
|
|
3907
3957
|
const e = s.map((n) => new Date(n)), t = (n) => n.every((o) => e.every((c) => o(c) === o(e[0]))), i = [
|
|
3908
3958
|
(n) => n.getUTCHours(),
|
|
3909
3959
|
(n) => n.getUTCMinutes(),
|
|
@@ -3924,7 +3974,7 @@ function aa(s) {
|
|
|
3924
3974
|
const r = a.getUTCHours() === 0 && a.getUTCMinutes() === 0 && a.getUTCSeconds() === 0 && a.getUTCMilliseconds() === 0;
|
|
3925
3975
|
return r && a.getUTCMonth() === 0 && a.getUTCDate() === 1 ? "year" : r && a.getUTCDate() === 1 ? "month" : r ? "day" : a.getUTCMinutes() === 0 && a.getUTCSeconds() === 0 && a.getUTCMilliseconds() === 0 ? "hour" : a.getUTCSeconds() === 0 && a.getUTCMilliseconds() === 0 ? "minute" : "second";
|
|
3926
3976
|
}
|
|
3927
|
-
function
|
|
3977
|
+
function At(s) {
|
|
3928
3978
|
if (s.length < 2)
|
|
3929
3979
|
return;
|
|
3930
3980
|
const e = s[1] - s[0];
|
|
@@ -3933,7 +3983,7 @@ function Lt(s) {
|
|
|
3933
3983
|
) ? e : void 0;
|
|
3934
3984
|
}
|
|
3935
3985
|
function re(s, e) {
|
|
3936
|
-
return e ?
|
|
3986
|
+
return e ? xt(e, [
|
|
3937
3987
|
s.values[0],
|
|
3938
3988
|
s.values[s.values.length - 1]
|
|
3939
3989
|
]) : null;
|
|
@@ -3952,11 +4002,11 @@ function ne(s, e) {
|
|
|
3952
4002
|
min: r[0],
|
|
3953
4003
|
max: r[r.length - 1],
|
|
3954
4004
|
size: r.length,
|
|
3955
|
-
step:
|
|
4005
|
+
step: At(r),
|
|
3956
4006
|
values: r
|
|
3957
4007
|
};
|
|
3958
4008
|
}
|
|
3959
|
-
function
|
|
4009
|
+
function st(s, e) {
|
|
3960
4010
|
const { start: t, end: i } = s.temporal ?? {};
|
|
3961
4011
|
return t || i ? ne(e, { start: t, end: i }) : e;
|
|
3962
4012
|
}
|
|
@@ -3966,18 +4016,18 @@ function fe(s) {
|
|
|
3966
4016
|
s.variables.derivation.magnitude_variable
|
|
3967
4017
|
] : [s.variables.u ?? "uo", s.variables.v ?? "vo"];
|
|
3968
4018
|
}
|
|
3969
|
-
function
|
|
3970
|
-
const t = s.sources.filter(
|
|
4019
|
+
function Ee(s, e) {
|
|
4020
|
+
const t = s.sources.filter(Fe);
|
|
3971
4021
|
return t.find((i) => i.id === e) ?? (e === "geovideo" || e === "auto" ? t[0] : void 0);
|
|
3972
4022
|
}
|
|
3973
|
-
function
|
|
4023
|
+
function Ct(s) {
|
|
3974
4024
|
return [...s].sort((e, t) => {
|
|
3975
4025
|
const i = Math.abs(e), a = Math.abs(t);
|
|
3976
4026
|
return i !== a ? i - a : t - e;
|
|
3977
4027
|
});
|
|
3978
4028
|
}
|
|
3979
|
-
function
|
|
3980
|
-
return s?.values.length ? e == null ?
|
|
4029
|
+
function Le(s, e) {
|
|
4030
|
+
return s?.values.length ? e == null ? Ct(s.values)[0] : V(s.values, e) : e ?? 0;
|
|
3981
4031
|
}
|
|
3982
4032
|
function V(s, e) {
|
|
3983
4033
|
if (s.length === 0)
|
|
@@ -3989,7 +4039,7 @@ function V(s, e) {
|
|
|
3989
4039
|
}
|
|
3990
4040
|
return t;
|
|
3991
4041
|
}
|
|
3992
|
-
function
|
|
4042
|
+
function rt(s) {
|
|
3993
4043
|
for (const [e, t] of [
|
|
3994
4044
|
[s?.playbackRate, "Playback rate"],
|
|
3995
4045
|
[s?.stepsPerSecond, "Steps per second"]
|
|
@@ -3997,14 +4047,14 @@ function st(s) {
|
|
|
3997
4047
|
if (e != null && (!Number.isFinite(e) || e <= 0))
|
|
3998
4048
|
throw new Error(`${t} must be positive`);
|
|
3999
4049
|
}
|
|
4000
|
-
function
|
|
4050
|
+
function nt(s, e) {
|
|
4001
4051
|
const t = s.surface?.value ?? 0, i = V(
|
|
4002
4052
|
[t, ...s.depths.map((a) => a.value)],
|
|
4003
4053
|
e
|
|
4004
4054
|
);
|
|
4005
4055
|
return i === t ? null : i;
|
|
4006
4056
|
}
|
|
4007
|
-
function
|
|
4057
|
+
function oa(s) {
|
|
4008
4058
|
const e = s.surface ?? s.depths[0];
|
|
4009
4059
|
return {
|
|
4010
4060
|
name: e.name,
|
|
@@ -4016,24 +4066,24 @@ function sa(s) {
|
|
|
4016
4066
|
]
|
|
4017
4067
|
};
|
|
4018
4068
|
}
|
|
4019
|
-
function
|
|
4069
|
+
function ot(s, e) {
|
|
4020
4070
|
return JSON.stringify([
|
|
4021
4071
|
s?.values ?? null,
|
|
4022
4072
|
e ? [e.name, e.units, e.values] : null
|
|
4023
4073
|
]);
|
|
4024
4074
|
}
|
|
4025
|
-
function
|
|
4075
|
+
function la(s) {
|
|
4026
4076
|
const e = [...new Set(s)].sort((t, i) => t - i);
|
|
4027
4077
|
return {
|
|
4028
4078
|
min: e[0],
|
|
4029
4079
|
max: e[e.length - 1],
|
|
4030
|
-
step:
|
|
4080
|
+
step: At(e),
|
|
4031
4081
|
size: e.length,
|
|
4032
4082
|
units: "milliseconds since 1970-01-01T00:00:00Z",
|
|
4033
4083
|
values: e
|
|
4034
4084
|
};
|
|
4035
4085
|
}
|
|
4036
|
-
const
|
|
4086
|
+
const ca = 5 * 6e4, ha = 6e4, lt = 6;
|
|
4037
4087
|
function pe(s) {
|
|
4038
4088
|
const { particles: e = {}, raster: t = {} } = s, i = {
|
|
4039
4089
|
palette: s.palette,
|
|
@@ -4043,7 +4093,7 @@ function pe(s) {
|
|
|
4043
4093
|
speed: e.speed,
|
|
4044
4094
|
fade: e.fade,
|
|
4045
4095
|
glow: e.glow,
|
|
4046
|
-
colorGrade: e.grade === void 0 ? void 0 :
|
|
4096
|
+
colorGrade: e.grade === void 0 ? void 0 : fi(e.grade),
|
|
4047
4097
|
opacity: t.opacity,
|
|
4048
4098
|
logScale: t.logScale,
|
|
4049
4099
|
vibrance: t.vibrance,
|
|
@@ -4057,29 +4107,29 @@ function pe(s) {
|
|
|
4057
4107
|
Object.entries(i).filter(([, a]) => a !== void 0)
|
|
4058
4108
|
);
|
|
4059
4109
|
}
|
|
4060
|
-
function
|
|
4110
|
+
function Ve(s) {
|
|
4061
4111
|
const e = s.alphaFadeLow ?? 0, t = s.alphaFadeHigh ?? 0;
|
|
4062
4112
|
return e > 0 || t > 0 ? { low: e, high: t, curve: s.alphaFadeCurve ?? "linear" } : void 0;
|
|
4063
4113
|
}
|
|
4064
|
-
const
|
|
4065
|
-
|
|
4066
|
-
),
|
|
4067
|
-
function
|
|
4068
|
-
return typeof s != "string" ||
|
|
4069
|
-
`[zartigl] palette "${s}" is not in this version: drawn with "${
|
|
4070
|
-
)),
|
|
4114
|
+
const ct = "rdylbu", ua = new Set(
|
|
4115
|
+
_t({ includeDeprecated: !0 }).map((s) => s.id)
|
|
4116
|
+
), ht = /* @__PURE__ */ new Set();
|
|
4117
|
+
function Ne(s) {
|
|
4118
|
+
return typeof s != "string" || ua.has(s) ? s : (ht.has(s) || (ht.add(s), console.warn(
|
|
4119
|
+
`[zartigl] palette "${s}" is not in this version: drawn with "${ct}"`
|
|
4120
|
+
)), ct);
|
|
4071
4121
|
}
|
|
4072
|
-
function
|
|
4073
|
-
const { reversePalette: e } = s, t =
|
|
4074
|
-
return t != null && (e || i) ?
|
|
4122
|
+
function De(s) {
|
|
4123
|
+
const { reversePalette: e } = s, t = Ne(s.palette), i = Ve(s);
|
|
4124
|
+
return t != null && (e || i) ? ke(t, { reverse: e, alphaFade: i }) : t;
|
|
4075
4125
|
}
|
|
4076
|
-
const
|
|
4126
|
+
const da = [
|
|
4077
4127
|
"palette",
|
|
4078
4128
|
"reversePalette",
|
|
4079
4129
|
"alphaFadeLow",
|
|
4080
4130
|
"alphaFadeHigh",
|
|
4081
4131
|
"alphaFadeCurve"
|
|
4082
|
-
],
|
|
4132
|
+
], kt = Object.freeze({
|
|
4083
4133
|
palette: "style.palette",
|
|
4084
4134
|
renderMode: "style.renderMode",
|
|
4085
4135
|
particleDensity: "style.particles.density",
|
|
@@ -4092,7 +4142,7 @@ const ca = [
|
|
|
4092
4142
|
colorDomain: "style.raster.colorDomain",
|
|
4093
4143
|
backdrop: "style.particles.backdrop"
|
|
4094
4144
|
});
|
|
4095
|
-
function
|
|
4145
|
+
function Ae(s) {
|
|
4096
4146
|
const {
|
|
4097
4147
|
palette: e,
|
|
4098
4148
|
renderMode: t,
|
|
@@ -4102,12 +4152,12 @@ function De(s) {
|
|
|
4102
4152
|
colorGrade: n,
|
|
4103
4153
|
opacity: o,
|
|
4104
4154
|
logScale: c,
|
|
4105
|
-
vibrance:
|
|
4155
|
+
vibrance: d,
|
|
4106
4156
|
colorDomain: l,
|
|
4107
|
-
backdrop:
|
|
4157
|
+
backdrop: u,
|
|
4108
4158
|
...f
|
|
4109
4159
|
} = s ?? {}, m = Object.keys(s ?? {}).filter(
|
|
4110
|
-
(h) => h in
|
|
4160
|
+
(h) => h in kt && s[h] !== void 0
|
|
4111
4161
|
);
|
|
4112
4162
|
return {
|
|
4113
4163
|
style: ae({
|
|
@@ -4117,47 +4167,47 @@ function De(s) {
|
|
|
4117
4167
|
density: i,
|
|
4118
4168
|
speed: a,
|
|
4119
4169
|
fade: r,
|
|
4120
|
-
grade: n &&
|
|
4121
|
-
backdrop:
|
|
4170
|
+
grade: n && mi(n),
|
|
4171
|
+
backdrop: u
|
|
4122
4172
|
},
|
|
4123
|
-
raster: { opacity: o, logScale: c, vibrance:
|
|
4173
|
+
raster: { opacity: o, logScale: c, vibrance: d, colorDomain: l }
|
|
4124
4174
|
}),
|
|
4125
4175
|
settings: e === void 0 || typeof e == "string" ? f : { ...f, palette: e },
|
|
4126
4176
|
legacyKeys: m
|
|
4127
4177
|
};
|
|
4128
4178
|
}
|
|
4129
|
-
const
|
|
4130
|
-
function
|
|
4179
|
+
const ut = /* @__PURE__ */ new Set();
|
|
4180
|
+
function dt(s) {
|
|
4131
4181
|
for (const e of s)
|
|
4132
|
-
|
|
4133
|
-
`[zartigl] settings.${e} is deprecated: use ${
|
|
4182
|
+
ut.has(e) || (ut.add(e), console.warn(
|
|
4183
|
+
`[zartigl] settings.${e} is deprecated: use ${kt[e]}`
|
|
4134
4184
|
));
|
|
4135
4185
|
}
|
|
4136
|
-
function
|
|
4137
|
-
const t =
|
|
4186
|
+
function Ft(s, e) {
|
|
4187
|
+
const t = ze(s, e);
|
|
4138
4188
|
return {
|
|
4139
4189
|
...pe(t),
|
|
4140
4190
|
palette: t.palette ?? "rdylbu",
|
|
4141
4191
|
colorDomain: Q(t.raster.colorDomain)
|
|
4142
4192
|
};
|
|
4143
4193
|
}
|
|
4144
|
-
function
|
|
4194
|
+
function ma(s) {
|
|
4145
4195
|
return {
|
|
4146
|
-
...
|
|
4196
|
+
...Ft(s),
|
|
4147
4197
|
particleState: "auto",
|
|
4148
4198
|
rgba8MaxParticleZoom: 4
|
|
4149
4199
|
};
|
|
4150
4200
|
}
|
|
4151
|
-
function
|
|
4201
|
+
function fa(s) {
|
|
4152
4202
|
const { palette: e, ...t } = s;
|
|
4153
4203
|
return t;
|
|
4154
4204
|
}
|
|
4155
|
-
function
|
|
4156
|
-
s !== void 0 &&
|
|
4205
|
+
function mt(s, e, t) {
|
|
4206
|
+
s !== void 0 && ft(s, "style", {
|
|
4157
4207
|
kind: e.layers.find((i) => i.id === t)?.kind
|
|
4158
4208
|
});
|
|
4159
4209
|
}
|
|
4160
|
-
class
|
|
4210
|
+
class Da {
|
|
4161
4211
|
constructor(e) {
|
|
4162
4212
|
if (this.fullTimeMeta = null, this.autoplayPending = !0, this.playing = !1, this.catalogLayer = null, this.catalogSource = null, this.layer = null, this.time = 0, this.pendingTime = null, this.requestedTime = null, this.playbackIntent = 0, this.requestSeq = 0, this.playSeq = 0, this.depth = 0, this.depthRequest = null, this.failedGeoVideo = /* @__PURE__ */ new Set(), this.lastMeta = null, this.timeMeta = null, this.resolvedTimeRange = null, this.verticalMeta = null, this.variableUnit = "", this.geoVideoManifest = null, this.wmtsMetadata = null, this.fieldSources = /* @__PURE__ */ new Map(), this.archiveChunks = /* @__PURE__ */ new Map(), this.chunkTimes = /* @__PURE__ */ new Map(), this.archiveRoots = /* @__PURE__ */ new Map(), this.archiveLevel = null, this.depthLocked = !1, this.chunkLevels = /* @__PURE__ */ new Map(), this.nextChunkManifest = null, this.activeFieldSource = null, this.switchGeneration = 0, this.destroyed = !1, this.initialized = !1, this.initStarted = !1, this.updateQueue = Promise.resolve(), this.suspended = !1, this.attachQueued = !1, this.anchor = null, this.querySources = /* @__PURE__ */ new Map(), this.listeners = /* @__PURE__ */ new Map(), this.onMapReady = () => {
|
|
4163
4213
|
this.attachQueued && this.attachWhenReady();
|
|
@@ -4165,9 +4215,9 @@ class Pa {
|
|
|
4165
4215
|
throw new Error("Zartigl requires a layer UUID");
|
|
4166
4216
|
if (e.time != null && z(e.time, "time"), e.depth != null && !Number.isFinite(e.depth))
|
|
4167
4217
|
throw new Error("Depth must be finite");
|
|
4168
|
-
|
|
4169
|
-
const t =
|
|
4170
|
-
|
|
4218
|
+
rt(e.geoVideo), this.id = e.id ?? "zartigl", this.map = e.map, this.catalog = e.catalog, this.initialLayer = e.layer, this.initialTime = e.time, this.initialDepth = e.depth, this.depthRequest = e.depth ?? null, this.sourcePreference = e.source ?? "auto", this.timeRange = e.timeRange ? { ...e.timeRange } : void 0, this.autoplay = e.geoVideo?.autoplay ?? !0, this.loop = e.geoVideo?.loop ?? !0, this.playbackRate = e.geoVideo?.playbackRate ?? 1, this.stepsPerSecond = e.geoVideo?.stepsPerSecond ?? null, this.metadata = e.metadata ? { ...e.metadata } : void 0, this.before = e.before, this.visible = e.visible ?? !0;
|
|
4219
|
+
const t = Ae(e.settings);
|
|
4220
|
+
dt(t.legacyKeys), this.style = ae(t.style, e.style), mt(this.style, e.catalog, e.layer), this.settings = { ...t.settings, ...pe(this.style) }, this.settings.colorDomain !== void 0 && (this.settings.colorDomain = Q(
|
|
4171
4221
|
this.settings.colorDomain
|
|
4172
4222
|
)), this.colorDomainOverridden = this.settings.colorDomain !== void 0, this.paletteOverridden = this.settings.palette !== void 0, this.map.on("load", this.onMapReady), this.map.on("styledata", this.onMapReady), this.map.on("idle", this.onMapReady);
|
|
4173
4223
|
}
|
|
@@ -4184,16 +4234,16 @@ class Pa {
|
|
|
4184
4234
|
}
|
|
4185
4235
|
async update(e) {
|
|
4186
4236
|
this.assertAlive();
|
|
4187
|
-
const t =
|
|
4188
|
-
|
|
4237
|
+
const t = Ae(e.settings);
|
|
4238
|
+
dt(t.legacyKeys);
|
|
4189
4239
|
const i = t.legacyKeys.length ? { ...e, settings: t.settings, stylePatch: t.style } : e;
|
|
4190
4240
|
if (!this.initialized)
|
|
4191
4241
|
throw new Error("Call init() before update()");
|
|
4192
4242
|
if (i.depth != null && !Number.isFinite(i.depth))
|
|
4193
4243
|
throw new Error("Depth must be finite");
|
|
4194
|
-
i.time != null && z(i.time, "time"),
|
|
4244
|
+
i.time != null && z(i.time, "time"), rt(i.geoVideo), i.settings?.colorDomain !== void 0 && Q(i.settings.colorDomain);
|
|
4195
4245
|
for (const a of [i.style, i.stylePatch])
|
|
4196
|
-
a !== void 0 &&
|
|
4246
|
+
a !== void 0 && ft(a, "style");
|
|
4197
4247
|
return i.time != null && this.pause(), this.enqueue(i, ++this.requestSeq);
|
|
4198
4248
|
}
|
|
4199
4249
|
/**
|
|
@@ -4215,9 +4265,9 @@ class Pa {
|
|
|
4215
4265
|
}
|
|
4216
4266
|
async applyUpdate(e, t, i) {
|
|
4217
4267
|
this.assertAlive(), i != null && e.time != null && this.playSeq !== 0 && this.playSeq < i && this.pause();
|
|
4218
|
-
const a = e.layer != null && e.layer !== this.catalogLayer?.id, r = e.source != null && (a || e.source !== this.sourcePreference), n = !a && e.source === "auto" && this.sourcePreference === "auto", o = { time: e.time, depth: e.depth }, c = a ? e.layer : this.catalogLayer?.id,
|
|
4219
|
-
|
|
4220
|
-
const f =
|
|
4268
|
+
const a = e.layer != null && e.layer !== this.catalogLayer?.id, r = e.source != null && (a || e.source !== this.sourcePreference), n = !a && e.source === "auto" && this.sourcePreference === "auto", o = { time: e.time, depth: e.depth }, c = a ? e.layer : this.catalogLayer?.id, d = e.stylePatch === void 0 ? e.style : e.style === void 0 ? ae(this.style, e.stylePatch) : ae(e.stylePatch, e.style), l = e.settings?.palette, u = d !== void 0 && l !== void 0 && typeof l != "string" && e.style?.palette === void 0 ? fa(d) : d;
|
|
4269
|
+
mt(u, this.catalog, c);
|
|
4270
|
+
const f = u ?? (a ? pt(
|
|
4221
4271
|
this.style,
|
|
4222
4272
|
this.catalog.layers.find((m) => m.id === c)?.kind
|
|
4223
4273
|
) : void 0);
|
|
@@ -4266,10 +4316,10 @@ class Pa {
|
|
|
4266
4316
|
e.geoVideo && (e.geoVideo.autoplay != null && (this.autoplay = e.geoVideo.autoplay, this.catalogSource?.type === "geovideo" && (this.autoplay ? await this.startPlayback(i ?? ++this.requestSeq) : this.pause())), e.geoVideo.loop != null && this.applyLoop(e.geoVideo.loop), e.geoVideo.stepsPerSecond != null ? (this.stepsPerSecond = e.geoVideo.stepsPerSecond, this.applyPlaybackSpeed()) : e.geoVideo.playbackRate != null && this.applyPlaybackRate(e.geoVideo.playbackRate)), e.time != null && e.depth != null ? this.applyTimeAndDepth(e.time, e.depth) : (e.time != null && this.applyTime(e.time), e.depth != null && this.applyDepth(e.depth)), e.time != null && this.requestedTime === z(e.time, "time") && (this.requestedTime = null), e.visible != null && this.applyVisible(e.visible);
|
|
4267
4317
|
}
|
|
4268
4318
|
async loadLayer(e, t = this.sourcePreference, i, a) {
|
|
4269
|
-
const r = this.getSource(), n =
|
|
4319
|
+
const r = this.getSource(), n = ot(this.timeMeta, this.verticalMeta);
|
|
4270
4320
|
await this.loadSource(e, t, i, a);
|
|
4271
4321
|
const o = this.getSource();
|
|
4272
|
-
o && (o.id !== r?.id || o.type !== r?.type) ? this.emit("sourceChange", o) :
|
|
4322
|
+
o && (o.id !== r?.id || o.type !== r?.type) ? this.emit("sourceChange", o) : ot(this.timeMeta, this.verticalMeta) !== n && this.emit("axesChange");
|
|
4273
4323
|
}
|
|
4274
4324
|
async loadSource(e, t, i, a) {
|
|
4275
4325
|
this.assertAlive();
|
|
@@ -4278,15 +4328,15 @@ class Pa {
|
|
|
4278
4328
|
);
|
|
4279
4329
|
if (!r)
|
|
4280
4330
|
throw new Error(`Unknown zartigl catalog entry: ${e}`);
|
|
4281
|
-
const n =
|
|
4331
|
+
const n = ma(r), o = i ? i.timeRange : this.timeRange, c = a ?? ++this.switchGeneration, d = {
|
|
4282
4332
|
...i?.target,
|
|
4283
4333
|
depth: i?.target?.depth ?? this.depthRequest ?? void 0
|
|
4284
4334
|
}, l = await this.selectSource(
|
|
4285
4335
|
r,
|
|
4286
4336
|
t,
|
|
4287
4337
|
o,
|
|
4288
|
-
|
|
4289
|
-
),
|
|
4338
|
+
d
|
|
4339
|
+
), u = i?.settings ?? this.settings, f = i?.colorDomainOverridden ?? this.colorDomainOverridden, m = i?.paletteOverridden ?? this.paletteOverridden;
|
|
4290
4340
|
if (l.type === "geovideo") {
|
|
4291
4341
|
this.emit("status", { phase: "metadata" });
|
|
4292
4342
|
try {
|
|
@@ -4303,18 +4353,18 @@ class Pa {
|
|
|
4303
4353
|
throw new Error(
|
|
4304
4354
|
`GeoVideo manifest identity does not match catalog entry/source: ${l.id}`
|
|
4305
4355
|
);
|
|
4306
|
-
const S =
|
|
4307
|
-
if (S && (R ? !
|
|
4356
|
+
const S = Ee(r, l.id), R = S ? this.chunkLevels.get(l.manifestUrl) ?? null : null, E = v.vertical;
|
|
4357
|
+
if (S && (R ? !He(E, R) : E !== void 0))
|
|
4308
4358
|
throw new Error(
|
|
4309
4359
|
`GeoVideo manifest level does not match its index: ${l.manifestUrl}`
|
|
4310
4360
|
);
|
|
4311
|
-
const k = R?.value ?? null, F = S ? await this.archiveTimes(r, l.id, k) : null, P = S ? await this.archiveLevels(r, S) : null, L = !!P?.depths.length, b = !L && !!P?.surface, A = L || b ?
|
|
4361
|
+
const k = R?.value ?? null, F = S ? await this.archiveTimes(r, l.id, k) : null, P = S ? await this.archiveLevels(r, S) : null, L = !!P?.depths.length, b = !L && !!P?.surface, A = L || b ? oa(P) : null;
|
|
4312
4362
|
if (c !== this.switchGeneration)
|
|
4313
4363
|
throw new DOMException(
|
|
4314
4364
|
"Layer selection was superseded",
|
|
4315
4365
|
"AbortError"
|
|
4316
4366
|
);
|
|
4317
|
-
const N =
|
|
4367
|
+
const N = we(v), C = la(F ?? N), I = re(
|
|
4318
4368
|
C,
|
|
4319
4369
|
o
|
|
4320
4370
|
), w = ne(
|
|
@@ -4323,9 +4373,9 @@ class Pa {
|
|
|
4323
4373
|
), U = N.filter(
|
|
4324
4374
|
(ce) => ce >= w.min && ce <= w.max
|
|
4325
4375
|
), X = U.length ? U : N, oe = this.catalogLayer?.id === r.id && this.catalogSource?.type === "geovideo", le = this.settings.palette;
|
|
4326
|
-
this.catalogLayer = r, this.catalogSource = l, this.sourcePreference = t, this.timeRange = o, this.activeFieldSource = null, this.geoVideoManifest = v, this.wmtsMetadata = null, this.fullTimeMeta = C, this.resolvedTimeRange = I, this.timeMeta = w, this.verticalMeta = A, this.variableUnit = v.style.unit ?? "", this.variableStandardName = v.provenance.variables[0], this.time = this.pendingTime == null ? X[0] : V(X, this.pendingTime), this.pendingTime = null, this.depthLocked = b, this.archiveLevel = k, this.depth = L ? k ?? P.surface?.value ?? 0 :
|
|
4327
|
-
const
|
|
4328
|
-
if (this.settings = { ...n, ...
|
|
4376
|
+
this.catalogLayer = r, this.catalogSource = l, this.sourcePreference = t, this.timeRange = o, this.activeFieldSource = null, this.geoVideoManifest = v, this.wmtsMetadata = null, this.fullTimeMeta = C, this.resolvedTimeRange = I, this.timeMeta = w, this.verticalMeta = A, this.variableUnit = v.style.unit ?? "", this.variableStandardName = v.provenance.variables[0], this.time = this.pendingTime == null ? X[0] : V(X, this.pendingTime), this.pendingTime = null, this.depthLocked = b, this.archiveLevel = k, this.depth = L ? k ?? P.surface?.value ?? 0 : Le(A, d.depth), L && (this.depthRequest = this.depth);
|
|
4377
|
+
const zt = u.colorDomain;
|
|
4378
|
+
if (this.settings = { ...n, ...u }, this.colorDomainOverridden = f, this.paletteOverridden = m, this.settings.colorDomain = f ? zt ?? null : v.style.colorDomain, this.settings.palette = m ? this.settings.palette : qe(r.defaults).palette ?? v.style.palette, this.lastMeta = null, oe && this.replaceGeoVideoInPlace(le))
|
|
4329
4379
|
return;
|
|
4330
4380
|
this.detach(), this.attachWhenReady();
|
|
4331
4381
|
return;
|
|
@@ -4339,7 +4389,7 @@ class Pa {
|
|
|
4339
4389
|
if (l.type === "wmts") {
|
|
4340
4390
|
this.emit("status", { phase: "metadata" });
|
|
4341
4391
|
try {
|
|
4342
|
-
const v = await
|
|
4392
|
+
const v = await sa(l);
|
|
4343
4393
|
if (c !== this.switchGeneration)
|
|
4344
4394
|
throw new DOMException(
|
|
4345
4395
|
"Layer selection was superseded",
|
|
@@ -4356,7 +4406,7 @@ class Pa {
|
|
|
4356
4406
|
}, this.sourcePreference = t, this.timeRange = o, this.activeFieldSource = null, this.geoVideoManifest = null, this.wmtsMetadata = v, this.fullTimeMeta = _, this.resolvedTimeRange = re(
|
|
4357
4407
|
_,
|
|
4358
4408
|
o
|
|
4359
|
-
), this.timeMeta = S, this.verticalMeta = v.vertical, this.archiveLevel = null, this.depthLocked = !1, this.variableUnit = "", this.variableStandardName = l.layer, this.time = this.pendingTime == null ?
|
|
4409
|
+
), this.timeMeta = S, this.verticalMeta = v.vertical, this.archiveLevel = null, this.depthLocked = !1, this.variableUnit = "", this.variableStandardName = l.layer, this.time = this.pendingTime == null ? at(S.values, Date.now()) : V(S.values, this.pendingTime), this.pendingTime = null, this.depth = Le(v.vertical, d.depth), this.settings = { ...n, ...u }, this.colorDomainOverridden = f, this.paletteOverridden = m, this.lastMeta = null, this.attachWhenReady();
|
|
4360
4410
|
return;
|
|
4361
4411
|
} catch (v) {
|
|
4362
4412
|
const _ = v instanceof Error ? v : new Error(String(v));
|
|
@@ -4374,7 +4424,7 @@ class Pa {
|
|
|
4374
4424
|
throw new Error(
|
|
4375
4425
|
`Configured variable not found in Zarr store: ${_}`
|
|
4376
4426
|
);
|
|
4377
|
-
if (g =
|
|
4427
|
+
if (g = st(
|
|
4378
4428
|
l,
|
|
4379
4429
|
p.getTimeDimension()
|
|
4380
4430
|
), g.values.length === 0)
|
|
@@ -4388,9 +4438,9 @@ class Pa {
|
|
|
4388
4438
|
}
|
|
4389
4439
|
if (c !== this.switchGeneration)
|
|
4390
4440
|
throw new DOMException("Layer selection was superseded", "AbortError");
|
|
4391
|
-
this.detach(), this.catalogLayer = r, this.catalogSource = l, this.sourcePreference = t, this.timeRange = o, this.activeFieldSource = p, this.geoVideoManifest = null, this.wmtsMetadata = null, this.fullTimeMeta = g, this.resolvedTimeRange = x, this.timeMeta = h, this.verticalMeta = T, this.archiveLevel = null, this.depthLocked = !1, this.variableUnit = typeof M.units == "string" ? M.units : "", this.variableStandardName = typeof M.standard_name == "string" ? M.standard_name : void 0, this.time = this.pendingTime == null ?
|
|
4392
|
-
const y =
|
|
4393
|
-
this.settings = { ...n, ...
|
|
4441
|
+
this.detach(), this.catalogLayer = r, this.catalogSource = l, this.sourcePreference = t, this.timeRange = o, this.activeFieldSource = p, this.geoVideoManifest = null, this.wmtsMetadata = null, this.fullTimeMeta = g, this.resolvedTimeRange = x, this.timeMeta = h, this.verticalMeta = T, this.archiveLevel = null, this.depthLocked = !1, this.variableUnit = typeof M.units == "string" ? M.units : "", this.variableStandardName = typeof M.standard_name == "string" ? M.standard_name : void 0, this.time = this.pendingTime == null ? at(this.timeMeta.values, Date.now()) : V(this.timeMeta.values, this.pendingTime), this.pendingTime = null, this.depth = Le(T, d.depth);
|
|
4442
|
+
const y = u.colorDomain;
|
|
4443
|
+
this.settings = { ...n, ...u }, this.colorDomainOverridden = f, this.paletteOverridden = m, this.settings.colorDomain = f ? y ?? null : n.colorDomain ?? null, this.lastMeta = null, this.attachWhenReady();
|
|
4394
4444
|
}
|
|
4395
4445
|
async changeSource(e, t = this.timeRange, i = {}) {
|
|
4396
4446
|
if (this.assertAlive(), !this.catalogLayer) {
|
|
@@ -4414,16 +4464,16 @@ class Pa {
|
|
|
4414
4464
|
const a = this.catalogLayer, r = this.catalogSource;
|
|
4415
4465
|
if (!a || !r || !this.isArchiveChunk(r))
|
|
4416
4466
|
return !1;
|
|
4417
|
-
const n =
|
|
4418
|
-
if ((t.time == null && !i ||
|
|
4467
|
+
const n = Ee(a, this.sourcePreference), o = n ? await this.archiveLevels(a, n) : null, d = !!o?.depths.length && t.depth != null && nt(o, t.depth) !== this.archiveLevel;
|
|
4468
|
+
if ((t.time == null && !i || Gt(r, this.sourceTimeRequest(e, t.time))) && !d)
|
|
4419
4469
|
return !1;
|
|
4420
|
-
const
|
|
4470
|
+
const u = await this.selectSource(
|
|
4421
4471
|
a,
|
|
4422
4472
|
this.sourcePreference,
|
|
4423
4473
|
e,
|
|
4424
4474
|
t
|
|
4425
4475
|
);
|
|
4426
|
-
return !
|
|
4476
|
+
return !ei(u, r);
|
|
4427
4477
|
}
|
|
4428
4478
|
applyVisible(e) {
|
|
4429
4479
|
this.assertAlive(), this.visible !== e && (this.visible = e, e ? this.attachWhenReady() : this.detach());
|
|
@@ -4496,10 +4546,10 @@ class Pa {
|
|
|
4496
4546
|
}
|
|
4497
4547
|
/** Media rate for the loaded artifact: steps per second when set, else the raw multiplier. */
|
|
4498
4548
|
effectivePlaybackRate() {
|
|
4499
|
-
return this.stepsPerSecond != null && this.geoVideoManifest ?
|
|
4549
|
+
return this.stepsPerSecond != null && this.geoVideoManifest ? ti(this.geoVideoManifest, this.stepsPerSecond) : this.playbackRate;
|
|
4500
4550
|
}
|
|
4501
4551
|
playbackSpeeds() {
|
|
4502
|
-
return this.catalogLayer?.kind === "vector" ?
|
|
4552
|
+
return this.catalogLayer?.kind === "vector" ? it : ra;
|
|
4503
4553
|
}
|
|
4504
4554
|
/**
|
|
4505
4555
|
* Steps per second the active source shows. Vector GeoVideo stays inside
|
|
@@ -4507,13 +4557,13 @@ class Pa {
|
|
|
4507
4557
|
*/
|
|
4508
4558
|
appliedStepsPerSecond() {
|
|
4509
4559
|
if (this.catalogLayer?.kind === "vector") {
|
|
4510
|
-
const e =
|
|
4560
|
+
const e = it;
|
|
4511
4561
|
return Math.min(
|
|
4512
4562
|
e[e.length - 1],
|
|
4513
4563
|
Math.max(e[0], this.stepsPerSecond ?? 1)
|
|
4514
4564
|
);
|
|
4515
4565
|
}
|
|
4516
|
-
return this.stepsPerSecond != null ? this.stepsPerSecond : this.geoVideoManifest ? this.playbackRate *
|
|
4566
|
+
return this.stepsPerSecond != null ? this.stepsPerSecond : this.geoVideoManifest ? this.playbackRate * ii(this.geoVideoManifest) : this.playbackRate;
|
|
4517
4567
|
}
|
|
4518
4568
|
/** Apply or clear a time window without rebuilding source metadata or the map layer. */
|
|
4519
4569
|
applyTimeRange(e) {
|
|
@@ -4547,7 +4597,7 @@ class Pa {
|
|
|
4547
4597
|
values: t.values,
|
|
4548
4598
|
units: t.units,
|
|
4549
4599
|
current: this.time,
|
|
4550
|
-
granularity:
|
|
4600
|
+
granularity: na(t.values),
|
|
4551
4601
|
timelineKind: this.geoVideoManifest?.timeline.kind
|
|
4552
4602
|
} : {
|
|
4553
4603
|
min: NaN,
|
|
@@ -4563,7 +4613,7 @@ class Pa {
|
|
|
4563
4613
|
return { values: [], label: "depth", current: void 0 };
|
|
4564
4614
|
const e = this.verticalMeta;
|
|
4565
4615
|
return {
|
|
4566
|
-
values:
|
|
4616
|
+
values: Ct(e.values),
|
|
4567
4617
|
name: e.name,
|
|
4568
4618
|
label: e.label,
|
|
4569
4619
|
units: e.units,
|
|
@@ -4584,7 +4634,7 @@ class Pa {
|
|
|
4584
4634
|
const i = this.catalogSource;
|
|
4585
4635
|
return {
|
|
4586
4636
|
type: "image",
|
|
4587
|
-
url:
|
|
4637
|
+
url: Yi({
|
|
4588
4638
|
baseUrl: i.baseUrl ?? this.wmtsMetadata?.baseUrl ?? new URL(i.capabilitiesUrl).origin,
|
|
4589
4639
|
layer: i.layer,
|
|
4590
4640
|
style: i.style
|
|
@@ -4593,30 +4643,30 @@ class Pa {
|
|
|
4593
4643
|
};
|
|
4594
4644
|
}
|
|
4595
4645
|
if (this.catalogSource.type === "geovideo" && this.geoVideoManifest) {
|
|
4596
|
-
const i = typeof this.settings.palette == "string" ?
|
|
4646
|
+
const i = typeof this.settings.palette == "string" ? Ne(this.settings.palette) : "custom", a = this.settings.colorDomain ?? this.geoVideoManifest.style.colorDomain;
|
|
4597
4647
|
return {
|
|
4598
4648
|
type: "gradient",
|
|
4599
4649
|
palette: i,
|
|
4600
4650
|
reverse: this.settings.reversePalette ?? !1,
|
|
4601
|
-
alphaFade:
|
|
4651
|
+
alphaFade: Ve(this.settings),
|
|
4602
4652
|
min: a[0],
|
|
4603
4653
|
max: a[1],
|
|
4604
|
-
unit:
|
|
4654
|
+
unit: Ye(this.geoVideoManifest.style.unit)
|
|
4605
4655
|
};
|
|
4606
4656
|
}
|
|
4607
|
-
const e = typeof this.settings.palette == "string" ?
|
|
4657
|
+
const e = typeof this.settings.palette == "string" ? Ne(this.settings.palette) : "custom", t = this.catalogLayer.kind === "scalar" ? this.settings.colorDomain : null;
|
|
4608
4658
|
return {
|
|
4609
4659
|
type: "gradient",
|
|
4610
4660
|
palette: e,
|
|
4611
4661
|
reverse: this.settings.reversePalette ?? !1,
|
|
4612
|
-
alphaFade: this.catalogLayer.kind === "scalar" ?
|
|
4662
|
+
alphaFade: this.catalogLayer.kind === "scalar" ? Ve(this.settings) : void 0,
|
|
4613
4663
|
min: t?.[0] ?? this.lastMeta?.min,
|
|
4614
4664
|
max: t?.[1] ?? this.lastMeta?.max,
|
|
4615
|
-
unit:
|
|
4665
|
+
unit: Ye(this.lastMeta?.unit ?? this.variableUnit)
|
|
4616
4666
|
};
|
|
4617
4667
|
}
|
|
4618
4668
|
getPalettes() {
|
|
4619
|
-
return
|
|
4669
|
+
return _t();
|
|
4620
4670
|
}
|
|
4621
4671
|
getSource() {
|
|
4622
4672
|
return this.catalogSource ? { id: this.catalogSource.id, type: this.catalogSource.type } : void 0;
|
|
@@ -4649,7 +4699,7 @@ class Pa {
|
|
|
4649
4699
|
if (e.timeline.kind === "snapshot-loop")
|
|
4650
4700
|
return this.catalogLayer?.kind !== "vector";
|
|
4651
4701
|
const t = this.timeMeta;
|
|
4652
|
-
return
|
|
4702
|
+
return we(e).filter(
|
|
4653
4703
|
(a) => !t || a >= t.min && a <= t.max
|
|
4654
4704
|
).length > 1;
|
|
4655
4705
|
}
|
|
@@ -4662,9 +4712,9 @@ class Pa {
|
|
|
4662
4712
|
* source chose, such as a GeoVideo archive's palette.
|
|
4663
4713
|
*/
|
|
4664
4714
|
getStyle() {
|
|
4665
|
-
return
|
|
4715
|
+
return ze(
|
|
4666
4716
|
this.catalogLayer ?? void 0,
|
|
4667
|
-
|
|
4717
|
+
Ae(this.settings).style
|
|
4668
4718
|
);
|
|
4669
4719
|
}
|
|
4670
4720
|
/** The style override over the layer's own. */
|
|
@@ -4688,7 +4738,7 @@ class Pa {
|
|
|
4688
4738
|
devicePixelRatio: typeof window < "u" ? window.devicePixelRatio : void 0,
|
|
4689
4739
|
catalogEntry: this.catalogLayer ? {
|
|
4690
4740
|
id: this.catalogLayer.id,
|
|
4691
|
-
title:
|
|
4741
|
+
title: Ot(
|
|
4692
4742
|
this.catalogLayer.title,
|
|
4693
4743
|
this.catalog.defaultLocale,
|
|
4694
4744
|
this.catalog.defaultLocale
|
|
@@ -4713,23 +4763,23 @@ class Pa {
|
|
|
4713
4763
|
* color domain of a GeoVideo archive included, as a load sets them.
|
|
4714
4764
|
*/
|
|
4715
4765
|
styledSettings() {
|
|
4716
|
-
const e =
|
|
4766
|
+
const e = Ft(
|
|
4717
4767
|
this.catalogLayer ?? void 0,
|
|
4718
4768
|
this.style
|
|
4719
4769
|
), t = this.catalogSource?.type === "geovideo" ? this.geoVideoManifest : null;
|
|
4720
|
-
return t && this.style.raster?.colorDomain === void 0 && (e.colorDomain = t.style.colorDomain), t && this.style.palette === void 0 && (e.palette =
|
|
4770
|
+
return t && this.style.raster?.colorDomain === void 0 && (e.colorDomain = t.style.colorDomain), t && this.style.palette === void 0 && (e.palette = qe(this.catalogLayer?.defaults)?.palette ?? t.style.palette), e;
|
|
4721
4771
|
}
|
|
4722
4772
|
applySettings(e) {
|
|
4723
4773
|
this.assertAlive();
|
|
4724
4774
|
const t = e.colorDomain === void 0 ? e : {
|
|
4725
4775
|
...e,
|
|
4726
4776
|
colorDomain: Q(e.colorDomain)
|
|
4727
|
-
}, i =
|
|
4777
|
+
}, i = da.some(
|
|
4728
4778
|
(r) => t[r] != null && t[r] !== this.settings[r]
|
|
4729
4779
|
), a = t.particleState != null && t.particleState !== this.settings.particleState;
|
|
4730
4780
|
if (t.colorDomain !== void 0 && (this.colorDomainOverridden = !0), t.palette !== void 0 && (this.paletteOverridden = !0), this.settings = { ...this.settings, ...t }, !!this.layer) {
|
|
4731
4781
|
if (i && this.catalogSource?.type === "geovideo") {
|
|
4732
|
-
this.layer.setColorRamp(
|
|
4782
|
+
this.layer.setColorRamp(De(this.settings)), this.applyMutableSettings(this.layer, t);
|
|
4733
4783
|
return;
|
|
4734
4784
|
}
|
|
4735
4785
|
if (i || a) {
|
|
@@ -4748,7 +4798,7 @@ class Pa {
|
|
|
4748
4798
|
);
|
|
4749
4799
|
const a = Math.max(1, Math.floor(e.maxPoints ?? 512)), r = this.getQuerySource(i.endpoints.pointSeries);
|
|
4750
4800
|
await r.init();
|
|
4751
|
-
const n = r.getTimeDimension().values, o =
|
|
4801
|
+
const n = r.getTimeDimension().values, o = st(
|
|
4752
4802
|
i,
|
|
4753
4803
|
r.getTimeDimension()
|
|
4754
4804
|
);
|
|
@@ -4766,18 +4816,18 @@ class Pa {
|
|
|
4766
4816
|
const c = this.timeRange ? Math.max(
|
|
4767
4817
|
o.min,
|
|
4768
4818
|
this.resolvedTimeRange?.[0] ?? this.timeMeta?.min ?? o.min
|
|
4769
|
-
) : o.min,
|
|
4819
|
+
) : o.min, d = this.timeRange ? Math.min(
|
|
4770
4820
|
o.max,
|
|
4771
4821
|
this.resolvedTimeRange?.[1] ?? this.timeMeta?.max ?? o.max
|
|
4772
4822
|
) : o.max, l = n.findIndex((m) => m >= c);
|
|
4773
|
-
let
|
|
4774
|
-
for (;
|
|
4775
|
-
|
|
4776
|
-
if (l < 0 ||
|
|
4823
|
+
let u = n.length - 1;
|
|
4824
|
+
for (; u >= 0 && n[u] > d; )
|
|
4825
|
+
u--;
|
|
4826
|
+
if (l < 0 || u < l)
|
|
4777
4827
|
throw new Error("Time range does not overlap the point-series store");
|
|
4778
4828
|
const f = Math.max(
|
|
4779
4829
|
1,
|
|
4780
|
-
Math.ceil((
|
|
4830
|
+
Math.ceil((u - l + 1) / a)
|
|
4781
4831
|
);
|
|
4782
4832
|
return r.sampleTimeSeries({
|
|
4783
4833
|
variables: fe(i),
|
|
@@ -4785,7 +4835,7 @@ class Pa {
|
|
|
4785
4835
|
latitude: e.latitude,
|
|
4786
4836
|
depth: e.depth ?? this.depth,
|
|
4787
4837
|
timeStartIndex: l,
|
|
4788
|
-
timeEndIndex:
|
|
4838
|
+
timeEndIndex: u,
|
|
4789
4839
|
stride: f,
|
|
4790
4840
|
stopAfterMissingSamples: 12
|
|
4791
4841
|
});
|
|
@@ -4822,7 +4872,7 @@ class Pa {
|
|
|
4822
4872
|
);
|
|
4823
4873
|
return;
|
|
4824
4874
|
}
|
|
4825
|
-
const e = new
|
|
4875
|
+
const e = new ea({
|
|
4826
4876
|
id: this.id,
|
|
4827
4877
|
entry: this.catalogLayer,
|
|
4828
4878
|
sourceConfig: this.catalogSource,
|
|
@@ -4848,7 +4898,7 @@ class Pa {
|
|
|
4848
4898
|
zarrSource: this.activeFieldSource ?? void 0,
|
|
4849
4899
|
unit: this.variableUnit,
|
|
4850
4900
|
verticalLabel: this.verticalMeta?.label,
|
|
4851
|
-
colorRamp:
|
|
4901
|
+
colorRamp: De(this.settings),
|
|
4852
4902
|
metadata: this.metadata ? { ...this.metadata } : void 0,
|
|
4853
4903
|
before: this.before
|
|
4854
4904
|
});
|
|
@@ -4887,7 +4937,7 @@ class Pa {
|
|
|
4887
4937
|
loop: i.geoVideoLoop,
|
|
4888
4938
|
playbackRate: i.geoVideoPlaybackRate,
|
|
4889
4939
|
stepsPerSecond: this.catalogLayer?.kind === "vector" ? this.appliedStepsPerSecond() : void 0
|
|
4890
|
-
}) ? (t.setColorDomain(this.settings.colorDomain ?? null), this.settings.palette && this.settings.palette !== e && t.setColorRamp(
|
|
4940
|
+
}) ? (t.setColorDomain(this.settings.colorDomain ?? null), this.settings.palette && this.settings.palette !== e && t.setColorRamp(De(this.settings)), !0) : !1;
|
|
4891
4941
|
}
|
|
4892
4942
|
detach() {
|
|
4893
4943
|
const e = this.layer;
|
|
@@ -4902,11 +4952,11 @@ class Pa {
|
|
|
4902
4952
|
}
|
|
4903
4953
|
getQuerySource(e) {
|
|
4904
4954
|
let t = this.querySources.get(e);
|
|
4905
|
-
return t || (t = new
|
|
4955
|
+
return t || (t = new _e(e, 80), this.querySources.set(e, t)), t;
|
|
4906
4956
|
}
|
|
4907
4957
|
getFieldSource(e) {
|
|
4908
4958
|
let t = this.fieldSources.get(e);
|
|
4909
|
-
return t || (t = new
|
|
4959
|
+
return t || (t = new _e(e), this.fieldSources.set(e, t)), t;
|
|
4910
4960
|
}
|
|
4911
4961
|
/**
|
|
4912
4962
|
* Time the caller asked for, so selection skips fixed-period sources (such
|
|
@@ -4924,19 +4974,19 @@ class Pa {
|
|
|
4924
4974
|
* "auto", a level deeper than the surface GeoVideo renders shows Zarr.
|
|
4925
4975
|
*/
|
|
4926
4976
|
async selectSource(e, t, i, a = {}) {
|
|
4927
|
-
const r = this.sourceTimeRequest(i, a.time), n =
|
|
4977
|
+
const r = this.sourceTimeRequest(i, a.time), n = Ee(e, t);
|
|
4928
4978
|
if (n) {
|
|
4929
|
-
const o = await this.archiveLevels(e, n),
|
|
4979
|
+
const o = await this.archiveLevels(e, n), d = o.depths.length > 0 && a.depth != null ? nt(o, a.depth) : this.catalogLayer?.id === e.id && this.catalogSource?.id === n.id ? this.archiveLevel : null, l = await this.resolveArchives(e, d), u = l.sources.filter(
|
|
4930
4980
|
(m) => m.id === n.id
|
|
4931
4981
|
);
|
|
4932
|
-
if (
|
|
4982
|
+
if (u.length) {
|
|
4933
4983
|
const m = await this.archiveSample(
|
|
4934
4984
|
e,
|
|
4935
4985
|
n.id,
|
|
4936
4986
|
i,
|
|
4937
4987
|
a.time,
|
|
4938
|
-
|
|
4939
|
-
), p =
|
|
4988
|
+
d
|
|
4989
|
+
), p = ai(u, { time: m });
|
|
4940
4990
|
if (p && !this.isFailedGeoVideo(p))
|
|
4941
4991
|
return p;
|
|
4942
4992
|
if (t !== "auto" || this.catalogSource?.id === n.id)
|
|
@@ -4944,8 +4994,8 @@ class Pa {
|
|
|
4944
4994
|
`GeoVideo chunk unavailable: ${p?.type === "geovideo" ? p.manifestUrl : n.id}`
|
|
4945
4995
|
);
|
|
4946
4996
|
} else {
|
|
4947
|
-
if (
|
|
4948
|
-
throw new Error(`GeoVideo archive level unavailable: ${
|
|
4997
|
+
if (d != null)
|
|
4998
|
+
throw new Error(`GeoVideo archive level unavailable: ${d}`);
|
|
4949
4999
|
if (t !== "auto")
|
|
4950
5000
|
throw new Error(`GeoVideo archive unavailable: ${n.id}`);
|
|
4951
5001
|
}
|
|
@@ -4977,7 +5027,7 @@ class Pa {
|
|
|
4977
5027
|
}
|
|
4978
5028
|
isArchiveChunk(e) {
|
|
4979
5029
|
return e.type === "geovideo" && !!this.catalogLayer?.sources.some(
|
|
4980
|
-
(t) => t.id === e.id &&
|
|
5030
|
+
(t) => t.id === e.id && Fe(t)
|
|
4981
5031
|
);
|
|
4982
5032
|
}
|
|
4983
5033
|
/**
|
|
@@ -4989,7 +5039,7 @@ class Pa {
|
|
|
4989
5039
|
if (!e || !t || !this.isArchiveChunk(t))
|
|
4990
5040
|
return null;
|
|
4991
5041
|
const i = this.archiveLevel;
|
|
4992
|
-
return
|
|
5042
|
+
return si(
|
|
4993
5043
|
(await this.resolveArchives(e, i)).sources,
|
|
4994
5044
|
t,
|
|
4995
5045
|
{
|
|
@@ -5000,7 +5050,7 @@ class Pa {
|
|
|
5000
5050
|
}
|
|
5001
5051
|
/** A chunk manifest, reusing the one requested ahead for the next chunk. */
|
|
5002
5052
|
loadChunkManifest(e) {
|
|
5003
|
-
return this.nextChunkManifest?.url === e ? this.nextChunkManifest.manifest :
|
|
5053
|
+
return this.nextChunkManifest?.url === e ? this.nextChunkManifest.manifest : Ce(e);
|
|
5004
5054
|
}
|
|
5005
5055
|
/**
|
|
5006
5056
|
* While a scalar archive chunk plays, load the next chunk into the layer so
|
|
@@ -5013,7 +5063,7 @@ class Pa {
|
|
|
5013
5063
|
const i = await this.nextArchiveChunk(), a = i?.source.type === "geovideo" && i.source.manifestUrl;
|
|
5014
5064
|
if (!i || !a)
|
|
5015
5065
|
return;
|
|
5016
|
-
this.nextChunkManifest?.url !== a && (this.nextChunkManifest = { url: a, manifest:
|
|
5066
|
+
this.nextChunkManifest?.url !== a && (this.nextChunkManifest = { url: a, manifest: Ce(a) });
|
|
5017
5067
|
const r = this.nextChunkManifest, n = await r.manifest.catch((o) => {
|
|
5018
5068
|
throw this.nextChunkManifest === r && (this.nextChunkManifest = null), o;
|
|
5019
5069
|
});
|
|
@@ -5066,14 +5116,14 @@ class Pa {
|
|
|
5066
5116
|
const a = (await this.resolveArchives(e, i)).sources.flatMap(
|
|
5067
5117
|
(n) => n.id === t && n.type === "geovideo" && n.manifestUrl ? [n.manifestUrl] : []
|
|
5068
5118
|
), r = a.filter((n) => !this.chunkTimes.has(n));
|
|
5069
|
-
for (let n = 0; n < r.length; n +=
|
|
5070
|
-
const o = r.slice(n, n +
|
|
5119
|
+
for (let n = 0; n < r.length; n += lt) {
|
|
5120
|
+
const o = r.slice(n, n + lt);
|
|
5071
5121
|
(await Promise.allSettled(
|
|
5072
|
-
o.map((
|
|
5073
|
-
)).forEach((
|
|
5074
|
-
|
|
5122
|
+
o.map((d) => this.loadChunkManifest(d))
|
|
5123
|
+
)).forEach((d, l) => {
|
|
5124
|
+
d.status === "fulfilled" ? this.chunkTimes.set(o[l], we(d.value)) : console.warn(
|
|
5075
5125
|
"[zartigl] GeoVideo chunk samples unavailable:",
|
|
5076
|
-
|
|
5126
|
+
d.reason
|
|
5077
5127
|
);
|
|
5078
5128
|
});
|
|
5079
5129
|
}
|
|
@@ -5088,13 +5138,13 @@ class Pa {
|
|
|
5088
5138
|
* and the time shown in agreement.
|
|
5089
5139
|
*/
|
|
5090
5140
|
async archiveSample(e, t, i, a, r = null) {
|
|
5091
|
-
const n = await this.archiveTimes(e, t, r), [o, c] = i && n.length ?
|
|
5092
|
-
if (
|
|
5141
|
+
const n = await this.archiveTimes(e, t, r), [o, c] = i && n.length ? xt(i, [n[0], n[n.length - 1]]) : [-1 / 0, 1 / 0], d = n.filter((u) => u >= o && u <= c);
|
|
5142
|
+
if (d.length === 0)
|
|
5093
5143
|
throw new RangeError(
|
|
5094
5144
|
"Time range does not contain any available timestamps"
|
|
5095
5145
|
);
|
|
5096
5146
|
const l = this.sourceTimeRequest(void 0, a).time;
|
|
5097
|
-
return l == null ?
|
|
5147
|
+
return l == null ? d[d.length - 1] : V(d, l);
|
|
5098
5148
|
}
|
|
5099
5149
|
/**
|
|
5100
5150
|
* Entry whose archive sources are replaced by one fixed-period source per
|
|
@@ -5105,7 +5155,7 @@ class Pa {
|
|
|
5105
5155
|
async resolveArchives(e, t = null) {
|
|
5106
5156
|
const i = await Promise.all(
|
|
5107
5157
|
e.sources.map(async (a) => {
|
|
5108
|
-
if (!
|
|
5158
|
+
if (!Fe(a))
|
|
5109
5159
|
return [a];
|
|
5110
5160
|
const r = await this.archiveChunksAt(
|
|
5111
5161
|
e,
|
|
@@ -5119,7 +5169,7 @@ class Pa {
|
|
|
5119
5169
|
return n ? this.archiveChunksAt(
|
|
5120
5170
|
e,
|
|
5121
5171
|
a,
|
|
5122
|
-
|
|
5172
|
+
ri(n, a.indexUrl),
|
|
5123
5173
|
n
|
|
5124
5174
|
) : [];
|
|
5125
5175
|
})
|
|
@@ -5140,28 +5190,28 @@ class Pa {
|
|
|
5140
5190
|
if (r && r.expires > Date.now())
|
|
5141
5191
|
return r.chunks;
|
|
5142
5192
|
const n = {
|
|
5143
|
-
expires: Date.now() +
|
|
5144
|
-
chunks:
|
|
5145
|
-
if (a ? !
|
|
5193
|
+
expires: Date.now() + ca,
|
|
5194
|
+
chunks: ni(i).then((o) => {
|
|
5195
|
+
if (a ? !He(o.vertical, a) : o.vertical !== void 0)
|
|
5146
5196
|
throw new Error(`GeoVideo index level does not match: ${i}`);
|
|
5147
5197
|
!a && !this.archiveRoots.has(t.indexUrl) && this.archiveRoots.set(t.indexUrl, {
|
|
5148
5198
|
surface: o.surface,
|
|
5149
5199
|
depths: o.depths ?? []
|
|
5150
5200
|
});
|
|
5151
|
-
const c =
|
|
5201
|
+
const c = oi(
|
|
5152
5202
|
{ ...t, indexUrl: i },
|
|
5153
5203
|
o,
|
|
5154
5204
|
e
|
|
5155
5205
|
);
|
|
5156
|
-
for (const
|
|
5157
|
-
this.chunkLevels.set(
|
|
5206
|
+
for (const d of li(o, i))
|
|
5207
|
+
this.chunkLevels.set(d.manifestUrl, a), d.times && this.chunkTimes.set(d.manifestUrl, d.times);
|
|
5158
5208
|
return c;
|
|
5159
|
-
}).catch((o) => (console.warn("[zartigl] GeoVideo archive unavailable:", o), n.expires = Date.now() +
|
|
5209
|
+
}).catch((o) => (console.warn("[zartigl] GeoVideo archive unavailable:", o), n.expires = Date.now() + ha, []))
|
|
5160
5210
|
};
|
|
5161
5211
|
return this.archiveChunks.set(i, n), n.chunks;
|
|
5162
5212
|
}
|
|
5163
5213
|
resolveSource(e, t, i) {
|
|
5164
|
-
const a = t === "auto" ?
|
|
5214
|
+
const a = t === "auto" ? Bt(e, i) : e.sources.find((r) => r.id === t) ?? he(
|
|
5165
5215
|
e,
|
|
5166
5216
|
[t],
|
|
5167
5217
|
i
|
|
@@ -5222,33 +5272,33 @@ class Pa {
|
|
|
5222
5272
|
a(...t);
|
|
5223
5273
|
}
|
|
5224
5274
|
}
|
|
5225
|
-
function
|
|
5275
|
+
function pa(s, e) {
|
|
5226
5276
|
const t = new Date(s).toISOString();
|
|
5227
5277
|
return e === "year" ? t.slice(0, 4) : e === "month" ? t.slice(0, 7) : e === "day" ? t.slice(0, 10) : "";
|
|
5228
5278
|
}
|
|
5229
|
-
function
|
|
5279
|
+
function ga(s, e) {
|
|
5230
5280
|
return e === "year" ? Date.UTC(Number(s), 0, 1) : e === "month" ? (/* @__PURE__ */ new Date(`${s}-01T00:00:00Z`)).getTime() : e === "day" ? (/* @__PURE__ */ new Date(`${s}T00:00:00Z`)).getTime() : (/* @__PURE__ */ new Date(`${s}Z`)).getTime();
|
|
5231
5281
|
}
|
|
5232
|
-
function
|
|
5282
|
+
function Aa(s, e, t) {
|
|
5233
5283
|
if (!e || s.length === 0)
|
|
5234
5284
|
return;
|
|
5235
5285
|
if (["year", "month", "day"].includes(t)) {
|
|
5236
5286
|
const a = s.find(
|
|
5237
|
-
(r) =>
|
|
5287
|
+
(r) => pa(r, t) === e
|
|
5238
5288
|
);
|
|
5239
5289
|
if (a !== void 0)
|
|
5240
5290
|
return a;
|
|
5241
5291
|
}
|
|
5242
|
-
const i =
|
|
5292
|
+
const i = ga(e, t);
|
|
5243
5293
|
if (Number.isFinite(i))
|
|
5244
5294
|
return s.reduce(
|
|
5245
5295
|
(a, r) => Math.abs(r - i) < Math.abs(a - i) ? r : a
|
|
5246
5296
|
);
|
|
5247
5297
|
}
|
|
5248
|
-
const
|
|
5298
|
+
const It = gt.devDependencies["maplibre-gl"].replace(
|
|
5249
5299
|
/^[^\d]*/,
|
|
5250
5300
|
""
|
|
5251
|
-
),
|
|
5301
|
+
), va = `https://cdn.jsdelivr.net/npm/maplibre-gl@${It}/+esm`, ya = `https://cdn.jsdelivr.net/npm/maplibre-gl@${It}/dist/maplibre-gl.css`, _a = `{
|
|
5252
5302
|
version: 8,
|
|
5253
5303
|
sources: {
|
|
5254
5304
|
"eox-cloudless": {
|
|
@@ -5272,10 +5322,10 @@ const kt = pt.devDependencies["maplibre-gl"].replace(
|
|
|
5272
5322
|
function q(s) {
|
|
5273
5323
|
return JSON.stringify(s);
|
|
5274
5324
|
}
|
|
5275
|
-
function
|
|
5325
|
+
function xa(s) {
|
|
5276
5326
|
return JSON.stringify(s, null, 2);
|
|
5277
5327
|
}
|
|
5278
|
-
function
|
|
5328
|
+
function Ut(s) {
|
|
5279
5329
|
return s instanceof Date ? `new Date(${q(s.toISOString())})` : typeof s == "string" ? `new Date(${q(s)})` : String(s);
|
|
5280
5330
|
}
|
|
5281
5331
|
function ie(s, e = 6) {
|
|
@@ -5283,25 +5333,25 @@ function ie(s, e = 6) {
|
|
|
5283
5333
|
}
|
|
5284
5334
|
function $(s, e) {
|
|
5285
5335
|
const t = " ".repeat(e);
|
|
5286
|
-
return
|
|
5336
|
+
return xa(s).split(`
|
|
5287
5337
|
`).map((i) => `${t}${i}`).join(`
|
|
5288
5338
|
`).trimStart();
|
|
5289
5339
|
}
|
|
5290
|
-
function
|
|
5340
|
+
function ba(s, e) {
|
|
5291
5341
|
const t = " ".repeat(e);
|
|
5292
5342
|
return s.split(`
|
|
5293
5343
|
`).map((i) => i.length > 0 ? `${t}${i}` : i).join(`
|
|
5294
5344
|
`);
|
|
5295
5345
|
}
|
|
5296
|
-
const
|
|
5346
|
+
const Sa = (s) => {
|
|
5297
5347
|
const e = s.source ?? "auto";
|
|
5298
5348
|
return s.sourceType ?? (e === "wmts" || e === "geovideo" ? e : "zarr");
|
|
5299
5349
|
};
|
|
5300
|
-
function
|
|
5301
|
-
const { layerKind: e, layerDefaults: t } = s, i =
|
|
5350
|
+
function Vt(s) {
|
|
5351
|
+
const { layerKind: e, layerDefaults: t } = s, i = pt(s.style ?? {}, e), a = t === void 0 ? i : $t(i, ze({ kind: e, defaults: t })), r = a.raster?.opacity, n = Sa(s) !== "wmts" ? a : r === void 0 ? {} : { raster: { opacity: r } };
|
|
5302
5352
|
return Object.keys(n).length ? n : void 0;
|
|
5303
5353
|
}
|
|
5304
|
-
function
|
|
5354
|
+
function Nt(s) {
|
|
5305
5355
|
const { particleState: e, rgba8MaxParticleZoom: t } = s.settings ?? {}, i = Object.fromEntries(
|
|
5306
5356
|
Object.entries({ particleState: e, rgba8MaxParticleZoom: t }).filter(
|
|
5307
5357
|
([, a]) => a !== void 0
|
|
@@ -5309,8 +5359,8 @@ function Ut(s) {
|
|
|
5309
5359
|
);
|
|
5310
5360
|
return s.layerKind === "vector" && Object.keys(i).length ? i : void 0;
|
|
5311
5361
|
}
|
|
5312
|
-
function
|
|
5313
|
-
const e = s.source ?? "auto", t =
|
|
5362
|
+
function Ca(s) {
|
|
5363
|
+
const e = s.source ?? "auto", t = Vt(s), i = Nt(s), a = [
|
|
5314
5364
|
" idView: widget.opt.view.id,",
|
|
5315
5365
|
" map: widget.opt.map,",
|
|
5316
5366
|
` layer: ${q(s.layerId)},`,
|
|
@@ -5318,7 +5368,7 @@ function La(s) {
|
|
|
5318
5368
|
];
|
|
5319
5369
|
for (const r of ["title", "subtitle", "description"])
|
|
5320
5370
|
s[r] != null && a.push(` ${r}: ${$(s[r], 10)},`);
|
|
5321
|
-
return s.entry && a.push(` entry: ${$(s.entry, 10)},`), t && a.push(` style: ${$(t, 10)},`), i && a.push(` settings: ${$(i, 10)},`), s.time != null && a.push(` time: ${
|
|
5371
|
+
return s.entry && a.push(` entry: ${$(s.entry, 10)},`), t && a.push(` style: ${$(t, 10)},`), i && a.push(` settings: ${$(i, 10)},`), s.time != null && a.push(` time: ${Ut(s.time)},`), s.timeRange != null && a.push(
|
|
5322
5372
|
` timeRange: ${$(s.timeRange, 10)},`
|
|
5323
5373
|
), s.geoVideo != null && a.push(
|
|
5324
5374
|
` geoVideo: ${$(s.geoVideo, 10)},`
|
|
@@ -5357,16 +5407,16 @@ ${a.join(`
|
|
|
5357
5407
|
};
|
|
5358
5408
|
}`;
|
|
5359
5409
|
}
|
|
5360
|
-
function
|
|
5361
|
-
const e = s.moduleBaseUrl ?? `https://cdn.jsdelivr.net/npm/@fxi/zartigl@${
|
|
5410
|
+
function wa(s) {
|
|
5411
|
+
const e = s.moduleBaseUrl ?? `https://cdn.jsdelivr.net/npm/@fxi/zartigl@${gt.version}/dist`, t = s.source ?? "auto", i = Vt(s), a = Nt(s), r = s.timeRange == null ? "" : ` timeRange: ${$(s.timeRange, 2)},
|
|
5362
5412
|
`, n = s.geoVideo == null ? "" : ` geoVideo: ${$(s.geoVideo, 2)},
|
|
5363
5413
|
`, o = i == null ? "" : ` style: ${$(i, 2)},
|
|
5364
5414
|
`, c = a == null ? "" : ` settings: ${$(a, 2)},
|
|
5365
|
-
`,
|
|
5415
|
+
`, d = s.time == null ? "" : ` time: ${Ut(s.time)},
|
|
5366
5416
|
`, l = s.depth == null ? "" : ` depth: ${s.depth},
|
|
5367
|
-
`,
|
|
5417
|
+
`, u = s.center ?? [0, 20], f = s.projection ?? "mercator", m = s.mapStyle == null ? _a : q(s.mapStyle), p = `map.setProjection({ type: ${q(f)} });
|
|
5368
5418
|
map.jumpTo({
|
|
5369
|
-
center: [${ie(
|
|
5419
|
+
center: [${ie(u[0])}, ${ie(u[1])}],
|
|
5370
5420
|
zoom: ${ie(s.zoom ?? 2, 3)},
|
|
5371
5421
|
bearing: ${ie(s.bearing ?? 0, 3)},
|
|
5372
5422
|
pitch: ${ie(s.pitch ?? 0, 3)},
|
|
@@ -5393,10 +5443,10 @@ const z = new Zartigl({
|
|
|
5393
5443
|
catalog,
|
|
5394
5444
|
layer: ${q(s.layerId)},
|
|
5395
5445
|
source: ${q(t)},
|
|
5396
|
-
${r}${n}${o}${c}${
|
|
5446
|
+
${r}${n}${o}${c}${d}${l}});
|
|
5397
5447
|
|
|
5398
5448
|
await z.init();`;
|
|
5399
|
-
return `import maplibregl from ${q(
|
|
5449
|
+
return `import maplibregl from ${q(va)};
|
|
5400
5450
|
import { Zartigl } from "${e}/zartigl.js";
|
|
5401
5451
|
import { catalog } from "${e}/catalog.js";
|
|
5402
5452
|
|
|
@@ -5408,18 +5458,18 @@ const map = new maplibregl.Map({
|
|
|
5408
5458
|
});
|
|
5409
5459
|
|
|
5410
5460
|
map.once("style.load", async () => {
|
|
5411
|
-
${
|
|
5461
|
+
${ba(p, 2)}
|
|
5412
5462
|
});`;
|
|
5413
5463
|
}
|
|
5414
|
-
function
|
|
5415
|
-
const e =
|
|
5464
|
+
function ka(s) {
|
|
5465
|
+
const e = wa(s);
|
|
5416
5466
|
return `<!doctype html>
|
|
5417
5467
|
<html lang="en">
|
|
5418
5468
|
<head>
|
|
5419
5469
|
<meta charset="UTF-8" />
|
|
5420
5470
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
5421
5471
|
<title>Zartigl demo</title>
|
|
5422
|
-
<link rel="stylesheet" href=${q(
|
|
5472
|
+
<link rel="stylesheet" href=${q(ya)} />
|
|
5423
5473
|
<style>
|
|
5424
5474
|
html, body, #map {
|
|
5425
5475
|
width: 100%;
|
|
@@ -5441,41 +5491,41 @@ ${e}
|
|
|
5441
5491
|
</html>`;
|
|
5442
5492
|
}
|
|
5443
5493
|
export {
|
|
5444
|
-
|
|
5445
|
-
|
|
5446
|
-
|
|
5447
|
-
|
|
5494
|
+
ci as BACKDROP_OFF,
|
|
5495
|
+
hi as COLOR_GRADE_OFF,
|
|
5496
|
+
za as COLOR_GRADE_VIBRANT,
|
|
5497
|
+
ra as GEOVIDEO_SPEEDS,
|
|
5448
5498
|
G as GeoVideoLayer,
|
|
5449
|
-
|
|
5450
|
-
|
|
5499
|
+
kt as LEGACY_STYLE_SETTINGS,
|
|
5500
|
+
Mt as ParticleSimulation,
|
|
5451
5501
|
me as ScalarLayer,
|
|
5452
|
-
|
|
5502
|
+
it as VECTOR_GEOVIDEO_SPEEDS,
|
|
5453
5503
|
D as VectorLayer,
|
|
5454
|
-
|
|
5455
|
-
|
|
5456
|
-
|
|
5457
|
-
|
|
5458
|
-
|
|
5459
|
-
|
|
5460
|
-
|
|
5461
|
-
|
|
5462
|
-
|
|
5463
|
-
|
|
5464
|
-
|
|
5465
|
-
|
|
5466
|
-
|
|
5467
|
-
|
|
5468
|
-
|
|
5469
|
-
|
|
5470
|
-
|
|
5471
|
-
|
|
5472
|
-
|
|
5473
|
-
|
|
5474
|
-
|
|
5475
|
-
|
|
5476
|
-
|
|
5477
|
-
|
|
5478
|
-
|
|
5479
|
-
|
|
5480
|
-
|
|
5504
|
+
Rt as VelocityField,
|
|
5505
|
+
_e as ZarrSource,
|
|
5506
|
+
Da as Zartigl,
|
|
5507
|
+
xe as ZartiglFrameUnavailableError,
|
|
5508
|
+
Ca as buildMapxWidgetSnippet,
|
|
5509
|
+
ka as buildStandaloneDemoHtml,
|
|
5510
|
+
wa as buildStandaloneDemoSnippet,
|
|
5511
|
+
Yi as buildWmtsLegendUrl,
|
|
5512
|
+
Je as buildWmtsTileUrl,
|
|
5513
|
+
mi as colorGradeToGrade,
|
|
5514
|
+
qi as deriveDirectionMagnitudeComponents,
|
|
5515
|
+
Ye as formatUnit,
|
|
5516
|
+
Jt as geoVideoSecondsForTime,
|
|
5517
|
+
Ua as geoVideoTimeForSeconds,
|
|
5518
|
+
we as geoVideoTimelineValues,
|
|
5519
|
+
_t as getPalettes,
|
|
5520
|
+
La as getVectorDerivationVariables,
|
|
5521
|
+
fi as gradeToColorGrade,
|
|
5522
|
+
Ga as isHexColor,
|
|
5523
|
+
Ce as loadGeoVideoManifest,
|
|
5524
|
+
St as resolveBackdrop,
|
|
5525
|
+
bt as resolveColorGrade,
|
|
5526
|
+
ke as resolveColorRamp,
|
|
5527
|
+
Aa as resolveTimeInputSelection,
|
|
5528
|
+
Ae as splitLegacySettings,
|
|
5529
|
+
Pt as stitchVelocityChunks,
|
|
5530
|
+
Va as validateGeoVideoManifest
|
|
5481
5531
|
};
|