@needle-tools/engine 5.1.0-beta.2 → 5.1.0-beta.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.
Files changed (68) hide show
  1. package/dist/{materialx-DnlAB5wd.min.js → materialx-B5gKeM65.min.js} +1 -1
  2. package/dist/{materialx-BdEC3ugB.umd.cjs → materialx-CFRcCYWy.umd.cjs} +1 -1
  3. package/dist/{materialx-BCzyAHFr.js → materialx-DqGmteNO.js} +1 -1
  4. package/dist/{needle-engine.bundle-BcPtAnC9.umd.cjs → needle-engine.bundle--5M1FCR0.umd.cjs} +153 -141
  5. package/dist/{needle-engine.bundle-H5HXbUCS.js → needle-engine.bundle-B6JqW8fC.js} +5313 -5260
  6. package/dist/{needle-engine.bundle-D0UTRn3W.min.js → needle-engine.bundle-D5eqAuZu.min.js} +158 -146
  7. package/dist/needle-engine.d.ts +19 -8
  8. package/dist/needle-engine.js +157 -157
  9. package/dist/needle-engine.min.js +1 -1
  10. package/dist/needle-engine.umd.cjs +1 -1
  11. package/dist/{vendor-DQu6PDTB.min.js → vendor-2--bD1c9.min.js} +4 -4
  12. package/dist/{vendor-J7NvM88N.js → vendor-BNtcIZkv.js} +819 -816
  13. package/dist/{vendor-CsClD1Nd.umd.cjs → vendor-vbe9sv1t.umd.cjs} +20 -20
  14. package/lib/engine/api.d.ts +1 -1
  15. package/lib/engine/api.js +1 -1
  16. package/lib/engine/api.js.map +1 -1
  17. package/lib/engine/engine_init.js +2 -2
  18. package/lib/engine/engine_init.js.map +1 -1
  19. package/lib/engine/engine_license.d.ts +7 -7
  20. package/lib/engine/engine_license.js +72 -72
  21. package/lib/engine/engine_license.js.map +1 -1
  22. package/lib/engine/engine_networking_blob.js +3 -3
  23. package/lib/engine/engine_networking_blob.js.map +1 -1
  24. package/lib/engine/engine_utils_qrcode.js +2 -2
  25. package/lib/engine/engine_utils_qrcode.js.map +1 -1
  26. package/lib/engine/webcomponents/needle menu/needle-menu-spatial.js +2 -2
  27. package/lib/engine/webcomponents/needle menu/needle-menu-spatial.js.map +1 -1
  28. package/lib/engine/webcomponents/needle menu/needle-menu.js +5 -5
  29. package/lib/engine/webcomponents/needle menu/needle-menu.js.map +1 -1
  30. package/lib/engine/webcomponents/needle-engine.js +2 -2
  31. package/lib/engine/webcomponents/needle-engine.js.map +1 -1
  32. package/lib/engine/webcomponents/needle-engine.loading.js +2 -2
  33. package/lib/engine/webcomponents/needle-engine.loading.js.map +1 -1
  34. package/lib/engine/xr/TempXRContext.js +2 -2
  35. package/lib/engine/xr/TempXRContext.js.map +1 -1
  36. package/lib/engine-components/Component.js +12 -0
  37. package/lib/engine-components/Component.js.map +1 -1
  38. package/lib/engine-components/ContactShadows.d.ts +7 -2
  39. package/lib/engine-components/ContactShadows.js +65 -45
  40. package/lib/engine-components/ContactShadows.js.map +1 -1
  41. package/lib/engine-components/GroundProjection.d.ts +6 -0
  42. package/lib/engine-components/GroundProjection.js +69 -7
  43. package/lib/engine-components/GroundProjection.js.map +1 -1
  44. package/lib/engine-components/NeedleMenu.js +4 -1
  45. package/lib/engine-components/NeedleMenu.js.map +1 -1
  46. package/lib/engine-components/Skybox.js +9 -0
  47. package/lib/engine-components/Skybox.js.map +1 -1
  48. package/lib/engine-components/export/usdz/USDZExporter.js +4 -4
  49. package/lib/engine-components/export/usdz/USDZExporter.js.map +1 -1
  50. package/package.json +2 -2
  51. package/plugins/common/license.js +4 -4
  52. package/plugins/vite/license.js +4 -4
  53. package/src/engine/api.ts +1 -1
  54. package/src/engine/engine_init.ts +2 -2
  55. package/src/engine/engine_license.ts +69 -69
  56. package/src/engine/engine_networking_blob.ts +3 -3
  57. package/src/engine/engine_utils_qrcode.ts +2 -2
  58. package/src/engine/webcomponents/needle menu/needle-menu-spatial.ts +2 -2
  59. package/src/engine/webcomponents/needle menu/needle-menu.ts +5 -5
  60. package/src/engine/webcomponents/needle-engine.loading.ts +6 -6
  61. package/src/engine/webcomponents/needle-engine.ts +2 -2
  62. package/src/engine/xr/TempXRContext.ts +2 -2
  63. package/src/engine-components/Component.ts +11 -0
  64. package/src/engine-components/ContactShadows.ts +75 -49
  65. package/src/engine-components/GroundProjection.ts +71 -7
  66. package/src/engine-components/NeedleMenu.ts +4 -1
  67. package/src/engine-components/Skybox.ts +8 -0
  68. package/src/engine-components/export/usdz/USDZExporter.ts +4 -4
@@ -1,4 +1,4 @@
1
- import { Object3D as cc, PlaneGeometry as lc, Layers as Br, MeshBasicMaterial as ea, DoubleSide as Gs, AdditiveBlending as uc, InstancedBufferAttribute as yn, DynamicDrawUsage as ee, InstancedBufferGeometry as jl, Uniform$1 as Re, ShaderMaterial as Ws, BufferGeometry as yi, BufferAttribute as he, Mesh as Zr, MeshStandardMaterial as Gl, MeshPhysicalMaterial as Wl, ShaderChunk as $l, Triangle as Mn, Vector3 as H, Box3 as Fe, Matrix4 as Oe, Line3 as tn, Plane as hc, Vector2 as fn, BackSide as Hl, REVISION as fc, Ray as ql, FrontSide as na, LineSegments as dc, LineLoop as pc, Line as mc, Points as yc, Sphere as Xl, BatchedMesh as Yl, Matrix3 as Zl, Vector4 as vo, InterpolateDiscrete as Kl, InterpolateLinear as gc, AnimationClip as Ql, QuaternionKeyframeTrack as tu, ColorKeyframeTrack as eu, VectorKeyframeTrack as nu, BooleanKeyframeTrack as iu, NumberKeyframeTrack as ru, PropertyBinding as ia } from "./three.js";
1
+ import { Object3D as cc, PlaneGeometry as lc, Layers as Br, MeshBasicMaterial as ea, DoubleSide as Gs, AdditiveBlending as uc, InstancedBufferAttribute as mn, DynamicDrawUsage as ee, InstancedBufferGeometry as jl, Uniform$1 as Re, ShaderMaterial as Ws, BufferGeometry as yi, BufferAttribute as he, Mesh as Zr, MeshStandardMaterial as Gl, MeshPhysicalMaterial as Wl, ShaderChunk as $l, Triangle as Mn, Vector3 as H, Box3 as Fe, Matrix4 as Oe, Line3 as tn, Plane as hc, Vector2 as hn, BackSide as Hl, REVISION as fc, Ray as ql, FrontSide as na, LineSegments as dc, LineLoop as pc, Line as mc, Points as yc, Sphere as Xl, BatchedMesh as Yl, Matrix3 as Zl, Vector4 as vo, InterpolateDiscrete as Kl, InterpolateLinear as gc, AnimationClip as Ql, QuaternionKeyframeTrack as tu, ColorKeyframeTrack as eu, VectorKeyframeTrack as nu, BooleanKeyframeTrack as iu, NumberKeyframeTrack as ru, PropertyBinding as ia } from "./three.js";
2
2
  const su = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
3
3
  function ou(r) {
4
4
  return typeof r == "string" && su.test(r);
@@ -91,7 +91,7 @@ function pu(r) {
91
91
  }
92
92
  return [e[0] >> 24 & 255, e[0] >> 16 & 255, e[0] >> 8 & 255, e[0] & 255, e[1] >> 24 & 255, e[1] >> 16 & 255, e[1] >> 8 & 255, e[1] & 255, e[2] >> 24 & 255, e[2] >> 16 & 255, e[2] >> 8 & 255, e[2] & 255, e[3] >> 24 & 255, e[3] >> 16 & 255, e[3] >> 8 & 255, e[3] & 255, e[4] >> 24 & 255, e[4] >> 16 & 255, e[4] >> 8 & 255, e[4] & 255];
93
93
  }
