u-space 0.0.5 → 0.0.7

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.
Files changed (69) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.js +682 -481
  3. package/dist/plugins/u-manager/flows/ComponentFlowParser.d.ts +8 -0
  4. package/dist/plugins/u-manager/flows/FlowParser.d.ts +48 -0
  5. package/dist/plugins/u-manager/flows/edges/index.d.ts +9 -0
  6. package/dist/plugins/u-manager/flows/index.d.ts +4 -0
  7. package/dist/plugins/u-manager/flows/nodes/ColorNode.d.ts +8 -0
  8. package/dist/plugins/u-manager/flows/nodes/ConditionNode.d.ts +9 -0
  9. package/dist/plugins/u-manager/flows/nodes/DataExtractionNode.d.ts +8 -0
  10. package/dist/plugins/u-manager/flows/nodes/DataFilterNode.d.ts +8 -0
  11. package/dist/plugins/u-manager/flows/nodes/DelayNode.d.ts +8 -0
  12. package/dist/plugins/u-manager/flows/nodes/EmissiveNode.d.ts +8 -0
  13. package/dist/plugins/u-manager/flows/nodes/FlyToNode.d.ts +8 -0
  14. package/dist/plugins/u-manager/flows/nodes/HideNode.d.ts +10 -0
  15. package/dist/plugins/u-manager/flows/nodes/HighlightNode.d.ts +8 -0
  16. package/dist/plugins/u-manager/flows/nodes/MeshNode.d.ts +8 -0
  17. package/dist/plugins/u-manager/flows/nodes/MeshesNode.d.ts +8 -0
  18. package/dist/plugins/u-manager/flows/nodes/ModelNode.d.ts +8 -0
  19. package/dist/plugins/u-manager/flows/nodes/ModelsNode.d.ts +8 -0
  20. package/dist/plugins/u-manager/flows/nodes/Node.d.ts +52 -0
  21. package/dist/plugins/u-manager/flows/nodes/NumberNode.d.ts +8 -0
  22. package/dist/plugins/u-manager/flows/nodes/OpacityNode.d.ts +8 -0
  23. package/dist/plugins/u-manager/flows/nodes/POINode.d.ts +8 -0
  24. package/dist/plugins/u-manager/flows/nodes/POISNode.d.ts +8 -0
  25. package/dist/plugins/u-manager/flows/nodes/PathNode.d.ts +8 -0
  26. package/dist/plugins/u-manager/flows/nodes/PathsNode.d.ts +8 -0
  27. package/dist/plugins/u-manager/flows/nodes/RotateNode.d.ts +8 -0
  28. package/dist/plugins/u-manager/flows/nodes/ScaleNode.d.ts +8 -0
  29. package/dist/plugins/u-manager/flows/nodes/ShowNode.d.ts +10 -0
  30. package/dist/plugins/u-manager/flows/nodes/SpaceNode.d.ts +8 -0
  31. package/dist/plugins/u-manager/flows/nodes/SpacesNode.d.ts +8 -0
  32. package/dist/plugins/u-manager/flows/nodes/StartNode.d.ts +7 -0
  33. package/dist/plugins/u-manager/flows/nodes/TranslateNode.d.ts +8 -0
  34. package/dist/plugins/u-manager/flows/nodes/UnEmissiveNode.d.ts +10 -0
  35. package/dist/plugins/u-manager/flows/nodes/UnHighlightNode.d.ts +10 -0
  36. package/dist/plugins/u-manager/flows/nodes/UnOpacityNode.d.ts +8 -0
  37. package/dist/plugins/u-manager/flows/nodes/UserDataNode.d.ts +8 -0
  38. package/dist/plugins/u-manager/flows/nodes/clip-animation/ClipAnimationNode.d.ts +8 -0
  39. package/dist/plugins/u-manager/flows/nodes/clip-animation/UnClipAnimationNode.d.ts +8 -0
  40. package/dist/plugins/u-manager/flows/nodes/clip-animation/index.d.ts +2 -0
  41. package/dist/plugins/u-manager/flows/nodes/component-tween-animation/ComponentTweenAnimationNode.d.ts +8 -0
  42. package/dist/plugins/u-manager/flows/nodes/component-tween-animation/UnComponentTweenAnimationNode.d.ts +8 -0
  43. package/dist/plugins/u-manager/flows/nodes/component-tween-animation/index.d.ts +2 -0
  44. package/dist/plugins/u-manager/flows/nodes/component-tween-animation/utils.d.ts +5 -0
  45. package/dist/plugins/u-manager/flows/nodes/index.d.ts +34 -0
  46. package/dist/plugins/u-manager/flows/nodes/tween-animation/TweenAnimationNode.d.ts +8 -0
  47. package/dist/plugins/u-manager/flows/nodes/tween-animation/UnTweenAnimationNode.d.ts +8 -0
  48. package/dist/plugins/u-manager/flows/nodes/tween-animation/index.d.ts +2 -0
  49. package/dist/plugins/u-manager/flows/nodes/tween-animation/utils.d.ts +5 -0
  50. package/dist/plugins/u-manager/flows/types.d.ts +81 -0
  51. package/dist/plugins/u-manager/flows/utils.d.ts +14 -0
  52. package/dist/plugins/u-manager/index.cjs +59 -59
  53. package/dist/plugins/u-manager/index.d.ts +1 -0
  54. package/dist/plugins/u-manager/index.js +9692 -8601
  55. package/dist/src/effects/MaterialEffects.d.ts +10 -3
  56. package/dist/src/index.d.ts +8 -0
  57. package/dist/src/viewers/CSSRenderer.d.ts +19 -0
  58. package/dist/src/viewers/CameraControls.d.ts +7 -0
  59. package/dist/src/viewers/RenderPipeline.d.ts +30 -2
  60. package/dist/src/viewers/Viewer.d.ts +2 -0
  61. package/dist/src/viewers/index.d.ts +2 -0
  62. package/docs/api-css-renderer.md +43 -0
  63. package/docs/api-effects.md +49 -11
  64. package/docs/api-render-pipeline.md +114 -0
  65. package/docs/api-viewer.md +31 -0
  66. package/docs/examples-guide.md +26 -0
  67. package/docs/getting-started.md +12 -0
  68. package/docs/index.md +6 -0
  69. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,20 +1,27 @@
