bimatter-viewer-react 0.5.6 → 0.5.8

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/lib/index.js CHANGED
@@ -1,44 +1,44 @@
1
1
  import e, { createContext as t, forwardRef as n, memo as r, useCallback as i, useContext as a, useEffect as o, useImperativeHandle as s, useMemo as c, useRef as l, useState as u } from "react";
2
2
  import { Canvas as d, useFrame as f, useThree as p } from "@react-three/fiber";
3
3
  import { OrbitControls as m, Stats as h } from "@react-three/drei";
4
- import { Box3 as g, BoxGeometry as _, BufferAttribute as v, BufferGeometry as y, CanvasTexture as b, Color as x, ConeGeometry as S, DataTexture as C, DoubleSide as w, DynamicDrawUsage as T, Float32BufferAttribute as E, Group as D, Line as O, Line3 as k, LineBasicMaterial as ee, LineDashedMaterial as A, LineSegments as j, LinearFilter as M, MathUtils as te, Matrix4 as N, Mesh as P, MeshBasicMaterial as F, MeshLambertMaterial as ne, NearestFilter as re, Object3D as ie, OrthographicCamera as ae, PerspectiveCamera as oe, Plane as se, RGBAFormat as ce, SRGBColorSpace as le, Sphere as ue, SphereGeometry as de, Sprite as fe, SpriteMaterial as pe, UnsignedByteType as me, Vector2 as I, Vector3 as L } from "three";
5
- import { useStore as he } from "zustand";
6
- import { createStore as ge } from "zustand/vanilla";
7
- import { CONTAINED as _e, INTERSECTED as ve, MeshBVH as ye, NOT_INTERSECTED as be, acceleratedRaycast as xe } from "three-mesh-bvh";
8
- import { Fragment as Se, jsx as R, jsxs as z } from "react/jsx-runtime";
9
- import Ce from "pako";
4
+ import { Box3 as g, BoxGeometry as _, BufferAttribute as v, BufferGeometry as y, CanvasTexture as b, Color as x, ConeGeometry as S, DataTexture as C, DoubleSide as w, DynamicDrawUsage as T, Float32BufferAttribute as E, Group as D, Line as ee, Line3 as O, LineBasicMaterial as te, LineDashedMaterial as k, LineSegments as ne, LinearFilter as A, MathUtils as re, Matrix4 as j, Mesh as M, MeshBasicMaterial as ie, MeshLambertMaterial as ae, NearestFilter as oe, Object3D as se, OrthographicCamera as ce, PerspectiveCamera as le, Plane as ue, RGBAFormat as de, SRGBColorSpace as fe, Sphere as pe, SphereGeometry as me, Sprite as he, SpriteMaterial as ge, UnsignedByteType as _e, Vector2 as N, Vector3 as P } from "three";
5
+ import { useStore as ve } from "zustand";
6
+ import { createStore as ye } from "zustand/vanilla";
7
+ import { CONTAINED as be, INTERSECTED as xe, MeshBVH as Se, NOT_INTERSECTED as Ce, acceleratedRaycast as we } from "three-mesh-bvh";
8
+ import { Fragment as Te, jsx as F, jsxs as I } from "react/jsx-runtime";
9
+ import Ee from "pako";
10
10
  //#region src/viewer/store/ViewerStoreContext.ts
11
- var we = t(null);
11
+ var De = t(null);
12
12
  //#endregion
13
13
  //#region src/viewer/store/useViewerStore.ts
