u-space 0.0.2 → 0.0.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.js CHANGED
@@ -1,20 +1,20 @@
1
- import { Raycaster as me, Vector2 as P, RenderPipeline as Be, Sphere as ge, Box3 as we, Spherical as C, Matrix4 as Re, Quaternion as _e, Vector4 as Ne, Vector3 as J, MathUtils as Ae, PMREMGenerator as Ue, OrthographicCamera as F, TimestampQuery as De, Cache as je, EventDispatcher as ke, Timer as Ge, PerspectiveCamera as W, WebGPURenderer as Fe, PCFShadowMap as He, AgXToneMapping as ze, Scene as $e, Color as Z, MeshStandardNodeMaterial as I, Loader as We, LoaderUtils as L, FileLoader as fe, TextureLoader as ye, Group as z, SRGBColorSpace as ve, RepeatWrapping as ne, BufferGeometry as Qe, BufferAttribute as ie, Mesh as j, FrontSide as Ke, BackSide as Xe, DoubleSide as qe, REVISION as re, CubeTextureLoader as Ye, EquirectangularReflectionMapping as Je, Sprite as Ze, SphereGeometry as Ve, TubeGeometry as et, LineCurve3 as tt, CatmullRomCurve3 as st, SpriteNodeMaterial as nt, CanvasTexture as it, ShapeGeometry as rt, Shape as be, ExtrudeGeometry as at, PlaneGeometry as ot, CircleGeometry as ct } from "three/webgpu";
2
- import { pass as q, blendColor as ht, color as N, uv as ae, time as Q, pow as K, sin as oe, mix as X, mx_noise_float as ce, Fn as Te, userData as D, materialColor as he, select as Y, materialOpacity as lt, vec3 as dt } from "three/tsl";
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
3
  import Ce from "camera-controls";
4
- import { RoomEnvironment as pt } from "three/addons/environments/RoomEnvironment.js";
5
- import { ViewHelper as ut } from "three/addons/helpers/ViewHelper.js";
4
+ import { RoomEnvironment as ft } from "three/addons/environments/RoomEnvironment.js";
5
+ import { ViewHelper as wt } from "three/addons/helpers/ViewHelper.js";
6
6
  import { GLTFLoader as xe } from "three/addons/loaders/GLTFLoader.js";
7
- import { FBXLoader as mt } from "three/addons/loaders/FBXLoader.js";
8
- import { OBJLoader as gt } from "three/addons/loaders/OBJLoader.js";
9
- import { STLLoader as wt } from "three/addons/loaders/STLLoader.js";
10
- import { DRACOLoader as ft } from "three/addons/loaders/DRACOLoader.js";
11
- import { KTX2Loader as yt } from "three/addons/loaders/KTX2Loader.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
12
  import { MeshoptDecoder as le } from "three/addons/libs/meshopt_decoder.module.js";
