@thatopen/components 2.0.0-alpha.3 → 2.0.0-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,131 +1,131 @@
1
1
  var vn = Object.defineProperty;
2
- var Bn = (c, s, t) => s in c ? vn(c, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : c[s] = t;
3
- var I = (c, s, t) => (Bn(c, typeof s != "symbol" ? s + "" : s, t), t);
2
+ var Bn = (l, s, t) => s in l ? vn(l, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[s] = t;
3
+ var I = (l, s, t) => (Bn(l, typeof s != "symbol" ? s + "" : s, t), t);
4
4
  import * as O from "three";
5
- import { BufferAttribute as An, Vector3 as M, Vector2 as fe, Plane as pi, Line3 as Lt, Triangle as ue, Sphere as Yn, Matrix4 as Mt, Box3 as Ot, BackSide as Vn, DoubleSide as Fn, FrontSide as _i, Mesh as v, Ray as Gn, Raycaster as zn, Quaternion as yt, Object3D as ei, Euler as Hn, MeshBasicMaterial as gn, LineBasicMaterial as kn, CylinderGeometry as ct, BoxGeometry as rt, BufferGeometry as Ni, Float32BufferAttribute as Pi, OctahedronGeometry as Qe, Line as Ut, SphereGeometry as Wn, TorusGeometry as me, PlaneGeometry as Xn } from "three";
5
+ import { BufferAttribute as An, Vector3 as M, Vector2 as fe, Plane as pi, Line3 as Pt, Triangle as ue, Sphere as Yn, Matrix4 as Mt, Box3 as Ot, BackSide as Gn, DoubleSide as Fn, FrontSide as _i, Mesh as v, Ray as Vn, Raycaster as zn, Quaternion as Lt, Object3D as ei, Euler as Hn, MeshBasicMaterial as gn, LineBasicMaterial as kn, CylinderGeometry as ct, BoxGeometry as rt, BufferGeometry as Ni, Float32BufferAttribute as yi, OctahedronGeometry as Qe, Line as Ut, SphereGeometry as Wn, TorusGeometry as me, PlaneGeometry as Xn } from "three";
6
6
  import * as b from "web-ifc";
7
7
  import * as $t from "bim-fragment";
8
8
  import { Serializer as Zn } from "bim-fragment";
9
- const On = 0, Qn = 1, jn = 2, yi = 2, Us = 1.25, Li = 1, Ts = 6 * 4 + 4 + 4, ys = 65535, qn = Math.pow(2, -24), xs = Symbol("SKIP_GENERATION");
10
- function $n(c) {
11
- return c.index ? c.index.count : c.attributes.position.count;
9
+ const On = 0, Qn = 1, jn = 2, Li = 2, Us = 1.25, Pi = 1, Ts = 6 * 4 + 4 + 4, Ls = 65535, qn = Math.pow(2, -24), xs = Symbol("SKIP_GENERATION");
10
+ function $n(l) {
11
+ return l.index ? l.index.count : l.attributes.position.count;
12
12
  }
13
- function pe(c) {
14
- return $n(c) / 3;
13
+ function pe(l) {
14
+ return $n(l) / 3;
15
15
  }
16
- function Kn(c, s = ArrayBuffer) {
17
- return c > 65535 ? new Uint32Array(new s(4 * c)) : new Uint16Array(new s(2 * c));
16
+ function Kn(l, s = ArrayBuffer) {
17
+ return l > 65535 ? new Uint32Array(new s(4 * l)) : new Uint16Array(new s(2 * l));
18
18
  }
19
- function Jn(c, s) {
20
- if (!c.index) {
21
- const t = c.attributes.position.count, e = s.useSharedArrayBuffer ? SharedArrayBuffer : ArrayBuffer, i = Kn(t, e);
22
- c.setIndex(new An(i, 1));
19
+ function Jn(l, s) {
20
+ if (!l.index) {
21
+ const t = l.attributes.position.count, e = s.useSharedArrayBuffer ? SharedArrayBuffer : ArrayBuffer, i = Kn(t, e);
22
+ l.setIndex(new An(i, 1));
23
23
  for (let o = 0; o < t; o++)
24
24
  i[o] = o;
25
25
  }
26
26
  }
27
- function Sn(c) {
28
- const s = pe(c), t = c.drawRange, e = t.start / 3, i = (t.start + t.count) / 3, o = Math.max(0, e), n = Math.min(s, i) - o;
27
+ function Sn(l) {
28
+ const s = pe(l), t = l.drawRange, e = t.start / 3, i = (t.start + t.count) / 3, o = Math.max(0, e), n = Math.min(s, i) - o;
29
29
  return [{
30
30
  offset: Math.floor(o),
31
31
  count: Math.floor(n)
32
32
  }];
33
33
  }
34
- function _n(c) {
35
- if (!c.groups || !c.groups.length)
36
- return Sn(c);
37
- const s = [], t = /* @__PURE__ */ new Set(), e = c.drawRange, i = e.start / 3, o = (e.start + e.count) / 3;
38
- for (const r of c.groups) {
39
- const a = r.start / 3, l = (r.start + r.count) / 3;
40
- t.add(Math.max(i, a)), t.add(Math.min(o, l));
34
+ function _n(l) {
35
+ if (!l.groups || !l.groups.length)
36
+ return Sn(l);
37
+ const s = [], t = /* @__PURE__ */ new Set(), e = l.drawRange, i = e.start / 3, o = (e.start + e.count) / 3;
38
+ for (const r of l.groups) {
39
+ const a = r.start / 3, c = (r.start + r.count) / 3;
40
+ t.add(Math.max(i, a)), t.add(Math.min(o, c));
41
41
  }
42
42
  const n = Array.from(t.values()).sort((r, a) => r - a);
43
43
  for (let r = 0; r < n.length - 1; r++) {
44
- const a = n[r], l = n[r + 1];
44
+ const a = n[r], c = n[r + 1];
45
45
  s.push({
46
46
  offset: Math.floor(a),
47
- count: Math.floor(l - a)
47
+ count: Math.floor(c - a)
48
48
  });
49
49
  }
50
50
  return s;
51
51
  }
52
- function to(c) {
53
- if (c.groups.length === 0)
52
+ function to(l) {
53
+ if (l.groups.length === 0)
54
54
  return !1;
55
- const s = pe(c), t = _n(c).sort((o, n) => o.offset - n.offset), e = t[t.length - 1];
55
+ const s = pe(l), t = _n(l).sort((o, n) => o.offset - n.offset), e = t[t.length - 1];
56
56
  e.count = Math.min(s - e.offset, e.count);
57
57
  let i = 0;
58
58
  return t.forEach(({ count: o }) => i += o), s !== i;
59
59
  }
60
- function $(c, s, t) {
61
- return t.min.x = s[c], t.min.y = s[c + 1], t.min.z = s[c + 2], t.max.x = s[c + 3], t.max.y = s[c + 4], t.max.z = s[c + 5], t;
60
+ function $(l, s, t) {
61
+ return t.min.x = s[l], t.min.y = s[l + 1], t.min.z = s[l + 2], t.max.x = s[l + 3], t.max.y = s[l + 4], t.max.z = s[l + 5], t;
62
62
  }
63
- function eo(c) {
64
- c[0] = c[1] = c[2] = 1 / 0, c[3] = c[4] = c[5] = -1 / 0;
63
+ function eo(l) {
64
+ l[0] = l[1] = l[2] = 1 / 0, l[3] = l[4] = l[5] = -1 / 0;
65
65
  }
66
- function Mi(c) {
66
+ function Mi(l) {
67
67
  let s = -1, t = -1 / 0;
68
68
  for (let e = 0; e < 3; e++) {
69
- const i = c[e + 3] - c[e];
69
+ const i = l[e + 3] - l[e];
70
70
  i > t && (t = i, s = e);
71
71
  }
72
72
  return s;
73
73
  }
74
- function wi(c, s) {
75
- s.set(c);
74
+ function wi(l, s) {
75
+ s.set(l);
76
76
  }
77
- function Di(c, s, t) {
77
+ function Di(l, s, t) {
78
78
  let e, i;
79
79
  for (let o = 0; o < 3; o++) {
80
80
  const n = o + 3;
81
- e = c[o], i = s[o], t[o] = e < i ? e : i, e = c[n], i = s[n], t[n] = e > i ? e : i;
81
+ e = l[o], i = s[o], t[o] = e < i ? e : i, e = l[n], i = s[n], t[n] = e > i ? e : i;
82
82
  }
83
83
  }
84
- function je(c, s, t) {
84
+ function je(l, s, t) {
85
85
  for (let e = 0; e < 3; e++) {
86
- const i = s[c + 2 * e], o = s[c + 2 * e + 1], n = i - o, r = i + o;
86
+ const i = s[l + 2 * e], o = s[l + 2 * e + 1], n = i - o, r = i + o;
87
87
  n < t[e] && (t[e] = n), r > t[e + 3] && (t[e + 3] = r);
88
88
  }
89
89
  }
90
- function Re(c) {
91
- const s = c[3] - c[0], t = c[4] - c[1], e = c[5] - c[2];
90
+ function Re(l) {
91
+ const s = l[3] - l[0], t = l[4] - l[1], e = l[5] - l[2];
92
92
  return 2 * (s * t + t * e + e * s);
93
93
  }
94
- function bs(c, s, t, e, i = null) {
95
- let o = 1 / 0, n = 1 / 0, r = 1 / 0, a = -1 / 0, l = -1 / 0, E = -1 / 0, d = 1 / 0, h = 1 / 0, u = 1 / 0, p = -1 / 0, R = -1 / 0, A = -1 / 0;
94
+ function bs(l, s, t, e, i = null) {
95
+ let o = 1 / 0, n = 1 / 0, r = 1 / 0, a = -1 / 0, c = -1 / 0, E = -1 / 0, d = 1 / 0, h = 1 / 0, u = 1 / 0, p = -1 / 0, R = -1 / 0, A = -1 / 0;
96
96
  const C = i !== null;
97
97
  for (let T = s * 6, F = (s + t) * 6; T < F; T += 6) {
98
- const f = c[T + 0], m = c[T + 1], g = f - m, S = f + m;
98
+ const f = l[T + 0], m = l[T + 1], g = f - m, S = f + m;
99
99
  g < o && (o = g), S > a && (a = S), C && f < d && (d = f), C && f > p && (p = f);
100
- const _ = c[T + 2], N = c[T + 3], y = _ - N, w = _ + N;
101
- y < n && (n = y), w > l && (l = w), C && _ < h && (h = _), C && _ > R && (R = _);
102
- const L = c[T + 4], U = c[T + 5], x = L - U, B = L + U;
103
- x < r && (r = x), B > E && (E = B), C && L < u && (u = L), C && L > A && (A = L);
100
+ const _ = l[T + 2], N = l[T + 3], L = _ - N, w = _ + N;
101
+ L < n && (n = L), w > c && (c = w), C && _ < h && (h = _), C && _ > R && (R = _);
102
+ const P = l[T + 4], U = l[T + 5], x = P - U, B = P + U;
103
+ x < r && (r = x), B > E && (E = B), C && P < u && (u = P), C && P > A && (A = P);
104
104
  }
105
- e[0] = o, e[1] = n, e[2] = r, e[3] = a, e[4] = l, e[5] = E, C && (i[0] = d, i[1] = h, i[2] = u, i[3] = p, i[4] = R, i[5] = A);
105
+ e[0] = o, e[1] = n, e[2] = r, e[3] = a, e[4] = c, e[5] = E, C && (i[0] = d, i[1] = h, i[2] = u, i[3] = p, i[4] = R, i[5] = A);
106
106
  }
107
- function so(c, s, t, e) {
108
- let i = 1 / 0, o = 1 / 0, n = 1 / 0, r = -1 / 0, a = -1 / 0, l = -1 / 0;
107
+ function so(l, s, t, e) {
108
+ let i = 1 / 0, o = 1 / 0, n = 1 / 0, r = -1 / 0, a = -1 / 0, c = -1 / 0;
109
109
  for (let E = s * 6, d = (s + t) * 6; E < d; E += 6) {
110
- const h = c[E + 0];
110
+ const h = l[E + 0];
111
111
  h < i && (i = h), h > r && (r = h);
112
- const u = c[E + 2];
112
+ const u = l[E + 2];
113
113
  u < o && (o = u), u > a && (a = u);
114
- const p = c[E + 4];
115
- p < n && (n = p), p > l && (l = p);
114
+ const p = l[E + 4];
115
+ p < n && (n = p), p > c && (c = p);
116
116
  }
117
- e[0] = i, e[1] = o, e[2] = n, e[3] = r, e[4] = a, e[5] = l;
117
+ e[0] = i, e[1] = o, e[2] = n, e[3] = r, e[4] = a, e[5] = c;
118
118
  }
119
- function io(c, s) {
119
+ function io(l, s) {
120
120
  eo(s);
121
- const t = c.attributes.position, e = c.index ? c.index.array : null, i = pe(c), o = new Float32Array(i * 6), n = t.normalized, r = t.array, a = t.offset || 0;
122
- let l = 3;
123
- t.isInterleavedBufferAttribute && (l = t.data.stride);
121
+ const t = l.attributes.position, e = l.index ? l.index.array : null, i = pe(l), o = new Float32Array(i * 6), n = t.normalized, r = t.array, a = t.offset || 0;
122
+ let c = 3;
123
+ t.isInterleavedBufferAttribute && (c = t.data.stride);
124
124
  const E = ["getX", "getY", "getZ"];
125
125
  for (let d = 0; d < i; d++) {
126
126
  const h = d * 3, u = d * 6;
127
127
  let p = h + 0, R = h + 1, A = h + 2;
128
- e && (p = e[p], R = e[R], A = e[A]), n || (p = p * l + a, R = R * l + a, A = A * l + a);
128
+ e && (p = e[p], R = e[R], A = e[A]), n || (p = p * c + a, R = R * c + a, A = A * c + a);
129
129
  for (let C = 0; C < 3; C++) {
130
130
  let T, F, f;
131
131
  n ? (T = t[E[C]](p), F = t[E[C]](R), f = t[E[C]](A)) : (T = r[p + C], F = r[R + C], f = r[A + C]);
@@ -139,22 +139,22 @@ function io(c, s) {
139
139
  }
140
140
  return o;
141
141
  }
142
- const wt = 32, no = (c, s) => c.candidate - s.candidate, xt = new Array(wt).fill().map(() => ({
142
+ const wt = 32, no = (l, s) => l.candidate - s.candidate, xt = new Array(wt).fill().map(() => ({
143
143
  count: 0,
144
144
  bounds: new Float32Array(6),
145
145
  rightCacheBounds: new Float32Array(6),
146
146
  leftCacheBounds: new Float32Array(6),
147
147
  candidate: 0
148
148
  })), qe = new Float32Array(6);
149
- function oo(c, s, t, e, i, o) {
149
+ function oo(l, s, t, e, i, o) {
150
150
  let n = -1, r = 0;
151
151
  if (o === On)
152
152
  n = Mi(s), n !== -1 && (r = (s[n] + s[n + 3]) / 2);
153
153
  else if (o === Qn)
154
- n = Mi(c), n !== -1 && (r = ro(t, e, i, n));
154
+ n = Mi(l), n !== -1 && (r = ro(t, e, i, n));
155
155
  else if (o === jn) {
156
- const a = Re(c);
157
- let l = Us * i;
156
+ const a = Re(l);
157
+ let c = Us * i;
158
158
  const E = e * 6, d = (e + i) * 6;
159
159
  for (let h = 0; h < 3; h++) {
160
160
  const u = s[h], A = (s[h + 3] - u) / wt;
@@ -190,12 +190,12 @@ function oo(c, s, t, e, i, o) {
190
190
  }
191
191
  for (let f = 0; f < F; f++) {
192
192
  const m = C[f], g = m.count, S = i - m.count, _ = m.leftCacheBounds, N = m.rightCacheBounds;
193
- let y = 0;
194
- g !== 0 && (y = Re(_) / a);
193
+ let L = 0;
194
+ g !== 0 && (L = Re(_) / a);
195
195
  let w = 0;
196
196
  S !== 0 && (w = Re(N) / a);
197
- const L = Li + Us * (y * g + w * S);
198
- L < l && (n = h, l = L, r = m.candidate);
197
+ const P = Pi + Us * (L * g + w * S);
198
+ P < c && (n = h, c = P, r = m.candidate);
199
199
  }
200
200
  } else {
201
201
  for (let F = 0; F < wt; F++) {
@@ -221,12 +221,12 @@ function oo(c, s, t, e, i, o) {
221
221
  for (let F = 0; F < wt - 1; F++) {
222
222
  const f = xt[F], m = f.count, g = f.bounds, _ = xt[F + 1].rightCacheBounds;
223
223
  m !== 0 && (T === 0 ? wi(g, qe) : Di(g, qe, qe)), T += m;
224
- let N = 0, y = 0;
224
+ let N = 0, L = 0;
225
225
  T !== 0 && (N = Re(qe) / a);
226
226
  const w = i - T;
227
- w !== 0 && (y = Re(_) / a);
228
- const L = Li + Us * (N * T + y * w);
229
- L < l && (n = h, l = L, r = f.candidate);
227
+ w !== 0 && (L = Re(_) / a);
228
+ const P = Pi + Us * (N * T + L * w);
229
+ P < c && (n = h, c = P, r = f.candidate);
230
230
  }
231
231
  }
232
232
  }
@@ -234,23 +234,23 @@ function oo(c, s, t, e, i, o) {
234
234
  console.warn(`MeshBVH: Invalid build strategy value ${o} used.`);
235
235
  return { axis: n, pos: r };
236
236
  }
237
- function ro(c, s, t, e) {
237
+ function ro(l, s, t, e) {
238
238
  let i = 0;
239
239
  for (let o = s, n = s + t; o < n; o++)
240
- i += c[o * 6 + e * 2];
240
+ i += l[o * 6 + e * 2];
241
241
  return i / t;
242
242
  }
243
243
  class $e {
244
244
  constructor() {
245
245
  }
246
246
  }
247
- function ao(c, s, t, e, i, o) {
247
+ function ao(l, s, t, e, i, o) {
248
248
  let n = e, r = e + i - 1;
249
- const a = o.pos, l = o.axis * 2;
249
+ const a = o.pos, c = o.axis * 2;
250
250
  for (; ; ) {
251
- for (; n <= r && t[n * 6 + l] < a; )
251
+ for (; n <= r && t[n * 6 + c] < a; )
252
252
  n++;
253
- for (; n <= r && t[r * 6 + l] >= a; )
253
+ for (; n <= r && t[r * 6 + c] >= a; )
254
254
  r--;
255
255
  if (n < r) {
256
256
  for (let E = 0; E < 3; E++) {
@@ -266,17 +266,17 @@ function ao(c, s, t, e, i, o) {
266
266
  return n;
267
267
  }
268
268
  }
269
- function co(c, s, t, e, i, o) {
269
+ function co(l, s, t, e, i, o) {
270
270
  let n = e, r = e + i - 1;
271
- const a = o.pos, l = o.axis * 2;
271
+ const a = o.pos, c = o.axis * 2;
272
272
  for (; ; ) {
273
- for (; n <= r && t[n * 6 + l] < a; )
273
+ for (; n <= r && t[n * 6 + c] < a; )
274
274
  n++;
275
- for (; n <= r && t[r * 6 + l] >= a; )
275
+ for (; n <= r && t[r * 6 + c] >= a; )
276
276
  r--;
277
277
  if (n < r) {
278
- let E = c[n];
279
- c[n] = c[r], c[r] = E;
278
+ let E = l[n];
279
+ l[n] = l[r], l[r] = E;
280
280
  for (let d = 0; d < 6; d++) {
281
281
  let h = t[n * 6 + d];
282
282
  t[n * 6 + d] = t[r * 6 + d], t[r * 6 + d] = h;
@@ -286,14 +286,14 @@ function co(c, s, t, e, i, o) {
286
286
  return n;
287
287
  }
288
288
  }
289
- function lo(c, s) {
290
- const t = (c.index ? c.index.count : c.attributes.position.count) / 3, e = t > 2 ** 16, i = e ? 4 : 2, o = s ? new SharedArrayBuffer(t * i) : new ArrayBuffer(t * i), n = e ? new Uint32Array(o) : new Uint16Array(o);
289
+ function lo(l, s) {
290
+ const t = (l.index ? l.index.count : l.attributes.position.count) / 3, e = t > 2 ** 16, i = e ? 4 : 2, o = s ? new SharedArrayBuffer(t * i) : new ArrayBuffer(t * i), n = e ? new Uint32Array(o) : new Uint16Array(o);
291
291
  for (let r = 0, a = n.length; r < a; r++)
292
292
  n[r] = r;
293
293
  return n;
294
294
  }
295
- function ho(c, s) {
296
- const t = c.geometry, e = t.index ? t.index.array : null, i = s.maxDepth, o = s.verbose, n = s.maxLeafTris, r = s.strategy, a = s.onProgress, l = pe(t), E = c._indirectBuffer;
295
+ function ho(l, s) {
296
+ const t = l.geometry, e = t.index ? t.index.array : null, i = s.maxDepth, o = s.verbose, n = s.maxLeafTris, r = s.strategy, a = s.onProgress, c = pe(t), E = l._indirectBuffer;
297
297
  let d = !1;
298
298
  const h = new Float32Array(6), u = new Float32Array(6), p = io(t, h), R = s.indirect ? co : ao, A = [], C = s.indirect ? Sn(t) : _n(t);
299
299
  if (C.length === 1) {
@@ -306,7 +306,7 @@ function ho(c, s) {
306
306
  }
307
307
  return A;
308
308
  function T(f) {
309
- a && a(f / l);
309
+ a && a(f / c);
310
310
  }
311
311
  function F(f, m, g, S = null, _ = 0) {
312
312
  if (!d && _ >= i && (d = !0, o && (console.warn(`MeshBVH: Max depth of ${i} reached when generating BVH. Consider increasing maxDepth.`), console.warn(t))), g <= n || _ >= i)
@@ -314,37 +314,37 @@ function ho(c, s) {
314
314
  const N = oo(f.boundingData, S, p, m, g, r);
315
315
  if (N.axis === -1)
316
316
  return T(m + g), f.offset = m, f.count = g, f;
317
- const y = R(E, e, p, m, g, N);
318
- if (y === m || y === m + g)
317
+ const L = R(E, e, p, m, g, N);
318
+ if (L === m || L === m + g)
319
319
  T(m + g), f.offset = m, f.count = g;
320
320
  else {
321
321
  f.splitAxis = N.axis;
322
- const w = new $e(), L = m, U = y - m;
323
- f.left = w, w.boundingData = new Float32Array(6), bs(p, L, U, w.boundingData, u), F(w, L, U, u, _ + 1);
324
- const x = new $e(), B = y, H = g - U;
322
+ const w = new $e(), P = m, U = L - m;
323
+ f.left = w, w.boundingData = new Float32Array(6), bs(p, P, U, w.boundingData, u), F(w, P, U, u, _ + 1);
324
+ const x = new $e(), B = L, H = g - U;
325
325
  f.right = x, x.boundingData = new Float32Array(6), bs(p, B, H, x.boundingData, u), F(x, B, H, u, _ + 1);
326
326
  }
327
327
  return f;
328
328
  }
329
329
  }
330
- function Eo(c, s) {
331
- const t = c.geometry;
332
- s.indirect && (c._indirectBuffer = lo(t, s.useSharedArrayBuffer), to(t) && !s.verbose && console.warn(
330
+ function Eo(l, s) {
331
+ const t = l.geometry;
332
+ s.indirect && (l._indirectBuffer = lo(t, s.useSharedArrayBuffer), to(t) && !s.verbose && console.warn(
333
333
  'MeshBVH: Provided geometry contains groups that do not fully span the vertex contents while using the "indirect" option. BVH may incorrectly report intersections on unrendered portions of the geometry.'
334
- )), c._indirectBuffer || Jn(t, s);
335
- const e = ho(c, s);
334
+ )), l._indirectBuffer || Jn(t, s);
335
+ const e = ho(l, s);
336
336
  let i, o, n;
337
337
  const r = [], a = s.useSharedArrayBuffer ? SharedArrayBuffer : ArrayBuffer;
338
338
  for (let d = 0; d < e.length; d++) {
339
339
  const h = e[d];
340
- let u = l(h);
340
+ let u = c(h);
341
341
  const p = new a(Ts * u);
342
342
  i = new Float32Array(p), o = new Uint32Array(p), n = new Uint16Array(p), E(0, h), r.push(p);
343
343
  }
344
- c._roots = r;
344
+ l._roots = r;
345
345
  return;
346
- function l(d) {
347
- return d.count ? 1 : 1 + l(d.left) + l(d.right);
346
+ function c(d) {
347
+ return d.count ? 1 : 1 + c(d.left) + c(d.right);
348
348
  }
349
349
  function E(d, h) {
350
350
  const u = d / 4, p = d / 2, R = !!h.count, A = h.boundingData;
@@ -352,7 +352,7 @@ function Eo(c, s) {
352
352
  i[u + C] = A[C];
353
353
  if (R) {
354
354
  const C = h.offset, T = h.count;
355
- return o[u + 6] = C, n[p + 14] = T, n[p + 15] = ys, d + Ts;
355
+ return o[u + 6] = C, n[p + 14] = T, n[p + 15] = Ls, d + Ts;
356
356
  } else {
357
357
  const C = h.left, T = h.right, F = h.splitAxis;
358
358
  let f;
@@ -387,48 +387,48 @@ class Dt {
387
387
  }
388
388
  }
389
389
  Dt.prototype.setFromBox = function() {
390
- const c = new M();
390
+ const l = new M();
391
391
  return function(t, e) {
392
392
  const i = e.min, o = e.max;
393
393
  let n = 1 / 0, r = -1 / 0;
394
394
  for (let a = 0; a <= 1; a++)
395
- for (let l = 0; l <= 1; l++)
395
+ for (let c = 0; c <= 1; c++)
396
396
  for (let E = 0; E <= 1; E++) {
397
- c.x = i.x * a + o.x * (1 - a), c.y = i.y * l + o.y * (1 - l), c.z = i.z * E + o.z * (1 - E);
398
- const d = t.dot(c);
397
+ l.x = i.x * a + o.x * (1 - a), l.y = i.y * c + o.y * (1 - c), l.z = i.z * E + o.z * (1 - E);
398
+ const d = t.dot(l);
399
399
  n = Math.min(d, n), r = Math.max(d, r);
400
400
  }
401
401
  this.min = n, this.max = r;
402
402
  };
403
403
  }();
404
404
  const uo = function() {
405
- const c = new M(), s = new M(), t = new M();
405
+ const l = new M(), s = new M(), t = new M();
406
406
  return function(i, o, n) {
407
- const r = i.start, a = c, l = o.start, E = s;
408
- t.subVectors(r, l), c.subVectors(i.end, i.start), s.subVectors(o.end, o.start);
407
+ const r = i.start, a = l, c = o.start, E = s;
408
+ t.subVectors(r, c), l.subVectors(i.end, i.start), s.subVectors(o.end, o.start);
409
409
  const d = t.dot(E), h = E.dot(a), u = E.dot(E), p = t.dot(a), A = a.dot(a) * u - h * h;
410
410
  let C, T;
411
411
  A !== 0 ? C = (d * h - p * u) / A : C = 0, T = (d + C * h) / u, n.x = C, n.y = T;
412
412
  };
413
413
  }(), Ci = function() {
414
- const c = new fe(), s = new M(), t = new M();
414
+ const l = new fe(), s = new M(), t = new M();
415
415
  return function(i, o, n, r) {
416
- uo(i, o, c);
417
- let a = c.x, l = c.y;
418
- if (a >= 0 && a <= 1 && l >= 0 && l <= 1) {
419
- i.at(a, n), o.at(l, r);
416
+ uo(i, o, l);
417
+ let a = l.x, c = l.y;
418
+ if (a >= 0 && a <= 1 && c >= 0 && c <= 1) {
419
+ i.at(a, n), o.at(c, r);
420
420
  return;
421
421
  } else if (a >= 0 && a <= 1) {
422
- l < 0 ? o.at(0, r) : o.at(1, r), i.closestPointToPoint(r, !0, n);
422
+ c < 0 ? o.at(0, r) : o.at(1, r), i.closestPointToPoint(r, !0, n);
423
423
  return;
424
- } else if (l >= 0 && l <= 1) {
424
+ } else if (c >= 0 && c <= 1) {
425
425
  a < 0 ? i.at(0, n) : i.at(1, n), o.closestPointToPoint(n, !0, r);
426
426
  return;
427
427
  } else {
428
428
  let E;
429
429
  a < 0 ? E = i.start : E = i.end;
430
430
  let d;
431
- l < 0 ? d = o.start : d = o.end;
431
+ c < 0 ? d = o.start : d = o.end;
432
432
  const h = s, u = t;
433
433
  if (i.closestPointToPoint(d, !0, s), o.closestPointToPoint(E, !0, t), h.distanceToSquared(d) <= u.distanceToSquared(E)) {
434
434
  n.copy(h), r.copy(d);
@@ -440,10 +440,10 @@ const uo = function() {
440
440
  }
441
441
  };
442
442
  }(), Io = function() {
443
- const c = new M(), s = new M(), t = new pi(), e = new Lt();
443
+ const l = new M(), s = new M(), t = new pi(), e = new Pt();
444
444
  return function(o, n) {
445
- const { radius: r, center: a } = o, { a: l, b: E, c: d } = n;
446
- if (e.start = l, e.end = E, e.closestPointToPoint(a, !0, c).distanceTo(a) <= r || (e.start = l, e.end = d, e.closestPointToPoint(a, !0, c).distanceTo(a) <= r) || (e.start = E, e.end = d, e.closestPointToPoint(a, !0, c).distanceTo(a) <= r))
445
+ const { radius: r, center: a } = o, { a: c, b: E, c: d } = n;
446
+ if (e.start = c, e.end = E, e.closestPointToPoint(a, !0, l).distanceTo(a) <= r || (e.start = c, e.end = d, e.closestPointToPoint(a, !0, l).distanceTo(a) <= r) || (e.start = E, e.end = d, e.closestPointToPoint(a, !0, l).distanceTo(a) <= r))
447
447
  return !0;
448
448
  const R = n.getPlane(t);
449
449
  if (Math.abs(R.distanceToPoint(a)) <= r) {
@@ -454,8 +454,8 @@ const uo = function() {
454
454
  return !1;
455
455
  };
456
456
  }(), fo = 1e-15;
457
- function vs(c) {
458
- return Math.abs(c) < fo;
457
+ function vs(l) {
458
+ return Math.abs(l) < fo;
459
459
  }
460
460
  class gt extends ue {
461
461
  constructor(...s) {
@@ -467,8 +467,8 @@ class gt extends ue {
467
467
  update() {
468
468
  const s = this.a, t = this.b, e = this.c, i = this.points, o = this.satAxes, n = this.satBounds, r = o[0], a = n[0];
469
469
  this.getNormal(r), a.setFromPoints(r, i);
470
- const l = o[1], E = n[1];
471
- l.subVectors(s, t), E.setFromPoints(l, i);
470
+ const c = o[1], E = n[1];
471
+ c.subVectors(s, t), E.setFromPoints(c, i);
472
472
  const d = o[2], h = n[2];
473
473
  d.subVectors(t, e), h.setFromPoints(d, i);
474
474
  const u = o[3], p = n[3];
@@ -476,19 +476,19 @@ class gt extends ue {
476
476
  }
477
477
  }
478
478
  gt.prototype.closestPointToSegment = function() {
479
- const c = new M(), s = new M(), t = new Lt();
479
+ const l = new M(), s = new M(), t = new Pt();
480
480
  return function(i, o = null, n = null) {
481
- const { start: r, end: a } = i, l = this.points;
481
+ const { start: r, end: a } = i, c = this.points;
482
482
  let E, d = 1 / 0;
483
483
  for (let h = 0; h < 3; h++) {
484
484
  const u = (h + 1) % 3;
485
- t.start.copy(l[h]), t.end.copy(l[u]), Ci(t, i, c, s), E = c.distanceToSquared(s), E < d && (d = E, o && o.copy(c), n && n.copy(s));
485
+ t.start.copy(c[h]), t.end.copy(c[u]), Ci(t, i, l, s), E = l.distanceToSquared(s), E < d && (d = E, o && o.copy(l), n && n.copy(s));
486
486
  }
487
- return this.closestPointToPoint(r, c), E = r.distanceToSquared(c), E < d && (d = E, o && o.copy(c), n && n.copy(r)), this.closestPointToPoint(a, c), E = a.distanceToSquared(c), E < d && (d = E, o && o.copy(c), n && n.copy(a)), Math.sqrt(d);
487
+ return this.closestPointToPoint(r, l), E = r.distanceToSquared(l), E < d && (d = E, o && o.copy(l), n && n.copy(r)), this.closestPointToPoint(a, l), E = a.distanceToSquared(l), E < d && (d = E, o && o.copy(l), n && n.copy(a)), Math.sqrt(d);
488
488
  };
489
489
  }();
490
490
  gt.prototype.intersectsTriangle = function() {
491
- const c = new gt(), s = new Array(3), t = new Array(3), e = new Dt(), i = new Dt(), o = new M(), n = new M(), r = new M(), a = new M(), l = new M(), E = new Lt(), d = new Lt(), h = new Lt(), u = new M();
491
+ const l = new gt(), s = new Array(3), t = new Array(3), e = new Dt(), i = new Dt(), o = new M(), n = new M(), r = new M(), a = new M(), c = new M(), E = new Pt(), d = new Pt(), h = new Pt(), u = new M();
492
492
  function p(R, A, C) {
493
493
  const T = R.points;
494
494
  let F = 0, f = -1;
@@ -515,28 +515,28 @@ gt.prototype.intersectsTriangle = function() {
515
515
  return F;
516
516
  }
517
517
  return function(A, C = null, T = !1) {
518
- this.needsUpdate && this.update(), A.isExtendedTriangle ? A.needsUpdate && A.update() : (c.copy(A), c.update(), A = c);
518
+ this.needsUpdate && this.update(), A.isExtendedTriangle ? A.needsUpdate && A.update() : (l.copy(A), l.update(), A = l);
519
519
  const F = this.plane, f = A.plane;
520
520
  if (Math.abs(F.normal.dot(f.normal)) > 1 - 1e-10) {
521
521
  const m = this.satBounds, g = this.satAxes;
522
522
  t[0] = A.a, t[1] = A.b, t[2] = A.c;
523
523
  for (let N = 0; N < 4; N++) {
524
- const y = m[N], w = g[N];
525
- if (e.setFromPoints(w, t), y.isSeparated(e))
524
+ const L = m[N], w = g[N];
525
+ if (e.setFromPoints(w, t), L.isSeparated(e))
526
526
  return !1;
527
527
  }
528
528
  const S = A.satBounds, _ = A.satAxes;
529
529
  s[0] = this.a, s[1] = this.b, s[2] = this.c;
530
530
  for (let N = 0; N < 4; N++) {
531
- const y = S[N], w = _[N];
532
- if (e.setFromPoints(w, s), y.isSeparated(e))
531
+ const L = S[N], w = _[N];
532
+ if (e.setFromPoints(w, s), L.isSeparated(e))
533
533
  return !1;
534
534
  }
535
535
  for (let N = 0; N < 4; N++) {
536
- const y = g[N];
536
+ const L = g[N];
537
537
  for (let w = 0; w < 4; w++) {
538
- const L = _[w];
539
- if (o.crossVectors(y, L), e.setFromPoints(o, s), i.setFromPoints(o, t), e.isSeparated(i))
538
+ const P = _[w];
539
+ if (o.crossVectors(L, P), e.setFromPoints(o, s), i.setFromPoints(o, t), e.isSeparated(i))
540
540
  return !1;
541
541
  }
542
542
  }
@@ -556,39 +556,39 @@ gt.prototype.intersectsTriangle = function() {
556
556
  let U = h.start;
557
557
  h.start = h.end, h.end = U;
558
558
  }
559
- const S = d.start.dot(r), _ = d.end.dot(r), N = h.start.dot(r), y = h.end.dot(r), w = _ < N, L = S < y;
560
- return S !== y && N !== _ && w === L ? !1 : (C && (l.subVectors(d.start, h.start), l.dot(r) > 0 ? C.start.copy(d.start) : C.start.copy(h.start), l.subVectors(d.end, h.end), l.dot(r) < 0 ? C.end.copy(d.end) : C.end.copy(h.end)), !0);
559
+ const S = d.start.dot(r), _ = d.end.dot(r), N = h.start.dot(r), L = h.end.dot(r), w = _ < N, P = S < L;
560
+ return S !== L && N !== _ && w === P ? !1 : (C && (c.subVectors(d.start, h.start), c.dot(r) > 0 ? C.start.copy(d.start) : C.start.copy(h.start), c.subVectors(d.end, h.end), c.dot(r) < 0 ? C.end.copy(d.end) : C.end.copy(h.end)), !0);
561
561
  }
562
562
  };
563
563
  }();
564
564
  gt.prototype.distanceToPoint = function() {
565
- const c = new M();
565
+ const l = new M();
566
566
  return function(t) {
567
- return this.closestPointToPoint(t, c), t.distanceTo(c);
567
+ return this.closestPointToPoint(t, l), t.distanceTo(l);
568
568
  };
569
569
  }();
570
570
  gt.prototype.distanceToTriangle = function() {
571
- const c = new M(), s = new M(), t = ["a", "b", "c"], e = new Lt(), i = new Lt();
571
+ const l = new M(), s = new M(), t = ["a", "b", "c"], e = new Pt(), i = new Pt();
572
572
  return function(n, r = null, a = null) {
573
- const l = r || a ? e : null;
574
- if (this.intersectsTriangle(n, l))
575
- return (r || a) && (r && l.getCenter(r), a && l.getCenter(a)), 0;
573
+ const c = r || a ? e : null;
574
+ if (this.intersectsTriangle(n, c))
575
+ return (r || a) && (r && c.getCenter(r), a && c.getCenter(a)), 0;
576
576
  let E = 1 / 0;
577
577
  for (let d = 0; d < 3; d++) {
578
578
  let h;
579
579
  const u = t[d], p = n[u];
580
- this.closestPointToPoint(p, c), h = p.distanceToSquared(c), h < E && (E = h, r && r.copy(c), a && a.copy(p));
580
+ this.closestPointToPoint(p, l), h = p.distanceToSquared(l), h < E && (E = h, r && r.copy(l), a && a.copy(p));
581
581
  const R = this[u];
582
- n.closestPointToPoint(R, c), h = R.distanceToSquared(c), h < E && (E = h, r && r.copy(R), a && a.copy(c));
582
+ n.closestPointToPoint(R, l), h = R.distanceToSquared(l), h < E && (E = h, r && r.copy(R), a && a.copy(l));
583
583
  }
584
584
  for (let d = 0; d < 3; d++) {
585
585
  const h = t[d], u = t[(d + 1) % 3];
586
586
  e.set(this[h], this[u]);
587
587
  for (let p = 0; p < 3; p++) {
588
588
  const R = t[p], A = t[(p + 1) % 3];
589
- i.set(n[R], n[A]), Ci(e, i, c, s);
590
- const C = c.distanceToSquared(s);
591
- C < E && (E = C, r && r.copy(c), a && a.copy(s));
589
+ i.set(n[R], n[A]), Ci(e, i, l, s);
590
+ const C = l.distanceToSquared(s);
591
+ C < E && (E = C, r && r.copy(l), a && a.copy(s));
592
592
  }
593
593
  }
594
594
  return Math.sqrt(E);
@@ -608,15 +608,15 @@ class at {
608
608
  at.prototype.update = /* @__PURE__ */ function() {
609
609
  return function() {
610
610
  const s = this.matrix, t = this.min, e = this.max, i = this.points;
611
- for (let l = 0; l <= 1; l++)
611
+ for (let c = 0; c <= 1; c++)
612
612
  for (let E = 0; E <= 1; E++)
613
613
  for (let d = 0; d <= 1; d++) {
614
- const h = 1 * l | 2 * E | 4 * d, u = i[h];
615
- u.x = l ? e.x : t.x, u.y = E ? e.y : t.y, u.z = d ? e.z : t.z, u.applyMatrix4(s);
614
+ const h = 1 * c | 2 * E | 4 * d, u = i[h];
615
+ u.x = c ? e.x : t.x, u.y = E ? e.y : t.y, u.z = d ? e.z : t.z, u.applyMatrix4(s);
616
616
  }
617
617
  const o = this.satBounds, n = this.satAxes, r = i[0];
618
- for (let l = 0; l < 3; l++) {
619
- const E = n[l], d = o[l], h = 1 << l, u = i[h];
618
+ for (let c = 0; c < 3; c++) {
619
+ const E = n[c], d = o[c], h = 1 << c, u = i[h];
620
620
  E.subVectors(r, u), d.setFromPoints(E, i);
621
621
  }
622
622
  const a = this.alignedSatBounds;
@@ -624,24 +624,24 @@ at.prototype.update = /* @__PURE__ */ function() {
624
624
  };
625
625
  }();
626
626
  at.prototype.intersectsBox = function() {
627
- const c = new Dt();
627
+ const l = new Dt();
628
628
  return function(t) {
629
629
  this.needsUpdate && this.update();
630
630
  const e = t.min, i = t.max, o = this.satBounds, n = this.satAxes, r = this.alignedSatBounds;
631
- if (c.min = e.x, c.max = i.x, r[0].isSeparated(c) || (c.min = e.y, c.max = i.y, r[1].isSeparated(c)) || (c.min = e.z, c.max = i.z, r[2].isSeparated(c)))
631
+ if (l.min = e.x, l.max = i.x, r[0].isSeparated(l) || (l.min = e.y, l.max = i.y, r[1].isSeparated(l)) || (l.min = e.z, l.max = i.z, r[2].isSeparated(l)))
632
632
  return !1;
633
633
  for (let a = 0; a < 3; a++) {
634
- const l = n[a], E = o[a];
635
- if (c.setFromBox(l, t), E.isSeparated(c))
634
+ const c = n[a], E = o[a];
635
+ if (l.setFromBox(c, t), E.isSeparated(l))
636
636
  return !1;
637
637
  }
638
638
  return !0;
639
639
  };
640
640
  }();
641
641
  at.prototype.intersectsTriangle = function() {
642
- const c = new gt(), s = new Array(3), t = new Dt(), e = new Dt(), i = new M();
642
+ const l = new gt(), s = new Array(3), t = new Dt(), e = new Dt(), i = new M();
643
643
  return function(n) {
644
- this.needsUpdate && this.update(), n.isExtendedTriangle ? n.needsUpdate && n.update() : (c.copy(n), c.update(), n = c);
644
+ this.needsUpdate && this.update(), n.isExtendedTriangle ? n.needsUpdate && n.update() : (l.copy(n), l.update(), n = l);
645
645
  const r = this.satBounds, a = this.satAxes;
646
646
  s[0] = n.a, s[1] = n.b, s[2] = n.c;
647
647
  for (let h = 0; h < 3; h++) {
@@ -649,9 +649,9 @@ at.prototype.intersectsTriangle = function() {
649
649
  if (t.setFromPoints(p, s), u.isSeparated(t))
650
650
  return !1;
651
651
  }
652
- const l = n.satBounds, E = n.satAxes, d = this.points;
652
+ const c = n.satBounds, E = n.satAxes, d = this.points;
653
653
  for (let h = 0; h < 3; h++) {
654
- const u = l[h], p = E[h];
654
+ const u = c[h], p = E[h];
655
655
  if (t.setFromPoints(p, d), u.isSeparated(t))
656
656
  return !1;
657
657
  }
@@ -672,23 +672,23 @@ at.prototype.closestPointToPoint = /* @__PURE__ */ function() {
672
672
  };
673
673
  }();
674
674
  at.prototype.distanceToPoint = function() {
675
- const c = new M();
675
+ const l = new M();
676
676
  return function(t) {
677
- return this.closestPointToPoint(t, c), t.distanceTo(c);
677
+ return this.closestPointToPoint(t, l), t.distanceTo(l);
678
678
  };
679
679
  }();
680
680
  at.prototype.distanceToBox = function() {
681
- const c = ["x", "y", "z"], s = new Array(12).fill().map(() => new Lt()), t = new Array(12).fill().map(() => new Lt()), e = new M(), i = new M();
682
- return function(n, r = 0, a = null, l = null) {
681
+ const l = ["x", "y", "z"], s = new Array(12).fill().map(() => new Pt()), t = new Array(12).fill().map(() => new Pt()), e = new M(), i = new M();
682
+ return function(n, r = 0, a = null, c = null) {
683
683
  if (this.needsUpdate && this.update(), this.intersectsBox(n))
684
- return (a || l) && (n.getCenter(i), this.closestPointToPoint(i, e), n.closestPointToPoint(e, i), a && a.copy(e), l && l.copy(i)), 0;
684
+ return (a || c) && (n.getCenter(i), this.closestPointToPoint(i, e), n.closestPointToPoint(e, i), a && a.copy(e), c && c.copy(i)), 0;
685
685
  const E = r * r, d = n.min, h = n.max, u = this.points;
686
686
  let p = 1 / 0;
687
687
  for (let A = 0; A < 8; A++) {
688
688
  const C = u[A];
689
689
  i.copy(C).clamp(d, h);
690
690
  const T = C.distanceToSquared(i);
691
- if (T < p && (p = T, a && a.copy(C), l && l.copy(i), T < E))
691
+ if (T < p && (p = T, a && a.copy(C), c && c.copy(i), T < E))
692
692
  return Math.sqrt(T);
693
693
  }
694
694
  let R = 0;
@@ -697,15 +697,15 @@ at.prototype.distanceToBox = function() {
697
697
  for (let T = 0; T <= 1; T++) {
698
698
  const F = (A + 1) % 3, f = (A + 2) % 3, m = C << F | T << f, g = 1 << A | C << F | T << f, S = u[m], _ = u[g];
699
699
  s[R].set(S, _);
700
- const y = c[A], w = c[F], L = c[f], U = t[R], x = U.start, B = U.end;
701
- x[y] = d[y], x[w] = C ? d[w] : h[w], x[L] = T ? d[L] : h[w], B[y] = h[y], B[w] = C ? d[w] : h[w], B[L] = T ? d[L] : h[w], R++;
700
+ const L = l[A], w = l[F], P = l[f], U = t[R], x = U.start, B = U.end;
701
+ x[L] = d[L], x[w] = C ? d[w] : h[w], x[P] = T ? d[P] : h[w], B[L] = h[L], B[w] = C ? d[w] : h[w], B[P] = T ? d[P] : h[w], R++;
702
702
  }
703
703
  for (let A = 0; A <= 1; A++)
704
704
  for (let C = 0; C <= 1; C++)
705
705
  for (let T = 0; T <= 1; T++) {
706
706
  i.x = A ? h.x : d.x, i.y = C ? h.y : d.y, i.z = T ? h.z : d.z, this.closestPointToPoint(i, e);
707
707
  const F = i.distanceToSquared(e);
708
- if (F < p && (p = F, a && a.copy(e), l && l.copy(i), F < E))
708
+ if (F < p && (p = F, a && a.copy(e), c && c.copy(i), F < E))
709
709
  return Math.sqrt(F);
710
710
  }
711
711
  for (let A = 0; A < 12; A++) {
@@ -714,7 +714,7 @@ at.prototype.distanceToBox = function() {
714
714
  const F = t[T];
715
715
  Ci(C, F, e, i);
716
716
  const f = e.distanceToSquared(i);
717
- if (f < p && (p = f, a && a.copy(e), l && l.copy(i), f < E))
717
+ if (f < p && (p = f, a && a.copy(e), c && c.copy(i), f < E))
718
718
  return Math.sqrt(f);
719
719
  }
720
720
  }
@@ -739,23 +739,23 @@ class po extends Ti {
739
739
  }
740
740
  }
741
741
  const It = /* @__PURE__ */ new po();
742
- function ht(c, s) {
743
- return s[c + 15] === 65535;
742
+ function ht(l, s) {
743
+ return s[l + 15] === 65535;
744
744
  }
745
- function Et(c, s) {
746
- return s[c + 6];
745
+ function Et(l, s) {
746
+ return s[l + 6];
747
747
  }
748
- function ft(c, s) {
749
- return s[c + 14];
748
+ function ft(l, s) {
749
+ return s[l + 14];
750
750
  }
751
- function pt(c) {
752
- return c + 8;
751
+ function pt(l) {
752
+ return l + 8;
753
753
  }
754
- function Ct(c, s) {
755
- return s[c + 6];
754
+ function Ct(l, s) {
755
+ return s[l + 6];
756
756
  }
757
- function Nn(c, s) {
758
- return s[c + 7];
757
+ function Nn(l, s) {
758
+ return s[l + 7];
759
759
  }
760
760
  class Co {
761
761
  constructor() {
@@ -770,48 +770,48 @@ class Co {
770
770
  }
771
771
  }
772
772
  const Z = new Co();
773
- let Vt, Ie;
773
+ let Gt, Ie;
774
774
  const Jt = [], Ke = /* @__PURE__ */ new Ti(() => new Ot());
775
- function To(c, s, t, e, i, o) {
776
- Vt = Ke.getPrimitive(), Ie = Ke.getPrimitive(), Jt.push(Vt, Ie), Z.setBuffer(c._roots[s]);
777
- const n = si(0, c.geometry, t, e, i, o);
778
- Z.clearBuffer(), Ke.releasePrimitive(Vt), Ke.releasePrimitive(Ie), Jt.pop(), Jt.pop();
775
+ function To(l, s, t, e, i, o) {
776
+ Gt = Ke.getPrimitive(), Ie = Ke.getPrimitive(), Jt.push(Gt, Ie), Z.setBuffer(l._roots[s]);
777
+ const n = si(0, l.geometry, t, e, i, o);
778
+ Z.clearBuffer(), Ke.releasePrimitive(Gt), Ke.releasePrimitive(Ie), Jt.pop(), Jt.pop();
779
779
  const r = Jt.length;
780
- return r > 0 && (Ie = Jt[r - 1], Vt = Jt[r - 2]), n;
780
+ return r > 0 && (Ie = Jt[r - 1], Gt = Jt[r - 2]), n;
781
781
  }
782
- function si(c, s, t, e, i = null, o = 0, n = 0) {
783
- const { float32Array: r, uint16Array: a, uint32Array: l } = Z;
784
- let E = c * 2;
782
+ function si(l, s, t, e, i = null, o = 0, n = 0) {
783
+ const { float32Array: r, uint16Array: a, uint32Array: c } = Z;
784
+ let E = l * 2;
785
785
  if (ht(E, a)) {
786
- const h = Et(c, l), u = ft(E, a);
787
- return $(c, r, Vt), e(h, u, !1, n, o + c, Vt);
786
+ const h = Et(l, c), u = ft(E, a);
787
+ return $(l, r, Gt), e(h, u, !1, n, o + l, Gt);
788
788
  } else {
789
- let y = function(L) {
789
+ let L = function(P) {
790
790
  const { uint16Array: U, uint32Array: x } = Z;
791
- let B = L * 2;
791
+ let B = P * 2;
792
792
  for (; !ht(B, U); )
793
- L = pt(L), B = L * 2;
794
- return Et(L, x);
795
- }, w = function(L) {
793
+ P = pt(P), B = P * 2;
794
+ return Et(P, x);
795
+ }, w = function(P) {
796
796
  const { uint16Array: U, uint32Array: x } = Z;
797
- let B = L * 2;
797
+ let B = P * 2;
798
798
  for (; !ht(B, U); )
799
- L = Ct(L, x), B = L * 2;
800
- return Et(L, x) + ft(B, U);
799
+ P = Ct(P, x), B = P * 2;
800
+ return Et(P, x) + ft(B, U);
801
801
  };
802
- const h = pt(c), u = Ct(c, l);
802
+ const h = pt(l), u = Ct(l, c);
803
803
  let p = h, R = u, A, C, T, F;
804
- if (i && (T = Vt, F = Ie, $(p, r, T), $(R, r, F), A = i(T), C = i(F), C < A)) {
804
+ if (i && (T = Gt, F = Ie, $(p, r, T), $(R, r, F), A = i(T), C = i(F), C < A)) {
805
805
  p = u, R = h;
806
- const L = A;
807
- A = C, C = L, T = F;
806
+ const P = A;
807
+ A = C, C = P, T = F;
808
808
  }
809
- T || (T = Vt, $(p, r, T));
809
+ T || (T = Gt, $(p, r, T));
810
810
  const f = ht(p * 2, a), m = t(T, f, A, n + 1, o + p);
811
811
  let g;
812
- if (m === yi) {
813
- const L = y(p), x = w(p) - L;
814
- g = e(L, x, !0, n + 1, o + p, T);
812
+ if (m === Li) {
813
+ const P = L(p), x = w(p) - P;
814
+ g = e(P, x, !0, n + 1, o + p, T);
815
815
  } else
816
816
  g = m && si(
817
817
  p,
@@ -827,9 +827,9 @@ function si(c, s, t, e, i = null, o = 0, n = 0) {
827
827
  F = Ie, $(R, r, F);
828
828
  const S = ht(R * 2, a), _ = t(F, S, C, n + 1, o + R);
829
829
  let N;
830
- if (_ === yi) {
831
- const L = y(R), x = w(R) - L;
832
- N = e(L, x, !0, n + 1, o + R, F);
830
+ if (_ === Li) {
831
+ const P = L(R), x = w(R) - P;
832
+ N = e(P, x, !0, n + 1, o + R, F);
833
833
  } else
834
834
  N = _ && si(
835
835
  R,
@@ -844,10 +844,10 @@ function si(c, s, t, e, i = null, o = 0, n = 0) {
844
844
  }
845
845
  }
846
846
  const Ae = /* @__PURE__ */ new M(), Bs = /* @__PURE__ */ new M();
847
- function mo(c, s, t = {}, e = 0, i = 1 / 0) {
847
+ function mo(l, s, t = {}, e = 0, i = 1 / 0) {
848
848
  const o = e * e, n = i * i;
849
849
  let r = 1 / 0, a = null;
850
- if (c.shapecast(
850
+ if (l.shapecast(
851
851
  {
852
852
  boundsTraverseOrder: (E) => (Ae.copy(s).clamp(E.min, E.max), Ae.distanceToSquared(s)),
853
853
  intersectsBounds: (E, d, h) => h < r && h < n,
@@ -859,22 +859,22 @@ function mo(c, s, t = {}, e = 0, i = 1 / 0) {
859
859
  }
860
860
  ), r === 1 / 0)
861
861
  return null;
862
- const l = Math.sqrt(r);
863
- return t.point ? t.point.copy(Bs) : t.point = Bs.clone(), t.distance = l, t.faceIndex = a, t;
862
+ const c = Math.sqrt(r);
863
+ return t.point ? t.point.copy(Bs) : t.point = Bs.clone(), t.distance = c, t.faceIndex = a, t;
864
864
  }
865
865
  const te = /* @__PURE__ */ new M(), ee = /* @__PURE__ */ new M(), se = /* @__PURE__ */ new M(), Je = /* @__PURE__ */ new fe(), ts = /* @__PURE__ */ new fe(), es = /* @__PURE__ */ new fe(), Ui = /* @__PURE__ */ new M(), xi = /* @__PURE__ */ new M(), bi = /* @__PURE__ */ new M(), ss = /* @__PURE__ */ new M();
866
- function Ro(c, s, t, e, i, o) {
866
+ function Ro(l, s, t, e, i, o) {
867
867
  let n;
868
- return o === Vn ? n = c.intersectTriangle(e, t, s, !0, i) : n = c.intersectTriangle(s, t, e, o !== Fn, i), n === null ? null : {
869
- distance: c.origin.distanceTo(i),
868
+ return o === Gn ? n = l.intersectTriangle(e, t, s, !0, i) : n = l.intersectTriangle(s, t, e, o !== Fn, i), n === null ? null : {
869
+ distance: l.origin.distanceTo(i),
870
870
  point: i.clone()
871
871
  };
872
872
  }
873
- function Ao(c, s, t, e, i, o, n, r, a) {
873
+ function Ao(l, s, t, e, i, o, n, r, a) {
874
874
  te.fromBufferAttribute(s, o), ee.fromBufferAttribute(s, n), se.fromBufferAttribute(s, r);
875
- const l = Ro(c, te, ee, se, ss, a);
876
- if (l) {
877
- e && (Je.fromBufferAttribute(e, o), ts.fromBufferAttribute(e, n), es.fromBufferAttribute(e, r), l.uv = ue.getInterpolation(ss, te, ee, se, Je, ts, es, new fe())), i && (Je.fromBufferAttribute(i, o), ts.fromBufferAttribute(i, n), es.fromBufferAttribute(i, r), l.uv1 = ue.getInterpolation(ss, te, ee, se, Je, ts, es, new fe())), t && (Ui.fromBufferAttribute(t, o), xi.fromBufferAttribute(t, n), bi.fromBufferAttribute(t, r), l.normal = ue.getInterpolation(ss, te, ee, se, Ui, xi, bi, new M()), l.normal.dot(c.direction) > 0 && l.normal.multiplyScalar(-1));
875
+ const c = Ro(l, te, ee, se, ss, a);
876
+ if (c) {
877
+ e && (Je.fromBufferAttribute(e, o), ts.fromBufferAttribute(e, n), es.fromBufferAttribute(e, r), c.uv = ue.getInterpolation(ss, te, ee, se, Je, ts, es, new fe())), i && (Je.fromBufferAttribute(i, o), ts.fromBufferAttribute(i, n), es.fromBufferAttribute(i, r), c.uv1 = ue.getInterpolation(ss, te, ee, se, Je, ts, es, new fe())), t && (Ui.fromBufferAttribute(t, o), xi.fromBufferAttribute(t, n), bi.fromBufferAttribute(t, r), c.normal = ue.getInterpolation(ss, te, ee, se, Ui, xi, bi, new M()), c.normal.dot(l.direction) > 0 && c.normal.multiplyScalar(-1));
878
878
  const E = {
879
879
  a: o,
880
880
  b: n,
@@ -882,62 +882,62 @@ function Ao(c, s, t, e, i, o, n, r, a) {
882
882
  normal: new M(),
883
883
  materialIndex: 0
884
884
  };
885
- ue.getNormal(te, ee, se, E.normal), l.face = E, l.faceIndex = o;
885
+ ue.getNormal(te, ee, se, E.normal), c.face = E, c.faceIndex = o;
886
886
  }
887
- return l;
887
+ return c;
888
888
  }
889
- function Ls(c, s, t, e, i) {
889
+ function Ps(l, s, t, e, i) {
890
890
  const o = e * 3;
891
891
  let n = o + 0, r = o + 1, a = o + 2;
892
- const l = c.index;
893
- c.index && (n = l.getX(n), r = l.getX(r), a = l.getX(a));
894
- const { position: E, normal: d, uv: h, uv1: u } = c.attributes, p = Ao(t, E, d, h, u, n, r, a, s);
892
+ const c = l.index;
893
+ l.index && (n = c.getX(n), r = c.getX(r), a = c.getX(a));
894
+ const { position: E, normal: d, uv: h, uv1: u } = l.attributes, p = Ao(t, E, d, h, u, n, r, a, s);
895
895
  return p ? (p.faceIndex = e, i && i.push(p), p) : null;
896
896
  }
897
- function tt(c, s, t, e) {
898
- const i = c.a, o = c.b, n = c.c;
899
- let r = s, a = s + 1, l = s + 2;
900
- t && (r = t.getX(r), a = t.getX(a), l = t.getX(l)), i.x = e.getX(r), i.y = e.getY(r), i.z = e.getZ(r), o.x = e.getX(a), o.y = e.getY(a), o.z = e.getZ(a), n.x = e.getX(l), n.y = e.getY(l), n.z = e.getZ(l);
897
+ function tt(l, s, t, e) {
898
+ const i = l.a, o = l.b, n = l.c;
899
+ let r = s, a = s + 1, c = s + 2;
900
+ t && (r = t.getX(r), a = t.getX(a), c = t.getX(c)), i.x = e.getX(r), i.y = e.getY(r), i.z = e.getZ(r), o.x = e.getX(a), o.y = e.getY(a), o.z = e.getZ(a), n.x = e.getX(c), n.y = e.getY(c), n.z = e.getZ(c);
901
901
  }
902
- function Fo(c, s, t, e, i, o) {
903
- const { geometry: n, _indirectBuffer: r } = c;
904
- for (let a = e, l = e + i; a < l; a++)
905
- Ls(n, s, t, a, o);
902
+ function Fo(l, s, t, e, i, o) {
903
+ const { geometry: n, _indirectBuffer: r } = l;
904
+ for (let a = e, c = e + i; a < c; a++)
905
+ Ps(n, s, t, a, o);
906
906
  }
907
- function go(c, s, t, e, i) {
908
- const { geometry: o, _indirectBuffer: n } = c;
907
+ function go(l, s, t, e, i) {
908
+ const { geometry: o, _indirectBuffer: n } = l;
909
909
  let r = 1 / 0, a = null;
910
- for (let l = e, E = e + i; l < E; l++) {
910
+ for (let c = e, E = e + i; c < E; c++) {
911
911
  let d;
912
- d = Ls(o, s, t, l), d && d.distance < r && (a = d, r = d.distance);
912
+ d = Ps(o, s, t, c), d && d.distance < r && (a = d, r = d.distance);
913
913
  }
914
914
  return a;
915
915
  }
916
- function Oo(c, s, t, e, i, o, n) {
917
- const { geometry: r } = t, { index: a } = r, l = r.attributes.position;
918
- for (let E = c, d = s + c; E < d; E++) {
916
+ function Oo(l, s, t, e, i, o, n) {
917
+ const { geometry: r } = t, { index: a } = r, c = r.attributes.position;
918
+ for (let E = l, d = s + l; E < d; E++) {
919
919
  let h;
920
- if (h = E, tt(n, h * 3, a, l), n.needsUpdate = !0, e(n, h, i, o))
920
+ if (h = E, tt(n, h * 3, a, c), n.needsUpdate = !0, e(n, h, i, o))
921
921
  return !0;
922
922
  }
923
923
  return !1;
924
924
  }
925
- function So(c, s = null) {
925
+ function So(l, s = null) {
926
926
  s && Array.isArray(s) && (s = new Set(s));
927
- const t = c.geometry, e = t.index ? t.index.array : null, i = t.attributes.position;
928
- let o, n, r, a, l = 0;
929
- const E = c._roots;
927
+ const t = l.geometry, e = t.index ? t.index.array : null, i = t.attributes.position;
928
+ let o, n, r, a, c = 0;
929
+ const E = l._roots;
930
930
  for (let h = 0, u = E.length; h < u; h++)
931
- o = E[h], n = new Uint32Array(o), r = new Uint16Array(o), a = new Float32Array(o), d(0, l), l += o.byteLength;
931
+ o = E[h], n = new Uint32Array(o), r = new Uint16Array(o), a = new Float32Array(o), d(0, c), c += o.byteLength;
932
932
  function d(h, u, p = !1) {
933
933
  const R = h * 2;
934
- if (r[R + 15] === ys) {
934
+ if (r[R + 15] === Ls) {
935
935
  const C = n[h + 6], T = r[R + 14];
936
936
  let F = 1 / 0, f = 1 / 0, m = 1 / 0, g = -1 / 0, S = -1 / 0, _ = -1 / 0;
937
- for (let N = 3 * C, y = 3 * (C + T); N < y; N++) {
937
+ for (let N = 3 * C, L = 3 * (C + T); N < L; N++) {
938
938
  let w = e[N];
939
- const L = i.getX(w), U = i.getY(w), x = i.getZ(w);
940
- L < F && (F = L), L > g && (g = L), U < f && (f = U), U > S && (S = U), x < m && (m = x), x > _ && (_ = x);
939
+ const P = i.getX(w), U = i.getY(w), x = i.getZ(w);
940
+ P < F && (F = P), P > g && (g = P), U < f && (f = U), U > S && (S = U), x < m && (m = x), x > _ && (_ = x);
941
941
  }
942
942
  return a[h + 0] !== F || a[h + 1] !== f || a[h + 2] !== m || a[h + 3] !== g || a[h + 4] !== S || a[h + 5] !== _ ? (a[h + 0] = F, a[h + 1] = f, a[h + 2] = m, a[h + 3] = g, a[h + 4] = S, a[h + 5] = _, !0) : !1;
943
943
  } else {
@@ -945,107 +945,107 @@ function So(c, s = null) {
945
945
  let m = p, g = !1, S = !1;
946
946
  s ? m || (g = s.has(F), S = s.has(f), m = !g && !S) : (g = !0, S = !0);
947
947
  const _ = m || g, N = m || S;
948
- let y = !1;
949
- _ && (y = d(C, u, m));
948
+ let L = !1;
949
+ _ && (L = d(C, u, m));
950
950
  let w = !1;
951
951
  N && (w = d(T, u, m));
952
- const L = y || w;
953
- if (L)
952
+ const P = L || w;
953
+ if (P)
954
954
  for (let U = 0; U < 3; U++) {
955
955
  const x = C + U, B = T + U, H = a[x], q = a[x + 3], et = a[B], Q = a[B + 3];
956
956
  a[h + U] = H < et ? H : et, a[h + U + 3] = q > Q ? q : Q;
957
957
  }
958
- return L;
958
+ return P;
959
959
  }
960
960
  }
961
961
  }
962
962
  const vi = /* @__PURE__ */ new Ot();
963
- function Gt(c, s, t, e) {
964
- return $(c, s, vi), t.intersectBox(vi, e);
963
+ function Vt(l, s, t, e) {
964
+ return $(l, s, vi), t.intersectBox(vi, e);
965
965
  }
966
- function _o(c, s, t, e, i, o) {
967
- const { geometry: n, _indirectBuffer: r } = c;
968
- for (let a = e, l = e + i; a < l; a++) {
966
+ function _o(l, s, t, e, i, o) {
967
+ const { geometry: n, _indirectBuffer: r } = l;
968
+ for (let a = e, c = e + i; a < c; a++) {
969
969
  let E = r ? r[a] : a;
970
- Ls(n, s, t, E, o);
970
+ Ps(n, s, t, E, o);
971
971
  }
972
972
  }
973
- function No(c, s, t, e, i) {
974
- const { geometry: o, _indirectBuffer: n } = c;
973
+ function No(l, s, t, e, i) {
974
+ const { geometry: o, _indirectBuffer: n } = l;
975
975
  let r = 1 / 0, a = null;
976
- for (let l = e, E = e + i; l < E; l++) {
976
+ for (let c = e, E = e + i; c < E; c++) {
977
977
  let d;
978
- d = Ls(o, s, t, n ? n[l] : l), d && d.distance < r && (a = d, r = d.distance);
978
+ d = Ps(o, s, t, n ? n[c] : c), d && d.distance < r && (a = d, r = d.distance);
979
979
  }
980
980
  return a;
981
981
  }
982
- function Po(c, s, t, e, i, o, n) {
983
- const { geometry: r } = t, { index: a } = r, l = r.attributes.position;
984
- for (let E = c, d = s + c; E < d; E++) {
982
+ function yo(l, s, t, e, i, o, n) {
983
+ const { geometry: r } = t, { index: a } = r, c = r.attributes.position;
984
+ for (let E = l, d = s + l; E < d; E++) {
985
985
  let h;
986
- if (h = t.resolveTriangleIndex(E), tt(n, h * 3, a, l), n.needsUpdate = !0, e(n, h, i, o))
986
+ if (h = t.resolveTriangleIndex(E), tt(n, h * 3, a, c), n.needsUpdate = !0, e(n, h, i, o))
987
987
  return !0;
988
988
  }
989
989
  return !1;
990
990
  }
991
991
  const Bi = /* @__PURE__ */ new M();
992
- function yo(c, s, t, e, i) {
993
- Z.setBuffer(c._roots[s]), ii(0, c, t, e, i), Z.clearBuffer();
992
+ function Lo(l, s, t, e, i) {
993
+ Z.setBuffer(l._roots[s]), ii(0, l, t, e, i), Z.clearBuffer();
994
994
  }
995
- function ii(c, s, t, e, i) {
996
- const { float32Array: o, uint16Array: n, uint32Array: r } = Z, a = c * 2;
995
+ function ii(l, s, t, e, i) {
996
+ const { float32Array: o, uint16Array: n, uint32Array: r } = Z, a = l * 2;
997
997
  if (ht(a, n)) {
998
- const E = Et(c, r), d = ft(a, n);
998
+ const E = Et(l, r), d = ft(a, n);
999
999
  Fo(s, t, e, E, d, i);
1000
1000
  } else {
1001
- const E = pt(c);
1002
- Gt(E, o, e, Bi) && ii(E, s, t, e, i);
1003
- const d = Ct(c, r);
1004
- Gt(d, o, e, Bi) && ii(d, s, t, e, i);
1001
+ const E = pt(l);
1002
+ Vt(E, o, e, Bi) && ii(E, s, t, e, i);
1003
+ const d = Ct(l, r);
1004
+ Vt(d, o, e, Bi) && ii(d, s, t, e, i);
1005
1005
  }
1006
1006
  }
1007
- const Yi = /* @__PURE__ */ new M(), Lo = ["x", "y", "z"];
1008
- function Mo(c, s, t, e) {
1009
- Z.setBuffer(c._roots[s]);
1010
- const i = ni(0, c, t, e);
1007
+ const Yi = /* @__PURE__ */ new M(), Po = ["x", "y", "z"];
1008
+ function Mo(l, s, t, e) {
1009
+ Z.setBuffer(l._roots[s]);
1010
+ const i = ni(0, l, t, e);
1011
1011
  return Z.clearBuffer(), i;
1012
1012
  }
1013
- function ni(c, s, t, e) {
1013
+ function ni(l, s, t, e) {
1014
1014
  const { float32Array: i, uint16Array: o, uint32Array: n } = Z;
1015
- let r = c * 2;
1015
+ let r = l * 2;
1016
1016
  if (ht(r, o)) {
1017
- const l = Et(c, n), E = ft(r, o);
1018
- return go(s, t, e, l, E);
1017
+ const c = Et(l, n), E = ft(r, o);
1018
+ return go(s, t, e, c, E);
1019
1019
  } else {
1020
- const l = Nn(c, n), E = Lo[l], h = e.direction[E] >= 0;
1020
+ const c = Nn(l, n), E = Po[c], h = e.direction[E] >= 0;
1021
1021
  let u, p;
1022
- h ? (u = pt(c), p = Ct(c, n)) : (u = Ct(c, n), p = pt(c));
1023
- const A = Gt(u, i, e, Yi) ? ni(u, s, t, e) : null;
1022
+ h ? (u = pt(l), p = Ct(l, n)) : (u = Ct(l, n), p = pt(l));
1023
+ const A = Vt(u, i, e, Yi) ? ni(u, s, t, e) : null;
1024
1024
  if (A) {
1025
1025
  const F = A.point[E];
1026
- if (h ? F <= i[p + l] : (
1026
+ if (h ? F <= i[p + c] : (
1027
1027
  // min bounding data
1028
- F >= i[p + l + 3]
1028
+ F >= i[p + c + 3]
1029
1029
  ))
1030
1030
  return A;
1031
1031
  }
1032
- const T = Gt(p, i, e, Yi) ? ni(p, s, t, e) : null;
1032
+ const T = Vt(p, i, e, Yi) ? ni(p, s, t, e) : null;
1033
1033
  return A && T ? A.distance <= T.distance ? A : T : A || T || null;
1034
1034
  }
1035
1035
  }
1036
- const is = /* @__PURE__ */ new Ot(), ie = /* @__PURE__ */ new gt(), ne = /* @__PURE__ */ new gt(), Fe = /* @__PURE__ */ new Mt(), Vi = /* @__PURE__ */ new at(), ns = /* @__PURE__ */ new at();
1037
- function wo(c, s, t, e) {
1038
- Z.setBuffer(c._roots[s]);
1039
- const i = oi(0, c, t, e);
1036
+ const is = /* @__PURE__ */ new Ot(), ie = /* @__PURE__ */ new gt(), ne = /* @__PURE__ */ new gt(), Fe = /* @__PURE__ */ new Mt(), Gi = /* @__PURE__ */ new at(), ns = /* @__PURE__ */ new at();
1037
+ function wo(l, s, t, e) {
1038
+ Z.setBuffer(l._roots[s]);
1039
+ const i = oi(0, l, t, e);
1040
1040
  return Z.clearBuffer(), i;
1041
1041
  }
1042
- function oi(c, s, t, e, i = null) {
1042
+ function oi(l, s, t, e, i = null) {
1043
1043
  const { float32Array: o, uint16Array: n, uint32Array: r } = Z;
1044
- let a = c * 2;
1045
- if (i === null && (t.boundingBox || t.computeBoundingBox(), Vi.set(t.boundingBox.min, t.boundingBox.max, e), i = Vi), ht(a, n)) {
1046
- const E = s.geometry, d = E.index, h = E.attributes.position, u = t.index, p = t.attributes.position, R = Et(c, r), A = ft(a, n);
1044
+ let a = l * 2;
1045
+ if (i === null && (t.boundingBox || t.computeBoundingBox(), Gi.set(t.boundingBox.min, t.boundingBox.max, e), i = Gi), ht(a, n)) {
1046
+ const E = s.geometry, d = E.index, h = E.attributes.position, u = t.index, p = t.attributes.position, R = Et(l, r), A = ft(a, n);
1047
1047
  if (Fe.copy(e).invert(), t.boundsTree)
1048
- return $(c, o, ns), ns.matrix.copy(Fe), ns.needsUpdate = !0, t.boundsTree.shapecast({
1048
+ return $(l, o, ns), ns.matrix.copy(Fe), ns.needsUpdate = !0, t.boundsTree.shapecast({
1049
1049
  intersectsBounds: (T) => ns.intersectsBox(T),
1050
1050
  intersectsTriangle: (T) => {
1051
1051
  T.a.applyMatrix4(e), T.b.applyMatrix4(e), T.c.applyMatrix4(e), T.needsUpdate = !0;
@@ -1062,18 +1062,18 @@ function oi(c, s, t, e, i = null) {
1062
1062
  return !0;
1063
1063
  }
1064
1064
  } else {
1065
- const E = c + 8, d = r[c + 6];
1065
+ const E = l + 8, d = r[l + 6];
1066
1066
  return $(E, o, is), !!(i.intersectsBox(is) && oi(E, s, t, e, i) || ($(d, o, is), i.intersectsBox(is) && oi(d, s, t, e, i)));
1067
1067
  }
1068
1068
  }
1069
1069
  const os = /* @__PURE__ */ new Mt(), Ys = /* @__PURE__ */ new at(), ge = /* @__PURE__ */ new at(), Do = /* @__PURE__ */ new M(), Uo = /* @__PURE__ */ new M(), xo = /* @__PURE__ */ new M(), bo = /* @__PURE__ */ new M();
1070
- function vo(c, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
1070
+ function vo(l, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
1071
1071
  s.boundingBox || s.computeBoundingBox(), Ys.set(s.boundingBox.min, s.boundingBox.max, t), Ys.needsUpdate = !0;
1072
- const r = c.geometry, a = r.attributes.position, l = r.index, E = s.attributes.position, d = s.index, h = It.getPrimitive(), u = It.getPrimitive();
1072
+ const r = l.geometry, a = r.attributes.position, c = r.index, E = s.attributes.position, d = s.index, h = It.getPrimitive(), u = It.getPrimitive();
1073
1073
  let p = Do, R = Uo, A = null, C = null;
1074
1074
  i && (A = xo, C = bo);
1075
1075
  let T = 1 / 0, F = null, f = null;
1076
- return os.copy(t).invert(), ge.matrix.copy(os), c.shapecast(
1076
+ return os.copy(t).invert(), ge.matrix.copy(os), l.shapecast(
1077
1077
  {
1078
1078
  boundsTraverseOrder: (m) => Ys.distanceToBox(m),
1079
1079
  intersectsBounds: (m, g, S) => S < T && S < n ? (g && (ge.min.copy(m.min), ge.max.copy(m.max), ge.needsUpdate = !0), !0) : !1,
@@ -1081,14 +1081,14 @@ function vo(c, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
1081
1081
  if (s.boundsTree)
1082
1082
  return s.boundsTree.shapecast({
1083
1083
  boundsTraverseOrder: (_) => ge.distanceToBox(_),
1084
- intersectsBounds: (_, N, y) => y < T && y < n,
1084
+ intersectsBounds: (_, N, L) => L < T && L < n,
1085
1085
  intersectsRange: (_, N) => {
1086
- for (let y = _, w = _ + N; y < w; y++) {
1087
- tt(u, 3 * y, d, E), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
1088
- for (let L = m, U = m + g; L < U; L++) {
1089
- tt(h, 3 * L, l, a), h.needsUpdate = !0;
1086
+ for (let L = _, w = _ + N; L < w; L++) {
1087
+ tt(u, 3 * L, d, E), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
1088
+ for (let P = m, U = m + g; P < U; P++) {
1089
+ tt(h, 3 * P, c, a), h.needsUpdate = !0;
1090
1090
  const x = h.distanceToTriangle(u, p, A);
1091
- if (x < T && (R.copy(p), C && C.copy(A), T = x, F = L, f = y), x < o)
1091
+ if (x < T && (R.copy(p), C && C.copy(A), T = x, F = P, f = L), x < o)
1092
1092
  return !0;
1093
1093
  }
1094
1094
  }
@@ -1098,10 +1098,10 @@ function vo(c, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
1098
1098
  const S = pe(s);
1099
1099
  for (let _ = 0, N = S; _ < N; _++) {
1100
1100
  tt(u, 3 * _, d, E), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
1101
- for (let y = m, w = m + g; y < w; y++) {
1102
- tt(h, 3 * y, l, a), h.needsUpdate = !0;
1103
- const L = h.distanceToTriangle(u, p, A);
1104
- if (L < T && (R.copy(p), C && C.copy(A), T = L, F = y, f = _), L < o)
1101
+ for (let L = m, w = m + g; L < w; L++) {
1102
+ tt(h, 3 * L, c, a), h.needsUpdate = !0;
1103
+ const P = h.distanceToTriangle(u, p, A);
1104
+ if (P < T && (R.copy(p), C && C.copy(A), T = P, F = L, f = _), P < o)
1105
1105
  return !0;
1106
1106
  }
1107
1107
  }
@@ -1110,22 +1110,22 @@ function vo(c, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
1110
1110
  }
1111
1111
  ), It.releasePrimitive(h), It.releasePrimitive(u), T === 1 / 0 ? null : (e.point ? e.point.copy(R) : e.point = R.clone(), e.distance = T, e.faceIndex = F, i && (i.point ? i.point.copy(C) : i.point = C.clone(), i.point.applyMatrix4(os), R.applyMatrix4(os), i.distance = R.sub(i.point).length(), i.faceIndex = f), e);
1112
1112
  }
1113
- function Bo(c, s = null) {
1113
+ function Bo(l, s = null) {
1114
1114
  s && Array.isArray(s) && (s = new Set(s));
1115
- const t = c.geometry, e = t.index ? t.index.array : null, i = t.attributes.position;
1116
- let o, n, r, a, l = 0;
1117
- const E = c._roots;
1115
+ const t = l.geometry, e = t.index ? t.index.array : null, i = t.attributes.position;
1116
+ let o, n, r, a, c = 0;
1117
+ const E = l._roots;
1118
1118
  for (let h = 0, u = E.length; h < u; h++)
1119
- o = E[h], n = new Uint32Array(o), r = new Uint16Array(o), a = new Float32Array(o), d(0, l), l += o.byteLength;
1119
+ o = E[h], n = new Uint32Array(o), r = new Uint16Array(o), a = new Float32Array(o), d(0, c), c += o.byteLength;
1120
1120
  function d(h, u, p = !1) {
1121
1121
  const R = h * 2;
1122
- if (r[R + 15] === ys) {
1122
+ if (r[R + 15] === Ls) {
1123
1123
  const C = n[h + 6], T = r[R + 14];
1124
1124
  let F = 1 / 0, f = 1 / 0, m = 1 / 0, g = -1 / 0, S = -1 / 0, _ = -1 / 0;
1125
- for (let N = C, y = C + T; N < y; N++) {
1126
- const w = 3 * c.resolveTriangleIndex(N);
1127
- for (let L = 0; L < 3; L++) {
1128
- let U = w + L;
1125
+ for (let N = C, L = C + T; N < L; N++) {
1126
+ const w = 3 * l.resolveTriangleIndex(N);
1127
+ for (let P = 0; P < 3; P++) {
1128
+ let U = w + P;
1129
1129
  U = e ? e[U] : U;
1130
1130
  const x = i.getX(U), B = i.getY(U), H = i.getZ(U);
1131
1131
  x < F && (F = x), x > g && (g = x), B < f && (f = B), B > S && (S = B), H < m && (m = H), H > _ && (_ = H);
@@ -1137,78 +1137,78 @@ function Bo(c, s = null) {
1137
1137
  let m = p, g = !1, S = !1;
1138
1138
  s ? m || (g = s.has(F), S = s.has(f), m = !g && !S) : (g = !0, S = !0);
1139
1139
  const _ = m || g, N = m || S;
1140
- let y = !1;
1141
- _ && (y = d(C, u, m));
1140
+ let L = !1;
1141
+ _ && (L = d(C, u, m));
1142
1142
  let w = !1;
1143
1143
  N && (w = d(T, u, m));
1144
- const L = y || w;
1145
- if (L)
1144
+ const P = L || w;
1145
+ if (P)
1146
1146
  for (let U = 0; U < 3; U++) {
1147
1147
  const x = C + U, B = T + U, H = a[x], q = a[x + 3], et = a[B], Q = a[B + 3];
1148
1148
  a[h + U] = H < et ? H : et, a[h + U + 3] = q > Q ? q : Q;
1149
1149
  }
1150
- return L;
1150
+ return P;
1151
1151
  }
1152
1152
  }
1153
1153
  }
1154
- const Gi = /* @__PURE__ */ new M();
1155
- function Yo(c, s, t, e, i) {
1156
- Z.setBuffer(c._roots[s]), ri(0, c, t, e, i), Z.clearBuffer();
1154
+ const Vi = /* @__PURE__ */ new M();
1155
+ function Yo(l, s, t, e, i) {
1156
+ Z.setBuffer(l._roots[s]), ri(0, l, t, e, i), Z.clearBuffer();
1157
1157
  }
1158
- function ri(c, s, t, e, i) {
1159
- const { float32Array: o, uint16Array: n, uint32Array: r } = Z, a = c * 2;
1158
+ function ri(l, s, t, e, i) {
1159
+ const { float32Array: o, uint16Array: n, uint32Array: r } = Z, a = l * 2;
1160
1160
  if (ht(a, n)) {
1161
- const E = Et(c, r), d = ft(a, n);
1161
+ const E = Et(l, r), d = ft(a, n);
1162
1162
  _o(s, t, e, E, d, i);
1163
1163
  } else {
1164
- const E = pt(c);
1165
- Gt(E, o, e, Gi) && ri(E, s, t, e, i);
1166
- const d = Ct(c, r);
1167
- Gt(d, o, e, Gi) && ri(d, s, t, e, i);
1164
+ const E = pt(l);
1165
+ Vt(E, o, e, Vi) && ri(E, s, t, e, i);
1166
+ const d = Ct(l, r);
1167
+ Vt(d, o, e, Vi) && ri(d, s, t, e, i);
1168
1168
  }
1169
1169
  }
1170
- const zi = /* @__PURE__ */ new M(), Vo = ["x", "y", "z"];
1171
- function Go(c, s, t, e) {
1172
- Z.setBuffer(c._roots[s]);
1173
- const i = ai(0, c, t, e);
1170
+ const zi = /* @__PURE__ */ new M(), Go = ["x", "y", "z"];
1171
+ function Vo(l, s, t, e) {
1172
+ Z.setBuffer(l._roots[s]);
1173
+ const i = ai(0, l, t, e);
1174
1174
  return Z.clearBuffer(), i;
1175
1175
  }
1176
- function ai(c, s, t, e) {
1176
+ function ai(l, s, t, e) {
1177
1177
  const { float32Array: i, uint16Array: o, uint32Array: n } = Z;
1178
- let r = c * 2;
1178
+ let r = l * 2;
1179
1179
  if (ht(r, o)) {
1180
- const l = Et(c, n), E = ft(r, o);
1181
- return No(s, t, e, l, E);
1180
+ const c = Et(l, n), E = ft(r, o);
1181
+ return No(s, t, e, c, E);
1182
1182
  } else {
1183
- const l = Nn(c, n), E = Vo[l], h = e.direction[E] >= 0;
1183
+ const c = Nn(l, n), E = Go[c], h = e.direction[E] >= 0;
1184
1184
  let u, p;
1185
- h ? (u = pt(c), p = Ct(c, n)) : (u = Ct(c, n), p = pt(c));
1186
- const A = Gt(u, i, e, zi) ? ai(u, s, t, e) : null;
1185
+ h ? (u = pt(l), p = Ct(l, n)) : (u = Ct(l, n), p = pt(l));
1186
+ const A = Vt(u, i, e, zi) ? ai(u, s, t, e) : null;
1187
1187
  if (A) {
1188
1188
  const F = A.point[E];
1189
- if (h ? F <= i[p + l] : (
1189
+ if (h ? F <= i[p + c] : (
1190
1190
  // min bounding data
1191
- F >= i[p + l + 3]
1191
+ F >= i[p + c + 3]
1192
1192
  ))
1193
1193
  return A;
1194
1194
  }
1195
- const T = Gt(p, i, e, zi) ? ai(p, s, t, e) : null;
1195
+ const T = Vt(p, i, e, zi) ? ai(p, s, t, e) : null;
1196
1196
  return A && T ? A.distance <= T.distance ? A : T : A || T || null;
1197
1197
  }
1198
1198
  }
1199
1199
  const rs = /* @__PURE__ */ new Ot(), oe = /* @__PURE__ */ new gt(), re = /* @__PURE__ */ new gt(), Oe = /* @__PURE__ */ new Mt(), Hi = /* @__PURE__ */ new at(), as = /* @__PURE__ */ new at();
1200
- function zo(c, s, t, e) {
1201
- Z.setBuffer(c._roots[s]);
1202
- const i = ci(0, c, t, e);
1200
+ function zo(l, s, t, e) {
1201
+ Z.setBuffer(l._roots[s]);
1202
+ const i = ci(0, l, t, e);
1203
1203
  return Z.clearBuffer(), i;
1204
1204
  }
1205
- function ci(c, s, t, e, i = null) {
1205
+ function ci(l, s, t, e, i = null) {
1206
1206
  const { float32Array: o, uint16Array: n, uint32Array: r } = Z;
1207
- let a = c * 2;
1207
+ let a = l * 2;
1208
1208
  if (i === null && (t.boundingBox || t.computeBoundingBox(), Hi.set(t.boundingBox.min, t.boundingBox.max, e), i = Hi), ht(a, n)) {
1209
- const E = s.geometry, d = E.index, h = E.attributes.position, u = t.index, p = t.attributes.position, R = Et(c, r), A = ft(a, n);
1209
+ const E = s.geometry, d = E.index, h = E.attributes.position, u = t.index, p = t.attributes.position, R = Et(l, r), A = ft(a, n);
1210
1210
  if (Oe.copy(e).invert(), t.boundsTree)
1211
- return $(c, o, as), as.matrix.copy(Oe), as.needsUpdate = !0, t.boundsTree.shapecast({
1211
+ return $(l, o, as), as.matrix.copy(Oe), as.needsUpdate = !0, t.boundsTree.shapecast({
1212
1212
  intersectsBounds: (T) => as.intersectsBox(T),
1213
1213
  intersectsTriangle: (T) => {
1214
1214
  T.a.applyMatrix4(e), T.b.applyMatrix4(e), T.c.applyMatrix4(e), T.needsUpdate = !0;
@@ -1226,36 +1226,36 @@ function ci(c, s, t, e, i = null) {
1226
1226
  return !0;
1227
1227
  }
1228
1228
  } else {
1229
- const E = c + 8, d = r[c + 6];
1229
+ const E = l + 8, d = r[l + 6];
1230
1230
  return $(E, o, rs), !!(i.intersectsBox(rs) && ci(E, s, t, e, i) || ($(d, o, rs), i.intersectsBox(rs) && ci(d, s, t, e, i)));
1231
1231
  }
1232
1232
  }
1233
- const cs = /* @__PURE__ */ new Mt(), Vs = /* @__PURE__ */ new at(), Se = /* @__PURE__ */ new at(), Ho = /* @__PURE__ */ new M(), ko = /* @__PURE__ */ new M(), Wo = /* @__PURE__ */ new M(), Xo = /* @__PURE__ */ new M();
1234
- function Zo(c, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
1235
- s.boundingBox || s.computeBoundingBox(), Vs.set(s.boundingBox.min, s.boundingBox.max, t), Vs.needsUpdate = !0;
1236
- const r = c.geometry, a = r.attributes.position, l = r.index, E = s.attributes.position, d = s.index, h = It.getPrimitive(), u = It.getPrimitive();
1233
+ const cs = /* @__PURE__ */ new Mt(), Gs = /* @__PURE__ */ new at(), Se = /* @__PURE__ */ new at(), Ho = /* @__PURE__ */ new M(), ko = /* @__PURE__ */ new M(), Wo = /* @__PURE__ */ new M(), Xo = /* @__PURE__ */ new M();
1234
+ function Zo(l, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
1235
+ s.boundingBox || s.computeBoundingBox(), Gs.set(s.boundingBox.min, s.boundingBox.max, t), Gs.needsUpdate = !0;
1236
+ const r = l.geometry, a = r.attributes.position, c = r.index, E = s.attributes.position, d = s.index, h = It.getPrimitive(), u = It.getPrimitive();
1237
1237
  let p = Ho, R = ko, A = null, C = null;
1238
1238
  i && (A = Wo, C = Xo);
1239
1239
  let T = 1 / 0, F = null, f = null;
1240
- return cs.copy(t).invert(), Se.matrix.copy(cs), c.shapecast(
1240
+ return cs.copy(t).invert(), Se.matrix.copy(cs), l.shapecast(
1241
1241
  {
1242
- boundsTraverseOrder: (m) => Vs.distanceToBox(m),
1242
+ boundsTraverseOrder: (m) => Gs.distanceToBox(m),
1243
1243
  intersectsBounds: (m, g, S) => S < T && S < n ? (g && (Se.min.copy(m.min), Se.max.copy(m.max), Se.needsUpdate = !0), !0) : !1,
1244
1244
  intersectsRange: (m, g) => {
1245
1245
  if (s.boundsTree) {
1246
1246
  const S = s.boundsTree;
1247
1247
  return S.shapecast({
1248
1248
  boundsTraverseOrder: (_) => Se.distanceToBox(_),
1249
- intersectsBounds: (_, N, y) => y < T && y < n,
1249
+ intersectsBounds: (_, N, L) => L < T && L < n,
1250
1250
  intersectsRange: (_, N) => {
1251
- for (let y = _, w = _ + N; y < w; y++) {
1252
- const L = S.resolveTriangleIndex(y);
1253
- tt(u, 3 * L, d, E), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
1251
+ for (let L = _, w = _ + N; L < w; L++) {
1252
+ const P = S.resolveTriangleIndex(L);
1253
+ tt(u, 3 * P, d, E), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
1254
1254
  for (let U = m, x = m + g; U < x; U++) {
1255
- const B = c.resolveTriangleIndex(U);
1256
- tt(h, 3 * B, l, a), h.needsUpdate = !0;
1255
+ const B = l.resolveTriangleIndex(U);
1256
+ tt(h, 3 * B, c, a), h.needsUpdate = !0;
1257
1257
  const H = h.distanceToTriangle(u, p, A);
1258
- if (H < T && (R.copy(p), C && C.copy(A), T = H, F = U, f = y), H < o)
1258
+ if (H < T && (R.copy(p), C && C.copy(A), T = H, F = U, f = L), H < o)
1259
1259
  return !0;
1260
1260
  }
1261
1261
  }
@@ -1265,11 +1265,11 @@ function Zo(c, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
1265
1265
  const S = pe(s);
1266
1266
  for (let _ = 0, N = S; _ < N; _++) {
1267
1267
  tt(u, 3 * _, d, E), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
1268
- for (let y = m, w = m + g; y < w; y++) {
1269
- const L = c.resolveTriangleIndex(y);
1270
- tt(h, 3 * L, l, a), h.needsUpdate = !0;
1268
+ for (let L = m, w = m + g; L < w; L++) {
1269
+ const P = l.resolveTriangleIndex(L);
1270
+ tt(h, 3 * P, c, a), h.needsUpdate = !0;
1271
1271
  const U = h.distanceToTriangle(u, p, A);
1272
- if (U < T && (R.copy(p), C && C.copy(A), T = U, F = y, f = _), U < o)
1272
+ if (U < T && (R.copy(p), C && C.copy(A), T = U, F = L, f = _), U < o)
1273
1273
  return !0;
1274
1274
  }
1275
1275
  }
@@ -1281,24 +1281,24 @@ function Zo(c, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
1281
1281
  function Qo() {
1282
1282
  return typeof SharedArrayBuffer < "u";
1283
1283
  }
1284
- const xe = new Z.constructor(), As = new Z.constructor(), Bt = new Ti(() => new Ot()), ae = new Ot(), ce = new Ot(), Gs = new Ot(), zs = new Ot();
1284
+ const xe = new Z.constructor(), As = new Z.constructor(), Bt = new Ti(() => new Ot()), ae = new Ot(), ce = new Ot(), Vs = new Ot(), zs = new Ot();
1285
1285
  let Hs = !1;
1286
- function jo(c, s, t, e) {
1286
+ function jo(l, s, t, e) {
1287
1287
  if (Hs)
1288
1288
  throw new Error("MeshBVH: Recursive calls to bvhcast not supported.");
1289
1289
  Hs = !0;
1290
- const i = c._roots, o = s._roots;
1290
+ const i = l._roots, o = s._roots;
1291
1291
  let n, r = 0, a = 0;
1292
- const l = new Mt().copy(t).invert();
1292
+ const c = new Mt().copy(t).invert();
1293
1293
  for (let E = 0, d = i.length; E < d; E++) {
1294
1294
  xe.setBuffer(i[E]), a = 0;
1295
1295
  const h = Bt.getPrimitive();
1296
- $(0, xe.float32Array, h), h.applyMatrix4(l);
1296
+ $(0, xe.float32Array, h), h.applyMatrix4(c);
1297
1297
  for (let u = 0, p = o.length; u < p && (As.setBuffer(o[E]), n = Tt(
1298
1298
  0,
1299
1299
  0,
1300
1300
  t,
1301
- l,
1301
+ c,
1302
1302
  e,
1303
1303
  r,
1304
1304
  a,
@@ -1312,37 +1312,37 @@ function jo(c, s, t, e) {
1312
1312
  }
1313
1313
  return Hs = !1, n;
1314
1314
  }
1315
- function Tt(c, s, t, e, i, o = 0, n = 0, r = 0, a = 0, l = null, E = !1) {
1315
+ function Tt(l, s, t, e, i, o = 0, n = 0, r = 0, a = 0, c = null, E = !1) {
1316
1316
  let d, h;
1317
1317
  E ? (d = As, h = xe) : (d = xe, h = As);
1318
- const u = d.float32Array, p = d.uint32Array, R = d.uint16Array, A = h.float32Array, C = h.uint32Array, T = h.uint16Array, F = c * 2, f = s * 2, m = ht(F, R), g = ht(f, T);
1318
+ const u = d.float32Array, p = d.uint32Array, R = d.uint16Array, A = h.float32Array, C = h.uint32Array, T = h.uint16Array, F = l * 2, f = s * 2, m = ht(F, R), g = ht(f, T);
1319
1319
  let S = !1;
1320
1320
  if (g && m)
1321
1321
  E ? S = i(
1322
1322
  Et(s, C),
1323
1323
  ft(s * 2, T),
1324
- Et(c, p),
1325
- ft(c * 2, R),
1324
+ Et(l, p),
1325
+ ft(l * 2, R),
1326
1326
  a,
1327
1327
  n + s,
1328
1328
  r,
1329
- o + c
1329
+ o + l
1330
1330
  ) : S = i(
1331
- Et(c, p),
1332
- ft(c * 2, R),
1331
+ Et(l, p),
1332
+ ft(l * 2, R),
1333
1333
  Et(s, C),
1334
1334
  ft(s * 2, T),
1335
1335
  r,
1336
- o + c,
1336
+ o + l,
1337
1337
  a,
1338
1338
  n + s
1339
1339
  );
1340
1340
  else if (g) {
1341
1341
  const _ = Bt.getPrimitive();
1342
1342
  $(s, A, _), _.applyMatrix4(t);
1343
- const N = pt(c), y = Ct(c, p);
1344
- $(N, u, ae), $(y, u, ce);
1345
- const w = _.intersectsBox(ae), L = _.intersectsBox(ce);
1343
+ const N = pt(l), L = Ct(l, p);
1344
+ $(N, u, ae), $(L, u, ce);
1345
+ const w = _.intersectsBox(ae), P = _.intersectsBox(ce);
1346
1346
  S = w && Tt(
1347
1347
  s,
1348
1348
  N,
@@ -1355,9 +1355,9 @@ function Tt(c, s, t, e, i, o = 0, n = 0, r = 0, a = 0, l = null, E = !1) {
1355
1355
  r + 1,
1356
1356
  _,
1357
1357
  !E
1358
- ) || L && Tt(
1358
+ ) || P && Tt(
1359
1359
  s,
1360
- y,
1360
+ L,
1361
1361
  e,
1362
1362
  t,
1363
1363
  i,
@@ -1370,11 +1370,11 @@ function Tt(c, s, t, e, i, o = 0, n = 0, r = 0, a = 0, l = null, E = !1) {
1370
1370
  ), Bt.releasePrimitive(_);
1371
1371
  } else {
1372
1372
  const _ = pt(s), N = Ct(s, C);
1373
- $(_, A, Gs), $(N, A, zs);
1374
- const y = l.intersectsBox(Gs), w = l.intersectsBox(zs);
1375
- if (y && w)
1373
+ $(_, A, Vs), $(N, A, zs);
1374
+ const L = c.intersectsBox(Vs), w = c.intersectsBox(zs);
1375
+ if (L && w)
1376
1376
  S = Tt(
1377
- c,
1377
+ l,
1378
1378
  _,
1379
1379
  t,
1380
1380
  e,
@@ -1383,10 +1383,10 @@ function Tt(c, s, t, e, i, o = 0, n = 0, r = 0, a = 0, l = null, E = !1) {
1383
1383
  n,
1384
1384
  r,
1385
1385
  a + 1,
1386
- l,
1386
+ c,
1387
1387
  E
1388
1388
  ) || Tt(
1389
- c,
1389
+ l,
1390
1390
  N,
1391
1391
  t,
1392
1392
  e,
@@ -1395,13 +1395,13 @@ function Tt(c, s, t, e, i, o = 0, n = 0, r = 0, a = 0, l = null, E = !1) {
1395
1395
  n,
1396
1396
  r,
1397
1397
  a + 1,
1398
- l,
1398
+ c,
1399
1399
  E
1400
1400
  );
1401
- else if (y)
1401
+ else if (L)
1402
1402
  if (m)
1403
1403
  S = Tt(
1404
- c,
1404
+ l,
1405
1405
  _,
1406
1406
  t,
1407
1407
  e,
@@ -1410,15 +1410,15 @@ function Tt(c, s, t, e, i, o = 0, n = 0, r = 0, a = 0, l = null, E = !1) {
1410
1410
  n,
1411
1411
  r,
1412
1412
  a + 1,
1413
- l,
1413
+ c,
1414
1414
  E
1415
1415
  );
1416
1416
  else {
1417
- const L = Bt.getPrimitive();
1418
- L.copy(Gs).applyMatrix4(t);
1419
- const U = pt(c), x = Ct(c, p);
1417
+ const P = Bt.getPrimitive();
1418
+ P.copy(Vs).applyMatrix4(t);
1419
+ const U = pt(l), x = Ct(l, p);
1420
1420
  $(U, u, ae), $(x, u, ce);
1421
- const B = L.intersectsBox(ae), H = L.intersectsBox(ce);
1421
+ const B = P.intersectsBox(ae), H = P.intersectsBox(ce);
1422
1422
  S = B && Tt(
1423
1423
  _,
1424
1424
  U,
@@ -1429,7 +1429,7 @@ function Tt(c, s, t, e, i, o = 0, n = 0, r = 0, a = 0, l = null, E = !1) {
1429
1429
  o,
1430
1430
  a,
1431
1431
  r + 1,
1432
- L,
1432
+ P,
1433
1433
  !E
1434
1434
  ) || H && Tt(
1435
1435
  _,
@@ -1441,14 +1441,14 @@ function Tt(c, s, t, e, i, o = 0, n = 0, r = 0, a = 0, l = null, E = !1) {
1441
1441
  o,
1442
1442
  a,
1443
1443
  r + 1,
1444
- L,
1444
+ P,
1445
1445
  !E
1446
- ), Bt.releasePrimitive(L);
1446
+ ), Bt.releasePrimitive(P);
1447
1447
  }
1448
1448
  else if (w)
1449
1449
  if (m)
1450
1450
  S = Tt(
1451
- c,
1451
+ l,
1452
1452
  N,
1453
1453
  t,
1454
1454
  e,
@@ -1457,15 +1457,15 @@ function Tt(c, s, t, e, i, o = 0, n = 0, r = 0, a = 0, l = null, E = !1) {
1457
1457
  n,
1458
1458
  r,
1459
1459
  a + 1,
1460
- l,
1460
+ c,
1461
1461
  E
1462
1462
  );
1463
1463
  else {
1464
- const L = Bt.getPrimitive();
1465
- L.copy(zs).applyMatrix4(t);
1466
- const U = pt(c), x = Ct(c, p);
1464
+ const P = Bt.getPrimitive();
1465
+ P.copy(zs).applyMatrix4(t);
1466
+ const U = pt(l), x = Ct(l, p);
1467
1467
  $(U, u, ae), $(x, u, ce);
1468
- const B = L.intersectsBox(ae), H = L.intersectsBox(ce);
1468
+ const B = P.intersectsBox(ae), H = P.intersectsBox(ce);
1469
1469
  S = B && Tt(
1470
1470
  N,
1471
1471
  U,
@@ -1476,7 +1476,7 @@ function Tt(c, s, t, e, i, o = 0, n = 0, r = 0, a = 0, l = null, E = !1) {
1476
1476
  o,
1477
1477
  a,
1478
1478
  r + 1,
1479
- L,
1479
+ P,
1480
1480
  !E
1481
1481
  ) || H && Tt(
1482
1482
  N,
@@ -1488,9 +1488,9 @@ function Tt(c, s, t, e, i, o = 0, n = 0, r = 0, a = 0, l = null, E = !1) {
1488
1488
  o,
1489
1489
  a,
1490
1490
  r + 1,
1491
- L,
1491
+ P,
1492
1492
  !E
1493
- ), Bt.releasePrimitive(L);
1493
+ ), Bt.releasePrimitive(P);
1494
1494
  }
1495
1495
  }
1496
1496
  return S;
@@ -1524,8 +1524,8 @@ class mi {
1524
1524
  if (r._roots = o, r._indirectBuffer = n || null, e.setIndex) {
1525
1525
  const a = t.getIndex();
1526
1526
  if (a === null) {
1527
- const l = new An(s.index, 1, !1);
1528
- t.setIndex(l);
1527
+ const c = new An(s.index, 1, !1);
1528
+ t.setIndex(c);
1529
1529
  } else
1530
1530
  a.array !== i && (a.array.set(i), a.needsUpdate = !0);
1531
1531
  }
@@ -1565,9 +1565,9 @@ class mi {
1565
1565
  const e = this._roots[t], i = new Uint32Array(e), o = new Uint16Array(e);
1566
1566
  n(0);
1567
1567
  function n(r, a = 0) {
1568
- const l = r * 2, E = o[l + 15] === ys;
1568
+ const c = r * 2, E = o[c + 15] === Ls;
1569
1569
  if (E) {
1570
- const d = i[r + 6], h = o[l + 14];
1570
+ const d = i[r + 6], h = o[c + 14];
1571
1571
  s(a, E, new Float32Array(e, r * 4, 6), d, h);
1572
1572
  } else {
1573
1573
  const d = r + Ts / 4, h = i[r + 6], u = i[r + 7];
@@ -1577,9 +1577,9 @@ class mi {
1577
1577
  }
1578
1578
  /* Core Cast Functions */
1579
1579
  raycast(s, t = _i) {
1580
- const e = this._roots, i = this.geometry, o = [], n = t.isMaterial, r = Array.isArray(t), a = i.groups, l = n ? t.side : t, E = this.indirect ? Yo : yo;
1580
+ const e = this._roots, i = this.geometry, o = [], n = t.isMaterial, r = Array.isArray(t), a = i.groups, c = n ? t.side : t, E = this.indirect ? Yo : Lo;
1581
1581
  for (let d = 0, h = e.length; d < h; d++) {
1582
- const u = r ? t[a[d].materialIndex].side : l, p = o.length;
1582
+ const u = r ? t[a[d].materialIndex].side : c, p = o.length;
1583
1583
  if (E(this, d, u, s, o), r) {
1584
1584
  const R = a[d].materialIndex;
1585
1585
  for (let A = p, C = o.length; A < C; A++)
@@ -1591,9 +1591,9 @@ class mi {
1591
1591
  raycastFirst(s, t = _i) {
1592
1592
  const e = this._roots, i = this.geometry, o = t.isMaterial, n = Array.isArray(t);
1593
1593
  let r = null;
1594
- const a = i.groups, l = o ? t.side : t, E = this.indirect ? Go : Mo;
1594
+ const a = i.groups, c = o ? t.side : t, E = this.indirect ? Vo : Mo;
1595
1595
  for (let d = 0, h = e.length; d < h; d++) {
1596
- const u = n ? t[a[d].materialIndex].side : l, p = E(this, d, u, s);
1596
+ const u = n ? t[a[d].materialIndex].side : c, p = E(this, d, u, s);
1597
1597
  p != null && (r == null || p.distance < r.distance) && (r = p, n && (p.face.materialIndex = a[d].materialIndex));
1598
1598
  }
1599
1599
  return r;
@@ -1606,7 +1606,7 @@ class mi {
1606
1606
  return e;
1607
1607
  }
1608
1608
  shapecast(s) {
1609
- const t = It.getPrimitive(), e = this.indirect ? Po : Oo;
1609
+ const t = It.getPrimitive(), e = this.indirect ? yo : Oo;
1610
1610
  let {
1611
1611
  boundsTraverseOrder: i,
1612
1612
  intersectsBounds: o,
@@ -1618,13 +1618,13 @@ class mi {
1618
1618
  n = (h, u, p, R, A) => d(h, u, p, R, A) ? !0 : e(h, u, this, r, p, R, t);
1619
1619
  } else
1620
1620
  n || (r ? n = (d, h, u, p) => e(d, h, this, r, u, p, t) : n = (d, h, u) => u);
1621
- let a = !1, l = 0;
1621
+ let a = !1, c = 0;
1622
1622
  const E = this._roots;
1623
1623
  for (let d = 0, h = E.length; d < h; d++) {
1624
1624
  const u = E[d];
1625
- if (a = To(this, d, o, n, i, l), a)
1625
+ if (a = To(this, d, o, n, i, c), a)
1626
1626
  break;
1627
- l += u.byteLength;
1627
+ c += u.byteLength;
1628
1628
  }
1629
1629
  return It.releasePrimitive(t), a;
1630
1630
  }
@@ -1633,7 +1633,7 @@ class mi {
1633
1633
  intersectsRanges: i,
1634
1634
  intersectsTriangles: o
1635
1635
  } = e;
1636
- const n = It.getPrimitive(), r = this.geometry.index, a = this.geometry.attributes.position, l = this.indirect ? (p) => {
1636
+ const n = It.getPrimitive(), r = this.geometry.index, a = this.geometry.attributes.position, c = this.indirect ? (p) => {
1637
1637
  const R = this.resolveTriangleIndex(p);
1638
1638
  tt(n, R * 3, r, a);
1639
1639
  } : (p) => {
@@ -1648,8 +1648,8 @@ class mi {
1648
1648
  const p = (R, A, C, T, F, f, m, g) => {
1649
1649
  for (let S = C, _ = C + T; S < _; S++) {
1650
1650
  u(S), E.a.applyMatrix4(t), E.b.applyMatrix4(t), E.c.applyMatrix4(t), E.needsUpdate = !0;
1651
- for (let N = R, y = R + A; N < y; N++)
1652
- if (l(N), n.needsUpdate = !0, o(n, E, N, S, F, f, m, g))
1651
+ for (let N = R, L = R + A; N < L; N++)
1652
+ if (c(N), n.needsUpdate = !0, o(n, E, N, S, F, f, m, g))
1653
1653
  return !0;
1654
1654
  }
1655
1655
  return !1;
@@ -1707,31 +1707,31 @@ class mi {
1707
1707
  }), s;
1708
1708
  }
1709
1709
  }
1710
- function Wi(c, s, t) {
1711
- return c === null || (c.point.applyMatrix4(s.matrixWorld), c.distance = c.point.distanceTo(t.ray.origin), c.object = s, c.distance < t.near || c.distance > t.far) ? null : c;
1710
+ function Wi(l, s, t) {
1711
+ return l === null || (l.point.applyMatrix4(s.matrixWorld), l.distance = l.point.distanceTo(t.ray.origin), l.object = s, l.distance < t.near || l.distance > t.far) ? null : l;
1712
1712
  }
1713
- const ks = /* @__PURE__ */ new Gn(), Xi = /* @__PURE__ */ new Mt(), qo = v.prototype.raycast;
1714
- function $o(c, s) {
1713
+ const ks = /* @__PURE__ */ new Vn(), Xi = /* @__PURE__ */ new Mt(), qo = v.prototype.raycast;
1714
+ function $o(l, s) {
1715
1715
  if (this.geometry.boundsTree) {
1716
1716
  if (this.material === void 0)
1717
1717
  return;
1718
- Xi.copy(this.matrixWorld).invert(), ks.copy(c.ray).applyMatrix4(Xi);
1718
+ Xi.copy(this.matrixWorld).invert(), ks.copy(l.ray).applyMatrix4(Xi);
1719
1719
  const t = this.geometry.boundsTree;
1720
- if (c.firstHitOnly === !0) {
1721
- const e = Wi(t.raycastFirst(ks, this.material), this, c);
1720
+ if (l.firstHitOnly === !0) {
1721
+ const e = Wi(t.raycastFirst(ks, this.material), this, l);
1722
1722
  e && s.push(e);
1723
1723
  } else {
1724
1724
  const e = t.raycast(ks, this.material);
1725
1725
  for (let i = 0, o = e.length; i < o; i++) {
1726
- const n = Wi(e[i], this, c);
1726
+ const n = Wi(e[i], this, l);
1727
1727
  n && s.push(n);
1728
1728
  }
1729
1729
  }
1730
1730
  } else
1731
- qo.call(this, c, s);
1731
+ qo.call(this, l, s);
1732
1732
  }
1733
- function Ko(c) {
1734
- return this.boundsTree = new mi(this, c), this.boundsTree;
1733
+ function Ko(l) {
1734
+ return this.boundsTree = new mi(this, l), this.boundsTree;
1735
1735
  }
1736
1736
  function Jo() {
1737
1737
  this.boundsTree = null;
@@ -1919,7 +1919,7 @@ class sr extends Ai {
1919
1919
  this.three.children = [], this.onDisposed.trigger(), this.onDisposed.reset();
1920
1920
  }
1921
1921
  }
1922
- const ms = 0, ir = 1, nr = new M(), Zi = new Lt(), Ws = new pi(), Qi = new M(), hs = new ue();
1922
+ const ms = 0, ir = 1, nr = new M(), Zi = new Pt(), Ws = new pi(), Qi = new M(), hs = new ue();
1923
1923
  class or {
1924
1924
  constructor() {
1925
1925
  this.tolerance = -1, this.faces = [], this.newFaces = [], this.assigned = new ji(), this.unassigned = new ji(), this.vertices = [];
@@ -1958,10 +1958,10 @@ class or {
1958
1958
  const e = this.faces;
1959
1959
  let i = -1 / 0, o = 1 / 0;
1960
1960
  for (let n = 0, r = e.length; n < r; n++) {
1961
- const a = e[n], l = a.distanceToPoint(s.origin), E = a.normal.dot(s.direction);
1962
- if (l > 0 && E >= 0)
1961
+ const a = e[n], c = a.distanceToPoint(s.origin), E = a.normal.dot(s.direction);
1962
+ if (c > 0 && E >= 0)
1963
1963
  return null;
1964
- const d = E !== 0 ? -l / E : 0;
1964
+ const d = E !== 0 ? -c / E : 0;
1965
1965
  if (!(d <= 0) && (E > 0 ? o = Math.min(d, o) : i = Math.max(d, i), i > o))
1966
1966
  return null;
1967
1967
  }
@@ -2034,10 +2034,10 @@ class or {
2034
2034
  s.copy(this.vertices[0].point), t.copy(this.vertices[0].point);
2035
2035
  for (let o = 0, n = this.vertices.length; o < n; o++) {
2036
2036
  const r = this.vertices[o], a = r.point;
2037
- for (let l = 0; l < 3; l++)
2038
- a.getComponent(l) < s.getComponent(l) && (s.setComponent(l, a.getComponent(l)), e[l] = r);
2039
- for (let l = 0; l < 3; l++)
2040
- a.getComponent(l) > t.getComponent(l) && (t.setComponent(l, a.getComponent(l)), i[l] = r);
2037
+ for (let c = 0; c < 3; c++)
2038
+ a.getComponent(c) < s.getComponent(c) && (s.setComponent(c, a.getComponent(c)), e[c] = r);
2039
+ for (let c = 0; c < 3; c++)
2040
+ a.getComponent(c) > t.getComponent(c) && (t.setComponent(c, a.getComponent(c)), i[c] = r);
2041
2041
  }
2042
2042
  return this.tolerance = 3 * Number.EPSILON * (Math.max(Math.abs(s.x), Math.abs(t.x)) + Math.max(Math.abs(s.y), Math.abs(t.y)) + Math.max(Math.abs(s.z), Math.abs(t.z))), { min: e, max: i };
2043
2043
  }
@@ -2051,20 +2051,20 @@ class or {
2051
2051
  u > o && (o = u, n = h);
2052
2052
  }
2053
2053
  const r = e[n], a = i[n];
2054
- let l, E;
2054
+ let c, E;
2055
2055
  o = 0, Zi.set(r.point, a.point);
2056
2056
  for (let h = 0, u = this.vertices.length; h < u; h++) {
2057
2057
  const p = s[h];
2058
2058
  if (p !== r && p !== a) {
2059
2059
  Zi.closestPointToPoint(p.point, !0, Qi);
2060
2060
  const R = Qi.distanceToSquared(p.point);
2061
- R > o && (o = R, l = p);
2061
+ R > o && (o = R, c = p);
2062
2062
  }
2063
2063
  }
2064
- o = -1, Ws.setFromCoplanarPoints(r.point, a.point, l.point);
2064
+ o = -1, Ws.setFromCoplanarPoints(r.point, a.point, c.point);
2065
2065
  for (let h = 0, u = this.vertices.length; h < u; h++) {
2066
2066
  const p = s[h];
2067
- if (p !== r && p !== a && p !== l) {
2067
+ if (p !== r && p !== a && p !== c) {
2068
2068
  const R = Math.abs(Ws.distanceToPoint(p.point));
2069
2069
  R > o && (o = R, E = p);
2070
2070
  }
@@ -2072,10 +2072,10 @@ class or {
2072
2072
  const d = [];
2073
2073
  if (Ws.distanceToPoint(E.point) < 0) {
2074
2074
  d.push(
2075
- Rt.create(r, a, l),
2075
+ Rt.create(r, a, c),
2076
2076
  Rt.create(E, a, r),
2077
- Rt.create(E, l, a),
2078
- Rt.create(E, r, l)
2077
+ Rt.create(E, c, a),
2078
+ Rt.create(E, r, c)
2079
2079
  );
2080
2080
  for (let h = 0; h < 3; h++) {
2081
2081
  const u = (h + 1) % 3;
@@ -2083,10 +2083,10 @@ class or {
2083
2083
  }
2084
2084
  } else {
2085
2085
  d.push(
2086
- Rt.create(r, l, a),
2086
+ Rt.create(r, c, a),
2087
2087
  Rt.create(E, r, a),
2088
- Rt.create(E, a, l),
2089
- Rt.create(E, l, r)
2088
+ Rt.create(E, a, c),
2089
+ Rt.create(E, c, r)
2090
2090
  );
2091
2091
  for (let h = 0; h < 3; h++) {
2092
2092
  const u = (h + 1) % 3;
@@ -2097,7 +2097,7 @@ class or {
2097
2097
  this.faces.push(d[h]);
2098
2098
  for (let h = 0, u = s.length; h < u; h++) {
2099
2099
  const p = s[h];
2100
- if (p !== r && p !== a && p !== l && p !== E) {
2100
+ if (p !== r && p !== a && p !== c && p !== E) {
2101
2101
  o = this.tolerance;
2102
2102
  let R = null;
2103
2103
  for (let A = 0; A < 4; A++) {
@@ -2270,54 +2270,54 @@ class ji {
2270
2270
  }
2271
2271
  }
2272
2272
  const li = [2, 2, 1], hi = [1, 0, 0];
2273
- function Pt(c, s) {
2274
- return c * 3 + s;
2273
+ function yt(l, s) {
2274
+ return l * 3 + s;
2275
2275
  }
2276
- function ar(c) {
2277
- const s = c.elements;
2276
+ function ar(l) {
2277
+ const s = l.elements;
2278
2278
  let t = 0;
2279
2279
  for (let e = 0; e < 9; e++)
2280
2280
  t += s[e] * s[e];
2281
2281
  return Math.sqrt(t);
2282
2282
  }
2283
- function cr(c) {
2284
- const s = c.elements;
2283
+ function cr(l) {
2284
+ const s = l.elements;
2285
2285
  let t = 0;
2286
2286
  for (let e = 0; e < 3; e++) {
2287
- const i = s[Pt(li[e], hi[e])];
2287
+ const i = s[yt(li[e], hi[e])];
2288
2288
  t += 2 * i * i;
2289
2289
  }
2290
2290
  return Math.sqrt(t);
2291
2291
  }
2292
- function lr(c, s) {
2292
+ function lr(l, s) {
2293
2293
  let t = 0, e = 1;
2294
- const i = c.elements;
2295
- for (let l = 0; l < 3; l++) {
2296
- const E = Math.abs(i[Pt(li[l], hi[l])]);
2297
- E > t && (t = E, e = l);
2294
+ const i = l.elements;
2295
+ for (let c = 0; c < 3; c++) {
2296
+ const E = Math.abs(i[yt(li[c], hi[c])]);
2297
+ E > t && (t = E, e = c);
2298
2298
  }
2299
2299
  let o = 1, n = 0;
2300
2300
  const r = hi[e], a = li[e];
2301
- if (Math.abs(i[Pt(a, r)]) > Number.EPSILON) {
2302
- const l = i[Pt(a, a)], E = i[Pt(r, r)], d = i[Pt(a, r)], h = (l - E) / 2 / d;
2301
+ if (Math.abs(i[yt(a, r)]) > Number.EPSILON) {
2302
+ const c = i[yt(a, a)], E = i[yt(r, r)], d = i[yt(a, r)], h = (c - E) / 2 / d;
2303
2303
  let u;
2304
2304
  h < 0 ? u = -1 / (-h + Math.sqrt(1 + h * h)) : u = 1 / (h + Math.sqrt(1 + h * h)), o = 1 / Math.sqrt(1 + u * u), n = u * o;
2305
2305
  }
2306
- return s.identity(), s.elements[Pt(r, r)] = o, s.elements[Pt(a, a)] = o, s.elements[Pt(a, r)] = n, s.elements[Pt(r, a)] = -n, s;
2306
+ return s.identity(), s.elements[yt(r, r)] = o, s.elements[yt(a, a)] = o, s.elements[yt(a, r)] = n, s.elements[yt(r, a)] = -n, s;
2307
2307
  }
2308
- function hr(c, s) {
2308
+ function hr(l, s) {
2309
2309
  let t = 0, e = 0;
2310
2310
  const i = 10;
2311
- s.unitary.identity(), s.diagonal.copy(c);
2312
- const o = s.unitary, n = s.diagonal, r = new O.Matrix3(), a = new O.Matrix3(), l = Number.EPSILON * ar(n);
2313
- for (; e < i && cr(n) > l; )
2311
+ s.unitary.identity(), s.diagonal.copy(l);
2312
+ const o = s.unitary, n = s.diagonal, r = new O.Matrix3(), a = new O.Matrix3(), c = Number.EPSILON * ar(n);
2313
+ for (; e < i && cr(n) > c; )
2314
2314
  lr(n, r), a.copy(r).transpose(), n.multiply(r), n.premultiply(a), o.multiply(r), ++t > 2 && (e++, t = 0);
2315
2315
  return s;
2316
2316
  }
2317
- function Er(c) {
2317
+ function Er(l) {
2318
2318
  const s = [];
2319
- for (let st = 0; st < c.length - 2; st += 3) {
2320
- const Xt = c[st], J = c[st + 1], Kt = c[st + 2];
2319
+ for (let st = 0; st < l.length - 2; st += 3) {
2320
+ const Xt = l[st], J = l[st + 1], Kt = l[st + 2];
2321
2321
  s.push(new O.Vector3(Xt, J, Kt));
2322
2322
  }
2323
2323
  const t = new or();
@@ -2339,26 +2339,26 @@ function Er(c) {
2339
2339
  n.push(Ms.point.x, Ms.point.y, Ms.point.z), n.push(ws.point.x, ws.point.y, ws.point.z), n.push(Ds.point.x, Ds.point.y, Ds.point.z);
2340
2340
  }
2341
2341
  }
2342
- const r = new O.Vector3(), a = new O.Vector3(), l = new O.Vector3(), E = new O.Vector3(), d = new O.Vector3(), h = new O.Vector3(), u = new O.Vector3(), p = new O.Vector3();
2342
+ const r = new O.Vector3(), a = new O.Vector3(), c = new O.Vector3(), E = new O.Vector3(), d = new O.Vector3(), h = new O.Vector3(), u = new O.Vector3(), p = new O.Vector3();
2343
2343
  let R = 0, A = 0, C = 0, T = 0, F = 0, f = 0, m = 0;
2344
2344
  for (let st = 0, Xt = n.length; st < Xt; st += 9) {
2345
- r.fromArray(n, st), a.fromArray(n, st + 3), l.fromArray(n, st + 6), u.set(0, 0, 0), u.add(r).add(a).add(l).divideScalar(3), E.subVectors(a, r), d.subVectors(l, r);
2345
+ r.fromArray(n, st), a.fromArray(n, st + 3), c.fromArray(n, st + 6), u.set(0, 0, 0), u.add(r).add(a).add(c).divideScalar(3), E.subVectors(a, r), d.subVectors(c, r);
2346
2346
  const J = h.crossVectors(E, d).length() / 2;
2347
- p.add(h.copy(u).multiplyScalar(J)), R += J, A += (9 * u.x * u.x + r.x * r.x + a.x * a.x + l.x * l.x) * (J / 12), C += (9 * u.x * u.y + r.x * r.y + a.x * a.y + l.x * l.y) * (J / 12), T += (9 * u.x * u.z + r.x * r.z + a.x * a.z + l.x * l.z) * (J / 12), F += (9 * u.y * u.y + r.y * r.y + a.y * a.y + l.y * l.y) * (J / 12), f += (9 * u.y * u.z + r.y * r.z + a.y * a.z + l.y * l.z) * (J / 12), m += (9 * u.z * u.z + r.z * r.z + a.z * a.z + l.z * l.z) * (J / 12);
2347
+ p.add(h.copy(u).multiplyScalar(J)), R += J, A += (9 * u.x * u.x + r.x * r.x + a.x * a.x + c.x * c.x) * (J / 12), C += (9 * u.x * u.y + r.x * r.y + a.x * a.y + c.x * c.y) * (J / 12), T += (9 * u.x * u.z + r.x * r.z + a.x * a.z + c.x * c.z) * (J / 12), F += (9 * u.y * u.y + r.y * r.y + a.y * a.y + c.y * c.y) * (J / 12), f += (9 * u.y * u.z + r.y * r.z + a.y * a.z + c.y * c.z) * (J / 12), m += (9 * u.z * u.z + r.z * r.z + a.z * a.z + c.z * c.z) * (J / 12);
2348
2348
  }
2349
2349
  p.divideScalar(R), A /= R, C /= R, T /= R, F /= R, f /= R, m /= R, A -= p.x * p.x, C -= p.x * p.y, T -= p.x * p.z, F -= p.y * p.y, f -= p.y * p.z, m -= p.z * p.z;
2350
2350
  const g = new O.Matrix3();
2351
2351
  g.elements[0] = A, g.elements[1] = C, g.elements[2] = T, g.elements[3] = C, g.elements[4] = F, g.elements[5] = f, g.elements[6] = T, g.elements[7] = f, g.elements[8] = m, hr(g, e);
2352
- const S = e.unitary, _ = new O.Vector3(), N = new O.Vector3(), y = new O.Vector3();
2353
- S.extractBasis(_, N, y);
2354
- let w = -1 / 0, L = -1 / 0, U = -1 / 0, x = 1 / 0, B = 1 / 0, H = 1 / 0;
2352
+ const S = e.unitary, _ = new O.Vector3(), N = new O.Vector3(), L = new O.Vector3();
2353
+ S.extractBasis(_, N, L);
2354
+ let w = -1 / 0, P = -1 / 0, U = -1 / 0, x = 1 / 0, B = 1 / 0, H = 1 / 0;
2355
2355
  for (let st = 0, Xt = s.length; st < Xt; st++) {
2356
2356
  const J = s[st];
2357
- w = Math.max(_.dot(J), w), L = Math.max(N.dot(J), L), U = Math.max(y.dot(J), U), x = Math.min(_.dot(J), x), B = Math.min(N.dot(J), B), H = Math.min(y.dot(J), H);
2357
+ w = Math.max(_.dot(J), w), P = Math.max(N.dot(J), P), U = Math.max(L.dot(J), U), x = Math.min(_.dot(J), x), B = Math.min(N.dot(J), B), H = Math.min(L.dot(J), H);
2358
2358
  }
2359
- _.multiplyScalar(0.5 * (x + w)), N.multiplyScalar(0.5 * (B + L)), y.multiplyScalar(0.5 * (H + U));
2359
+ _.multiplyScalar(0.5 * (x + w)), N.multiplyScalar(0.5 * (B + P)), L.multiplyScalar(0.5 * (H + U));
2360
2360
  const q = new O.Vector3(), et = new O.Vector3(), Q = new O.Matrix3();
2361
- q.add(_).add(N).add(y), et.x = w - x, et.y = L - B, et.z = U - H, et.multiplyScalar(0.5), Q.copy(S);
2361
+ q.add(_).add(N).add(L), et.x = w - x, et.y = P - B, et.z = U - H, et.multiplyScalar(0.5), Q.copy(S);
2362
2362
  const { x: Ht, y: kt, z: Wt } = et, Xe = new O.Matrix4();
2363
2363
  Xe.makeScale(Ht * 2, kt * 2, Wt * 2);
2364
2364
  const Ce = new O.Matrix4();
@@ -2370,11 +2370,11 @@ function Er(c) {
2370
2370
  const Te = new O.Matrix4();
2371
2371
  return Te.multiply(Oi), Te.multiply(Si), Te.multiply(Ce), Te.multiply(Xe), { center: q, halfSizes: et, rotation: Q, transformation: Te };
2372
2372
  }
2373
- function dr(c, s, t) {
2373
+ function dr(l, s, t) {
2374
2374
  const e = [
2375
- c[0] - s[0],
2376
- c[1] - s[1],
2377
- c[2] - s[2]
2375
+ l[0] - s[0],
2376
+ l[1] - s[1],
2377
+ l[2] - s[2]
2378
2378
  ];
2379
2379
  return t[0] * e[0] + t[1] * e[1] + t[2] * e[2] > 0;
2380
2380
  }
@@ -3104,11 +3104,11 @@ class qr extends er {
3104
3104
  * (c) 2017 @yomotsu
3105
3105
  * Released under the MIT License.
3106
3106
  */
3107
- const V = {
3107
+ const G = {
3108
3108
  LEFT: 1,
3109
3109
  RIGHT: 2,
3110
3110
  MIDDLE: 4
3111
- }, P = Object.freeze({
3111
+ }, y = Object.freeze({
3112
3112
  NONE: 0,
3113
3113
  ROTATE: 1,
3114
3114
  TRUCK: 2,
@@ -3131,64 +3131,64 @@ const V = {
3131
3131
  IN: 1,
3132
3132
  OUT: -1
3133
3133
  };
3134
- function Zt(c) {
3135
- return c.isPerspectiveCamera;
3134
+ function Zt(l) {
3135
+ return l.isPerspectiveCamera;
3136
3136
  }
3137
- function vt(c) {
3138
- return c.isOrthographicCamera;
3137
+ function vt(l) {
3138
+ return l.isOrthographicCamera;
3139
3139
  }
3140
- const he = Math.PI * 2, $i = Math.PI / 2, Pn = 1e-5, _e = Math.PI / 180;
3141
- function mt(c, s, t) {
3142
- return Math.max(s, Math.min(t, c));
3140
+ const he = Math.PI * 2, $i = Math.PI / 2, yn = 1e-5, _e = Math.PI / 180;
3141
+ function mt(l, s, t) {
3142
+ return Math.max(s, Math.min(t, l));
3143
3143
  }
3144
- function X(c, s = Pn) {
3145
- return Math.abs(c) < s;
3144
+ function X(l, s = yn) {
3145
+ return Math.abs(l) < s;
3146
3146
  }
3147
- function k(c, s, t = Pn) {
3148
- return X(c - s, t);
3147
+ function k(l, s, t = yn) {
3148
+ return X(l - s, t);
3149
3149
  }
3150
- function Ki(c, s) {
3151
- return Math.round(c / s) * s;
3150
+ function Ki(l, s) {
3151
+ return Math.round(l / s) * s;
3152
3152
  }
3153
- function Ne(c) {
3154
- return isFinite(c) ? c : c < 0 ? -Number.MAX_VALUE : Number.MAX_VALUE;
3153
+ function Ne(l) {
3154
+ return isFinite(l) ? l : l < 0 ? -Number.MAX_VALUE : Number.MAX_VALUE;
3155
3155
  }
3156
- function Pe(c) {
3157
- return Math.abs(c) < Number.MAX_VALUE ? c : c * (1 / 0);
3156
+ function ye(l) {
3157
+ return Math.abs(l) < Number.MAX_VALUE ? l : l * (1 / 0);
3158
3158
  }
3159
- function Es(c, s, t, e, i = 1 / 0, o) {
3159
+ function Es(l, s, t, e, i = 1 / 0, o) {
3160
3160
  e = Math.max(1e-4, e);
3161
3161
  const n = 2 / e, r = n * o, a = 1 / (1 + r + 0.48 * r * r + 0.235 * r * r * r);
3162
- let l = c - s;
3162
+ let c = l - s;
3163
3163
  const E = s, d = i * e;
3164
- l = mt(l, -d, d), s = c - l;
3165
- const h = (t.value + n * l) * o;
3164
+ c = mt(c, -d, d), s = l - c;
3165
+ const h = (t.value + n * c) * o;
3166
3166
  t.value = (t.value - n * h) * a;
3167
- let u = s + (l + h) * a;
3168
- return E - c > 0 == u > E && (u = E, t.value = (u - E) / o), u;
3167
+ let u = s + (c + h) * a;
3168
+ return E - l > 0 == u > E && (u = E, t.value = (u - E) / o), u;
3169
3169
  }
3170
- function Ji(c, s, t, e, i = 1 / 0, o, n) {
3170
+ function Ji(l, s, t, e, i = 1 / 0, o, n) {
3171
3171
  e = Math.max(1e-4, e);
3172
- const r = 2 / e, a = r * o, l = 1 / (1 + a + 0.48 * a * a + 0.235 * a * a * a);
3173
- let E = s.x, d = s.y, h = s.z, u = c.x - E, p = c.y - d, R = c.z - h;
3172
+ const r = 2 / e, a = r * o, c = 1 / (1 + a + 0.48 * a * a + 0.235 * a * a * a);
3173
+ let E = s.x, d = s.y, h = s.z, u = l.x - E, p = l.y - d, R = l.z - h;
3174
3174
  const A = E, C = d, T = h, F = i * e, f = F * F, m = u * u + p * p + R * R;
3175
3175
  if (m > f) {
3176
3176
  const B = Math.sqrt(m);
3177
3177
  u = u / B * F, p = p / B * F, R = R / B * F;
3178
3178
  }
3179
- E = c.x - u, d = c.y - p, h = c.z - R;
3179
+ E = l.x - u, d = l.y - p, h = l.z - R;
3180
3180
  const g = (t.x + r * u) * o, S = (t.y + r * p) * o, _ = (t.z + r * R) * o;
3181
- t.x = (t.x - r * g) * l, t.y = (t.y - r * S) * l, t.z = (t.z - r * _) * l, n.x = E + (u + g) * l, n.y = d + (p + S) * l, n.z = h + (R + _) * l;
3182
- const N = A - c.x, y = C - c.y, w = T - c.z, L = n.x - A, U = n.y - C, x = n.z - T;
3183
- return N * L + y * U + w * x > 0 && (n.x = A, n.y = C, n.z = T, t.x = (n.x - A) / o, t.y = (n.y - C) / o, t.z = (n.z - T) / o), n;
3181
+ t.x = (t.x - r * g) * c, t.y = (t.y - r * S) * c, t.z = (t.z - r * _) * c, n.x = E + (u + g) * c, n.y = d + (p + S) * c, n.z = h + (R + _) * c;
3182
+ const N = A - l.x, L = C - l.y, w = T - l.z, P = n.x - A, U = n.y - C, x = n.z - T;
3183
+ return N * P + L * U + w * x > 0 && (n.x = A, n.y = C, n.z = T, t.x = (n.x - A) / o, t.y = (n.y - C) / o, t.z = (n.z - T) / o), n;
3184
3184
  }
3185
- function Zs(c, s) {
3186
- s.set(0, 0), c.forEach((t) => {
3185
+ function Zs(l, s) {
3186
+ s.set(0, 0), l.forEach((t) => {
3187
3187
  s.x += t.clientX, s.y += t.clientY;
3188
- }), s.x /= c.length, s.y /= c.length;
3188
+ }), s.x /= l.length, s.y /= l.length;
3189
3189
  }
3190
- function Qs(c, s) {
3191
- return vt(c) ? (console.warn(`${s} is not supported in OrthographicCamera`), !0) : !1;
3190
+ function Qs(l, s) {
3191
+ return vt(l) ? (console.warn(`${s} is not supported in OrthographicCamera`), !0) : !1;
3192
3192
  }
3193
3193
  class pr {
3194
3194
  constructor() {
@@ -3254,8 +3254,8 @@ class pr {
3254
3254
  }
3255
3255
  }
3256
3256
  }
3257
- const Cr = "2.7.3", ds = 1 / 8, yn = typeof window < "u", Tr = yn && /Mac/.test(navigator.platform), mr = !(yn && "PointerEvent" in window);
3258
- let Y, tn, us, js, lt, G, z, Ee, ye, St, _t, Qt, en, sn, ut, Le, de, nn, qs, on, $s, Ks, Is;
3257
+ const Cr = "2.7.3", ds = 1 / 8, Ln = typeof window < "u", Tr = Ln && /Mac/.test(navigator.platform), mr = !(Ln && "PointerEvent" in window);
3258
+ let Y, tn, us, js, lt, V, z, Ee, Le, St, _t, Qt, en, sn, ut, Pe, de, nn, qs, on, $s, Ks, Is;
3259
3259
  class ot extends pr {
3260
3260
  /**
3261
3261
  * Injects THREE as the dependency. You can then proceed to use CameraControls.
@@ -3298,14 +3298,14 @@ class ot extends pr {
3298
3298
  * @category Statics
3299
3299
  */
3300
3300
  static install(s) {
3301
- Y = s.THREE, tn = Object.freeze(new Y.Vector3(0, 0, 0)), us = Object.freeze(new Y.Vector3(0, 1, 0)), js = Object.freeze(new Y.Vector3(0, 0, 1)), lt = new Y.Vector2(), G = new Y.Vector3(), z = new Y.Vector3(), Ee = new Y.Vector3(), ye = new Y.Vector3(), St = new Y.Vector3(), _t = new Y.Vector3(), Qt = new Y.Vector3(), en = new Y.Vector3(), sn = new Y.Vector3(), ut = new Y.Spherical(), Le = new Y.Spherical(), de = new Y.Box3(), nn = new Y.Box3(), qs = new Y.Sphere(), on = new Y.Quaternion(), $s = new Y.Quaternion(), Ks = new Y.Matrix4(), Is = new Y.Raycaster();
3301
+ Y = s.THREE, tn = Object.freeze(new Y.Vector3(0, 0, 0)), us = Object.freeze(new Y.Vector3(0, 1, 0)), js = Object.freeze(new Y.Vector3(0, 0, 1)), lt = new Y.Vector2(), V = new Y.Vector3(), z = new Y.Vector3(), Ee = new Y.Vector3(), Le = new Y.Vector3(), St = new Y.Vector3(), _t = new Y.Vector3(), Qt = new Y.Vector3(), en = new Y.Vector3(), sn = new Y.Vector3(), ut = new Y.Spherical(), Pe = new Y.Spherical(), de = new Y.Box3(), nn = new Y.Box3(), qs = new Y.Sphere(), on = new Y.Quaternion(), $s = new Y.Quaternion(), Ks = new Y.Matrix4(), Is = new Y.Raycaster();
3302
3302
  }
3303
3303
  /**
3304
3304
  * list all ACTIONs
3305
3305
  * @category Statics
3306
3306
  */
3307
3307
  static get ACTION() {
3308
- return P;
3308
+ return y;
3309
3309
  }
3310
3310
  /**
3311
3311
  * Creates a `CameraControls` instance.
@@ -3326,10 +3326,10 @@ class ot extends pr {
3326
3326
  */
3327
3327
  constructor(s, t) {
3328
3328
  super(), this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.minAzimuthAngle = -1 / 0, this.maxAzimuthAngle = 1 / 0, this.minDistance = Number.EPSILON, this.maxDistance = 1 / 0, this.infinityDolly = !1, this.minZoom = 0.01, this.maxZoom = 1 / 0, this.smoothTime = 0.25, this.draggingSmoothTime = 0.125, this.maxSpeed = 1 / 0, this.azimuthRotateSpeed = 1, this.polarRotateSpeed = 1, this.dollySpeed = 1, this.dollyDragInverted = !1, this.truckSpeed = 2, this.dollyToCursor = !1, this.dragToOffset = !1, this.verticalDragToForward = !1, this.boundaryFriction = 0, this.restThreshold = 0.01, this.colliderMeshes = [], this.cancel = () => {
3329
- }, this._enabled = !0, this._state = P.NONE, this._viewport = null, this._changedDolly = 0, this._changedZoom = 0, this._hasRested = !0, this._boundaryEnclosesCamera = !1, this._needsUpdate = !0, this._updatedLastTime = !1, this._elementRect = new DOMRect(), this._isDragging = !1, this._dragNeedsUpdate = !0, this._activePointers = [], this._lockedPointer = null, this._interactiveArea = new DOMRect(0, 0, 1, 1), this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._isUserControllingOffset = !1, this._isUserControllingZoom = !1, this._lastDollyDirection = le.NONE, this._thetaVelocity = { value: 0 }, this._phiVelocity = { value: 0 }, this._radiusVelocity = { value: 0 }, this._targetVelocity = new Y.Vector3(), this._focalOffsetVelocity = new Y.Vector3(), this._zoomVelocity = { value: 0 }, this._truckInternal = (f, m, g) => {
3329
+ }, this._enabled = !0, this._state = y.NONE, this._viewport = null, this._changedDolly = 0, this._changedZoom = 0, this._hasRested = !0, this._boundaryEnclosesCamera = !1, this._needsUpdate = !0, this._updatedLastTime = !1, this._elementRect = new DOMRect(), this._isDragging = !1, this._dragNeedsUpdate = !0, this._activePointers = [], this._lockedPointer = null, this._interactiveArea = new DOMRect(0, 0, 1, 1), this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._isUserControllingOffset = !1, this._isUserControllingZoom = !1, this._lastDollyDirection = le.NONE, this._thetaVelocity = { value: 0 }, this._phiVelocity = { value: 0 }, this._radiusVelocity = { value: 0 }, this._targetVelocity = new Y.Vector3(), this._focalOffsetVelocity = new Y.Vector3(), this._zoomVelocity = { value: 0 }, this._truckInternal = (f, m, g) => {
3330
3330
  let S, _;
3331
3331
  if (Zt(this._camera)) {
3332
- const N = G.copy(this._camera.position).sub(this._target), y = this._camera.getEffectiveFOV() * _e, w = N.length() * Math.tan(y * 0.5);
3332
+ const N = V.copy(this._camera.position).sub(this._target), L = this._camera.getEffectiveFOV() * _e, w = N.length() * Math.tan(L * 0.5);
3333
3333
  S = this.truckSpeed * f * w / this._elementRect.height, _ = this.truckSpeed * m * w / this._elementRect.height;
3334
3334
  } else if (vt(this._camera)) {
3335
3335
  const N = this._camera;
@@ -3341,25 +3341,25 @@ class ot extends pr {
3341
3341
  const g = he * this.azimuthRotateSpeed * f / this._elementRect.height, S = he * this.polarRotateSpeed * m / this._elementRect.height;
3342
3342
  this.rotate(g, S, !0);
3343
3343
  }, this._dollyInternal = (f, m, g) => {
3344
- const S = Math.pow(0.95, -f * this.dollySpeed), _ = this._sphericalEnd.radius, N = this._sphericalEnd.radius * S, y = mt(N, this.minDistance, this.maxDistance), w = y - N;
3345
- this.infinityDolly && this.dollyToCursor ? this._dollyToNoClamp(N, !0) : this.infinityDolly && !this.dollyToCursor ? (this.dollyInFixed(w, !0), this._dollyToNoClamp(y, !0)) : this._dollyToNoClamp(y, !0), this.dollyToCursor && (this._changedDolly += (this.infinityDolly ? N : y) - _, this._dollyControlCoord.set(m, g)), this._lastDollyDirection = Math.sign(-f);
3344
+ const S = Math.pow(0.95, -f * this.dollySpeed), _ = this._sphericalEnd.radius, N = this._sphericalEnd.radius * S, L = mt(N, this.minDistance, this.maxDistance), w = L - N;
3345
+ this.infinityDolly && this.dollyToCursor ? this._dollyToNoClamp(N, !0) : this.infinityDolly && !this.dollyToCursor ? (this.dollyInFixed(w, !0), this._dollyToNoClamp(L, !0)) : this._dollyToNoClamp(L, !0), this.dollyToCursor && (this._changedDolly += (this.infinityDolly ? N : L) - _, this._dollyControlCoord.set(m, g)), this._lastDollyDirection = Math.sign(-f);
3346
3346
  }, this._zoomInternal = (f, m, g) => {
3347
3347
  const S = Math.pow(0.95, f * this.dollySpeed), _ = this._zoom, N = this._zoom * S;
3348
3348
  this.zoomTo(N, !0), this.dollyToCursor && (this._changedZoom += N - _, this._dollyControlCoord.set(m, g));
3349
- }, typeof Y > "u" && console.error("camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."), this._camera = s, this._yAxisUpSpace = new Y.Quaternion().setFromUnitVectors(this._camera.up, us), this._yAxisUpSpaceInverse = this._yAxisUpSpace.clone().invert(), this._state = P.NONE, this._target = new Y.Vector3(), this._targetEnd = this._target.clone(), this._focalOffset = new Y.Vector3(), this._focalOffsetEnd = this._focalOffset.clone(), this._spherical = new Y.Spherical().setFromVector3(G.copy(this._camera.position).applyQuaternion(this._yAxisUpSpace)), this._sphericalEnd = this._spherical.clone(), this._lastDistance = this._spherical.radius, this._zoom = this._camera.zoom, this._zoomEnd = this._zoom, this._lastZoom = this._zoom, this._nearPlaneCorners = [
3349
+ }, typeof Y > "u" && console.error("camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."), this._camera = s, this._yAxisUpSpace = new Y.Quaternion().setFromUnitVectors(this._camera.up, us), this._yAxisUpSpaceInverse = this._yAxisUpSpace.clone().invert(), this._state = y.NONE, this._target = new Y.Vector3(), this._targetEnd = this._target.clone(), this._focalOffset = new Y.Vector3(), this._focalOffsetEnd = this._focalOffset.clone(), this._spherical = new Y.Spherical().setFromVector3(V.copy(this._camera.position).applyQuaternion(this._yAxisUpSpace)), this._sphericalEnd = this._spherical.clone(), this._lastDistance = this._spherical.radius, this._zoom = this._camera.zoom, this._zoomEnd = this._zoom, this._lastZoom = this._zoom, this._nearPlaneCorners = [
3350
3350
  new Y.Vector3(),
3351
3351
  new Y.Vector3(),
3352
3352
  new Y.Vector3(),
3353
3353
  new Y.Vector3()
3354
3354
  ], this._updateNearPlaneCorners(), this._boundary = new Y.Box3(new Y.Vector3(-1 / 0, -1 / 0, -1 / 0), new Y.Vector3(1 / 0, 1 / 0, 1 / 0)), this._cameraUp0 = this._camera.up.clone(), this._target0 = this._target.clone(), this._position0 = this._camera.position.clone(), this._zoom0 = this._zoom, this._focalOffset0 = this._focalOffset.clone(), this._dollyControlCoord = new Y.Vector2(), this.mouseButtons = {
3355
- left: P.ROTATE,
3356
- middle: P.DOLLY,
3357
- right: P.TRUCK,
3358
- wheel: Zt(this._camera) ? P.DOLLY : vt(this._camera) ? P.ZOOM : P.NONE
3355
+ left: y.ROTATE,
3356
+ middle: y.DOLLY,
3357
+ right: y.TRUCK,
3358
+ wheel: Zt(this._camera) ? y.DOLLY : vt(this._camera) ? y.ZOOM : y.NONE
3359
3359
  }, this.touches = {
3360
- one: P.TOUCH_ROTATE,
3361
- two: Zt(this._camera) ? P.TOUCH_DOLLY_TRUCK : vt(this._camera) ? P.TOUCH_ZOOM_TRUCK : P.NONE,
3362
- three: P.TOUCH_TRUCK
3360
+ one: y.TOUCH_ROTATE,
3361
+ two: Zt(this._camera) ? y.TOUCH_DOLLY_TRUCK : vt(this._camera) ? y.TOUCH_ZOOM_TRUCK : y.NONE,
3362
+ three: y.TOUCH_TRUCK
3363
3363
  };
3364
3364
  const e = new Y.Vector2(), i = new Y.Vector2(), o = new Y.Vector2(), n = (f) => {
3365
3365
  if (!this._enabled || !this._domElement)
@@ -3369,12 +3369,12 @@ class ot extends pr {
3369
3369
  if (_ < this._interactiveArea.left || _ > this._interactiveArea.right || N < this._interactiveArea.top || N > this._interactiveArea.bottom)
3370
3370
  return;
3371
3371
  }
3372
- const m = f.pointerType !== "mouse" ? null : (f.buttons & V.LEFT) === V.LEFT ? V.LEFT : (f.buttons & V.MIDDLE) === V.MIDDLE ? V.MIDDLE : (f.buttons & V.RIGHT) === V.RIGHT ? V.RIGHT : null;
3372
+ const m = f.pointerType !== "mouse" ? null : (f.buttons & G.LEFT) === G.LEFT ? G.LEFT : (f.buttons & G.MIDDLE) === G.MIDDLE ? G.MIDDLE : (f.buttons & G.RIGHT) === G.RIGHT ? G.RIGHT : null;
3373
3373
  if (m !== null) {
3374
3374
  const S = this._findPointerByMouseButton(m);
3375
3375
  S && this._disposePointer(S);
3376
3376
  }
3377
- if ((f.buttons & V.LEFT) === V.LEFT && this._lockedPointer)
3377
+ if ((f.buttons & G.LEFT) === G.LEFT && this._lockedPointer)
3378
3378
  return;
3379
3379
  const g = {
3380
3380
  pointerId: f.pointerId,
@@ -3393,7 +3393,7 @@ class ot extends pr {
3393
3393
  if (_ < this._interactiveArea.left || _ > this._interactiveArea.right || N < this._interactiveArea.top || N > this._interactiveArea.bottom)
3394
3394
  return;
3395
3395
  }
3396
- const m = (f.buttons & V.LEFT) === V.LEFT ? V.LEFT : (f.buttons & V.MIDDLE) === V.MIDDLE ? V.MIDDLE : (f.buttons & V.RIGHT) === V.RIGHT ? V.RIGHT : null;
3396
+ const m = (f.buttons & G.LEFT) === G.LEFT ? G.LEFT : (f.buttons & G.MIDDLE) === G.MIDDLE ? G.MIDDLE : (f.buttons & G.RIGHT) === G.RIGHT ? G.RIGHT : null;
3397
3397
  if (m !== null) {
3398
3398
  const S = this._findPointerByMouseButton(m);
3399
3399
  S && this._disposePointer(S);
@@ -3404,9 +3404,9 @@ class ot extends pr {
3404
3404
  clientY: f.clientY,
3405
3405
  deltaX: 0,
3406
3406
  deltaY: 0,
3407
- mouseButton: (f.buttons & V.LEFT) === V.LEFT ? V.LEFT : (f.buttons & V.MIDDLE) === V.LEFT ? V.MIDDLE : (f.buttons & V.RIGHT) === V.LEFT ? V.RIGHT : null
3407
+ mouseButton: (f.buttons & G.LEFT) === G.LEFT ? G.LEFT : (f.buttons & G.MIDDLE) === G.LEFT ? G.MIDDLE : (f.buttons & G.RIGHT) === G.LEFT ? G.RIGHT : null
3408
3408
  };
3409
- this._activePointers.push(g), this._domElement.ownerDocument.removeEventListener("mousemove", l), this._domElement.ownerDocument.removeEventListener("mouseup", d), this._domElement.ownerDocument.addEventListener("mousemove", l), this._domElement.ownerDocument.addEventListener("mouseup", d), this._isDragging = !0, R(f);
3409
+ this._activePointers.push(g), this._domElement.ownerDocument.removeEventListener("mousemove", c), this._domElement.ownerDocument.removeEventListener("mouseup", d), this._domElement.ownerDocument.addEventListener("mousemove", c), this._domElement.ownerDocument.addEventListener("mouseup", d), this._isDragging = !0, R(f);
3410
3410
  }, a = (f) => {
3411
3411
  f.cancelable && f.preventDefault();
3412
3412
  const m = f.pointerId, g = this._lockedPointer || this._findPointerById(m);
@@ -3424,19 +3424,19 @@ class ot extends pr {
3424
3424
  break;
3425
3425
  }
3426
3426
  else
3427
- (!this._isDragging && this._lockedPointer || this._isDragging && (f.buttons & V.LEFT) === V.LEFT) && (this._state = this._state | this.mouseButtons.left), this._isDragging && (f.buttons & V.MIDDLE) === V.MIDDLE && (this._state = this._state | this.mouseButtons.middle), this._isDragging && (f.buttons & V.RIGHT) === V.RIGHT && (this._state = this._state | this.mouseButtons.right);
3427
+ (!this._isDragging && this._lockedPointer || this._isDragging && (f.buttons & G.LEFT) === G.LEFT) && (this._state = this._state | this.mouseButtons.left), this._isDragging && (f.buttons & G.MIDDLE) === G.MIDDLE && (this._state = this._state | this.mouseButtons.middle), this._isDragging && (f.buttons & G.RIGHT) === G.RIGHT && (this._state = this._state | this.mouseButtons.right);
3428
3428
  A();
3429
3429
  }
3430
- }, l = (f) => {
3430
+ }, c = (f) => {
3431
3431
  const m = this._lockedPointer || this._findPointerById(1);
3432
- m && (m.clientX = f.clientX, m.clientY = f.clientY, m.deltaX = f.movementX, m.deltaY = f.movementY, this._state = 0, (this._lockedPointer || (f.buttons & V.LEFT) === V.LEFT) && (this._state = this._state | this.mouseButtons.left), (f.buttons & V.MIDDLE) === V.MIDDLE && (this._state = this._state | this.mouseButtons.middle), (f.buttons & V.RIGHT) === V.RIGHT && (this._state = this._state | this.mouseButtons.right), A());
3432
+ m && (m.clientX = f.clientX, m.clientY = f.clientY, m.deltaX = f.movementX, m.deltaY = f.movementY, this._state = 0, (this._lockedPointer || (f.buttons & G.LEFT) === G.LEFT) && (this._state = this._state | this.mouseButtons.left), (f.buttons & G.MIDDLE) === G.MIDDLE && (this._state = this._state | this.mouseButtons.middle), (f.buttons & G.RIGHT) === G.RIGHT && (this._state = this._state | this.mouseButtons.right), A());
3433
3433
  }, E = (f) => {
3434
3434
  const m = this._findPointerById(f.pointerId);
3435
3435
  if (!(m && m === this._lockedPointer)) {
3436
3436
  if (m && this._disposePointer(m), f.pointerType === "touch")
3437
3437
  switch (this._activePointers.length) {
3438
3438
  case 0:
3439
- this._state = P.NONE;
3439
+ this._state = y.NONE;
3440
3440
  break;
3441
3441
  case 1:
3442
3442
  this._state = this.touches.one;
@@ -3449,45 +3449,45 @@ class ot extends pr {
3449
3449
  break;
3450
3450
  }
3451
3451
  else
3452
- this._state = P.NONE;
3452
+ this._state = y.NONE;
3453
3453
  C();
3454
3454
  }
3455
3455
  }, d = () => {
3456
3456
  const f = this._findPointerById(1);
3457
- f && f === this._lockedPointer || (f && this._disposePointer(f), this._state = P.NONE, C());
3457
+ f && f === this._lockedPointer || (f && this._disposePointer(f), this._state = y.NONE, C());
3458
3458
  };
3459
3459
  let h = -1;
3460
3460
  const u = (f) => {
3461
- if (!this._domElement || !this._enabled || this.mouseButtons.wheel === P.NONE)
3461
+ if (!this._domElement || !this._enabled || this.mouseButtons.wheel === y.NONE)
3462
3462
  return;
3463
3463
  if (this._interactiveArea.left !== 0 || this._interactiveArea.top !== 0 || this._interactiveArea.width !== 1 || this._interactiveArea.height !== 1) {
3464
- const N = this._domElement.getBoundingClientRect(), y = f.clientX / N.width, w = f.clientY / N.height;
3465
- if (y < this._interactiveArea.left || y > this._interactiveArea.right || w < this._interactiveArea.top || w > this._interactiveArea.bottom)
3464
+ const N = this._domElement.getBoundingClientRect(), L = f.clientX / N.width, w = f.clientY / N.height;
3465
+ if (L < this._interactiveArea.left || L > this._interactiveArea.right || w < this._interactiveArea.top || w > this._interactiveArea.bottom)
3466
3466
  return;
3467
3467
  }
3468
- if (f.preventDefault(), this.dollyToCursor || this.mouseButtons.wheel === P.ROTATE || this.mouseButtons.wheel === P.TRUCK) {
3468
+ if (f.preventDefault(), this.dollyToCursor || this.mouseButtons.wheel === y.ROTATE || this.mouseButtons.wheel === y.TRUCK) {
3469
3469
  const N = performance.now();
3470
3470
  h - N < 1e3 && this._getClientRect(this._elementRect), h = N;
3471
3471
  }
3472
3472
  const m = Tr ? -1 : -3, g = f.deltaMode === 1 ? f.deltaY / m : f.deltaY / (m * 10), S = this.dollyToCursor ? (f.clientX - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, _ = this.dollyToCursor ? (f.clientY - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
3473
3473
  switch (this.mouseButtons.wheel) {
3474
- case P.ROTATE: {
3474
+ case y.ROTATE: {
3475
3475
  this._rotateInternal(f.deltaX, f.deltaY), this._isUserControllingRotate = !0;
3476
3476
  break;
3477
3477
  }
3478
- case P.TRUCK: {
3478
+ case y.TRUCK: {
3479
3479
  this._truckInternal(f.deltaX, f.deltaY, !1), this._isUserControllingTruck = !0;
3480
3480
  break;
3481
3481
  }
3482
- case P.OFFSET: {
3482
+ case y.OFFSET: {
3483
3483
  this._truckInternal(f.deltaX, f.deltaY, !0), this._isUserControllingOffset = !0;
3484
3484
  break;
3485
3485
  }
3486
- case P.DOLLY: {
3486
+ case y.DOLLY: {
3487
3487
  this._dollyInternal(-g, S, _), this._isUserControllingDolly = !0;
3488
3488
  break;
3489
3489
  }
3490
- case P.ZOOM: {
3490
+ case y.ZOOM: {
3491
3491
  this._zoomInternal(-g, S, _), this._isUserControllingZoom = !0;
3492
3492
  break;
3493
3493
  }
@@ -3497,7 +3497,7 @@ class ot extends pr {
3497
3497
  if (!(!this._domElement || !this._enabled)) {
3498
3498
  if (this.mouseButtons.right === ot.ACTION.NONE) {
3499
3499
  const m = f instanceof PointerEvent ? f.pointerId : (f instanceof MouseEvent, 0), g = this._findPointerById(m);
3500
- g && this._disposePointer(g), this._domElement.ownerDocument.removeEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("pointerup", E), this._domElement.ownerDocument.removeEventListener("mousemove", l), this._domElement.ownerDocument.removeEventListener("mouseup", d);
3500
+ g && this._disposePointer(g), this._domElement.ownerDocument.removeEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("pointerup", E), this._domElement.ownerDocument.removeEventListener("mousemove", c), this._domElement.ownerDocument.removeEventListener("mouseup", d);
3501
3501
  return;
3502
3502
  }
3503
3503
  f.preventDefault();
@@ -3508,8 +3508,8 @@ class ot extends pr {
3508
3508
  if (Zs(this._activePointers, lt), this._getClientRect(this._elementRect), e.copy(lt), i.copy(lt), this._activePointers.length >= 2) {
3509
3509
  const g = lt.x - this._activePointers[1].clientX, S = lt.y - this._activePointers[1].clientY, _ = Math.sqrt(g * g + S * S);
3510
3510
  o.set(0, _);
3511
- const N = (this._activePointers[0].clientX + this._activePointers[1].clientX) * 0.5, y = (this._activePointers[0].clientY + this._activePointers[1].clientY) * 0.5;
3512
- i.set(N, y);
3511
+ const N = (this._activePointers[0].clientX + this._activePointers[1].clientX) * 0.5, L = (this._activePointers[0].clientY + this._activePointers[1].clientY) * 0.5;
3512
+ i.set(N, L);
3513
3513
  }
3514
3514
  if (this._state = 0, !f)
3515
3515
  this._lockedPointer && (this._state = this._state | this.mouseButtons.left);
@@ -3526,26 +3526,26 @@ class ot extends pr {
3526
3526
  break;
3527
3527
  }
3528
3528
  else
3529
- !this._lockedPointer && (f.buttons & V.LEFT) === V.LEFT && (this._state = this._state | this.mouseButtons.left), (f.buttons & V.MIDDLE) === V.MIDDLE && (this._state = this._state | this.mouseButtons.middle), (f.buttons & V.RIGHT) === V.RIGHT && (this._state = this._state | this.mouseButtons.right);
3530
- ((this._state & P.ROTATE) === P.ROTATE || (this._state & P.TOUCH_ROTATE) === P.TOUCH_ROTATE || (this._state & P.TOUCH_DOLLY_ROTATE) === P.TOUCH_DOLLY_ROTATE || (this._state & P.TOUCH_ZOOM_ROTATE) === P.TOUCH_ZOOM_ROTATE) && (this._sphericalEnd.theta = this._spherical.theta, this._sphericalEnd.phi = this._spherical.phi, this._thetaVelocity.value = 0, this._phiVelocity.value = 0), ((this._state & P.TRUCK) === P.TRUCK || (this._state & P.TOUCH_TRUCK) === P.TOUCH_TRUCK || (this._state & P.TOUCH_DOLLY_TRUCK) === P.TOUCH_DOLLY_TRUCK || (this._state & P.TOUCH_ZOOM_TRUCK) === P.TOUCH_ZOOM_TRUCK) && (this._targetEnd.copy(this._target), this._targetVelocity.set(0, 0, 0)), ((this._state & P.DOLLY) === P.DOLLY || (this._state & P.TOUCH_DOLLY) === P.TOUCH_DOLLY || (this._state & P.TOUCH_DOLLY_TRUCK) === P.TOUCH_DOLLY_TRUCK || (this._state & P.TOUCH_DOLLY_OFFSET) === P.TOUCH_DOLLY_OFFSET || (this._state & P.TOUCH_DOLLY_ROTATE) === P.TOUCH_DOLLY_ROTATE) && (this._sphericalEnd.radius = this._spherical.radius, this._radiusVelocity.value = 0), ((this._state & P.ZOOM) === P.ZOOM || (this._state & P.TOUCH_ZOOM) === P.TOUCH_ZOOM || (this._state & P.TOUCH_ZOOM_TRUCK) === P.TOUCH_ZOOM_TRUCK || (this._state & P.TOUCH_ZOOM_OFFSET) === P.TOUCH_ZOOM_OFFSET || (this._state & P.TOUCH_ZOOM_ROTATE) === P.TOUCH_ZOOM_ROTATE) && (this._zoomEnd = this._zoom, this._zoomVelocity.value = 0), ((this._state & P.OFFSET) === P.OFFSET || (this._state & P.TOUCH_OFFSET) === P.TOUCH_OFFSET || (this._state & P.TOUCH_DOLLY_OFFSET) === P.TOUCH_DOLLY_OFFSET || (this._state & P.TOUCH_ZOOM_OFFSET) === P.TOUCH_ZOOM_OFFSET) && (this._focalOffsetEnd.copy(this._focalOffset), this._focalOffsetVelocity.set(0, 0, 0)), this.dispatchEvent({ type: "controlstart" });
3529
+ !this._lockedPointer && (f.buttons & G.LEFT) === G.LEFT && (this._state = this._state | this.mouseButtons.left), (f.buttons & G.MIDDLE) === G.MIDDLE && (this._state = this._state | this.mouseButtons.middle), (f.buttons & G.RIGHT) === G.RIGHT && (this._state = this._state | this.mouseButtons.right);
3530
+ ((this._state & y.ROTATE) === y.ROTATE || (this._state & y.TOUCH_ROTATE) === y.TOUCH_ROTATE || (this._state & y.TOUCH_DOLLY_ROTATE) === y.TOUCH_DOLLY_ROTATE || (this._state & y.TOUCH_ZOOM_ROTATE) === y.TOUCH_ZOOM_ROTATE) && (this._sphericalEnd.theta = this._spherical.theta, this._sphericalEnd.phi = this._spherical.phi, this._thetaVelocity.value = 0, this._phiVelocity.value = 0), ((this._state & y.TRUCK) === y.TRUCK || (this._state & y.TOUCH_TRUCK) === y.TOUCH_TRUCK || (this._state & y.TOUCH_DOLLY_TRUCK) === y.TOUCH_DOLLY_TRUCK || (this._state & y.TOUCH_ZOOM_TRUCK) === y.TOUCH_ZOOM_TRUCK) && (this._targetEnd.copy(this._target), this._targetVelocity.set(0, 0, 0)), ((this._state & y.DOLLY) === y.DOLLY || (this._state & y.TOUCH_DOLLY) === y.TOUCH_DOLLY || (this._state & y.TOUCH_DOLLY_TRUCK) === y.TOUCH_DOLLY_TRUCK || (this._state & y.TOUCH_DOLLY_OFFSET) === y.TOUCH_DOLLY_OFFSET || (this._state & y.TOUCH_DOLLY_ROTATE) === y.TOUCH_DOLLY_ROTATE) && (this._sphericalEnd.radius = this._spherical.radius, this._radiusVelocity.value = 0), ((this._state & y.ZOOM) === y.ZOOM || (this._state & y.TOUCH_ZOOM) === y.TOUCH_ZOOM || (this._state & y.TOUCH_ZOOM_TRUCK) === y.TOUCH_ZOOM_TRUCK || (this._state & y.TOUCH_ZOOM_OFFSET) === y.TOUCH_ZOOM_OFFSET || (this._state & y.TOUCH_ZOOM_ROTATE) === y.TOUCH_ZOOM_ROTATE) && (this._zoomEnd = this._zoom, this._zoomVelocity.value = 0), ((this._state & y.OFFSET) === y.OFFSET || (this._state & y.TOUCH_OFFSET) === y.TOUCH_OFFSET || (this._state & y.TOUCH_DOLLY_OFFSET) === y.TOUCH_DOLLY_OFFSET || (this._state & y.TOUCH_ZOOM_OFFSET) === y.TOUCH_ZOOM_OFFSET) && (this._focalOffsetEnd.copy(this._focalOffset), this._focalOffsetVelocity.set(0, 0, 0)), this.dispatchEvent({ type: "controlstart" });
3531
3531
  }, A = () => {
3532
3532
  if (!this._enabled || !this._dragNeedsUpdate)
3533
3533
  return;
3534
3534
  this._dragNeedsUpdate = !1, Zs(this._activePointers, lt);
3535
3535
  const m = this._domElement && document.pointerLockElement === this._domElement ? this._lockedPointer || this._activePointers[0] : null, g = m ? -m.deltaX : i.x - lt.x, S = m ? -m.deltaY : i.y - lt.y;
3536
- if (i.copy(lt), ((this._state & P.ROTATE) === P.ROTATE || (this._state & P.TOUCH_ROTATE) === P.TOUCH_ROTATE || (this._state & P.TOUCH_DOLLY_ROTATE) === P.TOUCH_DOLLY_ROTATE || (this._state & P.TOUCH_ZOOM_ROTATE) === P.TOUCH_ZOOM_ROTATE) && (this._rotateInternal(g, S), this._isUserControllingRotate = !0), (this._state & P.DOLLY) === P.DOLLY || (this._state & P.ZOOM) === P.ZOOM) {
3537
- const _ = this.dollyToCursor ? (e.x - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, N = this.dollyToCursor ? (e.y - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0, y = this.dollyDragInverted ? -1 : 1;
3538
- (this._state & P.DOLLY) === P.DOLLY ? (this._dollyInternal(y * S * ds, _, N), this._isUserControllingDolly = !0) : (this._zoomInternal(y * S * ds, _, N), this._isUserControllingZoom = !0);
3536
+ if (i.copy(lt), ((this._state & y.ROTATE) === y.ROTATE || (this._state & y.TOUCH_ROTATE) === y.TOUCH_ROTATE || (this._state & y.TOUCH_DOLLY_ROTATE) === y.TOUCH_DOLLY_ROTATE || (this._state & y.TOUCH_ZOOM_ROTATE) === y.TOUCH_ZOOM_ROTATE) && (this._rotateInternal(g, S), this._isUserControllingRotate = !0), (this._state & y.DOLLY) === y.DOLLY || (this._state & y.ZOOM) === y.ZOOM) {
3537
+ const _ = this.dollyToCursor ? (e.x - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, N = this.dollyToCursor ? (e.y - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0, L = this.dollyDragInverted ? -1 : 1;
3538
+ (this._state & y.DOLLY) === y.DOLLY ? (this._dollyInternal(L * S * ds, _, N), this._isUserControllingDolly = !0) : (this._zoomInternal(L * S * ds, _, N), this._isUserControllingZoom = !0);
3539
3539
  }
3540
- if ((this._state & P.TOUCH_DOLLY) === P.TOUCH_DOLLY || (this._state & P.TOUCH_ZOOM) === P.TOUCH_ZOOM || (this._state & P.TOUCH_DOLLY_TRUCK) === P.TOUCH_DOLLY_TRUCK || (this._state & P.TOUCH_ZOOM_TRUCK) === P.TOUCH_ZOOM_TRUCK || (this._state & P.TOUCH_DOLLY_OFFSET) === P.TOUCH_DOLLY_OFFSET || (this._state & P.TOUCH_ZOOM_OFFSET) === P.TOUCH_ZOOM_OFFSET || (this._state & P.TOUCH_DOLLY_ROTATE) === P.TOUCH_DOLLY_ROTATE || (this._state & P.TOUCH_ZOOM_ROTATE) === P.TOUCH_ZOOM_ROTATE) {
3541
- const _ = lt.x - this._activePointers[1].clientX, N = lt.y - this._activePointers[1].clientY, y = Math.sqrt(_ * _ + N * N), w = o.y - y;
3542
- o.set(0, y);
3543
- const L = this.dollyToCursor ? (i.x - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, U = this.dollyToCursor ? (i.y - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
3544
- (this._state & P.TOUCH_DOLLY) === P.TOUCH_DOLLY || (this._state & P.TOUCH_DOLLY_ROTATE) === P.TOUCH_DOLLY_ROTATE || (this._state & P.TOUCH_DOLLY_TRUCK) === P.TOUCH_DOLLY_TRUCK || (this._state & P.TOUCH_DOLLY_OFFSET) === P.TOUCH_DOLLY_OFFSET ? (this._dollyInternal(w * ds, L, U), this._isUserControllingDolly = !0) : (this._zoomInternal(w * ds, L, U), this._isUserControllingZoom = !0);
3540
+ if ((this._state & y.TOUCH_DOLLY) === y.TOUCH_DOLLY || (this._state & y.TOUCH_ZOOM) === y.TOUCH_ZOOM || (this._state & y.TOUCH_DOLLY_TRUCK) === y.TOUCH_DOLLY_TRUCK || (this._state & y.TOUCH_ZOOM_TRUCK) === y.TOUCH_ZOOM_TRUCK || (this._state & y.TOUCH_DOLLY_OFFSET) === y.TOUCH_DOLLY_OFFSET || (this._state & y.TOUCH_ZOOM_OFFSET) === y.TOUCH_ZOOM_OFFSET || (this._state & y.TOUCH_DOLLY_ROTATE) === y.TOUCH_DOLLY_ROTATE || (this._state & y.TOUCH_ZOOM_ROTATE) === y.TOUCH_ZOOM_ROTATE) {
3541
+ const _ = lt.x - this._activePointers[1].clientX, N = lt.y - this._activePointers[1].clientY, L = Math.sqrt(_ * _ + N * N), w = o.y - L;
3542
+ o.set(0, L);
3543
+ const P = this.dollyToCursor ? (i.x - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, U = this.dollyToCursor ? (i.y - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
3544
+ (this._state & y.TOUCH_DOLLY) === y.TOUCH_DOLLY || (this._state & y.TOUCH_DOLLY_ROTATE) === y.TOUCH_DOLLY_ROTATE || (this._state & y.TOUCH_DOLLY_TRUCK) === y.TOUCH_DOLLY_TRUCK || (this._state & y.TOUCH_DOLLY_OFFSET) === y.TOUCH_DOLLY_OFFSET ? (this._dollyInternal(w * ds, P, U), this._isUserControllingDolly = !0) : (this._zoomInternal(w * ds, P, U), this._isUserControllingZoom = !0);
3545
3545
  }
3546
- ((this._state & P.TRUCK) === P.TRUCK || (this._state & P.TOUCH_TRUCK) === P.TOUCH_TRUCK || (this._state & P.TOUCH_DOLLY_TRUCK) === P.TOUCH_DOLLY_TRUCK || (this._state & P.TOUCH_ZOOM_TRUCK) === P.TOUCH_ZOOM_TRUCK) && (this._truckInternal(g, S, !1), this._isUserControllingTruck = !0), ((this._state & P.OFFSET) === P.OFFSET || (this._state & P.TOUCH_OFFSET) === P.TOUCH_OFFSET || (this._state & P.TOUCH_DOLLY_OFFSET) === P.TOUCH_DOLLY_OFFSET || (this._state & P.TOUCH_ZOOM_OFFSET) === P.TOUCH_ZOOM_OFFSET) && (this._truckInternal(g, S, !0), this._isUserControllingOffset = !0), this.dispatchEvent({ type: "control" });
3546
+ ((this._state & y.TRUCK) === y.TRUCK || (this._state & y.TOUCH_TRUCK) === y.TOUCH_TRUCK || (this._state & y.TOUCH_DOLLY_TRUCK) === y.TOUCH_DOLLY_TRUCK || (this._state & y.TOUCH_ZOOM_TRUCK) === y.TOUCH_ZOOM_TRUCK) && (this._truckInternal(g, S, !1), this._isUserControllingTruck = !0), ((this._state & y.OFFSET) === y.OFFSET || (this._state & y.TOUCH_OFFSET) === y.TOUCH_OFFSET || (this._state & y.TOUCH_DOLLY_OFFSET) === y.TOUCH_DOLLY_OFFSET || (this._state & y.TOUCH_ZOOM_OFFSET) === y.TOUCH_ZOOM_OFFSET) && (this._truckInternal(g, S, !0), this._isUserControllingOffset = !0), this.dispatchEvent({ type: "control" });
3547
3547
  }, C = () => {
3548
- Zs(this._activePointers, lt), i.copy(lt), this._dragNeedsUpdate = !1, (this._activePointers.length === 0 || this._activePointers.length === 1 && this._activePointers[0] === this._lockedPointer) && (this._isDragging = !1), this._activePointers.length === 0 && this._domElement && (this._domElement.ownerDocument.removeEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("mousemove", l), this._domElement.ownerDocument.removeEventListener("pointerup", E), this._domElement.ownerDocument.removeEventListener("mouseup", d), this.dispatchEvent({ type: "controlend" }));
3548
+ Zs(this._activePointers, lt), i.copy(lt), this._dragNeedsUpdate = !1, (this._activePointers.length === 0 || this._activePointers.length === 1 && this._activePointers[0] === this._lockedPointer) && (this._isDragging = !1), this._activePointers.length === 0 && this._domElement && (this._domElement.ownerDocument.removeEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("mousemove", c), this._domElement.ownerDocument.removeEventListener("pointerup", E), this._domElement.ownerDocument.removeEventListener("mouseup", d), this.dispatchEvent({ type: "controlend" }));
3549
3549
  };
3550
3550
  this.lockPointer = () => {
3551
3551
  !this._enabled || !this._domElement || (this.cancel(), this._lockedPointer = {
@@ -3567,9 +3567,9 @@ class ot extends pr {
3567
3567
  this._addAllEventListeners = (f) => {
3568
3568
  this._domElement = f, this._domElement.style.touchAction = "none", this._domElement.style.userSelect = "none", this._domElement.style.webkitUserSelect = "none", this._domElement.addEventListener("pointerdown", n), mr && this._domElement.addEventListener("mousedown", r), this._domElement.addEventListener("pointercancel", E), this._domElement.addEventListener("wheel", u, { passive: !1 }), this._domElement.addEventListener("contextmenu", p);
3569
3569
  }, this._removeAllEventListeners = () => {
3570
- this._domElement && (this._domElement.style.touchAction = "", this._domElement.style.userSelect = "", this._domElement.style.webkitUserSelect = "", this._domElement.removeEventListener("pointerdown", n), this._domElement.removeEventListener("mousedown", r), this._domElement.removeEventListener("pointercancel", E), this._domElement.removeEventListener("wheel", u, { passive: !1 }), this._domElement.removeEventListener("contextmenu", p), this._domElement.ownerDocument.removeEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("mousemove", l), this._domElement.ownerDocument.removeEventListener("pointerup", E), this._domElement.ownerDocument.removeEventListener("mouseup", d), this._domElement.ownerDocument.removeEventListener("pointerlockchange", T), this._domElement.ownerDocument.removeEventListener("pointerlockerror", F));
3570
+ this._domElement && (this._domElement.style.touchAction = "", this._domElement.style.userSelect = "", this._domElement.style.webkitUserSelect = "", this._domElement.removeEventListener("pointerdown", n), this._domElement.removeEventListener("mousedown", r), this._domElement.removeEventListener("pointercancel", E), this._domElement.removeEventListener("wheel", u, { passive: !1 }), this._domElement.removeEventListener("contextmenu", p), this._domElement.ownerDocument.removeEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("mousemove", c), this._domElement.ownerDocument.removeEventListener("pointerup", E), this._domElement.ownerDocument.removeEventListener("mouseup", d), this._domElement.ownerDocument.removeEventListener("pointerlockchange", T), this._domElement.ownerDocument.removeEventListener("pointerlockerror", F));
3571
3571
  }, this.cancel = () => {
3572
- this._state !== P.NONE && (this._state = P.NONE, this._activePointers.length = 0, C());
3572
+ this._state !== y.NONE && (this._state = y.NONE, this._activePointers.length = 0, C());
3573
3573
  }, t && this.connect(t), this.update(0);
3574
3574
  }
3575
3575
  /**
@@ -3825,7 +3825,7 @@ class ot extends pr {
3825
3825
  * @category Methods
3826
3826
  */
3827
3827
  dollyInFixed(s, t = !1) {
3828
- this._targetEnd.add(this._getCameraDirection(ye).multiplyScalar(s)), t || this._target.copy(this._targetEnd);
3828
+ this._targetEnd.add(this._getCameraDirection(Le).multiplyScalar(s)), t || this._target.copy(this._targetEnd);
3829
3829
  const e = !t || k(this._target.x, this._targetEnd.x, this.restThreshold) && k(this._target.y, this._targetEnd.y, this.restThreshold) && k(this._target.z, this._targetEnd.z, this.restThreshold);
3830
3830
  return this._createOnRestPromise(e);
3831
3831
  }
@@ -3867,7 +3867,7 @@ class ot extends pr {
3867
3867
  */
3868
3868
  truck(s, t, e = !1) {
3869
3869
  this._camera.updateMatrix(), St.setFromMatrixColumn(this._camera.matrix, 0), _t.setFromMatrixColumn(this._camera.matrix, 1), St.multiplyScalar(s), _t.multiplyScalar(-t);
3870
- const i = G.copy(St).add(_t), o = z.copy(this._targetEnd).add(i);
3870
+ const i = V.copy(St).add(_t), o = z.copy(this._targetEnd).add(i);
3871
3871
  return this.moveTo(o.x, o.y, o.z, e);
3872
3872
  }
3873
3873
  /**
@@ -3877,8 +3877,8 @@ class ot extends pr {
3877
3877
  * @category Methods
3878
3878
  */
3879
3879
  forward(s, t = !1) {
3880
- G.setFromMatrixColumn(this._camera.matrix, 0), G.crossVectors(this._camera.up, G), G.multiplyScalar(s);
3881
- const e = z.copy(this._targetEnd).add(G);
3880
+ V.setFromMatrixColumn(this._camera.matrix, 0), V.crossVectors(this._camera.up, V), V.multiplyScalar(s);
3881
+ const e = z.copy(this._targetEnd).add(V);
3882
3882
  return this.moveTo(e.x, e.y, e.z, t);
3883
3883
  }
3884
3884
  /**
@@ -3888,7 +3888,7 @@ class ot extends pr {
3888
3888
  * @category Methods
3889
3889
  */
3890
3890
  elevate(s, t = !1) {
3891
- return G.copy(this._camera.up).multiplyScalar(s), this.moveTo(this._targetEnd.x + G.x, this._targetEnd.y + G.y, this._targetEnd.z + G.z, t);
3891
+ return V.copy(this._camera.up).multiplyScalar(s), this.moveTo(this._targetEnd.x + V.x, this._targetEnd.y + V.y, this._targetEnd.z + V.z, t);
3892
3892
  }
3893
3893
  /**
3894
3894
  * Move target position to given point.
@@ -3900,7 +3900,7 @@ class ot extends pr {
3900
3900
  */
3901
3901
  moveTo(s, t, e, i = !1) {
3902
3902
  this._isUserControllingTruck = !1;
3903
- const o = G.set(s, t, e).sub(this._targetEnd);
3903
+ const o = V.set(s, t, e).sub(this._targetEnd);
3904
3904
  this._encloseToBoundary(this._targetEnd, o, this.boundaryFriction), this._needsUpdate = !0, i || this._target.copy(this._targetEnd);
3905
3905
  const n = !i || k(this._target.x, this._targetEnd.x, this.restThreshold) && k(this._target.y, this._targetEnd.y, this.restThreshold) && k(this._target.z, this._targetEnd.z, this.restThreshold);
3906
3906
  return this._createOnRestPromise(n);
@@ -3915,7 +3915,7 @@ class ot extends pr {
3915
3915
  * @category Methods
3916
3916
  */
3917
3917
  lookInDirectionOf(s, t, e, i = !1) {
3918
- const r = G.set(s, t, e).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius);
3918
+ const r = V.set(s, t, e).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius);
3919
3919
  return this.setPosition(r.x, r.y, r.z, i);
3920
3920
  }
3921
3921
  /**
@@ -3932,15 +3932,15 @@ class ot extends pr {
3932
3932
  * @category Methods
3933
3933
  */
3934
3934
  fitToBox(s, t, { cover: e = !1, paddingLeft: i = 0, paddingRight: o = 0, paddingBottom: n = 0, paddingTop: r = 0 } = {}) {
3935
- const a = [], l = s.isBox3 ? de.copy(s) : de.setFromObject(s);
3936
- l.isEmpty() && (console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"), Promise.resolve());
3935
+ const a = [], c = s.isBox3 ? de.copy(s) : de.setFromObject(s);
3936
+ c.isEmpty() && (console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"), Promise.resolve());
3937
3937
  const E = Ki(this._sphericalEnd.theta, $i), d = Ki(this._sphericalEnd.phi, $i);
3938
3938
  a.push(this.rotateTo(E, d, t));
3939
- const h = G.setFromSpherical(this._sphericalEnd).normalize(), u = on.setFromUnitVectors(h, js), p = k(Math.abs(h.y), 1);
3939
+ const h = V.setFromSpherical(this._sphericalEnd).normalize(), u = on.setFromUnitVectors(h, js), p = k(Math.abs(h.y), 1);
3940
3940
  p && u.multiply($s.setFromAxisAngle(us, E)), u.multiply(this._yAxisUpSpaceInverse);
3941
3941
  const R = nn.makeEmpty();
3942
- z.copy(l.min).applyQuaternion(u), R.expandByPoint(z), z.copy(l.min).setX(l.max.x).applyQuaternion(u), R.expandByPoint(z), z.copy(l.min).setY(l.max.y).applyQuaternion(u), R.expandByPoint(z), z.copy(l.max).setZ(l.min.z).applyQuaternion(u), R.expandByPoint(z), z.copy(l.min).setZ(l.max.z).applyQuaternion(u), R.expandByPoint(z), z.copy(l.max).setY(l.min.y).applyQuaternion(u), R.expandByPoint(z), z.copy(l.max).setX(l.min.x).applyQuaternion(u), R.expandByPoint(z), z.copy(l.max).applyQuaternion(u), R.expandByPoint(z), R.min.x -= i, R.min.y -= n, R.max.x += o, R.max.y += r, u.setFromUnitVectors(js, h), p && u.premultiply($s.invert()), u.premultiply(this._yAxisUpSpace);
3943
- const A = R.getSize(G), C = R.getCenter(z).applyQuaternion(u);
3942
+ z.copy(c.min).applyQuaternion(u), R.expandByPoint(z), z.copy(c.min).setX(c.max.x).applyQuaternion(u), R.expandByPoint(z), z.copy(c.min).setY(c.max.y).applyQuaternion(u), R.expandByPoint(z), z.copy(c.max).setZ(c.min.z).applyQuaternion(u), R.expandByPoint(z), z.copy(c.min).setZ(c.max.z).applyQuaternion(u), R.expandByPoint(z), z.copy(c.max).setY(c.min.y).applyQuaternion(u), R.expandByPoint(z), z.copy(c.max).setX(c.min.x).applyQuaternion(u), R.expandByPoint(z), z.copy(c.max).applyQuaternion(u), R.expandByPoint(z), R.min.x -= i, R.min.y -= n, R.max.x += o, R.max.y += r, u.setFromUnitVectors(js, h), p && u.premultiply($s.invert()), u.premultiply(this._yAxisUpSpace);
3943
+ const A = R.getSize(V), C = R.getCenter(z).applyQuaternion(u);
3944
3944
  if (Zt(this._camera)) {
3945
3945
  const T = this.getDistanceToFitBox(A.x, A.y, A.z, e);
3946
3946
  a.push(this.moveTo(C.x, C.y, C.z, t)), a.push(this.dollyTo(T, t)), a.push(this.setFocalOffset(0, 0, 0, t));
@@ -3962,8 +3962,8 @@ class ot extends pr {
3962
3962
  const n = this.getDistanceToFitSphere(o.radius);
3963
3963
  e.push(this.dollyTo(n, t));
3964
3964
  } else if (vt(this._camera)) {
3965
- const n = this._camera.right - this._camera.left, r = this._camera.top - this._camera.bottom, a = 2 * o.radius, l = Math.min(n / a, r / a);
3966
- e.push(this.zoomTo(l, t));
3965
+ const n = this._camera.right - this._camera.left, r = this._camera.top - this._camera.bottom, a = 2 * o.radius, c = Math.min(n / a, r / a);
3966
+ e.push(this.zoomTo(c, t));
3967
3967
  }
3968
3968
  return e.push(this.setFocalOffset(0, 0, 0, t)), Promise.all(e);
3969
3969
  }
@@ -3980,8 +3980,8 @@ class ot extends pr {
3980
3980
  */
3981
3981
  setLookAt(s, t, e, i, o, n, r = !1) {
3982
3982
  this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection = le.NONE, this._changedDolly = 0;
3983
- const a = z.set(i, o, n), l = G.set(s, t, e);
3984
- this._targetEnd.copy(a), this._sphericalEnd.setFromVector3(l.sub(a).applyQuaternion(this._yAxisUpSpace)), this.normalizeRotations(), this._needsUpdate = !0, r || (this._target.copy(this._targetEnd), this._spherical.copy(this._sphericalEnd));
3983
+ const a = z.set(i, o, n), c = V.set(s, t, e);
3984
+ this._targetEnd.copy(a), this._sphericalEnd.setFromVector3(c.sub(a).applyQuaternion(this._yAxisUpSpace)), this.normalizeRotations(), this._needsUpdate = !0, r || (this._target.copy(this._targetEnd), this._spherical.copy(this._sphericalEnd));
3985
3985
  const E = !r || k(this._target.x, this._targetEnd.x, this.restThreshold) && k(this._target.y, this._targetEnd.y, this.restThreshold) && k(this._target.z, this._targetEnd.z, this.restThreshold) && k(this._spherical.theta, this._sphericalEnd.theta, this.restThreshold) && k(this._spherical.phi, this._sphericalEnd.phi, this.restThreshold) && k(this._spherical.radius, this._sphericalEnd.radius, this.restThreshold);
3986
3986
  return this._createOnRestPromise(E);
3987
3987
  }
@@ -4003,13 +4003,13 @@ class ot extends pr {
4003
4003
  * @param enableTransition
4004
4004
  * @category Methods
4005
4005
  */
4006
- lerpLookAt(s, t, e, i, o, n, r, a, l, E, d, h, u, p = !1) {
4006
+ lerpLookAt(s, t, e, i, o, n, r, a, c, E, d, h, u, p = !1) {
4007
4007
  this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection = le.NONE, this._changedDolly = 0;
4008
- const R = G.set(i, o, n), A = z.set(s, t, e);
4008
+ const R = V.set(i, o, n), A = z.set(s, t, e);
4009
4009
  ut.setFromVector3(A.sub(R).applyQuaternion(this._yAxisUpSpace));
4010
- const C = Ee.set(E, d, h), T = z.set(r, a, l);
4011
- Le.setFromVector3(T.sub(C).applyQuaternion(this._yAxisUpSpace)), this._targetEnd.copy(R.lerp(C, u));
4012
- const F = Le.theta - ut.theta, f = Le.phi - ut.phi, m = Le.radius - ut.radius;
4010
+ const C = Ee.set(E, d, h), T = z.set(r, a, c);
4011
+ Pe.setFromVector3(T.sub(C).applyQuaternion(this._yAxisUpSpace)), this._targetEnd.copy(R.lerp(C, u));
4012
+ const F = Pe.theta - ut.theta, f = Pe.phi - ut.phi, m = Pe.radius - ut.radius;
4013
4013
  this._sphericalEnd.set(ut.radius + m * u, ut.phi + f * u, ut.theta + F * u), this.normalizeRotations(), this._needsUpdate = !0, p || (this._target.copy(this._targetEnd), this._spherical.copy(this._sphericalEnd));
4014
4014
  const g = !p || k(this._target.x, this._targetEnd.x, this.restThreshold) && k(this._target.y, this._targetEnd.y, this.restThreshold) && k(this._target.z, this._targetEnd.z, this.restThreshold) && k(this._spherical.theta, this._sphericalEnd.theta, this.restThreshold) && k(this._spherical.phi, this._sphericalEnd.phi, this.restThreshold) && k(this._spherical.radius, this._sphericalEnd.radius, this.restThreshold);
4015
4015
  return this._createOnRestPromise(g);
@@ -4036,7 +4036,7 @@ class ot extends pr {
4036
4036
  * @category Methods
4037
4037
  */
4038
4038
  setTarget(s, t, e, i = !1) {
4039
- const o = this.getPosition(G), n = this.setLookAt(o.x, o.y, o.z, s, t, e, i);
4039
+ const o = this.getPosition(V), n = this.setLookAt(o.x, o.y, o.z, s, t, e, i);
4040
4040
  return this._sphericalEnd.phi = mt(this._sphericalEnd.phi, this.minPolarAngle, this.maxPolarAngle), n;
4041
4041
  }
4042
4042
  /**
@@ -4062,8 +4062,8 @@ class ot extends pr {
4062
4062
  */
4063
4063
  setOrbitPoint(s, t, e) {
4064
4064
  this._camera.updateMatrixWorld(), St.setFromMatrixColumn(this._camera.matrixWorldInverse, 0), _t.setFromMatrixColumn(this._camera.matrixWorldInverse, 1), Qt.setFromMatrixColumn(this._camera.matrixWorldInverse, 2);
4065
- const i = G.set(s, t, e), o = i.distanceTo(this._camera.position), n = i.sub(this._camera.position);
4066
- St.multiplyScalar(n.x), _t.multiplyScalar(n.y), Qt.multiplyScalar(n.z), G.copy(St).add(_t).add(Qt), G.z = G.z + o, this.dollyTo(o, !1), this.setFocalOffset(-G.x, G.y, -G.z, !1), this.moveTo(s, t, e, !1);
4065
+ const i = V.set(s, t, e), o = i.distanceTo(this._camera.position), n = i.sub(this._camera.position);
4066
+ St.multiplyScalar(n.x), _t.multiplyScalar(n.y), Qt.multiplyScalar(n.z), V.copy(St).add(_t).add(Qt), V.z = V.z + o, this.dollyTo(o, !1), this.setFocalOffset(-V.x, V.y, -V.z, !1), this.moveTo(s, t, e, !1);
4067
4067
  }
4068
4068
  /**
4069
4069
  * Set the boundary box that encloses the target of the camera. box3 is in THREE.Box3
@@ -4170,7 +4170,7 @@ class ot extends pr {
4170
4170
  reset(s = !1) {
4171
4171
  if (!k(this._camera.up.x, this._cameraUp0.x) || !k(this._camera.up.y, this._cameraUp0.y) || !k(this._camera.up.z, this._cameraUp0.z)) {
4172
4172
  this._camera.up.copy(this._cameraUp0);
4173
- const e = this.getPosition(G);
4173
+ const e = this.getPosition(V);
4174
4174
  this.updateCameraUp(), this.setPosition(e.x, e.y, e.z);
4175
4175
  }
4176
4176
  const t = [
@@ -4201,9 +4201,9 @@ class ot extends pr {
4201
4201
  * @category Methods
4202
4202
  */
4203
4203
  applyCameraUp() {
4204
- const s = G.subVectors(this._target, this._camera.position).normalize(), t = z.crossVectors(s, this._camera.up);
4204
+ const s = V.subVectors(this._target, this._camera.position).normalize(), t = z.crossVectors(s, this._camera.up);
4205
4205
  this._camera.up.crossVectors(t, s).normalize(), this._camera.updateMatrixWorld();
4206
- const e = this.getPosition(G);
4206
+ const e = this.getPosition(V);
4207
4207
  this.updateCameraUp(), this.setPosition(e.x, e.y, e.z);
4208
4208
  }
4209
4209
  /**
@@ -4253,9 +4253,9 @@ class ot extends pr {
4253
4253
  }
4254
4254
  if (this.dollyToCursor) {
4255
4255
  if (Zt(this._camera) && this._changedDolly !== 0) {
4256
- const d = this._spherical.radius - this._lastDistance, h = this._camera, u = this._getCameraDirection(ye), p = G.copy(u).cross(h.up).normalize();
4256
+ const d = this._spherical.radius - this._lastDistance, h = this._camera, u = this._getCameraDirection(Le), p = V.copy(u).cross(h.up).normalize();
4257
4257
  p.lengthSq() === 0 && (p.x = 1);
4258
- const R = z.crossVectors(p, u), A = this._sphericalEnd.radius * Math.tan(h.getEffectiveFOV() * _e * 0.5), T = (this._sphericalEnd.radius - d - this._sphericalEnd.radius) / this._sphericalEnd.radius, F = Ee.copy(this._targetEnd).add(p.multiplyScalar(this._dollyControlCoord.x * A * h.aspect)).add(R.multiplyScalar(this._dollyControlCoord.y * A)), f = G.copy(this._targetEnd).lerp(F, T), m = this._lastDollyDirection === le.IN && this._spherical.radius <= this.minDistance, g = this._lastDollyDirection === le.OUT && this.maxDistance <= this._spherical.radius;
4258
+ const R = z.crossVectors(p, u), A = this._sphericalEnd.radius * Math.tan(h.getEffectiveFOV() * _e * 0.5), T = (this._sphericalEnd.radius - d - this._sphericalEnd.radius) / this._sphericalEnd.radius, F = Ee.copy(this._targetEnd).add(p.multiplyScalar(this._dollyControlCoord.x * A * h.aspect)).add(R.multiplyScalar(this._dollyControlCoord.y * A)), f = V.copy(this._targetEnd).lerp(F, T), m = this._lastDollyDirection === le.IN && this._spherical.radius <= this.minDistance, g = this._lastDollyDirection === le.OUT && this.maxDistance <= this._spherical.radius;
4259
4259
  if (this.infinityDolly && (m || g)) {
4260
4260
  this._sphericalEnd.radius -= d, this._spherical.radius -= d;
4261
4261
  const _ = z.copy(u).multiplyScalar(-d);
@@ -4265,7 +4265,7 @@ class ot extends pr {
4265
4265
  const S = z.subVectors(f, this._targetEnd);
4266
4266
  this._targetEnd.copy(f), this._target.add(S), this._changedDolly -= d, X(this._changedDolly) && (this._changedDolly = 0);
4267
4267
  } else if (vt(this._camera) && this._changedZoom !== 0) {
4268
- const d = this._zoom - this._lastZoom, h = this._camera, u = G.set(this._dollyControlCoord.x, this._dollyControlCoord.y, (h.near + h.far) / (h.near - h.far)).unproject(h), p = z.set(0, 0, -1).applyQuaternion(h.quaternion), R = Ee.copy(u).add(p.multiplyScalar(-u.dot(h.up))), C = -(this._zoom - d - this._zoom) / this._zoom, T = this._getCameraDirection(ye), F = this._targetEnd.dot(T), f = G.copy(this._targetEnd).lerp(R, C), m = f.dot(T), g = T.multiplyScalar(m - F);
4268
+ const d = this._zoom - this._lastZoom, h = this._camera, u = V.set(this._dollyControlCoord.x, this._dollyControlCoord.y, (h.near + h.far) / (h.near - h.far)).unproject(h), p = z.set(0, 0, -1).applyQuaternion(h.quaternion), R = Ee.copy(u).add(p.multiplyScalar(-u.dot(h.up))), C = -(this._zoom - d - this._zoom) / this._zoom, T = this._getCameraDirection(Le), F = this._targetEnd.dot(T), f = V.copy(this._targetEnd).lerp(R, C), m = f.dot(T), g = T.multiplyScalar(m - F);
4269
4269
  f.sub(g), this._boundary.clampPoint(f, f);
4270
4270
  const S = z.subVectors(f, this._targetEnd);
4271
4271
  this._targetEnd.copy(f), this._target.add(S), this._changedZoom -= d, X(this._changedZoom) && (this._changedZoom = 0);
@@ -4273,7 +4273,7 @@ class ot extends pr {
4273
4273
  }
4274
4274
  this._camera.zoom !== this._zoom && (this._camera.zoom = this._zoom, this._camera.updateProjectionMatrix(), this._updateNearPlaneCorners(), this._needsUpdate = !0), this._dragNeedsUpdate = !0;
4275
4275
  const a = this._collisionTest();
4276
- this._spherical.radius = Math.min(this._spherical.radius, a), this._spherical.makeSafe(), this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target), this._camera.lookAt(this._target), (!X(this._focalOffset.x) || !X(this._focalOffset.y) || !X(this._focalOffset.z)) && (this._camera.updateMatrixWorld(), St.setFromMatrixColumn(this._camera.matrix, 0), _t.setFromMatrixColumn(this._camera.matrix, 1), Qt.setFromMatrixColumn(this._camera.matrix, 2), St.multiplyScalar(this._focalOffset.x), _t.multiplyScalar(-this._focalOffset.y), Qt.multiplyScalar(this._focalOffset.z), G.copy(St).add(_t).add(Qt), this._camera.position.add(G)), this._boundaryEnclosesCamera && this._encloseToBoundary(this._camera.position.copy(this._target), G.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse), 1);
4276
+ this._spherical.radius = Math.min(this._spherical.radius, a), this._spherical.makeSafe(), this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target), this._camera.lookAt(this._target), (!X(this._focalOffset.x) || !X(this._focalOffset.y) || !X(this._focalOffset.z)) && (this._camera.updateMatrixWorld(), St.setFromMatrixColumn(this._camera.matrix, 0), _t.setFromMatrixColumn(this._camera.matrix, 1), Qt.setFromMatrixColumn(this._camera.matrix, 2), St.multiplyScalar(this._focalOffset.x), _t.multiplyScalar(-this._focalOffset.y), Qt.multiplyScalar(this._focalOffset.z), V.copy(St).add(_t).add(Qt), this._camera.position.add(V)), this._boundaryEnclosesCamera && this._encloseToBoundary(this._camera.position.copy(this._target), V.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse), 1);
4277
4277
  const E = this._needsUpdate;
4278
4278
  return E && !this._updatedLastTime ? (this._hasRested = !1, this.dispatchEvent({ type: "wake" }), this.dispatchEvent({ type: "update" })) : E ? (this.dispatchEvent({ type: "update" }), X(t, this.restThreshold) && X(e, this.restThreshold) && X(i, this.restThreshold) && X(o.x, this.restThreshold) && X(o.y, this.restThreshold) && X(o.z, this.restThreshold) && X(n.x, this.restThreshold) && X(n.y, this.restThreshold) && X(n.z, this.restThreshold) && X(r, this.restThreshold) && !this._hasRested && (this._hasRested = !0, this.dispatchEvent({ type: "rest" }))) : !E && this._updatedLastTime && this.dispatchEvent({ type: "sleep" }), this._lastDistance = this._spherical.radius, this._lastZoom = this._zoom, this._updatedLastTime = E, this._needsUpdate = !1, E;
4279
4279
  }
@@ -4299,7 +4299,7 @@ class ot extends pr {
4299
4299
  dollyToCursor: this.dollyToCursor,
4300
4300
  verticalDragToForward: this.verticalDragToForward,
4301
4301
  target: this._targetEnd.toArray(),
4302
- position: G.setFromSpherical(this._sphericalEnd).add(this._targetEnd).toArray(),
4302
+ position: V.setFromSpherical(this._sphericalEnd).add(this._targetEnd).toArray(),
4303
4303
  zoom: this._zoomEnd,
4304
4304
  focalOffset: this._focalOffsetEnd.toArray(),
4305
4305
  target0: this._target0.toArray(),
@@ -4316,7 +4316,7 @@ class ot extends pr {
4316
4316
  */
4317
4317
  fromJSON(s, t = !1) {
4318
4318
  const e = JSON.parse(s);
4319
- this.enabled = e.enabled, this.minDistance = e.minDistance, this.maxDistance = Pe(e.maxDistance), this.minZoom = e.minZoom, this.maxZoom = Pe(e.maxZoom), this.minPolarAngle = e.minPolarAngle, this.maxPolarAngle = Pe(e.maxPolarAngle), this.minAzimuthAngle = Pe(e.minAzimuthAngle), this.maxAzimuthAngle = Pe(e.maxAzimuthAngle), this.smoothTime = e.smoothTime, this.draggingSmoothTime = e.draggingSmoothTime, this.dollySpeed = e.dollySpeed, this.truckSpeed = e.truckSpeed, this.dollyToCursor = e.dollyToCursor, this.verticalDragToForward = e.verticalDragToForward, this._target0.fromArray(e.target0), this._position0.fromArray(e.position0), this._zoom0 = e.zoom0, this._focalOffset0.fromArray(e.focalOffset0), this.moveTo(e.target[0], e.target[1], e.target[2], t), ut.setFromVector3(G.fromArray(e.position).sub(this._targetEnd).applyQuaternion(this._yAxisUpSpace)), this.rotateTo(ut.theta, ut.phi, t), this.dollyTo(ut.radius, t), this.zoomTo(e.zoom, t), this.setFocalOffset(e.focalOffset[0], e.focalOffset[1], e.focalOffset[2], t), this._needsUpdate = !0;
4319
+ this.enabled = e.enabled, this.minDistance = e.minDistance, this.maxDistance = ye(e.maxDistance), this.minZoom = e.minZoom, this.maxZoom = ye(e.maxZoom), this.minPolarAngle = e.minPolarAngle, this.maxPolarAngle = ye(e.maxPolarAngle), this.minAzimuthAngle = ye(e.minAzimuthAngle), this.maxAzimuthAngle = ye(e.maxAzimuthAngle), this.smoothTime = e.smoothTime, this.draggingSmoothTime = e.draggingSmoothTime, this.dollySpeed = e.dollySpeed, this.truckSpeed = e.truckSpeed, this.dollyToCursor = e.dollyToCursor, this.verticalDragToForward = e.verticalDragToForward, this._target0.fromArray(e.target0), this._position0.fromArray(e.position0), this._zoom0 = e.zoom0, this._focalOffset0.fromArray(e.focalOffset0), this.moveTo(e.target[0], e.target[1], e.target[2], t), ut.setFromVector3(V.fromArray(e.position).sub(this._targetEnd).applyQuaternion(this._yAxisUpSpace)), this.rotateTo(ut.theta, ut.phi, t), this.dollyTo(ut.radius, t), this.zoomTo(e.zoom, t), this.setFocalOffset(e.focalOffset[0], e.focalOffset[1], e.focalOffset[2], t), this._needsUpdate = !0;
4320
4320
  }
4321
4321
  /**
4322
4322
  * Attach all internal event handlers to enable drag control.
@@ -4371,8 +4371,8 @@ class ot extends pr {
4371
4371
  if (e === 0)
4372
4372
  return s.add(t).add(r);
4373
4373
  {
4374
- const l = 1 + e * a / t.dot(r);
4375
- return s.add(z.copy(t).multiplyScalar(l)).add(r.multiplyScalar(1 - e));
4374
+ const c = 1 + e * a / t.dot(r);
4375
+ return s.add(z.copy(t).multiplyScalar(c)).add(r.multiplyScalar(1 - e));
4376
4376
  }
4377
4377
  }
4378
4378
  _updateNearPlaneCorners() {
@@ -4389,7 +4389,7 @@ class ot extends pr {
4389
4389
  let s = 1 / 0;
4390
4390
  if (!(this.colliderMeshes.length >= 1) || Qs(this._camera, "_collisionTest"))
4391
4391
  return s;
4392
- const e = this._getTargetDirection(ye);
4392
+ const e = this._getTargetDirection(Le);
4393
4393
  Ks.lookAt(tn, e, this._camera.up);
4394
4394
  for (let i = 0; i < 4; i++) {
4395
4395
  const o = z.copy(this._nearPlaneCorners[i]);
@@ -4468,7 +4468,7 @@ class ot extends pr {
4468
4468
  a.applyMatrix4(r.matrixWorld);
4469
4469
  const E = a.attributes.position;
4470
4470
  for (let d = 0, h = E.count; d < h; d++)
4471
- G.fromBufferAttribute(E, d), o = Math.max(o, i.distanceToSquared(G));
4471
+ V.fromBufferAttribute(E, d), o = Math.max(o, i.distanceToSquared(V));
4472
4472
  }), e.radius = Math.sqrt(o), e;
4473
4473
  }
4474
4474
  }
@@ -4617,7 +4617,7 @@ class Rr {
4617
4617
  this.world = t;
4618
4618
  const { color: i, size1: o, size2: n, distance: r } = e;
4619
4619
  this.components = s;
4620
- const a = new O.PlaneGeometry(2, 2, 1, 1), l = new O.ShaderMaterial({
4620
+ const a = new O.PlaneGeometry(2, 2, 1, 1), c = new O.ShaderMaterial({
4621
4621
  side: O.DoubleSide,
4622
4622
  uniforms: {
4623
4623
  uSize1: {
@@ -4707,7 +4707,7 @@ class Rr {
4707
4707
  derivatives: !0
4708
4708
  }
4709
4709
  });
4710
- this._grid = new O.Mesh(a, l), this._grid.frustumCulled = !1, t.scene.three.add(this._grid), this.setupEvents(!0);
4710
+ this._grid = new O.Mesh(a, c), this._grid.frustumCulled = !1, t.scene.three.add(this._grid), this.setupEvents(!0);
4711
4711
  }
4712
4712
  /** {@link Hideable.visible} */
4713
4713
  get visible() {
@@ -4786,7 +4786,7 @@ class Ar extends it {
4786
4786
  }
4787
4787
  }
4788
4788
  I(Ar, "uuid", "d1e814d5-b81c-4452-87a2-f039375e0489");
4789
- const jt = new zn(), nt = new M(), bt = new M(), j = new yt(), rn = {
4789
+ const jt = new zn(), nt = new M(), bt = new M(), j = new Lt(), rn = {
4790
4790
  X: new M(1, 0, 0),
4791
4791
  Y: new M(0, 1, 0),
4792
4792
  Z: new M(0, 0, 1)
@@ -4794,9 +4794,9 @@ const jt = new zn(), nt = new M(), bt = new M(), j = new yt(), rn = {
4794
4794
  class Fr extends ei {
4795
4795
  constructor(s, t) {
4796
4796
  super(), t === void 0 && (console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'), t = document), this.isTransformControls = !0, this.visible = !1, this.domElement = t, this.domElement.style.touchAction = "none";
4797
- const e = new Pr();
4797
+ const e = new yr();
4798
4798
  this._gizmo = e, this.add(e);
4799
- const i = new yr();
4799
+ const i = new Lr();
4800
4800
  this._plane = i, this.add(i);
4801
4801
  const o = this;
4802
4802
  function n(T, F) {
@@ -4811,8 +4811,8 @@ class Fr extends ei {
4811
4811
  }), o[T] = F, i[T] = F, e[T] = F;
4812
4812
  }
4813
4813
  n("camera", s), n("object", void 0), n("enabled", !0), n("axis", null), n("mode", "translate"), n("translationSnap", null), n("rotationSnap", null), n("scaleSnap", null), n("space", "world"), n("size", 1), n("dragging", !1), n("showX", !0), n("showY", !0), n("showZ", !0);
4814
- const r = new M(), a = new M(), l = new yt(), E = new yt(), d = new M(), h = new yt(), u = new M(), p = new M(), R = new M(), A = 0, C = new M();
4815
- n("worldPosition", r), n("worldPositionStart", a), n("worldQuaternion", l), n("worldQuaternionStart", E), n("cameraPosition", d), n("cameraQuaternion", h), n("pointStart", u), n("pointEnd", p), n("rotationAxis", R), n("rotationAngle", A), n("eye", C), this._offset = new M(), this._startNorm = new M(), this._endNorm = new M(), this._cameraScale = new M(), this._parentPosition = new M(), this._parentQuaternion = new yt(), this._parentQuaternionInv = new yt(), this._parentScale = new M(), this._worldScaleStart = new M(), this._worldQuaternionInv = new yt(), this._worldScale = new M(), this._positionStart = new M(), this._quaternionStart = new yt(), this._scaleStart = new M(), this._getPointer = gr.bind(this), this._onPointerDown = Sr.bind(this), this._onPointerHover = Or.bind(this), this._onPointerMove = _r.bind(this), this._onPointerUp = Nr.bind(this), this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointermove", this._onPointerHover), this.domElement.addEventListener("pointerup", this._onPointerUp);
4814
+ const r = new M(), a = new M(), c = new Lt(), E = new Lt(), d = new M(), h = new Lt(), u = new M(), p = new M(), R = new M(), A = 0, C = new M();
4815
+ n("worldPosition", r), n("worldPositionStart", a), n("worldQuaternion", c), n("worldQuaternionStart", E), n("cameraPosition", d), n("cameraQuaternion", h), n("pointStart", u), n("pointEnd", p), n("rotationAxis", R), n("rotationAngle", A), n("eye", C), this._offset = new M(), this._startNorm = new M(), this._endNorm = new M(), this._cameraScale = new M(), this._parentPosition = new M(), this._parentQuaternion = new Lt(), this._parentQuaternionInv = new Lt(), this._parentScale = new M(), this._worldScaleStart = new M(), this._worldQuaternionInv = new Lt(), this._worldScale = new M(), this._positionStart = new M(), this._quaternionStart = new Lt(), this._scaleStart = new M(), this._getPointer = gr.bind(this), this._onPointerDown = Sr.bind(this), this._onPointerHover = Or.bind(this), this._onPointerMove = _r.bind(this), this._onPointerUp = Nr.bind(this), this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointermove", this._onPointerHover), this.domElement.addEventListener("pointerup", this._onPointerUp);
4816
4816
  }
4817
4817
  // updateMatrixWorld updates key transformation variables
4818
4818
  updateMatrixWorld() {
@@ -4903,49 +4903,49 @@ class Fr extends ei {
4903
4903
  this.space = s;
4904
4904
  }
4905
4905
  }
4906
- function gr(c) {
4906
+ function gr(l) {
4907
4907
  if (this.domElement.ownerDocument.pointerLockElement)
4908
4908
  return {
4909
4909
  x: 0,
4910
4910
  y: 0,
4911
- button: c.button
4911
+ button: l.button
4912
4912
  };
4913
4913
  {
4914
4914
  const s = this.domElement.getBoundingClientRect();
4915
4915
  return {
4916
- x: (c.clientX - s.left) / s.width * 2 - 1,
4917
- y: -(c.clientY - s.top) / s.height * 2 + 1,
4918
- button: c.button
4916
+ x: (l.clientX - s.left) / s.width * 2 - 1,
4917
+ y: -(l.clientY - s.top) / s.height * 2 + 1,
4918
+ button: l.button
4919
4919
  };
4920
4920
  }
4921
4921
  }
4922
- function Or(c) {
4922
+ function Or(l) {
4923
4923
  if (this.enabled)
4924
- switch (c.pointerType) {
4924
+ switch (l.pointerType) {
4925
4925
  case "mouse":
4926
4926
  case "pen":
4927
- this.pointerHover(this._getPointer(c));
4927
+ this.pointerHover(this._getPointer(l));
4928
4928
  break;
4929
4929
  }
4930
4930
  }
4931
- function Sr(c) {
4932
- this.enabled && (document.pointerLockElement || this.domElement.setPointerCapture(c.pointerId), this.domElement.addEventListener("pointermove", this._onPointerMove), this.pointerHover(this._getPointer(c)), this.pointerDown(this._getPointer(c)));
4931
+ function Sr(l) {
4932
+ this.enabled && (document.pointerLockElement || this.domElement.setPointerCapture(l.pointerId), this.domElement.addEventListener("pointermove", this._onPointerMove), this.pointerHover(this._getPointer(l)), this.pointerDown(this._getPointer(l)));
4933
4933
  }
4934
- function _r(c) {
4935
- this.enabled && this.pointerMove(this._getPointer(c));
4934
+ function _r(l) {
4935
+ this.enabled && this.pointerMove(this._getPointer(l));
4936
4936
  }
4937
- function Nr(c) {
4938
- this.enabled && (this.domElement.releasePointerCapture(c.pointerId), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.pointerUp(this._getPointer(c)));
4937
+ function Nr(l) {
4938
+ this.enabled && (this.domElement.releasePointerCapture(l.pointerId), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.pointerUp(this._getPointer(l)));
4939
4939
  }
4940
- function ti(c, s, t) {
4941
- const e = s.intersectObject(c, !0);
4940
+ function ti(l, s, t) {
4941
+ const e = s.intersectObject(l, !0);
4942
4942
  for (let i = 0; i < e.length; i++)
4943
4943
  if (e[i].object.visible || t)
4944
4944
  return e[i];
4945
4945
  return !1;
4946
4946
  }
4947
- const fs = new Hn(), W = new M(0, 1, 0), hn = new M(0, 0, 0), En = new Mt(), ps = new yt(), Rs = new yt(), Nt = new M(), dn = new Mt(), De = new M(1, 0, 0), qt = new M(0, 1, 0), Ue = new M(0, 0, 1), Cs = new M(), Me = new M(), we = new M();
4948
- class Pr extends ei {
4947
+ const fs = new Hn(), W = new M(0, 1, 0), hn = new M(0, 0, 0), En = new Mt(), ps = new Lt(), Rs = new Lt(), Nt = new M(), dn = new Mt(), De = new M(1, 0, 0), qt = new M(0, 1, 0), Ue = new M(0, 0, 1), Cs = new M(), Me = new M(), we = new M();
4948
+ class yr extends ei {
4949
4949
  constructor() {
4950
4950
  super(), this.isTransformControlsGizmo = !0, this.type = "TransformControlsGizmo";
4951
4951
  const s = new gn({
@@ -4972,8 +4972,8 @@ class Pr extends ei {
4972
4972
  r.color.setHex(255);
4973
4973
  const a = s.clone();
4974
4974
  a.color.setHex(16711680), a.opacity = 0.5;
4975
- const l = s.clone();
4976
- l.color.setHex(65280), l.opacity = 0.5;
4975
+ const c = s.clone();
4976
+ c.color.setHex(65280), c.opacity = 0.5;
4977
4977
  const E = s.clone();
4978
4978
  E.color.setHex(255), E.opacity = 0.5;
4979
4979
  const d = s.clone();
@@ -4987,7 +4987,7 @@ class Pr extends ei {
4987
4987
  const A = new rt(0.08, 0.08, 0.08);
4988
4988
  A.translate(0, 0.04, 0);
4989
4989
  const C = new Ni();
4990
- C.setAttribute("position", new Pi([0, 0, 0, 1, 0, 0], 3));
4990
+ C.setAttribute("position", new yi([0, 0, 0, 1, 0, 0], 3));
4991
4991
  const T = new ct(75e-4, 75e-4, 0.5, 3);
4992
4992
  T.translate(0, 0.25, 0);
4993
4993
  function F(B, H) {
@@ -4996,7 +4996,7 @@ class Pr extends ei {
4996
4996
  }
4997
4997
  function f() {
4998
4998
  const B = new Ni();
4999
- return B.setAttribute("position", new Pi([0, 0, 0, 1, 1, 1], 3)), B;
4999
+ return B.setAttribute("position", new yi([0, 0, 0, 1, 1, 1], 3)), B;
5000
5000
  }
5001
5001
  const m = {
5002
5002
  X: [
@@ -5024,7 +5024,7 @@ class Pr extends ei {
5024
5024
  [new v(new rt(0.15, 0.15, 0.01), a.clone()), [0, 0.15, 0.15], [0, Math.PI / 2, 0]]
5025
5025
  ],
5026
5026
  XZ: [
5027
- [new v(new rt(0.15, 0.15, 0.01), l.clone()), [0.15, 0, 0.15], [-Math.PI / 2, 0, 0]]
5027
+ [new v(new rt(0.15, 0.15, 0.01), c.clone()), [0.15, 0, 0.15], [-Math.PI / 2, 0, 0]]
5028
5028
  ]
5029
5029
  }, g = {
5030
5030
  X: [
@@ -5090,7 +5090,7 @@ class Pr extends ei {
5090
5090
  AXIS: [
5091
5091
  [new Ut(C, i.clone()), [-1e3, 0, 0], null, [1e6, 1, 1], "helper"]
5092
5092
  ]
5093
- }, y = {
5093
+ }, L = {
5094
5094
  XYZE: [
5095
5095
  [new v(new Wn(0.25, 10, 8), e)]
5096
5096
  ],
@@ -5129,12 +5129,12 @@ class Pr extends ei {
5129
5129
  [new v(new rt(0.15, 0.15, 0.01), a), [0, 0.15, 0.15], [0, Math.PI / 2, 0]]
5130
5130
  ],
5131
5131
  XZ: [
5132
- [new v(new rt(0.15, 0.15, 0.01), l), [0.15, 0, 0.15], [-Math.PI / 2, 0, 0]]
5132
+ [new v(new rt(0.15, 0.15, 0.01), c), [0.15, 0, 0.15], [-Math.PI / 2, 0, 0]]
5133
5133
  ],
5134
5134
  XYZ: [
5135
5135
  [new v(new rt(0.1, 0.1, 0.1), d.clone())]
5136
5136
  ]
5137
- }, L = {
5137
+ }, P = {
5138
5138
  X: [
5139
5139
  [new v(new ct(0.2, 0, 0.6, 4), e), [0.3, 0, 0], [0, 0, -Math.PI / 2]],
5140
5140
  [new v(new ct(0.2, 0, 0.6, 4), e), [-0.3, 0, 0], [0, 0, Math.PI / 2]]
@@ -5181,7 +5181,7 @@ class Pr extends ei {
5181
5181
  }
5182
5182
  return H;
5183
5183
  }
5184
- this.gizmo = {}, this.picker = {}, this.helper = {}, this.add(this.gizmo.translate = x(m)), this.add(this.gizmo.rotate = x(_)), this.add(this.gizmo.scale = x(w)), this.add(this.picker.translate = x(g)), this.add(this.picker.rotate = x(y)), this.add(this.picker.scale = x(L)), this.add(this.helper.translate = x(S)), this.add(this.helper.rotate = x(N)), this.add(this.helper.scale = x(U)), this.picker.translate.visible = !1, this.picker.rotate.visible = !1, this.picker.scale.visible = !1;
5184
+ this.gizmo = {}, this.picker = {}, this.helper = {}, this.add(this.gizmo.translate = x(m)), this.add(this.gizmo.rotate = x(_)), this.add(this.gizmo.scale = x(w)), this.add(this.picker.translate = x(g)), this.add(this.picker.rotate = x(L)), this.add(this.picker.scale = x(P)), this.add(this.helper.translate = x(S)), this.add(this.helper.rotate = x(N)), this.add(this.helper.scale = x(U)), this.picker.translate.visible = !1, this.picker.rotate.visible = !1, this.picker.scale.visible = !1;
5185
5185
  }
5186
5186
  // updateMatrixWorld will update transformations and appearance of individual handles
5187
5187
  updateMatrixWorld(s) {
@@ -5204,7 +5204,7 @@ class Pr extends ei {
5204
5204
  super.updateMatrixWorld(s);
5205
5205
  }
5206
5206
  }
5207
- class yr extends v {
5207
+ class Lr extends v {
5208
5208
  constructor() {
5209
5209
  super(
5210
5210
  new Xn(1e5, 1e5, 2, 2),
@@ -5546,8 +5546,8 @@ const ve = class ve extends it {
5546
5546
  const i = t.object;
5547
5547
  let o = t.object.matrixWorld.clone();
5548
5548
  if (i instanceof O.InstancedMesh && t.instanceId !== void 0) {
5549
- const l = new O.Matrix4();
5550
- i.getMatrixAt(t.instanceId, l), o = l.multiply(o);
5549
+ const c = new O.Matrix4();
5550
+ i.getMatrixAt(t.instanceId, c), o = c.multiply(o);
5551
5551
  }
5552
5552
  const r = new O.Matrix3().getNormalMatrix(o), a = e.clone().applyMatrix3(r).normalize();
5553
5553
  return this.normalizePlaneDirectionY(a), a;
@@ -5682,15 +5682,15 @@ const Be = class Be extends it {
5682
5682
  };
5683
5683
  I(Be, "uuid", "24989d27-fa2f-4797-8b08-35918f74e502");
5684
5684
  let In = Be;
5685
- function Lr(c, s, t, e) {
5685
+ function Pr(l, s, t, e) {
5686
5686
  return new Promise((i, o) => {
5687
5687
  function n() {
5688
- const r = c.clientWaitSync(s, t, 0);
5689
- if (r === c.WAIT_FAILED) {
5688
+ const r = l.clientWaitSync(s, t, 0);
5689
+ if (r === l.WAIT_FAILED) {
5690
5690
  o();
5691
5691
  return;
5692
5692
  }
5693
- if (r === c.TIMEOUT_EXPIRED) {
5693
+ if (r === l.TIMEOUT_EXPIRED) {
5694
5694
  setTimeout(n, e);
5695
5695
  return;
5696
5696
  }
@@ -5699,13 +5699,13 @@ function Lr(c, s, t, e) {
5699
5699
  n();
5700
5700
  });
5701
5701
  }
5702
- async function Mr(c, s, t, e, i, o, n) {
5703
- const r = c.fenceSync(c.SYNC_GPU_COMMANDS_COMPLETE, 0);
5704
- c.flush(), await Lr(c, r, 0, 10), c.deleteSync(r), c.bindBuffer(s, t), c.getBufferSubData(s, e, i, o, n), c.bindBuffer(s, null);
5702
+ async function Mr(l, s, t, e, i, o, n) {
5703
+ const r = l.fenceSync(l.SYNC_GPU_COMMANDS_COMPLETE, 0);
5704
+ l.flush(), await Pr(l, r, 0, 10), l.deleteSync(r), l.bindBuffer(s, t), l.getBufferSubData(s, e, i, o, n), l.bindBuffer(s, null);
5705
5705
  }
5706
- async function wr(c, s, t, e, i, o, n, r) {
5707
- const a = c.createBuffer();
5708
- return c.bindBuffer(c.PIXEL_PACK_BUFFER, a), c.bufferData(c.PIXEL_PACK_BUFFER, r.byteLength, c.STREAM_READ), c.readPixels(s, t, e, i, o, n, 0), c.bindBuffer(c.PIXEL_PACK_BUFFER, null), await Mr(c, c.PIXEL_PACK_BUFFER, a, 0, r), c.deleteBuffer(a), r;
5706
+ async function wr(l, s, t, e, i, o, n, r) {
5707
+ const a = l.createBuffer();
5708
+ return l.bindBuffer(l.PIXEL_PACK_BUFFER, a), l.bufferData(l.PIXEL_PACK_BUFFER, r.byteLength, l.STREAM_READ), l.readPixels(s, t, e, i, o, n, 0), l.bindBuffer(l.PIXEL_PACK_BUFFER, null), await Mr(l, l.PIXEL_PACK_BUFFER, a, 0, r), l.deleteBuffer(a), r;
5709
5709
  }
5710
5710
  class Dr {
5711
5711
  constructor(s, t, e) {
@@ -5902,7 +5902,7 @@ class Ur extends Dr {
5902
5902
  } else
5903
5903
  a = n;
5904
5904
  this._colorCodeMeshMap.set(r, t), this._meshIDColorCodeMap.set(t.uuid, r);
5905
- const l = e ? t.count : 1, E = new O.InstancedMesh(i, a, l);
5905
+ const c = e ? t.count : 1, E = new O.InstancedMesh(i, a, c);
5906
5906
  e ? E.instanceMatrix = t.instanceMatrix : E.setMatrixAt(0, new O.Matrix4()), t.visible = !1, E.applyMatrix4(t.matrix), E.updateMatrix(), this.scene.add(E), this.colorMeshes.set(t.uuid, E), this.increaseColor(), this.isProcessing = !1;
5907
5907
  }
5908
5908
  remove(t) {
@@ -5926,12 +5926,12 @@ class Ur extends Dr {
5926
5926
  const r = new O.Color(`rgb(${t}, ${e}, ${i})`);
5927
5927
  if (!this.world.renderer)
5928
5928
  throw new Error("Renderer not found in the world!");
5929
- const a = this.world.renderer.clippingPlanes, l = new O.MeshBasicMaterial({
5929
+ const a = this.world.renderer.clippingPlanes, c = new O.MeshBasicMaterial({
5930
5930
  color: r,
5931
5931
  clippingPlanes: a,
5932
5932
  side: O.DoubleSide
5933
5933
  });
5934
- return O.ColorManagement.enabled = n, { colorMaterial: l, code: o };
5934
+ return O.ColorManagement.enabled = n, { colorMaterial: c, code: o };
5935
5935
  }
5936
5936
  }
5937
5937
  const Ye = class Ye extends it {
@@ -6018,8 +6018,8 @@ const At = class At extends it {
6018
6018
  return new O.Sphere(r, a);
6019
6019
  }
6020
6020
  getMesh() {
6021
- const t = new O.Box3(this._absoluteMin, this._absoluteMax), e = At.getDimensions(t), { width: i, height: o, depth: n, center: r } = e, a = new O.BoxGeometry(i, o, n), l = new O.Mesh(a);
6022
- return this._meshes.push(l), l.position.copy(r), l;
6021
+ const t = new O.Box3(this._absoluteMin, this._absoluteMax), e = At.getDimensions(t), { width: i, height: o, depth: n, center: r } = e, a = new O.BoxGeometry(i, o, n), c = new O.Mesh(a);
6022
+ return this._meshes.push(c), c.position.copy(r), c;
6023
6023
  }
6024
6024
  reset() {
6025
6025
  this._absoluteMin = At.newBound(!0), this._absoluteMax = At.newBound(!1);
@@ -6035,8 +6035,8 @@ const At = class At extends it {
6035
6035
  t.updateMatrixWorld();
6036
6036
  const i = t.matrixWorld, o = new O.Matrix4(), n = t instanceof O.InstancedMesh, r = n ? t.count : 1;
6037
6037
  for (let a = 0; a < r; a++) {
6038
- const l = e.min.clone(), E = e.max.clone();
6039
- n && (t.getMatrixAt(a, o), l.applyMatrix4(o), E.applyMatrix4(o)), l.applyMatrix4(i), E.applyMatrix4(i), l.x < this._absoluteMin.x && (this._absoluteMin.x = l.x), l.y < this._absoluteMin.y && (this._absoluteMin.y = l.y), l.z < this._absoluteMin.z && (this._absoluteMin.z = l.z), l.x > this._absoluteMax.x && (this._absoluteMax.x = l.x), l.y > this._absoluteMax.y && (this._absoluteMax.y = l.y), l.z > this._absoluteMax.z && (this._absoluteMax.z = l.z), E.x > this._absoluteMax.x && (this._absoluteMax.x = E.x), E.y > this._absoluteMax.y && (this._absoluteMax.y = E.y), E.z > this._absoluteMax.z && (this._absoluteMax.z = E.z), E.x < this._absoluteMin.x && (this._absoluteMin.x = E.x), E.y < this._absoluteMin.y && (this._absoluteMin.y = E.y), E.z < this._absoluteMin.z && (this._absoluteMin.z = E.z);
6038
+ const c = e.min.clone(), E = e.max.clone();
6039
+ n && (t.getMatrixAt(a, o), c.applyMatrix4(o), E.applyMatrix4(o)), c.applyMatrix4(i), E.applyMatrix4(i), c.x < this._absoluteMin.x && (this._absoluteMin.x = c.x), c.y < this._absoluteMin.y && (this._absoluteMin.y = c.y), c.z < this._absoluteMin.z && (this._absoluteMin.z = c.z), c.x > this._absoluteMax.x && (this._absoluteMax.x = c.x), c.y > this._absoluteMax.y && (this._absoluteMax.y = c.y), c.z > this._absoluteMax.z && (this._absoluteMax.z = c.z), E.x > this._absoluteMax.x && (this._absoluteMax.x = E.x), E.y > this._absoluteMax.y && (this._absoluteMax.y = E.y), E.z > this._absoluteMax.z && (this._absoluteMax.z = E.z), E.x < this._absoluteMin.x && (this._absoluteMin.x = E.x), E.y < this._absoluteMin.y && (this._absoluteMin.y = E.y), E.z < this._absoluteMin.z && (this._absoluteMin.z = E.z);
6040
6040
  }
6041
6041
  }
6042
6042
  static getFragmentBounds(t) {
@@ -6044,12 +6044,12 @@ const At = class At extends it {
6044
6044
  if (!t.geometry.index)
6045
6045
  throw new Error("Geometry must be indexed!");
6046
6046
  const a = Array.from(t.geometry.index.array);
6047
- for (let l = 0; l < a.length; l++) {
6048
- if (l % 3 === 0 && a[l] === 0 && a[l + 1] === 0 && a[l + 2] === 0) {
6049
- l += 2;
6047
+ for (let c = 0; c < a.length; c++) {
6048
+ if (c % 3 === 0 && a[c] === 0 && a[c + 1] === 0 && a[c + 2] === 0) {
6049
+ c += 2;
6050
6050
  continue;
6051
6051
  }
6052
- const E = a[l], d = e.getX(E), h = e.getY(E), u = e.getZ(E);
6052
+ const E = a[c], d = e.getX(E), h = e.getY(E), u = e.getZ(E);
6053
6053
  d < n.x && (n.x = d), h < n.y && (n.y = h), u < n.z && (n.z = u), d > r.x && (r.x = d), h > r.y && (r.y = h), u > r.z && (r.z = u);
6054
6054
  }
6055
6055
  return new O.Box3(n, r);
@@ -6057,7 +6057,7 @@ const At = class At extends it {
6057
6057
  };
6058
6058
  I(At, "uuid", "d1444724-dba6-4cdd-a0c7-68ee1450d166");
6059
6059
  let fn = At;
6060
- const Ln = /* @__PURE__ */ new Set([
6060
+ const Pn = /* @__PURE__ */ new Set([
6061
6061
  1123145078,
6062
6062
  574549367,
6063
6063
  1675464909,
@@ -6212,11 +6212,11 @@ class xr {
6212
6212
  for (const a of r)
6213
6213
  n.add(a);
6214
6214
  for (const a of n) {
6215
- if (Ln.has(a))
6215
+ if (Pn.has(a))
6216
6216
  continue;
6217
- const l = r.has(a) && i, E = s.GetLineIDsWithType(t, a);
6217
+ const c = r.has(a) && i, E = s.GetLineIDsWithType(t, a);
6218
6218
  for (const d of E) {
6219
- const h = s.GetLine(0, d, l, e);
6219
+ const h = s.GetLine(0, d, c, e);
6220
6220
  o[h.expressID] = h;
6221
6221
  }
6222
6222
  }
@@ -6367,8 +6367,8 @@ class $r {
6367
6367
  const e = {}, i = Object.keys(br).map((o) => parseInt(o, 10));
6368
6368
  for (let o = 0; o < i.length; o++) {
6369
6369
  const n = i[o], r = s.GetLineIDsWithType(t, n), a = r.size();
6370
- for (let l = 0; l < a; l++)
6371
- e[r.get(l)] = n;
6370
+ for (let c = 0; c < a; c++)
6371
+ e[r.get(c)] = n;
6372
6372
  }
6373
6373
  return e;
6374
6374
  }
@@ -7547,8 +7547,8 @@ class Ft {
7547
7547
  var a;
7548
7548
  const o = e ?? (() => {
7549
7549
  }), n = {}, r = s.getAllPropertiesIDs();
7550
- for (const l of r) {
7551
- const E = await s.getProperties(l);
7550
+ for (const c of r) {
7551
+ const E = await s.getProperties(c);
7552
7552
  if (!E)
7553
7553
  continue;
7554
7554
  const d = E.type === t, h = Object.keys(E).find(
@@ -7569,12 +7569,12 @@ class Ft {
7569
7569
  static async getQsetQuantities(s, t, e) {
7570
7570
  const o = e ?? (() => {
7571
7571
  }), n = await s.getProperties(t);
7572
- return !n || n.type !== b.IFCELEMENTQUANTITY ? null : (n.Quantities ?? [{}]).map((l) => (l.value && o(l.value), l.value)).filter((l) => l !== null);
7572
+ return !n || n.type !== b.IFCELEMENTQUANTITY ? null : (n.Quantities ?? [{}]).map((c) => (c.value && o(c.value), c.value)).filter((c) => c !== null);
7573
7573
  }
7574
7574
  static async getPsetProps(s, t, e) {
7575
7575
  const o = e ?? (() => {
7576
7576
  }), n = await s.getProperties(t);
7577
- return !n || n.type !== b.IFCPROPERTYSET ? null : (n.HasProperties ?? [{}]).map((l) => (l.value && o(l.value), l.value)).filter((l) => l !== null);
7577
+ return !n || n.type !== b.IFCPROPERTYSET ? null : (n.HasProperties ?? [{}]).map((c) => (c.value && o(c.value), c.value)).filter((c) => c !== null);
7578
7578
  }
7579
7579
  static async getPsetRel(s, t) {
7580
7580
  var r;
@@ -7759,8 +7759,8 @@ class Kr extends it {
7759
7759
  });
7760
7760
  for (const a of n) {
7761
7761
  e[o].add(a);
7762
- for (const l of r)
7763
- e[l].add(a);
7762
+ for (const c of r)
7763
+ e[c].add(a);
7764
7764
  e[a] || (e[a] = /* @__PURE__ */ new Set()), e[a].add(a);
7765
7765
  }
7766
7766
  }
@@ -7785,13 +7785,13 @@ class Kr extends it {
7785
7785
  async find(t, e) {
7786
7786
  const i = this.components.get(dt), o = e || i.groups.values(), n = {};
7787
7787
  for (const a of o) {
7788
- let l = this.indexedModels[a.uuid];
7789
- l || (l = await this.indexEntityRelations(a));
7788
+ let c = this.indexedModels[a.uuid];
7789
+ c || (c = await this.indexEntityRelations(a));
7790
7790
  let E = [];
7791
7791
  for (const [u, p] of t.entries()) {
7792
7792
  const R = /* @__PURE__ */ new Set(), A = this.simpleQuery(a, p, R), C = [];
7793
7793
  for (const T of A) {
7794
- const F = l[T];
7794
+ const F = c[T];
7795
7795
  if (F) {
7796
7796
  C.push(T);
7797
7797
  for (const f of F)
@@ -7819,9 +7819,9 @@ class Kr extends it {
7819
7819
  continue;
7820
7820
  const r = t[o].modelEntities;
7821
7821
  for (const a of r) {
7822
- const l = n.data.get(a);
7823
- if (l)
7824
- for (const E of l[0]) {
7822
+ const c = n.data.get(a);
7823
+ if (c)
7824
+ for (const E of c[0]) {
7825
7825
  const d = n.keyFragments.get(E);
7826
7826
  if (!d)
7827
7827
  throw new Error("Fragment ID not found!");
@@ -7836,24 +7836,24 @@ class Kr extends it {
7836
7836
  if (!o)
7837
7837
  throw new Error("Model has no properties");
7838
7838
  let n = {}, r = 0, a = [];
7839
- for (const l of e.queries) {
7839
+ for (const c of e.queries) {
7840
7840
  let E = [];
7841
- const d = l.operator === "AND" ? n : o;
7842
- if (l.condition) {
7841
+ const d = c.operator === "AND" ? n : o;
7842
+ if (c.condition) {
7843
7843
  const u = this.getMatchingEntities(
7844
7844
  d,
7845
- l,
7845
+ c,
7846
7846
  i
7847
7847
  );
7848
7848
  E = u.expressIDs, n = { ...n, ...u.entities };
7849
7849
  } else
7850
7850
  E = [
7851
- ...this.simpleQuery(t, l, i)
7851
+ ...this.simpleQuery(t, c, i)
7852
7852
  ];
7853
7853
  a = r === 0 ? E : this.combineArrays(
7854
7854
  a,
7855
7855
  E,
7856
- l.operator ?? "AND"
7856
+ c.operator ?? "AND"
7857
7857
  // Defaults to AND if iterations > 0 and query.operator is not defined
7858
7858
  ), r++;
7859
7859
  }
@@ -7862,7 +7862,7 @@ class Kr extends it {
7862
7862
  getMatchingEntities(t, e, i) {
7863
7863
  const { attribute: o, condition: n } = e;
7864
7864
  let { value: r } = e;
7865
- const a = !this._noHandleAttributes.includes(o), l = [], E = [];
7865
+ const a = !this._noHandleAttributes.includes(o), c = [], E = [];
7866
7866
  for (const d in t) {
7867
7867
  const h = t[d];
7868
7868
  if (h === void 0)
@@ -7881,9 +7881,9 @@ class Kr extends it {
7881
7881
  e.negateResult && i.add(h.expressID);
7882
7882
  continue;
7883
7883
  }
7884
- l.push(h.expressID), E.push(h);
7884
+ c.push(h.expressID), E.push(h);
7885
7885
  }
7886
- return { expressIDs: l, entities: E, excludedItems: i };
7886
+ return { expressIDs: c, entities: E, excludedItems: i };
7887
7887
  }
7888
7888
  combineArrays(t, e, i) {
7889
7889
  return i ? i === "AND" ? this.arrayIntersection(t, e) : this.arrayUnion(t, e) : e;
@@ -7915,137 +7915,211 @@ class Kr extends it {
7915
7915
  };
7916
7916
  }
7917
7917
  }
7918
- const Ve = class Ve extends it {
7918
+ const Ge = class Ge extends it {
7919
7919
  constructor(t) {
7920
7920
  super(t);
7921
7921
  /** {@link Disposable.onDisposed} */
7922
7922
  I(this, "onDisposed", new D());
7923
7923
  I(this, "enabled", !0);
7924
- I(this, "relationsToProcess", [
7925
- b.IFCRELDEFINESBYPROPERTIES,
7926
- b.IFCRELDEFINESBYTYPE,
7927
- b.IFCRELASSOCIATESMATERIAL,
7928
- b.IFCRELCONTAINEDINSPATIALSTRUCTURE,
7929
- b.IFCRELASSOCIATESCLASSIFICATION,
7930
- b.IFCRELASSIGNSTOGROUP
7924
+ /**
7925
+ * All the inverse attributes this component can processes.
7926
+ */
7927
+ I(this, "inverseAttributes", [
7928
+ "IsDecomposedBy",
7929
+ "Decomposes",
7930
+ "AssociatedTo",
7931
+ "HasAssociations",
7932
+ "ClassificationForObjects",
7933
+ "IsGroupedBy",
7934
+ "HasAssignments",
7935
+ "IsDefinedBy",
7936
+ "DefinesOcurrence",
7937
+ "IsTypedBy",
7938
+ "Types",
7939
+ "Defines",
7940
+ "ContainedInStructure",
7941
+ "ContainsElements"
7942
+ ]);
7943
+ I(this, "inverseAttributesToProcess", [
7944
+ "HasAssignments",
7945
+ "IsDecomposedBy",
7946
+ "IsDefinedBy",
7947
+ "IsTypedBy",
7948
+ "HasAssociations",
7949
+ "ContainedInStructure"
7931
7950
  ]);
7932
- I(this, "indexMap", {});
7933
- I(this, "_propertiesManager", null);
7934
- I(this, "onPropertiesManagerSet", new D());
7951
+ I(this, "_relToAttributesMap", /* @__PURE__ */ new Map());
7952
+ I(this, "relationMaps", {});
7935
7953
  I(this, "onFragmentsDisposed", (t) => {
7936
- delete this.indexMap[t.groupID];
7954
+ delete this.relationMaps[t.groupID];
7937
7955
  });
7938
- this.components.add(Ve.uuid, this), t.get(dt).onFragmentsDisposed.add(this.onFragmentsDisposed);
7939
- }
7940
- // private _entityUIPool: UIPool<TreeView>;
7941
- set propertiesManager(t) {
7942
- this._propertiesManager || (this._propertiesManager = t, t && (t.onElementToPset.add(async ({ model: e, psetID: i, elementID: o }) => {
7943
- this.indexMap[e.uuid] && this.setEntityIndex(e, o).add(i);
7944
- }), this.onPropertiesManagerSet.trigger(t)));
7945
- }
7946
- get propertiesManager() {
7947
- return this._propertiesManager;
7948
- }
7949
- async dispose() {
7950
- this.indexMap = {}, this.propertiesManager = null, this.onPropertiesManagerSet.reset(), this.components.get(dt).onFragmentsDisposed.remove(this.onFragmentsDisposed), this.onDisposed.trigger(Ve.uuid), this.onDisposed.reset();
7956
+ this.components.add(Ge.uuid, this), t.get(dt).onFragmentsDisposed.add(this.onFragmentsDisposed), this.setRelMap();
7951
7957
  }
7952
- async getProperties(t, e) {
7953
- if (!t.hasProperties)
7954
- return null;
7955
- const i = t.getLocalProperties();
7956
- if (i === void 0)
7957
- return null;
7958
- const o = this.indexMap[t.uuid];
7959
- if (!o)
7960
- return null;
7961
- const n = o[e], r = parseInt(e, 10), a = await t.getProperties(r);
7962
- if (!a)
7963
- throw new Error("Properties not found!");
7964
- const l = this.cloneProperty(a);
7965
- if (!l)
7966
- throw new Error("Properties not found!");
7967
- const E = [l];
7968
- if (n)
7969
- for (const d of n) {
7970
- const h = await t.getProperties(d);
7971
- if (!h)
7972
- continue;
7973
- const u = this.cloneProperty(h);
7974
- u && (this.getPsetProperties(u, i), this.getNestedPsets(u, i), E.push(u));
7975
- }
7976
- return E;
7977
- }
7978
- getNestedPsets(t, e) {
7979
- if (t.HasPropertySets)
7980
- for (const i of t.HasPropertySets) {
7981
- const o = i.value;
7982
- i.value = this.cloneProperty(e[o]), this.getPsetProperties(i.value, e);
7983
- }
7958
+ getAttributeRels(t) {
7959
+ const e = [];
7960
+ for (const [i, o] of this._relToAttributesMap.entries()) {
7961
+ const { forRelating: n, forRelated: r } = o;
7962
+ (n === t || r === t) && e.push(i);
7963
+ }
7964
+ return e;
7984
7965
  }
7985
- getPsetProperties(t, e) {
7986
- if (t.HasProperties)
7987
- for (const i of t.HasProperties) {
7988
- const o = i.value, n = this.cloneProperty(e[o]);
7989
- i.value = { ...n };
7990
- }
7966
+ // TODO: Construct this based on the IFC EXPRESS long form schema?
7967
+ setRelMap() {
7968
+ this._relToAttributesMap.set(b.IFCRELAGGREGATES, {
7969
+ forRelating: "IsDecomposedBy",
7970
+ forRelated: "Decomposes"
7971
+ }), this._relToAttributesMap.set(b.IFCRELASSOCIATESMATERIAL, {
7972
+ forRelating: "AssociatedTo",
7973
+ forRelated: "HasAssociations"
7974
+ }), this._relToAttributesMap.set(b.IFCRELASSOCIATESCLASSIFICATION, {
7975
+ forRelating: "ClassificationForObjects",
7976
+ forRelated: "HasAssociations"
7977
+ }), this._relToAttributesMap.set(b.IFCRELASSIGNSTOGROUP, {
7978
+ forRelating: "IsGroupedBy",
7979
+ forRelated: "HasAssignments"
7980
+ }), this._relToAttributesMap.set(b.IFCRELDEFINESBYPROPERTIES, {
7981
+ forRelated: "IsDefinedBy",
7982
+ forRelating: "DefinesOcurrence"
7983
+ }), this._relToAttributesMap.set(b.IFCRELDEFINESBYTYPE, {
7984
+ forRelated: "IsTypedBy",
7985
+ forRelating: "Types"
7986
+ }), this._relToAttributesMap.set(b.IFCRELDEFINESBYTEMPLATE, {
7987
+ forRelated: "IsDefinedBy",
7988
+ forRelating: "Defines"
7989
+ }), this._relToAttributesMap.set(b.IFCRELCONTAINEDINSPATIALSTRUCTURE, {
7990
+ forRelated: "ContainedInStructure",
7991
+ forRelating: "ContainsElements"
7992
+ });
7991
7993
  }
7994
+ /**
7995
+ * Processes a given model to index its IFC entities relations based on predefined inverse attributes.
7996
+ * This method iterates through each specified inverse attribute, retrieves the corresponding relations,
7997
+ * and maps them in a structured way to facilitate quick access to related entities.
7998
+ *
7999
+ * The process involves querying the model for each relation type associated with the inverse attributes
8000
+ * and updating the internal relationMaps with the relationships found. This map is keyed by the model's UUID
8001
+ * and contains a nested map where each key is an entity's expressID and its value is another map.
8002
+ * This inner map's keys are the indices of the inverse attributes, and its values are arrays of expressIDs
8003
+ * of entities that are related through that attribute.
8004
+ *
8005
+ * @param model The `FragmentsGroup` model to be processed. It must have properties loaded.
8006
+ * @returns A promise that resolves to the relations map for the processed model. This map is a detailed
8007
+ * representation of the relations indexed by entity expressIDs and relation types.
8008
+ * @throws An error if the model does not have properties loaded.
8009
+ */
7992
8010
  async process(t) {
7993
8011
  if (!t.hasProperties)
7994
8012
  throw new Error("FragmentsGroup properties not found");
7995
- this.indexMap[t.uuid] = {};
7996
- const e = [b.IFCPROPERTYSET, b.IFCELEMENTQUANTITY];
7997
- for (const i of this.relationsToProcess)
7998
- await Ft.getRelationMap(
7999
- t,
8000
- i,
8001
- // eslint-disable-next-line no-loop-func
8002
- async (o, n) => {
8003
- const r = await t.getProperties(o);
8004
- if (r) {
8005
- e.includes(r.type) || this.setEntityIndex(t, o);
8006
- for (const a of n)
8007
- this.setEntityIndex(t, a).add(o);
8013
+ this.relationMaps[t.uuid] = /* @__PURE__ */ new Map();
8014
+ const e = this.relationMaps[t.uuid];
8015
+ for (const i of this.inverseAttributesToProcess) {
8016
+ const o = this.getAttributeRels(i);
8017
+ for (const n of o)
8018
+ await Ft.getRelationMap(
8019
+ t,
8020
+ n,
8021
+ async (r, a) => {
8022
+ const c = this._relToAttributesMap.get(n);
8023
+ if (!c)
8024
+ return;
8025
+ const { forRelated: E, forRelating: d } = c;
8026
+ if (d && this.inverseAttributesToProcess.includes(d)) {
8027
+ const h = e.get(r) ?? /* @__PURE__ */ new Map(), u = this.inverseAttributes.indexOf(d);
8028
+ h.set(u, a), e.set(r, h);
8029
+ }
8030
+ if (E && this.inverseAttributesToProcess.includes(E))
8031
+ for (const h of a) {
8032
+ const u = e.get(h) ?? /* @__PURE__ */ new Map(), p = this.inverseAttributes.indexOf(E), R = u.get(p) ?? [];
8033
+ R.push(r), u.set(p, R), e.set(h, u);
8034
+ }
8008
8035
  }
8009
- }
8010
- );
8036
+ );
8037
+ }
8038
+ return e;
8039
+ }
8040
+ /**
8041
+ * Retrieves the relations of a specific entity within a model based on the given relation name.
8042
+ * This method searches the indexed relation maps for the specified model and entity,
8043
+ * returning the IDs of related entities if a match is found.
8044
+ *
8045
+ * @param model The `FragmentsGroup` model containing the entity.
8046
+ * @param expressID The unique identifier of the entity within the model.
8047
+ * @param relationName The IFC schema inverse attribute of the relation to search for (e.g., "IsDefinedBy", "ContainsElements").
8048
+ * @returns An array of express IDs representing the related entities, or `null` if no relations are found
8049
+ * or the specified relation name is not indexed.
8050
+ */
8051
+ getEntityRelations(t, e, i) {
8052
+ const o = this.relationMaps[t.uuid];
8053
+ if (!o)
8054
+ return null;
8055
+ const n = o.get(e), r = this.inverseAttributes.indexOf(i);
8056
+ if (!n || r === -1)
8057
+ return null;
8058
+ const a = n.get(r);
8059
+ return a || null;
8011
8060
  }
8012
- setEntityIndex(t, e) {
8013
- return this.indexMap[t.uuid][e] || (this.indexMap[t.uuid][e] = /* @__PURE__ */ new Set()), this.indexMap[t.uuid][e];
8061
+ /**
8062
+ * Serializes the relations of a specific model into a JSON string.
8063
+ * This method iterates through the relations indexed for the given model,
8064
+ * organizing them into a structured object where each key is an expressID of an entity,
8065
+ * and its value is another object mapping relation indices to arrays of related entity expressIDs.
8066
+ * The resulting object is then serialized into a JSON string.
8067
+ *
8068
+ * @param model The `FragmentsGroup` model whose relations are to be serialized.
8069
+ * @returns A JSON string representing the serialized relations of the specified model.
8070
+ * If the model has no indexed relations, `null` is returned.
8071
+ */
8072
+ serializeModelRelations(t) {
8073
+ const e = this.relationMaps[t.uuid];
8074
+ if (!e)
8075
+ return null;
8076
+ const i = {};
8077
+ for (const [o, n] of e.entries()) {
8078
+ i[o] || (i[o] = {});
8079
+ for (const [r, a] of n.entries())
8080
+ i[o][r] = a;
8081
+ }
8082
+ return JSON.stringify(i);
8014
8083
  }
8015
- cloneProperty(t, e = {}) {
8016
- if (!t)
8017
- return e;
8018
- for (const i in t) {
8019
- const o = t[i], n = Array.isArray(o), r = typeof o == "object" && !n && o !== null;
8020
- if (n) {
8021
- e[i] = [];
8022
- const a = e[i];
8023
- this.clonePropertyArray(o, a);
8024
- } else if (r) {
8025
- e[i] = {};
8026
- const a = e[i];
8027
- this.cloneProperty(o, a);
8028
- } else
8029
- e[i] = o;
8084
+ /**
8085
+ * Serializes all relations of every model processed by the indexer into a JSON string.
8086
+ * This method iterates through each model's relations indexed in `relationMaps`, organizing them
8087
+ * into a structured JSON object. Each top-level key in this object corresponds to a model's UUID,
8088
+ * and its value is another object mapping entity expressIDs to their related entities, categorized
8089
+ * by relation types. The structure facilitates easy access to any entity's relations across all models.
8090
+ *
8091
+ * @returns A JSON string representing the serialized relations of all models processed by the indexer.
8092
+ * If no relations have been indexed, an empty object is returned as a JSON string.
8093
+ */
8094
+ serializeRelations() {
8095
+ const t = {};
8096
+ for (const e in this.relationMaps) {
8097
+ const i = this.relationMaps[e], o = {};
8098
+ for (const [n, r] of i.entries()) {
8099
+ o[n] || (o[n] = {});
8100
+ for (const [a, c] of r.entries())
8101
+ o[n][a] = c;
8102
+ }
8103
+ t[e] = o;
8030
8104
  }
8031
- return e;
8105
+ return JSON.stringify(t);
8032
8106
  }
8033
- clonePropertyArray(t, e) {
8034
- for (const i of t) {
8035
- const o = Array.isArray(i), n = typeof i == "object" && !o && i !== null;
8036
- if (o) {
8037
- const r = [];
8038
- e.push(r), this.clonePropertyArray(i, r);
8039
- } else if (n) {
8040
- const r = {};
8041
- e.push(r), this.cloneProperty(i, r);
8042
- } else
8043
- e.push(i);
8107
+ getRelationsMapFromJSON(t) {
8108
+ const e = JSON.parse(t), i = /* @__PURE__ */ new Map();
8109
+ for (const o in e) {
8110
+ const n = e[o], r = /* @__PURE__ */ new Map();
8111
+ for (const a in n)
8112
+ r.set(Number(a), n[a]);
8113
+ i.set(Number(o), r);
8044
8114
  }
8115
+ return i;
8116
+ }
8117
+ dispose() {
8118
+ this.relationMaps = {}, this.components.get(dt).onFragmentsDisposed.remove(this.onFragmentsDisposed), this.onDisposed.trigger(Ge.uuid), this.onDisposed.reset();
8045
8119
  }
8046
8120
  };
8047
- I(Ve, "uuid", "23a889ab-83b3-44a4-8bee-ead83438370b");
8048
- let pn = Ve;
8121
+ I(Ge, "uuid", "23a889ab-83b3-44a4-8bee-ead83438370b");
8122
+ let pn = Ge;
8049
8123
  class vr {
8050
8124
  constructor() {
8051
8125
  I(this, "factor", 1);
@@ -8117,11 +8191,11 @@ class wn {
8117
8191
  0,
8118
8192
  b.IFCRELCONTAINEDINSPATIALSTRUCTURE
8119
8193
  ), e = /* @__PURE__ */ new Set(), i = s.GetLineIDsWithType(0, b.IFCSPACE);
8120
- for (let l = 0; l < i.size(); l++)
8121
- e.add(i.get(l));
8194
+ for (let c = 0; c < i.size(); c++)
8195
+ e.add(i.get(c));
8122
8196
  const o = s.GetLineIDsWithType(0, b.IFCRELAGGREGATES), n = o.size();
8123
- for (let l = 0; l < n; l++) {
8124
- const E = o.get(l), d = s.GetLine(0, E);
8197
+ for (let c = 0; c < n; c++) {
8198
+ const E = o.get(c), d = s.GetLine(0, E);
8125
8199
  if (!d || !d.RelatingObject || !d.RelatedObjects)
8126
8200
  continue;
8127
8201
  const h = d.RelatingObject.value, u = d.RelatedObjects;
@@ -8131,8 +8205,8 @@ class wn {
8131
8205
  }
8132
8206
  }
8133
8207
  const r = {}, a = t.size();
8134
- for (let l = 0; l < a; l++) {
8135
- const E = t.get(l), d = s.GetLine(0, E);
8208
+ for (let c = 0; c < a; c++) {
8209
+ const E = t.get(c), d = s.GetLine(0, E);
8136
8210
  if (!d || !d.RelatingStructure || !d.RelatedElements)
8137
8211
  continue;
8138
8212
  const h = d.RelatingStructure.value, u = d.RelatedElements;
@@ -8148,16 +8222,16 @@ class wn {
8148
8222
  this.itemsByFloor[R] = h;
8149
8223
  }
8150
8224
  }
8151
- for (const l in r) {
8152
- const E = this.itemsByFloor[l];
8225
+ for (const c in r) {
8226
+ const E = this.itemsByFloor[c];
8153
8227
  if (E !== void 0) {
8154
- const d = r[l];
8228
+ const d = r[c];
8155
8229
  for (const h of d)
8156
8230
  this.itemsByFloor[h] = E;
8157
8231
  }
8158
8232
  }
8159
- for (let l = 0; l < n; l++) {
8160
- const E = o.get(l), d = s.GetLine(0, E);
8233
+ for (let c = 0; c < n; c++) {
8234
+ const E = o.get(c), d = s.GetLine(0, E);
8161
8235
  if (!d || !d.RelatingObject || !d.RelatedObjects)
8162
8236
  continue;
8163
8237
  const h = d.RelatingObject.value, u = d.RelatedObjects;
@@ -8241,8 +8315,8 @@ class Dn {
8241
8315
  const { x: u, y: p, z: R } = r[h];
8242
8316
  a[h * 3] = u, a[h * 3 + 1] = p, a[h * 3 + 2] = R || 0;
8243
8317
  }
8244
- const l = new O.BufferAttribute(a, 3), E = new O.EdgesGeometry();
8245
- E.setAttribute("position", l);
8318
+ const c = new O.BufferAttribute(a, 3), E = new O.EdgesGeometry();
8319
+ E.setAttribute("position", c);
8246
8320
  const d = new $t.CurveMesh(
8247
8321
  i,
8248
8322
  n,
@@ -8271,7 +8345,7 @@ class Un {
8271
8345
  return e;
8272
8346
  }
8273
8347
  }
8274
- const Ge = class Ge extends it {
8348
+ const Ve = class Ve extends it {
8275
8349
  constructor(t) {
8276
8350
  super(t);
8277
8351
  I(this, "onIfcStartedLoading", new D());
@@ -8292,10 +8366,10 @@ const Ge = class Ge extends it {
8292
8366
  transparent: !0,
8293
8367
  opacity: 0.5
8294
8368
  }));
8295
- this.components.add(Ge.uuid, this), this.settings.excludedCategories.add(b.IFCOPENINGELEMENT);
8369
+ this.components.add(Ve.uuid, this), this.settings.excludedCategories.add(b.IFCOPENINGELEMENT);
8296
8370
  }
8297
8371
  dispose() {
8298
- this.webIfc = null, this.onDisposed.trigger(Ge.uuid), this.onDisposed.reset();
8372
+ this.webIfc = null, this.onDisposed.trigger(Ve.uuid), this.onDisposed.reset();
8299
8373
  }
8300
8374
  async setup(t) {
8301
8375
  this.settings = { ...this.settings, ...t }, this.settings.autoSetWasm && await this.autoSetWasm(), this.onSetup.trigger();
@@ -8328,9 +8402,9 @@ const Ge = class Ge extends it {
8328
8402
  for (const a of t) {
8329
8403
  if (!this.webIfc.IsIfcElement(a) && a !== b.IFCSPACE || this.settings.excludedCategories.has(a))
8330
8404
  continue;
8331
- const l = this.webIfc.GetLineIDsWithType(0, a), E = l.size();
8405
+ const c = this.webIfc.GetLineIDsWithType(0, a), E = c.size();
8332
8406
  for (let d = 0; d < E; d++) {
8333
- const h = l.get(d);
8407
+ const h = c.get(d);
8334
8408
  n.push(h);
8335
8409
  const u = this._spatialTree.itemsByFloor[h] || 0;
8336
8410
  e.data.set(h, [[], [u, a]]);
@@ -8340,15 +8414,15 @@ const Ge = class Ge extends it {
8340
8414
  this.getMesh(a, e);
8341
8415
  });
8342
8416
  for (const a of this._visitedFragments) {
8343
- const { index: l, fragment: E } = a[1];
8344
- e.keyFragments.set(l, E.id);
8417
+ const { index: c, fragment: E } = a[1];
8418
+ e.keyFragments.set(c, E.id);
8345
8419
  }
8346
8420
  for (const a of e.items) {
8347
- const l = this._fragmentInstances.get(a.id);
8348
- if (!l)
8421
+ const c = this._fragmentInstances.get(a.id);
8422
+ if (!c)
8349
8423
  throw new Error("Fragment not found!");
8350
8424
  const E = [];
8351
- for (const [d, h] of l)
8425
+ for (const [d, h] of c)
8352
8426
  E.push(h);
8353
8427
  a.add(E);
8354
8428
  }
@@ -8361,14 +8435,14 @@ const Ge = class Ge extends it {
8361
8435
  getMesh(t, e) {
8362
8436
  const i = t.geometries.size(), o = t.expressID;
8363
8437
  for (let n = 0; n < i; n++) {
8364
- const r = t.geometries.get(n), { x: a, y: l, z: E, w: d } = r.color, h = d !== 1, { geometryExpressID: u } = r, p = `${u}-${h}`;
8438
+ const r = t.geometries.get(n), { x: a, y: c, z: E, w: d } = r.color, h = d !== 1, { geometryExpressID: u } = r, p = `${u}-${h}`;
8365
8439
  if (!this._visitedFragments.has(p)) {
8366
8440
  const m = this.getGeometry(this.webIfc, u), g = h ? this._materialT : this._material, S = new $t.Fragment(m, g, 1);
8367
8441
  e.add(S.mesh), e.items.push(S);
8368
8442
  const _ = this._visitedFragments.size;
8369
8443
  this._visitedFragments.set(p, { index: _, fragment: S });
8370
8444
  }
8371
- const R = new O.Color().setRGB(a, l, E, "srgb"), A = new O.Matrix4();
8445
+ const R = new O.Color().setRGB(a, c, E, "srgb"), A = new O.Matrix4();
8372
8446
  A.fromArray(r.flatTransformation);
8373
8447
  const C = this._visitedFragments.get(p);
8374
8448
  if (C === void 0)
@@ -8401,8 +8475,8 @@ const Ge = class Ge extends it {
8401
8475
  ), r = new Float32Array(n.length / 2), a = new Float32Array(n.length / 2);
8402
8476
  for (let h = 0; h < n.length; h += 6)
8403
8477
  r[h / 2] = n[h], r[h / 2 + 1] = n[h + 1], r[h / 2 + 2] = n[h + 2], a[h / 2] = n[h + 3], a[h / 2 + 1] = n[h + 4], a[h / 2 + 2] = n[h + 5];
8404
- const l = new O.BufferGeometry(), E = new O.BufferAttribute(r, 3), d = new O.BufferAttribute(a, 3);
8405
- return l.setAttribute("position", E), l.setAttribute("normal", d), l.setIndex(Array.from(o)), i.delete(), l;
8478
+ const c = new O.BufferGeometry(), E = new O.BufferAttribute(r, 3), d = new O.BufferAttribute(a, 3);
8479
+ return c.setAttribute("position", E), c.setAttribute("normal", d), c.setIndex(Array.from(o)), i.delete(), c;
8406
8480
  }
8407
8481
  async autoSetWasm() {
8408
8482
  const t = await fetch(
@@ -8425,8 +8499,8 @@ const Ge = class Ge extends it {
8425
8499
  }
8426
8500
  }
8427
8501
  };
8428
- I(Ge, "uuid", "a659add7-1418-4771-a0d6-7d4d438e4624");
8429
- let Ii = Ge;
8502
+ I(Ve, "uuid", "a659add7-1418-4771-a0d6-7d4d438e4624");
8503
+ let Ii = Ve;
8430
8504
  const Yt = class Yt extends it {
8431
8505
  constructor(t) {
8432
8506
  super(t);
@@ -8488,11 +8562,11 @@ const Yt = class Yt extends it {
8488
8562
  }
8489
8563
  }
8490
8564
  async newPset(t, e, i) {
8491
- const o = Yt.getIFCSchema(t), { ownerHistoryHandle: n } = await this.getOwnerHistory(t), r = this.newGUID(t), a = new b[o].IfcLabel(e), l = i ? new b[o].IfcText(i) : null, E = new b[o].IfcPropertySet(
8565
+ const o = Yt.getIFCSchema(t), { ownerHistoryHandle: n } = await this.getOwnerHistory(t), r = this.newGUID(t), a = new b[o].IfcLabel(e), c = i ? new b[o].IfcText(i) : null, E = new b[o].IfcPropertySet(
8492
8566
  r,
8493
8567
  n,
8494
8568
  a,
8495
- l,
8569
+ c,
8496
8570
  []
8497
8571
  );
8498
8572
  E.expressID = this.increaseMaxID(t);
@@ -8520,13 +8594,13 @@ const Yt = class Yt extends it {
8520
8594
  }
8521
8595
  }
8522
8596
  async newSingleProperty(t, e, i, o) {
8523
- const n = Yt.getIFCSchema(t), r = new b[n].IfcIdentifier(i), a = new b[n][e](o), l = new b[n].IfcPropertySingleValue(
8597
+ const n = Yt.getIFCSchema(t), r = new b[n].IfcIdentifier(i), a = new b[n][e](o), c = new b[n].IfcPropertySingleValue(
8524
8598
  r,
8525
8599
  null,
8526
8600
  a,
8527
8601
  null
8528
8602
  );
8529
- return l.expressID = this.increaseMaxID(t), await this.setData(t, l), l;
8603
+ return c.expressID = this.increaseMaxID(t), await this.setData(t, c), c;
8530
8604
  }
8531
8605
  newSingleStringProperty(t, e, i, o) {
8532
8606
  return this.newSingleProperty(t, e, i, o);
@@ -8572,8 +8646,8 @@ const Yt = class Yt extends it {
8572
8646
  }
8573
8647
  async saveToIfc(t, e) {
8574
8648
  const i = this.components.get(Ii), o = i.webIfc, n = await i.readIfcFile(e), r = this._changeMap[t.uuid] ?? [];
8575
- for (const l of r) {
8576
- const E = await t.getProperties(l);
8649
+ for (const c of r) {
8650
+ const E = await t.getProperties(c);
8577
8651
  if (E)
8578
8652
  try {
8579
8653
  o.WriteLine(n, E);
@@ -8581,7 +8655,7 @@ const Yt = class Yt extends it {
8581
8655
  }
8582
8656
  else
8583
8657
  try {
8584
- o.DeleteLine(n, l);
8658
+ o.DeleteLine(n, c);
8585
8659
  } catch {
8586
8660
  }
8587
8661
  }
@@ -8604,15 +8678,15 @@ const Yt = class Yt extends it {
8604
8678
  const a = r.value;
8605
8679
  if (a === void 0 || a == null)
8606
8680
  throw new Error(`Attribute ${i} has a badly defined handle.`);
8607
- const l = new D();
8681
+ const c = new D();
8608
8682
  return Object.defineProperty(n[i], "value", {
8609
8683
  get() {
8610
8684
  return this._value;
8611
8685
  },
8612
8686
  async set(E) {
8613
- this._value = E, l.trigger(E);
8687
+ this._value = E, c.trigger(E);
8614
8688
  }
8615
- }), n[i].value = a, this.attributeListeners[t.uuid][e] || (this.attributeListeners[t.uuid][e] = {}), this.attributeListeners[t.uuid][e][i] = l, l;
8689
+ }), n[i].value = a, this.attributeListeners[t.uuid][e] || (this.attributeListeners[t.uuid][e] = {}), this.attributeListeners[t.uuid][e][i] = c, c;
8616
8690
  }
8617
8691
  };
8618
8692
  I(Yt, "uuid", "58c2d9f0-183c-48d6-a402-dfcf5b9a34df");
@@ -8633,10 +8707,10 @@ const _s = class _s extends it {
8633
8707
  delete n[e], Object.values(n).length === 0 && delete this._groupSystems[o];
8634
8708
  else
8635
8709
  for (const a of r) {
8636
- const l = n[a];
8710
+ const c = n[a];
8637
8711
  for (const E of i)
8638
- delete l[E];
8639
- Object.values(l).length === 0 && delete n[a];
8712
+ delete c[E];
8713
+ Object.values(c).length === 0 && delete n[a];
8640
8714
  }
8641
8715
  }
8642
8716
  });
@@ -8662,8 +8736,8 @@ const _s = class _s extends it {
8662
8736
  const e = this.components.get(dt);
8663
8737
  if (!t) {
8664
8738
  const r = {};
8665
- for (const [a, l] of e.list)
8666
- r[a] = new Set(l.ids);
8739
+ for (const [a, c] of e.list)
8740
+ r[a] = new Set(c.ids);
8667
8741
  return r;
8668
8742
  }
8669
8743
  const i = Object.keys(t).length, o = {};
@@ -8673,8 +8747,8 @@ const _s = class _s extends it {
8673
8747
  console.warn(`Classification ${r} does not exist.`);
8674
8748
  continue;
8675
8749
  }
8676
- for (const l of a) {
8677
- const E = this._groupSystems[r][l];
8750
+ for (const c of a) {
8751
+ const E = this._groupSystems[r][c];
8678
8752
  if (E)
8679
8753
  for (const d in E) {
8680
8754
  o[d] || (o[d] = /* @__PURE__ */ new Map());
@@ -8688,10 +8762,10 @@ const _s = class _s extends it {
8688
8762
  const n = {};
8689
8763
  for (const r in o) {
8690
8764
  const a = o[r];
8691
- for (const [l, E] of a) {
8765
+ for (const [c, E] of a) {
8692
8766
  if (E === void 0)
8693
8767
  throw new Error("Malformed fragments map!");
8694
- E === i && (n[r] || (n[r] = /* @__PURE__ */ new Set()), n[r].add(l));
8768
+ E === i && (n[r] || (n[r] = /* @__PURE__ */ new Set()), n[r].add(c));
8695
8769
  }
8696
8770
  }
8697
8771
  return n;
@@ -8703,8 +8777,8 @@ const _s = class _s extends it {
8703
8777
  const o = i[t];
8704
8778
  for (const [n, r] of e.data) {
8705
8779
  const a = r[0];
8706
- for (const l of a) {
8707
- const E = e.keyFragments.get(l);
8780
+ for (const c of a) {
8781
+ const E = e.keyFragments.get(c);
8708
8782
  E && (o[E] || (o[E] = /* @__PURE__ */ new Set()), o[E].add(n));
8709
8783
  }
8710
8784
  }
@@ -8719,14 +8793,14 @@ const _s = class _s extends it {
8719
8793
  continue;
8720
8794
  const a = String((o = r.PredefinedType) == null ? void 0 : o.value).toUpperCase();
8721
8795
  e[a] || (e[a] = {});
8722
- const l = e[a];
8796
+ const c = e[a];
8723
8797
  for (const [E, d] of t.data) {
8724
8798
  const h = d[0];
8725
8799
  for (const u of h) {
8726
8800
  const p = t.keyFragments.get(u);
8727
8801
  if (!p)
8728
8802
  throw new Error("Fragment ID not found!");
8729
- l[p] || (l[p] = /* @__PURE__ */ new Set()), l[p].add(r.expressID);
8803
+ c[p] || (c[p] = /* @__PURE__ */ new Set()), c[p].add(r.expressID);
8730
8804
  }
8731
8805
  }
8732
8806
  }
@@ -8770,8 +8844,8 @@ const _s = class _s extends it {
8770
8844
  for (const r of n[0]) {
8771
8845
  const a = t.keyFragments.get(r);
8772
8846
  if (a) {
8773
- const l = this._groupSystems[e];
8774
- l[i] || (l[i] = {}), l[i][a] || (l[i][a] = /* @__PURE__ */ new Set()), l[i][a].add(o);
8847
+ const c = this._groupSystems[e];
8848
+ c[i] || (c[i] = {}), c[i][a] || (c[i][a] = /* @__PURE__ */ new Set()), c[i][a].add(o);
8775
8849
  }
8776
8850
  }
8777
8851
  }
@@ -8802,14 +8876,14 @@ const ze = class ze extends it {
8802
8876
  const t = this.components.get(fi), e = this.components.get(dt), i = this.enabled ? 1 : -1;
8803
8877
  let o = 0;
8804
8878
  const r = t.get()[this.groupName], a = new O.Matrix4();
8805
- for (const l in r) {
8879
+ for (const c in r) {
8806
8880
  a.elements[13] = o * i * this.height;
8807
- for (const E in r[l]) {
8808
- const d = e.list.get(E), h = l + E, u = this.list.has(h);
8881
+ for (const E in r[c]) {
8882
+ const d = e.list.get(E), h = c + E, u = this.list.has(h);
8809
8883
  if (!d || this.enabled && u || !this.enabled && !u)
8810
8884
  continue;
8811
8885
  this.enabled ? this.list.add(h) : this.list.delete(h);
8812
- const p = r[l][E];
8886
+ const p = r[c][E];
8813
8887
  d.applyTransform(p, a);
8814
8888
  }
8815
8889
  o++;
@@ -8864,7 +8938,7 @@ class Yr extends gi {
8864
8938
  I(this, "propertiesSize", 100);
8865
8939
  }
8866
8940
  }
8867
- class Vr extends it {
8941
+ class Gr extends it {
8868
8942
  constructor() {
8869
8943
  super(...arguments);
8870
8944
  I(this, "onPropertiesStreamed", new D());
@@ -8914,7 +8988,7 @@ class Vr extends it {
8914
8988
  e.add(E);
8915
8989
  let r = 0.01, a = 0;
8916
8990
  for (const E of e) {
8917
- if (a++, Ln.has(E))
8991
+ if (a++, Pn.has(E))
8918
8992
  continue;
8919
8993
  const d = n.has(E), h = this.webIfc.GetLineIDsWithType(0, E), u = h.size();
8920
8994
  let p = 0;
@@ -8948,10 +9022,10 @@ class Vr extends it {
8948
9022
  const R = a / e.size;
8949
9023
  R > r && (r += 0.01, r = Math.max(r, R), await this.onProgress.trigger(Math.round(r * 100) / 100));
8950
9024
  }
8951
- const l = [];
9025
+ const c = [];
8952
9026
  for (const [E, d] of o)
8953
- l.push([E, ...d]);
8954
- await this.onIndicesStreamed.trigger(l);
9027
+ c.push([E, ...d]);
9028
+ await this.onIndicesStreamed.trigger(c);
8955
9029
  }
8956
9030
  getIndices(t, e, i) {
8957
9031
  const o = t.RelatedObjects || t.RelatedElements;
@@ -8970,16 +9044,16 @@ class Vr extends it {
8970
9044
  for (const a of o) {
8971
9045
  if (a.value === void 0 || a.value === null)
8972
9046
  continue;
8973
- const l = a.value;
8974
- i.has(l) || i.set(l, /* @__PURE__ */ new Set()), i.get(l).add(r);
9047
+ const c = a.value;
9048
+ i.has(c) || i.set(c, /* @__PURE__ */ new Set()), i.get(c).add(r);
8975
9049
  }
8976
9050
  }
8977
9051
  cleanUp() {
8978
9052
  this.webIfc = null, this.webIfc = new b.IfcAPI();
8979
9053
  }
8980
9054
  }
8981
- I(Vr, "uuid", "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b");
8982
- const Ps = class Ps extends it {
9055
+ I(Gr, "uuid", "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b");
9056
+ const ys = class ys extends it {
8983
9057
  constructor(t) {
8984
9058
  super(t);
8985
9059
  I(this, "onGeometryStreamed", new D());
@@ -9001,7 +9075,7 @@ const Ps = class Ps extends it {
9001
9075
  I(this, "_groupSerializer", new $t.Serializer());
9002
9076
  I(this, "_assets", []);
9003
9077
  I(this, "_meshesWithHoles", /* @__PURE__ */ new Set());
9004
- this.components.add(Ps.uuid, this), this.settings.excludedCategories.add(b.IFCOPENINGELEMENT);
9078
+ this.components.add(ys.uuid, this), this.settings.excludedCategories.add(b.IFCOPENINGELEMENT);
9005
9079
  }
9006
9080
  dispose() {
9007
9081
  this.onIfcLoaded.reset(), this.onGeometryStreamed.reset(), this.onAssetStreamed.reset(), this.webIfc = null, this.onDisposed.trigger(), this.onDisposed.reset();
@@ -9032,17 +9106,17 @@ const Ps = class Ps extends it {
9032
9106
  schema: this.webIfc.GetModelSchema(0) || "IFC2X3",
9033
9107
  maxExpressID: this.webIfc.GetMaxExpressID(0)
9034
9108
  };
9035
- let l = 0, E = 0;
9109
+ let c = 0, E = 0;
9036
9110
  for (const T of i) {
9037
9111
  if (!this.webIfc.IsIfcElement(T) && T !== b.IFCSPACE || this.settings.excludedCategories.has(T))
9038
9112
  continue;
9039
9113
  const F = this.webIfc.GetLineIDsWithType(0, T), f = F.size();
9040
9114
  for (let m = 0; m < f; m++) {
9041
- l > t && (l = 0, E++, o.push([]));
9115
+ c > t && (c = 0, E++, o.push([]));
9042
9116
  const g = F.get(m);
9043
9117
  o[E].push(g);
9044
9118
  const S = this._spatialTree.itemsByFloor[g] || 0;
9045
- n.data.set(g, [[], [S, T]]), l++;
9119
+ n.data.set(g, [[], [S, T]]), c++;
9046
9120
  }
9047
9121
  }
9048
9122
  this._spatialTree.cleanUp();
@@ -9074,7 +9148,7 @@ const Ps = class Ps extends it {
9074
9148
  getMesh(t, e, i) {
9075
9149
  const o = e.geometries.size(), n = e.expressID, r = { id: n, geometries: [] };
9076
9150
  for (let a = 0; a < o; a++) {
9077
- const l = e.geometries.get(a), E = l.geometryExpressID, d = l.color.w === 1 ? 1 : -1, h = E * d;
9151
+ const c = e.geometries.get(a), E = c.geometryExpressID, d = c.color.w === 1 ? 1 : -1, h = E * d;
9078
9152
  if (!this._visitedGeometries.has(h)) {
9079
9153
  this._visitedGeometries.has(E) || this.getGeometry(t, E);
9080
9154
  const m = this._visitedGeometries.size, g = O.MathUtils.generateUUID();
@@ -9087,7 +9161,7 @@ const Ps = class Ps extends it {
9087
9161
  if (!p)
9088
9162
  throw new Error("Data not found!");
9089
9163
  p[0].push(u.index);
9090
- const { x: R, y: A, z: C, w: T } = l.color, F = [R, A, C, T], f = l.flatTransformation;
9164
+ const { x: R, y: A, z: C, w: T } = c.color, F = [R, A, C, T], f = c.flatTransformation;
9091
9165
  r.geometries.push({ color: F, geometryID: E, transformation: f });
9092
9166
  }
9093
9167
  this._assets.push(r);
@@ -9102,7 +9176,7 @@ const Ps = class Ps extends it {
9102
9176
  ), r = new Float32Array(n.length / 2), a = new Float32Array(n.length / 2);
9103
9177
  for (let u = 0; u < n.length; u += 6)
9104
9178
  r[u / 2] = n[u], r[u / 2 + 1] = n[u + 1], r[u / 2 + 2] = n[u + 2], a[u / 2] = n[u + 3], a[u / 2 + 1] = n[u + 4], a[u / 2 + 2] = n[u + 5];
9105
- const l = Er(r), E = new Float32Array(l.transformation.elements), d = [l.center.x, l.center.y, l.center.z];
9179
+ const c = Er(r), E = new Float32Array(c.transformation.elements), d = [c.center.x, c.center.y, c.center.z];
9106
9180
  let h = !1;
9107
9181
  for (let u = 0; u < r.length - 2; u += 3) {
9108
9182
  const p = r[u], R = r[u + 1], A = r[u + 2], C = a[u], T = a[u + 1], F = a[u + 2];
@@ -9129,9 +9203,9 @@ const Ps = class Ps extends it {
9129
9203
  this.onGeometryStreamed.trigger({ data: e, buffer: t }), e = null, t = null, this._geometries.clear(), this._geometryCount = 0;
9130
9204
  }
9131
9205
  };
9132
- I(Ps, "uuid", "d9999a00-e1f5-4d3f-8cfe-c56e08609764");
9133
- let Rn = Ps;
9134
- class Gr {
9206
+ I(ys, "uuid", "d9999a00-e1f5-4d3f-8cfe-c56e08609764");
9207
+ let Rn = ys;
9208
+ class Vr {
9135
9209
  constructor(s) {
9136
9210
  /** {@link NavigationMode.enabled} */
9137
9211
  I(this, "enabled", !1);
@@ -9250,8 +9324,8 @@ class kr {
9250
9324
  this._component.three.getWorldDirection(t);
9251
9325
  const e = new O.Vector3();
9252
9326
  this._component.controls.getTarget(e);
9253
- const o = e.clone().sub(this._component.three.position).dot(t), n = s.renderer.getSize(), r = n.x / n.y, a = this._component.three, l = o * 2 * Math.atan(a.fov * (Math.PI / 180) / 2);
9254
- return { width: l * r, height: l };
9327
+ const o = e.clone().sub(this._component.three.position).dot(t), n = s.renderer.getSize(), r = n.x / n.y, a = this._component.three, c = o * 2 * Math.atan(a.fov * (Math.PI / 180) / 2);
9328
+ return { width: c * r, height: c };
9255
9329
  }
9256
9330
  setupOrthoCamera(s, t) {
9257
9331
  this._component.controls.mouseButtons.wheel = ot.ACTION.ZOOM, this._component.controls.mouseButtons.middle = ot.ACTION.ZOOM;
@@ -9280,7 +9354,7 @@ class Jr extends We {
9280
9354
  I(this, "_userInputButtons", {});
9281
9355
  I(this, "_frustumSize", 50);
9282
9356
  I(this, "_navigationModes", /* @__PURE__ */ new Map());
9283
- this.threeOrtho = this.newOrthoCamera(), this._navigationModes.set("Orbit", new zr(this)), this._navigationModes.set("FirstPerson", new Gr(this)), this._navigationModes.set("Plan", new Hr(this)), this.mode = this._navigationModes.get("Orbit"), this.mode.set(!0, { preventTargetAdjustment: !0 }), this.projection = new kr(this), this.onAspectUpdated.add(() => this.setOrthoCameraAspect());
9357
+ this.threeOrtho = this.newOrthoCamera(), this._navigationModes.set("Orbit", new zr(this)), this._navigationModes.set("FirstPerson", new Vr(this)), this._navigationModes.set("Plan", new Hr(this)), this.mode = this._navigationModes.get("Orbit"), this.mode.set(!0, { preventTargetAdjustment: !0 }), this.projection = new kr(this), this.onAspectUpdated.add(() => this.setOrthoCameraAspect());
9284
9358
  }
9285
9359
  get current() {
9286
9360
  return this.projection.camera;
@@ -9316,11 +9390,11 @@ class Jr extends We {
9316
9390
  const p = new O.Box3().setFromObject(u);
9317
9391
  p.min.x < n.x && (n.x = p.min.x), p.min.y < n.y && (n.y = p.min.y), p.min.z < n.z && (n.z = p.min.z), p.max.x > r.x && (r.x = p.max.x), p.max.y > r.y && (r.y = p.max.y), p.max.z > r.z && (r.z = p.max.z);
9318
9392
  }
9319
- const a = new O.Box3(n, r), l = new O.Vector3();
9320
- a.getSize(l);
9393
+ const a = new O.Box3(n, r), c = new O.Vector3();
9394
+ a.getSize(c);
9321
9395
  const E = new O.Vector3();
9322
9396
  a.getCenter(E);
9323
- const d = Math.max(l.x, l.y, l.z) * e, h = new O.Sphere(E, d);
9397
+ const d = Math.max(c.x, c.y, c.z) * e, h = new O.Sphere(E, d);
9324
9398
  await this.controls.fitToSphere(h, !0);
9325
9399
  }
9326
9400
  /**
@@ -9373,19 +9447,19 @@ class ta {
9373
9447
  }
9374
9448
  }
9375
9449
  let a = 0;
9376
- const l = /* @__PURE__ */ new Map(), E = /* @__PURE__ */ new Map();
9450
+ const c = /* @__PURE__ */ new Map(), E = /* @__PURE__ */ new Map();
9377
9451
  for (const { index: d, edges: h } of r) {
9378
9452
  const u = /* @__PURE__ */ new Map();
9379
9453
  for (const { id: f } of h)
9380
- if (l.has(f)) {
9381
- const m = l.get(f);
9454
+ if (c.has(f)) {
9455
+ const m = c.get(f);
9382
9456
  u.set(f, m);
9383
9457
  }
9384
9458
  const p = h.map((f) => f.id);
9385
9459
  if (!u.size) {
9386
9460
  const f = a++;
9387
9461
  for (const { id: m } of h)
9388
- l.set(m, f);
9462
+ c.set(m, f);
9389
9463
  E.set(f, {
9390
9464
  edges: new Set(p),
9391
9465
  indices: /* @__PURE__ */ new Set([d])
@@ -9395,7 +9469,7 @@ class ta {
9395
9469
  let R = null;
9396
9470
  const A = /* @__PURE__ */ new Set(), C = new Set(p);
9397
9471
  for (const [f, m] of u) {
9398
- R === null ? R = m : m !== R && A.add(m), l.delete(f);
9472
+ R === null ? R = m : m !== R && A.add(m), c.delete(f);
9399
9473
  const { edges: g } = E.get(m);
9400
9474
  g.delete(f), C.delete(f);
9401
9475
  }
@@ -9404,16 +9478,16 @@ class ta {
9404
9478
  const T = E.get(R), { indices: F } = T;
9405
9479
  F.add(d);
9406
9480
  for (const f of C) {
9407
- l.set(f, R);
9481
+ c.set(f, R);
9408
9482
  const { edges: m } = T;
9409
9483
  m.add(f);
9410
9484
  }
9411
9485
  for (const f of A) {
9412
- const m = E.get(f), { edges: g, indices: S } = m, _ = E.get(R), { edges: N, indices: y } = _;
9486
+ const m = E.get(f), { edges: g, indices: S } = m, _ = E.get(R), { edges: N, indices: L } = _;
9413
9487
  for (const w of g)
9414
- N.add(w), l.set(w, R);
9488
+ N.add(w), c.set(w, R);
9415
9489
  for (const w of S)
9416
- y.add(w);
9490
+ L.add(w);
9417
9491
  E.delete(f);
9418
9492
  }
9419
9493
  }
@@ -9435,17 +9509,17 @@ class ta {
9435
9509
  static getFaceData(s, t, e) {
9436
9510
  const i = this.getVerticesAndNormal(e, s, t), { p1: o, p2: n, p3: r, faceNormal: a } = i;
9437
9511
  this.round(o), this.round(n), this.round(r), this.round(a);
9438
- const l = [
9512
+ const c = [
9439
9513
  { id: `${o.x}|${o.y}|${o.z}`, value: o },
9440
9514
  { id: `${n.x}|${n.y}|${n.z}`, value: n },
9441
9515
  { id: `${r.x}|${r.y}|${r.z}`, value: r }
9442
9516
  ];
9443
- l.sort((T, F) => T.id < F.id ? -1 : T.id > F.id ? 1 : 0);
9517
+ c.sort((T, F) => T.id < F.id ? -1 : T.id > F.id ? 1 : 0);
9444
9518
  const [
9445
9519
  { id: E, value: d },
9446
9520
  { id: h, value: u },
9447
9521
  { id: p, value: R }
9448
- ] = l, A = [
9522
+ ] = c, A = [
9449
9523
  {
9450
9524
  id: `${E}|${h}`,
9451
9525
  distance: d.distanceTo(u),
@@ -9467,7 +9541,7 @@ class ta {
9467
9541
  static getVerticesAndNormal(s, t, e) {
9468
9542
  if (!s.geometry.index)
9469
9543
  throw new Error("Geometry must be indexed!");
9470
- const i = s.geometry.index.array, o = s.geometry.attributes.position.array, n = s.geometry.attributes.normal.array, r = i[t * 3] * 3, a = i[t * 3 + 1] * 3, l = i[t * 3 + 2] * 3, E = new O.Vector3(o[r], o[r + 1], o[r + 2]), d = new O.Vector3(o[a], o[a + 1], o[a + 2]), h = new O.Vector3(o[l], o[l + 1], o[l + 2]), u = new O.Vector3(n[r], n[r + 1], n[r + 2]), p = new O.Vector3(n[a], n[a + 1], n[a + 2]), R = new O.Vector3(n[l], n[l + 1], n[l + 2]), A = (u.x + p.x + R.x) / 3, C = (u.y + p.y + R.y) / 3, T = (u.z + p.z + R.z) / 3, F = new O.Vector3(A, C, T);
9544
+ const i = s.geometry.index.array, o = s.geometry.attributes.position.array, n = s.geometry.attributes.normal.array, r = i[t * 3] * 3, a = i[t * 3 + 1] * 3, c = i[t * 3 + 2] * 3, E = new O.Vector3(o[r], o[r + 1], o[r + 2]), d = new O.Vector3(o[a], o[a + 1], o[a + 2]), h = new O.Vector3(o[c], o[c + 1], o[c + 2]), u = new O.Vector3(n[r], n[r + 1], n[r + 2]), p = new O.Vector3(n[a], n[a + 1], n[a + 2]), R = new O.Vector3(n[c], n[c + 1], n[c + 2]), A = (u.x + p.x + R.x) / 3, C = (u.y + p.y + R.y) / 3, T = (u.z + p.z + R.z) / 3, F = new O.Vector3(A, C, T);
9471
9545
  if (!F.x && !F.y && !F.z && console.log("hey"), e !== void 0 && s instanceof O.InstancedMesh) {
9472
9546
  const f = new O.Matrix4();
9473
9547
  s.getMatrixAt(e, f);
@@ -9493,7 +9567,7 @@ export {
9493
9567
  ui as Cullers,
9494
9568
  zt as Disposer,
9495
9569
  D as Event,
9496
- Gr as FirstPersonMode,
9570
+ Vr as FirstPersonMode,
9497
9571
  fn as FragmentBoundingBox,
9498
9572
  fi as FragmentClassifier,
9499
9573
  Tn as FragmentExploder,
@@ -9501,7 +9575,7 @@ export {
9501
9575
  Ii as FragmentIfcLoader,
9502
9576
  Rn as FragmentIfcStreamConverter,
9503
9577
  dt as FragmentManager,
9504
- Vr as FragmentPropsStreamConverter,
9578
+ Gr as FragmentPropsStreamConverter,
9505
9579
  Ar as Grids,
9506
9580
  $r as IfcCategories,
9507
9581
  Mn as IfcCategoryMap,