@thatopen/components 2.1.8 → 2.1.10

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,24 +1,24 @@
1
1
  var kn = Object.defineProperty;
2
- var Wn = (l, s, t) => s in l ? kn(l, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[s] = t;
3
- var I = (l, s, t) => (Wn(l, typeof s != "symbol" ? s + "" : s, t), t);
2
+ var Xn = (l, s, t) => s in l ? kn(l, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[s] = t;
3
+ var I = (l, s, t) => (Xn(l, typeof s != "symbol" ? s + "" : s, t), t);
4
4
  import * as O from "three";
5
- import { BufferAttribute as Pn, Vector3 as M, Vector2 as fe, Plane as Fi, Line3 as yt, Triangle as ue, Sphere as Xn, Matrix4 as Lt, Box3 as gt, BackSide as Zn, DoubleSide as yn, FrontSide as wi, Mesh as v, Ray as Qn, Raycaster as jn, Quaternion as Pt, Object3D as ri, Euler as qn, MeshBasicMaterial as Ln, LineBasicMaterial as Kn, CylinderGeometry as ct, BoxGeometry as rt, BufferGeometry as Di, Float32BufferAttribute as Ui, OctahedronGeometry as Ze, Line as Dt, SphereGeometry as $n, TorusGeometry as Re, PlaneGeometry as Jn } from "three";
5
+ import { BufferAttribute as Pn, Vector3 as M, Vector2 as fe, Plane as Fi, Line3 as yt, Triangle as ue, Sphere as Zn, Matrix4 as Lt, Box3 as gt, BackSide as Qn, DoubleSide as yn, FrontSide as wi, Mesh as v, Ray as jn, Raycaster as qn, Quaternion as Pt, Object3D as ri, Euler as Kn, MeshBasicMaterial as Ln, LineBasicMaterial as $n, CylinderGeometry as ct, BoxGeometry as rt, BufferGeometry as Di, Float32BufferAttribute as Ui, OctahedronGeometry as Ze, Line as Dt, SphereGeometry as Jn, TorusGeometry as Re, PlaneGeometry as to } from "three";
6
6
  import * as Vt from "@thatopen/fragments";
7
- import { Serializer as to } from "@thatopen/fragments";
8
- import * as b from "web-ifc";
9
- const Mn = 0, eo = 1, so = 2, xi = 2, Ys = 1.25, bi = 1, Cs = 6 * 4 + 4 + 4, Us = 65535, io = Math.pow(2, -24), Vs = Symbol("SKIP_GENERATION");
10
- function no(l) {
7
+ import { Serializer as eo } from "@thatopen/fragments";
8
+ import * as x from "web-ifc";
9
+ const Mn = 0, so = 1, io = 2, xi = 2, Ys = 1.25, bi = 1, Cs = 6 * 4 + 4 + 4, Us = 65535, no = Math.pow(2, -24), Vs = Symbol("SKIP_GENERATION");
10
+ function oo(l) {
11
11
  return l.index ? l.index.count : l.attributes.position.count;
12
12
  }
13
13
  function Ce(l) {
14
- return no(l) / 3;
14
+ return oo(l) / 3;
15
15
  }
16
- function oo(l, s = ArrayBuffer) {
16
+ function ro(l, s = ArrayBuffer) {
17
17
  return l > 65535 ? new Uint32Array(new s(4 * l)) : new Uint16Array(new s(2 * l));
18
18
  }
19
- function ro(l, s) {
19
+ function ao(l, s) {
20
20
  if (!l.index) {
21
- const t = l.attributes.position.count, e = s.useSharedArrayBuffer ? SharedArrayBuffer : ArrayBuffer, i = oo(t, e);
21
+ const t = l.attributes.position.count, e = s.useSharedArrayBuffer ? SharedArrayBuffer : ArrayBuffer, i = ro(t, e);
22
22
  l.setIndex(new Pn(i, 1));
23
23
  for (let o = 0; o < t; o++)
24
24
  i[o] = o;
@@ -49,7 +49,7 @@ function Dn(l) {
49
49
  }
50
50
  return s;
51
51
  }
52
- function ao(l) {
52
+ function co(l) {
53
53
  if (l.groups.length === 0)
54
54
  return !1;
55
55
  const s = Ce(l), t = Dn(l).sort((o, n) => o.offset - n.offset), e = t[t.length - 1];
@@ -60,7 +60,7 @@ function ao(l) {
60
60
  function K(l, s, t) {
61
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 co(l) {
63
+ function lo(l) {
64
64
  l[0] = l[1] = l[2] = 1 / 0, l[3] = l[4] = l[5] = -1 / 0;
65
65
  }
66
66
  function vi(l) {
@@ -92,19 +92,19 @@ function Ae(l) {
92
92
  return 2 * (s * t + t * e + e * s);
93
93
  }
94
94
  function Gs(l, s, t, e, i = null) {
95
- let o = 1 / 0, n = 1 / 0, r = 1 / 0, a = -1 / 0, c = -1 / 0, h = -1 / 0, d = 1 / 0, E = 1 / 0, u = 1 / 0, f = -1 / 0, R = -1 / 0, m = -1 / 0;
95
+ let o = 1 / 0, n = 1 / 0, r = 1 / 0, a = -1 / 0, c = -1 / 0, h = -1 / 0, d = 1 / 0, E = 1 / 0, u = 1 / 0, f = -1 / 0, T = -1 / 0, R = -1 / 0;
96
96
  const C = i !== null;
97
97
  for (let A = s * 6, F = (s + t) * 6; A < F; A += 6) {
98
- const p = l[A + 0], T = l[A + 1], g = p - T, S = p + T;
98
+ const p = l[A + 0], m = l[A + 1], g = p - m, S = p + m;
99
99
  g < o && (o = g), S > a && (a = S), C && p < d && (d = p), C && p > f && (f = p);
100
100
  const _ = l[A + 2], N = l[A + 3], y = _ - N, w = _ + N;
101
- y < n && (n = y), w > c && (c = w), C && _ < E && (E = _), C && _ > R && (R = _);
102
- const L = l[A + 4], U = l[A + 5], x = L - U, B = L + U;
103
- x < r && (r = x), B > h && (h = B), C && L < u && (u = L), C && L > m && (m = L);
101
+ y < n && (n = y), w > c && (c = w), C && _ < E && (E = _), C && _ > T && (T = _);
102
+ const L = l[A + 4], U = l[A + 5], b = L - U, B = L + U;
103
+ b < r && (r = b), B > h && (h = B), C && L < u && (u = L), C && L > R && (R = L);
104
104
  }
105
- e[0] = o, e[1] = n, e[2] = r, e[3] = a, e[4] = c, e[5] = h, C && (i[0] = d, i[1] = E, i[2] = u, i[3] = f, i[4] = R, i[5] = m);
105
+ e[0] = o, e[1] = n, e[2] = r, e[3] = a, e[4] = c, e[5] = h, C && (i[0] = d, i[1] = E, i[2] = u, i[3] = f, i[4] = T, i[5] = R);
106
106
  }
107
- function lo(l, s, t, e) {
107
+ function ho(l, s, t, e) {
108
108
  let i = 1 / 0, o = 1 / 0, n = 1 / 0, r = -1 / 0, a = -1 / 0, c = -1 / 0;
109
109
  for (let h = s * 6, d = (s + t) * 6; h < d; h += 6) {
110
110
  const E = l[h + 0];
@@ -116,97 +116,97 @@ function lo(l, s, t, e) {
116
116
  }
117
117
  e[0] = i, e[1] = o, e[2] = n, e[3] = r, e[4] = a, e[5] = c;
118
118
  }
119
- function ho(l, s) {
120
- co(s);
119
+ function Eo(l, s) {
120
+ lo(s);
121
121
  const t = l.attributes.position, e = l.index ? l.index.array : null, i = Ce(l), o = new Float32Array(i * 6), n = t.normalized, r = t.array, a = t.offset || 0;
122
122
  let c = 3;
123
123
  t.isInterleavedBufferAttribute && (c = t.data.stride);
124
124
  const h = ["getX", "getY", "getZ"];
125
125
  for (let d = 0; d < i; d++) {
126
126
  const E = d * 3, u = d * 6;
127
- let f = E + 0, R = E + 1, m = E + 2;
128
- e && (f = e[f], R = e[R], m = e[m]), n || (f = f * c + a, R = R * c + a, m = m * c + a);
127
+ let f = E + 0, T = E + 1, R = E + 2;
128
+ e && (f = e[f], T = e[T], R = e[R]), n || (f = f * c + a, T = T * c + a, R = R * c + a);
129
129
  for (let C = 0; C < 3; C++) {
130
130
  let A, F, p;
131
- n ? (A = t[h[C]](f), F = t[h[C]](R), p = t[h[C]](m)) : (A = r[f + C], F = r[R + C], p = r[m + C]);
132
- let T = A;
133
- F < T && (T = F), p < T && (T = p);
131
+ n ? (A = t[h[C]](f), F = t[h[C]](T), p = t[h[C]](R)) : (A = r[f + C], F = r[T + C], p = r[R + C]);
132
+ let m = A;
133
+ F < m && (m = F), p < m && (m = p);
134
134
  let g = A;
135
135
  F > g && (g = F), p > g && (g = p);
136
- const S = (g - T) / 2, _ = C * 2;
137
- o[u + _ + 0] = T + S, o[u + _ + 1] = S + (Math.abs(T) + S) * io, T < s[C] && (s[C] = T), g > s[C + 3] && (s[C + 3] = g);
136
+ const S = (g - m) / 2, _ = C * 2;
137
+ o[u + _ + 0] = m + S, o[u + _ + 1] = S + (Math.abs(m) + S) * no, m < s[C] && (s[C] = m), g > s[C + 3] && (s[C + 3] = g);
138
138
  }
139
139
  }
140
140
  return o;
141
141
  }
142
- const Mt = 32, Eo = (l, s) => l.candidate - s.candidate, Ut = new Array(Mt).fill().map(() => ({
142
+ const Mt = 32, uo = (l, s) => l.candidate - s.candidate, Ut = new Array(Mt).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
  })), je = new Float32Array(6);
149
- function uo(l, s, t, e, i, o) {
149
+ function Io(l, s, t, e, i, o) {
150
150
  let n = -1, r = 0;
151
151
  if (o === Mn)
152
152
  n = vi(s), n !== -1 && (r = (s[n] + s[n + 3]) / 2);
153
- else if (o === eo)
154
- n = vi(l), n !== -1 && (r = Io(t, e, i, n));
155
- else if (o === so) {
153
+ else if (o === so)
154
+ n = vi(l), n !== -1 && (r = fo(t, e, i, n));
155
+ else if (o === io) {
156
156
  const a = Ae(l);
157
157
  let c = Ys * i;
158
158
  const h = e * 6, d = (e + i) * 6;
159
159
  for (let E = 0; E < 3; E++) {
160
- const u = s[E], m = (s[E + 3] - u) / Mt;
160
+ const u = s[E], R = (s[E + 3] - u) / Mt;
161
161
  if (i < Mt / 4) {
162
162
  const C = [...Ut];
163
163
  C.length = i;
164
164
  let A = 0;
165
165
  for (let p = h; p < d; p += 6, A++) {
166
- const T = C[A];
167
- T.candidate = t[p + 2 * E], T.count = 0;
166
+ const m = C[A];
167
+ m.candidate = t[p + 2 * E], m.count = 0;
168
168
  const {
169
169
  bounds: g,
170
170
  leftCacheBounds: S,
171
171
  rightCacheBounds: _
172
- } = T;
172
+ } = m;
173
173
  for (let N = 0; N < 3; N++)
174
174
  _[N] = 1 / 0, _[N + 3] = -1 / 0, S[N] = 1 / 0, S[N + 3] = -1 / 0, g[N] = 1 / 0, g[N + 3] = -1 / 0;
175
175
  Qe(p, t, g);
176
176
  }
177
- C.sort(Eo);
177
+ C.sort(uo);
178
178
  let F = i;
179
179
  for (let p = 0; p < F; p++) {
180
- const T = C[p];
181
- for (; p + 1 < F && C[p + 1].candidate === T.candidate; )
180
+ const m = C[p];
181
+ for (; p + 1 < F && C[p + 1].candidate === m.candidate; )
182
182
  C.splice(p + 1, 1), F--;
183
183
  }
184
184
  for (let p = h; p < d; p += 6) {
185
- const T = t[p + 2 * E];
185
+ const m = t[p + 2 * E];
186
186
  for (let g = 0; g < F; g++) {
187
187
  const S = C[g];
188
- T >= S.candidate ? Qe(p, t, S.rightCacheBounds) : (Qe(p, t, S.leftCacheBounds), S.count++);
188
+ m >= S.candidate ? Qe(p, t, S.rightCacheBounds) : (Qe(p, t, S.leftCacheBounds), S.count++);
189
189
  }
190
190
  }
191
191
  for (let p = 0; p < F; p++) {
192
- const T = C[p], g = T.count, S = i - T.count, _ = T.leftCacheBounds, N = T.rightCacheBounds;
192
+ const m = C[p], g = m.count, S = i - m.count, _ = m.leftCacheBounds, N = m.rightCacheBounds;
193
193
  let y = 0;
194
194
  g !== 0 && (y = Ae(_) / a);
195
195
  let w = 0;
196
196
  S !== 0 && (w = Ae(N) / a);
197
197
  const L = bi + Ys * (y * g + w * S);
198
- L < c && (n = E, c = L, r = T.candidate);
198
+ L < c && (n = E, c = L, r = m.candidate);
199
199
  }
200
200
  } else {
201
201
  for (let F = 0; F < Mt; F++) {
202
202
  const p = Ut[F];
203
- p.count = 0, p.candidate = u + m + F * m;
204
- const T = p.bounds;
203
+ p.count = 0, p.candidate = u + R + F * R;
204
+ const m = p.bounds;
205
205
  for (let g = 0; g < 3; g++)
206
- T[g] = 1 / 0, T[g + 3] = -1 / 0;
206
+ m[g] = 1 / 0, m[g + 3] = -1 / 0;
207
207
  }
208
208
  for (let F = h; F < d; F += 6) {
209
- let g = ~~((t[F + 2 * E] - u) / m);
209
+ let g = ~~((t[F + 2 * E] - u) / R);
210
210
  g >= Mt && (g = Mt - 1);
211
211
  const S = Ut[g];
212
212
  S.count++, Qe(F, t, S.bounds);
@@ -214,13 +214,13 @@ function uo(l, s, t, e, i, o) {
214
214
  const C = Ut[Mt - 1];
215
215
  Bi(C.bounds, C.rightCacheBounds);
216
216
  for (let F = Mt - 2; F >= 0; F--) {
217
- const p = Ut[F], T = Ut[F + 1];
218
- Yi(p.bounds, T.rightCacheBounds, p.rightCacheBounds);
217
+ const p = Ut[F], m = Ut[F + 1];
218
+ Yi(p.bounds, m.rightCacheBounds, p.rightCacheBounds);
219
219
  }
220
220
  let A = 0;
221
221
  for (let F = 0; F < Mt - 1; F++) {
222
- const p = Ut[F], T = p.count, g = p.bounds, _ = Ut[F + 1].rightCacheBounds;
223
- T !== 0 && (A === 0 ? Bi(g, je) : Yi(g, je, je)), A += T;
222
+ const p = Ut[F], m = p.count, g = p.bounds, _ = Ut[F + 1].rightCacheBounds;
223
+ m !== 0 && (A === 0 ? Bi(g, je) : Yi(g, je, je)), A += m;
224
224
  let N = 0, y = 0;
225
225
  A !== 0 && (N = Ae(je) / a);
226
226
  const w = i - A;
@@ -234,7 +234,7 @@ function uo(l, 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 Io(l, s, t, e) {
237
+ function fo(l, s, t, e) {
238
238
  let i = 0;
239
239
  for (let o = s, n = s + t; o < n; o++)
240
240
  i += l[o * 6 + e * 2];
@@ -244,7 +244,7 @@ class qe {
244
244
  constructor() {
245
245
  }
246
246
  }
247
- function fo(l, s, t, e, i, o) {
247
+ function po(l, s, t, e, i, o) {
248
248
  let n = e, r = e + i - 1;
249
249
  const a = o.pos, c = o.axis * 2;
250
250
  for (; ; ) {
@@ -266,7 +266,7 @@ function fo(l, s, t, e, i, o) {
266
266
  return n;
267
267
  }
268
268
  }
269
- function po(l, s, t, e, i, o) {
269
+ function Co(l, s, t, e, i, o) {
270
270
  let n = e, r = e + i - 1;
271
271
  const a = o.pos, c = o.axis * 2;
272
272
  for (; ; ) {
@@ -286,53 +286,53 @@ function po(l, s, t, e, i, o) {
286
286
  return n;
287
287
  }
288
288
  }
289
- function Co(l, s) {
289
+ function To(l, s) {
290
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 To(l, s) {
295
+ function mo(l, s) {
296
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 = Ce(t), h = l._indirectBuffer;
297
297
  let d = !1;
298
- const E = new Float32Array(6), u = new Float32Array(6), f = ho(t, E), R = s.indirect ? po : fo, m = [], C = s.indirect ? wn(t) : Dn(t);
298
+ const E = new Float32Array(6), u = new Float32Array(6), f = Eo(t, E), T = s.indirect ? Co : po, R = [], C = s.indirect ? wn(t) : Dn(t);
299
299
  if (C.length === 1) {
300
- const p = C[0], T = new qe();
301
- T.boundingData = E, lo(f, p.offset, p.count, u), F(T, p.offset, p.count, u), m.push(T);
300
+ const p = C[0], m = new qe();
301
+ m.boundingData = E, ho(f, p.offset, p.count, u), F(m, p.offset, p.count, u), R.push(m);
302
302
  } else
303
303
  for (let p of C) {
304
- const T = new qe();
305
- T.boundingData = new Float32Array(6), Gs(f, p.offset, p.count, T.boundingData, u), F(T, p.offset, p.count, u), m.push(T);
304
+ const m = new qe();
305
+ m.boundingData = new Float32Array(6), Gs(f, p.offset, p.count, m.boundingData, u), F(m, p.offset, p.count, u), R.push(m);
306
306
  }
307
- return m;
307
+ return R;
308
308
  function A(p) {
309
309
  a && a(p / c);
310
310
  }
311
- function F(p, T, g, S = null, _ = 0) {
311
+ function F(p, 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)
313
- return A(T + g), p.offset = T, p.count = g, p;
314
- const N = uo(p.boundingData, S, f, T, g, r);
313
+ return A(m + g), p.offset = m, p.count = g, p;
314
+ const N = Io(p.boundingData, S, f, m, g, r);
315
315
  if (N.axis === -1)
316
- return A(T + g), p.offset = T, p.count = g, p;
317
- const y = R(h, e, f, T, g, N);
318
- if (y === T || y === T + g)
319
- A(T + g), p.offset = T, p.count = g;
316
+ return A(m + g), p.offset = m, p.count = g, p;
317
+ const y = T(h, e, f, m, g, N);
318
+ if (y === m || y === m + g)
319
+ A(m + g), p.offset = m, p.count = g;
320
320
  else {
321
321
  p.splitAxis = N.axis;
322
- const w = new qe(), L = T, U = y - T;
322
+ const w = new qe(), L = m, U = y - m;
323
323
  p.left = w, w.boundingData = new Float32Array(6), Gs(f, L, U, w.boundingData, u), F(w, L, U, u, _ + 1);
324
- const x = new qe(), B = y, H = g - U;
325
- p.right = x, x.boundingData = new Float32Array(6), Gs(f, B, H, x.boundingData, u), F(x, B, H, u, _ + 1);
324
+ const b = new qe(), B = y, H = g - U;
325
+ p.right = b, b.boundingData = new Float32Array(6), Gs(f, B, H, b.boundingData, u), F(b, B, H, u, _ + 1);
326
326
  }
327
327
  return p;
328
328
  }
329
329
  }
330
- function mo(l, s) {
330
+ function Ro(l, s) {
331
331
  const t = l.geometry;
332
- s.indirect && (l._indirectBuffer = Co(t, s.useSharedArrayBuffer), ao(t) && !s.verbose && console.warn(
332
+ s.indirect && (l._indirectBuffer = To(t, s.useSharedArrayBuffer), co(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
- )), l._indirectBuffer || ro(t, s);
335
- const e = To(l, s);
334
+ )), l._indirectBuffer || ao(t, s);
335
+ const e = mo(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++) {
@@ -347,10 +347,10 @@ function mo(l, s) {
347
347
  return d.count ? 1 : 1 + c(d.left) + c(d.right);
348
348
  }
349
349
  function h(d, E) {
350
- const u = d / 4, f = d / 2, R = !!E.count, m = E.boundingData;
350
+ const u = d / 4, f = d / 2, T = !!E.count, R = E.boundingData;
351
351
  for (let C = 0; C < 6; C++)
352
- i[u + C] = m[C];
353
- if (R) {
352
+ i[u + C] = R[C];
353
+ if (T) {
354
354
  const C = E.offset, A = E.count;
355
355
  return o[u + 6] = C, n[f + 14] = A, n[f + 15] = Us, d + Cs;
356
356
  } else {
@@ -401,19 +401,19 @@ wt.prototype.setFromBox = function() {
401
401
  this.min = n, this.max = r;
402
402
  };
403
403
  }();
404
- const Ro = function() {
404
+ const Ao = function() {
405
405
  const l = new M(), s = new M(), t = new M();
406
406
  return function(i, o, n) {
407
407
  const r = i.start, a = l, c = o.start, h = s;
408
408
  t.subVectors(r, c), l.subVectors(i.end, i.start), s.subVectors(o.end, o.start);
409
- const d = t.dot(h), E = h.dot(a), u = h.dot(h), f = t.dot(a), m = a.dot(a) * u - E * E;
409
+ const d = t.dot(h), E = h.dot(a), u = h.dot(h), f = t.dot(a), R = a.dot(a) * u - E * E;
410
410
  let C, A;
411
- m !== 0 ? C = (d * E - f * u) / m : C = 0, A = (d + C * E) / u, n.x = C, n.y = A;
411
+ R !== 0 ? C = (d * E - f * u) / R : C = 0, A = (d + C * E) / u, n.x = C, n.y = A;
412
412
  };
413
413
  }(), gi = function() {
414
414
  const l = new fe(), s = new M(), t = new M();
415
415
  return function(i, o, n, r) {
416
- Ro(i, o, l);
416
+ Ao(i, o, l);
417
417
  let a = l.x, c = l.y;
418
418
  if (a >= 0 && a <= 1 && c >= 0 && c <= 1) {
419
419
  i.at(a, n), o.at(c, r);
@@ -439,30 +439,30 @@ const Ro = function() {
439
439
  }
440
440
  }
441
441
  };
442
- }(), Ao = function() {
442
+ }(), Fo = function() {
443
443
  const l = new M(), s = new M(), t = new Fi(), e = new yt();
444
444
  return function(o, n) {
445
445
  const { radius: r, center: a } = o, { a: c, b: h, c: d } = n;
446
446
  if (e.start = c, e.end = h, e.closestPointToPoint(a, !0, l).distanceTo(a) <= r || (e.start = c, e.end = d, e.closestPointToPoint(a, !0, l).distanceTo(a) <= r) || (e.start = h, e.end = d, e.closestPointToPoint(a, !0, l).distanceTo(a) <= r))
447
447
  return !0;
448
- const R = n.getPlane(t);
449
- if (Math.abs(R.distanceToPoint(a)) <= r) {
450
- const C = R.projectPoint(a, s);
448
+ const T = n.getPlane(t);
449
+ if (Math.abs(T.distanceToPoint(a)) <= r) {
450
+ const C = T.projectPoint(a, s);
451
451
  if (n.containsPoint(C))
452
452
  return !0;
453
453
  }
454
454
  return !1;
455
455
  };
456
- }(), Fo = 1e-15;
456
+ }(), go = 1e-15;
457
457
  function zs(l) {
458
- return Math.abs(l) < Fo;
458
+ return Math.abs(l) < go;
459
459
  }
460
460
  class Ft extends ue {
461
461
  constructor(...s) {
462
- super(...s), this.isExtendedTriangle = !0, this.satAxes = new Array(4).fill().map(() => new M()), this.satBounds = new Array(4).fill().map(() => new wt()), this.points = [this.a, this.b, this.c], this.sphere = new Xn(), this.plane = new Fi(), this.needsUpdate = !0;
462
+ super(...s), this.isExtendedTriangle = !0, this.satAxes = new Array(4).fill().map(() => new M()), this.satBounds = new Array(4).fill().map(() => new wt()), this.points = [this.a, this.b, this.c], this.sphere = new Zn(), this.plane = new Fi(), this.needsUpdate = !0;
463
463
  }
464
464
  intersectsSphere(s) {
465
- return Ao(s, this);
465
+ return Fo(s, this);
466
466
  }
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];
@@ -489,18 +489,18 @@ Ft.prototype.closestPointToSegment = function() {
489
489
  }();
490
490
  Ft.prototype.intersectsTriangle = function() {
491
491
  const l = new Ft(), s = new Array(3), t = new Array(3), e = new wt(), i = new wt(), o = new M(), n = new M(), r = new M(), a = new M(), c = new M(), h = new yt(), d = new yt(), E = new yt(), u = new M();
492
- function f(R, m, C) {
493
- const A = R.points;
492
+ function f(T, R, C) {
493
+ const A = T.points;
494
494
  let F = 0, p = -1;
495
- for (let T = 0; T < 3; T++) {
495
+ for (let m = 0; m < 3; m++) {
496
496
  const { start: g, end: S } = h;
497
- g.copy(A[T]), S.copy(A[(T + 1) % 3]), h.delta(n);
498
- const _ = zs(m.distanceToPoint(g));
499
- if (zs(m.normal.dot(n)) && _) {
497
+ g.copy(A[m]), S.copy(A[(m + 1) % 3]), h.delta(n);
498
+ const _ = zs(R.distanceToPoint(g));
499
+ if (zs(R.normal.dot(n)) && _) {
500
500
  C.copy(h), F = 2;
501
501
  break;
502
502
  }
503
- const N = m.intersectLine(h, u);
503
+ const N = R.intersectLine(h, u);
504
504
  if (!N && _ && u.copy(g), (N || _) && !zs(u.distanceTo(S))) {
505
505
  if (F <= 1)
506
506
  (F === 1 ? C.start : C.end).copy(u), _ && (p = F);
@@ -514,18 +514,18 @@ Ft.prototype.intersectsTriangle = function() {
514
514
  }
515
515
  return F;
516
516
  }
517
- return function(m, C = null, A = !1) {
518
- this.needsUpdate && this.update(), m.isExtendedTriangle ? m.needsUpdate && m.update() : (l.copy(m), l.update(), m = l);
519
- const F = this.plane, p = m.plane;
517
+ return function(R, C = null, A = !1) {
518
+ this.needsUpdate && this.update(), R.isExtendedTriangle ? R.needsUpdate && R.update() : (l.copy(R), l.update(), R = l);
519
+ const F = this.plane, p = R.plane;
520
520
  if (Math.abs(F.normal.dot(p.normal)) > 1 - 1e-10) {
521
- const T = this.satBounds, g = this.satAxes;
522
- t[0] = m.a, t[1] = m.b, t[2] = m.c;
521
+ const m = this.satBounds, g = this.satAxes;
522
+ t[0] = R.a, t[1] = R.b, t[2] = R.c;
523
523
  for (let N = 0; N < 4; N++) {
524
- const y = T[N], w = g[N];
524
+ const y = m[N], w = g[N];
525
525
  if (e.setFromPoints(w, t), y.isSeparated(e))
526
526
  return !1;
527
527
  }
528
- const S = m.satBounds, _ = m.satAxes;
528
+ const S = R.satBounds, _ = R.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
531
  const y = S[N], w = _[N];
@@ -542,12 +542,12 @@ Ft.prototype.intersectsTriangle = function() {
542
542
  }
543
543
  return C && (A || console.warn("ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0."), C.start.set(0, 0, 0), C.end.set(0, 0, 0)), !0;
544
544
  } else {
545
- const T = f(this, p, d);
546
- if (T === 1 && m.containsPoint(d.end))
545
+ const m = f(this, p, d);
546
+ if (m === 1 && R.containsPoint(d.end))
547
547
  return C && (C.start.copy(d.end), C.end.copy(d.end)), !0;
548
- if (T !== 2)
548
+ if (m !== 2)
549
549
  return !1;
550
- const g = f(m, F, E);
550
+ const g = f(R, F, E);
551
551
  if (g === 1 && this.containsPoint(E.end))
552
552
  return C && (C.start.copy(E.end), C.end.copy(E.end)), !0;
553
553
  if (g !== 2)
@@ -578,15 +578,15 @@ Ft.prototype.distanceToTriangle = function() {
578
578
  let E;
579
579
  const u = t[d], f = n[u];
580
580
  this.closestPointToPoint(f, l), E = f.distanceToSquared(l), E < h && (h = E, r && r.copy(l), a && a.copy(f));
581
- const R = this[u];
582
- n.closestPointToPoint(R, l), E = R.distanceToSquared(l), E < h && (h = E, r && r.copy(R), a && a.copy(l));
581
+ const T = this[u];
582
+ n.closestPointToPoint(T, l), E = T.distanceToSquared(l), E < h && (h = E, r && r.copy(T), a && a.copy(l));
583
583
  }
584
584
  for (let d = 0; d < 3; d++) {
585
585
  const E = t[d], u = t[(d + 1) % 3];
586
586
  e.set(this[E], this[u]);
587
587
  for (let f = 0; f < 3; f++) {
588
- const R = t[f], m = t[(f + 1) % 3];
589
- i.set(n[R], n[m]), gi(e, i, l, s);
588
+ const T = t[f], R = t[(f + 1) % 3];
589
+ i.set(n[T], n[R]), gi(e, i, l, s);
590
590
  const C = l.distanceToSquared(s);
591
591
  C < h && (h = C, r && r.copy(l), a && a.copy(s));
592
592
  }
@@ -658,8 +658,8 @@ at.prototype.intersectsTriangle = function() {
658
658
  for (let E = 0; E < 3; E++) {
659
659
  const u = a[E];
660
660
  for (let f = 0; f < 4; f++) {
661
- const R = h[f];
662
- if (i.crossVectors(u, R), t.setFromPoints(i, s), e.setFromPoints(i, d), t.isSeparated(e))
661
+ const T = h[f];
662
+ if (i.crossVectors(u, T), t.setFromPoints(i, s), e.setFromPoints(i, d), t.isSeparated(e))
663
663
  return !1;
664
664
  }
665
665
  }
@@ -684,32 +684,32 @@ at.prototype.distanceToBox = function() {
684
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 h = r * r, d = n.min, E = n.max, u = this.points;
686
686
  let f = 1 / 0;
687
- for (let m = 0; m < 8; m++) {
688
- const C = u[m];
687
+ for (let R = 0; R < 8; R++) {
688
+ const C = u[R];
689
689
  i.copy(C).clamp(d, E);
690
690
  const A = C.distanceToSquared(i);
691
691
  if (A < f && (f = A, a && a.copy(C), c && c.copy(i), A < h))
692
692
  return Math.sqrt(A);
693
693
  }
694
- let R = 0;
695
- for (let m = 0; m < 3; m++)
694
+ let T = 0;
695
+ for (let R = 0; R < 3; R++)
696
696
  for (let C = 0; C <= 1; C++)
697
697
  for (let A = 0; A <= 1; A++) {
698
- const F = (m + 1) % 3, p = (m + 2) % 3, T = C << F | A << p, g = 1 << m | C << F | A << p, S = u[T], _ = u[g];
699
- s[R].set(S, _);
700
- const y = l[m], w = l[F], L = l[p], U = t[R], x = U.start, B = U.end;
701
- x[y] = d[y], x[w] = C ? d[w] : E[w], x[L] = A ? d[L] : E[w], B[y] = E[y], B[w] = C ? d[w] : E[w], B[L] = A ? d[L] : E[w], R++;
698
+ const F = (R + 1) % 3, p = (R + 2) % 3, m = C << F | A << p, g = 1 << R | C << F | A << p, S = u[m], _ = u[g];
699
+ s[T].set(S, _);
700
+ const y = l[R], w = l[F], L = l[p], U = t[T], b = U.start, B = U.end;
701
+ b[y] = d[y], b[w] = C ? d[w] : E[w], b[L] = A ? d[L] : E[w], B[y] = E[y], B[w] = C ? d[w] : E[w], B[L] = A ? d[L] : E[w], T++;
702
702
  }
703
- for (let m = 0; m <= 1; m++)
703
+ for (let R = 0; R <= 1; R++)
704
704
  for (let C = 0; C <= 1; C++)
705
705
  for (let A = 0; A <= 1; A++) {
706
- i.x = m ? E.x : d.x, i.y = C ? E.y : d.y, i.z = A ? E.z : d.z, this.closestPointToPoint(i, e);
706
+ i.x = R ? E.x : d.x, i.y = C ? E.y : d.y, i.z = A ? E.z : d.z, this.closestPointToPoint(i, e);
707
707
  const F = i.distanceToSquared(e);
708
708
  if (F < f && (f = F, a && a.copy(e), c && c.copy(i), F < h))
709
709
  return Math.sqrt(F);
710
710
  }
711
- for (let m = 0; m < 12; m++) {
712
- const C = s[m];
711
+ for (let R = 0; R < 12; R++) {
712
+ const C = s[R];
713
713
  for (let A = 0; A < 12; A++) {
714
714
  const F = t[A];
715
715
  gi(C, F, e, i);
@@ -733,12 +733,12 @@ class Oi {
733
733
  this._primitives.push(s);
734
734
  }
735
735
  }
736
- class go extends Oi {
736
+ class Oo extends Oi {
737
737
  constructor() {
738
738
  super(() => new Ft());
739
739
  }
740
740
  }
741
- const It = /* @__PURE__ */ new go();
741
+ const It = /* @__PURE__ */ new Oo();
742
742
  function Et(l, s) {
743
743
  return s[l + 15] === 65535;
744
744
  }
@@ -757,7 +757,7 @@ function Ct(l, s) {
757
757
  function Un(l, s) {
758
758
  return s[l + 7];
759
759
  }
760
- class Oo {
760
+ class So {
761
761
  constructor() {
762
762
  this.float32Array = null, this.uint16Array = null, this.uint32Array = null;
763
763
  const s = [];
@@ -769,10 +769,10 @@ class Oo {
769
769
  };
770
770
  }
771
771
  }
772
- const Z = new Oo();
772
+ const Z = new So();
773
773
  let Yt, Ie;
774
774
  const Jt = [], Ke = /* @__PURE__ */ new Oi(() => new gt());
775
- function So(l, s, t, e, i, o) {
775
+ function _o(l, s, t, e, i, o) {
776
776
  Yt = Ke.getPrimitive(), Ie = Ke.getPrimitive(), Jt.push(Yt, Ie), Z.setBuffer(l._roots[s]);
777
777
  const n = ai(0, l.geometry, t, e, i, o);
778
778
  Z.clearBuffer(), Ke.releasePrimitive(Yt), Ke.releasePrimitive(Ie), Jt.pop(), Jt.pop();
@@ -787,33 +787,33 @@ function ai(l, s, t, e, i = null, o = 0, n = 0) {
787
787
  return K(l, r, Yt), e(E, u, !1, n, o + l, Yt);
788
788
  } else {
789
789
  let y = function(L) {
790
- const { uint16Array: U, uint32Array: x } = Z;
790
+ const { uint16Array: U, uint32Array: b } = Z;
791
791
  let B = L * 2;
792
792
  for (; !Et(B, U); )
793
793
  L = pt(L), B = L * 2;
794
- return dt(L, x);
794
+ return dt(L, b);
795
795
  }, w = function(L) {
796
- const { uint16Array: U, uint32Array: x } = Z;
796
+ const { uint16Array: U, uint32Array: b } = Z;
797
797
  let B = L * 2;
798
798
  for (; !Et(B, U); )
799
- L = Ct(L, x), B = L * 2;
800
- return dt(L, x) + ft(B, U);
799
+ L = Ct(L, b), B = L * 2;
800
+ return dt(L, b) + ft(B, U);
801
801
  };
802
802
  const E = pt(l), u = Ct(l, c);
803
- let f = E, R = u, m, C, A, F;
804
- if (i && (A = Yt, F = Ie, K(f, r, A), K(R, r, F), m = i(A), C = i(F), C < m)) {
805
- f = u, R = E;
806
- const L = m;
807
- m = C, C = L, A = F;
803
+ let f = E, T = u, R, C, A, F;
804
+ if (i && (A = Yt, F = Ie, K(f, r, A), K(T, r, F), R = i(A), C = i(F), C < R)) {
805
+ f = u, T = E;
806
+ const L = R;
807
+ R = C, C = L, A = F;
808
808
  }
809
809
  A || (A = Yt, K(f, r, A));
810
- const p = Et(f * 2, a), T = t(A, p, m, n + 1, o + f);
810
+ const p = Et(f * 2, a), m = t(A, p, R, n + 1, o + f);
811
811
  let g;
812
- if (T === xi) {
813
- const L = y(f), x = w(f) - L;
814
- g = e(L, x, !0, n + 1, o + f, A);
812
+ if (m === xi) {
813
+ const L = y(f), b = w(f) - L;
814
+ g = e(L, b, !0, n + 1, o + f, A);
815
815
  } else
816
- g = T && ai(
816
+ g = m && ai(
817
817
  f,
818
818
  s,
819
819
  t,
@@ -824,15 +824,15 @@ function ai(l, s, t, e, i = null, o = 0, n = 0) {
824
824
  );
825
825
  if (g)
826
826
  return !0;
827
- F = Ie, K(R, r, F);
828
- const S = Et(R * 2, a), _ = t(F, S, C, n + 1, o + R);
827
+ F = Ie, K(T, r, F);
828
+ const S = Et(T * 2, a), _ = t(F, S, C, n + 1, o + T);
829
829
  let N;
830
830
  if (_ === xi) {
831
- const L = y(R), x = w(R) - L;
832
- N = e(L, x, !0, n + 1, o + R, F);
831
+ const L = y(T), b = w(T) - L;
832
+ N = e(L, b, !0, n + 1, o + T, F);
833
833
  } else
834
834
  N = _ && ai(
835
- R,
835
+ T,
836
836
  s,
837
837
  t,
838
838
  e,
@@ -844,7 +844,7 @@ function ai(l, s, t, e, i = null, o = 0, n = 0) {
844
844
  }
845
845
  }
846
846
  const Fe = /* @__PURE__ */ new M(), Hs = /* @__PURE__ */ new M();
847
- function _o(l, s, t = {}, e = 0, i = 1 / 0) {
847
+ function No(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
850
  if (l.shapecast(
@@ -863,16 +863,16 @@ function _o(l, s, t = {}, e = 0, i = 1 / 0) {
863
863
  return t.point ? t.point.copy(Hs) : t.point = Hs.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(), $e = /* @__PURE__ */ new fe(), Je = /* @__PURE__ */ new fe(), ts = /* @__PURE__ */ new fe(), Vi = /* @__PURE__ */ new M(), Gi = /* @__PURE__ */ new M(), zi = /* @__PURE__ */ new M(), es = /* @__PURE__ */ new M();
866
- function No(l, s, t, e, i, o) {
866
+ function Po(l, s, t, e, i, o) {
867
867
  let n;
868
- return o === Zn ? n = l.intersectTriangle(e, t, s, !0, i) : n = l.intersectTriangle(s, t, e, o !== yn, i), n === null ? null : {
868
+ return o === Qn ? n = l.intersectTriangle(e, t, s, !0, i) : n = l.intersectTriangle(s, t, e, o !== yn, i), n === null ? null : {
869
869
  distance: l.origin.distanceTo(i),
870
870
  point: i.clone()
871
871
  };
872
872
  }
873
- function Po(l, s, t, e, i, o, n, r, a) {
873
+ function yo(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 c = No(l, te, ee, se, es, a);
875
+ const c = Po(l, te, ee, se, es, a);
876
876
  if (c) {
877
877
  e && ($e.fromBufferAttribute(e, o), Je.fromBufferAttribute(e, n), ts.fromBufferAttribute(e, r), c.uv = ue.getInterpolation(es, te, ee, se, $e, Je, ts, new fe())), i && ($e.fromBufferAttribute(i, o), Je.fromBufferAttribute(i, n), ts.fromBufferAttribute(i, r), c.uv1 = ue.getInterpolation(es, te, ee, se, $e, Je, ts, new fe())), t && (Vi.fromBufferAttribute(t, o), Gi.fromBufferAttribute(t, n), zi.fromBufferAttribute(t, r), c.normal = ue.getInterpolation(es, te, ee, se, Vi, Gi, zi, new M()), c.normal.dot(l.direction) > 0 && c.normal.multiplyScalar(-1));
878
878
  const h = {
@@ -891,7 +891,7 @@ function xs(l, s, t, e, i) {
891
891
  let n = o + 0, r = o + 1, a = o + 2;
892
892
  const c = l.index;
893
893
  l.index && (n = c.getX(n), r = c.getX(r), a = c.getX(a));
894
- const { position: h, normal: d, uv: E, uv1: u } = l.attributes, f = Po(t, h, d, E, u, n, r, a, s);
894
+ const { position: h, normal: d, uv: E, uv1: u } = l.attributes, f = yo(t, h, d, E, u, n, r, a, s);
895
895
  return f ? (f.faceIndex = e, i && i.push(f), f) : null;
896
896
  }
897
897
  function tt(l, s, t, e) {
@@ -899,12 +899,12 @@ function tt(l, s, t, e) {
899
899
  let r = s, a = s + 1, c = s + 2;
900
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 yo(l, s, t, e, i, o) {
902
+ function Lo(l, s, t, e, i, o) {
903
903
  const { geometry: n, _indirectBuffer: r } = l;
904
904
  for (let a = e, c = e + i; a < c; a++)
905
905
  xs(n, s, t, a, o);
906
906
  }
907
- function Lo(l, s, t, e, i) {
907
+ function Mo(l, s, t, e, i) {
908
908
  const { geometry: o, _indirectBuffer: n } = l;
909
909
  let r = 1 / 0, a = null;
910
910
  for (let c = e, h = e + i; c < h; c++) {
@@ -913,7 +913,7 @@ function Lo(l, s, t, e, i) {
913
913
  }
914
914
  return a;
915
915
  }
916
- function Mo(l, s, t, e, i, o, n) {
916
+ function wo(l, s, t, e, i, o, n) {
917
917
  const { geometry: r } = t, { index: a } = r, c = r.attributes.position;
918
918
  for (let h = l, d = s + l; h < d; h++) {
919
919
  let E;
@@ -922,7 +922,7 @@ function Mo(l, s, t, e, i, o, n) {
922
922
  }
923
923
  return !1;
924
924
  }
925
- function wo(l, s = null) {
925
+ function Do(l, s = null) {
926
926
  s && Array.isArray(s) && (s = new Set(s));
927
927
  const t = l.geometry, e = t.index ? t.index.array : null, i = t.attributes.position;
928
928
  let o, n, r, a, c = 0;
@@ -930,29 +930,29 @@ function wo(l, s = null) {
930
930
  for (let E = 0, u = h.length; E < u; E++)
931
931
  o = h[E], n = new Uint32Array(o), r = new Uint16Array(o), a = new Float32Array(o), d(0, c), c += o.byteLength;
932
932
  function d(E, u, f = !1) {
933
- const R = E * 2;
934
- if (r[R + 15] === Us) {
935
- const C = n[E + 6], A = r[R + 14];
936
- let F = 1 / 0, p = 1 / 0, T = 1 / 0, g = -1 / 0, S = -1 / 0, _ = -1 / 0;
933
+ const T = E * 2;
934
+ if (r[T + 15] === Us) {
935
+ const C = n[E + 6], A = r[T + 14];
936
+ let F = 1 / 0, p = 1 / 0, m = 1 / 0, g = -1 / 0, S = -1 / 0, _ = -1 / 0;
937
937
  for (let N = 3 * C, y = 3 * (C + A); N < y; 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 < p && (p = U), U > S && (S = U), x < T && (T = x), x > _ && (_ = x);
939
+ const L = i.getX(w), U = i.getY(w), b = i.getZ(w);
940
+ L < F && (F = L), L > g && (g = L), U < p && (p = U), U > S && (S = U), b < m && (m = b), b > _ && (_ = b);
941
941
  }
942
- return a[E + 0] !== F || a[E + 1] !== p || a[E + 2] !== T || a[E + 3] !== g || a[E + 4] !== S || a[E + 5] !== _ ? (a[E + 0] = F, a[E + 1] = p, a[E + 2] = T, a[E + 3] = g, a[E + 4] = S, a[E + 5] = _, !0) : !1;
942
+ return a[E + 0] !== F || a[E + 1] !== p || a[E + 2] !== m || a[E + 3] !== g || a[E + 4] !== S || a[E + 5] !== _ ? (a[E + 0] = F, a[E + 1] = p, a[E + 2] = m, a[E + 3] = g, a[E + 4] = S, a[E + 5] = _, !0) : !1;
943
943
  } else {
944
944
  const C = E + 8, A = n[E + 6], F = C + u, p = A + u;
945
- let T = f, g = !1, S = !1;
946
- s ? T || (g = s.has(F), S = s.has(p), T = !g && !S) : (g = !0, S = !0);
947
- const _ = T || g, N = T || S;
945
+ let m = f, g = !1, S = !1;
946
+ s ? m || (g = s.has(F), S = s.has(p), m = !g && !S) : (g = !0, S = !0);
947
+ const _ = m || g, N = m || S;
948
948
  let y = !1;
949
- _ && (y = d(C, u, T));
949
+ _ && (y = d(C, u, m));
950
950
  let w = !1;
951
- N && (w = d(A, u, T));
951
+ N && (w = d(A, u, m));
952
952
  const L = y || w;
953
953
  if (L)
954
954
  for (let U = 0; U < 3; U++) {
955
- const x = C + U, B = A + U, H = a[x], q = a[x + 3], st = a[B], Q = a[B + 3];
955
+ const b = C + U, B = A + U, H = a[b], q = a[b + 3], st = a[B], Q = a[B + 3];
956
956
  a[E + U] = H < st ? H : st, a[E + U + 3] = q > Q ? q : Q;
957
957
  }
958
958
  return L;
@@ -963,14 +963,14 @@ const Hi = /* @__PURE__ */ new gt();
963
963
  function Gt(l, s, t, e) {
964
964
  return K(l, s, Hi), t.intersectBox(Hi, e);
965
965
  }
966
- function Do(l, s, t, e, i, o) {
966
+ function Uo(l, s, t, e, i, o) {
967
967
  const { geometry: n, _indirectBuffer: r } = l;
968
968
  for (let a = e, c = e + i; a < c; a++) {
969
969
  let h = r ? r[a] : a;
970
970
  xs(n, s, t, h, o);
971
971
  }
972
972
  }
973
- function Uo(l, s, t, e, i) {
973
+ function xo(l, s, t, e, i) {
974
974
  const { geometry: o, _indirectBuffer: n } = l;
975
975
  let r = 1 / 0, a = null;
976
976
  for (let c = e, h = e + i; c < h; c++) {
@@ -979,7 +979,7 @@ function Uo(l, s, t, e, i) {
979
979
  }
980
980
  return a;
981
981
  }
982
- function xo(l, s, t, e, i, o, n) {
982
+ function bo(l, s, t, e, i, o, n) {
983
983
  const { geometry: r } = t, { index: a } = r, c = r.attributes.position;
984
984
  for (let h = l, d = s + l; h < d; h++) {
985
985
  let E;
@@ -988,24 +988,24 @@ function xo(l, s, t, e, i, o, n) {
988
988
  }
989
989
  return !1;
990
990
  }
991
- const ki = /* @__PURE__ */ new M();
992
- function bo(l, s, t, e, i) {
991
+ const Wi = /* @__PURE__ */ new M();
992
+ function vo(l, s, t, e, i) {
993
993
  Z.setBuffer(l._roots[s]), ci(0, l, t, e, i), Z.clearBuffer();
994
994
  }
995
995
  function ci(l, s, t, e, i) {
996
996
  const { float32Array: o, uint16Array: n, uint32Array: r } = Z, a = l * 2;
997
997
  if (Et(a, n)) {
998
998
  const h = dt(l, r), d = ft(a, n);
999
- yo(s, t, e, h, d, i);
999
+ Lo(s, t, e, h, d, i);
1000
1000
  } else {
1001
1001
  const h = pt(l);
1002
- Gt(h, o, e, ki) && ci(h, s, t, e, i);
1002
+ Gt(h, o, e, Wi) && ci(h, s, t, e, i);
1003
1003
  const d = Ct(l, r);
1004
- Gt(d, o, e, ki) && ci(d, s, t, e, i);
1004
+ Gt(d, o, e, Wi) && ci(d, s, t, e, i);
1005
1005
  }
1006
1006
  }
1007
- const Wi = /* @__PURE__ */ new M(), vo = ["x", "y", "z"];
1008
- function Bo(l, s, t, e) {
1007
+ const ki = /* @__PURE__ */ new M(), Bo = ["x", "y", "z"];
1008
+ function Yo(l, s, t, e) {
1009
1009
  Z.setBuffer(l._roots[s]);
1010
1010
  const i = li(0, l, t, e);
1011
1011
  return Z.clearBuffer(), i;
@@ -1015,26 +1015,26 @@ function li(l, s, t, e) {
1015
1015
  let r = l * 2;
1016
1016
  if (Et(r, o)) {
1017
1017
  const c = dt(l, n), h = ft(r, o);
1018
- return Lo(s, t, e, c, h);
1018
+ return Mo(s, t, e, c, h);
1019
1019
  } else {
1020
- const c = Un(l, n), h = vo[c], E = e.direction[h] >= 0;
1020
+ const c = Un(l, n), h = Bo[c], E = e.direction[h] >= 0;
1021
1021
  let u, f;
1022
1022
  E ? (u = pt(l), f = Ct(l, n)) : (u = Ct(l, n), f = pt(l));
1023
- const m = Gt(u, i, e, Wi) ? li(u, s, t, e) : null;
1024
- if (m) {
1025
- const F = m.point[h];
1023
+ const R = Gt(u, i, e, ki) ? li(u, s, t, e) : null;
1024
+ if (R) {
1025
+ const F = R.point[h];
1026
1026
  if (E ? F <= i[f + c] : (
1027
1027
  // min bounding data
1028
1028
  F >= i[f + c + 3]
1029
1029
  ))
1030
- return m;
1030
+ return R;
1031
1031
  }
1032
- const A = Gt(f, i, e, Wi) ? li(f, s, t, e) : null;
1033
- return m && A ? m.distance <= A.distance ? m : A : m || A || null;
1032
+ const A = Gt(f, i, e, ki) ? li(f, s, t, e) : null;
1033
+ return R && A ? R.distance <= A.distance ? R : A : R || A || null;
1034
1034
  }
1035
1035
  }
1036
1036
  const ss = /* @__PURE__ */ new gt(), ie = /* @__PURE__ */ new Ft(), ne = /* @__PURE__ */ new Ft(), ge = /* @__PURE__ */ new Lt(), Xi = /* @__PURE__ */ new at(), is = /* @__PURE__ */ new at();
1037
- function Yo(l, s, t, e) {
1037
+ function Vo(l, s, t, e) {
1038
1038
  Z.setBuffer(l._roots[s]);
1039
1039
  const i = hi(0, l, t, e);
1040
1040
  return Z.clearBuffer(), i;
@@ -1043,19 +1043,19 @@ function hi(l, s, t, e, i = null) {
1043
1043
  const { float32Array: o, uint16Array: n, uint32Array: r } = Z;
1044
1044
  let a = l * 2;
1045
1045
  if (i === null && (t.boundingBox || t.computeBoundingBox(), Xi.set(t.boundingBox.min, t.boundingBox.max, e), i = Xi), Et(a, n)) {
1046
- const h = s.geometry, d = h.index, E = h.attributes.position, u = t.index, f = t.attributes.position, R = dt(l, r), m = ft(a, n);
1046
+ const h = s.geometry, d = h.index, E = h.attributes.position, u = t.index, f = t.attributes.position, T = dt(l, r), R = ft(a, n);
1047
1047
  if (ge.copy(e).invert(), t.boundsTree)
1048
1048
  return K(l, o, is), is.matrix.copy(ge), is.needsUpdate = !0, t.boundsTree.shapecast({
1049
1049
  intersectsBounds: (A) => is.intersectsBox(A),
1050
1050
  intersectsTriangle: (A) => {
1051
1051
  A.a.applyMatrix4(e), A.b.applyMatrix4(e), A.c.applyMatrix4(e), A.needsUpdate = !0;
1052
- for (let F = R * 3, p = (m + R) * 3; F < p; F += 3)
1052
+ for (let F = T * 3, p = (R + T) * 3; F < p; F += 3)
1053
1053
  if (tt(ne, F, d, E), ne.needsUpdate = !0, A.intersectsTriangle(ne))
1054
1054
  return !0;
1055
1055
  return !1;
1056
1056
  }
1057
1057
  });
1058
- for (let C = R * 3, A = (m + R) * 3; C < A; C += 3) {
1058
+ for (let C = T * 3, A = (R + T) * 3; C < A; C += 3) {
1059
1059
  tt(ie, C, d, E), ie.a.applyMatrix4(ge), ie.b.applyMatrix4(ge), ie.c.applyMatrix4(ge), ie.needsUpdate = !0;
1060
1060
  for (let F = 0, p = u.count; F < p; F += 3)
1061
1061
  if (tt(ne, F, u, f), ne.needsUpdate = !0, ie.intersectsTriangle(ne))
@@ -1066,18 +1066,18 @@ function hi(l, s, t, e, i = null) {
1066
1066
  return K(h, o, ss), !!(i.intersectsBox(ss) && hi(h, s, t, e, i) || (K(d, o, ss), i.intersectsBox(ss) && hi(d, s, t, e, i)));
1067
1067
  }
1068
1068
  }
1069
- const ns = /* @__PURE__ */ new Lt(), ks = /* @__PURE__ */ new at(), Oe = /* @__PURE__ */ new at(), Vo = /* @__PURE__ */ new M(), Go = /* @__PURE__ */ new M(), zo = /* @__PURE__ */ new M(), Ho = /* @__PURE__ */ new M();
1069
+ const ns = /* @__PURE__ */ new Lt(), Ws = /* @__PURE__ */ new at(), Oe = /* @__PURE__ */ new at(), Go = /* @__PURE__ */ new M(), zo = /* @__PURE__ */ new M(), Ho = /* @__PURE__ */ new M(), Wo = /* @__PURE__ */ new M();
1070
1070
  function ko(l, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
1071
- s.boundingBox || s.computeBoundingBox(), ks.set(s.boundingBox.min, s.boundingBox.max, t), ks.needsUpdate = !0;
1071
+ s.boundingBox || s.computeBoundingBox(), Ws.set(s.boundingBox.min, s.boundingBox.max, t), Ws.needsUpdate = !0;
1072
1072
  const r = l.geometry, a = r.attributes.position, c = r.index, h = s.attributes.position, d = s.index, E = It.getPrimitive(), u = It.getPrimitive();
1073
- let f = Vo, R = Go, m = null, C = null;
1074
- i && (m = zo, C = Ho);
1073
+ let f = Go, T = zo, R = null, C = null;
1074
+ i && (R = Ho, C = Wo);
1075
1075
  let A = 1 / 0, F = null, p = null;
1076
1076
  return ns.copy(t).invert(), Oe.matrix.copy(ns), l.shapecast(
1077
1077
  {
1078
- boundsTraverseOrder: (T) => ks.distanceToBox(T),
1079
- intersectsBounds: (T, g, S) => S < A && S < n ? (g && (Oe.min.copy(T.min), Oe.max.copy(T.max), Oe.needsUpdate = !0), !0) : !1,
1080
- intersectsRange: (T, g) => {
1078
+ boundsTraverseOrder: (m) => Ws.distanceToBox(m),
1079
+ intersectsBounds: (m, g, S) => S < A && S < n ? (g && (Oe.min.copy(m.min), Oe.max.copy(m.max), Oe.needsUpdate = !0), !0) : !1,
1080
+ intersectsRange: (m, g) => {
1081
1081
  if (s.boundsTree)
1082
1082
  return s.boundsTree.shapecast({
1083
1083
  boundsTraverseOrder: (_) => Oe.distanceToBox(_),
@@ -1085,10 +1085,10 @@ function ko(l, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
1085
1085
  intersectsRange: (_, N) => {
1086
1086
  for (let y = _, w = _ + N; y < w; y++) {
1087
1087
  tt(u, 3 * y, d, h), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
1088
- for (let L = T, U = T + g; L < U; L++) {
1088
+ for (let L = m, U = m + g; L < U; L++) {
1089
1089
  tt(E, 3 * L, c, a), E.needsUpdate = !0;
1090
- const x = E.distanceToTriangle(u, f, m);
1091
- if (x < A && (R.copy(f), C && C.copy(m), A = x, F = L, p = y), x < o)
1090
+ const b = E.distanceToTriangle(u, f, R);
1091
+ if (b < A && (T.copy(f), C && C.copy(R), A = b, F = L, p = y), b < o)
1092
1092
  return !0;
1093
1093
  }
1094
1094
  }
@@ -1098,19 +1098,19 @@ function ko(l, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
1098
1098
  const S = Ce(s);
1099
1099
  for (let _ = 0, N = S; _ < N; _++) {
1100
1100
  tt(u, 3 * _, d, h), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
1101
- for (let y = T, w = T + g; y < w; y++) {
1101
+ for (let y = m, w = m + g; y < w; y++) {
1102
1102
  tt(E, 3 * y, c, a), E.needsUpdate = !0;
1103
- const L = E.distanceToTriangle(u, f, m);
1104
- if (L < A && (R.copy(f), C && C.copy(m), A = L, F = y, p = _), L < o)
1103
+ const L = E.distanceToTriangle(u, f, R);
1104
+ if (L < A && (T.copy(f), C && C.copy(R), A = L, F = y, p = _), L < o)
1105
1105
  return !0;
1106
1106
  }
1107
1107
  }
1108
1108
  }
1109
1109
  }
1110
1110
  }
1111
- ), It.releasePrimitive(E), It.releasePrimitive(u), A === 1 / 0 ? null : (e.point ? e.point.copy(R) : e.point = R.clone(), e.distance = A, e.faceIndex = F, i && (i.point ? i.point.copy(C) : i.point = C.clone(), i.point.applyMatrix4(ns), R.applyMatrix4(ns), i.distance = R.sub(i.point).length(), i.faceIndex = p), e);
1111
+ ), It.releasePrimitive(E), It.releasePrimitive(u), A === 1 / 0 ? null : (e.point ? e.point.copy(T) : e.point = T.clone(), e.distance = A, e.faceIndex = F, i && (i.point ? i.point.copy(C) : i.point = C.clone(), i.point.applyMatrix4(ns), T.applyMatrix4(ns), i.distance = T.sub(i.point).length(), i.faceIndex = p), e);
1112
1112
  }
1113
- function Wo(l, s = null) {
1113
+ function Xo(l, s = null) {
1114
1114
  s && Array.isArray(s) && (s = new Set(s));
1115
1115
  const t = l.geometry, e = t.index ? t.index.array : null, i = t.attributes.position;
1116
1116
  let o, n, r, a, c = 0;
@@ -1118,33 +1118,33 @@ function Wo(l, s = null) {
1118
1118
  for (let E = 0, u = h.length; E < u; E++)
1119
1119
  o = h[E], n = new Uint32Array(o), r = new Uint16Array(o), a = new Float32Array(o), d(0, c), c += o.byteLength;
1120
1120
  function d(E, u, f = !1) {
1121
- const R = E * 2;
1122
- if (r[R + 15] === Us) {
1123
- const C = n[E + 6], A = r[R + 14];
1124
- let F = 1 / 0, p = 1 / 0, T = 1 / 0, g = -1 / 0, S = -1 / 0, _ = -1 / 0;
1121
+ const T = E * 2;
1122
+ if (r[T + 15] === Us) {
1123
+ const C = n[E + 6], A = r[T + 14];
1124
+ let F = 1 / 0, p = 1 / 0, m = 1 / 0, g = -1 / 0, S = -1 / 0, _ = -1 / 0;
1125
1125
  for (let N = C, y = C + A; N < y; N++) {
1126
1126
  const w = 3 * l.resolveTriangleIndex(N);
1127
1127
  for (let L = 0; L < 3; L++) {
1128
1128
  let U = w + L;
1129
1129
  U = e ? e[U] : U;
1130
- const x = i.getX(U), B = i.getY(U), H = i.getZ(U);
1131
- x < F && (F = x), x > g && (g = x), B < p && (p = B), B > S && (S = B), H < T && (T = H), H > _ && (_ = H);
1130
+ const b = i.getX(U), B = i.getY(U), H = i.getZ(U);
1131
+ b < F && (F = b), b > g && (g = b), B < p && (p = B), B > S && (S = B), H < m && (m = H), H > _ && (_ = H);
1132
1132
  }
1133
1133
  }
1134
- return a[E + 0] !== F || a[E + 1] !== p || a[E + 2] !== T || a[E + 3] !== g || a[E + 4] !== S || a[E + 5] !== _ ? (a[E + 0] = F, a[E + 1] = p, a[E + 2] = T, a[E + 3] = g, a[E + 4] = S, a[E + 5] = _, !0) : !1;
1134
+ return a[E + 0] !== F || a[E + 1] !== p || a[E + 2] !== m || a[E + 3] !== g || a[E + 4] !== S || a[E + 5] !== _ ? (a[E + 0] = F, a[E + 1] = p, a[E + 2] = m, a[E + 3] = g, a[E + 4] = S, a[E + 5] = _, !0) : !1;
1135
1135
  } else {
1136
1136
  const C = E + 8, A = n[E + 6], F = C + u, p = A + u;
1137
- let T = f, g = !1, S = !1;
1138
- s ? T || (g = s.has(F), S = s.has(p), T = !g && !S) : (g = !0, S = !0);
1139
- const _ = T || g, N = T || S;
1137
+ let m = f, g = !1, S = !1;
1138
+ s ? m || (g = s.has(F), S = s.has(p), m = !g && !S) : (g = !0, S = !0);
1139
+ const _ = m || g, N = m || S;
1140
1140
  let y = !1;
1141
- _ && (y = d(C, u, T));
1141
+ _ && (y = d(C, u, m));
1142
1142
  let w = !1;
1143
- N && (w = d(A, u, T));
1143
+ N && (w = d(A, u, m));
1144
1144
  const L = y || w;
1145
1145
  if (L)
1146
1146
  for (let U = 0; U < 3; U++) {
1147
- const x = C + U, B = A + U, H = a[x], q = a[x + 3], st = a[B], Q = a[B + 3];
1147
+ const b = C + U, B = A + U, H = a[b], q = a[b + 3], st = a[B], Q = a[B + 3];
1148
1148
  a[E + U] = H < st ? H : st, a[E + U + 3] = q > Q ? q : Q;
1149
1149
  }
1150
1150
  return L;
@@ -1152,14 +1152,14 @@ function Wo(l, s = null) {
1152
1152
  }
1153
1153
  }
1154
1154
  const Zi = /* @__PURE__ */ new M();
1155
- function Xo(l, s, t, e, i) {
1155
+ function Zo(l, s, t, e, i) {
1156
1156
  Z.setBuffer(l._roots[s]), Ei(0, l, t, e, i), Z.clearBuffer();
1157
1157
  }
1158
1158
  function Ei(l, s, t, e, i) {
1159
1159
  const { float32Array: o, uint16Array: n, uint32Array: r } = Z, a = l * 2;
1160
1160
  if (Et(a, n)) {
1161
1161
  const h = dt(l, r), d = ft(a, n);
1162
- Do(s, t, e, h, d, i);
1162
+ Uo(s, t, e, h, d, i);
1163
1163
  } else {
1164
1164
  const h = pt(l);
1165
1165
  Gt(h, o, e, Zi) && Ei(h, s, t, e, i);
@@ -1167,8 +1167,8 @@ function Ei(l, s, t, e, i) {
1167
1167
  Gt(d, o, e, Zi) && Ei(d, s, t, e, i);
1168
1168
  }
1169
1169
  }
1170
- const Qi = /* @__PURE__ */ new M(), Zo = ["x", "y", "z"];
1171
- function Qo(l, s, t, e) {
1170
+ const Qi = /* @__PURE__ */ new M(), Qo = ["x", "y", "z"];
1171
+ function jo(l, s, t, e) {
1172
1172
  Z.setBuffer(l._roots[s]);
1173
1173
  const i = di(0, l, t, e);
1174
1174
  return Z.clearBuffer(), i;
@@ -1178,26 +1178,26 @@ function di(l, s, t, e) {
1178
1178
  let r = l * 2;
1179
1179
  if (Et(r, o)) {
1180
1180
  const c = dt(l, n), h = ft(r, o);
1181
- return Uo(s, t, e, c, h);
1181
+ return xo(s, t, e, c, h);
1182
1182
  } else {
1183
- const c = Un(l, n), h = Zo[c], E = e.direction[h] >= 0;
1183
+ const c = Un(l, n), h = Qo[c], E = e.direction[h] >= 0;
1184
1184
  let u, f;
1185
1185
  E ? (u = pt(l), f = Ct(l, n)) : (u = Ct(l, n), f = pt(l));
1186
- const m = Gt(u, i, e, Qi) ? di(u, s, t, e) : null;
1187
- if (m) {
1188
- const F = m.point[h];
1186
+ const R = Gt(u, i, e, Qi) ? di(u, s, t, e) : null;
1187
+ if (R) {
1188
+ const F = R.point[h];
1189
1189
  if (E ? F <= i[f + c] : (
1190
1190
  // min bounding data
1191
1191
  F >= i[f + c + 3]
1192
1192
  ))
1193
- return m;
1193
+ return R;
1194
1194
  }
1195
1195
  const A = Gt(f, i, e, Qi) ? di(f, s, t, e) : null;
1196
- return m && A ? m.distance <= A.distance ? m : A : m || A || null;
1196
+ return R && A ? R.distance <= A.distance ? R : A : R || A || null;
1197
1197
  }
1198
1198
  }
1199
1199
  const os = /* @__PURE__ */ new gt(), oe = /* @__PURE__ */ new Ft(), re = /* @__PURE__ */ new Ft(), Se = /* @__PURE__ */ new Lt(), ji = /* @__PURE__ */ new at(), rs = /* @__PURE__ */ new at();
1200
- function jo(l, s, t, e) {
1200
+ function qo(l, s, t, e) {
1201
1201
  Z.setBuffer(l._roots[s]);
1202
1202
  const i = ui(0, l, t, e);
1203
1203
  return Z.clearBuffer(), i;
@@ -1206,22 +1206,22 @@ function ui(l, s, t, e, i = null) {
1206
1206
  const { float32Array: o, uint16Array: n, uint32Array: r } = Z;
1207
1207
  let a = l * 2;
1208
1208
  if (i === null && (t.boundingBox || t.computeBoundingBox(), ji.set(t.boundingBox.min, t.boundingBox.max, e), i = ji), Et(a, n)) {
1209
- const h = s.geometry, d = h.index, E = h.attributes.position, u = t.index, f = t.attributes.position, R = dt(l, r), m = ft(a, n);
1209
+ const h = s.geometry, d = h.index, E = h.attributes.position, u = t.index, f = t.attributes.position, T = dt(l, r), R = ft(a, n);
1210
1210
  if (Se.copy(e).invert(), t.boundsTree)
1211
1211
  return K(l, o, rs), rs.matrix.copy(Se), rs.needsUpdate = !0, t.boundsTree.shapecast({
1212
1212
  intersectsBounds: (A) => rs.intersectsBox(A),
1213
1213
  intersectsTriangle: (A) => {
1214
1214
  A.a.applyMatrix4(e), A.b.applyMatrix4(e), A.c.applyMatrix4(e), A.needsUpdate = !0;
1215
- for (let F = R, p = m + R; F < p; F++)
1215
+ for (let F = T, p = R + T; F < p; F++)
1216
1216
  if (tt(re, 3 * s.resolveTriangleIndex(F), d, E), re.needsUpdate = !0, A.intersectsTriangle(re))
1217
1217
  return !0;
1218
1218
  return !1;
1219
1219
  }
1220
1220
  });
1221
- for (let C = R, A = m + R; C < A; C++) {
1221
+ for (let C = T, A = R + T; C < A; C++) {
1222
1222
  const F = s.resolveTriangleIndex(C);
1223
1223
  tt(oe, 3 * F, d, E), oe.a.applyMatrix4(Se), oe.b.applyMatrix4(Se), oe.c.applyMatrix4(Se), oe.needsUpdate = !0;
1224
- for (let p = 0, T = u.count; p < T; p += 3)
1224
+ for (let p = 0, m = u.count; p < m; p += 3)
1225
1225
  if (tt(re, p, u, f), re.needsUpdate = !0, oe.intersectsTriangle(re))
1226
1226
  return !0;
1227
1227
  }
@@ -1230,18 +1230,18 @@ function ui(l, s, t, e, i = null) {
1230
1230
  return K(h, o, os), !!(i.intersectsBox(os) && ui(h, s, t, e, i) || (K(d, o, os), i.intersectsBox(os) && ui(d, s, t, e, i)));
1231
1231
  }
1232
1232
  }
1233
- const as = /* @__PURE__ */ new Lt(), Ws = /* @__PURE__ */ new at(), _e = /* @__PURE__ */ new at(), qo = /* @__PURE__ */ new M(), Ko = /* @__PURE__ */ new M(), $o = /* @__PURE__ */ new M(), Jo = /* @__PURE__ */ new M();
1234
- function tr(l, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
1235
- s.boundingBox || s.computeBoundingBox(), Ws.set(s.boundingBox.min, s.boundingBox.max, t), Ws.needsUpdate = !0;
1233
+ const as = /* @__PURE__ */ new Lt(), ks = /* @__PURE__ */ new at(), _e = /* @__PURE__ */ new at(), Ko = /* @__PURE__ */ new M(), $o = /* @__PURE__ */ new M(), Jo = /* @__PURE__ */ new M(), tr = /* @__PURE__ */ new M();
1234
+ function er(l, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
1235
+ s.boundingBox || s.computeBoundingBox(), ks.set(s.boundingBox.min, s.boundingBox.max, t), ks.needsUpdate = !0;
1236
1236
  const r = l.geometry, a = r.attributes.position, c = r.index, h = s.attributes.position, d = s.index, E = It.getPrimitive(), u = It.getPrimitive();
1237
- let f = qo, R = Ko, m = null, C = null;
1238
- i && (m = $o, C = Jo);
1237
+ let f = Ko, T = $o, R = null, C = null;
1238
+ i && (R = Jo, C = tr);
1239
1239
  let A = 1 / 0, F = null, p = null;
1240
1240
  return as.copy(t).invert(), _e.matrix.copy(as), l.shapecast(
1241
1241
  {
1242
- boundsTraverseOrder: (T) => Ws.distanceToBox(T),
1243
- intersectsBounds: (T, g, S) => S < A && S < n ? (g && (_e.min.copy(T.min), _e.max.copy(T.max), _e.needsUpdate = !0), !0) : !1,
1244
- intersectsRange: (T, g) => {
1242
+ boundsTraverseOrder: (m) => ks.distanceToBox(m),
1243
+ intersectsBounds: (m, g, S) => S < A && S < n ? (g && (_e.min.copy(m.min), _e.max.copy(m.max), _e.needsUpdate = !0), !0) : !1,
1244
+ intersectsRange: (m, g) => {
1245
1245
  if (s.boundsTree) {
1246
1246
  const S = s.boundsTree;
1247
1247
  return S.shapecast({
@@ -1251,11 +1251,11 @@ function tr(l, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
1251
1251
  for (let y = _, w = _ + N; y < w; y++) {
1252
1252
  const L = S.resolveTriangleIndex(y);
1253
1253
  tt(u, 3 * L, d, h), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
1254
- for (let U = T, x = T + g; U < x; U++) {
1254
+ for (let U = m, b = m + g; U < b; U++) {
1255
1255
  const B = l.resolveTriangleIndex(U);
1256
1256
  tt(E, 3 * B, c, a), E.needsUpdate = !0;
1257
- const H = E.distanceToTriangle(u, f, m);
1258
- if (H < A && (R.copy(f), C && C.copy(m), A = H, F = U, p = y), H < o)
1257
+ const H = E.distanceToTriangle(u, f, R);
1258
+ if (H < A && (T.copy(f), C && C.copy(R), A = H, F = U, p = y), H < o)
1259
1259
  return !0;
1260
1260
  }
1261
1261
  }
@@ -1265,25 +1265,25 @@ function tr(l, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
1265
1265
  const S = Ce(s);
1266
1266
  for (let _ = 0, N = S; _ < N; _++) {
1267
1267
  tt(u, 3 * _, d, h), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
1268
- for (let y = T, w = T + g; y < w; y++) {
1268
+ for (let y = m, w = m + g; y < w; y++) {
1269
1269
  const L = l.resolveTriangleIndex(y);
1270
1270
  tt(E, 3 * L, c, a), E.needsUpdate = !0;
1271
- const U = E.distanceToTriangle(u, f, m);
1272
- if (U < A && (R.copy(f), C && C.copy(m), A = U, F = y, p = _), U < o)
1271
+ const U = E.distanceToTriangle(u, f, R);
1272
+ if (U < A && (T.copy(f), C && C.copy(R), A = U, F = y, p = _), U < o)
1273
1273
  return !0;
1274
1274
  }
1275
1275
  }
1276
1276
  }
1277
1277
  }
1278
1278
  }
1279
- ), It.releasePrimitive(E), It.releasePrimitive(u), A === 1 / 0 ? null : (e.point ? e.point.copy(R) : e.point = R.clone(), e.distance = A, e.faceIndex = F, i && (i.point ? i.point.copy(C) : i.point = C.clone(), i.point.applyMatrix4(as), R.applyMatrix4(as), i.distance = R.sub(i.point).length(), i.faceIndex = p), e);
1279
+ ), It.releasePrimitive(E), It.releasePrimitive(u), A === 1 / 0 ? null : (e.point ? e.point.copy(T) : e.point = T.clone(), e.distance = A, e.faceIndex = F, i && (i.point ? i.point.copy(C) : i.point = C.clone(), i.point.applyMatrix4(as), T.applyMatrix4(as), i.distance = T.sub(i.point).length(), i.faceIndex = p), e);
1280
1280
  }
1281
- function er() {
1281
+ function sr() {
1282
1282
  return typeof SharedArrayBuffer < "u";
1283
1283
  }
1284
1284
  const be = new Z.constructor(), As = new Z.constructor(), vt = new Oi(() => new gt()), ae = new gt(), ce = new gt(), Xs = new gt(), Zs = new gt();
1285
1285
  let Qs = !1;
1286
- function sr(l, s, t, e) {
1286
+ function ir(l, s, t, e) {
1287
1287
  if (Qs)
1288
1288
  throw new Error("MeshBVH: Recursive calls to bvhcast not supported.");
1289
1289
  Qs = !0;
@@ -1315,21 +1315,21 @@ function sr(l, s, t, e) {
1315
1315
  function Tt(l, s, t, e, i, o = 0, n = 0, r = 0, a = 0, c = null, h = !1) {
1316
1316
  let d, E;
1317
1317
  h ? (d = As, E = be) : (d = be, E = As);
1318
- const u = d.float32Array, f = d.uint32Array, R = d.uint16Array, m = E.float32Array, C = E.uint32Array, A = E.uint16Array, F = l * 2, p = s * 2, T = Et(F, R), g = Et(p, A);
1318
+ const u = d.float32Array, f = d.uint32Array, T = d.uint16Array, R = E.float32Array, C = E.uint32Array, A = E.uint16Array, F = l * 2, p = s * 2, m = Et(F, T), g = Et(p, A);
1319
1319
  let S = !1;
1320
- if (g && T)
1320
+ if (g && m)
1321
1321
  h ? S = i(
1322
1322
  dt(s, C),
1323
1323
  ft(s * 2, A),
1324
1324
  dt(l, f),
1325
- ft(l * 2, R),
1325
+ ft(l * 2, T),
1326
1326
  a,
1327
1327
  n + s,
1328
1328
  r,
1329
1329
  o + l
1330
1330
  ) : S = i(
1331
1331
  dt(l, f),
1332
- ft(l * 2, R),
1332
+ ft(l * 2, T),
1333
1333
  dt(s, C),
1334
1334
  ft(s * 2, A),
1335
1335
  r,
@@ -1339,7 +1339,7 @@ function Tt(l, s, t, e, i, o = 0, n = 0, r = 0, a = 0, c = null, h = !1) {
1339
1339
  );
1340
1340
  else if (g) {
1341
1341
  const _ = vt.getPrimitive();
1342
- K(s, m, _), _.applyMatrix4(t);
1342
+ K(s, R, _), _.applyMatrix4(t);
1343
1343
  const N = pt(l), y = Ct(l, f);
1344
1344
  K(N, u, ae), K(y, u, ce);
1345
1345
  const w = _.intersectsBox(ae), L = _.intersectsBox(ce);
@@ -1370,7 +1370,7 @@ function Tt(l, s, t, e, i, o = 0, n = 0, r = 0, a = 0, c = null, h = !1) {
1370
1370
  ), vt.releasePrimitive(_);
1371
1371
  } else {
1372
1372
  const _ = pt(s), N = Ct(s, C);
1373
- K(_, m, Xs), K(N, m, Zs);
1373
+ K(_, R, Xs), K(N, R, Zs);
1374
1374
  const y = c.intersectsBox(Xs), w = c.intersectsBox(Zs);
1375
1375
  if (y && w)
1376
1376
  S = Tt(
@@ -1399,7 +1399,7 @@ function Tt(l, s, t, e, i, o = 0, n = 0, r = 0, a = 0, c = null, h = !1) {
1399
1399
  h
1400
1400
  );
1401
1401
  else if (y)
1402
- if (T)
1402
+ if (m)
1403
1403
  S = Tt(
1404
1404
  l,
1405
1405
  _,
@@ -1416,8 +1416,8 @@ function Tt(l, s, t, e, i, o = 0, n = 0, r = 0, a = 0, c = null, h = !1) {
1416
1416
  else {
1417
1417
  const L = vt.getPrimitive();
1418
1418
  L.copy(Xs).applyMatrix4(t);
1419
- const U = pt(l), x = Ct(l, f);
1420
- K(U, u, ae), K(x, u, ce);
1419
+ const U = pt(l), b = Ct(l, f);
1420
+ K(U, u, ae), K(b, u, ce);
1421
1421
  const B = L.intersectsBox(ae), H = L.intersectsBox(ce);
1422
1422
  S = B && Tt(
1423
1423
  _,
@@ -1433,7 +1433,7 @@ function Tt(l, s, t, e, i, o = 0, n = 0, r = 0, a = 0, c = null, h = !1) {
1433
1433
  !h
1434
1434
  ) || H && Tt(
1435
1435
  _,
1436
- x,
1436
+ b,
1437
1437
  e,
1438
1438
  t,
1439
1439
  i,
@@ -1446,7 +1446,7 @@ function Tt(l, s, t, e, i, o = 0, n = 0, r = 0, a = 0, c = null, h = !1) {
1446
1446
  ), vt.releasePrimitive(L);
1447
1447
  }
1448
1448
  else if (w)
1449
- if (T)
1449
+ if (m)
1450
1450
  S = Tt(
1451
1451
  l,
1452
1452
  N,
@@ -1463,8 +1463,8 @@ function Tt(l, s, t, e, i, o = 0, n = 0, r = 0, a = 0, c = null, h = !1) {
1463
1463
  else {
1464
1464
  const L = vt.getPrimitive();
1465
1465
  L.copy(Zs).applyMatrix4(t);
1466
- const U = pt(l), x = Ct(l, f);
1467
- K(U, u, ae), K(x, u, ce);
1466
+ const U = pt(l), b = Ct(l, f);
1467
+ K(U, u, ae), K(b, u, ce);
1468
1468
  const B = L.intersectsBox(ae), H = L.intersectsBox(ce);
1469
1469
  S = B && Tt(
1470
1470
  N,
@@ -1480,7 +1480,7 @@ function Tt(l, s, t, e, i, o = 0, n = 0, r = 0, a = 0, c = null, h = !1) {
1480
1480
  !h
1481
1481
  ) || H && Tt(
1482
1482
  N,
1483
- x,
1483
+ b,
1484
1484
  e,
1485
1485
  t,
1486
1486
  i,
@@ -1552,14 +1552,14 @@ class Si {
1552
1552
  // undocumented options
1553
1553
  // Whether to skip generating the tree. Used for deserialization.
1554
1554
  [Vs]: !1
1555
- }, t), t.useSharedArrayBuffer && !er())
1555
+ }, t), t.useSharedArrayBuffer && !sr())
1556
1556
  throw new Error("MeshBVH: SharedArrayBuffer is not available.");
1557
- this.geometry = s, this._roots = null, this._indirectBuffer = null, t[Vs] || (mo(this, t), !s.boundingBox && t.setBoundingBox && (s.boundingBox = this.getBoundingBox(new gt())));
1557
+ this.geometry = s, this._roots = null, this._indirectBuffer = null, t[Vs] || (Ro(this, t), !s.boundingBox && t.setBoundingBox && (s.boundingBox = this.getBoundingBox(new gt())));
1558
1558
  const { _indirectBuffer: e } = this;
1559
1559
  this.resolveTriangleIndex = t.indirect ? (i) => e[i] : (i) => i;
1560
1560
  }
1561
1561
  refit(s = null) {
1562
- return (this.indirect ? Wo : wo)(this, s);
1562
+ return (this.indirect ? Xo : Do)(this, s);
1563
1563
  }
1564
1564
  traverse(s, t = 0) {
1565
1565
  const e = this._roots[t], i = new Uint32Array(e), o = new Uint16Array(e);
@@ -1577,13 +1577,13 @@ class Si {
1577
1577
  }
1578
1578
  /* Core Cast Functions */
1579
1579
  raycast(s, t = wi) {
1580
- const e = this._roots, i = this.geometry, o = [], n = t.isMaterial, r = Array.isArray(t), a = i.groups, c = n ? t.side : t, h = this.indirect ? Xo : bo;
1580
+ const e = this._roots, i = this.geometry, o = [], n = t.isMaterial, r = Array.isArray(t), a = i.groups, c = n ? t.side : t, h = this.indirect ? Zo : vo;
1581
1581
  for (let d = 0, E = e.length; d < E; d++) {
1582
1582
  const u = r ? t[a[d].materialIndex].side : c, f = o.length;
1583
1583
  if (h(this, d, u, s, o), r) {
1584
- const R = a[d].materialIndex;
1585
- for (let m = f, C = o.length; m < C; m++)
1586
- o[m].face.materialIndex = R;
1584
+ const T = a[d].materialIndex;
1585
+ for (let R = f, C = o.length; R < C; R++)
1586
+ o[R].face.materialIndex = T;
1587
1587
  }
1588
1588
  }
1589
1589
  return o;
@@ -1591,7 +1591,7 @@ class Si {
1591
1591
  raycastFirst(s, t = wi) {
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, c = o ? t.side : t, h = this.indirect ? Qo : Bo;
1594
+ const a = i.groups, c = o ? t.side : t, h = this.indirect ? jo : Yo;
1595
1595
  for (let d = 0, E = e.length; d < E; d++) {
1596
1596
  const u = n ? t[a[d].materialIndex].side : c, f = h(this, d, u, s);
1597
1597
  f != null && (r == null || f.distance < r.distance) && (r = f, n && (f.face.materialIndex = a[d].materialIndex));
@@ -1600,13 +1600,13 @@ class Si {
1600
1600
  }
1601
1601
  intersectsGeometry(s, t) {
1602
1602
  let e = !1;
1603
- const i = this._roots, o = this.indirect ? jo : Yo;
1603
+ const i = this._roots, o = this.indirect ? qo : Vo;
1604
1604
  for (let n = 0, r = i.length; n < r && (e = o(this, n, s, t), !e); n++)
1605
1605
  ;
1606
1606
  return e;
1607
1607
  }
1608
1608
  shapecast(s) {
1609
- const t = It.getPrimitive(), e = this.indirect ? xo : Mo;
1609
+ const t = It.getPrimitive(), e = this.indirect ? bo : wo;
1610
1610
  let {
1611
1611
  boundsTraverseOrder: i,
1612
1612
  intersectsBounds: o,
@@ -1615,14 +1615,14 @@ class Si {
1615
1615
  } = s;
1616
1616
  if (n && r) {
1617
1617
  const d = n;
1618
- n = (E, u, f, R, m) => d(E, u, f, R, m) ? !0 : e(E, u, this, r, f, R, t);
1618
+ n = (E, u, f, T, R) => d(E, u, f, T, R) ? !0 : e(E, u, this, r, f, T, t);
1619
1619
  } else
1620
1620
  n || (r ? n = (d, E, u, f) => e(d, E, this, r, u, f, t) : n = (d, E, u) => u);
1621
1621
  let a = !1, c = 0;
1622
1622
  const h = this._roots;
1623
1623
  for (let d = 0, E = h.length; d < E; d++) {
1624
1624
  const u = h[d];
1625
- if (a = So(this, d, o, n, i, c), a)
1625
+ if (a = _o(this, d, o, n, i, c), a)
1626
1626
  break;
1627
1627
  c += u.byteLength;
1628
1628
  }
@@ -1634,35 +1634,35 @@ class Si {
1634
1634
  intersectsTriangles: o
1635
1635
  } = e;
1636
1636
  const n = It.getPrimitive(), r = this.geometry.index, a = this.geometry.attributes.position, c = this.indirect ? (f) => {
1637
- const R = this.resolveTriangleIndex(f);
1638
- tt(n, R * 3, r, a);
1637
+ const T = this.resolveTriangleIndex(f);
1638
+ tt(n, T * 3, r, a);
1639
1639
  } : (f) => {
1640
1640
  tt(n, f * 3, r, a);
1641
1641
  }, h = It.getPrimitive(), d = s.geometry.index, E = s.geometry.attributes.position, u = s.indirect ? (f) => {
1642
- const R = s.resolveTriangleIndex(f);
1643
- tt(h, R * 3, d, E);
1642
+ const T = s.resolveTriangleIndex(f);
1643
+ tt(h, T * 3, d, E);
1644
1644
  } : (f) => {
1645
1645
  tt(h, f * 3, d, E);
1646
1646
  };
1647
1647
  if (o) {
1648
- const f = (R, m, C, A, F, p, T, g) => {
1648
+ const f = (T, R, C, A, F, p, m, g) => {
1649
1649
  for (let S = C, _ = C + A; S < _; S++) {
1650
1650
  u(S), h.a.applyMatrix4(t), h.b.applyMatrix4(t), h.c.applyMatrix4(t), h.needsUpdate = !0;
1651
- for (let N = R, y = R + m; N < y; N++)
1652
- if (c(N), n.needsUpdate = !0, o(n, h, N, S, F, p, T, g))
1651
+ for (let N = T, y = T + R; N < y; N++)
1652
+ if (c(N), n.needsUpdate = !0, o(n, h, N, S, F, p, m, g))
1653
1653
  return !0;
1654
1654
  }
1655
1655
  return !1;
1656
1656
  };
1657
1657
  if (i) {
1658
- const R = i;
1659
- i = function(m, C, A, F, p, T, g, S) {
1660
- return R(m, C, A, F, p, T, g, S) ? !0 : f(m, C, A, F, p, T, g, S);
1658
+ const T = i;
1659
+ i = function(R, C, A, F, p, m, g, S) {
1660
+ return T(R, C, A, F, p, m, g, S) ? !0 : f(R, C, A, F, p, m, g, S);
1661
1661
  };
1662
1662
  } else
1663
1663
  i = f;
1664
1664
  }
1665
- return sr(this, s, t, i);
1665
+ return ir(this, s, t, i);
1666
1666
  }
1667
1667
  /* Derived Cast Functions */
1668
1668
  intersectsBox(s, t) {
@@ -1682,7 +1682,7 @@ class Si {
1682
1682
  );
1683
1683
  }
1684
1684
  closestPointToGeometry(s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
1685
- return (this.indirect ? tr : ko)(
1685
+ return (this.indirect ? er : ko)(
1686
1686
  this,
1687
1687
  s,
1688
1688
  t,
@@ -1693,7 +1693,7 @@ class Si {
1693
1693
  );
1694
1694
  }
1695
1695
  closestPointToPoint(s, t = {}, e = 0, i = 1 / 0) {
1696
- return _o(
1696
+ return No(
1697
1697
  this,
1698
1698
  s,
1699
1699
  t,
@@ -1710,8 +1710,8 @@ class Si {
1710
1710
  function Ki(l, s, t) {
1711
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 js = /* @__PURE__ */ new Qn(), $i = /* @__PURE__ */ new Lt(), ir = v.prototype.raycast;
1714
- function nr(l, s) {
1713
+ const js = /* @__PURE__ */ new jn(), $i = /* @__PURE__ */ new Lt(), nr = v.prototype.raycast;
1714
+ function or(l, s) {
1715
1715
  if (this.geometry.boundsTree) {
1716
1716
  if (this.material === void 0)
1717
1717
  return;
@@ -1728,12 +1728,12 @@ function nr(l, s) {
1728
1728
  }
1729
1729
  }
1730
1730
  } else
1731
- ir.call(this, l, s);
1731
+ nr.call(this, l, s);
1732
1732
  }
1733
- function or(l) {
1733
+ function rr(l) {
1734
1734
  return this.boundsTree = new Si(this, l), this.boundsTree;
1735
1735
  }
1736
- function rr() {
1736
+ function ar() {
1737
1737
  this.boundsTree = null;
1738
1738
  }
1739
1739
  class D {
@@ -1829,7 +1829,7 @@ class Ni extends _i {
1829
1829
  });
1830
1830
  }
1831
1831
  }
1832
- class ar extends Ni {
1832
+ class cr extends Ni {
1833
1833
  constructor() {
1834
1834
  super(...arguments);
1835
1835
  /**
@@ -1840,7 +1840,7 @@ class ar extends Ni {
1840
1840
  I(this, "hasCameraControls", () => "controls" in this);
1841
1841
  }
1842
1842
  }
1843
- class cr extends Ni {
1843
+ class lr extends Ni {
1844
1844
  constructor() {
1845
1845
  super(...arguments);
1846
1846
  /** {@link Updateable.onBeforeUpdate} */
@@ -1958,7 +1958,7 @@ const ve = class ve extends et {
1958
1958
  */
1959
1959
  I(ve, "uuid", "76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe");
1960
1960
  let zt = ve;
1961
- class lr extends Ni {
1961
+ class hr extends Ni {
1962
1962
  constructor(t) {
1963
1963
  super(t);
1964
1964
  /** {@link Disposable.onDisposed} */
@@ -1974,8 +1974,8 @@ class lr extends Ni {
1974
1974
  this.three.children = [], this.onDisposed.trigger(), this.onDisposed.reset();
1975
1975
  }
1976
1976
  }
1977
- const ms = 0, hr = 1, Er = new M(), Ji = new yt(), qs = new Fi(), tn = new M(), ls = new ue();
1978
- class dr {
1977
+ const ms = 0, Er = 1, dr = new M(), Ji = new yt(), qs = new Fi(), tn = new M(), ls = new ue();
1978
+ class ur {
1979
1979
  constructor() {
1980
1980
  this.tolerance = -1, this.faces = [], this.newFaces = [], this.assigned = new en(), this.unassigned = new en(), this.vertices = [];
1981
1981
  }
@@ -1983,7 +1983,7 @@ class dr {
1983
1983
  if (s.length >= 4) {
1984
1984
  this.makeEmpty();
1985
1985
  for (let t = 0, e = s.length; t < e; t++)
1986
- this.vertices.push(new ur(s[t]));
1986
+ this.vertices.push(new Ir(s[t]));
1987
1987
  this.compute();
1988
1988
  }
1989
1989
  return this;
@@ -2023,7 +2023,7 @@ class dr {
2023
2023
  return i !== -1 / 0 ? s.at(i, t) : s.at(o, t), t;
2024
2024
  }
2025
2025
  intersectsRay(s) {
2026
- return this.intersectRay(s, Er) !== null;
2026
+ return this.intersectRay(s, dr) !== null;
2027
2027
  }
2028
2028
  makeEmpty() {
2029
2029
  return this.faces = [], this.vertices = [], this;
@@ -2112,16 +2112,16 @@ class dr {
2112
2112
  const f = s[E];
2113
2113
  if (f !== r && f !== a) {
2114
2114
  Ji.closestPointToPoint(f.point, !0, tn);
2115
- const R = tn.distanceToSquared(f.point);
2116
- R > o && (o = R, c = f);
2115
+ const T = tn.distanceToSquared(f.point);
2116
+ T > o && (o = T, c = f);
2117
2117
  }
2118
2118
  }
2119
2119
  o = -1, qs.setFromCoplanarPoints(r.point, a.point, c.point);
2120
2120
  for (let E = 0, u = this.vertices.length; E < u; E++) {
2121
2121
  const f = s[E];
2122
2122
  if (f !== r && f !== a && f !== c) {
2123
- const R = Math.abs(qs.distanceToPoint(f.point));
2124
- R > o && (o = R, h = f);
2123
+ const T = Math.abs(qs.distanceToPoint(f.point));
2124
+ T > o && (o = T, h = f);
2125
2125
  }
2126
2126
  }
2127
2127
  const d = [];
@@ -2154,12 +2154,12 @@ class dr {
2154
2154
  const f = s[E];
2155
2155
  if (f !== r && f !== a && f !== c && f !== h) {
2156
2156
  o = this.tolerance;
2157
- let R = null;
2158
- for (let m = 0; m < 4; m++) {
2159
- const C = this.faces[m].distanceToPoint(f.point);
2160
- C > o && (o = C, R = this.faces[m]);
2157
+ let T = null;
2158
+ for (let R = 0; R < 4; R++) {
2159
+ const C = this.faces[R].distanceToPoint(f.point);
2160
+ C > o && (o = C, T = this.faces[R]);
2161
2161
  }
2162
- R !== null && this.addVertexToFace(f, R);
2162
+ T !== null && this.addVertexToFace(f, T);
2163
2163
  }
2164
2164
  }
2165
2165
  return this;
@@ -2190,7 +2190,7 @@ class dr {
2190
2190
  // For an edge to be part of the horizon it must join a face that can see
2191
2191
  // 'eyePoint' and a face that cannot see 'eyePoint'.
2192
2192
  computeHorizon(s, t, e, i) {
2193
- this.deleteFaceVertices(e), e.mark = hr;
2193
+ this.deleteFaceVertices(e), e.mark = Er;
2194
2194
  let o;
2195
2195
  t === null ? o = t = e.getEdge(0) : o = t.next;
2196
2196
  do {
@@ -2276,7 +2276,7 @@ class Ks {
2276
2276
  return this.twin = s, s.twin = this, this;
2277
2277
  }
2278
2278
  }
2279
- class ur {
2279
+ class Ir {
2280
2280
  constructor(s) {
2281
2281
  this.point = s, this.prev = null, this.next = null, this.face = null;
2282
2282
  }
@@ -2328,14 +2328,14 @@ const Ii = [2, 2, 1], fi = [1, 0, 0];
2328
2328
  function Nt(l, s) {
2329
2329
  return l * 3 + s;
2330
2330
  }
2331
- function Ir(l) {
2331
+ function fr(l) {
2332
2332
  const s = l.elements;
2333
2333
  let t = 0;
2334
2334
  for (let e = 0; e < 9; e++)
2335
2335
  t += s[e] * s[e];
2336
2336
  return Math.sqrt(t);
2337
2337
  }
2338
- function fr(l) {
2338
+ function pr(l) {
2339
2339
  const s = l.elements;
2340
2340
  let t = 0;
2341
2341
  for (let e = 0; e < 3; e++) {
@@ -2344,7 +2344,7 @@ function fr(l) {
2344
2344
  }
2345
2345
  return Math.sqrt(t);
2346
2346
  }
2347
- function pr(l, s) {
2347
+ function Cr(l, s) {
2348
2348
  let t = 0, e = 1;
2349
2349
  const i = l.elements;
2350
2350
  for (let c = 0; c < 3; c++) {
@@ -2360,22 +2360,22 @@ function pr(l, s) {
2360
2360
  }
2361
2361
  return s.identity(), s.elements[Nt(r, r)] = o, s.elements[Nt(a, a)] = o, s.elements[Nt(a, r)] = n, s.elements[Nt(r, a)] = -n, s;
2362
2362
  }
2363
- function Cr(l, s) {
2363
+ function Tr(l, s) {
2364
2364
  let t = 0, e = 0;
2365
2365
  const i = 10;
2366
2366
  s.unitary.identity(), s.diagonal.copy(l);
2367
- const o = s.unitary, n = s.diagonal, r = new O.Matrix3(), a = new O.Matrix3(), c = Number.EPSILON * Ir(n);
2368
- for (; e < i && fr(n) > c; )
2369
- pr(n, r), a.copy(r).transpose(), n.multiply(r), n.premultiply(a), o.multiply(r), ++t > 2 && (e++, t = 0);
2367
+ const o = s.unitary, n = s.diagonal, r = new O.Matrix3(), a = new O.Matrix3(), c = Number.EPSILON * fr(n);
2368
+ for (; e < i && pr(n) > c; )
2369
+ Cr(n, r), a.copy(r).transpose(), n.multiply(r), n.premultiply(a), o.multiply(r), ++t > 2 && (e++, t = 0);
2370
2370
  return s;
2371
2371
  }
2372
- function Tr(l) {
2372
+ function mr(l) {
2373
2373
  const s = [];
2374
2374
  for (let it = 0; it < l.length - 2; it += 3) {
2375
2375
  const Xt = l[it], J = l[it + 1], $t = l[it + 2];
2376
2376
  s.push(new O.Vector3(Xt, J, $t));
2377
2377
  }
2378
- const t = new dr();
2378
+ const t = new ur();
2379
2379
  t.setFromPoints(s);
2380
2380
  const e = {
2381
2381
  unitary: new O.Matrix3(),
@@ -2388,44 +2388,44 @@ function Tr(l) {
2388
2388
  do
2389
2389
  o.push($t), $t = $t.next;
2390
2390
  while ($t !== J.edge);
2391
- const zn = o.length - 2;
2392
- for (let Xe = 1, Hn = zn; Xe <= Hn; Xe++) {
2391
+ const Hn = o.length - 2;
2392
+ for (let Xe = 1, Wn = Hn; Xe <= Wn; Xe++) {
2393
2393
  const bs = o[0].vertex, vs = o[Xe + 0].vertex, Bs = o[Xe + 1].vertex;
2394
2394
  n.push(bs.point.x, bs.point.y, bs.point.z), n.push(vs.point.x, vs.point.y, vs.point.z), n.push(Bs.point.x, Bs.point.y, Bs.point.z);
2395
2395
  }
2396
2396
  }
2397
2397
  const r = new O.Vector3(), a = new O.Vector3(), c = new O.Vector3(), h = new O.Vector3(), d = new O.Vector3(), E = new O.Vector3(), u = new O.Vector3(), f = new O.Vector3();
2398
- let R = 0, m = 0, C = 0, A = 0, F = 0, p = 0, T = 0;
2398
+ let T = 0, R = 0, C = 0, A = 0, F = 0, p = 0, m = 0;
2399
2399
  for (let it = 0, Xt = n.length; it < Xt; it += 9) {
2400
2400
  r.fromArray(n, it), a.fromArray(n, it + 3), c.fromArray(n, it + 6), u.set(0, 0, 0), u.add(r).add(a).add(c).divideScalar(3), h.subVectors(a, r), d.subVectors(c, r);
2401
2401
  const J = E.crossVectors(h, d).length() / 2;
2402
- f.add(E.copy(u).multiplyScalar(J)), R += J, m += (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), A += (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), p += (9 * u.y * u.z + r.y * r.z + a.y * a.z + c.y * c.z) * (J / 12), T += (9 * u.z * u.z + r.z * r.z + a.z * a.z + c.z * c.z) * (J / 12);
2402
+ f.add(E.copy(u).multiplyScalar(J)), T += J, R += (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), A += (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), p += (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);
2403
2403
  }
2404
- f.divideScalar(R), m /= R, C /= R, A /= R, F /= R, p /= R, T /= R, m -= f.x * f.x, C -= f.x * f.y, A -= f.x * f.z, F -= f.y * f.y, p -= f.y * f.z, T -= f.z * f.z;
2404
+ f.divideScalar(T), R /= T, C /= T, A /= T, F /= T, p /= T, m /= T, R -= f.x * f.x, C -= f.x * f.y, A -= f.x * f.z, F -= f.y * f.y, p -= f.y * f.z, m -= f.z * f.z;
2405
2405
  const g = new O.Matrix3();
2406
- g.elements[0] = m, g.elements[1] = C, g.elements[2] = A, g.elements[3] = C, g.elements[4] = F, g.elements[5] = p, g.elements[6] = A, g.elements[7] = p, g.elements[8] = T, Cr(g, e);
2406
+ g.elements[0] = R, g.elements[1] = C, g.elements[2] = A, g.elements[3] = C, g.elements[4] = F, g.elements[5] = p, g.elements[6] = A, g.elements[7] = p, g.elements[8] = m, Tr(g, e);
2407
2407
  const S = e.unitary, _ = new O.Vector3(), N = new O.Vector3(), y = new O.Vector3();
2408
2408
  S.extractBasis(_, N, y);
2409
- let w = -1 / 0, L = -1 / 0, U = -1 / 0, x = 1 / 0, B = 1 / 0, H = 1 / 0;
2409
+ let w = -1 / 0, L = -1 / 0, U = -1 / 0, b = 1 / 0, B = 1 / 0, H = 1 / 0;
2410
2410
  for (let it = 0, Xt = s.length; it < Xt; it++) {
2411
2411
  const J = s[it];
2412
- 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);
2412
+ w = Math.max(_.dot(J), w), L = Math.max(N.dot(J), L), U = Math.max(y.dot(J), U), b = Math.min(_.dot(J), b), B = Math.min(N.dot(J), B), H = Math.min(y.dot(J), H);
2413
2413
  }
2414
- _.multiplyScalar(0.5 * (x + w)), N.multiplyScalar(0.5 * (B + L)), y.multiplyScalar(0.5 * (H + U));
2414
+ _.multiplyScalar(0.5 * (b + w)), N.multiplyScalar(0.5 * (B + L)), y.multiplyScalar(0.5 * (H + U));
2415
2415
  const q = new O.Vector3(), st = new O.Vector3(), Q = new O.Matrix3();
2416
- q.add(_).add(N).add(y), st.x = w - x, st.y = L - B, st.z = U - H, st.multiplyScalar(0.5), Q.copy(S);
2417
- const { x: Ht, y: kt, z: Wt } = st, We = new O.Matrix4();
2418
- We.makeScale(Ht * 2, kt * 2, Wt * 2);
2416
+ q.add(_).add(N).add(y), st.x = w - b, st.y = L - B, st.z = U - H, st.multiplyScalar(0.5), Q.copy(S);
2417
+ const { x: Ht, y: Wt, z: kt } = st, ke = new O.Matrix4();
2418
+ ke.makeScale(Ht * 2, Wt * 2, kt * 2);
2419
2419
  const Te = new O.Matrix4();
2420
- Te.makeTranslation(-Ht, -kt, -Wt);
2420
+ Te.makeTranslation(-Ht, -Wt, -kt);
2421
2421
  const Li = new O.Matrix4();
2422
2422
  Li.makeTranslation(q.x, q.y, q.z);
2423
2423
  const Mi = new O.Matrix4();
2424
2424
  Mi.setFromMatrix3(Q);
2425
2425
  const me = new O.Matrix4();
2426
- return me.multiply(Li), me.multiply(Mi), me.multiply(Te), me.multiply(We), { center: q, halfSizes: st, rotation: Q, transformation: me };
2426
+ return me.multiply(Li), me.multiply(Mi), me.multiply(Te), me.multiply(ke), { center: q, halfSizes: st, rotation: Q, transformation: me };
2427
2427
  }
2428
- function mr(l, s, t) {
2428
+ function Rr(l, s, t) {
2429
2429
  const e = [
2430
2430
  l[0] - s[0],
2431
2431
  l[1] - s[1],
@@ -2716,7 +2716,7 @@ I($, "_lut", [
2716
2716
  "ff"
2717
2717
  ]);
2718
2718
  let ze = $;
2719
- class ea extends et {
2719
+ class sa extends et {
2720
2720
  constructor(t, e) {
2721
2721
  super(t);
2722
2722
  /** {@link Disposable.onDisposed} */
@@ -2962,15 +2962,15 @@ const Fs = class Fs {
2962
2962
  this._clock.stop(), this.onDisposed.trigger(), this.onDisposed.reset();
2963
2963
  }
2964
2964
  static setupBVH() {
2965
- O.BufferGeometry.prototype.computeBoundsTree = or, O.BufferGeometry.prototype.disposeBoundsTree = rr, O.Mesh.prototype.raycast = nr;
2965
+ O.BufferGeometry.prototype.computeBoundsTree = rr, O.BufferGeometry.prototype.disposeBoundsTree = ar, O.Mesh.prototype.raycast = or;
2966
2966
  }
2967
2967
  };
2968
2968
  /**
2969
2969
  * The version of the @thatopen/components library.
2970
2970
  */
2971
- I(Fs, "release", "2.1.8");
2971
+ I(Fs, "release", "2.1.10");
2972
2972
  let pi = Fs;
2973
- class Rr {
2973
+ class Ar {
2974
2974
  constructor(s) {
2975
2975
  I(this, "_event");
2976
2976
  I(this, "_position", new O.Vector2());
@@ -3005,7 +3005,7 @@ class Rr {
3005
3005
  s ? this.dom.addEventListener("pointermove", this.updateMouseInfo) : this.dom.removeEventListener("pointermove", this.updateMouseInfo);
3006
3006
  }
3007
3007
  }
3008
- class Ar {
3008
+ class Fr {
3009
3009
  constructor(s, t) {
3010
3010
  /** {@link Component.enabled} */
3011
3011
  I(this, "enabled", !0);
@@ -3028,7 +3028,7 @@ class Ar {
3028
3028
  const e = t.renderer;
3029
3029
  if (!e)
3030
3030
  throw new Error("A renderer is needed for the raycaster to work!");
3031
- this.world = t, this.mouse = new Rr(e.three.domElement), this.components = s;
3031
+ this.world = t, this.mouse = new Ar(e.three.domElement), this.components = s;
3032
3032
  }
3033
3033
  /** {@link Disposable.dispose} */
3034
3034
  dispose() {
@@ -3102,7 +3102,7 @@ const gs = class gs extends et {
3102
3102
  get(t) {
3103
3103
  if (this.list.has(t.uuid))
3104
3104
  return this.list.get(t.uuid);
3105
- const e = new Ar(this.components, t);
3105
+ const e = new Fr(this.components, t);
3106
3106
  return this.list.set(t.uuid, e), t.onDisposed.add(() => {
3107
3107
  this.delete(t);
3108
3108
  }), e;
@@ -3131,7 +3131,7 @@ const gs = class gs extends et {
3131
3131
  */
3132
3132
  I(gs, "uuid", "d5d8bdf0-db25-4952-b951-b643af207ace");
3133
3133
  let He = gs;
3134
- class Fr extends _i {
3134
+ class gr extends _i {
3135
3135
  constructor() {
3136
3136
  super(...arguments);
3137
3137
  /**
@@ -3231,7 +3231,7 @@ class Fr extends _i {
3231
3231
  this._scene = null, this._camera = null, this._renderer = null, this.onDisposed.trigger();
3232
3232
  }
3233
3233
  }
3234
- class sa extends lr {
3234
+ class ia extends hr {
3235
3235
  constructor(t) {
3236
3236
  super(t);
3237
3237
  /** {@link Configurable.isSetup} */
@@ -3275,7 +3275,7 @@ class sa extends lr {
3275
3275
  this.three.add(e, i), this.isSetup = !0, this.onSetup.trigger(this);
3276
3276
  }
3277
3277
  }
3278
- class ia extends cr {
3278
+ class na extends lr {
3279
3279
  /**
3280
3280
  * Constructor for the SimpleRenderer class.
3281
3281
  *
@@ -3415,7 +3415,7 @@ function mt(l, s, t) {
3415
3415
  function X(l, s = xn) {
3416
3416
  return Math.abs(l) < s;
3417
3417
  }
3418
- function k(l, s, t = xn) {
3418
+ function W(l, s, t = xn) {
3419
3419
  return X(l - s, t);
3420
3420
  }
3421
3421
  function on(l, s) {
@@ -3441,17 +3441,17 @@ function hs(l, s, t, e, i = 1 / 0, o) {
3441
3441
  function rn(l, s, t, e, i = 1 / 0, o, n) {
3442
3442
  e = Math.max(1e-4, e);
3443
3443
  const r = 2 / e, a = r * o, c = 1 / (1 + a + 0.48 * a * a + 0.235 * a * a * a);
3444
- let h = s.x, d = s.y, E = s.z, u = l.x - h, f = l.y - d, R = l.z - E;
3445
- const m = h, C = d, A = E, F = i * e, p = F * F, T = u * u + f * f + R * R;
3446
- if (T > p) {
3447
- const B = Math.sqrt(T);
3448
- u = u / B * F, f = f / B * F, R = R / B * F;
3449
- }
3450
- h = l.x - u, d = l.y - f, E = l.z - R;
3451
- const g = (t.x + r * u) * o, S = (t.y + r * f) * o, _ = (t.z + r * R) * o;
3452
- t.x = (t.x - r * g) * c, t.y = (t.y - r * S) * c, t.z = (t.z - r * _) * c, n.x = h + (u + g) * c, n.y = d + (f + S) * c, n.z = E + (R + _) * c;
3453
- const N = m - l.x, y = C - l.y, w = A - l.z, L = n.x - m, U = n.y - C, x = n.z - A;
3454
- return N * L + y * U + w * x > 0 && (n.x = m, n.y = C, n.z = A, t.x = (n.x - m) / o, t.y = (n.y - C) / o, t.z = (n.z - A) / o), n;
3444
+ let h = s.x, d = s.y, E = s.z, u = l.x - h, f = l.y - d, T = l.z - E;
3445
+ const R = h, C = d, A = E, F = i * e, p = F * F, m = u * u + f * f + T * T;
3446
+ if (m > p) {
3447
+ const B = Math.sqrt(m);
3448
+ u = u / B * F, f = f / B * F, T = T / B * F;
3449
+ }
3450
+ h = l.x - u, d = l.y - f, E = l.z - T;
3451
+ const g = (t.x + r * u) * o, S = (t.y + r * f) * o, _ = (t.z + r * T) * o;
3452
+ t.x = (t.x - r * g) * c, t.y = (t.y - r * S) * c, t.z = (t.z - r * _) * c, n.x = h + (u + g) * c, n.y = d + (f + S) * c, n.z = E + (T + _) * c;
3453
+ const N = R - l.x, y = C - l.y, w = A - l.z, L = n.x - R, U = n.y - C, b = n.z - A;
3454
+ return N * L + y * U + w * b > 0 && (n.x = R, n.y = C, n.z = A, t.x = (n.x - R) / o, t.y = (n.y - C) / o, t.z = (n.z - A) / o), n;
3455
3455
  }
3456
3456
  function $s(l, s) {
3457
3457
  s.set(0, 0), l.forEach((t) => {
@@ -3461,7 +3461,7 @@ function $s(l, s) {
3461
3461
  function Js(l, s) {
3462
3462
  return bt(l) ? (console.warn(`${s} is not supported in OrthographicCamera`), !0) : !1;
3463
3463
  }
3464
- class gr {
3464
+ class Or {
3465
3465
  constructor() {
3466
3466
  this._listeners = {};
3467
3467
  }
@@ -3525,9 +3525,9 @@ class gr {
3525
3525
  }
3526
3526
  }
3527
3527
  }
3528
- const Or = "2.7.3", Es = 1 / 8, bn = typeof window < "u", Sr = bn && /Mac/.test(navigator.platform), _r = !(bn && "PointerEvent" in window);
3528
+ const Sr = "2.7.3", Es = 1 / 8, bn = typeof window < "u", _r = bn && /Mac/.test(navigator.platform), Nr = !(bn && "PointerEvent" in window);
3529
3529
  let Y, an, ds, ti, lt, G, z, Ee, Le, Ot, St, Qt, cn, ln, ut, Me, de, hn, ei, En, si, ii, us;
3530
- class ot extends gr {
3530
+ class ot extends Or {
3531
3531
  /**
3532
3532
  * Injects THREE as the dependency. You can then proceed to use CameraControls.
3533
3533
  *
@@ -3597,26 +3597,26 @@ class ot extends gr {
3597
3597
  */
3598
3598
  constructor(s, t) {
3599
3599
  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 = () => {
3600
- }, 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 = (p, T, g) => {
3600
+ }, 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 = (p, m, g) => {
3601
3601
  let S, _;
3602
3602
  if (Zt(this._camera)) {
3603
3603
  const N = G.copy(this._camera.position).sub(this._target), y = this._camera.getEffectiveFOV() * Ne, w = N.length() * Math.tan(y * 0.5);
3604
- S = this.truckSpeed * p * w / this._elementRect.height, _ = this.truckSpeed * T * w / this._elementRect.height;
3604
+ S = this.truckSpeed * p * w / this._elementRect.height, _ = this.truckSpeed * m * w / this._elementRect.height;
3605
3605
  } else if (bt(this._camera)) {
3606
3606
  const N = this._camera;
3607
- S = p * (N.right - N.left) / N.zoom / this._elementRect.width, _ = T * (N.top - N.bottom) / N.zoom / this._elementRect.height;
3607
+ S = p * (N.right - N.left) / N.zoom / this._elementRect.width, _ = m * (N.top - N.bottom) / N.zoom / this._elementRect.height;
3608
3608
  } else
3609
3609
  return;
3610
3610
  this.verticalDragToForward ? (g ? this.setFocalOffset(this._focalOffsetEnd.x + S, this._focalOffsetEnd.y, this._focalOffsetEnd.z, !0) : this.truck(S, 0, !0), this.forward(-_, !0)) : g ? this.setFocalOffset(this._focalOffsetEnd.x + S, this._focalOffsetEnd.y + _, this._focalOffsetEnd.z, !0) : this.truck(S, _, !0);
3611
- }, this._rotateInternal = (p, T) => {
3612
- const g = he * this.azimuthRotateSpeed * p / this._elementRect.height, S = he * this.polarRotateSpeed * T / this._elementRect.height;
3611
+ }, this._rotateInternal = (p, m) => {
3612
+ const g = he * this.azimuthRotateSpeed * p / this._elementRect.height, S = he * this.polarRotateSpeed * m / this._elementRect.height;
3613
3613
  this.rotate(g, S, !0);
3614
- }, this._dollyInternal = (p, T, g) => {
3614
+ }, this._dollyInternal = (p, m, g) => {
3615
3615
  const S = Math.pow(0.95, -p * this.dollySpeed), _ = this._sphericalEnd.radius, N = this._sphericalEnd.radius * S, y = mt(N, this.minDistance, this.maxDistance), w = y - N;
3616
- 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(T, g)), this._lastDollyDirection = Math.sign(-p);
3617
- }, this._zoomInternal = (p, T, g) => {
3616
+ 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(-p);
3617
+ }, this._zoomInternal = (p, m, g) => {
3618
3618
  const S = Math.pow(0.95, p * this.dollySpeed), _ = this._zoom, N = this._zoom * S;
3619
- this.zoomTo(N, !0), this.dollyToCursor && (this._changedZoom += N - _, this._dollyControlCoord.set(T, g));
3619
+ this.zoomTo(N, !0), this.dollyToCursor && (this._changedZoom += N - _, this._dollyControlCoord.set(m, g));
3620
3620
  }, 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, ds), 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 = [
3621
3621
  new Y.Vector3(),
3622
3622
  new Y.Vector3(),
@@ -3640,9 +3640,9 @@ class ot extends gr {
3640
3640
  if (_ < this._interactiveArea.left || _ > this._interactiveArea.right || N < this._interactiveArea.top || N > this._interactiveArea.bottom)
3641
3641
  return;
3642
3642
  }
3643
- const T = p.pointerType !== "mouse" ? null : (p.buttons & V.LEFT) === V.LEFT ? V.LEFT : (p.buttons & V.MIDDLE) === V.MIDDLE ? V.MIDDLE : (p.buttons & V.RIGHT) === V.RIGHT ? V.RIGHT : null;
3644
- if (T !== null) {
3645
- const S = this._findPointerByMouseButton(T);
3643
+ const m = p.pointerType !== "mouse" ? null : (p.buttons & V.LEFT) === V.LEFT ? V.LEFT : (p.buttons & V.MIDDLE) === V.MIDDLE ? V.MIDDLE : (p.buttons & V.RIGHT) === V.RIGHT ? V.RIGHT : null;
3644
+ if (m !== null) {
3645
+ const S = this._findPointerByMouseButton(m);
3646
3646
  S && this._disposePointer(S);
3647
3647
  }
3648
3648
  if ((p.buttons & V.LEFT) === V.LEFT && this._lockedPointer)
@@ -3653,9 +3653,9 @@ class ot extends gr {
3653
3653
  clientY: p.clientY,
3654
3654
  deltaX: 0,
3655
3655
  deltaY: 0,
3656
- mouseButton: T
3656
+ mouseButton: m
3657
3657
  };
3658
- this._activePointers.push(g), this._domElement.ownerDocument.removeEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("pointerup", h), this._domElement.ownerDocument.addEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.addEventListener("pointerup", h), this._isDragging = !0, R(p);
3658
+ this._activePointers.push(g), this._domElement.ownerDocument.removeEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("pointerup", h), this._domElement.ownerDocument.addEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.addEventListener("pointerup", h), this._isDragging = !0, T(p);
3659
3659
  }, r = (p) => {
3660
3660
  if (!this._enabled || !this._domElement || this._lockedPointer)
3661
3661
  return;
@@ -3664,9 +3664,9 @@ class ot extends gr {
3664
3664
  if (_ < this._interactiveArea.left || _ > this._interactiveArea.right || N < this._interactiveArea.top || N > this._interactiveArea.bottom)
3665
3665
  return;
3666
3666
  }
3667
- const T = (p.buttons & V.LEFT) === V.LEFT ? V.LEFT : (p.buttons & V.MIDDLE) === V.MIDDLE ? V.MIDDLE : (p.buttons & V.RIGHT) === V.RIGHT ? V.RIGHT : null;
3668
- if (T !== null) {
3669
- const S = this._findPointerByMouseButton(T);
3667
+ const m = (p.buttons & V.LEFT) === V.LEFT ? V.LEFT : (p.buttons & V.MIDDLE) === V.MIDDLE ? V.MIDDLE : (p.buttons & V.RIGHT) === V.RIGHT ? V.RIGHT : null;
3668
+ if (m !== null) {
3669
+ const S = this._findPointerByMouseButton(m);
3670
3670
  S && this._disposePointer(S);
3671
3671
  }
3672
3672
  const g = {
@@ -3677,10 +3677,10 @@ class ot extends gr {
3677
3677
  deltaY: 0,
3678
3678
  mouseButton: (p.buttons & V.LEFT) === V.LEFT ? V.LEFT : (p.buttons & V.MIDDLE) === V.LEFT ? V.MIDDLE : (p.buttons & V.RIGHT) === V.LEFT ? V.RIGHT : null
3679
3679
  };
3680
- 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(p);
3680
+ 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, T(p);
3681
3681
  }, a = (p) => {
3682
3682
  p.cancelable && p.preventDefault();
3683
- const T = p.pointerId, g = this._lockedPointer || this._findPointerById(T);
3683
+ const m = p.pointerId, g = this._lockedPointer || this._findPointerById(m);
3684
3684
  if (g) {
3685
3685
  if (g.clientX = p.clientX, g.clientY = p.clientY, g.deltaX = p.movementX, g.deltaY = p.movementY, this._state = 0, p.pointerType === "touch")
3686
3686
  switch (this._activePointers.length) {
@@ -3696,15 +3696,15 @@ class ot extends gr {
3696
3696
  }
3697
3697
  else
3698
3698
  (!this._isDragging && this._lockedPointer || this._isDragging && (p.buttons & V.LEFT) === V.LEFT) && (this._state = this._state | this.mouseButtons.left), this._isDragging && (p.buttons & V.MIDDLE) === V.MIDDLE && (this._state = this._state | this.mouseButtons.middle), this._isDragging && (p.buttons & V.RIGHT) === V.RIGHT && (this._state = this._state | this.mouseButtons.right);
3699
- m();
3699
+ R();
3700
3700
  }
3701
3701
  }, c = (p) => {
3702
- const T = this._lockedPointer || this._findPointerById(1);
3703
- T && (T.clientX = p.clientX, T.clientY = p.clientY, T.deltaX = p.movementX, T.deltaY = p.movementY, this._state = 0, (this._lockedPointer || (p.buttons & V.LEFT) === V.LEFT) && (this._state = this._state | this.mouseButtons.left), (p.buttons & V.MIDDLE) === V.MIDDLE && (this._state = this._state | this.mouseButtons.middle), (p.buttons & V.RIGHT) === V.RIGHT && (this._state = this._state | this.mouseButtons.right), m());
3702
+ const m = this._lockedPointer || this._findPointerById(1);
3703
+ m && (m.clientX = p.clientX, m.clientY = p.clientY, m.deltaX = p.movementX, m.deltaY = p.movementY, this._state = 0, (this._lockedPointer || (p.buttons & V.LEFT) === V.LEFT) && (this._state = this._state | this.mouseButtons.left), (p.buttons & V.MIDDLE) === V.MIDDLE && (this._state = this._state | this.mouseButtons.middle), (p.buttons & V.RIGHT) === V.RIGHT && (this._state = this._state | this.mouseButtons.right), R());
3704
3704
  }, h = (p) => {
3705
- const T = this._findPointerById(p.pointerId);
3706
- if (!(T && T === this._lockedPointer)) {
3707
- if (T && this._disposePointer(T), p.pointerType === "touch")
3705
+ const m = this._findPointerById(p.pointerId);
3706
+ if (!(m && m === this._lockedPointer)) {
3707
+ if (m && this._disposePointer(m), p.pointerType === "touch")
3708
3708
  switch (this._activePointers.length) {
3709
3709
  case 0:
3710
3710
  this._state = P.NONE;
@@ -3740,7 +3740,7 @@ class ot extends gr {
3740
3740
  const N = performance.now();
3741
3741
  E - N < 1e3 && this._getClientRect(this._elementRect), E = N;
3742
3742
  }
3743
- const T = Sr ? -1 : -3, g = p.deltaMode === 1 ? p.deltaY / T : p.deltaY / (T * 10), S = this.dollyToCursor ? (p.clientX - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, _ = this.dollyToCursor ? (p.clientY - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
3743
+ const m = _r ? -1 : -3, g = p.deltaMode === 1 ? p.deltaY / m : p.deltaY / (m * 10), S = this.dollyToCursor ? (p.clientX - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, _ = this.dollyToCursor ? (p.clientY - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
3744
3744
  switch (this.mouseButtons.wheel) {
3745
3745
  case P.ROTATE: {
3746
3746
  this._rotateInternal(p.deltaX, p.deltaY), this._isUserControllingRotate = !0;
@@ -3767,13 +3767,13 @@ class ot extends gr {
3767
3767
  }, f = (p) => {
3768
3768
  if (!(!this._domElement || !this._enabled)) {
3769
3769
  if (this.mouseButtons.right === ot.ACTION.NONE) {
3770
- const T = p instanceof PointerEvent ? p.pointerId : (p instanceof MouseEvent, 0), g = this._findPointerById(T);
3770
+ const m = p instanceof PointerEvent ? p.pointerId : (p instanceof MouseEvent, 0), g = this._findPointerById(m);
3771
3771
  g && this._disposePointer(g), this._domElement.ownerDocument.removeEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("pointerup", h), this._domElement.ownerDocument.removeEventListener("mousemove", c), this._domElement.ownerDocument.removeEventListener("mouseup", d);
3772
3772
  return;
3773
3773
  }
3774
3774
  p.preventDefault();
3775
3775
  }
3776
- }, R = (p) => {
3776
+ }, T = (p) => {
3777
3777
  if (!this._enabled)
3778
3778
  return;
3779
3779
  if ($s(this._activePointers, lt), this._getClientRect(this._elementRect), e.copy(lt), i.copy(lt), this._activePointers.length >= 2) {
@@ -3799,11 +3799,11 @@ class ot extends gr {
3799
3799
  else
3800
3800
  !this._lockedPointer && (p.buttons & V.LEFT) === V.LEFT && (this._state = this._state | this.mouseButtons.left), (p.buttons & V.MIDDLE) === V.MIDDLE && (this._state = this._state | this.mouseButtons.middle), (p.buttons & V.RIGHT) === V.RIGHT && (this._state = this._state | this.mouseButtons.right);
3801
3801
  ((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" });
3802
- }, m = () => {
3802
+ }, R = () => {
3803
3803
  if (!this._enabled || !this._dragNeedsUpdate)
3804
3804
  return;
3805
3805
  this._dragNeedsUpdate = !1, $s(this._activePointers, lt);
3806
- const T = this._domElement && document.pointerLockElement === this._domElement ? this._lockedPointer || this._activePointers[0] : null, g = T ? -T.deltaX : i.x - lt.x, S = T ? -T.deltaY : i.y - lt.y;
3806
+ 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;
3807
3807
  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) {
3808
3808
  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;
3809
3809
  (this._state & P.DOLLY) === P.DOLLY ? (this._dollyInternal(y * S * Es, _, N), this._isUserControllingDolly = !0) : (this._zoomInternal(y * S * Es, _, N), this._isUserControllingZoom = !0);
@@ -3826,7 +3826,7 @@ class ot extends gr {
3826
3826
  deltaX: 0,
3827
3827
  deltaY: 0,
3828
3828
  mouseButton: null
3829
- }, this._activePointers.push(this._lockedPointer), this._domElement.ownerDocument.removeEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("pointerup", h), this._domElement.requestPointerLock(), this._domElement.ownerDocument.addEventListener("pointerlockchange", A), this._domElement.ownerDocument.addEventListener("pointerlockerror", F), this._domElement.ownerDocument.addEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.addEventListener("pointerup", h), R());
3829
+ }, this._activePointers.push(this._lockedPointer), this._domElement.ownerDocument.removeEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("pointerup", h), this._domElement.requestPointerLock(), this._domElement.ownerDocument.addEventListener("pointerlockchange", A), this._domElement.ownerDocument.addEventListener("pointerlockerror", F), this._domElement.ownerDocument.addEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.addEventListener("pointerup", h), T());
3830
3830
  }, this.unlockPointer = () => {
3831
3831
  this._lockedPointer !== null && (this._disposePointer(this._lockedPointer), this._lockedPointer = null), document.exitPointerLock(), this.cancel(), this._domElement && (this._domElement.ownerDocument.removeEventListener("pointerlockchange", A), this._domElement.ownerDocument.removeEventListener("pointerlockerror", F));
3832
3832
  };
@@ -3836,7 +3836,7 @@ class ot extends gr {
3836
3836
  this.unlockPointer();
3837
3837
  };
3838
3838
  this._addAllEventListeners = (p) => {
3839
- this._domElement = p, this._domElement.style.touchAction = "none", this._domElement.style.userSelect = "none", this._domElement.style.webkitUserSelect = "none", this._domElement.addEventListener("pointerdown", n), _r && this._domElement.addEventListener("mousedown", r), this._domElement.addEventListener("pointercancel", h), this._domElement.addEventListener("wheel", u, { passive: !1 }), this._domElement.addEventListener("contextmenu", f);
3839
+ this._domElement = p, this._domElement.style.touchAction = "none", this._domElement.style.userSelect = "none", this._domElement.style.webkitUserSelect = "none", this._domElement.addEventListener("pointerdown", n), Nr && this._domElement.addEventListener("mousedown", r), this._domElement.addEventListener("pointercancel", h), this._domElement.addEventListener("wheel", u, { passive: !1 }), this._domElement.addEventListener("contextmenu", f);
3840
3840
  }, this._removeAllEventListeners = () => {
3841
3841
  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", h), this._domElement.removeEventListener("wheel", u, { passive: !1 }), this._domElement.removeEventListener("contextmenu", f), this._domElement.ownerDocument.removeEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("mousemove", c), this._domElement.ownerDocument.removeEventListener("pointerup", h), this._domElement.ownerDocument.removeEventListener("mouseup", d), this._domElement.ownerDocument.removeEventListener("pointerlockchange", A), this._domElement.ownerDocument.removeEventListener("pointerlockerror", F));
3842
3842
  }, this.cancel = () => {
@@ -4054,7 +4054,7 @@ class ot extends gr {
4054
4054
  this._isUserControllingRotate = !1;
4055
4055
  const i = mt(s, this.minAzimuthAngle, this.maxAzimuthAngle), o = mt(t, this.minPolarAngle, this.maxPolarAngle);
4056
4056
  this._sphericalEnd.theta = i, this._sphericalEnd.phi = o, this._sphericalEnd.makeSafe(), this._needsUpdate = !0, e || (this._spherical.theta = this._sphericalEnd.theta, this._spherical.phi = this._sphericalEnd.phi);
4057
- const n = !e || k(this._spherical.theta, this._sphericalEnd.theta, this.restThreshold) && k(this._spherical.phi, this._sphericalEnd.phi, this.restThreshold);
4057
+ const n = !e || W(this._spherical.theta, this._sphericalEnd.theta, this.restThreshold) && W(this._spherical.phi, this._sphericalEnd.phi, this.restThreshold);
4058
4058
  return this._createOnRestPromise(n);
4059
4059
  }
4060
4060
  /**
@@ -4078,14 +4078,14 @@ class ot extends gr {
4078
4078
  _dollyToNoClamp(s, t = !1) {
4079
4079
  const e = this._sphericalEnd.radius;
4080
4080
  if (this.colliderMeshes.length >= 1) {
4081
- const n = this._collisionTest(), r = k(n, this._spherical.radius);
4081
+ const n = this._collisionTest(), r = W(n, this._spherical.radius);
4082
4082
  if (!(e > s) && r)
4083
4083
  return Promise.resolve();
4084
4084
  this._sphericalEnd.radius = Math.min(s, n);
4085
4085
  } else
4086
4086
  this._sphericalEnd.radius = s;
4087
4087
  this._needsUpdate = !0, t || (this._spherical.radius = this._sphericalEnd.radius);
4088
- const o = !t || k(this._spherical.radius, this._sphericalEnd.radius, this.restThreshold);
4088
+ const o = !t || W(this._spherical.radius, this._sphericalEnd.radius, this.restThreshold);
4089
4089
  return this._createOnRestPromise(o);
4090
4090
  }
4091
4091
  /**
@@ -4097,7 +4097,7 @@ class ot extends gr {
4097
4097
  */
4098
4098
  dollyInFixed(s, t = !1) {
4099
4099
  this._targetEnd.add(this._getCameraDirection(Le).multiplyScalar(s)), t || this._target.copy(this._targetEnd);
4100
- 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);
4100
+ const e = !t || W(this._target.x, this._targetEnd.x, this.restThreshold) && W(this._target.y, this._targetEnd.y, this.restThreshold) && W(this._target.z, this._targetEnd.z, this.restThreshold);
4101
4101
  return this._createOnRestPromise(e);
4102
4102
  }
4103
4103
  /**
@@ -4119,7 +4119,7 @@ class ot extends gr {
4119
4119
  */
4120
4120
  zoomTo(s, t = !1) {
4121
4121
  this._isUserControllingZoom = !1, this._zoomEnd = mt(s, this.minZoom, this.maxZoom), this._needsUpdate = !0, t || (this._zoom = this._zoomEnd);
4122
- const e = !t || k(this._zoom, this._zoomEnd, this.restThreshold);
4122
+ const e = !t || W(this._zoom, this._zoomEnd, this.restThreshold);
4123
4123
  return this._changedZoom = 0, this._createOnRestPromise(e);
4124
4124
  }
4125
4125
  /**
@@ -4173,7 +4173,7 @@ class ot extends gr {
4173
4173
  this._isUserControllingTruck = !1;
4174
4174
  const o = G.set(s, t, e).sub(this._targetEnd);
4175
4175
  this._encloseToBoundary(this._targetEnd, o, this.boundaryFriction), this._needsUpdate = !0, i || this._target.copy(this._targetEnd);
4176
- 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);
4176
+ const n = !i || W(this._target.x, this._targetEnd.x, this.restThreshold) && W(this._target.y, this._targetEnd.y, this.restThreshold) && W(this._target.z, this._targetEnd.z, this.restThreshold);
4177
4177
  return this._createOnRestPromise(n);
4178
4178
  }
4179
4179
  /**
@@ -4207,17 +4207,17 @@ class ot extends gr {
4207
4207
  c.isEmpty() && (console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"), Promise.resolve());
4208
4208
  const h = on(this._sphericalEnd.theta, nn), d = on(this._sphericalEnd.phi, nn);
4209
4209
  a.push(this.rotateTo(h, d, t));
4210
- const E = G.setFromSpherical(this._sphericalEnd).normalize(), u = En.setFromUnitVectors(E, ti), f = k(Math.abs(E.y), 1);
4210
+ const E = G.setFromSpherical(this._sphericalEnd).normalize(), u = En.setFromUnitVectors(E, ti), f = W(Math.abs(E.y), 1);
4211
4211
  f && u.multiply(si.setFromAxisAngle(ds, h)), u.multiply(this._yAxisUpSpaceInverse);
4212
- const R = hn.makeEmpty();
4213
- 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(ti, E), f && u.premultiply(si.invert()), u.premultiply(this._yAxisUpSpace);
4214
- const m = R.getSize(G), C = R.getCenter(z).applyQuaternion(u);
4212
+ const T = hn.makeEmpty();
4213
+ z.copy(c.min).applyQuaternion(u), T.expandByPoint(z), z.copy(c.min).setX(c.max.x).applyQuaternion(u), T.expandByPoint(z), z.copy(c.min).setY(c.max.y).applyQuaternion(u), T.expandByPoint(z), z.copy(c.max).setZ(c.min.z).applyQuaternion(u), T.expandByPoint(z), z.copy(c.min).setZ(c.max.z).applyQuaternion(u), T.expandByPoint(z), z.copy(c.max).setY(c.min.y).applyQuaternion(u), T.expandByPoint(z), z.copy(c.max).setX(c.min.x).applyQuaternion(u), T.expandByPoint(z), z.copy(c.max).applyQuaternion(u), T.expandByPoint(z), T.min.x -= i, T.min.y -= n, T.max.x += o, T.max.y += r, u.setFromUnitVectors(ti, E), f && u.premultiply(si.invert()), u.premultiply(this._yAxisUpSpace);
4214
+ const R = T.getSize(G), C = T.getCenter(z).applyQuaternion(u);
4215
4215
  if (Zt(this._camera)) {
4216
- const A = this.getDistanceToFitBox(m.x, m.y, m.z, e);
4216
+ const A = this.getDistanceToFitBox(R.x, R.y, R.z, e);
4217
4217
  a.push(this.moveTo(C.x, C.y, C.z, t)), a.push(this.dollyTo(A, t)), a.push(this.setFocalOffset(0, 0, 0, t));
4218
4218
  } else if (bt(this._camera)) {
4219
- const A = this._camera, F = A.right - A.left, p = A.top - A.bottom, T = e ? Math.max(F / m.x, p / m.y) : Math.min(F / m.x, p / m.y);
4220
- a.push(this.moveTo(C.x, C.y, C.z, t)), a.push(this.zoomTo(T, t)), a.push(this.setFocalOffset(0, 0, 0, t));
4219
+ const A = this._camera, F = A.right - A.left, p = A.top - A.bottom, m = e ? Math.max(F / R.x, p / R.y) : Math.min(F / R.x, p / R.y);
4220
+ a.push(this.moveTo(C.x, C.y, C.z, t)), a.push(this.zoomTo(m, t)), a.push(this.setFocalOffset(0, 0, 0, t));
4221
4221
  }
4222
4222
  return Promise.all(a);
4223
4223
  }
@@ -4253,7 +4253,7 @@ class ot extends gr {
4253
4253
  this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection = le.NONE, this._changedDolly = 0;
4254
4254
  const a = z.set(i, o, n), c = G.set(s, t, e);
4255
4255
  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));
4256
- const h = !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);
4256
+ const h = !r || W(this._target.x, this._targetEnd.x, this.restThreshold) && W(this._target.y, this._targetEnd.y, this.restThreshold) && W(this._target.z, this._targetEnd.z, this.restThreshold) && W(this._spherical.theta, this._sphericalEnd.theta, this.restThreshold) && W(this._spherical.phi, this._sphericalEnd.phi, this.restThreshold) && W(this._spherical.radius, this._sphericalEnd.radius, this.restThreshold);
4257
4257
  return this._createOnRestPromise(h);
4258
4258
  }
4259
4259
  /**
@@ -4276,13 +4276,13 @@ class ot extends gr {
4276
4276
  */
4277
4277
  lerpLookAt(s, t, e, i, o, n, r, a, c, h, d, E, u, f = !1) {
4278
4278
  this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection = le.NONE, this._changedDolly = 0;
4279
- const R = G.set(i, o, n), m = z.set(s, t, e);
4280
- ut.setFromVector3(m.sub(R).applyQuaternion(this._yAxisUpSpace));
4279
+ const T = G.set(i, o, n), R = z.set(s, t, e);
4280
+ ut.setFromVector3(R.sub(T).applyQuaternion(this._yAxisUpSpace));
4281
4281
  const C = Ee.set(h, d, E), A = z.set(r, a, c);
4282
- Me.setFromVector3(A.sub(C).applyQuaternion(this._yAxisUpSpace)), this._targetEnd.copy(R.lerp(C, u));
4283
- const F = Me.theta - ut.theta, p = Me.phi - ut.phi, T = Me.radius - ut.radius;
4284
- this._sphericalEnd.set(ut.radius + T * u, ut.phi + p * u, ut.theta + F * u), this.normalizeRotations(), this._needsUpdate = !0, f || (this._target.copy(this._targetEnd), this._spherical.copy(this._sphericalEnd));
4285
- const g = !f || 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);
4282
+ Me.setFromVector3(A.sub(C).applyQuaternion(this._yAxisUpSpace)), this._targetEnd.copy(T.lerp(C, u));
4283
+ const F = Me.theta - ut.theta, p = Me.phi - ut.phi, m = Me.radius - ut.radius;
4284
+ this._sphericalEnd.set(ut.radius + m * u, ut.phi + p * u, ut.theta + F * u), this.normalizeRotations(), this._needsUpdate = !0, f || (this._target.copy(this._targetEnd), this._spherical.copy(this._sphericalEnd));
4285
+ const g = !f || W(this._target.x, this._targetEnd.x, this.restThreshold) && W(this._target.y, this._targetEnd.y, this.restThreshold) && W(this._target.z, this._targetEnd.z, this.restThreshold) && W(this._spherical.theta, this._sphericalEnd.theta, this.restThreshold) && W(this._spherical.phi, this._sphericalEnd.phi, this.restThreshold) && W(this._spherical.radius, this._sphericalEnd.radius, this.restThreshold);
4286
4286
  return this._createOnRestPromise(g);
4287
4287
  }
4288
4288
  /**
@@ -4320,7 +4320,7 @@ class ot extends gr {
4320
4320
  */
4321
4321
  setFocalOffset(s, t, e, i = !1) {
4322
4322
  this._isUserControllingOffset = !1, this._focalOffsetEnd.set(s, t, e), this._needsUpdate = !0, i || this._focalOffset.copy(this._focalOffsetEnd);
4323
- const o = !i || k(this._focalOffset.x, this._focalOffsetEnd.x, this.restThreshold) && k(this._focalOffset.y, this._focalOffsetEnd.y, this.restThreshold) && k(this._focalOffset.z, this._focalOffsetEnd.z, this.restThreshold);
4323
+ const o = !i || W(this._focalOffset.x, this._focalOffsetEnd.x, this.restThreshold) && W(this._focalOffset.y, this._focalOffsetEnd.y, this.restThreshold) && W(this._focalOffset.z, this._focalOffsetEnd.z, this.restThreshold);
4324
4324
  return this._createOnRestPromise(o);
4325
4325
  }
4326
4326
  /**
@@ -4439,7 +4439,7 @@ class ot extends gr {
4439
4439
  * @category Methods
4440
4440
  */
4441
4441
  reset(s = !1) {
4442
- 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)) {
4442
+ if (!W(this._camera.up.x, this._cameraUp0.x) || !W(this._camera.up.y, this._cameraUp0.y) || !W(this._camera.up.z, this._cameraUp0.z)) {
4443
4443
  this._camera.up.copy(this._cameraUp0);
4444
4444
  const e = this.getPosition(G);
4445
4445
  this.updateCameraUp(), this.setPosition(e.x, e.y, e.z);
@@ -4526,8 +4526,8 @@ class ot extends gr {
4526
4526
  if (Zt(this._camera) && this._changedDolly !== 0) {
4527
4527
  const d = this._spherical.radius - this._lastDistance, E = this._camera, u = this._getCameraDirection(Le), f = G.copy(u).cross(E.up).normalize();
4528
4528
  f.lengthSq() === 0 && (f.x = 1);
4529
- const R = z.crossVectors(f, u), m = this._sphericalEnd.radius * Math.tan(E.getEffectiveFOV() * Ne * 0.5), A = (this._sphericalEnd.radius - d - this._sphericalEnd.radius) / this._sphericalEnd.radius, F = Ee.copy(this._targetEnd).add(f.multiplyScalar(this._dollyControlCoord.x * m * E.aspect)).add(R.multiplyScalar(this._dollyControlCoord.y * m)), p = G.copy(this._targetEnd).lerp(F, A), T = this._lastDollyDirection === le.IN && this._spherical.radius <= this.minDistance, g = this._lastDollyDirection === le.OUT && this.maxDistance <= this._spherical.radius;
4530
- if (this.infinityDolly && (T || g)) {
4529
+ const T = z.crossVectors(f, u), R = this._sphericalEnd.radius * Math.tan(E.getEffectiveFOV() * Ne * 0.5), A = (this._sphericalEnd.radius - d - this._sphericalEnd.radius) / this._sphericalEnd.radius, F = Ee.copy(this._targetEnd).add(f.multiplyScalar(this._dollyControlCoord.x * R * E.aspect)).add(T.multiplyScalar(this._dollyControlCoord.y * R)), p = G.copy(this._targetEnd).lerp(F, A), m = this._lastDollyDirection === le.IN && this._spherical.radius <= this.minDistance, g = this._lastDollyDirection === le.OUT && this.maxDistance <= this._spherical.radius;
4530
+ if (this.infinityDolly && (m || g)) {
4531
4531
  this._sphericalEnd.radius -= d, this._spherical.radius -= d;
4532
4532
  const _ = z.copy(u).multiplyScalar(-d);
4533
4533
  p.add(_);
@@ -4536,7 +4536,7 @@ class ot extends gr {
4536
4536
  const S = z.subVectors(p, this._targetEnd);
4537
4537
  this._targetEnd.copy(p), this._target.add(S), this._changedDolly -= d, X(this._changedDolly) && (this._changedDolly = 0);
4538
4538
  } else if (bt(this._camera) && this._changedZoom !== 0) {
4539
- const d = this._zoom - this._lastZoom, E = this._camera, u = G.set(this._dollyControlCoord.x, this._dollyControlCoord.y, (E.near + E.far) / (E.near - E.far)).unproject(E), f = z.set(0, 0, -1).applyQuaternion(E.quaternion), R = Ee.copy(u).add(f.multiplyScalar(-u.dot(E.up))), C = -(this._zoom - d - this._zoom) / this._zoom, A = this._getCameraDirection(Le), F = this._targetEnd.dot(A), p = G.copy(this._targetEnd).lerp(R, C), T = p.dot(A), g = A.multiplyScalar(T - F);
4539
+ const d = this._zoom - this._lastZoom, E = this._camera, u = G.set(this._dollyControlCoord.x, this._dollyControlCoord.y, (E.near + E.far) / (E.near - E.far)).unproject(E), f = z.set(0, 0, -1).applyQuaternion(E.quaternion), T = Ee.copy(u).add(f.multiplyScalar(-u.dot(E.up))), C = -(this._zoom - d - this._zoom) / this._zoom, A = this._getCameraDirection(Le), F = this._targetEnd.dot(A), p = G.copy(this._targetEnd).lerp(T, C), m = p.dot(A), g = A.multiplyScalar(m - F);
4540
4540
  p.sub(g), this._boundary.clampPoint(p, p);
4541
4541
  const S = z.subVectors(p, this._targetEnd);
4542
4542
  this._targetEnd.copy(p), this._target.add(S), this._changedZoom -= d, X(this._changedZoom) && (this._changedZoom = 0);
@@ -4598,7 +4598,7 @@ class ot extends gr {
4598
4598
  console.warn("camera-controls is already connected.");
4599
4599
  return;
4600
4600
  }
4601
- s.setAttribute("data-camera-controls-version", Or), this._addAllEventListeners(s), this._getClientRect(this._elementRect);
4601
+ s.setAttribute("data-camera-controls-version", Sr), this._addAllEventListeners(s), this._getClientRect(this._elementRect);
4602
4602
  }
4603
4603
  /**
4604
4604
  * Detach all internal event handlers to disable drag control.
@@ -4743,7 +4743,7 @@ class ot extends gr {
4743
4743
  }), e.radius = Math.sqrt(o), e;
4744
4744
  }
4745
4745
  }
4746
- class ke extends ar {
4746
+ class We extends cr {
4747
4747
  constructor(t) {
4748
4748
  super(t);
4749
4749
  /** {@link Updateable.onBeforeUpdate} */
@@ -4843,7 +4843,7 @@ class ke extends ar {
4843
4843
  throw new Error("This camera needs a world to work!");
4844
4844
  if (!this.currentWorld.renderer)
4845
4845
  throw new Error("This camera needs a renderer to work!");
4846
- ot.install({ THREE: ke.getSubsetOfThree() });
4846
+ ot.install({ THREE: We.getSubsetOfThree() });
4847
4847
  const { domElement: t } = this.currentWorld.renderer.three, e = new ot(this.three, t);
4848
4848
  return e.smoothTime = 0.2, e.dollyToCursor = !0, e.infinityDolly = !0, e;
4849
4849
  }
@@ -4904,7 +4904,7 @@ const Os = class Os extends et {
4904
4904
  * @throws {Error} - Throws an error if a world with the same UUID already exists in the list.
4905
4905
  */
4906
4906
  create() {
4907
- const t = new Fr(this.components), e = t.uuid;
4907
+ const t = new gr(this.components), e = t.uuid;
4908
4908
  if (this.list.has(e))
4909
4909
  throw new Error("There is already a world with this name!");
4910
4910
  return this.list.set(e, t), this.onWorldCreated.trigger(t), t;
@@ -4950,7 +4950,7 @@ const Os = class Os extends et {
4950
4950
  */
4951
4951
  I(Os, "uuid", "fdb61dc4-2ec1-4966-b83d-54ea795fad4a");
4952
4952
  let Ci = Os;
4953
- class Nr {
4953
+ class Pr {
4954
4954
  constructor(s, t, e) {
4955
4955
  /** {@link Disposable.onDisposed} */
4956
4956
  I(this, "onDisposed", new D());
@@ -4962,7 +4962,7 @@ class Nr {
4962
4962
  I(this, "three");
4963
4963
  I(this, "_fade", 3);
4964
4964
  I(this, "updateZoom", () => {
4965
- this.world.camera instanceof ke && (this.material.uniforms.uZoom.value = this.world.camera.three.zoom);
4965
+ this.world.camera instanceof We && (this.material.uniforms.uZoom.value = this.world.camera.three.zoom);
4966
4966
  });
4967
4967
  this.world = t;
4968
4968
  const { color: i, size1: o, size2: n, distance: r } = e;
@@ -5090,7 +5090,7 @@ class Nr {
5090
5090
  this.setupEvents(!1), this.components.get(zt).destroy(this.three), this.onDisposed.trigger(), this.onDisposed.reset(), this.world = null, this.components = null;
5091
5091
  }
5092
5092
  setupEvents(s) {
5093
- if (this.world.isDisposing || !(this.world.camera instanceof ke))
5093
+ if (this.world.isDisposing || !(this.world.camera instanceof We))
5094
5094
  return;
5095
5095
  const t = this.world.camera.controls;
5096
5096
  s ? t.addEventListener("update", this.updateZoom) : t.removeEventListener("update", this.updateZoom);
@@ -5130,7 +5130,7 @@ const Ss = class Ss extends et {
5130
5130
  create(t) {
5131
5131
  if (this.list.has(t.uuid))
5132
5132
  throw new Error("This world already has a grid!");
5133
- const e = new Nr(this.components, t, this.config);
5133
+ const e = new Pr(this.components, t, this.config);
5134
5134
  return this.list.set(t.uuid, e), t.onDisposed.add(() => {
5135
5135
  this.delete(t);
5136
5136
  }), e;
@@ -5162,17 +5162,17 @@ const Ss = class Ss extends et {
5162
5162
  */
5163
5163
  I(Ss, "uuid", "d1e814d5-b81c-4452-87a2-f039375e0489");
5164
5164
  let dn = Ss;
5165
- const jt = new jn(), nt = new M(), xt = new M(), j = new Pt(), un = {
5165
+ const jt = new qn(), nt = new M(), xt = new M(), j = new Pt(), un = {
5166
5166
  X: new M(1, 0, 0),
5167
5167
  Y: new M(0, 1, 0),
5168
5168
  Z: new M(0, 0, 1)
5169
5169
  }, ni = { type: "change" }, In = { type: "mouseDown" }, fn = { type: "mouseUp", mode: null }, pn = { type: "objectChange" };
5170
- class Pr extends ri {
5170
+ class yr extends ri {
5171
5171
  constructor(s, t) {
5172
5172
  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";
5173
- const e = new Ur();
5173
+ const e = new xr();
5174
5174
  this._gizmo = e, this.add(e);
5175
- const i = new xr();
5175
+ const i = new br();
5176
5176
  this._plane = i, this.add(i);
5177
5177
  const o = this;
5178
5178
  function n(A, F) {
@@ -5181,14 +5181,14 @@ class Pr extends ri {
5181
5181
  get: function() {
5182
5182
  return p !== void 0 ? p : F;
5183
5183
  },
5184
- set: function(T) {
5185
- p !== T && (p = T, i[A] = T, e[A] = T, o.dispatchEvent({ type: A + "-changed", value: T }), o.dispatchEvent(ni));
5184
+ set: function(m) {
5185
+ p !== m && (p = m, i[A] = m, e[A] = m, o.dispatchEvent({ type: A + "-changed", value: m }), o.dispatchEvent(ni));
5186
5186
  }
5187
5187
  }), o[A] = F, i[A] = F, e[A] = F;
5188
5188
  }
5189
5189
  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);
5190
- const r = new M(), a = new M(), c = new Pt(), h = new Pt(), d = new M(), E = new Pt(), u = new M(), f = new M(), R = new M(), m = 0, C = new M();
5191
- n("worldPosition", r), n("worldPositionStart", a), n("worldQuaternion", c), n("worldQuaternionStart", h), n("cameraPosition", d), n("cameraQuaternion", E), n("pointStart", u), n("pointEnd", f), n("rotationAxis", R), n("rotationAngle", m), 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 Pt(), this._parentQuaternionInv = new Pt(), this._parentScale = new M(), this._worldScaleStart = new M(), this._worldQuaternionInv = new Pt(), this._worldScale = new M(), this._positionStart = new M(), this._quaternionStart = new Pt(), this._scaleStart = new M(), this._getPointer = yr.bind(this), this._onPointerDown = Mr.bind(this), this._onPointerHover = Lr.bind(this), this._onPointerMove = wr.bind(this), this._onPointerUp = Dr.bind(this), this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointermove", this._onPointerHover), this.domElement.addEventListener("pointerup", this._onPointerUp);
5190
+ const r = new M(), a = new M(), c = new Pt(), h = new Pt(), d = new M(), E = new Pt(), u = new M(), f = new M(), T = new M(), R = 0, C = new M();
5191
+ n("worldPosition", r), n("worldPositionStart", a), n("worldQuaternion", c), n("worldQuaternionStart", h), n("cameraPosition", d), n("cameraQuaternion", E), n("pointStart", u), n("pointEnd", f), n("rotationAxis", T), n("rotationAngle", R), 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 Pt(), this._parentQuaternionInv = new Pt(), this._parentScale = new M(), this._worldScaleStart = new M(), this._worldQuaternionInv = new Pt(), this._worldScale = new M(), this._positionStart = new M(), this._quaternionStart = new Pt(), this._scaleStart = new M(), this._getPointer = Lr.bind(this), this._onPointerDown = wr.bind(this), this._onPointerHover = Mr.bind(this), this._onPointerMove = Dr.bind(this), this._onPointerUp = Ur.bind(this), this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointermove", this._onPointerHover), this.domElement.addEventListener("pointerup", this._onPointerUp);
5192
5192
  }
5193
5193
  // updateMatrixWorld updates key transformation variables
5194
5194
  updateMatrixWorld() {
@@ -5279,7 +5279,7 @@ class Pr extends ri {
5279
5279
  this.space = s;
5280
5280
  }
5281
5281
  }
5282
- function yr(l) {
5282
+ function Lr(l) {
5283
5283
  if (this.domElement.ownerDocument.pointerLockElement)
5284
5284
  return {
5285
5285
  x: 0,
@@ -5295,7 +5295,7 @@ function yr(l) {
5295
5295
  };
5296
5296
  }
5297
5297
  }
5298
- function Lr(l) {
5298
+ function Mr(l) {
5299
5299
  if (this.enabled)
5300
5300
  switch (l.pointerType) {
5301
5301
  case "mouse":
@@ -5304,13 +5304,13 @@ function Lr(l) {
5304
5304
  break;
5305
5305
  }
5306
5306
  }
5307
- function Mr(l) {
5307
+ function wr(l) {
5308
5308
  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)));
5309
5309
  }
5310
- function wr(l) {
5310
+ function Dr(l) {
5311
5311
  this.enabled && this.pointerMove(this._getPointer(l));
5312
5312
  }
5313
- function Dr(l) {
5313
+ function Ur(l) {
5314
5314
  this.enabled && (this.domElement.releasePointerCapture(l.pointerId), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.pointerUp(this._getPointer(l)));
5315
5315
  }
5316
5316
  function oi(l, s, t) {
@@ -5320,8 +5320,8 @@ function oi(l, s, t) {
5320
5320
  return e[i];
5321
5321
  return !1;
5322
5322
  }
5323
- const Is = new qn(), W = new M(0, 1, 0), Cn = new M(0, 0, 0), Tn = new Lt(), fs = new Pt(), Rs = new Pt(), _t = new M(), mn = new Lt(), Ue = new M(1, 0, 0), qt = new M(0, 1, 0), xe = new M(0, 0, 1), ps = new M(), we = new M(), De = new M();
5324
- class Ur extends ri {
5323
+ const Is = new Kn(), k = new M(0, 1, 0), Cn = new M(0, 0, 0), Tn = new Lt(), fs = new Pt(), Rs = new Pt(), _t = new M(), mn = new Lt(), Ue = new M(1, 0, 0), qt = new M(0, 1, 0), xe = new M(0, 0, 1), ps = new M(), we = new M(), De = new M();
5324
+ class xr extends ri {
5325
5325
  constructor() {
5326
5326
  super(), this.isTransformControlsGizmo = !0, this.type = "TransformControlsGizmo";
5327
5327
  const s = new Ln({
@@ -5330,7 +5330,7 @@ class Ur extends ri {
5330
5330
  fog: !1,
5331
5331
  toneMapped: !1,
5332
5332
  transparent: !0
5333
- }), t = new Kn({
5333
+ }), t = new $n({
5334
5334
  depthTest: !1,
5335
5335
  depthWrite: !1,
5336
5336
  fog: !1,
@@ -5358,10 +5358,10 @@ class Ur extends ri {
5358
5358
  E.color.setHex(16776960), E.opacity = 0.25, s.clone().color.setHex(16776960);
5359
5359
  const f = s.clone();
5360
5360
  f.color.setHex(7895160);
5361
- const R = new ct(0, 0.04, 0.1, 12);
5362
- R.translate(0, 0.05, 0);
5363
- const m = new rt(0.08, 0.08, 0.08);
5364
- m.translate(0, 0.04, 0);
5361
+ const T = new ct(0, 0.04, 0.1, 12);
5362
+ T.translate(0, 0.05, 0);
5363
+ const R = new rt(0.08, 0.08, 0.08);
5364
+ R.translate(0, 0.04, 0);
5365
5365
  const C = new Di();
5366
5366
  C.setAttribute("position", new Ui([0, 0, 0, 1, 0, 0], 3));
5367
5367
  const A = new ct(75e-4, 75e-4, 0.5, 3);
@@ -5374,20 +5374,20 @@ class Ur extends ri {
5374
5374
  const B = new Di();
5375
5375
  return B.setAttribute("position", new Ui([0, 0, 0, 1, 1, 1], 3)), B;
5376
5376
  }
5377
- const T = {
5377
+ const m = {
5378
5378
  X: [
5379
- [new v(R, o), [0.5, 0, 0], [0, 0, -Math.PI / 2]],
5380
- [new v(R, o), [-0.5, 0, 0], [0, 0, Math.PI / 2]],
5379
+ [new v(T, o), [0.5, 0, 0], [0, 0, -Math.PI / 2]],
5380
+ [new v(T, o), [-0.5, 0, 0], [0, 0, Math.PI / 2]],
5381
5381
  [new v(A, o), [0, 0, 0], [0, 0, -Math.PI / 2]]
5382
5382
  ],
5383
5383
  Y: [
5384
- [new v(R, n), [0, 0.5, 0]],
5385
- [new v(R, n), [0, -0.5, 0], [Math.PI, 0, 0]],
5384
+ [new v(T, n), [0, 0.5, 0]],
5385
+ [new v(T, n), [0, -0.5, 0], [Math.PI, 0, 0]],
5386
5386
  [new v(A, n)]
5387
5387
  ],
5388
5388
  Z: [
5389
- [new v(R, r), [0, 0, 0.5], [Math.PI / 2, 0, 0]],
5390
- [new v(R, r), [0, 0, -0.5], [-Math.PI / 2, 0, 0]],
5389
+ [new v(T, r), [0, 0, 0.5], [Math.PI / 2, 0, 0]],
5390
+ [new v(T, r), [0, 0, -0.5], [-Math.PI / 2, 0, 0]],
5391
5391
  [new v(A, r), null, [Math.PI / 2, 0, 0]]
5392
5392
  ],
5393
5393
  XYZ: [
@@ -5468,7 +5468,7 @@ class Ur extends ri {
5468
5468
  ]
5469
5469
  }, y = {
5470
5470
  XYZE: [
5471
- [new v(new $n(0.25, 10, 8), e)]
5471
+ [new v(new Jn(0.25, 10, 8), e)]
5472
5472
  ],
5473
5473
  X: [
5474
5474
  [new v(new Re(0.5, 0.1, 4, 24), e), [0, 0, 0], [0, -Math.PI / 2, -Math.PI / 2]]
@@ -5484,19 +5484,19 @@ class Ur extends ri {
5484
5484
  ]
5485
5485
  }, w = {
5486
5486
  X: [
5487
- [new v(m, o), [0.5, 0, 0], [0, 0, -Math.PI / 2]],
5487
+ [new v(R, o), [0.5, 0, 0], [0, 0, -Math.PI / 2]],
5488
5488
  [new v(A, o), [0, 0, 0], [0, 0, -Math.PI / 2]],
5489
- [new v(m, o), [-0.5, 0, 0], [0, 0, Math.PI / 2]]
5489
+ [new v(R, o), [-0.5, 0, 0], [0, 0, Math.PI / 2]]
5490
5490
  ],
5491
5491
  Y: [
5492
- [new v(m, n), [0, 0.5, 0]],
5492
+ [new v(R, n), [0, 0.5, 0]],
5493
5493
  [new v(A, n)],
5494
- [new v(m, n), [0, -0.5, 0], [0, 0, Math.PI]]
5494
+ [new v(R, n), [0, -0.5, 0], [0, 0, Math.PI]]
5495
5495
  ],
5496
5496
  Z: [
5497
- [new v(m, r), [0, 0, 0.5], [Math.PI / 2, 0, 0]],
5497
+ [new v(R, r), [0, 0, 0.5], [Math.PI / 2, 0, 0]],
5498
5498
  [new v(A, r), [0, 0, 0], [Math.PI / 2, 0, 0]],
5499
- [new v(m, r), [0, 0, -0.5], [-Math.PI / 2, 0, 0]]
5499
+ [new v(R, r), [0, 0, -0.5], [-Math.PI / 2, 0, 0]]
5500
5500
  ],
5501
5501
  XY: [
5502
5502
  [new v(new rt(0.15, 0.15, 0.01), h), [0.15, 0.15, 0]]
@@ -5546,18 +5546,18 @@ class Ur extends ri {
5546
5546
  [new Dt(C, i.clone()), [0, 0, -1e3], [0, -Math.PI / 2, 0], [1e6, 1, 1], "helper"]
5547
5547
  ]
5548
5548
  };
5549
- function x(B) {
5549
+ function b(B) {
5550
5550
  const H = new ri();
5551
5551
  for (const q in B)
5552
5552
  for (let st = B[q].length; st--; ) {
5553
- const Q = B[q][st][0].clone(), Ht = B[q][st][1], kt = B[q][st][2], Wt = B[q][st][3], We = B[q][st][4];
5554
- Q.name = q, Q.tag = We, Ht && Q.position.set(Ht[0], Ht[1], Ht[2]), kt && Q.rotation.set(kt[0], kt[1], kt[2]), Wt && Q.scale.set(Wt[0], Wt[1], Wt[2]), Q.updateMatrix();
5553
+ const Q = B[q][st][0].clone(), Ht = B[q][st][1], Wt = B[q][st][2], kt = B[q][st][3], ke = B[q][st][4];
5554
+ Q.name = q, Q.tag = ke, Ht && Q.position.set(Ht[0], Ht[1], Ht[2]), Wt && Q.rotation.set(Wt[0], Wt[1], Wt[2]), kt && Q.scale.set(kt[0], kt[1], kt[2]), Q.updateMatrix();
5555
5555
  const Te = Q.geometry.clone();
5556
5556
  Te.applyMatrix4(Q.matrix), Q.geometry = Te, Q.renderOrder = 1 / 0, Q.position.set(0, 0, 0), Q.rotation.set(0, 0, 0), Q.scale.set(1, 1, 1), H.add(Q);
5557
5557
  }
5558
5558
  return H;
5559
5559
  }
5560
- this.gizmo = {}, this.picker = {}, this.helper = {}, this.add(this.gizmo.translate = x(T)), 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;
5560
+ this.gizmo = {}, this.picker = {}, this.helper = {}, this.add(this.gizmo.translate = b(m)), this.add(this.gizmo.rotate = b(_)), this.add(this.gizmo.scale = b(w)), this.add(this.picker.translate = b(g)), this.add(this.picker.rotate = b(y)), this.add(this.picker.scale = b(L)), this.add(this.helper.translate = b(S)), this.add(this.helper.rotate = b(N)), this.add(this.helper.scale = b(U)), this.picker.translate.visible = !1, this.picker.rotate.visible = !1, this.picker.scale.visible = !1;
5561
5561
  }
5562
5562
  // updateMatrixWorld will update transformations and appearance of individual handles
5563
5563
  updateMatrixWorld(s) {
@@ -5570,37 +5570,37 @@ class Ur extends ri {
5570
5570
  n.visible = !0, n.rotation.set(0, 0, 0), n.position.copy(this.worldPosition);
5571
5571
  let r;
5572
5572
  if (this.camera.isOrthographicCamera ? r = (this.camera.top - this.camera.bottom) / this.camera.zoom : r = this.worldPosition.distanceTo(this.cameraPosition) * Math.min(1.9 * Math.tan(Math.PI * this.camera.fov / 360) / this.camera.zoom, 7), n.scale.set(1, 1, 1).multiplyScalar(r * this.size / 4), n.tag === "helper") {
5573
- n.visible = !1, n.name === "AXIS" ? (n.visible = !!this.axis, this.axis === "X" && (j.setFromEuler(Is.set(0, 0, 0)), n.quaternion.copy(e).multiply(j), Math.abs(W.copy(Ue).applyQuaternion(e).dot(this.eye)) > 0.9 && (n.visible = !1)), this.axis === "Y" && (j.setFromEuler(Is.set(0, 0, Math.PI / 2)), n.quaternion.copy(e).multiply(j), Math.abs(W.copy(qt).applyQuaternion(e).dot(this.eye)) > 0.9 && (n.visible = !1)), this.axis === "Z" && (j.setFromEuler(Is.set(0, Math.PI / 2, 0)), n.quaternion.copy(e).multiply(j), Math.abs(W.copy(xe).applyQuaternion(e).dot(this.eye)) > 0.9 && (n.visible = !1)), this.axis === "XYZE" && (j.setFromEuler(Is.set(0, Math.PI / 2, 0)), W.copy(this.rotationAxis), n.quaternion.setFromRotationMatrix(Tn.lookAt(Cn, W, qt)), n.quaternion.multiply(j), n.visible = this.dragging), this.axis === "E" && (n.visible = !1)) : n.name === "START" ? (n.position.copy(this.worldPositionStart), n.visible = this.dragging) : n.name === "END" ? (n.position.copy(this.worldPosition), n.visible = this.dragging) : n.name === "DELTA" ? (n.position.copy(this.worldPositionStart), n.quaternion.copy(this.worldQuaternionStart), nt.set(1e-10, 1e-10, 1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1), nt.applyQuaternion(this.worldQuaternionStart.clone().invert()), n.scale.copy(nt), n.visible = this.dragging) : (n.quaternion.copy(e), this.dragging ? n.position.copy(this.worldPositionStart) : n.position.copy(this.worldPosition), this.axis && (n.visible = this.axis.search(n.name) !== -1));
5573
+ n.visible = !1, n.name === "AXIS" ? (n.visible = !!this.axis, this.axis === "X" && (j.setFromEuler(Is.set(0, 0, 0)), n.quaternion.copy(e).multiply(j), Math.abs(k.copy(Ue).applyQuaternion(e).dot(this.eye)) > 0.9 && (n.visible = !1)), this.axis === "Y" && (j.setFromEuler(Is.set(0, 0, Math.PI / 2)), n.quaternion.copy(e).multiply(j), Math.abs(k.copy(qt).applyQuaternion(e).dot(this.eye)) > 0.9 && (n.visible = !1)), this.axis === "Z" && (j.setFromEuler(Is.set(0, Math.PI / 2, 0)), n.quaternion.copy(e).multiply(j), Math.abs(k.copy(xe).applyQuaternion(e).dot(this.eye)) > 0.9 && (n.visible = !1)), this.axis === "XYZE" && (j.setFromEuler(Is.set(0, Math.PI / 2, 0)), k.copy(this.rotationAxis), n.quaternion.setFromRotationMatrix(Tn.lookAt(Cn, k, qt)), n.quaternion.multiply(j), n.visible = this.dragging), this.axis === "E" && (n.visible = !1)) : n.name === "START" ? (n.position.copy(this.worldPositionStart), n.visible = this.dragging) : n.name === "END" ? (n.position.copy(this.worldPosition), n.visible = this.dragging) : n.name === "DELTA" ? (n.position.copy(this.worldPositionStart), n.quaternion.copy(this.worldQuaternionStart), nt.set(1e-10, 1e-10, 1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1), nt.applyQuaternion(this.worldQuaternionStart.clone().invert()), n.scale.copy(nt), n.visible = this.dragging) : (n.quaternion.copy(e), this.dragging ? n.position.copy(this.worldPositionStart) : n.position.copy(this.worldPosition), this.axis && (n.visible = this.axis.search(n.name) !== -1));
5574
5574
  continue;
5575
5575
  }
5576
- n.quaternion.copy(e), this.mode === "translate" || this.mode === "scale" ? (n.name === "X" && Math.abs(W.copy(Ue).applyQuaternion(e).dot(this.eye)) > 0.99 && (n.scale.set(1e-10, 1e-10, 1e-10), n.visible = !1), n.name === "Y" && Math.abs(W.copy(qt).applyQuaternion(e).dot(this.eye)) > 0.99 && (n.scale.set(1e-10, 1e-10, 1e-10), n.visible = !1), n.name === "Z" && Math.abs(W.copy(xe).applyQuaternion(e).dot(this.eye)) > 0.99 && (n.scale.set(1e-10, 1e-10, 1e-10), n.visible = !1), n.name === "XY" && Math.abs(W.copy(xe).applyQuaternion(e).dot(this.eye)) < 0.2 && (n.scale.set(1e-10, 1e-10, 1e-10), n.visible = !1), n.name === "YZ" && Math.abs(W.copy(Ue).applyQuaternion(e).dot(this.eye)) < 0.2 && (n.scale.set(1e-10, 1e-10, 1e-10), n.visible = !1), n.name === "XZ" && Math.abs(W.copy(qt).applyQuaternion(e).dot(this.eye)) < 0.2 && (n.scale.set(1e-10, 1e-10, 1e-10), n.visible = !1)) : this.mode === "rotate" && (fs.copy(e), W.copy(this.eye).applyQuaternion(j.copy(e).invert()), n.name.search("E") !== -1 && n.quaternion.setFromRotationMatrix(Tn.lookAt(this.eye, Cn, qt)), n.name === "X" && (j.setFromAxisAngle(Ue, Math.atan2(-W.y, W.z)), j.multiplyQuaternions(fs, j), n.quaternion.copy(j)), n.name === "Y" && (j.setFromAxisAngle(qt, Math.atan2(W.x, W.z)), j.multiplyQuaternions(fs, j), n.quaternion.copy(j)), n.name === "Z" && (j.setFromAxisAngle(xe, Math.atan2(W.y, W.x)), j.multiplyQuaternions(fs, j), n.quaternion.copy(j))), n.visible = n.visible && (n.name.indexOf("X") === -1 || this.showX), n.visible = n.visible && (n.name.indexOf("Y") === -1 || this.showY), n.visible = n.visible && (n.name.indexOf("Z") === -1 || this.showZ), n.visible = n.visible && (n.name.indexOf("E") === -1 || this.showX && this.showY && this.showZ), n.material._color = n.material._color || n.material.color.clone(), n.material._opacity = n.material._opacity || n.material.opacity, n.material.color.copy(n.material._color), n.material.opacity = n.material._opacity, this.enabled && this.axis && (n.name === this.axis || this.axis.split("").some(function(a) {
5576
+ n.quaternion.copy(e), this.mode === "translate" || this.mode === "scale" ? (n.name === "X" && Math.abs(k.copy(Ue).applyQuaternion(e).dot(this.eye)) > 0.99 && (n.scale.set(1e-10, 1e-10, 1e-10), n.visible = !1), n.name === "Y" && Math.abs(k.copy(qt).applyQuaternion(e).dot(this.eye)) > 0.99 && (n.scale.set(1e-10, 1e-10, 1e-10), n.visible = !1), n.name === "Z" && Math.abs(k.copy(xe).applyQuaternion(e).dot(this.eye)) > 0.99 && (n.scale.set(1e-10, 1e-10, 1e-10), n.visible = !1), n.name === "XY" && Math.abs(k.copy(xe).applyQuaternion(e).dot(this.eye)) < 0.2 && (n.scale.set(1e-10, 1e-10, 1e-10), n.visible = !1), n.name === "YZ" && Math.abs(k.copy(Ue).applyQuaternion(e).dot(this.eye)) < 0.2 && (n.scale.set(1e-10, 1e-10, 1e-10), n.visible = !1), n.name === "XZ" && Math.abs(k.copy(qt).applyQuaternion(e).dot(this.eye)) < 0.2 && (n.scale.set(1e-10, 1e-10, 1e-10), n.visible = !1)) : this.mode === "rotate" && (fs.copy(e), k.copy(this.eye).applyQuaternion(j.copy(e).invert()), n.name.search("E") !== -1 && n.quaternion.setFromRotationMatrix(Tn.lookAt(this.eye, Cn, qt)), n.name === "X" && (j.setFromAxisAngle(Ue, Math.atan2(-k.y, k.z)), j.multiplyQuaternions(fs, j), n.quaternion.copy(j)), n.name === "Y" && (j.setFromAxisAngle(qt, Math.atan2(k.x, k.z)), j.multiplyQuaternions(fs, j), n.quaternion.copy(j)), n.name === "Z" && (j.setFromAxisAngle(xe, Math.atan2(k.y, k.x)), j.multiplyQuaternions(fs, j), n.quaternion.copy(j))), n.visible = n.visible && (n.name.indexOf("X") === -1 || this.showX), n.visible = n.visible && (n.name.indexOf("Y") === -1 || this.showY), n.visible = n.visible && (n.name.indexOf("Z") === -1 || this.showZ), n.visible = n.visible && (n.name.indexOf("E") === -1 || this.showX && this.showY && this.showZ), n.material._color = n.material._color || n.material.color.clone(), n.material._opacity = n.material._opacity || n.material.opacity, n.material.color.copy(n.material._color), n.material.opacity = n.material._opacity, this.enabled && this.axis && (n.name === this.axis || this.axis.split("").some(function(a) {
5577
5577
  return n.name === a;
5578
5578
  })) && (n.material.color.setHex(16776960), n.material.opacity = 1);
5579
5579
  }
5580
5580
  super.updateMatrixWorld(s);
5581
5581
  }
5582
5582
  }
5583
- class xr extends v {
5583
+ class br extends v {
5584
5584
  constructor() {
5585
5585
  super(
5586
- new Jn(1e5, 1e5, 2, 2),
5586
+ new to(1e5, 1e5, 2, 2),
5587
5587
  new Ln({ visible: !1, wireframe: !0, side: yn, transparent: !0, opacity: 0.1, toneMapped: !1 })
5588
5588
  ), this.isTransformControlsPlane = !0, this.type = "TransformControlsPlane";
5589
5589
  }
5590
5590
  updateMatrixWorld(s) {
5591
5591
  let t = this.space;
5592
- switch (this.position.copy(this.worldPosition), this.mode === "scale" && (t = "local"), ps.copy(Ue).applyQuaternion(t === "local" ? this.worldQuaternion : Rs), we.copy(qt).applyQuaternion(t === "local" ? this.worldQuaternion : Rs), De.copy(xe).applyQuaternion(t === "local" ? this.worldQuaternion : Rs), W.copy(we), this.mode) {
5592
+ switch (this.position.copy(this.worldPosition), this.mode === "scale" && (t = "local"), ps.copy(Ue).applyQuaternion(t === "local" ? this.worldQuaternion : Rs), we.copy(qt).applyQuaternion(t === "local" ? this.worldQuaternion : Rs), De.copy(xe).applyQuaternion(t === "local" ? this.worldQuaternion : Rs), k.copy(we), this.mode) {
5593
5593
  case "translate":
5594
5594
  case "scale":
5595
5595
  switch (this.axis) {
5596
5596
  case "X":
5597
- W.copy(this.eye).cross(ps), _t.copy(ps).cross(W);
5597
+ k.copy(this.eye).cross(ps), _t.copy(ps).cross(k);
5598
5598
  break;
5599
5599
  case "Y":
5600
- W.copy(this.eye).cross(we), _t.copy(we).cross(W);
5600
+ k.copy(this.eye).cross(we), _t.copy(we).cross(k);
5601
5601
  break;
5602
5602
  case "Z":
5603
- W.copy(this.eye).cross(De), _t.copy(De).cross(W);
5603
+ k.copy(this.eye).cross(De), _t.copy(De).cross(k);
5604
5604
  break;
5605
5605
  case "XY":
5606
5606
  _t.copy(De);
@@ -5609,7 +5609,7 @@ class xr extends v {
5609
5609
  _t.copy(ps);
5610
5610
  break;
5611
5611
  case "XZ":
5612
- W.copy(De), _t.copy(we);
5612
+ k.copy(De), _t.copy(we);
5613
5613
  break;
5614
5614
  case "XYZ":
5615
5615
  case "E":
@@ -5621,7 +5621,7 @@ class xr extends v {
5621
5621
  default:
5622
5622
  _t.set(0, 0, 0);
5623
5623
  }
5624
- _t.length() === 0 ? this.quaternion.copy(this.cameraQuaternion) : (mn.lookAt(nt.set(0, 0, 0), _t, W), this.quaternion.setFromRotationMatrix(mn)), super.updateMatrixWorld(s);
5624
+ _t.length() === 0 ? this.quaternion.copy(this.cameraQuaternion) : (mn.lookAt(nt.set(0, 0, 0), _t, k), this.quaternion.setFromRotationMatrix(mn)), super.updateMatrixWorld(s);
5625
5625
  }
5626
5626
  }
5627
5627
  class Pi {
@@ -5762,7 +5762,7 @@ class Pi {
5762
5762
  newTransformControls() {
5763
5763
  if (!this.world.renderer)
5764
5764
  throw new Error("No renderer found for clipping plane!");
5765
- const s = this.world.camera.three, t = this.world.renderer.three.domElement, e = new Pr(s, t);
5765
+ const s = this.world.camera.three, t = this.world.renderer.three.domElement, e = new yr(s, t);
5766
5766
  return this.initializeControls(e), this.world.scene.three.add(e), e;
5767
5767
  }
5768
5768
  initializeControls(s) {
@@ -6028,7 +6028,7 @@ const Be = class Be extends et {
6028
6028
  */
6029
6029
  I(Be, "uuid", "66290bc5-18c4-4cd1-9379-2e17a0617611");
6030
6030
  let Rn = Be;
6031
- function br(l, s, t, e) {
6031
+ function vr(l, s, t, e) {
6032
6032
  return new Promise((i, o) => {
6033
6033
  function n() {
6034
6034
  const r = l.clientWaitSync(s, t, 0);
@@ -6045,15 +6045,15 @@ function br(l, s, t, e) {
6045
6045
  n();
6046
6046
  });
6047
6047
  }
6048
- async function vr(l, s, t, e, i, o, n) {
6048
+ async function Br(l, s, t, e, i, o, n) {
6049
6049
  const r = l.fenceSync(l.SYNC_GPU_COMMANDS_COMPLETE, 0);
6050
- l.flush(), await br(l, r, 0, 10), l.deleteSync(r), l.bindBuffer(s, t), l.getBufferSubData(s, e, i, o, n), l.bindBuffer(s, null);
6050
+ l.flush(), await vr(l, r, 0, 10), l.deleteSync(r), l.bindBuffer(s, t), l.getBufferSubData(s, e, i, o, n), l.bindBuffer(s, null);
6051
6051
  }
6052
- async function Br(l, s, t, e, i, o, n, r) {
6052
+ async function Yr(l, s, t, e, i, o, n, r) {
6053
6053
  const a = l.createBuffer();
6054
- 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 vr(l, l.PIXEL_PACK_BUFFER, a, 0, r), l.deleteBuffer(a), r;
6054
+ 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 Br(l, l.PIXEL_PACK_BUFFER, a, 0, r), l.deleteBuffer(a), r;
6055
6055
  }
6056
- class Yr {
6056
+ class Vr {
6057
6057
  constructor(s, t, e) {
6058
6058
  /** {@link Disposable.onDisposed} */
6059
6059
  I(this, "onDisposed", new D());
@@ -6108,7 +6108,7 @@ class Yr {
6108
6108
  const t = this.world.camera.three;
6109
6109
  t.updateMatrix(), this.renderer.setSize(this._width, this._height), this.renderer.setRenderTarget(this.renderTarget), this.renderer.render(this.scene, t);
6110
6110
  const e = this.renderer.getContext();
6111
- await Br(
6111
+ await Yr(
6112
6112
  e,
6113
6113
  0,
6114
6114
  0,
@@ -6180,7 +6180,7 @@ class Yr {
6180
6180
  s && (s.updateInterval !== void 0 && (this.updateInterval = s.updateInterval), s.height !== void 0 && (this._height = s.height), s.width !== void 0 && (this._width = s.width), s.autoUpdate !== void 0 && (this.autoUpdate = s.autoUpdate));
6181
6181
  }
6182
6182
  }
6183
- class Vr extends Yr {
6183
+ class Gr extends Vr {
6184
6184
  constructor(t, e, i) {
6185
6185
  super(t, e, i);
6186
6186
  /**
@@ -6352,7 +6352,7 @@ const Ye = class Ye extends et {
6352
6352
  create(t, e) {
6353
6353
  if (this.list.has(t.uuid))
6354
6354
  return this.list.get(t.uuid);
6355
- const i = new Vr(this.components, t, e);
6355
+ const i = new Gr(this.components, t, e);
6356
6356
  return this.list.set(t.uuid, i), i;
6357
6357
  }
6358
6358
  /**
@@ -6381,7 +6381,7 @@ const Ye = class Ye extends et {
6381
6381
  */
6382
6382
  I(Ye, "uuid", "69f2a50d-c266-44fc-b1bd-fa4d34be89e6");
6383
6383
  let Ti = Ye;
6384
- class Gr {
6384
+ class zr {
6385
6385
  constructor(s) {
6386
6386
  /** {@link Disposable.onDisposed} */
6387
6387
  I(this, "onDisposed", new D());
@@ -6550,7 +6550,7 @@ const _s = class _s extends et {
6550
6550
  create(t) {
6551
6551
  if (this.list.has(t.uuid))
6552
6552
  throw new Error("This world already has a minimap!");
6553
- const e = new Gr(t);
6553
+ const e = new zr(t);
6554
6554
  return this.list.set(t.uuid, e), e;
6555
6555
  }
6556
6556
  /**
@@ -6582,7 +6582,7 @@ const _s = class _s extends et {
6582
6582
  */
6583
6583
  I(_s, "uuid", "39ad6aad-84c8-4adf-a1e0-7f25313a9e7f");
6584
6584
  let An = _s;
6585
- class zr {
6585
+ class Hr {
6586
6586
  constructor(s) {
6587
6587
  /** {@link NavigationMode.enabled} */
6588
6588
  I(this, "enabled", !1);
@@ -6609,7 +6609,7 @@ class zr {
6609
6609
  ), s.truckSpeed = 50, s.mouseButtons.wheel = ot.ACTION.DOLLY, s.touches.two = ot.ACTION.TOUCH_ZOOM_TRUCK;
6610
6610
  }
6611
6611
  }
6612
- class Hr {
6612
+ class Wr {
6613
6613
  constructor(s) {
6614
6614
  /** {@link NavigationMode.enabled} */
6615
6615
  I(this, "enabled", !0);
@@ -6652,7 +6652,7 @@ class kr {
6652
6652
  t.azimuthRotateSpeed = s ? 0 : this.defaultAzimuthSpeed, t.polarRotateSpeed = s ? 0 : this.defaultPolarSpeed, this.mouseInitialized || (this.mouseAction1 = t.touches.one, this.mouseAction2 = t.touches.two, this.mouseInitialized = !0), s ? (t.mouseButtons.left = ot.ACTION.TRUCK, t.touches.one = ot.ACTION.TOUCH_TRUCK, t.touches.two = ot.ACTION.TOUCH_ZOOM) : (t.mouseButtons.left = ot.ACTION.ROTATE, t.touches.one = this.mouseAction1, t.touches.two = this.mouseAction2);
6653
6653
  }
6654
6654
  }
6655
- class Wr {
6655
+ class Xr {
6656
6656
  constructor(s) {
6657
6657
  /**
6658
6658
  * Event that fires when the {@link CameraProjection} changes.
@@ -6727,7 +6727,7 @@ class Wr {
6727
6727
  s.position.copy(t.position), s.quaternion.copy(t.quaternion), this._component.controls.mouseButtons.wheel = ot.ACTION.DOLLY, this.matchOrthoDistanceEnabled ? this._component.controls.distance = this.getDistance() : this._component.controls.distance = this._previousDistance, await this._component.controls.zoomTo(1), s.updateProjectionMatrix(), this._component.controls.camera = s, this.camera = s, this.current = "Perspective";
6728
6728
  }
6729
6729
  }
6730
- class na extends ke {
6730
+ class oa extends We {
6731
6731
  constructor(t) {
6732
6732
  super(t);
6733
6733
  /**
@@ -6749,14 +6749,14 @@ class na extends ke {
6749
6749
  I(this, "_navigationModes", /* @__PURE__ */ new Map());
6750
6750
  I(this, "_mode", null);
6751
6751
  I(this, "previousSize", null);
6752
- this.threePersp = this.three, this.threeOrtho = this.newOrthoCamera(), this.projection = new Wr(this), this.onAspectUpdated.add(() => {
6752
+ this.threePersp = this.three, this.threeOrtho = this.newOrthoCamera(), this.projection = new Xr(this), this.onAspectUpdated.add(() => {
6753
6753
  this.setOrthoPerspCameraAspect();
6754
6754
  }), this.projection.onChanged.add(
6755
6755
  (e) => {
6756
6756
  this.three = e, this.updateAspect();
6757
6757
  }
6758
6758
  ), this.onWorldChanged.add(({ action: e }) => {
6759
- e === "added" && (this._navigationModes.clear(), this._navigationModes.set("Orbit", new Hr(this)), this._navigationModes.set("FirstPerson", new zr(this)), this._navigationModes.set("Plan", new kr(this)), this._mode = this._navigationModes.get("Orbit"), this.mode.set(!0, { preventTargetAdjustment: !0 }), this.currentWorld && this.currentWorld.renderer && (this.previousSize = this.currentWorld.renderer.getSize().clone()));
6759
+ e === "added" && (this._navigationModes.clear(), this._navigationModes.set("Orbit", new Wr(this)), this._navigationModes.set("FirstPerson", new Hr(this)), this._navigationModes.set("Plan", new kr(this)), this._mode = this._navigationModes.get("Orbit"), this.mode.set(!0, { preventTargetAdjustment: !0 }), this.currentWorld && this.currentWorld.renderer && (this.previousSize = this.currentWorld.renderer.getSize().clone()));
6760
6760
  });
6761
6761
  }
6762
6762
  /**
@@ -6842,58 +6842,58 @@ class na extends ke {
6842
6842
  this.threeOrtho.left = -a, this.threeOrtho.right = a, this.threeOrtho.top = r, this.threeOrtho.bottom = -r, this.threeOrtho.updateProjectionMatrix(), this.previousSize.copy(t);
6843
6843
  }
6844
6844
  }
6845
- const Xr = /* @__PURE__ */ new Map([
6845
+ const Zr = /* @__PURE__ */ new Map([
6846
6846
  [
6847
- b.IFCRELAGGREGATES,
6847
+ x.IFCRELAGGREGATES,
6848
6848
  {
6849
6849
  forRelating: "IsDecomposedBy",
6850
6850
  forRelated: "Decomposes"
6851
6851
  }
6852
6852
  ],
6853
6853
  [
6854
- b.IFCRELASSOCIATESMATERIAL,
6854
+ x.IFCRELASSOCIATESMATERIAL,
6855
6855
  {
6856
6856
  forRelating: "AssociatedTo",
6857
6857
  forRelated: "HasAssociations"
6858
6858
  }
6859
6859
  ],
6860
6860
  [
6861
- b.IFCRELASSOCIATESCLASSIFICATION,
6861
+ x.IFCRELASSOCIATESCLASSIFICATION,
6862
6862
  {
6863
6863
  forRelating: "ClassificationForObjects",
6864
6864
  forRelated: "HasAssociations"
6865
6865
  }
6866
6866
  ],
6867
6867
  [
6868
- b.IFCRELASSIGNSTOGROUP,
6868
+ x.IFCRELASSIGNSTOGROUP,
6869
6869
  {
6870
6870
  forRelating: "IsGroupedBy",
6871
6871
  forRelated: "HasAssignments"
6872
6872
  }
6873
6873
  ],
6874
6874
  [
6875
- b.IFCRELDEFINESBYPROPERTIES,
6875
+ x.IFCRELDEFINESBYPROPERTIES,
6876
6876
  {
6877
6877
  forRelated: "IsDefinedBy",
6878
6878
  forRelating: "DefinesOcurrence"
6879
6879
  }
6880
6880
  ],
6881
6881
  [
6882
- b.IFCRELDEFINESBYTYPE,
6882
+ x.IFCRELDEFINESBYTYPE,
6883
6883
  {
6884
6884
  forRelated: "IsTypedBy",
6885
6885
  forRelating: "Types"
6886
6886
  }
6887
6887
  ],
6888
6888
  [
6889
- b.IFCRELDEFINESBYTEMPLATE,
6889
+ x.IFCRELDEFINESBYTEMPLATE,
6890
6890
  {
6891
6891
  forRelated: "IsDefinedBy",
6892
6892
  forRelating: "Defines"
6893
6893
  }
6894
6894
  ],
6895
6895
  [
6896
- b.IFCRELCONTAINEDINSPATIALSTRUCTURE,
6896
+ x.IFCRELCONTAINEDINSPATIALSTRUCTURE,
6897
6897
  {
6898
6898
  forRelated: "ContainedInStructure",
6899
6899
  forRelating: "ContainsElements"
@@ -6924,7 +6924,7 @@ const Xr = /* @__PURE__ */ new Map([
6924
6924
  I(this, "relationMaps", {});
6925
6925
  /** {@link Component.enabled} */
6926
6926
  I(this, "enabled", !0);
6927
- I(this, "_relToAttributesMap", Xr);
6927
+ I(this, "_relToAttributesMap", Zr);
6928
6928
  I(this, "_inverseAttributes", [
6929
6929
  "IsDecomposedBy",
6930
6930
  "Decomposes",
@@ -6942,14 +6942,14 @@ const Xr = /* @__PURE__ */ new Map([
6942
6942
  "ContainsElements"
6943
6943
  ]);
6944
6944
  I(this, "_ifcRels", [
6945
- b.IFCRELAGGREGATES,
6946
- b.IFCRELASSOCIATESMATERIAL,
6947
- b.IFCRELASSOCIATESCLASSIFICATION,
6948
- b.IFCRELASSIGNSTOGROUP,
6949
- b.IFCRELDEFINESBYPROPERTIES,
6950
- b.IFCRELDEFINESBYTYPE,
6951
- b.IFCRELDEFINESBYTEMPLATE,
6952
- b.IFCRELCONTAINEDINSPATIALSTRUCTURE
6945
+ x.IFCRELAGGREGATES,
6946
+ x.IFCRELASSOCIATESMATERIAL,
6947
+ x.IFCRELASSOCIATESCLASSIFICATION,
6948
+ x.IFCRELASSIGNSTOGROUP,
6949
+ x.IFCRELDEFINESBYPROPERTIES,
6950
+ x.IFCRELDEFINESBYTYPE,
6951
+ x.IFCRELDEFINESBYTEMPLATE,
6952
+ x.IFCRELCONTAINEDINSPATIALSTRUCTURE
6953
6953
  ]);
6954
6954
  I(this, "onFragmentsDisposed", (t) => {
6955
6955
  delete this.relationMaps[t.groupID];
@@ -6970,8 +6970,8 @@ const Xr = /* @__PURE__ */ new Map([
6970
6970
  const u = t.get(E) ?? /* @__PURE__ */ new Map(), f = this.getAttributeIndex(i);
6971
6971
  if (!f)
6972
6972
  continue;
6973
- const R = u.get(f) ?? [];
6974
- R.push(a), u.set(f, R), t.set(E, u);
6973
+ const T = u.get(f) ?? [];
6974
+ T.push(a), u.set(f, T), t.set(E, u);
6975
6975
  }
6976
6976
  }
6977
6977
  getAttributeIndex(t) {
@@ -7076,7 +7076,7 @@ const Xr = /* @__PURE__ */ new Map([
7076
7076
  `IfcRelationsIndexer: model ${t.uuid} has no relations indexed.`
7077
7077
  );
7078
7078
  const n = o.get(e), r = this.getAttributeIndex(i);
7079
- if (!(n && r))
7079
+ if (n === void 0 || r === null)
7080
7080
  return null;
7081
7081
  const a = n.get(r);
7082
7082
  return a || null;
@@ -7201,7 +7201,7 @@ const Xr = /* @__PURE__ */ new Map([
7201
7201
  * @returns A `Set` with the expressIDs of the found items.
7202
7202
  */
7203
7203
  getEntityChildren(t, e, i = /* @__PURE__ */ new Set()) {
7204
- if (i.add(e), this.relationMaps[t.uuid] === void 0)
7204
+ if (e === 22655 && console.log("Heyyy"), i.add(e), this.relationMaps[t.uuid] === void 0)
7205
7205
  throw new Error(
7206
7206
  "The provided model has no indices. You have to generate them first."
7207
7207
  );
@@ -7253,7 +7253,7 @@ const Ns = class Ns extends et {
7253
7253
  I(this, "baseCoordinationMatrix", new O.Matrix4());
7254
7254
  /** {@link Component.enabled} */
7255
7255
  I(this, "enabled", !0);
7256
- I(this, "_loader", new to());
7256
+ I(this, "_loader", new eo());
7257
7257
  this.components.add(Ns.uuid, this);
7258
7258
  }
7259
7259
  /**
@@ -7822,11 +7822,11 @@ const vn = /* @__PURE__ */ new Set([
7822
7822
  */
7823
7823
  async export(t, e, i = !1, o = !0) {
7824
7824
  const n = {}, r = new Set(t.GetIfcEntityList(e)), a = /* @__PURE__ */ new Set([
7825
- b.IFCPROJECT,
7826
- b.IFCSITE,
7827
- b.IFCBUILDING,
7828
- b.IFCBUILDINGSTOREY,
7829
- b.IFCSPACE
7825
+ x.IFCPROJECT,
7826
+ x.IFCSITE,
7827
+ x.IFCBUILDING,
7828
+ x.IFCBUILDINGSTOREY,
7829
+ x.IFCSPACE
7830
7830
  ]);
7831
7831
  for (const c of a)
7832
7832
  r.add(c);
@@ -7848,7 +7848,7 @@ const vn = /* @__PURE__ */ new Set([
7848
7848
  */
7849
7849
  I(Ps, "uuid", "b32c4332-cd67-436e-ba7f-196646c7a635");
7850
7850
  let mi = Ps;
7851
- const Zr = {
7851
+ const Qr = {
7852
7852
  103090709: "IFCPROJECT",
7853
7853
  4097777520: "IFCSITE",
7854
7854
  4031249490: "IFCBUILDING",
@@ -7987,9 +7987,9 @@ const Zr = {
7987
7987
  4292641817: "IFCUNITARYEQUIPMENT",
7988
7988
  3009204131: "IFCGRID"
7989
7989
  };
7990
- class oa {
7990
+ class ra {
7991
7991
  getAll(s, t) {
7992
- const e = {}, i = Object.keys(Zr).map((o) => parseInt(o, 10));
7992
+ const e = {}, i = Object.keys(Qr).map((o) => parseInt(o, 10));
7993
7993
  for (let o = 0; o < i.length; o++) {
7994
7994
  const n = i[o], r = s.GetLineIDsWithType(t, n), a = r.size();
7995
7995
  for (let c = 0; c < a; c++)
@@ -9143,7 +9143,7 @@ const Bn = {
9143
9143
  class Kt {
9144
9144
  static async getUnits(s) {
9145
9145
  var n, r, a;
9146
- const { IFCUNITASSIGNMENT: t } = b, e = await s.getAllPropertiesOfType(t);
9146
+ const { IFCUNITASSIGNMENT: t } = x, e = await s.getAllPropertiesOfType(t);
9147
9147
  if (!e)
9148
9148
  return 1;
9149
9149
  const i = Object.keys(e), o = e[parseInt(i[0], 10)];
@@ -9183,30 +9183,30 @@ class Kt {
9183
9183
  );
9184
9184
  if (!(d && E && u))
9185
9185
  continue;
9186
- const f = await s.getProperties((a = h[E]) == null ? void 0 : a.value), R = h[u];
9187
- if (!f || !R || !(R && Array.isArray(R)))
9186
+ const f = await s.getProperties((a = h[E]) == null ? void 0 : a.value), T = h[u];
9187
+ if (!f || !T || !(T && Array.isArray(T)))
9188
9188
  continue;
9189
- const m = R.map((C) => C.value);
9190
- await o(f.expressID, m), n[f.expressID] = m;
9189
+ const R = T.map((C) => C.value);
9190
+ await o(f.expressID, R), n[f.expressID] = R;
9191
9191
  }
9192
9192
  return n;
9193
9193
  }
9194
9194
  static async getQsetQuantities(s, t, e) {
9195
9195
  const o = e ?? (() => {
9196
9196
  }), n = await s.getProperties(t);
9197
- return !n || n.type !== b.IFCELEMENTQUANTITY ? null : (n.Quantities ?? [{}]).map((c) => (c.value && o(c.value), c.value)).filter((c) => c !== null);
9197
+ return !n || n.type !== x.IFCELEMENTQUANTITY ? null : (n.Quantities ?? [{}]).map((c) => (c.value && o(c.value), c.value)).filter((c) => c !== null);
9198
9198
  }
9199
9199
  static async getPsetProps(s, t, e) {
9200
9200
  const o = e ?? (() => {
9201
9201
  }), n = await s.getProperties(t);
9202
- return !n || n.type !== b.IFCPROPERTYSET ? null : (n.HasProperties ?? [{}]).map((c) => (c.value && o(c.value), c.value)).filter((c) => c !== null);
9202
+ return !n || n.type !== x.IFCPROPERTYSET ? null : (n.HasProperties ?? [{}]).map((c) => (c.value && o(c.value), c.value)).filter((c) => c !== null);
9203
9203
  }
9204
9204
  static async getPsetRel(s, t) {
9205
9205
  var r;
9206
9206
  if (!await s.getProperties(t))
9207
9207
  return null;
9208
9208
  const i = await s.getAllPropertiesOfType(
9209
- b.IFCRELDEFINESBYPROPERTIES
9209
+ x.IFCRELDEFINESBYPROPERTIES
9210
9210
  );
9211
9211
  if (!i)
9212
9212
  return null;
@@ -9275,7 +9275,7 @@ class Kt {
9275
9275
  // return propertyInstance;
9276
9276
  // }
9277
9277
  }
9278
- class Qr {
9278
+ class jr {
9279
9279
  constructor() {
9280
9280
  I(this, "factor", 1);
9281
9281
  I(this, "complement", 1);
@@ -9297,7 +9297,7 @@ class Qr {
9297
9297
  try {
9298
9298
  const e = s.GetLineIDsWithType(
9299
9299
  0,
9300
- b.IFCUNITASSIGNMENT
9300
+ x.IFCUNITASSIGNMENT
9301
9301
  ).get(0), i = s.GetLine(0, e);
9302
9302
  for (const o of i.Units) {
9303
9303
  if (!o || o.value === null || o.value === void 0)
@@ -9336,7 +9336,7 @@ class Qr {
9336
9336
  class Yn {
9337
9337
  constructor() {
9338
9338
  I(this, "itemsByFloor", {});
9339
- I(this, "_units", new Qr());
9339
+ I(this, "_units", new jr());
9340
9340
  }
9341
9341
  // TODO: Maybe make this more flexible so that it also support more exotic spatial structures?
9342
9342
  setUp(s) {
@@ -9344,19 +9344,19 @@ class Yn {
9344
9344
  try {
9345
9345
  const t = s.GetLineIDsWithType(
9346
9346
  0,
9347
- b.IFCRELCONTAINEDINSPATIALSTRUCTURE
9348
- ), e = /* @__PURE__ */ new Set(), i = s.GetLineIDsWithType(0, b.IFCSPACE);
9347
+ x.IFCRELCONTAINEDINSPATIALSTRUCTURE
9348
+ ), e = /* @__PURE__ */ new Set(), i = s.GetLineIDsWithType(0, x.IFCSPACE);
9349
9349
  for (let c = 0; c < i.size(); c++)
9350
9350
  e.add(i.get(c));
9351
- const o = s.GetLineIDsWithType(0, b.IFCRELAGGREGATES), n = o.size();
9351
+ const o = s.GetLineIDsWithType(0, x.IFCRELAGGREGATES), n = o.size();
9352
9352
  for (let c = 0; c < n; c++) {
9353
9353
  const h = o.get(c), d = s.GetLine(0, h);
9354
9354
  if (!d || !d.RelatingObject || !d.RelatedObjects)
9355
9355
  continue;
9356
9356
  const E = d.RelatingObject.value, u = d.RelatedObjects;
9357
9357
  for (const f of u) {
9358
- const R = f.value;
9359
- e.has(R) && (this.itemsByFloor[R] = E);
9358
+ const T = f.value;
9359
+ e.has(T) && (this.itemsByFloor[T] = E);
9360
9360
  }
9361
9361
  }
9362
9362
  const r = {}, a = t.size();
@@ -9368,13 +9368,13 @@ class Yn {
9368
9368
  if (e.has(E))
9369
9369
  for (const f of u) {
9370
9370
  r[E] || (r[E] = []);
9371
- const R = f.value;
9372
- r[E].push(R);
9371
+ const T = f.value;
9372
+ r[E].push(T);
9373
9373
  }
9374
9374
  else
9375
9375
  for (const f of u) {
9376
- const R = f.value;
9377
- this.itemsByFloor[R] = E;
9376
+ const T = f.value;
9377
+ this.itemsByFloor[T] = E;
9378
9378
  }
9379
9379
  }
9380
9380
  for (const c in r) {
@@ -9391,8 +9391,8 @@ class Yn {
9391
9391
  continue;
9392
9392
  const E = d.RelatingObject.value, u = d.RelatedObjects;
9393
9393
  for (const f of u) {
9394
- const R = f.value, m = this.itemsByFloor[E];
9395
- m !== void 0 && (this.itemsByFloor[R] = m);
9394
+ const T = f.value, R = this.itemsByFloor[E];
9395
+ R !== void 0 && (this.itemsByFloor[T] = R);
9396
9396
  }
9397
9397
  }
9398
9398
  } catch {
@@ -9411,14 +9411,14 @@ class yi {
9411
9411
  * Generate the geometry for categories that are not included by default,
9412
9412
  * like IFCSPACE.
9413
9413
  */
9414
- I(this, "optionalCategories", [b.IFCSPACE]);
9414
+ I(this, "optionalCategories", [x.IFCSPACE]);
9415
9415
  /** Whether to use the coordination data coming from the IFC files. */
9416
9416
  I(this, "coordinate", !0);
9417
9417
  /** Path of the WASM for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
9418
9418
  I(this, "wasm", {
9419
9419
  path: "",
9420
9420
  absolute: !1,
9421
- logLevel: b.LogLevel.LOG_LEVEL_OFF
9421
+ logLevel: x.LogLevel.LOG_LEVEL_OFF
9422
9422
  });
9423
9423
  /** List of categories that won't be converted to fragments. */
9424
9424
  I(this, "excludedCategories", /* @__PURE__ */ new Set());
@@ -9476,13 +9476,13 @@ class Vn {
9476
9476
  const n = {};
9477
9477
  if (o.data)
9478
9478
  for (const E of o.data) {
9479
- const [u, f] = E.split(": "), R = parseFloat(f);
9480
- n[u] = R || f;
9479
+ const [u, f] = E.split(": "), T = parseFloat(f);
9480
+ n[u] = T || f;
9481
9481
  }
9482
9482
  const { points: r } = o, a = new Float32Array(r.length * 3);
9483
9483
  for (let E = 0; E < r.length; E++) {
9484
- const { x: u, y: f, z: R } = r[E];
9485
- a[E * 3] = u, a[E * 3 + 1] = f, a[E * 3 + 2] = R || 0;
9484
+ const { x: u, y: f, z: T } = r[E];
9485
+ a[E * 3] = u, a[E * 3 + 1] = f, a[E * 3 + 2] = T || 0;
9486
9486
  }
9487
9487
  const c = new O.BufferAttribute(a, 3), h = new O.EdgesGeometry();
9488
9488
  h.setAttribute("position", c);
@@ -9501,7 +9501,7 @@ class Vn {
9501
9501
  class Gn {
9502
9502
  getNameInfo(s) {
9503
9503
  var d;
9504
- const t = {}, { arguments: e } = s.GetHeaderLine(0, b.FILE_NAME) || {};
9504
+ const t = {}, { arguments: e } = s.GetHeaderLine(0, x.FILE_NAME) || {};
9505
9505
  if (!e)
9506
9506
  return t;
9507
9507
  const [
@@ -9522,7 +9522,7 @@ class Gn {
9522
9522
  }
9523
9523
  getDescriptionInfo(s) {
9524
9524
  var n;
9525
- const t = {}, { arguments: e } = s.GetHeaderLine(0, b.FILE_DESCRIPTION) || {};
9525
+ const t = {}, { arguments: e } = s.GetHeaderLine(0, x.FILE_DESCRIPTION) || {};
9526
9526
  if (!e)
9527
9527
  return t;
9528
9528
  const [i, o] = e;
@@ -9533,6 +9533,28 @@ class Gn {
9533
9533
  return o != null && o.value && (t.implementationLevel = o.value), t;
9534
9534
  }
9535
9535
  }
9536
+ class zn {
9537
+ static get(s, t) {
9538
+ const e = [
9539
+ x.IFCPROJECT,
9540
+ x.IFCSITE,
9541
+ x.IFCBUILDING,
9542
+ x.IFCBUILDINGSTOREY,
9543
+ x.IFCSPACE,
9544
+ x.IFCROAD,
9545
+ x.IFCFACILITY,
9546
+ x.IFCFACILITYPART,
9547
+ x.IFCBRIDGE
9548
+ ], i = s.data;
9549
+ for (const o of e) {
9550
+ const n = t.GetLineIDsWithType(0, o), r = n.size();
9551
+ for (let a = 0; a < r; a++) {
9552
+ const c = n.get(a);
9553
+ i.has(c) || i.set(c, [[], [0, o]]);
9554
+ }
9555
+ }
9556
+ }
9557
+ }
9536
9558
  const Ge = class Ge extends et {
9537
9559
  constructor(t) {
9538
9560
  super(t);
@@ -9554,7 +9576,7 @@ const Ge = class Ge extends et {
9554
9576
  /**
9555
9577
  * The instance of the Web-IFC library used for handling IFC data.
9556
9578
  */
9557
- I(this, "webIfc", new b.IfcAPI());
9579
+ I(this, "webIfc", new x.IfcAPI());
9558
9580
  /** {@link Component.enabled} */
9559
9581
  I(this, "enabled", !0);
9560
9582
  I(this, "_material", new O.MeshLambertMaterial());
@@ -9567,7 +9589,7 @@ const Ge = class Ge extends et {
9567
9589
  transparent: !0,
9568
9590
  opacity: 0.5
9569
9591
  }));
9570
- this.components.add(Ge.uuid, this), this.settings.excludedCategories.add(b.IFCOPENINGELEMENT);
9592
+ this.components.add(Ge.uuid, this), this.settings.excludedCategories.add(x.IFCOPENINGELEMENT);
9571
9593
  }
9572
9594
  /** {@link Disposable.dispose} */
9573
9595
  dispose() {
@@ -9612,7 +9634,7 @@ const Ge = class Ge extends et {
9612
9634
  const i = performance.now();
9613
9635
  this.onIfcStartedLoading.trigger(), await this.readIfcFile(t);
9614
9636
  const o = await this.getAllGeometries(), r = await this.components.get(mi).export(this.webIfc, 0);
9615
- o.setLocalProperties(r), this.cleanUp();
9637
+ o.setLocalProperties(r);
9616
9638
  const a = this.components.get(ht);
9617
9639
  a.groups.set(o.uuid, o);
9618
9640
  for (const c of o.items)
@@ -9625,7 +9647,7 @@ const Ge = class Ge extends et {
9625
9647
  const d = h.GlobalId.value || h.GlobalId;
9626
9648
  o.globalToExpressIDs.set(d, c);
9627
9649
  }
9628
- return console.log(`Streaming the IFC took ${performance.now() - i} ms!`), o;
9650
+ return zn.get(o, this.webIfc), this.cleanUp(), console.log(`Streaming the IFC took ${performance.now() - i} ms!`), o;
9629
9651
  }
9630
9652
  /**
9631
9653
  * Reads an IFC file and initializes the Web-IFC library.
@@ -9662,7 +9684,7 @@ const Ge = class Ge extends et {
9662
9684
  * ```
9663
9685
  */
9664
9686
  cleanUp() {
9665
- this.webIfc.Dispose(), this.webIfc = null, this.webIfc = new b.IfcAPI(), this._visitedFragments.clear(), this._fragmentInstances.clear();
9687
+ this.webIfc.Dispose(), this.webIfc = null, this.webIfc = new x.IfcAPI(), this._visitedFragments.clear(), this._fragmentInstances.clear();
9666
9688
  }
9667
9689
  async getAllGeometries() {
9668
9690
  this._spatialTree.setUp(this.webIfc);
@@ -9677,7 +9699,7 @@ const Ge = class Ge extends et {
9677
9699
  };
9678
9700
  const i = [];
9679
9701
  for (const n of t) {
9680
- if (!this.webIfc.IsIfcElement(n) && n !== b.IFCSPACE || this.settings.excludedCategories.has(n))
9702
+ if (!this.webIfc.IsIfcElement(n) && n !== x.IFCSPACE || this.settings.excludedCategories.has(n))
9681
9703
  continue;
9682
9704
  const r = this.webIfc.GetLineIDsWithType(0, n), a = r.size();
9683
9705
  for (let c = 0; c < a; c++) {
@@ -9711,13 +9733,13 @@ const Ge = class Ge extends et {
9711
9733
  for (let n = 0; n < i; n++) {
9712
9734
  const r = t.geometries.get(n), { x: a, y: c, z: h, w: d } = r.color, E = d !== 1, { geometryExpressID: u } = r, f = `${u}-${E}`;
9713
9735
  if (!this._visitedFragments.has(f)) {
9714
- const T = this.getGeometry(this.webIfc, u), g = E ? this._materialT : this._material, S = new Vt.Fragment(T, g, 1);
9736
+ const m = this.getGeometry(this.webIfc, u), g = E ? this._materialT : this._material, S = new Vt.Fragment(m, g, 1);
9715
9737
  e.add(S.mesh), e.items.push(S);
9716
9738
  const _ = this._visitedFragments.size;
9717
9739
  this._visitedFragments.set(f, { index: _, fragment: S });
9718
9740
  }
9719
- const R = new O.Color().setRGB(a, c, h, "srgb"), m = new O.Matrix4();
9720
- m.fromArray(r.flatTransformation);
9741
+ const T = new O.Color().setRGB(a, c, h, "srgb"), R = new O.Matrix4();
9742
+ R.fromArray(r.flatTransformation);
9721
9743
  const C = this._visitedFragments.get(f);
9722
9744
  if (C === void 0)
9723
9745
  throw new Error("Error getting geometry data for streaming!");
@@ -9731,12 +9753,12 @@ const Ge = class Ge extends et {
9731
9753
  if (!p)
9732
9754
  throw new Error("Instances not found!");
9733
9755
  if (p.has(o)) {
9734
- const T = p.get(o);
9735
- if (!T)
9756
+ const m = p.get(o);
9757
+ if (!m)
9736
9758
  throw new Error("Instance not found!");
9737
- T.transforms.push(m), T.colors && T.colors.push(R);
9759
+ m.transforms.push(R), m.colors && m.colors.push(T);
9738
9760
  } else
9739
- p.set(o, { id: o, transforms: [m], colors: [R] });
9761
+ p.set(o, { id: o, transforms: [R], colors: [T] });
9740
9762
  }
9741
9763
  }
9742
9764
  getGeometry(t, e) {
@@ -9879,7 +9901,7 @@ const Bt = class Bt extends et {
9879
9901
  * @throws Will throw an error if no OwnerHistory is found in the model.
9880
9902
  */
9881
9903
  async newPset(t, e, i) {
9882
- const o = Bt.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, h = new b[o].IfcPropertySet(
9904
+ const o = Bt.getIFCSchema(t), { ownerHistoryHandle: n } = await this.getOwnerHistory(t), r = this.newGUID(t), a = new x[o].IfcLabel(e), c = i ? new x[o].IfcText(i) : null, h = new x[o].IfcPropertySet(
9883
9905
  r,
9884
9906
  n,
9885
9907
  a,
@@ -9887,13 +9909,13 @@ const Bt = class Bt extends et {
9887
9909
  []
9888
9910
  );
9889
9911
  h.expressID = this.increaseMaxID(t);
9890
- const d = this.newGUID(t), E = new b[o].IfcRelDefinesByProperties(
9912
+ const d = this.newGUID(t), E = new x[o].IfcRelDefinesByProperties(
9891
9913
  d,
9892
9914
  n,
9893
9915
  null,
9894
9916
  null,
9895
9917
  [],
9896
- new b.Handle(h.expressID)
9918
+ new x.Handle(h.expressID)
9897
9919
  );
9898
9920
  return E.expressID = this.increaseMaxID(t), await this.setData(t, h, E), { pset: h, rel: E };
9899
9921
  }
@@ -9912,7 +9934,7 @@ const Bt = class Bt extends et {
9912
9934
  async removePset(t, ...e) {
9913
9935
  for (const i of e) {
9914
9936
  const o = await t.getProperties(i);
9915
- if ((o == null ? void 0 : o.type) !== b.IFCPROPERTYSET)
9937
+ if ((o == null ? void 0 : o.type) !== x.IFCPROPERTYSET)
9916
9938
  continue;
9917
9939
  const n = await Kt.getPsetRel(t, i);
9918
9940
  if (n && (await t.setProperties(n, null), this.registerChange(t, n)), o) {
@@ -9984,7 +10006,7 @@ const Bt = class Bt extends et {
9984
10006
  */
9985
10007
  async removePsetProp(t, e, i) {
9986
10008
  const o = await t.getProperties(e), n = await t.getProperties(i);
9987
- !o || !n || o.type === b.IFCPROPERTYSET && n && (o.HasProperties = o.HasProperties.filter((r) => r.value !== i), await t.setProperties(i, null), this.registerChange(t, e, i));
10009
+ !o || !n || o.type === x.IFCPROPERTYSET && n && (o.HasProperties = o.HasProperties.filter((r) => r.value !== i), await t.setProperties(i, null), this.registerChange(t, e, i));
9988
10010
  }
9989
10011
  async addElementToPset(t, e, ...i) {
9990
10012
  const o = await Kt.getPsetRel(t, e);
@@ -9994,7 +10016,7 @@ const Bt = class Bt extends et {
9994
10016
  if (!n)
9995
10017
  return;
9996
10018
  for (const a of i) {
9997
- const c = new b.Handle(a);
10019
+ const c = new x.Handle(a);
9998
10020
  n.RelatedObjects.push(c), this.onElementToPset.trigger({
9999
10021
  model: t,
10000
10022
  psetID: e,
@@ -10025,7 +10047,7 @@ const Bt = class Bt extends et {
10025
10047
  for (const n of i) {
10026
10048
  if (o.HasProperties.includes(n))
10027
10049
  continue;
10028
- const r = new b.Handle(n);
10050
+ const r = new x.Handle(n);
10029
10051
  o.HasProperties.push(r), this.onPropToPset.trigger({ model: t, psetID: e, propID: n });
10030
10052
  }
10031
10053
  this.registerChange(t, e);
@@ -10104,15 +10126,15 @@ const Bt = class Bt extends et {
10104
10126
  }
10105
10127
  newGUID(t) {
10106
10128
  const e = Bt.getIFCSchema(t);
10107
- return new b[e].IfcGloballyUniqueId(ze.create());
10129
+ return new x[e].IfcGloballyUniqueId(ze.create());
10108
10130
  }
10109
10131
  async getOwnerHistory(t) {
10110
10132
  const e = await t.getAllPropertiesOfType(
10111
- b.IFCOWNERHISTORY
10133
+ x.IFCOWNERHISTORY
10112
10134
  );
10113
10135
  if (!e)
10114
10136
  throw new Error("No OwnerHistory was found.");
10115
- const i = Object.keys(e).map((r) => parseInt(r, 10)), o = e[i[0]], n = new b.Handle(o.expressID);
10137
+ const i = Object.keys(e).map((r) => parseInt(r, 10)), o = e[i[0]], n = new x.Handle(o.expressID);
10116
10138
  return { ownerHistory: o, ownerHistoryHandle: n };
10117
10139
  }
10118
10140
  registerChange(t, ...e) {
@@ -10121,7 +10143,7 @@ const Bt = class Bt extends et {
10121
10143
  this.changeMap[t.uuid].add(i), this.onDataChanged.trigger({ model: t, expressID: i });
10122
10144
  }
10123
10145
  async newSingleProperty(t, e, i, o) {
10124
- const n = Bt.getIFCSchema(t), r = new b[n].IfcIdentifier(i), a = new b[n][e](o), c = new b[n].IfcPropertySingleValue(
10146
+ const n = Bt.getIFCSchema(t), r = new x[n].IfcIdentifier(i), a = new x[n][e](o), c = new x[n].IfcPropertySingleValue(
10125
10147
  r,
10126
10148
  null,
10127
10149
  a,
@@ -10358,7 +10380,9 @@ const ys = class ys extends et {
10358
10380
  * Classifies fragments based on their spatial structure in the IFC model.
10359
10381
  *
10360
10382
  * @param model - The FragmentsGroup containing the fragments to be classified.
10361
- * @param config - The configuration for the classifier. It includes "useProperties" (if false, the classification will use the expressIDs instead of the names)
10383
+ * @param config - The configuration for the classifier. It includes "useProperties", which is true by default
10384
+ * (if false, the classification will use the expressIDs instead of the names), and "isolate", which will make
10385
+ * the classifier just pick the WEBIFC categories provided.
10362
10386
  *
10363
10387
  * @remarks
10364
10388
  * This method iterates through the relations of the fragments in the provided group,
@@ -10368,55 +10392,63 @@ const ys = class ys extends et {
10368
10392
  *
10369
10393
  * @throws Will throw an error if the fragment ID is not found or if the model relations do not exist.
10370
10394
  */
10371
- async bySpatialStructure(t, e = { useProperties: !0 }) {
10372
- var r, a;
10395
+ async bySpatialStructure(t, e = {}) {
10396
+ var c, h;
10373
10397
  const i = this.components.get(pe), o = i.relationMaps[t.uuid];
10374
10398
  if (!o)
10375
10399
  throw new Error(
10376
10400
  `Classifier: model relations of ${t.name || t.uuid} have to exists to group by spatial structure.`
10377
10401
  );
10378
- const n = "spatialStructures";
10379
- for (const [c] of o) {
10380
- const h = i.getEntityRelations(
10402
+ const n = "spatialStructures", a = e.useProperties === void 0 || e.useProperties;
10403
+ for (const [d] of o) {
10404
+ if (e.isolate) {
10405
+ const T = t.data.get(d);
10406
+ if (!T)
10407
+ continue;
10408
+ const R = T[1][1];
10409
+ if (R === void 0 || !e.isolate.has(R))
10410
+ continue;
10411
+ }
10412
+ const E = i.getEntityRelations(
10381
10413
  t,
10382
- c,
10414
+ d,
10383
10415
  "Decomposes"
10384
10416
  );
10385
- if (h)
10386
- for (const u of h) {
10387
- let f = u.toString();
10388
- if (e.useProperties) {
10389
- const R = await t.getProperties(u);
10390
- if (!R)
10417
+ if (E)
10418
+ for (const T of E) {
10419
+ let R = T.toString();
10420
+ if (a) {
10421
+ const C = await t.getProperties(T);
10422
+ if (!C)
10391
10423
  continue;
10392
- f = (r = R.Name) == null ? void 0 : r.value;
10424
+ R = (c = C.Name) == null ? void 0 : c.value;
10393
10425
  }
10394
- this.saveItem(t, n, f, c, u);
10426
+ this.saveItem(t, n, R, d, T);
10395
10427
  }
10396
- const d = i.getEntityRelations(
10428
+ const u = i.getEntityRelations(
10397
10429
  t,
10398
- c,
10430
+ d,
10399
10431
  "ContainsElements"
10400
10432
  );
10401
- if (!d)
10433
+ if (!u)
10402
10434
  continue;
10403
- let E = c.toString();
10404
- if (e.useProperties) {
10405
- const u = await t.getProperties(c);
10406
- if (!u)
10435
+ let f = d.toString();
10436
+ if (a) {
10437
+ const T = await t.getProperties(d);
10438
+ if (!T)
10407
10439
  continue;
10408
- E = (a = u.Name) == null ? void 0 : a.value;
10440
+ f = (h = T.Name) == null ? void 0 : h.value;
10409
10441
  }
10410
- for (const u of d) {
10411
- this.saveItem(t, n, E, u, c);
10412
- const f = i.getEntityRelations(
10442
+ for (const T of u) {
10443
+ this.saveItem(t, n, f, T, d);
10444
+ const R = i.getEntityRelations(
10413
10445
  t,
10414
- Number(u),
10446
+ Number(T),
10415
10447
  "IsDecomposedBy"
10416
10448
  );
10417
- if (f)
10418
- for (const R of f)
10419
- this.saveItem(t, n, E, R, c);
10449
+ if (R)
10450
+ for (const C of R)
10451
+ this.saveItem(t, n, f, C, d);
10420
10452
  }
10421
10453
  }
10422
10454
  }
@@ -10609,7 +10641,7 @@ const Ms = class Ms extends et {
10609
10641
  */
10610
10642
  I(Ms, "uuid", "dd9ccf2d-8a21-4821-b7f6-2949add16a29");
10611
10643
  let Sn = Ms;
10612
- class jr extends yi {
10644
+ class qr extends yi {
10613
10645
  constructor() {
10614
10646
  super(...arguments);
10615
10647
  /**
@@ -10652,13 +10684,13 @@ const ws = class ws extends et {
10652
10684
  /**
10653
10685
  * Settings for the IfcGeometryTiler.
10654
10686
  */
10655
- I(this, "settings", new jr());
10687
+ I(this, "settings", new qr());
10656
10688
  /** {@link Component.enabled} */
10657
10689
  I(this, "enabled", !0);
10658
10690
  /**
10659
10691
  * The WebIFC API instance used for IFC file processing.
10660
10692
  */
10661
- I(this, "webIfc", new b.IfcAPI());
10693
+ I(this, "webIfc", new x.IfcAPI());
10662
10694
  I(this, "_spatialTree", new Yn());
10663
10695
  I(this, "_metaData", new Gn());
10664
10696
  I(this, "_visitedGeometries", /* @__PURE__ */ new Map());
@@ -10669,7 +10701,7 @@ const ws = class ws extends et {
10669
10701
  I(this, "_groupSerializer", new Vt.Serializer());
10670
10702
  I(this, "_assets", []);
10671
10703
  I(this, "_meshesWithHoles", /* @__PURE__ */ new Set());
10672
- this.components.add(ws.uuid, this), this.settings.excludedCategories.add(b.IFCOPENINGELEMENT);
10704
+ this.components.add(ws.uuid, this), this.settings.excludedCategories.add(x.IFCOPENINGELEMENT);
10673
10705
  }
10674
10706
  /** {@link Disposable.dispose} */
10675
10707
  dispose() {
@@ -10729,48 +10761,44 @@ const ws = class ws extends et {
10729
10761
  maxExpressID: this.webIfc.GetMaxExpressID(0)
10730
10762
  };
10731
10763
  let r = 0, a = 0;
10732
- for (const m of i) {
10733
- if (!this.webIfc.IsIfcElement(m) && m !== b.IFCSPACE || this.settings.excludedCategories.has(m))
10764
+ for (const T of i) {
10765
+ if (!this.webIfc.IsIfcElement(T) && T !== x.IFCSPACE || this.settings.excludedCategories.has(T))
10734
10766
  continue;
10735
- const C = this.webIfc.GetLineIDsWithType(0, m), A = C.size();
10736
- for (let F = 0; F < A; F++) {
10767
+ const R = this.webIfc.GetLineIDsWithType(0, T), C = R.size();
10768
+ for (let A = 0; A < C; A++) {
10737
10769
  r > t && (r = 0, a++, o.push([]));
10738
- const p = C.get(F);
10739
- o[a].push(p);
10740
- const T = this.webIfc.GetLine(0, p);
10741
- if (T.GlobalId) {
10742
- const S = (T == null ? void 0 : T.GlobalId.value) || (T == null ? void 0 : T.GlobalId);
10743
- n.globalToExpressIDs.set(S, p);
10770
+ const F = R.get(A);
10771
+ o[a].push(F);
10772
+ const p = this.webIfc.GetLine(0, F);
10773
+ if (p.GlobalId) {
10774
+ const g = (p == null ? void 0 : p.GlobalId.value) || (p == null ? void 0 : p.GlobalId);
10775
+ n.globalToExpressIDs.set(g, F);
10744
10776
  }
10745
- const g = this._spatialTree.itemsByFloor[p] || 0;
10746
- n.data.set(p, [[], [g, m]]), r++;
10777
+ const m = this._spatialTree.itemsByFloor[F] || 0;
10778
+ n.data.set(F, [[], [m, T]]), r++;
10747
10779
  }
10748
10780
  }
10749
10781
  this._spatialTree.cleanUp();
10750
10782
  let c = 0.01, h = 0;
10751
- for (const m of o) {
10752
- h++, this.webIfc.StreamMeshes(0, m, (A) => {
10753
- this.getMesh(this.webIfc, A, n);
10783
+ for (const T of o) {
10784
+ h++, this.webIfc.StreamMeshes(0, T, (C) => {
10785
+ this.getMesh(this.webIfc, C, n);
10754
10786
  }), this._geometryCount > t && await this.streamGeometries(), this._assets.length > e && await this.streamAssets();
10755
- const C = h / o.length;
10756
- C > c && (c += 0.01, c = Math.max(c, C), this.onProgress.trigger(Math.round(c * 100) / 100));
10787
+ const R = h / o.length;
10788
+ R > c && (c += 0.01, c = Math.max(c, R), this.onProgress.trigger(Math.round(c * 100) / 100));
10757
10789
  }
10758
10790
  this._geometryCount && await this.streamGeometries(), this._assets.length && await this.streamAssets();
10759
10791
  const { opaque: d, transparent: E } = n.geometryIDs;
10760
- for (const [m, { index: C, uuid: A }] of this._visitedGeometries)
10761
- n.keyFragments.set(C, A), (m > 1 ? d : E).set(m, C);
10762
- const u = n.data.keys();
10763
- for (const m of u) {
10764
- const [C] = n.data.get(m);
10765
- C.length || n.data.delete(m);
10766
- }
10767
- const f = this.webIfc.GetCoordinationMatrix(0);
10768
- n.coordinationMatrix.fromArray(f), n.civilData = this._civil.read(this.webIfc);
10769
- const R = this._groupSerializer.export(n);
10770
- this.onIfcLoaded.trigger(R), n.dispose(!0);
10792
+ for (const [T, { index: R, uuid: C }] of this._visitedGeometries)
10793
+ n.keyFragments.set(R, C), (T > 1 ? d : E).set(T, R);
10794
+ zn.get(n, this.webIfc);
10795
+ const u = this.webIfc.GetCoordinationMatrix(0);
10796
+ n.coordinationMatrix.fromArray(u), n.civilData = this._civil.read(this.webIfc);
10797
+ const f = this._groupSerializer.export(n);
10798
+ this.onIfcLoaded.trigger(f), n.dispose(!0);
10771
10799
  }
10772
10800
  cleanUp() {
10773
- this.webIfc.Dispose(), this.webIfc = null, this.webIfc = new b.IfcAPI(), this._visitedGeometries.clear(), this._geometries.clear(), this._assets = [], this._meshesWithHoles.clear();
10801
+ this.webIfc.Dispose(), this.webIfc = null, this.webIfc = new x.IfcAPI(), this._visitedGeometries.clear(), this._geometries.clear(), this._assets = [], this._meshesWithHoles.clear();
10774
10802
  }
10775
10803
  getMesh(t, e, i) {
10776
10804
  const o = e.geometries.size(), n = e.expressID, r = { id: n, geometries: [] };
@@ -10778,8 +10806,8 @@ const ws = class ws extends et {
10778
10806
  const c = e.geometries.get(a), h = c.geometryExpressID, d = c.color.w === 1 ? 1 : -1, E = h * d;
10779
10807
  if (!this._visitedGeometries.has(E)) {
10780
10808
  this._visitedGeometries.has(h) || this.getGeometry(t, h);
10781
- const T = this._visitedGeometries.size, g = O.MathUtils.generateUUID();
10782
- this._visitedGeometries.set(E, { uuid: g, index: T });
10809
+ const m = this._visitedGeometries.size, g = O.MathUtils.generateUUID();
10810
+ this._visitedGeometries.set(E, { uuid: g, index: m });
10783
10811
  }
10784
10812
  const u = this._visitedGeometries.get(E);
10785
10813
  if (u === void 0)
@@ -10788,7 +10816,7 @@ const ws = class ws extends et {
10788
10816
  if (!f)
10789
10817
  throw new Error("Data not found!");
10790
10818
  f[0].push(u.index);
10791
- const { x: R, y: m, z: C, w: A } = c.color, F = [R, m, C, A], p = c.flatTransformation;
10819
+ const { x: T, y: R, z: C, w: A } = c.color, F = [T, R, C, A], p = c.flatTransformation;
10792
10820
  r.geometries.push({ color: F, geometryID: h, transformation: p });
10793
10821
  }
10794
10822
  this._assets.push(r);
@@ -10803,11 +10831,11 @@ const ws = class ws extends et {
10803
10831
  ), r = new Float32Array(n.length / 2), a = new Float32Array(n.length / 2);
10804
10832
  for (let u = 0; u < n.length; u += 6)
10805
10833
  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];
10806
- const c = Tr(r), h = new Float32Array(c.transformation.elements), d = [c.center.x, c.center.y, c.center.z];
10834
+ const c = mr(r), h = new Float32Array(c.transformation.elements), d = [c.center.x, c.center.y, c.center.z];
10807
10835
  let E = !1;
10808
10836
  for (let u = 0; u < r.length - 2; u += 3) {
10809
- const f = r[u], R = r[u + 1], m = r[u + 2], C = a[u], A = a[u + 1], F = a[u + 2];
10810
- if (mr(d, [f, R, m], [C, A, F])) {
10837
+ const f = r[u], T = r[u + 1], R = r[u + 2], C = a[u], A = a[u + 1], F = a[u + 2];
10838
+ if (Rr(d, [f, T, R], [C, A, F])) {
10811
10839
  E = !0;
10812
10840
  break;
10813
10841
  }
@@ -10836,7 +10864,7 @@ const ws = class ws extends et {
10836
10864
  */
10837
10865
  I(ws, "uuid", "d9999a00-e1f5-4d3f-8cfe-c56e08609764");
10838
10866
  let _n = ws;
10839
- class qr extends yi {
10867
+ class Kr extends yi {
10840
10868
  constructor() {
10841
10869
  super(...arguments);
10842
10870
  /**
@@ -10846,7 +10874,7 @@ class qr extends yi {
10846
10874
  I(this, "propertiesSize", 100);
10847
10875
  }
10848
10876
  }
10849
- class Kr extends et {
10877
+ class $r extends et {
10850
10878
  constructor() {
10851
10879
  super(...arguments);
10852
10880
  /**
@@ -10871,11 +10899,11 @@ class Kr extends et {
10871
10899
  /**
10872
10900
  * An instance of the PropertiesStreamingSettings class, which holds the settings for the streaming process.
10873
10901
  */
10874
- I(this, "settings", new qr());
10902
+ I(this, "settings", new Kr());
10875
10903
  /**
10876
10904
  * An instance of the IfcAPI class from the Web-IFC library, which provides methods for reading and processing IFC data.
10877
10905
  */
10878
- I(this, "webIfc", new b.IfcAPI());
10906
+ I(this, "webIfc", new x.IfcAPI());
10879
10907
  }
10880
10908
  /** {@link Disposable.dispose} */
10881
10909
  async dispose() {
@@ -10909,11 +10937,11 @@ class Kr extends et {
10909
10937
  }
10910
10938
  async streamAllProperties() {
10911
10939
  const { propertiesSize: t } = this.settings, e = new Set(this.webIfc.GetIfcEntityList(0)), i = /* @__PURE__ */ new Set([
10912
- b.IFCPROJECT,
10913
- b.IFCSITE,
10914
- b.IFCBUILDING,
10915
- b.IFCBUILDINGSTOREY,
10916
- b.IFCSPACE
10940
+ x.IFCPROJECT,
10941
+ x.IFCSITE,
10942
+ x.IFCBUILDING,
10943
+ x.IFCBUILDINGSTOREY,
10944
+ x.IFCSPACE
10917
10945
  ]);
10918
10946
  for (const c of i)
10919
10947
  e.add(c);
@@ -10923,32 +10951,32 @@ class Kr extends et {
10923
10951
  continue;
10924
10952
  const h = i.has(c), d = this.webIfc.GetLineIDsWithType(0, c), E = d.size();
10925
10953
  let u = 0;
10926
- for (let R = 0; R < E - t; R += t) {
10927
- const m = {};
10954
+ for (let T = 0; T < E - t; T += t) {
10955
+ const R = {};
10928
10956
  for (let C = 0; C < t; C++) {
10929
10957
  u++;
10930
- const A = d.get(R + C);
10958
+ const A = d.get(T + C);
10931
10959
  try {
10932
10960
  const F = this.webIfc.GetLine(0, A, h);
10933
- m[F.expressID] = F;
10961
+ R[F.expressID] = F;
10934
10962
  } catch {
10935
10963
  console.log(`Could not get property: ${A}`);
10936
10964
  }
10937
10965
  }
10938
- await this.onPropertiesStreamed.trigger({ type: c, data: m });
10966
+ await this.onPropertiesStreamed.trigger({ type: c, data: R });
10939
10967
  }
10940
10968
  if (u !== E) {
10941
- const R = {};
10942
- for (let m = u; m < E; m++) {
10943
- const C = d.get(m);
10969
+ const T = {};
10970
+ for (let R = u; R < E; R++) {
10971
+ const C = d.get(R);
10944
10972
  try {
10945
10973
  const A = this.webIfc.GetLine(0, C, h);
10946
- R[A.expressID] = A;
10974
+ T[A.expressID] = A;
10947
10975
  } catch {
10948
10976
  console.log(`Could not get property: ${C}`);
10949
10977
  }
10950
10978
  }
10951
- await this.onPropertiesStreamed.trigger({ type: c, data: R });
10979
+ await this.onPropertiesStreamed.trigger({ type: c, data: T });
10952
10980
  }
10953
10981
  n / e.size > o && (o = Math.round(o * 100) / 100, await this.onProgress.trigger(o), o += 0.01);
10954
10982
  }
@@ -10957,14 +10985,14 @@ class Kr extends et {
10957
10985
  await this.onIndicesStreamed.trigger(a);
10958
10986
  }
10959
10987
  cleanUp() {
10960
- this.webIfc.Dispose(), this.webIfc = null, this.webIfc = new b.IfcAPI();
10988
+ this.webIfc.Dispose(), this.webIfc = null, this.webIfc = new x.IfcAPI();
10961
10989
  }
10962
10990
  }
10963
10991
  /**
10964
10992
  * A unique identifier for the component.
10965
10993
  * This UUID is used to register the component within the Components system.
10966
10994
  */
10967
- I(Kr, "uuid", "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b");
10995
+ I($r, "uuid", "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b");
10968
10996
  const Ds = class Ds extends et {
10969
10997
  constructor(t) {
10970
10998
  super(t);
@@ -11006,63 +11034,63 @@ const Ds = class Ds extends et {
11006
11034
  const { plane: u, edges: f } = this.getFaceData(E, i, t);
11007
11035
  if (u.equals(r)) {
11008
11036
  a.push({ index: E, edges: f });
11009
- for (const { id: R, points: m, distance: C } of f)
11010
- o.set(R, { points: m, distance: C });
11037
+ for (const { id: T, points: R, distance: C } of f)
11038
+ o.set(T, { points: R, distance: C });
11011
11039
  }
11012
11040
  }
11013
11041
  let c = 0;
11014
11042
  const h = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map();
11015
11043
  for (const { index: E, edges: u } of a) {
11016
11044
  const f = /* @__PURE__ */ new Map();
11017
- for (const { id: T } of u)
11018
- if (h.has(T)) {
11019
- const g = h.get(T);
11020
- f.set(T, g);
11045
+ for (const { id: m } of u)
11046
+ if (h.has(m)) {
11047
+ const g = h.get(m);
11048
+ f.set(m, g);
11021
11049
  }
11022
- const R = u.map((T) => T.id);
11050
+ const T = u.map((m) => m.id);
11023
11051
  if (!f.size) {
11024
- const T = c++;
11052
+ const m = c++;
11025
11053
  for (const { id: g } of u)
11026
- h.set(g, T);
11027
- d.set(T, {
11028
- edges: new Set(R),
11054
+ h.set(g, m);
11055
+ d.set(m, {
11056
+ edges: new Set(T),
11029
11057
  indices: /* @__PURE__ */ new Set([E])
11030
11058
  });
11031
11059
  continue;
11032
11060
  }
11033
- let m = null;
11034
- const C = /* @__PURE__ */ new Set(), A = new Set(R);
11035
- for (const [T, g] of f) {
11036
- m === null ? m = g : g !== m && C.add(g), h.delete(T);
11061
+ let R = null;
11062
+ const C = /* @__PURE__ */ new Set(), A = new Set(T);
11063
+ for (const [m, g] of f) {
11064
+ R === null ? R = g : g !== R && C.add(g), h.delete(m);
11037
11065
  const { edges: S } = d.get(g);
11038
- S.delete(T), A.delete(T);
11066
+ S.delete(m), A.delete(m);
11039
11067
  }
11040
- if (m === null)
11068
+ if (R === null)
11041
11069
  throw new Error("Error computing face!");
11042
- const F = d.get(m), { indices: p } = F;
11070
+ const F = d.get(R), { indices: p } = F;
11043
11071
  p.add(E);
11044
- for (const T of A) {
11045
- h.set(T, m);
11072
+ for (const m of A) {
11073
+ h.set(m, R);
11046
11074
  const { edges: g } = F;
11047
- g.add(T);
11075
+ g.add(m);
11048
11076
  }
11049
- for (const T of C) {
11050
- const g = d.get(T), { edges: S, indices: _ } = g, N = d.get(m), { edges: y, indices: w } = N;
11077
+ for (const m of C) {
11078
+ const g = d.get(m), { edges: S, indices: _ } = g, N = d.get(R), { edges: y, indices: w } = N;
11051
11079
  for (const L of S)
11052
- y.add(L), h.set(L, m);
11080
+ y.add(L), h.set(L, R);
11053
11081
  for (const L of _)
11054
11082
  w.add(L);
11055
- d.delete(T);
11083
+ d.delete(m);
11056
11084
  }
11057
11085
  }
11058
11086
  for (const [E, { indices: u, edges: f }] of d)
11059
11087
  if (u.has(e)) {
11060
- const R = [];
11061
- for (const m of f) {
11062
- const C = o.get(m);
11063
- R.push(C);
11088
+ const T = [];
11089
+ for (const R of f) {
11090
+ const C = o.get(R);
11091
+ T.push(C);
11064
11092
  }
11065
- return { edges: R, indices: u };
11093
+ return { edges: T, indices: u };
11066
11094
  }
11067
11095
  return null;
11068
11096
  }
@@ -11079,12 +11107,12 @@ const Ds = class Ds extends et {
11079
11107
  getVerticesAndNormal(t, e, i) {
11080
11108
  if (!t.geometry.index)
11081
11109
  throw new Error("Geometry must be indexed!");
11082
- const o = t.geometry.index.array, n = t.geometry.attributes.position.array, r = t.geometry.attributes.normal.array, a = o[e * 3] * 3, c = o[e * 3 + 1] * 3, h = o[e * 3 + 2] * 3, d = new O.Vector3(n[a], n[a + 1], n[a + 2]), E = new O.Vector3(n[c], n[c + 1], n[c + 2]), u = new O.Vector3(n[h], n[h + 1], n[h + 2]), f = new O.Vector3(r[a], r[a + 1], r[a + 2]), R = new O.Vector3(r[c], r[c + 1], r[c + 2]), m = new O.Vector3(r[h], r[h + 1], r[h + 2]), C = (f.x + R.x + m.x) / 3, A = (f.y + R.y + m.y) / 3, F = (f.z + R.z + m.z) / 3, p = new O.Vector3(C, A, F);
11110
+ const o = t.geometry.index.array, n = t.geometry.attributes.position.array, r = t.geometry.attributes.normal.array, a = o[e * 3] * 3, c = o[e * 3 + 1] * 3, h = o[e * 3 + 2] * 3, d = new O.Vector3(n[a], n[a + 1], n[a + 2]), E = new O.Vector3(n[c], n[c + 1], n[c + 2]), u = new O.Vector3(n[h], n[h + 1], n[h + 2]), f = new O.Vector3(r[a], r[a + 1], r[a + 2]), T = new O.Vector3(r[c], r[c + 1], r[c + 2]), R = new O.Vector3(r[h], r[h + 1], r[h + 2]), C = (f.x + T.x + R.x) / 3, A = (f.y + T.y + R.y) / 3, F = (f.z + T.z + R.z) / 3, p = new O.Vector3(C, A, F);
11083
11111
  if (i !== void 0 && t instanceof O.InstancedMesh) {
11084
- const T = new O.Matrix4();
11085
- t.getMatrixAt(i, T);
11112
+ const m = new O.Matrix4();
11113
+ t.getMatrixAt(i, m);
11086
11114
  const g = new O.Matrix4();
11087
- g.extractRotation(T), p.applyMatrix4(g), d.applyMatrix4(T), E.applyMatrix4(T), u.applyMatrix4(T);
11115
+ g.extractRotation(m), p.applyMatrix4(g), d.applyMatrix4(m), E.applyMatrix4(m), u.applyMatrix4(m);
11088
11116
  }
11089
11117
  return { p1: d, p2: E, p3: u, faceNormal: p };
11090
11118
  }
@@ -11132,8 +11160,8 @@ const Ds = class Ds extends et {
11132
11160
  for (const u of c) {
11133
11161
  const f = a.getInstancesIDs(u);
11134
11162
  if (f)
11135
- for (const R of f)
11136
- a.mesh.getMatrixAt(R, i), d.setMatrixAt(E++, i);
11163
+ for (const T of f)
11164
+ a.mesh.getMatrixAt(T, i), d.setMatrixAt(E++, i);
11137
11165
  }
11138
11166
  o.push(d);
11139
11167
  }
@@ -11171,7 +11199,7 @@ const Ds = class Ds extends et {
11171
11199
  const [
11172
11200
  { id: d, value: E },
11173
11201
  { id: u, value: f },
11174
- { id: R, value: m }
11202
+ { id: T, value: R }
11175
11203
  ] = h, C = [
11176
11204
  {
11177
11205
  id: `${d}|${u}`,
@@ -11179,14 +11207,14 @@ const Ds = class Ds extends et {
11179
11207
  points: [E, f]
11180
11208
  },
11181
11209
  {
11182
- id: `${u}|${R}`,
11183
- distance: f.distanceTo(m),
11184
- points: [f, m]
11210
+ id: `${u}|${T}`,
11211
+ distance: f.distanceTo(R),
11212
+ points: [f, R]
11185
11213
  },
11186
11214
  {
11187
- id: `${d}|${R}`,
11188
- distance: E.distanceTo(m),
11189
- points: [E, m]
11215
+ id: `${d}|${T}`,
11216
+ distance: E.distanceTo(R),
11217
+ points: [E, R]
11190
11218
  }
11191
11219
  ], A = new O.Plane();
11192
11220
  return A.setFromNormalAndCoplanarPoint(c, n), A.constant = Math.round(A.constant * 10) / 10, { plane: A, edges: C };
@@ -11208,8 +11236,8 @@ const Ds = class Ds extends et {
11208
11236
  const { matrixWorld: h } = t;
11209
11237
  for (let d = 0; d < r.array.length - 2; d += 3)
11210
11238
  for (const E of c) {
11211
- const u = E.multiply(h), f = r.array[d] * 3, R = r.array[d + 1] * 3, m = r.array[d + 2] * 3;
11212
- i.set(a[f], a[f + 1], a[f + 2]).applyMatrix4(u), o.set(a[R], a[R + 1], a[R + 2]).applyMatrix4(u), n.set(a[m], a[m + 1], a[m + 2]).applyMatrix4(u), e += this.getSignedVolumeOfTriangle(i, o, n);
11239
+ const u = E.multiply(h), f = r.array[d] * 3, T = r.array[d + 1] * 3, R = r.array[d + 2] * 3;
11240
+ i.set(a[f], a[f + 1], a[f + 2]).applyMatrix4(u), o.set(a[T], a[T + 1], a[T + 2]).applyMatrix4(u), n.set(a[R], a[R + 1], a[R + 2]).applyMatrix4(u), e += this.getSignedVolumeOfTriangle(i, o, n);
11213
11241
  }
11214
11242
  return Math.abs(e);
11215
11243
  }
@@ -11227,60 +11255,60 @@ let Nn = Ds;
11227
11255
  export {
11228
11256
  Ts as AsyncEvent,
11229
11257
  _i as Base,
11230
- ar as BaseCamera,
11231
- cr as BaseRenderer,
11232
- lr as BaseScene,
11258
+ cr as BaseCamera,
11259
+ lr as BaseRenderer,
11260
+ hr as BaseScene,
11233
11261
  Ni as BaseWorldItem,
11234
11262
  Fn as BoundingBoxer,
11235
11263
  Ai as Classifier,
11236
11264
  Rn as Clipper,
11237
11265
  et as Component,
11238
11266
  pi as Components,
11239
- Yr as CullerRenderer,
11267
+ Vr as CullerRenderer,
11240
11268
  Ti as Cullers,
11241
11269
  zt as Disposer,
11242
11270
  D as Event,
11243
11271
  On as Exploder,
11244
- zr as FirstPersonMode,
11272
+ Hr as FirstPersonMode,
11245
11273
  ht as FragmentsManager,
11246
11274
  vn as GeometryTypes,
11247
11275
  dn as Grids,
11248
11276
  Sn as Hider,
11249
- oa as IfcCategories,
11277
+ ra as IfcCategories,
11250
11278
  Bn as IfcCategoryMap,
11251
- Zr as IfcElements,
11279
+ Qr as IfcElements,
11252
11280
  yi as IfcFragmentSettings,
11253
11281
  _n as IfcGeometryTiler,
11254
11282
  mi as IfcJsonExporter,
11255
11283
  Ri as IfcLoader,
11256
11284
  gn as IfcPropertiesManager,
11257
- Kr as IfcPropertiesTiler,
11285
+ $r as IfcPropertiesTiler,
11258
11286
  Kt as IfcPropertiesUtils,
11259
11287
  pe as IfcRelationsIndexer,
11260
- jr as IfcStreamingSettings,
11288
+ qr as IfcStreamingSettings,
11261
11289
  sn as MaterialsUtils,
11262
11290
  Nn as MeasurementUtils,
11263
- Vr as MeshCullerRenderer,
11264
- Gr as MiniMap,
11291
+ Gr as MeshCullerRenderer,
11292
+ zr as MiniMap,
11265
11293
  An as MiniMaps,
11266
- Rr as Mouse,
11267
- Hr as OrbitMode,
11268
- na as OrthoPerspectiveCamera,
11294
+ Ar as Mouse,
11295
+ Wr as OrbitMode,
11296
+ oa as OrthoPerspectiveCamera,
11269
11297
  kr as PlanMode,
11270
- Wr as ProjectionManager,
11271
- qr as PropertiesStreamingSettings,
11298
+ Xr as ProjectionManager,
11299
+ Kr as PropertiesStreamingSettings,
11272
11300
  He as Raycasters,
11273
- ke as SimpleCamera,
11274
- Nr as SimpleGrid,
11301
+ We as SimpleCamera,
11302
+ Pr as SimpleGrid,
11275
11303
  Pi as SimplePlane,
11276
- Ar as SimpleRaycaster,
11277
- ia as SimpleRenderer,
11278
- sa as SimpleScene,
11279
- Fr as SimpleWorld,
11304
+ Fr as SimpleRaycaster,
11305
+ na as SimpleRenderer,
11306
+ ia as SimpleScene,
11307
+ gr as SimpleWorld,
11280
11308
  ze as UUID,
11281
- ea as VertexPicker,
11309
+ sa as VertexPicker,
11282
11310
  Ci as Worlds,
11283
- mr as isPointInFrontOfPlane,
11284
- Tr as obbFromPoints,
11285
- Br as readPixelsAsync
11311
+ Rr as isPointInFrontOfPlane,
11312
+ mr as obbFromPoints,
11313
+ Yr as readPixelsAsync
11286
11314
  };