14
- function B(e) {
15
- return he(Te(), e);
14
+ function L(e) {
15
+ return ve(R(), e);
16
16
  }
17
- function Te() {
18
- let e = a(we);
17
+ function R() {
18
+ let e = a(De);
19
19
  if (!e) throw Error("useViewerStore must be used inside ViewerStoreProvider");
20
20
  return e;
21
21
  }
22
22
  //#endregion
23
23
  //#region src/viewer/store/ViewerStore.ts
24
- var Ee = "rgb(17, 148, 189)", De = "rgb(104, 198, 227)", Oe = {
24
+ var Oe = "rgb(17, 148, 189)", ke = "rgb(104, 198, 227)", Ae = {
25
25
  bottom: !0,
26
26
  left: !0,
27
27
  right: !0,
28
28
  top: !0,
29
29
  visible: !0
30
30
  };
31
- function ke() {
32
- return ge((e) => ({
31
+ function je() {
32
+ return ye((e) => ({
33
33
  api: null,
34
34
  defaultHotkeysEnabled: !0,
35
- gridAxesVisibility: Oe,
35
+ gridAxesVisibility: Ae,
36
36
  modelNames: {},
37
37
  modelProps: {},
38
38
  modelStructure: {},
39
- preselectionColor: De,
39
+ preselectionColor: ke,
40
40
  selected: {},
41
- selectionColor: Ee,
41
+ selectionColor: Oe,
42
42
  selectionInteractionDisabled: !1,
43
43
  showNavCube: !0,
44
44
  showStats: !1,
@@ -119,60 +119,60 @@ function ke() {
119
119
  }
120
120
  }));
121
121
  }
122
- var Ae = 2;
123
- function je() {
124
- let e = new C(new Uint8Array(256 * 4), 256, 1, ce, me);
125
- return e.magFilter = re, e.minFilter = re, e.generateMipmaps = !1, e.needsUpdate = !0, Ne(e, 1, new x(Ee)), e;
122
+ var Me = 2;
123
+ function Ne() {
124
+ let e = new C(new Uint8Array(256 * 4), 256, 1, de, _e);
125
+ return e.magFilter = oe, e.minFilter = oe, e.generateMipmaps = !1, e.needsUpdate = !0, Fe(e, 1, new x(Oe)), e;
126
126
  }
127
- function Me(e) {
127
+ function Pe(e) {
128
128
  return `${e.r.toFixed(6)}:${e.g.toFixed(6)}:${e.b.toFixed(6)}`;
129
129
  }
130
- function Ne(e, t, n) {
130
+ function Fe(e, t, n) {
131
131
  let r = e.image.data, i = t * 4;
132
132
  r[i] = Math.round(n.r * 255), r[i + 1] = Math.round(n.g * 255), r[i + 2] = Math.round(n.b * 255), r[i + 3] = 255, e.needsUpdate = !0;
133
133
  }
134
- function Pe(e) {
134
+ function Ie(e) {
135
135
  return e.mesh.geometry.attributes.colorIndex;
136
136
  }
137
- function Fe(e) {
137
+ function Le(e) {
138
138
  let t = e.mesh.geometry.attributes.ids;
139
139
  if (!t) return null;
140
140
  let n = new v(new Uint8Array(t.count), 1);
141
141
  return e.mesh.geometry.setAttribute("colorIndex", n), n;
142
142
  }
143
- function Ie(e, t) {
144
- let n = Pe(e);
145
- return n || t === 0 ? n : Fe(e);
143
+ function Re(e, t) {
144
+ let n = Ie(e);
145
+ return n || t === 0 ? n : Le(e);
146
146
  }
147
- function Le(e) {
148
- Pe(e) && e.mesh.geometry.deleteAttribute("colorIndex");
147
+ function ze(e) {
148
+ Ie(e) && e.mesh.geometry.deleteAttribute("colorIndex");
149
149
  }
150
- function Re(e, t, n) {
150
+ function Be(e, t, n) {
151
151
  let r = e.get(t);
152
152
  return !r && n && (r = /* @__PURE__ */ new Set(), e.set(t, r)), r;
153
153
  }
154
- function ze(e, t) {
155
- let n = Ie(e.record, t);
154
+ function Ve(e, t) {
155
+ let n = Re(e.record, t);
156
156
  if (!n) return !1;
157
157
  let r = n.array;
158
158
  return e.vertexRanges.forEach(({ count: e, start: n }) => {
159
159
  r.fill(t, n, n + e);
160
160
  }), n.needsUpdate = !0, !0;
161
161
  }
162
- function Be(e, t, n, r, i) {
162
+ function He(e, t, n, r, i) {
163
163
  e && e.forEach((e) => {
164
164
  if (e.record.modelID !== t) return;
165
- let a = ze(e, r), o = Re(i, e.record, r !== 0 && a);
166
- r === 0 ? (o?.delete(n), o?.size || (i.delete(e.record), Le(e.record))) : a && o?.add(n);
165
+ let a = Ve(e, r), o = Be(i, e.record, r !== 0 && a);
166
+ r === 0 ? (o?.delete(n), o?.size || (i.delete(e.record), ze(e.record))) : a && o?.add(n);
167
167
  });
168
168
  }
169
- function Ve(e) {
169
+ function Ue(e) {
170
170
  let t = /* @__PURE__ */ new Set();
171
171
  return Object.entries(e).forEach(([e, n]) => {
172
172
  n.forEach((n) => t.add(`${e}:${n}`));
173
173
  }), t;
174
174
  }
175
- function He(e, t) {
175
+ function We(e, t) {
176
176
  let n = /* @__PURE__ */ new Map(), r = (e) => {
177
177
  let [t, r] = e.split(":").map(Number), i = n.get(t);
178
178
  i || (i = /* @__PURE__ */ new Set(), n.set(t, i)), i.add(r);
@@ -183,28 +183,28 @@ function He(e, t) {
183
183
  t.has(e) || r(e);
184
184
  }), n;
185
185
  }
186
- function Ue(e) {
187
- let t = B((e) => e.selected), n = B((e) => e.selectionColor), r = c(je, []), a = l(/* @__PURE__ */ new Map()), s = l(Ae), u = l(/* @__PURE__ */ new Map()), d = l(t), f = l(/* @__PURE__ */ new Set()), p = l(/* @__PURE__ */ new WeakMap());
186
+ function Ge(e) {
187
+ let t = L((e) => e.selected), n = L((e) => e.selectionColor), r = c(Ne, []), a = l(/* @__PURE__ */ new Map()), s = l(Me), u = l(/* @__PURE__ */ new Map()), d = l(t), f = l(/* @__PURE__ */ new Set()), p = l(/* @__PURE__ */ new WeakMap());
188
188
  o(() => {
189
189
  d.current = t;
190
190
  }, [t]), o(() => () => r.dispose(), [r]), o(() => {
191
- Ne(r, 1, new x(n));
191
+ Fe(r, 1, new x(n));
192
192
  }, [r, n]);
193
193
  let m = i((e, t) => d.current[e]?.has(t) ? 1 : u.current.get(e)?.get(t) ?? 0, []), h = i((t, n) => {
194
194
  let r = e.buildIndex();
195
195
  n.forEach((e) => {
196
- Be(r.elementIndex.get(e), t, e, m(t, e), p.current);
196
+ He(r.elementIndex.get(e), t, e, m(t, e), p.current);
197
197
  });
198
198
  }, [e, m]), g = i((e) => {
199
- let t = new x(e), n = Me(t), i = a.current.get(n);
199
+ let t = new x(e), n = Pe(t), i = a.current.get(n);
200
200
  if (i !== void 0) return i;
201
201
  let o = s.current;
202
202
  if (o >= 256) throw Error("Element color palette is full. Maximum colors: 255.");
203
- return a.current.set(n, o), s.current += 1, Ne(r, o, t), o;
203
+ return a.current.set(n, o), s.current += 1, Fe(r, o, t), o;
204
204
  }, [r]);
205
205
  o(() => {
206
- let e = Ve(t);
207
- He(f.current, e).forEach((e, t) => {
206
+ let e = Ue(t);
207
+ We(f.current, e).forEach((e, t) => {
208
208
  h(t, Array.from(e));
209
209
  }), f.current = e;
210
210
  }, [h, t]);
@@ -232,12 +232,12 @@ function Ue(e) {
232
232
  t.forEach((t) => r(Number(e), t));
233
233
  }), n.forEach((e, n) => {
234
234
  e.forEach((e) => {
235
- Be(t.elementIndex.get(e), n, e, m(n, e), p.current);
235
+ He(t.elementIndex.get(e), n, e, m(n, e), p.current);
236
236
  });
237
237
  });
238
238
  }, [e, m]), S = i(() => {
239
239
  e.buildIndex().records.forEach((e) => {
240
- p.current.delete(e), Le(e);
240
+ p.current.delete(e), ze(e);
241
241
  }), p.current = /* @__PURE__ */ new WeakMap(), u.current.clear(), b();
242
242
  }, [b, e]);
243
243
  return {
@@ -259,12 +259,12 @@ function Ue(e) {
259
259
  }
260
260
  //#endregion
261
261
  //#region src/viewer/SelectableMesh.tsx
262
- P.prototype.raycast = xe;
263
- var We = e.memo(function({ colorPaletteTexture: e, material: t, data: n, isIfcSpace: r = !1, meshMatrix: i }) {
264
- let a = l(null), s = B((e) => e.preselectionColor), u = l(s);
262
+ M.prototype.raycast = we;
263
+ var Ke = e.memo(function({ colorPaletteTexture: e, material: t, data: n, isIfcSpace: r = !1, meshMatrix: i }) {
264
+ let a = l(null), s = L((e) => e.preselectionColor), u = l(s);
265
265
  u.current = s;
266
266
  let d = c(() => {
267
- let n = new ne({
267
+ let n = new ae({
268
268
  color: new x(t.r, t.g, t.b),
269
269
  transparent: !!(t.opacity && t.opacity != 1),
270
270
  opacity: t.opacity ?? 1,
@@ -298,11 +298,11 @@ var We = e.memo(function({ colorPaletteTexture: e, material: t, data: n, isIfcSp
298
298
  e && (e.value instanceof x ? e.value.set(s) : e.value = new x(s));
299
299
  }, [d, s]), o(() => {
300
300
  if (!a.current) return;
301
- let e = a.current.geometry, t = new ye(e, { indirect: !0 });
301
+ let e = a.current.geometry, t = new Se(e, { indirect: !0 });
302
302
  return Object.assign(e, { boundsTree: t }), () => {
303
303
  d.dispose(), Object.assign(e, { boundsTree: null });
304
304
  };
305
- }, [d]), /* @__PURE__ */ z("mesh", {
305
+ }, [d]), /* @__PURE__ */ I("mesh", {
306
306
  matrix: i,
307
307
  matrixAutoUpdate: !1,
308
308
  name: r ? "space" : void 0,
@@ -312,38 +312,38 @@ var We = e.memo(function({ colorPaletteTexture: e, material: t, data: n, isIfcSp
312
312
  let t = e.object;
313
313
  t.preselected &&= !1;
314
314
  },
315
- children: [/* @__PURE__ */ z("bufferGeometry", { children: [
316
- /* @__PURE__ */ R("bufferAttribute", {
315
+ children: [/* @__PURE__ */ I("bufferGeometry", { children: [
316
+ /* @__PURE__ */ F("bufferAttribute", {
317
317
  attach: "attributes-position",
318
318
  args: [n.pos, 3]
319
319
  }),
320
- n.norm && /* @__PURE__ */ R("bufferAttribute", {
320
+ n.norm && /* @__PURE__ */ F("bufferAttribute", {
321
321
  attach: "attributes-normal",
322
322
  args: [n.norm, 3]
323
323
  }),
324
- /* @__PURE__ */ R("bufferAttribute", {
324
+ /* @__PURE__ */ F("bufferAttribute", {
325
325
  attach: "attributes-ids",
326
326
  args: [n.ids, 1]
327
327
  }),
328
- /* @__PURE__ */ R("bufferAttribute", {
328
+ /* @__PURE__ */ F("bufferAttribute", {
329
329
  attach: "index",
330
330
  args: [n.ind, 1]
331
331
  })
332
- ] }), /* @__PURE__ */ R("primitive", { object: d })]
332
+ ] }), /* @__PURE__ */ F("primitive", { object: d })]
333
333
  });
334
- }), Ge = 10, Ke = "#1d2733", qe = 2, Je = .05, Ye = "\0", Xe = /* @__PURE__ */ new Map();
335
- function Ze() {
334
+ }), qe = 10, Je = "#1d2733", Ye = 2, Xe = .05, Ze = "\0", Qe = /* @__PURE__ */ new Map();
335
+ function $e() {
336
336
  return typeof window > "u" ? 1 : Math.min(window.devicePixelRatio || 1, 2);
337
337
  }
338
- function Qe(e, t, n, r) {
339
- let i = Ze(), a = document.createElement("canvas"), o = a.getContext("2d");
338
+ function et(e, t, n, r) {
339
+ let i = $e(), a = document.createElement("canvas"), o = a.getContext("2d");
340
340
  if (!o) throw Error("Could not create grid label canvas context");
341
341
  let s = `400 ${r}px system-ui, "Segoe UI", sans-serif`, c = Math.ceil(r * .5), l = Math.ceil(r * .35);
342
342
  o.font = s;
343
343
  let u = o.measureText(t), d = u.actualBoundingBoxAscent || r * .8, f = u.actualBoundingBoxDescent || r * .2, p = Math.max(1, Math.ceil(u.width + c * 2)), m = Math.max(1, Math.ceil(d + f + l * 2));
344
344
  a.width = Math.ceil(p * i), a.height = Math.ceil(m * i), o.scale(i, i), o.clearRect(0, 0, p, m), o.font = s, o.fillStyle = n, o.textAlign = "left", o.textBaseline = "alphabetic", o.fillText(t, c, l + d);
345
345
  let h = new b(a);
346
- return h.colorSpace = le, h.generateMipmaps = !1, h.magFilter = M, h.minFilter = M, h.needsUpdate = !0, {
346
+ return h.colorSpace = fe, h.generateMipmaps = !1, h.magFilter = A, h.minFilter = A, h.needsUpdate = !0, {
347
347
  disposeTimer: null,
348
348
  height: m,
349
349
  key: e,
@@ -352,49 +352,49 @@ function Qe(e, t, n, r) {
352
352
  width: p
353
353
  };
354
354
  }
355
- function $e(e, t, n) {
355
+ function tt(e, t, n) {
356
356
  let r = [
357
357
  e,
358
358
  t,
359
359
  n
360
- ].join(Ye), i = Xe.get(r);
361
- return i || (i = Qe(r, e, t, n), Xe.set(r, i)), i;
360
+ ].join(Ze), i = Qe.get(r);
361
+ return i || (i = et(r, e, t, n), Qe.set(r, i)), i;
362
362
  }
363
- function et(e, t, n) {
364
- let r = c(() => $e(e, t, n), [
363
+ function nt(e, t, n) {
364
+ let r = c(() => tt(e, t, n), [
365
365
  t,
366
366
  n,
367
367
  e
368
368
  ]);
369
369
  return o(() => (r.disposeTimer &&= (clearTimeout(r.disposeTimer), null), r.refs++, () => {
370
370
  r.refs = Math.max(0, r.refs - 1), r.refs <= 0 && (r.disposeTimer = setTimeout(() => {
371
- r.refs > 0 || (r.texture.dispose(), Xe.delete(r.key), r.disposeTimer = null);
371
+ r.refs > 0 || (r.texture.dispose(), Qe.delete(r.key), r.disposeTimer = null);
372
372
  }, 1e3));
373
373
  }), [r]), r;
374
374
  }
375
- function tt(e, t, n, r) {
375
+ function rt(e, t, n, r) {
376
376
  let i = Math.abs(n.projectionMatrix.elements[5]) || 1, a = t.height * 2 / (Math.max(1, r) * i), o = a * (t.width / t.height);
377
377
  e.scale.set(o, a, 1);
378
378
  }
379
- function nt(e, t) {
379
+ function it(e, t) {
380
380
  let n = e[t];
381
381
  return n === void 0 ? 0 : Number.isFinite(n) ? n : null;
382
382
  }
383
- function V(e, t) {
384
- return nt(e, t) ?? 0;
383
+ function z(e, t) {
384
+ return it(e, t) ?? 0;
385
385
  }
386
- function rt(e) {
387
- let t = nt(e, "x"), n = nt(e, "y"), r = nt(e, "z");
388
- return t === null || n === null || r === null ? null : new L(t, n, r);
386
+ function at(e) {
387
+ let t = it(e, "x"), n = it(e, "y"), r = it(e, "z");
388
+ return t === null || n === null || r === null ? null : new P(t, n, r);
389
389
  }
390
- function it(e, t) {
390
+ function ot(e, t) {
391
391
  return [
392
- V(e, "x"),
393
- t !== void 0 && Number.isFinite(t) ? t : V(e, "y"),
394
- V(e, "z")
392
+ z(e, "x"),
393
+ t !== void 0 && Number.isFinite(t) ? t : z(e, "y"),
394
+ z(e, "z")
395
395
  ];
396
396
  }
397
- function at(e) {
397
+ function st(e) {
398
398
  let { h: t, l: n } = e.getHSL({
399
399
  h: 0,
400
400
  s: 0,
@@ -402,14 +402,14 @@ function at(e) {
402
402
  });
403
403
  return t < .55 && n >= .5 || t >= .55 && n >= .75 ? "#000000" : "#ffffff";
404
404
  }
405
- function ot(e) {
405
+ function ct(e) {
406
406
  let t = p((e) => e.scene.background);
407
- return c(() => e || (t instanceof x ? at(t) : Ke), [t, e]);
407
+ return c(() => e || (t instanceof x ? st(t) : Je), [t, e]);
408
408
  }
409
- function st({ axis: e, grid: t, endSide: n, startSide: r }) {
409
+ function lt({ axis: e, grid: t, endSide: n, startSide: r }) {
410
410
  return Object.entries(e).flatMap(([e, i]) => {
411
411
  if (i.length < 2) return [];
412
- let a = rt(i[0]), o = rt(i[1]);
412
+ let a = at(i[0]), o = at(i[1]);
413
413
  return !a || !o ? [] : (a.y = 0, o.y = 0, [{
414
414
  endSide: n,
415
415
  loc: t.loc,
@@ -419,18 +419,18 @@ function st({ axis: e, grid: t, endSide: n, startSide: r }) {
419
419
  }]);
420
420
  });
421
421
  }
422
- function ct({ flattenToFloor: e, grids: t, showBottom: n, showLeft: r, showRight: i, showTop: a }) {
422
+ function ut({ flattenToFloor: e, grids: t, showBottom: n, showLeft: r, showRight: i, showTop: a }) {
423
423
  let o = {
424
424
  bottom: n,
425
425
  left: r,
426
426
  right: i,
427
427
  top: a
428
- }, s = Object.values(t).flatMap((e) => [...st({
428
+ }, s = Object.values(t).flatMap((e) => [...lt({
429
429
  axis: e.points.u,
430
430
  endSide: "right",
431
431
  grid: e,
432
432
  startSide: "left"
433
- }), ...st({
433
+ }), ...lt({
434
434
  axis: e.points.v,
435
435
  endSide: "bottom",
436
436
  grid: e,
@@ -443,8 +443,8 @@ function ct({ flattenToFloor: e, grids: t, showBottom: n, showLeft: r, showRight
443
443
  e.startSide,
444
444
  e.endSide,
445
445
  e.name,
446
- V(e.loc, "x"),
447
- V(e.loc, "z"),
446
+ z(e.loc, "x"),
447
+ z(e.loc, "z"),
448
448
  e.points[0].x,
449
449
  e.points[0].z,
450
450
  e.points[1].x,
@@ -453,57 +453,57 @@ function ct({ flattenToFloor: e, grids: t, showBottom: n, showLeft: r, showRight
453
453
  c.has(t) || c.set(t, e);
454
454
  }), Array.from(c.values());
455
455
  }
456
- function lt(e, t) {
457
- return new L(...it(e.loc, t));
456
+ function dt(e, t) {
457
+ return new P(...ot(e.loc, t));
458
458
  }
459
- function ut({ cameraPosition: e, floorY: t, line: n, showBottom: r, showLeft: i, showRight: a, showTop: o }) {
459
+ function ft({ cameraPosition: e, floorY: t, line: n, showBottom: r, showLeft: i, showRight: a, showTop: o }) {
460
460
  let s = {
461
461
  bottom: r,
462
462
  left: i,
463
463
  right: a,
464
464
  top: o
465
- }, c = lt(n, t), l = n.points[0].clone().add(c), u = n.points[1].clone().add(c), d = l.distanceToSquared(e) > u.distanceToSquared(e) ? "start" : "end", f = d === "start" ? "end" : "start", p = (e) => s[e === "start" ? n.startSide : n.endSide];
465
+ }, c = dt(n, t), l = n.points[0].clone().add(c), u = n.points[1].clone().add(c), d = l.distanceToSquared(e) > u.distanceToSquared(e) ? "start" : "end", f = d === "start" ? "end" : "start", p = (e) => s[e === "start" ? n.startSide : n.endSide];
466
466
  return p(d) ? d : p(f) ? f : null;
467
467
  }
468
- function dt({ endpoint: e, labelOffset: t, line: n }) {
468
+ function pt({ endpoint: e, labelOffset: t, line: n }) {
469
469
  let r = e === "start" ? n.points[0].clone() : n.points[1].clone(), i = n.points[1].clone().sub(n.points[0]);
470
470
  return i.y = 0, i.lengthSq() === 0 && i.set(1, 0, 0), i.normalize().multiplyScalar(t), e === "start" && i.negate(), r.add(i);
471
471
  }
472
- function ft(e, t) {
473
- let n = new L(), r = 0;
472
+ function mt(e, t) {
473
+ let n = new P(), r = 0;
474
474
  return e.forEach((e) => {
475
- let i = lt(e, t);
475
+ let i = dt(e, t);
476
476
  e.points.forEach((e) => {
477
477
  n.add(e).add(i), r++;
478
478
  });
479
479
  }), r && n.divideScalar(r), n;
480
480
  }
481
- function pt(e, t, n) {
481
+ function ht(e, t, n) {
482
482
  let r = 0;
483
483
  return e.forEach((e) => {
484
- let i = lt(e, n);
484
+ let i = dt(e, n);
485
485
  e.points.forEach((e) => {
486
486
  r = Math.max(r, e.clone().add(i).distanceTo(t));
487
487
  });
488
488
  }), r;
489
489
  }
490
- function mt({ color: e, fontSize: t, position: n, text: r }) {
491
- let { camera: i, size: a } = p(), s = l(null), c = et(r, e, t);
490
+ function gt({ color: e, fontSize: t, position: n, text: r }) {
491
+ let { camera: i, size: a } = p(), s = l(null), c = nt(r, e, t);
492
492
  return o(() => {
493
493
  let e = s.current;
494
- e && tt(e, c, i, a.height);
494
+ e && rt(e, c, i, a.height);
495
495
  }, [
496
496
  i,
497
497
  a.height,
498
498
  c
499
499
  ]), f(({ camera: e, size: t }) => {
500
500
  let n = s.current;
501
- n && tt(n, c, e, t.height);
502
- }), /* @__PURE__ */ R("sprite", {
501
+ n && rt(n, c, e, t.height);
502
+ }), /* @__PURE__ */ F("sprite", {
503
503
  ref: s,
504
504
  position: n,
505
505
  renderOrder: 2,
506
- children: /* @__PURE__ */ R("spriteMaterial", {
506
+ children: /* @__PURE__ */ F("spriteMaterial", {
507
507
  alphaTest: .1,
508
508
  depthTest: !0,
509
509
  depthWrite: !1,
@@ -514,8 +514,8 @@ function mt({ color: e, fontSize: t, position: n, text: r }) {
514
514
  })
515
515
  });
516
516
  }
517
- function ht({ cameraPosition: e, color: t, floorY: n, fontSize: r, labelOffset: i, line: a, showBottom: s, showLeft: l, showRight: u, showTop: d }) {
518
- let f = c(() => new y().setFromPoints(a.points), [a.points]), p = ut({
517
+ function _t({ cameraPosition: e, color: t, floorY: n, fontSize: r, labelOffset: i, line: a, showBottom: s, showLeft: l, showRight: u, showTop: d }) {
518
+ let f = c(() => new y().setFromPoints(a.points), [a.points]), p = ft({
519
519
  cameraPosition: e,
520
520
  floorY: n,
521
521
  line: a,
@@ -523,19 +523,19 @@ function ht({ cameraPosition: e, color: t, floorY: n, fontSize: r, labelOffset:
523
523
  showLeft: l,
524
524
  showRight: u,
525
525
  showTop: d
526
- }), m = p ? dt({
526
+ }), m = p ? pt({
527
527
  endpoint: p,
528
528
  labelOffset: i,
529
529
  line: a
530
530
  }) : null;
531
- return o(() => () => f.dispose(), [f]), /* @__PURE__ */ z("lineSegments", {
531
+ return o(() => () => f.dispose(), [f]), /* @__PURE__ */ I("lineSegments", {
532
532
  geometry: f,
533
- position: it(a.loc, n),
534
- children: [/* @__PURE__ */ R("lineBasicMaterial", {
533
+ position: ot(a.loc, n),
534
+ children: [/* @__PURE__ */ F("lineBasicMaterial", {
535
535
  color: t,
536
536
  depthWrite: !1,
537
537
  linewidth: 2
538
- }), m && /* @__PURE__ */ R(mt, {
538
+ }), m && /* @__PURE__ */ F(gt, {
539
539
  color: t,
540
540
  fontSize: r,
541
541
  position: m,
@@ -543,8 +543,8 @@ function ht({ cameraPosition: e, color: t, floorY: n, fontSize: r, labelOffset:
543
543
  })]
544
544
  });
545
545
  }
546
- function gt({ color: e, floorY: t, fontSize: n = Ge, grids: r, labelOffset: i = qe, showBottom: a = !0, showLeft: o = !0, showRight: s = !0, showTop: d = !0, visible: m = !0 }) {
547
- let h = p((e) => e.camera), g = l(null), [_, v] = u(() => new L()), y = ot(e), b = c(() => r ? ct({
546
+ function vt({ color: e, floorY: t, fontSize: n = qe, grids: r, labelOffset: i = Ye, showBottom: a = !0, showLeft: o = !0, showRight: s = !0, showTop: d = !0, visible: m = !0 }) {
547
+ let h = p((e) => e.camera), g = l(null), [_, v] = u(() => new P()), y = ct(e), b = c(() => r ? ut({
548
548
  flattenToFloor: t !== void 0,
549
549
  grids: r,
550
550
  showBottom: a,
@@ -558,7 +558,7 @@ function gt({ color: e, floorY: t, fontSize: n = Ge, grids: r, labelOffset: i =
558
558
  o,
559
559
  s,
560
560
  d
561
- ]), x = c(() => ft(b, t), [t, b]), S = c(() => Math.max(i, pt(b, x, t) * .015), [
561
+ ]), x = c(() => mt(b, t), [t, b]), S = c(() => Math.max(i, ht(b, x, t) * .015), [
562
562
  x,
563
563
  t,
564
564
  i,
@@ -568,11 +568,11 @@ function gt({ color: e, floorY: t, fontSize: n = Ge, grids: r, labelOffset: i =
568
568
  let e = g.current;
569
569
  if (!e) return;
570
570
  let t = h.position.clone();
571
- e.worldToLocal(t), !(t.distanceToSquared(_) < Je) && v(t);
572
- }), !m || !b.length ? null : /* @__PURE__ */ R("group", {
571
+ e.worldToLocal(t), !(t.distanceToSquared(_) < Xe) && v(t);
572
+ }), !m || !b.length ? null : /* @__PURE__ */ F("group", {
573
573
  ref: g,
574
574
  userData: { modelGrids: !0 },
575
- children: b.map((e) => /* @__PURE__ */ R(ht, {
575
+ children: b.map((e) => /* @__PURE__ */ F(_t, {
576
576
  cameraPosition: _,
577
577
  color: y,
578
578
  floorY: t,
@@ -587,9 +587,9 @@ function gt({ color: e, floorY: t, fontSize: n = Ge, grids: r, labelOffset: i =
587
587
  e.startSide,
588
588
  e.endSide,
589
589
  e.name,
590
- V(e.loc, "x"),
591
- t ?? V(e.loc, "y"),
592
- V(e.loc, "z"),
590
+ z(e.loc, "x"),
591
+ t ?? z(e.loc, "y"),
592
+ z(e.loc, "z"),
593
593
  e.points[0].x,
594
594
  e.points[0].y,
595
595
  e.points[0].z,
@@ -601,33 +601,33 @@ function gt({ color: e, floorY: t, fontSize: n = Ge, grids: r, labelOffset: i =
601
601
  }
602
602
  //#endregion
603
603
  //#region src/viewer/Model.tsx
604
- var _t = new N();
605
- function vt(e) {
604
+ var yt = new j();
605
+ function bt(e) {
606
606
  if (!e) return null;
607
607
  try {
608
608
  let t = JSON.parse(e);
609
- return !Array.isArray(t) || t.length !== 16 ? null : new N().fromArray(t);
609
+ return !Array.isArray(t) || t.length !== 16 ? null : new j().fromArray(t);
610
610
  } catch (e) {
611
611
  return console.warn("Model matrix parsing error", e), null;
612
612
  }
613
613
  }
614
- function yt(e) {
615
- return vt(bt(e));
614
+ function xt(e) {
615
+ return bt(St(e));
616
616
  }
617
- function bt(e) {
617
+ function St(e) {
618
618
  return e.coordinationMatrix ?? Object.values(e.data)[0]?.matrix;
619
619
  }
620
- function xt({ colorPaletteTexture: e, coordinationMatrix: t, modelID: n, data: r }) {
621
- let i = B((e) => e.gridAxesVisibility), a = c(() => {
620
+ function Ct({ colorPaletteTexture: e, coordinationMatrix: t, modelID: n, data: r }) {
621
+ let i = L((e) => e.gridAxesVisibility), a = c(() => {
622
622
  if (!r) return {
623
623
  data: [],
624
624
  coordinationMatrix: null,
625
625
  floorY: 0
626
626
  };
627
- let e = Object.values(r.data).some((e) => !!e.matrix) ? t?.clone() ?? yt(r) : null, i = Infinity, a = new L();
627
+ let e = Object.values(r.data).some((e) => !!e.matrix) ? t?.clone() ?? xt(r) : null, i = Infinity, a = new P();
628
628
  return {
629
629
  data: Object.values(r.data).map((e) => {
630
- let t = (vt(e.matrix) ?? new N()).clone().invert(), r = e.mat, o = e.pos;
630
+ let t = (bt(e.matrix) ?? new j()).clone().invert(), r = e.mat, o = e.pos;
631
631
  for (let e = 0; e < o.length; e += 3) a.set(o[e], o[e + 1], o[e + 2]).applyMatrix4(t), Number.isFinite(a.y) && (i = Math.min(i, a.y));
632
632
  return {
633
633
  data: e,
@@ -645,17 +645,17 @@ function xt({ colorPaletteTexture: e, coordinationMatrix: t, modelID: n, data: r
645
645
  r,
646
646
  n
647
647
  ]);
648
- return r ? /* @__PURE__ */ z("group", {
649
- matrix: a.coordinationMatrix ?? _t,
648
+ return r ? /* @__PURE__ */ I("group", {
649
+ matrix: a.coordinationMatrix ?? yt,
650
650
  matrixAutoUpdate: !1,
651
651
  userData: { modelID: n },
652
- children: [a.data.map(({ data: t, isIfcSpace: n, key: r, material: i, meshMatrix: a }) => /* @__PURE__ */ R(We, {
652
+ children: [a.data.map(({ data: t, isIfcSpace: n, key: r, material: i, meshMatrix: a }) => /* @__PURE__ */ F(Ke, {
653
653
  colorPaletteTexture: e,
654
654
  material: i,
655
655
  data: t,
656
656
  isIfcSpace: n,
657
657
  meshMatrix: a
658
- }, r)), /* @__PURE__ */ R(gt, {
658
+ }, r)), /* @__PURE__ */ F(vt, {
659
659
  floorY: a.floorY,
660
660
  grids: r.grids,
661
661
  showBottom: i.bottom,
@@ -664,12 +664,12 @@ function xt({ colorPaletteTexture: e, coordinationMatrix: t, modelID: n, data: r
664
664
  showTop: i.top,
665
665
  visible: i.visible
666
666
  })]
667
- }) : /* @__PURE__ */ R(Se, {});
667
+ }) : /* @__PURE__ */ F(Te, {});
668
668
  }
669
- var St = r(xt);
669
+ var wt = r(Ct);
670
670
  //#endregion
671
671
  //#region src/viewer/utils/GeometryUtils/useGeometryIndex.ts
672
- function Ct() {
672
+ function Tt() {
673
673
  return {
674
674
  elementIndex: /* @__PURE__ */ new Map(),
675
675
  ifcSpacesVisible: !0,
@@ -679,10 +679,10 @@ function Ct() {
679
679
  records: /* @__PURE__ */ new Set()
680
680
  };
681
681
  }
682
- function wt(e) {
682
+ function Et(e) {
683
683
  return e instanceof Uint16Array || e instanceof Uint32Array ? e : e.length > 65535 ? new Uint32Array(e) : new Uint16Array(e);
684
684
  }
685
- function Tt(e, t, n, r) {
685
+ function Dt(e, t, n, r) {
686
686
  let i = n.get(e);
687
687
  if (i) return i;
688
688
  i = {
@@ -692,20 +692,20 @@ function Tt(e, t, n, r) {
692
692
  let a = r.get(e);
693
693
  return a || (a = [], r.set(e, a)), a.push(i), i;
694
694
  }
695
- function Et(e, t, n, r, i, a) {
696
- n && Tt(e, r, i, a).vertexRanges.push({
695
+ function Ot(e, t, n, r, i, a) {
696
+ n && Dt(e, r, i, a).vertexRanges.push({
697
697
  count: n,
698
698
  start: t
699
699
  });
700
700
  }
701
- function Dt(e, t, n, r, i, a) {
702
- n && (Tt(e, r, i, a), r.triangleRanges.push({
701
+ function kt(e, t, n, r, i, a) {
702
+ n && (Dt(e, r, i, a), r.triangleRanges.push({
703
703
  count: n,
704
704
  id: e,
705
705
  start: t
706
706
  }));
707
707
  }
708
- function Ot(e) {
708
+ function At(e) {
709
709
  let t = e;
710
710
  for (; t;) {
711
711
  let e = t.userData.modelID;
@@ -714,22 +714,22 @@ function Ot(e) {
714
714
  }
715
715
  return 0;
716
716
  }
717
- function kt(e) {
717
+ function jt(e) {
718
718
  return e.name === "space" || e.userData.isIfcSpace === !0;
719
719
  }
720
- function At(e) {
721
- let t = l(Ct()), n = i(() => {
720
+ function Mt(e) {
721
+ let t = l(Tt()), n = i(() => {
722
722
  let n = e.current, r = t.current;
723
723
  if (!n || r.indexedModel === n && r.records.size) return r;
724
724
  let i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Set();
725
725
  return n.traverse((e) => {
726
- if (!(e instanceof P)) return;
726
+ if (!(e instanceof M)) return;
727
727
  let t = e, n = t.geometry, r = n.index, o = n.attributes.ids;
728
728
  if (!r || !o) return;
729
- let s = Ot(t), c = wt(r.array), l = {
729
+ let s = At(t), c = Et(r.array), l = {
730
730
  hiddenIds: /* @__PURE__ */ new Set(),
731
731
  initialVisible: t.visible,
732
- isIfcSpace: kt(t),
732
+ isIfcSpace: jt(t),
733
733
  mesh: t,
734
734
  modelID: s,
735
735
  originalBoundsTree: n.boundsTree ?? null,
@@ -739,15 +739,15 @@ function At(e) {
739
739
  }, u = /* @__PURE__ */ new Map(), d = null, f = 0, p = c.length / 3;
740
740
  for (let e = 0; e < p; e++) {
741
741
  let t = o.getX(c[e * 3]);
742
- d === null ? (d = t, f = e) : t !== d && (Dt(d, f, e - f, l, u, i), d = t, f = e);
742
+ d === null ? (d = t, f = e) : t !== d && (kt(d, f, e - f, l, u, i), d = t, f = e);
743
743
  }
744
- d !== null && Dt(d, f, p - f, l, u, i);
744
+ d !== null && kt(d, f, p - f, l, u, i);
745
745
  let m = null, h = 0;
746
746
  for (let e = 0; e < o.count; e++) {
747
747
  let t = o.getX(e);
748
- m === null ? (m = t, h = e) : t !== m && (Et(m, h, e - h, l, u, i), m = t, h = e);
748
+ m === null ? (m = t, h = e) : t !== m && (Ot(m, h, e - h, l, u, i), m = t, h = e);
749
749
  }
750
- m !== null && Et(m, h, o.count - h, l, u, i), a.add(l);
750
+ m !== null && Ot(m, h, o.count - h, l, u, i), a.add(l);
751
751
  }), t.current = {
752
752
  elementIndex: i,
753
753
  ifcSpacesVisible: r.ifcSpacesVisible,
@@ -757,7 +757,7 @@ function At(e) {
757
757
  records: a
758
758
  }, t.current;
759
759
  }, [e]), r = i(() => {
760
- t.current = Ct();
760
+ t.current = Tt();
761
761
  }, []);
762
762
  return c(() => ({
763
763
  buildIndex: n,
@@ -766,95 +766,95 @@ function At(e) {
766
766
  }
767
767
  //#endregion
768
768
  //#region src/viewer/utils/GeometryUtils/useGeometryUtils.ts
769
- function jt(e, t) {
769
+ function Nt(e, t) {
770
770
  return e instanceof Uint32Array ? new Uint32Array(t) : new Uint16Array(t);
771
771
  }
772
- function Mt(e) {
772
+ function Pt(e) {
773
773
  let t = e.geometry;
774
- Object.assign(t, { boundsTree: void 0 }), e.geometry.index?.count && Object.assign(t, { boundsTree: new ye(e.geometry, { indirect: !0 }) });
774
+ Object.assign(t, { boundsTree: void 0 }), e.geometry.index?.count && Object.assign(t, { boundsTree: new Se(e.geometry, { indirect: !0 }) });
775
775
  }
776
- function Nt(e, t, n = !0) {
777
- e.mesh.geometry.setIndex(new v(t, 1)), n && Mt(e.mesh);
776
+ function Ft(e, t, n = !0) {
777
+ e.mesh.geometry.setIndex(new v(t, 1)), n && Pt(e.mesh);
778
778
  }
779
- function Pt(e, t) {
779
+ function It(e, t) {
780
780
  return e.initialVisible && (!e.isIfcSpace || t);
781
781
  }
782
- function Ft(e, t) {
782
+ function Lt(e, t) {
783
783
  let n = e.mesh.geometry, r = n.index?.array;
784
- e.mesh.visible = Pt(e, t), r !== e.originalIndex && Nt(e, e.originalIndex, !1), e.originalBoundsTree ? Object.assign(n, { boundsTree: e.originalBoundsTree }) : (Mt(e.mesh), e.originalBoundsTree = e.mesh.geometry.boundsTree ?? null);
784
+ e.mesh.visible = It(e, t), r !== e.originalIndex && Ft(e, e.originalIndex, !1), e.originalBoundsTree ? Object.assign(n, { boundsTree: e.originalBoundsTree }) : (Pt(e.mesh), e.originalBoundsTree = e.mesh.geometry.boundsTree ?? null);
785
785
  }
786
- function It(e) {
786
+ function Rt(e) {
787
787
  return e === null ? "*" : e.size ? Array.from(e).sort((e, t) => e - t).join(",") : "";
788
788
  }
789
- function Lt(e, t, n, r) {
790
- return `h:${It(e)}|i:${It(n)}|s:${r ? Number(t) : ""}`;
789
+ function zt(e, t, n, r) {
790
+ return `h:${Rt(e)}|i:${Rt(n)}|s:${r ? Number(t) : ""}`;
791
791
  }
792
- function Rt(e, t, n) {
792
+ function Bt(e, t, n) {
793
793
  return !t.has(e) && (!n || n.has(e));
794
794
  }
795
- function zt(e, t) {
795
+ function Vt(e, t) {
796
796
  Object.entries(e).forEach(([e, n]) => {
797
797
  n.forEach((n) => t(Number(e), n));
798
798
  });
799
799
  }
800
- function Bt(e, t, n) {
800
+ function Ht(e, t, n) {
801
801
  e.hiddenIds.has(t) || (e.hiddenIds.add(t), n.add(e));
802
802
  }
803
- function H(e, t, n) {
803
+ function B(e, t, n) {
804
804
  e && console.log(`${t}:`, Date.now() - n, "ms");
805
805
  }
806
- function U(e, t, n, r) {
807
- let { hiddenIds: i, originalIndex: a, triangleRanges: o } = e, s = Lt(i, t, n, e.isIfcSpace);
806
+ function V(e, t, n, r) {
807
+ let { hiddenIds: i, originalIndex: a, triangleRanges: o } = e, s = zt(i, t, n, e.isIfcSpace);
808
808
  if (e.visibleStateKey === s) return;
809
809
  if (!i.size && !n) {
810
- Ft(e, t), e.visibleStateKey = s;
810
+ Lt(e, t), e.visibleStateKey = s;
811
811
  return;
812
812
  }
813
813
  let c = 0, l = 0;
814
814
  if (o.forEach(({ count: e, id: t }) => {
815
- Rt(t, i, n) ? c += e * 3 : l += e * 3;
815
+ Bt(t, i, n) ? c += e * 3 : l += e * 3;
816
816
  }), !c) {
817
- Ft(e, t), e.mesh.visible = !1, e.visibleStateKey = s;
817
+ Lt(e, t), e.mesh.visible = !1, e.visibleStateKey = s;
818
818
  return;
819
819
  }
820
820
  if (!l) {
821
- Ft(e, t), e.visibleStateKey = s;
821
+ Lt(e, t), e.visibleStateKey = s;
822
822
  return;
823
823
  }
824
- e.mesh.visible = Pt(e, t);
825
- let u = jt(a, c), d = 0;
824
+ e.mesh.visible = It(e, t);
825
+ let u = Nt(a, c), d = 0;
826
826
  for (let e = 0; e < o.length; e++) {
827
827
  let { count: t, id: r, start: s } = o[e];
828
- if (!Rt(r, i, n)) continue;
828
+ if (!Bt(r, i, n)) continue;
829
829
  let c = s * 3, l = c + t * 3;
830
830
  u.set(a.subarray(c, l), d), d += t * 3;
831
831
  }
832
- r || (e.originalBoundsTree = null), Nt(e, u), e.visibleStateKey = s;
832
+ r || (e.originalBoundsTree = null), Ft(e, u), e.visibleStateKey = s;
833
833
  }
834
- function W(e, t) {
834
+ function H(e, t) {
835
835
  return e.isolatedIdsByModel ? e.isolatedIdsByModel.get(t.modelID) ?? /* @__PURE__ */ new Set() : e.isolatedIds;
836
836
  }
837
- function Vt(e) {
838
- let t = B((e) => e.selected), n = B((e) => e.resetSelected), r = B((e) => e.showStats), a = B((e) => e.userDevice) === "pc", o = e.buildIndex, s = i(() => Array.from(o().elementIndex.keys()), [o]), c = i(() => o().ifcSpacesVisible, [o]), l = i((e) => {
837
+ function Ut(e) {
838
+ let t = L((e) => e.selected), n = L((e) => e.resetSelected), r = L((e) => e.showStats), a = L((e) => e.userDevice) === "pc", o = e.buildIndex, s = i(() => Array.from(o().elementIndex.keys()), [o]), c = i(() => o().ifcSpacesVisible, [o]), l = i((e) => {
839
839
  let t = Date.now(), n = o(), i = /* @__PURE__ */ new Set();
840
840
  e.forEach((e) => {
841
841
  let t = n.elementIndex.get(e);
842
842
  t && t.forEach(({ record: t }) => {
843
- Bt(t, e, i);
843
+ Ht(t, e, i);
844
844
  });
845
- }), i.forEach((e) => U(e, n.ifcSpacesVisible, W(n, e), a)), H(r, "hideByIds", t);
845
+ }), i.forEach((e) => V(e, n.ifcSpacesVisible, H(n, e), a)), B(r, "hideByIds", t);
846
846
  }, [
847
847
  o,
848
848
  a,
849
849
  r
850
850
  ]), u = i(() => {
851
851
  let e = Date.now(), i = o(), s = /* @__PURE__ */ new Set();
852
- zt(t, (e, t) => {
852
+ Vt(t, (e, t) => {
853
853
  let n = i.elementIndex.get(t);
854
854
  n && n.forEach(({ record: n }) => {
855
- n.modelID === e && Bt(n, t, s);
855
+ n.modelID === e && Ht(n, t, s);
856
856
  });
857
- }), s.forEach((e) => U(e, i.ifcSpacesVisible, W(i, e), a)), n(), H(r, "hideSelected", e);
857
+ }), s.forEach((e) => V(e, i.ifcSpacesVisible, H(i, e), a)), n(), B(r, "hideSelected", e);
858
858
  }, [
859
859
  o,
860
860
  a,
@@ -868,24 +868,24 @@ function Vt(e) {
868
868
  t && t.forEach(({ record: t }) => {
869
869
  t.hiddenIds.delete(e) && i.add(t);
870
870
  });
871
- }), i.forEach((e) => U(e, n.ifcSpacesVisible, W(n, e), a)), H(r, "showByIds", t);
871
+ }), i.forEach((e) => V(e, n.ifcSpacesVisible, H(n, e), a)), B(r, "showByIds", t);
872
872
  }, [
873
873
  o,
874
874
  a,
875
875
  r
876
876
  ]), f = i((e) => {
877
877
  let t = Date.now(), n = o();
878
- n.isolatedIdsByModel = null, n.isolatedIds = new Set(e), n.records.forEach((e) => U(e, n.ifcSpacesVisible, W(n, e), a)), H(r, "isolateByIds", t);
878
+ n.isolatedIdsByModel = null, n.isolatedIds = new Set(e), n.records.forEach((e) => V(e, n.ifcSpacesVisible, H(n, e), a)), B(r, "isolateByIds", t);
879
879
  }, [
880
880
  o,
881
881
  a,
882
882
  r
883
883
  ]), p = i(() => {
884
884
  let e = Date.now(), n = o(), i = /* @__PURE__ */ new Map();
885
- zt(t, (e, t) => {
885
+ Vt(t, (e, t) => {
886
886
  let n = i.get(e);
887
887
  n || (n = /* @__PURE__ */ new Set(), i.set(e, n)), n.add(t);
888
- }), n.isolatedIdsByModel = i, n.isolatedIds = null, n.records.forEach((e) => U(e, n.ifcSpacesVisible, W(n, e), a)), H(r, "isolateSelected", e);
888
+ }), n.isolatedIdsByModel = i, n.isolatedIds = null, n.records.forEach((e) => V(e, n.ifcSpacesVisible, H(n, e), a)), B(r, "isolateSelected", e);
889
889
  }, [
890
890
  o,
891
891
  a,
@@ -893,7 +893,7 @@ function Vt(e) {
893
893
  r
894
894
  ]), m = i(() => {
895
895
  let e = Date.now(), t = o();
896
- t.isolatedIdsByModel = null, t.isolatedIds = null, t.records.forEach((e) => U(e, t.ifcSpacesVisible, W(t, e), a)), H(r, "resetIsolation", e);
896
+ t.isolatedIdsByModel = null, t.isolatedIds = null, t.records.forEach((e) => V(e, t.ifcSpacesVisible, H(t, e), a)), B(r, "resetIsolation", e);
897
897
  }, [
898
898
  o,
899
899
  a,
@@ -901,7 +901,7 @@ function Vt(e) {
901
901
  ]), h = i((e) => {
902
902
  let t = o();
903
903
  t.ifcSpacesVisible !== e && (t.ifcSpacesVisible = e, t.records.forEach((e) => {
904
- e.isIfcSpace && U(e, t.ifcSpacesVisible, W(t, e), a);
904
+ e.isIfcSpace && V(e, t.ifcSpacesVisible, H(t, e), a);
905
905
  }));
906
906
  }, [o, a]), g = i(() => {
907
907
  h(!c());
@@ -919,8 +919,8 @@ function Vt(e) {
919
919
  showAll: i(() => {
920
920
  let e = Date.now(), t = o();
921
921
  t.isolatedIdsByModel = null, t.isolatedIds = null, t.records.forEach((e) => {
922
- e.hiddenIds.clear(), U(e, t.ifcSpacesVisible, W(t, e), a);
923
- }), H(r, "showAll", e);
922
+ e.hiddenIds.clear(), V(e, t.ifcSpacesVisible, H(t, e), a);
923
+ }), B(r, "showAll", e);
924
924
  }, [
925
925
  o,
926
926
  a,
@@ -932,49 +932,49 @@ function Vt(e) {
932
932
  }
933
933
  //#endregion
934
934
  //#region src/viewer/utils/ClippingUtils/ClippingEdges.ts
935
- var Ht = 1024, Ut = -1e-5;
936
- function Wt(e) {
935
+ var Wt = 1024, Gt = -1e-5;
936
+ function Kt(e) {
937
937
  let t = new v(new Float32Array(e * 3), 3, !1);
938
938
  return t.setUsage(T), t;
939
939
  }
940
- function Gt(e) {
940
+ function qt(e) {
941
941
  return Math.max(1, Math.ceil((e.geometry.index?.count ?? 0) / 3));
942
942
  }
943
- function Kt(e, t) {
944
- let n = new y(), r = Math.ceil(Math.min(Math.max(Ht, Gt(t) * .05), 32768));
945
- n.setAttribute("position", Wt(r)), n.setDrawRange(0, 0);
946
- let i = new j(n, e);
943
+ function Jt(e, t) {
944
+ let n = new y(), r = Math.ceil(Math.min(Math.max(Wt, qt(t) * .05), 32768));
945
+ n.setAttribute("position", Kt(r)), n.setDrawRange(0, 0);
946
+ let i = new ne(n, e);
947
947
  return i.frustumCulled = !1, i.renderOrder = 1, i.visible = !1, i;
948
948
  }
949
- function qt(e, t) {
949
+ function Yt(e, t) {
950
950
  let n = e.geometry.getAttribute("position");
951
951
  if (n.count > t) return n;
952
- let r = Wt(Math.max(n.count * 2, t + 1));
952
+ let r = Kt(Math.max(n.count * 2, t + 1));
953
953
  return r.array.set(n.array), e.geometry.setAttribute("position", r), n = r, n;
954
954
  }
955
- function Jt(e) {
955
+ function Xt(e) {
956
956
  return e.filter((e) => e.parent && e.geometry.index?.count);
957
957
  }
958
- var Yt = class {
958
+ var Zt = class {
959
959
  active;
960
960
  material;
961
961
  plane;
962
962
  context;
963
963
  lines = /* @__PURE__ */ new Map();
964
- inverseMatrix = new N();
965
- localPlane = new se();
966
- tempLine = new k();
967
- tempVector = new L();
968
- tempVector1 = new L();
969
- tempVector2 = new L();
970
- tempVector3 = new L();
964
+ inverseMatrix = new j();
965
+ localPlane = new ue();
966
+ tempLine = new O();
967
+ tempVector = new P();
968
+ tempVector1 = new P();
969
+ tempVector2 = new P();
970
+ tempVector3 = new P();
971
971
  constructor(e, t) {
972
972
  this.context = e, this.plane = t, this.active = e.getActive() && e.getEdgesActive(), e.edges.forEach((e) => {
973
973
  let n = e.material.clippingPlanes ?? [];
974
974
  e.plane === t || n.includes(t) || (e.material.clippingPlanes = [...n, t], e.material.needsUpdate = !0);
975
975
  });
976
976
  let n = e.planes.filter((e) => e !== t);
977
- this.material = new ee({
977
+ this.material = new te({
978
978
  clippingPlanes: n,
979
979
  color: "black",
980
980
  depthTest: !0,
@@ -985,12 +985,12 @@ var Yt = class {
985
985
  return this.syncMeshes(), Array.from(this.lines.values());
986
986
  }
987
987
  syncMeshes() {
988
- let e = new Set(Jt(this.context.getMeshes()));
988
+ let e = new Set(Xt(this.context.getMeshes()));
989
989
  this.lines.forEach((t, n) => {
990
990
  e.has(n) || (t.removeFromParent(), t.geometry.dispose(), this.lines.delete(n));
991
991
  }), e.forEach((e) => {
992
992
  if (this.lines.has(e)) return;
993
- let t = Kt(this.material, e);
993
+ let t = Jt(this.material, e);
994
994
  e.add(t), this.lines.set(e, t);
995
995
  }), this.setVisible(this.active);
996
996
  }
@@ -1016,7 +1016,7 @@ var Yt = class {
1016
1016
  }
1017
1017
  t.updateWorldMatrix(!0, !1), this.inverseMatrix.copy(t.matrixWorld).invert(), this.localPlane.copy(this.plane).applyMatrix4(this.inverseMatrix);
1018
1018
  let r = 0, i = e.geometry.getAttribute("position"), a = (t) => {
1019
- i = qt(e, r), i.setXYZ(r, t.x, t.y, t.z), r++;
1019
+ i = Yt(e, r), i.setXYZ(r, t.x, t.y, t.z), r++;
1020
1020
  };
1021
1021
  n.shapecast({
1022
1022
  intersectsBounds: (e) => this.localPlane.intersectsBox(e),
@@ -1024,19 +1024,19 @@ var Yt = class {
1024
1024
  let t = 0;
1025
1025
  this.tempLine.start.copy(e.a), this.tempLine.end.copy(e.b), this.localPlane.intersectLine(this.tempLine, this.tempVector) && (a(this.tempVector), t++), this.tempLine.start.copy(e.b), this.tempLine.end.copy(e.c), this.localPlane.intersectLine(this.tempLine, this.tempVector) && (a(this.tempVector), t++), this.tempLine.start.copy(e.c), this.tempLine.end.copy(e.a), this.localPlane.intersectLine(this.tempLine, this.tempVector) && (a(this.tempVector), t++), t === 3 && (this.tempVector1.fromBufferAttribute(i, r - 3), this.tempVector2.fromBufferAttribute(i, r - 2), this.tempVector3.fromBufferAttribute(i, r - 1), this.tempVector3.equals(this.tempVector1) || this.tempVector3.equals(this.tempVector2) ? (t--, r--) : this.tempVector1.equals(this.tempVector2) && (i.setXYZ(r - 2, this.tempVector3.x, this.tempVector3.y, this.tempVector3.z), t--, r--)), t !== 2 && (r -= t);
1026
1026
  }
1027
- }), e.geometry.setDrawRange(0, r), e.position.copy(this.localPlane.normal).multiplyScalar(Ut), i.needsUpdate = !0;
1027
+ }), e.geometry.setDrawRange(0, r), e.position.copy(this.localPlane.normal).multiplyScalar(Gt), i.needsUpdate = !0;
1028
1028
  }));
1029
1029
  }
1030
- }, Xt = "#0b2f5f", Zt = "#0b2f5f", Qt = 0, $t = "#1f7ae0", en = .22, tn = .01, nn = .025, rn = .015, an = .25, on = .15, sn = .25, G = 1;
1031
- function cn(e, t) {
1030
+ }, Qt = "#0b2f5f", $t = "#0b2f5f", en = 0, tn = "#1f7ae0", nn = .22, rn = .01, an = .025, on = .015, sn = .25, cn = .15, ln = .25, U = 1;
1031
+ function un(e, t) {
1032
1032
  let n = t.getBoundingClientRect();
1033
- return new I((e.clientX - n.left) / n.width * 2 - 1, -((e.clientY - n.top) / n.height) * 2 + 1);
1033
+ return new N((e.clientX - n.left) / n.width * 2 - 1, -((e.clientY - n.top) / n.height) * 2 + 1);
1034
1034
  }
1035
- function ln(e) {
1036
- let t = e.getSize(new L());
1037
- return Math.max(sn, t.length() * tn);
1035
+ function dn(e) {
1036
+ let t = e.getSize(new P());
1037
+ return Math.max(ln, t.length() * rn);
1038
1038
  }
1039
- var un = class extends ie {
1039
+ var fn = class extends se {
1040
1040
  helper = new D();
1041
1041
  borderMaterial;
1042
1042
  material;
@@ -1047,22 +1047,22 @@ var un = class extends ie {
1047
1047
  location;
1048
1048
  normal;
1049
1049
  planeMesh;
1050
- pointer = new I();
1050
+ pointer = new N();
1051
1051
  layout;
1052
1052
  dragState = null;
1053
1053
  hovered = !1;
1054
1054
  listenersActive = !1;
1055
1055
  constructor(e, t, n, r) {
1056
- super(), this.context = e, this.plane = t, this.location = n.clone(), this.normal = r.clone().normalize(), this.material = new F({
1057
- color: Zt,
1056
+ super(), this.context = e, this.plane = t, this.location = n.clone(), this.normal = r.clone().normalize(), this.material = new ie({
1057
+ color: $t,
1058
1058
  depthWrite: !1,
1059
- opacity: Qt,
1059
+ opacity: en,
1060
1060
  side: w,
1061
1061
  transparent: !0
1062
1062
  }), this.helper.position.copy(this.location), this.applyPlaneOrientation(), this.layout = this.getHelperLayout();
1063
- let i = Math.max(an, Math.min(this.layout.width, this.layout.height) * nn), a = Math.max(on, Math.min(this.layout.width, this.layout.height) * rn);
1064
- this.borderMaterial = new A({
1065
- color: Xt,
1063
+ let i = Math.max(sn, Math.min(this.layout.width, this.layout.height) * an), a = Math.max(cn, Math.min(this.layout.width, this.layout.height) * on);
1064
+ this.borderMaterial = new k({
1065
+ color: Qt,
1066
1066
  dashSize: i,
1067
1067
  depthWrite: !1,
1068
1068
  gapSize: a
@@ -1093,7 +1093,7 @@ var un = class extends ie {
1093
1093
  }
1094
1094
  updateBorderDash() {
1095
1095
  let e = Math.min(this.layout.width, this.layout.height);
1096
- this.borderMaterial.dashSize = Math.max(an, e * nn), this.borderMaterial.gapSize = Math.max(on, e * rn), this.borderMaterial.needsUpdate = !0;
1096
+ this.borderMaterial.dashSize = Math.max(sn, e * an), this.borderMaterial.gapSize = Math.max(cn, e * on), this.borderMaterial.needsUpdate = !0;
1097
1097
  }
1098
1098
  addEventListeners() {
1099
1099
  if (this.listenersActive) return;
@@ -1128,15 +1128,15 @@ var un = class extends ie {
1128
1128
  hasModelIntersection(e) {
1129
1129
  return !!this.context.getCameraUtils().getIntersection(!0, {
1130
1130
  event: e,
1131
- filter: (e) => !(e.object instanceof P) || e.faceIndex === void 0 || e.faceIndex === null ? !1 : !!(e.object.geometry.index && e.object.geometry.attributes.ids),
1131
+ filter: (e) => !(e.object instanceof M) || e.faceIndex === void 0 || e.faceIndex === null ? !1 : !!(e.object.geometry.index && e.object.geometry.attributes.ids),
1132
1132
  object: this.context.getMeshes(),
1133
1133
  recursive: !1
1134
1134
  });
1135
1135
  }
1136
1136
  getPointerPointOnPlane(e, t) {
1137
1137
  let n = this.context.getDomElement();
1138
- this.pointer.copy(cn(e, n));
1139
- let r = this.context.getRaycaster(), i = new L();
1138
+ this.pointer.copy(un(e, n));
1139
+ let r = this.context.getRaycaster(), i = new P();
1140
1140
  return r.setFromCamera(this.pointer, this.context.getCamera()), r.ray.intersectPlane(t, i);
1141
1141
  }
1142
1142
  onPointerDown = (e) => {
@@ -1148,9 +1148,9 @@ var un = class extends ie {
1148
1148
  let t = this.getPointerIntersection(e);
1149
1149
  if (!t) return;
1150
1150
  e.preventDefault(), e.stopPropagation(), e.stopImmediatePropagation(), this.context.clearHelpersHover(this), this.setHovered(!0), this.context.setHelperDragActive(!0), this.context.setSelectionInteractionDisabled(!0);
1151
- let n = new L();
1151
+ let n = new P();
1152
1152
  this.context.getCamera().getWorldDirection(n), n.normalize();
1153
- let r = new se().setFromNormalAndCoplanarPoint(n, t.point);
1153
+ let r = new ue().setFromNormalAndCoplanarPoint(n, t.point);
1154
1154
  this.dragState = {
1155
1155
  dragPlane: r,
1156
1156
  helperStart: this.helper.position.clone(),
@@ -1192,14 +1192,14 @@ var un = class extends ie {
1192
1192
  this.hovered !== t && this.setHovered(t);
1193
1193
  }
1194
1194
  setHovered(e) {
1195
- this.hovered = e, this.material.color.set(e ? $t : Zt), this.material.opacity = e ? en : Qt, this.material.needsUpdate = !0;
1195
+ this.hovered = e, this.material.color.set(e ? tn : $t), this.material.opacity = e ? nn : en, this.material.needsUpdate = !0;
1196
1196
  }
1197
1197
  createPlaneMesh() {
1198
- let e = new P(new y(), this.material);
1198
+ let e = new M(new y(), this.material);
1199
1199
  return e.renderOrder = 2, e;
1200
1200
  }
1201
1201
  createBorder() {
1202
- let e = new j(new y(), this.borderMaterial);
1202
+ let e = new ne(new y(), this.borderMaterial);
1203
1203
  return e.renderOrder = 3, e;
1204
1204
  }
1205
1205
  replaceGeometry(e, t) {
@@ -1268,27 +1268,27 @@ var un = class extends ie {
1268
1268
  getHelperLayout() {
1269
1269
  let e = this.getModelWorldBox();
1270
1270
  if (!e || e.isEmpty()) return {
1271
- height: G,
1272
- maxU: G / 2,
1273
- maxV: G / 2,
1274
- minU: -G / 2,
1275
- minV: -G / 2,
1276
- width: G
1271
+ height: U,
1272
+ maxU: U / 2,
1273
+ maxV: U / 2,
1274
+ minU: -U / 2,
1275
+ minV: -U / 2,
1276
+ width: U
1277
1277
  };
1278
- let t = this.getPlaneBasis(), n = this.helper.position, r = this.getBoxCorners(e), i = new L(), a = new L(), o = Infinity, s = -Infinity, c = Infinity, l = -Infinity;
1278
+ let t = this.getPlaneBasis(), n = this.helper.position, r = this.getBoxCorners(e), i = new P(), a = new P(), o = Infinity, s = -Infinity, c = Infinity, l = -Infinity;
1279
1279
  if (r.forEach((e) => {
1280
1280
  this.plane.projectPoint(e, i), a.copy(i).sub(n);
1281
1281
  let r = a.dot(t.u), u = a.dot(t.v);
1282
1282
  o = Math.min(o, r), s = Math.max(s, r), c = Math.min(c, u), l = Math.max(l, u);
1283
1283
  }), !Number.isFinite(o) || !Number.isFinite(s) || !Number.isFinite(c) || !Number.isFinite(l)) return {
1284
- height: G,
1285
- maxU: G / 2,
1286
- maxV: G / 2,
1287
- minU: -G / 2,
1288
- minV: -G / 2,
1289
- width: G
1284
+ height: U,
1285
+ maxU: U / 2,
1286
+ maxV: U / 2,
1287
+ minU: -U / 2,
1288
+ minV: -U / 2,
1289
+ width: U
1290
1290
  };
1291
- let u = ln(e), d = o - u, f = s + u, p = c - u, m = l + u, h = Math.max(G, f - d), g = Math.max(G, m - p), _ = (d + f) / 2, v = (p + m) / 2;
1291
+ let u = dn(e), d = o - u, f = s + u, p = c - u, m = l + u, h = Math.max(U, f - d), g = Math.max(U, m - p), _ = (d + f) / 2, v = (p + m) / 2;
1292
1292
  return {
1293
1293
  height: g,
1294
1294
  maxU: _ + h / 2,
@@ -1299,14 +1299,14 @@ var un = class extends ie {
1299
1299
  };
1300
1300
  }
1301
1301
  getPlaneBasis() {
1302
- let e = (Math.abs(this.normal.y) < .9 ? new L(0, 1, 0) : new L(1, 0, 0)).cross(this.normal).normalize();
1302
+ let e = (Math.abs(this.normal.y) < .9 ? new P(0, 1, 0) : new P(1, 0, 0)).cross(this.normal).normalize();
1303
1303
  return {
1304
1304
  u: e,
1305
1305
  v: this.normal.clone().cross(e).normalize()
1306
1306
  };
1307
1307
  }
1308
1308
  applyPlaneOrientation() {
1309
- let e = this.getPlaneBasis(), t = new N().makeBasis(e.u, e.v, this.normal);
1309
+ let e = this.getPlaneBasis(), t = new j().makeBasis(e.u, e.v, this.normal);
1310
1310
  this.helper.quaternion.setFromRotationMatrix(t);
1311
1311
  }
1312
1312
  getModelWorldBox() {
@@ -1319,20 +1319,20 @@ var un = class extends ie {
1319
1319
  }
1320
1320
  getBoxCorners(e) {
1321
1321
  return [
1322
- new L(e.min.x, e.min.y, e.min.z),
1323
- new L(e.min.x, e.min.y, e.max.z),
1324
- new L(e.min.x, e.max.y, e.min.z),
1325
- new L(e.min.x, e.max.y, e.max.z),
1326
- new L(e.max.x, e.min.y, e.min.z),
1327
- new L(e.max.x, e.min.y, e.max.z),
1328
- new L(e.max.x, e.max.y, e.min.z),
1329
- new L(e.max.x, e.max.y, e.max.z)
1322
+ new P(e.min.x, e.min.y, e.min.z),
1323
+ new P(e.min.x, e.min.y, e.max.z),
1324
+ new P(e.min.x, e.max.y, e.min.z),
1325
+ new P(e.min.x, e.max.y, e.max.z),
1326
+ new P(e.max.x, e.min.y, e.min.z),
1327
+ new P(e.max.x, e.min.y, e.max.z),
1328
+ new P(e.max.x, e.max.y, e.min.z),
1329
+ new P(e.max.x, e.max.y, e.max.z)
1330
1330
  ];
1331
1331
  }
1332
1332
  };
1333
1333
  //#endregion
1334
1334
  //#region src/viewer/utils/ClippingUtils/ClippingUtils.ts
1335
- function dn(e, t) {
1335
+ function pn(e, t) {
1336
1336
  if (Array.isArray(e)) {
1337
1337
  e.forEach((e) => {
1338
1338
  e.clippingPlanes = t, e.needsUpdate = !0;
@@ -1341,16 +1341,16 @@ function dn(e, t) {
1341
1341
  }
1342
1342
  e.clippingPlanes = t, e.needsUpdate = !0;
1343
1343
  }
1344
- function fn(e) {
1344
+ function mn(e) {
1345
1345
  let t = [];
1346
1346
  return e?.traverse((e) => {
1347
- e instanceof P && (!e.geometry.index || !e.geometry.attributes.ids || t.push(e));
1347
+ e instanceof M && (!e.geometry.index || !e.geometry.attributes.ids || t.push(e));
1348
1348
  }), t;
1349
1349
  }
1350
- function pn(e, t) {
1350
+ function hn(e, t) {
1351
1351
  return t.clone().transformDirection(e.matrixWorld).normalize();
1352
1352
  }
1353
- var mn = class {
1353
+ var gn = class {
1354
1354
  planes = [];
1355
1355
  edges = [];
1356
1356
  helpers = [];
@@ -1399,7 +1399,7 @@ var mn = class {
1399
1399
  return this.context.controlRef;
1400
1400
  }
1401
1401
  getMeshes() {
1402
- return fn(this.context.modelRef.current);
1402
+ return mn(this.context.modelRef.current);
1403
1403
  }
1404
1404
  getHelperHoverIsMoving() {
1405
1405
  return this.helperHoverMoveState !== "end" && this.helperHoverMoveState !== "start";
@@ -1442,7 +1442,7 @@ var mn = class {
1442
1442
  updateMaterials() {
1443
1443
  let e = this.active ? this.planes : [];
1444
1444
  this.getMeshes().forEach((t) => {
1445
- dn(t.material, e);
1445
+ pn(t.material, e);
1446
1446
  }), this.context.camera.updateMatrixWorld();
1447
1447
  }
1448
1448
  setActive(e) {
@@ -1461,42 +1461,42 @@ var mn = class {
1461
1461
  recursive: !1
1462
1462
  });
1463
1463
  if (!n?.face) return null;
1464
- let r = n.point.clone(), i = pn(n.object, n.face.normal);
1464
+ let r = n.point.clone(), i = hn(n.object, n.face.normal);
1465
1465
  r.add(i.clone().multiplyScalar(.001));
1466
- let a = new se().setFromNormalAndCoplanarPoint(i.clone().negate(), r);
1466
+ let a = new ue().setFromNormalAndCoplanarPoint(i.clone().negate(), r);
1467
1467
  return this.addPlane(a, r, i), a.clone();
1468
1468
  }
1469
1469
  createClippingRectangle() {
1470
1470
  let e = this.getModelWorldBox();
1471
1471
  if (!e) return [];
1472
- let t = ln(e), n = e.min.clone().addScalar(-t), r = e.max.clone().addScalar(t), i = e.getCenter(new L()), a = [
1472
+ let t = dn(e), n = e.min.clone().addScalar(-t), r = e.max.clone().addScalar(t), i = e.getCenter(new P()), a = [
1473
1473
  {
1474
- normal: new L(1, 0, 0),
1475
- point: new L(n.x, i.y, i.z)
1474
+ normal: new P(1, 0, 0),
1475
+ point: new P(n.x, i.y, i.z)
1476
1476
  },
1477
1477
  {
1478
- normal: new L(-1, 0, 0),
1479
- point: new L(r.x, i.y, i.z)
1478
+ normal: new P(-1, 0, 0),
1479
+ point: new P(r.x, i.y, i.z)
1480
1480
  },
1481
1481
  {
1482
- normal: new L(0, 1, 0),
1483
- point: new L(i.x, n.y, i.z)
1482
+ normal: new P(0, 1, 0),
1483
+ point: new P(i.x, n.y, i.z)
1484
1484
  },
1485
1485
  {
1486
- normal: new L(0, -1, 0),
1487
- point: new L(i.x, r.y, i.z)
1486
+ normal: new P(0, -1, 0),
1487
+ point: new P(i.x, r.y, i.z)
1488
1488
  },
1489
1489
  {
1490
- normal: new L(0, 0, 1),
1491
- point: new L(i.x, i.y, n.z)
1490
+ normal: new P(0, 0, 1),
1491
+ point: new P(i.x, i.y, n.z)
1492
1492
  },
1493
1493
  {
1494
- normal: new L(0, 0, -1),
1495
- point: new L(i.x, i.y, r.z)
1494
+ normal: new P(0, 0, -1),
1495
+ point: new P(i.x, i.y, r.z)
1496
1496
  }
1497
1497
  ].map(({ normal: e, point: t }) => ({
1498
1498
  normal: e,
1499
- plane: new se().setFromNormalAndCoplanarPoint(e, t),
1499
+ plane: new ue().setFromNormalAndCoplanarPoint(e, t),
1500
1500
  point: t
1501
1501
  }));
1502
1502
  return a.forEach(({ normal: e, plane: t, point: n }) => {
@@ -1504,8 +1504,8 @@ var mn = class {
1504
1504
  }), this.updateHelpers(), a.map(({ plane: e }) => e.clone());
1505
1505
  }
1506
1506
  addPlane(e, t, n) {
1507
- if (this.active || this.setActive(!0), this.planes.push(e), new un(this, e, t, n), this.updateHelpers(), this.updateMaterials(), this.edgesActive) {
1508
- let t = new Yt(this, e);
1507
+ if (this.active || this.setActive(!0), this.planes.push(e), new fn(this, e, t, n), this.updateHelpers(), this.updateMaterials(), this.edgesActive) {
1508
+ let t = new Zt(this, e);
1509
1509
  t.create(), t.update();
1510
1510
  }
1511
1511
  }
@@ -1517,7 +1517,7 @@ var mn = class {
1517
1517
  }
1518
1518
  setEdgesActive(e) {
1519
1519
  this.edgesActive !== e && (this.edgesActive = e, e && this.edges.length !== this.planes.length && (this.edges.forEach((e) => e.dispose()), this.edges = [], this.planes.forEach((e) => {
1520
- let t = new Yt(this, e);
1520
+ let t = new Zt(this, e);
1521
1521
  t.create(), t.update();
1522
1522
  })), this.edges.forEach((t) => t.setVisible(this.active && e)));
1523
1523
  }
@@ -1544,8 +1544,8 @@ var mn = class {
1544
1544
  this.deleteAllPlanes();
1545
1545
  }
1546
1546
  };
1547
- function hn(e, t, n) {
1548
- let r = p((e) => e.camera), i = p((e) => e.gl), a = p((e) => e.raycaster), s = p((e) => e.scene), l = Te(), u = c(() => new mn({
1547
+ function _n(e, t, n) {
1548
+ let r = p((e) => e.camera), i = p((e) => e.gl), a = p((e) => e.raycaster), s = p((e) => e.scene), l = R(), u = c(() => new gn({
1549
1549
  camera: r,
1550
1550
  cameraUtils: n,
1551
1551
  controlRef: t,
@@ -1615,28 +1615,28 @@ function hn(e, t, n) {
1615
1615
  }
1616
1616
  //#endregion
1617
1617
  //#region src/viewer/utils/DimentionsUtils/DimentionLine.ts
1618
- var gn = 12, _n = 6, vn = 4;
1619
- function yn() {
1618
+ var vn = 12, yn = 6, bn = 4;
1619
+ function xn() {
1620
1620
  return typeof window > "u" ? 1 : Math.min(window.devicePixelRatio || 1, 2);
1621
1621
  }
1622
- function bn(e, t) {
1623
- return e instanceof ae ? (e.top - e.bottom) / e.zoom : e instanceof oe ? 2 * Math.tan(e.fov * Math.PI / 360) * Math.max(t, .001) : Math.max(t, 1);
1622
+ function Sn(e, t) {
1623
+ return e instanceof ce ? (e.top - e.bottom) / e.zoom : e instanceof le ? 2 * Math.tan(e.fov * Math.PI / 360) * Math.max(t, .001) : Math.max(t, 1);
1624
1624
  }
1625
- function xn(e) {
1626
- let t = yn(), n = document.createElement("canvas"), r = n.getContext("2d");
1625
+ function Cn(e) {
1626
+ let t = xn(), n = document.createElement("canvas"), r = n.getContext("2d");
1627
1627
  if (!r) throw Error("Could not create dimension label canvas context");
1628
- let i = `600 ${gn}px system-ui, "Segoe UI", sans-serif`;
1628
+ let i = `600 ${vn}px system-ui, "Segoe UI", sans-serif`;
1629
1629
  r.font = i;
1630
- let a = r.measureText(e), o = a.actualBoundingBoxAscent || gn * .8, s = a.actualBoundingBoxDescent || gn * .2, c = Math.max(1, Math.ceil(a.width + _n * 2)), l = Math.max(1, Math.ceil(o + s + vn * 2));
1630
+ let a = r.measureText(e), o = a.actualBoundingBoxAscent || vn * .8, s = a.actualBoundingBoxDescent || vn * .2, c = Math.max(1, Math.ceil(a.width + yn * 2)), l = Math.max(1, Math.ceil(o + s + bn * 2));
1631
1631
  n.width = Math.ceil(c * t), n.height = Math.ceil(l * t), r.scale(t, t), r.clearRect(0, 0, c, l), r.fillStyle = "rgba(255, 255, 255, 0.86)", r.strokeStyle = "rgba(29, 39, 51, 0.22)", r.lineWidth = 1, r.beginPath(), r.roundRect(.5, .5, c - 1, l - 1, 4), r.fill(), r.stroke(), r.font = i, r.fillStyle = "#111827", r.textAlign = "center", r.textBaseline = "middle", r.fillText(e, c / 2, l / 2);
1632
1632
  let u = new b(n);
1633
- return u.colorSpace = le, u.generateMipmaps = !1, u.magFilter = M, u.minFilter = M, u.needsUpdate = !0, {
1633
+ return u.colorSpace = fe, u.generateMipmaps = !1, u.magFilter = A, u.minFilter = A, u.needsUpdate = !0, {
1634
1634
  height: l,
1635
1635
  texture: u,
1636
1636
  width: c
1637
1637
  };
1638
1638
  }
1639
- var Sn = class e {
1639
+ var wn = class e {
1640
1640
  static scale = 1;
1641
1641
  static scaleFactor = .015;
1642
1642
  static units = "m";
@@ -1666,7 +1666,7 @@ var Sn = class e {
1666
1666
  this.end.x,
1667
1667
  this.end.y,
1668
1668
  this.end.z
1669
- ], 3)), this.line = new O(this.lineGeometry, this.lineMaterial), this.line.renderOrder = 4, this.line.computeLineDistances(), this.root.add(this.line), this.addEndpointMeshes(), this.labelSprite = this.createLabelSprite(), this.root.add(this.labelSprite), this.updateLabel(), this.updatePositions(), this.ownerRoot.add(this.root);
1669
+ ], 3)), this.line = new ee(this.lineGeometry, this.lineMaterial), this.line.renderOrder = 4, this.line.computeLineDistances(), this.root.add(this.line), this.addEndpointMeshes(), this.labelSprite = this.createLabelSprite(), this.root.add(this.labelSprite), this.updateLabel(), this.updatePositions(), this.ownerRoot.add(this.root);
1670
1670
  }
1671
1671
  get length() {
1672
1672
  return this.start.distanceTo(this.end);
@@ -1708,11 +1708,11 @@ var Sn = class e {
1708
1708
  this.addEndpointMesh(this.start, this.end), this.addEndpointMesh(this.end, this.start);
1709
1709
  }
1710
1710
  addEndpointMesh(e, t) {
1711
- let n = new P(this.endpointGeometry, this.endpointMaterial);
1711
+ let n = new M(this.endpointGeometry, this.endpointMaterial);
1712
1712
  n.position.copy(e), n.scale.copy(this.endpointBaseScale), n.lookAt(t), n.renderOrder = 4, this.endpointMeshes.push(n), this.root.add(n);
1713
1713
  }
1714
1714
  createLabelSprite() {
1715
- let e = new fe(new pe({
1715
+ let e = new he(new ge({
1716
1716
  depthTest: !1,
1717
1717
  depthWrite: !1,
1718
1718
  transparent: !0
@@ -1720,7 +1720,7 @@ var Sn = class e {
1720
1720
  return e.renderOrder = 5, e;
1721
1721
  }
1722
1722
  createBoundingBoxMesh() {
1723
- let e = new P(new _(1, 1, Math.max(this.length, .001)), this.boundingMaterial);
1723
+ let e = new M(new _(1, 1, Math.max(this.length, .001)), this.boundingMaterial);
1724
1724
  return e.renderOrder = 3, e;
1725
1725
  }
1726
1726
  getTextContent() {
@@ -1731,7 +1731,7 @@ var Sn = class e {
1731
1731
  let e = this.getTextContent();
1732
1732
  if (this.labelText === e) return;
1733
1733
  this.labelText = e, this.labelTexture?.dispose();
1734
- let t = xn(e);
1734
+ let t = Cn(e);
1735
1735
  this.labelHeight = t.height, this.labelTexture = t.texture, this.labelWidth = t.width, this.labelSprite.material.map = t.texture, this.labelSprite.material.needsUpdate = !0;
1736
1736
  }
1737
1737
  updatePositions() {
@@ -1742,37 +1742,37 @@ var Sn = class e {
1742
1742
  this.boundingMesh && (this.boundingMesh.position.copy(this.center), this.boundingMesh.lookAt(this.end), this.boundingMesh.geometry.dispose(), this.boundingMesh.geometry = new _(1, 1, Math.max(this.length, .001)));
1743
1743
  }
1744
1744
  rescaleMesh(t, n, r) {
1745
- let i = bn(n, t.position.distanceTo(n.position)) / Math.max(1, r) * 12 * e.scaleFactor;
1745
+ let i = Sn(n, t.position.distanceTo(n.position)) / Math.max(1, r) * 12 * e.scaleFactor;
1746
1746
  t.scale.setScalar(i);
1747
1747
  }
1748
1748
  rescaleBoundingMesh(e, t) {
1749
1749
  if (!this.boundingMesh) return;
1750
- let n = bn(e, this.boundingMesh.position.distanceTo(e.position)) / Math.max(1, t) * 8;
1750
+ let n = Sn(e, this.boundingMesh.position.distanceTo(e.position)) / Math.max(1, t) * 8;
1751
1751
  this.boundingMesh.scale.set(n, n, 1);
1752
1752
  }
1753
1753
  rescaleLabel(e, t) {
1754
- let n = bn(e, this.labelSprite.position.distanceTo(e.position)), r = this.labelHeight / Math.max(1, t) * n, i = r * (this.labelWidth / this.labelHeight);
1754
+ let n = Sn(e, this.labelSprite.position.distanceTo(e.position)), r = this.labelHeight / Math.max(1, t) * n, i = r * (this.labelWidth / this.labelHeight);
1755
1755
  this.labelSprite.scale.set(i, r, 1);
1756
1756
  }
1757
- }, Cn = "#111827", wn = 1, Tn = "x";
1758
- function En(e) {
1757
+ }, Tn = "#111827", En = 1, Dn = "x";
1758
+ function On(e) {
1759
1759
  let t = [];
1760
1760
  return e?.traverse((e) => {
1761
- e instanceof P && e.geometry.attributes.position && t.push(e);
1761
+ e instanceof M && e.geometry.attributes.position && t.push(e);
1762
1762
  }), t;
1763
1763
  }
1764
- function Dn(e, t, n) {
1764
+ function kn(e, t, n) {
1765
1765
  let r = e.clone();
1766
1766
  return r[n] = t[n], r;
1767
1767
  }
1768
- function On(e, t) {
1768
+ function An(e, t) {
1769
1769
  let n = Math.hypot(t.y - e.y, t.z - e.z), r = Math.hypot(t.x - e.x, t.z - e.z), i = Math.hypot(t.x - e.x, t.y - e.y), a = Math.min(n, r, i);
1770
1770
  return a === n ? "x" : a === r ? "y" : "z";
1771
1771
  }
1772
- var kn = class e {
1772
+ var jn = class e {
1773
1773
  active = !1;
1774
1774
  axis = null;
1775
- boundingMaterial = new F({
1775
+ boundingMaterial = new ie({
1776
1776
  color: 0,
1777
1777
  depthTest: !1,
1778
1778
  depthWrite: !1,
@@ -1783,14 +1783,14 @@ var kn = class e {
1783
1783
  currentDimension = null;
1784
1784
  dimensions = [];
1785
1785
  endpointGeometry = e.createEndpointGeometry();
1786
- endpointMaterial = new F({
1787
- color: Cn,
1786
+ endpointMaterial = new ie({
1787
+ color: Tn,
1788
1788
  depthTest: !1,
1789
1789
  depthWrite: !1
1790
1790
  });
1791
- endpointScale = new L(1, 1, 1);
1792
- lineMaterial = new A({
1793
- color: Cn,
1791
+ endpointScale = new P(1, 1, 1);
1792
+ lineMaterial = new k({
1793
+ color: Tn,
1794
1794
  dashSize: .2,
1795
1795
  depthTest: !1,
1796
1796
  depthWrite: !1,
@@ -1798,14 +1798,14 @@ var kn = class e {
1798
1798
  });
1799
1799
  measureInProcess = !1;
1800
1800
  moveState = "end";
1801
- previewMarker = new P(e.createPreviewGeometry(), new F({
1801
+ previewMarker = new M(e.createPreviewGeometry(), new ie({
1802
1802
  color: 0,
1803
1803
  depthTest: !1,
1804
1804
  depthWrite: !1
1805
1805
  }));
1806
1806
  root = new D();
1807
- snapDistance = wn;
1808
- startPoint = new L();
1807
+ snapDistance = En;
1808
+ startPoint = new P();
1809
1809
  unit = "m";
1810
1810
  constructor(e) {
1811
1811
  this.context = e, this.root.name = "BimatterDimensions", this.previewMarker.renderOrder = 5, this.previewMarker.visible = !1, this.root.add(this.previewMarker), this.context.scene.add(this.root);
@@ -1838,13 +1838,13 @@ var kn = class e {
1838
1838
  });
1839
1839
  }
1840
1840
  setEndpointScaleFactor(e) {
1841
- !Number.isFinite(e) || e <= 0 || (Sn.scaleFactor = e);
1841
+ !Number.isFinite(e) || e <= 0 || (wn.scaleFactor = e);
1842
1842
  }
1843
1843
  setSnapDistance(e) {
1844
1844
  !Number.isFinite(e) || e < 0 || (this.snapDistance = e);
1845
1845
  }
1846
1846
  setUnit(e) {
1847
- this.unit = e, Sn.units = e, Sn.scale = e === "mm" ? 1e3 : 1, this.dimensions.forEach((e) => {
1847
+ this.unit = e, wn.units = e, wn.scale = e === "mm" ? 1e3 : 1, this.dimensions.forEach((e) => {
1848
1848
  e.endPoint = e.end;
1849
1849
  }), this.currentDimension && (this.currentDimension.endPoint = this.currentDimension.end);
1850
1850
  }
@@ -1870,7 +1870,7 @@ var kn = class e {
1870
1870
  changeAxes() {
1871
1871
  if (!this.measureInProcess || !this.currentDimension) return;
1872
1872
  let e = this.currentDimension.end, t = this.getNextAxis();
1873
- this.axis = t, this.currentDimension.endPoint = Dn(this.startPoint, e, t);
1873
+ this.axis = t, this.currentDimension.endPoint = kn(this.startPoint, e, t);
1874
1874
  }
1875
1875
  updateFrame() {
1876
1876
  if (!this.active) return;
@@ -1914,7 +1914,7 @@ var kn = class e {
1914
1914
  this.currentDimension && (this.currentDimension.createBoundingBox(), this.dimensions.push(this.currentDimension), this.currentDimension = null, this.measureInProcess = !1, this.axis = null);
1915
1915
  }
1916
1916
  createDimension(e, t) {
1917
- return new Sn({
1917
+ return new wn({
1918
1918
  boundingMaterial: this.boundingMaterial,
1919
1919
  endpointGeometry: this.endpointGeometry,
1920
1920
  endpointMaterial: this.endpointMaterial,
@@ -1926,7 +1926,7 @@ var kn = class e {
1926
1926
  });
1927
1927
  }
1928
1928
  getModelHit(e) {
1929
- let t = En(this.context.modelRef.current);
1929
+ let t = On(this.context.modelRef.current);
1930
1930
  return t.length ? this.context.cameraUtils.getIntersection(!0, {
1931
1931
  event: e,
1932
1932
  filter: (e) => !!e.face,
@@ -1938,7 +1938,7 @@ var kn = class e {
1938
1938
  return this.dimensions.map((e) => e.boundingBox).filter((e) => !!e);
1939
1939
  }
1940
1940
  getClosestVertex(e) {
1941
- if (!(e.object instanceof P) || !e.face) return e.point.clone();
1941
+ if (!(e.object instanceof M) || !e.face) return e.point.clone();
1942
1942
  let t = e.object.geometry.attributes.position;
1943
1943
  if (!t) return e.point.clone();
1944
1944
  let n = [
@@ -1946,29 +1946,29 @@ var kn = class e {
1946
1946
  e.face.b,
1947
1947
  e.face.c
1948
1948
  ].map((n) => {
1949
- let r = new L(t.getX(n), t.getY(n), t.getZ(n));
1949
+ let r = new P(t.getX(n), t.getY(n), t.getZ(n));
1950
1950
  return e.object.localToWorld(r);
1951
1951
  }).filter((t) => t.distanceTo(e.point) <= this.snapDistance);
1952
1952
  return n.length ? n.reduce((t, n) => n.distanceTo(e.point) < t.distanceTo(e.point) ? n : t) : e.point.clone();
1953
1953
  }
1954
1954
  getPreviewEndPoint(e, t) {
1955
1955
  if (!t) return this.axis = null, e.clone();
1956
- let n = this.axis ?? On(this.startPoint, e);
1957
- return this.axis = n, Dn(this.startPoint, e, n);
1956
+ let n = this.axis ?? An(this.startPoint, e);
1957
+ return this.axis = n, kn(this.startPoint, e, n);
1958
1958
  }
1959
1959
  getNextAxis() {
1960
1960
  switch (this.axis) {
1961
1961
  case "x": return "y";
1962
1962
  case "y": return "z";
1963
1963
  case "z": return "x";
1964
- default: return Tn;
1964
+ default: return Dn;
1965
1965
  }
1966
1966
  }
1967
1967
  getIsMoving() {
1968
1968
  return this.moveState !== "end" && this.moveState !== "start";
1969
1969
  }
1970
1970
  rescalePreviewMarker() {
1971
- let { camera: e, viewportHeight: t } = this.context, n = this.previewMarker.position.distanceTo(e.position), r = e instanceof oe ? 2 * Math.tan(e.fov * Math.PI / 360) * Math.max(n, .001) * 6.667 / Math.max(1, t) : .08;
1971
+ let { camera: e, viewportHeight: t } = this.context, n = this.previewMarker.position.distanceTo(e.position), r = e instanceof le ? 2 * Math.tan(e.fov * Math.PI / 360) * Math.max(n, .001) * 6.667 / Math.max(1, t) : .08;
1972
1972
  this.previewMarker.scale.setScalar(r);
1973
1973
  }
1974
1974
  setSelectionInteractionDisabled(e) {
@@ -2005,11 +2005,11 @@ var kn = class e {
2005
2005
  return n.translate(0, -e / 2, 0), n.rotateX(-Math.PI / 2), n;
2006
2006
  }
2007
2007
  static createPreviewGeometry() {
2008
- return new de(.5, 16, 12);
2008
+ return new me(.5, 16, 12);
2009
2009
  }
2010
2010
  };
2011
- function An(e, t, n) {
2012
- let r = p((e) => e.camera), i = p((e) => e.gl), a = p((e) => e.scene), s = p((e) => e.size), l = Te(), u = c(() => new kn({
2011
+ function Mn(e, t, n) {
2012
+ let r = p((e) => e.camera), i = p((e) => e.gl), a = p((e) => e.scene), s = p((e) => e.size), l = R(), u = c(() => new jn({
2013
2013
  camera: r,
2014
2014
  cameraUtils: n,
2015
2015
  controlRef: t,
@@ -2071,15 +2071,15 @@ function An(e, t, n) {
2071
2071
  }
2072
2072
  //#endregion
2073
2073
  //#region src/viewer/utils/Hotkeys/useHotkeysUtils.tsx
2074
- function jn(e) {
2074
+ function Nn(e) {
2075
2075
  return e instanceof HTMLElement ? e.isContentEditable || e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement : !1;
2076
2076
  }
2077
- function Mn() {
2078
- let e = B((e) => e.api), t = B((e) => e.defaultHotkeysEnabled);
2077
+ function Pn() {
2078
+ let e = L((e) => e.api), t = L((e) => e.defaultHotkeysEnabled);
2079
2079
  o(() => {
2080
2080
  if (!t) return;
2081
2081
  let n = (t) => {
2082
- jn(t.target) || (t.code === "KeyI" && e?.geometryUtils.isolateSelected(), t.code === "KeyH" && e?.geometryUtils.hideSelected(), t.code === "KeyC" && e?.geometryUtils.showAll(), t.code === "KeyP" && e?.clipping.createPlane(), t.code === "KeyM" && e?.dimensions.toggle());
2082
+ Nn(t.target) || (t.code === "KeyI" && e?.geometryUtils.isolateSelected(), t.code === "KeyH" && e?.geometryUtils.hideSelected(), t.code === "KeyC" && e?.geometryUtils.showAll(), t.code === "KeyP" && e?.clipping.createPlane(), t.code === "KeyM" && e?.dimensions.toggle());
2083
2083
  };
2084
2084
  return window.addEventListener("keydown", n), () => {
2085
2085
  window.removeEventListener("keydown", n);
@@ -2088,15 +2088,15 @@ function Mn() {
2088
2088
  }
2089
2089
  //#endregion
2090
2090
  //#region src/viewer/Camera/useCameraUtils.ts
2091
- var Nn = 1e-6;
2092
- function Pn(e, t) {
2091
+ var Fn = 1e-6;
2092
+ function In(e, t) {
2093
2093
  let n = t.getBoundingClientRect();
2094
- return n.width <= 0 || n.height <= 0 || e.clientX < n.left || e.clientX > n.right || e.clientY < n.top || e.clientY > n.bottom ? null : new I((e.clientX - n.left) / n.width * 2 - 1, -((e.clientY - n.top) / n.height) * 2 + 1);
2094
+ return n.width <= 0 || n.height <= 0 || e.clientX < n.left || e.clientX > n.right || e.clientY < n.top || e.clientY > n.bottom ? null : new N((e.clientX - n.left) / n.width * 2 - 1, -((e.clientY - n.top) / n.height) * 2 + 1);
2095
2095
  }
2096
- function Fn(e, t) {
2097
- return t.every((t) => t.distanceToPoint(e) >= -Nn);
2096
+ function Ln(e, t) {
2097
+ return t.every((t) => t.distanceToPoint(e) >= -Fn);
2098
2098
  }
2099
- function In(e) {
2099
+ function Rn(e) {
2100
2100
  let t = e;
2101
2101
  for (; t;) {
2102
2102
  if (!t.visible) return !1;
@@ -2104,8 +2104,8 @@ function In(e) {
2104
2104
  }
2105
2105
  return !0;
2106
2106
  }
2107
- function Ln(e) {
2108
- let t = p((e) => e.camera), n = p((e) => e.gl), r = p((e) => e.raycaster), a = l(null), s = l(null), u = l(new I()), d = i((e) => {
2107
+ function zn(e) {
2108
+ let t = p((e) => e.camera), n = p((e) => e.gl), r = p((e) => e.raycaster), a = l(null), s = l(null), u = l(new N()), d = i((e) => {
2109
2109
  a.current = e;
2110
2110
  }, []), f = i(() => {
2111
2111
  let e = a.current;
@@ -2113,7 +2113,7 @@ function Ln(e) {
2113
2113
  }, []);
2114
2114
  o(() => {
2115
2115
  let e = n.domElement, t = (t) => {
2116
- let n = Pn(t, e);
2116
+ let n = In(t, e);
2117
2117
  n && (s.current = n);
2118
2118
  }, r = () => {
2119
2119
  s.current = null;
@@ -2123,11 +2123,11 @@ function Ln(e) {
2123
2123
  };
2124
2124
  }, [n]);
2125
2125
  let m = i((i = !1, { event: a, filter: o, object: c = e.current, recursive: l = !0, respectClipping: d = !0 } = {}) => {
2126
- let p = a ? Pn(a, n.domElement) : s.current;
2126
+ let p = a ? In(a, n.domElement) : s.current;
2127
2127
  if (!p || !c) return i ? null : [];
2128
2128
  let m = d ? f() : [], h = Array.isArray(c) ? c : [c];
2129
2129
  t.updateMatrixWorld(), e.current?.updateMatrixWorld(!0), u.current.copy(p), r.setFromCamera(u.current, t);
2130
- let g = r.intersectObjects(h, l).filter((e) => In(e.object) ? m.length ? Fn(e.point, m) : !0 : !1).filter((e) => o ? o(e) : !0);
2130
+ let g = r.intersectObjects(h, l).filter((e) => Rn(e.object) ? m.length ? Ln(e.point, m) : !0 : !1).filter((e) => o ? o(e) : !0);
2131
2131
  return i ? g[0] ?? null : g;
2132
2132
  }, [
2133
2133
  t,
@@ -2148,8 +2148,8 @@ function Ln(e) {
2148
2148
  }
2149
2149
  //#endregion
2150
2150
  //#region src/viewer/Selector/SelectionBox.ts
2151
- var Rn = new L(), zn = new L(), K = new I(), Bn = new L(), Vn = new L(), Hn = new L(), Un = new L(), Wn = new L(), Gn = new L(), Kn = new L();
2152
- function qn(e) {
2151
+ var Bn = new P(), Vn = new P(), W = new N(), Hn = new P(), Un = new P(), Wn = new P(), Gn = new P(), Kn = new P(), qn = new P(), Jn = new P();
2152
+ function Yn(e) {
2153
2153
  let t = e;
2154
2154
  for (; t;) {
2155
2155
  let e = t.modelID ?? t.userData.modelID;
@@ -2158,7 +2158,7 @@ function qn(e) {
2158
2158
  }
2159
2159
  return 0;
2160
2160
  }
2161
- function Jn(e) {
2161
+ function Xn(e) {
2162
2162
  let t = e;
2163
2163
  for (; t;) {
2164
2164
  if (!t.visible) return !1;
@@ -2166,16 +2166,16 @@ function Jn(e) {
2166
2166
  }
2167
2167
  return !0;
2168
2168
  }
2169
- function Yn(e, t, n) {
2170
- return n.length ? (Bn.copy(t).applyMatrix4(e.matrixWorld), Fn(Bn, n)) : !0;
2169
+ function Zn(e, t, n) {
2170
+ return n.length ? (Hn.copy(t).applyMatrix4(e.matrixWorld), Ln(Hn, n)) : !0;
2171
2171
  }
2172
- function Xn(e, t, n, r, i) {
2173
- return i.length ? (Vn.copy(t).applyMatrix4(e.matrixWorld), Hn.copy(n).applyMatrix4(e.matrixWorld), Un.copy(r).applyMatrix4(e.matrixWorld), i.every((e) => {
2174
- let t = e.distanceToPoint(Vn), n = e.distanceToPoint(Hn), r = e.distanceToPoint(Un);
2172
+ function Qn(e, t, n, r, i) {
2173
+ return i.length ? (Un.copy(t).applyMatrix4(e.matrixWorld), Wn.copy(n).applyMatrix4(e.matrixWorld), Gn.copy(r).applyMatrix4(e.matrixWorld), i.every((e) => {
2174
+ let t = e.distanceToPoint(Un), n = e.distanceToPoint(Wn), r = e.distanceToPoint(Gn);
2175
2175
  return !(t < -1e-6 && n < -1e-6 && r < -1e-6);
2176
2176
  })) : !0;
2177
2177
  }
2178
- function Zn(e) {
2178
+ function $n(e) {
2179
2179
  let t = e.getBoundingClientRect();
2180
2180
  return {
2181
2181
  height: t.height,
@@ -2184,7 +2184,7 @@ function Zn(e) {
2184
2184
  width: t.width
2185
2185
  };
2186
2186
  }
2187
- function Qn(e) {
2187
+ function er(e) {
2188
2188
  return {
2189
2189
  boundsCheckMs: 0,
2190
2190
  candidateIds: 0,
@@ -2210,7 +2210,7 @@ function Qn(e) {
2210
2210
  triangleProjectionMs: 0
2211
2211
  };
2212
2212
  }
2213
- function $n(e, t) {
2213
+ function tr(e, t) {
2214
2214
  return {
2215
2215
  minX: Math.min(e.x, t.x),
2216
2216
  minY: Math.min(e.y, t.y),
@@ -2218,43 +2218,43 @@ function $n(e, t) {
2218
2218
  maxY: Math.max(e.y, t.y)
2219
2219
  };
2220
2220
  }
2221
- function er(e, t) {
2221
+ function nr(e, t) {
2222
2222
  return t.x >= e.x ? "contains" : "intersects";
2223
2223
  }
2224
- function tr(e, t) {
2225
- return nr(e.x, e.y, t);
2224
+ function rr(e, t) {
2225
+ return ir(e.x, e.y, t);
2226
2226
  }
2227
- function nr(e, t, n) {
2227
+ function ir(e, t, n) {
2228
2228
  return e >= n.minX && e <= n.maxX && t >= n.minY && t <= n.maxY;
2229
2229
  }
2230
- function rr(e, t, n, r, i, a) {
2230
+ function ar(e, t, n, r, i, a) {
2231
2231
  return (a - t) * (n - e) > (r - t) * (i - e);
2232
2232
  }
2233
- function ir(e, t, n, r, i, a, o, s) {
2234
- return rr(e, t, i, a, o, s) !== rr(n, r, i, a, o, s) && rr(e, t, n, r, i, a) !== rr(e, t, n, r, o, s);
2233
+ function or(e, t, n, r, i, a, o, s) {
2234
+ return ar(e, t, i, a, o, s) !== ar(n, r, i, a, o, s) && ar(e, t, n, r, i, a) !== ar(e, t, n, r, o, s);
2235
2235
  }
2236
- function ar(e, t, n, r, i) {
2236
+ function sr(e, t, n, r, i) {
2237
2237
  let a = .5 * (-r.y * i.x + n.y * (-r.x + i.x) + n.x * (r.y - i.y) + r.x * i.y), o = a < 0 ? -1 : 1, s = (n.y * i.x - n.x * i.y + (i.y - n.y) * e + (n.x - i.x) * t) * o, c = (n.x * r.y - n.y * r.x + (n.y - r.y) * e + (r.x - n.x) * t) * o;
2238
2238
  return s >= 0 && c >= 0 && s + c <= 2 * a * o;
2239
2239
  }
2240
- function or(e, t, n, r) {
2241
- return tr(e, r) || tr(t, r) || tr(n, r) || ar(r.minX, r.minY, e, t, n) || ar(r.maxX, r.minY, e, t, n) || ar(r.maxX, r.maxY, e, t, n) || ar(r.minX, r.maxY, e, t, n) ? !0 : sr(e, t, r) || sr(t, n, r) || sr(n, e, r);
2240
+ function cr(e, t, n, r) {
2241
+ return rr(e, r) || rr(t, r) || rr(n, r) || sr(r.minX, r.minY, e, t, n) || sr(r.maxX, r.minY, e, t, n) || sr(r.maxX, r.maxY, e, t, n) || sr(r.minX, r.maxY, e, t, n) ? !0 : lr(e, t, r) || lr(t, n, r) || lr(n, e, r);
2242
2242
  }
2243
- function sr(e, t, n) {
2244
- return ir(e.x, e.y, t.x, t.y, n.minX, n.minY, n.maxX, n.minY) || ir(e.x, e.y, t.x, t.y, n.maxX, n.minY, n.maxX, n.maxY) || ir(e.x, e.y, t.x, t.y, n.maxX, n.maxY, n.minX, n.maxY) || ir(e.x, e.y, t.x, t.y, n.minX, n.maxY, n.minX, n.minY);
2243
+ function lr(e, t, n) {
2244
+ return or(e.x, e.y, t.x, t.y, n.minX, n.minY, n.maxX, n.minY) || or(e.x, e.y, t.x, t.y, n.maxX, n.minY, n.maxX, n.maxY) || or(e.x, e.y, t.x, t.y, n.maxX, n.maxY, n.minX, n.maxY) || or(e.x, e.y, t.x, t.y, n.minX, n.maxY, n.minX, n.minY);
2245
2245
  }
2246
- function cr(e, t, n, r, i = new I()) {
2247
- let a = Rn.copy(t).applyMatrix4(e.matrixWorld).project(n);
2246
+ function G(e, t, n, r, i = new N()) {
2247
+ let a = Bn.copy(t).applyMatrix4(e.matrixWorld).project(n);
2248
2248
  return i.set((a.x + 1) / 2 * r.width + r.left, (-a.y + 1) / 2 * r.height + r.top);
2249
2249
  }
2250
- function lr(e, t, n, r, i) {
2250
+ function ur(e, t, n, r, i) {
2251
2251
  let a = Infinity, o = -Infinity, s = Infinity, c = -Infinity, l = 0;
2252
- for (let u = 0; u < 2; u++) for (let d = 0; d < 2; d++) for (let f = 0; f < 2; f++) zn.set(u ? t.max.x : t.min.x, d ? t.max.y : t.min.y, f ? t.max.z : t.min.z), cr(e, zn, r, i, K), a = Math.min(a, K.x), o = Math.max(o, K.x), s = Math.min(s, K.y), c = Math.max(c, K.y), tr(K, n) && (l += 1);
2253
- return o < n.minX || a > n.maxX || c < n.minY || s > n.maxY ? be : l === 8 ? _e : ve;
2252
+ for (let u = 0; u < 2; u++) for (let d = 0; d < 2; d++) for (let f = 0; f < 2; f++) Vn.set(u ? t.max.x : t.min.x, d ? t.max.y : t.min.y, f ? t.max.z : t.min.z), G(e, Vn, r, i, W), a = Math.min(a, W.x), o = Math.max(o, W.x), s = Math.min(s, W.y), c = Math.max(c, W.y), rr(W, n) && (l += 1);
2253
+ return o < n.minX || a > n.maxX || c < n.minY || s > n.maxY ? Ce : l === 8 ? be : xe;
2254
2254
  }
2255
- function ur(e, t, n, r) {
2255
+ function dr(e, t, n, r) {
2256
2256
  let i = Infinity, a = -Infinity, o = Infinity, s = -Infinity;
2257
- for (let c = 0; c < 2; c++) for (let l = 0; l < 2; l++) for (let u = 0; u < 2; u++) zn.set(c ? t.max.x : t.min.x, l ? t.max.y : t.min.y, u ? t.max.z : t.min.z), cr(e, zn, n, r, K), i = Math.min(i, K.x), a = Math.max(a, K.x), o = Math.min(o, K.y), s = Math.max(s, K.y);
2257
+ for (let c = 0; c < 2; c++) for (let l = 0; l < 2; l++) for (let u = 0; u < 2; u++) Vn.set(c ? t.max.x : t.min.x, l ? t.max.y : t.min.y, u ? t.max.z : t.min.z), G(e, Vn, n, r, W), i = Math.min(i, W.x), a = Math.max(a, W.x), o = Math.min(o, W.y), s = Math.max(s, W.y);
2258
2258
  return {
2259
2259
  minX: i,
2260
2260
  minY: o,
@@ -2262,41 +2262,41 @@ function ur(e, t, n, r) {
2262
2262
  maxY: s
2263
2263
  };
2264
2264
  }
2265
- function dr(e, t) {
2265
+ function fr(e, t) {
2266
2266
  return !(e.maxX < t.minX || e.minX > t.maxX || e.maxY < t.minY || e.minY > t.maxY);
2267
2267
  }
2268
- function fr(e, t, n, r) {
2268
+ function pr(e, t, n, r) {
2269
2269
  e.geometry.boundingBox || e.geometry.computeBoundingBox();
2270
2270
  let i = e.geometry.boundingBox;
2271
- return i ? dr(ur(e, i, n, r), t) : !0;
2271
+ return i ? fr(dr(e, i, n, r), t) : !0;
2272
2272
  }
2273
- function pr(e, t, n) {
2273
+ function mr(e, t, n) {
2274
2274
  let r = e.get(t);
2275
2275
  r || (r = /* @__PURE__ */ new Set(), e.set(t, r)), r.add(n);
2276
2276
  }
2277
- function mr(e) {
2277
+ function hr(e) {
2278
2278
  let t = 0;
2279
2279
  return e.forEach((e) => {
2280
2280
  t += e.size;
2281
2281
  }), t;
2282
2282
  }
2283
- function hr(e, t, n, r = []) {
2283
+ function gr(e, t, n, r = []) {
2284
2284
  let i = e.geometry, a = i.index, o = i.attributes.ids, s = i.attributes.position;
2285
2285
  if (!a || !o || !s) return;
2286
2286
  let c = t * 3;
2287
- r.length && (Wn.fromBufferAttribute(s, a.getX(c)), Gn.fromBufferAttribute(s, a.getX(c + 1)), Kn.fromBufferAttribute(s, a.getX(c + 2)), !Xn(e, Wn, Gn, Kn, r)) || pr(n, qn(e), o.getX(a.getX(c)));
2287
+ r.length && (Kn.fromBufferAttribute(s, a.getX(c)), qn.fromBufferAttribute(s, a.getX(c + 1)), Jn.fromBufferAttribute(s, a.getX(c + 2)), !Qn(e, Kn, qn, Jn, r)) || mr(n, Yn(e), o.getX(a.getX(c)));
2288
2288
  }
2289
- function gr({ model: e, camera: t, viewport: n, rect: r, candidateIdsByModel: i, clippingPlanes: a, profile: o }) {
2290
- let s = performance.now(), c = /* @__PURE__ */ new Map(), l = new L();
2289
+ function _r({ model: e, camera: t, viewport: n, rect: r, candidateIdsByModel: i, clippingPlanes: a, profile: o }) {
2290
+ let s = performance.now(), c = /* @__PURE__ */ new Map(), l = new P();
2291
2291
  e.traverse((e) => {
2292
2292
  let s = e;
2293
- if (!s.isMesh || !Jn(s)) return;
2293
+ if (!s.isMesh || !Xn(s)) return;
2294
2294
  let u = s.geometry.attributes.ids, d = s.geometry.attributes.position;
2295
2295
  if (!(!u || !d)) {
2296
2296
  o && (o.containedVerticesVisited += u.count);
2297
2297
  for (let e = 0; e < u.count; e++) {
2298
- let f = qn(s), p = u.getX(e);
2299
- if (!i.get(f)?.has(p) || (l.fromBufferAttribute(d, e), !Yn(s, l, a))) continue;
2298
+ let f = Yn(s), p = u.getX(e);
2299
+ if (!i.get(f)?.has(p) || (l.fromBufferAttribute(d, e), !Zn(s, l, a))) continue;
2300
2300
  o && (o.containedCandidateVertices += 1);
2301
2301
  let m = `${f}:${p}`, h = c.get(m);
2302
2302
  h || (h = {
@@ -2304,23 +2304,23 @@ function gr({ model: e, camera: t, viewport: n, rect: r, candidateIdsByModel: i,
2304
2304
  inside: 0,
2305
2305
  modelID: f,
2306
2306
  total: 0
2307
- }, c.set(m, h)), h.total += 1, tr(cr(s, l, t, n), r) && (h.inside += 1);
2307
+ }, c.set(m, h)), h.total += 1, rr(G(s, l, t, n), r) && (h.inside += 1);
2308
2308
  }
2309
2309
  }
2310
2310
  });
2311
2311
  let u = /* @__PURE__ */ new Map();
2312
2312
  return c.forEach((e) => {
2313
- e.total > 0 && e.total === e.inside && pr(u, e.modelID, e.id);
2313
+ e.total > 0 && e.total === e.inside && mr(u, e.modelID, e.id);
2314
2314
  }), o && (o.containedIdsMs += performance.now() - s), u;
2315
2315
  }
2316
- function _r({ model: e, camera: t, clippingPlanes: n = [], domElement: r, rect: i, mode: a, profile: o }) {
2316
+ function vr({ model: e, camera: t, clippingPlanes: n = [], domElement: r, rect: i, mode: a, profile: o }) {
2317
2317
  let s = performance.now(), c = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map();
2318
2318
  if (!e) return c;
2319
- let u = Zn(r), d = performance.now();
2319
+ let u = $n(r), d = performance.now();
2320
2320
  e.updateMatrixWorld(!0), t.updateMatrixWorld(), o && (o.matrixUpdateMs += performance.now() - d), e.traverse((e) => {
2321
2321
  let r = e;
2322
2322
  if (!r.isMesh) return;
2323
- if (o && (o.meshCount += 1), !Jn(r)) {
2323
+ if (o && (o.meshCount += 1), !Xn(r)) {
2324
2324
  o && (o.skippedMeshCount += 1);
2325
2325
  return;
2326
2326
  }
@@ -2329,7 +2329,7 @@ function _r({ model: e, camera: t, clippingPlanes: n = [], domElement: r, rect:
2329
2329
  o && (o.skippedMeshCount += 1);
2330
2330
  return;
2331
2331
  }
2332
- let d = performance.now(), f = fr(r, i, t, u);
2332
+ let d = performance.now(), f = pr(r, i, t, u);
2333
2333
  if (o && (o.boundsCheckMs += performance.now() - d), !f) {
2334
2334
  o && (o.skippedMeshCount += 1);
2335
2335
  return;
@@ -2337,26 +2337,26 @@ function _r({ model: e, camera: t, clippingPlanes: n = [], domElement: r, rect:
2337
2337
  let p = performance.now();
2338
2338
  s.shapecast({
2339
2339
  intersectsBounds: (e) => {
2340
- let n = performance.now(), a = lr(r, e, i, t, u);
2340
+ let n = performance.now(), a = ur(r, e, i, t, u);
2341
2341
  return o && (o.intersectsBoundsCalls += 1, o.intersectsBoundsMs += performance.now() - n), a;
2342
2342
  },
2343
2343
  intersectsRange: (e, t, i) => {
2344
2344
  let u = performance.now();
2345
2345
  if (o && (o.intersectsRangeCalls += 1), !i) return o && (o.intersectsRangeMs += performance.now() - u), !1;
2346
- for (let i = e; i < e + t; i++) hr(r, s.resolveTriangleIndex(i), a === "contains" ? l : c, n);
2346
+ for (let i = e; i < e + t; i++) gr(r, s.resolveTriangleIndex(i), a === "contains" ? l : c, n);
2347
2347
  return o && (o.intersectsRangeMs += performance.now() - u), !1;
2348
2348
  },
2349
2349
  intersectsTriangle: (e, s, d) => {
2350
2350
  let f = performance.now();
2351
2351
  if (o && (o.intersectsTriangleCalls += 1), !d) {
2352
- let n = performance.now(), a = cr(r, e.a, t, u), s = cr(r, e.b, t, u), c = cr(r, e.c, t, u);
2353
- if (o && (o.triangleProjectionMs += performance.now() - n), !or(a, s, c, i)) return o && (o.intersectsTriangleMs += performance.now() - f), !1;
2352
+ let n = performance.now(), a = G(r, e.a, t, u), s = G(r, e.b, t, u), c = G(r, e.c, t, u);
2353
+ if (o && (o.triangleProjectionMs += performance.now() - n), !cr(a, s, c, i)) return o && (o.intersectsTriangleMs += performance.now() - f), !1;
2354
2354
  }
2355
- return a === "contains" ? hr(r, s, l, n) : hr(r, s, c, n), o && (o.intersectsTriangleMs += performance.now() - f), !1;
2355
+ return a === "contains" ? gr(r, s, l, n) : gr(r, s, c, n), o && (o.intersectsTriangleMs += performance.now() - f), !1;
2356
2356
  }
2357
2357
  }), o && (o.shapecastMs += performance.now() - p);
2358
2358
  });
2359
- let f = a === "contains" ? gr({
2359
+ let f = a === "contains" ? _r({
2360
2360
  model: e,
2361
2361
  camera: t,
2362
2362
  clippingPlanes: n,
@@ -2365,19 +2365,19 @@ function _r({ model: e, camera: t, clippingPlanes: n = [], domElement: r, rect:
2365
2365
  candidateIdsByModel: l,
2366
2366
  profile: o
2367
2367
  }) : c;
2368
- return o && (o.candidateIds = mr(l), o.selectedIds = mr(f), o.totalMs = performance.now() - s), f;
2368
+ return o && (o.candidateIds = hr(l), o.selectedIds = hr(f), o.totalMs = performance.now() - s), f;
2369
2369
  }
2370
- function vr(e) {
2371
- let t = Qn(e.mode);
2370
+ function yr(e) {
2371
+ let t = er(e.mode);
2372
2372
  return {
2373
- ids: _r({
2373
+ ids: vr({
2374
2374
  ...e,
2375
2375
  profile: t
2376
2376
  }),
2377
2377
  profile: t
2378
2378
  };
2379
2379
  }
2380
- function yr(e) {
2380
+ function br(e) {
2381
2381
  return e === "contains" ? {
2382
2382
  border: "rgb(37, 99, 235)",
2383
2383
  background: "rgba(37, 99, 235, 0.16)"
@@ -2386,32 +2386,32 @@ function yr(e) {
2386
2386
  background: "rgba(22, 163, 74, 0.16)"
2387
2387
  };
2388
2388
  }
2389
- function br(e, t, n) {
2390
- let r = yr(er(t, n));
2389
+ function xr(e, t, n) {
2390
+ let r = br(nr(t, n));
2391
2391
  if (!e.current) {
2392
2392
  let t = document.createElement("div");
2393
2393
  t.style.position = "fixed", t.style.pointerEvents = "none", t.style.zIndex = "10", e.current = t, document.body.appendChild(t);
2394
2394
  }
2395
- let i = $n(t, n);
2395
+ let i = tr(t, n);
2396
2396
  e.current.style.border = `1px solid ${r.border}`, e.current.style.background = r.background, e.current.style.left = `${i.minX}px`, e.current.style.top = `${i.minY}px`, e.current.style.width = `${i.maxX - i.minX}px`, e.current.style.height = `${i.maxY - i.minY}px`;
2397
2397
  }
2398
- function xr(e) {
2398
+ function Sr(e) {
2399
2399
  e.current?.remove(), e.current = null;
2400
2400
  }
2401
2401
  //#endregion
2402
2402
  //#region src/viewer/Selector/useSelector.tsx
2403
- var Sr = 40;
2404
- function Cr(e) {
2403
+ var Cr = 40;
2404
+ function wr(e) {
2405
2405
  if (!Array.isArray(e)) return e.userData.shader;
2406
2406
  }
2407
- function wr(e, t) {
2408
- let n = Cr(e)?.uniforms.preSelectionId;
2407
+ function Tr(e, t) {
2408
+ let n = wr(e)?.uniforms.preSelectionId;
2409
2409
  n && (n.value = t);
2410
2410
  }
2411
- function Tr(e) {
2411
+ function Er(e) {
2412
2412
  return Number(e.current?.modelID ?? 0);
2413
2413
  }
2414
- function Er(e) {
2414
+ function Dr(e) {
2415
2415
  let t = e;
2416
2416
  for (; t;) {
2417
2417
  let e = t.modelID ?? t.userData.modelID;
@@ -2420,7 +2420,7 @@ function Er(e) {
2420
2420
  }
2421
2421
  return 0;
2422
2422
  }
2423
- function Dr(e) {
2423
+ function Or(e) {
2424
2424
  let t = e;
2425
2425
  for (; t;) {
2426
2426
  if (!t.visible) return !1;
@@ -2428,20 +2428,20 @@ function Dr(e) {
2428
2428
  }
2429
2429
  return !0;
2430
2430
  }
2431
- function Or(e) {
2432
- if (!Dr(e.object) || !(e.object instanceof P) || e.faceIndex === void 0 || e.faceIndex === null) return !1;
2431
+ function kr(e) {
2432
+ if (!Or(e.object) || !(e.object instanceof M) || e.faceIndex === void 0 || e.faceIndex === null) return !1;
2433
2433
  let t = e.object.geometry;
2434
2434
  return !!(t.index && t.attributes.ids);
2435
2435
  }
2436
- function kr(e, t, n) {
2437
- let r = l("end"), i = B((e) => e.selected), a = B((e) => e.setSelected), s = B((e) => e.addSelected), c = B((e) => e.removeSelected), u = B((e) => e.showStats), d = Te(), f = l(null), m = l(null), h = l(!1), g = l(!1), _ = l("add"), v = l(null), y = l(!1), b = l(0), x = l(null), S = l(null), C = () => d.getState().selectionInteractionDisabled, w = () => {
2436
+ function Ar(e, t, n) {
2437
+ let r = l("end"), i = L((e) => e.selected), a = L((e) => e.setSelected), s = L((e) => e.addSelected), c = L((e) => e.removeSelected), u = L((e) => e.showStats), d = R(), f = l(null), m = l(null), h = l(!1), g = l(!1), _ = l("add"), v = l(null), y = l(!1), b = l(0), x = l(null), S = l(null), C = () => d.getState().selectionInteractionDisabled, w = () => {
2438
2438
  e.current?.traverse((e) => {
2439
- if (!(e instanceof P)) return;
2439
+ if (!(e instanceof M)) return;
2440
2440
  let t = e;
2441
- t.preselected = !1, wr(t.material, -1);
2441
+ t.preselected = !1, Tr(t.material, -1);
2442
2442
  });
2443
2443
  }, T = () => {
2444
- f.current = null, h.current = !1, xr(m), t.current && (t.current.enabled = !0);
2444
+ f.current = null, h.current = !1, Sr(m), t.current && (t.current.enabled = !0);
2445
2445
  }, E = (t) => {
2446
2446
  if (C()) {
2447
2447
  w();
@@ -2455,47 +2455,47 @@ function kr(e, t, n) {
2455
2455
  w();
2456
2456
  return;
2457
2457
  }
2458
- let n = re(t, e.current)[0], i;
2458
+ let n = oe(t, e.current)[0], i;
2459
2459
  n && (i = n.object), w(), !(!n || !i) && e.current?.traverse((e) => {
2460
- if (!(e instanceof P)) return;
2460
+ if (!(e instanceof M)) return;
2461
2461
  let t = e;
2462
2462
  if (t !== i) return;
2463
2463
  let r = n.faceIndex * 3, a = t.geometry.index.getX(r), o = t.geometry.attributes.ids.getX(a);
2464
- t.preselected = !0, wr(t.material, o);
2464
+ t.preselected = !0, Tr(t.material, o);
2465
2465
  });
2466
2466
  };
2467
2467
  function D() {
2468
2468
  return performance.now();
2469
2469
  }
2470
- let O = (e) => {
2470
+ let ee = (e) => {
2471
2471
  if (C()) {
2472
2472
  S.current = null, x.current !== null && (window.clearTimeout(x.current), x.current = null), w();
2473
2473
  return;
2474
2474
  }
2475
2475
  if (S.current = e, x.current !== null) return;
2476
- let t = D() - b.current, n = Math.max(0, Sr - t);
2476
+ let t = D() - b.current, n = Math.max(0, Cr - t);
2477
2477
  x.current = window.setTimeout(() => {
2478
2478
  x.current = null;
2479
2479
  let e = S.current;
2480
2480
  S.current = null, e && (b.current = performance.now(), E(e));
2481
2481
  }, n);
2482
- }, k = l(null);
2482
+ }, O = l(null);
2483
2483
  o(() => {
2484
2484
  let e = v.current;
2485
2485
  if (e) {
2486
- u && k.current !== null && console.log(`selection ${e.action}:`, Date.now() - k.current, "ms"), v.current = null, k.current = null;
2486
+ u && O.current !== null && console.log(`selection ${e.action}:`, Date.now() - O.current, "ms"), v.current = null, O.current = null;
2487
2487
  return;
2488
2488
  }
2489
- u && k.current !== null && (console.log("selection spend:", Date.now() - k.current, "ms"), k.current = null);
2489
+ u && O.current !== null && (console.log("selection spend:", Date.now() - O.current, "ms"), O.current = null);
2490
2490
  }, [i, u]);
2491
- let { camera: ee, gl: A } = p();
2492
- function j() {
2491
+ let { camera: te, gl: k } = p();
2492
+ function ne() {
2493
2493
  return Date.now();
2494
2494
  }
2495
- let M = (e) => {
2496
- let t = A.domElement.getBoundingClientRect();
2495
+ let A = (e) => {
2496
+ let t = k.domElement.getBoundingClientRect();
2497
2497
  return e.clientX >= t.left && e.clientX <= t.right && e.clientY >= t.top && e.clientY <= t.bottom;
2498
- }, te = (t) => {
2498
+ }, re = (t) => {
2499
2499
  if (C()) {
2500
2500
  y.current = !1, g.current = !1, w();
2501
2501
  return;
@@ -2505,15 +2505,15 @@ function kr(e, t, n) {
2505
2505
  g.current = !1;
2506
2506
  return;
2507
2507
  }
2508
- if (!M(t)) return;
2509
- if (k.current = j(), r.current !== "end" && r.current !== "start" && r.current > 15) {
2508
+ if (!A(t)) return;
2509
+ if (O.current = ne(), r.current !== "end" && r.current !== "start" && r.current > 15) {
2510
2510
  r.current = "end";
2511
2511
  return;
2512
2512
  }
2513
- let n = t.shiftKey, o = t.ctrlKey, l = re(t, e.current), u, d = Tr(e);
2513
+ let n = t.shiftKey, o = t.ctrlKey, l = oe(t, e.current), u, d = Er(e);
2514
2514
  if (l.length) {
2515
2515
  let e = l[0], t = e.object;
2516
- d = Er(t);
2516
+ d = Dr(t);
2517
2517
  let n = e.faceIndex * 3, r = t.geometry.index.getX(n);
2518
2518
  u = t.geometry.attributes.ids.getX(r);
2519
2519
  }
@@ -2525,33 +2525,33 @@ function kr(e, t, n) {
2525
2525
  return;
2526
2526
  }
2527
2527
  a(d, u === void 0 ? [] : [u], !0);
2528
- }, N = (e) => {
2529
- C() || e.button !== 0 || !e.shiftKey && !e.ctrlKey || (f.current = new I(e.clientX, e.clientY), _.current = e.ctrlKey ? "remove" : "add", h.current = !1, t.current && (t.current.enabled = !1));
2530
- }, F = (e) => {
2528
+ }, j = (e) => {
2529
+ C() || e.button !== 0 || !e.shiftKey && !e.ctrlKey || (f.current = new N(e.clientX, e.clientY), _.current = e.ctrlKey ? "remove" : "add", h.current = !1, t.current && (t.current.enabled = !1));
2530
+ }, ie = (e) => {
2531
2531
  if (C()) {
2532
2532
  T();
2533
2533
  return;
2534
2534
  }
2535
2535
  if (!f.current) return;
2536
- let t = new I(e.clientX, e.clientY), n = Math.abs(t.x - f.current.x), r = Math.abs(t.y - f.current.y);
2537
- n < 6 && r < 6 || (h.current ||= !0, e.preventDefault(), br(m, f.current, t));
2538
- }, ne = (r) => {
2536
+ let t = new N(e.clientX, e.clientY), n = Math.abs(t.x - f.current.x), r = Math.abs(t.y - f.current.y);
2537
+ n < 6 && r < 6 || (h.current ||= !0, e.preventDefault(), xr(m, f.current, t));
2538
+ }, ae = (r) => {
2539
2539
  if (C()) {
2540
2540
  T();
2541
2541
  return;
2542
2542
  }
2543
2543
  if (!f.current) return;
2544
- k.current = j();
2545
- let i = h.current, a = new I(r.clientX, r.clientY), o = $n(f.current, a), l = er(f.current, a);
2546
- if (f.current = null, h.current = !1, xr(m), t.current && setTimeout(() => {
2544
+ O.current = ne();
2545
+ let i = h.current, a = new N(r.clientX, r.clientY), o = tr(f.current, a), l = nr(f.current, a);
2546
+ if (f.current = null, h.current = !1, Sr(m), t.current && setTimeout(() => {
2547
2547
  t.current && (t.current.enabled = !0);
2548
2548
  }, 100), !i) return;
2549
2549
  g.current = !0, r.preventDefault();
2550
- let { ids: u, profile: d } = vr({
2550
+ let { ids: u, profile: d } = yr({
2551
2551
  model: e.current,
2552
- camera: ee,
2552
+ camera: te,
2553
2553
  clippingPlanes: n.getActiveClippingPlanes(),
2554
- domElement: A.domElement,
2554
+ domElement: k.domElement,
2555
2555
  rect: o,
2556
2556
  mode: l
2557
2557
  }), p = Array.from(u.values()).reduce((e, t) => e + t.size, 0), y = {
@@ -2563,16 +2563,16 @@ function kr(e, t, n) {
2563
2563
  let n = Array.from(e);
2564
2564
  _.current === "remove" ? c(t, n) : s(t, n);
2565
2565
  }));
2566
- }, re = (e, t) => t ? n.getIntersection(!1, {
2566
+ }, oe = (e, t) => t ? n.getIntersection(!1, {
2567
2567
  event: e,
2568
- filter: Or,
2568
+ filter: kr,
2569
2569
  object: t,
2570
2570
  recursive: !0
2571
2571
  }) : [];
2572
2572
  o(() => {
2573
2573
  let e = t.current;
2574
2574
  if (!e) return;
2575
- A.domElement.addEventListener("pointerdown", N), A.domElement.addEventListener("pointermove", F), window.addEventListener("pointerup", ne), window.addEventListener("pointerup", te), A.domElement.addEventListener("contextmenu", o), A.domElement.addEventListener("pointerup", a), A.domElement.addEventListener("pointermove", O), A.domElement.addEventListener("pointerleave", w), A.domElement.addEventListener("pointerdown", i), e.addEventListener("change", n);
2575
+ k.domElement.addEventListener("pointerdown", j), k.domElement.addEventListener("pointermove", ie), window.addEventListener("pointerup", ae), window.addEventListener("pointerup", re), k.domElement.addEventListener("contextmenu", o), k.domElement.addEventListener("pointerup", a), k.domElement.addEventListener("pointermove", ee), k.domElement.addEventListener("pointerleave", w), k.domElement.addEventListener("pointerdown", i), e.addEventListener("change", n);
2576
2576
  function n() {
2577
2577
  typeof r.current == "number" ? r.current += 1 : r.current === "start" && (r.current = 1);
2578
2578
  }
@@ -2588,35 +2588,35 @@ function kr(e, t, n) {
2588
2588
  e.ctrlKey && e.preventDefault();
2589
2589
  }
2590
2590
  return () => {
2591
- xr(m), x.current !== null && (window.clearTimeout(x.current), x.current = null), S.current = null, w(), e.removeEventListener("change", n), A.domElement.removeEventListener("pointerdown", N), A.domElement.removeEventListener("pointermove", F), window.removeEventListener("pointerup", ne), window.removeEventListener("pointerup", te), A.domElement.removeEventListener("contextmenu", o), A.domElement.removeEventListener("pointerup", a), A.domElement.removeEventListener("pointerdown", i), A.domElement.removeEventListener("pointermove", O), A.domElement.removeEventListener("pointerleave", w);
2591
+ Sr(m), x.current !== null && (window.clearTimeout(x.current), x.current = null), S.current = null, w(), e.removeEventListener("change", n), k.domElement.removeEventListener("pointerdown", j), k.domElement.removeEventListener("pointermove", ie), window.removeEventListener("pointerup", ae), window.removeEventListener("pointerup", re), k.domElement.removeEventListener("contextmenu", o), k.domElement.removeEventListener("pointerup", a), k.domElement.removeEventListener("pointerdown", i), k.domElement.removeEventListener("pointermove", ee), k.domElement.removeEventListener("pointerleave", w);
2592
2592
  };
2593
2593
  });
2594
2594
  }
2595
2595
  //#endregion
2596
2596
  //#region src/viewer/Camera/useCameraFit.tsx
2597
- var Ar = new L(1, 1, 1).normalize(), jr = 1.18;
2598
- function Mr() {
2597
+ var jr = new P(1, 1, 1).normalize(), Mr = 1.18;
2598
+ function Nr() {
2599
2599
  let { camera: e } = p();
2600
2600
  return i((t, n, r) => {
2601
- if (!t.current || !(e instanceof oe)) return;
2601
+ if (!t.current || !(e instanceof le)) return;
2602
2602
  let i = new g().setFromObject(t.current);
2603
2603
  if (i.isEmpty()) return;
2604
- let a = i.getCenter(new L()), o = i.getBoundingSphere(new ue()), s = te.degToRad(e.fov), c = 2 * Math.atan(Math.tan(s / 2) * e.aspect), l = Math.min(s, c), u = o.radius / Math.sin(l / 2) * jr;
2605
- e.position.copy(a).addScaledVector(Ar, u), e.up.set(0, 1, 0), e.lookAt(a), e.updateProjectionMatrix(), n.current && (n.current.target.copy(a), n.current.update()), r.current && (r.current.position.copy(a).addScaledVector(Ar, u * .8), r.current.lookAt(a));
2604
+ let a = i.getCenter(new P()), o = i.getBoundingSphere(new pe()), s = re.degToRad(e.fov), c = 2 * Math.atan(Math.tan(s / 2) * e.aspect), l = Math.min(s, c), u = o.radius / Math.sin(l / 2) * Mr;
2605
+ e.position.copy(a).addScaledVector(jr, u), e.up.set(0, 1, 0), e.lookAt(a), e.updateProjectionMatrix(), n.current && (n.current.target.copy(a), n.current.update()), r.current && (r.current.position.copy(a).addScaledVector(jr, u * .8), r.current.lookAt(a));
2606
2606
  }, [e]);
2607
2607
  }
2608
2608
  //#endregion
2609
2609
  //#region src/viewer/store/ViewerStoreProvider.tsx
2610
- function Nr({ children: e, store: t }) {
2611
- let [n] = u(() => t ?? ke());
2612
- return /* @__PURE__ */ R(we.Provider, {
2610
+ function Pr({ children: e, store: t }) {
2611
+ let [n] = u(() => t ?? je());
2612
+ return /* @__PURE__ */ F(De.Provider, {
2613
2613
  value: n,
2614
2614
  children: e
2615
2615
  });
2616
2616
  }
2617
2617
  //#endregion
2618
2618
  //#region src/viewer/utils/ExportUtils/ExportUtils.ts
2619
- var Pr = new TextEncoder(), Fr = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>", Ir = "Unknown", Lr = ["elementID", "ifcguid"], Rr = 0, zr = 33;
2619
+ var K = new TextEncoder(), Fr = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>", Ir = "Unknown", Lr = ["elementID", "ifcguid"], Rr = 0, zr = 33;
2620
2620
  function Br(e) {
2621
2621
  return !!e && typeof e == "object" && !Array.isArray(e);
2622
2622
  }
@@ -2840,7 +2840,7 @@ function gi(e) {
2840
2840
  let n = {
2841
2841
  ...e,
2842
2842
  crc: di(e.data),
2843
- nameBytes: Pr.encode(e.path),
2843
+ nameBytes: K.encode(e.path),
2844
2844
  offset: t
2845
2845
  };
2846
2846
  return t += 30 + n.nameBytes.length + n.data.length, n;
@@ -2877,23 +2877,23 @@ function vi(e, t = {}) {
2877
2877
  let n = _i(e, t.emptyValue ?? "-"), r = n.map((e) => e.name), i = [
2878
2878
  {
2879
2879
  path: "[Content_Types].xml",
2880
- data: Pr.encode(ci(r))
2880
+ data: K.encode(ci(r))
2881
2881
  },
2882
2882
  {
2883
2883
  path: "_rels/.rels",
2884
- data: Pr.encode(si())
2884
+ data: K.encode(si())
2885
2885
  },
2886
2886
  {
2887
2887
  path: "xl/workbook.xml",
2888
- data: Pr.encode(ai(r))
2888
+ data: K.encode(ai(r))
2889
2889
  },
2890
2890
  {
2891
2891
  path: "xl/_rels/workbook.xml.rels",
2892
- data: Pr.encode(oi(r))
2892
+ data: K.encode(oi(r))
2893
2893
  },
2894
2894
  ...n.map((e, t) => ({
2895
2895
  path: `xl/worksheets/sheet${t + 1}.xml`,
2896
- data: Pr.encode(ni(e.rows))
2896
+ data: K.encode(ni(e.rows))
2897
2897
  }))
2898
2898
  ];
2899
2899
  return new Blob([gi(i)], { type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" });
@@ -3227,7 +3227,7 @@ var wi = "BMT", Ti = 1, J = {
3227
3227
  let t = /* @__PURE__ */ new Map();
3228
3228
  return (Array.isArray(e) ? e : [e]).forEach((e) => {
3229
3229
  e.traverse((e) => {
3230
- if (!(e instanceof P) || !this.isIfcSpaceObject(e)) return;
3230
+ if (!(e instanceof M) || !this.isIfcSpaceObject(e)) return;
3231
3231
  let n = this.getObjectModelID(e);
3232
3232
  if (n === null) return;
3233
3233
  let r = e.geometry.getAttribute("ids");
@@ -3241,7 +3241,7 @@ var wi = "BMT", Ti = 1, J = {
3241
3241
  addVisibleIdsFromObject3D(e, t) {
3242
3242
  (Array.isArray(e) ? e : [e]).forEach((e) => {
3243
3243
  e.traverse((e) => {
3244
- if (!(e instanceof P) || !this.isObjectVisible(e)) return;
3244
+ if (!(e instanceof M) || !this.isObjectVisible(e)) return;
3245
3245
  let n = this.getObjectModelID(e);
3246
3246
  if (n === null) return;
3247
3247
  let r = e.geometry.getAttribute("ids");
@@ -3293,7 +3293,7 @@ var wi = "BMT", Ti = 1, J = {
3293
3293
  return this.deflateBytes(new Uint8Array(e.buffer, e.byteOffset, e.byteLength));
3294
3294
  }
3295
3295
  deflateBytes(e) {
3296
- return Ce.deflate(e);
3296
+ return Ee.deflate(e);
3297
3297
  }
3298
3298
  encodeText(e) {
3299
3299
  return this.textEncoder.encode(e);
@@ -3671,9 +3671,9 @@ var qi = class {
3671
3671
  }
3672
3672
  }, Ji = class {
3673
3673
  decodeBuffer(e) {
3674
- return this.textDecoder.decode(Ce.inflate(e));
3674
+ return this.textDecoder.decode(Ee.inflate(e));
3675
3675
  }
3676
- decoder = Ce;
3676
+ decoder = Ee;
3677
3677
  textDecoder = new TextDecoder("utf-8");
3678
3678
  ChunkType = {
3679
3679
  PROP: 1,
@@ -4124,7 +4124,7 @@ var Ca = new class {
4124
4124
  }
4125
4125
  return i;
4126
4126
  }
4127
- }(), wa = .5, X = .04, Z = .16, Ta = Z, Q = wa * 2 - Z * 2, Ea = wa - X / 2, Da = wa - Z / 2, Oa = wa - Ta / 2, ka = .63, Aa = "#dfe6ec", ja = 260, Ma = 52, Na = .17, Pa = new g(), $ = new ue(), Fa = [
4127
+ }(), wa = .5, X = .04, Z = .16, Ta = Z, Q = wa * 2 - Z * 2, Ea = wa - X / 2, Da = wa - Z / 2, Oa = wa - Ta / 2, ka = .63, Aa = "#dfe6ec", ja = 260, Ma = 52, Na = .17, Pa = new g(), $ = new pe(), Fa = [
4128
4128
  {
4129
4129
  direction: [
4130
4130
  0,
@@ -4386,17 +4386,17 @@ function Va(e, t) {
4386
4386
  let a = r.measureText(e), o = a.actualBoundingBoxAscent || Ma * .8, s = a.actualBoundingBoxDescent || Ma * .2, c = Math.ceil(a.width + 36), l = Math.ceil(o + s + 20);
4387
4387
  n.width = c, n.height = l, r.clearRect(0, 0, c, l), r.font = i, r.fillStyle = t, r.textAlign = "center", r.textBaseline = "alphabetic", r.fillText(e, c / 2, 10 + o);
4388
4388
  let u = new b(n);
4389
- return u.colorSpace = le, u.generateMipmaps = !1, u.magFilter = M, u.minFilter = M, u.needsUpdate = !0, {
4389
+ return u.colorSpace = fe, u.generateMipmaps = !1, u.magFilter = A, u.minFilter = A, u.needsUpdate = !0, {
4390
4390
  aspect: c / l,
4391
4391
  texture: u
4392
4392
  };
4393
4393
  }
4394
4394
  function Ha({ color: e, label: t, position: n, rotation: r }) {
4395
4395
  let { aspect: i, texture: a } = c(() => Va(t, e), [e, t]);
4396
- return o(() => () => a.dispose(), [a]), /* @__PURE__ */ z("mesh", {
4396
+ return o(() => () => a.dispose(), [a]), /* @__PURE__ */ I("mesh", {
4397
4397
  position: n,
4398
4398
  rotation: r,
4399
- children: [/* @__PURE__ */ R("planeGeometry", { args: [Na * i, Na] }), /* @__PURE__ */ R("meshBasicMaterial", {
4399
+ children: [/* @__PURE__ */ F("planeGeometry", { args: [Na * i, Na] }), /* @__PURE__ */ F("meshBasicMaterial", {
4400
4400
  alphaTest: .1,
4401
4401
  depthWrite: !1,
4402
4402
  map: a,
@@ -4406,17 +4406,17 @@ function Ha({ color: e, label: t, position: n, rotation: r }) {
4406
4406
  });
4407
4407
  }
4408
4408
  function Ua(e) {
4409
- return Math.abs(e.y) > .9 ? new L(0, 0, e.y > 0 ? -1 : 1) : new L(0, 1, 0);
4409
+ return Math.abs(e.y) > .9 ? new P(0, 0, e.y > 0 ? -1 : 1) : new P(0, 1, 0);
4410
4410
  }
4411
4411
  function Wa(e, t) {
4412
4412
  let n = e.current;
4413
4413
  return !n || (n.updateWorldMatrix(!0, !0), Pa.setFromObject(n), Pa.isEmpty()) ? ($.center.copy(t), $.radius = 10, $) : (Pa.getBoundingSphere($), (!Number.isFinite($.radius) || $.radius <= 0) && ($.radius = 10), $);
4414
4414
  }
4415
4415
  function Ga(e) {
4416
- return e.current?.target.clone() ?? new L();
4416
+ return e.current?.target.clone() ?? new P();
4417
4417
  }
4418
4418
  function Ka({ camera: e, controlRef: t, direction: n, modelRef: r, transitionRef: i }) {
4419
- let a = Ga(t), o = Wa(r, a), s = o.center.clone(), c = new L(...n).normalize(), l = e.position.distanceTo(a), u = Number.isFinite(l) && l > o.radius * .5 ? l : o.radius * 2.4;
4419
+ let a = Ga(t), o = Wa(r, a), s = o.center.clone(), c = new P(...n).normalize(), l = e.position.distanceTo(a), u = Number.isFinite(l) && l > o.radius * .5 ? l : o.radius * 2.4;
4420
4420
  i.current = {
4421
4421
  endPosition: s.clone().addScaledVector(c, u),
4422
4422
  endTarget: s,
@@ -4429,7 +4429,7 @@ function Ka({ camera: e, controlRef: t, direction: n, modelRef: r, transitionRef
4429
4429
  }
4430
4430
  function qa({ action: e, onPick: t }) {
4431
4431
  let [n, r] = u(!1);
4432
- return /* @__PURE__ */ z("group", {
4432
+ return /* @__PURE__ */ I("group", {
4433
4433
  position: e.position,
4434
4434
  onClick: Ra,
4435
4435
  onPointerDown: (n) => {
@@ -4441,18 +4441,18 @@ function qa({ action: e, onPick: t }) {
4441
4441
  onPointerLeave: (e) => {
4442
4442
  Ra(e), r(!1);
4443
4443
  },
4444
- children: [/* @__PURE__ */ z("mesh", {
4444
+ children: [/* @__PURE__ */ I("mesh", {
4445
4445
  scale: e.scale,
4446
- children: [/* @__PURE__ */ R("boxGeometry", { args: [
4446
+ children: [/* @__PURE__ */ F("boxGeometry", { args: [
4447
4447
  1,
4448
4448
  1,
4449
4449
  1
4450
- ] }), /* @__PURE__ */ R("meshBasicMaterial", {
4450
+ ] }), /* @__PURE__ */ F("meshBasicMaterial", {
4451
4451
  color: za(n),
4452
4452
  opacity: Ba(n),
4453
4453
  transparent: !0
4454
4454
  })]
4455
- }), e.label && /* @__PURE__ */ R(Ha, {
4455
+ }), e.label && /* @__PURE__ */ F(Ha, {
4456
4456
  color: n ? "#ffffff" : "#50606f",
4457
4457
  label: e.label,
4458
4458
  position: [
@@ -4479,10 +4479,10 @@ function Ja({ active: e = !0, cameraRef: t, controlRef: n, modelRef: r }) {
4479
4479
  if (!o) return;
4480
4480
  let s = performance.now() - o.startTime, c = Math.min(s / ja, 1), l = 1 - (1 - c) ** 3, u = n.current;
4481
4481
  r.position.lerpVectors(o.startPosition, o.endPosition, l), r.up.lerpVectors(o.startUp, o.endUp, l), u ? (u.target.lerpVectors(o.startTarget, o.endTarget, l), u.update()) : r.lookAt(o.endTarget), c >= 1 && (r.up.copy(o.endUp), u?.target.copy(o.endTarget), u?.update(), a.current = null);
4482
- }), e ? /* @__PURE__ */ R("group", {
4482
+ }), e ? /* @__PURE__ */ F("group", {
4483
4483
  ref: i,
4484
4484
  scale: ka,
4485
- children: o.map((e) => /* @__PURE__ */ R(qa, {
4485
+ children: o.map((e) => /* @__PURE__ */ F(qa, {
4486
4486
  action: e,
4487
4487
  onPick: (e) => {
4488
4488
  let i = t.current;
@@ -4499,7 +4499,13 @@ function Ja({ active: e = !0, cameraRef: t, controlRef: n, modelRef: r }) {
4499
4499
  }
4500
4500
  //#endregion
4501
4501
  //#region src/viewer/Viewer.tsx
4502
- var Ya = {
4502
+ var Ya = class {
4503
+ sceneApi = null;
4504
+ get = () => this.sceneApi;
4505
+ set = (e) => {
4506
+ this.sceneApi = e;
4507
+ };
4508
+ }, Xa = {
4503
4509
  bottom: 16,
4504
4510
  height: 96,
4505
4511
  pointerEvents: "auto",
@@ -4508,11 +4514,11 @@ var Ya = {
4508
4514
  touchAction: "none",
4509
4515
  width: 96,
4510
4516
  zIndex: 2
4511
- }, Xa = {
4517
+ }, Za = {
4512
4518
  height: "100%",
4513
4519
  position: "relative",
4514
4520
  width: "100%"
4515
- }, Za = {
4521
+ }, Qa = {
4516
4522
  far: 50,
4517
4523
  near: .1,
4518
4524
  position: [
@@ -4521,132 +4527,136 @@ var Ya = {
4521
4527
  10
4522
4528
  ],
4523
4529
  zoom: 72
4524
- }, Qa = {
4530
+ }, $a = {
4525
4531
  alpha: !0,
4526
4532
  antialias: !0
4527
4533
  };
4528
- function $a() {
4534
+ function eo() {
4529
4535
  let e = navigator, t = navigator.userAgent.toLowerCase(), n = navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1, r = window.matchMedia?.("(pointer: coarse)").matches ?? !1;
4530
4536
  return e.userAgentData?.mobile || n || /android|iphone|ipad|ipod|mobile|tablet/.test(t) || navigator.maxTouchPoints > 1 && r ? "mobile" : "pc";
4531
4537
  }
4532
- function eo({ cameraRef: e, controlRef: t, lightRef: n, modelRef: r, modelsData: i, onReady: a, publicApi: s, setSceneApi: u }) {
4533
- let d = p((e) => e.camera), f = At(r), g = Vt(f), { colorPaletteTexture: _, colorUtils: v } = Ue(f), y = Ln(r), b = hn(r, t, y), x = An(r, t, y), S = c(() => new ki(), []), C = g.buildIndex, w = f.resetIndex, T = v.applyStoredColors, E = Mr(), D = l(!1), O = B((e) => e.showStats), k = c(() => {
4534
- let e = Object.keys(i).sort((e, t) => Number(e) - Number(t));
4538
+ function to({ autoFitCamera: e, cameraRef: t, controlRef: n, lightRef: r, modelRef: i, modelsData: a, onReady: s, publicApi: u, setSceneApi: d }) {
4539
+ let f = p((e) => e.camera), g = Mt(i), _ = Ut(g), { colorPaletteTexture: v, colorUtils: y } = Ge(g), b = zn(i), x = _n(i, n, b), S = Mn(i, n, b), C = c(() => new ki(), []), w = _.buildIndex, T = g.resetIndex, E = y.applyStoredColors, D = Nr(), ee = l(!1), O = L((e) => e.showStats), te = c(() => {
4540
+ let e = Object.keys(a).sort((e, t) => Number(e) - Number(t));
4535
4541
  for (let t of e) {
4536
- let e = bt(i[Number(t)]);
4542
+ let e = St(a[Number(t)]);
4537
4543
  if (e) return e;
4538
4544
  }
4539
4545
  return null;
4540
- }, [i]), ee = c(() => vt(k ?? void 0), [k]), A = c(() => Object.entries(i).map(([e, t]) => [Number(e), t]), [i]), j = c(() => {
4546
+ }, [a]), k = c(() => bt(te ?? void 0), [te]), ne = c(() => Object.entries(a).map(([e, t]) => [Number(e), t]), [a]), A = c(() => {
4541
4547
  let e = (e) => ({
4542
4548
  ...e,
4543
- activeViewRoot: r.current
4549
+ activeViewRoot: i.current
4544
4550
  });
4545
4551
  return {
4546
- convertIfcFileToBmt: (e, t) => S.ConvertIfcFileToBmt(e, t),
4547
- convertToBmt: (t) => S.ConvertToBmt(i, e(t))
4552
+ convertIfcFileToBmt: (e, t) => C.ConvertIfcFileToBmt(e, t),
4553
+ convertToBmt: (t) => C.ConvertToBmt(a, e(t))
4548
4554
  };
4549
4555
  }, [
4550
- S,
4551
- r,
4552
- i
4556
+ C,
4557
+ i,
4558
+ a
4553
4559
  ]);
4554
- return kr(r, t, y), Mn(), o(() => (y.setClippingSource(b), () => {
4555
- y.setClippingSource(null);
4556
- }), [y, b]), o(() => (e.current = d, () => {
4557
- e.current === d && (e.current = null);
4558
- }), [d, e]), o(() => {
4559
- if (!r.current) return;
4560
- let e = requestAnimationFrame(() => {
4561
- r.current?.updateMatrixWorld(!0), w(), C(), T(), b.syncWithModel(), x.syncWithModel(), E(r, t, n);
4560
+ return Ar(i, n, b), Pn(), o(() => (b.setClippingSource(x), () => {
4561
+ b.setClippingSource(null);
4562
+ }), [b, x]), o(() => (t.current = f, () => {
4563
+ t.current === f && (t.current = null);
4564
+ }), [f, t]), o(() => {
4565
+ if (!i.current) return;
4566
+ let t = requestAnimationFrame(() => {
4567
+ i.current?.updateMatrixWorld(!0), T(), w(), E(), x.syncWithModel(), S.syncWithModel(), e && D(i, n, r);
4562
4568
  });
4563
- return () => cancelAnimationFrame(e);
4569
+ return () => cancelAnimationFrame(t);
4564
4570
  }, [
4565
- T,
4566
- C,
4567
- b,
4568
- t,
4569
- x,
4570
4571
  E,
4572
+ e,
4573
+ w,
4574
+ x,
4571
4575
  n,
4576
+ S,
4577
+ D,
4572
4578
  r,
4573
4579
  i,
4574
- w
4575
- ]), o(() => (u({
4580
+ a,
4581
+ T
4582
+ ]), o(() => (d({
4576
4583
  camera: {
4577
- fitCamera: () => E(r, t, n),
4578
- getIntersection: y.getIntersection
4584
+ fitCamera: () => D(i, n, r),
4585
+ getIntersection: b.getIntersection
4579
4586
  },
4580
4587
  clipping: {
4581
- createClippingRectangle: b.createClippingRectangle,
4582
- createPlane: b.createPlane,
4583
- deleteAllPlanes: b.deleteAllPlanes,
4584
- getActive: b.getActive,
4585
- getEdgesActive: b.getEdgesActive,
4586
- getHelpersActive: b.getHelpersActive,
4587
- getPlanes: b.getPlanes,
4588
- setActive: b.setActive,
4589
- setEdgesActive: b.setEdgesActive,
4590
- setHelpersActive: b.setHelpersActive,
4591
- toggle: b.toggle,
4592
- updateEdges: b.updateEdges,
4593
- updateMaterials: b.updateMaterials
4588
+ createClippingRectangle: x.createClippingRectangle,
4589
+ createPlane: x.createPlane,
4590
+ deleteAllPlanes: x.deleteAllPlanes,
4591
+ getActive: x.getActive,
4592
+ getEdgesActive: x.getEdgesActive,
4593
+ getHelpersActive: x.getHelpersActive,
4594
+ getPlanes: x.getPlanes,
4595
+ setActive: x.setActive,
4596
+ setEdgesActive: x.setEdgesActive,
4597
+ setHelpersActive: x.setHelpersActive,
4598
+ toggle: x.toggle,
4599
+ updateEdges: x.updateEdges,
4600
+ updateMaterials: x.updateMaterials
4594
4601
  },
4595
4602
  colors: {
4596
- clearAllColors: v.clearAllColors,
4597
- clearColor: v.clearColor,
4598
- clearModelColors: v.clearModelColors,
4599
- setColor: v.setColor
4603
+ clearAllColors: y.clearAllColors,
4604
+ clearColor: y.clearColor,
4605
+ clearModelColors: y.clearModelColors,
4606
+ setColor: y.setColor
4600
4607
  },
4601
- converter: j,
4608
+ converter: A,
4602
4609
  dimensions: {
4603
- cancelDrawing: x.cancelDrawing,
4604
- changeAxes: x.changeAxes,
4605
- delete: x.delete,
4606
- deleteAll: x.deleteAll,
4607
- getActive: x.getActive,
4608
- getDimensions: x.getDimensions,
4609
- getSnapDistance: x.getSnapDistance,
4610
- getUnit: x.getUnit,
4611
- setActive: x.setActive,
4612
- setColor: x.setColor,
4613
- setEndpointScaleFactor: x.setEndpointScaleFactor,
4614
- setSnapDistance: x.setSnapDistance,
4615
- setUnit: x.setUnit,
4616
- setWidth: x.setWidth,
4617
- toggle: x.toggle
4610
+ cancelDrawing: S.cancelDrawing,
4611
+ changeAxes: S.changeAxes,
4612
+ delete: S.delete,
4613
+ deleteAll: S.deleteAll,
4614
+ getActive: S.getActive,
4615
+ getDimensions: S.getDimensions,
4616
+ getSnapDistance: S.getSnapDistance,
4617
+ getUnit: S.getUnit,
4618
+ setActive: S.setActive,
4619
+ setColor: S.setColor,
4620
+ setEndpointScaleFactor: S.setEndpointScaleFactor,
4621
+ setSnapDistance: S.setSnapDistance,
4622
+ setUnit: S.setUnit,
4623
+ setWidth: S.setWidth,
4624
+ toggle: S.toggle
4618
4625
  },
4619
4626
  geometryUtils: {
4620
- getAllIds: g.getAllIds,
4621
- getIfcSpacesVisibility: g.getIfcSpacesVisibility,
4622
- hideByIds: g.hideByIds,
4623
- hideSelected: g.hideSelected,
4624
- isolateByIds: g.isolateByIds,
4625
- isolateSelected: g.isolateSelected,
4626
- resetIsolation: g.resetIsolation,
4627
- setIfcSpacesVisibility: g.setIfcSpacesVisibility,
4628
- showAll: g.showAll,
4629
- showByIds: g.showByIds,
4630
- toggleIIfcSpacesVisibility: g.toggleIIfcSpacesVisibility
4627
+ getAllIds: _.getAllIds,
4628
+ getIfcSpacesVisibility: _.getIfcSpacesVisibility,
4629
+ hideByIds: _.hideByIds,
4630
+ hideSelected: _.hideSelected,
4631
+ isolateByIds: _.isolateByIds,
4632
+ isolateSelected: _.isolateSelected,
4633
+ resetIsolation: _.resetIsolation,
4634
+ setIfcSpacesVisibility: _.setIfcSpacesVisibility,
4635
+ showAll: _.showAll,
4636
+ showByIds: _.showByIds,
4637
+ toggleIIfcSpacesVisibility: _.toggleIIfcSpacesVisibility
4631
4638
  }
4632
- }), D.current || (D.current = !0, a?.(s)), () => u(null)), [
4639
+ }), ee.current || (ee.current = !0, s?.(u)), () => d(null)), [
4640
+ x,
4633
4641
  b,
4634
4642
  y,
4635
- v,
4636
- j,
4637
- x,
4638
- E,
4639
- g,
4640
- a,
4643
+ n,
4644
+ A,
4645
+ S,
4646
+ D,
4647
+ _,
4648
+ r,
4649
+ i,
4641
4650
  s,
4642
- u
4643
- ]), /* @__PURE__ */ z(Se, { children: [
4644
- /* @__PURE__ */ R("ambientLight", {
4651
+ u,
4652
+ d
4653
+ ]), /* @__PURE__ */ I(Te, { children: [
4654
+ /* @__PURE__ */ F("ambientLight", {
4645
4655
  intensity: 1.2,
4646
4656
  color: "#ffffff"
4647
4657
  }),
4648
- /* @__PURE__ */ R("directionalLight", {
4649
- ref: n,
4658
+ /* @__PURE__ */ F("directionalLight", {
4659
+ ref: r,
4650
4660
  position: [
4651
4661
  10,
4652
4662
  10,
@@ -4655,102 +4665,103 @@ function eo({ cameraRef: e, controlRef: t, lightRef: n, modelRef: r, modelsData:
4655
4665
  color: "#ffffff",
4656
4666
  intensity: 2
4657
4667
  }),
4658
- O && /* @__PURE__ */ R(h, {}),
4659
- /* @__PURE__ */ R("group", {
4660
- ref: r,
4661
- children: A.map(([e, t]) => /* @__PURE__ */ R(St, {
4662
- colorPaletteTexture: _,
4663
- coordinationMatrix: ee,
4668
+ O && /* @__PURE__ */ F(h, {}),
4669
+ /* @__PURE__ */ F("group", {
4670
+ ref: i,
4671
+ children: ne.map(([e, t]) => /* @__PURE__ */ F(wt, {
4672
+ colorPaletteTexture: v,
4673
+ coordinationMatrix: k,
4664
4674
  data: t,
4665
4675
  modelID: e
4666
4676
  }, e))
4667
4677
  }),
4668
- /* @__PURE__ */ R(m, {
4678
+ /* @__PURE__ */ F(m, {
4669
4679
  dampingFactor: .15,
4670
4680
  enableDamping: !0,
4671
- ref: t
4681
+ ref: n
4672
4682
  })
4673
4683
  ] });
4674
4684
  }
4675
- function to({ camera: e = {
4685
+ function no({ autoFitCamera: e = !0, camera: t = {
4676
4686
  position: [
4677
4687
  10,
4678
4688
  10,
4679
4689
  10
4680
4690
  ],
4681
4691
  fov: 50
4682
- }, dpr: t = window.devicePixelRatio, modelUrls: n, modelSources: r, modelsData: i, onReady: a, publicApi: s, setSceneApi: c, showNavCube: f, showStats: p }) {
4683
- let m = l(null), h = l(null), g = l(null), _ = l(null), [v, y] = u(), b = Te(), x = B((e) => e.setModelNames), S = B((e) => e.setModelProps), C = B((e) => e.setModelStructure), w = B((e) => e.setShowNavCube), T = B((e) => e.setShowStats), E = B((e) => e.setUserDevice), D = B((e) => e.showNavCube), O = i ?? v;
4692
+ }, dpr: n = window.devicePixelRatio, modelUrls: r, modelSources: i, modelsData: a, onReady: s, publicApi: c, setSceneApi: f, showNavCube: p, showStats: m }) {
4693
+ let h = l(null), g = l(null), _ = l(null), v = l(null), [y, b] = u(), x = R(), S = L((e) => e.setModelNames), C = L((e) => e.setModelProps), w = L((e) => e.setModelStructure), T = L((e) => e.setShowNavCube), E = L((e) => e.setShowStats), D = L((e) => e.setUserDevice), ee = L((e) => e.showNavCube), O = a ?? y;
4684
4694
  return o(() => {
4685
- E($a());
4686
- }, [E]), o(() => {
4687
- T(!!p);
4695
+ D(eo());
4696
+ }, [D]), o(() => {
4697
+ E(!!m);
4698
+ }, [E, m]), o(() => {
4699
+ p !== void 0 && T(p);
4688
4700
  }, [T, p]), o(() => {
4689
- f !== void 0 && w(f);
4690
- }, [w, f]), o(() => {
4691
4701
  let e = {}, t = {}, n = {};
4692
4702
  O && Object.entries(O).forEach(([r, i]) => {
4693
4703
  let a = Number(r);
4694
4704
  i.name !== void 0 && (e[a] = i.name), i.props !== void 0 && (t[a] = i.props), i.structure !== void 0 && (n[a] = i.structure);
4695
- }), x(e), S(t), C(n);
4705
+ }), S(e), C(t), w(n);
4696
4706
  }, [
4697
4707
  O,
4698
- x,
4699
4708
  S,
4700
- C
4709
+ C,
4710
+ w
4701
4711
  ]), o(() => {
4702
- if (i) return;
4703
- let e = r ?? n;
4712
+ if (a) return;
4713
+ let e = i ?? r;
4704
4714
  if (!e?.length) return;
4705
4715
  let t = !0;
4706
4716
  return Ca.loadModel(e).then((e) => {
4707
- t && y(e);
4717
+ t && b(e);
4708
4718
  }), () => {
4709
4719
  t = !1;
4710
4720
  };
4711
4721
  }, [
4722
+ a,
4712
4723
  i,
4713
- r,
4714
- n
4715
- ]), O ? /* @__PURE__ */ z("div", {
4716
- style: Xa,
4717
- children: [/* @__PURE__ */ R(d, {
4718
- camera: e,
4719
- dpr: t,
4720
- children: /* @__PURE__ */ R(Nr, {
4721
- store: b,
4722
- children: /* @__PURE__ */ R(eo, {
4723
- cameraRef: m,
4724
- controlRef: h,
4725
- lightRef: _,
4726
- modelRef: g,
4724
+ r
4725
+ ]), O ? /* @__PURE__ */ I("div", {
4726
+ style: Za,
4727
+ children: [/* @__PURE__ */ F(d, {
4728
+ camera: t,
4729
+ dpr: n,
4730
+ children: /* @__PURE__ */ F(Pr, {
4731
+ store: x,
4732
+ children: /* @__PURE__ */ F(to, {
4733
+ autoFitCamera: e,
4734
+ cameraRef: h,
4735
+ controlRef: g,
4736
+ lightRef: v,
4737
+ modelRef: _,
4727
4738
  modelsData: O,
4728
- onReady: a,
4729
- publicApi: s,
4730
- setSceneApi: c
4739
+ onReady: s,
4740
+ publicApi: c,
4741
+ setSceneApi: f
4731
4742
  })
4732
4743
  })
4733
- }), D && /* @__PURE__ */ R("div", {
4734
- style: Ya,
4735
- children: /* @__PURE__ */ R(d, {
4736
- camera: Za,
4737
- dpr: t,
4738
- gl: Qa,
4744
+ }), ee && /* @__PURE__ */ F("div", {
4745
+ style: Xa,
4746
+ children: /* @__PURE__ */ F(d, {
4747
+ camera: Qa,
4748
+ dpr: n,
4749
+ gl: $a,
4739
4750
  orthographic: !0,
4740
- children: /* @__PURE__ */ R(Ja, {
4751
+ children: /* @__PURE__ */ F(Ja, {
4741
4752
  active: !0,
4742
- cameraRef: m,
4743
- controlRef: h,
4744
- modelRef: g
4753
+ cameraRef: h,
4754
+ controlRef: g,
4755
+ modelRef: _
4745
4756
  })
4746
4757
  })
4747
4758
  })]
4748
- }) : /* @__PURE__ */ R(Se, {});
4759
+ }) : /* @__PURE__ */ F(Te, {});
4749
4760
  }
4750
- var no = n(function(e, t) {
4751
- let [n] = u(ke), r = l(!1), a = l(!1), d = l(null), { defaultSelected: f, onSelectedChange: p, selected: m } = e, h = i((e) => {
4752
- d.current = e;
4753
- }, []), g = c(() => Ki(n, () => d.current), [n]);
4761
+ var ro = n(function(e, t) {
4762
+ let [n] = u(je), r = l(!1), a = l(!1), d = c(() => new Ya(), []), { defaultSelected: f, onSelectedChange: p, selected: m } = e, h = i((e) => {
4763
+ d.set(e);
4764
+ }, [d]), g = c(() => Ki(n, d.get), [d, n]);
4754
4765
  return s(t, () => g, [g]), o(() => (n.getState().setApi(g), () => {
4755
4766
  n.getState().api === g && n.getState().setApi(null);
4756
4767
  }), [g, n]), o(() => {
@@ -4765,15 +4776,15 @@ var no = n(function(e, t) {
4765
4776
  if (p) return n.subscribe((e, t) => {
4766
4777
  e.selected !== t.selected && (a.current || p(Wi(e.selected)));
4767
4778
  });
4768
- }, [p, n]), /* @__PURE__ */ R(Nr, {
4779
+ }, [p, n]), /* @__PURE__ */ F(Pr, {
4769
4780
  store: n,
4770
- children: /* @__PURE__ */ R(to, {
4781
+ children: /* @__PURE__ */ F(no, {
4771
4782
  ...e,
4772
4783
  publicApi: g,
4773
4784
  setSceneApi: h
4774
4785
  })
4775
4786
  });
4776
4787
  });
4777
- no.displayName = "Viewer";
4788
+ ro.displayName = "Viewer";
4778
4789
  //#endregion
4779
- export { Ji as BMTLoader, ki as BmtConverter, ji as ConvertIfcFileToBmt, Mi as ConvertToBmt, Sn as DimensionLine, kn as DimensionsUtils, Ui as FilteredElementsCollector, gt as ModelGrids, Ja as NavigationCube, no as Viewer, Nr as ViewerStoreProvider, Ai as bmtConverter, ia as createBmtWorker, ga as createIfcWorker, ke as createViewerStore, xi as exportExcel, vi as exportModelPropertiesToExcel, ra as loadBmtModelsInWorker, ha as loadIfcModelsInWorker, Ca as loader, An as useDimensionsUtils, B as useViewerStore, Te as useViewerStoreApi };
4790
+ export { Ji as BMTLoader, ki as BmtConverter, ji as ConvertIfcFileToBmt, Mi as ConvertToBmt, wn as DimensionLine, jn as DimensionsUtils, Ui as FilteredElementsCollector, vt as ModelGrids, Ja as NavigationCube, ro as Viewer, Pr as ViewerStoreProvider, Ai as bmtConverter, ia as createBmtWorker, ga as createIfcWorker, je as createViewerStore, xi as exportExcel, vi as exportModelPropertiesToExcel, ra as loadBmtModelsInWorker, ha as loadIfcModelsInWorker, Ca as loader, Mn as useDimensionsUtils, L as useViewerStore, R as useViewerStoreApi };