@fxi/zartigl 0.7.0 → 0.8.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 +32 -32
- package/dist/engine.d.ts +7 -0
- package/dist/engine.js +27 -26
- package/dist/{geovideo-index-CMGVia5M.js → geovideo-index-_qQ6iS2d.js} +257 -196
- package/dist/zartigl.d.ts +7 -0
- package/dist/zartigl.js +479 -476
- package/package.json +2 -1
|
@@ -1,29 +1,30 @@
|
|
|
1
|
-
const
|
|
2
|
-
thermal:
|
|
1
|
+
const W = { label: "Thermal", tags: ["sequential", "temperature"], colors: ["#042333", "#2c3395", "#744796", "#b15f82", "#eb7958", "#fbb43d", "#e8fa5b"] }, H = { label: "Haline", tags: ["sequential", "salinity"], colors: ["#2a186c", "#17568b", "#1a7e8f", "#22a785", "#55c666", "#aadc32", "#fde333"] }, Y = { label: "Solar", tags: ["sequential", "irradiance"], colors: ["#330f0b", "#6b2313", "#a83c12", "#d6621a", "#f3951e", "#f7c741", "#f9f871"] }, z = { label: "Ice", tags: ["sequential"], colors: ["#040d1a", "#123365", "#1c5f9e", "#2b8ece", "#62bde3", "#aaddf2", "#f2faff"] }, j = { label: "Deep", tags: ["sequential", "depth"], colors: ["#fdfecc", "#c8e59b", "#74c8a3", "#3194b0", "#2a5b8e", "#281a5e", "#0c0820"] }, K = { label: "RdYlBu", tags: ["diverging"], colors: ["#3288bd", "#66c2a5", "#abdda4", "#e6f598", "#fee08b", "#fdae61", "#f46d43", "#d53e4f"] }, J = { label: "Dense", tags: ["sequential"], colors: ["#e6f1f1", "#92c4ca", "#44929a", "#20627a", "#1a3c6a", "#211a50", "#0d0621"] }, Q = { label: "Algae", tags: ["sequential", "biology", "log"], colors: ["#d7f9d0", "#a2d595", "#64b463", "#129450", "#126e45", "#1a482f", "#122414"] }, Z = { label: "Oxygen", tags: ["sequential", "biology", "hypoxia"], colors: ["#09060f", "#5b1028", "#d43d2f", "#f39b3d", "#f3e7b3", "#79cbd1", "#176b9c"] }, ee = { label: "Matter", tags: ["sequential", "biology"], colors: ["#fdfecc", "#f2c98a", "#e07c4e", "#bc3754", "#8d1a6d", "#51156b", "#1c0c3f"] }, te = { label: "Viridis", tags: ["sequential", "perceptual"], colors: ["#440154", "#443983", "#31688e", "#21918c", "#35b779", "#90d743", "#fde725"] }, re = { label: "Plasma", tags: ["sequential", "perceptual"], colors: ["#0d0887", "#5e01a6", "#9c179e", "#cc4778", "#ed7953", "#fdb42f", "#f0f921"] }, ne = { label: "Cyclic", tags: ["cyclic", "direction"], colors: ["#2e22ea", "#b541fb", "#fc93c0", "#f1ee35", "#77c80d", "#458776", "#2c24e9"] }, ae = { label: "Tempo", tags: ["sequential"], colors: ["#fff6f4", "#c2d1b9", "#7db390", "#2a937f", "#156d73", "#1c455b", "#151d44"] }, ie = { label: "Turbid", tags: ["sequential", "biology", "log"], colors: ["#e9f5a0", "#c8c86e", "#a09845", "#786031", "#533324", "#341423", "#150d17"] }, oe = { label: "Speed", tags: ["sequential", "velocity"], colors: ["#fcfea4", "#d5e429", "#94c63e", "#52a657", "#2d8169", "#1d5b6d", "#0d3361"] }, se = { label: "Amp", tags: ["sequential"], colors: ["#f2f2f2", "#c0b8db", "#9180b6", "#6c4e9e", "#4e2e83", "#32185d", "#110a35"] }, ce = { label: "Balance", tags: ["diverging"], colors: ["#181c43", "#3066af", "#9bbcdd", "#f2f2f2", "#e07d53", "#b13626", "#2c0b0e"] }, de = { label: "Delta", tags: ["diverging"], colors: ["#0e3f31", "#20877b", "#99d4c1", "#f2f2f2", "#a1b0d4", "#3c5b9e", "#0d1938"] }, ue = { label: "Curl", tags: ["diverging"], colors: ["#152237", "#2471b3", "#8dbac4", "#f2f2f2", "#c79f84", "#a63827", "#270b17"] }, le = { label: "Gray", tags: ["sequential"], colors: ["#000000", "#252525", "#4d4d4d", "#7a7a7a", "#a8a8a8", "#d4d4d4", "#ffffff"] }, X = {
|
|
2
|
+
thermal: W,
|
|
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
|
-
|
|
4
|
+
haline: H,
|
|
5
|
+
solar: Y,
|
|
6
|
+
ice: z,
|
|
7
|
+
deep: j,
|
|
8
|
+
rdylbu: K,
|
|
9
|
+
dense: J,
|
|
10
|
+
algae: Q,
|
|
11
|
+
oxygen: Z,
|
|
12
|
+
matter: ee,
|
|
13
|
+
viridis: te,
|
|
14
|
+
plasma: re,
|
|
15
|
+
cyclic: ne,
|
|
16
|
+
tempo: ae,
|
|
17
|
+
turbid: ie,
|
|
18
|
+
speed: oe,
|
|
19
|
+
amp: se,
|
|
20
|
+
"heat-alert": { label: "Heat Alert", tags: ["sequential", "alpha"], colors: ["#fde72500", "#fde725cc", "#f8961e", "#e63946", "#9d0208", "#3a0007"] },
|
|
21
|
+
balance: ce,
|
|
22
|
+
delta: de,
|
|
23
|
+
curl: ue,
|
|
23
24
|
"mono-black": { label: "Black", tags: ["monochrome", "particles"], colors: ["#000000", "#000000"] },
|
|
24
25
|
"mono-white": { label: "White", tags: ["monochrome", "particles"], colors: ["#ffffff", "#ffffff"] },
|
|
25
26
|
"mono-pink": { label: "Pink", tags: ["monochrome", "particles"], colors: ["#ff2aa1", "#ff2aa1"] },
|
|
26
|
-
gray:
|
|
27
|
+
gray: le
|
|
27
28
|
};
|
|
28
29
|
function I(e) {
|
|
29
30
|
const t = {}, r = e.length - 1;
|
|
@@ -32,7 +33,7 @@ function I(e) {
|
|
|
32
33
|
}), t;
|
|
33
34
|
}
|
|
34
35
|
function fe(e, t) {
|
|
35
|
-
const r =
|
|
36
|
+
const r = X;
|
|
36
37
|
if (typeof e == "string") {
|
|
37
38
|
const n = r[e];
|
|
38
39
|
if (!n)
|
|
@@ -50,10 +51,10 @@ function fe(e, t) {
|
|
|
50
51
|
}
|
|
51
52
|
return e;
|
|
52
53
|
}
|
|
53
|
-
function
|
|
54
|
-
return Object.entries(
|
|
54
|
+
function Je() {
|
|
55
|
+
return Object.entries(X).map(([t, r]) => ({ id: t, ...r }));
|
|
55
56
|
}
|
|
56
|
-
function
|
|
57
|
+
function g(e, t, r) {
|
|
57
58
|
const n = e.createShader(t);
|
|
58
59
|
if (!n)
|
|
59
60
|
throw new Error("Failed to create shader");
|
|
@@ -63,18 +64,18 @@ function N(e, t, r) {
|
|
|
63
64
|
}
|
|
64
65
|
return n;
|
|
65
66
|
}
|
|
66
|
-
function
|
|
67
|
+
function Qe(e, t, r) {
|
|
67
68
|
const n = e.createProgram();
|
|
68
69
|
if (!n)
|
|
69
70
|
throw new Error("Failed to create program");
|
|
70
|
-
const a =
|
|
71
|
+
const a = g(e, e.VERTEX_SHADER, t), i = g(e, e.FRAGMENT_SHADER, r);
|
|
71
72
|
if (e.attachShader(n, a), e.attachShader(n, i), e.linkProgram(n), !e.getProgramParameter(n, e.LINK_STATUS)) {
|
|
72
73
|
const s = e.getProgramInfoLog(n);
|
|
73
74
|
throw e.deleteProgram(n), new Error(`Program link error: ${s}`);
|
|
74
75
|
}
|
|
75
76
|
return e.deleteShader(a), e.deleteShader(i), n;
|
|
76
77
|
}
|
|
77
|
-
function
|
|
78
|
+
function Ze(e, t, r, n, a) {
|
|
78
79
|
const i = e.createTexture();
|
|
79
80
|
if (!i)
|
|
80
81
|
throw new Error("Failed to create texture");
|
|
@@ -90,7 +91,7 @@ function je(e, t, r, n, a) {
|
|
|
90
91
|
r
|
|
91
92
|
), e.bindTexture(e.TEXTURE_2D, null), i;
|
|
92
93
|
}
|
|
93
|
-
function
|
|
94
|
+
function he(e, t, r) {
|
|
94
95
|
const n = e.getParameter(
|
|
95
96
|
e.TEXTURE_BINDING_2D
|
|
96
97
|
), a = e.getParameter(
|
|
@@ -122,19 +123,19 @@ function le(e, t, r) {
|
|
|
122
123
|
}
|
|
123
124
|
return o;
|
|
124
125
|
}
|
|
125
|
-
function
|
|
126
|
+
function me(e) {
|
|
126
127
|
return {
|
|
127
128
|
kind: "rgba8-packed",
|
|
128
129
|
internalFormat: e.RGBA,
|
|
129
130
|
type: e.UNSIGNED_BYTE
|
|
130
131
|
};
|
|
131
132
|
}
|
|
132
|
-
function
|
|
133
|
+
function et(e) {
|
|
133
134
|
if (typeof WebGL2RenderingContext > "u" || !(e instanceof WebGL2RenderingContext))
|
|
134
135
|
throw new Error("zartigl requires WebGL2");
|
|
135
136
|
return e;
|
|
136
137
|
}
|
|
137
|
-
function
|
|
138
|
+
function tt(e) {
|
|
138
139
|
const t = [];
|
|
139
140
|
e.getExtension("EXT_color_buffer_float") ? t.push(
|
|
140
141
|
{ kind: "float32", internalFormat: e.RGBA32F, type: e.FLOAT },
|
|
@@ -145,15 +146,15 @@ function Je(e) {
|
|
|
145
146
|
type: e.HALF_FLOAT
|
|
146
147
|
});
|
|
147
148
|
for (const r of t)
|
|
148
|
-
if (
|
|
149
|
+
if (he(
|
|
149
150
|
e,
|
|
150
151
|
r.internalFormat,
|
|
151
152
|
r.type
|
|
152
153
|
))
|
|
153
154
|
return r;
|
|
154
|
-
return
|
|
155
|
+
return me(e);
|
|
155
156
|
}
|
|
156
|
-
function
|
|
157
|
+
function rt(e, t, r, n, a, i, s) {
|
|
157
158
|
const o = e.createTexture();
|
|
158
159
|
if (!o)
|
|
159
160
|
throw new Error("Failed to create texture");
|
|
@@ -169,10 +170,10 @@ function Qe(e, t, r, n, a, i, s) {
|
|
|
169
170
|
r
|
|
170
171
|
), e.bindTexture(e.TEXTURE_2D, null), o;
|
|
171
172
|
}
|
|
172
|
-
function
|
|
173
|
+
function nt(e, t, r) {
|
|
173
174
|
e.activeTexture(e.TEXTURE0 + r), e.bindTexture(e.TEXTURE_2D, t);
|
|
174
175
|
}
|
|
175
|
-
function
|
|
176
|
+
function at(e, t) {
|
|
176
177
|
const r = e.createFramebuffer();
|
|
177
178
|
if (!r)
|
|
178
179
|
throw new Error("Failed to create framebuffer");
|
|
@@ -184,7 +185,7 @@ function et(e, t) {
|
|
|
184
185
|
0
|
|
185
186
|
), e.bindFramebuffer(e.FRAMEBUFFER, null), r;
|
|
186
187
|
}
|
|
187
|
-
function
|
|
188
|
+
function it(e) {
|
|
188
189
|
const t = e.createBuffer();
|
|
189
190
|
if (!t)
|
|
190
191
|
throw new Error("Failed to create buffer");
|
|
@@ -194,7 +195,7 @@ function tt(e) {
|
|
|
194
195
|
e.STATIC_DRAW
|
|
195
196
|
), t;
|
|
196
197
|
}
|
|
197
|
-
const
|
|
198
|
+
const Ee = {
|
|
198
199
|
0: "#3288bd",
|
|
199
200
|
0.1: "#66c2a5",
|
|
200
201
|
0.2: "#abdda4",
|
|
@@ -204,8 +205,8 @@ const me = {
|
|
|
204
205
|
0.6: "#f46d43",
|
|
205
206
|
1: "#d53e4f"
|
|
206
207
|
};
|
|
207
|
-
function
|
|
208
|
-
const r = t != null ? fe(t) :
|
|
208
|
+
function ot(e, t) {
|
|
209
|
+
const r = t != null ? fe(t) : Ee, n = document.createElement("canvas");
|
|
209
210
|
n.width = 256, n.height = 1;
|
|
210
211
|
const a = n.getContext("2d"), i = a.createLinearGradient(0, 0, 256, 0);
|
|
211
212
|
for (const [o, c] of Object.entries(r))
|
|
@@ -216,7 +217,7 @@ function rt(e, t) {
|
|
|
216
217
|
throw new Error("Failed to create color ramp texture");
|
|
217
218
|
return e.bindTexture(e.TEXTURE_2D, s), 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, n), e.bindTexture(e.TEXTURE_2D, null), s;
|
|
218
219
|
}
|
|
219
|
-
function
|
|
220
|
+
function st(e) {
|
|
220
221
|
const t = e.getExtension("WEBGL_debug_renderer_info");
|
|
221
222
|
return {
|
|
222
223
|
vendor: String(e.getParameter(e.VENDOR) ?? ""),
|
|
@@ -226,7 +227,7 @@ function nt(e) {
|
|
|
226
227
|
version: String(e.getParameter(e.VERSION) ?? "")
|
|
227
228
|
};
|
|
228
229
|
}
|
|
229
|
-
function
|
|
230
|
+
function ct(e) {
|
|
230
231
|
return {
|
|
231
232
|
program: e.getParameter(e.CURRENT_PROGRAM),
|
|
232
233
|
activeTexture: e.getParameter(e.ACTIVE_TEXTURE),
|
|
@@ -243,19 +244,78 @@ function at(e) {
|
|
|
243
244
|
]
|
|
244
245
|
};
|
|
245
246
|
}
|
|
246
|
-
function
|
|
247
|
+
function dt(e, t) {
|
|
247
248
|
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]);
|
|
248
249
|
}
|
|
249
|
-
const
|
|
250
|
-
|
|
250
|
+
const Te = {
|
|
251
|
+
degrees_c: "°C",
|
|
252
|
+
degc: "°C",
|
|
253
|
+
degrees_celsius: "°C",
|
|
254
|
+
degree_celsius: "°C",
|
|
255
|
+
celsius: "°C",
|
|
256
|
+
// Degree heating weeks accumulate °C over weeks: a product, not a rate.
|
|
257
|
+
degree_celsius_weeks: "°C-weeks",
|
|
258
|
+
degree: "°",
|
|
259
|
+
degrees: "°",
|
|
260
|
+
kelvin: "K",
|
|
261
|
+
1: "",
|
|
262
|
+
"1e-3": "PSU",
|
|
263
|
+
"0.001": "PSU",
|
|
264
|
+
psu: "PSU",
|
|
265
|
+
stress_level: ""
|
|
266
|
+
}, pe = {
|
|
267
|
+
meter: "m",
|
|
268
|
+
meters: "m",
|
|
269
|
+
metre: "m",
|
|
270
|
+
metres: "m",
|
|
271
|
+
second: "s",
|
|
272
|
+
seconds: "s",
|
|
273
|
+
day: "d",
|
|
274
|
+
days: "d",
|
|
275
|
+
hour: "h",
|
|
276
|
+
hours: "h",
|
|
277
|
+
gram: "g",
|
|
278
|
+
grams: "g",
|
|
279
|
+
milligram: "mg",
|
|
280
|
+
milligrams: "mg",
|
|
281
|
+
kilogram: "kg",
|
|
282
|
+
kilograms: "kg",
|
|
283
|
+
mole: "mol",
|
|
284
|
+
millimole: "mmol",
|
|
285
|
+
watt: "W",
|
|
286
|
+
newton: "N",
|
|
287
|
+
pascal: "Pa",
|
|
288
|
+
kelvin: "K"
|
|
289
|
+
}, be = "⁰¹²³⁴⁵⁶⁷⁸⁹";
|
|
290
|
+
function N(e) {
|
|
291
|
+
return e === 1 ? "" : [...String(e)].map((t) => be[Number(t)]).join("");
|
|
292
|
+
}
|
|
293
|
+
function ut(e) {
|
|
294
|
+
const t = e?.trim() ?? "", r = Te[t.toLowerCase()];
|
|
295
|
+
if (r != null)
|
|
296
|
+
return r;
|
|
297
|
+
if (t.includes("/"))
|
|
298
|
+
return t;
|
|
299
|
+
const n = [], a = [];
|
|
300
|
+
for (const i of t.split(/\s+/)) {
|
|
301
|
+
const s = /^([A-Za-z]+)\^?(-?\d+)?$/.exec(i);
|
|
302
|
+
if (!s)
|
|
303
|
+
return t.replace(/_/g, " ");
|
|
304
|
+
const o = pe[s[1]] ?? s[1], c = Number(s[2] ?? 1);
|
|
305
|
+
c < 0 ? a.push(o + N(-c)) : n.push(o + N(c));
|
|
306
|
+
}
|
|
307
|
+
return [n.join(" ") || "1", ...a].join("/");
|
|
308
|
+
}
|
|
309
|
+
const L = 20, we = 600;
|
|
310
|
+
function Re(e) {
|
|
251
311
|
const t = Math.max(0, Math.min(1, e));
|
|
252
|
-
return L * Math.pow(
|
|
312
|
+
return L * Math.pow(we / L, t);
|
|
253
313
|
}
|
|
254
|
-
function
|
|
255
|
-
return Math.exp(-1 /
|
|
314
|
+
function lt(e) {
|
|
315
|
+
return Math.exp(-1 / Re(e));
|
|
256
316
|
}
|
|
257
|
-
const
|
|
258
|
-
class
|
|
317
|
+
const _e = 0.8, Ae = 120, Fe = 300;
|
|
318
|
+
class ft {
|
|
259
319
|
constructor(t) {
|
|
260
320
|
this.base = t, this.moving = !1, this.start = 0, this.duration = 0, this.from = t, this.to = t;
|
|
261
321
|
}
|
|
@@ -264,7 +324,7 @@ class st {
|
|
|
264
324
|
this.base = t, this.moving || (this.from = t, this.to = t, this.duration = 0);
|
|
265
325
|
}
|
|
266
326
|
setMoving(t, r) {
|
|
267
|
-
t !== this.moving && (this.from = this.value(r), this.moving = t, this.to = t ?
|
|
327
|
+
t !== this.moving && (this.from = this.value(r), this.moving = t, this.to = t ? _e : this.base, this.start = r, this.duration = t ? Ae : Fe);
|
|
268
328
|
}
|
|
269
329
|
value(t) {
|
|
270
330
|
if (this.duration === 0)
|
|
@@ -273,7 +333,7 @@ class st {
|
|
|
273
333
|
return r === 1 ? (this.duration = 0, this.from = this.to, this.to) : this.from + (this.to - this.from) * r * r * (3 - 2 * r);
|
|
274
334
|
}
|
|
275
335
|
}
|
|
276
|
-
function
|
|
336
|
+
function ht(e) {
|
|
277
337
|
if (e == null)
|
|
278
338
|
return null;
|
|
279
339
|
if (!Number.isFinite(e[0]) || !Number.isFinite(e[1]) || e[0] >= e[1])
|
|
@@ -295,12 +355,12 @@ function F(e, t) {
|
|
|
295
355
|
throw new Error(`Invalid GeoVideo manifest ${t}`);
|
|
296
356
|
return r;
|
|
297
357
|
}
|
|
298
|
-
function
|
|
358
|
+
function S(e) {
|
|
299
359
|
return typeof e == "string" && /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/.test(
|
|
300
360
|
e
|
|
301
361
|
);
|
|
302
362
|
}
|
|
303
|
-
function
|
|
363
|
+
function C(e) {
|
|
304
364
|
if (!e || typeof e != "object")
|
|
305
365
|
throw new Error("Invalid GeoVideo manifest");
|
|
306
366
|
const t = e;
|
|
@@ -313,16 +373,16 @@ function V(e) {
|
|
|
313
373
|
if (!Array.isArray(t.bounds) || t.bounds.length !== 4)
|
|
314
374
|
throw new Error("Invalid GeoVideo manifest bounds");
|
|
315
375
|
const [r, n, a, i] = t.bounds.map(
|
|
316
|
-
(
|
|
376
|
+
(l, T) => m(l, `bounds[${T}]`)
|
|
317
377
|
);
|
|
318
378
|
if (n < -90 || i > 90 || n >= i || r === a)
|
|
319
379
|
throw new Error("Invalid GeoVideo geographic bounds");
|
|
320
380
|
const s = t.media;
|
|
321
381
|
if (!s || typeof s.url != "string" || !s.url)
|
|
322
382
|
throw new Error("Invalid GeoVideo media");
|
|
323
|
-
for (const
|
|
324
|
-
if (m(s[
|
|
325
|
-
throw new Error(`Invalid GeoVideo media.${
|
|
383
|
+
for (const l of ["width", "height", "fps", "durationSeconds"])
|
|
384
|
+
if (m(s[l], `media.${l}`) <= 0)
|
|
385
|
+
throw new Error(`Invalid GeoVideo media.${l}`);
|
|
326
386
|
const o = t.encoding;
|
|
327
387
|
if (!o || o.bits !== 8 || o.colorSpace !== "bt709" || o.colorRange !== "limited" && o.colorRange !== "full")
|
|
328
388
|
throw new Error("Invalid GeoVideo encoding");
|
|
@@ -343,8 +403,8 @@ function V(e) {
|
|
|
343
403
|
if (!u || u.kind !== "static-validity" || typeof u.url != "string" || !u.url || m(u.width, "mask.width") !== s.width || m(u.height, "mask.height") !== h || m(u.threshold, "mask.threshold") < 0 || u.threshold > 1)
|
|
344
404
|
throw new Error("Invalid GeoVideo static mask");
|
|
345
405
|
if (t.timeline?.kind === "range") {
|
|
346
|
-
const
|
|
347
|
-
if (F(t.timeline.dateEnd, "timeline.dateEnd") <=
|
|
406
|
+
const l = F(t.timeline.dateStart, "timeline.dateStart");
|
|
407
|
+
if (F(t.timeline.dateEnd, "timeline.dateEnd") <= l)
|
|
348
408
|
throw new Error("GeoVideo timeline end must follow start");
|
|
349
409
|
if (t.timeline.interpolation !== "linear" && t.timeline.interpolation !== "nearest")
|
|
350
410
|
throw new Error("Invalid GeoVideo interpolation");
|
|
@@ -353,10 +413,10 @@ function V(e) {
|
|
|
353
413
|
else if (t.timeline?.kind === "sample-sequence") {
|
|
354
414
|
if (!Array.isArray(t.timeline.values) || t.timeline.values.length === 0)
|
|
355
415
|
throw new Error("GeoVideo sample sequence must contain values");
|
|
356
|
-
const
|
|
416
|
+
const l = t.timeline.values.map(
|
|
357
417
|
(T, b) => F(T, `timeline.values[${b}]`)
|
|
358
418
|
);
|
|
359
|
-
if (
|
|
419
|
+
if (l.some((T, b) => b > 0 && T <= l[b - 1]))
|
|
360
420
|
throw new Error(
|
|
361
421
|
"GeoVideo sample sequence values must be strictly increasing"
|
|
362
422
|
);
|
|
@@ -365,19 +425,19 @@ function V(e) {
|
|
|
365
425
|
const E = t.style?.colorDomain;
|
|
366
426
|
if (!Array.isArray(E) || E.length !== 2 || !E.every(Number.isFinite) || E[0] >= E[1])
|
|
367
427
|
throw new Error("Invalid GeoVideo color domain");
|
|
368
|
-
if (!
|
|
428
|
+
if (!S(t.id) || !t.provenance || !S(t.provenance.catalogEntryId) || !S(t.provenance.inputSourceId) || !Array.isArray(t.provenance.variables) || t.provenance.variables.length === 0)
|
|
369
429
|
throw new Error("Invalid GeoVideo provenance");
|
|
370
430
|
return { ...t, bounds: [r, n, a, i] };
|
|
371
431
|
}
|
|
372
|
-
async function
|
|
432
|
+
async function xe(e, t) {
|
|
373
433
|
if (typeof e != "string")
|
|
374
|
-
return
|
|
434
|
+
return C(e);
|
|
375
435
|
const r = await fetch(e, { signal: t });
|
|
376
436
|
if (!r.ok)
|
|
377
437
|
throw new Error(
|
|
378
438
|
`GeoVideo manifest request failed (${r.status}): ${e}`
|
|
379
439
|
);
|
|
380
|
-
const n = await r.json(), a =
|
|
440
|
+
const n = await r.json(), a = C(n), i = typeof document < "u" ? new URL(e, document.baseURI).href : e;
|
|
381
441
|
return {
|
|
382
442
|
...a,
|
|
383
443
|
media: { ...a.media, url: new URL(a.media.url, i).href },
|
|
@@ -398,13 +458,13 @@ function _(e) {
|
|
|
398
458
|
(a, i) => t + (r - t) * i / (n - 1)
|
|
399
459
|
);
|
|
400
460
|
}
|
|
401
|
-
function
|
|
461
|
+
function ve(e) {
|
|
402
462
|
return e.timeline.kind === "sample-sequence" ? e.timeline.values.length / e.media.durationSeconds : e.media.fps;
|
|
403
463
|
}
|
|
404
|
-
function
|
|
405
|
-
return t /
|
|
464
|
+
function mt(e, t) {
|
|
465
|
+
return t / ve(e);
|
|
406
466
|
}
|
|
407
|
-
function
|
|
467
|
+
function ye(e, t) {
|
|
408
468
|
if (e.timeline.kind === "snapshot-loop")
|
|
409
469
|
return 0;
|
|
410
470
|
if (e.timeline.kind === "sample-sequence") {
|
|
@@ -416,22 +476,22 @@ function Ae(e, t) {
|
|
|
416
476
|
return s * o + Math.min(o / 2, 0.5 / e.media.fps);
|
|
417
477
|
}
|
|
418
478
|
const r = new Date(e.timeline.dateStart).getTime(), n = new Date(e.timeline.dateEnd).getTime();
|
|
419
|
-
return Math.max(0, Math.min(1, (t - r) / (n - r))) *
|
|
479
|
+
return Math.max(0, Math.min(1, (t - r) / (n - r))) * O(e);
|
|
420
480
|
}
|
|
421
|
-
function
|
|
481
|
+
function Et(e, t) {
|
|
422
482
|
if (e.timeline.kind === "snapshot-loop")
|
|
423
483
|
return new Date(e.timeline.date).getTime();
|
|
424
484
|
if (e.timeline.kind === "sample-sequence") {
|
|
425
485
|
const s = _(e), o = e.media.durationSeconds / s.length, c = Math.floor((t + 0.25 / e.media.fps) / o);
|
|
426
486
|
return s[Math.max(0, Math.min(s.length - 1, c))];
|
|
427
487
|
}
|
|
428
|
-
const r = new Date(e.timeline.dateStart).getTime(), n = new Date(e.timeline.dateEnd).getTime(), a =
|
|
488
|
+
const r = new Date(e.timeline.dateStart).getTime(), n = new Date(e.timeline.dateEnd).getTime(), a = O(e), i = a > 0 ? Math.max(0, Math.min(1, t / a)) : 0;
|
|
429
489
|
return r + (n - r) * i;
|
|
430
490
|
}
|
|
431
|
-
function
|
|
491
|
+
function O(e) {
|
|
432
492
|
return Math.max(0, e.media.durationSeconds - 1 / e.media.fps);
|
|
433
493
|
}
|
|
434
|
-
function
|
|
494
|
+
function Se(e, t) {
|
|
435
495
|
const r = new Uint8Array(e.length / 4);
|
|
436
496
|
for (let n = 0; n < r.length; n++) {
|
|
437
497
|
const a = e[n * 4];
|
|
@@ -439,7 +499,7 @@ function Fe(e, t) {
|
|
|
439
499
|
}
|
|
440
500
|
return r;
|
|
441
501
|
}
|
|
442
|
-
class
|
|
502
|
+
class Ue {
|
|
443
503
|
constructor() {
|
|
444
504
|
this.gl = null, this.texture = null, this.framebuffer = null;
|
|
445
505
|
}
|
|
@@ -470,44 +530,44 @@ class xe {
|
|
|
470
530
|
return this.gl = n, this.texture = n.createTexture(), this.framebuffer = n.createFramebuffer(), n;
|
|
471
531
|
}
|
|
472
532
|
}
|
|
473
|
-
function
|
|
533
|
+
function V(e) {
|
|
474
534
|
const t = Math.max(4, Math.floor(e.length / 4 / 997) * 4);
|
|
475
535
|
for (let r = 3; r < e.length; r += t)
|
|
476
536
|
if (e[r] !== 0)
|
|
477
537
|
return !1;
|
|
478
538
|
return !0;
|
|
479
539
|
}
|
|
480
|
-
function
|
|
540
|
+
function f() {
|
|
481
541
|
return new DOMException("GeoVideo frame request was cancelled", "AbortError");
|
|
482
542
|
}
|
|
483
543
|
function R(e, t, r) {
|
|
484
544
|
return t ? t.aborted ? (e.catch(() => {
|
|
485
|
-
}), r?.(), Promise.reject(
|
|
545
|
+
}), r?.(), Promise.reject(f())) : new Promise((n, a) => {
|
|
486
546
|
const i = () => {
|
|
487
|
-
r?.(), a(
|
|
547
|
+
r?.(), a(f());
|
|
488
548
|
};
|
|
489
549
|
t.addEventListener("abort", i, { once: !0 }), e.then(n, a).finally(() => {
|
|
490
550
|
t.removeEventListener("abort", i);
|
|
491
551
|
});
|
|
492
552
|
}) : e;
|
|
493
553
|
}
|
|
494
|
-
function
|
|
554
|
+
function U(e, t) {
|
|
495
555
|
return new Promise(
|
|
496
556
|
(r) => e.addEventListener(t, () => r(), { once: !0 })
|
|
497
557
|
);
|
|
498
558
|
}
|
|
499
|
-
const
|
|
500
|
-
function
|
|
559
|
+
const Me = 250;
|
|
560
|
+
function De(e) {
|
|
501
561
|
return "requestVideoFrameCallback" in e ? Promise.race([
|
|
502
562
|
new Promise(
|
|
503
563
|
(t) => e.requestVideoFrameCallback(() => t())
|
|
504
564
|
),
|
|
505
|
-
new Promise((t) => setTimeout(t,
|
|
565
|
+
new Promise((t) => setTimeout(t, Me))
|
|
506
566
|
]) : Promise.resolve();
|
|
507
567
|
}
|
|
508
|
-
class
|
|
568
|
+
class q {
|
|
509
569
|
constructor(t, r, n = {}) {
|
|
510
|
-
this.reader = new
|
|
570
|
+
this.reader = new Ue(), this.video = null, this.mask = 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(_(t));
|
|
511
571
|
}
|
|
512
572
|
init() {
|
|
513
573
|
return this.initPromise ??= this.load().catch((t) => {
|
|
@@ -531,7 +591,7 @@ class O {
|
|
|
531
591
|
frame(t, r = {}) {
|
|
532
592
|
const { signal: n } = r;
|
|
533
593
|
if (n?.aborted)
|
|
534
|
-
return Promise.reject(
|
|
594
|
+
return Promise.reject(f());
|
|
535
595
|
let a = this.frames.get(t);
|
|
536
596
|
if (a ? (this.frames.delete(t), this.frames.set(t, a)) : a = this.enqueue(t), a.settled)
|
|
537
597
|
return a.promise;
|
|
@@ -540,7 +600,7 @@ class O {
|
|
|
540
600
|
}
|
|
541
601
|
enqueue(t) {
|
|
542
602
|
const r = new AbortController(), n = this.queue.then(
|
|
543
|
-
() => r.signal.aborted ? Promise.reject(
|
|
603
|
+
() => r.signal.aborted ? Promise.reject(f()) : this.decode(t, r.signal)
|
|
544
604
|
);
|
|
545
605
|
this.queue = n.catch(() => {
|
|
546
606
|
});
|
|
@@ -610,8 +670,8 @@ class O {
|
|
|
610
670
|
async presentFrame(t, r) {
|
|
611
671
|
if (this.presented && Math.abs(t.currentTime - r) <= 1e-3 && !t.seeking)
|
|
612
672
|
return;
|
|
613
|
-
const n =
|
|
614
|
-
t.currentTime = r, await a, t.readyState < HTMLMediaElement.HAVE_CURRENT_DATA && await Promise.race([
|
|
673
|
+
const n = De(t), a = U(t, "seeked");
|
|
674
|
+
t.currentTime = r, await a, t.readyState < HTMLMediaElement.HAVE_CURRENT_DATA && await Promise.race([U(t, "loadeddata"), U(t, "canplay")]), await n, this.presented = !0;
|
|
615
675
|
}
|
|
616
676
|
/**
|
|
617
677
|
* Some mobile browsers expose no decoded pixels to WebGL until playback
|
|
@@ -632,32 +692,32 @@ class O {
|
|
|
632
692
|
*/
|
|
633
693
|
async decode(t, r) {
|
|
634
694
|
if (r.aborted)
|
|
635
|
-
throw
|
|
695
|
+
throw f();
|
|
636
696
|
await this.init();
|
|
637
697
|
const n = this.video, a = this.mask;
|
|
638
698
|
if (r.aborted || !n || !a)
|
|
639
|
-
throw
|
|
640
|
-
const i =
|
|
699
|
+
throw f();
|
|
700
|
+
const i = ye(this.manifest, this.times[t]);
|
|
641
701
|
if (await this.presentFrame(n, i), r.aborted || n !== this.video)
|
|
642
|
-
throw
|
|
702
|
+
throw f();
|
|
643
703
|
const s = this.height * this.planes;
|
|
644
704
|
let o = this.reader.read(n, this.width, s);
|
|
645
|
-
if (
|
|
705
|
+
if (V(o) && !this.primed) {
|
|
646
706
|
if (await this.primeDecoder(n), await this.presentFrame(n, i), r.aborted || n !== this.video)
|
|
647
|
-
throw
|
|
707
|
+
throw f();
|
|
648
708
|
o = this.reader.read(n, this.width, s);
|
|
649
709
|
}
|
|
650
|
-
if (
|
|
710
|
+
if (V(o))
|
|
651
711
|
throw new Error("GeoVideo frame could not be read back from the decoder");
|
|
652
|
-
const c =
|
|
712
|
+
const c = Se(o, this.manifest.encoding.colorRange);
|
|
653
713
|
return this.decodeCodes(c, a, this.manifest.mask.threshold);
|
|
654
714
|
}
|
|
655
715
|
}
|
|
656
|
-
function
|
|
716
|
+
function Pe(e, t) {
|
|
657
717
|
let r = (e - t.codeMin) / (t.codeMax - t.codeMin) * 2 - 1;
|
|
658
718
|
return r = Math.max(-1, Math.min(1, r)), t.transfer === "sqrt" && (r = Math.sign(r) * r * r), r * t.valueDomain;
|
|
659
719
|
}
|
|
660
|
-
function
|
|
720
|
+
function ke(e, t, r, n) {
|
|
661
721
|
const a = t.length;
|
|
662
722
|
if (e.length !== 2 * a)
|
|
663
723
|
throw new Error(
|
|
@@ -665,7 +725,7 @@ function Me(e, t, r, n) {
|
|
|
665
725
|
);
|
|
666
726
|
const i = new Float32Array(256);
|
|
667
727
|
for (let d = 0; d < 256; d++)
|
|
668
|
-
i[d] =
|
|
728
|
+
i[d] = Pe(d, n);
|
|
669
729
|
const s = r * 255, o = new Float32Array(a), c = new Float32Array(a);
|
|
670
730
|
for (let d = 0; d < a; d++) {
|
|
671
731
|
const h = t[d] >= s;
|
|
@@ -673,7 +733,7 @@ function Me(e, t, r, n) {
|
|
|
673
733
|
}
|
|
674
734
|
return { u: o, v: c };
|
|
675
735
|
}
|
|
676
|
-
class
|
|
736
|
+
class Ge extends q {
|
|
677
737
|
constructor(t, r = {}) {
|
|
678
738
|
if (t.encoding.kind !== "vector-luma")
|
|
679
739
|
throw new Error("GeoVideoVectorSource requires a vector-luma manifest");
|
|
@@ -738,10 +798,10 @@ class Ue extends O {
|
|
|
738
798
|
};
|
|
739
799
|
}
|
|
740
800
|
decodeCodes(t, r, n) {
|
|
741
|
-
return
|
|
801
|
+
return ke(t, r, n, this.encoding);
|
|
742
802
|
}
|
|
743
803
|
}
|
|
744
|
-
function
|
|
804
|
+
function Ie(e, t) {
|
|
745
805
|
const r = Math.max(
|
|
746
806
|
0,
|
|
747
807
|
Math.min(
|
|
@@ -751,7 +811,7 @@ function Se(e, t) {
|
|
|
751
811
|
);
|
|
752
812
|
return t.valueMin + r * (t.valueMax - t.valueMin);
|
|
753
813
|
}
|
|
754
|
-
function
|
|
814
|
+
function ge(e, t, r, n) {
|
|
755
815
|
const a = t.length;
|
|
756
816
|
if (e.length !== a)
|
|
757
817
|
throw new Error(
|
|
@@ -759,23 +819,23 @@ function Ge(e, t, r, n) {
|
|
|
759
819
|
);
|
|
760
820
|
const i = new Float32Array(256);
|
|
761
821
|
for (let c = 0; c < 256; c++)
|
|
762
|
-
i[c] =
|
|
822
|
+
i[c] = Ie(c, n);
|
|
763
823
|
const s = r * 255, o = new Float32Array(a);
|
|
764
824
|
for (let c = 0; c < a; c++)
|
|
765
825
|
o[c] = t[c] >= s ? i[e[c]] : NaN;
|
|
766
826
|
return o;
|
|
767
827
|
}
|
|
768
|
-
class
|
|
828
|
+
class Ne extends q {
|
|
769
829
|
constructor(t, r = {}) {
|
|
770
830
|
if (t.encoding.kind !== "scalar-luma")
|
|
771
831
|
throw new Error("GeoVideoScalarSource requires a scalar-luma manifest");
|
|
772
832
|
super(t, 1, r), this.encoding = t.encoding;
|
|
773
833
|
}
|
|
774
834
|
decodeCodes(t, r, n) {
|
|
775
|
-
return
|
|
835
|
+
return ge(t, r, n, this.encoding);
|
|
776
836
|
}
|
|
777
837
|
}
|
|
778
|
-
function
|
|
838
|
+
function Le(e, t, r = {}) {
|
|
779
839
|
const [n, a] = r.range ?? [-1 / 0, 1 / 0], i = [...e].sort((o, c) => o.start - c.start), s = i.find(
|
|
780
840
|
(o) => o.start > t && o.start <= a
|
|
781
841
|
) ?? (r.loop ? i.find(
|
|
@@ -783,7 +843,7 @@ function ke(e, t, r = {}) {
|
|
|
783
843
|
) : void 0);
|
|
784
844
|
return s ? { chunk: s, time: Math.max(s.start, n) } : null;
|
|
785
845
|
}
|
|
786
|
-
function
|
|
846
|
+
function Ce(e, t) {
|
|
787
847
|
let r = null, n = -1 / 0;
|
|
788
848
|
for (const a of t) {
|
|
789
849
|
const i = Math.min(e.end, a.end) - Math.max(e.start, a.start);
|
|
@@ -791,7 +851,7 @@ function Ie(e, t) {
|
|
|
791
851
|
}
|
|
792
852
|
return r;
|
|
793
853
|
}
|
|
794
|
-
function
|
|
854
|
+
function Ve(e) {
|
|
795
855
|
return {
|
|
796
856
|
width: e.mask.width,
|
|
797
857
|
height: e.mask.height,
|
|
@@ -799,11 +859,11 @@ function Ne(e) {
|
|
|
799
859
|
rowOrder: "north-to-south"
|
|
800
860
|
};
|
|
801
861
|
}
|
|
802
|
-
function
|
|
803
|
-
return e.encoding.kind === "vector-luma" ? new
|
|
862
|
+
function Be(e, t = {}) {
|
|
863
|
+
return e.encoding.kind === "vector-luma" ? new Ge(e, t) : new Ne(e, t);
|
|
804
864
|
}
|
|
805
|
-
const
|
|
806
|
-
function
|
|
865
|
+
const Xe = 3, Oe = 3, qe = 0.6, $e = 1.5;
|
|
866
|
+
function We(e, t) {
|
|
807
867
|
const r = e.length - 1;
|
|
808
868
|
if (t <= e[0])
|
|
809
869
|
return { step: 0, fraction: 0 };
|
|
@@ -816,7 +876,7 @@ function Xe(e, t) {
|
|
|
816
876
|
}
|
|
817
877
|
return { step: n, fraction: (t - e[n]) / (e[a] - e[n]) };
|
|
818
878
|
}
|
|
819
|
-
function
|
|
879
|
+
function He(e) {
|
|
820
880
|
const t = new AbortController();
|
|
821
881
|
if (!e)
|
|
822
882
|
return { controller: t, unlink: () => {
|
|
@@ -827,14 +887,14 @@ function Oe(e) {
|
|
|
827
887
|
unlink: () => e.removeEventListener("abort", r)
|
|
828
888
|
};
|
|
829
889
|
}
|
|
830
|
-
class
|
|
890
|
+
class Tt {
|
|
831
891
|
constructor(t) {
|
|
832
892
|
this.manifests = /* @__PURE__ */ new Map(), this.open = /* @__PURE__ */ new Map(), this.id = t.id, this.chunks = t.chunks.filter(
|
|
833
893
|
(r) => Number.isFinite(r.start) && Number.isFinite(r.end) && r.end >= r.start
|
|
834
|
-
).sort((r, n) => r.start - n.start), this.maxOpenChunks = Math.max(2, t.maxOpenChunks ??
|
|
894
|
+
).sort((r, n) => r.start - n.start), this.maxOpenChunks = Math.max(2, t.maxOpenChunks ?? Xe), this.frameCacheSize = Math.max(
|
|
835
895
|
1,
|
|
836
|
-
t.frameCacheSize ??
|
|
837
|
-
), this.prefetchAt = t.prefetchAt ??
|
|
896
|
+
t.frameCacheSize ?? Oe
|
|
897
|
+
), this.prefetchAt = t.prefetchAt ?? qe, this.maxGap = t.maxGap, this.loadManifest = t.loadManifest ?? xe, this.createFrameSource = t.createFrameSource ?? ((r, n) => Be(
|
|
838
898
|
r,
|
|
839
899
|
n
|
|
840
900
|
));
|
|
@@ -852,7 +912,7 @@ class ft {
|
|
|
852
912
|
/** Every step time of the archive; loads all chunk manifests. */
|
|
853
913
|
async steps(t = {}) {
|
|
854
914
|
if (t.signal?.aborted)
|
|
855
|
-
throw
|
|
915
|
+
throw f();
|
|
856
916
|
const r = await R(
|
|
857
917
|
Promise.all(this.chunks.map((n) => this.manifest(n))),
|
|
858
918
|
t.signal
|
|
@@ -866,39 +926,39 @@ class ft {
|
|
|
866
926
|
async sample(t, r = {}) {
|
|
867
927
|
const { signal: n } = r, a = r.mode ?? "interpolate";
|
|
868
928
|
if (n?.aborted)
|
|
869
|
-
throw
|
|
929
|
+
throw f();
|
|
870
930
|
const i = this.chunkIndexAt(t);
|
|
871
931
|
if (i < 0)
|
|
872
932
|
return null;
|
|
873
|
-
const s = [], { controller: o, unlink: c } =
|
|
933
|
+
const s = [], { controller: o, unlink: c } = He(n);
|
|
874
934
|
try {
|
|
875
935
|
const d = this.acquire(this.chunks[i], s), h = await R(d.ready, o.signal), { times: u } = h;
|
|
876
936
|
let E;
|
|
877
937
|
if (t <= u[u.length - 1]) {
|
|
878
|
-
const { step: p, fraction: w } =
|
|
938
|
+
const { step: p, fraction: w } = We(u, t);
|
|
879
939
|
E = a === "discrete" || w === 0 ? [d, p, d, p, 0] : [d, p, d, p + 1, w];
|
|
880
940
|
} else {
|
|
881
941
|
const p = this.chunks[i + 1];
|
|
882
942
|
if (!p)
|
|
883
943
|
return null;
|
|
884
|
-
const w = this.acquire(p, s),
|
|
885
|
-
if (y - v > this.gapLimit(u,
|
|
944
|
+
const w = this.acquire(p, s), G = await R(w.ready, o.signal), A = u.length - 1, v = u[A], y = G.times[0];
|
|
945
|
+
if (y - v > this.gapLimit(u, G.times))
|
|
886
946
|
return null;
|
|
887
947
|
E = a === "discrete" ? [d, A, d, A, 0] : t >= y ? [w, 0, w, 0, 0] : [d, A, w, 0, (t - v) / (y - v)];
|
|
888
948
|
}
|
|
889
|
-
const [
|
|
890
|
-
|
|
949
|
+
const [l, T, b, D, $] = E, P = l === b && T === D, k = [this.frame(l, T, o.signal)];
|
|
950
|
+
P || k.push(this.frame(b, D, o.signal));
|
|
891
951
|
let x;
|
|
892
952
|
try {
|
|
893
|
-
x = await Promise.all(
|
|
953
|
+
x = await Promise.all(k);
|
|
894
954
|
} catch (p) {
|
|
895
955
|
throw o.abort(), p;
|
|
896
956
|
}
|
|
897
957
|
return this.prefetchAfter(i, t), {
|
|
898
958
|
time: t,
|
|
899
959
|
a: x[0],
|
|
900
|
-
b: x[
|
|
901
|
-
mix:
|
|
960
|
+
b: x[P ? 0 : 1],
|
|
961
|
+
mix: $
|
|
902
962
|
};
|
|
903
963
|
} finally {
|
|
904
964
|
c();
|
|
@@ -937,7 +997,7 @@ class ft {
|
|
|
937
997
|
t.length > 1 ? t[t.length - 1] - t[t.length - 2] : 0,
|
|
938
998
|
r.length > 1 ? r[1] - r[0] : 0
|
|
939
999
|
], a = Math.max(...n);
|
|
940
|
-
return a > 0 ? a *
|
|
1000
|
+
return a > 0 ? a * $e : -1 / 0;
|
|
941
1001
|
}
|
|
942
1002
|
prefetchAfter(t, r) {
|
|
943
1003
|
const n = this.chunks[t], a = this.chunks[t + 1], i = n.end - n.start, s = i > 0 ? (r - n.start) / i : 1;
|
|
@@ -970,11 +1030,11 @@ class ft {
|
|
|
970
1030
|
};
|
|
971
1031
|
n.ready = this.manifest(t).then((a) => {
|
|
972
1032
|
if (n.released)
|
|
973
|
-
throw
|
|
1033
|
+
throw f();
|
|
974
1034
|
return n.opened = {
|
|
975
1035
|
manifest: a,
|
|
976
1036
|
times: Float64Array.from(_(a)),
|
|
977
|
-
grid:
|
|
1037
|
+
grid: Ve(a),
|
|
978
1038
|
source: this.createFrameSource(a, {
|
|
979
1039
|
cacheSize: this.frameCacheSize
|
|
980
1040
|
})
|
|
@@ -991,7 +1051,7 @@ class ft {
|
|
|
991
1051
|
n
|
|
992
1052
|
);
|
|
993
1053
|
if (t.released)
|
|
994
|
-
throw
|
|
1054
|
+
throw f();
|
|
995
1055
|
const c = await o.frame(r, { signal: n });
|
|
996
1056
|
return {
|
|
997
1057
|
key: `${this.id}/${t.chunk.key}/${r}`,
|
|
@@ -1016,7 +1076,7 @@ class ft {
|
|
|
1016
1076
|
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);
|
|
1017
1077
|
}
|
|
1018
1078
|
}
|
|
1019
|
-
function
|
|
1079
|
+
function M(e) {
|
|
1020
1080
|
const { start: t, end: r } = e.temporal ?? {};
|
|
1021
1081
|
return {
|
|
1022
1082
|
source: e,
|
|
@@ -1024,27 +1084,27 @@ function U(e) {
|
|
|
1024
1084
|
end: Date.parse(r ?? t ?? "")
|
|
1025
1085
|
};
|
|
1026
1086
|
}
|
|
1027
|
-
function
|
|
1028
|
-
const n = e.filter((i) => i.id === t.id && i.temporal?.start != null).map(
|
|
1087
|
+
function pt(e, t, r = {}) {
|
|
1088
|
+
const n = e.filter((i) => i.id === t.id && i.temporal?.start != null).map(M), a = Le(
|
|
1029
1089
|
n,
|
|
1030
1090
|
Date.parse(t.temporal?.end ?? ""),
|
|
1031
1091
|
r
|
|
1032
1092
|
);
|
|
1033
1093
|
return a ? { source: a.chunk.source, time: a.time } : null;
|
|
1034
1094
|
}
|
|
1035
|
-
function
|
|
1036
|
-
return
|
|
1095
|
+
function bt(e, t) {
|
|
1096
|
+
return Ce(M(e), t.map(M))?.source ?? null;
|
|
1037
1097
|
}
|
|
1038
|
-
function
|
|
1098
|
+
function wt(e) {
|
|
1039
1099
|
return e.type === "geovideo" && typeof e.indexUrl == "string";
|
|
1040
1100
|
}
|
|
1041
|
-
function
|
|
1101
|
+
function Rt(e, t) {
|
|
1042
1102
|
return e.id === t.id && (e.type !== "geovideo" || t.type !== "geovideo" || e.manifestUrl === t.manifestUrl);
|
|
1043
1103
|
}
|
|
1044
1104
|
function B(e) {
|
|
1045
1105
|
return typeof e == "string" && Number.isFinite(Date.parse(e));
|
|
1046
1106
|
}
|
|
1047
|
-
function
|
|
1107
|
+
function Ye(e) {
|
|
1048
1108
|
const t = e;
|
|
1049
1109
|
if (!t || t.schemaVersion !== 1 || t.type !== "geovideo-index" || !Array.isArray(t.chunks))
|
|
1050
1110
|
throw new Error("Unsupported GeoVideo index");
|
|
@@ -1053,19 +1113,19 @@ function qe(e) {
|
|
|
1053
1113
|
throw new Error("Invalid GeoVideo index chunk");
|
|
1054
1114
|
return t;
|
|
1055
1115
|
}
|
|
1056
|
-
async function
|
|
1116
|
+
async function _t(e, t) {
|
|
1057
1117
|
const r = await fetch(e, { signal: t });
|
|
1058
1118
|
if (!r.ok)
|
|
1059
1119
|
throw new Error(
|
|
1060
1120
|
`GeoVideo index request failed (${r.status}): ${e}`
|
|
1061
1121
|
);
|
|
1062
|
-
return
|
|
1122
|
+
return Ye(await r.json());
|
|
1063
1123
|
}
|
|
1064
|
-
function
|
|
1124
|
+
function ze(e) {
|
|
1065
1125
|
return typeof document < "u" ? new URL(e, document.baseURI).href : e;
|
|
1066
1126
|
}
|
|
1067
|
-
function
|
|
1068
|
-
const r =
|
|
1127
|
+
function je(e, t) {
|
|
1128
|
+
const r = ze(t);
|
|
1069
1129
|
return e.chunks.map((n) => ({
|
|
1070
1130
|
key: n.key,
|
|
1071
1131
|
manifestUrl: new URL(n.manifestUrl, r).href,
|
|
@@ -1075,15 +1135,15 @@ function We(e, t) {
|
|
|
1075
1135
|
...n.provisional ? { provisional: !0 } : {}
|
|
1076
1136
|
}));
|
|
1077
1137
|
}
|
|
1078
|
-
function
|
|
1138
|
+
function Ke(e, t, r) {
|
|
1079
1139
|
if (t.sourceId !== e.id || t.catalogEntryId !== r.id)
|
|
1080
1140
|
throw new Error(
|
|
1081
1141
|
`GeoVideo index identity does not match catalog entry/source: ${e.id}`
|
|
1082
1142
|
);
|
|
1083
1143
|
}
|
|
1084
|
-
function
|
|
1085
|
-
|
|
1086
|
-
const n =
|
|
1144
|
+
function At(e, t, r) {
|
|
1145
|
+
Ke(e, t, r);
|
|
1146
|
+
const n = je(t, e.indexUrl);
|
|
1087
1147
|
return t.chunks.map(
|
|
1088
1148
|
(a, i) => ({
|
|
1089
1149
|
id: e.id,
|
|
@@ -1101,48 +1161,49 @@ function pt(e, t, r) {
|
|
|
1101
1161
|
);
|
|
1102
1162
|
}
|
|
1103
1163
|
export {
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
Ze as
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1164
|
+
pt as A,
|
|
1165
|
+
_t as B,
|
|
1166
|
+
At as C,
|
|
1167
|
+
C as D,
|
|
1168
|
+
Tt as E,
|
|
1169
|
+
q as F,
|
|
1170
|
+
Ge as G,
|
|
1171
|
+
Ne as H,
|
|
1172
|
+
Ke as I,
|
|
1173
|
+
Be as J,
|
|
1174
|
+
g as K,
|
|
1175
|
+
Re as L,
|
|
1176
|
+
Ve as M,
|
|
1177
|
+
je as N,
|
|
1178
|
+
Le as O,
|
|
1179
|
+
bt as P,
|
|
1180
|
+
Ce as Q,
|
|
1181
|
+
Ye as R,
|
|
1182
|
+
ft as T,
|
|
1183
|
+
it as a,
|
|
1184
|
+
ot as b,
|
|
1185
|
+
Qe as c,
|
|
1186
|
+
tt as d,
|
|
1187
|
+
rt as e,
|
|
1188
|
+
at as f,
|
|
1189
|
+
st as g,
|
|
1190
|
+
Ze as h,
|
|
1191
|
+
nt as i,
|
|
1192
|
+
et as j,
|
|
1193
|
+
dt as k,
|
|
1194
|
+
lt as l,
|
|
1195
|
+
xe as m,
|
|
1196
|
+
ye as n,
|
|
1136
1197
|
fe as o,
|
|
1137
|
-
|
|
1198
|
+
Et as p,
|
|
1138
1199
|
_ as q,
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1200
|
+
me as r,
|
|
1201
|
+
ct as s,
|
|
1202
|
+
Rt as t,
|
|
1203
|
+
mt as u,
|
|
1204
|
+
ht as v,
|
|
1205
|
+
ve as w,
|
|
1206
|
+
ut as x,
|
|
1207
|
+
Je as y,
|
|
1208
|
+
wt as z
|
|
1148
1209
|
};
|