@thatopen/components 2.0.20 → 2.0.21

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,26 +92,26 @@ function Re(l) {
92
92
  return 2 * (e * t + t * s + s * e);
93
93
  }
94
94
  function Gs(l, e, t, s, i = null) {
95
- let o = 1 / 0, n = 1 / 0, r = 1 / 0, a = -1 / 0, c = -1 / 0, E = -1 / 0, d = 1 / 0, h = 1 / 0, u = 1 / 0, p = -1 / 0, A = -1 / 0, m = -1 / 0;
95
+ let o = 1 / 0, n = 1 / 0, r = 1 / 0, a = -1 / 0, c = -1 / 0, h = -1 / 0, d = 1 / 0, E = 1 / 0, u = 1 / 0, p = -1 / 0, A = -1 / 0, m = -1 / 0;
96
96
  const C = i !== null;
97
97
  for (let R = e * 6, F = (e + t) * 6; R < F; R += 6) {
98
98
  const f = l[R + 0], T = l[R + 1], O = f - T, _ = f + T;
99
99
  O < o && (o = O), _ > a && (a = _), C && f < d && (d = f), C && f > p && (p = f);
100
100
  const S = l[R + 2], N = l[R + 3], P = S - N, w = S + N;
101
- P < n && (n = P), w > c && (c = w), C && S < h && (h = S), C && S > A && (A = S);
101
+ P < n && (n = P), w > c && (c = w), C && S < E && (E = S), C && S > A && (A = S);
102
102
  const y = l[R + 4], U = l[R + 5], x = y - U, B = y + U;
103
- x < r && (r = x), B > E && (E = B), C && y < u && (u = y), C && y > m && (m = y);
103
+ x < r && (r = x), B > h && (h = B), C && y < u && (u = y), C && y > m && (m = y);
104
104
  }
105
- s[0] = o, s[1] = n, s[2] = r, s[3] = a, s[4] = c, s[5] = E, C && (i[0] = d, i[1] = h, i[2] = u, i[3] = p, i[4] = A, i[5] = m);
105
+ s[0] = o, s[1] = n, s[2] = r, s[3] = a, s[4] = c, s[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 lo(l, e, t, s) {
108
108
  let i = 1 / 0, o = 1 / 0, n = 1 / 0, r = -1 / 0, a = -1 / 0, c = -1 / 0;
109
- for (let E = e * 6, d = (e + t) * 6; E < d; E += 6) {
110
- const h = l[E + 0];
111
- h < i && (i = h), h > r && (r = h);
112
- const u = l[E + 2];
109
+ for (let h = e * 6, d = (e + t) * 6; h < d; h += 6) {
110
+ const E = l[h + 0];
111
+ E < i && (i = E), E > r && (r = E);
112
+ const u = l[h + 2];
113
113
  u < o && (o = u), u > a && (a = u);
114
- const p = l[E + 4];
114
+ const p = l[h + 4];
115
115
  p < n && (n = p), p > c && (c = p);
116
116
  }
117
117
  s[0] = i, s[1] = o, s[2] = n, s[3] = r, s[4] = a, s[5] = c;
@@ -121,14 +121,14 @@ function ho(l, e) {
121
121
  const t = l.attributes.position, s = l.index ? l.index.array : null, i = pe(l), o = new Float32Array(i * 6), n = t.normalized, r = t.array, a = t.offset || 0;
122
122
  let c = 3;
123
123
  t.isInterleavedBufferAttribute && (c = t.data.stride);
124
- const E = ["getX", "getY", "getZ"];
124
+ const h = ["getX", "getY", "getZ"];
125
125
  for (let d = 0; d < i; d++) {
126
- const h = d * 3, u = d * 6;
127
- let p = h + 0, A = h + 1, m = h + 2;
126
+ const E = d * 3, u = d * 6;
127
+ let p = E + 0, A = E + 1, m = E + 2;
128
128
  s && (p = s[p], A = s[A], m = s[m]), n || (p = p * c + a, A = A * c + a, m = m * c + a);
129
129
  for (let C = 0; C < 3; C++) {
130
130
  let R, F, f;
131
- n ? (R = t[E[C]](p), F = t[E[C]](A), f = t[E[C]](m)) : (R = r[p + C], F = r[A + C], f = r[m + C]);
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
132
  let T = R;
133
133
  F < T && (T = F), f < T && (T = f);
134
134
  let O = R;
@@ -155,16 +155,16 @@ function uo(l, e, t, s, i, o) {
155
155
  else if (o === so) {
156
156
  const a = Re(l);
157
157
  let c = Ys * i;
158
- const E = s * 6, d = (s + i) * 6;
159
- for (let h = 0; h < 3; h++) {
160
- const u = e[h], m = (e[h + 3] - u) / Mt;
158
+ const h = s * 6, d = (s + i) * 6;
159
+ for (let E = 0; E < 3; E++) {
160
+ const u = e[E], m = (e[E + 3] - u) / Mt;
161
161
  if (i < Mt / 4) {
162
162
  const C = [...Ut];
163
163
  C.length = i;
164
164
  let R = 0;
165
- for (let f = E; f < d; f += 6, R++) {
165
+ for (let f = h; f < d; f += 6, R++) {
166
166
  const T = C[R];
167
- T.candidate = t[f + 2 * h], T.count = 0;
167
+ T.candidate = t[f + 2 * E], T.count = 0;
168
168
  const {
169
169
  bounds: O,
170
170
  leftCacheBounds: _,
@@ -181,8 +181,8 @@ function uo(l, e, t, s, i, o) {
181
181
  for (; f + 1 < F && C[f + 1].candidate === T.candidate; )
182
182
  C.splice(f + 1, 1), F--;
183
183
  }
184
- for (let f = E; f < d; f += 6) {
185
- const T = t[f + 2 * h];
184
+ for (let f = h; f < d; f += 6) {
185
+ const T = t[f + 2 * E];
186
186
  for (let O = 0; O < F; O++) {
187
187
  const _ = C[O];
188
188
  T >= _.candidate ? Qe(f, t, _.rightCacheBounds) : (Qe(f, t, _.leftCacheBounds), _.count++);
@@ -195,7 +195,7 @@ function uo(l, e, t, s, i, o) {
195
195
  let w = 0;
196
196
  _ !== 0 && (w = Re(N) / a);
197
197
  const y = bi + Ys * (P * O + w * _);
198
- y < c && (n = h, c = y, r = T.candidate);
198
+ y < c && (n = E, c = y, r = T.candidate);
199
199
  }
200
200
  } else {
201
201
  for (let F = 0; F < Mt; F++) {
@@ -205,8 +205,8 @@ function uo(l, e, t, s, i, o) {
205
205
  for (let O = 0; O < 3; O++)
206
206
  T[O] = 1 / 0, T[O + 3] = -1 / 0;
207
207
  }
208
- for (let F = E; F < d; F += 6) {
209
- let O = ~~((t[F + 2 * h] - u) / m);
208
+ for (let F = h; F < d; F += 6) {
209
+ let O = ~~((t[F + 2 * E] - u) / m);
210
210
  O >= Mt && (O = Mt - 1);
211
211
  const _ = Ut[O];
212
212
  _.count++, Qe(F, t, _.bounds);
@@ -226,7 +226,7 @@ function uo(l, e, t, s, i, o) {
226
226
  const w = i - R;
227
227
  w !== 0 && (P = Re(S) / a);
228
228
  const y = bi + Ys * (N * R + P * w);
229
- y < c && (n = h, c = y, r = f.candidate);
229
+ y < c && (n = E, c = y, r = f.candidate);
230
230
  }
231
231
  }
232
232
  }
@@ -253,13 +253,13 @@ function fo(l, e, t, s, i, o) {
253
253
  for (; n <= r && t[r * 6 + c] >= a; )
254
254
  r--;
255
255
  if (n < r) {
256
- for (let E = 0; E < 3; E++) {
257
- let d = e[n * 3 + E];
258
- e[n * 3 + E] = e[r * 3 + E], e[r * 3 + E] = d;
256
+ for (let h = 0; h < 3; h++) {
257
+ let d = e[n * 3 + h];
258
+ e[n * 3 + h] = e[r * 3 + h], e[r * 3 + h] = d;
259
259
  }
260
- for (let E = 0; E < 6; E++) {
261
- let d = t[n * 6 + E];
262
- t[n * 6 + E] = t[r * 6 + E], t[r * 6 + E] = d;
260
+ for (let h = 0; h < 6; h++) {
261
+ let d = t[n * 6 + h];
262
+ t[n * 6 + h] = t[r * 6 + h], t[r * 6 + h] = d;
263
263
  }
264
264
  n++, r--;
265
265
  } else
@@ -275,11 +275,11 @@ function po(l, e, t, s, i, o) {
275
275
  for (; n <= r && t[r * 6 + c] >= a; )
276
276
  r--;
277
277
  if (n < r) {
278
- let E = l[n];
279
- l[n] = l[r], l[r] = E;
278
+ let h = l[n];
279
+ l[n] = l[r], l[r] = h;
280
280
  for (let d = 0; d < 6; d++) {
281
- let h = t[n * 6 + d];
282
- t[n * 6 + d] = t[r * 6 + d], t[r * 6 + d] = h;
281
+ let E = t[n * 6 + d];
282
+ t[n * 6 + d] = t[r * 6 + d], t[r * 6 + d] = E;
283
283
  }
284
284
  n++, r--;
285
285
  } else
@@ -293,12 +293,12 @@ function Co(l, e) {
293
293
  return n;
294
294
  }
295
295
  function To(l, e) {
296
- const t = l.geometry, s = t.index ? t.index.array : null, i = e.maxDepth, o = e.verbose, n = e.maxLeafTris, r = e.strategy, a = e.onProgress, c = pe(t), E = l._indirectBuffer;
296
+ const t = l.geometry, s = t.index ? t.index.array : null, i = e.maxDepth, o = e.verbose, n = e.maxLeafTris, r = e.strategy, a = e.onProgress, c = pe(t), h = l._indirectBuffer;
297
297
  let d = !1;
298
- const h = new Float32Array(6), u = new Float32Array(6), p = ho(t, h), A = e.indirect ? po : fo, m = [], C = e.indirect ? wn(t) : Dn(t);
298
+ const E = new Float32Array(6), u = new Float32Array(6), p = ho(t, E), A = e.indirect ? po : fo, m = [], C = e.indirect ? wn(t) : Dn(t);
299
299
  if (C.length === 1) {
300
300
  const f = C[0], T = new qe();
301
- T.boundingData = h, lo(p, f.offset, f.count, u), F(T, f.offset, f.count, u), m.push(T);
301
+ T.boundingData = E, lo(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
304
  const T = new qe();
@@ -314,7 +314,7 @@ function To(l, e) {
314
314
  const N = uo(f.boundingData, _, p, T, O, r);
315
315
  if (N.axis === -1)
316
316
  return R(T + O), f.offset = T, f.count = O, f;
317
- const P = A(E, s, p, T, O, N);
317
+ const P = A(h, s, p, T, O, N);
318
318
  if (P === T || P === T + O)
319
319
  R(T + O), f.offset = T, f.count = O;
320
320
  else {
@@ -336,29 +336,29 @@ function mo(l, e) {
336
336
  let i, o, n;
337
337
  const r = [], a = e.useSharedArrayBuffer ? SharedArrayBuffer : ArrayBuffer;
338
338
  for (let d = 0; d < s.length; d++) {
339
- const h = s[d];
340
- let u = c(h);
339
+ const E = s[d];
340
+ let u = c(E);
341
341
  const p = new a(Cs * u);
342
- i = new Float32Array(p), o = new Uint32Array(p), n = new Uint16Array(p), E(0, h), r.push(p);
342
+ i = new Float32Array(p), o = new Uint32Array(p), n = new Uint16Array(p), h(0, E), r.push(p);
343
343
  }
344
344
  l._roots = r;
345
345
  return;
346
346
  function c(d) {
347
347
  return d.count ? 1 : 1 + c(d.left) + c(d.right);
348
348
  }
349
- function E(d, h) {
350
- const u = d / 4, p = d / 2, A = !!h.count, m = h.boundingData;
349
+ function h(d, E) {
350
+ const u = d / 4, p = d / 2, A = !!E.count, m = E.boundingData;
351
351
  for (let C = 0; C < 6; C++)
352
352
  i[u + C] = m[C];
353
353
  if (A) {
354
- const C = h.offset, R = h.count;
354
+ const C = E.offset, R = E.count;
355
355
  return o[u + 6] = C, n[p + 14] = R, n[p + 15] = Us, d + Cs;
356
356
  } else {
357
- const C = h.left, R = h.right, F = h.splitAxis;
357
+ const C = E.left, R = E.right, F = E.splitAxis;
358
358
  let f;
359
- if (f = E(d + Cs, C), f / 4 > Math.pow(2, 32))
359
+ if (f = h(d + Cs, 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 = E(f, R), 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
  }
@@ -393,8 +393,8 @@ wt.prototype.setFromBox = function() {
393
393
  let n = 1 / 0, r = -1 / 0;
394
394
  for (let a = 0; a <= 1; a++)
395
395
  for (let c = 0; c <= 1; c++)
396
- for (let E = 0; E <= 1; E++) {
397
- l.x = i.x * a + o.x * (1 - a), l.y = i.y * c + o.y * (1 - c), l.z = i.z * E + o.z * (1 - E);
396
+ for (let h = 0; h <= 1; h++) {
397
+ l.x = i.x * a + o.x * (1 - a), l.y = i.y * c + o.y * (1 - c), l.z = i.z * h + o.z * (1 - h);
398
398
  const d = t.dot(l);
399
399
  n = Math.min(d, n), r = Math.max(d, r);
400
400
  }
@@ -404,11 +404,11 @@ wt.prototype.setFromBox = function() {
404
404
  const Ro = function() {
405
405
  const l = new M(), e = new M(), t = new M();
406
406
  return function(i, o, n) {
407
- const r = i.start, a = l, c = o.start, E = e;
407
+ const r = i.start, a = l, c = o.start, h = e;
408
408
  t.subVectors(r, c), l.subVectors(i.end, i.start), e.subVectors(o.end, o.start);
409
- const d = t.dot(E), h = E.dot(a), u = E.dot(E), p = t.dot(a), m = a.dot(a) * u - h * h;
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
410
  let C, R;
411
- m !== 0 ? C = (d * h - p * u) / m : C = 0, R = (d + C * h) / u, n.x = C, n.y = 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 fe(), e = new M(), t = new M();
@@ -425,16 +425,16 @@ const Ro = function() {
425
425
  a < 0 ? i.at(0, n) : i.at(1, n), o.closestPointToPoint(n, !0, r);
426
426
  return;
427
427
  } else {
428
- let E;
429
- a < 0 ? E = i.start : E = i.end;
428
+ let h;
429
+ a < 0 ? h = i.start : h = i.end;
430
430
  let d;
431
431
  c < 0 ? d = o.start : d = o.end;
432
- const h = e, u = t;
433
- if (i.closestPointToPoint(d, !0, e), o.closestPointToPoint(E, !0, t), h.distanceToSquared(d) <= u.distanceToSquared(E)) {
434
- n.copy(h), r.copy(d);
432
+ const E = e, u = t;
433
+ if (i.closestPointToPoint(d, !0, e), o.closestPointToPoint(h, !0, t), E.distanceToSquared(d) <= u.distanceToSquared(h)) {
434
+ n.copy(E), r.copy(d);
435
435
  return;
436
436
  } else {
437
- n.copy(E), r.copy(u);
437
+ n.copy(h), r.copy(u);
438
438
  return;
439
439
  }
440
440
  }
@@ -442,8 +442,8 @@ const Ro = function() {
442
442
  }(), Ao = function() {
443
443
  const l = new M(), e = new M(), t = new Fi(), s = new Pt();
444
444
  return function(o, n) {
445
- const { radius: r, center: a } = o, { a: c, b: E, c: d } = n;
446
- if (s.start = c, s.end = E, s.closestPointToPoint(a, !0, l).distanceTo(a) <= r || (s.start = c, s.end = d, s.closestPointToPoint(a, !0, l).distanceTo(a) <= r) || (s.start = E, s.end = d, s.closestPointToPoint(a, !0, l).distanceTo(a) <= r))
445
+ const { radius: r, center: a } = o, { a: c, b: h, c: d } = n;
446
+ if (s.start = c, s.end = h, s.closestPointToPoint(a, !0, l).distanceTo(a) <= r || (s.start = c, s.end = d, s.closestPointToPoint(a, !0, l).distanceTo(a) <= r) || (s.start = h, s.end = d, s.closestPointToPoint(a, !0, l).distanceTo(a) <= r))
447
447
  return !0;
448
448
  const A = n.getPlane(t);
449
449
  if (Math.abs(A.distanceToPoint(a)) <= r) {
@@ -467,10 +467,10 @@ class Ft extends ue {
467
467
  update() {
468
468
  const e = this.a, t = this.b, s = this.c, i = this.points, o = this.satAxes, n = this.satBounds, r = o[0], a = n[0];
469
469
  this.getNormal(r), a.setFromPoints(r, i);
470
- const c = o[1], E = n[1];
471
- c.subVectors(e, t), E.setFromPoints(c, i);
472
- const d = o[2], h = n[2];
473
- d.subVectors(t, s), h.setFromPoints(d, i);
470
+ const c = o[1], h = n[1];
471
+ c.subVectors(e, t), h.setFromPoints(c, i);
472
+ const d = o[2], E = n[2];
473
+ d.subVectors(t, s), E.setFromPoints(d, i);
474
474
  const u = o[3], p = n[3];
475
475
  u.subVectors(s, e), p.setFromPoints(u, i), this.sphere.setFromPoints(this.points), this.plane.setFromNormalAndCoplanarPoint(r, e), this.needsUpdate = !1;
476
476
  }
@@ -479,28 +479,28 @@ Ft.prototype.closestPointToSegment = function() {
479
479
  const l = new M(), e = new M(), t = new Pt();
480
480
  return function(i, o = null, n = null) {
481
481
  const { start: r, end: a } = i, c = this.points;
482
- let E, d = 1 / 0;
483
- for (let h = 0; h < 3; h++) {
484
- const u = (h + 1) % 3;
485
- t.start.copy(c[h]), t.end.copy(c[u]), Oi(t, i, l, e), E = l.distanceToSquared(e), E < d && (d = E, o && o.copy(l), n && n.copy(e));
482
+ let h, d = 1 / 0;
483
+ for (let E = 0; E < 3; E++) {
484
+ const u = (E + 1) % 3;
485
+ t.start.copy(c[E]), t.end.copy(c[u]), Oi(t, i, l, e), h = l.distanceToSquared(e), h < d && (d = h, o && o.copy(l), n && n.copy(e));
486
486
  }
487
- return this.closestPointToPoint(r, l), E = r.distanceToSquared(l), E < d && (d = E, o && o.copy(l), n && n.copy(r)), this.closestPointToPoint(a, l), E = a.distanceToSquared(l), E < d && (d = E, o && o.copy(l), n && n.copy(a)), Math.sqrt(d);
487
+ return this.closestPointToPoint(r, l), h = r.distanceToSquared(l), h < d && (d = h, o && o.copy(l), n && n.copy(r)), this.closestPointToPoint(a, l), h = a.distanceToSquared(l), h < d && (d = h, o && o.copy(l), n && n.copy(a)), Math.sqrt(d);
488
488
  };
489
489
  }();
490
490
  Ft.prototype.intersectsTriangle = function() {
491
- const l = new Ft(), e = new Array(3), t = new Array(3), s = new wt(), i = new wt(), o = new M(), n = new M(), r = new M(), a = new M(), c = new M(), E = new Pt(), d = new Pt(), h = new Pt(), u = new M();
491
+ const l = new Ft(), e = new Array(3), t = new Array(3), s = new wt(), i = new wt(), o = new M(), n = new M(), r = new M(), a = new M(), c = new M(), h = new Pt(), d = new Pt(), E = new Pt(), u = new M();
492
492
  function p(A, m, C) {
493
493
  const R = A.points;
494
494
  let F = 0, f = -1;
495
495
  for (let T = 0; T < 3; T++) {
496
- const { start: O, end: _ } = E;
497
- O.copy(R[T]), _.copy(R[(T + 1) % 3]), E.delta(n);
496
+ const { start: O, end: _ } = h;
497
+ O.copy(R[T]), _.copy(R[(T + 1) % 3]), h.delta(n);
498
498
  const S = zs(m.distanceToPoint(O));
499
499
  if (zs(m.normal.dot(n)) && S) {
500
- C.copy(E), F = 2;
500
+ C.copy(h), F = 2;
501
501
  break;
502
502
  }
503
- const N = m.intersectLine(E, u);
503
+ const N = m.intersectLine(h, u);
504
504
  if (!N && S && u.copy(O), (N || S) && !zs(u.distanceTo(_))) {
505
505
  if (F <= 1)
506
506
  (F === 1 ? C.start : C.end).copy(u), S && (f = F);
@@ -547,17 +547,17 @@ Ft.prototype.intersectsTriangle = function() {
547
547
  return C && (C.start.copy(d.end), C.end.copy(d.end)), !0;
548
548
  if (T !== 2)
549
549
  return !1;
550
- const O = p(m, F, h);
551
- if (O === 1 && this.containsPoint(h.end))
552
- return C && (C.start.copy(h.end), C.end.copy(h.end)), !0;
550
+ const O = p(m, F, E);
551
+ if (O === 1 && this.containsPoint(E.end))
552
+ return C && (C.start.copy(E.end), C.end.copy(E.end)), !0;
553
553
  if (O !== 2)
554
554
  return !1;
555
- if (d.delta(r), h.delta(a), r.dot(a) < 0) {
556
- let U = h.start;
557
- h.start = h.end, h.end = U;
555
+ if (d.delta(r), E.delta(a), r.dot(a) < 0) {
556
+ let U = E.start;
557
+ E.start = E.end, E.end = U;
558
558
  }
559
- const _ = d.start.dot(r), S = d.end.dot(r), N = h.start.dot(r), P = h.end.dot(r), w = S < N, y = _ < P;
560
- return _ !== P && N !== S && w === y ? !1 : (C && (c.subVectors(d.start, h.start), c.dot(r) > 0 ? C.start.copy(d.start) : C.start.copy(h.start), c.subVectors(d.end, h.end), c.dot(r) < 0 ? C.end.copy(d.end) : C.end.copy(h.end)), !0);
559
+ const _ = d.start.dot(r), S = d.end.dot(r), N = E.start.dot(r), P = E.end.dot(r), w = S < N, y = _ < P;
560
+ return _ !== P && N !== S && w === y ? !1 : (C && (c.subVectors(d.start, E.start), c.dot(r) > 0 ? C.start.copy(d.start) : C.start.copy(E.start), c.subVectors(d.end, E.end), c.dot(r) < 0 ? C.end.copy(d.end) : C.end.copy(E.end)), !0);
561
561
  }
562
562
  };
563
563
  }();
@@ -573,25 +573,25 @@ Ft.prototype.distanceToTriangle = function() {
573
573
  const c = r || a ? s : null;
574
574
  if (this.intersectsTriangle(n, c))
575
575
  return (r || a) && (r && c.getCenter(r), a && c.getCenter(a)), 0;
576
- let E = 1 / 0;
576
+ let h = 1 / 0;
577
577
  for (let d = 0; d < 3; d++) {
578
- let h;
578
+ let E;
579
579
  const u = t[d], p = n[u];
580
- this.closestPointToPoint(p, l), h = p.distanceToSquared(l), h < E && (E = h, r && r.copy(l), a && a.copy(p));
580
+ this.closestPointToPoint(p, l), E = p.distanceToSquared(l), E < h && (h = E, r && r.copy(l), a && a.copy(p));
581
581
  const A = this[u];
582
- n.closestPointToPoint(A, l), h = A.distanceToSquared(l), h < E && (E = h, r && r.copy(A), a && a.copy(l));
582
+ n.closestPointToPoint(A, l), E = A.distanceToSquared(l), E < h && (h = E, r && r.copy(A), a && a.copy(l));
583
583
  }
584
584
  for (let d = 0; d < 3; d++) {
585
- const h = t[d], u = t[(d + 1) % 3];
586
- s.set(this[h], this[u]);
585
+ const E = t[d], u = t[(d + 1) % 3];
586
+ s.set(this[E], this[u]);
587
587
  for (let p = 0; p < 3; p++) {
588
588
  const A = t[p], m = t[(p + 1) % 3];
589
589
  i.set(n[A], n[m]), Oi(s, i, l, e);
590
590
  const C = l.distanceToSquared(e);
591
- C < E && (E = C, r && r.copy(l), a && a.copy(e));
591
+ C < h && (h = C, r && r.copy(l), a && a.copy(e));
592
592
  }
593
593
  }
594
- return Math.sqrt(E);
594
+ return Math.sqrt(h);
595
595
  };
596
596
  }();
597
597
  class at {
@@ -609,15 +609,15 @@ at.prototype.update = /* @__PURE__ */ function() {
609
609
  return function() {
610
610
  const e = this.matrix, t = this.min, s = this.max, i = this.points;
611
611
  for (let c = 0; c <= 1; c++)
612
- for (let E = 0; E <= 1; E++)
612
+ for (let h = 0; h <= 1; h++)
613
613
  for (let d = 0; d <= 1; d++) {
614
- const h = 1 * c | 2 * E | 4 * d, u = i[h];
615
- u.x = c ? s.x : t.x, u.y = E ? s.y : t.y, u.z = d ? s.z : t.z, u.applyMatrix4(e);
614
+ const E = 1 * c | 2 * h | 4 * d, u = i[E];
615
+ u.x = c ? s.x : t.x, u.y = h ? s.y : t.y, u.z = d ? s.z : t.z, u.applyMatrix4(e);
616
616
  }
617
617
  const o = this.satBounds, n = this.satAxes, r = i[0];
618
618
  for (let c = 0; c < 3; c++) {
619
- const E = n[c], d = o[c], h = 1 << c, u = i[h];
620
- E.subVectors(r, u), d.setFromPoints(E, i);
619
+ const h = n[c], d = o[c], E = 1 << c, u = i[E];
620
+ h.subVectors(r, u), d.setFromPoints(h, i);
621
621
  }
622
622
  const a = this.alignedSatBounds;
623
623
  a[0].setFromPointsField(i, "x"), a[1].setFromPointsField(i, "y"), a[2].setFromPointsField(i, "z"), this.invMatrix.copy(this.matrix).invert(), this.needsUpdate = !1;
@@ -631,8 +631,8 @@ at.prototype.intersectsBox = function() {
631
631
  if (l.min = s.x, l.max = i.x, r[0].isSeparated(l) || (l.min = s.y, l.max = i.y, r[1].isSeparated(l)) || (l.min = s.z, l.max = i.z, r[2].isSeparated(l)))
632
632
  return !1;
633
633
  for (let a = 0; a < 3; a++) {
634
- const c = n[a], E = o[a];
635
- if (l.setFromBox(c, t), E.isSeparated(l))
634
+ const c = n[a], h = o[a];
635
+ if (l.setFromBox(c, t), h.isSeparated(l))
636
636
  return !1;
637
637
  }
638
638
  return !0;
@@ -644,21 +644,21 @@ at.prototype.intersectsTriangle = function() {
644
644
  this.needsUpdate && this.update(), n.isExtendedTriangle ? n.needsUpdate && n.update() : (l.copy(n), l.update(), n = l);
645
645
  const r = this.satBounds, a = this.satAxes;
646
646
  e[0] = n.a, e[1] = n.b, e[2] = n.c;
647
- for (let h = 0; h < 3; h++) {
648
- const u = r[h], p = a[h];
647
+ for (let E = 0; E < 3; E++) {
648
+ const u = r[E], p = a[E];
649
649
  if (t.setFromPoints(p, e), u.isSeparated(t))
650
650
  return !1;
651
651
  }
652
- const c = n.satBounds, E = n.satAxes, d = this.points;
653
- for (let h = 0; h < 3; h++) {
654
- const u = c[h], p = E[h];
652
+ const c = n.satBounds, h = n.satAxes, d = this.points;
653
+ for (let E = 0; E < 3; E++) {
654
+ const u = c[E], p = h[E];
655
655
  if (t.setFromPoints(p, d), u.isSeparated(t))
656
656
  return !1;
657
657
  }
658
- for (let h = 0; h < 3; h++) {
659
- const u = a[h];
658
+ for (let E = 0; E < 3; E++) {
659
+ const u = a[E];
660
660
  for (let p = 0; p < 4; p++) {
661
- const A = E[p];
661
+ const A = h[p];
662
662
  if (i.crossVectors(u, A), t.setFromPoints(i, e), s.setFromPoints(i, d), t.isSeparated(s))
663
663
  return !1;
664
664
  }
@@ -682,13 +682,13 @@ at.prototype.distanceToBox = function() {
682
682
  return function(n, r = 0, a = null, c = null) {
683
683
  if (this.needsUpdate && this.update(), this.intersectsBox(n))
684
684
  return (a || c) && (n.getCenter(i), this.closestPointToPoint(i, s), n.closestPointToPoint(s, i), a && a.copy(s), c && c.copy(i)), 0;
685
- const E = r * r, d = n.min, h = n.max, u = this.points;
685
+ const h = r * r, d = n.min, E = n.max, u = this.points;
686
686
  let p = 1 / 0;
687
687
  for (let m = 0; m < 8; m++) {
688
688
  const C = u[m];
689
- i.copy(C).clamp(d, h);
689
+ i.copy(C).clamp(d, E);
690
690
  const R = C.distanceToSquared(i);
691
- if (R < p && (p = R, a && a.copy(C), c && c.copy(i), R < E))
691
+ if (R < p && (p = R, a && a.copy(C), c && c.copy(i), R < h))
692
692
  return Math.sqrt(R);
693
693
  }
694
694
  let A = 0;
@@ -698,14 +698,14 @@ at.prototype.distanceToBox = function() {
698
698
  const F = (m + 1) % 3, f = (m + 2) % 3, T = C << F | R << f, O = 1 << m | C << F | R << f, _ = u[T], S = u[O];
699
699
  e[A].set(_, S);
700
700
  const P = l[m], w = l[F], y = l[f], U = t[A], x = U.start, B = U.end;
701
- x[P] = d[P], x[w] = C ? d[w] : h[w], x[y] = R ? d[y] : h[w], B[P] = h[P], B[w] = C ? d[w] : h[w], B[y] = R ? d[y] : h[w], A++;
701
+ x[P] = d[P], x[w] = C ? d[w] : E[w], x[y] = R ? d[y] : E[w], B[P] = E[P], B[w] = C ? d[w] : E[w], B[y] = R ? d[y] : E[w], A++;
702
702
  }
703
703
  for (let m = 0; m <= 1; m++)
704
704
  for (let C = 0; C <= 1; C++)
705
705
  for (let R = 0; R <= 1; R++) {
706
- i.x = m ? h.x : d.x, i.y = C ? h.y : d.y, i.z = R ? h.z : d.z, this.closestPointToPoint(i, s);
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, s);
707
707
  const F = i.distanceToSquared(s);
708
- if (F < p && (p = F, a && a.copy(s), c && c.copy(i), F < E))
708
+ if (F < p && (p = F, a && a.copy(s), c && c.copy(i), F < h))
709
709
  return Math.sqrt(F);
710
710
  }
711
711
  for (let m = 0; m < 12; m++) {
@@ -714,7 +714,7 @@ at.prototype.distanceToBox = function() {
714
714
  const F = t[R];
715
715
  Oi(C, F, s, i);
716
716
  const f = s.distanceToSquared(i);
717
- if (f < p && (p = f, a && a.copy(s), c && c.copy(i), f < E))
717
+ if (f < p && (p = f, a && a.copy(s), c && c.copy(i), f < h))
718
718
  return Math.sqrt(f);
719
719
  }
720
720
  }
@@ -781,10 +781,10 @@ function _o(l, e, t, s, i, o) {
781
781
  }
782
782
  function ai(l, e, t, s, i = null, o = 0, n = 0) {
783
783
  const { float32Array: r, uint16Array: a, uint32Array: c } = Z;
784
- let E = l * 2;
785
- if (ht(E, a)) {
786
- const h = Et(l, c), u = ft(E, a);
787
- return K(l, r, Yt), s(h, u, !1, n, o + l, Yt);
784
+ let h = l * 2;
785
+ if (ht(h, a)) {
786
+ const E = Et(l, c), u = ft(h, a);
787
+ return K(l, r, Yt), s(E, u, !1, n, o + l, Yt);
788
788
  } else {
789
789
  let P = function(y) {
790
790
  const { uint16Array: U, uint32Array: x } = Z;
@@ -799,10 +799,10 @@ function ai(l, e, t, s, i = null, o = 0, n = 0) {
799
799
  y = Ct(y, x), B = y * 2;
800
800
  return Et(y, x) + ft(B, U);
801
801
  };
802
- const h = pt(l), u = Ct(l, c);
803
- let p = h, A = u, m, C, R, F;
802
+ const E = pt(l), u = Ct(l, c);
803
+ let p = E, A = u, m, C, R, F;
804
804
  if (i && (R = Yt, F = Ie, K(p, r, R), K(A, r, F), m = i(R), C = i(F), C < m)) {
805
- p = u, A = h;
805
+ p = u, A = E;
806
806
  const y = m;
807
807
  m = C, C = y, R = F;
808
808
  }
@@ -849,12 +849,12 @@ function So(l, e, t = {}, s = 0, i = 1 / 0) {
849
849
  let r = 1 / 0, a = null;
850
850
  if (l.shapecast(
851
851
  {
852
- boundsTraverseOrder: (E) => (Ae.copy(e).clamp(E.min, E.max), Ae.distanceToSquared(e)),
853
- intersectsBounds: (E, d, h) => h < r && h < n,
854
- intersectsTriangle: (E, d) => {
855
- E.closestPointToPoint(e, Ae);
856
- const h = e.distanceToSquared(Ae);
857
- return h < r && (Hs.copy(Ae), r = h, a = d), h < o;
852
+ boundsTraverseOrder: (h) => (Ae.copy(e).clamp(h.min, h.max), Ae.distanceToSquared(e)),
853
+ intersectsBounds: (h, d, E) => E < r && E < n,
854
+ intersectsTriangle: (h, d) => {
855
+ h.closestPointToPoint(e, Ae);
856
+ const E = e.distanceToSquared(Ae);
857
+ return E < r && (Hs.copy(Ae), r = E, a = d), E < o;
858
858
  }
859
859
  }
860
860
  ), r === 1 / 0)
@@ -875,14 +875,14 @@ function Lo(l, e, t, s, i, o, n, r, a) {
875
875
  const c = No(l, te, ee, se, es, a);
876
876
  if (c) {
877
877
  s && ($e.fromBufferAttribute(s, o), Je.fromBufferAttribute(s, n), ts.fromBufferAttribute(s, r), c.uv = ue.getInterpolation(es, te, ee, se, $e, Je, ts, new fe())), i && ($e.fromBufferAttribute(i, o), Je.fromBufferAttribute(i, n), ts.fromBufferAttribute(i, r), c.uv1 = ue.getInterpolation(es, te, ee, se, $e, Je, ts, new fe())), t && (Vi.fromBufferAttribute(t, o), Gi.fromBufferAttribute(t, n), zi.fromBufferAttribute(t, r), c.normal = ue.getInterpolation(es, te, ee, se, Vi, Gi, zi, new M()), c.normal.dot(l.direction) > 0 && c.normal.multiplyScalar(-1));
878
- const E = {
878
+ const h = {
879
879
  a: o,
880
880
  b: n,
881
881
  c: r,
882
882
  normal: new M(),
883
883
  materialIndex: 0
884
884
  };
885
- ue.getNormal(te, ee, se, E.normal), c.face = E, c.faceIndex = o;
885
+ ue.getNormal(te, ee, se, h.normal), c.face = h, c.faceIndex = o;
886
886
  }
887
887
  return c;
888
888
  }
@@ -891,7 +891,7 @@ function xs(l, e, t, s, i) {
891
891
  let n = o + 0, r = o + 1, a = o + 2;
892
892
  const c = l.index;
893
893
  l.index && (n = c.getX(n), r = c.getX(r), a = c.getX(a));
894
- const { position: E, normal: d, uv: h, uv1: u } = l.attributes, p = Lo(t, E, d, h, u, n, r, a, e);
894
+ const { position: h, normal: d, uv: E, uv1: u } = l.attributes, p = Lo(t, h, d, E, u, n, r, a, e);
895
895
  return p ? (p.faceIndex = s, i && i.push(p), p) : null;
896
896
  }
897
897
  function tt(l, e, t, s) {
@@ -907,7 +907,7 @@ function Po(l, e, t, s, i, o) {
907
907
  function yo(l, e, t, s, i) {
908
908
  const { geometry: o, _indirectBuffer: n } = l;
909
909
  let r = 1 / 0, a = null;
910
- for (let c = s, E = s + i; c < E; c++) {
910
+ for (let c = s, h = s + i; c < h; c++) {
911
911
  let d;
912
912
  d = xs(o, e, t, c), d && d.distance < r && (a = d, r = d.distance);
913
913
  }
@@ -915,9 +915,9 @@ function yo(l, e, t, s, i) {
915
915
  }
916
916
  function Mo(l, e, t, s, i, o, n) {
917
917
  const { geometry: r } = t, { index: a } = r, c = r.attributes.position;
918
- for (let E = l, d = e + l; E < d; E++) {
919
- let h;
920
- if (h = E, tt(n, h * 3, a, c), n.needsUpdate = !0, s(n, h, i, o))
918
+ for (let h = l, d = e + l; h < d; h++) {
919
+ let E;
920
+ if (E = h, tt(n, E * 3, a, c), n.needsUpdate = !0, s(n, E, i, o))
921
921
  return !0;
922
922
  }
923
923
  return !1;
@@ -926,22 +926,22 @@ function wo(l, e = null) {
926
926
  e && Array.isArray(e) && (e = new Set(e));
927
927
  const t = l.geometry, s = t.index ? t.index.array : null, i = t.attributes.position;
928
928
  let o, n, r, a, c = 0;
929
- const E = l._roots;
930
- for (let h = 0, u = E.length; h < u; h++)
931
- o = E[h], n = new Uint32Array(o), r = new Uint16Array(o), a = new Float32Array(o), d(0, c), c += o.byteLength;
932
- function d(h, u, p = !1) {
933
- const A = h * 2;
929
+ const h = l._roots;
930
+ for (let E = 0, u = h.length; E < u; E++)
931
+ o = h[E], n = new Uint32Array(o), r = new Uint16Array(o), a = new Float32Array(o), d(0, c), c += o.byteLength;
932
+ function d(E, u, p = !1) {
933
+ const A = E * 2;
934
934
  if (r[A + 15] === Us) {
935
- const C = n[h + 6], R = r[A + 14];
935
+ const C = n[E + 6], R = r[A + 14];
936
936
  let F = 1 / 0, f = 1 / 0, T = 1 / 0, O = -1 / 0, _ = -1 / 0, S = -1 / 0;
937
937
  for (let N = 3 * C, P = 3 * (C + R); N < P; N++) {
938
938
  let w = s[N];
939
939
  const y = i.getX(w), U = i.getY(w), x = i.getZ(w);
940
940
  y < F && (F = y), y > O && (O = y), U < f && (f = U), U > _ && (_ = U), x < T && (T = x), x > S && (S = x);
941
941
  }
942
- return a[h + 0] !== F || a[h + 1] !== f || a[h + 2] !== T || a[h + 3] !== O || a[h + 4] !== _ || a[h + 5] !== S ? (a[h + 0] = F, a[h + 1] = f, a[h + 2] = T, a[h + 3] = O, a[h + 4] = _, a[h + 5] = S, !0) : !1;
942
+ return a[E + 0] !== F || a[E + 1] !== f || a[E + 2] !== T || a[E + 3] !== O || a[E + 4] !== _ || a[E + 5] !== S ? (a[E + 0] = F, a[E + 1] = f, a[E + 2] = T, a[E + 3] = O, a[E + 4] = _, a[E + 5] = S, !0) : !1;
943
943
  } else {
944
- const C = h + 8, R = n[h + 6], F = C + u, f = R + u;
944
+ const C = E + 8, R = n[E + 6], F = C + u, f = R + u;
945
945
  let T = p, O = !1, _ = !1;
946
946
  e ? T || (O = e.has(F), _ = e.has(f), T = !O && !_) : (O = !0, _ = !0);
947
947
  const S = T || O, N = T || _;
@@ -953,7 +953,7 @@ function wo(l, e = null) {
953
953
  if (y)
954
954
  for (let U = 0; U < 3; U++) {
955
955
  const x = C + U, B = R + U, H = a[x], q = a[x + 3], st = a[B], Q = a[B + 3];
956
- a[h + U] = H < st ? H : st, a[h + U + 3] = q > Q ? q : Q;
956
+ a[E + U] = H < st ? H : st, a[E + U + 3] = q > Q ? q : Q;
957
957
  }
958
958
  return y;
959
959
  }
@@ -966,14 +966,14 @@ function Gt(l, e, t, s) {
966
966
  function Do(l, e, t, s, i, o) {
967
967
  const { geometry: n, _indirectBuffer: r } = l;
968
968
  for (let a = s, c = s + i; a < c; a++) {
969
- let E = r ? r[a] : a;
970
- xs(n, e, t, E, o);
969
+ let h = r ? r[a] : a;
970
+ xs(n, e, t, h, o);
971
971
  }
972
972
  }
973
973
  function Uo(l, e, t, s, i) {
974
974
  const { geometry: o, _indirectBuffer: n } = l;
975
975
  let r = 1 / 0, a = null;
976
- for (let c = s, E = s + i; c < E; c++) {
976
+ for (let c = s, h = s + i; c < h; c++) {
977
977
  let d;
978
978
  d = xs(o, e, t, n ? n[c] : c), d && d.distance < r && (a = d, r = d.distance);
979
979
  }
@@ -981,9 +981,9 @@ function Uo(l, e, t, s, i) {
981
981
  }
982
982
  function xo(l, e, t, s, i, o, n) {
983
983
  const { geometry: r } = t, { index: a } = r, c = r.attributes.position;
984
- for (let E = l, d = e + l; E < d; E++) {
985
- let h;
986
- if (h = t.resolveTriangleIndex(E), tt(n, h * 3, a, c), n.needsUpdate = !0, s(n, h, i, o))
984
+ for (let h = l, d = e + l; h < d; h++) {
985
+ let E;
986
+ if (E = t.resolveTriangleIndex(h), tt(n, E * 3, a, c), n.needsUpdate = !0, s(n, E, i, o))
987
987
  return !0;
988
988
  }
989
989
  return !1;
@@ -995,11 +995,11 @@ function bo(l, e, t, s, i) {
995
995
  function ci(l, e, t, s, i) {
996
996
  const { float32Array: o, uint16Array: n, uint32Array: r } = Z, a = l * 2;
997
997
  if (ht(a, n)) {
998
- const E = Et(l, r), d = ft(a, n);
999
- Po(e, t, s, E, d, i);
998
+ const h = Et(l, r), d = ft(a, n);
999
+ Po(e, t, s, h, d, i);
1000
1000
  } else {
1001
- const E = pt(l);
1002
- Gt(E, o, s, ki) && ci(E, e, t, s, i);
1001
+ const h = pt(l);
1002
+ Gt(h, o, s, ki) && ci(h, e, t, s, i);
1003
1003
  const d = Ct(l, r);
1004
1004
  Gt(d, o, s, ki) && ci(d, e, t, s, i);
1005
1005
  }
@@ -1014,16 +1014,16 @@ function li(l, e, t, s) {
1014
1014
  const { float32Array: i, uint16Array: o, uint32Array: n } = Z;
1015
1015
  let r = l * 2;
1016
1016
  if (ht(r, o)) {
1017
- const c = Et(l, n), E = ft(r, o);
1018
- return yo(e, t, s, c, E);
1017
+ const c = Et(l, n), h = ft(r, o);
1018
+ return yo(e, t, s, c, h);
1019
1019
  } else {
1020
- const c = Un(l, n), E = vo[c], h = s.direction[E] >= 0;
1020
+ const c = Un(l, n), h = vo[c], E = s.direction[h] >= 0;
1021
1021
  let u, p;
1022
- h ? (u = pt(l), p = Ct(l, n)) : (u = Ct(l, n), p = pt(l));
1022
+ E ? (u = pt(l), p = Ct(l, n)) : (u = Ct(l, n), p = pt(l));
1023
1023
  const m = Gt(u, i, s, Wi) ? li(u, e, t, s) : null;
1024
1024
  if (m) {
1025
- const F = m.point[E];
1026
- if (h ? F <= i[p + c] : (
1025
+ const F = m.point[h];
1026
+ if (E ? F <= i[p + c] : (
1027
1027
  // min bounding data
1028
1028
  F >= i[p + c + 3]
1029
1029
  ))
@@ -1043,33 +1043,33 @@ function hi(l, e, t, s, i = null) {
1043
1043
  const { float32Array: o, uint16Array: n, uint32Array: r } = Z;
1044
1044
  let a = l * 2;
1045
1045
  if (i === null && (t.boundingBox || t.computeBoundingBox(), Xi.set(t.boundingBox.min, t.boundingBox.max, s), i = Xi), ht(a, n)) {
1046
- const E = e.geometry, d = E.index, h = E.attributes.position, u = t.index, p = t.attributes.position, A = Et(l, r), m = ft(a, n);
1046
+ const h = e.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 (Fe.copy(s).invert(), t.boundsTree)
1048
1048
  return K(l, o, is), is.matrix.copy(Fe), is.needsUpdate = !0, t.boundsTree.shapecast({
1049
1049
  intersectsBounds: (R) => is.intersectsBox(R),
1050
1050
  intersectsTriangle: (R) => {
1051
1051
  R.a.applyMatrix4(s), R.b.applyMatrix4(s), R.c.applyMatrix4(s), R.needsUpdate = !0;
1052
1052
  for (let F = A * 3, f = (m + A) * 3; F < f; F += 3)
1053
- if (tt(ne, F, d, h), ne.needsUpdate = !0, R.intersectsTriangle(ne))
1053
+ if (tt(ne, F, d, E), ne.needsUpdate = !0, R.intersectsTriangle(ne))
1054
1054
  return !0;
1055
1055
  return !1;
1056
1056
  }
1057
1057
  });
1058
1058
  for (let C = A * 3, R = (m + A) * 3; C < R; C += 3) {
1059
- tt(ie, C, d, h), ie.a.applyMatrix4(Fe), ie.b.applyMatrix4(Fe), ie.c.applyMatrix4(Fe), ie.needsUpdate = !0;
1059
+ tt(ie, C, d, E), ie.a.applyMatrix4(Fe), ie.b.applyMatrix4(Fe), ie.c.applyMatrix4(Fe), ie.needsUpdate = !0;
1060
1060
  for (let F = 0, f = u.count; F < f; F += 3)
1061
1061
  if (tt(ne, F, u, p), ne.needsUpdate = !0, ie.intersectsTriangle(ne))
1062
1062
  return !0;
1063
1063
  }
1064
1064
  } else {
1065
- const E = l + 8, d = r[l + 6];
1066
- return K(E, o, ss), !!(i.intersectsBox(ss) && hi(E, e, t, s, i) || (K(d, o, ss), i.intersectsBox(ss) && hi(d, e, t, s, i)));
1065
+ const h = l + 8, d = r[l + 6];
1066
+ return K(h, o, ss), !!(i.intersectsBox(ss) && hi(h, e, t, s, i) || (K(d, o, ss), i.intersectsBox(ss) && hi(d, e, t, s, i)));
1067
1067
  }
1068
1068
  }
1069
1069
  const ns = /* @__PURE__ */ new yt(), ks = /* @__PURE__ */ new at(), Oe = /* @__PURE__ */ new at(), Vo = /* @__PURE__ */ new M(), Go = /* @__PURE__ */ new M(), zo = /* @__PURE__ */ new M(), Ho = /* @__PURE__ */ new M();
1070
1070
  function ko(l, e, t, s = {}, i = {}, o = 0, n = 1 / 0) {
1071
1071
  e.boundingBox || e.computeBoundingBox(), ks.set(e.boundingBox.min, e.boundingBox.max, t), ks.needsUpdate = !0;
1072
- const r = l.geometry, a = r.attributes.position, c = r.index, E = e.attributes.position, d = e.index, h = It.getPrimitive(), u = It.getPrimitive();
1072
+ const r = l.geometry, a = r.attributes.position, c = r.index, h = e.attributes.position, d = e.index, E = It.getPrimitive(), u = It.getPrimitive();
1073
1073
  let p = Vo, A = Go, m = null, C = null;
1074
1074
  i && (m = zo, C = Ho);
1075
1075
  let R = 1 / 0, F = null, f = null;
@@ -1084,10 +1084,10 @@ function ko(l, e, t, s = {}, i = {}, o = 0, n = 1 / 0) {
1084
1084
  intersectsBounds: (S, N, P) => P < R && P < n,
1085
1085
  intersectsRange: (S, N) => {
1086
1086
  for (let P = S, w = S + N; P < w; P++) {
1087
- tt(u, 3 * P, d, E), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
1087
+ tt(u, 3 * P, d, h), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
1088
1088
  for (let y = T, U = T + O; y < U; y++) {
1089
- tt(h, 3 * y, c, a), h.needsUpdate = !0;
1090
- const x = h.distanceToTriangle(u, p, m);
1089
+ tt(E, 3 * y, c, a), E.needsUpdate = !0;
1090
+ const x = E.distanceToTriangle(u, p, m);
1091
1091
  if (x < R && (A.copy(p), C && C.copy(m), R = x, F = y, f = P), x < o)
1092
1092
  return !0;
1093
1093
  }
@@ -1097,10 +1097,10 @@ function ko(l, e, t, s = {}, i = {}, o = 0, n = 1 / 0) {
1097
1097
  {
1098
1098
  const _ = pe(e);
1099
1099
  for (let S = 0, N = _; S < N; S++) {
1100
- tt(u, 3 * S, d, E), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
1100
+ tt(u, 3 * S, d, h), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
1101
1101
  for (let P = T, w = T + O; P < w; P++) {
1102
- tt(h, 3 * P, c, a), h.needsUpdate = !0;
1103
- const y = h.distanceToTriangle(u, p, m);
1102
+ tt(E, 3 * P, c, a), E.needsUpdate = !0;
1103
+ const y = E.distanceToTriangle(u, p, m);
1104
1104
  if (y < R && (A.copy(p), C && C.copy(m), R = y, F = P, f = S), y < o)
1105
1105
  return !0;
1106
1106
  }
@@ -1108,19 +1108,19 @@ function ko(l, e, t, s = {}, i = {}, o = 0, n = 1 / 0) {
1108
1108
  }
1109
1109
  }
1110
1110
  }
1111
- ), It.releasePrimitive(h), It.releasePrimitive(u), R === 1 / 0 ? null : (s.point ? s.point.copy(A) : s.point = A.clone(), s.distance = R, s.faceIndex = F, i && (i.point ? i.point.copy(C) : i.point = C.clone(), i.point.applyMatrix4(ns), A.applyMatrix4(ns), i.distance = A.sub(i.point).length(), i.faceIndex = f), s);
1111
+ ), It.releasePrimitive(E), It.releasePrimitive(u), R === 1 / 0 ? null : (s.point ? s.point.copy(A) : s.point = A.clone(), s.distance = R, s.faceIndex = F, i && (i.point ? i.point.copy(C) : i.point = C.clone(), i.point.applyMatrix4(ns), A.applyMatrix4(ns), i.distance = A.sub(i.point).length(), i.faceIndex = f), s);
1112
1112
  }
1113
1113
  function Wo(l, e = null) {
1114
1114
  e && Array.isArray(e) && (e = new Set(e));
1115
1115
  const t = l.geometry, s = t.index ? t.index.array : null, i = t.attributes.position;
1116
1116
  let o, n, r, a, c = 0;
1117
- const E = l._roots;
1118
- for (let h = 0, u = E.length; h < u; h++)
1119
- o = E[h], n = new Uint32Array(o), r = new Uint16Array(o), a = new Float32Array(o), d(0, c), c += o.byteLength;
1120
- function d(h, u, p = !1) {
1121
- const A = h * 2;
1117
+ const h = l._roots;
1118
+ for (let E = 0, u = h.length; E < u; E++)
1119
+ o = h[E], n = new Uint32Array(o), r = new Uint16Array(o), a = new Float32Array(o), d(0, c), c += o.byteLength;
1120
+ function d(E, u, p = !1) {
1121
+ const A = E * 2;
1122
1122
  if (r[A + 15] === Us) {
1123
- const C = n[h + 6], R = r[A + 14];
1123
+ const C = n[E + 6], R = r[A + 14];
1124
1124
  let F = 1 / 0, f = 1 / 0, T = 1 / 0, O = -1 / 0, _ = -1 / 0, S = -1 / 0;
1125
1125
  for (let N = C, P = C + R; N < P; N++) {
1126
1126
  const w = 3 * l.resolveTriangleIndex(N);
@@ -1131,9 +1131,9 @@ function Wo(l, e = null) {
1131
1131
  x < F && (F = x), x > O && (O = x), B < f && (f = B), B > _ && (_ = B), H < T && (T = H), H > S && (S = H);
1132
1132
  }
1133
1133
  }
1134
- return a[h + 0] !== F || a[h + 1] !== f || a[h + 2] !== T || a[h + 3] !== O || a[h + 4] !== _ || a[h + 5] !== S ? (a[h + 0] = F, a[h + 1] = f, a[h + 2] = T, a[h + 3] = O, a[h + 4] = _, a[h + 5] = S, !0) : !1;
1134
+ return a[E + 0] !== F || a[E + 1] !== f || a[E + 2] !== T || a[E + 3] !== O || a[E + 4] !== _ || a[E + 5] !== S ? (a[E + 0] = F, a[E + 1] = f, a[E + 2] = T, a[E + 3] = O, a[E + 4] = _, a[E + 5] = S, !0) : !1;
1135
1135
  } else {
1136
- const C = h + 8, R = n[h + 6], F = C + u, f = R + u;
1136
+ const C = E + 8, R = n[E + 6], F = C + u, f = R + u;
1137
1137
  let T = p, O = !1, _ = !1;
1138
1138
  e ? T || (O = e.has(F), _ = e.has(f), T = !O && !_) : (O = !0, _ = !0);
1139
1139
  const S = T || O, N = T || _;
@@ -1145,7 +1145,7 @@ function Wo(l, e = null) {
1145
1145
  if (y)
1146
1146
  for (let U = 0; U < 3; U++) {
1147
1147
  const x = C + U, B = R + U, H = a[x], q = a[x + 3], st = a[B], Q = a[B + 3];
1148
- a[h + U] = H < st ? H : st, a[h + U + 3] = q > Q ? q : Q;
1148
+ a[E + U] = H < st ? H : st, a[E + U + 3] = q > Q ? q : Q;
1149
1149
  }
1150
1150
  return y;
1151
1151
  }
@@ -1158,11 +1158,11 @@ function Xo(l, e, t, s, i) {
1158
1158
  function Ei(l, e, t, s, i) {
1159
1159
  const { float32Array: o, uint16Array: n, uint32Array: r } = Z, a = l * 2;
1160
1160
  if (ht(a, n)) {
1161
- const E = Et(l, r), d = ft(a, n);
1162
- Do(e, t, s, E, d, i);
1161
+ const h = Et(l, r), d = ft(a, n);
1162
+ Do(e, t, s, h, d, i);
1163
1163
  } else {
1164
- const E = pt(l);
1165
- Gt(E, o, s, Zi) && Ei(E, e, t, s, i);
1164
+ const h = pt(l);
1165
+ Gt(h, o, s, Zi) && Ei(h, e, t, s, i);
1166
1166
  const d = Ct(l, r);
1167
1167
  Gt(d, o, s, Zi) && Ei(d, e, t, s, i);
1168
1168
  }
@@ -1177,16 +1177,16 @@ function di(l, e, t, s) {
1177
1177
  const { float32Array: i, uint16Array: o, uint32Array: n } = Z;
1178
1178
  let r = l * 2;
1179
1179
  if (ht(r, o)) {
1180
- const c = Et(l, n), E = ft(r, o);
1181
- return Uo(e, t, s, c, E);
1180
+ const c = Et(l, n), h = ft(r, o);
1181
+ return Uo(e, t, s, c, h);
1182
1182
  } else {
1183
- const c = Un(l, n), E = Zo[c], h = s.direction[E] >= 0;
1183
+ const c = Un(l, n), h = Zo[c], E = s.direction[h] >= 0;
1184
1184
  let u, p;
1185
- h ? (u = pt(l), p = Ct(l, n)) : (u = Ct(l, n), p = pt(l));
1185
+ E ? (u = pt(l), p = Ct(l, n)) : (u = Ct(l, n), p = pt(l));
1186
1186
  const m = Gt(u, i, s, Qi) ? di(u, e, t, s) : null;
1187
1187
  if (m) {
1188
- const F = m.point[E];
1189
- if (h ? F <= i[p + c] : (
1188
+ const F = m.point[h];
1189
+ if (E ? F <= i[p + c] : (
1190
1190
  // min bounding data
1191
1191
  F >= i[p + c + 3]
1192
1192
  ))
@@ -1206,34 +1206,34 @@ function ui(l, e, t, s, i = null) {
1206
1206
  const { float32Array: o, uint16Array: n, uint32Array: r } = Z;
1207
1207
  let a = l * 2;
1208
1208
  if (i === null && (t.boundingBox || t.computeBoundingBox(), ji.set(t.boundingBox.min, t.boundingBox.max, s), i = ji), ht(a, n)) {
1209
- const E = e.geometry, d = E.index, h = E.attributes.position, u = t.index, p = t.attributes.position, A = Et(l, r), m = ft(a, n);
1209
+ const h = e.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 (ge.copy(s).invert(), t.boundsTree)
1211
1211
  return K(l, o, rs), rs.matrix.copy(ge), rs.needsUpdate = !0, t.boundsTree.shapecast({
1212
1212
  intersectsBounds: (R) => rs.intersectsBox(R),
1213
1213
  intersectsTriangle: (R) => {
1214
1214
  R.a.applyMatrix4(s), R.b.applyMatrix4(s), R.c.applyMatrix4(s), R.needsUpdate = !0;
1215
1215
  for (let F = A, f = m + A; F < f; F++)
1216
- if (tt(re, 3 * e.resolveTriangleIndex(F), d, h), re.needsUpdate = !0, R.intersectsTriangle(re))
1216
+ if (tt(re, 3 * e.resolveTriangleIndex(F), d, E), re.needsUpdate = !0, R.intersectsTriangle(re))
1217
1217
  return !0;
1218
1218
  return !1;
1219
1219
  }
1220
1220
  });
1221
1221
  for (let C = A, R = m + A; C < R; C++) {
1222
1222
  const F = e.resolveTriangleIndex(C);
1223
- tt(oe, 3 * F, d, h), oe.a.applyMatrix4(ge), oe.b.applyMatrix4(ge), oe.c.applyMatrix4(ge), oe.needsUpdate = !0;
1223
+ tt(oe, 3 * F, d, E), oe.a.applyMatrix4(ge), oe.b.applyMatrix4(ge), oe.c.applyMatrix4(ge), oe.needsUpdate = !0;
1224
1224
  for (let f = 0, T = u.count; f < T; f += 3)
1225
1225
  if (tt(re, f, u, p), re.needsUpdate = !0, oe.intersectsTriangle(re))
1226
1226
  return !0;
1227
1227
  }
1228
1228
  } else {
1229
- const E = l + 8, d = r[l + 6];
1230
- return K(E, o, os), !!(i.intersectsBox(os) && ui(E, e, t, s, i) || (K(d, o, os), i.intersectsBox(os) && ui(d, e, t, s, i)));
1229
+ const h = l + 8, d = r[l + 6];
1230
+ return K(h, o, os), !!(i.intersectsBox(os) && ui(h, e, t, s, i) || (K(d, o, os), i.intersectsBox(os) && ui(d, e, t, s, i)));
1231
1231
  }
1232
1232
  }
1233
1233
  const as = /* @__PURE__ */ new yt(), Ws = /* @__PURE__ */ new at(), _e = /* @__PURE__ */ new at(), qo = /* @__PURE__ */ new M(), Ko = /* @__PURE__ */ new M(), $o = /* @__PURE__ */ new M(), Jo = /* @__PURE__ */ new M();
1234
1234
  function tr(l, e, t, s = {}, i = {}, o = 0, n = 1 / 0) {
1235
1235
  e.boundingBox || e.computeBoundingBox(), Ws.set(e.boundingBox.min, e.boundingBox.max, t), Ws.needsUpdate = !0;
1236
- const r = l.geometry, a = r.attributes.position, c = r.index, E = e.attributes.position, d = e.index, h = It.getPrimitive(), u = It.getPrimitive();
1236
+ const r = l.geometry, a = r.attributes.position, c = r.index, h = e.attributes.position, d = e.index, E = It.getPrimitive(), u = It.getPrimitive();
1237
1237
  let p = qo, A = Ko, m = null, C = null;
1238
1238
  i && (m = $o, C = Jo);
1239
1239
  let R = 1 / 0, F = null, f = null;
@@ -1250,11 +1250,11 @@ function tr(l, e, t, s = {}, i = {}, o = 0, n = 1 / 0) {
1250
1250
  intersectsRange: (S, N) => {
1251
1251
  for (let P = S, w = S + N; P < w; P++) {
1252
1252
  const y = _.resolveTriangleIndex(P);
1253
- tt(u, 3 * y, d, E), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
1253
+ tt(u, 3 * y, d, h), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
1254
1254
  for (let U = T, x = T + O; U < x; U++) {
1255
1255
  const B = l.resolveTriangleIndex(U);
1256
- tt(h, 3 * B, c, a), h.needsUpdate = !0;
1257
- const H = h.distanceToTriangle(u, p, m);
1256
+ tt(E, 3 * B, c, a), E.needsUpdate = !0;
1257
+ const H = E.distanceToTriangle(u, p, m);
1258
1258
  if (H < R && (A.copy(p), C && C.copy(m), R = H, F = U, f = P), H < o)
1259
1259
  return !0;
1260
1260
  }
@@ -1264,11 +1264,11 @@ function tr(l, e, t, s = {}, i = {}, o = 0, n = 1 / 0) {
1264
1264
  } else {
1265
1265
  const _ = pe(e);
1266
1266
  for (let S = 0, N = _; S < N; S++) {
1267
- tt(u, 3 * S, d, E), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
1267
+ tt(u, 3 * S, d, h), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
1268
1268
  for (let P = T, w = T + O; P < w; P++) {
1269
1269
  const y = l.resolveTriangleIndex(P);
1270
- tt(h, 3 * y, c, a), h.needsUpdate = !0;
1271
- const U = h.distanceToTriangle(u, p, m);
1270
+ tt(E, 3 * y, c, a), E.needsUpdate = !0;
1271
+ const U = E.distanceToTriangle(u, p, m);
1272
1272
  if (U < R && (A.copy(p), C && C.copy(m), R = U, F = P, f = S), U < o)
1273
1273
  return !0;
1274
1274
  }
@@ -1276,7 +1276,7 @@ function tr(l, e, t, s = {}, i = {}, o = 0, n = 1 / 0) {
1276
1276
  }
1277
1277
  }
1278
1278
  }
1279
- ), It.releasePrimitive(h), It.releasePrimitive(u), R === 1 / 0 ? null : (s.point ? s.point.copy(A) : s.point = A.clone(), s.distance = R, s.faceIndex = F, i && (i.point ? i.point.copy(C) : i.point = C.clone(), i.point.applyMatrix4(as), A.applyMatrix4(as), i.distance = A.sub(i.point).length(), i.faceIndex = f), s);
1279
+ ), It.releasePrimitive(E), It.releasePrimitive(u), R === 1 / 0 ? null : (s.point ? s.point.copy(A) : s.point = A.clone(), s.distance = R, s.faceIndex = F, i && (i.point ? i.point.copy(C) : i.point = C.clone(), i.point.applyMatrix4(as), A.applyMatrix4(as), i.distance = A.sub(i.point).length(), i.faceIndex = f), s);
1280
1280
  }
1281
1281
  function er() {
1282
1282
  return typeof SharedArrayBuffer < "u";
@@ -1290,11 +1290,11 @@ function sr(l, e, t, s) {
1290
1290
  const i = l._roots, o = e._roots;
1291
1291
  let n, r = 0, a = 0;
1292
1292
  const c = new yt().copy(t).invert();
1293
- for (let E = 0, d = i.length; E < d; E++) {
1294
- xe.setBuffer(i[E]), a = 0;
1295
- const h = vt.getPrimitive();
1296
- K(0, xe.float32Array, h), h.applyMatrix4(c);
1297
- for (let u = 0, p = o.length; u < p && (As.setBuffer(o[E]), n = Tt(
1293
+ for (let h = 0, d = i.length; h < d; h++) {
1294
+ xe.setBuffer(i[h]), a = 0;
1295
+ const E = vt.getPrimitive();
1296
+ K(0, xe.float32Array, E), E.applyMatrix4(c);
1297
+ for (let u = 0, p = o.length; u < p && (As.setBuffer(o[h]), n = Tt(
1298
1298
  0,
1299
1299
  0,
1300
1300
  t,
@@ -1304,21 +1304,21 @@ function sr(l, e, t, s) {
1304
1304
  a,
1305
1305
  0,
1306
1306
  0,
1307
- h
1307
+ E
1308
1308
  ), As.clearBuffer(), a += o[u].length, !n); u++)
1309
1309
  ;
1310
- if (vt.releasePrimitive(h), xe.clearBuffer(), r += i[E].length, n)
1310
+ if (vt.releasePrimitive(E), xe.clearBuffer(), r += i[h].length, n)
1311
1311
  break;
1312
1312
  }
1313
1313
  return Qs = !1, n;
1314
1314
  }
1315
- function Tt(l, e, t, s, i, o = 0, n = 0, r = 0, a = 0, c = null, E = !1) {
1316
- let d, h;
1317
- E ? (d = As, h = xe) : (d = xe, h = As);
1318
- const u = d.float32Array, p = d.uint32Array, A = d.uint16Array, m = h.float32Array, C = h.uint32Array, R = h.uint16Array, F = l * 2, f = e * 2, T = ht(F, A), O = ht(f, R);
1315
+ function Tt(l, e, t, s, i, o = 0, n = 0, r = 0, a = 0, c = null, h = !1) {
1316
+ let d, E;
1317
+ h ? (d = As, E = xe) : (d = xe, E = As);
1318
+ const u = d.float32Array, p = d.uint32Array, A = d.uint16Array, m = E.float32Array, C = E.uint32Array, R = E.uint16Array, F = l * 2, f = e * 2, T = ht(F, A), O = ht(f, R);
1319
1319
  let _ = !1;
1320
1320
  if (O && T)
1321
- E ? _ = i(
1321
+ h ? _ = i(
1322
1322
  Et(e, C),
1323
1323
  ft(e * 2, R),
1324
1324
  Et(l, p),
@@ -1354,7 +1354,7 @@ function Tt(l, e, t, s, i, o = 0, n = 0, r = 0, a = 0, c = null, E = !1) {
1354
1354
  a,
1355
1355
  r + 1,
1356
1356
  S,
1357
- !E
1357
+ !h
1358
1358
  ) || y && Tt(
1359
1359
  e,
1360
1360
  P,
@@ -1366,7 +1366,7 @@ function Tt(l, e, t, s, i, o = 0, n = 0, r = 0, a = 0, c = null, E = !1) {
1366
1366
  a,
1367
1367
  r + 1,
1368
1368
  S,
1369
- !E
1369
+ !h
1370
1370
  ), vt.releasePrimitive(S);
1371
1371
  } else {
1372
1372
  const S = pt(e), N = Ct(e, C);
@@ -1384,7 +1384,7 @@ function Tt(l, e, t, s, i, o = 0, n = 0, r = 0, a = 0, c = null, E = !1) {
1384
1384
  r,
1385
1385
  a + 1,
1386
1386
  c,
1387
- E
1387
+ h
1388
1388
  ) || Tt(
1389
1389
  l,
1390
1390
  N,
@@ -1396,7 +1396,7 @@ function Tt(l, e, t, s, i, o = 0, n = 0, r = 0, a = 0, c = null, E = !1) {
1396
1396
  r,
1397
1397
  a + 1,
1398
1398
  c,
1399
- E
1399
+ h
1400
1400
  );
1401
1401
  else if (P)
1402
1402
  if (T)
@@ -1411,7 +1411,7 @@ function Tt(l, e, t, s, i, o = 0, n = 0, r = 0, a = 0, c = null, E = !1) {
1411
1411
  r,
1412
1412
  a + 1,
1413
1413
  c,
1414
- E
1414
+ h
1415
1415
  );
1416
1416
  else {
1417
1417
  const y = vt.getPrimitive();
@@ -1430,7 +1430,7 @@ function Tt(l, e, t, s, i, o = 0, n = 0, r = 0, a = 0, c = null, E = !1) {
1430
1430
  a,
1431
1431
  r + 1,
1432
1432
  y,
1433
- !E
1433
+ !h
1434
1434
  ) || H && Tt(
1435
1435
  S,
1436
1436
  x,
@@ -1442,7 +1442,7 @@ function Tt(l, e, t, s, i, o = 0, n = 0, r = 0, a = 0, c = null, E = !1) {
1442
1442
  a,
1443
1443
  r + 1,
1444
1444
  y,
1445
- !E
1445
+ !h
1446
1446
  ), vt.releasePrimitive(y);
1447
1447
  }
1448
1448
  else if (w)
@@ -1458,7 +1458,7 @@ function Tt(l, e, t, s, i, o = 0, n = 0, r = 0, a = 0, c = null, E = !1) {
1458
1458
  r,
1459
1459
  a + 1,
1460
1460
  c,
1461
- E
1461
+ h
1462
1462
  );
1463
1463
  else {
1464
1464
  const y = vt.getPrimitive();
@@ -1477,7 +1477,7 @@ function Tt(l, e, t, s, i, o = 0, n = 0, r = 0, a = 0, c = null, E = !1) {
1477
1477
  a,
1478
1478
  r + 1,
1479
1479
  y,
1480
- !E
1480
+ !h
1481
1481
  ) || H && Tt(
1482
1482
  N,
1483
1483
  x,
@@ -1489,7 +1489,7 @@ function Tt(l, e, t, s, i, o = 0, n = 0, r = 0, a = 0, c = null, E = !1) {
1489
1489
  a,
1490
1490
  r + 1,
1491
1491
  y,
1492
- !E
1492
+ !h
1493
1493
  ), vt.releasePrimitive(y);
1494
1494
  }
1495
1495
  }
@@ -1565,22 +1565,22 @@ class _i {
1565
1565
  const s = this._roots[t], i = new Uint32Array(s), o = new Uint16Array(s);
1566
1566
  n(0);
1567
1567
  function n(r, a = 0) {
1568
- const c = r * 2, E = o[c + 15] === Us;
1569
- if (E) {
1570
- const d = i[r + 6], h = o[c + 14];
1571
- e(a, E, new Float32Array(s, r * 4, 6), d, h);
1568
+ const c = r * 2, h = o[c + 15] === Us;
1569
+ if (h) {
1570
+ const d = i[r + 6], E = o[c + 14];
1571
+ e(a, h, new Float32Array(s, r * 4, 6), d, E);
1572
1572
  } else {
1573
- const d = r + Cs / 4, h = i[r + 6], u = i[r + 7];
1574
- e(a, E, new Float32Array(s, r * 4, 6), u) || (n(d, a + 1), n(h, a + 1));
1573
+ const d = r + Cs / 4, E = i[r + 6], u = i[r + 7];
1574
+ e(a, h, new Float32Array(s, r * 4, 6), u) || (n(d, a + 1), n(E, a + 1));
1575
1575
  }
1576
1576
  }
1577
1577
  }
1578
1578
  /* Core Cast Functions */
1579
1579
  raycast(e, t = wi) {
1580
- const s = this._roots, i = this.geometry, o = [], n = t.isMaterial, r = Array.isArray(t), a = i.groups, c = n ? t.side : t, E = this.indirect ? Xo : bo;
1581
- for (let d = 0, h = s.length; d < h; d++) {
1580
+ const s = this._roots, i = this.geometry, o = [], n = t.isMaterial, r = Array.isArray(t), a = i.groups, c = n ? t.side : t, h = this.indirect ? Xo : bo;
1581
+ for (let d = 0, E = s.length; d < E; d++) {
1582
1582
  const u = r ? t[a[d].materialIndex].side : c, p = o.length;
1583
- if (E(this, d, u, e, o), r) {
1583
+ if (h(this, d, u, e, o), r) {
1584
1584
  const A = a[d].materialIndex;
1585
1585
  for (let m = p, C = o.length; m < C; m++)
1586
1586
  o[m].face.materialIndex = A;
@@ -1591,9 +1591,9 @@ class _i {
1591
1591
  raycastFirst(e, t = wi) {
1592
1592
  const s = this._roots, i = this.geometry, o = t.isMaterial, n = Array.isArray(t);
1593
1593
  let r = null;
1594
- const a = i.groups, c = o ? t.side : t, E = this.indirect ? Qo : Bo;
1595
- for (let d = 0, h = s.length; d < h; d++) {
1596
- const u = n ? t[a[d].materialIndex].side : c, p = E(this, d, u, e);
1594
+ const a = i.groups, c = o ? t.side : t, h = this.indirect ? Qo : Bo;
1595
+ for (let d = 0, E = s.length; d < E; d++) {
1596
+ const u = n ? t[a[d].materialIndex].side : c, p = h(this, d, u, e);
1597
1597
  p != null && (r == null || p.distance < r.distance) && (r = p, n && (p.face.materialIndex = a[d].materialIndex));
1598
1598
  }
1599
1599
  return r;
@@ -1615,13 +1615,13 @@ class _i {
1615
1615
  } = e;
1616
1616
  if (n && r) {
1617
1617
  const d = n;
1618
- n = (h, u, p, A, m) => d(h, u, p, A, m) ? !0 : s(h, u, this, r, p, A, t);
1618
+ n = (E, u, p, A, m) => d(E, u, p, A, m) ? !0 : s(E, u, this, r, p, A, t);
1619
1619
  } else
1620
- n || (r ? n = (d, h, u, p) => s(d, h, this, r, u, p, t) : n = (d, h, u) => u);
1620
+ n || (r ? n = (d, E, u, p) => s(d, E, this, r, u, p, t) : n = (d, E, u) => u);
1621
1621
  let a = !1, c = 0;
1622
- const E = this._roots;
1623
- for (let d = 0, h = E.length; d < h; d++) {
1624
- const u = E[d];
1622
+ const h = this._roots;
1623
+ for (let d = 0, E = h.length; d < E; d++) {
1624
+ const u = h[d];
1625
1625
  if (a = _o(this, d, o, n, i, c), a)
1626
1626
  break;
1627
1627
  c += u.byteLength;
@@ -1638,18 +1638,18 @@ class _i {
1638
1638
  tt(n, A * 3, r, a);
1639
1639
  } : (p) => {
1640
1640
  tt(n, p * 3, r, a);
1641
- }, E = It.getPrimitive(), d = e.geometry.index, h = e.geometry.attributes.position, u = e.indirect ? (p) => {
1641
+ }, h = It.getPrimitive(), d = e.geometry.index, E = e.geometry.attributes.position, u = e.indirect ? (p) => {
1642
1642
  const A = e.resolveTriangleIndex(p);
1643
- tt(E, A * 3, d, h);
1643
+ tt(h, A * 3, d, E);
1644
1644
  } : (p) => {
1645
- tt(E, p * 3, d, h);
1645
+ tt(h, p * 3, d, E);
1646
1646
  };
1647
1647
  if (o) {
1648
1648
  const p = (A, m, C, R, F, f, T, O) => {
1649
1649
  for (let _ = C, S = C + R; _ < S; _++) {
1650
- u(_), E.a.applyMatrix4(t), E.b.applyMatrix4(t), E.c.applyMatrix4(t), E.needsUpdate = !0;
1650
+ u(_), h.a.applyMatrix4(t), h.b.applyMatrix4(t), h.c.applyMatrix4(t), h.needsUpdate = !0;
1651
1651
  for (let N = A, P = A + m; N < P; N++)
1652
- if (c(N), n.needsUpdate = !0, o(n, E, N, _, F, f, T, O))
1652
+ if (c(N), n.needsUpdate = !0, o(n, h, N, _, F, f, T, O))
1653
1653
  return !0;
1654
1654
  }
1655
1655
  return !1;
@@ -2013,11 +2013,11 @@ class dr {
2013
2013
  const s = this.faces;
2014
2014
  let i = -1 / 0, o = 1 / 0;
2015
2015
  for (let n = 0, r = s.length; n < r; n++) {
2016
- const a = s[n], c = a.distanceToPoint(e.origin), E = a.normal.dot(e.direction);
2017
- if (c > 0 && E >= 0)
2016
+ const a = s[n], c = a.distanceToPoint(e.origin), h = a.normal.dot(e.direction);
2017
+ if (c > 0 && h >= 0)
2018
2018
  return null;
2019
- const d = E !== 0 ? -c / E : 0;
2020
- if (!(d <= 0) && (E > 0 ? o = Math.min(d, o) : i = Math.max(d, i), i > o))
2019
+ const d = h !== 0 ? -c / h : 0;
2020
+ if (!(d <= 0) && (h > 0 ? o = Math.min(d, o) : i = Math.max(d, i), i > o))
2021
2021
  return null;
2022
2022
  }
2023
2023
  return i !== -1 / 0 ? e.at(i, t) : e.at(o, t), t;
@@ -2101,15 +2101,15 @@ class dr {
2101
2101
  computeInitialHull() {
2102
2102
  const e = this.vertices, t = this.computeExtremes(), s = t.min, i = t.max;
2103
2103
  let o = 0, n = 0;
2104
- for (let h = 0; h < 3; h++) {
2105
- const u = i[h].point.getComponent(h) - s[h].point.getComponent(h);
2106
- u > o && (o = u, n = h);
2104
+ for (let E = 0; E < 3; E++) {
2105
+ const u = i[E].point.getComponent(E) - s[E].point.getComponent(E);
2106
+ u > o && (o = u, n = E);
2107
2107
  }
2108
2108
  const r = s[n], a = i[n];
2109
- let c, E;
2109
+ let c, h;
2110
2110
  o = 0, Ji.set(r.point, a.point);
2111
- for (let h = 0, u = this.vertices.length; h < u; h++) {
2112
- const p = e[h];
2111
+ for (let E = 0, u = this.vertices.length; E < u; E++) {
2112
+ const p = e[E];
2113
2113
  if (p !== r && p !== a) {
2114
2114
  Ji.closestPointToPoint(p.point, !0, tn);
2115
2115
  const A = tn.distanceToSquared(p.point);
@@ -2117,42 +2117,42 @@ class dr {
2117
2117
  }
2118
2118
  }
2119
2119
  o = -1, qs.setFromCoplanarPoints(r.point, a.point, c.point);
2120
- for (let h = 0, u = this.vertices.length; h < u; h++) {
2121
- const p = e[h];
2120
+ for (let E = 0, u = this.vertices.length; E < u; E++) {
2121
+ const p = e[E];
2122
2122
  if (p !== r && p !== a && p !== c) {
2123
2123
  const A = Math.abs(qs.distanceToPoint(p.point));
2124
- A > o && (o = A, E = p);
2124
+ A > o && (o = A, h = p);
2125
2125
  }
2126
2126
  }
2127
2127
  const d = [];
2128
- if (qs.distanceToPoint(E.point) < 0) {
2128
+ if (qs.distanceToPoint(h.point) < 0) {
2129
2129
  d.push(
2130
2130
  Rt.create(r, a, c),
2131
- Rt.create(E, a, r),
2132
- Rt.create(E, c, a),
2133
- Rt.create(E, r, c)
2131
+ Rt.create(h, a, r),
2132
+ Rt.create(h, c, a),
2133
+ Rt.create(h, r, c)
2134
2134
  );
2135
- for (let h = 0; h < 3; h++) {
2136
- const u = (h + 1) % 3;
2137
- d[h + 1].getEdge(2).setTwin(d[0].getEdge(u)), d[h + 1].getEdge(1).setTwin(d[u + 1].getEdge(0));
2135
+ for (let E = 0; E < 3; E++) {
2136
+ const u = (E + 1) % 3;
2137
+ d[E + 1].getEdge(2).setTwin(d[0].getEdge(u)), d[E + 1].getEdge(1).setTwin(d[u + 1].getEdge(0));
2138
2138
  }
2139
2139
  } else {
2140
2140
  d.push(
2141
2141
  Rt.create(r, c, a),
2142
- Rt.create(E, r, a),
2143
- Rt.create(E, a, c),
2144
- Rt.create(E, c, r)
2142
+ Rt.create(h, r, a),
2143
+ Rt.create(h, a, c),
2144
+ Rt.create(h, c, r)
2145
2145
  );
2146
- for (let h = 0; h < 3; h++) {
2147
- const u = (h + 1) % 3;
2148
- d[h + 1].getEdge(2).setTwin(d[0].getEdge((3 - h) % 3)), d[h + 1].getEdge(0).setTwin(d[u + 1].getEdge(1));
2146
+ for (let E = 0; E < 3; E++) {
2147
+ const u = (E + 1) % 3;
2148
+ d[E + 1].getEdge(2).setTwin(d[0].getEdge((3 - E) % 3)), d[E + 1].getEdge(0).setTwin(d[u + 1].getEdge(1));
2149
2149
  }
2150
2150
  }
2151
- for (let h = 0; h < 4; h++)
2152
- this.faces.push(d[h]);
2153
- for (let h = 0, u = e.length; h < u; h++) {
2154
- const p = e[h];
2155
- if (p !== r && p !== a && p !== c && p !== E) {
2151
+ for (let E = 0; E < 4; E++)
2152
+ this.faces.push(d[E]);
2153
+ for (let E = 0, u = e.length; E < u; E++) {
2154
+ const p = e[E];
2155
+ if (p !== r && p !== a && p !== c && p !== h) {
2156
2156
  o = this.tolerance;
2157
2157
  let A = null;
2158
2158
  for (let m = 0; m < 4; m++) {
@@ -2348,15 +2348,15 @@ function pr(l, e) {
2348
2348
  let t = 0, s = 1;
2349
2349
  const i = l.elements;
2350
2350
  for (let c = 0; c < 3; c++) {
2351
- const E = Math.abs(i[Nt(Ii[c], fi[c])]);
2352
- E > t && (t = E, s = c);
2351
+ const h = Math.abs(i[Nt(Ii[c], fi[c])]);
2352
+ h > t && (t = h, s = c);
2353
2353
  }
2354
2354
  let o = 1, n = 0;
2355
2355
  const r = fi[s], a = Ii[s];
2356
2356
  if (Math.abs(i[Nt(a, r)]) > Number.EPSILON) {
2357
- const c = i[Nt(a, a)], E = i[Nt(r, r)], d = i[Nt(a, r)], h = (c - E) / 2 / d;
2357
+ const c = i[Nt(a, a)], h = i[Nt(r, r)], d = i[Nt(a, r)], E = (c - h) / 2 / d;
2358
2358
  let u;
2359
- h < 0 ? u = -1 / (-h + Math.sqrt(1 + h * h)) : u = 1 / (h + Math.sqrt(1 + h * h)), o = 1 / Math.sqrt(1 + u * u), n = u * o;
2359
+ E < 0 ? u = -1 / (-E + Math.sqrt(1 + E * E)) : u = 1 / (E + Math.sqrt(1 + E * E)), o = 1 / Math.sqrt(1 + u * u), n = u * o;
2360
2360
  }
2361
2361
  return e.identity(), e.elements[Nt(r, r)] = o, e.elements[Nt(a, a)] = o, e.elements[Nt(a, r)] = n, e.elements[Nt(r, a)] = -n, e;
2362
2362
  }
@@ -2394,12 +2394,12 @@ function Tr(l) {
2394
2394
  n.push(bs.point.x, bs.point.y, bs.point.z), n.push(vs.point.x, vs.point.y, vs.point.z), n.push(Bs.point.x, Bs.point.y, Bs.point.z);
2395
2395
  }
2396
2396
  }
2397
- const r = new g.Vector3(), a = new g.Vector3(), c = new g.Vector3(), E = new g.Vector3(), d = new g.Vector3(), h = new g.Vector3(), u = new g.Vector3(), p = new g.Vector3();
2397
+ 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();
2398
2398
  let A = 0, m = 0, C = 0, R = 0, F = 0, f = 0, T = 0;
2399
2399
  for (let it = 0, Xt = n.length; it < Xt; it += 9) {
2400
- r.fromArray(n, it), a.fromArray(n, it + 3), c.fromArray(n, it + 6), u.set(0, 0, 0), u.add(r).add(a).add(c).divideScalar(3), E.subVectors(a, r), d.subVectors(c, r);
2401
- const J = h.crossVectors(E, d).length() / 2;
2402
- p.add(h.copy(u).multiplyScalar(J)), A += J, m += (9 * u.x * u.x + r.x * r.x + a.x * a.x + c.x * c.x) * (J / 12), C += (9 * u.x * u.y + r.x * r.y + a.x * a.y + c.x * c.y) * (J / 12), R += (9 * u.x * u.z + r.x * r.z + a.x * a.z + c.x * c.z) * (J / 12), F += (9 * u.y * u.y + r.y * r.y + a.y * a.y + c.y * c.y) * (J / 12), f += (9 * u.y * u.z + r.y * r.z + a.y * a.z + c.y * c.z) * (J / 12), T += (9 * u.z * u.z + r.z * r.z + a.z * a.z + c.z * c.z) * (J / 12);
2400
+ r.fromArray(n, it), a.fromArray(n, it + 3), c.fromArray(n, it + 6), u.set(0, 0, 0), u.add(r).add(a).add(c).divideScalar(3), h.subVectors(a, r), d.subVectors(c, r);
2401
+ const J = E.crossVectors(h, d).length() / 2;
2402
+ p.add(E.copy(u).multiplyScalar(J)), A += J, m += (9 * u.x * u.x + r.x * r.x + a.x * a.x + c.x * c.x) * (J / 12), C += (9 * u.x * u.y + r.x * r.y + a.x * a.y + c.x * c.y) * (J / 12), R += (9 * u.x * u.z + r.x * r.z + a.x * a.z + c.x * c.z) * (J / 12), F += (9 * u.y * u.y + r.y * r.y + a.y * a.y + c.y * c.y) * (J / 12), f += (9 * u.y * u.z + r.y * r.z + a.y * a.z + c.y * c.z) * (J / 12), T += (9 * u.z * u.z + r.z * r.z + a.z * a.z + c.z * c.z) * (J / 12);
2403
2403
  }
2404
2404
  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;
2405
2405
  const O = new g.Matrix3();
@@ -2964,7 +2964,7 @@ const Fs = class Fs {
2964
2964
  /**
2965
2965
  * The version of the @thatopen/components library.
2966
2966
  */
2967
- I(Fs, "release", "2.0.20");
2967
+ I(Fs, "release", "2.0.21");
2968
2968
  let pi = Fs;
2969
2969
  class Rr {
2970
2970
  constructor(e) {
@@ -3427,25 +3427,25 @@ function hs(l, e, t, s, i = 1 / 0, o) {
3427
3427
  s = Math.max(1e-4, s);
3428
3428
  const n = 2 / s, r = n * o, a = 1 / (1 + r + 0.48 * r * r + 0.235 * r * r * r);
3429
3429
  let c = l - e;
3430
- const E = e, d = i * s;
3430
+ const h = e, d = i * s;
3431
3431
  c = mt(c, -d, d), e = l - c;
3432
- const h = (t.value + n * c) * o;
3433
- t.value = (t.value - n * h) * a;
3434
- let u = e + (c + h) * a;
3435
- return E - l > 0 == u > E && (u = E, t.value = (u - E) / o), u;
3432
+ const E = (t.value + n * c) * o;
3433
+ t.value = (t.value - n * E) * a;
3434
+ let u = e + (c + E) * a;
3435
+ return h - l > 0 == u > h && (u = h, t.value = (u - h) / o), u;
3436
3436
  }
3437
3437
  function rn(l, e, t, s, i = 1 / 0, o, n) {
3438
3438
  s = Math.max(1e-4, s);
3439
3439
  const r = 2 / s, a = r * o, c = 1 / (1 + a + 0.48 * a * a + 0.235 * a * a * a);
3440
- let E = e.x, d = e.y, h = e.z, u = l.x - E, p = l.y - d, A = l.z - h;
3441
- const m = E, C = d, R = h, F = i * s, f = F * F, T = u * u + p * p + A * A;
3440
+ let h = e.x, d = e.y, E = e.z, u = l.x - h, p = l.y - d, A = l.z - E;
3441
+ const m = h, C = d, R = E, F = i * s, f = F * F, T = u * u + p * p + A * A;
3442
3442
  if (T > f) {
3443
3443
  const B = Math.sqrt(T);
3444
3444
  u = u / B * F, p = p / B * F, A = A / B * F;
3445
3445
  }
3446
- E = l.x - u, d = l.y - p, h = l.z - A;
3446
+ h = l.x - u, d = l.y - p, E = l.z - A;
3447
3447
  const O = (t.x + r * u) * o, _ = (t.y + r * p) * o, S = (t.z + r * A) * o;
3448
- t.x = (t.x - r * O) * c, t.y = (t.y - r * _) * c, t.z = (t.z - r * S) * c, n.x = E + (u + O) * c, n.y = d + (p + _) * c, n.z = h + (A + S) * c;
3448
+ t.x = (t.x - r * O) * c, t.y = (t.y - r * _) * c, t.z = (t.z - r * S) * c, n.x = h + (u + O) * c, n.y = d + (p + _) * c, n.z = E + (A + S) * c;
3449
3449
  const N = m - l.x, P = C - l.y, w = R - l.z, y = n.x - m, U = n.y - C, x = n.z - R;
3450
3450
  return N * y + P * U + w * x > 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;
3451
3451
  }
@@ -3651,7 +3651,7 @@ class ot extends Or {
3651
3651
  deltaY: 0,
3652
3652
  mouseButton: T
3653
3653
  };
3654
- this._activePointers.push(O), this._domElement.ownerDocument.removeEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("pointerup", E), this._domElement.ownerDocument.addEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.addEventListener("pointerup", E), this._isDragging = !0, A(f);
3654
+ 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);
3655
3655
  }, r = (f) => {
3656
3656
  if (!this._enabled || !this._domElement || this._lockedPointer)
3657
3657
  return;
@@ -3697,7 +3697,7 @@ class ot extends Or {
3697
3697
  }, c = (f) => {
3698
3698
  const T = this._lockedPointer || this._findPointerById(1);
3699
3699
  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());
3700
- }, E = (f) => {
3700
+ }, h = (f) => {
3701
3701
  const T = this._findPointerById(f.pointerId);
3702
3702
  if (!(T && T === this._lockedPointer)) {
3703
3703
  if (T && this._disposePointer(T), f.pointerType === "touch")
@@ -3723,7 +3723,7 @@ class ot extends Or {
3723
3723
  const f = this._findPointerById(1);
3724
3724
  f && f === this._lockedPointer || (f && this._disposePointer(f), this._state = L.NONE, C());
3725
3725
  };
3726
- let h = -1;
3726
+ let E = -1;
3727
3727
  const u = (f) => {
3728
3728
  if (!this._domElement || !this._enabled || this.mouseButtons.wheel === L.NONE)
3729
3729
  return;
@@ -3734,7 +3734,7 @@ class ot extends Or {
3734
3734
  }
3735
3735
  if (f.preventDefault(), this.dollyToCursor || this.mouseButtons.wheel === L.ROTATE || this.mouseButtons.wheel === L.TRUCK) {
3736
3736
  const N = performance.now();
3737
- h - N < 1e3 && this._getClientRect(this._elementRect), h = N;
3737
+ E - N < 1e3 && this._getClientRect(this._elementRect), E = N;
3738
3738
  }
3739
3739
  const T = _r ? -1 : -3, O = f.deltaMode === 1 ? f.deltaY / T : f.deltaY / (T * 10), _ = this.dollyToCursor ? (f.clientX - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, S = this.dollyToCursor ? (f.clientY - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
3740
3740
  switch (this.mouseButtons.wheel) {
@@ -3764,7 +3764,7 @@ class ot extends Or {
3764
3764
  if (!(!this._domElement || !this._enabled)) {
3765
3765
  if (this.mouseButtons.right === ot.ACTION.NONE) {
3766
3766
  const T = f instanceof PointerEvent ? f.pointerId : (f instanceof MouseEvent, 0), O = this._findPointerById(T);
3767
- O && this._disposePointer(O), this._domElement.ownerDocument.removeEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("pointerup", E), this._domElement.ownerDocument.removeEventListener("mousemove", c), this._domElement.ownerDocument.removeEventListener("mouseup", d);
3767
+ 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);
3768
3768
  return;
3769
3769
  }
3770
3770
  f.preventDefault();
@@ -3812,7 +3812,7 @@ class ot extends Or {
3812
3812
  }
3813
3813
  ((this._state & L.TRUCK) === L.TRUCK || (this._state & L.TOUCH_TRUCK) === L.TOUCH_TRUCK || (this._state & L.TOUCH_DOLLY_TRUCK) === L.TOUCH_DOLLY_TRUCK || (this._state & L.TOUCH_ZOOM_TRUCK) === L.TOUCH_ZOOM_TRUCK) && (this._truckInternal(O, _, !1), this._isUserControllingTruck = !0), ((this._state & L.OFFSET) === L.OFFSET || (this._state & L.TOUCH_OFFSET) === L.TOUCH_OFFSET || (this._state & L.TOUCH_DOLLY_OFFSET) === L.TOUCH_DOLLY_OFFSET || (this._state & L.TOUCH_ZOOM_OFFSET) === L.TOUCH_ZOOM_OFFSET) && (this._truckInternal(O, _, !0), this._isUserControllingOffset = !0), this.dispatchEvent({ type: "control" });
3814
3814
  }, C = () => {
3815
- $s(this._activePointers, lt), i.copy(lt), this._dragNeedsUpdate = !1, (this._activePointers.length === 0 || this._activePointers.length === 1 && this._activePointers[0] === this._lockedPointer) && (this._isDragging = !1), this._activePointers.length === 0 && this._domElement && (this._domElement.ownerDocument.removeEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("mousemove", c), this._domElement.ownerDocument.removeEventListener("pointerup", E), this._domElement.ownerDocument.removeEventListener("mouseup", d), this.dispatchEvent({ type: "controlend" }));
3815
+ $s(this._activePointers, lt), i.copy(lt), this._dragNeedsUpdate = !1, (this._activePointers.length === 0 || this._activePointers.length === 1 && this._activePointers[0] === this._lockedPointer) && (this._isDragging = !1), this._activePointers.length === 0 && this._domElement && (this._domElement.ownerDocument.removeEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("mousemove", c), this._domElement.ownerDocument.removeEventListener("pointerup", h), this._domElement.ownerDocument.removeEventListener("mouseup", d), this.dispatchEvent({ type: "controlend" }));
3816
3816
  };
3817
3817
  this.lockPointer = () => {
3818
3818
  !this._enabled || !this._domElement || (this.cancel(), this._lockedPointer = {
@@ -3822,7 +3822,7 @@ class ot extends Or {
3822
3822
  deltaX: 0,
3823
3823
  deltaY: 0,
3824
3824
  mouseButton: null
3825
- }, this._activePointers.push(this._lockedPointer), this._domElement.ownerDocument.removeEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("pointerup", E), 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", E), A());
3825
+ }, 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());
3826
3826
  }, this.unlockPointer = () => {
3827
3827
  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));
3828
3828
  };
@@ -3832,9 +3832,9 @@ class ot extends Or {
3832
3832
  this.unlockPointer();
3833
3833
  };
3834
3834
  this._addAllEventListeners = (f) => {
3835
- this._domElement = f, this._domElement.style.touchAction = "none", this._domElement.style.userSelect = "none", this._domElement.style.webkitUserSelect = "none", this._domElement.addEventListener("pointerdown", n), Sr && this._domElement.addEventListener("mousedown", r), this._domElement.addEventListener("pointercancel", E), this._domElement.addEventListener("wheel", u, { passive: !1 }), this._domElement.addEventListener("contextmenu", p);
3835
+ this._domElement = f, this._domElement.style.touchAction = "none", this._domElement.style.userSelect = "none", this._domElement.style.webkitUserSelect = "none", this._domElement.addEventListener("pointerdown", n), Sr && this._domElement.addEventListener("mousedown", r), this._domElement.addEventListener("pointercancel", h), this._domElement.addEventListener("wheel", u, { passive: !1 }), this._domElement.addEventListener("contextmenu", p);
3836
3836
  }, this._removeAllEventListeners = () => {
3837
- this._domElement && (this._domElement.style.touchAction = "", this._domElement.style.userSelect = "", this._domElement.style.webkitUserSelect = "", this._domElement.removeEventListener("pointerdown", n), this._domElement.removeEventListener("mousedown", r), this._domElement.removeEventListener("pointercancel", E), this._domElement.removeEventListener("wheel", u, { passive: !1 }), this._domElement.removeEventListener("contextmenu", p), this._domElement.ownerDocument.removeEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("mousemove", c), this._domElement.ownerDocument.removeEventListener("pointerup", E), this._domElement.ownerDocument.removeEventListener("mouseup", d), this._domElement.ownerDocument.removeEventListener("pointerlockchange", R), this._domElement.ownerDocument.removeEventListener("pointerlockerror", F));
3837
+ 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));
3838
3838
  }, this.cancel = () => {
3839
3839
  this._state !== L.NONE && (this._state = L.NONE, this._activePointers.length = 0, C());
3840
3840
  }, t && this.connect(t), this.update(0);
@@ -4201,12 +4201,12 @@ class ot extends Or {
4201
4201
  fitToBox(e, t, { cover: s = !1, paddingLeft: i = 0, paddingRight: o = 0, paddingBottom: n = 0, paddingTop: r = 0 } = {}) {
4202
4202
  const a = [], c = e.isBox3 ? de.copy(e) : de.setFromObject(e);
4203
4203
  c.isEmpty() && (console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"), Promise.resolve());
4204
- const E = on(this._sphericalEnd.theta, nn), d = on(this._sphericalEnd.phi, nn);
4205
- a.push(this.rotateTo(E, d, t));
4206
- const h = G.setFromSpherical(this._sphericalEnd).normalize(), u = En.setFromUnitVectors(h, ti), p = k(Math.abs(h.y), 1);
4207
- p && u.multiply(si.setFromAxisAngle(ds, E)), u.multiply(this._yAxisUpSpaceInverse);
4204
+ const h = on(this._sphericalEnd.theta, nn), d = on(this._sphericalEnd.phi, nn);
4205
+ a.push(this.rotateTo(h, d, t));
4206
+ const E = G.setFromSpherical(this._sphericalEnd).normalize(), u = En.setFromUnitVectors(E, ti), p = k(Math.abs(E.y), 1);
4207
+ p && u.multiply(si.setFromAxisAngle(ds, h)), u.multiply(this._yAxisUpSpaceInverse);
4208
4208
  const A = hn.makeEmpty();
4209
- 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, h), p && u.premultiply(si.invert()), u.premultiply(this._yAxisUpSpace);
4209
+ 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);
4210
4210
  const m = A.getSize(G), C = A.getCenter(z).applyQuaternion(u);
4211
4211
  if (Zt(this._camera)) {
4212
4212
  const R = this.getDistanceToFitBox(m.x, m.y, m.z, s);
@@ -4249,8 +4249,8 @@ class ot extends Or {
4249
4249
  this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection = le.NONE, this._changedDolly = 0;
4250
4250
  const a = z.set(i, o, n), c = G.set(e, t, s);
4251
4251
  this._targetEnd.copy(a), this._sphericalEnd.setFromVector3(c.sub(a).applyQuaternion(this._yAxisUpSpace)), this.normalizeRotations(), this._needsUpdate = !0, r || (this._target.copy(this._targetEnd), this._spherical.copy(this._sphericalEnd));
4252
- const E = !r || k(this._target.x, this._targetEnd.x, this.restThreshold) && k(this._target.y, this._targetEnd.y, this.restThreshold) && k(this._target.z, this._targetEnd.z, this.restThreshold) && k(this._spherical.theta, this._sphericalEnd.theta, this.restThreshold) && k(this._spherical.phi, this._sphericalEnd.phi, this.restThreshold) && k(this._spherical.radius, this._sphericalEnd.radius, this.restThreshold);
4253
- return this._createOnRestPromise(E);
4252
+ const h = !r || k(this._target.x, this._targetEnd.x, this.restThreshold) && k(this._target.y, this._targetEnd.y, this.restThreshold) && k(this._target.z, this._targetEnd.z, this.restThreshold) && k(this._spherical.theta, this._sphericalEnd.theta, this.restThreshold) && k(this._spherical.phi, this._sphericalEnd.phi, this.restThreshold) && k(this._spherical.radius, this._sphericalEnd.radius, this.restThreshold);
4253
+ return this._createOnRestPromise(h);
4254
4254
  }
4255
4255
  /**
4256
4256
  * Similar to setLookAt, but it interpolates between two states.
@@ -4270,11 +4270,11 @@ class ot extends Or {
4270
4270
  * @param enableTransition
4271
4271
  * @category Methods
4272
4272
  */
4273
- lerpLookAt(e, t, s, i, o, n, r, a, c, E, d, h, u, p = !1) {
4273
+ lerpLookAt(e, t, s, i, o, n, r, a, c, h, d, E, u, p = !1) {
4274
4274
  this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection = le.NONE, this._changedDolly = 0;
4275
4275
  const A = G.set(i, o, n), m = z.set(e, t, s);
4276
4276
  dt.setFromVector3(m.sub(A).applyQuaternion(this._yAxisUpSpace));
4277
- const C = Ee.set(E, d, h), R = z.set(r, a, c);
4277
+ const C = Ee.set(h, d, E), R = z.set(r, a, c);
4278
4278
  ye.setFromVector3(R.sub(C).applyQuaternion(this._yAxisUpSpace)), this._targetEnd.copy(A.lerp(C, u));
4279
4279
  const F = ye.theta - dt.theta, f = ye.phi - dt.phi, T = ye.radius - dt.radius;
4280
4280
  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));
@@ -4520,9 +4520,9 @@ class ot extends Or {
4520
4520
  }
4521
4521
  if (this.dollyToCursor) {
4522
4522
  if (Zt(this._camera) && this._changedDolly !== 0) {
4523
- const d = this._spherical.radius - this._lastDistance, h = this._camera, u = this._getCameraDirection(Pe), p = G.copy(u).cross(h.up).normalize();
4523
+ const d = this._spherical.radius - this._lastDistance, E = this._camera, u = this._getCameraDirection(Pe), p = G.copy(u).cross(E.up).normalize();
4524
4524
  p.lengthSq() === 0 && (p.x = 1);
4525
- const A = z.crossVectors(p, u), m = this._sphericalEnd.radius * Math.tan(h.getEffectiveFOV() * Se * 0.5), R = (this._sphericalEnd.radius - d - this._sphericalEnd.radius) / this._sphericalEnd.radius, F = Ee.copy(this._targetEnd).add(p.multiplyScalar(this._dollyControlCoord.x * m * h.aspect)).add(A.multiplyScalar(this._dollyControlCoord.y * m)), f = G.copy(this._targetEnd).lerp(F, R), T = this._lastDollyDirection === le.IN && this._spherical.radius <= this.minDistance, O = this._lastDollyDirection === le.OUT && this.maxDistance <= this._spherical.radius;
4525
+ const A = z.crossVectors(p, u), m = this._sphericalEnd.radius * Math.tan(E.getEffectiveFOV() * Se * 0.5), R = (this._sphericalEnd.radius - d - this._sphericalEnd.radius) / this._sphericalEnd.radius, F = Ee.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 === le.IN && this._spherical.radius <= this.minDistance, O = this._lastDollyDirection === le.OUT && this.maxDistance <= this._spherical.radius;
4526
4526
  if (this.infinityDolly && (T || O)) {
4527
4527
  this._sphericalEnd.radius -= d, this._spherical.radius -= d;
4528
4528
  const S = z.copy(u).multiplyScalar(-d);
@@ -4532,7 +4532,7 @@ class ot extends Or {
4532
4532
  const _ = z.subVectors(f, this._targetEnd);
4533
4533
  this._targetEnd.copy(f), this._target.add(_), this._changedDolly -= d, X(this._changedDolly) && (this._changedDolly = 0);
4534
4534
  } else if (bt(this._camera) && this._changedZoom !== 0) {
4535
- const d = this._zoom - this._lastZoom, h = this._camera, u = G.set(this._dollyControlCoord.x, this._dollyControlCoord.y, (h.near + h.far) / (h.near - h.far)).unproject(h), p = z.set(0, 0, -1).applyQuaternion(h.quaternion), A = Ee.copy(u).add(p.multiplyScalar(-u.dot(h.up))), C = -(this._zoom - d - this._zoom) / this._zoom, R = this._getCameraDirection(Pe), F = this._targetEnd.dot(R), f = G.copy(this._targetEnd).lerp(A, C), T = f.dot(R), O = R.multiplyScalar(T - F);
4535
+ 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 = Ee.copy(u).add(p.multiplyScalar(-u.dot(E.up))), C = -(this._zoom - d - this._zoom) / this._zoom, R = this._getCameraDirection(Pe), F = this._targetEnd.dot(R), f = G.copy(this._targetEnd).lerp(A, C), T = f.dot(R), O = R.multiplyScalar(T - F);
4536
4536
  f.sub(O), this._boundary.clampPoint(f, f);
4537
4537
  const _ = z.subVectors(f, this._targetEnd);
4538
4538
  this._targetEnd.copy(f), this._target.add(_), this._changedZoom -= d, X(this._changedZoom) && (this._changedZoom = 0);
@@ -4541,8 +4541,8 @@ class ot extends Or {
4541
4541
  this._camera.zoom !== this._zoom && (this._camera.zoom = this._zoom, this._camera.updateProjectionMatrix(), this._updateNearPlaneCorners(), this._needsUpdate = !0), this._dragNeedsUpdate = !0;
4542
4542
  const a = this._collisionTest();
4543
4543
  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), _t.setFromMatrixColumn(this._camera.matrix, 1), Qt.setFromMatrixColumn(this._camera.matrix, 2), gt.multiplyScalar(this._focalOffset.x), _t.multiplyScalar(-this._focalOffset.y), Qt.multiplyScalar(this._focalOffset.z), G.copy(gt).add(_t).add(Qt), this._camera.position.add(G)), this._boundaryEnclosesCamera && this._encloseToBoundary(this._camera.position.copy(this._target), G.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse), 1);
4544
- const E = this._needsUpdate;
4545
- return E && !this._updatedLastTime ? (this._hasRested = !1, this.dispatchEvent({ type: "wake" }), this.dispatchEvent({ type: "update" })) : E ? (this.dispatchEvent({ type: "update" }), X(t, this.restThreshold) && X(s, this.restThreshold) && X(i, this.restThreshold) && X(o.x, this.restThreshold) && X(o.y, this.restThreshold) && X(o.z, this.restThreshold) && X(n.x, this.restThreshold) && X(n.y, this.restThreshold) && X(n.z, this.restThreshold) && X(r, this.restThreshold) && !this._hasRested && (this._hasRested = !0, this.dispatchEvent({ type: "rest" }))) : !E && this._updatedLastTime && this.dispatchEvent({ type: "sleep" }), this._lastDistance = this._spherical.radius, this._lastZoom = this._zoom, this._updatedLastTime = E, this._needsUpdate = !1, E;
4544
+ const h = this._needsUpdate;
4545
+ 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(s, 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;
4546
4546
  }
4547
4547
  /**
4548
4548
  * Get all state in JSON string
@@ -4733,9 +4733,9 @@ class ot extends Or {
4733
4733
  return;
4734
4734
  const r = n, a = r.geometry.clone();
4735
4735
  a.applyMatrix4(r.matrixWorld);
4736
- const E = a.attributes.position;
4737
- for (let d = 0, h = E.count; d < h; d++)
4738
- G.fromBufferAttribute(E, d), o = Math.max(o, i.distanceToSquared(G));
4736
+ const h = a.attributes.position;
4737
+ for (let d = 0, E = h.count; d < E; d++)
4738
+ G.fromBufferAttribute(h, d), o = Math.max(o, i.distanceToSquared(G));
4739
4739
  }), s.radius = Math.sqrt(o), s;
4740
4740
  }
4741
4741
  }
@@ -5183,8 +5183,8 @@ class Lr extends ri {
5183
5183
  }), o[R] = F, i[R] = F, s[R] = F;
5184
5184
  }
5185
5185
  n("camera", e), 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);
5186
- const r = new M(), a = new M(), c = new Lt(), E = new Lt(), d = new M(), h = new Lt(), u = new M(), p = new M(), A = new M(), m = 0, C = new M();
5187
- n("worldPosition", r), n("worldPositionStart", a), n("worldQuaternion", c), n("worldQuaternionStart", E), n("cameraPosition", d), n("cameraQuaternion", h), n("pointStart", u), n("pointEnd", p), n("rotationAxis", A), n("rotationAngle", m), n("eye", C), this._offset = new M(), this._startNorm = new M(), this._endNorm = new M(), this._cameraScale = new M(), this._parentPosition = new M(), this._parentQuaternion = new Lt(), this._parentQuaternionInv = new Lt(), this._parentScale = new M(), this._worldScaleStart = new M(), this._worldQuaternionInv = new Lt(), this._worldScale = new M(), this._positionStart = new M(), this._quaternionStart = new Lt(), this._scaleStart = new M(), this._getPointer = Pr.bind(this), this._onPointerDown = Mr.bind(this), this._onPointerHover = yr.bind(this), this._onPointerMove = wr.bind(this), this._onPointerUp = Dr.bind(this), this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointermove", this._onPointerHover), this.domElement.addEventListener("pointerup", this._onPointerUp);
5186
+ const r = new M(), a = new M(), c = new Lt(), h = new Lt(), d = new M(), E = new Lt(), u = new M(), p = new M(), A = new M(), m = 0, C = new M();
5187
+ 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 M(), this._startNorm = new M(), this._endNorm = new M(), this._cameraScale = new M(), this._parentPosition = new M(), this._parentQuaternion = new Lt(), this._parentQuaternionInv = new Lt(), this._parentScale = new M(), this._worldScaleStart = new M(), this._worldQuaternionInv = new Lt(), this._worldScale = new M(), this._positionStart = new M(), this._quaternionStart = new Lt(), this._scaleStart = new M(), this._getPointer = Pr.bind(this), this._onPointerDown = Mr.bind(this), this._onPointerHover = yr.bind(this), this._onPointerMove = wr.bind(this), this._onPointerUp = Dr.bind(this), this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointermove", this._onPointerHover), this.domElement.addEventListener("pointerup", this._onPointerUp);
5188
5188
  }
5189
5189
  // updateMatrixWorld updates key transformation variables
5190
5190
  updateMatrixWorld() {
@@ -5346,12 +5346,12 @@ class Ur extends ri {
5346
5346
  a.color.setHex(16711680), a.opacity = 0.5;
5347
5347
  const c = e.clone();
5348
5348
  c.color.setHex(65280), c.opacity = 0.5;
5349
- const E = e.clone();
5350
- E.color.setHex(255), E.opacity = 0.5;
5349
+ const h = e.clone();
5350
+ h.color.setHex(255), h.opacity = 0.5;
5351
5351
  const d = e.clone();
5352
5352
  d.opacity = 0.25;
5353
- const h = e.clone();
5354
- h.color.setHex(16776960), h.opacity = 0.25, e.clone().color.setHex(16776960);
5353
+ const E = e.clone();
5354
+ E.color.setHex(16776960), E.opacity = 0.25, e.clone().color.setHex(16776960);
5355
5355
  const p = e.clone();
5356
5356
  p.color.setHex(7895160);
5357
5357
  const A = new ct(0, 0.04, 0.1, 12);
@@ -5390,7 +5390,7 @@ class Ur extends ri {
5390
5390
  [new v(new Ze(0.1, 0), d.clone()), [0, 0, 0]]
5391
5391
  ],
5392
5392
  XY: [
5393
- [new v(new rt(0.15, 0.15, 0.01), E.clone()), [0.15, 0.15, 0]]
5393
+ [new v(new rt(0.15, 0.15, 0.01), h.clone()), [0.15, 0.15, 0]]
5394
5394
  ],
5395
5395
  YZ: [
5396
5396
  [new v(new rt(0.15, 0.15, 0.01), a.clone()), [0, 0.15, 0.15], [0, Math.PI / 2, 0]]
@@ -5456,7 +5456,7 @@ class Ur extends ri {
5456
5456
  [new v(F(0.5, 0.5), r), null, [0, Math.PI / 2, 0]]
5457
5457
  ],
5458
5458
  E: [
5459
- [new v(F(0.75, 1), h), null, [0, Math.PI / 2, 0]]
5459
+ [new v(F(0.75, 1), E), null, [0, Math.PI / 2, 0]]
5460
5460
  ]
5461
5461
  }, N = {
5462
5462
  AXIS: [
@@ -5495,7 +5495,7 @@ class Ur extends ri {
5495
5495
  [new v(m, r), [0, 0, -0.5], [-Math.PI / 2, 0, 0]]
5496
5496
  ],
5497
5497
  XY: [
5498
- [new v(new rt(0.15, 0.15, 0.01), E), [0.15, 0.15, 0]]
5498
+ [new v(new rt(0.15, 0.15, 0.01), h), [0.15, 0.15, 0]]
5499
5499
  ],
5500
5500
  YZ: [
5501
5501
  [new v(new rt(0.15, 0.15, 0.01), a), [0, 0.15, 0.15], [0, Math.PI / 2, 0]]
@@ -6250,22 +6250,22 @@ class Vr extends Yr {
6250
6250
  let a;
6251
6251
  if (Array.isArray(o)) {
6252
6252
  let d = !0;
6253
- const h = [];
6253
+ const E = [];
6254
6254
  for (const u of o)
6255
- sn.isTransparent(u) ? h.push(this._transparentMat) : (d = !1, h.push(n));
6255
+ sn.isTransparent(u) ? E.push(this._transparentMat) : (d = !1, E.push(n));
6256
6256
  if (d) {
6257
6257
  n.dispose(), this.isProcessing = !1;
6258
6258
  return;
6259
6259
  }
6260
- a = h;
6260
+ a = E;
6261
6261
  } else if (sn.isTransparent(o)) {
6262
6262
  n.dispose(), this.isProcessing = !1;
6263
6263
  return;
6264
6264
  } else
6265
6265
  a = n;
6266
6266
  this._colorCodeMeshMap.set(r, t), this._meshIDColorCodeMap.set(t.uuid, r);
6267
- const c = s ? t.count : 1, E = new g.InstancedMesh(i, a, c);
6268
- s ? E.instanceMatrix = t.instanceMatrix : E.setMatrixAt(0, new g.Matrix4()), t.visible = !1, t.updateWorldMatrix(!0, !1), E.applyMatrix4(t.matrixWorld), E.updateMatrix(), this.scene.add(E), this.colorMeshes.set(t.uuid, E), this.increaseColor(), this.isProcessing = !1;
6267
+ const c = s ? t.count : 1, h = new g.InstancedMesh(i, a, c);
6268
+ s ? h.instanceMatrix = t.instanceMatrix : h.setMatrixAt(0, new g.Matrix4()), t.visible = !1, t.updateWorldMatrix(!0, !1), h.applyMatrix4(t.matrixWorld), h.updateMatrix(), this.scene.add(h), this.colorMeshes.set(t.uuid, h), this.increaseColor(), this.isProcessing = !1;
6269
6269
  }
6270
6270
  /**
6271
6271
  * Removes a mesh from the culler, so its visibility is not controlled by the culler anymore.
@@ -6791,10 +6791,10 @@ class na extends He {
6791
6791
  }
6792
6792
  const a = new g.Box3(n, r), c = new g.Vector3();
6793
6793
  a.getSize(c);
6794
- const E = new g.Vector3();
6795
- a.getCenter(E);
6796
- const d = Math.max(c.x, c.y, c.z) * s, h = new g.Sphere(E, d);
6797
- await this.controls.fitToSphere(h, !0);
6794
+ const h = new g.Vector3();
6795
+ a.getCenter(h);
6796
+ const d = Math.max(c.x, c.y, c.z) * s, E = new g.Sphere(h, d);
6797
+ await this.controls.fitToSphere(E, !0);
6798
6798
  }
6799
6799
  /**
6800
6800
  * Allows or prevents all user input.
@@ -7042,16 +7042,16 @@ const At = class At extends et {
7042
7042
  const o = t.matrixWorld, n = new g.Matrix4(), r = t instanceof g.InstancedMesh, a = /* @__PURE__ */ new Set();
7043
7043
  if (s && t instanceof Vt.FragmentMesh)
7044
7044
  for (const c of s) {
7045
- const E = t.fragment.getInstancesIDs(c);
7046
- if (E)
7047
- for (const d of E)
7045
+ const h = t.fragment.getInstancesIDs(c);
7046
+ if (h)
7047
+ for (const d of h)
7048
7048
  a.add(d);
7049
7049
  }
7050
7050
  else
7051
7051
  a.add(0);
7052
7052
  for (const c of a) {
7053
- const E = i.min.clone(), d = i.max.clone();
7054
- r && (t.getMatrixAt(c, n), E.applyMatrix4(n), d.applyMatrix4(n)), E.applyMatrix4(o), d.applyMatrix4(o), E.x < this._absoluteMin.x && (this._absoluteMin.x = E.x), E.y < this._absoluteMin.y && (this._absoluteMin.y = E.y), E.z < this._absoluteMin.z && (this._absoluteMin.z = E.z), E.x > this._absoluteMax.x && (this._absoluteMax.x = E.x), E.y > this._absoluteMax.y && (this._absoluteMax.y = E.y), E.z > this._absoluteMax.z && (this._absoluteMax.z = E.z), d.x > this._absoluteMax.x && (this._absoluteMax.x = d.x), d.y > this._absoluteMax.y && (this._absoluteMax.y = d.y), d.z > this._absoluteMax.z && (this._absoluteMax.z = d.z), d.x < this._absoluteMin.x && (this._absoluteMin.x = d.x), d.y < this._absoluteMin.y && (this._absoluteMin.y = d.y), d.z < this._absoluteMin.z && (this._absoluteMin.z = d.z);
7053
+ const h = i.min.clone(), d = i.max.clone();
7054
+ r && (t.getMatrixAt(c, n), h.applyMatrix4(n), d.applyMatrix4(n)), h.applyMatrix4(o), d.applyMatrix4(o), h.x < this._absoluteMin.x && (this._absoluteMin.x = h.x), h.y < this._absoluteMin.y && (this._absoluteMin.y = h.y), h.z < this._absoluteMin.z && (this._absoluteMin.z = h.z), h.x > this._absoluteMax.x && (this._absoluteMax.x = h.x), h.y > this._absoluteMax.y && (this._absoluteMax.y = h.y), h.z > this._absoluteMax.z && (this._absoluteMax.z = h.z), d.x > this._absoluteMax.x && (this._absoluteMax.x = d.x), d.y > this._absoluteMax.y && (this._absoluteMax.y = d.y), d.z > this._absoluteMax.z && (this._absoluteMax.z = d.z), d.x < this._absoluteMin.x && (this._absoluteMin.x = d.x), d.y < this._absoluteMin.y && (this._absoluteMin.y = d.y), d.z < this._absoluteMin.z && (this._absoluteMin.z = d.z);
7055
7055
  }
7056
7056
  }
7057
7057
  static getFragmentBounds(t) {
@@ -7064,8 +7064,8 @@ const At = class At extends et {
7064
7064
  c += 2;
7065
7065
  continue;
7066
7066
  }
7067
- const E = a[c], d = s.getX(E), h = s.getY(E), u = s.getZ(E);
7068
- d < n.x && (n.x = d), h < n.y && (n.y = h), u < n.z && (n.z = u), d > r.x && (r.x = d), h > r.y && (r.y = h), u > r.z && (r.z = u);
7067
+ const h = a[c], d = s.getX(h), E = s.getY(h), u = s.getZ(h);
7068
+ d < n.x && (n.x = d), E < n.y && (n.y = E), u < n.z && (n.z = u), d > r.x && (r.x = d), E > r.y && (r.y = E), u > r.z && (r.z = u);
7069
7069
  }
7070
7070
  return new g.Box3(n, r);
7071
7071
  }
@@ -7234,9 +7234,9 @@ const vn = /* @__PURE__ */ new Set([
7234
7234
  for (const c of r) {
7235
7235
  if (vn.has(c))
7236
7236
  continue;
7237
- const E = a.has(c) && o, d = t.GetLineIDsWithType(s, c);
7238
- for (const h of d) {
7239
- const u = t.GetLine(0, h, E, i);
7237
+ const h = a.has(c) && o, d = t.GetLineIDsWithType(s, c);
7238
+ for (const E of d) {
7239
+ const u = t.GetLine(0, E, h, i);
7240
7240
  n[u.expressID] = u;
7241
7241
  }
7242
7242
  }
@@ -7320,11 +7320,11 @@ const Ls = class Ls extends et {
7320
7320
  * @returns The loaded FragmentsGroup.
7321
7321
  */
7322
7322
  load(t, s) {
7323
- const o = { ...{ coordinate: !0 }, ...s }, { coordinate: n, name: r, properties: a, relationsMap: c } = o, E = this._loader.import(t);
7324
- r && (E.name = r);
7325
- for (const d of E.items)
7326
- d.group = E, this.list.set(d.id, d);
7327
- return n && this.coordinate([E]), this.groups.set(E.uuid, E), a && E.setLocalProperties(a), c && this.components.get(ke).setRelationMap(E, c), this.onFragmentsLoaded.trigger(E), E;
7323
+ const o = { ...{ coordinate: !0 }, ...s }, { coordinate: n, name: r, properties: a, relationsMap: c } = o, h = this._loader.import(t);
7324
+ r && (h.name = r);
7325
+ for (const d of h.items)
7326
+ d.group = h, this.list.set(d.id, d);
7327
+ return n && this.coordinate([h]), this.groups.set(h.uuid, h), a && h.setLocalProperties(a), c && this.components.get(ke).setRelationMap(h, c), this.onFragmentsLoaded.trigger(h), h;
7328
7328
  }
7329
7329
  /**
7330
7330
  * Export the specified fragmentsgroup to binary data.
@@ -7525,17 +7525,17 @@ const Xr = /* @__PURE__ */ new Map([
7525
7525
  }
7526
7526
  indexRelations(t, s, i, o) {
7527
7527
  const n = Object.keys(s).find(
7528
- (h) => h.startsWith("Relating")
7528
+ (E) => E.startsWith("Relating")
7529
7529
  ), r = Object.keys(s).find(
7530
- (h) => h.startsWith("Related")
7530
+ (E) => E.startsWith("Related")
7531
7531
  );
7532
7532
  if (!(n && r))
7533
7533
  return;
7534
- const a = s[n].value, c = s[r].map((h) => h.value), E = t.get(a) ?? /* @__PURE__ */ new Map(), d = this._inverseAttributes.indexOf(o);
7535
- E.set(d, c), t.set(a, E);
7536
- for (const h of c) {
7537
- const u = t.get(h) ?? /* @__PURE__ */ new Map(), p = this._inverseAttributes.indexOf(i), A = u.get(p) ?? [];
7538
- A.push(a), u.set(p, A), t.set(h, u);
7534
+ const a = s[n].value, c = s[r].map((E) => E.value), h = t.get(a) ?? /* @__PURE__ */ new Map(), d = this._inverseAttributes.indexOf(o);
7535
+ h.set(d, c), t.set(a, h);
7536
+ for (const E of c) {
7537
+ const u = t.get(E) ?? /* @__PURE__ */ new Map(), p = this._inverseAttributes.indexOf(i), A = u.get(p) ?? [];
7538
+ A.push(a), u.set(p, A), t.set(E, u);
7539
7539
  }
7540
7540
  }
7541
7541
  /**
@@ -7584,8 +7584,8 @@ const Xr = /* @__PURE__ */ new Map([
7584
7584
  continue;
7585
7585
  const { forRelated: r, forRelating: a } = n;
7586
7586
  for (const c in o) {
7587
- const E = o[c];
7588
- this.indexRelations(s, E, r, a);
7587
+ const h = o[c];
7588
+ this.indexRelations(s, h, r, a);
7589
7589
  }
7590
7590
  }
7591
7591
  return this.setRelationMap(t, s), s;
@@ -7605,10 +7605,10 @@ const Xr = /* @__PURE__ */ new Map([
7605
7605
  if (!n)
7606
7606
  continue;
7607
7607
  const { forRelated: r, forRelating: a } = n, c = t.GetLineIDsWithType(s, o);
7608
- for (let E = 0; E < c.size(); E++) {
7608
+ for (let h = 0; h < c.size(); h++) {
7609
7609
  const d = await t.properties.getItemProperties(
7610
7610
  s,
7611
- c.get(E)
7611
+ c.get(h)
7612
7612
  );
7613
7613
  this.indexRelations(i, d, r, a);
7614
7614
  }
@@ -9033,8 +9033,8 @@ class Kt {
9033
9033
  const a = await e.getProperties(r.value);
9034
9034
  if (!a || !a.UnitType || !a.UnitType.value || a.UnitType.value !== "LENGTHUNIT")
9035
9035
  continue;
9036
- let E = 1, d = 1;
9037
- return a.Name.value === "METRE" && (d = 1), a.Name.value === "FOOT" && (d = 0.3048), ((n = a.Prefix) == null ? void 0 : n.value) === "MILLI" && (E = 1e-3), d * E;
9036
+ let h = 1, d = 1;
9037
+ return a.Name.value === "METRE" && (d = 1), a.Name.value === "FOOT" && (d = 0.3048), ((n = a.Prefix) == null ? void 0 : n.value) === "MILLI" && (h = 1e-3), d * h;
9038
9038
  }
9039
9039
  return 1;
9040
9040
  }
@@ -9053,17 +9053,17 @@ class Kt {
9053
9053
  const o = s ?? (async () => {
9054
9054
  }), n = {}, r = e.getAllPropertiesIDs();
9055
9055
  for (const c of r) {
9056
- const E = await e.getProperties(c);
9057
- if (!E)
9056
+ const h = await e.getProperties(c);
9057
+ if (!h)
9058
9058
  continue;
9059
- const d = E.type === t, h = Object.keys(E).find(
9059
+ const d = h.type === t, E = Object.keys(h).find(
9060
9060
  (C) => C.startsWith("Relating")
9061
- ), u = Object.keys(E).find(
9061
+ ), u = Object.keys(h).find(
9062
9062
  (C) => C.startsWith("Related")
9063
9063
  );
9064
- if (!(d && h && u))
9064
+ if (!(d && E && u))
9065
9065
  continue;
9066
- const p = await e.getProperties((a = E[h]) == null ? void 0 : a.value), A = E[u];
9066
+ const p = await e.getProperties((a = h[E]) == null ? void 0 : a.value), A = h[u];
9067
9067
  if (!p || !A || !(A && Array.isArray(A)))
9068
9068
  continue;
9069
9069
  const m = A.map((C) => C.value);
@@ -9230,48 +9230,48 @@ class Yn {
9230
9230
  s.add(i.get(c));
9231
9231
  const o = e.GetLineIDsWithType(0, b.IFCRELAGGREGATES), n = o.size();
9232
9232
  for (let c = 0; c < n; c++) {
9233
- const E = o.get(c), d = e.GetLine(0, E);
9233
+ const h = o.get(c), d = e.GetLine(0, h);
9234
9234
  if (!d || !d.RelatingObject || !d.RelatedObjects)
9235
9235
  continue;
9236
- const h = d.RelatingObject.value, u = d.RelatedObjects;
9236
+ const E = d.RelatingObject.value, u = d.RelatedObjects;
9237
9237
  for (const p of u) {
9238
9238
  const A = p.value;
9239
- s.has(A) && (this.itemsByFloor[A] = h);
9239
+ s.has(A) && (this.itemsByFloor[A] = E);
9240
9240
  }
9241
9241
  }
9242
9242
  const r = {}, a = t.size();
9243
9243
  for (let c = 0; c < a; c++) {
9244
- const E = t.get(c), d = e.GetLine(0, E);
9244
+ const h = t.get(c), d = e.GetLine(0, h);
9245
9245
  if (!d || !d.RelatingStructure || !d.RelatedElements)
9246
9246
  continue;
9247
- const h = d.RelatingStructure.value, u = d.RelatedElements;
9248
- if (s.has(h))
9247
+ const E = d.RelatingStructure.value, u = d.RelatedElements;
9248
+ if (s.has(E))
9249
9249
  for (const p of u) {
9250
- r[h] || (r[h] = []);
9250
+ r[E] || (r[E] = []);
9251
9251
  const A = p.value;
9252
- r[h].push(A);
9252
+ r[E].push(A);
9253
9253
  }
9254
9254
  else
9255
9255
  for (const p of u) {
9256
9256
  const A = p.value;
9257
- this.itemsByFloor[A] = h;
9257
+ this.itemsByFloor[A] = E;
9258
9258
  }
9259
9259
  }
9260
9260
  for (const c in r) {
9261
- const E = this.itemsByFloor[c];
9262
- if (E !== void 0) {
9261
+ const h = this.itemsByFloor[c];
9262
+ if (h !== void 0) {
9263
9263
  const d = r[c];
9264
- for (const h of d)
9265
- this.itemsByFloor[h] = E;
9264
+ for (const E of d)
9265
+ this.itemsByFloor[E] = h;
9266
9266
  }
9267
9267
  }
9268
9268
  for (let c = 0; c < n; c++) {
9269
- const E = o.get(c), d = e.GetLine(0, E);
9269
+ const h = o.get(c), d = e.GetLine(0, h);
9270
9270
  if (!d || !d.RelatingObject || !d.RelatedObjects)
9271
9271
  continue;
9272
- const h = d.RelatingObject.value, u = d.RelatedObjects;
9272
+ const E = d.RelatingObject.value, u = d.RelatedObjects;
9273
9273
  for (const p of u) {
9274
- const A = p.value, m = this.itemsByFloor[h];
9274
+ const A = p.value, m = this.itemsByFloor[E];
9275
9275
  m !== void 0 && (this.itemsByFloor[A] = m);
9276
9276
  }
9277
9277
  }
@@ -9355,22 +9355,22 @@ class Vn {
9355
9355
  for (const o of e) {
9356
9356
  const n = {};
9357
9357
  if (o.data)
9358
- for (const h of o.data) {
9359
- const [u, p] = h.split(": "), A = parseFloat(p);
9358
+ for (const E of o.data) {
9359
+ const [u, p] = E.split(": "), A = parseFloat(p);
9360
9360
  n[u] = A || p;
9361
9361
  }
9362
9362
  const { points: r } = o, a = new Float32Array(r.length * 3);
9363
- for (let h = 0; h < r.length; h++) {
9364
- const { x: u, y: p, z: A } = r[h];
9365
- a[h * 3] = u, a[h * 3 + 1] = p, a[h * 3 + 2] = A || 0;
9363
+ for (let E = 0; E < r.length; E++) {
9364
+ const { x: u, y: p, z: A } = r[E];
9365
+ a[E * 3] = u, a[E * 3 + 1] = p, a[E * 3 + 2] = A || 0;
9366
9366
  }
9367
- const c = new g.BufferAttribute(a, 3), E = new g.EdgesGeometry();
9368
- E.setAttribute("position", c);
9367
+ const c = new g.BufferAttribute(a, 3), h = new g.EdgesGeometry();
9368
+ h.setAttribute("position", c);
9369
9369
  const d = new Vt.CurveMesh(
9370
9370
  i,
9371
9371
  n,
9372
9372
  t,
9373
- E,
9373
+ h,
9374
9374
  this.defLineMat
9375
9375
  );
9376
9376
  s.push(d.curve), i++;
@@ -9391,14 +9391,14 @@ class Gn {
9391
9391
  r,
9392
9392
  a,
9393
9393
  c,
9394
- E
9394
+ h
9395
9395
  ] = s;
9396
9396
  if (i != null && i.value && (t.name = i.value), o != null && o.value && (t.creationDate = new Date(o.value)), n) {
9397
9397
  t.author = {};
9398
- const [h, u] = n;
9399
- h != null && h.value && (t.author.name = h.value), u != null && u.value && (t.author.email = u.value);
9398
+ const [E, u] = n;
9399
+ E != null && E.value && (t.author.name = E.value), u != null && u.value && (t.author.email = u.value);
9400
9400
  }
9401
- return (d = r[0]) != null && d.value && (t.organization = r[0].value), a != null && a.value && (t.preprocessorVersion = a == null ? void 0 : a.value), c != null && c.value && (t.originatingSystem = c == null ? void 0 : c.value), E != null && E.value && (t.authorization = E == null ? void 0 : E.value), t;
9401
+ return (d = r[0]) != null && d.value && (t.organization = r[0].value), a != null && a.value && (t.preprocessorVersion = a == null ? void 0 : a.value), c != null && c.value && (t.originatingSystem = c == null ? void 0 : c.value), h != null && h.value && (t.authorization = h == null ? void 0 : h.value), t;
9402
9402
  }
9403
9403
  getDescriptionInfo(e) {
9404
9404
  var n;
@@ -9497,7 +9497,15 @@ const Ve = class Ve extends et {
9497
9497
  a.groups.set(o.uuid, o);
9498
9498
  for (const c of o.items)
9499
9499
  a.list.set(c.id, c), c.mesh.uuid = c.id, c.group = o;
9500
- return a.onFragmentsLoaded.trigger(o), s && a.coordinate([o]), console.log(`Streaming the IFC took ${performance.now() - i} ms!`), o;
9500
+ a.onFragmentsLoaded.trigger(o), s && a.coordinate([o]);
9501
+ for (const [c] of o.data) {
9502
+ const h = r[c];
9503
+ if (!h || !h.GlobalId)
9504
+ continue;
9505
+ const d = h.GlobalId.value || h.GlobalId;
9506
+ o.globalToExpressIDs.set(d, c);
9507
+ }
9508
+ return console.log(`Streaming the IFC took ${performance.now() - i} ms!`), o;
9501
9509
  }
9502
9510
  /**
9503
9511
  * Reads an IFC file and initializes the Web-IFC library.
@@ -9553,10 +9561,10 @@ const Ve = class Ve extends et {
9553
9561
  continue;
9554
9562
  const r = this.webIfc.GetLineIDsWithType(0, n), a = r.size();
9555
9563
  for (let c = 0; c < a; c++) {
9556
- const E = r.get(c);
9557
- i.push(E);
9558
- const d = this._spatialTree.itemsByFloor[E] || 0;
9559
- s.data.set(E, [[], [d, n]]);
9564
+ const h = r.get(c);
9565
+ i.push(h);
9566
+ const d = this._spatialTree.itemsByFloor[h] || 0;
9567
+ s.data.set(h, [[], [d, n]]);
9560
9568
  }
9561
9569
  }
9562
9570
  this._spatialTree.cleanUp(), this.webIfc.StreamMeshes(0, i, (n) => {
@@ -9571,8 +9579,8 @@ const Ve = class Ve extends et {
9571
9579
  if (!r)
9572
9580
  throw new Error("Fragment not found!");
9573
9581
  const a = [];
9574
- for (const [c, E] of r)
9575
- a.push(E);
9582
+ for (const [c, h] of r)
9583
+ a.push(h);
9576
9584
  n.add(a);
9577
9585
  }
9578
9586
  const o = this.webIfc.GetCoordinationMatrix(0);
@@ -9581,14 +9589,14 @@ const Ve = class Ve extends et {
9581
9589
  getMesh(t, s) {
9582
9590
  const i = t.geometries.size(), o = t.expressID;
9583
9591
  for (let n = 0; n < i; n++) {
9584
- const r = t.geometries.get(n), { x: a, y: c, z: E, w: d } = r.color, h = d !== 1, { geometryExpressID: u } = r, p = `${u}-${h}`;
9592
+ 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}`;
9585
9593
  if (!this._visitedFragments.has(p)) {
9586
- const T = this.getGeometry(this.webIfc, u), O = h ? this._materialT : this._material, _ = new Vt.Fragment(T, O, 1);
9594
+ const T = this.getGeometry(this.webIfc, u), O = E ? this._materialT : this._material, _ = new Vt.Fragment(T, O, 1);
9587
9595
  s.add(_.mesh), s.items.push(_);
9588
9596
  const S = this._visitedFragments.size;
9589
9597
  this._visitedFragments.set(p, { index: S, fragment: _ });
9590
9598
  }
9591
- const A = new g.Color().setRGB(a, c, E, "srgb"), m = new g.Matrix4();
9599
+ const A = new g.Color().setRGB(a, c, h, "srgb"), m = new g.Matrix4();
9592
9600
  m.fromArray(r.flatTransformation);
9593
9601
  const C = this._visitedFragments.get(p);
9594
9602
  if (C === void 0)
@@ -9619,10 +9627,10 @@ const Ve = class Ve extends et {
9619
9627
  i.GetVertexData(),
9620
9628
  i.GetVertexDataSize()
9621
9629
  ), r = new Float32Array(n.length / 2), a = new Float32Array(n.length / 2);
9622
- for (let h = 0; h < n.length; h += 6)
9623
- r[h / 2] = n[h], r[h / 2 + 1] = n[h + 1], r[h / 2 + 2] = n[h + 2], a[h / 2] = n[h + 3], a[h / 2 + 1] = n[h + 4], a[h / 2 + 2] = n[h + 5];
9624
- const c = new g.BufferGeometry(), E = new g.BufferAttribute(r, 3), d = new g.BufferAttribute(a, 3);
9625
- return c.setAttribute("position", E), c.setAttribute("normal", d), c.setIndex(Array.from(o)), i.delete(), c;
9630
+ for (let E = 0; E < n.length; E += 6)
9631
+ r[E / 2] = n[E], r[E / 2 + 1] = n[E + 1], r[E / 2 + 2] = n[E + 2], a[E / 2] = n[E + 3], a[E / 2 + 1] = n[E + 4], a[E / 2 + 2] = n[E + 5];
9632
+ const c = new g.BufferGeometry(), h = new g.BufferAttribute(r, 3), d = new g.BufferAttribute(a, 3);
9633
+ return c.setAttribute("position", h), c.setAttribute("normal", d), c.setIndex(Array.from(o)), i.delete(), c;
9626
9634
  }
9627
9635
  async autoSetWasm() {
9628
9636
  const t = await fetch(
@@ -9751,23 +9759,23 @@ const Bt = class Bt extends et {
9751
9759
  * @throws Will throw an error if no OwnerHistory is found in the model.
9752
9760
  */
9753
9761
  async newPset(t, s, i) {
9754
- const o = Bt.getIFCSchema(t), { ownerHistoryHandle: n } = await this.getOwnerHistory(t), r = this.newGUID(t), a = new b[o].IfcLabel(s), c = i ? new b[o].IfcText(i) : null, E = new b[o].IfcPropertySet(
9762
+ const o = Bt.getIFCSchema(t), { ownerHistoryHandle: n } = await this.getOwnerHistory(t), r = this.newGUID(t), a = new b[o].IfcLabel(s), c = i ? new b[o].IfcText(i) : null, h = new b[o].IfcPropertySet(
9755
9763
  r,
9756
9764
  n,
9757
9765
  a,
9758
9766
  c,
9759
9767
  []
9760
9768
  );
9761
- E.expressID = this.increaseMaxID(t);
9762
- const d = this.newGUID(t), h = new b[o].IfcRelDefinesByProperties(
9769
+ h.expressID = this.increaseMaxID(t);
9770
+ const d = this.newGUID(t), E = new b[o].IfcRelDefinesByProperties(
9763
9771
  d,
9764
9772
  n,
9765
9773
  null,
9766
9774
  null,
9767
9775
  [],
9768
- new b.Handle(E.expressID)
9776
+ new b.Handle(h.expressID)
9769
9777
  );
9770
- return h.expressID = this.increaseMaxID(t), await this.setData(t, E, h), { pset: E, rel: h };
9778
+ return E.expressID = this.increaseMaxID(t), await this.setData(t, h, E), { pset: h, rel: E };
9771
9779
  }
9772
9780
  /**
9773
9781
  * Removes a Property Set (Pset) from the given model.
@@ -9913,10 +9921,10 @@ const Bt = class Bt extends et {
9913
9921
  async saveToIfc(t, s) {
9914
9922
  const i = this.components.get(Ri), o = i.webIfc, n = await i.readIfcFile(s), r = this.changeMap[t.uuid] ?? [];
9915
9923
  for (const c of r) {
9916
- const E = await t.getProperties(c);
9917
- if (E)
9924
+ const h = await t.getProperties(c);
9925
+ if (h)
9918
9926
  try {
9919
- o.WriteLine(n, E);
9927
+ o.WriteLine(n, h);
9920
9928
  } catch {
9921
9929
  }
9922
9930
  else
@@ -9963,8 +9971,8 @@ const Bt = class Bt extends et {
9963
9971
  get() {
9964
9972
  return this._value;
9965
9973
  },
9966
- async set(E) {
9967
- this._value = E, c.trigger(E);
9974
+ async set(h) {
9975
+ this._value = h, c.trigger(h);
9968
9976
  }
9969
9977
  }), n[i].value = a, this.attributeListeners[t.uuid][s] || (this.attributeListeners[t.uuid][s] = {}), this.attributeListeners[t.uuid][s][i] = c, c;
9970
9978
  }
@@ -10026,8 +10034,8 @@ const Ps = class Ps extends et {
10026
10034
  else
10027
10035
  for (const a of r) {
10028
10036
  const c = n[a];
10029
- for (const E of i)
10030
- delete c[E];
10037
+ for (const h of i)
10038
+ delete c[h];
10031
10039
  Object.values(c).length === 0 && delete n[a];
10032
10040
  }
10033
10041
  }
@@ -10082,13 +10090,13 @@ const Ps = class Ps extends et {
10082
10090
  continue;
10083
10091
  }
10084
10092
  for (const c of a) {
10085
- const E = this.list[r][c];
10086
- if (E)
10087
- for (const d in E) {
10093
+ const h = this.list[r][c];
10094
+ if (h)
10095
+ for (const d in h) {
10088
10096
  o[d] || (o[d] = /* @__PURE__ */ new Map());
10089
- for (const h of E[d]) {
10090
- const u = o[d].get(h);
10091
- u === void 0 ? o[d].set(h, 1) : o[d].set(h, u + 1);
10097
+ for (const E of h[d]) {
10098
+ const u = o[d].get(E);
10099
+ u === void 0 ? o[d].set(E, 1) : o[d].set(E, u + 1);
10092
10100
  }
10093
10101
  }
10094
10102
  }
@@ -10096,10 +10104,10 @@ const Ps = class Ps extends et {
10096
10104
  const n = {};
10097
10105
  for (const r in o) {
10098
10106
  const a = o[r];
10099
- for (const [c, E] of a) {
10100
- if (E === void 0)
10107
+ for (const [c, h] of a) {
10108
+ if (h === void 0)
10101
10109
  throw new Error("Malformed fragments map!");
10102
- E === i && (n[r] || (n[r] = /* @__PURE__ */ new Set()), n[r].add(c));
10110
+ h === i && (n[r] || (n[r] = /* @__PURE__ */ new Set()), n[r].add(c));
10103
10111
  }
10104
10112
  }
10105
10113
  return n;
@@ -10125,8 +10133,8 @@ const Ps = class Ps extends et {
10125
10133
  for (const [n, r] of s.data) {
10126
10134
  const a = r[0];
10127
10135
  for (const c of a) {
10128
- const E = s.keyFragments.get(c);
10129
- E && (o[E] || (o[E] = /* @__PURE__ */ new Set()), o[E].add(n));
10136
+ const h = s.keyFragments.get(c);
10137
+ h && (o[h] || (o[h] = /* @__PURE__ */ new Set()), o[h].add(n));
10130
10138
  }
10131
10139
  }
10132
10140
  }
@@ -10154,9 +10162,9 @@ const Ps = class Ps extends et {
10154
10162
  const a = String((o = r.PredefinedType) == null ? void 0 : o.value).toUpperCase();
10155
10163
  s[a] || (s[a] = {});
10156
10164
  const c = s[a];
10157
- for (const [E, d] of t.data) {
10158
- const h = d[0];
10159
- for (const u of h) {
10165
+ for (const [h, d] of t.data) {
10166
+ const E = d[0];
10167
+ for (const u of E) {
10160
10168
  const p = t.keyFragments.get(u);
10161
10169
  if (!p)
10162
10170
  throw new Error("Fragment ID not found!");
@@ -10248,17 +10256,17 @@ const Ps = class Ps extends et {
10248
10256
  ), c = await t.getProperties(r);
10249
10257
  if (!(a && c))
10250
10258
  continue;
10251
- const E = (n = c.Name) == null ? void 0 : n.value;
10259
+ const h = (n = c.Name) == null ? void 0 : n.value;
10252
10260
  for (const d of a) {
10253
- this.saveItem(t, o, E, d);
10254
- const h = s.getEntityRelations(
10261
+ this.saveItem(t, o, h, d);
10262
+ const E = s.getEntityRelations(
10255
10263
  t,
10256
10264
  Number(d),
10257
10265
  "IsDecomposedBy"
10258
10266
  );
10259
- if (h)
10260
- for (const u of h)
10261
- this.saveItem(t, o, E, u);
10267
+ if (E)
10268
+ for (const u of E)
10269
+ this.saveItem(t, o, h, u);
10262
10270
  }
10263
10271
  }
10264
10272
  }
@@ -10377,12 +10385,12 @@ const ys = class ys extends et {
10377
10385
  const r = s.list[this.groupName], a = new g.Matrix4();
10378
10386
  for (const c in r) {
10379
10387
  a.elements[13] = n * o * this.height;
10380
- for (const E in r[c]) {
10381
- const d = i.list.get(E), h = c + E, u = this.list.has(h);
10388
+ for (const h in r[c]) {
10389
+ const d = i.list.get(h), E = c + h, u = this.list.has(E);
10382
10390
  if (!d || t && u || !t && !u)
10383
10391
  continue;
10384
- t ? this.list.add(h) : this.list.delete(h);
10385
- const p = r[c][E];
10392
+ t ? this.list.add(E) : this.list.delete(E);
10393
+ const p = r[c][h];
10386
10394
  d.applyTransform(p, a);
10387
10395
  }
10388
10396
  n++;
@@ -10579,23 +10587,28 @@ const ws = class ws extends et {
10579
10587
  r > t && (r = 0, a++, o.push([]));
10580
10588
  const f = C.get(F);
10581
10589
  o[a].push(f);
10582
- const T = this._spatialTree.itemsByFloor[f] || 0;
10583
- n.data.set(f, [[], [T, m]]), r++;
10590
+ const T = this.webIfc.GetLine(0, f);
10591
+ if (T.GlobalId) {
10592
+ const _ = (T == null ? void 0 : T.GlobalId.value) || (T == null ? void 0 : T.GlobalId);
10593
+ n.globalToExpressIDs.set(_, f);
10594
+ }
10595
+ const O = this._spatialTree.itemsByFloor[f] || 0;
10596
+ n.data.set(f, [[], [O, m]]), r++;
10584
10597
  }
10585
10598
  }
10586
10599
  this._spatialTree.cleanUp();
10587
- let c = 0.01, E = 0;
10600
+ let c = 0.01, h = 0;
10588
10601
  for (const m of o) {
10589
- E++, this.webIfc.StreamMeshes(0, m, (R) => {
10602
+ h++, this.webIfc.StreamMeshes(0, m, (R) => {
10590
10603
  this.getMesh(this.webIfc, R, n);
10591
10604
  }), this._geometryCount > t && await this.streamGeometries(), this._assets.length > s && await this.streamAssets();
10592
- const C = E / o.length;
10605
+ const C = h / o.length;
10593
10606
  C > c && (c += 0.01, c = Math.max(c, C), this.onProgress.trigger(Math.round(c * 100) / 100));
10594
10607
  }
10595
10608
  this._geometryCount && await this.streamGeometries(), this._assets.length && await this.streamAssets();
10596
- const { opaque: d, transparent: h } = n.geometryIDs;
10609
+ const { opaque: d, transparent: E } = n.geometryIDs;
10597
10610
  for (const [m, { index: C, uuid: R }] of this._visitedGeometries)
10598
- n.keyFragments.set(C, R), (m > 1 ? d : h).set(m, C);
10611
+ n.keyFragments.set(C, R), (m > 1 ? d : E).set(m, C);
10599
10612
  const u = n.data.keys();
10600
10613
  for (const m of u) {
10601
10614
  const [C] = n.data.get(m);
@@ -10612,13 +10625,13 @@ const ws = class ws extends et {
10612
10625
  getMesh(t, s, i) {
10613
10626
  const o = s.geometries.size(), n = s.expressID, r = { id: n, geometries: [] };
10614
10627
  for (let a = 0; a < o; a++) {
10615
- const c = s.geometries.get(a), E = c.geometryExpressID, d = c.color.w === 1 ? 1 : -1, h = E * d;
10616
- if (!this._visitedGeometries.has(h)) {
10617
- this._visitedGeometries.has(E) || this.getGeometry(t, E);
10628
+ const c = s.geometries.get(a), h = c.geometryExpressID, d = c.color.w === 1 ? 1 : -1, E = h * d;
10629
+ if (!this._visitedGeometries.has(E)) {
10630
+ this._visitedGeometries.has(h) || this.getGeometry(t, h);
10618
10631
  const T = this._visitedGeometries.size, O = g.MathUtils.generateUUID();
10619
- this._visitedGeometries.set(h, { uuid: O, index: T });
10632
+ this._visitedGeometries.set(E, { uuid: O, index: T });
10620
10633
  }
10621
- const u = this._visitedGeometries.get(h);
10634
+ const u = this._visitedGeometries.get(E);
10622
10635
  if (u === void 0)
10623
10636
  throw new Error("Error getting geometry data for streaming!");
10624
10637
  const p = i.data.get(n);
@@ -10626,7 +10639,7 @@ const ws = class ws extends et {
10626
10639
  throw new Error("Data not found!");
10627
10640
  p[0].push(u.index);
10628
10641
  const { x: A, y: m, z: C, w: R } = c.color, F = [A, m, C, R], f = c.flatTransformation;
10629
- r.geometries.push({ color: F, geometryID: E, transformation: f });
10642
+ r.geometries.push({ color: F, geometryID: h, transformation: f });
10630
10643
  }
10631
10644
  this._assets.push(r);
10632
10645
  }
@@ -10640,12 +10653,12 @@ const ws = class ws extends et {
10640
10653
  ), r = new Float32Array(n.length / 2), a = new Float32Array(n.length / 2);
10641
10654
  for (let u = 0; u < n.length; u += 6)
10642
10655
  r[u / 2] = n[u], r[u / 2 + 1] = n[u + 1], r[u / 2 + 2] = n[u + 2], a[u / 2] = n[u + 3], a[u / 2 + 1] = n[u + 4], a[u / 2 + 2] = n[u + 5];
10643
- const c = Tr(r), E = new Float32Array(c.transformation.elements), d = [c.center.x, c.center.y, c.center.z];
10644
- let h = !1;
10656
+ const c = Tr(r), h = new Float32Array(c.transformation.elements), d = [c.center.x, c.center.y, c.center.z];
10657
+ let E = !1;
10645
10658
  for (let u = 0; u < r.length - 2; u += 3) {
10646
10659
  const p = r[u], A = r[u + 1], m = r[u + 2], C = a[u], R = a[u + 1], F = a[u + 2];
10647
10660
  if (mr(d, [p, A, m], [C, R, F])) {
10648
- h = !0;
10661
+ E = !0;
10649
10662
  break;
10650
10663
  }
10651
10664
  }
@@ -10653,8 +10666,8 @@ const ws = class ws extends et {
10653
10666
  position: r,
10654
10667
  normal: a,
10655
10668
  index: o,
10656
- boundingBox: E,
10657
- hasHoles: h
10669
+ boundingBox: h,
10670
+ hasHoles: E
10658
10671
  }), i.delete(), this._geometryCount++;
10659
10672
  }
10660
10673
  async streamAssets() {
@@ -10758,15 +10771,15 @@ class Kr extends et {
10758
10771
  for (const c of s) {
10759
10772
  if (n++, vn.has(c))
10760
10773
  continue;
10761
- const E = i.has(c), d = this.webIfc.GetLineIDsWithType(0, c), h = d.size();
10774
+ const h = i.has(c), d = this.webIfc.GetLineIDsWithType(0, c), E = d.size();
10762
10775
  let u = 0;
10763
- for (let A = 0; A < h - t; A += t) {
10776
+ for (let A = 0; A < E - t; A += t) {
10764
10777
  const m = {};
10765
10778
  for (let C = 0; C < t; C++) {
10766
10779
  u++;
10767
10780
  const R = d.get(A + C);
10768
10781
  try {
10769
- const F = this.webIfc.GetLine(0, R, E);
10782
+ const F = this.webIfc.GetLine(0, R, h);
10770
10783
  m[F.expressID] = F;
10771
10784
  } catch {
10772
10785
  console.log(`Could not get property: ${R}`);
@@ -10774,12 +10787,12 @@ class Kr extends et {
10774
10787
  }
10775
10788
  await this.onPropertiesStreamed.trigger({ type: c, data: m });
10776
10789
  }
10777
- if (u !== h) {
10790
+ if (u !== E) {
10778
10791
  const A = {};
10779
- for (let m = u; m < h; m++) {
10792
+ for (let m = u; m < E; m++) {
10780
10793
  const C = d.get(m);
10781
10794
  try {
10782
- const R = this.webIfc.GetLine(0, C, E);
10795
+ const R = this.webIfc.GetLine(0, C, h);
10783
10796
  A[R.expressID] = R;
10784
10797
  } catch {
10785
10798
  console.log(`Could not get property: ${C}`);
@@ -10839,60 +10852,60 @@ const Ds = class Ds extends et {
10839
10852
  i,
10840
10853
  t
10841
10854
  ), a = [];
10842
- for (let h = 0; h < n.length / 3; h++) {
10843
- const { plane: u, edges: p } = this.getFaceData(h, i, t);
10855
+ for (let E = 0; E < n.length / 3; E++) {
10856
+ const { plane: u, edges: p } = this.getFaceData(E, i, t);
10844
10857
  if (u.equals(r)) {
10845
- a.push({ index: h, edges: p });
10858
+ a.push({ index: E, edges: p });
10846
10859
  for (const { id: A, points: m, distance: C } of p)
10847
10860
  o.set(A, { points: m, distance: C });
10848
10861
  }
10849
10862
  }
10850
10863
  let c = 0;
10851
- const E = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map();
10852
- for (const { index: h, edges: u } of a) {
10864
+ const h = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map();
10865
+ for (const { index: E, edges: u } of a) {
10853
10866
  const p = /* @__PURE__ */ new Map();
10854
10867
  for (const { id: T } of u)
10855
- if (E.has(T)) {
10856
- const O = E.get(T);
10868
+ if (h.has(T)) {
10869
+ const O = h.get(T);
10857
10870
  p.set(T, O);
10858
10871
  }
10859
10872
  const A = u.map((T) => T.id);
10860
10873
  if (!p.size) {
10861
10874
  const T = c++;
10862
10875
  for (const { id: O } of u)
10863
- E.set(O, T);
10876
+ h.set(O, T);
10864
10877
  d.set(T, {
10865
10878
  edges: new Set(A),
10866
- indices: /* @__PURE__ */ new Set([h])
10879
+ indices: /* @__PURE__ */ new Set([E])
10867
10880
  });
10868
10881
  continue;
10869
10882
  }
10870
10883
  let m = null;
10871
10884
  const C = /* @__PURE__ */ new Set(), R = new Set(A);
10872
10885
  for (const [T, O] of p) {
10873
- m === null ? m = O : O !== m && C.add(O), E.delete(T);
10886
+ m === null ? m = O : O !== m && C.add(O), h.delete(T);
10874
10887
  const { edges: _ } = d.get(O);
10875
10888
  _.delete(T), R.delete(T);
10876
10889
  }
10877
10890
  if (m === null)
10878
10891
  throw new Error("Error computing face!");
10879
10892
  const F = d.get(m), { indices: f } = F;
10880
- f.add(h);
10893
+ f.add(E);
10881
10894
  for (const T of R) {
10882
- E.set(T, m);
10895
+ h.set(T, m);
10883
10896
  const { edges: O } = F;
10884
10897
  O.add(T);
10885
10898
  }
10886
10899
  for (const T of C) {
10887
10900
  const O = d.get(T), { edges: _, indices: S } = O, N = d.get(m), { edges: P, indices: w } = N;
10888
10901
  for (const y of _)
10889
- P.add(y), E.set(y, m);
10902
+ P.add(y), h.set(y, m);
10890
10903
  for (const y of S)
10891
10904
  w.add(y);
10892
10905
  d.delete(T);
10893
10906
  }
10894
10907
  }
10895
- for (const [h, { indices: u, edges: p }] of d)
10908
+ for (const [E, { indices: u, edges: p }] of d)
10896
10909
  if (u.has(s)) {
10897
10910
  const A = [];
10898
10911
  for (const m of p) {
@@ -10916,14 +10929,14 @@ const Ds = class Ds extends et {
10916
10929
  getVerticesAndNormal(t, s, i) {
10917
10930
  if (!t.geometry.index)
10918
10931
  throw new Error("Geometry must be indexed!");
10919
- const o = t.geometry.index.array, n = t.geometry.attributes.position.array, r = t.geometry.attributes.normal.array, a = o[s * 3] * 3, c = o[s * 3 + 1] * 3, E = o[s * 3 + 2] * 3, d = new g.Vector3(n[a], n[a + 1], n[a + 2]), h = new g.Vector3(n[c], n[c + 1], n[c + 2]), u = new g.Vector3(n[E], n[E + 1], n[E + 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[E], r[E + 1], r[E + 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);
10932
+ const o = t.geometry.index.array, n = t.geometry.attributes.position.array, r = t.geometry.attributes.normal.array, a = o[s * 3] * 3, c = o[s * 3 + 1] * 3, h = o[s * 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);
10920
10933
  if (i !== void 0 && t instanceof g.InstancedMesh) {
10921
10934
  const T = new g.Matrix4();
10922
10935
  t.getMatrixAt(i, T);
10923
10936
  const O = new g.Matrix4();
10924
- O.extractRotation(T), f.applyMatrix4(O), d.applyMatrix4(T), h.applyMatrix4(T), u.applyMatrix4(T);
10937
+ O.extractRotation(T), f.applyMatrix4(O), d.applyMatrix4(T), E.applyMatrix4(T), u.applyMatrix4(T);
10925
10938
  }
10926
- return { p1: d, p2: h, p3: u, faceNormal: f };
10939
+ return { p1: d, p2: E, p3: u, faceNormal: f };
10927
10940
  }
10928
10941
  /**
10929
10942
  * Method to round the vector's components to a specified number of decimal places.
@@ -10938,21 +10951,21 @@ const Ds = class Ds extends et {
10938
10951
  getFaceData(t, s, i) {
10939
10952
  const o = this.getVerticesAndNormal(i, t, s), { p1: n, p2: r, p3: a, faceNormal: c } = o;
10940
10953
  this.round(n), this.round(r), this.round(a), this.round(c);
10941
- const E = [
10954
+ const h = [
10942
10955
  { id: `${n.x}|${n.y}|${n.z}`, value: n },
10943
10956
  { id: `${r.x}|${r.y}|${r.z}`, value: r },
10944
10957
  { id: `${a.x}|${a.y}|${a.z}`, value: a }
10945
10958
  ];
10946
- E.sort((F, f) => F.id < f.id ? -1 : F.id > f.id ? 1 : 0);
10959
+ h.sort((F, f) => F.id < f.id ? -1 : F.id > f.id ? 1 : 0);
10947
10960
  const [
10948
- { id: d, value: h },
10961
+ { id: d, value: E },
10949
10962
  { id: u, value: p },
10950
10963
  { id: A, value: m }
10951
- ] = E, C = [
10964
+ ] = h, C = [
10952
10965
  {
10953
10966
  id: `${d}|${u}`,
10954
- distance: h.distanceTo(p),
10955
- points: [h, p]
10967
+ distance: E.distanceTo(p),
10968
+ points: [E, p]
10956
10969
  },
10957
10970
  {
10958
10971
  id: `${u}|${A}`,
@@ -10961,8 +10974,8 @@ const Ds = class Ds extends et {
10961
10974
  },
10962
10975
  {
10963
10976
  id: `${d}|${A}`,
10964
- distance: h.distanceTo(m),
10965
- points: [h, m]
10977
+ distance: E.distanceTo(m),
10978
+ points: [E, m]
10966
10979
  }
10967
10980
  ], R = new g.Plane();
10968
10981
  return R.setFromNormalAndCoplanarPoint(c, n), R.constant = Math.round(R.constant * 10) / 10, { plane: R, edges: C };