13
- import { HDRLoader as vt } from "three/addons/loaders/HDRLoader.js";
14
- import { clone as bt } from "three/addons/utils/SkeletonUtils.js";
15
- import { Color as A } from "three";
16
- import { Easing as d, Tween as Tt } from "three/addons/libs/tween.module.js";
17
- class Ct {
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 {
18
18
  /** The type of event (e.g., 'click', 'pointerdown'). */
19
19
  type;
20
20
  /** The original 3D object that triggered the event. */
@@ -42,15 +42,15 @@ class Ct {
42
42
  return this._propagationStopped;
43
43
  }
44
44
  }
45
- class xt {
45
+ class Pt {
46
46
  domElement;
47
47
  scene;
48
48
  camera;
49
49
  raycaster = new me();
50
- pointer = new P();
50
+ pointer = new S();
51
51
  hoveredObject = null;
52
52
  pointerDownTime = 0;
53
- pointerDownPos = new P();
53
+ pointerDownPos = new S();
54
54
  clickTimer = null;
55
55
  longPressThreshold = 500;
56
56
  moveThreshold = 0.01;
@@ -86,15 +86,15 @@ class xt {
86
86
  * Dispatches an event to the target object and bubbles up the parent chain.
87
87
  */
88
88
  _dispatchToTarget(e, t, s, n) {
89
- const i = new Ct({
89
+ const i = new Ot({
90
90
  type: e,
91
91
  target: t,
92
92
  intersect: s,
93
93
  originalEvent: n
94
94
  });
95
- let a = t;
96
- for (; a && !i.propagationStopped; )
97
- i.currentTarget = a, a.dispatchEvent({ type: e, event: i }), a = a.parent;
95
+ let r = t;
96
+ for (; r && !i.propagationStopped; )
97
+ i.currentTarget = r, r.dispatchEvent({ type: e, event: i }), r = r.parent;
98
98
  }
99
99
  /**
100
100
  * Handles a DOM event by raycasting and dispatching to the first intersected object.
@@ -147,7 +147,7 @@ class xt {
147
147
  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
148
  }
149
149
  }
150
- class Mt {
150
+ class St {
151
151
  idMap = /* @__PURE__ */ new Map();
152
152
  nameMap = /* @__PURE__ */ new Map();
153
153
  typeMap = /* @__PURE__ */ new Map();
@@ -250,7 +250,7 @@ class Mt {
250
250
  return this.allObjects.size;
251
251
  }
252
252
  }
253
- class Et extends Be {
253
+ class Lt extends Ae {
254
254
  scene;
255
255
  camera;
256
256
  currentOutputNode;
@@ -258,7 +258,7 @@ class Et extends Be {
258
258
  #e;
259
259
  constructor(...e) {
260
260
  const [t, s, n] = e;
261
- super(t), this.scene = s, this.camera = n, this.currentOutputNode = q(s, n), this.needsUpdateOutputNode = !0, this.#e = /* @__PURE__ */ new Set();
261
+ super(t), this.scene = s, this.camera = n, this.currentOutputNode = Z(s, n), this.needsUpdateOutputNode = !0, this.#e = /* @__PURE__ */ new Set();
262
262
  }
263
263
  addOverlayPass(e) {
264
264
  this.#e.add(e), this.needsUpdateOutputNode = !0;
@@ -273,31 +273,31 @@ class Et extends Be {
273
273
  this.currentOutputNode.dispose(), this.currentOutputNode = e, this.needsUpdateOutputNode = !0;
274
274
  }
275
275
  resetCurrentOutputNode() {
276
- this.currentOutputNode.dispose(), this.currentOutputNode = q(this.scene, this.camera), this.needsUpdateOutputNode = !0;
276
+ this.currentOutputNode.dispose(), this.currentOutputNode = Z(this.scene, this.camera), this.needsUpdateOutputNode = !0;
277
277
  }
278
278
  #t() {
279
279
  let e = this.currentOutputNode;
280
280
  this.#e.size > 0 && this.#e.forEach((t) => {
281
- e = ht(e, t);
281
+ e = ut(e, t);
282
282
  }), this.outputNode = e, this.needsUpdate = !0;
283
283
  }
284
284
  render() {
285
285
  this.needsUpdateOutputNode && (this.#t(), this.needsUpdateOutputNode = !1), super.render();
286
286
  }
287
287
  }
288
- const Ot = {
289
- Vector2: P,
290
- Vector3: J,
288
+ const It = {
289
+ Vector2: S,
290
+ Vector3: ee,
291
291
  Vector4: Ne,
292
292
  Quaternion: _e,
293
293
  Matrix4: Re,
294
- Spherical: C,
295
- Box3: we,
294
+ Spherical: T,
295
+ Box3: fe,
296
296
  Sphere: ge,
297
297
  Raycaster: me
298
298
  };
299
- Ce.install({ THREE: Ot });
300
- class Pt extends Ce {
299
+ Ce.install({ THREE: It });
300
+ class Bt extends Ce {
301
301
  constructor(...e) {
302
302
  super(...e), this.minDistance = 0.2, this.smoothTime = 0.2, this.dollySpeed = 0.2;
303
303
  }
@@ -305,62 +305,62 @@ class Pt extends Ce {
305
305
  * Set absolute angle for azimuth to avoid spinning
306
306
  */
307
307
  absoluteRotations() {
308
- this.azimuthAngle = St(this.azimuthAngle, 0);
308
+ this.azimuthAngle = At(this.azimuthAngle, 0);
309
309
  }
310
310
  async flyToBox(e, t = {}) {
311
311
  if (e.isEmpty())
312
312
  return console.warn("CameraControls.flyToBox: The provided Box3 is empty."), !1;
313
313
  this.absoluteRotations();
314
- const { viewpoint: s = "frontTop", enableTransition: n = !0, padding: i = 0.1, cover: a = !1 } = t, c = [];
314
+ const { viewpoint: s = "frontTop", enableTransition: n = !0, padding: i = 0.1, cover: r = !1 } = t, a = [];
315
315
  if (s !== "current") {
316
- const r = de[s.toUpperCase()] ?? de.FRONTTOP, h = r.theta, l = r.phi;
317
- c.push(
316
+ const o = de[s.toUpperCase()] ?? de.FRONTTOP, h = o.theta, l = o.phi;
317
+ a.push(
318
318
  this.fitToBox(e, n, {
319
319
  paddingLeft: i,
320
320
  paddingRight: i,
321
321
  paddingTop: i,
322
322
  paddingBottom: i,
323
- cover: a
323
+ cover: r
324
324
  })
325
- ), c.push(this.rotateTo(h, l, n));
325
+ ), a.push(this.rotateTo(h, l, n));
326
326
  } else {
327
- const r = new ge();
328
- e.getBoundingSphere(r), r.radius += i, c.push(this.fitToSphere(r, n));
327
+ const o = new ge();
328
+ e.getBoundingSphere(o), o.radius += i, a.push(this.fitToSphere(o, n));
329
329
  }
330
- return await Promise.all(c), !0;
330
+ return await Promise.all(a), !0;
331
331
  }
332
332
  async flyToObject(e, t = {}) {
333
- const s = new we().setFromObject(e);
333
+ const s = new fe().setFromObject(e);
334
334
  return this.flyToBox(s, t);
335
335
  }
336
336
  }
337
337
  const de = {
338
- LEFT: new C(0, Math.PI / 2, -Math.PI / 2),
339
- RIGHT: new C(0, Math.PI / 2, Math.PI / 2),
340
- FRONT: new C(0, Math.PI / 2, 0),
341
- BACK: new C(0, Math.PI / 2, Math.PI),
342
- TOP: new C(0, 0, 0),
343
- BOTTOM: new C(0, Math.PI, 0),
344
- FRONTTOP: new C(0, Math.PI / 4, 0),
345
- BACKTOP: new C(0, Math.PI / 4, Math.PI),
346
- LEFTTOP: new C(0, Math.PI / 4, -Math.PI / 2),
347
- RIGHTTOP: new C(0, Math.PI / 4, Math.PI / 2),
348
- LEFTFRONTTOP: new C(0, Math.PI / 4, -Math.PI / 4),
349
- RIGHTFRONTTOP: new C(0, Math.PI / 4, Math.PI / 4),
350
- LEFTBACKTOP: new C(0, Math.PI / 4, -Math.PI / 4 * 3),
351
- RIGHTBACKTOP: new C(0, Math.PI / 4, Math.PI / 4 * 3)
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)
352
352
  };
353
- function St(o, e) {
354
- const t = o - e;
355
- return Ae.euclideanModulo(t + Math.PI, Math.PI * 2) - Math.PI;
353
+ function At(c, e) {
354
+ const t = c - e;
355
+ return Ue.euclideanModulo(t + Math.PI, Math.PI * 2) - Math.PI;
356
356
  }
357
- class Lt {
358
- environment = new pt();
357
+ class Rt {
358
+ environment = new ft();
359
359
  renderer;
360
360
  pmremGenerator;
361
361
  envMap = null;
362
362
  constructor(e) {
363
- this.renderer = e, this.pmremGenerator = new Ue(e);
363
+ this.renderer = e, this.pmremGenerator = new De(e);
364
364
  }
365
365
  update() {
366
366
  this.envMap || (this.envMap = this.pmremGenerator.fromScene(this.environment).texture);
@@ -369,20 +369,20 @@ class Lt {
369
369
  this.pmremGenerator.dispose(), this.envMap?.dispose();
370
370
  }
371
371
  }
372
- const G = 128;
373
- class It extends ut {
372
+ const z = 128;
373
+ class _t extends wt {
374
374
  viewer;
375
375
  overlayPass;
376
376
  constructor(e) {
377
377
  super(e.camera, e.el), this.viewer = e;
378
- const t = new F(-2, 2, 2, -2, 0, 4);
379
- t.position.set(0, 0, 2), this.overlayPass = q(this, t), this.setLabels("x", "y", "z");
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");
380
380
  }
381
381
  _update = () => {
382
382
  this.quaternion.copy(this.viewer.camera.quaternion).invert();
383
383
  const e = this.location;
384
384
  let t, s;
385
- e.left !== null ? t = e.left : t = this.viewer.el.offsetWidth - G - e.right, e.top !== null ? s = e.top : s = this.viewer.el.offsetHeight - G - e.bottom, this.overlayPass.setViewport(t, s, G, G);
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);
386
386
  };
387
387
  enable() {
388
388
  return this.viewer.renderPipeline.addOverlayPass(this.overlayPass), this.viewer.addEventListener("beforeRender", this._update), this.viewer.render(), this;
@@ -391,7 +391,7 @@ class It extends ut {
391
391
  return this.viewer.renderPipeline.removeOverlayPass(this.overlayPass), this.viewer.removeEventListener("beforeRender", this._update), this.viewer.render(), this;
392
392
  }
393
393
  }
394
- class Bt {
394
+ class Nt {
395
395
  el;
396
396
  renderer;
397
397
  container;
@@ -406,9 +406,9 @@ class Bt {
406
406
  this.el = e, this.renderer = t;
407
407
  const s = document.createElement("div");
408
408
  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(a, c = !0) {
410
- const r = document.createElement("span");
411
- return c && (r.style.marginLeft = "6px"), r.innerText = a, r;
409
+ function n(r, a = !0) {
410
+ const o = document.createElement("span");
411
+ return a && (o.style.marginLeft = "6px"), o.innerText = r, o;
412
412
  }
413
413
  function i() {
414
414
  return document.createElement("br");
@@ -418,7 +418,7 @@ class Bt {
418
418
  update() {
419
419
  if (this._enabled) {
420
420
  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(De.RENDER).then((t) => {
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) => {
422
422
  this.timestampText.innerText = t?.toFixed(2) ?? "0";
423
423
  });
424
424
  }
@@ -433,8 +433,8 @@ class Bt {
433
433
  this.disable();
434
434
  }
435
435
  }
436
- je.enabled = !0;
437
- class ys extends ke {
436
+ ke.enabled = !0;
437
+ class Cs extends Ge {
438
438
  el;
439
439
  renderer;
440
440
  scene;
@@ -450,11 +450,11 @@ class ys extends ke {
450
450
  frameCount = 1;
451
451
  frameloop = "demand";
452
452
  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 Bt(this.el, this.renderer), this.controls = new Pt(this.camera, this.renderer.domElement), this.renderPipeline = new Et(this.renderer, this.scene, this.camera), this.timer = new Ge(), this.roomEnvironment = new Lt(this.renderer), this.interactionManager = new xt(this.renderer.domElement, this.scene, this.camera), this.objectManager = new Mt(), this.viewerHelper = new It(this), window.addEventListener("resize", this.onWindowResize);
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);
454
454
  }
455
455
  onWindowResize = () => {
456
456
  const e = this.el.clientWidth, t = this.el.clientHeight;
457
- this.camera instanceof W ? (this.camera.aspect = e / t, this.camera.updateProjectionMatrix()) : this.camera instanceof F && (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();
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();
458
458
  };
459
459
  async init() {
460
460
  await this.renderer.init(), this.roomEnvironment.update(), this.scene.environment = this.roomEnvironment.envMap;
@@ -463,7 +463,7 @@ class ys extends ke {
463
463
  this.camera = e, this.controls.camera = e, this.interactionManager.setCamera(e), this.renderPipeline.setCamera(e), this.onWindowResize(), this.dispatchEvent({ type: "cameraChange", camera: e });
464
464
  }
465
465
  setCameraByType(e) {
466
- e === "perspective" && !(this.camera instanceof W) ? this.setCamera(this.createPerspectiveCamera()) : e === "orthographic" && !(this.camera instanceof F) && this.setCamera(this.createOrthographicCamera());
466
+ e === "perspective" && !(this.camera instanceof X) ? this.setCamera(this.createPerspectiveCamera()) : e === "orthographic" && !(this.camera instanceof $) && this.setCamera(this.createOrthographicCamera());
467
467
  }
468
468
  render(e = 1) {
469
469
  return this.frameCount += e, new Promise((t) => {
@@ -474,30 +474,32 @@ class ys extends ke {
474
474
  });
475
475
  }
476
476
  animate = (e) => {
477
- this.timer.update(e), this.dispatchEvent({ type: "beforeControlsUpdate", time: e });
478
- let t = this.controls.update(this.timer.getDelta());
479
- this.dispatchEvent({ type: "afterControlsUpdate", time: e }), this.frameCount > 0 && (this.frameCount--, t = !0), this.frameloop === "always" && (t = !0), t && (this.dispatchEvent({ type: "beforeRender", time: e }), this.renderer.info.reset(), this.renderPipeline.render(), this.info.update(), this.dispatchEvent({ type: "afterRender", time: e }));
477
+ this.timer.update(e);
478
+ const t = this.timer.getDelta();
479
+ this.dispatchEvent({ type: "beforeControlsUpdate", time: e, delta: t });
480
+ 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 }));
480
482
  };
481
483
  _initRenderer(e) {
482
- const t = new Fe({
484
+ const t = new He({
483
485
  logarithmicDepthBuffer: !0,
484
486
  antialias: !1,
485
487
  depth: !1,
486
488
  trackTimestamp: !0,
487
489
  ...e
488
490
  });
489
- return t.setSize(this.el.clientWidth, this.el.clientHeight), t.shadowMap.enabled = !0, t.shadowMap.type = He, t.toneMapping = ze, t.toneMappingExposure = 1, t.info.autoReset = !1, t.setPixelRatio(window.devicePixelRatio), t.setAnimationLoop(this.animate), this.el.appendChild(t.domElement), t;
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;
490
492
  }
491
493
  createScene() {
492
- const e = new $e();
493
- return e.background = new Z(0), e;
494
+ const e = new We();
495
+ return e.background = new te(0), e;
494
496
  }
495
497
  createPerspectiveCamera() {
496
- const e = new W(50, this.el.clientWidth / this.el.clientHeight, 0.1, 1e5);
498
+ const e = new X(50, this.el.clientWidth / this.el.clientHeight, 0.1, 1e5);
497
499
  return e.position.setScalar(5), e;
498
500
  }
499
501
  createOrthographicCamera() {
500
- const e = new F(
502
+ const e = new $(
501
503
  -this.el.clientWidth / 2,
502
504
  this.el.clientWidth / 2,
503
505
  this.el.clientHeight / 2,
@@ -511,71 +513,71 @@ class ys extends ke {
511
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();
512
514
  }
513
515
  }
514
- class Rt extends xe {
516
+ class Ut extends xe {
515
517
  constructor(e) {
516
518
  super(e);
517
519
  }
518
520
  parse(e, t, s, n) {
519
- if (_t(e.slice(0, 8)) === "SBMG----") {
520
- const a = Nt(e.slice(8));
521
- return super.parse(a, 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);
522
524
  } else
523
525
  return super.parse(e, t, s, n);
524
526
  }
525
527
  }
526
- function _t(o) {
527
- return new TextDecoder().decode(new Uint8Array(o));
528
+ function Dt(c) {
529
+ return new TextDecoder().decode(new Uint8Array(c));
528
530
  }
529
- function Nt(o) {
530
- const e = new DataView(o);
531
+ function jt(c) {
532
+ const e = new DataView(c);
531
533
  for (let t = 0; t < e.byteLength; t++) {
532
534
  const s = e.getUint8(t), n = (s >> 4 & 15) + (s << 4 & 240);
533
535
  e.setUint8(t, n);
534
536
  }
535
537
  return e.buffer;
536
538
  }
537
- const At = 8, Ut = 130, pe = 66, Dt = "SBK-----", jt = "SBM-----", Me = new TextDecoder(), kt = new TextEncoder();
538
- function Gt(o) {
539
- let e = At;
540
- const t = new Uint8Array(o, 0, e);
541
- if (Me.decode(t) !== Dt)
542
- return o;
543
- e += Ut;
544
- const n = new Uint8Array(o, 0, e);
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);
545
547
  if (n[40] === 1) {
546
- const a = kt.encode(jt), c = new Uint8Array([n[41]]), r = Ft(n), h = Ht(r);
548
+ const r = zt.encode(Ht), a = new Uint8Array([n[41]]), o = Wt(n), h = Qt(o);
547
549
  let l = pe % h.length;
548
- const u = e + pe, f = new Uint8Array(o, u), p = new Uint8Array(f.length);
549
- for (let w = 0; w < f.length; w++)
550
- p[w] = f[w] ^ h[l], l = (l + 1) % h.length;
551
- const g = new Uint8Array(a.length + c.length + p.length);
552
- return g.set(a), g.set(c, a.length), g.set(p, a.length + c.length), g.buffer;
550
+ const p = e + pe, g = new Uint8Array(c, p), u = new Uint8Array(g.length);
551
+ 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;
553
555
  }
554
556
  }
555
- function Ft(o) {
557
+ function Wt(c) {
556
558
  const e = new Uint8Array(128);
557
- return e.set(o.slice(42, 74), 0), e.set(o.slice(74, 138), 32), e.set(o.slice(8, 40), 96), e;
559
+ return e.set(c.slice(42, 74), 0), e.set(c.slice(74, 138), 32), e.set(c.slice(8, 40), 96), e;
558
560
  }
559
- function Ht(o) {
561
+ function Qt(c) {
560
562
  const e = new Uint8Array(64);
561
- return e.set(o.slice(0, 8), 0), e.set(o.slice(24, 32), 8), e.set(o.slice(40, 56), 16), e.set(o.slice(64, 88), 32), e.set(o.slice(96, 104), 56), e;
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;
562
564
  }
563
- const zt = (o, e, t) => {
564
- const s = o.buffer.slice(t, t + e);
565
+ const Kt = (c, e, t) => {
566
+ const s = c.buffer.slice(t, t + e);
565
567
  let n = Me.decode(s);
566
568
  return n = n.replace("\\", "/"), n.startsWith("Maps/") || (n = `Maps/${n}`), n;
567
- }, $t = (o, e, t) => {
568
- const [s, n, i, a, c] = e, r = t || a < 1;
569
+ }, Xt = (c, e, t) => {
570
+ const [s, n, i, r, a] = e, o = t || r < 1;
569
571
  return new I({
570
- name: o,
571
- color: new Z(s, n, i),
572
- opacity: a,
573
- transparent: r,
572
+ name: c,
573
+ color: new te(s, n, i),
574
+ opacity: r,
575
+ transparent: o,
574
576
  alphaTest: 0.01,
575
- side: c
577
+ side: a
576
578
  });
577
- }, Wt = (o) => o?.toLowerCase().endsWith(".png") ?? !1;
578
- class Qt {
579
+ }, qt = (c) => c?.toLowerCase().endsWith(".png") ?? !1;
580
+ class Yt {
579
581
  data;
580
582
  options;
581
583
  textureLoader;
@@ -586,127 +588,127 @@ class Qt {
586
588
  }
587
589
  parse(e, t) {
588
590
  let s = this.data;
589
- const n = Gt(this.data);
591
+ const n = $t(this.data);
590
592
  n && (s = n);
591
593
  const i = new DataView(s);
592
- let a = 8;
593
- const c = i.getUint8(a);
594
- a += 1, c === 1 ? this._parseV2(i, a, e) : c === 2 ? this._parseV2(i, a, e) : c === 3 ? this._parseV3(i, a, e) : t?.(new Error(`SBMLoader: Unsupported SBM version: ${c}`));
594
+ 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}`));
595
597
  }
596
598
  _parseV2(e, t, s) {
597
- const n = new z(), i = e.getUint16(t, this.littleEndian);
599
+ const n = new Q(), i = e.getUint16(t, this.littleEndian);
598
600
  t += 2;
599
- const a = e.getUint16(t, this.littleEndian);
601
+ const r = e.getUint16(t, this.littleEndian);
600
602
  t += 2;
601
- for (let c = 0; c < i; ++c) {
602
- const r = e.getUint16(t, this.littleEndian).toString();
603
+ for (let a = 0; a < i; ++a) {
604
+ const o = e.getUint16(t, this.littleEndian).toString();
603
605
  t += 2, t += 4, t += 4, t += 4, t += 4;
604
606
  const h = e.getFloat32(t, this.littleEndian);
605
607
  t += 4;
606
608
  const l = e.getFloat32(t, this.littleEndian);
607
609
  t += 4;
608
- const u = e.getFloat32(t, this.littleEndian);
610
+ const p = e.getFloat32(t, this.littleEndian);
609
611
  t += 4;
610
- const f = e.getFloat32(t, this.littleEndian);
612
+ const g = e.getFloat32(t, this.littleEndian);
611
613
  t += 4, t += 4, t += 4, t += 4, t += 4;
612
- let p = e.getUint8(t);
613
- t += 1, p === 0 ? p = Ke : p === 1 ? p = Xe : p === 2 && (p = qe);
614
- const g = e.getUint16(t, this.littleEndian);
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);
615
617
  t += 2;
616
- const w = g > 0 ? zt(e, g, t) : "";
617
- if (t += g, !this.materials.has(r)) {
618
- const v = $t(r, [h, l, u, f, p], Wt(w));
619
- this.materials.set(r, v), w && this.options.path && this.textureLoader.load(L.resolveURL(w, this.options.path), (b) => {
620
- b.colorSpace = ve, b.wrapS = ne, b.wrapT = ne, b.flipY = !1, b.anisotropy = 16, v.map = b;
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;
621
623
  });
622
624
  }
623
625
  }
624
- for (let c = 0; c < a; ++c) {
625
- const r = e.getUint16(t, this.littleEndian).toString();
626
+ for (let a = 0; a < r; ++a) {
627
+ const o = e.getUint16(t, this.littleEndian).toString();
626
628
  t += 2;
627
629
  const h = e.getUint16(t, this.littleEndian).toString();
628
630
  t += 2;
629
- const l = [], u = [], f = [], p = [], g = e.getUint16(t, this.littleEndian);
630
- if (t += 2, g > 0)
631
- for (let m = 0; m < g; m++) {
632
- const y = new J();
633
- 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);
634
- }
635
- const w = e.getUint16(t, this.littleEndian);
631
+ const l = [], p = [], g = [], u = [], w = e.getUint16(t, this.littleEndian);
636
632
  if (t += 2, w > 0)
637
- for (let m = 0; m < w; m++)
638
- t += 4, t += 4, t += 4;
639
- const T = e.getUint16(t, this.littleEndian);
640
- if (t += 2, T > 0)
641
- for (let m = 0; m < T; m++) {
642
- const y = new P();
643
- y.setX(e.getFloat32(t, this.littleEndian)), t += 4, y.setY(e.getFloat32(t, this.littleEndian)), t += 4, u.push(y);
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);
644
636
  }
645
637
  const v = e.getUint16(t, this.littleEndian);
646
638
  if (t += 2, v > 0)
647
- for (let m = 0; m < v; m++) {
639
+ for (let m = 0; m < v; m++)
640
+ 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);
646
+ }
647
+ const b = e.getUint16(t, this.littleEndian);
648
+ if (t += 2, b > 0)
649
+ for (let m = 0; m < b; m++) {
648
650
  const y = e.getUint16(t, this.littleEndian);
649
651
  t += 2;
650
652
  const B = e.getUint16(t, this.littleEndian);
651
653
  t += 2;
652
- const _ = e.getUint16(t, this.littleEndian);
654
+ const A = e.getUint16(t, this.littleEndian);
653
655
  t += 2;
654
- const O = [y, B, _];
655
- f.push(O), u.length > 0 && p.push([u[O[0]], u[O[1]], u[O[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]]]);
656
658
  }
657
- const b = [], x = [];
658
- for (let m = 0; m < f.length; m++) {
659
- const y = f[m], B = l[y[0]], _ = l[y[1]], O = l[y[2]];
660
- b.push(...B.toArray(), ..._.toArray(), ...O.toArray());
661
- let ee = new P(), te = new P(), se = new P();
662
- const k = p[m];
663
- k !== void 0 && (ee = k[0], te = k[1], se = k[2]), x.push(...ee.toArray(), ...te.toArray(), ...se.toArray());
659
+ const f = [], C = [];
660
+ 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());
664
666
  }
665
- const M = new Float32Array(b), E = new Float32Array(x), S = new Qe();
666
- if (M.length > 0 && S.setAttribute("position", new ie(M, 3)), E.length > 0 && S.setAttribute("uv", new ie(E, 2)), S.computeVertexNormals(), this.materials.has(h)) {
667
- const m = new j(S, this.materials.get(h));
668
- m.name = r, m.castShadow = !0, m.receiveShadow = !0, n.add(m);
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);
669
671
  }
670
672
  }
671
673
  s(n);
672
674
  }
673
675
  _parseV3(e, t, s) {
674
- const n = new z();
676
+ const n = new Q();
675
677
  console.warn("SBMLoader: SBM version 3 is not supported yet."), s(n);
676
678
  }
677
679
  }
678
- class Kt extends We {
680
+ class Jt extends Qe {
679
681
  load(e, t, s, n) {
680
682
  let i;
681
683
  if (this.resourcePath !== "")
682
684
  i = this.resourcePath;
683
685
  else if (this.path !== "") {
684
- const r = L.extractUrlBase(e);
685
- i = L.resolveURL(r, this.path);
686
+ const o = L.extractUrlBase(e);
687
+ i = L.resolveURL(o, this.path);
686
688
  } else
687
689
  i = L.extractUrlBase(e);
688
690
  this.manager.itemStart(e);
689
- const a = (r) => {
690
- n ? n(r) : console.error(r), this.manager.itemError(e), this.manager.itemEnd(e);
691
- }, c = new fe(this.manager);
692
- c.setPath(this.path), c.setResponseType("arraybuffer"), c.setRequestHeader(this.requestHeader), c.setWithCredentials(this.withCredentials), c.load(
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(
693
695
  e,
694
- (r) => {
696
+ (o) => {
695
697
  try {
696
698
  this.parse(
697
- r,
699
+ o,
698
700
  i,
699
701
  (h) => {
700
702
  t(h), this.manager.itemEnd(e);
701
703
  },
702
- a
704
+ r
703
705
  );
704
706
  } catch (h) {
705
- a(h);
707
+ r(h);
706
708
  }
707
709
  },
708
710
  s,
709
- a
711
+ r
710
712
  );
711
713
  }
712
714
  parse(e, t, s, n) {
@@ -715,7 +717,7 @@ class Kt extends We {
715
717
  n?.(new Error(`SBMLoader: Invalid SBM format: ${i}`));
716
718
  return;
717
719
  }
718
- new Qt(e, {
720
+ new Yt(e, {
719
721
  path: t,
720
722
  crossOrigin: this.crossOrigin,
721
723
  requestHeader: this.requestHeader,
@@ -739,19 +741,19 @@ class Kt extends We {
739
741
  }
740
742
  class R {
741
743
  static CACHE_NAME = "u-space-model-loader-cache";
742
- static fileLoader = new fe().setResponseType("arraybuffer");
743
- static dracoLoader = new ft().setDecoderPath(
744
+ static fileLoader = new we().setResponseType("arraybuffer");
745
+ static dracoLoader = new Tt().setDecoderPath(
744
746
  `https://cdn.jsdelivr.net/npm/three@0.${re}.0/examples/jsm/libs/draco/`
745
747
  );
746
- static ktx2Loader = new yt().setTranscoderPath(
748
+ static ktx2Loader = new Ct().setTranscoderPath(
747
749
  `https://cdn.jsdelivr.net/npm/three@0.${re}.0/examples/jsm/libs/basis/`
748
750
  );
749
751
  static gltfLoader = new xe().setDRACOLoader(R.dracoLoader).setKTX2Loader(R.ktx2Loader).setMeshoptDecoder(le);
750
- static sbmxLoader = new Rt().setDRACOLoader(R.dracoLoader).setKTX2Loader(R.ktx2Loader).setMeshoptDecoder(le);
751
- static sbmLoader = new Kt();
752
- static fbxLoader = new mt();
753
- static objLoader = new gt();
754
- static stlLoader = new wt();
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();
755
757
  static setLoadingManager(e) {
756
758
  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;
757
759
  }
@@ -779,9 +781,11 @@ class R {
779
781
  switch (t.persistent && typeof caches < "u" ? n = await this.getPersistentData(e) : n = await this.fileLoader.loadAsync(e), s) {
780
782
  case "gltf":
781
783
  case "glb":
782
- return (await this.gltfLoader.parseAsync(n, L.extractUrlBase(e))).scene;
784
+ const i = await this.gltfLoader.parseAsync(n, L.extractUrlBase(e));
785
+ return i.scene.animations = i.animations, i.scene;
783
786
  case "sbmx":
784
- return (await this.sbmxLoader.parseAsync(n, L.extractUrlBase(e))).scene;
787
+ const r = await this.sbmxLoader.parseAsync(n, L.extractUrlBase(e));
788
+ return r.scene.animations = r.animations, r.scene;
785
789
  case "sbm":
786
790
  return await this.sbmLoader.parseAsync(n, L.extractUrlBase(e));
787
791
  case "fbx":
@@ -790,8 +794,8 @@ class R {
790
794
  const h = new TextDecoder().decode(n);
791
795
  return this.objLoader.parse(h);
792
796
  case "stl":
793
- const u = this.stlLoader.parse(n);
794
- return new j(u, new I());
797
+ const p = this.stlLoader.parse(n);
798
+ return new F(p, new I());
795
799
  default:
796
800
  throw new Error(`Unsupported model format: ${s}`);
797
801
  }
@@ -808,10 +812,10 @@ class R {
808
812
  }
809
813
  }
810
814
  }
811
- class vs {
815
+ class xs {
812
816
  static textureLoader = new ye();
813
- static hdrLoader = new vt();
814
- static cubeTextureLoader = new Ye();
817
+ static hdrLoader = new xt();
818
+ static cubeTextureLoader = new Je();
815
819
  static setLoadingManager(e) {
816
820
  this.textureLoader.manager = e, this.hdrLoader.manager = e, this.cubeTextureLoader.manager = e;
817
821
  }
@@ -820,13 +824,13 @@ class vs {
820
824
  }
821
825
  static async loadAsyncHDR(e) {
822
826
  const t = await this.hdrLoader.loadAsync(e);
823
- return t.mapping = Je, t;
827
+ return t.mapping = Ze, t;
824
828
  }
825
829
  static async loadAsyncCubeTexture(e, t) {
826
830
  return this.cubeTextureLoader.setPath(e), await this.cubeTextureLoader.loadAsync(t);
827
831
  }
828
832
  }
829
- class U extends j {
833
+ class j extends F {
830
834
  isBaseMesh = !0;
831
835
  type = "BaseMesh";
832
836
  ignoreInvisibleWhenRaycast = !0;
@@ -837,7 +841,7 @@ class U extends j {
837
841
  return this.visible === !1 && this.ignoreInvisibleWhenRaycast === !0 ? !1 : super.raycast(e, t);
838
842
  }
839
843
  }
840
- class Ee extends z {
844
+ class Ee extends Q {
841
845
  isBaseGroup = !0;
842
846
  type = "BaseGroup";
843
847
  ignoreInvisibleWhenRaycast = !0;
@@ -848,7 +852,7 @@ class Ee extends z {
848
852
  return this.visible === !1 && this.ignoreInvisibleWhenRaycast === !0 ? !1 : super.raycast(e, t);
849
853
  }
850
854
  }
851
- class Xt extends Ze {
855
+ class Zt extends Ve {
852
856
  isBaseSprite = !0;
853
857
  type = "BaseSprite";
854
858
  ignoreInvisibleWhenRaycast = !0;
@@ -859,10 +863,13 @@ class Xt extends Ze {
859
863
  return this.visible === !1 && this.ignoreInvisibleWhenRaycast === !0 ? !1 : super.raycast(e, t);
860
864
  }
861
865
  }
862
- class H extends Ee {
866
+ class W extends Ee {
863
867
  isModel = !0;
864
868
  type = "Model";
865
869
  static memoryCache = /* @__PURE__ */ new Map();
870
+ mixer = null;
871
+ animations = [];
872
+ actions = /* @__PURE__ */ new Map();
866
873
  constructor() {
867
874
  super();
868
875
  }
@@ -870,13 +877,37 @@ class H extends Ee {
870
877
  const { url: t, cache: s = !0, persistent: n = !0 } = e;
871
878
  try {
872
879
  let i;
873
- s ? H.memoryCache.has(t) ? i = H.memoryCache.get(t) : (i = R.loadAsync(t, { persistent: n }), H.memoryCache.set(t, i)) : i = R.loadAsync(t, { persistent: n });
874
- const a = await i, c = bt(a);
875
- return this.add(c), c;
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;
876
883
  } catch (i) {
877
884
  return console.error(`[Model] Failed to load model from ${t}:`, i), null;
878
885
  }
879
886
  }
887
+ playAnimation(e, t = {}) {
888
+ 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)
892
+ 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;
895
+ }
896
+ playAllAnimations(e = {}) {
897
+ return this.animations.map((t, s) => this.playAnimation(s, e)).filter((t) => t !== null);
898
+ }
899
+ stopAnimation(e) {
900
+ if (!this.mixer) return;
901
+ if (e === void 0) {
902
+ this.mixer.stopAllAction();
903
+ return;
904
+ }
905
+ let t;
906
+ typeof e == "number" ? t = this.animations[e]?.name : t = e, t && this.actions.get(t)?.stop();
907
+ }
908
+ updateAnimation(e) {
909
+ this.mixer?.update(e);
910
+ }
880
911
  static clearMemoryCache() {
881
912
  this.memoryCache.clear();
882
913
  }
@@ -884,11 +915,11 @@ class H extends Ee {
884
915
  typeof caches < "u" && await caches.delete("u-space-loader-cache");
885
916
  }
886
917
  }
887
- class qt extends U {
918
+ class Vt extends j {
888
919
  isSphereMesh = !0;
889
920
  type = "SphereMesh";
890
921
  constructor({ geometryParameters: e, materialParameters: t } = {}) {
891
- super(), this.geometry = new Ve(
922
+ super(), this.geometry = new nt(
892
923
  e?.radius,
893
924
  e?.widthSegments,
894
925
  e?.heightSegments,
@@ -899,11 +930,11 @@ class qt extends U {
899
930
  ), this.material = new I(t);
900
931
  }
901
932
  }
902
- class ue extends U {
933
+ class ue extends j {
903
934
  isTubeMesh = !0;
904
935
  type = "TubeMesh";
905
936
  constructor({ geometryParameters: e, materialParameters: t } = {}) {
906
- super(), this.geometry = new et(
937
+ super(), this.geometry = new it(
907
938
  e?.path,
908
939
  e?.tubularSegments,
909
940
  e?.radius,
@@ -912,7 +943,7 @@ class ue extends U {
912
943
  ), this.material = new I(t);
913
944
  }
914
945
  }
915
- class bs extends Ee {
946
+ class Ms extends Ee {
916
947
  isTopology = !0;
917
948
  type = "Topology";
918
949
  // Visuals
@@ -958,13 +989,13 @@ class bs extends Ee {
958
989
  * @param bidirectional If true, adds the reverse edge as well. Default true.
959
990
  */
960
991
  addEdge(e, t, s, n = !0) {
961
- const i = this.nodes.get(e), a = this.nodes.get(t);
962
- if (!i || !a) {
992
+ const i = this.nodes.get(e), r = this.nodes.get(t);
993
+ if (!i || !r) {
963
994
  console.error(`[Topology] Cannot add edge. One or both nodes not found: ${e}, ${t}`);
964
995
  return;
965
996
  }
966
- const c = s ?? i.distanceTo(a);
967
- this.getNeighbors(e)?.set(t, c), n && this.getNeighbors(t)?.set(e, c);
997
+ const a = s ?? i.distanceTo(r);
998
+ this.getNeighbors(e)?.set(t, a), n && this.getNeighbors(t)?.set(e, a);
968
999
  }
969
1000
  /**
970
1001
  * Remove an edge between two nodes.
@@ -982,41 +1013,41 @@ class bs extends Ee {
982
1013
  if (!this.nodes.has(e) || !this.nodes.has(t))
983
1014
  return console.warn("[Topology] Start or End node not found."), [];
984
1015
  const s = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Set();
985
- for (const [r] of this.nodes)
986
- s.set(r, 1 / 0), n.set(r, null), i.add(r);
1016
+ for (const [o] of this.nodes)
1017
+ s.set(o, 1 / 0), n.set(o, null), i.add(o);
987
1018
  for (s.set(e, 0); i.size > 0; ) {
988
- let r = null, h = 1 / 0;
989
- for (const u of i) {
990
- const f = s.get(u);
991
- f < h && (h = f, r = u);
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);
992
1023
  }
993
- if (r === null || r === t || h === 1 / 0)
1024
+ if (o === null || o === t || h === 1 / 0)
994
1025
  break;
995
- i.delete(r);
996
- const l = this.adjacencyMap?.get(r);
1026
+ i.delete(o);
1027
+ const l = this.adjacencyMap?.get(o);
997
1028
  if (l)
998
- for (const [u, f] of l) {
999
- if (!i.has(u)) continue;
1000
- const p = s.get(r) + f;
1001
- p < s.get(u) && (s.set(u, p), n.set(u, r));
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));
1002
1033
  }
1003
1034
  }
1004
- const a = [];
1005
- let c = t;
1035
+ const r = [];
1036
+ let a = t;
1006
1037
  if (n.get(t) === null && e !== t)
1007
1038
  return [];
1008
- for (; c !== null; ) {
1009
- const r = this.nodes.get(c);
1010
- r && a.unshift(r), c = n.get(c) || null;
1039
+ for (; a !== null; ) {
1040
+ const o = this.nodes.get(a);
1041
+ o && r.unshift(o), a = n.get(a) || null;
1011
1042
  }
1012
- return a;
1043
+ return r;
1013
1044
  }
1014
1045
  /**
1015
1046
  * Renders the entire topology graph structure using TubeGeometry and Spheres.
1016
1047
  */
1017
1048
  renderGraph() {
1018
- this.clearGraph(), this.graphGroup = new z();
1019
- const e = new qt({
1049
+ this.clearGraph(), this.graphGroup = new Q();
1050
+ const e = new Vt({
1020
1051
  geometryParameters: {
1021
1052
  radius: this.parameters.nodeRadius,
1022
1053
  widthSegments: 16,
@@ -1032,13 +1063,13 @@ class bs extends Ee {
1032
1063
  });
1033
1064
  const t = /* @__PURE__ */ new Set();
1034
1065
  this.adjacencyMap.forEach((s, n) => {
1035
- s.forEach((i, a) => {
1036
- const c = [n, a].sort().join("-");
1037
- if (t.has(c)) return;
1038
- t.add(c);
1039
- const r = this.nodes.get(n), h = this.nodes.get(a);
1040
- if (r && h) {
1041
- const l = new tt(r, h), u = new ue({
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({
1042
1073
  geometryParameters: {
1043
1074
  path: l,
1044
1075
  tubularSegments: 1,
@@ -1050,14 +1081,14 @@ class bs extends Ee {
1050
1081
  color: this.parameters.edgeColor
1051
1082
  }
1052
1083
  });
1053
- Object.assign(u.userData, { from: n, to: a, weight: i, type: "edge" }), this.graphGroup.add(u);
1084
+ Object.assign(p.userData, { from: n, to: r, weight: i, type: "edge" }), this.graphGroup.add(p);
1054
1085
  }
1055
1086
  });
1056
1087
  }), this.add(this.graphGroup);
1057
1088
  }
1058
1089
  clearGraph() {
1059
1090
  this.graphGroup && (this.remove(this.graphGroup), this.graphGroup.traverse((e) => {
1060
- e instanceof j && (e.geometry.dispose(), e.material.dispose());
1091
+ e instanceof F && (e.geometry.dispose(), e.material.dispose());
1061
1092
  }), this.graphGroup = null);
1062
1093
  }
1063
1094
  /**
@@ -1065,7 +1096,7 @@ class bs extends Ee {
1065
1096
  */
1066
1097
  renderPath(e, t = this.parameters.pathColor) {
1067
1098
  if (e.length < 2) return;
1068
- const s = new st(e, !1, "catmullrom", 0), n = new ue({
1099
+ const s = new at(e, !1, "catmullrom", 0), n = new ue({
1069
1100
  geometryParameters: {
1070
1101
  path: s,
1071
1102
  tubularSegments: e.length * 10,
@@ -1091,9 +1122,9 @@ class bs extends Ee {
1091
1122
  });
1092
1123
  const t = [], s = /* @__PURE__ */ new Set();
1093
1124
  return this.adjacencyMap.forEach((n, i) => {
1094
- n.forEach((a, c) => {
1095
- const r = [i, c].sort().join("-");
1096
- s.has(r) || (s.add(r), t.push({ from: i, to: c, weight: a }));
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 }));
1097
1128
  });
1098
1129
  }), { nodes: e, edges: t };
1099
1130
  }
@@ -1103,7 +1134,7 @@ class bs extends Ee {
1103
1134
  */
1104
1135
  importData(e) {
1105
1136
  this.clearGraph(), this.clearPaths(), this.nodes.clear(), this.adjacencyMap.clear(), Object.entries(e.nodes).forEach(([t, s]) => {
1106
- this.addNode(t, new J(s.x, s.y, s.z));
1137
+ this.addNode(t, new ee(s.x, s.y, s.z));
1107
1138
  }), e.edges.forEach(({ from: t, to: s, weight: n }) => {
1108
1139
  this.addEdge(t, s, n);
1109
1140
  }), this.renderGraph();
@@ -1115,7 +1146,7 @@ class bs extends Ee {
1115
1146
  return this.adjacencyMap.get(e);
1116
1147
  }
1117
1148
  }
1118
- class Ts extends Xt {
1149
+ class Es extends Zt {
1119
1150
  isPoi = !0;
1120
1151
  type = "Poi";
1121
1152
  parameters = {
@@ -1126,12 +1157,15 @@ class Ts extends Xt {
1126
1157
  color: "#ffffff",
1127
1158
  iconSize: 64,
1128
1159
  padding: 10,
1129
- backgroundColor: "rgba(0, 0, 0, 0.5)",
1160
+ backgroundColor: "rgba(0, 0, 0, 0)",
1130
1161
  borderRadius: 8,
1131
- textPosition: "right"
1162
+ textPosition: "right",
1163
+ scaleFactor: 0.01
1132
1164
  };
1165
+ _canvas = document.createElement("canvas");
1166
+ _lastParametersJSON = "";
1133
1167
  constructor(e = {}) {
1134
- super(new nt()), Object.assign(this.parameters, e);
1168
+ super(new ot()), Object.assign(this.parameters, e), this.updateAsync();
1135
1169
  }
1136
1170
  /**
1137
1171
  * Update the POI with new parameters
@@ -1139,90 +1173,95 @@ class Ts extends Xt {
1139
1173
  */
1140
1174
  async updateAsync(e = {}) {
1141
1175
  Object.assign(this.parameters, e);
1142
- const t = document.createElement("canvas"), s = t.getContext("2d");
1143
- if (!s) return;
1144
- s.font = `${this.parameters.fontSize}px ${this.parameters.fontFamily}`;
1145
- let n = null;
1146
- this.parameters.img && (n = await this._loadImage(this.parameters.img));
1147
- const { text: i, fontSize: a, color: c, iconSize: r, padding: h, backgroundColor: l, borderRadius: u, textPosition: f } = this.parameters, p = s.measureText(i), g = i ? p.width : 0, w = i ? a : 0;
1148
- let T = 0, v = 0, b = 0, x = 0, M = 0, E = 0;
1149
- const S = !!n, m = !!i;
1150
- if (S && m)
1151
- switch (f) {
1176
+ const t = JSON.stringify(this.parameters);
1177
+ if (t === this._lastParametersJSON) return;
1178
+ 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) {
1152
1189
  case "top":
1153
- T = Math.max(r, g), v = r + h + w, M = (T - g) / 2, E = w / 2, b = (T - r) / 2, x = w + h;
1190
+ f = Math.max(h, x), C = h + l + b, M = (f - x) / 2, m = b / 2, O = (f - h) / 2, P = b + l;
1154
1191
  break;
1155
1192
  case "bottom":
1156
- T = Math.max(r, g), v = r + h + w, b = (T - r) / 2, x = 0, M = (T - g) / 2, E = r + h + w / 2;
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;
1157
1194
  break;
1158
1195
  case "left":
1159
- T = r + h + g, v = Math.max(r, w), M = 0, E = v / 2, b = g + h, x = (v - r) / 2;
1196
+ f = h + l + x, C = Math.max(h, b), M = 0, m = C / 2, O = x + l, P = (C - h) / 2;
1160
1197
  break;
1161
1198
  default:
1162
- T = r + h + g, v = Math.max(r, w), b = 0, x = (v - r) / 2, M = r + h, E = v / 2;
1199
+ f = h + l + x, C = Math.max(h, b), O = 0, P = (C - h) / 2, M = h + l, m = C / 2;
1163
1200
  break;
1164
1201
  }
1165
- else S ? (T = r, v = r, b = 0, x = 0) : m && (T = g, v = w, M = 0, E = w / 2);
1166
- const y = T + h * 2, B = v + h * 2;
1167
- t.width = y, t.height = B, s.font = `${a}px ${this.parameters.fontFamily}`, s.textBaseline = "middle", l && (s.fillStyle = l, this._drawRoundedRect(s, 0, 0, y, B, u), s.fill()), S && s.drawImage(n, b + h, x + h, r, r), m && (s.fillStyle = c, s.fillText(i, M + h, E + h)), this.material.map?.dispose();
1168
- const _ = new it(t);
1169
- _.colorSpace = ve, this.material.map = _;
1170
- const O = 0.01;
1171
- this.scale.set(y * O, B * O, 1);
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);
1208
+ }
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);
1172
1211
  }
1173
1212
  _loadImage(e) {
1174
1213
  return new Promise((t, s) => {
1175
1214
  if (typeof e == "string") {
1176
1215
  const n = new Image();
1177
- n.crossOrigin = "Anonymous", n.onload = () => t(n), n.onerror = (i) => s(i), n.src = e;
1216
+ n.crossOrigin = "Anonymous", n.onload = () => t(n), n.onerror = () => s(new Error(`Failed to load image: ${e}`)), n.src = e;
1178
1217
  } else
1179
1218
  t(e);
1180
1219
  });
1181
1220
  }
1182
- _drawRoundedRect(e, t, s, n, i, a) {
1183
- e.beginPath(), e.moveTo(t + a, s), e.lineTo(t + n - a, s), e.quadraticCurveTo(t + n, s, t + n, s + a), e.lineTo(t + n, s + i - a), e.quadraticCurveTo(t + n, s + i, t + n - a, s + i), e.lineTo(t + a, s + i), e.quadraticCurveTo(t, s + i, t, s + i - a), e.lineTo(t, s + a), e.quadraticCurveTo(t, s, t + a, s), e.closePath();
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();
1184
1223
  }
1185
1224
  dispose() {
1186
1225
  this.material.map?.dispose(), this.material.dispose();
1187
1226
  }
1188
1227
  }
1189
- class Oe extends U {
1228
+ class Oe extends j {
1190
1229
  isShapeMesh = !0;
1191
1230
  type = "ShapeMesh";
1192
1231
  constructor({ geometryParameters: e, materialParameters: t } = {}) {
1193
- super(), this.geometry = new rt(e?.shape, e?.curveSegments), this.material = new I(t), this.geometry.rotateX(-Math.PI / 2);
1232
+ super(), this.geometry = new ht(e?.shape, e?.curveSegments), this.material = new I(t), this.geometry.rotateX(-Math.PI / 2);
1194
1233
  }
1195
1234
  static createFromPoints(e, t = {}) {
1196
1235
  return new Oe({
1197
1236
  ...t,
1198
1237
  geometryParameters: {
1199
1238
  ...t.geometryParameters,
1200
- shape: new be(e.map((s) => new P(s.x, -s.z)))
1239
+ shape: new be(e.map((s) => new S(s.x, -s.z)))
1201
1240
  }
1202
1241
  });
1203
1242
  }
1204
1243
  }
1205
- class Pe extends U {
1244
+ class Pe extends j {
1206
1245
  isExtrudeMesh = !0;
1207
1246
  type = "ExtrudeMesh";
1208
1247
  constructor({ geometryParameters: e, materialParameters: t } = {}) {
1209
- super(), this.geometry = new at(e?.shape, e?.options), this.material = new I(t), this.geometry.rotateX(-Math.PI / 2);
1248
+ super(), this.geometry = new lt(e?.shape, e?.options), this.material = new I(t), this.geometry.rotateX(-Math.PI / 2);
1210
1249
  }
1211
1250
  static createFromPoints(e, t = {}) {
1212
1251
  return new Pe({
1213
1252
  ...t,
1214
1253
  geometryParameters: {
1215
1254
  ...t.geometryParameters,
1216
- shape: new be(e.map((s) => new P(s.x, -s.z)))
1255
+ shape: new be(e.map((s) => new S(s.x, -s.z)))
1217
1256
  }
1218
1257
  });
1219
1258
  }
1220
1259
  }
1221
- class Cs extends U {
1260
+ class Os extends j {
1222
1261
  isPlaneMesh = !0;
1223
1262
  type = "PlaneMesh";
1224
1263
  constructor({ geometryParameters: e, materialParameters: t } = {}) {
1225
- super(), this.geometry = new ot(
1264
+ super(), this.geometry = new dt(
1226
1265
  e?.width,
1227
1266
  e?.height,
1228
1267
  e?.widthSegments,
@@ -1230,12 +1269,12 @@ class Cs extends U {
1230
1269
  ), this.material = new I(t);
1231
1270
  }
1232
1271
  }
1233
- class xs extends U {
1272
+ class Ps extends j {
1234
1273
  isCircleMesh = !0;
1235
1274
  type = "CircleMesh";
1236
1275
  constructor({ geometryParameters: e, materialParameters: t } = {}) {
1237
1276
  super(
1238
- new ct(
1277
+ new pt(
1239
1278
  e?.radius,
1240
1279
  e?.segments,
1241
1280
  e?.thetaStart,
@@ -1245,21 +1284,21 @@ class xs extends U {
1245
1284
  ), this.geometry.rotateX(-Math.PI / 2);
1246
1285
  }
1247
1286
  }
1248
- class Yt {
1287
+ class es {
1249
1288
  static traverseMeshes(e, t) {
1250
1289
  e.traverse((s) => {
1251
- s instanceof j && t(s);
1290
+ s instanceof F && t(s);
1252
1291
  });
1253
1292
  }
1254
1293
  }
1255
- class Ms {
1294
+ class Ss {
1256
1295
  static flow(e = {}) {
1257
- const { baseColor: t = 16777215, flowColor: s = 65280, speed: n = 1, scale: i = 3, intensity: a = 4 } = e, c = N(new A(t)), r = N(new A(s)), h = ae().x.mul(i).sub(Q.mul(n)), l = K(oe(h).add(1).mul(0.5), a);
1258
- return X(c, r, l);
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);
1259
1298
  }
1260
1299
  static breathe(e = {}) {
1261
- const { baseColor: t = 16777215, breathColor: s = 65280, speed: n = 1, intensity: i = 2 } = e, a = N(new A(t)), c = N(new A(s)), r = oe(Q.mul(n)).add(1).mul(0.5), h = K(r, i);
1262
- return X(a, c, h);
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);
1263
1302
  }
1264
1303
  static fluid(e = {}) {
1265
1304
  const {
@@ -1267,22 +1306,22 @@ class Ms {
1267
1306
  flowColor: s = 255,
1268
1307
  speed: n = 1,
1269
1308
  scale: i = 1,
1270
- intensity: a = 1,
1271
- distortion: c = 0.5
1272
- } = e, r = N(new A(t)), h = N(new A(s)), l = ae().mul(i), u = Q.mul(n), f = ce(l.add(u), 1, 0), p = l.add(f.mul(c)), g = ce(p, 1, 0).add(1).mul(0.5), w = K(g, a);
1273
- return X(r, h, w);
1309
+ 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);
1274
1313
  }
1275
1314
  }
1276
- function Es(o) {
1315
+ function Ls(c) {
1277
1316
  }
1278
- const $ = "uSpaceHighlight", V = `${$}/enabled`, Se = `${$}/opacity`, Le = `${$}/color`, Ie = `${$}/overwrite`, Jt = Te(() => {
1279
- const o = D(V, "uint"), e = D(Le, "uint"), t = D(Ie, "uint"), s = Vt(e), n = he.mul(s), i = Y(t.greaterThan(0), s, n);
1280
- return Y(o.greaterThan(0), i, he);
1281
- })(), Zt = Te(() => {
1282
- const o = D(V, "uint"), e = D(Se, "float");
1283
- return Y(o.greaterThan(0), e, lt);
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);
1284
1323
  })();
1285
- class Os {
1324
+ class Is {
1286
1325
  static highlight(e, t = {}) {
1287
1326
  const s = Object.assign(
1288
1327
  {
@@ -1293,18 +1332,18 @@ class Os {
1293
1332
  },
1294
1333
  t
1295
1334
  );
1296
- s.color = new Z(s.color).getHex(), Yt.traverseMeshes(e, (n) => {
1297
- n.userData[V] = s.enabled ? 1 : 0, n.userData[Se] = s.opacity, n.userData[Le] = s.color, n.userData[Ie] = s.overwrite ? 1 : 0;
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;
1298
1337
  const i = n.material;
1299
- i && !Array.isArray(i) && (i.transparent = !0, i.colorNode = Jt, i.opacityNode = Zt, i.needsUpdate = !0);
1338
+ i && !Array.isArray(i) && (i.transparent = !0, i.colorNode = ts, i.opacityNode = ss, i.needsUpdate = !0);
1300
1339
  });
1301
1340
  }
1302
1341
  }
1303
- const Vt = (o) => {
1304
- const e = o.shiftRight(16).bitAnd(255).toFloat().div(255), t = o.shiftRight(8).bitAnd(255).toFloat().div(255), s = o.bitAnd(255).toFloat().div(255);
1305
- return dt(e, t, s);
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);
1306
1345
  };
1307
- class es extends Tt {
1346
+ class is extends Et {
1308
1347
  viewer;
1309
1348
  constructor(e, t) {
1310
1349
  super(t), this.viewer = e;
@@ -1313,7 +1352,7 @@ class es extends Tt {
1313
1352
  this.update(e) && this.viewer.render();
1314
1353
  };
1315
1354
  easingByMode(e) {
1316
- const t = ts[e];
1355
+ const t = rs[e];
1317
1356
  return super.easing(t);
1318
1357
  }
1319
1358
  start(e, t) {
@@ -1323,21 +1362,21 @@ class es extends Tt {
1323
1362
  return this.viewer.removeEventListener("afterControlsUpdate", this._update), super.stop();
1324
1363
  }
1325
1364
  }
1326
- function Ps(o, e, t, s = {}, n, i) {
1327
- return new Promise((a, c) => {
1328
- const { duration: r = 1e3, delay: h = 0, repeat: l = !1, mode: u = "Linear.None", yoyo: f = !1 } = s, p = new es(o, e).to(t, r).easingByMode(u).delay(h).onUpdate((g) => {
1329
- n?.(g, p);
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);
1330
1369
  }).onComplete(() => {
1331
- a();
1370
+ r();
1332
1371
  }).onStop(() => {
1333
- c("animation stop");
1372
+ a("animation stop");
1334
1373
  }).onStart(() => {
1335
- i?.(p);
1374
+ i?.(u);
1336
1375
  });
1337
- typeof l == "number" ? p.repeat(l) : typeof l == "boolean" && l && p.repeat(1 / 0), f && p.repeatDelay(20), p.yoyo(f), p.start();
1376
+ typeof l == "number" ? u.repeat(l) : typeof l == "boolean" && l && u.repeat(1 / 0), g && u.repeatDelay(20), u.yoyo(g), u.start();
1338
1377
  });
1339
1378
  }
1340
- const ts = {
1379
+ const rs = {
1341
1380
  "Linear.None": d.Linear.None,
1342
1381
  "Quadratic.In": d.Quadratic.In,
1343
1382
  "Quadratic.Out": d.Quadratic.Out,
@@ -1372,31 +1411,31 @@ const ts = {
1372
1411
  };
1373
1412
  export {
1374
1413
  Ee as BaseGroup,
1375
- U as BaseMesh,
1376
- Xt as BaseSprite,
1377
- Pt as CameraControls,
1378
- xs as CircleMesh,
1414
+ j as BaseMesh,
1415
+ Zt as BaseSprite,
1416
+ Bt as CameraControls,
1417
+ Ps as CircleMesh,
1379
1418
  Pe as ExtrudeMesh,
1380
- Ct as InteractionEvent,
1381
- xt as InteractionManager,
1382
- Os as MaterialEffects,
1383
- H as Model,
1419
+ Ot as InteractionEvent,
1420
+ Pt as InteractionManager,
1421
+ Is as MaterialEffects,
1422
+ W as Model,
1384
1423
  R as ModelLoaderManager,
1385
- Mt as ObjectManager,
1386
- Yt as ObjectUtils,
1387
- Cs as PlaneMesh,
1388
- Ts as Poi,
1389
- Lt as RoomEnvironment,
1390
- Kt as SBMLoader,
1391
- Rt as SBMXLoader,
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,
1392
1431
  Oe as ShapeMesh,
1393
- qt as SphereMesh,
1394
- Ms as TSLEffects,
1395
- vs as TextureLoaderManager,
1396
- bs as Topology,
1432
+ Vt as SphereMesh,
1433
+ Ss as TSLEffects,
1434
+ xs as TextureLoaderManager,
1435
+ Ms as Topology,
1397
1436
  ue as TubeMesh,
1398
- es as Tween,
1399
- ys as Viewer,
1400
- Es as reinterpretType,
1401
- Ps as tweenAnimation
1437
+ is as Tween,
1438
+ Cs as Viewer,
1439
+ Ls as reinterpretType,
1440
+ Bs as tweenAnimation
1402
1441
  };