bimatter-viewer-react 0.5.10 → 0.5.12

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
- 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 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";
3
+ import { CameraControls 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 A, LineDashedMaterial as ee, LineSegments as j, LinearFilter as M, MathUtils as te, Matrix4 as N, Mesh as P, MeshBasicMaterial as ne, MeshLambertMaterial as re, NearestFilter as ie, Object3D as ae, OrthographicCamera as oe, PerspectiveCamera as se, Plane as ce, RGBAFormat as le, SRGBColorSpace as ue, Sphere as de, SphereGeometry as fe, Sprite as pe, SpriteMaterial as me, UnsignedByteType as he, Vector2 as F, Vector3 as I } from "three";
5
+ import { useStore as ge } from "zustand";
6
+ import { createStore as _e } from "zustand/vanilla";
7
+ import { CONTAINED as ve, INTERSECTED as ye, MeshBVH as be, NOT_INTERSECTED as xe, acceleratedRaycast as Se } from "three-mesh-bvh";
8
+ import { Fragment as Ce, jsx as L, jsxs as R } from "react/jsx-runtime";
9
+ import we from "pako";
10
10
  //#region src/viewer/store/ViewerStoreContext.ts
11
- var De = t(null);
11
+ var Te = t(null);
12
12
  //#endregion
13
13
  //#region src/viewer/store/useViewerStore.ts
