@thatopen/components 2.0.6 → 2.0.9

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
@@ -92,17 +92,17 @@ 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, p = -1 / 0, A = -1 / 0, R = -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, p = -1 / 0, A = -1 / 0, m = -1 / 0;
96
96
  const C = i !== null;
97
- for (let T = s * 6, F = (s + t) * 6; T < F; T += 6) {
98
- const f = l[T + 0], m = l[T + 1], O = f - m, S = f + m;
97
+ for (let R = s * 6, F = (s + t) * 6; R < F; R += 6) {
98
+ const f = l[R + 0], T = l[R + 1], O = f - T, S = f + T;
99
99
  O < o && (o = O), S > a && (a = S), C && f < d && (d = f), C && f > p && (p = f);
100
- const _ = l[T + 2], N = l[T + 3], L = _ - N, M = _ + N;
100
+ const _ = l[R + 2], N = l[R + 3], L = _ - N, M = _ + N;
101
101
  L < n && (n = L), M > c && (c = M), C && _ < E && (E = _), C && _ > A && (A = _);
102
- const y = l[T + 4], x = l[T + 5], b = y - x, B = y + x;
103
- b < r && (r = b), B > h && (h = B), C && y < u && (u = y), C && y > R && (R = y);
102
+ const y = l[R + 4], x = l[R + 5], b = y - x, B = y + x;
103
+ b < r && (r = b), B > h && (h = B), C && y < u && (u = y), C && y > m && (m = y);
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] = p, i[4] = A, i[5] = R);
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] = p, i[4] = A, i[5] = m);
106
106
  }
107
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;
@@ -124,17 +124,17 @@ function Eo(l, s) {
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 p = E + 0, A = E + 1, R = E + 2;
128
- e && (p = e[p], A = e[A], R = e[R]), n || (p = p * c + a, A = A * c + a, R = R * c + a);
127
+ let p = E + 0, A = E + 1, m = E + 2;
128
+ e && (p = e[p], A = e[A], m = e[m]), n || (p = p * c + a, A = A * c + a, m = m * c + a);
129
129
  for (let C = 0; C < 3; C++) {
130
- let T, F, f;
131
- n ? (T = t[h[C]](p), F = t[h[C]](A), f = t[h[C]](R)) : (T = r[p + C], F = r[A + C], f = r[R + C]);
132
- let m = T;
133
- F < m && (m = F), f < m && (m = f);
134
- let O = T;
130
+ let R, F, f;
131
+ n ? (R = t[h[C]](p), F = t[h[C]](A), f = t[h[C]](m)) : (R = r[p + C], F = r[A + C], f = r[m + C]);
132
+ let T = R;
133
+ F < T && (T = F), f < T && (T = f);
134
+ let O = R;
135
135
  F > O && (O = F), f > O && (O = f);
136
- const S = (O - 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), O > s[C + 3] && (s[C + 3] = O);
136
+ const S = (O - T) / 2, _ = C * 2;
137
+ o[u + _ + 0] = T + S, o[u + _ + 1] = S + (Math.abs(T) + S) * no, T < s[C] && (s[C] = T), O > s[C + 3] && (s[C + 3] = O);
138
138
  }
139
139
  }
140
140
  return o;
