viral-viewer-2 7.2.3 → 7.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,25 +1,25 @@
1
- import { Vector3 as E, Box3 as N, Mesh as x, BufferAttribute as L, BufferGeometry as Z, EdgesGeometry as Et, MeshBasicMaterial as G, PointLight as Ht, Object3D as Ft, InstancedMesh as le, Color as k, InstancedBufferAttribute as je, Matrix4 as re, LineSegments as yt, Line as gt, Points as St, Clock as ii, AnimationMixer as si, Vector2 as z, Vector4 as ni, Quaternion as ri, Spherical as Wt, Sphere as Gt, Raycaster as Tt, MathUtils as ai, PerspectiveCamera as Fe, OrthographicCamera as Ct, Euler as oi, MeshPhongMaterial as ft, FrontSide as li, MeshStandardMaterial as J, DoubleSide as te, ObjectLoader as ci, ShaderMaterial as ee, WebGLRenderTarget as ue, DepthTexture as At, UnsignedShortType as _t, MeshNormalMaterial as hi, RGBAFormat as Ut, HalfFloatType as qt, NearestFilter as Rt, Scene as vt, WebGLRenderer as Qt, SRGBColorSpace as di, VSMShadowMap as ui, SphereGeometry as Lt, DirectionalLight as pt, AmbientLight as pi, CameraHelper as mi, BoxGeometry as Pt, AxesHelper as gi, BoxHelper as fi, Box3Helper as vi, PlaneGeometry as oe, Plane as he, Fog as bi, PointsMaterial as wi, LOD as yi, TextureLoader as xi, CanvasTexture as kt, SpriteMaterial as Bt, Sprite as zt, LineBasicMaterial as Mi } from "three";
1
+ import { Vector3 as E, Box3 as j, Mesh as x, BufferAttribute as z, BufferGeometry as ne, EdgesGeometry as Mt, MeshBasicMaterial as q, PointLight as $t, Object3D as jt, InstancedMesh as oe, Color as $, InstancedBufferAttribute as bt, Matrix4 as se, LineSegments as wt, Line as mt, Points as Et, Clock as ii, AnimationMixer as si, Vector2 as H, Vector4 as ni, Quaternion as ri, Spherical as Ht, Sphere as Ft, Raycaster as It, MathUtils as ai, PerspectiveCamera as He, OrthographicCamera as Ct, Euler as oi, MeshPhongMaterial as gt, FrontSide as li, MeshStandardMaterial as K, DoubleSide as J, ObjectLoader as ci, WebGLRenderTarget as ue, DepthTexture as St, UnsignedShortType as At, ShaderMaterial as le, MeshNormalMaterial as hi, RGBAFormat as Wt, HalfFloatType as Gt, NearestFilter as Ot, WebGLRenderer as Ut, SRGBColorSpace as di, VSMShadowMap as ui, Scene as Tt, SphereGeometry as Dt, DirectionalLight as ut, AmbientLight as pi, CameraHelper as mi, BoxGeometry as Pt, AxesHelper as gi, BoxHelper as fi, Box3Helper as vi, PlaneGeometry as ae, Plane as he, Fog as bi, PointsMaterial as wi, LOD as yi, TextureLoader as xi, CanvasTexture as Rt, SpriteMaterial as Lt, Sprite as kt, LineBasicMaterial as Mi } from "three";
2
2
  import { SimplifyModifier as Ei } from "three/examples/jsm/modifiers/SimplifyModifier";
3
- import { LineSegmentsGeometry as Zt, LineSegments2 as Yt, SSAARenderPass as Si, FXAAShader as Ci, TAARenderPass as Ai, SAOPass as _i, SSAOPass as mt } from "three/examples/jsm/Addons";
4
- import { computeBoundsTree as Ii, disposeBoundsTree as Vi, acceleratedRaycast as Ti } from "three-mesh-bvh";
3
+ import { LineSegmentsGeometry as qt, LineSegments2 as Qt, SSAARenderPass as Ci, FXAAShader as Si, TAARenderPass as Ai, SAOPass as _i, SSAOPass as pt } from "three/examples/jsm/Addons";
4
+ import { computeBoundsTree as Vi, disposeBoundsTree as Ii, acceleratedRaycast as Ti } from "three-mesh-bvh";
5
5
  import pe from "camera-controls";
6
6
  import { inflate as Pi, Inflate as Oi } from "pako";
7
7
  import { Potree as Di, PointSizeType as Ri, PointShape as Li, PointColorType as ki } from "potree-core-viral";
8
8
  import { GLTFLoader as Bi } from "three/examples/jsm/loaders/GLTFLoader";
9
- import { LineMaterial as Xt } from "three/examples/jsm/lines/LineMaterial";
9
+ import { LineMaterial as Zt } from "three/examples/jsm/lines/LineMaterial";
10
10
  import { N8AOPass as zi } from "n8ao";
11
11
  import { EffectComposer as Ni } from "three/examples/jsm/postprocessing/EffectComposer";
12
12
  import { OutlinePass as $i } from "three/examples/jsm/postprocessing/OutlinePass";
13
13
  import { OutputPass as ji } from "three/examples/jsm/postprocessing/OutputPass";
14
14
  import { RenderPass as Hi } from "three/examples/jsm/postprocessing/RenderPass";
15
- import { ShaderPass as xt } from "three/examples/jsm/postprocessing/ShaderPass";
15
+ import { ShaderPass as yt } from "three/examples/jsm/postprocessing/ShaderPass";
16
16
  import { SMAAPass as Fi } from "three/examples/jsm/postprocessing/SMAAPass";
17
17
  import { GammaCorrectionShader as Wi } from "three/examples/jsm/shaders/GammaCorrectionShader";
18
- import { Pass as Ot, FullScreenQuad as Dt } from "three/examples/jsm/postprocessing/Pass";
18
+ import { Pass as Yt, FullScreenQuad as Xt } from "three/examples/jsm/postprocessing/Pass";
19
19
  import { TransformControls as Gi } from "three/examples/jsm/controls/TransformControls";
20
20
  import { LineSegments2 as Ui } from "three/examples/jsm/lines/LineSegments2";
21
21
  import { LineSegmentsGeometry as qi } from "three/examples/jsm/lines/LineSegmentsGeometry";
22
- class bt {
22
+ class ft {
23
23
  static createElementFromHTML(e) {
24
24
  const t = document.createElement("div");
25
25
  return t.innerHTML = e.trim(), t.firstChild;
@@ -57,7 +57,7 @@ class Q {
57
57
  ) : console.log("Memory tracking is not supported in this browser.");
58
58
  }
59
59
  }
60
- class D {
60
+ class R {
61
61
  static middlePoint(e, t) {
62
62
  return new E(
63
63
  (e.x + t.x) / 2,
@@ -100,14 +100,14 @@ class D {
100
100
  };
101
101
  }
102
102
  static rgbToThreejsColor(e, t, i) {
103
- return "#" + D.componentToHex(e) + D.componentToHex(t) + D.componentToHex(i);
103
+ return "#" + R.componentToHex(e) + R.componentToHex(t) + R.componentToHex(i);
104
104
  }
105
105
  static componentToHex(e) {
106
106
  var t = e.toString(16);
107
107
  return t.length == 1 ? "0" + t : t;
108
108
  }
109
109
  static mergeBoundingBoxes(e) {
110
- const t = new N();
110
+ const t = new j();
111
111
  return e.forEach((i) => {
112
112
  t.union(i);
113
113
  }), t;
@@ -122,8 +122,8 @@ class D {
122
122
  return new x(s, e.material);
123
123
  }
124
124
  }
125
- const Zi = D.hexToRGB(y.accent), Yi = 0.99;
126
- class Y extends x {
125
+ const Zi = R.hexToRGB(y.accent);
126
+ class Z extends x {
127
127
  constructor(e, t, i) {
128
128
  super(e, t), this.globalMaterialIndex = -1, this.workerPool = null, this._depthPrePassMesh = null, this._bufferElements = [], this._colors = null, this._originalColor = null, this._elementMap = /* @__PURE__ */ new Map(), this._isBatching = !1, this._batchQueue = [], this._isProcessingQueue = !1, this._edgeLines = null, this._edgeRanges = /* @__PURE__ */ new Map(), this._edgeThreshold = 60, this._edgeMaterial = null, this._selectedElements = [], this._hidingElements = [], this._isolatingElements = [], this._hiddenSet = /* @__PURE__ */ new Set(), this._isolatedSet = /* @__PURE__ */ new Set(), this._elementOpacityMap = /* @__PURE__ */ new Map(), this._isRGBAMode = !1, this._elementOriginalColors = /* @__PURE__ */ new Map(), this._temporaryColors = /* @__PURE__ */ new Map(), this._isGeneratedLights = !1, this._pointLight = null, this.workerPool = i || null;
129
129
  }
@@ -156,7 +156,7 @@ class Y extends x {
156
156
  indices: m
157
157
  }), o += p;
158
158
  }
159
- this.geometry.setAttribute("position", new L(s, 3)), this.geometry.setAttribute("color", new L(r, 4)), this.geometry.setIndex(new L(n, 1)), this.geometry.computeVertexNormals(), this.geometry.computeBoundingSphere();
159
+ this.geometry.setAttribute("position", new z(s, 3)), this.geometry.setAttribute("color", new z(r, 4)), this.geometry.setIndex(new z(n, 1)), this.geometry.computeVertexNormals(), this.geometry.computeBoundingSphere();
160
160
  try {
161
161
  this.geometry.computeBoundsTree();
162
162
  } catch {
@@ -189,18 +189,18 @@ class Y extends x {
189
189
  return;
190
190
  const b = v.buffer.length / 3, w = [];
191
191
  this._elementMap.has(v.modelId.toString()) || this._elementMap.set(v.modelId.toString(), /* @__PURE__ */ new Map());
192
- const S = m;
193
- for (let C = 0; C < b; C++)
194
- c[u++] = v.buffer[C * 3], c[u++] = v.buffer[C * 3 + 1], c[u++] = v.buffer[C * 3 + 2], this._originalColor && (h[p++] = this._originalColor.r, h[p++] = this._originalColor.g, h[p++] = this._originalColor.b, h[p++] = 1);
195
- for (let C = 0; C < b - 2; C += 3)
196
- d[f++] = m + C, d[f++] = m + C + 1, d[f++] = m + C + 2, w.push(m + C, m + C + 1, m + C + 2);
192
+ const C = m;
193
+ for (let S = 0; S < b; S++)
194
+ c[u++] = v.buffer[S * 3], c[u++] = v.buffer[S * 3 + 1], c[u++] = v.buffer[S * 3 + 2], this._originalColor && (h[p++] = this._originalColor.r, h[p++] = this._originalColor.g, h[p++] = this._originalColor.b, h[p++] = 1);
195
+ for (let S = 0; S < b - 2; S += 3)
196
+ d[f++] = m + S, d[f++] = m + S + 1, d[f++] = m + S + 2, w.push(m + S, m + S + 1, m + S + 2);
197
197
  const A = this._elementMap.get(v.modelId.toString());
198
198
  A.has(v.elementId) || A.set(v.elementId, []), A.get(v.elementId).push({
199
- start: S,
199
+ start: C,
200
200
  count: b,
201
201
  indices: w
202
202
  }), m += b, this._bufferElements.push(v);
203
- }), this.geometry.setAttribute("position", new L(c, 3)), this.geometry.setAttribute("color", new L(h, 4)), this.geometry.setIndex(new L(d, 1)), this.geometry.hasAttribute("normal") && this.geometry.deleteAttribute("normal"), this.geometry.computeVertexNormals(), this.geometry.boundingSphere = null, this.geometry.computeBoundingSphere();
203
+ }), this.geometry.setAttribute("position", new z(c, 3)), this.geometry.setAttribute("color", new z(h, 4)), this.geometry.setIndex(new z(d, 1)), this.geometry.hasAttribute("normal") && this.geometry.deleteAttribute("normal"), this.geometry.computeVertexNormals(), this.geometry.boundingSphere = null, this.geometry.computeBoundingSphere();
204
204
  try {
205
205
  this.geometry.boundsTree && (this.geometry.boundsTree = null), this.geometry.computeBoundsTree();
206
206
  } catch {
@@ -270,7 +270,7 @@ class Y extends x {
270
270
  const { newPositions: t, newColors: i, newIndices: s, elementMappings: n } = e;
271
271
  try {
272
272
  const r = new Float32Array(t), o = new Float32Array(i), a = new Uint32Array(s);
273
- this.geometry.setAttribute("position", new L(r, 3)), this.geometry.setAttribute("color", new L(o, 3)), this.geometry.setIndex(new L(a, 1)), n.forEach((l) => {
273
+ this.geometry.setAttribute("position", new z(r, 3)), this.geometry.setAttribute("color", new z(o, 3)), this.geometry.setIndex(new z(a, 1)), n.forEach((l) => {
274
274
  const { modelId: c, elementId: h, start: d, count: u, indices: p } = l;
275
275
  this._elementMap.has(c) || this._elementMap.set(c, /* @__PURE__ */ new Map());
276
276
  const m = this._elementMap.get(c);
@@ -329,19 +329,19 @@ class Y extends x {
329
329
  if (this._edgeLines && (this.remove(this._edgeLines), this._edgeLines.geometry.dispose(), this._edgeLines = null), this._edgeRanges.clear(), !this._edgeMaterial)
330
330
  return;
331
331
  let e = 0;
332
- const t = new Z();
332
+ const t = new ne();
333
333
  for (const o of this._bufferElements) {
334
334
  const a = o.buffer;
335
335
  if (!a || a.length < 9)
336
336
  continue;
337
- t.setAttribute("position", new L(a, 3));
337
+ t.setAttribute("position", new z(a, 3));
338
338
  const l = Math.floor(a.length / 3 / 3), c = new Uint32Array(l * 3);
339
339
  for (let d = 0; d < l; d++) {
340
340
  const u = d * 3;
341
341
  c[u] = u, c[u + 1] = u + 1, c[u + 2] = u + 2;
342
342
  }
343
- t.setIndex(new L(c, 1));
344
- const h = new Et(t, this._edgeThreshold);
343
+ t.setIndex(new z(c, 1));
344
+ const h = new Mt(t, this._edgeThreshold);
345
345
  e += h.getAttribute("position").count, h.dispose(), t.deleteAttribute("position"), t.setIndex(null);
346
346
  }
347
347
  const i = new Float32Array(e * 3);
@@ -350,15 +350,15 @@ class Y extends x {
350
350
  const a = o.buffer;
351
351
  if (!a || a.length < 9)
352
352
  continue;
353
- const l = new Z();
354
- l.setAttribute("position", new L(a, 3));
353
+ const l = new ne();
354
+ l.setAttribute("position", new z(a, 3));
355
355
  const c = Math.floor(a.length / 3 / 3), h = new Uint32Array(c * 3);
356
356
  for (let b = 0; b < c; b++) {
357
357
  const w = b * 3;
358
358
  h[w] = w, h[w + 1] = w + 1, h[w + 2] = w + 2;
359
359
  }
360
- l.setIndex(new L(h, 1));
361
- const d = new Et(l, this._edgeThreshold), u = d.getAttribute("position");
360
+ l.setIndex(new z(h, 1));
361
+ const d = new Mt(l, this._edgeThreshold), u = d.getAttribute("position");
362
362
  i.set(u.array, s * 3);
363
363
  const p = s, m = u.count;
364
364
  let f = this._edgeRanges.get(o.modelId.toString());
@@ -369,8 +369,8 @@ class Y extends x {
369
369
  const n = new Uint32Array(e);
370
370
  for (let o = 0; o < e; o++)
371
371
  n[o] = o;
372
- const r = new Zt();
373
- r.setPositions(i), this._edgeLines = new Yt(r, this._edgeMaterial), this.add(this._edgeLines);
372
+ const r = new qt();
373
+ r.setPositions(i), this._edgeLines = new Qt(r, this._edgeMaterial), this.add(this._edgeLines);
374
374
  }
375
375
  /** Show edges ONLY for the given elements */
376
376
  isolateEdge(e) {
@@ -391,7 +391,7 @@ class Y extends x {
391
391
  let s = 0;
392
392
  for (const n of t)
393
393
  i[s++] = n;
394
- this._edgeLines.geometry.setIndex(new L(i, 1));
394
+ this._edgeLines.geometry.setIndex(new z(i, 1));
395
395
  }
396
396
  /** Hide edges for the given elements (keep all others) */
397
397
  hideEdge(e) {
@@ -413,7 +413,7 @@ class Y extends x {
413
413
  let n = 0;
414
414
  for (let r = 0; r < i.length; r++)
415
415
  i[r] && (s[n++] = r);
416
- this._edgeLines.geometry.setIndex(new L(s, 1));
416
+ this._edgeLines.geometry.setIndex(new z(s, 1));
417
417
  }
418
418
  /** Restore all edges */
419
419
  edgeReset() {
@@ -422,50 +422,20 @@ class Y extends x {
422
422
  const e = this._edgeLines.geometry.getAttribute("position"), t = new Uint32Array(e.count);
423
423
  for (let i = 0; i < t.length; i++)
424
424
  t[i] = i;
425
- this._edgeLines.geometry.setIndex(new L(t, 1));
425
+ this._edgeLines.geometry.setIndex(new z(t, 1));
426
426
  }
427
427
  //#region Selection
428
428
  /**
429
429
  * Select elements (highlights them with accent color)
430
430
  */
431
431
  select(e, t = []) {
432
- this.unselect(), this._selectedElements = e, this.changeColor(this._selectedElements, Zi), this._setSelectionAlpha(this._selectedElements, Yi);
432
+ this.unselect(), this._selectedElements = e, this.changeColor(this._selectedElements, Zi);
433
433
  }
434
434
  get selectedElements() {
435
435
  return this._selectedElements;
436
436
  }
437
437
  unselect() {
438
- this._selectedElements.length !== 0 && (this._setSelectionAlpha(this._selectedElements, 1), this.resetColor(this._selectedElements), this._selectedElements = []);
439
- }
440
- /**
441
- * Set alpha value for elements (used for selection marking)
442
- * This is VERY fast - only updates alpha channel, no geometry copying
443
- *
444
- * When setting alpha to 1.0 (removing selection), respects hidden/isolated state
445
- */
446
- _setSelectionAlpha(e, t) {
447
- var s;
448
- if (!this._colors)
449
- return;
450
- const i = this.geometry.getAttribute("color");
451
- if (i.itemSize === 4) {
452
- for (const { modelId: n, elementId: r } of e) {
453
- const o = (s = this._elementMap.get(n)) == null ? void 0 : s.get(r);
454
- if (!o)
455
- continue;
456
- let a = t;
457
- if (t === 1) {
458
- const l = `${n}:${r}`, c = this._elementOpacityMap.get(l);
459
- c !== void 0 ? a = c : this._isolatedSet.size > 0 ? a = this._isolatedSet.has(l) ? 1 : 0 : this._hiddenSet.has(l) && (a = 0);
460
- }
461
- for (const l of o)
462
- for (let c = 0; c < l.count; c++) {
463
- const h = (l.start + c) * 4 + 3;
464
- this._colors[h] = a;
465
- }
466
- }
467
- i.needsUpdate = !0;
468
- }
438
+ this._selectedElements.length !== 0 && (this.resetColor(this._selectedElements), this._selectedElements = []);
469
439
  }
470
440
  //#endregion
471
441
  //#region Hide/Isolate/Show
@@ -647,7 +617,7 @@ class Y extends x {
647
617
  */
648
618
  _createDepthPrePass() {
649
619
  this._removeDepthPrePass();
650
- const e = this.material, t = new G({
620
+ const e = this.material, t = new q({
651
621
  vertexColors: !0,
652
622
  transparent: !0,
653
623
  alphaTest: 0.5,
@@ -918,7 +888,7 @@ class Y extends x {
918
888
  s[c] = a.r, s[c + 1] = a.g, s[c + 2] = a.b;
919
889
  }
920
890
  }
921
- this.geometry.setAttribute("color", new L(s, t)), this.geometry.attributes.color.needsUpdate = !0, this._colors = s, console.log("✅ Unique colors assigned to each face.");
891
+ this.geometry.setAttribute("color", new z(s, t)), this.geometry.attributes.color.needsUpdate = !0, this._colors = s, console.log("✅ Unique colors assigned to each face.");
922
892
  }
923
893
  }
924
894
  /**
@@ -986,8 +956,8 @@ class Y extends x {
986
956
  n && e.push(n);
987
957
  }
988
958
  });
989
- const t = D.getCenterPoint(e), i = this.getFarthestDistance(t, e);
990
- t && !this._pointLight && (this._pointLight = new Ht(16562741, 1, i, 0.1), this._pointLight.position.copy(t), this.add(this._pointLight)), this._isGeneratedLights = !0;
959
+ const t = R.getCenterPoint(e), i = this.getFarthestDistance(t, e);
960
+ t && !this._pointLight && (this._pointLight = new $t(16562741, 1, i, 0.1), this._pointLight.position.copy(t), this.add(this._pointLight)), this._isGeneratedLights = !0;
991
961
  }
992
962
  this._pointLight && (this._pointLight.visible = !0);
993
963
  }
@@ -1022,7 +992,7 @@ class Y extends x {
1022
992
  );
1023
993
  if (t.length === 0)
1024
994
  return null;
1025
- const i = new N(), s = new E();
995
+ const i = new j(), s = new E();
1026
996
  for (const n of t)
1027
997
  if (n.buffer)
1028
998
  for (let r = 0; r < n.buffer.length; r += 3)
@@ -1073,7 +1043,7 @@ class Y extends x {
1073
1043
  o,
1074
1044
  100
1075
1045
  // Process 100 elements at a time
1076
- ), l = new Y(
1046
+ ), l = new Z(
1077
1047
  void 0,
1078
1048
  Array.isArray(this.material) ? this.material[0] : this.material,
1079
1049
  this.workerPool
@@ -1116,12 +1086,12 @@ class Y extends x {
1116
1086
  }), this.geometry.index && this.geometry.setIndex(null)), this._edgeLines && (this._edgeLines.geometry && this._edgeLines.geometry.dispose(), this.remove(this._edgeLines), this._edgeLines = null), this.geometry = null;
1117
1087
  }
1118
1088
  }
1119
- let Xi = 1;
1120
- class Nt {
1089
+ let Yi = 1;
1090
+ class Bt {
1121
1091
  constructor(e) {
1122
1092
  this._worker = new Worker(e), this._worker.onmessage = (t) => {
1123
1093
  this._OnMessage(t);
1124
- }, this._resolve = null, this._id = Xi++;
1094
+ }, this._resolve = null, this._id = Yi++;
1125
1095
  }
1126
1096
  _OnMessage(e) {
1127
1097
  const t = this._resolve;
@@ -1137,14 +1107,14 @@ class Nt {
1137
1107
  this._worker.terminate();
1138
1108
  }
1139
1109
  }
1140
- class ie {
1110
+ class ee {
1141
1111
  /**
1142
1112
  *
1143
1113
  * @param maxSize maximum number of worker
1144
1114
  * @param scriptPath javascript path for worker execute
1145
1115
  */
1146
1116
  constructor(e, t) {
1147
- this._workers = [], this.maximumNumberOfWorker = e, this.scriptPath = t, this._workers.push(new Nt(t)), this._free = [...this._workers], this._busy = {}, this._queue = [];
1117
+ this._workers = [], this.maximumNumberOfWorker = e, this.scriptPath = t, this._workers.push(new Bt(t)), this._free = [...this._workers], this._busy = {}, this._queue = [];
1148
1118
  }
1149
1119
  get length() {
1150
1120
  return this._workers.length;
@@ -1163,7 +1133,7 @@ class ie {
1163
1133
  _PumpQueue() {
1164
1134
  for (; this._queue.length > 0; ) {
1165
1135
  if (this._free.length == 0 && this._workers.length < this.maximumNumberOfWorker) {
1166
- const s = new Nt(this.scriptPath);
1136
+ const s = new Bt(this.scriptPath);
1167
1137
  this._workers.push(s), this._free.push(s);
1168
1138
  }
1169
1139
  if (this._free.length == 0)
@@ -1180,7 +1150,7 @@ class ie {
1180
1150
  this._workers.forEach((e) => e.dispose()), this._workers = [], this._free = [], this._busy = {}, this._queue = [];
1181
1151
  }
1182
1152
  }
1183
- const Ki = D.hexToRGB(y.accent), Ge = class Ge extends Ft {
1153
+ const Xi = R.hexToRGB(y.accent), We = class We extends jt {
1184
1154
  constructor(e) {
1185
1155
  super(), this.material = e, this.globalMaterialIndex = -1, this._depthPrePassMeshes = [], this._instancedMeshes = /* @__PURE__ */ new Map(), this._bufferElements = [], this._originalColor = null, this._elementMap = /* @__PURE__ */ new Map(), this._originalTransforms = /* @__PURE__ */ new Map(), this._elementOpacity = /* @__PURE__ */ new Map(), this._temporaryColors = /* @__PURE__ */ new Map(), this._selectedElements = [], this._hidingElements = [], this._isolatingElements = [], this._edgeLines = /* @__PURE__ */ new Map(), this._edgeRanges = /* @__PURE__ */ new Map(), this._edgeThreshold = 60, this._edgeMaterial = null, this._isGeneratedLights = !1, this._pointLight = null, this._hiddenSet = /* @__PURE__ */ new Set(), this._isolatedSet = /* @__PURE__ */ new Set(), this.material && "vertexColors" in this.material && (this.material.vertexColors = !0, this.material.needsUpdate = !0);
1186
1156
  }
@@ -1221,29 +1191,27 @@ const Ki = D.hexToRGB(y.accent), Ge = class Ge extends Ft {
1221
1191
  );
1222
1192
  }
1223
1193
  _createInstancedMesh(e, t, i) {
1224
- const s = this._createGeometryFromBuffer(e.buffer), n = new le(s, this.material, t.length), r = new Float32Array(t.length * 3);
1225
- t.forEach(({ element: l, instanceData: c }, h) => {
1226
- const d = this._transformArrayToMatrix4(c.transform);
1227
- n.setMatrixAt(h, d);
1228
- const u = l.modelId.toString(), p = c.elementId;
1229
- this._originalTransforms.has(u) || this._originalTransforms.set(u, /* @__PURE__ */ new Map()), this._originalTransforms.get(u).set(p, d.clone());
1230
- const m = this._originalColor || new k(1, 1, 1);
1231
- r[h * 3] = m.r, r[h * 3 + 1] = m.g, r[h * 3 + 2] = m.b, this._elementMap.has(u) || this._elementMap.set(u, /* @__PURE__ */ new Map());
1232
- const f = this._elementMap.get(u);
1233
- f.has(p) || f.set(p, []), f.get(p).push({
1194
+ const s = this._createGeometryFromBuffer(e.buffer), n = new oe(s, this.material, t.length), r = new Float32Array(t.length * 3);
1195
+ t.forEach(({ element: a, instanceData: l }, c) => {
1196
+ const h = this._transformArrayToMatrix4(l.transform);
1197
+ n.setMatrixAt(c, h);
1198
+ const d = a.modelId.toString(), u = l.elementId;
1199
+ this._originalTransforms.has(d) || this._originalTransforms.set(d, /* @__PURE__ */ new Map()), this._originalTransforms.get(d).set(u, h.clone());
1200
+ const p = this._originalColor || new $(1, 1, 1);
1201
+ r[c * 3] = p.r, r[c * 3 + 1] = p.g, r[c * 3 + 2] = p.b, this._elementMap.has(d) || this._elementMap.set(d, /* @__PURE__ */ new Map());
1202
+ const m = this._elementMap.get(d);
1203
+ m.has(u) || m.set(u, []), m.get(u).push({
1234
1204
  geometryKey: i,
1235
- instanceIndex: h,
1205
+ instanceIndex: c,
1236
1206
  instancedMesh: n
1237
1207
  });
1238
- }), n.instanceColor = new je(r, 3), n.instanceMatrix.needsUpdate = !0;
1208
+ }), n.instanceColor = new bt(r, 3), n.instanceMatrix.needsUpdate = !0;
1239
1209
  const o = new Float32Array(t.length);
1240
- o.fill(1), s.setAttribute("instanceOpacity", new je(o, 1));
1241
- const a = new Float32Array(t.length);
1242
- return a.fill(0), s.setAttribute("instanceSelected", new je(a, 1)), this.material && "vertexColors" in this.material && (this.material.vertexColors = !0, this.material.needsUpdate = !0), n;
1210
+ return o.fill(1), s.setAttribute("instanceOpacity", new bt(o, 1)), this.material && "vertexColors" in this.material && (this.material.vertexColors = !0, this.material.needsUpdate = !0), n;
1243
1211
  }
1244
1212
  _createGeometryFromBuffer(e) {
1245
- const t = new Z();
1246
- t.setAttribute("position", new L(e, 3));
1213
+ const t = new ne();
1214
+ t.setAttribute("position", new z(e, 3));
1247
1215
  const i = e.length / 3, s = Math.floor(i / 3), n = new Uint32Array(s * 3);
1248
1216
  for (let o = 0; o < s; o++) {
1249
1217
  const a = o * 3;
@@ -1252,7 +1220,7 @@ const Ki = D.hexToRGB(y.accent), Ge = class Ge extends Ft {
1252
1220
  const r = new Float32Array(i * 3);
1253
1221
  for (let o = 0; o < i; o++)
1254
1222
  r[o * 3] = 1, r[o * 3 + 1] = 1, r[o * 3 + 2] = 1;
1255
- t.setAttribute("color", new L(r, 3)), t.setIndex(new L(n, 1)), t.computeVertexNormals(), t.computeBoundingSphere();
1223
+ t.setAttribute("color", new z(r, 3)), t.setIndex(new z(n, 1)), t.computeVertexNormals(), t.computeBoundingSphere();
1256
1224
  try {
1257
1225
  t.computeBoundsTree();
1258
1226
  } catch {
@@ -1261,9 +1229,9 @@ const Ki = D.hexToRGB(y.accent), Ge = class Ge extends Ft {
1261
1229
  }
1262
1230
  _transformArrayToMatrix4(e) {
1263
1231
  if (e.length === 16)
1264
- return new re().fromArray(e);
1232
+ return new se().fromArray(e);
1265
1233
  if (e.length === 12) {
1266
- const t = new re();
1234
+ const t = new se();
1267
1235
  return t.set(
1268
1236
  e[0],
1269
1237
  e[1],
@@ -1283,7 +1251,7 @@ const Ki = D.hexToRGB(y.accent), Ge = class Ge extends Ft {
1283
1251
  1
1284
1252
  ), t;
1285
1253
  } else
1286
- return console.warn("Unsupported transform array length:", e.length), new re().identity();
1254
+ return console.warn("Unsupported transform array length:", e.length), new se().identity();
1287
1255
  }
1288
1256
  _generateGeometryKey(e) {
1289
1257
  let t = e.length.toString();
@@ -1299,29 +1267,10 @@ const Ki = D.hexToRGB(y.accent), Ge = class Ge extends Ft {
1299
1267
  }
1300
1268
  //#region Selection and Color Control
1301
1269
  select(e, t = []) {
1302
- this.unselect(), this._selectedElements = e, this.changeColor(this._selectedElements, Ki), this._setInstanceSelection(this._selectedElements, 1);
1270
+ this.unselect(), this._selectedElements = e, this.changeColor(this._selectedElements, Xi);
1303
1271
  }
1304
1272
  unselect() {
1305
- this._selectedElements.length > 0 && (this._setInstanceSelection(this._selectedElements, 0), this.resetColor(this._selectedElements), this._selectedElements = []);
1306
- }
1307
- /**
1308
- * Set instance selection state for fast outline detection
1309
- * @param elements - Elements to set selection for
1310
- * @param selected - 1.0 = selected, 0.0 = not selected
1311
- */
1312
- _setInstanceSelection(e, t) {
1313
- var i;
1314
- this._ensureSelectionAttributes();
1315
- for (const { modelId: s, elementId: n } of e) {
1316
- const r = (i = this._elementMap.get(s)) == null ? void 0 : i.get(n);
1317
- if (r)
1318
- for (const { instancedMesh: o, instanceIndex: a } of r) {
1319
- const l = o.geometry.getAttribute(
1320
- "instanceSelected"
1321
- );
1322
- l && (l.array[a] = t, l.needsUpdate = !0);
1323
- }
1324
- }
1273
+ this._selectedElements.length > 0 && (this.resetColor(this._selectedElements), this._selectedElements = []);
1325
1274
  }
1326
1275
  /**
1327
1276
  * Changes the color of multiple elements.
@@ -1445,7 +1394,7 @@ const Ki = D.hexToRGB(y.accent), Ge = class Ge extends Ft {
1445
1394
  var r;
1446
1395
  const n = (r = this._elementMap.get(i)) == null ? void 0 : r.get(s);
1447
1396
  n && n.forEach(({ instancedMesh: o, instanceIndex: a }) => {
1448
- o.setMatrixAt(a, Ge.ZERO_MATRIX), o.instanceMatrix.needsUpdate = !0;
1397
+ o.setMatrixAt(a, We.ZERO_MATRIX), o.instanceMatrix.needsUpdate = !0;
1449
1398
  });
1450
1399
  }));
1451
1400
  }
@@ -1463,7 +1412,7 @@ const Ki = D.hexToRGB(y.accent), Ge = class Ge extends Ft {
1463
1412
  this._isolatedSet.add(s);
1464
1413
  }), this._isolatingElements = [...t], this._isolatedSet.size === 0 ? (this.visible = !1, this._isolatingElements) : (this._instancedMeshes.forEach((i) => {
1465
1414
  for (let s = 0; s < i.count; s++)
1466
- i.setMatrixAt(s, Ge.ZERO_MATRIX);
1415
+ i.setMatrixAt(s, We.ZERO_MATRIX);
1467
1416
  i.instanceMatrix.needsUpdate = !0;
1468
1417
  }), t.forEach(({ modelId: i, elementId: s }) => {
1469
1418
  var o, a;
@@ -1533,10 +1482,7 @@ const Ki = D.hexToRGB(y.accent), Ge = class Ge extends Ft {
1533
1482
  //#endregion
1534
1483
  //#region Opacity Control (Per-Instance Transparency)
1535
1484
  /**
1536
- * Inject per-instance opacity and selection shader into material
1537
- * Enables:
1538
- * - Per-instance opacity (ghosting, hiding)
1539
- * - Selection alpha marker (for fast outline detection via AlphaSelectionOutlinePass)
1485
+ * Inject per-instance opacity shader into material
1540
1486
  * Must be called after material is set and before rendering
1541
1487
  */
1542
1488
  injectOpacityShader() {
@@ -1548,28 +1494,19 @@ const Ki = D.hexToRGB(y.accent), Ge = class Ge extends Ft {
1548
1494
  "#include <common>",
1549
1495
  `#include <common>
1550
1496
  attribute float instanceOpacity;
1551
- attribute float instanceSelected;
1552
- varying float vInstanceOpacity;
1553
- varying float vInstanceSelected;`
1497
+ varying float vInstanceOpacity;`
1554
1498
  ), t.vertexShader = t.vertexShader.replace(
1555
1499
  "#include <begin_vertex>",
1556
1500
  `#include <begin_vertex>
1557
- vInstanceOpacity = instanceOpacity;
1558
- vInstanceSelected = instanceSelected;`
1501
+ vInstanceOpacity = instanceOpacity;`
1559
1502
  ), t.fragmentShader = t.fragmentShader.replace(
1560
1503
  "#include <common>",
1561
1504
  `#include <common>
1562
- varying float vInstanceOpacity;
1563
- varying float vInstanceSelected;`
1505
+ varying float vInstanceOpacity;`
1564
1506
  ), t.fragmentShader = t.fragmentShader.replace(
1565
1507
  "#include <dithering_fragment>",
1566
1508
  `#include <dithering_fragment>
1567
- // Apply per-instance opacity
1568
1509
  gl_FragColor.a *= vInstanceOpacity;
1569
- // If selected, set alpha to SELECTION_ALPHA (0.99) for outline detection
1570
- if (vInstanceSelected > 0.5) {
1571
- gl_FragColor.a = 0.99;
1572
- }
1573
1510
  if (gl_FragColor.a < 0.01) discard;`
1574
1511
  );
1575
1512
  }, e._opacityInjected = !0, e.needsUpdate = !0);
@@ -1582,25 +1519,11 @@ if (gl_FragColor.a < 0.01) discard;`
1582
1519
  if (!e.geometry.getAttribute("instanceOpacity")) {
1583
1520
  const t = new Float32Array(e.count);
1584
1521
  t.fill(1);
1585
- const i = new je(t, 1);
1522
+ const i = new bt(t, 1);
1586
1523
  e.geometry.setAttribute("instanceOpacity", i);
1587
1524
  }
1588
1525
  });
1589
1526
  }
1590
- /**
1591
- * Ensure all instanced meshes have selection attribute
1592
- * Used for fast outline detection via AlphaSelectionOutlinePass
1593
- */
1594
- _ensureSelectionAttributes() {
1595
- this._instancedMeshes.forEach((e) => {
1596
- if (!e.geometry.getAttribute("instanceSelected")) {
1597
- const t = new Float32Array(e.count);
1598
- t.fill(0);
1599
- const i = new je(t, 1);
1600
- e.geometry.setAttribute("instanceSelected", i);
1601
- }
1602
- });
1603
- }
1604
1527
  /**
1605
1528
  * Update opacity for specific instances
1606
1529
  */
@@ -1675,7 +1598,7 @@ if (gl_FragColor.a < 0.01) discard;`
1675
1598
  */
1676
1599
  _createDepthPrePass() {
1677
1600
  this._removeDepthPrePass(), this._instancedMeshes.forEach((e) => {
1678
- const t = e.material, i = new G({
1601
+ const t = e.material, i = new q({
1679
1602
  colorWrite: !1,
1680
1603
  depthWrite: !0,
1681
1604
  side: t == null ? void 0 : t.side
@@ -1700,7 +1623,7 @@ varying float vInstanceOpacity;`
1700
1623
  if (vInstanceOpacity < 0.5) discard;`
1701
1624
  );
1702
1625
  }, i.needsUpdate = !0;
1703
- const s = new le(
1626
+ const s = new oe(
1704
1627
  e.geometry,
1705
1628
  i,
1706
1629
  e.count
@@ -1829,13 +1752,13 @@ if (vInstanceOpacity < 0.5) discard;`
1829
1752
  this._edgeLines.forEach((e) => {
1830
1753
  this.remove(e), e.geometry.dispose();
1831
1754
  }), this._edgeLines.clear(), this._edgeRanges.clear(), this._edgeMaterial && this._instancedMeshes.forEach((e, t) => {
1832
- const i = e.geometry, s = new Et(i, this._edgeThreshold);
1755
+ const i = e.geometry, s = new Mt(i, this._edgeThreshold);
1833
1756
  if (s.getAttribute("position")) {
1834
1757
  const r = s.getAttribute("position").array, o = e.count, a = new Float32Array(
1835
1758
  r.length * o
1836
1759
  );
1837
1760
  for (let c = 0; c < o; c++) {
1838
- const h = new re();
1761
+ const h = new se();
1839
1762
  e.getMatrixAt(c, h);
1840
1763
  const d = c * r.length;
1841
1764
  for (let u = 0; u < r.length; u += 3) {
@@ -1847,9 +1770,9 @@ if (vInstanceOpacity < 0.5) discard;`
1847
1770
  p.applyMatrix4(h), a[d + u] = p.x, a[d + u + 1] = p.y, a[d + u + 2] = p.z;
1848
1771
  }
1849
1772
  }
1850
- const l = new Zt();
1773
+ const l = new qt();
1851
1774
  if (l.setPositions(a), this._edgeMaterial) {
1852
- const c = new Yt(l, this._edgeMaterial);
1775
+ const c = new Qt(l, this._edgeMaterial);
1853
1776
  this.add(c), this._edgeLines.set(t, c);
1854
1777
  }
1855
1778
  }
@@ -1879,7 +1802,7 @@ if (vInstanceOpacity < 0.5) discard;`
1879
1802
  * Custom raycast function for instanced meshes
1880
1803
  */
1881
1804
  _instancedRaycast(e, t, i) {
1882
- const s = le.prototype.raycast, n = [];
1805
+ const s = oe.prototype.raycast, n = [];
1883
1806
  s.call(e, t, n), n.forEach((r) => {
1884
1807
  if (r.instanceId !== void 0) {
1885
1808
  const o = this.findElementByInstancedMeshAndIndex(
@@ -1930,15 +1853,15 @@ if (vInstanceOpacity < 0.5) discard;`
1930
1853
  }
1931
1854
  getElementBoxs(e) {
1932
1855
  var s;
1933
- const t = new N();
1856
+ const t = new j();
1934
1857
  let i = !1;
1935
1858
  for (const n of e) {
1936
1859
  const r = (s = this._elementMap.get(n.modelId)) == null ? void 0 : s.get(n.elementId);
1937
1860
  if (!(!r || r.length === 0))
1938
1861
  for (const { instancedMesh: o, instanceIndex: a } of r) {
1939
- const l = new re();
1862
+ const l = new se();
1940
1863
  o.getMatrixAt(a, l);
1941
- const c = new N().setFromBufferAttribute(
1864
+ const c = new j().setFromBufferAttribute(
1942
1865
  o.geometry.getAttribute("position")
1943
1866
  );
1944
1867
  c.applyMatrix4(l), t.union(c), i = !0;
@@ -1970,8 +1893,8 @@ if (vInstanceOpacity < 0.5) discard;`
1970
1893
  n && e.push(n);
1971
1894
  }
1972
1895
  });
1973
- const t = D.getCenterPoint(e), i = this.getFarthestDistance(t, e);
1974
- t && !this._pointLight && (this._pointLight = new Ht(16562741, 1, i, 0.1), this._pointLight.position.copy(t), this.add(this._pointLight)), this._isGeneratedLights = !0;
1896
+ const t = R.getCenterPoint(e), i = this.getFarthestDistance(t, e);
1897
+ t && !this._pointLight && (this._pointLight = new $t(16562741, 1, i, 0.1), this._pointLight.position.copy(t), this.add(this._pointLight)), this._isGeneratedLights = !0;
1975
1898
  }
1976
1899
  this._pointLight && (this._pointLight.visible = !0);
1977
1900
  }
@@ -2007,9 +1930,9 @@ if (vInstanceOpacity < 0.5) discard;`
2007
1930
  }
2008
1931
  //#endregion
2009
1932
  };
2010
- Ge.ZERO_MATRIX = new re().makeScale(0, 0, 0);
2011
- let ce = Ge;
2012
- const Ji = `
1933
+ We.ZERO_MATRIX = new se().makeScale(0, 0, 0);
1934
+ let ce = We;
1935
+ const Ki = `
2013
1936
  // Web Worker code as string (to be created as blob URL)
2014
1937
  self.onmessage = function(e) {
2015
1938
  const {
@@ -2123,16 +2046,16 @@ self.onmessage = function(e) {
2123
2046
  }
2124
2047
  };
2125
2048
  `;
2126
- class es extends x {
2049
+ class Ji extends x {
2127
2050
  constructor() {
2128
2051
  super(), this.workerPool = null, this.bimModels = [], this.isReady = !1, this._batchedMeshes = [], this._instancedMeshes = [], this._isolatingElements = [], this._initializeWorkerPool(4);
2129
2052
  }
2130
2053
  _initializeWorkerPool(e) {
2131
2054
  try {
2132
- const t = new Blob([Ji], {
2055
+ const t = new Blob([Ki], {
2133
2056
  type: "application/javascript"
2134
2057
  }), i = URL.createObjectURL(t);
2135
- this.workerPool = new ie(
2058
+ this.workerPool = new ee(
2136
2059
  e || navigator.hardwareConcurrency || 4,
2137
2060
  i
2138
2061
  ), console.log(
@@ -2144,9 +2067,9 @@ class es extends x {
2144
2067
  }
2145
2068
  get bounds() {
2146
2069
  try {
2147
- return new N().setFromObject(this);
2070
+ return new j().setFromObject(this);
2148
2071
  } catch {
2149
- return new N();
2072
+ return new j();
2150
2073
  }
2151
2074
  }
2152
2075
  setReady(e) {
@@ -2169,7 +2092,7 @@ class es extends x {
2169
2092
  * Get diagnostic info about merged model structure
2170
2093
  */
2171
2094
  getDiagnostics() {
2172
- const e = this.children.filter((s) => s instanceof Y).length, t = this.children.filter(
2095
+ const e = this.children.filter((s) => s instanceof Z).length, t = this.children.filter(
2173
2096
  (s) => s instanceof ce
2174
2097
  ).length;
2175
2098
  let i = 0;
@@ -2196,9 +2119,9 @@ class es extends x {
2196
2119
  }
2197
2120
  hide(e) {
2198
2121
  this._batchedMeshes.forEach((t) => {
2199
- t.hide(e);
2122
+ t.hide(e), t.hideEdge(e);
2200
2123
  }), this._instancedMeshes.forEach((t) => {
2201
- t.hide(e);
2124
+ t.hide(e), t.hideEdge(e);
2202
2125
  });
2203
2126
  }
2204
2127
  isolate(e) {
@@ -2311,7 +2234,7 @@ class es extends x {
2311
2234
  return null;
2312
2235
  const n = new Float32Array(s);
2313
2236
  let r = 0;
2314
- const o = new re(), a = new E();
2237
+ const o = new se(), a = new E();
2315
2238
  for (const l of i)
2316
2239
  if (l.buffer)
2317
2240
  if (l.instances && l.instances.length > 0)
@@ -2349,7 +2272,7 @@ class es extends x {
2349
2272
  }), this._instancedMeshes.forEach((i) => {
2350
2273
  const s = i.getElementBoxs(e);
2351
2274
  s && t.push(s);
2352
- }), D.mergeBoundingBoxes(t);
2275
+ }), R.mergeBoundingBoxes(t);
2353
2276
  }
2354
2277
  /**
2355
2278
  * reset visibility/ geometries only not reset color
@@ -2431,67 +2354,67 @@ class es extends x {
2431
2354
  this.isReady = !1, this._batchedMeshes.forEach((e) => e.dispose()), this._batchedMeshes = [], this._instancedMeshes.forEach((e) => e.dispose()), this._instancedMeshes = [], this.children = [];
2432
2355
  }
2433
2356
  }
2434
- class ur {
2357
+ class hr {
2435
2358
  constructor() {
2436
2359
  this.MaterialIndex = 0, this.Vertices = [], this.Indices = [], this.Name = "", this.Instances = [];
2437
2360
  }
2438
2361
  }
2439
- class pr {
2362
+ class dr {
2440
2363
  constructor() {
2441
2364
  this.MaterialIndex = 0, this.Elements = [];
2442
2365
  }
2443
2366
  }
2444
- class mr {
2367
+ class ur {
2445
2368
  constructor() {
2446
2369
  this.Vertices = [], this.Indices = [], this.Instances = [], this.Id = "";
2447
2370
  }
2448
2371
  }
2449
- class gr {
2372
+ class pr {
2450
2373
  constructor() {
2451
2374
  this.Vertices = [], this.Indices = [], this.Transform = null;
2452
2375
  }
2453
2376
  }
2454
- class fr {
2377
+ class mr {
2455
2378
  constructor() {
2456
2379
  this.buffer = null, this.instances = [];
2457
2380
  }
2458
2381
  }
2459
- class vr {
2382
+ class gr {
2460
2383
  constructor() {
2461
2384
  this.Solids = [], this.Id = "", this.Instances = [];
2462
2385
  }
2463
2386
  }
2464
- class br {
2387
+ class fr {
2465
2388
  constructor() {
2466
2389
  this.Materials = [], this.Elements = [], this.Camera = new Kt();
2467
2390
  }
2468
2391
  }
2469
- class wr {
2392
+ class vr {
2470
2393
  constructor() {
2471
2394
  this.MaterialIndex = 0, this.Vertices = [], this.Indices = [], this.Buffer = [];
2472
2395
  }
2473
2396
  }
2474
2397
  class Kt {
2475
2398
  constructor() {
2476
- this.scale = 0, this.origin = new ae(), this.eyePosition = new ae(), this.upDirection = new ae(), this.forwardDirection = new ae(), this.target = new ae(), this.box = new ts();
2399
+ this.scale = 0, this.origin = new re(), this.eyePosition = new re(), this.upDirection = new re(), this.forwardDirection = new re(), this.target = new re(), this.box = new es();
2477
2400
  }
2478
2401
  }
2479
- class ts {
2402
+ class es {
2480
2403
  constructor() {
2481
- this.min = new ae(), this.max = new ae();
2404
+ this.min = new re(), this.max = new re();
2482
2405
  }
2483
2406
  }
2484
- class yr {
2407
+ class br {
2485
2408
  constructor() {
2486
2409
  this.Data = {}, this.CameraData = new Kt(), this.Translation = [];
2487
2410
  }
2488
2411
  }
2489
- class ae {
2412
+ class re {
2490
2413
  constructor() {
2491
2414
  this.X = 0, this.Y = 0, this.Z = 0;
2492
2415
  }
2493
2416
  }
2494
- const is = {
2417
+ const ts = {
2495
2418
  enabled: !0,
2496
2419
  castShadow: !0,
2497
2420
  intensity: 5,
@@ -2502,7 +2425,7 @@ const is = {
2502
2425
  indirectLightIntensity: 1.2,
2503
2426
  shadowcatcher: !0
2504
2427
  };
2505
- function ss() {
2428
+ function is() {
2506
2429
  function g(i) {
2507
2430
  let s = 0;
2508
2431
  for (let n = 0; n < i.length; n++)
@@ -2532,25 +2455,25 @@ function ss() {
2532
2455
  for (let v = 0; v < a; v++)
2533
2456
  i.forEach((b) => {
2534
2457
  const w = u.get(b.id);
2535
- w.vx = 0, w.vy = 0, i.forEach((S) => {
2536
- if (b.id === S.id)
2458
+ w.vx = 0, w.vy = 0, i.forEach((C) => {
2459
+ if (b.id === C.id)
2537
2460
  return;
2538
- const A = u.get(S.id), C = w.x - A.x, M = w.y - A.y, _ = C * C + M * M, I = Math.sqrt(_) || 1, O = d * d / I;
2539
- w.vx += C / I * O, w.vy += M / I * O;
2461
+ const A = u.get(C.id), S = w.x - A.x, _ = w.y - A.y, V = S * S + _ * _, T = Math.sqrt(V) || 1, M = d * d / T;
2462
+ w.vx += S / T * M, w.vy += _ / T * M;
2540
2463
  });
2541
2464
  }), s.forEach((b) => {
2542
- const w = String(b.source), S = String(b.target), A = u.get(w), C = u.get(S);
2543
- if (!A || !C)
2465
+ const w = String(b.source), C = String(b.target), A = u.get(w), S = u.get(C);
2466
+ if (!A || !S)
2544
2467
  return;
2545
- const M = A.x - C.x, _ = A.y - C.y, I = Math.sqrt(M * M + _ * _) || 1, O = I * I / d, V = M / I * O, T = _ / I * O;
2546
- A.vx -= V, A.vy -= T, C.vx += V, C.vy += T;
2468
+ const _ = A.x - S.x, V = A.y - S.y, T = Math.sqrt(_ * _ + V * V) || 1, M = T * T / d, I = _ / T * M, D = V / T * M;
2469
+ A.vx -= I, A.vy -= D, S.vx += I, S.vy += D;
2547
2470
  }), i.forEach((b) => {
2548
- const w = u.get(b.id), S = Math.sqrt(w.vx * w.vx + w.vy * w.vy) || 1, A = Math.min(S, p);
2549
- if (w.x += w.vx / S * A, w.y += w.vy / S * A, l === "circular") {
2550
- const C = r / 2, M = o / 2, _ = Math.min(r, o) / 2, I = w.x - C, O = w.y - M;
2551
- if (Math.sqrt(I * I + O * O) > _) {
2552
- const T = Math.atan2(O, I);
2553
- w.x = C + _ * Math.cos(T), w.y = M + _ * Math.sin(T);
2471
+ const w = u.get(b.id), C = Math.sqrt(w.vx * w.vx + w.vy * w.vy) || 1, A = Math.min(C, p);
2472
+ if (w.x += w.vx / C * A, w.y += w.vy / C * A, l === "circular") {
2473
+ const S = r / 2, _ = o / 2, V = Math.min(r, o) / 2, T = w.x - S, M = w.y - _;
2474
+ if (Math.sqrt(T * T + M * M) > V) {
2475
+ const D = Math.atan2(M, T);
2476
+ w.x = S + V * Math.cos(D), w.y = _ + V * Math.sin(D);
2554
2477
  }
2555
2478
  } else
2556
2479
  w.x = Math.max(0, Math.min(r, w.x)), w.y = Math.max(0, Math.min(o, w.y));
@@ -2584,11 +2507,11 @@ function ss() {
2584
2507
  }
2585
2508
  };
2586
2509
  }
2587
- const ns = ss;
2588
- class rs {
2510
+ const ss = is;
2511
+ class ns {
2589
2512
  constructor() {
2590
- const e = new Blob([`(${ns})()`]), t = URL.createObjectURL(e);
2591
- this.workerPool = new ie(2, t);
2513
+ const e = new Blob([`(${ss})()`]), t = URL.createObjectURL(e);
2514
+ this.workerPool = new ee(2, t);
2592
2515
  }
2593
2516
  computeLayout(e, t, i, s) {
2594
2517
  const n = {
@@ -2607,7 +2530,7 @@ class rs {
2607
2530
  this.workerPool.dispose();
2608
2531
  }
2609
2532
  }
2610
- class as {
2533
+ class rs {
2611
2534
  constructor(e, t) {
2612
2535
  this._elementMap = /* @__PURE__ */ new Map(), this._relationships = [], this._searchIndex = null, this._searchIndexBuilt = !1, this._outEdges = /* @__PURE__ */ new Map(), this._inEdges = /* @__PURE__ */ new Map(), this._edgesByType = /* @__PURE__ */ new Map(), this.INVERSE = {
2613
2536
  ON_LEVEL: "HAS_ELEMENT",
@@ -2875,19 +2798,19 @@ class as {
2875
2798
  }), l("Building edges", n, n);
2876
2799
  const d = [];
2877
2800
  this._elementMap.forEach((f, v) => {
2878
- var w, S, A, C, M;
2879
- if (a++, (!(f != null && f.Category) || !((w = f.Category) != null && w.value) || f.Category.value == null) && (!(f != null && f.ObjectType) || !((S = f.ObjectType) != null && S.value) || f.ObjectType.value == null) || !h.has(v))
2801
+ var w, C, A, S, _;
2802
+ if (a++, (!(f != null && f.Category) || !((w = f.Category) != null && w.value) || f.Category.value == null) && (!(f != null && f.ObjectType) || !((C = f.ObjectType) != null && C.value) || f.ObjectType.value == null) || !h.has(v))
2880
2803
  return;
2881
2804
  const b = ((A = f == null ? void 0 : f.Name) == null ? void 0 : A.value) || v.toString();
2882
2805
  d.push({
2883
2806
  id: String(v),
2884
2807
  label: b,
2885
- group: ((C = f == null ? void 0 : f.Category) == null ? void 0 : C.value) || ((M = f == null ? void 0 : f.ObjectType) == null ? void 0 : M.value)
2808
+ group: ((S = f == null ? void 0 : f.Category) == null ? void 0 : S.value) || ((_ = f == null ? void 0 : f.ObjectType) == null ? void 0 : _.value)
2886
2809
  });
2887
2810
  }), l("Building nodes", d.length, d.length);
2888
2811
  const u = d.map((f) => f.id), p = this._calculateNodeLevels(c, u);
2889
2812
  a += r, l("Calculating levels", d.length, d.length);
2890
- const m = new rs();
2813
+ const m = new ns();
2891
2814
  l(
2892
2815
  "Computing layout",
2893
2816
  0,
@@ -2895,12 +2818,12 @@ class as {
2895
2818
  ), m.computeLayout(d, c, e, (f) => {
2896
2819
  a++;
2897
2820
  const v = d.map((b) => {
2898
- const w = f[b.id], S = p.get(b.id);
2821
+ const w = f[b.id], C = p.get(b.id);
2899
2822
  return {
2900
2823
  ...b,
2901
2824
  x: (w == null ? void 0 : w.x) ?? 0,
2902
2825
  y: (w == null ? void 0 : w.y) ?? 0,
2903
- level: S
2826
+ level: C
2904
2827
  };
2905
2828
  });
2906
2829
  a++, m.dispose(), t == null || t({
@@ -2943,22 +2866,22 @@ class as {
2943
2866
  b.vx = 0, b.vy = 0, e.forEach((w) => {
2944
2867
  if (v.id === w.id)
2945
2868
  return;
2946
- const S = h.get(w.id), A = b.x - S.x, C = b.y - S.y, M = A * A + C * C, _ = Math.sqrt(M) || 1, I = c * c / _;
2947
- b.vx += A / _ * I, b.vy += C / _ * I;
2869
+ const C = h.get(w.id), A = b.x - C.x, S = b.y - C.y, _ = A * A + S * S, V = Math.sqrt(_) || 1, T = c * c / V;
2870
+ b.vx += A / V * T, b.vy += S / V * T;
2948
2871
  });
2949
2872
  }), t.forEach((v) => {
2950
- const b = String(v.source), w = String(v.target), S = h.get(b), A = h.get(w);
2951
- if (!S || !A)
2873
+ const b = String(v.source), w = String(v.target), C = h.get(b), A = h.get(w);
2874
+ if (!C || !A)
2952
2875
  return;
2953
- const C = S.x - A.x, M = S.y - A.y, _ = Math.sqrt(C * C + M * M) || 1, I = _ * _ / c, O = C / _ * I, V = M / _ * I;
2954
- S.vx -= O, S.vy -= V, A.vx += O, A.vy += V;
2876
+ const S = C.x - A.x, _ = C.y - A.y, V = Math.sqrt(S * S + _ * _) || 1, T = V * V / c, M = S / V * T, I = _ / V * T;
2877
+ C.vx -= M, C.vy -= I, A.vx += M, A.vy += I;
2955
2878
  }), e.forEach((v) => {
2956
- const b = h.get(v.id), w = Math.sqrt(b.vx * b.vx + b.vy * b.vy) || 1, S = Math.min(w, u);
2957
- if (b.x += b.vx / w * S, b.y += b.vy / w * S, o === "circular") {
2958
- const A = s / 2, C = n / 2, M = Math.min(s, n) / 2, _ = b.x - A, I = b.y - C;
2959
- if (Math.sqrt(_ * _ + I * I) > M) {
2960
- const V = Math.atan2(I, _);
2961
- b.x = A + M * Math.cos(V), b.y = C + M * Math.sin(V);
2879
+ const b = h.get(v.id), w = Math.sqrt(b.vx * b.vx + b.vy * b.vy) || 1, C = Math.min(w, u);
2880
+ if (b.x += b.vx / w * C, b.y += b.vy / w * C, o === "circular") {
2881
+ const A = s / 2, S = n / 2, _ = Math.min(s, n) / 2, V = b.x - A, T = b.y - S;
2882
+ if (Math.sqrt(V * V + T * T) > _) {
2883
+ const I = Math.atan2(T, V);
2884
+ b.x = A + _ * Math.cos(I), b.y = S + _ * Math.sin(I);
2962
2885
  }
2963
2886
  } else
2964
2887
  b.x = Math.max(0, Math.min(s, b.x)), b.y = Math.max(0, Math.min(n, b.y));
@@ -2986,13 +2909,13 @@ class as {
2986
2909
  }
2987
2910
  //#endregion
2988
2911
  }
2989
- class xr {
2912
+ class wr {
2990
2913
  constructor() {
2991
2914
  this.children = /* @__PURE__ */ new Map(), this.keys = /* @__PURE__ */ new Set();
2992
2915
  }
2993
2916
  }
2994
- var B = /* @__PURE__ */ ((g) => (g[g.ON_MOUSE_MOVE = 0] = "ON_MOUSE_MOVE", g[g.ON_MOUSE_DOWN_LEFT = 1] = "ON_MOUSE_DOWN_LEFT", g[g.ON_MOUSE_UP_LEFT = 2] = "ON_MOUSE_UP_LEFT", g[g.ON_MOUSE_DOWN_RIGHT = 3] = "ON_MOUSE_DOWN_RIGHT", g[g.ON_MOUSE_UP_RIGHT = 4] = "ON_MOUSE_UP_RIGHT", g[g.ON_MOUSE_DOUBLE_CLICK = 5] = "ON_MOUSE_DOUBLE_CLICK", g))(B || {}), K = /* @__PURE__ */ ((g) => (g[g.ON_WAKE = 0] = "ON_WAKE", g[g.ON_SLEEP = 1] = "ON_SLEEP", g[g.ON_UPDATE = 2] = "ON_UPDATE", g))(K || {}), me = /* @__PURE__ */ ((g) => (g[g.KEYDOWN = 0] = "KEYDOWN", g[g.KEYUP = 1] = "KEYUP", g))(me || {}), R = /* @__PURE__ */ ((g) => (g[g.LOADED_SCENE = 0] = "LOADED_SCENE", g[g.LOADED_MATERIAL_MANAGER = 1] = "LOADED_MATERIAL_MANAGER", g[g.LOADED_RENDERER = 2] = "LOADED_RENDERER", g[g.LOADED_CAMERA = 3] = "LOADED_CAMERA", g[g.LOADED_CUBE = 4] = "LOADED_CUBE", g[g.LOADED_TOOLS = 5] = "LOADED_TOOLS", g[g.LOADED_SEPERATE_MODEL = 6] = "LOADED_SEPERATE_MODEL", g[g.GENERATED_MERGE_MODEL = 7] = "GENERATED_MERGE_MODEL", g[g.LOADED_DATA = 8] = "LOADED_DATA", g[g.SELECT_ELEMENTS = 9] = "SELECT_ELEMENTS", g[g.UNSELECT_ELEMENTS = 10] = "UNSELECT_ELEMENTS", g))(R || {});
2995
- class It {
2917
+ var N = /* @__PURE__ */ ((g) => (g[g.ON_MOUSE_MOVE = 0] = "ON_MOUSE_MOVE", g[g.ON_MOUSE_DOWN_LEFT = 1] = "ON_MOUSE_DOWN_LEFT", g[g.ON_MOUSE_UP_LEFT = 2] = "ON_MOUSE_UP_LEFT", g[g.ON_MOUSE_DOWN_RIGHT = 3] = "ON_MOUSE_DOWN_RIGHT", g[g.ON_MOUSE_UP_RIGHT = 4] = "ON_MOUSE_UP_RIGHT", g[g.ON_MOUSE_DOUBLE_CLICK = 5] = "ON_MOUSE_DOUBLE_CLICK", g))(N || {}), X = /* @__PURE__ */ ((g) => (g[g.ON_WAKE = 0] = "ON_WAKE", g[g.ON_SLEEP = 1] = "ON_SLEEP", g[g.ON_UPDATE = 2] = "ON_UPDATE", g))(X || {}), me = /* @__PURE__ */ ((g) => (g[g.KEYDOWN = 0] = "KEYDOWN", g[g.KEYUP = 1] = "KEYUP", g))(me || {}), k = /* @__PURE__ */ ((g) => (g[g.LOADED_SCENE = 0] = "LOADED_SCENE", g[g.LOADED_MATERIAL_MANAGER = 1] = "LOADED_MATERIAL_MANAGER", g[g.LOADED_RENDERER = 2] = "LOADED_RENDERER", g[g.LOADED_CAMERA = 3] = "LOADED_CAMERA", g[g.LOADED_CUBE = 4] = "LOADED_CUBE", g[g.LOADED_TOOLS = 5] = "LOADED_TOOLS", g[g.LOADED_SEPERATE_MODEL = 6] = "LOADED_SEPERATE_MODEL", g[g.GENERATED_MERGE_MODEL = 7] = "GENERATED_MERGE_MODEL", g[g.LOADED_DATA = 8] = "LOADED_DATA", g[g.SELECT_ELEMENTS = 9] = "SELECT_ELEMENTS", g[g.UNSELECT_ELEMENTS = 10] = "UNSELECT_ELEMENTS", g))(k || {});
2918
+ class _t {
2996
2919
  constructor() {
2997
2920
  this.items = {};
2998
2921
  }
@@ -3028,7 +2951,7 @@ class It {
3028
2951
  return Object.keys(this.items).length;
3029
2952
  }
3030
2953
  }
3031
- class Mr {
2954
+ class yr {
3032
2955
  constructor(e, t) {
3033
2956
  this.delay = e, this.eventHandler = t, this.timerId = null, this.handleEvent = (i) => {
3034
2957
  this.timerId && clearTimeout(this.timerId), this.timerId = setTimeout(() => {
@@ -3037,22 +2960,22 @@ class Mr {
3037
2960
  };
3038
2961
  }
3039
2962
  }
3040
- class os {
2963
+ class as {
3041
2964
  constructor() {
3042
2965
  this.deleted = [], this.added = [], this.modified = [], this.notChanged = [];
3043
2966
  }
3044
2967
  }
3045
- class ls {
2968
+ class os {
3046
2969
  constructor() {
3047
- this.clashes = new It();
2970
+ this.clashes = new _t();
3048
2971
  }
3049
2972
  }
3050
- class cs {
2973
+ class ls {
3051
2974
  constructor() {
3052
2975
  this.value = {}, this.elementIds = [], this.modelId = -1;
3053
2976
  }
3054
2977
  }
3055
- class hs {
2978
+ class cs {
3056
2979
  constructor(e) {
3057
2980
  this.viralViewerApi = e, this.panel = null, this.batchListContainer = null, this.isVisible = !1, this.selectedBatchMesh = null, this.inject();
3058
2981
  }
@@ -3268,7 +3191,7 @@ class hs {
3268
3191
  this.clearIsolation(), this.panel && (this.panel.remove(), this.panel = null);
3269
3192
  }
3270
3193
  }
3271
- class ds {
3194
+ class hs {
3272
3195
  constructor(e) {
3273
3196
  this.viralViewerApi = e, this.panel = null, this.instancedListContainer = null, this.isVisible = !1, this.selectedInstancedMesh = null, this.selectedInternalMesh = null, this.inject();
3274
3197
  }
@@ -3482,8 +3405,8 @@ class ds {
3482
3405
  </div>
3483
3406
  <span style="font-size: 14px; color: #666;">▶</span>
3484
3407
  `, u.addEventListener("click", (b) => {
3485
- const w = d.querySelector(".instanced-wrapper-content"), S = u.querySelector("span");
3486
- w && S && (w.classList.toggle("expanded"), S.textContent = w.classList.contains("expanded") ? "▼" : "▶");
3408
+ const w = d.querySelector(".instanced-wrapper-content"), C = u.querySelector("span");
3409
+ w && C && (w.classList.toggle("expanded"), C.textContent = w.classList.contains("expanded") ? "▼" : "▶");
3487
3410
  });
3488
3411
  const p = document.createElement("div");
3489
3412
  p.className = "instanced-wrapper-content";
@@ -3504,21 +3427,21 @@ class ds {
3504
3427
  ), m.addEventListener("click", (b) => {
3505
3428
  b.stopPropagation(), this.isolateWrapper(r, d);
3506
3429
  }), p.appendChild(m), a.forEach((b, w) => {
3507
- var _;
3508
- const S = b.geometry, A = ((_ = S.attributes.position) == null ? void 0 : _.count) || 0, C = S.index ? S.index.count / 3 : A / 3, M = document.createElement("div");
3509
- M.className = "internal-mesh-item", M.innerHTML = `
3430
+ var V;
3431
+ const C = b.geometry, A = ((V = C.attributes.position) == null ? void 0 : V.count) || 0, S = C.index ? C.index.count / 3 : A / 3, _ = document.createElement("div");
3432
+ _.className = "internal-mesh-item", _.innerHTML = `
3510
3433
  <div style="font-weight: 600; font-size: 12px; margin-bottom: 2px;">
3511
3434
  InstancedMesh ${w + 1}
3512
3435
  </div>
3513
3436
  <div class="instanced-item-info">
3514
3437
  Instances: ${b.count.toLocaleString()}<br>
3515
3438
  Base Vertices: ${A.toLocaleString()}<br>
3516
- Base Triangles: ${Math.floor(C).toLocaleString()}<br>
3439
+ Base Triangles: ${Math.floor(S).toLocaleString()}<br>
3517
3440
  Total Rendered: ${(A * b.count).toLocaleString()} verts
3518
3441
  </div>
3519
- `, M.addEventListener("click", (I) => {
3520
- I.stopPropagation(), this.isolateInternalMesh(r, b, M);
3521
- }), p.appendChild(M);
3442
+ `, _.addEventListener("click", (T) => {
3443
+ T.stopPropagation(), this.isolateInternalMesh(r, b, _);
3444
+ }), p.appendChild(_);
3522
3445
  }), d.appendChild(u), d.appendChild(p), this.instancedListContainer.appendChild(d);
3523
3446
  });
3524
3447
  const n = document.createElement("div");
@@ -3664,7 +3587,7 @@ class ds {
3664
3587
  this.clearIsolation(), this.panel && (this.panel.remove(), this.panel = null);
3665
3588
  }
3666
3589
  }
3667
- class us {
3590
+ class ds {
3668
3591
  constructor(e) {
3669
3592
  this.viralViewerApi = e, this.panel = null, this.contentContainer = null, this.isVisible = !1, this.lastAnalysis = null, this.inject();
3670
3593
  }
@@ -3971,12 +3894,12 @@ class us {
3971
3894
  let t = 0, i = 0, s = 0, n = "N/A";
3972
3895
  if (e instanceof x) {
3973
3896
  const c = e.geometry;
3974
- c && (c.attributes.position && (t = c.attributes.position.count), c.index ? i = c.index.count / 3 : i = t / 3), e instanceof le ? (s = 1, n = "Instanced", i *= e.count) : e instanceof Y ? (s = 1, n = "Batched") : (s = e.visible ? 1 : 0, n = Array.isArray(e.material) ? "Multi-Material" : ((a = e.material) == null ? void 0 : a.type) || "Unknown");
3975
- } else if (e instanceof yt || e instanceof gt) {
3897
+ c && (c.attributes.position && (t = c.attributes.position.count), c.index ? i = c.index.count / 3 : i = t / 3), e instanceof oe ? (s = 1, n = "Instanced", i *= e.count) : e instanceof Z ? (s = 1, n = "Batched") : (s = e.visible ? 1 : 0, n = Array.isArray(e.material) ? "Multi-Material" : ((a = e.material) == null ? void 0 : a.type) || "Unknown");
3898
+ } else if (e instanceof wt || e instanceof mt) {
3976
3899
  s = e.visible ? 1 : 0, n = "Line";
3977
3900
  const c = e.geometry;
3978
3901
  c && c.attributes.position && (t = c.attributes.position.count);
3979
- } else if (e instanceof St) {
3902
+ } else if (e instanceof Et) {
3980
3903
  s = e.visible ? 1 : 0, n = "Points";
3981
3904
  const c = e.geometry;
3982
3905
  c && c.attributes.position && (t = c.attributes.position.count);
@@ -3999,7 +3922,7 @@ class us {
3999
3922
  };
4000
3923
  }
4001
3924
  isRenderable(e) {
4002
- return e instanceof x || e instanceof yt || e instanceof gt || e instanceof St;
3925
+ return e instanceof x || e instanceof wt || e instanceof mt || e instanceof Et;
4003
3926
  }
4004
3927
  isVisibleInHierarchy(e) {
4005
3928
  let t = e;
@@ -4025,7 +3948,7 @@ class us {
4025
3948
  return `v${s}_i${n}_${r}`;
4026
3949
  }
4027
3950
  categorizeObject(e, t, i) {
4028
- e instanceof Y ? i.batchedMeshes.push(t) : e instanceof ce || e instanceof le ? i.instancedMeshes.push(t) : e instanceof x ? i.regularMeshes.push(t) : e instanceof yt || e instanceof gt ? i.edgeMeshes.push(t) : this.isRenderable(e) && i.otherObjects.push(t);
3951
+ e instanceof Z ? i.batchedMeshes.push(t) : e instanceof ce || e instanceof oe ? i.instancedMeshes.push(t) : e instanceof x ? i.regularMeshes.push(t) : e instanceof wt || e instanceof mt ? i.edgeMeshes.push(t) : this.isRenderable(e) && i.otherObjects.push(t);
4029
3952
  }
4030
3953
  analyzeMergedModel(e) {
4031
3954
  const t = this.viralViewerApi.viralScene.bimWorld, i = t.getDiagnostics();
@@ -4286,7 +4209,7 @@ class us {
4286
4209
  var a;
4287
4210
  const i = " ".repeat(t), s = e.visible ? "✅" : "❌", n = e.constructor.name, r = e.children.length;
4288
4211
  let o = "";
4289
- e instanceof x && e.geometry && (o = ` [V:${((a = e.geometry.attributes.position) == null ? void 0 : a.count) || 0}]`), e instanceof le && (o += ` [Instances:${e.count}]`), console.log(
4212
+ e instanceof x && e.geometry && (o = ` [V:${((a = e.geometry.attributes.position) == null ? void 0 : a.count) || 0}]`), e instanceof oe && (o += ` [Instances:${e.count}]`), console.log(
4290
4213
  `${i}${s} ${e.name || "[unnamed]"} (${n})${o} [${r} children]`
4291
4214
  ), t < 3 ? e.children.forEach((l) => {
4292
4215
  this.logObjectTree(l, t + 1);
@@ -4311,7 +4234,7 @@ class us {
4311
4234
  this.panel && (this.panel.remove(), this.panel = null);
4312
4235
  }
4313
4236
  }
4314
- class ps {
4237
+ class us {
4315
4238
  // 5 seconds for cleanup
4316
4239
  constructor(e) {
4317
4240
  this.viralViewerApi = e, this.clock = new ii(), this.lastSpatialUpdateTime = 0, this.lastCleanupTime = 0, this.spatialUpdateInterval = 16, this.cleanupInterval = 5e3, this.isRainEnabled = !1;
@@ -4357,7 +4280,7 @@ class ps {
4357
4280
  this.isRainEnabled = e, this.isRainEnabled && this.rainAnimation();
4358
4281
  }
4359
4282
  }
4360
- class ms {
4283
+ class ps {
4361
4284
  static generateRandomString(e) {
4362
4285
  const t = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
4363
4286
  let i = "";
@@ -4368,16 +4291,16 @@ class ms {
4368
4291
  return i;
4369
4292
  }
4370
4293
  }
4371
- const gs = 0.032;
4372
- class fs {
4294
+ const ms = 0.032;
4295
+ class gs {
4373
4296
  constructor(e, t, i, s, n = 2, r = 1, o, a) {
4374
- this.viralViewerApi = e, this.scaleRatio = n, this.mixer = null, this.idleAnimation = null, this.walkAnimation = null, this.avatar = null, this.destination = null, this.isReady = !1, this.name = "", this.id = ms.generateRandomString(10), this.MOVEMENT_SPEED = 0.032, this.talkContent = "", o && (this.id = o), a && (this.name = a, this.nameDiv = document.createElement("div"), this.nameDiv.setAttribute(
4297
+ this.viralViewerApi = e, this.scaleRatio = n, this.mixer = null, this.idleAnimation = null, this.walkAnimation = null, this.avatar = null, this.destination = null, this.isReady = !1, this.name = "", this.id = ps.generateRandomString(10), this.MOVEMENT_SPEED = 0.032, this.talkContent = "", o && (this.id = o), a && (this.name = a, this.nameDiv = document.createElement("div"), this.nameDiv.setAttribute(
4375
4298
  "style",
4376
4299
  "position: absolute; top:0; left:0;transform: translateX(-50%); pointer-events: none; background-color:rgba(226, 230, 220,1); color:rgb(23, 49, 44); padding: 5px ; border-radius:5px; font-size:x-small"
4377
4300
  ), this.nameDiv.id = this.id, this.nameDiv.append(this.name), this.viralViewerApi.targetElement.appendChild(this.nameDiv)), this.chatDiv = document.createElement("div"), this.chatDiv.setAttribute(
4378
4301
  "style",
4379
4302
  "position: absolute;display:none; top:0; left:0;transform: translate(-50%, -100%); pointer-events: none; background-color:rgba(226, 230, 220,1); color:rgb(23, 49, 44); padding: 5px ; border-radius:5px; font-size:x-small"
4380
- ), this.viralViewerApi.targetElement.appendChild(this.chatDiv), this.MOVEMENT_SPEED = gs * r, this.viralViewerApi.viralLoader.threeLoader.loadGLTF(t, (l) => {
4303
+ ), this.viralViewerApi.targetElement.appendChild(this.chatDiv), this.MOVEMENT_SPEED = ms * r, this.viralViewerApi.viralLoader.threeLoader.loadGLTF(t, (l) => {
4381
4304
  this.avatar = l.scene;
4382
4305
  const c = new E(n, n, n);
4383
4306
  this.avatar.scale.copy(c), console.log(this.avatar), this.mixer = new si(l.scene), this.viralViewerApi.viralScene.scene.add(l.scene), this.viralViewerApi.viralRenderer.render(), this.viralViewerApi.viralLoader.threeLoader.loadGLTF(i, (h) => {
@@ -4440,12 +4363,12 @@ class fs {
4440
4363
  (e = this.avatar) == null || e.removeFromParent(), this.mixer = null, this.walkAnimation = null, this.avatar = null, (i = (t = this.nameDiv) == null ? void 0 : t.parentNode) == null || i.removeChild(this.nameDiv), (n = (s = this.chatDiv) == null ? void 0 : s.parentNode) == null || n.removeChild(this.chatDiv);
4441
4364
  }
4442
4365
  }
4443
- class vs {
4366
+ class fs {
4444
4367
  constructor(e) {
4445
4368
  this.viralViewerApi = e, this.avatars = [];
4446
4369
  }
4447
4370
  load(e, t, i, s = 2, n = 1, r, o) {
4448
- const a = new fs(
4371
+ const a = new gs(
4449
4372
  this.viralViewerApi,
4450
4373
  e,
4451
4374
  t,
@@ -4462,33 +4385,33 @@ class vs {
4462
4385
  t && t.dispose(), this.avatars = this.avatars.filter((i) => i.id !== e);
4463
4386
  }
4464
4387
  }
4465
- class bs {
4388
+ class vs {
4466
4389
  constructor() {
4467
- Z.prototype.computeBoundsTree = Ii, Z.prototype.disposeBoundsTree = Vi, x.prototype.raycast = Ti;
4390
+ ne.prototype.computeBoundsTree = Vi, ne.prototype.disposeBoundsTree = Ii, x.prototype.raycast = Ti;
4468
4391
  }
4469
4392
  applyThreeMeshBVH(e) {
4470
4393
  e.boundsTree || e.computeBoundsTree();
4471
4394
  }
4472
4395
  }
4473
- const ws = {
4474
- Vector2: z,
4396
+ const bs = {
4397
+ Vector2: H,
4475
4398
  Vector3: E,
4476
4399
  Vector4: ni,
4477
4400
  Quaternion: ri,
4478
- Matrix4: re,
4479
- Spherical: Wt,
4480
- Box3: N,
4481
- Sphere: Gt,
4482
- Raycaster: Tt,
4401
+ Matrix4: se,
4402
+ Spherical: Ht,
4403
+ Box3: j,
4404
+ Sphere: Ft,
4405
+ Raycaster: It,
4483
4406
  MathUtils: ai
4484
4407
  };
4485
- pe.install({ THREE: ws });
4486
- class ys {
4408
+ pe.install({ THREE: bs });
4409
+ class ws {
4487
4410
  constructor(e) {
4488
- this.viralViewerApi = e, this.raycaster = new Tt(), this.camera = null, this._orthoCamera = null, this._perspectiveCamera = null, this._frustumSize = 200, this.cameraControls = null, this.onUsing = !1, this.modelId = "0", this.elementId = "243274", this.cameraWakeQueuedEvents = [], this.cameraSleepQueuedEvents = [], this.cameraUpdateQueuedEvents = [], this.targetElement = this.viralViewerApi.options.container, this.setupCamera(), this.viralViewerApi.emit(R.LOADED_CAMERA);
4411
+ this.viralViewerApi = e, this.raycaster = new It(), this.camera = null, this._orthoCamera = null, this._perspectiveCamera = null, this._frustumSize = 200, this.cameraControls = null, this.onUsing = !1, this.modelId = "0", this.elementId = "243274", this.cameraWakeQueuedEvents = [], this.cameraSleepQueuedEvents = [], this.cameraUpdateQueuedEvents = [], this.targetElement = this.viralViewerApi.options.container, this.setupCamera(), this.viralViewerApi.emit(k.LOADED_CAMERA);
4489
4412
  }
4490
4413
  setupCamera() {
4491
- this._perspectiveCamera = new Fe(
4414
+ this._perspectiveCamera = new He(
4492
4415
  60,
4493
4416
  this.targetElement.clientWidth / this.targetElement.clientHeight,
4494
4417
  0.1,
@@ -4537,7 +4460,7 @@ class ys {
4537
4460
  */
4538
4461
  resizeCanvas() {
4539
4462
  if (this.camera) {
4540
- if (this.camera instanceof Fe && (this.camera.aspect = this.targetElement.clientWidth / this.targetElement.clientHeight), this.camera instanceof Ct) {
4463
+ if (this.camera instanceof He && (this.camera.aspect = this.targetElement.clientWidth / this.targetElement.clientHeight), this.camera instanceof Ct) {
4541
4464
  const e = this.targetElement.offsetWidth / this.targetElement.offsetHeight;
4542
4465
  this.camera.left = -this._frustumSize * e / 2, this.camera.right = this._frustumSize * e / 2, this.camera.top = this._frustumSize / 2, this.camera.bottom = -this._frustumSize / 2;
4543
4466
  }
@@ -4548,7 +4471,7 @@ class ys {
4548
4471
  }
4549
4472
  }
4550
4473
  resizeCanvas2() {
4551
- this.camera && (this.camera instanceof Fe && (this.camera.aspect = this.targetElement.offsetWidth / this.targetElement.offsetHeight), this.camera.updateProjectionMatrix(), this.viralViewerApi.viralRenderer.updateSize(
4474
+ this.camera && (this.camera instanceof He && (this.camera.aspect = this.targetElement.offsetWidth / this.targetElement.offsetHeight), this.camera.updateProjectionMatrix(), this.viralViewerApi.viralRenderer.updateSize(
4552
4475
  this.targetElement.offsetWidth,
4553
4476
  this.targetElement.offsetHeight
4554
4477
  ), this.viralViewerApi.viralRenderer.render());
@@ -4658,7 +4581,7 @@ class ys {
4658
4581
  const t = this.viralViewerApi.viralScene.scene;
4659
4582
  if (!t || !this.camera)
4660
4583
  return;
4661
- const s = new N().setFromObject(t).getSize(new E()), n = Math.max(s.x, s.y, s.z);
4584
+ const s = new j().setFromObject(t).getSize(new E()), n = Math.max(s.x, s.y, s.z);
4662
4585
  this.camera.far = n + e, this.camera.updateProjectionMatrix(), this.cameraControls && (this.cameraControls.maxDistance = this.camera.far * 0.95);
4663
4586
  }
4664
4587
  /**
@@ -4669,32 +4592,32 @@ class ys {
4669
4592
  */
4670
4593
  addEventListener(e, t, i) {
4671
4594
  switch (e) {
4672
- case K.ON_WAKE:
4595
+ case X.ON_WAKE:
4673
4596
  this.cameraWakeQueuedEvents.push([t, i]);
4674
4597
  break;
4675
- case K.ON_SLEEP:
4598
+ case X.ON_SLEEP:
4676
4599
  this.cameraSleepQueuedEvents.push([t, i]);
4677
4600
  break;
4678
- case K.ON_UPDATE:
4601
+ case X.ON_UPDATE:
4679
4602
  this.cameraUpdateQueuedEvents.push([t, i]);
4680
4603
  break;
4681
4604
  }
4682
4605
  }
4683
4606
  removeEventListener(e, t) {
4684
4607
  switch (e) {
4685
- case K.ON_WAKE:
4608
+ case X.ON_WAKE:
4686
4609
  {
4687
4610
  const i = this.cameraWakeQueuedEvents.findIndex((s) => s[0] === t);
4688
4611
  this.cameraWakeQueuedEvents.splice(i, 1);
4689
4612
  }
4690
4613
  break;
4691
- case K.ON_SLEEP:
4614
+ case X.ON_SLEEP:
4692
4615
  {
4693
4616
  const i = this.cameraSleepQueuedEvents.findIndex((s) => s[0] === t);
4694
4617
  this.cameraSleepQueuedEvents.splice(i, 1);
4695
4618
  }
4696
4619
  break;
4697
- case K.ON_UPDATE:
4620
+ case X.ON_UPDATE:
4698
4621
  {
4699
4622
  const i = this.cameraUpdateQueuedEvents.findIndex((s) => s[0] === t);
4700
4623
  this.cameraUpdateQueuedEvents.splice(i, 1);
@@ -4720,7 +4643,7 @@ class ys {
4720
4643
  */
4721
4644
  async focusCameraOnModel(e, t = !1) {
4722
4645
  var u, p, m, f, v;
4723
- const i = new E(-e.box.min.X, e.box.min.Z, e.box.min.Y), s = new E(-e.box.max.X, e.box.max.Z, e.box.max.Y), n = D.middlePoint(i, s), r = Math.abs(e.box.max.X - e.box.min.X), o = Math.abs(e.box.max.Y - e.box.min.Y), a = Math.abs(e.box.max.Z - e.box.min.Z), l = Math.max(r, o, a);
4646
+ const i = new E(-e.box.min.X, e.box.min.Z, e.box.min.Y), s = new E(-e.box.max.X, e.box.max.Z, e.box.max.Y), n = R.middlePoint(i, s), r = Math.abs(e.box.max.X - e.box.min.X), o = Math.abs(e.box.max.Y - e.box.min.Y), a = Math.abs(e.box.max.Z - e.box.min.Z), l = Math.max(r, o, a);
4724
4647
  await ((u = this.viralViewerApi.viralCamera.cameraControls) == null ? void 0 : u.setTarget(
4725
4648
  n.x,
4726
4649
  n.y,
@@ -4730,7 +4653,7 @@ class ys {
4730
4653
  2 * l / 2,
4731
4654
  -(2 * l) / 2
4732
4655
  ));
4733
- const c = new N(i, s);
4656
+ const c = new j(i, s);
4734
4657
  await ((m = this.viralViewerApi.viralCamera.cameraControls) == null ? void 0 : m.fitToBox(c, !1));
4735
4658
  const h = new E();
4736
4659
  (f = this.viralViewerApi.viralCamera.cameraControls) == null || f.getPosition(h);
@@ -4744,7 +4667,7 @@ class ys {
4744
4667
  }
4745
4668
  //#endregion
4746
4669
  }
4747
- class xs {
4670
+ class ys {
4748
4671
  pakoUnzip(e) {
4749
4672
  const t = new Uint8Array(e);
4750
4673
  return Pi(t);
@@ -4754,17 +4677,17 @@ class xs {
4754
4677
  return t.push(e, !0), t.result;
4755
4678
  }
4756
4679
  }
4757
- class ne {
4680
+ class ie {
4758
4681
  constructor(e, t, i) {
4759
4682
  this.x = 0, this.y = 0, this.z = 0, this.x = e, this.y = t, this.z = i;
4760
4683
  }
4761
4684
  }
4762
- class P {
4685
+ class O {
4763
4686
  static doesEdgeIncludePlane(e, t, i, s, n, r = 1e-7) {
4764
- const o = P.subtract(s, i), a = P.subtract(n, i), l = P.crossProduct(o, a), c = -P.dotProduct(l, i), h = P.dotProduct(l, e) + c, d = P.dotProduct(l, t) + c;
4687
+ const o = O.subtract(s, i), a = O.subtract(n, i), l = O.crossProduct(o, a), c = -O.dotProduct(l, i), h = O.dotProduct(l, e) + c, d = O.dotProduct(l, t) + c;
4765
4688
  if (Math.abs(h) > r || Math.abs(d) > r)
4766
4689
  return !1;
4767
- const u = P.isPointInTriangle(e, i, s, n, r), p = P.isPointInTriangle(t, i, s, n, r);
4690
+ const u = O.isPointInTriangle(e, i, s, n, r), p = O.isPointInTriangle(t, i, s, n, r);
4768
4691
  return !(!u || !p);
4769
4692
  }
4770
4693
  /**
@@ -4777,14 +4700,14 @@ class P {
4777
4700
  * @returns boolean - Whether the edge intersects the triangle
4778
4701
  */
4779
4702
  static doesEdgeIntersectTriangle(e, t, i, s, n, r = 5) {
4780
- const o = P.subtract(s, i), a = P.subtract(n, i), l = P.crossProduct(o, a), c = -P.dotProduct(l, i), h = P.subtract(t, e), d = P.dotProduct(l, h);
4703
+ const o = O.subtract(s, i), a = O.subtract(n, i), l = O.crossProduct(o, a), c = -O.dotProduct(l, i), h = O.subtract(t, e), d = O.dotProduct(l, h);
4781
4704
  if (Math.abs(d) < 1e-7)
4782
4705
  return !1;
4783
- const u = -(P.dotProduct(l, e) + c) / d;
4706
+ const u = -(O.dotProduct(l, e) + c) / d;
4784
4707
  if (u < -r || u > 1 + r)
4785
4708
  return !1;
4786
- const p = P.add(e, P.scale(h, u)), m = P.distance(p, e), f = P.distance(p, t);
4787
- return m < r || f < r ? !1 : P.isPointInTriangle(p, i, s, n, r);
4709
+ const p = O.add(e, O.scale(h, u)), m = O.distance(p, e), f = O.distance(p, t);
4710
+ return m < r || f < r ? !1 : O.isPointInTriangle(p, i, s, n, r);
4788
4711
  }
4789
4712
  /**
4790
4713
  * Check if a point lies inside a triangle using barycentric coordinates
@@ -4795,7 +4718,7 @@ class P {
4795
4718
  * @returns boolean - Whether the point lies inside the triangle
4796
4719
  */
4797
4720
  static isPointInTriangle(e, t, i, s, n = 1e-7) {
4798
- const r = P.subtract(i, t), o = P.subtract(s, i), a = P.subtract(t, s), l = P.subtract(e, t), c = P.subtract(e, i), h = P.subtract(e, s), d = P.crossProduct(r, l), u = P.crossProduct(o, c), p = P.crossProduct(a, h), m = P.normalize(d), f = P.normalize(u), v = P.normalize(p), b = P.dotProduct(m, f), w = P.dotProduct(f, v);
4721
+ const r = O.subtract(i, t), o = O.subtract(s, i), a = O.subtract(t, s), l = O.subtract(e, t), c = O.subtract(e, i), h = O.subtract(e, s), d = O.crossProduct(r, l), u = O.crossProduct(o, c), p = O.crossProduct(a, h), m = O.normalize(d), f = O.normalize(u), v = O.normalize(p), b = O.dotProduct(m, f), w = O.dotProduct(f, v);
4799
4722
  return b > 1 - n && w > 1 - n;
4800
4723
  }
4801
4724
  // Vector math helper functions
@@ -4822,22 +4745,22 @@ class P {
4822
4745
  const t = Math.sqrt(
4823
4746
  e.x * e.x + e.y * e.y + e.z * e.z
4824
4747
  );
4825
- return t < 1e-7 ? new ne(0, 0, 0) : new ne(e.x / t, e.y / t, e.z / t);
4748
+ return t < 1e-7 ? new ie(0, 0, 0) : new ie(e.x / t, e.y / t, e.z / t);
4826
4749
  }
4827
4750
  static distance(e, t) {
4828
4751
  return Math.sqrt((e.x - t.x) ** 2 + (e.y - t.y) ** 2 + (e.z - t.z) ** 2);
4829
4752
  }
4830
4753
  static doTrianglesIntersect(e, t, i, s, n, r, o = 1e-3) {
4831
- return !!(P.doesEdgeIntersectTriangle(e, t, s, n, r, o) || P.doesEdgeIntersectTriangle(t, i, s, n, r, o) || P.doesEdgeIntersectTriangle(i, e, s, n, r, o));
4754
+ return !!(O.doesEdgeIntersectTriangle(e, t, s, n, r, o) || O.doesEdgeIntersectTriangle(t, i, s, n, r, o) || O.doesEdgeIntersectTriangle(i, e, s, n, r, o));
4832
4755
  }
4833
4756
  static objectsIntersect(e, t, i = 1e-3) {
4834
4757
  for (let s = 0; s < e.length; s += 9) {
4835
- const n = new ne(e[s], e[s + 1], e[s + 2]), r = new ne(e[s + 3], e[s + 4], e[s + 5]), o = new ne(e[s + 6], e[s + 7], e[s + 8]);
4758
+ const n = new ie(e[s], e[s + 1], e[s + 2]), r = new ie(e[s + 3], e[s + 4], e[s + 5]), o = new ie(e[s + 6], e[s + 7], e[s + 8]);
4836
4759
  for (let a = 0; a < t.length; a += 9) {
4837
- const l = new ne(t[a], t[a + 1], t[a + 2]), c = new ne(t[a + 3], t[a + 4], t[a + 5]), h = new ne(t[a + 6], t[a + 7], t[a + 8]);
4838
- if (P.doesEdgeIncludePlane(n, r, l, c, h, i) && P.doesEdgeIncludePlane(r, o, l, c, h, i))
4760
+ const l = new ie(t[a], t[a + 1], t[a + 2]), c = new ie(t[a + 3], t[a + 4], t[a + 5]), h = new ie(t[a + 6], t[a + 7], t[a + 8]);
4761
+ if (O.doesEdgeIncludePlane(n, r, l, c, h, i) && O.doesEdgeIncludePlane(r, o, l, c, h, i))
4839
4762
  return console.log("belong to face"), !1;
4840
- if (P.doTrianglesIntersect(n, r, o, l, c, h, i))
4763
+ if (O.doTrianglesIntersect(n, r, o, l, c, h, i))
4841
4764
  return !0;
4842
4765
  }
4843
4766
  }
@@ -4848,7 +4771,7 @@ class P {
4848
4771
  return i && s && n;
4849
4772
  }
4850
4773
  }
4851
- function Ms() {
4774
+ function xs() {
4852
4775
  class g {
4853
4776
  constructor(t, i, s) {
4854
4777
  this.X = 0, this.Y = 0, this.Z = 0, this.X = t, this.Y = i, this.Z = s;
@@ -4870,11 +4793,11 @@ function Ms() {
4870
4793
  self.postMessage(i());
4871
4794
  };
4872
4795
  }
4873
- const Es = Ms;
4874
- class Ss {
4796
+ const Ms = xs;
4797
+ class Es {
4875
4798
  constructor() {
4876
- const e = new Blob([`(${Es})()`]), t = URL.createObjectURL(e);
4877
- this.workerPool = new ie(navigator.hardwareConcurrency || 10, t);
4799
+ const e = new Blob([`(${Ms})()`]), t = URL.createObjectURL(e);
4800
+ this.workerPool = new ee(navigator.hardwareConcurrency || 10, t);
4878
4801
  }
4879
4802
  getBoundingBox(e, t = (i) => {
4880
4803
  }) {
@@ -4904,11 +4827,11 @@ function Cs() {
4904
4827
  self.postMessage(i);
4905
4828
  };
4906
4829
  }
4907
- const As = Cs;
4908
- class _s {
4830
+ const Ss = Cs;
4831
+ class As {
4909
4832
  constructor() {
4910
- const e = new Blob([`(${As})()`]), t = URL.createObjectURL(e);
4911
- this.workerPool = new ie(4, t);
4833
+ const e = new Blob([`(${Ss})()`]), t = URL.createObjectURL(e);
4834
+ this.workerPool = new ee(4, t);
4912
4835
  }
4913
4836
  checkIntersect(e, t = (i) => {
4914
4837
  }) {
@@ -4917,7 +4840,7 @@ class _s {
4917
4840
  });
4918
4841
  }
4919
4842
  }
4920
- function Is() {
4843
+ function _s() {
4921
4844
  class g {
4922
4845
  constructor() {
4923
4846
  this.children = /* @__PURE__ */ new Map(), this.keys = /* @__PURE__ */ new Set();
@@ -5009,11 +4932,11 @@ function Is() {
5009
4932
  }
5010
4933
  };
5011
4934
  }
5012
- const Vs = Is;
5013
- class Ts {
4935
+ const Vs = _s;
4936
+ class Is {
5014
4937
  constructor() {
5015
4938
  const e = new Blob([`(${Vs})()`]), t = URL.createObjectURL(e);
5016
- this.workerPool = new ie(2, t);
4939
+ this.workerPool = new ee(2, t);
5017
4940
  }
5018
4941
  buildTreeNode(e, t = (i) => {
5019
4942
  }) {
@@ -5022,7 +4945,7 @@ class Ts {
5022
4945
  });
5023
4946
  }
5024
4947
  }
5025
- function Ps() {
4948
+ function Ts() {
5026
4949
  class g {
5027
4950
  constructor(u, p, m) {
5028
4951
  this.x = 0, this.y = 0, this.z = 0, this.x = u, this.y = p, this.z = m;
@@ -5057,46 +4980,46 @@ function Ps() {
5057
4980
  return Math.sqrt((d.x - u.x) ** 2 + (d.y - u.y) ** 2 + (d.z - u.z) ** 2);
5058
4981
  }
5059
4982
  function a(d, u, p, m, f = 1e-7) {
5060
- const v = e(p, u), b = e(m, p), w = e(u, m), S = e(d, u), A = e(d, p), C = e(d, m), M = n(v, S), _ = n(b, A), I = n(w, C), O = r(M), V = r(_), T = r(I), j = s(O, V), H = s(V, T);
5061
- return j > 1 - f && H > 1 - f;
4983
+ const v = e(p, u), b = e(m, p), w = e(u, m), C = e(d, u), A = e(d, p), S = e(d, m), _ = n(v, C), V = n(b, A), T = n(w, S), M = r(_), I = r(V), D = r(T), B = s(M, I), P = s(I, D);
4984
+ return B > 1 - f && P > 1 - f;
5062
4985
  }
5063
4986
  function l(d, u, p, m, f, v, b = 1e-3) {
5064
4987
  return !!(h(d, u, m, f, v, b) || h(u, p, m, f, v, b) || h(p, d, m, f, v, b));
5065
4988
  }
5066
4989
  function c(d, u, p, m, f, v = 1e-7) {
5067
- const b = e(m, p), w = e(f, p), S = n(b, w), A = -s(S, p), C = s(S, d) + A, M = s(S, u) + A;
5068
- if (Math.abs(C) > v || Math.abs(M) > v)
4990
+ const b = e(m, p), w = e(f, p), C = n(b, w), A = -s(C, p), S = s(C, d) + A, _ = s(C, u) + A;
4991
+ if (Math.abs(S) > v || Math.abs(_) > v)
5069
4992
  return !1;
5070
- const _ = a(d, p, m, f, v), I = a(u, p, m, f, v);
5071
- return !(!_ || !I);
4993
+ const V = a(d, p, m, f, v), T = a(u, p, m, f, v);
4994
+ return !(!V || !T);
5072
4995
  }
5073
4996
  function h(d, u, p, m, f, v = 5) {
5074
- const b = e(m, p), w = e(f, p), S = n(b, w), A = -s(S, p), C = e(u, d), M = s(S, C);
5075
- if (Math.abs(M) < 1e-7)
4997
+ const b = e(m, p), w = e(f, p), C = n(b, w), A = -s(C, p), S = e(u, d), _ = s(C, S);
4998
+ if (Math.abs(_) < 1e-7)
5076
4999
  return !1;
5077
- const _ = -(s(S, d) + A) / M;
5078
- if (_ < -v || _ > 1 + v)
5000
+ const V = -(s(C, d) + A) / _;
5001
+ if (V < -v || V > 1 + v)
5079
5002
  return !1;
5080
- const I = t(d, i(C, _)), O = o(I, d), V = o(I, u);
5081
- return O < v || V < v ? !1 : a(I, p, m, f, v);
5003
+ const T = t(d, i(S, V)), M = o(T, d), I = o(T, u);
5004
+ return M < v || I < v ? !1 : a(T, p, m, f, v);
5082
5005
  }
5083
5006
  self.onmessage = (d) => {
5084
5007
  const u = d.data, p = u.buffer1, m = u.buffer2, f = 1e-3;
5085
5008
  for (let v = 0; v < p.length; v += 9) {
5086
- const b = new g(p[v], p[v + 1], p[v + 2]), w = new g(p[v + 3], p[v + 4], p[v + 5]), S = new g(p[v + 6], p[v + 7], p[v + 8]);
5009
+ const b = new g(p[v], p[v + 1], p[v + 2]), w = new g(p[v + 3], p[v + 4], p[v + 5]), C = new g(p[v + 6], p[v + 7], p[v + 8]);
5087
5010
  for (let A = 0; A < m.length; A += 9) {
5088
- const C = new g(m[A], m[A + 1], m[A + 2]), M = new g(m[A + 3], m[A + 4], m[A + 5]), _ = new g(m[A + 6], m[A + 7], m[A + 8]);
5089
- c(b, w, C, M, _, f) && c(w, S, C, M, _, f) && (console.log("belong to face"), self.postMessage(!1)), l(b, w, S, C, M, _, f) && self.postMessage(!0);
5011
+ const S = new g(m[A], m[A + 1], m[A + 2]), _ = new g(m[A + 3], m[A + 4], m[A + 5]), V = new g(m[A + 6], m[A + 7], m[A + 8]);
5012
+ c(b, w, S, _, V, f) && c(w, C, S, _, V, f) && (console.log("belong to face"), self.postMessage(!1)), l(b, w, C, S, _, V, f) && self.postMessage(!0);
5090
5013
  }
5091
5014
  }
5092
5015
  self.postMessage(!1);
5093
5016
  };
5094
5017
  }
5095
- const Os = Ps;
5096
- class Ds {
5018
+ const Ps = Ts;
5019
+ class Os {
5097
5020
  constructor() {
5098
- const e = new Blob([`(${Os})()`]), t = URL.createObjectURL(e);
5099
- this.workerPool = new ie(navigator.hardwareConcurrency || 10, t);
5021
+ const e = new Blob([`(${Ps})()`]), t = URL.createObjectURL(e);
5022
+ this.workerPool = new ee(navigator.hardwareConcurrency || 10, t);
5100
5023
  }
5101
5024
  checkClash(e, t = (i) => {
5102
5025
  }) {
@@ -5105,7 +5028,7 @@ class Ds {
5105
5028
  });
5106
5029
  }
5107
5030
  }
5108
- function Rs() {
5031
+ function Ds() {
5109
5032
  self.addEventListener(
5110
5033
  "message",
5111
5034
  (g) => {
@@ -5139,28 +5062,28 @@ function Rs() {
5139
5062
  !1
5140
5063
  );
5141
5064
  }
5142
- const Ls = Rs;
5143
- class ks {
5065
+ const Rs = Ds;
5066
+ class Ls {
5144
5067
  constructor() {
5145
- const e = new Blob([`(${Ls})()`]), t = URL.createObjectURL(e);
5146
- this.workerPool = new ie(2, t);
5068
+ const e = new Blob([`(${Rs})()`]), t = URL.createObjectURL(e);
5069
+ this.workerPool = new ee(2, t);
5147
5070
  }
5148
5071
  fetch(e, t = (n) => {
5149
5072
  }, i, s) {
5150
- const n = new Bs(e, i, s);
5073
+ const n = new ks(e, i, s);
5151
5074
  this.workerPool.Enqueue(n, (r) => {
5152
5075
  t(r);
5153
5076
  });
5154
5077
  }
5155
5078
  }
5156
- class Bs {
5079
+ class ks {
5157
5080
  constructor(e, t, i) {
5158
5081
  this.url = "", this.url = e, this.byteRangeStart = t, this.byteRangeEnd = i;
5159
5082
  }
5160
5083
  }
5161
- class zs {
5084
+ class Bs {
5162
5085
  constructor(e) {
5163
- this.viralViewerApi = e, this.dataTree = [], this.trackingData = /* @__PURE__ */ new Map(), this.fetchDataWorker = new ks(), this.buildTreeNodeWorker = new Ts(), this._boundingBoxWorker = new Ss(), this._boundingBoxIntersectWorker = new _s(), this._checkClashWorker = new Ds(), this.searchValue = "", this.firstElementId = "211850", this.secondElementId = "680539", this.groupByKeyword = "Category", this._shallowCompare = (t, i) => JSON.stringify(Object.keys(t).sort()) === JSON.stringify(Object.keys(i).sort()) && JSON.stringify(Object.values(t).sort()) === JSON.stringify(Object.values(i).sort());
5086
+ this.viralViewerApi = e, this.dataTree = [], this.trackingData = /* @__PURE__ */ new Map(), this.fetchDataWorker = new Ls(), this.buildTreeNodeWorker = new Is(), this._boundingBoxWorker = new Es(), this._boundingBoxIntersectWorker = new As(), this._checkClashWorker = new Os(), this.searchValue = "", this.firstElementId = "211850", this.secondElementId = "680539", this.groupByKeyword = "Category", this._shallowCompare = (t, i) => JSON.stringify(Object.keys(t).sort()) === JSON.stringify(Object.keys(i).sort()) && JSON.stringify(Object.values(t).sort()) === JSON.stringify(Object.values(i).sort());
5164
5087
  }
5165
5088
  addTrackingData(e, t) {
5166
5089
  this.trackingData.set(e, t);
@@ -5210,8 +5133,8 @@ class zs {
5210
5133
  addData(e) {
5211
5134
  const t = performance.now(), i = Object.keys(e.Data).length;
5212
5135
  console.log(`[DataManager] Adding ${i} elements to data tree...`);
5213
- const s = new as();
5214
- s.addElements(e.Data), e.Relationships && (s.addRelationships(e.Relationships), s.buildGraphIndex()), this.dataTree.push(s), this.viralViewerApi.emit(R.LOADED_DATA, {
5136
+ const s = new rs();
5137
+ s.addElements(e.Data), e.Relationships && (s.addRelationships(e.Relationships), s.buildGraphIndex()), this.dataTree.push(s), this.viralViewerApi.emit(k.LOADED_DATA, {
5215
5138
  modelId: this.dataTree.length - 1
5216
5139
  }), console.log(
5217
5140
  `[DataManager] Data tree created in ${(performance.now() - t).toFixed(2)}ms`
@@ -5288,7 +5211,7 @@ class zs {
5288
5211
  * @returns
5289
5212
  */
5290
5213
  compareModels(e = 0, t = 1) {
5291
- const i = new os();
5214
+ const i = new as();
5292
5215
  if (!this.dataTree[e] || !this.dataTree[t])
5293
5216
  return i;
5294
5217
  const s = this.dataTree[e].elementData, n = this.dataTree[t].elementData, r = this._getDiffKeys(s[0], n[0]);
@@ -5316,46 +5239,46 @@ class zs {
5316
5239
  }
5317
5240
  return this.viralViewerApi.viralVisibilityManager.exceptElements = [], this.viralViewerApi.viralScene.bimWorld.changeColor(
5318
5241
  i.deleted.map((a) => ({ elementId: a.toString(), modelId: e.toString() })),
5319
- D.hexToRGB(y.deleted),
5242
+ R.hexToRGB(y.deleted),
5320
5243
  !0
5321
5244
  ), this.viralViewerApi.viralVisibilityManager.exceptElements.push({
5322
5245
  elements: i.deleted.map((a) => ({ elementId: a.toString(), modelId: e.toString() })),
5323
- color: D.hexToRGB(y.deleted)
5246
+ color: R.hexToRGB(y.deleted)
5324
5247
  }), this.viralViewerApi.viralScene.bimWorld.changeColor(
5325
5248
  i.added.map((a) => ({ elementId: a.toString(), modelId: t.toString() })),
5326
- D.hexToRGB(y.added),
5249
+ R.hexToRGB(y.added),
5327
5250
  !0
5328
5251
  ), this.viralViewerApi.viralVisibilityManager.exceptElements.push({
5329
5252
  elements: i.added.map((a) => ({ elementId: a.toString(), modelId: t.toString() })),
5330
- color: D.hexToRGB(y.added)
5253
+ color: R.hexToRGB(y.added)
5331
5254
  }), this.viralViewerApi.viralScene.bimWorld.changeColor(
5332
5255
  i.modified.map((a) => ({ elementId: a.toString(), modelId: e.toString() })),
5333
- D.hexToRGB(y.modified),
5256
+ R.hexToRGB(y.modified),
5334
5257
  !0
5335
5258
  ), this.viralViewerApi.viralScene.bimWorld.changeColor(
5336
5259
  i.modified.map((a) => ({ elementId: a.toString(), modelId: t.toString() })),
5337
- D.hexToRGB(y.modified),
5260
+ R.hexToRGB(y.modified),
5338
5261
  !0
5339
5262
  ), this.viralViewerApi.viralVisibilityManager.exceptElements.push({
5340
5263
  elements: i.modified.map((a) => ({ elementId: a.toString(), modelId: e.toString() })),
5341
- color: D.hexToRGB(y.modified)
5264
+ color: R.hexToRGB(y.modified)
5342
5265
  }), this.viralViewerApi.viralVisibilityManager.exceptElements.push({
5343
5266
  elements: i.modified.map((a) => ({ elementId: a.toString(), modelId: t.toString() })),
5344
- color: D.hexToRGB(y.modified)
5267
+ color: R.hexToRGB(y.modified)
5345
5268
  }), this.viralViewerApi.viralScene.bimWorld.changeColor(
5346
5269
  i.notChanged.map((a) => ({ elementId: a.toString(), modelId: e.toString() })),
5347
- D.hexToRGB(y.notChanged),
5270
+ R.hexToRGB(y.notChanged),
5348
5271
  !0
5349
5272
  ), this.viralViewerApi.viralScene.bimWorld.changeColor(
5350
5273
  i.notChanged.map((a) => ({ elementId: a.toString(), modelId: t.toString() })),
5351
- D.hexToRGB(y.notChanged),
5274
+ R.hexToRGB(y.notChanged),
5352
5275
  !0
5353
5276
  ), this.viralViewerApi.viralVisibilityManager.exceptElements.push({
5354
5277
  elements: i.notChanged.map((a) => ({ elementId: a.toString(), modelId: e.toString() })),
5355
- color: D.hexToRGB(y.notChanged)
5278
+ color: R.hexToRGB(y.notChanged)
5356
5279
  }), this.viralViewerApi.viralVisibilityManager.exceptElements.push({
5357
5280
  elements: i.notChanged.map((a) => ({ elementId: a.toString(), modelId: t.toString() })),
5358
- color: D.hexToRGB(y.notChanged)
5281
+ color: R.hexToRGB(y.notChanged)
5359
5282
  }), this.viralViewerApi.viralRenderer.render(), i;
5360
5283
  }
5361
5284
  uncompareModels() {
@@ -5384,7 +5307,7 @@ class zs {
5384
5307
  if (i.length > 0 && s.length > 0) {
5385
5308
  const n = i[0], r = s[0];
5386
5309
  console.log(
5387
- P.objectsIntersect(
5310
+ O.objectsIntersect(
5388
5311
  Array.from(n.buffer),
5389
5312
  Array.from(r.buffer)
5390
5313
  )
@@ -5397,7 +5320,7 @@ class zs {
5397
5320
  * @param secondModelIndex
5398
5321
  */
5399
5322
  async checkClashModels(e = 0, t = 0) {
5400
- const i = new ls(), s = this.viralViewerApi.viralScene.bimWorld.getElementsByModel(e), n = e === t ? s : this.viralViewerApi.viralScene.bimWorld.getElementsByModel(t);
5323
+ const i = new os(), s = this.viralViewerApi.viralScene.bimWorld.getElementsByModel(e), n = e === t ? s : this.viralViewerApi.viralScene.bimWorld.getElementsByModel(t);
5401
5324
  if (s.length === 0 || n.length === 0)
5402
5325
  return i;
5403
5326
  const r = (h) => new Promise((d) => {
@@ -5438,30 +5361,30 @@ class zs {
5438
5361
  (w) => f.includes(Number.parseInt(w.elementId))
5439
5362
  ), b = [];
5440
5363
  for (let w = 0; w < v.length; w++) {
5441
- const S = v[w];
5442
- if (d.buffer && S.buffer) {
5443
- const A = () => new Promise((C) => {
5364
+ const C = v[w];
5365
+ if (d.buffer && C.buffer) {
5366
+ const A = () => new Promise((S) => {
5444
5367
  this._checkClashWorker.checkClash(
5445
5368
  {
5446
5369
  buffer1: Array.from(d.buffer),
5447
- buffer2: Array.from(S.buffer)
5370
+ buffer2: Array.from(C.buffer)
5448
5371
  },
5449
- (M) => {
5450
- if (M) {
5372
+ (_) => {
5373
+ if (_) {
5451
5374
  i.clashes.containsKey(
5452
5375
  Number.parseInt(d.elementId)
5453
5376
  ) || i.clashes.add(
5454
5377
  Number.parseInt(d.elementId),
5455
5378
  []
5456
5379
  );
5457
- const _ = i.clashes.get(
5380
+ const V = i.clashes.get(
5458
5381
  Number.parseInt(d.elementId)
5459
5382
  );
5460
- _ == null || _.push(
5461
- Number.parseInt(S.elementId)
5383
+ V == null || V.push(
5384
+ Number.parseInt(C.elementId)
5462
5385
  );
5463
5386
  }
5464
- C();
5387
+ S();
5465
5388
  }
5466
5389
  );
5467
5390
  });
@@ -5488,7 +5411,7 @@ class zs {
5488
5411
  (h) => this._shallowCompare(h.value, l)
5489
5412
  );
5490
5413
  if (c < 0) {
5491
- const h = new cs();
5414
+ const h = new ls();
5492
5415
  h.value = l, h.modelId = s, h.elementIds = [], h.elementIds.push(Number(o)), t.push(h);
5493
5416
  } else
5494
5417
  t[c].elementIds.push(Number(o));
@@ -5515,20 +5438,20 @@ class zs {
5515
5438
  }
5516
5439
  //#endregion
5517
5440
  }
5518
- class Ns {
5441
+ class zs {
5519
5442
  constructor() {
5520
5443
  this.events = {
5521
- [R.LOADED_SCENE]: [],
5522
- [R.LOADED_MATERIAL_MANAGER]: [],
5523
- [R.LOADED_RENDERER]: [],
5524
- [R.LOADED_CAMERA]: [],
5525
- [R.LOADED_CUBE]: [],
5526
- [R.LOADED_TOOLS]: [],
5527
- [R.LOADED_SEPERATE_MODEL]: [],
5528
- [R.GENERATED_MERGE_MODEL]: [],
5529
- [R.LOADED_DATA]: [],
5530
- [R.SELECT_ELEMENTS]: [],
5531
- [R.UNSELECT_ELEMENTS]: []
5444
+ [k.LOADED_SCENE]: [],
5445
+ [k.LOADED_MATERIAL_MANAGER]: [],
5446
+ [k.LOADED_RENDERER]: [],
5447
+ [k.LOADED_CAMERA]: [],
5448
+ [k.LOADED_CUBE]: [],
5449
+ [k.LOADED_TOOLS]: [],
5450
+ [k.LOADED_SEPERATE_MODEL]: [],
5451
+ [k.GENERATED_MERGE_MODEL]: [],
5452
+ [k.LOADED_DATA]: [],
5453
+ [k.SELECT_ELEMENTS]: [],
5454
+ [k.UNSELECT_ELEMENTS]: []
5532
5455
  };
5533
5456
  }
5534
5457
  /**
@@ -5557,7 +5480,7 @@ class Ns {
5557
5480
  i && i.forEach((s) => s(...t));
5558
5481
  }
5559
5482
  }
5560
- class $s {
5483
+ class Ns {
5561
5484
  constructor(e) {
5562
5485
  this.viralViewerApi = e, this.keydownQueuedEvents = [], this.keyupQueuedEvents = [], this.setupKeyPress();
5563
5486
  }
@@ -5605,9 +5528,9 @@ class $s {
5605
5528
  }
5606
5529
  //#endregion
5607
5530
  }
5608
- class js {
5531
+ class $s {
5609
5532
  constructor(e) {
5610
- this.viralViewerApi = e, this.position = new z(), this.rawPosition = new z(), this.mouseMoveQueuedEvents = [], this.mouseDownLeftQueuedEvents = [], this.mouseUpLeftQueuedEvents = [], this.mouseDownRightQueuedEvents = [], this.mouseUpRightQueuedEvents = [], this.mouseDoubleClickQueuedEvents = [], this.handleClick = async (t) => {
5533
+ this.viralViewerApi = e, this.position = new H(), this.rawPosition = new H(), this.mouseMoveQueuedEvents = [], this.mouseDownLeftQueuedEvents = [], this.mouseUpLeftQueuedEvents = [], this.mouseDownRightQueuedEvents = [], this.mouseUpRightQueuedEvents = [], this.mouseDoubleClickQueuedEvents = [], this.handleClick = async (t) => {
5611
5534
  var i, s, n;
5612
5535
  if (this.viralViewerApi) {
5613
5536
  if (t.button === 0) {
@@ -5619,7 +5542,7 @@ class js {
5619
5542
  if (this.viralViewerApi.options.isDev && Q.information("Time to ray cast: " + (performance.now() - r)), o && o.length > 0 && !((i = this.viralViewerApi.viralSectionBox) != null && i.isVisible)) {
5620
5543
  let l = null;
5621
5544
  for (const c of o)
5622
- if (c.object instanceof Y) {
5545
+ if (c.object instanceof Z) {
5623
5546
  const h = c.object.findElementByFaceIndex(
5624
5547
  ((s = c.face) == null ? void 0 : s.a) ?? 0
5625
5548
  );
@@ -5651,7 +5574,7 @@ class js {
5651
5574
  }
5652
5575
  l = c;
5653
5576
  break;
5654
- } else if (c.object instanceof le) {
5577
+ } else if (c.object instanceof oe) {
5655
5578
  l = c;
5656
5579
  break;
5657
5580
  }
@@ -5705,53 +5628,53 @@ class js {
5705
5628
  */
5706
5629
  addEventListener(e, t, i) {
5707
5630
  switch (e) {
5708
- case B.ON_MOUSE_MOVE:
5631
+ case N.ON_MOUSE_MOVE:
5709
5632
  this.mouseMoveQueuedEvents.push([t, i]);
5710
5633
  break;
5711
- case B.ON_MOUSE_DOWN_LEFT:
5634
+ case N.ON_MOUSE_DOWN_LEFT:
5712
5635
  this.mouseDownLeftQueuedEvents.push([t, i]);
5713
5636
  break;
5714
- case B.ON_MOUSE_UP_LEFT:
5637
+ case N.ON_MOUSE_UP_LEFT:
5715
5638
  this.mouseUpLeftQueuedEvents.push([t, i]);
5716
5639
  break;
5717
- case B.ON_MOUSE_DOWN_RIGHT:
5640
+ case N.ON_MOUSE_DOWN_RIGHT:
5718
5641
  this.mouseDownRightQueuedEvents.push([t, i]);
5719
5642
  break;
5720
- case B.ON_MOUSE_UP_RIGHT:
5643
+ case N.ON_MOUSE_UP_RIGHT:
5721
5644
  this.mouseUpRightQueuedEvents.push([t, i]);
5722
5645
  break;
5723
- case B.ON_MOUSE_DOUBLE_CLICK:
5646
+ case N.ON_MOUSE_DOUBLE_CLICK:
5724
5647
  this.mouseDoubleClickQueuedEvents.push([t, i]);
5725
5648
  break;
5726
5649
  }
5727
5650
  }
5728
5651
  removeEventListener(e, t) {
5729
5652
  switch (e) {
5730
- case B.ON_MOUSE_MOVE:
5653
+ case N.ON_MOUSE_MOVE:
5731
5654
  {
5732
5655
  const i = this.mouseMoveQueuedEvents.findIndex((s) => s[0] === t);
5733
5656
  this.mouseMoveQueuedEvents.splice(i, 1);
5734
5657
  }
5735
5658
  break;
5736
- case B.ON_MOUSE_DOWN_LEFT:
5659
+ case N.ON_MOUSE_DOWN_LEFT:
5737
5660
  {
5738
5661
  const i = this.mouseDownLeftQueuedEvents.findIndex((s) => s[0] === t);
5739
5662
  this.mouseDownLeftQueuedEvents.splice(i, 1);
5740
5663
  }
5741
5664
  break;
5742
- case B.ON_MOUSE_UP_LEFT:
5665
+ case N.ON_MOUSE_UP_LEFT:
5743
5666
  {
5744
5667
  const i = this.mouseUpLeftQueuedEvents.findIndex((s) => s[0] === t);
5745
5668
  this.mouseUpLeftQueuedEvents.splice(i, 1);
5746
5669
  }
5747
5670
  break;
5748
- case B.ON_MOUSE_DOWN_RIGHT:
5671
+ case N.ON_MOUSE_DOWN_RIGHT:
5749
5672
  {
5750
5673
  const i = this.mouseDownRightQueuedEvents.findIndex((s) => s[0] === t);
5751
5674
  this.mouseDownRightQueuedEvents.splice(i, 1);
5752
5675
  }
5753
5676
  break;
5754
- case B.ON_MOUSE_UP_RIGHT:
5677
+ case N.ON_MOUSE_UP_RIGHT:
5755
5678
  {
5756
5679
  const i = this.mouseUpRightQueuedEvents.findIndex((s) => s[0] === t);
5757
5680
  this.mouseUpRightQueuedEvents.splice(i, 1);
@@ -5779,14 +5702,14 @@ class js {
5779
5702
  }
5780
5703
  //#endregion
5781
5704
  }
5782
- const He = {
5705
+ const je = {
5783
5706
  showAll: (g, e) => `<svg xmlns="http://www.w3.org/2000/svg" fill=${e || ""} height=${g || 24} viewBox="0 -960 960 960" width="24"><path d="M240-160q-33 0-56.5-23.5T160-240q0-33 23.5-56.5T240-320q33 0 56.5 23.5T320-240q0 33-23.5 56.5T240-160Zm240 0q-33 0-56.5-23.5T400-240q0-33 23.5-56.5T480-320q33 0 56.5 23.5T560-240q0 33-23.5 56.5T480-160Zm240 0q-33 0-56.5-23.5T640-240q0-33 23.5-56.5T720-320q33 0 56.5 23.5T800-240q0 33-23.5 56.5T720-160ZM240-400q-33 0-56.5-23.5T160-480q0-33 23.5-56.5T240-560q33 0 56.5 23.5T320-480q0 33-23.5 56.5T240-400Zm240 0q-33 0-56.5-23.5T400-480q0-33 23.5-56.5T480-560q33 0 56.5 23.5T560-480q0 33-23.5 56.5T480-400Zm240 0q-33 0-56.5-23.5T640-480q0-33 23.5-56.5T720-560q33 0 56.5 23.5T800-480q0 33-23.5 56.5T720-400ZM240-640q-33 0-56.5-23.5T160-720q0-33 23.5-56.5T240-800q33 0 56.5 23.5T320-720q0 33-23.5 56.5T240-640Zm240 0q-33 0-56.5-23.5T400-720q0-33 23.5-56.5T480-800q33 0 56.5 23.5T560-720q0 33-23.5 56.5T480-640Zm240 0q-33 0-56.5-23.5T640-720q0-33 23.5-56.5T720-800q33 0 56.5 23.5T800-720q0 33-23.5 56.5T720-640Z"/></svg>`,
5784
5707
  isolate: (g, e) => `<svg xmlns="http://www.w3.org/2000/svg" fill=${e || ""} height=${g || 24} viewBox="0 -960 960 960" width="24"><path d="M440-760v-80h80v80h-80Zm0 640v-80h80v80h-80ZM280-760v-80h80v80h-80Zm0 640v-80h80v80h-80ZM120-760v-80h80v80h-80Zm0 160v-80h80v80h-80Zm0 160v-80h80v80h-80Zm0 160v-80h80v80h-80Zm0 160v-80h80v80h-80Zm480 0v-80h80v-560h-80v-80h240v80h-80v560h80v80H600Z"/></svg>`,
5785
5708
  hide: (g, e) => `<svg xmlns="http://www.w3.org/2000/svg" fill=${e || ""} height=${g || 24} viewBox="0 -960 960 960" width="24"><path d="M200-120q-33 0-56.5-23.5T120-200h80v80Zm-80-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160q0-33 23.5-56.5T200-840v80h-80Zm160 640v-80h80v80h-80Zm0-640v-80h80v80h-80Zm160 0v-80h80v80h-80Zm60 640-56-56 142-142-142-142 56-56 142 142 142-142 56 56-142 142 142 142-56 56-142-142-142 142Zm100-640v-80h80v80h-80Zm160 160v-80h80v80h-80Zm0-160v-80q33 0 56.5 23.5T840-760h-80Z"/></svg>`,
5786
5709
  focus: (g, e) => `<svg xmlns="http://www.w3.org/2000/svg" fill=${e || ""} height=${g || 24} viewBox="0 -960 960 960" width="24"><path d="M120-120v-200h80v120h120v80H120Zm520 0v-80h120v-120h80v200H640ZM120-640v-200h200v80H200v120h-80Zm640 0v-120H640v-80h200v200h-80Z"/></svg>`,
5787
5710
  properties: (g, e) => `<svg xmlns="http://www.w3.org/2000/svg" fill=${e || ""} height=${g || 24} viewBox="0 -960 960 960" width="24"><path d="M440-280h80v-240h-80v240Zm40-320q17 0 28.5-11.5T520-640q0-17-11.5-28.5T480-680q-17 0-28.5 11.5T440-640q0 17 11.5 28.5T480-600Zm0 520q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Zm0-320Z"/></svg>`
5788
5711
  };
5789
- class Hs {
5712
+ class js {
5790
5713
  constructor(e) {
5791
5714
  this.viralViewerApi = e, this.elementProperties = {}, this._sleepDebounceTimer = null, this._sleepDebounceDelay = 150, this.resizeObserver = null, this.isShiftPressed = !1, this.windowHandler(), this.contextMenuEventHandler(), this.selectElementHandler2(), this.doubleClickElementHandler(), this.keyboardHandler(), this.cameraHandler(), this._visibilityManager = this.viralViewerApi.viralVisibilityManager;
5792
5715
  }
@@ -5794,40 +5717,40 @@ class Hs {
5794
5717
  this.viralViewerApi.viralContextMenu && (this.viralViewerApi.viralContextMenu.addContextItem(
5795
5718
  0,
5796
5719
  "Show all elements",
5797
- He.showAll(void 0, y.primary),
5720
+ je.showAll(void 0, y.primary),
5798
5721
  (e) => {
5799
5722
  this._visibilityManager.showAll2(), this.viralViewerApi.viralContextMenu.hideContextMenu();
5800
5723
  }
5801
5724
  ), this.viralViewerApi.viralContextMenu.addContextItem(
5802
5725
  1,
5803
5726
  "Isolate",
5804
- He.isolate(void 0, y.primary),
5727
+ je.isolate(void 0, y.primary),
5805
5728
  (e) => {
5806
5729
  this._visibilityManager.isolate2(), this.viralViewerApi.viralContextMenu.hideContextMenu();
5807
5730
  }
5808
5731
  ), this.viralViewerApi.viralContextMenu.addContextItem(
5809
5732
  2,
5810
5733
  "Hide",
5811
- He.hide(void 0, y.primary),
5734
+ je.hide(void 0, y.primary),
5812
5735
  (e) => {
5813
5736
  this._visibilityManager.hide2(), this.viralViewerApi.viralContextMenu.hideContextMenu();
5814
5737
  }
5815
5738
  ), this.viralViewerApi.viralContextMenu.addContextItem(
5816
5739
  3,
5817
5740
  "Focus",
5818
- He.focus(void 0, y.primary),
5741
+ je.focus(void 0, y.primary),
5819
5742
  (e) => {
5820
5743
  this._visibilityManager.zoomTo(), this.viralViewerApi.viralContextMenu.hideContextMenu();
5821
5744
  }
5822
5745
  ), this.viralViewerApi.viralContextMenu.addContextItem(
5823
5746
  4,
5824
5747
  "Properties",
5825
- He.properties(void 0, y.secondary),
5748
+ je.properties(void 0, y.secondary),
5826
5749
  (e) => {
5827
5750
  this.viralViewerApi.viralDraggableModal.show(), this.viralViewerApi.viralContextMenu.hideContextMenu();
5828
5751
  }
5829
5752
  )), this.viralViewerApi.viralMouse && (this.viralViewerApi.viralMouse.addEventListener(
5830
- B.ON_MOUSE_DOWN_RIGHT,
5753
+ N.ON_MOUSE_DOWN_RIGHT,
5831
5754
  "ShowContextMenu",
5832
5755
  (e) => {
5833
5756
  this.viralViewerApi.viralContextMenu.showContextMenu(
@@ -5837,7 +5760,7 @@ class Hs {
5837
5760
  );
5838
5761
  }
5839
5762
  ), this.viralViewerApi.viralMouse.addEventListener(
5840
- B.ON_MOUSE_DOWN_LEFT,
5763
+ N.ON_MOUSE_DOWN_LEFT,
5841
5764
  "HideContextMenu",
5842
5765
  (e) => {
5843
5766
  this.viralViewerApi.viralContextMenu.hideContextMenu();
@@ -5847,13 +5770,13 @@ class Hs {
5847
5770
  // ms to wait before confirming camera is steady
5848
5771
  cameraHandler() {
5849
5772
  this.viralViewerApi.viralCamera && (this.viralViewerApi.viralCamera.addEventListener(
5850
- K.ON_WAKE,
5773
+ X.ON_WAKE,
5851
5774
  "hide objects",
5852
5775
  () => {
5853
5776
  this._sleepDebounceTimer && (clearTimeout(this._sleepDebounceTimer), this._sleepDebounceTimer = null), this.viralViewerApi.viralVisibilityManager.bypassScreenSpaceEdge(), this.viralViewerApi.viralVisibilityManager.bypassSelectionOutline(), this.viralViewerApi.viralVisibilityManager.disableAmbientOcclusion(), this.viralViewerApi.viralVisibilityManager.disableSampling();
5854
5777
  }
5855
5778
  ), this.viralViewerApi.viralCamera.addEventListener(
5856
- K.ON_SLEEP,
5779
+ X.ON_SLEEP,
5857
5780
  "unhide objects",
5858
5781
  () => {
5859
5782
  this._sleepDebounceTimer && clearTimeout(this._sleepDebounceTimer), this._sleepDebounceTimer = setTimeout(() => {
@@ -5879,13 +5802,13 @@ class Hs {
5879
5802
  let e = null;
5880
5803
  const t = 250;
5881
5804
  this.viralViewerApi.viralMouse.addEventListener(
5882
- B.ON_MOUSE_DOWN_LEFT,
5805
+ N.ON_MOUSE_DOWN_LEFT,
5883
5806
  "SelectElement",
5884
5807
  (i) => {
5885
5808
  e = performance.now();
5886
5809
  }
5887
5810
  ), this.viralViewerApi.viralMouse.addEventListener(
5888
- B.ON_MOUSE_UP_LEFT,
5811
+ N.ON_MOUSE_UP_LEFT,
5889
5812
  "SelectElementUp",
5890
5813
  (i) => {
5891
5814
  var s, n;
@@ -5908,7 +5831,7 @@ class Hs {
5908
5831
  if (c)
5909
5832
  break;
5910
5833
  const d = h;
5911
- if (d.object instanceof Y && d.face) {
5834
+ if (d.object instanceof Z && d.face) {
5912
5835
  const u = d.object.findElementByFaceIndex(
5913
5836
  d.face.a
5914
5837
  );
@@ -5973,14 +5896,14 @@ class Hs {
5973
5896
  //#region Double Click element handler
5974
5897
  doubleClickElementHandler() {
5975
5898
  this.viralViewerApi.viralMouse.addEventListener(
5976
- B.ON_MOUSE_DOUBLE_CLICK,
5899
+ N.ON_MOUSE_DOUBLE_CLICK,
5977
5900
  "DoubleClickElement",
5978
5901
  (e) => {
5979
5902
  const t = this.viralViewerApi.viralCamera.clientToWorld();
5980
5903
  if (t && (t == null ? void 0 : t.length) > 0)
5981
5904
  for (const s of t) {
5982
5905
  const n = s;
5983
- if (n.object instanceof Y && n.face) {
5906
+ if (n.object instanceof Z && n.face) {
5984
5907
  const r = n.object.findElementByFaceIndex(
5985
5908
  n.face.a
5986
5909
  );
@@ -6032,40 +5955,40 @@ class Hs {
6032
5955
  }
6033
5956
  //#endregion
6034
5957
  }
6035
- class Fs {
5958
+ class Hs {
6036
5959
  constructor(e, t) {
6037
- this.viralViewerApi = e, this.options = t, this.viralViewerApi.on(R.LOADED_SCENE, () => this.loadedScene()), this.viralViewerApi.on(
6038
- R.LOADED_MATERIAL_MANAGER,
5960
+ this.viralViewerApi = e, this.options = t, this.viralViewerApi.on(k.LOADED_SCENE, () => this.loadedScene()), this.viralViewerApi.on(
5961
+ k.LOADED_MATERIAL_MANAGER,
6039
5962
  () => this.loadedMaterialManager()
6040
- ), this.viralViewerApi.on(R.LOADED_RENDERER, () => this.loadedRenderer()), this.viralViewerApi.on(R.LOADED_CAMERA, () => this.loadedCamera()), this.viralViewerApi.on(R.LOADED_CUBE, () => this.loadedCube()), this.viralViewerApi.on(R.LOADED_TOOLS, () => this.loadedTools()), this.viralViewerApi.on(
6041
- R.LOADED_SEPERATE_MODEL,
5963
+ ), this.viralViewerApi.on(k.LOADED_RENDERER, () => this.loadedRenderer()), this.viralViewerApi.on(k.LOADED_CAMERA, () => this.loadedCamera()), this.viralViewerApi.on(k.LOADED_CUBE, () => this.loadedCube()), this.viralViewerApi.on(k.LOADED_TOOLS, () => this.loadedTools()), this.viralViewerApi.on(
5964
+ k.LOADED_SEPERATE_MODEL,
6042
5965
  (i) => this.loadedModels(i)
6043
5966
  );
6044
5967
  }
6045
5968
  loadedScene() {
6046
- this.options.isDev && Q.information("scene loaded!"), this.viralViewerApi.off(R.LOADED_SCENE, () => this.loadedScene());
5969
+ this.options.isDev && Q.information("scene loaded!"), this.viralViewerApi.off(k.LOADED_SCENE, () => this.loadedScene());
6047
5970
  }
6048
5971
  loadedMaterialManager() {
6049
5972
  this.options.isDev && Q.information("material manager loaded!"), this.viralViewerApi.off(
6050
- R.LOADED_MATERIAL_MANAGER,
5973
+ k.LOADED_MATERIAL_MANAGER,
6051
5974
  () => this.loadedMaterialManager()
6052
5975
  );
6053
5976
  }
6054
5977
  loadedRenderer() {
6055
- this.options.isDev && Q.information("renderer loaded!"), this.viralViewerApi.off(R.LOADED_RENDERER, () => this.loadedRenderer());
5978
+ this.options.isDev && Q.information("renderer loaded!"), this.viralViewerApi.off(k.LOADED_RENDERER, () => this.loadedRenderer());
6056
5979
  }
6057
5980
  loadedCamera() {
6058
5981
  this.options.isDev && Q.information("camera loaded!");
6059
5982
  }
6060
5983
  loadedCube() {
6061
- this.options.isDev && Q.information("cube loaded!"), this.viralViewerApi.off(R.LOADED_CUBE, () => this.loadedCube());
5984
+ this.options.isDev && Q.information("cube loaded!"), this.viralViewerApi.off(k.LOADED_CUBE, () => this.loadedCube());
6062
5985
  }
6063
5986
  loadedTools() {
6064
- this.options.isDev && Q.information("tools loaded!"), this.viralViewerApi.off(R.LOADED_TOOLS, () => this.loadedTools());
5987
+ this.options.isDev && Q.information("tools loaded!"), this.viralViewerApi.off(k.LOADED_TOOLS, () => this.loadedTools());
6065
5988
  }
6066
5989
  async loadedModels(e) {
6067
5990
  this.options.isDev && Q.information(`model ${e.modelId} loaded!`), this.viralViewerApi.viralScene.selectables = [], this.viralViewerApi.viralScene.selectables = [], this.viralViewerApi.viralScene.bimWorld.children.forEach((t) => {
6068
- if (t instanceof Y) {
5991
+ if (t instanceof Z) {
6069
5992
  this.viralViewerApi.viralScene.selectables.push(t);
6070
5993
  return;
6071
5994
  }
@@ -6075,7 +5998,7 @@ class Fs {
6075
5998
  });
6076
5999
  }
6077
6000
  }
6078
- class Ws {
6001
+ class Fs {
6079
6002
  constructor(e) {
6080
6003
  this.viralViewerApi = e, this.potree = new Di(), this.pointClouds = [];
6081
6004
  }
@@ -6099,7 +6022,7 @@ class Ws {
6099
6022
  });
6100
6023
  }
6101
6024
  }
6102
- class Gs {
6025
+ class Ws {
6103
6026
  static getDeviceType() {
6104
6027
  const e = navigator.userAgent.toLowerCase(), t = /iphone|ipod|android.*mobile|blackberry|opera mini|windows phone/i.test(
6105
6028
  e
@@ -6107,7 +6030,7 @@ class Gs {
6107
6030
  return t ? "mobile" : i ? "tablet" : "pc";
6108
6031
  }
6109
6032
  }
6110
- class Us {
6033
+ class Gs {
6111
6034
  constructor() {
6112
6035
  this.gl = null, this.specs = null, this.initWebGL(), this.detectSpecs();
6113
6036
  }
@@ -6251,16 +6174,16 @@ class Us {
6251
6174
  });
6252
6175
  }
6253
6176
  }
6254
- class qs {
6177
+ class Us {
6255
6178
  constructor() {
6256
- this.modelId = -1, this.elements = [], this.materials = [], this.mapMaterialsToMaterialManager = new It();
6179
+ this.modelId = -1, this.elements = [], this.materials = [], this.mapMaterialsToMaterialManager = new _t();
6257
6180
  }
6258
6181
  //#endregion
6259
6182
  dispose() {
6260
- this.elements = [], this.materials = [], this.mapMaterialsToMaterialManager = new It();
6183
+ this.elements = [], this.materials = [], this.mapMaterialsToMaterialManager = new _t();
6261
6184
  }
6262
6185
  }
6263
- class Qs {
6186
+ class qs {
6264
6187
  constructor() {
6265
6188
  this.MIN_VERTEX_INSTANCES_FOR_INSTANCING = 1e3, this.MIN_INSTANCES_FOR_INSTANCING = 3, this.MAX_DRAW_CALLS = 25, this.MIN_INSTANCED_VERTEX_RATIO = 0.6, this.HIGH_VERTEX_THRESHOLD = 500;
6266
6189
  }
@@ -6409,8 +6332,8 @@ class Qs {
6409
6332
  }
6410
6333
  }
6411
6334
  }
6412
- const Zs = new Qs();
6413
- function Ys() {
6335
+ const Qs = new qs();
6336
+ function Zs() {
6414
6337
  class g {
6415
6338
  constructor() {
6416
6339
  this.elements = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
@@ -6457,8 +6380,8 @@ function Ys() {
6457
6380
  ]);
6458
6381
  const u = d.elements;
6459
6382
  for (let p = 0; p < o; p++) {
6460
- const m = s[i[p]], f = -m.X, v = m.Z, b = m.Y, w = 1 / (u[3] * f + u[7] * v + u[11] * b + u[15]), S = p * 3;
6461
- a[S] = (u[0] * f + u[4] * v + u[8] * b + u[12]) * w, a[S + 1] = (u[1] * f + u[5] * v + u[9] * b + u[13]) * w, a[S + 2] = (u[2] * f + u[6] * v + u[10] * b + u[14]) * w;
6383
+ const m = s[i[p]], f = -m.X, v = m.Z, b = m.Y, w = 1 / (u[3] * f + u[7] * v + u[11] * b + u[15]), C = p * 3;
6384
+ a[C] = (u[0] * f + u[4] * v + u[8] * b + u[12]) * w, a[C + 1] = (u[1] * f + u[5] * v + u[9] * b + u[13]) * w, a[C + 2] = (u[2] * f + u[6] * v + u[10] * b + u[14]) * w;
6462
6385
  }
6463
6386
  return a;
6464
6387
  }
@@ -6495,8 +6418,8 @@ function Ys() {
6495
6418
  }), self.postMessage(r);
6496
6419
  };
6497
6420
  }
6498
- const Xs = Ys;
6499
- function Ks() {
6421
+ const Ys = Zs;
6422
+ function Xs() {
6500
6423
  class g {
6501
6424
  constructor() {
6502
6425
  this.elements = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
@@ -6543,8 +6466,8 @@ function Ks() {
6543
6466
  ]);
6544
6467
  const u = d.elements;
6545
6468
  for (let p = 0; p < o; p++) {
6546
- const m = s[i[p]], f = -m.X, v = m.Z, b = m.Y, w = 1 / (u[3] * f + u[7] * v + u[11] * b + u[15]), S = p * 3;
6547
- a[S] = (u[0] * f + u[4] * v + u[8] * b + u[12]) * w, a[S + 1] = (u[1] * f + u[5] * v + u[9] * b + u[13]) * w, a[S + 2] = (u[2] * f + u[6] * v + u[10] * b + u[14]) * w;
6469
+ const m = s[i[p]], f = -m.X, v = m.Z, b = m.Y, w = 1 / (u[3] * f + u[7] * v + u[11] * b + u[15]), C = p * 3;
6470
+ a[C] = (u[0] * f + u[4] * v + u[8] * b + u[12]) * w, a[C + 1] = (u[1] * f + u[5] * v + u[9] * b + u[13]) * w, a[C + 2] = (u[2] * f + u[6] * v + u[10] * b + u[14]) * w;
6548
6471
  }
6549
6472
  return a;
6550
6473
  }
@@ -6586,19 +6509,19 @@ function Ks() {
6586
6509
  }), self.postMessage(r);
6587
6510
  };
6588
6511
  }
6589
- const Js = Ks;
6590
- class en {
6512
+ const Ks = Xs;
6513
+ class Js {
6591
6514
  // Or 5K objects
6592
6515
  //#endregion
6593
6516
  constructor(e) {
6594
6517
  this.viralViewerApi = e, this.lastRenderTime = 0, this.elementBuffer = /* @__PURE__ */ new Map(), this.BATCH_THRESHOLD_VERTICES = 1e5, this.BATCH_THRESHOLD_OBJECTS = 5e3;
6595
- const t = new Blob([`(${Xs})()`]), i = URL.createObjectURL(t);
6596
- this.workerPool = new ie(
6518
+ const t = new Blob([`(${Ys})()`]), i = URL.createObjectURL(t);
6519
+ this.workerPool = new ee(
6597
6520
  navigator.hardwareConcurrency || this.viralViewerApi.options.numberOfWorker,
6598
6521
  i
6599
6522
  );
6600
- const s = new Blob([`(${Js})()`]), n = URL.createObjectURL(s);
6601
- this.workerPool2 = new ie(
6523
+ const s = new Blob([`(${Ks})()`]), n = URL.createObjectURL(s);
6524
+ this.workerPool2 = new ee(
6602
6525
  this.viralViewerApi.options.numberOfWorker,
6603
6526
  n
6604
6527
  );
@@ -6610,11 +6533,11 @@ class en {
6610
6533
  */
6611
6534
  initial(e) {
6612
6535
  console.log(e);
6613
- const t = new qs();
6536
+ const t = new Us();
6614
6537
  t.modelId = this.viralViewerApi.viralScene.bimWorld.bimModels.length, this.viralViewerApi.viralScene.bimWorld.bimModels.push(t);
6615
6538
  const i = this.viralViewerApi.viralScene.bimWorld.bimModels.length - 1;
6616
6539
  for (let s = 0; s < e.length; s++) {
6617
- const n = e[s], r = D.rgbToThreejsColor(
6540
+ const n = e[s], r = R.rgbToThreejsColor(
6618
6541
  n.Red,
6619
6542
  n.Green,
6620
6543
  n.Blue
@@ -6622,7 +6545,7 @@ class en {
6622
6545
  (a) => a.userData.red === n.Red && a.userData.green === n.Green && a.userData.blue === n.Blue && a.userData.opacity === n.Opacity
6623
6546
  );
6624
6547
  if (o < 0) {
6625
- const a = new ft({
6548
+ const a = new gt({
6626
6549
  color: r,
6627
6550
  opacity: n.Opacity,
6628
6551
  transparent: n.Opacity !== 1,
@@ -6649,7 +6572,7 @@ class en {
6649
6572
  */
6650
6573
  loadElement(e, t, i = () => {
6651
6574
  }, s = null) {
6652
- const { highDuplicationElements: n, lowDuplicationElements: r } = Zs.analyze(t), o = r.map((p) => p.element), a = n.map((p) => p.element), l = o.length > 0, c = a.length > 0;
6575
+ const { highDuplicationElements: n, lowDuplicationElements: r } = Qs.analyze(t), o = r.map((p) => p.element), a = n.map((p) => p.element), l = o.length > 0, c = a.length > 0;
6653
6576
  if (!l && !c) {
6654
6577
  i();
6655
6578
  return;
@@ -6739,7 +6662,7 @@ class en {
6739
6662
  createSingleMergedMesh(e, t, i) {
6740
6663
  const s = this.createOptimizedMaterial(t);
6741
6664
  this.viralViewerApi.viralMaterialManager.mergeMaterials.push(s);
6742
- const n = new Y(
6665
+ const n = new Z(
6743
6666
  void 0,
6744
6667
  s,
6745
6668
  this.viralViewerApi.viralScene.bimWorld.workerPool
@@ -6757,14 +6680,14 @@ class en {
6757
6680
  * Uses onBeforeCompile to inject custom shader code for RGBA vertex colors
6758
6681
  */
6759
6682
  createOptimizedMaterial(e) {
6760
- const t = Gs.getDeviceType() === "pc", i = (r, o = 2) => {
6683
+ const t = Ws.getDeviceType() === "pc", i = (r, o = 2) => {
6761
6684
  if (!r)
6762
6685
  return 16777215;
6763
6686
  const a = r.clone();
6764
6687
  return a.multiplyScalar(o), a;
6765
- }, s = e.transparent || e.opacity < 1, n = t ? new J({
6688
+ }, s = e.transparent || e.opacity < 1, n = t ? new K({
6766
6689
  vertexColors: !0,
6767
- side: te,
6690
+ side: J,
6768
6691
  // 🔧 FIX: Changed from DoubleSide to halve draw calls
6769
6692
  opacity: e.opacity,
6770
6693
  transparent: !0,
@@ -6782,7 +6705,7 @@ class en {
6782
6705
  isOriginallyTransparent: s
6783
6706
  // Track original state
6784
6707
  }
6785
- }) : new G({
6708
+ }) : new q({
6786
6709
  vertexColors: !0,
6787
6710
  opacity: e.opacity,
6788
6711
  transparent: !0,
@@ -6928,9 +6851,9 @@ class en {
6928
6851
  }
6929
6852
  //#endregion
6930
6853
  }
6931
- class tn {
6854
+ class en {
6932
6855
  constructor(e) {
6933
- this.viralViewerApi = e, this.elements = [], this._loadBatchedElementWorker = new en(e);
6856
+ this.viralViewerApi = e, this.elements = [], this._loadBatchedElementWorker = new Js(e);
6934
6857
  }
6935
6858
  //#region Load worker
6936
6859
  async load(e, t, i, s = () => {
@@ -6982,7 +6905,7 @@ class tn {
6982
6905
  p,
6983
6906
  () => {
6984
6907
  u += 1, u === d && (this._loadBatchedElementWorker.flushAllBuffers(), this.viralViewerApi.emit(
6985
- R.LOADED_SEPERATE_MODEL,
6908
+ k.LOADED_SEPERATE_MODEL,
6986
6909
  { modelId: c }
6987
6910
  ), this.viralViewerApi.viralVisibilityManager.enableShadow(), this.viralViewerApi.viralVisibilityManager.enableAmbientOcclusion(), this.viralViewerApi.viralVisibilityManager.enableAmbientOcclusionScreenSpaceRadius(), this.viralViewerApi.viralVisibilityManager.enableScreenSpaceEdge(
6988
6911
  "shaded"
@@ -6990,7 +6913,7 @@ class tn {
6990
6913
  },
6991
6914
  h
6992
6915
  ) : (u += 1, u === d && (this._loadBatchedElementWorker.flushAllBuffers(), this.viralViewerApi.emit(
6993
- R.LOADED_SEPERATE_MODEL,
6916
+ k.LOADED_SEPERATE_MODEL,
6994
6917
  { modelId: c }
6995
6918
  ), this.viralViewerApi.viralVisibilityManager.enableShadow(), this.viralViewerApi.viralVisibilityManager.enableAmbientOcclusion(), this.viralViewerApi.viralVisibilityManager.enableAmbientOcclusionScreenSpaceRadius(), this.viralViewerApi.viralVisibilityManager.enableScreenSpaceEdge(
6996
6919
  "shaded"
@@ -7074,7 +6997,7 @@ class tn {
7074
6997
  }), this.viralViewerApi.viralMaterialManager.mergeMaterials = [], this.viralViewerApi.viralVisibilityManager.disableGroundShadow(), this.viralViewerApi.viralRenderer.render(), this.viralViewerApi.viralDataManager.dataTree = [], this.viralViewerApi.viralScene.selectables = [];
7075
6998
  }
7076
6999
  }
7077
- class sn {
7000
+ class tn {
7078
7001
  constructor(e) {
7079
7002
  this.viralViewerApi = e, this.objectLoader = new ci(), this.gltfLoader = new Bi();
7080
7003
  }
@@ -7088,37 +7011,37 @@ class sn {
7088
7011
  this.gltfLoader.load(e, t, i, s);
7089
7012
  }
7090
7013
  }
7091
- class nn {
7014
+ class sn {
7092
7015
  constructor(e) {
7093
- this.viralViewerApi = e, this.revitLoader = new tn(this.viralViewerApi), this.pointCloudLoader = new Ws(this.viralViewerApi), this.threeLoader = new sn(this.viralViewerApi);
7016
+ this.viralViewerApi = e, this.revitLoader = new en(this.viralViewerApi), this.pointCloudLoader = new Fs(this.viralViewerApi), this.threeLoader = new tn(this.viralViewerApi);
7094
7017
  }
7095
7018
  }
7096
- class rn {
7019
+ class nn {
7097
7020
  constructor(e) {
7098
- this.viralViewerApi = e, this.hoverMaterial = new ft({
7099
- color: D.hexToThreejsColor(y.secondary),
7021
+ this.viralViewerApi = e, this.hoverMaterial = new gt({
7022
+ color: R.hexToThreejsColor(y.secondary),
7100
7023
  opacity: 0.7,
7101
7024
  transparent: !0,
7102
7025
  depthTest: !1,
7103
7026
  name: "Render Material",
7104
7027
  flatShading: !0
7105
- }), this.selectedMaterial = new ft({
7106
- color: D.hexToThreejsColor(y.secondary),
7028
+ }), this.selectedMaterial = new gt({
7029
+ color: R.hexToThreejsColor(y.secondary),
7107
7030
  opacity: 0.7,
7108
7031
  transparent: !0,
7109
7032
  name: "Render Material",
7110
7033
  depthTest: !1,
7111
7034
  flatShading: !0
7112
- }), this.edgeMaterial = new Xt({
7113
- color: D.hexToThreejsColor(y.edge),
7035
+ }), this.edgeMaterial = new Zt({
7036
+ color: R.hexToThreejsColor(y.edge),
7114
7037
  linewidth: 2,
7115
- resolution: new z(window.innerWidth, window.innerHeight),
7038
+ resolution: new H(window.innerWidth, window.innerHeight),
7116
7039
  transparent: !0,
7117
7040
  opacity: 0.8
7118
- }), this.outlineMaterial = new J({
7041
+ }), this.outlineMaterial = new K({
7119
7042
  transparent: !0,
7120
7043
  opacity: 0
7121
- }), this.materials = [], this.mergeMaterials = [], this.originalColors = [], this.viralViewerApi.emit(R.LOADED_MATERIAL_MANAGER);
7044
+ }), this.materials = [], this.mergeMaterials = [], this.originalColors = [], this.viralViewerApi.emit(k.LOADED_MATERIAL_MANAGER);
7122
7045
  }
7123
7046
  /**
7124
7047
  * Checks if a material has a color property.
@@ -7140,141 +7063,13 @@ class rn {
7140
7063
  resetToOriginal() {
7141
7064
  for (let e = 0; e < this.materials.length; e++) {
7142
7065
  const t = this.materials[e];
7143
- t instanceof ft && t.color.set(this.originalColors[e]);
7066
+ t instanceof gt && t.color.set(this.originalColors[e]);
7144
7067
  }
7145
7068
  }
7146
7069
  }
7147
- const an = {
7148
- outlineColor: new k(y.accent),
7149
- outlineOpacity: 1,
7150
- outlineThickness: 2,
7151
- selectionAlpha: 0.99,
7152
- alphaTolerance: 5e-3
7153
- }, $t = `
7154
- varying vec2 vUv;
7155
- void main() {
7156
- vUv = uv;
7157
- gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
7158
- }
7159
- `, on = `
7160
- precision highp float;
7161
-
7162
- uniform sampler2D tDiffuse;
7163
-
7164
- uniform vec2 resolution;
7165
- uniform vec3 outlineColor;
7166
- uniform float outlineOpacity;
7167
- uniform float outlineThickness;
7168
- uniform float selectionAlpha;
7169
- uniform float alphaTolerance;
7170
-
7171
- varying vec2 vUv;
7172
-
7173
- // Check if pixel is selected based on alpha
7174
- float isSelected(vec4 color) {
7175
- return abs(color.a - selectionAlpha) < alphaTolerance ? 1.0 : 0.0;
7176
- }
7177
-
7178
- // Edge detection - find boundaries between selected and non-selected
7179
- float detectSelectionEdge(vec2 uv, vec2 texelSize) {
7180
- // Sample center
7181
- vec4 center = texture2D(tDiffuse, uv);
7182
- float centerSelected = isSelected(center);
7183
-
7184
- // If center is selected, check if any neighbor is NOT selected (inner edge)
7185
- // If center is NOT selected, check if any neighbor IS selected (outer edge)
7186
-
7187
- float maxDiff = 0.0;
7188
-
7189
- // Sample 8 neighbors at outline thickness distance
7190
- for (float y = -1.0; y <= 1.0; y += 1.0) {
7191
- for (float x = -1.0; x <= 1.0; x += 1.0) {
7192
- if (x == 0.0 && y == 0.0) continue;
7193
-
7194
- vec2 offset = vec2(x, y) * texelSize * outlineThickness;
7195
- vec4 neighbor = texture2D(tDiffuse, uv + offset);
7196
- float neighborSelected = isSelected(neighbor);
7197
-
7198
- maxDiff = max(maxDiff, abs(centerSelected - neighborSelected));
7199
- }
7200
- }
7201
-
7202
- // Only draw outline OUTSIDE selection (where center is NOT selected but has selected neighbor)
7203
- if (centerSelected > 0.5) {
7204
- return 0.0; // Don't draw outline inside selected area
7205
- }
7206
-
7207
- return maxDiff;
7208
- }
7209
-
7210
- void main() {
7211
- vec2 texelSize = 1.0 / resolution;
7212
- vec4 sceneColor = texture2D(tDiffuse, vUv);
7213
-
7214
- // Detect selection boundary
7215
- float edge = detectSelectionEdge(vUv, texelSize);
7216
-
7217
- if (edge < 0.5) {
7218
- // Restore original alpha if it was selection marker
7219
- float originalAlpha = isSelected(sceneColor) > 0.5 ? 1.0 : sceneColor.a;
7220
- gl_FragColor = vec4(sceneColor.rgb, originalAlpha);
7221
- return;
7222
- }
7223
-
7224
- // Apply outline
7225
- vec3 finalColor = mix(sceneColor.rgb, outlineColor, outlineOpacity);
7226
- gl_FragColor = vec4(finalColor, 1.0);
7227
- }
7228
- `;
7229
- class ln extends Ot {
7230
- constructor(e, t = {}) {
7231
- super(), this.copyMaterial = null, this.bypass = !1, this.hasSelection = !1, this.resolution = e, this.options = { ...an, ...t }, this.outlineMaterial = new ee({
7232
- uniforms: {
7233
- tDiffuse: { value: null },
7234
- resolution: { value: this.resolution },
7235
- outlineColor: { value: this.options.outlineColor },
7236
- outlineOpacity: { value: this.options.outlineOpacity },
7237
- outlineThickness: { value: this.options.outlineThickness },
7238
- selectionAlpha: { value: this.options.selectionAlpha },
7239
- alphaTolerance: { value: this.options.alphaTolerance }
7240
- },
7241
- vertexShader: $t,
7242
- fragmentShader: on
7243
- }), this.fsQuad = new Dt(this.outlineMaterial);
7244
- }
7245
- setOptions(e) {
7246
- this.options = { ...this.options, ...e };
7247
- const t = this.outlineMaterial.uniforms;
7248
- t.outlineColor.value = this.options.outlineColor, t.outlineOpacity.value = this.options.outlineOpacity, t.outlineThickness.value = this.options.outlineThickness, t.selectionAlpha.value = this.options.selectionAlpha, t.alphaTolerance.value = this.options.alphaTolerance;
7249
- }
7250
- render(e, t, i, s, n) {
7251
- if (this.bypass || !this.hasSelection) {
7252
- this.copyMaterial || (this.copyMaterial = new ee({
7253
- uniforms: { tDiffuse: { value: null } },
7254
- vertexShader: $t,
7255
- fragmentShader: `
7256
- uniform sampler2D tDiffuse;
7257
- varying vec2 vUv;
7258
- void main() {
7259
- gl_FragColor = texture2D(tDiffuse, vUv);
7260
- }
7261
- `
7262
- })), this.copyMaterial.uniforms.tDiffuse.value = i.texture, this.fsQuad.material = this.copyMaterial, e.setRenderTarget(this.renderToScreen ? null : t), this.fsQuad.render(e);
7263
- return;
7264
- }
7265
- this.outlineMaterial.uniforms.tDiffuse.value = i.texture, this.fsQuad.material = this.outlineMaterial, e.setRenderTarget(this.renderToScreen ? null : t), this.fsQuad.render(e);
7266
- }
7267
- setSize(e, t) {
7268
- this.resolution.set(e, t), this.outlineMaterial.uniforms.resolution.value = this.resolution;
7269
- }
7270
- dispose() {
7271
- var e;
7272
- this.outlineMaterial.dispose(), (e = this.copyMaterial) == null || e.dispose(), this.fsQuad.dispose();
7273
- }
7274
- }
7275
- function cn() {
7070
+ function rn() {
7276
7071
  const g = new hi({
7277
- side: te
7072
+ side: J
7278
7073
  });
7279
7074
  return g.onBeforeCompile = (e) => {
7280
7075
  e.vertexShader = `attribute vec4 color;
@@ -7294,10 +7089,10 @@ function cn() {
7294
7089
  );
7295
7090
  }, g;
7296
7091
  }
7297
- function hn() {
7298
- const g = new G({
7092
+ function an() {
7093
+ const g = new q({
7299
7094
  colorWrite: !1,
7300
- side: te
7095
+ side: J
7301
7096
  });
7302
7097
  return g.onBeforeCompile = (e) => {
7303
7098
  e.vertexShader = `attribute vec4 color;
@@ -7317,8 +7112,8 @@ function hn() {
7317
7112
  );
7318
7113
  }, g;
7319
7114
  }
7320
- const dn = {
7321
- edgeColor: new k(0),
7115
+ const on = {
7116
+ edgeColor: new $(0),
7322
7117
  edgeOpacity: 0.6,
7323
7118
  // Reduced for subtlety, better perf
7324
7119
  edgeThickness: 1,
@@ -7335,14 +7130,14 @@ const dn = {
7335
7130
  // Keep - good for creases
7336
7131
  enableObjectIdEdges: !1
7337
7132
  // Disable by default - most expensive (extra render pass)
7338
- }, un = `
7133
+ }, ln = `
7339
7134
  varying vec2 vUv;
7340
7135
 
7341
7136
  void main() {
7342
7137
  vUv = uv;
7343
7138
  gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
7344
7139
  }
7345
- `, pn = `
7140
+ `, cn = `
7346
7141
  precision highp float;
7347
7142
 
7348
7143
  uniform sampler2D tDiffuse; // Color buffer (from main render)
@@ -7508,7 +7303,7 @@ void main() {
7508
7303
 
7509
7304
  gl_FragColor = vec4(finalColor, color.a);
7510
7305
  }
7511
- `, mn = `
7306
+ `, hn = `
7512
7307
  attribute float objectIndex;
7513
7308
  varying float vObjectIndex;
7514
7309
 
@@ -7516,7 +7311,7 @@ void main() {
7516
7311
  vObjectIndex = objectIndex;
7517
7312
  gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
7518
7313
  }
7519
- `, gn = `
7314
+ `, dn = `
7520
7315
  precision highp float;
7521
7316
  varying float vObjectIndex;
7522
7317
 
@@ -7532,34 +7327,34 @@ void main() {
7532
7327
  gl_FragColor = vec4(packIndex(vObjectIndex), 1.0);
7533
7328
  }
7534
7329
  `;
7535
- class fn extends Ot {
7330
+ class un extends Yt {
7536
7331
  constructor(e, t, i, s) {
7537
- super(), this.excludeObjects = [], this.bypass = !1, this.scene = e, this.camera = t, this.resolution = i || new z(window.innerWidth, window.innerHeight), this.options = { ...dn, ...s };
7332
+ super(), this.excludeObjects = [], this.bypass = !1, this.scene = e, this.camera = t, this.resolution = i || new H(window.innerWidth, window.innerHeight), this.options = { ...on, ...s };
7538
7333
  const n = {
7539
- format: Ut,
7540
- type: qt,
7541
- minFilter: Rt,
7542
- magFilter: Rt
7334
+ format: Wt,
7335
+ type: Gt,
7336
+ minFilter: Ot,
7337
+ magFilter: Ot
7543
7338
  };
7544
7339
  this.normalTarget = new ue(this.resolution.x, this.resolution.y, {
7545
7340
  ...n,
7546
7341
  depthBuffer: !0
7547
- }), this.normalTarget.depthTexture = new At(
7342
+ }), this.normalTarget.depthTexture = new St(
7548
7343
  this.resolution.x,
7549
7344
  this.resolution.y,
7550
- _t
7345
+ At
7551
7346
  ), this.depthTarget = new ue(this.resolution.x, this.resolution.y, {
7552
7347
  ...n,
7553
7348
  depthBuffer: !0
7554
- }), this.depthTarget.depthTexture = new At(
7349
+ }), this.depthTarget.depthTexture = new St(
7555
7350
  this.resolution.x,
7556
7351
  this.resolution.y,
7557
- _t
7558
- ), this.objectIdTarget = new ue(this.resolution.x, this.resolution.y, n), this.normalMaterial = cn(), this.depthMaterial = hn(), this.objectIdMaterial = new ee({
7559
- vertexShader: mn,
7560
- fragmentShader: gn,
7561
- side: te
7562
- }), this.edgeMaterial = new ee({
7352
+ At
7353
+ ), this.objectIdTarget = new ue(this.resolution.x, this.resolution.y, n), this.normalMaterial = rn(), this.depthMaterial = an(), this.objectIdMaterial = new le({
7354
+ vertexShader: hn,
7355
+ fragmentShader: dn,
7356
+ side: J
7357
+ }), this.edgeMaterial = new le({
7563
7358
  uniforms: {
7564
7359
  tDiffuse: { value: null },
7565
7360
  tDepth: { value: null },
@@ -7580,9 +7375,9 @@ class fn extends Ot {
7580
7375
  enableNormalEdges: { value: this.options.enableNormalEdges },
7581
7376
  enableObjectIdEdges: { value: this.options.enableObjectIdEdges }
7582
7377
  },
7583
- vertexShader: un,
7584
- fragmentShader: pn
7585
- }), this.copyMaterial = new ee({
7378
+ vertexShader: ln,
7379
+ fragmentShader: cn
7380
+ }), this.copyMaterial = new le({
7586
7381
  uniforms: {
7587
7382
  tDiffuse: { value: null }
7588
7383
  },
@@ -7600,7 +7395,7 @@ class fn extends Ot {
7600
7395
  gl_FragColor = texture2D(tDiffuse, vUv);
7601
7396
  }
7602
7397
  `
7603
- }), this.fsQuad = new Dt(this.edgeMaterial);
7398
+ }), this.fsQuad = new Xt(this.edgeMaterial);
7604
7399
  }
7605
7400
  /**
7606
7401
  * Update options
@@ -7658,19 +7453,19 @@ class fn extends Ot {
7658
7453
  this.normalTarget.dispose(), this.depthTarget.dispose(), this.objectIdTarget.dispose(), this.normalMaterial.dispose(), this.depthMaterial.dispose(), this.edgeMaterial.dispose(), this.objectIdMaterial.dispose(), this.copyMaterial.dispose(), this.fsQuad.dispose();
7659
7454
  }
7660
7455
  }
7661
- const vn = {
7662
- outlineColor: new k(y.accent),
7456
+ const pn = {
7457
+ outlineColor: new $(y.accent),
7663
7458
  outlineOpacity: 1,
7664
7459
  outlineThickness: 2,
7665
7460
  showOccluded: !0,
7666
7461
  occludedOpacity: 0.5
7667
- }, Mt = `
7462
+ }, xt = R.hexToRGB(y.accent), zt = `
7668
7463
  varying vec2 vUv;
7669
7464
  void main() {
7670
7465
  vUv = uv;
7671
7466
  gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
7672
7467
  }
7673
- `, bn = `
7468
+ `, mn = `
7674
7469
  precision highp float;
7675
7470
 
7676
7471
  uniform sampler2D tDiffuse; // Original scene
@@ -7704,11 +7499,11 @@ float detectEdge(vec2 uv, vec2 texelSize) {
7704
7499
  float tx0y0 = texture2D(tMask, uv + texelSize * vec2(-1.0, -1.0) * outlineThickness).r;
7705
7500
  float tx1y0 = texture2D(tMask, uv + texelSize * vec2( 0.0, -1.0) * outlineThickness).r;
7706
7501
  float tx2y0 = texture2D(tMask, uv + texelSize * vec2( 1.0, -1.0) * outlineThickness).r;
7707
-
7502
+
7708
7503
  float tx0y1 = texture2D(tMask, uv + texelSize * vec2(-1.0, 0.0) * outlineThickness).r;
7709
7504
  float tx1y1 = texture2D(tMask, uv + texelSize * vec2( 0.0, 0.0) * outlineThickness).r;
7710
7505
  float tx2y1 = texture2D(tMask, uv + texelSize * vec2( 1.0, 0.0) * outlineThickness).r;
7711
-
7506
+
7712
7507
  float tx0y2 = texture2D(tMask, uv + texelSize * vec2(-1.0, 1.0) * outlineThickness).r;
7713
7508
  float tx1y2 = texture2D(tMask, uv + texelSize * vec2( 0.0, 1.0) * outlineThickness).r;
7714
7509
  float tx2y2 = texture2D(tMask, uv + texelSize * vec2( 1.0, 1.0) * outlineThickness).r;
@@ -7726,54 +7521,96 @@ float detectEdge(vec2 uv, vec2 texelSize) {
7726
7521
 
7727
7522
  void main() {
7728
7523
  vec2 texelSize = 1.0 / resolution;
7729
-
7524
+
7730
7525
  // Get original scene color
7731
7526
  vec4 sceneColor = texture2D(tDiffuse, vUv);
7732
-
7527
+
7733
7528
  // Detect edge strength
7734
7529
  float edge = detectEdge(vUv, texelSize);
7735
-
7530
+
7736
7531
  // Skip if no edge
7737
7532
  if (edge < 0.1) {
7738
7533
  gl_FragColor = sceneColor;
7739
7534
  return;
7740
7535
  }
7741
-
7536
+
7742
7537
  // Clamp edge intensity
7743
7538
  edge = clamp(edge, 0.0, 1.0);
7744
-
7539
+
7745
7540
  // Check occlusion (is the selected object behind something?)
7746
7541
  float sceneDepth = texture2D(tDepth, vUv).r;
7747
7542
  float maskDepth = texture2D(tMaskDepth, vUv).r;
7748
-
7543
+
7749
7544
  float finalOpacity = outlineOpacity;
7750
-
7545
+
7751
7546
  // If mask depth is further than scene depth, outline is occluded
7752
7547
  if (showOccluded && maskDepth > sceneDepth + 0.0001) {
7753
7548
  finalOpacity *= occludedOpacity;
7754
7549
  }
7755
-
7550
+
7756
7551
  // Composite outline over scene
7757
7552
  vec3 finalColor = mix(sceneColor.rgb, outlineColor, edge * finalOpacity);
7758
-
7553
+
7759
7554
  gl_FragColor = vec4(finalColor, sceneColor.a);
7760
7555
  }
7556
+ `, gn = `
7557
+ varying vec3 vVertexColor;
7558
+
7559
+ void main() {
7560
+ // Three.js injects vertex color handling when vertexColors is enabled
7561
+ // For regular meshes: reads "color" attribute
7562
+ // For InstancedMesh: reads "instanceColor" and multiplies into color
7563
+ #ifdef USE_COLOR
7564
+ vVertexColor = color.rgb;
7565
+ #else
7566
+ vVertexColor = vec3(1.0);
7567
+ #endif
7568
+
7569
+ gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
7570
+
7571
+ #ifdef USE_INSTANCING
7572
+ gl_Position = projectionMatrix * modelViewMatrix * instanceMatrix * vec4(position, 1.0);
7573
+ #endif
7574
+ }
7575
+ `, fn = `
7576
+ precision highp float;
7577
+
7578
+ uniform vec3 selectColor;
7579
+ uniform float colorTolerance;
7580
+
7581
+ varying vec3 vVertexColor;
7582
+
7583
+ void main() {
7584
+ // Check if this fragment's color matches the selection color
7585
+ float dist = distance(vVertexColor, selectColor);
7586
+ if (dist > colorTolerance) {
7587
+ discard;
7588
+ }
7589
+ gl_FragColor = vec4(1.0); // White mask for selected
7590
+ }
7761
7591
  `;
7762
- class wn extends Ot {
7592
+ class vn extends Yt {
7763
7593
  constructor(e, t, i, s = {}) {
7764
- super(), this.copyMaterial = null, this.selectionMesh = null, this.hasSelection = !1, this.bypass = !1, this.camera = t, this.resolution = i, this.options = { ...vn, ...s };
7594
+ super(), this.copyMaterial = null, this.hasSelection = !1, this.bypass = !1, this.scene = e, this.camera = t, this.resolution = i, this.options = { ...pn, ...s };
7765
7595
  const n = i.clone().multiplyScalar(0.5);
7766
7596
  this.maskRenderTarget = new ue(n.x, n.y, {
7767
7597
  depthBuffer: !0
7768
7598
  }), this.maskDepthRenderTarget = new ue(n.x, n.y, {
7769
7599
  depthBuffer: !0
7770
- }), this.maskMaterial = new G({
7771
- color: 16777215,
7772
- side: te,
7600
+ }), this.selectionFilterMaterial = new le({
7601
+ uniforms: {
7602
+ selectColor: {
7603
+ value: [xt.r, xt.g, xt.b]
7604
+ },
7605
+ colorTolerance: { value: 0.01 }
7606
+ },
7607
+ vertexShader: gn,
7608
+ fragmentShader: fn,
7609
+ vertexColors: !0,
7610
+ side: J,
7773
7611
  depthTest: !this.options.showOccluded,
7774
- // Disable depth test to capture occluded parts
7775
7612
  depthWrite: !0
7776
- }), this.outlineMaterial = new ee({
7613
+ }), this.selectionFilterMaterialDepth = this.selectionFilterMaterial.clone(), this.selectionFilterMaterialDepth.depthTest = !0, this.outlineMaterial = new le({
7777
7614
  uniforms: {
7778
7615
  tDiffuse: { value: null },
7779
7616
  tMask: { value: this.maskRenderTarget.texture },
@@ -7786,21 +7623,23 @@ class wn extends Ot {
7786
7623
  showOccluded: { value: this.options.showOccluded },
7787
7624
  occludedOpacity: { value: this.options.occludedOpacity }
7788
7625
  },
7789
- vertexShader: Mt,
7790
- fragmentShader: bn
7791
- }), this.selectionGeometry = new Z(), this.maskScene = new vt(), this.fsQuad = new Dt(this.outlineMaterial);
7626
+ vertexShader: zt,
7627
+ fragmentShader: mn
7628
+ }), this.fsQuad = new Xt(this.outlineMaterial);
7792
7629
  }
7793
7630
  /**
7794
- * Update selection geometry from buffer elements
7795
- * Call this when selection changes
7796
- * @param positions - Merged Float32Array of all selected element positions
7631
+ * Notify the pass whether there is an active selection.
7632
+ * No data transfer needed — the GPU reads selection state from vertex colors.
7633
+ */
7634
+ setHasSelection(e) {
7635
+ this.hasSelection = e;
7636
+ }
7637
+ /**
7638
+ * Legacy method — kept for backward compatibility.
7639
+ * With the GPU-based approach, this just toggles hasSelection.
7797
7640
  */
7798
7641
  updateSelectionGeometry(e) {
7799
- if (this.selectionGeometry.dispose(), this.selectionGeometry = new Z(), !e || e.length === 0) {
7800
- this.hasSelection = !1, this.selectionMesh && (this.maskScene.remove(this.selectionMesh), this.selectionMesh = null);
7801
- return;
7802
- }
7803
- this.hasSelection = !0, this.selectionGeometry.setAttribute("position", new L(e, 3)), this.selectionGeometry.computeBoundingSphere(), this.selectionMesh ? this.selectionMesh.geometry = this.selectionGeometry : (this.selectionMesh = new x(this.selectionGeometry, this.maskMaterial), this.selectionMesh.frustumCulled = !1, this.maskScene.add(this.selectionMesh));
7642
+ this.hasSelection = e !== null && e.length > 0;
7804
7643
  }
7805
7644
  /**
7806
7645
  * Get whether there's an active selection
@@ -7812,39 +7651,32 @@ class wn extends Ot {
7812
7651
  * Update outline options
7813
7652
  */
7814
7653
  setOptions(e) {
7815
- this.options = { ...this.options, ...e }, this.outlineMaterial.uniforms.outlineColor.value = this.options.outlineColor, this.outlineMaterial.uniforms.outlineOpacity.value = this.options.outlineOpacity, this.outlineMaterial.uniforms.outlineThickness.value = this.options.outlineThickness, this.outlineMaterial.uniforms.showOccluded.value = this.options.showOccluded, this.outlineMaterial.uniforms.occludedOpacity.value = this.options.occludedOpacity, this.maskMaterial.depthTest = !this.options.showOccluded;
7654
+ this.options = { ...this.options, ...e }, this.outlineMaterial.uniforms.outlineColor.value = this.options.outlineColor, this.outlineMaterial.uniforms.outlineOpacity.value = this.options.outlineOpacity, this.outlineMaterial.uniforms.outlineThickness.value = this.options.outlineThickness, this.outlineMaterial.uniforms.showOccluded.value = this.options.showOccluded, this.outlineMaterial.uniforms.occludedOpacity.value = this.options.occludedOpacity, this.selectionFilterMaterial.depthTest = !this.options.showOccluded;
7816
7655
  }
7817
7656
  render(e, t, i, s, n) {
7818
7657
  if (this.bypass) {
7819
- this.copyMaterial || (this.copyMaterial = new ee({
7820
- uniforms: { tDiffuse: { value: null } },
7821
- vertexShader: Mt,
7822
- fragmentShader: `
7823
- uniform sampler2D tDiffuse;
7824
- varying vec2 vUv;
7825
- void main() {
7826
- gl_FragColor = texture2D(tDiffuse, vUv);
7827
- }
7828
- `
7829
- })), this.copyMaterial.uniforms.tDiffuse.value = i.texture, this.fsQuad.material = this.copyMaterial, this.renderToScreen ? e.setRenderTarget(null) : e.setRenderTarget(t), this.fsQuad.render(e), this.fsQuad.material = this.outlineMaterial;
7658
+ this._renderCopyPass(e, i, t);
7830
7659
  return;
7831
7660
  }
7832
- if (!this.hasSelection || !this.enabled || !this.selectionMesh) {
7833
- this.copyMaterial || (this.copyMaterial = new ee({
7834
- uniforms: { tDiffuse: { value: null } },
7835
- vertexShader: Mt,
7836
- fragmentShader: `
7837
- uniform sampler2D tDiffuse;
7838
- varying vec2 vUv;
7839
- void main() {
7840
- gl_FragColor = texture2D(tDiffuse, vUv);
7841
- }
7842
- `
7843
- })), this.copyMaterial.uniforms.tDiffuse.value = i.texture, this.fsQuad.material = this.copyMaterial, this.renderToScreen ? e.setRenderTarget(null) : e.setRenderTarget(t), this.fsQuad.render(e);
7661
+ if (!this.hasSelection || !this.enabled) {
7662
+ this._renderCopyPass(e, i, t);
7844
7663
  return;
7845
7664
  }
7846
- const r = e.getRenderTarget(), o = e.autoClear;
7847
- e.setRenderTarget(this.maskRenderTarget), e.setClearColor(0, 0), e.clear(), e.render(this.maskScene, this.camera), this.options.showOccluded && (this.maskMaterial.depthTest = !0, e.setRenderTarget(this.maskDepthRenderTarget), e.clear(), e.render(this.maskScene, this.camera), this.maskMaterial.depthTest = !1), this.outlineMaterial.uniforms.tDiffuse.value = i.texture, this.outlineMaterial.uniforms.tMask.value = this.maskRenderTarget.texture, i.depthTexture && (this.outlineMaterial.uniforms.tDepth.value = i.depthTexture), this.renderToScreen ? e.setRenderTarget(null) : e.setRenderTarget(t), this.fsQuad.material = this.outlineMaterial, this.fsQuad.render(e), e.setRenderTarget(r), e.autoClear = o;
7665
+ const r = e.getRenderTarget(), o = e.autoClear, a = this.scene.overrideMaterial;
7666
+ e.setRenderTarget(this.maskRenderTarget), e.setClearColor(0, 0), e.clear(), this.scene.overrideMaterial = this.selectionFilterMaterial, e.render(this.scene, this.camera), this.options.showOccluded && (e.setRenderTarget(this.maskDepthRenderTarget), e.clear(), this.scene.overrideMaterial = this.selectionFilterMaterialDepth, e.render(this.scene, this.camera)), this.scene.overrideMaterial = a, this.outlineMaterial.uniforms.tDiffuse.value = i.texture, this.outlineMaterial.uniforms.tMask.value = this.maskRenderTarget.texture, i.depthTexture && (this.outlineMaterial.uniforms.tDepth.value = i.depthTexture), this.renderToScreen ? e.setRenderTarget(null) : e.setRenderTarget(t), this.fsQuad.material = this.outlineMaterial, this.fsQuad.render(e), e.setRenderTarget(r), e.autoClear = o;
7667
+ }
7668
+ _renderCopyPass(e, t, i) {
7669
+ this.copyMaterial || (this.copyMaterial = new le({
7670
+ uniforms: { tDiffuse: { value: null } },
7671
+ vertexShader: zt,
7672
+ fragmentShader: `
7673
+ uniform sampler2D tDiffuse;
7674
+ varying vec2 vUv;
7675
+ void main() {
7676
+ gl_FragColor = texture2D(tDiffuse, vUv);
7677
+ }
7678
+ `
7679
+ })), this.copyMaterial.uniforms.tDiffuse.value = t.texture, this.fsQuad.material = this.copyMaterial, this.renderToScreen ? e.setRenderTarget(null) : e.setRenderTarget(i), this.fsQuad.render(e), this.fsQuad.material = this.outlineMaterial;
7848
7680
  }
7849
7681
  setSize(e, t) {
7850
7682
  this.resolution.set(e, t);
@@ -7853,13 +7685,13 @@ class wn extends Ot {
7853
7685
  }
7854
7686
  dispose() {
7855
7687
  var e;
7856
- this.maskRenderTarget.dispose(), this.maskDepthRenderTarget.dispose(), this.selectionGeometry.dispose(), this.maskMaterial.dispose(), this.outlineMaterial.dispose(), (e = this.copyMaterial) == null || e.dispose(), this.fsQuad.dispose(), this.selectionMesh && this.maskScene.remove(this.selectionMesh);
7688
+ this.maskRenderTarget.dispose(), this.maskDepthRenderTarget.dispose(), this.selectionFilterMaterial.dispose(), this.selectionFilterMaterialDepth.dispose(), this.outlineMaterial.dispose(), (e = this.copyMaterial) == null || e.dispose(), this.fsQuad.dispose();
7857
7689
  }
7858
7690
  }
7859
- new z(1024, 1024), new k(0);
7860
- class yn {
7691
+ new H(1024, 1024), new $(0);
7692
+ class bn {
7861
7693
  constructor(e, t) {
7862
- this.renderer = e, this.viralViewerApi = t, this.gammaPass = null, this.ssaoPass = null, this.saoPass = null, this.smaaPass = null, this.ssaaPass = null, this.fxaaPass = null, this.taaPass = null, this.sobelPass = null, this.whitePass = null, this.shadowRemovalPass = null, this.outlinePass = null, this.screenSpaceEdgesPass = null, this.selectionOutlinePass = null, this.alphaSelectionOutlinePass = null, this.perfChecker = new Us(), this._whiteShader = {
7694
+ this.renderer = e, this.viralViewerApi = t, this.gammaPass = null, this.ssaoPass = null, this.saoPass = null, this.smaaPass = null, this.ssaaPass = null, this.fxaaPass = null, this.taaPass = null, this.sobelPass = null, this.whitePass = null, this.shadowRemovalPass = null, this.outlinePass = null, this.screenSpaceEdgesPass = null, this.selectionOutlinePass = null, this.perfChecker = new Gs(), this._whiteShader = {
7863
7695
  uniforms: {
7864
7696
  tDiffuse: { value: null },
7865
7697
  shadowTexture: { value: null },
@@ -7890,15 +7722,15 @@ class yn {
7890
7722
  }
7891
7723
  `
7892
7724
  };
7893
- const i = new z();
7725
+ const i = new H();
7894
7726
  e.getSize(i);
7895
7727
  const s = new ue(i.x, i.y, {
7896
- format: Ut,
7897
- type: qt,
7728
+ format: Wt,
7729
+ type: Gt,
7898
7730
  depthBuffer: !0,
7899
7731
  stencilBuffer: !1
7900
7732
  });
7901
- s.depthTexture = new At(i.x, i.y, _t), this.composer = new Ni(this.renderer, s), this.composer.setSize(window.innerWidth, window.innerHeight);
7733
+ s.depthTexture = new St(i.x, i.y, At), this.composer = new Ni(this.renderer, s), this.composer.setSize(window.innerWidth, window.innerHeight);
7902
7734
  }
7903
7735
  isWebGL2Available() {
7904
7736
  return !!window.WebGL2RenderingContext;
@@ -7917,13 +7749,13 @@ class yn {
7917
7749
  this.initn8aoPass(e, t);
7918
7750
  } else
7919
7751
  this.perfChecker.canHandleBasicEffects();
7920
- this.initScreenSpaceEdgesPass(e, t), this.initSelectionOutlinePass(e, t), this.initAlphaSelectionOutlinePass(), this.alphaSelectionOutlinePass && (this.alphaSelectionOutlinePass.enabled = !1);
7752
+ this.initScreenSpaceEdgesPass(e, t), this.initSelectionOutlinePass(e, t);
7921
7753
  //! this pass slow render too, turn it off when we dont use
7922
7754
  const s = new ji();
7923
7755
  this.composer.addPass(s);
7924
7756
  }
7925
7757
  initGammaPass() {
7926
- this.gammaPass = new xt(Wi), this.composer.addPass(this.gammaPass);
7758
+ this.gammaPass = new yt(Wi), this.composer.addPass(this.gammaPass);
7927
7759
  }
7928
7760
  //#region N8AOPass
7929
7761
  initn8aoPass(e, t) {
@@ -7948,10 +7780,10 @@ class yn {
7948
7780
  this.smaaPass = new Fi(), this.smaaPass.renderToScreen = !0, this.composer.addPass(this.smaaPass);
7949
7781
  }
7950
7782
  initSSAAPass(e, t) {
7951
- this.ssaaPass = new Si(e, t), this.ssaaPass.unbiased = !0, this.ssaaPass.sampleLevel = 2, this.composer.addPass(this.ssaaPass);
7783
+ this.ssaaPass = new Ci(e, t), this.ssaaPass.unbiased = !0, this.ssaaPass.sampleLevel = 2, this.composer.addPass(this.ssaaPass);
7952
7784
  }
7953
7785
  initFXAAPass() {
7954
- this.fxaaPass = new xt(Ci), this.fxaaPass.uniforms.resolution.value.set(
7786
+ this.fxaaPass = new yt(Si), this.fxaaPass.uniforms.resolution.value.set(
7955
7787
  1 / window.innerWidth,
7956
7788
  1 / window.innerHeight
7957
7789
  ), this.composer.addPass(this.fxaaPass);
@@ -7973,13 +7805,13 @@ class yn {
7973
7805
  //#endregion
7974
7806
  //#region SSAO
7975
7807
  initSSAOPass(e, t) {
7976
- this.ssaoPass = new mt(e, t), this.ssaoPass.output = mt.OUTPUT.Default, this.ssaoPass.kernelRadius = 8, this.ssaoPass.minDistance = 1e-5, this.ssaoPass.maxDistance = 0.02, this.ssaoPass.enabled = !0, this.ssaoPass.renderToScreen = !0, this.composer.addPass(this.ssaoPass);
7808
+ this.ssaoPass = new pt(e, t), this.ssaoPass.output = pt.OUTPUT.Default, this.ssaoPass.kernelRadius = 8, this.ssaoPass.minDistance = 1e-5, this.ssaoPass.maxDistance = 0.02, this.ssaoPass.enabled = !0, this.ssaoPass.renderToScreen = !0, this.composer.addPass(this.ssaoPass);
7977
7809
  }
7978
7810
  enableSSAO() {
7979
- this.ssaoPass && (this.ssaoPass.output = mt.OUTPUT.SSAO, this.ssaoPass.kernelRadius = 64, this.ssaoPass.minDistance = 1e-3, this.ssaoPass.maxDistance = 0.02);
7811
+ this.ssaoPass && (this.ssaoPass.output = pt.OUTPUT.SSAO, this.ssaoPass.kernelRadius = 64, this.ssaoPass.minDistance = 1e-3, this.ssaoPass.maxDistance = 0.02);
7980
7812
  }
7981
7813
  disableSSAO() {
7982
- this.ssaoPass && (this.ssaoPass.output = mt.OUTPUT.Default, this.ssaoPass.kernelRadius = 1, this.ssaoPass.minDistance = 5e-4, this.ssaoPass.maxDistance = 0.3);
7814
+ this.ssaoPass && (this.ssaoPass.output = pt.OUTPUT.Default, this.ssaoPass.kernelRadius = 1, this.ssaoPass.minDistance = 5e-4, this.ssaoPass.maxDistance = 0.3);
7983
7815
  }
7984
7816
  //#endregion
7985
7817
  //#region SOBEL
@@ -7999,12 +7831,12 @@ class yn {
7999
7831
  * - Object ID discontinuity detection (object boundaries)
8000
7832
  */
8001
7833
  initScreenSpaceEdgesPass(e, t) {
8002
- this.screenSpaceEdgesPass = new fn(
7834
+ this.screenSpaceEdgesPass = new un(
8003
7835
  e,
8004
7836
  t,
8005
- new z(window.innerWidth, window.innerHeight),
7837
+ new H(window.innerWidth, window.innerHeight),
8006
7838
  {
8007
- edgeColor: new k(0),
7839
+ edgeColor: new $(0),
8008
7840
  edgeOpacity: 1,
8009
7841
  edgeThickness: 2,
8010
7842
  depthMultiplier: 1.5,
@@ -8055,7 +7887,7 @@ class yn {
8055
7887
  */
8056
7888
  setScreenSpaceEdgeColor(e) {
8057
7889
  if (this.screenSpaceEdgesPass) {
8058
- const t = typeof e == "number" ? new k(e) : e;
7890
+ const t = typeof e == "number" ? new $(e) : e;
8059
7891
  this.screenSpaceEdgesPass.setOptions({ edgeColor: t });
8060
7892
  }
8061
7893
  }
@@ -8086,7 +7918,7 @@ class yn {
8086
7918
  */
8087
7919
  setScreenSpaceEdgesPenMode() {
8088
7920
  this.screenSpaceEdgesPass && this.screenSpaceEdgesPass.setOptions({
8089
- edgeColor: new k(0),
7921
+ edgeColor: new $(0),
8090
7922
  edgeOpacity: 1,
8091
7923
  edgeThickness: 1.5
8092
7924
  });
@@ -8096,19 +7928,19 @@ class yn {
8096
7928
  */
8097
7929
  setScreenSpaceEdgesShadedMode() {
8098
7930
  this.screenSpaceEdgesPass && this.screenSpaceEdgesPass.setOptions({
8099
- edgeColor: new k(0),
7931
+ edgeColor: new $(0),
8100
7932
  edgeOpacity: 0.8,
8101
7933
  edgeThickness: 1.5
8102
7934
  });
8103
7935
  }
8104
7936
  initWhitePass() {
8105
- this.whitePass = new xt(this._whiteShader), this.composer.addPass(this.whitePass);
7937
+ this.whitePass = new yt(this._whiteShader), this.composer.addPass(this.whitePass);
8106
7938
  }
8107
7939
  //#endregion
8108
7940
  //#region Outline Pass
8109
7941
  initOutlinePass(e, t) {
8110
7942
  this.outlinePass = new $i(
8111
- new z(window.innerWidth, window.innerHeight),
7943
+ new H(window.innerWidth, window.innerHeight),
8112
7944
  e,
8113
7945
  t,
8114
7946
  // TODO : investigate why this effect when render new model
@@ -8129,12 +7961,12 @@ class yn {
8129
7961
  * Cost: 1 extra draw call + 1 fullscreen pass
8130
7962
  */
8131
7963
  initSelectionOutlinePass(e, t) {
8132
- this.selectionOutlinePass = new wn(
7964
+ this.selectionOutlinePass = new vn(
8133
7965
  e,
8134
7966
  t,
8135
- new z(window.innerWidth, window.innerHeight),
7967
+ new H(window.innerWidth, window.innerHeight),
8136
7968
  {
8137
- outlineColor: new k(y.accent),
7969
+ outlineColor: new $(y.accent),
8138
7970
  outlineOpacity: 1,
8139
7971
  outlineThickness: 2,
8140
7972
  showOccluded: !0,
@@ -8150,6 +7982,13 @@ class yn {
8150
7982
  updateSelectionOutline(e) {
8151
7983
  this.selectionOutlinePass && this.selectionOutlinePass.updateSelectionGeometry(e);
8152
7984
  }
7985
+ /**
7986
+ * Notify the outline pass whether elements are currently selected.
7987
+ * The GPU reads selection state directly from vertex colors — no data transfer needed.
7988
+ */
7989
+ setSelectionOutlineActive(e) {
7990
+ this.selectionOutlinePass && this.selectionOutlinePass.setHasSelection(e);
7991
+ }
8153
7992
  /**
8154
7993
  * Enable selection outline rendering
8155
7994
  */
@@ -8188,7 +8027,7 @@ class yn {
8188
8027
  */
8189
8028
  setSelectionOutlineColor(e) {
8190
8029
  if (this.selectionOutlinePass) {
8191
- const t = e instanceof k ? e : new k(e);
8030
+ const t = e instanceof $ ? e : new $(e);
8192
8031
  this.selectionOutlinePass.setOptions({ outlineColor: t });
8193
8032
  }
8194
8033
  }
@@ -8199,92 +8038,25 @@ class yn {
8199
8038
  this.selectionOutlinePass && this.selectionOutlinePass.setOptions({ outlineThickness: e });
8200
8039
  }
8201
8040
  //#endregion
8202
- //#region Alpha Selection Outline Pass (Ultra-Fast)
8203
- /**
8204
- * Initialize alpha-based selection outline pass
8205
- * ZERO extra render passes - detects selection via alpha channel in main render
8206
- * Cost: 1 fullscreen pass only (no geometry re-render)
8207
- *
8208
- * This is MUCH faster than SelectionOutlinePass for large selections
8209
- * Works with both batched meshes (per-vertex alpha) and instanced meshes (per-instance alpha)
8210
- */
8211
- initAlphaSelectionOutlinePass() {
8212
- this.alphaSelectionOutlinePass = new ln(
8213
- new z(window.innerWidth, window.innerHeight),
8214
- {
8215
- outlineColor: new k(y.accent),
8216
- outlineOpacity: 1,
8217
- outlineThickness: 2
8218
- }
8219
- ), this.alphaSelectionOutlinePass.enabled = !0, this.composer.addPass(this.alphaSelectionOutlinePass);
8220
- }
8221
- /**
8222
- * Enable alpha selection outline rendering
8223
- */
8224
- enableAlphaSelectionOutline() {
8225
- this.alphaSelectionOutlinePass && (this.alphaSelectionOutlinePass.enabled = !0);
8226
- }
8227
- /**
8228
- * Disable alpha selection outline rendering
8229
- */
8230
- disableAlphaSelectionOutline() {
8231
- this.alphaSelectionOutlinePass && (this.alphaSelectionOutlinePass.enabled = !1);
8232
- }
8233
- /**
8234
- * Bypass alpha selection outline (instant, zero cost)
8235
- */
8236
- bypassAlphaSelectionOutline() {
8237
- this.alphaSelectionOutlinePass && (this.alphaSelectionOutlinePass.bypass = !0);
8238
- }
8239
- /**
8240
- * Resume alpha selection outline after bypassing
8241
- */
8242
- resumeAlphaSelectionOutline() {
8243
- this.alphaSelectionOutlinePass && (this.alphaSelectionOutlinePass.bypass = !1);
8244
- }
8245
- /**
8246
- * Set alpha selection outline color
8247
- */
8248
- setAlphaSelectionOutlineColor(e) {
8249
- if (this.alphaSelectionOutlinePass) {
8250
- const t = e instanceof k ? e : new k(e);
8251
- this.alphaSelectionOutlinePass.setOptions({ outlineColor: t });
8252
- }
8253
- }
8254
- /**
8255
- * Set alpha selection outline thickness in pixels
8256
- */
8257
- setAlphaSelectionOutlineThickness(e) {
8258
- this.alphaSelectionOutlinePass && this.alphaSelectionOutlinePass.setOptions({ outlineThickness: e });
8259
- }
8260
- /**
8261
- * Update alpha selection outline state
8262
- * Call this when selection changes
8263
- * @param hasSelection - Whether there's any selection active
8264
- */
8265
- updateAlphaSelectionOutline(e) {
8266
- this.alphaSelectionOutlinePass && (this.alphaSelectionOutlinePass.hasSelection = e);
8267
- }
8268
- //#endregion
8269
8041
  }
8270
- class xn {
8042
+ class wn {
8271
8043
  constructor(e) {
8272
- this.viralViewerApi = e, this.renderer = new Qt({
8044
+ this.viralViewerApi = e, this.renderer = new Ut({
8273
8045
  alpha: !0,
8274
8046
  antialias: !0,
8275
8047
  stencil: !0,
8276
8048
  logarithmicDepthBuffer: !0,
8277
8049
  powerPreference: "high-performance",
8278
8050
  preserveDrawingBuffer: !0
8279
- }), this._t = 0, this._lastSpatialStatsTime = 0, this.renderTimeout = null, this.jitterOffsets = [], this.jitterIndex = 0, this.size = new z(window.innerWidth, window.innerHeight), this.samples = 4;
8051
+ }), this._t = 0, this._lastSpatialStatsTime = 0, this.renderTimeout = null, this.jitterOffsets = [], this.jitterIndex = 0, this.size = new H(window.innerWidth, window.innerHeight), this.samples = 4;
8280
8052
  const t = this.renderer.getContext(), i = t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS);
8281
8053
  console.log("Max Fragment Uniform Vectors ->", i), this.renderer.setPixelRatio(window.devicePixelRatio), this.renderer.setSize(
8282
8054
  this.viralViewerApi.targetElement.offsetWidth,
8283
8055
  this.viralViewerApi.targetElement.offsetHeight
8284
- ), this.renderer.outputColorSpace = di, this.renderer.shadowMap.enabled = !0, this.renderer.shadowMap.type = ui, this.renderer.shadowMap.autoUpdate = !1, this.renderer.shadowMap.needsUpdate = !0, this.renderer.info.autoReset = !1, this.viralViewerApi.targetElement.appendChild(this.renderer.domElement), this.viralViewerApi.options.enablePostProcessing !== !1 && (this.postProcessingRenderer = new yn(
8056
+ ), this.renderer.outputColorSpace = di, this.renderer.shadowMap.enabled = !0, this.renderer.shadowMap.type = ui, this.renderer.shadowMap.autoUpdate = !1, this.renderer.shadowMap.needsUpdate = !0, this.renderer.info.autoReset = !1, this.viralViewerApi.targetElement.appendChild(this.renderer.domElement), this.viralViewerApi.options.enablePostProcessing !== !1 && (this.postProcessingRenderer = new bn(
8285
8057
  this.renderer,
8286
8058
  this.viralViewerApi
8287
- )), this.jitterOffsets = this.generateJitterOffsets(), this.viralViewerApi.emit(R.LOADED_RENDERER);
8059
+ )), this.jitterOffsets = this.generateJitterOffsets(), this.viralViewerApi.emit(k.LOADED_RENDERER);
8288
8060
  }
8289
8061
  updateSize(e, t) {
8290
8062
  this.renderer.setSize(e, t), this.postProcessingRenderer && this.postProcessingRenderer.composer.setSize(e, t);
@@ -8372,7 +8144,7 @@ class xn {
8372
8144
  o
8373
8145
  );
8374
8146
  } else
8375
- i instanceof Fe && (i.projectionMatrix.elements[8] = e / this.size.x, i.projectionMatrix.elements[9] = t / this.size.y);
8147
+ i instanceof He && (i.projectionMatrix.elements[8] = e / this.size.x, i.projectionMatrix.elements[9] = t / this.size.y);
8376
8148
  this.jitterIndex = (this.jitterIndex + 1) % this.samples;
8377
8149
  }
8378
8150
  // Generates jitter offsets for the specified number of samples
@@ -8396,14 +8168,14 @@ const de = {
8396
8168
  outlineModel: "viral_outline_model",
8397
8169
  sunlight: "viral_sunlight"
8398
8170
  };
8399
- class Mn {
8171
+ class yn {
8400
8172
  constructor(e) {
8401
- this.viralViewerApi = e, this.scene = new vt(), this.objects = [], this.models = [], this.bimWorld = new es(), this.outlineModel = new x(), this.hideables = [], this.selectables = [], this.edges = [], this.sunLight = null, this.lights = [], this.transformControls = null, this.lightHelpers = [], this.fullScreenQuadMaterial = new G({
8173
+ this.viralViewerApi = e, this.scene = new Tt(), this.objects = [], this.models = [], this.bimWorld = new Ji(), this.outlineModel = new x(), this.hideables = [], this.selectables = [], this.edges = [], this.sunLight = null, this.lights = [], this.transformControls = null, this.lightHelpers = [], this.fullScreenQuadMaterial = new q({
8402
8174
  map: null,
8403
8175
  // Use the render target's texture
8404
- side: te
8405
- }), this.fullScreenQuad = null, this.viralViewerApi.emit(R.LOADED_SCENE), this.bimWorld.name = de.mergedModel, this.addModel(this.bimWorld), this.outlineModel.name = de.outlineModel, this.outlineModel.renderOrder = 0, this.addModel(this.outlineModel);
8406
- const t = new Lt(5, 32, 32), i = new J({
8176
+ side: J
8177
+ }), this.fullScreenQuad = null, this.viralViewerApi.emit(k.LOADED_SCENE), this.bimWorld.name = de.mergedModel, this.addModel(this.bimWorld), this.outlineModel.name = de.outlineModel, this.outlineModel.renderOrder = 0, this.addModel(this.outlineModel);
8178
+ const t = new Dt(5, 32, 32), i = new K({
8407
8179
  color: 16768256,
8408
8180
  emissive: 16755200,
8409
8181
  emissiveIntensity: 1
@@ -8434,21 +8206,21 @@ class Mn {
8434
8206
  }
8435
8207
  //#region lights
8436
8208
  addLights() {
8437
- const e = new pt(16777215, 1);
8209
+ const e = new ut(16777215, 1);
8438
8210
  e.position.set(1, 1, 1).normalize();
8439
- const t = new pt(16777215, 1.5);
8211
+ const t = new ut(16777215, 1.5);
8440
8212
  t.position.set(0, -1, 0).normalize();
8441
- const i = new pt(16777215, 1);
8213
+ const i = new ut(16777215, 1);
8442
8214
  i.position.set(-1, 1, -1).normalize();
8443
8215
  const s = new pi(16777215, 1);
8444
- this.sunLight = new pt(16777215, 4), this.sunLight.name = de.sunlight, this.sunLight.castShadow = !1, this.sunLight.position.set(50, 50, 50), this.sunLight.shadow.camera.top = 50, this.sunLight.shadow.camera.bottom = -50, this.sunLight.shadow.camera.left = -50, this.sunLight.shadow.camera.right = 50, this.sunLight.shadow.mapSize.x = 2048, this.sunLight.shadow.mapSize.y = 2048, this.sunLight.shadow.camera.near = 5, this.sunLight.shadow.camera.far = 350, this.sunLight.shadow.bias = -1e-3, this.sunLight.shadow.radius = 2, this.sunLight.visible = !0;
8216
+ this.sunLight = new ut(16777215, 4), this.sunLight.name = de.sunlight, this.sunLight.castShadow = !1, this.sunLight.position.set(50, 50, 50), this.sunLight.shadow.camera.top = 50, this.sunLight.shadow.camera.bottom = -50, this.sunLight.shadow.camera.left = -50, this.sunLight.shadow.camera.right = 50, this.sunLight.shadow.mapSize.x = 2048, this.sunLight.shadow.mapSize.y = 2048, this.sunLight.shadow.camera.near = 5, this.sunLight.shadow.camera.far = 350, this.sunLight.shadow.bias = -1e-3, this.sunLight.shadow.radius = 2, this.sunLight.visible = !0;
8445
8217
  const n = new mi(this.sunLight.shadow.camera);
8446
8218
  n.visible = !1, this.addObject(e), this.addObject(t), this.addObject(i), this.addObject(s), this.addObject(this.sunLight), this.addObject(n), this.lights.push(e), this.lights.push(t), this.lights.push(i), this.lights.push(s), this.lights.push(this.sunLight), this.lightHelpers.push(n);
8447
8219
  }
8448
8220
  //#endregion
8449
8221
  addPivotPoint() {
8450
- const e = new Lt(1, 16, 16), t = new G({
8451
- color: D.hexToThreejsColor(y.accent)
8222
+ const e = new Dt(1, 16, 16), t = new q({
8223
+ color: R.hexToThreejsColor(y.accent)
8452
8224
  // transparent: true,
8453
8225
  // opacity: 0.5,
8454
8226
  }), i = new x(e, t);
@@ -8474,7 +8246,7 @@ class Mn {
8474
8246
  if (this.scene) {
8475
8247
  const e = new x(
8476
8248
  new Pt(1, 1, 1),
8477
- new J({ color: 16711680 })
8249
+ new K({ color: 16711680 })
8478
8250
  );
8479
8251
  e.castShadow = !0, e.receiveShadow = !0, this.addObject(e);
8480
8252
  }
@@ -8503,12 +8275,12 @@ class Mn {
8503
8275
  this.addObject(t);
8504
8276
  }
8505
8277
  addFullscreenQuad() {
8506
- const e = new oe(window.innerWidth, window.innerHeight);
8278
+ const e = new ae(window.innerWidth, window.innerHeight);
8507
8279
  this.fullScreenQuad = new x(e, this.fullScreenQuadMaterial), this.addObject(this.fullScreenQuad);
8508
8280
  }
8509
8281
  //#endregion
8510
8282
  }
8511
- const jt = new Float32Array([
8283
+ const Nt = new Float32Array([
8512
8284
  // Bottom face (Y = -1)
8513
8285
  -1,
8514
8286
  -1,
@@ -8584,7 +8356,7 @@ const jt = new Float32Array([
8584
8356
  -1,
8585
8357
  1,
8586
8358
  1
8587
- ]), En = [
8359
+ ]), xn = [
8588
8360
  new E(1, 0, 0),
8589
8361
  // 0: +X
8590
8362
  new E(-1, 0, 0),
@@ -8597,9 +8369,9 @@ const jt = new Float32Array([
8597
8369
  // 4: +Z
8598
8370
  new E(0, 0, -1)
8599
8371
  // 5: -Z
8600
- ], Ue = class Ue {
8372
+ ], Ge = class Ge {
8601
8373
  constructor(e) {
8602
- this.viralViewerApi = e, this._isGenerated = !1, this._isActive = !1, this._isVisible = !1, this._initialCenter = new E(), this._initialHalfSize = new E(), this._center = new E(), this._halfSize = new E(), this._boxOutline = null, this._outlineGeometry = null, this._outlineMaterial = null, this._hitBoxMesh = null, this._facePlaneMesh = null, this._dragAnchor = new Ft(), this._selectedFaceIndex = -1, this._clippingPlanes = [], this._transformedEdges = new Float32Array(72);
8374
+ this.viralViewerApi = e, this._isGenerated = !1, this._isActive = !1, this._isVisible = !1, this._initialCenter = new E(), this._initialHalfSize = new E(), this._center = new E(), this._halfSize = new E(), this._boxOutline = null, this._outlineGeometry = null, this._outlineMaterial = null, this._hitBoxMesh = null, this._facePlaneMesh = null, this._dragAnchor = new jt(), this._selectedFaceIndex = -1, this._clippingPlanes = [], this._transformedEdges = new Float32Array(72);
8603
8375
  }
8604
8376
  /** Whether section box is active (clipping enabled) */
8605
8377
  get isActive() {
@@ -8689,7 +8461,7 @@ const jt = new Float32Array([
8689
8461
  }
8690
8462
  const i = this._getFaceCenter(e);
8691
8463
  this._dragAnchor.position.copy(i), this._dragAnchor.updateMatrixWorld(!0), t.attach(this._dragAnchor), t.setMode("translate");
8692
- const s = En[e];
8464
+ const s = xn[e];
8693
8465
  t.showX = Math.abs(s.x) > 0.5, t.showY = Math.abs(s.y) > 0.5, t.showZ = Math.abs(s.z) > 0.5, this._positionFaceHighlight(e);
8694
8466
  }
8695
8467
  onDragAnchorChanged() {
@@ -8723,46 +8495,46 @@ const jt = new Float32Array([
8723
8495
  }
8724
8496
  // --- Private methods ---
8725
8497
  _initFromBoundingBox() {
8726
- const e = new N().setFromObject(this.viralViewerApi.viralScene.bimWorld);
8498
+ const e = new j().setFromObject(this.viralViewerApi.viralScene.bimWorld);
8727
8499
  e.getCenter(this._center), e.getSize(this._halfSize).multiplyScalar(0.5), this._initialCenter.copy(this._center), this._initialHalfSize.copy(this._halfSize), this._isGenerated = !0;
8728
8500
  }
8729
8501
  _createVisuals() {
8730
8502
  if (this._boxOutline)
8731
8503
  return;
8732
- this._outlineMaterial = new Xt({
8733
- color: D.hexToThreejsColor(y.accent),
8504
+ this._outlineMaterial = new Zt({
8505
+ color: R.hexToThreejsColor(y.accent),
8734
8506
  linewidth: 2,
8735
- resolution: new z(window.innerWidth, window.innerHeight),
8507
+ resolution: new H(window.innerWidth, window.innerHeight),
8736
8508
  worldUnits: !1,
8737
8509
  transparent: !1,
8738
8510
  depthTest: !0,
8739
8511
  depthWrite: !0
8740
- }), this._outlineGeometry = new qi(), this._outlineGeometry.setPositions(jt), this._boxOutline = new Ui(this._outlineGeometry, this._outlineMaterial), this._boxOutline.name = "SectionBoxOutline", this._boxOutline.renderOrder = 0, this._boxOutline.frustumCulled = !1, this.viralViewerApi.viralScene.addObject(this._boxOutline);
8741
- const e = new Pt(2, 2, 2), t = new G({
8512
+ }), this._outlineGeometry = new qi(), this._outlineGeometry.setPositions(Nt), this._boxOutline = new Ui(this._outlineGeometry, this._outlineMaterial), this._boxOutline.name = "SectionBoxOutline", this._boxOutline.renderOrder = 0, this._boxOutline.frustumCulled = !1, this.viralViewerApi.viralScene.addObject(this._boxOutline);
8513
+ const e = new Pt(2, 2, 2), t = new q({
8742
8514
  transparent: !0,
8743
8515
  opacity: 0,
8744
- side: te,
8516
+ side: J,
8745
8517
  depthWrite: !1,
8746
8518
  depthTest: !1
8747
8519
  });
8748
8520
  this._hitBoxMesh = new x(e, t), this._hitBoxMesh.name = "SectionBoxHit", this._hitBoxMesh.visible = !0, this._hitBoxMesh.renderOrder = -1, this.viralViewerApi.viralScene.addObject(this._hitBoxMesh);
8749
- const i = new G({
8750
- color: D.hexToThreejsColor(y.accent),
8521
+ const i = new q({
8522
+ color: R.hexToThreejsColor(y.accent),
8751
8523
  transparent: !0,
8752
8524
  opacity: 0.15,
8753
- side: te,
8525
+ side: J,
8754
8526
  depthWrite: !1,
8755
8527
  depthTest: !1,
8756
8528
  polygonOffset: !0,
8757
8529
  polygonOffsetFactor: 1,
8758
8530
  polygonOffsetUnits: 1
8759
8531
  });
8760
- this._facePlaneMesh = new x(new oe(1, 1), i), this._facePlaneMesh.name = "SectionBoxFaceHighlight", this._facePlaneMesh.visible = !1, this._facePlaneMesh.renderOrder = 997, this.viralViewerApi.viralScene.addObject(this._facePlaneMesh), this._dragAnchor.name = "SectionBoxDragAnchor", this.viralViewerApi.viralScene.scene.add(this._dragAnchor);
8532
+ this._facePlaneMesh = new x(new ae(1, 1), i), this._facePlaneMesh.name = "SectionBoxFaceHighlight", this._facePlaneMesh.visible = !1, this._facePlaneMesh.renderOrder = 997, this.viralViewerApi.viralScene.addObject(this._facePlaneMesh), this._dragAnchor.name = "SectionBoxDragAnchor", this.viralViewerApi.viralScene.scene.add(this._dragAnchor);
8761
8533
  }
8762
8534
  _updateVisuals() {
8763
8535
  if (!this._boxOutline || !this._outlineGeometry || !this._hitBoxMesh)
8764
8536
  return;
8765
- const e = Ue.VISUAL_INSET, t = this._center.x, i = this._center.y, s = this._center.z, n = this._halfSize.x * (1 - e), r = this._halfSize.y * (1 - e), o = this._halfSize.z * (1 - e), a = jt, l = this._transformedEdges;
8537
+ const e = Ge.VISUAL_INSET, t = this._center.x, i = this._center.y, s = this._center.z, n = this._halfSize.x * (1 - e), r = this._halfSize.y * (1 - e), o = this._halfSize.z * (1 - e), a = Nt, l = this._transformedEdges;
8766
8538
  for (let c = 0; c < 72; c += 3)
8767
8539
  l[c] = t + n * a[c], l[c + 1] = i + r * a[c + 1], l[c + 2] = s + o * a[c + 2];
8768
8540
  if (this._outlineGeometry.setPositions(l), this._boxOutline.computeLineDistances(), this._boxOutline.geometry.computeBoundingSphere(), this._hitBoxMesh.position.copy(this._center), this._hitBoxMesh.scale.copy(this._halfSize), this._hitBoxMesh.updateMatrixWorld(!0), this._outlineMaterial) {
@@ -8812,7 +8584,7 @@ const jt = new Float32Array([
8812
8584
  _positionFaceHighlight(e) {
8813
8585
  if (!this._facePlaneMesh)
8814
8586
  return;
8815
- const t = this._center, i = Ue.VISUAL_INSET, s = this._halfSize.x * (1 - i), n = this._halfSize.y * (1 - i), r = this._halfSize.z * (1 - i);
8587
+ const t = this._center, i = Ge.VISUAL_INSET, s = this._halfSize.x * (1 - i), n = this._halfSize.y * (1 - i), r = this._halfSize.z * (1 - i);
8816
8588
  switch (this._facePlaneMesh.visible = !0, this._facePlaneMesh.rotation.set(0, 0, 0), e) {
8817
8589
  case 0:
8818
8590
  this._facePlaneMesh.scale.set(r * 2, n * 2, 1), this._facePlaneMesh.position.set(t.x + s, t.y, t.z), this._facePlaneMesh.rotation.y = Math.PI / 2;
@@ -8862,9 +8634,9 @@ const jt = new Float32Array([
8862
8634
  );
8863
8635
  }
8864
8636
  };
8865
- Ue.VISUAL_INSET = 2e-3;
8866
- let Vt = Ue;
8867
- var We = () => {
8637
+ Ge.VISUAL_INSET = 2e-3;
8638
+ let Vt = Ge;
8639
+ var Fe = () => {
8868
8640
  var g = 0, e = document.createElement("div");
8869
8641
  e.style.cssText = "position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000", e.addEventListener(
8870
8642
  "click",
@@ -8881,9 +8653,9 @@ var We = () => {
8881
8653
  e.children[h].style.display = h === c ? "block" : "none";
8882
8654
  g = c;
8883
8655
  }
8884
- var s = (performance || Date).now(), n = s, r = 0, o = t(We.Panel("FPS", "#0ff", "#002")), a = t(We.Panel("MS", "#0f0", "#020"));
8656
+ var s = (performance || Date).now(), n = s, r = 0, o = t(Fe.Panel("FPS", "#0ff", "#002")), a = t(Fe.Panel("MS", "#0f0", "#020"));
8885
8657
  if (self.performance && self.performance.memory)
8886
- var l = t(We.Panel("MB", "#f08", "#201"));
8658
+ var l = t(Fe.Panel("MB", "#f08", "#201"));
8887
8659
  return i(0), {
8888
8660
  REVISION: 16,
8889
8661
  dom: e,
@@ -8912,7 +8684,7 @@ var We = () => {
8912
8684
  setMode: i
8913
8685
  };
8914
8686
  };
8915
- We.Panel = (g, e, t) => {
8687
+ Fe.Panel = (g, e, t) => {
8916
8688
  var i = 1 / 0, s = 0, n = Math.round, r = n(window.devicePixelRatio || 1), o = 80 * r, a = 48 * r, l = 3 * r, c = 2 * r, h = 3 * r, d = 15 * r, u = 74 * r, p = 30 * r, m = document.createElement("canvas");
8917
8689
  m.width = o, m.height = a, m.style.cssText = "width:80px;height:48px";
8918
8690
  var f = m.getContext("2d");
@@ -8942,14 +8714,14 @@ We.Panel = (g, e, t) => {
8942
8714
  }
8943
8715
  };
8944
8716
  };
8945
- class Sn {
8717
+ class Mn {
8946
8718
  constructor(e) {
8947
- this.viralViewerApi = e, this.stats = null, this.viralViewerApi.targetElement && (this.stats = We(), this.stats.showPanel(0), this.viralViewerApi.targetElement.appendChild(this.stats.dom));
8719
+ this.viralViewerApi = e, this.stats = null, this.viralViewerApi.targetElement && (this.stats = Fe(), this.stats.showPanel(0), this.viralViewerApi.targetElement.appendChild(this.stats.dom));
8948
8720
  }
8949
8721
  }
8950
- class Cn {
8722
+ class En {
8951
8723
  constructor(e) {
8952
- this.viralViewerApi = e, this._selectionOutlineEnabled = !0, this.exceptElements = [], this.isolateModelId = "0", this.sunConfiguration = is, this._ground = null, this._alphaSelectionOutlineEnabled = !1, this.opacity = 1, this._fog = new bi(13421772, 1, 1e3), this.rainGeometry = new Z(), this.rain = null, this._isGeneratedRain = !1, this.ghostMode = !0, this._batchColors = /* @__PURE__ */ new Map(), this._originalBatchMaterials = /* @__PURE__ */ new Map(), this._batchVisualizationEnabled = !1, this.showHidePercentage = 100, this.randomColor = 100;
8724
+ this.viralViewerApi = e, this._selectionOutlineEnabled = !0, this.exceptElements = [], this.isolateModelId = "0", this.sunConfiguration = ts, this._ground = null, this.opacity = 1, this._fog = new bi(13421772, 1, 1e3), this.rainGeometry = new ne(), this.rain = null, this._isGeneratedRain = !1, this.ghostMode = !0, this._batchColors = /* @__PURE__ */ new Map(), this._originalBatchMaterials = /* @__PURE__ */ new Map(), this._batchVisualizationEnabled = !1, this.showHidePercentage = 100, this.randomColor = 100;
8953
8725
  }
8954
8726
  /**
8955
8727
  * show all elements and reset back to normal visualization
@@ -8958,10 +8730,20 @@ class Cn {
8958
8730
  this.viralViewerApi.viralScene.bimWorld.resetVisibility(), this.viralViewerApi.viralRenderer.render();
8959
8731
  }
8960
8732
  /**
8961
- * hide all elements and reset back to normal visualization
8733
+ * Hide all elements (sets all meshes invisible)
8962
8734
  */
8963
8735
  hideAllElements() {
8964
- this.viralViewerApi.viralScene.bimWorld.isolate([]), this.viralViewerApi.viralRenderer.render();
8736
+ const e = this.viralViewerApi.viralScene.bimWorld, t = [];
8737
+ for (const i of this.viralViewerApi.viralScene.bimWorld.bimModels) {
8738
+ const s = i.modelId.toString();
8739
+ for (const n of i.elements)
8740
+ for (const r of n.Instances)
8741
+ t.push({
8742
+ modelId: s,
8743
+ elementId: r.Id
8744
+ });
8745
+ }
8746
+ e.hide(t), this.viralViewerApi.viralRenderer.render();
8965
8747
  }
8966
8748
  /**
8967
8749
  *
@@ -9008,7 +8790,7 @@ class Cn {
9008
8790
  * Select elements (replaces current selection)
9009
8791
  */
9010
8792
  selectElements(e) {
9011
- e.length > 0 && (this.viralViewerApi.emit(R.SELECT_ELEMENTS, e), this.viralViewerApi.viralScene.bimWorld.select(e, this.exceptElements), this.updateSelectionOutline(), this.updateAlphaSelectionOutline(), this.viralViewerApi.viralRenderer.render());
8793
+ e.length > 0 && (this.viralViewerApi.emit(k.SELECT_ELEMENTS, e), this.viralViewerApi.viralScene.bimWorld.select(e, this.exceptElements), this.notifySelectionOutline(!0), this.viralViewerApi.viralRenderer.render());
9012
8794
  }
9013
8795
  /**
9014
8796
  * Add elements to current selection (multi-select with Shift)
@@ -9027,13 +8809,13 @@ class Cn {
9027
8809
  ) || s.push(r);
9028
8810
  });
9029
8811
  const n = [...s, ...i];
9030
- n.length > 0 ? (this.viralViewerApi.viralScene.bimWorld.select(n, this.exceptElements), this.updateSelectionOutline(), this.updateAlphaSelectionOutline(), this.viralViewerApi.viralRenderer.render()) : this.unselectElements();
8812
+ n.length > 0 ? (this.viralViewerApi.viralScene.bimWorld.select(n, this.exceptElements), this.notifySelectionOutline(!0), this.viralViewerApi.viralRenderer.render()) : this.unselectElements();
9031
8813
  }
9032
8814
  /**
9033
8815
  * Unselect all elements
9034
8816
  */
9035
8817
  unselectElements() {
9036
- this.viralViewerApi.viralScene.bimWorld.unselect(), this.viralViewerApi.emit(R.UNSELECT_ELEMENTS), this.updateSelectionOutline(), this.updateAlphaSelectionOutline(), this.viralViewerApi.viralRenderer.render();
8818
+ this.viralViewerApi.viralScene.bimWorld.unselect(), this.viralViewerApi.emit(k.UNSELECT_ELEMENTS), this.notifySelectionOutline(!1), this.viralViewerApi.viralRenderer.render();
9037
8819
  }
9038
8820
  selectAllElements() {
9039
8821
  console.time("⏱️ selectAllElements - gathering elements");
@@ -9073,15 +8855,15 @@ class Cn {
9073
8855
  this.viralViewerApi.viralScene.sunLight && (this.viralViewerApi.viralScene.sunLight.castShadow = !1), this.viralViewerApi.viralRenderer.render();
9074
8856
  }
9075
8857
  _adjustLightForMesh(e, t) {
9076
- const i = new N().setFromObject(e), s = i.min, n = i.max, r = s.distanceTo(n), o = i.getCenter(new E()), a = t.shadow.camera;
8858
+ const i = new j().setFromObject(e), s = i.min, n = i.max, r = s.distanceTo(n), o = i.getCenter(new E()), a = t.shadow.camera;
9077
8859
  a.left = -r / 2, a.right = r / 2, a.top = r / 2, a.bottom = -r / 2, a.near = 0.1, a.far = r + t.position.distanceTo(o), t.position.set(o.x + r / 2, o.y + r / 2, o.z + r / 2), t.target.position.copy(o), t.shadow.camera.updateProjectionMatrix(), t.castShadow = !0;
9078
8860
  }
9079
8861
  _updateDirectLights(e, t) {
9080
- const i = D.mergeBoundingBoxes(e), s = i.min, n = i.max;
8862
+ const i = R.mergeBoundingBoxes(e), s = i.min, n = i.max;
9081
8863
  s.distanceTo(n);
9082
8864
  const r = i.getCenter(new E()), o = this.sunConfiguration.elevation, a = this.sunConfiguration.azimuth, l = this.sunConfiguration.radius || 0;
9083
- this.sunConfiguration.castShadow !== void 0 && (t.castShadow = this.sunConfiguration.castShadow), this.sunConfiguration.intensity !== void 0 && (t.intensity = this.sunConfiguration.intensity), t.color = new k(this.sunConfiguration.color), this.sunConfiguration.enabled !== void 0 && (t.visible = this.sunConfiguration.enabled), t.position.copy(r);
9084
- const c = i.getBoundingSphere(new Gt()), h = new Wt(c.radius + l, o, a);
8865
+ this.sunConfiguration.castShadow !== void 0 && (t.castShadow = this.sunConfiguration.castShadow), this.sunConfiguration.intensity !== void 0 && (t.intensity = this.sunConfiguration.intensity), t.color = new $(this.sunConfiguration.color), this.sunConfiguration.enabled !== void 0 && (t.visible = this.sunConfiguration.enabled), t.position.copy(r);
8866
+ const c = i.getBoundingSphere(new Ft()), h = new Ht(c.radius + l, o, a);
9085
8867
  t.position.setFromSpherical(h), t.position.add(r), t.updateWorldMatrix(!0, !0), t.shadow.updateMatrices(t), this._updateLightShadowCamera(t, i), this.viralViewerApi.viralScene.sunSphere.position.copy(t.position);
9086
8868
  }
9087
8869
  _updateLightShadowCamera(e, t) {
@@ -9096,7 +8878,7 @@ class Cn {
9096
8878
  new E(s.x, s.y, s.z)
9097
8879
  ];
9098
8880
  n.forEach((o) => o.applyMatrix4(e.shadow.camera.matrixWorldInverse));
9099
- const r = new N().setFromPoints(n);
8881
+ const r = new j().setFromPoints(n);
9100
8882
  e.shadow.camera.left = r.min.x, e.shadow.camera.right = r.max.x, e.shadow.camera.top = r.min.y, e.shadow.camera.bottom = r.max.y, e.shadow.camera.near = Math.abs(r.max.z), e.shadow.camera.far = Math.abs(r.min.z), e.shadow.camera.updateProjectionMatrix(), this.viralViewerApi.viralRenderer.renderer.shadowMap.needsUpdate = !0;
9101
8883
  }
9102
8884
  //#endregion
@@ -9177,7 +8959,7 @@ class Cn {
9177
8959
  enableAllWhite() {
9178
8960
  this.viralViewerApi.viralMaterialManager.mergeMaterials.forEach(
9179
8961
  (e) => {
9180
- e.vertexColors = !1, e.color = new k(16448250), e.needsUpdate = !0;
8962
+ e.vertexColors = !1, e.color = new $(16448250), e.needsUpdate = !0;
9181
8963
  }
9182
8964
  ), this.viralViewerApi.viralRenderer.render();
9183
8965
  }
@@ -9210,18 +8992,18 @@ class Cn {
9210
8992
  if (this._ground)
9211
8993
  this._ground.visible = !0, this.viralViewerApi.viralRenderer.render();
9212
8994
  else {
9213
- let t = new N();
8995
+ let t = new j();
9214
8996
  if (e)
9215
- t = new N().setFromObject(e);
8997
+ t = new j().setFromObject(e);
9216
8998
  else {
9217
8999
  const a = [this.viralViewerApi.viralScene.bimWorld.bounds];
9218
- t = D.mergeBoundingBoxes(a);
9000
+ t = R.mergeBoundingBoxes(a);
9219
9001
  }
9220
9002
  const i = new E();
9221
9003
  t.getSize(i);
9222
- const s = t.max.x - t.min.x, n = t.max.z - t.min.z, r = t.min.y, o = new ee({
9004
+ const s = t.max.x - t.min.x, n = t.max.z - t.min.z, r = t.min.y, o = new le({
9223
9005
  uniforms: {
9224
- color: { value: new k(0) },
9006
+ color: { value: new $(0) },
9225
9007
  opacity: { value: 0.5 }
9226
9008
  },
9227
9009
  vertexShader: `
@@ -9244,7 +9026,7 @@ class Cn {
9244
9026
  transparent: !0
9245
9027
  });
9246
9028
  this._ground = new x(
9247
- new oe(s * 1.5, n * 1.5),
9029
+ new ae(s * 1.5, n * 1.5),
9248
9030
  o
9249
9031
  // Semi-transparent shadow material
9250
9032
  ), this._ground.rotation.x = -Math.PI / 2, this._ground.position.set(
@@ -9284,8 +9066,8 @@ class Cn {
9284
9066
  for (let i = 0; i < t.length; i++) {
9285
9067
  const s = t[i];
9286
9068
  if (s.buffer) {
9287
- const n = new Z();
9288
- n.setAttribute("position", new L(s.buffer, 3));
9069
+ const n = new ne();
9070
+ n.setAttribute("position", new z(s.buffer, 3));
9289
9071
  const r = new x(
9290
9072
  n,
9291
9073
  this.viralViewerApi.viralMaterialManager.outlineMaterial
@@ -9300,11 +9082,20 @@ class Cn {
9300
9082
  * Uses merged geometry for efficient rendering
9301
9083
  */
9302
9084
  updateSelectionOutline() {
9303
- var t;
9304
9085
  if (!this._selectionOutlineEnabled)
9305
9086
  return;
9306
- const e = this.viralViewerApi.viralScene.bimWorld.getSelectedElementsPositions();
9307
- (t = this.viralViewerApi.viralRenderer.postProcessingRenderer) == null || t.updateSelectionOutline(e);
9087
+ const e = this.viralViewerApi.viralScene.bimWorld.getSelectedElements().length > 0;
9088
+ this.notifySelectionOutline(e);
9089
+ }
9090
+ /**
9091
+ * Notify the outline pass whether there is an active selection.
9092
+ * The GPU reads selection state directly from vertex colors — no CPU work needed.
9093
+ */
9094
+ notifySelectionOutline(e) {
9095
+ var t;
9096
+ this._selectionOutlineEnabled || (e = !1), (t = this.viralViewerApi.viralRenderer.postProcessingRenderer) == null || t.setSelectionOutlineActive(
9097
+ e
9098
+ );
9308
9099
  }
9309
9100
  /**
9310
9101
  * Enable selection outline effect
@@ -9325,8 +9116,13 @@ class Cn {
9325
9116
  * @param enabled - true to enable outline on selection, false to disable
9326
9117
  */
9327
9118
  setSelectionOutlineMode(e) {
9328
- var t;
9329
- this._selectionOutlineEnabled = e, e ? (this.enableSelectionOutline(), this.updateSelectionOutline()) : ((t = this.viralViewerApi.viralRenderer.postProcessingRenderer) == null || t.updateSelectionOutline(null), this.disableSelectionOutline()), this.viralViewerApi.viralRenderer.render();
9119
+ if (this._selectionOutlineEnabled = e, e) {
9120
+ this.enableSelectionOutline();
9121
+ const t = this.viralViewerApi.viralScene.bimWorld.getSelectedElements().length > 0;
9122
+ this.notifySelectionOutline(t);
9123
+ } else
9124
+ this.notifySelectionOutline(!1), this.disableSelectionOutline();
9125
+ this.viralViewerApi.viralRenderer.render();
9330
9126
  }
9331
9127
  /**
9332
9128
  * Get whether selection outline mode is enabled
@@ -9334,83 +9130,24 @@ class Cn {
9334
9130
  get selectionOutlineEnabled() {
9335
9131
  return this._selectionOutlineEnabled;
9336
9132
  }
9337
- /**
9338
- * Update alpha selection outline state
9339
- * This is MUCH faster than updateSelectionOutline() - no geometry copying needed
9340
- */
9341
- updateAlphaSelectionOutline() {
9342
- var t;
9343
- if (!this._alphaSelectionOutlineEnabled)
9344
- return;
9345
- const e = this.viralViewerApi.viralScene.bimWorld.getSelectedElements().length > 0;
9346
- (t = this.viralViewerApi.viralRenderer.postProcessingRenderer) == null || t.updateAlphaSelectionOutline(
9347
- e
9348
- );
9349
- }
9350
- /**
9351
- * Enable alpha selection outline effect
9352
- * This is the FAST outline mode - constant cost regardless of selection size
9353
- */
9354
- enableAlphaSelectionOutline() {
9355
- var e;
9356
- (e = this.viralViewerApi.viralRenderer.postProcessingRenderer) == null || e.enableAlphaSelectionOutline();
9357
- }
9358
- /**
9359
- * Disable alpha selection outline effect
9360
- */
9361
- disableAlphaSelectionOutline() {
9362
- var e;
9363
- (e = this.viralViewerApi.viralRenderer.postProcessingRenderer) == null || e.disableAlphaSelectionOutline();
9364
- }
9365
- /**
9366
- * Set whether alpha selection outline mode is enabled
9367
- * This is the recommended mode for large selections (1000+ elements)
9368
- * @param enabled - true to enable, false to disable
9369
- */
9370
- setAlphaSelectionOutlineMode(e) {
9371
- var t;
9372
- this._alphaSelectionOutlineEnabled = e, e ? (this.enableAlphaSelectionOutline(), this.updateAlphaSelectionOutline()) : ((t = this.viralViewerApi.viralRenderer.postProcessingRenderer) == null || t.updateAlphaSelectionOutline(
9373
- !1
9374
- ), this.disableAlphaSelectionOutline()), this.viralViewerApi.viralRenderer.render();
9375
- }
9376
- /**
9377
- * Get whether alpha selection outline mode is enabled
9378
- */
9379
- get alphaSelectionOutlineEnabled() {
9380
- return this._alphaSelectionOutlineEnabled;
9381
- }
9382
- /**
9383
- * Bypass alpha selection outline (fast, for camera movement)
9384
- */
9385
- bypassAlphaSelectionOutline() {
9386
- var e;
9387
- (e = this.viralViewerApi.viralRenderer.postProcessingRenderer) == null || e.bypassAlphaSelectionOutline();
9388
- }
9389
- /**
9390
- * Resume alpha selection outline after bypass
9391
- */
9392
- resumeAlphaSelectionOutline() {
9393
- var e;
9394
- (e = this.viralViewerApi.viralRenderer.postProcessingRenderer) == null || e.resumeAlphaSelectionOutline();
9395
- }
9396
9133
  //#endregion
9397
9134
  //#region night
9398
9135
  enableNight() {
9399
9136
  this.viralViewerApi.viralScene.lights.forEach((e) => {
9400
9137
  e.name !== de.sunlight && (e.visible = !1);
9401
9138
  }), this.viralViewerApi.viralMaterialManager.mergeMaterials.forEach((e) => {
9402
- e instanceof J && e.transparent && (e.emissiveIntensity = 0.5);
9139
+ e instanceof K && e.transparent && (e.emissiveIntensity = 0.5);
9403
9140
  }), this.viralViewerApi.viralScene.bimWorld.children.forEach((e) => {
9404
- e.material instanceof J && e.material.transparent && e.enableLights && e.enableLights();
9141
+ e.material instanceof K && e.material.transparent && e.enableLights && e.enableLights();
9405
9142
  }), this.viralViewerApi.viralRenderer.render();
9406
9143
  }
9407
9144
  disableNight() {
9408
9145
  this.viralViewerApi.viralScene.lights.forEach((e) => {
9409
9146
  e.name !== de.sunlight && (e.visible = !0);
9410
9147
  }), this.viralViewerApi.viralMaterialManager.mergeMaterials.forEach((e) => {
9411
- e instanceof J && e.transparent && (e.emissiveIntensity = 0);
9148
+ e instanceof K && e.transparent && (e.emissiveIntensity = 0);
9412
9149
  }), this.viralViewerApi.viralScene.bimWorld.children.forEach((e) => {
9413
- e.material instanceof J && e.material.transparent && e.disableLights && e.disableLights();
9150
+ e.material instanceof K && e.material.transparent && e.disableLights && e.disableLights();
9414
9151
  }), this.viralViewerApi.viralRenderer.render();
9415
9152
  }
9416
9153
  //#endregion
@@ -9453,14 +9190,14 @@ class Cn {
9453
9190
  const e = this.viralViewerApi.viralScene.bimWorld.bounds, t = 1e4, i = new Float32Array(t * 3);
9454
9191
  for (let n = 0; n < t; n++)
9455
9192
  i[n * 3] = Math.random() * (e.max.x - e.min.x) + e.min.x, i[n * 3 + 1] = Math.random() * (e.max.y + 100 - e.min.y) + e.min.y, i[n * 3 + 2] = Math.random() * (e.max.z - e.min.z) + e.min.z;
9456
- this.rainGeometry.setAttribute("position", new L(i, 3));
9193
+ this.rainGeometry.setAttribute("position", new z(i, 3));
9457
9194
  const s = new wi({
9458
9195
  color: 11184810,
9459
9196
  size: 0.2,
9460
9197
  transparent: !0,
9461
9198
  opacity: 0.8
9462
9199
  });
9463
- this.rain = new St(this.rainGeometry, s), this.viralViewerApi.viralScene.addObject(this.rain), this._isGeneratedRain = !0;
9200
+ this.rain = new Et(this.rainGeometry, s), this.viralViewerApi.viralScene.addObject(this.rain), this._isGeneratedRain = !0;
9464
9201
  }
9465
9202
  this.rain && (this.rain.visible = !0), this.viralViewerApi.viralAnimation.toggleRain(!0);
9466
9203
  }
@@ -9533,7 +9270,7 @@ class Cn {
9533
9270
  generateLOD() {
9534
9271
  this.viralViewerApi.viralScene.bimWorld.children.forEach((e) => {
9535
9272
  if (e.isMesh) {
9536
- const t = new yi(), i = D.createLowResMesh(e, 0.5);
9273
+ const t = new yi(), i = R.createLowResMesh(e, 0.5);
9537
9274
  t.addLevel(e, 50), t.addLevel(i, 200), this.viralViewerApi.viralScene.bimWorld.add(t), this.viralViewerApi.viralScene.bimWorld.remove(e);
9538
9275
  }
9539
9276
  });
@@ -9542,7 +9279,7 @@ class Cn {
9542
9279
  * Generate a random but distinct color for each material ID
9543
9280
  */
9544
9281
  _generateDistinctColor(e) {
9545
- const i = e * 0.618033988749895 % 1, s = 0.7 + Math.sin(e * 0.5) * 0.3, n = 0.5 + Math.cos(e * 0.7) * 0.2, r = new k();
9282
+ const i = e * 0.618033988749895 % 1, s = 0.7 + Math.sin(e * 0.5) * 0.3, n = 0.5 + Math.cos(e * 0.7) * 0.2, r = new $();
9546
9283
  return r.setHSL(i, s, n), r;
9547
9284
  }
9548
9285
  /**
@@ -9558,7 +9295,7 @@ class Cn {
9558
9295
  i,
9559
9296
  this._generateDistinctColor(i)
9560
9297
  );
9561
- const s = this._batchColors.get(i), n = new J({
9298
+ const s = this._batchColors.get(i), n = new K({
9562
9299
  color: s,
9563
9300
  roughness: 0.7,
9564
9301
  metalness: 0.2,
@@ -9641,7 +9378,7 @@ class Cn {
9641
9378
  }
9642
9379
  //#endregion
9643
9380
  }
9644
- class An {
9381
+ class Cn {
9645
9382
  constructor(e) {
9646
9383
  this.viralViewerApi = e, this.contextMenu = null, this.contextItems = [], this.injectContextMenu();
9647
9384
  }
@@ -9674,7 +9411,7 @@ class An {
9674
9411
  for (let i = 0; i < this.contextItems.length; i++) {
9675
9412
  if (e.findIndex((l) => l == this.contextItems[i][0]) < 0)
9676
9413
  continue;
9677
- const [s, n, r, o] = this.contextItems[i], a = bt.createElementFromHTML(
9414
+ const [s, n, r, o] = this.contextItems[i], a = ft.createElementFromHTML(
9678
9415
  `<div class="hover-element" style="padding: 5px 10px; cursor: pointer; color:${y.primary}; display:flex; align-items:center">${r} <p style="margin:0px !important;padding-left:5px">${n}</p></div>`
9679
9416
  );
9680
9417
  a.addEventListener("click", (l) => {
@@ -9691,7 +9428,7 @@ class An {
9691
9428
  this.contextItems.push([e, t, i, s]);
9692
9429
  }
9693
9430
  }
9694
- class _n {
9431
+ class Sn {
9695
9432
  constructor(e) {
9696
9433
  this.viralViewerApi = e, this.modal = null, this.modalTitle = null, this.modalBody = null, this.modalBodyLeft = null, this.modalBodyRight = null, this.properties = null, this.rawModal = `<div class="modal" id="myModal">
9697
9434
  <div class="modal-content">
@@ -9801,7 +9538,7 @@ class _n {
9801
9538
  inject() {
9802
9539
  if (this.viralViewerApi.targetElement) {
9803
9540
  const e = document.createElement("style");
9804
- e.innerHTML = this.rawModalStyle, document.head.appendChild(e), this.modal = bt.createElementFromHTML(this.rawModal), this.viralViewerApi.targetElement.appendChild(this.modal);
9541
+ e.innerHTML = this.rawModalStyle, document.head.appendChild(e), this.modal = ft.createElementFromHTML(this.rawModal), this.viralViewerApi.targetElement.appendChild(this.modal);
9805
9542
  const t = this.viralViewerApi.targetElement.getBoundingClientRect(), i = this.modal.querySelector(".modal-content");
9806
9543
  i && (i.style.maxHeight = `${t.height - 20}px`);
9807
9544
  const s = document.getElementById("modal-header"), n = document.getElementById("resizeHandle"), r = document.getElementById("column-resizer");
@@ -9887,17 +9624,17 @@ const Jt = {
9887
9624
  importLink: "https://fonts.googleapis.com/css2?family=Quicksand:wght@300&display=swap",
9888
9625
  fontFamily: "Quicksand, sans-serif"
9889
9626
  }
9890
- }, In = (g) => {
9627
+ }, An = (g) => {
9891
9628
  const e = document.createElement("style");
9892
9629
  e.innerHTML = `@import url(${Jt[g]});`, document.head.appendChild(e);
9893
- }, Vn = (g, e) => {
9630
+ }, _n = (g, e) => {
9894
9631
  const t = Jt[e];
9895
9632
  g && t && (g.style.fontFamily = t.fontFamily);
9896
9633
  };
9897
- class Tn {
9634
+ class Vn {
9898
9635
  constructor(e) {
9899
9636
  this.viralNavigationCube = e, this._mouseDownTime = null, this.clickThreshold = 250, this._handleClick = async (t) => {
9900
- var c, h, d, u, p, m, f, v, b, w, S, A, C, M, _, I, O, V, T, j, H;
9637
+ var c, h, d, u, p, m, f, v, b, w, C, A, S, _, V, T, M, I, D, B, P;
9901
9638
  if (!((c = this.viralNavigationCube.cubeScene) != null && c.activePlane) || (h = this.viralNavigationCube.cubeCamera) != null && h.cameraControlHasMoved)
9902
9639
  return console.log("false"), !1;
9903
9640
  let i = new E(
@@ -9906,27 +9643,27 @@ class Tn {
9906
9643
  (p = this.viralNavigationCube.cubeScene) == null ? void 0 : p.activePlane.position.z
9907
9644
  );
9908
9645
  if (((m = this.viralNavigationCube.cubeScene) == null ? void 0 : m.activePlane.children.length) > 0) {
9909
- let q = 0, $ = 0, U = 0;
9910
- for (let F = 0; F < ((f = this.viralNavigationCube.cubeScene) == null ? void 0 : f.activePlane.children.length); F++) {
9911
- const W = (v = this.viralNavigationCube.cubeScene) == null ? void 0 : v.activePlane.children[F];
9912
- q += W.position.x, $ += W.position.y, U += W.position.z;
9646
+ let L = 0, F = 0, U = 0;
9647
+ for (let W = 0; W < ((f = this.viralNavigationCube.cubeScene) == null ? void 0 : f.activePlane.children.length); W++) {
9648
+ const G = (v = this.viralNavigationCube.cubeScene) == null ? void 0 : v.activePlane.children[W];
9649
+ L += G.position.x, F += G.position.y, U += G.position.z;
9913
9650
  }
9914
9651
  i = new E(
9915
- q / ((b = this.viralNavigationCube.cubeScene) == null ? void 0 : b.activePlane.children.length),
9916
- $ / ((w = this.viralNavigationCube.cubeScene) == null ? void 0 : w.activePlane.children.length),
9917
- U / ((S = this.viralNavigationCube.cubeScene) == null ? void 0 : S.activePlane.children.length)
9652
+ L / ((b = this.viralNavigationCube.cubeScene) == null ? void 0 : b.activePlane.children.length),
9653
+ F / ((w = this.viralNavigationCube.cubeScene) == null ? void 0 : w.activePlane.children.length),
9654
+ U / ((C = this.viralNavigationCube.cubeScene) == null ? void 0 : C.activePlane.children.length)
9918
9655
  );
9919
9656
  }
9920
9657
  const s = new E();
9921
9658
  (A = this.viralNavigationCube.cubeCamera) == null || A.cameraControls.getTarget(s);
9922
9659
  const n = i.clone().sub(s).normalize();
9923
- (_ = this.viralNavigationCube.cubeCamera) == null || _.cameraControlOldPosition.copy(
9924
- (M = (C = this.viralNavigationCube.cubeCamera) == null ? void 0 : C.camera) == null ? void 0 : M.position
9660
+ (V = this.viralNavigationCube.cubeCamera) == null || V.cameraControlOldPosition.copy(
9661
+ (_ = (S = this.viralNavigationCube.cubeCamera) == null ? void 0 : S.camera) == null ? void 0 : _.position
9925
9662
  );
9926
9663
  const r = new E();
9927
- (I = this.viralNavigationCube.viralViewerApi.viralCamera) == null || I.cameraControls.getTarget(r);
9664
+ (T = this.viralNavigationCube.viralViewerApi.viralCamera) == null || T.cameraControls.getTarget(r);
9928
9665
  const o = new E();
9929
- (O = this.viralNavigationCube.viralViewerApi.viralCamera) == null || O.cameraControls.getPosition(
9666
+ (M = this.viralNavigationCube.viralViewerApi.viralCamera) == null || M.cameraControls.getPosition(
9930
9667
  o
9931
9668
  );
9932
9669
  const a = o.clone().sub(r).length(), l = new E(
@@ -9934,73 +9671,73 @@ class Tn {
9934
9671
  Math.round(n.y),
9935
9672
  Math.round(n.z)
9936
9673
  );
9937
- l.multiplyScalar(a), (V = this.viralNavigationCube.viralViewerApi.viralCamera.camera) == null || V.updateMatrixWorld(), (T = this.viralNavigationCube.viralViewerApi.viralCamera.cameraControls) == null || T.setTarget(0, 0, 0), n.multiplyScalar(2), (j = this.viralNavigationCube.cubeCamera) == null || j.cameraControls.setPosition(
9674
+ l.multiplyScalar(a), (I = this.viralNavigationCube.viralViewerApi.viralCamera.camera) == null || I.updateMatrixWorld(), (D = this.viralNavigationCube.viralViewerApi.viralCamera.cameraControls) == null || D.setTarget(0, 0, 0), n.multiplyScalar(2), (B = this.viralNavigationCube.cubeCamera) == null || B.cameraControls.setPosition(
9938
9675
  n.x,
9939
9676
  n.y,
9940
9677
  n.z,
9941
9678
  !0
9942
- ), (H = this.viralNavigationCube.viralViewerApi.viralCamera.cameraControls) == null || H.setPosition(
9679
+ ), (P = this.viralNavigationCube.viralViewerApi.viralCamera.cameraControls) == null || P.setPosition(
9943
9680
  l.x,
9944
9681
  l.y,
9945
9682
  l.z,
9946
9683
  !0
9947
9684
  );
9948
9685
  }, this._handleMouseUp = async (t) => {
9949
- var i, s, n, r, o, a, l, c, h, d, u, p, m, f, v, b, w, S, A, C, M;
9686
+ var i, s, n, r, o, a, l, c, h, d, u, p, m, f, v, b, w, C, A, S, _;
9950
9687
  if (console.log(this._mouseDownTime), this._mouseDownTime !== null && performance.now() - this._mouseDownTime < this.clickThreshold) {
9951
9688
  if (!((i = this.viralNavigationCube.cubeScene) != null && i.activePlane) || (s = this.viralNavigationCube.cubeCamera) != null && s.cameraControlHasMoved)
9952
9689
  return console.log("false"), !1;
9953
- let O = new E(
9690
+ let M = new E(
9954
9691
  (n = this.viralNavigationCube.cubeScene) == null ? void 0 : n.activePlane.position.x,
9955
9692
  (r = this.viralNavigationCube.cubeScene) == null ? void 0 : r.activePlane.position.y,
9956
9693
  (o = this.viralNavigationCube.cubeScene) == null ? void 0 : o.activePlane.position.z
9957
9694
  );
9958
9695
  if (((a = this.viralNavigationCube.cubeScene) == null ? void 0 : a.activePlane.children.length) > 0) {
9959
- let U = 0, F = 0, W = 0;
9960
- for (let X = 0; X < ((l = this.viralNavigationCube.cubeScene) == null ? void 0 : l.activePlane.children.length); X++) {
9961
- const se = (c = this.viralNavigationCube.cubeScene) == null ? void 0 : c.activePlane.children[X];
9962
- U += se.position.x, F += se.position.y, W += se.position.z;
9696
+ let U = 0, W = 0, G = 0;
9697
+ for (let Y = 0; Y < ((l = this.viralNavigationCube.cubeScene) == null ? void 0 : l.activePlane.children.length); Y++) {
9698
+ const te = (c = this.viralNavigationCube.cubeScene) == null ? void 0 : c.activePlane.children[Y];
9699
+ U += te.position.x, W += te.position.y, G += te.position.z;
9963
9700
  }
9964
- O = new E(
9701
+ M = new E(
9965
9702
  U / ((h = this.viralNavigationCube.cubeScene) == null ? void 0 : h.activePlane.children.length),
9966
- F / ((d = this.viralNavigationCube.cubeScene) == null ? void 0 : d.activePlane.children.length),
9967
- W / ((u = this.viralNavigationCube.cubeScene) == null ? void 0 : u.activePlane.children.length)
9703
+ W / ((d = this.viralNavigationCube.cubeScene) == null ? void 0 : d.activePlane.children.length),
9704
+ G / ((u = this.viralNavigationCube.cubeScene) == null ? void 0 : u.activePlane.children.length)
9968
9705
  );
9969
9706
  }
9970
- const V = new E();
9707
+ const I = new E();
9971
9708
  (p = this.viralNavigationCube.cubeCamera) == null || p.cameraControls.getTarget(
9972
- V
9709
+ I
9973
9710
  );
9974
- const T = O.clone().sub(V).normalize();
9711
+ const D = M.clone().sub(I).normalize();
9975
9712
  (v = this.viralNavigationCube.cubeCamera) == null || v.cameraControlOldPosition.copy(
9976
9713
  (f = (m = this.viralNavigationCube.cubeCamera) == null ? void 0 : m.camera) == null ? void 0 : f.position
9977
9714
  );
9978
- const j = new E();
9715
+ const B = new E();
9979
9716
  (b = this.viralNavigationCube.viralViewerApi.viralCamera) == null || b.cameraControls.getTarget(
9980
- j
9717
+ B
9981
9718
  );
9982
- const H = new E();
9719
+ const P = new E();
9983
9720
  (w = this.viralNavigationCube.viralViewerApi.viralCamera) == null || w.cameraControls.getPosition(
9984
- H
9721
+ P
9985
9722
  );
9986
- const q = H.clone().sub(j).length(), $ = new E(
9987
- Math.round(T.x),
9988
- Math.round(T.y),
9989
- Math.round(T.z)
9723
+ const L = P.clone().sub(B).length(), F = new E(
9724
+ Math.round(D.x),
9725
+ Math.round(D.y),
9726
+ Math.round(D.z)
9990
9727
  );
9991
- $.multiplyScalar(q), (S = this.viralNavigationCube.viralViewerApi.viralCamera.camera) == null || S.updateMatrixWorld(), (A = this.viralNavigationCube.viralViewerApi.viralCamera.cameraControls) == null || A.setTarget(
9728
+ F.multiplyScalar(L), (C = this.viralNavigationCube.viralViewerApi.viralCamera.camera) == null || C.updateMatrixWorld(), (A = this.viralNavigationCube.viralViewerApi.viralCamera.cameraControls) == null || A.setTarget(
9992
9729
  0,
9993
9730
  0,
9994
9731
  0
9995
- ), T.multiplyScalar(2), (C = this.viralNavigationCube.cubeCamera) == null || C.cameraControls.setPosition(
9996
- T.x,
9997
- T.y,
9998
- T.z,
9732
+ ), D.multiplyScalar(2), (S = this.viralNavigationCube.cubeCamera) == null || S.cameraControls.setPosition(
9733
+ D.x,
9734
+ D.y,
9735
+ D.z,
9999
9736
  !0
10000
- ), (M = this.viralNavigationCube.viralViewerApi.viralCamera.cameraControls) == null || M.setPosition(
10001
- $.x,
10002
- $.y,
10003
- $.z,
9737
+ ), (_ = this.viralNavigationCube.viralViewerApi.viralCamera.cameraControls) == null || _.setPosition(
9738
+ F.x,
9739
+ F.y,
9740
+ F.z,
10004
9741
  !0
10005
9742
  );
10006
9743
  }
@@ -10015,7 +9752,7 @@ class Tn {
10015
9752
  }
10016
9753
  this.viralNavigationCube.cubeScene.activePlane = null;
10017
9754
  }
10018
- const i = t.offsetX, s = t.offsetY, n = (c = this.viralNavigationCube.cubeRenderer) == null ? void 0 : c.renderer.getSize(new z()), r = new z(i / n.width * 2 - 1, -s / n.height * 2 + 1), o = new Tt();
9755
+ const i = t.offsetX, s = t.offsetY, n = (c = this.viralNavigationCube.cubeRenderer) == null ? void 0 : c.renderer.getSize(new H()), r = new H(i / n.width * 2 - 1, -s / n.height * 2 + 1), o = new It();
10019
9756
  o.setFromCamera(r, (h = this.viralNavigationCube.cubeCamera) == null ? void 0 : h.camera);
10020
9757
  const a = o.intersectObjects((d = this.viralNavigationCube.cubeScene) == null ? void 0 : d.objects);
10021
9758
  if (a.length > 0 && a[0].object != ((u = this.viralNavigationCube.cubeScene) == null ? void 0 : u.cube)) {
@@ -10042,14 +9779,14 @@ class Tn {
10042
9779
  }
10043
9780
  //#endregion
10044
9781
  }
10045
- class Pn {
9782
+ class In {
10046
9783
  constructor(e) {
10047
9784
  this.viralNavigationCube = e, this.camera = null, this.cameraControls = null, this.cameraControlOldPosition = new E(), this.cameraControlNewPosition = new E(), this.cameraControlHasMoved = !1, this.setupCamera(), this.setupHandle();
10048
9785
  }
10049
9786
  setupCamera() {
10050
9787
  if (this.viralNavigationCube.targetElement && this.viralNavigationCube.cubeRenderer) {
10051
9788
  const e = this.viralNavigationCube.targetElement.offsetWidth, t = this.viralNavigationCube.targetElement.offsetHeight;
10052
- this.camera = new Fe(60, e / t, 0.01, 100), this.camera.position.set(0, 0, 2), this.cameraControls = new pe(
9789
+ this.camera = new He(60, e / t, 0.01, 100), this.camera.position.set(0, 0, 2), this.cameraControls = new pe(
10053
9790
  this.camera,
10054
9791
  this.viralNavigationCube.cubeRenderer.renderer.domElement
10055
9792
  ), this.cameraControls.dollyToCursor = !1, this.cameraControls.infinityDolly = !1, this.cameraControls.setTarget(0, 0, 0), this.cameraControls.polarRotateSpeed = 0.15, this.cameraControls.azimuthRotateSpeed = 0.15, this.cameraControls.mouseButtons.middle = pe.ACTION.NONE, this.cameraControls.mouseButtons.wheel = pe.ACTION.NONE, this.cameraControls.addEventListener("control", (i) => {
@@ -10080,9 +9817,9 @@ class Pn {
10080
9817
  window.addEventListener("mousedown", e, !1), window.addEventListener("mousemove", t, !1), window.addEventListener("touchstart", e, !1), window.addEventListener("touchmove", t, !0);
10081
9818
  }
10082
9819
  }
10083
- class On {
9820
+ class Tn {
10084
9821
  constructor(e) {
10085
- this.viralNavigationCube = e, this.renderer = new Qt({
9822
+ this.viralNavigationCube = e, this.renderer = new Ut({
10086
9823
  alpha: !0,
10087
9824
  antialias: !0,
10088
9825
  logarithmicDepthBuffer: !0
@@ -10115,9 +9852,9 @@ class On {
10115
9852
  // }
10116
9853
  // }
10117
9854
  }
10118
- class Dn {
9855
+ class Pn {
10119
9856
  constructor(e, t = 1) {
10120
- this.viralNavigationCube = e, this.scene = new vt(), this.objects = [], this.cube = null, this.activePlane = null, this.cubeScale = 1, this.cubeScale = Math.round(Math.max(0.1, Math.min(1, t)) * 10) / 10, this.addCube(), this.addPlanes();
9857
+ this.viralNavigationCube = e, this.scene = new Tt(), this.objects = [], this.cube = null, this.activePlane = null, this.cubeScale = 1, this.cubeScale = Math.round(Math.max(0.1, Math.min(1, t)) * 10) / 10, this.addCube(), this.addPlanes();
10121
9858
  }
10122
9859
  addObject(e) {
10123
9860
  this.scene.add(e), this.objects.push(e);
@@ -10128,7 +9865,7 @@ class Dn {
10128
9865
  n.font = 'bolder 12px "Open sans", Arial', n.textBaseline = "middle", n.textAlign = "center";
10129
9866
  const o = `${y.background}`;
10130
9867
  for (let l = 0; l < 6; l++)
10131
- t[l] == "TOP" || t[l] == "BOTTOM", n.fillStyle = o, n.fillRect(0, 0, r, r), n.strokeStyle = `${y.primary}`, n.setLineDash([8, 8]), n.lineWidth = 4, n.strokeRect(0, 0, r, r), n.fillStyle = `${y.primary}`, n.fillText(t[l], r / 2, r / 2), e[l] = new G({
9868
+ t[l] == "TOP" || t[l] == "BOTTOM", n.fillStyle = o, n.fillRect(0, 0, r, r), n.strokeStyle = `${y.primary}`, n.setLineDash([8, 8]), n.lineWidth = 4, n.strokeRect(0, 0, r, r), n.fillStyle = `${y.primary}`, n.fillText(t[l], r / 2, r / 2), e[l] = new q({
10132
9869
  map: i.load(s.toDataURL())
10133
9870
  });
10134
9871
  const a = this.cubeScale;
@@ -10136,13 +9873,13 @@ class Dn {
10136
9873
  }
10137
9874
  }
10138
9875
  addPlanes() {
10139
- const e = this.cubeScale, t = new G({
10140
- side: te,
9876
+ const e = this.cubeScale, t = new q({
9877
+ side: J,
10141
9878
  color: 6659921,
10142
9879
  transparent: !0,
10143
9880
  opacity: 0,
10144
9881
  depthTest: !1
10145
- }), i = 0.7 * e, s = 0.7 * e, n = 0.15 * e, r = new oe(i, i), o = new oe(n, s), a = new oe(n, n), l = 0.51 * e, c = new x(r, t.clone());
9882
+ }), i = 0.7 * e, s = 0.7 * e, n = 0.15 * e, r = new ae(i, i), o = new ae(n, s), a = new ae(n, n), l = 0.51 * e, c = new x(r, t.clone());
10146
9883
  c.position.z = l, c.name = "FRONT";
10147
9884
  const h = new x(o, t.clone());
10148
9885
  h.position.z = l, h.position.x = i / 2 + n / 2;
@@ -10162,46 +9899,46 @@ class Dn {
10162
9899
  b.position.z = l, b.position.x = -(i / 2 + n / 2), b.position.y = -(i / 2 + n / 2);
10163
9900
  const w = new x(r, t.clone());
10164
9901
  w.position.z = -l, w.name = "BACK";
10165
- const S = new x(o, t.clone());
10166
- S.position.z = -l, S.position.x = i / 2 + n / 2;
9902
+ const C = new x(o, t.clone());
9903
+ C.position.z = -l, C.position.x = i / 2 + n / 2;
10167
9904
  const A = new x(o, t.clone());
10168
9905
  A.position.z = -l, A.position.x = -(i / 2 + n / 2);
10169
- const C = new x(o, t.clone());
10170
- C.position.z = -l, C.rotation.z = Math.PI / 2, C.position.y = i / 2 + n / 2;
10171
- const M = new x(o, t.clone());
10172
- M.position.z = -l, M.rotation.z = Math.PI / 2, M.position.y = -(i / 2 + n / 2);
10173
- const _ = new x(a, t.clone());
10174
- _.position.z = -l, _.position.x = i / 2 + n / 2, _.position.y = i / 2 + n / 2;
10175
- const I = new x(a, t.clone());
10176
- I.position.z = -l, I.position.x = -(i / 2 + n / 2), I.position.y = i / 2 + n / 2;
10177
- const O = new x(a, t.clone());
10178
- O.position.z = -l, O.position.x = -(i / 2 + n / 2), O.position.y = -(i / 2 + n / 2);
9906
+ const S = new x(o, t.clone());
9907
+ S.position.z = -l, S.rotation.z = Math.PI / 2, S.position.y = i / 2 + n / 2;
9908
+ const _ = new x(o, t.clone());
9909
+ _.position.z = -l, _.rotation.z = Math.PI / 2, _.position.y = -(i / 2 + n / 2);
10179
9910
  const V = new x(a, t.clone());
10180
- V.position.z = -l, V.position.x = i / 2 + n / 2, V.position.y = -(i / 2 + n / 2);
10181
- const T = new x(r, t.clone());
10182
- T.rotation.y = Math.PI / 2, T.position.x = l, T.name = "RIGHT";
10183
- const j = new x(o, t.clone());
10184
- j.rotation.y = Math.PI / 2, j.position.x = l, j.position.z = i / 2 + n / 2;
10185
- const H = new x(o, t.clone());
10186
- H.rotation.y = Math.PI / 2, H.position.x = l, H.position.z = -(i / 2 + n / 2);
10187
- const q = new x(o, t.clone());
10188
- q.rotation.y = Math.PI / 2, q.position.x = l, q.rotation.z = Math.PI / 2, q.position.y = i / 2 + n / 2;
10189
- const $ = new x(o, t.clone());
10190
- $.rotation.y = Math.PI / 2, $.position.x = l, $.rotation.z = Math.PI / 2, $.position.y = -(i / 2 + n / 2);
9911
+ V.position.z = -l, V.position.x = i / 2 + n / 2, V.position.y = i / 2 + n / 2;
9912
+ const T = new x(a, t.clone());
9913
+ T.position.z = -l, T.position.x = -(i / 2 + n / 2), T.position.y = i / 2 + n / 2;
9914
+ const M = new x(a, t.clone());
9915
+ M.position.z = -l, M.position.x = -(i / 2 + n / 2), M.position.y = -(i / 2 + n / 2);
9916
+ const I = new x(a, t.clone());
9917
+ I.position.z = -l, I.position.x = i / 2 + n / 2, I.position.y = -(i / 2 + n / 2);
9918
+ const D = new x(r, t.clone());
9919
+ D.rotation.y = Math.PI / 2, D.position.x = l, D.name = "RIGHT";
9920
+ const B = new x(o, t.clone());
9921
+ B.rotation.y = Math.PI / 2, B.position.x = l, B.position.z = i / 2 + n / 2;
9922
+ const P = new x(o, t.clone());
9923
+ P.rotation.y = Math.PI / 2, P.position.x = l, P.position.z = -(i / 2 + n / 2);
9924
+ const L = new x(o, t.clone());
9925
+ L.rotation.y = Math.PI / 2, L.position.x = l, L.rotation.z = Math.PI / 2, L.position.y = i / 2 + n / 2;
9926
+ const F = new x(o, t.clone());
9927
+ F.rotation.y = Math.PI / 2, F.position.x = l, F.rotation.z = Math.PI / 2, F.position.y = -(i / 2 + n / 2);
10191
9928
  const U = new x(a, t.clone());
10192
9929
  U.rotation.y = Math.PI / 2, U.position.x = l, U.position.z = i / 2 + n / 2, U.position.y = i / 2 + n / 2;
10193
- const F = new x(a, t.clone());
10194
- F.rotation.y = Math.PI / 2, F.position.x = l, F.position.z = -(i / 2 + n / 2), F.position.y = i / 2 + n / 2;
10195
9930
  const W = new x(a, t.clone());
10196
- W.rotation.y = Math.PI / 2, W.position.x = l, W.position.z = -(i / 2 + n / 2), W.position.y = -(i / 2 + n / 2);
10197
- const X = new x(a, t.clone());
10198
- X.rotation.y = Math.PI / 2, X.position.x = l, X.position.z = i / 2 + n / 2, X.position.y = -(i / 2 + n / 2);
10199
- const se = new x(r, t.clone());
10200
- se.rotation.y = Math.PI / 2, se.position.x = -l, se.name = "LEFT";
9931
+ W.rotation.y = Math.PI / 2, W.position.x = l, W.position.z = -(i / 2 + n / 2), W.position.y = i / 2 + n / 2;
9932
+ const G = new x(a, t.clone());
9933
+ G.rotation.y = Math.PI / 2, G.position.x = l, G.position.z = -(i / 2 + n / 2), G.position.y = -(i / 2 + n / 2);
9934
+ const Y = new x(a, t.clone());
9935
+ Y.rotation.y = Math.PI / 2, Y.position.x = l, Y.position.z = i / 2 + n / 2, Y.position.y = -(i / 2 + n / 2);
9936
+ const te = new x(r, t.clone());
9937
+ te.rotation.y = Math.PI / 2, te.position.x = -l, te.name = "LEFT";
9938
+ const Ue = new x(o, t.clone());
9939
+ Ue.rotation.y = Math.PI / 2, Ue.position.x = -l, Ue.position.z = i / 2 + n / 2;
10201
9940
  const qe = new x(o, t.clone());
10202
- qe.rotation.y = Math.PI / 2, qe.position.x = -l, qe.position.z = i / 2 + n / 2;
10203
- const Qe = new x(o, t.clone());
10204
- Qe.rotation.y = Math.PI / 2, Qe.position.x = -l, Qe.position.z = -(i / 2 + n / 2);
9941
+ qe.rotation.y = Math.PI / 2, qe.position.x = -l, qe.position.z = -(i / 2 + n / 2);
10205
9942
  const ge = new x(o, t.clone());
10206
9943
  ge.rotation.y = Math.PI / 2, ge.position.x = -l, ge.rotation.z = Math.PI / 2, ge.position.y = i / 2 + n / 2;
10207
9944
  const fe = new x(o, t.clone());
@@ -10214,92 +9951,92 @@ class Dn {
10214
9951
  we.rotation.y = Math.PI / 2, we.position.x = -l, we.position.z = i / 2 + n / 2, we.position.y = -(i / 2 + n / 2);
10215
9952
  const ye = new x(a, t.clone());
10216
9953
  ye.rotation.y = Math.PI / 2, ye.position.x = -l, ye.position.z = -(i / 2 + n / 2), ye.position.y = -(i / 2 + n / 2);
10217
- const Ze = new x(r, t.clone());
10218
- Ze.rotation.x = Math.PI / 2, Ze.position.y = l, Ze.name = "TOP";
9954
+ const Qe = new x(r, t.clone());
9955
+ Qe.rotation.x = Math.PI / 2, Qe.position.y = l, Qe.name = "TOP";
9956
+ const Ze = new x(o, t.clone());
9957
+ Ze.rotation.x = Math.PI / 2, Ze.position.y = l, Ze.position.x = i / 2 + n / 2;
10219
9958
  const Ye = new x(o, t.clone());
10220
- Ye.rotation.x = Math.PI / 2, Ye.position.y = l, Ye.position.x = i / 2 + n / 2;
10221
- const Xe = new x(o, t.clone());
10222
- Xe.rotation.x = Math.PI / 2, Xe.position.y = l, Xe.position.x = -(i / 2 + n / 2);
9959
+ Ye.rotation.x = Math.PI / 2, Ye.position.y = l, Ye.position.x = -(i / 2 + n / 2);
10223
9960
  const xe = new x(o, t.clone());
10224
9961
  xe.rotation.x = Math.PI / 2, xe.position.y = l, xe.rotation.z = Math.PI / 2, xe.position.z = i / 2 + n / 2;
10225
9962
  const Me = new x(o, t.clone());
10226
9963
  Me.rotation.x = Math.PI / 2, Me.position.y = l, Me.rotation.z = Math.PI / 2, Me.position.z = -(i / 2 + n / 2);
10227
9964
  const Ee = new x(a, t.clone());
10228
9965
  Ee.rotation.x = Math.PI / 2, Ee.position.y = l, Ee.position.z = -(i / 2 + n / 2), Ee.position.x = -(i / 2 + n / 2);
10229
- const Se = new x(a, t.clone());
10230
- Se.rotation.x = Math.PI / 2, Se.position.y = l, Se.position.z = -(i / 2 + n / 2), Se.position.x = i / 2 + n / 2;
10231
9966
  const Ce = new x(a, t.clone());
10232
- Ce.rotation.x = Math.PI / 2, Ce.position.y = l, Ce.position.z = i / 2 + n / 2, Ce.position.x = i / 2 + n / 2;
9967
+ Ce.rotation.x = Math.PI / 2, Ce.position.y = l, Ce.position.z = -(i / 2 + n / 2), Ce.position.x = i / 2 + n / 2;
9968
+ const Se = new x(a, t.clone());
9969
+ Se.rotation.x = Math.PI / 2, Se.position.y = l, Se.position.z = i / 2 + n / 2, Se.position.x = i / 2 + n / 2;
10233
9970
  const Ae = new x(a, t.clone());
10234
9971
  Ae.rotation.x = Math.PI / 2, Ae.position.y = l, Ae.position.z = i / 2 + n / 2, Ae.position.x = -(i / 2 + n / 2);
10235
- const Ke = new x(r, t.clone());
10236
- Ke.rotation.x = Math.PI / 2, Ke.position.y = -l, Ke.name = "BOTTOM";
9972
+ const Xe = new x(r, t.clone());
9973
+ Xe.rotation.x = Math.PI / 2, Xe.position.y = -l, Xe.name = "BOTTOM";
9974
+ const Ke = new x(o, t.clone());
9975
+ Ke.rotation.x = Math.PI / 2, Ke.position.y = -l, Ke.position.x = i / 2 + n / 2;
10237
9976
  const Je = new x(o, t.clone());
10238
- Je.rotation.x = Math.PI / 2, Je.position.y = -l, Je.position.x = i / 2 + n / 2;
10239
- const et = new x(o, t.clone());
10240
- et.rotation.x = Math.PI / 2, et.position.y = -l, et.position.x = -(i / 2 + n / 2);
9977
+ Je.rotation.x = Math.PI / 2, Je.position.y = -l, Je.position.x = -(i / 2 + n / 2);
10241
9978
  const _e = new x(o, t.clone());
10242
9979
  _e.rotation.x = Math.PI / 2, _e.position.y = -l, _e.rotation.z = Math.PI / 2, _e.position.z = i / 2 + n / 2;
10243
- const Ie = new x(o, t.clone());
10244
- Ie.rotation.x = Math.PI / 2, Ie.position.y = -l, Ie.rotation.z = Math.PI / 2, Ie.position.z = -(i / 2 + n / 2);
10245
- const Ve = new x(a, t.clone());
10246
- Ve.rotation.x = Math.PI / 2, Ve.position.y = -l, Ve.position.z = i / 2 + n / 2, Ve.position.x = -(i / 2 + n / 2);
9980
+ const Ve = new x(o, t.clone());
9981
+ Ve.rotation.x = Math.PI / 2, Ve.position.y = -l, Ve.rotation.z = Math.PI / 2, Ve.position.z = -(i / 2 + n / 2);
9982
+ const Ie = new x(a, t.clone());
9983
+ Ie.rotation.x = Math.PI / 2, Ie.position.y = -l, Ie.position.z = i / 2 + n / 2, Ie.position.x = -(i / 2 + n / 2);
10247
9984
  const Te = new x(a, t.clone());
10248
9985
  Te.rotation.x = Math.PI / 2, Te.position.y = -l, Te.position.z = i / 2 + n / 2, Te.position.x = i / 2 + n / 2;
10249
9986
  const Pe = new x(a, t.clone());
10250
9987
  Pe.rotation.x = Math.PI / 2, Pe.position.y = -l, Pe.position.z = -(i / 2 + n / 2), Pe.position.x = i / 2 + n / 2;
10251
9988
  const Oe = new x(a, t.clone());
10252
9989
  Oe.rotation.x = Math.PI / 2, Oe.position.y = -l, Oe.position.z = -(i / 2 + n / 2), Oe.position.x = -(i / 2 + n / 2);
10253
- const ei = new G({
9990
+ const ei = new q({
10254
9991
  color: 11184810
10255
- }), ti = new oe(1 * e, 1 * e), wt = new x(ti, ei);
10256
- wt.rotation.x = -Math.PI / 2, wt.position.y = -0.6 * e, this.addObject(c), this.addObject(w), this.addObject(T), this.addObject(se), this.addObject(Ze), this.addObject(Ke), this.addObject(wt);
9992
+ }), ti = new ae(1 * e, 1 * e), vt = new x(ti, ei);
9993
+ vt.rotation.x = -Math.PI / 2, vt.position.y = -0.6 * e, this.addObject(c), this.addObject(w), this.addObject(D), this.addObject(te), this.addObject(Qe), this.addObject(Xe), this.addObject(vt);
9994
+ const et = new x();
9995
+ et.name = "1131", et.add(h), et.add(B), this.addObject(et);
10257
9996
  const tt = new x();
10258
- tt.name = "1131", tt.add(h), tt.add(j), this.addObject(tt);
9997
+ tt.name = "1241", tt.add(d), tt.add(Ue), this.addObject(tt);
10259
9998
  const it = new x();
10260
- it.name = "1241", it.add(d), it.add(qe), this.addObject(it);
9999
+ it.name = "1353", it.add(u), it.add(xe), this.addObject(it);
10261
10000
  const st = new x();
10262
- st.name = "1353", st.add(u), st.add(xe), this.addObject(st);
10001
+ st.name = "1463", st.add(p), st.add(_e), this.addObject(st);
10263
10002
  const nt = new x();
10264
- nt.name = "1463", nt.add(p), nt.add(_e), this.addObject(nt);
10003
+ nt.name = "2464", nt.add(_), nt.add(Ve), this.addObject(nt);
10265
10004
  const rt = new x();
10266
- rt.name = "2464", rt.add(M), rt.add(Ie), this.addObject(rt);
10005
+ rt.name = "3221", rt.add(P), rt.add(C), this.addObject(rt);
10267
10006
  const at = new x();
10268
- at.name = "3221", at.add(H), at.add(S), this.addObject(at);
10007
+ at.name = "3351", at.add(L), at.add(Ze), this.addObject(at);
10269
10008
  const ot = new x();
10270
- ot.name = "3351", ot.add(q), ot.add(Ye), this.addObject(ot);
10009
+ ot.name = "3461", ot.add(F), ot.add(Ke), this.addObject(ot);
10271
10010
  const lt = new x();
10272
- lt.name = "3461", lt.add($), lt.add(Je), this.addObject(lt);
10011
+ lt.name = "4222", lt.add(qe), lt.add(A), this.addObject(lt);
10273
10012
  const ct = new x();
10274
- ct.name = "4222", ct.add(Qe), ct.add(A), this.addObject(ct);
10013
+ ct.name = "4352", ct.add(ge), ct.add(Ye), this.addObject(ct);
10275
10014
  const ht = new x();
10276
- ht.name = "4352", ht.add(ge), ht.add(Xe), this.addObject(ht);
10015
+ ht.name = "3462", ht.add(fe), ht.add(Je), this.addObject(ht);
10277
10016
  const dt = new x();
10278
- dt.name = "3462", dt.add(fe), dt.add(et), this.addObject(dt);
10279
- const ut = new x();
10280
- ut.name = "5423", ut.add(Me), ut.add(C), this.addObject(ut);
10017
+ dt.name = "5423", dt.add(Me), dt.add(S), this.addObject(dt);
10281
10018
  const De = new x();
10282
10019
  De.name = "corner1", De.add(m), De.add(Ae), De.add(be), this.addObject(De);
10283
10020
  const Re = new x();
10284
- Re.name = "corner2", Re.add(f), Re.add(U), Re.add(Ce), this.addObject(Re);
10021
+ Re.name = "corner2", Re.add(f), Re.add(U), Re.add(Se), this.addObject(Re);
10285
10022
  const Le = new x();
10286
- Le.name = "corner3", Le.add(v), Le.add(X), Le.add(Te), this.addObject(Le);
10023
+ Le.name = "corner3", Le.add(v), Le.add(Y), Le.add(Te), this.addObject(Le);
10287
10024
  const ke = new x();
10288
- ke.name = "corner4", ke.add(b), ke.add(we), ke.add(Ve), this.addObject(ke);
10025
+ ke.name = "corner4", ke.add(b), ke.add(we), ke.add(Ie), this.addObject(ke);
10289
10026
  const Be = new x();
10290
- Be.name = "corner5", Be.add(_), Be.add(F), Be.add(Se), this.addObject(Be);
10027
+ Be.name = "corner5", Be.add(V), Be.add(W), Be.add(Ce), this.addObject(Be);
10291
10028
  const ze = new x();
10292
- ze.name = "corner6", ze.add(I), ze.add(Ee), ze.add(ve), this.addObject(ze);
10029
+ ze.name = "corner6", ze.add(T), ze.add(Ee), ze.add(ve), this.addObject(ze);
10293
10030
  const Ne = new x();
10294
- Ne.name = "corner7", Ne.add(O), Ne.add(ye), Ne.add(Oe), this.addObject(Ne);
10031
+ Ne.name = "corner7", Ne.add(M), Ne.add(ye), Ne.add(Oe), this.addObject(Ne);
10295
10032
  const $e = new x();
10296
- $e.name = "corner8", $e.add(V), $e.add(W), $e.add(Pe), this.addObject($e);
10033
+ $e.name = "corner8", $e.add(I), $e.add(G), $e.add(Pe), this.addObject($e);
10297
10034
  }
10298
10035
  }
10299
- class Rn {
10036
+ class On {
10300
10037
  //* view cube from third party (new approach)
10301
10038
  constructor(e, t = 1) {
10302
- this.viralViewerApi = e, this.targetElement = null, this.cubeScene = null, this.cubeRenderer = null, this.cubeCamera = null, this.cubeMouse = null, this.cubeScale = 1, this.cubeScale = Math.round(Math.max(0.1, Math.min(1, t)) * 10) / 10, this.injectCubeWrapperElement(), this.targetElement = document.getElementById("orientCubeWrapper"), this.targetElement && (this.cubeScene = new Dn(this, this.cubeScale), this.cubeRenderer = new On(this), this.cubeCamera = new Pn(this), this.cubeMouse = new Tn(this)), this.viralViewerApi.emit(R.LOADED_CUBE);
10039
+ this.viralViewerApi = e, this.targetElement = null, this.cubeScene = null, this.cubeRenderer = null, this.cubeCamera = null, this.cubeMouse = null, this.cubeScale = 1, this.cubeScale = Math.round(Math.max(0.1, Math.min(1, t)) * 10) / 10, this.injectCubeWrapperElement(), this.targetElement = document.getElementById("orientCubeWrapper"), this.targetElement && (this.cubeScene = new Pn(this, this.cubeScale), this.cubeRenderer = new Tn(this), this.cubeCamera = new In(this), this.cubeMouse = new Vn(this)), this.viralViewerApi.emit(k.LOADED_CUBE);
10303
10040
  }
10304
10041
  injectCubeWrapperElement() {
10305
10042
  if (this.viralViewerApi.targetElement) {
@@ -10320,7 +10057,7 @@ class Rn {
10320
10057
  this.viralViewerApi.viralCamera.backHome();
10321
10058
  }
10322
10059
  }
10323
- class Ln {
10060
+ class Dn {
10324
10061
  constructor(e) {
10325
10062
  this.viralViewerApi = e, this.contextMenu = null, this.injectContextMenu();
10326
10063
  }
@@ -10337,7 +10074,7 @@ class Ln {
10337
10074
  this.contextMenu && this.contextMenu.style.setProperty("display", "none");
10338
10075
  }
10339
10076
  }
10340
- class kn {
10077
+ class Rn {
10341
10078
  constructor(e) {
10342
10079
  this.viralViewerApi = e, this.spinner = null, this.logo = `<svg
10343
10080
  width="348.25488"
@@ -10407,7 +10144,7 @@ class kn {
10407
10144
  "style",
10408
10145
  `width: 200px; height: 200px; border-radius: 50%; border: 2px solid #ccc; border-top: 2px solid ${y.primary}; animation: spin 1.5s linear infinite;`
10409
10146
  );
10410
- const n = bt.createElementFromHTML(this.logo);
10147
+ const n = ft.createElementFromHTML(this.logo);
10411
10148
  n.setAttribute(
10412
10149
  "style",
10413
10150
  "height:150px;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)"
@@ -10421,7 +10158,7 @@ class kn {
10421
10158
  this.spinner && this.spinner.style.setProperty("display", "none");
10422
10159
  }
10423
10160
  }
10424
- class Bn {
10161
+ class Ln {
10425
10162
  constructor(e) {
10426
10163
  this.viralTools = e;
10427
10164
  }
@@ -10430,7 +10167,7 @@ class Bn {
10430
10167
  e.activate && console.log((t = this.viralTools.viralViewerApi.viralCamera.camera) == null ? void 0 : t.position);
10431
10168
  }
10432
10169
  }
10433
- class zn {
10170
+ class kn {
10434
10171
  constructor(e) {
10435
10172
  this.viralTools = e;
10436
10173
  }
@@ -10438,7 +10175,7 @@ class zn {
10438
10175
  this.viralTools.viralViewerApi.targetElement && e.activate;
10439
10176
  }
10440
10177
  }
10441
- class Nn {
10178
+ class Bn {
10442
10179
  constructor(e) {
10443
10180
  this.viralTools = e;
10444
10181
  }
@@ -10455,7 +10192,7 @@ class Nn {
10455
10192
  ));
10456
10193
  }
10457
10194
  }
10458
- class $n {
10195
+ class zn {
10459
10196
  constructor(e) {
10460
10197
  this.viralTools = e, this.isActivated = !1;
10461
10198
  }
@@ -10475,9 +10212,9 @@ class $n {
10475
10212
  }
10476
10213
  }
10477
10214
  }
10478
- class jn {
10215
+ class Nn {
10479
10216
  constructor(e) {
10480
- this.viralTools = e, this.viralToolMeasureScene = new vt(), this.isActivated = !1, this.measures = [], this.point1 = null, this.point2 = null, this.tempPoint2 = null, this.defaultSprite = this.makeSprite(), this.measureObject = new x(), this.tempMeasure = new x(), this.tempSprite1 = null, this.tempLine = null, this.tempSprite2 = null;
10217
+ this.viralTools = e, this.viralToolMeasureScene = new Tt(), this.isActivated = !1, this.measures = [], this.point1 = null, this.point2 = null, this.tempPoint2 = null, this.defaultSprite = this.makeSprite(), this.measureObject = new x(), this.tempMeasure = new x(), this.tempSprite1 = null, this.tempLine = null, this.tempSprite2 = null;
10481
10218
  }
10482
10219
  activate(e) {
10483
10220
  this.isActivated = e.activate, this.isActivated ? (this.viralToolMeasureScene.getObjectByName("measure-object") || (this.measureObject.name = "measure-object", this.viralToolMeasureScene.add(this.measureObject)), this.viralToolMeasureScene.getObjectByName("temp-measure") || (this.tempMeasure.name = "temp-measure", this.viralToolMeasureScene.add(this.tempMeasure))) : this.dispose();
@@ -10514,7 +10251,7 @@ class jn {
10514
10251
  const s = this.defaultSprite.clone();
10515
10252
  s.position.copy(this.point1), this.tempMeasure.add(s);
10516
10253
  } else if (this.point1 && !this.point2) {
10517
- this.point2 = i, D.clearChildren(this.tempMeasure);
10254
+ this.point2 = i, R.clearChildren(this.tempMeasure);
10518
10255
  const s = this.defaultSprite.clone();
10519
10256
  s.position.copy(this.point1), this.measureObject.add(s);
10520
10257
  const n = this.defaultSprite.clone();
@@ -10541,18 +10278,18 @@ class jn {
10541
10278
  const a = o * 0.8 / 2;
10542
10279
  return r && (r.shadowBlur = 5, r.shadowColor = "#555", r.fillStyle = "#fff", r.beginPath(), r.arc(o / 2, o / 2, a, 0, Math.PI * 2), r.closePath(), r.fill(), r.shadowBlur = 0, r.fillStyle = y.primary, r.beginPath(), r.arc(o / 2, o / 2, a * 0.5, 0, Math.PI * 2), r.closePath(), r.fill()), n;
10543
10280
  }
10544
- const t = new kt(e()), i = new Bt({
10281
+ const t = new Rt(e()), i = new Lt({
10545
10282
  map: t,
10546
10283
  sizeAttenuation: !1
10547
- }), s = new zt(i);
10284
+ }), s = new kt(i);
10548
10285
  return s.scale.setScalar(0.08), s;
10549
10286
  }
10550
10287
  makeLine(e, t) {
10551
10288
  const i = new Mi({
10552
- color: D.hexToThreejsColor(y.primary),
10289
+ color: R.hexToThreejsColor(y.primary),
10553
10290
  linewidth: 20
10554
- }), s = [e, t], n = new Z().setFromPoints(s);
10555
- return new gt(n, i);
10291
+ }), s = [e, t], n = new ne().setFromPoints(s);
10292
+ return new mt(n, i);
10556
10293
  }
10557
10294
  makeDistanceSprite(e, t) {
10558
10295
  function i(c, h, d, u, p, m) {
@@ -10571,24 +10308,24 @@ class jn {
10571
10308
  10
10572
10309
  ), n.shadowBlur = 0, n.fillStyle = "#fff", n.textAlign = "left", n.textBaseline = "top", n.font = "bolder " + r + 'px "Open Sans", Arial', n.fillText(h, u + m, p + m);
10573
10310
  }
10574
- const o = new kt(s), a = new zt(
10575
- new Bt({
10311
+ const o = new Rt(s), a = new kt(
10312
+ new Lt({
10576
10313
  map: o,
10577
10314
  sizeAttenuation: !1
10578
10315
  })
10579
10316
  );
10580
10317
  a.scale.set(2e-3 * s.width * 0.5, 25e-4 * s.height * 0.5, 1);
10581
- const l = D.middlePoint(e, t);
10318
+ const l = R.middlePoint(e, t);
10582
10319
  return a.position.copy(l), a;
10583
10320
  }
10584
10321
  dispose() {
10585
- this.resetPickedPoints(), D.clearChildren(this.measureObject), D.clearChildren(this.tempMeasure), this.viralTools.viralViewerApi.viralRenderer.render();
10322
+ this.resetPickedPoints(), R.clearChildren(this.measureObject), R.clearChildren(this.tempMeasure), this.viralTools.viralViewerApi.viralRenderer.render();
10586
10323
  }
10587
10324
  onKeyPress(e) {
10588
- e.code == "Escape" && (D.clearChildren(this.tempMeasure), this.point1 = null, this.point2 = null, this.tempPoint2 = null, this.viralTools.viralViewerApi.viralRenderer.render());
10325
+ e.code == "Escape" && (R.clearChildren(this.tempMeasure), this.point1 = null, this.point2 = null, this.tempPoint2 = null, this.viralTools.viralViewerApi.viralRenderer.render());
10589
10326
  }
10590
10327
  }
10591
- class Hn {
10328
+ class $n {
10592
10329
  constructor(e) {
10593
10330
  this.viralTools = e;
10594
10331
  }
@@ -10600,7 +10337,7 @@ class Hn {
10600
10337
  if (e.activate) {
10601
10338
  if (t) {
10602
10339
  if (t.visible = !0, this.viralTools.viralViewerApi.viralScene.models.length > 0) {
10603
- const i = new N().setFromObject(
10340
+ const i = new j().setFromObject(
10604
10341
  this.viralTools.viralViewerApi.viralScene.models[0]
10605
10342
  ), s = new E();
10606
10343
  i.getSize(s);
@@ -10623,7 +10360,7 @@ class Hn {
10623
10360
  }
10624
10361
  }
10625
10362
  }
10626
- class Fn {
10363
+ class jn {
10627
10364
  constructor(e) {
10628
10365
  this.viralViewerApi = e, this.tools = [
10629
10366
  {
@@ -10727,7 +10464,7 @@ class Fn {
10727
10464
  }
10728
10465
  ]
10729
10466
  }
10730
- ], this.items = [], this.viralToolAvatar = new zn(this), this.viralToolDarkMode = new Nn(this), this.viralToolSunlight = new Hn(this), this.viralToolElevation = new $n(this), this.viralToolMeasure = new jn(this), this.viralToolAmbientOcclusion = new Bn(this), this.dehydratedCachedData(), this.executeToolsByDefault(), this.injectTools(), this.viralViewerApi.emit(R.LOADED_TOOLS);
10467
+ ], this.items = [], this.viralToolAvatar = new kn(this), this.viralToolDarkMode = new Bn(this), this.viralToolSunlight = new $n(this), this.viralToolElevation = new zn(this), this.viralToolMeasure = new Nn(this), this.viralToolAmbientOcclusion = new Ln(this), this.dehydratedCachedData(), this.executeToolsByDefault(), this.injectTools(), this.viralViewerApi.emit(k.LOADED_TOOLS);
10731
10468
  }
10732
10469
  //#region Init
10733
10470
  injectTools() {
@@ -10771,7 +10508,7 @@ class Fn {
10771
10508
  }, l.onmouseleave = () => {
10772
10509
  l.style.setProperty("background-color", "unset");
10773
10510
  };
10774
- const c = bt.createElementFromHTML(r.svg);
10511
+ const c = ft.createElementFromHTML(r.svg);
10775
10512
  r.activate && c && c.setAttribute("fill", `${y.secondary}`), l.appendChild(c), o.appendChild(l), s.appendChild(o);
10776
10513
  }
10777
10514
  e.appendChild(s);
@@ -10811,7 +10548,7 @@ class Fn {
10811
10548
  }
10812
10549
  //#endregion
10813
10550
  }
10814
- class Wn {
10551
+ class Hn {
10815
10552
  set(e, t) {
10816
10553
  localStorage[e] = t;
10817
10554
  }
@@ -10860,7 +10597,7 @@ class Wn {
10860
10597
  localStorage.clear();
10861
10598
  }
10862
10599
  }
10863
- class Er extends Ns {
10600
+ class xr extends zs {
10864
10601
  constructor(e = {
10865
10602
  isDev: !1,
10866
10603
  cameraZUp: !1,
@@ -10872,13 +10609,13 @@ class Er extends Ns {
10872
10609
  adaptiveEdges: !0,
10873
10610
  adaptiveAmbientOcclusion: !0
10874
10611
  }) {
10875
- super(), this.viralCompressProcessor = new xs(), this.localStorageService = new Wn(), this.viralStats = null, this.viralSectionBox = null, this.viralBatchDebugPanel = null, this.viralRenderDebugPanel = null, this.viralInstancedDebugPanel = null, this.options = e, this.viralLifecycleEventHandler = new Fs(this, this.options), this.targetElement = e.container, In("QUICK_SAND"), Vn(this.targetElement, "QUICK_SAND"), this.options.enableTools && (this.viralTools = new Fn(this)), this.viralSpinner = new kn(this), this.viralDraggableModal = new _n(this), this.viralContextMenu = new An(this), this.viralPivotPoint = new Ln(this), this.viralScene = new Mn(this), this.viralMaterialManager = new rn(this), this.viralRenderer = new xn(this), this.viralCamera = new ys(this), this.options.enableNavigationCube && (this.viralNavigationCube = new Rn(
10612
+ super(), this.viralCompressProcessor = new ys(), this.localStorageService = new Hn(), this.viralStats = null, this.viralSectionBox = null, this.viralBatchDebugPanel = null, this.viralRenderDebugPanel = null, this.viralInstancedDebugPanel = null, this.options = e, this.viralLifecycleEventHandler = new Hs(this, this.options), this.targetElement = e.container, An("QUICK_SAND"), _n(this.targetElement, "QUICK_SAND"), this.options.enableTools && (this.viralTools = new jn(this)), this.viralSpinner = new Rn(this), this.viralDraggableModal = new Sn(this), this.viralContextMenu = new Cn(this), this.viralPivotPoint = new Dn(this), this.viralScene = new yn(this), this.viralMaterialManager = new nn(this), this.viralRenderer = new wn(this), this.viralCamera = new ws(this), this.options.enableNavigationCube && (this.viralNavigationCube = new On(
10876
10613
  this,
10877
10614
  this.options.navigationCubeScale || 1
10878
- )), this.viralMouse = new js(this), this.viralKeyboard = new $s(this), this.viralAnimation = new ps(this), this.viralVisibilityManager = new Cn(this), this.viralCentralizedEventHandler = new Hs(this), this.viralLoader = new nn(this), this.viralBVH = new bs(), this.viralDataManager = new zs(this), this.viralAvatarManager = new vs(this), this.options.isDev && (this.viralStats = new Sn(this)), this.options.isDev ? this.viralAnimation.devAnimation() : this.viralAnimation.animation();
10615
+ )), this.viralMouse = new $s(this), this.viralKeyboard = new Ns(this), this.viralAnimation = new us(this), this.viralVisibilityManager = new En(this), this.viralCentralizedEventHandler = new js(this), this.viralLoader = new sn(this), this.viralBVH = new vs(), this.viralDataManager = new Bs(this), this.viralAvatarManager = new fs(this), this.options.isDev && (this.viralStats = new Mn(this)), this.options.isDev ? this.viralAnimation.devAnimation() : this.viralAnimation.animation();
10879
10616
  const t = window;
10880
- t.VIRAL_VIEWER = this, this.viralSectionBox = new Vt(this), this.viralBatchDebugPanel = new hs(this), this.viralRenderDebugPanel = new us(this), this.viralInstancedDebugPanel = new ds(this), this.options.isDev && import("./lil-gui.esm-BtfdsiIY.mjs").then(({ GUI: i }) => {
10881
- var b, w, S, A, C;
10617
+ t.VIRAL_VIEWER = this, this.viralSectionBox = new Vt(this), this.viralBatchDebugPanel = new cs(this), this.viralRenderDebugPanel = new ds(this), this.viralInstancedDebugPanel = new hs(this), this.options.isDev && import("./lil-gui.esm-BtfdsiIY.mjs").then(({ GUI: i }) => {
10618
+ var A, S, _, V, T;
10882
10619
  const s = new i({ title: "Controls" }), n = s.addFolder("Sun Light");
10883
10620
  n.add(this.viralScene.sunLight, "visible").onChange(() => {
10884
10621
  this.viralRenderer.render();
@@ -10899,15 +10636,46 @@ class Er extends Ns {
10899
10636
  o.add(a, "enabled").name("Outline Enabled").onChange((M) => {
10900
10637
  this.viralVisibilityManager.setSelectionOutlineMode(M);
10901
10638
  }), o.addColor(a, "color").name("Outline Color").onChange((M) => {
10902
- var _;
10903
- (_ = this.viralRenderer.postProcessingRenderer) == null || _.setSelectionOutlineColor(M), this.viralRenderer.render();
10639
+ var I;
10640
+ (I = this.viralRenderer.postProcessingRenderer) == null || I.setSelectionOutlineColor(M), this.viralRenderer.render();
10904
10641
  }), o.add(a, "thickness", 0.5, 5, 0.5).name("Thickness").onChange((M) => {
10905
- var _;
10906
- (_ = this.viralRenderer.postProcessingRenderer) == null || _.setSelectionOutlineThickness(
10642
+ var I;
10643
+ (I = this.viralRenderer.postProcessingRenderer) == null || I.setSelectionOutlineThickness(
10907
10644
  M
10908
10645
  ), this.viralRenderer.render();
10909
- }), o.add(this.viralVisibilityManager, "updateSelectionOutline").name("Refresh"), o.open();
10910
- const l = s.addFolder("Debug Panels"), c = {
10646
+ }), o.add(this.viralVisibilityManager, "updateSelectionOutline").name("Refresh");
10647
+ const l = { randomCount: 500 }, c = () => {
10648
+ const M = [];
10649
+ for (let I = 0; I < this.viralDataManager.dataTree.length; I++) {
10650
+ const D = this.viralDataManager.dataTree[I];
10651
+ for (const B of D.getAllElements())
10652
+ M.push({
10653
+ elementId: B.elementId.toString(),
10654
+ modelId: I.toString()
10655
+ });
10656
+ }
10657
+ return M;
10658
+ }, h = {
10659
+ selectAllAndMeasure: () => {
10660
+ console.log("--- Outline Benchmark ---"), console.time("⏱️ select + outline total"), this.viralVisibilityManager.selectAllElements(), console.timeEnd("⏱️ select + outline total"), console.log(
10661
+ `📊 Selected: ${this.viralScene.bimWorld.getSelectedElements().length} elements`
10662
+ );
10663
+ },
10664
+ selectRandom: () => {
10665
+ const M = c(), I = Math.min(l.randomCount, M.length);
10666
+ for (let B = M.length - 1; B > M.length - 1 - I; B--) {
10667
+ const P = Math.floor(Math.random() * (B + 1));
10668
+ [M[B], M[P]] = [M[P], M[B]];
10669
+ }
10670
+ const D = M.slice(M.length - I);
10671
+ console.log(`--- Outline Benchmark (random ${I}) ---`), console.time("⏱️ select + outline total"), this.viralVisibilityManager.selectElements(D), console.timeEnd("⏱️ select + outline total"), console.log(`📊 Selected: ${I} / ${M.length} elements`);
10672
+ },
10673
+ unselectAll: () => {
10674
+ console.time("⏱️ unselect + outline"), this.viralVisibilityManager.unselectElements(), console.timeEnd("⏱️ unselect + outline");
10675
+ }
10676
+ };
10677
+ o.add(l, "randomCount", 1, 5e3, 1).name("Random Count"), o.add(h, "selectRandom").name("⏱️ Select Random (bench)"), o.add(h, "selectAllAndMeasure").name("⏱️ Select All (bench)"), o.add(h, "unselectAll").name("⏱️ Unselect All (bench)"), o.open();
10678
+ const d = s.addFolder("Debug Panels"), u = {
10911
10679
  showBatchDebugPanel: () => {
10912
10680
  var M;
10913
10681
  return (M = this.viralBatchDebugPanel) == null ? void 0 : M.show();
@@ -10937,91 +10705,91 @@ class Er extends Ns {
10937
10705
  return (M = this.viralRenderDebugPanel) == null ? void 0 : M.logToConsole();
10938
10706
  }
10939
10707
  };
10940
- l.add(c, "showRenderDebugPanel").name("🔍 Show Render Debug"), l.add(c, "hideRenderDebugPanel").name("Hide Render Debug"), l.add(c, "logSceneAnalysis").name("📋 Log to Console"), l.add(c, "showBatchDebugPanel").name("📦 Show Batch Debug"), l.add(c, "hideBatchDebugPanel").name("Hide Batch Debug"), l.add(c, "showInstancedDebugPanel").name("🔄 Show Instanced Debug"), l.add(c, "hideInstancedDebugPanel").name("Hide Instanced Debug"), l.open(), r.add(this.viralVisibilityManager, "opacity", 0, 1, 0.1).onChange(() => {
10708
+ d.add(u, "showRenderDebugPanel").name("🔍 Show Render Debug"), d.add(u, "hideRenderDebugPanel").name("Hide Render Debug"), d.add(u, "logSceneAnalysis").name("📋 Log to Console"), d.add(u, "showBatchDebugPanel").name("📦 Show Batch Debug"), d.add(u, "hideBatchDebugPanel").name("Hide Batch Debug"), d.add(u, "showInstancedDebugPanel").name("🔄 Show Instanced Debug"), d.add(u, "hideInstancedDebugPanel").name("Hide Instanced Debug"), d.open(), r.add(this.viralVisibilityManager, "opacity", 0, 1, 0.1).onChange(() => {
10941
10709
  this.viralVisibilityManager.setOpacity();
10942
10710
  }), r.add(this.viralVisibilityManager, "showHidePercentage", 0, 100, 1).onChange(() => {
10943
10711
  this.viralVisibilityManager.showHideByPercentage();
10944
10712
  }), r.add(this.viralVisibilityManager, "randomColor", 0, 100, 1).onChange(() => {
10945
10713
  this.viralVisibilityManager.changeRandomColor();
10946
10714
  });
10947
- const h = r.addFolder("Element Opacity"), d = {
10715
+ const p = r.addFolder("Element Opacity"), m = {
10948
10716
  ghostOpacity: 0.12,
10949
10717
  elementOpacity: 0.5,
10950
10718
  ghostSelected: () => {
10951
10719
  const M = this.viralScene.bimWorld.getSelectedElements();
10952
10720
  M.length > 0 && this.viralVisibilityManager.setElementGhost(
10953
10721
  M,
10954
- d.ghostOpacity
10722
+ m.ghostOpacity
10955
10723
  );
10956
10724
  },
10957
10725
  ghostExceptSelected: () => {
10958
10726
  const M = this.viralScene.bimWorld.getSelectedElements();
10959
10727
  M.length > 0 && this.viralVisibilityManager.ghostExcept(
10960
10728
  M,
10961
- d.ghostOpacity
10729
+ m.ghostOpacity
10962
10730
  );
10963
10731
  },
10964
10732
  setSelectedOpacity: () => {
10965
10733
  const M = this.viralScene.bimWorld.getSelectedElements();
10966
10734
  M.length > 0 && this.viralVisibilityManager.setElementOpacity(
10967
10735
  M,
10968
- d.elementOpacity
10736
+ m.elementOpacity
10969
10737
  );
10970
10738
  },
10971
10739
  resetOpacity: () => {
10972
10740
  this.viralVisibilityManager.resetElementOpacity();
10973
10741
  }
10974
10742
  };
10975
- h.add(d, "ghostOpacity", 0, 1, 0.01).name("Ghost Opacity"), h.add(d, "elementOpacity", 0, 1, 0.01).name("Element Opacity"), h.add(d, "ghostSelected").name("Ghost Selected"), h.add(d, "ghostExceptSelected").name("Ghost Except Selected"), h.add(d, "setSelectedOpacity").name("Set Selected Opacity"), h.add(d, "resetOpacity").name("Reset All Opacity"), r.close();
10976
- const u = s.addFolder("Camera");
10977
- u.add(this.viralCamera, "enableOrthographicCamera"), u.add(this.viralCamera, "enablePerspectiveCamera"), u.add(this.viralCamera, "modelId"), u.add(this.viralCamera, "elementId"), u.add(this.viralCamera, "zoomTo");
10978
- const p = s.addFolder("Data");
10979
- p.add(this.viralDataManager, "searchValue"), p.add(this.viralDataManager, "searchElementData"), p.add(this.viralDataManager, "compareModels"), p.add(this.viralDataManager, "uncompareModels"), p.add(this.viralDataManager, "firstElementId"), p.add(this.viralDataManager, "secondElementId"), p.add(this.viralDataManager, "checkClash"), p.add(this.viralDataManager, "checkClashModels"), p.add(this.viralDataManager, "groupByKeyword"), p.add(this.viralDataManager, "groupBy");
10980
- const m = s.addFolder("Section Box");
10981
- if (m.add(this.viralVisibilityManager, "enableSectionBox").name("Enable (Activate)"), m.add(this.viralVisibilityManager, "disableSectionBox").name("Disable (Deactivate)"), m.add(this.viralVisibilityManager, "showSectionBox").name("Show Visuals"), m.add(this.viralVisibilityManager, "hideSectionBox").name("Hide Visuals"), m.add(this.viralVisibilityManager, "resetSectionBox").name("Reset to Initial"), s.addFolder("Model Management").add(this.viralLoader.revitLoader, "disposeModels"), s.addFolder("Materials").add(this.viralMaterialManager.edgeMaterial, "linewidth", 0, 10, 1).onChange((M) => {
10743
+ p.add(m, "ghostOpacity", 0, 1, 0.01).name("Ghost Opacity"), p.add(m, "elementOpacity", 0, 1, 0.01).name("Element Opacity"), p.add(m, "ghostSelected").name("Ghost Selected"), p.add(m, "ghostExceptSelected").name("Ghost Except Selected"), p.add(m, "setSelectedOpacity").name("Set Selected Opacity"), p.add(m, "resetOpacity").name("Reset All Opacity"), r.close();
10744
+ const f = s.addFolder("Camera");
10745
+ f.add(this.viralCamera, "enableOrthographicCamera"), f.add(this.viralCamera, "enablePerspectiveCamera"), f.add(this.viralCamera, "modelId"), f.add(this.viralCamera, "elementId"), f.add(this.viralCamera, "zoomTo");
10746
+ const v = s.addFolder("Data");
10747
+ v.add(this.viralDataManager, "searchValue"), v.add(this.viralDataManager, "searchElementData"), v.add(this.viralDataManager, "compareModels"), v.add(this.viralDataManager, "uncompareModels"), v.add(this.viralDataManager, "firstElementId"), v.add(this.viralDataManager, "secondElementId"), v.add(this.viralDataManager, "checkClash"), v.add(this.viralDataManager, "checkClashModels"), v.add(this.viralDataManager, "groupByKeyword"), v.add(this.viralDataManager, "groupBy");
10748
+ const b = s.addFolder("Section Box");
10749
+ if (b.add(this.viralVisibilityManager, "enableSectionBox").name("Enable (Activate)"), b.add(this.viralVisibilityManager, "disableSectionBox").name("Disable (Deactivate)"), b.add(this.viralVisibilityManager, "showSectionBox").name("Show Visuals"), b.add(this.viralVisibilityManager, "hideSectionBox").name("Hide Visuals"), b.add(this.viralVisibilityManager, "resetSectionBox").name("Reset to Initial"), s.addFolder("Model Management").add(this.viralLoader.revitLoader, "disposeModels"), s.addFolder("Materials").add(this.viralMaterialManager.edgeMaterial, "linewidth", 0, 10, 1).onChange((M) => {
10982
10750
  console.log("The value is now " + M), this.viralMaterialManager.edgeMaterial.linewidth = M, this.viralRenderer.render();
10983
10751
  }), this.viralRenderer.postProcessingRenderer) {
10984
- const M = s.addFolder("Post Processing"), _ = M.addFolder("N8ao");
10985
- _.add(
10986
- (b = this.viralRenderer.postProcessingRenderer) == null ? void 0 : b.n8aoPass.configuration,
10752
+ const M = s.addFolder("Post Processing"), I = M.addFolder("N8ao");
10753
+ I.add(
10754
+ (A = this.viralRenderer.postProcessingRenderer) == null ? void 0 : A.n8aoPass.configuration,
10987
10755
  "aoSamples",
10988
10756
  1,
10989
10757
  64,
10990
10758
  1
10991
- ).onChange((V) => {
10992
- this.viralRenderer.postProcessingRenderer.n8aoPass.configuration.aoSamples = V, this.viralRenderer.render();
10993
- }), _.add(
10994
- (w = this.viralRenderer.postProcessingRenderer) == null ? void 0 : w.n8aoPass.configuration,
10759
+ ).onChange((P) => {
10760
+ this.viralRenderer.postProcessingRenderer.n8aoPass.configuration.aoSamples = P, this.viralRenderer.render();
10761
+ }), I.add(
10762
+ (S = this.viralRenderer.postProcessingRenderer) == null ? void 0 : S.n8aoPass.configuration,
10995
10763
  "aoRadius",
10996
10764
  1,
10997
10765
  10,
10998
10766
  0.01
10999
- ).onChange((V) => {
11000
- this.viralRenderer.postProcessingRenderer.n8aoPass.configuration.aoRadius = V, this.viralRenderer.render();
11001
- }), _.add(
11002
- (S = this.viralRenderer.postProcessingRenderer) == null ? void 0 : S.n8aoPass.configuration,
10767
+ ).onChange((P) => {
10768
+ this.viralRenderer.postProcessingRenderer.n8aoPass.configuration.aoRadius = P, this.viralRenderer.render();
10769
+ }), I.add(
10770
+ (_ = this.viralRenderer.postProcessingRenderer) == null ? void 0 : _.n8aoPass.configuration,
11003
10771
  "denoiseRadius",
11004
10772
  0,
11005
10773
  24,
11006
10774
  0.01
11007
- ).onChange((V) => {
11008
- this.viralRenderer.postProcessingRenderer.n8aoPass.configuration.denoiseRadius = V, this.viralRenderer.render();
11009
- }), _.add(
11010
- (A = this.viralRenderer.postProcessingRenderer) == null ? void 0 : A.n8aoPass.configuration,
10775
+ ).onChange((P) => {
10776
+ this.viralRenderer.postProcessingRenderer.n8aoPass.configuration.denoiseRadius = P, this.viralRenderer.render();
10777
+ }), I.add(
10778
+ (V = this.viralRenderer.postProcessingRenderer) == null ? void 0 : V.n8aoPass.configuration,
11011
10779
  "intensity",
11012
10780
  0,
11013
10781
  10,
11014
10782
  0.01
11015
- ).onChange((V) => {
11016
- this.viralRenderer.postProcessingRenderer.n8aoPass.configuration.intensity = V, this.viralRenderer.render();
11017
- }), _.add(
11018
- (C = this.viralRenderer.postProcessingRenderer) == null ? void 0 : C.n8aoPass.configuration,
10783
+ ).onChange((P) => {
10784
+ this.viralRenderer.postProcessingRenderer.n8aoPass.configuration.intensity = P, this.viralRenderer.render();
10785
+ }), I.add(
10786
+ (T = this.viralRenderer.postProcessingRenderer) == null ? void 0 : T.n8aoPass.configuration,
11019
10787
  "distanceFalloff",
11020
10788
  0,
11021
10789
  10,
11022
10790
  0.01
11023
- ).onChange((V) => {
11024
- this.viralRenderer.postProcessingRenderer.n8aoPass.configuration.distanceFalloff = V, this.viralRenderer.render();
10791
+ ).onChange((P) => {
10792
+ this.viralRenderer.postProcessingRenderer.n8aoPass.configuration.distanceFalloff = P, this.viralRenderer.render();
11025
10793
  }), M.add(
11026
10794
  this.viralRenderer.postProcessingRenderer,
11027
10795
  "enableSobel"
@@ -11029,15 +10797,15 @@ class Er extends Ns {
11029
10797
  this.viralRenderer.postProcessingRenderer,
11030
10798
  "disableSobel"
11031
10799
  );
11032
- const I = M.addFolder("Screen-Space Edges");
11033
- I.add(this.viralRenderer.postProcessingRenderer, "enableScreenSpaceEdges").name("Enable"), I.add(this.viralRenderer.postProcessingRenderer, "disableScreenSpaceEdges").name("Disable"), I.add(
10800
+ const D = M.addFolder("Screen-Space Edges");
10801
+ D.add(this.viralRenderer.postProcessingRenderer, "enableScreenSpaceEdges").name("Enable"), D.add(this.viralRenderer.postProcessingRenderer, "disableScreenSpaceEdges").name("Disable"), D.add(
11034
10802
  this.viralRenderer.postProcessingRenderer,
11035
10803
  "setScreenSpaceEdgesPenMode"
11036
- ).name("Pen Mode"), I.add(
10804
+ ).name("Pen Mode"), D.add(
11037
10805
  this.viralRenderer.postProcessingRenderer,
11038
10806
  "setScreenSpaceEdgesShadedMode"
11039
10807
  ).name("Shaded Mode");
11040
- const O = {
10808
+ const B = {
11041
10809
  edgeColor: "#000000",
11042
10810
  edgeOpacity: 1,
11043
10811
  // Slightly reduced for subtlety
@@ -11056,48 +10824,48 @@ class Er extends Ns {
11056
10824
  enableObjectIdEdges: !1
11057
10825
  // Disable - most expensive
11058
10826
  };
11059
- I.addColor(O, "edgeColor").name("Edge Color").onChange((V) => {
11060
- var T;
11061
- (T = this.viralRenderer.postProcessingRenderer) == null || T.setScreenSpaceEdgeColor(
11062
- parseInt(V.replace("#", "0x"))
10827
+ D.addColor(B, "edgeColor").name("Edge Color").onChange((P) => {
10828
+ var L;
10829
+ (L = this.viralRenderer.postProcessingRenderer) == null || L.setScreenSpaceEdgeColor(
10830
+ parseInt(P.replace("#", "0x"))
11063
10831
  ), this.viralRenderer.render();
11064
- }), I.add(O, "edgeOpacity", 0, 1, 0.05).name("Opacity").onChange((V) => {
11065
- var T;
11066
- (T = this.viralRenderer.postProcessingRenderer) == null || T.setScreenSpaceEdgeOpacity(V), this.viralRenderer.render();
11067
- }), I.add(O, "edgeThickness", 0.5, 5, 0.1).name("Thickness").onChange((V) => {
11068
- var T;
11069
- (T = this.viralRenderer.postProcessingRenderer) == null || T.setScreenSpaceEdgeThickness(
11070
- V
10832
+ }), D.add(B, "edgeOpacity", 0, 1, 0.05).name("Opacity").onChange((P) => {
10833
+ var L;
10834
+ (L = this.viralRenderer.postProcessingRenderer) == null || L.setScreenSpaceEdgeOpacity(P), this.viralRenderer.render();
10835
+ }), D.add(B, "edgeThickness", 0.5, 5, 0.1).name("Thickness").onChange((P) => {
10836
+ var L;
10837
+ (L = this.viralRenderer.postProcessingRenderer) == null || L.setScreenSpaceEdgeThickness(
10838
+ P
11071
10839
  ), this.viralRenderer.render();
11072
- }), I.add(O, "depthMultiplier", 0, 3, 0.1).name("Depth Sensitivity").onChange((V) => {
11073
- var T;
11074
- (T = this.viralRenderer.postProcessingRenderer) == null || T.setScreenSpaceEdgesOptions({
11075
- depthMultiplier: V
10840
+ }), D.add(B, "depthMultiplier", 0, 3, 0.1).name("Depth Sensitivity").onChange((P) => {
10841
+ var L;
10842
+ (L = this.viralRenderer.postProcessingRenderer) == null || L.setScreenSpaceEdgesOptions({
10843
+ depthMultiplier: P
11076
10844
  }), this.viralRenderer.render();
11077
- }), I.add(O, "normalMultiplier", 0, 3, 0.1).name("Normal Sensitivity").onChange((V) => {
11078
- var T;
11079
- (T = this.viralRenderer.postProcessingRenderer) == null || T.setScreenSpaceEdgesOptions({
11080
- normalMultiplier: V
10845
+ }), D.add(B, "normalMultiplier", 0, 3, 0.1).name("Normal Sensitivity").onChange((P) => {
10846
+ var L;
10847
+ (L = this.viralRenderer.postProcessingRenderer) == null || L.setScreenSpaceEdgesOptions({
10848
+ normalMultiplier: P
11081
10849
  }), this.viralRenderer.render();
11082
- }), I.add(O, "normalBias", 0, 1, 0.01).name("Normal Bias").onChange((V) => {
11083
- var T;
11084
- (T = this.viralRenderer.postProcessingRenderer) == null || T.setScreenSpaceEdgesOptions({
11085
- normalBias: V
10850
+ }), D.add(B, "normalBias", 0, 1, 0.01).name("Normal Bias").onChange((P) => {
10851
+ var L;
10852
+ (L = this.viralRenderer.postProcessingRenderer) == null || L.setScreenSpaceEdgesOptions({
10853
+ normalBias: P
11086
10854
  }), this.viralRenderer.render();
11087
- }), I.add(O, "enableDepthEdges").name("Depth Edges").onChange((V) => {
11088
- var T;
11089
- (T = this.viralRenderer.postProcessingRenderer) == null || T.setScreenSpaceEdgeMethods({
11090
- depth: V
10855
+ }), D.add(B, "enableDepthEdges").name("Depth Edges").onChange((P) => {
10856
+ var L;
10857
+ (L = this.viralRenderer.postProcessingRenderer) == null || L.setScreenSpaceEdgeMethods({
10858
+ depth: P
11091
10859
  }), this.viralRenderer.render();
11092
- }), I.add(O, "enableNormalEdges").name("Normal Edges").onChange((V) => {
11093
- var T;
11094
- (T = this.viralRenderer.postProcessingRenderer) == null || T.setScreenSpaceEdgeMethods({
11095
- normal: V
10860
+ }), D.add(B, "enableNormalEdges").name("Normal Edges").onChange((P) => {
10861
+ var L;
10862
+ (L = this.viralRenderer.postProcessingRenderer) == null || L.setScreenSpaceEdgeMethods({
10863
+ normal: P
11096
10864
  }), this.viralRenderer.render();
11097
- }), I.add(O, "enableObjectIdEdges").name("Object ID Edges").onChange((V) => {
11098
- var T;
11099
- (T = this.viralRenderer.postProcessingRenderer) == null || T.setScreenSpaceEdgeMethods({
11100
- objectId: V
10865
+ }), D.add(B, "enableObjectIdEdges").name("Object ID Edges").onChange((P) => {
10866
+ var L;
10867
+ (L = this.viralRenderer.postProcessingRenderer) == null || L.setScreenSpaceEdgeMethods({
10868
+ objectId: P
11101
10869
  }), this.viralRenderer.render();
11102
10870
  });
11103
10871
  }
@@ -11105,37 +10873,37 @@ class Er extends Ns {
11105
10873
  }
11106
10874
  }
11107
10875
  export {
11108
- fr as BufferElement,
11109
- ls as CheckClashResult,
11110
- os as CompareModelsResult,
11111
- as as DataTree,
11112
- Mr as DebouncedEventHandler,
11113
- is as DefaultLightConfiguration,
11114
- It as Dictionary,
11115
- mr as ElementFragment,
11116
- pr as Fragment,
11117
- cs as GroupByResult,
11118
- bt as HTMLUtil,
10876
+ mr as BufferElement,
10877
+ os as CheckClashResult,
10878
+ as as CompareModelsResult,
10879
+ rs as DataTree,
10880
+ yr as DebouncedEventHandler,
10881
+ ts as DefaultLightConfiguration,
10882
+ _t as Dictionary,
10883
+ ur as ElementFragment,
10884
+ dr as Fragment,
10885
+ ls as GroupByResult,
10886
+ ft as HTMLUtil,
11119
10887
  Q as LogUtil,
11120
- D as THREEUtil,
11121
- xr as TreeNode,
11122
- es as ViralBIMWorld,
11123
- hs as ViralBatchDebugPanel,
11124
- Y as ViralBatchedMesh,
11125
- K as ViralCameraEventType,
11126
- ds as ViralInstancedDebugPanel,
10888
+ R as THREEUtil,
10889
+ wr as TreeNode,
10890
+ Ji as ViralBIMWorld,
10891
+ cs as ViralBatchDebugPanel,
10892
+ Z as ViralBatchedMesh,
10893
+ X as ViralCameraEventType,
10894
+ hs as ViralInstancedDebugPanel,
11127
10895
  me as ViralKeyboardEventType,
11128
- B as ViralMouseEventType,
11129
- ae as ViralPoint,
11130
- us as ViralRenderDebugPanel,
11131
- Er as ViralViewerApi,
11132
- gr as ViralViewerRevitGeometry,
11133
- ur as ViralViewerRevitNoneStructuralGeometry,
11134
- ts as ViralutionBox,
10896
+ N as ViralMouseEventType,
10897
+ re as ViralPoint,
10898
+ ds as ViralRenderDebugPanel,
10899
+ xr as ViralViewerApi,
10900
+ pr as ViralViewerRevitGeometry,
10901
+ hr as ViralViewerRevitNoneStructuralGeometry,
10902
+ es as ViralutionBox,
11135
10903
  Kt as ViralutionCamera,
11136
- vr as ViralutionElement,
11137
- R as ViralutionEvent,
11138
- wr as ViralutionSolid,
11139
- br as ViralutionStandaloneModel,
11140
- yr as ViralutionTrackingModel
10904
+ gr as ViralutionElement,
10905
+ k as ViralutionEvent,
10906
+ vr as ViralutionSolid,
10907
+ fr as ViralutionStandaloneModel,
10908
+ br as ViralutionTrackingModel
11141
10909
  };