@nebula-spatial/viewer 0.5.14 → 0.5.16

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.
@@ -1,25 +1,25 @@
1
1
  var jn = Object.defineProperty;
2
2
  var Fn = (r, e, t) => e in r ? jn(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
3
  var u = (r, e, t) => Fn(r, typeof e != "symbol" ? e + "" : e, t);
4
- import { Texture as ot, Scene as $e, OrthographicCamera as St, PlaneGeometry as tn, ShaderMaterial as nn, KeepStencilOp as ke, EqualStencilFunc as Qe, Matrix3 as rn, Mesh as ae, MeshBasicMaterial as Nt, ReplaceStencilOp as Se, AlwaysStencilFunc as Pt, DoubleSide as Ot, Color as tt, MathUtils as Y, EquirectangularReflectionMapping as Me, Matrix4 as ct, Euler as sn, MeshPhysicalMaterial as jt, FrontSide as zn, Vector3 as M, ShaderChunk as Ut, MOUSE as re, Object3D as an, Group as on, Raycaster as lt, Vector2 as J, Quaternion as it, WebGLRenderer as ln, PerspectiveCamera as dn, TOUCH as _t, Vector4 as $n, Plane as cn, WebGLRenderTarget as Vn, Box3 as Z, PMREMGenerator as Bn, TextureLoader as un, SRGBColorSpace as Ft, ACESFilmicToneMapping as Un, MeshStandardMaterial as _n, SphereGeometry as Hn, Sphere as Ht, UniformsUtils as qn, BoxHelper as Yn, Box3Helper as Wn, BoxGeometry as Gn, LineSegments as Xn, EdgesGeometry as Kn, LineBasicMaterial as Jn } from "three";
4
+ import { Texture as lt, Scene as $e, OrthographicCamera as Pt, PlaneGeometry as tn, ShaderMaterial as nn, KeepStencilOp as ke, EqualStencilFunc as Qe, Matrix3 as rn, Mesh as ae, MeshBasicMaterial as Ot, ReplaceStencilOp as Se, AlwaysStencilFunc as Mt, DoubleSide as jt, Color as tt, MathUtils as Y, EquirectangularReflectionMapping as Me, Matrix4 as ut, Euler as sn, MeshPhysicalMaterial as Ft, FrontSide as zn, Vector3 as R, ShaderChunk as _t, MOUSE as se, Object3D as an, Group as on, Raycaster as dt, Vector2 as Z, Quaternion as it, WebGLRenderer as ln, PerspectiveCamera as dn, TOUCH as Ht, Vector4 as $n, Plane as cn, WebGLRenderTarget as Vn, Box3 as Q, PMREMGenerator as Bn, TextureLoader as un, SRGBColorSpace as zt, ACESFilmicToneMapping as Un, MeshStandardMaterial as _n, SphereGeometry as Hn, Sphere as qt, UniformsUtils as qn, BoxHelper as Yn, Box3Helper as Wn, BoxGeometry as Gn, LineSegments as Xn, EdgesGeometry as Kn, LineBasicMaterial as Jn } from "three";
5
5
  import { RoomEnvironment as Zn } from "three/addons/environments/RoomEnvironment.js";
6
6
  import { MapControls as Qn } from "three/addons/controls/MapControls.js";
7
7
  import { OrbitControls as er } from "three/addons/controls/OrbitControls.js";
8
8
  import { HDRLoader as hn } from "three/addons/loaders/HDRLoader.js";
9
- import { createCadDocumentSession as tr, getCadDocumentRenderResource as ir, formatCadInsertId as qt } from "@nebula-spatial/cad-loader";
9
+ import { createCadDocumentSession as tr, getCadDocumentRenderResource as ir, formatCadInsertId as Yt } from "@nebula-spatial/cad-loader";
10
10
  import { CSS2DObject as nr, CSS2DRenderer as rr } from "three/addons/renderers/CSS2DRenderer.js";
11
- import { viewerRuntimeAssetUrls as Yt } from "@nebula-spatial/viewer/runtime-assets";
11
+ import { viewerRuntimeAssetUrls as Wt } from "@nebula-spatial/viewer/runtime-assets";
12
12
  import sr from "@mujoco/mujoco/mujoco.wasm?url";
13
- const ar = "0.5.14", or = "@nebula-spatial/viewer", Wt = "__NEBULA_SPATIAL_VIEWER_BANNER_PRINTED__";
14
- function Gt() {
13
+ const ar = "0.5.16", or = "@nebula-spatial/viewer", Gt = "__NEBULA_SPATIAL_VIEWER_BANNER_PRINTED__";
14
+ function Xt() {
15
15
  const r = `%c ${or} %c v${ar} `;
16
16
  console.log(r, "background:#111827;color:#ffffff;padding:4px 10px;border-radius:4px 0 0 4px;font-weight:700;", "background:#10B981;color:#ffffff;padding:4px 10px;border-radius:0 4px 4px 0;font-weight:700;");
17
17
  }
18
18
  try {
19
19
  const r = globalThis;
20
- r[Wt] || (r[Wt] = !0, Gt());
20
+ r[Gt] || (r[Gt] = !0, Xt());
21
21
  } catch {
22
- Gt();
22
+ Xt();
23
23
  }
24
24
  const lr = [
25
25
  "alphaMap",
@@ -55,12 +55,12 @@ function dr(r, e, t) {
55
55
  const i = r;
56
56
  for (const n of lr) {
57
57
  const s = i[n];
58
- s instanceof ot && nt(s, t);
58
+ s instanceof lt && nt(s, t);
59
59
  }
60
60
  }
61
61
  nt(r, t);
62
62
  }
63
- function Xt(r, e = {}) {
63
+ function Kt(r, e = {}) {
64
64
  const t = e.disposedResources ?? /* @__PURE__ */ new WeakSet(), i = e.disposeTextures !== !1;
65
65
  r.traverse((n) => {
66
66
  const s = n;
@@ -79,7 +79,7 @@ function pe(r) {
79
79
  }
80
80
  return !0;
81
81
  }
82
- const Kt = 31, Jt = "HDR_BACKDROP_BLUR", cr = (
82
+ const Jt = 31, Zt = "HDR_BACKDROP_BLUR", cr = (
83
83
  /* glsl */
84
84
  `
85
85
  varying vec2 vUv;
@@ -137,7 +137,7 @@ class hr {
137
137
  u(this, "candidates", []);
138
138
  u(this, "activeCandidates", []);
139
139
  u(this, "backdropScene", new $e());
140
- u(this, "backdropCamera", new St(-1, 1, 1, -1, 0, 1));
140
+ u(this, "backdropCamera", new Pt(-1, 1, 1, -1, 0, 1));
141
141
  u(this, "backdropGeometry", new tn(2, 2));
142
142
  u(this, "backdropMaterial", new nn({
143
143
  name: "HdrTransparentBackdropMaterial",
@@ -161,16 +161,16 @@ class hr {
161
161
  toneMapped: !0
162
162
  }));
163
163
  u(this, "backdropMesh", new ae(this.backdropGeometry, this.backdropMaterial));
164
- u(this, "maskMaterial", new Nt({
164
+ u(this, "maskMaterial", new Ot({
165
165
  name: "HdrTransparentMaskMaterial",
166
166
  colorWrite: !1,
167
167
  depthTest: !1,
168
168
  depthWrite: !1,
169
169
  fog: !1,
170
- side: Ot,
170
+ side: jt,
171
171
  stencilWrite: !0,
172
172
  stencilRef: 1,
173
- stencilFunc: Pt,
173
+ stencilFunc: Mt,
174
174
  stencilFail: Se,
175
175
  stencilZFail: Se,
176
176
  stencilZPass: Se
@@ -201,7 +201,7 @@ class hr {
201
201
  }
202
202
  render(e, t, i, n) {
203
203
  const s = t.environment;
204
- if (this.disposed || !(s instanceof ot) || s.mapping !== Me || (this.dirty && this.refreshCandidates(n), this.candidates.length === 0)) return !1;
204
+ if (this.disposed || !(s instanceof lt) || s.mapping !== Me || (this.dirty && this.refreshCandidates(n), this.candidates.length === 0)) return !1;
205
205
  this.activeCandidates.length = 0;
206
206
  for (const m of this.candidates)
207
207
  pe(m) && i.layers.test(m.layers) && this.activeCandidates.push(m);
@@ -209,7 +209,7 @@ class hr {
209
209
  const a = e.autoClear, o = e.getClearAlpha(), l = e.getClearColor(this.previousClearColor), d = t.background, c = t.overrideMaterial, p = i.layers.mask;
210
210
  this.previousLayerMasks.length = 0;
211
211
  for (const m of this.activeCandidates)
212
- this.previousLayerMasks.push(m.layers.mask), m.layers.set(Kt);
212
+ this.previousLayerMasks.push(m.layers.mask), m.layers.set(Jt);
213
213
  s.updateMatrix();
214
214
  const h = this.backdropMaterial.uniforms;
215
215
  h.tEquirect.value = s, h.uvTransform.value.copy(s.matrix), h.backgroundIntensity.value = t.backgroundIntensity, h.blurriness.value = this.blurriness, h.yawOffset.value = this.yawOffset;
@@ -217,7 +217,7 @@ class hr {
217
217
  return e.autoClear = !1, e.setClearColor(
218
218
  t.background instanceof tt ? t.background : l,
219
219
  1
220
- ), e.clear(!0, !0, !0), t.background = null, t.overrideMaterial = this.maskMaterial, i.layers.set(Kt), e.render(t, i), t.overrideMaterial = null, e.render(this.backdropScene, this.backdropCamera), t.overrideMaterial = c, t.background = null, i.layers.mask = p, this.restoreCandidateLayers(), e.render(t, i), !0;
220
+ ), e.clear(!0, !0, !0), t.background = null, t.overrideMaterial = this.maskMaterial, i.layers.set(Jt), e.render(t, i), t.overrideMaterial = null, e.render(this.backdropScene, this.backdropCamera), t.overrideMaterial = c, t.background = null, i.layers.mask = p, this.restoreCandidateLayers(), e.render(t, i), !0;
221
221
  } finally {
222
222
  this.restoreCandidateLayers(), i.layers.mask = p, t.overrideMaterial = c, t.background = d, e.autoClear = a, e.setClearColor(l, o);
223
223
  }
@@ -242,9 +242,9 @@ function pr(r) {
242
242
  return (Array.isArray(r) ? r : [r]).some((t) => t.visible && t.transparent === !0);
243
243
  }
244
244
  function mr(r, e) {
245
- e ? r.defines = { ...r.defines, [Jt]: "" } : r.defines && delete r.defines[Jt], r.needsUpdate = !0;
245
+ e ? r.defines = { ...r.defines, [Zt]: "" } : r.defines && delete r.defines[Zt], r.needsUpdate = !0;
246
246
  }
247
- const Zt = "TRANSMISSION_BACKDROP_BLUR", fr = -9999, vr = -1e4, gr = (
247
+ const Qt = "TRANSMISSION_BACKDROP_BLUR", fr = -9999, vr = -1e4, gr = (
248
248
  /* glsl */
249
249
  `
250
250
  varying vec2 vUv;
@@ -311,16 +311,16 @@ class yr {
311
311
  u(this, "candidates", /* @__PURE__ */ new Set());
312
312
  u(this, "proxies", /* @__PURE__ */ new Map());
313
313
  u(this, "backdropGeometry", new tn(2, 2));
314
- u(this, "maskMaterial", new Nt({
314
+ u(this, "maskMaterial", new Ot({
315
315
  name: "TransmissionHdrMaskMaterial",
316
316
  colorWrite: !1,
317
317
  depthTest: !1,
318
318
  depthWrite: !1,
319
319
  fog: !1,
320
- side: Ot,
320
+ side: jt,
321
321
  stencilWrite: !0,
322
322
  stencilRef: 1,
323
- stencilFunc: Pt,
323
+ stencilFunc: Mt,
324
324
  stencilFail: Se,
325
325
  stencilZFail: Se,
326
326
  stencilZPass: Se
@@ -330,8 +330,8 @@ class yr {
330
330
  uniforms: {
331
331
  tEquirect: { value: null },
332
332
  environmentRotation: { value: new rn() },
333
- cameraProjectionMatrixInverse: { value: new ct() },
334
- cameraWorldMatrix: { value: new ct() },
333
+ cameraProjectionMatrixInverse: { value: new ut() },
334
+ cameraWorldMatrix: { value: new ut() },
335
335
  environmentIntensity: { value: 1 },
336
336
  blurriness: { value: 0 }
337
337
  },
@@ -350,7 +350,7 @@ class yr {
350
350
  }));
351
351
  u(this, "backdropMesh", new ae(this.backdropGeometry, this.backdropMaterial));
352
352
  u(this, "rotation", new sn());
353
- u(this, "rotationMatrix", new ct());
353
+ u(this, "rotationMatrix", new ut());
354
354
  u(this, "blurriness", 0);
355
355
  u(this, "dirty", !0);
356
356
  u(this, "attachedScene", null);
@@ -358,7 +358,7 @@ class yr {
358
358
  this.backdropMesh.name = "scene-runtime:transmission-hdr-backdrop", this.backdropMesh.frustumCulled = !1, this.backdropMesh.renderOrder = fr, this.backdropMesh.raycast = () => {
359
359
  }, this.backdropMesh.onBeforeRender = (e) => {
360
360
  const t = e.getRenderTarget() !== null;
361
- this.backdropMaterial.stencilWrite = !t, this.backdropMaterial.stencilFunc = t ? Pt : Qe;
361
+ this.backdropMaterial.stencilWrite = !t, this.backdropMaterial.stencilFunc = t ? Mt : Qe;
362
362
  };
363
363
  }
364
364
  markDirty() {
@@ -375,7 +375,7 @@ class yr {
375
375
  prepare(e, t) {
376
376
  if (this.disposed) return !1;
377
377
  const i = e.environment;
378
- if (!(i instanceof ot) || i.mapping !== Me)
378
+ if (!(i instanceof lt) || i.mapping !== Me)
379
379
  return this.finish(), !1;
380
380
  if (this.dirty && this.refreshCandidates(t), this.candidates.size === 0)
381
381
  return this.finish(), !1;
@@ -429,11 +429,11 @@ class yr {
429
429
  }
430
430
  function xr(r) {
431
431
  return (Array.isArray(r) ? r : [r]).some(
432
- (t) => t.visible && t instanceof jt && t.transmission > 0
432
+ (t) => t.visible && t instanceof Ft && t.transmission > 0
433
433
  );
434
434
  }
435
435
  function wr(r, e) {
436
- e ? r.defines = { ...r.defines, [Zt]: "" } : r.defines && delete r.defines[Zt], r.needsUpdate = !0;
436
+ e ? r.defines = { ...r.defines, [Qt]: "" } : r.defines && delete r.defines[Qt], r.needsUpdate = !0;
437
437
  }
438
438
  class Cr {
439
439
  constructor() {
@@ -447,7 +447,7 @@ class Cr {
447
447
  prepare(e) {
448
448
  if (this.dirty && this.refreshCandidates(e), this.candidates.size === 0) return !1;
449
449
  for (const t of this.candidates)
450
- t.visible && t.transmission > 0 && t.thickness > 0 && t.side === zn && (this.temporarySides.set(t, t.side), t.side = Ot);
450
+ t.visible && t.transmission > 0 && t.thickness > 0 && t.side === zn && (this.temporarySides.set(t, t.side), t.side = jt);
451
451
  return !0;
452
452
  }
453
453
  finish() {
@@ -464,12 +464,12 @@ class Cr {
464
464
  if (!(i instanceof ae) || !pe(i)) return;
465
465
  const n = Array.isArray(i.material) ? i.material : [i.material];
466
466
  for (const s of n)
467
- s instanceof jt && s.transmission > 0 && this.candidates.add(s);
467
+ s instanceof Ft && s.transmission > 0 && this.candidates.add(s);
468
468
  });
469
469
  this.dirty = !1;
470
470
  }
471
471
  }
472
- const Qt = "#include <transmission_pars_fragment>", ei = "#include <transmission_fragment>", Er = (
472
+ const ei = "#include <transmission_pars_fragment>", ti = "#include <transmission_fragment>", Er = (
473
473
  /* glsl */
474
474
  `
475
475
  vec4 getEeveeSphereProbeRefraction(
@@ -541,7 +541,7 @@ class kr {
541
541
  const s = n.material, a = Array.isArray(s) ? s : [s];
542
542
  let o = !1;
543
543
  const l = a.map((d) => {
544
- if (!(d instanceof jt) || d.transmission <= 0 || !Sr(d))
544
+ if (!(d instanceof Ft) || d.transmission <= 0 || !Sr(d))
545
545
  return d;
546
546
  const c = Mr(n);
547
547
  return c === null ? d : (o = !0, this.getReplacement(d, c));
@@ -578,13 +578,13 @@ function Sr(r) {
578
578
  function Pr(r) {
579
579
  const e = r.onBeforeCompile, t = r.customProgramCacheKey;
580
580
  r.onBeforeCompile = (i, n) => {
581
- e.call(r, i, n), !(!i.fragmentShader.includes(Qt) || !i.fragmentShader.includes(ei)) && (i.fragmentShader = i.fragmentShader.replace(
582
- Qt,
583
- `${Ut.transmission_pars_fragment}
581
+ e.call(r, i, n), !(!i.fragmentShader.includes(ei) || !i.fragmentShader.includes(ti)) && (i.fragmentShader = i.fragmentShader.replace(
582
+ ei,
583
+ `${_t.transmission_pars_fragment}
584
584
  ${Er}`
585
585
  ).replace(
586
- ei,
587
- Ut.transmission_fragment.replace(
586
+ ti,
587
+ _t.transmission_fragment.replace(
588
588
  "getIBLVolumeRefraction(",
589
589
  "getEeveeSphereProbeRefraction("
590
590
  )
@@ -596,7 +596,7 @@ function Mr(r) {
596
596
  e.boundingBox || e.computeBoundingBox();
597
597
  const t = e.boundingBox;
598
598
  if (!t) return null;
599
- const i = t.getSize(new M()), n = Math.min(i.x, i.y, i.z);
599
+ const i = t.getSize(new R()), n = Math.min(i.x, i.y, i.z);
600
600
  return Number.isFinite(n) && n > 1e-6 ? n : null;
601
601
  }
602
602
  function Rr(r) {
@@ -613,10 +613,10 @@ function Rr(r) {
613
613
  } = r;
614
614
  if (!Number.isFinite(e) || !Number.isFinite(t) || !Number.isFinite(i) || !Number.isFinite(n) || !Number.isFinite(s) || !Number.isFinite(a) || !Number.isFinite(o) || !Number.isFinite(l) || !Number.isFinite(d) || i <= 0 || n <= 0 || s <= 0 || a <= 0 || a >= 180 || o <= 0)
615
615
  return { x: 0, y: 0, z: 0 };
616
- const c = 2 * s * Math.tan(a * Math.PI / 360), p = c / n, m = c * o / i, f = Math.sin(l), b = Math.cos(l), y = -f, v = b, g = -b, w = -f, x = -e * m * d, C = t * p * d;
616
+ const c = 2 * s * Math.tan(a * Math.PI / 360), p = c / n, m = c * o / i, f = Math.sin(l), g = Math.cos(l), b = -f, x = g, v = -g, w = -f, y = -e * m * d, C = t * p * d;
617
617
  return {
618
- x: y * x + g * C,
619
- y: v * x + w * C,
618
+ x: b * y + v * C,
619
+ y: x * y + w * C,
620
620
  z: 0
621
621
  };
622
622
  }
@@ -732,19 +732,19 @@ function Ur(r, e, t) {
732
732
  const s = 1 / t.maxScalePerFrame;
733
733
  return Math.max(s, Math.min(t.maxScalePerFrame, n));
734
734
  }
735
- const ut = 500, ti = 2e5, ht = 0.95, ii = -Math.PI / 2, ni = Y.degToRad(55), _r = 1e3, Hr = 2e6;
735
+ const ht = 500, ii = 2e5, pt = 0.95, ni = -Math.PI / 2, ri = Y.degToRad(55), _r = 1e3, Hr = 2e6;
736
736
  function ge(r, e, t = 1e-4) {
737
737
  return Math.abs(r - e) <= t;
738
738
  }
739
739
  class qr {
740
740
  constructor() {
741
- u(this, "orbitTarget", new M(0, 0, 0));
741
+ u(this, "orbitTarget", new R(0, 0, 0));
742
742
  u(this, "orbitDistance", 14e3);
743
- u(this, "orbitYaw", ii);
744
- u(this, "orbitPitch", ni);
743
+ u(this, "orbitYaw", ni);
744
+ u(this, "orbitPitch", ri);
745
745
  u(this, "enabled", !0);
746
- u(this, "orbitDistanceMin", ut);
747
- u(this, "orbitDistanceMax", ti);
746
+ u(this, "orbitDistanceMin", ht);
747
+ u(this, "orbitDistanceMax", ii);
748
748
  u(this, "viewportSnapshotBefore3D", null);
749
749
  u(this, "orbitSnapshotOn3DEntry", null);
750
750
  u(this, "dragMode", null);
@@ -785,7 +785,7 @@ class qr {
785
785
  fit3D(e, t) {
786
786
  const i = this.runtime;
787
787
  if (!i) return;
788
- const n = Math.max(1, (t == null ? void 0 : t.padding) ?? 1.15), s = e.getSize(new M()), a = e.getCenter(new M());
788
+ const n = Math.max(1, (t == null ? void 0 : t.padding) ?? 1.15), s = e.getSize(new R()), a = e.getCenter(new R());
789
789
  this.orbitTarget.set(a.x, a.y, a.z);
790
790
  const o = $r({
791
791
  xmin: e.min.x,
@@ -794,9 +794,9 @@ class qr {
794
794
  ymax: e.max.y,
795
795
  fovDeg: i.camera3d.fov,
796
796
  orbitPitchRad: this.orbitPitch,
797
- ndcBand: ht
797
+ ndcBand: pt
798
798
  }), l = i.camera3d.fov * Math.PI / 180, d = 2 * Math.atan(Math.tan(l / 2) * Math.max(i.camera3d.aspect, 1e-6)), c = Math.max(Math.min(l, d) / 2, 1e-6), p = Math.max(s.length() / 2, 1e-6) / Math.sin(c) * n, h = Math.max(o, p);
799
- this.orbitDistanceMin = h < ut ? Math.max(h * 0.02, 1e-6) : ut, this.orbitDistanceMax = Math.max(ti, h * 20), this.orbitDistance = this.clampDistance(h), this.syncPerspectiveCamera();
799
+ this.orbitDistanceMin = h < ht ? Math.max(h * 0.02, 1e-6) : ht, this.orbitDistanceMax = Math.max(ii, h * 20), this.orbitDistance = this.clampDistance(h), this.syncPerspectiveCamera();
800
800
  }
801
801
  getVisibleDocumentRect() {
802
802
  const e = this.runtime;
@@ -950,9 +950,9 @@ class qr {
950
950
  orbitDistanceMin: this.orbitDistanceMin,
951
951
  orbitDistanceMax: this.orbitDistanceMax,
952
952
  useFixedOrientation: e,
953
- fixedOrbitYaw: ii,
954
- fixedOrbitPitch: ni,
955
- ndcBand: ht
953
+ fixedOrbitYaw: ni,
954
+ fixedOrbitPitch: ri,
955
+ ndcBand: pt
956
956
  });
957
957
  this.orbitTarget.set(a.orbitTarget.x, a.orbitTarget.y, a.orbitTarget.z), this.orbitDistance = this.clampDistance(a.orbitDistance), this.orbitYaw = a.orbitYaw, this.orbitPitch = a.orbitPitch;
958
958
  }
@@ -969,7 +969,7 @@ class qr {
969
969
  viewportHeightPx: n,
970
970
  orthoFrustumMin: c,
971
971
  orthoFrustumMax: p,
972
- ndcBand: ht
972
+ ndcBand: pt
973
973
  }), m = h.orthoFrustumSize > 0 ? h.orthoFrustumSize : o, f = o / 2;
974
974
  e.setOrthographicViewport({
975
975
  left: -f * s,
@@ -986,7 +986,7 @@ class qr {
986
986
  syncPerspectiveCamera(e = {}) {
987
987
  const t = this.runtime;
988
988
  if (!t) return;
989
- const i = Math.cos(this.orbitPitch), n = new M(
989
+ const i = Math.cos(this.orbitPitch), n = new R(
990
990
  this.orbitTarget.x + this.orbitDistance * Math.cos(this.orbitYaw) * i,
991
991
  this.orbitTarget.y + this.orbitDistance * Math.sin(this.orbitYaw) * i,
992
992
  this.orbitTarget.z + this.orbitDistance * Math.sin(this.orbitPitch)
@@ -1019,7 +1019,7 @@ class qr {
1019
1019
  const t = [];
1020
1020
  for (const i of [-1, 1])
1021
1021
  for (const n of [-1, 1]) {
1022
- const s = new M(i, n, -1).unproject(e.camera3d), o = new M(i, n, 1).unproject(e.camera3d).sub(s).normalize();
1022
+ const s = new R(i, n, -1).unproject(e.camera3d), o = new R(i, n, 1).unproject(e.camera3d).sub(s).normalize();
1023
1023
  if (Math.abs(o.z) < 1e-8) continue;
1024
1024
  const l = (0 - s.z) / o.z;
1025
1025
  !Number.isFinite(l) || l < 0 || t.push({
@@ -1062,9 +1062,9 @@ class qr {
1062
1062
  }
1063
1063
  }
1064
1064
  }
1065
- const Yr = new M(2.4, -2.7, 1.7), Wr = new M(0, 0, 0.65), Gr = Math.PI, Xr = !0, Kr = new M(1.25, -1.5, 0.85).normalize(), Jr = 1.25, Zr = 0.4, Qr = 12, es = 1e3, ts = 20, is = 0.1, ns = 0.2, vn = "left-rotate", rs = {
1066
- "left-rotate": { LEFT: re.ROTATE, MIDDLE: re.DOLLY, RIGHT: re.PAN },
1067
- "left-pan": { LEFT: re.PAN, MIDDLE: re.DOLLY, RIGHT: re.ROTATE }
1065
+ const Yr = new R(2.4, -2.7, 1.7), Wr = new R(0, 0, 0.65), Gr = Math.PI, Xr = !0, Kr = new R(1.25, -1.5, 0.85).normalize(), Jr = 1.25, Zr = 0.4, Qr = 12, es = 1e3, ts = 20, is = 0.1, ns = 0.2, vn = "left-rotate", rs = {
1066
+ "left-rotate": { LEFT: se.ROTATE, MIDDLE: se.DOLLY, RIGHT: se.PAN },
1067
+ "left-pan": { LEFT: se.PAN, MIDDLE: se.DOLLY, RIGHT: se.ROTATE }
1068
1068
  };
1069
1069
  function ss({ radius: r, fovDeg: e }) {
1070
1070
  const t = Math.max(r, 0.02), i = Y.degToRad(e), n = t / Math.sin(i * 0.5) * Jr;
@@ -1083,15 +1083,15 @@ function ss({ radius: r, fovDeg: e }) {
1083
1083
  function as(r, e, t) {
1084
1084
  e.minDistance = t.minDistance, e.maxDistance = t.maxDistance, r.near = t.near, r.far = t.far, r.updateProjectionMatrix();
1085
1085
  }
1086
- function ri(r, e, t = vn) {
1086
+ function si(r, e, t = vn) {
1087
1087
  r.enableDamping = Xr, r.maxPolarAngle = Gr, r.dampingFactor = 0.1, r.enablePan = !0, r.screenSpacePanning = !0, r.mouseButtons = { ...rs[t] }, an.DEFAULT_UP.set(0, 0, 1), e.up.set(0, 0, 1);
1088
1088
  }
1089
1089
  function os(r, e, t, i) {
1090
1090
  if (t.isEmpty()) return null;
1091
- const n = t.getSize(new M()), s = t.getCenter(new M()), a = Math.max(n.length() * 0.5, 0.02), o = ss({ radius: a, fovDeg: i });
1091
+ const n = t.getSize(new R()), s = t.getCenter(new R()), a = Math.max(n.length() * 0.5, 0.02), o = ss({ radius: a, fovDeg: i });
1092
1092
  return e.target.copy(s), r.position.copy(s).addScaledVector(Kr, o.distance), as(r, e, o), r.updateMatrixWorld(), e.update(), o;
1093
1093
  }
1094
- const ls = 1e3, ds = 2, cs = -1e4, us = 1e4, si = 1e3, hs = 2e6, ps = 1.15, ms = 1, fs = new sn(Math.PI / 2, 0, 0), vs = new it().setFromEuler(fs), gs = new M(0, 1, 0);
1094
+ const ls = 1e3, ds = 2, cs = -1e4, us = 1e4, ai = 1e3, hs = 2e6, ps = 1.15, ms = 1, fs = new sn(Math.PI / 2, 0, 0), vs = new it().setFromEuler(fs), gs = new R(0, 1, 0);
1095
1095
  class bs {
1096
1096
  constructor(e) {
1097
1097
  u(this, "canvasArea");
@@ -1109,10 +1109,10 @@ class bs {
1109
1109
  u(this, "ownedObjects", /* @__PURE__ */ new Set());
1110
1110
  u(this, "overlays", /* @__PURE__ */ new Map());
1111
1111
  u(this, "eventCleanups", []);
1112
- u(this, "raycaster", new lt());
1113
- u(this, "pointerNdc", new J());
1114
- u(this, "reuseVector", new M());
1115
- u(this, "reuseVector2", new M());
1112
+ u(this, "raycaster", new dt());
1113
+ u(this, "pointerNdc", new Z());
1114
+ u(this, "reuseVector", new R());
1115
+ u(this, "reuseVector2", new R());
1116
1116
  u(this, "viewModeValue");
1117
1117
  u(this, "initialized", !1);
1118
1118
  u(this, "disposed", !1);
@@ -1148,7 +1148,7 @@ class bs {
1148
1148
  u(this, "volumeTransmissionFailed", !1);
1149
1149
  u(this, "eeveeSphereProbeTransmission", new kr());
1150
1150
  u(this, "eeveeSphereProbeTransmissionFailed", !1);
1151
- this.options = e, this.transparentHdrBackdropBlurriness = e.transparentHdrBackdropBlurriness ?? 0, this.canvasArea = e.canvasArea, this.canvas = e.canvas, this.viewModeValue = e.initialViewMode ?? "2d", this.navigationPolicyValue = e.navigationPolicy ?? "legacy", this.previewDragPreset = e.previewDragPreset ?? vn, this.environmentBackgroundCapable = e.environment !== void 0 && e.environment !== "room", this.environmentRotationDegrees = oi(e.environmentRotation ?? 0), this.overlayRoot.name = "scene-runtime:overlays", this.scene.add(this.overlayRoot);
1151
+ this.options = e, this.transparentHdrBackdropBlurriness = e.transparentHdrBackdropBlurriness ?? 0, this.canvasArea = e.canvasArea, this.canvas = e.canvas, this.viewModeValue = e.initialViewMode ?? "2d", this.navigationPolicyValue = e.navigationPolicy ?? "legacy", this.previewDragPreset = e.previewDragPreset ?? vn, this.environmentBackgroundCapable = e.environment !== void 0 && e.environment !== "room", this.environmentRotationDegrees = li(e.environmentRotation ?? 0), this.overlayRoot.name = "scene-runtime:overlays", this.scene.add(this.overlayRoot);
1152
1152
  }
1153
1153
  initialize() {
1154
1154
  if (this.disposed) throw new Error("SceneRuntime has been disposed.");
@@ -1165,7 +1165,7 @@ class bs {
1165
1165
  }), this.options.clearColor !== void 0 && this.renderer.setClearColor(new tt(this.options.clearColor));
1166
1166
  const s = Math.max(1, this.canvasArea.clientWidth || 1), a = Math.max(1, this.canvasArea.clientHeight || 1), o = s / a;
1167
1167
  if (this.renderer.setPixelRatio(this.readDevicePixelRatio()), this.renderer.setSize(s, a, !1), this.options.environment) {
1168
- const l = (e == null ? void 0 : e.createEnvironment) ?? ai;
1168
+ const l = (e == null ? void 0 : e.createEnvironment) ?? oi;
1169
1169
  this.scene.environmentIntensity = ms, this.applyEnvironmentRotations();
1170
1170
  const d = ++this.environmentLoadGeneration, c = l(this.renderer, this.options.environment);
1171
1171
  ys(c) ? c.then(
@@ -1175,13 +1175,13 @@ class bs {
1175
1175
  }
1176
1176
  ) : this.applyEnvironmentResource(c, d);
1177
1177
  }
1178
- this.camera2d = new St(-o, o, 1, -1, cs, us), this.camera2d.position.set(0, 0, 1), this.camera2d.lookAt(0, 0, 0), this.camera3d = new dn(40, o, si, hs), this.camera3d.up.set(0, 0, 1), this.camera3d.position.set(1e4, 0, 1e4), this.camera3d.lookAt(0, 0, 0), this.controls2d = i(this.camera2d, this.renderer.domElement), this.controls2d.enableRotate = !1, this.controls2d.screenSpacePanning = !0, this.controls2d.zoomToCursor = !0, this.controls2d.minZoom = 2e-3, this.controls2d.maxZoom = 5e4, this.controls2d.mouseButtons = {
1179
- LEFT: re.PAN,
1180
- MIDDLE: re.DOLLY,
1181
- RIGHT: re.PAN
1178
+ this.camera2d = new Pt(-o, o, 1, -1, cs, us), this.camera2d.position.set(0, 0, 1), this.camera2d.lookAt(0, 0, 0), this.camera3d = new dn(40, o, ai, hs), this.camera3d.up.set(0, 0, 1), this.camera3d.position.set(1e4, 0, 1e4), this.camera3d.lookAt(0, 0, 0), this.controls2d = i(this.camera2d, this.renderer.domElement), this.controls2d.enableRotate = !1, this.controls2d.screenSpacePanning = !0, this.controls2d.zoomToCursor = !0, this.controls2d.minZoom = 2e-3, this.controls2d.maxZoom = 5e4, this.controls2d.mouseButtons = {
1179
+ LEFT: se.PAN,
1180
+ MIDDLE: se.DOLLY,
1181
+ RIGHT: se.PAN
1182
1182
  }, this.controls2d.touches = {
1183
- ONE: _t.PAN,
1184
- TWO: _t.DOLLY_PAN
1183
+ ONE: Ht.PAN,
1184
+ TWO: Ht.DOLLY_PAN
1185
1185
  }, this.controls3d = n(this.camera3d, this.renderer.domElement), this.controls3d.enablePan = !1, this.listen(this.controls2d, "change", () => this.requestRender()), this.listen(this.controls3d, "change", () => this.requestRender()), this.applyNavigationPolicy(this.navigationPolicyValue), this.initialized = !0, this.setViewMode(this.viewModeValue);
1186
1186
  }
1187
1187
  get isInitialized() {
@@ -1228,7 +1228,7 @@ class bs {
1228
1228
  this.viewerOrbit ?? (this.viewerOrbit = new qr()), this.viewerOrbit.attach(this);
1229
1229
  return;
1230
1230
  }
1231
- (t = this.viewerOrbit) == null || t.setEnabled(!1), (i = this.viewerOrbit) == null || i.dispose(), this.viewerOrbit = null, this.controls3d.enabled = e === "preview" && this.viewModeValue === "3d", e === "preview" && (ri(this.controls3d, this.camera3d, this.previewDragPreset), this.camera3d.position.copy(Yr), this.controls3d.target.copy(Wr), this.controls3d.update());
1231
+ (t = this.viewerOrbit) == null || t.setEnabled(!1), (i = this.viewerOrbit) == null || i.dispose(), this.viewerOrbit = null, this.controls3d.enabled = e === "preview" && this.viewModeValue === "3d", e === "preview" && (si(this.controls3d, this.camera3d, this.previewDragPreset), this.camera3d.position.copy(Yr), this.controls3d.target.copy(Wr), this.controls3d.update());
1232
1232
  }
1233
1233
  }
1234
1234
  /**
@@ -1237,7 +1237,7 @@ class bs {
1237
1237
  * handed to OrbitControls.
1238
1238
  */
1239
1239
  setPreviewDragPreset(e) {
1240
- this.previewDragPreset !== e && (this.previewDragPreset = e, !(!this.initialized || this.navigationPolicyValue !== "preview") && (ri(this.controls3d, this.camera3d, e), this.requestRender()));
1240
+ this.previewDragPreset !== e && (this.previewDragPreset = e, !(!this.initialized || this.navigationPolicyValue !== "preview") && (si(this.controls3d, this.camera3d, e), this.requestRender()));
1241
1241
  }
1242
1242
  /**
1243
1243
  * Drives OrbitControls once per frame. Damping mutates the camera inside
@@ -1259,7 +1259,7 @@ class bs {
1259
1259
  async setEnvironment(e) {
1260
1260
  var n;
1261
1261
  if (this.disposed || !this.renderer) return !1;
1262
- const t = ++this.environmentLoadGeneration, i = ((n = this.options.factories) == null ? void 0 : n.createEnvironment) ?? ai;
1262
+ const t = ++this.environmentLoadGeneration, i = ((n = this.options.factories) == null ? void 0 : n.createEnvironment) ?? oi;
1263
1263
  try {
1264
1264
  const s = await i(this.renderer, e), a = this.applyEnvironmentResource(s, t);
1265
1265
  return a && (this.environmentBackgroundCapable = e !== "room"), a;
@@ -1276,7 +1276,7 @@ class bs {
1276
1276
  setEnvironmentRotation(e) {
1277
1277
  var i;
1278
1278
  if (this.disposed || !Number.isFinite(e)) return !1;
1279
- const t = oi(e);
1279
+ const t = li(e);
1280
1280
  return t === this.environmentRotationDegrees || (this.environmentRotationDegrees = t, this.applyEnvironmentRotations(), (i = this.hdrTransparentBackdrop) == null || i.setRotationDegrees(this.environmentRotationDegrees), this.requestRender()), !0;
1281
1281
  }
1282
1282
  getEnvironmentRotation() {
@@ -1322,7 +1322,7 @@ class bs {
1322
1322
  if (!this.mountedObjects.has(e) && e.parent !== this.scene) return !1;
1323
1323
  e.removeFromParent(), this.mountedObjects.delete(e), this.markTransmissionCachesDirty();
1324
1324
  const i = this.ownedObjects.delete(e);
1325
- return (t.dispose === !0 || t.dispose === void 0 && i) && Xt(e), this.requestRender(), !0;
1325
+ return (t.dispose === !0 || t.dispose === void 0 && i) && Kt(e), this.requestRender(), !0;
1326
1326
  }
1327
1327
  setObjectVisible(e, t) {
1328
1328
  e.visible !== t && (e.visible = t, this.markTransmissionCachesDirty(), this.requestRender());
@@ -1332,7 +1332,7 @@ class bs {
1332
1332
  }
1333
1333
  removeOverlay(e, t = {}) {
1334
1334
  const i = this.overlays.get(e);
1335
- return i ? (this.overlays.delete(e), i.object.removeFromParent(), (t.dispose === !0 || t.dispose === void 0 && i.owned) && Xt(i.object), this.requestRender(), i.object) : null;
1335
+ return i ? (this.overlays.delete(e), i.object.removeFromParent(), (t.dispose === !0 || t.dispose === void 0 && i.owned) && Kt(i.object), this.requestRender(), i.object) : null;
1336
1336
  }
1337
1337
  setHighlight(e, t = {}) {
1338
1338
  if (!e) {
@@ -1355,7 +1355,7 @@ class bs {
1355
1355
  if (!this.camera2d || !this.camera3d) return !1;
1356
1356
  const i = this.resolveBox3(e);
1357
1357
  if (!i || i.isEmpty()) return !1;
1358
- const n = i.getSize(new M()), s = i.getCenter(new M());
1358
+ const n = i.getSize(new R()), s = i.getCenter(new R());
1359
1359
  if (![n.x, n.y, n.z, s.x, s.y, s.z].every(Number.isFinite)) return !1;
1360
1360
  const a = Math.max(1, t.padding ?? 1.05);
1361
1361
  if ((t.viewMode ?? this.viewModeValue) === "2d") {
@@ -1369,7 +1369,7 @@ class bs {
1369
1369
  else {
1370
1370
  const l = s.clone(), d = this.camera3d.fov * Math.PI / 180, c = 2 * Math.atan(Math.tan(d / 2) * Math.max(this.camera3d.aspect, 1e-6)), p = Math.max(n.length() / 2, 1e-6), h = Math.max(Math.min(d, c) / 2, 1e-6), m = p / Math.sin(h) * a, f = this.camera3d.position.clone().sub(this.controls3d.target);
1371
1371
  f.lengthSq() <= 1e-12 && f.set(1, -1, 1), f.normalize(), this.controls3d.target.copy(l), this.camera3d.position.copy(l).addScaledVector(f, m), this.camera3d.lookAt(l), this.camera3d.near = Math.min(
1372
- si,
1372
+ ai,
1373
1373
  Math.max(m * 0.01, 1e-6)
1374
1374
  ), this.camera3d.updateProjectionMatrix(), this.controls3d.update();
1375
1375
  }
@@ -1434,11 +1434,11 @@ class bs {
1434
1434
  }
1435
1435
  applyPreviewOrbitSnapshot(e) {
1436
1436
  if (!this.camera3d || !this.controls3d) return !1;
1437
- const t = Math.cos(e.pitch), i = new M(e.targetX, e.targetY, e.targetZ), n = Y.clamp(
1437
+ const t = Math.cos(e.pitch), i = new R(e.targetX, e.targetY, e.targetZ), n = Y.clamp(
1438
1438
  e.distance,
1439
1439
  this.controls3d.minDistance,
1440
1440
  this.controls3d.maxDistance
1441
- ), s = new M(
1441
+ ), s = new R(
1442
1442
  i.x + n * Math.cos(e.yaw) * t,
1443
1443
  i.y + n * Math.sin(e.yaw) * t,
1444
1444
  i.z + n * Math.sin(e.pitch)
@@ -1471,36 +1471,36 @@ class bs {
1471
1471
  };
1472
1472
  }
1473
1473
  renderOrthographicPreview(e, t, i) {
1474
- var D;
1474
+ var T;
1475
1475
  if (!this.renderer || this.disposed || t.parent || !xs(i)) return !1;
1476
- const n = Math.max(1, Math.floor(e.clientWidth || e.width || 0)), s = Math.max(1, Math.floor(e.clientHeight || e.height || 0)), a = this.resolveRendererPixelRatio(), o = Math.min(2, a), l = Math.max(1, Math.floor(n * o)), d = Math.max(1, Math.floor(s * o)), c = l / a, p = d / a, h = Math.min(c, p), m = (i.minX + i.maxX) / 2, f = (i.minY + i.maxY) / 2, y = Math.max(i.maxX - i.minX, i.maxY - i.minY, 1) * ps / 2, v = this.getOrCreatePreviewRenderTarget(l, d), g = this.getOrCreatePreviewCamera();
1477
- g.left = -y, g.right = y, g.top = y, g.bottom = -y, g.position.set(m, f, 1), g.up.copy(((D = this.camera2d) == null ? void 0 : D.up) ?? new M(0, 1, 0)), g.lookAt(m, f, 0), g.updateProjectionMatrix(), g.updateMatrixWorld(!0);
1478
- const w = this.getOrCreatePreviewScene(), x = this.renderer, C = x.getRenderTarget(), k = x.getClearAlpha(), E = x.autoClear, P = new $n();
1479
- x.getViewport(P);
1480
- const I = x.getScissorTest();
1476
+ const n = Math.max(1, Math.floor(e.clientWidth || e.width || 0)), s = Math.max(1, Math.floor(e.clientHeight || e.height || 0)), a = this.resolveRendererPixelRatio(), o = Math.min(2, a), l = Math.max(1, Math.floor(n * o)), d = Math.max(1, Math.floor(s * o)), c = l / a, p = d / a, h = Math.min(c, p), m = (i.minX + i.maxX) / 2, f = (i.minY + i.maxY) / 2, b = Math.max(i.maxX - i.minX, i.maxY - i.minY, 1) * ps / 2, x = this.getOrCreatePreviewRenderTarget(l, d), v = this.getOrCreatePreviewCamera();
1477
+ v.left = -b, v.right = b, v.top = b, v.bottom = -b, v.position.set(m, f, 1), v.up.copy(((T = this.camera2d) == null ? void 0 : T.up) ?? new R(0, 1, 0)), v.lookAt(m, f, 0), v.updateProjectionMatrix(), v.updateMatrixWorld(!0);
1478
+ const w = this.getOrCreatePreviewScene(), y = this.renderer, C = y.getRenderTarget(), k = y.getClearAlpha(), E = y.autoClear, P = new $n();
1479
+ y.getViewport(P);
1480
+ const D = y.getScissorTest();
1481
1481
  w.add(t);
1482
1482
  try {
1483
- x.setRenderTarget(v), x.setViewport(0, 0, c, p), x.setScissorTest(!1), x.setClearAlpha(0), x.autoClear = !1, x.clear(), x.setViewport(
1483
+ y.setRenderTarget(x), y.setViewport(0, 0, c, p), y.setScissorTest(!1), y.setClearAlpha(0), y.autoClear = !1, y.clear(), y.setViewport(
1484
1484
  Math.floor((c - h) / 2),
1485
1485
  Math.floor((p - h) / 2),
1486
1486
  h,
1487
1487
  h
1488
- ), x.render(w, g);
1489
- const S = this.getOrCreatePreviewPixelBuffer(l, d);
1490
- return x.readRenderTargetPixels(v, 0, 0, l, d, S), this.blitPreviewPixelsToCanvas(e, S, l, d);
1488
+ ), y.render(w, v);
1489
+ const M = this.getOrCreatePreviewPixelBuffer(l, d);
1490
+ return y.readRenderTargetPixels(x, 0, 0, l, d, M), this.blitPreviewPixelsToCanvas(e, M, l, d);
1491
1491
  } finally {
1492
- t.removeFromParent(), x.setRenderTarget(C), x.setClearAlpha(k), x.autoClear = E, x.setViewport(
1492
+ t.removeFromParent(), y.setRenderTarget(C), y.setClearAlpha(k), y.autoClear = E, y.setViewport(
1493
1493
  P.x,
1494
1494
  P.y,
1495
1495
  P.z,
1496
1496
  P.w
1497
- ), x.setScissorTest(I), this.requestRender();
1497
+ ), y.setScissorTest(D), this.requestRender();
1498
1498
  }
1499
1499
  }
1500
1500
  bindRuntimeEvent(e, t, i, n) {
1501
1501
  this.listen(e, t, i, n);
1502
1502
  }
1503
- clientToNdc(e, t, i = new J()) {
1503
+ clientToNdc(e, t, i = new Z()) {
1504
1504
  var a;
1505
1505
  const n = (a = this.renderer) == null ? void 0 : a.domElement;
1506
1506
  if (!n) return null;
@@ -1512,9 +1512,9 @@ class bs {
1512
1512
  }
1513
1513
  screenToWorldOnPlane(e, t, i = 0) {
1514
1514
  const n = this.clientToNdc(e, t, this.pointerNdc);
1515
- return !n || !this.activeCamera ? null : (this.raycaster.setFromCamera(n, this.activeCamera), this.raycaster.ray.intersectPlane(new cn(new M(0, 0, 1), -i), new M()));
1515
+ return !n || !this.activeCamera ? null : (this.raycaster.setFromCamera(n, this.activeCamera), this.raycaster.ray.intersectPlane(new cn(new R(0, 0, 1), -i), new R()));
1516
1516
  }
1517
- worldToClient(e, t = new J()) {
1517
+ worldToClient(e, t = new Z()) {
1518
1518
  var a;
1519
1519
  const i = (a = this.renderer) == null ? void 0 : a.domElement;
1520
1520
  if (!i || !this.activeCamera) return null;
@@ -1555,7 +1555,7 @@ class bs {
1555
1555
  if (this.disposed || this.animationLoopActive) return;
1556
1556
  this.animationLoopActive = !0, this.infoFrames = 0, this.infoLastTime = performance.now();
1557
1557
  const t = e.infoUpdateIntervalMs ?? ls, i = (n = performance.now()) => {
1558
- var o, l, d, c, p, h, m, f, b;
1558
+ var o, l, d, c, p, h, m, f, g;
1559
1559
  if (!this.animationLoopActive || this.disposed) {
1560
1560
  this.animationFrameId = null;
1561
1561
  return;
@@ -1566,18 +1566,18 @@ class bs {
1566
1566
  let a = !1;
1567
1567
  if (this.renderRequested && (((c = e.shouldRender) == null ? void 0 : c.call(e, n)) ?? !0)) {
1568
1568
  (p = e.beforeRender) == null || p.call(e, n);
1569
- const y = (h = e.renderExtension) == null ? void 0 : h.beforeRender(this.renderer, this.scene, this.activeCamera, n);
1569
+ const b = (h = e.renderExtension) == null ? void 0 : h.beforeRender(this.renderer, this.scene, this.activeCamera, n);
1570
1570
  try {
1571
1571
  this.renderScene();
1572
1572
  } finally {
1573
- y == null || y();
1573
+ b == null || b();
1574
1574
  }
1575
1575
  this.renderRequested = !1, a = !0, (m = e.afterRender) == null || m.call(e, n);
1576
1576
  }
1577
1577
  if (this.infoFrames += 1, n - this.infoLastTime >= t) {
1578
- const y = Math.max(1, n - this.infoLastTime);
1579
- this.fpsCurrent = this.infoFrames * 1e3 / y, this.infoFrames = 0, this.infoLastTime = n, (f = e.onInfoUpdate) == null || f.call(e);
1580
- } else a && ((b = e.onInfoUpdate) == null || b.call(e));
1578
+ const b = Math.max(1, n - this.infoLastTime);
1579
+ this.fpsCurrent = this.infoFrames * 1e3 / b, this.infoFrames = 0, this.infoLastTime = n, (f = e.onInfoUpdate) == null || f.call(e);
1580
+ } else a && ((g = e.onInfoUpdate) == null || g.call(e));
1581
1581
  };
1582
1582
  i();
1583
1583
  }
@@ -1593,7 +1593,7 @@ class bs {
1593
1593
  o
1594
1594
  );
1595
1595
  }
1596
- const t = this.environmentBackgroundVisible && this.scene.environment instanceof ot && this.scene.environment.mapping === Me, i = this.options.transparentHdrBackdrop === !0 && !t, n = this.scene.background;
1596
+ const t = this.environmentBackgroundVisible && this.scene.environment instanceof lt && this.scene.environment.mapping === Me, i = this.options.transparentHdrBackdrop === !0 && !t, n = this.scene.background;
1597
1597
  t && (this.scene.background = this.scene.environment);
1598
1598
  try {
1599
1599
  if (i && !e && !this.transmissionHdrBackdropFailed)
@@ -1668,7 +1668,7 @@ class bs {
1668
1668
  return this.previewScene || (this.previewScene = new $e()), this.previewScene;
1669
1669
  }
1670
1670
  getOrCreatePreviewCamera() {
1671
- return this.previewCamera || (this.previewCamera = new St(-1, 1, 1, -1, -1e6, 1e6)), this.previewCamera;
1671
+ return this.previewCamera || (this.previewCamera = new Pt(-1, 1, 1, -1, -1e6, 1e6)), this.previewCamera;
1672
1672
  }
1673
1673
  getOrCreatePreviewRenderTarget(e, t) {
1674
1674
  var i;
@@ -1705,10 +1705,10 @@ class bs {
1705
1705
  return typeof e != "number" || !Number.isFinite(e) || e <= 0 ? 1 : Math.min(e, ds);
1706
1706
  }
1707
1707
  resolveBox3(e) {
1708
- if (e instanceof Z) return e.clone();
1709
- if (e instanceof an) return new Z().setFromObject(e);
1708
+ if (e instanceof Q) return e.clone();
1709
+ if (e instanceof an) return new Q().setFromObject(e);
1710
1710
  const { minX: t, minY: i, maxX: n, maxY: s } = e;
1711
- return ![t, i, n, s].every(Number.isFinite) || n < t || s < i ? null : new Z(new M(t, i, 0), new M(n, s, 0));
1711
+ return ![t, i, n, s].every(Number.isFinite) || n < t || s < i ? null : new Q(new R(t, i, 0), new R(n, s, 0));
1712
1712
  }
1713
1713
  isDescendantOf(e, t) {
1714
1714
  let i = e.parent;
@@ -1725,7 +1725,7 @@ class bs {
1725
1725
  });
1726
1726
  }
1727
1727
  }
1728
- function ai(r, e) {
1728
+ function oi(r, e) {
1729
1729
  if (e === "room") {
1730
1730
  const t = new Bn(r), i = new Zn(), n = t.fromScene(i);
1731
1731
  return i.dispose(), t.dispose(), {
@@ -1735,7 +1735,7 @@ function ai(r, e) {
1735
1735
  }
1736
1736
  if (e.url.trim().length === 0)
1737
1737
  throw new Error("Scene environment requires a non-empty URL.");
1738
- return e.type === "image" ? new un().loadAsync(e.url).then((t) => (t.mapping = Me, t.colorSpace = Ft, {
1738
+ return e.type === "image" ? new un().loadAsync(e.url).then((t) => (t.mapping = Me, t.colorSpace = zt, {
1739
1739
  texture: t,
1740
1740
  dispose: () => t.dispose()
1741
1741
  })) : new hn().loadAsync(e.url).then((t) => (t.mapping = Me, {
@@ -1746,7 +1746,7 @@ function ai(r, e) {
1746
1746
  function ys(r) {
1747
1747
  return typeof (r == null ? void 0 : r.then) == "function";
1748
1748
  }
1749
- function oi(r) {
1749
+ function li(r) {
1750
1750
  if (!Number.isFinite(r)) return 0;
1751
1751
  const e = r % 360;
1752
1752
  return e < 0 ? e + 360 : e;
@@ -1754,12 +1754,12 @@ function oi(r) {
1754
1754
  function xs(r) {
1755
1755
  return Number.isFinite(r.minX) && Number.isFinite(r.minY) && Number.isFinite(r.maxX) && Number.isFinite(r.maxY) && r.maxX >= r.minX && r.maxY >= r.minY;
1756
1756
  }
1757
- const zt = 1, ws = 1024, Cs = 16, Es = 1e9;
1757
+ const $t = 1, ws = 1024, Cs = 16, Es = 1e9;
1758
1758
  function ks() {
1759
1759
  return typeof globalThis.localStorage > "u" ? Ss() : {
1760
1760
  read(r) {
1761
1761
  try {
1762
- const e = globalThis.localStorage.getItem(li(r));
1762
+ const e = globalThis.localStorage.getItem(di(r));
1763
1763
  return e ? JSON.parse(e) : null;
1764
1764
  } catch {
1765
1765
  return null;
@@ -1767,7 +1767,7 @@ function ks() {
1767
1767
  },
1768
1768
  write(r, e) {
1769
1769
  try {
1770
- globalThis.localStorage.setItem(li(r), JSON.stringify(e));
1770
+ globalThis.localStorage.setItem(di(r), JSON.stringify(e));
1771
1771
  } catch {
1772
1772
  }
1773
1773
  }
@@ -1787,12 +1787,12 @@ function Ss() {
1787
1787
  function Ps(r, e) {
1788
1788
  if (!r || !e) return null;
1789
1789
  const t = r.read(e);
1790
- return $t(t) ? t : null;
1790
+ return Vt(t) ? t : null;
1791
1791
  }
1792
- function $t(r) {
1792
+ function Vt(r) {
1793
1793
  if (!r || typeof r != "object") return !1;
1794
1794
  const e = r;
1795
- if (e.schemaVersion !== zt) return !1;
1795
+ if (e.schemaVersion !== $t) return !1;
1796
1796
  if (e.viewMode === "2d") {
1797
1797
  const t = e.orthographic;
1798
1798
  return !t || ![
@@ -1825,14 +1825,14 @@ function Ms(r, e, t) {
1825
1825
  }
1826
1826
  function Rs(r) {
1827
1827
  return {
1828
- schemaVersion: zt,
1828
+ schemaVersion: $t,
1829
1829
  viewMode: r.viewMode,
1830
1830
  ...r.orthographic ? { orthographic: r.orthographic } : {},
1831
1831
  ...r.orbit ? { orbit: r.orbit } : {}
1832
1832
  };
1833
1833
  }
1834
1834
  function As(r, e) {
1835
- if (!$t(r)) return null;
1835
+ if (!Vt(r)) return null;
1836
1836
  const t = Is(e);
1837
1837
  if (r.viewMode === "2d") {
1838
1838
  const n = r.orthographic;
@@ -1860,13 +1860,13 @@ function Ds(r, e, t) {
1860
1860
  const n = i * Cs;
1861
1861
  return r >= t.minX - n && r <= t.maxX + n && e >= t.minY - n && e <= t.maxY + n;
1862
1862
  }
1863
- function li(r) {
1864
- return `nebula-viewer:camera:v${zt}:${r}`;
1863
+ function di(r) {
1864
+ return `nebula-viewer:camera:v${$t}:${r}`;
1865
1865
  }
1866
1866
  function Ie(r) {
1867
- return new Z(
1868
- new M(r.minX, r.minY, r.minZ),
1869
- new M(r.maxX, r.maxY, r.maxZ)
1867
+ return new Q(
1868
+ new R(r.minX, r.minY, r.minZ),
1869
+ new R(r.maxX, r.maxY, r.maxZ)
1870
1870
  );
1871
1871
  }
1872
1872
  function gn(r) {
@@ -2096,7 +2096,7 @@ function $s(r, e) {
2096
2096
  }
2097
2097
  return `${r.toFixed(2)}${e ? ` ${e}` : ""}`;
2098
2098
  }
2099
- function di(r) {
2099
+ function ci(r) {
2100
2100
  return {
2101
2101
  documentKey: r.documentKey,
2102
2102
  filename: r.filename,
@@ -2108,7 +2108,7 @@ function di(r) {
2108
2108
  units: r.units ?? { source: "mm" }
2109
2109
  };
2110
2110
  }
2111
- const Vs = 160, ci = 5e3;
2111
+ const Vs = 160, ui = 5e3;
2112
2112
  class Bs {
2113
2113
  constructor(e) {
2114
2114
  u(this, "layers", new Ts());
@@ -2240,7 +2240,7 @@ class Bs {
2240
2240
  name: "AbortError",
2241
2241
  code: "E_SUPERSEDED"
2242
2242
  });
2243
- return this.layers.sync(s, !1), this.blocks.sync(s, !1), this.syncHud(t.filename ?? o.filename ?? null), this.initialCameraRestored = this.tryRestoreCamera(n, o.bounds), !this.initialCameraRestored && o.bounds && this.host.fitBox3(Ie(o.bounds)), this.cameraSettled = !0, this.syncDisplayContext(), this.document = di({
2243
+ return this.layers.sync(s, !1), this.blocks.sync(s, !1), this.syncHud(t.filename ?? o.filename ?? null), this.initialCameraRestored = this.tryRestoreCamera(n, o.bounds), !this.initialCameraRestored && o.bounds && this.host.fitBox3(Ie(o.bounds)), this.cameraSettled = !0, this.syncDisplayContext(), this.document = ci({
2244
2244
  documentKey: n,
2245
2245
  filename: t.filename ?? o.filename ?? null,
2246
2246
  phase: s.phase === "interactive" && !this.initialDemandSettled ? "initial-loading" : s.phase,
@@ -2376,7 +2376,7 @@ class Bs {
2376
2376
  }
2377
2377
  select(e) {
2378
2378
  var t, i, n;
2379
- this.assertActive(), e ? !this.document || !this.session || e.selection.documentKey !== this.document.documentKey ? this.clearSelection() : e.kind === "insert" ? this.setInsertSelection(e.selection, ((t = this.session) == null ? void 0 : t.getBlockDetails(qt(e.selection.id))) ?? null) : this.setTextSelectionInternal(e.selection, ((n = (i = this.session) == null ? void 0 : i.getTextDetails) == null ? void 0 : n.call(i, e.selection.id)) ?? null) : this.clearSelection();
2379
+ this.assertActive(), e ? !this.document || !this.session || e.selection.documentKey !== this.document.documentKey ? this.clearSelection() : e.kind === "insert" ? this.setInsertSelection(e.selection, ((t = this.session) == null ? void 0 : t.getBlockDetails(Yt(e.selection.id))) ?? null) : this.setTextSelectionInternal(e.selection, ((n = (i = this.session) == null ? void 0 : i.getTextDetails) == null ? void 0 : n.call(i, e.selection.id)) ?? null) : this.clearSelection();
2380
2380
  }
2381
2381
  clearSelection() {
2382
2382
  this.assertActive(), !(!this.inspector.selection && !this.inspector.textSelection) && (this.inspector.clear(), this.emit("inspector-change", { inspector: this.inspector }));
@@ -2411,8 +2411,8 @@ class Bs {
2411
2411
  if (!e) return !1;
2412
2412
  let { minX: t, minY: i, maxX: n, maxY: s } = e;
2413
2413
  const a = n - t, o = s - i, l = Math.max(a, o);
2414
- if (a > 0 && o > 0 && l < ci) {
2415
- const c = (t + n) / 2, p = (i + s) / 2, h = ci / 2;
2414
+ if (a > 0 && o > 0 && l < ui) {
2415
+ const c = (t + n) / 2, p = (i + s) / 2, h = ui / 2;
2416
2416
  t = c - h, i = p - h, n = c + h, s = p + h;
2417
2417
  }
2418
2418
  return this.host.fitBox3(Ie({
@@ -2427,7 +2427,7 @@ class Bs {
2427
2427
  refreshInspectorDetails(e) {
2428
2428
  const t = this.inspector.selection;
2429
2429
  if (!t) return;
2430
- const i = e.getBlockDetails(qt(t.id));
2430
+ const i = e.getBlockDetails(Yt(t.id));
2431
2431
  if (!i) return;
2432
2432
  const n = this.inspector.details, s = n == null ? void 0 : n.bbox;
2433
2433
  (s == null ? void 0 : s.minX) === i.bbox.minX && (s == null ? void 0 : s.minY) === i.bbox.minY && (s == null ? void 0 : s.maxX) === i.bbox.maxX && (s == null ? void 0 : s.maxY) === i.bbox.maxY || (this.inspector.setSelection(t, i), this.emit("inspector-change", { inspector: this.inspector }));
@@ -2509,7 +2509,7 @@ class Bs {
2509
2509
  });
2510
2510
  }
2511
2511
  publishDocumentPhase(e) {
2512
- this.document && (this.document = di({
2512
+ this.document && (this.document = ci({
2513
2513
  documentKey: this.document.documentKey,
2514
2514
  filename: this.document.filename,
2515
2515
  phase: e,
@@ -2558,7 +2558,7 @@ function Le(r, e, t) {
2558
2558
  const i = r.code, n = r.name, s = r.message.toLowerCase(), a = /external block|sidecar|variant .*fetch/.test(s), o = /annotation/.test(s), l = /font|troika/.test(s), d = i === "E_SUPERSEDED" ? "E_SUPERSEDED" : n === "AbortError" || i === "E_DISPOSED" ? "E_ABORTED" : a ? "E_SIDECAR_FETCH" : o ? "E_ANNOTATION" : l ? "E_FONT" : i === "E_SOURCE" ? "E_SOURCE" : i === "E_PACK_HTTP" || i === "E_PACK_NETWORK" ? "E_FETCH" : i === "E_HEADER" || i === "E_HEADER_JSON" || i === "E_UNSUPPORTED_PACK_VERSION" ? "E_PARSE_HEADER" : i === "E_WORKER" || i === "E_MAIN_BUFFER_PROTOCOL" || i === "E_MAIN_BUFFER_MISSING" || /worker/.test(s) ? "E_WORKER" : "E_PARSE_GEOMETRY";
2559
2559
  return { code: d, stage: d === "E_FETCH" ? "source" : d === "E_PARSE_HEADER" ? "header" : d === "E_WORKER" ? "worker" : d === "E_PARSE_GEOMETRY" ? "geometry" : d === "E_SIDECAR_FETCH" ? "sidecar" : d === "E_ANNOTATION" ? "annotation" : d === "E_FONT" ? "font" : d === "E_ABORTED" || d === "E_SUPERSEDED" ? "lifecycle" : "source", fatal: e, source: t };
2560
2560
  }
2561
- const ui = 1;
2561
+ const hi = 1;
2562
2562
  class Ws {
2563
2563
  constructor(e) {
2564
2564
  u(this, "startX", 0);
@@ -2604,10 +2604,10 @@ class Ws {
2604
2604
  this.release(), this.resetMotion(), this.startX = 0, this.startY = 0, this.lastX = 0, this.lastY = 0;
2605
2605
  }
2606
2606
  isTrackingPrimaryPointer(e) {
2607
- return this.primaryPointerDown || (e & ui) === ui;
2607
+ return this.primaryPointerDown || (e & hi) === hi;
2608
2608
  }
2609
2609
  }
2610
- function Mt(r, e) {
2610
+ function Rt(r, e) {
2611
2611
  return `${r}:${e}`;
2612
2612
  }
2613
2613
  class Gs {
@@ -2630,7 +2630,7 @@ class Gs {
2630
2630
  this.expandedLayers.has(e) ? this.expandedLayers.delete(e) : this.expandedLayers.add(e), this.suppressedSelectionKey = null;
2631
2631
  }
2632
2632
  toggleBlockExpanded(e, t) {
2633
- const i = Mt(e, t);
2633
+ const i = Rt(e, t);
2634
2634
  this.expandedBlocks.has(i) ? this.expandedBlocks.delete(i) : this.expandedBlocks.add(i), this.suppressedSelectionKey = null;
2635
2635
  }
2636
2636
  prune(e, t) {
@@ -2642,7 +2642,7 @@ class Gs {
2642
2642
  t.has(i) || this.blockVisibilitySnapshots.delete(i);
2643
2643
  }
2644
2644
  ensureSelectionVisible(e, t, i) {
2645
- this.suppressedSelectionKey !== e && (this.suppressedSelectionKey !== null && (this.suppressedSelectionKey = null), this.expandedLayers.add(t), this.expandedBlocks.add(Mt(t, i)));
2645
+ this.suppressedSelectionKey !== e && (this.suppressedSelectionKey !== null && (this.suppressedSelectionKey = null), this.expandedLayers.add(t), this.expandedBlocks.add(Rt(t, i)));
2646
2646
  }
2647
2647
  needsSelectionReveal(e) {
2648
2648
  return this.revealedSelectionKey !== e;
@@ -2654,7 +2654,7 @@ class Gs {
2654
2654
  this.revealedSelectionKey = null, this.suppressedSelectionKey = null;
2655
2655
  }
2656
2656
  }
2657
- function H(r) {
2657
+ function U(r) {
2658
2658
  return r.replace(/[&<>"']/g, (e) => ({
2659
2659
  "&": "&amp;",
2660
2660
  "<": "&lt;",
@@ -2894,11 +2894,11 @@ function ta(r, e) {
2894
2894
  const t = r.trim(), i = ea[t];
2895
2895
  return i ? e.t(i) : t;
2896
2896
  }
2897
- const Vt = yn({});
2897
+ const Bt = yn({});
2898
2898
  function ia(r) {
2899
2899
  const e = /* @__PURE__ */ new Map();
2900
2900
  for (const i of r.usages) {
2901
- const n = e.get(i.layerIndex) ?? /* @__PURE__ */ new Map(), s = Mt(i.layerIndex, i.variantId);
2901
+ const n = e.get(i.layerIndex) ?? /* @__PURE__ */ new Map(), s = Rt(i.layerIndex, i.variantId);
2902
2902
  let a = n.get(s);
2903
2903
  a || (a = {
2904
2904
  key: s,
@@ -2939,7 +2939,7 @@ function xn(r, e, t, i) {
2939
2939
  const n = r.id;
2940
2940
  return n.layerIndex !== e || n.variantId !== t ? !1 : i === void 0 ? !0 : n.instanceId === i;
2941
2941
  }
2942
- function hi(r) {
2942
+ function pi(r) {
2943
2943
  const e = r.querySelector(".vui-lrow-insert.active") ?? r.querySelector(".vui-lrow-block.active");
2944
2944
  if (!e) return !1;
2945
2945
  const t = r.getBoundingClientRect(), i = e.getBoundingClientRect();
@@ -2989,14 +2989,14 @@ function aa(r, e) {
2989
2989
  );
2990
2990
  a && a.classList.add("active");
2991
2991
  }
2992
- function oa(r, e, t, i = Vt) {
2992
+ function oa(r, e, t, i = Bt) {
2993
2993
  var l;
2994
2994
  const n = new Map(e.map((d) => [d.index, d]));
2995
2995
  r.querySelectorAll(".vui-lrow[data-layer-index]:not(.vui-lrow-all)").forEach((d) => {
2996
2996
  const c = n.get(Number(d.dataset.layerIndex));
2997
2997
  if (!c) return;
2998
2998
  const p = d.querySelector(".vui-lrow-eye");
2999
- p && (p.textContent = c.visible ? "●" : "○", p.title = c.visible ? i.t("layer.hide") : i.t("layer.show")), d.classList.toggle("off", !c.visible), Cn(d, Bt(c));
2999
+ p && (p.textContent = c.visible ? "●" : "○", p.title = c.visible ? i.t("layer.hide") : i.t("layer.show")), d.classList.toggle("off", !c.visible), Cn(d, Ut(c));
3000
3000
  });
3001
3001
  const s = r.querySelector(".vui-lrow-all"), a = t === null ? "#c8c8c8" : Re(t);
3002
3002
  (l = s == null ? void 0 : s.querySelector(".vui-lrow-clr")) == null || l.style.setProperty("background", a);
@@ -3005,7 +3005,7 @@ function oa(r, e, t, i = Vt) {
3005
3005
  }
3006
3006
  function la(r, e, t) {
3007
3007
  var f;
3008
- const i = t.text ?? Vt;
3008
+ const i = t.text ?? Bt;
3009
3009
  e.resetForScope(t.scopeKey);
3010
3010
  const n = e.filterText.trim().toLowerCase(), s = t.layers.rows, a = ia(t.blocks);
3011
3011
  if (r.list.replaceChildren(), r.count.textContent = String(s.length), s.length === 0) {
@@ -3013,9 +3013,9 @@ function la(r, e, t) {
3013
3013
  return;
3014
3014
  }
3015
3015
  const o = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set();
3016
- for (const b of s) {
3017
- o.add(b.index);
3018
- for (const y of a.get(b.index) ?? []) l.add(y.key);
3016
+ for (const g of s) {
3017
+ o.add(g.index);
3018
+ for (const b of a.get(g.index) ?? []) l.add(b.key);
3019
3019
  }
3020
3020
  e.prune(o, l);
3021
3021
  const d = (f = t.selection) == null ? void 0 : f.id, c = d ? `${d.layerIndex}:${d.variantId}:${d.instanceId}` : null;
@@ -3025,41 +3025,41 @@ function la(r, e, t) {
3025
3025
  <span class="vui-lrow-eye">◎</span>
3026
3026
  <span class="vui-lrow-dot"></span>
3027
3027
  <span class="vui-lrow-toggle placeholder">▶</span>
3028
- <span class="vui-lrow-name">${H(i.t("layer.all"))}</span>
3029
- <span class="vui-lrow-clr" style="background: ${t.layers.allColor == null ? "#c8c8c8" : `#${t.layers.allColor.toString(16).padStart(6, "0")}`}" title="${H(i.t("layer.colorOverrideAll"))}">
3028
+ <span class="vui-lrow-name">${U(i.t("layer.all"))}</span>
3029
+ <span class="vui-lrow-clr" style="background: ${t.layers.allColor == null ? "#c8c8c8" : `#${t.layers.allColor.toString(16).padStart(6, "0")}`}" title="${U(i.t("layer.colorOverrideAll"))}">
3030
3030
  <input type="color" value="#${(t.layers.allColor ?? 13158600).toString(16).padStart(6, "0")}">
3031
3031
  </span>`;
3032
3032
  const h = p.querySelector('input[type="color"]');
3033
3033
  h && h.addEventListener("input", () => {
3034
- var v, g, w;
3035
- const b = Number.parseInt(h.value.slice(1), 16), y = Number.isFinite(b) ? b : null;
3036
- (v = t.beginLayerColorPreview) == null || v.call(t, h);
3034
+ var x, v, w;
3035
+ const g = Number.parseInt(h.value.slice(1), 16), b = Number.isFinite(g) ? g : null;
3036
+ (x = t.beginLayerColorPreview) == null || x.call(t, h);
3037
3037
  try {
3038
- if (t.setAllLayerColor) t.setAllLayerColor(y);
3039
- else for (const C of s) t.setLayerColor(C.index, y);
3040
- const x = y === null ? "#c8c8c8" : Re(y);
3041
- (g = h.closest(".vui-lrow-clr")) == null || g.style.setProperty("background", x), pi(r.list, s, y);
3038
+ if (t.setAllLayerColor) t.setAllLayerColor(b);
3039
+ else for (const C of s) t.setLayerColor(C.index, b);
3040
+ const y = b === null ? "#c8c8c8" : Re(b);
3041
+ (v = h.closest(".vui-lrow-clr")) == null || v.style.setProperty("background", y), mi(r.list, s, b);
3042
3042
  } finally {
3043
3043
  (w = t.endLayerColorPreview) == null || w.call(t, h);
3044
3044
  }
3045
- }), h == null || h.addEventListener("click", (b) => b.stopPropagation());
3045
+ }), h == null || h.addEventListener("click", (g) => g.stopPropagation());
3046
3046
  const m = p.querySelector(".vui-lrow-clr");
3047
- m && m.addEventListener("contextmenu", (b) => {
3048
- var y;
3049
- if (b.preventDefault(), b.stopPropagation(), t.setAllLayerColor) t.setAllLayerColor(null);
3050
- else for (const v of s) t.setLayerColor(v.index, null);
3051
- (y = h == null ? void 0 : h.closest(".vui-lrow-clr")) == null || y.style.setProperty("background", "#c8c8c8"), h && (h.value = "#c8c8c8"), pi(r.list, s, null);
3047
+ m && m.addEventListener("contextmenu", (g) => {
3048
+ var b;
3049
+ if (g.preventDefault(), g.stopPropagation(), t.setAllLayerColor) t.setAllLayerColor(null);
3050
+ else for (const x of s) t.setLayerColor(x.index, null);
3051
+ (b = h == null ? void 0 : h.closest(".vui-lrow-clr")) == null || b.style.setProperty("background", "#c8c8c8"), h && (h.value = "#c8c8c8"), mi(r.list, s, null);
3052
3052
  }), r.list.appendChild(p);
3053
- for (const b of s)
3054
- na(n, b.name) && r.list.appendChild(da(b, e, t, a.get(b.index) ?? [], i));
3055
- c && e.needsSelectionReveal(c) && (hi(r.list) && e.markSelectionRevealed(c), typeof requestAnimationFrame == "function" && requestAnimationFrame(() => {
3056
- e.needsSelectionReveal(c) && hi(r.list) && e.markSelectionRevealed(c);
3053
+ for (const g of s)
3054
+ na(n, g.name) && r.list.appendChild(da(g, e, t, a.get(g.index) ?? [], i));
3055
+ c && e.needsSelectionReveal(c) && (pi(r.list) && e.markSelectionRevealed(c), typeof requestAnimationFrame == "function" && requestAnimationFrame(() => {
3056
+ e.needsSelectionReveal(c) && pi(r.list) && e.markSelectionRevealed(c);
3057
3057
  }));
3058
3058
  }
3059
3059
  function Re(r) {
3060
3060
  return `#${r.toString(16).padStart(6, "0")}`;
3061
3061
  }
3062
- function Bt(r) {
3062
+ function Ut(r) {
3063
3063
  return r.color !== null ? Re(r.color) : Re(gn(r.sourceColor));
3064
3064
  }
3065
3065
  function Cn(r, e) {
@@ -3070,83 +3070,83 @@ function Cn(r, e) {
3070
3070
  const i = r.querySelector('input[type="color"]');
3071
3071
  i && i.value !== e && (i.value = e);
3072
3072
  }
3073
- function pi(r, e, t) {
3073
+ function mi(r, e, t) {
3074
3074
  const i = new Map(e.map((n) => [n.index, n]));
3075
3075
  r.querySelectorAll(".vui-lrow[data-layer-index]").forEach((n) => {
3076
3076
  const s = i.get(Number(n.dataset.layerIndex));
3077
- s && Cn(n, t === null ? Bt(s) : Re(t));
3077
+ s && Cn(n, t === null ? Ut(s) : Re(t));
3078
3078
  });
3079
3079
  }
3080
3080
  function da(r, e, t, i, n) {
3081
- const s = i.length > 0, a = e.expandedLayers.has(r.index), o = Bt(r), l = document.createElement("div");
3081
+ const s = i.length > 0, a = e.expandedLayers.has(r.index), o = Ut(r), l = document.createElement("div");
3082
3082
  l.className = "vui-lrow-wrap";
3083
3083
  const d = document.createElement("div");
3084
3084
  d.className = `vui-lrow${r.visible ? "" : " off"}`, d.dataset.layerIndex = String(r.index);
3085
3085
  const c = document.createElement("button");
3086
- c.type = "button", c.className = "vui-lrow-eye", c.textContent = r.visible ? "●" : "○", c.title = r.visible ? n.t("layer.hide") : n.t("layer.show"), c.addEventListener("click", (v) => {
3087
- v.stopPropagation();
3088
- const g = !r.visible;
3089
- c.textContent = g ? "●" : "○", c.title = g ? n.t("layer.hide") : n.t("layer.show"), d.classList.toggle("off", !g), t.toggleLayer(r.index);
3086
+ c.type = "button", c.className = "vui-lrow-eye", c.textContent = r.visible ? "●" : "○", c.title = r.visible ? n.t("layer.hide") : n.t("layer.show"), c.addEventListener("click", (x) => {
3087
+ x.stopPropagation();
3088
+ const v = !r.visible;
3089
+ c.textContent = v ? "●" : "○", c.title = v ? n.t("layer.hide") : n.t("layer.show"), d.classList.toggle("off", !v), t.toggleLayer(r.index);
3090
3090
  });
3091
3091
  const p = document.createElement("span");
3092
3092
  p.className = "vui-lrow-dot", p.style.background = o;
3093
3093
  const h = document.createElement("button");
3094
3094
  h.type = "button", h.className = `vui-lrow-toggle${s ? "" : " placeholder"}`, h.textContent = a ? "▼" : "▶", h.disabled = !s;
3095
- const m = (v) => {
3096
- if (v.stopPropagation(), !s) return;
3095
+ const m = (x) => {
3096
+ if (x.stopPropagation(), !s) return;
3097
3097
  e.toggleLayerExpanded(r.index);
3098
- const g = e.expandedLayers.has(r.index);
3099
- h.textContent = g ? "▼" : "▶";
3098
+ const v = e.expandedLayers.has(r.index);
3099
+ h.textContent = v ? "▼" : "▶";
3100
3100
  let w = l.querySelector(":scope > .vui-lrow-blocks");
3101
- if (g)
3101
+ if (v)
3102
3102
  if (w)
3103
3103
  w.classList.add("open");
3104
3104
  else {
3105
3105
  w = document.createElement("div"), w.className = "vui-lrow-blocks open";
3106
- for (const x of i)
3107
- w.appendChild(mi(x, e, t, n));
3106
+ for (const y of i)
3107
+ w.appendChild(fi(y, e, t, n));
3108
3108
  l.appendChild(w);
3109
3109
  }
3110
3110
  else {
3111
3111
  w == null || w.classList.remove("open");
3112
- const x = l.closest(".vui-section-list") ?? l.parentElement;
3113
- x && wn(x, d, 0);
3112
+ const y = l.closest(".vui-section-list") ?? l.parentElement;
3113
+ y && wn(y, d, 0);
3114
3114
  }
3115
3115
  };
3116
3116
  h.addEventListener("click", m);
3117
3117
  const f = document.createElement("span");
3118
3118
  f.className = "vui-lrow-name", f.textContent = r.name || n.t("layer.unnamed"), f.title = r.name;
3119
- const b = document.createElement("span");
3120
- b.className = "vui-lrow-clr", b.style.background = o, b.title = n.t("layer.colorOverride");
3121
- const y = document.createElement("input");
3122
- if (y.type = "color", y.value = o, y.addEventListener("input", () => {
3123
- var g, w;
3124
- const v = Number.parseInt(y.value.slice(1), 16);
3125
- (g = t.beginLayerColorPreview) == null || g.call(t, y);
3119
+ const g = document.createElement("span");
3120
+ g.className = "vui-lrow-clr", g.style.background = o, g.title = n.t("layer.colorOverride");
3121
+ const b = document.createElement("input");
3122
+ if (b.type = "color", b.value = o, b.addEventListener("input", () => {
3123
+ var v, w;
3124
+ const x = Number.parseInt(b.value.slice(1), 16);
3125
+ (v = t.beginLayerColorPreview) == null || v.call(t, b);
3126
3126
  try {
3127
- t.setLayerColor(r.index, Number.isFinite(v) ? v : null), p.style.background = y.value, b.style.background = y.value;
3127
+ t.setLayerColor(r.index, Number.isFinite(x) ? x : null), p.style.background = b.value, g.style.background = b.value;
3128
3128
  } finally {
3129
- (w = t.endLayerColorPreview) == null || w.call(t, y);
3130
- }
3131
- }), y.addEventListener("click", (v) => v.stopPropagation()), b.addEventListener("contextmenu", (v) => {
3132
- v.preventDefault(), v.stopPropagation(), t.setLayerColor(r.index, null);
3133
- const g = Re(gn(r.sourceColor));
3134
- y.value = g, p.style.background = g, b.style.background = g;
3135
- }), b.appendChild(y), d.append(c, p, h, f, b), d.addEventListener("click", (v) => {
3136
- const g = v.target;
3137
- if (g instanceof HTMLInputElement && g.type === "color" || g.closest(".vui-lrow-clr") || g.closest(".vui-lrow-toggle") || g.closest(".vui-lrow-eye")) return;
3129
+ (w = t.endLayerColorPreview) == null || w.call(t, b);
3130
+ }
3131
+ }), b.addEventListener("click", (x) => x.stopPropagation()), g.addEventListener("contextmenu", (x) => {
3132
+ x.preventDefault(), x.stopPropagation(), t.setLayerColor(r.index, null);
3133
+ const v = Re(gn(r.sourceColor));
3134
+ b.value = v, p.style.background = v, g.style.background = v;
3135
+ }), g.appendChild(b), d.append(c, p, h, f, g), d.addEventListener("click", (x) => {
3136
+ const v = x.target;
3137
+ if (v instanceof HTMLInputElement && v.type === "color" || v.closest(".vui-lrow-clr") || v.closest(".vui-lrow-toggle") || v.closest(".vui-lrow-eye")) return;
3138
3138
  const w = !r.visible;
3139
3139
  c.textContent = w ? "●" : "○", c.title = w ? n.t("layer.hide") : n.t("layer.show"), d.classList.toggle("off", !w), t.toggleLayer(r.index);
3140
3140
  }), l.appendChild(d), s && a) {
3141
- const v = document.createElement("div");
3142
- v.className = "vui-lrow-blocks open";
3143
- for (const g of i)
3144
- v.appendChild(mi(g, e, t, n));
3145
- l.appendChild(v);
3141
+ const x = document.createElement("div");
3142
+ x.className = "vui-lrow-blocks open";
3143
+ for (const v of i)
3144
+ x.appendChild(fi(v, e, t, n));
3145
+ l.appendChild(x);
3146
3146
  }
3147
3147
  return l;
3148
3148
  }
3149
- function mi(r, e, t, i) {
3149
+ function fi(r, e, t, i) {
3150
3150
  const n = document.createElement("div");
3151
3151
  n.className = "vui-lrow-block-wrap";
3152
3152
  const s = e.expandedBlocks.has(r.key), a = ra(r.inserts), o = xn(t.selection, r.layerIndex, r.variantId), l = document.createElement("div");
@@ -3154,44 +3154,44 @@ function mi(r, e, t, i) {
3154
3154
  const d = document.createElement("button");
3155
3155
  d.type = "button", d.className = "vui-lrow-block-visibility", et(d, a, i), d.addEventListener("click", (f) => {
3156
3156
  if (f.stopPropagation(), a === "none") {
3157
- const y = e.blockVisibilitySnapshots.get(r.key), v = [];
3158
- for (const g of r.inserts) {
3159
- const w = (y == null ? void 0 : y.get(g.instanceId)) ?? !0;
3160
- g.visible !== w && v.push({ insertId: g.insertId, visible: w });
3157
+ const b = e.blockVisibilitySnapshots.get(r.key), x = [];
3158
+ for (const v of r.inserts) {
3159
+ const w = (b == null ? void 0 : b.get(v.instanceId)) ?? !0;
3160
+ v.visible !== w && x.push({ insertId: v.insertId, visible: w });
3161
3161
  }
3162
- if (et(d, "all", i), n.querySelectorAll(".vui-lrow-insert-visibility").forEach((g) => {
3163
- rt(g, !0, i);
3164
- }), t.batchToggleInserts && v.length > 0)
3165
- t.batchToggleInserts(v);
3162
+ if (et(d, "all", i), n.querySelectorAll(".vui-lrow-insert-visibility").forEach((v) => {
3163
+ rt(v, !0, i);
3164
+ }), t.batchToggleInserts && x.length > 0)
3165
+ t.batchToggleInserts(x);
3166
3166
  else
3167
- for (const g of v) t.toggleInsert(g.insertId, g.visible);
3167
+ for (const v of x) t.toggleInsert(v.insertId, v.visible);
3168
3168
  return;
3169
3169
  }
3170
3170
  e.blockVisibilitySnapshots.set(
3171
3171
  r.key,
3172
- new Map(r.inserts.map((y) => [y.instanceId, y.visible]))
3172
+ new Map(r.inserts.map((b) => [b.instanceId, b.visible]))
3173
3173
  );
3174
- const b = r.inserts.filter((y) => y.visible).map((y) => ({ insertId: y.insertId, visible: !1 }));
3175
- if (et(d, "none", i), n.querySelectorAll(".vui-lrow-insert-visibility").forEach((y) => {
3176
- rt(y, !1, i);
3177
- }), t.batchToggleInserts && b.length > 0)
3178
- t.batchToggleInserts(b);
3174
+ const g = r.inserts.filter((b) => b.visible).map((b) => ({ insertId: b.insertId, visible: !1 }));
3175
+ if (et(d, "none", i), n.querySelectorAll(".vui-lrow-insert-visibility").forEach((b) => {
3176
+ rt(b, !1, i);
3177
+ }), t.batchToggleInserts && g.length > 0)
3178
+ t.batchToggleInserts(g);
3179
3179
  else
3180
- for (const y of b) t.toggleInsert(y.insertId, !1);
3180
+ for (const b of g) t.toggleInsert(b.insertId, !1);
3181
3181
  });
3182
3182
  const c = document.createElement("button");
3183
3183
  c.type = "button", c.className = "vui-lrow-block-toggle", c.textContent = s ? "▼" : "▶";
3184
3184
  const p = (f) => {
3185
3185
  f.stopPropagation(), e.toggleBlockExpanded(r.layerIndex, r.variantId);
3186
- const b = e.expandedBlocks.has(r.key);
3187
- c.textContent = b ? "▼" : "▶";
3188
- let y = n.querySelector(":scope > .vui-lrow-inserts");
3189
- if (b)
3190
- y ? y.classList.add("open") : (y = fi(r, e, t, d, i), n.appendChild(y));
3186
+ const g = e.expandedBlocks.has(r.key);
3187
+ c.textContent = g ? "▼" : "▶";
3188
+ let b = n.querySelector(":scope > .vui-lrow-inserts");
3189
+ if (g)
3190
+ b ? b.classList.add("open") : (b = vi(r, e, t, d, i), n.appendChild(b));
3191
3191
  else {
3192
- y == null || y.classList.remove("open");
3193
- const v = n.closest(".vui-section-list") ?? n.parentElement;
3194
- v && wn(v, l, 24);
3192
+ b == null || b.classList.remove("open");
3193
+ const x = n.closest(".vui-section-list") ?? n.parentElement;
3194
+ x && wn(x, l, 24);
3195
3195
  }
3196
3196
  };
3197
3197
  c.addEventListener("click", p);
@@ -3200,11 +3200,11 @@ function mi(r, e, t, i) {
3200
3200
  const m = document.createElement("span");
3201
3201
  return m.className = "vui-lrow-block-count", m.textContent = `×${r.inserts.length}`, l.append(d, c, h, m), r.inserts.length === 1 && l.addEventListener("click", () => {
3202
3202
  if (!r.canHighlight) return;
3203
- const f = r.inserts[0], b = `${r.layerIndex}:${r.variantId}:${f.instanceId}`;
3204
- e.markSelectionRevealed(b), t.selectInsert(f.insertId);
3205
- }), n.appendChild(l), s && n.appendChild(fi(r, e, t, d, i)), n;
3203
+ const f = r.inserts[0], g = `${r.layerIndex}:${r.variantId}:${f.instanceId}`;
3204
+ e.markSelectionRevealed(g), t.selectInsert(f.insertId);
3205
+ }), n.appendChild(l), s && n.appendChild(vi(r, e, t, d, i)), n;
3206
3206
  }
3207
- function fi(r, e, t, i, n) {
3207
+ function vi(r, e, t, i, n) {
3208
3208
  const s = document.createElement("div");
3209
3209
  s.className = "vui-lrow-inserts open";
3210
3210
  for (const a of r.inserts) {
@@ -3217,8 +3217,8 @@ function fi(r, e, t, i, n) {
3217
3217
  rt(l, p, n);
3218
3218
  const h = s.querySelectorAll(".vui-lrow-insert-visibility");
3219
3219
  let m = 0;
3220
- h.forEach((b) => {
3221
- b.dataset.visible === "1" && m++;
3220
+ h.forEach((g) => {
3221
+ g.dataset.visible === "1" && m++;
3222
3222
  });
3223
3223
  const f = m === 0 ? "none" : m === h.length ? "all" : "mixed";
3224
3224
  et(i, f, n), t.toggleInsert(a.insertId, p);
@@ -3242,16 +3242,16 @@ function ua(r, e) {
3242
3242
  };
3243
3243
  return r.addEventListener("input", t), () => r.removeEventListener("input", t);
3244
3244
  }
3245
- function vi(r, e, t = Vt, i = "mm") {
3245
+ function gi(r, e, t = Bt, i = "mm") {
3246
3246
  if (r.body.replaceChildren(), e.textSelection && e.textDetails) {
3247
- Ce(r, !1), pa(r.body, e.textDetails, t, i), gi(r.body);
3247
+ Ce(r, !1), pa(r.body, e.textDetails, t, i), bi(r.body);
3248
3248
  return;
3249
3249
  }
3250
3250
  if (!e.selection || !e.details) {
3251
3251
  Ce(r, !1), r.body.appendChild(ma(t.t("property.empty")));
3252
3252
  return;
3253
3253
  }
3254
- ha(r.body, e.details, t, i), gi(r.body);
3254
+ ha(r.body, e.details, t, i), bi(r.body);
3255
3255
  }
3256
3256
  function Ce(r, e) {
3257
3257
  if (!r.previewWrap || !r.previewCanvas || (r.previewWrap.hidden = !e, e)) return;
@@ -3259,22 +3259,22 @@ function Ce(r, e) {
3259
3259
  t == null || t.clearRect(0, 0, r.previewCanvas.width, r.previewCanvas.height);
3260
3260
  }
3261
3261
  function ha(r, e, t, i) {
3262
- En(r, t.t("property.insert"), e.blockName), Rt(r, t.t("property.basic"), (n) => {
3262
+ En(r, t.t("property.insert"), e.blockName), At(r, t.t("property.basic"), (n) => {
3263
3263
  q(n, t.t("property.block"), e.blockName), q(n, t.t("property.layer"), e.layerName), q(n, t.t("property.instance"), `#${e.id.instanceId}`), q(n, t.t("property.currentShape"), t.t("property.normalShape"));
3264
- }), Rt(r, t.t("property.transform"), (n) => {
3264
+ }), At(r, t.t("property.transform"), (n) => {
3265
3265
  q(n, "X", t.formatUnit(e.tx, i)), q(n, "Y", t.formatUnit(e.ty, i)), q(n, t.t("property.rotation"), t.formatUnit(e.rotation, "°")), q(n, "Sx", t.formatNumber(e.scaleX)), q(n, "Sy", t.formatNumber(e.scaleY));
3266
3266
  });
3267
3267
  }
3268
3268
  function pa(r, e, t, i) {
3269
- En(r, t.t("property.text"), e.content), Rt(r, t.t("property.basic"), (n) => {
3269
+ En(r, t.t("property.text"), e.content), At(r, t.t("property.basic"), (n) => {
3270
3270
  q(n, t.t("property.layer"), e.layerName), q(n, t.t("property.content"), e.content), q(n, t.t("property.height"), t.formatUnit(e.height, i)), q(n, "X", t.formatUnit(e.x, i)), q(n, "Y", t.formatUnit(e.y, i)), q(n, t.t("property.rotation"), t.formatUnit(e.rotation, "°"));
3271
3271
  });
3272
3272
  }
3273
3273
  function En(r, e, t) {
3274
3274
  const i = document.createElement("div");
3275
- i.className = "vui-pp-section vui-pp-title-row", i.innerHTML = `<strong>${H(e)}</strong><span>·</span><span>${H(t)}</span>`, r.appendChild(i);
3275
+ i.className = "vui-pp-section vui-pp-title-row", i.innerHTML = `<strong>${U(e)}</strong><span>·</span><span>${U(t)}</span>`, r.appendChild(i);
3276
3276
  }
3277
- function Rt(r, e, t) {
3277
+ function At(r, e, t) {
3278
3278
  const i = document.createElement("section");
3279
3279
  i.className = "vui-pp-section";
3280
3280
  const n = document.createElement("div");
@@ -3282,13 +3282,13 @@ function Rt(r, e, t) {
3282
3282
  }
3283
3283
  function q(r, e, t) {
3284
3284
  const i = document.createElement("div");
3285
- i.className = "vui-pp-row", i.innerHTML = `<span class="label">${H(e)}</span><span class="value" title="${H(t)}">${H(t)}</span>`, r.appendChild(i);
3285
+ i.className = "vui-pp-row", i.innerHTML = `<span class="label">${U(e)}</span><span class="value" title="${U(t)}">${U(t)}</span>`, r.appendChild(i);
3286
3286
  }
3287
3287
  function ma(r) {
3288
3288
  const e = document.createElement("div");
3289
3289
  return e.className = "vui-empty-note", e.textContent = r, e;
3290
3290
  }
3291
- function gi(r) {
3291
+ function bi(r) {
3292
3292
  if (r.querySelector('input:not([type="color"])'))
3293
3293
  throw new Error("Property panel must not contain editable inputs");
3294
3294
  if (r.querySelector('[contenteditable=""], [contenteditable="true"]'))
@@ -4310,7 +4310,7 @@ button, input { font: inherit; }
4310
4310
  }
4311
4311
  `
4312
4312
  };
4313
- function pt(r = "dark", e = {}) {
4313
+ function mt(r = "dark", e = {}) {
4314
4314
  const t = {
4315
4315
  accent: "--vui-accent",
4316
4316
  panelBackground: "--vui-bg2",
@@ -4337,7 +4337,7 @@ const xa = {
4337
4337
  infobarLineMode: !0,
4338
4338
  infobarPhase: !0,
4339
4339
  infobarDebug: !0
4340
- }, bi = "property-panel:open", yi = "layer-panel:open", xi = 300, wi = 180, wa = 2;
4340
+ }, yi = "property-panel:open", xi = "layer-panel:open", wi = 300, Ci = 180, wa = 2;
4341
4341
  let Ca = 0;
4342
4342
  function be(r, ...e) {
4343
4343
  const t = document.createElement("div");
@@ -4347,7 +4347,7 @@ function be(r, ...e) {
4347
4347
  const n = document.createElement("div");
4348
4348
  return n.className = "vui-debug-value", n.append(...e), t.append(i, n), t;
4349
4349
  }
4350
- function Ci(r, e, t) {
4350
+ function Ei(r, e, t) {
4351
4351
  const i = document.createElement("div");
4352
4352
  i.className = "vui-debug-spread";
4353
4353
  const n = document.createElement("b");
@@ -4359,7 +4359,7 @@ function Ci(r, e, t) {
4359
4359
  }
4360
4360
  return i;
4361
4361
  }
4362
- function Ei(r) {
4362
+ function ki(r) {
4363
4363
  const e = document.createElement("div");
4364
4364
  return e.className = "vui-debug-spread-list", e.append(...r), e;
4365
4365
  }
@@ -4381,7 +4381,7 @@ function Ea(r, e) {
4381
4381
  return "";
4382
4382
  }
4383
4383
  }
4384
- function ki(r) {
4384
+ function Si(r) {
4385
4385
  return (typeof r.composedPath == "function" ? r.composedPath() : [r.target]).some((t) => {
4386
4386
  var a, o;
4387
4387
  if (!t || typeof t != "object") return !1;
@@ -4427,13 +4427,13 @@ class ka {
4427
4427
  u(this, "activeLayerColorPreview", null);
4428
4428
  u(this, "renderedLayerRows", null);
4429
4429
  u(this, "handleKeyDown", (e) => {
4430
- if (this.disposed || e.defaultPrevented || e.altKey || e.ctrlKey || e.metaKey || ki(e)) return;
4430
+ if (this.disposed || e.defaultPrevented || e.altKey || e.ctrlKey || e.metaKey || Si(e)) return;
4431
4431
  const t = this.getFitShortcut();
4432
4432
  t && e.key.toLowerCase() === t.toLowerCase() && this.host.fitSelectionOrDocument();
4433
4433
  });
4434
4434
  u(this, "handleKeyboardTargetPointerDown", (e) => {
4435
4435
  var t, i;
4436
- this.disposed || ki(e) || (i = (t = this.keyboardTarget) == null ? void 0 : t.focus) == null || i.call(t, { preventScroll: !0 });
4436
+ this.disposed || Si(e) || (i = (t = this.keyboardTarget) == null ? void 0 : t.focus) == null || i.call(t, { preventScroll: !0 });
4437
4437
  });
4438
4438
  u(this, "unsubscribers", []);
4439
4439
  u(this, "filterCleanup", null);
@@ -4445,7 +4445,7 @@ class ka {
4445
4445
  }
4446
4446
  }));
4447
4447
  u(this, "refresh", () => {
4448
- this.disposed || !this.active || (this.syncToolbarState(), this.renderLayerPanel(), this.propertyPanelRefs && this.parts.propertyPanel && (vi(this.propertyPanelRefs, this.host.cad.inspector, this.text, this.getCadUnit()), this.syncPropertyPanelSelectionState(), this.syncPropertyPanelPreview()), this.syncHud());
4448
+ this.disposed || !this.active || (this.syncToolbarState(), this.renderLayerPanel(), this.propertyPanelRefs && this.parts.propertyPanel && (gi(this.propertyPanelRefs, this.host.cad.inspector, this.text, this.getCadUnit()), this.syncPropertyPanelSelectionState(), this.syncPropertyPanelPreview()), this.syncHud());
4449
4449
  });
4450
4450
  u(this, "syncHud", () => {
4451
4451
  var e;
@@ -4463,7 +4463,7 @@ class ka {
4463
4463
  blocks: this.text.formatInteger(t.blockVariantCount),
4464
4464
  split: this.text.formatInteger(t.splitBlockLayerGroupCount)
4465
4465
  });
4466
- const s = t.renderDebugBreakdown.map((d) => Ci(
4466
+ const s = t.renderDebugBreakdown.map((d) => Ei(
4467
4467
  d.label,
4468
4468
  this.text.t("toolbar.debug.breakdown", {
4469
4469
  renderables: this.text.formatInteger(d.renderables),
@@ -4475,8 +4475,8 @@ class ka {
4475
4475
  calls: this.text.formatInteger(t.drawCalls)
4476
4476
  })
4477
4477
  ];
4478
- s.length > 0 && a.push(Ei(s));
4479
- const o = t.splitBlockLayerDetails.map((d) => Ci(
4478
+ s.length > 0 && a.push(ki(s));
4479
+ const o = t.splitBlockLayerDetails.map((d) => Ei(
4480
4480
  `${d.blockName} #${d.variantId}`,
4481
4481
  this.text.t("toolbar.debug.spreadMeta", {
4482
4482
  layers: this.text.formatInteger(d.layerCount),
@@ -4493,7 +4493,7 @@ class ka {
4493
4493
  const l = [this.text.t("toolbar.debug.splitLayerCount", {
4494
4494
  count: this.text.formatInteger(t.splitBlockLayerGroupCount)
4495
4495
  })];
4496
- o.length > 0 && l.push(Ei(o)), this.infobarRefs.debugBody.replaceChildren(
4496
+ o.length > 0 && l.push(ki(o)), this.infobarRefs.debugBody.replaceChildren(
4497
4497
  be("" + this.text.t("toolbar.debug.submitted"), this.text.formatInteger(t.submittedVertexRefs)),
4498
4498
  ...t.lineRenderMode ? [be(this.text.t("toolbar.debug.lineMode"), t.lineRenderMode.toUpperCase())] : [],
4499
4499
  be(this.text.t("toolbar.debug.layers"), this.text.t("toolbar.debug.layerCount", {
@@ -4531,7 +4531,7 @@ class ka {
4531
4531
  if (this.disposed) return;
4532
4532
  this.shadow = ((o = this.host.layout) == null ? void 0 : o.shadowRoot()) ?? this.options.root.shadowRoot ?? this.options.root.attachShadow({ mode: "open" });
4533
4533
  const e = this.theme, t = document.createElement("style");
4534
- t.dataset.viewerUiTheme = "", t.textContent = pt(e, this.options.tokens), this.themeStyle = t;
4534
+ t.dataset.viewerUiTheme = "", t.textContent = mt(e, this.options.tokens), this.themeStyle = t;
4535
4535
  const i = document.createElement("div");
4536
4536
  i.className = "vui-root", i.dataset.theme = e, i.dataset.preset = this.options.preset ?? "auto";
4537
4537
  const n = document.createElement("div");
@@ -4558,11 +4558,11 @@ class ka {
4558
4558
  this.themeValue = e;
4559
4559
  const t = this.shadow.querySelector(".vui-root");
4560
4560
  if (t && (t.dataset.theme = e), this.themeStyle) {
4561
- this.themeStyle.textContent = pt(e, this.options.tokens);
4561
+ this.themeStyle.textContent = mt(e, this.options.tokens);
4562
4562
  return;
4563
4563
  }
4564
4564
  const i = document.createElement("style");
4565
- i.dataset.viewerUiTheme = "", i.textContent = pt(e, this.options.tokens), (n = this.shadow.querySelector("style[data-viewer-ui-theme]")) == null || n.replaceWith(i), this.themeStyle = i;
4565
+ i.dataset.viewerUiTheme = "", i.textContent = mt(e, this.options.tokens), (n = this.shadow.querySelector("style[data-viewer-ui-theme]")) == null || n.replaceWith(i), this.themeStyle = i;
4566
4566
  }
4567
4567
  get theme() {
4568
4568
  return this.themeValue;
@@ -4610,7 +4610,7 @@ class ka {
4610
4610
  const i = document.createElement("div");
4611
4611
  i.className = "vui-section";
4612
4612
  const n = document.createElement("div");
4613
- n.className = "vui-section-head", n.innerHTML = `<span class="vui-section-title">${H(this.text.t("panel.layers"))}</span><span class="vui-section-count">—</span>`;
4613
+ n.className = "vui-section-head", n.innerHTML = `<span class="vui-section-title">${U(this.text.t("panel.layers"))}</span><span class="vui-section-count">—</span>`;
4614
4614
  const s = document.createElement("div");
4615
4615
  s.className = "vui-section-filter-wrap";
4616
4616
  const a = document.createElement("input");
@@ -4623,9 +4623,9 @@ class ka {
4623
4623
  d.type = "button", d.className = "vui-btn", d.textContent = this.text.t("layer.hideAll"), d.addEventListener("click", () => this.host.cad.layers.hideAll());
4624
4624
  const c = document.createElement("button");
4625
4625
  c.type = "button", c.className = "vui-btn", c.textContent = this.text.t("layer.collapse"), c.title = this.text.t("layer.collapseTitle"), c.addEventListener("click", () => {
4626
- var y;
4627
- const f = (y = this.host.cad.inspector.selection) == null ? void 0 : y.id, b = f ? `${f.layerIndex}:${f.variantId}:${f.instanceId}` : null;
4628
- this.layerPanelState.collapseAll(b), this.refresh();
4626
+ var b;
4627
+ const f = (b = this.host.cad.inspector.selection) == null ? void 0 : b.id, g = f ? `${f.layerIndex}:${f.variantId}:${f.instanceId}` : null;
4628
+ this.layerPanelState.collapseAll(g), this.refresh();
4629
4629
  }), o.append(l, d, c);
4630
4630
  const p = document.createElement("div");
4631
4631
  p.className = "vui-section-list", i.append(n, s, o, p), t.appendChild(i), this.layerPanelRefs = {
@@ -4660,12 +4660,12 @@ class ka {
4660
4660
  const a = document.createElement("span");
4661
4661
  if (a.className = "vui-info-text", this.toolbarInfoText = a, s.appendChild(a), this.parts.fit) {
4662
4662
  this.btnFit = document.createElement("button"), this.btnFit.type = "button", this.btnFit.className = "vui-btn";
4663
- const y = this.getFitShortcut();
4664
- this.btnFit.innerHTML = y ? `${H(this.text.t("toolbar.fit"))} <span class="vui-kbd">${H(y.toUpperCase())}</span>` : H(this.text.t("toolbar.fit")), this.btnFit.addEventListener("click", () => this.host.fitSelectionOrDocument()), s.appendChild(this.btnFit);
4663
+ const b = this.getFitShortcut();
4664
+ this.btnFit.innerHTML = b ? `${U(this.text.t("toolbar.fit"))} <span class="vui-kbd">${U(b.toUpperCase())}</span>` : U(this.text.t("toolbar.fit")), this.btnFit.addEventListener("click", () => this.host.fitSelectionOrDocument()), s.appendChild(this.btnFit);
4665
4665
  }
4666
4666
  if (this.parts.viewMode) {
4667
- const y = document.createElement("div");
4668
- y.className = "vui-view-toggle", y.setAttribute("role", "group"), y.setAttribute("aria-label", this.text.t("toolbar.viewMode")), this.btnView2d = document.createElement("button"), this.btnView2d.type = "button", this.btnView2d.className = "vui-btn", this.btnView2d.textContent = "2D", this.btnView2d.setAttribute("aria-pressed", "false"), this.btnView2d.addEventListener("click", () => this.host.setViewMode("2d")), this.btnView3d = document.createElement("button"), this.btnView3d.type = "button", this.btnView3d.className = "vui-btn", this.btnView3d.textContent = "3D", this.btnView3d.setAttribute("aria-pressed", "false"), this.btnView3d.addEventListener("click", () => this.host.setViewMode("3d")), y.append(this.btnView2d, this.btnView3d), s.appendChild(y);
4667
+ const b = document.createElement("div");
4668
+ b.className = "vui-view-toggle", b.setAttribute("role", "group"), b.setAttribute("aria-label", this.text.t("toolbar.viewMode")), this.btnView2d = document.createElement("button"), this.btnView2d.type = "button", this.btnView2d.className = "vui-btn", this.btnView2d.textContent = "2D", this.btnView2d.setAttribute("aria-pressed", "false"), this.btnView2d.addEventListener("click", () => this.host.setViewMode("2d")), this.btnView3d = document.createElement("button"), this.btnView3d.type = "button", this.btnView3d.className = "vui-btn", this.btnView3d.textContent = "3D", this.btnView3d.setAttribute("aria-pressed", "false"), this.btnView3d.addEventListener("click", () => this.host.setViewMode("3d")), b.append(this.btnView2d, this.btnView3d), s.appendChild(b);
4669
4669
  }
4670
4670
  const o = document.createElement("span");
4671
4671
  o.className = "vui-seg";
@@ -4683,8 +4683,8 @@ class ka {
4683
4683
  m.className = "vui-debug-card";
4684
4684
  const f = document.createElement("summary");
4685
4685
  f.className = "vui-debug-summary", f.textContent = this.text.t("toolbar.details");
4686
- const b = document.createElement("div");
4687
- return b.className = "vui-debug-body", m.append(f, b), i.append(n, s, o, l, d, c, p, h, m), e.append(t, i), this.infobarRefs = {
4686
+ const g = document.createElement("div");
4687
+ return g.className = "vui-debug-body", m.append(f, g), i.append(n, s, o, l, d, c, p, h, m), e.append(t, i), this.infobarRefs = {
4688
4688
  infobar: e,
4689
4689
  file: n,
4690
4690
  tools: s,
@@ -4696,7 +4696,7 @@ class ka {
4696
4696
  fps: h,
4697
4697
  debugCard: m,
4698
4698
  debugSummary: f,
4699
- debugBody: b
4699
+ debugBody: g
4700
4700
  }, this.infobar = e, this.infobarToggle = t, e;
4701
4701
  }
4702
4702
  buildPropertyPanel() {
@@ -4705,7 +4705,7 @@ class ka {
4705
4705
  const t = document.createElement("div");
4706
4706
  t.className = "vui-property-panel", t.dataset.part = "property-panel";
4707
4707
  const i = document.createElement("div");
4708
- i.className = "vui-pp-head", i.innerHTML = `<span class="vui-pp-title-text">${H(this.text.t("panel.properties"))}</span>`;
4708
+ i.className = "vui-pp-head", i.innerHTML = `<span class="vui-pp-title-text">${U(this.text.t("panel.properties"))}</span>`;
4709
4709
  const n = document.createElement("div");
4710
4710
  n.className = "vui-pp-preview-wrap", n.hidden = !0;
4711
4711
  const s = document.createElement("canvas");
@@ -4729,7 +4729,7 @@ class ka {
4729
4729
  const e = this.host.cad.inspector.selection, t = e == null ? void 0 : e.id, i = t ? `${t.layerIndex}:${t.variantId}:${t.instanceId}` : null;
4730
4730
  i && this.layerPanelState.needsSelectionReveal(i) ? this.renderLayerPanel() : aa(this.layerPanelRefs.list, e);
4731
4731
  }
4732
- this.propertyPanelRefs && this.parts.propertyPanel && (vi(this.propertyPanelRefs, this.host.cad.inspector, this.text, this.getCadUnit()), this.syncPropertyPanelSelectionState(), this.syncPropertyPanelPreview());
4732
+ this.propertyPanelRefs && this.parts.propertyPanel && (gi(this.propertyPanelRefs, this.host.cad.inspector, this.text, this.getCadUnit()), this.syncPropertyPanelSelectionState(), this.syncPropertyPanelPreview());
4733
4733
  }),
4734
4734
  this.host.cad.on("hud-change", () => this.syncHud()),
4735
4735
  this.host.on("view-mode-change", () => {
@@ -4818,7 +4818,7 @@ class ka {
4818
4818
  var e;
4819
4819
  if (((e = this.options.cad) == null ? void 0 : e.persistence) === !1) return !1;
4820
4820
  try {
4821
- return this.readState(bi) === "1";
4821
+ return this.readState(yi) === "1";
4822
4822
  } catch {
4823
4823
  return !1;
4824
4824
  }
@@ -4827,7 +4827,7 @@ class ka {
4827
4827
  var e;
4828
4828
  if (((e = this.options.cad) == null ? void 0 : e.persistence) === !1) return !0;
4829
4829
  try {
4830
- return this.readState(yi) !== "0";
4830
+ return this.readState(xi) !== "0";
4831
4831
  } catch {
4832
4832
  return !0;
4833
4833
  }
@@ -4840,7 +4840,7 @@ class ka {
4840
4840
  panel: this.text.t("panel.layers")
4841
4841
  })), !!t && (this.emitUiLayoutChange(), ((s = this.options.cad) == null ? void 0 : s.persistence) !== !1)))
4842
4842
  try {
4843
- this.writeState(yi, e ? "1" : "0");
4843
+ this.writeState(xi, e ? "1" : "0");
4844
4844
  } catch {
4845
4845
  }
4846
4846
  }
@@ -4856,7 +4856,7 @@ class ka {
4856
4856
  panel: this.text.t("panel.properties")
4857
4857
  })), (s = i.querySelector(".vui-property-panel")) == null || s.setAttribute("aria-hidden", String(!e)), e ? this.syncPropertyPanelPreview(!0) : (this.cancelPropertyPreviewRender(), this.propertyPanelRefs && Ce(this.propertyPanelRefs, !1)), !!t && (this.emitUiLayoutChange(), ((a = this.options.cad) == null ? void 0 : a.persistence) !== !1)))
4858
4858
  try {
4859
- this.writeState(bi, e ? "1" : "0");
4859
+ this.writeState(yi, e ? "1" : "0");
4860
4860
  } catch {
4861
4861
  }
4862
4862
  }
@@ -4954,7 +4954,7 @@ class ka {
4954
4954
  return (t = this.propertyPanelShell) != null && t.classList.contains("closed") ? !0 : !this.isPropertyPreviewLayoutReady(e);
4955
4955
  }
4956
4956
  isPropertyPreviewLayoutReady(e) {
4957
- return e.clientWidth >= wi && e.clientHeight >= wi;
4957
+ return e.clientWidth >= Ci && e.clientHeight >= Ci;
4958
4958
  }
4959
4959
  waitForPropertyPreviewLayout(e) {
4960
4960
  if (this.isPropertyPreviewLayoutReady(e)) return Promise.resolve();
@@ -4964,37 +4964,37 @@ class ka {
4964
4964
  const l = [], d = [];
4965
4965
  let c = 0;
4966
4966
  const p = () => {
4967
- for (const v of l) window.clearTimeout(v);
4968
- for (const v of d) v();
4969
- window.clearTimeout(y), c !== 0 && cancelAnimationFrame(c), this.propertyPreviewLayoutWaitAbort = null;
4967
+ for (const x of l) window.clearTimeout(x);
4968
+ for (const x of d) x();
4969
+ window.clearTimeout(b), c !== 0 && cancelAnimationFrame(c), this.propertyPreviewLayoutWaitAbort = null;
4970
4970
  }, h = () => {
4971
4971
  s || (s = !0, p(), n());
4972
4972
  }, m = () => {
4973
- const v = e.clientWidth;
4973
+ const x = e.clientWidth;
4974
4974
  if (!this.isPropertyPreviewLayoutReady(e)) {
4975
4975
  a = 0, o = -1;
4976
4976
  return;
4977
4977
  }
4978
- if (v === o) {
4978
+ if (x === o) {
4979
4979
  a += 1, a >= wa && h();
4980
4980
  return;
4981
4981
  }
4982
- o = v, a = 0;
4983
- }, f = (v) => {
4984
- if (!Sa(v)) return;
4985
- let g = !1;
4982
+ o = x, a = 0;
4983
+ }, f = (x) => {
4984
+ if (!Sa(x)) return;
4985
+ let v = !1;
4986
4986
  const w = (C) => {
4987
- C.target !== v || C.propertyName !== "width" || x();
4988
- }, x = () => {
4989
- g || (g = !0, v.removeEventListener("transitionend", w), requestAnimationFrame(m));
4987
+ C.target !== x || C.propertyName !== "width" || y();
4988
+ }, y = () => {
4989
+ v || (v = !0, x.removeEventListener("transitionend", w), requestAnimationFrame(m));
4990
4990
  };
4991
- v.addEventListener("transitionend", w), l.push(window.setTimeout(x, xi)), d.push(() => {
4992
- g || (g = !0, v.removeEventListener("transitionend", w));
4991
+ x.addEventListener("transitionend", w), l.push(window.setTimeout(y, wi)), d.push(() => {
4992
+ v || (v = !0, x.removeEventListener("transitionend", w));
4993
4993
  });
4994
- }, b = () => {
4995
- m(), s || (c = requestAnimationFrame(b));
4996
- }, y = window.setTimeout(h, xi);
4997
- f(i), f(t), c = requestAnimationFrame(b), this.propertyPreviewLayoutWaitAbort = () => {
4994
+ }, g = () => {
4995
+ m(), s || (c = requestAnimationFrame(g));
4996
+ }, b = window.setTimeout(h, wi);
4997
+ f(i), f(t), c = requestAnimationFrame(g), this.propertyPreviewLayoutWaitAbort = () => {
4998
4998
  s = !0, p();
4999
4999
  };
5000
5000
  });
@@ -5041,7 +5041,7 @@ class Ra {
5041
5041
  const t = this.canMeasure();
5042
5042
  this.resizeObserver = t && typeof ResizeObserver == "function" ? new ResizeObserver(() => this.schedule()) : null, t && typeof globalThis.window < "u" && globalThis.window.addEventListener("resize", this.handleWindowResize);
5043
5043
  const i = this.host.reference(), n = this.host.target();
5044
- i && ne(i) && ((s = this.resizeObserver) == null || s.observe(i)), n && n !== i && ne(n) && ((a = this.resizeObserver) == null || a.observe(n));
5044
+ i && re(i) && ((s = this.resizeObserver) == null || s.observe(i)), n && n !== i && re(n) && ((a = this.resizeObserver) == null || a.observe(n));
5045
5045
  }
5046
5046
  mountBuiltin(e, t) {
5047
5047
  return this.mountNode(e, t.zone, !0, t.group);
@@ -5078,7 +5078,7 @@ class Ra {
5078
5078
  }
5079
5079
  canMeasure() {
5080
5080
  const e = this.host.reference();
5081
- return !!(e && ne(e) && typeof e.getBoundingClientRect == "function");
5081
+ return !!(e && re(e) && typeof e.getBoundingClientRect == "function");
5082
5082
  }
5083
5083
  dispose() {
5084
5084
  var e;
@@ -5092,13 +5092,13 @@ class Ra {
5092
5092
  }
5093
5093
  mountNode(e, t, i, n) {
5094
5094
  var l;
5095
- const s = mt(t, i, n), a = this.ensureZoneContainer(t, i, n);
5095
+ const s = ft(t, i, n), a = this.ensureZoneContainer(t, i, n);
5096
5096
  a.append(e);
5097
5097
  const o = { node: e, zone: t, builtin: i, group: n, container: a, key: s };
5098
- return this.mounts.add(o), ne(e) && ((l = this.resizeObserver) == null || l.observe(e)), this.schedule(), {
5098
+ return this.mounts.add(o), re(e) && ((l = this.resizeObserver) == null || l.observe(e)), this.schedule(), {
5099
5099
  dispose: () => {
5100
5100
  var d, c;
5101
- this.mounts.delete(o) && (ne(e) ? ((d = this.resizeObserver) == null || d.unobserve(e), e.remove()) : e.parentNode === a && a.removeChild(e), this.containerHasMounts(s) || ((c = this.resizeObserver) == null || c.unobserve(a), a.remove(), this.zoneContainers.delete(s)), this.schedule());
5101
+ this.mounts.delete(o) && (re(e) ? ((d = this.resizeObserver) == null || d.unobserve(e), e.remove()) : e.parentNode === a && a.removeChild(e), this.containerHasMounts(s) || ((c = this.resizeObserver) == null || c.unobserve(a), a.remove(), this.zoneContainers.delete(s)), this.schedule());
5102
5102
  }
5103
5103
  };
5104
5104
  }
@@ -5108,7 +5108,7 @@ class Ra {
5108
5108
  }
5109
5109
  ensureZoneContainer(e, t, i) {
5110
5110
  var l;
5111
- const n = mt(e, t, i), s = this.zoneContainers.get(n);
5111
+ const n = ft(e, t, i), s = this.zoneContainers.get(n);
5112
5112
  if (s) return s;
5113
5113
  const a = document.createElement("div");
5114
5114
  a.dataset.viewerZone = e, a.dataset.viewerZoneOwner = t ? "builtin" : "plugin", i && (a.dataset.viewerZoneGroup = i), a.dataset.viewerZoneActive = String(!i || this.activeGroups.has(i));
@@ -5117,12 +5117,12 @@ class Ra {
5117
5117
  }
5118
5118
  /** Test/debug seam. Prefer querying the relevant host by data attributes. */
5119
5119
  getOwnerZoneElement(e, t = !1, i) {
5120
- return this.zoneContainers.get(mt(e, t, i)) ?? null;
5120
+ return this.zoneContainers.get(ft(e, t, i)) ?? null;
5121
5121
  }
5122
5122
  installZoneStyles(e, t) {
5123
5123
  if (!e || typeof e.querySelector != "function" || typeof e.prepend != "function" || e.querySelector(`style[data-viewer-layout="${t}"]`)) return;
5124
5124
  const i = document.createElement("style");
5125
- i.dataset.viewerLayout = t, i.textContent = La, e.append(i), this.installedStyles.push(i), ne(e) && (e.dataset.viewerLayoutHost = "", typeof getComputedStyle == "function" && getComputedStyle(e).position === "static" && (e.style.position = "relative"));
5125
+ i.dataset.viewerLayout = t, i.textContent = La, e.append(i), this.installedStyles.push(i), re(e) && (e.dataset.viewerLayoutHost = "", typeof getComputedStyle == "function" && getComputedStyle(e).position === "static" && (e.style.position = "relative"));
5126
5126
  }
5127
5127
  schedule() {
5128
5128
  if (!(this.disposed || this.frameHandle !== null)) {
@@ -5190,17 +5190,17 @@ class Ra {
5190
5190
  return !t || this.activeGroups.has(t);
5191
5191
  }
5192
5192
  assertStableReference(e, t) {
5193
- return !t || t === e || !ne(e) || !ne(t) || !e.contains(t) ? !0 : (this.warnedUnstableReference || (this.warnedUnstableReference = !0, console.warn("[viewer] ui.root must not contain the inset target; content insets will be broadcast but not applied. Use a shell-level ui.root so insets stay stable.")), !1);
5193
+ return !t || t === e || !re(e) || !re(t) || !e.contains(t) ? !0 : (this.warnedUnstableReference || (this.warnedUnstableReference = !0, console.warn("[viewer] ui.root must not contain the inset target; content insets will be broadcast but not applied. Use a shell-level ui.root so insets stay stable.")), !1);
5194
5194
  }
5195
5195
  }
5196
- function mt(r, e, t) {
5196
+ function ft(r, e, t) {
5197
5197
  return `${e ? "builtin" : "plugin"}:${t ?? ""}:${r}`;
5198
5198
  }
5199
- function ne(r) {
5199
+ function re(r) {
5200
5200
  return !!(r && typeof r == "object" && r.nodeType === 1);
5201
5201
  }
5202
5202
  function Aa(r) {
5203
- if (!ne(r) || r.hidden) return !1;
5203
+ if (!re(r) || r.hidden) return !1;
5204
5204
  const e = typeof getComputedStyle == "function" ? getComputedStyle(r) : null;
5205
5205
  return !(e && (e.display === "none" || e.visibility === "hidden"));
5206
5206
  }
@@ -5239,7 +5239,7 @@ const La = `
5239
5239
  sun: '<circle cx="12" cy="12" r="4"/><path d="M12 2v2m0 16v2M2 12h2m16 0h2M5 5l1.5 1.5m11 11L19 19M5 19l1.5-1.5m11-11L19 5"/>',
5240
5240
  moon: '<path d="M20.5 13A9 9 0 0 1 11 3.5 9 9 0 1 0 20.5 13Z"/>'
5241
5241
  };
5242
- function dt(r) {
5242
+ function ct(r) {
5243
5243
  return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${Da[r]}</svg>`;
5244
5244
  }
5245
5245
  const Ta = {
@@ -5260,98 +5260,104 @@ function Na(r, e) {
5260
5260
  i.className = "vpu-toolbar", i.dataset.theme = e.theme ?? "dark", i.setAttribute("aria-label", e.label);
5261
5261
  const n = document.createElement("span");
5262
5262
  n.className = "vpu-filename", n.hidden = !0;
5263
- const s = document.createElement("div");
5264
- s.className = "vpu-actions", i.append(n, s);
5265
- const a = /* @__PURE__ */ new Map();
5266
- let o = null, l = null, d = { play: "运行仿真", pause: "暂停仿真", reset: "重置仿真" }, c = e.theme ?? "dark", p = null;
5267
- const h = (v, g, w, x, C) => {
5268
- const k = document.createElement("button");
5269
- return k.type = "button", k.className = "vpu-btn", k.dataset.viewerControl = g, k.dataset.viewerControlId = v, k.innerHTML = dt(x), k.title = w, k.setAttribute("aria-label", w), k.addEventListener("click", C), a.set(v, { button: k, icon: x }), s.append(k), k;
5270
- }, m = (v, g) => v ? g === "filename" ? t.filename : g === "playback" ? t.playback && v.canPlay : g === "reset" ? t.reset && v.canReset : g === "fit" ? t.fit : g === "upAxis" ? t.upAxis && v.canReorientUpAxis === !0 : g === "environment" ? t.environment : g === "ground" ? t.ground && v.canToggleGround === !0 : g === "collision" ? t.collision && v.canToggleCollision === !0 : t.theme : !1, f = (v) => {
5271
- var k, E, P, I, D, S, U;
5272
- p = v, s.replaceChildren(), a.clear(), o = null, l = null;
5273
- const g = (v == null ? void 0 : v.capabilities) ?? null, w = (E = (k = r.asset).$inspection) == null ? void 0 : E.call(k), x = (w == null ? void 0 : w.kind) === "joints" && w.getSnapshot().controlMode === "kinematic";
5274
- if (d = (g == null ? void 0 : g.hasAnimation) === !0 && (g.hasPhysics !== !0 || x) ? { play: "播放动画", pause: "暂停动画", reset: "重置动画" } : { play: "运行仿真", pause: "暂停仿真", reset: "重置仿真" }, n.hidden = !(t.filename && (v != null && v.filename)), n.textContent = (v == null ? void 0 : v.filename) ?? "", n.title = (v == null ? void 0 : v.filename) ?? "", v && m(g, "playback")) {
5275
- const L = "playback";
5276
- l = L;
5277
- const V = h(L, "playback", d.play, "play", () => {
5263
+ const s = document.createElement("span");
5264
+ s.className = "vpu-toolbar-spinner", s.hidden = !0, s.setAttribute("role", "status"), s.setAttribute("aria-live", "polite");
5265
+ const a = document.createElement("div");
5266
+ a.className = "vpu-actions", i.append(s, n, a);
5267
+ const o = /* @__PURE__ */ new Map();
5268
+ let l = null, d = null, c = { play: "运行仿真", pause: "暂停仿真", reset: "重置仿真" }, p = e.theme ?? "dark", h = null;
5269
+ const m = (v, w, y, C, k) => {
5270
+ const E = document.createElement("button");
5271
+ return E.type = "button", E.className = "vpu-btn", E.dataset.viewerControl = w, E.dataset.viewerControlId = v, E.innerHTML = ct(C), E.title = y, E.setAttribute("aria-label", y), E.addEventListener("click", k), o.set(v, { button: E, icon: C }), a.append(E), E;
5272
+ }, f = (v, w) => v ? w === "filename" ? t.filename : w === "playback" ? t.playback && v.canPlay : w === "reset" ? t.reset && v.canReset : w === "fit" ? t.fit : w === "upAxis" ? t.upAxis && v.canReorientUpAxis === !0 : w === "environment" ? t.environment : w === "ground" ? t.ground && v.canToggleGround === !0 : w === "collision" ? t.collision && v.canToggleCollision === !0 : t.theme : !1, g = (v) => {
5273
+ var D, T, M, V, _, H, O, G;
5274
+ h = v, a.replaceChildren(), o.clear(), l = null, d = null;
5275
+ const w = (v == null ? void 0 : v.capabilities) ?? null, y = (T = (D = r.asset).$inspection) == null ? void 0 : T.call(D), C = (y == null ? void 0 : y.kind) === "joints" && y.getSnapshot().controlMode === "kinematic";
5276
+ c = (w == null ? void 0 : w.hasAnimation) === !0 && (w.hasPhysics !== !0 || C) ? { play: "播放动画", pause: "暂停动画", reset: "重置动画" } : { play: "运行仿真", pause: "暂停仿真", reset: "重置仿真" }, n.hidden = !(t.filename && (v != null && v.filename)), n.textContent = (v == null ? void 0 : v.filename) ?? "", n.title = (v == null ? void 0 : v.filename) ?? "";
5277
+ const k = (v == null ? void 0 : v.phase) === "ready" ? v.backgroundLoading ?? null : null;
5278
+ s.hidden = !t.filename || !k;
5279
+ const E = ((M = k == null ? void 0 : k.message) == null ? void 0 : M.trim()) || "资源加载中...";
5280
+ if (k ? (s.title = E, s.setAttribute("aria-label", E)) : (s.removeAttribute("title"), s.removeAttribute("aria-label")), v && f(w, "playback")) {
5281
+ const S = "playback";
5282
+ d = S;
5283
+ const A = m(S, "playback", c.play, "play", () => {
5278
5284
  r.asset.$readControl().playing ? r.commands.pause() : r.commands.play();
5279
5285
  });
5280
- V.className = "vpu-btn vpu-btn-primary";
5286
+ A.className = "vpu-btn vpu-btn-primary";
5281
5287
  }
5282
- if ((v == null ? void 0 : v.kind) === "simulation" && v.phase === "ready" && t.playback && !(g != null && g.canPlay) && (((P = v.physics) == null ? void 0 : P.status) === "unavailable" || !v.physics && ((I = v.warning) == null ? void 0 : I.stage) === "physics-fallback")) {
5283
- const L = ((D = v.physics) == null ? void 0 : D.status) === "unavailable" ? v.physics.issue : v.warning, V = L.notice ? `${L.notice.title}:${L.notice.summary}` : L.message, j = h("playback", "playback", V, "play", () => {
5288
+ if ((v == null ? void 0 : v.kind) === "simulation" && v.phase === "ready" && t.playback && !(w != null && w.canPlay) && (((V = v.physics) == null ? void 0 : V.status) === "unavailable" || !v.physics && ((_ = v.warning) == null ? void 0 : _.stage) === "physics-fallback")) {
5289
+ const S = ((H = v.physics) == null ? void 0 : H.status) === "unavailable" ? v.physics.issue : v.warning, A = S.notice ? `${S.notice.title}:${S.notice.summary}` : S.message, j = m("playback", "playback", A, "play", () => {
5284
5290
  });
5285
5291
  j.setAttribute("aria-disabled", "true"), j.className = "vpu-btn vpu-btn-primary";
5286
5292
  }
5287
- v && m(g, "reset") && h("reset", "reset", d.reset, "reset", () => {
5293
+ v && f(w, "reset") && m("reset", "reset", c.reset, "reset", () => {
5288
5294
  r.commands.reset();
5289
- }), v && m(g, "fit") && h("fit", "fit", "视角适应", "fit", () => {
5295
+ }), v && f(w, "fit") && m("fit", "fit", "视角适应", "fit", () => {
5290
5296
  r.commands.fitView();
5291
- }), v && m(g, "upAxis") && (o = "切换上轴", h("upAxis", "upAxis", o, "upAxisZ", () => {
5292
- const L = r.asset.$readControl().upAxis ?? "z";
5293
- r.commands.setUpAxis(L === "z" ? "y" : "z");
5297
+ }), v && f(w, "upAxis") && (l = "切换上轴", m("upAxis", "upAxis", l, "upAxisZ", () => {
5298
+ const S = r.asset.$readControl().upAxis ?? "z";
5299
+ r.commands.setUpAxis(S === "z" ? "y" : "z");
5294
5300
  }));
5295
- const C = (S = e.environment) == null ? void 0 : S.getState();
5296
- if (v && (C != null && C.available) && m(g, "environment")) {
5297
- const L = h("environment", "environment", "选择环境纹理", "environment", () => {
5298
- var V;
5299
- (V = e.environment) == null || V.openPicker(L);
5301
+ const P = (O = e.environment) == null ? void 0 : O.getState();
5302
+ if (v && (P != null && P.available) && f(w, "environment")) {
5303
+ const S = m("environment", "environment", "选择环境纹理", "environment", () => {
5304
+ var A;
5305
+ (A = e.environment) == null || A.openPicker(S);
5300
5306
  });
5301
- L.setAttribute("aria-haspopup", "dialog"), L.setAttribute("aria-controls", "vpu-environment-picker"), Si(L, ((U = e.environment) == null ? void 0 : U.isPickerOpen()) ?? !1);
5302
- }
5303
- if (v && m(g, "ground") && h("ground", "ground", "显示地面", "ground", () => {
5304
- const L = r.asset.$readControl().groundVisible;
5305
- r.commands.setGroundVisible(!L);
5306
- }), v && m(g, "collision") && h("collision", "collision", Pi(!1), "collision", () => {
5307
- const L = r.asset.$readControl().collisionVisible;
5308
- r.commands.setCollisionVisible(!L);
5309
- }), v && m(g, "theme")) {
5310
- const L = c === "dark";
5311
- h(
5307
+ S.setAttribute("aria-haspopup", "dialog"), S.setAttribute("aria-controls", "vpu-environment-picker"), Pi(S, ((G = e.environment) == null ? void 0 : G.isPickerOpen()) ?? !1);
5308
+ }
5309
+ if (v && f(w, "ground") && m("ground", "ground", "显示地面", "ground", () => {
5310
+ const S = r.asset.$readControl().groundVisible;
5311
+ r.commands.setGroundVisible(!S);
5312
+ }), v && f(w, "collision") && m("collision", "collision", Mi(!1), "collision", () => {
5313
+ const S = r.asset.$readControl().collisionVisible;
5314
+ r.commands.setCollisionVisible(!S);
5315
+ }), v && f(w, "theme")) {
5316
+ const S = p === "dark";
5317
+ m(
5312
5318
  "theme",
5313
5319
  "theme",
5314
- L ? "切换浅色主题" : "切换深色主题",
5315
- L ? "sun" : "moon",
5316
- () => r.commands.setTheme(c === "dark" ? "light" : "dark")
5320
+ S ? "切换浅色主题" : "切换深色主题",
5321
+ S ? "sun" : "moon",
5322
+ () => r.commands.setTheme(p === "dark" ? "light" : "dark")
5317
5323
  );
5318
5324
  }
5319
- i.hidden = s.childElementCount === 0 && n.hidden, b(r.asset.$readControl());
5325
+ i.hidden = a.childElementCount === 0 && n.hidden, b(r.asset.$readControl());
5320
5326
  }, b = (v) => {
5321
- const g = l ? a.get(l) : void 0;
5322
- g && (qe(g.button, v.playing ? d.pause : d.play, v.playing ? "pause" : "play", v.playing), g.icon = v.playing ? "pause" : "play");
5323
- const w = a.get("ground");
5324
- w && qe(w.button, v.groundVisible ? "隐藏地面" : "显示地面", "ground", v.groundVisible);
5325
- const x = a.get("collision");
5326
- x && qe(x.button, Pi(v.collisionVisible), "collision", v.collisionVisible);
5327
- const C = a.get("upAxis");
5328
- C && qe(C.button, ja(v.upAxis), Oa(v.upAxis), v.upAxis === "y");
5327
+ const w = d ? o.get(d) : void 0;
5328
+ w && (qe(w.button, v.playing ? c.pause : c.play, v.playing ? "pause" : "play", v.playing), w.icon = v.playing ? "pause" : "play");
5329
+ const y = o.get("ground");
5330
+ y && qe(y.button, v.groundVisible ? "隐藏地面" : "显示地面", "ground", v.groundVisible);
5331
+ const C = o.get("collision");
5332
+ C && qe(C.button, Mi(v.collisionVisible), "collision", v.collisionVisible);
5333
+ const k = o.get("upAxis");
5334
+ k && qe(k.button, ja(v.upAxis), Oa(v.upAxis), v.upAxis === "y");
5329
5335
  };
5330
5336
  return {
5331
5337
  element: i,
5332
- update: (v) => f(v),
5338
+ update: (v) => g(v),
5333
5339
  pressedChanged: () => b(r.asset.$readControl()),
5334
5340
  pickerChanged: (v) => {
5335
- const g = a.get("environment");
5336
- g && Si(g.button, v);
5341
+ const w = o.get("environment");
5342
+ w && Pi(w.button, v);
5337
5343
  },
5338
5344
  environmentAnchor: () => {
5339
5345
  var v;
5340
- return ((v = a.get("environment")) == null ? void 0 : v.button) ?? null;
5346
+ return ((v = o.get("environment")) == null ? void 0 : v.button) ?? null;
5341
5347
  },
5342
5348
  themeChanged: (v) => {
5343
- c = v, i.dataset.theme = v, f(p);
5349
+ p = v, i.dataset.theme = v, g(h);
5344
5350
  },
5345
5351
  dispose: () => {
5346
5352
  i.remove();
5347
5353
  }
5348
5354
  };
5349
5355
  }
5350
- function Si(r, e) {
5356
+ function Pi(r, e) {
5351
5357
  r.setAttribute("aria-expanded", String(e)), r.classList.toggle("is-active", e);
5352
5358
  }
5353
5359
  function qe(r, e, t, i) {
5354
- r.innerHTML = dt(t), r.title = e, r.setAttribute("aria-label", e), r.setAttribute("aria-pressed", String(i)), r.classList.toggle("is-active", i);
5360
+ r.innerHTML = ct(t), r.title = e, r.setAttribute("aria-label", e), r.setAttribute("aria-pressed", String(i)), r.classList.toggle("is-active", i);
5355
5361
  }
5356
5362
  function Oa(r) {
5357
5363
  return r === "y" ? "upAxisY" : "upAxisZ";
@@ -5359,7 +5365,7 @@ function Oa(r) {
5359
5365
  function ja(r) {
5360
5366
  return r === "y" ? "当前 Y-UP,点击切换为 Z-UP" : "当前 Z-UP,点击切换为 Y-UP";
5361
5367
  }
5362
- function Pi(r) {
5368
+ function Mi(r) {
5363
5369
  return `${r ? "隐藏碰撞代理" : "显示碰撞代理"}(青绿=精确代理,橙黄=碰撞源网格近似)`;
5364
5370
  }
5365
5371
  class Fa {
@@ -5376,8 +5382,8 @@ class Fa {
5376
5382
  u(this, "rotation");
5377
5383
  u(this, "status");
5378
5384
  u(this, "input");
5379
- u(this, "defaultPreview", new ft());
5380
- u(this, "customPreview", new ft());
5385
+ u(this, "defaultPreview", new vt());
5386
+ u(this, "customPreview", new vt());
5381
5387
  u(this, "showBackgroundToggle");
5382
5388
  u(this, "onOpenChange");
5383
5389
  u(this, "state");
@@ -5394,7 +5400,7 @@ class Fa {
5394
5400
  const s = document.createElement("header");
5395
5401
  s.className = "vpu-environment-header";
5396
5402
  const a = document.createElement("div");
5397
- a.className = "vpu-environment-title", a.textContent = "环境纹理", this.closeButton = Mi("关闭环境选择", "close"), s.append(a, this.closeButton);
5403
+ a.className = "vpu-environment-title", a.textContent = "环境纹理", this.closeButton = Ri("关闭环境选择", "close"), s.append(a, this.closeButton);
5398
5404
  const o = document.createElement("label");
5399
5405
  o.className = "vpu-environment-background", o.hidden = !this.showBackgroundToggle;
5400
5406
  const l = document.createElement("span");
@@ -5418,8 +5424,8 @@ class Fa {
5418
5424
  }), this.customCard.select.addEventListener("click", () => {
5419
5425
  this.state.customEnvironment ? this.run(() => this.api.useCustom()) : this.input.click();
5420
5426
  }), (m = this.customCard.replace) == null || m.addEventListener("click", () => this.input.click()), this.input.addEventListener("change", () => {
5421
- var b;
5422
- const f = (b = this.input.files) == null ? void 0 : b[0];
5427
+ var g;
5428
+ const f = (g = this.input.files) == null ? void 0 : g[0];
5423
5429
  this.input.value = "", f && this.run(() => this.api.load(f), "环境已应用");
5424
5430
  }), this.update(this.state);
5425
5431
  }
@@ -5465,12 +5471,12 @@ class Fa {
5465
5471
  const t = $a(e);
5466
5472
  this.syncPresetCards(t);
5467
5473
  const i = e.active === "default" ? e.activePresetIndex ?? 0 : null;
5468
- this.element.dataset.busy = String(e.loading), this.defaultCard.root.dataset.selected = String(i === 0), this.customCard.root.dataset.selected = String(e.active === "custom"), this.defaultCard.select.setAttribute("aria-pressed", String(i === 0)), this.customCard.select.setAttribute("aria-pressed", String(e.active === "custom")), this.defaultCard.name.textContent = ((n = t[0]) == null ? void 0 : n.name) ?? "默认环境", this.defaultCard.format.textContent = t[0] ? vt(t[0]) : "HDR";
5474
+ this.element.dataset.busy = String(e.loading), this.defaultCard.root.dataset.selected = String(i === 0), this.customCard.root.dataset.selected = String(e.active === "custom"), this.defaultCard.select.setAttribute("aria-pressed", String(i === 0)), this.customCard.select.setAttribute("aria-pressed", String(e.active === "custom")), this.defaultCard.name.textContent = ((n = t[0]) == null ? void 0 : n.name) ?? "默认环境", this.defaultCard.format.textContent = t[0] ? gt(t[0]) : "HDR";
5469
5475
  for (let a = 0; a < this.presetCards.length; a += 1) {
5470
5476
  const o = this.presetCards[a], l = t[a + 1];
5471
- o.root.dataset.selected = String(i === a + 1), o.select.setAttribute("aria-pressed", String(i === a + 1)), o.select.disabled = e.loading, o.name.textContent = (l == null ? void 0 : l.name) ?? `预设环境 ${a + 2}`, o.format.textContent = l ? vt(l) : "HDR";
5477
+ o.root.dataset.selected = String(i === a + 1), o.select.setAttribute("aria-pressed", String(i === a + 1)), o.select.disabled = e.loading, o.name.textContent = (l == null ? void 0 : l.name) ?? `预设环境 ${a + 2}`, o.format.textContent = l ? gt(l) : "HDR";
5472
5478
  }
5473
- if (this.customCard.name.textContent = ((s = e.customEnvironment) == null ? void 0 : s.name) ?? "上传自定义环境", this.customCard.format.textContent = e.customEnvironment ? vt(e.customEnvironment) : "HDR / JPG / PNG", this.customCard.root.dataset.empty = String(!e.customEnvironment), this.customCard.replace.hidden = !e.customEnvironment, this.customCard.select.disabled = e.loading, this.defaultCard.select.disabled = e.loading, this.customCard.replace.disabled = e.loading, this.closeButton.disabled = e.loading, this.backgroundToggle.checked = e.backgroundVisible, this.rotation.input.value = String(e.rotation), this.rotation.output.value = Sn(e.rotation), this.rotationPanel.hidden = !e.rotationAvailable, this.status.textContent = e.loading ? "正在应用环境..." : this.message, this.status.dataset.kind = this.message.startsWith("环境加载失败") ? "error" : "hint", !!this.opened) {
5479
+ if (this.customCard.name.textContent = ((s = e.customEnvironment) == null ? void 0 : s.name) ?? "上传自定义环境", this.customCard.format.textContent = e.customEnvironment ? gt(e.customEnvironment) : "HDR / JPG / PNG", this.customCard.root.dataset.empty = String(!e.customEnvironment), this.customCard.replace.hidden = !e.customEnvironment, this.customCard.select.disabled = e.loading, this.defaultCard.select.disabled = e.loading, this.customCard.replace.disabled = e.loading, this.closeButton.disabled = e.loading, this.backgroundToggle.checked = e.backgroundVisible, this.rotation.input.value = String(e.rotation), this.rotation.output.value = Sn(e.rotation), this.rotationPanel.hidden = !e.rotationAvailable, this.status.textContent = e.loading ? "正在应用环境..." : this.message, this.status.dataset.kind = this.message.startsWith("环境加载失败") ? "error" : "hint", !!this.opened) {
5474
5480
  t[0] ? this.defaultPreview.load(this.defaultCard, t[0]) : this.defaultPreview.clear(this.defaultCard);
5475
5481
  for (let a = 0; a < this.presetCards.length; a += 1) {
5476
5482
  const o = t[a + 1], l = this.presetCards[a], d = this.presetPreviews[a];
@@ -5495,7 +5501,7 @@ class Fa {
5495
5501
  for (; this.presetCards.length > t; )
5496
5502
  (i = this.presetPreviews.pop()) == null || i.dispose(), (n = this.presetCards.pop()) == null || n.root.remove();
5497
5503
  for (; this.presetCards.length < t; ) {
5498
- const s = this.presetCards.length + 1, a = this.createCard(`预设环境 ${s + 1}`, !1), o = new ft();
5504
+ const s = this.presetCards.length + 1, a = this.createCard(`预设环境 ${s + 1}`, !1), o = new vt();
5499
5505
  a.select.addEventListener("click", () => {
5500
5506
  this.run(() => this.api.usePreset(s));
5501
5507
  }), this.presetCards.push(a), this.presetPreviews.push(o), this.list.insertBefore(a.root, this.customCard.root);
@@ -5511,14 +5517,14 @@ class Fa {
5511
5517
  const a = document.createElement("canvas");
5512
5518
  a.width = 128, a.height = 128, a.setAttribute("aria-hidden", "true");
5513
5519
  const o = document.createElement("span");
5514
- o.className = "vpu-environment-fallback", o.innerHTML = dt(t ? "image" : "environment"), s.append(a, o);
5520
+ o.className = "vpu-environment-fallback", o.innerHTML = ct(t ? "image" : "environment"), s.append(a, o);
5515
5521
  const l = document.createElement("span");
5516
5522
  l.className = "vpu-environment-format";
5517
5523
  const d = document.createElement("span");
5518
5524
  d.className = "vpu-environment-meta";
5519
5525
  const c = document.createElement("span");
5520
5526
  c.className = "vpu-environment-name", d.append(c), n.append(s, d);
5521
- const p = t ? Mi("更换自定义环境", "upload") : void 0;
5527
+ const p = t ? Ri("更换自定义环境", "upload") : void 0;
5522
5528
  return p && (p.className = "vpu-environment-replace", p.hidden = !0), i.append(n, l, ...p ? [p] : []), { root: i, select: n, canvas: a, fallback: o, format: l, name: c, replace: p };
5523
5529
  }
5524
5530
  async run(e, t = "") {
@@ -5548,7 +5554,7 @@ class Fa {
5548
5554
  this.pendingRotationValue = null, e !== null && this.setRotation(e);
5549
5555
  }
5550
5556
  }
5551
- class ft {
5557
+ class vt {
5552
5558
  constructor() {
5553
5559
  u(this, "key", "");
5554
5560
  u(this, "generation", 0);
@@ -5591,7 +5597,7 @@ class ft {
5591
5597
  if (this.renderer && this.canvas === e) return this.renderer;
5592
5598
  (a = this.mesh) == null || a.geometry.dispose(), (o = this.mesh) == null || o.material.dispose(), (l = this.renderer) == null || l.dispose(), (d = this.renderer) == null || d.forceContextLoss();
5593
5599
  const t = new ln({ canvas: e, alpha: !0, antialias: !0, powerPreference: "low-power" });
5594
- t.setPixelRatio(1), t.setSize(128, 128, !1), t.outputColorSpace = Ft, t.toneMapping = Un, t.toneMappingExposure = 1.05;
5600
+ t.setPixelRatio(1), t.setSize(128, 128, !1), t.outputColorSpace = zt, t.toneMapping = Un, t.toneMappingExposure = 1.05;
5595
5601
  const i = new $e(), n = new _n({
5596
5602
  color: 16777215,
5597
5603
  metalness: 1,
@@ -5607,11 +5613,11 @@ class ft {
5607
5613
  }
5608
5614
  const kn = new dn(32, 1, 0.1, 10);
5609
5615
  kn.position.set(0, 0, 3.4);
5610
- function Mi(r, e) {
5616
+ function Ri(r, e) {
5611
5617
  const t = document.createElement("button");
5612
- return t.type = "button", t.className = "vpu-environment-icon", t.innerHTML = dt(e), t.title = r, t.setAttribute("aria-label", r), t;
5618
+ return t.type = "button", t.className = "vpu-environment-icon", t.innerHTML = ct(e), t.title = r, t.setAttribute("aria-label", r), t;
5613
5619
  }
5614
- function vt(r) {
5620
+ function gt(r) {
5615
5621
  var e;
5616
5622
  return r.type === "hdr" ? "HDR" : ((e = r.name.split(".").pop()) == null ? void 0 : e.toUpperCase()) ?? "IMAGE";
5617
5623
  }
@@ -5636,10 +5642,10 @@ function $a(r) {
5636
5642
  }
5637
5643
  async function Va(r) {
5638
5644
  let e;
5639
- return r.type === "hdr" ? e = await new hn().loadAsync(r.url) : (e = await new un().loadAsync(r.url), e.colorSpace = Ft), e.mapping = Me, e;
5645
+ return r.type === "hdr" ? e = await new hn().loadAsync(r.url) : (e = await new un().loadAsync(r.url), e.colorSpace = zt), e.mapping = Me, e;
5640
5646
  }
5641
5647
  const je = 1;
5642
- function Ql(r) {
5648
+ function ed(r) {
5643
5649
  if (!Number.isFinite(r) || r <= 0) return je;
5644
5650
  const e = r / 16, t = 10 ** Math.floor(Math.log10(e)), i = e / t;
5645
5651
  return (i >= 5 ? 5 : i >= 2.5 ? 2.5 : i >= 2 ? 2 : 1) * t;
@@ -5833,6 +5839,16 @@ const Ya = `
5833
5839
  }
5834
5840
  .vpu-toolbar[data-theme="light"] .vpu-filename { text-shadow: 0 1px 2px rgba(255, 255, 255, 0.7); }
5835
5841
  .vpu-filename[hidden] { display: none; }
5842
+ .vpu-toolbar-spinner {
5843
+ flex: 0 0 auto;
5844
+ width: 14px;
5845
+ height: 14px;
5846
+ border-radius: 50%;
5847
+ border: 2px solid color-mix(in srgb, var(--vpu-active) 28%, transparent);
5848
+ border-top-color: var(--vpu-active);
5849
+ animation: vpu-spin 0.9s linear infinite;
5850
+ }
5851
+ .vpu-toolbar-spinner[hidden] { display: none; }
5836
5852
  .vpu-actions {
5837
5853
  display: inline-flex;
5838
5854
  align-items: center;
@@ -6256,6 +6272,7 @@ const Ya = `
6256
6272
  }
6257
6273
  @media (prefers-reduced-motion: reduce) {
6258
6274
  .vpu-status-spinner { animation: none; }
6275
+ .vpu-toolbar-spinner { animation: none; }
6259
6276
  .vpu-joint-scene-dot,.vpu-joint-scene-pin,.vpu-joint-map-node { transition: none; }
6260
6277
  }
6261
6278
  `, st = /* @__PURE__ */ new Set(["revolute", "continuous", "prismatic"]);
@@ -6342,7 +6359,7 @@ function Xa(r) {
6342
6359
  var e;
6343
6360
  return (e = r.label) != null && e.trim() ? r.label.trim() : r.name.split("/").filter(Boolean).pop() ?? r.name;
6344
6361
  }
6345
- function gt(r, e) {
6362
+ function bt(r, e) {
6346
6363
  const t = new Map(r.map((o) => [o.id, o])), i = t.get(e);
6347
6364
  if (!i || !st.has(i.type)) return null;
6348
6365
  let n = i, s = 1;
@@ -6387,8 +6404,8 @@ class Ka {
6387
6404
  const n = e.clientX - t.x, s = e.clientY - t.y;
6388
6405
  let a, o;
6389
6406
  if (t.corner) {
6390
- const l = t.corner.endsWith("w"), d = t.corner.startsWith("n"), c = t.left + t.width, p = t.top + t.height, h = Math.min(i.maxWidth, l ? c - i.left : i.right - t.left), m = Math.min(i.maxHeight, d ? p - i.top : i.bottom - t.top), f = le(t.width + (l ? -n : n), i.minWidth, h), b = le(t.height + (d ? -s : s), i.minHeight, m);
6391
- a = l ? c - f : t.left, o = d ? p - b : t.top, this.resizedHeight = b, this.element.style.width = `${f}px`, this.element.style.height = `${b}px`;
6407
+ const l = t.corner.endsWith("w"), d = t.corner.startsWith("n"), c = t.left + t.width, p = t.top + t.height, h = Math.min(i.maxWidth, l ? c - i.left : i.right - t.left), m = Math.min(i.maxHeight, d ? p - i.top : i.bottom - t.top), f = le(t.width + (l ? -n : n), i.minWidth, h), g = le(t.height + (d ? -s : s), i.minHeight, m);
6408
+ a = l ? c - f : t.left, o = d ? p - g : t.top, this.resizedHeight = g, this.element.style.width = `${f}px`, this.element.style.height = `${g}px`;
6392
6409
  } else
6393
6410
  a = le(t.left + n, i.left, i.right - t.width), o = le(t.top + s, i.top, i.bottom - t.height);
6394
6411
  this.element.style.left = `${a}px`, this.element.style.top = `${o}px`;
@@ -6436,10 +6453,10 @@ class Ka {
6436
6453
  if (!e) return null;
6437
6454
  const t = e.getBoundingClientRect(), i = e.clientWidth || t.width, n = e.clientHeight || t.height;
6438
6455
  if (i <= 0 || n <= 0) return null;
6439
- const s = t.left + e.clientLeft - e.scrollLeft, a = t.top + e.clientTop - e.scrollTop, o = this.view.visualViewport, l = (o == null ? void 0 : o.offsetLeft) ?? 0, d = (o == null ? void 0 : o.offsetTop) ?? 0, c = (o == null ? void 0 : o.width) ?? this.view.innerWidth, p = (o == null ? void 0 : o.height) ?? this.view.innerHeight, h = Math.max(0, l - s) + 8, m = Math.max(0, d - a) + 8, f = Math.min(i, l + c - s) - 8, b = Math.min(n, d + p - a) - 8;
6440
- if (f <= h || b <= m) return null;
6441
- const y = Math.min(560, f - h), v = Math.min(p * 0.8, b - m);
6442
- return { originX: s, originY: a, left: h, top: m, right: f, bottom: b, minWidth: Math.min(280, y), minHeight: Math.min(280, v), maxWidth: y, maxHeight: v };
6456
+ const s = t.left + e.clientLeft - e.scrollLeft, a = t.top + e.clientTop - e.scrollTop, o = this.view.visualViewport, l = (o == null ? void 0 : o.offsetLeft) ?? 0, d = (o == null ? void 0 : o.offsetTop) ?? 0, c = (o == null ? void 0 : o.width) ?? this.view.innerWidth, p = (o == null ? void 0 : o.height) ?? this.view.innerHeight, h = Math.max(0, l - s) + 8, m = Math.max(0, d - a) + 8, f = Math.min(i, l + c - s) - 8, g = Math.min(n, d + p - a) - 8;
6457
+ if (f <= h || g <= m) return null;
6458
+ const b = Math.min(560, f - h), x = Math.min(p * 0.8, g - m);
6459
+ return { originX: s, originY: a, left: h, top: m, right: f, bottom: g, minWidth: Math.min(280, b), minHeight: Math.min(280, x), maxWidth: b, maxHeight: x };
6443
6460
  }
6444
6461
  start(e, t, i) {
6445
6462
  var a;
@@ -6505,12 +6522,12 @@ class Ja {
6505
6522
  var l;
6506
6523
  const t = this.dialGesture;
6507
6524
  if (!t || t.pointerId !== e.pointerId) return;
6508
- const i = Ai(t.dial, e);
6525
+ const i = Ii(t.dial, e);
6509
6526
  if (i === null) return;
6510
6527
  e.preventDefault(), e.stopPropagation();
6511
6528
  const n = eo(i - t.previousAngle);
6512
6529
  t.previousAngle = i;
6513
- const s = Ii(t.joint, t.value), a = t.joint.unit === "rad" ? t.value + n * Math.PI / 180 : t.value + n / 270 * (s.upper - s.lower), o = Math.max(s.lower, Math.min(s.upper, a));
6530
+ const s = Li(t.joint, t.value), a = t.joint.unit === "rad" ? t.value + n * Math.PI / 180 : t.value + n / 270 * (s.upper - s.lower), o = Math.max(s.lower, Math.min(s.upper, a));
6514
6531
  !Number.isFinite(o) || o === t.value || (t.value = o, (l = this.inspection) == null || l.setJointValue(t.joint.id, o));
6515
6532
  });
6516
6533
  u(this, "endDialGesture", (e) => {
@@ -6567,18 +6584,18 @@ class Ja {
6567
6584
  const a = e.playing && e.controlMode === "kinematic" && e.previewing === !0, o = e.playing && !a;
6568
6585
  o && this.dialGesture && this.stopDialGesture(), this.hint.textContent = a ? "关节动画播放中,拖动或输入可暂停并调整;联动关节同步跟随。" : e.playing ? "仿真播放中,暂停后可手动调整关节。" : e.previewing ? "正在自动展示关节运动,结束后回到默认姿态。手动调整可立即中止展示。" : e.controlMode === "physics" ? "暂停中,拖动或输入目标位置,通过物理驱动调整关节;遇到有效碰撞会受阻。播放仿真时从默认姿态开始。" : e.controlMode === "kinematic" ? "暂停中,可直接点选并拖动三维关节点或相连部件,也可调节主驱动关节;联动关节同步跟随。" : "暂停中,可拖动或输入关节位置。", this.unitToggle.textContent = this.angleUnit === "deg" ? "°" : "rad", this.unitToggle.setAttribute("aria-pressed", String(this.angleUnit === "deg")), this.reset.disabled = o;
6569
6586
  for (const p of this.plan.drivers) {
6570
- const h = this.rows.get(p.id), m = p.unit === "rad" && this.angleUnit === "deg" ? 180 / Math.PI : 1, f = p.unit === "m" ? "m" : this.angleUnit === "deg" ? "°" : "rad", b = e.jointValues[p.id] ?? e.jointValues[p.name] ?? p.defaultValue, y = e.controlMode === "physics", v = y ? ((d = e.jointTargets) == null ? void 0 : d[p.id]) ?? ((c = e.jointTargets) == null ? void 0 : c[p.name]) ?? b : b, g = Ii(p, v), w = o;
6571
- w && this.numberDrafts.delete(p.id), h.element.hidden = n !== p.id, h.element.classList.toggle("is-selected", n === p.id), h.slider.disabled = h.value.disabled = h.reset.disabled = w, h.dialKnobHit.style.pointerEvents = w ? "none" : "all", h.slider.min = h.value.min = String(g.lower * m), h.slider.max = h.value.max = String(g.upper * m), h.slider.value = String(v * m);
6572
- const x = h.value.getRootNode();
6573
- if ((w || x.activeElement !== h.value || !this.numberDrafts.has(p.id)) && (h.value.value = _(v * m)), h.slider.dataset.factor = h.value.dataset.factor = String(m), h.unit.textContent = f, h.limits.textContent = `${_(g.lower * m)} — ${_(g.upper * m)} ${f}`, h.current.textContent = `${_(b * m)} ${f}`, h.rangeSummary.textContent = `${_(g.lower * m)} to ${_(g.upper * m)} ${f} · home ${_(p.defaultValue * m)} ${f}`, h.rangeSummary.title = h.rangeSummary.textContent, Qa(h, p, b, g), h.feedback.hidden = !y, y) {
6574
- const k = Math.abs(b - v) > (p.unit === "rad" ? Math.PI / 1800 : 1e-4);
6575
- h.feedback.textContent = `实际 ${_(b * m)} ${f} · 目标 ${_(v * m)} ${f}${k ? "(尚未到达)" : ""}`, h.feedback.classList.toggle("is-pending", k), h.feedback.title = "实际位置由物理求解决定;尚未到达目标时,关节可能仍在运动或受到碰撞约束。";
6587
+ const h = this.rows.get(p.id), m = p.unit === "rad" && this.angleUnit === "deg" ? 180 / Math.PI : 1, f = p.unit === "m" ? "m" : this.angleUnit === "deg" ? "°" : "rad", g = e.jointValues[p.id] ?? e.jointValues[p.name] ?? p.defaultValue, b = e.controlMode === "physics", x = b ? ((d = e.jointTargets) == null ? void 0 : d[p.id]) ?? ((c = e.jointTargets) == null ? void 0 : c[p.name]) ?? g : g, v = Li(p, x), w = o;
6588
+ w && this.numberDrafts.delete(p.id), h.element.hidden = n !== p.id, h.element.classList.toggle("is-selected", n === p.id), h.slider.disabled = h.value.disabled = h.reset.disabled = w, h.dialKnobHit.style.pointerEvents = w ? "none" : "all", h.slider.min = h.value.min = String(v.lower * m), h.slider.max = h.value.max = String(v.upper * m), h.slider.value = String(x * m);
6589
+ const y = h.value.getRootNode();
6590
+ if ((w || y.activeElement !== h.value || !this.numberDrafts.has(p.id)) && (h.value.value = B(x * m)), h.slider.dataset.factor = h.value.dataset.factor = String(m), h.unit.textContent = f, h.limits.textContent = `${B(v.lower * m)} — ${B(v.upper * m)} ${f}`, h.current.textContent = `${B(g * m)} ${f}`, h.rangeSummary.textContent = `${B(v.lower * m)} to ${B(v.upper * m)} ${f} · home ${B(p.defaultValue * m)} ${f}`, h.rangeSummary.title = h.rangeSummary.textContent, Qa(h, p, g, v), h.feedback.hidden = !b, b) {
6591
+ const k = Math.abs(g - x) > (p.unit === "rad" ? Math.PI / 1800 : 1e-4);
6592
+ h.feedback.textContent = `实际 ${B(g * m)} ${f} · 目标 ${B(x * m)} ${f}${k ? "(尚未到达)" : ""}`, h.feedback.classList.toggle("is-pending", k), h.feedback.title = "实际位置由物理求解决定;尚未到达目标时,关节可能仍在运动或受到碰撞约束。";
6576
6593
  }
6577
- h.slider.setAttribute("aria-label", `${p.name} ${y ? "目标位置" : "位置"}`), h.value.setAttribute("aria-label", `${p.name} ${y ? "目标位置数值" : "位置数值"}`), h.name.setAttribute("aria-pressed", String(n === p.id));
6594
+ h.slider.setAttribute("aria-label", `${p.name} ${b ? "目标位置" : "位置"}`), h.value.setAttribute("aria-label", `${p.name} ${b ? "目标位置数值" : "位置数值"}`), h.name.setAttribute("aria-pressed", String(n === p.id));
6578
6595
  const C = this.cards.get(p.id);
6579
6596
  if (C) {
6580
- C.value.textContent = `${_(b * m)} ${f}`;
6581
- const k = g.upper - g.lower, E = k > 0 ? Math.max(0, Math.min(1, (b - g.lower) / k)) : 0;
6597
+ C.value.textContent = `${B(g * m)} ${f}`;
6598
+ const k = v.upper - v.lower, E = k > 0 ? Math.max(0, Math.min(1, (g - v.lower) / k)) : 0;
6582
6599
  C.progress.style.width = `${E * 100}%`;
6583
6600
  }
6584
6601
  }
@@ -6586,8 +6603,8 @@ class Ja {
6586
6603
  for (const h of p) {
6587
6604
  const m = this.followerRows.get(h.id);
6588
6605
  if (!m) continue;
6589
- const f = h.unit === "rad" && this.angleUnit === "deg" ? 180 / Math.PI : 1, b = h.unit === "m" ? "m" : this.angleUnit === "deg" ? "°" : "rad", y = e.jointValues[h.id] ?? e.jointValues[h.name] ?? h.defaultValue;
6590
- m.value.textContent = `${_(y * f)} ${b}`, m.element.classList.toggle("is-selected", e.selectedJointId === h.id);
6606
+ const f = h.unit === "rad" && this.angleUnit === "deg" ? 180 / Math.PI : 1, g = h.unit === "m" ? "m" : this.angleUnit === "deg" ? "°" : "rad", b = e.jointValues[h.id] ?? e.jointValues[h.name] ?? h.defaultValue;
6607
+ m.value.textContent = `${B(b * f)} ${g}`, m.element.classList.toggle("is-selected", e.selectedJointId === h.id);
6591
6608
  }
6592
6609
  for (const p of this.map.querySelectorAll("[data-map-joint]")) {
6593
6610
  const h = p.dataset.mapJoint === n;
@@ -6605,13 +6622,13 @@ class Ja {
6605
6622
  s.className = "vpu-joint-heading";
6606
6623
  const a = document.createElement("button");
6607
6624
  a.type = "button", a.className = "vpu-joint-name", a.textContent = e.labels.get(i.id) ?? We(i), a.title = `${i.name} · ${i.type}`, a.addEventListener("click", () => {
6608
- var j;
6609
- return (j = this.inspection) == null ? void 0 : j.select(i.id);
6625
+ var O;
6626
+ return (O = this.inspection) == null ? void 0 : O.select(i.id);
6610
6627
  });
6611
6628
  const o = document.createElement("button");
6612
6629
  o.type = "button", o.className = "vpu-joint-reset", o.textContent = "Home", o.title = `恢复 ${i.name} 默认位置`, o.setAttribute("aria-label", o.title), o.addEventListener("click", () => {
6613
- var j;
6614
- return (j = this.inspection) == null ? void 0 : j.resetJoint(i.id);
6630
+ var O;
6631
+ return (O = this.inspection) == null ? void 0 : O.resetJoint(i.id);
6615
6632
  }), s.append(a);
6616
6633
  const l = document.createElementNS("http://www.w3.org/2000/svg", "svg");
6617
6634
  l.classList.add("vpu-joint-dial"), l.setAttribute("viewBox", "0 0 104 104"), l.setAttribute("aria-hidden", "true");
@@ -6626,19 +6643,19 @@ class Ja {
6626
6643
  const m = document.createElementNS("http://www.w3.org/2000/svg", "line");
6627
6644
  m.classList.add("vpu-joint-dial-needle");
6628
6645
  const f = document.createElementNS("http://www.w3.org/2000/svg", "circle");
6629
- f.setAttribute("r", "10"), f.classList.add("vpu-joint-dial-hit"), f.style.pointerEvents = "all", f.style.touchAction = "none", f.addEventListener("pointerdown", (j) => this.startDialGesture(i, l, f, j)), f.addEventListener("pointermove", this.moveDialGesture), f.addEventListener("pointerup", this.endDialGesture), f.addEventListener("pointercancel", this.endDialGesture), f.addEventListener("lostpointercapture", this.endDialGesture);
6646
+ f.setAttribute("r", "10"), f.classList.add("vpu-joint-dial-hit"), f.style.pointerEvents = "all", f.style.touchAction = "none", f.addEventListener("pointerdown", (O) => this.startDialGesture(i, l, f, O)), f.addEventListener("pointermove", this.moveDialGesture), f.addEventListener("pointerup", this.endDialGesture), f.addEventListener("pointercancel", this.endDialGesture), f.addEventListener("lostpointercapture", this.endDialGesture);
6647
+ const g = document.createElementNS("http://www.w3.org/2000/svg", "circle");
6648
+ g.setAttribute("r", "4.5"), g.classList.add("vpu-joint-dial-knob");
6630
6649
  const b = document.createElementNS("http://www.w3.org/2000/svg", "circle");
6631
- b.setAttribute("r", "4.5"), b.classList.add("vpu-joint-dial-knob");
6632
- const y = document.createElementNS("http://www.w3.org/2000/svg", "circle");
6633
- y.setAttribute("cx", "52"), y.setAttribute("cy", "52"), y.setAttribute("r", "3.4"), y.classList.add("vpu-joint-dial-center"), l.append(d, c, p, h, m, f, b, y);
6634
- const v = document.createElement("strong");
6635
- v.className = "vpu-joint-current";
6636
- const g = document.createElement("small");
6637
- g.className = "vpu-joint-range-summary";
6650
+ b.setAttribute("cx", "52"), b.setAttribute("cy", "52"), b.setAttribute("r", "3.4"), b.classList.add("vpu-joint-dial-center"), l.append(d, c, p, h, m, f, g, b);
6651
+ const x = document.createElement("strong");
6652
+ x.className = "vpu-joint-current";
6653
+ const v = document.createElement("small");
6654
+ v.className = "vpu-joint-range-summary";
6638
6655
  const w = document.createElement("div");
6639
6656
  w.className = "vpu-joint-inspector-main";
6640
- const x = document.createElement("div");
6641
- x.className = "vpu-joint-inspector-summary", x.append(s, v, g), w.append(l, x);
6657
+ const y = document.createElement("div");
6658
+ y.className = "vpu-joint-inspector-summary", y.append(s, x, v), w.append(l, y);
6642
6659
  const C = document.createElement("small");
6643
6660
  C.className = "vpu-joint-relation", C.textContent = `${Ge(i.parent)} → ${Ge(i.child)}`, C.title = `${i.parent ?? "世界"} → ${i.child ?? "未绑定"}`;
6644
6661
  const k = document.createElement("div");
@@ -6647,52 +6664,52 @@ class Ja {
6647
6664
  E.type = "range", E.step = "any", E.setAttribute("aria-label", `${i.name} 位置`);
6648
6665
  const P = document.createElement("input");
6649
6666
  P.type = "number", P.step = "any", P.setAttribute("aria-label", `${i.name} 位置数值`);
6650
- const I = (j) => {
6651
- var O, T;
6652
- const Q = j.valueAsNumber;
6653
- Number.isFinite(Q) && ((O = this.inspection) == null || O.select(i.id), (T = this.inspection) == null || T.setJointValue(i.id, Q / Number(j.dataset.factor ?? 1)));
6667
+ const D = (O) => {
6668
+ var S, A;
6669
+ const G = O.valueAsNumber;
6670
+ Number.isFinite(G) && ((S = this.inspection) == null || S.select(i.id), (A = this.inspection) == null || A.setJointValue(i.id, G / Number(O.dataset.factor ?? 1)));
6654
6671
  };
6655
- E.addEventListener("input", () => I(E)), P.addEventListener("input", () => this.numberDrafts.add(i.id)), P.addEventListener("change", () => {
6656
- this.numberDrafts.delete(i.id), I(P), P.blur(), this.inspection && this.render(this.inspection.getSnapshot());
6672
+ E.addEventListener("input", () => D(E)), P.addEventListener("input", () => this.numberDrafts.add(i.id)), P.addEventListener("change", () => {
6673
+ this.numberDrafts.delete(i.id), D(P), P.blur(), this.inspection && this.render(this.inspection.getSnapshot());
6657
6674
  }), P.addEventListener("blur", () => {
6658
6675
  this.numberDrafts.delete(i.id), this.inspection && this.render(this.inspection.getSnapshot());
6659
6676
  });
6660
- const D = document.createElement("span");
6661
- D.className = "vpu-joint-unit", k.append(E, P, D, o);
6662
- const S = document.createElement("small");
6663
- S.className = "vpu-joint-limits";
6664
- const U = document.createElement("small");
6665
- U.className = "vpu-joint-feedback", U.hidden = !0;
6666
- const L = document.createElement("div");
6667
- L.className = "vpu-joint-metadata", L.append(...Za(i)), n.append(w, C, k, U, S, L);
6668
- const V = e.followersByDriver.get(i.id) ?? [];
6669
- if (V.length) {
6670
- const j = document.createElement("details");
6671
- j.className = "vpu-joint-followers", j.dataset.driverId = i.id;
6672
- const Q = document.createElement("summary");
6673
- Q.textContent = `联动关节 ${V.length}`, j.append(Q);
6674
- for (const O of V) {
6675
- const T = document.createElement("div");
6676
- T.className = "vpu-joint-follower", T.dataset.jointId = O.id;
6677
- const B = document.createElement("button");
6678
- B.type = "button", B.className = "vpu-joint-name", B.textContent = e.labels.get(O.id) ?? We(O), B.title = `${O.name} · 由 ${i.name} 控制`, B.addEventListener("click", () => {
6677
+ const T = document.createElement("span");
6678
+ T.className = "vpu-joint-unit", k.append(E, P, T, o);
6679
+ const M = document.createElement("small");
6680
+ M.className = "vpu-joint-limits";
6681
+ const V = document.createElement("small");
6682
+ V.className = "vpu-joint-feedback", V.hidden = !0;
6683
+ const _ = document.createElement("div");
6684
+ _.className = "vpu-joint-metadata", _.append(...Za(i)), n.append(w, C, k, V, M, _);
6685
+ const H = e.followersByDriver.get(i.id) ?? [];
6686
+ if (H.length) {
6687
+ const O = document.createElement("details");
6688
+ O.className = "vpu-joint-followers", O.dataset.driverId = i.id;
6689
+ const G = document.createElement("summary");
6690
+ G.textContent = `联动关节 ${H.length}`, O.append(G);
6691
+ for (const S of H) {
6692
+ const A = document.createElement("div");
6693
+ A.className = "vpu-joint-follower", A.dataset.jointId = S.id;
6694
+ const j = document.createElement("button");
6695
+ j.type = "button", j.className = "vpu-joint-name", j.textContent = e.labels.get(S.id) ?? We(S), j.title = `${S.name} · 由 ${i.name} 控制`, j.addEventListener("click", () => {
6679
6696
  var Ue;
6680
6697
  return (Ue = this.inspection) == null ? void 0 : Ue.select(i.id);
6681
6698
  });
6682
6699
  const de = document.createElement("span");
6683
6700
  de.className = "vpu-joint-follower-value";
6684
6701
  const fe = document.createElement("div");
6685
- fe.className = "vpu-joint-heading", fe.append(B, de);
6702
+ fe.className = "vpu-joint-heading", fe.append(j, de);
6686
6703
  const ce = document.createElement("small");
6687
6704
  ce.className = "vpu-joint-mimic";
6688
- const oe = O.mimic ? t.get(O.mimic.joint) : void 0;
6689
- ce.textContent = O.mimic ? `跟随 ${(oe == null ? void 0 : oe.name) ?? O.mimic.joint} · × ${_(O.mimic.multiplier)}${O.mimic.offset ? ` ${O.mimic.offset < 0 ? "−" : "+"} ${_(Math.abs(O.mimic.offset))} ${O.unit}` : ""}` : `由 ${i.name} 联动控制`;
6705
+ const oe = S.mimic ? t.get(S.mimic.joint) : void 0;
6706
+ ce.textContent = S.mimic ? `跟随 ${(oe == null ? void 0 : oe.name) ?? S.mimic.joint} · × ${B(S.mimic.multiplier)}${S.mimic.offset ? ` ${S.mimic.offset < 0 ? "−" : "+"} ${B(Math.abs(S.mimic.offset))} ${S.unit}` : ""}` : `由 ${i.name} 联动控制`;
6690
6707
  const ve = document.createElement("small");
6691
- ve.className = "vpu-joint-relation", ve.textContent = `${Ge(O.parent)} → ${Ge(O.child)}`, ve.title = `${O.parent ?? "世界"} → ${O.child ?? "未绑定"}`, T.append(fe, ve, ce), this.followerRows.set(O.id, { element: T, value: de }), j.append(T);
6708
+ ve.className = "vpu-joint-relation", ve.textContent = `${Ge(S.parent)} → ${Ge(S.child)}`, ve.title = `${S.parent ?? "世界"} → ${S.child ?? "未绑定"}`, A.append(fe, ve, ce), this.followerRows.set(S.id, { element: A, value: de }), O.append(A);
6692
6709
  }
6693
- n.append(j);
6710
+ n.append(O);
6694
6711
  }
6695
- this.rows.set(i.id, { element: n, name: a, slider: E, value: P, unit: D, limits: S, feedback: U, reset: o, current: v, rangeSummary: g, dial: l, dialRange: c, dialWedge: p, dialNeedle: m, dialHome: h, dialKnobHit: f, dialKnob: b }), this.list.append(n);
6712
+ this.rows.set(i.id, { element: n, name: a, slider: E, value: P, unit: T, limits: M, feedback: V, reset: o, current: x, rangeSummary: v, dial: l, dialRange: c, dialWedge: p, dialNeedle: m, dialHome: h, dialKnobHit: f, dialKnob: g }), this.list.append(n);
6696
6713
  }
6697
6714
  }
6698
6715
  startDialGesture(e, t, i, n) {
@@ -6702,7 +6719,7 @@ class Ja {
6702
6719
  if (!s) return;
6703
6720
  const a = s.getSnapshot(), o = a.playing && a.controlMode === "kinematic" && a.previewing === !0;
6704
6721
  if (a.playing && !o) return;
6705
- const l = Ai(t, n);
6722
+ const l = Ii(t, n);
6706
6723
  if (l === null) return;
6707
6724
  const d = a.jointValues[e.id] ?? e.defaultValue;
6708
6725
  this.dialGesture = { pointerId: n.pointerId, joint: e, dial: t, hit: i, previousAngle: l, value: d }, i.classList.add("is-dragging"), i.style.cursor = "grabbing";
@@ -6766,14 +6783,14 @@ function We(r) {
6766
6783
  function Za(r) {
6767
6784
  var t;
6768
6785
  const e = [["type", r.type]];
6769
- if (r.movingMass != null && Number.isFinite(r.movingMass) && e.push(["moving mass", `${_(r.movingMass)} kg`]), (t = r.drive) != null && t.type) {
6786
+ if (r.movingMass != null && Number.isFinite(r.movingMass) && e.push(["moving mass", `${B(r.movingMass)} kg`]), (t = r.drive) != null && t.type) {
6770
6787
  const i = [
6771
- Number.isFinite(r.drive.stiffness) ? `k ${_(r.drive.stiffness)}` : "",
6772
- Number.isFinite(r.drive.damping) ? `d ${_(r.drive.damping)}` : ""
6788
+ Number.isFinite(r.drive.stiffness) ? `k ${B(r.drive.stiffness)}` : "",
6789
+ Number.isFinite(r.drive.damping) ? `d ${B(r.drive.damping)}` : ""
6773
6790
  ].filter(Boolean).join(" · ");
6774
6791
  e.push(["drive", `${r.drive.type}${i ? ` · ${i}` : ""}`]);
6775
6792
  }
6776
- return r.maxEffort != null && Number.isFinite(r.maxEffort) && Math.abs(r.maxEffort) < 1e9 && e.push(["max effort", `${_(r.maxEffort)} ${r.type === "revolute" ? "N·m" : "N"}`]), e.flatMap(([i, n]) => {
6793
+ return r.maxEffort != null && Number.isFinite(r.maxEffort) && Math.abs(r.maxEffort) < 1e9 && e.push(["max effort", `${B(r.maxEffort)} ${r.type === "revolute" ? "N·m" : "N"}`]), e.flatMap(([i, n]) => {
6777
6794
  const s = document.createElement("span");
6778
6795
  s.className = "vpu-joint-metadata-key", s.textContent = i;
6779
6796
  const a = document.createElement("span");
@@ -6784,21 +6801,21 @@ function ze(r, e) {
6784
6801
  const t = r * Math.PI / 180;
6785
6802
  return [52 + Math.sin(t) * e, 52 - Math.cos(t) * e];
6786
6803
  }
6787
- function Ri(r, e, t) {
6804
+ function Ai(r, e, t) {
6788
6805
  if (Math.abs(t - e) >= 359.5)
6789
6806
  return `M 52 ${52 - r} A ${r} ${r} 0 1 1 52 ${52 + r} A ${r} ${r} 0 1 1 52 ${52 - r}`;
6790
6807
  const [i, n] = ze(e, r), [s, a] = ze(t, r);
6791
6808
  return `M ${i} ${n} A ${r} ${r} 0 ${Math.abs(t - e) > 180 ? 1 : 0} ${t >= e ? 1 : 0} ${s} ${a}`;
6792
6809
  }
6793
6810
  function Qa(r, e, t, i) {
6794
- const n = i.upper - i.lower, s = (y) => e.unit === "rad" ? y * 180 / Math.PI : -135 + (n > 0 && Number.isFinite(n) ? Math.max(0, Math.min(1, (y - i.lower) / n)) : 0.5) * 270, a = s(t), o = s(e.defaultValue), [l, d] = ze(o, 35), [c, p] = ze(o, 49), h = Math.abs(a - o);
6795
- r.dialRange.setAttribute("d", Ri(43, s(i.lower), s(i.upper)));
6796
- const m = Ri(39, o, a);
6811
+ const n = i.upper - i.lower, s = (b) => e.unit === "rad" ? b * 180 / Math.PI : -135 + (n > 0 && Number.isFinite(n) ? Math.max(0, Math.min(1, (b - i.lower) / n)) : 0.5) * 270, a = s(t), o = s(e.defaultValue), [l, d] = ze(o, 35), [c, p] = ze(o, 49), h = Math.abs(a - o);
6812
+ r.dialRange.setAttribute("d", Ai(43, s(i.lower), s(i.upper)));
6813
+ const m = Ai(39, o, a);
6797
6814
  r.dialWedge.setAttribute("d", h < 0.5 ? "" : h >= 359.5 ? `${m} Z` : `M 52 52 L ${m.slice(2)} Z`), r.dialNeedle.setAttribute("x1", "52"), r.dialNeedle.setAttribute("y1", "52");
6798
- const [f, b] = ze(a, 40);
6799
- r.dialNeedle.setAttribute("x2", String(f)), r.dialNeedle.setAttribute("y2", String(b)), r.dialKnobHit.setAttribute("cx", String(f)), r.dialKnobHit.setAttribute("cy", String(b)), r.dialKnob.setAttribute("cx", String(f)), r.dialKnob.setAttribute("cy", String(b)), r.dialHome.setAttribute("x1", String(l)), r.dialHome.setAttribute("y1", String(d)), r.dialHome.setAttribute("x2", String(c)), r.dialHome.setAttribute("y2", String(p));
6815
+ const [f, g] = ze(a, 40);
6816
+ r.dialNeedle.setAttribute("x2", String(f)), r.dialNeedle.setAttribute("y2", String(g)), r.dialKnobHit.setAttribute("cx", String(f)), r.dialKnobHit.setAttribute("cy", String(g)), r.dialKnob.setAttribute("cx", String(f)), r.dialKnob.setAttribute("cy", String(g)), r.dialHome.setAttribute("x1", String(l)), r.dialHome.setAttribute("y1", String(d)), r.dialHome.setAttribute("x2", String(c)), r.dialHome.setAttribute("y2", String(p));
6800
6817
  }
6801
- function Ai(r, e) {
6818
+ function Ii(r, e) {
6802
6819
  const t = r.getBoundingClientRect();
6803
6820
  if (!(t.width > 0) || !(t.height > 0)) return null;
6804
6821
  const i = (e.clientX - t.left) / t.width * 104, n = (e.clientY - t.top) / t.height * 104, s = i - 52, a = 52 - n;
@@ -6810,20 +6827,20 @@ function eo(r) {
6810
6827
  function Ge(r) {
6811
6828
  return (r == null ? void 0 : r.split("/").filter(Boolean).pop()) ?? (r === null ? "世界" : "未绑定");
6812
6829
  }
6813
- function _(r) {
6830
+ function B(r) {
6814
6831
  return Number(r.toFixed(4)).toString();
6815
6832
  }
6816
- function Ii(r, e) {
6833
+ function Li(r, e) {
6817
6834
  const t = r.controlLimits ?? r.limits;
6818
6835
  if (t && Number.isFinite(t.lower) && Number.isFinite(t.upper) && t.lower <= t.upper) return t;
6819
6836
  const i = r.unit === "rad" ? Math.PI : 1, n = t && Number.isFinite(t.lower) ? t.lower : Math.min(-i, r.defaultValue, e), s = t && Number.isFinite(t.upper) ? t.upper : Math.max(i, r.defaultValue, e);
6820
6837
  return { lower: n, upper: Math.max(n, s) };
6821
6838
  }
6822
- const Li = "http://www.w3.org/2000/svg", ie = "var(--vpu-joint-highlight)", Di = { dark: "#21c7be", light: "#21c7be" }, to = 140, De = (r) => Number.isFinite(r.x) && Number.isFinite(r.y) && Number.isFinite(r.z), Ti = (r, e) => Number(r.toFixed(e)).toString(), bt = (r, e) => r.unit === "rad" ? `${Ti(e * 180 / Math.PI, 1)}°` : `${Ti(e, 4)} m`;
6839
+ const Di = "http://www.w3.org/2000/svg", ne = "var(--vpu-joint-highlight)", Ti = { dark: "#21c7be", light: "#21c7be" }, to = 140, De = (r) => Number.isFinite(r.x) && Number.isFinite(r.y) && Number.isFinite(r.z), Ni = (r, e) => Number(r.toFixed(e)).toString(), yt = (r, e) => r.unit === "rad" ? `${Ni(e * 180 / Math.PI, 1)}°` : `${Ni(e, 4)} m`;
6823
6840
  function Te(r) {
6824
6841
  return !r.playing || r.controlMode === "kinematic" && r.previewing === !0;
6825
6842
  }
6826
- function At(r) {
6843
+ function It(r) {
6827
6844
  const e = /* @__PURE__ */ new Set(), t = new Set(r);
6828
6845
  for (const i of t) {
6829
6846
  let n = !0;
@@ -6838,11 +6855,11 @@ function At(r) {
6838
6855
  }
6839
6856
  return e;
6840
6857
  }
6841
- function Ni(r) {
6842
- return Mn(At(r));
6858
+ function Oi(r) {
6859
+ return Mn(It(r));
6843
6860
  }
6844
6861
  function Mn(r) {
6845
- const e = new Z();
6862
+ const e = new Q();
6846
6863
  for (const t of r)
6847
6864
  (Array.isArray(t.material) ? t.material : [t.material]).some((n) => n.visible) && (t.updateWorldMatrix(!0, !1), t.geometry.boundingBox || t.geometry.computeBoundingBox(), t.geometry.boundingBox && e.union(t.geometry.boundingBox.clone().applyMatrix4(t.matrixWorld)));
6848
6865
  return e;
@@ -6894,9 +6911,9 @@ class ro {
6894
6911
  u(this, "joints", []);
6895
6912
  u(this, "plan", Fe([]));
6896
6913
  u(this, "occluded", /* @__PURE__ */ new Set());
6897
- u(this, "occlusionRay", new lt());
6898
- u(this, "rayScreen", new J());
6899
- u(this, "rayPoint", new M());
6914
+ u(this, "occlusionRay", new dt());
6915
+ u(this, "rayScreen", new Z());
6916
+ u(this, "rayPoint", new R());
6900
6917
  u(this, "lastOcclusion", -1 / 0);
6901
6918
  u(this, "occlusionTimer", null);
6902
6919
  u(this, "highlightColor");
@@ -6911,17 +6928,17 @@ class ro {
6911
6928
  u(this, "offsetX", 0);
6912
6929
  u(this, "offsetY", 0);
6913
6930
  var o;
6914
- this.inspection = e, this.options = t, this.highlightColor = new tt(((o = t.getHighlightColor) == null ? void 0 : o.call(t)) || Di[t.theme ?? "dark"]);
6931
+ this.inspection = e, this.options = t, this.highlightColor = new tt(((o = t.getHighlightColor) == null ? void 0 : o.call(t)) || Ti[t.theme ?? "dark"]);
6915
6932
  const i = t.canvas.ownerDocument;
6916
6933
  this.element = i.createElement("div"), this.element.className = "vpu-joint-scene-overlay", Object.assign(this.element.style, { position: "absolute", inset: "0", overflow: "hidden", pointerEvents: "none", zIndex: "4" }), this.element.style.setProperty("--vpu-joint-highlight", this.highlightColor.getStyle()), this.element.setAttribute("aria-label", "三维关节控制,拖动关节点或连接部件调整姿态");
6917
6934
  const n = (l, d, c) => {
6918
- const p = i.createElementNS(Li, l);
6935
+ const p = i.createElementNS(Di, l);
6919
6936
  for (const [h, m] of Object.entries(d)) p.setAttribute(h, m);
6920
6937
  return c.append(p), p;
6921
6938
  };
6922
- this.svg = i.createElementNS(Li, "svg"), this.svg.setAttribute("width", "100%"), this.svg.setAttribute("height", "100%"), this.svg.setAttribute("aria-hidden", "true"), Object.assign(this.svg.style, { position: "absolute", inset: "0", overflow: "visible", pointerEvents: "none" }), this.element.append(this.svg), this.dial = n("g", { class: "vpu-joint-dial", display: "none" }, this.svg);
6939
+ this.svg = i.createElementNS(Di, "svg"), this.svg.setAttribute("width", "100%"), this.svg.setAttribute("height", "100%"), this.svg.setAttribute("aria-hidden", "true"), Object.assign(this.svg.style, { position: "absolute", inset: "0", overflow: "visible", pointerEvents: "none" }), this.element.append(this.svg), this.dial = n("g", { class: "vpu-joint-dial", display: "none" }, this.svg);
6923
6940
  const s = { fill: "none", "stroke-linecap": "round", "stroke-linejoin": "round" };
6924
- this.wedge = n("path", { class: "vpu-joint-dial-wedge", fill: ie, "fill-opacity": ".22" }, this.dial), this.range = n("path", { ...s, class: "vpu-joint-dial-range", stroke: "#fff", "stroke-opacity": ".6", "stroke-width": "1.5" }, this.dial), this.progress = n("path", { ...s, class: "vpu-joint-dial-progress", stroke: ie, "stroke-width": "2.5" }, this.dial), this.lower = n("line", { ...s, stroke: "#fff", "stroke-width": "1.5" }, this.dial), this.upper = n("line", { ...s, stroke: "#fff", "stroke-width": "1.5" }, this.dial), this.home = n("line", { ...s, class: "vpu-joint-dial-home", stroke: "#fff", "stroke-dasharray": "3 3", "stroke-width": "2" }, this.dial), this.needle = n("line", { ...s, class: "vpu-joint-dial-needle", stroke: ie, "stroke-width": "2" }, this.dial), this.knob = n("circle", { class: "vpu-joint-dial-knob", r: "5", fill: ie, stroke: "#171717", "stroke-width": "1.5" }, this.dial), this.value = n("text", { class: "vpu-joint-dial-value", fill: ie, "font-size": "11", "font-weight": "700", "font-family": "ui-monospace, monospace", "text-anchor": "middle", "dominant-baseline": "central", stroke: "#171717", "stroke-width": "3", "paint-order": "stroke" }, this.dial), this.dialLineHit = n("line", { class: "vpu-joint-dial-line-hit", stroke: "transparent", "stroke-width": "16", "stroke-linecap": "round" }, this.dial), this.dialHit = n("circle", { class: "vpu-joint-dial-hit", r: "14", fill: "transparent" }, this.dial);
6941
+ this.wedge = n("path", { class: "vpu-joint-dial-wedge", fill: ne, "fill-opacity": ".22" }, this.dial), this.range = n("path", { ...s, class: "vpu-joint-dial-range", stroke: "#fff", "stroke-opacity": ".6", "stroke-width": "1.5" }, this.dial), this.progress = n("path", { ...s, class: "vpu-joint-dial-progress", stroke: ne, "stroke-width": "2.5" }, this.dial), this.lower = n("line", { ...s, stroke: "#fff", "stroke-width": "1.5" }, this.dial), this.upper = n("line", { ...s, stroke: "#fff", "stroke-width": "1.5" }, this.dial), this.home = n("line", { ...s, class: "vpu-joint-dial-home", stroke: "#fff", "stroke-dasharray": "3 3", "stroke-width": "2" }, this.dial), this.needle = n("line", { ...s, class: "vpu-joint-dial-needle", stroke: ne, "stroke-width": "2" }, this.dial), this.knob = n("circle", { class: "vpu-joint-dial-knob", r: "5", fill: ne, stroke: "#171717", "stroke-width": "1.5" }, this.dial), this.value = n("text", { class: "vpu-joint-dial-value", fill: ne, "font-size": "11", "font-weight": "700", "font-family": "ui-monospace, monospace", "text-anchor": "middle", "dominant-baseline": "central", stroke: "#171717", "stroke-width": "3", "paint-order": "stroke" }, this.dial), this.dialLineHit = n("line", { class: "vpu-joint-dial-line-hit", stroke: "transparent", "stroke-width": "16", "stroke-linecap": "round" }, this.dial), this.dialHit = n("circle", { class: "vpu-joint-dial-hit", r: "14", fill: "transparent" }, this.dial);
6925
6942
  const a = (l) => {
6926
6943
  Object.assign(l.style, { pointerEvents: "none", touchAction: "none", cursor: "grab" }), l.addEventListener("pointerdown", (d) => {
6927
6944
  const c = this.dial.dataset.jointId;
@@ -6940,7 +6957,7 @@ class ro {
6940
6957
  themeChanged(e) {
6941
6958
  var t, i;
6942
6959
  if (!this.disposed) {
6943
- this.highlightColor.set(((i = (t = this.options).getHighlightColor) == null ? void 0 : i.call(t)) || Di[e]), this.element.style.setProperty("--vpu-joint-highlight", this.highlightColor.getStyle());
6960
+ this.highlightColor.set(((i = (t = this.options).getHighlightColor) == null ? void 0 : i.call(t)) || Ti[e]), this.element.style.setProperty("--vpu-joint-highlight", this.highlightColor.getStyle());
6944
6961
  for (const n of this.highlights.values()) n.strength = -1;
6945
6962
  this.update(), this.options.requestRender();
6946
6963
  }
@@ -6956,42 +6973,42 @@ class ro {
6956
6973
  this.disposed || (this.pulsePending = !0, this.update());
6957
6974
  }
6958
6975
  update() {
6959
- var f, b, y;
6976
+ var f, g, b;
6960
6977
  if (this.disposed) return;
6961
6978
  const e = this.inspection.getSnapshot(), t = Te(e);
6962
6979
  this.joints !== e.joints && (this.joints = e.joints, this.plan = Fe(e.joints));
6963
- const i = new Map(e.joints.map((v) => [v.id, v])), n = this.plan.drivers, s = new Set(n.map((v) => v.id));
6964
- for (const [v, g] of this.pins)
6965
- s.has(v) || (g.button.remove(), this.pins.delete(v), this.bases.delete(v));
6980
+ const i = new Map(e.joints.map((x) => [x.id, x])), n = this.plan.drivers, s = new Set(n.map((x) => x.id));
6981
+ for (const [x, v] of this.pins)
6982
+ s.has(x) || (v.button.remove(), this.pins.delete(x), this.bases.delete(x));
6966
6983
  const a = this.options.canvas.getBoundingClientRect(), o = this.element.getBoundingClientRect();
6967
6984
  this.width = a.width || this.options.canvas.clientWidth || 1, this.height = a.height || this.options.canvas.clientHeight || 1, this.offsetX = a.left - o.left, this.offsetY = a.top - o.top;
6968
6985
  const l = this.options.getCamera();
6969
6986
  l.updateWorldMatrix(!0, !1);
6970
6987
  const d = this.plan.driverIds.get(e.selectedJointId ?? "") ?? null, c = this.plan.driverIds.get(this.hover ?? "") ?? null, p = this.plan.driverIds.get(this.dragging ?? "") ?? null, h = /* @__PURE__ */ new Map();
6971
6988
  if (t)
6972
- for (const v of n) {
6973
- const g = (b = (f = this.inspection).jointWorldFrame) == null ? void 0 : b.call(f, v.id), w = g && De(g.position) ? this.project(g.position, l) : null;
6974
- w && h.set(v.id, { world: g.position, point: w });
6989
+ for (const x of n) {
6990
+ const v = (g = (f = this.inspection).jointWorldFrame) == null ? void 0 : g.call(f, x.id), w = v && De(v.position) ? this.project(v.position, l) : null;
6991
+ w && h.set(x.id, { world: v.position, point: w });
6975
6992
  }
6976
6993
  this.updateOcclusion(h, l);
6977
- for (const v of n) {
6978
- const g = this.pins.get(v.id) ?? this.makePin(v), w = (y = h.get(v.id)) == null ? void 0 : y.point, x = !!w;
6979
- g.button.hidden = !x, g.button.style.display = x ? "grid" : "none", g.button.disabled = !t;
6980
- const C = this.jointValue(e, v);
6981
- g.button.setAttribute("aria-label", `${v.name} · ${bt(v, C)},拖动调整关节`), g.button.setAttribute("aria-pressed", String(d === v.id)), g.button.dataset.selected = String(d === v.id);
6982
- const k = v.id === d || v.id === c || v.id === p, E = this.occluded.has(v.id), P = E && !k;
6983
- if (g.button.dataset.occluded = String(E), g.label.textContent = `${v.name} · ${bt(v, C)}`, g.label.hidden = !k, g.button.style.opacity = P ? "0.4" : "1", g.button.style.zIndex = k ? "3" : P ? "1" : "2", g.button.style.cursor = p === v.id ? "grabbing" : "grab", g.dot.style.background = k ? ie : "rgba(12,12,12,.82)", g.dot.style.transform = k ? "scale(1.25)" : "none", g.dot.style.boxShadow = d === v.id ? `0 0 0 4px color-mix(in srgb, ${ie} 25%, transparent),0 0 0 1px #333` : "0 0 0 1px #333", w) {
6984
- g.button.style.transform = `translate(${w.x.toFixed(1)}px, ${w.y.toFixed(1)}px)`;
6985
- const I = w.x - this.offsetX > this.width - 180;
6986
- g.label.style.left = I ? "auto" : "24px", g.label.style.right = I ? "24px" : "auto";
6994
+ for (const x of n) {
6995
+ const v = this.pins.get(x.id) ?? this.makePin(x), w = (b = h.get(x.id)) == null ? void 0 : b.point, y = !!w;
6996
+ v.button.hidden = !y, v.button.style.display = y ? "grid" : "none", v.button.disabled = !t;
6997
+ const C = this.jointValue(e, x);
6998
+ v.button.setAttribute("aria-label", `${x.name} · ${yt(x, C)},拖动调整关节`), v.button.setAttribute("aria-pressed", String(d === x.id)), v.button.dataset.selected = String(d === x.id);
6999
+ const k = x.id === d || x.id === c || x.id === p, E = this.occluded.has(x.id), P = E && !k;
7000
+ if (v.button.dataset.occluded = String(E), v.label.textContent = `${x.name} · ${yt(x, C)}`, v.label.hidden = !k, v.button.style.opacity = P ? "0.4" : "1", v.button.style.zIndex = k ? "3" : P ? "1" : "2", v.button.style.cursor = p === x.id ? "grabbing" : "grab", v.dot.style.background = k ? ne : "rgba(12,12,12,.82)", v.dot.style.transform = k ? "scale(1.25)" : "none", v.dot.style.boxShadow = d === x.id ? `0 0 0 4px color-mix(in srgb, ${ne} 25%, transparent),0 0 0 1px #333` : "0 0 0 1px #333", w) {
7001
+ v.button.style.transform = `translate(${w.x.toFixed(1)}px, ${w.y.toFixed(1)}px)`;
7002
+ const D = w.x - this.offsetX > this.width - 180;
7003
+ v.label.style.left = D ? "auto" : "24px", v.label.style.right = D ? "24px" : "auto";
6987
7004
  }
6988
7005
  }
6989
7006
  this.startPendingPulse(), this.updateHighlights(e, d, c, p);
6990
7007
  const m = i.get(p ?? d ?? "");
6991
7008
  if (this.dial.setAttribute("display", "none"), this.dialLineHit.style.pointerEvents = "none", this.dialHit.style.pointerEvents = "none", t && m) {
6992
7009
  this.updateDial(e, m, l);
6993
- const v = this.dial.getAttribute("display") === "inline", g = p === m.id ? "grabbing" : "grab";
6994
- this.dialHit.style.pointerEvents = v ? "all" : "none", this.dialLineHit.style.pointerEvents = v && m.unit === "rad" ? "all" : "none", this.dialHit.style.cursor = g, this.dialLineHit.style.cursor = g;
7010
+ const x = this.dial.getAttribute("display") === "inline", v = p === m.id ? "grabbing" : "grab";
7011
+ this.dialHit.style.pointerEvents = x ? "all" : "none", this.dialLineHit.style.pointerEvents = x && m.unit === "rad" ? "all" : "none", this.dialHit.style.cursor = v, this.dialLineHit.style.cursor = v;
6995
7012
  }
6996
7013
  }
6997
7014
  dispose() {
@@ -7017,7 +7034,7 @@ class ro {
7017
7034
  height: "11px",
7018
7035
  margin: "-5.5px 0 0 -5.5px",
7019
7036
  boxSizing: "border-box",
7020
- border: `2px solid ${ie}`,
7037
+ border: `2px solid ${ne}`,
7021
7038
  borderRadius: "50%",
7022
7039
  pointerEvents: "none",
7023
7040
  opacity: "0",
@@ -7057,7 +7074,7 @@ class ro {
7057
7074
  const n = t.createElement("span");
7058
7075
  n.className = "vpu-joint-scene-dot", Object.assign(n.style, { width: "11px", height: "11px", boxSizing: "border-box", border: "2px solid #fff", borderRadius: "50%", pointerEvents: "none" });
7059
7076
  const s = t.createElement("span");
7060
- s.className = "vpu-joint-scene-label", Object.assign(s.style, { position: "absolute", top: "50%", transform: "translateY(-50%)", padding: "2px 6px", whiteSpace: "nowrap", border: `1px solid color-mix(in srgb, ${ie} 65%, transparent)`, borderRadius: "3px", background: "rgba(20,20,20,.9)", color: "#fff", font: "700 10px/1.3 ui-monospace, monospace", pointerEvents: "none" }), i.append(n, s), i.addEventListener("pointerdown", (o) => {
7077
+ s.className = "vpu-joint-scene-label", Object.assign(s.style, { position: "absolute", top: "50%", transform: "translateY(-50%)", padding: "2px 6px", whiteSpace: "nowrap", border: `1px solid color-mix(in srgb, ${ne} 65%, transparent)`, borderRadius: "3px", background: "rgba(20,20,20,.9)", color: "#fff", font: "700 10px/1.3 ui-monospace, monospace", pointerEvents: "none" }), i.append(n, s), i.addEventListener("pointerdown", (o) => {
7061
7078
  !this.disposed && Te(this.inspection.getSnapshot()) && o.button === 0 && this.options.onPointerDown(e.id, o);
7062
7079
  }), i.addEventListener("pointerenter", () => this.setHover(e.id)), i.addEventListener("pointerleave", () => {
7063
7080
  this.hover === e.id && this.setHover(null);
@@ -7096,18 +7113,18 @@ class ro {
7096
7113
  this.clearOcclusionTimer(), this.lastOcclusion = i, this.occluded.clear();
7097
7114
  const s = this.inspection.pickRoots();
7098
7115
  for (const p of s) p.updateWorldMatrix(!0, !0);
7099
- const a = [...At(s)];
7116
+ const a = [...It(s)];
7100
7117
  if (!a.length) return;
7101
- const o = Mn(a), l = o.isEmpty() ? 0 : o.getBoundingSphere(new Ht()).radius, d = Number.isFinite(l) ? Math.max(l * 0.09, 1e-8) : 1e-8, c = this.occlusionRay;
7118
+ const o = Mn(a), l = o.isEmpty() ? 0 : o.getBoundingSphere(new qt()).radius, d = Number.isFinite(l) ? Math.max(l * 0.09, 1e-8) : 1e-8, c = this.occlusionRay;
7102
7119
  c.layers.mask = t.layers.mask;
7103
7120
  for (const [p, { world: h }] of e) {
7104
7121
  this.rayPoint.copy(h).project(t), this.rayScreen.set(this.rayPoint.x, this.rayPoint.y), c.setFromCamera(this.rayScreen, t);
7105
7122
  const m = this.rayPoint.copy(h).sub(c.ray.origin).dot(c.ray.direction);
7106
7123
  if (this.rayPoint.set(this.rayScreen.x, this.rayScreen.y, -1).unproject(t), c.near = Math.max(0, this.rayPoint.sub(c.ray.origin).dot(c.ray.direction)), c.far = m - d, c.far <= c.near) continue;
7107
- c.intersectObjects(a, !1).some((b) => {
7108
- var g;
7109
- const y = b.object, v = Array.isArray(y.material) ? y.material[((g = b.face) == null ? void 0 : g.materialIndex) ?? 0] : y.material;
7110
- return (v == null ? void 0 : v.visible) && v.colorWrite && (!v.transparent || v.opacity > 0);
7124
+ c.intersectObjects(a, !1).some((g) => {
7125
+ var v;
7126
+ const b = g.object, x = Array.isArray(b.material) ? b.material[((v = g.face) == null ? void 0 : v.materialIndex) ?? 0] : b.material;
7127
+ return (x == null ? void 0 : x.visible) && x.colorWrite && (!x.transparent || x.opacity > 0);
7111
7128
  }) && this.occluded.add(p);
7112
7129
  }
7113
7130
  }
@@ -7126,7 +7143,7 @@ class ro {
7126
7143
  }
7127
7144
  }
7128
7145
  for (const { strength: o, roots: l } of a.values())
7129
- for (const d of At([...l]))
7146
+ for (const d of It([...l]))
7130
7147
  (Array.isArray(d.material) ? d.material : [d.material]).some((p) => p.visible) && s.set(d, Math.max(s.get(d) ?? 0, o));
7131
7148
  }
7132
7149
  for (const [a, o] of this.highlights)
@@ -7148,24 +7165,24 @@ class ro {
7148
7165
  for (const i of t.clones) i.dispose();
7149
7166
  }
7150
7167
  basis(e, t, i, n) {
7151
- var y, v, g, w, x, C;
7168
+ var b, x, v, w, y, C;
7152
7169
  const s = this.bases.get(e.id);
7153
7170
  if (s) return s;
7154
- const a = e.child ? (v = (y = this.inspection).objectForBody) == null ? void 0 : v.call(y, e.child) : null, o = Ni(a ? [a] : []), l = Ni(((w = (g = this.inspection).pickRoots) == null ? void 0 : w.call(g)) ?? []);
7155
- let d = l.isEmpty() ? 0 : l.getBoundingSphere(new Ht()).radius;
7171
+ const a = e.child ? (x = (b = this.inspection).objectForBody) == null ? void 0 : x.call(b, e.child) : null, o = Oi(a ? [a] : []), l = Oi(((w = (v = this.inspection).pickRoots) == null ? void 0 : w.call(v)) ?? []);
7172
+ let d = l.isEmpty() ? 0 : l.getBoundingSphere(new qt()).radius;
7156
7173
  (!(d > 0) || !Number.isFinite(d)) && (d = 0.1);
7157
- const p = (o.isEmpty() ? t.clone() : o.getCenter(new M())).sub(t);
7174
+ const p = (o.isEmpty() ? t.clone() : o.getCenter(new R())).sub(t);
7158
7175
  p.addScaledVector(i, -p.dot(i));
7159
7176
  let h = p.length();
7160
7177
  h < d * 1e-5 && (p.set(0, 1, 0), Math.abs(p.dot(i)) > 0.9 && p.set(1, 0, 0), p.addScaledVector(i, -p.dot(i)), h = 0.2 * d), p.normalize(), e.unit === "rad" && p.applyAxisAngle(i, e.defaultValue - n);
7161
- const m = (e.parent ? (C = (x = this.inspection).objectForBody) == null ? void 0 : C.call(x, e.parent) : null) ?? null;
7178
+ const m = (e.parent ? (C = (y = this.inspection).objectForBody) == null ? void 0 : C.call(y, e.parent) : null) ?? null;
7162
7179
  m && (m.updateWorldMatrix(!0, !1), p.transformDirection(m.matrixWorld.clone().invert()));
7163
- const f = Math.min(0.17 * d, Math.max(0.07 * d, 0.62 * h)), b = { parent: m, direction: p, radius: e.unit === "rad" ? f * 1.35 : f };
7164
- return this.bases.set(e.id, b), b;
7180
+ const f = Math.min(0.17 * d, Math.max(0.07 * d, 0.62 * h)), g = { parent: m, direction: p, radius: e.unit === "rad" ? f * 1.35 : f };
7181
+ return this.bases.set(e.id, g), g;
7165
7182
  }
7166
7183
  updateDial(e, t, i) {
7167
- var w, x;
7168
- const n = (x = (w = this.inspection).jointWorldFrame) == null ? void 0 : x.call(w, t.id);
7184
+ var w, y;
7185
+ const n = (y = (w = this.inspection).jointWorldFrame) == null ? void 0 : y.call(w, t.id);
7169
7186
  if (!n || !De(n.position) || !De(n.axis) || n.axis.lengthSq() < 1e-12) return;
7170
7187
  const s = this.project(n.position, i);
7171
7188
  if (!s) return;
@@ -7173,24 +7190,24 @@ class ro {
7173
7190
  if (l.parent && (l.parent.updateWorldMatrix(!0, !1), d.transformDirection(l.parent.matrixWorld)), d.addScaledVector(o, -d.dot(o)).normalize(), d.lengthSq() < 1e-12) return;
7174
7191
  const c = (C, k = 1) => this.project(t.unit === "rad" ? n.position.clone().addScaledVector(d.clone().applyAxisAngle(o, C - t.defaultValue), l.radius * k) : n.position.clone().addScaledVector(o, C - a), i), p = t.controlLimits ?? t.limits, h = Number.isFinite(p == null ? void 0 : p.lower) ? p.lower : t.unit === "rad" ? t.defaultValue - Math.PI : t.defaultValue - l.radius, m = Number.isFinite(p == null ? void 0 : p.upper) ? p.upper : t.unit === "rad" ? t.defaultValue + Math.PI : t.defaultValue + l.radius, f = (C, k) => {
7175
7192
  const E = t.unit === "rad" ? Math.max(2, Math.min(128, Math.ceil(Math.abs(k - C) / (Math.PI / 36)))) : 1, P = [];
7176
- for (let I = 0; I <= E; I += 1) {
7177
- const D = c(C + (k - C) * I / E);
7178
- if (!D) return "";
7179
- P.push(D);
7193
+ for (let D = 0; D <= E; D += 1) {
7194
+ const T = c(C + (k - C) * D / E);
7195
+ if (!T) return "";
7196
+ P.push(T);
7180
7197
  }
7181
- return P.map((I, D) => `${D ? "L" : "M"} ${I.x.toFixed(1)} ${I.y.toFixed(1)}`).join(" ");
7182
- }, b = c(a), y = f(h, m), v = f(t.defaultValue, a);
7183
- if (!b || !y || !v) return;
7184
- this.dial.setAttribute("display", "inline"), this.dial.dataset.jointId = t.id, this.range.setAttribute("d", y), this.progress.setAttribute("d", v);
7185
- const g = t.unit === "rad" && m - h >= 2 * Math.PI - 0.01;
7186
- if (this.range.setAttribute("stroke-dasharray", g ? "3 4" : "none"), this.knob.setAttribute("cx", b.x.toFixed(1)), this.knob.setAttribute("cy", b.y.toFixed(1)), this.dialHit.setAttribute("cx", b.x.toFixed(1)), this.dialHit.setAttribute("cy", b.y.toFixed(1)), this.value.textContent = bt(t, a), t.unit === "rad") {
7187
- this.wedge.setAttribute("d", `M ${s.x.toFixed(1)} ${s.y.toFixed(1)} ${v.replace(/^M/, "L")} Z`), this.needle.setAttribute("display", "inline"), this.line(this.needle, s, b), this.dialLineHit.setAttribute("display", "inline"), this.line(this.dialLineHit, s, b), this.line(this.home, c(t.defaultValue, 0.25), c(t.defaultValue, 1.22)), this.line(this.lower, c(h, 0.82), c(h, 1.18)), this.line(this.upper, c(m, 0.82), c(m, 1.18)), this.lower.setAttribute("display", g ? "none" : "inline"), this.upper.setAttribute("display", g ? "none" : "inline");
7188
- const C = c(a, 1.55) ?? b;
7198
+ return P.map((D, T) => `${T ? "L" : "M"} ${D.x.toFixed(1)} ${D.y.toFixed(1)}`).join(" ");
7199
+ }, g = c(a), b = f(h, m), x = f(t.defaultValue, a);
7200
+ if (!g || !b || !x) return;
7201
+ this.dial.setAttribute("display", "inline"), this.dial.dataset.jointId = t.id, this.range.setAttribute("d", b), this.progress.setAttribute("d", x);
7202
+ const v = t.unit === "rad" && m - h >= 2 * Math.PI - 0.01;
7203
+ if (this.range.setAttribute("stroke-dasharray", v ? "3 4" : "none"), this.knob.setAttribute("cx", g.x.toFixed(1)), this.knob.setAttribute("cy", g.y.toFixed(1)), this.dialHit.setAttribute("cx", g.x.toFixed(1)), this.dialHit.setAttribute("cy", g.y.toFixed(1)), this.value.textContent = yt(t, a), t.unit === "rad") {
7204
+ this.wedge.setAttribute("d", `M ${s.x.toFixed(1)} ${s.y.toFixed(1)} ${x.replace(/^M/, "L")} Z`), this.needle.setAttribute("display", "inline"), this.line(this.needle, s, g), this.dialLineHit.setAttribute("display", "inline"), this.line(this.dialLineHit, s, g), this.line(this.home, c(t.defaultValue, 0.25), c(t.defaultValue, 1.22)), this.line(this.lower, c(h, 0.82), c(h, 1.18)), this.line(this.upper, c(m, 0.82), c(m, 1.18)), this.lower.setAttribute("display", v ? "none" : "inline"), this.upper.setAttribute("display", v ? "none" : "inline");
7205
+ const C = c(a, 1.55) ?? g;
7189
7206
  this.value.setAttribute("x", C.x.toFixed(1)), this.value.setAttribute("y", C.y.toFixed(1));
7190
7207
  } else {
7191
7208
  this.wedge.setAttribute("d", ""), this.needle.setAttribute("display", "none"), this.dialLineHit.setAttribute("display", "none"), this.lower.setAttribute("display", "none"), this.upper.setAttribute("display", "none");
7192
7209
  const C = c(t.defaultValue);
7193
- this.line(this.home, { x: C.x - 5, y: C.y }, { x: C.x + 5, y: C.y }), this.value.setAttribute("x", (b.x + 24).toFixed(1)), this.value.setAttribute("y", (b.y - 14).toFixed(1));
7210
+ this.line(this.home, { x: C.x - 5, y: C.y }, { x: C.x + 5, y: C.y }), this.value.setAttribute("x", (g.x + 24).toFixed(1)), this.value.setAttribute("y", (g.y - 14).toFixed(1));
7194
7211
  }
7195
7212
  }
7196
7213
  line(e, t, i) {
@@ -7201,20 +7218,20 @@ class ro {
7201
7218
  e.removeAttribute("visibility"), e.setAttribute("x1", t.x.toFixed(1)), e.setAttribute("y1", t.y.toFixed(1)), e.setAttribute("x2", i.x.toFixed(1)), e.setAttribute("y2", i.y.toFixed(1));
7202
7219
  }
7203
7220
  }
7204
- function yt(r, e, t) {
7221
+ function xt(r, e, t) {
7205
7222
  const i = r.clone().project(e);
7206
- return new J(t.left + (i.x + 1) * t.width / 2, t.top + (1 - i.y) * t.height / 2);
7223
+ return new Z(t.left + (i.x + 1) * t.width / 2, t.top + (1 - i.y) * t.height / 2);
7207
7224
  }
7208
7225
  function so(r, e, t, i, n, s, a) {
7209
7226
  if (e.width <= 0 || e.height <= 0 || t.axis.lengthSq() < 1e-12) return 0;
7210
7227
  r.updateMatrixWorld(!0);
7211
- const o = t.axis.clone().normalize(), l = a ? o : o.clone().cross(i.clone().sub(t.position)), d = yt(i, r, e), c = yt(i.clone().addScaledVector(l, 0.05), r, e).sub(d).multiplyScalar(20), p = s.clone().sub(n), h = c.lengthSq();
7228
+ const o = t.axis.clone().normalize(), l = a ? o : o.clone().cross(i.clone().sub(t.position)), d = xt(i, r, e), c = xt(i.clone().addScaledVector(l, 0.05), r, e).sub(d).multiplyScalar(20), p = s.clone().sub(n), h = c.lengthSq();
7212
7229
  let m = 0;
7213
7230
  if (h > (a ? 1 : 900)) m = p.dot(c) / h;
7214
7231
  else if (!a) {
7215
- const f = yt(t.position, r, e), b = n.clone().sub(f), y = s.clone().sub(f);
7216
- if (b.lengthSq() < 16 || y.lengthSq() < 16) return 0;
7217
- m = Math.atan2(y.y, y.x) - Math.atan2(b.y, b.x), m = Math.atan2(Math.sin(m), Math.cos(m)), o.dot(r.getWorldPosition(new M()).sub(t.position)) > 0 && (m = -m);
7232
+ const f = xt(t.position, r, e), g = n.clone().sub(f), b = s.clone().sub(f);
7233
+ if (g.lengthSq() < 16 || b.lengthSq() < 16) return 0;
7234
+ m = Math.atan2(b.y, b.x) - Math.atan2(g.y, g.x), m = Math.atan2(Math.sin(m), Math.cos(m)), o.dot(r.getWorldPosition(new R()).sub(t.position)) > 0 && (m = -m);
7218
7235
  }
7219
7236
  return Number.isFinite(m) ? a ? m : Math.max(-0.5, Math.min(0.5, m)) : 0;
7220
7237
  }
@@ -7222,7 +7239,7 @@ class ao {
7222
7239
  constructor(e, t) {
7223
7240
  u(this, "element");
7224
7241
  u(this, "overlay");
7225
- u(this, "raycaster", new lt());
7242
+ u(this, "raycaster", new dt());
7226
7243
  u(this, "gesture", null);
7227
7244
  u(this, "background", null);
7228
7245
  u(this, "unsubscribe");
@@ -7234,13 +7251,13 @@ class ao {
7234
7251
  u(this, "down", (e) => {
7235
7252
  if (!this.fromCanvas(e) || this.gesture || !this.editable() || e.button !== 0 || e.isPrimary === !1 || e.altKey || e.ctrlKey || e.metaKey) return;
7236
7253
  const t = this.pick(e);
7237
- t ? this.start(t.motion, t.point, t.body, e) : this.background = { pointerId: e.pointerId, point: new J(e.clientX, e.clientY), moved: !1 };
7254
+ t ? this.start(t.motion, t.point, t.body, e) : this.background = { pointerId: e.pointerId, point: new Z(e.clientX, e.clientY), moved: !1 };
7238
7255
  });
7239
7256
  u(this, "move", (e) => {
7240
7257
  var d, c, p;
7241
7258
  const t = this.gesture;
7242
7259
  if (!t) {
7243
- if (!this.fromCanvas(e) || (((d = this.background) == null ? void 0 : d.pointerId) === e.pointerId && this.background.point.distanceTo(new J(e.clientX, e.clientY)) >= 4 && (this.background.moved = !0), !this.editable() || e.buttons)) return;
7260
+ if (!this.fromCanvas(e) || (((d = this.background) == null ? void 0 : d.pointerId) === e.pointerId && this.background.point.distanceTo(new Z(e.clientX, e.clientY)) >= 4 && (this.background.moved = !0), !this.editable() || e.buttons)) return;
7244
7261
  const h = this.pick(e);
7245
7262
  this.overlay.setHover((h == null ? void 0 : h.motion.driver.id) ?? null), h ? (this.hoverCursor === null && (this.hoverCursor = this.options.canvas.style.cursor), this.options.canvas.style.cursor = "grab") : this.restoreHoverCursor();
7246
7263
  return;
@@ -7251,7 +7268,7 @@ class ao {
7251
7268
  return;
7252
7269
  }
7253
7270
  e.preventDefault(), e.stopImmediatePropagation();
7254
- const i = new J(e.clientX, e.clientY);
7271
+ const i = new Z(e.clientX, e.clientY);
7255
7272
  if (!t.moved && i.distanceTo(t.start) < 4) return;
7256
7273
  t.moved = !0;
7257
7274
  const n = (p = (c = this.inspection).jointWorldFrame) == null ? void 0 : p.call(c, t.via.id);
@@ -7266,7 +7283,7 @@ class ao {
7266
7283
  });
7267
7284
  u(this, "up", (e) => {
7268
7285
  var t, i;
7269
- ((t = this.gesture) == null ? void 0 : t.pointerId) === e.pointerId ? (e.preventDefault(), e.stopImmediatePropagation(), this.stop()) : ((i = this.background) == null ? void 0 : i.pointerId) === e.pointerId && (this.fromCanvas(e) && this.editable() && e.button === 0 && !this.background.moved && this.background.point.distanceTo(new J(e.clientX, e.clientY)) < 4 && this.inspection.select(null), this.background = null);
7286
+ ((t = this.gesture) == null ? void 0 : t.pointerId) === e.pointerId ? (e.preventDefault(), e.stopImmediatePropagation(), this.stop()) : ((i = this.background) == null ? void 0 : i.pointerId) === e.pointerId && (this.fromCanvas(e) && this.editable() && e.button === 0 && !this.background.moved && this.background.point.distanceTo(new Z(e.clientX, e.clientY)) < 4 && this.inspection.select(null), this.background = null);
7270
7287
  });
7271
7288
  u(this, "cancel", (e) => {
7272
7289
  var t;
@@ -7323,24 +7340,24 @@ class ao {
7323
7340
  return !this.disposed && e.controlMode === "kinematic" && (!e.playing || e.previewing === !0);
7324
7341
  }
7325
7342
  pick(e) {
7326
- var h, m, f, b, y;
7343
+ var h, m, f, g, b;
7327
7344
  const i = this.options.canvas.getBoundingClientRect();
7328
7345
  if (!i.width || !i.height) return null;
7329
7346
  const n = this.options.getCamera();
7330
7347
  n.updateMatrixWorld(!0);
7331
7348
  const s = ((m = (h = this.inspection).pickRoots) == null ? void 0 : m.call(h)) ?? [];
7332
- for (const v of s) v.updateWorldMatrix(!0, !0);
7333
- this.raycaster.firstHitOnly = !0, this.raycaster.setFromCamera(new J((e.clientX - i.left) / i.width * 2 - 1, 1 - (e.clientY - i.top) / i.height * 2), n);
7334
- const a = this.raycaster.intersectObjects([...s], !0).find((v) => {
7335
- if (!v.object.isMesh) return !1;
7336
- for (let g = v.object; g; g = g.parent) if (!g.visible) return !1;
7349
+ for (const x of s) x.updateWorldMatrix(!0, !0);
7350
+ this.raycaster.firstHitOnly = !0, this.raycaster.setFromCamera(new Z((e.clientX - i.left) / i.width * 2 - 1, 1 - (e.clientY - i.top) / i.height * 2), n);
7351
+ const a = this.raycaster.intersectObjects([...s], !0).find((x) => {
7352
+ if (!x.object.isMesh) return !1;
7353
+ for (let v = x.object; v; v = v.parent) if (!v.visible) return !1;
7337
7354
  return !0;
7338
7355
  });
7339
7356
  if (!a) return null;
7340
7357
  let o = a.object;
7341
7358
  for (; o && typeof o.userData.bodyId != "number"; ) o = o.parent;
7342
7359
  if (!o) return null;
7343
- const l = this.inspection.getSnapshot().joints, d = l.find((v) => v.id === this.inspection.getSnapshot().selectedJointId && v.child === o.name), c = (d == null ? void 0 : d.id) ?? ((b = (f = this.inspection).jointForBody) == null ? void 0 : b.call(f, o.name)) ?? ((y = l.find((v) => v.child === o.name)) == null ? void 0 : y.id), p = c ? gt(l, c) : null;
7360
+ const l = this.inspection.getSnapshot().joints, d = l.find((x) => x.id === this.inspection.getSnapshot().selectedJointId && x.child === o.name), c = (d == null ? void 0 : d.id) ?? ((g = (f = this.inspection).jointForBody) == null ? void 0 : g.call(f, o.name)) ?? ((b = l.find((x) => x.child === o.name)) == null ? void 0 : b.id), p = c ? bt(l, c) : null;
7344
7361
  return p ? { motion: p, point: a.point, body: o } : null;
7345
7362
  }
7346
7363
  start(e, t, i, n) {
@@ -7349,7 +7366,7 @@ class ao {
7349
7366
  this.restoreHoverCursor(), this.inspection.select(e.driver.id);
7350
7367
  const s = this.inspection.getSnapshot().jointValues[e.driver.id] ?? e.driver.defaultValue;
7351
7368
  this.inspection.setJointValue(e.driver.id, s), this.background = null;
7352
- const a = new J(n.clientX, n.clientY);
7369
+ const a = new Z(n.clientX, n.clientY);
7353
7370
  this.gesture = {
7354
7371
  pointerId: n.pointerId,
7355
7372
  ...e,
@@ -7367,16 +7384,16 @@ class ao {
7367
7384
  }
7368
7385
  startPin(e, t) {
7369
7386
  var l, d, c, p;
7370
- const i = gt(this.inspection.getSnapshot().joints, e);
7387
+ const i = bt(this.inspection.getSnapshot().joints, e);
7371
7388
  if (!i || !this.editable()) return;
7372
7389
  const n = i.via.child ? ((d = (l = this.inspection).objectForBody) == null ? void 0 : d.call(l, i.via.child)) ?? null : null, s = (p = (c = this.inspection).jointWorldFrame) == null ? void 0 : p.call(c, i.via.id);
7373
7390
  if (!s) return;
7374
- const a = n ? new Z().setFromObject(n) : new Z(), o = a.isEmpty() ? s.position.clone() : a.getCenter(new M());
7391
+ const a = n ? new Q().setFromObject(n) : new Q(), o = a.isEmpty() ? s.position.clone() : a.getCenter(new R());
7375
7392
  this.start(i, o, n, t);
7376
7393
  }
7377
7394
  startDial(e, t) {
7378
7395
  var s, a;
7379
- const i = gt(this.inspection.getSnapshot().joints, e);
7396
+ const i = bt(this.inspection.getSnapshot().joints, e);
7380
7397
  if (!i || !this.editable()) return;
7381
7398
  const n = (a = (s = this.inspection).jointWorldFrame) == null ? void 0 : a.call(s, i.via.id);
7382
7399
  n && this.start(i, n.position.clone(), null, t);
@@ -7401,14 +7418,14 @@ class ao {
7401
7418
  }
7402
7419
  const ye = "scene";
7403
7420
  function oo(r, e) {
7404
- let t = null, i = null, n = null, s = null, a = null, o = null, l = null, d = null, c = null, p = null, h = null, m = null, f = null, b = null, y = null;
7405
- const v = [], g = (w) => {
7406
- const x = (w == null ? void 0 : w.getSnapshot().controlMode) === "kinematic" && w.pickRoots && w.jointWorldFrame && r.interactionCanvas && r.interactionCamera && r.setNavigationEnabled ? w : null;
7407
- if (l === x) {
7421
+ let t = null, i = null, n = null, s = null, a = null, o = null, l = null, d = null, c = null, p = null, h = null, m = null, f = null, g = null, b = null;
7422
+ const x = [], v = (w) => {
7423
+ const y = (w == null ? void 0 : w.getSnapshot().controlMode) === "kinematic" && w.pickRoots && w.jointWorldFrame && r.interactionCanvas && r.interactionCamera && r.setNavigationEnabled ? w : null;
7424
+ if (l === y) {
7408
7425
  o == null || o.update();
7409
7426
  return;
7410
7427
  }
7411
- o == null || o.dispose(), d == null || d.dispose(), o = null, d = null, l = x, x && (o = new ao(x, {
7428
+ o == null || o.dispose(), d == null || d.dispose(), o = null, d = null, l = y, y && (o = new ao(y, {
7412
7429
  canvas: r.interactionCanvas(),
7413
7430
  getCamera: () => r.interactionCamera(),
7414
7431
  requestRender: () => {
@@ -7422,10 +7439,10 @@ function oo(r, e) {
7422
7439
  return {
7423
7440
  id: "nebula.ui.scene",
7424
7441
  activate(w) {
7425
- var C, k, E, P, I, D;
7426
- y = document.createElement("style"), y.dataset.viewerSceneUi = "", y.textContent = Ya, (C = r.shadowRoot()) == null || C.append(y), i = r.environment ? new Fa(r.theme(), r.environment, {
7442
+ var C, k, E, P, D, T;
7443
+ b = document.createElement("style"), b.dataset.viewerSceneUi = "", b.textContent = Ya, (C = r.shadowRoot()) == null || C.append(b), i = r.environment ? new Fa(r.theme(), r.environment, {
7427
7444
  showBackgroundToggle: ((E = (k = e.scene) == null ? void 0 : k.parts) == null ? void 0 : E.background) !== !1,
7428
- onOpenChange: (S) => t == null ? void 0 : t.pickerChanged(S)
7445
+ onOpenChange: (M) => t == null ? void 0 : t.pickerChanged(M)
7429
7446
  }) : null, t = Na(w, {
7430
7447
  label: e.label("simulation"),
7431
7448
  parts: (P = e.scene) == null ? void 0 : P.parts,
@@ -7434,44 +7451,44 @@ function oo(r, e) {
7434
7451
  environment: {
7435
7452
  getState: () => r.environment.getState(),
7436
7453
  isPickerOpen: () => (i == null ? void 0 : i.isOpen) ?? !1,
7437
- openPicker: (S) => i.toggle(S)
7454
+ openPicker: (M) => i.toggle(M)
7438
7455
  }
7439
7456
  } : {}
7440
- }), n = new _a(r.theme(), ((D = (I = e.scene) == null ? void 0 : I.parts) == null ? void 0 : D.scaleRuler) !== !1), s = new Ha(r.theme(), () => {
7441
- var S;
7442
- return ((S = r.getVisualDiagnostics) == null ? void 0 : S.call(r)) ?? null;
7443
- }), a = new Ja(r.theme()), c = r.mountBuiltin(t.element, { zone: "overlay", group: ye }), i && (p = r.mountBuiltin(i.element, { zone: "overlay", group: ye })), h = r.mountBuiltin(n.element, { zone: "overlay", group: ye }), m = r.mountBuiltin(s.element, { zone: "overlay", group: ye }), f = r.mountBuiltin(a.element, { zone: "overlay", group: ye }), b = r.onThemeChange((S) => {
7444
- t == null || t.themeChanged(S), i == null || i.themeChanged(S), i == null || i.reposition((t == null ? void 0 : t.environmentAnchor()) ?? null), n == null || n.themeChanged(S), s == null || s.themeChanged(S), a == null || a.themeChanged(S), o == null || o.themeChanged(S);
7457
+ }), n = new _a(r.theme(), ((T = (D = e.scene) == null ? void 0 : D.parts) == null ? void 0 : T.scaleRuler) !== !1), s = new Ha(r.theme(), () => {
7458
+ var M;
7459
+ return ((M = r.getVisualDiagnostics) == null ? void 0 : M.call(r)) ?? null;
7460
+ }), a = new Ja(r.theme()), c = r.mountBuiltin(t.element, { zone: "overlay", group: ye }), i && (p = r.mountBuiltin(i.element, { zone: "overlay", group: ye })), h = r.mountBuiltin(n.element, { zone: "overlay", group: ye }), m = r.mountBuiltin(s.element, { zone: "overlay", group: ye }), f = r.mountBuiltin(a.element, { zone: "overlay", group: ye }), g = r.onThemeChange((M) => {
7461
+ t == null || t.themeChanged(M), i == null || i.themeChanged(M), i == null || i.reposition((t == null ? void 0 : t.environmentAnchor()) ?? null), n == null || n.themeChanged(M), s == null || s.themeChanged(M), a == null || a.themeChanged(M), o == null || o.themeChanged(M);
7445
7462
  });
7446
- const x = () => {
7447
- var j, Q, O, T, B;
7448
- const S = w.asset.$read(), U = (Q = (j = w.asset).$inspection) == null ? void 0 : Q.call(j), L = (S == null ? void 0 : S.phase) === "ready" && (U == null ? void 0 : U.kind) === "joints" ? U : null;
7449
- if (a == null || a.bind(L), g(L), ((B = (T = (O = w.asset).$inspection) == null ? void 0 : T.call(O)) == null ? void 0 : B.kind) === "urdf") {
7463
+ const y = () => {
7464
+ var O, G, S, A, j;
7465
+ const M = w.asset.$read(), V = (G = (O = w.asset).$inspection) == null ? void 0 : G.call(O), _ = (M == null ? void 0 : M.phase) === "ready" && (V == null ? void 0 : V.kind) === "joints" ? V : null;
7466
+ if (a == null || a.bind(_), v(_), ((j = (A = (S = w.asset).$inspection) == null ? void 0 : A.call(S)) == null ? void 0 : j.kind) === "urdf") {
7450
7467
  t && (t.element.hidden = !0), i == null || i.close(), n == null || n.update(null, w.asset.$readControl()), s == null || s.update(null);
7451
7468
  return;
7452
7469
  }
7453
- if (!S) {
7470
+ if (!M) {
7454
7471
  t && (t.element.hidden = !0), i == null || i.close(), n == null || n.update(null, w.asset.$readControl()), s == null || s.update(null);
7455
7472
  return;
7456
7473
  }
7457
- t == null || t.update(S), i == null || i.update(), i == null || i.reposition((t == null ? void 0 : t.environmentAnchor()) ?? null);
7458
- const V = S.kind === "model" || S.kind === "simulation" ? e.label(S.kind) : null;
7459
- V && (t == null || t.element.setAttribute("aria-label", V)), n == null || n.update(S, w.asset.$readControl()), s == null || s.update(S);
7474
+ t == null || t.update(M), i == null || i.update(), i == null || i.reposition((t == null ? void 0 : t.environmentAnchor()) ?? null);
7475
+ const H = M.kind === "model" || M.kind === "simulation" ? e.label(M.kind) : null;
7476
+ H && (t == null || t.element.setAttribute("aria-label", H)), n == null || n.update(M, w.asset.$readControl()), s == null || s.update(M);
7460
7477
  };
7461
- v.push(w.events.on("asset-change", x)), v.push(w.events.on("asset-control-change", () => {
7478
+ x.push(w.events.on("asset-change", y)), x.push(w.events.on("asset-control-change", () => {
7462
7479
  t == null || t.pressedChanged(), n == null || n.update(w.asset.$read(), w.asset.$readControl()), o == null || o.update();
7463
- })), v.push(w.events.on("environment-change", (S) => {
7464
- i == null || i.update(S);
7480
+ })), x.push(w.events.on("environment-change", (M) => {
7481
+ i == null || i.update(M);
7465
7482
  }));
7466
- for (const S of ["camera-change", "resize", "viewport-change", "ui-layout-change"])
7467
- v.push(w.events.on(S, () => {
7483
+ for (const M of ["camera-change", "resize", "viewport-change", "ui-layout-change"])
7484
+ x.push(w.events.on(M, () => {
7468
7485
  o == null || o.update(), i == null || i.reposition((t == null ? void 0 : t.environmentAnchor()) ?? null);
7469
7486
  }));
7470
- x();
7487
+ y();
7471
7488
  },
7472
7489
  deactivate() {
7473
- for (const w of v.splice(0)) w();
7474
- b == null || b.dispose(), g(null), c == null || c.dispose(), p == null || p.dispose(), h == null || h.dispose(), m == null || m.dispose(), f == null || f.dispose(), i == null || i.dispose(), t == null || t.dispose(), n == null || n.dispose(), s == null || s.dispose(), a == null || a.dispose(), y == null || y.remove(), t = null, i = null, n = null, s = null, a = null, c = null, p = null, h = null, m = null, f = null, b = null, y = null;
7490
+ for (const w of x.splice(0)) w();
7491
+ g == null || g.dispose(), v(null), c == null || c.dispose(), p == null || p.dispose(), h == null || h.dispose(), m == null || m.dispose(), f == null || f.dispose(), i == null || i.dispose(), t == null || t.dispose(), n == null || n.dispose(), s == null || s.dispose(), a == null || a.dispose(), b == null || b.remove(), t = null, i = null, n = null, s = null, a = null, c = null, p = null, h = null, m = null, f = null, g = null, b = null;
7475
7492
  }
7476
7493
  };
7477
7494
  }
@@ -7524,7 +7541,7 @@ class lo {
7524
7541
  }
7525
7542
  }
7526
7543
  function co(r) {
7527
- const e = r.clone().invert(), t = [new M(1, 0, 0), new M(0, 1, 0), new M(0, 0, 1)], i = ["#f3656a", "#36c978", "#4789f5"];
7544
+ const e = r.clone().invert(), t = [new R(1, 0, 0), new R(0, 1, 0), new R(0, 0, 1)], i = ["#f3656a", "#36c978", "#4789f5"];
7528
7545
  return `<svg viewBox="0 0 100 100" role="img" aria-label="世界坐标轴">${t.flatMap((s, a) => [-1, 1].map((o) => ({ p: s.clone().multiplyScalar(o).applyQuaternion(e), i: a, sign: o }))).sort((s, a) => s.p.z - a.p.z).map(({ p: s, i: a, sign: o }) => {
7529
7546
  const l = 50 + s.x * 32, d = 50 - s.y * 32, c = i[a];
7530
7547
  return `${o > 0 ? `<path d="M50 50L${l} ${d}" stroke="${c}" stroke-width="2"/>` : ""}<circle cx="${l}" cy="${d}" r="${o > 0 ? 7.5 : 4}" fill="${c}" opacity="${o > 0 ? 1 : 0.6}" stroke="none"/>${o > 0 ? `<text x="${l}" y="${d + 3}" fill="#101b24" stroke="none" text-anchor="middle" font-size="9">${"XYZ"[a]}</text>` : ""}`;
@@ -7564,7 +7581,7 @@ function W(r) {
7564
7581
  function $(r) {
7565
7582
  return r.mode === "kinematic" || r.mode === "dynamics-paused" || r.mode === "dynamics-unavailable";
7566
7583
  }
7567
- function A(r) {
7584
+ function L(r) {
7568
7585
  return String(r ?? "").replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;");
7569
7586
  }
7570
7587
  function Be(r, e = 1 / 0) {
@@ -7578,20 +7595,20 @@ function ho(r, e, t, i) {
7578
7595
  const p = (E) => E.composedPath().some((P) => P instanceof s.HTMLElement && (P.matches("input,textarea,select") || P.isContentEditable)), h = () => {
7579
7596
  d && (d = null, r.style.cursor = c, r.removeAttribute("data-joint-adjusting"));
7580
7597
  }, m = () => ["kinematic", "dynamics-paused", "dynamics-unavailable"].includes(e.getSnapshot().mode), f = (E) => {
7581
- var L;
7598
+ var _;
7582
7599
  if (E.code === "Escape") {
7583
7600
  h();
7584
7601
  return;
7585
7602
  }
7586
7603
  if (E.code !== "KeyR" || E.repeat || E.ctrlKey || E.altKey || E.metaKey || p(E) || !a && n.activeElement !== r || !m()) return;
7587
- const P = e.getSnapshot(), I = P.nodes.find((V) => V.id === P.selectedEntityId && V.kind === "joint");
7588
- if (!(I != null && I.movable) || I.mimic) return;
7604
+ const P = e.getSnapshot(), D = P.nodes.find((H) => H.id === P.selectedEntityId && H.kind === "joint");
7605
+ if (!(D != null && D.movable) || D.mimic) return;
7589
7606
  t();
7590
- const D = (L = e.jointWorldFrame) == null ? void 0 : L.call(e, I.name), S = i == null ? void 0 : i(), U = D && S && l !== null ? po(S, D, r.getBoundingClientRect(), l, o, I.jointType === "prismatic") : 1;
7591
- d = { id: I.id, name: I.name, value: P.jointValues[I.name] ?? 0, sensitivity: I.jointType === "prismatic" ? 1e-3 : 5e-3, ...Be(I), direction: U }, c = r.style.cursor, r.style.cursor = "ew-resize", r.setAttribute("data-joint-adjusting", "true"), E.preventDefault();
7592
- }, b = (E) => {
7607
+ const T = (_ = e.jointWorldFrame) == null ? void 0 : _.call(e, D.name), M = i == null ? void 0 : i(), V = T && M && l !== null ? po(M, T, r.getBoundingClientRect(), l, o, D.jointType === "prismatic") : 1;
7608
+ d = { id: D.id, name: D.name, value: P.jointValues[D.name] ?? 0, sensitivity: D.jointType === "prismatic" ? 1e-3 : 5e-3, ...Be(D), direction: V }, c = r.style.cursor, r.style.cursor = "ew-resize", r.setAttribute("data-joint-adjusting", "true"), E.preventDefault();
7609
+ }, g = (E) => {
7593
7610
  E.code === "KeyR" && h();
7594
- }, y = (E) => {
7611
+ }, b = (E) => {
7595
7612
  const P = l === null ? 0 : E.clientX - l;
7596
7613
  if (l = E.clientX, o = E.clientY, !(!d || E.pointerType === "touch")) {
7597
7614
  if (!m() || e.getSnapshot().selectedEntityId !== d.id || E.buttons !== 0) {
@@ -7600,33 +7617,33 @@ function ho(r, e, t, i) {
7600
7617
  }
7601
7618
  P && (d.value = Math.max(d.lower, Math.min(d.upper, d.value + P * d.direction * d.sensitivity)), e.setJointValue(d.name, d.value), E.preventDefault(), E.stopImmediatePropagation());
7602
7619
  }
7603
- }, v = (E) => {
7620
+ }, x = (E) => {
7604
7621
  a = !0, l = E.clientX, o = E.clientY;
7605
- }, g = () => {
7622
+ }, v = () => {
7606
7623
  a = !1, l = null, h();
7607
7624
  }, w = (E) => {
7608
7625
  d && (E.preventDefault(), E.stopImmediatePropagation());
7609
- }, x = (E) => {
7626
+ }, y = (E) => {
7610
7627
  E.composedPath()[0] !== r && h();
7611
7628
  }, C = () => {
7612
7629
  n.hidden && h();
7613
7630
  }, k = e.subscribe((E) => {
7614
7631
  d && (!m() || E.selectedEntityId !== d.id) && h();
7615
7632
  });
7616
- return r.addEventListener("pointerenter", v), r.addEventListener("pointerleave", g), r.addEventListener("pointermove", y, !0), r.addEventListener("pointerdown", w, !0), n.addEventListener("keydown", f), n.addEventListener("keyup", b), n.addEventListener("focusin", x), n.addEventListener("visibilitychange", C), s.addEventListener("blur", g), () => {
7617
- h(), k(), r.removeEventListener("pointerenter", v), r.removeEventListener("pointerleave", g), r.removeEventListener("pointermove", y, !0), r.removeEventListener("pointerdown", w, !0), n.removeEventListener("keydown", f), n.removeEventListener("keyup", b), n.removeEventListener("focusin", x), n.removeEventListener("visibilitychange", C), s.removeEventListener("blur", g);
7633
+ return r.addEventListener("pointerenter", x), r.addEventListener("pointerleave", v), r.addEventListener("pointermove", b, !0), r.addEventListener("pointerdown", w, !0), n.addEventListener("keydown", f), n.addEventListener("keyup", g), n.addEventListener("focusin", y), n.addEventListener("visibilitychange", C), s.addEventListener("blur", v), () => {
7634
+ h(), k(), r.removeEventListener("pointerenter", x), r.removeEventListener("pointerleave", v), r.removeEventListener("pointermove", b, !0), r.removeEventListener("pointerdown", w, !0), n.removeEventListener("keydown", f), n.removeEventListener("keyup", g), n.removeEventListener("focusin", y), n.removeEventListener("visibilitychange", C), s.removeEventListener("blur", v);
7618
7635
  };
7619
7636
  }
7620
7637
  function po(r, e, t, i, n, s) {
7621
7638
  if (t.width <= 0 || t.height <= 0 || e.axis.lengthSq() < 1e-12) return 1;
7622
7639
  r.updateMatrixWorld(!0);
7623
- const a = e.axis.clone().normalize(), o = r.getWorldDirection(new M()), l = new M(1, 0, 0).transformDirection(r.matrixWorld), d = new M(0, 1, 0).transformDirection(r.matrixWorld);
7640
+ const a = e.axis.clone().normalize(), o = r.getWorldDirection(new R()), l = new R(1, 0, 0).transformDirection(r.matrixWorld), d = new R(0, 1, 0).transformDirection(r.matrixWorld);
7624
7641
  let c = a.clone();
7625
7642
  if (!s) {
7626
- const m = new lt();
7627
- m.setFromCamera(new J((i - t.left) / t.width * 2 - 1, 1 - (n - t.top) / t.height * 2), r);
7628
- const f = m.ray.intersectPlane(new cn().setFromNormalAndCoplanarPoint(o, e.position), new M()), b = f ? f.sub(e.position) : new M();
7629
- c = a.clone().cross(b), Math.abs(c.dot(l)) <= Math.max(b.length(), 1e-6) * 0.05 && (c = a.clone().cross(o.clone().negate()), Math.abs(c.dot(l)) < 0.05 && (c = a.clone().cross(d.clone().negate())));
7643
+ const m = new dt();
7644
+ m.setFromCamera(new Z((i - t.left) / t.width * 2 - 1, 1 - (n - t.top) / t.height * 2), r);
7645
+ const f = m.ray.intersectPlane(new cn().setFromNormalAndCoplanarPoint(o, e.position), new R()), g = f ? f.sub(e.position) : new R();
7646
+ c = a.clone().cross(g), Math.abs(c.dot(l)) <= Math.max(g.length(), 1e-6) * 0.05 && (c = a.clone().cross(o.clone().negate()), Math.abs(c.dot(l)) < 0.05 && (c = a.clone().cross(d.clone().negate())));
7630
7647
  }
7631
7648
  const p = c.dot(l);
7632
7649
  if (Math.abs(p) > 0.05 * Math.max(c.length(), 1e-9)) return p >= 0 ? 1 : -1;
@@ -7649,20 +7666,20 @@ function at(r, e) {
7649
7666
  }
7650
7667
  return r;
7651
7668
  }
7652
- function It(r, e, t, i = !1) {
7669
+ function Lt(r, e, t, i = !1) {
7653
7670
  const { lower: n, upper: s } = Be(r, Math.PI), a = e.jointValues[r.name] ?? 0, o = mo(r, t);
7654
- return `<div class="vurdf-slider-card ${e.selectedEntityId === r.id ? "is-selected" : ""}" data-joint-card="${A(r.id)}" tabindex="0" role="group" aria-label="${A(r.name)},点击选中关节">
7655
- <div class="vurdf-slider-heading"><button class="vurdf-text-btn" data-entity="${A(r.id)}">${A(r.name)}</button><output data-joint-readout="${A(r.name)}">${Ae(r, a, t)}</output></div>
7656
- <small>${i ? "联动控制 · " : ""}${A(r.parentLink)} → ${A(r.childLink)}</small>
7657
- <input type="range" aria-label="${A(r.name)}${i ? " 联动控制" : " 位置"}" data-control-joint="${A(r.name)}" data-display-factor="${o}" min="${n * o}" max="${s * o}" step="any" value="${a * o}" ${!$(e) || r.mimic ? "disabled" : ""}>
7658
- ${r.mimic ? `<small>跟随 ${A(r.mimic.joint)} × ${r.mimic.multiplier} + ${Ae(r, r.mimic.offset, t)}</small>` : ""}
7671
+ return `<div class="vurdf-slider-card ${e.selectedEntityId === r.id ? "is-selected" : ""}" data-joint-card="${L(r.id)}" tabindex="0" role="group" aria-label="${L(r.name)},点击选中关节">
7672
+ <div class="vurdf-slider-heading"><button class="vurdf-text-btn" data-entity="${L(r.id)}">${L(r.name)}</button><output data-joint-readout="${L(r.name)}">${Ae(r, a, t)}</output></div>
7673
+ <small>${i ? "联动控制 · " : ""}${L(r.parentLink)} → ${L(r.childLink)}</small>
7674
+ <input type="range" aria-label="${L(r.name)}${i ? " 联动控制" : " 位置"}" data-control-joint="${L(r.name)}" data-display-factor="${o}" min="${n * o}" max="${s * o}" step="any" value="${a * o}" ${!$(e) || r.mimic ? "disabled" : ""}>
7675
+ ${r.mimic ? `<small>跟随 ${L(r.mimic.joint)} × ${r.mimic.multiplier} + ${Ae(r, r.mimic.offset, t)}</small>` : ""}
7659
7676
  </div>`;
7660
7677
  }
7661
- function Oi(r, e, t) {
7678
+ function ji(r, e, t) {
7662
7679
  const i = e.nodes.filter((o) => o.kind === "joint"), n = r.kind === "joint" ? r : i.find((o) => o.childLink === r.name);
7663
7680
  if (!n) return "";
7664
7681
  const s = at(n, i), a = i.filter((o) => o.mimic && at(o, i).name === s.name);
7665
- return a.length ? `<section class="vurdf-section"><div class="vurdf-section-head"><strong>联动约束 · ${a.length + 1} 个关节</strong></div>${It(s, e, t, !0)}<p class="vurdf-control-hint">${a.map((o) => A(o.name)).join(" · ")}</p></section>` : "";
7682
+ return a.length ? `<section class="vurdf-section"><div class="vurdf-section-head"><strong>联动约束 · ${a.length + 1} 个关节</strong></div>${Lt(s, e, t, !0)}<p class="vurdf-control-hint">${a.map((o) => L(o.name)).join(" · ")}</p></section>` : "";
7666
7683
  }
7667
7684
  function fo(r, e, t) {
7668
7685
  const i = r.nodes.filter((c) => c.kind === "joint"), n = /* @__PURE__ */ new Map();
@@ -7687,7 +7704,7 @@ function fo(r, e, t) {
7687
7704
  const d = e.trim().toLowerCase();
7688
7705
  return o.filter((c) => c.some((p) => `${p.name} ${p.parentLink} ${p.childLink}`.toLowerCase().includes(d))).map((c) => {
7689
7706
  const p = [...new Set(c.map((h) => at(h, i)))].filter((h) => i.some((m) => m.mimic && at(m, i).name === h.name));
7690
- return `<section class="vurdf-joint-group"><h3>${A(c[0].parentLink)} → ${A(c[c.length - 1].childLink)}</h3>${p.filter((h) => !c.includes(h)).map((h) => It(h, r, t, !0)).join("")}${c.map((h) => It(h, r, t, p.includes(h))).join("")}</section>`;
7707
+ return `<section class="vurdf-joint-group"><h3>${L(c[0].parentLink)} → ${L(c[c.length - 1].childLink)}</h3>${p.filter((h) => !c.includes(h)).map((h) => Lt(h, r, t, !0)).join("")}${c.map((h) => Lt(h, r, t, p.includes(h))).join("")}</section>`;
7691
7708
  }).join("") || '<div class="vurdf-empty">没有符合筛选条件的可动关节。</div>';
7692
7709
  }
7693
7710
  function vo(r) {
@@ -7722,8 +7739,8 @@ class go {
7722
7739
  const t = new Set(e.issues.map((d) => d.entityId)), i = this.root.querySelector(".vurdf-tree"), n = { top: (i == null ? void 0 : i.scrollTop) ?? 0, left: (i == null ? void 0 : i.scrollLeft) ?? 0 }, s = this.root.getRootNode().activeElement, a = s && (i != null && i.contains(s)) ? s.dataset.entity : void 0;
7723
7740
  this.root.innerHTML = `
7724
7741
  <div class="vurdf-head"><div><strong>URDF模型结构</strong><span>${e.nodes.filter((d) => d.kind === "link").length} Links · ${e.nodes.filter((d) => d.kind === "joint").length} Joints</span></div><button class="vurdf-diagram-open" data-open-diagram title="打开结构图" aria-label="打开结构图">${W("structure")}</button></div>
7725
- <label class="vurdf-search">${W("search")}<input aria-label="搜索模型结构" placeholder="搜索 Link 或 Joint" value="${A(this.query)}"></label>
7726
- <div class="vurdf-filters">${xt("all", "全部", this.filter)}${xt("movable", "可动关节", this.filter)}${xt("errors", `错误 ${e.issues.length}`, this.filter)}</div>
7742
+ <label class="vurdf-search">${W("search")}<input aria-label="搜索模型结构" placeholder="搜索 Link 或 Joint" value="${L(this.query)}"></label>
7743
+ <div class="vurdf-filters">${wt("all", "全部", this.filter)}${wt("movable", "可动关节", this.filter)}${wt("errors", `错误 ${e.issues.length}`, this.filter)}</div>
7727
7744
  <div class="vurdf-tree" role="${this.filter === "movable" ? "region" : "tree"}">${this.filter === "movable" ? fo(e, this.query, this.angleUnit) : bo(e, t, this.filter, this.query, this.collapsed, this.angleUnit)}</div>
7728
7745
  `, this.bind(e), this.setDiagramOpen(this.diagramOpen);
7729
7746
  const o = this.root.querySelector(".vurdf-tree");
@@ -7818,21 +7835,21 @@ function bo(r, e, t, i, n, s) {
7818
7835
  if (m.has(p)) return { html: "", matched: !1 };
7819
7836
  const f = a.get(p);
7820
7837
  if (!f) return { html: "", matched: !1 };
7821
- const b = new Set(m).add(p), y = f.childIds.map((E) => c(E, h + 1, b));
7822
- if (!(d(f) || y.some((E) => E.matched))) return { html: "", matched: !1 };
7823
- const g = y.some((E) => E.matched), w = !l && n.has(f.id), x = f.kind === "joint" ? f.jointType : f.kind, C = f.kind === "joint" && f.movable ? `${Ae(f, r.jointValues[f.name] ?? 0, s)}` : "", k = `<div class="vurdf-tree-item" style="--depth:${h}" role="treeitem" aria-expanded="${g ? String(!w) : "false"}">
7824
- <button class="vurdf-tree-toggle ${g ? "" : "is-placeholder"} ${w ? "" : "is-open"}" data-tree-toggle="${A(f.id)}" ${g ? "" : "disabled"} aria-label="${w ? "展开" : "折叠"} ${A(f.name)}">${W("chevron")}</button>
7825
- <button class="vurdf-row ${r.selectedEntityId === f.id ? "is-selected" : ""} ${e.has(f.id) ? "has-error" : ""}" data-entity="${A(f.id)}">
7838
+ const g = new Set(m).add(p), b = f.childIds.map((E) => c(E, h + 1, g));
7839
+ if (!(d(f) || b.some((E) => E.matched))) return { html: "", matched: !1 };
7840
+ const v = b.some((E) => E.matched), w = !l && n.has(f.id), y = f.kind === "joint" ? f.jointType : f.kind, C = f.kind === "joint" && f.movable ? `${Ae(f, r.jointValues[f.name] ?? 0, s)}` : "", k = `<div class="vurdf-tree-item" style="--depth:${h}" role="treeitem" aria-expanded="${v ? String(!w) : "false"}">
7841
+ <button class="vurdf-tree-toggle ${v ? "" : "is-placeholder"} ${w ? "" : "is-open"}" data-tree-toggle="${L(f.id)}" ${v ? "" : "disabled"} aria-label="${w ? "展开" : "折叠"} ${L(f.name)}">${W("chevron")}</button>
7842
+ <button class="vurdf-row ${r.selectedEntityId === f.id ? "is-selected" : ""} ${e.has(f.id) ? "has-error" : ""}" data-entity="${L(f.id)}">
7826
7843
  ${W(f.kind === "robot" ? "robot" : f.kind === "joint" ? "joint" : "link")}
7827
- <span class="vurdf-node-copy"><b title="${A(f.name)}">${A(f.name)}</b><small>${A(x)}</small></span>
7828
- ${e.has(f.id) ? '<span class="vurdf-node-error">!</span>' : `<span class="vurdf-node-value" ${f.kind === "joint" ? `data-joint-readout="${A(f.name)}"` : ""}>${C}</span>`}
7844
+ <span class="vurdf-node-copy"><b title="${L(f.name)}">${L(f.name)}</b><small>${L(y)}</small></span>
7845
+ ${e.has(f.id) ? '<span class="vurdf-node-error">!</span>' : `<span class="vurdf-node-value" ${f.kind === "joint" ? `data-joint-readout="${L(f.name)}"` : ""}>${C}</span>`}
7829
7846
  </button>
7830
7847
  </div>`;
7831
- return { html: `<div class="vurdf-branch ${w ? "is-collapsed" : ""}">${k}<div class="vurdf-children" ${w ? "inert" : ""}><div>${y.map((E) => E.html).join("")}</div></div></div>`, matched: !0 };
7848
+ return { html: `<div class="vurdf-branch ${w ? "is-collapsed" : ""}">${k}<div class="vurdf-children" ${w ? "inert" : ""}><div>${b.map((E) => E.html).join("")}</div></div></div>`, matched: !0 };
7832
7849
  };
7833
7850
  return c(r.rootEntityId, 0).html || '<div class="vurdf-empty">没有符合筛选条件的节点。</div>';
7834
7851
  }
7835
- function xt(r, e, t) {
7852
+ function wt(r, e, t) {
7836
7853
  return `<button class="vurdf-chip ${r === t ? "is-active" : ""}" data-filter="${r}">${e}</button>`;
7837
7854
  }
7838
7855
  const yo = 1800;
@@ -7873,7 +7890,7 @@ class xo {
7873
7890
  const o = a.dataset.inertiaDetails;
7874
7891
  a.open ? this.expandedInertia.add(o) : this.expandedInertia.delete(o);
7875
7892
  }), this.root.innerHTML = `
7876
- <nav class="vurdf-tabs">${wt("properties", "属性", this.tab)}${wt("source", "XML", this.tab)}${wt("issues", `错误${e.issues.length ? ` <em>${e.issues.length}</em>` : ""}`, this.tab)}</nav>
7893
+ <nav class="vurdf-tabs">${Ct("properties", "属性", this.tab)}${Ct("source", "XML", this.tab)}${Ct("issues", `错误${e.issues.length ? ` <em>${e.issues.length}</em>` : ""}`, this.tab)}</nav>
7877
7894
  <section class="vurdf-pane ${this.tab === "properties" ? "is-active" : ""}" data-pane="properties">${t ? wo(t, e, ((i = this.sweep) == null ? void 0 : i.jointName) === t.name, this.angleUnit, this.expandedInertia) : ko()}</section>
7878
7895
  <section class="vurdf-pane ${this.tab === "source" ? "is-active" : ""}" data-pane="source">${this.tab === "source" ? Co(e, t) : ""}</section>
7879
7896
  <section class="vurdf-pane ${this.tab === "issues" ? "is-active" : ""}" data-pane="issues">${Eo(e)}</section>
@@ -7917,7 +7934,7 @@ class xo {
7917
7934
  if ((l = this.root.querySelector("[data-angle-unit]")) == null || l.addEventListener("click", () => {
7918
7935
  this.angleUnit = this.angleUnit === "rad" ? "deg" : "rad", this.render(this.inspection.getSnapshot());
7919
7936
  }), !(t != null && t.movable) || t.mimic || !$(e)) return;
7920
- const i = Dt(t, this.angleUnit), n = (h) => {
7937
+ const i = Tt(t, this.angleUnit), n = (h) => {
7921
7938
  !$(this.inspection.getSnapshot()) || !Number.isFinite(h) || (this.stopSweep(!1), this.inspection.setJointValue(t.name, h));
7922
7939
  }, s = this.root.querySelector("[data-joint-range]"), a = () => {
7923
7940
  if (this.draggingJoint !== t.name) return;
@@ -7938,8 +7955,8 @@ class xo {
7938
7955
  this.syncJointInputs(this.inspection.getSnapshot().jointValues[t.name] ?? 0);
7939
7956
  return;
7940
7957
  }
7941
- const { lower: b, upper: y } = Be(t);
7942
- n(Math.max(b, Math.min(y, f)));
7958
+ const { lower: g, upper: b } = Be(t);
7959
+ n(Math.max(g, Math.min(b, f)));
7943
7960
  }), this.root.querySelectorAll("[data-joint-value]").forEach((h) => h.addEventListener("click", () => n(Number(h.dataset.jointValue)))), (c = this.root.querySelector("[data-reset-joint]")) == null || c.addEventListener("click", () => {
7944
7961
  $(this.inspection.getSnapshot()) && (this.stopSweep(!1), this.inspection.resetJoint(t.name));
7945
7962
  }), (p = this.root.querySelector("[data-sweep-joint]")) == null || p.addEventListener("click", () => {
@@ -7979,7 +7996,7 @@ class xo {
7979
7996
  }
7980
7997
  syncJointInputs(e) {
7981
7998
  const t = this.root.querySelector("[data-joint-range]"), i = this.root.querySelector("[data-joint-number]"), n = this.inspection.getSnapshot(), s = n.nodes.find((a) => a.id === n.selectedEntityId);
7982
- (s == null ? void 0 : s.kind) === "joint" && (e *= Dt(s, this.angleUnit)), t && Number(t.value) !== e && (t.value = String(e)), i && (i.value = e.toFixed(3));
7999
+ (s == null ? void 0 : s.kind) === "joint" && (e *= Tt(s, this.angleUnit)), t && Number(t.value) !== e && (t.value = String(e)), i && (i.value = e.toFixed(3));
7983
8000
  }
7984
8001
  startSweep(e, t) {
7985
8002
  this.stopSweep(!1), this.sweep = { jointName: e.name, initial: t, startedAt: Date.now(), timer: null };
@@ -8004,37 +8021,37 @@ class xo {
8004
8021
  function wo(r, e, t, i, n) {
8005
8022
  var s, a;
8006
8023
  if (r.kind === "joint") {
8007
- const o = e.nodes.find((b) => b.kind === "link" && b.id === `link:${r.childLink}`), l = e.jointValues[r.name] ?? 0, { lower: d, upper: c } = Be(r, Math.PI), p = Dt(r, i), h = r.jointType === "prismatic" ? "m" : i === "deg" ? "°" : "rad", m = `<span class="vurdf-unit-label">${h}</span>`, f = r.mimic ? `<section class="vurdf-section vurdf-follower"><div class="vurdf-section-head"><strong>从属关节</strong>${m}<span class="vurdf-readonly-badge">只读 · 自动跟随</span></div><output class="vurdf-follower-value" data-joint-readout="${A(r.name)}">${Ae(r, l, i)}</output><div class="vurdf-follower-source"><span>主控关节</span><button class="vurdf-text-btn" data-entity="joint:${A(r.mimic.joint)}">${A(r.mimic.joint)}</button></div></section>` : r.movable ? `<fieldset class="vurdf-section vurdf-joint-controls" ${$(e) ? "" : "disabled"}>
8024
+ const o = e.nodes.find((g) => g.kind === "link" && g.id === `link:${r.childLink}`), l = e.jointValues[r.name] ?? 0, { lower: d, upper: c } = Be(r, Math.PI), p = Tt(r, i), h = r.jointType === "prismatic" ? "m" : i === "deg" ? "°" : "rad", m = `<span class="vurdf-unit-label">${h}</span>`, f = r.mimic ? `<section class="vurdf-section vurdf-follower"><div class="vurdf-section-head"><strong>从属关节</strong>${m}<span class="vurdf-readonly-badge">只读 · 自动跟随</span></div><output class="vurdf-follower-value" data-joint-readout="${L(r.name)}">${Ae(r, l, i)}</output><div class="vurdf-follower-source"><span>主控关节</span><button class="vurdf-text-btn" data-entity="joint:${L(r.mimic.joint)}">${L(r.mimic.joint)}</button></div></section>` : r.movable ? `<fieldset class="vurdf-section vurdf-joint-controls" ${$(e) ? "" : "disabled"}>
8008
8025
  <div class="vurdf-section-head"><strong>关节</strong>${m}<span class="vurdf-section-actions"><button class="vurdf-text-btn ${t ? "is-active" : ""}" data-sweep-joint>${t ? "停止扫描" : "扫描范围"}</button><button class="vurdf-text-btn" data-reset-joint>重置</button></span></div>
8009
8026
  <div class="vurdf-value"><input data-joint-range aria-label="关节位置" type="range" min="${d * p}" max="${c * p}" step="${p === 1 ? 1e-3 : 0.1}" value="${l * p}"><input data-joint-number aria-label="关节位置精确值" type="number" step="0.001" value="${(l * p).toFixed(3)}"></div>
8010
8027
  <div class="vurdf-quick"><span>${(d * p).toFixed(2)} ${h}</span><button data-joint-value="${d}">下限</button><button data-joint-value="0">零位</button><button data-joint-value="${c}">上限</button><span>${(c * p).toFixed(2)} ${h}</span></div>
8011
8028
  ${$(e) ? "" : '<p class="vurdf-control-hint">仿真运行期间只读,暂停后可选中部件并调整关节。</p>'}
8012
8029
  </fieldset>` : '<div class="vurdf-section"><div class="vurdf-empty">固定关节不可调节。</div></div>';
8013
- return `<div class="vurdf-entity"><label>${A(r.jointType.toUpperCase())} JOINT</label><h2>${A(r.name)}</h2><p>${A(r.parentLink)} → ${A(r.childLink)}</p></div>${f}${Oi(r, e, i)}<div class="vurdf-section"><div class="vurdf-section-head"><strong>变换与轴</strong><span>m / rad</span></div><dl class="vurdf-data"><dt>关节原点 XYZ</dt><dd>${r.originPosition.map(Ct).join(" ")}</dd><dt>关节原点 RPY</dt><dd>${r.originRotationRpy.map(Ct).join(" ")}</dd><dt>Axis xyz</dt><dd>${r.axis.map(Ct).join(" ")}</dd><dt>Lower</dt><dd>${((s = r.limits) == null ? void 0 : s.lower) ?? "—"}</dd><dt>Upper</dt><dd>${((a = r.limits) == null ? void 0 : a.upper) ?? "—"}</dd><dt>Effort</dt><dd>${r.effort ?? "—"}</dd><dt>Velocity</dt><dd>${r.velocity ?? "—"}</dd></dl></div>${o ? Fi(o, !0, n.has(o.id)) : ""}`;
8030
+ return `<div class="vurdf-entity"><label>${L(r.jointType.toUpperCase())} JOINT</label><h2>${L(r.name)}</h2><p>${L(r.parentLink)} → ${L(r.childLink)}</p></div>${f}${ji(r, e, i)}<div class="vurdf-section"><div class="vurdf-section-head"><strong>变换与轴</strong><span>m / rad</span></div><dl class="vurdf-data"><dt>关节原点 XYZ</dt><dd>${r.originPosition.map(Et).join(" ")}</dd><dt>关节原点 RPY</dt><dd>${r.originRotationRpy.map(Et).join(" ")}</dd><dt>Axis xyz</dt><dd>${r.axis.map(Et).join(" ")}</dd><dt>Lower</dt><dd>${((s = r.limits) == null ? void 0 : s.lower) ?? "—"}</dd><dt>Upper</dt><dd>${((a = r.limits) == null ? void 0 : a.upper) ?? "—"}</dd><dt>Effort</dt><dd>${r.effort ?? "—"}</dd><dt>Velocity</dt><dd>${r.velocity ?? "—"}</dd></dl></div>${o ? zi(o, !0, n.has(o.id)) : ""}`;
8014
8031
  }
8015
- return r.kind === "link" ? `<div class="vurdf-entity"><label>LINK</label><h2>${A(r.name)}</h2><p>${r.visualCount} Visual · ${r.collisionCount} Collision</p></div>${Oi(r, e, i)}${Fi(r, !1, n.has(r.id))}` : `<div class="vurdf-entity"><label>ROBOT</label><h2>${A(r.name)}</h2><p>${r.rootLinkIds.length} root link</p></div>`;
8032
+ return r.kind === "link" ? `<div class="vurdf-entity"><label>LINK</label><h2>${L(r.name)}</h2><p>${r.visualCount} Visual · ${r.collisionCount} Collision</p></div>${ji(r, e, i)}${zi(r, !1, n.has(r.id))}` : `<div class="vurdf-entity"><label>ROBOT</label><h2>${L(r.name)}</h2><p>${r.rootLinkIds.length} root link</p></div>`;
8016
8033
  }
8017
- function Lt(r) {
8034
+ function Dt(r) {
8018
8035
  if (r === void 0) return "<span>—</span>";
8019
8036
  const e = String(r), t = Number.isFinite(r) ? String(Number(r.toPrecision(6))) : e;
8020
8037
  return `<button type="button" class="vurdf-source-number" data-copy-number="${e}" title="${e} · 点击复制完整数值" aria-label="复制完整数值 ${e}">${t}</button>`;
8021
8038
  }
8022
- function ji(r, e, t, i) {
8023
- return `<div class="vurdf-vector"><div class="vurdf-vector-title">${r}<span>${i}</span></div><dl>${e.map((n, s) => `<div><dt>${n}</dt><dd>${Lt(t == null ? void 0 : t[s])}</dd></div>`).join("")}</dl></div>`;
8039
+ function Fi(r, e, t, i) {
8040
+ return `<div class="vurdf-vector"><div class="vurdf-vector-title">${r}<span>${i}</span></div><dl>${e.map((n, s) => `<div><dt>${n}</dt><dd>${Dt(t == null ? void 0 : t[s])}</dd></div>`).join("")}</dl></div>`;
8024
8041
  }
8025
- function Fi(r, e, t) {
8042
+ function zi(r, e, t) {
8026
8043
  return `<section class="vurdf-section" data-link-inertial>
8027
- <div class="vurdf-section-head vurdf-component-title"><strong>${e ? "子部件" : "部件属性"} · ${A(r.name)}</strong></div>
8028
- <dl class="vurdf-data"><dt>质量 (kg)</dt><dd>${Lt(r.mass)}</dd></dl>
8044
+ <div class="vurdf-section-head vurdf-component-title"><strong>${e ? "子部件" : "部件属性"} · ${L(r.name)}</strong></div>
8045
+ <dl class="vurdf-data"><dt>质量 (kg)</dt><dd>${Dt(r.mass)}</dd></dl>
8029
8046
  <div class="vurdf-inertial-frame">惯性原点 · 相对于 Link</div>
8030
- ${ji("质心位置", ["X", "Y", "Z"], r.centerOfMass, "m")}
8031
- ${ji("惯性坐标系旋转", ["R", "P", "Y"], r.inertialRotationRpy, "rad")}
8032
- <details class="vurdf-inertia-details" data-inertia-details="${A(r.id)}" ${t ? "open" : ""}>
8047
+ ${Fi("质心位置", ["X", "Y", "Z"], r.centerOfMass, "m")}
8048
+ ${Fi("惯性坐标系旋转", ["R", "P", "Y"], r.inertialRotationRpy, "rad")}
8049
+ <details class="vurdf-inertia-details" data-inertia-details="${L(r.id)}" ${t ? "open" : ""}>
8033
8050
  <summary>${W("chevron")}<strong>惯性张量</strong><span>kg·m²</span></summary>
8034
8051
  <div class="vurdf-inertial-frame">关于质心 · 惯性坐标系</div>
8035
8052
  <dl class="vurdf-data">${["Ixx", "Iyy", "Izz", "Ixy", "Ixz", "Iyz"].map((i, n) => {
8036
8053
  var s;
8037
- return `<dt>${i}</dt><dd>${Lt((s = r.inertiaTensor) == null ? void 0 : s[n])}</dd>`;
8054
+ return `<dt>${i}</dt><dd>${Dt((s = r.inertiaTensor) == null ? void 0 : s[n])}</dd>`;
8038
8055
  }).join("")}</dl>
8039
8056
  </details>
8040
8057
  </section>`;
@@ -8045,21 +8062,21 @@ function Co(r, e) {
8045
8062
  return `<pre class="vurdf-source"><code>${t.map((o, l) => `<span class="line ${e && l + 1 >= i && l + 1 <= n ? "is-selected" : ""}"><span class="ln">${l + 1}</span>${So(o)}</span>`).join("")}</code></pre>`;
8046
8063
  }
8047
8064
  function Eo(r) {
8048
- return r.issues.length ? r.issues.map((e) => `<button class="vurdf-issue" data-issue-entity="${A(e.entityId)}">${W("error")}<span><b>${A(e.title)}</b><small>${A(e.message)}</small></span></button>`).join("") : '<div class="vurdf-empty">所有严格结构与数学检查通过。</div>';
8065
+ return r.issues.length ? r.issues.map((e) => `<button class="vurdf-issue" data-issue-entity="${L(e.entityId)}">${W("error")}<span><b>${L(e.title)}</b><small>${L(e.message)}</small></span></button>`).join("") : '<div class="vurdf-empty">所有严格结构与数学检查通过。</div>';
8049
8066
  }
8050
- function wt(r, e, t) {
8067
+ function Ct(r, e, t) {
8051
8068
  return `<button class="vurdf-tab ${r === t ? "is-active" : ""}" data-tab="${r}">${e}</button>`;
8052
8069
  }
8053
8070
  function ko() {
8054
8071
  return '<div class="vurdf-empty vurdf-no-selection">点击模型或结构树选择部件;点击场景空白处可取消选择。</div>';
8055
8072
  }
8056
- function Ct(r) {
8073
+ function Et(r) {
8057
8074
  return r.toFixed(3);
8058
8075
  }
8059
8076
  function So(r) {
8060
- return A(r).replace(/(&lt;\/?[\w:-]+)/g, '<span class="tag">$1</span>').replace(/([\w:-]+)=(&quot;.*?&quot;)/g, '<span class="attr">$1</span>=<span class="str">$2</span>');
8077
+ return L(r).replace(/(&lt;\/?[\w:-]+)/g, '<span class="tag">$1</span>').replace(/([\w:-]+)=(&quot;.*?&quot;)/g, '<span class="attr">$1</span>=<span class="str">$2</span>');
8061
8078
  }
8062
- function Dt(r, e) {
8079
+ function Tt(r, e) {
8063
8080
  return r.jointType !== "prismatic" && e === "deg" ? 180 / Math.PI : 1;
8064
8081
  }
8065
8082
  function Po(r) {
@@ -8134,9 +8151,9 @@ class Mo {
8134
8151
  }), o.addEventListener("pointermove", (d) => {
8135
8152
  const c = this.windowResize;
8136
8153
  if (!c || c.id !== d.pointerId) return;
8137
- const p = this.element.parentElement, h = d.clientX - c.x, m = d.clientY - c.y, f = 420, b = 320;
8138
- let y = c.left, v = c.top, g = c.width, w = c.height;
8139
- (c.corner === "tr" || c.corner === "br") && (g = Math.max(f, c.width + h)), (c.corner === "tl" || c.corner === "bl") && (g = Math.max(f, c.width - h), y = c.left + c.width - g), c.corner === "tr" && (w = Math.max(b, c.height - m), v = c.top + c.height - w), (c.corner === "br" || c.corner === "bl") && (w = Math.max(b, c.height + m)), c.corner === "tl" && (w = Math.max(b, c.height - m), v = c.top + c.height - w), y = Math.max(0, Math.min(y, Math.max(0, p.clientWidth - g))), v = Math.max(0, Math.min(v, Math.max(0, p.clientHeight - w))), g = Math.min(g, p.clientWidth - y), w = Math.min(w, p.clientHeight - v), this.element.style.left = `${y}px`, this.element.style.top = `${v}px`, this.element.style.width = `${Math.max(f, g)}px`, this.element.style.height = `${Math.max(b, w)}px`;
8154
+ const p = this.element.parentElement, h = d.clientX - c.x, m = d.clientY - c.y, f = 420, g = 320;
8155
+ let b = c.left, x = c.top, v = c.width, w = c.height;
8156
+ (c.corner === "tr" || c.corner === "br") && (v = Math.max(f, c.width + h)), (c.corner === "tl" || c.corner === "bl") && (v = Math.max(f, c.width - h), b = c.left + c.width - v), c.corner === "tr" && (w = Math.max(g, c.height - m), x = c.top + c.height - w), (c.corner === "br" || c.corner === "bl") && (w = Math.max(g, c.height + m)), c.corner === "tl" && (w = Math.max(g, c.height - m), x = c.top + c.height - w), b = Math.max(0, Math.min(b, Math.max(0, p.clientWidth - v))), x = Math.max(0, Math.min(x, Math.max(0, p.clientHeight - w))), v = Math.min(v, p.clientWidth - b), w = Math.min(w, p.clientHeight - x), this.element.style.left = `${b}px`, this.element.style.top = `${x}px`, this.element.style.width = `${Math.max(f, v)}px`, this.element.style.height = `${Math.max(g, w)}px`;
8140
8157
  });
8141
8158
  const l = () => {
8142
8159
  this.windowResize = null;
@@ -8190,7 +8207,7 @@ class Mo {
8190
8207
  this.graph.innerHTML = i.edges.map((s) => {
8191
8208
  const a = n.get(s.from), o = n.get(s.to), l = a.y + 20, d = o.y - 20, c = (l + d) / 2;
8192
8209
  return `<path class="vurdf-diagram-edge" d="M${a.x} ${l} C${a.x} ${c},${o.x} ${c},${o.x} ${d}"/>`;
8193
- }).join("") + i.nodes.map(({ node: s, x: a, y: o }) => `<g class="vurdf-diagram-node" data-diagram-node="${H(s.id)}" transform="translate(${a - 90} ${o - 20})" role="button" tabindex="0" aria-label="${H(s.name)}"><title>${H(s.name)}</title><rect width="180" height="40" rx="${s.kind === "joint" ? 20 : 5}"/><text x="90" y="16">${H(s.name.length > 26 ? s.name.slice(0, 24) + "…" : s.name)}</text><text class="vurdf-diagram-kind" x="90" y="31">${H(s.kind === "joint" ? s.jointType : s.kind)}</text></g>`).join(""), this.fit();
8210
+ }).join("") + i.nodes.map(({ node: s, x: a, y: o }) => `<g class="vurdf-diagram-node" data-diagram-node="${U(s.id)}" transform="translate(${a - 90} ${o - 20})" role="button" tabindex="0" aria-label="${U(s.name)}"><title>${U(s.name)}</title><rect width="180" height="40" rx="${s.kind === "joint" ? 20 : 5}"/><text x="90" y="16">${U(s.name.length > 26 ? s.name.slice(0, 24) + "…" : s.name)}</text><text class="vurdf-diagram-kind" x="90" y="31">${U(s.kind === "joint" ? s.jointType : s.kind)}</text></g>`).join(""), this.fit();
8194
8211
  }
8195
8212
  const t = e.mode === "dynamics-running" || e.mode === "dynamics-initializing";
8196
8213
  for (const i of this.graph.querySelectorAll("[data-diagram-node]")) {
@@ -8249,7 +8266,7 @@ class Ro {
8249
8266
  <button class="vurdf-tool ${this.namesVisible ? "is-active" : ""}" data-name-labels aria-pressed="${this.namesVisible}" title="显示/隐藏部件名称">${W("names")}名称</button>
8250
8267
  ${e.nodes.some((a) => a.kind === "joint" && a.movable && a.jointType !== "prismatic") ? vo(i) : ""}
8251
8268
  <span class="vurdf-tool-divider" aria-hidden="true"></span>
8252
- ${Ke("ground", zi(this.ctx) ? "隐藏地面" : "显示地面", zi(this.ctx), "ground")}
8269
+ ${Ke("ground", $i(this.ctx) ? "隐藏地面" : "显示地面", $i(this.ctx), "ground")}
8253
8270
  ${Ke("fit", "适应视图", !1, "fit")}
8254
8271
  ${Ke("theme", this.theme === "dark" ? "浅色主题" : "深色主题", !1, this.theme === "dark" ? "sun" : "moon")}
8255
8272
  <span class="vurdf-tool-divider" aria-hidden="true"></span>
@@ -8289,9 +8306,9 @@ function Ke(r, e, t, i) {
8289
8306
  }
8290
8307
  function Ao(r, e, t) {
8291
8308
  const i = r.mode === "dynamics-running", n = i ? "暂停仿真" : r.mode === "dynamics-initializing" ? "启动中" : "启动仿真";
8292
- return `<button class="vurdf-tool vurdf-dynamics ${i ? "is-active" : ""}" data-mode="dynamics" ${e ? "disabled" : ""} title="${A(t)}">${W(i ? "pause" : "play")}${n}</button>`;
8309
+ return `<button class="vurdf-tool vurdf-dynamics ${i ? "is-active" : ""}" data-mode="dynamics" ${e ? "disabled" : ""} title="${L(t)}">${W(i ? "pause" : "play")}${n}</button>`;
8293
8310
  }
8294
- function zi(r) {
8311
+ function $i(r) {
8295
8312
  return r.asset.$readControl().groundVisible;
8296
8313
  }
8297
8314
  class Io {
@@ -8301,7 +8318,7 @@ class Io {
8301
8318
  }
8302
8319
  update(e) {
8303
8320
  const t = e.nodes.find((i) => i.id === e.selectedEntityId) ?? null;
8304
- this.element.innerHTML = `<span>模型已就绪</span><span title="${A(e.sourcePath)}">${A(e.sourcePath)}</span><span>选择:${t ? A(t.name) : "无"}</span>${(t == null ? void 0 : t.kind) === "joint" && t.movable && $(e) ? '<span class="vurdf-gesture-hint" title="选中可动关节,将鼠标移入场景,按住 R 左右移动调节,松开 R 结束。运行仿真时不可用。">按住 R + 鼠标左右移动</span>' : ""}<span class="spacer"></span><span>Z-Up</span><span>m / kg / s</span><span>${Lo(e.mode)}</span><span class="${e.issues.length ? "vurdf-status-error" : "vurdf-status-ok"}">${e.issues.length ? `${e.issues.length} 个错误` : "严格检查通过"}</span>`;
8321
+ this.element.innerHTML = `<span>模型已就绪</span><span title="${L(e.sourcePath)}">${L(e.sourcePath)}</span><span>选择:${t ? L(t.name) : "无"}</span>${(t == null ? void 0 : t.kind) === "joint" && t.movable && $(e) ? '<span class="vurdf-gesture-hint" title="选中可动关节,将鼠标移入场景,按住 R 左右移动调节,松开 R 结束。运行仿真时不可用。">按住 R + 鼠标左右移动</span>' : ""}<span class="spacer"></span><span>Z-Up</span><span>m / kg / s</span><span>${Lo(e.mode)}</span><span class="${e.issues.length ? "vurdf-status-error" : "vurdf-status-ok"}">${e.issues.length ? `${e.issues.length} 个错误` : "严格检查通过"}</span>`;
8305
8322
  }
8306
8323
  dispose() {
8307
8324
  this.element.remove();
@@ -8371,7 +8388,7 @@ class Do {
8371
8388
  var f;
8372
8389
  if (d.button !== 0) return;
8373
8390
  d.preventDefault(), this.root.classList.add("is-resizing"), (f = o.setPointerCapture) == null || f.call(o, d.pointerId);
8374
- const c = d.clientX, p = t.getBoundingClientRect().width, h = (b) => l(p + (e === "left" ? 1 : -1) * (b.clientX - c)), m = () => {
8391
+ const c = d.clientX, p = t.getBoundingClientRect().width, h = (g) => l(p + (e === "left" ? 1 : -1) * (g.clientX - c)), m = () => {
8375
8392
  o.removeEventListener("pointermove", h), o.removeEventListener("pointerup", m), o.removeEventListener("pointercancel", m), o.removeEventListener("lostpointercapture", m), this.resizeCleanup = null, this.root.classList.remove("is-resizing");
8376
8393
  };
8377
8394
  this.resizeCleanup = m, o.addEventListener("pointermove", h), o.addEventListener("pointerup", m), o.addEventListener("pointercancel", m), o.addEventListener("lostpointercapture", m);
@@ -8537,11 +8554,11 @@ function Oo(r) {
8537
8554
  l.events.on("pick", (h) => {
8538
8555
  var f;
8539
8556
  const m = l.asset.$inspection();
8540
- (m == null ? void 0 : m.kind) === "urdf" && $(m.getSnapshot()) && (i == null || i.selectFromScene($i(m, ((f = h.result) == null ? void 0 : f.object) ?? null)));
8557
+ (m == null ? void 0 : m.kind) === "urdf" && $(m.getSnapshot()) && (i == null || i.selectFromScene(Vi(m, ((f = h.result) == null ? void 0 : f.object) ?? null)));
8541
8558
  }),
8542
8559
  l.events.on("selection-change", (h) => {
8543
8560
  const m = l.asset.$inspection();
8544
- (m == null ? void 0 : m.kind) === "urdf" && $(m.getSnapshot()) && (i == null || i.selectFromScene($i(m, h.object)));
8561
+ (m == null ? void 0 : m.kind) === "urdf" && $(m.getSnapshot()) && (i == null || i.selectFromScene(Vi(m, h.object)));
8545
8562
  })
8546
8563
  ), c();
8547
8564
  },
@@ -8559,7 +8576,7 @@ function jo(r) {
8559
8576
  }
8560
8577
  return null;
8561
8578
  }
8562
- function $i(r, e) {
8579
+ function Vi(r, e) {
8563
8580
  var s;
8564
8581
  const t = jo(e), i = r.getSnapshot(), n = i.nodes.find((a) => a.id === t && a.kind === "link");
8565
8582
  return n ? ((s = i.nodes.find((a) => a.kind === "joint" && a.childLink === n.name)) == null ? void 0 : s.id) ?? t : t;
@@ -8835,8 +8852,10 @@ function zo(r) {
8835
8852
  return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${r}</svg>`;
8836
8853
  }
8837
8854
  function $o(r, e, t) {
8838
- var p;
8839
- const i = Bo(r), n = Vi([t, e.signal, i]), s = ((p = e.filename) == null ? void 0 : p.trim()) || _o(r), a = Tt(r) ? qo(r.files, r.entry, s) : s, o = Rn(r), l = e.baseUrl ?? Ho(o), d = /* @__PURE__ */ new Set(), c = Tt(r) ? new Map(r.files.map((h) => [se(h.path), h])) : null;
8855
+ var h, m, f;
8856
+ const i = Bo(r), n = Bi([t, e.signal, i]), s = ((h = e.filename) == null ? void 0 : h.trim()) || _o(r), a = Nt(r) ? qo(r.files, r.entry, s) : s, o = Rn(r), l = e.baseUrl ?? Ho(o), d = /* @__PURE__ */ new Set(), c = Nt(r) ? new Map(r.files.map((g) => [ie(g.path), g])) : null, p = Wo(
8857
+ ((f = (m = e.resourceResolver) == null ? void 0 : m.listResources) == null ? void 0 : f.call(m)) ?? []
8858
+ );
8840
8859
  return Object.freeze({
8841
8860
  original: r,
8842
8861
  entryPath: a,
@@ -8845,28 +8864,29 @@ function $o(r, e, t) {
8845
8864
  signal: n,
8846
8865
  baseUrl: l,
8847
8866
  hasResourceResolver: !!e.resourceResolver,
8848
- async resolve(h, m) {
8849
- const f = m ? Vi([n, m]) : n;
8850
- Bi(f);
8851
- const b = se(h), y = Uo(r);
8852
- if (y && (!b || b === se(a ?? ""))) {
8853
- const w = URL.createObjectURL(y);
8854
- return d.add(w), w;
8867
+ resourcePaths: p,
8868
+ async resolve(g, b) {
8869
+ const x = b ? Bi([n, b]) : n;
8870
+ Ui(x);
8871
+ const v = ie(g), w = Uo(r);
8872
+ if (w && (!v || v === ie(a ?? ""))) {
8873
+ const k = URL.createObjectURL(w);
8874
+ return d.add(k), k;
8855
8875
  }
8856
- const v = (c == null ? void 0 : c.get(b)) ?? Yo(c, a, b);
8857
- if (v) {
8858
- const w = URL.createObjectURL(v.file);
8859
- return d.add(w), w;
8876
+ const y = (c == null ? void 0 : c.get(v)) ?? Yo(c, a, v);
8877
+ if (y) {
8878
+ const k = URL.createObjectURL(y.file);
8879
+ return d.add(k), k;
8860
8880
  }
8861
- const g = await Wo(e.resourceResolver, h, f);
8862
- if (Bi(f), g instanceof Blob) {
8863
- const w = URL.createObjectURL(g);
8864
- return d.add(w), w;
8881
+ const C = await Go(e.resourceResolver, g, x);
8882
+ if (Ui(x), C instanceof Blob) {
8883
+ const k = URL.createObjectURL(C);
8884
+ return d.add(k), k;
8865
8885
  }
8866
- return g instanceof URL ? g.href : typeof g == "string" ? g : l ? new URL(h, l).href : h;
8886
+ return C instanceof URL ? C.href : typeof C == "string" ? C : l ? new URL(g, l).href : g;
8867
8887
  },
8868
8888
  release() {
8869
- for (const h of d) URL.revokeObjectURL(h);
8889
+ for (const g of d) URL.revokeObjectURL(g);
8870
8890
  d.clear();
8871
8891
  }
8872
8892
  });
@@ -8888,7 +8908,7 @@ function Vo(r) {
8888
8908
  const i = /\.([a-z0-9]+)$/i.exec(t);
8889
8909
  return ((n = i == null ? void 0 : i[1]) == null ? void 0 : n.toLowerCase()) ?? null;
8890
8910
  }
8891
- function Vi(r) {
8911
+ function Bi(r) {
8892
8912
  const e = r.filter((n) => !!n);
8893
8913
  if (e.length === 0) return new AbortController().signal;
8894
8914
  if (e.length === 1) return e[0];
@@ -8903,7 +8923,7 @@ function Vi(r) {
8903
8923
  }
8904
8924
  return t.signal;
8905
8925
  }
8906
- function Bi(r) {
8926
+ function Ui(r) {
8907
8927
  if (r.aborted)
8908
8928
  throw typeof r.throwIfAborted == "function" && r.throwIfAborted(), new DOMException("The operation was aborted.", "AbortError");
8909
8929
  }
@@ -8925,7 +8945,7 @@ function _o(r) {
8925
8945
  } catch {
8926
8946
  return ((t = e.split(/[?#]/, 1)[0]) == null ? void 0 : t.split("/").pop()) || null;
8927
8947
  }
8928
- return Tt(r) ? r.entry ?? null : typeof File < "u" && r instanceof File && r.name || null;
8948
+ return Nt(r) ? r.entry ?? null : typeof File < "u" && r instanceof File && r.name || null;
8929
8949
  }
8930
8950
  function Ho(r) {
8931
8951
  var e;
@@ -8936,38 +8956,56 @@ function Ho(r) {
8936
8956
  return null;
8937
8957
  }
8938
8958
  }
8939
- function Tt(r) {
8959
+ function Nt(r) {
8940
8960
  return typeof r == "object" && r !== null && "kind" in r && r.kind === "files";
8941
8961
  }
8942
8962
  function qo(r, e, t) {
8943
8963
  if (e) {
8944
- const i = se(e);
8945
- if (!r.some((n) => se(n.path) === i))
8946
- throw Ui(`Asset package entry not found: ${e}`, "E_ASSET_ENTRY_NOT_FOUND");
8964
+ const i = ie(e);
8965
+ if (!r.some((n) => ie(n.path) === i))
8966
+ throw ot(`Asset package entry not found: ${e}`, "E_ASSET_ENTRY_NOT_FOUND");
8947
8967
  return i;
8948
8968
  }
8949
8969
  if (t) {
8950
- const i = se(t);
8951
- if (r.filter((s) => se(s.path) === i).length === 1) return i;
8970
+ const i = ie(t);
8971
+ if (r.filter((s) => ie(s.path) === i).length === 1) return i;
8952
8972
  }
8953
- if (r.length === 1) return se(r[0].path);
8954
- throw Ui("Asset package has multiple files; specify an entry.", "E_ASSET_AMBIGUOUS_ENTRY");
8973
+ if (r.length === 1) return ie(r[0].path);
8974
+ throw ot("Asset package has multiple files; specify an entry.", "E_ASSET_AMBIGUOUS_ENTRY");
8955
8975
  }
8956
8976
  function Yo(r, e, t) {
8957
8977
  if (!r || !e) return;
8958
8978
  const i = e.lastIndexOf("/"), n = i < 0 ? "" : e.slice(0, i + 1);
8959
- return r.get(se(`${n}${t}`));
8979
+ return r.get(ie(`${n}${t}`));
8960
8980
  }
8961
- function se(r) {
8981
+ function ie(r) {
8962
8982
  const e = [];
8963
8983
  for (const t of r.replaceAll("\\", "/").split("/"))
8964
- !t || t === "." || (t === ".." ? e.pop() : e.push(t));
8984
+ !t || t === "." || (t === ".." ? e.length && e.at(-1) !== ".." ? e.pop() : e.push("..") : e.push(t));
8965
8985
  return e.join("/");
8966
8986
  }
8967
- async function Wo(r, e, t) {
8987
+ function Wo(r) {
8988
+ const e = /* @__PURE__ */ new Set();
8989
+ for (const t of r) {
8990
+ if (/^[a-z][a-z\d+.-]*:/i.test(t) || t.startsWith("/"))
8991
+ throw ot(
8992
+ `resourceResolver.listResources() must return entry-relative paths: ${t}`,
8993
+ "E_ASSET_RESOURCE_PATH_INVALID"
8994
+ );
8995
+ if (t.includes("?") || t.includes("#"))
8996
+ throw ot(
8997
+ `resourceResolver.listResources() must return logical paths without query or hash: ${t}`,
8998
+ "E_ASSET_RESOURCE_PATH_INVALID"
8999
+ );
9000
+ const i = ie(t);
9001
+ i && e.add(i);
9002
+ }
9003
+ return Object.freeze([...e]);
9004
+ }
9005
+ async function Go(r, e, t) {
8968
9006
  return r ? r.resolve(e, { signal: t }) : null;
8969
9007
  }
8970
- function Ui(r, e) {
9008
+ function ot(r, e) {
8971
9009
  return Object.assign(new Error(r), { code: e });
8972
9010
  }
8973
9011
  const _i = Object.freeze({
@@ -8980,8 +9018,8 @@ const _i = Object.freeze({
8980
9018
  }), Ee = Object.freeze({
8981
9019
  light: 15265002,
8982
9020
  dark: 593167
8983
- }), Go = 0.05;
8984
- class Xo {
9021
+ }), Xo = 0.05;
9022
+ class Ko {
8985
9023
  constructor(e) {
8986
9024
  u(this, "epoch", 0);
8987
9025
  u(this, "active", null);
@@ -9013,9 +9051,9 @@ class Xo {
9013
9051
  epoch: s,
9014
9052
  abort: new AbortController(),
9015
9053
  listeners: /* @__PURE__ */ new Set(),
9016
- ready: Et(),
9017
- finished: Et(),
9018
- closeResult: Et(),
9054
+ ready: kt(),
9055
+ finished: kt(),
9056
+ closeResult: kt(),
9019
9057
  options: t,
9020
9058
  snapshot: Object.freeze({ revision: 0, phase: "detecting", format: null, kind: null, capabilities: null, error: null, filename: null }),
9021
9059
  dynamic: !1,
@@ -9114,7 +9152,7 @@ class Xo {
9114
9152
  if (!t || !this.current(t) || t.snapshot.phase !== "ready" || !t.dynamic || !t.session) return !1;
9115
9153
  const i = t.session, n = t.playing ? i.update : i.updatePaused;
9116
9154
  if (!n) return !1;
9117
- const s = t.resetFrameClock ? 0 : Math.max(0, Math.min(Number.isNaN(e) ? 0 : e, Go));
9155
+ const s = t.resetFrameClock ? 0 : Math.max(0, Math.min(Number.isNaN(e) ? 0 : e, Xo));
9118
9156
  t.resetFrameClock = !1;
9119
9157
  try {
9120
9158
  return !!(n.call(i, s) && this.current(t) && t.snapshot.phase === "ready");
@@ -9140,7 +9178,7 @@ class Xo {
9140
9178
  const o = this.detect(e), l = Hi(o) ? await o : o;
9141
9179
  if (!this.current(e) || (e.loader = l.loader, !this.current(e))) return;
9142
9180
  if (!this.host.loaders().includes(l.loader))
9143
- throw X("Asset loader was removed.", "E_ABORTED");
9181
+ throw K("Asset loader was removed.", "E_ABORTED");
9144
9182
  if (this.transition(e, {
9145
9183
  phase: "loading",
9146
9184
  format: l.format,
@@ -9164,24 +9202,25 @@ class Xo {
9164
9202
  },
9165
9203
  ...this.host.invalidateTransmissionCaches ? {
9166
9204
  invalidateTransmissionCaches: () => {
9167
- var f, b;
9168
- this.current(e) && ((b = (f = this.host).invalidateTransmissionCaches) == null || b.call(f));
9205
+ var f, g;
9206
+ this.current(e) && ((g = (f = this.host).invalidateTransmissionCaches) == null || g.call(f));
9169
9207
  }
9170
9208
  } : {},
9171
- fit: (f, b) => this.current(e) ? this.host.fit(f, b) : !1,
9172
- reportError: (f, b) => this.report(e, f, b),
9209
+ fit: (f, g) => this.current(e) ? this.host.fit(f, g) : !1,
9210
+ reportError: (f, g) => this.report(e, f, g),
9173
9211
  reportSessionState: () => {
9174
- var b;
9212
+ var g;
9175
9213
  if (!this.current(e) || e.snapshot.phase !== "ready" || !e.session) return;
9176
9214
  const f = e.session;
9177
- f.isPlaying && (e.playing = f.isPlaying()), ((b = f.physics) == null ? void 0 : b.status) === "unavailable" && (e.playing = !1, e.resetFrameClock = !1, this.endGrabOf(e)), this.transition(e, {
9215
+ f.isPlaying && (e.playing = f.isPlaying()), ((g = f.physics) == null ? void 0 : g.status) === "unavailable" && (e.playing = !1, e.resetFrameClock = !1, this.endGrabOf(e)), this.transition(e, {
9178
9216
  capabilities: f.capabilities ?? _i,
9179
9217
  physics: f.physics ?? null,
9218
+ backgroundLoading: f.backgroundLoading ?? null,
9180
9219
  warning: f.warning ?? null
9181
9220
  }), this.publishControl(e), this.host.requestRender();
9182
9221
  },
9183
- reportProgress: (f, b) => {
9184
- this.current(e) && e.snapshot.phase === "loading" && this.transition(e, { stage: f, message: b });
9222
+ reportProgress: (f, g) => {
9223
+ this.current(e) && e.snapshot.phase === "loading" && this.transition(e, { stage: f, message: g });
9185
9224
  }
9186
9225
  }, h = l.loader.createSession(e.source, p), m = Hi(h) ? await h : h;
9187
9226
  if (e.session && e.session !== m) {
@@ -9199,7 +9238,7 @@ class Xo {
9199
9238
  if (e.mounted = m.root, this.host.mount(m.root), !this.current(e)) return;
9200
9239
  if (((i = m.presentation ?? l.loader.presentation) == null ? void 0 : i.fitPolicy) === "fit-on-ready") {
9201
9240
  const f = ((n = m.getFitBounds) == null ? void 0 : n.call(m)) ?? m.fitTarget ?? m.root;
9202
- if (!this.host.fit(f, { padding: 1.15 })) throw X("Asset has no displayable geometry.", "E_ASSET_EMPTY");
9241
+ if (!this.host.fit(f, { padding: 1.15 })) throw K("Asset has no displayable geometry.", "E_ASSET_EMPTY");
9203
9242
  }
9204
9243
  }
9205
9244
  if (!this.current(e)) return;
@@ -9207,7 +9246,8 @@ class Xo {
9207
9246
  phase: "ready",
9208
9247
  capabilities: m.capabilities ?? _i,
9209
9248
  warning: m.warning ?? null,
9210
- physics: m.physics ?? null
9249
+ physics: m.physics ?? null,
9250
+ backgroundLoading: m.backgroundLoading ?? null
9211
9251
  }), this.current(e) && e.snapshot.phase === "ready" && e.ready.resolve();
9212
9252
  } catch (s) {
9213
9253
  this.current(e) && this.report(e, s, { fatal: !0, stage: "load" });
@@ -9220,23 +9260,23 @@ class Xo {
9220
9260
  if (a) {
9221
9261
  const o = i.find((l) => l.formats.includes(a));
9222
9262
  if (o) return { loader: o, format: a };
9223
- if (n && n !== "auto") throw X(`Unsupported asset format: ${n}`, "E_ASSET_UNKNOWN_FORMAT");
9263
+ if (n && n !== "auto") throw K(`Unsupported asset format: ${n}`, "E_ASSET_UNKNOWN_FORMAT");
9224
9264
  }
9225
9265
  return this.matchLoaders(e, i, 0);
9226
9266
  }
9227
9267
  async matchLoaders(e, t, i) {
9228
9268
  var n;
9229
9269
  for (let s = i; s < t.length; s += 1) {
9230
- if (!this.current(e)) throw X("Asset open superseded.", "E_SUPERSEDED");
9270
+ if (!this.current(e)) throw K("Asset open superseded.", "E_SUPERSEDED");
9231
9271
  const a = t[s], o = await ((n = a.match) == null ? void 0 : n.call(a, e.source));
9232
9272
  if (o && o.format !== "auto" && a.formats.includes(o.format)) return { loader: a, format: o.format };
9233
9273
  }
9234
- throw X("Unable to determine asset format automatically; provide a supported filename or specify format explicitly.", "E_ASSET_UNKNOWN_FORMAT");
9274
+ throw K("Unable to determine asset format automatically; provide a supported filename or specify format explicitly.", "E_ASSET_UNKNOWN_FORMAT");
9235
9275
  }
9236
9276
  stop(e, t) {
9237
9277
  var i;
9238
9278
  if (e.stopped) return e.closeResult.promise;
9239
- if (e.stopped = !0, e.playing = !1, e.resetFrameClock = !1, this.endGrabOf(e), this.active === e && (this.active = null, this.host.applyProfile(void 0)), e.ready.reject(X(t === "E_SUPERSEDED" ? "Asset open superseded." : "Asset open aborted.", t)), (i = e.unsubscribeAbort) == null || i.call(e), e.abort.abort(), this.beginDispose(e), e.mounted) {
9279
+ if (e.stopped = !0, e.playing = !1, e.resetFrameClock = !1, this.endGrabOf(e), this.active === e && (this.active = null, this.host.applyProfile(void 0)), e.ready.reject(K(t === "E_SUPERSEDED" ? "Asset open superseded." : "Asset open aborted.", t)), (i = e.unsubscribeAbort) == null || i.call(e), e.abort.abort(), this.beginDispose(e), e.mounted) {
9240
9280
  const n = e.mounted;
9241
9281
  e.mounted = void 0;
9242
9282
  try {
@@ -9281,11 +9321,11 @@ class Xo {
9281
9321
  }
9282
9322
  control(e, t) {
9283
9323
  var n, s;
9284
- if (!this.current(e)) throw X("Asset is inactive.", "E_ASSET_INACTIVE");
9285
- if (e.snapshot.phase !== "ready") throw X("Asset is not ready.", "E_ASSET_NOT_READY");
9324
+ if (!this.current(e)) throw K("Asset is inactive.", "E_ASSET_INACTIVE");
9325
+ if (e.snapshot.phase !== "ready") throw K("Asset is not ready.", "E_ASSET_NOT_READY");
9286
9326
  const i = t === "play" ? "canPlay" : t === "pause" ? "canPause" : "canReset";
9287
9327
  if (!((n = e.snapshot.capabilities) != null && n[i]) || !((s = e.session) != null && s[t]))
9288
- throw X(`Asset does not support ${t}.`, "E_ASSET_CAPABILITY_UNAVAILABLE");
9328
+ throw K(`Asset does not support ${t}.`, "E_ASSET_CAPABILITY_UNAVAILABLE");
9289
9329
  this.applyControl(e, t);
9290
9330
  }
9291
9331
  applyControl(e, t) {
@@ -9298,19 +9338,19 @@ class Xo {
9298
9338
  * surface returns booleans instead of throwing `E_ASSET_*`.
9299
9339
  */
9300
9340
  requireReady(e) {
9301
- if (!this.current(e)) throw X("Asset is inactive.", "E_ASSET_INACTIVE");
9302
- if (e.snapshot.phase !== "ready") throw X("Asset is not ready.", "E_ASSET_NOT_READY");
9341
+ if (!this.current(e)) throw K("Asset is inactive.", "E_ASSET_INACTIVE");
9342
+ if (e.snapshot.phase !== "ready") throw K("Asset is not ready.", "E_ASSET_NOT_READY");
9303
9343
  }
9304
9344
  requireCapability(e, t, i) {
9305
9345
  var n;
9306
9346
  if (this.requireReady(e), !((n = e.snapshot.capabilities) != null && n[t]))
9307
- throw X(i, "E_ASSET_CAPABILITY_UNAVAILABLE");
9347
+ throw K(i, "E_ASSET_CAPABILITY_UNAVAILABLE");
9308
9348
  }
9309
9349
  requireSession(e, t, i) {
9310
9350
  var s;
9311
9351
  this.requireReady(e);
9312
9352
  const n = (s = e.session) == null ? void 0 : s[t];
9313
- if (typeof n != "function") throw X(i, "E_ASSET_CAPABILITY_UNAVAILABLE");
9353
+ if (typeof n != "function") throw K(i, "E_ASSET_CAPABILITY_UNAVAILABLE");
9314
9354
  return n.bind(e.session);
9315
9355
  }
9316
9356
  setCollisionVisible(e, t) {
@@ -9482,7 +9522,11 @@ class Xo {
9482
9522
  stage: i.stage,
9483
9523
  fatal: i.fatal
9484
9524
  };
9485
- if (this.current(e) && i.fatal && (e.playing = !1, e.resetFrameClock = !1, this.transition(e, { phase: "failed", error: Object.freeze({ code: s.code, message: s.message, stage: s.stage, fatal: !0 }) }), e.ready.reject(n)), this.disposed)
9525
+ if (this.current(e) && i.fatal && (e.playing = !1, e.resetFrameClock = !1, this.transition(e, {
9526
+ phase: "failed",
9527
+ error: Object.freeze({ code: s.code, message: s.message, stage: s.stage, fatal: !0 }),
9528
+ backgroundLoading: null
9529
+ }), e.ready.reject(n)), this.disposed)
9486
9530
  i.stage === "dispose" && this.host.cleanupError ? this.host.cleanupError(s) : console.error("[viewer] asset cleanup failed", s);
9487
9531
  else if (this.current(e) || i.stage === "dispose")
9488
9532
  try {
@@ -9512,7 +9556,7 @@ class Xo {
9512
9556
  }
9513
9557
  }
9514
9558
  }
9515
- function Et() {
9559
+ function kt() {
9516
9560
  let r, e;
9517
9561
  const t = new Promise((i, n) => {
9518
9562
  r = i, e = n;
@@ -9520,13 +9564,13 @@ function Et() {
9520
9564
  return t.catch(() => {
9521
9565
  }), { promise: t, resolve: r, reject: e };
9522
9566
  }
9523
- function X(r, e) {
9567
+ function K(r, e) {
9524
9568
  return Object.assign(new Error(r), { code: e, ...e === "E_ABORTED" || e === "E_SUPERSEDED" ? { name: "AbortError" } : {} });
9525
9569
  }
9526
9570
  function Hi(r) {
9527
9571
  return !!(r && typeof r.then == "function");
9528
9572
  }
9529
- const Ko = {
9573
+ const Jo = {
9530
9574
  id: "nebula-asset-model",
9531
9575
  activate(r) {
9532
9576
  r.contribute({
@@ -9544,13 +9588,13 @@ const Ko = {
9544
9588
  clearColor: Ee.dark
9545
9589
  },
9546
9590
  async createSession(e, t) {
9547
- const { createModelSession: i } = await import("./session-BUarD9PA.js");
9591
+ const { createModelSession: i } = await import("./session-Dn5fAl3z.js");
9548
9592
  return i(e, t);
9549
9593
  }
9550
9594
  });
9551
9595
  }
9552
9596
  };
9553
- function Jo(r, e, t) {
9597
+ function Zo(r, e, t) {
9554
9598
  let i = !1, n = !1;
9555
9599
  const s = {
9556
9600
  ...t.options.cad,
@@ -9579,7 +9623,7 @@ function Jo(r, e, t) {
9579
9623
  }
9580
9624
  };
9581
9625
  }
9582
- function Zo(r) {
9626
+ function Qo(r) {
9583
9627
  return {
9584
9628
  id: "nebula-asset-cad",
9585
9629
  activate(e) {
@@ -9594,24 +9638,24 @@ function Zo(r) {
9594
9638
  uiProfile: "cad",
9595
9639
  fitPolicy: "restore-then-fit"
9596
9640
  },
9597
- createSession: (t, i) => Jo(r, t, i)
9641
+ createSession: (t, i) => Zo(r, t, i)
9598
9642
  });
9599
9643
  }
9600
9644
  };
9601
9645
  }
9602
- function Qo(r) {
9646
+ function el(r) {
9603
9647
  const e = r.replace(/^\uFEFF/, "").replace(/^\s*(?:<\?[\s\S]*?\?>\s*)?/, "").replace(/^(?:<!--[\s\S]*?-->\s*)*/, "");
9604
9648
  return /^<\s*mujoco(?:\s|>)/i.test(e) ? "mjcf" : /^<\s*robot(?:\s|>)/i.test(e) ? "urdf" : null;
9605
9649
  }
9606
- async function el(r) {
9650
+ async function tl(r) {
9607
9651
  const e = r.entryPath ?? r.filename ?? r.url ?? "";
9608
9652
  if (!e.toLowerCase().split(/[?#]/, 1)[0].endsWith(".xml")) return null;
9609
9653
  const t = await r.resolve(e), i = await fetch(t, { signal: r.signal });
9610
9654
  if (!i.ok) return null;
9611
- const n = Qo(await i.text());
9655
+ const n = el(await i.text());
9612
9656
  return n ? { format: n } : null;
9613
9657
  }
9614
- const tl = {
9658
+ const il = {
9615
9659
  id: "nebula-asset-simulation",
9616
9660
  activate(r) {
9617
9661
  r.contribute({
@@ -9619,7 +9663,7 @@ const tl = {
9619
9663
  id: "nebula.simulation-loader",
9620
9664
  assetKind: "simulation",
9621
9665
  formats: ["urdf", "xacro", "mjcf", "usd", "usda", "usdc", "usdz"],
9622
- match: el,
9666
+ match: tl,
9623
9667
  presentation: {
9624
9668
  preferredViewMode: "3d",
9625
9669
  interactionMode: "simulation",
@@ -9628,7 +9672,7 @@ const tl = {
9628
9672
  clearColor: Ee.dark
9629
9673
  },
9630
9674
  async createSession(e, t) {
9631
- const { createSimulationSession: i } = await import("./session-Ciaw522_.js").then((n) => n.a);
9675
+ const { createSimulationSession: i } = await import("./session-CEipzQYJ.js").then((n) => n.a);
9632
9676
  return i(e, t);
9633
9677
  }
9634
9678
  });
@@ -9642,8 +9686,8 @@ const tl = {
9642
9686
  hover: { color: 24524, fillOpacity: 0, edgeOpacity: 0.95 },
9643
9687
  selected: { color: 24524, fillOpacity: 0.2, edgeOpacity: 1 }
9644
9688
  }
9645
- }, il = 6, nl = 12, rl = 160, sl = 160, al = 50, Yi = 592655;
9646
- class ol {
9689
+ }, nl = 6, rl = 12, sl = 160, al = 160, ol = 50, Yi = 592655;
9690
+ class ll {
9647
9691
  constructor(e, t) {
9648
9692
  u(this, "cad");
9649
9693
  u(this, "mountedObjects", /* @__PURE__ */ new Set());
@@ -9660,8 +9704,8 @@ class ol {
9660
9704
  u(this, "cadHoveredInsert", null);
9661
9705
  u(this, "cadPointerPosition", null);
9662
9706
  u(this, "pointerDragTracker", new Ws({
9663
- distancePx: il,
9664
- pathPx: nl
9707
+ distancePx: nl,
9708
+ pathPx: rl
9665
9709
  }));
9666
9710
  u(this, "cadCapability");
9667
9711
  u(this, "cadHost");
@@ -9796,17 +9840,17 @@ class ol {
9796
9840
  u(this, "handlePointerLeave", (e) => {
9797
9841
  this.pointerStart = null, this.cadPointerPosition = null, this.pointerDragTracker.reset(), this.setCadHoveredInsert(null), this.interactionMode !== "disabled" && this.pluginManager.dispatchInteraction("onHover", null), this.scheduleInteractionIdle(), !this.disposed && this.emit("pointer-leave", this.toPointerEvent(e));
9798
9842
  });
9799
- var i, n, s, a, o, l, d, c, p, h, m, f, b, y, v, g, w;
9800
- this.options = e, this.runtime = t, this.cameraStateStore = e.cameraStateStore === !1 ? void 0 : e.cameraStateStore ?? ks(), this.interactionMode = e.cadInteraction ?? "managed", this.defaultEnvironment = (i = e.environmentPresets) != null && i.length ? e.environmentPresets[0] : e.environment ?? "room", this.environmentPresets = (n = e.environmentPresets) != null && n.length ? e.environmentPresets.map((x) => Wi(x)).filter((x) => x !== null) : [Wi(this.defaultEnvironment)].filter((x) => x !== null), this.activePresetIndex = this.environmentPresets.length > 0 ? 0 : null, this.environmentRotation = Gi(e.environmentRotation ?? 0), this.environmentSupported = typeof t.setEnvironment == "function" && typeof t.setEnvironmentBackgroundVisible == "function" && typeof t.getEnvironmentBackgroundVisible == "function", this.environmentRotationSupported = typeof t.setEnvironmentRotation == "function", this.environmentRotationSupported && t.setEnvironmentRotation(this.environmentRotation), e.previewDragPreset && this.runtime.setPreviewDragPreset(e.previewDragPreset), this.uiTheme = ((s = e.ui) == null ? void 0 : s.theme) ?? "dark", this.cadHost = this.createCadHost(), this.cadCapability = new Bs(this.cadHost), this.cad = this.cadCapability, this.cadCapability.open = async (x, C = {}) => {
9843
+ var i, n, s, a, o, l, d, c, p, h, m, f, g, b, x, v, w;
9844
+ this.options = e, this.runtime = t, this.cameraStateStore = e.cameraStateStore === !1 ? void 0 : e.cameraStateStore ?? ks(), this.interactionMode = e.cadInteraction ?? "managed", this.defaultEnvironment = (i = e.environmentPresets) != null && i.length ? e.environmentPresets[0] : e.environment ?? "room", this.environmentPresets = (n = e.environmentPresets) != null && n.length ? e.environmentPresets.map((y) => Wi(y)).filter((y) => y !== null) : [Wi(this.defaultEnvironment)].filter((y) => y !== null), this.activePresetIndex = this.environmentPresets.length > 0 ? 0 : null, this.environmentRotation = Gi(e.environmentRotation ?? 0), this.environmentSupported = typeof t.setEnvironment == "function" && typeof t.setEnvironmentBackgroundVisible == "function" && typeof t.getEnvironmentBackgroundVisible == "function", this.environmentRotationSupported = typeof t.setEnvironmentRotation == "function", this.environmentRotationSupported && t.setEnvironmentRotation(this.environmentRotation), e.previewDragPreset && this.runtime.setPreviewDragPreset(e.previewDragPreset), this.uiTheme = ((s = e.ui) == null ? void 0 : s.theme) ?? "dark", this.cadHost = this.createCadHost(), this.cadCapability = new Bs(this.cadHost), this.cad = this.cadCapability, this.cadCapability.open = async (y, C = {}) => {
9801
9845
  this.assertActive();
9802
9846
  const { filename: k, signal: E, ...P } = C;
9803
- await this.assetController.open(x, { format: "cad", filename: k, signal: E, cad: P }, !0).ready;
9804
- const D = this.cadCapability.document;
9805
- if (!D) throw Object.assign(new Error("CAD open superseded"), { code: "E_SUPERSEDED", name: "AbortError" });
9806
- return D;
9847
+ await this.assetController.open(y, { format: "cad", filename: k, signal: E, cad: P }, !0).ready;
9848
+ const T = this.cadCapability.document;
9849
+ if (!T) throw Object.assign(new Error("CAD open superseded"), { code: "E_SUPERSEDED", name: "AbortError" });
9850
+ return T;
9807
9851
  }, this.cadCapability.close = () => {
9808
9852
  this.assertActive(), this.assetController.closeKind("cad");
9809
- }, this.initialCameraSnapshot = t.captureCameraSnapshot(), this.lastCameraFingerprint = kt(this.initialCameraSnapshot), this.layoutEngine = this.createLayoutEngine(), this.pluginManager = new Fo(
9853
+ }, this.initialCameraSnapshot = t.captureCameraSnapshot(), this.lastCameraFingerprint = St(this.initialCameraSnapshot), this.layoutEngine = this.createLayoutEngine(), this.pluginManager = new Fo(
9810
9854
  () => this.cadCapability.getSnapshot(),
9811
9855
  () => ({
9812
9856
  viewMode: this.runtime.viewMode,
@@ -9816,12 +9860,12 @@ class ol {
9816
9860
  }),
9817
9861
  () => this.assetController.getActiveSnapshot(),
9818
9862
  () => this.assetController.getActiveControlState(),
9819
- (x, C) => this.subscribePluginEvent(x, C),
9863
+ (y, C) => this.subscribePluginEvent(y, C),
9820
9864
  {
9821
- setLayerVisible: (x, C) => this.cad.layers.setVisible(x, C),
9822
- setSelection: (x) => this.cad.select(x),
9865
+ setLayerVisible: (y, C) => this.cad.layers.setVisible(y, C),
9866
+ setSelection: (y) => this.cad.select(y),
9823
9867
  fitDocument: () => this.cad.fitDocument(),
9824
- setViewMode: (x) => this.setViewMode(x),
9868
+ setViewMode: (y) => this.setViewMode(y),
9825
9869
  play: () => this.assetController.tryPlay(),
9826
9870
  pause: () => this.assetController.tryPause(),
9827
9871
  reset: () => this.assetController.tryReset(),
@@ -9832,81 +9876,81 @@ class ol {
9832
9876
  return !1;
9833
9877
  }
9834
9878
  },
9835
- setUpAxis: (x) => this.assetController.trySetUpAxis(x),
9836
- setGroundVisible: (x) => this.assetController.trySetGroundVisible(x),
9837
- setCollisionVisible: (x) => this.assetController.trySetCollisionVisible(x),
9838
- setTheme: (x) => this.applyUiTheme(x)
9879
+ setUpAxis: (y) => this.assetController.trySetUpAxis(y),
9880
+ setGroundVisible: (y) => this.assetController.trySetGroundVisible(y),
9881
+ setCollisionVisible: (y) => this.assetController.trySetCollisionVisible(y),
9882
+ setTheme: (y) => this.applyUiTheme(y)
9839
9883
  },
9840
9884
  e.viewport,
9841
9885
  this.layoutEngine,
9842
9886
  () => this.assetController.getActiveInspection()
9843
- ), this.assetController = new Xo({
9887
+ ), this.assetController = new Ko({
9844
9888
  loaders: () => this.pluginManager.getAssetLoaders(),
9845
9889
  ...this.runtime.getRenderer ? { getRenderer: () => this.runtime.getRenderer() } : {},
9846
- mount: (x) => this.mountAssetObject(x),
9847
- detach: (x) => this.unmountAssetObject(x),
9848
- applyProfile: (x) => this.applyAssetProfile(x),
9849
- fit: (x, C) => this.runtime.fitView(x, C),
9890
+ mount: (y) => this.mountAssetObject(y),
9891
+ detach: (y) => this.unmountAssetObject(y),
9892
+ applyProfile: (y) => this.applyAssetProfile(y),
9893
+ fit: (y, C) => this.runtime.fitView(y, C),
9850
9894
  requestRender: () => this.runtime.requestRender(),
9851
9895
  invalidateTransmissionCaches: () => {
9852
- var x, C;
9853
- return (C = (x = this.runtime).invalidateTransmissionCaches) == null ? void 0 : C.call(x);
9896
+ var y, C;
9897
+ return (C = (y = this.runtime).invalidateTransmissionCaches) == null ? void 0 : C.call(y);
9854
9898
  },
9855
- change: (x) => this.emit("asset-change", x),
9856
- error: (x) => this.emit("asset-error", x),
9857
- controlChange: (x) => this.emit("asset-control-change", x),
9858
- cleanupError: (x) => {
9859
- this.options.onCleanupError ? this.options.onCleanupError(x) : console.error("[viewer] asset cleanup failed", x);
9899
+ change: (y) => this.emit("asset-change", y),
9900
+ error: (y) => this.emit("asset-error", y),
9901
+ controlChange: (y) => this.emit("asset-control-change", y),
9902
+ cleanupError: (y) => {
9903
+ this.options.onCleanupError ? this.options.onCleanupError(y) : console.error("[viewer] asset cleanup failed", y);
9860
9904
  }
9861
- }), this.pluginManager.registerBuiltin(Zo(this.cadCapability)), this.pluginManager.registerBuiltin(Ko), this.pluginManager.registerBuiltin(tl), this.pluginManager.onAssetLoaderRemoved((x) => this.assetController.removeLoader(x)), this.cadInspectorUnsubscribe = this.cad.on("inspector-change", () => {
9905
+ }), this.pluginManager.registerBuiltin(Qo(this.cadCapability)), this.pluginManager.registerBuiltin(Jo), this.pluginManager.registerBuiltin(il), this.pluginManager.onAssetLoaderRemoved((y) => this.assetController.removeLoader(y)), this.cadInspectorUnsubscribe = this.cad.on("inspector-change", () => {
9862
9906
  this.interactionMode === "managed" && (this.syncCadSelectionOverlay(), this.syncCadHoverOverlay()), this.dispatchCadSelectionChange();
9863
9907
  }), this.cadDocumentUnsubscribe = this.cad.on("document-change", () => {
9864
9908
  this.setCadHoveredInsert(null), this.interactionMode === "managed" && this.syncCadSelectionOverlay();
9865
- }), this.assetChangeUnsubscribe = this.on("asset-change", (x) => {
9866
- const C = x.snapshot.phase;
9909
+ }), this.assetChangeUnsubscribe = this.on("asset-change", (y) => {
9910
+ const C = y.snapshot.phase;
9867
9911
  (C === "closing" || C === "failed" || C === "closed") && this.endAssetGrab();
9868
9912
  }), e.ui && e.ui.preset !== "none" && (e.ui.preset !== "cad-readonly" && this.interactionMode === "managed" && this.pluginManager.registerBuiltin(oo(
9869
9913
  {
9870
- mountBuiltin: (x, C) => this.layoutEngine.mountBuiltin(x, C),
9914
+ mountBuiltin: (y, C) => this.layoutEngine.mountBuiltin(y, C),
9871
9915
  shadowRoot: () => this.builtinUiShadow(),
9872
9916
  getVisualDiagnostics: () => this.assetController.getActiveVisualDiagnostics(),
9873
9917
  interactionCanvas: () => this.options.canvas,
9874
9918
  interactionCamera: () => this.runtime.getActiveCamera(),
9875
9919
  requestRender: () => this.runtime.requestRender(),
9876
- setNavigationEnabled: (x) => this.runtime.setNavigationEnabled(x),
9920
+ setNavigationEnabled: (y) => this.runtime.setNavigationEnabled(y),
9877
9921
  environment: this.environment,
9878
9922
  theme: () => this.uiTheme,
9879
- onThemeChange: (x) => (this.uiThemeListeners.add(x), { dispose: () => this.uiThemeListeners.delete(x) })
9923
+ onThemeChange: (y) => (this.uiThemeListeners.add(y), { dispose: () => this.uiThemeListeners.delete(y) })
9880
9924
  },
9881
9925
  {
9882
- label: (x) => x === "simulation" ? "仿真控制" : "模型控制",
9926
+ label: (y) => y === "simulation" ? "仿真控制" : "模型控制",
9883
9927
  scene: e.ui.scene
9884
9928
  }
9885
9929
  )), e.ui.urdf !== !1 && this.interactionMode === "managed" && this.pluginManager.registerBuiltin(Oo({
9886
9930
  interactionCanvas: () => this.options.canvas,
9887
9931
  interactionCamera: () => this.runtime.getActiveCamera(),
9888
9932
  cameraQuaternion: () => this.runtime.getActiveCamera().quaternion.clone(),
9889
- mountBuiltin: (x, C) => this.layoutEngine.mountBuiltin(x, C),
9933
+ mountBuiltin: (y, C) => this.layoutEngine.mountBuiltin(y, C),
9890
9934
  shadowRoot: () => this.builtinUiShadow(),
9891
9935
  theme: () => this.uiTheme,
9892
- onThemeChange: (x) => (this.uiThemeListeners.add(x), { dispose: () => this.uiThemeListeners.delete(x) })
9936
+ onThemeChange: (y) => (this.uiThemeListeners.add(y), { dispose: () => this.uiThemeListeners.delete(y) })
9893
9937
  })), this.interactionMode === "managed" && this.pluginManager.register({
9894
9938
  id: "nebula.ui.cad",
9895
9939
  activate: () => {
9896
9940
  this.ui = new ka(this.createUiHost(), e.ui), this.ui.mount();
9897
9941
  },
9898
9942
  deactivate: () => {
9899
- var x;
9900
- (x = this.ui) == null || x.dispose(), this.ui = null;
9943
+ var y;
9944
+ (y = this.ui) == null || y.dispose(), this.ui = null;
9901
9945
  }
9902
- })), (o = (a = this.options.canvas).addEventListener) == null || o.call(a, "pointerdown", this.handlePointerDown), (d = (l = this.options.canvas).addEventListener) == null || d.call(l, "pointermove", this.handlePointerMove), (p = (c = this.options.canvas).addEventListener) == null || p.call(c, "pointerup", this.handlePointerUp), (m = (h = this.options.canvas).addEventListener) == null || m.call(h, "pointercancel", this.handlePointerCancel), (b = (f = this.options.canvas).addEventListener) == null || b.call(f, "pointerleave", this.handlePointerLeave), (v = (y = this.options.canvas).addEventListener) == null || v.call(y, "lostpointercapture", this.handleLostPointerCapture), (w = (g = this.options.canvas).addEventListener) == null || w.call(g, "wheel", this.handleWheel, { passive: !0 }), typeof globalThis.window < "u" && globalThis.window.addEventListener("blur", this.handleWindowBlur), typeof ResizeObserver == "function" && pl(this.options.viewport) ? (this.viewportResizeObserver = new ResizeObserver(() => this.handleViewportResize()), this.viewportResizeObserver.observe(this.options.viewport)) : (this.viewportResizeObserver = null, typeof globalThis.window < "u" && (this.usingWindowResizeFallback = !0, globalThis.window.addEventListener("resize", this.handleViewportResize))), this.runtime.startAnimation({
9903
- renderExtension: { beforeRender: (x, C, k) => this.assetController.beforeRender(x, C, k) },
9904
- onFrame: (x, C) => {
9946
+ })), (o = (a = this.options.canvas).addEventListener) == null || o.call(a, "pointerdown", this.handlePointerDown), (d = (l = this.options.canvas).addEventListener) == null || d.call(l, "pointermove", this.handlePointerMove), (p = (c = this.options.canvas).addEventListener) == null || p.call(c, "pointerup", this.handlePointerUp), (m = (h = this.options.canvas).addEventListener) == null || m.call(h, "pointercancel", this.handlePointerCancel), (g = (f = this.options.canvas).addEventListener) == null || g.call(f, "pointerleave", this.handlePointerLeave), (x = (b = this.options.canvas).addEventListener) == null || x.call(b, "lostpointercapture", this.handleLostPointerCapture), (w = (v = this.options.canvas).addEventListener) == null || w.call(v, "wheel", this.handleWheel, { passive: !0 }), typeof globalThis.window < "u" && globalThis.window.addEventListener("blur", this.handleWindowBlur), typeof ResizeObserver == "function" && ml(this.options.viewport) ? (this.viewportResizeObserver = new ResizeObserver(() => this.handleViewportResize()), this.viewportResizeObserver.observe(this.options.viewport)) : (this.viewportResizeObserver = null, typeof globalThis.window < "u" && (this.usingWindowResizeFallback = !0, globalThis.window.addEventListener("resize", this.handleViewportResize))), this.runtime.startAnimation({
9947
+ renderExtension: { beforeRender: (y, C, k) => this.assetController.beforeRender(y, C, k) },
9948
+ onFrame: (y, C) => {
9905
9949
  this.assetController.update(C) && this.runtime.requestRender();
9906
9950
  },
9907
- shouldRender: (x) => this.shouldRenderCurrentFrame(x),
9908
- beforeRender: (x) => {
9909
- this.detectCameraChange() || this.cadCapability.onBeforeRender(), this.interaction === "active" && (this.interactionRenderLastTs = x);
9951
+ shouldRender: (y) => this.shouldRenderCurrentFrame(y),
9952
+ beforeRender: (y) => {
9953
+ this.detectCameraChange() || this.cadCapability.onBeforeRender(), this.interaction === "active" && (this.interactionRenderLastTs = y);
9910
9954
  },
9911
9955
  onInfoUpdate: () => {
9912
9956
  this.detectCameraChange() || this.cadCapability.onRuntimeStatsChanged();
@@ -10023,7 +10067,7 @@ class ol {
10023
10067
  async loadEnvironmentFile(e) {
10024
10068
  var o;
10025
10069
  this.assertActive();
10026
- const t = dl(e);
10070
+ const t = cl(e);
10027
10071
  if (!t) return !1;
10028
10072
  const i = URL.createObjectURL(e), n = { type: t, url: i, name: e.name }, s = (o = this.customEnvironment) == null ? void 0 : o.url, a = await this.applyEnvironment(n, "custom", () => {
10029
10073
  this.customEnvironment = n, s && s !== i && URL.revokeObjectURL(s);
@@ -10083,7 +10127,7 @@ class ol {
10083
10127
  this.assertActive(), e !== this.runtime.viewMode && (t ? this.runtime.setViewMode(e, t) : this.runtime.setViewMode(e), this.emit("view-mode-change", { viewMode: e }), this.pendingCameraReason = "view-mode", this.cadCapability.onCameraChanged("view-mode"), this.refreshCadPointerHover());
10084
10128
  }
10085
10129
  fitView(e, t) {
10086
- this.assertActive(), e && !(e instanceof Z) && this.assertMounted(e);
10130
+ this.assertActive(), e && !(e instanceof Q) && this.assertMounted(e);
10087
10131
  const i = e ?? this.assetController.getActiveFitBounds() ?? this.pluginManager.findFitPolicy() ?? this.resolveMixedBounds();
10088
10132
  if (!i) return !1;
10089
10133
  const n = this.runtime.fitView(i, t);
@@ -10144,14 +10188,14 @@ class ol {
10144
10188
  this.assertActive(), this.pluginManager.use(e, t);
10145
10189
  }
10146
10190
  dispose() {
10147
- var e, t, i, n, s, a, o, l, d, c, p, h, m, f, b;
10191
+ var e, t, i, n, s, a, o, l, d, c, p, h, m, f, g;
10148
10192
  if (!this.disposed) {
10149
- this.environmentGeneration += 1, this.customEnvironment && (URL.revokeObjectURL(this.customEnvironment.url), this.customEnvironment = null), this.grabbing && this.endAssetGrab(), this.assetController.dispose(), this.disposed = !0, this.pluginManager.dispose(), this.clearInteractionIdleTimer(), this.pointerDragTracker.reset(), (t = (e = this.options.canvas).removeEventListener) == null || t.call(e, "pointerdown", this.handlePointerDown), (n = (i = this.options.canvas).removeEventListener) == null || n.call(i, "pointermove", this.handlePointerMove), (a = (s = this.options.canvas).removeEventListener) == null || a.call(s, "pointerup", this.handlePointerUp), (l = (o = this.options.canvas).removeEventListener) == null || l.call(o, "pointercancel", this.handlePointerCancel), (c = (d = this.options.canvas).removeEventListener) == null || c.call(d, "pointerleave", this.handlePointerLeave), (h = (p = this.options.canvas).removeEventListener) == null || h.call(p, "lostpointercapture", this.handleLostPointerCapture), (f = (m = this.options.canvas).removeEventListener) == null || f.call(m, "wheel", this.handleWheel), typeof globalThis.window < "u" && (globalThis.window.removeEventListener("blur", this.handleWindowBlur), this.usingWindowResizeFallback && globalThis.window.removeEventListener("resize", this.handleViewportResize)), (b = this.viewportResizeObserver) == null || b.disconnect(), this.pointerStart = null, this.cadPointerPosition = null, this.setCadHoveredInsert(null), this.setCanvasCursor(""), this.highlightedObjectValue && this.runtime.removeOverlay(Je), this.runtime.removeOverlay(xe), this.runtime.removeOverlay(we), this.cadInspectorUnsubscribe(), this.cadDocumentUnsubscribe(), this.assetChangeUnsubscribe(), this.highlightedObjectValue = null, this.selectedObjectValue = null;
10150
- for (const y of this.mountedObjects)
10151
- this.runtime.removeObject(y, { dispose: !1 });
10193
+ this.environmentGeneration += 1, this.customEnvironment && (URL.revokeObjectURL(this.customEnvironment.url), this.customEnvironment = null), this.grabbing && this.endAssetGrab(), this.assetController.dispose(), this.disposed = !0, this.pluginManager.dispose(), this.clearInteractionIdleTimer(), this.pointerDragTracker.reset(), (t = (e = this.options.canvas).removeEventListener) == null || t.call(e, "pointerdown", this.handlePointerDown), (n = (i = this.options.canvas).removeEventListener) == null || n.call(i, "pointermove", this.handlePointerMove), (a = (s = this.options.canvas).removeEventListener) == null || a.call(s, "pointerup", this.handlePointerUp), (l = (o = this.options.canvas).removeEventListener) == null || l.call(o, "pointercancel", this.handlePointerCancel), (c = (d = this.options.canvas).removeEventListener) == null || c.call(d, "pointerleave", this.handlePointerLeave), (h = (p = this.options.canvas).removeEventListener) == null || h.call(p, "lostpointercapture", this.handleLostPointerCapture), (f = (m = this.options.canvas).removeEventListener) == null || f.call(m, "wheel", this.handleWheel), typeof globalThis.window < "u" && (globalThis.window.removeEventListener("blur", this.handleWindowBlur), this.usingWindowResizeFallback && globalThis.window.removeEventListener("resize", this.handleViewportResize)), (g = this.viewportResizeObserver) == null || g.disconnect(), this.pointerStart = null, this.cadPointerPosition = null, this.setCadHoveredInsert(null), this.setCanvasCursor(""), this.highlightedObjectValue && this.runtime.removeOverlay(Je), this.runtime.removeOverlay(xe), this.runtime.removeOverlay(we), this.cadInspectorUnsubscribe(), this.cadDocumentUnsubscribe(), this.assetChangeUnsubscribe(), this.highlightedObjectValue = null, this.selectedObjectValue = null;
10194
+ for (const b of this.mountedObjects)
10195
+ this.runtime.removeObject(b, { dispose: !1 });
10152
10196
  this.mountedObjects.clear();
10153
- for (const y of this.mountedAssetObjects)
10154
- this.runtime.removeObject(y, { dispose: !1 });
10197
+ for (const b of this.mountedAssetObjects)
10198
+ this.runtime.removeObject(b, { dispose: !1 });
10155
10199
  this.mountedAssetObjects.clear(), this.cadCapability.dispose(), this.layoutEngine.dispose(), this.listeners.clear(), this.runtime.dispose();
10156
10200
  }
10157
10201
  }
@@ -10236,7 +10280,7 @@ class ol {
10236
10280
  return e.cadCapability.getVisibilityRevision();
10237
10281
  },
10238
10282
  get viewportDemandCoalesceMs() {
10239
- return e.options.viewportDemandCoalesceMs ?? sl;
10283
+ return e.options.viewportDemandCoalesceMs ?? al;
10240
10284
  },
10241
10285
  mountCadObject(t) {
10242
10286
  e.unmountCadObject(), e.runtime.addObject(t, { owned: !0 }), e.cadRenderRoot = t;
@@ -10251,7 +10295,7 @@ class ol {
10251
10295
  e.emit("content-change", { source: "cad" });
10252
10296
  },
10253
10297
  emitCameraChange(t = e.pendingCameraReason) {
10254
- e.lastCameraFingerprint = kt(e.runtime.captureCameraSnapshot()), e.emit("camera-change", {
10298
+ e.lastCameraFingerprint = St(e.runtime.captureCameraSnapshot()), e.emit("camera-change", {
10255
10299
  viewMode: e.runtime.viewMode,
10256
10300
  reason: t,
10257
10301
  interaction: e.interaction
@@ -10299,12 +10343,12 @@ class ol {
10299
10343
  e.details.bbox.minY,
10300
10344
  e.details.bbox.maxX,
10301
10345
  e.details.bbox.maxY
10302
- ].every(Number.isFinite) ? e.details.bbox : null, i = t ? new Z(
10303
- new M(t.minX, t.minY, -0.01),
10304
- new M(t.maxX, t.maxY, 0.01)
10305
- ) : e.textDetails ? new Z(
10306
- new M(e.textDetails.x, e.textDetails.y, -0.01),
10307
- new M(
10346
+ ].every(Number.isFinite) ? e.details.bbox : null, i = t ? new Q(
10347
+ new R(t.minX, t.minY, -0.01),
10348
+ new R(t.maxX, t.maxY, 0.01)
10349
+ ) : e.textDetails ? new Q(
10350
+ new R(e.textDetails.x, e.textDetails.y, -0.01),
10351
+ new R(
10308
10352
  e.textDetails.x + e.textDetails.content.length * e.textDetails.height * 0.6,
10309
10353
  e.textDetails.y + e.textDetails.height,
10310
10354
  0.01
@@ -10338,11 +10382,11 @@ class ol {
10338
10382
  edgeOpacity: (s == null ? void 0 : s.edgeOpacity) ?? n.edgeOpacity
10339
10383
  }, o = new on();
10340
10384
  o.name = t === "hover" ? "cad-insert-hover" : "cad-insert-selected", o.renderOrder = t === "hover" ? 1300 : 1310;
10341
- const l = e.getSize(new M()), d = e.getCenter(new M()), c = new Gn(Math.max(l.x, 1e-6), Math.max(l.y, 1e-6), Math.max(l.z, 1e-3));
10385
+ const l = e.getSize(new R()), d = e.getCenter(new R()), c = new Gn(Math.max(l.x, 1e-6), Math.max(l.y, 1e-6), Math.max(l.z, 1e-3));
10342
10386
  if (a.fillOpacity > 0) {
10343
10387
  const f = new ae(
10344
10388
  c.clone(),
10345
- new Nt({
10389
+ new Ot({
10346
10390
  color: a.color,
10347
10391
  transparent: !0,
10348
10392
  opacity: a.fillOpacity,
@@ -10366,9 +10410,9 @@ class ol {
10366
10410
  }
10367
10411
  cadInsertDetailsToBox(e) {
10368
10412
  const t = e == null ? void 0 : e.bbox;
10369
- return !t || ![t.minX, t.minY, t.maxX, t.maxY].every(Number.isFinite) ? null : new Z(
10370
- new M(t.minX, t.minY, -0.01),
10371
- new M(t.maxX, t.maxY, 0.01)
10413
+ return !t || ![t.minX, t.minY, t.maxX, t.maxY].every(Number.isFinite) ? null : new Q(
10414
+ new R(t.minX, t.minY, -0.01),
10415
+ new R(t.maxX, t.maxY, 0.01)
10372
10416
  );
10373
10417
  }
10374
10418
  isSameCadInsertSelection(e, t) {
@@ -10458,12 +10502,12 @@ class ol {
10458
10502
  }
10459
10503
  this.runtime.setClearColor(e.clearColor ?? this.options.clearColor ?? Yi), this.runtime.setNavigationPolicy(
10460
10504
  e.interactionMode === "object" || e.interactionMode === "simulation" ? "preview" : "viewer"
10461
- ), e.preferredViewMode && e.preferredViewMode !== this.runtime.viewMode && this.setViewMode(e.preferredViewMode, { preserveOrbit: !0 }), this.interactionMode = e.interactionMode === "cad-managed" ? this.options.cadInteraction ?? "managed" : e.interactionMode === "object" || e.interactionMode === "simulation" ? "disabled" : this.options.cadInteraction ?? "managed", this.layoutEngine.setActiveGroups(cl(e.uiProfile)), (t = this.ui) == null || t.setActive(e.uiProfile === "cad"), this.interactionMode !== "managed" ? (this.setCadHoveredInsert(null), this.runtime.removeOverlay(xe), this.runtime.removeOverlay(we), this.cadCapability.clearSelection()) : this.syncCadSelectionOverlay();
10505
+ ), e.preferredViewMode && e.preferredViewMode !== this.runtime.viewMode && this.setViewMode(e.preferredViewMode, { preserveOrbit: !0 }), this.interactionMode = e.interactionMode === "cad-managed" ? this.options.cadInteraction ?? "managed" : e.interactionMode === "object" || e.interactionMode === "simulation" ? "disabled" : this.options.cadInteraction ?? "managed", this.layoutEngine.setActiveGroups(ul(e.uiProfile)), (t = this.ui) == null || t.setActive(e.uiProfile === "cad"), this.interactionMode !== "managed" ? (this.setCadHoveredInsert(null), this.runtime.removeOverlay(xe), this.runtime.removeOverlay(we), this.cadCapability.clearSelection()) : this.syncCadSelectionOverlay();
10462
10506
  }
10463
10507
  resolveMixedBounds() {
10464
10508
  const e = this.assetController.getActiveFitBounds();
10465
10509
  if (e) return e;
10466
- const t = new Z();
10510
+ const t = new Q();
10467
10511
  let i = !1;
10468
10512
  for (const s of [...this.mountedObjects, ...this.mountedAssetObjects])
10469
10513
  s.visible && (t.expandByObject(s), i = !0);
@@ -10474,12 +10518,12 @@ class ol {
10474
10518
  this.interaction !== e && (this.interaction = e, this.interactionRenderLastTs = null, this.emit("interaction-change", { interaction: e }), this.emitViewportChange(), this.cadCapability.onInteractionChanged(), e === "idle" && (this.pendingCameraReason = "api"), e === "idle" && this.runtime.requestRender());
10475
10519
  }
10476
10520
  applyCameraSnapshot(e, t) {
10477
- if (!$t(e)) return !1;
10521
+ if (!Vt(e)) return !1;
10478
10522
  const i = this.runtime.viewMode;
10479
10523
  return this.runtime.applyCameraSnapshot(e) ? (this.runtime.resize(), this.runtime.viewMode !== i && this.emit("view-mode-change", { viewMode: this.runtime.viewMode }), this.pendingCameraReason = t, this.cadCapability.onCameraChanged(t), this.refreshCadPointerHover(), !0) : !1;
10480
10524
  }
10481
10525
  detectCameraChange(e = !1) {
10482
- const t = kt(this.runtime.captureCameraSnapshot());
10526
+ const t = St(this.runtime.captureCameraSnapshot());
10483
10527
  return !e && t === this.lastCameraFingerprint ? !1 : (this.lastCameraFingerprint = t, this.cadCapability.onCameraChanged(this.pendingCameraReason), !0);
10484
10528
  }
10485
10529
  emitViewportChange() {
@@ -10496,7 +10540,7 @@ class ol {
10496
10540
  shouldRenderCurrentFrame(e) {
10497
10541
  if (this.assetController.isActivePreview || this.assetController.isActiveDynamicPlaying || this.interaction !== "active" || this.interactionRenderLastTs === null) return !0;
10498
10542
  const t = e - this.interactionRenderLastTs;
10499
- return t < 0 || t >= al;
10543
+ return t < 0 || t >= ol;
10500
10544
  }
10501
10545
  markInteractionActive() {
10502
10546
  this.clearInteractionIdleTimer(), this.setInteraction("active");
@@ -10504,7 +10548,7 @@ class ol {
10504
10548
  scheduleInteractionIdle() {
10505
10549
  this.clearInteractionIdleTimer(), this.interactionIdleTimer = globalThis.setTimeout(() => {
10506
10550
  this.interactionIdleTimer = null, this.setInteraction("idle"), this.refreshCadPointerHover();
10507
- }, rl);
10551
+ }, sl);
10508
10552
  }
10509
10553
  clearInteractionIdleTimer() {
10510
10554
  this.interactionIdleTimer !== null && (globalThis.clearTimeout(this.interactionIdleTimer), this.interactionIdleTimer = null);
@@ -10579,7 +10623,7 @@ class ol {
10579
10623
  for (const i of this.listeners.get(e) ?? []) i(t);
10580
10624
  }
10581
10625
  }
10582
- function ed(r) {
10626
+ function td(r) {
10583
10627
  var i;
10584
10628
  const e = (i = r.environmentPresets) != null && i.length ? r.environmentPresets[0] : r.environment ?? "room", t = new bs({
10585
10629
  canvasArea: r.viewport,
@@ -10596,10 +10640,10 @@ function ed(r) {
10596
10640
  transmissionMode: r.transmissionMode,
10597
10641
  navigationPolicy: "viewer"
10598
10642
  });
10599
- return ll(r, t);
10643
+ return dl(r, t);
10600
10644
  }
10601
- function ll(r, e) {
10602
- return e.initialize(), new ol(r, e);
10645
+ function dl(r, e) {
10646
+ return e.initialize(), new ll(r, e);
10603
10647
  }
10604
10648
  function Wi(r) {
10605
10649
  if (r === "room") return null;
@@ -10610,7 +10654,7 @@ function Wi(r) {
10610
10654
  }
10611
10655
  return { type: r.type, url: r.url, name: t };
10612
10656
  }
10613
- function dl(r) {
10657
+ function cl(r) {
10614
10658
  const e = r.name.trim().toLowerCase().split(".").pop();
10615
10659
  return e === "hdr" ? "hdr" : ["jpg", "jpeg", "png", "webp", "avif"].includes(e ?? "") ? "image" : null;
10616
10660
  }
@@ -10619,17 +10663,17 @@ function Gi(r) {
10619
10663
  const e = r % 360;
10620
10664
  return e < 0 ? e + 360 : e;
10621
10665
  }
10622
- function cl(r) {
10623
- return r === "cad" ? ul : r === "model" ? Xi : r === "simulation" ? /* @__PURE__ */ new Set([...Xi, "urdf"]) : hl;
10666
+ function ul(r) {
10667
+ return r === "cad" ? hl : r === "model" ? Xi : r === "simulation" ? /* @__PURE__ */ new Set([...Xi, "urdf"]) : pl;
10624
10668
  }
10625
- const ul = /* @__PURE__ */ new Set(["cad"]), Xi = /* @__PURE__ */ new Set(["scene"]), hl = /* @__PURE__ */ new Set();
10626
- function kt(r) {
10669
+ const hl = /* @__PURE__ */ new Set(["cad"]), Xi = /* @__PURE__ */ new Set(["scene"]), pl = /* @__PURE__ */ new Set();
10670
+ function St(r) {
10627
10671
  return r ? JSON.stringify(r) : null;
10628
10672
  }
10629
- function pl(r) {
10673
+ function ml(r) {
10630
10674
  return !!(r && typeof r == "object" && r.nodeType === 1);
10631
10675
  }
10632
- function ml(r, e) {
10676
+ function fl(r, e) {
10633
10677
  const t = async (s, a) => {
10634
10678
  var l;
10635
10679
  const o = r.GetPrimAtPath(s);
@@ -10644,10 +10688,10 @@ function ml(r, e) {
10644
10688
  if (!o) return [];
10645
10689
  try {
10646
10690
  return ((d = o.IsValid) == null ? void 0 : d.call(o)) !== !0 ? [] : (((c = o.GetConnections) == null ? void 0 : c.call(o)) ?? []).map((h) => {
10647
- var f, b;
10691
+ var f, g;
10648
10692
  if (typeof h == "string") return h;
10649
10693
  const m = String(((f = h.GetString) == null ? void 0 : f.call(h)) ?? h.path ?? "");
10650
- return (b = h.delete) == null || b.call(h), m;
10694
+ return (g = h.delete) == null || g.call(h), m;
10651
10695
  }).filter(Boolean);
10652
10696
  } finally {
10653
10697
  (p = o.delete) == null || p.call(o);
@@ -10762,11 +10806,11 @@ function ml(r, e) {
10762
10806
  const c = (p = l == null ? void 0 : l.GetAttribute) == null ? void 0 : p.call(l, d);
10763
10807
  if (!c) return [d, { valid: !1, authored: !1, value: null }];
10764
10808
  try {
10765
- const b = ((h = c.IsValid) == null ? void 0 : h.call(c)) === !0;
10809
+ const g = ((h = c.IsValid) == null ? void 0 : h.call(c)) === !0;
10766
10810
  return [d, {
10767
- valid: b,
10768
- authored: b && ((m = c.HasAuthoredValue) == null ? void 0 : m.call(c)) === !0,
10769
- value: b ? c.Get() : null
10811
+ valid: g,
10812
+ authored: g && ((m = c.HasAuthoredValue) == null ? void 0 : m.call(c)) === !0,
10813
+ value: g ? c.Get() : null
10770
10814
  }];
10771
10815
  } finally {
10772
10816
  (f = c.delete) == null || f.call(c);
@@ -10801,26 +10845,26 @@ function ml(r, e) {
10801
10845
  }
10802
10846
  };
10803
10847
  }
10804
- function td(r) {
10848
+ function id(r) {
10805
10849
  const e = r;
10806
- return e.usdQuery ? e.usdQuery : !r.stage || !r.pxr ? null : e.usdQuery = ml(r.stage, r.pxr);
10850
+ return e.usdQuery ? e.usdQuery : !r.stage || !r.pxr ? null : e.usdQuery = fl(r.stage, r.pxr);
10807
10851
  }
10808
- const fl = 1, vl = 3, gl = "6ad6617c3ba6d2037c62", bl = {
10852
+ const vl = 1, gl = 5, bl = "6f5df5c5901df72d6c87", yl = {
10809
10853
  file: "openusd_probe.js",
10810
- sha256: "83a14d264f2348a0899de8f1bc0c021fdcd8cae554ef545fb9e5b88da6f30b4e",
10811
- bytes: 95918
10812
- }, yl = {
10813
- file: "openusd_probe.wasm",
10814
- sha256: "a68fdbc8902ccb59e5cc84d24ad79572860806c01eaec5ad130218d0bbc835a9",
10815
- bytes: 10672319
10854
+ sha256: "f89019f6a03661e6aa6403e8b6b694fa00c92ba1c0c7e09620e25ea8efbe6bc2",
10855
+ bytes: 97833
10816
10856
  }, xl = {
10817
- schemaVersion: fl,
10818
- apiVersion: vl,
10819
- runtimeId: gl,
10820
- js: bl,
10821
- wasm: yl
10822
- }, Ne = wl(xl);
10823
- function wl(r) {
10857
+ file: "openusd_probe.wasm",
10858
+ sha256: "1170d1ae548f51e5e9d65931df001d8fcd627e8b69b85d9447494c24402893f7",
10859
+ bytes: 10744656
10860
+ }, wl = {
10861
+ schemaVersion: vl,
10862
+ apiVersion: gl,
10863
+ runtimeId: bl,
10864
+ js: yl,
10865
+ wasm: xl
10866
+ }, Ne = Cl(wl);
10867
+ function Cl(r) {
10824
10868
  if (!r || typeof r != "object") throw new Error("OpenUSD runtime manifest is missing.");
10825
10869
  const e = r;
10826
10870
  if (e.schemaVersion !== 1 || !Number.isInteger(e.apiVersion) || Number(e.apiVersion) < 1 || typeof e.runtimeId != "string" || !/^[0-9a-f]{20}$/.test(e.runtimeId))
@@ -10853,8 +10897,8 @@ function An(r, e = Ne.runtimeId) {
10853
10897
  throw new Error(`Invalid OpenUSD runtime id: ${e}`);
10854
10898
  if (!r)
10855
10899
  return {
10856
- moduleUrl: Ji(Yt.openUsdModuleUrl, e),
10857
- wasmUrl: Ji(Yt.openUsdWasmUrl, e),
10900
+ moduleUrl: Ji(Wt.openUsdModuleUrl, e),
10901
+ wasmUrl: Ji(Wt.openUsdWasmUrl, e),
10858
10902
  runtimeId: e,
10859
10903
  apiVersion: Ne.apiVersion
10860
10904
  };
@@ -10877,7 +10921,7 @@ async function In(r, e) {
10877
10921
  });
10878
10922
  return WebAssembly.compile(await t.arrayBuffer());
10879
10923
  }
10880
- function id(r, e, t) {
10924
+ function nd(r, e, t) {
10881
10925
  return WebAssembly.instantiate(r, e).then(
10882
10926
  (i) => t(i, r),
10883
10927
  (i) => {
@@ -10887,25 +10931,25 @@ function id(r, e, t) {
10887
10931
  }
10888
10932
  ), {};
10889
10933
  }
10890
- function nd(r = {}) {
10934
+ function rd(r = {}) {
10891
10935
  const e = An(
10892
10936
  r.openUsdBaseUrl,
10893
10937
  r.openUsdRuntimeId
10894
10938
  );
10895
10939
  return In(e.wasmUrl, r.signal);
10896
10940
  }
10897
- function Cl(r) {
10941
+ function El(r) {
10898
10942
  return r ? new URL("mujoco.wasm", r).href : sr;
10899
10943
  }
10900
- function rd(r = {}) {
10901
- return In(Cl(r.mujocoBaseUrl), r.signal);
10944
+ function sd(r = {}) {
10945
+ return In(El(r.mujocoBaseUrl), r.signal);
10902
10946
  }
10903
10947
  let Zi = null;
10904
- function sd() {
10905
- return Zi ?? (Zi = import("./usd-session-DSFtJk4b.js").then(() => {
10948
+ function ad() {
10949
+ return Zi ?? (Zi = import("./usd-session-CNYn-3LD.js").then(() => {
10906
10950
  })), Zi;
10907
10951
  }
10908
- function El(r) {
10952
+ function kl(r) {
10909
10953
  return r instanceof Error ? {
10910
10954
  name: r.name,
10911
10955
  message: r.message,
@@ -10920,7 +10964,7 @@ function Oe(r) {
10920
10964
  });
10921
10965
  return r.stack && (e.stack = r.stack), e;
10922
10966
  }
10923
- const kl = [
10967
+ const Sl = [
10924
10968
  1,
10925
10969
  0,
10926
10970
  0,
@@ -10938,7 +10982,7 @@ const kl = [
10938
10982
  0,
10939
10983
  1
10940
10984
  ];
10941
- function Sl(r) {
10985
+ function Pl(r) {
10942
10986
  const e = new Map(r.map((s) => [s.path, s])), t = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Set(), n = (s) => {
10943
10987
  const a = t.get(s.path);
10944
10988
  if (a) return a;
@@ -10951,7 +10995,7 @@ function Sl(r) {
10951
10995
  if (!s.resetsXformStack || !s.parentPath) return s;
10952
10996
  const a = e.get(s.parentPath);
10953
10997
  if (!a) return s;
10954
- const o = n(a), l = Ml(o);
10998
+ const o = n(a), l = Rl(o);
10955
10999
  return l ? {
10956
11000
  ...s,
10957
11001
  localMatrix: en(n(s), l)
@@ -10959,9 +11003,9 @@ function Sl(r) {
10959
11003
  });
10960
11004
  }
10961
11005
  function Qi(r) {
10962
- return Pl(r) ? r : kl;
11006
+ return Ml(r) ? r : Sl;
10963
11007
  }
10964
- function Pl(r) {
11008
+ function Ml(r) {
10965
11009
  return (r == null ? void 0 : r.length) === 16 && r.every(Number.isFinite);
10966
11010
  }
10967
11011
  function en(r, e) {
@@ -10975,7 +11019,7 @@ function en(r, e) {
10975
11019
  }
10976
11020
  return t;
10977
11021
  }
10978
- function Ml(r) {
11022
+ function Rl(r) {
10979
11023
  const [
10980
11024
  e,
10981
11025
  t,
@@ -10992,7 +11036,7 @@ function Ml(r) {
10992
11036
  c,
10993
11037
  p,
10994
11038
  h
10995
- ] = r, m = s * d - a * l, f = i * l - t * d, b = t * a - i * s, y = e * m + n * f + o * b, v = Math.max(
11039
+ ] = r, m = s * d - a * l, f = i * l - t * d, g = t * a - i * s, b = e * m + n * f + o * g, x = Math.max(
10996
11040
  Math.abs(e * s * d),
10997
11041
  Math.abs(e * a * l),
10998
11042
  Math.abs(t * n * d),
@@ -11001,39 +11045,39 @@ function Ml(r) {
11001
11045
  Math.abs(i * s * o),
11002
11046
  1
11003
11047
  );
11004
- if (!Number.isFinite(y) || Math.abs(y) <= Number.EPSILON * v * 16)
11048
+ if (!Number.isFinite(b) || Math.abs(b) <= Number.EPSILON * x * 16)
11005
11049
  return null;
11006
- const g = 1 / y, w = m * g, x = f * g, C = b * g, k = (a * o - n * d) * g, E = (e * d - i * o) * g, P = (i * n - e * a) * g, I = (n * l - s * o) * g, D = (t * o - e * l) * g, S = (e * s - t * n) * g;
11050
+ const v = 1 / b, w = m * v, y = f * v, C = g * v, k = (a * o - n * d) * v, E = (e * d - i * o) * v, P = (i * n - e * a) * v, D = (n * l - s * o) * v, T = (t * o - e * l) * v, M = (e * s - t * n) * v;
11007
11051
  return [
11008
11052
  w,
11009
- x,
11053
+ y,
11010
11054
  C,
11011
11055
  0,
11012
11056
  k,
11013
11057
  E,
11014
11058
  P,
11015
11059
  0,
11016
- I,
11017
11060
  D,
11018
- S,
11061
+ T,
11062
+ M,
11019
11063
  0,
11020
- -(c * w + p * k + h * I),
11021
- -(c * x + p * E + h * D),
11022
- -(c * C + p * P + h * S),
11064
+ -(c * w + p * k + h * D),
11065
+ -(c * y + p * E + h * T),
11066
+ -(c * C + p * P + h * M),
11023
11067
  1
11024
11068
  ];
11025
11069
  }
11026
- function ad(r, e = []) {
11070
+ function od(r, e = []) {
11027
11071
  return {
11028
11072
  stage: r.stage,
11029
11073
  view: {
11030
11074
  ...r.view,
11031
- prims: Sl(r.view.prims)
11075
+ prims: Pl(r.view.prims)
11032
11076
  },
11033
11077
  elements: r.elements,
11034
11078
  materials: r.materials,
11035
11079
  materialAliases: r.materialAliases,
11036
- physics: Al(),
11080
+ physics: Il(),
11037
11081
  joints: [],
11038
11082
  cameras: [],
11039
11083
  lights: [],
@@ -11042,10 +11086,10 @@ function ad(r, e = []) {
11042
11086
  variants: e
11043
11087
  };
11044
11088
  }
11045
- function Rl(r, e) {
11089
+ function Al(r, e) {
11046
11090
  r.physics = e.physics, r.joints = e.joints;
11047
11091
  }
11048
- function od(r) {
11092
+ function ld(r) {
11049
11093
  const e = r.materialSubsets;
11050
11094
  if (!Array.isArray(e))
11051
11095
  throw new Error(`USD probe omitted material subset hints for ${r.path}.`);
@@ -11056,7 +11100,7 @@ function od(r) {
11056
11100
  }
11057
11101
  return e;
11058
11102
  }
11059
- function ld(r) {
11103
+ function dd(r) {
11060
11104
  const e = r;
11061
11105
  if (!Object.hasOwn(e, "surface"))
11062
11106
  throw new Error(`USD probe omitted surface metadata for ${r.path}.`);
@@ -11065,7 +11109,7 @@ function ld(r) {
11065
11109
  throw new Error(`USD probe returned invalid surface metadata for ${r.path}.`);
11066
11110
  return e.surface;
11067
11111
  }
11068
- function dd(r) {
11112
+ function cd(r) {
11069
11113
  const e = r;
11070
11114
  if (!Object.hasOwn(e, "surfaceTerminals")) return null;
11071
11115
  if (!Array.isArray(e.surfaceTerminals))
@@ -11086,13 +11130,13 @@ function dd(r) {
11086
11130
  }
11087
11131
  return Object.freeze(t);
11088
11132
  }
11089
- function cd(r) {
11133
+ function ud(r) {
11090
11134
  const e = r;
11091
11135
  if (typeof e.doubleSidedAuthored != "boolean")
11092
11136
  throw new Error(`USD probe omitted authored double-sided metadata for ${r.path}.`);
11093
11137
  return e.doubleSidedAuthored;
11094
11138
  }
11095
- function ud(r) {
11139
+ function hd(r) {
11096
11140
  const e = r;
11097
11141
  if (e.uvTopology === null) return null;
11098
11142
  if (!e.uvTopology || typeof e.uvTopology != "object")
@@ -11106,13 +11150,13 @@ function ud(r) {
11106
11150
  indexed: t.indexed
11107
11151
  };
11108
11152
  }
11109
- function hd(r) {
11153
+ function pd(r) {
11110
11154
  const e = r;
11111
11155
  if (typeof e.purpose != "string" || !e.purpose)
11112
11156
  throw new Error(`USD probe omitted visual purpose metadata for ${e.path}.`);
11113
11157
  return e.purpose;
11114
11158
  }
11115
- function Al() {
11159
+ function Il() {
11116
11160
  return {
11117
11161
  scenes: [],
11118
11162
  rigidBodies: [],
@@ -11128,7 +11172,7 @@ function Ln(r, e) {
11128
11172
  function Dn() {
11129
11173
  return new Worker(new URL(
11130
11174
  /* @vite-ignore */
11131
- "" + new URL("assets/usd-worker-CPCXyXkl.js", import.meta.url).href,
11175
+ "" + new URL("assets/usd-worker-drur-7bI.js", import.meta.url).href,
11132
11176
  import.meta.url
11133
11177
  ), {
11134
11178
  type: "module",
@@ -11148,7 +11192,7 @@ function Tn(r, e, t) {
11148
11192
  }, r.postMessage({ type: "prepare", runtime: e, warmup: t });
11149
11193
  });
11150
11194
  }
11151
- async function Il(r, e) {
11195
+ async function Ll(r, e) {
11152
11196
  if (typeof Worker > "u") return;
11153
11197
  const t = An(r, e);
11154
11198
  if (te && Ln(te.runtime, t)) {
@@ -11161,152 +11205,152 @@ async function Il(r, e) {
11161
11205
  te === s && (te = null);
11162
11206
  }), await n;
11163
11207
  }
11164
- function Ll(r) {
11208
+ function Dl(r) {
11165
11209
  const e = te;
11166
11210
  return e ? (te = null, Ln(e.runtime, r) ? e : (e.worker.terminate(), null)) : null;
11167
11211
  }
11168
- async function pd(r, e, t) {
11169
- var L, V, j, Q, O;
11212
+ async function md(r, e, t) {
11213
+ var _, H, O, G, S;
11170
11214
  if (typeof Worker > "u") throw new Error("Web Worker is unavailable");
11171
- const i = Ll(r), n = (i == null ? void 0 : i.worker) ?? Dn(), s = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set(), l = [];
11172
- let d = 0, c = 1, p = !1, h = !1, m = !1, f = !1, b = null, y = /* @__PURE__ */ new Map(), v = () => {
11215
+ const i = Dl(r), n = (i == null ? void 0 : i.worker) ?? Dn(), s = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set(), l = [];
11216
+ let d = 0, c = 1, p = !1, h = !1, m = !1, f = !1, g = null, b = /* @__PURE__ */ new Map(), x = () => {
11173
11217
  };
11174
- const g = (i == null ? void 0 : i.ready) ?? Tn(n, r, !1), w = new Promise((T, B) => {
11175
- v = B, g.then(T, B);
11218
+ const v = (i == null ? void 0 : i.ready) ?? Tn(n, r, !1), w = new Promise((A, j) => {
11219
+ x = j, v.then(A, j);
11176
11220
  });
11177
11221
  w.catch(() => {
11178
11222
  });
11179
- let x = () => {
11223
+ let y = () => {
11180
11224
  }, C = () => {
11181
11225
  };
11182
- const k = new Promise((T, B) => {
11183
- x = T, C = B;
11226
+ const k = new Promise((A, j) => {
11227
+ y = A, C = j;
11184
11228
  });
11185
11229
  k.catch(() => {
11186
11230
  });
11187
- const E = (T, B = []) => {
11188
- n.postMessage(T, B);
11189
- }, P = (T, B) => {
11231
+ const E = (A, j = []) => {
11232
+ n.postMessage(A, j);
11233
+ }, P = (A, j) => {
11190
11234
  if (p) return Promise.reject(new Error("USD worker disposed"));
11191
11235
  const de = c++;
11192
11236
  return new Promise((fe, ce) => {
11193
11237
  s.set(de, {
11194
11238
  resolve: (oe) => fe(oe),
11195
11239
  reject: ce
11196
- }), E({ type: "decode-texture", id: de, url: T, maxDimension: B });
11240
+ }), E({ type: "decode-texture", id: de, url: A, maxDimension: j });
11197
11241
  });
11198
- }, I = () => {
11242
+ }, D = () => {
11199
11243
  for (; !p && d < 4 && l.length > 0; ) {
11200
- const T = l.shift();
11201
- d += 1, P(T.url, T.maxDimension).then(T.resolve, T.reject).finally(() => {
11202
- d -= 1, I();
11244
+ const A = l.shift();
11245
+ d += 1, P(A.url, A.maxDimension).then(A.resolve, A.reject).finally(() => {
11246
+ d -= 1, D();
11203
11247
  });
11204
11248
  }
11205
- }, D = () => {
11249
+ }, T = () => {
11206
11250
  if (!p) {
11207
11251
  p = !0;
11208
- for (const T of l.splice(0))
11209
- T.reject(new Error("USD worker disposed"));
11210
- for (const T of o) T.close();
11252
+ for (const A of l.splice(0))
11253
+ A.reject(new Error("USD worker disposed"));
11254
+ for (const A of o) A.close();
11211
11255
  o.clear(), a.clear();
11212
- for (const T of s.values()) T.reject(new Error("USD worker disposed"));
11213
- s.clear(), v(new Error("USD worker disposed")), m || (m = !0, C(new Error("USD worker disposed"))), n.terminate();
11256
+ for (const A of s.values()) A.reject(new Error("USD worker disposed"));
11257
+ s.clear(), x(new Error("USD worker disposed")), m || (m = !0, C(new Error("USD worker disposed"))), n.terminate();
11214
11258
  }
11215
- }, S = () => {
11216
- D(), U(Ze());
11259
+ }, M = () => {
11260
+ T(), V(Ze());
11217
11261
  };
11218
- let U = () => {
11262
+ let V = () => {
11219
11263
  };
11220
- if ((L = t.signal) != null && L.aborted)
11221
- throw D(), Ze();
11222
- (V = t.signal) == null || V.addEventListener("abort", S, { once: !0 });
11264
+ if ((_ = t.signal) != null && _.aborted)
11265
+ throw T(), Ze();
11266
+ (H = t.signal) == null || H.addEventListener("abort", M, { once: !0 });
11223
11267
  try {
11224
11268
  const {
11225
- signal: T,
11226
- resolveBytes: B,
11269
+ signal: A,
11270
+ resolveBytes: j,
11227
11271
  onReferenceSkipped: de,
11228
11272
  onResourceFailed: fe,
11229
11273
  ...ce
11230
11274
  } = t, oe = await e;
11231
11275
  if (await w, p) throw new Error("USD worker disposed");
11232
- if ((j = t.signal) != null && j.aborted) throw Ze();
11276
+ if ((O = t.signal) != null && O.aborted) throw Ze();
11233
11277
  const ve = new Promise((N, z) => {
11234
- U = z, n.onerror = (ee) => {
11235
- const R = new Error(ee.message || "USD worker failed");
11236
- z(R);
11237
- for (const G of s.values()) G.reject(R);
11238
- s.clear(), D();
11278
+ V = z, n.onerror = (ee) => {
11279
+ const I = new Error(ee.message || "USD worker failed");
11280
+ z(I);
11281
+ for (const X of s.values()) X.reject(I);
11282
+ s.clear(), T();
11239
11283
  }, n.onmessage = async (ee) => {
11240
- var G, ue;
11241
- const R = ee.data;
11242
- switch (R.type) {
11284
+ var X, ue;
11285
+ const I = ee.data;
11286
+ switch (I.type) {
11243
11287
  case "visual-ready":
11244
11288
  if (h) return;
11245
- h = !0, b = R.data, y = new Map(R.textureURLs ?? []), N(b);
11289
+ h = !0, g = I.data, b = new Map(I.textureURLs ?? []), N(g);
11246
11290
  return;
11247
11291
  case "physics-ready": {
11248
- if (!b || m) return;
11249
- m = !0, Rl(b, R.phase), x(R.phase);
11292
+ if (!g || m) return;
11293
+ m = !0, Al(g, I.phase), y(I.phase);
11250
11294
  return;
11251
11295
  }
11252
11296
  case "physics-failed":
11253
11297
  if (m) return;
11254
- m = !0, C(Oe(R.error));
11298
+ m = !0, C(Oe(I.error));
11255
11299
  return;
11256
11300
  case "resource-request": {
11257
11301
  try {
11258
- const F = await t.resolveBytes(new URL(R.url), R.identifier), he = { type: "resource-result", id: R.id, bytes: F };
11302
+ const F = await t.resolveBytes(new URL(I.url), I.identifier), he = { type: "resource-result", id: I.id, bytes: F };
11259
11303
  n.postMessage(he, [F.buffer]);
11260
11304
  } catch (F) {
11261
11305
  const he = {
11262
11306
  type: "resource-result",
11263
- id: R.id,
11264
- error: El(F)
11307
+ id: I.id,
11308
+ error: kl(F)
11265
11309
  };
11266
11310
  n.postMessage(he);
11267
11311
  }
11268
11312
  return;
11269
11313
  }
11270
11314
  case "event":
11271
- R.event === "reference-skipped" ? (G = t.onReferenceSkipped) == null || G.call(t, R.identifier) : (ue = t.onResourceFailed) == null || ue.call(t, R.identifier, Oe(R.error));
11315
+ I.event === "reference-skipped" ? (X = t.onReferenceSkipped) == null || X.call(t, I.identifier) : (ue = t.onResourceFailed) == null || ue.call(t, I.identifier, Oe(I.error));
11272
11316
  return;
11273
11317
  case "query-result": {
11274
- const F = s.get(R.id);
11275
- s.delete(R.id), F == null || F.resolve(R.value);
11318
+ const F = s.get(I.id);
11319
+ s.delete(I.id), F == null || F.resolve(I.value);
11276
11320
  return;
11277
11321
  }
11278
11322
  case "texture-decoded": {
11279
- const F = s.get(R.id);
11280
- s.delete(R.id), F == null || F.resolve(R.bitmap);
11323
+ const F = s.get(I.id);
11324
+ s.delete(I.id), F == null || F.resolve(I.bitmap);
11281
11325
  return;
11282
11326
  }
11283
11327
  case "error":
11284
- if (R.id !== void 0) {
11285
- const F = s.get(R.id);
11286
- s.delete(R.id), F == null || F.reject(Oe(R.error));
11328
+ if (I.id !== void 0) {
11329
+ const F = s.get(I.id);
11330
+ s.delete(I.id), F == null || F.reject(Oe(I.error));
11287
11331
  } else {
11288
- const F = Oe(R.error);
11289
- z(F), D();
11332
+ const F = Oe(I.error);
11333
+ z(F), T();
11290
11334
  }
11291
11335
  }
11292
11336
  };
11293
11337
  });
11294
11338
  E({ type: "load", input: oe, options: ce }, [oe.buffer]);
11295
11339
  const Ue = await ve;
11296
- if ((Q = t.signal) != null && Q.aborted) throw Ze();
11297
- const K = async (N, z) => {
11340
+ if ((G = t.signal) != null && G.aborted) throw Ze();
11341
+ const J = async (N, z) => {
11298
11342
  if (p) return Promise.reject(new Error("USD worker disposed"));
11299
11343
  const ee = c++;
11300
11344
  try {
11301
- return await new Promise((R, G) => {
11302
- s.set(ee, { resolve: (ue) => R(ue), reject: G }), E({ type: "query", id: ee, method: N, args: z });
11345
+ return await new Promise((I, X) => {
11346
+ s.set(ee, { resolve: (ue) => I(ue), reject: X }), E({ type: "query", id: ee, method: N, args: z });
11303
11347
  });
11304
- } catch (R) {
11305
- const G = R instanceof Error ? R.message : String(R);
11348
+ } catch (I) {
11349
+ const X = I instanceof Error ? I.message : String(I);
11306
11350
  throw Object.assign(
11307
- new Error(`USD stage query ${N}(${z.map(String).join(", ")}) failed: ${G}`),
11351
+ new Error(`USD stage query ${N}(${z.map(String).join(", ")}) failed: ${X}`),
11308
11352
  {
11309
- code: R && typeof R == "object" && "code" in R ? String(R.code) : "E_USD_QUERY"
11353
+ code: I && typeof I == "object" && "code" in I ? String(I.code) : "E_USD_QUERY"
11310
11354
  }
11311
11355
  );
11312
11356
  }
@@ -11314,45 +11358,45 @@ async function pd(r, e, t) {
11314
11358
  return {
11315
11359
  data: Ue,
11316
11360
  query: {
11317
- stageMetadata: (N) => K("stageMetadata", [N]),
11318
- primInfo: (N) => K("primInfo", [N]),
11319
- primChildren: (N) => K("primChildren", [N]),
11320
- primDescendants: (N, z) => K("primDescendants", [N, z ?? ""]),
11321
- primAttributes: (N) => K("primAttributes", [N]),
11322
- primMetadata: (N, z) => K("primMetadata", [N, z]),
11323
- relationshipTargets: (N, z) => K("relationshipTargets", [N, z]),
11324
- attributeValue: (N, z) => K("attributeValue", [N, z]),
11325
- attributeValues: (N) => K("attributeValues", [N]),
11326
- attributeMetadata: (N, z, ee) => K("attributeMetadata", [N, z, ee]),
11327
- attributeConnections: (N, z) => K("attributeConnections", [N, z]),
11328
- boundMaterial: (N) => K("boundMaterial", [N])
11361
+ stageMetadata: (N) => J("stageMetadata", [N]),
11362
+ primInfo: (N) => J("primInfo", [N]),
11363
+ primChildren: (N) => J("primChildren", [N]),
11364
+ primDescendants: (N, z) => J("primDescendants", [N, z ?? ""]),
11365
+ primAttributes: (N) => J("primAttributes", [N]),
11366
+ primMetadata: (N, z) => J("primMetadata", [N, z]),
11367
+ relationshipTargets: (N, z) => J("relationshipTargets", [N, z]),
11368
+ attributeValue: (N, z) => J("attributeValue", [N, z]),
11369
+ attributeValues: (N) => J("attributeValues", [N]),
11370
+ attributeMetadata: (N, z, ee) => J("attributeMetadata", [N, z, ee]),
11371
+ attributeConnections: (N, z) => J("attributeConnections", [N, z]),
11372
+ boundMaterial: (N) => J("boundMaterial", [N])
11329
11373
  },
11330
- textureURLs: y,
11374
+ textureURLs: b,
11331
11375
  decodeTexture(N, z, ee) {
11332
11376
  if (p) return Promise.reject(new Error("USD worker disposed"));
11333
- const R = ee ? Dl(ee) : N, G = `${z}:${R}`, ue = a.get(G);
11377
+ const I = ee ? Tl(ee) : N, X = `${z}:${I}`, ue = a.get(X);
11334
11378
  if (ue) return ue;
11335
11379
  const F = new Promise((he, On) => {
11336
- l.push({ url: N, maxDimension: z, resolve: he, reject: On }), I();
11380
+ l.push({ url: N, maxDimension: z, resolve: he, reject: On }), D();
11337
11381
  });
11338
- return a.set(G, F), F.then((he) => {
11382
+ return a.set(X, F), F.then((he) => {
11339
11383
  o.add(he);
11340
11384
  }, () => {
11341
- a.get(G) === F && a.delete(G);
11385
+ a.get(X) === F && a.delete(X);
11342
11386
  }), F;
11343
11387
  },
11344
11388
  startPhysics() {
11345
11389
  return f || (f = !0, p ? (m = !0, C(new Error("USD worker disposed"))) : E({ type: "extract-physics" })), k;
11346
11390
  },
11347
- dispose: D
11391
+ dispose: T
11348
11392
  };
11349
- } catch (T) {
11350
- throw D(), T;
11393
+ } catch (A) {
11394
+ throw T(), A;
11351
11395
  } finally {
11352
- (O = t.signal) == null || O.removeEventListener("abort", S);
11396
+ (S = t.signal) == null || S.removeEventListener("abort", M);
11353
11397
  }
11354
11398
  }
11355
- function Dl(r) {
11399
+ function Tl(r) {
11356
11400
  if (/^https?:/i.test(r)) return r;
11357
11401
  const e = [];
11358
11402
  for (const t of r.replaceAll("\\", "/").split("/"))
@@ -11362,10 +11406,10 @@ function Dl(r) {
11362
11406
  function Ze() {
11363
11407
  return Object.assign(new Error("USD load aborted."), { name: "AbortError", code: "E_ABORTED" });
11364
11408
  }
11365
- function md(r, e) {
11366
- return Il(r, e);
11409
+ function fd(r, e) {
11410
+ return Ll(r, e);
11367
11411
  }
11368
- const Tl = "E_ASSET_RESOURCE_NOT_FOUND", Nl = "E_ASSET_RESOURCE_INVALID", Ol = "E_ASSET_FETCH", jl = "E_ASSET_EXTERNAL_DENIED", Fl = "E_ASSET_AUTH", zl = /* @__PURE__ */ new Set([
11412
+ const Nl = "E_ASSET_RESOURCE_NOT_FOUND", Ol = "E_ASSET_RESOURCE_INVALID", jl = "E_ASSET_FETCH", Fl = "E_ASSET_EXTERNAL_DENIED", zl = "E_ASSET_AUTH", $l = /* @__PURE__ */ new Set([
11369
11413
  "png",
11370
11414
  "jpg",
11371
11415
  "jpeg",
@@ -11378,78 +11422,78 @@ const Tl = "E_ASSET_RESOURCE_NOT_FOUND", Nl = "E_ASSET_RESOURCE_INVALID", Ol = "
11378
11422
  "hdr",
11379
11423
  "exr",
11380
11424
  "ktx2"
11381
- ]), $l = /* @__PURE__ */ new Set(["usd", "usda", "usdc", "usdz"]);
11382
- function Vl(r) {
11425
+ ]), Vl = /* @__PURE__ */ new Set(["usd", "usda", "usdc", "usdz"]);
11426
+ function Bl(r) {
11383
11427
  var t;
11384
11428
  return ((t = (r.split(/[?#]/, 1)[0] ?? r).split(".").pop()) == null ? void 0 : t.toLowerCase()) ?? "";
11385
11429
  }
11386
- function fd(r) {
11387
- const e = Vl(r);
11388
- return zl.has(e) && !$l.has(e);
11430
+ function vd(r) {
11431
+ const e = Bl(r);
11432
+ return $l.has(e) && !Vl.has(e);
11389
11433
  }
11390
- function vd(r, e) {
11434
+ function gd(r, e) {
11391
11435
  return Object.assign(new Error(r), { code: e });
11392
11436
  }
11393
- function Bl(r) {
11437
+ function Ul(r) {
11394
11438
  var i;
11395
11439
  if (r instanceof Error && r.name === "AbortError") return "aborted";
11396
11440
  const e = r == null ? void 0 : r.code;
11397
- if (e === Tl) return "missing";
11398
- if (e === Nl) return "invalid";
11399
- if (e === Ol) return "unavailable";
11400
- if (e === Fl || e === jl) return "denied";
11441
+ if (e === Nl) return "missing";
11442
+ if (e === Ol) return "invalid";
11443
+ if (e === jl) return "unavailable";
11444
+ if (e === zl || e === Fl) return "denied";
11401
11445
  const t = (i = /\((\d{3})\)/.exec(r instanceof Error ? r.message : "")) == null ? void 0 : i[1];
11402
11446
  return t === "404" || t === "410" ? "missing" : t === "401" || t === "403" ? "denied" : t != null && t.startsWith("5") ? "unavailable" : "unknown";
11403
11447
  }
11404
- function gd(r) {
11405
- const e = Bl(r);
11448
+ function bd(r) {
11449
+ const e = Ul(r);
11406
11450
  return e === "missing" || e === "invalid" || e === "unavailable";
11407
11451
  }
11408
11452
  function Nn(r, e) {
11409
11453
  return r && /\bhtml\b/i.test(r) ? `返回 HTML 页面(${r})` : r && !/^text\//i.test(r) ? null : /^\uFEFF?\s*(?:<!doctype\s+html|<html|<\?xml[^>]*\bhtml)/i.test(e) ? "返回 HTML 兜底页" : null;
11410
11454
  }
11411
- function bd(r, e) {
11455
+ function yd(r, e) {
11412
11456
  return e.byteLength ? Nn(r, new TextDecoder().decode(e.subarray(0, 512))) : "响应内容为空";
11413
11457
  }
11414
- async function yd(r) {
11458
+ async function xd(r) {
11415
11459
  return r.size ? Nn(r.type, await r.slice(0, 512).text()) : "响应内容为空";
11416
11460
  }
11417
11461
  export {
11418
- jl as A,
11419
- rd as B,
11420
- nd as C,
11462
+ Fl as A,
11463
+ sd as B,
11464
+ rd as C,
11421
11465
  je as D,
11422
- ed as E,
11466
+ td as E,
11423
11467
  Ba as F,
11424
- sd as G,
11425
- md as H,
11468
+ ad as G,
11469
+ fd as H,
11426
11470
  ar as I,
11427
- Nl as U,
11471
+ Ol as U,
11428
11472
  Ee as V,
11429
- Rl as a,
11430
- id as b,
11431
- vd as c,
11432
- ad as d,
11433
- ml as e,
11434
- fd as f,
11435
- gd as g,
11436
- cd as h,
11437
- bd as i,
11438
- dd as j,
11439
- td as k,
11440
- od as l,
11441
- ud as m,
11442
- ld as n,
11473
+ Al as a,
11474
+ nd as b,
11475
+ gd as c,
11476
+ od as d,
11477
+ fl as e,
11478
+ vd as f,
11479
+ bd as g,
11480
+ ud as h,
11481
+ yd as i,
11482
+ cd as j,
11483
+ id as k,
11484
+ ld as l,
11485
+ hd as m,
11486
+ dd as n,
11443
11487
  Ne as o,
11444
- Bl as p,
11488
+ Ul as p,
11445
11489
  An as q,
11446
- hd as r,
11447
- pd as s,
11448
- Bi as t,
11449
- Tl as u,
11450
- Fl as v,
11451
- Ol as w,
11452
- yd as x,
11453
- Ql as y,
11454
- Cl as z
11490
+ pd as r,
11491
+ md as s,
11492
+ Ui as t,
11493
+ Nl as u,
11494
+ zl as v,
11495
+ jl as w,
11496
+ xd as x,
11497
+ ed as y,
11498
+ El as z
11455
11499
  };