world.ts 0.3.1 → 0.3.3

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/index.js CHANGED
@@ -22,35 +22,35 @@ const Rt = (e, t) => {
22
22
  );
23
23
  if (e.attachShader(i, r), e.attachShader(i, s), e.linkProgram(i), !e.getProgramParameter(i, e.LINK_STATUS))
24
24
  throw console.error("Link failure", e.getProgramInfoLog(i)), new Error("Link failure");
25
- const o = () => e.useProgram(i), c = (E, T) => {
25
+ const o = () => e.useProgram(i), c = (E, y) => {
26
26
  const R = e.getUniformLocation(i, E);
27
27
  return { set: (b) => {
28
- R && T(R, b);
28
+ R && y(R, b);
29
29
  } };
30
- }, a = (E) => c(E, (T, R) => e.uniform1f(T, R)), f = (E) => c(E, (T, R) => e.uniform1i(T, R)), l = (E) => c(
30
+ }, a = (E) => c(E, (y, R) => e.uniform1f(y, R)), f = (E) => c(E, (y, R) => e.uniform1i(y, R)), l = (E) => c(
31
31
  E,
32
- (T, [R = 0, M = 0]) => e.uniform2f(T, R, M)
33
- ), u = (E) => c(
34
- E,
35
- (T, [R = 0, M = 0]) => e.uniform2i(T, R, M)
32
+ (y, [R = 0, M = 0]) => e.uniform2f(y, R, M)
36
33
  ), h = (E) => c(
37
34
  E,
38
- (T, [R = 0, M = 0, b = 0]) => e.uniform3f(T, R, M, b)
35
+ (y, [R = 0, M = 0]) => e.uniform2i(y, R, M)
36
+ ), u = (E) => c(
37
+ E,
38
+ (y, [R = 0, M = 0, b = 0]) => e.uniform3f(y, R, M, b)
39
39
  ), d = (E) => c(
40
40
  E,
41
- (T, [R = 0, M = 0, b = 0]) => e.uniform3i(T, R, M, b)
41
+ (y, [R = 0, M = 0, b = 0]) => e.uniform3i(y, R, M, b)
42
42
  ), m = (E) => c(
43
43
  E,
44
- (T, [R = 0, M = 0, b = 0, P = 0]) => e.uniform4f(T, R, M, b, P)
44
+ (y, [R = 0, M = 0, b = 0, P = 0]) => e.uniform4f(y, R, M, b, P)
45
45
  ), _ = (E) => c(
46
46
  E,
47
- (T, [R = 0, M = 0, b = 0, P = 0]) => e.uniform4i(T, R, M, b, P)
47
+ (y, [R = 0, M = 0, b = 0, P = 0]) => e.uniform4i(y, R, M, b, P)
48
48
  ), w = (E) => c(
49
49
  E,
50
- (T, R) => e.uniformMatrix4fv(T, !1, R)
50
+ (y, R) => e.uniformMatrix4fv(y, !1, R)
51
51
  ), x = ({
52
52
  name: E,
53
- buffer: T,
53
+ buffer: y,
54
54
  size: R,
55
55
  type: M,
56
56
  stride: b,
@@ -60,7 +60,7 @@ const Rt = (e, t) => {
60
60
  if (U === -1)
61
61
  throw new Error(`Missing attribute: ${E}`);
62
62
  return { use: () => {
63
- T.use(), e.enableVertexAttribArray(U), ["u16", "i32"].includes(M) ? e.vertexAttribIPointer(
63
+ y.use(), e.enableVertexAttribArray(U), ["u16", "i32"].includes(M) ? e.vertexAttribIPointer(
64
64
  U,
65
65
  R,
66
66
  M === "u16" ? e.UNSIGNED_SHORT : e.INT,
@@ -81,16 +81,16 @@ const Rt = (e, t) => {
81
81
  uniform1f: a,
82
82
  uniform1i: f,
83
83
  uniform2f: l,
84
- uniform2i: u,
85
- uniform3f: h,
84
+ uniform2i: h,
85
+ uniform3f: u,
86
86
  uniform3i: d,
87
87
  uniform4f: m,
88
88
  uniform4i: _,
89
89
  uniformMatrix4f: w,
90
- attribute1f: (E, T, R = {}) => x({ name: E, buffer: T, size: 1, type: "f32", ...R }),
91
- attribute2f: (E, T, R = {}) => x({ name: E, buffer: T, size: 2, type: "f32", ...R }),
92
- attribute3f: (E, T, R = {}) => x({ name: E, buffer: T, size: 3, type: "f32", ...R }),
93
- attribute3i: (E, T, R = {}) => x({ name: E, buffer: T, size: 3, type: "i32", ...R }),
90
+ attribute1f: (E, y, R = {}) => x({ name: E, buffer: y, size: 1, type: "f32", ...R }),
91
+ attribute2f: (E, y, R = {}) => x({ name: E, buffer: y, size: 2, type: "f32", ...R }),
92
+ attribute3f: (E, y, R = {}) => x({ name: E, buffer: y, size: 3, type: "f32", ...R }),
93
+ attribute3i: (E, y, R = {}) => x({ name: E, buffer: y, size: 3, type: "i32", ...R }),
94
94
  dispose: () => {
95
95
  e.deleteProgram(i), e.deleteShader(r), e.deleteShader(s);
96
96
  }
@@ -123,8 +123,8 @@ const Rt = (e, t) => {
123
123
  const n = Mt(t), { dispose: i } = n;
124
124
  return { gl: t, programs: n, dispose: i };
125
125
  };
126
- var bt = 1e-6, Y = typeof Float32Array < "u" ? Float32Array : Array;
127
- function St(e) {
126
+ var St = 1e-6, Y = typeof Float32Array < "u" ? Float32Array : Array;
127
+ function bt(e) {
128
128
  Y = e;
129
129
  }
130
130
  Math.hypot || (Math.hypot = function() {
@@ -144,32 +144,32 @@ function rt(e) {
144
144
  return e[0] = 1, e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 0, e[5] = 1, e[6] = 0, e[7] = 0, e[8] = 0, e[9] = 0, e[10] = 1, e[11] = 0, e[12] = 0, e[13] = 0, e[14] = 0, e[15] = 1, e;
145
145
  }
146
146
  function Pt(e, t) {
147
- var n = t[0], i = t[1], r = t[2], s = t[3], o = t[4], c = t[5], a = t[6], f = t[7], l = t[8], u = t[9], h = t[10], d = t[11], m = t[12], _ = t[13], w = t[14], x = t[15], A = n * c - i * o, p = n * a - r * o, v = n * f - s * o, y = i * a - r * c, g = i * f - s * c, E = r * f - s * a, T = l * _ - u * m, R = l * w - h * m, M = l * x - d * m, b = u * w - h * _, P = u * x - d * _, U = h * x - d * w, S = A * U - p * P + v * b + y * M - g * R + E * T;
148
- return S ? (S = 1 / S, e[0] = (c * U - a * P + f * b) * S, e[1] = (r * P - i * U - s * b) * S, e[2] = (_ * E - w * g + x * y) * S, e[3] = (h * g - u * E - d * y) * S, e[4] = (a * M - o * U - f * R) * S, e[5] = (n * U - r * M + s * R) * S, e[6] = (w * v - m * E - x * p) * S, e[7] = (l * E - h * v + d * p) * S, e[8] = (o * P - c * M + f * T) * S, e[9] = (i * M - n * P - s * T) * S, e[10] = (m * g - _ * v + x * A) * S, e[11] = (u * v - l * g - d * A) * S, e[12] = (c * R - o * b - a * T) * S, e[13] = (n * b - i * R + r * T) * S, e[14] = (_ * p - m * y - w * A) * S, e[15] = (l * y - u * p + h * A) * S, e) : null;
147
+ var n = t[0], i = t[1], r = t[2], s = t[3], o = t[4], c = t[5], a = t[6], f = t[7], l = t[8], h = t[9], u = t[10], d = t[11], m = t[12], _ = t[13], w = t[14], x = t[15], A = n * c - i * o, v = n * a - r * o, T = n * f - s * o, p = i * a - r * c, g = i * f - s * c, E = r * f - s * a, y = l * _ - h * m, R = l * w - u * m, M = l * x - d * m, b = h * w - u * _, P = h * x - d * _, U = u * x - d * w, S = A * U - v * P + T * b + p * M - g * R + E * y;
148
+ return S ? (S = 1 / S, e[0] = (c * U - a * P + f * b) * S, e[1] = (r * P - i * U - s * b) * S, e[2] = (_ * E - w * g + x * p) * S, e[3] = (u * g - h * E - d * p) * S, e[4] = (a * M - o * U - f * R) * S, e[5] = (n * U - r * M + s * R) * S, e[6] = (w * T - m * E - x * v) * S, e[7] = (l * E - u * T + d * v) * S, e[8] = (o * P - c * M + f * y) * S, e[9] = (i * M - n * P - s * y) * S, e[10] = (m * g - _ * T + x * A) * S, e[11] = (h * T - l * g - d * A) * S, e[12] = (c * R - o * b - a * y) * S, e[13] = (n * b - i * R + r * y) * S, e[14] = (_ * v - m * p - w * A) * S, e[15] = (l * p - h * v + u * A) * S, e) : null;
149
149
  }
150
150
  function zt(e, t, n) {
151
- var i = t[0], r = t[1], s = t[2], o = t[3], c = t[4], a = t[5], f = t[6], l = t[7], u = t[8], h = t[9], d = t[10], m = t[11], _ = t[12], w = t[13], x = t[14], A = t[15], p = n[0], v = n[1], y = n[2], g = n[3];
152
- return e[0] = p * i + v * c + y * u + g * _, e[1] = p * r + v * a + y * h + g * w, e[2] = p * s + v * f + y * d + g * x, e[3] = p * o + v * l + y * m + g * A, p = n[4], v = n[5], y = n[6], g = n[7], e[4] = p * i + v * c + y * u + g * _, e[5] = p * r + v * a + y * h + g * w, e[6] = p * s + v * f + y * d + g * x, e[7] = p * o + v * l + y * m + g * A, p = n[8], v = n[9], y = n[10], g = n[11], e[8] = p * i + v * c + y * u + g * _, e[9] = p * r + v * a + y * h + g * w, e[10] = p * s + v * f + y * d + g * x, e[11] = p * o + v * l + y * m + g * A, p = n[12], v = n[13], y = n[14], g = n[15], e[12] = p * i + v * c + y * u + g * _, e[13] = p * r + v * a + y * h + g * w, e[14] = p * s + v * f + y * d + g * x, e[15] = p * o + v * l + y * m + g * A, e;
151
+ var i = t[0], r = t[1], s = t[2], o = t[3], c = t[4], a = t[5], f = t[6], l = t[7], h = t[8], u = t[9], d = t[10], m = t[11], _ = t[12], w = t[13], x = t[14], A = t[15], v = n[0], T = n[1], p = n[2], g = n[3];
152
+ return e[0] = v * i + T * c + p * h + g * _, e[1] = v * r + T * a + p * u + g * w, e[2] = v * s + T * f + p * d + g * x, e[3] = v * o + T * l + p * m + g * A, v = n[4], T = n[5], p = n[6], g = n[7], e[4] = v * i + T * c + p * h + g * _, e[5] = v * r + T * a + p * u + g * w, e[6] = v * s + T * f + p * d + g * x, e[7] = v * o + T * l + p * m + g * A, v = n[8], T = n[9], p = n[10], g = n[11], e[8] = v * i + T * c + p * h + g * _, e[9] = v * r + T * a + p * u + g * w, e[10] = v * s + T * f + p * d + g * x, e[11] = v * o + T * l + p * m + g * A, v = n[12], T = n[13], p = n[14], g = n[15], e[12] = v * i + T * c + p * h + g * _, e[13] = v * r + T * a + p * u + g * w, e[14] = v * s + T * f + p * d + g * x, e[15] = v * o + T * l + p * m + g * A, e;
153
153
  }
154
154
  function Lt(e, t, n) {
155
155
  var i = n[0], r = n[1], s = n[2];
156
156
  return e[0] = t[0] * i, e[1] = t[1] * i, e[2] = t[2] * i, e[3] = t[3] * i, e[4] = t[4] * r, e[5] = t[5] * r, e[6] = t[6] * r, e[7] = t[7] * r, e[8] = t[8] * s, e[9] = t[9] * s, e[10] = t[10] * s, e[11] = t[11] * s, e[12] = t[12], e[13] = t[13], e[14] = t[14], e[15] = t[15], e;
157
157
  }
158
158
  function Nt(e, t, n) {
159
- var i = Math.sin(n), r = Math.cos(n), s = t[4], o = t[5], c = t[6], a = t[7], f = t[8], l = t[9], u = t[10], h = t[11];
160
- return t !== e && (e[0] = t[0], e[1] = t[1], e[2] = t[2], e[3] = t[3], e[12] = t[12], e[13] = t[13], e[14] = t[14], e[15] = t[15]), e[4] = s * r + f * i, e[5] = o * r + l * i, e[6] = c * r + u * i, e[7] = a * r + h * i, e[8] = f * r - s * i, e[9] = l * r - o * i, e[10] = u * r - c * i, e[11] = h * r - a * i, e;
161
- }
162
- function It(e, t, n) {
163
- var i = Math.sin(n), r = Math.cos(n), s = t[0], o = t[1], c = t[2], a = t[3], f = t[8], l = t[9], u = t[10], h = t[11];
164
- return t !== e && (e[4] = t[4], e[5] = t[5], e[6] = t[6], e[7] = t[7], e[12] = t[12], e[13] = t[13], e[14] = t[14], e[15] = t[15]), e[0] = s * r - f * i, e[1] = o * r - l * i, e[2] = c * r - u * i, e[3] = a * r - h * i, e[8] = s * i + f * r, e[9] = o * i + l * r, e[10] = c * i + u * r, e[11] = a * i + h * r, e;
159
+ var i = Math.sin(n), r = Math.cos(n), s = t[4], o = t[5], c = t[6], a = t[7], f = t[8], l = t[9], h = t[10], u = t[11];
160
+ return t !== e && (e[0] = t[0], e[1] = t[1], e[2] = t[2], e[3] = t[3], e[12] = t[12], e[13] = t[13], e[14] = t[14], e[15] = t[15]), e[4] = s * r + f * i, e[5] = o * r + l * i, e[6] = c * r + h * i, e[7] = a * r + u * i, e[8] = f * r - s * i, e[9] = l * r - o * i, e[10] = h * r - c * i, e[11] = u * r - a * i, e;
165
161
  }
166
162
  function Dt(e, t, n) {
167
- var i = Math.sin(n), r = Math.cos(n), s = t[0], o = t[1], c = t[2], a = t[3], f = t[4], l = t[5], u = t[6], h = t[7];
168
- return t !== e && (e[8] = t[8], e[9] = t[9], e[10] = t[10], e[11] = t[11], e[12] = t[12], e[13] = t[13], e[14] = t[14], e[15] = t[15]), e[0] = s * r + f * i, e[1] = o * r + l * i, e[2] = c * r + u * i, e[3] = a * r + h * i, e[4] = f * r - s * i, e[5] = l * r - o * i, e[6] = u * r - c * i, e[7] = h * r - a * i, e;
163
+ var i = Math.sin(n), r = Math.cos(n), s = t[0], o = t[1], c = t[2], a = t[3], f = t[8], l = t[9], h = t[10], u = t[11];
164
+ return t !== e && (e[4] = t[4], e[5] = t[5], e[6] = t[6], e[7] = t[7], e[12] = t[12], e[13] = t[13], e[14] = t[14], e[15] = t[15]), e[0] = s * r - f * i, e[1] = o * r - l * i, e[2] = c * r - h * i, e[3] = a * r - u * i, e[8] = s * i + f * r, e[9] = o * i + l * r, e[10] = c * i + h * r, e[11] = a * i + u * r, e;
165
+ }
166
+ function It(e, t, n) {
167
+ var i = Math.sin(n), r = Math.cos(n), s = t[0], o = t[1], c = t[2], a = t[3], f = t[4], l = t[5], h = t[6], u = t[7];
168
+ return t !== e && (e[8] = t[8], e[9] = t[9], e[10] = t[10], e[11] = t[11], e[12] = t[12], e[13] = t[13], e[14] = t[14], e[15] = t[15]), e[0] = s * r + f * i, e[1] = o * r + l * i, e[2] = c * r + h * i, e[3] = a * r + u * i, e[4] = f * r - s * i, e[5] = l * r - o * i, e[6] = h * r - c * i, e[7] = u * r - a * i, e;
169
169
  }
170
170
  function Ot(e, t) {
171
- var n = t[0], i = t[1], r = t[2], s = t[3], o = n + n, c = i + i, a = r + r, f = n * o, l = i * o, u = i * c, h = r * o, d = r * c, m = r * a, _ = s * o, w = s * c, x = s * a;
172
- return e[0] = 1 - u - m, e[1] = l + x, e[2] = h - w, e[3] = 0, e[4] = l - x, e[5] = 1 - f - m, e[6] = d + _, e[7] = 0, e[8] = h + w, e[9] = d - _, e[10] = 1 - f - u, e[11] = 0, e[12] = 0, e[13] = 0, e[14] = 0, e[15] = 1, e;
171
+ var n = t[0], i = t[1], r = t[2], s = t[3], o = n + n, c = i + i, a = r + r, f = n * o, l = i * o, h = i * c, u = r * o, d = r * c, m = r * a, _ = s * o, w = s * c, x = s * a;
172
+ return e[0] = 1 - h - m, e[1] = l + x, e[2] = u - w, e[3] = 0, e[4] = l - x, e[5] = 1 - f - m, e[6] = d + _, e[7] = 0, e[8] = u + w, e[9] = d - _, e[10] = 1 - f - h, e[11] = 0, e[12] = 0, e[13] = 0, e[14] = 0, e[15] = 1, e;
173
173
  }
174
174
  function Ct(e, t, n, i, r) {
175
175
  var s = 1 / Math.tan(t / 2), o;
@@ -290,8 +290,8 @@ function tn(e, t) {
290
290
  return Math.acos(2 * n * n - 1);
291
291
  }
292
292
  function Ne(e, t, n, i) {
293
- var r = t[0], s = t[1], o = t[2], c = t[3], a = n[0], f = n[1], l = n[2], u = n[3], h, d, m, _, w;
294
- return d = r * a + s * f + o * l + c * u, d < 0 && (d = -d, a = -a, f = -f, l = -l, u = -u), 1 - d > bt ? (h = Math.acos(d), m = Math.sin(h), _ = Math.sin((1 - i) * h) / m, w = Math.sin(i * h) / m) : (_ = 1 - i, w = i), e[0] = _ * r + w * a, e[1] = _ * s + w * f, e[2] = _ * o + w * l, e[3] = _ * c + w * u, e;
293
+ var r = t[0], s = t[1], o = t[2], c = t[3], a = n[0], f = n[1], l = n[2], h = n[3], u, d, m, _, w;
294
+ return d = r * a + s * f + o * l + c * h, d < 0 && (d = -d, a = -a, f = -f, l = -l, h = -h), 1 - d > St ? (u = Math.acos(d), m = Math.sin(u), _ = Math.sin((1 - i) * u) / m, w = Math.sin(i * u) / m) : (_ = 1 - i, w = i), e[0] = _ * r + w * a, e[1] = _ * s + w * f, e[2] = _ * o + w * l, e[3] = _ * c + w * h, e;
295
295
  }
296
296
  function nn(e, t) {
297
297
  var n = t[0] + t[4] + t[8], i;
@@ -305,12 +305,12 @@ function nn(e, t) {
305
305
  }
306
306
  return e;
307
307
  }
308
- var rn = qt, ht = Qt;
308
+ var rn = qt, ut = Qt;
309
309
  (function() {
310
310
  var e = z(), t = st(1, 0, 0), n = st(0, 1, 0);
311
311
  return function(i, r, s) {
312
312
  var o = Vt(r, s);
313
- return o < -0.999999 ? (Ve(e, t, r), $t(e) < 1e-6 && Ve(e, n, r), Zt(e, e), en(i, e, Math.PI), i) : o > 0.999999 ? (i[0] = 0, i[1] = 0, i[2] = 0, i[3] = 1, i) : (Ve(e, r, s), i[0] = e[0], i[1] = e[1], i[2] = e[2], i[3] = 1 + o, ht(i, i));
313
+ return o < -0.999999 ? (Ve(e, t, r), $t(e) < 1e-6 && Ve(e, n, r), Zt(e, e), en(i, e, Math.PI), i) : o > 0.999999 ? (i[0] = 0, i[1] = 0, i[2] = 0, i[3] = 1, i) : (Ve(e, r, s), i[0] = e[0], i[1] = e[1], i[2] = e[2], i[3] = 1 + o, ut(i, i));
314
314
  };
315
315
  })();
316
316
  (function() {
@@ -322,7 +322,7 @@ var rn = qt, ht = Qt;
322
322
  (function() {
323
323
  var e = Ut();
324
324
  return function(t, n, i, r) {
325
- return e[0] = i[0], e[3] = i[1], e[6] = i[2], e[1] = r[0], e[4] = r[1], e[7] = r[2], e[2] = -n[0], e[5] = -n[1], e[8] = -n[2], ht(t, nn(t, e));
325
+ return e[0] = i[0], e[3] = i[1], e[6] = i[2], e[1] = r[0], e[4] = r[1], e[7] = r[2], e[2] = -n[0], e[5] = -n[1], e[8] = -n[2], ut(t, nn(t, e));
326
326
  };
327
327
  })();
328
328
  function de() {
@@ -348,11 +348,11 @@ function ln(e, t) {
348
348
  var n = t[0] - e[0], i = t[1] - e[1];
349
349
  return Math.hypot(n, i);
350
350
  }
351
- function hn(e, t) {
351
+ function un(e, t) {
352
352
  var n = t[0] - e[0], i = t[1] - e[1];
353
353
  return n * n + i * i;
354
354
  }
355
- var un = cn;
355
+ var hn = cn;
356
356
  (function() {
357
357
  var e = de();
358
358
  return function(t, n, i, r, s, o) {
@@ -362,13 +362,13 @@ var un = cn;
362
362
  return t;
363
363
  };
364
364
  })();
365
- const H = 40075017, Ie = (e) => e / 180 * Math.PI, dn = (e) => e * 180 / Math.PI, mn = (e, t, n) => {
365
+ const H = 40075017, De = (e) => e / 180 * Math.PI, dn = (e) => e * 180 / Math.PI, mn = (e, t, n) => {
366
366
  const i = Math.sqrt(t * t - 4 * e * n);
367
367
  return [(-t - i) / (2 * e), (-t + i) / (2 * e)];
368
368
  }, L = ([e = 0, t = 0, n = 0], i = z()) => we(
369
369
  i,
370
370
  e / 360 + 0.5,
371
- -Math.asinh(Math.tan(Ie(t))) / (2 * Math.PI) + 0.5,
371
+ -Math.asinh(Math.tan(De(t))) / (2 * Math.PI) + 0.5,
372
372
  n / H
373
373
  ), se = ([e = 0, t = 0, n = 0], i = z()) => we(
374
374
  i,
@@ -378,13 +378,13 @@ const H = 40075017, Ie = (e) => e / 180 * Math.PI, dn = (e) => e * 180 / Math.PI
378
378
  ), vn = ([e = 0, t = 0, n = 0], i = z()) => {
379
379
  const r = 2 ** -n;
380
380
  return we(i, e * r, t * r, 0);
381
- }, Se = ([e = 0, t = 0, n = 0]) => {
382
- const i = Math.cos(t * 0.5), r = Math.sin(t * 0.5), s = Math.cos(e * 0.5), o = Math.sin(e * 0.5), c = Math.cos(n * 0.5), a = Math.sin(n * 0.5), f = c * s * i + a * o * r, l = a * s * i - c * o * r, u = c * o * i + a * s * r, h = c * s * r - a * o * i;
383
- return [l, u, h, f];
381
+ }, be = ([e = 0, t = 0, n = 0]) => {
382
+ const i = Math.cos(t * 0.5), r = Math.sin(t * 0.5), s = Math.cos(e * 0.5), o = Math.sin(e * 0.5), c = Math.cos(n * 0.5), a = Math.sin(n * 0.5), f = c * s * i + a * o * r, l = a * s * i - c * o * r, h = c * o * i + a * s * r, u = c * s * r - a * o * i;
383
+ return [l, h, u, f];
384
384
  }, pn = ([e = 0, t = 0, n = 0, i = 0]) => {
385
385
  const r = Math.atan2(2 * (i * e + t * n), 1 - 2 * (e * e + t * t)), s = Math.asin(Math.min(1, 2 * (i * t - n * e))), o = Math.atan2(2 * (i * n + e * t), 1 - 2 * (t * t + n * n));
386
386
  return [s, o, r];
387
- }, ut = {
387
+ }, ht = {
388
388
  target: [0, 0, 0],
389
389
  offset: [0, 0],
390
390
  distance: H,
@@ -392,47 +392,47 @@ const H = 40075017, Ie = (e) => e / 180 * Math.PI, dn = (e) => e * 180 / Math.PI
392
392
  fieldOfView: 45
393
393
  }, xn = xe(), En = ee(), J = (e, t) => {
394
394
  const { target: n, offset: i, distance: r, orientation: s, fieldOfView: o } = {
395
- ...ut,
395
+ ...ht,
396
396
  ...e
397
- }, [c = 0, a = 0] = t, [f = 0, l = 0] = i, [u = 0, h = 0, d = 0] = s, m = Math.tan(Ie(45) / 2) / Math.tan(Ie(o) / 2), _ = r / H * m, w = _ / 100, x = _ * 1e6, A = xe();
398
- rt(A), Xt(A, Ie(o), c / a, w, x), Lt(A, A, [1, -1, 1]);
399
- const p = xe();
400
- rt(p), Nt(p, p, u), It(p, p, h), Dt(p, p, d);
401
- const v = zt(xn, A, p), y = Pt(xe(), v), g = (O) => {
397
+ }, [c = 0, a = 0] = t, [f = 0, l = 0] = i, [h = 0, u = 0, d = 0] = s, m = Math.tan(De(45) / 2) / Math.tan(De(o) / 2), _ = r / H * m, w = _ / 100, x = _ * 1e6, A = xe();
398
+ rt(A), Xt(A, De(o), c / a, w, x), Lt(A, A, [1, -1, 1]);
399
+ const v = xe();
400
+ rt(v), Nt(v, v, h), Dt(v, v, u), It(v, v, d);
401
+ const T = zt(xn, A, v), p = Pt(xe(), T), g = (O) => {
402
402
  const W = [c * O, a * O], k = [f * O, l * O];
403
403
  return J({ ...e, offset: k }, W);
404
404
  }, E = ([O = 0, W = 0], k = ee()) => {
405
405
  const K = 2 * O / c - 1, ve = -(2 * W / a - 1);
406
406
  return ot(k, K, ve, 0, 1);
407
- }, T = ([O = 0, W = 0, , k = 0], K = de()) => on(K, (1 + O / k) * c * 0.5, (1 - W / k) * a * 0.5), R = (O, W = z()) => {
408
- const [k = 0, K = 0, ve = 0, pe = 0] = at(En, O, y);
407
+ }, y = ([O = 0, W = 0, , k = 0], K = de()) => on(K, (1 + O / k) * c * 0.5, (1 - W / k) * a * 0.5), R = (O, W = z()) => {
408
+ const [k = 0, K = 0, ve = 0, pe = 0] = at(En, O, p);
409
409
  return we(W, k / pe, K / pe, ve / pe);
410
- }, M = ([O = 0, W = 0, k = 0], K = ee()) => at(K, ot(K, O, W, k, 1), v), [b = 0, P = 0] = E([f + c / 2, l + a / 2]), [U = 0, S = 0, N = 0] = R([b, P, -1, 1]), [D = 0, j = 0, X = 0] = R([b, P, 1.00001, 1]), [C = 0] = mn(
411
- (D - U) * (D - U) + (j - S) * (j - S) + (X - N) * (X - N),
412
- U * (D - U) + S * (j - S) + N * (X - N),
410
+ }, M = ([O = 0, W = 0, k = 0], K = ee()) => at(K, ot(K, O, W, k, 1), T), [b = 0, P = 0] = E([f + c / 2, l + a / 2]), [U = 0, S = 0, N = 0] = R([b, P, -1, 1]), [I = 0, j = 0, X = 0] = R([b, P, 1.00001, 1]), [C = 0] = mn(
411
+ (I - U) * (I - U) + (j - S) * (j - S) + (X - N) * (X - N),
412
+ U * (I - U) + S * (j - S) + N * (X - N),
413
413
  U * U + S * S + N * N - r * r / H / H * m * m
414
414
  );
415
415
  if (isNaN(C))
416
416
  throw new Error("Unexpected");
417
417
  const G = [
418
- U + C * (D - U),
418
+ U + C * (I - U),
419
419
  S + C * (j - S),
420
420
  N + C * (X - N)
421
- ], Z = re(z(), L(n), G), $ = (O, W = z()) => ne(W, O, Z), be = (O, W = z()) => re(W, O, Z);
421
+ ], Z = re(z(), L(n), G), $ = (O, W = z()) => ne(W, O, Z), Se = (O, W = z()) => re(W, O, Z);
422
422
  return {
423
423
  camera: Z,
424
424
  screen: t,
425
425
  projection: A,
426
- modelView: p,
426
+ modelView: v,
427
427
  fieldScale: m,
428
428
  scale: g,
429
429
  screenToClip: E,
430
- clipToScreen: T,
430
+ clipToScreen: y,
431
431
  clipToLocal: R,
432
432
  localToClip: M,
433
433
  localToWorld: $,
434
- worldToLocal: be,
435
- project: (O) => T(M(be(L(O)))),
434
+ worldToLocal: Se,
435
+ project: (O) => y(M(Se(L(O)))),
436
436
  unproject: (O, { targetZ: W = 0 } = {}) => {
437
437
  const k = E(O), [K = 0, ve = 0, , pe = 0] = k, Tt = [K, ve, -1, pe], et = se($(R(k))), tt = se($(R(Tt))), [, , Ze = 0] = et, [, , nt = 0] = tt, gt = Ze === nt ? 0 : (W - Ze) / (nt - Ze);
438
438
  return Yt(z(), et, tt, gt);
@@ -446,71 +446,72 @@ const H = 40075017, Ie = (e) => e / 180 * Math.PI, dn = (e) => e * 180 / Math.PI
446
446
  onChangeView: o
447
447
  } = n;
448
448
  let c = !1, a = !1;
449
- const { view: f } = n, l = ([v = 0, y = 0]) => {
450
- const [g, E] = [
449
+ const { view: f } = n, l = ([p = 0, g = 0]) => {
450
+ const [E, y] = [
451
451
  e.width / devicePixelRatio,
452
452
  e.height / devicePixelRatio
453
- ], { camera: T, fieldScale: R } = J(f(), [g, E]), { position: M, layer: b } = t.pick([v, y]);
454
- if (!b)
453
+ ], { camera: R, fieldScale: M } = J(f(), [E, y]), { position: b, layer: P } = t.pick([p, g]);
454
+ if (!P)
455
455
  return;
456
- const P = Te(L(M), T) * H / R, U = [v - g / 2, y - E / 2];
456
+ const U = Te(L(b), R) * H / M, S = [p - E / 2, g - y / 2];
457
457
  o({
458
- offset: U,
459
- target: M,
460
- distance: P
458
+ offset: S,
459
+ target: b,
460
+ distance: U
461
461
  });
462
- }, u = (v, y) => {
462
+ }, h = (p, g) => {
463
463
  if (!r())
464
464
  return;
465
- a || (l([v, y]), a = !0);
466
- const [g, E] = [
465
+ a || (l([p, g]), a = !0);
466
+ const [E, y] = [
467
467
  e.width / devicePixelRatio,
468
468
  e.height / devicePixelRatio
469
469
  ];
470
470
  o({
471
- offset: [v - g / 2, y - E / 2]
471
+ offset: [p - E / 2, g - y / 2]
472
472
  });
473
- }, h = (v, y, g, E) => {
473
+ }, u = (p, g, E, y) => {
474
474
  if (!s())
475
475
  return;
476
- r() && !a && (l([v, y]), a = !0);
477
- const [T, R] = [
476
+ r() && !a && (l([p, g]), a = !0);
477
+ const [R, M] = [
478
478
  e.width / devicePixelRatio,
479
479
  e.height / devicePixelRatio
480
- ], { orientation: [M = 0, b = 0, P = 0] = [] } = f(), U = [
480
+ ], { orientation: [b = 0, P = 0, U = 0] = [] } = f(), S = [
481
481
  Math.min(
482
482
  Math.PI / 2 - 0.1,
483
- Math.max(0.1, M - E / R * Math.PI)
483
+ Math.max(0.1, b - y / M * Math.PI)
484
484
  ),
485
- b,
486
- P - g / T * Math.PI
485
+ P,
486
+ U - E / R * Math.PI
487
487
  ];
488
488
  o({
489
- orientation: U
489
+ orientation: S
490
490
  });
491
- }, d = (v) => {
492
- a = !1;
493
- }, m = ({ buttons: v, movementX: y, movementY: g, x: E, y: T }) => {
494
- !i() || !v || (v === 1 && r() ? u(E, T) : v === 2 && s() && h(E, T, y, g));
495
- }, _ = ({ touches: v }) => {
496
- const y = v.item(0);
497
- if (!y)
491
+ }, d = (p) => {
492
+ p.preventDefault(), a = !1;
493
+ }, m = ({ buttons: p, movementX: g, movementY: E, x: y, y: R }) => {
494
+ !i() || !p || (p === 1 && r() ? h(y, R) : p === 2 && s() && u(y, R, g, E));
495
+ }, _ = (p) => {
496
+ p.preventDefault();
497
+ const g = p.touches.item(0);
498
+ if (!g)
498
499
  return;
499
- const { clientX: g, clientY: E } = y;
500
- u(g, E);
501
- }, w = Rt(() => c = !1, 100), x = ({ x: v, y, deltaY: g }) => {
500
+ const { clientX: E, clientY: y } = g;
501
+ h(E, y);
502
+ }, w = Rt(() => c = !1, 100), x = ({ x: p, y: g, deltaY: E }) => {
502
503
  if (!i())
503
504
  return;
504
- c || (r() && l([v, y]), c = !0);
505
- let { distance: E } = { ...ut, ...f() };
506
- E = Math.min(
507
- Math.max(E * Math.exp(g * 1e-3), _n),
505
+ c || (r() && l([p, g]), c = !0);
506
+ let { distance: y } = { ...ht, ...f() };
507
+ y = Math.min(
508
+ Math.max(y * Math.exp(E * 1e-3), _n),
508
509
  H
509
- ), o({ distance: E }), w();
510
- }, A = (v) => v.preventDefault();
511
- return e.addEventListener("mousedown", d), e.addEventListener("mousemove", m), e.addEventListener("touchstart", d, { passive: !1 }), e.addEventListener("touchmove", _, { passive: !1 }), e.addEventListener("wheel", x, { passive: !0 }), e.addEventListener("contextmenu", A), {
510
+ ), o({ distance: y }), w();
511
+ }, A = (p) => p.preventDefault(), v = (p) => p.preventDefault();
512
+ return e.addEventListener("mousedown", d), e.addEventListener("mousemove", m), e.addEventListener("touchstart", d, { passive: !1 }), e.addEventListener("touchmove", _, { passive: !1 }), e.addEventListener("gesturestart", A), e.addEventListener("wheel", x, { passive: !0 }), e.addEventListener("contextmenu", v), {
512
513
  dispose: () => {
513
- e.removeEventListener("mousedown", d), e.removeEventListener("mousemove", m), e.removeEventListener("touchstart", d), e.removeEventListener("touchmove", _), e.removeEventListener("wheel", x), e.removeEventListener("contextmenu", A);
514
+ e.removeEventListener("mousedown", d), e.removeEventListener("mousemove", m), e.removeEventListener("touchstart", d), e.removeEventListener("touchmove", _), e.removeEventListener("gesturestart", A), e.removeEventListener("wheel", x), e.removeEventListener("contextmenu", v);
514
515
  }
515
516
  };
516
517
  }, V = ({
@@ -744,12 +745,12 @@ const gi = (e, t = {}) => {
744
745
  cornerBuffer: s,
745
746
  uvBuffer: o,
746
747
  indexBuffer: c
747
- }), u = ({
748
+ }), h = ({
748
749
  viewport: { projection: m, modelView: _, camera: w, screen: x },
749
750
  depth: A = !1,
750
- index: p = 0
751
+ index: v = 0
751
752
  }) => {
752
- const v = t.position?.() ?? [0, 0, 0], y = t.color?.() ?? [1, 1, 1, 1], g = t.size?.() ?? 100, E = t.minSizePixels?.() ?? 0, T = t.maxSizePixels?.() ?? Number.MAX_VALUE;
753
+ const T = t.position?.() ?? [0, 0, 0], p = t.color?.() ?? [1, 1, 1, 1], g = t.size?.() ?? 100, E = t.minSizePixels?.() ?? 0, y = t.maxSizePixels?.() ?? Number.MAX_VALUE;
753
754
  if (a(), !i || ge(n, A, t))
754
755
  return;
755
756
  (A ? l : f).execute({
@@ -759,19 +760,19 @@ const gi = (e, t = {}) => {
759
760
  screen: x,
760
761
  image: i,
761
762
  imageSize: r,
762
- position: Q(L(v)),
763
- color: y,
763
+ position: Q(L(T)),
764
+ color: p,
764
765
  size: g,
765
766
  minSizePixels: E,
766
- maxSizePixels: T,
767
- index: p
767
+ maxSizePixels: y,
768
+ index: v
768
769
  });
769
- }, h = () => {
770
+ }, u = () => {
770
771
  s.dispose(), o.dispose(), c.dispose(), i?.dispose();
771
772
  }, d = Ae(t);
772
773
  return {
773
- render: u,
774
- dispose: h,
774
+ render: h,
775
+ dispose: u,
775
776
  ...d
776
777
  };
777
778
  }, An = ({ gl: e, programs: t }, {
@@ -785,9 +786,9 @@ const gi = (e, t = {}) => {
785
786
  fragmentSource: a ? Re : gn
786
787
  }), l = f.attribute2f("corner", n, {
787
788
  stride: 2 * Float32Array.BYTES_PER_ELEMENT
788
- }), u = f.attribute2f("uv", i, {
789
+ }), h = f.attribute2f("uv", i, {
789
790
  stride: 2 * Float32Array.BYTES_PER_ELEMENT
790
- }), h = f.uniformMatrix4f("projection"), d = f.uniformMatrix4f("model_view"), m = f.uniform3i("camera"), _ = f.uniform2f("screen"), w = f.uniform1i("image"), x = f.uniform2f("image_size"), A = f.uniform3i("position"), p = f.uniform4f("color"), v = f.uniform1i("index"), y = f.uniform1f("size"), g = f.uniform1f("min_size_pixels"), E = f.uniform1f("max_size_pixels");
791
+ }), u = f.uniformMatrix4f("projection"), d = f.uniformMatrix4f("model_view"), m = f.uniform3i("camera"), _ = f.uniform2f("screen"), w = f.uniform1i("image"), x = f.uniform2f("image_size"), A = f.uniform3i("position"), v = f.uniform4f("color"), T = f.uniform1i("index"), p = f.uniform1f("size"), g = f.uniform1f("min_size_pixels"), E = f.uniform1f("max_size_pixels");
791
792
  return { execute: ({
792
793
  projection: R,
793
794
  modelView: M,
@@ -796,13 +797,13 @@ const gi = (e, t = {}) => {
796
797
  image: U,
797
798
  imageSize: S,
798
799
  position: N,
799
- color: D,
800
+ color: I,
800
801
  size: j,
801
802
  minSizePixels: X,
802
803
  maxSizePixels: C,
803
804
  index: G
804
805
  }) => {
805
- f.use(), l.use(), u.use(), h.set(R), d.set(M), m.set(b), _.set(P), x.set(S), A.set(N), p.set(D), y.set(j), g.set(X), E.set(C), v.set(G), e.activeTexture(e.TEXTURE0), w.set(0), U.use(), r.use(), e.drawElements(e.TRIANGLES, 6, e.UNSIGNED_SHORT, 0);
806
+ f.use(), l.use(), h.use(), u.set(R), d.set(M), m.set(b), _.set(P), x.set(S), A.set(N), v.set(I), p.set(j), g.set(X), E.set(C), T.set(G), e.activeTexture(e.TEXTURE0), w.set(0), U.use(), r.use(), e.drawElements(e.TRIANGLES, 6, e.UNSIGNED_SHORT, 0);
806
807
  } };
807
808
  }, o = s(), c = s(!0);
808
809
  return { renderProgram: o, depthProgram: c };
@@ -829,7 +830,7 @@ const gi = (e, t = {}) => {
829
830
  render: e,
830
831
  dispose: () => {
831
832
  }
832
- }), bi = () => ({ dispose: () => {
833
+ }), Si = () => ({ dispose: () => {
833
834
  } });
834
835
  var Mn = `#version 300 es
835
836
 
@@ -848,7 +849,7 @@ void main() {
848
849
  result = color_out * texture(
849
850
  dash,
850
851
  vec2(fract((distance_out / dash_size) - dash_offset), 0.0));;
851
- }`, bn = `#version 300 es
852
+ }`, Sn = `#version 300 es
852
853
 
853
854
  precision highp float;
854
855
 
@@ -915,51 +916,51 @@ void main(void) {
915
916
  color_out = color;
916
917
  distance_out = distance;
917
918
  }`;
918
- const Si = (e, t = {}) => {
919
+ const bi = (e, t = {}) => {
919
920
  const { gl: n } = e;
920
921
  let i = 0;
921
- const r = V({ gl: n, type: "i32", target: "array" }), s = V({ gl: n, type: "u16", target: "element" }), o = V({ gl: n, type: "f32", target: "array" }), c = V({ gl: n, type: "f32", target: "array" }), { renderProgram: a, depthProgram: f } = Sn(e, {
922
+ const r = V({ gl: n, type: "i32", target: "array" }), s = V({ gl: n, type: "u16", target: "element" }), o = V({ gl: n, type: "f32", target: "array" }), c = V({ gl: n, type: "f32", target: "array" }), { renderProgram: a, depthProgram: f } = bn(e, {
922
923
  positionBuffer: r,
923
924
  indexBuffer: s,
924
925
  cornerBuffer: o,
925
926
  distanceBuffer: c
926
927
  }), l = mt(n);
927
928
  l.use(), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MIN_FILTER, n.LINEAR), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MAG_FILTER, n.LINEAR), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_S, n.CLAMP_TO_EDGE), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_T, n.REPEAT);
928
- const u = ({
929
- viewport: { projection: w, modelView: x, camera: A, screen: p },
930
- depth: v = !1,
931
- index: y = 0
929
+ const h = ({
930
+ viewport: { projection: w, modelView: x, camera: A, screen: v },
931
+ depth: T = !1,
932
+ index: p = 0
932
933
  }) => {
933
- h(), d();
934
- const g = t.color?.() ?? [1, 1, 1, 1], E = t.width?.() ?? 1, T = t.minWidthPixels?.() ?? 0, R = t.maxWidthPixels?.() ?? Number.MAX_VALUE, M = t.depthWidthPixels?.(), b = t.dashSize?.() ?? 1e3, P = t.dashOffset?.() ?? 0;
935
- if (ge(n, v, t))
934
+ u(), d();
935
+ const g = t.color?.() ?? [1, 1, 1, 1], E = t.width?.() ?? 1, y = t.minWidthPixels?.() ?? 0, R = t.maxWidthPixels?.() ?? Number.MAX_VALUE, M = t.depthWidthPixels?.(), b = t.dashSize?.() ?? 1e3, P = t.dashOffset?.() ?? 0;
936
+ if (ge(n, T, t))
936
937
  return;
937
- (v ? f : a).execute({
938
+ (T ? f : a).execute({
938
939
  projection: w,
939
940
  modelView: x,
940
941
  camera: Q(A),
941
- screen: p,
942
+ screen: v,
942
943
  count: i,
943
944
  color: g,
944
945
  width: E,
945
- minWidthPixels: v && M !== void 0 ? Math.max(T, M) : T,
946
- maxWidthPixels: v && M !== void 0 ? Math.max(R, M) : R,
947
- index: y,
946
+ minWidthPixels: T && M !== void 0 ? Math.max(y, M) : y,
947
+ maxWidthPixels: T && M !== void 0 ? Math.max(R, M) : R,
948
+ index: p,
948
949
  dash: l,
949
950
  dashSize: b,
950
951
  dashOffset: P
951
952
  });
952
- }, h = me(
953
+ }, u = me(
953
954
  () => t.points?.() ?? [],
954
955
  (w) => {
955
- const x = w.flatMap((y) => {
956
- const [g] = y, [E] = y.slice(-1);
957
- return !g || !E ? [] : [g, ...y, E].map((T) => Q(L(T))).flatMap((T) => [...T, ...T, ...T, ...T]);
956
+ const x = w.flatMap((p) => {
957
+ const [g] = p, [E] = p.slice(-1);
958
+ return !g || !E ? [] : [g, ...p, E].map((y) => Q(L(y))).flatMap((y) => [...y, ...y, ...y, ...y]);
958
959
  }), { indexData: A } = w.reduce(
959
- ({ indexData: y, count: g }, E) => {
960
+ ({ indexData: p, count: g }, E) => {
960
961
  if (E.length === 0)
961
- return { indexData: y, count: g };
962
- const T = ie(0, (E.length - 1) * 2).flatMap((R) => {
962
+ return { indexData: p, count: g };
963
+ const y = ie(0, (E.length - 1) * 2).flatMap((R) => {
963
964
  const [M = 0, b = 0, P = 0, U = 0] = ie(0, 4).map(
964
965
  (S) => S + R * 2 + g
965
966
  );
@@ -968,13 +969,13 @@ const Si = (e, t = {}) => {
968
969
  [M, U, P]
969
970
  ].flat();
970
971
  });
971
- return g += (E.length + 2) * 4, y = y.concat(T), { indexData: y, count: g };
972
+ return g += (E.length + 2) * 4, p = p.concat(y), { indexData: p, count: g };
972
973
  },
973
974
  { indexData: [], count: 0 }
974
975
  );
975
976
  i = A.length;
976
- const p = w.flatMap(
977
- (y) => y.length === 0 ? [] : ie(0, (y.length + 1) * 2).flatMap(
977
+ const v = w.flatMap(
978
+ (p) => p.length === 0 ? [] : ie(0, (p.length + 1) * 2).flatMap(
978
979
  () => [
979
980
  [-1, -1],
980
981
  [-1, 1],
@@ -982,16 +983,16 @@ const Si = (e, t = {}) => {
982
983
  [1, 1]
983
984
  ].flat()
984
985
  )
985
- ), v = w.flatMap((y) => {
986
- const E = y.map(
987
- (M, b) => Te(L(M), L(y[b - 1] ?? M)) * H
986
+ ), T = w.flatMap((p) => {
987
+ const E = p.map(
988
+ (M, b) => Te(L(M), L(p[b - 1] ?? M)) * H
988
989
  ).reduce(
989
990
  ({ current: M, result: b }, P) => (M += P, b.push(M), { current: M, result: b }),
990
991
  { current: 0, result: [] }
991
- ).result, [T] = E, [R] = E.slice(-1);
992
- return T === void 0 || R === void 0 ? [] : [T, ...E, R].flatMap((M) => [M, M, M, M]);
992
+ ).result, [y] = E, [R] = E.slice(-1);
993
+ return y === void 0 || R === void 0 ? [] : [y, ...E, R].flatMap((M) => [M, M, M, M]);
993
994
  });
994
- r.set(x), s.set(A), o.set(p), c.set(v);
995
+ r.set(x), s.set(A), o.set(v), c.set(T);
995
996
  }
996
997
  ), d = me(
997
998
  () => t.dashPattern?.(),
@@ -1012,11 +1013,11 @@ const Si = (e, t = {}) => {
1012
1013
  r.dispose(), s.dispose(), o.dispose(), c.dispose();
1013
1014
  }, _ = Ae(t);
1014
1015
  return {
1015
- render: u,
1016
+ render: h,
1016
1017
  dispose: m,
1017
1018
  ..._
1018
1019
  };
1019
- }, Sn = ({ gl: e, programs: t }, {
1020
+ }, bn = ({ gl: e, programs: t }, {
1020
1021
  positionBuffer: n,
1021
1022
  indexBuffer: i,
1022
1023
  cornerBuffer: r,
@@ -1024,38 +1025,38 @@ const Si = (e, t = {}) => {
1024
1025
  }) => {
1025
1026
  const o = (f = !1) => {
1026
1027
  const l = t.get({
1027
- vertexSource: bn,
1028
+ vertexSource: Sn,
1028
1029
  fragmentSource: f ? Re : Mn
1029
- }), u = Float32Array.BYTES_PER_ELEMENT, h = Int32Array.BYTES_PER_ELEMENT, d = l.attribute3i("previous", n, {
1030
- stride: h * 3
1030
+ }), h = Float32Array.BYTES_PER_ELEMENT, u = Int32Array.BYTES_PER_ELEMENT, d = l.attribute3i("previous", n, {
1031
+ stride: u * 3
1031
1032
  }), m = l.attribute3i("current", n, {
1032
- stride: h * 3,
1033
- offset: h * 3 * 4
1033
+ stride: u * 3,
1034
+ offset: u * 3 * 4
1034
1035
  }), _ = l.attribute3i("next", n, {
1035
- stride: h * 3,
1036
- offset: h * 3 * 4 * 2
1036
+ stride: u * 3,
1037
+ offset: u * 3 * 4 * 2
1037
1038
  }), w = l.attribute2f("corner", r, {
1038
- stride: u * 2
1039
+ stride: h * 2
1039
1040
  }), x = l.attribute1f("distance", s, {
1040
- stride: u,
1041
- offset: u * 1 * 4
1042
- }), A = l.uniformMatrix4f("projection"), p = l.uniformMatrix4f("model_view"), v = l.uniform3i("camera"), y = l.uniform2f("screen"), g = l.uniform4f("color"), E = l.uniform1f("width"), T = l.uniform1f("max_width_pixels"), R = l.uniform1f("min_width_pixels"), M = l.uniform1i("index"), b = l.uniform1i("dash"), P = l.uniform1f("dash_size"), U = l.uniform1f("dash_offset");
1041
+ stride: h,
1042
+ offset: h * 1 * 4
1043
+ }), A = l.uniformMatrix4f("projection"), v = l.uniformMatrix4f("model_view"), T = l.uniform3i("camera"), p = l.uniform2f("screen"), g = l.uniform4f("color"), E = l.uniform1f("width"), y = l.uniform1f("max_width_pixels"), R = l.uniform1f("min_width_pixels"), M = l.uniform1i("index"), b = l.uniform1i("dash"), P = l.uniform1f("dash_size"), U = l.uniform1f("dash_offset");
1043
1044
  return { execute: ({
1044
1045
  projection: N,
1045
- modelView: D,
1046
+ modelView: I,
1046
1047
  camera: j,
1047
1048
  screen: X,
1048
1049
  count: C,
1049
1050
  color: G,
1050
1051
  width: Z,
1051
1052
  minWidthPixels: $,
1052
- maxWidthPixels: be,
1053
+ maxWidthPixels: Se,
1053
1054
  index: qe,
1054
1055
  dash: Je,
1055
1056
  dashSize: O,
1056
1057
  dashOffset: W
1057
1058
  }) => {
1058
- C !== 0 && (l.use(), d.use(), m.use(), _.use(), w.use(), x.use(), A.set(N), p.set(D), v.set(j), y.set(X), g.set(G), E.set(Z), R.set($), T.set(be), M.set(qe), P.set(O), U.set(W), e.activeTexture(e.TEXTURE0), b.set(0), Je.use(), i.use(), e.drawElements(e.TRIANGLES, C, e.UNSIGNED_SHORT, 0));
1059
+ C !== 0 && (l.use(), d.use(), m.use(), _.use(), w.use(), x.use(), A.set(N), v.set(I), T.set(j), p.set(X), g.set(G), E.set(Z), R.set($), y.set(Se), M.set(qe), P.set(O), U.set(W), e.activeTexture(e.TEXTURE0), b.set(0), Je.use(), i.use(), e.drawElements(e.TRIANGLES, C, e.UNSIGNED_SHORT, 0));
1059
1060
  } };
1060
1061
  }, c = o(), a = o(!0);
1061
1062
  return { renderProgram: c, depthProgram: a };
@@ -1122,7 +1123,7 @@ const Ui = (e, t = {}) => {
1122
1123
  depth: x = !1,
1123
1124
  index: A = 0
1124
1125
  }) => {
1125
- const p = t.position?.() ?? [0, 0, 0], v = t.orientation?.() ?? [0, 0, 0, 1], y = t.color?.() ?? [1, 1, 1, 1], g = t.diffuse?.() ?? [0, 0, 0, 0], E = t.size?.() ?? 1, T = t.minSizePixels?.() ?? 0, R = t.maxSizePixels?.() ?? Number.MAX_VALUE;
1126
+ const v = t.position?.() ?? [0, 0, 0], T = t.orientation?.() ?? [0, 0, 0, 1], p = t.color?.() ?? [1, 1, 1, 1], g = t.diffuse?.() ?? [0, 0, 0, 0], E = t.size?.() ?? 1, y = t.minSizePixels?.() ?? 0, R = t.maxSizePixels?.() ?? Number.MAX_VALUE;
1126
1127
  if (l(), ge(n, x, t))
1127
1128
  return;
1128
1129
  (x ? a : c).execute({
@@ -1131,12 +1132,12 @@ const Ui = (e, t = {}) => {
1131
1132
  camera: Q(_),
1132
1133
  screen: w,
1133
1134
  count: i,
1134
- position: Q(L(p)),
1135
- orientation: Ot(xe(), v),
1136
- color: y,
1135
+ position: Q(L(v)),
1136
+ orientation: Ot(xe(), T),
1137
+ color: p,
1137
1138
  diffuse: g,
1138
1139
  size: E,
1139
- minSizePixels: T,
1140
+ minSizePixels: y,
1140
1141
  maxSizePixels: R,
1141
1142
  index: A
1142
1143
  });
@@ -1148,13 +1149,13 @@ const Ui = (e, t = {}) => {
1148
1149
  w.length === 0 ? m.flatMap(() => [0, 0, 0]) : w.flatMap((x) => [...x])
1149
1150
  ), i = _.length * 3;
1150
1151
  }
1151
- ), u = () => {
1152
+ ), h = () => {
1152
1153
  r.dispose(), s.dispose(), o.dispose();
1153
- }, h = Ae(t);
1154
+ }, u = Ae(t);
1154
1155
  return {
1155
1156
  render: f,
1156
- dispose: u,
1157
- ...h
1157
+ dispose: h,
1158
+ ...u
1158
1159
  };
1159
1160
  }, zn = ({ gl: e, programs: t }, {
1160
1161
  vertexBuffer: n,
@@ -1165,7 +1166,7 @@ const Ui = (e, t = {}) => {
1165
1166
  const f = t.get({
1166
1167
  vertexSource: Pn,
1167
1168
  fragmentSource: a ? Re : Un
1168
- }), l = f.attribute3f("vertex", n), u = f.attribute3f("normal", r), h = f.uniformMatrix4f("projection"), d = f.uniformMatrix4f("model_view"), m = f.uniform3i("camera"), _ = f.uniform3i("position"), w = f.uniformMatrix4f("orientation"), x = f.uniform2f("screen"), A = f.uniform4f("color"), p = f.uniform4f("diffuse"), v = f.uniform1f("size"), y = f.uniform1f("min_size_pixels"), g = f.uniform1f("max_size_pixels"), E = f.uniform1i("index");
1169
+ }), l = f.attribute3f("vertex", n), h = f.attribute3f("normal", r), u = f.uniformMatrix4f("projection"), d = f.uniformMatrix4f("model_view"), m = f.uniform3i("camera"), _ = f.uniform3i("position"), w = f.uniformMatrix4f("orientation"), x = f.uniform2f("screen"), A = f.uniform4f("color"), v = f.uniform4f("diffuse"), T = f.uniform1f("size"), p = f.uniform1f("min_size_pixels"), g = f.uniform1f("max_size_pixels"), E = f.uniform1i("index");
1169
1170
  return { execute: ({
1170
1171
  projection: R,
1171
1172
  modelView: M,
@@ -1174,14 +1175,14 @@ const Ui = (e, t = {}) => {
1174
1175
  count: U,
1175
1176
  position: S,
1176
1177
  orientation: N,
1177
- color: D,
1178
+ color: I,
1178
1179
  diffuse: j,
1179
1180
  size: X,
1180
1181
  minSizePixels: C,
1181
1182
  maxSizePixels: G,
1182
1183
  index: Z
1183
1184
  }) => {
1184
- f.use(), l.use(), u.use(), h.set(R), d.set(M), m.set(b), x.set(P), _.set(S), w.set(N), A.set(D), p.set(j), v.set(X), y.set(C), g.set(G), E.set(Z), i.use(), e.drawElements(e.TRIANGLES, U, e.UNSIGNED_SHORT, 0);
1185
+ f.use(), l.use(), h.use(), u.set(R), d.set(M), m.set(b), x.set(P), _.set(S), w.set(N), A.set(I), v.set(j), T.set(X), p.set(C), g.set(G), E.set(Z), i.use(), e.drawElements(e.TRIANGLES, U, e.UNSIGNED_SHORT, 0);
1185
1186
  } };
1186
1187
  }, o = s(), c = s(!0);
1187
1188
  return { renderProgram: o, depthProgram: c };
@@ -1199,7 +1200,7 @@ var pt = function(e, t, n, i, r) {
1199
1200
  t === void 0 && (t = e);
1200
1201
  let n = e, i;
1201
1202
  do
1202
- if (i = !1, !n.steiner && (je(n, n.next) || I(n.prev, n, n.next) === 0)) {
1203
+ if (i = !1, !n.steiner && (je(n, n.next) || D(n.prev, n, n.next) === 0)) {
1203
1204
  if (ye(n), n = t = n.prev, n === n.next)
1204
1205
  break;
1205
1206
  i = !0;
@@ -1218,51 +1219,51 @@ var pt = function(e, t, n, i, r) {
1218
1219
  continue;
1219
1220
  }
1220
1221
  if (e = f, e === c) {
1221
- o === 0 ? Ee(oe(e), t, n, i, r, s, 1) : o === 1 ? (e = In(oe(e), t, n), Ee(e, t, n, i, r, s, 2)) : o === 2 && Dn(e, t, n, i, r, s);
1222
+ o === 0 ? Ee(oe(e), t, n, i, r, s, 1) : o === 1 ? (e = Dn(oe(e), t, n), Ee(e, t, n, i, r, s, 2)) : o === 2 && In(e, t, n, i, r, s);
1222
1223
  break;
1223
1224
  }
1224
1225
  }
1225
1226
  }, Ln = function(e) {
1226
1227
  const t = e.prev, n = e, i = e.next;
1227
- if (I(t, n, i) >= 0)
1228
+ if (D(t, n, i) >= 0)
1228
1229
  return !1;
1229
1230
  let r = e.next.next;
1230
1231
  for (; r !== e.prev; ) {
1231
- if (he(t.x, t.y, n.x, n.y, i.x, i.y, r.x, r.y) && I(r.prev, r, r.next) >= 0)
1232
+ if (ue(t.x, t.y, n.x, n.y, i.x, i.y, r.x, r.y) && D(r.prev, r, r.next) >= 0)
1232
1233
  return !1;
1233
1234
  r = r.next;
1234
1235
  }
1235
1236
  return !0;
1236
1237
  }, Nn = function(e, t, n, i) {
1237
1238
  const r = e.prev, s = e, o = e.next;
1238
- if (I(r, s, o) >= 0)
1239
+ if (D(r, s, o) >= 0)
1239
1240
  return !1;
1240
- const c = r.x < s.x ? r.x < o.x ? r.x : o.x : s.x < o.x ? s.x : o.x, a = r.y < s.y ? r.y < o.y ? r.y : o.y : s.y < o.y ? s.y : o.y, f = r.x > s.x ? r.x > o.x ? r.x : o.x : s.x > o.x ? s.x : o.x, l = r.y > s.y ? r.y > o.y ? r.y : o.y : s.y > o.y ? s.y : o.y, u = Ge(c, a, t, n, i), h = Ge(f, l, t, n, i);
1241
+ const c = r.x < s.x ? r.x < o.x ? r.x : o.x : s.x < o.x ? s.x : o.x, a = r.y < s.y ? r.y < o.y ? r.y : o.y : s.y < o.y ? s.y : o.y, f = r.x > s.x ? r.x > o.x ? r.x : o.x : s.x > o.x ? s.x : o.x, l = r.y > s.y ? r.y > o.y ? r.y : o.y : s.y > o.y ? s.y : o.y, h = Ge(c, a, t, n, i), u = Ge(f, l, t, n, i);
1241
1242
  let { prevZ: d, nextZ: m } = e;
1242
- for (; d !== null && m !== null && d.z >= u && m.z <= h; ) {
1243
- if (d !== e.prev && d !== e.next && he(r.x, r.y, s.x, s.y, o.x, o.y, d.x, d.y) && I(d.prev, d, d.next) >= 0 || (d = d.prevZ, m !== e.prev && m !== e.next && he(r.x, r.y, s.x, s.y, o.x, o.y, m.x, m.y) && I(m.prev, m, m.next) >= 0))
1243
+ for (; d !== null && m !== null && d.z >= h && m.z <= u; ) {
1244
+ if (d !== e.prev && d !== e.next && ue(r.x, r.y, s.x, s.y, o.x, o.y, d.x, d.y) && D(d.prev, d, d.next) >= 0 || (d = d.prevZ, m !== e.prev && m !== e.next && ue(r.x, r.y, s.x, s.y, o.x, o.y, m.x, m.y) && D(m.prev, m, m.next) >= 0))
1244
1245
  return !1;
1245
1246
  m = m.nextZ;
1246
1247
  }
1247
- for (; d !== null && d.z >= u; ) {
1248
- if (d !== e.prev && d !== e.next && he(r.x, r.y, s.x, s.y, o.x, o.y, d.x, d.y) && I(d.prev, d, d.next) >= 0)
1248
+ for (; d !== null && d.z >= h; ) {
1249
+ if (d !== e.prev && d !== e.next && ue(r.x, r.y, s.x, s.y, o.x, o.y, d.x, d.y) && D(d.prev, d, d.next) >= 0)
1249
1250
  return !1;
1250
1251
  d = d.prevZ;
1251
1252
  }
1252
- for (; m !== null && m.z <= h; ) {
1253
- if (m !== e.prev && m !== e.next && he(r.x, r.y, s.x, s.y, o.x, o.y, m.x, m.y) && I(m.prev, m, m.next) >= 0)
1253
+ for (; m !== null && m.z <= u; ) {
1254
+ if (m !== e.prev && m !== e.next && ue(r.x, r.y, s.x, s.y, o.x, o.y, m.x, m.y) && D(m.prev, m, m.next) >= 0)
1254
1255
  return !1;
1255
1256
  m = m.nextZ;
1256
1257
  }
1257
1258
  return !0;
1258
- }, In = function(e, t, n) {
1259
+ }, Dn = function(e, t, n) {
1259
1260
  let i = e;
1260
1261
  do {
1261
1262
  const r = i.prev, s = i.next.next;
1262
1263
  !je(r, s) && xt(r, i, i.next, s) && _e(r, s) && _e(s, r) && (t.push(r.i / n), t.push(i.i / n), t.push(s.i / n), ye(i), ye(i.next), i = e = s), i = i.next;
1263
1264
  } while (i !== e);
1264
1265
  return i;
1265
- }, Dn = function(e, t, n, i, r, s) {
1266
+ }, In = function(e, t, n, i, r, s) {
1266
1267
  let o = e;
1267
1268
  do {
1268
1269
  let c = o.next.next;
@@ -1300,9 +1301,9 @@ var pt = function(e, t, n, i, r) {
1300
1301
  let s = -1 / 0, o;
1301
1302
  do {
1302
1303
  if (r <= n.y && r >= n.next.y && n.next.y !== n.y) {
1303
- const h = n.x + (r - n.y) * (n.next.x - n.x) / (n.next.y - n.y);
1304
- if (h <= i && h > s) {
1305
- if (s = h, h === i) {
1304
+ const u = n.x + (r - n.y) * (n.next.x - n.x) / (n.next.y - n.y);
1305
+ if (u <= i && u > s) {
1306
+ if (s = u, u === i) {
1306
1307
  if (r === n.y)
1307
1308
  return n;
1308
1309
  if (r === n.next.y)
@@ -1318,10 +1319,10 @@ var pt = function(e, t, n, i, r) {
1318
1319
  if (i === s)
1319
1320
  return o;
1320
1321
  const c = o, a = o.x, f = o.y;
1321
- let l = 1 / 0, u;
1322
+ let l = 1 / 0, h;
1322
1323
  n = o;
1323
1324
  do
1324
- i >= n.x && n.x >= a && i !== n.x && he(r < f ? i : s, r, a, f, r < f ? s : i, r, n.x, n.y) && (u = Math.abs(r - n.y) / (i - n.x), _e(n, e) && (u < l || u === l && (n.x > o.x || n.x === o.x && I(o.prev, o, n.prev) < 0 && I(n.next, o, o.next) < 0)) && (o = n, l = u)), n = n.next;
1325
+ i >= n.x && n.x >= a && i !== n.x && ue(r < f ? i : s, r, a, f, r < f ? s : i, r, n.x, n.y) && (h = Math.abs(r - n.y) / (i - n.x), _e(n, e) && (h < l || h === l && (n.x > o.x || n.x === o.x && D(o.prev, o, n.prev) < 0 && D(n.next, o, o.next) < 0)) && (o = n, l = h)), n = n.next;
1325
1326
  while (n !== c);
1326
1327
  return o;
1327
1328
  }, jn = function(e, t, n, i) {
@@ -1351,16 +1352,16 @@ var pt = function(e, t, n, i, r) {
1351
1352
  (t.x < n.x || t.x === n.x && t.y < n.y) && (n = t), t = t.next;
1352
1353
  while (t !== e);
1353
1354
  return n;
1354
- }, he = function(e, t, n, i, r, s, o, c) {
1355
+ }, ue = function(e, t, n, i, r, s, o, c) {
1355
1356
  return (r - o) * (t - c) - (e - o) * (s - c) >= 0 && (e - o) * (i - c) - (n - o) * (t - c) >= 0 && (n - o) * (s - c) - (r - o) * (i - c) >= 0;
1356
1357
  }, Vn = function(e, t) {
1357
- return e.next.i !== t.i && e.prev.i !== t.i && !Yn(e, t) && (_e(e, t) && _e(t, e) && $n(e, t) && (I(e.prev, e, t.prev) !== 0 || I(e, t.prev, t) !== 0) || je(e, t) && I(e.prev, e, e.next) > 0 && I(t.prev, t, t.next) > 0);
1358
- }, I = function(e, t, n) {
1358
+ return e.next.i !== t.i && e.prev.i !== t.i && !Yn(e, t) && (_e(e, t) && _e(t, e) && $n(e, t) && (D(e.prev, e, t.prev) !== 0 || D(e, t.prev, t) !== 0) || je(e, t) && D(e.prev, e, e.next) > 0 && D(t.prev, t, t.next) > 0);
1359
+ }, D = function(e, t, n) {
1359
1360
  return (t.y - e.y) * (n.x - t.x) - (t.x - e.x) * (n.y - t.y);
1360
1361
  }, je = function(e, t) {
1361
1362
  return e.x === t.x && e.y === t.y;
1362
1363
  }, xt = function(e, t, n, i) {
1363
- const r = Pe(I(e, t, n)), s = Pe(I(e, t, i)), o = Pe(I(n, i, e)), c = Pe(I(n, i, t));
1364
+ const r = Pe(D(e, t, n)), s = Pe(D(e, t, i)), o = Pe(D(n, i, e)), c = Pe(D(n, i, t));
1364
1365
  return !!(r !== s && o !== c || r === 0 && ze(e, n, t) || s === 0 && ze(e, i, t) || o === 0 && ze(n, e, i) || c === 0 && ze(n, t, i));
1365
1366
  }, Pe = function(e) {
1366
1367
  return e > 0 ? 1 : e < 0 ? -1 : 0;
@@ -1375,7 +1376,7 @@ var pt = function(e, t, n, i, r) {
1375
1376
  } while (n !== e);
1376
1377
  return !1;
1377
1378
  }, _e = function(e, t) {
1378
- return I(e.prev, e, e.next) < 0 ? I(e, t, e.next) >= 0 && I(e, e.prev, t) >= 0 : I(e, t, e.prev) < 0 || I(e, e.next, t) < 0;
1379
+ return D(e.prev, e, e.next) < 0 ? D(e, t, e.next) >= 0 && D(e, e.prev, t) >= 0 : D(e, t, e.prev) < 0 || D(e, e.next, t) < 0;
1379
1380
  }, $n = function(e, t) {
1380
1381
  const n = (e.x + t.x) / 2, i = (e.y + t.y) / 2;
1381
1382
  let r = e, s = !1;
@@ -1414,14 +1415,14 @@ function Hn(e, t = [], n = 2) {
1414
1415
  const o = [];
1415
1416
  if (s === null || s.next === s.prev)
1416
1417
  return o;
1417
- let c = 1 / 0, a = 1 / 0, f = -1 / 0, l = -1 / 0, u = 0, h, d;
1418
+ let c = 1 / 0, a = 1 / 0, f = -1 / 0, l = -1 / 0, h = 0, u, d;
1418
1419
  if (i && (s = On(e, t, s, n)), e.length > 80 * n) {
1419
1420
  c = f = e[0], a = l = e[1];
1420
1421
  for (let m = n; m < r; m += n)
1421
- h = e[m], d = e[m + 1], h < c && (c = h), d < a && (a = d), h > f && (f = h), d > l && (l = d);
1422
- u = Math.max(f - c, l - a), u = u !== 0 ? 1 / u : 0;
1422
+ u = e[m], d = e[m + 1], u < c && (c = u), d < a && (a = d), u > f && (f = u), d > l && (l = d);
1423
+ h = Math.max(f - c, l - a), h = h !== 0 ? 1 / h : 0;
1423
1424
  }
1424
- return Ee(s, o, n, c, a, u, 0), o;
1425
+ return Ee(s, o, n, c, a, h, 0), o;
1425
1426
  }
1426
1427
  function Gn(e, t = 1 / 0, n = 0) {
1427
1428
  const { vertices: i, holeIndices: r, dim: s } = Qn(e), o = Hn(i, r, s);
@@ -1439,65 +1440,65 @@ function Fn(e, t, n, i) {
1439
1440
  var Kn = function(e, t, n, i, r, s, o, c) {
1440
1441
  const a = i[e * s + o], f = i[t * s + o], l = i[n * s + o];
1441
1442
  if (a < f && a < l) {
1442
- const u = a + c - ce(a, c);
1443
- if (u > a && u <= f && u <= l && (f !== u || f !== u))
1444
- return $e(u, e, t, n, a, f, l, i, r, s, o, c);
1443
+ const h = a + c - ce(a, c);
1444
+ if (h > a && h <= f && h <= l && (f !== h || f !== h))
1445
+ return $e(h, e, t, n, a, f, l, i, r, s, o, c);
1445
1446
  } else if (a > f && a > l) {
1446
- let u = ce(a, c);
1447
- u === 0 && (u = c);
1448
- const h = a - u;
1449
- if (h < a && h >= f && h >= l && (f !== h || f !== h))
1450
- return ke(h, e, t, n, a, f, l, i, r, s, o, c);
1447
+ let h = ce(a, c);
1448
+ h === 0 && (h = c);
1449
+ const u = a - h;
1450
+ if (u < a && u >= f && u >= l && (f !== u || f !== u))
1451
+ return ke(u, e, t, n, a, f, l, i, r, s, o, c);
1451
1452
  }
1452
1453
  if (f < a && f < l) {
1453
- const u = f + c - ce(f, c);
1454
- if (u > f && u <= l && u <= a && (a !== u || l !== u))
1455
- return $e(u, t, n, e, f, l, a, i, r, s, o, c);
1454
+ const h = f + c - ce(f, c);
1455
+ if (h > f && h <= l && h <= a && (a !== h || l !== h))
1456
+ return $e(h, t, n, e, f, l, a, i, r, s, o, c);
1456
1457
  } else if (f > a && f > l) {
1457
- let u = ce(f, c);
1458
- u === 0 && (u = c);
1459
- const h = f - u;
1460
- if (h < f && h >= l && h >= a && (a !== h || l !== h))
1461
- return ke(h, t, n, e, f, l, a, i, r, s, o, c);
1458
+ let h = ce(f, c);
1459
+ h === 0 && (h = c);
1460
+ const u = f - h;
1461
+ if (u < f && u >= l && u >= a && (a !== u || l !== u))
1462
+ return ke(u, t, n, e, f, l, a, i, r, s, o, c);
1462
1463
  }
1463
1464
  if (l < a && l < f) {
1464
- const u = l + c - ce(l, c);
1465
- if (u > l && u <= a && u <= f && (a !== u || f !== u))
1466
- return $e(u, n, e, t, l, a, f, i, r, s, o, c);
1465
+ const h = l + c - ce(l, c);
1466
+ if (h > l && h <= a && h <= f && (a !== h || f !== h))
1467
+ return $e(h, n, e, t, l, a, f, i, r, s, o, c);
1467
1468
  } else if (l > a && l > f) {
1468
- let u = ce(l, c);
1469
- u === 0 && (u = c);
1470
- const h = l - u;
1471
- if (h < l && h >= a && h >= f && (a !== h || f !== h))
1472
- return ke(h, n, e, t, l, a, f, i, r, s, o, c);
1469
+ let h = ce(l, c);
1470
+ h === 0 && (h = c);
1471
+ const u = l - h;
1472
+ if (u < l && u >= a && u >= f && (a !== u || f !== u))
1473
+ return ke(u, n, e, t, l, a, f, i, r, s, o, c);
1473
1474
  }
1474
1475
  }, F = function(e, t, n, i, r, s, o, c) {
1475
1476
  const a = s.length / o, f = (r - i) / (e - i);
1476
- let l, u;
1477
- for (let h = 0; h < o; h++)
1478
- l = s[t * o + h], u = s[n * o + h], h !== c ? s.push(l + (u - l) / f) : s.push(e);
1477
+ let l, h;
1478
+ for (let u = 0; u < o; u++)
1479
+ l = s[t * o + u], h = s[n * o + u], u !== c ? s.push(l + (h - l) / f) : s.push(e);
1479
1480
  return a;
1480
- }, $e = function(e, t, n, i, r, s, o, c, a, f, l, u) {
1481
- let h = F(e, t, n, r, s, c, f, l), d = F(e, t, i, r, o, c, f, l);
1482
- if (a.push(t, h, d), e += u, s < o) {
1481
+ }, $e = function(e, t, n, i, r, s, o, c, a, f, l, h) {
1482
+ let u = F(e, t, n, r, s, c, f, l), d = F(e, t, i, r, o, c, f, l);
1483
+ if (a.push(t, u, d), e += h, s < o) {
1483
1484
  for (; e < s; )
1484
- a.push(d, h), d = F(e, t, i, r, o, c, f, l), a.push(d, d, h), h = F(e, t, n, r, s, c, f, l), a.push(h), e += u;
1485
- return a.push(d, h, n), [d, n, i];
1485
+ a.push(d, u), d = F(e, t, i, r, o, c, f, l), a.push(d, d, u), u = F(e, t, n, r, s, c, f, l), a.push(u), e += h;
1486
+ return a.push(d, u, n), [d, n, i];
1486
1487
  } else {
1487
1488
  for (; e < o; )
1488
- a.push(d, h), d = F(e, t, i, r, o, c, f, l), a.push(d, d, h), h = F(e, t, n, r, s, c, f, l), a.push(h), e += u;
1489
- return a.push(d, h, i), [i, h, n];
1489
+ a.push(d, u), d = F(e, t, i, r, o, c, f, l), a.push(d, d, u), u = F(e, t, n, r, s, c, f, l), a.push(u), e += h;
1490
+ return a.push(d, u, i), [i, u, n];
1490
1491
  }
1491
- }, ke = function(e, t, n, i, r, s, o, c, a, f, l, u) {
1492
- let h = F(e, t, n, r, s, c, f, l), d = F(e, t, i, r, o, c, f, l);
1493
- if (a.push(t, h, d), e -= u, s > o) {
1492
+ }, ke = function(e, t, n, i, r, s, o, c, a, f, l, h) {
1493
+ let u = F(e, t, n, r, s, c, f, l), d = F(e, t, i, r, o, c, f, l);
1494
+ if (a.push(t, u, d), e -= h, s > o) {
1494
1495
  for (; e > s; )
1495
- a.push(d, h), d = F(e, t, i, r, o, c, f, l), a.push(d, d, h), h = F(e, t, n, r, s, c, f, l), a.push(h), e -= u;
1496
- return a.push(d, h, n), [d, n, i];
1496
+ a.push(d, u), d = F(e, t, i, r, o, c, f, l), a.push(d, d, u), u = F(e, t, n, r, s, c, f, l), a.push(u), e -= h;
1497
+ return a.push(d, u, n), [d, n, i];
1497
1498
  } else {
1498
1499
  for (; e > o; )
1499
- a.push(d, h), d = F(e, t, i, r, o, c, f, l), a.push(d, d, h), h = F(e, t, n, r, s, c, f, l), a.push(h), e -= u;
1500
- return a.push(d, h, i), [i, h, n];
1500
+ a.push(d, u), d = F(e, t, i, r, o, c, f, l), a.push(d, d, u), u = F(e, t, n, r, s, c, f, l), a.push(u), e -= h;
1501
+ return a.push(d, u, i), [i, u, n];
1501
1502
  }
1502
1503
  }, ce = function(e, t) {
1503
1504
  return (e % t + t) % t;
@@ -1553,7 +1554,7 @@ const Pi = (e, t = {}) => {
1553
1554
  positionBuffer: r,
1554
1555
  indexBuffer: s
1555
1556
  }), a = ({
1556
- viewport: { projection: h, modelView: d, camera: m, screen: _ },
1557
+ viewport: { projection: u, modelView: d, camera: m, screen: _ },
1557
1558
  depth: w = !1,
1558
1559
  index: x = 0
1559
1560
  }) => {
@@ -1561,7 +1562,7 @@ const Pi = (e, t = {}) => {
1561
1562
  if (f(), ge(n, w, t))
1562
1563
  return;
1563
1564
  (w ? c : o).execute({
1564
- projection: h,
1565
+ projection: u,
1565
1566
  modelView: d,
1566
1567
  camera: Q(m),
1567
1568
  screen: _,
@@ -1571,17 +1572,17 @@ const Pi = (e, t = {}) => {
1571
1572
  });
1572
1573
  }, f = me(
1573
1574
  () => t.points?.() ?? [],
1574
- (h) => {
1575
- const { vertices: d, indices: m } = h.length > 0 ? Gn(h.map((_) => _.map((w) => [...Q(L(w))]))) : { vertices: [], indices: [] };
1575
+ (u) => {
1576
+ const { vertices: d, indices: m } = u.length > 0 ? Gn(u.map((_) => _.map((w) => [...Q(L(w))]))) : { vertices: [], indices: [] };
1576
1577
  r.set(d), s.set(m), i = m.length;
1577
1578
  }
1578
1579
  ), l = () => {
1579
1580
  r.dispose(), s.dispose();
1580
- }, u = Ae(t);
1581
+ }, h = Ae(t);
1581
1582
  return {
1582
1583
  render: a,
1583
1584
  dispose: l,
1584
- ...u
1585
+ ...h
1585
1586
  };
1586
1587
  }, ei = ({ gl: e, programs: t }, {
1587
1588
  positionBuffer: n,
@@ -1593,17 +1594,17 @@ const Pi = (e, t = {}) => {
1593
1594
  fragmentSource: c ? Re : qn
1594
1595
  }), f = a.attribute3i("position", n, {
1595
1596
  stride: 3 * Int32Array.BYTES_PER_ELEMENT
1596
- }), l = a.uniformMatrix4f("projection"), u = a.uniformMatrix4f("model_view"), h = a.uniform3i("camera"), d = a.uniform2f("screen"), m = a.uniform4f("color"), _ = a.uniform1i("index");
1597
+ }), l = a.uniformMatrix4f("projection"), h = a.uniformMatrix4f("model_view"), u = a.uniform3i("camera"), d = a.uniform2f("screen"), m = a.uniform4f("color"), _ = a.uniform1i("index");
1597
1598
  return { execute: ({
1598
1599
  projection: x,
1599
1600
  modelView: A,
1600
- camera: p,
1601
- screen: v,
1602
- count: y,
1601
+ camera: v,
1602
+ screen: T,
1603
+ count: p,
1603
1604
  color: g,
1604
1605
  index: E
1605
1606
  }) => {
1606
- y !== 0 && (a.use(), f.use(), l.set(x), u.set(A), h.set(p), d.set(v), m.set(g), _.set(E), i.use(), e.drawElements(e.TRIANGLES, y, e.UNSIGNED_SHORT, 0));
1607
+ p !== 0 && (a.use(), f.use(), l.set(x), h.set(A), u.set(v), d.set(T), m.set(g), _.set(E), i.use(), e.drawElements(e.TRIANGLES, p, e.UNSIGNED_SHORT, 0));
1607
1608
  } };
1608
1609
  }, s = r(), o = r(!0);
1609
1610
  return { renderProgram: s, depthProgram: o };
@@ -1651,13 +1652,13 @@ if (typeof Xe > "u") {
1651
1652
  e && (e = !1, yt("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.", "NO_ABORT_CONTROLLER", "ENOTSUP", t));
1652
1653
  };
1653
1654
  }
1654
- const ti = (e) => !_t.has(e), q = (e) => e && e === Math.floor(e) && e > 0 && isFinite(e), wt = (e) => q(e) ? e <= Math.pow(2, 8) ? Uint8Array : e <= Math.pow(2, 16) ? Uint16Array : e <= Math.pow(2, 32) ? Uint32Array : e <= Number.MAX_SAFE_INTEGER ? De : null : null;
1655
- class De extends Array {
1655
+ const ti = (e) => !_t.has(e), q = (e) => e && e === Math.floor(e) && e > 0 && isFinite(e), wt = (e) => q(e) ? e <= Math.pow(2, 8) ? Uint8Array : e <= Math.pow(2, 16) ? Uint16Array : e <= Math.pow(2, 32) ? Uint32Array : e <= Number.MAX_SAFE_INTEGER ? Ie : null : null;
1656
+ class Ie extends Array {
1656
1657
  constructor(t) {
1657
1658
  super(t), this.fill(0);
1658
1659
  }
1659
1660
  }
1660
- class ue {
1661
+ class he {
1661
1662
  heap;
1662
1663
  length;
1663
1664
  // private constructor
@@ -1666,12 +1667,12 @@ class ue {
1666
1667
  const n = wt(t);
1667
1668
  if (!n)
1668
1669
  return [];
1669
- ue.#c = !0;
1670
- const i = new ue(t, n);
1671
- return ue.#c = !1, i;
1670
+ he.#c = !0;
1671
+ const i = new he(t, n);
1672
+ return he.#c = !1, i;
1672
1673
  }
1673
1674
  constructor(t, n) {
1674
- if (!ue.#c)
1675
+ if (!he.#c)
1675
1676
  throw new TypeError("instantiate Stack using Stack.create(n)");
1676
1677
  this.heap = new n(t), this.length = 0;
1677
1678
  }
@@ -1687,7 +1688,7 @@ class Qe {
1687
1688
  // really *need* to be protected. The rest can be modified, as they just
1688
1689
  // set defaults for various methods.
1689
1690
  #c;
1690
- #h;
1691
+ #u;
1691
1692
  #v;
1692
1693
  #p;
1693
1694
  #U;
@@ -1758,7 +1759,7 @@ class Qe {
1758
1759
  #n;
1759
1760
  #e;
1760
1761
  #f;
1761
- #u;
1762
+ #h;
1762
1763
  #a;
1763
1764
  #s;
1764
1765
  #E;
@@ -1788,7 +1789,7 @@ class Qe {
1788
1789
  keyList: t.#n,
1789
1790
  valList: t.#e,
1790
1791
  next: t.#f,
1791
- prev: t.#u,
1792
+ prev: t.#h,
1792
1793
  get head() {
1793
1794
  return t.#a;
1794
1795
  },
@@ -1799,7 +1800,7 @@ class Qe {
1799
1800
  // methods
1800
1801
  isBackgroundFetch: (n) => t.#t(n),
1801
1802
  backgroundFetch: (n, i, r, s) => t.#L(n, i, r, s),
1802
- moveToTail: (n) => t.#S(n),
1803
+ moveToTail: (n) => t.#b(n),
1803
1804
  indexes: (n) => t.#T(n),
1804
1805
  rindexes: (n) => t.#g(n),
1805
1806
  isStale: (n) => t.#m(n)
@@ -1816,7 +1817,7 @@ class Qe {
1816
1817
  * {@link LRUCache.OptionsBase.maxSize} (read-only)
1817
1818
  */
1818
1819
  get maxSize() {
1819
- return this.#h;
1820
+ return this.#u;
1820
1821
  }
1821
1822
  /**
1822
1823
  * The total computed size of items in the cache (read-only)
@@ -1849,22 +1850,22 @@ class Qe {
1849
1850
  return this.#p;
1850
1851
  }
1851
1852
  constructor(t) {
1852
- const { max: n = 0, ttl: i, ttlResolution: r = 1, ttlAutopurge: s, updateAgeOnGet: o, updateAgeOnHas: c, allowStale: a, dispose: f, disposeAfter: l, noDisposeOnSet: u, noUpdateTTL: h, maxSize: d = 0, maxEntrySize: m = 0, sizeCalculation: _, fetchMethod: w, noDeleteOnFetchRejection: x, noDeleteOnStaleGet: A, allowStaleOnFetchRejection: p, allowStaleOnFetchAbort: v, ignoreFetchAbort: y } = t;
1853
+ const { max: n = 0, ttl: i, ttlResolution: r = 1, ttlAutopurge: s, updateAgeOnGet: o, updateAgeOnHas: c, allowStale: a, dispose: f, disposeAfter: l, noDisposeOnSet: h, noUpdateTTL: u, maxSize: d = 0, maxEntrySize: m = 0, sizeCalculation: _, fetchMethod: w, noDeleteOnFetchRejection: x, noDeleteOnStaleGet: A, allowStaleOnFetchRejection: v, allowStaleOnFetchAbort: T, ignoreFetchAbort: p } = t;
1853
1854
  if (n !== 0 && !q(n))
1854
1855
  throw new TypeError("max option must be a nonnegative integer");
1855
1856
  const g = n ? wt(n) : Array;
1856
1857
  if (!g)
1857
1858
  throw new Error("invalid max value: " + n);
1858
- if (this.#c = n, this.#h = d, this.maxEntrySize = m || this.#h, this.sizeCalculation = _, this.sizeCalculation) {
1859
- if (!this.#h && !this.maxEntrySize)
1859
+ if (this.#c = n, this.#u = d, this.maxEntrySize = m || this.#u, this.sizeCalculation = _, this.sizeCalculation) {
1860
+ if (!this.#u && !this.maxEntrySize)
1860
1861
  throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
1861
1862
  if (typeof this.sizeCalculation != "function")
1862
1863
  throw new TypeError("sizeCalculation set to non-function");
1863
1864
  }
1864
1865
  if (w !== void 0 && typeof w != "function")
1865
1866
  throw new TypeError("fetchMethod must be a function if specified");
1866
- if (this.#U = w, this.#A = !!w, this.#i = /* @__PURE__ */ new Map(), this.#n = new Array(n).fill(void 0), this.#e = new Array(n).fill(void 0), this.#f = new g(n), this.#u = new g(n), this.#a = 0, this.#s = 0, this.#E = ue.create(n), this.#r = 0, this.#x = 0, typeof f == "function" && (this.#v = f), typeof l == "function" ? (this.#p = l, this.#o = []) : (this.#p = void 0, this.#o = void 0), this.#w = !!this.#v, this.#l = !!this.#p, this.noDisposeOnSet = !!u, this.noUpdateTTL = !!h, this.noDeleteOnFetchRejection = !!x, this.allowStaleOnFetchRejection = !!p, this.allowStaleOnFetchAbort = !!v, this.ignoreFetchAbort = !!y, this.maxEntrySize !== 0) {
1867
- if (this.#h !== 0 && !q(this.#h))
1867
+ if (this.#U = w, this.#A = !!w, this.#i = /* @__PURE__ */ new Map(), this.#n = new Array(n).fill(void 0), this.#e = new Array(n).fill(void 0), this.#f = new g(n), this.#h = new g(n), this.#a = 0, this.#s = 0, this.#E = he.create(n), this.#r = 0, this.#x = 0, typeof f == "function" && (this.#v = f), typeof l == "function" ? (this.#p = l, this.#o = []) : (this.#p = void 0, this.#o = void 0), this.#w = !!this.#v, this.#l = !!this.#p, this.noDisposeOnSet = !!h, this.noUpdateTTL = !!u, this.noDeleteOnFetchRejection = !!x, this.allowStaleOnFetchRejection = !!v, this.allowStaleOnFetchAbort = !!T, this.ignoreFetchAbort = !!p, this.maxEntrySize !== 0) {
1868
+ if (this.#u !== 0 && !q(this.#u))
1868
1869
  throw new TypeError("maxSize must be a positive integer if specified");
1869
1870
  if (!q(this.maxEntrySize))
1870
1871
  throw new TypeError("maxEntrySize must be a positive integer if specified");
@@ -1875,9 +1876,9 @@ class Qe {
1875
1876
  throw new TypeError("ttl must be a positive integer if specified");
1876
1877
  this.#N();
1877
1878
  }
1878
- if (this.#c === 0 && this.ttl === 0 && this.#h === 0)
1879
+ if (this.#c === 0 && this.ttl === 0 && this.#u === 0)
1879
1880
  throw new TypeError("At least one of max, maxSize, or ttl is required");
1880
- if (!this.ttlAutopurge && !this.#c && !this.#h) {
1881
+ if (!this.ttlAutopurge && !this.#c && !this.#u) {
1881
1882
  const E = "LRU_CACHE_UNBOUNDED";
1882
1883
  ti(E) && (_t.add(E), yt("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.", "UnboundedCacheWarning", E, Qe));
1883
1884
  }
@@ -1889,8 +1890,8 @@ class Qe {
1889
1890
  return this.#i.has(t) ? 1 / 0 : 0;
1890
1891
  }
1891
1892
  #N() {
1892
- const t = new De(this.#c), n = new De(this.#c);
1893
- this.#d = t, this.#y = n, this.#I = (s, o, c = fe.now()) => {
1893
+ const t = new Ie(this.#c), n = new Ie(this.#c);
1894
+ this.#d = t, this.#y = n, this.#D = (s, o, c = fe.now()) => {
1894
1895
  if (n[s] = o !== 0 ? c : 0, t[s] = o, o !== 0 && this.ttlAutopurge) {
1895
1896
  const a = setTimeout(() => {
1896
1897
  this.#m(s) && this.delete(this.#n[s]);
@@ -1938,15 +1939,15 @@ class Qe {
1938
1939
  };
1939
1940
  #R = () => {
1940
1941
  };
1941
- #I = () => {
1942
+ #D = () => {
1942
1943
  };
1943
1944
  /* c8 ignore stop */
1944
1945
  #m = () => !1;
1945
1946
  #X() {
1946
- const t = new De(this.#c);
1947
- this.#x = 0, this.#_ = t, this.#b = (n) => {
1947
+ const t = new Ie(this.#c);
1948
+ this.#x = 0, this.#_ = t, this.#S = (n) => {
1948
1949
  this.#x -= t[n], t[n] = 0;
1949
- }, this.#D = (n, i, r, s) => {
1950
+ }, this.#I = (n, i, r, s) => {
1950
1951
  if (this.#t(i))
1951
1952
  return 0;
1952
1953
  if (!q(r))
@@ -1959,19 +1960,19 @@ class Qe {
1959
1960
  throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");
1960
1961
  return r;
1961
1962
  }, this.#P = (n, i, r) => {
1962
- if (t[n] = i, this.#h) {
1963
- const s = this.#h - t[n];
1963
+ if (t[n] = i, this.#u) {
1964
+ const s = this.#u - t[n];
1964
1965
  for (; this.#x > s; )
1965
1966
  this.#z(!0);
1966
1967
  }
1967
1968
  this.#x += t[n], r && (r.entrySize = i, r.totalCalculatedSize = this.#x);
1968
1969
  };
1969
1970
  }
1970
- #b = (t) => {
1971
+ #S = (t) => {
1971
1972
  };
1972
1973
  #P = (t, n, i) => {
1973
1974
  };
1974
- #D = (t, n, i, r) => {
1975
+ #I = (t, n, i, r) => {
1975
1976
  if (i || r)
1976
1977
  throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");
1977
1978
  return 0;
@@ -1979,7 +1980,7 @@ class Qe {
1979
1980
  *#T({ allowStale: t = this.allowStale } = {}) {
1980
1981
  if (this.#r)
1981
1982
  for (let n = this.#s; !(!this.#O(n) || ((t || !this.#m(n)) && (yield n), n === this.#a)); )
1982
- n = this.#u[n];
1983
+ n = this.#h[n];
1983
1984
  }
1984
1985
  *#g({ allowStale: t = this.allowStale } = {}) {
1985
1986
  if (this.#r)
@@ -2171,34 +2172,34 @@ class Qe {
2171
2172
  return this.delete(t), this;
2172
2173
  const { ttl: r = this.ttl, start: s, noDisposeOnSet: o = this.noDisposeOnSet, sizeCalculation: c = this.sizeCalculation, status: a } = i;
2173
2174
  let { noUpdateTTL: f = this.noUpdateTTL } = i;
2174
- const l = this.#D(t, n, i.size || 0, c);
2175
+ const l = this.#I(t, n, i.size || 0, c);
2175
2176
  if (this.maxEntrySize && l > this.maxEntrySize)
2176
2177
  return a && (a.set = "miss", a.maxEntrySizeExceeded = !0), this.delete(t), this;
2177
- let u = this.#r === 0 ? void 0 : this.#i.get(t);
2178
- if (u === void 0)
2179
- u = this.#r === 0 ? this.#s : this.#E.length !== 0 ? this.#E.pop() : this.#r === this.#c ? this.#z(!1) : this.#r, this.#n[u] = t, this.#e[u] = n, this.#i.set(t, u), this.#f[this.#s] = u, this.#u[u] = this.#s, this.#s = u, this.#r++, this.#P(u, l, a), a && (a.set = "add"), f = !1;
2178
+ let h = this.#r === 0 ? void 0 : this.#i.get(t);
2179
+ if (h === void 0)
2180
+ h = this.#r === 0 ? this.#s : this.#E.length !== 0 ? this.#E.pop() : this.#r === this.#c ? this.#z(!1) : this.#r, this.#n[h] = t, this.#e[h] = n, this.#i.set(t, h), this.#f[this.#s] = h, this.#h[h] = this.#s, this.#s = h, this.#r++, this.#P(h, l, a), a && (a.set = "add"), f = !1;
2180
2181
  else {
2181
- this.#S(u);
2182
- const h = this.#e[u];
2183
- if (n !== h) {
2184
- if (this.#A && this.#t(h)) {
2185
- h.__abortController.abort(new Error("replaced"));
2186
- const { __staleWhileFetching: d } = h;
2182
+ this.#b(h);
2183
+ const u = this.#e[h];
2184
+ if (n !== u) {
2185
+ if (this.#A && this.#t(u)) {
2186
+ u.__abortController.abort(new Error("replaced"));
2187
+ const { __staleWhileFetching: d } = u;
2187
2188
  d !== void 0 && !o && (this.#w && this.#v?.(d, t, "set"), this.#l && this.#o?.push([d, t, "set"]));
2188
2189
  } else
2189
- o || (this.#w && this.#v?.(h, t, "set"), this.#l && this.#o?.push([h, t, "set"]));
2190
- if (this.#b(u), this.#P(u, l, a), this.#e[u] = n, a) {
2190
+ o || (this.#w && this.#v?.(u, t, "set"), this.#l && this.#o?.push([u, t, "set"]));
2191
+ if (this.#S(h), this.#P(h, l, a), this.#e[h] = n, a) {
2191
2192
  a.set = "replace";
2192
- const d = h && this.#t(h) ? h.__staleWhileFetching : h;
2193
+ const d = u && this.#t(u) ? u.__staleWhileFetching : u;
2193
2194
  d !== void 0 && (a.oldValue = d);
2194
2195
  }
2195
2196
  } else
2196
2197
  a && (a.set = "update");
2197
2198
  }
2198
- if (r !== 0 && !this.#d && this.#N(), this.#d && (f || this.#I(u, r, s), a && this.#R(a, u)), !o && this.#l && this.#o) {
2199
- const h = this.#o;
2199
+ if (r !== 0 && !this.#d && this.#N(), this.#d && (f || this.#D(h, r, s), a && this.#R(a, h)), !o && this.#l && this.#o) {
2200
+ const u = this.#o;
2200
2201
  let d;
2201
- for (; d = h?.shift(); )
2202
+ for (; d = u?.shift(); )
2202
2203
  this.#p?.(...d);
2203
2204
  }
2204
2205
  return this;
@@ -2228,7 +2229,7 @@ class Qe {
2228
2229
  }
2229
2230
  #z(t) {
2230
2231
  const n = this.#a, i = this.#n[n], r = this.#e[n];
2231
- return this.#A && this.#t(r) ? r.__abortController.abort(new Error("evicted")) : (this.#w || this.#l) && (this.#w && this.#v?.(r, i, "evict"), this.#l && this.#o?.push([r, i, "evict"])), this.#b(n), t && (this.#n[n] = void 0, this.#e[n] = void 0, this.#E.push(n)), this.#r === 1 ? (this.#a = this.#s = 0, this.#E.length = 0) : this.#a = this.#f[n], this.#i.delete(i), this.#r--, n;
2232
+ return this.#A && this.#t(r) ? r.__abortController.abort(new Error("evicted")) : (this.#w || this.#l) && (this.#w && this.#v?.(r, i, "evict"), this.#l && this.#o?.push([r, i, "evict"])), this.#S(n), t && (this.#n[n] = void 0, this.#e[n] = void 0, this.#E.push(n)), this.#r === 1 ? (this.#a = this.#s = 0, this.#E.length = 0) : this.#a = this.#f[n], this.#i.delete(i), this.#r--, n;
2232
2233
  }
2233
2234
  /**
2234
2235
  * Check if a key is in the cache, without updating the recency of use.
@@ -2281,23 +2282,23 @@ class Qe {
2281
2282
  }, f = (_, w = !1) => {
2282
2283
  const { aborted: x } = o.signal, A = i.ignoreFetchAbort && _ !== void 0;
2283
2284
  if (i.status && (x && !w ? (i.status.fetchAborted = !0, i.status.fetchError = o.signal.reason, A && (i.status.fetchAbortIgnored = !0)) : i.status.fetchResolved = !0), x && !A && !w)
2284
- return u(o.signal.reason);
2285
- const p = d;
2286
- return this.#e[n] === d && (_ === void 0 ? p.__staleWhileFetching ? this.#e[n] = p.__staleWhileFetching : this.delete(t) : (i.status && (i.status.fetchUpdated = !0), this.set(t, _, a.options))), _;
2287
- }, l = (_) => (i.status && (i.status.fetchRejected = !0, i.status.fetchError = _), u(_)), u = (_) => {
2288
- const { aborted: w } = o.signal, x = w && i.allowStaleOnFetchAbort, A = x || i.allowStaleOnFetchRejection, p = A || i.noDeleteOnFetchRejection, v = d;
2289
- if (this.#e[n] === d && (!p || v.__staleWhileFetching === void 0 ? this.delete(t) : x || (this.#e[n] = v.__staleWhileFetching)), A)
2290
- return i.status && v.__staleWhileFetching !== void 0 && (i.status.returnedStale = !0), v.__staleWhileFetching;
2291
- if (v.__returned === v)
2285
+ return h(o.signal.reason);
2286
+ const v = d;
2287
+ return this.#e[n] === d && (_ === void 0 ? v.__staleWhileFetching ? this.#e[n] = v.__staleWhileFetching : this.delete(t) : (i.status && (i.status.fetchUpdated = !0), this.set(t, _, a.options))), _;
2288
+ }, l = (_) => (i.status && (i.status.fetchRejected = !0, i.status.fetchError = _), h(_)), h = (_) => {
2289
+ const { aborted: w } = o.signal, x = w && i.allowStaleOnFetchAbort, A = x || i.allowStaleOnFetchRejection, v = A || i.noDeleteOnFetchRejection, T = d;
2290
+ if (this.#e[n] === d && (!v || T.__staleWhileFetching === void 0 ? this.delete(t) : x || (this.#e[n] = T.__staleWhileFetching)), A)
2291
+ return i.status && T.__staleWhileFetching !== void 0 && (i.status.returnedStale = !0), T.__staleWhileFetching;
2292
+ if (T.__returned === T)
2292
2293
  throw _;
2293
- }, h = (_, w) => {
2294
+ }, u = (_, w) => {
2294
2295
  const x = this.#U?.(t, s, a);
2295
2296
  x && x instanceof Promise && x.then((A) => _(A === void 0 ? void 0 : A), w), o.signal.addEventListener("abort", () => {
2296
2297
  (!i.ignoreFetchAbort || i.allowStaleOnFetchAbort) && (_(void 0), i.allowStaleOnFetchAbort && (_ = (A) => f(A, !0)));
2297
2298
  });
2298
2299
  };
2299
2300
  i.status && (i.status.fetchDispatched = !0);
2300
- const d = new Promise(h).then(f, l), m = Object.assign(d, {
2301
+ const d = new Promise(u).then(f, l), m = Object.assign(d, {
2301
2302
  __abortController: o,
2302
2303
  __staleWhileFetching: s,
2303
2304
  __returned: void 0
@@ -2323,8 +2324,8 @@ class Qe {
2323
2324
  sizeCalculation: f = this.sizeCalculation,
2324
2325
  noUpdateTTL: l = this.noUpdateTTL,
2325
2326
  // fetch exclusive options
2326
- noDeleteOnFetchRejection: u = this.noDeleteOnFetchRejection,
2327
- allowStaleOnFetchRejection: h = this.allowStaleOnFetchRejection,
2327
+ noDeleteOnFetchRejection: h = this.noDeleteOnFetchRejection,
2328
+ allowStaleOnFetchRejection: u = this.allowStaleOnFetchRejection,
2328
2329
  ignoreFetchAbort: d = this.ignoreFetchAbort,
2329
2330
  allowStaleOnFetchAbort: m = this.allowStaleOnFetchAbort,
2330
2331
  context: _,
@@ -2339,7 +2340,7 @@ class Qe {
2339
2340
  noDeleteOnStaleGet: s,
2340
2341
  status: x
2341
2342
  });
2342
- const p = {
2343
+ const v = {
2343
2344
  allowStale: i,
2344
2345
  updateAgeOnGet: r,
2345
2346
  noDeleteOnStaleGet: s,
@@ -2348,28 +2349,28 @@ class Qe {
2348
2349
  size: a,
2349
2350
  sizeCalculation: f,
2350
2351
  noUpdateTTL: l,
2351
- noDeleteOnFetchRejection: u,
2352
- allowStaleOnFetchRejection: h,
2352
+ noDeleteOnFetchRejection: h,
2353
+ allowStaleOnFetchRejection: u,
2353
2354
  allowStaleOnFetchAbort: m,
2354
2355
  ignoreFetchAbort: d,
2355
2356
  status: x,
2356
2357
  signal: A
2357
2358
  };
2358
- let v = this.#i.get(t);
2359
- if (v === void 0) {
2359
+ let T = this.#i.get(t);
2360
+ if (T === void 0) {
2360
2361
  x && (x.fetch = "miss");
2361
- const y = this.#L(t, v, p, _);
2362
- return y.__returned = y;
2362
+ const p = this.#L(t, T, v, _);
2363
+ return p.__returned = p;
2363
2364
  } else {
2364
- const y = this.#e[v];
2365
- if (this.#t(y)) {
2366
- const M = i && y.__staleWhileFetching !== void 0;
2367
- return x && (x.fetch = "inflight", M && (x.returnedStale = !0)), M ? y.__staleWhileFetching : y.__returned = y;
2365
+ const p = this.#e[T];
2366
+ if (this.#t(p)) {
2367
+ const M = i && p.__staleWhileFetching !== void 0;
2368
+ return x && (x.fetch = "inflight", M && (x.returnedStale = !0)), M ? p.__staleWhileFetching : p.__returned = p;
2368
2369
  }
2369
- const g = this.#m(v);
2370
+ const g = this.#m(T);
2370
2371
  if (!w && !g)
2371
- return x && (x.fetch = "hit"), this.#S(v), r && this.#M(v), x && this.#R(x, v), y;
2372
- const E = this.#L(t, v, p, _), R = E.__staleWhileFetching !== void 0 && i;
2372
+ return x && (x.fetch = "hit"), this.#b(T), r && this.#M(T), x && this.#R(x, T), p;
2373
+ const E = this.#L(t, T, v, _), R = E.__staleWhileFetching !== void 0 && i;
2373
2374
  return x && (x.fetch = g ? "stale" : "refresh", R && g && (x.returnedStale = !0)), R ? E.__staleWhileFetching : E.__returned = E;
2374
2375
  }
2375
2376
  }
@@ -2383,15 +2384,15 @@ class Qe {
2383
2384
  const { allowStale: i = this.allowStale, updateAgeOnGet: r = this.updateAgeOnGet, noDeleteOnStaleGet: s = this.noDeleteOnStaleGet, status: o } = n, c = this.#i.get(t);
2384
2385
  if (c !== void 0) {
2385
2386
  const a = this.#e[c], f = this.#t(a);
2386
- return o && this.#R(o, c), this.#m(c) ? (o && (o.get = "stale"), f ? (o && i && a.__staleWhileFetching !== void 0 && (o.returnedStale = !0), i ? a.__staleWhileFetching : void 0) : (s || this.delete(t), o && i && (o.returnedStale = !0), i ? a : void 0)) : (o && (o.get = "hit"), f ? a.__staleWhileFetching : (this.#S(c), r && this.#M(c), a));
2387
+ return o && this.#R(o, c), this.#m(c) ? (o && (o.get = "stale"), f ? (o && i && a.__staleWhileFetching !== void 0 && (o.returnedStale = !0), i ? a.__staleWhileFetching : void 0) : (s || this.delete(t), o && i && (o.returnedStale = !0), i ? a : void 0)) : (o && (o.get = "hit"), f ? a.__staleWhileFetching : (this.#b(c), r && this.#M(c), a));
2387
2388
  } else
2388
2389
  o && (o.get = "miss");
2389
2390
  }
2390
2391
  #C(t, n) {
2391
- this.#u[n] = t, this.#f[t] = n;
2392
+ this.#h[n] = t, this.#f[t] = n;
2392
2393
  }
2393
- #S(t) {
2394
- t !== this.#s && (t === this.#a ? this.#a = this.#f[t] : this.#C(this.#u[t], this.#f[t]), this.#C(this.#s, t), this.#s = t);
2394
+ #b(t) {
2395
+ t !== this.#s && (t === this.#a ? this.#a = this.#f[t] : this.#C(this.#h[t], this.#f[t]), this.#C(this.#s, t), this.#s = t);
2395
2396
  }
2396
2397
  /**
2397
2398
  * Deletes a key out of the cache.
@@ -2405,17 +2406,17 @@ class Qe {
2405
2406
  if (n = !0, this.#r === 1)
2406
2407
  this.clear();
2407
2408
  else {
2408
- this.#b(i);
2409
+ this.#S(i);
2409
2410
  const r = this.#e[i];
2410
2411
  if (this.#t(r) ? r.__abortController.abort(new Error("deleted")) : (this.#w || this.#l) && (this.#w && this.#v?.(r, t, "delete"), this.#l && this.#o?.push([r, t, "delete"])), this.#i.delete(t), this.#n[i] = void 0, this.#e[i] = void 0, i === this.#s)
2411
- this.#s = this.#u[i];
2412
+ this.#s = this.#h[i];
2412
2413
  else if (i === this.#a)
2413
2414
  this.#a = this.#f[i];
2414
2415
  else {
2415
- const s = this.#u[i];
2416
+ const s = this.#h[i];
2416
2417
  this.#f[s] = this.#f[i];
2417
2418
  const o = this.#f[i];
2418
- this.#u[o] = this.#u[i];
2419
+ this.#h[o] = this.#h[i];
2419
2420
  }
2420
2421
  this.#r--, this.#E.push(i);
2421
2422
  }
@@ -2477,25 +2478,25 @@ const We = (e) => {
2477
2478
  if (!r)
2478
2479
  throw new Error("Framebuffer creation failed");
2479
2480
  const s = ([a = 0, f = 0, l = 0]) => {
2480
- const u = i.get([a, f, l]);
2481
- if (!u)
2481
+ const h = i.get([a, f, l]);
2482
+ if (!h)
2482
2483
  return;
2483
- const { texture: h, downsample: d } = u, m = 2 ** d, _ = [Math.floor(a / m), Math.floor(f / m), l - d], w = n.get(_);
2484
+ const { texture: u, downsample: d } = h, m = 2 ** d, _ = [Math.floor(a / m), Math.floor(f / m), l - d], w = n.get(_);
2484
2485
  if (w)
2485
2486
  return { buffer: w, downsample: d };
2486
2487
  const x = new Uint8Array(4 * te * te);
2487
- return e.bindFramebuffer(e.FRAMEBUFFER, r), h.attach(), e.readPixels(0, 0, te, te, e.RGBA, e.UNSIGNED_BYTE, x), e.bindFramebuffer(e.FRAMEBUFFER, null), n.set(_, x), { buffer: x, downsample: d };
2488
+ return e.bindFramebuffer(e.FRAMEBUFFER, r), u.attach(), e.readPixels(0, 0, te, te, e.RGBA, e.UNSIGNED_BYTE, x), e.bindFramebuffer(e.FRAMEBUFFER, null), n.set(_, x), { buffer: x, downsample: d };
2488
2489
  };
2489
2490
  return { get: ([a = 0, f = 0], l = ni) => {
2490
- const u = 2 ** l, h = L([a, f, 0]).map((M) => M * u), [d = 0, m = 0] = h.map((M) => Math.floor(M % u));
2491
- let [_ = 0, w = 0] = h.map((M) => M % 1);
2491
+ const h = 2 ** l, u = L([a, f, 0]).map((M) => M * h), [d = 0, m = 0] = u.map((M) => Math.floor(M % h));
2492
+ let [_ = 0, w = 0] = u.map((M) => M % 1);
2492
2493
  const x = s([d, m, l]);
2493
2494
  if (!x)
2494
2495
  return 0;
2495
- const { buffer: A, downsample: p } = x, v = 2 ** p;
2496
- [_, w] = [(d % v + _) / v, (m % v + w) / v];
2497
- const y = 4 * te * Math.floor(w * te) + 4 * Math.floor(_ * te), [g = 0, E = 0, T = 0] = A.slice(y, y + 4);
2498
- return (g * 65536 + E * 256 + T) / 10 - 1e4;
2496
+ const { buffer: A, downsample: v } = x, T = 2 ** v;
2497
+ [_, w] = [(d % T + _) / T, (m % T + w) / T];
2498
+ const p = 4 * te * Math.floor(w * te) + 4 * Math.floor(_ * te), [g = 0, E = 0, y = 0] = A.slice(p, p + 4);
2499
+ return (g * 65536 + E * 256 + y) / 10 - 1e4;
2499
2500
  }, dispose: () => {
2500
2501
  e.deleteFramebuffer(r);
2501
2502
  } };
@@ -2534,7 +2535,7 @@ const lt = ({
2534
2535
  return r.delete(a), f;
2535
2536
  r.set(a, !0);
2536
2537
  } else {
2537
- const [l, u, h] = a, d = t.replace("{x}", `${l}`).replace("{y}", `${u}`).replace("{z}", `${h}`), m = vt({
2538
+ const [l, h, u] = a, d = t.replace("{x}", `${l}`).replace("{y}", `${h}`).replace("{z}", `${u}`), m = vt({
2538
2539
  gl: e,
2539
2540
  url: d,
2540
2541
  onLoad: () => {
@@ -2561,10 +2562,10 @@ const lt = ({
2561
2562
  const s = t.get(r);
2562
2563
  if (s)
2563
2564
  return s;
2564
- const [o = 0, c = 0, a = 0] = r, f = n.map(([l = 0, u = 0]) => [o + l, c + u, a]).map((l) => vn(l, l)).map((l) => se(l, l)).map((l) => {
2565
- const [u = 0, h = 0] = l, d = Math.max(a - 5, 0);
2565
+ const [o = 0, c = 0, a = 0] = r, f = n.map(([l = 0, h = 0]) => [o + l, c + h, a]).map((l) => vn(l, l)).map((l) => se(l, l)).map((l) => {
2566
+ const [h = 0, u = 0] = l, d = Math.max(a - 5, 0);
2566
2567
  return L(
2567
- we(l, u, h, e.get([u, h], d)),
2568
+ we(l, h, u, e.get([h, u], d)),
2568
2569
  l
2569
2570
  );
2570
2571
  });
@@ -2632,14 +2633,14 @@ const B = 34, ai = 22, ci = ie(0, B).flatMap(
2632
2633
  gl: n,
2633
2634
  urlPattern: E,
2634
2635
  onLoad: () => {
2635
- const T = n.getExtension("EXT_texture_filter_anisotropic");
2636
- if (T) {
2636
+ const y = n.getExtension("EXT_texture_filter_anisotropic");
2637
+ if (y) {
2637
2638
  const R = n.getParameter(
2638
- T.MAX_TEXTURE_MAX_ANISOTROPY_EXT
2639
+ y.MAX_TEXTURE_MAX_ANISOTROPY_EXT
2639
2640
  );
2640
2641
  n.texParameterf(
2641
2642
  n.TEXTURE_2D,
2642
- T.TEXTURE_MAX_ANISOTROPY_EXT,
2643
+ y.TEXTURE_MAX_ANISOTROPY_EXT,
2643
2644
  R
2644
2645
  );
2645
2646
  }
@@ -2657,50 +2658,50 @@ const B = 34, ai = 22, ci = ie(0, B).flatMap(
2657
2658
  onLoad: () => {
2658
2659
  n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MIN_FILTER, n.NEAREST), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MAG_FILTER, n.NEAREST), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_S, n.CLAMP_TO_EDGE), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_T, n.CLAMP_TO_EDGE);
2659
2660
  }
2660
- }), a = Fe(c, 3), f = ii({ gl: n, terrainCache: c }), l = si(f), u = V({ gl: n, type: "f32", target: "array" });
2661
- u.set(fi.flatMap(([E = 0, T = 0, R = 0]) => [E, T, R]));
2662
- const h = V({ gl: n, type: "u16", target: "element" });
2663
- h.set(ci);
2661
+ }), a = Fe(c, 3), f = ii({ gl: n, terrainCache: c }), l = si(f), h = V({ gl: n, type: "f32", target: "array" });
2662
+ h.set(fi.flatMap(([E = 0, y = 0, R = 0]) => [E, y, R]));
2663
+ const u = V({ gl: n, type: "u16", target: "element" });
2664
+ u.set(ci);
2664
2665
  const { renderProgram: d, depthProgram: m } = li(e, {
2665
- uvwBuffer: u,
2666
- indexBuffer: h
2667
- }), _ = [0, 1, 2, 3], w = _.map(z), x = _.map(ee), A = _.map(de), p = (E) => {
2668
- const { camera: T, worldToLocal: R, localToClip: M, clipToScreen: b } = E, P = (U) => {
2669
- const [S = 0, N = 0, D = 0] = U, j = l.get(U);
2670
- let X = hi(T, j);
2666
+ uvwBuffer: h,
2667
+ indexBuffer: u
2668
+ }), _ = [0, 1, 2, 3], w = _.map(z), x = _.map(ee), A = _.map(de), v = (E) => {
2669
+ const { camera: y, worldToLocal: R, localToClip: M, clipToScreen: b } = E, P = (U) => {
2670
+ const [S = 0, N = 0, I = 0] = U, j = l.get(U);
2671
+ let X = ui(y, j);
2671
2672
  if (!X) {
2672
2673
  const C = j.map((Z, $) => R(Z, w[$])).map((Z, $) => M(Z, x[$]));
2673
- if (ui(C))
2674
+ if (hi(C))
2674
2675
  return [];
2675
2676
  X = di(C.map((Z, $) => b(Z, A[$]))) > 512 / devicePixelRatio;
2676
2677
  }
2677
- return X && D < ai ? [
2678
- [2 * S, 2 * N, D + 1],
2679
- [2 * S + 1, 2 * N, D + 1],
2680
- [2 * S, 2 * N + 1, D + 1],
2681
- [2 * S + 1, 2 * N + 1, D + 1]
2678
+ return X && I < ai ? [
2679
+ [2 * S, 2 * N, I + 1],
2680
+ [2 * S + 1, 2 * N, I + 1],
2681
+ [2 * S, 2 * N + 1, I + 1],
2682
+ [2 * S + 1, 2 * N + 1, I + 1]
2682
2683
  ].flatMap((G) => P(G)) : [U];
2683
2684
  };
2684
2685
  return P([0, 0, 0]);
2685
- }, v = ({
2686
+ }, T = ({
2686
2687
  viewport: E,
2687
- depth: T = !1,
2688
+ depth: y = !1,
2688
2689
  index: R = 0
2689
2690
  }) => {
2690
2691
  const M = t.color?.() ?? [1, 1, 1, 1];
2691
- if (s(), ge(n, T, t))
2692
+ if (s(), ge(n, y, t))
2692
2693
  return;
2693
- const b = T ? m : d, { projection: P, modelView: U, camera: S } = E, N = p(E);
2694
- for (const D of N) {
2695
- const j = T ? void 0 : r?.get(D), X = a.get(D);
2696
- if (!T && !j || !X)
2694
+ const b = y ? m : d, { projection: P, modelView: U, camera: S } = E, N = v(E);
2695
+ for (const I of N) {
2696
+ const j = y ? void 0 : r?.get(I), X = a.get(I);
2697
+ if (!y && !j || !X)
2697
2698
  continue;
2698
2699
  const { texture: C, downsample: G } = X, { texture: Z = C, downsample: $ = 0 } = j ?? {};
2699
2700
  b.execute({
2700
2701
  projection: P,
2701
2702
  modelView: U,
2702
2703
  camera: Q(S),
2703
- xyz: D,
2704
+ xyz: I,
2704
2705
  imagery: Z,
2705
2706
  terrain: C,
2706
2707
  downsampleImagery: $,
@@ -2709,12 +2710,12 @@ const B = 34, ai = 22, ci = ie(0, B).flatMap(
2709
2710
  index: R
2710
2711
  });
2711
2712
  }
2712
- }, y = () => {
2713
+ }, p = () => {
2713
2714
  i?.dispose(), c.dispose(), f.dispose();
2714
2715
  }, g = Ae(t);
2715
2716
  return {
2716
- render: v,
2717
- dispose: y,
2717
+ render: T,
2718
+ dispose: p,
2718
2719
  ...g
2719
2720
  };
2720
2721
  }, li = ({ gl: e, programs: t }, { uvwBuffer: n, indexBuffer: i }) => {
@@ -2722,12 +2723,12 @@ const B = 34, ai = 22, ci = ie(0, B).flatMap(
2722
2723
  const a = t.get({
2723
2724
  vertexSource: oi,
2724
2725
  fragmentSource: c ? Re : ri
2725
- }), f = a.attribute3f("uvw", n), l = a.uniformMatrix4f("projection"), u = a.uniformMatrix4f("model_view"), h = a.uniform1i("imagery"), d = a.uniform1i("terrain"), m = a.uniform1i("downsample_imagery"), _ = a.uniform1i("downsample_terrain"), w = a.uniform4f("color"), x = a.uniform3i("xyz"), A = a.uniform3i("camera"), p = a.uniform1i("index");
2726
+ }), f = a.attribute3f("uvw", n), l = a.uniformMatrix4f("projection"), h = a.uniformMatrix4f("model_view"), u = a.uniform1i("imagery"), d = a.uniform1i("terrain"), m = a.uniform1i("downsample_imagery"), _ = a.uniform1i("downsample_terrain"), w = a.uniform4f("color"), x = a.uniform3i("xyz"), A = a.uniform3i("camera"), v = a.uniform1i("index");
2726
2727
  return { execute: ({
2727
- projection: y,
2728
+ projection: p,
2728
2729
  modelView: g,
2729
2730
  camera: E,
2730
- xyz: T,
2731
+ xyz: y,
2731
2732
  imagery: R,
2732
2733
  terrain: M,
2733
2734
  downsampleImagery: b,
@@ -2735,29 +2736,29 @@ const B = 34, ai = 22, ci = ie(0, B).flatMap(
2735
2736
  color: U,
2736
2737
  index: S
2737
2738
  }) => {
2738
- a.use(), f.use(), l.set(y), u.set(g), x.set(T), A.set(E), m.set(b), _.set(P), w.set(U), p.set(S), e.activeTexture(e.TEXTURE0), h.set(0), R.use(), e.activeTexture(e.TEXTURE1), d.set(1), M.use(), i.use(), e.drawElements(e.TRIANGLES, B * B * 2 * 3, e.UNSIGNED_SHORT, 0);
2739
+ a.use(), f.use(), l.set(p), h.set(g), x.set(y), A.set(E), m.set(b), _.set(P), w.set(U), v.set(S), e.activeTexture(e.TEXTURE0), u.set(0), R.use(), e.activeTexture(e.TEXTURE1), d.set(1), M.use(), i.use(), e.drawElements(e.TRIANGLES, B * B * 2 * 3, e.UNSIGNED_SHORT, 0);
2739
2740
  } };
2740
2741
  }, s = r(), o = r(!0);
2741
2742
  return { renderProgram: s, depthProgram: o };
2742
- }, hi = (e, t) => {
2743
+ }, ui = (e, t) => {
2743
2744
  const [n, i, r, s] = t.reduce(
2744
- ([f, l, u, h], [d = 0, m = 0]) => [
2745
+ ([f, l, h, u], [d = 0, m = 0]) => [
2745
2746
  Math.min(d, f),
2746
2747
  Math.max(d, l),
2747
- Math.min(m, u),
2748
- Math.max(m, h)
2748
+ Math.min(m, h),
2749
+ Math.max(m, u)
2749
2750
  ],
2750
2751
  [1, 0, 1, 0]
2751
2752
  ), [o = 0, c = 0, a = 0] = e;
2752
2753
  return o > n && o < i && c > r && c < s && a > 0 && a < i - n;
2753
- }, ui = (e) => e.every(([t = 0, , , n = 0]) => t > n) || e.every(([t = 0, , , n = 0]) => t < -n) || e.every(([, t = 0, , n = 0]) => t > n) || e.every(([, t = 0, , n = 0]) => t < -n) || e.every(([, , t = 0, n = 0]) => t > n) || e.every(([, , t = 0, n = 0]) => t < -n) || e.every(([, , , t = 0]) => t < 0), di = (e) => Math.sqrt(
2754
+ }, hi = (e) => e.every(([t = 0, , , n = 0]) => t > n) || e.every(([t = 0, , , n = 0]) => t < -n) || e.every(([, t = 0, , n = 0]) => t > n) || e.every(([, t = 0, , n = 0]) => t < -n) || e.every(([, , t = 0, n = 0]) => t > n) || e.every(([, , t = 0, n = 0]) => t < -n) || e.every(([, , , t = 0]) => t < 0), di = (e) => Math.sqrt(
2754
2755
  e.map(
2755
- (t, n) => hn(
2756
+ (t, n) => un(
2756
2757
  e[n] ?? [0, 0],
2757
2758
  e[(n + 1) % e.length] ?? [0, 0]
2758
2759
  )
2759
2760
  ).reduce((t, n) => t + n, 0) / e.length
2760
- ), Ii = {
2761
+ ), Di = {
2761
2762
  pickable: !0,
2762
2763
  depth: !0,
2763
2764
  polygonOffset: 0
@@ -2811,11 +2812,11 @@ const B = 34, ai = 22, ci = ie(0, B).flatMap(
2811
2812
  t,
2812
2813
  fn(
2813
2814
  de(),
2814
- un(de(), n, t),
2815
+ hn(de(), n, t),
2815
2816
  1 - Math.exp(-Be * e)
2816
2817
  )
2817
2818
  ), t)
2818
- ), Di = ae(
2819
+ ), Ii = ae(
2819
2820
  ({ time: e, current: t, target: n }) => (Kt(t, n) < Me ? kt(t, n) : t = Ht(
2820
2821
  ee(),
2821
2822
  t,
@@ -2883,17 +2884,17 @@ const B = 34, ai = 22, ci = ie(0, B).flatMap(
2883
2884
  ({ time: e, current: t, target: n }) => (t = pn(
2884
2885
  Ne(
2885
2886
  He(),
2886
- Se(t),
2887
- Se(n),
2887
+ be(t),
2888
+ be(n),
2888
2889
  Math.PI * e
2889
2890
  )
2890
- ), tn(Se(t), Se(n)) < Me && (n = t), t)
2891
+ ), tn(be(t), be(n)) < Me && (n = t), t)
2891
2892
  ), Ei = 10, Xi = (e) => {
2892
2893
  const t = xi(() => e().orientation), n = pi(() => e().offset), i = vi(() => e().fieldOfView);
2893
2894
  return ae(({ time: s, current: o, target: c }) => {
2894
- const a = Te(L(o.target), L(c.target)) * H, f = Math.max(c.distance, a), l = 1 - Math.exp(-Ei * s), u = Math.exp(
2895
+ const a = Te(L(o.target), L(c.target)) * H, f = Math.max(c.distance, a), l = 1 - Math.exp(-Ei * s), h = Math.exp(
2895
2896
  Math.log(o.distance) + (Math.log(f) - Math.log(o.distance)) * l
2896
- ), h = o.distance > a ? 1 : o.distance / a, d = se(
2897
+ ), u = o.distance > a ? 1 : o.distance / a, d = se(
2897
2898
  ne(
2898
2899
  z(),
2899
2900
  L(o.target),
@@ -2904,14 +2905,14 @@ const B = 34, ai = 22, ci = ie(0, B).flatMap(
2904
2905
  L(c.target),
2905
2906
  L(o.target)
2906
2907
  ),
2907
- l * h
2908
+ l * u
2908
2909
  )
2909
2910
  )
2910
2911
  );
2911
2912
  return {
2912
2913
  ...o,
2913
2914
  target: d,
2914
- distance: u,
2915
+ distance: h,
2915
2916
  orientation: t(),
2916
2917
  offset: n(),
2917
2918
  fieldOfView: i()
@@ -2936,8 +2937,8 @@ const B = 34, ai = 22, ci = ie(0, B).flatMap(
2936
2937
  n
2937
2938
  ), e.bindFramebuffer(e.FRAMEBUFFER, null);
2938
2939
  let s = 0;
2939
- const o = ([l = 0, u = 0]) => {
2940
- s = u, e.bindTexture(e.TEXTURE_2D, t), e.texImage2D(
2940
+ const o = ([l = 0, h = 0]) => {
2941
+ s = h, e.bindTexture(e.TEXTURE_2D, t), e.texImage2D(
2941
2942
  e.TEXTURE_2D,
2942
2943
  0,
2943
2944
  e.RGBA,
@@ -2957,9 +2958,9 @@ const B = 34, ai = 22, ci = ie(0, B).flatMap(
2957
2958
  return {
2958
2959
  use: r,
2959
2960
  resize: o,
2960
- read: ([l = 0, u = 0]) => {
2961
- r(), e.readPixels(l, s - u, 1, 1, e.RGBA, e.UNSIGNED_BYTE, c), e.bindFramebuffer(e.FRAMEBUFFER, null);
2962
- const [h = 0, d = 0, m = 0, _ = 0] = c, x = 2 * ((h * 256 + d) / (256 * 256 - 1)) - 1, A = m * 256 + _;
2961
+ read: ([l = 0, h = 0]) => {
2962
+ r(), e.readPixels(l, s - h, 1, 1, e.RGBA, e.UNSIGNED_BYTE, c), e.bindFramebuffer(e.FRAMEBUFFER, null);
2963
+ const [u = 0, d = 0, m = 0, _ = 0] = c, x = 2 * ((u * 256 + d) / (256 * 256 - 1)) - 1, A = m * 256 + _;
2963
2964
  return [x, A];
2964
2965
  },
2965
2966
  dispose: () => {
@@ -2978,84 +2979,84 @@ const B = 34, ai = 22, ci = ie(0, B).flatMap(
2978
2979
  }, f = ({ x: m, y: _, movementX: w, movementY: x }) => {
2979
2980
  if (o) {
2980
2981
  if (o.onDrag) {
2981
- const { point: A, position: p, layer: v } = i([m, _], { terrain: !0 });
2982
- o.onDrag({ point: A, position: p, layer: v });
2982
+ const { point: A, position: v, layer: T } = i([m, _], { terrain: !0 });
2983
+ o.onDrag({ point: A, position: v, layer: T });
2983
2984
  }
2984
2985
  if (o.onDragFlat) {
2985
- const p = J(t(), n()).unproject([m, _], { targetZ: c });
2986
- o.onDragFlat({ point: [m, _], position: p, layer: void 0 });
2986
+ const v = J(t(), n()).unproject([m, _], { targetZ: c });
2987
+ o.onDragFlat({ point: [m, _], position: v, layer: void 0 });
2987
2988
  }
2988
2989
  return;
2989
2990
  }
2990
2991
  if (s && (Math.abs(w) > 1 || Math.abs(x) > 1)) {
2991
2992
  s = !1;
2992
- const { point: A, position: p, layer: v } = i([m, _]);
2993
- (v?.onDrag || v?.onDragFlat) && (o = v, o.onDragStart?.({ point: A, position: p, layer: v }), [, , c] = p);
2993
+ const { point: A, position: v, layer: T } = i([m, _]);
2994
+ (T?.onDrag || T?.onDragFlat) && (o = T, o.onDragStart?.({ point: A, position: v, layer: T }), [, , c] = v);
2994
2995
  }
2995
2996
  }, l = (m) => {
2996
- if (s && u(m), s = !1, o) {
2997
- const { x: _, y: w } = m, { point: x, position: A, layer: p } = i([_, w]);
2998
- o.onDragEnd?.({ point: x, position: A, layer: p });
2997
+ if (s && h(m), s = !1, o) {
2998
+ const { x: _, y: w } = m, { point: x, position: A, layer: v } = i([_, w]);
2999
+ o.onDragEnd?.({ point: x, position: A, layer: v });
2999
3000
  }
3000
3001
  o = void 0;
3001
- }, u = ({ x: m, y: _, button: w }) => {
3002
- const { point: x, position: A, layer: p } = i([m, _]);
3003
- (w === 2 ? p?.onRightClick : p?.onClick)?.({
3002
+ }, h = ({ x: m, y: _, button: w }) => {
3003
+ const { point: x, position: A, layer: v } = i([m, _]);
3004
+ (w === 2 ? v?.onRightClick : v?.onClick)?.({
3004
3005
  point: x,
3005
3006
  position: A,
3006
- layer: p
3007
+ layer: v
3007
3008
  });
3008
- }, h = ({ x: m, y: _ }) => {
3009
+ }, u = ({ x: m, y: _ }) => {
3009
3010
  const { point: w, position: x, layer: A } = i([m, _]);
3010
3011
  A?.onDoubleClick?.({ point: w, position: x, layer: A });
3011
3012
  };
3012
- return r?.addEventListener("mousedown", a), r?.addEventListener("mousemove", f), r?.addEventListener("dblclick", h), window.addEventListener("mouseup", l), { dispose: () => {
3013
- r?.removeEventListener("mousedown", a), r?.removeEventListener("mousemove", f), r?.removeEventListener("dblclick", h), window.removeEventListener("mouseup", l);
3013
+ return r?.addEventListener("mousedown", a), r?.addEventListener("mousemove", f), r?.addEventListener("dblclick", u), window.addEventListener("mouseup", l), { dispose: () => {
3014
+ r?.removeEventListener("mousedown", a), r?.removeEventListener("mousemove", f), r?.removeEventListener("dblclick", u), window.removeEventListener("mouseup", l);
3014
3015
  } };
3015
3016
  };
3016
- St(Array);
3017
+ bt(Array);
3017
3018
  const Wi = ({ gl: e }, t) => {
3018
3019
  const { view: n, layers: i } = t;
3019
3020
  let r = !0, s = [0, 0];
3020
3021
  e.enable(e.CULL_FACE), e.cullFace(e.FRONT), e.depthFunc(e.LEQUAL);
3021
- const o = _i(e), { canvas: c } = e, a = ([p = 0, v = 0]) => {
3022
- p = p || 1, v = v || 1, s = [p, v], c.width = p * devicePixelRatio, c.height = v * devicePixelRatio, o.resize([c.width, c.height]);
3022
+ const o = _i(e), { canvas: c } = e, a = ([v = 0, T = 0]) => {
3023
+ v = v || 1, T = T || 1, s = [v, T], c.width = v * devicePixelRatio, c.height = T * devicePixelRatio, o.resize([c.width, c.height]);
3023
3024
  };
3024
3025
  a([c.width, c.height]);
3025
- const f = new ResizeObserver(([p]) => {
3026
- if (!p)
3026
+ const f = new ResizeObserver(([v]) => {
3027
+ if (!v)
3027
3028
  return;
3028
- const { contentRect: v } = p, { width: y, height: g } = v;
3029
- a([y, g]);
3029
+ const { contentRect: T } = v, { width: p, height: g } = T;
3030
+ a([p, g]);
3030
3031
  });
3031
3032
  c instanceof HTMLCanvasElement && f.observe(c);
3032
- const l = ([p = 0, v = 0]) => {
3033
- e.viewport(0, 0, p * devicePixelRatio, v * devicePixelRatio), e.clear(e.COLOR_BUFFER_BIT | e.DEPTH_BUFFER_BIT);
3034
- }, u = () => {
3035
- const p = J(n(), s);
3036
- l(s), Oe(i()).forEach((v) => v.render?.({ viewport: p }));
3037
- }, h = (p) => {
3033
+ const l = ([v = 0, T = 0]) => {
3034
+ e.viewport(0, 0, v * devicePixelRatio, T * devicePixelRatio), e.clear(e.COLOR_BUFFER_BIT | e.DEPTH_BUFFER_BIT);
3035
+ }, h = () => {
3038
3036
  const v = J(n(), s);
3039
- l(s), (p ? [p] : Oe(i())).forEach(
3040
- (y, g) => y.render?.({ viewport: v, depth: !0, index: g + 1 })
3037
+ l(s), Oe(i()).forEach((T) => T.render?.({ viewport: v }));
3038
+ }, u = (v) => {
3039
+ const T = J(n(), s);
3040
+ l(s), (v ? [v] : Oe(i())).forEach(
3041
+ (p, g) => p.render?.({ viewport: T, depth: !0, index: g + 1 })
3041
3042
  );
3042
3043
  }, d = () => {
3043
- r && (u(), requestAnimationFrame(d));
3044
+ r && (h(), requestAnimationFrame(d));
3044
3045
  };
3045
3046
  requestAnimationFrame(d);
3046
- const m = (p) => J(n(), s).project(p), _ = (p) => J(n(), s).unproject(p), w = (p, { terrain: v } = {}) => {
3047
- const { screenToClip: y, clipToLocal: g, localToWorld: E } = J(
3047
+ const m = (v) => J(n(), s).project(v), _ = (v) => J(n(), s).unproject(v), w = (v, { terrain: T } = {}) => {
3048
+ const { screenToClip: p, clipToLocal: g, localToWorld: E } = J(
3048
3049
  n(),
3049
3050
  s
3050
3051
  );
3051
3052
  o.use();
3052
- const [T] = v ? i() : [];
3053
- h(T);
3054
- const [R = 0, M = 0] = p, [b, P] = o.read([
3053
+ const [y] = T ? i() : [];
3054
+ u(y);
3055
+ const [R = 0, M = 0] = v, [b, P] = o.read([
3055
3056
  R * devicePixelRatio,
3056
3057
  M * devicePixelRatio
3057
- ]), [U = 0, S = 0] = y(p), N = se(E(g([U, S, b, 1]))), D = P === 0 ? void 0 : T ?? Oe(i())[P - 1];
3058
- return { point: p, position: N, layer: D };
3058
+ ]), [U = 0, S = 0] = p(v), N = se(E(g([U, S, b, 1]))), I = P === 0 ? void 0 : y ?? Oe(i())[P - 1];
3059
+ return { point: v, position: N, layer: I };
3059
3060
  }, x = yi(e, {
3060
3061
  view: n,
3061
3062
  screen: () => s,
@@ -3078,8 +3079,8 @@ export {
3078
3079
  Ri as createContainer,
3079
3080
  wi as createContext,
3080
3081
  Ai as createDynamicContainer,
3081
- bi as createEmptyLayer,
3082
- Si as createLineLayer,
3082
+ Si as createEmptyLayer,
3083
+ bi as createLineLayer,
3083
3084
  Ti as createMouseControl,
3084
3085
  Ae as createMouseEvents,
3085
3086
  vi as createNumberTransition,
@@ -3092,20 +3093,20 @@ export {
3092
3093
  Ni as createTerrainLayer,
3093
3094
  ae as createTransition,
3094
3095
  pi as createVec2Transition,
3095
- Di as createVec4Transition,
3096
+ Ii as createVec4Transition,
3096
3097
  Xi as createViewTransition,
3097
3098
  Wi as createWorld,
3098
3099
  Rt as debounce,
3099
- Ii as defaultLayerOptions,
3100
- ut as defaultView,
3100
+ Di as defaultLayerOptions,
3101
+ ht as defaultView,
3101
3102
  dn as degrees,
3102
3103
  se as geodetic,
3103
3104
  L as mercator,
3104
3105
  mn as quadratic,
3105
- Ie as radians,
3106
+ De as radians,
3106
3107
  ie as range,
3107
3108
  vn as tileToMercator,
3108
3109
  pn as toOrientation,
3109
- Se as toQuaternion
3110
+ be as toQuaternion
3110
3111
  };
3111
3112
  //# sourceMappingURL=index.js.map