14
- function L(e) {
15
- return ve(R(), e);
14
+ function z(e) {
15
+ return ge(Ee(), e);
16
16
  }
17
- function R() {
18
- let e = a(De);
17
+ function Ee() {
18
+ let e = a(Te);
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 Oe = "rgb(17, 148, 189)", ke = "rgb(104, 198, 227)", Ae = {
24
+ var De = "rgb(17, 148, 189)", Oe = "rgb(104, 198, 227)", ke = {
25
25
  bottom: !0,
26
26
  left: !0,
27
27
  right: !0,
28
28
  top: !0,
29
29
  visible: !0
30
30
  };
31
- function je() {
32
- return ye((e) => ({
31
+ function Ae() {
32
+ return _e((e) => ({
33
33
  api: null,
34
34
  defaultHotkeysEnabled: !0,
35
- gridAxesVisibility: Ae,
35
+ gridAxesVisibility: ke,
36
36
  modelNames: {},
37
37
  modelProps: {},
38
38
  modelStructure: {},
39
- preselectionColor: ke,
39
+ preselectionColor: Oe,
40
40
  selected: {},
41
- selectionColor: Oe,
41
+ selectionColor: De,
42
42
  selectionInteractionDisabled: !1,
43
43
  showNavCube: !0,
44
44
  showStats: !1,
@@ -119,53 +119,59 @@ function je() {
119
119
  }
120
120
  }));
121
121
  }
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;
122
+ var je = 2;
123
+ function Me() {
124
+ let e = new C(new Uint8Array(256 * 4), 256, 1, le, he);
125
+ return e.magFilter = ie, e.minFilter = ie, e.generateMipmaps = !1, e.needsUpdate = !0, Pe(e, 1, new x(De)), e;
126
126
  }
127
- function Pe(e) {
127
+ function Ne(e) {
128
128
  return `${e.r.toFixed(6)}:${e.g.toFixed(6)}:${e.b.toFixed(6)}`;
129
129
  }
130
- function Fe(e, t, n) {
130
+ function Pe(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 Ie(e) {
134
+ function Fe(e) {
135
135
  return e.mesh.geometry.attributes.colorIndex;
136
136
  }
137
- function Le(e) {
137
+ function Ie(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 Re(e, t) {
144
- let n = Ie(e);
145
- return n || t === 0 ? n : Le(e);
143
+ function Le(e, t) {
144
+ let n = Fe(e);
145
+ return n || t === 0 ? n : Ie(e);
146
146
  }
147
- function ze(e) {
148
- Ie(e) && e.mesh.geometry.deleteAttribute("colorIndex");
147
+ function Re(e) {
148
+ Fe(e) && e.mesh.geometry.deleteAttribute("colorIndex");
149
149
  }
150
- function Be(e, t, n) {
150
+ function ze(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 Ve(e, t) {
155
- let n = Re(e.record, t);
154
+ function Be(e, t) {
155
+ let n = Le(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 He(e, t, n, r, i) {
162
+ function Ve(e, t, n, r, i) {
163
163
  e && e.forEach((e) => {
164
164
  if (e.record.modelID !== t) return;
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);
165
+ let a = Be(e, r), o = ze(i, e.record, r !== 0 && a);
166
+ r === 0 ? (o?.delete(n), o?.size || (i.delete(e.record), Re(e.record))) : a && o?.add(n);
167
167
  });
168
168
  }
169
+ function He(e, t, n) {
170
+ let r = /* @__PURE__ */ new Set();
171
+ return e.elementIndex.forEach((e, i) => {
172
+ n.has(i) || e.some((e) => e.record.modelID === t) && r.add(i);
173
+ }), r;
174
+ }
169
175
  function Ue(e) {
170
176
  let t = /* @__PURE__ */ new Set();
171
177
  return Object.entries(e).forEach(([e, n]) => {
@@ -184,23 +190,23 @@ function We(e, t) {
184
190
  }), n;
185
191
  }
186
192
  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());
193
+ let t = z((e) => e.selected), n = z((e) => e.selectionColor), r = c(() => Me(), []), a = l(/* @__PURE__ */ new Map()), s = l(je), u = l(/* @__PURE__ */ new Map()), d = l(t), f = l(/* @__PURE__ */ new Set()), p = l(/* @__PURE__ */ new WeakMap());
188
194
  o(() => {
189
195
  d.current = t;
190
196
  }, [t]), o(() => () => r.dispose(), [r]), o(() => {
191
- Fe(r, 1, new x(n));
197
+ Pe(r, 1, new x(n));
192
198
  }, [r, n]);
193
199
  let m = i((e, t) => d.current[e]?.has(t) ? 1 : u.current.get(e)?.get(t) ?? 0, []), h = i((t, n) => {
194
200
  let r = e.buildIndex();
195
201
  n.forEach((e) => {
196
- He(r.elementIndex.get(e), t, e, m(t, e), p.current);
202
+ Ve(r.elementIndex.get(e), t, e, m(t, e), p.current);
197
203
  });
198
204
  }, [e, m]), g = i((e) => {
199
- let t = new x(e), n = Pe(t), i = a.current.get(n);
205
+ let t = new x(e), n = Ne(t), i = a.current.get(n);
200
206
  if (i !== void 0) return i;
201
207
  let o = s.current;
202
208
  if (o >= 256) throw Error("Element color palette is full. Maximum colors: 255.");
203
- return a.current.set(n, o), s.current += 1, Fe(r, o, t), o;
209
+ return a.current.set(n, o), s.current += 1, Pe(r, o, t), o;
204
210
  }, [r]);
205
211
  o(() => {
206
212
  let e = Ue(t);
@@ -211,15 +217,26 @@ function Ge(e) {
211
217
  let _ = i((e, t, n) => {
212
218
  let r = g(n), i = u.current.get(e);
213
219
  i || (i = /* @__PURE__ */ new Map(), u.current.set(e, i)), t.forEach((e) => i.set(e, r)), h(e, t);
214
- }, [h, g]), v = i((e, t) => {
220
+ }, [h, g]), v = i((t, n, r) => {
221
+ let i = e.buildIndex(), a = /* @__PURE__ */ new Set(), o = Object.entries(n);
222
+ o.forEach(([, e]) => {
223
+ e.forEach((e) => a.add(e));
224
+ }), r !== void 0 && _(t, Array.from(He(i, t, a)), r), o.forEach(([e, n]) => {
225
+ _(t, n, e);
226
+ });
227
+ }, [e, _]), y = i((e, t) => {
228
+ Object.entries(e).forEach(([e, n]) => {
229
+ v(Number(e), n, t);
230
+ });
231
+ }, [v]), b = i((e, t) => {
215
232
  let n = u.current.get(e);
216
233
  t.forEach((e) => n?.delete(e)), n?.size === 0 && u.current.delete(e), h(e, t);
217
- }, [h]), y = i((e) => {
234
+ }, [h]), S = i((e) => {
218
235
  let t = u.current.get(e);
219
236
  if (!t?.size) return;
220
237
  let n = Array.from(t.keys());
221
238
  t.clear(), u.current.delete(e), h(e, n);
222
- }, [h]), b = i(() => {
239
+ }, [h]), C = i(() => {
223
240
  let t = e.buildIndex(), n = /* @__PURE__ */ new Map(), r = (e, t) => {
224
241
  let r = n.get(e);
225
242
  r || (r = /* @__PURE__ */ new Set(), n.set(e, r)), r.add(t);
@@ -232,39 +249,43 @@ function Ge(e) {
232
249
  t.forEach((t) => r(Number(e), t));
233
250
  }), n.forEach((e, n) => {
234
251
  e.forEach((e) => {
235
- He(t.elementIndex.get(e), n, e, m(n, e), p.current);
252
+ Ve(t.elementIndex.get(e), n, e, m(n, e), p.current);
236
253
  });
237
254
  });
238
- }, [e, m]), S = i(() => {
255
+ }, [e, m]), w = i(() => {
239
256
  e.buildIndex().records.forEach((e) => {
240
- p.current.delete(e), ze(e);
241
- }), p.current = /* @__PURE__ */ new WeakMap(), u.current.clear(), b();
242
- }, [b, e]);
257
+ p.current.delete(e), Re(e);
258
+ }), p.current = /* @__PURE__ */ new WeakMap(), u.current.clear(), C();
259
+ }, [C, e]);
243
260
  return {
244
261
  colorPaletteTexture: r,
245
262
  colorUtils: c(() => ({
246
- applyStoredColors: b,
247
- clearAllColors: S,
248
- clearColor: v,
249
- clearModelColors: y,
263
+ applyStoredColors: C,
264
+ clearAllColors: w,
265
+ clearColor: b,
266
+ clearModelColors: S,
267
+ rebuildByColors: y,
268
+ rebuildModelByColors: v,
250
269
  setColor: _
251
270
  }), [
271
+ C,
272
+ w,
252
273
  b,
253
274
  S,
254
- v,
255
275
  y,
276
+ v,
256
277
  _
257
278
  ])
258
279
  };
259
280
  }
260
281
  //#endregion
261
282
  //#region src/viewer/SelectableMesh.tsx
262
- M.prototype.raycast = we;
283
+ P.prototype.raycast = Se;
263
284
  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);
285
+ let a = l(null), s = z((e) => e.preselectionColor), u = l(s);
265
286
  u.current = s;
266
287
  let d = c(() => {
267
- let n = new ae({
288
+ let n = new re({
268
289
  color: new x(t.r, t.g, t.b),
269
290
  transparent: !!(t.opacity && t.opacity != 1),
270
291
  opacity: t.opacity ?? 1,
@@ -298,11 +319,11 @@ var Ke = e.memo(function({ colorPaletteTexture: e, material: t, data: n, isIfcSp
298
319
  e && (e.value instanceof x ? e.value.set(s) : e.value = new x(s));
299
320
  }, [d, s]), o(() => {
300
321
  if (!a.current) return;
301
- let e = a.current.geometry, t = new Se(e, { indirect: !0 });
322
+ let e = a.current.geometry, t = new be(e, { indirect: !0 });
302
323
  return Object.assign(e, { boundsTree: t }), () => {
303
324
  d.dispose(), Object.assign(e, { boundsTree: null });
304
325
  };
305
- }, [d]), /* @__PURE__ */ I("mesh", {
326
+ }, [d]), /* @__PURE__ */ R("mesh", {
306
327
  matrix: i,
307
328
  matrixAutoUpdate: !1,
308
329
  name: r ? "space" : void 0,
@@ -312,24 +333,24 @@ var Ke = e.memo(function({ colorPaletteTexture: e, material: t, data: n, isIfcSp
312
333
  let t = e.object;
313
334
  t.preselected &&= !1;
314
335
  },
315
- children: [/* @__PURE__ */ I("bufferGeometry", { children: [
316
- /* @__PURE__ */ F("bufferAttribute", {
336
+ children: [/* @__PURE__ */ R("bufferGeometry", { children: [
337
+ /* @__PURE__ */ L("bufferAttribute", {
317
338
  attach: "attributes-position",
318
339
  args: [n.pos, 3]
319
340
  }),
320
- n.norm && /* @__PURE__ */ F("bufferAttribute", {
341
+ n.norm && /* @__PURE__ */ L("bufferAttribute", {
321
342
  attach: "attributes-normal",
322
343
  args: [n.norm, 3]
323
344
  }),
324
- /* @__PURE__ */ F("bufferAttribute", {
345
+ /* @__PURE__ */ L("bufferAttribute", {
325
346
  attach: "attributes-ids",
326
347
  args: [n.ids, 1]
327
348
  }),
328
- /* @__PURE__ */ F("bufferAttribute", {
349
+ /* @__PURE__ */ L("bufferAttribute", {
329
350
  attach: "index",
330
351
  args: [n.ind, 1]
331
352
  })
332
- ] }), /* @__PURE__ */ F("primitive", { object: d })]
353
+ ] }), /* @__PURE__ */ L("primitive", { object: d })]
333
354
  });
334
355
  }), qe = 10, Je = "#1d2733", Ye = 2, Xe = .05, Ze = "\0", Qe = /* @__PURE__ */ new Map();
335
356
  function $e() {
@@ -343,7 +364,7 @@ function et(e, t, n, r) {
343
364
  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
365
  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
366
  let h = new b(a);
346
- return h.colorSpace = fe, h.generateMipmaps = !1, h.magFilter = A, h.minFilter = A, h.needsUpdate = !0, {
367
+ return h.colorSpace = ue, h.generateMipmaps = !1, h.magFilter = M, h.minFilter = M, h.needsUpdate = !0, {
347
368
  disposeTimer: null,
348
369
  height: m,
349
370
  key: e,
@@ -380,18 +401,18 @@ function it(e, t) {
380
401
  let n = e[t];
381
402
  return n === void 0 ? 0 : Number.isFinite(n) ? n : null;
382
403
  }
383
- function z(e, t) {
404
+ function B(e, t) {
384
405
  return it(e, t) ?? 0;
385
406
  }
386
407
  function at(e) {
387
408
  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);
409
+ return t === null || n === null || r === null ? null : new I(t, n, r);
389
410
  }
390
411
  function ot(e, t) {
391
412
  return [
392
- z(e, "x"),
393
- t !== void 0 && Number.isFinite(t) ? t : z(e, "y"),
394
- z(e, "z")
413
+ B(e, "x"),
414
+ t !== void 0 && Number.isFinite(t) ? t : B(e, "y"),
415
+ B(e, "z")
395
416
  ];
396
417
  }
397
418
  function st(e) {
@@ -443,8 +464,8 @@ function ut({ flattenToFloor: e, grids: t, showBottom: n, showLeft: r, showRight
443
464
  e.startSide,
444
465
  e.endSide,
445
466
  e.name,
446
- z(e.loc, "x"),
447
- z(e.loc, "z"),
467
+ B(e.loc, "x"),
468
+ B(e.loc, "z"),
448
469
  e.points[0].x,
449
470
  e.points[0].z,
450
471
  e.points[1].x,
@@ -454,7 +475,7 @@ function ut({ flattenToFloor: e, grids: t, showBottom: n, showLeft: r, showRight
454
475
  }), Array.from(c.values());
455
476
  }
456
477
  function dt(e, t) {
457
- return new P(...ot(e.loc, t));
478
+ return new I(...ot(e.loc, t));
458
479
  }
459
480
  function ft({ cameraPosition: e, floorY: t, line: n, showBottom: r, showLeft: i, showRight: a, showTop: o }) {
460
481
  let s = {
@@ -470,7 +491,7 @@ function pt({ endpoint: e, labelOffset: t, line: n }) {
470
491
  return i.y = 0, i.lengthSq() === 0 && i.set(1, 0, 0), i.normalize().multiplyScalar(t), e === "start" && i.negate(), r.add(i);
471
492
  }
472
493
  function mt(e, t) {
473
- let n = new P(), r = 0;
494
+ let n = new I(), r = 0;
474
495
  return e.forEach((e) => {
475
496
  let i = dt(e, t);
476
497
  e.points.forEach((e) => {
@@ -499,11 +520,11 @@ function gt({ color: e, fontSize: t, position: n, text: r }) {
499
520
  ]), f(({ camera: e, size: t }) => {
500
521
  let n = s.current;
501
522
  n && rt(n, c, e, t.height);
502
- }), /* @__PURE__ */ F("sprite", {
523
+ }), /* @__PURE__ */ L("sprite", {
503
524
  ref: s,
504
525
  position: n,
505
526
  renderOrder: 2,
506
- children: /* @__PURE__ */ F("spriteMaterial", {
527
+ children: /* @__PURE__ */ L("spriteMaterial", {
507
528
  alphaTest: .1,
508
529
  depthTest: !0,
509
530
  depthWrite: !1,
@@ -528,14 +549,14 @@ function _t({ cameraPosition: e, color: t, floorY: n, fontSize: r, labelOffset:
528
549
  labelOffset: i,
529
550
  line: a
530
551
  }) : null;
531
- return o(() => () => f.dispose(), [f]), /* @__PURE__ */ I("lineSegments", {
552
+ return o(() => () => f.dispose(), [f]), /* @__PURE__ */ R("lineSegments", {
532
553
  geometry: f,
533
554
  position: ot(a.loc, n),
534
- children: [/* @__PURE__ */ F("lineBasicMaterial", {
555
+ children: [/* @__PURE__ */ L("lineBasicMaterial", {
535
556
  color: t,
536
557
  depthWrite: !1,
537
558
  linewidth: 2
538
- }), m && /* @__PURE__ */ F(gt, {
559
+ }), m && /* @__PURE__ */ L(gt, {
539
560
  color: t,
540
561
  fontSize: r,
541
562
  position: m,
@@ -544,7 +565,7 @@ function _t({ cameraPosition: e, color: t, floorY: n, fontSize: r, labelOffset:
544
565
  });
545
566
  }
546
567
  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({
568
+ let h = p((e) => e.camera), g = l(null), [_, v] = u(() => new I()), y = ct(e), b = c(() => r ? ut({
548
569
  flattenToFloor: t !== void 0,
549
570
  grids: r,
550
571
  showBottom: a,
@@ -569,10 +590,10 @@ function vt({ color: e, floorY: t, fontSize: n = qe, grids: r, labelOffset: i =
569
590
  if (!e) return;
570
591
  let t = h.position.clone();
571
592
  e.worldToLocal(t), !(t.distanceToSquared(_) < Xe) && v(t);
572
- }), !m || !b.length ? null : /* @__PURE__ */ F("group", {
593
+ }), !m || !b.length ? null : /* @__PURE__ */ L("group", {
573
594
  ref: g,
574
595
  userData: { modelGrids: !0 },
575
- children: b.map((e) => /* @__PURE__ */ F(_t, {
596
+ children: b.map((e) => /* @__PURE__ */ L(_t, {
576
597
  cameraPosition: _,
577
598
  color: y,
578
599
  floorY: t,
@@ -587,9 +608,9 @@ function vt({ color: e, floorY: t, fontSize: n = qe, grids: r, labelOffset: i =
587
608
  e.startSide,
588
609
  e.endSide,
589
610
  e.name,
590
- z(e.loc, "x"),
591
- t ?? z(e.loc, "y"),
592
- z(e.loc, "z"),
611
+ B(e.loc, "x"),
612
+ t ?? B(e.loc, "y"),
613
+ B(e.loc, "z"),
593
614
  e.points[0].x,
594
615
  e.points[0].y,
595
616
  e.points[0].z,
@@ -601,12 +622,12 @@ function vt({ color: e, floorY: t, fontSize: n = qe, grids: r, labelOffset: i =
601
622
  }
602
623
  //#endregion
603
624
  //#region src/viewer/Model.tsx
604
- var yt = new j();
625
+ var yt = new N();
605
626
  function bt(e) {
606
627
  if (!e) return null;
607
628
  try {
608
629
  let t = JSON.parse(e);
609
- return !Array.isArray(t) || t.length !== 16 ? null : new j().fromArray(t);
630
+ return !Array.isArray(t) || t.length !== 16 ? null : new N().fromArray(t);
610
631
  } catch (e) {
611
632
  return console.warn("Model matrix parsing error", e), null;
612
633
  }
@@ -618,16 +639,16 @@ function St(e) {
618
639
  return e.coordinationMatrix ?? Object.values(e.data)[0]?.matrix;
619
640
  }
620
641
  function Ct({ colorPaletteTexture: e, coordinationMatrix: t, modelID: n, data: r }) {
621
- let i = L((e) => e.gridAxesVisibility), a = c(() => {
642
+ let i = z((e) => e.gridAxesVisibility), a = c(() => {
622
643
  if (!r) return {
623
644
  data: [],
624
645
  coordinationMatrix: null,
625
646
  floorY: 0
626
647
  };
627
- let e = Object.values(r.data).some((e) => !!e.matrix) ? t?.clone() ?? xt(r) : null, i = Infinity, a = new P();
648
+ let e = Object.values(r.data).some((e) => !!e.matrix) ? t?.clone() ?? xt(r) : null, i = Infinity, a = new I();
628
649
  return {
629
650
  data: Object.values(r.data).map((e) => {
630
- let t = (bt(e.matrix) ?? new j()).clone().invert(), r = e.mat, o = e.pos;
651
+ let t = (bt(e.matrix) ?? new N()).clone().invert(), r = e.mat, o = e.pos;
631
652
  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
653
  return {
633
654
  data: e,
@@ -645,17 +666,17 @@ function Ct({ colorPaletteTexture: e, coordinationMatrix: t, modelID: n, data: r
645
666
  r,
646
667
  n
647
668
  ]);
648
- return r ? /* @__PURE__ */ I("group", {
669
+ return r ? /* @__PURE__ */ R("group", {
649
670
  matrix: a.coordinationMatrix ?? yt,
650
671
  matrixAutoUpdate: !1,
651
672
  userData: { modelID: n },
652
- children: [a.data.map(({ data: t, isIfcSpace: n, key: r, material: i, meshMatrix: a }) => /* @__PURE__ */ F(Ke, {
673
+ children: [a.data.map(({ data: t, isIfcSpace: n, key: r, material: i, meshMatrix: a }) => /* @__PURE__ */ L(Ke, {
653
674
  colorPaletteTexture: e,
654
675
  material: i,
655
676
  data: t,
656
677
  isIfcSpace: n,
657
678
  meshMatrix: a
658
- }, r)), /* @__PURE__ */ F(vt, {
679
+ }, r)), /* @__PURE__ */ L(vt, {
659
680
  floorY: a.floorY,
660
681
  grids: r.grids,
661
682
  showBottom: i.bottom,
@@ -664,7 +685,7 @@ function Ct({ colorPaletteTexture: e, coordinationMatrix: t, modelID: n, data: r
664
685
  showTop: i.top,
665
686
  visible: i.visible
666
687
  })]
667
- }) : /* @__PURE__ */ F(Te, {});
688
+ }) : /* @__PURE__ */ L(Ce, {});
668
689
  }
669
690
  var wt = r(Ct);
670
691
  //#endregion
@@ -723,7 +744,7 @@ function Mt(e) {
723
744
  if (!n || r.indexedModel === n && r.records.size) return r;
724
745
  let i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Set();
725
746
  return n.traverse((e) => {
726
- if (!(e instanceof M)) return;
747
+ if (!(e instanceof P)) return;
727
748
  let t = e, n = t.geometry, r = n.index, o = n.attributes.ids;
728
749
  if (!r || !o) return;
729
750
  let s = At(t), c = Et(r.array), l = {
@@ -771,7 +792,7 @@ function Nt(e, t) {
771
792
  }
772
793
  function Pt(e) {
773
794
  let t = e.geometry;
774
- Object.assign(t, { boundsTree: void 0 }), e.geometry.index?.count && Object.assign(t, { boundsTree: new Se(e.geometry, { indirect: !0 }) });
795
+ Object.assign(t, { boundsTree: void 0 }), e.geometry.index?.count && Object.assign(t, { boundsTree: new be(e.geometry, { indirect: !0 }) });
775
796
  }
776
797
  function Ft(e, t, n = !0) {
777
798
  e.mesh.geometry.setIndex(new v(t, 1)), n && Pt(e.mesh);
@@ -800,10 +821,10 @@ function Vt(e, t) {
800
821
  function Ht(e, t, n) {
801
822
  e.hiddenIds.has(t) || (e.hiddenIds.add(t), n.add(e));
802
823
  }
803
- function B(e, t, n) {
824
+ function V(e, t, n) {
804
825
  e && console.log(`${t}:`, Date.now() - n, "ms");
805
826
  }
806
- function V(e, t, n, r) {
827
+ function H(e, t, n, r) {
807
828
  let { hiddenIds: i, originalIndex: a, triangleRanges: o } = e, s = zt(i, t, n, e.isIfcSpace);
808
829
  if (e.visibleStateKey === s) return;
809
830
  if (!i.size && !n) {
@@ -831,18 +852,18 @@ function V(e, t, n, r) {
831
852
  }
832
853
  r || (e.originalBoundsTree = null), Ft(e, u), e.visibleStateKey = s;
833
854
  }
834
- function H(e, t) {
855
+ function U(e, t) {
835
856
  return e.isolatedIdsByModel ? e.isolatedIdsByModel.get(t.modelID) ?? /* @__PURE__ */ new Set() : e.isolatedIds;
836
857
  }
837
858
  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) => {
859
+ let t = z((e) => e.selected), n = z((e) => e.resetSelected), r = z((e) => e.showStats), a = z((e) => e.userDevice) === "pc", o = e.buildIndex, s = i(() => Array.from(o().elementIndex.keys()), [o]), c = i(() => o().ifcSpacesVisible, [o]), l = i((e) => {
839
860
  let t = Date.now(), n = o(), i = /* @__PURE__ */ new Set();
840
861
  e.forEach((e) => {
841
862
  let t = n.elementIndex.get(e);
842
863
  t && t.forEach(({ record: t }) => {
843
864
  Ht(t, e, i);
844
865
  });
845
- }), i.forEach((e) => V(e, n.ifcSpacesVisible, H(n, e), a)), B(r, "hideByIds", t);
866
+ }), i.forEach((e) => H(e, n.ifcSpacesVisible, U(n, e), a)), V(r, "hideByIds", t);
846
867
  }, [
847
868
  o,
848
869
  a,
@@ -854,7 +875,7 @@ function Ut(e) {
854
875
  n && n.forEach(({ record: n }) => {
855
876
  n.modelID === e && Ht(n, t, s);
856
877
  });
857
- }), s.forEach((e) => V(e, i.ifcSpacesVisible, H(i, e), a)), n(), B(r, "hideSelected", e);
878
+ }), s.forEach((e) => H(e, i.ifcSpacesVisible, U(i, e), a)), n(), V(r, "hideSelected", e);
858
879
  }, [
859
880
  o,
860
881
  a,
@@ -868,14 +889,14 @@ function Ut(e) {
868
889
  t && t.forEach(({ record: t }) => {
869
890
  t.hiddenIds.delete(e) && i.add(t);
870
891
  });
871
- }), i.forEach((e) => V(e, n.ifcSpacesVisible, H(n, e), a)), B(r, "showByIds", t);
892
+ }), i.forEach((e) => H(e, n.ifcSpacesVisible, U(n, e), a)), V(r, "showByIds", t);
872
893
  }, [
873
894
  o,
874
895
  a,
875
896
  r
876
897
  ]), f = i((e) => {
877
898
  let t = Date.now(), n = o();
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);
899
+ n.isolatedIdsByModel = null, n.isolatedIds = new Set(e), n.records.forEach((e) => H(e, n.ifcSpacesVisible, U(n, e), a)), V(r, "isolateByIds", t);
879
900
  }, [
880
901
  o,
881
902
  a,
@@ -885,7 +906,7 @@ function Ut(e) {
885
906
  Vt(t, (e, t) => {
886
907
  let n = i.get(e);
887
908
  n || (n = /* @__PURE__ */ new Set(), i.set(e, n)), n.add(t);
888
- }), n.isolatedIdsByModel = i, n.isolatedIds = null, n.records.forEach((e) => V(e, n.ifcSpacesVisible, H(n, e), a)), B(r, "isolateSelected", e);
909
+ }), n.isolatedIdsByModel = i, n.isolatedIds = null, n.records.forEach((e) => H(e, n.ifcSpacesVisible, U(n, e), a)), V(r, "isolateSelected", e);
889
910
  }, [
890
911
  o,
891
912
  a,
@@ -893,7 +914,7 @@ function Ut(e) {
893
914
  r
894
915
  ]), m = i(() => {
895
916
  let e = Date.now(), t = o();
896
- t.isolatedIdsByModel = null, t.isolatedIds = null, t.records.forEach((e) => V(e, t.ifcSpacesVisible, H(t, e), a)), B(r, "resetIsolation", e);
917
+ t.isolatedIdsByModel = null, t.isolatedIds = null, t.records.forEach((e) => H(e, t.ifcSpacesVisible, U(t, e), a)), V(r, "resetIsolation", e);
897
918
  }, [
898
919
  o,
899
920
  a,
@@ -901,7 +922,7 @@ function Ut(e) {
901
922
  ]), h = i((e) => {
902
923
  let t = o();
903
924
  t.ifcSpacesVisible !== e && (t.ifcSpacesVisible = e, t.records.forEach((e) => {
904
- e.isIfcSpace && V(e, t.ifcSpacesVisible, H(t, e), a);
925
+ e.isIfcSpace && H(e, t.ifcSpacesVisible, U(t, e), a);
905
926
  }));
906
927
  }, [o, a]), g = i(() => {
907
928
  h(!c());
@@ -919,8 +940,8 @@ function Ut(e) {
919
940
  showAll: i(() => {
920
941
  let e = Date.now(), t = o();
921
942
  t.isolatedIdsByModel = null, t.isolatedIds = null, t.records.forEach((e) => {
922
- e.hiddenIds.clear(), V(e, t.ifcSpacesVisible, H(t, e), a);
923
- }), B(r, "showAll", e);
943
+ e.hiddenIds.clear(), H(e, t.ifcSpacesVisible, U(t, e), a);
944
+ }), V(r, "showAll", e);
924
945
  }, [
925
946
  o,
926
947
  a,
@@ -943,7 +964,7 @@ function qt(e) {
943
964
  function Jt(e, t) {
944
965
  let n = new y(), r = Math.ceil(Math.min(Math.max(Wt, qt(t) * .05), 32768));
945
966
  n.setAttribute("position", Kt(r)), n.setDrawRange(0, 0);
946
- let i = new ne(n, e);
967
+ let i = new j(n, e);
947
968
  return i.frustumCulled = !1, i.renderOrder = 1, i.visible = !1, i;
948
969
  }
949
970
  function Yt(e, t) {
@@ -961,20 +982,20 @@ var Zt = class {
961
982
  plane;
962
983
  context;
963
984
  lines = /* @__PURE__ */ new Map();
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();
985
+ inverseMatrix = new N();
986
+ localPlane = new ce();
987
+ tempLine = new k();
988
+ tempVector = new I();
989
+ tempVector1 = new I();
990
+ tempVector2 = new I();
991
+ tempVector3 = new I();
971
992
  constructor(e, t) {
972
993
  this.context = e, this.plane = t, this.active = e.getActive() && e.getEdgesActive(), e.edges.forEach((e) => {
973
994
  let n = e.material.clippingPlanes ?? [];
974
995
  e.plane === t || n.includes(t) || (e.material.clippingPlanes = [...n, t], e.material.needsUpdate = !0);
975
996
  });
976
997
  let n = e.planes.filter((e) => e !== t);
977
- this.material = new te({
998
+ this.material = new A({
978
999
  clippingPlanes: n,
979
1000
  color: "black",
980
1001
  depthTest: !0,
@@ -1027,16 +1048,16 @@ var Zt = class {
1027
1048
  }), e.geometry.setDrawRange(0, r), e.position.copy(this.localPlane.normal).multiplyScalar(Gt), i.needsUpdate = !0;
1028
1049
  }));
1029
1050
  }
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;
1051
+ }, Qt = "#0b2f5f", $t = "#0b2f5f", en = 0, tn = "#1f7ae0", nn = .22, rn = .01, an = .025, on = .015, sn = .25, cn = .15, ln = .25, W = 1;
1031
1052
  function un(e, t) {
1032
1053
  let n = t.getBoundingClientRect();
1033
- return new N((e.clientX - n.left) / n.width * 2 - 1, -((e.clientY - n.top) / n.height) * 2 + 1);
1054
+ return new F((e.clientX - n.left) / n.width * 2 - 1, -((e.clientY - n.top) / n.height) * 2 + 1);
1034
1055
  }
1035
1056
  function dn(e) {
1036
- let t = e.getSize(new P());
1057
+ let t = e.getSize(new I());
1037
1058
  return Math.max(ln, t.length() * rn);
1038
1059
  }
1039
- var fn = class extends se {
1060
+ var fn = class extends ae {
1040
1061
  helper = new D();
1041
1062
  borderMaterial;
1042
1063
  material;
@@ -1047,13 +1068,13 @@ var fn = class extends se {
1047
1068
  location;
1048
1069
  normal;
1049
1070
  planeMesh;
1050
- pointer = new N();
1071
+ pointer = new F();
1051
1072
  layout;
1052
1073
  dragState = null;
1053
1074
  hovered = !1;
1054
1075
  listenersActive = !1;
1055
1076
  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 ie({
1077
+ super(), this.context = e, this.plane = t, this.location = n.clone(), this.normal = r.clone().normalize(), this.material = new ne({
1057
1078
  color: $t,
1058
1079
  depthWrite: !1,
1059
1080
  opacity: en,
@@ -1061,7 +1082,7 @@ var fn = class extends se {
1061
1082
  transparent: !0
1062
1083
  }), this.helper.position.copy(this.location), this.applyPlaneOrientation(), this.layout = this.getHelperLayout();
1063
1084
  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({
1085
+ this.borderMaterial = new ee({
1065
1086
  color: Qt,
1066
1087
  dashSize: i,
1067
1088
  depthWrite: !1,
@@ -1128,7 +1149,7 @@ var fn = class extends se {
1128
1149
  hasModelIntersection(e) {
1129
1150
  return !!this.context.getCameraUtils().getIntersection(!0, {
1130
1151
  event: e,
1131
- filter: (e) => !(e.object instanceof M) || e.faceIndex === void 0 || e.faceIndex === null ? !1 : !!(e.object.geometry.index && e.object.geometry.attributes.ids),
1152
+ filter: (e) => !(e.object instanceof P) || e.faceIndex === void 0 || e.faceIndex === null ? !1 : !!(e.object.geometry.index && e.object.geometry.attributes.ids),
1132
1153
  object: this.context.getMeshes(),
1133
1154
  recursive: !1
1134
1155
  });
@@ -1136,7 +1157,7 @@ var fn = class extends se {
1136
1157
  getPointerPointOnPlane(e, t) {
1137
1158
  let n = this.context.getDomElement();
1138
1159
  this.pointer.copy(un(e, n));
1139
- let r = this.context.getRaycaster(), i = new P();
1160
+ let r = this.context.getRaycaster(), i = new I();
1140
1161
  return r.setFromCamera(this.pointer, this.context.getCamera()), r.ray.intersectPlane(t, i);
1141
1162
  }
1142
1163
  onPointerDown = (e) => {
@@ -1148,9 +1169,9 @@ var fn = class extends se {
1148
1169
  let t = this.getPointerIntersection(e);
1149
1170
  if (!t) return;
1150
1171
  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 P();
1172
+ let n = new I();
1152
1173
  this.context.getCamera().getWorldDirection(n), n.normalize();
1153
- let r = new ue().setFromNormalAndCoplanarPoint(n, t.point);
1174
+ let r = new ce().setFromNormalAndCoplanarPoint(n, t.point);
1154
1175
  this.dragState = {
1155
1176
  dragPlane: r,
1156
1177
  helperStart: this.helper.position.clone(),
@@ -1195,11 +1216,11 @@ var fn = class extends se {
1195
1216
  this.hovered = e, this.material.color.set(e ? tn : $t), this.material.opacity = e ? nn : en, this.material.needsUpdate = !0;
1196
1217
  }
1197
1218
  createPlaneMesh() {
1198
- let e = new M(new y(), this.material);
1219
+ let e = new P(new y(), this.material);
1199
1220
  return e.renderOrder = 2, e;
1200
1221
  }
1201
1222
  createBorder() {
1202
- let e = new ne(new y(), this.borderMaterial);
1223
+ let e = new j(new y(), this.borderMaterial);
1203
1224
  return e.renderOrder = 3, e;
1204
1225
  }
1205
1226
  replaceGeometry(e, t) {
@@ -1268,27 +1289,27 @@ var fn = class extends se {
1268
1289
  getHelperLayout() {
1269
1290
  let e = this.getModelWorldBox();
1270
1291
  if (!e || e.isEmpty()) return {
1271
- height: U,
1272
- maxU: U / 2,
1273
- maxV: U / 2,
1274
- minU: -U / 2,
1275
- minV: -U / 2,
1276
- width: U
1292
+ height: W,
1293
+ maxU: W / 2,
1294
+ maxV: W / 2,
1295
+ minU: -W / 2,
1296
+ minV: -W / 2,
1297
+ width: W
1277
1298
  };
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;
1299
+ let t = this.getPlaneBasis(), n = this.helper.position, r = this.getBoxCorners(e), i = new I(), a = new I(), o = Infinity, s = -Infinity, c = Infinity, l = -Infinity;
1279
1300
  if (r.forEach((e) => {
1280
1301
  this.plane.projectPoint(e, i), a.copy(i).sub(n);
1281
1302
  let r = a.dot(t.u), u = a.dot(t.v);
1282
1303
  o = Math.min(o, r), s = Math.max(s, r), c = Math.min(c, u), l = Math.max(l, u);
1283
1304
  }), !Number.isFinite(o) || !Number.isFinite(s) || !Number.isFinite(c) || !Number.isFinite(l)) return {
1284
- height: U,
1285
- maxU: U / 2,
1286
- maxV: U / 2,
1287
- minU: -U / 2,
1288
- minV: -U / 2,
1289
- width: U
1305
+ height: W,
1306
+ maxU: W / 2,
1307
+ maxV: W / 2,
1308
+ minU: -W / 2,
1309
+ minV: -W / 2,
1310
+ width: W
1290
1311
  };
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;
1312
+ let u = dn(e), d = o - u, f = s + u, p = c - u, m = l + u, h = Math.max(W, f - d), g = Math.max(W, m - p), _ = (d + f) / 2, v = (p + m) / 2;
1292
1313
  return {
1293
1314
  height: g,
1294
1315
  maxU: _ + h / 2,
@@ -1299,14 +1320,14 @@ var fn = class extends se {
1299
1320
  };
1300
1321
  }
1301
1322
  getPlaneBasis() {
1302
- let e = (Math.abs(this.normal.y) < .9 ? new P(0, 1, 0) : new P(1, 0, 0)).cross(this.normal).normalize();
1323
+ let e = (Math.abs(this.normal.y) < .9 ? new I(0, 1, 0) : new I(1, 0, 0)).cross(this.normal).normalize();
1303
1324
  return {
1304
1325
  u: e,
1305
1326
  v: this.normal.clone().cross(e).normalize()
1306
1327
  };
1307
1328
  }
1308
1329
  applyPlaneOrientation() {
1309
- let e = this.getPlaneBasis(), t = new j().makeBasis(e.u, e.v, this.normal);
1330
+ let e = this.getPlaneBasis(), t = new N().makeBasis(e.u, e.v, this.normal);
1310
1331
  this.helper.quaternion.setFromRotationMatrix(t);
1311
1332
  }
1312
1333
  getModelWorldBox() {
@@ -1319,14 +1340,14 @@ var fn = class extends se {
1319
1340
  }
1320
1341
  getBoxCorners(e) {
1321
1342
  return [
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)
1343
+ new I(e.min.x, e.min.y, e.min.z),
1344
+ new I(e.min.x, e.min.y, e.max.z),
1345
+ new I(e.min.x, e.max.y, e.min.z),
1346
+ new I(e.min.x, e.max.y, e.max.z),
1347
+ new I(e.max.x, e.min.y, e.min.z),
1348
+ new I(e.max.x, e.min.y, e.max.z),
1349
+ new I(e.max.x, e.max.y, e.min.z),
1350
+ new I(e.max.x, e.max.y, e.max.z)
1330
1351
  ];
1331
1352
  }
1332
1353
  };
@@ -1344,13 +1365,22 @@ function pn(e, t) {
1344
1365
  function mn(e) {
1345
1366
  let t = [];
1346
1367
  return e?.traverse((e) => {
1347
- e instanceof M && (!e.geometry.index || !e.geometry.attributes.ids || t.push(e));
1368
+ e instanceof P && (!e.geometry.index || !e.geometry.attributes.ids || t.push(e));
1348
1369
  }), t;
1349
1370
  }
1350
- function hn(e, t) {
1371
+ function hn(e) {
1372
+ let t = e;
1373
+ for (; t;) {
1374
+ let e = t.userData.modelID;
1375
+ if (typeof e == "number") return e;
1376
+ t = t.parent;
1377
+ }
1378
+ return 0;
1379
+ }
1380
+ function gn(e, t) {
1351
1381
  return t.clone().transformDirection(e.matrixWorld).normalize();
1352
1382
  }
1353
- var gn = class {
1383
+ var _n = class {
1354
1384
  planes = [];
1355
1385
  edges = [];
1356
1386
  helpers = [];
@@ -1432,6 +1462,18 @@ var gn = class {
1432
1462
  n.updateWorldMatrix(!0, !1), n.geometry.boundingBox || n.geometry.computeBoundingBox(), n.geometry.boundingBox && (t.copy(n.geometry.boundingBox).applyMatrix4(n.matrixWorld), e.union(t));
1433
1463
  }), e.isEmpty() ? null : e;
1434
1464
  }
1465
+ getSelectedWorldBox() {
1466
+ let e = this.context.viewerStore.getState().selected, t = new g(), n = new I();
1467
+ return this.getMeshes().forEach((r) => {
1468
+ let i = e[hn(r)];
1469
+ if (!i?.size) return;
1470
+ let a = r.geometry.attributes.ids, o = r.geometry.attributes.position;
1471
+ if (!a || !o) return;
1472
+ r.updateWorldMatrix(!0, !1);
1473
+ let s = Math.min(a.count, o.count);
1474
+ for (let e = 0; e < s; e++) i.has(a.getX(e)) && (n.set(o.getX(e), o.getY(e), o.getZ(e)).applyMatrix4(r.matrixWorld), Number.isFinite(n.x + n.y + n.z) && t.expandByPoint(n));
1475
+ }), t.isEmpty() ? null : t;
1476
+ }
1435
1477
  setControlsEnabled(e) {
1436
1478
  let t = this.context.controlRef.current;
1437
1479
  t && (t.enabled = e);
@@ -1461,47 +1503,47 @@ var gn = class {
1461
1503
  recursive: !1
1462
1504
  });
1463
1505
  if (!n?.face) return null;
1464
- let r = n.point.clone(), i = hn(n.object, n.face.normal);
1506
+ let r = n.point.clone(), i = gn(n.object, n.face.normal);
1465
1507
  r.add(i.clone().multiplyScalar(.001));
1466
- let a = new ue().setFromNormalAndCoplanarPoint(i.clone().negate(), r);
1508
+ let a = new ce().setFromNormalAndCoplanarPoint(i.clone().negate(), r);
1467
1509
  return this.addPlane(a, r, i), a.clone();
1468
1510
  }
1469
- createClippingRectangle() {
1470
- let e = this.getModelWorldBox();
1471
- if (!e) return [];
1472
- let t = dn(e), n = e.min.clone().addScalar(-t), r = e.max.clone().addScalar(t), i = e.getCenter(new P()), a = [
1511
+ createClippingRectangle(e = !1) {
1512
+ let t = e ? this.getSelectedWorldBox() : this.getModelWorldBox();
1513
+ if (!t) return [];
1514
+ let n = dn(t), r = t.min.clone().addScalar(-n), i = t.max.clone().addScalar(n), a = t.getCenter(new I()), o = [
1473
1515
  {
1474
- normal: new P(1, 0, 0),
1475
- point: new P(n.x, i.y, i.z)
1516
+ normal: new I(1, 0, 0),
1517
+ point: new I(r.x, a.y, a.z)
1476
1518
  },
1477
1519
  {
1478
- normal: new P(-1, 0, 0),
1479
- point: new P(r.x, i.y, i.z)
1520
+ normal: new I(-1, 0, 0),
1521
+ point: new I(i.x, a.y, a.z)
1480
1522
  },
1481
1523
  {
1482
- normal: new P(0, 1, 0),
1483
- point: new P(i.x, n.y, i.z)
1524
+ normal: new I(0, 1, 0),
1525
+ point: new I(a.x, r.y, a.z)
1484
1526
  },
1485
1527
  {
1486
- normal: new P(0, -1, 0),
1487
- point: new P(i.x, r.y, i.z)
1528
+ normal: new I(0, -1, 0),
1529
+ point: new I(a.x, i.y, a.z)
1488
1530
  },
1489
1531
  {
1490
- normal: new P(0, 0, 1),
1491
- point: new P(i.x, i.y, n.z)
1532
+ normal: new I(0, 0, 1),
1533
+ point: new I(a.x, a.y, r.z)
1492
1534
  },
1493
1535
  {
1494
- normal: new P(0, 0, -1),
1495
- point: new P(i.x, i.y, r.z)
1536
+ normal: new I(0, 0, -1),
1537
+ point: new I(a.x, a.y, i.z)
1496
1538
  }
1497
1539
  ].map(({ normal: e, point: t }) => ({
1498
1540
  normal: e,
1499
- plane: new ue().setFromNormalAndCoplanarPoint(e, t),
1541
+ plane: new ce().setFromNormalAndCoplanarPoint(e, t),
1500
1542
  point: t
1501
1543
  }));
1502
- return a.forEach(({ normal: e, plane: t, point: n }) => {
1544
+ return o.forEach(({ normal: e, plane: t, point: n }) => {
1503
1545
  this.addPlane(t, n, e);
1504
- }), this.updateHelpers(), a.map(({ plane: e }) => e.clone());
1546
+ }), this.updateHelpers(), o.map(({ plane: e }) => e.clone());
1505
1547
  }
1506
1548
  addPlane(e, t, n) {
1507
1549
  if (this.active || this.setActive(!0), this.planes.push(e), new fn(this, e, t, n), this.updateHelpers(), this.updateMaterials(), this.edgesActive) {
@@ -1544,8 +1586,8 @@ var gn = class {
1544
1586
  this.deleteAllPlanes();
1545
1587
  }
1546
1588
  };
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({
1589
+ function vn(e, t, n) {
1590
+ let r = p((e) => e.camera), i = p((e) => e.gl), a = p((e) => e.raycaster), s = p((e) => e.scene), l = Ee(), u = c(() => new _n({
1549
1591
  camera: r,
1550
1592
  cameraUtils: n,
1551
1593
  controlRef: t,
@@ -1589,15 +1631,15 @@ function _n(e, t, n) {
1589
1631
  l
1590
1632
  ]), o(() => () => u.dispose(), [u]), o(() => {
1591
1633
  let e = i.domElement, n = t.current;
1592
- return e.addEventListener("pointerdown", u.setHelperHoverMoveStart), window.addEventListener("pointerup", u.setHelperHoverMoveEnd), window.addEventListener("pointercancel", u.setHelperHoverMoveEnd), n?.addEventListener("change", u.setHelperHoverMoving), () => {
1593
- e.removeEventListener("pointerdown", u.setHelperHoverMoveStart), window.removeEventListener("pointerup", u.setHelperHoverMoveEnd), window.removeEventListener("pointercancel", u.setHelperHoverMoveEnd), n?.removeEventListener("change", u.setHelperHoverMoving);
1634
+ return e.addEventListener("pointerdown", u.setHelperHoverMoveStart), window.addEventListener("pointerup", u.setHelperHoverMoveEnd), window.addEventListener("pointercancel", u.setHelperHoverMoveEnd), n?.addEventListener("update", u.setHelperHoverMoving), () => {
1635
+ e.removeEventListener("pointerdown", u.setHelperHoverMoveStart), window.removeEventListener("pointerup", u.setHelperHoverMoveEnd), window.removeEventListener("pointercancel", u.setHelperHoverMoveEnd), n?.removeEventListener("update", u.setHelperHoverMoving);
1594
1636
  };
1595
1637
  }, [
1596
1638
  u,
1597
1639
  t,
1598
1640
  i
1599
1641
  ]), c(() => ({
1600
- createClippingRectangle: () => u.createClippingRectangle(),
1642
+ createClippingRectangle: (e = !1) => u.createClippingRectangle(e),
1601
1643
  createPlane: (e) => u.createPlane(e),
1602
1644
  deleteAllPlanes: () => u.deleteAllPlanes(),
1603
1645
  getActive: () => u.getActive(),
@@ -1615,28 +1657,28 @@ function _n(e, t, n) {
1615
1657
  }
1616
1658
  //#endregion
1617
1659
  //#region src/viewer/utils/DimentionsUtils/DimentionLine.ts
1618
- var vn = 12, yn = 6, bn = 4;
1619
- function xn() {
1660
+ var yn = 12, bn = 6, xn = 4;
1661
+ function Sn() {
1620
1662
  return typeof window > "u" ? 1 : Math.min(window.devicePixelRatio || 1, 2);
1621
1663
  }
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);
1664
+ function Cn(e, t) {
1665
+ return e instanceof oe ? (e.top - e.bottom) / e.zoom : e instanceof se ? 2 * Math.tan(e.fov * Math.PI / 360) * Math.max(t, .001) : Math.max(t, 1);
1624
1666
  }
1625
- function Cn(e) {
1626
- let t = xn(), n = document.createElement("canvas"), r = n.getContext("2d");
1667
+ function wn(e) {
1668
+ let t = Sn(), n = document.createElement("canvas"), r = n.getContext("2d");
1627
1669
  if (!r) throw Error("Could not create dimension label canvas context");
1628
- let i = `600 ${vn}px system-ui, "Segoe UI", sans-serif`;
1670
+ let i = `600 ${yn}px system-ui, "Segoe UI", sans-serif`;
1629
1671
  r.font = i;
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));
1672
+ let a = r.measureText(e), o = a.actualBoundingBoxAscent || yn * .8, s = a.actualBoundingBoxDescent || yn * .2, c = Math.max(1, Math.ceil(a.width + bn * 2)), l = Math.max(1, Math.ceil(o + s + xn * 2));
1631
1673
  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
1674
  let u = new b(n);
1633
- return u.colorSpace = fe, u.generateMipmaps = !1, u.magFilter = A, u.minFilter = A, u.needsUpdate = !0, {
1675
+ return u.colorSpace = ue, u.generateMipmaps = !1, u.magFilter = M, u.minFilter = M, u.needsUpdate = !0, {
1634
1676
  height: l,
1635
1677
  texture: u,
1636
1678
  width: c
1637
1679
  };
1638
1680
  }
1639
- var wn = class e {
1681
+ var Tn = class e {
1640
1682
  static scale = 1;
1641
1683
  static scaleFactor = .015;
1642
1684
  static units = "m";
@@ -1666,7 +1708,7 @@ var wn = class e {
1666
1708
  this.end.x,
1667
1709
  this.end.y,
1668
1710
  this.end.z
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);
1711
+ ], 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);
1670
1712
  }
1671
1713
  get length() {
1672
1714
  return this.start.distanceTo(this.end);
@@ -1708,11 +1750,11 @@ var wn = class e {
1708
1750
  this.addEndpointMesh(this.start, this.end), this.addEndpointMesh(this.end, this.start);
1709
1751
  }
1710
1752
  addEndpointMesh(e, t) {
1711
- let n = new M(this.endpointGeometry, this.endpointMaterial);
1753
+ let n = new P(this.endpointGeometry, this.endpointMaterial);
1712
1754
  n.position.copy(e), n.scale.copy(this.endpointBaseScale), n.lookAt(t), n.renderOrder = 4, this.endpointMeshes.push(n), this.root.add(n);
1713
1755
  }
1714
1756
  createLabelSprite() {
1715
- let e = new he(new ge({
1757
+ let e = new pe(new me({
1716
1758
  depthTest: !1,
1717
1759
  depthWrite: !1,
1718
1760
  transparent: !0
@@ -1720,7 +1762,7 @@ var wn = class e {
1720
1762
  return e.renderOrder = 5, e;
1721
1763
  }
1722
1764
  createBoundingBoxMesh() {
1723
- let e = new M(new _(1, 1, Math.max(this.length, .001)), this.boundingMaterial);
1765
+ let e = new P(new _(1, 1, Math.max(this.length, .001)), this.boundingMaterial);
1724
1766
  return e.renderOrder = 3, e;
1725
1767
  }
1726
1768
  getTextContent() {
@@ -1731,7 +1773,7 @@ var wn = class e {
1731
1773
  let e = this.getTextContent();
1732
1774
  if (this.labelText === e) return;
1733
1775
  this.labelText = e, this.labelTexture?.dispose();
1734
- let t = Cn(e);
1776
+ let t = wn(e);
1735
1777
  this.labelHeight = t.height, this.labelTexture = t.texture, this.labelWidth = t.width, this.labelSprite.material.map = t.texture, this.labelSprite.material.needsUpdate = !0;
1736
1778
  }
1737
1779
  updatePositions() {
@@ -1742,37 +1784,37 @@ var wn = class e {
1742
1784
  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
1785
  }
1744
1786
  rescaleMesh(t, n, r) {
1745
- let i = Sn(n, t.position.distanceTo(n.position)) / Math.max(1, r) * 12 * e.scaleFactor;
1787
+ let i = Cn(n, t.position.distanceTo(n.position)) / Math.max(1, r) * 12 * e.scaleFactor;
1746
1788
  t.scale.setScalar(i);
1747
1789
  }
1748
1790
  rescaleBoundingMesh(e, t) {
1749
1791
  if (!this.boundingMesh) return;
1750
- let n = Sn(e, this.boundingMesh.position.distanceTo(e.position)) / Math.max(1, t) * 8;
1792
+ let n = Cn(e, this.boundingMesh.position.distanceTo(e.position)) / Math.max(1, t) * 8;
1751
1793
  this.boundingMesh.scale.set(n, n, 1);
1752
1794
  }
1753
1795
  rescaleLabel(e, t) {
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);
1796
+ let n = Cn(e, this.labelSprite.position.distanceTo(e.position)), r = this.labelHeight / Math.max(1, t) * n, i = r * (this.labelWidth / this.labelHeight);
1755
1797
  this.labelSprite.scale.set(i, r, 1);
1756
1798
  }
1757
- }, Tn = "#111827", En = 1, Dn = "x";
1758
- function On(e) {
1799
+ }, En = "#111827", Dn = 1, On = "x";
1800
+ function kn(e) {
1759
1801
  let t = [];
1760
1802
  return e?.traverse((e) => {
1761
- e instanceof M && e.geometry.attributes.position && t.push(e);
1803
+ e instanceof P && e.geometry.attributes.position && t.push(e);
1762
1804
  }), t;
1763
1805
  }
1764
- function kn(e, t, n) {
1806
+ function An(e, t, n) {
1765
1807
  let r = e.clone();
1766
1808
  return r[n] = t[n], r;
1767
1809
  }
1768
- function An(e, t) {
1810
+ function jn(e, t) {
1769
1811
  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
1812
  return a === n ? "x" : a === r ? "y" : "z";
1771
1813
  }
1772
- var jn = class e {
1814
+ var Mn = class e {
1773
1815
  active = !1;
1774
1816
  axis = null;
1775
- boundingMaterial = new ie({
1817
+ boundingMaterial = new ne({
1776
1818
  color: 0,
1777
1819
  depthTest: !1,
1778
1820
  depthWrite: !1,
@@ -1783,14 +1825,14 @@ var jn = class e {
1783
1825
  currentDimension = null;
1784
1826
  dimensions = [];
1785
1827
  endpointGeometry = e.createEndpointGeometry();
1786
- endpointMaterial = new ie({
1787
- color: Tn,
1828
+ endpointMaterial = new ne({
1829
+ color: En,
1788
1830
  depthTest: !1,
1789
1831
  depthWrite: !1
1790
1832
  });
1791
- endpointScale = new P(1, 1, 1);
1792
- lineMaterial = new k({
1793
- color: Tn,
1833
+ endpointScale = new I(1, 1, 1);
1834
+ lineMaterial = new ee({
1835
+ color: En,
1794
1836
  dashSize: .2,
1795
1837
  depthTest: !1,
1796
1838
  depthWrite: !1,
@@ -1798,14 +1840,14 @@ var jn = class e {
1798
1840
  });
1799
1841
  measureInProcess = !1;
1800
1842
  moveState = "end";
1801
- previewMarker = new M(e.createPreviewGeometry(), new ie({
1843
+ previewMarker = new P(e.createPreviewGeometry(), new ne({
1802
1844
  color: 0,
1803
1845
  depthTest: !1,
1804
1846
  depthWrite: !1
1805
1847
  }));
1806
1848
  root = new D();
1807
- snapDistance = En;
1808
- startPoint = new P();
1849
+ snapDistance = Dn;
1850
+ startPoint = new I();
1809
1851
  unit = "m";
1810
1852
  constructor(e) {
1811
1853
  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 +1880,13 @@ var jn = class e {
1838
1880
  });
1839
1881
  }
1840
1882
  setEndpointScaleFactor(e) {
1841
- !Number.isFinite(e) || e <= 0 || (wn.scaleFactor = e);
1883
+ !Number.isFinite(e) || e <= 0 || (Tn.scaleFactor = e);
1842
1884
  }
1843
1885
  setSnapDistance(e) {
1844
1886
  !Number.isFinite(e) || e < 0 || (this.snapDistance = e);
1845
1887
  }
1846
1888
  setUnit(e) {
1847
- this.unit = e, wn.units = e, wn.scale = e === "mm" ? 1e3 : 1, this.dimensions.forEach((e) => {
1889
+ this.unit = e, Tn.units = e, Tn.scale = e === "mm" ? 1e3 : 1, this.dimensions.forEach((e) => {
1848
1890
  e.endPoint = e.end;
1849
1891
  }), this.currentDimension && (this.currentDimension.endPoint = this.currentDimension.end);
1850
1892
  }
@@ -1870,7 +1912,7 @@ var jn = class e {
1870
1912
  changeAxes() {
1871
1913
  if (!this.measureInProcess || !this.currentDimension) return;
1872
1914
  let e = this.currentDimension.end, t = this.getNextAxis();
1873
- this.axis = t, this.currentDimension.endPoint = kn(this.startPoint, e, t);
1915
+ this.axis = t, this.currentDimension.endPoint = An(this.startPoint, e, t);
1874
1916
  }
1875
1917
  updateFrame() {
1876
1918
  if (!this.active) return;
@@ -1885,11 +1927,11 @@ var jn = class e {
1885
1927
  }
1886
1928
  addEventListeners() {
1887
1929
  let { controlRef: e, domElement: t } = this.context;
1888
- t.addEventListener("click", this.onClick), t.addEventListener("pointermove", this.onPointerMove), t.addEventListener("pointerdown", this.onPointerDown), window.addEventListener("pointerup", this.onPointerUp), window.addEventListener("pointercancel", this.onPointerUp), window.addEventListener("keydown", this.onKeyDown), e.current?.addEventListener("change", this.onControlsChange);
1930
+ t.addEventListener("click", this.onClick), t.addEventListener("pointermove", this.onPointerMove), t.addEventListener("pointerdown", this.onPointerDown), window.addEventListener("pointerup", this.onPointerUp), window.addEventListener("pointercancel", this.onPointerUp), window.addEventListener("keydown", this.onKeyDown), e.current?.addEventListener("update", this.onControlsChange);
1889
1931
  }
1890
1932
  removeEventListeners() {
1891
1933
  let { controlRef: e, domElement: t } = this.context;
1892
- t.removeEventListener("click", this.onClick), t.removeEventListener("pointermove", this.onPointerMove), t.removeEventListener("pointerdown", this.onPointerDown), window.removeEventListener("pointerup", this.onPointerUp), window.removeEventListener("pointercancel", this.onPointerUp), window.removeEventListener("keydown", this.onKeyDown), e.current?.removeEventListener("change", this.onControlsChange);
1934
+ t.removeEventListener("click", this.onClick), t.removeEventListener("pointermove", this.onPointerMove), t.removeEventListener("pointerdown", this.onPointerDown), window.removeEventListener("pointerup", this.onPointerUp), window.removeEventListener("pointercancel", this.onPointerUp), window.removeEventListener("keydown", this.onKeyDown), e.current?.removeEventListener("update", this.onControlsChange);
1893
1935
  }
1894
1936
  drawStart(e) {
1895
1937
  let t = this.getClosestVertex(e);
@@ -1914,7 +1956,7 @@ var jn = class e {
1914
1956
  this.currentDimension && (this.currentDimension.createBoundingBox(), this.dimensions.push(this.currentDimension), this.currentDimension = null, this.measureInProcess = !1, this.axis = null);
1915
1957
  }
1916
1958
  createDimension(e, t) {
1917
- return new wn({
1959
+ return new Tn({
1918
1960
  boundingMaterial: this.boundingMaterial,
1919
1961
  endpointGeometry: this.endpointGeometry,
1920
1962
  endpointMaterial: this.endpointMaterial,
@@ -1926,7 +1968,7 @@ var jn = class e {
1926
1968
  });
1927
1969
  }
1928
1970
  getModelHit(e) {
1929
- let t = On(this.context.modelRef.current);
1971
+ let t = kn(this.context.modelRef.current);
1930
1972
  return t.length ? this.context.cameraUtils.getIntersection(!0, {
1931
1973
  event: e,
1932
1974
  filter: (e) => !!e.face,
@@ -1938,7 +1980,7 @@ var jn = class e {
1938
1980
  return this.dimensions.map((e) => e.boundingBox).filter((e) => !!e);
1939
1981
  }
1940
1982
  getClosestVertex(e) {
1941
- if (!(e.object instanceof M) || !e.face) return e.point.clone();
1983
+ if (!(e.object instanceof P) || !e.face) return e.point.clone();
1942
1984
  let t = e.object.geometry.attributes.position;
1943
1985
  if (!t) return e.point.clone();
1944
1986
  let n = [
@@ -1946,29 +1988,29 @@ var jn = class e {
1946
1988
  e.face.b,
1947
1989
  e.face.c
1948
1990
  ].map((n) => {
1949
- let r = new P(t.getX(n), t.getY(n), t.getZ(n));
1991
+ let r = new I(t.getX(n), t.getY(n), t.getZ(n));
1950
1992
  return e.object.localToWorld(r);
1951
1993
  }).filter((t) => t.distanceTo(e.point) <= this.snapDistance);
1952
1994
  return n.length ? n.reduce((t, n) => n.distanceTo(e.point) < t.distanceTo(e.point) ? n : t) : e.point.clone();
1953
1995
  }
1954
1996
  getPreviewEndPoint(e, t) {
1955
1997
  if (!t) return this.axis = null, e.clone();
1956
- let n = this.axis ?? An(this.startPoint, e);
1957
- return this.axis = n, kn(this.startPoint, e, n);
1998
+ let n = this.axis ?? jn(this.startPoint, e);
1999
+ return this.axis = n, An(this.startPoint, e, n);
1958
2000
  }
1959
2001
  getNextAxis() {
1960
2002
  switch (this.axis) {
1961
2003
  case "x": return "y";
1962
2004
  case "y": return "z";
1963
2005
  case "z": return "x";
1964
- default: return Dn;
2006
+ default: return On;
1965
2007
  }
1966
2008
  }
1967
2009
  getIsMoving() {
1968
2010
  return this.moveState !== "end" && this.moveState !== "start";
1969
2011
  }
1970
2012
  rescalePreviewMarker() {
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;
2013
+ let { camera: e, viewportHeight: t } = this.context, n = this.previewMarker.position.distanceTo(e.position), r = e instanceof se ? 2 * Math.tan(e.fov * Math.PI / 360) * Math.max(n, .001) * 6.667 / Math.max(1, t) : .08;
1972
2014
  this.previewMarker.scale.setScalar(r);
1973
2015
  }
1974
2016
  setSelectionInteractionDisabled(e) {
@@ -2005,11 +2047,11 @@ var jn = class e {
2005
2047
  return n.translate(0, -e / 2, 0), n.rotateX(-Math.PI / 2), n;
2006
2048
  }
2007
2049
  static createPreviewGeometry() {
2008
- return new me(.5, 16, 12);
2050
+ return new fe(.5, 16, 12);
2009
2051
  }
2010
2052
  };
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({
2053
+ function Nn(e, t, n) {
2054
+ let r = p((e) => e.camera), i = p((e) => e.gl), a = p((e) => e.scene), s = p((e) => e.size), l = Ee(), u = c(() => new Mn({
2013
2055
  camera: r,
2014
2056
  cameraUtils: n,
2015
2057
  controlRef: t,
@@ -2071,15 +2113,15 @@ function Mn(e, t, n) {
2071
2113
  }
2072
2114
  //#endregion
2073
2115
  //#region src/viewer/utils/Hotkeys/useHotkeysUtils.tsx
2074
- function Nn(e) {
2116
+ function Pn(e) {
2075
2117
  return e instanceof HTMLElement ? e.isContentEditable || e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement : !1;
2076
2118
  }
2077
- function Pn() {
2078
- let e = L((e) => e.api), t = L((e) => e.defaultHotkeysEnabled);
2119
+ function Fn() {
2120
+ let e = z((e) => e.api), t = z((e) => e.defaultHotkeysEnabled);
2079
2121
  o(() => {
2080
2122
  if (!t) return;
2081
2123
  let n = (t) => {
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());
2124
+ Pn(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
2125
  };
2084
2126
  return window.addEventListener("keydown", n), () => {
2085
2127
  window.removeEventListener("keydown", n);
@@ -2088,15 +2130,15 @@ function Pn() {
2088
2130
  }
2089
2131
  //#endregion
2090
2132
  //#region src/viewer/Camera/useCameraUtils.ts
2091
- var Fn = 1e-6;
2092
- function In(e, t) {
2133
+ var In = 1e-6;
2134
+ function Ln(e, t) {
2093
2135
  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 N((e.clientX - n.left) / n.width * 2 - 1, -((e.clientY - n.top) / n.height) * 2 + 1);
2136
+ 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 F((e.clientX - n.left) / n.width * 2 - 1, -((e.clientY - n.top) / n.height) * 2 + 1);
2095
2137
  }
2096
- function Ln(e, t) {
2097
- return t.every((t) => t.distanceToPoint(e) >= -Fn);
2138
+ function Rn(e, t) {
2139
+ return t.every((t) => t.distanceToPoint(e) >= -In);
2098
2140
  }
2099
- function Rn(e) {
2141
+ function zn(e) {
2100
2142
  let t = e;
2101
2143
  for (; t;) {
2102
2144
  if (!t.visible) return !1;
@@ -2104,8 +2146,8 @@ function Rn(e) {
2104
2146
  }
2105
2147
  return !0;
2106
2148
  }
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) => {
2149
+ function Bn(e) {
2150
+ 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 F()), d = i((e) => {
2109
2151
  a.current = e;
2110
2152
  }, []), f = i(() => {
2111
2153
  let e = a.current;
@@ -2113,7 +2155,7 @@ function zn(e) {
2113
2155
  }, []);
2114
2156
  o(() => {
2115
2157
  let e = n.domElement, t = (t) => {
2116
- let n = In(t, e);
2158
+ let n = Ln(t, e);
2117
2159
  n && (s.current = n);
2118
2160
  }, r = () => {
2119
2161
  s.current = null;
@@ -2123,11 +2165,11 @@ function zn(e) {
2123
2165
  };
2124
2166
  }, [n]);
2125
2167
  let m = i((i = !1, { event: a, filter: o, object: c = e.current, recursive: l = !0, respectClipping: d = !0 } = {}) => {
2126
- let p = a ? In(a, n.domElement) : s.current;
2168
+ let p = a ? Ln(a, n.domElement) : s.current;
2127
2169
  if (!p || !c) return i ? null : [];
2128
2170
  let m = d ? f() : [], h = Array.isArray(c) ? c : [c];
2129
2171
  t.updateMatrixWorld(), e.current?.updateMatrixWorld(!0), u.current.copy(p), r.setFromCamera(u.current, t);
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);
2172
+ let g = r.intersectObjects(h, l).filter((e) => zn(e.object) ? m.length ? Rn(e.point, m) : !0 : !1).filter((e) => o ? o(e) : !0);
2131
2173
  return i ? g[0] ?? null : g;
2132
2174
  }, [
2133
2175
  t,
@@ -2148,8 +2190,8 @@ function zn(e) {
2148
2190
  }
2149
2191
  //#endregion
2150
2192
  //#region src/viewer/Selector/SelectionBox.ts
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) {
2193
+ var Vn = new I(), Hn = new I(), G = new F(), Un = new I(), Wn = new I(), Gn = new I(), Kn = new I(), qn = new I(), Jn = new I(), Yn = new I();
2194
+ function Xn(e) {
2153
2195
  let t = e;
2154
2196
  for (; t;) {
2155
2197
  let e = t.modelID ?? t.userData.modelID;
@@ -2158,7 +2200,7 @@ function Yn(e) {
2158
2200
  }
2159
2201
  return 0;
2160
2202
  }
2161
- function Xn(e) {
2203
+ function Zn(e) {
2162
2204
  let t = e;
2163
2205
  for (; t;) {
2164
2206
  if (!t.visible) return !1;
@@ -2166,16 +2208,16 @@ function Xn(e) {
2166
2208
  }
2167
2209
  return !0;
2168
2210
  }
2169
- function Zn(e, t, n) {
2170
- return n.length ? (Hn.copy(t).applyMatrix4(e.matrixWorld), Ln(Hn, n)) : !0;
2211
+ function Qn(e, t, n) {
2212
+ return n.length ? (Un.copy(t).applyMatrix4(e.matrixWorld), Rn(Un, n)) : !0;
2171
2213
  }
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);
2214
+ function $n(e, t, n, r, i) {
2215
+ return i.length ? (Wn.copy(t).applyMatrix4(e.matrixWorld), Gn.copy(n).applyMatrix4(e.matrixWorld), Kn.copy(r).applyMatrix4(e.matrixWorld), i.every((e) => {
2216
+ let t = e.distanceToPoint(Wn), n = e.distanceToPoint(Gn), r = e.distanceToPoint(Kn);
2175
2217
  return !(t < -1e-6 && n < -1e-6 && r < -1e-6);
2176
2218
  })) : !0;
2177
2219
  }
2178
- function $n(e) {
2220
+ function er(e) {
2179
2221
  let t = e.getBoundingClientRect();
2180
2222
  return {
2181
2223
  height: t.height,
@@ -2184,7 +2226,7 @@ function $n(e) {
2184
2226
  width: t.width
2185
2227
  };
2186
2228
  }
2187
- function er(e) {
2229
+ function tr(e) {
2188
2230
  return {
2189
2231
  boundsCheckMs: 0,
2190
2232
  candidateIds: 0,
@@ -2210,7 +2252,7 @@ function er(e) {
2210
2252
  triangleProjectionMs: 0
2211
2253
  };
2212
2254
  }
2213
- function tr(e, t) {
2255
+ function nr(e, t) {
2214
2256
  return {
2215
2257
  minX: Math.min(e.x, t.x),
2216
2258
  minY: Math.min(e.y, t.y),
@@ -2218,43 +2260,43 @@ function tr(e, t) {
2218
2260
  maxY: Math.max(e.y, t.y)
2219
2261
  };
2220
2262
  }
2221
- function nr(e, t) {
2263
+ function rr(e, t) {
2222
2264
  return t.x >= e.x ? "contains" : "intersects";
2223
2265
  }
2224
- function rr(e, t) {
2225
- return ir(e.x, e.y, t);
2266
+ function ir(e, t) {
2267
+ return ar(e.x, e.y, t);
2226
2268
  }
2227
- function ir(e, t, n) {
2269
+ function ar(e, t, n) {
2228
2270
  return e >= n.minX && e <= n.maxX && t >= n.minY && t <= n.maxY;
2229
2271
  }
2230
- function ar(e, t, n, r, i, a) {
2272
+ function or(e, t, n, r, i, a) {
2231
2273
  return (a - t) * (n - e) > (r - t) * (i - e);
2232
2274
  }
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);
2275
+ function sr(e, t, n, r, i, a, o, s) {
2276
+ return or(e, t, i, a, o, s) !== or(n, r, i, a, o, s) && or(e, t, n, r, i, a) !== or(e, t, n, r, o, s);
2235
2277
  }
2236
- function sr(e, t, n, r, i) {
2278
+ function cr(e, t, n, r, i) {
2237
2279
  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
2280
  return s >= 0 && c >= 0 && s + c <= 2 * a * o;
2239
2281
  }
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);
2282
+ function lr(e, t, n, r) {
2283
+ return ir(e, r) || ir(t, r) || ir(n, r) || cr(r.minX, r.minY, e, t, n) || cr(r.maxX, r.minY, e, t, n) || cr(r.maxX, r.maxY, e, t, n) || cr(r.minX, r.maxY, e, t, n) ? !0 : ur(e, t, r) || ur(t, n, r) || ur(n, e, r);
2242
2284
  }
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);
2285
+ function ur(e, t, n) {
2286
+ return sr(e.x, e.y, t.x, t.y, n.minX, n.minY, n.maxX, n.minY) || sr(e.x, e.y, t.x, t.y, n.maxX, n.minY, n.maxX, n.maxY) || sr(e.x, e.y, t.x, t.y, n.maxX, n.maxY, n.minX, n.maxY) || sr(e.x, e.y, t.x, t.y, n.minX, n.maxY, n.minX, n.minY);
2245
2287
  }
2246
- function G(e, t, n, r, i = new N()) {
2247
- let a = Bn.copy(t).applyMatrix4(e.matrixWorld).project(n);
2288
+ function dr(e, t, n, r, i = new F()) {
2289
+ let a = Vn.copy(t).applyMatrix4(e.matrixWorld).project(n);
2248
2290
  return i.set((a.x + 1) / 2 * r.width + r.left, (-a.y + 1) / 2 * r.height + r.top);
2249
2291
  }
2250
- function ur(e, t, n, r, i) {
2292
+ function fr(e, t, n, r, i) {
2251
2293
  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++) 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;
2294
+ for (let u = 0; u < 2; u++) for (let d = 0; d < 2; d++) for (let f = 0; f < 2; f++) Hn.set(u ? t.max.x : t.min.x, d ? t.max.y : t.min.y, f ? t.max.z : t.min.z), dr(e, Hn, r, i, G), a = Math.min(a, G.x), o = Math.max(o, G.x), s = Math.min(s, G.y), c = Math.max(c, G.y), ir(G, n) && (l += 1);
2295
+ return o < n.minX || a > n.maxX || c < n.minY || s > n.maxY ? xe : l === 8 ? ve : ye;
2254
2296
  }
2255
- function dr(e, t, n, r) {
2297
+ function pr(e, t, n, r) {
2256
2298
  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++) 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);
2299
+ for (let c = 0; c < 2; c++) for (let l = 0; l < 2; l++) for (let u = 0; u < 2; u++) Hn.set(c ? t.max.x : t.min.x, l ? t.max.y : t.min.y, u ? t.max.z : t.min.z), dr(e, Hn, n, r, G), i = Math.min(i, G.x), a = Math.max(a, G.x), o = Math.min(o, G.y), s = Math.max(s, G.y);
2258
2300
  return {
2259
2301
  minX: i,
2260
2302
  minY: o,
@@ -2262,41 +2304,41 @@ function dr(e, t, n, r) {
2262
2304
  maxY: s
2263
2305
  };
2264
2306
  }
2265
- function fr(e, t) {
2307
+ function mr(e, t) {
2266
2308
  return !(e.maxX < t.minX || e.minX > t.maxX || e.maxY < t.minY || e.minY > t.maxY);
2267
2309
  }
2268
- function pr(e, t, n, r) {
2310
+ function hr(e, t, n, r) {
2269
2311
  e.geometry.boundingBox || e.geometry.computeBoundingBox();
2270
2312
  let i = e.geometry.boundingBox;
2271
- return i ? fr(dr(e, i, n, r), t) : !0;
2313
+ return i ? mr(pr(e, i, n, r), t) : !0;
2272
2314
  }
2273
- function mr(e, t, n) {
2315
+ function gr(e, t, n) {
2274
2316
  let r = e.get(t);
2275
2317
  r || (r = /* @__PURE__ */ new Set(), e.set(t, r)), r.add(n);
2276
2318
  }
2277
- function hr(e) {
2319
+ function _r(e) {
2278
2320
  let t = 0;
2279
2321
  return e.forEach((e) => {
2280
2322
  t += e.size;
2281
2323
  }), t;
2282
2324
  }
2283
- function gr(e, t, n, r = []) {
2325
+ function vr(e, t, n, r = []) {
2284
2326
  let i = e.geometry, a = i.index, o = i.attributes.ids, s = i.attributes.position;
2285
2327
  if (!a || !o || !s) return;
2286
2328
  let c = t * 3;
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)));
2329
+ r.length && (qn.fromBufferAttribute(s, a.getX(c)), Jn.fromBufferAttribute(s, a.getX(c + 1)), Yn.fromBufferAttribute(s, a.getX(c + 2)), !$n(e, qn, Jn, Yn, r)) || gr(n, Xn(e), o.getX(a.getX(c)));
2288
2330
  }
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();
2331
+ function yr({ model: e, camera: t, viewport: n, rect: r, candidateIdsByModel: i, clippingPlanes: a, profile: o }) {
2332
+ let s = performance.now(), c = /* @__PURE__ */ new Map(), l = new I();
2291
2333
  e.traverse((e) => {
2292
2334
  let s = e;
2293
- if (!s.isMesh || !Xn(s)) return;
2335
+ if (!s.isMesh || !Zn(s)) return;
2294
2336
  let u = s.geometry.attributes.ids, d = s.geometry.attributes.position;
2295
2337
  if (!(!u || !d)) {
2296
2338
  o && (o.containedVerticesVisited += u.count);
2297
2339
  for (let e = 0; e < u.count; e++) {
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;
2340
+ let f = Xn(s), p = u.getX(e);
2341
+ if (!i.get(f)?.has(p) || (l.fromBufferAttribute(d, e), !Qn(s, l, a))) continue;
2300
2342
  o && (o.containedCandidateVertices += 1);
2301
2343
  let m = `${f}:${p}`, h = c.get(m);
2302
2344
  h || (h = {
@@ -2304,23 +2346,23 @@ function _r({ model: e, camera: t, viewport: n, rect: r, candidateIdsByModel: i,
2304
2346
  inside: 0,
2305
2347
  modelID: f,
2306
2348
  total: 0
2307
- }, c.set(m, h)), h.total += 1, rr(G(s, l, t, n), r) && (h.inside += 1);
2349
+ }, c.set(m, h)), h.total += 1, ir(dr(s, l, t, n), r) && (h.inside += 1);
2308
2350
  }
2309
2351
  }
2310
2352
  });
2311
2353
  let u = /* @__PURE__ */ new Map();
2312
2354
  return c.forEach((e) => {
2313
- e.total > 0 && e.total === e.inside && mr(u, e.modelID, e.id);
2355
+ e.total > 0 && e.total === e.inside && gr(u, e.modelID, e.id);
2314
2356
  }), o && (o.containedIdsMs += performance.now() - s), u;
2315
2357
  }
2316
- function vr({ model: e, camera: t, clippingPlanes: n = [], domElement: r, rect: i, mode: a, profile: o }) {
2358
+ function br({ model: e, camera: t, clippingPlanes: n = [], domElement: r, rect: i, mode: a, profile: o }) {
2317
2359
  let s = performance.now(), c = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map();
2318
2360
  if (!e) return c;
2319
- let u = $n(r), d = performance.now();
2361
+ let u = er(r), d = performance.now();
2320
2362
  e.updateMatrixWorld(!0), t.updateMatrixWorld(), o && (o.matrixUpdateMs += performance.now() - d), e.traverse((e) => {
2321
2363
  let r = e;
2322
2364
  if (!r.isMesh) return;
2323
- if (o && (o.meshCount += 1), !Xn(r)) {
2365
+ if (o && (o.meshCount += 1), !Zn(r)) {
2324
2366
  o && (o.skippedMeshCount += 1);
2325
2367
  return;
2326
2368
  }
@@ -2329,7 +2371,7 @@ function vr({ model: e, camera: t, clippingPlanes: n = [], domElement: r, rect:
2329
2371
  o && (o.skippedMeshCount += 1);
2330
2372
  return;
2331
2373
  }
2332
- let d = performance.now(), f = pr(r, i, t, u);
2374
+ let d = performance.now(), f = hr(r, i, t, u);
2333
2375
  if (o && (o.boundsCheckMs += performance.now() - d), !f) {
2334
2376
  o && (o.skippedMeshCount += 1);
2335
2377
  return;
@@ -2337,26 +2379,26 @@ function vr({ model: e, camera: t, clippingPlanes: n = [], domElement: r, rect:
2337
2379
  let p = performance.now();
2338
2380
  s.shapecast({
2339
2381
  intersectsBounds: (e) => {
2340
- let n = performance.now(), a = ur(r, e, i, t, u);
2382
+ let n = performance.now(), a = fr(r, e, i, t, u);
2341
2383
  return o && (o.intersectsBoundsCalls += 1, o.intersectsBoundsMs += performance.now() - n), a;
2342
2384
  },
2343
2385
  intersectsRange: (e, t, i) => {
2344
2386
  let u = performance.now();
2345
2387
  if (o && (o.intersectsRangeCalls += 1), !i) return o && (o.intersectsRangeMs += performance.now() - u), !1;
2346
- for (let i = e; i < e + t; i++) gr(r, s.resolveTriangleIndex(i), a === "contains" ? l : c, n);
2388
+ for (let i = e; i < e + t; i++) vr(r, s.resolveTriangleIndex(i), a === "contains" ? l : c, n);
2347
2389
  return o && (o.intersectsRangeMs += performance.now() - u), !1;
2348
2390
  },
2349
2391
  intersectsTriangle: (e, s, d) => {
2350
2392
  let f = performance.now();
2351
2393
  if (o && (o.intersectsTriangleCalls += 1), !d) {
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;
2394
+ let n = performance.now(), a = dr(r, e.a, t, u), s = dr(r, e.b, t, u), c = dr(r, e.c, t, u);
2395
+ if (o && (o.triangleProjectionMs += performance.now() - n), !lr(a, s, c, i)) return o && (o.intersectsTriangleMs += performance.now() - f), !1;
2354
2396
  }
2355
- return a === "contains" ? gr(r, s, l, n) : gr(r, s, c, n), o && (o.intersectsTriangleMs += performance.now() - f), !1;
2397
+ return a === "contains" ? vr(r, s, l, n) : vr(r, s, c, n), o && (o.intersectsTriangleMs += performance.now() - f), !1;
2356
2398
  }
2357
2399
  }), o && (o.shapecastMs += performance.now() - p);
2358
2400
  });
2359
- let f = a === "contains" ? _r({
2401
+ let f = a === "contains" ? yr({
2360
2402
  model: e,
2361
2403
  camera: t,
2362
2404
  clippingPlanes: n,
@@ -2365,19 +2407,19 @@ function vr({ model: e, camera: t, clippingPlanes: n = [], domElement: r, rect:
2365
2407
  candidateIdsByModel: l,
2366
2408
  profile: o
2367
2409
  }) : c;
2368
- return o && (o.candidateIds = hr(l), o.selectedIds = hr(f), o.totalMs = performance.now() - s), f;
2410
+ return o && (o.candidateIds = _r(l), o.selectedIds = _r(f), o.totalMs = performance.now() - s), f;
2369
2411
  }
2370
- function yr(e) {
2371
- let t = er(e.mode);
2412
+ function xr(e) {
2413
+ let t = tr(e.mode);
2372
2414
  return {
2373
- ids: vr({
2415
+ ids: br({
2374
2416
  ...e,
2375
2417
  profile: t
2376
2418
  }),
2377
2419
  profile: t
2378
2420
  };
2379
2421
  }
2380
- function br(e) {
2422
+ function Sr(e) {
2381
2423
  return e === "contains" ? {
2382
2424
  border: "rgb(37, 99, 235)",
2383
2425
  background: "rgba(37, 99, 235, 0.16)"
@@ -2386,32 +2428,32 @@ function br(e) {
2386
2428
  background: "rgba(22, 163, 74, 0.16)"
2387
2429
  };
2388
2430
  }
2389
- function xr(e, t, n) {
2390
- let r = br(nr(t, n));
2431
+ function Cr(e, t, n) {
2432
+ let r = Sr(rr(t, n));
2391
2433
  if (!e.current) {
2392
2434
  let t = document.createElement("div");
2393
2435
  t.style.position = "fixed", t.style.pointerEvents = "none", t.style.zIndex = "10", e.current = t, document.body.appendChild(t);
2394
2436
  }
2395
- let i = tr(t, n);
2437
+ let i = nr(t, n);
2396
2438
  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
2439
  }
2398
- function Sr(e) {
2440
+ function wr(e) {
2399
2441
  e.current?.remove(), e.current = null;
2400
2442
  }
2401
2443
  //#endregion
2402
2444
  //#region src/viewer/Selector/useSelector.tsx
2403
- var Cr = 40;
2404
- function wr(e) {
2445
+ var Tr = 40;
2446
+ function Er(e) {
2405
2447
  if (!Array.isArray(e)) return e.userData.shader;
2406
2448
  }
2407
- function Tr(e, t) {
2408
- let n = wr(e)?.uniforms.preSelectionId;
2449
+ function Dr(e, t) {
2450
+ let n = Er(e)?.uniforms.preSelectionId;
2409
2451
  n && (n.value = t);
2410
2452
  }
2411
- function Er(e) {
2453
+ function Or(e) {
2412
2454
  return Number(e.current?.modelID ?? 0);
2413
2455
  }
2414
- function Dr(e) {
2456
+ function kr(e) {
2415
2457
  let t = e;
2416
2458
  for (; t;) {
2417
2459
  let e = t.modelID ?? t.userData.modelID;
@@ -2420,7 +2462,7 @@ function Dr(e) {
2420
2462
  }
2421
2463
  return 0;
2422
2464
  }
2423
- function Or(e) {
2465
+ function Ar(e) {
2424
2466
  let t = e;
2425
2467
  for (; t;) {
2426
2468
  if (!t.visible) return !1;
@@ -2428,76 +2470,79 @@ function Or(e) {
2428
2470
  }
2429
2471
  return !0;
2430
2472
  }
2431
- function kr(e) {
2432
- if (!Or(e.object) || !(e.object instanceof M) || e.faceIndex === void 0 || e.faceIndex === null) return !1;
2473
+ function jr(e) {
2474
+ if (!Ar(e.object) || !(e.object instanceof P) || e.faceIndex === void 0 || e.faceIndex === null) return !1;
2433
2475
  let t = e.object.geometry;
2434
2476
  return !!(t.index && t.attributes.ids);
2435
2477
  }
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 = () => {
2478
+ function Mr(e, t, n) {
2479
+ let r = l("end"), i = z((e) => e.selected), a = z((e) => e.setSelected), s = z((e) => e.addSelected), c = z((e) => e.removeSelected), u = z((e) => e.showStats), d = Ee(), 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 = (e) => {
2480
+ let n = t.current;
2481
+ n && (n.cancel(), n.setOrbitPoint(e.x, e.y, e.z));
2482
+ }, T = () => {
2438
2483
  e.current?.traverse((e) => {
2439
- if (!(e instanceof M)) return;
2484
+ if (!(e instanceof P)) return;
2440
2485
  let t = e;
2441
- t.preselected = !1, Tr(t.material, -1);
2486
+ t.preselected = !1, Dr(t.material, -1);
2442
2487
  });
2443
- }, T = () => {
2444
- f.current = null, h.current = !1, Sr(m), t.current && (t.current.enabled = !0);
2445
- }, E = (t) => {
2488
+ }, E = () => {
2489
+ f.current = null, h.current = !1, wr(m), t.current && (t.current.enabled = !0);
2490
+ }, D = (t) => {
2446
2491
  if (C()) {
2447
- w();
2492
+ T();
2448
2493
  return;
2449
2494
  }
2450
2495
  if (f.current) {
2451
- w();
2496
+ T();
2452
2497
  return;
2453
2498
  }
2454
2499
  if (r.current !== "end" && r.current !== "start") {
2455
- w();
2500
+ T();
2456
2501
  return;
2457
2502
  }
2458
- let n = oe(t, e.current)[0], i;
2459
- n && (i = n.object), w(), !(!n || !i) && e.current?.traverse((e) => {
2460
- if (!(e instanceof M)) return;
2503
+ let n = ae(t, e.current)[0], i;
2504
+ n && (i = n.object), T(), !(!n || !i) && e.current?.traverse((e) => {
2505
+ if (!(e instanceof P)) return;
2461
2506
  let t = e;
2462
2507
  if (t !== i) return;
2463
2508
  let r = n.faceIndex * 3, a = t.geometry.index.getX(r), o = t.geometry.attributes.ids.getX(a);
2464
- t.preselected = !0, Tr(t.material, o);
2509
+ t.preselected = !0, Dr(t.material, o);
2465
2510
  });
2466
2511
  };
2467
- function D() {
2512
+ function O() {
2468
2513
  return performance.now();
2469
2514
  }
2470
- let ee = (e) => {
2515
+ let k = (e) => {
2471
2516
  if (C()) {
2472
- S.current = null, x.current !== null && (window.clearTimeout(x.current), x.current = null), w();
2517
+ S.current = null, x.current !== null && (window.clearTimeout(x.current), x.current = null), T();
2473
2518
  return;
2474
2519
  }
2475
2520
  if (S.current = e, x.current !== null) return;
2476
- let t = D() - b.current, n = Math.max(0, Cr - t);
2521
+ let t = O() - b.current, n = Math.max(0, Tr - t);
2477
2522
  x.current = window.setTimeout(() => {
2478
2523
  x.current = null;
2479
2524
  let e = S.current;
2480
- S.current = null, e && (b.current = performance.now(), E(e));
2525
+ S.current = null, e && (b.current = performance.now(), D(e));
2481
2526
  }, n);
2482
- }, O = l(null);
2527
+ }, A = l(null);
2483
2528
  o(() => {
2484
2529
  let e = v.current;
2485
2530
  if (e) {
2486
- u && O.current !== null && console.log(`selection ${e.action}:`, Date.now() - O.current, "ms"), v.current = null, O.current = null;
2531
+ u && A.current !== null && console.log(`selection ${e.action}:`, Date.now() - A.current, "ms"), v.current = null, A.current = null;
2487
2532
  return;
2488
2533
  }
2489
- u && O.current !== null && (console.log("selection spend:", Date.now() - O.current, "ms"), O.current = null);
2534
+ u && A.current !== null && (console.log("selection spend:", Date.now() - A.current, "ms"), A.current = null);
2490
2535
  }, [i, u]);
2491
- let { camera: te, gl: k } = p();
2492
- function ne() {
2536
+ let { camera: ee, gl: j } = p();
2537
+ function M() {
2493
2538
  return Date.now();
2494
2539
  }
2495
- let A = (e) => {
2496
- let t = k.domElement.getBoundingClientRect();
2540
+ let te = (e) => {
2541
+ let t = j.domElement.getBoundingClientRect();
2497
2542
  return e.clientX >= t.left && e.clientX <= t.right && e.clientY >= t.top && e.clientY <= t.bottom;
2498
- }, re = (t) => {
2543
+ }, N = (t) => {
2499
2544
  if (C()) {
2500
- y.current = !1, g.current = !1, w();
2545
+ y.current = !1, g.current = !1, T();
2501
2546
  return;
2502
2547
  }
2503
2548
  if (!y.current) return;
@@ -2505,15 +2550,15 @@ function Ar(e, t, n) {
2505
2550
  g.current = !1;
2506
2551
  return;
2507
2552
  }
2508
- if (!A(t)) return;
2509
- if (O.current = ne(), r.current !== "end" && r.current !== "start" && r.current > 15) {
2553
+ if (!te(t)) return;
2554
+ if (A.current = M(), r.current !== "end" && r.current !== "start" && r.current > 15) {
2510
2555
  r.current = "end";
2511
2556
  return;
2512
2557
  }
2513
- let n = t.shiftKey, o = t.ctrlKey, l = oe(t, e.current), u, d = Er(e);
2558
+ let n = t.shiftKey, o = t.ctrlKey, l = ae(t, e.current), u, d = Or(e), f = null;
2514
2559
  if (l.length) {
2515
2560
  let e = l[0], t = e.object;
2516
- d = Dr(t);
2561
+ d = kr(t), f = e.point;
2517
2562
  let n = e.faceIndex * 3, r = t.geometry.index.getX(n);
2518
2563
  u = t.geometry.attributes.ids.getX(r);
2519
2564
  }
@@ -2521,37 +2566,37 @@ function Ar(e, t, n) {
2521
2566
  u !== void 0 && c(d, [u]);
2522
2567
  return;
2523
2568
  } else if (n) {
2524
- u !== void 0 && (i[d]?.has(u) ?? !1 ? c(d, [u]) : s(d, [u]));
2569
+ u !== void 0 && (i[d]?.has(u) ?? !1 ? c(d, [u]) : (s(d, [u]), f && w(f)));
2525
2570
  return;
2526
2571
  }
2527
- a(d, u === void 0 ? [] : [u], !0);
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) => {
2572
+ a(d, u === void 0 ? [] : [u], !0), f && w(f);
2573
+ }, ne = (e) => {
2574
+ C() || e.button !== 0 || !e.shiftKey && !e.ctrlKey || (f.current = new F(e.clientX, e.clientY), _.current = e.ctrlKey ? "remove" : "add", h.current = !1, t.current && (t.current.enabled = !1));
2575
+ }, re = (e) => {
2531
2576
  if (C()) {
2532
- T();
2577
+ E();
2533
2578
  return;
2534
2579
  }
2535
2580
  if (!f.current) return;
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) => {
2581
+ let t = new F(e.clientX, e.clientY), n = Math.abs(t.x - f.current.x), r = Math.abs(t.y - f.current.y);
2582
+ n < 6 && r < 6 || (h.current ||= !0, e.preventDefault(), Cr(m, f.current, t));
2583
+ }, ie = (r) => {
2539
2584
  if (C()) {
2540
- T();
2585
+ E();
2541
2586
  return;
2542
2587
  }
2543
2588
  if (!f.current) return;
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(() => {
2589
+ A.current = M();
2590
+ let i = h.current, a = new F(r.clientX, r.clientY), o = nr(f.current, a), l = rr(f.current, a);
2591
+ if (f.current = null, h.current = !1, wr(m), t.current && setTimeout(() => {
2547
2592
  t.current && (t.current.enabled = !0);
2548
2593
  }, 100), !i) return;
2549
2594
  g.current = !0, r.preventDefault();
2550
- let { ids: u, profile: d } = yr({
2595
+ let { ids: u, profile: d } = xr({
2551
2596
  model: e.current,
2552
- camera: te,
2597
+ camera: ee,
2553
2598
  clippingPlanes: n.getActiveClippingPlanes(),
2554
- domElement: k.domElement,
2599
+ domElement: j.domElement,
2555
2600
  rect: o,
2556
2601
  mode: l
2557
2602
  }), p = Array.from(u.values()).reduce((e, t) => e + t.size, 0), y = {
@@ -2563,16 +2608,16 @@ function Ar(e, t, n) {
2563
2608
  let n = Array.from(e);
2564
2609
  _.current === "remove" ? c(t, n) : s(t, n);
2565
2610
  }));
2566
- }, oe = (e, t) => t ? n.getIntersection(!1, {
2611
+ }, ae = (e, t) => t ? n.getIntersection(!1, {
2567
2612
  event: e,
2568
- filter: kr,
2613
+ filter: jr,
2569
2614
  object: t,
2570
2615
  recursive: !0
2571
2616
  }) : [];
2572
2617
  o(() => {
2573
2618
  let e = t.current;
2574
2619
  if (!e) return;
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);
2620
+ j.domElement.addEventListener("pointerdown", ne), j.domElement.addEventListener("pointermove", re), window.addEventListener("pointerup", ie), window.addEventListener("pointerup", N), j.domElement.addEventListener("contextmenu", o), j.domElement.addEventListener("pointerup", a), j.domElement.addEventListener("pointermove", k), j.domElement.addEventListener("pointerleave", T), j.domElement.addEventListener("pointerdown", i), e.addEventListener("update", n);
2576
2621
  function n() {
2577
2622
  typeof r.current == "number" ? r.current += 1 : r.current === "start" && (r.current = 1);
2578
2623
  }
@@ -2588,47 +2633,49 @@ function Ar(e, t, n) {
2588
2633
  e.ctrlKey && e.preventDefault();
2589
2634
  }
2590
2635
  return () => {
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);
2636
+ wr(m), x.current !== null && (window.clearTimeout(x.current), x.current = null), S.current = null, T(), e.removeEventListener("update", n), j.domElement.removeEventListener("pointerdown", ne), j.domElement.removeEventListener("pointermove", re), window.removeEventListener("pointerup", ie), window.removeEventListener("pointerup", N), j.domElement.removeEventListener("contextmenu", o), j.domElement.removeEventListener("pointerup", a), j.domElement.removeEventListener("pointerdown", i), j.domElement.removeEventListener("pointermove", k), j.domElement.removeEventListener("pointerleave", T);
2592
2637
  };
2593
2638
  });
2594
2639
  }
2595
2640
  //#endregion
2596
2641
  //#region src/viewer/Camera/useCameraFit.tsx
2597
- var jr = new P(1, 1, 1).normalize(), Mr = 1.18;
2598
- function Nr() {
2642
+ var Nr = new I(1, 1, 1).normalize(), Pr = 1.18;
2643
+ function Fr() {
2599
2644
  let { camera: e } = p();
2600
2645
  return i((t, n, r) => {
2601
- if (!t.current || !(e instanceof le)) return;
2646
+ if (!t.current || !(e instanceof se)) return;
2602
2647
  let i = new g().setFromObject(t.current);
2603
2648
  if (i.isEmpty()) return;
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));
2649
+ let a = i.getCenter(new I()), o = i.getBoundingSphere(new de()), 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) * Pr;
2650
+ e.position.copy(a).addScaledVector(Nr, u), e.up.set(0, 1, 0), e.lookAt(a), e.updateProjectionMatrix();
2651
+ let d = n.current;
2652
+ d && (d.cancel(), d.setFocalOffset(0, 0, 0, !1), d.setLookAt(e.position.x, e.position.y, e.position.z, a.x, a.y, a.z, !1)), r.current && (r.current.position.copy(a).addScaledVector(Nr, u * .8), r.current.lookAt(a));
2606
2653
  }, [e]);
2607
2654
  }
2608
2655
  //#endregion
2609
2656
  //#region src/viewer/store/ViewerStoreProvider.tsx
2610
- function Pr({ children: e, store: t }) {
2611
- let [n] = u(() => t ?? je());
2612
- return /* @__PURE__ */ F(De.Provider, {
2657
+ function Ir({ children: e, store: t }) {
2658
+ let [n] = u(() => t ?? Ae());
2659
+ return /* @__PURE__ */ L(Te.Provider, {
2613
2660
  value: n,
2614
2661
  children: e
2615
2662
  });
2616
2663
  }
2617
2664
  //#endregion
2618
2665
  //#region src/viewer/utils/ExportUtils/ExportUtils.ts
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
- function Br(e) {
2666
+ var Lr = new TextEncoder(), Rr = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>", zr = "Unknown", Br = ["elementID", "ifcguid"], Vr = 0, Hr = 33;
2667
+ function Ur(e) {
2621
2668
  return !!e && typeof e == "object" && !Array.isArray(e);
2622
2669
  }
2623
- function Vr(e, t) {
2624
- return e == null ? t : typeof e == "boolean" ? e ? "true" : "false" : typeof e == "number" ? Number.isFinite(e) ? String(e) : t : typeof e == "string" ? e.trim() ? e : t : Br(e) && "value" in e ? Vr(e.value, t) : null;
2670
+ function Wr(e, t) {
2671
+ return e == null ? t : typeof e == "boolean" ? e ? "true" : "false" : typeof e == "number" ? Number.isFinite(e) ? String(e) : t : typeof e == "string" ? e.trim() ? e : t : Ur(e) && "value" in e ? Wr(e.value, t) : null;
2625
2672
  }
2626
- function Hr(e, t) {
2627
- let n = Vr(e, t);
2673
+ function Gr(e, t) {
2674
+ let n = Wr(e, t);
2628
2675
  if (n !== null) return n;
2629
2676
  if (Array.isArray(e)) {
2630
2677
  if (!e.length) return t;
2631
- let n = e.map((e) => Vr(e, t));
2678
+ let n = e.map((e) => Wr(e, t));
2632
2679
  if (n.every((e) => e !== null)) {
2633
2680
  let e = n.join(", ");
2634
2681
  return e.trim() ? e : t;
@@ -2641,21 +2688,21 @@ function Hr(e, t) {
2641
2688
  return t;
2642
2689
  }
2643
2690
  }
2644
- function q(e) {
2691
+ function K(e) {
2645
2692
  return typeof e == "string" && e.trim() ? e : null;
2646
2693
  }
2647
- function Ur(e) {
2648
- let t = Br(e.props) ? e.props : {};
2649
- return q(e.type ?? e.Type ?? t.type ?? t.Type) ?? Ir;
2694
+ function Kr(e) {
2695
+ let t = Ur(e.props) ? e.props : {};
2696
+ return K(e.type ?? e.Type ?? t.type ?? t.Type) ?? zr;
2650
2697
  }
2651
- function Wr(e) {
2652
- let t = Br(e.props) ? e.props : {};
2653
- return q(e.guid ?? e.GlobalId ?? e.globalId ?? t.guid ?? t.GlobalId ?? t.globalId) ?? "";
2698
+ function qr(e) {
2699
+ let t = Ur(e.props) ? e.props : {};
2700
+ return K(e.guid ?? e.GlobalId ?? e.globalId ?? t.guid ?? t.GlobalId ?? t.globalId) ?? "";
2654
2701
  }
2655
- function Gr(e, t) {
2656
- return q(e.Name) ?? q(e.name) ?? q(e.DisplayName) ?? q(e.displayName) ?? `Property ${t + 1}`;
2702
+ function Jr(e, t) {
2703
+ return K(e.Name) ?? K(e.name) ?? K(e.DisplayName) ?? K(e.displayName) ?? `Property ${t + 1}`;
2657
2704
  }
2658
- function Kr(e) {
2705
+ function Yr(e) {
2659
2706
  for (let t of [
2660
2707
  "NominalValue",
2661
2708
  "nominalValue",
@@ -2678,18 +2725,18 @@ function Kr(e) {
2678
2725
  "description"
2679
2726
  ].includes(e)));
2680
2727
  }
2681
- function qr(e, t) {
2682
- return q(e.name) ?? q(e.Name) ?? `Set ${t + 1}`;
2728
+ function Xr(e, t) {
2729
+ return K(e.name) ?? K(e.Name) ?? `Set ${t + 1}`;
2683
2730
  }
2684
- function Jr(e) {
2731
+ function Zr(e) {
2685
2732
  let t = e.props;
2686
- return Array.isArray(t) ? t.map((e, t) => Br(e) ? {
2687
- label: Gr(e, t),
2688
- value: Kr(e)
2733
+ return Array.isArray(t) ? t.map((e, t) => Ur(e) ? {
2734
+ label: Jr(e, t),
2735
+ value: Yr(e)
2689
2736
  } : {
2690
2737
  label: `Property ${t + 1}`,
2691
2738
  value: e
2692
- }) : Br(t) ? Object.entries(t).map(([e, t]) => ({
2739
+ }) : Ur(t) ? Object.entries(t).map(([e, t]) => ({
2693
2740
  label: e,
2694
2741
  value: t
2695
2742
  })) : Object.entries(e).filter(([e]) => ![
@@ -2703,14 +2750,14 @@ function Jr(e) {
2703
2750
  value: t
2704
2751
  }));
2705
2752
  }
2706
- function Yr(e, t) {
2753
+ function Qr(e, t) {
2707
2754
  e.columnSet.has(t) || (e.columnSet.add(t), e.columns.push(t));
2708
2755
  }
2709
- function Xr(e, t, n, r, i) {
2756
+ function $r(e, t, n, r, i) {
2710
2757
  let a = n.trim();
2711
- a && (Yr(e, a), t[a] = Hr(r, i));
2758
+ a && (Qr(e, a), t[a] = Gr(r, i));
2712
2759
  }
2713
- function Zr(e, t, n) {
2760
+ function ei(e, t, n) {
2714
2761
  let r = {};
2715
2762
  return Object.entries(t).forEach(([t, i]) => {
2716
2763
  [
@@ -2718,33 +2765,33 @@ function Zr(e, t, n) {
2718
2765
  "guid",
2719
2766
  "props",
2720
2767
  "sets"
2721
- ].includes(t) || Xr(e, r, t, i, n);
2722
- }), Br(t.props) && Object.entries(t.props).forEach(([t, i]) => {
2723
- Xr(e, r, t, i, n);
2768
+ ].includes(t) || $r(e, r, t, i, n);
2769
+ }), Ur(t.props) && Object.entries(t.props).forEach(([t, i]) => {
2770
+ $r(e, r, t, i, n);
2724
2771
  }), Array.isArray(t.sets) && t.sets.forEach((t, i) => {
2725
- let a = qr(t, i);
2726
- Jr(t).forEach((t) => {
2727
- Xr(e, r, `${a}.${t.label}`, t.value, n);
2772
+ let a = Xr(t, i);
2773
+ Zr(t).forEach((t) => {
2774
+ $r(e, r, `${a}.${t.label}`, t.value, n);
2728
2775
  });
2729
2776
  }), r;
2730
2777
  }
2731
- function Qr(e, t, n) {
2778
+ function ti(e, t, n) {
2732
2779
  Object.entries(t).forEach(([t, r]) => {
2733
2780
  let i = Number(t);
2734
2781
  if (!Number.isFinite(i)) return;
2735
- let a = Ur(r), o = e.get(a);
2782
+ let a = Kr(r), o = e.get(a);
2736
2783
  o || (o = {
2737
2784
  columns: [],
2738
2785
  columnSet: /* @__PURE__ */ new Set(),
2739
2786
  rows: []
2740
2787
  }, e.set(a, o)), o.rows.push({
2741
2788
  elementID: i,
2742
- ifcguid: Wr(r),
2743
- values: Zr(o, r, n)
2789
+ ifcguid: qr(r),
2790
+ values: ei(o, r, n)
2744
2791
  });
2745
2792
  });
2746
2793
  }
2747
- function $r(e) {
2794
+ function ni(e) {
2748
2795
  return e.replace(/[<>&'"]/g, (e) => {
2749
2796
  switch (e) {
2750
2797
  case "<": return "&lt;";
@@ -2756,7 +2803,7 @@ function $r(e) {
2756
2803
  }
2757
2804
  });
2758
2805
  }
2759
- function ei(e) {
2806
+ function ri(e) {
2760
2807
  let t = e, n = "";
2761
2808
  for (; t > 0;) {
2762
2809
  let e = (t - 1) % 26;
@@ -2764,45 +2811,45 @@ function ei(e) {
2764
2811
  }
2765
2812
  return n;
2766
2813
  }
2767
- function ti(e, t, n) {
2768
- return `<c r="${`${ei(n)}${t}`}" t="inlineStr"><is><t${/^\s|\s$/.test(e) ? " xml:space=\"preserve\"" : ""}>${$r(e)}</t></is></c>`;
2814
+ function ii(e, t, n) {
2815
+ return `<c r="${`${ri(n)}${t}`}" t="inlineStr"><is><t${/^\s|\s$/.test(e) ? " xml:space=\"preserve\"" : ""}>${ni(e)}</t></is></c>`;
2769
2816
  }
2770
- function ni(e) {
2771
- return `${Fr}<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><sheetData>${e.map((e, t) => {
2817
+ function ai(e) {
2818
+ return `${Rr}<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><sheetData>${e.map((e, t) => {
2772
2819
  let n = t + 1;
2773
- return `<row r="${n}">${e.map((e, t) => ti(e, n, t + 1)).join("")}</row>`;
2820
+ return `<row r="${n}">${e.map((e, t) => ii(e, n, t + 1)).join("")}</row>`;
2774
2821
  }).join("")}</sheetData></worksheet>`;
2775
2822
  }
2776
- function ri(e) {
2777
- return e.replace(/[\\/?*[\]:]/g, " ").trim() || Ir;
2823
+ function oi(e) {
2824
+ return e.replace(/[\\/?*[\]:]/g, " ").trim() || zr;
2778
2825
  }
2779
- function ii(e, t) {
2780
- let n = ri(e).slice(0, 31), r = n, i = 2;
2826
+ function si(e, t) {
2827
+ let n = oi(e).slice(0, 31), r = n, i = 2;
2781
2828
  for (; t.has(r.toLowerCase());) {
2782
2829
  let e = ` (${i})`;
2783
2830
  r = `${n.slice(0, 31 - e.length)}${e}`, i += 1;
2784
2831
  }
2785
2832
  return t.add(r.toLowerCase()), r;
2786
2833
  }
2787
- function ai(e) {
2788
- return `${Fr}<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><sheets>${e.map((e, t) => {
2834
+ function ci(e) {
2835
+ return `${Rr}<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><sheets>${e.map((e, t) => {
2789
2836
  let n = t + 1;
2790
- return `<sheet name="${$r(e)}" sheetId="${n}" r:id="rId${n}"/>`;
2837
+ return `<sheet name="${ni(e)}" sheetId="${n}" r:id="rId${n}"/>`;
2791
2838
  }).join("")}</sheets></workbook>`;
2792
2839
  }
2793
- function oi(e) {
2794
- return `${Fr}<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">${e.map((e, t) => {
2840
+ function li(e) {
2841
+ return `${Rr}<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">${e.map((e, t) => {
2795
2842
  let n = t + 1;
2796
2843
  return `<Relationship Id="rId${n}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet${n}.xml"/>`;
2797
2844
  }).join("")}</Relationships>`;
2798
2845
  }
2799
- function si() {
2800
- return `${Fr}<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/></Relationships>`;
2846
+ function ui() {
2847
+ return `${Rr}<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/></Relationships>`;
2801
2848
  }
2802
- function ci(e) {
2803
- return `${Fr}<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/>${e.map((e, t) => `<Override PartName="/xl/worksheets/sheet${t + 1}.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/>`).join("")}</Types>`;
2849
+ function di(e) {
2850
+ return `${Rr}<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/>${e.map((e, t) => `<Override PartName="/xl/worksheets/sheet${t + 1}.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/>`).join("")}</Types>`;
2804
2851
  }
2805
- function li() {
2852
+ function fi() {
2806
2853
  let e = new Uint32Array(256);
2807
2854
  for (let t = 0; t < 256; t++) {
2808
2855
  let n = t;
@@ -2811,118 +2858,121 @@ function li() {
2811
2858
  }
2812
2859
  return e;
2813
2860
  }
2814
- var ui = li();
2815
- function di(e) {
2861
+ var pi = fi();
2862
+ function mi(e) {
2816
2863
  let t = 4294967295;
2817
- for (let n of e) t = ui[(t ^ n) & 255] ^ t >>> 8;
2864
+ for (let n of e) t = pi[(t ^ n) & 255] ^ t >>> 8;
2818
2865
  return (t ^ 4294967295) >>> 0;
2819
2866
  }
2820
- function fi(e) {
2867
+ function hi(e) {
2821
2868
  let t = new Uint8Array(30 + e.nameBytes.length), n = new DataView(t.buffer);
2822
- return n.setUint32(0, 67324752, !0), n.setUint16(4, 20, !0), n.setUint16(6, 0, !0), n.setUint16(8, 0, !0), n.setUint16(10, Rr, !0), n.setUint16(12, zr, !0), n.setUint32(14, e.crc, !0), n.setUint32(18, e.data.length, !0), n.setUint32(22, e.data.length, !0), n.setUint16(26, e.nameBytes.length, !0), n.setUint16(28, 0, !0), t.set(e.nameBytes, 30), t;
2869
+ return n.setUint32(0, 67324752, !0), n.setUint16(4, 20, !0), n.setUint16(6, 0, !0), n.setUint16(8, 0, !0), n.setUint16(10, Vr, !0), n.setUint16(12, Hr, !0), n.setUint32(14, e.crc, !0), n.setUint32(18, e.data.length, !0), n.setUint32(22, e.data.length, !0), n.setUint16(26, e.nameBytes.length, !0), n.setUint16(28, 0, !0), t.set(e.nameBytes, 30), t;
2823
2870
  }
2824
- function pi(e) {
2871
+ function gi(e) {
2825
2872
  let t = new Uint8Array(46 + e.nameBytes.length), n = new DataView(t.buffer);
2826
- return n.setUint32(0, 33639248, !0), n.setUint16(4, 20, !0), n.setUint16(6, 20, !0), n.setUint16(8, 0, !0), n.setUint16(10, 0, !0), n.setUint16(12, Rr, !0), n.setUint16(14, zr, !0), n.setUint32(16, e.crc, !0), n.setUint32(20, e.data.length, !0), n.setUint32(24, e.data.length, !0), n.setUint16(28, e.nameBytes.length, !0), n.setUint16(30, 0, !0), n.setUint16(32, 0, !0), n.setUint16(34, 0, !0), n.setUint16(36, 0, !0), n.setUint32(38, 0, !0), n.setUint32(42, e.offset, !0), t.set(e.nameBytes, 46), t;
2873
+ return n.setUint32(0, 33639248, !0), n.setUint16(4, 20, !0), n.setUint16(6, 20, !0), n.setUint16(8, 0, !0), n.setUint16(10, 0, !0), n.setUint16(12, Vr, !0), n.setUint16(14, Hr, !0), n.setUint32(16, e.crc, !0), n.setUint32(20, e.data.length, !0), n.setUint32(24, e.data.length, !0), n.setUint16(28, e.nameBytes.length, !0), n.setUint16(30, 0, !0), n.setUint16(32, 0, !0), n.setUint16(34, 0, !0), n.setUint16(36, 0, !0), n.setUint32(38, 0, !0), n.setUint32(42, e.offset, !0), t.set(e.nameBytes, 46), t;
2827
2874
  }
2828
- function mi(e, t, n) {
2875
+ function _i(e, t, n) {
2829
2876
  let r = new Uint8Array(22), i = new DataView(r.buffer);
2830
2877
  return i.setUint32(0, 101010256, !0), i.setUint16(4, 0, !0), i.setUint16(6, 0, !0), i.setUint16(8, e, !0), i.setUint16(10, e, !0), i.setUint32(12, t, !0), i.setUint32(16, n, !0), i.setUint16(20, 0, !0), r;
2831
2878
  }
2832
- function hi(e, t) {
2879
+ function vi(e, t) {
2833
2880
  let n = new Uint8Array(t), r = 0;
2834
2881
  return e.forEach((e) => {
2835
2882
  n.set(e, r), r += e.length;
2836
2883
  }), n;
2837
2884
  }
2838
- function gi(e) {
2885
+ function yi(e) {
2839
2886
  let t = 0, n = e.map((e) => {
2840
2887
  let n = {
2841
2888
  ...e,
2842
- crc: di(e.data),
2843
- nameBytes: K.encode(e.path),
2889
+ crc: mi(e.data),
2890
+ nameBytes: Lr.encode(e.path),
2844
2891
  offset: t
2845
2892
  };
2846
2893
  return t += 30 + n.nameBytes.length + n.data.length, n;
2847
2894
  }), r = [];
2848
2895
  n.forEach((e) => {
2849
- r.push(fi(e), e.data);
2896
+ r.push(hi(e), e.data);
2850
2897
  });
2851
2898
  let i = t, a = 0;
2852
2899
  return n.forEach((e) => {
2853
- let t = pi(e);
2900
+ let t = gi(e);
2854
2901
  a += t.length, r.push(t);
2855
- }), r.push(mi(n.length, a, i)), hi(r, r.reduce((e, t) => e + t.length, 0));
2902
+ }), r.push(_i(n.length, a, i)), vi(r, r.reduce((e, t) => e + t.length, 0));
2856
2903
  }
2857
- function _i(e, t) {
2904
+ function bi(e, t) {
2858
2905
  let n = /* @__PURE__ */ new Map();
2859
- e && Qr(n, e.props, t);
2906
+ e && ti(n, e.props, t);
2860
2907
  let r = /* @__PURE__ */ new Set(), i = Array.from(n.entries()).sort(([e], [t]) => e.localeCompare(t)).map(([e, n]) => {
2861
- let i = [...Lr, ...n.columns], a = n.rows.sort((e, t) => e.elementID - t.elementID).map((e) => [
2908
+ let i = [...Br, ...n.columns], a = n.rows.sort((e, t) => e.elementID - t.elementID).map((e) => [
2862
2909
  String(e.elementID),
2863
2910
  e.ifcguid || t,
2864
2911
  ...n.columns.map((n) => e.values[n] ?? t)
2865
2912
  ]);
2866
2913
  return {
2867
- name: ii(e, r),
2914
+ name: si(e, r),
2868
2915
  rows: [i, ...a]
2869
2916
  };
2870
2917
  });
2871
2918
  return i.length || i.push({
2872
- name: ii(Ir, r),
2873
- rows: [Lr]
2919
+ name: si(zr, r),
2920
+ rows: [Br]
2874
2921
  }), i;
2875
2922
  }
2876
- function vi(e, t = {}) {
2877
- let n = _i(e, t.emptyValue ?? "-"), r = n.map((e) => e.name), i = [
2923
+ function xi(e, t = {}) {
2924
+ let n = bi(e, t.emptyValue ?? "-"), r = n.map((e) => e.name), i = [
2878
2925
  {
2879
2926
  path: "[Content_Types].xml",
2880
- data: K.encode(ci(r))
2927
+ data: Lr.encode(di(r))
2881
2928
  },
2882
2929
  {
2883
2930
  path: "_rels/.rels",
2884
- data: K.encode(si())
2931
+ data: Lr.encode(ui())
2885
2932
  },
2886
2933
  {
2887
2934
  path: "xl/workbook.xml",
2888
- data: K.encode(ai(r))
2935
+ data: Lr.encode(ci(r))
2889
2936
  },
2890
2937
  {
2891
2938
  path: "xl/_rels/workbook.xml.rels",
2892
- data: K.encode(oi(r))
2939
+ data: Lr.encode(li(r))
2893
2940
  },
2894
2941
  ...n.map((e, t) => ({
2895
2942
  path: `xl/worksheets/sheet${t + 1}.xml`,
2896
- data: K.encode(ni(e.rows))
2943
+ data: Lr.encode(ai(e.rows))
2897
2944
  }))
2898
2945
  ];
2899
- return new Blob([gi(i)], { type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" });
2946
+ return new Blob([yi(i)], { type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" });
2900
2947
  }
2901
- function yi(e) {
2948
+ function Si(e) {
2902
2949
  return e.split(/[?#]/)[0].split(/[\\/]/).pop()?.replace(/\.min\.bmt$/i, "").replace(/\.[^.]+$/i, "").trim() || "model";
2903
2950
  }
2904
- function bi(e, t) {
2905
- let n = t.fileName?.trim() || `${yi(t.modelName ?? e?.name ?? "model")}_properties`;
2951
+ function Ci(e, t) {
2952
+ let n = t.fileName?.trim() || `${Si(t.modelName ?? e?.name ?? "model")}_properties`;
2906
2953
  return n.toLowerCase().endsWith(".xlsx") ? n : `${n}.xlsx`;
2907
2954
  }
2908
- function xi(e, t = {}) {
2955
+ function wi(e, t = {}) {
2909
2956
  return {
2910
- blob: vi(e, t),
2911
- name: bi(e, t)
2957
+ blob: xi(e, t),
2958
+ name: Ci(e, t)
2912
2959
  };
2913
2960
  }
2914
2961
  //#endregion
2915
2962
  //#region src/viewer/api/ViewerPropertiesApi.ts
2916
- function Si(e) {
2963
+ function q(e) {
2917
2964
  return !!e && typeof e == "object" && !Array.isArray(e);
2918
2965
  }
2919
- function Ci(e) {
2920
- return Si(e);
2966
+ function Ti(e, t) {
2967
+ return Object.prototype.hasOwnProperty.call(e, t);
2921
2968
  }
2922
- function wi(e) {
2923
- return Array.isArray(e) ? e.filter(Ci) : Si(e) ? Object.values(e).filter(Ci) : [];
2969
+ function Ei(e) {
2970
+ return q(e);
2924
2971
  }
2925
- function Ti(e) {
2972
+ function Di(e) {
2973
+ return Array.isArray(e) ? e.filter(Ei) : q(e) ? Object.values(e).filter(Ei) : [];
2974
+ }
2975
+ function Oi(e) {
2926
2976
  if (typeof e == "number" && Number.isFinite(e)) return e;
2927
2977
  if (typeof e == "string") {
2928
2978
  let t = Number(e);
@@ -2930,10 +2980,10 @@ function Ti(e) {
2930
2980
  }
2931
2981
  return null;
2932
2982
  }
2933
- function Ei(e) {
2934
- return Ti(e.id ?? e.expressID ?? e.expressId ?? e.elementID ?? e.elementId);
2983
+ function ki(e) {
2984
+ return Oi(e.id ?? e.expressID ?? e.expressId ?? e.elementID ?? e.elementId);
2935
2985
  }
2936
- function Di(e) {
2986
+ function Ai(e) {
2937
2987
  let t = [
2938
2988
  e.children,
2939
2989
  e.items,
@@ -2941,40 +2991,40 @@ function Di(e) {
2941
2991
  e.childs
2942
2992
  ];
2943
2993
  for (let e of t) {
2944
- let t = wi(e);
2994
+ let t = Di(e);
2945
2995
  if (t.length) return t;
2946
2996
  }
2947
2997
  return [];
2948
2998
  }
2949
- function Oi(e) {
2950
- let t = Si(e.props) ? e.props : {}, n = e.type ?? e.Type ?? t.type ?? t.Type;
2999
+ function ji(e) {
3000
+ let t = q(e.props) ? e.props : {}, n = e.type ?? e.Type ?? t.type ?? t.Type;
2951
3001
  return typeof n == "string" ? n : "";
2952
3002
  }
2953
- function ki(e) {
3003
+ function Mi(e) {
2954
3004
  return e.replace(/[^a-z0-9]/gi, "").toUpperCase();
2955
3005
  }
2956
- function Ai(e) {
2957
- return ki(Oi(e)) === "IFCBUILDINGSTOREY";
3006
+ function Ni(e) {
3007
+ return Mi(ji(e)) === "IFCBUILDINGSTOREY";
2958
3008
  }
2959
- var ji = new Set([
3009
+ var Pi = new Set([
2960
3010
  "children",
2961
3011
  "childs",
2962
3012
  "elements",
2963
3013
  "items"
2964
3014
  ]);
2965
- function Mi(e) {
3015
+ function Fi(e) {
2966
3016
  let t = {};
2967
3017
  return Object.entries(e).forEach(([e, n]) => {
2968
- ji.has(e) || (t[e] = n);
3018
+ Pi.has(e) || (t[e] = n);
2969
3019
  }), t;
2970
3020
  }
2971
- function Ni(e, t) {
3021
+ function Ii(e, t) {
2972
3022
  return Array.isArray(t) ? {
2973
- children: wi(t),
3023
+ children: Di(t),
2974
3024
  name: `Model ${e}`,
2975
3025
  type: "Model"
2976
- } : Si(t) ? Ei(t) !== null || typeof t.name == "string" || typeof t.Name == "string" || typeof t.type == "string" || typeof t.Type == "string" || Array.isArray(t.children) ? t : {
2977
- children: wi(t),
3026
+ } : q(t) ? ki(t) !== null || typeof t.name == "string" || typeof t.Name == "string" || typeof t.type == "string" || typeof t.Type == "string" || Array.isArray(t.children) ? t : {
3027
+ children: Di(t),
2978
3028
  name: `Model ${e}`,
2979
3029
  type: "Model"
2980
3030
  } : {
@@ -2983,37 +3033,106 @@ function Ni(e, t) {
2983
3033
  type: "Model"
2984
3034
  };
2985
3035
  }
2986
- function Pi(e) {
3036
+ function Li(e) {
2987
3037
  let t = [];
2988
- return Di(e).forEach((e) => {
2989
- let n = Ei(e);
2990
- n !== null && t.push(n), t.push(...Pi(e));
3038
+ return Ai(e).forEach((e) => {
3039
+ let n = ki(e);
3040
+ n !== null && t.push(n), t.push(...Li(e));
2991
3041
  }), t;
2992
3042
  }
2993
- function Fi(e, t, n, r) {
2994
- let i = Ei(t), a = i === null ? void 0 : n[e]?.[i], o = {
2995
- ...Mi(t),
3043
+ function Ri(e, t, n, r) {
3044
+ let i = ki(t), a = i === null ? void 0 : n[e]?.[i], o = {
3045
+ ...Fi(t),
2996
3046
  ...a ?? {},
2997
3047
  modelID: e
2998
3048
  };
2999
- return r && (o.elements = Pi(t)), o;
3049
+ return r && (o.elements = Li(t)), o;
3000
3050
  }
3001
- function Ii(e, t, n, r, i) {
3002
- Ai(t) && n.push(Fi(e, t, r, i)), Di(t).forEach((t) => Ii(e, t, n, r, i));
3051
+ function zi(e, t, n, r, i) {
3052
+ Ni(t) && n.push(Ri(e, t, r, i)), Ai(t).forEach((t) => zi(e, t, n, r, i));
3003
3053
  }
3004
- function Li(e, t, n = !1) {
3054
+ function Bi(e, t, n = !1) {
3005
3055
  let r = {};
3006
3056
  return Object.entries(e).forEach(([e, i]) => {
3007
3057
  let a = Number(e), o = [];
3008
- Ii(a, Ni(a, i), o, t, n), r[a] = o;
3058
+ zi(a, Ii(a, i), o, t, n), r[a] = o;
3009
3059
  }), r;
3010
3060
  }
3011
- function Ri(e, t, n, r = !1) {
3061
+ function Vi(e, t, n, r = !1) {
3012
3062
  let i = [], a = e[n];
3013
3063
  if (!a) throw Error(`Model with modelID ${n} not found`);
3014
- return Ii(Number(n), Ni(Number(n), a), i, t, r), i;
3064
+ return zi(Number(n), Ii(Number(n), a), i, t, r), i;
3015
3065
  }
3016
- function zi(e, t, n, r) {
3066
+ function Hi(e, t, n) {
3067
+ return e[t]?.[n];
3068
+ }
3069
+ function Ui(e) {
3070
+ return typeof e == "string" ? e : q(e) && typeof e.value == "string" ? e.value : "";
3071
+ }
3072
+ function Wi(e, t) {
3073
+ return Ui(e.Name) || Ui(e.name) || Ui(e.DisplayName) || Ui(e.displayName) || `Property ${t + 1}`;
3074
+ }
3075
+ function Gi(e) {
3076
+ for (let t of [
3077
+ "NominalValue",
3078
+ "nominalValue",
3079
+ "Value",
3080
+ "value",
3081
+ "LengthValue",
3082
+ "AreaValue",
3083
+ "VolumeValue",
3084
+ "CountValue",
3085
+ "WeightValue",
3086
+ "TimeValue",
3087
+ "IntegerValue",
3088
+ "RealValue",
3089
+ "BooleanValue"
3090
+ ]) if (e[t] !== void 0) return e[t];
3091
+ return Object.fromEntries(Object.entries(e).filter(([e]) => ![
3092
+ "Name",
3093
+ "name",
3094
+ "Description",
3095
+ "description"
3096
+ ].includes(e)));
3097
+ }
3098
+ function Ki(e) {
3099
+ return Ui(e.name) || Ui(e.Name);
3100
+ }
3101
+ function qi(e, t) {
3102
+ return Ti(e, t) ? e[t] : void 0;
3103
+ }
3104
+ function Ji(e, t) {
3105
+ let n = e.props;
3106
+ if (q(n)) {
3107
+ let e = qi(n, t);
3108
+ if (e !== void 0) return e;
3109
+ }
3110
+ if (Array.isArray(n)) for (let e = 0; e < n.length; e += 1) {
3111
+ let r = n[e];
3112
+ if (!q(r)) continue;
3113
+ let i = r;
3114
+ if (Wi(i, e) === t) return Gi(i);
3115
+ }
3116
+ return qi(e, t);
3117
+ }
3118
+ function Yi(e, t, n) {
3119
+ if (!e) return;
3120
+ if (n !== void 0) {
3121
+ let r = e.sets?.find((e) => Ki(e) === n);
3122
+ return r ? Ji(r, t) : void 0;
3123
+ }
3124
+ if (q(e.props)) {
3125
+ let n = qi(e.props, t);
3126
+ if (n !== void 0) return n;
3127
+ }
3128
+ let r = qi(e, t);
3129
+ if (r !== void 0) return r;
3130
+ for (let n of e.sets ?? []) {
3131
+ let e = Ji(n, t);
3132
+ if (e !== void 0) return e;
3133
+ }
3134
+ }
3135
+ function Xi(e, t, n, r) {
3017
3136
  let i = t[e];
3018
3137
  return i ? {
3019
3138
  data: {},
@@ -3022,41 +3141,44 @@ function zi(e, t, n, r) {
3022
3141
  structure: n[e] ?? {}
3023
3142
  } : null;
3024
3143
  }
3025
- function Bi(e) {
3144
+ function Zi(e) {
3026
3145
  return {
3027
3146
  exportAllExcel: (t) => {
3028
3147
  let n = e.getState();
3029
3148
  return Object.keys(n.modelProps).flatMap((e) => {
3030
- let r = zi(Number(e), n.modelProps, n.modelStructure, n.modelNames);
3031
- return r ? [xi(r, t)] : [];
3149
+ let r = Xi(Number(e), n.modelProps, n.modelStructure, n.modelNames);
3150
+ return r ? [wi(r, t)] : [];
3032
3151
  });
3033
3152
  },
3034
3153
  exportExcel: (t, n) => {
3035
- let r = e.getState(), i = zi(t, r.modelProps, r.modelStructure, r.modelNames);
3036
- return i ? xi(i, n) : null;
3154
+ let r = e.getState(), i = Xi(t, r.modelProps, r.modelStructure, r.modelNames);
3155
+ return i ? wi(i, n) : null;
3037
3156
  },
3038
3157
  getAllLevels: (t = !1) => {
3039
3158
  let n = e.getState();
3040
- return Li(n.modelStructure, n.modelProps, t);
3159
+ return Bi(n.modelStructure, n.modelProps, t);
3041
3160
  },
3042
3161
  getAllModelLevels: (t, n = !1) => {
3043
3162
  let r = e.getState();
3044
- return Ri(r.modelStructure, r.modelProps, t, n);
3163
+ return Vi(r.modelStructure, r.modelProps, t, n);
3045
3164
  },
3046
3165
  getModelProps: () => e.getState().modelProps,
3047
- getModelStructure: () => e.getState().modelStructure
3166
+ getModelStructure: () => e.getState().modelStructure,
3167
+ getParamsByElement: (t, n) => Hi(e.getState().modelProps, t, n),
3168
+ getParamValueByName: Yi,
3169
+ getParamValueByElement: (t, n, r, i) => Yi(Hi(e.getState().modelProps, t, n), r, i)
3048
3170
  };
3049
3171
  }
3050
3172
  //#endregion
3051
3173
  //#region src/viewer/Loaders/BmtConverter.ts
3052
- var Vi = "BMT", Hi = 1, J = {
3174
+ var Qi = "BMT", $i = 1, J = {
3053
3175
  PROP: 1,
3054
3176
  MESH: 2,
3055
3177
  STRUCTURE: 3,
3056
3178
  GRIDS: 4,
3057
3179
  MATRIX: 5,
3058
3180
  MESHSPACE: 6
3059
- }, Ui = "application/json", Wi = "application/octet-stream", Gi = class {
3181
+ }, ea = "application/json", ta = "application/octet-stream", na = class {
3060
3182
  chunks = [];
3061
3183
  length = 0;
3062
3184
  writeUint8(e) {
@@ -3076,7 +3198,7 @@ var Vi = "BMT", Hi = 1, J = {
3076
3198
  e.set(n, t), t += n.byteLength;
3077
3199
  }), e;
3078
3200
  }
3079
- }, Ki = class {
3201
+ }, ra = class {
3080
3202
  textEncoder = new TextEncoder();
3081
3203
  ifcLoader = null;
3082
3204
  async ConvertIfcFileToBmt(e, t = {}) {
@@ -3143,7 +3265,7 @@ var Vi = "BMT", Hi = 1, J = {
3143
3265
  }
3144
3266
  createModelFiles(e, t, n) {
3145
3267
  let r = n ? `${t}.min.bmt` : `${t}.bmt`, i = this.createBmtBytes(e, !n), a = [{
3146
- blob: new Blob([i], { type: Wi }),
3268
+ blob: new Blob([i], { type: ta }),
3147
3269
  bytes: i,
3148
3270
  name: r,
3149
3271
  type: "bmt"
@@ -3154,7 +3276,7 @@ var Vi = "BMT", Hi = 1, J = {
3154
3276
  structure: e.structure
3155
3277
  });
3156
3278
  a.push({
3157
- blob: new Blob([n], { type: Ui }),
3279
+ blob: new Blob([n], { type: ea }),
3158
3280
  bytes: n,
3159
3281
  name: `${t}_props.json`,
3160
3282
  type: "json"
@@ -3163,8 +3285,8 @@ var Vi = "BMT", Hi = 1, J = {
3163
3285
  return a;
3164
3286
  }
3165
3287
  createBmtBytes(e, t) {
3166
- let n = new Gi();
3167
- return n.writeBytes(this.textEncoder.encode(Vi)), n.writeUint8(Hi), t && this.writeProps(n, e.props), e.grids !== void 0 && this.writeJsonChunk(n, J.GRIDS, e.grids), this.writeMeshes(n, e), t && this.writeJsonChunk(n, J.STRUCTURE, e.structure), e.coordinationMatrix && !this.hasMeshMatrices(e) && this.writeTextChunk(n, J.MATRIX, e.coordinationMatrix), n.toUint8Array();
3288
+ let n = new na();
3289
+ return n.writeBytes(this.textEncoder.encode(Qi)), n.writeUint8($i), t && this.writeProps(n, e.props), e.grids !== void 0 && this.writeJsonChunk(n, J.GRIDS, e.grids), this.writeMeshes(n, e), t && this.writeJsonChunk(n, J.STRUCTURE, e.structure), e.coordinationMatrix && !this.hasMeshMatrices(e) && this.writeTextChunk(n, J.MATRIX, e.coordinationMatrix), n.toUint8Array();
3168
3290
  }
3169
3291
  writeProps(e, t) {
3170
3292
  Object.entries(t).forEach(([t, n]) => {
@@ -3182,7 +3304,7 @@ var Vi = "BMT", Hi = 1, J = {
3182
3304
  });
3183
3305
  }
3184
3306
  createMeshPayload(e) {
3185
- let t = new Gi(), n = this.deflateTypedArray(e.pos), r = this.deflateTypedArray(e.ids), i = this.deflateTypedArray(e.ind);
3307
+ let t = new na(), n = this.deflateTypedArray(e.pos), r = this.deflateTypedArray(e.ids), i = this.deflateTypedArray(e.ind);
3186
3308
  return t.writeUint32(n.byteLength), t.writeBytes(n), t.writeUint32(r.byteLength), t.writeBytes(r), t.writeUint32(i.byteLength), t.writeUint32(this.getIndexType(e.ind)), t.writeBytes(i), t.writeUint8(this.colorToByte(e.mat.r)), t.writeUint8(this.colorToByte(e.mat.g)), t.writeUint8(this.colorToByte(e.mat.b)), t.writeUint8(this.colorToByte(e.mat.opacity ?? 1)), t.writeUint32(e.mat.name), t.toUint8Array();
3187
3309
  }
3188
3310
  writeJsonChunk(e, t, n) {
@@ -3335,7 +3457,7 @@ var Vi = "BMT", Hi = 1, J = {
3335
3457
  let t = /* @__PURE__ */ new Map();
3336
3458
  return (Array.isArray(e) ? e : [e]).forEach((e) => {
3337
3459
  e.traverse((e) => {
3338
- if (!(e instanceof M) || !this.isIfcSpaceObject(e)) return;
3460
+ if (!(e instanceof P) || !this.isIfcSpaceObject(e)) return;
3339
3461
  let n = this.getObjectModelID(e);
3340
3462
  if (n === null) return;
3341
3463
  let r = e.geometry.getAttribute("ids");
@@ -3349,7 +3471,7 @@ var Vi = "BMT", Hi = 1, J = {
3349
3471
  addVisibleIdsFromObject3D(e, t) {
3350
3472
  (Array.isArray(e) ? e : [e]).forEach((e) => {
3351
3473
  e.traverse((e) => {
3352
- if (!(e instanceof M) || !this.isObjectVisible(e)) return;
3474
+ if (!(e instanceof P) || !this.isObjectVisible(e)) return;
3353
3475
  let n = this.getObjectModelID(e);
3354
3476
  if (n === null) return;
3355
3477
  let r = e.geometry.getAttribute("ids");
@@ -3401,7 +3523,7 @@ var Vi = "BMT", Hi = 1, J = {
3401
3523
  return this.deflateBytes(new Uint8Array(e.buffer, e.byteOffset, e.byteLength));
3402
3524
  }
3403
3525
  deflateBytes(e) {
3404
- return Ee.deflate(e);
3526
+ return we.deflate(e);
3405
3527
  }
3406
3528
  encodeText(e) {
3407
3529
  return this.textEncoder.encode(e);
@@ -3412,43 +3534,43 @@ var Vi = "BMT", Hi = 1, J = {
3412
3534
  isRecord(e) {
3413
3535
  return typeof e == "object" && !!e;
3414
3536
  }
3415
- }, qi = new Ki();
3416
- async function Ji(e, t) {
3417
- return qi.ConvertIfcFileToBmt(e, t);
3537
+ }, ia = new ra();
3538
+ async function aa(e, t) {
3539
+ return ia.ConvertIfcFileToBmt(e, t);
3418
3540
  }
3419
- function Yi(e, t) {
3420
- return qi.ConvertToBmt(e, t);
3541
+ function oa(e, t) {
3542
+ return ia.ConvertToBmt(e, t);
3421
3543
  }
3422
3544
  //#endregion
3423
3545
  //#region src/viewer/Selector/FilteredElementsCollector.ts
3424
3546
  function Y(e) {
3425
3547
  return !!e && typeof e == "object" && !Array.isArray(e);
3426
3548
  }
3427
- function Xi(e) {
3549
+ function sa(e) {
3428
3550
  let t = Number(e);
3429
3551
  return Number.isFinite(t) ? t : null;
3430
3552
  }
3431
- function Zi(e) {
3553
+ function ca(e) {
3432
3554
  return Y(e) && Y(e.data) && Y(e.props) && "structure" in e;
3433
3555
  }
3434
- function Qi(e) {
3556
+ function la(e) {
3435
3557
  return Y(e) && ("guid" in e || "id" in e || "props" in e || "sets" in e);
3436
3558
  }
3437
- function $i(e) {
3559
+ function ua(e) {
3438
3560
  if (!Y(e)) return !1;
3439
3561
  let t = Object.entries(e);
3440
- return t.length ? t.every(([e, t]) => Xi(e) !== null && Qi(t)) : !0;
3562
+ return t.length ? t.every(([e, t]) => sa(e) !== null && la(t)) : !0;
3441
3563
  }
3442
- function ea(e) {
3564
+ function da(e) {
3443
3565
  return typeof e == "string" ? e : null;
3444
3566
  }
3445
- function ta(e) {
3567
+ function fa(e) {
3446
3568
  let t = Y(e.props.props) ? e.props.props : {};
3447
- return ea(e.props.type ?? e.props.Type ?? t.type ?? t.Type);
3569
+ return da(e.props.type ?? e.props.Type ?? t.type ?? t.Type);
3448
3570
  }
3449
- function na(e, t, n) {
3571
+ function pa(e, t, n) {
3450
3572
  Object.entries(n).forEach(([n, r]) => {
3451
- let i = Xi(n);
3573
+ let i = sa(n);
3452
3574
  i !== null && e.push({
3453
3575
  elementID: i,
3454
3576
  modelID: t,
@@ -3456,29 +3578,29 @@ function na(e, t, n) {
3456
3578
  });
3457
3579
  });
3458
3580
  }
3459
- function ra(e) {
3581
+ function ma(e) {
3460
3582
  if (!e || !Y(e)) return [];
3461
- if (Zi(e)) {
3583
+ if (ca(e)) {
3462
3584
  let t = [];
3463
- return na(t, 0, e.props), t;
3585
+ return pa(t, 0, e.props), t;
3464
3586
  }
3465
- if ($i(e)) {
3587
+ if (ua(e)) {
3466
3588
  let t = [];
3467
- return na(t, 0, e), t;
3589
+ return pa(t, 0, e), t;
3468
3590
  }
3469
3591
  let t = [];
3470
3592
  return Object.entries(e).forEach(([e, n]) => {
3471
- let r = Xi(e);
3593
+ let r = sa(e);
3472
3594
  if (r !== null) {
3473
- if (Zi(n)) {
3474
- na(t, r, n.props);
3595
+ if (ca(n)) {
3596
+ pa(t, r, n.props);
3475
3597
  return;
3476
3598
  }
3477
- $i(n) && na(t, r, n);
3599
+ ua(n) && pa(t, r, n);
3478
3600
  }
3479
3601
  }), t;
3480
3602
  }
3481
- function ia(e) {
3603
+ function ha(e) {
3482
3604
  let t = {};
3483
3605
  return e.forEach(({ elementID: e, modelID: n, props: r }) => {
3484
3606
  t[n] ??= [], t[n].push({
@@ -3487,26 +3609,26 @@ function ia(e) {
3487
3609
  });
3488
3610
  }), t;
3489
3611
  }
3490
- function aa(e) {
3612
+ function ga(e) {
3491
3613
  let t = {};
3492
3614
  return e.forEach(({ elementID: e, modelID: n }) => {
3493
3615
  t[n] ??= [], t[n].push(e);
3494
3616
  }), t;
3495
3617
  }
3496
- var oa = class {
3618
+ var _a = class {
3497
3619
  elements;
3498
3620
  filters = [];
3499
3621
  selectedModelIDs = null;
3500
3622
  constructor(e) {
3501
- this.elements = ra(e);
3623
+ this.elements = ma(e);
3502
3624
  }
3503
3625
  from(e) {
3504
- return this.elements = ra(e), this.filters = [], this.selectedModelIDs = null, this;
3626
+ return this.elements = ma(e), this.filters = [], this.selectedModelIDs = null, this;
3505
3627
  }
3506
3628
  ofType(e) {
3507
3629
  let t = new Set((Array.isArray(e) ? e : [e]).map((e) => e.toLowerCase()));
3508
3630
  return this.filters.push((e) => {
3509
- let n = ta(e);
3631
+ let n = fa(e);
3510
3632
  return !!(n && t.has(n.toLowerCase()));
3511
3633
  }), this;
3512
3634
  }
@@ -3535,11 +3657,11 @@ var oa = class {
3535
3657
  return this.hasSingleSelectedModel() ? e.map(({ elementID: e, props: t }) => ({
3536
3658
  elementID: e,
3537
3659
  props: t
3538
- })) : ia(e);
3660
+ })) : ha(e);
3539
3661
  }
3540
3662
  toElementsIds() {
3541
3663
  let e = this.getFilteredElements();
3542
- return this.hasSingleSelectedModel() ? e.map(({ elementID: e }) => e) : aa(e);
3664
+ return this.hasSingleSelectedModel() ? e.map(({ elementID: e }) => e) : ga(e);
3543
3665
  }
3544
3666
  toElementIds() {
3545
3667
  return this.toElementsIds();
@@ -3547,20 +3669,20 @@ var oa = class {
3547
3669
  };
3548
3670
  //#endregion
3549
3671
  //#region src/viewer/api/ViewerApi.ts
3550
- function sa(e) {
3672
+ function va(e) {
3551
3673
  let t = {};
3552
3674
  return Object.entries(e).forEach(([e, n]) => {
3553
3675
  t[Number(e)] = Array.from(n);
3554
3676
  }), t;
3555
3677
  }
3556
- function ca(e) {
3678
+ function ya(e) {
3557
3679
  let t = {};
3558
3680
  return Object.entries(e).forEach(([e, n]) => {
3559
3681
  t[Number(e)] = new Set(n);
3560
3682
  }), t;
3561
3683
  }
3562
- function la(e, t) {
3563
- let n = new Ki();
3684
+ function ba(e, t) {
3685
+ let n = new ra();
3564
3686
  return {
3565
3687
  camera: {
3566
3688
  fitCamera: () => {
@@ -3572,7 +3694,7 @@ function la(e, t) {
3572
3694
  })
3573
3695
  },
3574
3696
  clipping: {
3575
- createClippingRectangle: () => t()?.clipping.createClippingRectangle() ?? [],
3697
+ createClippingRectangle: (e = !1) => t()?.clipping.createClippingRectangle(e) ?? [],
3576
3698
  createPlane: (e) => t()?.clipping.createPlane(e) ?? null,
3577
3699
  deleteAllPlanes: () => {
3578
3700
  t()?.clipping.deleteAllPlanes();
@@ -3610,6 +3732,12 @@ function la(e, t) {
3610
3732
  clearModelColors: (e) => {
3611
3733
  t()?.colors.clearModelColors(e);
3612
3734
  },
3735
+ rebuildByColors: (e, n) => {
3736
+ t()?.colors.rebuildByColors(e, n);
3737
+ },
3738
+ rebuildModelByColors: (e, n, r) => {
3739
+ t()?.colors.rebuildModelByColors(e, n, r);
3740
+ },
3613
3741
  setColor: (e, n, r) => {
3614
3742
  t()?.colors.setColor(e, n, r);
3615
3743
  }
@@ -3694,15 +3822,16 @@ function la(e, t) {
3694
3822
  t()?.geometryUtils.toggleIIfcSpacesVisibility();
3695
3823
  }
3696
3824
  },
3697
- properties: Bi(e),
3825
+ properties: Zi(e),
3698
3826
  selector: {
3699
- addSelected: (t, n) => {
3700
- e.getState().addSelected(t, n);
3827
+ addSelected: (n, r, i = !0, a = !1) => {
3828
+ let o = i || a;
3829
+ e.getState().addSelected(n, r), o && t()?.selector.setTargetToSelection(va(e.getState().selected), a);
3701
3830
  },
3702
- collector: () => new oa(e.getState().modelProps),
3831
+ collector: () => new _a(e.getState().modelProps),
3703
3832
  getPreselectionColor: () => e.getState().preselectionColor,
3704
3833
  getSelectionColor: () => e.getState().selectionColor,
3705
- getSelected: () => sa(e.getState().selected),
3834
+ getSelected: () => va(e.getState().selected),
3706
3835
  removeSelected: (t, n) => {
3707
3836
  e.getState().removeSelected(t, n);
3708
3837
  },
@@ -3715,8 +3844,9 @@ function la(e, t) {
3715
3844
  setSelectionColor: (t) => {
3716
3845
  e.getState().setSelectionColor(t);
3717
3846
  },
3718
- setSelected: (t, n, r = !1) => {
3719
- e.getState().setSelected(t, n, r);
3847
+ setSelected: (n, r, i = !1, a = !0, o = !1) => {
3848
+ let s = a || o;
3849
+ e.getState().setSelected(n, r, i), s && t()?.selector.setTargetToSelection(va(e.getState().selected), o);
3720
3850
  }
3721
3851
  },
3722
3852
  utils: {
@@ -3761,7 +3891,7 @@ function la(e, t) {
3761
3891
  }
3762
3892
  //#endregion
3763
3893
  //#region src/viewer/Loaders/BmtLoader.ts
3764
- var ua = class {
3894
+ var xa = class {
3765
3895
  view;
3766
3896
  offset = 0;
3767
3897
  constructor(e) {
@@ -3781,11 +3911,11 @@ var ua = class {
3781
3911
  eof() {
3782
3912
  return this.offset >= this.view.byteLength;
3783
3913
  }
3784
- }, da = class {
3914
+ }, Sa = class {
3785
3915
  decodeBuffer(e) {
3786
- return this.textDecoder.decode(Ee.inflate(e));
3916
+ return this.textDecoder.decode(we.inflate(e));
3787
3917
  }
3788
- decoder = Ee;
3918
+ decoder = we;
3789
3919
  textDecoder = new TextDecoder("utf-8");
3790
3920
  ChunkType = {
3791
3921
  PROP: 1,
@@ -3854,7 +3984,7 @@ var ua = class {
3854
3984
  return a?.props && (i.props = a.props), a?.grids && (i.grids = a.grids), a?.coordinationMatrix && (i.coordinationMatrix = a.coordinationMatrix), a?.structure !== void 0 && (i.structure = a.structure), i;
3855
3985
  }
3856
3986
  parseBinaryFile(e, t = {}) {
3857
- let n = new ua(e);
3987
+ let n = new xa(e);
3858
3988
  if (new TextDecoder().decode(n.readBytes(3)) !== "BMT") throw Error("Invalid file");
3859
3989
  let r = n.readUint8();
3860
3990
  console.log(`model version: ${r}`);
@@ -3922,24 +4052,24 @@ var ua = class {
3922
4052
  };
3923
4053
  //#endregion
3924
4054
  //#region src/viewer/workers/BMTWorker.ts?worker
3925
- function fa(e) {
4055
+ function Ca(e) {
3926
4056
  return new Worker("" + new URL("assets/BMTWorker-yhSXOg2i.js", import.meta.url).href, { name: e?.name });
3927
4057
  }
3928
4058
  //#endregion
3929
4059
  //#region src/viewer/workers/BMTWorkerClient.ts
3930
- function pa() {
4060
+ function wa() {
3931
4061
  return globalThis.crypto?.randomUUID?.() ?? `${Date.now()}-${Math.random()}`;
3932
4062
  }
3933
- function ma(e) {
4063
+ function Ta(e) {
3934
4064
  return Array.isArray(e) ? e : [e];
3935
4065
  }
3936
- function ha(e) {
4066
+ function Ea(e) {
3937
4067
  return e.split(/[?#]/)[0].split(/[\\/]/).pop() || "model.bmt";
3938
4068
  }
3939
- function ga(e) {
4069
+ function Da(e) {
3940
4070
  return typeof e == "string" ? {
3941
4071
  kind: "url",
3942
- name: ha(e),
4072
+ name: Ea(e),
3943
4073
  url: new URL(e, globalThis.location.href).href
3944
4074
  } : e instanceof File ? {
3945
4075
  file: e,
@@ -3950,18 +4080,18 @@ function ga(e) {
3950
4080
  kind: "buffer"
3951
4081
  };
3952
4082
  }
3953
- function _a(e) {
4083
+ function Oa(e) {
3954
4084
  return e.map((e) => e.kind === "buffer" ? e.buffer : null).filter((e) => e instanceof ArrayBuffer);
3955
4085
  }
3956
- function va() {
3957
- return new fa();
4086
+ function ka() {
4087
+ return new Ca();
3958
4088
  }
3959
- function ya(e) {
4089
+ function Aa(e) {
3960
4090
  return { streamGeometryChunks: e.streamGeometryChunks ?? !!e.onChunk };
3961
4091
  }
3962
- function ba(e, t = {}) {
3963
- let n = t.worker ?? va(), r = t.terminateOnComplete ?? !t.worker, i = t.collectChunks ?? !0, a = ma(e).map(ga), o = pa(), s = {}, c = {
3964
- options: ya(t),
4092
+ function ja(e, t = {}) {
4093
+ let n = t.worker ?? ka(), r = t.terminateOnComplete ?? !t.worker, i = t.collectChunks ?? !0, a = Ta(e).map(Da), o = wa(), s = {}, c = {
4094
+ options: Aa(t),
3965
4095
  sources: a,
3966
4096
  taskId: o,
3967
4097
  type: "load-bmt-model"
@@ -3999,29 +4129,147 @@ function ba(e, t = {}) {
3999
4129
  let a = Error(r.error.message);
4000
4130
  r.error.stack && (a.stack = r.error.stack), l(a);
4001
4131
  };
4002
- n.addEventListener("message", f), n.addEventListener("error", d), n.postMessage(c, _a(a));
4132
+ n.addEventListener("message", f), n.addEventListener("error", d), n.postMessage(c, Oa(a));
4003
4133
  });
4004
4134
  }
4005
- function xa() {
4006
- return va();
4135
+ function Ma() {
4136
+ return ka();
4137
+ }
4138
+ //#endregion
4139
+ //#region src/viewer/workers/BmtConverterWorker.ts?worker
4140
+ function Na(e) {
4141
+ return new Worker("" + new URL("assets/BmtConverterWorker-D4BQ-hoH.js", import.meta.url).href, { name: e?.name });
4142
+ }
4143
+ //#endregion
4144
+ //#region src/viewer/workers/BmtConverterWorkerClient.ts
4145
+ function Pa() {
4146
+ return globalThis.crypto?.randomUUID?.() ?? `${Date.now()}-${Math.random()}`;
4147
+ }
4148
+ function Fa(e) {
4149
+ return Array.isArray(e) ? e : [e];
4150
+ }
4151
+ function Ia(e) {
4152
+ return e.split(/[?#]/)[0].split(/[\\/]/).pop() || "model.ifc";
4153
+ }
4154
+ function La() {
4155
+ return globalThis.document?.baseURI ?? globalThis.location.href;
4156
+ }
4157
+ function Ra(e) {
4158
+ let t = e ?? "ifc-parser.wasm";
4159
+ return /^(https?:|blob:|data:)/i.test(t) ? t : new URL(t, La()).href;
4160
+ }
4161
+ function za(e) {
4162
+ return typeof e == "string" ? {
4163
+ kind: "url",
4164
+ name: Ia(e),
4165
+ url: new URL(e, globalThis.location.href).href
4166
+ } : e instanceof File ? {
4167
+ file: e,
4168
+ kind: "file",
4169
+ name: e.name
4170
+ } : {
4171
+ buffer: e,
4172
+ kind: "buffer"
4173
+ };
4174
+ }
4175
+ function Ba(e) {
4176
+ return e.map((e) => e.kind === "buffer" ? e.buffer : null).filter((e) => e instanceof ArrayBuffer);
4177
+ }
4178
+ function Va() {
4179
+ return new Na();
4180
+ }
4181
+ function Ha(e) {
4182
+ return {
4183
+ chunk: e.chunk,
4184
+ coordinationMatrix: e.coordinationMatrix,
4185
+ fileName: e.fileName,
4186
+ fileNames: e.fileNames,
4187
+ maxMeshBytes: e.maxMeshBytes,
4188
+ useIfcColors: e.useIfcColors,
4189
+ useIfcElementAssembly: e.useIfcElementAssembly,
4190
+ useIfcSpace: e.useIfcSpace,
4191
+ useMinVersion: e.useMinVersion,
4192
+ visibleIdsByModel: e.visibleIdsByModel,
4193
+ wasmPath: Ra(e.wasmPath)
4194
+ };
4195
+ }
4196
+ function Ua(e) {
4197
+ let t = new Uint8Array(e.bytes.byteLength);
4198
+ return t.set(e.bytes), {
4199
+ ...e,
4200
+ blob: new Blob([t.buffer], { type: e.mimeType })
4201
+ };
4202
+ }
4203
+ function Wa(e) {
4204
+ return {
4205
+ files: e.result.files.map(Ua),
4206
+ models: e.result.models
4207
+ };
4208
+ }
4209
+ function Ga(e) {
4210
+ if (e.error instanceof Error) return e.error;
4211
+ let t = [
4212
+ e.message || "Unknown worker error",
4213
+ e.filename ? `file: ${e.filename}` : "",
4214
+ e.lineno ? `line: ${e.lineno}` : "",
4215
+ e.colno ? `column: ${e.colno}` : ""
4216
+ ].filter(Boolean);
4217
+ return /* @__PURE__ */ Error(`BMT converter worker failed: ${t.join(", ")}`);
4218
+ }
4219
+ function Ka(e) {
4220
+ return /* @__PURE__ */ Error(`BMT converter worker response could not be cloned: ${String(e.data ?? "unknown message error")}`);
4221
+ }
4222
+ function qa(e, t = {}) {
4223
+ let n = t.worker ?? Va(), r = t.terminateOnComplete ?? !t.worker, i = Fa(e).map(za), a = Pa(), o = {
4224
+ options: Ha(t),
4225
+ sources: i,
4226
+ taskId: a,
4227
+ type: "convert-ifc-to-bmt"
4228
+ };
4229
+ return new Promise((e, s) => {
4230
+ let c = () => {
4231
+ n.removeEventListener("message", d), n.removeEventListener("error", l), n.removeEventListener("messageerror", u), r && n.terminate();
4232
+ }, l = (e) => {
4233
+ c(), s(Ga(e));
4234
+ }, u = (e) => {
4235
+ c(), s(Ka(e));
4236
+ }, d = (n) => {
4237
+ let r = n.data;
4238
+ if (r.taskId !== a) return;
4239
+ if (r.type === "progress") {
4240
+ t.onProgress?.(r.progress);
4241
+ return;
4242
+ }
4243
+ if (c(), r.type === "complete") {
4244
+ e(Wa(r));
4245
+ return;
4246
+ }
4247
+ let i = Error(r.error.message);
4248
+ r.error.stack && (i.stack = r.error.stack), s(i);
4249
+ };
4250
+ n.addEventListener("message", d), n.addEventListener("error", l), n.addEventListener("messageerror", u), n.postMessage(o, Ba(i));
4251
+ });
4252
+ }
4253
+ function Ja() {
4254
+ return Va();
4007
4255
  }
4008
4256
  //#endregion
4009
4257
  //#region src/viewer/workers/IFCWorker.ts?worker
4010
- function Sa(e) {
4258
+ function Ya(e) {
4011
4259
  return new Worker("" + new URL("assets/IFCWorker-Dgk5iwps.js", import.meta.url).href, { name: e?.name });
4012
4260
  }
4013
4261
  //#endregion
4014
4262
  //#region src/viewer/workers/IFCWorkerClient.ts
4015
- function Ca() {
4263
+ function Xa() {
4016
4264
  return globalThis.crypto?.randomUUID?.() ?? `${Date.now()}-${Math.random()}`;
4017
4265
  }
4018
- function wa(e) {
4266
+ function Za(e) {
4019
4267
  return Array.isArray(e) ? e : [e];
4020
4268
  }
4021
- function Ta(e) {
4269
+ function Qa(e) {
4022
4270
  return typeof e == "string" ? {
4023
4271
  kind: "url",
4024
- name: Ea(e),
4272
+ name: $a(e),
4025
4273
  url: new URL(e, globalThis.location.href).href
4026
4274
  } : e instanceof File ? {
4027
4275
  file: e,
@@ -4032,23 +4280,23 @@ function Ta(e) {
4032
4280
  kind: "buffer"
4033
4281
  };
4034
4282
  }
4035
- function Ea(e) {
4283
+ function $a(e) {
4036
4284
  return e.split(/[?#]/)[0].split(/[\\/]/).pop() || "model.ifc";
4037
4285
  }
4038
- function Da() {
4286
+ function eo() {
4039
4287
  return globalThis.document?.baseURI ?? globalThis.location.href;
4040
4288
  }
4041
- function Oa(e) {
4289
+ function to(e) {
4042
4290
  let t = e ?? "ifc-parser.wasm";
4043
- return /^(https?:|blob:|data:)/i.test(t) ? t : new URL(t, Da()).href;
4291
+ return /^(https?:|blob:|data:)/i.test(t) ? t : new URL(t, eo()).href;
4044
4292
  }
4045
- function ka(e) {
4293
+ function no(e) {
4046
4294
  return e.map((e) => e.kind === "buffer" ? e.buffer : null).filter((e) => e instanceof ArrayBuffer);
4047
4295
  }
4048
- function Aa() {
4049
- return new Sa();
4296
+ function ro() {
4297
+ return new Ya();
4050
4298
  }
4051
- function ja(e) {
4299
+ function io(e) {
4052
4300
  return {
4053
4301
  chunk: e.chunk,
4054
4302
  coordinationMatrix: e.coordinationMatrix,
@@ -4057,12 +4305,12 @@ function ja(e) {
4057
4305
  useIfcColors: e.useIfcColors,
4058
4306
  useIfcElementAssembly: e.useIfcElementAssembly,
4059
4307
  useIfcSpace: e.useIfcSpace,
4060
- wasmPath: Oa(e.wasmPath)
4308
+ wasmPath: to(e.wasmPath)
4061
4309
  };
4062
4310
  }
4063
- function Ma(e, t = {}) {
4064
- let n = t.worker ?? Aa(), r = t.terminateOnComplete ?? !t.worker, i = t.collectChunks ?? !0, a = wa(e).map(Ta), o = Ca(), s = {}, c = {
4065
- options: ja(t),
4311
+ function ao(e, t = {}) {
4312
+ let n = t.worker ?? ro(), r = t.terminateOnComplete ?? !t.worker, i = t.collectChunks ?? !0, a = Za(e).map(Qa), o = Xa(), s = {}, c = {
4313
+ options: io(t),
4066
4314
  sources: a,
4067
4315
  taskId: o,
4068
4316
  type: "load-ifc-model"
@@ -4100,34 +4348,34 @@ function Ma(e, t = {}) {
4100
4348
  let a = Error(r.error.message);
4101
4349
  r.error.stack && (a.stack = r.error.stack), l(a);
4102
4350
  };
4103
- n.addEventListener("message", f), n.addEventListener("error", d), n.postMessage(c, ka(a));
4351
+ n.addEventListener("message", f), n.addEventListener("error", d), n.postMessage(c, no(a));
4104
4352
  });
4105
4353
  }
4106
- function Na() {
4107
- return Aa();
4354
+ function oo() {
4355
+ return ro();
4108
4356
  }
4109
4357
  //#endregion
4110
4358
  //#region src/viewer/api/loader.ts
4111
- function Pa(e) {
4359
+ function so(e) {
4112
4360
  return typeof e == "string" ? e : e.name;
4113
4361
  }
4114
- function Fa(e) {
4115
- return (Pa(e).split(/[?#]/)[0].split(/[\\/]/).pop() || "model").replace(/\.min\.bmt$/i, "").replace(/\.[^.]+$/i, "") || "model";
4362
+ function co(e) {
4363
+ return (so(e).split(/[?#]/)[0].split(/[\\/]/).pop() || "model").replace(/\.min\.bmt$/i, "").replace(/\.[^.]+$/i, "") || "model";
4116
4364
  }
4117
- function Ia(e) {
4118
- let t = Pa(e).split(/[?#]/)[0].toLowerCase(), n = t.lastIndexOf(".");
4365
+ function lo(e) {
4366
+ let t = so(e).split(/[?#]/)[0].toLowerCase(), n = t.lastIndexOf(".");
4119
4367
  return n === -1 ? "" : t.slice(n + 1);
4120
4368
  }
4121
- function La(e) {
4369
+ function uo(e) {
4122
4370
  return /\.min\.bmt$/i.test(e.name) ? e.name.replace(/\.min\.bmt$/i, "_props.json") : null;
4123
4371
  }
4124
- function Ra(e) {
4125
- return /_props\.json$/i.test(Pa(e).split(/[?#]/)[0]);
4372
+ function fo(e) {
4373
+ return /_props\.json$/i.test(so(e).split(/[?#]/)[0]);
4126
4374
  }
4127
- function za(e) {
4375
+ function po(e) {
4128
4376
  return e.coordinationMatrix ? e.coordinationMatrix : Object.values(e.data)[0]?.matrix || void 0;
4129
4377
  }
4130
- var Ba = new class {
4378
+ var mo = new class {
4131
4379
  coordinationMatrix;
4132
4380
  useIfcSpace = !1;
4133
4381
  bmtLoader = null;
@@ -4138,7 +4386,7 @@ var Ba = new class {
4138
4386
  this.getBmtLoader();
4139
4387
  }
4140
4388
  getBmtLoader() {
4141
- return this.bmtLoader ||= new da(), this.bmtLoader;
4389
+ return this.bmtLoader ||= new Sa(), this.bmtLoader;
4142
4390
  }
4143
4391
  async getIfcLoader(e = {}) {
4144
4392
  if (!this.ifcLoader) {
@@ -4166,7 +4414,7 @@ var Ba = new class {
4166
4414
  async loadBmtModel(e, t) {
4167
4415
  let n = this.getBmtLoader();
4168
4416
  if (typeof e == "string") return n.loadModel(e);
4169
- let r = n.parseBinaryFile(await e.arrayBuffer()), i = La(e), a = i ? t.get(i) : void 0;
4417
+ let r = n.parseBinaryFile(await e.arrayBuffer()), i = uo(e), a = i ? t.get(i) : void 0;
4170
4418
  return this.applyBmtMetadata(r, a);
4171
4419
  }
4172
4420
  createWorkerProgressHandler(e, t, n, r) {
@@ -4189,7 +4437,7 @@ var Ba = new class {
4189
4437
  };
4190
4438
  }
4191
4439
  async loadIfcModelInWorker(e, t, n, r, i) {
4192
- return (await Ma(e, {
4440
+ return (await ao(e, {
4193
4441
  chunk: t.chunk,
4194
4442
  collectChunks: t.collectWorkerChunks,
4195
4443
  coordinationMatrix: this.coordinationMatrix,
@@ -4202,14 +4450,14 @@ var Ba = new class {
4202
4450
  }))[0];
4203
4451
  }
4204
4452
  async loadBmtModelInWorker(e, t, n, r, i, a) {
4205
- let o = (await ba(e, {
4453
+ let o = (await ja(e, {
4206
4454
  collectChunks: n.collectWorkerChunks,
4207
4455
  onChunk: this.createWorkerChunkHandler(n, r),
4208
4456
  onProgress: this.createWorkerProgressHandler(n, r, i, a),
4209
4457
  streamGeometryChunks: n.streamGeometryChunks ?? !!n.onChunk
4210
4458
  }))[0];
4211
4459
  if (e instanceof File) {
4212
- let n = La(e), r = n ? t.get(n) : void 0;
4460
+ let n = uo(e), r = n ? t.get(n) : void 0;
4213
4461
  return this.applyBmtMetadata(o, r);
4214
4462
  }
4215
4463
  return o;
@@ -4222,21 +4470,21 @@ var Ba = new class {
4222
4470
  }
4223
4471
  async loadModel(e, t = {}) {
4224
4472
  this.initLoaders();
4225
- let n = Array.isArray(e) ? e : [e], r = this.getFileSourceMap(n), i = {}, a = n.filter((e) => !Ra(e)).length, o = 0;
4473
+ let n = Array.isArray(e) ? e : [e], r = this.getFileSourceMap(n), i = {}, a = n.filter((e) => !fo(e)).length, o = 0;
4226
4474
  this.loadedModelCount === 0 && this.resetCoordinationMatrixState();
4227
4475
  for (let e = 0; e < n.length; e++) {
4228
- let s = n[e], c = Ia(s), l;
4229
- if (c === "json" && Ra(s)) continue;
4476
+ let s = n[e], c = lo(s), l;
4477
+ if (c === "json" && fo(s)) continue;
4230
4478
  let u = this.nextModelID, d = o;
4231
4479
  if (o++, c === "ifc") l = t.useWorker ? await this.loadIfcModelInWorker(s, t, u, d, a) : (await (await this.getIfcLoader(t)).loadModel(s, this.coordinationMatrix))[0];
4232
4480
  else if (c === "bmt") l = t.useWorker ? await this.loadBmtModelInWorker(s, r, t, u, d, a) : await this.loadBmtModel(s, r);
4233
- else throw Error(`Unsupported model format: ${Pa(s)}`);
4234
- let f = za(l);
4235
- !this.coordinationMatrix && f && (this.coordinationMatrix = f), !l.coordinationMatrix && this.coordinationMatrix && (l.coordinationMatrix = this.coordinationMatrix), l.name ??= Fa(s), this.nextModelID += 1, this.loadedModelCount += 1, i[u] = l;
4481
+ else throw Error(`Unsupported model format: ${so(s)}`);
4482
+ let f = po(l);
4483
+ !this.coordinationMatrix && f && (this.coordinationMatrix = f), !l.coordinationMatrix && this.coordinationMatrix && (l.coordinationMatrix = this.coordinationMatrix), l.name ??= co(s), this.nextModelID += 1, this.loadedModelCount += 1, i[u] = l;
4236
4484
  }
4237
4485
  return i;
4238
4486
  }
4239
- }(), Va = .5, X = .04, Z = .16, Ha = Z, Q = Va * 2 - Z * 2, Ua = Va - X / 2, Wa = Va - Z / 2, Ga = Va - Ha / 2, Ka = .63, qa = "#dfe6ec", Ja = 260, Ya = 52, Xa = .17, Za = new g(), $ = new pe(), Qa = [
4487
+ }(), ho = .5, X = .04, Z = .16, go = Z, Q = ho * 2 - Z * 2, _o = ho - X / 2, vo = ho - Z / 2, yo = ho - go / 2, bo = .63, xo = "#dfe6ec", So = 260, Co = 52, wo = .17, To = new g(), $ = new de(), Eo = [
4240
4488
  {
4241
4489
  direction: [
4242
4490
  0,
@@ -4247,7 +4495,7 @@ var Ba = new class {
4247
4495
  position: [
4248
4496
  0,
4249
4497
  0,
4250
- Ua
4498
+ _o
4251
4499
  ],
4252
4500
  scale: [
4253
4501
  Q,
@@ -4267,7 +4515,7 @@ var Ba = new class {
4267
4515
  position: [
4268
4516
  0,
4269
4517
  0,
4270
- -Ua
4518
+ -_o
4271
4519
  ],
4272
4520
  rotation: [
4273
4521
  0,
@@ -4290,7 +4538,7 @@ var Ba = new class {
4290
4538
  ],
4291
4539
  label: "right",
4292
4540
  position: [
4293
- Ua,
4541
+ _o,
4294
4542
  0,
4295
4543
  0
4296
4544
  ],
@@ -4315,7 +4563,7 @@ var Ba = new class {
4315
4563
  ],
4316
4564
  label: "left",
4317
4565
  position: [
4318
- -Ua,
4566
+ -_o,
4319
4567
  0,
4320
4568
  0
4321
4569
  ],
@@ -4341,7 +4589,7 @@ var Ba = new class {
4341
4589
  label: "top",
4342
4590
  position: [
4343
4591
  0,
4344
- Ua,
4592
+ _o,
4345
4593
  0
4346
4594
  ],
4347
4595
  rotation: [
@@ -4366,7 +4614,7 @@ var Ba = new class {
4366
4614
  label: "bot",
4367
4615
  position: [
4368
4616
  0,
4369
- -Ua,
4617
+ -_o,
4370
4618
  0
4371
4619
  ],
4372
4620
  rotation: [
@@ -4383,7 +4631,7 @@ var Ba = new class {
4383
4631
  type: "face"
4384
4632
  }
4385
4633
  ];
4386
- function $a() {
4634
+ function Do() {
4387
4635
  let e = [], t = [-1, 1];
4388
4636
  return t.forEach((n) => {
4389
4637
  t.forEach((t) => {
@@ -4395,8 +4643,8 @@ function $a() {
4395
4643
  ],
4396
4644
  position: [
4397
4645
  0,
4398
- n * Wa,
4399
- t * Wa
4646
+ n * vo,
4647
+ t * vo
4400
4648
  ],
4401
4649
  scale: [
4402
4650
  Q,
@@ -4416,9 +4664,9 @@ function $a() {
4416
4664
  t
4417
4665
  ],
4418
4666
  position: [
4419
- n * Wa,
4667
+ n * vo,
4420
4668
  0,
4421
- t * Wa
4669
+ t * vo
4422
4670
  ],
4423
4671
  scale: [
4424
4672
  Z,
@@ -4438,8 +4686,8 @@ function $a() {
4438
4686
  0
4439
4687
  ],
4440
4688
  position: [
4441
- n * Wa,
4442
- t * Wa,
4689
+ n * vo,
4690
+ t * vo,
4443
4691
  0
4444
4692
  ],
4445
4693
  scale: [
@@ -4453,7 +4701,7 @@ function $a() {
4453
4701
  });
4454
4702
  }), e;
4455
4703
  }
4456
- function eo() {
4704
+ function Oo() {
4457
4705
  let e = [], t = [-1, 1];
4458
4706
  return t.forEach((n) => {
4459
4707
  t.forEach((r) => {
@@ -4465,14 +4713,14 @@ function eo() {
4465
4713
  t
4466
4714
  ],
4467
4715
  position: [
4468
- n * Ga,
4469
- r * Ga,
4470
- t * Ga
4716
+ n * yo,
4717
+ r * yo,
4718
+ t * yo
4471
4719
  ],
4472
4720
  scale: [
4473
- Ha,
4474
- Ha,
4475
- Ha
4721
+ go,
4722
+ go,
4723
+ go
4476
4724
  ],
4477
4725
  title: `${r > 0 ? "Top" : "Bottom"} ${n > 0 ? "Right" : "Left"} ${t > 0 ? "Front" : "Back"}`,
4478
4726
  type: "corner"
@@ -4481,34 +4729,34 @@ function eo() {
4481
4729
  });
4482
4730
  }), e;
4483
4731
  }
4484
- function to(e) {
4732
+ function ko(e) {
4485
4733
  e.stopPropagation(), e.nativeEvent.stopPropagation(), e.nativeEvent.stopImmediatePropagation?.();
4486
4734
  }
4487
- function no(e) {
4488
- return e ? "#4f7fa3" : qa;
4735
+ function Ao(e) {
4736
+ return e ? "#4f7fa3" : xo;
4489
4737
  }
4490
- function ro(e) {
4738
+ function jo(e) {
4491
4739
  return e ? 1 : .96;
4492
4740
  }
4493
- function io(e, t) {
4741
+ function Mo(e, t) {
4494
4742
  let n = document.createElement("canvas"), r = n.getContext("2d");
4495
4743
  if (!r) throw Error("Could not create navigation cube label context");
4496
- let i = `600 ${Ya}px system-ui, "Segoe UI", sans-serif`;
4744
+ let i = `600 ${Co}px system-ui, "Segoe UI", sans-serif`;
4497
4745
  r.font = i;
4498
- let a = r.measureText(e), o = a.actualBoundingBoxAscent || Ya * .8, s = a.actualBoundingBoxDescent || Ya * .2, c = Math.ceil(a.width + 36), l = Math.ceil(o + s + 20);
4746
+ let a = r.measureText(e), o = a.actualBoundingBoxAscent || Co * .8, s = a.actualBoundingBoxDescent || Co * .2, c = Math.ceil(a.width + 36), l = Math.ceil(o + s + 20);
4499
4747
  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);
4500
4748
  let u = new b(n);
4501
- return u.colorSpace = fe, u.generateMipmaps = !1, u.magFilter = A, u.minFilter = A, u.needsUpdate = !0, {
4749
+ return u.colorSpace = ue, u.generateMipmaps = !1, u.magFilter = M, u.minFilter = M, u.needsUpdate = !0, {
4502
4750
  aspect: c / l,
4503
4751
  texture: u
4504
4752
  };
4505
4753
  }
4506
- function ao({ color: e, label: t, position: n, rotation: r }) {
4507
- let { aspect: i, texture: a } = c(() => io(t, e), [e, t]);
4508
- return o(() => () => a.dispose(), [a]), /* @__PURE__ */ I("mesh", {
4754
+ function No({ color: e, label: t, position: n, rotation: r }) {
4755
+ let { aspect: i, texture: a } = c(() => Mo(t, e), [e, t]);
4756
+ return o(() => () => a.dispose(), [a]), /* @__PURE__ */ R("mesh", {
4509
4757
  position: n,
4510
4758
  rotation: r,
4511
- children: [/* @__PURE__ */ F("planeGeometry", { args: [Xa * i, Xa] }), /* @__PURE__ */ F("meshBasicMaterial", {
4759
+ children: [/* @__PURE__ */ L("planeGeometry", { args: [wo * i, wo] }), /* @__PURE__ */ L("meshBasicMaterial", {
4512
4760
  alphaTest: .1,
4513
4761
  depthWrite: !1,
4514
4762
  map: a,
@@ -4517,54 +4765,54 @@ function ao({ color: e, label: t, position: n, rotation: r }) {
4517
4765
  })]
4518
4766
  });
4519
4767
  }
4520
- function oo(e) {
4521
- return Math.abs(e.y) > .9 ? new P(0, 0, e.y > 0 ? -1 : 1) : new P(0, 1, 0);
4768
+ function Po(e) {
4769
+ return Math.abs(e.y) > .9 ? new I(0, 0, e.y > 0 ? -1 : 1) : new I(0, 1, 0);
4522
4770
  }
4523
- function so(e, t) {
4771
+ function Fo(e, t) {
4524
4772
  let n = e.current;
4525
- return !n || (n.updateWorldMatrix(!0, !0), Za.setFromObject(n), Za.isEmpty()) ? ($.center.copy(t), $.radius = 10, $) : (Za.getBoundingSphere($), (!Number.isFinite($.radius) || $.radius <= 0) && ($.radius = 10), $);
4773
+ return !n || (n.updateWorldMatrix(!0, !0), To.setFromObject(n), To.isEmpty()) ? ($.center.copy(t), $.radius = 10, $) : (To.getBoundingSphere($), (!Number.isFinite($.radius) || $.radius <= 0) && ($.radius = 10), $);
4526
4774
  }
4527
- function co(e) {
4528
- return e.current?.target.clone() ?? new P();
4775
+ function Io(e) {
4776
+ return e.current?.getTarget(new I()) ?? new I();
4529
4777
  }
4530
- function lo({ camera: e, controlRef: t, direction: n, modelRef: r, transitionRef: i }) {
4531
- let a = co(t), o = so(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;
4532
- i.current = {
4533
- endPosition: s.clone().addScaledVector(c, u),
4778
+ function Lo({ camera: e, controlRef: t, direction: n, modelRef: r, transitionRef: i }) {
4779
+ let a = Io(t), o = Fo(r, a), s = o.center.clone(), c = new I(...n).normalize(), l = e.position.distanceTo(a), u = Number.isFinite(l) && l > o.radius * .5 ? l : o.radius * 2.4, d = s.clone().addScaledVector(c, u);
4780
+ t.current?.cancel(), t.current?.setFocalOffset(0, 0, 0, !1), i.current = {
4781
+ endPosition: d,
4534
4782
  endTarget: s,
4535
- endUp: oo(c),
4783
+ endUp: Po(c),
4536
4784
  startPosition: e.position.clone(),
4537
4785
  startTarget: a,
4538
4786
  startTime: performance.now(),
4539
4787
  startUp: e.up.clone()
4540
4788
  };
4541
4789
  }
4542
- function uo({ action: e, onPick: t }) {
4790
+ function Ro({ action: e, onPick: t }) {
4543
4791
  let [n, r] = u(!1);
4544
- return /* @__PURE__ */ I("group", {
4792
+ return /* @__PURE__ */ R("group", {
4545
4793
  position: e.position,
4546
- onClick: to,
4794
+ onClick: ko,
4547
4795
  onPointerDown: (n) => {
4548
- to(n), t(e);
4796
+ ko(n), t(e);
4549
4797
  },
4550
4798
  onPointerEnter: (e) => {
4551
- to(e), r(!0);
4799
+ ko(e), r(!0);
4552
4800
  },
4553
4801
  onPointerLeave: (e) => {
4554
- to(e), r(!1);
4802
+ ko(e), r(!1);
4555
4803
  },
4556
- children: [/* @__PURE__ */ I("mesh", {
4804
+ children: [/* @__PURE__ */ R("mesh", {
4557
4805
  scale: e.scale,
4558
- children: [/* @__PURE__ */ F("boxGeometry", { args: [
4806
+ children: [/* @__PURE__ */ L("boxGeometry", { args: [
4559
4807
  1,
4560
4808
  1,
4561
4809
  1
4562
- ] }), /* @__PURE__ */ F("meshBasicMaterial", {
4563
- color: no(n),
4564
- opacity: ro(n),
4810
+ ] }), /* @__PURE__ */ L("meshBasicMaterial", {
4811
+ color: Ao(n),
4812
+ opacity: jo(n),
4565
4813
  transparent: !0
4566
4814
  })]
4567
- }), e.label && /* @__PURE__ */ F(ao, {
4815
+ }), e.label && /* @__PURE__ */ L(No, {
4568
4816
  color: n ? "#ffffff" : "#50606f",
4569
4817
  label: e.label,
4570
4818
  position: [
@@ -4576,11 +4824,11 @@ function uo({ action: e, onPick: t }) {
4576
4824
  })]
4577
4825
  });
4578
4826
  }
4579
- function fo({ active: e = !0, cameraRef: t, controlRef: n, modelRef: r }) {
4827
+ function zo({ active: e = !0, cameraRef: t, controlRef: n, modelRef: r }) {
4580
4828
  let i = l(null), a = l(null), o = c(() => [
4581
- ...Qa,
4582
- ...$a(),
4583
- ...eo()
4829
+ ...Eo,
4830
+ ...Do(),
4831
+ ...Oo()
4584
4832
  ], []);
4585
4833
  return f(() => {
4586
4834
  if (!e) return;
@@ -4589,16 +4837,20 @@ function fo({ active: e = !0, cameraRef: t, controlRef: n, modelRef: r }) {
4589
4837
  i.current && i.current.quaternion.copy(r.quaternion).invert();
4590
4838
  let o = a.current;
4591
4839
  if (!o) return;
4592
- let s = performance.now() - o.startTime, c = Math.min(s / Ja, 1), l = 1 - (1 - c) ** 3, u = n.current;
4593
- 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);
4594
- }), e ? /* @__PURE__ */ F("group", {
4840
+ let s = performance.now() - o.startTime, c = Math.min(s / So, 1), l = 1 - (1 - c) ** 3, u = n.current;
4841
+ if (r.position.lerpVectors(o.startPosition, o.endPosition, l), r.up.lerpVectors(o.startUp, o.endUp, l), u) {
4842
+ let e = new I().lerpVectors(o.startTarget, o.endTarget, l);
4843
+ u.setLookAt(r.position.x, r.position.y, r.position.z, e.x, e.y, e.z, !1);
4844
+ } else r.lookAt(o.endTarget);
4845
+ c >= 1 && (r.up.copy(o.endUp), u?.setLookAt(o.endPosition.x, o.endPosition.y, o.endPosition.z, o.endTarget.x, o.endTarget.y, o.endTarget.z, !1), a.current = null);
4846
+ }), e ? /* @__PURE__ */ L("group", {
4595
4847
  ref: i,
4596
- scale: Ka,
4597
- children: o.map((e) => /* @__PURE__ */ F(uo, {
4848
+ scale: bo,
4849
+ children: o.map((e) => /* @__PURE__ */ L(Ro, {
4598
4850
  action: e,
4599
4851
  onPick: (e) => {
4600
4852
  let i = t.current;
4601
- i && lo({
4853
+ i && Lo({
4602
4854
  camera: i,
4603
4855
  controlRef: n,
4604
4856
  direction: e.direction,
@@ -4611,13 +4863,13 @@ function fo({ active: e = !0, cameraRef: t, controlRef: n, modelRef: r }) {
4611
4863
  }
4612
4864
  //#endregion
4613
4865
  //#region src/viewer/Viewer.tsx
4614
- var po = class {
4866
+ var Bo = class {
4615
4867
  sceneApi = null;
4616
4868
  get = () => this.sceneApi;
4617
4869
  set = (e) => {
4618
4870
  this.sceneApi = e;
4619
4871
  };
4620
- }, mo = {
4872
+ }, Vo = {
4621
4873
  bottom: 16,
4622
4874
  height: 96,
4623
4875
  pointerEvents: "auto",
@@ -4626,11 +4878,11 @@ var po = class {
4626
4878
  touchAction: "none",
4627
4879
  width: 96,
4628
4880
  zIndex: 2
4629
- }, ho = {
4881
+ }, Ho = {
4630
4882
  height: "100%",
4631
4883
  position: "relative",
4632
4884
  width: "100%"
4633
- }, go = {
4885
+ }, Uo = {
4634
4886
  far: 50,
4635
4887
  near: .1,
4636
4888
  position: [
@@ -4639,135 +4891,207 @@ var po = class {
4639
4891
  10
4640
4892
  ],
4641
4893
  zoom: 72
4642
- }, _o = {
4894
+ }, Wo = {
4643
4895
  alpha: !0,
4644
4896
  antialias: !0
4645
- };
4646
- function vo() {
4897
+ }, Go = .1, Ko = .02, qo = 1e3, Jo = 50, Yo = .08, Xo = new g(), Zo = new de(), Qo = new I();
4898
+ function $o() {
4647
4899
  let e = navigator, t = navigator.userAgent.toLowerCase(), n = navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1, r = window.matchMedia?.("(pointer: coarse)").matches ?? !1;
4648
4900
  return e.userAgentData?.mobile || n || /android|iphone|ipad|ipod|mobile|tablet/.test(t) || navigator.maxTouchPoints > 1 && r ? "mobile" : "pc";
4649
4901
  }
4650
- function yo({ autoFitCamera: e, cameraRef: t, controlRef: n, lightRef: r, modelRef: i, modelsData: a, onReady: s, publicApi: u, setSceneApi: d }) {
4651
- 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(() => {
4652
- let e = Object.keys(a).sort((e, t) => Number(e) - Number(t));
4902
+ function es(e) {
4903
+ let t = ts(e);
4904
+ return t ? Math.max(t.radius * Ko, Go) : Go;
4905
+ }
4906
+ function ts(e) {
4907
+ if (!e || (Xo.setFromObject(e), Xo.isEmpty())) return null;
4908
+ let t = Xo.getBoundingSphere(Zo);
4909
+ return !Number.isFinite(t.radius) || t.radius <= 0 ? null : t;
4910
+ }
4911
+ function ns(e, t) {
4912
+ let n = ts(t);
4913
+ if (!n) return;
4914
+ let r = Math.max(qo, n.radius * Jo, e.near + 1);
4915
+ Math.abs(e.far - r) < 1 || (e.far = r, e.updateProjectionMatrix());
4916
+ }
4917
+ function rs(e, t, n, r, i) {
4918
+ let a = n.elementIndex.get(i);
4919
+ a && a.forEach((n) => {
4920
+ let { record: i, vertexRanges: a } = n;
4921
+ if (i.modelID !== r) return;
4922
+ let o = i.mesh.geometry.attributes.position;
4923
+ o && (i.mesh.updateWorldMatrix(!0, !1), a.forEach((n) => {
4924
+ let r = n.start + n.count;
4925
+ for (let a = n.start; a < r; a++) t.set(o.getX(a), o.getY(a), o.getZ(a)).applyMatrix4(i.mesh.matrixWorld), Number.isFinite(t.x + t.y + t.z) && e.expandByPoint(t);
4926
+ }));
4927
+ });
4928
+ }
4929
+ function is(e, t) {
4930
+ let n = new g(), r = new I();
4931
+ return Object.entries(e).forEach(([e, i]) => {
4932
+ let a = Number(e);
4933
+ i.forEach((e) => {
4934
+ rs(n, r, t, a, e);
4935
+ });
4936
+ }), n.isEmpty() ? null : n;
4937
+ }
4938
+ function as(e) {
4939
+ let t = e.getSize(Qo), n = Math.max(t.x, t.y, t.z);
4940
+ return Number.isFinite(n) && n > 0 ? n * Yo : Go;
4941
+ }
4942
+ function os({ autoFitCamera: e, cameraRef: t, controlRef: n, lightRef: r, modelRef: a, modelsData: s, onReady: u, publicApi: d, setSceneApi: f }) {
4943
+ let g = p((e) => e.camera), _ = Mt(a), v = Ut(_), { colorPaletteTexture: y, colorUtils: b } = Ge(_), x = Bn(a), S = vn(a, n, x), C = Nn(a, n, x), w = c(() => new ra(), []), T = v.buildIndex, E = _.resetIndex, D = b.applyStoredColors, O = Fr(), k = l(!1), A = z((e) => e.showStats), ee = c(() => {
4944
+ let e = Object.keys(s).sort((e, t) => Number(e) - Number(t));
4653
4945
  for (let t of e) {
4654
- let e = St(a[Number(t)]);
4946
+ let e = St(s[Number(t)]);
4655
4947
  if (e) return e;
4656
4948
  }
4657
4949
  return null;
4658
- }, [a]), k = c(() => bt(te ?? void 0), [te]), ne = c(() => Object.entries(a).map(([e, t]) => [Number(e), t]), [a]), A = c(() => {
4950
+ }, [s]), j = c(() => bt(ee ?? void 0), [ee]), M = c(() => Object.entries(s).map(([e, t]) => [Number(e), t]), [s]), te = i(() => {
4951
+ n.current && (n.current.minDistance = es(a.current));
4952
+ }, [n, a]), N = i((e, t = !1) => {
4953
+ let r = n.current;
4954
+ if (!r) return;
4955
+ let i = is(e, _.buildIndex());
4956
+ if (!i) return;
4957
+ let a = i.getCenter(new I());
4958
+ if (r.cancel(), t) {
4959
+ let e = as(i);
4960
+ r.fitToBox(i, !0, {
4961
+ paddingBottom: e,
4962
+ paddingLeft: e,
4963
+ paddingRight: e,
4964
+ paddingTop: e
4965
+ });
4966
+ return;
4967
+ }
4968
+ r.setOrbitPoint(a.x, a.y, a.z);
4969
+ }, [n, _]), P = c(() => {
4659
4970
  let e = (e) => ({
4660
4971
  ...e,
4661
- activeViewRoot: i.current
4972
+ activeViewRoot: a.current
4662
4973
  });
4663
4974
  return {
4664
- convertIfcFileToBmt: (e, t) => C.ConvertIfcFileToBmt(e, t),
4665
- convertToBmt: (t) => C.ConvertToBmt(a, e(t))
4975
+ convertIfcFileToBmt: (e, t) => w.ConvertIfcFileToBmt(e, t),
4976
+ convertToBmt: (t) => w.ConvertToBmt(s, e(t))
4666
4977
  };
4667
4978
  }, [
4668
- C,
4669
- i,
4670
- a
4979
+ w,
4980
+ a,
4981
+ s
4671
4982
  ]);
4672
- return Ar(i, n, b), Pn(), o(() => (b.setClippingSource(x), () => {
4673
- b.setClippingSource(null);
4674
- }), [b, x]), o(() => (t.current = f, () => {
4675
- t.current === f && (t.current = null);
4676
- }), [f, t]), o(() => {
4677
- if (!i.current) return;
4983
+ return Mr(a, n, x), Fn(), o(() => (x.setClippingSource(S), () => {
4984
+ x.setClippingSource(null);
4985
+ }), [x, S]), o(() => (t.current = g, () => {
4986
+ t.current === g && (t.current = null);
4987
+ }), [g, t]), o(() => {
4988
+ if (!a.current) return;
4678
4989
  let t = requestAnimationFrame(() => {
4679
- i.current?.updateMatrixWorld(!0), T(), w(), E(), x.syncWithModel(), S.syncWithModel(), e && D(i, n, r);
4990
+ a.current?.updateMatrixWorld(!0), (g instanceof se || g instanceof oe) && ns(g, a.current), te(), E(), T(), D(), S.syncWithModel(), C.syncWithModel(), e && O(a, n, r);
4680
4991
  });
4681
4992
  return () => cancelAnimationFrame(t);
4682
4993
  }, [
4683
- E,
4994
+ D,
4684
4995
  e,
4685
- w,
4686
- x,
4687
- n,
4996
+ T,
4997
+ g,
4688
4998
  S,
4689
- D,
4999
+ n,
5000
+ C,
5001
+ O,
4690
5002
  r,
4691
- i,
4692
5003
  a,
4693
- T
4694
- ]), o(() => (d({
4695
- camera: {
4696
- fitCamera: () => D(i, n, r),
4697
- getIntersection: b.getIntersection
4698
- },
4699
- clipping: {
4700
- createClippingRectangle: x.createClippingRectangle,
4701
- createPlane: x.createPlane,
4702
- deleteAllPlanes: x.deleteAllPlanes,
4703
- getActive: x.getActive,
4704
- getEdgesActive: x.getEdgesActive,
4705
- getHelpersActive: x.getHelpersActive,
4706
- getPlanes: x.getPlanes,
4707
- setActive: x.setActive,
4708
- setEdgesActive: x.setEdgesActive,
4709
- setHelpersActive: x.setHelpersActive,
4710
- toggle: x.toggle,
4711
- updateEdges: x.updateEdges,
4712
- updateMaterials: x.updateMaterials
4713
- },
4714
- colors: {
4715
- clearAllColors: y.clearAllColors,
4716
- clearColor: y.clearColor,
4717
- clearModelColors: y.clearModelColors,
4718
- setColor: y.setColor
4719
- },
4720
- converter: A,
4721
- dimensions: {
4722
- cancelDrawing: S.cancelDrawing,
4723
- changeAxes: S.changeAxes,
4724
- delete: S.delete,
4725
- deleteAll: S.deleteAll,
4726
- getActive: S.getActive,
4727
- getDimensions: S.getDimensions,
4728
- getSnapDistance: S.getSnapDistance,
4729
- getUnit: S.getUnit,
4730
- setActive: S.setActive,
4731
- setColor: S.setColor,
4732
- setEndpointScaleFactor: S.setEndpointScaleFactor,
4733
- setSnapDistance: S.setSnapDistance,
4734
- setUnit: S.setUnit,
4735
- setWidth: S.setWidth,
4736
- toggle: S.toggle
4737
- },
4738
- geometryUtils: {
4739
- getAllIds: _.getAllIds,
4740
- getIfcSpacesVisibility: _.getIfcSpacesVisibility,
4741
- hideByIds: _.hideByIds,
4742
- hideSelected: _.hideSelected,
4743
- isolateByIds: _.isolateByIds,
4744
- isolateSelected: _.isolateSelected,
4745
- resetIsolation: _.resetIsolation,
4746
- setIfcSpacesVisibility: _.setIfcSpacesVisibility,
4747
- showAll: _.showAll,
4748
- showByIds: _.showByIds,
4749
- toggleIIfcSpacesVisibility: _.toggleIIfcSpacesVisibility
4750
- }
4751
- }), ee.current || (ee.current = !0, s?.(u)), () => d(null)), [
5004
+ s,
5005
+ E,
5006
+ te
5007
+ ]), o(() => {
5008
+ let e = () => {
5009
+ !S.getActive() || !S.getEdgesActive() || S.updateEdges();
5010
+ }, t = (t) => {
5011
+ t(), e();
5012
+ };
5013
+ return f({
5014
+ camera: {
5015
+ fitCamera: () => O(a, n, r),
5016
+ getIntersection: x.getIntersection
5017
+ },
5018
+ clipping: {
5019
+ createClippingRectangle: S.createClippingRectangle,
5020
+ createPlane: S.createPlane,
5021
+ deleteAllPlanes: S.deleteAllPlanes,
5022
+ getActive: S.getActive,
5023
+ getEdgesActive: S.getEdgesActive,
5024
+ getHelpersActive: S.getHelpersActive,
5025
+ getPlanes: S.getPlanes,
5026
+ setActive: S.setActive,
5027
+ setEdgesActive: S.setEdgesActive,
5028
+ setHelpersActive: S.setHelpersActive,
5029
+ toggle: S.toggle,
5030
+ updateEdges: S.updateEdges,
5031
+ updateMaterials: S.updateMaterials
5032
+ },
5033
+ colors: {
5034
+ clearAllColors: b.clearAllColors,
5035
+ clearColor: b.clearColor,
5036
+ clearModelColors: b.clearModelColors,
5037
+ rebuildByColors: b.rebuildByColors,
5038
+ rebuildModelByColors: b.rebuildModelByColors,
5039
+ setColor: b.setColor
5040
+ },
5041
+ converter: P,
5042
+ dimensions: {
5043
+ cancelDrawing: C.cancelDrawing,
5044
+ changeAxes: C.changeAxes,
5045
+ delete: C.delete,
5046
+ deleteAll: C.deleteAll,
5047
+ getActive: C.getActive,
5048
+ getDimensions: C.getDimensions,
5049
+ getSnapDistance: C.getSnapDistance,
5050
+ getUnit: C.getUnit,
5051
+ setActive: C.setActive,
5052
+ setColor: C.setColor,
5053
+ setEndpointScaleFactor: C.setEndpointScaleFactor,
5054
+ setSnapDistance: C.setSnapDistance,
5055
+ setUnit: C.setUnit,
5056
+ setWidth: C.setWidth,
5057
+ toggle: C.toggle
5058
+ },
5059
+ geometryUtils: {
5060
+ getAllIds: v.getAllIds,
5061
+ getIfcSpacesVisibility: v.getIfcSpacesVisibility,
5062
+ hideByIds: (e) => t(() => v.hideByIds(e)),
5063
+ hideSelected: () => t(v.hideSelected),
5064
+ isolateByIds: (e) => t(() => v.isolateByIds(e)),
5065
+ isolateSelected: () => t(v.isolateSelected),
5066
+ resetIsolation: () => t(v.resetIsolation),
5067
+ setIfcSpacesVisibility: (e) => t(() => v.setIfcSpacesVisibility(e)),
5068
+ showAll: () => t(v.showAll),
5069
+ showByIds: (e) => t(() => v.showByIds(e)),
5070
+ toggleIIfcSpacesVisibility: () => t(v.toggleIIfcSpacesVisibility)
5071
+ },
5072
+ selector: { setTargetToSelection: N }
5073
+ }), k.current || (k.current = !0, u?.(d)), () => f(null);
5074
+ }, [
5075
+ S,
4752
5076
  x,
4753
5077
  b,
4754
- y,
4755
5078
  n,
4756
- A,
4757
- S,
4758
- D,
4759
- _,
5079
+ P,
5080
+ C,
5081
+ O,
5082
+ v,
4760
5083
  r,
4761
- i,
4762
- s,
5084
+ a,
4763
5085
  u,
4764
- d
4765
- ]), /* @__PURE__ */ I(Te, { children: [
4766
- /* @__PURE__ */ F("ambientLight", {
5086
+ d,
5087
+ f,
5088
+ N
5089
+ ]), /* @__PURE__ */ R(Ce, { children: [
5090
+ /* @__PURE__ */ L("ambientLight", {
4767
5091
  intensity: 1.2,
4768
5092
  color: "#ffffff"
4769
5093
  }),
4770
- /* @__PURE__ */ F("directionalLight", {
5094
+ /* @__PURE__ */ L("directionalLight", {
4771
5095
  ref: r,
4772
5096
  position: [
4773
5097
  10,
@@ -4777,24 +5101,27 @@ function yo({ autoFitCamera: e, cameraRef: t, controlRef: n, lightRef: r, modelR
4777
5101
  color: "#ffffff",
4778
5102
  intensity: 2
4779
5103
  }),
4780
- O && /* @__PURE__ */ F(h, {}),
4781
- /* @__PURE__ */ F("group", {
4782
- ref: i,
4783
- children: ne.map(([e, t]) => /* @__PURE__ */ F(wt, {
4784
- colorPaletteTexture: v,
4785
- coordinationMatrix: k,
5104
+ A && /* @__PURE__ */ L(h, {}),
5105
+ /* @__PURE__ */ L("group", {
5106
+ ref: a,
5107
+ children: M.map(([e, t]) => /* @__PURE__ */ L(wt, {
5108
+ colorPaletteTexture: y,
5109
+ coordinationMatrix: j,
4786
5110
  data: t,
4787
5111
  modelID: e
4788
5112
  }, e))
4789
5113
  }),
4790
- /* @__PURE__ */ F(m, {
4791
- dampingFactor: .15,
4792
- enableDamping: !0,
4793
- ref: n
5114
+ /* @__PURE__ */ L(m, {
5115
+ dollyToCursor: !0,
5116
+ draggingSmoothTime: .04,
5117
+ infinityDolly: !0,
5118
+ minDistance: Go,
5119
+ ref: n,
5120
+ smoothTime: .12
4794
5121
  })
4795
5122
  ] });
4796
5123
  }
4797
- function bo({ autoFitCamera: e = !0, camera: t = {
5124
+ function ss({ autoFitCamera: e = !0, camera: t = {
4798
5125
  position: [
4799
5126
  10,
4800
5127
  10,
@@ -4802,21 +5129,21 @@ function bo({ autoFitCamera: e = !0, camera: t = {
4802
5129
  ],
4803
5130
  fov: 50
4804
5131
  }, dpr: n = window.devicePixelRatio, modelUrls: r, modelSources: i, modelsData: a, onReady: s, publicApi: c, setSceneApi: f, showNavCube: p, showStats: m }) {
4805
- 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;
5132
+ let h = l(null), g = l(null), _ = l(null), v = l(null), [y, b] = u(), x = Ee(), S = z((e) => e.setModelNames), C = z((e) => e.setModelProps), w = z((e) => e.setModelStructure), T = z((e) => e.setShowNavCube), E = z((e) => e.setShowStats), D = z((e) => e.setUserDevice), O = z((e) => e.showNavCube), k = a ?? y;
4806
5133
  return o(() => {
4807
- D(vo());
5134
+ D($o());
4808
5135
  }, [D]), o(() => {
4809
5136
  E(!!m);
4810
5137
  }, [E, m]), o(() => {
4811
5138
  p !== void 0 && T(p);
4812
5139
  }, [T, p]), o(() => {
4813
5140
  let e = {}, t = {}, n = {};
4814
- O && Object.entries(O).forEach(([r, i]) => {
5141
+ k && Object.entries(k).forEach(([r, i]) => {
4815
5142
  let a = Number(r);
4816
5143
  i.name !== void 0 && (e[a] = i.name), i.props !== void 0 && (t[a] = i.props), i.structure !== void 0 && (n[a] = i.structure);
4817
5144
  }), S(e), C(t), w(n);
4818
5145
  }, [
4819
- O,
5146
+ k,
4820
5147
  S,
4821
5148
  C,
4822
5149
  w
@@ -4825,7 +5152,7 @@ function bo({ autoFitCamera: e = !0, camera: t = {
4825
5152
  let e = i ?? r;
4826
5153
  if (!e?.length) return;
4827
5154
  let t = !0;
4828
- return Ba.loadModel(e).then((e) => {
5155
+ return mo.loadModel(e).then((e) => {
4829
5156
  t && b(e);
4830
5157
  }), () => {
4831
5158
  t = !1;
@@ -4834,33 +5161,33 @@ function bo({ autoFitCamera: e = !0, camera: t = {
4834
5161
  a,
4835
5162
  i,
4836
5163
  r
4837
- ]), O ? /* @__PURE__ */ I("div", {
4838
- style: ho,
4839
- children: [/* @__PURE__ */ F(d, {
5164
+ ]), k ? /* @__PURE__ */ R("div", {
5165
+ style: Ho,
5166
+ children: [/* @__PURE__ */ L(d, {
4840
5167
  camera: t,
4841
5168
  dpr: n,
4842
- children: /* @__PURE__ */ F(Pr, {
5169
+ children: /* @__PURE__ */ L(Ir, {
4843
5170
  store: x,
4844
- children: /* @__PURE__ */ F(yo, {
5171
+ children: /* @__PURE__ */ L(os, {
4845
5172
  autoFitCamera: e,
4846
5173
  cameraRef: h,
4847
5174
  controlRef: g,
4848
5175
  lightRef: v,
4849
5176
  modelRef: _,
4850
- modelsData: O,
5177
+ modelsData: k,
4851
5178
  onReady: s,
4852
5179
  publicApi: c,
4853
5180
  setSceneApi: f
4854
5181
  })
4855
5182
  })
4856
- }), ee && /* @__PURE__ */ F("div", {
4857
- style: mo,
4858
- children: /* @__PURE__ */ F(d, {
4859
- camera: go,
5183
+ }), O && /* @__PURE__ */ L("div", {
5184
+ style: Vo,
5185
+ children: /* @__PURE__ */ L(d, {
5186
+ camera: Uo,
4860
5187
  dpr: n,
4861
- gl: _o,
5188
+ gl: Wo,
4862
5189
  orthographic: !0,
4863
- children: /* @__PURE__ */ F(fo, {
5190
+ children: /* @__PURE__ */ L(zo, {
4864
5191
  active: !0,
4865
5192
  cameraRef: h,
4866
5193
  controlRef: g,
@@ -4868,35 +5195,35 @@ function bo({ autoFitCamera: e = !0, camera: t = {
4868
5195
  })
4869
5196
  })
4870
5197
  })]
4871
- }) : /* @__PURE__ */ F(Te, {});
5198
+ }) : /* @__PURE__ */ L(Ce, {});
4872
5199
  }
4873
- var xo = n(function(e, t) {
4874
- let [n] = u(je), r = l(!1), a = l(!1), d = c(() => new po(), []), { defaultSelected: f, onSelectedChange: p, selected: m } = e, h = i((e) => {
5200
+ var cs = n(function(e, t) {
5201
+ let [n] = u(Ae), r = l(!1), a = l(!1), d = c(() => new Bo(), []), { defaultSelected: f, onSelectedChange: p, selected: m } = e, h = i((e) => {
4875
5202
  d.set(e);
4876
- }, [d]), g = c(() => la(n, d.get), [d, n]);
5203
+ }, [d]), g = c(() => ba(n, d.get), [d, n]);
4877
5204
  return s(t, () => g, [g]), o(() => (n.getState().setApi(g), () => {
4878
5205
  n.getState().api === g && n.getState().setApi(null);
4879
5206
  }), [g, n]), o(() => {
4880
- r.current || !f || m !== void 0 || (r.current = !0, n.getState().setSelection(ca(f)));
5207
+ r.current || !f || m !== void 0 || (r.current = !0, n.getState().setSelection(ya(f)));
4881
5208
  }, [
4882
5209
  m,
4883
5210
  f,
4884
5211
  n
4885
5212
  ]), o(() => {
4886
- m !== void 0 && (a.current = !0, n.getState().setSelection(ca(m)), a.current = !1);
5213
+ m !== void 0 && (a.current = !0, n.getState().setSelection(ya(m)), a.current = !1);
4887
5214
  }, [m, n]), o(() => {
4888
5215
  if (p) return n.subscribe((e, t) => {
4889
- e.selected !== t.selected && (a.current || p(sa(e.selected)));
5216
+ e.selected !== t.selected && (a.current || p(va(e.selected)));
4890
5217
  });
4891
- }, [p, n]), /* @__PURE__ */ F(Pr, {
5218
+ }, [p, n]), /* @__PURE__ */ L(Ir, {
4892
5219
  store: n,
4893
- children: /* @__PURE__ */ F(bo, {
5220
+ children: /* @__PURE__ */ L(ss, {
4894
5221
  ...e,
4895
5222
  publicApi: g,
4896
5223
  setSceneApi: h
4897
5224
  })
4898
5225
  });
4899
5226
  });
4900
- xo.displayName = "Viewer";
5227
+ cs.displayName = "Viewer";
4901
5228
  //#endregion
4902
- export { da as BMTLoader, Ki as BmtConverter, Ji as ConvertIfcFileToBmt, Yi as ConvertToBmt, wn as DimensionLine, jn as DimensionsUtils, oa as FilteredElementsCollector, vt as ModelGrids, fo as NavigationCube, xo as Viewer, Pr as ViewerStoreProvider, qi as bmtConverter, xa as createBmtWorker, Na as createIfcWorker, je as createViewerStore, xi as exportExcel, vi as exportModelPropertiesToExcel, ba as loadBmtModelsInWorker, Ma as loadIfcModelsInWorker, Ba as loader, Mn as useDimensionsUtils, L as useViewerStore, R as useViewerStoreApi };
5229
+ export { Sa as BMTLoader, ra as BmtConverter, aa as ConvertIfcFileToBmt, oa as ConvertToBmt, Tn as DimensionLine, Mn as DimensionsUtils, _a as FilteredElementsCollector, vt as ModelGrids, zo as NavigationCube, cs as Viewer, Ir as ViewerStoreProvider, ia as bmtConverter, qa as convertIfcFilesToBmtInWorker, Ja as createBmtConverterWorker, Ma as createBmtWorker, oo as createIfcWorker, Ae as createViewerStore, wi as exportExcel, xi as exportModelPropertiesToExcel, ja as loadBmtModelsInWorker, ao as loadIfcModelsInWorker, mo as loader, Nn as useDimensionsUtils, z as useViewerStore, Ee as useViewerStoreApi };