@@ -157,19 +157,19 @@ function Io(l, s, t, e, i, o) {
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], R = (s[E + 3] - u) / wt;
160
+ const u = s[E], m = (s[E + 3] - u) / wt;
161
161
  if (i < wt / 4) {
162
162
  const C = [...Ut];
163
163
  C.length = i;
164
- let T = 0;
165
- for (let f = h; f < d; f += 6, T++) {
166
- const m = C[T];
167
- m.candidate = t[f + 2 * E], m.count = 0;
164
+ let R = 0;
165
+ for (let f = h; f < d; f += 6, R++) {
166
+ const T = C[R];
167
+ T.candidate = t[f + 2 * E], T.count = 0;
168
168
  const {
169
169
  bounds: O,
170
170
  leftCacheBounds: S,
171
171
  rightCacheBounds: _
172
- } = m;
172
+ } = T;
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, O[N] = 1 / 0, O[N + 3] = -1 / 0;
175
175
  je(f, t, O);
@@ -177,36 +177,36 @@ function Io(l, s, t, e, i, o) {
177
177
  C.sort(uo);
178
178
  let F = i;
179
179
  for (let f = 0; f < F; f++) {
180
- const m = C[f];
181
- for (; f + 1 < F && C[f + 1].candidate === m.candidate; )
180
+ const T = C[f];
181
+ for (; f + 1 < F && C[f + 1].candidate === T.candidate; )
182
182
  C.splice(f + 1, 1), F--;
183
183
  }
184
184
  for (let f = h; f < d; f += 6) {
185
- const m = t[f + 2 * E];
185
+ const T = t[f + 2 * E];
186
186
  for (let O = 0; O < F; O++) {
187
187
  const S = C[O];
188
- m >= S.candidate ? je(f, t, S.rightCacheBounds) : (je(f, t, S.leftCacheBounds), S.count++);
188
+ T >= S.candidate ? je(f, t, S.rightCacheBounds) : (je(f, t, S.leftCacheBounds), S.count++);
189
189
  }
190
190
  }
191
191
  for (let f = 0; f < F; f++) {
192
- const m = C[f], O = m.count, S = i - m.count, _ = m.leftCacheBounds, N = m.rightCacheBounds;
192
+ const T = C[f], O = T.count, S = i - T.count, _ = T.leftCacheBounds, N = T.rightCacheBounds;
193
193
  let L = 0;
194
194
  O !== 0 && (L = Ae(_) / a);
195
195
  let M = 0;
196
196
  S !== 0 && (M = Ae(N) / a);
197
197
  const y = vi + Ys * (L * O + M * S);
198
- y < c && (n = E, c = y, r = m.candidate);
198
+ y < c && (n = E, c = y, r = T.candidate);
199
199
  }
200
200
  } else {
201
201
  for (let F = 0; F < wt; F++) {
202
202
  const f = Ut[F];
203
- f.count = 0, f.candidate = u + R + F * R;
204
- const m = f.bounds;
203
+ f.count = 0, f.candidate = u + m + F * m;
204
+ const T = f.bounds;
205
205
  for (let O = 0; O < 3; O++)
206
- m[O] = 1 / 0, m[O + 3] = -1 / 0;
206
+ T[O] = 1 / 0, T[O + 3] = -1 / 0;
207
207
  }
208
208
  for (let F = h; F < d; F += 6) {
209
- let O = ~~((t[F + 2 * E] - u) / R);
209
+ let O = ~~((t[F + 2 * E] - u) / m);
210
210
  O >= wt && (O = wt - 1);
211
211
  const S = Ut[O];
212
212
  S.count++, je(F, t, S.bounds);
@@ -214,18 +214,18 @@ function Io(l, s, t, e, i, o) {
214
214
  const C = Ut[wt - 1];
215
215
  Yi(C.bounds, C.rightCacheBounds);
216
216
  for (let F = wt - 2; F >= 0; F--) {
217
- const f = Ut[F], m = Ut[F + 1];
218
- Vi(f.bounds, m.rightCacheBounds, f.rightCacheBounds);
217
+ const f = Ut[F], T = Ut[F + 1];
218
+ Vi(f.bounds, T.rightCacheBounds, f.rightCacheBounds);
219
219
  }
220
- let T = 0;
220
+ let R = 0;
221
221
  for (let F = 0; F < wt - 1; F++) {
222
- const f = Ut[F], m = f.count, O = f.bounds, _ = Ut[F + 1].rightCacheBounds;
223
- m !== 0 && (T === 0 ? Yi(O, qe) : Vi(O, qe, qe)), T += m;
222
+ const f = Ut[F], T = f.count, O = f.bounds, _ = Ut[F + 1].rightCacheBounds;
223
+ T !== 0 && (R === 0 ? Yi(O, qe) : Vi(O, qe, qe)), R += T;
224
224
  let N = 0, L = 0;
225
- T !== 0 && (N = Ae(qe) / a);
226
- const M = i - T;
225
+ R !== 0 && (N = Ae(qe) / a);
226
+ const M = i - R;
227
227
  M !== 0 && (L = Ae(_) / a);
228
- const y = vi + Ys * (N * T + L * M);
228
+ const y = vi + Ys * (N * R + L * M);
229
229
  y < c && (n = E, c = y, r = f.candidate);
230
230
  }
231
231
  }
@@ -295,31 +295,31 @@ function To(l, s) {
295
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), p = Eo(t, E), A = s.indirect ? Co : po, R = [], C = s.indirect ? Dn(t) : Un(t);
298
+ const E = new Float32Array(6), u = new Float32Array(6), p = Eo(t, E), A = s.indirect ? Co : po, m = [], C = s.indirect ? Dn(t) : Un(t);
299
299
  if (C.length === 1) {
300
- const f = C[0], m = new $e();
301
- m.boundingData = E, ho(p, f.offset, f.count, u), F(m, f.offset, f.count, u), R.push(m);
300
+ const f = C[0], T = new $e();
301
+ T.boundingData = E, ho(p, f.offset, f.count, u), F(T, f.offset, f.count, u), m.push(T);
302
302
  } else
303
303
  for (let f of C) {
304
- const m = new $e();
305
- m.boundingData = new Float32Array(6), Gs(p, f.offset, f.count, m.boundingData, u), F(m, f.offset, f.count, u), R.push(m);
304
+ const T = new $e();
305
+ T.boundingData = new Float32Array(6), Gs(p, f.offset, f.count, T.boundingData, u), F(T, f.offset, f.count, u), m.push(T);
306
306
  }
307
- return R;
308
- function T(f) {
307
+ return m;
308
+ function R(f) {
309
309
  a && a(f / c);
310
310
  }
311
- function F(f, m, O, S = null, _ = 0) {
311
+ function F(f, T, O, 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))), O <= n || _ >= i)
313
- return T(m + O), f.offset = m, f.count = O, f;
314
- const N = Io(f.boundingData, S, p, m, O, r);
313
+ return R(T + O), f.offset = T, f.count = O, f;
314
+ const N = Io(f.boundingData, S, p, T, O, r);
315
315
  if (N.axis === -1)
316
- return T(m + O), f.offset = m, f.count = O, f;
317
- const L = A(h, e, p, m, O, N);
318
- if (L === m || L === m + O)
319
- T(m + O), f.offset = m, f.count = O;
316
+ return R(T + O), f.offset = T, f.count = O, f;
317
+ const L = A(h, e, p, T, O, N);
318
+ if (L === T || L === T + O)
319
+ R(T + O), f.offset = T, f.count = O;
320
320
  else {
321
321
  f.splitAxis = N.axis;
322
- const M = new $e(), y = m, x = L - m;
322
+ const M = new $e(), y = T, x = L - T;
323
323
  f.left = M, M.boundingData = new Float32Array(6), Gs(p, y, x, M.boundingData, u), F(M, y, x, u, _ + 1);
324
324
  const b = new $e(), B = L, H = O - x;
325
325
  f.right = b, b.boundingData = new Float32Array(6), Gs(p, B, H, b.boundingData, u), F(b, B, H, u, _ + 1);
@@ -347,18 +347,18 @@ function Ro(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, p = d / 2, A = !!E.count, R = E.boundingData;
350
+ const u = d / 4, p = d / 2, A = !!E.count, m = E.boundingData;
351
351
  for (let C = 0; C < 6; C++)
352
- i[u + C] = R[C];
352
+ i[u + C] = m[C];
353
353
  if (A) {
354
- const C = E.offset, T = E.count;
355
- return o[u + 6] = C, n[p + 14] = T, n[p + 15] = Us, d + Ts;
354
+ const C = E.offset, R = E.count;
355
+ return o[u + 6] = C, n[p + 14] = R, n[p + 15] = Us, d + Ts;
356
356
  } else {
357
- const C = E.left, T = E.right, F = E.splitAxis;
357
+ const C = E.left, R = E.right, F = E.splitAxis;
358
358
  let f;
359
359
  if (f = h(d + Ts, C), f / 4 > Math.pow(2, 32))
360
360
  throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");
361
- return o[u + 6] = f / 4, f = h(f, T), o[u + 7] = F, f;
361
+ return o[u + 6] = f / 4, f = h(f, R), o[u + 7] = F, f;
362
362
  }
363
363
  }
364
364
  }
@@ -406,9 +406,9 @@ const Ao = function() {
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), p = t.dot(a), R = a.dot(a) * u - E * E;
410
- let C, T;
411
- R !== 0 ? C = (d * E - p * u) / R : C = 0, T = (d + C * E) / u, n.x = C, n.y = T;
409
+ const d = t.dot(h), E = h.dot(a), u = h.dot(h), p = t.dot(a), m = a.dot(a) * u - E * E;
410
+ let C, R;
411
+ m !== 0 ? C = (d * E - p * u) / m : C = 0, R = (d + C * E) / u, n.x = C, n.y = R;
412
412
  };
413
413
  }(), Oi = function() {
414
414
  const l = new pe(), s = new w(), t = new w();
@@ -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 Mt(), i = new Mt(), o = new w(), n = new w(), r = new w(), a = new w(), c = new w(), h = new Lt(), d = new Lt(), E = new Lt(), u = new w();
492
- function p(A, R, C) {
493
- const T = A.points;
492
+ function p(A, m, C) {
493
+ const R = A.points;
494
494
  let F = 0, f = -1;
495
- for (let m = 0; m < 3; m++) {
495
+ for (let T = 0; T < 3; T++) {
496
496
  const { start: O, end: S } = h;
497
- O.copy(T[m]), S.copy(T[(m + 1) % 3]), h.delta(n);
498
- const _ = zs(R.distanceToPoint(O));
499
- if (zs(R.normal.dot(n)) && _) {
497
+ O.copy(R[T]), S.copy(R[(T + 1) % 3]), h.delta(n);
498
+ const _ = zs(m.distanceToPoint(O));
499
+ if (zs(m.normal.dot(n)) && _) {
500
500
  C.copy(h), F = 2;
501
501
  break;
502
502
  }
503
- const N = R.intersectLine(h, u);
503
+ const N = m.intersectLine(h, u);
504
504
  if (!N && _ && u.copy(O), (N || _) && !zs(u.distanceTo(S))) {
505
505
  if (F <= 1)
506
506
  (F === 1 ? C.start : C.end).copy(u), _ && (f = F);
@@ -514,18 +514,18 @@ Ft.prototype.intersectsTriangle = function() {
514
514
  }
515
515
  return F;
516
516
  }
517
- return function(R, C = null, T = !1) {
518
- this.needsUpdate && this.update(), R.isExtendedTriangle ? R.needsUpdate && R.update() : (l.copy(R), l.update(), R = l);
519
- const F = this.plane, f = R.plane;
517
+ return function(m, C = null, R = !1) {
518
+ this.needsUpdate && this.update(), m.isExtendedTriangle ? m.needsUpdate && m.update() : (l.copy(m), l.update(), m = l);
519
+ const F = this.plane, f = m.plane;
520
520
  if (Math.abs(F.normal.dot(f.normal)) > 1 - 1e-10) {
521
- const m = this.satBounds, O = this.satAxes;
522
- t[0] = R.a, t[1] = R.b, t[2] = R.c;
521
+ const T = this.satBounds, O = this.satAxes;
522
+ t[0] = m.a, t[1] = m.b, t[2] = m.c;
523
523
  for (let N = 0; N < 4; N++) {
524
- const L = m[N], M = O[N];
524
+ const L = T[N], M = O[N];
525
525
  if (e.setFromPoints(M, t), L.isSeparated(e))
526
526
  return !1;
527
527
  }
528
- const S = R.satBounds, _ = R.satAxes;
528
+ const S = m.satBounds, _ = m.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 L = S[N], M = _[N];
@@ -540,14 +540,14 @@ Ft.prototype.intersectsTriangle = function() {
540
540
  return !1;
541
541
  }
542
542
  }
543
- return C && (T || 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;
543
+ return C && (R || 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 m = p(this, f, d);
546
- if (m === 1 && R.containsPoint(d.end))
545
+ const T = p(this, f, d);
546
+ if (T === 1 && m.containsPoint(d.end))
547
547
  return C && (C.start.copy(d.end), C.end.copy(d.end)), !0;
548
- if (m !== 2)
548
+ if (T !== 2)
549
549
  return !1;
550
- const O = p(R, F, E);
550
+ const O = p(m, F, E);
551
551
  if (O === 1 && this.containsPoint(E.end))
552
552
  return C && (C.start.copy(E.end), C.end.copy(E.end)), !0;
553
553
  if (O !== 2)
@@ -585,8 +585,8 @@ Ft.prototype.distanceToTriangle = function() {
585
585
  const E = t[d], u = t[(d + 1) % 3];
586
586
  e.set(this[E], this[u]);
587
587
  for (let p = 0; p < 3; p++) {
588
- const A = t[p], R = t[(p + 1) % 3];
589
- i.set(n[A], n[R]), Oi(e, i, l, s);
588
+ const A = t[p], m = t[(p + 1) % 3];
589
+ i.set(n[A], n[m]), Oi(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
  }
@@ -684,34 +684,34 @@ 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 p = 1 / 0;
687
- for (let R = 0; R < 8; R++) {
688
- const C = u[R];
687
+ for (let m = 0; m < 8; m++) {
688
+ const C = u[m];
689
689
  i.copy(C).clamp(d, E);
690
- const T = C.distanceToSquared(i);
691
- if (T < p && (p = T, a && a.copy(C), c && c.copy(i), T < h))
692
- return Math.sqrt(T);
690
+ const R = C.distanceToSquared(i);
691
+ if (R < p && (p = R, a && a.copy(C), c && c.copy(i), R < h))
692
+ return Math.sqrt(R);
693
693
  }
694
694
  let A = 0;
695
- for (let R = 0; R < 3; R++)
695
+ for (let m = 0; m < 3; m++)
696
696
  for (let C = 0; C <= 1; C++)
697
- for (let T = 0; T <= 1; T++) {
698
- const F = (R + 1) % 3, f = (R + 2) % 3, m = C << F | T << f, O = 1 << R | C << F | T << f, S = u[m], _ = u[O];
697
+ for (let R = 0; R <= 1; R++) {
698
+ const F = (m + 1) % 3, f = (m + 2) % 3, T = C << F | R << f, O = 1 << m | C << F | R << f, S = u[T], _ = u[O];
699
699
  s[A].set(S, _);
700
- const L = l[R], M = l[F], y = l[f], x = t[A], b = x.start, B = x.end;
701
- b[L] = d[L], b[M] = C ? d[M] : E[M], b[y] = T ? d[y] : E[M], B[L] = E[L], B[M] = C ? d[M] : E[M], B[y] = T ? d[y] : E[M], A++;
700
+ const L = l[m], M = l[F], y = l[f], x = t[A], b = x.start, B = x.end;
701
+ b[L] = d[L], b[M] = C ? d[M] : E[M], b[y] = R ? d[y] : E[M], B[L] = E[L], B[M] = C ? d[M] : E[M], B[y] = R ? d[y] : E[M], A++;
702
702
  }
703
- for (let R = 0; R <= 1; R++)
703
+ for (let m = 0; m <= 1; m++)
704
704
  for (let C = 0; C <= 1; C++)
705
- for (let T = 0; T <= 1; T++) {
706
- i.x = R ? E.x : d.x, i.y = C ? E.y : d.y, i.z = T ? E.z : d.z, this.closestPointToPoint(i, e);
705
+ for (let R = 0; R <= 1; R++) {
706
+ i.x = m ? E.x : d.x, i.y = C ? E.y : d.y, i.z = R ? E.z : d.z, this.closestPointToPoint(i, e);
707
707
  const F = i.distanceToSquared(e);
708
708
  if (F < p && (p = F, a && a.copy(e), c && c.copy(i), F < h))
709
709
  return Math.sqrt(F);
710
710
  }
711
- for (let R = 0; R < 12; R++) {
712
- const C = s[R];
713
- for (let T = 0; T < 12; T++) {
714
- const F = t[T];
711
+ for (let m = 0; m < 12; m++) {
712
+ const C = s[m];
713
+ for (let R = 0; R < 12; R++) {
714
+ const F = t[R];
715
715
  Oi(C, F, e, i);
716
716
  const f = e.distanceToSquared(i);
717
717
  if (f < p && (p = f, a && a.copy(e), c && c.copy(i), f < h))
@@ -800,20 +800,20 @@ function ai(l, s, t, e, i = null, o = 0, n = 0) {
800
800
  return Et(y, b) + ft(B, x);
801
801
  };
802
802
  const E = pt(l), u = Ct(l, c);
803
- let p = E, A = u, R, C, T, F;
804
- if (i && (T = Yt, F = fe, $(p, r, T), $(A, r, F), R = i(T), C = i(F), C < R)) {
803
+ let p = E, A = u, m, C, R, F;
804
+ if (i && (R = Yt, F = fe, $(p, r, R), $(A, r, F), m = i(R), C = i(F), C < m)) {
805
805
  p = u, A = E;
806
- const y = R;
807
- R = C, C = y, T = F;
806
+ const y = m;
807
+ m = C, C = y, R = F;
808
808
  }
809
- T || (T = Yt, $(p, r, T));
810
- const f = ht(p * 2, a), m = t(T, f, R, n + 1, o + p);
809
+ R || (R = Yt, $(p, r, R));
810
+ const f = ht(p * 2, a), T = t(R, f, m, n + 1, o + p);
811
811
  let O;
812
- if (m === bi) {
812
+ if (T === bi) {
813
813
  const y = L(p), b = M(p) - y;
814
- O = e(y, b, !0, n + 1, o + p, T);
814
+ O = e(y, b, !0, n + 1, o + p, R);
815
815
  } else
816
- O = m && ai(
816
+ O = T && ai(
817
817
  p,
818
818
  s,
819
819
  t,
@@ -932,27 +932,27 @@ function Do(l, s = null) {
932
932
  function d(E, u, p = !1) {
933
933
  const A = E * 2;
934
934
  if (r[A + 15] === Us) {
935
- const C = n[E + 6], T = r[A + 14];
936
- let F = 1 / 0, f = 1 / 0, m = 1 / 0, O = -1 / 0, S = -1 / 0, _ = -1 / 0;
937
- for (let N = 3 * C, L = 3 * (C + T); N < L; N++) {
935
+ const C = n[E + 6], R = r[A + 14];
936
+ let F = 1 / 0, f = 1 / 0, T = 1 / 0, O = -1 / 0, S = -1 / 0, _ = -1 / 0;
937
+ for (let N = 3 * C, L = 3 * (C + R); N < L; N++) {
938
938
  let M = e[N];
939
939
  const y = i.getX(M), x = i.getY(M), b = i.getZ(M);
940
- y < F && (F = y), y > O && (O = y), x < f && (f = x), x > S && (S = x), b < m && (m = b), b > _ && (_ = b);
940
+ y < F && (F = y), y > O && (O = y), x < f && (f = x), x > S && (S = x), b < T && (T = b), b > _ && (_ = b);
941
941
  }
942
- return a[E + 0] !== F || a[E + 1] !== f || a[E + 2] !== m || a[E + 3] !== O || a[E + 4] !== S || a[E + 5] !== _ ? (a[E + 0] = F, a[E + 1] = f, a[E + 2] = m, a[E + 3] = O, a[E + 4] = S, a[E + 5] = _, !0) : !1;
942
+ return a[E + 0] !== F || a[E + 1] !== f || a[E + 2] !== T || a[E + 3] !== O || a[E + 4] !== S || a[E + 5] !== _ ? (a[E + 0] = F, a[E + 1] = f, a[E + 2] = T, a[E + 3] = O, a[E + 4] = S, a[E + 5] = _, !0) : !1;
943
943
  } else {
944
- const C = E + 8, T = n[E + 6], F = C + u, f = T + u;
945
- let m = p, O = !1, S = !1;
946
- s ? m || (O = s.has(F), S = s.has(f), m = !O && !S) : (O = !0, S = !0);
947
- const _ = m || O, N = m || S;
944
+ const C = E + 8, R = n[E + 6], F = C + u, f = R + u;
945
+ let T = p, O = !1, S = !1;
946
+ s ? T || (O = s.has(F), S = s.has(f), T = !O && !S) : (O = !0, S = !0);
947
+ const _ = T || O, N = T || S;
948
948
  let L = !1;
949
- _ && (L = d(C, u, m));
949
+ _ && (L = d(C, u, T));
950
950
  let M = !1;
951
- N && (M = d(T, u, m));
951
+ N && (M = d(R, u, T));
952
952
  const y = L || M;
953
953
  if (y)
954
954
  for (let x = 0; x < 3; x++) {
955
- const b = C + x, B = T + x, H = a[b], q = a[b + 3], st = a[B], Q = a[B + 3];
955
+ const b = C + x, B = R + x, H = a[b], q = a[b + 3], st = a[B], Q = a[B + 3];
956
956
  a[E + x] = H < st ? H : st, a[E + x + 3] = q > Q ? q : Q;
957
957
  }
958
958
  return y;
@@ -960,7 +960,7 @@ function Do(l, s = null) {
960
960
  }
961
961
  }
962
962
  const ki = /* @__PURE__ */ new Ot();
963
- function zt(l, s, t, e) {
963
+ function Gt(l, s, t, e) {
964
964
  return $(l, s, ki), t.intersectBox(ki, e);
965
965
  }
966
966
  function Uo(l, s, t, e, i, o) {
@@ -999,9 +999,9 @@ function ci(l, s, t, e, i) {
999
999
  yo(s, t, e, h, d, i);
1000
1000
  } else {
1001
1001
  const h = pt(l);
1002
- zt(h, o, e, Wi) && 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
- zt(d, o, e, Wi) && ci(d, s, t, e, i);
1004
+ Gt(d, o, e, Wi) && ci(d, s, t, e, i);
1005
1005
  }
1006
1006
  }
1007
1007
  const Xi = /* @__PURE__ */ new w(), Bo = ["x", "y", "z"];
@@ -1020,17 +1020,17 @@ function li(l, s, t, e) {
1020
1020
  const c = xn(l, n), h = Bo[c], E = e.direction[h] >= 0;
1021
1021
  let u, p;
1022
1022
  E ? (u = pt(l), p = Ct(l, n)) : (u = Ct(l, n), p = pt(l));
1023
- const R = zt(u, i, e, Xi) ? li(u, s, t, e) : null;
1024
- if (R) {
1025
- const F = R.point[h];
1023
+ const m = Gt(u, i, e, Xi) ? li(u, s, t, e) : null;
1024
+ if (m) {
1025
+ const F = m.point[h];
1026
1026
  if (E ? F <= i[p + c] : (
1027
1027
  // min bounding data
1028
1028
  F >= i[p + c + 3]
1029
1029
  ))
1030
- return R;
1030
+ return m;
1031
1031
  }
1032
- const T = zt(p, i, e, Xi) ? li(p, s, t, e) : null;
1033
- return R && T ? R.distance <= T.distance ? R : T : R || T || null;
1032
+ const R = Gt(p, i, e, Xi) ? li(p, s, t, e) : null;
1033
+ return m && R ? m.distance <= R.distance ? m : R : m || R || null;
1034
1034
  }
1035
1035
  }
1036
1036
  const is = /* @__PURE__ */ new Ot(), ne = /* @__PURE__ */ new Ft(), oe = /* @__PURE__ */ new Ft(), Oe = /* @__PURE__ */ new yt(), Zi = /* @__PURE__ */ new at(), ns = /* @__PURE__ */ new at();
@@ -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(), Zi.set(t.boundingBox.min, t.boundingBox.max, e), i = Zi), ht(a, n)) {
1046
- const h = s.geometry, d = h.index, E = h.attributes.position, u = t.index, p = t.attributes.position, A = Et(l, r), R = ft(a, n);
1046
+ const h = s.geometry, d = h.index, E = h.attributes.position, u = t.index, p = t.attributes.position, A = Et(l, r), m = ft(a, n);
1047
1047
  if (Oe.copy(e).invert(), t.boundsTree)
1048
1048
  return $(l, o, ns), ns.matrix.copy(Oe), ns.needsUpdate = !0, t.boundsTree.shapecast({
1049
- intersectsBounds: (T) => ns.intersectsBox(T),
1050
- intersectsTriangle: (T) => {
1051
- T.a.applyMatrix4(e), T.b.applyMatrix4(e), T.c.applyMatrix4(e), T.needsUpdate = !0;
1052
- for (let F = A * 3, f = (R + A) * 3; F < f; F += 3)
1053
- if (et(oe, F, d, E), oe.needsUpdate = !0, T.intersectsTriangle(oe))
1049
+ intersectsBounds: (R) => ns.intersectsBox(R),
1050
+ intersectsTriangle: (R) => {
1051
+ R.a.applyMatrix4(e), R.b.applyMatrix4(e), R.c.applyMatrix4(e), R.needsUpdate = !0;
1052
+ for (let F = A * 3, f = (m + A) * 3; F < f; F += 3)
1053
+ if (et(oe, F, d, E), oe.needsUpdate = !0, R.intersectsTriangle(oe))
1054
1054
  return !0;
1055
1055
  return !1;
1056
1056
  }
1057
1057
  });
1058
- for (let C = A * 3, T = (R + A) * 3; C < T; C += 3) {
1058
+ for (let C = A * 3, R = (m + A) * 3; C < R; C += 3) {
1059
1059
  et(ne, C, d, E), ne.a.applyMatrix4(Oe), ne.b.applyMatrix4(Oe), ne.c.applyMatrix4(Oe), ne.needsUpdate = !0;
1060
1060
  for (let F = 0, f = u.count; F < f; F += 3)
1061
1061
  if (et(oe, F, u, p), oe.needsUpdate = !0, ne.intersectsTriangle(oe))
@@ -1070,25 +1070,25 @@ const os = /* @__PURE__ */ new yt(), ks = /* @__PURE__ */ new at(), ge = /* @__P
1070
1070
  function Wo(l, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
1071
1071
  s.boundingBox || s.computeBoundingBox(), ks.set(s.boundingBox.min, s.boundingBox.max, t), ks.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 p = Go, A = zo, R = null, C = null;
1074
- i && (R = Ho, C = ko);
1075
- let T = 1 / 0, F = null, f = null;
1073
+ let p = Go, A = zo, m = null, C = null;
1074
+ i && (m = Ho, C = ko);
1075
+ let R = 1 / 0, F = null, f = null;
1076
1076
  return os.copy(t).invert(), ge.matrix.copy(os), l.shapecast(
1077
1077
  {
1078
- boundsTraverseOrder: (m) => ks.distanceToBox(m),
1079
- intersectsBounds: (m, O, S) => S < T && S < n ? (O && (ge.min.copy(m.min), ge.max.copy(m.max), ge.needsUpdate = !0), !0) : !1,
1080
- intersectsRange: (m, O) => {
1078
+ boundsTraverseOrder: (T) => ks.distanceToBox(T),
1079
+ intersectsBounds: (T, O, S) => S < R && S < n ? (O && (ge.min.copy(T.min), ge.max.copy(T.max), ge.needsUpdate = !0), !0) : !1,
1080
+ intersectsRange: (T, O) => {
1081
1081
  if (s.boundsTree)
1082
1082
  return s.boundsTree.shapecast({
1083
1083
  boundsTraverseOrder: (_) => ge.distanceToBox(_),
1084
- intersectsBounds: (_, N, L) => L < T && L < n,
1084
+ intersectsBounds: (_, N, L) => L < R && L < n,
1085
1085
  intersectsRange: (_, N) => {
1086
1086
  for (let L = _, M = _ + N; L < M; L++) {
1087
1087
  et(u, 3 * L, d, h), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
1088
- for (let y = m, x = m + O; y < x; y++) {
1088
+ for (let y = T, x = T + O; y < x; y++) {
1089
1089
  et(E, 3 * y, c, a), E.needsUpdate = !0;
1090
- const b = E.distanceToTriangle(u, p, R);
1091
- if (b < T && (A.copy(p), C && C.copy(R), T = b, F = y, f = L), b < o)
1090
+ const b = E.distanceToTriangle(u, p, m);
1091
+ if (b < R && (A.copy(p), C && C.copy(m), R = b, F = y, f = L), b < o)
1092
1092
  return !0;
1093
1093
  }
1094
1094
  }
@@ -1098,17 +1098,17 @@ function Wo(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
  et(u, 3 * _, d, h), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
1101
- for (let L = m, M = m + O; L < M; L++) {
1101
+ for (let L = T, M = T + O; L < M; L++) {
1102
1102
  et(E, 3 * L, c, a), E.needsUpdate = !0;
1103
- const y = E.distanceToTriangle(u, p, R);
1104
- if (y < T && (A.copy(p), C && C.copy(R), T = y, F = L, f = _), y < o)
1103
+ const y = E.distanceToTriangle(u, p, m);
1104
+ if (y < R && (A.copy(p), C && C.copy(m), R = y, F = L, f = _), y < o)
1105
1105
  return !0;
1106
1106
  }
1107
1107
  }
1108
1108
  }
1109
1109
  }
1110
1110
  }
1111
- ), It.releasePrimitive(E), It.releasePrimitive(u), T === 1 / 0 ? null : (e.point ? e.point.copy(A) : e.point = A.clone(), e.distance = T, e.faceIndex = F, i && (i.point ? i.point.copy(C) : i.point = C.clone(), i.point.applyMatrix4(os), A.applyMatrix4(os), i.distance = A.sub(i.point).length(), i.faceIndex = f), e);
1111
+ ), It.releasePrimitive(E), It.releasePrimitive(u), R === 1 / 0 ? null : (e.point ? e.point.copy(A) : e.point = A.clone(), e.distance = R, e.faceIndex = F, i && (i.point ? i.point.copy(C) : i.point = C.clone(), i.point.applyMatrix4(os), A.applyMatrix4(os), i.distance = A.sub(i.point).length(), i.faceIndex = f), e);
1112
1112
  }
1113
1113
  function Xo(l, s = null) {
1114
1114
  s && Array.isArray(s) && (s = new Set(s));
@@ -1120,31 +1120,31 @@ function Xo(l, s = null) {
1120
1120
  function d(E, u, p = !1) {
1121
1121
  const A = E * 2;
1122
1122
  if (r[A + 15] === Us) {
1123
- const C = n[E + 6], T = r[A + 14];
1124
- let F = 1 / 0, f = 1 / 0, m = 1 / 0, O = -1 / 0, S = -1 / 0, _ = -1 / 0;
1125
- for (let N = C, L = C + T; N < L; N++) {
1123
+ const C = n[E + 6], R = r[A + 14];
1124
+ let F = 1 / 0, f = 1 / 0, T = 1 / 0, O = -1 / 0, S = -1 / 0, _ = -1 / 0;
1125
+ for (let N = C, L = C + R; N < L; N++) {
1126
1126
  const M = 3 * l.resolveTriangleIndex(N);
1127
1127
  for (let y = 0; y < 3; y++) {
1128
1128
  let x = M + y;
1129
1129
  x = e ? e[x] : x;
1130
1130
  const b = i.getX(x), B = i.getY(x), H = i.getZ(x);
1131
- b < F && (F = b), b > O && (O = b), B < f && (f = B), B > S && (S = B), H < m && (m = H), H > _ && (_ = H);
1131
+ b < F && (F = b), b > O && (O = b), B < f && (f = B), B > S && (S = B), H < T && (T = H), H > _ && (_ = H);
1132
1132
  }
1133
1133
  }
1134
- return a[E + 0] !== F || a[E + 1] !== f || a[E + 2] !== m || a[E + 3] !== O || a[E + 4] !== S || a[E + 5] !== _ ? (a[E + 0] = F, a[E + 1] = f, a[E + 2] = m, a[E + 3] = O, a[E + 4] = S, a[E + 5] = _, !0) : !1;
1134
+ return a[E + 0] !== F || a[E + 1] !== f || a[E + 2] !== T || a[E + 3] !== O || a[E + 4] !== S || a[E + 5] !== _ ? (a[E + 0] = F, a[E + 1] = f, a[E + 2] = T, a[E + 3] = O, a[E + 4] = S, a[E + 5] = _, !0) : !1;
1135
1135
  } else {
1136
- const C = E + 8, T = n[E + 6], F = C + u, f = T + u;
1137
- let m = p, O = !1, S = !1;
1138
- s ? m || (O = s.has(F), S = s.has(f), m = !O && !S) : (O = !0, S = !0);
1139
- const _ = m || O, N = m || S;
1136
+ const C = E + 8, R = n[E + 6], F = C + u, f = R + u;
1137
+ let T = p, O = !1, S = !1;
1138
+ s ? T || (O = s.has(F), S = s.has(f), T = !O && !S) : (O = !0, S = !0);
1139
+ const _ = T || O, N = T || S;
1140
1140
  let L = !1;
1141
- _ && (L = d(C, u, m));
1141
+ _ && (L = d(C, u, T));
1142
1142
  let M = !1;
1143
- N && (M = d(T, u, m));
1143
+ N && (M = d(R, u, T));
1144
1144
  const y = L || M;
1145
1145
  if (y)
1146
1146
  for (let x = 0; x < 3; x++) {
1147
- const b = C + x, B = T + x, H = a[b], q = a[b + 3], st = a[B], Q = a[B + 3];
1147
+ const b = C + x, B = R + x, H = a[b], q = a[b + 3], st = a[B], Q = a[B + 3];
1148
1148
  a[E + x] = H < st ? H : st, a[E + x + 3] = q > Q ? q : Q;
1149
1149
  }
1150
1150
  return y;
@@ -1162,9 +1162,9 @@ function Ei(l, s, t, e, i) {
1162
1162
  Uo(s, t, e, h, d, i);
1163
1163
  } else {
1164
1164
  const h = pt(l);
1165
- zt(h, o, e, Qi) && Ei(h, s, t, e, i);
1165
+ Gt(h, o, e, Qi) && Ei(h, s, t, e, i);
1166
1166
  const d = Ct(l, r);
1167
- zt(d, o, e, Qi) && Ei(d, s, t, e, i);
1167
+ Gt(d, o, e, Qi) && Ei(d, s, t, e, i);
1168
1168
  }
1169
1169
  }
1170
1170
  const ji = /* @__PURE__ */ new w(), Qo = ["x", "y", "z"];
@@ -1183,17 +1183,17 @@ function di(l, s, t, e) {
1183
1183
  const c = xn(l, n), h = Qo[c], E = e.direction[h] >= 0;
1184
1184
  let u, p;
1185
1185
  E ? (u = pt(l), p = Ct(l, n)) : (u = Ct(l, n), p = pt(l));
1186
- const R = zt(u, i, e, ji) ? di(u, s, t, e) : null;
1187
- if (R) {
1188
- const F = R.point[h];
1186
+ const m = Gt(u, i, e, ji) ? di(u, s, t, e) : null;
1187
+ if (m) {
1188
+ const F = m.point[h];
1189
1189
  if (E ? F <= i[p + c] : (
1190
1190
  // min bounding data
1191
1191
  F >= i[p + c + 3]
1192
1192
  ))
1193
- return R;
1193
+ return m;
1194
1194
  }
1195
- const T = zt(p, i, e, ji) ? di(p, s, t, e) : null;
1196
- return R && T ? R.distance <= T.distance ? R : T : R || T || null;
1195
+ const R = Gt(p, i, e, ji) ? di(p, s, t, e) : null;
1196
+ return m && R ? m.distance <= R.distance ? m : R : m || R || null;
1197
1197
  }
1198
1198
  }
1199
1199
  const rs = /* @__PURE__ */ new Ot(), re = /* @__PURE__ */ new Ft(), ae = /* @__PURE__ */ new Ft(), Se = /* @__PURE__ */ new yt(), qi = /* @__PURE__ */ new at(), as = /* @__PURE__ */ new at();
@@ -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(), qi.set(t.boundingBox.min, t.boundingBox.max, e), i = qi), ht(a, n)) {
1209
- const h = s.geometry, d = h.index, E = h.attributes.position, u = t.index, p = t.attributes.position, A = Et(l, r), R = ft(a, n);
1209
+ const h = s.geometry, d = h.index, E = h.attributes.position, u = t.index, p = t.attributes.position, A = Et(l, r), m = ft(a, n);
1210
1210
  if (Se.copy(e).invert(), t.boundsTree)
1211
1211
  return $(l, o, as), as.matrix.copy(Se), as.needsUpdate = !0, t.boundsTree.shapecast({
1212
- intersectsBounds: (T) => as.intersectsBox(T),
1213
- intersectsTriangle: (T) => {
1214
- T.a.applyMatrix4(e), T.b.applyMatrix4(e), T.c.applyMatrix4(e), T.needsUpdate = !0;
1215
- for (let F = A, f = R + A; F < f; F++)
1216
- if (et(ae, 3 * s.resolveTriangleIndex(F), d, E), ae.needsUpdate = !0, T.intersectsTriangle(ae))
1212
+ intersectsBounds: (R) => as.intersectsBox(R),
1213
+ intersectsTriangle: (R) => {
1214
+ R.a.applyMatrix4(e), R.b.applyMatrix4(e), R.c.applyMatrix4(e), R.needsUpdate = !0;
1215
+ for (let F = A, f = m + A; F < f; F++)
1216
+ if (et(ae, 3 * s.resolveTriangleIndex(F), d, E), ae.needsUpdate = !0, R.intersectsTriangle(ae))
1217
1217
  return !0;
1218
1218
  return !1;
1219
1219
  }
1220
1220
  });
1221
- for (let C = A, T = R + A; C < T; C++) {
1221
+ for (let C = A, R = m + A; C < R; C++) {
1222
1222
  const F = s.resolveTriangleIndex(C);
1223
1223
  et(re, 3 * F, d, E), re.a.applyMatrix4(Se), re.b.applyMatrix4(Se), re.c.applyMatrix4(Se), re.needsUpdate = !0;
1224
- for (let f = 0, m = u.count; f < m; f += 3)
1224
+ for (let f = 0, T = u.count; f < T; f += 3)
1225
1225
  if (et(ae, f, u, p), ae.needsUpdate = !0, re.intersectsTriangle(ae))
1226
1226
  return !0;
1227
1227
  }
@@ -1234,28 +1234,28 @@ const cs = /* @__PURE__ */ new yt(), Ws = /* @__PURE__ */ new at(), _e = /* @__P
1234
1234
  function er(l, s, t, e = {}, i = {}, o = 0, n = 1 / 0) {
1235
1235
  s.boundingBox || s.computeBoundingBox(), Ws.set(s.boundingBox.min, s.boundingBox.max, t), Ws.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 p = $o, A = Ko, R = null, C = null;
1238
- i && (R = Jo, C = tr);
1239
- let T = 1 / 0, F = null, f = null;
1237
+ let p = $o, A = Ko, m = null, C = null;
1238
+ i && (m = Jo, C = tr);
1239
+ let R = 1 / 0, F = null, f = null;
1240
1240
  return cs.copy(t).invert(), _e.matrix.copy(cs), l.shapecast(
1241
1241
  {
1242
- boundsTraverseOrder: (m) => Ws.distanceToBox(m),
1243
- intersectsBounds: (m, O, S) => S < T && S < n ? (O && (_e.min.copy(m.min), _e.max.copy(m.max), _e.needsUpdate = !0), !0) : !1,
1244
- intersectsRange: (m, O) => {
1242
+ boundsTraverseOrder: (T) => Ws.distanceToBox(T),
1243
+ intersectsBounds: (T, O, S) => S < R && S < n ? (O && (_e.min.copy(T.min), _e.max.copy(T.max), _e.needsUpdate = !0), !0) : !1,
1244
+ intersectsRange: (T, O) => {
1245
1245
  if (s.boundsTree) {
1246
1246
  const S = s.boundsTree;
1247
1247
  return S.shapecast({
1248
1248
  boundsTraverseOrder: (_) => _e.distanceToBox(_),
1249
- intersectsBounds: (_, N, L) => L < T && L < n,
1249
+ intersectsBounds: (_, N, L) => L < R && L < n,
1250
1250
  intersectsRange: (_, N) => {
1251
1251
  for (let L = _, M = _ + N; L < M; L++) {
1252
1252
  const y = S.resolveTriangleIndex(L);
1253
1253
  et(u, 3 * y, d, h), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
1254
- for (let x = m, b = m + O; x < b; x++) {
1254
+ for (let x = T, b = T + O; x < b; x++) {
1255
1255
  const B = l.resolveTriangleIndex(x);
1256
1256
  et(E, 3 * B, c, a), E.needsUpdate = !0;
1257
- const H = E.distanceToTriangle(u, p, R);
1258
- if (H < T && (A.copy(p), C && C.copy(R), T = H, F = x, f = L), H < o)
1257
+ const H = E.distanceToTriangle(u, p, m);
1258
+ if (H < R && (A.copy(p), C && C.copy(m), R = H, F = x, f = L), H < o)
1259
1259
  return !0;
1260
1260
  }
1261
1261
  }
@@ -1265,18 +1265,18 @@ function er(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
  et(u, 3 * _, d, h), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
1268
- for (let L = m, M = m + O; L < M; L++) {
1268
+ for (let L = T, M = T + O; L < M; L++) {
1269
1269
  const y = l.resolveTriangleIndex(L);
1270
1270
  et(E, 3 * y, c, a), E.needsUpdate = !0;
1271
- const x = E.distanceToTriangle(u, p, R);
1272
- if (x < T && (A.copy(p), C && C.copy(R), T = x, F = L, f = _), x < o)
1271
+ const x = E.distanceToTriangle(u, p, m);
1272
+ if (x < R && (A.copy(p), C && C.copy(m), R = x, F = L, f = _), x < o)
1273
1273
  return !0;
1274
1274
  }
1275
1275
  }
1276
1276
  }
1277
1277
  }
1278
1278
  }
1279
- ), It.releasePrimitive(E), It.releasePrimitive(u), T === 1 / 0 ? null : (e.point ? e.point.copy(A) : e.point = A.clone(), e.distance = T, e.faceIndex = F, i && (i.point ? i.point.copy(C) : i.point = C.clone(), i.point.applyMatrix4(cs), A.applyMatrix4(cs), i.distance = A.sub(i.point).length(), i.faceIndex = f), e);
1279
+ ), It.releasePrimitive(E), It.releasePrimitive(u), R === 1 / 0 ? null : (e.point ? e.point.copy(A) : e.point = A.clone(), e.distance = R, e.faceIndex = F, i && (i.point ? i.point.copy(C) : i.point = C.clone(), i.point.applyMatrix4(cs), A.applyMatrix4(cs), i.distance = A.sub(i.point).length(), i.faceIndex = f), e);
1280
1280
  }
1281
1281
  function sr() {
1282
1282
  return typeof SharedArrayBuffer < "u";
@@ -1315,12 +1315,12 @@ function ir(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, p = d.uint32Array, A = d.uint16Array, R = E.float32Array, C = E.uint32Array, T = E.uint16Array, F = l * 2, f = s * 2, m = ht(F, A), O = ht(f, T);
1318
+ const u = d.float32Array, p = d.uint32Array, A = d.uint16Array, m = E.float32Array, C = E.uint32Array, R = E.uint16Array, F = l * 2, f = s * 2, T = ht(F, A), O = ht(f, R);
1319
1319
  let S = !1;
1320
- if (O && m)
1320
+ if (O && T)
1321
1321
  h ? S = i(
1322
1322
  Et(s, C),
1323
- ft(s * 2, T),
1323
+ ft(s * 2, R),
1324
1324
  Et(l, p),
1325
1325
  ft(l * 2, A),
1326
1326
  a,
@@ -1331,7 +1331,7 @@ function Tt(l, s, t, e, i, o = 0, n = 0, r = 0, a = 0, c = null, h = !1) {
1331
1331
  Et(l, p),
1332
1332
  ft(l * 2, A),
1333
1333
  Et(s, C),
1334
- ft(s * 2, T),
1334
+ ft(s * 2, R),
1335
1335
  r,
1336
1336
  o + l,
1337
1337
  a,
@@ -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 (O) {
1341
1341
  const _ = vt.getPrimitive();
1342
- $(s, R, _), _.applyMatrix4(t);
1342
+ $(s, m, _), _.applyMatrix4(t);
1343
1343
  const N = pt(l), L = Ct(l, p);
1344
1344
  $(N, u, ce), $(L, u, le);
1345
1345
  const M = _.intersectsBox(ce), y = _.intersectsBox(le);
@@ -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
- $(_, R, Xs), $(N, R, Zs);
1373
+ $(_, m, Xs), $(N, m, Zs);
1374
1374
  const L = c.intersectsBox(Xs), M = c.intersectsBox(Zs);
1375
1375
  if (L && M)
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 (L)
1402
- if (m)
1402
+ if (T)
1403
1403
  S = Tt(
1404
1404
  l,
1405
1405
  _,
@@ -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(y);
1447
1447
  }
1448
1448
  else if (M)
1449
- if (m)
1449
+ if (T)
1450
1450
  S = Tt(
1451
1451
  l,
1452
1452
  N,
@@ -1582,8 +1582,8 @@ class Si {
1582
1582
  const u = r ? t[a[d].materialIndex].side : c, p = o.length;
1583
1583
  if (h(this, d, u, s, o), r) {
1584
1584
  const A = a[d].materialIndex;
1585
- for (let R = p, C = o.length; R < C; R++)
1586
- o[R].face.materialIndex = A;
1585
+ for (let m = p, C = o.length; m < C; m++)
1586
+ o[m].face.materialIndex = A;
1587
1587
  }
1588
1588
  }
1589
1589
  return o;
@@ -1615,7 +1615,7 @@ class Si {
1615
1615
  } = s;
1616
1616
  if (n && r) {
1617
1617
  const d = n;
1618
- n = (E, u, p, A, R) => d(E, u, p, A, R) ? !0 : e(E, u, this, r, p, A, t);
1618
+ n = (E, u, p, A, m) => d(E, u, p, A, m) ? !0 : e(E, u, this, r, p, A, t);
1619
1619
  } else
1620
1620
  n || (r ? n = (d, E, u, p) => e(d, E, this, r, u, p, t) : n = (d, E, u) => u);
1621
1621
  let a = !1, c = 0;
@@ -1645,19 +1645,19 @@ class Si {
1645
1645
  et(h, p * 3, d, E);
1646
1646
  };
1647
1647
  if (o) {
1648
- const p = (A, R, C, T, F, f, m, O) => {
1649
- for (let S = C, _ = C + T; S < _; S++) {
1648
+ const p = (A, m, C, R, F, f, T, O) => {
1649
+ for (let S = C, _ = C + R; 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 = A, L = A + R; N < L; N++)
1652
- if (c(N), n.needsUpdate = !0, o(n, h, N, S, F, f, m, O))
1651
+ for (let N = A, L = A + m; N < L; N++)
1652
+ if (c(N), n.needsUpdate = !0, o(n, h, N, S, F, f, T, O))
1653
1653
  return !0;
1654
1654
  }
1655
1655
  return !1;
1656
1656
  };
1657
1657
  if (i) {
1658
1658
  const A = i;
1659
- i = function(R, C, T, F, f, m, O, S) {
1660
- return A(R, C, T, F, f, m, O, S) ? !0 : p(R, C, T, F, f, m, O, S);
1659
+ i = function(m, C, R, F, f, T, O, S) {
1660
+ return A(m, C, R, F, f, T, O, S) ? !0 : p(m, C, R, F, f, T, O, S);
1661
1661
  };
1662
1662
  } else
1663
1663
  i = p;
@@ -1765,7 +1765,7 @@ class D {
1765
1765
  this.handlers.length = 0;
1766
1766
  }
1767
1767
  }
1768
- class Kt {
1768
+ class $t {
1769
1769
  constructor() {
1770
1770
  /** Triggers all the callbacks assigned to this event. */
1771
1771
  I(this, "trigger", async (s) => {
@@ -1931,7 +1931,7 @@ const ve = class ve extends J {
1931
1931
  }
1932
1932
  };
1933
1933
  I(ve, "uuid", "76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe");
1934
- let Ht = ve;
1934
+ let zt = ve;
1935
1935
  class hr extends Ni {
1936
1936
  constructor(t) {
1937
1937
  super(t);
@@ -1940,7 +1940,7 @@ class hr extends Ni {
1940
1940
  }
1941
1941
  /** {@link Disposable.dispose} */
1942
1942
  dispose() {
1943
- const t = this.components.get(Ht);
1943
+ const t = this.components.get(zt);
1944
1944
  for (const e of this.three.children) {
1945
1945
  const i = e;
1946
1946
  i.geometry && t.destroy(i);
@@ -2129,9 +2129,9 @@ class ur {
2129
2129
  if (p !== r && p !== a && p !== c && p !== h) {
2130
2130
  o = this.tolerance;
2131
2131
  let A = null;
2132
- for (let R = 0; R < 4; R++) {
2133
- const C = this.faces[R].distanceToPoint(p.point);
2134
- C > o && (o = C, A = this.faces[R]);
2132
+ for (let m = 0; m < 4; m++) {
2133
+ const C = this.faces[m].distanceToPoint(p.point);
2134
+ C > o && (o = C, A = this.faces[m]);
2135
2135
  }
2136
2136
  A !== null && this.addVertexToFace(p, A);
2137
2137
  }
@@ -2346,8 +2346,8 @@ function Tr(l, s) {
2346
2346
  function mr(l) {
2347
2347
  const s = [];
2348
2348
  for (let it = 0; it < l.length - 2; it += 3) {
2349
- const Zt = l[it], tt = l[it + 1], Jt = l[it + 2];
2350
- s.push(new g.Vector3(Zt, tt, Jt));
2349
+ const Xt = l[it], tt = l[it + 1], Jt = l[it + 2];
2350
+ s.push(new g.Vector3(Xt, tt, Jt));
2351
2351
  }
2352
2352
  const t = new ur();
2353
2353
  t.setFromPoints(s);
@@ -2355,7 +2355,7 @@ function mr(l) {
2355
2355
  unitary: new g.Matrix3(),
2356
2356
  diagonal: new g.Matrix3()
2357
2357
  }, i = t.faces, o = [], n = [];
2358
- for (let it = 0, Zt = i.length; it < Zt; it++) {
2358
+ for (let it = 0, Xt = i.length; it < Xt; it++) {
2359
2359
  const tt = i[it];
2360
2360
  let Jt = tt.edge;
2361
2361
  o.length = 0;
@@ -2369,29 +2369,29 @@ function mr(l) {
2369
2369
  }
2370
2370
  }
2371
2371
  const r = new g.Vector3(), a = new g.Vector3(), c = new g.Vector3(), h = new g.Vector3(), d = new g.Vector3(), E = new g.Vector3(), u = new g.Vector3(), p = new g.Vector3();
2372
- let A = 0, R = 0, C = 0, T = 0, F = 0, f = 0, m = 0;
2373
- for (let it = 0, Zt = n.length; it < Zt; it += 9) {
2372
+ let A = 0, m = 0, C = 0, R = 0, F = 0, f = 0, T = 0;
2373
+ for (let it = 0, Xt = n.length; it < Xt; it += 9) {
2374
2374
  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);
2375
2375
  const tt = E.crossVectors(h, d).length() / 2;
2376
- p.add(E.copy(u).multiplyScalar(tt)), A += tt, R += (9 * u.x * u.x + r.x * r.x + a.x * a.x + c.x * c.x) * (tt / 12), C += (9 * u.x * u.y + r.x * r.y + a.x * a.y + c.x * c.y) * (tt / 12), T += (9 * u.x * u.z + r.x * r.z + a.x * a.z + c.x * c.z) * (tt / 12), F += (9 * u.y * u.y + r.y * r.y + a.y * a.y + c.y * c.y) * (tt / 12), f += (9 * u.y * u.z + r.y * r.z + a.y * a.z + c.y * c.z) * (tt / 12), m += (9 * u.z * u.z + r.z * r.z + a.z * a.z + c.z * c.z) * (tt / 12);
2376
+ p.add(E.copy(u).multiplyScalar(tt)), A += tt, m += (9 * u.x * u.x + r.x * r.x + a.x * a.x + c.x * c.x) * (tt / 12), C += (9 * u.x * u.y + r.x * r.y + a.x * a.y + c.x * c.y) * (tt / 12), R += (9 * u.x * u.z + r.x * r.z + a.x * a.z + c.x * c.z) * (tt / 12), F += (9 * u.y * u.y + r.y * r.y + a.y * a.y + c.y * c.y) * (tt / 12), f += (9 * u.y * u.z + r.y * r.z + a.y * a.z + c.y * c.z) * (tt / 12), T += (9 * u.z * u.z + r.z * r.z + a.z * a.z + c.z * c.z) * (tt / 12);
2377
2377
  }
2378
- p.divideScalar(A), R /= A, C /= A, T /= A, F /= A, f /= A, m /= A, R -= p.x * p.x, C -= p.x * p.y, T -= p.x * p.z, F -= p.y * p.y, f -= p.y * p.z, m -= p.z * p.z;
2378
+ p.divideScalar(A), m /= A, C /= A, R /= A, F /= A, f /= A, T /= A, m -= p.x * p.x, C -= p.x * p.y, R -= p.x * p.z, F -= p.y * p.y, f -= p.y * p.z, T -= p.z * p.z;
2379
2379
  const O = new g.Matrix3();
2380
- O.elements[0] = R, O.elements[1] = C, O.elements[2] = T, O.elements[3] = C, O.elements[4] = F, O.elements[5] = f, O.elements[6] = T, O.elements[7] = f, O.elements[8] = m, Tr(O, e);
2380
+ O.elements[0] = m, O.elements[1] = C, O.elements[2] = R, O.elements[3] = C, O.elements[4] = F, O.elements[5] = f, O.elements[6] = R, O.elements[7] = f, O.elements[8] = T, Tr(O, e);
2381
2381
  const S = e.unitary, _ = new g.Vector3(), N = new g.Vector3(), L = new g.Vector3();
2382
2382
  S.extractBasis(_, N, L);
2383
2383
  let M = -1 / 0, y = -1 / 0, x = -1 / 0, b = 1 / 0, B = 1 / 0, H = 1 / 0;
2384
- for (let it = 0, Zt = s.length; it < Zt; it++) {
2384
+ for (let it = 0, Xt = s.length; it < Xt; it++) {
2385
2385
  const tt = s[it];
2386
2386
  M = Math.max(_.dot(tt), M), y = Math.max(N.dot(tt), y), x = Math.max(L.dot(tt), x), b = Math.min(_.dot(tt), b), B = Math.min(N.dot(tt), B), H = Math.min(L.dot(tt), H);
2387
2387
  }
2388
2388
  _.multiplyScalar(0.5 * (b + M)), N.multiplyScalar(0.5 * (B + y)), L.multiplyScalar(0.5 * (H + x));
2389
2389
  const q = new g.Vector3(), st = new g.Vector3(), Q = new g.Matrix3();
2390
2390
  q.add(_).add(N).add(L), st.x = M - b, st.y = y - B, st.z = x - H, st.multiplyScalar(0.5), Q.copy(S);
2391
- const { x: kt, y: Wt, z: Xt } = st, Xe = new g.Matrix4();
2392
- Xe.makeScale(kt * 2, Wt * 2, Xt * 2);
2391
+ const { x: Ht, y: kt, z: Wt } = st, Xe = new g.Matrix4();
2392
+ Xe.makeScale(Ht * 2, kt * 2, Wt * 2);
2393
2393
  const Te = new g.Matrix4();
2394
- Te.makeTranslation(-kt, -Wt, -Xt);
2394
+ Te.makeTranslation(-Ht, -kt, -Wt);
2395
2395
  const wi = new g.Matrix4();
2396
2396
  wi.makeTranslation(q.x, q.y, q.z);
2397
2397
  const Mi = new g.Matrix4();
@@ -2739,23 +2739,26 @@ class sa extends J {
2739
2739
  getClosestVertex(t) {
2740
2740
  let e = new g.Vector3(), i = !1, o = Number.MAX_SAFE_INTEGER;
2741
2741
  const n = this.getVertices(t);
2742
- return n == null || n.forEach((r) => {
2742
+ if (n === null)
2743
+ return null;
2744
+ for (const r of n) {
2743
2745
  if (!r)
2744
- return;
2746
+ continue;
2745
2747
  const a = t.point.distanceTo(r);
2746
2748
  a > o || a > this._config.snapDistance || (i = !0, e = r, o = t.point.distanceTo(r));
2747
- }), i ? e : this.config.showOnlyVertex ? null : t.point;
2749
+ }
2750
+ return i ? e : this.config.showOnlyVertex ? null : t.point;
2748
2751
  }
2749
2752
  getVertices(t) {
2750
2753
  const e = t.object;
2751
2754
  if (!t.face || !e)
2752
2755
  return null;
2753
- const i = e.geometry;
2754
- return [
2756
+ const i = e.geometry, o = new g.Matrix4(), { instanceId: n } = t, r = n !== void 0, a = e instanceof g.InstancedMesh;
2757
+ return a && r && e.getMatrixAt(n, o), [
2755
2758
  this.getVertex(t.face.a, i),
2756
2759
  this.getVertex(t.face.b, i),
2757
2760
  this.getVertex(t.face.c, i)
2758
- ].map((o) => o == null ? void 0 : o.applyMatrix4(e.matrixWorld));
2761
+ ].map((c) => (c && (a && r && c.applyMatrix4(o), c.applyMatrix4(e.matrixWorld)), c));
2759
2762
  }
2760
2763
  getVertex(t, e) {
2761
2764
  if (t === void 0)
@@ -3006,7 +3009,7 @@ class Or extends _i {
3006
3009
  }
3007
3010
  dispose(t = !0) {
3008
3011
  if (this.enabled = !1, this.isDisposing = !0, this.scene.onWorldChanged.trigger({ world: this, action: "removed" }), this.camera.onWorldChanged.trigger({ world: this, action: "removed" }), this.renderer && this.renderer.onWorldChanged.trigger({ world: this, action: "removed" }), t) {
3009
- const e = this.components.get(Ht);
3012
+ const e = this.components.get(zt);
3010
3013
  this.scene.dispose(), this.camera.isDisposeable() && this.camera.dispose(), this.renderer && this.renderer.dispose();
3011
3014
  for (const i of this.meshes)
3012
3015
  e.destroy(i);
@@ -3155,7 +3158,7 @@ const V = {
3155
3158
  IN: 1,
3156
3159
  OUT: -1
3157
3160
  };
3158
- function Qt(l) {
3161
+ function Zt(l) {
3159
3162
  return l.isPerspectiveCamera;
3160
3163
  }
3161
3164
  function bt(l) {
@@ -3195,16 +3198,16 @@ function an(l, s, t, e, i = 1 / 0, o, n) {
3195
3198
  e = Math.max(1e-4, e);
3196
3199
  const r = 2 / e, a = r * o, c = 1 / (1 + a + 0.48 * a * a + 0.235 * a * a * a);
3197
3200
  let h = s.x, d = s.y, E = s.z, u = l.x - h, p = l.y - d, A = l.z - E;
3198
- const R = h, C = d, T = E, F = i * e, f = F * F, m = u * u + p * p + A * A;
3199
- if (m > f) {
3200
- const B = Math.sqrt(m);
3201
+ const m = h, C = d, R = E, F = i * e, f = F * F, T = u * u + p * p + A * A;
3202
+ if (T > f) {
3203
+ const B = Math.sqrt(T);
3201
3204
  u = u / B * F, p = p / B * F, A = A / B * F;
3202
3205
  }
3203
3206
  h = l.x - u, d = l.y - p, E = l.z - A;
3204
3207
  const O = (t.x + r * u) * o, S = (t.y + r * p) * o, _ = (t.z + r * A) * o;
3205
3208
  t.x = (t.x - r * O) * c, t.y = (t.y - r * S) * c, t.z = (t.z - r * _) * c, n.x = h + (u + O) * c, n.y = d + (p + S) * c, n.z = E + (A + _) * c;
3206
- const N = R - l.x, L = C - l.y, M = T - l.z, y = n.x - R, x = n.y - C, b = n.z - T;
3207
- return N * y + L * x + M * b > 0 && (n.x = R, n.y = C, n.z = T, t.x = (n.x - R) / o, t.y = (n.y - C) / o, t.z = (n.z - T) / o), n;
3209
+ const N = m - l.x, L = C - l.y, M = R - l.z, y = n.x - m, x = n.y - C, b = n.z - R;
3210
+ return N * y + L * x + M * b > 0 && (n.x = m, n.y = C, n.z = R, t.x = (n.x - m) / o, t.y = (n.y - C) / o, t.z = (n.z - R) / o), n;
3208
3211
  }
3209
3212
  function Ks(l, s) {
3210
3213
  s.set(0, 0), l.forEach((t) => {
@@ -3279,7 +3282,7 @@ class gr {
3279
3282
  }
3280
3283
  }
3281
3284
  const Sr = "2.7.3", ds = 1 / 8, vn = typeof window < "u", _r = vn && /Mac/.test(navigator.platform), Nr = !(vn && "PointerEvent" in window);
3282
- let Y, cn, us, ti, lt, G, z, de, ye, gt, St, jt, ln, hn, dt, we, ue, En, ei, dn, si, ii, Is;
3285
+ let Y, cn, us, ti, lt, G, z, de, ye, gt, St, Qt, ln, hn, dt, we, ue, En, ei, dn, si, ii, Is;
3283
3286
  class ot extends gr {
3284
3287
  /**
3285
3288
  * Injects THREE as the dependency. You can then proceed to use CameraControls.
@@ -3322,7 +3325,7 @@ class ot extends gr {
3322
3325
  * @category Statics
3323
3326
  */
3324
3327
  static install(s) {
3325
- Y = s.THREE, cn = Object.freeze(new Y.Vector3(0, 0, 0)), us = Object.freeze(new Y.Vector3(0, 1, 0)), ti = Object.freeze(new Y.Vector3(0, 0, 1)), lt = new Y.Vector2(), G = new Y.Vector3(), z = new Y.Vector3(), de = new Y.Vector3(), ye = new Y.Vector3(), gt = new Y.Vector3(), St = new Y.Vector3(), jt = new Y.Vector3(), ln = new Y.Vector3(), hn = new Y.Vector3(), dt = new Y.Spherical(), we = new Y.Spherical(), ue = new Y.Box3(), En = new Y.Box3(), ei = new Y.Sphere(), dn = new Y.Quaternion(), si = new Y.Quaternion(), ii = new Y.Matrix4(), Is = new Y.Raycaster();
3328
+ Y = s.THREE, cn = Object.freeze(new Y.Vector3(0, 0, 0)), us = Object.freeze(new Y.Vector3(0, 1, 0)), ti = Object.freeze(new Y.Vector3(0, 0, 1)), lt = new Y.Vector2(), G = new Y.Vector3(), z = new Y.Vector3(), de = new Y.Vector3(), ye = new Y.Vector3(), gt = new Y.Vector3(), St = new Y.Vector3(), Qt = new Y.Vector3(), ln = new Y.Vector3(), hn = new Y.Vector3(), dt = new Y.Spherical(), we = new Y.Spherical(), ue = new Y.Box3(), En = new Y.Box3(), ei = new Y.Sphere(), dn = new Y.Quaternion(), si = new Y.Quaternion(), ii = new Y.Matrix4(), Is = new Y.Raycaster();
3326
3329
  }
3327
3330
  /**
3328
3331
  * list all ACTIONs
@@ -3350,26 +3353,26 @@ class ot extends gr {
3350
3353
  */
3351
3354
  constructor(s, t) {
3352
3355
  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 = () => {
3353
- }, 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 = he.NONE, this._thetaVelocity = { value: 0 }, this._phiVelocity = { value: 0 }, this._radiusVelocity = { value: 0 }, this._targetVelocity = new Y.Vector3(), this._focalOffsetVelocity = new Y.Vector3(), this._zoomVelocity = { value: 0 }, this._truckInternal = (f, m, O) => {
3356
+ }, 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 = he.NONE, this._thetaVelocity = { value: 0 }, this._phiVelocity = { value: 0 }, this._radiusVelocity = { value: 0 }, this._targetVelocity = new Y.Vector3(), this._focalOffsetVelocity = new Y.Vector3(), this._zoomVelocity = { value: 0 }, this._truckInternal = (f, T, O) => {
3354
3357
  let S, _;
3355
- if (Qt(this._camera)) {
3358
+ if (Zt(this._camera)) {
3356
3359
  const N = G.copy(this._camera.position).sub(this._target), L = this._camera.getEffectiveFOV() * Ne, M = N.length() * Math.tan(L * 0.5);
3357
- S = this.truckSpeed * f * M / this._elementRect.height, _ = this.truckSpeed * m * M / this._elementRect.height;
3360
+ S = this.truckSpeed * f * M / this._elementRect.height, _ = this.truckSpeed * T * M / this._elementRect.height;
3358
3361
  } else if (bt(this._camera)) {
3359
3362
  const N = this._camera;
3360
- S = f * (N.right - N.left) / N.zoom / this._elementRect.width, _ = m * (N.top - N.bottom) / N.zoom / this._elementRect.height;
3363
+ S = f * (N.right - N.left) / N.zoom / this._elementRect.width, _ = T * (N.top - N.bottom) / N.zoom / this._elementRect.height;
3361
3364
  } else
3362
3365
  return;
3363
3366
  this.verticalDragToForward ? (O ? this.setFocalOffset(this._focalOffsetEnd.x + S, this._focalOffsetEnd.y, this._focalOffsetEnd.z, !0) : this.truck(S, 0, !0), this.forward(-_, !0)) : O ? this.setFocalOffset(this._focalOffsetEnd.x + S, this._focalOffsetEnd.y + _, this._focalOffsetEnd.z, !0) : this.truck(S, _, !0);
3364
- }, this._rotateInternal = (f, m) => {
3365
- const O = Ee * this.azimuthRotateSpeed * f / this._elementRect.height, S = Ee * this.polarRotateSpeed * m / this._elementRect.height;
3367
+ }, this._rotateInternal = (f, T) => {
3368
+ const O = Ee * this.azimuthRotateSpeed * f / this._elementRect.height, S = Ee * this.polarRotateSpeed * T / this._elementRect.height;
3366
3369
  this.rotate(O, S, !0);
3367
- }, this._dollyInternal = (f, m, O) => {
3370
+ }, this._dollyInternal = (f, T, O) => {
3368
3371
  const S = Math.pow(0.95, -f * this.dollySpeed), _ = this._sphericalEnd.radius, N = this._sphericalEnd.radius * S, L = mt(N, this.minDistance, this.maxDistance), M = L - N;
3369
- this.infinityDolly && this.dollyToCursor ? this._dollyToNoClamp(N, !0) : this.infinityDolly && !this.dollyToCursor ? (this.dollyInFixed(M, !0), this._dollyToNoClamp(L, !0)) : this._dollyToNoClamp(L, !0), this.dollyToCursor && (this._changedDolly += (this.infinityDolly ? N : L) - _, this._dollyControlCoord.set(m, O)), this._lastDollyDirection = Math.sign(-f);
3370
- }, this._zoomInternal = (f, m, O) => {
3372
+ this.infinityDolly && this.dollyToCursor ? this._dollyToNoClamp(N, !0) : this.infinityDolly && !this.dollyToCursor ? (this.dollyInFixed(M, !0), this._dollyToNoClamp(L, !0)) : this._dollyToNoClamp(L, !0), this.dollyToCursor && (this._changedDolly += (this.infinityDolly ? N : L) - _, this._dollyControlCoord.set(T, O)), this._lastDollyDirection = Math.sign(-f);
3373
+ }, this._zoomInternal = (f, T, O) => {
3371
3374
  const S = Math.pow(0.95, f * this.dollySpeed), _ = this._zoom, N = this._zoom * S;
3372
- this.zoomTo(N, !0), this.dollyToCursor && (this._changedZoom += N - _, this._dollyControlCoord.set(m, O));
3375
+ this.zoomTo(N, !0), this.dollyToCursor && (this._changedZoom += N - _, this._dollyControlCoord.set(T, O));
3373
3376
  }, typeof Y > "u" && console.error("camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."), this._camera = s, this._yAxisUpSpace = new Y.Quaternion().setFromUnitVectors(this._camera.up, us), this._yAxisUpSpaceInverse = this._yAxisUpSpace.clone().invert(), this._state = P.NONE, this._target = new Y.Vector3(), this._targetEnd = this._target.clone(), this._focalOffset = new Y.Vector3(), this._focalOffsetEnd = this._focalOffset.clone(), this._spherical = new Y.Spherical().setFromVector3(G.copy(this._camera.position).applyQuaternion(this._yAxisUpSpace)), this._sphericalEnd = this._spherical.clone(), this._lastDistance = this._spherical.radius, this._zoom = this._camera.zoom, this._zoomEnd = this._zoom, this._lastZoom = this._zoom, this._nearPlaneCorners = [
3374
3377
  new Y.Vector3(),
3375
3378
  new Y.Vector3(),
@@ -3379,10 +3382,10 @@ class ot extends gr {
3379
3382
  left: P.ROTATE,
3380
3383
  middle: P.DOLLY,
3381
3384
  right: P.TRUCK,
3382
- wheel: Qt(this._camera) ? P.DOLLY : bt(this._camera) ? P.ZOOM : P.NONE
3385
+ wheel: Zt(this._camera) ? P.DOLLY : bt(this._camera) ? P.ZOOM : P.NONE
3383
3386
  }, this.touches = {
3384
3387
  one: P.TOUCH_ROTATE,
3385
- two: Qt(this._camera) ? P.TOUCH_DOLLY_TRUCK : bt(this._camera) ? P.TOUCH_ZOOM_TRUCK : P.NONE,
3388
+ two: Zt(this._camera) ? P.TOUCH_DOLLY_TRUCK : bt(this._camera) ? P.TOUCH_ZOOM_TRUCK : P.NONE,
3386
3389
  three: P.TOUCH_TRUCK
3387
3390
  };
3388
3391
  const e = new Y.Vector2(), i = new Y.Vector2(), o = new Y.Vector2(), n = (f) => {
@@ -3393,9 +3396,9 @@ class ot extends gr {
3393
3396
  if (_ < this._interactiveArea.left || _ > this._interactiveArea.right || N < this._interactiveArea.top || N > this._interactiveArea.bottom)
3394
3397
  return;
3395
3398
  }
3396
- const m = f.pointerType !== "mouse" ? null : (f.buttons & V.LEFT) === V.LEFT ? V.LEFT : (f.buttons & V.MIDDLE) === V.MIDDLE ? V.MIDDLE : (f.buttons & V.RIGHT) === V.RIGHT ? V.RIGHT : null;
3397
- if (m !== null) {
3398
- const S = this._findPointerByMouseButton(m);
3399
+ const T = f.pointerType !== "mouse" ? null : (f.buttons & V.LEFT) === V.LEFT ? V.LEFT : (f.buttons & V.MIDDLE) === V.MIDDLE ? V.MIDDLE : (f.buttons & V.RIGHT) === V.RIGHT ? V.RIGHT : null;
3400
+ if (T !== null) {
3401
+ const S = this._findPointerByMouseButton(T);
3399
3402
  S && this._disposePointer(S);
3400
3403
  }
3401
3404
  if ((f.buttons & V.LEFT) === V.LEFT && this._lockedPointer)
@@ -3406,7 +3409,7 @@ class ot extends gr {
3406
3409
  clientY: f.clientY,
3407
3410
  deltaX: 0,
3408
3411
  deltaY: 0,
3409
- mouseButton: m
3412
+ mouseButton: T
3410
3413
  };
3411
3414
  this._activePointers.push(O), 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, A(f);
3412
3415
  }, r = (f) => {
@@ -3417,9 +3420,9 @@ class ot extends gr {
3417
3420
  if (_ < this._interactiveArea.left || _ > this._interactiveArea.right || N < this._interactiveArea.top || N > this._interactiveArea.bottom)
3418
3421
  return;
3419
3422
  }
3420
- const m = (f.buttons & V.LEFT) === V.LEFT ? V.LEFT : (f.buttons & V.MIDDLE) === V.MIDDLE ? V.MIDDLE : (f.buttons & V.RIGHT) === V.RIGHT ? V.RIGHT : null;
3421
- if (m !== null) {
3422
- const S = this._findPointerByMouseButton(m);
3423
+ const T = (f.buttons & V.LEFT) === V.LEFT ? V.LEFT : (f.buttons & V.MIDDLE) === V.MIDDLE ? V.MIDDLE : (f.buttons & V.RIGHT) === V.RIGHT ? V.RIGHT : null;
3424
+ if (T !== null) {
3425
+ const S = this._findPointerByMouseButton(T);
3423
3426
  S && this._disposePointer(S);
3424
3427
  }
3425
3428
  const O = {
@@ -3433,7 +3436,7 @@ class ot extends gr {
3433
3436
  this._activePointers.push(O), 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, A(f);
3434
3437
  }, a = (f) => {
3435
3438
  f.cancelable && f.preventDefault();
3436
- const m = f.pointerId, O = this._lockedPointer || this._findPointerById(m);
3439
+ const T = f.pointerId, O = this._lockedPointer || this._findPointerById(T);
3437
3440
  if (O) {
3438
3441
  if (O.clientX = f.clientX, O.clientY = f.clientY, O.deltaX = f.movementX, O.deltaY = f.movementY, this._state = 0, f.pointerType === "touch")
3439
3442
  switch (this._activePointers.length) {
@@ -3449,15 +3452,15 @@ class ot extends gr {
3449
3452
  }
3450
3453
  else
3451
3454
  (!this._isDragging && this._lockedPointer || this._isDragging && (f.buttons & V.LEFT) === V.LEFT) && (this._state = this._state | this.mouseButtons.left), this._isDragging && (f.buttons & V.MIDDLE) === V.MIDDLE && (this._state = this._state | this.mouseButtons.middle), this._isDragging && (f.buttons & V.RIGHT) === V.RIGHT && (this._state = this._state | this.mouseButtons.right);
3452
- R();
3455
+ m();
3453
3456
  }
3454
3457
  }, c = (f) => {
3455
- const m = this._lockedPointer || this._findPointerById(1);
3456
- m && (m.clientX = f.clientX, m.clientY = f.clientY, m.deltaX = f.movementX, m.deltaY = f.movementY, this._state = 0, (this._lockedPointer || (f.buttons & V.LEFT) === V.LEFT) && (this._state = this._state | this.mouseButtons.left), (f.buttons & V.MIDDLE) === V.MIDDLE && (this._state = this._state | this.mouseButtons.middle), (f.buttons & V.RIGHT) === V.RIGHT && (this._state = this._state | this.mouseButtons.right), R());
3458
+ const T = this._lockedPointer || this._findPointerById(1);
3459
+ T && (T.clientX = f.clientX, T.clientY = f.clientY, T.deltaX = f.movementX, T.deltaY = f.movementY, this._state = 0, (this._lockedPointer || (f.buttons & V.LEFT) === V.LEFT) && (this._state = this._state | this.mouseButtons.left), (f.buttons & V.MIDDLE) === V.MIDDLE && (this._state = this._state | this.mouseButtons.middle), (f.buttons & V.RIGHT) === V.RIGHT && (this._state = this._state | this.mouseButtons.right), m());
3457
3460
  }, h = (f) => {
3458
- const m = this._findPointerById(f.pointerId);
3459
- if (!(m && m === this._lockedPointer)) {
3460
- if (m && this._disposePointer(m), f.pointerType === "touch")
3461
+ const T = this._findPointerById(f.pointerId);
3462
+ if (!(T && T === this._lockedPointer)) {
3463
+ if (T && this._disposePointer(T), f.pointerType === "touch")
3461
3464
  switch (this._activePointers.length) {
3462
3465
  case 0:
3463
3466
  this._state = P.NONE;
@@ -3493,7 +3496,7 @@ class ot extends gr {
3493
3496
  const N = performance.now();
3494
3497
  E - N < 1e3 && this._getClientRect(this._elementRect), E = N;
3495
3498
  }
3496
- const m = _r ? -1 : -3, O = f.deltaMode === 1 ? f.deltaY / m : f.deltaY / (m * 10), S = this.dollyToCursor ? (f.clientX - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, _ = this.dollyToCursor ? (f.clientY - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
3499
+ const T = _r ? -1 : -3, O = f.deltaMode === 1 ? f.deltaY / T : f.deltaY / (T * 10), S = this.dollyToCursor ? (f.clientX - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, _ = this.dollyToCursor ? (f.clientY - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
3497
3500
  switch (this.mouseButtons.wheel) {
3498
3501
  case P.ROTATE: {
3499
3502
  this._rotateInternal(f.deltaX, f.deltaY), this._isUserControllingRotate = !0;
@@ -3520,7 +3523,7 @@ class ot extends gr {
3520
3523
  }, p = (f) => {
3521
3524
  if (!(!this._domElement || !this._enabled)) {
3522
3525
  if (this.mouseButtons.right === ot.ACTION.NONE) {
3523
- const m = f instanceof PointerEvent ? f.pointerId : (f instanceof MouseEvent, 0), O = this._findPointerById(m);
3526
+ const T = f instanceof PointerEvent ? f.pointerId : (f instanceof MouseEvent, 0), O = this._findPointerById(T);
3524
3527
  O && this._disposePointer(O), 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);
3525
3528
  return;
3526
3529
  }
@@ -3552,11 +3555,11 @@ class ot extends gr {
3552
3555
  else
3553
3556
  !this._lockedPointer && (f.buttons & V.LEFT) === V.LEFT && (this._state = this._state | this.mouseButtons.left), (f.buttons & V.MIDDLE) === V.MIDDLE && (this._state = this._state | this.mouseButtons.middle), (f.buttons & V.RIGHT) === V.RIGHT && (this._state = this._state | this.mouseButtons.right);
3554
3557
  ((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" });
3555
- }, R = () => {
3558
+ }, m = () => {
3556
3559
  if (!this._enabled || !this._dragNeedsUpdate)
3557
3560
  return;
3558
3561
  this._dragNeedsUpdate = !1, Ks(this._activePointers, lt);
3559
- const m = this._domElement && document.pointerLockElement === this._domElement ? this._lockedPointer || this._activePointers[0] : null, O = m ? -m.deltaX : i.x - lt.x, S = m ? -m.deltaY : i.y - lt.y;
3562
+ const T = this._domElement && document.pointerLockElement === this._domElement ? this._lockedPointer || this._activePointers[0] : null, O = T ? -T.deltaX : i.x - lt.x, S = T ? -T.deltaY : i.y - lt.y;
3560
3563
  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(O, S), this._isUserControllingRotate = !0), (this._state & P.DOLLY) === P.DOLLY || (this._state & P.ZOOM) === P.ZOOM) {
3561
3564
  const _ = this.dollyToCursor ? (e.x - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, N = this.dollyToCursor ? (e.y - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0, L = this.dollyDragInverted ? -1 : 1;
3562
3565
  (this._state & P.DOLLY) === P.DOLLY ? (this._dollyInternal(L * S * ds, _, N), this._isUserControllingDolly = !0) : (this._zoomInternal(L * S * ds, _, N), this._isUserControllingZoom = !0);
@@ -3579,11 +3582,11 @@ class ot extends gr {
3579
3582
  deltaX: 0,
3580
3583
  deltaY: 0,
3581
3584
  mouseButton: null
3582
- }, 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", T), this._domElement.ownerDocument.addEventListener("pointerlockerror", F), this._domElement.ownerDocument.addEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.addEventListener("pointerup", h), A());
3585
+ }, 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", R), this._domElement.ownerDocument.addEventListener("pointerlockerror", F), this._domElement.ownerDocument.addEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.addEventListener("pointerup", h), A());
3583
3586
  }, this.unlockPointer = () => {
3584
- this._lockedPointer !== null && (this._disposePointer(this._lockedPointer), this._lockedPointer = null), document.exitPointerLock(), this.cancel(), this._domElement && (this._domElement.ownerDocument.removeEventListener("pointerlockchange", T), this._domElement.ownerDocument.removeEventListener("pointerlockerror", F));
3587
+ this._lockedPointer !== null && (this._disposePointer(this._lockedPointer), this._lockedPointer = null), document.exitPointerLock(), this.cancel(), this._domElement && (this._domElement.ownerDocument.removeEventListener("pointerlockchange", R), this._domElement.ownerDocument.removeEventListener("pointerlockerror", F));
3585
3588
  };
3586
- const T = () => {
3589
+ const R = () => {
3587
3590
  this._domElement && this._domElement.ownerDocument.pointerLockElement === this._domElement || this.unlockPointer();
3588
3591
  }, F = () => {
3589
3592
  this.unlockPointer();
@@ -3591,7 +3594,7 @@ class ot extends gr {
3591
3594
  this._addAllEventListeners = (f) => {
3592
3595
  this._domElement = f, 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", p);
3593
3596
  }, this._removeAllEventListeners = () => {
3594
- 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", p), 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", T), this._domElement.ownerDocument.removeEventListener("pointerlockerror", F));
3597
+ 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", p), 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", R), this._domElement.ownerDocument.removeEventListener("pointerlockerror", F));
3595
3598
  }, this.cancel = () => {
3596
3599
  this._state !== P.NONE && (this._state = P.NONE, this._activePointers.length = 0, C());
3597
3600
  }, t && this.connect(t), this.update(0);
@@ -3964,13 +3967,13 @@ class ot extends gr {
3964
3967
  p && u.multiply(si.setFromAxisAngle(us, h)), u.multiply(this._yAxisUpSpaceInverse);
3965
3968
  const A = En.makeEmpty();
3966
3969
  z.copy(c.min).applyQuaternion(u), A.expandByPoint(z), z.copy(c.min).setX(c.max.x).applyQuaternion(u), A.expandByPoint(z), z.copy(c.min).setY(c.max.y).applyQuaternion(u), A.expandByPoint(z), z.copy(c.max).setZ(c.min.z).applyQuaternion(u), A.expandByPoint(z), z.copy(c.min).setZ(c.max.z).applyQuaternion(u), A.expandByPoint(z), z.copy(c.max).setY(c.min.y).applyQuaternion(u), A.expandByPoint(z), z.copy(c.max).setX(c.min.x).applyQuaternion(u), A.expandByPoint(z), z.copy(c.max).applyQuaternion(u), A.expandByPoint(z), A.min.x -= i, A.min.y -= n, A.max.x += o, A.max.y += r, u.setFromUnitVectors(ti, E), p && u.premultiply(si.invert()), u.premultiply(this._yAxisUpSpace);
3967
- const R = A.getSize(G), C = A.getCenter(z).applyQuaternion(u);
3968
- if (Qt(this._camera)) {
3969
- const T = this.getDistanceToFitBox(R.x, R.y, R.z, e);
3970
- a.push(this.moveTo(C.x, C.y, C.z, t)), a.push(this.dollyTo(T, t)), a.push(this.setFocalOffset(0, 0, 0, t));
3970
+ const m = A.getSize(G), C = A.getCenter(z).applyQuaternion(u);
3971
+ if (Zt(this._camera)) {
3972
+ const R = this.getDistanceToFitBox(m.x, m.y, m.z, e);
3973
+ a.push(this.moveTo(C.x, C.y, C.z, t)), a.push(this.dollyTo(R, t)), a.push(this.setFocalOffset(0, 0, 0, t));
3971
3974
  } else if (bt(this._camera)) {
3972
- const T = this._camera, F = T.right - T.left, f = T.top - T.bottom, m = e ? Math.max(F / R.x, f / R.y) : Math.min(F / R.x, f / R.y);
3973
- 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));
3975
+ const R = this._camera, F = R.right - R.left, f = R.top - R.bottom, T = e ? Math.max(F / m.x, f / m.y) : Math.min(F / m.x, f / m.y);
3976
+ 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));
3974
3977
  }
3975
3978
  return Promise.all(a);
3976
3979
  }
@@ -3982,7 +3985,7 @@ class ot extends gr {
3982
3985
  */
3983
3986
  fitToSphere(s, t) {
3984
3987
  const e = [], o = s instanceof Y.Sphere ? ei.copy(s) : ot.createBoundingSphere(s, ei);
3985
- if (e.push(this.moveTo(o.center.x, o.center.y, o.center.z, t)), Qt(this._camera)) {
3988
+ if (e.push(this.moveTo(o.center.x, o.center.y, o.center.z, t)), Zt(this._camera)) {
3986
3989
  const n = this.getDistanceToFitSphere(o.radius);
3987
3990
  e.push(this.dollyTo(n, t));
3988
3991
  } else if (bt(this._camera)) {
@@ -4029,12 +4032,12 @@ class ot extends gr {
4029
4032
  */
4030
4033
  lerpLookAt(s, t, e, i, o, n, r, a, c, h, d, E, u, p = !1) {
4031
4034
  this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection = he.NONE, this._changedDolly = 0;
4032
- const A = G.set(i, o, n), R = z.set(s, t, e);
4033
- dt.setFromVector3(R.sub(A).applyQuaternion(this._yAxisUpSpace));
4034
- const C = de.set(h, d, E), T = z.set(r, a, c);
4035
- we.setFromVector3(T.sub(C).applyQuaternion(this._yAxisUpSpace)), this._targetEnd.copy(A.lerp(C, u));
4036
- const F = we.theta - dt.theta, f = we.phi - dt.phi, m = we.radius - dt.radius;
4037
- this._sphericalEnd.set(dt.radius + m * u, dt.phi + f * u, dt.theta + F * u), this.normalizeRotations(), this._needsUpdate = !0, p || (this._target.copy(this._targetEnd), this._spherical.copy(this._sphericalEnd));
4035
+ const A = G.set(i, o, n), m = z.set(s, t, e);
4036
+ dt.setFromVector3(m.sub(A).applyQuaternion(this._yAxisUpSpace));
4037
+ const C = de.set(h, d, E), R = z.set(r, a, c);
4038
+ we.setFromVector3(R.sub(C).applyQuaternion(this._yAxisUpSpace)), this._targetEnd.copy(A.lerp(C, u));
4039
+ const F = we.theta - dt.theta, f = we.phi - dt.phi, T = we.radius - dt.radius;
4040
+ this._sphericalEnd.set(dt.radius + T * u, dt.phi + f * u, dt.theta + F * u), this.normalizeRotations(), this._needsUpdate = !0, p || (this._target.copy(this._targetEnd), this._spherical.copy(this._sphericalEnd));
4038
4041
  const O = !p || k(this._target.x, this._targetEnd.x, this.restThreshold) && k(this._target.y, this._targetEnd.y, this.restThreshold) && k(this._target.z, this._targetEnd.z, this.restThreshold) && k(this._spherical.theta, this._sphericalEnd.theta, this.restThreshold) && k(this._spherical.phi, this._sphericalEnd.phi, this.restThreshold) && k(this._spherical.radius, this._sphericalEnd.radius, this.restThreshold);
4039
4042
  return this._createOnRestPromise(O);
4040
4043
  }
@@ -4085,9 +4088,9 @@ class ot extends gr {
4085
4088
  * @category Methods
4086
4089
  */
4087
4090
  setOrbitPoint(s, t, e) {
4088
- this._camera.updateMatrixWorld(), gt.setFromMatrixColumn(this._camera.matrixWorldInverse, 0), St.setFromMatrixColumn(this._camera.matrixWorldInverse, 1), jt.setFromMatrixColumn(this._camera.matrixWorldInverse, 2);
4091
+ this._camera.updateMatrixWorld(), gt.setFromMatrixColumn(this._camera.matrixWorldInverse, 0), St.setFromMatrixColumn(this._camera.matrixWorldInverse, 1), Qt.setFromMatrixColumn(this._camera.matrixWorldInverse, 2);
4089
4092
  const i = G.set(s, t, e), o = i.distanceTo(this._camera.position), n = i.sub(this._camera.position);
4090
- gt.multiplyScalar(n.x), St.multiplyScalar(n.y), jt.multiplyScalar(n.z), G.copy(gt).add(St).add(jt), G.z = G.z + o, this.dollyTo(o, !1), this.setFocalOffset(-G.x, G.y, -G.z, !1), this.moveTo(s, t, e, !1);
4093
+ gt.multiplyScalar(n.x), St.multiplyScalar(n.y), Qt.multiplyScalar(n.z), G.copy(gt).add(St).add(Qt), G.z = G.z + o, this.dollyTo(o, !1), this.setFocalOffset(-G.x, G.y, -G.z, !1), this.moveTo(s, t, e, !1);
4091
4094
  }
4092
4095
  /**
4093
4096
  * Set the boundary box that encloses the target of the camera. box3 is in THREE.Box3
@@ -4276,11 +4279,11 @@ class ot extends gr {
4276
4279
  this._zoom = Es(this._zoom, this._zoomEnd, this._zoomVelocity, d, 1 / 0, s);
4277
4280
  }
4278
4281
  if (this.dollyToCursor) {
4279
- if (Qt(this._camera) && this._changedDolly !== 0) {
4282
+ if (Zt(this._camera) && this._changedDolly !== 0) {
4280
4283
  const d = this._spherical.radius - this._lastDistance, E = this._camera, u = this._getCameraDirection(ye), p = G.copy(u).cross(E.up).normalize();
4281
4284
  p.lengthSq() === 0 && (p.x = 1);
4282
- const A = z.crossVectors(p, u), R = this._sphericalEnd.radius * Math.tan(E.getEffectiveFOV() * Ne * 0.5), T = (this._sphericalEnd.radius - d - this._sphericalEnd.radius) / this._sphericalEnd.radius, F = de.copy(this._targetEnd).add(p.multiplyScalar(this._dollyControlCoord.x * R * E.aspect)).add(A.multiplyScalar(this._dollyControlCoord.y * R)), f = G.copy(this._targetEnd).lerp(F, T), m = this._lastDollyDirection === he.IN && this._spherical.radius <= this.minDistance, O = this._lastDollyDirection === he.OUT && this.maxDistance <= this._spherical.radius;
4283
- if (this.infinityDolly && (m || O)) {
4285
+ const A = z.crossVectors(p, u), m = this._sphericalEnd.radius * Math.tan(E.getEffectiveFOV() * Ne * 0.5), R = (this._sphericalEnd.radius - d - this._sphericalEnd.radius) / this._sphericalEnd.radius, F = de.copy(this._targetEnd).add(p.multiplyScalar(this._dollyControlCoord.x * m * E.aspect)).add(A.multiplyScalar(this._dollyControlCoord.y * m)), f = G.copy(this._targetEnd).lerp(F, R), T = this._lastDollyDirection === he.IN && this._spherical.radius <= this.minDistance, O = this._lastDollyDirection === he.OUT && this.maxDistance <= this._spherical.radius;
4286
+ if (this.infinityDolly && (T || O)) {
4284
4287
  this._sphericalEnd.radius -= d, this._spherical.radius -= d;
4285
4288
  const _ = z.copy(u).multiplyScalar(-d);
4286
4289
  f.add(_);
@@ -4289,7 +4292,7 @@ class ot extends gr {
4289
4292
  const S = z.subVectors(f, this._targetEnd);
4290
4293
  this._targetEnd.copy(f), this._target.add(S), this._changedDolly -= d, X(this._changedDolly) && (this._changedDolly = 0);
4291
4294
  } else if (bt(this._camera) && this._changedZoom !== 0) {
4292
- 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), p = z.set(0, 0, -1).applyQuaternion(E.quaternion), A = de.copy(u).add(p.multiplyScalar(-u.dot(E.up))), C = -(this._zoom - d - this._zoom) / this._zoom, T = this._getCameraDirection(ye), F = this._targetEnd.dot(T), f = G.copy(this._targetEnd).lerp(A, C), m = f.dot(T), O = T.multiplyScalar(m - F);
4295
+ 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), p = z.set(0, 0, -1).applyQuaternion(E.quaternion), A = de.copy(u).add(p.multiplyScalar(-u.dot(E.up))), C = -(this._zoom - d - this._zoom) / this._zoom, R = this._getCameraDirection(ye), F = this._targetEnd.dot(R), f = G.copy(this._targetEnd).lerp(A, C), T = f.dot(R), O = R.multiplyScalar(T - F);
4293
4296
  f.sub(O), this._boundary.clampPoint(f, f);
4294
4297
  const S = z.subVectors(f, this._targetEnd);
4295
4298
  this._targetEnd.copy(f), this._target.add(S), this._changedZoom -= d, X(this._changedZoom) && (this._changedZoom = 0);
@@ -4297,7 +4300,7 @@ class ot extends gr {
4297
4300
  }
4298
4301
  this._camera.zoom !== this._zoom && (this._camera.zoom = this._zoom, this._camera.updateProjectionMatrix(), this._updateNearPlaneCorners(), this._needsUpdate = !0), this._dragNeedsUpdate = !0;
4299
4302
  const a = this._collisionTest();
4300
- this._spherical.radius = Math.min(this._spherical.radius, a), this._spherical.makeSafe(), this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target), this._camera.lookAt(this._target), (!X(this._focalOffset.x) || !X(this._focalOffset.y) || !X(this._focalOffset.z)) && (this._camera.updateMatrixWorld(), gt.setFromMatrixColumn(this._camera.matrix, 0), St.setFromMatrixColumn(this._camera.matrix, 1), jt.setFromMatrixColumn(this._camera.matrix, 2), gt.multiplyScalar(this._focalOffset.x), St.multiplyScalar(-this._focalOffset.y), jt.multiplyScalar(this._focalOffset.z), G.copy(gt).add(St).add(jt), this._camera.position.add(G)), this._boundaryEnclosesCamera && this._encloseToBoundary(this._camera.position.copy(this._target), G.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse), 1);
4303
+ this._spherical.radius = Math.min(this._spherical.radius, a), this._spherical.makeSafe(), this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target), this._camera.lookAt(this._target), (!X(this._focalOffset.x) || !X(this._focalOffset.y) || !X(this._focalOffset.z)) && (this._camera.updateMatrixWorld(), gt.setFromMatrixColumn(this._camera.matrix, 0), St.setFromMatrixColumn(this._camera.matrix, 1), Qt.setFromMatrixColumn(this._camera.matrix, 2), gt.multiplyScalar(this._focalOffset.x), St.multiplyScalar(-this._focalOffset.y), Qt.multiplyScalar(this._focalOffset.z), G.copy(gt).add(St).add(Qt), this._camera.position.add(G)), this._boundaryEnclosesCamera && this._encloseToBoundary(this._camera.position.copy(this._target), G.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse), 1);
4301
4304
  const h = this._needsUpdate;
4302
4305
  return h && !this._updatedLastTime ? (this._hasRested = !1, this.dispatchEvent({ type: "wake" }), this.dispatchEvent({ type: "update" })) : h ? (this.dispatchEvent({ type: "update" }), X(t, this.restThreshold) && X(e, this.restThreshold) && X(i, this.restThreshold) && X(o.x, this.restThreshold) && X(o.y, this.restThreshold) && X(o.z, this.restThreshold) && X(n.x, this.restThreshold) && X(n.y, this.restThreshold) && X(n.z, this.restThreshold) && X(r, this.restThreshold) && !this._hasRested && (this._hasRested = !0, this.dispatchEvent({ type: "rest" }))) : !h && this._updatedLastTime && this.dispatchEvent({ type: "sleep" }), this._lastDistance = this._spherical.radius, this._lastZoom = this._zoom, this._updatedLastTime = h, this._needsUpdate = !1, h;
4303
4306
  }
@@ -4400,7 +4403,7 @@ class ot extends gr {
4400
4403
  }
4401
4404
  }
4402
4405
  _updateNearPlaneCorners() {
4403
- if (Qt(this._camera)) {
4406
+ if (Zt(this._camera)) {
4404
4407
  const s = this._camera, t = s.near, e = s.getEffectiveFOV() * Ne, i = Math.tan(e * 0.5) * t, o = i * s.aspect;
4405
4408
  this._nearPlaneCorners[0].set(-o, -i, 0), this._nearPlaneCorners[1].set(o, -i, 0), this._nearPlaneCorners[2].set(o, i, 0), this._nearPlaneCorners[3].set(-o, i, 0);
4406
4409
  } else if (bt(this._camera)) {
@@ -4803,7 +4806,7 @@ class Pr {
4803
4806
  }
4804
4807
  /** {@link Disposable.dispose} */
4805
4808
  dispose() {
4806
- this.setupEvents(!1), this.components.get(Ht).destroy(this.three), this.onDisposed.trigger(), this.onDisposed.reset(), this.world = null, this.components = null;
4809
+ this.setupEvents(!1), this.components.get(zt).destroy(this.three), this.onDisposed.trigger(), this.onDisposed.reset(), this.world = null, this.components = null;
4807
4810
  }
4808
4811
  setupEvents(s) {
4809
4812
  if (this.world.isDisposing || !(this.world.camera instanceof ke))
@@ -4847,7 +4850,7 @@ const Ss = class Ss extends J {
4847
4850
  };
4848
4851
  I(Ss, "uuid", "d1e814d5-b81c-4452-87a2-f039375e0489");
4849
4852
  let un = Ss;
4850
- const qt = new qn(), nt = new w(), xt = new w(), j = new Pt(), In = {
4853
+ const jt = new qn(), nt = new w(), xt = new w(), j = new Pt(), In = {
4851
4854
  X: new w(1, 0, 0),
4852
4855
  Y: new w(0, 1, 0),
4853
4856
  Z: new w(0, 0, 1)
@@ -4860,20 +4863,20 @@ class Lr extends ri {
4860
4863
  const i = new br();
4861
4864
  this._plane = i, this.add(i);
4862
4865
  const o = this;
4863
- function n(T, F) {
4866
+ function n(R, F) {
4864
4867
  let f = F;
4865
- Object.defineProperty(o, T, {
4868
+ Object.defineProperty(o, R, {
4866
4869
  get: function() {
4867
4870
  return f !== void 0 ? f : F;
4868
4871
  },
4869
- set: function(m) {
4870
- f !== m && (f = m, i[T] = m, e[T] = m, o.dispatchEvent({ type: T + "-changed", value: m }), o.dispatchEvent(ni));
4872
+ set: function(T) {
4873
+ f !== T && (f = T, i[R] = T, e[R] = T, o.dispatchEvent({ type: R + "-changed", value: T }), o.dispatchEvent(ni));
4871
4874
  }
4872
- }), o[T] = F, i[T] = F, e[T] = F;
4875
+ }), o[R] = F, i[R] = F, e[R] = F;
4873
4876
  }
4874
4877
  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);
4875
- const r = new w(), a = new w(), c = new Pt(), h = new Pt(), d = new w(), E = new Pt(), u = new w(), p = new w(), A = new w(), R = 0, C = new w();
4876
- n("worldPosition", r), n("worldPositionStart", a), n("worldQuaternion", c), n("worldQuaternionStart", h), n("cameraPosition", d), n("cameraQuaternion", E), n("pointStart", u), n("pointEnd", p), n("rotationAxis", A), n("rotationAngle", R), n("eye", C), this._offset = new w(), this._startNorm = new w(), this._endNorm = new w(), this._cameraScale = new w(), this._parentPosition = new w(), this._parentQuaternion = new Pt(), this._parentQuaternionInv = new Pt(), this._parentScale = new w(), this._worldScaleStart = new w(), this._worldQuaternionInv = new Pt(), this._worldScale = new w(), this._positionStart = new w(), this._quaternionStart = new Pt(), this._scaleStart = new w(), this._getPointer = yr.bind(this), this._onPointerDown = Mr.bind(this), this._onPointerHover = wr.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);
4878
+ const r = new w(), a = new w(), c = new Pt(), h = new Pt(), d = new w(), E = new Pt(), u = new w(), p = new w(), A = new w(), m = 0, C = new w();
4879
+ n("worldPosition", r), n("worldPositionStart", a), n("worldQuaternion", c), n("worldQuaternionStart", h), n("cameraPosition", d), n("cameraQuaternion", E), n("pointStart", u), n("pointEnd", p), n("rotationAxis", A), n("rotationAngle", m), n("eye", C), this._offset = new w(), this._startNorm = new w(), this._endNorm = new w(), this._cameraScale = new w(), this._parentPosition = new w(), this._parentQuaternion = new Pt(), this._parentQuaternionInv = new Pt(), this._parentScale = new w(), this._worldScaleStart = new w(), this._worldQuaternionInv = new Pt(), this._worldScale = new w(), this._positionStart = new w(), this._quaternionStart = new Pt(), this._scaleStart = new w(), this._getPointer = yr.bind(this), this._onPointerDown = Mr.bind(this), this._onPointerHover = wr.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);
4877
4880
  }
4878
4881
  // updateMatrixWorld updates key transformation variables
4879
4882
  updateMatrixWorld() {
@@ -4882,14 +4885,14 @@ class Lr extends ri {
4882
4885
  pointerHover(s) {
4883
4886
  if (this.object === void 0 || this.dragging === !0)
4884
4887
  return;
4885
- qt.setFromCamera(s, this.camera);
4886
- const t = oi(this._gizmo.picker[this.mode], qt);
4888
+ jt.setFromCamera(s, this.camera);
4889
+ const t = oi(this._gizmo.picker[this.mode], jt);
4887
4890
  t ? this.axis = t.object.name : this.axis = null;
4888
4891
  }
4889
4892
  pointerDown(s) {
4890
4893
  if (!(this.object === void 0 || this.dragging === !0 || s.button !== 0) && this.axis !== null) {
4891
- qt.setFromCamera(s, this.camera);
4892
- const t = oi(this._plane, qt, !0);
4894
+ jt.setFromCamera(s, this.camera);
4895
+ const t = oi(this._plane, jt, !0);
4893
4896
  t && (this.object.updateMatrixWorld(), this.object.parent.updateMatrixWorld(), this._positionStart.copy(this.object.position), this._quaternionStart.copy(this.object.quaternion), this._scaleStart.copy(this.object.scale), this.object.matrixWorld.decompose(this.worldPositionStart, this.worldQuaternionStart, this._worldScaleStart), this.pointStart.copy(t.point).sub(this.worldPositionStart)), this.dragging = !0, fn.mode = this.mode, this.dispatchEvent(fn);
4894
4897
  }
4895
4898
  }
@@ -4898,8 +4901,8 @@ class Lr extends ri {
4898
4901
  let o = this.space;
4899
4902
  if (e === "scale" ? o = "local" : (t === "E" || t === "XYZE" || t === "XYZ") && (o = "world"), i === void 0 || t === null || this.dragging === !1 || s.button !== -1)
4900
4903
  return;
4901
- qt.setFromCamera(s, this.camera);
4902
- const n = oi(this._plane, qt, !0);
4904
+ jt.setFromCamera(s, this.camera);
4905
+ const n = oi(this._plane, jt, !0);
4903
4906
  if (n) {
4904
4907
  if (this.pointEnd.copy(n.point).sub(this.worldPositionStart), e === "translate")
4905
4908
  this._offset.copy(this.pointEnd).sub(this.pointStart), o === "local" && t !== "XYZ" && this._offset.applyQuaternion(this._worldQuaternionInv), t.indexOf("X") === -1 && (this._offset.x = 0), t.indexOf("Y") === -1 && (this._offset.y = 0), t.indexOf("Z") === -1 && (this._offset.z = 0), o === "local" && t !== "XYZ" ? this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale) : this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale), i.position.copy(this._offset).add(this._positionStart), this.translationSnap && (o === "local" && (i.position.applyQuaternion(j.copy(this._quaternionStart).invert()), t.search("X") !== -1 && (i.position.x = Math.round(i.position.x / this.translationSnap) * this.translationSnap), t.search("Y") !== -1 && (i.position.y = Math.round(i.position.y / this.translationSnap) * this.translationSnap), t.search("Z") !== -1 && (i.position.z = Math.round(i.position.z / this.translationSnap) * this.translationSnap), i.position.applyQuaternion(this._quaternionStart)), o === "world" && (i.parent && i.position.add(nt.setFromMatrixPosition(i.parent.matrixWorld)), t.search("X") !== -1 && (i.position.x = Math.round(i.position.x / this.translationSnap) * this.translationSnap), t.search("Y") !== -1 && (i.position.y = Math.round(i.position.y / this.translationSnap) * this.translationSnap), t.search("Z") !== -1 && (i.position.z = Math.round(i.position.z / this.translationSnap) * this.translationSnap), i.parent && i.position.sub(nt.setFromMatrixPosition(i.parent.matrixWorld))));
@@ -4939,7 +4942,7 @@ class Lr extends ri {
4939
4942
  this.enabled && this.dragging && (this.object.position.copy(this._positionStart), this.object.quaternion.copy(this._quaternionStart), this.object.scale.copy(this._scaleStart), this.dispatchEvent(ni), this.dispatchEvent(Cn), this.pointStart.copy(this.pointEnd));
4940
4943
  }
4941
4944
  getRaycaster() {
4942
- return qt;
4945
+ return jt;
4943
4946
  }
4944
4947
  // TODO: deprecate
4945
4948
  getMode() {
@@ -5005,7 +5008,7 @@ function oi(l, s, t) {
5005
5008
  return e[i];
5006
5009
  return !1;
5007
5010
  }
5008
- const fs = new $n(), W = new w(0, 1, 0), Tn = new w(0, 0, 0), mn = new yt(), ps = new Pt(), Rs = new Pt(), _t = new w(), Rn = new yt(), Ue = new w(1, 0, 0), $t = new w(0, 1, 0), xe = new w(0, 0, 1), Cs = new w(), Me = new w(), De = new w();
5011
+ const fs = new $n(), W = new w(0, 1, 0), Tn = new w(0, 0, 0), mn = new yt(), ps = new Pt(), Rs = new Pt(), _t = new w(), Rn = new yt(), Ue = new w(1, 0, 0), qt = new w(0, 1, 0), xe = new w(0, 0, 1), Cs = new w(), Me = new w(), De = new w();
5009
5012
  class xr extends ri {
5010
5013
  constructor() {
5011
5014
  super(), this.isTransformControlsGizmo = !0, this.type = "TransformControlsGizmo";
@@ -5045,12 +5048,12 @@ class xr extends ri {
5045
5048
  p.color.setHex(7895160);
5046
5049
  const A = new ct(0, 0.04, 0.1, 12);
5047
5050
  A.translate(0, 0.05, 0);
5048
- const R = new rt(0.08, 0.08, 0.08);
5049
- R.translate(0, 0.04, 0);
5051
+ const m = new rt(0.08, 0.08, 0.08);
5052
+ m.translate(0, 0.04, 0);
5050
5053
  const C = new Ui();
5051
5054
  C.setAttribute("position", new xi([0, 0, 0, 1, 0, 0], 3));
5052
- const T = new ct(75e-4, 75e-4, 0.5, 3);
5053
- T.translate(0, 0.25, 0);
5055
+ const R = new ct(75e-4, 75e-4, 0.5, 3);
5056
+ R.translate(0, 0.25, 0);
5054
5057
  function F(B, H) {
5055
5058
  const q = new Re(B, 75e-4, 3, 64, H * Math.PI * 2);
5056
5059
  return q.rotateY(Math.PI / 2), q.rotateX(Math.PI / 2), q;
@@ -5059,21 +5062,21 @@ class xr extends ri {
5059
5062
  const B = new Ui();
5060
5063
  return B.setAttribute("position", new xi([0, 0, 0, 1, 1, 1], 3)), B;
5061
5064
  }
5062
- const m = {
5065
+ const T = {
5063
5066
  X: [
5064
5067
  [new v(A, o), [0.5, 0, 0], [0, 0, -Math.PI / 2]],
5065
5068
  [new v(A, o), [-0.5, 0, 0], [0, 0, Math.PI / 2]],
5066
- [new v(T, o), [0, 0, 0], [0, 0, -Math.PI / 2]]
5069
+ [new v(R, o), [0, 0, 0], [0, 0, -Math.PI / 2]]
5067
5070
  ],
5068
5071
  Y: [
5069
5072
  [new v(A, n), [0, 0.5, 0]],
5070
5073
  [new v(A, n), [0, -0.5, 0], [Math.PI, 0, 0]],
5071
- [new v(T, n)]
5074
+ [new v(R, n)]
5072
5075
  ],
5073
5076
  Z: [
5074
5077
  [new v(A, r), [0, 0, 0.5], [Math.PI / 2, 0, 0]],
5075
5078
  [new v(A, r), [0, 0, -0.5], [-Math.PI / 2, 0, 0]],
5076
- [new v(T, r), null, [Math.PI / 2, 0, 0]]
5079
+ [new v(R, r), null, [Math.PI / 2, 0, 0]]
5077
5080
  ],
5078
5081
  XYZ: [
5079
5082
  [new v(new Qe(0.1, 0), d.clone()), [0, 0, 0]]
@@ -5169,19 +5172,19 @@ class xr extends ri {
5169
5172
  ]
5170
5173
  }, M = {
5171
5174
  X: [
5172
- [new v(R, o), [0.5, 0, 0], [0, 0, -Math.PI / 2]],
5173
- [new v(T, o), [0, 0, 0], [0, 0, -Math.PI / 2]],
5174
- [new v(R, o), [-0.5, 0, 0], [0, 0, Math.PI / 2]]
5175
+ [new v(m, o), [0.5, 0, 0], [0, 0, -Math.PI / 2]],
5176
+ [new v(R, o), [0, 0, 0], [0, 0, -Math.PI / 2]],
5177
+ [new v(m, o), [-0.5, 0, 0], [0, 0, Math.PI / 2]]
5175
5178
  ],
5176
5179
  Y: [
5177
- [new v(R, n), [0, 0.5, 0]],
5178
- [new v(T, n)],
5179
- [new v(R, n), [0, -0.5, 0], [0, 0, Math.PI]]
5180
+ [new v(m, n), [0, 0.5, 0]],
5181
+ [new v(R, n)],
5182
+ [new v(m, n), [0, -0.5, 0], [0, 0, Math.PI]]
5180
5183
  ],
5181
5184
  Z: [
5182
- [new v(R, r), [0, 0, 0.5], [Math.PI / 2, 0, 0]],
5183
- [new v(T, r), [0, 0, 0], [Math.PI / 2, 0, 0]],
5184
- [new v(R, r), [0, 0, -0.5], [-Math.PI / 2, 0, 0]]
5185
+ [new v(m, r), [0, 0, 0.5], [Math.PI / 2, 0, 0]],
5186
+ [new v(R, r), [0, 0, 0], [Math.PI / 2, 0, 0]],
5187
+ [new v(m, r), [0, 0, -0.5], [-Math.PI / 2, 0, 0]]
5185
5188
  ],
5186
5189
  XY: [
5187
5190
  [new v(new rt(0.15, 0.15, 0.01), h), [0.15, 0.15, 0]]
@@ -5235,14 +5238,14 @@ class xr extends ri {
5235
5238
  const H = new ri();
5236
5239
  for (const q in B)
5237
5240
  for (let st = B[q].length; st--; ) {
5238
- const Q = B[q][st][0].clone(), kt = B[q][st][1], Wt = B[q][st][2], Xt = B[q][st][3], Xe = B[q][st][4];
5239
- Q.name = q, Q.tag = Xe, kt && Q.position.set(kt[0], kt[1], kt[2]), Wt && Q.rotation.set(Wt[0], Wt[1], Wt[2]), Xt && Q.scale.set(Xt[0], Xt[1], Xt[2]), Q.updateMatrix();
5241
+ const Q = B[q][st][0].clone(), Ht = B[q][st][1], kt = B[q][st][2], Wt = B[q][st][3], Xe = B[q][st][4];
5242
+ Q.name = q, Q.tag = Xe, 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();
5240
5243
  const Te = Q.geometry.clone();
5241
5244
  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);
5242
5245
  }
5243
5246
  return H;
5244
5247
  }
5245
- 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(M)), this.add(this.picker.translate = b(O)), this.add(this.picker.rotate = b(L)), this.add(this.picker.scale = b(y)), this.add(this.helper.translate = b(S)), this.add(this.helper.rotate = b(N)), this.add(this.helper.scale = b(x)), this.picker.translate.visible = !1, this.picker.rotate.visible = !1, this.picker.scale.visible = !1;
5248
+ this.gizmo = {}, this.picker = {}, this.helper = {}, this.add(this.gizmo.translate = b(T)), this.add(this.gizmo.rotate = b(_)), this.add(this.gizmo.scale = b(M)), this.add(this.picker.translate = b(O)), this.add(this.picker.rotate = b(L)), this.add(this.picker.scale = b(y)), this.add(this.helper.translate = b(S)), this.add(this.helper.rotate = b(N)), this.add(this.helper.scale = b(x)), this.picker.translate.visible = !1, this.picker.rotate.visible = !1, this.picker.scale.visible = !1;
5246
5249
  }
5247
5250
  // updateMatrixWorld will update transformations and appearance of individual handles
5248
5251
  updateMatrixWorld(s) {
@@ -5255,10 +5258,10 @@ class xr extends ri {
5255
5258
  n.visible = !0, n.rotation.set(0, 0, 0), n.position.copy(this.worldPosition);
5256
5259
  let r;
5257
5260
  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") {
5258
- n.visible = !1, n.name === "AXIS" ? (n.visible = !!this.axis, this.axis === "X" && (j.setFromEuler(fs.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(fs.set(0, 0, Math.PI / 2)), n.quaternion.copy(e).multiply(j), Math.abs(W.copy($t).applyQuaternion(e).dot(this.eye)) > 0.9 && (n.visible = !1)), this.axis === "Z" && (j.setFromEuler(fs.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(fs.set(0, Math.PI / 2, 0)), W.copy(this.rotationAxis), n.quaternion.setFromRotationMatrix(mn.lookAt(Tn, W, $t)), 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));
5261
+ n.visible = !1, n.name === "AXIS" ? (n.visible = !!this.axis, this.axis === "X" && (j.setFromEuler(fs.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(fs.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(fs.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(fs.set(0, Math.PI / 2, 0)), W.copy(this.rotationAxis), n.quaternion.setFromRotationMatrix(mn.lookAt(Tn, 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));
5259
5262
  continue;
5260
5263
  }
5261
- 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($t).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($t).applyQuaternion(e).dot(this.eye)) < 0.2 && (n.scale.set(1e-10, 1e-10, 1e-10), n.visible = !1)) : this.mode === "rotate" && (ps.copy(e), W.copy(this.eye).applyQuaternion(j.copy(e).invert()), n.name.search("E") !== -1 && n.quaternion.setFromRotationMatrix(mn.lookAt(this.eye, Tn, $t)), n.name === "X" && (j.setFromAxisAngle(Ue, Math.atan2(-W.y, W.z)), j.multiplyQuaternions(ps, j), n.quaternion.copy(j)), n.name === "Y" && (j.setFromAxisAngle($t, Math.atan2(W.x, W.z)), j.multiplyQuaternions(ps, j), n.quaternion.copy(j)), n.name === "Z" && (j.setFromAxisAngle(xe, Math.atan2(W.y, W.x)), j.multiplyQuaternions(ps, 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) {
5264
+ 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" && (ps.copy(e), W.copy(this.eye).applyQuaternion(j.copy(e).invert()), n.name.search("E") !== -1 && n.quaternion.setFromRotationMatrix(mn.lookAt(this.eye, Tn, qt)), n.name === "X" && (j.setFromAxisAngle(Ue, Math.atan2(-W.y, W.z)), j.multiplyQuaternions(ps, j), n.quaternion.copy(j)), n.name === "Y" && (j.setFromAxisAngle(qt, Math.atan2(W.x, W.z)), j.multiplyQuaternions(ps, j), n.quaternion.copy(j)), n.name === "Z" && (j.setFromAxisAngle(xe, Math.atan2(W.y, W.x)), j.multiplyQuaternions(ps, 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) {
5262
5265
  return n.name === a;
5263
5266
  })) && (n.material.color.setHex(16776960), n.material.opacity = 1);
5264
5267
  }
@@ -5274,7 +5277,7 @@ class br extends v {
5274
5277
  }
5275
5278
  updateMatrixWorld(s) {
5276
5279
  let t = this.space;
5277
- switch (this.position.copy(this.worldPosition), this.mode === "scale" && (t = "local"), Cs.copy(Ue).applyQuaternion(t === "local" ? this.worldQuaternion : Rs), Me.copy($t).applyQuaternion(t === "local" ? this.worldQuaternion : Rs), De.copy(xe).applyQuaternion(t === "local" ? this.worldQuaternion : Rs), W.copy(Me), this.mode) {
5280
+ switch (this.position.copy(this.worldPosition), this.mode === "scale" && (t = "local"), Cs.copy(Ue).applyQuaternion(t === "local" ? this.worldQuaternion : Rs), Me.copy(qt).applyQuaternion(t === "local" ? this.worldQuaternion : Rs), De.copy(xe).applyQuaternion(t === "local" ? this.worldQuaternion : Rs), W.copy(Me), this.mode) {
5278
5281
  case "translate":
5279
5282
  case "scale":
5280
5283
  switch (this.axis) {
@@ -5674,7 +5677,7 @@ class Vr {
5674
5677
  * meshes that are currently visible, and the ones that were visible
5675
5678
  * just before but not anymore.
5676
5679
  */
5677
- I(this, "onViewUpdated", new Kt());
5680
+ I(this, "onViewUpdated", new $t());
5678
5681
  /** {@link Component.enabled} */
5679
5682
  I(this, "enabled", !0);
5680
5683
  /**
@@ -5831,7 +5834,7 @@ class Gr extends Vr {
5831
5834
  }
5832
5835
  dispose() {
5833
5836
  super.dispose(), this._intervalID !== null && (window.clearInterval(this._intervalID), this._intervalID = null), this._currentVisibleMeshes.clear(), this._recentlyHiddenMeshes.clear(), this._meshIDColorCodeMap.clear(), this._transparentMat.dispose(), this._colorCodeMeshMap.clear();
5834
- const t = this.components.get(Ht);
5837
+ const t = this.components.get(zt);
5835
5838
  for (const e in this.colorMeshes) {
5836
5839
  const i = this.colorMeshes.get(e);
5837
5840
  i && t.destroy(i, !0);
@@ -5873,7 +5876,7 @@ class Gr extends Vr {
5873
5876
  return;
5874
5877
  }
5875
5878
  this.isProcessing = !0;
5876
- const e = this.components.get(Ht);
5879
+ const e = this.components.get(zt);
5877
5880
  this._currentVisibleMeshes.delete(t), this._recentlyHiddenMeshes.delete(t);
5878
5881
  const i = this.colorMeshes.get(t.uuid), o = this._meshIDColorCodeMap.get(t.uuid);
5879
5882
  if (!i || !o) {
@@ -6354,7 +6357,7 @@ const At = class At extends J {
6354
6357
  }
6355
6358
  /** {@link Disposable.dispose} */
6356
6359
  dispose() {
6357
- const t = this.components.get(Ht);
6360
+ const t = this.components.get(zt);
6358
6361
  for (const e of this._meshes)
6359
6362
  t.destroy(e);
6360
6363
  this._meshes = [], this.onDisposed.trigger(At.uuid), this.onDisposed.reset();
@@ -6670,160 +6673,470 @@ const Ps = class Ps extends J {
6670
6673
  };
6671
6674
  I(Ps, "uuid", "fef46874-46a3-461b-8c44-2922ab77c806");
6672
6675
  let ut = Ps;
6673
- const Zr = {
6674
- 103090709: "IFCPROJECT",
6675
- 4097777520: "IFCSITE",
6676
- 4031249490: "IFCBUILDING",
6677
- 3124254112: "IFCBUILDINGSTOREY",
6678
- 3856911033: "IFCSPACE",
6679
- 1674181508: "IFCANNOTATION",
6680
- 25142252: "IFCCONTROLLER",
6681
- 32344328: "IFCBOILER",
6682
- 76236018: "IFCLAMP",
6683
- 90941305: "IFCPUMP",
6684
- 177149247: "IFCAIRTERMINALBOX",
6685
- 182646315: "IFCFLOWINSTRUMENT",
6686
- 263784265: "IFCFURNISHINGELEMENT",
6687
- 264262732: "IFCELECTRICGENERATOR",
6688
- 277319702: "IFCAUDIOVISUALAPPLIANCE",
6689
- 310824031: "IFCPIPEFITTING",
6690
- 331165859: "IFCSTAIR",
6691
- 342316401: "IFCDUCTFITTING",
6692
- 377706215: "IFCMECHANICALFASTENER",
6693
- 395920057: "IFCDOOR",
6694
- 402227799: "IFCELECTRICMOTOR",
6695
- 413509423: "IFCSYSTEMFURNITUREELEMENT",
6696
- 484807127: "IFCEVAPORATOR",
6697
- 486154966: "IFCWINDOWSTANDARDCASE",
6698
- 629592764: "IFCLIGHTFIXTURE",
6699
- 630975310: "IFCUNITARYCONTROLELEMENT",
6700
- 635142910: "IFCCABLECARRIERFITTING",
6701
- 639361253: "IFCCOIL",
6702
- 647756555: "IFCFASTENER",
6703
- 707683696: "IFCFLOWSTORAGEDEVICE",
6704
- 738039164: "IFCPROTECTIVEDEVICE",
6705
- 753842376: "IFCBEAM",
6706
- 812556717: "IFCTANK",
6707
- 819412036: "IFCFILTER",
6708
- 843113511: "IFCCOLUMN",
6709
- 862014818: "IFCELECTRICDISTRIBUTIONBOARD",
6710
- 900683007: "IFCFOOTING",
6711
- 905975707: "IFCCOLUMNSTANDARDCASE",
6712
- 926996030: "IFCVOIDINGFEATURE",
6713
- 979691226: "IFCREINFORCINGBAR",
6714
- 987401354: "IFCFLOWSEGMENT",
6715
- 1003880860: "IFCELECTRICTIMECONTROL",
6716
- 1051757585: "IFCCABLEFITTING",
6717
- 1052013943: "IFCDISTRIBUTIONCHAMBERELEMENT",
6718
- 1062813311: "IFCDISTRIBUTIONCONTROLELEMENT",
6719
- 1073191201: "IFCMEMBER",
6720
- 1095909175: "IFCBUILDINGELEMENTPROXY",
6721
- 1156407060: "IFCPLATESTANDARDCASE",
6722
- 1162798199: "IFCSWITCHINGDEVICE",
6723
- 1329646415: "IFCSHADINGDEVICE",
6724
- 1335981549: "IFCDISCRETEACCESSORY",
6725
- 1360408905: "IFCDUCTSILENCER",
6726
- 1404847402: "IFCSTACKTERMINAL",
6727
- 1426591983: "IFCFIRESUPPRESSIONTERMINAL",
6728
- 1437502449: "IFCMEDICALDEVICE",
6729
- 1509553395: "IFCFURNITURE",
6730
- 1529196076: "IFCSLAB",
6731
- 1620046519: "IFCTRANSPORTELEMENT",
6732
- 1634111441: "IFCAIRTERMINAL",
6733
- 1658829314: "IFCENERGYCONVERSIONDEVICE",
6734
- 1677625105: "IFCCIVILELEMENT",
6735
- 1687234759: "IFCPILE",
6736
- 1904799276: "IFCELECTRICAPPLIANCE",
6737
- 1911478936: "IFCMEMBERSTANDARDCASE",
6738
- 1945004755: "IFCDISTRIBUTIONELEMENT",
6739
- 1973544240: "IFCCOVERING",
6740
- 1999602285: "IFCSPACEHEATER",
6741
- 2016517767: "IFCROOF",
6742
- 2056796094: "IFCAIRTOAIRHEATRECOVERY",
6743
- 2058353004: "IFCFLOWCONTROLLER",
6744
- 2068733104: "IFCHUMIDIFIER",
6745
- 2176052936: "IFCJUNCTIONBOX",
6746
- 2188021234: "IFCFLOWMETER",
6747
- 2223149337: "IFCFLOWTERMINAL",
6748
- 2262370178: "IFCRAILING",
6749
- 2272882330: "IFCCONDENSER",
6750
- 2295281155: "IFCPROTECTIVEDEVICETRIPPINGUNIT",
6751
- 2320036040: "IFCREINFORCINGMESH",
6752
- 2347447852: "IFCTENDONANCHOR",
6753
- 2391383451: "IFCVIBRATIONISOLATOR",
6754
- 2391406946: "IFCWALL",
6755
- 2474470126: "IFCMOTORCONNECTION",
6756
- 2769231204: "IFCVIRTUALELEMENT",
6757
- 2814081492: "IFCENGINE",
6758
- 2906023776: "IFCBEAMSTANDARDCASE",
6759
- 2938176219: "IFCBURNER",
6760
- 2979338954: "IFCBUILDINGELEMENTPART",
6761
- 3024970846: "IFCRAMP",
6762
- 3026737570: "IFCTUBEBUNDLE",
6763
- 3027962421: "IFCSLABSTANDARDCASE",
6764
- 3040386961: "IFCDISTRIBUTIONFLOWELEMENT",
6765
- 3053780830: "IFCSANITARYTERMINAL",
6766
- 3079942009: "IFCOPENINGSTANDARDCASE",
6767
- 3087945054: "IFCALARM",
6768
- 3101698114: "IFCSURFACEFEATURE",
6769
- 3127900445: "IFCSLABELEMENTEDCASE",
6770
- 3132237377: "IFCFLOWMOVINGDEVICE",
6771
- 3171933400: "IFCPLATE",
6772
- 3221913625: "IFCCOMMUNICATIONSAPPLIANCE",
6773
- 3242481149: "IFCDOORSTANDARDCASE",
6774
- 3283111854: "IFCRAMPFLIGHT",
6775
- 3296154744: "IFCCHIMNEY",
6776
- 3304561284: "IFCWINDOW",
6777
- 3310460725: "IFCELECTRICFLOWSTORAGEDEVICE",
6778
- 3319311131: "IFCHEATEXCHANGER",
6779
- 3415622556: "IFCFAN",
6780
- 3420628829: "IFCSOLARDEVICE",
6781
- 3493046030: "IFCGEOGRAPHICELEMENT",
6782
- 3495092785: "IFCCURTAINWALL",
6783
- 3508470533: "IFCFLOWTREATMENTDEVICE",
6784
- 3512223829: "IFCWALLSTANDARDCASE",
6785
- 3518393246: "IFCDUCTSEGMENT",
6786
- 3571504051: "IFCCOMPRESSOR",
6787
- 3588315303: "IFCOPENINGELEMENT",
6788
- 3612865200: "IFCPIPESEGMENT",
6789
- 3640358203: "IFCCOOLINGTOWER",
6790
- 3651124850: "IFCPROJECTIONELEMENT",
6791
- 3694346114: "IFCOUTLET",
6792
- 3747195512: "IFCEVAPORATIVECOOLER",
6793
- 3758799889: "IFCCABLECARRIERSEGMENT",
6794
- 3824725483: "IFCTENDON",
6795
- 3825984169: "IFCTRANSFORMER",
6796
- 3902619387: "IFCCHILLER",
6797
- 4074379575: "IFCDAMPER",
6798
- 4086658281: "IFCSENSOR",
6799
- 4123344466: "IFCELEMENTASSEMBLY",
6800
- 4136498852: "IFCCOOLEDBEAM",
6801
- 4156078855: "IFCWALLELEMENTEDCASE",
6802
- 4175244083: "IFCINTERCEPTOR",
6803
- 4207607924: "IFCVALVE",
6804
- 4217484030: "IFCCABLESEGMENT",
6805
- 4237592921: "IFCWASTETERMINAL",
6806
- 4252922144: "IFCSTAIRFLIGHT",
6807
- 4278956645: "IFCFLOWFITTING",
6808
- 4288193352: "IFCACTUATOR",
6809
- 4292641817: "IFCUNITARYEQUIPMENT",
6810
- 3009204131: "IFCGRID"
6811
- };
6812
- class ra {
6813
- getAll(s, t) {
6814
- const e = {}, i = Object.keys(Zr).map((o) => parseInt(o, 10));
6815
- for (let o = 0; o < i.length; o++) {
6816
- const n = i[o], r = s.GetLineIDsWithType(t, n), a = r.size();
6817
- for (let c = 0; c < a; c++)
6818
- e[r.get(c)] = n;
6676
+ const Zr = /* @__PURE__ */ new Map([
6677
+ [
6678
+ U.IFCRELAGGREGATES,
6679
+ {
6680
+ forRelating: "IsDecomposedBy",
6681
+ forRelated: "Decomposes"
6819
6682
  }
6820
- return e;
6683
+ ],
6684
+ [
6685
+ U.IFCRELASSOCIATESMATERIAL,
6686
+ {
6687
+ forRelating: "AssociatedTo",
6688
+ forRelated: "HasAssociations"
6689
+ }
6690
+ ],
6691
+ [
6692
+ U.IFCRELASSOCIATESCLASSIFICATION,
6693
+ {
6694
+ forRelating: "ClassificationForObjects",
6695
+ forRelated: "HasAssociations"
6696
+ }
6697
+ ],
6698
+ [
6699
+ U.IFCRELASSIGNSTOGROUP,
6700
+ {
6701
+ forRelating: "IsGroupedBy",
6702
+ forRelated: "HasAssignments"
6703
+ }
6704
+ ],
6705
+ [
6706
+ U.IFCRELDEFINESBYPROPERTIES,
6707
+ {
6708
+ forRelated: "IsDefinedBy",
6709
+ forRelating: "DefinesOcurrence"
6710
+ }
6711
+ ],
6712
+ [
6713
+ U.IFCRELDEFINESBYTYPE,
6714
+ {
6715
+ forRelated: "IsTypedBy",
6716
+ forRelating: "Types"
6717
+ }
6718
+ ],
6719
+ [
6720
+ U.IFCRELDEFINESBYTEMPLATE,
6721
+ {
6722
+ forRelated: "IsDefinedBy",
6723
+ forRelating: "Defines"
6724
+ }
6725
+ ],
6726
+ [
6727
+ U.IFCRELCONTAINEDINSPATIALSTRUCTURE,
6728
+ {
6729
+ forRelated: "ContainedInStructure",
6730
+ forRelating: "ContainsElements"
6731
+ }
6732
+ ]
6733
+ ]), Ve = class Ve extends J {
6734
+ constructor(t) {
6735
+ super(t);
6736
+ /** {@link Disposable.onDisposed} */
6737
+ I(this, "onDisposed", new D());
6738
+ I(this, "enabled", !0);
6739
+ I(this, "onRelationsIndexed", new D());
6740
+ I(this, "_relToAttributesMap", Zr);
6741
+ I(this, "_inverseAttributes", [
6742
+ "IsDecomposedBy",
6743
+ "Decomposes",
6744
+ "AssociatedTo",
6745
+ "HasAssociations",
6746
+ "ClassificationForObjects",
6747
+ "IsGroupedBy",
6748
+ "HasAssignments",
6749
+ "IsDefinedBy",
6750
+ "DefinesOcurrence",
6751
+ "IsTypedBy",
6752
+ "Types",
6753
+ "Defines",
6754
+ "ContainedInStructure",
6755
+ "ContainsElements"
6756
+ ]);
6757
+ I(this, "_ifcRels", [
6758
+ U.IFCRELAGGREGATES,
6759
+ U.IFCRELASSOCIATESMATERIAL,
6760
+ U.IFCRELASSOCIATESCLASSIFICATION,
6761
+ U.IFCRELASSIGNSTOGROUP,
6762
+ U.IFCRELDEFINESBYPROPERTIES,
6763
+ U.IFCRELDEFINESBYTYPE,
6764
+ U.IFCRELDEFINESBYTEMPLATE,
6765
+ U.IFCRELCONTAINEDINSPATIALSTRUCTURE
6766
+ ]);
6767
+ /**
6768
+ * Holds the relationship mappings for each model processed by the indexer.
6769
+ * The structure is a map where each key is a model's UUID, and the value is another map.
6770
+ * This inner map's keys are entity expressIDs, and its values are maps where each key is an index
6771
+ * representing a specific relation type, and the value is an array of expressIDs of entities
6772
+ * that are related through that relation type. This structure allows for efficient querying
6773
+ * of entity relationships within a model.
6774
+ */
6775
+ I(this, "relationMaps", {});
6776
+ I(this, "onFragmentsDisposed", (t) => {
6777
+ delete this.relationMaps[t.groupID];
6778
+ });
6779
+ this.components.add(Ve.uuid, this), t.get(ut).onFragmentsDisposed.add(this.onFragmentsDisposed);
6821
6780
  }
6822
- }
6823
- const Bn = {
6824
- 950732822: "IFCURIREFERENCE",
6825
- 4075327185: "IFCTIME",
6826
- 1209108979: "IFCTEMPERATURERATEOFCHANGEMEASURE",
6781
+ indexRelations(t, e, i, o) {
6782
+ const n = Object.keys(e).find(
6783
+ (E) => E.startsWith("Relating")
6784
+ ), r = Object.keys(e).find(
6785
+ (E) => E.startsWith("Related")
6786
+ );
6787
+ if (!(n && r))
6788
+ return;
6789
+ const a = e[n].value, c = e[r].map((E) => E.value), h = t.get(a) ?? /* @__PURE__ */ new Map(), d = this._inverseAttributes.indexOf(o);
6790
+ h.set(d, c), t.set(a, h);
6791
+ for (const E of c) {
6792
+ const u = t.get(E) ?? /* @__PURE__ */ new Map(), p = this._inverseAttributes.indexOf(i), A = u.get(p) ?? [];
6793
+ A.push(a), u.set(p, A), t.set(E, u);
6794
+ }
6795
+ }
6796
+ /**
6797
+ * Adds a relation map to the model's relations map.
6798
+ *
6799
+ * @param model - The `FragmentsGroup` model to which the relation map will be added.
6800
+ * @param relationMap - The `RelationsMap` to be added to the model's relations map.
6801
+ *
6802
+ * @fires onRelationsIndexed - Triggers an event with the model's UUID and the added relation map.
6803
+ */
6804
+ setRelationMap(t, e) {
6805
+ this.relationMaps[t.uuid] = e, this.onRelationsIndexed.trigger({
6806
+ modelID: t.uuid,
6807
+ relationsMap: e
6808
+ });
6809
+ }
6810
+ /**
6811
+ * Processes a given model to index its IFC entities relations based on predefined inverse attributes.
6812
+ * This method iterates through each specified inverse attribute, retrieves the corresponding relations,
6813
+ * and maps them in a structured way to facilitate quick access to related entities.
6814
+ *
6815
+ * The process involves querying the model for each relation type associated with the inverse attributes
6816
+ * and updating the internal relationMaps with the relationships found. This map is keyed by the model's UUID
6817
+ * and contains a nested map where each key is an entity's expressID and its value is another map.
6818
+ * This inner map's keys are the indices of the inverse attributes, and its values are arrays of expressIDs
6819
+ * of entities that are related through that attribute.
6820
+ *
6821
+ * @param model The `FragmentsGroup` model to be processed. It must have properties loaded.
6822
+ * @returns A promise that resolves to the relations map for the processed model. This map is a detailed
6823
+ * representation of the relations indexed by entity expressIDs and relation types.
6824
+ * @throws An error if the model does not have properties loaded.
6825
+ */
6826
+ async process(t) {
6827
+ if (!t.hasProperties)
6828
+ throw new Error("FragmentsGroup properties not found");
6829
+ let e = this.relationMaps[t.uuid];
6830
+ if (e)
6831
+ return e;
6832
+ e = /* @__PURE__ */ new Map();
6833
+ for (const i of this._ifcRels) {
6834
+ const o = await t.getAllPropertiesOfType(i);
6835
+ if (!o)
6836
+ continue;
6837
+ const n = this._relToAttributesMap.get(i);
6838
+ if (!n)
6839
+ continue;
6840
+ const { forRelated: r, forRelating: a } = n;
6841
+ for (const c in o) {
6842
+ const h = o[c];
6843
+ this.indexRelations(e, h, r, a);
6844
+ }
6845
+ }
6846
+ return this.setRelationMap(t, e), e;
6847
+ }
6848
+ /**
6849
+ * Processes a given model from a WebIfc API to index its IFC entities relations.
6850
+ *
6851
+ * @param ifcApi - The WebIfc API instance from which to retrieve the model's properties.
6852
+ * @param modelID - The unique identifier of the model within the WebIfc API.
6853
+ * @returns A promise that resolves to the relations map for the processed model.
6854
+ * This map is a detailed representation of the relations indexed by entity expressIDs and relation types.
6855
+ */
6856
+ async processFromWebIfc(t, e) {
6857
+ const i = /* @__PURE__ */ new Map();
6858
+ for (const o of this._ifcRels) {
6859
+ const n = this._relToAttributesMap.get(o);
6860
+ if (!n)
6861
+ continue;
6862
+ const { forRelated: r, forRelating: a } = n, c = t.GetLineIDsWithType(e, o);
6863
+ for (let h = 0; h < c.size(); h++) {
6864
+ const d = await t.properties.getItemProperties(
6865
+ e,
6866
+ c.get(h)
6867
+ );
6868
+ this.indexRelations(i, d, r, a);
6869
+ }
6870
+ }
6871
+ return this.onRelationsIndexed.trigger({
6872
+ modelID: e.toString(),
6873
+ relationsMap: i
6874
+ }), i;
6875
+ }
6876
+ /**
6877
+ * Retrieves the relations of a specific entity within a model based on the given relation name.
6878
+ * This method searches the indexed relation maps for the specified model and entity,
6879
+ * returning the IDs of related entities if a match is found.
6880
+ *
6881
+ * @param model The `FragmentsGroup` model containing the entity.
6882
+ * @param expressID The unique identifier of the entity within the model.
6883
+ * @param relationName The IFC schema inverse attribute of the relation to search for (e.g., "IsDefinedBy", "ContainsElements").
6884
+ * @returns An array of express IDs representing the related entities, or `null` if no relations are found
6885
+ * or the specified relation name is not indexed.
6886
+ */
6887
+ getEntityRelations(t, e, i) {
6888
+ const o = this.relationMaps[t.uuid];
6889
+ if (!o)
6890
+ return null;
6891
+ const n = o.get(e), r = this._inverseAttributes.indexOf(i);
6892
+ if (!n || r === -1)
6893
+ return null;
6894
+ const a = n.get(r);
6895
+ return a || null;
6896
+ }
6897
+ /**
6898
+ * Serializes the relations of a given relation map into a JSON string.
6899
+ * This method iterates through the relations in the given map, organizing them into a structured object where each key is an expressID of an entity,
6900
+ * and its value is another object mapping relation indices to arrays of related entity expressIDs.
6901
+ * The resulting object is then serialized into a JSON string.
6902
+ *
6903
+ * @param relationMap - The map of relations to be serialized. The map keys are expressIDs of entities, and the values are maps where each key is a relation type ID and its value is an array of expressIDs of entities related through that relation type.
6904
+ * @returns A JSON string representing the serialized relations of the given relation map.
6905
+ */
6906
+ serializeRelations(t) {
6907
+ const e = {};
6908
+ for (const [i, o] of t.entries()) {
6909
+ e[i] || (e[i] = {});
6910
+ for (const [n, r] of o.entries())
6911
+ e[i][n] = r;
6912
+ }
6913
+ return JSON.stringify(e);
6914
+ }
6915
+ /**
6916
+ * Serializes the relations of a specific model into a JSON string.
6917
+ * This method iterates through the relations indexed for the given model,
6918
+ * organizing them into a structured object where each key is an expressID of an entity,
6919
+ * and its value is another object mapping relation indices to arrays of related entity expressIDs.
6920
+ * The resulting object is then serialized into a JSON string.
6921
+ *
6922
+ * @param model The `FragmentsGroup` model whose relations are to be serialized.
6923
+ * @returns A JSON string representing the serialized relations of the specified model.
6924
+ * If the model has no indexed relations, `null` is returned.
6925
+ */
6926
+ serializeModelRelations(t) {
6927
+ const e = this.relationMaps[t.uuid];
6928
+ return e ? this.serializeRelations(e) : null;
6929
+ }
6930
+ /**
6931
+ * Serializes all relations of every model processed by the indexer into a JSON string.
6932
+ * This method iterates through each model's relations indexed in `relationMaps`, organizing them
6933
+ * into a structured JSON object. Each top-level key in this object corresponds to a model's UUID,
6934
+ * and its value is another object mapping entity expressIDs to their related entities, categorized
6935
+ * by relation types. The structure facilitates easy access to any entity's relations across all models.
6936
+ *
6937
+ * @returns A JSON string representing the serialized relations of all models processed by the indexer.
6938
+ * If no relations have been indexed, an empty object is returned as a JSON string.
6939
+ */
6940
+ serializeAllRelations() {
6941
+ const t = {};
6942
+ for (const e in this.relationMaps) {
6943
+ const i = this.relationMaps[e], o = {};
6944
+ for (const [n, r] of i.entries()) {
6945
+ o[n] || (o[n] = {});
6946
+ for (const [a, c] of r.entries())
6947
+ o[n][a] = c;
6948
+ }
6949
+ t[e] = o;
6950
+ }
6951
+ return JSON.stringify(t);
6952
+ }
6953
+ /**
6954
+ * Converts a JSON string representing relations between entities into a structured map.
6955
+ * This method parses the JSON string to reconstruct the relations map that indexes
6956
+ * entity relations by their express IDs. The outer map keys are the express IDs of entities,
6957
+ * and the values are maps where each key is a relation type ID and its value is an array
6958
+ * of express IDs of entities related through that relation type.
6959
+ *
6960
+ * @param json The JSON string to be parsed into the relations map.
6961
+ * @returns A `Map` where the key is the express ID of an entity as a number, and the value
6962
+ * is another `Map`. This inner map's key is the relation type ID as a number, and its value
6963
+ * is an array of express IDs (as numbers) of entities related through that relation type.
6964
+ */
6965
+ getRelationsMapFromJSON(t) {
6966
+ const e = JSON.parse(t), i = /* @__PURE__ */ new Map();
6967
+ for (const o in e) {
6968
+ const n = e[o], r = /* @__PURE__ */ new Map();
6969
+ for (const a in n)
6970
+ r.set(Number(a), n[a]);
6971
+ i.set(Number(o), r);
6972
+ }
6973
+ return i;
6974
+ }
6975
+ /**
6976
+ * Disposes the component, cleaning up resources and detaching event listeners.
6977
+ * This ensures that the component is properly cleaned up and does not leave behind any
6978
+ * references that could prevent garbage collection.
6979
+ */
6980
+ dispose() {
6981
+ this.relationMaps = {}, this.components.get(ut).onFragmentsDisposed.remove(this.onFragmentsDisposed), this.onDisposed.trigger(Ve.uuid), this.onDisposed.reset();
6982
+ }
6983
+ };
6984
+ I(Ve, "uuid", "23a889ab-83b3-44a4-8bee-ead83438370b");
6985
+ let We = Ve;
6986
+ const Qr = {
6987
+ 103090709: "IFCPROJECT",
6988
+ 4097777520: "IFCSITE",
6989
+ 4031249490: "IFCBUILDING",
6990
+ 3124254112: "IFCBUILDINGSTOREY",
6991
+ 3856911033: "IFCSPACE",
6992
+ 1674181508: "IFCANNOTATION",
6993
+ 25142252: "IFCCONTROLLER",
6994
+ 32344328: "IFCBOILER",
6995
+ 76236018: "IFCLAMP",
6996
+ 90941305: "IFCPUMP",
6997
+ 177149247: "IFCAIRTERMINALBOX",
6998
+ 182646315: "IFCFLOWINSTRUMENT",
6999
+ 263784265: "IFCFURNISHINGELEMENT",
7000
+ 264262732: "IFCELECTRICGENERATOR",
7001
+ 277319702: "IFCAUDIOVISUALAPPLIANCE",
7002
+ 310824031: "IFCPIPEFITTING",
7003
+ 331165859: "IFCSTAIR",
7004
+ 342316401: "IFCDUCTFITTING",
7005
+ 377706215: "IFCMECHANICALFASTENER",
7006
+ 395920057: "IFCDOOR",
7007
+ 402227799: "IFCELECTRICMOTOR",
7008
+ 413509423: "IFCSYSTEMFURNITUREELEMENT",
7009
+ 484807127: "IFCEVAPORATOR",
7010
+ 486154966: "IFCWINDOWSTANDARDCASE",
7011
+ 629592764: "IFCLIGHTFIXTURE",
7012
+ 630975310: "IFCUNITARYCONTROLELEMENT",
7013
+ 635142910: "IFCCABLECARRIERFITTING",
7014
+ 639361253: "IFCCOIL",
7015
+ 647756555: "IFCFASTENER",
7016
+ 707683696: "IFCFLOWSTORAGEDEVICE",
7017
+ 738039164: "IFCPROTECTIVEDEVICE",
7018
+ 753842376: "IFCBEAM",
7019
+ 812556717: "IFCTANK",
7020
+ 819412036: "IFCFILTER",
7021
+ 843113511: "IFCCOLUMN",
7022
+ 862014818: "IFCELECTRICDISTRIBUTIONBOARD",
7023
+ 900683007: "IFCFOOTING",
7024
+ 905975707: "IFCCOLUMNSTANDARDCASE",
7025
+ 926996030: "IFCVOIDINGFEATURE",
7026
+ 979691226: "IFCREINFORCINGBAR",
7027
+ 987401354: "IFCFLOWSEGMENT",
7028
+ 1003880860: "IFCELECTRICTIMECONTROL",
7029
+ 1051757585: "IFCCABLEFITTING",
7030
+ 1052013943: "IFCDISTRIBUTIONCHAMBERELEMENT",
7031
+ 1062813311: "IFCDISTRIBUTIONCONTROLELEMENT",
7032
+ 1073191201: "IFCMEMBER",
7033
+ 1095909175: "IFCBUILDINGELEMENTPROXY",
7034
+ 1156407060: "IFCPLATESTANDARDCASE",
7035
+ 1162798199: "IFCSWITCHINGDEVICE",
7036
+ 1329646415: "IFCSHADINGDEVICE",
7037
+ 1335981549: "IFCDISCRETEACCESSORY",
7038
+ 1360408905: "IFCDUCTSILENCER",
7039
+ 1404847402: "IFCSTACKTERMINAL",
7040
+ 1426591983: "IFCFIRESUPPRESSIONTERMINAL",
7041
+ 1437502449: "IFCMEDICALDEVICE",
7042
+ 1509553395: "IFCFURNITURE",
7043
+ 1529196076: "IFCSLAB",
7044
+ 1620046519: "IFCTRANSPORTELEMENT",
7045
+ 1634111441: "IFCAIRTERMINAL",
7046
+ 1658829314: "IFCENERGYCONVERSIONDEVICE",
7047
+ 1677625105: "IFCCIVILELEMENT",
7048
+ 1687234759: "IFCPILE",
7049
+ 1904799276: "IFCELECTRICAPPLIANCE",
7050
+ 1911478936: "IFCMEMBERSTANDARDCASE",
7051
+ 1945004755: "IFCDISTRIBUTIONELEMENT",
7052
+ 1973544240: "IFCCOVERING",
7053
+ 1999602285: "IFCSPACEHEATER",
7054
+ 2016517767: "IFCROOF",
7055
+ 2056796094: "IFCAIRTOAIRHEATRECOVERY",
7056
+ 2058353004: "IFCFLOWCONTROLLER",
7057
+ 2068733104: "IFCHUMIDIFIER",
7058
+ 2176052936: "IFCJUNCTIONBOX",
7059
+ 2188021234: "IFCFLOWMETER",
7060
+ 2223149337: "IFCFLOWTERMINAL",
7061
+ 2262370178: "IFCRAILING",
7062
+ 2272882330: "IFCCONDENSER",
7063
+ 2295281155: "IFCPROTECTIVEDEVICETRIPPINGUNIT",
7064
+ 2320036040: "IFCREINFORCINGMESH",
7065
+ 2347447852: "IFCTENDONANCHOR",
7066
+ 2391383451: "IFCVIBRATIONISOLATOR",
7067
+ 2391406946: "IFCWALL",
7068
+ 2474470126: "IFCMOTORCONNECTION",
7069
+ 2769231204: "IFCVIRTUALELEMENT",
7070
+ 2814081492: "IFCENGINE",
7071
+ 2906023776: "IFCBEAMSTANDARDCASE",
7072
+ 2938176219: "IFCBURNER",
7073
+ 2979338954: "IFCBUILDINGELEMENTPART",
7074
+ 3024970846: "IFCRAMP",
7075
+ 3026737570: "IFCTUBEBUNDLE",
7076
+ 3027962421: "IFCSLABSTANDARDCASE",
7077
+ 3040386961: "IFCDISTRIBUTIONFLOWELEMENT",
7078
+ 3053780830: "IFCSANITARYTERMINAL",
7079
+ 3079942009: "IFCOPENINGSTANDARDCASE",
7080
+ 3087945054: "IFCALARM",
7081
+ 3101698114: "IFCSURFACEFEATURE",
7082
+ 3127900445: "IFCSLABELEMENTEDCASE",
7083
+ 3132237377: "IFCFLOWMOVINGDEVICE",
7084
+ 3171933400: "IFCPLATE",
7085
+ 3221913625: "IFCCOMMUNICATIONSAPPLIANCE",
7086
+ 3242481149: "IFCDOORSTANDARDCASE",
7087
+ 3283111854: "IFCRAMPFLIGHT",
7088
+ 3296154744: "IFCCHIMNEY",
7089
+ 3304561284: "IFCWINDOW",
7090
+ 3310460725: "IFCELECTRICFLOWSTORAGEDEVICE",
7091
+ 3319311131: "IFCHEATEXCHANGER",
7092
+ 3415622556: "IFCFAN",
7093
+ 3420628829: "IFCSOLARDEVICE",
7094
+ 3493046030: "IFCGEOGRAPHICELEMENT",
7095
+ 3495092785: "IFCCURTAINWALL",
7096
+ 3508470533: "IFCFLOWTREATMENTDEVICE",
7097
+ 3512223829: "IFCWALLSTANDARDCASE",
7098
+ 3518393246: "IFCDUCTSEGMENT",
7099
+ 3571504051: "IFCCOMPRESSOR",
7100
+ 3588315303: "IFCOPENINGELEMENT",
7101
+ 3612865200: "IFCPIPESEGMENT",
7102
+ 3640358203: "IFCCOOLINGTOWER",
7103
+ 3651124850: "IFCPROJECTIONELEMENT",
7104
+ 3694346114: "IFCOUTLET",
7105
+ 3747195512: "IFCEVAPORATIVECOOLER",
7106
+ 3758799889: "IFCCABLECARRIERSEGMENT",
7107
+ 3824725483: "IFCTENDON",
7108
+ 3825984169: "IFCTRANSFORMER",
7109
+ 3902619387: "IFCCHILLER",
7110
+ 4074379575: "IFCDAMPER",
7111
+ 4086658281: "IFCSENSOR",
7112
+ 4123344466: "IFCELEMENTASSEMBLY",
7113
+ 4136498852: "IFCCOOLEDBEAM",
7114
+ 4156078855: "IFCWALLELEMENTEDCASE",
7115
+ 4175244083: "IFCINTERCEPTOR",
7116
+ 4207607924: "IFCVALVE",
7117
+ 4217484030: "IFCCABLESEGMENT",
7118
+ 4237592921: "IFCWASTETERMINAL",
7119
+ 4252922144: "IFCSTAIRFLIGHT",
7120
+ 4278956645: "IFCFLOWFITTING",
7121
+ 4288193352: "IFCACTUATOR",
7122
+ 4292641817: "IFCUNITARYEQUIPMENT",
7123
+ 3009204131: "IFCGRID"
7124
+ };
7125
+ class ra {
7126
+ getAll(s, t) {
7127
+ const e = {}, i = Object.keys(Qr).map((o) => parseInt(o, 10));
7128
+ for (let o = 0; o < i.length; o++) {
7129
+ const n = i[o], r = s.GetLineIDsWithType(t, n), a = r.size();
7130
+ for (let c = 0; c < a; c++)
7131
+ e[r.get(c)] = n;
7132
+ }
7133
+ return e;
7134
+ }
7135
+ }
7136
+ const Bn = {
7137
+ 950732822: "IFCURIREFERENCE",
7138
+ 4075327185: "IFCTIME",
7139
+ 1209108979: "IFCTEMPERATURERATEOFCHANGEMEASURE",
6827
7140
  3457685358: "IFCSOUNDPRESSURELEVELMEASURE",
6828
7141
  4157543285: "IFCSOUNDPOWERLEVELMEASURE",
6829
7142
  2798247006: "IFCPROPERTYSETDEFINITIONSET",
@@ -7962,7 +8275,7 @@ const Bn = {
7962
8275
  1390159747: "FILE_NAME",
7963
8276
  1109904537: "FILE_SCHEMA"
7964
8277
  };
7965
- class Gt {
8278
+ class Kt {
7966
8279
  static async getUnits(s) {
7967
8280
  var n;
7968
8281
  const { IFCUNITASSIGNMENT: t } = U, e = await s.getAllPropertiesOfType(t);
@@ -7982,430 +8295,121 @@ class Gt {
7982
8295
  }
7983
8296
  static async findItemByGuid(s, t) {
7984
8297
  var i;
7985
- const e = s.getAllPropertiesIDs();
7986
- for (const o of e) {
7987
- const n = await s.getProperties(o);
7988
- if (n && ((i = n.GlobalId) == null ? void 0 : i.value) === t)
7989
- return n;
7990
- }
7991
- return null;
7992
- }
7993
- static async getRelationMap(s, t, e) {
7994
- var a;
7995
- const o = e ?? (async () => {
7996
- }), n = {}, r = s.getAllPropertiesIDs();
7997
- for (const c of r) {
7998
- const h = await s.getProperties(c);
7999
- if (!h)
8000
- continue;
8001
- const d = h.type === t, E = Object.keys(h).find(
8002
- (C) => C.startsWith("Relating")
8003
- ), u = Object.keys(h).find(
8004
- (C) => C.startsWith("Related")
8005
- );
8006
- if (!(d && E && u))
8007
- continue;
8008
- const p = await s.getProperties((a = h[E]) == null ? void 0 : a.value), A = h[u];
8009
- if (!p || !A || !(A && Array.isArray(A)))
8010
- continue;
8011
- const R = A.map((C) => C.value);
8012
- await o(p.expressID, R), n[p.expressID] = R;
8013
- }
8014
- return n;
8015
- }
8016
- static async getQsetQuantities(s, t, e) {
8017
- const o = e ?? (() => {
8018
- }), n = await s.getProperties(t);
8019
- return !n || n.type !== U.IFCELEMENTQUANTITY ? null : (n.Quantities ?? [{}]).map((c) => (c.value && o(c.value), c.value)).filter((c) => c !== null);
8020
- }
8021
- static async getPsetProps(s, t, e) {
8022
- const o = e ?? (() => {
8023
- }), n = await s.getProperties(t);
8024
- return !n || n.type !== U.IFCPROPERTYSET ? null : (n.HasProperties ?? [{}]).map((c) => (c.value && o(c.value), c.value)).filter((c) => c !== null);
8025
- }
8026
- static async getPsetRel(s, t) {
8027
- var r;
8028
- if (!await s.getProperties(t))
8029
- return null;
8030
- const i = await s.getAllPropertiesOfType(
8031
- U.IFCRELDEFINESBYPROPERTIES
8032
- );
8033
- if (!i)
8034
- return null;
8035
- const o = Object.values(i);
8036
- let n = null;
8037
- for (const a of o)
8038
- ((r = a.RelatingPropertyDefinition) == null ? void 0 : r.value) === t && (n = a.expressID);
8039
- return n;
8040
- }
8041
- static async getQsetRel(s, t) {
8042
- return Gt.getPsetRel(s, t);
8043
- }
8044
- static async getEntityName(s, t) {
8045
- var n;
8046
- const e = await s.getProperties(t);
8047
- if (!e)
8048
- return { key: null, name: null };
8049
- const i = Object.keys(e).find((r) => r.endsWith("Name")) ?? null, o = i ? (n = e[i]) == null ? void 0 : n.value : null;
8050
- return { key: i, name: o };
8051
- }
8052
- static async getQuantityValue(s, t) {
8053
- const e = await s.getProperties(t);
8054
- if (!e)
8055
- return { key: null, value: null };
8056
- const i = Object.keys(e).find((n) => n.endsWith("Value")) ?? null;
8057
- let o;
8058
- return i === null || e[i] === void 0 || e[i] === null ? o = null : o = e[i].value, { key: i, value: o };
8059
- }
8060
- static isRel(s) {
8061
- return Bn[s].startsWith("IFCREL");
8062
- }
8063
- static async attributeExists(s, t, e) {
8064
- const i = await s.getProperties(t);
8065
- return i ? Object.keys(i).includes(e) : !1;
8066
- }
8067
- static async groupEntitiesByType(s, t) {
8068
- var i;
8069
- const e = /* @__PURE__ */ new Map();
8070
- for (const o of t) {
8071
- const n = await s.getProperties(o);
8072
- if (!n)
8073
- continue;
8074
- const r = n.type;
8075
- e.get(r) || e.set(r, /* @__PURE__ */ new Set()), (i = e.get(r)) == null || i.add(o);
8076
- }
8077
- return e;
8078
- }
8079
- // static getPropertyUnits(properties: IfcProperties, expressID: number) {
8080
- // const entity = properties[expressID];
8081
- // if (!entity) return null;
8082
- // const propertyInstance =
8083
- // entity instanceof WEBIFC.IFC2X3.IfcProperty ||
8084
- // entity instanceof WEBIFC.IFC4.IfcProperty ||
8085
- // entity instanceof WEBIFC.IFC4X3.IfcProperty;
8086
- // if (!propertyInstance) return null;
8087
- // const { key: valueKey } = IfcPropertiesUtils.getQuantityValue(
8088
- // properties,
8089
- // expressID
8090
- // );
8091
- // if (!valueKey) return null;
8092
- // // @ts-ignore
8093
- // const measureName = entity[valueKey].constructor.name as string;
8094
- // const isMeasureAttribute = measureName.endsWith("Measure");
8095
- // if (!isMeasureAttribute) return null;
8096
- // const measureType = measureName.slice(3, measureName.length - 7);
8097
- // return propertyInstance;
8098
- // }
8099
- }
8100
- const Qr = /* @__PURE__ */ new Map([
8101
- [
8102
- U.IFCRELAGGREGATES,
8103
- {
8104
- forRelating: "IsDecomposedBy",
8105
- forRelated: "Decomposes"
8106
- }
8107
- ],
8108
- [
8109
- U.IFCRELASSOCIATESMATERIAL,
8110
- {
8111
- forRelating: "AssociatedTo",
8112
- forRelated: "HasAssociations"
8113
- }
8114
- ],
8115
- [
8116
- U.IFCRELASSOCIATESCLASSIFICATION,
8117
- {
8118
- forRelating: "ClassificationForObjects",
8119
- forRelated: "HasAssociations"
8120
- }
8121
- ],
8122
- [
8123
- U.IFCRELASSIGNSTOGROUP,
8124
- {
8125
- forRelating: "IsGroupedBy",
8126
- forRelated: "HasAssignments"
8127
- }
8128
- ],
8129
- [
8130
- U.IFCRELDEFINESBYPROPERTIES,
8131
- {
8132
- forRelated: "IsDefinedBy",
8133
- forRelating: "DefinesOcurrence"
8134
- }
8135
- ],
8136
- [
8137
- U.IFCRELDEFINESBYTYPE,
8138
- {
8139
- forRelated: "IsTypedBy",
8140
- forRelating: "Types"
8141
- }
8142
- ],
8143
- [
8144
- U.IFCRELDEFINESBYTEMPLATE,
8145
- {
8146
- forRelated: "IsDefinedBy",
8147
- forRelating: "Defines"
8148
- }
8149
- ],
8150
- [
8151
- U.IFCRELCONTAINEDINSPATIALSTRUCTURE,
8152
- {
8153
- forRelated: "ContainedInStructure",
8154
- forRelating: "ContainsElements"
8155
- }
8156
- ]
8157
- ]), Ve = class Ve extends J {
8158
- constructor(t) {
8159
- super(t);
8160
- /** {@link Disposable.onDisposed} */
8161
- I(this, "onDisposed", new D());
8162
- I(this, "enabled", !0);
8163
- I(this, "onRelationsIndexed", new D());
8164
- I(this, "_relToAttributesMap", Qr);
8165
- I(this, "_inverseAttributes", [
8166
- "IsDecomposedBy",
8167
- "Decomposes",
8168
- "AssociatedTo",
8169
- "HasAssociations",
8170
- "ClassificationForObjects",
8171
- "IsGroupedBy",
8172
- "HasAssignments",
8173
- "IsDefinedBy",
8174
- "DefinesOcurrence",
8175
- "IsTypedBy",
8176
- "Types",
8177
- "Defines",
8178
- "ContainedInStructure",
8179
- "ContainsElements"
8180
- ]);
8181
- I(this, "_ifcRels", [
8182
- U.IFCRELAGGREGATES,
8183
- U.IFCRELASSOCIATESMATERIAL,
8184
- U.IFCRELASSOCIATESCLASSIFICATION,
8185
- U.IFCRELASSIGNSTOGROUP,
8186
- U.IFCRELDEFINESBYPROPERTIES,
8187
- U.IFCRELDEFINESBYTYPE,
8188
- U.IFCRELDEFINESBYTEMPLATE,
8189
- U.IFCRELCONTAINEDINSPATIALSTRUCTURE
8190
- ]);
8191
- /**
8192
- * Holds the relationship mappings for each model processed by the indexer.
8193
- * The structure is a map where each key is a model's UUID, and the value is another map.
8194
- * This inner map's keys are entity expressIDs, and its values are maps where each key is an index
8195
- * representing a specific relation type, and the value is an array of expressIDs of entities
8196
- * that are related through that relation type. This structure allows for efficient querying
8197
- * of entity relationships within a model.
8198
- */
8199
- I(this, "relationMaps", {});
8200
- I(this, "onFragmentsDisposed", (t) => {
8201
- delete this.relationMaps[t.groupID];
8202
- });
8203
- this.components.add(Ve.uuid, this), t.get(ut).onFragmentsDisposed.add(this.onFragmentsDisposed);
8204
- }
8205
- /**
8206
- * Adds a relation map to the model's relations map.
8207
- *
8208
- * @param model - The `FragmentsGroup` model to which the relation map will be added.
8209
- * @param relationMap - The `RelationsMap` to be added to the model's relations map.
8210
- *
8211
- * @fires onRelationsIndexed - Triggers an event with the model's UUID and the added relation map.
8212
- */
8213
- setRelationMap(t, e) {
8214
- this.relationMaps[t.uuid] = e, this.onRelationsIndexed.trigger({
8215
- modelID: t.uuid,
8216
- relationsMap: e
8217
- });
8298
+ const e = s.getAllPropertiesIDs();
8299
+ for (const o of e) {
8300
+ const n = await s.getProperties(o);
8301
+ if (n && ((i = n.GlobalId) == null ? void 0 : i.value) === t)
8302
+ return n;
8303
+ }
8304
+ return null;
8218
8305
  }
8219
- /**
8220
- * Processes a given model to index its IFC entities relations based on predefined inverse attributes.
8221
- * This method iterates through each specified inverse attribute, retrieves the corresponding relations,
8222
- * and maps them in a structured way to facilitate quick access to related entities.
8223
- *
8224
- * The process involves querying the model for each relation type associated with the inverse attributes
8225
- * and updating the internal relationMaps with the relationships found. This map is keyed by the model's UUID
8226
- * and contains a nested map where each key is an entity's expressID and its value is another map.
8227
- * This inner map's keys are the indices of the inverse attributes, and its values are arrays of expressIDs
8228
- * of entities that are related through that attribute.
8229
- *
8230
- * @param model The `FragmentsGroup` model to be processed. It must have properties loaded.
8231
- * @returns A promise that resolves to the relations map for the processed model. This map is a detailed
8232
- * representation of the relations indexed by entity expressIDs and relation types.
8233
- * @throws An error if the model does not have properties loaded.
8234
- */
8235
- async process(t) {
8236
- if (!t.hasProperties)
8237
- throw new Error("FragmentsGroup properties not found");
8238
- let e = this.relationMaps[t.uuid];
8239
- if (e)
8240
- return e;
8241
- e = /* @__PURE__ */ new Map();
8242
- for (const i of this._ifcRels)
8243
- await Gt.getRelationMap(
8244
- t,
8245
- i,
8246
- async (o, n) => {
8247
- const r = this._relToAttributesMap.get(i);
8248
- if (!r)
8249
- return;
8250
- const { forRelated: a, forRelating: c } = r, h = e.get(o) ?? /* @__PURE__ */ new Map(), d = this._inverseAttributes.indexOf(c);
8251
- h.set(d, n), e.set(o, h);
8252
- for (const E of n) {
8253
- const u = e.get(E) ?? /* @__PURE__ */ new Map(), p = this._inverseAttributes.indexOf(a), A = u.get(p) ?? [];
8254
- A.push(o), u.set(p, A), e.set(E, u);
8255
- }
8256
- }
8306
+ static async getRelationMap(s, t, e) {
8307
+ var a;
8308
+ const o = e ?? (async () => {
8309
+ }), n = {}, r = s.getAllPropertiesIDs();
8310
+ for (const c of r) {
8311
+ const h = await s.getProperties(c);
8312
+ if (!h)
8313
+ continue;
8314
+ const d = h.type === t, E = Object.keys(h).find(
8315
+ (C) => C.startsWith("Relating")
8316
+ ), u = Object.keys(h).find(
8317
+ (C) => C.startsWith("Related")
8257
8318
  );
8258
- return this.setRelationMap(t, e), e;
8259
- }
8260
- /**
8261
- * Processes a given model from a WebIfc API to index its IFC entities relations.
8262
- *
8263
- * @param ifcApi - The WebIfc API instance from which to retrieve the model's properties.
8264
- * @param modelID - The unique identifier of the model within the WebIfc API.
8265
- * @returns A promise that resolves to the relations map for the processed model.
8266
- * This map is a detailed representation of the relations indexed by entity expressIDs and relation types.
8267
- */
8268
- async processFromWebIfc(t, e) {
8269
- const i = /* @__PURE__ */ new Map();
8270
- for (const o of this._ifcRels) {
8271
- const n = this._relToAttributesMap.get(o);
8272
- if (!n)
8319
+ if (!(d && E && u))
8273
8320
  continue;
8274
- const { forRelated: r, forRelating: a } = n, c = t.GetLineIDsWithType(e, o);
8275
- for (let h = 0; h < c.size(); h++) {
8276
- const d = await t.properties.getItemProperties(
8277
- e,
8278
- c.get(h)
8279
- ), E = Object.keys(d).find(
8280
- (T) => T.startsWith("Relating")
8281
- ), u = Object.keys(d).find(
8282
- (T) => T.startsWith("Related")
8283
- );
8284
- if (!(E && u))
8285
- continue;
8286
- const p = d[E].value, A = d[u].map((T) => T.value), R = i.get(p) ?? /* @__PURE__ */ new Map(), C = this._inverseAttributes.indexOf(a);
8287
- R.set(C, A), i.set(p, R);
8288
- for (const T of A) {
8289
- const F = i.get(T) ?? /* @__PURE__ */ new Map(), f = this._inverseAttributes.indexOf(r), m = F.get(f) ?? [];
8290
- m.push(p), F.set(f, m), i.set(T, F);
8291
- }
8292
- }
8321
+ const p = await s.getProperties((a = h[E]) == null ? void 0 : a.value), A = h[u];
8322
+ if (!p || !A || !(A && Array.isArray(A)))
8323
+ continue;
8324
+ const m = A.map((C) => C.value);
8325
+ await o(p.expressID, m), n[p.expressID] = m;
8293
8326
  }
8294
- return this.onRelationsIndexed.trigger({
8295
- modelID: e.toString(),
8296
- relationsMap: i
8297
- }), i;
8327
+ return n;
8298
8328
  }
8299
- /**
8300
- * Retrieves the relations of a specific entity within a model based on the given relation name.
8301
- * This method searches the indexed relation maps for the specified model and entity,
8302
- * returning the IDs of related entities if a match is found.
8303
- *
8304
- * @param model The `FragmentsGroup` model containing the entity.
8305
- * @param expressID The unique identifier of the entity within the model.
8306
- * @param relationName The IFC schema inverse attribute of the relation to search for (e.g., "IsDefinedBy", "ContainsElements").
8307
- * @returns An array of express IDs representing the related entities, or `null` if no relations are found
8308
- * or the specified relation name is not indexed.
8309
- */
8310
- getEntityRelations(t, e, i) {
8311
- const o = this.relationMaps[t.uuid];
8312
- if (!o)
8329
+ static async getQsetQuantities(s, t, e) {
8330
+ const o = e ?? (() => {
8331
+ }), n = await s.getProperties(t);
8332
+ return !n || n.type !== U.IFCELEMENTQUANTITY ? null : (n.Quantities ?? [{}]).map((c) => (c.value && o(c.value), c.value)).filter((c) => c !== null);
8333
+ }
8334
+ static async getPsetProps(s, t, e) {
8335
+ const o = e ?? (() => {
8336
+ }), n = await s.getProperties(t);
8337
+ return !n || n.type !== U.IFCPROPERTYSET ? null : (n.HasProperties ?? [{}]).map((c) => (c.value && o(c.value), c.value)).filter((c) => c !== null);
8338
+ }
8339
+ static async getPsetRel(s, t) {
8340
+ var r;
8341
+ if (!await s.getProperties(t))
8313
8342
  return null;
8314
- const n = o.get(e), r = this._inverseAttributes.indexOf(i);
8315
- if (!n || r === -1)
8343
+ const i = await s.getAllPropertiesOfType(
8344
+ U.IFCRELDEFINESBYPROPERTIES
8345
+ );
8346
+ if (!i)
8316
8347
  return null;
8317
- const a = n.get(r);
8318
- return a || null;
8348
+ const o = Object.values(i);
8349
+ let n = null;
8350
+ for (const a of o)
8351
+ ((r = a.RelatingPropertyDefinition) == null ? void 0 : r.value) === t && (n = a.expressID);
8352
+ return n;
8319
8353
  }
8320
- /**
8321
- * Serializes the relations of a given relation map into a JSON string.
8322
- * This method iterates through the relations in the given map, organizing them into a structured object where each key is an expressID of an entity,
8323
- * and its value is another object mapping relation indices to arrays of related entity expressIDs.
8324
- * The resulting object is then serialized into a JSON string.
8325
- *
8326
- * @param relationMap - The map of relations to be serialized. The map keys are expressIDs of entities, and the values are maps where each key is a relation type ID and its value is an array of expressIDs of entities related through that relation type.
8327
- * @returns A JSON string representing the serialized relations of the given relation map.
8328
- */
8329
- serializeRelations(t) {
8330
- const e = {};
8331
- for (const [i, o] of t.entries()) {
8332
- e[i] || (e[i] = {});
8333
- for (const [n, r] of o.entries())
8334
- e[i][n] = r;
8335
- }
8336
- return JSON.stringify(e);
8354
+ static async getQsetRel(s, t) {
8355
+ return Kt.getPsetRel(s, t);
8337
8356
  }
8338
- /**
8339
- * Serializes the relations of a specific model into a JSON string.
8340
- * This method iterates through the relations indexed for the given model,
8341
- * organizing them into a structured object where each key is an expressID of an entity,
8342
- * and its value is another object mapping relation indices to arrays of related entity expressIDs.
8343
- * The resulting object is then serialized into a JSON string.
8344
- *
8345
- * @param model The `FragmentsGroup` model whose relations are to be serialized.
8346
- * @returns A JSON string representing the serialized relations of the specified model.
8347
- * If the model has no indexed relations, `null` is returned.
8348
- */
8349
- serializeModelRelations(t) {
8350
- const e = this.relationMaps[t.uuid];
8351
- return e ? this.serializeRelations(e) : null;
8357
+ static async getEntityName(s, t) {
8358
+ var n;
8359
+ const e = await s.getProperties(t);
8360
+ if (!e)
8361
+ return { key: null, name: null };
8362
+ const i = Object.keys(e).find((r) => r.endsWith("Name")) ?? null, o = i ? (n = e[i]) == null ? void 0 : n.value : null;
8363
+ return { key: i, name: o };
8352
8364
  }
8353
- /**
8354
- * Serializes all relations of every model processed by the indexer into a JSON string.
8355
- * This method iterates through each model's relations indexed in `relationMaps`, organizing them
8356
- * into a structured JSON object. Each top-level key in this object corresponds to a model's UUID,
8357
- * and its value is another object mapping entity expressIDs to their related entities, categorized
8358
- * by relation types. The structure facilitates easy access to any entity's relations across all models.
8359
- *
8360
- * @returns A JSON string representing the serialized relations of all models processed by the indexer.
8361
- * If no relations have been indexed, an empty object is returned as a JSON string.
8362
- */
8363
- serializeAllRelations() {
8364
- const t = {};
8365
- for (const e in this.relationMaps) {
8366
- const i = this.relationMaps[e], o = {};
8367
- for (const [n, r] of i.entries()) {
8368
- o[n] || (o[n] = {});
8369
- for (const [a, c] of r.entries())
8370
- o[n][a] = c;
8371
- }
8372
- t[e] = o;
8373
- }
8374
- return JSON.stringify(t);
8365
+ static async getQuantityValue(s, t) {
8366
+ const e = await s.getProperties(t);
8367
+ if (!e)
8368
+ return { key: null, value: null };
8369
+ const i = Object.keys(e).find((n) => n.endsWith("Value")) ?? null;
8370
+ let o;
8371
+ return i === null || e[i] === void 0 || e[i] === null ? o = null : o = e[i].value, { key: i, value: o };
8375
8372
  }
8376
- /**
8377
- * Converts a JSON string representing relations between entities into a structured map.
8378
- * This method parses the JSON string to reconstruct the relations map that indexes
8379
- * entity relations by their express IDs. The outer map keys are the express IDs of entities,
8380
- * and the values are maps where each key is a relation type ID and its value is an array
8381
- * of express IDs of entities related through that relation type.
8382
- *
8383
- * @param json The JSON string to be parsed into the relations map.
8384
- * @returns A `Map` where the key is the express ID of an entity as a number, and the value
8385
- * is another `Map`. This inner map's key is the relation type ID as a number, and its value
8386
- * is an array of express IDs (as numbers) of entities related through that relation type.
8387
- */
8388
- getRelationsMapFromJSON(t) {
8389
- const e = JSON.parse(t), i = /* @__PURE__ */ new Map();
8390
- for (const o in e) {
8391
- const n = e[o], r = /* @__PURE__ */ new Map();
8392
- for (const a in n)
8393
- r.set(Number(a), n[a]);
8394
- i.set(Number(o), r);
8395
- }
8396
- return i;
8373
+ static isRel(s) {
8374
+ return Bn[s].startsWith("IFCREL");
8397
8375
  }
8398
- /**
8399
- * Disposes the component, cleaning up resources and detaching event listeners.
8400
- * This ensures that the component is properly cleaned up and does not leave behind any
8401
- * references that could prevent garbage collection.
8402
- */
8403
- dispose() {
8404
- this.relationMaps = {}, this.components.get(ut).onFragmentsDisposed.remove(this.onFragmentsDisposed), this.onDisposed.trigger(Ve.uuid), this.onDisposed.reset();
8376
+ static async attributeExists(s, t, e) {
8377
+ const i = await s.getProperties(t);
8378
+ return i ? Object.keys(i).includes(e) : !1;
8405
8379
  }
8406
- };
8407
- I(Ve, "uuid", "23a889ab-83b3-44a4-8bee-ead83438370b");
8408
- let We = Ve;
8380
+ static async groupEntitiesByType(s, t) {
8381
+ var i;
8382
+ const e = /* @__PURE__ */ new Map();
8383
+ for (const o of t) {
8384
+ const n = await s.getProperties(o);
8385
+ if (!n)
8386
+ continue;
8387
+ const r = n.type;
8388
+ e.get(r) || e.set(r, /* @__PURE__ */ new Set()), (i = e.get(r)) == null || i.add(o);
8389
+ }
8390
+ return e;
8391
+ }
8392
+ // static getPropertyUnits(properties: IfcProperties, expressID: number) {
8393
+ // const entity = properties[expressID];
8394
+ // if (!entity) return null;
8395
+ // const propertyInstance =
8396
+ // entity instanceof WEBIFC.IFC2X3.IfcProperty ||
8397
+ // entity instanceof WEBIFC.IFC4.IfcProperty ||
8398
+ // entity instanceof WEBIFC.IFC4X3.IfcProperty;
8399
+ // if (!propertyInstance) return null;
8400
+ // const { key: valueKey } = IfcPropertiesUtils.getQuantityValue(
8401
+ // properties,
8402
+ // expressID
8403
+ // );
8404
+ // if (!valueKey) return null;
8405
+ // // @ts-ignore
8406
+ // const measureName = entity[valueKey].constructor.name as string;
8407
+ // const isMeasureAttribute = measureName.endsWith("Measure");
8408
+ // if (!isMeasureAttribute) return null;
8409
+ // const measureType = measureName.slice(3, measureName.length - 7);
8410
+ // return propertyInstance;
8411
+ // }
8412
+ }
8409
8413
  class jr {
8410
8414
  constructor() {
8411
8415
  I(this, "factor", 1);
@@ -8522,8 +8526,8 @@ class Yn {
8522
8526
  continue;
8523
8527
  const E = d.RelatingObject.value, u = d.RelatedObjects;
8524
8528
  for (const p of u) {
8525
- const A = p.value, R = this.itemsByFloor[E];
8526
- R !== void 0 && (this.itemsByFloor[A] = R);
8529
+ const A = p.value, m = this.itemsByFloor[E];
8530
+ m !== void 0 && (this.itemsByFloor[A] = m);
8527
8531
  }
8528
8532
  }
8529
8533
  } catch {
@@ -8743,32 +8747,32 @@ const Ge = class Ge extends J {
8743
8747
  for (let n = 0; n < i; n++) {
8744
8748
  const r = t.geometries.get(n), { x: a, y: c, z: h, w: d } = r.color, E = d !== 1, { geometryExpressID: u } = r, p = `${u}-${E}`;
8745
8749
  if (!this._visitedFragments.has(p)) {
8746
- const m = this.getGeometry(this.webIfc, u), O = E ? this._materialT : this._material, S = new Vt.Fragment(m, O, 1);
8750
+ const T = this.getGeometry(this.webIfc, u), O = E ? this._materialT : this._material, S = new Vt.Fragment(T, O, 1);
8747
8751
  e.add(S.mesh), e.items.push(S);
8748
8752
  const _ = this._visitedFragments.size;
8749
8753
  this._visitedFragments.set(p, { index: _, fragment: S });
8750
8754
  }
8751
- const A = new g.Color().setRGB(a, c, h, "srgb"), R = new g.Matrix4();
8752
- R.fromArray(r.flatTransformation);
8755
+ const A = new g.Color().setRGB(a, c, h, "srgb"), m = new g.Matrix4();
8756
+ m.fromArray(r.flatTransformation);
8753
8757
  const C = this._visitedFragments.get(p);
8754
8758
  if (C === void 0)
8755
8759
  throw new Error("Error getting geometry data for streaming!");
8756
- const T = e.data.get(o);
8757
- if (!T)
8760
+ const R = e.data.get(o);
8761
+ if (!R)
8758
8762
  throw new Error("Data not found!");
8759
- T[0].push(C.index);
8763
+ R[0].push(C.index);
8760
8764
  const { fragment: F } = C;
8761
8765
  this._fragmentInstances.has(F.id) || this._fragmentInstances.set(F.id, /* @__PURE__ */ new Map());
8762
8766
  const f = this._fragmentInstances.get(F.id);
8763
8767
  if (!f)
8764
8768
  throw new Error("Instances not found!");
8765
8769
  if (f.has(o)) {
8766
- const m = f.get(o);
8767
- if (!m)
8770
+ const T = f.get(o);
8771
+ if (!T)
8768
8772
  throw new Error("Instance not found!");
8769
- m.transforms.push(R), m.colors && m.colors.push(A);
8773
+ T.transforms.push(m), T.colors && T.colors.push(A);
8770
8774
  } else
8771
- f.set(o, { id: o, transforms: [R], colors: [A] });
8775
+ f.set(o, { id: o, transforms: [m], colors: [A] });
8772
8776
  }
8773
8777
  }
8774
8778
  getGeometry(t, e) {
@@ -8888,7 +8892,7 @@ const Bt = class Bt extends J {
8888
8892
  const o = await t.getProperties(i);
8889
8893
  if ((o == null ? void 0 : o.type) !== U.IFCPROPERTYSET)
8890
8894
  continue;
8891
- const n = await Gt.getPsetRel(t, i);
8895
+ const n = await Kt.getPsetRel(t, i);
8892
8896
  if (n && (await t.setProperties(n, null), this.registerChange(t, n)), o) {
8893
8897
  for (const r of o.HasProperties)
8894
8898
  await t.setProperties(r.value, null);
@@ -8919,7 +8923,7 @@ const Bt = class Bt extends J {
8919
8923
  !o || !n || o.type === U.IFCPROPERTYSET && n && (o.HasProperties = o.HasProperties.filter((r) => r.value !== i), await t.setProperties(i, null), this.registerChange(t, e, i));
8920
8924
  }
8921
8925
  async addElementToPset(t, e, ...i) {
8922
- const o = await Gt.getPsetRel(t, e);
8926
+ const o = await Kt.getPsetRel(t, e);
8923
8927
  if (!o)
8924
8928
  return;
8925
8929
  const n = await t.getProperties(o);
@@ -9112,11 +9116,11 @@ const Ls = class Ls extends J {
9112
9116
  }
9113
9117
  }
9114
9118
  async byIfcRel(t, e, i) {
9115
- Gt.isRel(e) && await Gt.getRelationMap(
9119
+ Kt.isRel(e) && await Kt.getRelationMap(
9116
9120
  t,
9117
9121
  e,
9118
9122
  async (o, n) => {
9119
- const { name: r } = await Gt.getEntityName(
9123
+ const { name: r } = await Kt.getEntityName(
9120
9124
  t,
9121
9125
  o
9122
9126
  );
@@ -9280,9 +9284,9 @@ class zn extends yi {
9280
9284
  class $r extends J {
9281
9285
  constructor() {
9282
9286
  super(...arguments);
9283
- I(this, "onPropertiesStreamed", new Kt());
9284
- I(this, "onProgress", new Kt());
9285
- I(this, "onIndicesStreamed", new Kt());
9287
+ I(this, "onPropertiesStreamed", new $t());
9288
+ I(this, "onProgress", new $t());
9289
+ I(this, "onIndicesStreamed", new $t());
9286
9290
  /** {@link Disposable.onDisposed} */
9287
9291
  I(this, "onDisposed", new D());
9288
9292
  I(this, "enabled", !0);
@@ -9331,11 +9335,11 @@ class $r extends J {
9331
9335
  continue;
9332
9336
  const d = n.has(h), E = this.webIfc.GetLineIDsWithType(0, h), u = E.size();
9333
9337
  let p = 0;
9334
- for (let R = 0; R < u - t; R += t) {
9338
+ for (let m = 0; m < u - t; m += t) {
9335
9339
  const C = {};
9336
- for (let T = 0; T < t; T++) {
9340
+ for (let R = 0; R < t; R++) {
9337
9341
  p++;
9338
- const F = E.get(R + T);
9342
+ const F = E.get(m + R);
9339
9343
  try {
9340
9344
  const f = this.webIfc.GetLine(0, F, d);
9341
9345
  i.includes(h) && this.getIndices(f, F, o), C[f.expressID] = f;
@@ -9346,17 +9350,17 @@ class $r extends J {
9346
9350
  await this.onPropertiesStreamed.trigger({ type: h, data: C });
9347
9351
  }
9348
9352
  if (p !== u) {
9349
- const R = {};
9353
+ const m = {};
9350
9354
  for (let C = p; C < u; C++) {
9351
- const T = E.get(C);
9355
+ const R = E.get(C);
9352
9356
  try {
9353
- const F = this.webIfc.GetLine(0, T, d);
9354
- i.includes(h) && this.getIndices(F, T, o), R[F.expressID] = F;
9357
+ const F = this.webIfc.GetLine(0, R, d);
9358
+ i.includes(h) && this.getIndices(F, R, o), m[F.expressID] = F;
9355
9359
  } catch {
9356
- console.log(`Could not get property: ${T}`);
9360
+ console.log(`Could not get property: ${R}`);
9357
9361
  }
9358
9362
  }
9359
- await this.onPropertiesStreamed.trigger({ type: h, data: R });
9363
+ await this.onPropertiesStreamed.trigger({ type: h, data: m });
9360
9364
  }
9361
9365
  const A = a / e.size;
9362
9366
  A > r && (r += 0.01, r = Math.max(r, A), await this.onProgress.trigger(Math.round(r * 100) / 100));
@@ -9448,35 +9452,35 @@ const Ms = class Ms extends J {
9448
9452
  maxExpressID: this.webIfc.GetMaxExpressID(0)
9449
9453
  };
9450
9454
  let r = 0, a = 0;
9451
- for (const R of i) {
9452
- if (!this.webIfc.IsIfcElement(R) && R !== U.IFCSPACE || this.settings.excludedCategories.has(R))
9455
+ for (const m of i) {
9456
+ if (!this.webIfc.IsIfcElement(m) && m !== U.IFCSPACE || this.settings.excludedCategories.has(m))
9453
9457
  continue;
9454
- const C = this.webIfc.GetLineIDsWithType(0, R), T = C.size();
9455
- for (let F = 0; F < T; F++) {
9458
+ const C = this.webIfc.GetLineIDsWithType(0, m), R = C.size();
9459
+ for (let F = 0; F < R; F++) {
9456
9460
  r > t && (r = 0, a++, o.push([]));
9457
9461
  const f = C.get(F);
9458
9462
  o[a].push(f);
9459
- const m = this._spatialTree.itemsByFloor[f] || 0;
9460
- n.data.set(f, [[], [m, R]]), r++;
9463
+ const T = this._spatialTree.itemsByFloor[f] || 0;
9464
+ n.data.set(f, [[], [T, m]]), r++;
9461
9465
  }
9462
9466
  }
9463
9467
  this._spatialTree.cleanUp();
9464
9468
  let c = 0.01, h = 0;
9465
- for (const R of o) {
9466
- h++, this.webIfc.StreamMeshes(0, R, (T) => {
9467
- this.getMesh(this.webIfc, T, n);
9469
+ for (const m of o) {
9470
+ h++, this.webIfc.StreamMeshes(0, m, (R) => {
9471
+ this.getMesh(this.webIfc, R, n);
9468
9472
  }), this._geometryCount > t && await this.streamGeometries(), this._assets.length > e && await this.streamAssets();
9469
9473
  const C = h / o.length;
9470
9474
  C > c && (c += 0.01, c = Math.max(c, C), this.onProgress.trigger(Math.round(c * 100) / 100));
9471
9475
  }
9472
9476
  this._geometryCount && await this.streamGeometries(), this._assets.length && await this.streamAssets();
9473
9477
  const { opaque: d, transparent: E } = n.geometryIDs;
9474
- for (const [R, { index: C, uuid: T }] of this._visitedGeometries)
9475
- n.keyFragments.set(C, T), (R > 1 ? d : E).set(R, C);
9478
+ for (const [m, { index: C, uuid: R }] of this._visitedGeometries)
9479
+ n.keyFragments.set(C, R), (m > 1 ? d : E).set(m, C);
9476
9480
  const u = n.data.keys();
9477
- for (const R of u) {
9478
- const [C] = n.data.get(R);
9479
- C.length || n.data.delete(R);
9481
+ for (const m of u) {
9482
+ const [C] = n.data.get(m);
9483
+ C.length || n.data.delete(m);
9480
9484
  }
9481
9485
  const p = this.webIfc.GetCoordinationMatrix(0);
9482
9486
  n.coordinationMatrix.fromArray(p), n.civilData = this._civil.read(this.webIfc);
@@ -9492,8 +9496,8 @@ const Ms = class Ms extends J {
9492
9496
  const c = e.geometries.get(a), h = c.geometryExpressID, d = c.color.w === 1 ? 1 : -1, E = h * d;
9493
9497
  if (!this._visitedGeometries.has(E)) {
9494
9498
  this._visitedGeometries.has(h) || this.getGeometry(t, h);
9495
- const m = this._visitedGeometries.size, O = g.MathUtils.generateUUID();
9496
- this._visitedGeometries.set(E, { uuid: O, index: m });
9499
+ const T = this._visitedGeometries.size, O = g.MathUtils.generateUUID();
9500
+ this._visitedGeometries.set(E, { uuid: O, index: T });
9497
9501
  }
9498
9502
  const u = this._visitedGeometries.get(E);
9499
9503
  if (u === void 0)
@@ -9502,7 +9506,7 @@ const Ms = class Ms extends J {
9502
9506
  if (!p)
9503
9507
  throw new Error("Data not found!");
9504
9508
  p[0].push(u.index);
9505
- const { x: A, y: R, z: C, w: T } = c.color, F = [A, R, C, T], f = c.flatTransformation;
9509
+ const { x: A, y: m, z: C, w: R } = c.color, F = [A, m, C, R], f = c.flatTransformation;
9506
9510
  r.geometries.push({ color: F, geometryID: h, transformation: f });
9507
9511
  }
9508
9512
  this._assets.push(r);
@@ -9520,8 +9524,8 @@ const Ms = class Ms extends J {
9520
9524
  const c = mr(r), h = new Float32Array(c.transformation.elements), d = [c.center.x, c.center.y, c.center.z];
9521
9525
  let E = !1;
9522
9526
  for (let u = 0; u < r.length - 2; u += 3) {
9523
- const p = r[u], A = r[u + 1], R = r[u + 2], C = a[u], T = a[u + 1], F = a[u + 2];
9524
- if (Rr(d, [p, A, R], [C, T, F])) {
9527
+ const p = r[u], A = r[u + 1], m = r[u + 2], C = a[u], R = a[u + 1], F = a[u + 2];
9528
+ if (Rr(d, [p, A, m], [C, R, F])) {
9525
9529
  E = !0;
9526
9530
  break;
9527
9531
  }
@@ -9549,9 +9553,9 @@ let Nn = Ms;
9549
9553
  class Kr extends J {
9550
9554
  constructor() {
9551
9555
  super(...arguments);
9552
- I(this, "onPropertiesStreamed", new Kt());
9553
- I(this, "onProgress", new Kt());
9554
- I(this, "onIndicesStreamed", new Kt());
9556
+ I(this, "onPropertiesStreamed", new $t());
9557
+ I(this, "onProgress", new $t());
9558
+ I(this, "onIndicesStreamed", new $t());
9555
9559
  /** {@link Disposable.onDisposed} */
9556
9560
  I(this, "onDisposed", new D());
9557
9561
  I(this, "enabled", !0);
@@ -9594,26 +9598,26 @@ class Kr extends J {
9594
9598
  const h = i.has(c), d = this.webIfc.GetLineIDsWithType(0, c), E = d.size();
9595
9599
  let u = 0;
9596
9600
  for (let A = 0; A < E - t; A += t) {
9597
- const R = {};
9601
+ const m = {};
9598
9602
  for (let C = 0; C < t; C++) {
9599
9603
  u++;
9600
- const T = d.get(A + C);
9604
+ const R = d.get(A + C);
9601
9605
  try {
9602
- const F = this.webIfc.GetLine(0, T, h);
9603
- R[F.expressID] = F;
9606
+ const F = this.webIfc.GetLine(0, R, h);
9607
+ m[F.expressID] = F;
9604
9608
  } catch {
9605
- console.log(`Could not get property: ${T}`);
9609
+ console.log(`Could not get property: ${R}`);
9606
9610
  }
9607
9611
  }
9608
- await this.onPropertiesStreamed.trigger({ type: c, data: R });
9612
+ await this.onPropertiesStreamed.trigger({ type: c, data: m });
9609
9613
  }
9610
9614
  if (u !== E) {
9611
9615
  const A = {};
9612
- for (let R = u; R < E; R++) {
9613
- const C = d.get(R);
9616
+ for (let m = u; m < E; m++) {
9617
+ const C = d.get(m);
9614
9618
  try {
9615
- const T = this.webIfc.GetLine(0, C, h);
9616
- A[T.expressID] = T;
9619
+ const R = this.webIfc.GetLine(0, C, h);
9620
+ A[R.expressID] = R;
9617
9621
  } catch {
9618
9622
  console.log(`Could not get property: ${C}`);
9619
9623
  }
@@ -9649,60 +9653,60 @@ const Ds = class Ds extends J {
9649
9653
  const { plane: u, edges: p } = this.getFaceData(E, i, t);
9650
9654
  if (u.equals(r)) {
9651
9655
  a.push({ index: E, edges: p });
9652
- for (const { id: A, points: R, distance: C } of p)
9653
- o.set(A, { points: R, distance: C });
9656
+ for (const { id: A, points: m, distance: C } of p)
9657
+ o.set(A, { points: m, distance: C });
9654
9658
  }
9655
9659
  }
9656
9660
  let c = 0;
9657
9661
  const h = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map();
9658
9662
  for (const { index: E, edges: u } of a) {
9659
9663
  const p = /* @__PURE__ */ new Map();
9660
- for (const { id: m } of u)
9661
- if (h.has(m)) {
9662
- const O = h.get(m);
9663
- p.set(m, O);
9664
+ for (const { id: T } of u)
9665
+ if (h.has(T)) {
9666
+ const O = h.get(T);
9667
+ p.set(T, O);
9664
9668
  }
9665
- const A = u.map((m) => m.id);
9669
+ const A = u.map((T) => T.id);
9666
9670
  if (!p.size) {
9667
- const m = c++;
9671
+ const T = c++;
9668
9672
  for (const { id: O } of u)
9669
- h.set(O, m);
9670
- d.set(m, {
9673
+ h.set(O, T);
9674
+ d.set(T, {
9671
9675
  edges: new Set(A),
9672
9676
  indices: /* @__PURE__ */ new Set([E])
9673
9677
  });
9674
9678
  continue;
9675
9679
  }
9676
- let R = null;
9677
- const C = /* @__PURE__ */ new Set(), T = new Set(A);
9678
- for (const [m, O] of p) {
9679
- R === null ? R = O : O !== R && C.add(O), h.delete(m);
9680
+ let m = null;
9681
+ const C = /* @__PURE__ */ new Set(), R = new Set(A);
9682
+ for (const [T, O] of p) {
9683
+ m === null ? m = O : O !== m && C.add(O), h.delete(T);
9680
9684
  const { edges: S } = d.get(O);
9681
- S.delete(m), T.delete(m);
9685
+ S.delete(T), R.delete(T);
9682
9686
  }
9683
- if (R === null)
9687
+ if (m === null)
9684
9688
  throw new Error("Error computing face!");
9685
- const F = d.get(R), { indices: f } = F;
9689
+ const F = d.get(m), { indices: f } = F;
9686
9690
  f.add(E);
9687
- for (const m of T) {
9688
- h.set(m, R);
9691
+ for (const T of R) {
9692
+ h.set(T, m);
9689
9693
  const { edges: O } = F;
9690
- O.add(m);
9694
+ O.add(T);
9691
9695
  }
9692
- for (const m of C) {
9693
- const O = d.get(m), { edges: S, indices: _ } = O, N = d.get(R), { edges: L, indices: M } = N;
9696
+ for (const T of C) {
9697
+ const O = d.get(T), { edges: S, indices: _ } = O, N = d.get(m), { edges: L, indices: M } = N;
9694
9698
  for (const y of S)
9695
- L.add(y), h.set(y, R);
9699
+ L.add(y), h.set(y, m);
9696
9700
  for (const y of _)
9697
9701
  M.add(y);
9698
- d.delete(m);
9702
+ d.delete(T);
9699
9703
  }
9700
9704
  }
9701
9705
  for (const [E, { indices: u, edges: p }] of d)
9702
9706
  if (u.has(e)) {
9703
9707
  const A = [];
9704
- for (const R of p) {
9705
- const C = o.get(R);
9708
+ for (const m of p) {
9709
+ const C = o.get(m);
9706
9710
  A.push(C);
9707
9711
  }
9708
9712
  return { edges: A, indices: u };
@@ -9725,7 +9729,7 @@ const Ds = class Ds extends J {
9725
9729
  const [
9726
9730
  { id: d, value: E },
9727
9731
  { id: u, value: p },
9728
- { id: A, value: R }
9732
+ { id: A, value: m }
9729
9733
  ] = h, C = [
9730
9734
  {
9731
9735
  id: `${d}|${u}`,
@@ -9734,26 +9738,26 @@ const Ds = class Ds extends J {
9734
9738
  },
9735
9739
  {
9736
9740
  id: `${u}|${A}`,
9737
- distance: p.distanceTo(R),
9738
- points: [p, R]
9741
+ distance: p.distanceTo(m),
9742
+ points: [p, m]
9739
9743
  },
9740
9744
  {
9741
9745
  id: `${d}|${A}`,
9742
- distance: E.distanceTo(R),
9743
- points: [E, R]
9746
+ distance: E.distanceTo(m),
9747
+ points: [E, m]
9744
9748
  }
9745
- ], T = new g.Plane();
9746
- return T.setFromNormalAndCoplanarPoint(c, n), T.constant = Math.round(T.constant * 10) / 10, { plane: T, edges: C };
9749
+ ], R = new g.Plane();
9750
+ return R.setFromNormalAndCoplanarPoint(c, n), R.constant = Math.round(R.constant * 10) / 10, { plane: R, edges: C };
9747
9751
  }
9748
9752
  getVerticesAndNormal(t, e, i) {
9749
9753
  if (!t.geometry.index)
9750
9754
  throw new Error("Geometry must be indexed!");
9751
- 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 g.Vector3(n[a], n[a + 1], n[a + 2]), E = new g.Vector3(n[c], n[c + 1], n[c + 2]), u = new g.Vector3(n[h], n[h + 1], n[h + 2]), p = new g.Vector3(r[a], r[a + 1], r[a + 2]), A = new g.Vector3(r[c], r[c + 1], r[c + 2]), R = new g.Vector3(r[h], r[h + 1], r[h + 2]), C = (p.x + A.x + R.x) / 3, T = (p.y + A.y + R.y) / 3, F = (p.z + A.z + R.z) / 3, f = new g.Vector3(C, T, F);
9755
+ 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 g.Vector3(n[a], n[a + 1], n[a + 2]), E = new g.Vector3(n[c], n[c + 1], n[c + 2]), u = new g.Vector3(n[h], n[h + 1], n[h + 2]), p = new g.Vector3(r[a], r[a + 1], r[a + 2]), A = new g.Vector3(r[c], r[c + 1], r[c + 2]), m = new g.Vector3(r[h], r[h + 1], r[h + 2]), C = (p.x + A.x + m.x) / 3, R = (p.y + A.y + m.y) / 3, F = (p.z + A.z + m.z) / 3, f = new g.Vector3(C, R, F);
9752
9756
  if (i !== void 0 && t instanceof g.InstancedMesh) {
9753
- const m = new g.Matrix4();
9754
- t.getMatrixAt(i, m);
9757
+ const T = new g.Matrix4();
9758
+ t.getMatrixAt(i, T);
9755
9759
  const O = new g.Matrix4();
9756
- O.extractRotation(m), f.applyMatrix4(O), d.applyMatrix4(m), E.applyMatrix4(m), u.applyMatrix4(m);
9760
+ O.extractRotation(T), f.applyMatrix4(O), d.applyMatrix4(T), E.applyMatrix4(T), u.applyMatrix4(T);
9757
9761
  }
9758
9762
  return { p1: d, p2: E, p3: u, faceNormal: f };
9759
9763
  }
@@ -9764,7 +9768,7 @@ const Ds = class Ds extends J {
9764
9768
  I(Ds, "uuid", "267ca032-672f-4cb0-afa9-d24e904f39d6");
9765
9769
  let Pn = Ds;
9766
9770
  export {
9767
- Kt as AsyncEvent,
9771
+ $t as AsyncEvent,
9768
9772
  _i as Base,
9769
9773
  cr as BaseCamera,
9770
9774
  lr as BaseRenderer,
@@ -9777,7 +9781,7 @@ export {
9777
9781
  pi as Components,
9778
9782
  Vr as CullerRenderer,
9779
9783
  Ti as Cullers,
9780
- Ht as Disposer,
9784
+ zt as Disposer,
9781
9785
  D as Event,
9782
9786
  Sn as Exploder,
9783
9787
  Hr as FirstPersonMode,
@@ -9787,13 +9791,13 @@ export {
9787
9791
  _n as Hider,
9788
9792
  ra as IfcCategories,
9789
9793
  Bn as IfcCategoryMap,
9790
- Zr as IfcElements,
9794
+ Qr as IfcElements,
9791
9795
  Nn as IfcGeometryTiler,
9792
9796
  mi as IfcJsonExporter,
9793
9797
  Ri as IfcLoader,
9794
9798
  gn as IfcPropertiesManager,
9795
9799
  Kr as IfcPropertiesTiler,
9796
- Gt as IfcPropertiesUtils,
9800
+ Kt as IfcPropertiesUtils,
9797
9801
  We as IfcRelationsIndexer,
9798
9802
  qr as IfcStreamingSettings,
9799
9803
  nn as MaterialsUtils,