@fxi/zartigl 0.9.2 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -1
- package/dist/catalog.d.ts +25 -5
- package/dist/catalog.js +203 -174
- package/dist/engine.d.ts +78 -8
- package/dist/engine.js +48 -38
- package/dist/{geovideo-index-CzQo6UIG.js → geovideo-index-BJjE_fgO.js} +378 -250
- package/dist/zartigl.d.ts +60 -7
- package/dist/zartigl.js +668 -663
- package/package.json +2 -2
|
@@ -1,39 +1,94 @@
|
|
|
1
|
-
const
|
|
2
|
-
thermal:
|
|
1
|
+
const Y = { label: "Thermal", tags: ["sequential", "temperature"], colors: ["#042333", "#2c3395", "#744796", "#b15f82", "#eb7958", "#fbb43d", "#e8fa5b"] }, z = { label: "Haline", tags: ["sequential", "salinity"], colors: ["#2a186c", "#17568b", "#1a7e8f", "#22a785", "#55c666", "#aadc32", "#fde333"] }, K = { label: "Solar", tags: ["sequential", "irradiance"], colors: ["#330f0b", "#6b2313", "#a83c12", "#d6621a", "#f3951e", "#f7c741", "#f9f871"] }, J = { label: "Ice", tags: ["sequential"], colors: ["#040d1a", "#123365", "#1c5f9e", "#2b8ece", "#62bde3", "#aaddf2", "#f2faff"] }, Q = { label: "Deep", tags: ["sequential", "depth"], colors: ["#fdfecc", "#c8e59b", "#74c8a3", "#3194b0", "#2a5b8e", "#281a5e", "#0c0820"] }, Z = { label: "RdYlBu", tags: ["diverging"], colors: ["#3288bd", "#66c2a5", "#abdda4", "#e6f598", "#fee08b", "#fdae61", "#f46d43", "#d53e4f"] }, ee = { label: "Dense", tags: ["sequential"], colors: ["#e6f1f1", "#92c4ca", "#44929a", "#20627a", "#1a3c6a", "#211a50", "#0d0621"] }, te = { label: "Algae", tags: ["sequential", "biology", "log"], colors: ["#d7f9d0", "#a2d595", "#64b463", "#129450", "#126e45", "#1a482f", "#122414"] }, re = { label: "Oxygen", tags: ["sequential", "biology", "hypoxia"], colors: ["#09060f", "#5b1028", "#d43d2f", "#f39b3d", "#f3e7b3", "#79cbd1", "#176b9c"] }, ne = { label: "Matter", tags: ["sequential", "biology"], colors: ["#fdfecc", "#f2c98a", "#e07c4e", "#bc3754", "#8d1a6d", "#51156b", "#1c0c3f"] }, ae = { label: "Viridis", tags: ["sequential", "perceptual"], colors: ["#440154", "#443983", "#31688e", "#21918c", "#35b779", "#90d743", "#fde725"] }, ie = { label: "Plasma", tags: ["sequential", "perceptual"], colors: ["#0d0887", "#5e01a6", "#9c179e", "#cc4778", "#ed7953", "#fdb42f", "#f0f921"] }, oe = { label: "Cyclic", tags: ["cyclic", "direction"], colors: ["#2e22ea", "#b541fb", "#fc93c0", "#f1ee35", "#77c80d", "#458776", "#2c24e9"] }, se = { label: "Tempo", tags: ["sequential"], colors: ["#fff6f4", "#c2d1b9", "#7db390", "#2a937f", "#156d73", "#1c455b", "#151d44"] }, ce = { label: "Turbid", tags: ["sequential", "biology", "log"], colors: ["#e9f5a0", "#c8c86e", "#a09845", "#786031", "#533324", "#341423", "#150d17"] }, de = { label: "Speed", tags: ["sequential", "velocity"], colors: ["#fcfea4", "#d5e429", "#94c63e", "#52a657", "#2d8169", "#1d5b6d", "#0d3361"] }, ue = { label: "Amp", tags: ["sequential"], colors: ["#f2f2f2", "#c0b8db", "#9180b6", "#6c4e9e", "#4e2e83", "#32185d", "#110a35"] }, le = { label: "Heat", tags: ["sequential"], colors: ["#fde725", "#fde725", "#f8961e", "#e63946", "#9d0208", "#3a0007"] }, fe = { label: "Balance", tags: ["diverging"], colors: ["#181c43", "#3066af", "#9bbcdd", "#f2f2f2", "#e07d53", "#b13626", "#2c0b0e"] }, he = { label: "Delta", tags: ["diverging"], colors: ["#0e3f31", "#20877b", "#99d4c1", "#f2f2f2", "#a1b0d4", "#3c5b9e", "#0d1938"] }, me = { label: "Curl", tags: ["diverging"], colors: ["#152237", "#2471b3", "#8dbac4", "#f2f2f2", "#c79f84", "#a63827", "#270b17"] }, Ee = { label: "Gray", tags: ["sequential"], colors: ["#000000", "#252525", "#4d4d4d", "#7a7a7a", "#a8a8a8", "#d4d4d4", "#ffffff"] }, $ = {
|
|
2
|
+
thermal: Y,
|
|
3
3
|
"thermal-alt": { label: "Thermal Alt", tags: ["sequential", "temperature"], colors: ["#176b9c", "#79cbd1", "#f3e7b3", "#f39b3d", "#d43d2f", "#5b1028", "#09060f"] },
|
|
4
|
-
haline:
|
|
5
|
-
solar:
|
|
6
|
-
ice:
|
|
7
|
-
deep:
|
|
8
|
-
rdylbu:
|
|
9
|
-
dense:
|
|
10
|
-
algae:
|
|
11
|
-
oxygen:
|
|
12
|
-
matter:
|
|
13
|
-
viridis:
|
|
14
|
-
plasma:
|
|
15
|
-
cyclic:
|
|
16
|
-
tempo:
|
|
17
|
-
turbid:
|
|
18
|
-
speed:
|
|
19
|
-
amp:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
4
|
+
haline: z,
|
|
5
|
+
solar: K,
|
|
6
|
+
ice: J,
|
|
7
|
+
deep: Q,
|
|
8
|
+
rdylbu: Z,
|
|
9
|
+
dense: ee,
|
|
10
|
+
algae: te,
|
|
11
|
+
oxygen: re,
|
|
12
|
+
matter: ne,
|
|
13
|
+
viridis: ae,
|
|
14
|
+
plasma: ie,
|
|
15
|
+
cyclic: oe,
|
|
16
|
+
tempo: se,
|
|
17
|
+
turbid: ce,
|
|
18
|
+
speed: de,
|
|
19
|
+
amp: ue,
|
|
20
|
+
heat: le,
|
|
21
|
+
"heat-alert": { label: "Heat Alert", tags: ["sequential", "alpha", "deprecated"], colors: ["#fde72500", "#fde725cc", "#f8961e", "#e63946", "#9d0208", "#3a0007"] },
|
|
22
|
+
balance: fe,
|
|
23
|
+
delta: he,
|
|
24
|
+
curl: me,
|
|
24
25
|
"mono-black": { label: "Black", tags: ["monochrome", "particles"], colors: ["#000000", "#000000"] },
|
|
25
26
|
"mono-white": { label: "White", tags: ["monochrome", "particles"], colors: ["#ffffff", "#ffffff"] },
|
|
26
27
|
"mono-pink": { label: "Pink", tags: ["monochrome", "particles"], colors: ["#ff2aa1", "#ff2aa1"] },
|
|
27
|
-
gray:
|
|
28
|
+
gray: Ee
|
|
29
|
+
}, I = 64, pe = {
|
|
30
|
+
linear: (e) => e,
|
|
31
|
+
// Rises fast: values just inside the zone already show.
|
|
32
|
+
log: (e) => Math.log10(1 + 9 * e),
|
|
33
|
+
// Stays faint longer: codec noise at the end of the range stays hidden.
|
|
34
|
+
exp: (e) => (10 ** e - 1) / 9
|
|
28
35
|
};
|
|
29
|
-
function
|
|
36
|
+
function Te(e, t) {
|
|
37
|
+
const r = pe[t.curve ?? "linear"], n = t.low ?? 0, a = t.high ?? 0;
|
|
38
|
+
let i = 1;
|
|
39
|
+
return n > 0 && e < n && (i = Math.min(i, r(Math.max(e, 0) / n))), a > 0 && e > 1 - a && (i = Math.min(i, r(Math.max(1 - e, 0) / a))), i;
|
|
40
|
+
}
|
|
41
|
+
function be(e) {
|
|
42
|
+
let t = e.replace("#", "");
|
|
43
|
+
(t.length === 3 || t.length === 4) && (t = [...t].map((n) => n + n).join(""));
|
|
44
|
+
const r = (n) => parseInt(t.slice(n, n + 2), 16);
|
|
45
|
+
return [
|
|
46
|
+
r(0),
|
|
47
|
+
r(2),
|
|
48
|
+
r(4),
|
|
49
|
+
t.length === 8 ? r(6) : 255
|
|
50
|
+
];
|
|
51
|
+
}
|
|
52
|
+
function we([e, t, r, n]) {
|
|
53
|
+
return `#${[e, t, r, n].map(
|
|
54
|
+
(a) => Math.round(Math.min(255, Math.max(0, a))).toString(16).padStart(2, "0")
|
|
55
|
+
).join("")}`;
|
|
56
|
+
}
|
|
57
|
+
function Re(e, t) {
|
|
58
|
+
if (t <= e[0][0])
|
|
59
|
+
return e[0][1];
|
|
60
|
+
for (let r = 1; r < e.length; r++) {
|
|
61
|
+
const [n, a] = e[r];
|
|
62
|
+
if (t <= n) {
|
|
63
|
+
const [i, s] = e[r - 1], o = n === i ? 1 : (t - i) / (n - i);
|
|
64
|
+
return s.map((d, c) => d + (a[c] - d) * o);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return e[e.length - 1][1];
|
|
68
|
+
}
|
|
69
|
+
function _e(e, t) {
|
|
70
|
+
const r = Object.entries(e).map(
|
|
71
|
+
([a, i]) => [Number(a), be(i)]
|
|
72
|
+
).sort((a, i) => a[0] - i[0]), n = {};
|
|
73
|
+
for (let a = 0; a <= I; a++) {
|
|
74
|
+
const i = a / I, [s, o, d, c] = Re(r, i);
|
|
75
|
+
n[i] = we([s, o, d, c * Te(i, t)]);
|
|
76
|
+
}
|
|
77
|
+
return n;
|
|
78
|
+
}
|
|
79
|
+
const Ae = (e) => !!e && ((e.low ?? 0) > 0 || (e.high ?? 0) > 0);
|
|
80
|
+
function C(e) {
|
|
30
81
|
const t = {}, r = e.length - 1;
|
|
31
82
|
return e.forEach((n, a) => {
|
|
32
83
|
t[r === 0 ? 0 : a / r] = n;
|
|
33
84
|
}), t;
|
|
34
85
|
}
|
|
35
|
-
function
|
|
36
|
-
const r =
|
|
86
|
+
function Fe(e, t) {
|
|
87
|
+
const r = xe(e, t?.reverse ?? !1);
|
|
88
|
+
return Ae(t?.alphaFade) ? _e(r, t.alphaFade) : r;
|
|
89
|
+
}
|
|
90
|
+
function xe(e, t) {
|
|
91
|
+
const r = $;
|
|
37
92
|
if (typeof e == "string") {
|
|
38
93
|
const n = r[e];
|
|
39
94
|
if (!n)
|
|
@@ -42,19 +97,23 @@ function fe(e, t) {
|
|
|
42
97
|
r
|
|
43
98
|
).join(", ")}`
|
|
44
99
|
);
|
|
45
|
-
const a = t
|
|
46
|
-
return
|
|
100
|
+
const a = t ? [...n.colors].reverse() : n.colors;
|
|
101
|
+
return C(a);
|
|
47
102
|
}
|
|
48
103
|
if (Array.isArray(e)) {
|
|
49
|
-
const n = t
|
|
50
|
-
return
|
|
104
|
+
const n = t ? [...e].reverse() : e;
|
|
105
|
+
return C(n);
|
|
51
106
|
}
|
|
52
|
-
return
|
|
107
|
+
return t ? Object.fromEntries(
|
|
108
|
+
Object.entries(e).map(([n, a]) => [1 - Number(n), a])
|
|
109
|
+
) : e;
|
|
53
110
|
}
|
|
54
|
-
function
|
|
55
|
-
return Object.entries(
|
|
111
|
+
function ut(e = {}) {
|
|
112
|
+
return Object.entries($).map(([r, n]) => ({ id: r, ...n })).filter(
|
|
113
|
+
(r) => e.includeDeprecated || !r.tags.includes("deprecated")
|
|
114
|
+
);
|
|
56
115
|
}
|
|
57
|
-
function
|
|
116
|
+
function N(e, t, r) {
|
|
58
117
|
const n = e.createShader(t);
|
|
59
118
|
if (!n)
|
|
60
119
|
throw new Error("Failed to create shader");
|
|
@@ -64,18 +123,18 @@ function g(e, t, r) {
|
|
|
64
123
|
}
|
|
65
124
|
return n;
|
|
66
125
|
}
|
|
67
|
-
function
|
|
126
|
+
function lt(e, t, r) {
|
|
68
127
|
const n = e.createProgram();
|
|
69
128
|
if (!n)
|
|
70
129
|
throw new Error("Failed to create program");
|
|
71
|
-
const a =
|
|
130
|
+
const a = N(e, e.VERTEX_SHADER, t), i = N(e, e.FRAGMENT_SHADER, r);
|
|
72
131
|
if (e.attachShader(n, a), e.attachShader(n, i), e.linkProgram(n), !e.getProgramParameter(n, e.LINK_STATUS)) {
|
|
73
132
|
const s = e.getProgramInfoLog(n);
|
|
74
133
|
throw e.deleteProgram(n), new Error(`Program link error: ${s}`);
|
|
75
134
|
}
|
|
76
135
|
return e.deleteShader(a), e.deleteShader(i), n;
|
|
77
136
|
}
|
|
78
|
-
function
|
|
137
|
+
function ft(e, t, r, n, a) {
|
|
79
138
|
const i = e.createTexture();
|
|
80
139
|
if (!i)
|
|
81
140
|
throw new Error("Failed to create texture");
|
|
@@ -91,7 +150,7 @@ function Je(e, t, r, n, a) {
|
|
|
91
150
|
r
|
|
92
151
|
), e.bindTexture(e.TEXTURE_2D, null), i;
|
|
93
152
|
}
|
|
94
|
-
function
|
|
153
|
+
function ye(e, t, r) {
|
|
95
154
|
const n = e.getParameter(
|
|
96
155
|
e.TEXTURE_BINDING_2D
|
|
97
156
|
), a = e.getParameter(
|
|
@@ -123,19 +182,19 @@ function he(e, t, r) {
|
|
|
123
182
|
}
|
|
124
183
|
return o;
|
|
125
184
|
}
|
|
126
|
-
function
|
|
185
|
+
function De(e) {
|
|
127
186
|
return {
|
|
128
187
|
kind: "rgba8-packed",
|
|
129
188
|
internalFormat: e.RGBA,
|
|
130
189
|
type: e.UNSIGNED_BYTE
|
|
131
190
|
};
|
|
132
191
|
}
|
|
133
|
-
function
|
|
192
|
+
function ht(e) {
|
|
134
193
|
if (typeof WebGL2RenderingContext > "u" || !(e instanceof WebGL2RenderingContext))
|
|
135
194
|
throw new Error("zartigl requires WebGL2");
|
|
136
195
|
return e;
|
|
137
196
|
}
|
|
138
|
-
function
|
|
197
|
+
function mt(e) {
|
|
139
198
|
const t = [];
|
|
140
199
|
e.getExtension("EXT_color_buffer_float") ? t.push(
|
|
141
200
|
{ kind: "float32", internalFormat: e.RGBA32F, type: e.FLOAT },
|
|
@@ -146,15 +205,15 @@ function Ze(e) {
|
|
|
146
205
|
type: e.HALF_FLOAT
|
|
147
206
|
});
|
|
148
207
|
for (const r of t)
|
|
149
|
-
if (
|
|
208
|
+
if (ye(
|
|
150
209
|
e,
|
|
151
210
|
r.internalFormat,
|
|
152
211
|
r.type
|
|
153
212
|
))
|
|
154
213
|
return r;
|
|
155
|
-
return
|
|
214
|
+
return De(e);
|
|
156
215
|
}
|
|
157
|
-
function
|
|
216
|
+
function Et(e, t, r, n, a, i, s) {
|
|
158
217
|
const o = e.createTexture();
|
|
159
218
|
if (!o)
|
|
160
219
|
throw new Error("Failed to create texture");
|
|
@@ -170,10 +229,10 @@ function et(e, t, r, n, a, i, s) {
|
|
|
170
229
|
r
|
|
171
230
|
), e.bindTexture(e.TEXTURE_2D, null), o;
|
|
172
231
|
}
|
|
173
|
-
function
|
|
232
|
+
function pt(e, t, r) {
|
|
174
233
|
e.activeTexture(e.TEXTURE0 + r), e.bindTexture(e.TEXTURE_2D, t);
|
|
175
234
|
}
|
|
176
|
-
function
|
|
235
|
+
function Tt(e, t) {
|
|
177
236
|
const r = e.createFramebuffer();
|
|
178
237
|
if (!r)
|
|
179
238
|
throw new Error("Failed to create framebuffer");
|
|
@@ -185,7 +244,7 @@ function rt(e, t) {
|
|
|
185
244
|
0
|
|
186
245
|
), e.bindFramebuffer(e.FRAMEBUFFER, null), r;
|
|
187
246
|
}
|
|
188
|
-
function
|
|
247
|
+
function bt(e) {
|
|
189
248
|
const t = e.createBuffer();
|
|
190
249
|
if (!t)
|
|
191
250
|
throw new Error("Failed to create buffer");
|
|
@@ -195,7 +254,7 @@ function nt(e) {
|
|
|
195
254
|
e.STATIC_DRAW
|
|
196
255
|
), t;
|
|
197
256
|
}
|
|
198
|
-
const
|
|
257
|
+
const Ue = {
|
|
199
258
|
0: "#3288bd",
|
|
200
259
|
0.1: "#66c2a5",
|
|
201
260
|
0.2: "#abdda4",
|
|
@@ -205,19 +264,19 @@ const Ee = {
|
|
|
205
264
|
0.6: "#f46d43",
|
|
206
265
|
1: "#d53e4f"
|
|
207
266
|
};
|
|
208
|
-
function
|
|
209
|
-
const
|
|
210
|
-
|
|
211
|
-
const
|
|
212
|
-
for (const [
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
const
|
|
216
|
-
if (!
|
|
267
|
+
function wt(e, t, r) {
|
|
268
|
+
const n = Fe(t ?? Ue, r), a = document.createElement("canvas");
|
|
269
|
+
a.width = 256, a.height = 1;
|
|
270
|
+
const i = a.getContext("2d"), s = i.createLinearGradient(0, 0, 256, 0);
|
|
271
|
+
for (const [d, c] of Object.entries(n))
|
|
272
|
+
s.addColorStop(Number(d), c);
|
|
273
|
+
i.fillStyle = s, i.fillRect(0, 0, 256, 1);
|
|
274
|
+
const o = e.createTexture();
|
|
275
|
+
if (!o)
|
|
217
276
|
throw new Error("Failed to create color ramp texture");
|
|
218
|
-
return e.bindTexture(e.TEXTURE_2D,
|
|
277
|
+
return e.bindTexture(e.TEXTURE_2D, o), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_S, e.CLAMP_TO_EDGE), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_T, e.CLAMP_TO_EDGE), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MIN_FILTER, e.LINEAR), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MAG_FILTER, e.LINEAR), e.texImage2D(e.TEXTURE_2D, 0, e.RGBA, e.RGBA, e.UNSIGNED_BYTE, a), e.bindTexture(e.TEXTURE_2D, null), o;
|
|
219
278
|
}
|
|
220
|
-
function
|
|
279
|
+
function Rt(e) {
|
|
221
280
|
const t = e.getExtension("WEBGL_debug_renderer_info");
|
|
222
281
|
return {
|
|
223
282
|
vendor: String(e.getParameter(e.VENDOR) ?? ""),
|
|
@@ -227,7 +286,7 @@ function it(e) {
|
|
|
227
286
|
version: String(e.getParameter(e.VERSION) ?? "")
|
|
228
287
|
};
|
|
229
288
|
}
|
|
230
|
-
function
|
|
289
|
+
function _t(e) {
|
|
231
290
|
return {
|
|
232
291
|
program: e.getParameter(e.CURRENT_PROGRAM),
|
|
233
292
|
activeTexture: e.getParameter(e.ACTIVE_TEXTURE),
|
|
@@ -244,10 +303,10 @@ function ot(e) {
|
|
|
244
303
|
]
|
|
245
304
|
};
|
|
246
305
|
}
|
|
247
|
-
function
|
|
306
|
+
function At(e, t) {
|
|
248
307
|
e.useProgram(t.program), e.activeTexture(t.activeTexture), e.bindBuffer(e.ARRAY_BUFFER, t.arrayBuffer), e.bindBuffer(e.ELEMENT_ARRAY_BUFFER, t.elementBuffer), e.bindFramebuffer(e.FRAMEBUFFER, t.framebuffer), t.blend ? e.enable(e.BLEND) : e.disable(e.BLEND), t.depthTest ? e.enable(e.DEPTH_TEST) : e.disable(e.DEPTH_TEST), t.stencilTest ? e.enable(e.STENCIL_TEST) : e.disable(e.STENCIL_TEST), e.viewport(t.viewport[0], t.viewport[1], t.viewport[2], t.viewport[3]), e.blendFunc(t.blendFunc[0], t.blendFunc[1]);
|
|
249
308
|
}
|
|
250
|
-
const
|
|
309
|
+
const ve = {
|
|
251
310
|
degrees_c: "°C",
|
|
252
311
|
degc: "°C",
|
|
253
312
|
degrees_celsius: "°C",
|
|
@@ -263,7 +322,7 @@ const Te = {
|
|
|
263
322
|
"0.001": "PSU",
|
|
264
323
|
psu: "PSU",
|
|
265
324
|
stress_level: ""
|
|
266
|
-
},
|
|
325
|
+
}, Se = {
|
|
267
326
|
meter: "m",
|
|
268
327
|
meters: "m",
|
|
269
328
|
metre: "m",
|
|
@@ -286,12 +345,12 @@ const Te = {
|
|
|
286
345
|
newton: "N",
|
|
287
346
|
pascal: "Pa",
|
|
288
347
|
kelvin: "K"
|
|
289
|
-
},
|
|
290
|
-
function
|
|
291
|
-
return e === 1 ? "" : [...String(e)].map((t) =>
|
|
348
|
+
}, Me = "⁰¹²³⁴⁵⁶⁷⁸⁹";
|
|
349
|
+
function L(e) {
|
|
350
|
+
return e === 1 ? "" : [...String(e)].map((t) => Me[Number(t)]).join("");
|
|
292
351
|
}
|
|
293
|
-
function
|
|
294
|
-
const t = e?.trim() ?? "", r =
|
|
352
|
+
function Ft(e) {
|
|
353
|
+
const t = e?.trim() ?? "", r = ve[t.toLowerCase()];
|
|
295
354
|
if (r != null)
|
|
296
355
|
return r;
|
|
297
356
|
if (t.includes("/"))
|
|
@@ -301,21 +360,21 @@ function ct(e) {
|
|
|
301
360
|
const s = /^([A-Za-z]+)\^?(-?\d+)?$/.exec(i);
|
|
302
361
|
if (!s)
|
|
303
362
|
return t.replace(/_/g, " ");
|
|
304
|
-
const o =
|
|
305
|
-
d < 0 ? a.push(o +
|
|
363
|
+
const o = Se[s[1]] ?? s[1], d = Number(s[2] ?? 1);
|
|
364
|
+
d < 0 ? a.push(o + L(-d)) : n.push(o + L(d));
|
|
306
365
|
}
|
|
307
366
|
return [n.join(" ") || "1", ...a].join("/");
|
|
308
367
|
}
|
|
309
|
-
const
|
|
310
|
-
function
|
|
368
|
+
const V = 20, ge = 600;
|
|
369
|
+
function ke(e) {
|
|
311
370
|
const t = Math.max(0, Math.min(1, e));
|
|
312
|
-
return
|
|
371
|
+
return V * Math.pow(ge / V, t);
|
|
313
372
|
}
|
|
314
|
-
function
|
|
315
|
-
return Math.exp(-1 /
|
|
373
|
+
function xt(e) {
|
|
374
|
+
return Math.exp(-1 / ke(e));
|
|
316
375
|
}
|
|
317
|
-
const
|
|
318
|
-
class
|
|
376
|
+
const Pe = 0.8, Ge = 120, Ie = 300;
|
|
377
|
+
class yt {
|
|
319
378
|
constructor(t) {
|
|
320
379
|
this.base = t, this.moving = !1, this.start = 0, this.duration = 0, this.from = t, this.to = t;
|
|
321
380
|
}
|
|
@@ -324,7 +383,7 @@ class ut {
|
|
|
324
383
|
this.base = t, this.moving || (this.from = t, this.to = t, this.duration = 0);
|
|
325
384
|
}
|
|
326
385
|
setMoving(t, r) {
|
|
327
|
-
t !== this.moving && (this.from = this.value(r), this.moving = t, this.to = t ?
|
|
386
|
+
t !== this.moving && (this.from = this.value(r), this.moving = t, this.to = t ? Pe : this.base, this.start = r, this.duration = t ? Ge : Ie);
|
|
328
387
|
}
|
|
329
388
|
value(t) {
|
|
330
389
|
if (this.duration === 0)
|
|
@@ -333,7 +392,7 @@ class ut {
|
|
|
333
392
|
return r === 1 ? (this.duration = 0, this.from = this.to, this.to) : this.from + (this.to - this.from) * r * r * (3 - 2 * r);
|
|
334
393
|
}
|
|
335
394
|
}
|
|
336
|
-
function
|
|
395
|
+
function Dt(e) {
|
|
337
396
|
if (e == null)
|
|
338
397
|
return null;
|
|
339
398
|
if (!Number.isFinite(e[0]) || !Number.isFinite(e[1]) || e[0] >= e[1])
|
|
@@ -342,12 +401,12 @@ function lt(e) {
|
|
|
342
401
|
);
|
|
343
402
|
return [e[0], e[1]];
|
|
344
403
|
}
|
|
345
|
-
function
|
|
404
|
+
function p(e, t) {
|
|
346
405
|
if (typeof e != "number" || !Number.isFinite(e))
|
|
347
406
|
throw new Error(`Invalid GeoVideo manifest ${t}`);
|
|
348
407
|
return e;
|
|
349
408
|
}
|
|
350
|
-
function
|
|
409
|
+
function x(e, t) {
|
|
351
410
|
if (typeof e != "string")
|
|
352
411
|
throw new Error(`Invalid GeoVideo manifest ${t}`);
|
|
353
412
|
const r = new Date(e).getTime();
|
|
@@ -360,7 +419,7 @@ function S(e) {
|
|
|
360
419
|
e
|
|
361
420
|
);
|
|
362
421
|
}
|
|
363
|
-
function
|
|
422
|
+
function B(e) {
|
|
364
423
|
if (!e || typeof e != "object")
|
|
365
424
|
throw new Error("Invalid GeoVideo manifest");
|
|
366
425
|
const t = e;
|
|
@@ -373,7 +432,7 @@ function L(e) {
|
|
|
373
432
|
if (!Array.isArray(t.bounds) || t.bounds.length !== 4)
|
|
374
433
|
throw new Error("Invalid GeoVideo manifest bounds");
|
|
375
434
|
const [r, n, a, i] = t.bounds.map(
|
|
376
|
-
(l,
|
|
435
|
+
(l, m) => p(l, `bounds[${m}]`)
|
|
377
436
|
);
|
|
378
437
|
if (n < -90 || i > 90 || n >= i || r === a)
|
|
379
438
|
throw new Error("Invalid GeoVideo geographic bounds");
|
|
@@ -381,70 +440,70 @@ function L(e) {
|
|
|
381
440
|
if (!s || typeof s.url != "string" || !s.url)
|
|
382
441
|
throw new Error("Invalid GeoVideo media");
|
|
383
442
|
for (const l of ["width", "height", "fps", "durationSeconds"])
|
|
384
|
-
if (
|
|
443
|
+
if (p(s[l], `media.${l}`) <= 0)
|
|
385
444
|
throw new Error(`Invalid GeoVideo media.${l}`);
|
|
386
445
|
const o = t.encoding;
|
|
387
446
|
if (!o || o.bits !== 8 || o.colorSpace !== "bt709" || o.colorRange !== "limited" && o.colorRange !== "full")
|
|
388
447
|
throw new Error("Invalid GeoVideo encoding");
|
|
389
|
-
const d =
|
|
448
|
+
const d = p(o.codeMin, "encoding.codeMin"), c = p(o.codeMax, "encoding.codeMax");
|
|
390
449
|
if (d < 0 || c > 255 || d >= c)
|
|
391
450
|
throw new Error("Invalid GeoVideo code range");
|
|
392
|
-
let
|
|
451
|
+
let f = s.height;
|
|
393
452
|
if (o.kind === "scalar-luma") {
|
|
394
|
-
if (o.transfer !== "linear" ||
|
|
453
|
+
if (o.transfer !== "linear" && o.transfer !== "log10-1p9" || p(o.valueMin, "encoding.valueMin") >= p(o.valueMax, "encoding.valueMax"))
|
|
395
454
|
throw new Error("Invalid GeoVideo scalar-luma encoding");
|
|
396
455
|
} else if (o.kind === "vector-luma") {
|
|
397
|
-
if (o.transfer !== "linear" && o.transfer !== "sqrt" || o.layout !== "stacked-uv" ||
|
|
456
|
+
if (o.transfer !== "linear" && o.transfer !== "sqrt" || o.layout !== "stacked-uv" || p(o.valueDomain, "encoding.valueDomain") <= 0 || s.height % 2 !== 0)
|
|
398
457
|
throw new Error("Invalid GeoVideo vector-luma encoding");
|
|
399
|
-
|
|
458
|
+
f = s.height / 2;
|
|
400
459
|
} else
|
|
401
460
|
throw new Error("Unsupported GeoVideo encoding");
|
|
402
461
|
const u = t.mask;
|
|
403
|
-
if (!u || u.kind !== "static-validity" || typeof u.url != "string" || !u.url ||
|
|
462
|
+
if (!u || u.kind !== "static-validity" || typeof u.url != "string" || !u.url || p(u.width, "mask.width") !== s.width || p(u.height, "mask.height") !== f || p(u.threshold, "mask.threshold") < 0 || u.threshold > 1)
|
|
404
463
|
throw new Error("Invalid GeoVideo static mask");
|
|
405
464
|
if (t.timeline?.kind === "range") {
|
|
406
|
-
const l =
|
|
407
|
-
if (
|
|
465
|
+
const l = x(t.timeline.dateStart, "timeline.dateStart");
|
|
466
|
+
if (x(t.timeline.dateEnd, "timeline.dateEnd") <= l)
|
|
408
467
|
throw new Error("GeoVideo timeline end must follow start");
|
|
409
468
|
if (t.timeline.interpolation !== "linear" && t.timeline.interpolation !== "nearest")
|
|
410
469
|
throw new Error("Invalid GeoVideo interpolation");
|
|
411
470
|
} else if (t.timeline?.kind === "snapshot-loop")
|
|
412
|
-
|
|
471
|
+
x(t.timeline.date, "timeline.date");
|
|
413
472
|
else if (t.timeline?.kind === "sample-sequence") {
|
|
414
473
|
if (!Array.isArray(t.timeline.values) || t.timeline.values.length === 0)
|
|
415
474
|
throw new Error("GeoVideo sample sequence must contain values");
|
|
416
475
|
const l = t.timeline.values.map(
|
|
417
|
-
(
|
|
476
|
+
(m, T) => x(m, `timeline.values[${T}]`)
|
|
418
477
|
);
|
|
419
|
-
if (l.some((
|
|
478
|
+
if (l.some((m, T) => T > 0 && m <= l[T - 1]))
|
|
420
479
|
throw new Error(
|
|
421
480
|
"GeoVideo sample sequence values must be strictly increasing"
|
|
422
481
|
);
|
|
423
482
|
} else
|
|
424
483
|
throw new Error("Invalid GeoVideo timeline");
|
|
425
|
-
const
|
|
426
|
-
if (!Array.isArray(
|
|
484
|
+
const h = t.style?.colorDomain;
|
|
485
|
+
if (!Array.isArray(h) || h.length !== 2 || !h.every(Number.isFinite) || h[0] >= h[1])
|
|
427
486
|
throw new Error("Invalid GeoVideo color domain");
|
|
428
487
|
if (!S(t.id) || !t.provenance || !S(t.provenance.catalogEntryId) || !S(t.provenance.inputSourceId) || !Array.isArray(t.provenance.variables) || t.provenance.variables.length === 0)
|
|
429
488
|
throw new Error("Invalid GeoVideo provenance");
|
|
430
489
|
return { ...t, bounds: [r, n, a, i] };
|
|
431
490
|
}
|
|
432
|
-
async function
|
|
491
|
+
async function Ce(e, t) {
|
|
433
492
|
if (typeof e != "string")
|
|
434
|
-
return
|
|
493
|
+
return B(e);
|
|
435
494
|
const r = await fetch(e, { signal: t });
|
|
436
495
|
if (!r.ok)
|
|
437
496
|
throw new Error(
|
|
438
497
|
`GeoVideo manifest request failed (${r.status}): ${e}`
|
|
439
498
|
);
|
|
440
|
-
const n = await r.json(), a =
|
|
499
|
+
const n = await r.json(), a = B(n), i = typeof document < "u" ? new URL(e, document.baseURI).href : e;
|
|
441
500
|
return {
|
|
442
501
|
...a,
|
|
443
502
|
media: { ...a.media, url: new URL(a.media.url, i).href },
|
|
444
503
|
mask: { ...a.mask, url: new URL(a.mask.url, i).href }
|
|
445
504
|
};
|
|
446
505
|
}
|
|
447
|
-
function
|
|
506
|
+
function A(e) {
|
|
448
507
|
if (e.timeline.kind === "snapshot-loop")
|
|
449
508
|
return [new Date(e.timeline.date).getTime()];
|
|
450
509
|
if (e.timeline.kind === "sample-sequence")
|
|
@@ -458,17 +517,17 @@ function _(e) {
|
|
|
458
517
|
(a, i) => t + (r - t) * i / (n - 1)
|
|
459
518
|
);
|
|
460
519
|
}
|
|
461
|
-
function
|
|
520
|
+
function Ne(e) {
|
|
462
521
|
return e.timeline.kind === "sample-sequence" ? e.timeline.values.length / e.media.durationSeconds : e.media.fps;
|
|
463
522
|
}
|
|
464
|
-
function
|
|
465
|
-
return t /
|
|
523
|
+
function Ut(e, t) {
|
|
524
|
+
return t / Ne(e);
|
|
466
525
|
}
|
|
467
|
-
function
|
|
526
|
+
function Le(e, t) {
|
|
468
527
|
if (e.timeline.kind === "snapshot-loop")
|
|
469
528
|
return 0;
|
|
470
529
|
if (e.timeline.kind === "sample-sequence") {
|
|
471
|
-
const i =
|
|
530
|
+
const i = A(e);
|
|
472
531
|
let s = 0;
|
|
473
532
|
for (let d = 1; d < i.length; d += 1)
|
|
474
533
|
Math.abs(i[d] - t) < Math.abs(i[s] - t) && (s = d);
|
|
@@ -476,22 +535,22 @@ function ye(e, t) {
|
|
|
476
535
|
return s * o + Math.min(o / 2, 0.5 / e.media.fps);
|
|
477
536
|
}
|
|
478
537
|
const r = new Date(e.timeline.dateStart).getTime(), n = new Date(e.timeline.dateEnd).getTime();
|
|
479
|
-
return Math.max(0, Math.min(1, (t - r) / (n - r))) *
|
|
538
|
+
return Math.max(0, Math.min(1, (t - r) / (n - r))) * W(e);
|
|
480
539
|
}
|
|
481
|
-
function
|
|
540
|
+
function vt(e, t) {
|
|
482
541
|
if (e.timeline.kind === "snapshot-loop")
|
|
483
542
|
return new Date(e.timeline.date).getTime();
|
|
484
543
|
if (e.timeline.kind === "sample-sequence") {
|
|
485
|
-
const s =
|
|
544
|
+
const s = A(e), o = e.media.durationSeconds / s.length, d = Math.floor((t + 0.25 / e.media.fps) / o);
|
|
486
545
|
return s[Math.max(0, Math.min(s.length - 1, d))];
|
|
487
546
|
}
|
|
488
|
-
const r = new Date(e.timeline.dateStart).getTime(), n = new Date(e.timeline.dateEnd).getTime(), a =
|
|
547
|
+
const r = new Date(e.timeline.dateStart).getTime(), n = new Date(e.timeline.dateEnd).getTime(), a = W(e), i = a > 0 ? Math.max(0, Math.min(1, t / a)) : 0;
|
|
489
548
|
return r + (n - r) * i;
|
|
490
549
|
}
|
|
491
|
-
function
|
|
550
|
+
function W(e) {
|
|
492
551
|
return Math.max(0, e.media.durationSeconds - 1 / e.media.fps);
|
|
493
552
|
}
|
|
494
|
-
function
|
|
553
|
+
function Ve(e, t) {
|
|
495
554
|
const r = new Uint8Array(e.length / 4);
|
|
496
555
|
for (let n = 0; n < r.length; n++) {
|
|
497
556
|
const a = e[n * 4];
|
|
@@ -499,7 +558,7 @@ function Se(e, t) {
|
|
|
499
558
|
}
|
|
500
559
|
return r;
|
|
501
560
|
}
|
|
502
|
-
class
|
|
561
|
+
class Be {
|
|
503
562
|
constructor() {
|
|
504
563
|
this.gl = null, this.texture = null, this.framebuffer = null;
|
|
505
564
|
}
|
|
@@ -530,44 +589,44 @@ class Ue {
|
|
|
530
589
|
return this.gl = n, this.texture = n.createTexture(), this.framebuffer = n.createFramebuffer(), n;
|
|
531
590
|
}
|
|
532
591
|
}
|
|
533
|
-
function
|
|
592
|
+
function X(e) {
|
|
534
593
|
const t = Math.max(4, Math.floor(e.length / 4 / 997) * 4);
|
|
535
594
|
for (let r = 3; r < e.length; r += t)
|
|
536
595
|
if (e[r] !== 0)
|
|
537
596
|
return !1;
|
|
538
597
|
return !0;
|
|
539
598
|
}
|
|
540
|
-
function
|
|
599
|
+
function E() {
|
|
541
600
|
return new DOMException("GeoVideo frame request was cancelled", "AbortError");
|
|
542
601
|
}
|
|
543
602
|
function R(e, t, r) {
|
|
544
603
|
return t ? t.aborted ? (e.catch(() => {
|
|
545
|
-
}), r?.(), Promise.reject(
|
|
604
|
+
}), r?.(), Promise.reject(E())) : new Promise((n, a) => {
|
|
546
605
|
const i = () => {
|
|
547
|
-
r?.(), a(
|
|
606
|
+
r?.(), a(E());
|
|
548
607
|
};
|
|
549
608
|
t.addEventListener("abort", i, { once: !0 }), e.then(n, a).finally(() => {
|
|
550
609
|
t.removeEventListener("abort", i);
|
|
551
610
|
});
|
|
552
611
|
}) : e;
|
|
553
612
|
}
|
|
554
|
-
function
|
|
613
|
+
function M(e, t) {
|
|
555
614
|
return new Promise(
|
|
556
615
|
(r) => e.addEventListener(t, () => r(), { once: !0 })
|
|
557
616
|
);
|
|
558
617
|
}
|
|
559
|
-
const
|
|
560
|
-
function
|
|
618
|
+
const Xe = 250;
|
|
619
|
+
function Oe(e) {
|
|
561
620
|
return "requestVideoFrameCallback" in e ? Promise.race([
|
|
562
621
|
new Promise(
|
|
563
622
|
(t) => e.requestVideoFrameCallback(() => t())
|
|
564
623
|
),
|
|
565
|
-
new Promise((t) => setTimeout(t,
|
|
624
|
+
new Promise((t) => setTimeout(t, Xe))
|
|
566
625
|
]) : Promise.resolve();
|
|
567
626
|
}
|
|
568
|
-
class
|
|
627
|
+
class H {
|
|
569
628
|
constructor(t, r, n = {}) {
|
|
570
|
-
this.reader = new
|
|
629
|
+
this.reader = new Be(), this.video = null, this.maskCodes = null, this.initPromise = null, this.presented = !1, this.primed = !1, this.queue = Promise.resolve(), this.frames = /* @__PURE__ */ new Map(), this.pending = /* @__PURE__ */ new Set(), this.manifest = t, this.planes = r, this.cacheSize = Math.max(1, n.cacheSize ?? 3), this.width = t.media.width, this.height = t.media.height / r, this.times = Float64Array.from(A(t));
|
|
571
630
|
}
|
|
572
631
|
/** Static validity, one 8-bit value per grid cell; null before init(). */
|
|
573
632
|
get mask() {
|
|
@@ -576,11 +635,11 @@ class q {
|
|
|
576
635
|
/** Luma codes of the presented frame, or null when it is blank. */
|
|
577
636
|
readCodes(t, r) {
|
|
578
637
|
const n = this.reader.read(t, this.width, r);
|
|
579
|
-
return
|
|
638
|
+
return X(n) ? null : Ve(n, this.manifest.encoding.colorRange);
|
|
580
639
|
}
|
|
581
640
|
/** True when the decoder exposed no pixels; reads back one row only. */
|
|
582
641
|
isBlank(t) {
|
|
583
|
-
return
|
|
642
|
+
return X(this.reader.read(t, this.width, 1));
|
|
584
643
|
}
|
|
585
644
|
init() {
|
|
586
645
|
return this.initPromise ??= this.load().catch((t) => {
|
|
@@ -604,7 +663,7 @@ class q {
|
|
|
604
663
|
frame(t, r = {}) {
|
|
605
664
|
const { signal: n } = r;
|
|
606
665
|
if (n?.aborted)
|
|
607
|
-
return Promise.reject(
|
|
666
|
+
return Promise.reject(E());
|
|
608
667
|
let a = this.frames.get(t);
|
|
609
668
|
if (a ? (this.frames.delete(t), this.frames.set(t, a)) : a = this.enqueue(t), a.settled)
|
|
610
669
|
return a.promise;
|
|
@@ -613,7 +672,7 @@ class q {
|
|
|
613
672
|
}
|
|
614
673
|
enqueue(t) {
|
|
615
674
|
const r = new AbortController(), n = this.queue.then(
|
|
616
|
-
() => r.signal.aborted ? Promise.reject(
|
|
675
|
+
() => r.signal.aborted ? Promise.reject(E()) : this.decode(t, r.signal)
|
|
617
676
|
);
|
|
618
677
|
this.queue = n.catch(() => {
|
|
619
678
|
});
|
|
@@ -683,8 +742,8 @@ class q {
|
|
|
683
742
|
async presentFrame(t, r) {
|
|
684
743
|
if (this.presented && Math.abs(t.currentTime - r) <= 1e-3 && !t.seeking)
|
|
685
744
|
return;
|
|
686
|
-
const n =
|
|
687
|
-
t.currentTime = r, await a, t.readyState < HTMLMediaElement.HAVE_CURRENT_DATA && await Promise.race([
|
|
745
|
+
const n = Oe(t), a = M(t, "seeked");
|
|
746
|
+
t.currentTime = r, await a, t.readyState < HTMLMediaElement.HAVE_CURRENT_DATA && await Promise.race([M(t, "loadeddata"), M(t, "canplay")]), await n, this.presented = !0;
|
|
688
747
|
}
|
|
689
748
|
/**
|
|
690
749
|
* Some mobile browsers expose no decoded pixels to WebGL until playback
|
|
@@ -705,19 +764,19 @@ class q {
|
|
|
705
764
|
*/
|
|
706
765
|
async decode(t, r) {
|
|
707
766
|
if (r.aborted)
|
|
708
|
-
throw
|
|
767
|
+
throw E();
|
|
709
768
|
await this.init();
|
|
710
769
|
const n = this.video, a = this.maskCodes;
|
|
711
770
|
if (r.aborted || !n || !a)
|
|
712
|
-
throw
|
|
713
|
-
const i =
|
|
771
|
+
throw E();
|
|
772
|
+
const i = Le(this.manifest, this.times[t]);
|
|
714
773
|
if (await this.presentFrame(n, i), r.aborted || n !== this.video)
|
|
715
|
-
throw
|
|
774
|
+
throw E();
|
|
716
775
|
const s = this.height * this.planes;
|
|
717
776
|
let o = await this.capture(n, s, a);
|
|
718
777
|
if (o === null && !this.primed) {
|
|
719
778
|
if (await this.primeDecoder(n), await this.presentFrame(n, i), r.aborted || n !== this.video)
|
|
720
|
-
throw
|
|
779
|
+
throw E();
|
|
721
780
|
o = await this.capture(n, s, a);
|
|
722
781
|
}
|
|
723
782
|
if (o === null)
|
|
@@ -725,13 +784,14 @@ class q {
|
|
|
725
784
|
return o;
|
|
726
785
|
}
|
|
727
786
|
}
|
|
728
|
-
function
|
|
787
|
+
function St(e) {
|
|
729
788
|
return {
|
|
730
789
|
codeRange: [e.codeMin / 255, e.codeMax / 255],
|
|
731
|
-
valueRange: [e.valueMin, e.valueMax]
|
|
790
|
+
valueRange: [e.valueMin, e.valueMax],
|
|
791
|
+
transfer: e.transfer === "log10-1p9" ? 1 : 0
|
|
732
792
|
};
|
|
733
793
|
}
|
|
734
|
-
class
|
|
794
|
+
class qe extends H {
|
|
735
795
|
constructor(t, r = {}) {
|
|
736
796
|
if (t.encoding.kind !== "scalar-luma")
|
|
737
797
|
throw new Error("GeoVideoScalarSource requires a scalar-luma manifest");
|
|
@@ -744,11 +804,11 @@ class ke extends q {
|
|
|
744
804
|
});
|
|
745
805
|
}
|
|
746
806
|
}
|
|
747
|
-
function
|
|
807
|
+
function $e(e, t) {
|
|
748
808
|
let r = (e - t.codeMin) / (t.codeMax - t.codeMin) * 2 - 1;
|
|
749
809
|
return r = Math.max(-1, Math.min(1, r)), t.transfer === "sqrt" && (r = Math.sign(r) * r * r), r * t.valueDomain;
|
|
750
810
|
}
|
|
751
|
-
function
|
|
811
|
+
function We(e, t, r, n) {
|
|
752
812
|
const a = t.length;
|
|
753
813
|
if (e.length !== 2 * a)
|
|
754
814
|
throw new Error(
|
|
@@ -756,15 +816,15 @@ function Ge(e, t, r, n) {
|
|
|
756
816
|
);
|
|
757
817
|
const i = new Float32Array(256);
|
|
758
818
|
for (let c = 0; c < 256; c++)
|
|
759
|
-
i[c] =
|
|
819
|
+
i[c] = $e(c, n);
|
|
760
820
|
const s = r * 255, o = new Float32Array(a), d = new Float32Array(a);
|
|
761
821
|
for (let c = 0; c < a; c++) {
|
|
762
|
-
const
|
|
763
|
-
o[c] =
|
|
822
|
+
const f = t[c] >= s;
|
|
823
|
+
o[c] = f ? i[e[c]] : NaN, d[c] = f ? i[e[a + c]] : NaN;
|
|
764
824
|
}
|
|
765
825
|
return { u: o, v: d };
|
|
766
826
|
}
|
|
767
|
-
class
|
|
827
|
+
class He extends H {
|
|
768
828
|
constructor(t, r = {}) {
|
|
769
829
|
if (t.encoding.kind !== "vector-luma")
|
|
770
830
|
throw new Error("GeoVideoVectorSource requires a vector-luma manifest");
|
|
@@ -775,11 +835,11 @@ class Ie extends q {
|
|
|
775
835
|
vertical: new Float32Array([0]),
|
|
776
836
|
latitude: Float32Array.from(
|
|
777
837
|
{ length: this.height },
|
|
778
|
-
(c,
|
|
838
|
+
(c, f) => s - (f + 0.5) * d
|
|
779
839
|
),
|
|
780
840
|
longitude: Float32Array.from(
|
|
781
841
|
{ length: this.width },
|
|
782
|
-
(c,
|
|
842
|
+
(c, f) => n + (f + 0.5) * o
|
|
783
843
|
)
|
|
784
844
|
};
|
|
785
845
|
}
|
|
@@ -831,7 +891,7 @@ class Ie extends q {
|
|
|
831
891
|
/** u/v codes are written into luma: read back, then decoded on the CPU. */
|
|
832
892
|
async capture(t, r, n) {
|
|
833
893
|
const a = this.readCodes(t, r);
|
|
834
|
-
return a ?
|
|
894
|
+
return a ? We(
|
|
835
895
|
a,
|
|
836
896
|
n,
|
|
837
897
|
this.manifest.mask.threshold,
|
|
@@ -839,7 +899,7 @@ class Ie extends q {
|
|
|
839
899
|
) : null;
|
|
840
900
|
}
|
|
841
901
|
}
|
|
842
|
-
function
|
|
902
|
+
function je(e, t, r = {}) {
|
|
843
903
|
const [n, a] = r.range ?? [-1 / 0, 1 / 0], i = [...e].sort((o, d) => o.start - d.start), s = i.find(
|
|
844
904
|
(o) => o.start > t && o.start <= a
|
|
845
905
|
) ?? (r.loop ? i.find(
|
|
@@ -847,7 +907,7 @@ function ge(e, t, r = {}) {
|
|
|
847
907
|
) : void 0);
|
|
848
908
|
return s ? { chunk: s, time: Math.max(s.start, n) } : null;
|
|
849
909
|
}
|
|
850
|
-
function
|
|
910
|
+
function Ye(e, t) {
|
|
851
911
|
let r = null, n = -1 / 0;
|
|
852
912
|
for (const a of t) {
|
|
853
913
|
const i = Math.min(e.end, a.end) - Math.max(e.start, a.start);
|
|
@@ -855,7 +915,7 @@ function Ce(e, t) {
|
|
|
855
915
|
}
|
|
856
916
|
return r;
|
|
857
917
|
}
|
|
858
|
-
function
|
|
918
|
+
function ze(e) {
|
|
859
919
|
return {
|
|
860
920
|
width: e.mask.width,
|
|
861
921
|
height: e.mask.height,
|
|
@@ -863,11 +923,11 @@ function Ne(e) {
|
|
|
863
923
|
rowOrder: "north-to-south"
|
|
864
924
|
};
|
|
865
925
|
}
|
|
866
|
-
function
|
|
867
|
-
return e.encoding.kind === "vector-luma" ? new
|
|
926
|
+
function Ke(e, t = {}) {
|
|
927
|
+
return e.encoding.kind === "vector-luma" ? new He(e, t) : new qe(e, t);
|
|
868
928
|
}
|
|
869
|
-
const
|
|
870
|
-
function
|
|
929
|
+
const Je = 3, Qe = 3, Ze = 0.6, et = 1.5;
|
|
930
|
+
function tt(e, t) {
|
|
871
931
|
const r = e.length - 1;
|
|
872
932
|
if (t <= e[0])
|
|
873
933
|
return { step: 0, fraction: 0 };
|
|
@@ -880,7 +940,7 @@ function qe(e, t) {
|
|
|
880
940
|
}
|
|
881
941
|
return { step: n, fraction: (t - e[n]) / (e[a] - e[n]) };
|
|
882
942
|
}
|
|
883
|
-
function
|
|
943
|
+
function rt(e) {
|
|
884
944
|
const t = new AbortController();
|
|
885
945
|
if (!e)
|
|
886
946
|
return { controller: t, unlink: () => {
|
|
@@ -891,14 +951,14 @@ function $e(e) {
|
|
|
891
951
|
unlink: () => e.removeEventListener("abort", r)
|
|
892
952
|
};
|
|
893
953
|
}
|
|
894
|
-
class
|
|
954
|
+
class Mt {
|
|
895
955
|
constructor(t) {
|
|
896
956
|
this.manifests = /* @__PURE__ */ new Map(), this.open = /* @__PURE__ */ new Map(), this.id = t.id, this.chunks = t.chunks.filter(
|
|
897
957
|
(r) => Number.isFinite(r.start) && Number.isFinite(r.end) && r.end >= r.start
|
|
898
|
-
).sort((r, n) => r.start - n.start), this.maxOpenChunks = Math.max(2, t.maxOpenChunks ??
|
|
958
|
+
).sort((r, n) => r.start - n.start), this.maxOpenChunks = Math.max(2, t.maxOpenChunks ?? Je), this.frameCacheSize = Math.max(
|
|
899
959
|
1,
|
|
900
|
-
t.frameCacheSize ??
|
|
901
|
-
), this.prefetchAt = t.prefetchAt ??
|
|
960
|
+
t.frameCacheSize ?? Qe
|
|
961
|
+
), this.prefetchAt = t.prefetchAt ?? Ze, this.maxGap = t.maxGap, this.loadManifest = t.loadManifest ?? Ce, this.createFrameSource = t.createFrameSource ?? ((r, n) => Ke(
|
|
902
962
|
r,
|
|
903
963
|
n
|
|
904
964
|
));
|
|
@@ -916,12 +976,12 @@ class Et {
|
|
|
916
976
|
/** Every step time of the archive; loads all chunk manifests. */
|
|
917
977
|
async steps(t = {}) {
|
|
918
978
|
if (t.signal?.aborted)
|
|
919
|
-
throw
|
|
979
|
+
throw E();
|
|
920
980
|
const r = await R(
|
|
921
981
|
Promise.all(this.chunks.map((n) => this.manifest(n))),
|
|
922
982
|
t.signal
|
|
923
983
|
);
|
|
924
|
-
return Float64Array.from(r.flatMap(
|
|
984
|
+
return Float64Array.from(r.flatMap(A));
|
|
925
985
|
}
|
|
926
986
|
/**
|
|
927
987
|
* The frames bracketing `time`, decoded; null out of coverage (before the
|
|
@@ -930,39 +990,39 @@ class Et {
|
|
|
930
990
|
async sample(t, r = {}) {
|
|
931
991
|
const { signal: n } = r, a = r.mode ?? "interpolate";
|
|
932
992
|
if (n?.aborted)
|
|
933
|
-
throw
|
|
993
|
+
throw E();
|
|
934
994
|
const i = this.chunkIndexAt(t);
|
|
935
995
|
if (i < 0)
|
|
936
996
|
return null;
|
|
937
|
-
const s = [], { controller: o, unlink: d } =
|
|
997
|
+
const s = [], { controller: o, unlink: d } = rt(n);
|
|
938
998
|
try {
|
|
939
|
-
const c = this.acquire(this.chunks[i], s),
|
|
940
|
-
let
|
|
999
|
+
const c = this.acquire(this.chunks[i], s), f = await R(c.ready, o.signal), { times: u } = f;
|
|
1000
|
+
let h;
|
|
941
1001
|
if (t <= u[u.length - 1]) {
|
|
942
|
-
const { step:
|
|
943
|
-
|
|
1002
|
+
const { step: b, fraction: w } = tt(u, t);
|
|
1003
|
+
h = a === "discrete" || w === 0 ? [c, b, c, b, 0] : [c, b, c, b + 1, w];
|
|
944
1004
|
} else {
|
|
945
|
-
const
|
|
946
|
-
if (!
|
|
1005
|
+
const b = this.chunks[i + 1];
|
|
1006
|
+
if (!b)
|
|
947
1007
|
return null;
|
|
948
|
-
const w = this.acquire(
|
|
949
|
-
if (
|
|
1008
|
+
const w = this.acquire(b, s), G = await R(w.ready, o.signal), F = u.length - 1, U = u[F], v = G.times[0];
|
|
1009
|
+
if (v - U > this.gapLimit(u, G.times))
|
|
950
1010
|
return null;
|
|
951
|
-
|
|
1011
|
+
h = a === "discrete" ? [c, F, c, F, 0] : t >= v ? [w, 0, w, 0, 0] : [c, F, w, 0, (t - U) / (v - U)];
|
|
952
1012
|
}
|
|
953
|
-
const [l,
|
|
954
|
-
k || P.push(this.frame(
|
|
955
|
-
let
|
|
1013
|
+
const [l, m, T, y, _] = h, k = l === T && m === y, P = [this.frame(l, m, o.signal)];
|
|
1014
|
+
k || P.push(this.frame(T, y, o.signal));
|
|
1015
|
+
let D;
|
|
956
1016
|
try {
|
|
957
|
-
|
|
958
|
-
} catch (
|
|
959
|
-
throw o.abort(),
|
|
1017
|
+
D = await Promise.all(P);
|
|
1018
|
+
} catch (b) {
|
|
1019
|
+
throw o.abort(), b;
|
|
960
1020
|
}
|
|
961
1021
|
return this.prefetchAfter(i, t), {
|
|
962
1022
|
time: t,
|
|
963
|
-
a:
|
|
964
|
-
b:
|
|
965
|
-
mix:
|
|
1023
|
+
a: D[0],
|
|
1024
|
+
b: D[k ? 0 : 1],
|
|
1025
|
+
mix: _
|
|
966
1026
|
};
|
|
967
1027
|
} finally {
|
|
968
1028
|
d();
|
|
@@ -1001,7 +1061,7 @@ class Et {
|
|
|
1001
1061
|
t.length > 1 ? t[t.length - 1] - t[t.length - 2] : 0,
|
|
1002
1062
|
r.length > 1 ? r[1] - r[0] : 0
|
|
1003
1063
|
], a = Math.max(...n);
|
|
1004
|
-
return a > 0 ? a *
|
|
1064
|
+
return a > 0 ? a * et : -1 / 0;
|
|
1005
1065
|
}
|
|
1006
1066
|
prefetchAfter(t, r) {
|
|
1007
1067
|
const n = this.chunks[t], a = this.chunks[t + 1], i = n.end - n.start, s = i > 0 ? (r - n.start) / i : 1;
|
|
@@ -1034,11 +1094,11 @@ class Et {
|
|
|
1034
1094
|
};
|
|
1035
1095
|
n.ready = this.manifest(t).then((a) => {
|
|
1036
1096
|
if (n.released)
|
|
1037
|
-
throw
|
|
1097
|
+
throw E();
|
|
1038
1098
|
return n.opened = {
|
|
1039
1099
|
manifest: a,
|
|
1040
|
-
times: Float64Array.from(
|
|
1041
|
-
grid:
|
|
1100
|
+
times: Float64Array.from(A(a)),
|
|
1101
|
+
grid: ze(a),
|
|
1042
1102
|
source: this.createFrameSource(a, {
|
|
1043
1103
|
cacheSize: this.frameCacheSize
|
|
1044
1104
|
})
|
|
@@ -1055,7 +1115,7 @@ class Et {
|
|
|
1055
1115
|
n
|
|
1056
1116
|
);
|
|
1057
1117
|
if (t.released)
|
|
1058
|
-
throw
|
|
1118
|
+
throw E();
|
|
1059
1119
|
const d = await o.frame(r, { signal: n });
|
|
1060
1120
|
return {
|
|
1061
1121
|
key: `${this.id}/${t.chunk.key}/${r}`,
|
|
@@ -1080,7 +1140,7 @@ class Et {
|
|
|
1080
1140
|
t.released = !0, t.prefetch?.abort(), t.prefetch = null, t.opened?.source.release(), t.opened = null, this.open.get(t.chunk.key) === t && this.open.delete(t.chunk.key);
|
|
1081
1141
|
}
|
|
1082
1142
|
}
|
|
1083
|
-
function
|
|
1143
|
+
function g(e) {
|
|
1084
1144
|
const { start: t, end: r } = e.temporal ?? {};
|
|
1085
1145
|
return {
|
|
1086
1146
|
source: e,
|
|
@@ -1088,48 +1148,111 @@ function D(e) {
|
|
|
1088
1148
|
end: Date.parse(r ?? t ?? "")
|
|
1089
1149
|
};
|
|
1090
1150
|
}
|
|
1091
|
-
function
|
|
1092
|
-
const n = e.filter((i) => i.id === t.id && i.temporal?.start != null).map(
|
|
1151
|
+
function gt(e, t, r = {}) {
|
|
1152
|
+
const n = e.filter((i) => i.id === t.id && i.temporal?.start != null).map(g), a = je(
|
|
1093
1153
|
n,
|
|
1094
1154
|
Date.parse(t.temporal?.end ?? ""),
|
|
1095
1155
|
r
|
|
1096
1156
|
);
|
|
1097
1157
|
return a ? { source: a.chunk.source, time: a.time } : null;
|
|
1098
1158
|
}
|
|
1099
|
-
function
|
|
1100
|
-
return
|
|
1159
|
+
function kt(e, t) {
|
|
1160
|
+
return Ye(g(e), t.map(g))?.source ?? null;
|
|
1101
1161
|
}
|
|
1102
|
-
|
|
1162
|
+
const nt = /^P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/;
|
|
1163
|
+
function at(e) {
|
|
1164
|
+
return e instanceof Date ? e.getTime() : typeof e == "number" ? e : new Date(e).getTime();
|
|
1165
|
+
}
|
|
1166
|
+
function O(e, t) {
|
|
1167
|
+
const r = at(e);
|
|
1168
|
+
if (!Number.isFinite(r))
|
|
1169
|
+
throw new Error(`Invalid ${t}`);
|
|
1170
|
+
return r;
|
|
1171
|
+
}
|
|
1172
|
+
function j(e, t) {
|
|
1173
|
+
const r = t.match(nt);
|
|
1174
|
+
if (!r)
|
|
1175
|
+
throw new Error(`Invalid trailing time duration: ${t}`);
|
|
1176
|
+
const n = r.slice(1).map((_) => Number(_ ?? 0));
|
|
1177
|
+
if (!n.some((_) => _ > 0))
|
|
1178
|
+
throw new Error("Trailing time duration must be positive");
|
|
1179
|
+
const [a, i, s, o, d, c, f] = n, u = new Date(e), h = u.getUTCFullYear() * 12 + u.getUTCMonth() - a * 12 - i, l = Math.floor(h / 12), m = (h % 12 + 12) % 12, T = new Date(Date.UTC(l, m + 1, 0)).getUTCDate();
|
|
1180
|
+
return Date.UTC(
|
|
1181
|
+
l,
|
|
1182
|
+
m,
|
|
1183
|
+
Math.min(u.getUTCDate(), T),
|
|
1184
|
+
u.getUTCHours(),
|
|
1185
|
+
u.getUTCMinutes(),
|
|
1186
|
+
u.getUTCSeconds(),
|
|
1187
|
+
u.getUTCMilliseconds()
|
|
1188
|
+
) - (((s * 7 + o) * 24 + d) * 60 + c) * 6e4 - f * 1e3;
|
|
1189
|
+
}
|
|
1190
|
+
function Pt(e, [t, r]) {
|
|
1191
|
+
let n = t, a = r;
|
|
1192
|
+
if (typeof e.trailing == "string" ? n = j(r, e.trailing) : (e.start != null && (n = O(e.start, "time range start")), e.end != null && (a = O(e.end, "time range end"))), n > a)
|
|
1193
|
+
throw new Error("Time range start must not follow its end");
|
|
1194
|
+
return [Math.max(t, n), Math.min(r, a)];
|
|
1195
|
+
}
|
|
1196
|
+
const it = (e) => typeof e == "object" && e !== null && !Array.isArray(e);
|
|
1197
|
+
function Gt(e, t) {
|
|
1198
|
+
if (!it(e))
|
|
1199
|
+
throw new Error(`${t} must be an object`);
|
|
1200
|
+
for (const i of Object.keys(e))
|
|
1201
|
+
if (i !== "start" && i !== "end" && i !== "trailing")
|
|
1202
|
+
throw new Error(`${t}.${i} is not a time range key`);
|
|
1203
|
+
if (e.trailing !== void 0) {
|
|
1204
|
+
if (e.start !== void 0 || e.end !== void 0)
|
|
1205
|
+
throw new Error(`${t}.trailing excludes start and end`);
|
|
1206
|
+
if (typeof e.trailing != "string")
|
|
1207
|
+
throw new Error(`${t}.trailing must be an ISO 8601 duration`);
|
|
1208
|
+
return j(0, e.trailing), { trailing: e.trailing };
|
|
1209
|
+
}
|
|
1210
|
+
const r = (i) => {
|
|
1211
|
+
const s = e[i];
|
|
1212
|
+
if (s !== void 0) {
|
|
1213
|
+
if (typeof s != "string" || !Number.isFinite(Date.parse(s)))
|
|
1214
|
+
throw new Error(`${t}.${i} is not a date`);
|
|
1215
|
+
return s;
|
|
1216
|
+
}
|
|
1217
|
+
}, n = r("start"), a = r("end");
|
|
1218
|
+
if (n !== void 0 && a !== void 0 && Date.parse(n) > Date.parse(a))
|
|
1219
|
+
throw new Error(`${t}.start must not follow its end`);
|
|
1220
|
+
return {
|
|
1221
|
+
...n !== void 0 && { start: n },
|
|
1222
|
+
...a !== void 0 && { end: a }
|
|
1223
|
+
};
|
|
1224
|
+
}
|
|
1225
|
+
function It(e) {
|
|
1103
1226
|
return e.type === "geovideo" && typeof e.indexUrl == "string";
|
|
1104
1227
|
}
|
|
1105
|
-
function
|
|
1228
|
+
function Ct(e, t) {
|
|
1106
1229
|
return e.id === t.id && (e.type !== "geovideo" || t.type !== "geovideo" || e.manifestUrl === t.manifestUrl);
|
|
1107
1230
|
}
|
|
1108
|
-
function
|
|
1231
|
+
function q(e) {
|
|
1109
1232
|
return typeof e == "string" && Number.isFinite(Date.parse(e));
|
|
1110
1233
|
}
|
|
1111
|
-
function
|
|
1234
|
+
function ot(e) {
|
|
1112
1235
|
const t = e;
|
|
1113
1236
|
if (!t || t.schemaVersion !== 1 || t.type !== "geovideo-index" || !Array.isArray(t.chunks))
|
|
1114
1237
|
throw new Error("Unsupported GeoVideo index");
|
|
1115
1238
|
for (const r of t.chunks)
|
|
1116
|
-
if (!
|
|
1239
|
+
if (!q(r?.start) || !q(r.end) || Date.parse(r.end) < Date.parse(r.start) || typeof r.manifestUrl != "string")
|
|
1117
1240
|
throw new Error("Invalid GeoVideo index chunk");
|
|
1118
1241
|
return t;
|
|
1119
1242
|
}
|
|
1120
|
-
async function
|
|
1243
|
+
async function Nt(e, t) {
|
|
1121
1244
|
const r = await fetch(e, { signal: t });
|
|
1122
1245
|
if (!r.ok)
|
|
1123
1246
|
throw new Error(
|
|
1124
1247
|
`GeoVideo index request failed (${r.status}): ${e}`
|
|
1125
1248
|
);
|
|
1126
|
-
return
|
|
1249
|
+
return ot(await r.json());
|
|
1127
1250
|
}
|
|
1128
|
-
function
|
|
1251
|
+
function st(e) {
|
|
1129
1252
|
return typeof document < "u" ? new URL(e, document.baseURI).href : e;
|
|
1130
1253
|
}
|
|
1131
|
-
function
|
|
1132
|
-
const r =
|
|
1254
|
+
function ct(e, t) {
|
|
1255
|
+
const r = st(t);
|
|
1133
1256
|
return e.chunks.map((n) => ({
|
|
1134
1257
|
key: n.key,
|
|
1135
1258
|
manifestUrl: new URL(n.manifestUrl, r).href,
|
|
@@ -1139,15 +1262,15 @@ function Ye(e, t) {
|
|
|
1139
1262
|
...n.provisional ? { provisional: !0 } : {}
|
|
1140
1263
|
}));
|
|
1141
1264
|
}
|
|
1142
|
-
function
|
|
1265
|
+
function dt(e, t, r) {
|
|
1143
1266
|
if (t.sourceId !== e.id || t.catalogEntryId !== r.id)
|
|
1144
1267
|
throw new Error(
|
|
1145
1268
|
`GeoVideo index identity does not match catalog entry/source: ${e.id}`
|
|
1146
1269
|
);
|
|
1147
1270
|
}
|
|
1148
|
-
function
|
|
1149
|
-
|
|
1150
|
-
const n =
|
|
1271
|
+
function Lt(e, t, r) {
|
|
1272
|
+
dt(e, t, r);
|
|
1273
|
+
const n = ct(t, e.indexUrl);
|
|
1151
1274
|
return t.chunks.map(
|
|
1152
1275
|
(a, i) => ({
|
|
1153
1276
|
id: e.id,
|
|
@@ -1165,50 +1288,55 @@ function _t(e, t, r) {
|
|
|
1165
1288
|
);
|
|
1166
1289
|
}
|
|
1167
1290
|
export {
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1291
|
+
ut as A,
|
|
1292
|
+
It as B,
|
|
1293
|
+
gt as C,
|
|
1294
|
+
Nt as D,
|
|
1295
|
+
Lt as E,
|
|
1296
|
+
Pt as F,
|
|
1297
|
+
He as G,
|
|
1298
|
+
B as H,
|
|
1299
|
+
Mt as I,
|
|
1300
|
+
H as J,
|
|
1301
|
+
qe as K,
|
|
1302
|
+
Te as L,
|
|
1303
|
+
dt as M,
|
|
1304
|
+
Ke as N,
|
|
1305
|
+
N as O,
|
|
1306
|
+
ke as P,
|
|
1307
|
+
ze as Q,
|
|
1308
|
+
ct as R,
|
|
1309
|
+
je as S,
|
|
1310
|
+
yt as T,
|
|
1311
|
+
kt as U,
|
|
1312
|
+
Ye as V,
|
|
1313
|
+
Gt as W,
|
|
1314
|
+
j as X,
|
|
1315
|
+
ot as Y,
|
|
1316
|
+
bt as a,
|
|
1317
|
+
wt as b,
|
|
1318
|
+
lt as c,
|
|
1319
|
+
mt as d,
|
|
1320
|
+
Et as e,
|
|
1321
|
+
Tt as f,
|
|
1322
|
+
Rt as g,
|
|
1323
|
+
ft as h,
|
|
1324
|
+
pt as i,
|
|
1325
|
+
ht as j,
|
|
1326
|
+
At as k,
|
|
1327
|
+
xt as l,
|
|
1328
|
+
Ce as m,
|
|
1329
|
+
St as n,
|
|
1330
|
+
Le as o,
|
|
1331
|
+
Fe as p,
|
|
1332
|
+
vt as q,
|
|
1333
|
+
De as r,
|
|
1334
|
+
_t as s,
|
|
1335
|
+
A as t,
|
|
1336
|
+
O as u,
|
|
1337
|
+
Dt as v,
|
|
1338
|
+
Ct as w,
|
|
1339
|
+
Ut as x,
|
|
1340
|
+
Ne as y,
|
|
1341
|
+
Ft as z
|
|
1214
1342
|
};
|