1
- import { Raycaster as me, Vector2 as S, RenderPipeline as Ae, Sphere as ge, Box3 as fe, Spherical as T, Matrix4 as Re, Quaternion as _e, Vector4 as Ne, Vector3 as ee, MathUtils as Ue, PMREMGenerator as De, OrthographicCamera as $, TimestampQuery as je, Cache as ke, EventDispatcher as Ge, Timer as Fe, PerspectiveCamera as X, WebGPURenderer as He, PCFShadowMap as ze, AgXToneMapping as $e, Scene as We, Color as te, MeshStandardNodeMaterial as I, Loader as Qe, LoaderUtils as L, FileLoader as we, TextureLoader as ye, Group as Q, SRGBColorSpace as ve, RepeatWrapping as ne, BufferGeometry as Ke, BufferAttribute as ie, Mesh as F, FrontSide as Xe, BackSide as qe, DoubleSide as Ye, REVISION as re, CubeTextureLoader as Je, EquirectangularReflectionMapping as Ze, Sprite as Ve, AnimationMixer as et, LoopRepeat as tt, LoopOnce as st, SphereGeometry as nt, TubeGeometry as it, LineCurve3 as rt, CatmullRomCurve3 as at, SpriteNodeMaterial as ot, CanvasTexture as ct, ShapeGeometry as ht, Shape as be, ExtrudeGeometry as lt, PlaneGeometry as dt, CircleGeometry as pt } from "three/webgpu";
2
- import { pass as Z, blendColor as ut, color as U, uv as ae, time as q, pow as Y, sin as oe, mix as J, mx_noise_float as ce, Fn as Te, userData as G, materialColor as he, select as V, materialOpacity as mt, vec3 as gt } from "three/tsl";
3
- import Ce from "camera-controls";
4
- import { RoomEnvironment as ft } from "three/addons/environments/RoomEnvironment.js";
5
- import { ViewHelper as wt } from "three/addons/helpers/ViewHelper.js";
6
- import { GLTFLoader as xe } from "three/addons/loaders/GLTFLoader.js";
7
- import { FBXLoader as yt } from "three/addons/loaders/FBXLoader.js";
8
- import { OBJLoader as vt } from "three/addons/loaders/OBJLoader.js";
9
- import { STLLoader as bt } from "three/addons/loaders/STLLoader.js";
10
- import { DRACOLoader as Tt } from "three/addons/loaders/DRACOLoader.js";
11
- import { KTX2Loader as Ct } from "three/addons/loaders/KTX2Loader.js";
12
- import { MeshoptDecoder as le } from "three/addons/libs/meshopt_decoder.module.js";
13
- import { HDRLoader as xt } from "three/addons/loaders/HDRLoader.js";
14
- import { clone as Mt } from "three/addons/utils/SkeletonUtils.js";
15
- import { Color as D } from "three";
16
- import { Easing as d, Tween as Et } from "three/addons/libs/tween.module.js";
17
- class Ot {
1
+ import { Raycaster as Te, Vector2 as R, RenderPipeline as $e, PerspectiveCamera as K, Sphere as Se, Box3 as xe, Spherical as C, Matrix4 as We, Quaternion as Ke, Vector4 as Qe, Vector3 as oe, MathUtils as Xe, PMREMGenerator as qe, OrthographicCamera as Q, TimestampQuery as Ye, Cache as Je, EventDispatcher as Ze, Timer as Ve, WebGPURenderer as et, PCFShadowMap as tt, AgXToneMapping as st, Scene as it, Color as V, MeshStandardNodeMaterial as L, Loader as nt, LoaderUtils as I, FileLoader as Ee, TextureLoader as Me, Group as ee, SRGBColorSpace as Pe, RepeatWrapping as ce, BufferGeometry as rt, BufferAttribute as he, Mesh as z, FrontSide as at, BackSide as ot, DoubleSide as ct, REVISION as le, CubeTextureLoader as ht, EquirectangularReflectionMapping as lt, Sprite as dt, AnimationMixer as pt, LoopRepeat as ut, LoopOnce as mt, SphereGeometry as gt, TubeGeometry as ft, LineCurve3 as yt, CatmullRomCurve3 as wt, SpriteNodeMaterial as vt, CanvasTexture as bt, ShapeGeometry as Ct, Shape as Oe, ExtrudeGeometry as Tt, PlaneGeometry as St, CircleGeometry as xt } from "three/webgpu";
2
+ import { pass as re, mrt as Et, output as Mt, add as de, blendColor as Pt, emissive as Ot, normalView as Rt, velocity as It, color as j, uv as pe, time as X, pow as q, sin as ae, mix as Y, mx_noise_float as ue, Fn as Re, userData as O, materialColor as me, select as J, materialOpacity as Lt, vec3 as At } from "three/tsl";
3
+ import { bloom as Nt } from "three/addons/tsl/display/BloomNode.js";
4
+ import { ssgi as Bt } from "three/addons/tsl/display/SSGINode.js";
5
+ import { traa as _t } from "three/addons/tsl/display/TRAANode.js";
6
+ import Ie from "camera-controls";
7
+ import { RoomEnvironment as Dt } from "three/addons/environments/RoomEnvironment.js";
8
+ import { ViewHelper as jt } from "three/addons/helpers/ViewHelper.js";
9
+ import { CSS2DRenderer as Ut, CSS2DObject as kt } from "three/addons/renderers/CSS2DRenderer.js";
10
+ import { CSS2DObject as pi } from "three/addons/renderers/CSS2DRenderer.js";
11
+ import { CSS3DRenderer as Gt, CSS3DSprite as Ft, CSS3DObject as zt } from "three/addons/renderers/CSS3DRenderer.js";
12
+ import { CSS3DObject as mi, CSS3DSprite as gi } from "three/addons/renderers/CSS3DRenderer.js";
13
+ import { GLTFLoader as Le } from "three/addons/loaders/GLTFLoader.js";
14
+ import { FBXLoader as Ht } from "three/addons/loaders/FBXLoader.js";
15
+ import { OBJLoader as $t } from "three/addons/loaders/OBJLoader.js";
16
+ import { STLLoader as Wt } from "three/addons/loaders/STLLoader.js";
17
+ import { DRACOLoader as Kt } from "three/addons/loaders/DRACOLoader.js";
18
+ import { KTX2Loader as Qt } from "three/addons/loaders/KTX2Loader.js";
19
+ import { MeshoptDecoder as ge } from "three/addons/libs/meshopt_decoder.module.js";
20
+ import { HDRLoader as Xt } from "three/addons/loaders/HDRLoader.js";
21
+ import { clone as qt } from "three/addons/utils/SkeletonUtils.js";
22
+ import { Color as U } from "three";
23
+ import { Easing as u, Tween as Yt } from "three/addons/libs/tween.module.js";
24
+ class Jt {
18
25
  /** The type of event (e.g., 'click', 'pointerdown'). */
19
26
  type;
20
27
  /** The original 3D object that triggered the event. */
@@ -42,15 +49,15 @@ class Ot {
42
49
  return this._propagationStopped;
43
50
  }
44
51
  }
45
- class Pt {
52
+ class Zt {
46
53
  domElement;
47
54
  scene;
48
55
  camera;
49
- raycaster = new me();
50
- pointer = new S();
56
+ raycaster = new Te();
57
+ pointer = new R();
51
58
  hoveredObject = null;
52
59
  pointerDownTime = 0;
53
- pointerDownPos = new S();
60
+ pointerDownPos = new R();
54
61
  clickTimer = null;
55
62
  longPressThreshold = 500;
56
63
  moveThreshold = 0.01;
@@ -85,16 +92,16 @@ class Pt {
85
92
  /**
86
93
  * Dispatches an event to the target object and bubbles up the parent chain.
87
94
  */
88
- _dispatchToTarget(e, t, s, n) {
89
- const i = new Ot({
95
+ _dispatchToTarget(e, t, s, i) {
96
+ const n = new Jt({
90
97
  type: e,
91
98
  target: t,
92
99
  intersect: s,
93
- originalEvent: n
100
+ originalEvent: i
94
101
  });
95
102
  let r = t;
96
- for (; r && !i.propagationStopped; )
97
- i.currentTarget = r, r.dispatchEvent({ type: e, event: i }), r = r.parent;
103
+ for (; r && !n.propagationStopped; )
104
+ n.currentTarget = r, r.dispatchEvent({ type: e, event: n }), r = r.parent;
98
105
  }
99
106
  /**
100
107
  * Handles a DOM event by raycasting and dispatching to the first intersected object.
@@ -103,8 +110,8 @@ class Pt {
103
110
  this._updatePointer(t);
104
111
  const s = this._getIntersects();
105
112
  if (s.length === 0) return;
106
- const n = s[0];
107
- this._dispatchToTarget(e, n.object, n, t);
113
+ const i = s[0];
114
+ this._dispatchToTarget(e, i.object, i, t);
108
115
  }
109
116
  _onClick = (e) => {
110
117
  const t = Date.now() - this.pointerDownTime, s = this.pointer.distanceTo(this.pointerDownPos);
@@ -137,8 +144,8 @@ class Pt {
137
144
  _onPointerMove = (e) => {
138
145
  if (!this.pointerMoveEventsEnabled) return;
139
146
  this._updatePointer(e);
140
- const t = this._getIntersects(), s = t.length > 0 ? t[0].object : null, n = t.length > 0 ? t[0] : null;
141
- this.hoveredObject !== s && (this.hoveredObject && this._dispatchToTarget("pointerleave", this.hoveredObject, null, e), this.hoveredObject = s, s && n && this._dispatchToTarget("pointerenter", s, n, e)), s && n && this._dispatchToTarget("pointermove", s, n, e);
147
+ const t = this._getIntersects(), s = t.length > 0 ? t[0].object : null, i = t.length > 0 ? t[0] : null;
148
+ this.hoveredObject !== s && (this.hoveredObject && this._dispatchToTarget("pointerleave", this.hoveredObject, null, e), this.hoveredObject = s, s && i && this._dispatchToTarget("pointerenter", s, i, e)), s && i && this._dispatchToTarget("pointermove", s, i, e);
142
149
  };
143
150
  /**
144
151
  * Cleans up event listeners.
@@ -147,7 +154,7 @@ class Pt {
147
154
  this.domElement.removeEventListener("click", this._onClick), this.domElement.removeEventListener("dblclick", this._onDblClick), this.domElement.removeEventListener("contextmenu", this._onContextMenu), this.domElement.removeEventListener("pointerdown", this._onPointerDown), this.domElement.removeEventListener("pointerup", this._onPointerUp), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.hoveredObject = null;
148
155
  }
149
156
  }
150
- class St {
157
+ class Vt {
151
158
  idMap = /* @__PURE__ */ new Map();
152
159
  nameMap = /* @__PURE__ */ new Map();
153
160
  typeMap = /* @__PURE__ */ new Map();
@@ -250,54 +257,151 @@ class St {
250
257
  return this.allObjects.size;
251
258
  }
252
259
  }
253
- class Lt extends Ae {
260
+ class es extends $e {
254
261
  scene;
255
262
  camera;
256
- currentOutputNode;
263
+ scenePass;
257
264
  needsUpdateOutputNode;
258
- #e;
265
+ #r;
266
+ #t;
267
+ #s = !1;
268
+ #a = { strength: 1, radius: 0, threshold: 0 };
269
+ #c = null;
270
+ #n = !1;
271
+ #e = {
272
+ sliceCount: 1,
273
+ stepCount: 12,
274
+ aoIntensity: 1,
275
+ giIntensity: 10,
276
+ radius: 12,
277
+ thickness: 1
278
+ };
279
+ #h = null;
280
+ #o = !1;
281
+ #l = null;
282
+ #d = null;
259
283
  constructor(...e) {
260
- const [t, s, n] = e;
261
- super(t), this.scene = s, this.camera = n, this.currentOutputNode = Z(s, n), this.needsUpdateOutputNode = !0, this.#e = /* @__PURE__ */ new Set();
284
+ const [t, s, i] = e;
285
+ super(t), this.scene = s, this.camera = i, this.scenePass = re(s, i), this.needsUpdateOutputNode = !0, this.#r = /* @__PURE__ */ new Set(), this.#t = [], this.#p();
286
+ }
287
+ /** @deprecated Use `scenePass` instead */
288
+ get currentOutputNode() {
289
+ return this.scenePass;
262
290
  }
263
291
  addOverlayPass(e) {
264
- this.#e.add(e), this.needsUpdateOutputNode = !0;
292
+ this.#r.add(e), this.needsUpdateOutputNode = !0;
265
293
  }
266
294
  removeOverlayPass(e) {
267
- this.#e.delete(e), this.needsUpdateOutputNode = !0;
295
+ this.#r.delete(e), this.needsUpdateOutputNode = !0;
268
296
  }
269
297
  setCamera(e) {
270
- this.camera = e, this.needsUpdateOutputNode = !0;
298
+ this.camera = e, this.#i();
271
299
  }
300
+ /** @deprecated Use `setOutputComposer` instead */
272
301
  setCurrentOutputNode(e) {
273
- this.currentOutputNode.dispose(), this.currentOutputNode = e, this.needsUpdateOutputNode = !0;
302
+ this.setOutputComposer(() => e);
274
303
  }
304
+ /** @deprecated Use `setOutputComposer(null)` instead */
275
305
  resetCurrentOutputNode() {
276
- this.currentOutputNode.dispose(), this.currentOutputNode = Z(this.scene, this.camera), this.needsUpdateOutputNode = !0;
306
+ this.setOutputComposer(null);
307
+ }
308
+ setOutputComposer(e) {
309
+ this.#d = e, this.needsUpdateOutputNode = !0;
310
+ }
311
+ enableBloom(e) {
312
+ e && Object.assign(this.#a, e), this.#s = !0, this.#i();
313
+ }
314
+ disableBloom() {
315
+ this.#s = !1, this.#c = null, this.#i();
316
+ }
317
+ updateBloom(e) {
318
+ Object.assign(this.#a, e), this.#s && (this.needsUpdateOutputNode = !0);
319
+ }
320
+ enableSSGI(e) {
321
+ e && Object.assign(this.#e, e), this.#n = !0, this.#i();
322
+ }
323
+ disableSSGI() {
324
+ this.#n = !1, this.#h = null, this.#i();
325
+ }
326
+ updateSSGI(e) {
327
+ if (Object.assign(this.#e, e), this.#h) {
328
+ const t = this.#h;
329
+ e.sliceCount !== void 0 && (t.sliceCount.value = e.sliceCount), e.stepCount !== void 0 && (t.stepCount.value = e.stepCount), e.aoIntensity !== void 0 && (t.aoIntensity.value = e.aoIntensity), e.giIntensity !== void 0 && (t.giIntensity.value = e.giIntensity), e.radius !== void 0 && (t.radius.value = e.radius), e.thickness !== void 0 && (t.thickness.value = e.thickness);
330
+ }
331
+ }
332
+ enableTRAA() {
333
+ this.#o = !0, this.#i();
334
+ }
335
+ disableTRAA() {
336
+ this.#o = !1, this.#l = null, this.#i();
337
+ }
338
+ #i() {
339
+ const e = this.scenePass;
340
+ this.scenePass = re(this.scene, this.camera), this.#p(), this.needsUpdateOutputNode = !0, e.dispose();
341
+ }
342
+ #p() {
343
+ if (this.#s || this.#n || this.#o) {
344
+ const t = { output: Mt };
345
+ this.#s && (t.emissive = Ot), this.#n && (t.normal = Rt), this.#o && (t.velocity = It), this.scenePass.setMRT(Et(t));
346
+ }
277
347
  }
278
- #t() {
279
- let e = this.currentOutputNode;
280
- this.#e.size > 0 && this.#e.forEach((t) => {
281
- e = ut(e, t);
348
+ #u() {
349
+ for (const e of this.#t)
350
+ e.dispose();
351
+ this.#t = [];
352
+ }
353
+ #m() {
354
+ let e = this.scenePass.getTextureNode();
355
+ if (this.#n)
356
+ if (!(this.camera instanceof K))
357
+ console.warn("RenderPipeline: SSGI requires a PerspectiveCamera, skipping.");
358
+ else {
359
+ const t = this.scenePass.getTextureNode(), s = this.scenePass.getTextureNode("depth"), i = this.scenePass.getTextureNode("normal"), n = Bt(t, s, i, this.camera);
360
+ n.sliceCount.value = this.#e.sliceCount, n.stepCount.value = this.#e.stepCount, n.aoIntensity.value = this.#e.aoIntensity, n.giIntensity.value = this.#e.giIntensity, n.radius.value = this.#e.radius, n.thickness.value = this.#e.thickness, this.#h = n, e = de(e, n), this.#t.push(n);
361
+ }
362
+ if (this.#s) {
363
+ const t = this.scenePass.getTextureNode("emissive");
364
+ this.#c = Nt(
365
+ t,
366
+ this.#a.strength,
367
+ this.#a.radius,
368
+ this.#a.threshold
369
+ ), e = de(e, this.#c), this.#t.push(this.#c);
370
+ }
371
+ return e;
372
+ }
373
+ #g() {
374
+ this.#u();
375
+ let e;
376
+ if (this.#d ? e = this.#d(this.scenePass) : this.#s || this.#n ? e = this.#m() : e = this.scenePass, this.#o) {
377
+ const t = this.scenePass.getTextureNode("depth"), s = this.scenePass.getTextureNode("velocity");
378
+ this.#l = _t(e, t, s, this.camera), this.#t.push(this.#l), e = this.#l;
379
+ }
380
+ this.#r.size > 0 && this.#r.forEach((t) => {
381
+ const s = Pt(e, t);
382
+ this.#t.push(s), e = s;
282
383
  }), this.outputNode = e, this.needsUpdate = !0;
283
384
  }
284
385
  render() {
285
- this.needsUpdateOutputNode && (this.#t(), this.needsUpdateOutputNode = !1), super.render();
386
+ this.needsUpdateOutputNode && (this.#g(), this.needsUpdateOutputNode = !1), super.render();
387
+ }
388
+ dispose() {
389
+ this.#u(), this.scenePass.dispose(), super.dispose();
286
390
  }
287
391
  }
288
- const It = {
289
- Vector2: S,
290
- Vector3: ee,
291
- Vector4: Ne,
292
- Quaternion: _e,
293
- Matrix4: Re,
294
- Spherical: T,
295
- Box3: fe,
296
- Sphere: ge,
297
- Raycaster: me
392
+ const ts = {
393
+ Vector2: R,
394
+ Vector3: oe,
395
+ Vector4: Qe,
396
+ Quaternion: Ke,
397
+ Matrix4: We,
398
+ Spherical: C,
399
+ Box3: xe,
400
+ Sphere: Se,
401
+ Raycaster: Te
298
402
  };
299
- Ce.install({ THREE: It });
300
- class Bt extends Ce {
403
+ Ie.install({ THREE: ts });
404
+ class ss extends Ie {
301
405
  constructor(...e) {
302
406
  super(...e), this.minDistance = 0.2, this.smoothTime = 0.2, this.dollySpeed = 0.2;
303
407
  }
@@ -305,62 +409,69 @@ class Bt extends Ce {
305
409
  * Set absolute angle for azimuth to avoid spinning
306
410
  */
307
411
  absoluteRotations() {
308
- this.azimuthAngle = At(this.azimuthAngle, 0);
412
+ this.azimuthAngle = is(this.azimuthAngle, 0);
309
413
  }
310
414
  async flyToBox(e, t = {}) {
311
415
  if (e.isEmpty())
312
416
  return console.warn("CameraControls.flyToBox: The provided Box3 is empty."), !1;
313
417
  this.absoluteRotations();
314
- const { viewpoint: s = "frontTop", enableTransition: n = !0, padding: i = 0.1, cover: r = !1 } = t, a = [];
418
+ const { viewpoint: s = "frontTop", enableTransition: i = !0, padding: n = 0.1, cover: r = !1 } = t, o = [];
315
419
  if (s !== "current") {
316
- const o = de[s.toUpperCase()] ?? de.FRONTTOP, h = o.theta, l = o.phi;
317
- a.push(
318
- this.fitToBox(e, n, {
319
- paddingLeft: i,
320
- paddingRight: i,
321
- paddingTop: i,
322
- paddingBottom: i,
420
+ const c = fe[s.toUpperCase()] ?? fe.FRONTTOP, h = c.theta, l = c.phi;
421
+ o.push(
422
+ this.fitToBox(e, i, {
423
+ paddingLeft: n,
424
+ paddingRight: n,
425
+ paddingTop: n,
426
+ paddingBottom: n,
323
427
  cover: r
324
428
  })
325
- ), a.push(this.rotateTo(h, l, n));
429
+ ), o.push(this.rotateTo(h, l, i));
326
430
  } else {
327
- const o = new ge();
328
- e.getBoundingSphere(o), o.radius += i, a.push(this.fitToSphere(o, n));
431
+ const c = new Se();
432
+ e.getBoundingSphere(c), c.radius += n, o.push(this.fitToSphere(c, i));
329
433
  }
330
- return await Promise.all(a), !0;
434
+ return await Promise.all(o), !0;
331
435
  }
332
436
  async flyToObject(e, t = {}) {
333
- const s = new fe().setFromObject(e);
437
+ const s = new xe().setFromObject(e);
334
438
  return this.flyToBox(s, t);
335
439
  }
440
+ async setCameraViewpoint(e, t = !0) {
441
+ const { position: s, target: i, zoom: n = this.camera.zoom } = e;
442
+ return Promise.all([
443
+ this.zoomTo(n, t),
444
+ this.setLookAt(s.x, s.y, s.z, i.x, i.y, i.z, t)
445
+ ]);
446
+ }
336
447
  }
337
- const de = {
338
- LEFT: new T(0, Math.PI / 2, -Math.PI / 2),
339
- RIGHT: new T(0, Math.PI / 2, Math.PI / 2),
340
- FRONT: new T(0, Math.PI / 2, 0),
341
- BACK: new T(0, Math.PI / 2, Math.PI),
342
- TOP: new T(0, 0, 0),
343
- BOTTOM: new T(0, Math.PI, 0),
344
- FRONTTOP: new T(0, Math.PI / 4, 0),
345
- BACKTOP: new T(0, Math.PI / 4, Math.PI),
346
- LEFTTOP: new T(0, Math.PI / 4, -Math.PI / 2),
347
- RIGHTTOP: new T(0, Math.PI / 4, Math.PI / 2),
348
- LEFTFRONTTOP: new T(0, Math.PI / 4, -Math.PI / 4),
349
- RIGHTFRONTTOP: new T(0, Math.PI / 4, Math.PI / 4),
350
- LEFTBACKTOP: new T(0, Math.PI / 4, -Math.PI / 4 * 3),
351
- RIGHTBACKTOP: new T(0, Math.PI / 4, Math.PI / 4 * 3)
448
+ const fe = {
449
+ LEFT: new C(0, Math.PI / 2, -Math.PI / 2),
450
+ RIGHT: new C(0, Math.PI / 2, Math.PI / 2),
451
+ FRONT: new C(0, Math.PI / 2, 0),
452
+ BACK: new C(0, Math.PI / 2, Math.PI),
453
+ TOP: new C(0, 0, 0),
454
+ BOTTOM: new C(0, Math.PI, 0),
455
+ FRONTTOP: new C(0, Math.PI / 4, 0),
456
+ BACKTOP: new C(0, Math.PI / 4, Math.PI),
457
+ LEFTTOP: new C(0, Math.PI / 4, -Math.PI / 2),
458
+ RIGHTTOP: new C(0, Math.PI / 4, Math.PI / 2),
459
+ LEFTFRONTTOP: new C(0, Math.PI / 4, -Math.PI / 4),
460
+ RIGHTFRONTTOP: new C(0, Math.PI / 4, Math.PI / 4),
461
+ LEFTBACKTOP: new C(0, Math.PI / 4, -Math.PI / 4 * 3),
462
+ RIGHTBACKTOP: new C(0, Math.PI / 4, Math.PI / 4 * 3)
352
463
  };
353
- function At(c, e) {
354
- const t = c - e;
355
- return Ue.euclideanModulo(t + Math.PI, Math.PI * 2) - Math.PI;
464
+ function is(a, e) {
465
+ const t = a - e;
466
+ return Xe.euclideanModulo(t + Math.PI, Math.PI * 2) - Math.PI;
356
467
  }
357
- class Rt {
358
- environment = new ft();
468
+ class ns {
469
+ environment = new Dt();
359
470
  renderer;
360
471
  pmremGenerator;
361
472
  envMap = null;
362
473
  constructor(e) {
363
- this.renderer = e, this.pmremGenerator = new De(e);
474
+ this.renderer = e, this.pmremGenerator = new qe(e);
364
475
  }
365
476
  update() {
366
477
  this.envMap || (this.envMap = this.pmremGenerator.fromScene(this.environment).texture);
@@ -369,20 +480,20 @@ class Rt {
369
480
  this.pmremGenerator.dispose(), this.envMap?.dispose();
370
481
  }
371
482
  }
372
- const z = 128;
373
- class _t extends wt {
483
+ const $ = 128;
484
+ class rs extends jt {
374
485
  viewer;
375
486
  overlayPass;
376
487
  constructor(e) {
377
488
  super(e.camera, e.el), this.viewer = e;
378
- const t = new $(-2, 2, 2, -2, 0, 4);
379
- t.position.set(0, 0, 2), this.overlayPass = Z(this, t), this.setLabels("x", "y", "z");
489
+ const t = new Q(-2, 2, 2, -2, 0, 4);
490
+ t.position.set(0, 0, 2), this.overlayPass = re(this, t), this.setLabels("x", "y", "z");
380
491
  }
381
492
  _update = () => {
382
493
  this.quaternion.copy(this.viewer.camera.quaternion).invert();
383
494
  const e = this.location;
384
495
  let t, s;
385
- e.left !== null ? t = e.left : t = this.viewer.el.offsetWidth - z - e.right, e.top !== null ? s = e.top : s = this.viewer.el.offsetHeight - z - e.bottom, this.overlayPass.setViewport(t, s, z, z);
496
+ e.left !== null ? t = e.left : t = this.viewer.el.offsetWidth - $ - e.right, e.top !== null ? s = e.top : s = this.viewer.el.offsetHeight - $ - e.bottom, this.overlayPass.setViewport(t, s, $, $);
386
497
  };
387
498
  enable() {
388
499
  return this.viewer.renderPipeline.addOverlayPass(this.overlayPass), this.viewer.addEventListener("beforeRender", this._update), this.viewer.render(), this;
@@ -391,7 +502,42 @@ class _t extends wt {
391
502
  return this.viewer.renderPipeline.removeOverlayPass(this.overlayPass), this.viewer.removeEventListener("beforeRender", this._update), this.viewer.render(), this;
392
503
  }
393
504
  }
394
- class Nt {
505
+ const Ae = "position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;overflow:hidden;", as = Ae + "z-index:0;", os = Ae + "z-index:1;";
506
+ class cs {
507
+ el;
508
+ css2dRenderer = null;
509
+ css3dRenderer = null;
510
+ constructor(e) {
511
+ this.el = e, getComputedStyle(e).position === "static" && (e.style.position = "relative");
512
+ }
513
+ initCSS2DRenderer() {
514
+ const e = new Ut();
515
+ return e.setSize(this.el.clientWidth, this.el.clientHeight), e.domElement.style.cssText = os, this.el.appendChild(e.domElement), this.css2dRenderer = e, e;
516
+ }
517
+ initCSS3DRenderer() {
518
+ const e = new Gt();
519
+ return e.setSize(this.el.clientWidth, this.el.clientHeight), e.domElement.style.cssText = as, this.el.appendChild(e.domElement), this.css3dRenderer = e, e;
520
+ }
521
+ createCSS2DObject(e) {
522
+ return this.css2dRenderer || this.initCSS2DRenderer(), new kt(e);
523
+ }
524
+ createCSS25DObject(e) {
525
+ return this.css3dRenderer || this.initCSS3DRenderer(), new Ft(e);
526
+ }
527
+ createCSS3DObject(e) {
528
+ return this.css3dRenderer || this.initCSS3DRenderer(), new zt(e);
529
+ }
530
+ render(e, t) {
531
+ this.css2dRenderer && this.css2dRenderer.render(e, t), this.css3dRenderer && this.css3dRenderer.render(e, t);
532
+ }
533
+ resize(e, t) {
534
+ this.css2dRenderer && this.css2dRenderer.setSize(e, t), this.css3dRenderer && this.css3dRenderer.setSize(e, t);
535
+ }
536
+ dispose() {
537
+ this.css2dRenderer && (this.el.removeChild(this.css2dRenderer.domElement), this.css2dRenderer = null), this.css3dRenderer && (this.el.removeChild(this.css3dRenderer.domElement), this.css3dRenderer = null);
538
+ }
539
+ }
540
+ class hs {
395
541
  el;
396
542
  renderer;
397
543
  container;
@@ -406,19 +552,19 @@ class Nt {
406
552
  this.el = e, this.renderer = t;
407
553
  const s = document.createElement("div");
408
554
  s.style.position = "absolute", s.style.left = "12px", s.style.bottom = "12px", s.style.fontSize = "12px", s.style.color = "#fff", s.style.pointerEvents = "none", this.container = s;
409
- function n(r, a = !0) {
410
- const o = document.createElement("span");
411
- return a && (o.style.marginLeft = "6px"), o.innerText = r, o;
555
+ function i(r, o = !0) {
556
+ const c = document.createElement("span");
557
+ return o && (c.style.marginLeft = "6px"), c.innerText = r, c;
412
558
  }
413
- function i() {
559
+ function n() {
414
560
  return document.createElement("br");
415
561
  }
416
- this.drawCallsText = n("0"), this.frameCallsText = n("0"), this.trianglesText = n("0"), this.linesText = n("0"), this.pointsText = n("0"), this.timestampText = n("0"), this.container.appendChild(n("draw calls", !1)), this.container.appendChild(this.drawCallsText), this.container.appendChild(i()), this.container.appendChild(n("frame calls", !1)), this.container.appendChild(this.frameCallsText), this.container.appendChild(i()), this.container.appendChild(n("triangles", !1)), this.container.appendChild(this.trianglesText), this.container.appendChild(i()), this.container.appendChild(n("points", !1)), this.container.appendChild(this.pointsText), this.container.appendChild(i()), this.container.appendChild(n("lines", !1)), this.container.appendChild(this.linesText), this.container.appendChild(i()), this.container.appendChild(n("timestamp", !1)), this.container.appendChild(this.timestampText), this.container.appendChild(i());
562
+ this.drawCallsText = i("0"), this.frameCallsText = i("0"), this.trianglesText = i("0"), this.linesText = i("0"), this.pointsText = i("0"), this.timestampText = i("0"), this.container.appendChild(i("draw calls", !1)), this.container.appendChild(this.drawCallsText), this.container.appendChild(n()), this.container.appendChild(i("frame calls", !1)), this.container.appendChild(this.frameCallsText), this.container.appendChild(n()), this.container.appendChild(i("triangles", !1)), this.container.appendChild(this.trianglesText), this.container.appendChild(n()), this.container.appendChild(i("points", !1)), this.container.appendChild(this.pointsText), this.container.appendChild(n()), this.container.appendChild(i("lines", !1)), this.container.appendChild(this.linesText), this.container.appendChild(n()), this.container.appendChild(i("timestamp", !1)), this.container.appendChild(this.timestampText), this.container.appendChild(n());
417
563
  }
418
564
  update() {
419
565
  if (this._enabled) {
420
566
  const { render: e } = this.renderer.info;
421
- this.drawCallsText.innerText = e.drawCalls.toString(), this.frameCallsText.innerText = e.frameCalls.toString(), this.trianglesText.innerText = e.triangles.toString(), this.pointsText.innerText = e.points.toString(), this.linesText.innerText = e.lines.toString(), this.renderer.resolveTimestampsAsync(je.RENDER).then((t) => {
567
+ this.drawCallsText.innerText = e.drawCalls.toString(), this.frameCallsText.innerText = e.frameCalls.toString(), this.trianglesText.innerText = e.triangles.toString(), this.pointsText.innerText = e.points.toString(), this.linesText.innerText = e.lines.toString(), this.renderer.resolveTimestampsAsync(Ye.RENDER).then((t) => {
422
568
  this.timestampText.innerText = t?.toFixed(2) ?? "0";
423
569
  });
424
570
  }
@@ -433,8 +579,8 @@ class Nt {
433
579
  this.disable();
434
580
  }
435
581
  }
436
- ke.enabled = !0;
437
- class Cs extends Ge {
582
+ Je.enabled = !0;
583
+ class ei extends Ze {
438
584
  el;
439
585
  renderer;
440
586
  scene;
@@ -447,14 +593,15 @@ class Cs extends Ge {
447
593
  interactionManager;
448
594
  objectManager;
449
595
  viewerHelper;
596
+ cssRenderer;
450
597
  frameCount = 1;
451
598
  frameloop = "demand";
452
599
  constructor({ el: e, rendererOptions: t }) {
453
- super(), this.el = e, this.renderer = this._initRenderer(t), this.scene = this.createScene(), this.camera = this.createPerspectiveCamera(), this.info = new Nt(this.el, this.renderer), this.controls = new Bt(this.camera, this.renderer.domElement), this.renderPipeline = new Lt(this.renderer, this.scene, this.camera), this.timer = new Fe(), this.roomEnvironment = new Rt(this.renderer), this.interactionManager = new Pt(this.renderer.domElement, this.scene, this.camera), this.objectManager = new St(), this.viewerHelper = new _t(this), window.addEventListener("resize", this.onWindowResize);
600
+ super(), this.el = e, this.renderer = this._initRenderer(t), this.scene = this.createScene(), this.camera = this.createPerspectiveCamera(), this.info = new hs(this.el, this.renderer), this.controls = new ss(this.camera, this.renderer.domElement), this.renderPipeline = new es(this.renderer, this.scene, this.camera), this.timer = new Ve(), this.roomEnvironment = new ns(this.renderer), this.interactionManager = new Zt(this.renderer.domElement, this.scene, this.camera), this.objectManager = new Vt(), this.viewerHelper = new rs(this), this.cssRenderer = new cs(this.el), window.addEventListener("resize", this.onWindowResize);
454
601
  }
455
602
  onWindowResize = () => {
456
603
  const e = this.el.clientWidth, t = this.el.clientHeight;
457
- this.camera instanceof X ? (this.camera.aspect = e / t, this.camera.updateProjectionMatrix()) : this.camera instanceof $ && (this.camera.left = -e / 2, this.camera.right = e / 2, this.camera.top = t / 2, this.camera.bottom = -t / 2, this.camera.updateProjectionMatrix()), this.renderer.setSize(e, t), this.render();
604
+ this.camera instanceof K ? (this.camera.aspect = e / t, this.camera.updateProjectionMatrix()) : this.camera instanceof Q && (this.camera.left = -e / 2, this.camera.right = e / 2, this.camera.top = t / 2, this.camera.bottom = -t / 2, this.camera.updateProjectionMatrix()), this.renderer.setSize(e, t), this.cssRenderer.resize(e, t), this.render();
458
605
  };
459
606
  async init() {
460
607
  await this.renderer.init(), this.roomEnvironment.update(), this.scene.environment = this.roomEnvironment.envMap;
@@ -463,7 +610,7 @@ class Cs extends Ge {
463
610
  this.camera = e, this.controls.camera = e, this.interactionManager.setCamera(e), this.renderPipeline.setCamera(e), this.onWindowResize(), this.dispatchEvent({ type: "cameraChange", camera: e });
464
611
  }
465
612
  setCameraByType(e) {
466
- e === "perspective" && !(this.camera instanceof X) ? this.setCamera(this.createPerspectiveCamera()) : e === "orthographic" && !(this.camera instanceof $) && this.setCamera(this.createOrthographicCamera());
613
+ e === "perspective" && !(this.camera instanceof K) ? this.setCamera(this.createPerspectiveCamera()) : e === "orthographic" && !(this.camera instanceof Q) && this.setCamera(this.createOrthographicCamera());
467
614
  }
468
615
  render(e = 1) {
469
616
  return this.frameCount += e, new Promise((t) => {
@@ -478,28 +625,28 @@ class Cs extends Ge {
478
625
  const t = this.timer.getDelta();
479
626
  this.dispatchEvent({ type: "beforeControlsUpdate", time: e, delta: t });
480
627
  let s = this.controls.update(t);
481
- this.dispatchEvent({ type: "afterControlsUpdate", time: e, delta: t }), this.frameCount > 0 && (this.frameCount--, s = !0), this.frameloop === "always" && (s = !0), s && (this.dispatchEvent({ type: "beforeRender", time: e, delta: t }), this.renderer.info.reset(), this.renderPipeline.render(), this.info.update(), this.dispatchEvent({ type: "afterRender", time: e, delta: t }));
628
+ this.dispatchEvent({ type: "afterControlsUpdate", time: e, delta: t }), this.frameCount > 0 && (this.frameCount--, s = !0), this.frameloop === "always" && (s = !0), s && (this.dispatchEvent({ type: "beforeRender", time: e, delta: t }), this.renderer.info.reset(), this.renderPipeline.render(), this.cssRenderer.render(this.scene, this.camera), this.info.update(), this.dispatchEvent({ type: "afterRender", time: e, delta: t }));
482
629
  };
483
630
  _initRenderer(e) {
484
- const t = new He({
631
+ const t = new et({
485
632
  logarithmicDepthBuffer: !0,
486
633
  antialias: !1,
487
634
  depth: !1,
488
635
  trackTimestamp: !0,
489
636
  ...e
490
637
  });
491
- return t.setSize(this.el.clientWidth, this.el.clientHeight), t.shadowMap.enabled = !0, t.shadowMap.type = ze, t.toneMapping = $e, t.toneMappingExposure = 1, t.info.autoReset = !1, t.setPixelRatio(window.devicePixelRatio), t.setAnimationLoop(this.animate), this.el.appendChild(t.domElement), t;
638
+ return t.setSize(this.el.clientWidth, this.el.clientHeight), t.shadowMap.enabled = !0, t.shadowMap.type = tt, t.toneMapping = st, t.toneMappingExposure = 1, t.info.autoReset = !1, t.setPixelRatio(window.devicePixelRatio), t.setAnimationLoop(this.animate), this.el.appendChild(t.domElement), t;
492
639
  }
493
640
  createScene() {
494
- const e = new We();
495
- return e.background = new te(0), e;
641
+ const e = new it();
642
+ return e.background = new V(0), e;
496
643
  }
497
644
  createPerspectiveCamera() {
498
- const e = new X(50, this.el.clientWidth / this.el.clientHeight, 0.1, 1e5);
645
+ const e = new K(50, this.el.clientWidth / this.el.clientHeight, 0.1, 1e5);
499
646
  return e.position.setScalar(5), e;
500
647
  }
501
648
  createOrthographicCamera() {
502
- const e = new $(
649
+ const e = new Q(
503
650
  -this.el.clientWidth / 2,
504
651
  this.el.clientWidth / 2,
505
652
  this.el.clientHeight / 2,
@@ -510,194 +657,194 @@ class Cs extends Ge {
510
657
  return e.position.setScalar(5), e;
511
658
  }
512
659
  dispose() {
513
- this.el.removeChild(this.renderer.domElement), window.removeEventListener("resize", this.onWindowResize), this.info.dispose(), this.interactionManager.dispose(), this.roomEnvironment.dispose(), this.renderPipeline.dispose(), this.renderer.dispose();
660
+ this.el.removeChild(this.renderer.domElement), window.removeEventListener("resize", this.onWindowResize), this.info.dispose(), this.interactionManager.dispose(), this.roomEnvironment.dispose(), this.cssRenderer.dispose(), this.renderPipeline.dispose(), this.renderer.dispose();
514
661
  }
515
662
  }
516
- class Ut extends xe {
663
+ class ls extends Le {
517
664
  constructor(e) {
518
665
  super(e);
519
666
  }
520
- parse(e, t, s, n) {
521
- if (Dt(e.slice(0, 8)) === "SBMG----") {
522
- const r = jt(e.slice(8));
523
- return super.parse(r, t, s, n);
667
+ parse(e, t, s, i) {
668
+ if (ds(e.slice(0, 8)) === "SBMG----") {
669
+ const r = ps(e.slice(8));
670
+ return super.parse(r, t, s, i);
524
671
  } else
525
- return super.parse(e, t, s, n);
672
+ return super.parse(e, t, s, i);
526
673
  }
527
674
  }
528
- function Dt(c) {
529
- return new TextDecoder().decode(new Uint8Array(c));
675
+ function ds(a) {
676
+ return new TextDecoder().decode(new Uint8Array(a));
530
677
  }
531
- function jt(c) {
532
- const e = new DataView(c);
678
+ function ps(a) {
679
+ const e = new DataView(a);
533
680
  for (let t = 0; t < e.byteLength; t++) {
534
- const s = e.getUint8(t), n = (s >> 4 & 15) + (s << 4 & 240);
535
- e.setUint8(t, n);
681
+ const s = e.getUint8(t), i = (s >> 4 & 15) + (s << 4 & 240);
682
+ e.setUint8(t, i);
536
683
  }
537
684
  return e.buffer;
538
685
  }
539
- const kt = 8, Gt = 130, pe = 66, Ft = "SBK-----", Ht = "SBM-----", Me = new TextDecoder(), zt = new TextEncoder();
540
- function $t(c) {
541
- let e = kt;
542
- const t = new Uint8Array(c, 0, e);
543
- if (Me.decode(t) !== Ft)
544
- return c;
545
- e += Gt;
546
- const n = new Uint8Array(c, 0, e);
547
- if (n[40] === 1) {
548
- const r = zt.encode(Ht), a = new Uint8Array([n[41]]), o = Wt(n), h = Qt(o);
549
- let l = pe % h.length;
550
- const p = e + pe, g = new Uint8Array(c, p), u = new Uint8Array(g.length);
686
+ const us = 8, ms = 130, ye = 66, gs = "SBK-----", fs = "SBM-----", Ne = new TextDecoder(), ys = new TextEncoder();
687
+ function ws(a) {
688
+ let e = us;
689
+ const t = new Uint8Array(a, 0, e);
690
+ if (Ne.decode(t) !== gs)
691
+ return a;
692
+ e += ms;
693
+ const i = new Uint8Array(a, 0, e);
694
+ if (i[40] === 1) {
695
+ const r = ys.encode(fs), o = new Uint8Array([i[41]]), c = vs(i), h = bs(c);
696
+ let l = ye % h.length;
697
+ const d = e + ye, g = new Uint8Array(a, d), p = new Uint8Array(g.length);
551
698
  for (let v = 0; v < g.length; v++)
552
- u[v] = g[v] ^ h[l], l = (l + 1) % h.length;
553
- const w = new Uint8Array(r.length + a.length + u.length);
554
- return w.set(r), w.set(a, r.length), w.set(u, r.length + a.length), w.buffer;
699
+ p[v] = g[v] ^ h[l], l = (l + 1) % h.length;
700
+ const y = new Uint8Array(r.length + o.length + p.length);
701
+ return y.set(r), y.set(o, r.length), y.set(p, r.length + o.length), y.buffer;
555
702
  }
556
703
  }
557
- function Wt(c) {
704
+ function vs(a) {
558
705
  const e = new Uint8Array(128);
559
- return e.set(c.slice(42, 74), 0), e.set(c.slice(74, 138), 32), e.set(c.slice(8, 40), 96), e;
706
+ return e.set(a.slice(42, 74), 0), e.set(a.slice(74, 138), 32), e.set(a.slice(8, 40), 96), e;
560
707
  }
561
- function Qt(c) {
708
+ function bs(a) {
562
709
  const e = new Uint8Array(64);
563
- return e.set(c.slice(0, 8), 0), e.set(c.slice(24, 32), 8), e.set(c.slice(40, 56), 16), e.set(c.slice(64, 88), 32), e.set(c.slice(96, 104), 56), e;
710
+ return e.set(a.slice(0, 8), 0), e.set(a.slice(24, 32), 8), e.set(a.slice(40, 56), 16), e.set(a.slice(64, 88), 32), e.set(a.slice(96, 104), 56), e;
564
711
  }
565
- const Kt = (c, e, t) => {
566
- const s = c.buffer.slice(t, t + e);
567
- let n = Me.decode(s);
568
- return n = n.replace("\\", "/"), n.startsWith("Maps/") || (n = `Maps/${n}`), n;
569
- }, Xt = (c, e, t) => {
570
- const [s, n, i, r, a] = e, o = t || r < 1;
571
- return new I({
572
- name: c,
573
- color: new te(s, n, i),
712
+ const Cs = (a, e, t) => {
713
+ const s = a.buffer.slice(t, t + e);
714
+ let i = Ne.decode(s);
715
+ return i = i.replace("\\", "/"), i.startsWith("Maps/") || (i = `Maps/${i}`), i;
716
+ }, Ts = (a, e, t) => {
717
+ const [s, i, n, r, o] = e, c = t || r < 1;
718
+ return new L({
719
+ name: a,
720
+ color: new V(s, i, n),
574
721
  opacity: r,
575
- transparent: o,
722
+ transparent: c,
576
723
  alphaTest: 0.01,
577
- side: a
724
+ side: o
578
725
  });
579
- }, qt = (c) => c?.toLowerCase().endsWith(".png") ?? !1;
580
- class Yt {
726
+ }, Ss = (a) => a?.toLowerCase().endsWith(".png") ?? !1;
727
+ class xs {
581
728
  data;
582
729
  options;
583
730
  textureLoader;
584
731
  littleEndian = !0;
585
732
  materials = /* @__PURE__ */ new Map();
586
733
  constructor(e, t) {
587
- this.data = e, this.options = t, this.textureLoader = new ye(t.manager), this.textureLoader.setCrossOrigin(t.crossOrigin), this.textureLoader.setRequestHeader(t.requestHeader);
734
+ this.data = e, this.options = t, this.textureLoader = new Me(t.manager), this.textureLoader.setCrossOrigin(t.crossOrigin), this.textureLoader.setRequestHeader(t.requestHeader);
588
735
  }
589
736
  parse(e, t) {
590
737
  let s = this.data;
591
- const n = $t(this.data);
592
- n && (s = n);
593
- const i = new DataView(s);
738
+ const i = ws(this.data);
739
+ i && (s = i);
740
+ const n = new DataView(s);
594
741
  let r = 8;
595
- const a = i.getUint8(r);
596
- r += 1, a === 1 ? this._parseV2(i, r, e) : a === 2 ? this._parseV2(i, r, e) : a === 3 ? this._parseV3(i, r, e) : t?.(new Error(`SBMLoader: Unsupported SBM version: ${a}`));
742
+ const o = n.getUint8(r);
743
+ r += 1, o === 1 ? this._parseV2(n, r, e) : o === 2 ? this._parseV2(n, r, e) : o === 3 ? this._parseV3(n, r, e) : t?.(new Error(`SBMLoader: Unsupported SBM version: ${o}`));
597
744
  }
598
745
  _parseV2(e, t, s) {
599
- const n = new Q(), i = e.getUint16(t, this.littleEndian);
746
+ const i = new ee(), n = e.getUint16(t, this.littleEndian);
600
747
  t += 2;
601
748
  const r = e.getUint16(t, this.littleEndian);
602
749
  t += 2;
603
- for (let a = 0; a < i; ++a) {
604
- const o = e.getUint16(t, this.littleEndian).toString();
750
+ for (let o = 0; o < n; ++o) {
751
+ const c = e.getUint16(t, this.littleEndian).toString();
605
752
  t += 2, t += 4, t += 4, t += 4, t += 4;
606
753
  const h = e.getFloat32(t, this.littleEndian);
607
754
  t += 4;
608
755
  const l = e.getFloat32(t, this.littleEndian);
609
756
  t += 4;
610
- const p = e.getFloat32(t, this.littleEndian);
757
+ const d = e.getFloat32(t, this.littleEndian);
611
758
  t += 4;
612
759
  const g = e.getFloat32(t, this.littleEndian);
613
760
  t += 4, t += 4, t += 4, t += 4, t += 4;
614
- let u = e.getUint8(t);
615
- t += 1, u === 0 ? u = Xe : u === 1 ? u = qe : u === 2 && (u = Ye);
616
- const w = e.getUint16(t, this.littleEndian);
761
+ let p = e.getUint8(t);
762
+ t += 1, p === 0 ? p = at : p === 1 ? p = ot : p === 2 && (p = ct);
763
+ const y = e.getUint16(t, this.littleEndian);
617
764
  t += 2;
618
- const v = w > 0 ? Kt(e, w, t) : "";
619
- if (t += w, !this.materials.has(o)) {
620
- const b = Xt(o, [h, l, p, g, u], qt(v));
621
- this.materials.set(o, b), v && this.options.path && this.textureLoader.load(L.resolveURL(v, this.options.path), (f) => {
622
- f.colorSpace = ve, f.wrapS = ne, f.wrapT = ne, f.flipY = !1, f.anisotropy = 16, b.map = f;
765
+ const v = y > 0 ? Cs(e, y, t) : "";
766
+ if (t += y, !this.materials.has(c)) {
767
+ const b = Ts(c, [h, l, d, g, p], Ss(v));
768
+ this.materials.set(c, b), v && this.options.path && this.textureLoader.load(I.resolveURL(v, this.options.path), (f) => {
769
+ f.colorSpace = Pe, f.wrapS = ce, f.wrapT = ce, f.flipY = !1, f.anisotropy = 16, b.map = f;
623
770
  });
624
771
  }
625
772
  }
626
- for (let a = 0; a < r; ++a) {
627
- const o = e.getUint16(t, this.littleEndian).toString();
773
+ for (let o = 0; o < r; ++o) {
774
+ const c = e.getUint16(t, this.littleEndian).toString();
628
775
  t += 2;
629
776
  const h = e.getUint16(t, this.littleEndian).toString();
630
777
  t += 2;
631
- const l = [], p = [], g = [], u = [], w = e.getUint16(t, this.littleEndian);
632
- if (t += 2, w > 0)
633
- for (let m = 0; m < w; m++) {
634
- const y = new ee();
635
- y.setX(e.getFloat32(t, this.littleEndian)), t += 4, y.setY(e.getFloat32(t, this.littleEndian)), t += 4, y.setZ(e.getFloat32(t, this.littleEndian)), t += 4, l.push(y);
778
+ const l = [], d = [], g = [], p = [], y = e.getUint16(t, this.littleEndian);
779
+ if (t += 2, y > 0)
780
+ for (let m = 0; m < y; m++) {
781
+ const w = new oe();
782
+ w.setX(e.getFloat32(t, this.littleEndian)), t += 4, w.setY(e.getFloat32(t, this.littleEndian)), t += 4, w.setZ(e.getFloat32(t, this.littleEndian)), t += 4, l.push(w);
636
783
  }
637
784
  const v = e.getUint16(t, this.littleEndian);
638
785
  if (t += 2, v > 0)
639
786
  for (let m = 0; m < v; m++)
640
787
  t += 4, t += 4, t += 4;
641
- const x = e.getUint16(t, this.littleEndian);
642
- if (t += 2, x > 0)
643
- for (let m = 0; m < x; m++) {
644
- const y = new S();
645
- y.setX(e.getFloat32(t, this.littleEndian)), t += 4, y.setY(e.getFloat32(t, this.littleEndian)), t += 4, p.push(y);
788
+ const S = e.getUint16(t, this.littleEndian);
789
+ if (t += 2, S > 0)
790
+ for (let m = 0; m < S; m++) {
791
+ const w = new R();
792
+ w.setX(e.getFloat32(t, this.littleEndian)), t += 4, w.setY(e.getFloat32(t, this.littleEndian)), t += 4, d.push(w);
646
793
  }
647
794
  const b = e.getUint16(t, this.littleEndian);
648
795
  if (t += 2, b > 0)
649
796
  for (let m = 0; m < b; m++) {
650
- const y = e.getUint16(t, this.littleEndian);
651
- t += 2;
652
- const B = e.getUint16(t, this.littleEndian);
797
+ const w = e.getUint16(t, this.littleEndian);
653
798
  t += 2;
654
799
  const A = e.getUint16(t, this.littleEndian);
655
800
  t += 2;
656
- const E = [y, B, A];
657
- g.push(E), p.length > 0 && u.push([p[E[0]], p[E[1]], p[E[2]]]);
801
+ const N = e.getUint16(t, this.littleEndian);
802
+ t += 2;
803
+ const E = [w, A, N];
804
+ g.push(E), d.length > 0 && p.push([d[E[0]], d[E[1]], d[E[2]]]);
658
805
  }
659
- const f = [], C = [];
806
+ const f = [], T = [];
660
807
  for (let m = 0; m < g.length; m++) {
661
- const y = g[m], B = l[y[0]], A = l[y[1]], E = l[y[2]];
662
- f.push(...B.toArray(), ...A.toArray(), ...E.toArray());
663
- let H = new S(), k = new S(), _ = new S();
664
- const N = u[m];
665
- N !== void 0 && (H = N[0], k = N[1], _ = N[2]), C.push(...H.toArray(), ...k.toArray(), ..._.toArray());
808
+ const w = g[m], A = l[w[0]], N = l[w[1]], E = l[w[2]];
809
+ f.push(...A.toArray(), ...N.toArray(), ...E.toArray());
810
+ let H = new R(), G = new R(), _ = new R();
811
+ const D = p[m];
812
+ D !== void 0 && (H = D[0], G = D[1], _ = D[2]), T.push(...H.toArray(), ...G.toArray(), ..._.toArray());
666
813
  }
667
- const O = new Float32Array(f), P = new Float32Array(C), M = new Ke();
668
- if (O.length > 0 && M.setAttribute("position", new ie(O, 3)), P.length > 0 && M.setAttribute("uv", new ie(P, 2)), M.computeVertexNormals(), this.materials.has(h)) {
669
- const m = new F(M, this.materials.get(h));
670
- m.name = o, m.castShadow = !0, m.receiveShadow = !0, n.add(m);
814
+ const M = new Float32Array(f), P = new Float32Array(T), x = new rt();
815
+ if (M.length > 0 && x.setAttribute("position", new he(M, 3)), P.length > 0 && x.setAttribute("uv", new he(P, 2)), x.computeVertexNormals(), this.materials.has(h)) {
816
+ const m = new z(x, this.materials.get(h));
817
+ m.name = c, m.castShadow = !0, m.receiveShadow = !0, i.add(m);
671
818
  }
672
819
  }
673
- s(n);
820
+ s(i);
674
821
  }
675
822
  _parseV3(e, t, s) {
676
- const n = new Q();
677
- console.warn("SBMLoader: SBM version 3 is not supported yet."), s(n);
823
+ const i = new ee();
824
+ console.warn("SBMLoader: SBM version 3 is not supported yet."), s(i);
678
825
  }
679
826
  }
680
- class Jt extends Qe {
681
- load(e, t, s, n) {
682
- let i;
827
+ class Es extends nt {
828
+ load(e, t, s, i) {
829
+ let n;
683
830
  if (this.resourcePath !== "")
684
- i = this.resourcePath;
831
+ n = this.resourcePath;
685
832
  else if (this.path !== "") {
686
- const o = L.extractUrlBase(e);
687
- i = L.resolveURL(o, this.path);
833
+ const c = I.extractUrlBase(e);
834
+ n = I.resolveURL(c, this.path);
688
835
  } else
689
- i = L.extractUrlBase(e);
836
+ n = I.extractUrlBase(e);
690
837
  this.manager.itemStart(e);
691
- const r = (o) => {
692
- n ? n(o) : console.error(o), this.manager.itemError(e), this.manager.itemEnd(e);
693
- }, a = new we(this.manager);
694
- a.setPath(this.path), a.setResponseType("arraybuffer"), a.setRequestHeader(this.requestHeader), a.setWithCredentials(this.withCredentials), a.load(
838
+ const r = (c) => {
839
+ i ? i(c) : console.error(c), this.manager.itemError(e), this.manager.itemEnd(e);
840
+ }, o = new Ee(this.manager);
841
+ o.setPath(this.path), o.setResponseType("arraybuffer"), o.setRequestHeader(this.requestHeader), o.setWithCredentials(this.withCredentials), o.load(
695
842
  e,
696
- (o) => {
843
+ (c) => {
697
844
  try {
698
845
  this.parse(
699
- o,
700
- i,
846
+ c,
847
+ n,
701
848
  (h) => {
702
849
  t(h), this.manager.itemEnd(e);
703
850
  },
@@ -711,49 +858,49 @@ class Jt extends Qe {
711
858
  r
712
859
  );
713
860
  }
714
- parse(e, t, s, n) {
715
- const i = new TextDecoder().decode(e.slice(0, 8));
716
- if (i !== "SBK-----" && i !== "SBM-----") {
717
- n?.(new Error(`SBMLoader: Invalid SBM format: ${i}`));
861
+ parse(e, t, s, i) {
862
+ const n = new TextDecoder().decode(e.slice(0, 8));
863
+ if (n !== "SBK-----" && n !== "SBM-----") {
864
+ i?.(new Error(`SBMLoader: Invalid SBM format: ${n}`));
718
865
  return;
719
866
  }
720
- new Yt(e, {
867
+ new xs(e, {
721
868
  path: t,
722
869
  crossOrigin: this.crossOrigin,
723
870
  requestHeader: this.requestHeader,
724
871
  manager: this.manager
725
- }).parse(s, n);
872
+ }).parse(s, i);
726
873
  }
727
874
  parseAsync(e, t) {
728
- return new Promise((s, n) => {
875
+ return new Promise((s, i) => {
729
876
  this.parse(
730
877
  e,
731
878
  t,
732
- (i) => {
733
- s(i);
879
+ (n) => {
880
+ s(n);
734
881
  },
735
- (i) => {
736
- n(i);
882
+ (n) => {
883
+ i(n);
737
884
  }
738
885
  );
739
886
  });
740
887
  }
741
888
  }
742
- class R {
889
+ class B {
743
890
  static CACHE_NAME = "u-space-model-loader-cache";
744
- static fileLoader = new we().setResponseType("arraybuffer");
745
- static dracoLoader = new Tt().setDecoderPath(
746
- `https://cdn.jsdelivr.net/npm/three@0.${re}.0/examples/jsm/libs/draco/`
891
+ static fileLoader = new Ee().setResponseType("arraybuffer");
892
+ static dracoLoader = new Kt().setDecoderPath(
893
+ `https://cdn.jsdelivr.net/npm/three@0.${le}.0/examples/jsm/libs/draco/`
747
894
  );
748
- static ktx2Loader = new Ct().setTranscoderPath(
749
- `https://cdn.jsdelivr.net/npm/three@0.${re}.0/examples/jsm/libs/basis/`
895
+ static ktx2Loader = new Qt().setTranscoderPath(
896
+ `https://cdn.jsdelivr.net/npm/three@0.${le}.0/examples/jsm/libs/basis/`
750
897
  );
751
- static gltfLoader = new xe().setDRACOLoader(R.dracoLoader).setKTX2Loader(R.ktx2Loader).setMeshoptDecoder(le);
752
- static sbmxLoader = new Ut().setDRACOLoader(R.dracoLoader).setKTX2Loader(R.ktx2Loader).setMeshoptDecoder(le);
753
- static sbmLoader = new Jt();
754
- static fbxLoader = new yt();
755
- static objLoader = new vt();
756
- static stlLoader = new bt();
898
+ static gltfLoader = new Le().setDRACOLoader(B.dracoLoader).setKTX2Loader(B.ktx2Loader).setMeshoptDecoder(ge);
899
+ static sbmxLoader = new ls().setDRACOLoader(B.dracoLoader).setKTX2Loader(B.ktx2Loader).setMeshoptDecoder(ge);
900
+ static sbmLoader = new Es();
901
+ static fbxLoader = new Ht();
902
+ static objLoader = new $t();
903
+ static stlLoader = new Wt();
757
904
  static setLoadingManager(e) {
758
905
  this.fileLoader.manager = e, this.dracoLoader.manager = e, this.ktx2Loader.manager = e, this.gltfLoader.manager = e, this.sbmxLoader.manager = e, this.sbmLoader.manager = e, this.fbxLoader.manager = e, this.objLoader.manager = e, this.stlLoader.manager = e;
759
906
  }
@@ -777,25 +924,25 @@ class R {
777
924
  }
778
925
  static async loadAsync(e, t = { persistent: !0 }) {
779
926
  const s = e.split(".").pop()?.split("?")[0].toLowerCase();
780
- let n;
781
- switch (t.persistent && typeof caches < "u" ? n = await this.getPersistentData(e) : n = await this.fileLoader.loadAsync(e), s) {
927
+ let i;
928
+ switch (t.persistent && typeof caches < "u" ? i = await this.getPersistentData(e) : i = await this.fileLoader.loadAsync(e), s) {
782
929
  case "gltf":
783
930
  case "glb":
784
- const i = await this.gltfLoader.parseAsync(n, L.extractUrlBase(e));
785
- return i.scene.animations = i.animations, i.scene;
931
+ const n = await this.gltfLoader.parseAsync(i, I.extractUrlBase(e));
932
+ return n.scene.animations = n.animations, n.scene;
786
933
  case "sbmx":
787
- const r = await this.sbmxLoader.parseAsync(n, L.extractUrlBase(e));
934
+ const r = await this.sbmxLoader.parseAsync(i, I.extractUrlBase(e));
788
935
  return r.scene.animations = r.animations, r.scene;
789
936
  case "sbm":
790
- return await this.sbmLoader.parseAsync(n, L.extractUrlBase(e));
937
+ return await this.sbmLoader.parseAsync(i, I.extractUrlBase(e));
791
938
  case "fbx":
792
- return this.fbxLoader.parse(n, L.extractUrlBase(e));
939
+ return this.fbxLoader.parse(i, I.extractUrlBase(e));
793
940
  case "obj":
794
- const h = new TextDecoder().decode(n);
941
+ const h = new TextDecoder().decode(i);
795
942
  return this.objLoader.parse(h);
796
943
  case "stl":
797
- const p = this.stlLoader.parse(n);
798
- return new F(p, new I());
944
+ const d = this.stlLoader.parse(i);
945
+ return new z(d, new L());
799
946
  default:
800
947
  throw new Error(`Unsupported model format: ${s}`);
801
948
  }
@@ -805,17 +952,17 @@ class R {
805
952
  const t = await caches.open(this.CACHE_NAME), s = await t.match(e);
806
953
  if (s)
807
954
  return await s.arrayBuffer();
808
- const n = await this.fileLoader.loadAsync(e), i = new Response(n);
809
- return await t.put(e, i), n;
955
+ const i = await this.fileLoader.loadAsync(e), n = new Response(i);
956
+ return await t.put(e, n), i;
810
957
  } catch (t) {
811
958
  return console.warn(`[LoaderManager] Failed to use Cache API for ${e}:`, t), await this.fileLoader.loadAsync(e);
812
959
  }
813
960
  }
814
961
  }
815
- class xs {
816
- static textureLoader = new ye();
817
- static hdrLoader = new xt();
818
- static cubeTextureLoader = new Je();
962
+ class ti {
963
+ static textureLoader = new Me();
964
+ static hdrLoader = new Xt();
965
+ static cubeTextureLoader = new ht();
819
966
  static setLoadingManager(e) {
820
967
  this.textureLoader.manager = e, this.hdrLoader.manager = e, this.cubeTextureLoader.manager = e;
821
968
  }
@@ -824,13 +971,13 @@ class xs {
824
971
  }
825
972
  static async loadAsyncHDR(e) {
826
973
  const t = await this.hdrLoader.loadAsync(e);
827
- return t.mapping = Ze, t;
974
+ return t.mapping = lt, t;
828
975
  }
829
976
  static async loadAsyncCubeTexture(e, t) {
830
977
  return this.cubeTextureLoader.setPath(e), await this.cubeTextureLoader.loadAsync(t);
831
978
  }
832
979
  }
833
- class j extends F {
980
+ class k extends z {
834
981
  isBaseMesh = !0;
835
982
  type = "BaseMesh";
836
983
  ignoreInvisibleWhenRaycast = !0;
@@ -841,7 +988,7 @@ class j extends F {
841
988
  return this.visible === !1 && this.ignoreInvisibleWhenRaycast === !0 ? !1 : super.raycast(e, t);
842
989
  }
843
990
  }
844
- class Ee extends Q {
991
+ class Be extends ee {
845
992
  isBaseGroup = !0;
846
993
  type = "BaseGroup";
847
994
  ignoreInvisibleWhenRaycast = !0;
@@ -852,7 +999,7 @@ class Ee extends Q {
852
999
  return this.visible === !1 && this.ignoreInvisibleWhenRaycast === !0 ? !1 : super.raycast(e, t);
853
1000
  }
854
1001
  }
855
- class Zt extends Ve {
1002
+ class Ms extends dt {
856
1003
  isBaseSprite = !0;
857
1004
  type = "BaseSprite";
858
1005
  ignoreInvisibleWhenRaycast = !0;
@@ -863,7 +1010,7 @@ class Zt extends Ve {
863
1010
  return this.visible === !1 && this.ignoreInvisibleWhenRaycast === !0 ? !1 : super.raycast(e, t);
864
1011
  }
865
1012
  }
866
- class W extends Ee {
1013
+ class Z extends Be {
867
1014
  isModel = !0;
868
1015
  type = "Model";
869
1016
  static memoryCache = /* @__PURE__ */ new Map();
@@ -874,24 +1021,24 @@ class W extends Ee {
874
1021
  super();
875
1022
  }
876
1023
  async loadAsync(e) {
877
- const { url: t, cache: s = !0, persistent: n = !0 } = e;
1024
+ const { url: t, cache: s = !0, persistent: i = !0 } = e;
878
1025
  try {
879
- let i;
880
- s ? W.memoryCache.has(t) ? i = W.memoryCache.get(t) : (i = R.loadAsync(t, { persistent: n }), W.memoryCache.set(t, i)) : i = R.loadAsync(t, { persistent: n });
881
- const r = await i, a = Mt(r);
882
- return this.add(a), a.animations && a.animations.length > 0 && (this.animations = a.animations, this.mixer = new et(a)), a;
883
- } catch (i) {
884
- return console.error(`[Model] Failed to load model from ${t}:`, i), null;
1026
+ let n;
1027
+ s ? Z.memoryCache.has(t) ? n = Z.memoryCache.get(t) : (n = B.loadAsync(t, { persistent: i }), Z.memoryCache.set(t, n)) : n = B.loadAsync(t, { persistent: i });
1028
+ const r = await n, o = qt(r);
1029
+ return this.add(o), o.animations && o.animations.length > 0 && (this.animations = o.animations, this.mixer = new pt(o)), o;
1030
+ } catch (n) {
1031
+ return console.error(`[Model] Failed to load model from ${t}:`, n), null;
885
1032
  }
886
1033
  }
887
1034
  playAnimation(e, t = {}) {
888
1035
  if (!this.mixer || this.animations.length === 0) return null;
889
- const { loop: s = !0, repetitions: n = 1 / 0, timeScale: i = 1, clampWhenFinished: r = !1 } = t;
890
- let a;
891
- if (e === void 0 ? a = this.animations[0] : typeof e == "number" ? a = this.animations[e] : a = this.animations.find((h) => h.name === e), !a)
1036
+ const { loop: s = !0, repetitions: i = 1 / 0, timeScale: n = 1, clampWhenFinished: r = !1 } = t;
1037
+ let o;
1038
+ if (e === void 0 ? o = this.animations[0] : typeof e == "number" ? o = this.animations[e] : o = this.animations.find((h) => h.name === e), !o)
892
1039
  return console.warn(`[Model] Animation not found: ${e}`), null;
893
- let o = this.actions.get(a.name);
894
- return o || (o = this.mixer.clipAction(a), this.actions.set(a.name, o)), o.setLoop(s ? tt : st, n), o.clampWhenFinished = r, o.timeScale = i, o.reset().play(), o;
1040
+ let c = this.actions.get(o.name);
1041
+ return c || (c = this.mixer.clipAction(o), this.actions.set(o.name, c)), c.setLoop(s ? ut : mt, i), c.clampWhenFinished = r, c.timeScale = n, c.reset().play(), c;
895
1042
  }
896
1043
  playAllAnimations(e = {}) {
897
1044
  return this.animations.map((t, s) => this.playAnimation(s, e)).filter((t) => t !== null);
@@ -915,11 +1062,11 @@ class W extends Ee {
915
1062
  typeof caches < "u" && await caches.delete("u-space-loader-cache");
916
1063
  }
917
1064
  }
918
- class Vt extends j {
1065
+ class Ps extends k {
919
1066
  isSphereMesh = !0;
920
1067
  type = "SphereMesh";
921
1068
  constructor({ geometryParameters: e, materialParameters: t } = {}) {
922
- super(), this.geometry = new nt(
1069
+ super(), this.geometry = new gt(
923
1070
  e?.radius,
924
1071
  e?.widthSegments,
925
1072
  e?.heightSegments,
@@ -927,23 +1074,23 @@ class Vt extends j {
927
1074
  e?.phiLength,
928
1075
  e?.thetaStart,
929
1076
  e?.thetaLength
930
- ), this.material = new I(t);
1077
+ ), this.material = new L(t);
931
1078
  }
932
1079
  }
933
- class ue extends j {
1080
+ class we extends k {
934
1081
  isTubeMesh = !0;
935
1082
  type = "TubeMesh";
936
1083
  constructor({ geometryParameters: e, materialParameters: t } = {}) {
937
- super(), this.geometry = new it(
1084
+ super(), this.geometry = new ft(
938
1085
  e?.path,
939
1086
  e?.tubularSegments,
940
1087
  e?.radius,
941
1088
  e?.radialSegments,
942
1089
  e?.closed
943
- ), this.material = new I(t);
1090
+ ), this.material = new L(t);
944
1091
  }
945
1092
  }
946
- class Ms extends Ee {
1093
+ class si extends Be {
947
1094
  isTopology = !0;
948
1095
  type = "Topology";
949
1096
  // Visuals
@@ -988,14 +1135,14 @@ class Ms extends Ee {
988
1135
  * @param weight Cost of the edge. Defaults to Euclidean distance.
989
1136
  * @param bidirectional If true, adds the reverse edge as well. Default true.
990
1137
  */
991
- addEdge(e, t, s, n = !0) {
992
- const i = this.nodes.get(e), r = this.nodes.get(t);
993
- if (!i || !r) {
1138
+ addEdge(e, t, s, i = !0) {
1139
+ const n = this.nodes.get(e), r = this.nodes.get(t);
1140
+ if (!n || !r) {
994
1141
  console.error(`[Topology] Cannot add edge. One or both nodes not found: ${e}, ${t}`);
995
1142
  return;
996
1143
  }
997
- const a = s ?? i.distanceTo(r);
998
- this.getNeighbors(e)?.set(t, a), n && this.getNeighbors(t)?.set(e, a);
1144
+ const o = s ?? n.distanceTo(r);
1145
+ this.getNeighbors(e)?.set(t, o), i && this.getNeighbors(t)?.set(e, o);
999
1146
  }
1000
1147
  /**
1001
1148
  * Remove an edge between two nodes.
@@ -1012,33 +1159,33 @@ class Ms extends Ee {
1012
1159
  getShortestPath(e, t) {
1013
1160
  if (!this.nodes.has(e) || !this.nodes.has(t))
1014
1161
  return console.warn("[Topology] Start or End node not found."), [];
1015
- const s = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Set();
1016
- for (const [o] of this.nodes)
1017
- s.set(o, 1 / 0), n.set(o, null), i.add(o);
1018
- for (s.set(e, 0); i.size > 0; ) {
1019
- let o = null, h = 1 / 0;
1020
- for (const p of i) {
1021
- const g = s.get(p);
1022
- g < h && (h = g, o = p);
1162
+ const s = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set();
1163
+ for (const [c] of this.nodes)
1164
+ s.set(c, 1 / 0), i.set(c, null), n.add(c);
1165
+ for (s.set(e, 0); n.size > 0; ) {
1166
+ let c = null, h = 1 / 0;
1167
+ for (const d of n) {
1168
+ const g = s.get(d);
1169
+ g < h && (h = g, c = d);
1023
1170
  }
1024
- if (o === null || o === t || h === 1 / 0)
1171
+ if (c === null || c === t || h === 1 / 0)
1025
1172
  break;
1026
- i.delete(o);
1027
- const l = this.adjacencyMap?.get(o);
1173
+ n.delete(c);
1174
+ const l = this.adjacencyMap?.get(c);
1028
1175
  if (l)
1029
- for (const [p, g] of l) {
1030
- if (!i.has(p)) continue;
1031
- const u = s.get(o) + g;
1032
- u < s.get(p) && (s.set(p, u), n.set(p, o));
1176
+ for (const [d, g] of l) {
1177
+ if (!n.has(d)) continue;
1178
+ const p = s.get(c) + g;
1179
+ p < s.get(d) && (s.set(d, p), i.set(d, c));
1033
1180
  }
1034
1181
  }
1035
1182
  const r = [];
1036
- let a = t;
1037
- if (n.get(t) === null && e !== t)
1183
+ let o = t;
1184
+ if (i.get(t) === null && e !== t)
1038
1185
  return [];
1039
- for (; a !== null; ) {
1040
- const o = this.nodes.get(a);
1041
- o && r.unshift(o), a = n.get(a) || null;
1186
+ for (; o !== null; ) {
1187
+ const c = this.nodes.get(o);
1188
+ c && r.unshift(c), o = i.get(o) || null;
1042
1189
  }
1043
1190
  return r;
1044
1191
  }
@@ -1046,8 +1193,8 @@ class Ms extends Ee {
1046
1193
  * Renders the entire topology graph structure using TubeGeometry and Spheres.
1047
1194
  */
1048
1195
  renderGraph() {
1049
- this.clearGraph(), this.graphGroup = new Q();
1050
- const e = new Vt({
1196
+ this.clearGraph(), this.graphGroup = new ee();
1197
+ const e = new Ps({
1051
1198
  geometryParameters: {
1052
1199
  radius: this.parameters.nodeRadius,
1053
1200
  widthSegments: 16,
@@ -1057,19 +1204,19 @@ class Ms extends Ee {
1057
1204
  color: this.parameters.nodeColor
1058
1205
  }
1059
1206
  });
1060
- this.nodes.forEach((s, n) => {
1061
- const i = e.clone();
1062
- i.position.copy(s), Object.assign(i.userData, { id: n, type: "node" }), this.graphGroup.add(i);
1207
+ this.nodes.forEach((s, i) => {
1208
+ const n = e.clone();
1209
+ n.position.copy(s), Object.assign(n.userData, { id: i, type: "node" }), this.graphGroup.add(n);
1063
1210
  });
1064
1211
  const t = /* @__PURE__ */ new Set();
1065
- this.adjacencyMap.forEach((s, n) => {
1066
- s.forEach((i, r) => {
1067
- const a = [n, r].sort().join("-");
1068
- if (t.has(a)) return;
1069
- t.add(a);
1070
- const o = this.nodes.get(n), h = this.nodes.get(r);
1071
- if (o && h) {
1072
- const l = new rt(o, h), p = new ue({
1212
+ this.adjacencyMap.forEach((s, i) => {
1213
+ s.forEach((n, r) => {
1214
+ const o = [i, r].sort().join("-");
1215
+ if (t.has(o)) return;
1216
+ t.add(o);
1217
+ const c = this.nodes.get(i), h = this.nodes.get(r);
1218
+ if (c && h) {
1219
+ const l = new yt(c, h), d = new we({
1073
1220
  geometryParameters: {
1074
1221
  path: l,
1075
1222
  tubularSegments: 1,
@@ -1081,14 +1228,14 @@ class Ms extends Ee {
1081
1228
  color: this.parameters.edgeColor
1082
1229
  }
1083
1230
  });
1084
- Object.assign(p.userData, { from: n, to: r, weight: i, type: "edge" }), this.graphGroup.add(p);
1231
+ Object.assign(d.userData, { from: i, to: r, weight: n, type: "edge" }), this.graphGroup.add(d);
1085
1232
  }
1086
1233
  });
1087
1234
  }), this.add(this.graphGroup);
1088
1235
  }
1089
1236
  clearGraph() {
1090
1237
  this.graphGroup && (this.remove(this.graphGroup), this.graphGroup.traverse((e) => {
1091
- e instanceof F && (e.geometry.dispose(), e.material.dispose());
1238
+ e instanceof z && (e.geometry.dispose(), e.material.dispose());
1092
1239
  }), this.graphGroup = null);
1093
1240
  }
1094
1241
  /**
@@ -1096,7 +1243,7 @@ class Ms extends Ee {
1096
1243
  */
1097
1244
  renderPath(e, t = this.parameters.pathColor) {
1098
1245
  if (e.length < 2) return;
1099
- const s = new at(e, !1, "catmullrom", 0), n = new ue({
1246
+ const s = new wt(e, !1, "catmullrom", 0), i = new we({
1100
1247
  geometryParameters: {
1101
1248
  path: s,
1102
1249
  tubularSegments: e.length * 10,
@@ -1107,7 +1254,7 @@ class Ms extends Ee {
1107
1254
  color: t
1108
1255
  }
1109
1256
  });
1110
- return this.add(n), this.pathMeshes.push(n), n;
1257
+ return this.add(i), this.pathMeshes.push(i), i;
1111
1258
  }
1112
1259
  clearPaths() {
1113
1260
  this.pathMeshes.forEach((e) => {
@@ -1117,14 +1264,14 @@ class Ms extends Ee {
1117
1264
  /** Export nodes and edges as a JSON-serializable object. */
1118
1265
  exportData() {
1119
1266
  const e = {};
1120
- this.nodes.forEach((n, i) => {
1121
- e[i] = { x: n.x, y: n.y, z: n.z };
1267
+ this.nodes.forEach((i, n) => {
1268
+ e[n] = { x: i.x, y: i.y, z: i.z };
1122
1269
  });
1123
1270
  const t = [], s = /* @__PURE__ */ new Set();
1124
- return this.adjacencyMap.forEach((n, i) => {
1125
- n.forEach((r, a) => {
1126
- const o = [i, a].sort().join("-");
1127
- s.has(o) || (s.add(o), t.push({ from: i, to: a, weight: r }));
1271
+ return this.adjacencyMap.forEach((i, n) => {
1272
+ i.forEach((r, o) => {
1273
+ const c = [n, o].sort().join("-");
1274
+ s.has(c) || (s.add(c), t.push({ from: n, to: o, weight: r }));
1128
1275
  });
1129
1276
  }), { nodes: e, edges: t };
1130
1277
  }
@@ -1134,9 +1281,9 @@ class Ms extends Ee {
1134
1281
  */
1135
1282
  importData(e) {
1136
1283
  this.clearGraph(), this.clearPaths(), this.nodes.clear(), this.adjacencyMap.clear(), Object.entries(e.nodes).forEach(([t, s]) => {
1137
- this.addNode(t, new ee(s.x, s.y, s.z));
1138
- }), e.edges.forEach(({ from: t, to: s, weight: n }) => {
1139
- this.addEdge(t, s, n);
1284
+ this.addNode(t, new oe(s.x, s.y, s.z));
1285
+ }), e.edges.forEach(({ from: t, to: s, weight: i }) => {
1286
+ this.addEdge(t, s, i);
1140
1287
  }), this.renderGraph();
1141
1288
  }
1142
1289
  dispose() {
@@ -1146,7 +1293,7 @@ class Ms extends Ee {
1146
1293
  return this.adjacencyMap.get(e);
1147
1294
  }
1148
1295
  }
1149
- class Es extends Zt {
1296
+ class ii extends Ms {
1150
1297
  isPoi = !0;
1151
1298
  type = "Poi";
1152
1299
  parameters = {
@@ -1165,7 +1312,7 @@ class Es extends Zt {
1165
1312
  _canvas = document.createElement("canvas");
1166
1313
  _lastParametersJSON = "";
1167
1314
  constructor(e = {}) {
1168
- super(new ot()), Object.assign(this.parameters, e), this.updateAsync();
1315
+ super(new vt()), Object.assign(this.parameters, e), this.updateAsync();
1169
1316
  }
1170
1317
  /**
1171
1318
  * Update the POI with new parameters
@@ -1176,174 +1323,221 @@ class Es extends Zt {
1176
1323
  const t = JSON.stringify(this.parameters);
1177
1324
  if (t === this._lastParametersJSON) return;
1178
1325
  this._lastParametersJSON = t;
1179
- const s = this._canvas, n = s.getContext("2d");
1180
- if (!n) return;
1181
- n.font = `${this.parameters.fontSize}px ${this.parameters.fontFamily}`;
1182
- let i = null;
1183
- this.parameters.img && (i = await this._loadImage(this.parameters.img));
1184
- const { text: r, fontSize: a, color: o, iconSize: h, padding: l, backgroundColor: p, borderRadius: g, textPosition: u, scaleFactor: w } = this.parameters, v = n.measureText(r), x = r ? v.width : 0, b = r ? a : 0;
1185
- let f = 0, C = 0, O = 0, P = 0, M = 0, m = 0;
1186
- const y = !!i, B = !!r;
1187
- if (y && B)
1188
- switch (u) {
1326
+ const s = this._canvas, i = s.getContext("2d");
1327
+ if (!i) return;
1328
+ i.font = `${this.parameters.fontSize}px ${this.parameters.fontFamily}`;
1329
+ let n = null;
1330
+ this.parameters.img && (n = await this._loadImage(this.parameters.img));
1331
+ const { text: r, fontSize: o, color: c, iconSize: h, padding: l, backgroundColor: d, borderRadius: g, textPosition: p, scaleFactor: y } = this.parameters, v = i.measureText(r), S = r ? v.width : 0, b = r ? o : 0;
1332
+ let f = 0, T = 0, M = 0, P = 0, x = 0, m = 0;
1333
+ const w = !!n, A = !!r;
1334
+ if (w && A)
1335
+ switch (p) {
1189
1336
  case "top":
1190
- f = Math.max(h, x), C = h + l + b, M = (f - x) / 2, m = b / 2, O = (f - h) / 2, P = b + l;
1337
+ f = Math.max(h, S), T = h + l + b, x = (f - S) / 2, m = b / 2, M = (f - h) / 2, P = b + l;
1191
1338
  break;
1192
1339
  case "bottom":
1193
- f = Math.max(h, x), C = h + l + b, O = (f - h) / 2, P = 0, M = (f - x) / 2, m = h + l + b / 2;
1340
+ f = Math.max(h, S), T = h + l + b, M = (f - h) / 2, P = 0, x = (f - S) / 2, m = h + l + b / 2;
1194
1341
  break;
1195
1342
  case "left":
1196
- f = h + l + x, C = Math.max(h, b), M = 0, m = C / 2, O = x + l, P = (C - h) / 2;
1343
+ f = h + l + S, T = Math.max(h, b), x = 0, m = T / 2, M = S + l, P = (T - h) / 2;
1197
1344
  break;
1198
1345
  default:
1199
- f = h + l + x, C = Math.max(h, b), O = 0, P = (C - h) / 2, M = h + l, m = C / 2;
1346
+ f = h + l + S, T = Math.max(h, b), M = 0, P = (T - h) / 2, x = h + l, m = T / 2;
1200
1347
  break;
1201
1348
  }
1202
- else y ? (f = h, C = h, O = 0, P = 0) : B && (f = x, C = b, M = 0, m = b / 2);
1203
- const A = f + l * 2, E = C + l * 2;
1204
- if (s.width = A, s.height = E, n.font = `${a}px ${this.parameters.fontFamily}`, p && (n.fillStyle = p, this._drawRoundedRect(n, 0, 0, A, E, g), n.fill()), y && n.drawImage(i, O + l, P + l, h, h), B) {
1205
- n.fillStyle = o;
1206
- const _ = n.measureText(r), N = _.actualBoundingBoxAscent + _.actualBoundingBoxDescent, Be = _.actualBoundingBoxAscent - N / 2;
1207
- n.textBaseline = "alphabetic", n.fillText(r, M + l, m + l + Be);
1349
+ else w ? (f = h, T = h, M = 0, P = 0) : A && (f = S, T = b, x = 0, m = b / 2);
1350
+ const N = f + l * 2, E = T + l * 2;
1351
+ if (s.width = N, s.height = E, i.font = `${o}px ${this.parameters.fontFamily}`, d && (i.fillStyle = d, this._drawRoundedRect(i, 0, 0, N, E, g), i.fill()), w && i.drawImage(n, M + l, P + l, h, h), A) {
1352
+ i.fillStyle = c;
1353
+ const _ = i.measureText(r), D = _.actualBoundingBoxAscent + _.actualBoundingBoxDescent, He = _.actualBoundingBoxAscent - D / 2;
1354
+ i.textBaseline = "alphabetic", i.fillText(r, x + l, m + l + He);
1208
1355
  }
1209
- const H = this.material.map, k = new ct(s);
1210
- k.colorSpace = ve, this.material.map = k, H?.dispose(), this.scale.set(A * w, E * w, 1);
1356
+ const H = this.material.map, G = new bt(s);
1357
+ G.colorSpace = Pe, this.material.map = G, H?.dispose(), this.scale.set(N * y, E * y, 1);
1211
1358
  }
1212
1359
  _loadImage(e) {
1213
1360
  return new Promise((t, s) => {
1214
1361
  if (typeof e == "string") {
1215
- const n = new Image();
1216
- n.crossOrigin = "Anonymous", n.onload = () => t(n), n.onerror = () => s(new Error(`Failed to load image: ${e}`)), n.src = e;
1362
+ const i = new Image();
1363
+ i.crossOrigin = "Anonymous", i.onload = () => t(i), i.onerror = () => s(new Error(`Failed to load image: ${e}`)), i.src = e;
1217
1364
  } else
1218
1365
  t(e);
1219
1366
  });
1220
1367
  }
1221
- _drawRoundedRect(e, t, s, n, i, r) {
1222
- e.beginPath(), e.moveTo(t + r, s), e.lineTo(t + n - r, s), e.quadraticCurveTo(t + n, s, t + n, s + r), e.lineTo(t + n, s + i - r), e.quadraticCurveTo(t + n, s + i, t + n - r, s + i), e.lineTo(t + r, s + i), e.quadraticCurveTo(t, s + i, t, s + i - r), e.lineTo(t, s + r), e.quadraticCurveTo(t, s, t + r, s), e.closePath();
1368
+ _drawRoundedRect(e, t, s, i, n, r) {
1369
+ e.beginPath(), e.moveTo(t + r, s), e.lineTo(t + i - r, s), e.quadraticCurveTo(t + i, s, t + i, s + r), e.lineTo(t + i, s + n - r), e.quadraticCurveTo(t + i, s + n, t + i - r, s + n), e.lineTo(t + r, s + n), e.quadraticCurveTo(t, s + n, t, s + n - r), e.lineTo(t, s + r), e.quadraticCurveTo(t, s, t + r, s), e.closePath();
1223
1370
  }
1224
1371
  dispose() {
1225
1372
  this.material.map?.dispose(), this.material.dispose();
1226
1373
  }
1227
1374
  }
1228
- class Oe extends j {
1375
+ class _e extends k {
1229
1376
  isShapeMesh = !0;
1230
1377
  type = "ShapeMesh";
1231
1378
  constructor({ geometryParameters: e, materialParameters: t } = {}) {
1232
- super(), this.geometry = new ht(e?.shape, e?.curveSegments), this.material = new I(t), this.geometry.rotateX(-Math.PI / 2);
1379
+ super(), this.geometry = new Ct(e?.shape, e?.curveSegments), this.material = new L(t), this.geometry.rotateX(-Math.PI / 2);
1233
1380
  }
1234
1381
  static createFromPoints(e, t = {}) {
1235
- return new Oe({
1382
+ return new _e({
1236
1383
  ...t,
1237
1384
  geometryParameters: {
1238
1385
  ...t.geometryParameters,
1239
- shape: new be(e.map((s) => new S(s.x, -s.z)))
1386
+ shape: new Oe(e.map((s) => new R(s.x, -s.z)))
1240
1387
  }
1241
1388
  });
1242
1389
  }
1243
1390
  }
1244
- class Pe extends j {
1391
+ class De extends k {
1245
1392
  isExtrudeMesh = !0;
1246
1393
  type = "ExtrudeMesh";
1247
1394
  constructor({ geometryParameters: e, materialParameters: t } = {}) {
1248
- super(), this.geometry = new lt(e?.shape, e?.options), this.material = new I(t), this.geometry.rotateX(-Math.PI / 2);
1395
+ super(), this.geometry = new Tt(e?.shape, e?.options), this.material = new L(t), this.geometry.rotateX(-Math.PI / 2);
1249
1396
  }
1250
1397
  static createFromPoints(e, t = {}) {
1251
- return new Pe({
1398
+ return new De({
1252
1399
  ...t,
1253
1400
  geometryParameters: {
1254
1401
  ...t.geometryParameters,
1255
- shape: new be(e.map((s) => new S(s.x, -s.z)))
1402
+ shape: new Oe(e.map((s) => new R(s.x, -s.z)))
1256
1403
  }
1257
1404
  });
1258
1405
  }
1259
1406
  }
1260
- class Os extends j {
1407
+ class ni extends k {
1261
1408
  isPlaneMesh = !0;
1262
1409
  type = "PlaneMesh";
1263
1410
  constructor({ geometryParameters: e, materialParameters: t } = {}) {
1264
- super(), this.geometry = new dt(
1411
+ super(), this.geometry = new St(
1265
1412
  e?.width,
1266
1413
  e?.height,
1267
1414
  e?.widthSegments,
1268
1415
  e?.heightSegments
1269
- ), this.material = new I(t);
1416
+ ), this.material = new L(t);
1270
1417
  }
1271
1418
  }
1272
- class Ps extends j {
1419
+ class ri extends k {
1273
1420
  isCircleMesh = !0;
1274
1421
  type = "CircleMesh";
1275
1422
  constructor({ geometryParameters: e, materialParameters: t } = {}) {
1276
1423
  super(
1277
- new pt(
1424
+ new xt(
1278
1425
  e?.radius,
1279
1426
  e?.segments,
1280
1427
  e?.thetaStart,
1281
1428
  e?.thetaLength
1282
1429
  ),
1283
- new I(t)
1430
+ new L(t)
1284
1431
  ), this.geometry.rotateX(-Math.PI / 2);
1285
1432
  }
1286
1433
  }
1287
- class es {
1434
+ class W {
1288
1435
  static traverseMeshes(e, t) {
1289
1436
  e.traverse((s) => {
1290
- s instanceof F && t(s);
1437
+ s instanceof z && t(s);
1291
1438
  });
1292
1439
  }
1293
1440
  }
1294
- class Ss {
1441
+ class ai {
1295
1442
  static flow(e = {}) {
1296
- const { baseColor: t = 16777215, flowColor: s = 65280, speed: n = 1, scale: i = 3, intensity: r = 4 } = e, a = U(new D(t)), o = U(new D(s)), h = ae().x.mul(i).sub(q.mul(n)), l = Y(oe(h).add(1).mul(0.5), r);
1297
- return J(a, o, l);
1443
+ const { baseColor: t = 16777215, flowColor: s = 65280, speed: i = 1, scale: n = 3, intensity: r = 4 } = e, o = j(new U(t)), c = j(new U(s)), h = pe().x.mul(n).sub(X.mul(i)), l = q(ae(h).add(1).mul(0.5), r);
1444
+ return Y(o, c, l);
1298
1445
  }
1299
1446
  static breathe(e = {}) {
1300
- const { baseColor: t = 16777215, breathColor: s = 65280, speed: n = 1, intensity: i = 2 } = e, r = U(new D(t)), a = U(new D(s)), o = oe(q.mul(n)).add(1).mul(0.5), h = Y(o, i);
1301
- return J(r, a, h);
1447
+ const { baseColor: t = 16777215, breathColor: s = 65280, speed: i = 1, intensity: n = 2 } = e, r = j(new U(t)), o = j(new U(s)), c = ae(X.mul(i)).add(1).mul(0.5), h = q(c, n);
1448
+ return Y(r, o, h);
1302
1449
  }
1303
1450
  static fluid(e = {}) {
1304
1451
  const {
1305
1452
  baseColor: t = 16777215,
1306
1453
  flowColor: s = 255,
1307
- speed: n = 1,
1308
- scale: i = 1,
1454
+ speed: i = 1,
1455
+ scale: n = 1,
1309
1456
  intensity: r = 1,
1310
- distortion: a = 0.5
1311
- } = e, o = U(new D(t)), h = U(new D(s)), l = ae().mul(i), p = q.mul(n), g = ce(l.add(p), 1, 0), u = l.add(g.mul(a)), w = ce(u, 1, 0).add(1).mul(0.5), v = Y(w, r);
1312
- return J(o, h, v);
1457
+ distortion: o = 0.5
1458
+ } = e, c = j(new U(t)), h = j(new U(s)), l = pe().mul(n), d = X.mul(i), g = ue(l.add(d), 1, 0), p = l.add(g.mul(o)), y = ue(p, 1, 0).add(1).mul(0.5), v = q(y, r);
1459
+ return Y(c, h, v);
1313
1460
  }
1314
1461
  }
1315
- function Ls(c) {
1462
+ function oi(a) {
1316
1463
  }
1317
- const K = "uSpaceHighlight", se = `${K}/enabled`, Se = `${K}/opacity`, Le = `${K}/color`, Ie = `${K}/overwrite`, ts = Te(() => {
1318
- const c = G(se, "uint"), e = G(Le, "uint"), t = G(Ie, "uint"), s = ns(e), n = he.mul(s), i = V(t.greaterThan(0), s, n);
1319
- return V(c.greaterThan(0), i, he);
1320
- })(), ss = Te(() => {
1321
- const c = G(se, "uint"), e = G(Se, "float");
1322
- return V(c.greaterThan(0), e, mt);
1464
+ const ie = "uSpaceHighlight", F = `${ie}/enabled`, je = `${ie}/opacity`, Ue = `${ie}/color`, ke = `${ie}/overwrite`, ne = "uSpaceBreathe", te = `${ne}/enabled`, Ge = `${ne}/color`, Fe = `${ne}/speed`, ze = `${ne}/intensity`, se = /* @__PURE__ */ new WeakMap(), Os = Re(() => {
1465
+ const a = O(F, "uint"), e = O(Ue, "uint"), t = O(ke, "uint"), s = Ce(e), i = me.mul(s), n = J(t.greaterThan(0), s, i), r = J(a.greaterThan(0), n, me), o = O(te, "uint"), c = O(Ge, "uint"), h = O(Fe, "float"), l = O(ze, "float"), d = Ce(c), g = ae(X.mul(h)).add(1).mul(0.5), p = q(g, l), y = Y(r, d, p);
1466
+ return J(o.greaterThan(0), y, r);
1467
+ })(), Rs = Re(() => {
1468
+ const a = O(F, "uint"), e = O(je, "float");
1469
+ return J(a.greaterThan(0), e, Lt);
1323
1470
  })();
1324
- class Is {
1325
- static highlight(e, t = {}) {
1326
- const s = Object.assign(
1471
+ function ve(a) {
1472
+ const e = a.material;
1473
+ if (!e || Array.isArray(e)) return;
1474
+ let t = se.get(e);
1475
+ t || (t = {
1476
+ colorNode: e.colorNode,
1477
+ opacityNode: e.opacityNode,
1478
+ transparent: e.transparent,
1479
+ activeMeshes: /* @__PURE__ */ new Set()
1480
+ }, se.set(e, t)), t.activeMeshes.add(a), e.transparent = !0, e.colorNode = Os, e.opacityNode = Rs, e.needsUpdate = !0;
1481
+ }
1482
+ function be(a) {
1483
+ const e = a.userData[F], t = a.userData[te];
1484
+ if (e || t) return;
1485
+ const s = a.material;
1486
+ if (!s || Array.isArray(s)) return;
1487
+ const i = se.get(s);
1488
+ i && (i.activeMeshes.delete(a), !(i.activeMeshes.size > 0) && (s.colorNode = i.colorNode, s.opacityNode = i.opacityNode, s.transparent = i.transparent, s.needsUpdate = !0, se.delete(s)));
1489
+ }
1490
+ class ci {
1491
+ static highlightColor(e, t = {}) {
1492
+ const s = Array.isArray(e) ? e : [e], i = Object.assign(
1327
1493
  {
1328
- enabled: !0,
1329
1494
  opacity: 0.5,
1330
1495
  color: 16711680,
1331
1496
  overwrite: !1
1332
1497
  },
1333
1498
  t
1334
1499
  );
1335
- s.color = new te(s.color).getHex(), es.traverseMeshes(e, (n) => {
1336
- n.userData[se] = s.enabled ? 1 : 0, n.userData[Se] = s.opacity, n.userData[Le] = s.color, n.userData[Ie] = s.overwrite ? 1 : 0;
1337
- const i = n.material;
1338
- i && !Array.isArray(i) && (i.transparent = !0, i.colorNode = ts, i.opacityNode = ss, i.needsUpdate = !0);
1339
- });
1500
+ i.color = new V(i.color).getHex();
1501
+ for (const n of s)
1502
+ W.traverseMeshes(n, (r) => {
1503
+ r.userData[F] = 1, r.userData[je] = i.opacity, r.userData[Ue] = i.color, r.userData[ke] = i.overwrite ? 1 : 0, ve(r);
1504
+ });
1505
+ }
1506
+ static removeHighlightColor(e) {
1507
+ const t = Array.isArray(e) ? e : [e];
1508
+ for (const s of t)
1509
+ W.traverseMeshes(s, (i) => {
1510
+ i.userData[F] = 0, be(i);
1511
+ });
1512
+ }
1513
+ static breatheColor(e, t = {}) {
1514
+ const s = Array.isArray(e) ? e : [e], i = Object.assign(
1515
+ {
1516
+ color: 65280,
1517
+ speed: 1,
1518
+ intensity: 2
1519
+ },
1520
+ t
1521
+ );
1522
+ i.color = new V(i.color).getHex();
1523
+ for (const n of s)
1524
+ W.traverseMeshes(n, (r) => {
1525
+ r.userData[te] = 1, r.userData[Ge] = i.color, r.userData[Fe] = i.speed, r.userData[ze] = i.intensity, ve(r);
1526
+ });
1527
+ }
1528
+ static removeBreatheColor(e) {
1529
+ const t = Array.isArray(e) ? e : [e];
1530
+ for (const s of t)
1531
+ W.traverseMeshes(s, (i) => {
1532
+ i.userData[te] = 0, be(i);
1533
+ });
1340
1534
  }
1341
1535
  }
1342
- const ns = (c) => {
1343
- const e = c.shiftRight(16).bitAnd(255).toFloat().div(255), t = c.shiftRight(8).bitAnd(255).toFloat().div(255), s = c.bitAnd(255).toFloat().div(255);
1344
- return gt(e, t, s);
1536
+ const Ce = (a) => {
1537
+ const e = a.shiftRight(16).bitAnd(255).toFloat().div(255), t = a.shiftRight(8).bitAnd(255).toFloat().div(255), s = a.bitAnd(255).toFloat().div(255);
1538
+ return At(e, t, s);
1345
1539
  };
1346
- class is extends Et {
1540
+ class Is extends Yt {
1347
1541
  viewer;
1348
1542
  constructor(e, t) {
1349
1543
  super(t), this.viewer = e;
@@ -1352,7 +1546,7 @@ class is extends Et {
1352
1546
  this.update(e) && this.viewer.render();
1353
1547
  };
1354
1548
  easingByMode(e) {
1355
- const t = rs[e];
1549
+ const t = Ls[e];
1356
1550
  return super.easing(t);
1357
1551
  }
1358
1552
  start(e, t) {
@@ -1362,80 +1556,87 @@ class is extends Et {
1362
1556
  return this.viewer.removeEventListener("afterControlsUpdate", this._update), super.stop();
1363
1557
  }
1364
1558
  }
1365
- function Bs(c, e, t, s = {}, n, i) {
1366
- return new Promise((r, a) => {
1367
- const { duration: o = 1e3, delay: h = 0, repeat: l = !1, mode: p = "Linear.None", yoyo: g = !1 } = s, u = new is(c, e).to(t, o).easingByMode(p).delay(h).onUpdate((w) => {
1368
- n?.(w, u);
1559
+ function hi(a, e, t, s = {}, i, n) {
1560
+ return new Promise((r, o) => {
1561
+ const { duration: c = 1e3, delay: h = 0, repeat: l = !1, mode: d = "Linear.None", yoyo: g = !1 } = s, p = new Is(a, e).to(t, c).easingByMode(d).delay(h).onUpdate((y) => {
1562
+ i?.(y, p);
1369
1563
  }).onComplete(() => {
1370
1564
  r();
1371
1565
  }).onStop(() => {
1372
- a("animation stop");
1566
+ o("animation stop");
1373
1567
  }).onStart(() => {
1374
- i?.(u);
1568
+ n?.(p);
1375
1569
  });
1376
- typeof l == "number" ? u.repeat(l) : typeof l == "boolean" && l && u.repeat(1 / 0), g && u.repeatDelay(20), u.yoyo(g), u.start();
1570
+ typeof l == "number" ? p.repeat(l) : typeof l == "boolean" && l && p.repeat(1 / 0), g && p.repeatDelay(20), p.yoyo(g), p.start();
1377
1571
  });
1378
1572
  }
1379
- const rs = {
1380
- "Linear.None": d.Linear.None,
1381
- "Quadratic.In": d.Quadratic.In,
1382
- "Quadratic.Out": d.Quadratic.Out,
1383
- "Quadratic.InOut": d.Quadratic.InOut,
1384
- "Cubic.In": d.Cubic.In,
1385
- "Cubic.Out": d.Cubic.Out,
1386
- "Cubic.InOut": d.Cubic.InOut,
1387
- "Quartic.In": d.Quartic.In,
1388
- "Quartic.Out": d.Quartic.Out,
1389
- "Quartic.InOut": d.Quartic.InOut,
1390
- "Quintic.In": d.Quintic.In,
1391
- "Quintic.Out": d.Quintic.Out,
1392
- "Quintic.InOut": d.Quintic.InOut,
1393
- "Sinusoidal.In": d.Sinusoidal.In,
1394
- "Sinusoidal.Out": d.Sinusoidal.Out,
1395
- "Sinusoidal.InOut": d.Sinusoidal.InOut,
1396
- "Exponential.In": d.Exponential.In,
1397
- "Exponential.Out": d.Exponential.Out,
1398
- "Exponential.InOut": d.Exponential.InOut,
1399
- "Circular.In": d.Circular.In,
1400
- "Circular.Out": d.Circular.Out,
1401
- "Circular.InOut": d.Circular.InOut,
1402
- "Elastic.In": d.Elastic.In,
1403
- "Elastic.Out": d.Elastic.Out,
1404
- "Elastic.InOut": d.Elastic.InOut,
1405
- "Back.In": d.Back.In,
1406
- "Back.Out": d.Back.Out,
1407
- "Back.InOut": d.Back.InOut,
1408
- "Bounce.In": d.Bounce.In,
1409
- "Bounce.Out": d.Bounce.Out,
1410
- "Bounce.InOut": d.Bounce.InOut
1411
- };
1573
+ const Ls = {
1574
+ "Linear.None": u.Linear.None,
1575
+ "Quadratic.In": u.Quadratic.In,
1576
+ "Quadratic.Out": u.Quadratic.Out,
1577
+ "Quadratic.InOut": u.Quadratic.InOut,
1578
+ "Cubic.In": u.Cubic.In,
1579
+ "Cubic.Out": u.Cubic.Out,
1580
+ "Cubic.InOut": u.Cubic.InOut,
1581
+ "Quartic.In": u.Quartic.In,
1582
+ "Quartic.Out": u.Quartic.Out,
1583
+ "Quartic.InOut": u.Quartic.InOut,
1584
+ "Quintic.In": u.Quintic.In,
1585
+ "Quintic.Out": u.Quintic.Out,
1586
+ "Quintic.InOut": u.Quintic.InOut,
1587
+ "Sinusoidal.In": u.Sinusoidal.In,
1588
+ "Sinusoidal.Out": u.Sinusoidal.Out,
1589
+ "Sinusoidal.InOut": u.Sinusoidal.InOut,
1590
+ "Exponential.In": u.Exponential.In,
1591
+ "Exponential.Out": u.Exponential.Out,
1592
+ "Exponential.InOut": u.Exponential.InOut,
1593
+ "Circular.In": u.Circular.In,
1594
+ "Circular.Out": u.Circular.Out,
1595
+ "Circular.InOut": u.Circular.InOut,
1596
+ "Elastic.In": u.Elastic.In,
1597
+ "Elastic.Out": u.Elastic.Out,
1598
+ "Elastic.InOut": u.Elastic.InOut,
1599
+ "Back.In": u.Back.In,
1600
+ "Back.Out": u.Back.Out,
1601
+ "Back.InOut": u.Back.InOut,
1602
+ "Bounce.In": u.Bounce.In,
1603
+ "Bounce.Out": u.Bounce.Out,
1604
+ "Bounce.InOut": u.Bounce.InOut
1605
+ }, As = "0.0.5";
1606
+ window.__USPACE__ = { version: As };
1412
1607
  export {
1413
- Ee as BaseGroup,
1414
- j as BaseMesh,
1415
- Zt as BaseSprite,
1416
- Bt as CameraControls,
1417
- Ps as CircleMesh,
1418
- Pe as ExtrudeMesh,
1419
- Ot as InteractionEvent,
1420
- Pt as InteractionManager,
1421
- Is as MaterialEffects,
1422
- W as Model,
1423
- R as ModelLoaderManager,
1424
- St as ObjectManager,
1425
- es as ObjectUtils,
1426
- Os as PlaneMesh,
1427
- Es as Poi,
1428
- Rt as RoomEnvironment,
1429
- Jt as SBMLoader,
1430
- Ut as SBMXLoader,
1431
- Oe as ShapeMesh,
1432
- Vt as SphereMesh,
1433
- Ss as TSLEffects,
1434
- xs as TextureLoaderManager,
1435
- Ms as Topology,
1436
- ue as TubeMesh,
1437
- is as Tween,
1438
- Cs as Viewer,
1439
- Ls as reinterpretType,
1440
- Bs as tweenAnimation
1608
+ Be as BaseGroup,
1609
+ k as BaseMesh,
1610
+ Ms as BaseSprite,
1611
+ pi as CSS2DObject,
1612
+ mi as CSS3DObject,
1613
+ gi as CSS3DSprite,
1614
+ cs as CSSRenderer,
1615
+ ss as CameraControls,
1616
+ ri as CircleMesh,
1617
+ De as ExtrudeMesh,
1618
+ Jt as InteractionEvent,
1619
+ Zt as InteractionManager,
1620
+ ci as MaterialEffects,
1621
+ Z as Model,
1622
+ B as ModelLoaderManager,
1623
+ Vt as ObjectManager,
1624
+ W as ObjectUtils,
1625
+ ni as PlaneMesh,
1626
+ ii as Poi,
1627
+ es as RenderPipeline,
1628
+ ns as RoomEnvironment,
1629
+ Es as SBMLoader,
1630
+ ls as SBMXLoader,
1631
+ _e as ShapeMesh,
1632
+ Ps as SphereMesh,
1633
+ ai as TSLEffects,
1634
+ ti as TextureLoaderManager,
1635
+ si as Topology,
1636
+ we as TubeMesh,
1637
+ Is as Tween,
1638
+ ei as Viewer,
1639
+ oi as reinterpretType,
1640
+ hi as tweenAnimation,
1641
+ As as version
1441
1642
  };