94
- const Td = fu("v5", 80, pu), vs = 2, Ue = 4, Ze = 4, mu = 4, cn = new Int32Array(2), ra = new Float32Array(cn.buffer), sa = new Float64Array(cn.buffer), cr = new Uint16Array(new Uint8Array([1, 0]).buffer)[0] === 1;
94
+ const Td = fu("v5", 80, pu), vs = 2, Ue = 4, Ze = 4, mu = 4, an = new Int32Array(2), ra = new Float32Array(an.buffer), sa = new Float64Array(an.buffer), cr = new Uint16Array(new Uint8Array([1, 0]).buffer)[0] === 1;
95
95
  class Qe {
96
96
  constructor(t, e) {
97
97
  this.low = t | 0, this.high = e | 0;
@@ -176,10 +176,10 @@ class Jr {
176
176
  return new Qe(this.readUint32(t), this.readUint32(t + 4));
177
177
  }
178
178
  readFloat32(t) {
179
- return cn[0] = this.readInt32(t), ra[0];
179
+ return an[0] = this.readInt32(t), ra[0];
180
180
  }
181
181
  readFloat64(t) {
182
- return cn[cr ? 0 : 1] = this.readInt32(t), cn[cr ? 1 : 0] = this.readInt32(t + 4), sa[0];
182
+ return an[cr ? 0 : 1] = this.readInt32(t), an[cr ? 1 : 0] = this.readInt32(t + 4), sa[0];
183
183
  }
184
184
  writeInt8(t, e) {
185
185
  this.bytes_[t] = e;
@@ -206,10 +206,10 @@ class Jr {
206
206
  this.writeUint32(t, e.low), this.writeUint32(t + 4, e.high);
207
207
  }
208
208
  writeFloat32(t, e) {
209
- ra[0] = e, this.writeInt32(t, cn[0]);
209
+ ra[0] = e, this.writeInt32(t, an[0]);
210
210
  }
211
211
  writeFloat64(t, e) {
212
- sa[0] = e, this.writeInt32(t, cn[cr ? 0 : 1]), this.writeInt32(t + 4, cn[cr ? 1 : 0]);
212
+ sa[0] = e, this.writeInt32(t, an[cr ? 0 : 1]), this.writeInt32(t + 4, an[cr ? 1 : 0]);
213
213
  }
214
214
  /**
215
215
  * Return the file identifier. Behavior is undefined for FlatBuffers whose
@@ -1089,15 +1089,15 @@ class rt {
1089
1089
  }
1090
1090
  if (d !== T || c !== m || l !== p || h !== b) {
1091
1091
  let g = 1 - o;
1092
- const v = c * m + l * p + h * b + d * T, x = v >= 0 ? 1 : -1, _ = 1 - v * v;
1093
- if (_ > Number.EPSILON) {
1094
- const M = Math.sqrt(_), P = Math.atan2(M, v * x);
1095
- g = Math.sin(g * P) / M, o = Math.sin(o * P) / M;
1092
+ const v = c * m + l * p + h * b + d * T, _ = v >= 0 ? 1 : -1, x = 1 - v * v;
1093
+ if (x > Number.EPSILON) {
1094
+ const C = Math.sqrt(x), P = Math.atan2(C, v * _);
1095
+ g = Math.sin(g * P) / C, o = Math.sin(o * P) / C;
1096
1096
  }
1097
- const C = o * x;
1098
- if (c = c * g + m * C, l = l * g + p * C, h = h * g + b * C, d = d * g + T * C, g === 1 - o) {
1099
- const M = 1 / Math.sqrt(c * c + l * l + h * h + d * d);
1100
- c *= M, l *= M, h *= M, d *= M;
1097
+ const M = o * _;
1098
+ if (c = c * g + m * M, l = l * g + p * M, h = h * g + b * M, d = d * g + T * M, g === 1 - o) {
1099
+ const C = 1 / Math.sqrt(c * c + l * l + h * h + d * d);
1100
+ c *= C, l *= C, h *= C, d *= C;
1101
1101
  }
1102
1102
  }
1103
1103
  t[e] = c, t[e + 1] = l, t[e + 2] = h, t[e + 3] = d;
@@ -1613,8 +1613,8 @@ class Le {
1613
1613
  return this.multiplyMatrices(t, this);
1614
1614
  }
1615
1615
  multiplyMatrices(t, e) {
1616
- const n = t.elements, i = e.elements, s = this.elements, a = n[0], o = n[4], c = n[8], l = n[12], h = n[1], d = n[5], m = n[9], p = n[13], b = n[2], T = n[6], g = n[10], v = n[14], x = n[3], _ = n[7], C = n[11], M = n[15], P = i[0], E = i[4], O = i[8], z = i[12], R = i[1], B = i[5], A = i[9], N = i[13], L = i[2], V = i[6], $ = i[10], Q = i[14], W = i[3], yt = i[7], nt = i[11], ht = i[15];
1617
- return s[0] = a * P + o * R + c * L + l * W, s[4] = a * E + o * B + c * V + l * yt, s[8] = a * O + o * A + c * $ + l * nt, s[12] = a * z + o * N + c * Q + l * ht, s[1] = h * P + d * R + m * L + p * W, s[5] = h * E + d * B + m * V + p * yt, s[9] = h * O + d * A + m * $ + p * nt, s[13] = h * z + d * N + m * Q + p * ht, s[2] = b * P + T * R + g * L + v * W, s[6] = b * E + T * B + g * V + v * yt, s[10] = b * O + T * A + g * $ + v * nt, s[14] = b * z + T * N + g * Q + v * ht, s[3] = x * P + _ * R + C * L + M * W, s[7] = x * E + _ * B + C * V + M * yt, s[11] = x * O + _ * A + C * $ + M * nt, s[15] = x * z + _ * N + C * Q + M * ht, this;
1616
+ const n = t.elements, i = e.elements, s = this.elements, a = n[0], o = n[4], c = n[8], l = n[12], h = n[1], d = n[5], m = n[9], p = n[13], b = n[2], T = n[6], g = n[10], v = n[14], _ = n[3], x = n[7], M = n[11], C = n[15], P = i[0], E = i[4], A = i[8], z = i[12], R = i[1], B = i[5], O = i[9], N = i[13], L = i[2], V = i[6], $ = i[10], Q = i[14], W = i[3], yt = i[7], nt = i[11], ht = i[15];
1617
+ return s[0] = a * P + o * R + c * L + l * W, s[4] = a * E + o * B + c * V + l * yt, s[8] = a * A + o * O + c * $ + l * nt, s[12] = a * z + o * N + c * Q + l * ht, s[1] = h * P + d * R + m * L + p * W, s[5] = h * E + d * B + m * V + p * yt, s[9] = h * A + d * O + m * $ + p * nt, s[13] = h * z + d * N + m * Q + p * ht, s[2] = b * P + T * R + g * L + v * W, s[6] = b * E + T * B + g * V + v * yt, s[10] = b * A + T * O + g * $ + v * nt, s[14] = b * z + T * N + g * Q + v * ht, s[3] = _ * P + x * R + M * L + C * W, s[7] = _ * E + x * B + M * V + C * yt, s[11] = _ * A + x * O + M * $ + C * nt, s[15] = _ * z + x * N + M * Q + C * ht, this;
1618
1618
  }
1619
1619
  multiplyScalar(t) {
1620
1620
  const e = this.elements;
@@ -1634,11 +1634,11 @@ class Le {
1634
1634
  return t.isVector3 ? (i[12] = t.x, i[13] = t.y, i[14] = t.z) : (i[12] = t, i[13] = e, i[14] = n), this;
1635
1635
  }
1636
1636
  invert() {
1637
- const t = this.elements, e = t[0], n = t[1], i = t[2], s = t[3], a = t[4], o = t[5], c = t[6], l = t[7], h = t[8], d = t[9], m = t[10], p = t[11], b = t[12], T = t[13], g = t[14], v = t[15], x = d * g * l - T * m * l + T * c * p - o * g * p - d * c * v + o * m * v, _ = b * m * l - h * g * l - b * c * p + a * g * p + h * c * v - a * m * v, C = h * T * l - b * d * l + b * o * p - a * T * p - h * o * v + a * d * v, M = b * d * c - h * T * c - b * o * m + a * T * m + h * o * g - a * d * g, P = e * x + n * _ + i * C + s * M;
1637
+ const t = this.elements, e = t[0], n = t[1], i = t[2], s = t[3], a = t[4], o = t[5], c = t[6], l = t[7], h = t[8], d = t[9], m = t[10], p = t[11], b = t[12], T = t[13], g = t[14], v = t[15], _ = d * g * l - T * m * l + T * c * p - o * g * p - d * c * v + o * m * v, x = b * m * l - h * g * l - b * c * p + a * g * p + h * c * v - a * m * v, M = h * T * l - b * d * l + b * o * p - a * T * p - h * o * v + a * d * v, C = b * d * c - h * T * c - b * o * m + a * T * m + h * o * g - a * d * g, P = e * _ + n * x + i * M + s * C;
1638
1638
  if (P === 0)
1639
1639
  return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
1640
1640
  const E = 1 / P;
1641
- return t[0] = x * E, t[1] = (T * m * s - d * g * s - T * i * p + n * g * p + d * i * v - n * m * v) * E, t[2] = (o * g * s - T * c * s + T * i * l - n * g * l - o * i * v + n * c * v) * E, t[3] = (d * c * s - o * m * s - d * i * l + n * m * l + o * i * p - n * c * p) * E, t[4] = _ * E, t[5] = (h * g * s - b * m * s + b * i * p - e * g * p - h * i * v + e * m * v) * E, t[6] = (b * c * s - a * g * s - b * i * l + e * g * l + a * i * v - e * c * v) * E, t[7] = (a * m * s - h * c * s + h * i * l - e * m * l - a * i * p + e * c * p) * E, t[8] = C * E, t[9] = (b * d * s - h * T * s - b * n * p + e * T * p + h * n * v - e * d * v) * E, t[10] = (a * T * s - b * o * s + b * n * l - e * T * l - a * n * v + e * o * v) * E, t[11] = (h * o * s - a * d * s - h * n * l + e * d * l + a * n * p - e * o * p) * E, t[12] = M * E, t[13] = (h * T * i - b * d * i + b * n * m - e * T * m - h * n * g + e * d * g) * E, t[14] = (b * o * i - a * T * i - b * n * c + e * T * c + a * n * g - e * o * g) * E, t[15] = (a * d * i - h * o * i + h * n * c - e * d * c - a * n * m + e * o * m) * E, this;
1641
+ return t[0] = _ * E, t[1] = (T * m * s - d * g * s - T * i * p + n * g * p + d * i * v - n * m * v) * E, t[2] = (o * g * s - T * c * s + T * i * l - n * g * l - o * i * v + n * c * v) * E, t[3] = (d * c * s - o * m * s - d * i * l + n * m * l + o * i * p - n * c * p) * E, t[4] = x * E, t[5] = (h * g * s - b * m * s + b * i * p - e * g * p - h * i * v + e * m * v) * E, t[6] = (b * c * s - a * g * s - b * i * l + e * g * l + a * i * v - e * c * v) * E, t[7] = (a * m * s - h * c * s + h * i * l - e * m * l - a * i * p + e * c * p) * E, t[8] = M * E, t[9] = (b * d * s - h * T * s - b * n * p + e * T * p + h * n * v - e * d * v) * E, t[10] = (a * T * s - b * o * s + b * n * l - e * T * l - a * n * v + e * o * v) * E, t[11] = (h * o * s - a * d * s - h * n * l + e * d * l + a * n * p - e * o * p) * E, t[12] = C * E, t[13] = (h * T * i - b * d * i + b * n * m - e * T * m - h * n * g + e * d * g) * E, t[14] = (b * o * i - a * T * i - b * n * c + e * T * c + a * n * g - e * o * g) * E, t[15] = (a * d * i - h * o * i + h * n * c - e * d * c - a * n * m + e * o * m) * E, this;
1642
1642
  }
1643
1643
  scale(t) {
1644
1644
  const e = this.elements, n = t.x, i = t.y, s = t.z;
@@ -1674,8 +1674,8 @@ class Le {
1674
1674
  return this.set(1, n, s, 0, t, 1, a, 0, e, i, 1, 0, 0, 0, 0, 1), this;
1675
1675
  }
1676
1676
  compose(t, e, n) {
1677
- const i = this.elements, s = e._x, a = e._y, o = e._z, c = e._w, l = s + s, h = a + a, d = o + o, m = s * l, p = s * h, b = s * d, T = a * h, g = a * d, v = o * d, x = c * l, _ = c * h, C = c * d, M = n.x, P = n.y, E = n.z;
1678
- return i[0] = (1 - (T + v)) * M, i[1] = (p + C) * M, i[2] = (b - _) * M, i[3] = 0, i[4] = (p - C) * P, i[5] = (1 - (m + v)) * P, i[6] = (g + x) * P, i[7] = 0, i[8] = (b + _) * E, i[9] = (g - x) * E, i[10] = (1 - (m + T)) * E, i[11] = 0, i[12] = t.x, i[13] = t.y, i[14] = t.z, i[15] = 1, this;
1677
+ const i = this.elements, s = e._x, a = e._y, o = e._z, c = e._w, l = s + s, h = a + a, d = o + o, m = s * l, p = s * h, b = s * d, T = a * h, g = a * d, v = o * d, _ = c * l, x = c * h, M = c * d, C = n.x, P = n.y, E = n.z;
1678
+ return i[0] = (1 - (T + v)) * C, i[1] = (p + M) * C, i[2] = (b - x) * C, i[3] = 0, i[4] = (p - M) * P, i[5] = (1 - (m + v)) * P, i[6] = (g + _) * P, i[7] = 0, i[8] = (b + x) * E, i[9] = (g - _) * E, i[10] = (1 - (m + T)) * E, i[11] = 0, i[12] = t.x, i[13] = t.y, i[14] = t.z, i[15] = 1, this;
1679
1679
  }
1680
1680
  decompose(t, e, n) {
1681
1681
  const i = this.elements;
@@ -2128,11 +2128,11 @@ class fe {
2128
2128
  if (Math.abs(h + m) < 0.1 && Math.abs(d + T) < 0.1 && Math.abs(b + g) < 0.1 && Math.abs(l + p + v - 3) < 0.1)
2129
2129
  return this.set(1, 0, 0, 0), this;
2130
2130
  e = Math.PI;
2131
- const _ = (l + 1) / 2, C = (p + 1) / 2, M = (v + 1) / 2, P = (h + m) / 4, E = (d + T) / 4, O = (b + g) / 4;
2132
- return _ > C && _ > M ? _ < 0.01 ? (n = 0, i = 0.707106781, s = 0.707106781) : (n = Math.sqrt(_), i = P / n, s = E / n) : C > M ? C < 0.01 ? (n = 0.707106781, i = 0, s = 0.707106781) : (i = Math.sqrt(C), n = P / i, s = O / i) : M < 0.01 ? (n = 0.707106781, i = 0.707106781, s = 0) : (s = Math.sqrt(M), n = E / s, i = O / s), this.set(n, i, s, e), this;
2131
+ const x = (l + 1) / 2, M = (p + 1) / 2, C = (v + 1) / 2, P = (h + m) / 4, E = (d + T) / 4, A = (b + g) / 4;
2132
+ return x > M && x > C ? x < 0.01 ? (n = 0, i = 0.707106781, s = 0.707106781) : (n = Math.sqrt(x), i = P / n, s = E / n) : M > C ? M < 0.01 ? (n = 0.707106781, i = 0, s = 0.707106781) : (i = Math.sqrt(M), n = P / i, s = A / i) : C < 0.01 ? (n = 0.707106781, i = 0.707106781, s = 0) : (s = Math.sqrt(C), n = E / s, i = A / s), this.set(n, i, s, e), this;
2133
2133
  }
2134
- let x = Math.sqrt((g - b) * (g - b) + (d - T) * (d - T) + (m - h) * (m - h));
2135
- return Math.abs(x) < 1e-3 && (x = 1), this.x = (g - b) / x, this.y = (d - T) / x, this.z = (m - h) / x, this.w = Math.acos((l + p + v - 1) / 2), this;
2134
+ let _ = Math.sqrt((g - b) * (g - b) + (d - T) * (d - T) + (m - h) * (m - h));
2135
+ return Math.abs(_) < 1e-3 && (_ = 1), this.x = (g - b) / _, this.y = (d - T) / _, this.z = (m - h) / _, this.w = Math.acos((l + p + v - 1) / 2), this;
2136
2136
  }
2137
2137
  min(t) {
2138
2138
  return this.x = Math.min(this.x, t.x), this.y = Math.min(this.y, t.y), this.z = Math.min(this.z, t.z), this.w = Math.min(this.w, t.w), this;
@@ -2234,8 +2234,8 @@ class De {
2234
2234
  return this.multiplyMatrices(t, this);
2235
2235
  }
2236
2236
  multiplyMatrices(t, e) {
2237
- const n = t.elements, i = e.elements, s = this.elements, a = n[0], o = n[3], c = n[6], l = n[1], h = n[4], d = n[7], m = n[2], p = n[5], b = n[8], T = i[0], g = i[3], v = i[6], x = i[1], _ = i[4], C = i[7], M = i[2], P = i[5], E = i[8];
2238
- return s[0] = a * T + o * x + c * M, s[3] = a * g + o * _ + c * P, s[6] = a * v + o * C + c * E, s[1] = l * T + h * x + d * M, s[4] = l * g + h * _ + d * P, s[7] = l * v + h * C + d * E, s[2] = m * T + p * x + b * M, s[5] = m * g + p * _ + b * P, s[8] = m * v + p * C + b * E, this;
2237
+ const n = t.elements, i = e.elements, s = this.elements, a = n[0], o = n[3], c = n[6], l = n[1], h = n[4], d = n[7], m = n[2], p = n[5], b = n[8], T = i[0], g = i[3], v = i[6], _ = i[1], x = i[4], M = i[7], C = i[2], P = i[5], E = i[8];
2238
+ return s[0] = a * T + o * _ + c * C, s[3] = a * g + o * x + c * P, s[6] = a * v + o * M + c * E, s[1] = l * T + h * _ + d * C, s[4] = l * g + h * x + d * P, s[7] = l * v + h * M + d * E, s[2] = m * T + p * _ + b * C, s[5] = m * g + p * x + b * P, s[8] = m * v + p * M + b * E, this;
2239
2239
  }
2240
2240
  multiplyScalar(t) {
2241
2241
  const e = this.elements;
@@ -2459,7 +2459,7 @@ class qn {
2459
2459
  return new qn(this.a.clone(), this.b.clone());
2460
2460
  }
2461
2461
  }
2462
- class un {
2462
+ class ln {
2463
2463
  constructor(t, e) {
2464
2464
  this.subType = e, this.type = "function", this.keys = t;
2465
2465
  }
@@ -2495,10 +2495,10 @@ class un {
2495
2495
  };
2496
2496
  }
2497
2497
  static fromJSON(t) {
2498
- return new un(t.keys.map((e) => [Ju(e.value, t.subType), e.pos]), t.subType);
2498
+ return new ln(t.keys.map((e) => [Ju(e.value, t.subType), e.pos]), t.subType);
2499
2499
  }
2500
2500
  clone() {
2501
- return this.subType === "Number" ? new un(this.keys.map(([t, e]) => [t, e]), this.subType) : new un(this.keys.map(([t, e]) => [t.clone(), e]), this.subType);
2501
+ return this.subType === "Number" ? new ln(this.keys.map(([t, e]) => [t, e]), this.subType) : new ln(this.keys.map(([t, e]) => [t.clone(), e]), this.subType);
2502
2502
  }
2503
2503
  }
2504
2504
  const hr = new G();
@@ -2510,7 +2510,7 @@ class Pn {
2510
2510
  [1, 0],
2511
2511
  [1, 1]
2512
2512
  ]) {
2513
- this.type = "function", this.color = new un(t, "Color"), this.alpha = new un(e, "Number");
2513
+ this.type = "function", this.color = new ln(t, "Color"), this.alpha = new ln(e, "Number");
2514
2514
  }
2515
2515
  genColor(t, e, n) {
2516
2516
  return this.color.genValue(hr, n), e.set(hr.x, hr.y, hr.z, this.alpha.genValue(1, n));
@@ -2528,7 +2528,7 @@ class Pn {
2528
2528
  return t.functions.length > 0 && e.push([qn.fromJSON(t.functions[t.functions.length - 1].function).b, 1]), new Pn(e.map((n) => [new G(n[0].x, n[0].y, n[0].z), n[1]]), e.map((n) => [n[0].w, n[1]]));
2529
2529
  } else {
2530
2530
  const e = new Pn();
2531
- return e.alpha = un.fromJSON(t.alpha), e.color = un.fromJSON(t.color), e;
2531
+ return e.alpha = ln.fromJSON(t.alpha), e.color = ln.fromJSON(t.color), e;
2532
2532
  }
2533
2533
  }
2534
2534
  clone() {
@@ -3939,50 +3939,50 @@ class Mc {
3939
3939
  const c = (t + e) * Zu, l = Math.floor(t + c), h = Math.floor(e + c), d = (l + h) * ei, m = l - d, p = h - d, b = t - m, T = e - p;
3940
3940
  let g, v;
3941
3941
  b > T ? (g = 1, v = 0) : (g = 0, v = 1);
3942
- const x = b - g + ei, _ = T - v + ei, C = b - 1 + 2 * ei, M = T - 1 + 2 * ei, P = l & 255, E = h & 255;
3943
- let O = 0.5 - b * b - T * T;
3944
- if (O >= 0) {
3942
+ const _ = b - g + ei, x = T - v + ei, M = b - 1 + 2 * ei, C = T - 1 + 2 * ei, P = l & 255, E = h & 255;
3943
+ let A = 0.5 - b * b - T * T;
3944
+ if (A >= 0) {
3945
3945
  const B = n[P + i[E]] * 3;
3946
- O *= O, s = O * O * (zt[B] * b + zt[B + 1] * T);
3946
+ A *= A, s = A * A * (zt[B] * b + zt[B + 1] * T);
3947
3947
  }
3948
- let z = 0.5 - x * x - _ * _;
3948
+ let z = 0.5 - _ * _ - x * x;
3949
3949
  if (z >= 0) {
3950
3950
  const B = n[P + g + i[E + v]] * 3;
3951
- z *= z, a = z * z * (zt[B] * x + zt[B + 1] * _);
3951
+ z *= z, a = z * z * (zt[B] * _ + zt[B + 1] * x);
3952
3952
  }
3953
- let R = 0.5 - C * C - M * M;
3953
+ let R = 0.5 - M * M - C * C;
3954
3954
  if (R >= 0) {
3955
3955
  const B = n[P + 1 + i[E + 1]] * 3;
3956
- R *= R, o = R * R * (zt[B] * C + zt[B + 1] * M);
3956
+ R *= R, o = R * R * (zt[B] * M + zt[B + 1] * C);
3957
3957
  }
3958
3958
  return 70 * (s + a + o);
3959
3959
  }
3960
3960
  noise3D(t, e, n) {
3961
3961
  const i = this.permMod12, s = this.perm;
3962
3962
  let a, o, c, l;
3963
- const h = (t + e + n) * Ku, d = Math.floor(t + h), m = Math.floor(e + h), p = Math.floor(n + h), b = (d + m + p) * Ie, T = d - b, g = m - b, v = p - b, x = t - T, _ = e - g, C = n - v;
3964
- let M, P, E, O, z, R;
3965
- x >= _ ? _ >= C ? (M = 1, P = 0, E = 0, O = 1, z = 1, R = 0) : x >= C ? (M = 1, P = 0, E = 0, O = 1, z = 0, R = 1) : (M = 0, P = 0, E = 1, O = 1, z = 0, R = 1) : _ < C ? (M = 0, P = 0, E = 1, O = 0, z = 1, R = 1) : x < C ? (M = 0, P = 1, E = 0, O = 0, z = 1, R = 1) : (M = 0, P = 1, E = 0, O = 1, z = 1, R = 0);
3966
- const B = x - M + Ie, A = _ - P + Ie, N = C - E + Ie, L = x - O + 2 * Ie, V = _ - z + 2 * Ie, $ = C - R + 2 * Ie, Q = x - 1 + 3 * Ie, W = _ - 1 + 3 * Ie, yt = C - 1 + 3 * Ie, nt = d & 255, ht = m & 255, st = p & 255;
3967
- let vt = 0.6 - x * x - _ * _ - C * C;
3963
+ const h = (t + e + n) * Ku, d = Math.floor(t + h), m = Math.floor(e + h), p = Math.floor(n + h), b = (d + m + p) * Ie, T = d - b, g = m - b, v = p - b, _ = t - T, x = e - g, M = n - v;
3964
+ let C, P, E, A, z, R;
3965
+ _ >= x ? x >= M ? (C = 1, P = 0, E = 0, A = 1, z = 1, R = 0) : _ >= M ? (C = 1, P = 0, E = 0, A = 1, z = 0, R = 1) : (C = 0, P = 0, E = 1, A = 1, z = 0, R = 1) : x < M ? (C = 0, P = 0, E = 1, A = 0, z = 1, R = 1) : _ < M ? (C = 0, P = 1, E = 0, A = 0, z = 1, R = 1) : (C = 0, P = 1, E = 0, A = 1, z = 1, R = 0);
3966
+ const B = _ - C + Ie, O = x - P + Ie, N = M - E + Ie, L = _ - A + 2 * Ie, V = x - z + 2 * Ie, $ = M - R + 2 * Ie, Q = _ - 1 + 3 * Ie, W = x - 1 + 3 * Ie, yt = M - 1 + 3 * Ie, nt = d & 255, ht = m & 255, st = p & 255;
3967
+ let vt = 0.6 - _ * _ - x * x - M * M;
3968
3968
  if (vt < 0)
3969
3969
  a = 0;
3970
3970
  else {
3971
3971
  const at = i[nt + s[ht + s[st]]] * 3;
3972
- vt *= vt, a = vt * vt * (zt[at] * x + zt[at + 1] * _ + zt[at + 2] * C);
3972
+ vt *= vt, a = vt * vt * (zt[at] * _ + zt[at + 1] * x + zt[at + 2] * M);
3973
3973
  }
3974
- let Tt = 0.6 - B * B - A * A - N * N;
3974
+ let Tt = 0.6 - B * B - O * O - N * N;
3975
3975
  if (Tt < 0)
3976
3976
  o = 0;
3977
3977
  else {
3978
- const at = i[nt + M + s[ht + P + s[st + E]]] * 3;
3979
- Tt *= Tt, o = Tt * Tt * (zt[at] * B + zt[at + 1] * A + zt[at + 2] * N);
3978
+ const at = i[nt + C + s[ht + P + s[st + E]]] * 3;
3979
+ Tt *= Tt, o = Tt * Tt * (zt[at] * B + zt[at + 1] * O + zt[at + 2] * N);
3980
3980
  }
3981
3981
  let ot = 0.6 - L * L - V * V - $ * $;
3982
3982
  if (ot < 0)
3983
3983
  c = 0;
3984
3984
  else {
3985
- const at = i[nt + O + s[ht + z + s[st + R]]] * 3;
3985
+ const at = i[nt + A + s[ht + z + s[st + R]]] * 3;
3986
3986
  ot *= ot, c = ot * ot * (zt[at] * L + zt[at + 1] * V + zt[at + 2] * $);
3987
3987
  }
3988
3988
  let ft = 0.6 - Q * Q - W * W - yt * yt;
@@ -3997,16 +3997,16 @@ class Mc {
3997
3997
  noise4D(t, e, n, i) {
3998
3998
  const s = this.perm;
3999
3999
  let a, o, c, l, h;
4000
- const d = (t + e + n + i) * Qu, m = Math.floor(t + d), p = Math.floor(e + d), b = Math.floor(n + d), T = Math.floor(i + d), g = (m + p + b + T) * Ut, v = m - g, x = p - g, _ = b - g, C = T - g, M = t - v, P = e - x, E = n - _, O = i - C;
4001
- let z = 0, R = 0, B = 0, A = 0;
4002
- M > P ? z++ : R++, M > E ? z++ : B++, M > O ? z++ : A++, P > E ? R++ : B++, P > O ? R++ : A++, E > O ? B++ : A++;
4003
- const N = z >= 3 ? 1 : 0, L = R >= 3 ? 1 : 0, V = B >= 3 ? 1 : 0, $ = A >= 3 ? 1 : 0, Q = z >= 2 ? 1 : 0, W = R >= 2 ? 1 : 0, yt = B >= 2 ? 1 : 0, nt = A >= 2 ? 1 : 0, ht = z >= 1 ? 1 : 0, st = R >= 1 ? 1 : 0, vt = B >= 1 ? 1 : 0, Tt = A >= 1 ? 1 : 0, ot = M - N + Ut, ft = P - L + Ut, at = E - V + Ut, Yt = O - $ + Ut, Jt = M - Q + 2 * Ut, jt = P - W + 2 * Ut, Zt = E - yt + 2 * Ut, _t = O - nt + 2 * Ut, gt = M - ht + 3 * Ut, ct = P - st + 3 * Ut, de = E - vt + 3 * Ut, Rt = O - Tt + 3 * Ut, dt = M - 1 + 4 * Ut, se = P - 1 + 4 * Ut, _e = E - 1 + 4 * Ut, be = O - 1 + 4 * Ut, oe = m & 255, Te = p & 255, pe = b & 255, me = T & 255;
4004
- let Ce = 0.6 - M * M - P * P - E * E - O * O;
4000
+ const d = (t + e + n + i) * Qu, m = Math.floor(t + d), p = Math.floor(e + d), b = Math.floor(n + d), T = Math.floor(i + d), g = (m + p + b + T) * Ut, v = m - g, _ = p - g, x = b - g, M = T - g, C = t - v, P = e - _, E = n - x, A = i - M;
4001
+ let z = 0, R = 0, B = 0, O = 0;
4002
+ C > P ? z++ : R++, C > E ? z++ : B++, C > A ? z++ : O++, P > E ? R++ : B++, P > A ? R++ : O++, E > A ? B++ : O++;
4003
+ const N = z >= 3 ? 1 : 0, L = R >= 3 ? 1 : 0, V = B >= 3 ? 1 : 0, $ = O >= 3 ? 1 : 0, Q = z >= 2 ? 1 : 0, W = R >= 2 ? 1 : 0, yt = B >= 2 ? 1 : 0, nt = O >= 2 ? 1 : 0, ht = z >= 1 ? 1 : 0, st = R >= 1 ? 1 : 0, vt = B >= 1 ? 1 : 0, Tt = O >= 1 ? 1 : 0, ot = C - N + Ut, ft = P - L + Ut, at = E - V + Ut, Yt = A - $ + Ut, Jt = C - Q + 2 * Ut, jt = P - W + 2 * Ut, Zt = E - yt + 2 * Ut, _t = A - nt + 2 * Ut, gt = C - ht + 3 * Ut, ct = P - st + 3 * Ut, de = E - vt + 3 * Ut, Rt = A - Tt + 3 * Ut, dt = C - 1 + 4 * Ut, se = P - 1 + 4 * Ut, _e = E - 1 + 4 * Ut, be = A - 1 + 4 * Ut, oe = m & 255, Te = p & 255, pe = b & 255, me = T & 255;
4004
+ let Ce = 0.6 - C * C - P * P - E * E - A * A;
4005
4005
  if (Ce < 0)
4006
4006
  a = 0;
4007
4007
  else {
4008
4008
  const tt = s[oe + s[Te + s[pe + s[me]]]] % 32 * 4;
4009
- Ce *= Ce, a = Ce * Ce * (Mt[tt] * M + Mt[tt + 1] * P + Mt[tt + 2] * E + Mt[tt + 3] * O);
4009
+ Ce *= Ce, a = Ce * Ce * (Mt[tt] * C + Mt[tt + 1] * P + Mt[tt + 2] * E + Mt[tt + 3] * A);
4010
4010
  }
4011
4011
  let At = 0.6 - ot * ot - ft * ft - at * at - Yt * Yt;
4012
4012
  if (At < 0)
@@ -5123,20 +5123,20 @@ class Xs {
5123
5123
  this.rendererSettings.material.blending = t, this.neededToUpdateRender = !0;
5124
5124
  }
5125
5125
  constructor(t) {
5126
- var e, n, i, s, a, o, c, l, h, d, m, p, b, T, g, v, x, _, C, M, P, E, O, z, R, B;
5126
+ var e, n, i, s, a, o, c, l, h, d, m, p, b, T, g, v, _, x, M, C, P, E, A, z, R, B;
5127
5127
  if (this.temp = new G(), this.travelDistance = 0, this.normalMatrix = new De(), this.memory = [], this.listeners = {}, this.firstTimeUpdate = !0, this.autoDestroy = t.autoDestroy === void 0 ? !1 : t.autoDestroy, this.duration = (e = t.duration) !== null && e !== void 0 ? e : 1, this.looping = t.looping === void 0 ? !0 : t.looping, this.prewarm = t.prewarm === void 0 ? !1 : t.prewarm, this.startLife = (n = t.startLife) !== null && n !== void 0 ? n : new it(5), this.startSpeed = (i = t.startSpeed) !== null && i !== void 0 ? i : new it(0), this.startRotation = (s = t.startRotation) !== null && s !== void 0 ? s : new it(0), this.startSize = (a = t.startSize) !== null && a !== void 0 ? a : new it(1), this.startColor = (o = t.startColor) !== null && o !== void 0 ? o : new Xn(new fe(1, 1, 1, 1)), this.emissionOverTime = (c = t.emissionOverTime) !== null && c !== void 0 ? c : new it(10), this.emissionOverDistance = (l = t.emissionOverDistance) !== null && l !== void 0 ? l : new it(0), this.emissionBursts = (h = t.emissionBursts) !== null && h !== void 0 ? h : [], this.onlyUsedByOther = (d = t.onlyUsedByOther) !== null && d !== void 0 ? d : !1, this.emitterShape = (m = t.shape) !== null && m !== void 0 ? m : new Yn(), this.behaviors = (p = t.behaviors) !== null && p !== void 0 ? p : new Array(), this.worldSpace = (b = t.worldSpace) !== null && b !== void 0 ? b : !1, this.rendererEmitterSettings = (T = t.rendererEmitterSettings) !== null && T !== void 0 ? T : {}, t.renderMode === J.StretchedBillBoard) {
5128
- const A = this.rendererEmitterSettings;
5129
- t.speedFactor !== void 0 && (A.speedFactor = t.speedFactor), A.speedFactor = (g = A.speedFactor) !== null && g !== void 0 ? g : 0, A.lengthFactor = (v = A.lengthFactor) !== null && v !== void 0 ? v : 0;
5128
+ const O = this.rendererEmitterSettings;
5129
+ t.speedFactor !== void 0 && (O.speedFactor = t.speedFactor), O.speedFactor = (g = O.speedFactor) !== null && g !== void 0 ? g : 0, O.lengthFactor = (v = O.lengthFactor) !== null && v !== void 0 ? v : 0;
5130
5130
  }
5131
5131
  this.rendererSettings = {
5132
- instancingGeometry: (x = t.instancingGeometry) !== null && x !== void 0 ? x : Sh,
5133
- renderMode: (_ = t.renderMode) !== null && _ !== void 0 ? _ : J.BillBoard,
5134
- renderOrder: (C = t.renderOrder) !== null && C !== void 0 ? C : 0,
5132
+ instancingGeometry: (_ = t.instancingGeometry) !== null && _ !== void 0 ? _ : Sh,
5133
+ renderMode: (x = t.renderMode) !== null && x !== void 0 ? x : J.BillBoard,
5134
+ renderOrder: (M = t.renderOrder) !== null && M !== void 0 ? M : 0,
5135
5135
  material: t.material,
5136
- uTileCount: (M = t.uTileCount) !== null && M !== void 0 ? M : 1,
5136
+ uTileCount: (C = t.uTileCount) !== null && C !== void 0 ? C : 1,
5137
5137
  vTileCount: (P = t.vTileCount) !== null && P !== void 0 ? P : 1,
5138
5138
  blendTiles: (E = t.blendTiles) !== null && E !== void 0 ? E : !1,
5139
- softParticles: (O = t.softParticles) !== null && O !== void 0 ? O : !1,
5139
+ softParticles: (A = t.softParticles) !== null && A !== void 0 ? A : !1,
5140
5140
  softNearFade: (z = t.softNearFade) !== null && z !== void 0 ? z : 0,
5141
5141
  softFarFade: (R = t.softFarFade) !== null && R !== void 0 ? R : 0,
5142
5142
  layers: (B = t.layers) !== null && B !== void 0 ? B : new Br()
@@ -5149,7 +5149,7 @@ class Xs {
5149
5149
  time: 0,
5150
5150
  waitEmiting: 0,
5151
5151
  travelDistance: 0
5152
- }, this.emissionBursts.forEach((A) => A.count.startGen(this.memory)), this.emissionOverDistance.startGen(this.memory), this.emitEnded = !1, this.markForDestroy = !1, this.prewarmed = !1;
5152
+ }, this.emissionBursts.forEach((O) => O.count.startGen(this.memory)), this.emissionOverDistance.startGen(this.memory), this.emitEnded = !1, this.markForDestroy = !1, this.prewarmed = !1;
5153
5153
  }
5154
5154
  pause() {
5155
5155
  this.paused = !0;
@@ -5897,7 +5897,7 @@ class Mh extends wc {
5897
5897
  super(t), this.vector_ = new G(), this.vector2_ = new G(), this.vector3_ = new G(), this.quaternion_ = new rt(), this.quaternion2_ = new rt(), this.quaternion3_ = new rt(), this.rotationMat_ = new De(), this.rotationMat2_ = new De(), this.maxParticles = 1e3, this.setupBuffers(), this.rebuildMaterial();
5898
5898
  }
5899
5899
  buildExpandableBuffers() {
5900
- this.offsetBuffer = new yn(new Float32Array(this.maxParticles * 3), 3), this.offsetBuffer.setUsage(ee), this.geometry.setAttribute("offset", this.offsetBuffer), this.colorBuffer = new yn(new Float32Array(this.maxParticles * 4), 4), this.colorBuffer.setUsage(ee), this.geometry.setAttribute("color", this.colorBuffer), this.settings.renderMode === J.Mesh ? (this.rotationBuffer = new yn(new Float32Array(this.maxParticles * 4), 4), this.rotationBuffer.setUsage(ee), this.geometry.setAttribute("rotation", this.rotationBuffer)) : (this.settings.renderMode === J.BillBoard || this.settings.renderMode === J.HorizontalBillBoard || this.settings.renderMode === J.VerticalBillBoard || this.settings.renderMode === J.StretchedBillBoard) && (this.rotationBuffer = new yn(new Float32Array(this.maxParticles), 1), this.rotationBuffer.setUsage(ee), this.geometry.setAttribute("rotation", this.rotationBuffer)), this.sizeBuffer = new yn(new Float32Array(this.maxParticles * 3), 3), this.sizeBuffer.setUsage(ee), this.geometry.setAttribute("size", this.sizeBuffer), this.uvTileBuffer = new yn(new Float32Array(this.maxParticles), 1), this.uvTileBuffer.setUsage(ee), this.geometry.setAttribute("uvTile", this.uvTileBuffer), this.settings.renderMode === J.StretchedBillBoard && (this.velocityBuffer = new yn(new Float32Array(this.maxParticles * 4), 4), this.velocityBuffer.setUsage(ee), this.geometry.setAttribute("velocity", this.velocityBuffer));
5900
+ this.offsetBuffer = new mn(new Float32Array(this.maxParticles * 3), 3), this.offsetBuffer.setUsage(ee), this.geometry.setAttribute("offset", this.offsetBuffer), this.colorBuffer = new mn(new Float32Array(this.maxParticles * 4), 4), this.colorBuffer.setUsage(ee), this.geometry.setAttribute("color", this.colorBuffer), this.settings.renderMode === J.Mesh ? (this.rotationBuffer = new mn(new Float32Array(this.maxParticles * 4), 4), this.rotationBuffer.setUsage(ee), this.geometry.setAttribute("rotation", this.rotationBuffer)) : (this.settings.renderMode === J.BillBoard || this.settings.renderMode === J.HorizontalBillBoard || this.settings.renderMode === J.VerticalBillBoard || this.settings.renderMode === J.StretchedBillBoard) && (this.rotationBuffer = new mn(new Float32Array(this.maxParticles), 1), this.rotationBuffer.setUsage(ee), this.geometry.setAttribute("rotation", this.rotationBuffer)), this.sizeBuffer = new mn(new Float32Array(this.maxParticles * 3), 3), this.sizeBuffer.setUsage(ee), this.geometry.setAttribute("size", this.sizeBuffer), this.uvTileBuffer = new mn(new Float32Array(this.maxParticles), 1), this.uvTileBuffer.setUsage(ee), this.geometry.setAttribute("uvTile", this.uvTileBuffer), this.settings.renderMode === J.StretchedBillBoard && (this.velocityBuffer = new mn(new Float32Array(this.maxParticles * 4), 4), this.velocityBuffer.setUsage(ee), this.geometry.setAttribute("velocity", this.velocityBuffer));
5901
5901
  }
5902
5902
  setupBuffers() {
5903
5903
  this.geometry && this.geometry.dispose(), this.geometry = new jl(), this.geometry.setIndex(this.settings.instancingGeometry.getIndex()), this.settings.instancingGeometry.hasAttribute("normal") && this.geometry.setAttribute("normal", this.settings.instancingGeometry.getAttribute("normal")), this.geometry.setAttribute("position", this.settings.instancingGeometry.getAttribute("position")), this.geometry.setAttribute("uv", this.settings.instancingGeometry.getAttribute("uv")), this.buildExpandableBuffers();
@@ -6164,21 +6164,21 @@ class Eh extends wc {
6164
6164
  i.emitter.matrixWorld.decompose(a, s, o);
6165
6165
  const c = i.particles, l = i.particleNum, h = this.settings.uTileCount, d = this.settings.vTileCount, m = 1 / h, p = 1 / d;
6166
6166
  for (let b = 0; b < l; b++) {
6167
- const T = c[b], g = T.uvTile % d, v = Math.floor(T.uvTile / d + 1e-3), x = T.previous.values();
6168
- let _ = x.next(), C = _.value, M = C;
6169
- _.done || (_ = x.next());
6167
+ const T = c[b], g = T.uvTile % d, v = Math.floor(T.uvTile / d + 1e-3), _ = T.previous.values();
6168
+ let x = _.next(), M = x.value, C = M;
6169
+ x.done || (x = _.next());
6170
6170
  let P;
6171
- _.value !== void 0 ? P = _.value : P = M;
6171
+ x.value !== void 0 ? P = x.value : P = C;
6172
6172
  for (let E = 0; E < T.previous.length; E++, t += 2) {
6173
- if (this.positionBuffer.setXYZ(t, M.position.x, M.position.y, M.position.z), this.positionBuffer.setXYZ(t + 1, M.position.x, M.position.y, M.position.z), i.worldSpace ? (this.positionBuffer.setXYZ(t, M.position.x, M.position.y, M.position.z), this.positionBuffer.setXYZ(t + 1, M.position.x, M.position.y, M.position.z)) : (T.parentMatrix ? this.vector_.copy(M.position).applyMatrix4(T.parentMatrix) : this.vector_.copy(M.position).applyMatrix4(i.emitter.matrixWorld), this.positionBuffer.setXYZ(t, this.vector_.x, this.vector_.y, this.vector_.z), this.positionBuffer.setXYZ(t + 1, this.vector_.x, this.vector_.y, this.vector_.z)), i.worldSpace ? (this.previousBuffer.setXYZ(t, C.position.x, C.position.y, C.position.z), this.previousBuffer.setXYZ(t + 1, C.position.x, C.position.y, C.position.z)) : (T.parentMatrix ? this.vector_.copy(C.position).applyMatrix4(T.parentMatrix) : this.vector_.copy(C.position).applyMatrix4(i.emitter.matrixWorld), this.previousBuffer.setXYZ(t, this.vector_.x, this.vector_.y, this.vector_.z), this.previousBuffer.setXYZ(t + 1, this.vector_.x, this.vector_.y, this.vector_.z)), i.worldSpace ? (this.nextBuffer.setXYZ(t, P.position.x, P.position.y, P.position.z), this.nextBuffer.setXYZ(t + 1, P.position.x, P.position.y, P.position.z)) : (T.parentMatrix ? this.vector_.copy(P.position).applyMatrix4(T.parentMatrix) : this.vector_.copy(P.position).applyMatrix4(i.emitter.matrixWorld), this.nextBuffer.setXYZ(t, this.vector_.x, this.vector_.y, this.vector_.z), this.nextBuffer.setXYZ(t + 1, this.vector_.x, this.vector_.y, this.vector_.z)), this.sideBuffer.setX(t, -1), this.sideBuffer.setX(t + 1, 1), i.worldSpace)
6174
- this.widthBuffer.setX(t, M.size), this.widthBuffer.setX(t + 1, M.size);
6173
+ if (this.positionBuffer.setXYZ(t, C.position.x, C.position.y, C.position.z), this.positionBuffer.setXYZ(t + 1, C.position.x, C.position.y, C.position.z), i.worldSpace ? (this.positionBuffer.setXYZ(t, C.position.x, C.position.y, C.position.z), this.positionBuffer.setXYZ(t + 1, C.position.x, C.position.y, C.position.z)) : (T.parentMatrix ? this.vector_.copy(C.position).applyMatrix4(T.parentMatrix) : this.vector_.copy(C.position).applyMatrix4(i.emitter.matrixWorld), this.positionBuffer.setXYZ(t, this.vector_.x, this.vector_.y, this.vector_.z), this.positionBuffer.setXYZ(t + 1, this.vector_.x, this.vector_.y, this.vector_.z)), i.worldSpace ? (this.previousBuffer.setXYZ(t, M.position.x, M.position.y, M.position.z), this.previousBuffer.setXYZ(t + 1, M.position.x, M.position.y, M.position.z)) : (T.parentMatrix ? this.vector_.copy(M.position).applyMatrix4(T.parentMatrix) : this.vector_.copy(M.position).applyMatrix4(i.emitter.matrixWorld), this.previousBuffer.setXYZ(t, this.vector_.x, this.vector_.y, this.vector_.z), this.previousBuffer.setXYZ(t + 1, this.vector_.x, this.vector_.y, this.vector_.z)), i.worldSpace ? (this.nextBuffer.setXYZ(t, P.position.x, P.position.y, P.position.z), this.nextBuffer.setXYZ(t + 1, P.position.x, P.position.y, P.position.z)) : (T.parentMatrix ? this.vector_.copy(P.position).applyMatrix4(T.parentMatrix) : this.vector_.copy(P.position).applyMatrix4(i.emitter.matrixWorld), this.nextBuffer.setXYZ(t, this.vector_.x, this.vector_.y, this.vector_.z), this.nextBuffer.setXYZ(t + 1, this.vector_.x, this.vector_.y, this.vector_.z)), this.sideBuffer.setX(t, -1), this.sideBuffer.setX(t + 1, 1), i.worldSpace)
6174
+ this.widthBuffer.setX(t, C.size), this.widthBuffer.setX(t + 1, C.size);
6175
6175
  else if (T.parentMatrix)
6176
- this.widthBuffer.setX(t, M.size), this.widthBuffer.setX(t + 1, M.size);
6176
+ this.widthBuffer.setX(t, C.size), this.widthBuffer.setX(t + 1, C.size);
6177
6177
  else {
6178
- const O = (Math.abs(o.x) + Math.abs(o.y) + Math.abs(o.z)) / 3;
6179
- this.widthBuffer.setX(t, M.size * O), this.widthBuffer.setX(t + 1, M.size * O);
6178
+ const A = (Math.abs(o.x) + Math.abs(o.y) + Math.abs(o.z)) / 3;
6179
+ this.widthBuffer.setX(t, C.size * A), this.widthBuffer.setX(t + 1, C.size * A);
6180
6180
  }
6181
- this.uvBuffer.setXY(t, (E / T.previous.length + g) * m, (d - v - 1) * p), this.uvBuffer.setXY(t + 1, (E / T.previous.length + g) * m, (d - v) * p), this.colorBuffer.setXYZW(t, M.color.x, M.color.y, M.color.z, M.color.w), this.colorBuffer.setXYZW(t + 1, M.color.x, M.color.y, M.color.z, M.color.w), E + 1 < T.previous.length && (this.indexBuffer.setX(e * 3, t), this.indexBuffer.setX(e * 3 + 1, t + 1), this.indexBuffer.setX(e * 3 + 2, t + 2), e++, this.indexBuffer.setX(e * 3, t + 2), this.indexBuffer.setX(e * 3 + 1, t + 1), this.indexBuffer.setX(e * 3 + 2, t + 3), e++), C = M, M = P, _.done || (_ = x.next(), _.value !== void 0 && (P = _.value));
6181
+ this.uvBuffer.setXY(t, (E / T.previous.length + g) * m, (d - v - 1) * p), this.uvBuffer.setXY(t + 1, (E / T.previous.length + g) * m, (d - v) * p), this.colorBuffer.setXYZW(t, C.color.x, C.color.y, C.color.z, C.color.w), this.colorBuffer.setXYZW(t + 1, C.color.x, C.color.y, C.color.z, C.color.w), E + 1 < T.previous.length && (this.indexBuffer.setX(e * 3, t), this.indexBuffer.setX(e * 3 + 1, t + 1), this.indexBuffer.setX(e * 3 + 2, t + 2), e++, this.indexBuffer.setX(e * 3, t + 2), this.indexBuffer.setX(e * 3 + 1, t + 1), this.indexBuffer.setX(e * 3 + 2, t + 3), e++), M = C, C = P, x.done || (x = _.next(), x.value !== void 0 && (P = x.value));
6182
6182
  }
6183
6183
  }
6184
6184
  }), this.positionBuffer.clearUpdateRanges(), this.positionBuffer.addUpdateRange(0, t * 3), this.positionBuffer.needsUpdate = !0, this.previousBuffer.clearUpdateRanges(), this.previousBuffer.addUpdateRange(0, t * 3), this.previousBuffer.needsUpdate = !0, this.nextBuffer.clearUpdateRanges(), this.nextBuffer.addUpdateRange(0, t * 3), this.nextBuffer.needsUpdate = !0, this.sideBuffer.clearUpdateRanges(), this.sideBuffer.addUpdateRange(0, t), this.sideBuffer.needsUpdate = !0, this.widthBuffer.clearUpdateRanges(), this.widthBuffer.addUpdateRange(0, t), this.widthBuffer.needsUpdate = !0, this.uvBuffer.clearUpdateRanges(), this.uvBuffer.addUpdateRange(0, t * 2), this.uvBuffer.needsUpdate = !0, this.colorBuffer.clearUpdateRanges(), this.colorBuffer.addUpdateRange(0, t * 4), this.colorBuffer.needsUpdate = !0, this.indexBuffer.clearUpdateRanges(), this.indexBuffer.addUpdateRange(0, e * 3), this.indexBuffer.needsUpdate = !0, this.geometry.setDrawRange(0, e * 3);
@@ -6438,16 +6438,16 @@ function Pd(r = Math.random) {
6438
6438
  const t = Rh(r), e = new Float64Array(t).map((a) => pr[a % 32 * 4]), n = new Float64Array(t).map((a) => pr[a % 32 * 4 + 1]), i = new Float64Array(t).map((a) => pr[a % 32 * 4 + 2]), s = new Float64Array(t).map((a) => pr[a % 32 * 4 + 3]);
6439
6439
  return function(o, c, l, h) {
6440
6440
  let d, m, p, b, T;
6441
- const g = (o + c + l + h) * kh, v = dr(o + g), x = dr(c + g), _ = dr(l + g), C = dr(h + g), M = (v + x + _ + C) * Dt, P = v - M, E = x - M, O = _ - M, z = C - M, R = o - P, B = c - E, A = l - O, N = h - z;
6441
+ const g = (o + c + l + h) * kh, v = dr(o + g), _ = dr(c + g), x = dr(l + g), M = dr(h + g), C = (v + _ + x + M) * Dt, P = v - C, E = _ - C, A = x - C, z = M - C, R = o - P, B = c - E, O = l - A, N = h - z;
6442
6442
  let L = 0, V = 0, $ = 0, Q = 0;
6443
- R > B ? L++ : V++, R > A ? L++ : $++, R > N ? L++ : Q++, B > A ? V++ : $++, B > N ? V++ : Q++, A > N ? $++ : Q++;
6444
- const W = L >= 3 ? 1 : 0, yt = V >= 3 ? 1 : 0, nt = $ >= 3 ? 1 : 0, ht = Q >= 3 ? 1 : 0, st = L >= 2 ? 1 : 0, vt = V >= 2 ? 1 : 0, Tt = $ >= 2 ? 1 : 0, ot = Q >= 2 ? 1 : 0, ft = L >= 1 ? 1 : 0, at = V >= 1 ? 1 : 0, Yt = $ >= 1 ? 1 : 0, Jt = Q >= 1 ? 1 : 0, jt = R - W + Dt, Zt = B - yt + Dt, _t = A - nt + Dt, gt = N - ht + Dt, ct = R - st + 2 * Dt, de = B - vt + 2 * Dt, Rt = A - Tt + 2 * Dt, dt = N - ot + 2 * Dt, se = R - ft + 3 * Dt, _e = B - at + 3 * Dt, be = A - Yt + 3 * Dt, oe = N - Jt + 3 * Dt, Te = R - 1 + 4 * Dt, pe = B - 1 + 4 * Dt, me = A - 1 + 4 * Dt, Ce = N - 1 + 4 * Dt, At = v & 255, Kt = x & 255, le = _ & 255, Qt = C & 255;
6445
- let tt = 0.6 - R * R - B * B - A * A - N * N;
6443
+ R > B ? L++ : V++, R > O ? L++ : $++, R > N ? L++ : Q++, B > O ? V++ : $++, B > N ? V++ : Q++, O > N ? $++ : Q++;
6444
+ const W = L >= 3 ? 1 : 0, yt = V >= 3 ? 1 : 0, nt = $ >= 3 ? 1 : 0, ht = Q >= 3 ? 1 : 0, st = L >= 2 ? 1 : 0, vt = V >= 2 ? 1 : 0, Tt = $ >= 2 ? 1 : 0, ot = Q >= 2 ? 1 : 0, ft = L >= 1 ? 1 : 0, at = V >= 1 ? 1 : 0, Yt = $ >= 1 ? 1 : 0, Jt = Q >= 1 ? 1 : 0, jt = R - W + Dt, Zt = B - yt + Dt, _t = O - nt + Dt, gt = N - ht + Dt, ct = R - st + 2 * Dt, de = B - vt + 2 * Dt, Rt = O - Tt + 2 * Dt, dt = N - ot + 2 * Dt, se = R - ft + 3 * Dt, _e = B - at + 3 * Dt, be = O - Yt + 3 * Dt, oe = N - Jt + 3 * Dt, Te = R - 1 + 4 * Dt, pe = B - 1 + 4 * Dt, me = O - 1 + 4 * Dt, Ce = N - 1 + 4 * Dt, At = v & 255, Kt = _ & 255, le = x & 255, Qt = M & 255;
6445
+ let tt = 0.6 - R * R - B * B - O * O - N * N;
6446
6446
  if (tt < 0)
6447
6447
  d = 0;
6448
6448
  else {
6449
6449
  const ut = At + t[Kt + t[le + t[Qt]]];
6450
- tt *= tt, d = tt * tt * (e[ut] * R + n[ut] * B + i[ut] * A + s[ut] * N);
6450
+ tt *= tt, d = tt * tt * (e[ut] * R + n[ut] * B + i[ut] * O + s[ut] * N);
6451
6451
  }
6452
6452
  let Me = 0.6 - jt * jt - Zt * Zt - _t * _t - gt * gt;
6453
6453
  if (Me < 0)
@@ -7947,8 +7947,8 @@ function Dh() {
7947
7947
  if (b[T].payloadType === p || b[T].preferredPayloadType === p)
7948
7948
  return b[T];
7949
7949
  }, m = function(p, b, T, g) {
7950
- var v = d(p.parameters.apt, T), x = d(b.parameters.apt, g);
7951
- return v && x && v.name.toLowerCase() === x.name.toLowerCase();
7950
+ var v = d(p.parameters.apt, T), _ = d(b.parameters.apt, g);
7951
+ return v && _ && v.name.toLowerCase() === _.name.toLowerCase();
7952
7952
  };
7953
7953
  return c.codecs.forEach(function(p) {
7954
7954
  for (var b = 0; b < l.codecs.length; b++) {
@@ -8024,16 +8024,16 @@ function Dh() {
8024
8024
  { track: g }
8025
8025
  ));
8026
8026
  }
8027
- function m(g, v, x, _) {
8028
- var C = new Event("track");
8029
- C.track = v, C.receiver = x, C.transceiver = { receiver: x }, C.streams = _, c.setTimeout(function() {
8030
- g._dispatchEvent("track", C);
8027
+ function m(g, v, _, x) {
8028
+ var M = new Event("track");
8029
+ M.track = v, M.receiver = _, M.transceiver = { receiver: _ }, M.streams = x, c.setTimeout(function() {
8030
+ g._dispatchEvent("track", M);
8031
8031
  });
8032
8032
  }
8033
8033
  var p = function(g) {
8034
- var v = this, x = document.createDocumentFragment();
8035
- if (["addEventListener", "removeEventListener", "dispatchEvent"].forEach(function(C) {
8036
- v[C] = x[C].bind(x);
8034
+ var v = this, _ = document.createDocumentFragment();
8035
+ if (["addEventListener", "removeEventListener", "dispatchEvent"].forEach(function(M) {
8036
+ v[M] = _[M].bind(_);
8037
8037
  }), this.canTrickleIceCandidates = null, this.needNegotiation = !1, this.localStreams = [], this.remoteStreams = [], this._localDescription = null, this._remoteDescription = null, this.signalingState = "stable", this.iceConnectionState = "new", this.connectionState = "new", this.iceGatheringState = "new", g = JSON.parse(JSON.stringify(g || {})), this.usingBundle = g.bundlePolicy === "max-bundle", g.rtcpMuxPolicy === "negotiate")
8038
8038
  throw o(
8039
8039
  "NotSupportedError",
@@ -8057,7 +8057,7 @@ function Dh() {
8057
8057
  break;
8058
8058
  }
8059
8059
  if (g.iceServers = n(g.iceServers || [], l), this._iceGatherers = [], g.iceCandidatePoolSize)
8060
- for (var _ = g.iceCandidatePoolSize; _ > 0; _--)
8060
+ for (var x = g.iceCandidatePoolSize; x > 0; x--)
8061
8061
  this._iceGatherers.push(new c.RTCIceGatherer({
8062
8062
  iceServers: g.iceServers,
8063
8063
  gatherPolicy: g.iceTransportPolicy
@@ -8088,7 +8088,7 @@ function Dh() {
8088
8088
  }, p.prototype.getRemoteStreams = function() {
8089
8089
  return this.remoteStreams;
8090
8090
  }, p.prototype._createTransceiver = function(g, v) {
8091
- var x = this.transceivers.length > 0, _ = {
8091
+ var _ = this.transceivers.length > 0, x = {
8092
8092
  track: null,
8093
8093
  iceGatherer: null,
8094
8094
  iceTransport: null,
@@ -8105,45 +8105,45 @@ function Dh() {
8105
8105
  associatedRemoteMediaStreams: [],
8106
8106
  wantReceive: !0
8107
8107
  };
8108
- if (this.usingBundle && x)
8109
- _.iceTransport = this.transceivers[0].iceTransport, _.dtlsTransport = this.transceivers[0].dtlsTransport;
8108
+ if (this.usingBundle && _)
8109
+ x.iceTransport = this.transceivers[0].iceTransport, x.dtlsTransport = this.transceivers[0].dtlsTransport;
8110
8110
  else {
8111
- var C = this._createIceAndDtlsTransports();
8112
- _.iceTransport = C.iceTransport, _.dtlsTransport = C.dtlsTransport;
8111
+ var M = this._createIceAndDtlsTransports();
8112
+ x.iceTransport = M.iceTransport, x.dtlsTransport = M.dtlsTransport;
8113
8113
  }
8114
- return v || this.transceivers.push(_), _;
8114
+ return v || this.transceivers.push(x), x;
8115
8115
  }, p.prototype.addTrack = function(g, v) {
8116
8116
  if (this._isClosed)
8117
8117
  throw o(
8118
8118
  "InvalidStateError",
8119
8119
  "Attempted to call addTrack on a closed peerconnection."
8120
8120
  );
8121
- var x = this.transceivers.find(function(M) {
8122
- return M.track === g;
8121
+ var _ = this.transceivers.find(function(C) {
8122
+ return C.track === g;
8123
8123
  });
8124
- if (x)
8124
+ if (_)
8125
8125
  throw o("InvalidAccessError", "Track already exists.");
8126
- for (var _, C = 0; C < this.transceivers.length; C++)
8127
- !this.transceivers[C].track && this.transceivers[C].kind === g.kind && (_ = this.transceivers[C]);
8128
- return _ || (_ = this._createTransceiver(g.kind)), this._maybeFireNegotiationNeeded(), this.localStreams.indexOf(v) === -1 && this.localStreams.push(v), _.track = g, _.stream = v, _.rtpSender = new c.RTCRtpSender(
8126
+ for (var x, M = 0; M < this.transceivers.length; M++)
8127
+ !this.transceivers[M].track && this.transceivers[M].kind === g.kind && (x = this.transceivers[M]);
8128
+ return x || (x = this._createTransceiver(g.kind)), this._maybeFireNegotiationNeeded(), this.localStreams.indexOf(v) === -1 && this.localStreams.push(v), x.track = g, x.stream = v, x.rtpSender = new c.RTCRtpSender(
8129
8129
  g,
8130
- _.dtlsTransport
8131
- ), _.rtpSender;
8130
+ x.dtlsTransport
8131
+ ), x.rtpSender;
8132
8132
  }, p.prototype.addStream = function(g) {
8133
8133
  var v = this;
8134
8134
  if (l >= 15025)
8135
- g.getTracks().forEach(function(_) {
8136
- v.addTrack(_, g);
8135
+ g.getTracks().forEach(function(x) {
8136
+ v.addTrack(x, g);
8137
8137
  });
8138
8138
  else {
8139
- var x = g.clone();
8140
- g.getTracks().forEach(function(_, C) {
8141
- var M = x.getTracks()[C];
8142
- _.addEventListener("enabled", function(P) {
8143
- M.enabled = P.enabled;
8139
+ var _ = g.clone();
8140
+ g.getTracks().forEach(function(x, M) {
8141
+ var C = _.getTracks()[M];
8142
+ x.addEventListener("enabled", function(P) {
8143
+ C.enabled = P.enabled;
8144
8144
  });
8145
- }), x.getTracks().forEach(function(_) {
8146
- v.addTrack(_, x);
8145
+ }), _.getTracks().forEach(function(x) {
8146
+ v.addTrack(x, _);
8147
8147
  });
8148
8148
  }
8149
8149
  }, p.prototype.removeTrack = function(g) {
@@ -8154,27 +8154,27 @@ function Dh() {
8154
8154
  );
8155
8155
  if (!(g instanceof c.RTCRtpSender))
8156
8156
  throw new TypeError("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.");
8157
- var v = this.transceivers.find(function(C) {
8158
- return C.rtpSender === g;
8157
+ var v = this.transceivers.find(function(M) {
8158
+ return M.rtpSender === g;
8159
8159
  });
8160
8160
  if (!v)
8161
8161
  throw o(
8162
8162
  "InvalidAccessError",
8163
8163
  "Sender was not created by this connection."
8164
8164
  );
8165
- var x = v.stream;
8165
+ var _ = v.stream;
8166
8166
  v.rtpSender.stop(), v.rtpSender = null, v.track = null, v.stream = null;
8167
- var _ = this.transceivers.map(function(C) {
8168
- return C.stream;
8167
+ var x = this.transceivers.map(function(M) {
8168
+ return M.stream;
8169
8169
  });
8170
- _.indexOf(x) === -1 && this.localStreams.indexOf(x) > -1 && this.localStreams.splice(this.localStreams.indexOf(x), 1), this._maybeFireNegotiationNeeded();
8170
+ x.indexOf(_) === -1 && this.localStreams.indexOf(_) > -1 && this.localStreams.splice(this.localStreams.indexOf(_), 1), this._maybeFireNegotiationNeeded();
8171
8171
  }, p.prototype.removeStream = function(g) {
8172
8172
  var v = this;
8173
- g.getTracks().forEach(function(x) {
8174
- var _ = v.getSenders().find(function(C) {
8175
- return C.track === x;
8173
+ g.getTracks().forEach(function(_) {
8174
+ var x = v.getSenders().find(function(M) {
8175
+ return M.track === _;
8176
8176
  });
8177
- _ && v.removeTrack(_);
8177
+ x && v.removeTrack(x);
8178
8178
  });
8179
8179
  }, p.prototype.getSenders = function() {
8180
8180
  return this.transceivers.filter(function(g) {
@@ -8189,42 +8189,42 @@ function Dh() {
8189
8189
  return g.rtpReceiver;
8190
8190
  });
8191
8191
  }, p.prototype._createIceGatherer = function(g, v) {
8192
- var x = this;
8192
+ var _ = this;
8193
8193
  if (v && g > 0)
8194
8194
  return this.transceivers[0].iceGatherer;
8195
8195
  if (this._iceGatherers.length)
8196
8196
  return this._iceGatherers.shift();
8197
- var _ = new c.RTCIceGatherer({
8197
+ var x = new c.RTCIceGatherer({
8198
8198
  iceServers: this._config.iceServers,
8199
8199
  gatherPolicy: this._config.iceTransportPolicy
8200
8200
  });
8201
8201
  return Object.defineProperty(
8202
- _,
8202
+ x,
8203
8203
  "state",
8204
8204
  { value: "new", writable: !0 }
8205
- ), this.transceivers[g].bufferedCandidateEvents = [], this.transceivers[g].bufferCandidates = function(C) {
8206
- var M = !C.candidate || Object.keys(C.candidate).length === 0;
8207
- _.state = M ? "completed" : "gathering", x.transceivers[g].bufferedCandidateEvents !== null && x.transceivers[g].bufferedCandidateEvents.push(C);
8208
- }, _.addEventListener(
8205
+ ), this.transceivers[g].bufferedCandidateEvents = [], this.transceivers[g].bufferCandidates = function(M) {
8206
+ var C = !M.candidate || Object.keys(M.candidate).length === 0;
8207
+ x.state = C ? "completed" : "gathering", _.transceivers[g].bufferedCandidateEvents !== null && _.transceivers[g].bufferedCandidateEvents.push(M);
8208
+ }, x.addEventListener(
8209
8209
  "localcandidate",
8210
8210
  this.transceivers[g].bufferCandidates
8211
- ), _;
8211
+ ), x;
8212
8212
  }, p.prototype._gather = function(g, v) {
8213
- var x = this, _ = this.transceivers[v].iceGatherer;
8214
- if (!_.onlocalcandidate) {
8215
- var C = this.transceivers[v].bufferedCandidateEvents;
8216
- this.transceivers[v].bufferedCandidateEvents = null, _.removeEventListener(
8213
+ var _ = this, x = this.transceivers[v].iceGatherer;
8214
+ if (!x.onlocalcandidate) {
8215
+ var M = this.transceivers[v].bufferedCandidateEvents;
8216
+ this.transceivers[v].bufferedCandidateEvents = null, x.removeEventListener(
8217
8217
  "localcandidate",
8218
8218
  this.transceivers[v].bufferCandidates
8219
- ), _.onlocalcandidate = function(M) {
8220
- if (!(x.usingBundle && v > 0)) {
8219
+ ), x.onlocalcandidate = function(C) {
8220
+ if (!(_.usingBundle && v > 0)) {
8221
8221
  var P = new Event("icecandidate");
8222
8222
  P.candidate = { sdpMid: g, sdpMLineIndex: v };
8223
- var E = M.candidate, O = !E || Object.keys(E).length === 0;
8224
- if (O)
8225
- (_.state === "new" || _.state === "gathering") && (_.state = "completed");
8223
+ var E = C.candidate, A = !E || Object.keys(E).length === 0;
8224
+ if (A)
8225
+ (x.state === "new" || x.state === "gathering") && (x.state = "completed");
8226
8226
  else {
8227
- _.state === "new" && (_.state = "gathering"), E.component = 1, E.ufrag = _.getLocalParameters().usernameFragment;
8227
+ x.state === "new" && (x.state = "gathering"), E.component = 1, E.ufrag = x.getLocalParameters().usernameFragment;
8228
8228
  var z = r.writeCandidate(E);
8229
8229
  P.candidate = Object.assign(
8230
8230
  P.candidate,
@@ -8238,18 +8238,18 @@ function Dh() {
8238
8238
  };
8239
8239
  };
8240
8240
  }
8241
- var R = r.getMediaSections(x._localDescription.sdp);
8242
- O ? R[P.candidate.sdpMLineIndex] += `a=end-of-candidates\r
8241
+ var R = r.getMediaSections(_._localDescription.sdp);
8242
+ A ? R[P.candidate.sdpMLineIndex] += `a=end-of-candidates\r
8243
8243
  ` : R[P.candidate.sdpMLineIndex] += "a=" + P.candidate.candidate + `\r
8244
- `, x._localDescription.sdp = r.getDescription(x._localDescription.sdp) + R.join("");
8245
- var B = x.transceivers.every(function(A) {
8246
- return A.iceGatherer && A.iceGatherer.state === "completed";
8244
+ `, _._localDescription.sdp = r.getDescription(_._localDescription.sdp) + R.join("");
8245
+ var B = _.transceivers.every(function(O) {
8246
+ return O.iceGatherer && O.iceGatherer.state === "completed";
8247
8247
  });
8248
- x.iceGatheringState !== "gathering" && (x.iceGatheringState = "gathering", x._emitGatheringStateChange()), O || x._dispatchEvent("icecandidate", P), B && (x._dispatchEvent("icecandidate", new Event("icecandidate")), x.iceGatheringState = "complete", x._emitGatheringStateChange());
8248
+ _.iceGatheringState !== "gathering" && (_.iceGatheringState = "gathering", _._emitGatheringStateChange()), A || _._dispatchEvent("icecandidate", P), B && (_._dispatchEvent("icecandidate", new Event("icecandidate")), _.iceGatheringState = "complete", _._emitGatheringStateChange());
8249
8249
  }
8250
8250
  }, c.setTimeout(function() {
8251
- C.forEach(function(M) {
8252
- _.onlocalcandidate(M);
8251
+ M.forEach(function(C) {
8252
+ x.onlocalcandidate(C);
8253
8253
  });
8254
8254
  }, 0);
8255
8255
  }
@@ -8258,39 +8258,39 @@ function Dh() {
8258
8258
  v.onicestatechange = function() {
8259
8259
  g._updateIceConnectionState(), g._updateConnectionState();
8260
8260
  };
8261
- var x = new c.RTCDtlsTransport(v);
8262
- return x.ondtlsstatechange = function() {
8261
+ var _ = new c.RTCDtlsTransport(v);
8262
+ return _.ondtlsstatechange = function() {
8263
8263
  g._updateConnectionState();
8264
- }, x.onerror = function() {
8264
+ }, _.onerror = function() {
8265
8265
  Object.defineProperty(
8266
- x,
8266
+ _,
8267
8267
  "state",
8268
8268
  { value: "failed", writable: !0 }
8269
8269
  ), g._updateConnectionState();
8270
8270
  }, {
8271
8271
  iceTransport: v,
8272
- dtlsTransport: x
8272
+ dtlsTransport: _
8273
8273
  };
8274
8274
  }, p.prototype._disposeIceAndDtlsTransports = function(g) {
8275
8275
  var v = this.transceivers[g].iceGatherer;
8276
8276
  v && (delete v.onlocalcandidate, delete this.transceivers[g].iceGatherer);
8277
- var x = this.transceivers[g].iceTransport;
8278
- x && (delete x.onicestatechange, delete this.transceivers[g].iceTransport);
8279
- var _ = this.transceivers[g].dtlsTransport;
8280
- _ && (delete _.ondtlsstatechange, delete _.onerror, delete this.transceivers[g].dtlsTransport);
8281
- }, p.prototype._transceive = function(g, v, x) {
8282
- var _ = i(
8277
+ var _ = this.transceivers[g].iceTransport;
8278
+ _ && (delete _.onicestatechange, delete this.transceivers[g].iceTransport);
8279
+ var x = this.transceivers[g].dtlsTransport;
8280
+ x && (delete x.ondtlsstatechange, delete x.onerror, delete this.transceivers[g].dtlsTransport);
8281
+ }, p.prototype._transceive = function(g, v, _) {
8282
+ var x = i(
8283
8283
  g.localCapabilities,
8284
8284
  g.remoteCapabilities
8285
8285
  );
8286
- v && g.rtpSender && (_.encodings = g.sendEncodingParameters, _.rtcp = {
8286
+ v && g.rtpSender && (x.encodings = g.sendEncodingParameters, x.rtcp = {
8287
8287
  cname: r.localCName,
8288
8288
  compound: g.rtcpParameters.compound
8289
- }, g.recvEncodingParameters.length && (_.rtcp.ssrc = g.recvEncodingParameters[0].ssrc), g.rtpSender.send(_)), x && g.rtpReceiver && _.codecs.length > 0 && (g.kind === "video" && g.recvEncodingParameters && l < 15019 && g.recvEncodingParameters.forEach(function(C) {
8290
- delete C.rtx;
8291
- }), g.recvEncodingParameters.length ? _.encodings = g.recvEncodingParameters : _.encodings = [{}], _.rtcp = {
8289
+ }, g.recvEncodingParameters.length && (x.rtcp.ssrc = g.recvEncodingParameters[0].ssrc), g.rtpSender.send(x)), _ && g.rtpReceiver && x.codecs.length > 0 && (g.kind === "video" && g.recvEncodingParameters && l < 15019 && g.recvEncodingParameters.forEach(function(M) {
8290
+ delete M.rtx;
8291
+ }), g.recvEncodingParameters.length ? x.encodings = g.recvEncodingParameters : x.encodings = [{}], x.rtcp = {
8292
8292
  compound: g.rtcpParameters.compound
8293
- }, g.rtcpParameters.cname && (_.rtcp.cname = g.rtcpParameters.cname), g.sendEncodingParameters.length && (_.rtcp.ssrc = g.sendEncodingParameters[0].ssrc), g.rtpReceiver.receive(_));
8293
+ }, g.rtcpParameters.cname && (x.rtcp.cname = g.rtcpParameters.cname), g.sendEncodingParameters.length && (x.rtcp.ssrc = g.sendEncodingParameters[0].ssrc), g.rtpReceiver.receive(x));
8294
8294
  }, p.prototype.setLocalDescription = function(g) {
8295
8295
  var v = this;
8296
8296
  if (["offer", "answer"].indexOf(g.type) === -1)
@@ -8307,38 +8307,38 @@ function Dh() {
8307
8307
  "InvalidStateError",
8308
8308
  "Can not set local " + g.type + " in state " + v.signalingState
8309
8309
  ));
8310
- var x, _;
8310
+ var _, x;
8311
8311
  if (g.type === "offer")
8312
- x = r.splitSections(g.sdp), _ = x.shift(), x.forEach(function(M, P) {
8313
- var E = r.parseRtpParameters(M);
8312
+ _ = r.splitSections(g.sdp), x = _.shift(), _.forEach(function(C, P) {
8313
+ var E = r.parseRtpParameters(C);
8314
8314
  v.transceivers[P].localCapabilities = E;
8315
- }), v.transceivers.forEach(function(M, P) {
8316
- v._gather(M.mid, P);
8315
+ }), v.transceivers.forEach(function(C, P) {
8316
+ v._gather(C.mid, P);
8317
8317
  });
8318
8318
  else if (g.type === "answer") {
8319
- x = r.splitSections(v._remoteDescription.sdp), _ = x.shift();
8320
- var C = r.matchPrefix(
8321
- _,
8319
+ _ = r.splitSections(v._remoteDescription.sdp), x = _.shift();
8320
+ var M = r.matchPrefix(
8321
+ x,
8322
8322
  "a=ice-lite"
8323
8323
  ).length > 0;
8324
- x.forEach(function(M, P) {
8325
- var E = v.transceivers[P], O = E.iceGatherer, z = E.iceTransport, R = E.dtlsTransport, B = E.localCapabilities, A = E.remoteCapabilities, N = r.isRejected(M) && r.matchPrefix(M, "a=bundle-only").length === 0;
8324
+ _.forEach(function(C, P) {
8325
+ var E = v.transceivers[P], A = E.iceGatherer, z = E.iceTransport, R = E.dtlsTransport, B = E.localCapabilities, O = E.remoteCapabilities, N = r.isRejected(C) && r.matchPrefix(C, "a=bundle-only").length === 0;
8326
8326
  if (!N && !E.rejected) {
8327
8327
  var L = r.getIceParameters(
8328
- M,
8329
- _
8328
+ C,
8329
+ x
8330
8330
  ), V = r.getDtlsParameters(
8331
- M,
8332
- _
8331
+ C,
8332
+ x
8333
8333
  );
8334
- C && (V.role = "server"), (!v.usingBundle || P === 0) && (v._gather(E.mid, P), z.state === "new" && z.start(
8335
- O,
8334
+ M && (V.role = "server"), (!v.usingBundle || P === 0) && (v._gather(E.mid, P), z.state === "new" && z.start(
8335
+ A,
8336
8336
  L,
8337
- C ? "controlling" : "controlled"
8337
+ M ? "controlling" : "controlled"
8338
8338
  ), R.state === "new" && R.start(V));
8339
8339
  var $ = i(
8340
8340
  B,
8341
- A
8341
+ O
8342
8342
  );
8343
8343
  v._transceive(
8344
8344
  E,
@@ -8368,46 +8368,46 @@ function Dh() {
8368
8368
  "InvalidStateError",
8369
8369
  "Can not set remote " + g.type + " in state " + v.signalingState
8370
8370
  ));
8371
- var x = {};
8371
+ var _ = {};
8372
8372
  v.remoteStreams.forEach(function(z) {
8373
- x[z.id] = z;
8373
+ _[z.id] = z;
8374
8374
  });
8375
- var _ = [], C = r.splitSections(g.sdp), M = C.shift(), P = r.matchPrefix(
8376
- M,
8375
+ var x = [], M = r.splitSections(g.sdp), C = M.shift(), P = r.matchPrefix(
8376
+ C,
8377
8377
  "a=ice-lite"
8378
8378
  ).length > 0, E = r.matchPrefix(
8379
- M,
8379
+ C,
8380
8380
  "a=group:BUNDLE "
8381
8381
  ).length > 0;
8382
8382
  v.usingBundle = E;
8383
- var O = r.matchPrefix(
8384
- M,
8383
+ var A = r.matchPrefix(
8384
+ C,
8385
8385
  "a=ice-options:"
8386
8386
  )[0];
8387
- return O ? v.canTrickleIceCandidates = O.substr(14).split(" ").indexOf("trickle") >= 0 : v.canTrickleIceCandidates = !1, C.forEach(function(z, R) {
8388
- var B = r.splitLines(z), A = r.getKind(z), N = r.isRejected(z) && r.matchPrefix(z, "a=bundle-only").length === 0, L = B[0].substr(2).split(" ")[2], V = r.getDirection(z, M), $ = r.parseMsid(z), Q = r.getMid(z) || r.generateIdentifier();
8389
- if (N || A === "application" && (L === "DTLS/SCTP" || L === "UDP/DTLS/SCTP")) {
8387
+ return A ? v.canTrickleIceCandidates = A.substr(14).split(" ").indexOf("trickle") >= 0 : v.canTrickleIceCandidates = !1, M.forEach(function(z, R) {
8388
+ var B = r.splitLines(z), O = r.getKind(z), N = r.isRejected(z) && r.matchPrefix(z, "a=bundle-only").length === 0, L = B[0].substr(2).split(" ")[2], V = r.getDirection(z, C), $ = r.parseMsid(z), Q = r.getMid(z) || r.generateIdentifier();
8389
+ if (N || O === "application" && (L === "DTLS/SCTP" || L === "UDP/DTLS/SCTP")) {
8390
8390
  v.transceivers[R] = {
8391
8391
  mid: Q,
8392
- kind: A,
8392
+ kind: O,
8393
8393
  protocol: L,
8394
8394
  rejected: !0
8395
8395
  };
8396
8396
  return;
8397
8397
  }
8398
- !N && v.transceivers[R] && v.transceivers[R].rejected && (v.transceivers[R] = v._createTransceiver(A, !0));
8398
+ !N && v.transceivers[R] && v.transceivers[R].rejected && (v.transceivers[R] = v._createTransceiver(O, !0));
8399
8399
  var W, yt, nt, ht, st, vt, Tt, ot, ft, at = r.parseRtpParameters(z), Yt, Jt;
8400
8400
  N || (Yt = r.getIceParameters(
8401
8401
  z,
8402
- M
8402
+ C
8403
8403
  ), Jt = r.getDtlsParameters(
8404
8404
  z,
8405
- M
8405
+ C
8406
8406
  ), Jt.role = "client"), Tt = r.parseRtpEncodingParameters(z);
8407
8407
  var jt = r.parseRtcpParameters(z), Zt = r.matchPrefix(
8408
8408
  z,
8409
8409
  "a=end-of-candidates",
8410
- M
8410
+ C
8411
8411
  ).length > 0, _t = r.matchPrefix(z, "a=candidate:").map(function(dt) {
8412
8412
  return r.parseCandidate(dt);
8413
8413
  }).filter(function(dt) {
@@ -8418,12 +8418,12 @@ function Dh() {
8418
8418
  ), v.transceivers[R].rtpReceiver && v.transceivers[R].rtpReceiver.setTransport(
8419
8419
  v.transceivers[0].dtlsTransport
8420
8420
  )), g.type === "offer" && !N) {
8421
- W = v.transceivers[R] || v._createTransceiver(A), W.mid = Q, W.iceGatherer || (W.iceGatherer = v._createIceGatherer(
8421
+ W = v.transceivers[R] || v._createTransceiver(O), W.mid = Q, W.iceGatherer || (W.iceGatherer = v._createIceGatherer(
8422
8422
  R,
8423
8423
  E
8424
8424
  )), _t.length && W.iceTransport.state === "new" && (Zt && (!E || R === 0) ? W.iceTransport.setRemoteCandidates(_t) : _t.forEach(function(dt) {
8425
8425
  a(W.iceTransport, dt);
8426
- })), ot = c.RTCRtpReceiver.getCapabilities(A), l < 15019 && (ot.codecs = ot.codecs.filter(
8426
+ })), ot = c.RTCRtpReceiver.getCapabilities(O), l < 15019 && (ot.codecs = ot.codecs.filter(
8427
8427
  function(dt) {
8428
8428
  return dt.name !== "rtx";
8429
8429
  }
@@ -8432,9 +8432,9 @@ function Dh() {
8432
8432
  }];
8433
8433
  var gt = !1;
8434
8434
  if (V === "sendrecv" || V === "sendonly") {
8435
- if (gt = !W.rtpReceiver, st = W.rtpReceiver || new c.RTCRtpReceiver(W.dtlsTransport, A), gt) {
8435
+ if (gt = !W.rtpReceiver, st = W.rtpReceiver || new c.RTCRtpReceiver(W.dtlsTransport, O), gt) {
8436
8436
  var ct;
8437
- ft = st.track, $ && $.stream === "-" || ($ ? (x[$.stream] || (x[$.stream] = new c.MediaStream(), Object.defineProperty(x[$.stream], "id", {
8437
+ ft = st.track, $ && $.stream === "-" || ($ ? (_[$.stream] || (_[$.stream] = new c.MediaStream(), Object.defineProperty(_[$.stream], "id", {
8438
8438
  get: function() {
8439
8439
  return $.stream;
8440
8440
  }
@@ -8442,7 +8442,7 @@ function Dh() {
8442
8442
  get: function() {
8443
8443
  return $.track;
8444
8444
  }
8445
- }), ct = x[$.stream]) : (x.default || (x.default = new c.MediaStream()), ct = x.default)), ct && (h(ft, ct), W.associatedRemoteMediaStreams.push(ct)), _.push([ft, st, ct]);
8445
+ }), ct = _[$.stream]) : (_.default || (_.default = new c.MediaStream()), ct = _.default)), ct && (h(ft, ct), W.associatedRemoteMediaStreams.push(ct)), x.push([ft, st, ct]);
8446
8446
  }
8447
8447
  } else W.rtpReceiver && W.rtpReceiver.track && (W.associatedRemoteMediaStreams.forEach(function(dt) {
8448
8448
  var se = dt.getTracks().find(function(_e) {
@@ -8473,13 +8473,13 @@ function Dh() {
8473
8473
  W,
8474
8474
  V === "sendrecv" || V === "recvonly",
8475
8475
  V === "sendrecv" || V === "sendonly"
8476
- ), st && (V === "sendrecv" || V === "sendonly") ? (ft = st.track, $ ? (x[$.stream] || (x[$.stream] = new c.MediaStream()), h(ft, x[$.stream]), _.push([ft, st, x[$.stream]])) : (x.default || (x.default = new c.MediaStream()), h(ft, x.default), _.push([ft, st, x.default]))) : delete W.rtpReceiver;
8476
+ ), st && (V === "sendrecv" || V === "sendonly") ? (ft = st.track, $ ? (_[$.stream] || (_[$.stream] = new c.MediaStream()), h(ft, _[$.stream]), x.push([ft, st, _[$.stream]])) : (_.default || (_.default = new c.MediaStream()), h(ft, _.default), x.push([ft, st, _.default]))) : delete W.rtpReceiver;
8477
8477
  }
8478
8478
  }), v._dtlsRole === void 0 && (v._dtlsRole = g.type === "offer" ? "active" : "passive"), v._remoteDescription = {
8479
8479
  type: g.type,
8480
8480
  sdp: g.sdp
8481
- }, g.type === "offer" ? v._updateSignalingState("have-remote-offer") : v._updateSignalingState("stable"), Object.keys(x).forEach(function(z) {
8482
- var R = x[z];
8481
+ }, g.type === "offer" ? v._updateSignalingState("have-remote-offer") : v._updateSignalingState("stable"), Object.keys(_).forEach(function(z) {
8482
+ var R = _[z];
8483
8483
  if (R.getTracks().length) {
8484
8484
  if (v.remoteStreams.indexOf(R) === -1) {
8485
8485
  v.remoteStreams.push(R);
@@ -8488,12 +8488,12 @@ function Dh() {
8488
8488
  v._dispatchEvent("addstream", B);
8489
8489
  });
8490
8490
  }
8491
- _.forEach(function(A) {
8492
- var N = A[0], L = A[1];
8493
- R.id === A[2].id && m(v, N, L, [R]);
8491
+ x.forEach(function(O) {
8492
+ var N = O[0], L = O[1];
8493
+ R.id === O[2].id && m(v, N, L, [R]);
8494
8494
  });
8495
8495
  }
8496
- }), _.forEach(function(z) {
8496
+ }), x.forEach(function(z) {
8497
8497
  z[2] || m(v, z[0], z[1], []);
8498
8498
  }), c.setTimeout(function() {
8499
8499
  v && v.transceivers && v.transceivers.forEach(function(z) {
@@ -8527,12 +8527,12 @@ function Dh() {
8527
8527
  disconnected: 0,
8528
8528
  failed: 0
8529
8529
  };
8530
- if (this.transceivers.forEach(function(_) {
8531
- _.iceTransport && !_.rejected && v[_.iceTransport.state]++;
8530
+ if (this.transceivers.forEach(function(x) {
8531
+ x.iceTransport && !x.rejected && v[x.iceTransport.state]++;
8532
8532
  }), g = "new", v.failed > 0 ? g = "failed" : v.checking > 0 ? g = "checking" : v.disconnected > 0 ? g = "disconnected" : v.new > 0 ? g = "new" : v.connected > 0 ? g = "connected" : v.completed > 0 && (g = "completed"), g !== this.iceConnectionState) {
8533
8533
  this.iceConnectionState = g;
8534
- var x = new Event("iceconnectionstatechange");
8535
- this._dispatchEvent("iceconnectionstatechange", x);
8534
+ var _ = new Event("iceconnectionstatechange");
8535
+ this._dispatchEvent("iceconnectionstatechange", _);
8536
8536
  }
8537
8537
  }, p.prototype._updateConnectionState = function() {
8538
8538
  var g, v = {
@@ -8544,12 +8544,12 @@ function Dh() {
8544
8544
  disconnected: 0,
8545
8545
  failed: 0
8546
8546
  };
8547
- if (this.transceivers.forEach(function(_) {
8548
- _.iceTransport && _.dtlsTransport && !_.rejected && (v[_.iceTransport.state]++, v[_.dtlsTransport.state]++);
8547
+ if (this.transceivers.forEach(function(x) {
8548
+ x.iceTransport && x.dtlsTransport && !x.rejected && (v[x.iceTransport.state]++, v[x.dtlsTransport.state]++);
8549
8549
  }), v.connected += v.completed, g = "new", v.failed > 0 ? g = "failed" : v.connecting > 0 ? g = "connecting" : v.disconnected > 0 ? g = "disconnected" : v.new > 0 ? g = "new" : v.connected > 0 && (g = "connected"), g !== this.connectionState) {
8550
8550
  this.connectionState = g;
8551
- var x = new Event("connectionstatechange");
8552
- this._dispatchEvent("connectionstatechange", x);
8551
+ var _ = new Event("connectionstatechange");
8552
+ this._dispatchEvent("connectionstatechange", _);
8553
8553
  }
8554
8554
  }, p.prototype.createOffer = function() {
8555
8555
  var g = this;
@@ -8560,26 +8560,26 @@ function Dh() {
8560
8560
  ));
8561
8561
  var v = g.transceivers.filter(function(P) {
8562
8562
  return P.kind === "audio";
8563
- }).length, x = g.transceivers.filter(function(P) {
8563
+ }).length, _ = g.transceivers.filter(function(P) {
8564
8564
  return P.kind === "video";
8565
- }).length, _ = arguments[0];
8566
- if (_) {
8567
- if (_.mandatory || _.optional)
8565
+ }).length, x = arguments[0];
8566
+ if (x) {
8567
+ if (x.mandatory || x.optional)
8568
8568
  throw new TypeError(
8569
8569
  "Legacy mandatory/optional constraints not supported."
8570
8570
  );
8571
- _.offerToReceiveAudio !== void 0 && (_.offerToReceiveAudio === !0 ? v = 1 : _.offerToReceiveAudio === !1 ? v = 0 : v = _.offerToReceiveAudio), _.offerToReceiveVideo !== void 0 && (_.offerToReceiveVideo === !0 ? x = 1 : _.offerToReceiveVideo === !1 ? x = 0 : x = _.offerToReceiveVideo);
8571
+ x.offerToReceiveAudio !== void 0 && (x.offerToReceiveAudio === !0 ? v = 1 : x.offerToReceiveAudio === !1 ? v = 0 : v = x.offerToReceiveAudio), x.offerToReceiveVideo !== void 0 && (x.offerToReceiveVideo === !0 ? _ = 1 : x.offerToReceiveVideo === !1 ? _ = 0 : _ = x.offerToReceiveVideo);
8572
8572
  }
8573
8573
  for (g.transceivers.forEach(function(P) {
8574
- P.kind === "audio" ? (v--, v < 0 && (P.wantReceive = !1)) : P.kind === "video" && (x--, x < 0 && (P.wantReceive = !1));
8575
- }); v > 0 || x > 0; )
8576
- v > 0 && (g._createTransceiver("audio"), v--), x > 0 && (g._createTransceiver("video"), x--);
8577
- var C = r.writeSessionBoilerplate(
8574
+ P.kind === "audio" ? (v--, v < 0 && (P.wantReceive = !1)) : P.kind === "video" && (_--, _ < 0 && (P.wantReceive = !1));
8575
+ }); v > 0 || _ > 0; )
8576
+ v > 0 && (g._createTransceiver("audio"), v--), _ > 0 && (g._createTransceiver("video"), _--);
8577
+ var M = r.writeSessionBoilerplate(
8578
8578
  g._sdpSessionId,
8579
8579
  g._sdpSessionVersion++
8580
8580
  );
8581
8581
  g.transceivers.forEach(function(P, E) {
8582
- var O = P.track, z = P.kind, R = P.mid || r.generateIdentifier();
8582
+ var A = P.track, z = P.kind, R = P.mid || r.generateIdentifier();
8583
8583
  P.mid = R, P.iceGatherer || (P.iceGatherer = g._createIceGatherer(
8584
8584
  E,
8585
8585
  g.usingBundle
@@ -8599,38 +8599,38 @@ function Dh() {
8599
8599
  N.uri === V.uri && (N.id = V.id);
8600
8600
  });
8601
8601
  });
8602
- var A = P.sendEncodingParameters || [{
8602
+ var O = P.sendEncodingParameters || [{
8603
8603
  ssrc: (2 * E + 1) * 1001
8604
8604
  }];
8605
- O && l >= 15019 && z === "video" && !A[0].rtx && (A[0].rtx = {
8606
- ssrc: A[0].ssrc + 1
8605
+ A && l >= 15019 && z === "video" && !O[0].rtx && (O[0].rtx = {
8606
+ ssrc: O[0].ssrc + 1
8607
8607
  }), P.wantReceive && (P.rtpReceiver = new c.RTCRtpReceiver(
8608
8608
  P.dtlsTransport,
8609
8609
  z
8610
- )), P.localCapabilities = B, P.sendEncodingParameters = A;
8611
- }), g._config.bundlePolicy !== "max-compat" && (C += "a=group:BUNDLE " + g.transceivers.map(function(P) {
8610
+ )), P.localCapabilities = B, P.sendEncodingParameters = O;
8611
+ }), g._config.bundlePolicy !== "max-compat" && (M += "a=group:BUNDLE " + g.transceivers.map(function(P) {
8612
8612
  return P.mid;
8613
8613
  }).join(" ") + `\r
8614
- `), C += `a=ice-options:trickle\r
8614
+ `), M += `a=ice-options:trickle\r
8615
8615
  `, g.transceivers.forEach(function(P, E) {
8616
- C += e(
8616
+ M += e(
8617
8617
  P,
8618
8618
  P.localCapabilities,
8619
8619
  "offer",
8620
8620
  P.stream,
8621
8621
  g._dtlsRole
8622
- ), C += `a=rtcp-rsize\r
8623
- `, P.iceGatherer && g.iceGatheringState !== "new" && (E === 0 || !g.usingBundle) && (P.iceGatherer.getLocalCandidates().forEach(function(O) {
8624
- O.component = 1, C += "a=" + r.writeCandidate(O) + `\r
8622
+ ), M += `a=rtcp-rsize\r
8623
+ `, P.iceGatherer && g.iceGatheringState !== "new" && (E === 0 || !g.usingBundle) && (P.iceGatherer.getLocalCandidates().forEach(function(A) {
8624
+ A.component = 1, M += "a=" + r.writeCandidate(A) + `\r
8625
8625
  `;
8626
- }), P.iceGatherer.state === "completed" && (C += `a=end-of-candidates\r
8626
+ }), P.iceGatherer.state === "completed" && (M += `a=end-of-candidates\r
8627
8627
  `));
8628
8628
  });
8629
- var M = new c.RTCSessionDescription({
8629
+ var C = new c.RTCSessionDescription({
8630
8630
  type: "offer",
8631
- sdp: C
8631
+ sdp: M
8632
8632
  });
8633
- return Promise.resolve(M);
8633
+ return Promise.resolve(C);
8634
8634
  }, p.prototype.createAnswer = function() {
8635
8635
  var g = this;
8636
8636
  if (g._isClosed)
@@ -8647,63 +8647,63 @@ function Dh() {
8647
8647
  g._sdpSessionId,
8648
8648
  g._sdpSessionVersion++
8649
8649
  );
8650
- g.usingBundle && (v += "a=group:BUNDLE " + g.transceivers.map(function(C) {
8651
- return C.mid;
8650
+ g.usingBundle && (v += "a=group:BUNDLE " + g.transceivers.map(function(M) {
8651
+ return M.mid;
8652
8652
  }).join(" ") + `\r
8653
8653
  `), v += `a=ice-options:trickle\r
8654
8654
  `;
8655
- var x = r.getMediaSections(
8655
+ var _ = r.getMediaSections(
8656
8656
  g._remoteDescription.sdp
8657
8657
  ).length;
8658
- g.transceivers.forEach(function(C, M) {
8659
- if (!(M + 1 > x)) {
8660
- if (C.rejected) {
8661
- C.kind === "application" ? C.protocol === "DTLS/SCTP" ? v += `m=application 0 DTLS/SCTP 5000\r
8662
- ` : v += "m=application 0 " + C.protocol + ` webrtc-datachannel\r
8663
- ` : C.kind === "audio" ? v += `m=audio 0 UDP/TLS/RTP/SAVPF 0\r
8658
+ g.transceivers.forEach(function(M, C) {
8659
+ if (!(C + 1 > _)) {
8660
+ if (M.rejected) {
8661
+ M.kind === "application" ? M.protocol === "DTLS/SCTP" ? v += `m=application 0 DTLS/SCTP 5000\r
8662
+ ` : v += "m=application 0 " + M.protocol + ` webrtc-datachannel\r
8663
+ ` : M.kind === "audio" ? v += `m=audio 0 UDP/TLS/RTP/SAVPF 0\r
8664
8664
  a=rtpmap:0 PCMU/8000\r
8665
- ` : C.kind === "video" && (v += `m=video 0 UDP/TLS/RTP/SAVPF 120\r
8665
+ ` : M.kind === "video" && (v += `m=video 0 UDP/TLS/RTP/SAVPF 120\r
8666
8666
  a=rtpmap:120 VP8/90000\r
8667
8667
  `), v += `c=IN IP4 0.0.0.0\r
8668
8668
  a=inactive\r
8669
- a=mid:` + C.mid + `\r
8669
+ a=mid:` + M.mid + `\r
8670
8670
  `;
8671
8671
  return;
8672
8672
  }
8673
- if (C.stream) {
8673
+ if (M.stream) {
8674
8674
  var P;
8675
- C.kind === "audio" ? P = C.stream.getAudioTracks()[0] : C.kind === "video" && (P = C.stream.getVideoTracks()[0]), P && l >= 15019 && C.kind === "video" && !C.sendEncodingParameters[0].rtx && (C.sendEncodingParameters[0].rtx = {
8676
- ssrc: C.sendEncodingParameters[0].ssrc + 1
8675
+ M.kind === "audio" ? P = M.stream.getAudioTracks()[0] : M.kind === "video" && (P = M.stream.getVideoTracks()[0]), P && l >= 15019 && M.kind === "video" && !M.sendEncodingParameters[0].rtx && (M.sendEncodingParameters[0].rtx = {
8676
+ ssrc: M.sendEncodingParameters[0].ssrc + 1
8677
8677
  });
8678
8678
  }
8679
8679
  var E = i(
8680
- C.localCapabilities,
8681
- C.remoteCapabilities
8682
- ), O = E.codecs.filter(function(z) {
8680
+ M.localCapabilities,
8681
+ M.remoteCapabilities
8682
+ ), A = E.codecs.filter(function(z) {
8683
8683
  return z.name.toLowerCase() === "rtx";
8684
8684
  }).length;
8685
- !O && C.sendEncodingParameters[0].rtx && delete C.sendEncodingParameters[0].rtx, v += e(
8686
- C,
8685
+ !A && M.sendEncodingParameters[0].rtx && delete M.sendEncodingParameters[0].rtx, v += e(
8686
+ M,
8687
8687
  E,
8688
8688
  "answer",
8689
- C.stream,
8689
+ M.stream,
8690
8690
  g._dtlsRole
8691
- ), C.rtcpParameters && C.rtcpParameters.reducedSize && (v += `a=rtcp-rsize\r
8691
+ ), M.rtcpParameters && M.rtcpParameters.reducedSize && (v += `a=rtcp-rsize\r
8692
8692
  `);
8693
8693
  }
8694
8694
  });
8695
- var _ = new c.RTCSessionDescription({
8695
+ var x = new c.RTCSessionDescription({
8696
8696
  type: "answer",
8697
8697
  sdp: v
8698
8698
  });
8699
- return Promise.resolve(_);
8699
+ return Promise.resolve(x);
8700
8700
  }, p.prototype.addIceCandidate = function(g) {
8701
- var v = this, x;
8702
- return g && !(g.sdpMLineIndex !== void 0 || g.sdpMid) ? Promise.reject(new TypeError("sdpMLineIndex or sdpMid required")) : new Promise(function(_, C) {
8701
+ var v = this, _;
8702
+ return g && !(g.sdpMLineIndex !== void 0 || g.sdpMid) ? Promise.reject(new TypeError("sdpMLineIndex or sdpMid required")) : new Promise(function(x, M) {
8703
8703
  if (v._remoteDescription)
8704
8704
  if (!g || g.candidate === "")
8705
- for (var M = 0; M < v.transceivers.length && !(!v.transceivers[M].rejected && (v.transceivers[M].iceTransport.addRemoteCandidate({}), x = r.getMediaSections(v._remoteDescription.sdp), x[M] += `a=end-of-candidates\r
8706
- `, v._remoteDescription.sdp = r.getDescription(v._remoteDescription.sdp) + x.join(""), v.usingBundle)); M++)
8705
+ for (var C = 0; C < v.transceivers.length && !(!v.transceivers[C].rejected && (v.transceivers[C].iceTransport.addRemoteCandidate({}), _ = r.getMediaSections(v._remoteDescription.sdp), _[C] += `a=end-of-candidates\r
8706
+ `, v._remoteDescription.sdp = r.getDescription(v._remoteDescription.sdp) + _.join(""), v.usingBundle)); C++)
8707
8707
  ;
8708
8708
  else {
8709
8709
  var P = g.sdpMLineIndex;
@@ -8714,60 +8714,60 @@ a=mid:` + C.mid + `\r
8714
8714
  break;
8715
8715
  }
8716
8716
  }
8717
- var O = v.transceivers[P];
8718
- if (O) {
8719
- if (O.rejected)
8720
- return _();
8717
+ var A = v.transceivers[P];
8718
+ if (A) {
8719
+ if (A.rejected)
8720
+ return x();
8721
8721
  var z = Object.keys(g.candidate).length > 0 ? r.parseCandidate(g.candidate) : {};
8722
8722
  if (z.protocol === "tcp" && (z.port === 0 || z.port === 9) || z.component && z.component !== 1)
8723
- return _();
8724
- if ((P === 0 || P > 0 && O.iceTransport !== v.transceivers[0].iceTransport) && !a(O.iceTransport, z))
8725
- return C(o(
8723
+ return x();
8724
+ if ((P === 0 || P > 0 && A.iceTransport !== v.transceivers[0].iceTransport) && !a(A.iceTransport, z))
8725
+ return M(o(
8726
8726
  "OperationError",
8727
8727
  "Can not add ICE candidate"
8728
8728
  ));
8729
8729
  var R = g.candidate.trim();
8730
- R.indexOf("a=") === 0 && (R = R.substr(2)), x = r.getMediaSections(v._remoteDescription.sdp), x[P] += "a=" + (z.type ? R : "end-of-candidates") + `\r
8731
- `, v._remoteDescription.sdp = r.getDescription(v._remoteDescription.sdp) + x.join("");
8730
+ R.indexOf("a=") === 0 && (R = R.substr(2)), _ = r.getMediaSections(v._remoteDescription.sdp), _[P] += "a=" + (z.type ? R : "end-of-candidates") + `\r
8731
+ `, v._remoteDescription.sdp = r.getDescription(v._remoteDescription.sdp) + _.join("");
8732
8732
  } else
8733
- return C(o(
8733
+ return M(o(
8734
8734
  "OperationError",
8735
8735
  "Can not add ICE candidate"
8736
8736
  ));
8737
8737
  }
8738
- else return C(o(
8738
+ else return M(o(
8739
8739
  "InvalidStateError",
8740
8740
  "Can not add ICE candidate without a remote description"
8741
8741
  ));
8742
- _();
8742
+ x();
8743
8743
  });
8744
8744
  }, p.prototype.getStats = function(g) {
8745
8745
  if (g && g instanceof c.MediaStreamTrack) {
8746
8746
  var v = null;
8747
- if (this.transceivers.forEach(function(_) {
8748
- _.rtpSender && _.rtpSender.track === g ? v = _.rtpSender : _.rtpReceiver && _.rtpReceiver.track === g && (v = _.rtpReceiver);
8747
+ if (this.transceivers.forEach(function(x) {
8748
+ x.rtpSender && x.rtpSender.track === g ? v = x.rtpSender : x.rtpReceiver && x.rtpReceiver.track === g && (v = x.rtpReceiver);
8749
8749
  }), !v)
8750
8750
  throw o("InvalidAccessError", "Invalid selector.");
8751
8751
  return v.getStats();
8752
8752
  }
8753
- var x = [];
8754
- return this.transceivers.forEach(function(_) {
8753
+ var _ = [];
8754
+ return this.transceivers.forEach(function(x) {
8755
8755
  [
8756
8756
  "rtpSender",
8757
8757
  "rtpReceiver",
8758
8758
  "iceGatherer",
8759
8759
  "iceTransport",
8760
8760
  "dtlsTransport"
8761
- ].forEach(function(C) {
8762
- _[C] && x.push(_[C].getStats());
8761
+ ].forEach(function(M) {
8762
+ x[M] && _.push(x[M].getStats());
8763
8763
  });
8764
- }), Promise.all(x).then(function(_) {
8765
- var C = /* @__PURE__ */ new Map();
8766
- return _.forEach(function(M) {
8767
- M.forEach(function(P) {
8768
- C.set(P.id, P);
8764
+ }), Promise.all(_).then(function(x) {
8765
+ var M = /* @__PURE__ */ new Map();
8766
+ return x.forEach(function(C) {
8767
+ C.forEach(function(P) {
8768
+ M.set(P.id, P);
8769
8769
  });
8770
- }), C;
8770
+ }), M;
8771
8771
  });
8772
8772
  };
8773
8773
  var b = [
@@ -8780,13 +8780,13 @@ a=mid:` + C.mid + `\r
8780
8780
  b.forEach(function(g) {
8781
8781
  var v = c[g];
8782
8782
  if (v && v.prototype && v.prototype.getStats) {
8783
- var x = v.prototype.getStats;
8783
+ var _ = v.prototype.getStats;
8784
8784
  v.prototype.getStats = function() {
8785
- return x.apply(this).then(function(_) {
8786
- var C = /* @__PURE__ */ new Map();
8787
- return Object.keys(_).forEach(function(M) {
8788
- _[M].type = t(_[M]), C.set(M, _[M]);
8789
- }), C;
8785
+ return _.apply(this).then(function(x) {
8786
+ var M = /* @__PURE__ */ new Map();
8787
+ return Object.keys(x).forEach(function(C) {
8788
+ x[C].type = t(x[C]), M.set(C, x[C]);
8789
+ }), M;
8790
8790
  });
8791
8791
  };
8792
8792
  }
@@ -8795,29 +8795,29 @@ a=mid:` + C.mid + `\r
8795
8795
  return T.forEach(function(g) {
8796
8796
  var v = p.prototype[g];
8797
8797
  p.prototype[g] = function() {
8798
- var x = arguments;
8799
- return typeof x[0] == "function" || typeof x[1] == "function" ? v.apply(this, [arguments[2]]).then(function(_) {
8800
- typeof x[0] == "function" && x[0].apply(null, [_]);
8801
- }, function(_) {
8802
- typeof x[1] == "function" && x[1].apply(null, [_]);
8798
+ var _ = arguments;
8799
+ return typeof _[0] == "function" || typeof _[1] == "function" ? v.apply(this, [arguments[2]]).then(function(x) {
8800
+ typeof _[0] == "function" && _[0].apply(null, [x]);
8801
+ }, function(x) {
8802
+ typeof _[1] == "function" && _[1].apply(null, [x]);
8803
8803
  }) : v.apply(this, arguments);
8804
8804
  };
8805
8805
  }), T = ["setLocalDescription", "setRemoteDescription", "addIceCandidate"], T.forEach(function(g) {
8806
8806
  var v = p.prototype[g];
8807
8807
  p.prototype[g] = function() {
8808
- var x = arguments;
8809
- return typeof x[1] == "function" || typeof x[2] == "function" ? v.apply(this, arguments).then(function() {
8810
- typeof x[1] == "function" && x[1].apply(null);
8811
- }, function(_) {
8812
- typeof x[2] == "function" && x[2].apply(null, [_]);
8808
+ var _ = arguments;
8809
+ return typeof _[1] == "function" || typeof _[2] == "function" ? v.apply(this, arguments).then(function() {
8810
+ typeof _[1] == "function" && _[1].apply(null);
8811
+ }, function(x) {
8812
+ typeof _[2] == "function" && _[2].apply(null, [x]);
8813
8813
  }) : v.apply(this, arguments);
8814
8814
  };
8815
8815
  }), ["getStats"].forEach(function(g) {
8816
8816
  var v = p.prototype[g];
8817
8817
  p.prototype[g] = function() {
8818
- var x = arguments;
8819
- return typeof x[1] == "function" ? v.apply(this, arguments).then(function() {
8820
- typeof x[1] == "function" && x[1].apply(null);
8818
+ var _ = arguments;
8819
+ return typeof _[1] == "function" ? v.apply(this, arguments).then(function() {
8820
+ typeof _[1] == "function" && _[1].apply(null);
8821
8821
  }) : v.apply(this, arguments);
8822
8822
  };
8823
8823
  }), p;
@@ -9723,7 +9723,7 @@ tr = qt;
9723
9723
  var j = {};
9724
9724
  Ve(j, "LogLevel", () => ce, (r) => ce = r);
9725
9725
  Ve(j, "default", () => Ea, (r) => Ea = r);
9726
- var gn = function(r, t) {
9726
+ var yn = function(r, t) {
9727
9727
  var e = typeof Symbol == "function" && r[Symbol.iterator];
9728
9728
  if (!e) return r;
9729
9729
  var n = e.call(r), i, s = [], a;
@@ -9741,7 +9741,7 @@ var gn = function(r, t) {
9741
9741
  }
9742
9742
  }
9743
9743
  return s;
9744
- }, vn = function(r, t, e) {
9744
+ }, gn = function(r, t, e) {
9745
9745
  if (e || arguments.length === 2)
9746
9746
  for (var n = 0, i = t.length, s; n < i; n++) (s || !(n in t)) && (s || (s = Array.prototype.slice.call(t, 0, n)), s[n] = t[n]);
9747
9747
  return r.concat(s || Array.prototype.slice.call(t));
@@ -9766,32 +9766,32 @@ var Xh = (
9766
9766
  configurable: !0
9767
9767
  }), r.prototype.log = function() {
9768
9768
  for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
9769
- this._logLevel >= ce.All && this._print.apply(this, vn([
9769
+ this._logLevel >= ce.All && this._print.apply(this, gn([
9770
9770
  ce.All
9771
- ], gn(t), !1));
9771
+ ], yn(t), !1));
9772
9772
  }, r.prototype.warn = function() {
9773
9773
  for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
9774
- this._logLevel >= ce.Warnings && this._print.apply(this, vn([
9774
+ this._logLevel >= ce.Warnings && this._print.apply(this, gn([
9775
9775
  ce.Warnings
9776
- ], gn(t), !1));
9776
+ ], yn(t), !1));
9777
9777
  }, r.prototype.error = function() {
9778
9778
  for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
9779
- this._logLevel >= ce.Errors && this._print.apply(this, vn([
9779
+ this._logLevel >= ce.Errors && this._print.apply(this, gn([
9780
9780
  ce.Errors
9781
- ], gn(t), !1));
9781
+ ], yn(t), !1));
9782
9782
  }, r.prototype.setLogFunction = function(t) {
9783
9783
  this._print = t;
9784
9784
  }, r.prototype._print = function(t) {
9785
9785
  for (var e = [], n = 1; n < arguments.length; n++) e[n - 1] = arguments[n];
9786
- var i = vn([
9786
+ var i = gn([
9787
9787
  qh
9788
- ], gn(e), !1);
9788
+ ], yn(e), !1);
9789
9789
  for (var s in i) i[s] instanceof Error && (i[s] = "(" + i[s].name + ") " + i[s].message);
9790
- t >= ce.All ? console.log.apply(console, vn([], gn(i), !1)) : t >= ce.Warnings ? console.warn.apply(console, vn([
9790
+ t >= ce.All ? console.log.apply(console, gn([], yn(i), !1)) : t >= ce.Warnings ? console.warn.apply(console, gn([
9791
9791
  "WARNING"
9792
- ], gn(i), !1)) : t >= ce.Errors && console.error.apply(console, vn([
9792
+ ], yn(i), !1)) : t >= ce.Errors && console.error.apply(console, gn([
9793
9793
  "ERROR"
9794
- ], gn(i), !1));
9794
+ ], yn(i), !1));
9795
9795
  }, r;
9796
9796
  })()
9797
9797
  ), Ea = new Xh(), hl = {};
@@ -11369,8 +11369,8 @@ class pl {
11369
11369
  * @param options optional options to use.
11370
11370
  */
11371
11371
  constructor(t, e, n) {
11372
- var i, s, a, o, c, l, h, d, m, p, b, T, g, v, x;
11373
- this._closedByUser = !1, this.handleOpenEvent = (_) => this.handleEvent(lt.open, _), this.handleErrorEvent = (_) => this.handleEvent(lt.error, _), this.handleCloseEvent = (_) => this.handleEvent(lt.close, _), this.handleMessageEvent = (_) => this.handleEvent(lt.message, _), this._url = t, this._protocols = e, this._options = {
11372
+ var i, s, a, o, c, l, h, d, m, p, b, T, g, v, _;
11373
+ this._closedByUser = !1, this.handleOpenEvent = (x) => this.handleEvent(lt.open, x), this.handleErrorEvent = (x) => this.handleEvent(lt.error, x), this.handleCloseEvent = (x) => this.handleEvent(lt.close, x), this.handleMessageEvent = (x) => this.handleEvent(lt.message, x), this._url = t, this._protocols = e, this._options = {
11374
11374
  buffer: n?.buffer,
11375
11375
  retry: {
11376
11376
  maxRetries: (i = n?.retry) === null || i === void 0 ? void 0 : i.maxRetries,
@@ -11383,7 +11383,7 @@ class pl {
11383
11383
  error: [...(m = (d = n?.listeners) === null || d === void 0 ? void 0 : d.error) !== null && m !== void 0 ? m : []],
11384
11384
  message: [...(b = (p = n?.listeners) === null || p === void 0 ? void 0 : p.message) !== null && b !== void 0 ? b : []],
11385
11385
  retry: [...(g = (T = n?.listeners) === null || T === void 0 ? void 0 : T.retry) !== null && g !== void 0 ? g : []],
11386
- reconnect: [...(x = (v = n?.listeners) === null || v === void 0 ? void 0 : v.reconnect) !== null && x !== void 0 ? x : []]
11386
+ reconnect: [...(_ = (v = n?.listeners) === null || v === void 0 ? void 0 : v.reconnect) !== null && _ !== void 0 ? _ : []]
11387
11387
  }
11388
11388
  }, this._underlyingWebsocket = this.tryConnect();
11389
11389
  }
@@ -11817,16 +11817,16 @@ class hf {
11817
11817
  * @param options the listener options
11818
11818
  */
11819
11819
  addListener(t, e, n) {
11820
- var i, s, a, o, c, l, h, d, m, p, b, T, g, v, x, _, C, M, P, E, O;
11820
+ var i, s, a, o, c, l, h, d, m, p, b, T, g, v, _, x, M, C, P, E, A;
11821
11821
  return this._options = Object.assign(Object.assign({}, this._options), { listeners: {
11822
11822
  open: (a = (s = (i = this._options) === null || i === void 0 ? void 0 : i.listeners) === null || s === void 0 ? void 0 : s.open) !== null && a !== void 0 ? a : [],
11823
11823
  close: (l = (c = (o = this._options) === null || o === void 0 ? void 0 : o.listeners) === null || c === void 0 ? void 0 : c.close) !== null && l !== void 0 ? l : [],
11824
11824
  error: (m = (d = (h = this._options) === null || h === void 0 ? void 0 : h.listeners) === null || d === void 0 ? void 0 : d.error) !== null && m !== void 0 ? m : [],
11825
11825
  message: (T = (b = (p = this._options) === null || p === void 0 ? void 0 : p.listeners) === null || b === void 0 ? void 0 : b.message) !== null && T !== void 0 ? T : [],
11826
- retry: (x = (v = (g = this._options) === null || g === void 0 ? void 0 : g.listeners) === null || v === void 0 ? void 0 : v.retry) !== null && x !== void 0 ? x : [],
11827
- reconnect: (M = (C = (_ = this._options) === null || _ === void 0 ? void 0 : _.listeners) === null || C === void 0 ? void 0 : C.reconnect) !== null && M !== void 0 ? M : [],
11826
+ retry: (_ = (v = (g = this._options) === null || g === void 0 ? void 0 : g.listeners) === null || v === void 0 ? void 0 : v.retry) !== null && _ !== void 0 ? _ : [],
11827
+ reconnect: (C = (M = (x = this._options) === null || x === void 0 ? void 0 : x.listeners) === null || M === void 0 ? void 0 : M.reconnect) !== null && C !== void 0 ? C : [],
11828
11828
  [t]: [
11829
- ...(O = (E = (P = this._options) === null || P === void 0 ? void 0 : P.listeners) === null || E === void 0 ? void 0 : E[t]) !== null && O !== void 0 ? O : [],
11829
+ ...(A = (E = (P = this._options) === null || P === void 0 ? void 0 : P.listeners) === null || E === void 0 ? void 0 : E[t]) !== null && A !== void 0 ? A : [],
11830
11830
  { listener: e, options: n }
11831
11831
  ]
11832
11832
  } }), this;
@@ -11905,13 +11905,13 @@ function ko(r, t) {
11905
11905
  function zs(r, t, e, n, i) {
11906
11906
  let s = 1 / 0, a = 1 / 0, o = 1 / 0, c = -1 / 0, l = -1 / 0, h = -1 / 0, d = 1 / 0, m = 1 / 0, p = 1 / 0, b = -1 / 0, T = -1 / 0, g = -1 / 0;
11907
11907
  const v = r.offset || 0;
11908
- for (let x = (t - v) * 6, _ = (t + e - v) * 6; x < _; x += 6) {
11909
- const C = r[x + 0], M = r[x + 1], P = C - M, E = C + M;
11910
- P < s && (s = P), E > c && (c = E), C < d && (d = C), C > b && (b = C);
11911
- const O = r[x + 2], z = r[x + 3], R = O - z, B = O + z;
11912
- R < a && (a = R), B > l && (l = B), O < m && (m = O), O > T && (T = O);
11913
- const A = r[x + 4], N = r[x + 5], L = A - N, V = A + N;
11914
- L < o && (o = L), V > h && (h = V), A < p && (p = A), A > g && (g = A);
11908
+ for (let _ = (t - v) * 6, x = (t + e - v) * 6; _ < x; _ += 6) {
11909
+ const M = r[_ + 0], C = r[_ + 1], P = M - C, E = M + C;
11910
+ P < s && (s = P), E > c && (c = E), M < d && (d = M), M > b && (b = M);
11911
+ const A = r[_ + 2], z = r[_ + 3], R = A - z, B = A + z;
11912
+ R < a && (a = R), B > l && (l = B), A < m && (m = A), A > T && (T = A);
11913
+ const O = r[_ + 4], N = r[_ + 5], L = O - N, V = O + N;
11914
+ L < o && (o = L), V > h && (h = V), O < p && (p = O), O > g && (g = O);
11915
11915
  }
11916
11916
  n[0] = s, n[1] = a, n[2] = o, n[3] = c, n[4] = l, n[5] = h, i[0] = d, i[1] = m, i[2] = p, i[3] = b, i[4] = T, i[5] = g;
11917
11917
  }
@@ -11935,74 +11935,74 @@ function df(r, t, e, n, i, s) {
11935
11935
  for (let p = 0; p < 3; p++) {
11936
11936
  const b = t[p], v = (t[p + 3] - b) / qe;
11937
11937
  if (i < qe / 4) {
11938
- const x = [...on];
11939
- x.length = i;
11940
- let _ = 0;
11941
- for (let M = d; M < m; M += 6, _++) {
11942
- const P = x[_];
11943
- P.candidate = e[M + 2 * p], P.count = 0;
11938
+ const _ = [...on];
11939
+ _.length = i;
11940
+ let x = 0;
11941
+ for (let C = d; C < m; C += 6, x++) {
11942
+ const P = _[x];
11943
+ P.candidate = e[C + 2 * p], P.count = 0;
11944
11944
  const {
11945
11945
  bounds: E,
11946
- leftCacheBounds: O,
11946
+ leftCacheBounds: A,
11947
11947
  rightCacheBounds: z
11948
11948
  } = P;
11949
11949
  for (let R = 0; R < 3; R++)
11950
- z[R] = 1 / 0, z[R + 3] = -1 / 0, O[R] = 1 / 0, O[R + 3] = -1 / 0, E[R] = 1 / 0, E[R + 3] = -1 / 0;
11951
- gr(M, e, E);
11950
+ z[R] = 1 / 0, z[R + 3] = -1 / 0, A[R] = 1 / 0, A[R + 3] = -1 / 0, E[R] = 1 / 0, E[R + 3] = -1 / 0;
11951
+ gr(C, e, E);
11952
11952
  }
11953
- x.sort(ff);
11954
- let C = i;
11955
- for (let M = 0; M < C; M++) {
11956
- const P = x[M];
11957
- for (; M + 1 < C && x[M + 1].candidate === P.candidate; )
11958
- x.splice(M + 1, 1), C--;
11953
+ _.sort(ff);
11954
+ let M = i;
11955
+ for (let C = 0; C < M; C++) {
11956
+ const P = _[C];
11957
+ for (; C + 1 < M && _[C + 1].candidate === P.candidate; )
11958
+ _.splice(C + 1, 1), M--;
11959
11959
  }
11960
- for (let M = d; M < m; M += 6) {
11961
- const P = e[M + 2 * p];
11962
- for (let E = 0; E < C; E++) {
11963
- const O = x[E];
11964
- P >= O.candidate ? gr(M, e, O.rightCacheBounds) : (gr(M, e, O.leftCacheBounds), O.count++);
11960
+ for (let C = d; C < m; C += 6) {
11961
+ const P = e[C + 2 * p];
11962
+ for (let E = 0; E < M; E++) {
11963
+ const A = _[E];
11964
+ P >= A.candidate ? gr(C, e, A.rightCacheBounds) : (gr(C, e, A.leftCacheBounds), A.count++);
11965
11965
  }
11966
11966
  }
11967
- for (let M = 0; M < C; M++) {
11968
- const P = x[M], E = P.count, O = i - P.count, z = P.leftCacheBounds, R = P.rightCacheBounds;
11967
+ for (let C = 0; C < M; C++) {
11968
+ const P = _[C], E = P.count, A = i - P.count, z = P.leftCacheBounds, R = P.rightCacheBounds;
11969
11969
  let B = 0;
11970
11970
  E !== 0 && (B = ri(z) / c);
11971
- let A = 0;
11972
- O !== 0 && (A = ri(R) / c);
11973
- const N = Da + Os * (B * E + A * O);
11971
+ let O = 0;
11972
+ A !== 0 && (O = ri(R) / c);
11973
+ const N = Da + Os * (B * E + O * A);
11974
11974
  N < l && (a = p, l = N, o = P.candidate);
11975
11975
  }
11976
11976
  } else {
11977
- for (let C = 0; C < qe; C++) {
11978
- const M = on[C];
11979
- M.count = 0, M.candidate = b + v + C * v;
11980
- const P = M.bounds;
11977
+ for (let M = 0; M < qe; M++) {
11978
+ const C = on[M];
11979
+ C.count = 0, C.candidate = b + v + M * v;
11980
+ const P = C.bounds;
11981
11981
  for (let E = 0; E < 3; E++)
11982
11982
  P[E] = 1 / 0, P[E + 3] = -1 / 0;
11983
11983
  }
11984
- for (let C = d; C < m; C += 6) {
11985
- let E = ~~((e[C + 2 * p] - b) / v);
11984
+ for (let M = d; M < m; M += 6) {
11985
+ let E = ~~((e[M + 2 * p] - b) / v);
11986
11986
  E >= qe && (E = qe - 1);
11987
- const O = on[E];
11988
- O.count++, gr(C, e, O.bounds);
11987
+ const A = on[E];
11988
+ A.count++, gr(M, e, A.bounds);
11989
11989
  }
11990
- const x = on[qe - 1];
11991
- Fa(x.bounds, x.rightCacheBounds);
11992
- for (let C = qe - 2; C >= 0; C--) {
11993
- const M = on[C], P = on[C + 1];
11994
- Va(M.bounds, P.rightCacheBounds, M.rightCacheBounds);
11990
+ const _ = on[qe - 1];
11991
+ Fa(_.bounds, _.rightCacheBounds);
11992
+ for (let M = qe - 2; M >= 0; M--) {
11993
+ const C = on[M], P = on[M + 1];
11994
+ Va(C.bounds, P.rightCacheBounds, C.rightCacheBounds);
11995
11995
  }
11996
- let _ = 0;
11997
- for (let C = 0; C < qe - 1; C++) {
11998
- const M = on[C], P = M.count, E = M.bounds, z = on[C + 1].rightCacheBounds;
11999
- P !== 0 && (_ === 0 ? Fa(E, vr) : Va(E, vr, vr)), _ += P;
11996
+ let x = 0;
11997
+ for (let M = 0; M < qe - 1; M++) {
11998
+ const C = on[M], P = C.count, E = C.bounds, z = on[M + 1].rightCacheBounds;
11999
+ P !== 0 && (x === 0 ? Fa(E, vr) : Va(E, vr, vr)), x += P;
12000
12000
  let R = 0, B = 0;
12001
- _ !== 0 && (R = ri(vr) / c);
12002
- const A = i - _;
12003
- A !== 0 && (B = ri(z) / c);
12004
- const N = Da + Os * (R * _ + B * A);
12005
- N < l && (a = p, l = N, o = M.candidate);
12001
+ x !== 0 && (R = ri(vr) / c);
12002
+ const O = i - x;
12003
+ O !== 0 && (B = ri(z) / c);
12004
+ const N = Da + Os * (R * x + B * O);
12005
+ N < l && (a = p, l = N, o = C.candidate);
12006
12006
  }
12007
12007
  }
12008
12008
  }
@@ -12081,21 +12081,21 @@ function vf(r, t, e, n, i) {
12081
12081
  function T(v) {
12082
12082
  l && l(v / n);
12083
12083
  }
12084
- function g(v, x, _, C = null, M = 0) {
12085
- if (!p && M >= s && (p = !0, a && console.warn(`BVH: Max depth of ${s} reached when generating BVH. Consider increasing maxDepth.`)), _ <= o || M >= s)
12086
- return T(x + _), v.offset = x, v.count = _, v;
12087
- const P = df(v.boundingData, C, t, x, _, c);
12084
+ function g(v, _, x, M = null, C = 0) {
12085
+ if (!p && C >= s && (p = !0, a && console.warn(`BVH: Max depth of ${s} reached when generating BVH. Consider increasing maxDepth.`)), x <= o || C >= s)
12086
+ return T(_ + x), v.offset = _, v.count = x, v;
12087
+ const P = df(v.boundingData, M, t, _, x, c);
12088
12088
  if (P.axis === -1)
12089
- return T(x + _), v.offset = x, v.count = _, v;
12090
- const E = mf(h, d, t, x, _, P);
12091
- if (E === x || E === x + _)
12092
- T(x + _), v.offset = x, v.count = _;
12089
+ return T(_ + x), v.offset = _, v.count = x, v;
12090
+ const E = mf(h, d, t, _, x, P);
12091
+ if (E === _ || E === _ + x)
12092
+ T(_ + x), v.offset = _, v.count = x;
12093
12093
  else {
12094
12094
  v.splitAxis = P.axis;
12095
- const O = new Is(), z = x, R = E - x;
12096
- v.left = O, zs(t, z, R, O.boundingData, m), g(O, z, R, m, M + 1);
12097
- const B = new Is(), A = E, N = _ - R;
12098
- v.right = B, zs(t, A, N, B.boundingData, m), g(B, A, N, m, M + 1);
12095
+ const A = new Is(), z = _, R = E - _;
12096
+ v.left = A, zs(t, z, R, A.boundingData, m), g(A, z, R, m, C + 1);
12097
+ const B = new Is(), O = E, N = x - R;
12098
+ v.right = B, zs(t, O, N, B.boundingData, m), g(B, O, N, m, C + 1);
12099
12099
  }
12100
12100
  return v;
12101
12101
  }
@@ -12135,50 +12135,50 @@ class xf {
12135
12135
  }
12136
12136
  }
12137
12137
  const mt = /* @__PURE__ */ new xf();
12138
- let hn, $n;
12138
+ let un, $n;
12139
12139
  const Nn = [], Sr = /* @__PURE__ */ new Ro(() => new Fe());
12140
12140
  function _f(r, t, e, n, i, s) {
12141
- hn = Sr.getPrimitive(), $n = Sr.getPrimitive(), Nn.push(hn, $n), mt.setBuffer(r._roots[t]);
12141
+ un = Sr.getPrimitive(), $n = Sr.getPrimitive(), Nn.push(un, $n), mt.setBuffer(r._roots[t]);
12142
12142
  const a = uo(0, r.geometry, e, n, i, s);
12143
- mt.clearBuffer(), Sr.releasePrimitive(hn), Sr.releasePrimitive($n), Nn.pop(), Nn.pop();
12143
+ mt.clearBuffer(), Sr.releasePrimitive(un), Sr.releasePrimitive($n), Nn.pop(), Nn.pop();
12144
12144
  const o = Nn.length;
12145
- return o > 0 && ($n = Nn[o - 1], hn = Nn[o - 2]), a;
12145
+ return o > 0 && ($n = Nn[o - 1], un = Nn[o - 2]), a;
12146
12146
  }
12147
12147
  function uo(r, t, e, n, i = null, s = 0, a = 0) {
12148
12148
  const { float32Array: o, uint16Array: c, uint32Array: l } = mt;
12149
12149
  let h = r * 2;
12150
12150
  if (kt(h, c)) {
12151
12151
  const m = Ht(r, l), p = ie(h, c);
12152
- return xt(r, o, hn), n(m, p, !1, a, s + r / Et, hn);
12152
+ return xt(r, o, un), n(m, p, !1, a, s + r / Et, un);
12153
12153
  } else {
12154
- let R = function(A) {
12154
+ let R = function(O) {
12155
12155
  const { uint16Array: N, uint32Array: L } = mt;
12156
- let V = A * 2;
12156
+ let V = O * 2;
12157
12157
  for (; !kt(V, N); )
12158
- A = Bt(A), V = A * 2;
12159
- return Ht(A, L);
12160
- }, B = function(A) {
12158
+ O = Bt(O), V = O * 2;
12159
+ return Ht(O, L);
12160
+ }, B = function(O) {
12161
12161
  const { uint16Array: N, uint32Array: L } = mt;
12162
- let V = A * 2;
12162
+ let V = O * 2;
12163
12163
  for (; !kt(V, N); )
12164
- A = Nt(A, L), V = A * 2;
12165
- return Ht(A, L) + ie(V, N);
12164
+ O = Nt(O, L), V = O * 2;
12165
+ return Ht(O, L) + ie(V, N);
12166
12166
  };
12167
12167
  const m = Bt(r), p = Nt(r, l);
12168
- let b = m, T = p, g, v, x, _;
12169
- if (i && (x = hn, _ = $n, xt(b, o, x), xt(T, o, _), g = i(x), v = i(_), v < g)) {
12168
+ let b = m, T = p, g, v, _, x;
12169
+ if (i && (_ = un, x = $n, xt(b, o, _), xt(T, o, x), g = i(_), v = i(x), v < g)) {
12170
12170
  b = p, T = m;
12171
- const A = g;
12172
- g = v, v = A, x = _;
12171
+ const O = g;
12172
+ g = v, v = O, _ = x;
12173
12173
  }
12174
- x || (x = hn, xt(b, o, x));
12175
- const C = kt(b * 2, c), M = e(x, C, g, a + 1, s + b / Et);
12174
+ _ || (_ = un, xt(b, o, _));
12175
+ const M = kt(b * 2, c), C = e(_, M, g, a + 1, s + b / Et);
12176
12176
  let P;
12177
- if (M === oo) {
12178
- const A = R(b), L = B(b) - A;
12179
- P = n(A, L, !0, a + 1, s + b / Et, x);
12177
+ if (C === oo) {
12178
+ const O = R(b), L = B(b) - O;
12179
+ P = n(O, L, !0, a + 1, s + b / Et, _);
12180
12180
  } else
12181
- P = M && uo(
12181
+ P = C && uo(
12182
12182
  b,
12183
12183
  t,
12184
12184
  e,
@@ -12188,14 +12188,14 @@ function uo(r, t, e, n, i = null, s = 0, a = 0) {
12188
12188
  a + 1
12189
12189
  );
12190
12190
  if (P) return !0;
12191
- _ = $n, xt(T, o, _);
12192
- const E = kt(T * 2, c), O = e(_, E, v, a + 1, s + T / Et);
12191
+ x = $n, xt(T, o, x);
12192
+ const E = kt(T * 2, c), A = e(x, E, v, a + 1, s + T / Et);
12193
12193
  let z;
12194
- if (O === oo) {
12195
- const A = R(T), L = B(T) - A;
12196
- z = n(A, L, !0, a + 1, s + T / Et, _);
12194
+ if (A === oo) {
12195
+ const O = R(T), L = B(T) - O;
12196
+ z = n(O, L, !0, a + 1, s + T / Et, x);
12197
12197
  } else
12198
- z = O && uo(
12198
+ z = A && uo(
12199
12199
  T,
12200
12200
  t,
12201
12201
  e,
@@ -12207,7 +12207,7 @@ function uo(r, t, e, n, i = null, s = 0, a = 0) {
12207
12207
  return !!z;
12208
12208
  }
12209
12209
  }
12210
- const vi = /* @__PURE__ */ new mt.constructor(), Yr = /* @__PURE__ */ new mt.constructor(), ln = /* @__PURE__ */ new Ro(() => new Fe()), Un = /* @__PURE__ */ new Fe(), Dn = /* @__PURE__ */ new Fe(), Bs = /* @__PURE__ */ new Fe(), Ns = /* @__PURE__ */ new Fe();
12210
+ const vi = /* @__PURE__ */ new mt.constructor(), Yr = /* @__PURE__ */ new mt.constructor(), cn = /* @__PURE__ */ new Ro(() => new Fe()), Un = /* @__PURE__ */ new Fe(), Dn = /* @__PURE__ */ new Fe(), Bs = /* @__PURE__ */ new Fe(), Ns = /* @__PURE__ */ new Fe();
12211
12211
  let Us = !1;
12212
12212
  function bf(r, t, e, n) {
12213
12213
  if (Us)
@@ -12218,7 +12218,7 @@ function bf(r, t, e, n) {
12218
12218
  const l = new Oe().copy(e).invert();
12219
12219
  for (let h = 0, d = i.length; h < d; h++) {
12220
12220
  vi.setBuffer(i[h]), c = 0;
12221
- const m = ln.getPrimitive();
12221
+ const m = cn.getPrimitive();
12222
12222
  xt(0, vi.float32Array, m), m.applyMatrix4(l);
12223
12223
  for (let p = 0, b = s.length; p < b && (Yr.setBuffer(s[p]), a = ke(
12224
12224
  0,
@@ -12233,7 +12233,7 @@ function bf(r, t, e, n) {
12233
12233
  m
12234
12234
  ), Yr.clearBuffer(), c += s[p].byteLength / $t, !a); p++)
12235
12235
  ;
12236
- if (ln.releasePrimitive(m), vi.clearBuffer(), o += i[h].byteLength / $t, a)
12236
+ if (cn.releasePrimitive(m), vi.clearBuffer(), o += i[h].byteLength / $t, a)
12237
12237
  break;
12238
12238
  }
12239
12239
  return Us = !1, a;
@@ -12241,12 +12241,12 @@ function bf(r, t, e, n) {
12241
12241
  function ke(r, t, e, n, i, s = 0, a = 0, o = 0, c = 0, l = null, h = !1) {
12242
12242
  let d, m;
12243
12243
  h ? (d = Yr, m = vi) : (d = vi, m = Yr);
12244
- const p = d.float32Array, b = d.uint32Array, T = d.uint16Array, g = m.float32Array, v = m.uint32Array, x = m.uint16Array, _ = r * 2, C = t * 2, M = kt(_, T), P = kt(C, x);
12244
+ const p = d.float32Array, b = d.uint32Array, T = d.uint16Array, g = m.float32Array, v = m.uint32Array, _ = m.uint16Array, x = r * 2, M = t * 2, C = kt(x, T), P = kt(M, _);
12245
12245
  let E = !1;
12246
- if (P && M)
12246
+ if (P && C)
12247
12247
  h ? E = i(
12248
12248
  Ht(t, v),
12249
- ie(t * 2, x),
12249
+ ie(t * 2, _),
12250
12250
  Ht(r, b),
12251
12251
  ie(r * 2, T),
12252
12252
  c,
@@ -12257,18 +12257,18 @@ function ke(r, t, e, n, i, s = 0, a = 0, o = 0, c = 0, l = null, h = !1) {
12257
12257
  Ht(r, b),
12258
12258
  ie(r * 2, T),
12259
12259
  Ht(t, v),
12260
- ie(t * 2, x),
12260
+ ie(t * 2, _),
12261
12261
  o,
12262
12262
  s + r / Et,
12263
12263
  c,
12264
12264
  a + t / Et
12265
12265
  );
12266
12266
  else if (P) {
12267
- const O = ln.getPrimitive();
12268
- xt(t, g, O), O.applyMatrix4(e);
12267
+ const A = cn.getPrimitive();
12268
+ xt(t, g, A), A.applyMatrix4(e);
12269
12269
  const z = Bt(r), R = Nt(r, b);
12270
12270
  xt(z, p, Un), xt(R, p, Dn);
12271
- const B = O.intersectsBox(Un), A = O.intersectsBox(Dn);
12271
+ const B = A.intersectsBox(Un), O = A.intersectsBox(Dn);
12272
12272
  E = B && ke(
12273
12273
  t,
12274
12274
  z,
@@ -12279,9 +12279,9 @@ function ke(r, t, e, n, i, s = 0, a = 0, o = 0, c = 0, l = null, h = !1) {
12279
12279
  s,
12280
12280
  c,
12281
12281
  o + 1,
12282
- O,
12282
+ A,
12283
12283
  !h
12284
- ) || A && ke(
12284
+ ) || O && ke(
12285
12285
  t,
12286
12286
  R,
12287
12287
  n,
@@ -12291,17 +12291,17 @@ function ke(r, t, e, n, i, s = 0, a = 0, o = 0, c = 0, l = null, h = !1) {
12291
12291
  s,
12292
12292
  c,
12293
12293
  o + 1,
12294
- O,
12294
+ A,
12295
12295
  !h
12296
- ), ln.releasePrimitive(O);
12296
+ ), cn.releasePrimitive(A);
12297
12297
  } else {
12298
- const O = Bt(t), z = Nt(t, v);
12299
- xt(O, g, Bs), xt(z, g, Ns);
12298
+ const A = Bt(t), z = Nt(t, v);
12299
+ xt(A, g, Bs), xt(z, g, Ns);
12300
12300
  const R = l.intersectsBox(Bs), B = l.intersectsBox(Ns);
12301
12301
  if (R && B)
12302
12302
  E = ke(
12303
12303
  r,
12304
- O,
12304
+ A,
12305
12305
  e,
12306
12306
  n,
12307
12307
  i,
@@ -12325,10 +12325,10 @@ function ke(r, t, e, n, i, s = 0, a = 0, o = 0, c = 0, l = null, h = !1) {
12325
12325
  h
12326
12326
  );
12327
12327
  else if (R)
12328
- if (M)
12328
+ if (C)
12329
12329
  E = ke(
12330
12330
  r,
12331
- O,
12331
+ A,
12332
12332
  e,
12333
12333
  n,
12334
12334
  i,
@@ -12340,13 +12340,13 @@ function ke(r, t, e, n, i, s = 0, a = 0, o = 0, c = 0, l = null, h = !1) {
12340
12340
  h
12341
12341
  );
12342
12342
  else {
12343
- const A = ln.getPrimitive();
12344
- A.copy(Bs).applyMatrix4(e);
12343
+ const O = cn.getPrimitive();
12344
+ O.copy(Bs).applyMatrix4(e);
12345
12345
  const N = Bt(r), L = Nt(r, b);
12346
12346
  xt(N, p, Un), xt(L, p, Dn);
12347
- const V = A.intersectsBox(Un), $ = A.intersectsBox(Dn);
12347
+ const V = O.intersectsBox(Un), $ = O.intersectsBox(Dn);
12348
12348
  E = V && ke(
12349
- O,
12349
+ A,
12350
12350
  N,
12351
12351
  n,
12352
12352
  e,
@@ -12355,10 +12355,10 @@ function ke(r, t, e, n, i, s = 0, a = 0, o = 0, c = 0, l = null, h = !1) {
12355
12355
  s,
12356
12356
  c,
12357
12357
  o + 1,
12358
- A,
12358
+ O,
12359
12359
  !h
12360
12360
  ) || $ && ke(
12361
- O,
12361
+ A,
12362
12362
  L,
12363
12363
  n,
12364
12364
  e,
@@ -12367,12 +12367,12 @@ function ke(r, t, e, n, i, s = 0, a = 0, o = 0, c = 0, l = null, h = !1) {
12367
12367
  s,
12368
12368
  c,
12369
12369
  o + 1,
12370
- A,
12370
+ O,
12371
12371
  !h
12372
- ), ln.releasePrimitive(A);
12372
+ ), cn.releasePrimitive(O);
12373
12373
  }
12374
12374
  else if (B)
12375
- if (M)
12375
+ if (C)
12376
12376
  E = ke(
12377
12377
  r,
12378
12378
  z,
@@ -12387,11 +12387,11 @@ function ke(r, t, e, n, i, s = 0, a = 0, o = 0, c = 0, l = null, h = !1) {
12387
12387
  h
12388
12388
  );
12389
12389
  else {
12390
- const A = ln.getPrimitive();
12391
- A.copy(Ns).applyMatrix4(e);
12390
+ const O = cn.getPrimitive();
12391
+ O.copy(Ns).applyMatrix4(e);
12392
12392
  const N = Bt(r), L = Nt(r, b);
12393
12393
  xt(N, p, Un), xt(L, p, Dn);
12394
- const V = A.intersectsBox(Un), $ = A.intersectsBox(Dn);
12394
+ const V = O.intersectsBox(Un), $ = O.intersectsBox(Dn);
12395
12395
  E = V && ke(
12396
12396
  z,
12397
12397
  N,
@@ -12402,7 +12402,7 @@ function ke(r, t, e, n, i, s = 0, a = 0, o = 0, c = 0, l = null, h = !1) {
12402
12402
  s,
12403
12403
  c,
12404
12404
  o + 1,
12405
- A,
12405
+ O,
12406
12406
  !h
12407
12407
  ) || $ && ke(
12408
12408
  z,
@@ -12414,9 +12414,9 @@ function ke(r, t, e, n, i, s = 0, a = 0, o = 0, c = 0, l = null, h = !1) {
12414
12414
  s,
12415
12415
  c,
12416
12416
  o + 1,
12417
- A,
12417
+ O,
12418
12418
  !h
12419
- ), ln.releasePrimitive(A);
12419
+ ), cn.releasePrimitive(O);
12420
12420
  }
12421
12421
  }
12422
12422
  return E;
@@ -12446,8 +12446,8 @@ class _l {
12446
12446
  let s = 1 / 0, a = 1 / 0, o = 1 / 0, c = -1 / 0, l = -1 / 0, h = -1 / 0;
12447
12447
  for (let d = t, m = t + e; d < m; d++) {
12448
12448
  this.writePrimitiveBounds(d, Ln, 0);
12449
- const [p, b, T, g, v, x] = Ln;
12450
- p < s && (s = p), g > c && (c = g), b < a && (a = b), v > l && (l = v), T < o && (o = T), x > h && (h = x);
12449
+ const [p, b, T, g, v, _] = Ln;
12450
+ p < s && (s = p), g > c && (c = g), b < a && (a = b), v > l && (l = v), T < o && (o = T), _ > h && (h = _);
12451
12451
  }
12452
12452
  return n[i + 0] = s, n[i + 1] = a, n[i + 2] = o, n[i + 3] = c, n[i + 4] = l, n[i + 5] = h, n;
12453
12453
  }
@@ -12455,8 +12455,8 @@ class _l {
12455
12455
  const i = n.offset || 0;
12456
12456
  for (let s = t, a = t + e; s < a; s++) {
12457
12457
  this.writePrimitiveBounds(s, Ln, 0);
12458
- const [o, c, l, h, d, m] = Ln, p = (o + h) / 2, b = (c + d) / 2, T = (l + m) / 2, g = (h - o) / 2, v = (d - c) / 2, x = (m - l) / 2, _ = (s - i) * 6;
12459
- n[_ + 0] = p, n[_ + 1] = g + (Math.abs(p) + g) * Fr, n[_ + 2] = b, n[_ + 3] = v + (Math.abs(b) + v) * Fr, n[_ + 4] = T, n[_ + 5] = x + (Math.abs(T) + x) * Fr;
12458
+ const [o, c, l, h, d, m] = Ln, p = (o + h) / 2, b = (c + d) / 2, T = (l + m) / 2, g = (h - o) / 2, v = (d - c) / 2, _ = (m - l) / 2, x = (s - i) * 6;
12459
+ n[x + 0] = p, n[x + 1] = g + (Math.abs(p) + g) * Fr, n[x + 2] = b, n[x + 3] = v + (Math.abs(b) + v) * Fr, n[x + 4] = T, n[x + 5] = _ + (Math.abs(T) + _) * Fr;
12460
12460
  }
12461
12461
  return n;
12462
12462
  }
@@ -12502,8 +12502,8 @@ class _l {
12502
12502
  } else {
12503
12503
  const p = Bt(h), b = Nt(h, s);
12504
12504
  for (let T = 0; T < 3; T++) {
12505
- const g = o[p + T], v = o[p + T + 3], x = o[b + T], _ = o[b + T + 3];
12506
- o[h + T] = g < x ? g : x, o[h + T + 3] = v > _ ? v : _;
12505
+ const g = o[p + T], v = o[p + T + 3], _ = o[b + T], x = o[b + T + 3];
12506
+ o[h + T] = g < _ ? g : _, o[h + T + 3] = v > x ? v : x;
12507
12507
  }
12508
12508
  }
12509
12509
  }
@@ -12700,11 +12700,11 @@ const Ef = /* @__PURE__ */ (function() {
12700
12700
  const o = i.start, c = r, l = s.start, h = t;
12701
12701
  e.subVectors(o, l), r.subVectors(i.end, i.start), t.subVectors(s.end, s.start);
12702
12702
  const d = e.dot(h), m = h.dot(c), p = h.dot(h), b = e.dot(c), g = c.dot(c) * p - m * m;
12703
- let v, x;
12704
- g !== 0 ? v = (d * m - b * p) / g : v = 0, x = (d + v * m) / p, a.x = v, a.y = x;
12703
+ let v, _;
12704
+ g !== 0 ? v = (d * m - b * p) / g : v = 0, _ = (d + v * m) / p, a.x = v, a.y = _;
12705
12705
  };
12706
12706
  })(), Oo = /* @__PURE__ */ (function() {
12707
- const r = /* @__PURE__ */ new fn(), t = /* @__PURE__ */ new H(), e = /* @__PURE__ */ new H();
12707
+ const r = /* @__PURE__ */ new hn(), t = /* @__PURE__ */ new H(), e = /* @__PURE__ */ new H();
12708
12708
  return function(i, s, a, o) {
12709
12709
  Ef(i, s, r);
12710
12710
  let c = r.x, l = r.y;
@@ -12781,102 +12781,102 @@ xe.prototype.closestPointToSegment = /* @__PURE__ */ (function() {
12781
12781
  };
12782
12782
  })();
12783
12783
  xe.prototype.intersectsTriangle = /* @__PURE__ */ (function() {
12784
- const r = /* @__PURE__ */ new xe(), t = /* @__PURE__ */ new en(), e = /* @__PURE__ */ new en(), n = /* @__PURE__ */ new H(), i = /* @__PURE__ */ new H(), s = /* @__PURE__ */ new H(), a = /* @__PURE__ */ new H(), o = /* @__PURE__ */ new tn(), c = /* @__PURE__ */ new tn(), l = /* @__PURE__ */ new H(), h = /* @__PURE__ */ new fn(), d = /* @__PURE__ */ new fn();
12785
- function m(_, C, M, P) {
12784
+ const r = /* @__PURE__ */ new xe(), t = /* @__PURE__ */ new en(), e = /* @__PURE__ */ new en(), n = /* @__PURE__ */ new H(), i = /* @__PURE__ */ new H(), s = /* @__PURE__ */ new H(), a = /* @__PURE__ */ new H(), o = /* @__PURE__ */ new tn(), c = /* @__PURE__ */ new tn(), l = /* @__PURE__ */ new H(), h = /* @__PURE__ */ new hn(), d = /* @__PURE__ */ new hn();
12785
+ function m(x, M, C, P) {
12786
12786
  const E = n;
12787
- !_.isDegenerateIntoPoint && !_.isDegenerateIntoSegment ? E.copy(_.plane.normal) : E.copy(C.plane.normal);
12788
- const O = _.satBounds, z = _.satAxes;
12789
- for (let A = 1; A < 4; A++) {
12790
- const N = O[A], L = z[A];
12791
- if (t.setFromPoints(L, C.points), N.isSeparated(t) || (a.copy(E).cross(L), t.setFromPoints(a, _.points), e.setFromPoints(a, C.points), t.isSeparated(e))) return !1;
12787
+ !x.isDegenerateIntoPoint && !x.isDegenerateIntoSegment ? E.copy(x.plane.normal) : E.copy(M.plane.normal);
12788
+ const A = x.satBounds, z = x.satAxes;
12789
+ for (let O = 1; O < 4; O++) {
12790
+ const N = A[O], L = z[O];
12791
+ if (t.setFromPoints(L, M.points), N.isSeparated(t) || (a.copy(E).cross(L), t.setFromPoints(a, x.points), e.setFromPoints(a, M.points), t.isSeparated(e))) return !1;
12792
12792
  }
12793
- const R = C.satBounds, B = C.satAxes;
12794
- for (let A = 1; A < 4; A++) {
12795
- const N = R[A], L = B[A];
12796
- if (t.setFromPoints(L, _.points), N.isSeparated(t) || (a.crossVectors(E, L), t.setFromPoints(a, _.points), e.setFromPoints(a, C.points), t.isSeparated(e))) return !1;
12793
+ const R = M.satBounds, B = M.satAxes;
12794
+ for (let O = 1; O < 4; O++) {
12795
+ const N = R[O], L = B[O];
12796
+ if (t.setFromPoints(L, x.points), N.isSeparated(t) || (a.crossVectors(E, L), t.setFromPoints(a, x.points), e.setFromPoints(a, M.points), t.isSeparated(e))) return !1;
12797
12797
  }
12798
- return M && (P || console.warn("ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0."), M.start.set(0, 0, 0), M.end.set(0, 0, 0)), !0;
12798
+ return C && (P || console.warn("ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0."), C.start.set(0, 0, 0), C.end.set(0, 0, 0)), !0;
12799
12799
  }
12800
- function p(_, C, M, P, E, O, z, R, B, A, N) {
12800
+ function p(x, M, C, P, E, A, z, R, B, O, N) {
12801
12801
  let L = z / (z - R);
12802
- A.x = P + (E - P) * L, N.start.subVectors(C, _).multiplyScalar(L).add(_), L = z / (z - B), A.y = P + (O - P) * L, N.end.subVectors(M, _).multiplyScalar(L).add(_);
12802
+ O.x = P + (E - P) * L, N.start.subVectors(M, x).multiplyScalar(L).add(x), L = z / (z - B), O.y = P + (A - P) * L, N.end.subVectors(C, x).multiplyScalar(L).add(x);
12803
12803
  }
12804
- function b(_, C, M, P, E, O, z, R, B, A, N) {
12804
+ function b(x, M, C, P, E, A, z, R, B, O, N) {
12805
12805
  if (E > 0)
12806
- p(_.c, _.a, _.b, P, C, M, B, z, R, A, N);
12807
- else if (O > 0)
12808
- p(_.b, _.a, _.c, M, C, P, R, z, B, A, N);
12806
+ p(x.c, x.a, x.b, P, M, C, B, z, R, O, N);
12807
+ else if (A > 0)
12808
+ p(x.b, x.a, x.c, C, M, P, R, z, B, O, N);
12809
12809
  else if (R * B > 0 || z != 0)
12810
- p(_.a, _.b, _.c, C, M, P, z, R, B, A, N);
12810
+ p(x.a, x.b, x.c, M, C, P, z, R, B, O, N);
12811
12811
  else if (R != 0)
12812
- p(_.b, _.a, _.c, M, C, P, R, z, B, A, N);
12812
+ p(x.b, x.a, x.c, C, M, P, R, z, B, O, N);
12813
12813
  else if (B != 0)
12814
- p(_.c, _.a, _.b, P, C, M, B, z, R, A, N);
12814
+ p(x.c, x.a, x.b, P, M, C, B, z, R, O, N);
12815
12815
  else
12816
12816
  return !0;
12817
12817
  return !1;
12818
12818
  }
12819
- function T(_, C, M, P) {
12820
- const E = C.degenerateSegment, O = _.plane.distanceToPoint(E.start), z = _.plane.distanceToPoint(E.end);
12821
- return ge(O) ? ge(z) ? m(_, C, M, P) : (M && (M.start.copy(E.start), M.end.copy(E.start)), _.containsPoint(E.start)) : ge(z) ? (M && (M.start.copy(E.end), M.end.copy(E.end)), _.containsPoint(E.end)) : _.plane.intersectLine(E, n) != null ? (M && (M.start.copy(n), M.end.copy(n)), _.containsPoint(n)) : !1;
12822
- }
12823
- function g(_, C, M) {
12824
- const P = C.a;
12825
- return ge(_.plane.distanceToPoint(P)) && _.containsPoint(P) ? (M && (M.start.copy(P), M.end.copy(P)), !0) : !1;
12826
- }
12827
- function v(_, C, M) {
12828
- const P = _.degenerateSegment, E = C.a;
12829
- return P.closestPointToPoint(E, !0, n), E.distanceToSquared(n) < Ga ? (M && (M.start.copy(E), M.end.copy(E)), !0) : !1;
12830
- }
12831
- function x(_, C, M, P) {
12832
- if (_.isDegenerateIntoSegment)
12833
- if (C.isDegenerateIntoSegment) {
12834
- const E = _.degenerateSegment, O = C.degenerateSegment, z = i, R = s;
12835
- E.delta(z), O.delta(R);
12836
- const B = n.subVectors(O.start, E.start), A = z.x * R.y - z.y * R.x;
12837
- if (ge(A))
12819
+ function T(x, M, C, P) {
12820
+ const E = M.degenerateSegment, A = x.plane.distanceToPoint(E.start), z = x.plane.distanceToPoint(E.end);
12821
+ return ge(A) ? ge(z) ? m(x, M, C, P) : (C && (C.start.copy(E.start), C.end.copy(E.start)), x.containsPoint(E.start)) : ge(z) ? (C && (C.start.copy(E.end), C.end.copy(E.end)), x.containsPoint(E.end)) : x.plane.intersectLine(E, n) != null ? (C && (C.start.copy(n), C.end.copy(n)), x.containsPoint(n)) : !1;
12822
+ }
12823
+ function g(x, M, C) {
12824
+ const P = M.a;
12825
+ return ge(x.plane.distanceToPoint(P)) && x.containsPoint(P) ? (C && (C.start.copy(P), C.end.copy(P)), !0) : !1;
12826
+ }
12827
+ function v(x, M, C) {
12828
+ const P = x.degenerateSegment, E = M.a;
12829
+ return P.closestPointToPoint(E, !0, n), E.distanceToSquared(n) < Ga ? (C && (C.start.copy(E), C.end.copy(E)), !0) : !1;
12830
+ }
12831
+ function _(x, M, C, P) {
12832
+ if (x.isDegenerateIntoSegment)
12833
+ if (M.isDegenerateIntoSegment) {
12834
+ const E = x.degenerateSegment, A = M.degenerateSegment, z = i, R = s;
12835
+ E.delta(z), A.delta(R);
12836
+ const B = n.subVectors(A.start, E.start), O = z.x * R.y - z.y * R.x;
12837
+ if (ge(O))
12838
12838
  return !1;
12839
- const N = (B.x * R.y - B.y * R.x) / A, L = -(z.x * B.y - z.y * B.x) / A;
12839
+ const N = (B.x * R.y - B.y * R.x) / O, L = -(z.x * B.y - z.y * B.x) / O;
12840
12840
  if (N < 0 || N > 1 || L < 0 || L > 1)
12841
12841
  return !1;
12842
- const V = E.start.z + z.z * N, $ = O.start.z + R.z * L;
12843
- return ge(V - $) ? (M && (M.start.copy(E.start).addScaledVector(z, N), M.end.copy(E.start).addScaledVector(z, N)), !0) : !1;
12844
- } else return C.isDegenerateIntoPoint ? v(_, C, M) : T(C, _, M, P);
12842
+ const V = E.start.z + z.z * N, $ = A.start.z + R.z * L;
12843
+ return ge(V - $) ? (C && (C.start.copy(E.start).addScaledVector(z, N), C.end.copy(E.start).addScaledVector(z, N)), !0) : !1;
12844
+ } else return M.isDegenerateIntoPoint ? v(x, M, C) : T(M, x, C, P);
12845
12845
  else {
12846
- if (_.isDegenerateIntoPoint)
12847
- return C.isDegenerateIntoPoint ? C.a.distanceToSquared(_.a) < Ga ? (M && (M.start.copy(_.a), M.end.copy(_.a)), !0) : !1 : C.isDegenerateIntoSegment ? v(C, _, M) : g(C, _, M);
12848
- if (C.isDegenerateIntoPoint)
12849
- return g(_, C, M);
12850
- if (C.isDegenerateIntoSegment)
12851
- return T(_, C, M, P);
12846
+ if (x.isDegenerateIntoPoint)
12847
+ return M.isDegenerateIntoPoint ? M.a.distanceToSquared(x.a) < Ga ? (C && (C.start.copy(x.a), C.end.copy(x.a)), !0) : !1 : M.isDegenerateIntoSegment ? v(M, x, C) : g(M, x, C);
12848
+ if (M.isDegenerateIntoPoint)
12849
+ return g(x, M, C);
12850
+ if (M.isDegenerateIntoSegment)
12851
+ return T(x, M, C, P);
12852
12852
  }
12853
12853
  }
12854
- return function(C, M = null, P = !1) {
12855
- this.needsUpdate && this.update(), C.isExtendedTriangle ? C.needsUpdate && C.update() : (r.copy(C), r.update(), C = r);
12856
- const E = x(this, C, M, P);
12854
+ return function(M, C = null, P = !1) {
12855
+ this.needsUpdate && this.update(), M.isExtendedTriangle ? M.needsUpdate && M.update() : (r.copy(M), r.update(), M = r);
12856
+ const E = _(this, M, C, P);
12857
12857
  if (E !== void 0)
12858
12858
  return E;
12859
- const O = this.plane, z = C.plane;
12860
- let R = z.distanceToPoint(this.a), B = z.distanceToPoint(this.b), A = z.distanceToPoint(this.c);
12861
- ge(R) && (R = 0), ge(B) && (B = 0), ge(A) && (A = 0);
12862
- const N = R * B, L = R * A;
12859
+ const A = this.plane, z = M.plane;
12860
+ let R = z.distanceToPoint(this.a), B = z.distanceToPoint(this.b), O = z.distanceToPoint(this.c);
12861
+ ge(R) && (R = 0), ge(B) && (B = 0), ge(O) && (O = 0);
12862
+ const N = R * B, L = R * O;
12863
12863
  if (N > 0 && L > 0)
12864
12864
  return !1;
12865
- let V = O.distanceToPoint(C.a), $ = O.distanceToPoint(C.b), Q = O.distanceToPoint(C.c);
12865
+ let V = A.distanceToPoint(M.a), $ = A.distanceToPoint(M.b), Q = A.distanceToPoint(M.c);
12866
12866
  ge(V) && (V = 0), ge($) && ($ = 0), ge(Q) && (Q = 0);
12867
12867
  const W = V * $, yt = V * Q;
12868
12868
  if (W > 0 && yt > 0)
12869
12869
  return !1;
12870
- i.copy(O.normal), s.copy(z.normal);
12870
+ i.copy(A.normal), s.copy(z.normal);
12871
12871
  const nt = i.cross(s);
12872
12872
  let ht = 0, st = Math.abs(nt.x);
12873
12873
  const vt = Math.abs(nt.y);
12874
12874
  vt > st && (st = vt, ht = 1), Math.abs(nt.z) > st && (ht = 2);
12875
- const ot = Rf[ht], ft = this.a[ot], at = this.b[ot], Yt = this.c[ot], Jt = C.a[ot], jt = C.b[ot], Zt = C.c[ot];
12876
- if (b(this, ft, at, Yt, N, L, R, B, A, h, o))
12877
- return m(this, C, M, P);
12878
- if (b(C, Jt, jt, Zt, W, yt, V, $, Q, d, c))
12879
- return m(this, C, M, P);
12875
+ const ot = Rf[ht], ft = this.a[ot], at = this.b[ot], Yt = this.c[ot], Jt = M.a[ot], jt = M.b[ot], Zt = M.c[ot];
12876
+ if (b(this, ft, at, Yt, N, L, R, B, O, h, o))
12877
+ return m(this, M, C, P);
12878
+ if (b(M, Jt, jt, Zt, W, yt, V, $, Q, d, c))
12879
+ return m(this, M, C, P);
12880
12880
  if (h.y < h.x) {
12881
12881
  const _t = h.y;
12882
12882
  h.y = h.x, h.x = _t, l.copy(o.start), o.start.copy(o.end), o.end.copy(l);
@@ -12885,7 +12885,7 @@ xe.prototype.intersectsTriangle = /* @__PURE__ */ (function() {
12885
12885
  const _t = d.y;
12886
12886
  d.y = d.x, d.x = _t, l.copy(c.start), c.start.copy(c.end), c.end.copy(l);
12887
12887
  }
12888
- return h.y < d.x || d.y < h.x ? !1 : (M && (d.x > h.x ? M.start.copy(c.start) : M.start.copy(o.start), d.y < h.y ? M.end.copy(c.end) : M.end.copy(o.end)), !0);
12888
+ return h.y < d.x || d.y < h.x ? !1 : (C && (d.x > h.x ? C.start.copy(c.start) : C.start.copy(o.start), d.y < h.y ? C.end.copy(c.end) : C.end.copy(o.end)), !0);
12889
12889
  };
12890
12890
  })();
12891
12891
  xe.prototype.distanceToPoint = /* @__PURE__ */ (function() {
@@ -13009,35 +13009,35 @@ Xt.prototype.distanceToBox = /* @__PURE__ */ (function() {
13009
13009
  for (let g = 0; g < 8; g++) {
13010
13010
  const v = p[g];
13011
13011
  i.copy(v).clamp(d, m);
13012
- const x = v.distanceToSquared(i);
13013
- if (x < b && (b = x, c && c.copy(v), l && l.copy(i), x < h))
13014
- return Math.sqrt(x);
13012
+ const _ = v.distanceToSquared(i);
13013
+ if (_ < b && (b = _, c && c.copy(v), l && l.copy(i), _ < h))
13014
+ return Math.sqrt(_);
13015
13015
  }
13016
13016
  let T = 0;
13017
13017
  for (let g = 0; g < 3; g++)
13018
13018
  for (let v = 0; v <= 1; v++)
13019
- for (let x = 0; x <= 1; x++) {
13020
- const _ = (g + 1) % 3, C = (g + 2) % 3, M = v << _ | x << C, P = 1 << g | v << _ | x << C, E = p[M], O = p[P];
13021
- t[T].set(E, O);
13022
- const R = r[g], B = r[_], A = r[C], N = e[T], L = N.start, V = N.end;
13023
- L[R] = d[R], L[B] = v ? d[B] : m[B], L[A] = x ? d[A] : m[B], V[R] = m[R], V[B] = v ? d[B] : m[B], V[A] = x ? d[A] : m[B], T++;
13019
+ for (let _ = 0; _ <= 1; _++) {
13020
+ const x = (g + 1) % 3, M = (g + 2) % 3, C = v << x | _ << M, P = 1 << g | v << x | _ << M, E = p[C], A = p[P];
13021
+ t[T].set(E, A);
13022
+ const R = r[g], B = r[x], O = r[M], N = e[T], L = N.start, V = N.end;
13023
+ L[R] = d[R], L[B] = v ? d[B] : m[B], L[O] = _ ? d[O] : m[B], V[R] = m[R], V[B] = v ? d[B] : m[B], V[O] = _ ? d[O] : m[B], T++;
13024
13024
  }
13025
13025
  for (let g = 0; g <= 1; g++)
13026
13026
  for (let v = 0; v <= 1; v++)
13027
- for (let x = 0; x <= 1; x++) {
13028
- i.x = g ? m.x : d.x, i.y = v ? m.y : d.y, i.z = x ? m.z : d.z, this.closestPointToPoint(i, n);
13029
- const _ = i.distanceToSquared(n);
13030
- if (_ < b && (b = _, c && c.copy(n), l && l.copy(i), _ < h))
13031
- return Math.sqrt(_);
13027
+ for (let _ = 0; _ <= 1; _++) {
13028
+ i.x = g ? m.x : d.x, i.y = v ? m.y : d.y, i.z = _ ? m.z : d.z, this.closestPointToPoint(i, n);
13029
+ const x = i.distanceToSquared(n);
13030
+ if (x < b && (b = x, c && c.copy(n), l && l.copy(i), x < h))
13031
+ return Math.sqrt(x);
13032
13032
  }
13033
13033
  for (let g = 0; g < 12; g++) {
13034
13034
  const v = t[g];
13035
- for (let x = 0; x < 12; x++) {
13036
- const _ = e[x];
13037
- Oo(v, _, n, i);
13038
- const C = n.distanceToSquared(i);
13039
- if (C < b && (b = C, c && c.copy(n), l && l.copy(i), C < h))
13040
- return Math.sqrt(C);
13035
+ for (let _ = 0; _ < 12; _++) {
13036
+ const x = e[_];
13037
+ Oo(v, x, n, i);
13038
+ const M = n.distanceToSquared(i);
13039
+ if (M < b && (b = M, c && c.copy(n), l && l.copy(i), M < h))
13040
+ return Math.sqrt(M);
13041
13041
  }
13042
13042
  }
13043
13043
  return Math.sqrt(b);
@@ -13066,7 +13066,7 @@ function Of(r, t, e = {}, n = 0, i = 1 / 0) {
13066
13066
  const l = Math.sqrt(o);
13067
13067
  return e.point ? e.point.copy(Ds) : e.point = Ds.clone(), e.distance = l, e.faceIndex = c, e;
13068
13068
  }
13069
- const xr = parseInt(fc) >= 169, zf = parseInt(fc) <= 161, Sn = /* @__PURE__ */ new H(), xn = /* @__PURE__ */ new H(), _n = /* @__PURE__ */ new H(), _r = /* @__PURE__ */ new fn(), br = /* @__PURE__ */ new fn(), Tr = /* @__PURE__ */ new fn(), Wa = /* @__PURE__ */ new H(), $a = /* @__PURE__ */ new H(), Ha = /* @__PURE__ */ new H(), oi = /* @__PURE__ */ new H();
13069
+ const xr = parseInt(fc) >= 169, zf = parseInt(fc) <= 161, vn = /* @__PURE__ */ new H(), Sn = /* @__PURE__ */ new H(), xn = /* @__PURE__ */ new H(), _r = /* @__PURE__ */ new hn(), br = /* @__PURE__ */ new hn(), Tr = /* @__PURE__ */ new hn(), Wa = /* @__PURE__ */ new H(), $a = /* @__PURE__ */ new H(), Ha = /* @__PURE__ */ new H(), oi = /* @__PURE__ */ new H();
13070
13070
  function If(r, t, e, n, i, s, a, o) {
13071
13071
  let c;
13072
13072
  if (s === Hl ? c = r.intersectTriangle(n, e, t, !0, i) : c = r.intersectTriangle(t, e, n, s !== Gs, i), c === null) return null;
@@ -13077,22 +13077,22 @@ function If(r, t, e, n, i, s, a, o) {
13077
13077
  };
13078
13078
  }
13079
13079
  function qa(r, t, e, n, i, s, a, o, c, l, h) {
13080
- Sn.fromBufferAttribute(t, s), xn.fromBufferAttribute(t, a), _n.fromBufferAttribute(t, o);
13081
- const d = If(r, Sn, xn, _n, oi, c, l, h);
13080
+ vn.fromBufferAttribute(t, s), Sn.fromBufferAttribute(t, a), xn.fromBufferAttribute(t, o);
13081
+ const d = If(r, vn, Sn, xn, oi, c, l, h);
13082
13082
  if (d) {
13083
13083
  if (n) {
13084
- _r.fromBufferAttribute(n, s), br.fromBufferAttribute(n, a), Tr.fromBufferAttribute(n, o), d.uv = new fn();
13085
- const p = Mn.getInterpolation(oi, Sn, xn, _n, _r, br, Tr, d.uv);
13084
+ _r.fromBufferAttribute(n, s), br.fromBufferAttribute(n, a), Tr.fromBufferAttribute(n, o), d.uv = new hn();
13085
+ const p = Mn.getInterpolation(oi, vn, Sn, xn, _r, br, Tr, d.uv);
13086
13086
  xr || (d.uv = p);
13087
13087
  }
13088
13088
  if (i) {
13089
- _r.fromBufferAttribute(i, s), br.fromBufferAttribute(i, a), Tr.fromBufferAttribute(i, o), d.uv1 = new fn();
13090
- const p = Mn.getInterpolation(oi, Sn, xn, _n, _r, br, Tr, d.uv1);
13089
+ _r.fromBufferAttribute(i, s), br.fromBufferAttribute(i, a), Tr.fromBufferAttribute(i, o), d.uv1 = new hn();
13090
+ const p = Mn.getInterpolation(oi, vn, Sn, xn, _r, br, Tr, d.uv1);
13091
13091
  xr || (d.uv1 = p), zf && (d.uv2 = d.uv1);
13092
13092
  }
13093
13093
  if (e) {
13094
13094
  Wa.fromBufferAttribute(e, s), $a.fromBufferAttribute(e, a), Ha.fromBufferAttribute(e, o), d.normal = new H();
13095
- const p = Mn.getInterpolation(oi, Sn, xn, _n, Wa, $a, Ha, d.normal);
13095
+ const p = Mn.getInterpolation(oi, vn, Sn, xn, Wa, $a, Ha, d.normal);
13096
13096
  d.normal.dot(r.direction) > 0 && d.normal.multiplyScalar(-1), xr || (d.normal = p);
13097
13097
  }
13098
13098
  const m = {
@@ -13102,9 +13102,9 @@ function qa(r, t, e, n, i, s, a, o, c, l, h) {
13102
13102
  normal: new H(),
13103
13103
  materialIndex: 0
13104
13104
  };
13105
- if (Mn.getNormal(Sn, xn, _n, m.normal), d.face = m, d.faceIndex = s, xr) {
13105
+ if (Mn.getNormal(vn, Sn, xn, m.normal), d.face = m, d.faceIndex = s, xr) {
13106
13106
  const p = new H();
13107
- Mn.getBarycoord(oi, Sn, xn, _n, p), d.barycoord = p;
13107
+ Mn.getBarycoord(oi, vn, Sn, xn, p), d.barycoord = p;
13108
13108
  }
13109
13109
  }
13110
13110
  return d;
@@ -13120,24 +13120,24 @@ function is(r, t, e, n, i, s, a) {
13120
13120
  const { position: p, normal: b, uv: T, uv1: g } = r.attributes;
13121
13121
  if (Array.isArray(t)) {
13122
13122
  const v = n * 3;
13123
- for (let x = 0, _ = m.length; x < _; x++) {
13124
- const { start: C, count: M, materialIndex: P } = m[x];
13125
- if (v >= C && v < C + M) {
13126
- const E = Xa(t[P]), O = qa(e, p, b, T, g, c, l, h, E, s, a);
13127
- if (O)
13128
- if (O.faceIndex = n, O.face.materialIndex = P, i)
13129
- i.push(O);
13123
+ for (let _ = 0, x = m.length; _ < x; _++) {
13124
+ const { start: M, count: C, materialIndex: P } = m[_];
13125
+ if (v >= M && v < M + C) {
13126
+ const E = Xa(t[P]), A = qa(e, p, b, T, g, c, l, h, E, s, a);
13127
+ if (A)
13128
+ if (A.faceIndex = n, A.face.materialIndex = P, i)
13129
+ i.push(A);
13130
13130
  else
13131
- return O;
13131
+ return A;
13132
13132
  }
13133
13133
  }
13134
13134
  } else {
13135
- const v = Xa(t), x = qa(e, p, b, T, g, c, l, h, v, s, a);
13136
- if (x)
13137
- if (x.faceIndex = n, x.face.materialIndex = 0, i)
13138
- i.push(x);
13135
+ const v = Xa(t), _ = qa(e, p, b, T, g, c, l, h, v, s, a);
13136
+ if (_)
13137
+ if (_.faceIndex = n, _.face.materialIndex = 0, i)
13138
+ i.push(_);
13139
13139
  else
13140
- return x;
13140
+ return _;
13141
13141
  }
13142
13142
  return null;
13143
13143
  }
@@ -13180,43 +13180,43 @@ function Df(r, t = null) {
13180
13180
  const T = m * 2;
13181
13181
  if (kt(T, o)) {
13182
13182
  const g = Ht(m, a), v = ie(T, o);
13183
- let x = 1 / 0, _ = 1 / 0, C = 1 / 0, M = -1 / 0, P = -1 / 0, E = -1 / 0;
13184
- for (let O = 3 * g, z = 3 * (g + v); O < z; O++) {
13185
- let R = n[O];
13186
- const B = i.getX(R), A = i.getY(R), N = i.getZ(R);
13187
- B < x && (x = B), B > M && (M = B), A < _ && (_ = A), A > P && (P = A), N < C && (C = N), N > E && (E = N);
13183
+ let _ = 1 / 0, x = 1 / 0, M = 1 / 0, C = -1 / 0, P = -1 / 0, E = -1 / 0;
13184
+ for (let A = 3 * g, z = 3 * (g + v); A < z; A++) {
13185
+ let R = n[A];
13186
+ const B = i.getX(R), O = i.getY(R), N = i.getZ(R);
13187
+ B < _ && (_ = B), B > C && (C = B), O < x && (x = O), O > P && (P = O), N < M && (M = N), N > E && (E = N);
13188
13188
  }
13189
- return c[m + 0] !== x || c[m + 1] !== _ || c[m + 2] !== C || c[m + 3] !== M || c[m + 4] !== P || c[m + 5] !== E ? (c[m + 0] = x, c[m + 1] = _, c[m + 2] = C, c[m + 3] = M, c[m + 4] = P, c[m + 5] = E, !0) : !1;
13189
+ return c[m + 0] !== _ || c[m + 1] !== x || c[m + 2] !== M || c[m + 3] !== C || c[m + 4] !== P || c[m + 5] !== E ? (c[m + 0] = _, c[m + 1] = x, c[m + 2] = M, c[m + 3] = C, c[m + 4] = P, c[m + 5] = E, !0) : !1;
13190
13190
  } else {
13191
13191
  const g = Bt(m), v = Nt(m, a);
13192
- let x = b, _ = !1, C = !1;
13192
+ let _ = b, x = !1, M = !1;
13193
13193
  if (t) {
13194
- if (!x) {
13194
+ if (!_) {
13195
13195
  const R = g / Et + p / $t, B = v / Et + p / $t;
13196
- _ = t.has(R), C = t.has(B), x = !_ && !C;
13196
+ x = t.has(R), M = t.has(B), _ = !x && !M;
13197
13197
  }
13198
13198
  } else
13199
- _ = !0, C = !0;
13200
- const M = x || _, P = x || C;
13199
+ x = !0, M = !0;
13200
+ const C = _ || x, P = _ || M;
13201
13201
  let E = !1;
13202
- M && (E = d(g, p, x));
13203
- let O = !1;
13204
- P && (O = d(v, p, x));
13205
- const z = E || O;
13202
+ C && (E = d(g, p, _));
13203
+ let A = !1;
13204
+ P && (A = d(v, p, _));
13205
+ const z = E || A;
13206
13206
  if (z)
13207
13207
  for (let R = 0; R < 3; R++) {
13208
- const B = g + R, A = v + R, N = c[B], L = c[B + 3], V = c[A], $ = c[A + 3];
13208
+ const B = g + R, O = v + R, N = c[B], L = c[B + 3], V = c[O], $ = c[O + 3];
13209
13209
  c[m + R] = N < V ? N : V, c[m + R + 3] = L > $ ? L : $;
13210
13210
  }
13211
13211
  return z;
13212
13212
  }
13213
13213
  }
13214
13214
  }
13215
- function dn(r, t, e, n, i) {
13215
+ function fn(r, t, e, n, i) {
13216
13216
  let s, a, o, c, l, h;
13217
13217
  const d = 1 / e.direction.x, m = 1 / e.direction.y, p = 1 / e.direction.z, b = e.origin.x, T = e.origin.y, g = e.origin.z;
13218
- let v = t[r], x = t[r + 3], _ = t[r + 1], C = t[r + 3 + 1], M = t[r + 2], P = t[r + 3 + 2];
13219
- return d >= 0 ? (s = (v - b) * d, a = (x - b) * d) : (s = (x - b) * d, a = (v - b) * d), m >= 0 ? (o = (_ - T) * m, c = (C - T) * m) : (o = (C - T) * m, c = (_ - T) * m), s > c || o > a || ((o > s || isNaN(s)) && (s = o), (c < a || isNaN(a)) && (a = c), p >= 0 ? (l = (M - g) * p, h = (P - g) * p) : (l = (P - g) * p, h = (M - g) * p), s > h || l > a) ? !1 : ((l > s || s !== s) && (s = l), (h < a || a !== a) && (a = h), s <= i && a >= n);
13218
+ let v = t[r], _ = t[r + 3], x = t[r + 1], M = t[r + 3 + 1], C = t[r + 2], P = t[r + 3 + 2];
13219
+ return d >= 0 ? (s = (v - b) * d, a = (_ - b) * d) : (s = (_ - b) * d, a = (v - b) * d), m >= 0 ? (o = (x - T) * m, c = (M - T) * m) : (o = (M - T) * m, c = (x - T) * m), s > c || o > a || ((o > s || isNaN(s)) && (s = o), (c < a || isNaN(a)) && (a = c), p >= 0 ? (l = (C - g) * p, h = (P - g) * p) : (l = (P - g) * p, h = (C - g) * p), s > h || l > a) ? !1 : ((l > s || s !== s) && (s = l), (h < a || a !== a) && (a = h), s <= i && a >= n);
13220
13220
  }
13221
13221
  function Lf(r, t, e, n, i, s, a, o) {
13222
13222
  const { geometry: c, _indirectBuffer: l } = r;
@@ -13253,9 +13253,9 @@ function ho(r, t, e, n, i, s, a) {
13253
13253
  Bf(t, e, n, m, p, i, s, a);
13254
13254
  } else {
13255
13255
  const m = Bt(r);
13256
- dn(m, o, n, s, a) && ho(m, t, e, n, i, s, a);
13256
+ fn(m, o, n, s, a) && ho(m, t, e, n, i, s, a);
13257
13257
  const p = Nt(r, l);
13258
- dn(p, o, n, s, a) && ho(p, t, e, n, i, s, a);
13258
+ fn(p, o, n, s, a) && ho(p, t, e, n, i, s, a);
13259
13259
  }
13260
13260
  }
13261
13261
  const jf = ["x", "y", "z"];
@@ -13274,17 +13274,17 @@ function fo(r, t, e, n, i, s) {
13274
13274
  const d = ko(r, c), m = jf[d], b = n.direction[m] >= 0;
13275
13275
  let T, g;
13276
13276
  b ? (T = Bt(r), g = Nt(r, c)) : (T = Nt(r, c), g = Bt(r));
13277
- const x = dn(T, a, n, i, s) ? fo(T, t, e, n, i, s) : null;
13278
- if (x) {
13279
- const M = x.point[m];
13280
- if (b ? M <= a[g + d] : (
13277
+ const _ = fn(T, a, n, i, s) ? fo(T, t, e, n, i, s) : null;
13278
+ if (_) {
13279
+ const C = _.point[m];
13280
+ if (b ? C <= a[g + d] : (
13281
13281
  // min bounding data
13282
- M >= a[g + d + 3]
13282
+ C >= a[g + d + 3]
13283
13283
  ))
13284
- return x;
13284
+ return _;
13285
13285
  }
13286
- const C = dn(g, a, n, i, s) ? fo(g, t, e, n, i, s) : null;
13287
- return x && C ? x.distance <= C.distance ? x : C : x || C || null;
13286
+ const M = fn(g, a, n, i, s) ? fo(g, t, e, n, i, s) : null;
13287
+ return _ && M ? _.distance <= M.distance ? _ : M : _ || M || null;
13288
13288
  }
13289
13289
  }
13290
13290
  const Cr = /* @__PURE__ */ new Fe(), Fn = /* @__PURE__ */ new xe(), Vn = /* @__PURE__ */ new xe(), ai = /* @__PURE__ */ new Oe(), Ya = /* @__PURE__ */ new Xt(), Mr = /* @__PURE__ */ new Xt();
@@ -13300,21 +13300,21 @@ function po(r, t, e, n, i = null) {
13300
13300
  const h = t.geometry, d = h.index, m = h.attributes.position, p = e.index, b = e.attributes.position, T = Ht(r, o), g = ie(c, a);
13301
13301
  if (ai.copy(n).invert(), e.boundsTree)
13302
13302
  return xt(r, s, Mr), Mr.matrix.copy(ai), Mr.needsUpdate = !0, e.boundsTree.shapecast({
13303
- intersectsBounds: (x) => Mr.intersectsBox(x),
13304
- intersectsTriangle: (x) => {
13305
- x.a.applyMatrix4(n), x.b.applyMatrix4(n), x.c.applyMatrix4(n), x.needsUpdate = !0;
13306
- for (let _ = T * 3, C = (g + T) * 3; _ < C; _ += 3)
13307
- if (Pt(Vn, _, d, m), Vn.needsUpdate = !0, x.intersectsTriangle(Vn))
13303
+ intersectsBounds: (_) => Mr.intersectsBox(_),
13304
+ intersectsTriangle: (_) => {
13305
+ _.a.applyMatrix4(n), _.b.applyMatrix4(n), _.c.applyMatrix4(n), _.needsUpdate = !0;
13306
+ for (let x = T * 3, M = (g + T) * 3; x < M; x += 3)
13307
+ if (Pt(Vn, x, d, m), Vn.needsUpdate = !0, _.intersectsTriangle(Vn))
13308
13308
  return !0;
13309
13309
  return !1;
13310
13310
  }
13311
13311
  });
13312
13312
  {
13313
13313
  const v = ns(e);
13314
- for (let x = T * 3, _ = (g + T) * 3; x < _; x += 3) {
13315
- Pt(Fn, x, d, m), Fn.a.applyMatrix4(ai), Fn.b.applyMatrix4(ai), Fn.c.applyMatrix4(ai), Fn.needsUpdate = !0;
13316
- for (let C = 0, M = v * 3; C < M; C += 3)
13317
- if (Pt(Vn, C, p, b), Vn.needsUpdate = !0, Fn.intersectsTriangle(Vn))
13314
+ for (let _ = T * 3, x = (g + T) * 3; _ < x; _ += 3) {
13315
+ Pt(Fn, _, d, m), Fn.a.applyMatrix4(ai), Fn.b.applyMatrix4(ai), Fn.c.applyMatrix4(ai), Fn.needsUpdate = !0;
13316
+ for (let M = 0, C = v * 3; M < C; M += 3)
13317
+ if (Pt(Vn, M, p, b), Vn.needsUpdate = !0, Fn.intersectsTriangle(Vn))
13318
13318
  return !0;
13319
13319
  }
13320
13320
  }
@@ -13329,23 +13329,23 @@ function Yf(r, t, e, n = {}, i = {}, s = 0, a = 1 / 0) {
13329
13329
  const o = r.geometry, c = o.attributes.position, l = o.index, h = t.attributes.position, d = t.index, m = Se.getPrimitive(), p = Se.getPrimitive();
13330
13330
  let b = $f, T = Hf, g = null, v = null;
13331
13331
  i && (g = qf, v = Xf);
13332
- let x = 1 / 0, _ = null, C = null;
13332
+ let _ = 1 / 0, x = null, M = null;
13333
13333
  return wr.copy(e).invert(), ci.matrix.copy(wr), r.shapecast(
13334
13334
  {
13335
- boundsTraverseOrder: (M) => Ls.distanceToBox(M),
13336
- intersectsBounds: (M, P, E) => E < x && E < a ? (P && (ci.min.copy(M.min), ci.max.copy(M.max), ci.needsUpdate = !0), !0) : !1,
13337
- intersectsRange: (M, P) => {
13335
+ boundsTraverseOrder: (C) => Ls.distanceToBox(C),
13336
+ intersectsBounds: (C, P, E) => E < _ && E < a ? (P && (ci.min.copy(C.min), ci.max.copy(C.max), ci.needsUpdate = !0), !0) : !1,
13337
+ intersectsRange: (C, P) => {
13338
13338
  if (t.boundsTree)
13339
13339
  return t.boundsTree.shapecast({
13340
- boundsTraverseOrder: (O) => ci.distanceToBox(O),
13341
- intersectsBounds: (O, z, R) => R < x && R < a,
13342
- intersectsRange: (O, z) => {
13343
- for (let R = O, B = O + z; R < B; R++) {
13340
+ boundsTraverseOrder: (A) => ci.distanceToBox(A),
13341
+ intersectsBounds: (A, z, R) => R < _ && R < a,
13342
+ intersectsRange: (A, z) => {
13343
+ for (let R = A, B = A + z; R < B; R++) {
13344
13344
  Pt(p, 3 * R, d, h), p.a.applyMatrix4(e), p.b.applyMatrix4(e), p.c.applyMatrix4(e), p.needsUpdate = !0;
13345
- for (let A = M, N = M + P; A < N; A++) {
13346
- Pt(m, 3 * A, l, c), m.needsUpdate = !0;
13345
+ for (let O = C, N = C + P; O < N; O++) {
13346
+ Pt(m, 3 * O, l, c), m.needsUpdate = !0;
13347
13347
  const L = m.distanceToTriangle(p, b, g);
13348
- if (L < x && (T.copy(b), v && v.copy(g), x = L, _ = A, C = R), L < s)
13348
+ if (L < _ && (T.copy(b), v && v.copy(g), _ = L, x = O, M = R), L < s)
13349
13349
  return !0;
13350
13350
  }
13351
13351
  }
@@ -13353,19 +13353,19 @@ function Yf(r, t, e, n = {}, i = {}, s = 0, a = 1 / 0) {
13353
13353
  });
13354
13354
  {
13355
13355
  const E = ns(t);
13356
- for (let O = 0, z = E; O < z; O++) {
13357
- Pt(p, 3 * O, d, h), p.a.applyMatrix4(e), p.b.applyMatrix4(e), p.c.applyMatrix4(e), p.needsUpdate = !0;
13358
- for (let R = M, B = M + P; R < B; R++) {
13356
+ for (let A = 0, z = E; A < z; A++) {
13357
+ Pt(p, 3 * A, d, h), p.a.applyMatrix4(e), p.b.applyMatrix4(e), p.c.applyMatrix4(e), p.needsUpdate = !0;
13358
+ for (let R = C, B = C + P; R < B; R++) {
13359
13359
  Pt(m, 3 * R, l, c), m.needsUpdate = !0;
13360
- const A = m.distanceToTriangle(p, b, g);
13361
- if (A < x && (T.copy(b), v && v.copy(g), x = A, _ = R, C = O), A < s)
13360
+ const O = m.distanceToTriangle(p, b, g);
13361
+ if (O < _ && (T.copy(b), v && v.copy(g), _ = O, x = R, M = A), O < s)
13362
13362
  return !0;
13363
13363
  }
13364
13364
  }
13365
13365
  }
13366
13366
  }
13367
13367
  }
13368
- ), Se.releasePrimitive(m), Se.releasePrimitive(p), x === 1 / 0 ? null : (n.point ? n.point.copy(T) : n.point = T.clone(), n.distance = x, n.faceIndex = _, i && (i.point ? i.point.copy(v) : i.point = v.clone(), i.point.applyMatrix4(wr), T.applyMatrix4(wr), i.distance = T.sub(i.point).length(), i.faceIndex = C), n);
13368
+ ), Se.releasePrimitive(m), Se.releasePrimitive(p), _ === 1 / 0 ? null : (n.point ? n.point.copy(T) : n.point = T.clone(), n.distance = _, n.faceIndex = x, i && (i.point ? i.point.copy(v) : i.point = v.clone(), i.point.applyMatrix4(wr), T.applyMatrix4(wr), i.distance = T.sub(i.point).length(), i.faceIndex = M), n);
13369
13369
  }
13370
13370
  function Zf(r, t = null) {
13371
13371
  t && Array.isArray(t) && (t = new Set(t));
@@ -13378,36 +13378,36 @@ function Zf(r, t = null) {
13378
13378
  const T = m * 2;
13379
13379
  if (kt(T, o)) {
13380
13380
  const g = Ht(m, a), v = ie(T, o);
13381
- let x = 1 / 0, _ = 1 / 0, C = 1 / 0, M = -1 / 0, P = -1 / 0, E = -1 / 0;
13382
- for (let O = g, z = g + v; O < z; O++) {
13383
- const R = 3 * r.resolveTriangleIndex(O);
13381
+ let _ = 1 / 0, x = 1 / 0, M = 1 / 0, C = -1 / 0, P = -1 / 0, E = -1 / 0;
13382
+ for (let A = g, z = g + v; A < z; A++) {
13383
+ const R = 3 * r.resolveTriangleIndex(A);
13384
13384
  for (let B = 0; B < 3; B++) {
13385
- let A = R + B;
13386
- A = n ? n[A] : A;
13387
- const N = i.getX(A), L = i.getY(A), V = i.getZ(A);
13388
- N < x && (x = N), N > M && (M = N), L < _ && (_ = L), L > P && (P = L), V < C && (C = V), V > E && (E = V);
13385
+ let O = R + B;
13386
+ O = n ? n[O] : O;
13387
+ const N = i.getX(O), L = i.getY(O), V = i.getZ(O);
13388
+ N < _ && (_ = N), N > C && (C = N), L < x && (x = L), L > P && (P = L), V < M && (M = V), V > E && (E = V);
13389
13389
  }
13390
13390
  }
13391
- return c[m + 0] !== x || c[m + 1] !== _ || c[m + 2] !== C || c[m + 3] !== M || c[m + 4] !== P || c[m + 5] !== E ? (c[m + 0] = x, c[m + 1] = _, c[m + 2] = C, c[m + 3] = M, c[m + 4] = P, c[m + 5] = E, !0) : !1;
13391
+ return c[m + 0] !== _ || c[m + 1] !== x || c[m + 2] !== M || c[m + 3] !== C || c[m + 4] !== P || c[m + 5] !== E ? (c[m + 0] = _, c[m + 1] = x, c[m + 2] = M, c[m + 3] = C, c[m + 4] = P, c[m + 5] = E, !0) : !1;
13392
13392
  } else {
13393
13393
  const g = Bt(m), v = Nt(m, a);
13394
- let x = b, _ = !1, C = !1;
13394
+ let _ = b, x = !1, M = !1;
13395
13395
  if (t) {
13396
- if (!x) {
13396
+ if (!_) {
13397
13397
  const R = g / Et + p / $t, B = v / Et + p / $t;
13398
- _ = t.has(R), C = t.has(B), x = !_ && !C;
13398
+ x = t.has(R), M = t.has(B), _ = !x && !M;
13399
13399
  }
13400
13400
  } else
13401
- _ = !0, C = !0;
13402
- const M = x || _, P = x || C;
13401
+ x = !0, M = !0;
13402
+ const C = _ || x, P = _ || M;
13403
13403
  let E = !1;
13404
- M && (E = d(g, p, x));
13405
- let O = !1;
13406
- P && (O = d(v, p, x));
13407
- const z = E || O;
13404
+ C && (E = d(g, p, _));
13405
+ let A = !1;
13406
+ P && (A = d(v, p, _));
13407
+ const z = E || A;
13408
13408
  if (z)
13409
13409
  for (let R = 0; R < 3; R++) {
13410
- const B = g + R, A = v + R, N = c[B], L = c[B + 3], V = c[A], $ = c[A + 3];
13410
+ const B = g + R, O = v + R, N = c[B], L = c[B + 3], V = c[O], $ = c[O + 3];
13411
13411
  c[m + R] = N < V ? N : V, c[m + R + 3] = L > $ ? L : $;
13412
13412
  }
13413
13413
  return z;
@@ -13424,9 +13424,9 @@ function mo(r, t, e, n, i, s, a) {
13424
13424
  Lf(t, e, n, m, p, i, s, a);
13425
13425
  } else {
13426
13426
  const m = Bt(r);
13427
- dn(m, o, n, s, a) && mo(m, t, e, n, i, s, a);
13427
+ fn(m, o, n, s, a) && mo(m, t, e, n, i, s, a);
13428
13428
  const p = Nt(r, l);
13429
- dn(p, o, n, s, a) && mo(p, t, e, n, i, s, a);
13429
+ fn(p, o, n, s, a) && mo(p, t, e, n, i, s, a);
13430
13430
  }
13431
13431
  }
13432
13432
  const Qf = ["x", "y", "z"];
@@ -13445,17 +13445,17 @@ function yo(r, t, e, n, i, s) {
13445
13445
  const d = ko(r, c), m = Qf[d], b = n.direction[m] >= 0;
13446
13446
  let T, g;
13447
13447
  b ? (T = Bt(r), g = Nt(r, c)) : (T = Nt(r, c), g = Bt(r));
13448
- const x = dn(T, a, n, i, s) ? yo(T, t, e, n, i, s) : null;
13449
- if (x) {
13450
- const M = x.point[m];
13451
- if (b ? M <= a[g + d] : (
13448
+ const _ = fn(T, a, n, i, s) ? yo(T, t, e, n, i, s) : null;
13449
+ if (_) {
13450
+ const C = _.point[m];
13451
+ if (b ? C <= a[g + d] : (
13452
13452
  // min bounding data
13453
- M >= a[g + d + 3]
13453
+ C >= a[g + d + 3]
13454
13454
  ))
13455
- return x;
13455
+ return _;
13456
13456
  }
13457
- const C = dn(g, a, n, i, s) ? yo(g, t, e, n, i, s) : null;
13458
- return x && C ? x.distance <= C.distance ? x : C : x || C || null;
13457
+ const M = fn(g, a, n, i, s) ? yo(g, t, e, n, i, s) : null;
13458
+ return _ && M ? _.distance <= M.distance ? _ : M : _ || M || null;
13459
13459
  }
13460
13460
  }
13461
13461
  const Pr = /* @__PURE__ */ new Fe(), Jn = /* @__PURE__ */ new xe(), jn = /* @__PURE__ */ new xe(), li = /* @__PURE__ */ new Oe(), Za = /* @__PURE__ */ new Xt(), Er = /* @__PURE__ */ new Xt();
@@ -13471,22 +13471,22 @@ function go(r, t, e, n, i = null) {
13471
13471
  const h = t.geometry, d = h.index, m = h.attributes.position, p = e.index, b = e.attributes.position, T = Ht(r, o), g = ie(c, a);
13472
13472
  if (li.copy(n).invert(), e.boundsTree)
13473
13473
  return xt(r, s, Er), Er.matrix.copy(li), Er.needsUpdate = !0, e.boundsTree.shapecast({
13474
- intersectsBounds: (x) => Er.intersectsBox(x),
13475
- intersectsTriangle: (x) => {
13476
- x.a.applyMatrix4(n), x.b.applyMatrix4(n), x.c.applyMatrix4(n), x.needsUpdate = !0;
13477
- for (let _ = T, C = g + T; _ < C; _++)
13478
- if (Pt(jn, 3 * t.resolveTriangleIndex(_), d, m), jn.needsUpdate = !0, x.intersectsTriangle(jn))
13474
+ intersectsBounds: (_) => Er.intersectsBox(_),
13475
+ intersectsTriangle: (_) => {
13476
+ _.a.applyMatrix4(n), _.b.applyMatrix4(n), _.c.applyMatrix4(n), _.needsUpdate = !0;
13477
+ for (let x = T, M = g + T; x < M; x++)
13478
+ if (Pt(jn, 3 * t.resolveTriangleIndex(x), d, m), jn.needsUpdate = !0, _.intersectsTriangle(jn))
13479
13479
  return !0;
13480
13480
  return !1;
13481
13481
  }
13482
13482
  });
13483
13483
  {
13484
13484
  const v = ns(e);
13485
- for (let x = T, _ = g + T; x < _; x++) {
13486
- const C = t.resolveTriangleIndex(x);
13487
- Pt(Jn, 3 * C, d, m), Jn.a.applyMatrix4(li), Jn.b.applyMatrix4(li), Jn.c.applyMatrix4(li), Jn.needsUpdate = !0;
13488
- for (let M = 0, P = v * 3; M < P; M += 3)
13489
- if (Pt(jn, M, p, b), jn.needsUpdate = !0, Jn.intersectsTriangle(jn))
13485
+ for (let _ = T, x = g + T; _ < x; _++) {
13486
+ const M = t.resolveTriangleIndex(_);
13487
+ Pt(Jn, 3 * M, d, m), Jn.a.applyMatrix4(li), Jn.b.applyMatrix4(li), Jn.c.applyMatrix4(li), Jn.needsUpdate = !0;
13488
+ for (let C = 0, P = v * 3; C < P; C += 3)
13489
+ if (Pt(jn, C, p, b), jn.needsUpdate = !0, Jn.intersectsTriangle(jn))
13490
13490
  return !0;
13491
13491
  }
13492
13492
  }
@@ -13501,26 +13501,26 @@ function od(r, t, e, n = {}, i = {}, s = 0, a = 1 / 0) {
13501
13501
  const o = r.geometry, c = o.attributes.position, l = o.index, h = t.attributes.position, d = t.index, m = Se.getPrimitive(), p = Se.getPrimitive();
13502
13502
  let b = nd, T = id, g = null, v = null;
13503
13503
  i && (g = rd, v = sd);
13504
- let x = 1 / 0, _ = null, C = null;
13504
+ let _ = 1 / 0, x = null, M = null;
13505
13505
  return kr.copy(e).invert(), ui.matrix.copy(kr), r.shapecast(
13506
13506
  {
13507
- boundsTraverseOrder: (M) => Fs.distanceToBox(M),
13508
- intersectsBounds: (M, P, E) => E < x && E < a ? (P && (ui.min.copy(M.min), ui.max.copy(M.max), ui.needsUpdate = !0), !0) : !1,
13509
- intersectsRange: (M, P) => {
13507
+ boundsTraverseOrder: (C) => Fs.distanceToBox(C),
13508
+ intersectsBounds: (C, P, E) => E < _ && E < a ? (P && (ui.min.copy(C.min), ui.max.copy(C.max), ui.needsUpdate = !0), !0) : !1,
13509
+ intersectsRange: (C, P) => {
13510
13510
  if (t.boundsTree) {
13511
13511
  const E = t.boundsTree;
13512
13512
  return E.shapecast({
13513
- boundsTraverseOrder: (O) => ui.distanceToBox(O),
13514
- intersectsBounds: (O, z, R) => R < x && R < a,
13515
- intersectsRange: (O, z) => {
13516
- for (let R = O, B = O + z; R < B; R++) {
13517
- const A = E.resolveTriangleIndex(R);
13518
- Pt(p, 3 * A, d, h), p.a.applyMatrix4(e), p.b.applyMatrix4(e), p.c.applyMatrix4(e), p.needsUpdate = !0;
13519
- for (let N = M, L = M + P; N < L; N++) {
13513
+ boundsTraverseOrder: (A) => ui.distanceToBox(A),
13514
+ intersectsBounds: (A, z, R) => R < _ && R < a,
13515
+ intersectsRange: (A, z) => {
13516
+ for (let R = A, B = A + z; R < B; R++) {
13517
+ const O = E.resolveTriangleIndex(R);
13518
+ Pt(p, 3 * O, d, h), p.a.applyMatrix4(e), p.b.applyMatrix4(e), p.c.applyMatrix4(e), p.needsUpdate = !0;
13519
+ for (let N = C, L = C + P; N < L; N++) {
13520
13520
  const V = r.resolveTriangleIndex(N);
13521
13521
  Pt(m, 3 * V, l, c), m.needsUpdate = !0;
13522
13522
  const $ = m.distanceToTriangle(p, b, g);
13523
- if ($ < x && (T.copy(b), v && v.copy(g), x = $, _ = N, C = R), $ < s)
13523
+ if ($ < _ && (T.copy(b), v && v.copy(g), _ = $, x = N, M = R), $ < s)
13524
13524
  return !0;
13525
13525
  }
13526
13526
  }
@@ -13528,20 +13528,20 @@ function od(r, t, e, n = {}, i = {}, s = 0, a = 1 / 0) {
13528
13528
  });
13529
13529
  } else {
13530
13530
  const E = ns(t);
13531
- for (let O = 0, z = E; O < z; O++) {
13532
- Pt(p, 3 * O, d, h), p.a.applyMatrix4(e), p.b.applyMatrix4(e), p.c.applyMatrix4(e), p.needsUpdate = !0;
13533
- for (let R = M, B = M + P; R < B; R++) {
13534
- const A = r.resolveTriangleIndex(R);
13535
- Pt(m, 3 * A, l, c), m.needsUpdate = !0;
13531
+ for (let A = 0, z = E; A < z; A++) {
13532
+ Pt(p, 3 * A, d, h), p.a.applyMatrix4(e), p.b.applyMatrix4(e), p.c.applyMatrix4(e), p.needsUpdate = !0;
13533
+ for (let R = C, B = C + P; R < B; R++) {
13534
+ const O = r.resolveTriangleIndex(R);
13535
+ Pt(m, 3 * O, l, c), m.needsUpdate = !0;
13536
13536
  const N = m.distanceToTriangle(p, b, g);
13537
- if (N < x && (T.copy(b), v && v.copy(g), x = N, _ = R, C = O), N < s)
13537
+ if (N < _ && (T.copy(b), v && v.copy(g), _ = N, x = R, M = A), N < s)
13538
13538
  return !0;
13539
13539
  }
13540
13540
  }
13541
13541
  }
13542
13542
  }
13543
13543
  }
13544
- ), Se.releasePrimitive(m), Se.releasePrimitive(p), x === 1 / 0 ? null : (n.point ? n.point.copy(T) : n.point = T.clone(), n.distance = x, n.faceIndex = _, i && (i.point ? i.point.copy(v) : i.point = v.clone(), i.point.applyMatrix4(kr), T.applyMatrix4(kr), i.distance = T.sub(i.point).length(), i.faceIndex = C), n);
13544
+ ), Se.releasePrimitive(m), Se.releasePrimitive(p), _ === 1 / 0 ? null : (n.point ? n.point.copy(T) : n.point = T.clone(), n.distance = _, n.faceIndex = x, i && (i.point ? i.point.copy(v) : i.point = v.clone(), i.point.applyMatrix4(kr), T.applyMatrix4(kr), i.distance = T.sub(i.point).length(), i.faceIndex = M), n);
13545
13545
  }
13546
13546
  function Ka(r, t, e) {
13547
13547
  return r === null ? null : (r.point.applyMatrix4(t.matrixWorld), r.distance = r.point.distanceTo(e.ray.origin), r.object = t, r);
@@ -13615,8 +13615,8 @@ class Ki extends Tl {
13615
13615
  const b = a[Vs[p]](h), T = a[Vs[p]](d), g = a[Vs[p]](m);
13616
13616
  let v = b;
13617
13617
  T < v && (v = T), g < v && (v = g);
13618
- let x = b;
13619
- T > x && (x = T), g > x && (x = g), e[n + p] = v, e[n + p + 3] = x;
13618
+ let _ = b;
13619
+ T > _ && (_ = T), g > _ && (_ = g), e[n + p] = v, e[n + p + 3] = _;
13620
13620
  }
13621
13621
  return e;
13622
13622
  }
@@ -13633,18 +13633,18 @@ class Ki extends Tl {
13633
13633
  a.isInterleavedBufferAttribute && (d = a.data.stride);
13634
13634
  const m = ["getX", "getY", "getZ"], p = n.offset;
13635
13635
  for (let b = t, T = t + e; b < T; b++) {
13636
- const v = (s ? s[b] : b) * 3, x = (b - p) * 6;
13637
- let _ = v + 0, C = v + 1, M = v + 2;
13638
- o && (_ = o[_], C = o[C], M = o[M]), c || (_ = _ * d + h, C = C * d + h, M = M * d + h);
13636
+ const v = (s ? s[b] : b) * 3, _ = (b - p) * 6;
13637
+ let x = v + 0, M = v + 1, C = v + 2;
13638
+ o && (x = o[x], M = o[M], C = o[C]), c || (x = x * d + h, M = M * d + h, C = C * d + h);
13639
13639
  for (let P = 0; P < 3; P++) {
13640
- let E, O, z;
13641
- c ? (E = a[m[P]](_), O = a[m[P]](C), z = a[m[P]](M)) : (E = l[_ + P], O = l[C + P], z = l[M + P]);
13640
+ let E, A, z;
13641
+ c ? (E = a[m[P]](x), A = a[m[P]](M), z = a[m[P]](C)) : (E = l[x + P], A = l[M + P], z = l[C + P]);
13642
13642
  let R = E;
13643
- O < R && (R = O), z < R && (R = z);
13643
+ A < R && (R = A), z < R && (R = z);
13644
13644
  let B = E;
13645
- O > B && (B = O), z > B && (B = z);
13646
- const A = (B - R) / 2, N = P * 2;
13647
- n[x + N + 0] = R + A, n[x + N + 1] = A + (Math.abs(R) + A) * Fr;
13645
+ A > B && (B = A), z > B && (B = z);
13646
+ const O = (B - R) / 2, N = P * 2;
13647
+ n[_ + N + 0] = R + O, n[_ + N + 1] = O + (Math.abs(R) + O) * Fr;
13648
13648
  }
13649
13649
  }
13650
13650
  return n;
@@ -13726,19 +13726,19 @@ class Ki extends Tl {
13726
13726
  if (s) {
13727
13727
  if (!(t instanceof Ki))
13728
13728
  throw new Error('MeshBVH: "intersectsTriangles" callback can only be used with another MeshBVH.');
13729
- const b = (T, g, v, x, _, C, M, P) => {
13730
- for (let E = v, O = v + x; E < O; E++) {
13729
+ const b = (T, g, v, _, x, M, C, P) => {
13730
+ for (let E = v, A = v + _; E < A; E++) {
13731
13731
  p(E), h.a.applyMatrix4(e), h.b.applyMatrix4(e), h.c.applyMatrix4(e), h.needsUpdate = !0;
13732
13732
  for (let z = T, R = T + g; z < R; z++)
13733
- if (l(z), a.needsUpdate = !0, s(a, h, z, E, _, C, M, P))
13733
+ if (l(z), a.needsUpdate = !0, s(a, h, z, E, x, M, C, P))
13734
13734
  return !0;
13735
13735
  }
13736
13736
  return !1;
13737
13737
  };
13738
13738
  if (i) {
13739
13739
  const T = i;
13740
- i = function(g, v, x, _, C, M, P, E) {
13741
- return T(g, v, x, _, C, M, P, E) ? !0 : b(g, v, x, _, C, M, P, E);
13740
+ i = function(g, v, _, x, M, C, P, E) {
13741
+ return T(g, v, _, x, M, C, P, E) ? !0 : b(g, v, _, x, M, C, P, E);
13742
13742
  };
13743
13743
  } else
13744
13744
  i = b;
@@ -13846,7 +13846,7 @@ function ld(r = {}) {
13846
13846
  const { type: t = Ki } = r;
13847
13847
  return this.boundsTree = new t(this, r), this.boundsTree;
13848
13848
  }
13849
- const bn = /* @__PURE__ */ new H(), Tn = /* @__PURE__ */ new H(), Cn = /* @__PURE__ */ new H(), nc = /* @__PURE__ */ new vo(), zr = /* @__PURE__ */ new H(), Js = /* @__PURE__ */ new H(), ic = /* @__PURE__ */ new vo(), rc = /* @__PURE__ */ new vo(), Ir = /* @__PURE__ */ new Oe(), sc = /* @__PURE__ */ new Oe();
13849
+ const _n = /* @__PURE__ */ new H(), bn = /* @__PURE__ */ new H(), Tn = /* @__PURE__ */ new H(), nc = /* @__PURE__ */ new vo(), zr = /* @__PURE__ */ new H(), Js = /* @__PURE__ */ new H(), ic = /* @__PURE__ */ new vo(), rc = /* @__PURE__ */ new vo(), Ir = /* @__PURE__ */ new Oe(), sc = /* @__PURE__ */ new Oe();
13850
13850
  function hi(r, t) {
13851
13851
  if (!r && !t)
13852
13852
  return;
@@ -14046,11 +14046,11 @@ class md {
14046
14046
  !e.index && n.index && (e.index = n.index.clone()), c.position || e.setAttribute("position", mi(o.position)), s && !c.normal && o.normal && e.setAttribute("normal", mi(o.normal)), a && !c.tangent && o.tangent && e.setAttribute("tangent", mi(o.tangent)), hi(n.index, e.index), hi(o.position, c.position), s && hi(o.normal, c.normal), a && hi(o.tangent, c.tangent);
14047
14047
  const l = o.position, h = s ? o.normal : null, d = a ? o.tangent : null, m = n.morphAttributes.position, p = n.morphAttributes.normal, b = n.morphAttributes.tangent, T = n.morphTargetsRelative, g = t.morphTargetInfluences, v = new Zl();
14048
14048
  v.getNormalMatrix(t.matrixWorld), n.index && e.index.array.set(n.index.array);
14049
- for (let x = 0, _ = o.position.count; x < _; x++)
14050
- bn.fromBufferAttribute(l, x), h && Tn.fromBufferAttribute(h, x), d && (nc.fromBufferAttribute(d, x), Cn.fromBufferAttribute(d, x)), g && (m && js(m, g, T, x, bn), p && js(p, g, T, x, Tn), b && js(b, g, T, x, Cn)), t.isSkinnedMesh && (t.applyBoneTransform(x, bn), h && oc(t, x, Tn), d && oc(t, x, Cn)), i && bn.applyMatrix4(t.matrixWorld), c.position.setXYZ(x, bn.x, bn.y, bn.z), h && (i && Tn.applyNormalMatrix(v), c.normal.setXYZ(x, Tn.x, Tn.y, Tn.z)), d && (i && Cn.transformDirection(t.matrixWorld), c.tangent.setXYZW(x, Cn.x, Cn.y, Cn.z, nc.w));
14051
- for (const x in this.attributes) {
14052
- const _ = this.attributes[x];
14053
- _ === "position" || _ === "tangent" || _ === "normal" || !(_ in o) || (c[_] || e.setAttribute(_, mi(o[_])), hi(o[_], c[_]), Cl(o[_], c[_]));
14049
+ for (let _ = 0, x = o.position.count; _ < x; _++)
14050
+ _n.fromBufferAttribute(l, _), h && bn.fromBufferAttribute(h, _), d && (nc.fromBufferAttribute(d, _), Tn.fromBufferAttribute(d, _)), g && (m && js(m, g, T, _, _n), p && js(p, g, T, _, bn), b && js(b, g, T, _, Tn)), t.isSkinnedMesh && (t.applyBoneTransform(_, _n), h && oc(t, _, bn), d && oc(t, _, Tn)), i && _n.applyMatrix4(t.matrixWorld), c.position.setXYZ(_, _n.x, _n.y, _n.z), h && (i && bn.applyNormalMatrix(v), c.normal.setXYZ(_, bn.x, bn.y, bn.z)), d && (i && Tn.transformDirection(t.matrixWorld), c.tangent.setXYZW(_, Tn.x, Tn.y, Tn.z, nc.w));
14051
+ for (const _ in this.attributes) {
14052
+ const x = this.attributes[_];
14053
+ x === "position" || x === "tangent" || x === "normal" || !(x in o) || (c[x] || e.setAttribute(x, mi(o[x])), hi(o[x], c[x]), Cl(o[x], c[x]));
14054
14054
  }
14055
14055
  return t.matrixWorld.determinant() < 0 && dd(e), e;
14056
14056
  }
@@ -14100,7 +14100,7 @@ const ve = {
14100
14100
  material: "material",
14101
14101
  camera: "camera",
14102
14102
  light: "light"
14103
- }, an = "KHR_animation_pointer", yd = {
14103
+ }, Cn = "KHR_animation_pointer", yd = {
14104
14104
  // We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each
14105
14105
  // keyframe track will be initialized with a default interpolation type, then modified.
14106
14106
  CUBICSPLINE: void 0,
@@ -14110,7 +14110,7 @@ const ve = {
14110
14110
  class gd {
14111
14111
  /** @type {import("three/examples/jsm/loaders/GLTFLoader").GLTFParser} */
14112
14112
  constructor(t) {
14113
- this.name = an, this.parser = t, this.animationPointerResolver = null;
14113
+ this.name = Cn, this.parser = t, this.animationPointerResolver = null, this.pointerPathMap = /* @__PURE__ */ new Map();
14114
14114
  }
14115
14115
  /**
14116
14116
  * @param {import("..").AnimationPointerResolver | null} animationPointerResolver
@@ -14125,11 +14125,11 @@ class gd {
14125
14125
  }
14126
14126
  loadAnimationTargetFromChannelWithAnimationPointer(t) {
14127
14127
  Sd();
14128
- const e = t.target, n = e.extensions && e.extensions[an] && e.path && e.path === "pointer";
14128
+ const e = t.target, n = e.extensions && e.extensions[Cn] && e.path && e.path === "pointer";
14129
14129
  if (!n) return null;
14130
14130
  let i, s = ve.node, a;
14131
14131
  if (n) {
14132
- const c = e.extensions[an];
14132
+ const c = e.extensions[Cn];
14133
14133
  let l = c.pointer;
14134
14134
  if (!l) {
14135
14135
  console.warn("Invalid path", c, e);
@@ -14141,8 +14141,8 @@ class gd {
14141
14141
  }
14142
14142
  switch (s) {
14143
14143
  case ve.material:
14144
- const h = ("/materials/" + a.toString() + "/").length, d = l.substring(0, h);
14145
- switch (i = l.substring(h), i) {
14144
+ const d = ("/materials/" + a.toString() + "/").length, m = l.substring(0, d);
14145
+ switch (i = l.substring(d), i) {
14146
14146
  // Core Spec PBR Properties
14147
14147
  case "pbrMetallicRoughness/baseColorFactor":
14148
14148
  i = "color";
@@ -14236,13 +14236,13 @@ class gd {
14236
14236
  i = "specularColor";
14237
14237
  break;
14238
14238
  }
14239
- l = d + i;
14239
+ l = m + i;
14240
14240
  break;
14241
14241
  case ve.node:
14242
- const m = ("/nodes/" + a.toString() + "/").length, p = l.substring(0, m);
14243
- if (i = l.substring(m), i.startsWith("weights/")) {
14244
- const v = i.substring(8);
14245
- /^\d+$/.test(v) ? i = "morphTargetInfluences[" + v + "]" : console.warn(an + ": invalid weight index", i, l);
14242
+ const p = ("/nodes/" + a.toString() + "/").length, b = l.substring(0, p);
14243
+ if (i = l.substring(p), i.startsWith("weights/")) {
14244
+ const _ = i.substring(8);
14245
+ /^\d+$/.test(_) ? i = "morphTargetInfluences[" + _ + "]" : console.warn(Cn + ": invalid weight index", i, l);
14246
14246
  } else
14247
14247
  switch (i) {
14248
14248
  case "translation":
@@ -14261,11 +14261,11 @@ class gd {
14261
14261
  i = "visible";
14262
14262
  break;
14263
14263
  }
14264
- l = p + i;
14264
+ l = b + i;
14265
14265
  break;
14266
14266
  case ve.light:
14267
- const b = ("/extensions/KHR_lights_punctual/lights/" + a.toString() + "/").length;
14268
- switch (i = l.substring(b), i) {
14267
+ const T = ("/extensions/KHR_lights_punctual/lights/" + a.toString() + "/").length;
14268
+ switch (i = l.substring(T), i) {
14269
14269
  case "color":
14270
14270
  break;
14271
14271
  case "intensity":
@@ -14283,8 +14283,8 @@ class gd {
14283
14283
  l = "/lights/" + a.toString() + "/" + i;
14284
14284
  break;
14285
14285
  case ve.camera:
14286
- const T = ("/cameras/" + a.toString() + "/").length, g = l.substring(0, T);
14287
- switch (i = l.substring(T), i) {
14286
+ const g = ("/cameras/" + a.toString() + "/").length, v = l.substring(0, g);
14287
+ switch (i = l.substring(g), i) {
14288
14288
  case "perspective/yfov":
14289
14289
  i = "fov";
14290
14290
  break;
@@ -14308,10 +14308,12 @@ class gd {
14308
14308
  i = "zoom";
14309
14309
  break;
14310
14310
  }
14311
- l = g + i;
14311
+ l = v + i;
14312
14312
  break;
14313
14313
  }
14314
- this.animationPointerResolver?.resolvePath && (l = this.animationPointerResolver.resolvePath(l)), e.extensions[an].pointer = l;
14314
+ this.animationPointerResolver?.resolvePath && (l = this.animationPointerResolver.resolvePath(l));
14315
+ const h = c.pointer;
14316
+ this.pointerPathMap.set(h, l);
14315
14317
  }
14316
14318
  if (a == null || isNaN(a)) {
14317
14319
  console.warn("Failed resolving animation node id: " + a, e);
@@ -14321,73 +14323,74 @@ class gd {
14321
14323
  return s === ve.node ? o = this.parser.getDependency("node", a) : s === ve.material ? o = this.parser.getDependency("material", a) : s === ve.light ? o = this.parser.getDependency("light", a) : s === ve.camera ? o = this.parser.getDependency("camera", a) : console.error("Unhandled type", s), o;
14322
14324
  }
14323
14325
  createAnimationTracksWithAnimationPointer(t, e, n, i, s) {
14324
- if (!(s.extensions && s.extensions[an] && s.path && s.path === "pointer")) return null;
14325
- let o = s.extensions[an].pointer;
14326
- if (!o) return null;
14327
- const c = [];
14328
- o = o.replaceAll("/", ".");
14329
- const l = o.split(".");
14330
- var d = t.name !== void 0 && t.name !== null ? t.name : t.uuid;
14331
- if (l[2] = d, l[3]?.startsWith("morphTargetInfluences")) {
14332
- const b = l[3];
14326
+ if (!(s.extensions && s.extensions[Cn] && s.path && s.path === "pointer")) return null;
14327
+ const o = s.extensions[Cn].pointer;
14328
+ let c = this.pointerPathMap.get(o);
14329
+ if (!c) return null;
14330
+ const l = [];
14331
+ c = c.replaceAll("/", ".");
14332
+ const h = c.split(".");
14333
+ var m = t.name !== void 0 && t.name !== null ? t.name : t.uuid;
14334
+ if (h[2] = m, h[3]?.startsWith("morphTargetInfluences")) {
14335
+ const T = h[3];
14333
14336
  if (t.type === "Group") {
14334
- for (const T of t.children)
14335
- T.morphTargetInfluences && (l[3] = T.name, l[4] = b, p(this.parser));
14336
- return c;
14337
+ for (const g of t.children)
14338
+ g.morphTargetInfluences && (h[3] = g.name, h[4] = T, b(this.parser));
14339
+ return l;
14337
14340
  }
14338
14341
  }
14339
- p(this.parser);
14340
- function m(b, T) {
14342
+ b(this.parser);
14343
+ function p(T, g) {
14341
14344
  try {
14342
- const g = T.split(".").filter(Boolean), x = g[g.length - 1].replace(/\[.*\]$/, "");
14343
- return x in b ? typeof b[x] == "boolean" : !1;
14345
+ const v = g.split(".").filter(Boolean), x = v[v.length - 1].replace(/\[.*\]$/, "");
14346
+ return x in T ? typeof T[x] == "boolean" : !1;
14344
14347
  } catch {
14345
14348
  return !1;
14346
14349
  }
14347
14350
  }
14348
- function p(b) {
14349
- o = l.join(".");
14350
- let T, g = !1;
14351
+ function b(T) {
14352
+ c = h.join(".");
14353
+ let g, v = !1;
14351
14354
  switch (n.itemSize) {
14352
14355
  case 1:
14353
14356
  Object.prototype.toString.call(n.array) === "[object Uint8Array]" && // UNSIGNED_BYTE as a strong hint
14354
- m(t, o) ? (T = iu, g = !0) : T = ru;
14357
+ p(t, c) ? (g = iu, v = !0) : g = ru;
14355
14358
  break;
14356
14359
  case 2:
14357
14360
  case 3:
14358
- T = nu;
14361
+ g = nu;
14359
14362
  break;
14360
14363
  case 4:
14361
- o.endsWith(".quaternion") ? T = tu : T = eu;
14364
+ c.endsWith(".quaternion") ? g = tu : g = eu;
14362
14365
  break;
14363
14366
  }
14364
- if (!T) {
14367
+ if (!g) {
14365
14368
  console.warn("Unsupported output accessor format", n);
14366
14369
  return;
14367
14370
  }
14368
- const v = i.interpolation !== void 0 ? yd[i.interpolation] : gc;
14369
- let x = b._getArrayFromAccessor(n);
14370
- o.endsWith(".fov") && (x = x.map((C) => C / Math.PI * 180)), g && (x = x.map((C) => C > 0));
14371
- const _ = new T(
14372
- o,
14371
+ const _ = i.interpolation !== void 0 ? yd[i.interpolation] : gc;
14372
+ let x = T._getArrayFromAccessor(n);
14373
+ c.endsWith(".fov") && (x = x.map((C) => C / Math.PI * 180)), v && (x = x.map((C) => C > 0));
14374
+ const M = new g(
14375
+ c,
14373
14376
  e.array,
14374
14377
  x,
14375
- v
14378
+ _
14376
14379
  );
14377
- if (v === "CUBICSPLINE" && b._createCubicSplineTrackInterpolant(_), c.push(_), o && n.itemSize === 4 && o.startsWith(".materials.") && o.endsWith(".color")) {
14380
+ if (_ === "CUBICSPLINE" && T._createCubicSplineTrackInterpolant(M), l.push(M), c && n.itemSize === 4 && c.startsWith(".materials.") && c.endsWith(".color")) {
14378
14381
  const C = new Float32Array(x.length / 4);
14379
- for (let P = 0, E = x.length / 4; P < E; P += 1)
14380
- C[P] = x[P * 4 + 3];
14381
- const M = new T(
14382
- o.replace(".color", ".opacity"),
14382
+ for (let E = 0, A = x.length / 4; E < A; E += 1)
14383
+ C[E] = x[E * 4 + 3];
14384
+ const P = new g(
14385
+ c.replace(".color", ".opacity"),
14383
14386
  e.array,
14384
14387
  C,
14385
- v
14388
+ _
14386
14389
  );
14387
- v === "CUBICSPLINE" && b._createCubicSplineTrackInterpolant(_), c.push(M);
14390
+ _ === "CUBICSPLINE" && T._createCubicSplineTrackInterpolant(M), l.push(P);
14388
14391
  }
14389
14392
  }
14390
- return c;
14393
+ return l;
14391
14394
  }
14392
14395
  _tryResolveTargetId(t, e) {
14393
14396
  let n = "";
@@ -14402,9 +14405,9 @@ class gd {
14402
14405
  loadAnimation(t) {
14403
14406
  const e = this, n = this.parser.json, i = this.parser, s = n.animations[t], a = s.name ? s.name : "animation_" + t, o = [], c = [], l = [], h = [], d = [];
14404
14407
  for (let m = 0, p = s.channels.length; m < p; m++) {
14405
- const b = s.channels[m], T = s.samplers[b.sampler], g = b.target, v = s.parameters !== void 0 ? s.parameters[T.input] : T.input, x = s.parameters !== void 0 ? s.parameters[T.output] : T.output;
14406
- let _ = e.loadAnimationTargetFromChannelWithAnimationPointer(b);
14407
- _ || (_ = e.loadAnimationTargetFromChannel(b)), o.push(_), c.push(i.getDependency("accessor", v)), l.push(i.getDependency("accessor", x)), h.push(T), d.push(g);
14408
+ const b = s.channels[m], T = s.samplers[b.sampler], g = b.target, v = s.parameters !== void 0 ? s.parameters[T.input] : T.input, _ = s.parameters !== void 0 ? s.parameters[T.output] : T.output;
14409
+ let x = e.loadAnimationTargetFromChannelWithAnimationPointer(b);
14410
+ x || (x = e.loadAnimationTargetFromChannel(b)), o.push(x), c.push(i.getDependency("accessor", v)), l.push(i.getDependency("accessor", _)), h.push(T), d.push(g);
14408
14411
  }
14409
14412
  return Promise.all([
14410
14413
  Promise.all(o),
@@ -14413,17 +14416,17 @@ class gd {
14413
14416
  Promise.all(h),
14414
14417
  Promise.all(d)
14415
14418
  ]).then(function(m) {
14416
- const p = m[0], b = m[1], T = m[2], g = m[3], v = m[4], x = [];
14417
- for (let _ = 0, C = p.length; _ < C; _++) {
14418
- const M = p[_], P = b[_], E = T[_], O = g[_], z = v[_];
14419
- if (M === void 0) continue;
14420
- M.updateMatrix && (M.updateMatrix(), M.matrixAutoUpdate = !0);
14421
- let R = e.createAnimationTracksWithAnimationPointer(M, P, E, O, z);
14422
- if (R || (R = i._createAnimationTracks(M, P, E, O, z)), R)
14419
+ const p = m[0], b = m[1], T = m[2], g = m[3], v = m[4], _ = [];
14420
+ for (let x = 0, M = p.length; x < M; x++) {
14421
+ const C = p[x], P = b[x], E = T[x], A = g[x], z = v[x];
14422
+ if (C === void 0) continue;
14423
+ C.updateMatrix && (C.updateMatrix(), C.matrixAutoUpdate = !0);
14424
+ let R = e.createAnimationTracksWithAnimationPointer(C, P, E, A, z);
14425
+ if (R || (R = i._createAnimationTracks(C, P, E, A, z)), R)
14423
14426
  for (let B = 0; B < R.length; B++)
14424
- x.push(R[B]);
14427
+ _.push(R[B]);
14425
14428
  }
14426
- return new Ql(a, void 0, x);
14429
+ return new Ql(a, void 0, _);
14427
14430
  });
14428
14431
  }
14429
14432
  }
@@ -14458,7 +14461,7 @@ function Sd() {
14458
14461
  }
14459
14462
  if (!i) {
14460
14463
  const s = r(t, n[2]);
14461
- return s || console.warn(an + ": Property binding not found", e, t, t.name, n), s;
14464
+ return s || console.warn(Cn + ": Property binding not found", e, t, t.name, n), s;
14462
14465
  }
14463
14466
  return i;
14464
14467
  }
@@ -14537,19 +14540,19 @@ var xd = Object.defineProperty, _d = (r, t, e) => t in r ? xd(r, t, { enumerable
14537
14540
  }
14538
14541
  class v extends r {
14539
14542
  }
14540
- class x extends r {
14541
- }
14542
14543
  class _ extends r {
14543
14544
  }
14544
- class C extends r {
14545
+ class x extends r {
14545
14546
  }
14546
14547
  class M extends r {
14547
14548
  }
14549
+ class C extends r {
14550
+ }
14548
14551
  class P extends r {
14549
14552
  }
14550
14553
  class E extends r {
14551
14554
  }
14552
- class O extends r {
14555
+ class A extends r {
14553
14556
  }
14554
14557
  class z {
14555
14558
  constructor(f) {
@@ -14578,11 +14581,11 @@ var xd = Object.defineProperty, _d = (r, t, e) => t in r ? xd(r, t, { enumerable
14578
14581
  function B(u) {
14579
14582
  return R(u) || u === 8192 || u === 32;
14580
14583
  }
14581
- function A(u) {
14584
+ function O(u) {
14582
14585
  return u >= 48 && u <= 57;
14583
14586
  }
14584
14587
  function N(u) {
14585
- return A(u) || u >= 65 && u <= 70 || u >= 97 && u <= 102;
14588
+ return O(u) || u >= 65 && u <= 70 || u >= 97 && u <= 102;
14586
14589
  }
14587
14590
  function L(u) {
14588
14591
  return (function(f) {
@@ -14596,7 +14599,7 @@ var xd = Object.defineProperty, _d = (r, t, e) => t in r ? xd(r, t, { enumerable
14596
14599
  })(u) || u === 95;
14597
14600
  }
14598
14601
  function V(u) {
14599
- return L(u) || A(u) || u === 45;
14602
+ return L(u) || O(u) || u === 45;
14600
14603
  }
14601
14604
  function $(u) {
14602
14605
  return u >= 0 && u <= 8 || u === 11 || u >= 14 && u <= 31 || u === 127;
@@ -14608,7 +14611,7 @@ var xd = Object.defineProperty, _d = (r, t, e) => t in r ? xd(r, t, { enumerable
14608
14611
  return u === 45 ? L(f) || f === 45 || Q(f, y) : !!L(u) || u === 92 && Q(u, f);
14609
14612
  }
14610
14613
  function yt(u, f, y) {
14611
- return u === 43 || u === 45 ? A(f) || f === 46 && A(y) : A(u === 46 ? f : u);
14614
+ return u === 43 || u === 45 ? O(f) || f === 46 && O(y) : O(u === 46 ? f : u);
14612
14615
  }
14613
14616
  function nt(u) {
14614
14617
  const f = u.consume();
@@ -14647,9 +14650,9 @@ var xd = Object.defineProperty, _d = (r, t, e) => t in r ? xd(r, t, { enumerable
14647
14650
  function vt(u) {
14648
14651
  let f = (function(y) {
14649
14652
  let S = "integer", w = "";
14650
- for ([43, 45].includes(y.peek()[0]) && (w += String.fromCodePoint(y.consume())); A(...y.peek()); ) w += String.fromCodePoint(y.consume());
14651
- if (y.peek()[0] === 46 && A(y.peek()[1])) for (w += String.fromCodePoint(y.consume(), y.consume()), S = "number"; A(...y.peek()); ) w += String.fromCodePoint(y.consume());
14652
- return [69, 101].includes(y.peek()[0]) && ([45, 43].includes(y.peek()[1]) && A(y.peek()[2]) ? (w += String.fromCodePoint(y.consume(), y.consume(), y.consume()), S = "number") : A(y.peek()[1]) && (w += String.fromCodePoint(y.consume(), y.consume()), S = "number")), { value: parseFloat(w), type: S };
14653
+ for ([43, 45].includes(y.peek()[0]) && (w += String.fromCodePoint(y.consume())); O(...y.peek()); ) w += String.fromCodePoint(y.consume());
14654
+ if (y.peek()[0] === 46 && O(y.peek()[1])) for (w += String.fromCodePoint(y.consume(), y.consume()), S = "number"; O(...y.peek()); ) w += String.fromCodePoint(y.consume());
14655
+ return [69, 101].includes(y.peek()[0]) && ([45, 43].includes(y.peek()[1]) && O(y.peek()[2]) ? (w += String.fromCodePoint(y.consume(), y.consume(), y.consume()), S = "number") : O(y.peek()[1]) && (w += String.fromCodePoint(y.consume(), y.consume()), S = "number")), { value: parseFloat(w), type: S };
14653
14656
  })(u);
14654
14657
  return W(...u.peek()) ? new m(f.value, f.type, st(u)) : u.peek()[0] === 37 ? (u.consume(), new d(f.value)) : new h(f.value, f.type);
14655
14658
  }
@@ -14698,7 +14701,7 @@ var xd = Object.defineProperty, _d = (r, t, e) => t in r ? xd(r, t, { enumerable
14698
14701
  }
14699
14702
  return new l(String.fromCodePoint(f));
14700
14703
  }
14701
- return f === 39 ? ht(u, f) : f === 40 ? new M() : f === 41 ? new P() : f === 43 ? yt(...y) ? (u.reconsume(f), vt(u)) : new l(String.fromCodePoint(f)) : f === 44 ? new x() : f === 45 ? yt(...u.peek()) ? (u.reconsume(f), vt(u)) : u.peek()[0] === 45 && u.peek()[1] === 62 ? (u.consume(), u.consume(), new T()) : W(...u.peek()) ? (u.reconsume(f), ot(u)) : new l(String.fromCodePoint(f)) : f === 46 ? yt(...u.peek()) ? (u.reconsume(f), vt(u)) : new l(String.fromCodePoint(f)) : f === 58 ? new g() : f === 59 ? new v() : f === 60 ? y[0] === 33 && y[1] === 45 && y[2] === 45 ? (u.consume(), u.consume(), u.consume(), new b()) : new l(String.fromCodePoint(f)) : f === 64 ? W(...y) ? new n(st(u)) : new l(String.fromCodePoint(f)) : f === 91 ? new _() : f === 92 ? Q(...y) ? (u.reconsume(f), ot(u)) : new l(String.fromCodePoint(f)) : f === 93 ? new C() : f === 123 ? new E() : f === 125 ? new O() : A(f) ? (u.reconsume(f), vt(u)) : L(f) ? (u.reconsume(f), ot(u)) : f === void 0 ? void 0 : new l(String.fromCodePoint(f));
14704
+ return f === 39 ? ht(u, f) : f === 40 ? new C() : f === 41 ? new P() : f === 43 ? yt(...y) ? (u.reconsume(f), vt(u)) : new l(String.fromCodePoint(f)) : f === 44 ? new _() : f === 45 ? yt(...u.peek()) ? (u.reconsume(f), vt(u)) : u.peek()[0] === 45 && u.peek()[1] === 62 ? (u.consume(), u.consume(), new T()) : W(...u.peek()) ? (u.reconsume(f), ot(u)) : new l(String.fromCodePoint(f)) : f === 46 ? yt(...u.peek()) ? (u.reconsume(f), vt(u)) : new l(String.fromCodePoint(f)) : f === 58 ? new g() : f === 59 ? new v() : f === 60 ? y[0] === 33 && y[1] === 45 && y[2] === 45 ? (u.consume(), u.consume(), u.consume(), new b()) : new l(String.fromCodePoint(f)) : f === 64 ? W(...y) ? new n(st(u)) : new l(String.fromCodePoint(f)) : f === 91 ? new x() : f === 92 ? Q(...y) ? (u.reconsume(f), ot(u)) : new l(String.fromCodePoint(f)) : f === 93 ? new M() : f === 123 ? new E() : f === 125 ? new A() : O(f) ? (u.reconsume(f), vt(u)) : L(f) ? (u.reconsume(f), ot(u)) : f === void 0 ? void 0 : new l(String.fromCodePoint(f));
14702
14705
  }
14703
14706
  const at = /* @__PURE__ */ new Set(["px", "deg", "s", "hz", "dppx", "number", "fr"]);
14704
14707
  function Yt(u) {
@@ -14935,13 +14938,13 @@ var xd = Object.defineProperty, _d = (r, t, e) => t in r ? xd(r, t, { enumerable
14935
14938
  }
14936
14939
  function Qt(u) {
14937
14940
  const f = u.shift();
14938
- return f instanceof E || f instanceof _ || f instanceof M ? (function(y, S) {
14941
+ return f instanceof E || f instanceof x || f instanceof C ? (function(y, S) {
14939
14942
  let w;
14940
- if (S instanceof E) w = O;
14941
- else if (S instanceof M) w = P;
14943
+ if (S instanceof E) w = A;
14944
+ else if (S instanceof C) w = P;
14942
14945
  else {
14943
- if (!(S instanceof _)) return;
14944
- w = C;
14946
+ if (!(S instanceof x)) return;
14947
+ w = M;
14945
14948
  }
14946
14949
  const k = new Kt([], S);
14947
14950
  for (; ; ) {
@@ -14959,7 +14962,7 @@ var xd = Object.defineProperty, _d = (r, t, e) => t in r ? xd(r, t, { enumerable
14959
14962
  })(f, u) : f;
14960
14963
  }
14961
14964
  function tt(u) {
14962
- if (u instanceof M || u instanceof P) return 6;
14965
+ if (u instanceof C || u instanceof P) return 6;
14963
14966
  if (u instanceof l)
14964
14967
  switch (u.value) {
14965
14968
  case "*":
@@ -14992,7 +14995,7 @@ var xd = Object.defineProperty, _d = (r, t, e) => t in r ? xd(r, t, { enumerable
14992
14995
  }
14993
14996
  function je(u) {
14994
14997
  if (u.name === "min" || u.name === "max") {
14995
- const S = u.values.filter(((w) => !(w instanceof p || w instanceof x))).map(((w) => gt(je(new At("calc", w)))));
14998
+ const S = u.values.filter(((w) => !(w instanceof p || w instanceof _))).map(((w) => gt(je(new At("calc", w)))));
14996
14999
  return u.name === "min" ? new CSSMathMin(...S) : new CSSMathMax(...S);
14997
15000
  }
14998
15001
  if (u.name !== "calc") return null;
@@ -15002,24 +15005,24 @@ var xd = Object.defineProperty, _d = (r, t, e) => t in r ? xd(r, t, { enumerable
15002
15005
  const I = S.shift();
15003
15006
  if (I instanceof h || I instanceof m || I instanceof d || I instanceof At || I instanceof Kt || I instanceof t) k.push(I);
15004
15007
  else if (I instanceof l && ["*", "/", "+", "-"].includes(I.value)) {
15005
- for (; w.length && !(Me(w) instanceof M) && tt(Me(w)) > tt(I); ) {
15008
+ for (; w.length && !(Me(w) instanceof C) && tt(Me(w)) > tt(I); ) {
15006
15009
  const D = w.pop(), U = k.pop(), F = k.pop();
15007
15010
  k.push(Je(D, F, U));
15008
15011
  }
15009
15012
  w.push(I);
15010
- } else if (I instanceof M) w.push(I);
15013
+ } else if (I instanceof C) w.push(I);
15011
15014
  else if (I instanceof P) {
15012
15015
  if (!w.length) return null;
15013
- for (; !(Me(w) instanceof M); ) {
15016
+ for (; !(Me(w) instanceof C); ) {
15014
15017
  const D = w.pop(), U = k.pop(), F = k.pop();
15015
15018
  k.push(Je(D, F, U));
15016
15019
  }
15017
- if (!(Me(w) instanceof M)) return null;
15020
+ if (!(Me(w) instanceof C)) return null;
15018
15021
  w.pop();
15019
15022
  } else if (!(I instanceof p)) return null;
15020
15023
  }
15021
15024
  for (; w.length; ) {
15022
- if (Me(w) instanceof M) return null;
15025
+ if (Me(w) instanceof C) return null;
15023
15026
  const I = w.pop(), D = k.pop(), U = k.pop();
15024
15027
  k.push(Je(I, U, D));
15025
15028
  }
@@ -15176,7 +15179,7 @@ var xd = Object.defineProperty, _d = (r, t, e) => t in r ? xd(r, t, { enumerable
15176
15179
  function Io(u) {
15177
15180
  return u === document.scrollingElement ? document : u;
15178
15181
  }
15179
- function pn(u) {
15182
+ function dn(u) {
15180
15183
  ss(u);
15181
15184
  let f = Gt.get(u).animations;
15182
15185
  if (f.length === 0) return;
@@ -15234,7 +15237,7 @@ var xd = Object.defineProperty, _d = (r, t, e) => t in r ? xd(r, t, { enumerable
15234
15237
  f.updateScheduled || (setTimeout((() => {
15235
15238
  for (const y of f.timelineRefs) {
15236
15239
  const S = y.deref();
15237
- S && pn(S);
15240
+ S && dn(S);
15238
15241
  }
15239
15242
  f.updateScheduled = !1;
15240
15243
  })), f.updateScheduled = !0);
@@ -15268,7 +15271,7 @@ var xd = Object.defineProperty, _d = (r, t, e) => t in r ? xd(r, t, { enumerable
15268
15271
  w.sourceMeasurements.scrollLeft = f.scrollLeft, w.sourceMeasurements.scrollTop = f.scrollTop;
15269
15272
  for (const U of w.timelineRefs) {
15270
15273
  const F = U.deref();
15271
- F && pn(F);
15274
+ F && dn(F);
15272
15275
  }
15273
15276
  };
15274
15277
  Io(f).addEventListener("scroll", D), w.disconnect = () => {
@@ -15287,7 +15290,7 @@ var xd = Object.defineProperty, _d = (r, t, e) => t in r ? xd(r, t, { enumerable
15287
15290
  let S = Gt.get(u).animations;
15288
15291
  for (let w = 0; w < S.length; w++) if (S[w].animation == f) return;
15289
15292
  S.push({ animation: f, tickAnimation: y }), queueMicrotask((() => {
15290
- pn(u);
15293
+ dn(u);
15291
15294
  }));
15292
15295
  }
15293
15296
  class te {
@@ -15296,17 +15299,17 @@ var xd = Object.defineProperty, _d = (r, t, e) => t in r ? xd(r, t, { enumerable
15296
15299
  if (!No(f.axis)) throw TypeError("Invalid axis");
15297
15300
  Gt.get(this).axis = f.axis;
15298
15301
  }
15299
- pn(this);
15302
+ dn(this);
15300
15303
  }
15301
15304
  set source(f) {
15302
- Rn(this, f), pn(this);
15305
+ Rn(this, f), dn(this);
15303
15306
  }
15304
15307
  get source() {
15305
15308
  return Gt.get(this).source;
15306
15309
  }
15307
15310
  set axis(f) {
15308
15311
  if (!No(f)) throw TypeError("Invalid axis");
15309
- Gt.get(this).axis = f, pn(this);
15312
+ Gt.get(this).axis = f, dn(this);
15310
15313
  }
15311
15314
  get axis() {
15312
15315
  return Gt.get(this).axis;
@@ -15478,7 +15481,7 @@ var xd = Object.defineProperty, _d = (r, t, e) => t in r ? xd(r, t, { enumerable
15478
15481
  nr(y.source);
15479
15482
  })).observe(y.subject), new MutationObserver((() => {
15480
15483
  nr(y.source);
15481
- })).observe(y.subject, { attributes: !0, attributeFilter: ["class", "style"] })), ss(this), y.subjectMeasurements = as(y.source, y.subject), pn(this);
15484
+ })).observe(y.subject, { attributes: !0, attributeFilter: ["class", "style"] })), ss(this), y.subjectMeasurements = as(y.source, y.subject), dn(this);
15482
15485
  }
15483
15486
  get source() {
15484
15487
  return ss(this), Gt.get(this).source;
@@ -15531,7 +15534,7 @@ var xd = Object.defineProperty, _d = (r, t, e) => t in r ? xd(r, t, { enumerable
15531
15534
  function Jo() {
15532
15535
  return new DOMException("The user aborted a request", "AbortError");
15533
15536
  }
15534
- function mn(u, f) {
15537
+ function pn(u, f) {
15535
15538
  if (f === null) return f;
15536
15539
  if (typeof f != "number") throw new DOMException(`Unexpected value: ${f}. Cannot convert to CssNumberish`, "InvalidStateError");
15537
15540
  const y = u.rangeDuration ?? 100, S = $e(u), w = S ? y * f / S : 0;
@@ -15741,7 +15744,7 @@ var xd = Object.defineProperty, _d = (r, t, e) => t in r ? xd(r, t, { enumerable
15741
15744
  const q = F.apply(S);
15742
15745
  if (y.timeline) {
15743
15746
  const Y = y.duration ?? 100;
15744
- q.localTime = mn(y, q.localTime), q.endTime = mn(y, q.endTime), q.activeDuration = mn(y, q.activeDuration);
15747
+ q.localTime = pn(y, q.localTime), q.endTime = pn(y, q.endTime), q.activeDuration = pn(y, q.activeDuration);
15745
15748
  const Z = $e(y), pt = q.iterations ? (Z - q.delay - q.endDelay) / q.iterations : 0;
15746
15749
  q.duration = Z ? CSS.percent(Y * pt / Z) : CSS.percent(0), y.timeline.currentTime === void 0 && (q.localTime = null);
15747
15750
  }
@@ -15799,7 +15802,7 @@ var xd = Object.defineProperty, _d = (r, t, e) => t in r ? xd(r, t, { enumerable
15799
15802
  }
15800
15803
  get startTime() {
15801
15804
  const f = X.get(this);
15802
- return f.timeline ? mn(f, f.startTime) : f.animation.startTime;
15805
+ return f.timeline ? pn(f, f.startTime) : f.animation.startTime;
15803
15806
  }
15804
15807
  set startTime(f) {
15805
15808
  const y = X.get(this);
@@ -15810,7 +15813,7 @@ var xd = Object.defineProperty, _d = (r, t, e) => t in r ? xd(r, t, { enumerable
15810
15813
  }
15811
15814
  get currentTime() {
15812
15815
  const f = X.get(this);
15813
- return f.timeline ? f.holdTime != null ? mn(f, f.holdTime) : mn(f, $o(f)) : f.animation.currentTime;
15816
+ return f.timeline ? f.holdTime != null ? pn(f, f.holdTime) : pn(f, $o(f)) : f.animation.currentTime;
15814
15817
  }
15815
15818
  set currentTime(f) {
15816
15819
  const y = X.get(this);
@@ -15868,7 +15871,7 @@ var xd = Object.defineProperty, _d = (r, t, e) => t in r ? xd(r, t, { enumerable
15868
15871
  if (y > 0 && S == 1 / 0) throw new DOMException("Cannot finish Animation with an infinite target effect end.", "InvalidStateError");
15869
15872
  ze(f);
15870
15873
  const w = y < 0 ? 0 : S;
15871
- this.currentTime = mn(f, w);
15874
+ this.currentTime = pn(f, w);
15872
15875
  const k = St(f, f.timeline.currentTime);
15873
15876
  f.startTime === null && k !== null && (f.startTime = k - w / f.animation.playbackRate), f.pendingTask == "pause" && f.startTime !== null && (f.holdTime = null, f.pendingTask = null, f.readyPromise.resolve(this)), f.pendingTask == "play" && f.startTime !== null && (f.pendingTask = null, f.readyPromise.resolve(this)), We(f, !0, !0);
15874
15877
  }