@fxi/zartigl 0.12.0 → 0.13.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.
@@ -1,45 +1,45 @@
1
1
  import "./backdrop-Dceb4d8E.js";
2
- const Te = { label: "Thermal", tags: ["sequential", "temperature"], colors: ["#042333", "#2c3395", "#744796", "#b15f82", "#eb7958", "#fbb43d", "#e8fa5b"] }, be = { label: "Haline", tags: ["sequential", "salinity"], colors: ["#2a186c", "#17568b", "#1a7e8f", "#22a785", "#55c666", "#aadc32", "#fde333"] }, we = { label: "Solar", tags: ["sequential", "irradiance"], colors: ["#330f0b", "#6b2313", "#a83c12", "#d6621a", "#f3951e", "#f7c741", "#f9f871"] }, ye = { label: "Ice", tags: ["sequential"], colors: ["#040d1a", "#123365", "#1c5f9e", "#2b8ece", "#62bde3", "#aaddf2", "#f2faff"] }, _e = { label: "Deep", tags: ["sequential", "depth"], colors: ["#fdfecc", "#c8e59b", "#74c8a3", "#3194b0", "#2a5b8e", "#281a5e", "#0c0820"] }, Re = { label: "RdYlBu", tags: ["diverging"], colors: ["#3288bd", "#66c2a5", "#abdda4", "#e6f598", "#fee08b", "#fdae61", "#f46d43", "#d53e4f"] }, xe = { label: "Dense", tags: ["sequential"], colors: ["#e6f1f1", "#92c4ca", "#44929a", "#20627a", "#1a3c6a", "#211a50", "#0d0621"] }, ve = { label: "Algae", tags: ["sequential", "biology", "log"], colors: ["#d7f9d0", "#a2d595", "#64b463", "#129450", "#126e45", "#1a482f", "#122414"] }, ke = { label: "Oxygen", tags: ["sequential", "biology", "hypoxia"], colors: ["#09060f", "#5b1028", "#d43d2f", "#f39b3d", "#f3e7b3", "#79cbd1", "#176b9c"] }, Ae = { label: "Matter", tags: ["sequential", "biology"], colors: ["#fdfecc", "#f2c98a", "#e07c4e", "#bc3754", "#8d1a6d", "#51156b", "#1c0c3f"] }, Fe = { label: "Viridis", tags: ["sequential", "perceptual"], colors: ["#440154", "#443983", "#31688e", "#21918c", "#35b779", "#90d743", "#fde725"] }, Se = { label: "Plasma", tags: ["sequential", "perceptual"], colors: ["#0d0887", "#5e01a6", "#9c179e", "#cc4778", "#ed7953", "#fdb42f", "#f0f921"] }, Ue = { label: "Cyclic", tags: ["cyclic", "direction"], colors: ["#2e22ea", "#b541fb", "#fc93c0", "#f1ee35", "#77c80d", "#458776", "#2c24e9"] }, Me = { label: "Tempo", tags: ["sequential"], colors: ["#fff6f4", "#c2d1b9", "#7db390", "#2a937f", "#156d73", "#1c455b", "#151d44"] }, De = { label: "Turbid", tags: ["sequential", "biology", "log"], colors: ["#e9f5a0", "#c8c86e", "#a09845", "#786031", "#533324", "#341423", "#150d17"] }, Pe = { label: "Speed", tags: ["sequential", "velocity"], colors: ["#fcfea4", "#d5e429", "#94c63e", "#52a657", "#2d8169", "#1d5b6d", "#0d3361"] }, Ne = { label: "Amp", tags: ["sequential"], colors: ["#f2f2f2", "#c0b8db", "#9180b6", "#6c4e9e", "#4e2e83", "#32185d", "#110a35"] }, Ge = { label: "Heat", tags: ["sequential"], colors: ["#fde725", "#fde725", "#f8961e", "#e63946", "#9d0208", "#3a0007"] }, Ie = { label: "Balance", tags: ["diverging"], colors: ["#181c43", "#3066af", "#9bbcdd", "#f2f2f2", "#e07d53", "#b13626", "#2c0b0e"] }, Le = { label: "Delta", tags: ["diverging"], colors: ["#0e3f31", "#20877b", "#99d4c1", "#f2f2f2", "#a1b0d4", "#3c5b9e", "#0d1938"] }, Ce = { label: "Curl", tags: ["diverging"], colors: ["#152237", "#2471b3", "#8dbac4", "#f2f2f2", "#c79f84", "#a63827", "#270b17"] }, Ve = { label: "Gray", tags: ["sequential"], colors: ["#000000", "#252525", "#4d4d4d", "#7a7a7a", "#a8a8a8", "#d4d4d4", "#ffffff"] }, he = {
3
- thermal: Te,
2
+ const we = { label: "Thermal", tags: ["sequential", "temperature"], colors: ["#042333", "#2c3395", "#744796", "#b15f82", "#eb7958", "#fbb43d", "#e8fa5b"] }, ye = { label: "Haline", tags: ["sequential", "salinity"], colors: ["#2a186c", "#17568b", "#1a7e8f", "#22a785", "#55c666", "#aadc32", "#fde333"] }, Re = { label: "Solar", tags: ["sequential", "irradiance"], colors: ["#330f0b", "#6b2313", "#a83c12", "#d6621a", "#f3951e", "#f7c741", "#f9f871"] }, _e = { label: "Ice", tags: ["sequential"], colors: ["#040d1a", "#123365", "#1c5f9e", "#2b8ece", "#62bde3", "#aaddf2", "#f2faff"] }, xe = { label: "Deep", tags: ["sequential", "depth"], colors: ["#fdfecc", "#c8e59b", "#74c8a3", "#3194b0", "#2a5b8e", "#281a5e", "#0c0820"] }, ve = { label: "RdYlBu", tags: ["diverging"], colors: ["#3288bd", "#66c2a5", "#abdda4", "#e6f598", "#fee08b", "#fdae61", "#f46d43", "#d53e4f"] }, Ae = { label: "Dense", tags: ["sequential"], colors: ["#e6f1f1", "#92c4ca", "#44929a", "#20627a", "#1a3c6a", "#211a50", "#0d0621"] }, ke = { label: "Algae", tags: ["sequential", "biology", "log"], colors: ["#d7f9d0", "#a2d595", "#64b463", "#129450", "#126e45", "#1a482f", "#122414"] }, Fe = { label: "Oxygen", tags: ["sequential", "biology", "hypoxia"], colors: ["#09060f", "#5b1028", "#d43d2f", "#f39b3d", "#f3e7b3", "#79cbd1", "#176b9c"] }, Se = { label: "Matter", tags: ["sequential", "biology"], colors: ["#fdfecc", "#f2c98a", "#e07c4e", "#bc3754", "#8d1a6d", "#51156b", "#1c0c3f"] }, Ue = { label: "Viridis", tags: ["sequential", "perceptual"], colors: ["#440154", "#443983", "#31688e", "#21918c", "#35b779", "#90d743", "#fde725"] }, Me = { label: "Plasma", tags: ["sequential", "perceptual"], colors: ["#0d0887", "#5e01a6", "#9c179e", "#cc4778", "#ed7953", "#fdb42f", "#f0f921"] }, De = { label: "Cyclic", tags: ["cyclic", "direction"], colors: ["#2e22ea", "#b541fb", "#fc93c0", "#f1ee35", "#77c80d", "#458776", "#2c24e9"] }, Pe = { label: "Tempo", tags: ["sequential"], colors: ["#fff6f4", "#c2d1b9", "#7db390", "#2a937f", "#156d73", "#1c455b", "#151d44"] }, Ne = { label: "Turbid", tags: ["sequential", "biology", "log"], colors: ["#e9f5a0", "#c8c86e", "#a09845", "#786031", "#533324", "#341423", "#150d17"] }, Ge = { label: "Speed", tags: ["sequential", "velocity"], colors: ["#fcfea4", "#d5e429", "#94c63e", "#52a657", "#2d8169", "#1d5b6d", "#0d3361"] }, Ie = { label: "Amp", tags: ["sequential"], colors: ["#f2f2f2", "#c0b8db", "#9180b6", "#6c4e9e", "#4e2e83", "#32185d", "#110a35"] }, Le = { label: "Heat", tags: ["sequential"], colors: ["#fde725", "#fde725", "#f8961e", "#e63946", "#9d0208", "#3a0007"] }, Ce = { label: "Balance", tags: ["diverging"], colors: ["#181c43", "#3066af", "#9bbcdd", "#f2f2f2", "#e07d53", "#b13626", "#2c0b0e"] }, Ve = { label: "Delta", tags: ["diverging"], colors: ["#0e3f31", "#20877b", "#99d4c1", "#f2f2f2", "#a1b0d4", "#3c5b9e", "#0d1938"] }, Oe = { label: "Curl", tags: ["diverging"], colors: ["#152237", "#2471b3", "#8dbac4", "#f2f2f2", "#c79f84", "#a63827", "#270b17"] }, Be = { label: "Gray", tags: ["sequential"], colors: ["#000000", "#252525", "#4d4d4d", "#7a7a7a", "#a8a8a8", "#d4d4d4", "#ffffff"] }, ue = {
3
+ thermal: we,
4
4
  "thermal-alt": { label: "Thermal Alt", tags: ["sequential", "temperature"], colors: ["#176b9c", "#79cbd1", "#f3e7b3", "#f39b3d", "#d43d2f", "#5b1028", "#09060f"] },
5
- haline: be,
6
- solar: we,
7
- ice: ye,
8
- deep: _e,
9
- rdylbu: Re,
10
- dense: xe,
11
- algae: ve,
12
- oxygen: ke,
13
- matter: Ae,
14
- viridis: Fe,
15
- plasma: Se,
16
- cyclic: Ue,
17
- tempo: Me,
18
- turbid: De,
19
- speed: Pe,
20
- amp: Ne,
21
- heat: Ge,
5
+ haline: ye,
6
+ solar: Re,
7
+ ice: _e,
8
+ deep: xe,
9
+ rdylbu: ve,
10
+ dense: Ae,
11
+ algae: ke,
12
+ oxygen: Fe,
13
+ matter: Se,
14
+ viridis: Ue,
15
+ plasma: Me,
16
+ cyclic: De,
17
+ tempo: Pe,
18
+ turbid: Ne,
19
+ speed: Ge,
20
+ amp: Ie,
21
+ heat: Le,
22
22
  "heat-alert": { label: "Heat Alert", tags: ["sequential", "alpha", "deprecated"], colors: ["#fde72500", "#fde725cc", "#f8961e", "#e63946", "#9d0208", "#3a0007"] },
23
- balance: Ie,
24
- delta: Le,
25
- curl: Ce,
23
+ balance: Ce,
24
+ delta: Ve,
25
+ curl: Oe,
26
26
  "mono-black": { label: "Black", tags: ["monochrome", "particles"], colors: ["#000000", "#000000"] },
27
27
  "mono-white": { label: "White", tags: ["monochrome", "particles"], colors: ["#ffffff", "#ffffff"] },
28
28
  "mono-pink": { label: "Pink", tags: ["monochrome", "particles"], colors: ["#ff2aa1", "#ff2aa1"] },
29
- gray: Ve
30
- }, re = 64, Oe = {
29
+ gray: Be
30
+ }, ne = 64, Xe = {
31
31
  linear: (t) => t,
32
32
  // Rises fast: values just inside the zone already show.
33
33
  log: (t) => Math.log10(1 + 9 * t),
34
34
  // Stays faint longer: codec noise at the end of the range stays hidden.
35
35
  exp: (t) => (10 ** t - 1) / 9
36
36
  };
37
- function Be(t, e) {
38
- const i = Oe[e.curve ?? "linear"], r = e.low ?? 0, n = e.high ?? 0;
37
+ function $e(t, e) {
38
+ const i = Xe[e.curve ?? "linear"], r = e.low ?? 0, n = e.high ?? 0;
39
39
  let s = 1;
40
40
  return r > 0 && t < r && (s = Math.min(s, i(Math.max(t, 0) / r))), n > 0 && t > 1 - n && (s = Math.min(s, i(Math.max(1 - t, 0) / n))), s;
41
41
  }
42
- function Xe(t) {
42
+ function qe(t) {
43
43
  let e = t.replace("#", "");
44
44
  (e.length === 3 || e.length === 4) && (e = [...e].map((r) => r + r).join(""));
45
45
  const i = (r) => parseInt(e.slice(r, r + 2), 16);
@@ -50,46 +50,46 @@ function Xe(t) {
50
50
  e.length === 8 ? i(6) : 255
51
51
  ];
52
52
  }
53
- function $e([t, e, i, r]) {
53
+ function We([t, e, i, r]) {
54
54
  return `#${[t, e, i, r].map(
55
55
  (n) => Math.round(Math.min(255, Math.max(0, n))).toString(16).padStart(2, "0")
56
56
  ).join("")}`;
57
57
  }
58
- function qe(t, e) {
58
+ function He(t, e) {
59
59
  if (e <= t[0][0])
60
60
  return t[0][1];
61
61
  for (let i = 1; i < t.length; i++) {
62
62
  const [r, n] = t[i];
63
63
  if (e <= r) {
64
64
  const [s, o] = t[i - 1], a = r === s ? 1 : (e - s) / (r - s);
65
- return o.map((c, d) => c + (n[d] - c) * a);
65
+ return o.map((c, l) => c + (n[l] - c) * a);
66
66
  }
67
67
  }
68
68
  return t[t.length - 1][1];
69
69
  }
70
- function We(t, e) {
70
+ function ze(t, e) {
71
71
  const i = Object.entries(t).map(
72
- ([n, s]) => [Number(n), Xe(s)]
72
+ ([n, s]) => [Number(n), qe(s)]
73
73
  ).sort((n, s) => n[0] - s[0]), r = {};
74
- for (let n = 0; n <= re; n++) {
75
- const s = n / re, [o, a, c, d] = qe(i, s);
76
- r[s] = $e([o, a, c, d * Be(s, e)]);
74
+ for (let n = 0; n <= ne; n++) {
75
+ const s = n / ne, [o, a, c, l] = He(i, s);
76
+ r[s] = We([o, a, c, l * $e(s, e)]);
77
77
  }
78
78
  return r;
79
79
  }
80
- const He = (t) => !!t && ((t.low ?? 0) > 0 || (t.high ?? 0) > 0);
81
- function ne(t) {
80
+ const Ye = (t) => !!t && ((t.low ?? 0) > 0 || (t.high ?? 0) > 0);
81
+ function se(t) {
82
82
  const e = {}, i = t.length - 1;
83
83
  return t.forEach((r, n) => {
84
84
  e[i === 0 ? 0 : n / i] = r;
85
85
  }), e;
86
86
  }
87
- function ze(t, e) {
88
- const i = Ye(t, e?.reverse ?? !1);
89
- return He(e?.alphaFade) ? We(i, e.alphaFade) : i;
87
+ function je(t, e) {
88
+ const i = Ke(t, e?.reverse ?? !1);
89
+ return Ye(e?.alphaFade) ? ze(i, e.alphaFade) : i;
90
90
  }
91
- function Ye(t, e) {
92
- const i = he;
91
+ function Ke(t, e) {
92
+ const i = ue;
93
93
  if (typeof t == "string") {
94
94
  const r = i[t];
95
95
  if (!r)
@@ -99,22 +99,22 @@ function Ye(t, e) {
99
99
  ).join(", ")}`
100
100
  );
101
101
  const n = e ? [...r.colors].reverse() : r.colors;
102
- return ne(n);
102
+ return se(n);
103
103
  }
104
104
  if (Array.isArray(t)) {
105
105
  const r = e ? [...t].reverse() : t;
106
- return ne(r);
106
+ return se(r);
107
107
  }
108
108
  return e ? Object.fromEntries(
109
109
  Object.entries(t).map(([r, n]) => [1 - Number(r), n])
110
110
  ) : t;
111
111
  }
112
- function Kt(t = {}) {
113
- return Object.entries(he).map(([i, r]) => ({ id: i, ...r })).filter(
112
+ function Zt(t = {}) {
113
+ return Object.entries(ue).map(([i, r]) => ({ id: i, ...r })).filter(
114
114
  (i) => t.includeDeprecated || !i.tags.includes("deprecated")
115
115
  );
116
116
  }
117
- function se(t, e, i) {
117
+ function ae(t, e, i) {
118
118
  const r = t.createShader(e);
119
119
  if (!r)
120
120
  throw new Error("Failed to create shader");
@@ -124,18 +124,18 @@ function se(t, e, i) {
124
124
  }
125
125
  return r;
126
126
  }
127
- function Qt(t, e, i) {
127
+ function Jt(t, e, i) {
128
128
  const r = t.createProgram();
129
129
  if (!r)
130
130
  throw new Error("Failed to create program");
131
- const n = se(t, t.VERTEX_SHADER, e), s = se(t, t.FRAGMENT_SHADER, i);
131
+ const n = ae(t, t.VERTEX_SHADER, e), s = ae(t, t.FRAGMENT_SHADER, i);
132
132
  if (t.attachShader(r, n), t.attachShader(r, s), t.linkProgram(r), !t.getProgramParameter(r, t.LINK_STATUS)) {
133
133
  const o = t.getProgramInfoLog(r);
134
134
  throw t.deleteProgram(r), new Error(`Program link error: ${o}`);
135
135
  }
136
136
  return t.deleteShader(n), t.deleteShader(s), r;
137
137
  }
138
- function Zt(t, e, i, r, n) {
138
+ function ei(t, e, i, r, n) {
139
139
  const s = t.createTexture();
140
140
  if (!s)
141
141
  throw new Error("Failed to create texture");
@@ -151,7 +151,7 @@ function Zt(t, e, i, r, n) {
151
151
  i
152
152
  ), t.bindTexture(t.TEXTURE_2D, null), s;
153
153
  }
154
- function je(t, e, i) {
154
+ function Qe(t, e, i) {
155
155
  const r = t.getParameter(
156
156
  t.TEXTURE_BINDING_2D
157
157
  ), n = t.getParameter(
@@ -183,19 +183,19 @@ function je(t, e, i) {
183
183
  }
184
184
  return a;
185
185
  }
186
- function Ke(t) {
186
+ function Ze(t) {
187
187
  return {
188
188
  kind: "rgba8-packed",
189
189
  internalFormat: t.RGBA,
190
190
  type: t.UNSIGNED_BYTE
191
191
  };
192
192
  }
193
- function Jt(t) {
193
+ function ti(t) {
194
194
  if (typeof WebGL2RenderingContext > "u" || !(t instanceof WebGL2RenderingContext))
195
195
  throw new Error("zartigl requires WebGL2");
196
196
  return t;
197
197
  }
198
- function ei(t) {
198
+ function ii(t) {
199
199
  const e = [];
200
200
  t.getExtension("EXT_color_buffer_float") ? e.push(
201
201
  { kind: "float32", internalFormat: t.RGBA32F, type: t.FLOAT },
@@ -206,15 +206,15 @@ function ei(t) {
206
206
  type: t.HALF_FLOAT
207
207
  });
208
208
  for (const i of e)
209
- if (je(
209
+ if (Qe(
210
210
  t,
211
211
  i.internalFormat,
212
212
  i.type
213
213
  ))
214
214
  return i;
215
- return Ke(t);
215
+ return Ze(t);
216
216
  }
217
- function ti(t, e, i, r, n, s, o) {
217
+ function ri(t, e, i, r, n, s, o) {
218
218
  const a = t.createTexture();
219
219
  if (!a)
220
220
  throw new Error("Failed to create texture");
@@ -230,10 +230,10 @@ function ti(t, e, i, r, n, s, o) {
230
230
  i
231
231
  ), t.bindTexture(t.TEXTURE_2D, null), a;
232
232
  }
233
- function ii(t, e, i) {
233
+ function ni(t, e, i) {
234
234
  t.activeTexture(t.TEXTURE0 + i), t.bindTexture(t.TEXTURE_2D, e);
235
235
  }
236
- function ri(t, e) {
236
+ function si(t, e) {
237
237
  const i = t.createFramebuffer();
238
238
  if (!i)
239
239
  throw new Error("Failed to create framebuffer");
@@ -245,7 +245,7 @@ function ri(t, e) {
245
245
  0
246
246
  ), t.bindFramebuffer(t.FRAMEBUFFER, null), i;
247
247
  }
248
- function ni(t) {
248
+ function ai(t) {
249
249
  const e = t.createBuffer();
250
250
  if (!e)
251
251
  throw new Error("Failed to create buffer");
@@ -255,7 +255,7 @@ function ni(t) {
255
255
  t.STATIC_DRAW
256
256
  ), e;
257
257
  }
258
- const Qe = {
258
+ const Je = {
259
259
  0: "#3288bd",
260
260
  0.1: "#66c2a5",
261
261
  0.2: "#abdda4",
@@ -265,19 +265,19 @@ const Qe = {
265
265
  0.6: "#f46d43",
266
266
  1: "#d53e4f"
267
267
  };
268
- function si(t, e, i) {
269
- const r = ze(e ?? Qe, i), n = document.createElement("canvas");
268
+ function oi(t, e, i) {
269
+ const r = je(e ?? Je, i), n = document.createElement("canvas");
270
270
  n.width = 256, n.height = 1;
271
271
  const s = n.getContext("2d"), o = s.createLinearGradient(0, 0, 256, 0);
272
- for (const [c, d] of Object.entries(r))
273
- o.addColorStop(Number(c), d);
272
+ for (const [c, l] of Object.entries(r))
273
+ o.addColorStop(Number(c), l);
274
274
  s.fillStyle = o, s.fillRect(0, 0, 256, 1);
275
275
  const a = t.createTexture();
276
276
  if (!a)
277
277
  throw new Error("Failed to create color ramp texture");
278
278
  return t.bindTexture(t.TEXTURE_2D, a), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_WRAP_S, t.CLAMP_TO_EDGE), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_WRAP_T, t.CLAMP_TO_EDGE), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_MIN_FILTER, t.LINEAR), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_MAG_FILTER, t.LINEAR), t.texImage2D(t.TEXTURE_2D, 0, t.RGBA, t.RGBA, t.UNSIGNED_BYTE, n), t.bindTexture(t.TEXTURE_2D, null), a;
279
279
  }
280
- function ai(t) {
280
+ function ci(t) {
281
281
  const e = t.getExtension("WEBGL_debug_renderer_info");
282
282
  return {
283
283
  vendor: String(t.getParameter(t.VENDOR) ?? ""),
@@ -287,7 +287,7 @@ function ai(t) {
287
287
  version: String(t.getParameter(t.VERSION) ?? "")
288
288
  };
289
289
  }
290
- function oi(t) {
290
+ function li(t) {
291
291
  return {
292
292
  program: t.getParameter(t.CURRENT_PROGRAM),
293
293
  activeTexture: t.getParameter(t.ACTIVE_TEXTURE),
@@ -304,10 +304,10 @@ function oi(t) {
304
304
  ]
305
305
  };
306
306
  }
307
- function ci(t, e) {
307
+ function di(t, e) {
308
308
  t.useProgram(e.program), t.activeTexture(e.activeTexture), t.bindBuffer(t.ARRAY_BUFFER, e.arrayBuffer), t.bindBuffer(t.ELEMENT_ARRAY_BUFFER, e.elementBuffer), t.bindFramebuffer(t.FRAMEBUFFER, e.framebuffer), e.blend ? t.enable(t.BLEND) : t.disable(t.BLEND), e.depthTest ? t.enable(t.DEPTH_TEST) : t.disable(t.DEPTH_TEST), e.stencilTest ? t.enable(t.STENCIL_TEST) : t.disable(t.STENCIL_TEST), t.viewport(e.viewport[0], e.viewport[1], e.viewport[2], e.viewport[3]), t.blendFunc(e.blendFunc[0], e.blendFunc[1]);
309
309
  }
310
- const Ze = {
310
+ const et = {
311
311
  degrees_c: "°C",
312
312
  degc: "°C",
313
313
  degrees_celsius: "°C",
@@ -323,7 +323,7 @@ const Ze = {
323
323
  "0.001": "PSU",
324
324
  psu: "PSU",
325
325
  stress_level: ""
326
- }, Je = {
326
+ }, tt = {
327
327
  meter: "m",
328
328
  meters: "m",
329
329
  metre: "m",
@@ -346,12 +346,12 @@ const Ze = {
346
346
  newton: "N",
347
347
  pascal: "Pa",
348
348
  kelvin: "K"
349
- }, et = "⁰¹²³⁴⁵⁶⁷⁸⁹";
350
- function ae(t) {
351
- return t === 1 ? "" : [...String(t)].map((e) => et[Number(e)]).join("");
349
+ }, it = "⁰¹²³⁴⁵⁶⁷⁸⁹";
350
+ function oe(t) {
351
+ return t === 1 ? "" : [...String(t)].map((e) => it[Number(e)]).join("");
352
352
  }
353
- function di(t) {
354
- const e = t?.trim() ?? "", i = Ze[e.toLowerCase()];
353
+ function hi(t) {
354
+ const e = t?.trim() ?? "", i = et[e.toLowerCase()];
355
355
  if (i != null)
356
356
  return i;
357
357
  if (e.includes("/"))
@@ -361,21 +361,21 @@ function di(t) {
361
361
  const o = /^([A-Za-z]+)\^?(-?\d+)?$/.exec(s);
362
362
  if (!o)
363
363
  return e.replace(/_/g, " ");
364
- const a = Je[o[1]] ?? o[1], c = Number(o[2] ?? 1);
365
- c < 0 ? n.push(a + ae(-c)) : r.push(a + ae(c));
364
+ const a = tt[o[1]] ?? o[1], c = Number(o[2] ?? 1);
365
+ c < 0 ? n.push(a + oe(-c)) : r.push(a + oe(c));
366
366
  }
367
367
  return [r.join(" ") || "1", ...n].join("/");
368
368
  }
369
- const oe = 20, tt = 600;
370
- function it(t) {
369
+ const ce = 20, rt = 600;
370
+ function nt(t) {
371
371
  const e = Math.max(0, Math.min(1, t));
372
- return oe * Math.pow(tt / oe, e);
372
+ return ce * Math.pow(rt / ce, e);
373
373
  }
374
- function li(t) {
375
- return Math.exp(-1 / it(t));
374
+ function ui(t) {
375
+ return Math.exp(-1 / nt(t));
376
376
  }
377
- const rt = 0.8, nt = 120, st = 300;
378
- class hi {
377
+ const st = 0.8, at = 120, ot = 300;
378
+ class fi {
379
379
  constructor(e) {
380
380
  this.base = e, this.moving = !1, this.start = 0, this.duration = 0, this.from = e, this.to = e;
381
381
  }
@@ -384,7 +384,7 @@ class hi {
384
384
  this.base = e, this.moving || (this.from = e, this.to = e, this.duration = 0);
385
385
  }
386
386
  setMoving(e, i) {
387
- e !== this.moving && (this.from = this.value(i), this.moving = e, this.to = e ? rt : this.base, this.start = i, this.duration = e ? nt : st);
387
+ e !== this.moving && (this.from = this.value(i), this.moving = e, this.to = e ? st : this.base, this.start = i, this.duration = e ? at : ot);
388
388
  }
389
389
  value(e) {
390
390
  if (this.duration === 0)
@@ -393,7 +393,7 @@ class hi {
393
393
  return i === 1 ? (this.duration = 0, this.from = this.to, this.to) : this.from + (this.to - this.from) * i * i * (3 - 2 * i);
394
394
  }
395
395
  }
396
- var at = `vec3 velocityValue(vec4 texel, vec2 minimum, vec2 maximum, float physical) {
396
+ var ct = `vec3 velocityValue(vec4 texel, vec2 minimum, vec2 maximum, float physical) {
397
397
  if (physical > 0.5) return texel.xyz;
398
398
  return vec3(mix(minimum, maximum, texel.rg), texel.a);
399
399
  }
@@ -401,7 +401,7 @@ var at = `vec3 velocityValue(vec4 texel, vec2 minimum, vec2 maximum, float physi
401
401
  vec3 blendVelocity(vec3 a, vec3 b, float fraction) {
402
402
  if (fraction <= 0.0) return a;
403
403
  return mix(a, b, fraction);
404
- }`, ot = `vec3 applyVibrance(vec3 c, float v) {
404
+ }`, lt = `vec3 applyVibrance(vec3 c, float v) {
405
405
  float mx = max(c.r, max(c.g, c.b));
406
406
  float mn = min(c.r, min(c.g, c.b));
407
407
  float boost = v * (1.0 - (mx - mn));
@@ -422,7 +422,7 @@ vec3 gradeColor(vec3 c, vec4 g) {
422
422
 
423
423
  c = mix(c, c * c * (3.0 - 2.0 * c), g.y);
424
424
  return clamp(applyVibrance(c, g.z), 0.0, 1.0);
425
- }`, ct = `uniform vec2 u_code_range;
425
+ }`, dt = `uniform vec2 u_code_range;
426
426
  uniform vec2 u_value_range;
427
427
  uniform float u_scalar_transfer;
428
428
 
@@ -434,7 +434,7 @@ float geoVideoScalarValue(float r) {
434
434
  float code = geoVideoScalarCode(r);
435
435
  float t = mix(code, (pow(10.0, code) - 1.0) / 9.0, u_scalar_transfer);
436
436
  return mix(u_value_range.x, u_value_range.y, t);
437
- }`, dt = `uint pcg(uint v) {
437
+ }`, ht = `uint pcg(uint v) {
438
438
  uint state = v * 747796405u + 2891336453u;
439
439
  uint word = ((state >> ((state >> 28u) + 4u)) ^ state) * 277803737u;
440
440
  return (word >> 22u) ^ word;
@@ -442,13 +442,13 @@ float geoVideoScalarValue(float r) {
442
442
 
443
443
  float random(uvec3 v) {
444
444
  return float(pcg(v.x ^ pcg(v.y ^ pcg(v.z))) >> 8u) * (1.0 / 16777216.0);
445
- }`, lt = `vec3 applyVibrance(vec3 c, float v) {
445
+ }`, ut = `vec3 applyVibrance(vec3 c, float v) {
446
446
  float mx = max(c.r, max(c.g, c.b));
447
447
  float mn = min(c.r, min(c.g, c.b));
448
448
  float boost = v * (1.0 - (mx - mn));
449
449
  float luma = dot(c, vec3(0.299, 0.587, 0.114));
450
450
  return mix(vec3(luma), c, 1.0 + boost);
451
- }`, ht = `#define GLOW_SCALE 4
451
+ }`, ft = `#define GLOW_SCALE 4
452
452
 
453
453
  vec4 glowGather(sampler2D trails, ivec2 texel) {
454
454
  ivec2 last = textureSize(trails, 0) - 1;
@@ -476,8 +476,8 @@ vec4 addGlow(vec4 trail, sampler2D glowTex, vec2 uv, float gain) {
476
476
  vec3 rgb = (trail.rgb * trail.a + glow.rgb * under) / max(alpha, 1e-4);
477
477
  return vec4(rgb, alpha);
478
478
  }`;
479
- const ui = lt, fi = ot, mi = dt, pi = ct, Ei = at, gi = ht, Ti = 4, bi = 1.2;
480
- function wi(t) {
479
+ const mi = ut, pi = lt, Ei = ht, gi = dt, Ti = ct, bi = ft, wi = 4, yi = 1.2;
480
+ function Ri(t) {
481
481
  if (t == null)
482
482
  return null;
483
483
  if (!Number.isFinite(t[0]) || !Number.isFinite(t[1]) || t[0] >= t[1])
@@ -499,12 +499,12 @@ function B(t, e) {
499
499
  throw new Error(`Invalid GeoVideo manifest ${e}`);
500
500
  return i;
501
501
  }
502
- function j(t) {
502
+ function K(t) {
503
503
  return typeof t == "string" && /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/.test(
504
504
  t
505
505
  );
506
506
  }
507
- function ce(t) {
507
+ function le(t) {
508
508
  if (!t || typeof t != "object")
509
509
  throw new Error("Invalid GeoVideo manifest");
510
510
  const e = t;
@@ -530,21 +530,21 @@ function ce(t) {
530
530
  const a = e.encoding;
531
531
  if (!a || a.bits !== 8 || a.colorSpace !== "bt709" || a.colorRange !== "limited" && a.colorRange !== "full")
532
532
  throw new Error("Invalid GeoVideo encoding");
533
- const c = x(a.codeMin, "encoding.codeMin"), d = x(a.codeMax, "encoding.codeMax");
534
- if (c < 0 || d > 255 || c >= d)
533
+ const c = x(a.codeMin, "encoding.codeMin"), l = x(a.codeMax, "encoding.codeMax");
534
+ if (c < 0 || l > 255 || c >= l)
535
535
  throw new Error("Invalid GeoVideo code range");
536
- let l = o.height;
536
+ let d = o.height;
537
537
  if (a.kind === "scalar-luma") {
538
538
  if (a.transfer !== "linear" && a.transfer !== "log10-1p9" || x(a.valueMin, "encoding.valueMin") >= x(a.valueMax, "encoding.valueMax"))
539
539
  throw new Error("Invalid GeoVideo scalar-luma encoding");
540
540
  } else if (a.kind === "vector-luma") {
541
541
  if (a.transfer !== "linear" && a.transfer !== "sqrt" || a.layout !== "stacked-uv" || x(a.valueDomain, "encoding.valueDomain") <= 0 || o.height % 2 !== 0)
542
542
  throw new Error("Invalid GeoVideo vector-luma encoding");
543
- l = o.height / 2;
543
+ d = o.height / 2;
544
544
  } else
545
545
  throw new Error("Unsupported GeoVideo encoding");
546
546
  const h = e.mask;
547
- if (!h || h.kind !== "static-validity" || typeof h.url != "string" || !h.url || x(h.width, "mask.width") !== o.width || x(h.height, "mask.height") !== l || x(h.threshold, "mask.threshold") < 0 || h.threshold > 1)
547
+ if (!h || h.kind !== "static-validity" || typeof h.url != "string" || !h.url || x(h.width, "mask.width") !== o.width || x(h.height, "mask.height") !== d || x(h.threshold, "mask.threshold") < 0 || h.threshold > 1)
548
548
  throw new Error("Invalid GeoVideo static mask");
549
549
  if (e.timeline?.kind === "range") {
550
550
  const m = B(e.timeline.dateStart, "timeline.dateStart");
@@ -569,19 +569,19 @@ function ce(t) {
569
569
  const p = e.style?.colorDomain;
570
570
  if (!Array.isArray(p) || p.length !== 2 || !p.every(Number.isFinite) || p[0] >= p[1])
571
571
  throw new Error("Invalid GeoVideo color domain");
572
- if (!j(e.id) || !e.provenance || !j(e.provenance.catalogEntryId) || !j(e.provenance.inputSourceId) || !Array.isArray(e.provenance.variables) || e.provenance.variables.length === 0)
572
+ if (!K(e.id) || !e.provenance || !K(e.provenance.catalogEntryId) || !K(e.provenance.inputSourceId) || !Array.isArray(e.provenance.variables) || e.provenance.variables.length === 0)
573
573
  throw new Error("Invalid GeoVideo provenance");
574
574
  return { ...e, bounds: [i, r, n, s] };
575
575
  }
576
- async function ut(t, e) {
576
+ async function mt(t, e) {
577
577
  if (typeof t != "string")
578
- return ce(t);
578
+ return le(t);
579
579
  const i = await fetch(t, { signal: e });
580
580
  if (!i.ok)
581
581
  throw new Error(
582
582
  `GeoVideo manifest request failed (${i.status}): ${t}`
583
583
  );
584
- const r = await i.json(), n = ce(r), s = typeof document < "u" ? new URL(t, document.baseURI).href : t;
584
+ const r = await i.json(), n = le(r), s = typeof document < "u" ? new URL(t, document.baseURI).href : t;
585
585
  return {
586
586
  ...n,
587
587
  media: { ...n.media, url: new URL(n.media.url, s).href },
@@ -602,13 +602,13 @@ function M(t) {
602
602
  (n, s) => e + (i - e) * s / (r - 1)
603
603
  );
604
604
  }
605
- function ue(t) {
605
+ function fe(t) {
606
606
  return t.timeline.kind === "sample-sequence" ? t.timeline.values.length / t.media.durationSeconds : t.media.fps;
607
607
  }
608
- function yi(t, e) {
609
- return e / ue(t);
608
+ function _i(t, e) {
609
+ return e / fe(t);
610
610
  }
611
- function ft(t, e) {
611
+ function pt(t, e) {
612
612
  if (t.timeline.kind === "snapshot-loop")
613
613
  return 0;
614
614
  if (t.timeline.kind === "sample-sequence") {
@@ -620,22 +620,22 @@ function ft(t, e) {
620
620
  return o * a + Math.min(a / 2, 0.5 / t.media.fps);
621
621
  }
622
622
  const i = new Date(t.timeline.dateStart).getTime(), r = new Date(t.timeline.dateEnd).getTime();
623
- return Math.max(0, Math.min(1, (e - i) / (r - i))) * fe(t);
623
+ return Math.max(0, Math.min(1, (e - i) / (r - i))) * me(t);
624
624
  }
625
- function _i(t, e) {
625
+ function xi(t, e) {
626
626
  if (t.timeline.kind === "snapshot-loop")
627
627
  return new Date(t.timeline.date).getTime();
628
628
  if (t.timeline.kind === "sample-sequence") {
629
629
  const o = M(t), a = t.media.durationSeconds / o.length, c = Math.floor((e + 0.25 / t.media.fps) / a);
630
630
  return o[Math.max(0, Math.min(o.length - 1, c))];
631
631
  }
632
- const i = new Date(t.timeline.dateStart).getTime(), r = new Date(t.timeline.dateEnd).getTime(), n = fe(t), s = n > 0 ? Math.max(0, Math.min(1, e / n)) : 0;
632
+ const i = new Date(t.timeline.dateStart).getTime(), r = new Date(t.timeline.dateEnd).getTime(), n = me(t), s = n > 0 ? Math.max(0, Math.min(1, e / n)) : 0;
633
633
  return i + (r - i) * s;
634
634
  }
635
- function fe(t) {
635
+ function me(t) {
636
636
  return Math.max(0, t.media.durationSeconds - 1 / t.media.fps);
637
637
  }
638
- function mt(t, e) {
638
+ function Et(t, e) {
639
639
  const i = new Uint8Array(t.length / 4);
640
640
  for (let r = 0; r < i.length; r++) {
641
641
  const n = t[r * 4];
@@ -643,7 +643,7 @@ function mt(t, e) {
643
643
  }
644
644
  return i;
645
645
  }
646
- class pt {
646
+ class gt {
647
647
  constructor() {
648
648
  this.gl = null, this.texture = null, this.framebuffer = null;
649
649
  }
@@ -695,23 +695,23 @@ function N(t, e, i) {
695
695
  });
696
696
  }) : t;
697
697
  }
698
- function K(t, e) {
698
+ function Q(t, e) {
699
699
  return new Promise(
700
700
  (i) => t.addEventListener(e, () => i(), { once: !0 })
701
701
  );
702
702
  }
703
- const Et = 250;
704
- function gt(t) {
703
+ const Tt = 250;
704
+ function bt(t) {
705
705
  return "requestVideoFrameCallback" in t ? Promise.race([
706
706
  new Promise(
707
707
  (e) => t.requestVideoFrameCallback(() => e())
708
708
  ),
709
- new Promise((e) => setTimeout(e, Et))
709
+ new Promise((e) => setTimeout(e, Tt))
710
710
  ]) : Promise.resolve();
711
711
  }
712
- class me {
712
+ class pe {
713
713
  constructor(e, i, r = {}) {
714
- this.reader = new pt(), 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 = e, this.planes = i, this.cacheSize = Math.max(1, r.cacheSize ?? 3), this.width = e.media.width, this.height = e.media.height / i, this.times = Float64Array.from(M(e));
714
+ this.reader = new gt(), 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 = e, this.planes = i, this.cacheSize = Math.max(1, r.cacheSize ?? 3), this.width = e.media.width, this.height = e.media.height / i, this.times = Float64Array.from(M(e));
715
715
  }
716
716
  /** Static validity, one 8-bit value per grid cell; null before init(). */
717
717
  get mask() {
@@ -720,7 +720,7 @@ class me {
720
720
  /** Luma codes of the presented frame, or null when it is blank. */
721
721
  readCodes(e, i) {
722
722
  const r = this.reader.read(e, this.width, i);
723
- return de(r) ? null : mt(r, this.manifest.encoding.colorRange);
723
+ return de(r) ? null : Et(r, this.manifest.encoding.colorRange);
724
724
  }
725
725
  /** True when the decoder exposed no pixels; reads back one row only. */
726
726
  isBlank(e) {
@@ -831,8 +831,8 @@ class me {
831
831
  async presentFrame(e, i) {
832
832
  if (this.presented && Math.abs(e.currentTime - i) <= 1e-3 && !e.seeking)
833
833
  return;
834
- const r = gt(e), n = K(e, "seeked");
835
- e.currentTime = i, await n, e.readyState < HTMLMediaElement.HAVE_CURRENT_DATA && await Promise.race([K(e, "loadeddata"), K(e, "canplay")]), await r, this.presented = !0;
834
+ const r = bt(e), n = Q(e, "seeked");
835
+ e.currentTime = i, await n, e.readyState < HTMLMediaElement.HAVE_CURRENT_DATA && await Promise.race([Q(e, "loadeddata"), Q(e, "canplay")]), await r, this.presented = !0;
836
836
  }
837
837
  /**
838
838
  * Some mobile browsers expose no decoded pixels to WebGL until playback
@@ -849,7 +849,7 @@ class me {
849
849
  }
850
850
  /** Media time inside the video frame showing step `index`. */
851
851
  stepSeconds(e) {
852
- return this.manifest.timeline.kind === "snapshot-loop" ? e / this.manifest.media.fps : ft(this.manifest, this.times[e]);
852
+ return this.manifest.timeline.kind === "snapshot-loop" ? e / this.manifest.media.fps : pt(this.manifest, this.times[e]);
853
853
  }
854
854
  /**
855
855
  * Seek and capture one step. `signal` aborts it between steps; a seek
@@ -877,14 +877,14 @@ class me {
877
877
  return a;
878
878
  }
879
879
  }
880
- function Tt(t) {
880
+ function wt(t) {
881
881
  return {
882
882
  codeRange: [t.codeMin / 255, t.codeMax / 255],
883
883
  valueRange: [t.valueMin, t.valueMax],
884
884
  transfer: t.transfer === "log10-1p9" ? 1 : 0
885
885
  };
886
886
  }
887
- class bt extends me {
887
+ class yt extends pe {
888
888
  constructor(e, i = {}) {
889
889
  if (e.encoding.kind !== "scalar-luma")
890
890
  throw new Error("GeoVideoScalarSource requires a scalar-luma manifest");
@@ -910,15 +910,15 @@ function v(t, e) {
910
910
  }
911
911
  return { index: r, fraction: (e - t[r]) / (t[n] - t[r]) };
912
912
  }
913
- function Q(t, e) {
913
+ function Z(t, e) {
914
914
  const { index: i, fraction: r } = v(t, e);
915
915
  return i + r;
916
916
  }
917
- function wt(t, e) {
917
+ function Rt(t, e) {
918
918
  const i = Math.max(0, Math.min(t.length - 1, Math.floor(e))), r = Math.min(i + 1, t.length - 1);
919
919
  return t[i] + (t[r] - t[i]) * Math.max(0, e - i);
920
920
  }
921
- function q(t, e, i) {
921
+ function W(t, e, i) {
922
922
  const r = [];
923
923
  let n = e;
924
924
  for (; n + 8 <= i; ) {
@@ -937,7 +937,7 @@ function q(t, e, i) {
937
937
  return r;
938
938
  }
939
939
  function b(t, e, i) {
940
- const r = q(t, e.start, e.end).find(
940
+ const r = W(t, e.start, e.end).find(
941
941
  (n) => n.type === i
942
942
  );
943
943
  if (!r)
@@ -945,12 +945,12 @@ function b(t, e, i) {
945
945
  return r;
946
946
  }
947
947
  function V(t, e, i) {
948
- return q(t, e.start, e.end).find((r) => r.type === i) ?? null;
948
+ return W(t, e.start, e.end).find((r) => r.type === i) ?? null;
949
949
  }
950
950
  function P(t, e) {
951
951
  return { at: e.start + 8, count: t.getUint32(e.start + 4) };
952
952
  }
953
- function yt(t, e, i) {
953
+ function _t(t, e, i) {
954
954
  const r = V(t, e, "edts"), n = r && V(t, r, "elst");
955
955
  if (!n)
956
956
  return;
@@ -958,8 +958,8 @@ function yt(t, e, i) {
958
958
  if (o !== 1 || a !== i)
959
959
  throw new Error("Unsupported MP4 edit list");
960
960
  }
961
- function _t(t) {
962
- const e = new DataView(t), i = { type: "file", start: 0, end: t.byteLength }, r = b(e, i, "moov"), n = q(e, r.start, r.end).find((f) => {
961
+ function xt(t) {
962
+ const e = new DataView(t), i = { type: "file", start: 0, end: t.byteLength }, r = b(e, i, "moov"), n = W(e, r.start, r.end).find((f) => {
963
963
  if (f.type !== "trak")
964
964
  return !1;
965
965
  const u = b(e, b(e, f, "mdia"), "hdlr");
@@ -971,67 +971,67 @@ function _t(t) {
971
971
  e,
972
972
  b(e, b(e, n, "mdia"), "minf"),
973
973
  "stbl"
974
- ), o = b(e, s, "stsd"), [a] = q(e, o.start + 8, o.end);
974
+ ), o = b(e, s, "stsd"), [a] = W(e, o.start + 8, o.end);
975
975
  if (!a || a.type !== "avc1" && a.type !== "avc3")
976
976
  throw new Error(`Unsupported MP4 sample entry ${a?.type}`);
977
- const c = e.getUint16(a.start + 24), d = e.getUint16(a.start + 26), l = b(e, { ...a, start: a.start + 78 }, "avcC"), h = new Uint8Array(t.slice(l.start, l.end)), p = (f) => h[f].toString(16).padStart(2, "0"), m = `avc1.${p(1)}${p(2)}${p(3)}`, E = b(e, s, "stsz"), w = e.getUint32(E.start + 4), y = e.getUint32(E.start + 8), A = Array.from(
977
+ const c = e.getUint16(a.start + 24), l = e.getUint16(a.start + 26), d = b(e, { ...a, start: a.start + 78 }, "avcC"), h = new Uint8Array(t.slice(d.start, d.end)), p = (f) => h[f].toString(16).padStart(2, "0"), m = `avc1.${p(1)}${p(2)}${p(3)}`, E = b(e, s, "stsz"), w = e.getUint32(E.start + 4), y = e.getUint32(E.start + 8), k = Array.from(
978
978
  { length: y },
979
979
  (f, u) => w || e.getUint32(E.start + 12 + u * 4)
980
980
  ), G = V(e, s, "co64"), O = G ?? b(e, s, "stco"), U = P(e, O), T = Array.from(
981
981
  { length: U.count },
982
982
  (f, u) => G ? Number(e.getBigUint64(U.at + u * 8)) : e.getUint32(U.at + u * 4)
983
- ), _ = P(e, b(e, s, "stsc")), F = [];
984
- for (let f = 0; f < _.count; f++) {
985
- const u = _.at + f * 12, I = e.getUint32(u) - 1, R = e.getUint32(u + 4), Y = f + 1 < _.count ? e.getUint32(u + 12) - 1 : T.length;
986
- for (let L = I; L < Y; L++) {
983
+ ), R = P(e, b(e, s, "stsc")), F = [];
984
+ for (let f = 0; f < R.count; f++) {
985
+ const u = R.at + f * 12, I = e.getUint32(u) - 1, _ = e.getUint32(u + 4), j = f + 1 < R.count ? e.getUint32(u + 12) - 1 : T.length;
986
+ for (let L = I; L < j; L++) {
987
987
  let C = T[L];
988
- for (let ie = 0; ie < R && F.length < y; ie++)
989
- F.push(C), C += A[F.length - 1];
988
+ for (let re = 0; re < _ && F.length < y; re++)
989
+ F.push(C), C += k[F.length - 1];
990
990
  }
991
991
  }
992
- const S = P(e, b(e, s, "stts")), k = [];
992
+ const S = P(e, b(e, s, "stts")), A = [];
993
993
  let D = 0;
994
994
  for (let f = 0; f < S.count; f++) {
995
995
  const u = e.getUint32(S.at + f * 8), I = e.getUint32(S.at + f * 8 + 4);
996
- for (let R = 0; R < u; R++)
997
- k.push(D), D += I;
996
+ for (let _ = 0; _ < u; _++)
997
+ A.push(D), D += I;
998
998
  }
999
- const H = V(e, s, "ctts");
1000
- if (H) {
1001
- const f = e.getUint8(H.start) === 1, u = P(e, H);
999
+ const z = V(e, s, "ctts");
1000
+ if (z) {
1001
+ const f = e.getUint8(z.start) === 1, u = P(e, z);
1002
1002
  let I = 0;
1003
- for (let R = 0; R < u.count; R++) {
1004
- const Y = e.getUint32(u.at + R * 8), L = f ? e.getInt32(u.at + R * 8 + 4) : e.getUint32(u.at + R * 8 + 4);
1005
- for (let C = 0; C < Y; C++)
1006
- k[I++] += L;
1003
+ for (let _ = 0; _ < u.count; _++) {
1004
+ const j = e.getUint32(u.at + _ * 8), L = f ? e.getInt32(u.at + _ * 8 + 4) : e.getUint32(u.at + _ * 8 + 4);
1005
+ for (let C = 0; C < j; C++)
1006
+ A[I++] += L;
1007
1007
  }
1008
1008
  }
1009
- yt(e, n, Math.min(...k.slice(0, y)));
1010
- const ge = k.slice(0, y).map((f, u) => [f, u]).sort((f, u) => f[0] - u[0]), ee = new Array(y);
1011
- ge.forEach(([, f], u) => ee[f] = u);
1012
- const z = V(e, s, "stss"), te = /* @__PURE__ */ new Set();
1013
- if (z) {
1014
- const f = P(e, z);
1009
+ _t(e, n, Math.min(...A.slice(0, y)));
1010
+ const be = A.slice(0, y).map((f, u) => [f, u]).sort((f, u) => f[0] - u[0]), te = new Array(y);
1011
+ be.forEach(([, f], u) => te[f] = u);
1012
+ const Y = V(e, s, "stss"), ie = /* @__PURE__ */ new Set();
1013
+ if (Y) {
1014
+ const f = P(e, Y);
1015
1015
  for (let u = 0; u < f.count; u++)
1016
- te.add(e.getUint32(f.at + u * 4) - 1);
1016
+ ie.add(e.getUint32(f.at + u * 4) - 1);
1017
1017
  }
1018
- if (F.length !== y || k.length < y)
1018
+ if (F.length !== y || A.length < y)
1019
1019
  throw new Error("Inconsistent MP4 sample tables");
1020
1020
  return {
1021
1021
  codec: m,
1022
1022
  description: h,
1023
1023
  width: c,
1024
- height: d,
1025
- samples: A.map((f, u) => ({
1024
+ height: l,
1025
+ samples: k.map((f, u) => ({
1026
1026
  offset: F[u],
1027
1027
  size: f,
1028
- frame: ee[u],
1029
- key: z ? te.has(u) : !0
1028
+ frame: te[u],
1029
+ key: Y ? ie.has(u) : !0
1030
1030
  }))
1031
1031
  };
1032
1032
  }
1033
- const Rt = 50;
1034
- class xt extends bt {
1033
+ const vt = 50;
1034
+ class At extends yt {
1035
1035
  constructor() {
1036
1036
  super(...arguments), this.track = null, this.data = null, this.sampleOfFrame = [], this.decoder = null, this.fed = -1, this.taken = -1, this.outputs = /* @__PURE__ */ new Map(), this.progress = null, this.failure = null, this.loading = null;
1037
1037
  }
@@ -1054,7 +1054,7 @@ class xt extends bt {
1054
1054
  const r = await i.arrayBuffer();
1055
1055
  let n;
1056
1056
  try {
1057
- n = _t(r);
1057
+ n = xt(r);
1058
1058
  } catch {
1059
1059
  return this.loading === e ? super.loadMedia() : void 0;
1060
1060
  }
@@ -1155,7 +1155,7 @@ class xt extends bt {
1155
1155
  /** Next output, dequeue or error; a timer for decoders without events. */
1156
1156
  waitProgress() {
1157
1157
  return new Promise((e) => {
1158
- const i = setTimeout(r, Rt);
1158
+ const i = setTimeout(r, vt);
1159
1159
  function r() {
1160
1160
  clearTimeout(i), e();
1161
1161
  }
@@ -1173,27 +1173,27 @@ class xt extends bt {
1173
1173
  this.outputs.clear();
1174
1174
  }
1175
1175
  }
1176
- function vt(t, e) {
1176
+ function kt(t, e) {
1177
1177
  let i = (t - e.codeMin) / (e.codeMax - e.codeMin) * 2 - 1;
1178
1178
  return i = Math.max(-1, Math.min(1, i)), e.transfer === "sqrt" && (i = Math.sign(i) * i * i), i * e.valueDomain;
1179
1179
  }
1180
- function kt(t, e, i, r) {
1180
+ function Ft(t, e, i, r) {
1181
1181
  const n = e.length;
1182
1182
  if (t.length !== 2 * n)
1183
1183
  throw new Error(
1184
1184
  `GeoVideo vector frame has ${t.length} codes, expected ${2 * n}`
1185
1185
  );
1186
1186
  const s = new Float32Array(256);
1187
- for (let d = 0; d < 256; d++)
1188
- s[d] = vt(d, r);
1187
+ for (let l = 0; l < 256; l++)
1188
+ s[l] = kt(l, r);
1189
1189
  const o = i * 255, a = new Float32Array(n), c = new Float32Array(n);
1190
- for (let d = 0; d < n; d++) {
1191
- const l = e[d] >= o;
1192
- a[d] = l ? s[t[d]] : NaN, c[d] = l ? s[t[n + d]] : NaN;
1190
+ for (let l = 0; l < n; l++) {
1191
+ const d = e[l] >= o;
1192
+ a[l] = d ? s[t[l]] : NaN, c[l] = d ? s[t[n + l]] : NaN;
1193
1193
  }
1194
1194
  return { u: a, v: c };
1195
1195
  }
1196
- class At extends me {
1196
+ class St extends pe {
1197
1197
  constructor(e, i = {}) {
1198
1198
  if (e.encoding.kind !== "vector-luma")
1199
1199
  throw new Error("GeoVideoVectorSource requires a vector-luma manifest");
@@ -1204,11 +1204,11 @@ class At extends me {
1204
1204
  vertical: new Float32Array([0]),
1205
1205
  latitude: Float32Array.from(
1206
1206
  { length: this.height },
1207
- (d, l) => o - (l + 0.5) * c
1207
+ (l, d) => o - (d + 0.5) * c
1208
1208
  ),
1209
1209
  longitude: Float32Array.from(
1210
1210
  { length: this.width },
1211
- (d, l) => r + (l + 0.5) * a
1211
+ (l, d) => r + (d + 0.5) * a
1212
1212
  )
1213
1213
  };
1214
1214
  }
@@ -1260,7 +1260,7 @@ class At extends me {
1260
1260
  /** u/v codes are written into luma: read back, then decoded on the CPU. */
1261
1261
  async capture(e, i, r) {
1262
1262
  const n = this.readCodes(e, i);
1263
- return n ? kt(
1263
+ return n ? Ft(
1264
1264
  n,
1265
1265
  r,
1266
1266
  this.manifest.mask.threshold,
@@ -1268,7 +1268,7 @@ class At extends me {
1268
1268
  ) : null;
1269
1269
  }
1270
1270
  }
1271
- function Ft(t, e, i = {}) {
1271
+ function Ut(t, e, i = {}) {
1272
1272
  const [r, n] = i.range ?? [-1 / 0, 1 / 0], s = [...t].sort((a, c) => a.start - c.start), o = s.find(
1273
1273
  (a) => a.start > e && a.start <= n
1274
1274
  ) ?? (i.loop ? s.find(
@@ -1276,7 +1276,7 @@ function Ft(t, e, i = {}) {
1276
1276
  ) : void 0);
1277
1277
  return o ? { chunk: o, time: Math.max(o.start, r) } : null;
1278
1278
  }
1279
- function St(t, e) {
1279
+ function Mt(t, e) {
1280
1280
  let i = null, r = -1 / 0;
1281
1281
  for (const n of e) {
1282
1282
  const s = Math.min(t.end, n.end) - Math.max(t.start, n.start);
@@ -1284,7 +1284,7 @@ function St(t, e) {
1284
1284
  }
1285
1285
  return i;
1286
1286
  }
1287
- function Ut(t) {
1287
+ function Dt(t) {
1288
1288
  return {
1289
1289
  width: t.mask.width,
1290
1290
  height: t.mask.height,
@@ -1292,11 +1292,11 @@ function Ut(t) {
1292
1292
  rowOrder: "north-to-south"
1293
1293
  };
1294
1294
  }
1295
- function pe(t, e = {}) {
1296
- return t.encoding.kind === "vector-luma" ? new At(t, e) : new xt(t, e);
1295
+ function Ee(t, e = {}) {
1296
+ return t.encoding.kind === "vector-luma" ? new St(t, e) : new At(t, e);
1297
1297
  }
1298
- const Mt = 3, Dt = 3, Pt = 0.6, Nt = 1.5;
1299
- function Gt(t) {
1298
+ const Pt = 3, Nt = 3, Gt = 0.6, It = 1.5;
1299
+ function Lt(t) {
1300
1300
  const e = new AbortController();
1301
1301
  if (!t)
1302
1302
  return { controller: e, unlink: () => {
@@ -1307,14 +1307,14 @@ function Gt(t) {
1307
1307
  unlink: () => t.removeEventListener("abort", i)
1308
1308
  };
1309
1309
  }
1310
- class Ri {
1310
+ class vi {
1311
1311
  constructor(e) {
1312
1312
  this.manifests = /* @__PURE__ */ new Map(), this.open = /* @__PURE__ */ new Map(), this.id = e.id, this.chunks = e.chunks.filter(
1313
1313
  (i) => Number.isFinite(i.start) && Number.isFinite(i.end) && i.end >= i.start
1314
- ).sort((i, r) => i.start - r.start), this.maxOpenChunks = Math.max(2, e.maxOpenChunks ?? Mt), this.frameCacheSize = Math.max(
1314
+ ).sort((i, r) => i.start - r.start), this.maxOpenChunks = Math.max(2, e.maxOpenChunks ?? Pt), this.frameCacheSize = Math.max(
1315
1315
  1,
1316
- e.frameCacheSize ?? Dt
1317
- ), this.prefetchAt = e.prefetchAt ?? Pt, this.maxGap = e.maxGap, this.loadManifest = e.loadManifest ?? ut, this.createFrameSource = e.createFrameSource ?? ((i, r) => pe(
1316
+ e.frameCacheSize ?? Nt
1317
+ ), this.prefetchAt = e.prefetchAt ?? Gt, this.maxGap = e.maxGap, this.loadManifest = e.loadManifest ?? mt, this.createFrameSource = e.createFrameSource ?? ((i, r) => Ee(
1318
1318
  i,
1319
1319
  r
1320
1320
  ));
@@ -1350,23 +1350,23 @@ class Ri {
1350
1350
  const s = this.chunkIndexAt(e);
1351
1351
  if (s < 0)
1352
1352
  return null;
1353
- const o = [], { controller: a, unlink: c } = Gt(r);
1353
+ const o = [], { controller: a, unlink: c } = Lt(r);
1354
1354
  try {
1355
- const d = this.acquire(this.chunks[s], o), l = await N(d.ready, a.signal), { times: h } = l;
1355
+ const l = this.acquire(this.chunks[s], o), d = await N(l.ready, a.signal), { times: h } = d;
1356
1356
  let p;
1357
1357
  if (e <= h[h.length - 1]) {
1358
- const { index: T, fraction: _ } = v(h, e);
1359
- p = n === "discrete" || _ === 0 ? [d, T, d, T, 0] : [d, T, d, T + 1, _];
1358
+ const { index: T, fraction: R } = v(h, e);
1359
+ p = n === "discrete" || R === 0 ? [l, T, l, T, 0] : [l, T, l, T + 1, R];
1360
1360
  } else {
1361
1361
  const T = this.chunks[s + 1];
1362
1362
  if (!T)
1363
1363
  return null;
1364
- const _ = this.acquire(T, o), F = await N(_.ready, a.signal), S = h.length - 1, k = h[S], D = F.times[0];
1365
- if (D - k > this.gapLimit(h, F.times))
1364
+ const R = this.acquire(T, o), F = await N(R.ready, a.signal), S = h.length - 1, A = h[S], D = F.times[0];
1365
+ if (D - A > this.gapLimit(h, F.times))
1366
1366
  return null;
1367
- p = n === "discrete" ? [d, S, d, S, 0] : e >= D ? [_, 0, _, 0, 0] : [d, S, _, 0, (e - k) / (D - k)];
1367
+ p = n === "discrete" ? [l, S, l, S, 0] : e >= D ? [R, 0, R, 0, 0] : [l, S, R, 0, (e - A) / (D - A)];
1368
1368
  }
1369
- const [m, E, w, y, A] = p, G = m === w && E === y, O = [this.frame(m, E, a.signal)];
1369
+ const [m, E, w, y, k] = p, G = m === w && E === y, O = [this.frame(m, E, a.signal)];
1370
1370
  G || O.push(this.frame(w, y, a.signal));
1371
1371
  let U;
1372
1372
  try {
@@ -1378,12 +1378,12 @@ class Ri {
1378
1378
  time: e,
1379
1379
  a: U[0],
1380
1380
  b: U[G ? 0 : 1],
1381
- mix: A
1381
+ mix: k
1382
1382
  };
1383
1383
  } finally {
1384
1384
  c();
1385
- for (const d of o)
1386
- d.users--;
1385
+ for (const l of o)
1386
+ l.users--;
1387
1387
  this.trim();
1388
1388
  }
1389
1389
  }
@@ -1417,7 +1417,7 @@ class Ri {
1417
1417
  e.length > 1 ? e[e.length - 1] - e[e.length - 2] : 0,
1418
1418
  i.length > 1 ? i[1] - i[0] : 0
1419
1419
  ], n = Math.max(...r);
1420
- return n > 0 ? n * Nt : -1 / 0;
1420
+ return n > 0 ? n * It : -1 / 0;
1421
1421
  }
1422
1422
  prefetchAfter(e, i) {
1423
1423
  const r = this.chunks[e], n = this.chunks[e + 1], s = r.end - r.start, o = s > 0 ? (i - r.start) / s : 1;
@@ -1454,7 +1454,7 @@ class Ri {
1454
1454
  return r.opened = {
1455
1455
  manifest: n,
1456
1456
  times: Float64Array.from(M(n)),
1457
- grid: Ut(n),
1457
+ grid: Dt(n),
1458
1458
  source: this.createFrameSource(n, {
1459
1459
  cacheSize: this.frameCacheSize
1460
1460
  })
@@ -1496,18 +1496,18 @@ class Ri {
1496
1496
  e.released = !0, e.prefetch?.abort(), e.prefetch = null, e.opened?.source.release(), e.opened = null, this.open.get(e.chunk.key) === e && this.open.delete(e.chunk.key);
1497
1497
  }
1498
1498
  }
1499
- const It = {
1499
+ const Ct = {
1500
1500
  a: "u_vel0",
1501
1501
  b: "u_vel1",
1502
1502
  mix: "u_vel_mix",
1503
1503
  bounds: "u_bounds"
1504
- }, Lt = {
1504
+ }, Vt = {
1505
1505
  a: "u_tint0",
1506
1506
  b: "u_tint1",
1507
1507
  mix: "u_tint_mix",
1508
1508
  bounds: "u_tint_bounds"
1509
1509
  };
1510
- function Ct(t) {
1510
+ function Ot(t) {
1511
1511
  const e = new Float32Array(t.u.length * 4);
1512
1512
  for (let i = 0; i < t.u.length; i++) {
1513
1513
  const r = t.u[i], n = t.v[i];
@@ -1515,9 +1515,9 @@ function Ct(t) {
1515
1515
  }
1516
1516
  return e;
1517
1517
  }
1518
- class Vt {
1518
+ class Bt {
1519
1519
  constructor(e, i, r = {}) {
1520
- this.gl = e, this.manifest = i, this.options = r, this.textures = /* @__PURE__ */ new Map(), this.pending = /* @__PURE__ */ new Map(), this.mask = null, this.pair = null, this.destroyed = !1, this.linearFilter = !0, this.uploadedFrames = 0, this.lastUploadDurationMs = 0, this.vector = i.encoding.kind === "vector-luma", this.source = pe(i, { cacheSize: 2 }), this.uniforms = this.vector ? It : Lt;
1520
+ this.gl = e, this.manifest = i, this.options = r, this.textures = /* @__PURE__ */ new Map(), this.pending = /* @__PURE__ */ new Map(), this.mask = null, this.pair = null, this.destroyed = !1, this.linearFilter = !0, this.uploadedFrames = 0, this.lastUploadDurationMs = 0, this.vector = i.encoding.kind === "vector-luma", this.source = Ee(i, { cacheSize: 2 }), this.uniforms = this.vector ? Ct : Vt;
1521
1521
  const n = M(i);
1522
1522
  this.times = r.animateSnapshot && i.timeline.kind === "snapshot-loop" ? Array.from(
1523
1523
  {
@@ -1574,9 +1574,9 @@ class Vt {
1574
1574
  */
1575
1575
  sample(e, i = !0) {
1576
1576
  const { index: r, fraction: n } = v(this.times, e), s = Math.min(r + 1, this.times.length - 1);
1577
- [...this.pending.keys()].some((d) => d < r || d > s + 1) && (this.source.cancelAll(), this.pending.clear());
1578
- for (const d of [r, s, s + 1])
1579
- d < this.times.length && this.request(d).catch(() => {
1577
+ [...this.pending.keys()].some((l) => l < r || l > s + 1) && (this.source.cancelAll(), this.pending.clear());
1578
+ for (const l of [r, s, s + 1])
1579
+ l < this.times.length && this.request(l).catch(() => {
1580
1580
  });
1581
1581
  const o = this.textures.get(r), a = this.textures.get(s), c = i ? n : 0;
1582
1582
  return o && (c === 0 || a) && (this.pair = [o, c === 0 ? o : a, c]), this.evict(r), this.pair;
@@ -1612,7 +1612,7 @@ class Vt {
1612
1612
  return !1;
1613
1613
  const n = this.uniforms;
1614
1614
  if (e.texture(n.a, r, this.pair[0]), e.texture(n.b, r + 1, this.pair[1]), e.float(n.mix, this.pair[2]), e.vec4(n.bounds, this.bounds), this.mask && this.manifest.encoding.kind === "scalar-luma") {
1615
- const { codeRange: s, valueRange: o, transfer: a } = Tt(
1615
+ const { codeRange: s, valueRange: o, transfer: a } = wt(
1616
1616
  this.manifest.encoding
1617
1617
  );
1618
1618
  e.texture("u_tint_mask", r + 2, this.mask), e.vec2("u_code_range", ...s), e.vec2("u_value_range", ...o), e.float("u_scalar_transfer", a);
@@ -1669,7 +1669,7 @@ class Vt {
1669
1669
  0,
1670
1670
  i.RGBA,
1671
1671
  i.FLOAT,
1672
- Ct(e)
1672
+ Ot(e)
1673
1673
  ) : (i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL, !1), i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL, !1), i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL, i.NONE), i.texImage2D(
1674
1674
  i.TEXTURE_2D,
1675
1675
  0,
@@ -1722,7 +1722,7 @@ class Vt {
1722
1722
  }
1723
1723
  }
1724
1724
  }
1725
- class Ot {
1725
+ class Xt {
1726
1726
  constructor(e, i) {
1727
1727
  this.onPlaying = i, this.time = 0, this.endFraction = 0, this.held = !1, this.playingValue = e;
1728
1728
  }
@@ -1754,33 +1754,33 @@ class Ot {
1754
1754
  advance(e, i, r, n = [i[0], i[i.length - 1]], s = !1, o = !1) {
1755
1755
  if (!this.advancing || !i.length)
1756
1756
  return !1;
1757
- const a = Q(i, n[0]), c = Q(i, n[1]), d = c + (o ? 1 : 0);
1758
- let l = Math.max(a, Q(i, this.ms) + this.endFraction) + Math.max(0, e) * r;
1759
- const h = o ? l >= d : l > d;
1760
- return h && s && d > a ? l = a + (l - a) % (d - a) : l = Math.min(d, l), this.time = wt(i, Math.min(c, l)), this.endFraction = Math.max(0, l - c), h && !s;
1757
+ const a = Z(i, n[0]), c = Z(i, n[1]), l = c + (o ? 1 : 0);
1758
+ let d = Math.max(a, Z(i, this.ms) + this.endFraction) + Math.max(0, e) * r;
1759
+ const h = o ? d >= l : d > l;
1760
+ return h && s && l > a ? d = a + (d - a) % (l - a) : d = Math.min(l, d), this.time = Rt(i, Math.min(c, d)), this.endFraction = Math.max(0, d - c), h && !s;
1761
1761
  }
1762
1762
  }
1763
1763
  function X(t) {
1764
1764
  const e = M(t);
1765
1765
  return [e[0], e[e.length - 1]];
1766
1766
  }
1767
- function Z(t, e) {
1767
+ function J(t, e) {
1768
1768
  return e ? [Math.max(t[0], e[0]), Math.min(t[1], e[1])] : t;
1769
1769
  }
1770
1770
  function $([t, e], i) {
1771
1771
  return Math.max(t, Math.min(e, i));
1772
1772
  }
1773
- class xi {
1773
+ class Ai {
1774
1774
  constructor(e, i, r) {
1775
1775
  this.repaint = i, this.emit = r, this.field = null, this.manifest = null, this.gl = null, this.pendingField = null, this.standby = null, this.awaitingNext = !1, this.timeRange = null, this.lastTick = null, this.lastStepTime = null, this.seekId = 0, this.seeking = !1, this.failed = !1, this.exactTime = 0, this.endEmitted = !1, this.destroyed = !1, this.resumePlayback = !1, this.playOnReady = e.autoplay ?? !0, this.loop = e.loop ?? !0, this.playbackRate = e.playbackRate ?? 1, this.stepsPerSecond = e.stepsPerSecond;
1776
1776
  const n = typeof e.time == "string" ? Date.parse(e.time) : e.time;
1777
- this.requestedTime = n != null && Number.isFinite(n) ? n : null, this.requestedTimeRange = e.timeRange, this.clock = new Ot(
1777
+ this.requestedTime = n != null && Number.isFinite(n) ? n : null, this.requestedTimeRange = e.timeRange, this.clock = new Xt(
1778
1778
  !1,
1779
1779
  (s) => this.emit("playbackChange", s)
1780
1780
  );
1781
1781
  }
1782
1782
  async load(e, i) {
1783
- if (this.gl = e, this.manifest = i, this.timeRange = Z(
1783
+ if (this.gl = e, this.manifest = i, this.timeRange = J(
1784
1784
  X(i),
1785
1785
  this.requestedTimeRange
1786
1786
  ), this.timeRange[0] > this.timeRange[1])
@@ -1840,7 +1840,7 @@ class xi {
1840
1840
  const r = this.clock.advance(
1841
1841
  i,
1842
1842
  this.field.times,
1843
- this.stepsPerSecond ?? this.playbackRate * ue(this.field.manifest),
1843
+ this.stepsPerSecond ?? this.playbackRate * fe(this.field.manifest),
1844
1844
  this.playbackRange(this.field),
1845
1845
  this.loop,
1846
1846
  !0
@@ -1865,20 +1865,20 @@ class xi {
1865
1865
  this.seeking = !0, this.lastTick = null, e.focus(c);
1866
1866
  try {
1867
1867
  await e.prime(c);
1868
- } catch (l) {
1868
+ } catch (d) {
1869
1869
  if (r !== this.seekId)
1870
1870
  return;
1871
- throw l;
1871
+ throw d;
1872
1872
  }
1873
1873
  if (r !== this.seekId || this.destroyed)
1874
1874
  return;
1875
- const d = this.pendingField === e;
1876
- if (d && (this.field?.destroy(), this.field = e, this.pendingField = null, this.lastStepTime = null), this.exactTime = c, this.clock.ms = $(this.playbackRange(e), c), e.sample(c, !1), this.seeking = !1, this.endEmitted = !1, this.repaint(), d) {
1877
- const l = e.manifest;
1875
+ const l = this.pendingField === e;
1876
+ if (l && (this.field?.destroy(), this.field = e, this.pendingField = null, this.lastStepTime = null), this.exactTime = c, this.clock.ms = $(this.playbackRange(e), c), e.sample(c, !1), this.seeking = !1, this.endEmitted = !1, this.repaint(), l) {
1877
+ const d = e.manifest;
1878
1878
  if (this.emit("loaded", {
1879
- min: l.style.colorDomain[0],
1880
- max: l.style.colorDomain[1],
1881
- unit: l.style.unit ?? "",
1879
+ min: d.style.colorDomain[0],
1880
+ max: d.style.colorDomain[1],
1881
+ unit: d.style.unit ?? "",
1882
1882
  time: new Date(this.clock.ms).toISOString()
1883
1883
  }), this.emit("status", { phase: "ready", time: this.clock.ms }), this.playOnReady) {
1884
1884
  this.playOnReady = !1;
@@ -1918,7 +1918,7 @@ class xi {
1918
1918
  const r = this.manifest;
1919
1919
  if (!r || e.encoding.kind !== r.encoding.kind || e.media.width !== r.media.width || e.media.height !== r.media.height || e.mask.width !== r.mask.width || e.mask.height !== r.mask.height)
1920
1920
  return null;
1921
- const n = Z(
1921
+ const n = J(
1922
1922
  X(e),
1923
1923
  i.timeRange
1924
1924
  );
@@ -1964,7 +1964,7 @@ class xi {
1964
1964
  setTimeRange(e) {
1965
1965
  if (!Number.isFinite(e[0]) || !Number.isFinite(e[1]) || e[0] > e[1])
1966
1966
  throw new Error("Invalid GeoVideo time range");
1967
- const i = Z(
1967
+ const i = J(
1968
1968
  this.manifest ? X(this.manifest) : e,
1969
1969
  e
1970
1970
  );
@@ -1983,7 +1983,7 @@ class xi {
1983
1983
  ];
1984
1984
  }
1985
1985
  createField(e) {
1986
- const i = new Vt(this.gl, e, {
1986
+ const i = new Bt(this.gl, e, {
1987
1987
  repeatLongitude: !1,
1988
1988
  animateSnapshot: !0,
1989
1989
  onError: (r) => {
@@ -1998,7 +1998,7 @@ class xi {
1998
1998
  i.name === "AbortError" || this.destroyed || (this.playOnReady = !1, this.awaitingNext = !1, this.failed = !0, this.seeking = !0, this.clock.setPlaying(!1), this.emit("status", { phase: "error", error: i }), this.emit("error", i));
1999
1999
  }
2000
2000
  }
2001
- function W(t) {
2001
+ function H(t) {
2002
2002
  const { start: e, end: i } = t.temporal ?? {};
2003
2003
  return {
2004
2004
  source: t,
@@ -2006,19 +2006,19 @@ function W(t) {
2006
2006
  end: Date.parse(i ?? e ?? "")
2007
2007
  };
2008
2008
  }
2009
- function vi(t, e, i = {}) {
2010
- const r = t.filter((s) => s.id === e.id && s.temporal?.start != null).map(W), n = Ft(
2009
+ function ki(t, e, i = {}) {
2010
+ const r = t.filter((s) => s.id === e.id && s.temporal?.start != null).map(H), n = Ut(
2011
2011
  r,
2012
2012
  Date.parse(e.temporal?.end ?? ""),
2013
2013
  i
2014
2014
  );
2015
2015
  return n ? { source: n.chunk.source, time: n.time } : null;
2016
2016
  }
2017
- function ki(t, e) {
2018
- return St(W(t), e.map(W))?.source ?? null;
2017
+ function Fi(t, e) {
2018
+ return Mt(H(t), e.map(H))?.source ?? null;
2019
2019
  }
2020
- function Ai(t, e = {}) {
2021
- const i = e.start ?? -1 / 0, r = e.end ?? 1 / 0, n = t.map(W).filter((a) => a.end >= i && a.start <= r).sort((a, c) => a.start - c.start);
2020
+ function Si(t, e = {}) {
2021
+ const i = e.start ?? -1 / 0, r = e.end ?? 1 / 0, n = t.map(H).filter((a) => a.end >= i && a.start <= r).sort((a, c) => a.start - c.start);
2022
2022
  if (n.length === 0)
2023
2023
  return;
2024
2024
  if (e.time == null)
@@ -2028,24 +2028,24 @@ function Ai(t, e = {}) {
2028
2028
  (a, c) => o(c) <= o(a) ? c : a
2029
2029
  ).source;
2030
2030
  }
2031
- const Bt = /^P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/;
2032
- function Xt(t) {
2031
+ const $t = /^P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/;
2032
+ function qt(t) {
2033
2033
  return t instanceof Date ? t.getTime() : typeof t == "number" ? t : new Date(t).getTime();
2034
2034
  }
2035
- function le(t, e) {
2036
- const i = Xt(t);
2035
+ function he(t, e) {
2036
+ const i = qt(t);
2037
2037
  if (!Number.isFinite(i))
2038
2038
  throw new Error(`Invalid ${e}`);
2039
2039
  return i;
2040
2040
  }
2041
- function Ee(t, e) {
2042
- const i = e.match(Bt);
2041
+ function ge(t, e) {
2042
+ const i = e.match($t);
2043
2043
  if (!i)
2044
2044
  throw new Error(`Invalid trailing time duration: ${e}`);
2045
- const r = i.slice(1).map((A) => Number(A ?? 0));
2046
- if (!r.some((A) => A > 0))
2045
+ const r = i.slice(1).map((k) => Number(k ?? 0));
2046
+ if (!r.some((k) => k > 0))
2047
2047
  throw new Error("Trailing time duration must be positive");
2048
- const [n, s, o, a, c, d, l] = r, h = new Date(t), p = h.getUTCFullYear() * 12 + h.getUTCMonth() - n * 12 - s, m = Math.floor(p / 12), E = (p % 12 + 12) % 12, w = new Date(Date.UTC(m, E + 1, 0)).getUTCDate();
2048
+ const [n, s, o, a, c, l, d] = r, h = new Date(t), p = h.getUTCFullYear() * 12 + h.getUTCMonth() - n * 12 - s, m = Math.floor(p / 12), E = (p % 12 + 12) % 12, w = new Date(Date.UTC(m, E + 1, 0)).getUTCDate();
2049
2049
  return Date.UTC(
2050
2050
  m,
2051
2051
  E,
@@ -2054,17 +2054,17 @@ function Ee(t, e) {
2054
2054
  h.getUTCMinutes(),
2055
2055
  h.getUTCSeconds(),
2056
2056
  h.getUTCMilliseconds()
2057
- ) - (((o * 7 + a) * 24 + c) * 60 + d) * 6e4 - l * 1e3;
2057
+ ) - (((o * 7 + a) * 24 + c) * 60 + l) * 6e4 - d * 1e3;
2058
2058
  }
2059
- function Fi(t, [e, i]) {
2059
+ function Ui(t, [e, i]) {
2060
2060
  let r = e, n = i;
2061
- if (typeof t.trailing == "string" ? r = Ee(i, t.trailing) : (t.start != null && (r = le(t.start, "time range start")), t.end != null && (n = le(t.end, "time range end"))), r > n)
2061
+ if (typeof t.trailing == "string" ? r = ge(i, t.trailing) : (t.start != null && (r = he(t.start, "time range start")), t.end != null && (n = he(t.end, "time range end"))), r > n)
2062
2062
  throw new Error("Time range start must not follow its end");
2063
2063
  return [Math.max(e, r), Math.min(i, n)];
2064
2064
  }
2065
- const $t = (t) => typeof t == "object" && t !== null && !Array.isArray(t);
2066
- function Si(t, e) {
2067
- if (!$t(t))
2065
+ const Wt = (t) => typeof t == "object" && t !== null && !Array.isArray(t);
2066
+ function Mi(t, e) {
2067
+ if (!Wt(t))
2068
2068
  throw new Error(`${e} must be an object`);
2069
2069
  for (const s of Object.keys(t))
2070
2070
  if (s !== "start" && s !== "end" && s !== "trailing")
@@ -2074,7 +2074,7 @@ function Si(t, e) {
2074
2074
  throw new Error(`${e}.trailing excludes start and end`);
2075
2075
  if (typeof t.trailing != "string")
2076
2076
  throw new Error(`${e}.trailing must be an ISO 8601 duration`);
2077
- return Ee(0, t.trailing), { trailing: t.trailing };
2077
+ return ge(0, t.trailing), { trailing: t.trailing };
2078
2078
  }
2079
2079
  const i = (s) => {
2080
2080
  const o = t[s];
@@ -2091,50 +2091,72 @@ function Si(t, e) {
2091
2091
  ...n !== void 0 && { end: n }
2092
2092
  };
2093
2093
  }
2094
- function Ui(t) {
2094
+ function Di(t, e) {
2095
+ return !!t && !!e && t.name === e.name && t.units === e.units && t.positive === e.positive && t.value === e.value;
2096
+ }
2097
+ function q(t) {
2098
+ const e = t;
2099
+ return !!e && typeof e.name == "string" && typeof e.units == "string" && typeof e.positive == "string" && Number.isFinite(e.value);
2100
+ }
2101
+ function Ht(t) {
2102
+ const e = t.depths;
2103
+ if (e === void 0)
2104
+ return t.surface === void 0 || q(t.surface);
2105
+ const i = t.surface ?? e?.[0];
2106
+ if (!Array.isArray(e) || !q(i))
2107
+ return e?.length === 0;
2108
+ const r = new Set(t.surface ? [i.value] : []);
2109
+ return e.every((n) => {
2110
+ const s = q(n) && typeof n.indexUrl == "string" && n.name === i.name && n.units === i.units && n.positive === i.positive && !r.has(n.value);
2111
+ return r.add(n.value), s;
2112
+ });
2113
+ }
2114
+ function Pi(t) {
2095
2115
  return t.type === "geovideo" && typeof t.indexUrl == "string";
2096
2116
  }
2097
- function Mi(t, e) {
2117
+ function Ni(t, e) {
2098
2118
  return t.id === e.id && (t.type !== "geovideo" || e.type !== "geovideo" || t.manifestUrl === e.manifestUrl);
2099
2119
  }
2100
- function J(t) {
2120
+ function ee(t) {
2101
2121
  return typeof t == "string" && Number.isFinite(Date.parse(t));
2102
2122
  }
2103
- function qt(t) {
2123
+ function zt(t) {
2104
2124
  const e = t.times;
2105
2125
  if (!Array.isArray(e) || e.length !== t.samples || e[0] !== t.start || e[e.length - 1] !== t.end)
2106
2126
  return !1;
2107
2127
  let i = -1 / 0;
2108
2128
  for (const r of e) {
2109
- const n = J(r) ? Date.parse(r) : NaN;
2129
+ const n = ee(r) ? Date.parse(r) : NaN;
2110
2130
  if (!(n > i))
2111
2131
  return !1;
2112
2132
  i = n;
2113
2133
  }
2114
2134
  return !0;
2115
2135
  }
2116
- function Wt(t) {
2136
+ function Yt(t) {
2117
2137
  const e = t;
2118
2138
  if (!e || e.schemaVersion !== 1 || e.type !== "geovideo-index" || !Array.isArray(e.chunks))
2119
2139
  throw new Error("Unsupported GeoVideo index");
2140
+ if (!Ht(e) || e.vertical !== void 0 && !q(e.vertical))
2141
+ throw new Error("Invalid GeoVideo index levels");
2120
2142
  for (const i of e.chunks)
2121
- if (!J(i?.start) || !J(i.end) || Date.parse(i.end) < Date.parse(i.start) || typeof i.manifestUrl != "string" || i.times !== void 0 && !qt(i))
2143
+ if (!ee(i?.start) || !ee(i.end) || Date.parse(i.end) < Date.parse(i.start) || typeof i.manifestUrl != "string" || i.times !== void 0 && !zt(i))
2122
2144
  throw new Error("Invalid GeoVideo index chunk");
2123
2145
  return e;
2124
2146
  }
2125
- async function Di(t, e) {
2147
+ async function Gi(t, e) {
2126
2148
  const i = await fetch(t, { signal: e });
2127
2149
  if (!i.ok)
2128
2150
  throw new Error(
2129
2151
  `GeoVideo index request failed (${i.status}): ${t}`
2130
2152
  );
2131
- return Wt(await i.json());
2153
+ return Yt(await i.json());
2132
2154
  }
2133
- function Ht(t) {
2155
+ function Te(t) {
2134
2156
  return typeof document < "u" ? new URL(t, document.baseURI).href : t;
2135
2157
  }
2136
- function zt(t, e) {
2137
- const i = Ht(e);
2158
+ function jt(t, e) {
2159
+ const i = Te(e);
2138
2160
  return t.chunks.map((r) => ({
2139
2161
  key: r.key,
2140
2162
  manifestUrl: new URL(r.manifestUrl, i).href,
@@ -2145,15 +2167,15 @@ function zt(t, e) {
2145
2167
  ...r.provisional ? { provisional: !0 } : {}
2146
2168
  }));
2147
2169
  }
2148
- function Yt(t, e, i) {
2170
+ function Kt(t, e, i) {
2149
2171
  if (e.sourceId !== t.id || e.catalogEntryId !== i.id)
2150
2172
  throw new Error(
2151
2173
  `GeoVideo index identity does not match catalog entry/source: ${t.id}`
2152
2174
  );
2153
2175
  }
2154
- function Pi(t, e, i) {
2155
- Yt(t, e, i);
2156
- const r = zt(e, t.indexUrl);
2176
+ function Ii(t, e, i) {
2177
+ Kt(t, e, i);
2178
+ const r = jt(e, t.indexUrl);
2157
2179
  return e.chunks.map(
2158
2180
  (n, s) => ({
2159
2181
  id: t.id,
@@ -2170,73 +2192,78 @@ function Pi(t, e, i) {
2170
2192
  })
2171
2193
  );
2172
2194
  }
2195
+ function Li(t, e) {
2196
+ return new URL(t.indexUrl, Te(e)).href;
2197
+ }
2173
2198
  export {
2174
- Yt as $,
2175
- ue as A,
2176
- di as B,
2177
- Ai as C,
2178
- Ui as D,
2179
- vi as E,
2180
- Fi as F,
2181
- bi as G,
2182
- Di as H,
2183
- Pi as I,
2184
- zt as J,
2185
- _i as K,
2186
- ce as L,
2187
- fi as M,
2188
- pi as N,
2189
- gi as O,
2190
- Ri as P,
2191
- Ot as Q,
2192
- xt as R,
2193
- Vt as S,
2194
- hi as T,
2195
- me as U,
2196
- bt as V,
2197
- At as W,
2198
- mi as X,
2199
- Ei as Y,
2200
- ui as Z,
2201
- Be as _,
2202
- ni as a,
2203
- pe as a0,
2204
- se as a1,
2205
- it as a2,
2206
- Ut as a3,
2207
- Ft as a4,
2208
- ki as a5,
2209
- St as a6,
2210
- Si as a7,
2211
- wt as a8,
2212
- Ee as a9,
2213
- v as aa,
2214
- Q as ab,
2215
- Wt as ac,
2216
- Ct as ad,
2217
- si as b,
2218
- Qt as c,
2219
- ei as d,
2220
- ti as e,
2221
- ri as f,
2222
- ai as g,
2223
- Zt as h,
2224
- ii as i,
2225
- Ti as j,
2226
- Jt as k,
2227
- ci as l,
2228
- xi as m,
2229
- li as n,
2230
- ut as o,
2231
- Tt as p,
2232
- ze as q,
2233
- Ke as r,
2234
- oi as s,
2235
- ft as t,
2236
- Kt as u,
2237
- wi as v,
2238
- le as w,
2239
- M as x,
2240
- Mi as y,
2241
- yi as z
2199
+ mi as $,
2200
+ _i as A,
2201
+ fe as B,
2202
+ hi as C,
2203
+ Si as D,
2204
+ Pi as E,
2205
+ ki as F,
2206
+ yi as G,
2207
+ Ui as H,
2208
+ Li as I,
2209
+ Gi as J,
2210
+ Ii as K,
2211
+ jt as L,
2212
+ xi as M,
2213
+ le as N,
2214
+ pi as O,
2215
+ gi as P,
2216
+ bi as Q,
2217
+ vi as R,
2218
+ Xt as S,
2219
+ fi as T,
2220
+ At as U,
2221
+ Bt as V,
2222
+ pe as W,
2223
+ yt as X,
2224
+ St as Y,
2225
+ Ei as Z,
2226
+ Ti as _,
2227
+ ai as a,
2228
+ $e as a0,
2229
+ Kt as a1,
2230
+ Ee as a2,
2231
+ ae as a3,
2232
+ nt as a4,
2233
+ Dt as a5,
2234
+ Ut as a6,
2235
+ Fi as a7,
2236
+ Mt as a8,
2237
+ Mi as a9,
2238
+ Rt as aa,
2239
+ ge as ab,
2240
+ v as ac,
2241
+ Z as ad,
2242
+ Yt as ae,
2243
+ Ot as af,
2244
+ oi as b,
2245
+ Jt as c,
2246
+ ii as d,
2247
+ ri as e,
2248
+ si as f,
2249
+ ci as g,
2250
+ ei as h,
2251
+ ni as i,
2252
+ wi as j,
2253
+ ti as k,
2254
+ di as l,
2255
+ Ai as m,
2256
+ ui as n,
2257
+ mt as o,
2258
+ wt as p,
2259
+ je as q,
2260
+ Ze as r,
2261
+ li as s,
2262
+ pt as t,
2263
+ Zt as u,
2264
+ Ri as v,
2265
+ he as w,
2266
+ Di as x,
2267
+ M as y,
2268
+ Ni as z
2242
2269
  };