@nebula-spatial/viewer 0.4.6 → 0.5.1

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,14 +1,25 @@
1
- var Ft = Object.defineProperty;
2
- var $t = (s, e, t) => e in s ? Ft(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
- var u = (s, e, t) => $t(s, typeof e != "symbol" ? e + "" : e, t);
4
- import { Texture as Bt, Vector3 as S, MathUtils as D, MOUSE as z, Object3D as yt, Scene as we, Group as xt, Raycaster as wt, Vector2 as oe, WebGLRenderer as _t, Color as Ut, Euler as jt, OrthographicCamera as De, PerspectiveCamera as Ht, TOUCH as Oe, Vector4 as qt, Plane as Ct, WebGLRenderTarget as Yt, Box3 as N, PMREMGenerator as Xt, EquirectangularReflectionMapping as Wt, Quaternion as Gt, BoxHelper as Kt, Box3Helper as Zt, BoxGeometry as Jt, Mesh as Qt, MeshBasicMaterial as ei, LineSegments as ti, EdgesGeometry as ii, LineBasicMaterial as ri } from "three";
5
- import { RoomEnvironment as si } from "three/addons/environments/RoomEnvironment.js";
6
- import { MapControls as ni } from "three/addons/controls/MapControls.js";
7
- import { OrbitControls as ai } from "three/addons/controls/OrbitControls.js";
8
- import { HDRLoader as oi } from "three/addons/loaders/HDRLoader.js";
9
- import { createCadDocumentSession as li, getCadDocumentRenderResource as di, formatCadInsertId as ze } from "@nebula-spatial/cad-loader";
10
- import { CSS2DObject as ci, CSS2DRenderer as ui } from "three/addons/renderers/CSS2DRenderer.js";
11
- const hi = [
1
+ var Bt = Object.defineProperty;
2
+ var _t = (s, e, t) => e in s ? Bt(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
+ var u = (s, e, t) => _t(s, typeof e != "symbol" ? e + "" : e, t);
4
+ import { Texture as Ut, Vector3 as E, MathUtils as O, MOUSE as N, Object3D as Ct, Scene as we, Group as St, Raycaster as Et, Vector2 as oe, WebGLRenderer as jt, Color as Ht, Euler as qt, OrthographicCamera as Oe, PerspectiveCamera as Yt, TOUCH as ze, Vector4 as Xt, Plane as kt, WebGLRenderTarget as Wt, Box3 as F, PMREMGenerator as Gt, EquirectangularReflectionMapping as Kt, Quaternion as Zt, BoxHelper as Jt, Box3Helper as Qt, BoxGeometry as ei, Mesh as ti, MeshBasicMaterial as ii, LineSegments as ri, EdgesGeometry as si, LineBasicMaterial as ni } from "three";
5
+ import { RoomEnvironment as ai } from "three/addons/environments/RoomEnvironment.js";
6
+ import { MapControls as oi } from "three/addons/controls/MapControls.js";
7
+ import { OrbitControls as li } from "three/addons/controls/OrbitControls.js";
8
+ import { HDRLoader as di } from "three/addons/loaders/HDRLoader.js";
9
+ import { createCadDocumentSession as ci, getCadDocumentRenderResource as ui, formatCadInsertId as Ne } from "@nebula-spatial/cad-loader";
10
+ import { CSS2DObject as hi, CSS2DRenderer as pi } from "three/addons/renderers/CSS2DRenderer.js";
11
+ const fi = "0.5.1", mi = "@nebula-spatial/viewer", Fe = "__NEBULA_SPATIAL_VIEWER_BANNER_PRINTED__";
12
+ function Ve() {
13
+ const s = `%c ${mi} %c v${fi} `;
14
+ console.log(s, "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;");
15
+ }
16
+ try {
17
+ const s = globalThis;
18
+ s[Fe] || (s[Fe] = !0, Ve());
19
+ } catch {
20
+ Ve();
21
+ }
22
+ const vi = [
12
23
  "alphaMap",
13
24
  "aoMap",
14
25
  "bumpMap",
@@ -37,28 +48,28 @@ const hi = [
37
48
  function de(s, e) {
38
49
  e.has(s) || (e.add(s), s.dispose());
39
50
  }
40
- function pi(s, e, t) {
51
+ function gi(s, e, t) {
41
52
  if (e) {
42
53
  const i = s;
43
- for (const r of hi) {
54
+ for (const r of vi) {
44
55
  const n = i[r];
45
- n instanceof Bt && de(n, t);
56
+ n instanceof Ut && de(n, t);
46
57
  }
47
58
  }
48
59
  de(s, t);
49
60
  }
50
- function Ne(s, e = {}) {
61
+ function $e(s, e = {}) {
51
62
  const t = e.disposedResources ?? /* @__PURE__ */ new WeakSet(), i = e.disposeTextures !== !1;
52
63
  s.traverse((r) => {
53
64
  const n = r;
54
65
  n.geometry && de(n.geometry, t);
55
66
  const a = Array.isArray(n.material) ? n.material : [n.material];
56
67
  for (const o of a)
57
- o && pi(o, i, t);
68
+ o && gi(o, i, t);
58
69
  n.renderTarget && de(n.renderTarget, t);
59
70
  });
60
71
  }
61
- function fi(s) {
72
+ function bi(s) {
62
73
  const {
63
74
  dxPx: e,
64
75
  dyPx: t,
@@ -72,31 +83,31 @@ function fi(s) {
72
83
  } = s;
73
84
  if (!Number.isFinite(e) || !Number.isFinite(t) || !Number.isFinite(i) || !Number.isFinite(r) || !Number.isFinite(n) || !Number.isFinite(a) || !Number.isFinite(o) || !Number.isFinite(l) || !Number.isFinite(d) || i <= 0 || r <= 0 || n <= 0 || a <= 0 || a >= 180 || o <= 0)
74
85
  return { x: 0, y: 0, z: 0 };
75
- const c = 2 * n * Math.tan(a * Math.PI / 360), p = c / r, f = c * o / i, m = Math.sin(l), v = Math.cos(l), b = -m, y = v, g = -v, x = -m, w = -e * f * d, k = t * p * d;
86
+ const c = 2 * n * Math.tan(a * Math.PI / 360), p = c / r, f = c * o / i, v = Math.sin(l), y = Math.cos(l), m = -v, b = y, g = -y, x = -v, w = -e * f * d, C = t * p * d;
76
87
  return {
77
- x: b * w + g * k,
78
- y: y * w + x * k,
88
+ x: m * w + g * C,
89
+ y: b * w + x * C,
79
90
  z: 0
80
91
  };
81
92
  }
82
- function mi(s, e) {
93
+ function yi(s, e) {
83
94
  return !Number.isFinite(s.x) || !Number.isFinite(s.y) || !Number.isFinite(s.z) || !Number.isFinite(e.x) || !Number.isFinite(e.y) || !Number.isFinite(e.z) ? { x: 0, y: 0, z: 0 } : {
84
95
  x: s.x - e.x,
85
96
  y: s.y - e.y,
86
97
  z: 0
87
98
  };
88
99
  }
89
- function vi(s, e, t) {
100
+ function xi(s, e, t) {
90
101
  if (!Number.isFinite(s.x) || !Number.isFinite(s.y) || !Number.isFinite(s.z))
91
102
  return { x: 0, y: 0, z: 0 };
92
- const i = mi(e, t);
103
+ const i = yi(e, t);
93
104
  return {
94
105
  x: s.x + i.x,
95
106
  y: s.y + i.y,
96
107
  z: s.z
97
108
  };
98
109
  }
99
- const gi = 0.35, Y = 1, bi = 1, yi = 170;
110
+ const wi = 0.35, Y = 1, Ci = 1, Si = 170;
100
111
  function Q(s, e, t) {
101
112
  return Math.max(e, Math.min(t, s));
102
113
  }
@@ -104,20 +115,20 @@ function $(s, e, t, i) {
104
115
  const r = Number.isFinite(s) ? s : e;
105
116
  return Q(r, t, i);
106
117
  }
107
- function St(s) {
108
- return Number.isFinite(s) ? Q(s, 0.1, 0.95) : gi;
118
+ function Pt(s) {
119
+ return Number.isFinite(s) ? Q(s, 0.1, 0.95) : wi;
109
120
  }
110
- function xi(s, e) {
121
+ function Ei(s, e) {
111
122
  return !Number.isFinite(s) || !Number.isFinite(e) || s <= 0 || e <= 0 ? 1 : s / e;
112
123
  }
113
- function Et(s) {
114
- const e = $(s, 50, bi, yi), t = Math.tan(e * Math.PI / 360);
124
+ function At(s) {
125
+ const e = $(s, 50, Ci, Si), t = Math.tan(e * Math.PI / 360);
115
126
  return Math.max(t, 1e-4);
116
127
  }
117
- function wi(s) {
128
+ function ki(s) {
118
129
  return Number.isFinite(s) ? Math.max(0.2, Math.abs(Math.sin(s))) : 0.2;
119
130
  }
120
- function Ci(s) {
131
+ function Pi(s) {
121
132
  return Number.isFinite(s) ? {
122
133
  sinAbs: Math.max(1e-4, Math.abs(Math.sin(s))),
123
134
  cosAbs: Math.abs(Math.cos(s))
@@ -126,15 +137,15 @@ function Ci(s) {
126
137
  cosAbs: Math.sqrt(1 - 0.2 * 0.2)
127
138
  };
128
139
  }
129
- function kt(s, e, t) {
130
- const i = Math.max(1e-4, 2 * s * e / wi(t)), { sinAbs: r, cosAbs: n } = Ci(t), a = s * e, o = r * r - a * a * n * n;
140
+ function Mt(s, e, t) {
141
+ const i = Math.max(1e-4, 2 * s * e / ki(t)), { sinAbs: r, cosAbs: n } = Pi(t), a = s * e, o = r * r - a * a * n * n;
131
142
  if (!Number.isFinite(o) || o <= 1e-4)
132
143
  return i;
133
144
  const l = 2 * a * r / o;
134
145
  return !Number.isFinite(l) || l <= 1e-4 ? i : l;
135
146
  }
136
- function Si(s) {
137
- const e = St(s.ndcBand), t = s.useFixedOrientation ? s.fixedOrbitYaw : s.orbitYaw, i = s.useFixedOrientation ? s.fixedOrbitPitch : s.orbitPitch, r = Math.max($(s.orthoFrustumSize, Y, Y, Number.MAX_VALUE), Y), n = Et(s.perspectiveFovDeg), a = kt(e, n, i), o = $(s.orbitDistanceMin, 500, 1, Number.MAX_VALUE), l = Math.max(o, $(s.orbitDistanceMax, 2e5, o, Number.MAX_VALUE)), d = Q(r / a, o, l);
147
+ function Ai(s) {
148
+ const e = Pt(s.ndcBand), t = s.useFixedOrientation ? s.fixedOrbitYaw : s.orbitYaw, i = s.useFixedOrientation ? s.fixedOrbitPitch : s.orbitPitch, r = Math.max($(s.orthoFrustumSize, Y, Y, Number.MAX_VALUE), Y), n = At(s.perspectiveFovDeg), a = Mt(e, n, i), o = $(s.orbitDistanceMin, 500, 1, Number.MAX_VALUE), l = Math.max(o, $(s.orbitDistanceMax, 2e5, o, Number.MAX_VALUE)), d = Q(r / a, o, l);
138
149
  return {
139
150
  orbitTarget: { x: s.orthoCenterX, y: s.orthoCenterY, z: 0 },
140
151
  orbitDistance: d,
@@ -142,25 +153,25 @@ function Si(s) {
142
153
  orbitPitch: i
143
154
  };
144
155
  }
145
- function Ei(s) {
146
- const e = xi(s.viewportWidthPx, s.viewportHeightPx), t = St(s.ndcBand), i = Et(s.perspectiveFovDeg), r = kt(t, i, s.orbitPitch), n = $(s.orthoFrustumMin, 1e3, Y, Number.MAX_VALUE), a = Math.max(n, $(s.orthoFrustumMax, 1e5, n, Number.MAX_VALUE)), o = Math.max($(s.orbitDistance, n, n, Number.MAX_VALUE), Y), l = o * r, d = Number.isFinite(l) && l >= Y ? l : Q(o / Math.max(0.5, Math.min(2, e)), n, a);
156
+ function Mi(s) {
157
+ const e = Ei(s.viewportWidthPx, s.viewportHeightPx), t = Pt(s.ndcBand), i = At(s.perspectiveFovDeg), r = Mt(t, i, s.orbitPitch), n = $(s.orthoFrustumMin, 1e3, Y, Number.MAX_VALUE), a = Math.max(n, $(s.orthoFrustumMax, 1e5, n, Number.MAX_VALUE)), o = Math.max($(s.orbitDistance, n, n, Number.MAX_VALUE), Y), l = o * r, d = Number.isFinite(l) && l >= Y ? l : Q(o / Math.max(0.5, Math.min(2, e)), n, a);
147
158
  return {
148
159
  orthoCenterX: s.orbitTarget.x,
149
160
  orthoCenterY: s.orbitTarget.y,
150
161
  orthoFrustumSize: Q(d, n, a)
151
162
  };
152
163
  }
153
- function ki(s) {
164
+ function Ii(s) {
154
165
  const e = Math.max(s.xmax - s.xmin, s.ymax - s.ymin, 1), t = Math.max(1e-4, Math.tan(s.fovDeg * Math.PI / 360)), i = Math.max(1e-4, Math.abs(Math.sin(s.orbitPitchRad))), r = Math.abs(Math.cos(s.orbitPitchRad)), n = s.ndcBand * t, a = i * i - n * n * r * r, o = Math.max(
155
166
  1e-4,
156
167
  2 * s.ndcBand * t / Math.max(0.2, i)
157
168
  ), l = Number.isFinite(a) && a > 1e-4 ? Math.max(1e-4, 2 * n * i / a) : o;
158
169
  return e / l;
159
170
  }
160
- function Pi(s, e, t, i = 40) {
171
+ function Ri(s, e, t, i = 40) {
161
172
  return e === 1 ? s * i : e === 2 ? s * t : s;
162
173
  }
163
- function Ai(s) {
174
+ function Li(s) {
164
175
  const { valuePx: e, ctrlKey: t, eventTimeMs: i, state: r, resetMs: n } = s, a = Math.abs(e), o = r.lastEventTimeMs === 0 ? 0 : i - r.lastEventTimeMs;
165
176
  let l = r.type;
166
177
  if (t)
@@ -179,7 +190,7 @@ function Ai(s) {
179
190
  type: l
180
191
  };
181
192
  }
182
- function Ii(s, e, t) {
193
+ function Ti(s, e, t) {
183
194
  if (!Number.isFinite(s) || s === 0) return 1;
184
195
  const i = e === "wheel" ? t.wheelZoomRate : t.trackpadZoomRate;
185
196
  if (e === "wheel") {
@@ -191,19 +202,19 @@ function Ii(s, e, t) {
191
202
  const n = 1 / t.maxScalePerFrame;
192
203
  return Math.max(n, Math.min(t.maxScalePerFrame, r));
193
204
  }
194
- const he = 500, Ve = 2e5, pe = 0.95, Fe = -Math.PI / 2, $e = D.degToRad(55), Mi = 1e3, Ri = 2e6;
205
+ const he = 500, Be = 2e5, pe = 0.95, _e = -Math.PI / 2, Ue = O.degToRad(55), Di = 1e3, Oi = 2e6;
195
206
  function B(s, e, t = 1e-4) {
196
207
  return Math.abs(s - e) <= t;
197
208
  }
198
- class Li {
209
+ class zi {
199
210
  constructor() {
200
- u(this, "orbitTarget", new S(0, 0, 0));
211
+ u(this, "orbitTarget", new E(0, 0, 0));
201
212
  u(this, "orbitDistance", 14e3);
202
- u(this, "orbitYaw", Fe);
203
- u(this, "orbitPitch", $e);
213
+ u(this, "orbitYaw", _e);
214
+ u(this, "orbitPitch", Ue);
204
215
  u(this, "enabled", !0);
205
216
  u(this, "orbitDistanceMin", he);
206
- u(this, "orbitDistanceMax", Ve);
217
+ u(this, "orbitDistanceMax", Be);
207
218
  u(this, "viewportSnapshotBefore3D", null);
208
219
  u(this, "orbitSnapshotOn3DEntry", null);
209
220
  u(this, "dragMode", null);
@@ -244,9 +255,9 @@ class Li {
244
255
  fit3D(e, t) {
245
256
  const i = this.runtime;
246
257
  if (!i) return;
247
- const r = Math.max(1, (t == null ? void 0 : t.padding) ?? 1.15), n = e.getSize(new S()), a = e.getCenter(new S());
258
+ const r = Math.max(1, (t == null ? void 0 : t.padding) ?? 1.15), n = e.getSize(new E()), a = e.getCenter(new E());
248
259
  this.orbitTarget.set(a.x, a.y, a.z);
249
- const o = ki({
260
+ const o = Ii({
250
261
  xmin: e.min.x,
251
262
  ymin: e.min.y,
252
263
  xmax: e.max.x,
@@ -255,7 +266,7 @@ class Li {
255
266
  orbitPitchRad: this.orbitPitch,
256
267
  ndcBand: pe
257
268
  }), 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(n.length() / 2, 1e-6) / Math.sin(c) * r, h = Math.max(o, p);
258
- this.orbitDistanceMin = h < he ? Math.max(h * 0.02, 1e-6) : he, this.orbitDistanceMax = Math.max(Ve, h * 20), this.orbitDistance = this.clampDistance(h), this.syncPerspectiveCamera();
269
+ this.orbitDistanceMin = h < he ? Math.max(h * 0.02, 1e-6) : he, this.orbitDistanceMax = Math.max(Be, h * 20), this.orbitDistance = this.clampDistance(h), this.syncPerspectiveCamera();
259
270
  }
260
271
  getVisibleDocumentRect() {
261
272
  const e = this.runtime;
@@ -282,7 +293,7 @@ class Li {
282
293
  };
283
294
  }
284
295
  applyOrbitSnapshot(e) {
285
- this.runtime && (this.orbitTarget.set(e.targetX, e.targetY, e.targetZ), this.orbitDistance = this.clampDistance(e.distance), this.orbitYaw = e.yaw, this.orbitPitch = D.clamp(e.pitch, D.degToRad(5), D.degToRad(85)), this.syncPerspectiveCamera({ sync2D: !1 }));
296
+ this.runtime && (this.orbitTarget.set(e.targetX, e.targetY, e.targetZ), this.orbitDistance = this.clampDistance(e.distance), this.orbitYaw = e.yaw, this.orbitPitch = O.clamp(e.pitch, O.degToRad(5), O.degToRad(85)), this.syncPerspectiveCamera({ sync2D: !1 }));
286
297
  }
287
298
  bindInput(e) {
288
299
  const t = e.renderer.domElement;
@@ -325,7 +336,7 @@ class Li {
325
336
  if (this.dragMode === "pan") {
326
337
  const i = this.screenToGround(e.clientX, e.clientY);
327
338
  if (this.groundPanAnchor && i) {
328
- const r = vi(this.orbitTarget, this.groundPanAnchor, i);
339
+ const r = xi(this.orbitTarget, this.groundPanAnchor, i);
329
340
  this.translateOrbit(r.x - this.orbitTarget.x, r.y - this.orbitTarget.y);
330
341
  } else
331
342
  this.panByScreenDelta(
@@ -345,15 +356,15 @@ class Li {
345
356
  const t = this.runtime;
346
357
  if (!t || t.viewMode !== "3d") return;
347
358
  (d = e.preventDefault) == null || d.call(e);
348
- const i = Math.max(1, t.canvasArea.clientHeight), r = Pi(e.deltaY, e.deltaMode, i);
349
- this.wheelClassifier = Ai({
359
+ const i = Math.max(1, t.canvasArea.clientHeight), r = Ri(e.deltaY, e.deltaMode, i);
360
+ this.wheelClassifier = Li({
350
361
  valuePx: r,
351
362
  ctrlKey: e.ctrlKey,
352
363
  eventTimeMs: typeof performance > "u" ? Date.now() : performance.now(),
353
364
  state: this.wheelClassifier,
354
365
  resetMs: 400
355
366
  });
356
- const n = this.wheelClassifier.type ?? "trackpad", a = n === "wheel" ? Math.sign(r) * 100 : r, o = Ii(-a, n, {
367
+ const n = this.wheelClassifier.type ?? "trackpad", a = n === "wheel" ? Math.sign(r) * 100 : r, o = Ti(-a, n, {
357
368
  trackpadZoomRate: 1 / 700,
358
369
  wheelZoomRate: 1 / 3200,
359
370
  maxScalePerFrame: 2
@@ -365,7 +376,7 @@ class Li {
365
376
  panByScreenDelta(e, t) {
366
377
  const i = this.runtime;
367
378
  if (!i) return;
368
- const r = fi({
379
+ const r = bi({
369
380
  dxPx: e,
370
381
  dyPx: t,
371
382
  viewportWidthPx: Math.max(1, i.canvasArea.clientWidth),
@@ -379,10 +390,10 @@ class Li {
379
390
  this.translateOrbit(r.x, r.y);
380
391
  }
381
392
  rotateByScreenDelta(e, t) {
382
- const i = this.orbitYaw - e * 5e-3, r = D.clamp(
393
+ const i = this.orbitYaw - e * 5e-3, r = O.clamp(
383
394
  this.orbitPitch + t * 5e-3,
384
- D.degToRad(5),
385
- D.degToRad(85)
395
+ O.degToRad(5),
396
+ O.degToRad(85)
386
397
  );
387
398
  i === this.orbitYaw && r === this.orbitPitch || (this.orbitYaw = i, this.orbitPitch = r, this.syncPerspectiveCamera());
388
399
  }
@@ -397,7 +408,7 @@ class Li {
397
408
  var o, l;
398
409
  const t = this.runtime;
399
410
  if (!t) return;
400
- const i = t.camera2d, r = i.zoom > 0 ? i.zoom : 1, n = Math.max((i.top - i.bottom) / r, 1), a = Si({
411
+ const i = t.camera2d, r = i.zoom > 0 ? i.zoom : 1, n = Math.max((i.top - i.bottom) / r, 1), a = Ai({
401
412
  orthoCenterX: ((o = t.controls2d.target) == null ? void 0 : o.x) ?? i.position.x,
402
413
  orthoCenterY: ((l = t.controls2d.target) == null ? void 0 : l.y) ?? i.position.y,
403
414
  orthoFrustumSize: n,
@@ -409,8 +420,8 @@ class Li {
409
420
  orbitDistanceMin: this.orbitDistanceMin,
410
421
  orbitDistanceMax: this.orbitDistanceMax,
411
422
  useFixedOrientation: e,
412
- fixedOrbitYaw: Fe,
413
- fixedOrbitPitch: $e,
423
+ fixedOrbitYaw: _e,
424
+ fixedOrbitPitch: Ue,
414
425
  ndcBand: pe
415
426
  });
416
427
  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;
@@ -418,7 +429,7 @@ class Li {
418
429
  sync2DFromOrbit() {
419
430
  const e = this.runtime;
420
431
  if (!e) return;
421
- const t = e.camera2d, i = Math.max(1, e.canvasArea.clientWidth), r = Math.max(1, e.canvasArea.clientHeight), n = i / r, a = t.top - t.bottom, o = a > 0 ? a : 2, l = e.controls2d.minZoom > 0 ? e.controls2d.minZoom : 2e-3, d = Math.max(l, e.controls2d.maxZoom > 0 ? e.controls2d.maxZoom : 5e4), c = Math.max(1, o / d), p = Math.max(c, o / l), h = Ei({
432
+ const t = e.camera2d, i = Math.max(1, e.canvasArea.clientWidth), r = Math.max(1, e.canvasArea.clientHeight), n = i / r, a = t.top - t.bottom, o = a > 0 ? a : 2, l = e.controls2d.minZoom > 0 ? e.controls2d.minZoom : 2e-3, d = Math.max(l, e.controls2d.maxZoom > 0 ? e.controls2d.maxZoom : 5e4), c = Math.max(1, o / d), p = Math.max(c, o / l), h = Mi({
422
433
  orbitTarget: { x: this.orbitTarget.x, y: this.orbitTarget.y, z: this.orbitTarget.z },
423
434
  orbitDistance: this.orbitDistance,
424
435
  orbitYaw: this.orbitYaw,
@@ -429,13 +440,13 @@ class Li {
429
440
  orthoFrustumMin: c,
430
441
  orthoFrustumMax: p,
431
442
  ndcBand: pe
432
- }), f = h.orthoFrustumSize > 0 ? h.orthoFrustumSize : o, m = o / 2;
443
+ }), f = h.orthoFrustumSize > 0 ? h.orthoFrustumSize : o, v = o / 2;
433
444
  e.setOrthographicViewport({
434
- left: -m * n,
435
- right: m * n,
436
- top: m,
437
- bottom: -m,
438
- zoom: D.clamp(o / f, l, d),
445
+ left: -v * n,
446
+ right: v * n,
447
+ top: v,
448
+ bottom: -v,
449
+ zoom: O.clamp(o / f, l, d),
439
450
  positionX: h.orthoCenterX,
440
451
  positionY: h.orthoCenterY,
441
452
  targetX: h.orthoCenterX,
@@ -445,12 +456,12 @@ class Li {
445
456
  syncPerspectiveCamera(e = {}) {
446
457
  const t = this.runtime;
447
458
  if (!t) return;
448
- const i = Math.cos(this.orbitPitch), r = new S(
459
+ const i = Math.cos(this.orbitPitch), r = new E(
449
460
  this.orbitTarget.x + this.orbitDistance * Math.cos(this.orbitYaw) * i,
450
461
  this.orbitTarget.y + this.orbitDistance * Math.sin(this.orbitYaw) * i,
451
462
  this.orbitTarget.z + this.orbitDistance * Math.sin(this.orbitPitch)
452
463
  );
453
- t.camera3d.near = Math.min(Mi, Math.max(this.orbitDistance / 100, 1e-6)), t.camera3d.far = Math.max(Ri, this.orbitDistance * 20), t.setPerspectivePose(r, this.orbitTarget), e.sync2D !== !1 && this.sync2DFromOrbit();
464
+ t.camera3d.near = Math.min(Di, Math.max(this.orbitDistance / 100, 1e-6)), t.camera3d.far = Math.max(Oi, this.orbitDistance * 20), t.setPerspectivePose(r, this.orbitTarget), e.sync2D !== !1 && this.sync2DFromOrbit();
454
465
  }
455
466
  capture2DSnapshot() {
456
467
  const e = this.runtime;
@@ -478,7 +489,7 @@ class Li {
478
489
  const t = [];
479
490
  for (const i of [-1, 1])
480
491
  for (const r of [-1, 1]) {
481
- const n = new S(i, r, -1).unproject(e.camera3d), o = new S(i, r, 1).unproject(e.camera3d).sub(n).normalize();
492
+ const n = new E(i, r, -1).unproject(e.camera3d), o = new E(i, r, 1).unproject(e.camera3d).sub(n).normalize();
482
493
  if (Math.abs(o.z) < 1e-8) continue;
483
494
  const l = (0 - n.z) / o.z;
484
495
  !Number.isFinite(l) || l < 0 || t.push({
@@ -503,7 +514,7 @@ class Li {
503
514
  };
504
515
  }
505
516
  clampDistance(e) {
506
- return D.clamp(
517
+ return O.clamp(
507
518
  Number.isFinite(e) ? e : this.orbitDistanceMin,
508
519
  this.orbitDistanceMin,
509
520
  this.orbitDistanceMax
@@ -521,42 +532,42 @@ class Li {
521
532
  }
522
533
  }
523
534
  }
524
- const Ti = new S(2.4, -2.7, 1.7), Di = new S(0, 0, 0.65), Oi = Math.PI, zi = !0, Ni = new S(1.25, -1.5, 0.85).normalize(), Vi = 1.25, Fi = 0.4, $i = 12, Bi = 1e3, _i = 20, Ui = 0.1, ji = 0.2, Pt = "left-rotate", Hi = {
525
- "left-rotate": { LEFT: z.ROTATE, MIDDLE: z.DOLLY, RIGHT: z.PAN },
526
- "left-pan": { LEFT: z.PAN, MIDDLE: z.DOLLY, RIGHT: z.ROTATE }
535
+ const Ni = new E(2.4, -2.7, 1.7), Fi = new E(0, 0, 0.65), Vi = Math.PI, $i = !0, Bi = new E(1.25, -1.5, 0.85).normalize(), _i = 1.25, Ui = 0.4, ji = 12, Hi = 1e3, qi = 20, Yi = 0.1, Xi = 0.2, It = "left-rotate", Wi = {
536
+ "left-rotate": { LEFT: N.ROTATE, MIDDLE: N.DOLLY, RIGHT: N.PAN },
537
+ "left-pan": { LEFT: N.PAN, MIDDLE: N.DOLLY, RIGHT: N.ROTATE }
527
538
  };
528
- function qi({ radius: s, fovDeg: e }) {
529
- const t = Math.max(s, 0.02), i = D.degToRad(e), r = t / Math.sin(i * 0.5) * Vi;
539
+ function Gi({ radius: s, fovDeg: e }) {
540
+ const t = Math.max(s, 0.02), i = O.degToRad(e), r = t / Math.sin(i * 0.5) * _i;
530
541
  return {
531
542
  distance: r,
532
- minDistance: Math.max(t * Fi, 0.01),
533
- maxDistance: Math.max(t * $i, 1),
543
+ minDistance: Math.max(t * Ui, 0.01),
544
+ maxDistance: Math.max(t * ji, 1),
534
545
  near: Math.max(
535
- r / Bi,
536
- Math.min(Ui, t * ji),
546
+ r / Hi,
547
+ Math.min(Yi, t * Xi),
537
548
  1e-4
538
549
  ),
539
- far: Math.max(r * _i, 10)
550
+ far: Math.max(r * qi, 10)
540
551
  };
541
552
  }
542
- function Yi(s, e, t) {
553
+ function Ki(s, e, t) {
543
554
  e.minDistance = t.minDistance, e.maxDistance = t.maxDistance, s.near = t.near, s.far = t.far, s.updateProjectionMatrix();
544
555
  }
545
- function Be(s, e, t = Pt) {
546
- s.enableDamping = zi, s.maxPolarAngle = Oi, s.dampingFactor = 0.1, s.enablePan = !0, s.screenSpacePanning = !0, s.mouseButtons = { ...Hi[t] }, yt.DEFAULT_UP.set(0, 0, 1), e.up.set(0, 0, 1);
556
+ function je(s, e, t = It) {
557
+ s.enableDamping = $i, s.maxPolarAngle = Vi, s.dampingFactor = 0.1, s.enablePan = !0, s.screenSpacePanning = !0, s.mouseButtons = { ...Wi[t] }, Ct.DEFAULT_UP.set(0, 0, 1), e.up.set(0, 0, 1);
547
558
  }
548
- function Xi(s, e, t, i) {
559
+ function Zi(s, e, t, i) {
549
560
  if (t.isEmpty()) return null;
550
- const r = t.getSize(new S()), n = t.getCenter(new S()), a = Math.max(r.length() * 0.5, 0.02), o = qi({ radius: a, fovDeg: i });
551
- return e.target.copy(n), s.position.copy(n).addScaledVector(Ni, o.distance), Yi(s, e, o), s.updateMatrixWorld(), e.update(), o;
561
+ const r = t.getSize(new E()), n = t.getCenter(new E()), a = Math.max(r.length() * 0.5, 0.02), o = Gi({ radius: a, fovDeg: i });
562
+ return e.target.copy(n), s.position.copy(n).addScaledVector(Bi, o.distance), Ki(s, e, o), s.updateMatrixWorld(), e.update(), o;
552
563
  }
553
- const Wi = 1e3, Gi = 2, Ki = -1e4, Zi = 1e4, _e = 1e3, Ji = 2e6, Qi = 1.15, er = 1, Ue = new jt(Math.PI / 2, 0, Math.PI * 0.98 * 0.8);
554
- class tr {
564
+ const Ji = 1e3, Qi = 2, er = -1e4, tr = 1e4, He = 1e3, ir = 2e6, rr = 1.15, sr = 1, qe = new qt(Math.PI / 2, 0, Math.PI * 0.98 * 0.8);
565
+ class nr {
555
566
  constructor(e) {
556
567
  u(this, "canvasArea");
557
568
  u(this, "canvas");
558
569
  u(this, "scene", new we());
559
- u(this, "overlayRoot", new xt());
570
+ u(this, "overlayRoot", new St());
560
571
  u(this, "renderer");
561
572
  u(this, "camera2d");
562
573
  u(this, "camera3d");
@@ -568,10 +579,10 @@ class tr {
568
579
  u(this, "ownedObjects", /* @__PURE__ */ new Set());
569
580
  u(this, "overlays", /* @__PURE__ */ new Map());
570
581
  u(this, "eventCleanups", []);
571
- u(this, "raycaster", new wt());
582
+ u(this, "raycaster", new Et());
572
583
  u(this, "pointerNdc", new oe());
573
- u(this, "reuseVector", new S());
574
- u(this, "reuseVector2", new S());
584
+ u(this, "reuseVector", new E());
585
+ u(this, "reuseVector2", new E());
575
586
  u(this, "viewModeValue");
576
587
  u(this, "initialized", !1);
577
588
  u(this, "disposed", !1);
@@ -593,37 +604,37 @@ class tr {
593
604
  u(this, "previewImageDataBuffer", null);
594
605
  u(this, "environmentResource", null);
595
606
  u(this, "environmentLoadGeneration", 0);
596
- this.options = e, this.canvasArea = e.canvasArea, this.canvas = e.canvas, this.viewModeValue = e.initialViewMode ?? "2d", this.navigationPolicyValue = e.navigationPolicy ?? "legacy", this.previewDragPreset = e.previewDragPreset ?? Pt, this.overlayRoot.name = "scene-runtime:overlays", this.scene.add(this.overlayRoot);
607
+ this.options = e, this.canvasArea = e.canvasArea, this.canvas = e.canvas, this.viewModeValue = e.initialViewMode ?? "2d", this.navigationPolicyValue = e.navigationPolicy ?? "legacy", this.previewDragPreset = e.previewDragPreset ?? It, this.overlayRoot.name = "scene-runtime:overlays", this.scene.add(this.overlayRoot);
597
608
  }
598
609
  initialize() {
599
610
  if (this.disposed) throw new Error("SceneRuntime has been disposed.");
600
611
  if (this.initialized) return;
601
- const e = this.options.factories, t = (e == null ? void 0 : e.createRenderer) ?? ((l) => new _t(l)), i = (e == null ? void 0 : e.createMapControls) ?? ((l, d) => new ni(l, d)), r = (e == null ? void 0 : e.createOrbitControls) ?? ((l, d) => new ai(l, d));
612
+ const e = this.options.factories, t = (e == null ? void 0 : e.createRenderer) ?? ((l) => new jt(l)), i = (e == null ? void 0 : e.createMapControls) ?? ((l, d) => new oi(l, d)), r = (e == null ? void 0 : e.createOrbitControls) ?? ((l, d) => new li(l, d));
602
613
  this.renderer = t({
603
614
  canvas: this.canvas,
604
615
  antialias: this.options.antialias ?? !0,
605
616
  alpha: this.options.alpha ?? !1,
606
617
  powerPreference: this.options.powerPreference ?? "high-performance"
607
- }), this.options.clearColor !== void 0 && this.renderer.setClearColor(new Ut(this.options.clearColor));
618
+ }), this.options.clearColor !== void 0 && this.renderer.setClearColor(new Ht(this.options.clearColor));
608
619
  const n = Math.max(1, this.canvasArea.clientWidth || 1), a = Math.max(1, this.canvasArea.clientHeight || 1), o = n / a;
609
620
  if (this.renderer.setPixelRatio(this.readDevicePixelRatio()), this.renderer.setSize(n, a, !1), this.options.environment) {
610
- const l = (e == null ? void 0 : e.createEnvironment) ?? ir;
611
- this.scene.environmentIntensity = er, this.scene.environmentRotation.copy(Ue), this.scene.backgroundRotation.copy(Ue);
621
+ const l = (e == null ? void 0 : e.createEnvironment) ?? ar;
622
+ this.scene.environmentIntensity = sr, this.scene.environmentRotation.copy(qe), this.scene.backgroundRotation.copy(qe);
612
623
  const d = ++this.environmentLoadGeneration, c = l(this.renderer, this.options.environment);
613
- rr(c) ? c.then(
624
+ or(c) ? c.then(
614
625
  (p) => this.applyEnvironmentResource(p, d),
615
626
  (p) => {
616
627
  !this.disposed && d === this.environmentLoadGeneration && console.warn("Failed to load scene environment HDR.", p);
617
628
  }
618
629
  ) : this.applyEnvironmentResource(c, d);
619
630
  }
620
- this.camera2d = new De(-o, o, 1, -1, Ki, Zi), this.camera2d.position.set(0, 0, 1), this.camera2d.lookAt(0, 0, 0), this.camera3d = new Ht(40, o, _e, Ji), 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 = {
621
- LEFT: z.PAN,
622
- MIDDLE: z.DOLLY,
623
- RIGHT: z.PAN
631
+ this.camera2d = new Oe(-o, o, 1, -1, er, tr), this.camera2d.position.set(0, 0, 1), this.camera2d.lookAt(0, 0, 0), this.camera3d = new Yt(40, o, He, ir), 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 = {
632
+ LEFT: N.PAN,
633
+ MIDDLE: N.DOLLY,
634
+ RIGHT: N.PAN
624
635
  }, this.controls2d.touches = {
625
- ONE: Oe.PAN,
626
- TWO: Oe.DOLLY_PAN
636
+ ONE: ze.PAN,
637
+ TWO: ze.DOLLY_PAN
627
638
  }, this.controls3d = r(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);
628
639
  }
629
640
  get isInitialized() {
@@ -664,10 +675,10 @@ class tr {
664
675
  var t, i;
665
676
  if (this.controls3d) {
666
677
  if (e === "viewer") {
667
- this.viewerOrbit ?? (this.viewerOrbit = new Li()), this.viewerOrbit.attach(this);
678
+ this.viewerOrbit ?? (this.viewerOrbit = new zi()), this.viewerOrbit.attach(this);
668
679
  return;
669
680
  }
670
- (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" && (Be(this.controls3d, this.camera3d, this.previewDragPreset), this.camera3d.position.copy(Ti), this.controls3d.target.copy(Di), this.controls3d.update());
681
+ (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" && (je(this.controls3d, this.camera3d, this.previewDragPreset), this.camera3d.position.copy(Ni), this.controls3d.target.copy(Fi), this.controls3d.update());
671
682
  }
672
683
  }
673
684
  /**
@@ -676,7 +687,7 @@ class tr {
676
687
  * handed to OrbitControls.
677
688
  */
678
689
  setPreviewDragPreset(e) {
679
- this.previewDragPreset !== e && (this.previewDragPreset = e, !(!this.initialized || this.navigationPolicyValue !== "preview") && (Be(this.controls3d, this.camera3d, e), this.requestRender()));
690
+ this.previewDragPreset !== e && (this.previewDragPreset = e, !(!this.initialized || this.navigationPolicyValue !== "preview") && (je(this.controls3d, this.camera3d, e), this.requestRender()));
680
691
  }
681
692
  /**
682
693
  * Drives OrbitControls once per frame. Damping mutates the camera inside
@@ -728,7 +739,7 @@ class tr {
728
739
  if (!this.mountedObjects.has(e) && e.parent !== this.scene) return !1;
729
740
  e.removeFromParent(), this.mountedObjects.delete(e);
730
741
  const i = this.ownedObjects.delete(e);
731
- return (t.dispose === !0 || t.dispose === void 0 && i) && Ne(e), this.requestRender(), !0;
742
+ return (t.dispose === !0 || t.dispose === void 0 && i) && $e(e), this.requestRender(), !0;
732
743
  }
733
744
  setObjectVisible(e, t) {
734
745
  e.visible !== t && (e.visible = t, this.requestRender());
@@ -738,7 +749,7 @@ class tr {
738
749
  }
739
750
  removeOverlay(e, t = {}) {
740
751
  const i = this.overlays.get(e);
741
- return i ? (this.overlays.delete(e), i.object.removeFromParent(), (t.dispose === !0 || t.dispose === void 0 && i.owned) && Ne(i.object), this.requestRender(), i.object) : null;
752
+ return i ? (this.overlays.delete(e), i.object.removeFromParent(), (t.dispose === !0 || t.dispose === void 0 && i.owned) && $e(i.object), this.requestRender(), i.object) : null;
742
753
  }
743
754
  setHighlight(e, t = {}) {
744
755
  if (!e) {
@@ -761,21 +772,21 @@ class tr {
761
772
  if (!this.camera2d || !this.camera3d) return !1;
762
773
  const i = this.resolveBox3(e);
763
774
  if (!i || i.isEmpty()) return !1;
764
- const r = i.getSize(new S()), n = i.getCenter(new S());
775
+ const r = i.getSize(new E()), n = i.getCenter(new E());
765
776
  if (![r.x, r.y, r.z, n.x, n.y, n.z].every(Number.isFinite)) return !1;
766
777
  const a = Math.max(1, t.padding ?? 1.05);
767
778
  if ((t.viewMode ?? this.viewModeValue) === "2d") {
768
779
  const l = Math.max(r.x, 1e-6) * a, d = Math.max(r.y, 1e-6) * a, c = Math.max(1, this.canvasArea.clientWidth), p = Math.max(1, this.canvasArea.clientHeight), h = c / p;
769
- let f = l / 2, m = d / 2;
770
- f / m < h ? f = m * h : m = f / h, this.camera2d.left = -f, this.camera2d.right = f, this.camera2d.top = m, this.camera2d.bottom = -m, this.camera2d.zoom = 1, this.camera2d.position.set(n.x, n.y, Math.max(n.z + 1, 1)), this.camera2d.updateProjectionMatrix(), this.controls2d.target.copy(n), this.controls2d.update();
780
+ let f = l / 2, v = d / 2;
781
+ f / v < h ? f = v * h : v = f / h, this.camera2d.left = -f, this.camera2d.right = f, this.camera2d.top = v, this.camera2d.bottom = -v, this.camera2d.zoom = 1, this.camera2d.position.set(n.x, n.y, Math.max(n.z + 1, 1)), this.camera2d.updateProjectionMatrix(), this.controls2d.target.copy(n), this.controls2d.update();
771
782
  } else if (this.navigationPolicyValue === "preview")
772
- Xi(this.camera3d, this.controls3d, i, this.camera3d.fov);
783
+ Zi(this.camera3d, this.controls3d, i, this.camera3d.fov);
773
784
  else if (this.viewerOrbit)
774
785
  this.viewerOrbit.fit3D(i, { padding: a });
775
786
  else {
776
- const l = n.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(r.length() / 2, 1e-6), h = Math.max(Math.min(d, c) / 2, 1e-6), f = p / Math.sin(h) * a, m = this.camera3d.position.clone().sub(this.controls3d.target);
777
- m.lengthSq() <= 1e-12 && m.set(1, -1, 1), m.normalize(), this.controls3d.target.copy(l), this.camera3d.position.copy(l).addScaledVector(m, f), this.camera3d.lookAt(l), this.camera3d.near = Math.min(
778
- _e,
787
+ const l = n.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(r.length() / 2, 1e-6), h = Math.max(Math.min(d, c) / 2, 1e-6), f = p / Math.sin(h) * a, v = this.camera3d.position.clone().sub(this.controls3d.target);
788
+ v.lengthSq() <= 1e-12 && v.set(1, -1, 1), v.normalize(), this.controls3d.target.copy(l), this.camera3d.position.copy(l).addScaledVector(v, f), this.camera3d.lookAt(l), this.camera3d.near = Math.min(
789
+ He,
779
790
  Math.max(f * 0.01, 1e-6)
780
791
  ), this.camera3d.updateProjectionMatrix(), this.controls3d.update();
781
792
  }
@@ -835,16 +846,16 @@ class tr {
835
846
  distance: i,
836
847
  // Match ViewOrbitNavigation's convention: yaw around +Z, pitch off the XY plane.
837
848
  yaw: Math.atan2(t.y, t.x),
838
- pitch: Math.asin(D.clamp(t.z / i, -1, 1))
849
+ pitch: Math.asin(O.clamp(t.z / i, -1, 1))
839
850
  };
840
851
  }
841
852
  applyPreviewOrbitSnapshot(e) {
842
853
  if (!this.camera3d || !this.controls3d) return !1;
843
- const t = Math.cos(e.pitch), i = new S(e.targetX, e.targetY, e.targetZ), r = D.clamp(
854
+ const t = Math.cos(e.pitch), i = new E(e.targetX, e.targetY, e.targetZ), r = O.clamp(
844
855
  e.distance,
845
856
  this.controls3d.minDistance,
846
857
  this.controls3d.maxDistance
847
- ), n = new S(
858
+ ), n = new E(
848
859
  i.x + r * Math.cos(e.yaw) * t,
849
860
  i.y + r * Math.sin(e.yaw) * t,
850
861
  i.z + r * Math.sin(e.pitch)
@@ -878,24 +889,24 @@ class tr {
878
889
  }
879
890
  renderOrthographicPreview(e, t, i) {
880
891
  var G;
881
- if (!this.renderer || this.disposed || t.parent || !sr(i)) return !1;
882
- const r = Math.max(1, Math.floor(e.clientWidth || e.width || 0)), n = Math.max(1, Math.floor(e.clientHeight || e.height || 0)), a = this.resolveRendererPixelRatio(), o = Math.min(2, a), l = Math.max(1, Math.floor(r * o)), d = Math.max(1, Math.floor(n * o)), c = l / a, p = d / a, h = Math.min(c, p), f = (i.minX + i.maxX) / 2, m = (i.minY + i.maxY) / 2, b = Math.max(i.maxX - i.minX, i.maxY - i.minY, 1) * Qi / 2, y = this.getOrCreatePreviewRenderTarget(l, d), g = this.getOrCreatePreviewCamera();
883
- g.left = -b, g.right = b, g.top = b, g.bottom = -b, g.position.set(f, m, 1), g.up.copy(((G = this.camera2d) == null ? void 0 : G.up) ?? new S(0, 1, 0)), g.lookAt(f, m, 0), g.updateProjectionMatrix(), g.updateMatrixWorld(!0);
884
- const x = this.getOrCreatePreviewScene(), w = this.renderer, k = w.getRenderTarget(), F = w.getClearAlpha(), C = w.autoClear, A = new qt();
892
+ if (!this.renderer || this.disposed || t.parent || !lr(i)) return !1;
893
+ const r = Math.max(1, Math.floor(e.clientWidth || e.width || 0)), n = Math.max(1, Math.floor(e.clientHeight || e.height || 0)), a = this.resolveRendererPixelRatio(), o = Math.min(2, a), l = Math.max(1, Math.floor(r * o)), d = Math.max(1, Math.floor(n * o)), c = l / a, p = d / a, h = Math.min(c, p), f = (i.minX + i.maxX) / 2, v = (i.minY + i.maxY) / 2, m = Math.max(i.maxX - i.minX, i.maxY - i.minY, 1) * rr / 2, b = this.getOrCreatePreviewRenderTarget(l, d), g = this.getOrCreatePreviewCamera();
894
+ g.left = -m, g.right = m, g.top = m, g.bottom = -m, g.position.set(f, v, 1), g.up.copy(((G = this.camera2d) == null ? void 0 : G.up) ?? new E(0, 1, 0)), g.lookAt(f, v, 0), g.updateProjectionMatrix(), g.updateMatrixWorld(!0);
895
+ const x = this.getOrCreatePreviewScene(), w = this.renderer, C = w.getRenderTarget(), D = w.getClearAlpha(), S = w.autoClear, A = new Xt();
885
896
  w.getViewport(A);
886
897
  const L = w.getScissorTest();
887
898
  x.add(t);
888
899
  try {
889
- w.setRenderTarget(y), w.setViewport(0, 0, c, p), w.setScissorTest(!1), w.setClearAlpha(0), w.autoClear = !1, w.clear(), w.setViewport(
900
+ w.setRenderTarget(b), w.setViewport(0, 0, c, p), w.setScissorTest(!1), w.setClearAlpha(0), w.autoClear = !1, w.clear(), w.setViewport(
890
901
  Math.floor((c - h) / 2),
891
902
  Math.floor((p - h) / 2),
892
903
  h,
893
904
  h
894
905
  ), w.render(x, g);
895
906
  const K = this.getOrCreatePreviewPixelBuffer(l, d);
896
- return w.readRenderTargetPixels(y, 0, 0, l, d, K), this.blitPreviewPixelsToCanvas(e, K, l, d);
907
+ return w.readRenderTargetPixels(b, 0, 0, l, d, K), this.blitPreviewPixelsToCanvas(e, K, l, d);
897
908
  } finally {
898
- t.removeFromParent(), w.setRenderTarget(k), w.setClearAlpha(F), w.autoClear = C, w.setViewport(
909
+ t.removeFromParent(), w.setRenderTarget(C), w.setClearAlpha(D), w.autoClear = S, w.setViewport(
899
910
  A.x,
900
911
  A.y,
901
912
  A.z,
@@ -918,7 +929,7 @@ class tr {
918
929
  }
919
930
  screenToWorldOnPlane(e, t, i = 0) {
920
931
  const r = this.clientToNdc(e, t, this.pointerNdc);
921
- return !r || !this.activeCamera ? null : (this.raycaster.setFromCamera(r, this.activeCamera), this.raycaster.ray.intersectPlane(new Ct(new S(0, 0, 1), -i), new S()));
932
+ return !r || !this.activeCamera ? null : (this.raycaster.setFromCamera(r, this.activeCamera), this.raycaster.ray.intersectPlane(new kt(new E(0, 0, 1), -i), new E()));
922
933
  }
923
934
  worldToClient(e, t = new oe()) {
924
935
  var a;
@@ -960,8 +971,8 @@ class tr {
960
971
  startAnimation(e = {}) {
961
972
  if (this.disposed || this.animationLoopActive) return;
962
973
  this.animationLoopActive = !0, this.infoFrames = 0, this.infoLastTime = performance.now();
963
- const t = e.infoUpdateIntervalMs ?? Wi, i = (r = performance.now()) => {
964
- var o, l, d, c, p, h, f, m, v;
974
+ const t = e.infoUpdateIntervalMs ?? Ji, i = (r = performance.now()) => {
975
+ var o, l, d, c, p, h, f, v, y;
965
976
  if (!this.animationLoopActive || this.disposed) {
966
977
  this.animationFrameId = null;
967
978
  return;
@@ -972,18 +983,18 @@ class tr {
972
983
  let a = !1;
973
984
  if (this.renderRequested && (((c = e.shouldRender) == null ? void 0 : c.call(e, r)) ?? !0)) {
974
985
  (p = e.beforeRender) == null || p.call(e, r);
975
- const b = (h = e.renderExtension) == null ? void 0 : h.beforeRender(this.renderer, this.scene, this.activeCamera, r);
986
+ const m = (h = e.renderExtension) == null ? void 0 : h.beforeRender(this.renderer, this.scene, this.activeCamera, r);
976
987
  try {
977
988
  this.renderer.render(this.scene, this.activeCamera);
978
989
  } finally {
979
- b == null || b();
990
+ m == null || m();
980
991
  }
981
992
  this.renderRequested = !1, a = !0, (f = e.afterRender) == null || f.call(e, r);
982
993
  }
983
994
  if (this.infoFrames += 1, r - this.infoLastTime >= t) {
984
- const b = Math.max(1, r - this.infoLastTime);
985
- this.fpsCurrent = this.infoFrames * 1e3 / b, this.infoFrames = 0, this.infoLastTime = r, (m = e.onInfoUpdate) == null || m.call(e);
986
- } else a && ((v = e.onInfoUpdate) == null || v.call(e));
995
+ const m = Math.max(1, r - this.infoLastTime);
996
+ this.fpsCurrent = this.infoFrames * 1e3 / m, this.infoFrames = 0, this.infoLastTime = r, (v = e.onInfoUpdate) == null || v.call(e);
997
+ } else a && ((y = e.onInfoUpdate) == null || y.call(e));
987
998
  };
988
999
  i();
989
1000
  }
@@ -1011,11 +1022,11 @@ class tr {
1011
1022
  return this.previewScene || (this.previewScene = new we()), this.previewScene;
1012
1023
  }
1013
1024
  getOrCreatePreviewCamera() {
1014
- return this.previewCamera || (this.previewCamera = new De(-1, 1, 1, -1, -1e6, 1e6)), this.previewCamera;
1025
+ return this.previewCamera || (this.previewCamera = new Oe(-1, 1, 1, -1, -1e6, 1e6)), this.previewCamera;
1015
1026
  }
1016
1027
  getOrCreatePreviewRenderTarget(e, t) {
1017
1028
  var i;
1018
- return this.previewRenderTarget && this.previewRenderTargetSize.width === e && this.previewRenderTargetSize.height === t ? this.previewRenderTarget : ((i = this.previewRenderTarget) == null || i.dispose(), this.previewRenderTarget = new Yt(e, t), this.previewRenderTargetSize = { width: e, height: t }, this.previewRenderTarget);
1029
+ return this.previewRenderTarget && this.previewRenderTargetSize.width === e && this.previewRenderTargetSize.height === t ? this.previewRenderTarget : ((i = this.previewRenderTarget) == null || i.dispose(), this.previewRenderTarget = new Wt(e, t), this.previewRenderTargetSize = { width: e, height: t }, this.previewRenderTarget);
1019
1030
  }
1020
1031
  getOrCreatePreviewPixelBuffer(e, t) {
1021
1032
  const i = e * t * 4;
@@ -1045,13 +1056,13 @@ class tr {
1045
1056
  }
1046
1057
  readDevicePixelRatio() {
1047
1058
  const e = globalThis.devicePixelRatio;
1048
- return typeof e != "number" || !Number.isFinite(e) || e <= 0 ? 1 : Math.min(e, Gi);
1059
+ return typeof e != "number" || !Number.isFinite(e) || e <= 0 ? 1 : Math.min(e, Qi);
1049
1060
  }
1050
1061
  resolveBox3(e) {
1051
- if (e instanceof N) return e.clone();
1052
- if (e instanceof yt) return new N().setFromObject(e);
1062
+ if (e instanceof F) return e.clone();
1063
+ if (e instanceof Ct) return new F().setFromObject(e);
1053
1064
  const { minX: t, minY: i, maxX: r, maxY: n } = e;
1054
- return ![t, i, r, n].every(Number.isFinite) || r < t || n < i ? null : new N(new S(t, i, 0), new S(r, n, 0));
1065
+ return ![t, i, r, n].every(Number.isFinite) || r < t || n < i ? null : new F(new E(t, i, 0), new E(r, n, 0));
1055
1066
  }
1056
1067
  isDescendantOf(e, t) {
1057
1068
  let i = e.parent;
@@ -1068,9 +1079,9 @@ class tr {
1068
1079
  });
1069
1080
  }
1070
1081
  }
1071
- function ir(s, e) {
1082
+ function ar(s, e) {
1072
1083
  if (e === "room") {
1073
- const t = new Xt(s), i = new si(), r = t.fromScene(i);
1084
+ const t = new Gt(s), i = new ai(), r = t.fromScene(i);
1074
1085
  return i.dispose(), t.dispose(), {
1075
1086
  texture: r.texture,
1076
1087
  dispose: () => r.dispose()
@@ -1078,23 +1089,23 @@ function ir(s, e) {
1078
1089
  }
1079
1090
  if (e.type !== "hdr" || e.url.trim().length === 0)
1080
1091
  throw new Error("HDR scene environment requires a non-empty URL.");
1081
- return new oi().loadAsync(e.url).then((t) => (t.mapping = Wt, {
1092
+ return new di().loadAsync(e.url).then((t) => (t.mapping = Kt, {
1082
1093
  texture: t,
1083
1094
  dispose: () => t.dispose()
1084
1095
  }));
1085
1096
  }
1086
- function rr(s) {
1097
+ function or(s) {
1087
1098
  return typeof (s == null ? void 0 : s.then) == "function";
1088
1099
  }
1089
- function sr(s) {
1100
+ function lr(s) {
1090
1101
  return Number.isFinite(s.minX) && Number.isFinite(s.minY) && Number.isFinite(s.maxX) && Number.isFinite(s.maxY) && s.maxX >= s.minX && s.maxY >= s.minY;
1091
1102
  }
1092
- const Ie = 1;
1093
- function nr() {
1094
- return typeof globalThis.localStorage > "u" ? ar() : {
1103
+ const Me = 1, dr = 1024, cr = 16, ur = 1e9;
1104
+ function hr() {
1105
+ return typeof globalThis.localStorage > "u" ? pr() : {
1095
1106
  read(s) {
1096
1107
  try {
1097
- const e = globalThis.localStorage.getItem(je(s));
1108
+ const e = globalThis.localStorage.getItem(Ye(s));
1098
1109
  return e ? JSON.parse(e) : null;
1099
1110
  } catch {
1100
1111
  return null;
@@ -1102,13 +1113,13 @@ function nr() {
1102
1113
  },
1103
1114
  write(s, e) {
1104
1115
  try {
1105
- globalThis.localStorage.setItem(je(s), JSON.stringify(e));
1116
+ globalThis.localStorage.setItem(Ye(s), JSON.stringify(e));
1106
1117
  } catch {
1107
1118
  }
1108
1119
  }
1109
1120
  };
1110
1121
  }
1111
- function ar() {
1122
+ function pr() {
1112
1123
  const s = /* @__PURE__ */ new Map();
1113
1124
  return {
1114
1125
  read(e) {
@@ -1119,15 +1130,15 @@ function ar() {
1119
1130
  }
1120
1131
  };
1121
1132
  }
1122
- function or(s, e) {
1133
+ function fr(s, e) {
1123
1134
  if (!s || !e) return null;
1124
1135
  const t = s.read(e);
1125
- return At(t) ? t : null;
1136
+ return Ie(t) ? t : null;
1126
1137
  }
1127
- function At(s) {
1138
+ function Ie(s) {
1128
1139
  if (!s || typeof s != "object") return !1;
1129
1140
  const e = s;
1130
- if (e.schemaVersion !== Ie) return !1;
1141
+ if (e.schemaVersion !== Me) return !1;
1131
1142
  if (e.viewMode === "2d") {
1132
1143
  const t = e.orthographic;
1133
1144
  return !t || ![
@@ -1155,31 +1166,60 @@ function At(s) {
1155
1166
  }
1156
1167
  return !1;
1157
1168
  }
1158
- function lr(s, e, t) {
1169
+ function mr(s, e, t) {
1159
1170
  !s || !e || s.write(e, t);
1160
1171
  }
1161
- function dr(s) {
1172
+ function vr(s) {
1162
1173
  return {
1163
- schemaVersion: Ie,
1174
+ schemaVersion: Me,
1164
1175
  viewMode: s.viewMode,
1165
1176
  ...s.orthographic ? { orthographic: s.orthographic } : {},
1166
1177
  ...s.orbit ? { orbit: s.orbit } : {}
1167
1178
  };
1168
1179
  }
1169
- function je(s) {
1170
- return `nebula-viewer:camera:v${Ie}:${s}`;
1180
+ function gr(s, e) {
1181
+ if (!Ie(s)) return null;
1182
+ const t = br(e);
1183
+ if (s.viewMode === "2d") {
1184
+ const r = s.orthographic;
1185
+ if (!r) return null;
1186
+ const n = (r.right - r.left) / r.zoom, a = (r.top - r.bottom) / r.zoom;
1187
+ return !Number.isFinite(n) || !Number.isFinite(a) || Math.max(n, a) > t || e && !yr(r.positionX, r.positionY, n, a, e) ? null : s;
1188
+ }
1189
+ const i = s.orbit;
1190
+ return !i || e && !xr(i.targetX, i.targetY, e) ? null : s;
1191
+ }
1192
+ function br(s) {
1193
+ if (s) {
1194
+ const e = Math.max(s.maxX - s.minX, s.maxY - s.minY);
1195
+ if (Number.isFinite(e) && e > 0) return e * dr;
1196
+ }
1197
+ return ur;
1198
+ }
1199
+ function yr(s, e, t, i, r) {
1200
+ const n = t / 2, a = i / 2;
1201
+ return !(s + n < r.minX || s - n > r.maxX || e + a < r.minY || e - a > r.maxY);
1202
+ }
1203
+ function xr(s, e, t) {
1204
+ const i = Math.max(t.maxX - t.minX, t.maxY - t.minY);
1205
+ if (!Number.isFinite(i) || i <= 0) return !0;
1206
+ const r = i * cr;
1207
+ return s >= t.minX - r && s <= t.maxX + r && e >= t.minY - r && e <= t.maxY + r;
1208
+ }
1209
+ function Ye(s) {
1210
+ return `nebula-viewer:camera:v${Me}:${s}`;
1171
1211
  }
1172
1212
  function Z(s) {
1173
- return new N(
1174
- new S(s.minX, s.minY, s.minZ),
1175
- new S(s.maxX, s.maxY, s.maxZ)
1213
+ return new F(
1214
+ new E(s.minX, s.minY, s.minZ),
1215
+ new E(s.maxX, s.maxY, s.maxZ)
1176
1216
  );
1177
1217
  }
1178
- function It(s) {
1218
+ function Rt(s) {
1179
1219
  const [e, t, i] = s;
1180
1220
  return (e & 255) << 16 | (t & 255) << 8 | i & 255;
1181
1221
  }
1182
- class cr {
1222
+ class wr {
1183
1223
  constructor() {
1184
1224
  u(this, "rows", []);
1185
1225
  u(this, "allColor", null);
@@ -1202,7 +1242,7 @@ class cr {
1202
1242
  color: i.has(n.index) ? i.get(n.index) : this.allColor,
1203
1243
  sourceColor: n.color
1204
1244
  }));
1205
- fr(this.rows, r) || (this.rows = r, this.revision += 1, t && this.onChange());
1245
+ kr(this.rows, r) || (this.rows = r, this.revision += 1, t && this.onChange());
1206
1246
  }
1207
1247
  clear(e = !0) {
1208
1248
  const t = this.rows.length > 0 || this.allColor !== null;
@@ -1259,7 +1299,7 @@ class cr {
1259
1299
  t && (this.allColor = e, this.revision += 1, this.onChange());
1260
1300
  }
1261
1301
  }
1262
- class ur {
1302
+ class Cr {
1263
1303
  constructor() {
1264
1304
  u(this, "usages", []);
1265
1305
  u(this, "revision", 0);
@@ -1285,7 +1325,7 @@ class ur {
1285
1325
  canHighlight: r.canHighlight,
1286
1326
  visible: r.visible
1287
1327
  }));
1288
- mr(this.usages, i) || (this.usages = i, this.revision += 1, t && this.onChange());
1328
+ Pr(this.usages, i) || (this.usages = i, this.revision += 1, t && this.onChange());
1289
1329
  }
1290
1330
  clear(e = !0) {
1291
1331
  const t = this.usages.length > 0;
@@ -1312,7 +1352,7 @@ class ur {
1312
1352
  t.length !== 0 && (this.renderNode.setInsertVisibleBatch(t), i && (this.visibilityRevision += 1, this.revision += 1, this.onChange()));
1313
1353
  }
1314
1354
  }
1315
- class hr {
1355
+ class Sr {
1316
1356
  constructor() {
1317
1357
  u(this, "selection", null);
1318
1358
  u(this, "details", null);
@@ -1330,7 +1370,7 @@ class hr {
1330
1370
  return !this.selection && !this.details && !this.textSelection && !this.textDetails ? !1 : (this.selection = null, this.details = null, this.textSelection = null, this.textDetails = null, this.revision += 1, !0);
1331
1371
  }
1332
1372
  }
1333
- class pr {
1373
+ class Er {
1334
1374
  constructor() {
1335
1375
  u(this, "revision", 0);
1336
1376
  u(this, "filename", null);
@@ -1372,7 +1412,7 @@ class pr {
1372
1412
  this.zoomLabel = Number.isFinite(p) && (p ?? 0) > 0 ? `${Math.round(p * 100)}%` : "", this.scaleRuler = {
1373
1413
  visible: !0,
1374
1414
  worldLength: c,
1375
- lengthLabel: vr(c, ((l = e.units) == null ? void 0 : l.source) ?? "mm")
1415
+ lengthLabel: Ar(c, ((l = e.units) == null ? void 0 : l.source) ?? "mm")
1376
1416
  }, this.orbitDistanceLabel = "";
1377
1417
  } else {
1378
1418
  const c = (d = e.host.runtime.captureCameraSnapshot()) == null ? void 0 : d.orbit;
@@ -1383,26 +1423,26 @@ class pr {
1383
1423
  return this.filename !== null || this.fileCount !== 0 || this.visibleLayerCount !== 0 || this.totalLayerCount !== 0 || this.statusMessage !== "" || this.zoomLabel !== "" || this.orbitDistanceLabel !== "" || this.scaleRuler !== null || this.viewportVertexCount !== 0 || this.drawCalls !== 0 || this.fps !== 0 || this.lineRenderMode !== "" || this.entityCount !== 0 || this.lineCount !== 0 || this.fillCount !== 0 || this.dotCount !== 0 || this.textCount !== 0 || this.renderableCount !== 0 || this.submittedVertexRefs !== 0 || this.blockVariantCount !== 0 || this.blockInstanceCount !== 0 || this.splitBlockLayerGroupCount !== 0 || this.renderDebugBreakdown.length > 0 || this.splitBlockLayerDetails.length > 0 || this.phase !== null ? (this.revision += 1, this.filename = null, this.fileCount = 0, this.visibleLayerCount = 0, this.totalLayerCount = 0, this.statusMessage = "", this.zoomLabel = "", this.orbitDistanceLabel = "", this.scaleRuler = null, this.viewportVertexCount = 0, this.drawCalls = 0, this.fps = 0, this.lineRenderMode = "", this.entityCount = 0, this.lineCount = 0, this.fillCount = 0, this.dotCount = 0, this.textCount = 0, this.renderableCount = 0, this.submittedVertexRefs = 0, this.blockVariantCount = 0, this.blockInstanceCount = 0, this.splitBlockLayerGroupCount = 0, this.renderDebugBreakdown = [], this.splitBlockLayerDetails = [], this.phase = null, !0) : !1;
1384
1424
  }
1385
1425
  }
1386
- function fr(s, e) {
1426
+ function kr(s, e) {
1387
1427
  return s.length === e.length && s.every((t, i) => {
1388
1428
  const r = e[i];
1389
1429
  return r !== void 0 && t.index === r.index && t.name === r.name && t.visible === r.visible && t.color === r.color && t.sourceColor[0] === r.sourceColor[0] && t.sourceColor[1] === r.sourceColor[1] && t.sourceColor[2] === r.sourceColor[2];
1390
1430
  });
1391
1431
  }
1392
- function mr(s, e) {
1432
+ function Pr(s, e) {
1393
1433
  return s.length === e.length && s.every((t, i) => {
1394
1434
  const r = e[i];
1395
1435
  return r !== void 0 && t.insertId === r.insertId && t.blockName === r.blockName && t.layerName === r.layerName && t.layerIndex === r.layerIndex && t.variantId === r.variantId && t.instanceId === r.instanceId && t.label === r.label && t.canHighlight === r.canHighlight && t.visible === r.visible;
1396
1436
  });
1397
1437
  }
1398
- function vr(s, e) {
1438
+ function Ar(s, e) {
1399
1439
  if (e === "mm") {
1400
1440
  if (s >= 1e6) return `${(s / 1e6).toFixed(2)} km`;
1401
1441
  if (s >= 1e3) return `${(s / 1e3).toFixed(2)} m`;
1402
1442
  }
1403
1443
  return `${s.toFixed(2)}${e ? ` ${e}` : ""}`;
1404
1444
  }
1405
- function He(s) {
1445
+ function Xe(s) {
1406
1446
  return {
1407
1447
  documentKey: s.documentKey,
1408
1448
  filename: s.filename,
@@ -1414,13 +1454,13 @@ function He(s) {
1414
1454
  units: s.units ?? { source: "mm" }
1415
1455
  };
1416
1456
  }
1417
- const gr = 160, qe = 5e3;
1418
- class br {
1457
+ const Mr = 160, We = 5e3;
1458
+ class Ir {
1419
1459
  constructor(e) {
1420
- u(this, "layers", new cr());
1421
- u(this, "blocks", new ur());
1422
- u(this, "inspector", new hr());
1423
- u(this, "hud", new pr());
1460
+ u(this, "layers", new wr());
1461
+ u(this, "blocks", new Cr());
1462
+ u(this, "inspector", new Sr());
1463
+ u(this, "hud", new Er());
1424
1464
  u(this, "document", null);
1425
1465
  u(this, "loadTiming", null);
1426
1466
  u(this, "capabilities", {
@@ -1454,10 +1494,10 @@ class br {
1454
1494
  this.assertActive(), this.closeInternal();
1455
1495
  const i = ++this.openEpoch;
1456
1496
  this.cameraSettled = !1, this.initialDemandSettled = !1, this.initialCameraRestored = !1, this.cameraChangedDuringInitialLoad = !1, this.loadTiming = null;
1457
- const r = t.documentKey ?? Sr(e);
1497
+ const r = t.documentKey ?? Or(e);
1458
1498
  let n;
1459
1499
  try {
1460
- n = li(e, {
1500
+ n = ci(e, {
1461
1501
  documentKey: r ?? void 0,
1462
1502
  filename: t.filename,
1463
1503
  loadAnnotations: t.loadAnnotations,
@@ -1477,7 +1517,7 @@ class br {
1477
1517
  throw this.emit("error", { ...J(p, !0, e), error: p }), p;
1478
1518
  }
1479
1519
  this.session = n, this.loadTiming = n.loadTiming, this.statusMessage = "加载中…";
1480
- const a = di(n);
1520
+ const a = ui(n);
1481
1521
  this.renderNode = a, this.layers.bind(a, () => this.emit("layer-change", { layers: this.layers })), this.blocks.bind(a, () => this.emit("block-change", { blocks: this.blocks })), this.unsubscribers.push(
1482
1522
  a.onChange(() => {
1483
1523
  this.host.requestRender(), this.host.emitContentChange();
@@ -1546,7 +1586,7 @@ class br {
1546
1586
  name: "AbortError",
1547
1587
  code: "E_SUPERSEDED"
1548
1588
  });
1549
- return this.layers.sync(n, !1), this.blocks.sync(n, !1), this.syncHud(t.filename ?? o.filename ?? null), this.initialCameraRestored = this.tryRestoreCamera(r), !this.initialCameraRestored && o.bounds && this.host.fitBox3(Z(o.bounds)), this.cameraSettled = !0, this.syncDisplayContext(), this.document = He({
1589
+ return this.layers.sync(n, !1), this.blocks.sync(n, !1), this.syncHud(t.filename ?? o.filename ?? null), this.initialCameraRestored = this.tryRestoreCamera(r, o.bounds), !this.initialCameraRestored && o.bounds && this.host.fitBox3(Z(o.bounds)), this.cameraSettled = !0, this.syncDisplayContext(), this.document = Xe({
1550
1590
  documentKey: r,
1551
1591
  filename: t.filename ?? o.filename ?? null,
1552
1592
  phase: n.phase === "interactive" && !this.initialDemandSettled ? "initial-loading" : n.phase,
@@ -1625,11 +1665,11 @@ class br {
1625
1665
  return this.layers.getVisibilityRevision() + this.blocks.getVisibilityRevision();
1626
1666
  }
1627
1667
  setInsertSelection(e, t) {
1628
- yr(this.inspector.selection, e) && wr(this.inspector.details, t) && !this.inspector.textSelection || (this.inspector.setSelection(e, t), this.emit("inspector-change", { inspector: this.inspector }));
1668
+ Rr(this.inspector.selection, e) && Tr(this.inspector.details, t) && !this.inspector.textSelection || (this.inspector.setSelection(e, t), this.emit("inspector-change", { inspector: this.inspector }));
1629
1669
  }
1630
1670
  /** @internal Used by the viewer's managed interaction pipeline. */
1631
1671
  setTextSelectionInternal(e, t) {
1632
- xr(this.inspector.textSelection, e) && Cr(this.inspector.textDetails, t) && !this.inspector.selection || (this.inspector.setTextSelection(e, t), this.emit("inspector-change", { inspector: this.inspector }));
1672
+ Lr(this.inspector.textSelection, e) && Dr(this.inspector.textDetails, t) && !this.inspector.selection || (this.inspector.setTextSelection(e, t), this.emit("inspector-change", { inspector: this.inspector }));
1633
1673
  }
1634
1674
  getAuthoritativeBoundsBox() {
1635
1675
  if (!this.session) return null;
@@ -1682,7 +1722,7 @@ class br {
1682
1722
  }
1683
1723
  select(e) {
1684
1724
  var t, i, r;
1685
- 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(ze(e.selection.id))) ?? null) : this.setTextSelectionInternal(e.selection, ((r = (i = this.session) == null ? void 0 : i.getTextDetails) == null ? void 0 : r.call(i, e.selection.id)) ?? null) : this.clearSelection();
1725
+ 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(Ne(e.selection.id))) ?? null) : this.setTextSelectionInternal(e.selection, ((r = (i = this.session) == null ? void 0 : i.getTextDetails) == null ? void 0 : r.call(i, e.selection.id)) ?? null) : this.clearSelection();
1686
1726
  }
1687
1727
  clearSelection() {
1688
1728
  this.assertActive(), !(!this.inspector.selection && !this.inspector.textSelection) && (this.inspector.clear(), this.emit("inspector-change", { inspector: this.inspector }));
@@ -1703,7 +1743,7 @@ class br {
1703
1743
  hud: e(this.hud),
1704
1744
  loadTiming: e(this.loadTiming)
1705
1745
  };
1706
- return Mt(t);
1746
+ return Lt(t);
1707
1747
  }
1708
1748
  fitDocument() {
1709
1749
  this.assertActive();
@@ -1717,8 +1757,8 @@ class br {
1717
1757
  if (!e) return !1;
1718
1758
  let { minX: t, minY: i, maxX: r, maxY: n } = e;
1719
1759
  const a = r - t, o = n - i, l = Math.max(a, o);
1720
- if (a > 0 && o > 0 && l < qe) {
1721
- const c = (t + r) / 2, p = (i + n) / 2, h = qe / 2;
1760
+ if (a > 0 && o > 0 && l < We) {
1761
+ const c = (t + r) / 2, p = (i + n) / 2, h = We / 2;
1722
1762
  t = c - h, i = p - h, r = c + h, n = p + h;
1723
1763
  }
1724
1764
  return this.host.fitBox3(Z({
@@ -1733,14 +1773,16 @@ class br {
1733
1773
  refreshInspectorDetails(e) {
1734
1774
  const t = this.inspector.selection;
1735
1775
  if (!t) return;
1736
- const i = e.getBlockDetails(ze(t.id));
1776
+ const i = e.getBlockDetails(Ne(t.id));
1737
1777
  if (!i) return;
1738
1778
  const r = this.inspector.details, n = r == null ? void 0 : r.bbox;
1739
1779
  (n == null ? void 0 : n.minX) === i.bbox.minX && (n == null ? void 0 : n.minY) === i.bbox.minY && (n == null ? void 0 : n.maxX) === i.bbox.maxX && (n == null ? void 0 : n.maxY) === i.bbox.maxY || (this.inspector.setSelection(t, i), this.emit("inspector-change", { inspector: this.inspector }));
1740
1780
  }
1741
- tryRestoreCamera(e) {
1742
- const t = this.host.readCameraSnapshot(e);
1743
- return t ? this.host.applyCameraSnapshot(t, "restore") : !1;
1781
+ tryRestoreCamera(e, t) {
1782
+ const i = this.host.readCameraSnapshot(e);
1783
+ if (!i) return !1;
1784
+ const r = gr(i, t);
1785
+ return r ? this.host.applyCameraSnapshot(r, "restore") : !1;
1744
1786
  }
1745
1787
  persistCurrentCamera() {
1746
1788
  var t;
@@ -1748,7 +1790,7 @@ class br {
1748
1790
  const e = this.host.runtime.captureCameraSnapshot();
1749
1791
  e && this.host.persistCameraSnapshot(
1750
1792
  this.document.documentKey,
1751
- dr(e)
1793
+ vr(e)
1752
1794
  );
1753
1795
  }
1754
1796
  syncDisplayContext() {
@@ -1794,7 +1836,7 @@ class br {
1794
1836
  }
1795
1837
  this.viewportDemandTimer === null && (this.viewportDemandTimer = globalThis.setTimeout(() => {
1796
1838
  this.viewportDemandTimer = null, !(this.disposed || !this.session) && this.host.interaction === "active" && this.flushViewportDemand();
1797
- }, Math.max(0, this.host.viewportDemandCoalesceMs ?? gr)));
1839
+ }, Math.max(0, this.host.viewportDemandCoalesceMs ?? Mr)));
1798
1840
  }
1799
1841
  clearViewportDemandTimer() {
1800
1842
  this.viewportDemandTimer !== null && (globalThis.clearTimeout(this.viewportDemandTimer), this.viewportDemandTimer = null);
@@ -1813,7 +1855,7 @@ class br {
1813
1855
  });
1814
1856
  }
1815
1857
  publishDocumentPhase(e) {
1816
- this.document && (this.document = He({
1858
+ this.document && (this.document = Xe({
1817
1859
  documentKey: this.document.documentKey,
1818
1860
  filename: this.document.filename,
1819
1861
  phase: e,
@@ -1831,19 +1873,19 @@ class br {
1831
1873
  if (this.disposed) throw new Error("Viewer has been disposed.");
1832
1874
  }
1833
1875
  }
1834
- function yr(s, e) {
1876
+ function Rr(s, e) {
1835
1877
  return s === e || !!(s && e && s.documentKey === e.documentKey && s.id.layerIndex === e.id.layerIndex && s.id.variantId === e.id.variantId && s.id.instanceId === e.id.instanceId);
1836
1878
  }
1837
- function xr(s, e) {
1879
+ function Lr(s, e) {
1838
1880
  return s === e || !!(s && e && s.documentKey === e.documentKey && s.id.textId === e.id.textId);
1839
1881
  }
1840
- function wr(s, e) {
1882
+ function Tr(s, e) {
1841
1883
  return s === e || !!(s && e && s.id.layerIndex === e.id.layerIndex && s.id.variantId === e.id.variantId && s.id.instanceId === e.id.instanceId && s.label === e.label && s.blockName === e.blockName && s.layerName === e.layerName && s.layerIndex === e.layerIndex && s.tx === e.tx && s.ty === e.ty && s.rotation === e.rotation && s.scaleX === e.scaleX && s.scaleY === e.scaleY && s.bbox.minX === e.bbox.minX && s.bbox.minY === e.bbox.minY && s.bbox.maxX === e.bbox.maxX && s.bbox.maxY === e.bbox.maxY);
1842
1884
  }
1843
- function Cr(s, e) {
1885
+ function Dr(s, e) {
1844
1886
  return s === e || !!(s && e && s.id.textId === e.id.textId && s.content === e.content && s.x === e.x && s.y === e.y && s.height === e.height && s.rotation === e.rotation && s.layerName === e.layerName && s.layerIndex === e.layerIndex);
1845
1887
  }
1846
- function Sr(s) {
1888
+ function Or(s) {
1847
1889
  let e = null;
1848
1890
  if (typeof s == "string" ? e = s : typeof URL < "u" && s instanceof URL ? e = s.href : typeof s == "object" && s !== null && "kind" in s && s.kind === "url" && (e = s.url), !e) return null;
1849
1891
  let t = 2166136261;
@@ -1851,19 +1893,19 @@ function Sr(s) {
1851
1893
  t ^= e.charCodeAt(i), t = Math.imul(t, 16777619);
1852
1894
  return `reference:src-${(t >>> 0).toString(16)}`;
1853
1895
  }
1854
- function Mt(s) {
1896
+ function Lt(s) {
1855
1897
  if (!s || typeof s != "object") return s;
1856
1898
  Object.freeze(s);
1857
1899
  for (const e of Object.values(s))
1858
- e && typeof e == "object" && !Object.isFrozen(e) && Mt(e);
1900
+ e && typeof e == "object" && !Object.isFrozen(e) && Lt(e);
1859
1901
  return s;
1860
1902
  }
1861
1903
  function J(s, e, t) {
1862
1904
  const i = s.code, r = s.name, n = s.message.toLowerCase(), a = /external block|sidecar|variant .*fetch/.test(n), o = /annotation/.test(n), l = /font|troika/.test(n), d = i === "E_SUPERSEDED" ? "E_SUPERSEDED" : r === "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(n) ? "E_WORKER" : "E_PARSE_GEOMETRY";
1863
1905
  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 };
1864
1906
  }
1865
- const Ye = 1;
1866
- class Er {
1907
+ const Ge = 1;
1908
+ class zr {
1867
1909
  constructor(e) {
1868
1910
  u(this, "startX", 0);
1869
1911
  u(this, "startY", 0);
@@ -1908,13 +1950,13 @@ class Er {
1908
1950
  this.release(), this.resetMotion(), this.startX = 0, this.startY = 0, this.lastX = 0, this.lastY = 0;
1909
1951
  }
1910
1952
  isTrackingPrimaryPointer(e) {
1911
- return this.primaryPointerDown || (e & Ye) === Ye;
1953
+ return this.primaryPointerDown || (e & Ge) === Ge;
1912
1954
  }
1913
1955
  }
1914
1956
  function Ce(s, e) {
1915
1957
  return `${s}:${e}`;
1916
1958
  }
1917
- class kr {
1959
+ class Nr {
1918
1960
  constructor() {
1919
1961
  u(this, "expandedLayers", /* @__PURE__ */ new Set());
1920
1962
  u(this, "expandedBlocks", /* @__PURE__ */ new Set());
@@ -1958,7 +2000,7 @@ class kr {
1958
2000
  this.revealedSelectionKey = null, this.suppressedSelectionKey = null;
1959
2001
  }
1960
2002
  }
1961
- function I(s) {
2003
+ function M(s) {
1962
2004
  return s.replace(/[&<>"']/g, (e) => ({
1963
2005
  "&": "&amp;",
1964
2006
  "<": "&lt;",
@@ -1967,7 +2009,7 @@ function I(s) {
1967
2009
  "'": "&#39;"
1968
2010
  })[e] ?? e);
1969
2011
  }
1970
- const Pr = {
2012
+ const Fr = {
1971
2013
  "panel.layers": "图层",
1972
2014
  "panel.properties": "属性",
1973
2015
  "panel.layers.aria": "图层面板",
@@ -2046,7 +2088,7 @@ const Pr = {
2046
2088
  "status.parsing": "解析中…",
2047
2089
  "status.incrementalLoading": "增量渲染中…",
2048
2090
  "unit.mm": "mm"
2049
- }, Ar = {
2091
+ }, Vr = {
2050
2092
  "panel.layers": "Layers",
2051
2093
  "panel.properties": "Properties",
2052
2094
  "panel.layers.aria": "Layers panel",
@@ -2126,29 +2168,29 @@ const Pr = {
2126
2168
  "status.incrementalLoading": "Rendering incrementally…",
2127
2169
  "unit.mm": "mm"
2128
2170
  };
2129
- function Ir(s, e) {
2171
+ function $r(s, e) {
2130
2172
  return e ? s.replace(/\{([a-zA-Z0-9_]+)\}/g, (t, i) => {
2131
2173
  const r = e[i];
2132
2174
  return r === void 0 ? t : String(r);
2133
2175
  }) : s;
2134
2176
  }
2135
- function Mr(s) {
2177
+ function Br(s) {
2136
2178
  try {
2137
2179
  return new Intl.NumberFormat(s, { maximumFractionDigits: 4, useGrouping: !1 });
2138
2180
  } catch {
2139
2181
  return new Intl.NumberFormat("zh-CN", { maximumFractionDigits: 4, useGrouping: !1 });
2140
2182
  }
2141
2183
  }
2142
- function Rr(s) {
2184
+ function _r(s) {
2143
2185
  try {
2144
2186
  return new Intl.NumberFormat(s, { maximumFractionDigits: 0 });
2145
2187
  } catch {
2146
2188
  return new Intl.NumberFormat("zh-CN", { maximumFractionDigits: 0 });
2147
2189
  }
2148
2190
  }
2149
- function Rt(s) {
2191
+ function Tt(s) {
2150
2192
  var a;
2151
- const e = ((a = s.locale) == null ? void 0 : a.trim()) || "zh-CN", t = e.toLowerCase().startsWith("en") ? Ar : Pr, i = Mr(e), r = Rr(e), n = {
2193
+ const e = ((a = s.locale) == null ? void 0 : a.trim()) || "zh-CN", t = e.toLowerCase().startsWith("en") ? Vr : Fr, i = Br(e), r = _r(e), n = {
2152
2194
  locale: e,
2153
2195
  t(o, l) {
2154
2196
  var p;
@@ -2160,7 +2202,7 @@ function Rt(s) {
2160
2202
  d = void 0;
2161
2203
  }
2162
2204
  const c = d ?? ((p = s.messages) == null ? void 0 : p[o]) ?? t[o] ?? o;
2163
- return Ir(c, l);
2205
+ return $r(c, l);
2164
2206
  },
2165
2207
  formatNumber(o) {
2166
2208
  return o == null || !Number.isFinite(o) ? "—" : i.format(o);
@@ -2189,17 +2231,17 @@ function Rt(s) {
2189
2231
  };
2190
2232
  return n;
2191
2233
  }
2192
- const Lr = {
2234
+ const Ur = {
2193
2235
  "加载中…": "status.loading",
2194
2236
  "解析中…": "status.parsing",
2195
2237
  "增量渲染中…": "status.incrementalLoading"
2196
2238
  };
2197
- function Tr(s, e) {
2198
- const t = s.trim(), i = Lr[t];
2239
+ function jr(s, e) {
2240
+ const t = s.trim(), i = Ur[t];
2199
2241
  return i ? e.t(i) : t;
2200
2242
  }
2201
- const Me = Rt({});
2202
- function Dr(s) {
2243
+ const Re = Tt({});
2244
+ function Hr(s) {
2203
2245
  const e = /* @__PURE__ */ new Map();
2204
2246
  for (const i of s.usages) {
2205
2247
  const r = e.get(i.layerIndex) ?? /* @__PURE__ */ new Map(), n = Ce(i.layerIndex, i.variantId);
@@ -2224,7 +2266,7 @@ function Dr(s) {
2224
2266
  t.set(i, [...r.values()]);
2225
2267
  return t;
2226
2268
  }
2227
- function Or(s, e) {
2269
+ function qr(s, e) {
2228
2270
  return s ? e.toLowerCase().includes(s) : !0;
2229
2271
  }
2230
2272
  function ce(s, e, t) {
@@ -2233,17 +2275,17 @@ function ce(s, e, t) {
2233
2275
  function le(s, e, t) {
2234
2276
  s.classList.toggle("off", e === "none"), s.classList.toggle("mixed", e === "mixed"), s.textContent = e === "all" ? "●" : e === "none" ? "○" : "◐", s.title = e === "all" ? t.t("layer.hideBlock") : e === "none" ? t.t("layer.showBlockRestore") : t.t("layer.hideBlockKeep");
2235
2277
  }
2236
- function zr(s) {
2278
+ function Yr(s) {
2237
2279
  let e = 0;
2238
2280
  for (const t of s) t.visible && (e += 1);
2239
2281
  return e <= 0 ? "none" : e >= s.length ? "all" : "mixed";
2240
2282
  }
2241
- function Lt(s, e, t, i) {
2283
+ function Dt(s, e, t, i) {
2242
2284
  if (!s) return !1;
2243
2285
  const r = s.id;
2244
2286
  return r.layerIndex !== e || r.variantId !== t ? !1 : i === void 0 ? !0 : r.instanceId === i;
2245
2287
  }
2246
- function Xe(s) {
2288
+ function Ke(s) {
2247
2289
  const e = s.querySelector(".vui-lrow-insert.active") ?? s.querySelector(".vui-lrow-block.active");
2248
2290
  if (!e) return !1;
2249
2291
  const t = s.getBoundingClientRect(), i = e.getBoundingClientRect();
@@ -2251,7 +2293,7 @@ function Xe(s) {
2251
2293
  const r = i.top - t.top, n = s.scrollTop + r - (t.height - i.height) / 2;
2252
2294
  return s.scrollTop = Math.max(0, n), !0;
2253
2295
  }
2254
- function Tt(s, e, t = 0) {
2296
+ function Ot(s, e, t = 0) {
2255
2297
  const i = () => {
2256
2298
  const r = s.getBoundingClientRect(), n = e.getBoundingClientRect();
2257
2299
  if (r.height <= 0) return;
@@ -2270,7 +2312,7 @@ function Tt(s, e, t = 0) {
2270
2312
  };
2271
2313
  i(), typeof requestAnimationFrame == "function" && requestAnimationFrame(i);
2272
2314
  }
2273
- function Nr(s, e) {
2315
+ function Xr(s, e) {
2274
2316
  const t = e.trim().toLowerCase();
2275
2317
  s.querySelectorAll(".vui-lrow-wrap").forEach((i) => {
2276
2318
  var o, l;
@@ -2280,7 +2322,7 @@ function Nr(s, e) {
2280
2322
  i.style.display = a ? "" : "none";
2281
2323
  });
2282
2324
  }
2283
- function Vr(s, e) {
2325
+ function Wr(s, e) {
2284
2326
  if (s.querySelectorAll(".vui-lrow-block.active, .vui-lrow-insert.active").forEach((o) => {
2285
2327
  o.classList.remove("active");
2286
2328
  }), !e) return;
@@ -2293,80 +2335,80 @@ function Vr(s, e) {
2293
2335
  );
2294
2336
  a && a.classList.add("active");
2295
2337
  }
2296
- function Fr(s, e, t, i = Me) {
2338
+ function Gr(s, e, t, i = Re) {
2297
2339
  var l;
2298
2340
  const r = new Map(e.map((d) => [d.index, d]));
2299
2341
  s.querySelectorAll(".vui-lrow[data-layer-index]:not(.vui-lrow-all)").forEach((d) => {
2300
2342
  const c = r.get(Number(d.dataset.layerIndex));
2301
2343
  if (!c) return;
2302
2344
  const p = d.querySelector(".vui-lrow-eye");
2303
- p && (p.textContent = c.visible ? "●" : "○", p.title = c.visible ? i.t("layer.hide") : i.t("layer.show")), d.classList.toggle("off", !c.visible), Dt(d, Re(c));
2345
+ p && (p.textContent = c.visible ? "●" : "○", p.title = c.visible ? i.t("layer.hide") : i.t("layer.show")), d.classList.toggle("off", !c.visible), zt(d, Le(c));
2304
2346
  });
2305
2347
  const n = s.querySelector(".vui-lrow-all"), a = t === null ? "#c8c8c8" : X(t);
2306
2348
  (l = n == null ? void 0 : n.querySelector(".vui-lrow-clr")) == null || l.style.setProperty("background", a);
2307
2349
  const o = n == null ? void 0 : n.querySelector('input[type="color"]');
2308
2350
  o && o.value !== a && (o.value = a);
2309
2351
  }
2310
- function $r(s, e, t) {
2311
- var m;
2312
- const i = t.text ?? Me;
2352
+ function Kr(s, e, t) {
2353
+ var v;
2354
+ const i = t.text ?? Re;
2313
2355
  e.resetForScope(t.scopeKey);
2314
- const r = e.filterText.trim().toLowerCase(), n = t.layers.rows, a = Dr(t.blocks);
2356
+ const r = e.filterText.trim().toLowerCase(), n = t.layers.rows, a = Hr(t.blocks);
2315
2357
  if (s.list.replaceChildren(), s.count.textContent = String(n.length), n.length === 0) {
2316
- s.list.appendChild(_r(i.t("layer.empty")));
2358
+ s.list.appendChild(Jr(i.t("layer.empty")));
2317
2359
  return;
2318
2360
  }
2319
2361
  const o = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set();
2320
- for (const v of n) {
2321
- o.add(v.index);
2322
- for (const b of a.get(v.index) ?? []) l.add(b.key);
2362
+ for (const y of n) {
2363
+ o.add(y.index);
2364
+ for (const m of a.get(y.index) ?? []) l.add(m.key);
2323
2365
  }
2324
2366
  e.prune(o, l);
2325
- const d = (m = t.selection) == null ? void 0 : m.id, c = d ? `${d.layerIndex}:${d.variantId}:${d.instanceId}` : null;
2367
+ const d = (v = t.selection) == null ? void 0 : v.id, c = d ? `${d.layerIndex}:${d.variantId}:${d.instanceId}` : null;
2326
2368
  d && c && e.needsSelectionReveal(c) ? e.ensureSelectionVisible(c, d.layerIndex, d.variantId) : d || e.clearSelectionReveal();
2327
2369
  const p = document.createElement("div");
2328
2370
  p.className = "vui-lrow vui-lrow-all", p.innerHTML = `
2329
2371
  <span class="vui-lrow-eye">◎</span>
2330
2372
  <span class="vui-lrow-dot"></span>
2331
2373
  <span class="vui-lrow-toggle placeholder">▶</span>
2332
- <span class="vui-lrow-name">${I(i.t("layer.all"))}</span>
2333
- <span class="vui-lrow-clr" style="background: ${t.layers.allColor == null ? "#c8c8c8" : `#${t.layers.allColor.toString(16).padStart(6, "0")}`}" title="${I(i.t("layer.colorOverrideAll"))}">
2374
+ <span class="vui-lrow-name">${M(i.t("layer.all"))}</span>
2375
+ <span class="vui-lrow-clr" style="background: ${t.layers.allColor == null ? "#c8c8c8" : `#${t.layers.allColor.toString(16).padStart(6, "0")}`}" title="${M(i.t("layer.colorOverrideAll"))}">
2334
2376
  <input type="color" value="#${(t.layers.allColor ?? 13158600).toString(16).padStart(6, "0")}">
2335
2377
  </span>`;
2336
2378
  const h = p.querySelector('input[type="color"]');
2337
2379
  h && h.addEventListener("input", () => {
2338
- var y, g, x;
2339
- const v = Number.parseInt(h.value.slice(1), 16), b = Number.isFinite(v) ? v : null;
2340
- (y = t.beginLayerColorPreview) == null || y.call(t, h);
2380
+ var b, g, x;
2381
+ const y = Number.parseInt(h.value.slice(1), 16), m = Number.isFinite(y) ? y : null;
2382
+ (b = t.beginLayerColorPreview) == null || b.call(t, h);
2341
2383
  try {
2342
- if (t.setAllLayerColor) t.setAllLayerColor(b);
2343
- else for (const k of n) t.setLayerColor(k.index, b);
2344
- const w = b === null ? "#c8c8c8" : X(b);
2345
- (g = h.closest(".vui-lrow-clr")) == null || g.style.setProperty("background", w), We(s.list, n, b);
2384
+ if (t.setAllLayerColor) t.setAllLayerColor(m);
2385
+ else for (const C of n) t.setLayerColor(C.index, m);
2386
+ const w = m === null ? "#c8c8c8" : X(m);
2387
+ (g = h.closest(".vui-lrow-clr")) == null || g.style.setProperty("background", w), Ze(s.list, n, m);
2346
2388
  } finally {
2347
2389
  (x = t.endLayerColorPreview) == null || x.call(t, h);
2348
2390
  }
2349
- }), h == null || h.addEventListener("click", (v) => v.stopPropagation());
2391
+ }), h == null || h.addEventListener("click", (y) => y.stopPropagation());
2350
2392
  const f = p.querySelector(".vui-lrow-clr");
2351
- f && f.addEventListener("contextmenu", (v) => {
2352
- var b;
2353
- if (v.preventDefault(), v.stopPropagation(), t.setAllLayerColor) t.setAllLayerColor(null);
2354
- else for (const y of n) t.setLayerColor(y.index, null);
2355
- (b = h == null ? void 0 : h.closest(".vui-lrow-clr")) == null || b.style.setProperty("background", "#c8c8c8"), h && (h.value = "#c8c8c8"), We(s.list, n, null);
2393
+ f && f.addEventListener("contextmenu", (y) => {
2394
+ var m;
2395
+ if (y.preventDefault(), y.stopPropagation(), t.setAllLayerColor) t.setAllLayerColor(null);
2396
+ else for (const b of n) t.setLayerColor(b.index, null);
2397
+ (m = h == null ? void 0 : h.closest(".vui-lrow-clr")) == null || m.style.setProperty("background", "#c8c8c8"), h && (h.value = "#c8c8c8"), Ze(s.list, n, null);
2356
2398
  }), s.list.appendChild(p);
2357
- for (const v of n)
2358
- Or(r, v.name) && s.list.appendChild(Br(v, e, t, a.get(v.index) ?? [], i));
2359
- c && e.needsSelectionReveal(c) && (Xe(s.list) && e.markSelectionRevealed(c), typeof requestAnimationFrame == "function" && requestAnimationFrame(() => {
2360
- e.needsSelectionReveal(c) && Xe(s.list) && e.markSelectionRevealed(c);
2399
+ for (const y of n)
2400
+ qr(r, y.name) && s.list.appendChild(Zr(y, e, t, a.get(y.index) ?? [], i));
2401
+ c && e.needsSelectionReveal(c) && (Ke(s.list) && e.markSelectionRevealed(c), typeof requestAnimationFrame == "function" && requestAnimationFrame(() => {
2402
+ e.needsSelectionReveal(c) && Ke(s.list) && e.markSelectionRevealed(c);
2361
2403
  }));
2362
2404
  }
2363
2405
  function X(s) {
2364
2406
  return `#${s.toString(16).padStart(6, "0")}`;
2365
2407
  }
2366
- function Re(s) {
2367
- return s.color !== null ? X(s.color) : X(It(s.sourceColor));
2408
+ function Le(s) {
2409
+ return s.color !== null ? X(s.color) : X(Rt(s.sourceColor));
2368
2410
  }
2369
- function Dt(s, e) {
2411
+ function zt(s, e) {
2370
2412
  var r;
2371
2413
  (r = s.querySelector(".vui-lrow-dot")) == null || r.style.setProperty("background", e);
2372
2414
  const t = s.querySelector(".vui-lrow-clr");
@@ -2374,21 +2416,21 @@ function Dt(s, e) {
2374
2416
  const i = s.querySelector('input[type="color"]');
2375
2417
  i && i.value !== e && (i.value = e);
2376
2418
  }
2377
- function We(s, e, t) {
2419
+ function Ze(s, e, t) {
2378
2420
  const i = new Map(e.map((r) => [r.index, r]));
2379
2421
  s.querySelectorAll(".vui-lrow[data-layer-index]").forEach((r) => {
2380
2422
  const n = i.get(Number(r.dataset.layerIndex));
2381
- n && Dt(r, t === null ? Re(n) : X(t));
2423
+ n && zt(r, t === null ? Le(n) : X(t));
2382
2424
  });
2383
2425
  }
2384
- function Br(s, e, t, i, r) {
2385
- const n = i.length > 0, a = e.expandedLayers.has(s.index), o = Re(s), l = document.createElement("div");
2426
+ function Zr(s, e, t, i, r) {
2427
+ const n = i.length > 0, a = e.expandedLayers.has(s.index), o = Le(s), l = document.createElement("div");
2386
2428
  l.className = "vui-lrow-wrap";
2387
2429
  const d = document.createElement("div");
2388
2430
  d.className = `vui-lrow${s.visible ? "" : " off"}`, d.dataset.layerIndex = String(s.index);
2389
2431
  const c = document.createElement("button");
2390
- c.type = "button", c.className = "vui-lrow-eye", c.textContent = s.visible ? "●" : "○", c.title = s.visible ? r.t("layer.hide") : r.t("layer.show"), c.addEventListener("click", (y) => {
2391
- y.stopPropagation();
2432
+ c.type = "button", c.className = "vui-lrow-eye", c.textContent = s.visible ? "●" : "○", c.title = s.visible ? r.t("layer.hide") : r.t("layer.show"), c.addEventListener("click", (b) => {
2433
+ b.stopPropagation();
2392
2434
  const g = !s.visible;
2393
2435
  c.textContent = g ? "●" : "○", c.title = g ? r.t("layer.hide") : r.t("layer.show"), d.classList.toggle("off", !g), t.toggleLayer(s.index);
2394
2436
  });
@@ -2396,8 +2438,8 @@ function Br(s, e, t, i, r) {
2396
2438
  p.className = "vui-lrow-dot", p.style.background = o;
2397
2439
  const h = document.createElement("button");
2398
2440
  h.type = "button", h.className = `vui-lrow-toggle${n ? "" : " placeholder"}`, h.textContent = a ? "▼" : "▶", h.disabled = !n;
2399
- const f = (y) => {
2400
- if (y.stopPropagation(), !n) return;
2441
+ const f = (b) => {
2442
+ if (b.stopPropagation(), !n) return;
2401
2443
  e.toggleLayerExpanded(s.index);
2402
2444
  const g = e.expandedLayers.has(s.index);
2403
2445
  h.textContent = g ? "▼" : "▶";
@@ -2408,94 +2450,94 @@ function Br(s, e, t, i, r) {
2408
2450
  else {
2409
2451
  x = document.createElement("div"), x.className = "vui-lrow-blocks open";
2410
2452
  for (const w of i)
2411
- x.appendChild(Ge(w, e, t, r));
2453
+ x.appendChild(Je(w, e, t, r));
2412
2454
  l.appendChild(x);
2413
2455
  }
2414
2456
  else {
2415
2457
  x == null || x.classList.remove("open");
2416
2458
  const w = l.closest(".vui-section-list") ?? l.parentElement;
2417
- w && Tt(w, d, 0);
2459
+ w && Ot(w, d, 0);
2418
2460
  }
2419
2461
  };
2420
2462
  h.addEventListener("click", f);
2421
- const m = document.createElement("span");
2422
- m.className = "vui-lrow-name", m.textContent = s.name || r.t("layer.unnamed"), m.title = s.name;
2423
2463
  const v = document.createElement("span");
2424
- v.className = "vui-lrow-clr", v.style.background = o, v.title = r.t("layer.colorOverride");
2425
- const b = document.createElement("input");
2426
- if (b.type = "color", b.value = o, b.addEventListener("input", () => {
2464
+ v.className = "vui-lrow-name", v.textContent = s.name || r.t("layer.unnamed"), v.title = s.name;
2465
+ const y = document.createElement("span");
2466
+ y.className = "vui-lrow-clr", y.style.background = o, y.title = r.t("layer.colorOverride");
2467
+ const m = document.createElement("input");
2468
+ if (m.type = "color", m.value = o, m.addEventListener("input", () => {
2427
2469
  var g, x;
2428
- const y = Number.parseInt(b.value.slice(1), 16);
2429
- (g = t.beginLayerColorPreview) == null || g.call(t, b);
2470
+ const b = Number.parseInt(m.value.slice(1), 16);
2471
+ (g = t.beginLayerColorPreview) == null || g.call(t, m);
2430
2472
  try {
2431
- t.setLayerColor(s.index, Number.isFinite(y) ? y : null), p.style.background = b.value, v.style.background = b.value;
2473
+ t.setLayerColor(s.index, Number.isFinite(b) ? b : null), p.style.background = m.value, y.style.background = m.value;
2432
2474
  } finally {
2433
- (x = t.endLayerColorPreview) == null || x.call(t, b);
2475
+ (x = t.endLayerColorPreview) == null || x.call(t, m);
2434
2476
  }
2435
- }), b.addEventListener("click", (y) => y.stopPropagation()), v.addEventListener("contextmenu", (y) => {
2436
- y.preventDefault(), y.stopPropagation(), t.setLayerColor(s.index, null);
2437
- const g = X(It(s.sourceColor));
2438
- b.value = g, p.style.background = g, v.style.background = g;
2439
- }), v.appendChild(b), d.append(c, p, h, m, v), d.addEventListener("click", (y) => {
2440
- const g = y.target;
2477
+ }), m.addEventListener("click", (b) => b.stopPropagation()), y.addEventListener("contextmenu", (b) => {
2478
+ b.preventDefault(), b.stopPropagation(), t.setLayerColor(s.index, null);
2479
+ const g = X(Rt(s.sourceColor));
2480
+ m.value = g, p.style.background = g, y.style.background = g;
2481
+ }), y.appendChild(m), d.append(c, p, h, v, y), d.addEventListener("click", (b) => {
2482
+ const g = b.target;
2441
2483
  if (g instanceof HTMLInputElement && g.type === "color" || g.closest(".vui-lrow-clr") || g.closest(".vui-lrow-toggle") || g.closest(".vui-lrow-eye")) return;
2442
2484
  const x = !s.visible;
2443
2485
  c.textContent = x ? "●" : "○", c.title = x ? r.t("layer.hide") : r.t("layer.show"), d.classList.toggle("off", !x), t.toggleLayer(s.index);
2444
2486
  }), l.appendChild(d), n && a) {
2445
- const y = document.createElement("div");
2446
- y.className = "vui-lrow-blocks open";
2487
+ const b = document.createElement("div");
2488
+ b.className = "vui-lrow-blocks open";
2447
2489
  for (const g of i)
2448
- y.appendChild(Ge(g, e, t, r));
2449
- l.appendChild(y);
2490
+ b.appendChild(Je(g, e, t, r));
2491
+ l.appendChild(b);
2450
2492
  }
2451
2493
  return l;
2452
2494
  }
2453
- function Ge(s, e, t, i) {
2495
+ function Je(s, e, t, i) {
2454
2496
  const r = document.createElement("div");
2455
2497
  r.className = "vui-lrow-block-wrap";
2456
- const n = e.expandedBlocks.has(s.key), a = zr(s.inserts), o = Lt(t.selection, s.layerIndex, s.variantId), l = document.createElement("div");
2498
+ const n = e.expandedBlocks.has(s.key), a = Yr(s.inserts), o = Dt(t.selection, s.layerIndex, s.variantId), l = document.createElement("div");
2457
2499
  l.className = `vui-lrow-block${o ? " active" : ""}${s.canHighlight ? "" : " disabled"}`, l.dataset.variantId = String(s.variantId), l.dataset.layerIndex = String(s.layerIndex), s.canHighlight || (l.title = i.t("layer.noHighlightBlock"));
2458
2500
  const d = document.createElement("button");
2459
- d.type = "button", d.className = "vui-lrow-block-visibility", le(d, a, i), d.addEventListener("click", (m) => {
2460
- if (m.stopPropagation(), a === "none") {
2461
- const b = e.blockVisibilitySnapshots.get(s.key), y = [];
2501
+ d.type = "button", d.className = "vui-lrow-block-visibility", le(d, a, i), d.addEventListener("click", (v) => {
2502
+ if (v.stopPropagation(), a === "none") {
2503
+ const m = e.blockVisibilitySnapshots.get(s.key), b = [];
2462
2504
  for (const g of s.inserts) {
2463
- const x = (b == null ? void 0 : b.get(g.instanceId)) ?? !0;
2464
- g.visible !== x && y.push({ insertId: g.insertId, visible: x });
2505
+ const x = (m == null ? void 0 : m.get(g.instanceId)) ?? !0;
2506
+ g.visible !== x && b.push({ insertId: g.insertId, visible: x });
2465
2507
  }
2466
2508
  if (le(d, "all", i), r.querySelectorAll(".vui-lrow-insert-visibility").forEach((g) => {
2467
2509
  ce(g, !0, i);
2468
- }), t.batchToggleInserts && y.length > 0)
2469
- t.batchToggleInserts(y);
2510
+ }), t.batchToggleInserts && b.length > 0)
2511
+ t.batchToggleInserts(b);
2470
2512
  else
2471
- for (const g of y) t.toggleInsert(g.insertId, g.visible);
2513
+ for (const g of b) t.toggleInsert(g.insertId, g.visible);
2472
2514
  return;
2473
2515
  }
2474
2516
  e.blockVisibilitySnapshots.set(
2475
2517
  s.key,
2476
- new Map(s.inserts.map((b) => [b.instanceId, b.visible]))
2518
+ new Map(s.inserts.map((m) => [m.instanceId, m.visible]))
2477
2519
  );
2478
- const v = s.inserts.filter((b) => b.visible).map((b) => ({ insertId: b.insertId, visible: !1 }));
2479
- if (le(d, "none", i), r.querySelectorAll(".vui-lrow-insert-visibility").forEach((b) => {
2480
- ce(b, !1, i);
2481
- }), t.batchToggleInserts && v.length > 0)
2482
- t.batchToggleInserts(v);
2520
+ const y = s.inserts.filter((m) => m.visible).map((m) => ({ insertId: m.insertId, visible: !1 }));
2521
+ if (le(d, "none", i), r.querySelectorAll(".vui-lrow-insert-visibility").forEach((m) => {
2522
+ ce(m, !1, i);
2523
+ }), t.batchToggleInserts && y.length > 0)
2524
+ t.batchToggleInserts(y);
2483
2525
  else
2484
- for (const b of v) t.toggleInsert(b.insertId, !1);
2526
+ for (const m of y) t.toggleInsert(m.insertId, !1);
2485
2527
  });
2486
2528
  const c = document.createElement("button");
2487
2529
  c.type = "button", c.className = "vui-lrow-block-toggle", c.textContent = n ? "▼" : "▶";
2488
- const p = (m) => {
2489
- m.stopPropagation(), e.toggleBlockExpanded(s.layerIndex, s.variantId);
2490
- const v = e.expandedBlocks.has(s.key);
2491
- c.textContent = v ? "▼" : "▶";
2492
- let b = r.querySelector(":scope > .vui-lrow-inserts");
2493
- if (v)
2494
- b ? b.classList.add("open") : (b = Ke(s, e, t, d, i), r.appendChild(b));
2530
+ const p = (v) => {
2531
+ v.stopPropagation(), e.toggleBlockExpanded(s.layerIndex, s.variantId);
2532
+ const y = e.expandedBlocks.has(s.key);
2533
+ c.textContent = y ? "▼" : "▶";
2534
+ let m = r.querySelector(":scope > .vui-lrow-inserts");
2535
+ if (y)
2536
+ m ? m.classList.add("open") : (m = Qe(s, e, t, d, i), r.appendChild(m));
2495
2537
  else {
2496
- b == null || b.classList.remove("open");
2497
- const y = r.closest(".vui-section-list") ?? r.parentElement;
2498
- y && Tt(y, l, 24);
2538
+ m == null || m.classList.remove("open");
2539
+ const b = r.closest(".vui-section-list") ?? r.parentElement;
2540
+ b && Ot(b, l, 24);
2499
2541
  }
2500
2542
  };
2501
2543
  c.addEventListener("click", p);
@@ -2504,16 +2546,16 @@ function Ge(s, e, t, i) {
2504
2546
  const f = document.createElement("span");
2505
2547
  return f.className = "vui-lrow-block-count", f.textContent = `×${s.inserts.length}`, l.append(d, c, h, f), s.inserts.length === 1 && l.addEventListener("click", () => {
2506
2548
  if (!s.canHighlight) return;
2507
- const m = s.inserts[0], v = `${s.layerIndex}:${s.variantId}:${m.instanceId}`;
2508
- e.markSelectionRevealed(v), t.selectInsert(m.insertId);
2509
- }), r.appendChild(l), n && r.appendChild(Ke(s, e, t, d, i)), r;
2549
+ const v = s.inserts[0], y = `${s.layerIndex}:${s.variantId}:${v.instanceId}`;
2550
+ e.markSelectionRevealed(y), t.selectInsert(v.insertId);
2551
+ }), r.appendChild(l), n && r.appendChild(Qe(s, e, t, d, i)), r;
2510
2552
  }
2511
- function Ke(s, e, t, i, r) {
2553
+ function Qe(s, e, t, i, r) {
2512
2554
  const n = document.createElement("div");
2513
2555
  n.className = "vui-lrow-inserts open";
2514
2556
  for (const a of s.inserts) {
2515
2557
  const o = document.createElement("div");
2516
- o.className = `vui-lrow-insert${Lt(t.selection, s.layerIndex, s.variantId, a.instanceId) ? " active" : ""}${a.canHighlight === !1 ? " disabled" : ""}`, o.dataset.layerIndex = String(s.layerIndex), o.dataset.variantId = String(s.variantId), o.dataset.instanceId = String(a.instanceId), o.dataset.insertId = a.insertId, a.canHighlight === !1 && (o.title = r.t("layer.noHighlightInsert"));
2558
+ o.className = `vui-lrow-insert${Dt(t.selection, s.layerIndex, s.variantId, a.instanceId) ? " active" : ""}${a.canHighlight === !1 ? " disabled" : ""}`, o.dataset.layerIndex = String(s.layerIndex), o.dataset.variantId = String(s.variantId), o.dataset.instanceId = String(a.instanceId), o.dataset.insertId = a.insertId, a.canHighlight === !1 && (o.title = r.t("layer.noHighlightInsert"));
2517
2559
  const l = document.createElement("button");
2518
2560
  l.type = "button", l.className = "vui-lrow-insert-visibility", ce(l, a.visible, r), l.addEventListener("click", (c) => {
2519
2561
  c.stopPropagation();
@@ -2521,11 +2563,11 @@ function Ke(s, e, t, i, r) {
2521
2563
  ce(l, p, r);
2522
2564
  const h = n.querySelectorAll(".vui-lrow-insert-visibility");
2523
2565
  let f = 0;
2524
- h.forEach((v) => {
2525
- v.dataset.visible === "1" && f++;
2566
+ h.forEach((y) => {
2567
+ y.dataset.visible === "1" && f++;
2526
2568
  });
2527
- const m = f === 0 ? "none" : f === h.length ? "all" : "mixed";
2528
- le(i, m, r), t.toggleInsert(a.insertId, p);
2569
+ const v = f === 0 ? "none" : f === h.length ? "all" : "mixed";
2570
+ le(i, v, r), t.toggleInsert(a.insertId, p);
2529
2571
  });
2530
2572
  const d = document.createElement("span");
2531
2573
  d.className = "vui-lrow-insert-label", d.textContent = a.label, d.title = a.label, o.append(l, d), o.addEventListener("click", () => {
@@ -2536,47 +2578,47 @@ function Ke(s, e, t, i, r) {
2536
2578
  }
2537
2579
  return n;
2538
2580
  }
2539
- function _r(s) {
2581
+ function Jr(s) {
2540
2582
  const e = document.createElement("div");
2541
2583
  return e.className = "vui-empty-note", e.textContent = s, e;
2542
2584
  }
2543
- function Ur(s, e) {
2585
+ function Qr(s, e) {
2544
2586
  const t = () => {
2545
2587
  e(s.value);
2546
2588
  };
2547
2589
  return s.addEventListener("input", t), () => s.removeEventListener("input", t);
2548
2590
  }
2549
- function Ze(s, e, t = Me, i = "mm") {
2591
+ function et(s, e, t = Re, i = "mm") {
2550
2592
  if (s.body.replaceChildren(), e.textSelection && e.textDetails) {
2551
- H(s, !1), Hr(s.body, e.textDetails, t, i), Je(s.body);
2593
+ H(s, !1), ts(s.body, e.textDetails, t, i), tt(s.body);
2552
2594
  return;
2553
2595
  }
2554
2596
  if (!e.selection || !e.details) {
2555
- H(s, !1), s.body.appendChild(qr(t.t("property.empty")));
2597
+ H(s, !1), s.body.appendChild(is(t.t("property.empty")));
2556
2598
  return;
2557
2599
  }
2558
- jr(s.body, e.details, t, i), Je(s.body);
2600
+ es(s.body, e.details, t, i), tt(s.body);
2559
2601
  }
2560
2602
  function H(s, e) {
2561
2603
  if (!s.previewWrap || !s.previewCanvas || (s.previewWrap.hidden = !e, e)) return;
2562
2604
  const t = s.previewCanvas.getContext("2d");
2563
2605
  t == null || t.clearRect(0, 0, s.previewCanvas.width, s.previewCanvas.height);
2564
2606
  }
2565
- function jr(s, e, t, i) {
2566
- Ot(s, t.t("property.insert"), e.blockName), Se(s, t.t("property.basic"), (r) => {
2567
- M(r, t.t("property.block"), e.blockName), M(r, t.t("property.layer"), e.layerName), M(r, t.t("property.instance"), `#${e.id.instanceId}`), M(r, t.t("property.currentShape"), t.t("property.normalShape"));
2607
+ function es(s, e, t, i) {
2608
+ Nt(s, t.t("property.insert"), e.blockName), Se(s, t.t("property.basic"), (r) => {
2609
+ I(r, t.t("property.block"), e.blockName), I(r, t.t("property.layer"), e.layerName), I(r, t.t("property.instance"), `#${e.id.instanceId}`), I(r, t.t("property.currentShape"), t.t("property.normalShape"));
2568
2610
  }), Se(s, t.t("property.transform"), (r) => {
2569
- M(r, "X", t.formatUnit(e.tx, i)), M(r, "Y", t.formatUnit(e.ty, i)), M(r, t.t("property.rotation"), t.formatUnit(e.rotation, "°")), M(r, "Sx", t.formatNumber(e.scaleX)), M(r, "Sy", t.formatNumber(e.scaleY));
2611
+ I(r, "X", t.formatUnit(e.tx, i)), I(r, "Y", t.formatUnit(e.ty, i)), I(r, t.t("property.rotation"), t.formatUnit(e.rotation, "°")), I(r, "Sx", t.formatNumber(e.scaleX)), I(r, "Sy", t.formatNumber(e.scaleY));
2570
2612
  });
2571
2613
  }
2572
- function Hr(s, e, t, i) {
2573
- Ot(s, t.t("property.text"), e.content), Se(s, t.t("property.basic"), (r) => {
2574
- M(r, t.t("property.layer"), e.layerName), M(r, t.t("property.content"), e.content), M(r, t.t("property.height"), t.formatUnit(e.height, i)), M(r, "X", t.formatUnit(e.x, i)), M(r, "Y", t.formatUnit(e.y, i)), M(r, t.t("property.rotation"), t.formatUnit(e.rotation, "°"));
2614
+ function ts(s, e, t, i) {
2615
+ Nt(s, t.t("property.text"), e.content), Se(s, t.t("property.basic"), (r) => {
2616
+ I(r, t.t("property.layer"), e.layerName), I(r, t.t("property.content"), e.content), I(r, t.t("property.height"), t.formatUnit(e.height, i)), I(r, "X", t.formatUnit(e.x, i)), I(r, "Y", t.formatUnit(e.y, i)), I(r, t.t("property.rotation"), t.formatUnit(e.rotation, "°"));
2575
2617
  });
2576
2618
  }
2577
- function Ot(s, e, t) {
2619
+ function Nt(s, e, t) {
2578
2620
  const i = document.createElement("div");
2579
- i.className = "vui-pp-section vui-pp-title-row", i.innerHTML = `<strong>${I(e)}</strong><span>·</span><span>${I(t)}</span>`, s.appendChild(i);
2621
+ i.className = "vui-pp-section vui-pp-title-row", i.innerHTML = `<strong>${M(e)}</strong><span>·</span><span>${M(t)}</span>`, s.appendChild(i);
2580
2622
  }
2581
2623
  function Se(s, e, t) {
2582
2624
  const i = document.createElement("section");
@@ -2584,15 +2626,15 @@ function Se(s, e, t) {
2584
2626
  const r = document.createElement("div");
2585
2627
  r.className = "vui-pp-section-label", r.textContent = e, i.appendChild(r), t(i), s.appendChild(i);
2586
2628
  }
2587
- function M(s, e, t) {
2629
+ function I(s, e, t) {
2588
2630
  const i = document.createElement("div");
2589
- i.className = "vui-pp-row", i.innerHTML = `<span class="label">${I(e)}</span><span class="value" title="${I(t)}">${I(t)}</span>`, s.appendChild(i);
2631
+ i.className = "vui-pp-row", i.innerHTML = `<span class="label">${M(e)}</span><span class="value" title="${M(t)}">${M(t)}</span>`, s.appendChild(i);
2590
2632
  }
2591
- function qr(s) {
2633
+ function is(s) {
2592
2634
  const e = document.createElement("div");
2593
2635
  return e.className = "vui-empty-note", e.textContent = s, e;
2594
2636
  }
2595
- function Je(s) {
2637
+ function tt(s) {
2596
2638
  if (s.querySelector('input:not([type="color"])'))
2597
2639
  throw new Error("Property panel must not contain editable inputs");
2598
2640
  if (s.querySelector('[contenteditable=""], [contenteditable="true"]'))
@@ -2600,17 +2642,17 @@ function Je(s) {
2600
2642
  if (s.querySelector("textarea"))
2601
2643
  throw new Error("Property panel must not contain textarea elements");
2602
2644
  }
2603
- const Yr = typeof requestAnimationFrame == "function" ? requestAnimationFrame.bind(globalThis) : (s) => globalThis.setTimeout(() => s(performance.now()), 16), Xr = typeof cancelAnimationFrame == "function" ? cancelAnimationFrame.bind(globalThis) : (s) => {
2645
+ const rs = typeof requestAnimationFrame == "function" ? requestAnimationFrame.bind(globalThis) : (s) => globalThis.setTimeout(() => s(performance.now()), 16), ss = typeof cancelAnimationFrame == "function" ? cancelAnimationFrame.bind(globalThis) : (s) => {
2604
2646
  globalThis.clearTimeout(s);
2605
2647
  };
2606
- class Wr {
2648
+ class ns {
2607
2649
  constructor(e) {
2608
2650
  u(this, "onFlush");
2609
2651
  u(this, "requestFrame");
2610
2652
  u(this, "cancelFrame");
2611
2653
  u(this, "pending", /* @__PURE__ */ new Map());
2612
2654
  u(this, "scheduledHandle", null);
2613
- this.onFlush = e.onFlush, this.requestFrame = e.requestFrame ?? Yr, this.cancelFrame = e.cancelFrame ?? Xr;
2655
+ this.onFlush = e.onFlush, this.requestFrame = e.requestFrame ?? rs, this.cancelFrame = e.cancelFrame ?? ss;
2614
2656
  }
2615
2657
  enqueue(e, t) {
2616
2658
  this.pending.set(e, t), this.scheduledHandle === null && (this.scheduledHandle = this.requestFrame(() => {
@@ -2634,7 +2676,7 @@ class Wr {
2634
2676
  this.pending.clear(), this.scheduledHandle !== null && (this.cancelFrame(this.scheduledHandle), this.scheduledHandle = null);
2635
2677
  }
2636
2678
  }
2637
- const Gr = `
2679
+ const as = `
2638
2680
  :host {
2639
2681
  display: block;
2640
2682
  width: 100%;
@@ -3504,7 +3546,7 @@ button, input { font: inherit; }
3504
3546
  .vui-infobar-content { max-width: calc(100vw - 48px); }
3505
3547
  .vui-infobar-tools .vui-info-text { max-width: min(180px, 45vw); }
3506
3548
  }
3507
- `, Kr = {
3549
+ `, os = {
3508
3550
  dark: `
3509
3551
  :host, .vui-root[data-theme="dark"] {
3510
3552
  --vui-bg: #0A0B0F;
@@ -3625,13 +3667,13 @@ function fe(s = "dark", e = {}) {
3625
3667
  hudBackground: "--vui-hud-bg"
3626
3668
  }, i = Object.entries(e).filter(([, r]) => typeof r == "string" && r.trim().length > 0).map(([r, n]) => `${t[r]}: ${n};`).join(`
3627
3669
  `);
3628
- return `${Kr[s]}${i ? `
3670
+ return `${os[s]}${i ? `
3629
3671
  :host, .vui-root[data-theme="${s}"] {
3630
3672
  ${i}
3631
3673
  }
3632
- ` : ""}${Gr}`;
3674
+ ` : ""}${as}`;
3633
3675
  }
3634
- const Zr = {
3676
+ const ls = {
3635
3677
  layerPanel: !0,
3636
3678
  propertyPanel: !0,
3637
3679
  hud: !0,
@@ -3641,8 +3683,8 @@ const Zr = {
3641
3683
  infobarLineMode: !0,
3642
3684
  infobarPhase: !0,
3643
3685
  infobarDebug: !0
3644
- }, Qe = "property-panel:open", et = "layer-panel:open", tt = 300, it = 180, Jr = 2;
3645
- let Qr = 0;
3686
+ }, it = "property-panel:open", rt = "layer-panel:open", st = 300, nt = 180, ds = 2;
3687
+ let cs = 0;
3646
3688
  function _(s, ...e) {
3647
3689
  const t = document.createElement("div");
3648
3690
  t.className = "vui-debug-row";
@@ -3651,7 +3693,7 @@ function _(s, ...e) {
3651
3693
  const r = document.createElement("div");
3652
3694
  return r.className = "vui-debug-value", r.append(...e), t.append(i, r), t;
3653
3695
  }
3654
- function rt(s, e, t) {
3696
+ function at(s, e, t) {
3655
3697
  const i = document.createElement("div");
3656
3698
  i.className = "vui-debug-spread";
3657
3699
  const r = document.createElement("b");
@@ -3663,11 +3705,11 @@ function rt(s, e, t) {
3663
3705
  }
3664
3706
  return i;
3665
3707
  }
3666
- function st(s) {
3708
+ function ot(s) {
3667
3709
  const e = document.createElement("div");
3668
3710
  return e.className = "vui-debug-spread-list", e.append(...s), e;
3669
3711
  }
3670
- function es(s, e) {
3712
+ function us(s, e) {
3671
3713
  switch (s) {
3672
3714
  case "created":
3673
3715
  return e.t("status.created");
@@ -3685,7 +3727,7 @@ function es(s, e) {
3685
3727
  return "";
3686
3728
  }
3687
3729
  }
3688
- function nt(s) {
3730
+ function lt(s) {
3689
3731
  return (typeof s.composedPath == "function" ? s.composedPath() : [s.target]).some((t) => {
3690
3732
  var a, o;
3691
3733
  if (!t || typeof t != "object") return !1;
@@ -3695,11 +3737,11 @@ function nt(s) {
3695
3737
  return n === "" || n === "true" || n === "plaintext-only";
3696
3738
  });
3697
3739
  }
3698
- class ts {
3740
+ class hs {
3699
3741
  constructor(e, t) {
3700
3742
  u(this, "parts");
3701
3743
  u(this, "text");
3702
- u(this, "layerPanelState", new kr());
3744
+ u(this, "layerPanelState", new Nr());
3703
3745
  u(this, "shadow", null);
3704
3746
  u(this, "layerPanelRefs", null);
3705
3747
  u(this, "propertyPanelRefs", null);
@@ -3731,32 +3773,32 @@ class ts {
3731
3773
  u(this, "activeLayerColorPreview", null);
3732
3774
  u(this, "renderedLayerRows", null);
3733
3775
  u(this, "handleKeyDown", (e) => {
3734
- if (this.disposed || e.defaultPrevented || e.altKey || e.ctrlKey || e.metaKey || nt(e)) return;
3776
+ if (this.disposed || e.defaultPrevented || e.altKey || e.ctrlKey || e.metaKey || lt(e)) return;
3735
3777
  const t = this.getFitShortcut();
3736
3778
  t && e.key.toLowerCase() === t.toLowerCase() && this.host.fitSelectionOrDocument();
3737
3779
  });
3738
3780
  u(this, "handleKeyboardTargetPointerDown", (e) => {
3739
3781
  var t, i;
3740
- this.disposed || nt(e) || (i = (t = this.keyboardTarget) == null ? void 0 : t.focus) == null || i.call(t, { preventScroll: !0 });
3782
+ this.disposed || lt(e) || (i = (t = this.keyboardTarget) == null ? void 0 : t.focus) == null || i.call(t, { preventScroll: !0 });
3741
3783
  });
3742
3784
  u(this, "unsubscribers", []);
3743
3785
  u(this, "filterCleanup", null);
3744
3786
  u(this, "disposed", !1);
3745
3787
  u(this, "persistenceNamespace");
3746
- u(this, "insertToggleScheduler", new Wr({
3788
+ u(this, "insertToggleScheduler", new ns({
3747
3789
  onFlush: (e) => {
3748
3790
  this.host.cad.blocks.batchToggleInserts(e);
3749
3791
  }
3750
3792
  }));
3751
3793
  u(this, "refresh", () => {
3752
- this.disposed || !this.active || (this.syncToolbarState(), this.renderLayerPanel(), this.propertyPanelRefs && this.parts.propertyPanel && (Ze(this.propertyPanelRefs, this.host.cad.inspector, this.text, this.getCadUnit()), this.syncPropertyPanelSelectionState(), this.syncPropertyPanelPreview()), this.syncHud());
3794
+ this.disposed || !this.active || (this.syncToolbarState(), this.renderLayerPanel(), this.propertyPanelRefs && this.parts.propertyPanel && (et(this.propertyPanelRefs, this.host.cad.inspector, this.text, this.getCadUnit()), this.syncPropertyPanelSelectionState(), this.syncPropertyPanelPreview()), this.syncHud());
3753
3795
  });
3754
3796
  u(this, "syncHud", () => {
3755
3797
  var e;
3756
3798
  if (!(this.disposed || !this.active)) {
3757
3799
  if (this.infobarRefs && this.parts.hud) {
3758
3800
  const t = this.host.cad.hud;
3759
- this.infobarRefs.file.textContent = t.filename ?? "", this.infobarRefs.file.title = t.filename ?? "", this.infobarRefs.file.hidden = !t.filename, this.infobarRefs.zoom.textContent = t.zoomLabel ? this.text.t("toolbar.zoom", { value: t.zoomLabel }) : "", this.infobarRefs.zoom.hidden = !t.zoomLabel, this.infobarRefs.vertices.textContent = t.viewportVertexCount > 0 ? this.text.t("toolbar.vertices", { value: this.text.formatInteger(t.viewportVertexCount) }) : "", this.infobarRefs.vertices.hidden = t.viewportVertexCount <= 0, this.infobarRefs.drawCalls.textContent = t.drawCalls > 0 ? this.text.t("toolbar.drawCalls", { value: this.text.formatInteger(t.drawCalls) }) : "", this.infobarRefs.drawCalls.hidden = t.drawCalls <= 0, this.infobarRefs.lineMode.textContent = this.parts.infobarLineMode && t.lineRenderMode ? this.text.t("toolbar.lineMode", { value: t.lineRenderMode.toUpperCase() }) : "", this.infobarRefs.lineMode.hidden = !this.infobarRefs.lineMode.textContent, this.infobarRefs.phase.textContent = this.parts.infobarPhase ? es(t.phase, this.text) : "", this.infobarRefs.phase.hidden = !this.infobarRefs.phase.textContent;
3801
+ this.infobarRefs.file.textContent = t.filename ?? "", this.infobarRefs.file.title = t.filename ?? "", this.infobarRefs.file.hidden = !t.filename, this.infobarRefs.zoom.textContent = t.zoomLabel ? this.text.t("toolbar.zoom", { value: t.zoomLabel }) : "", this.infobarRefs.zoom.hidden = !t.zoomLabel, this.infobarRefs.vertices.textContent = t.viewportVertexCount > 0 ? this.text.t("toolbar.vertices", { value: this.text.formatInteger(t.viewportVertexCount) }) : "", this.infobarRefs.vertices.hidden = t.viewportVertexCount <= 0, this.infobarRefs.drawCalls.textContent = t.drawCalls > 0 ? this.text.t("toolbar.drawCalls", { value: this.text.formatInteger(t.drawCalls) }) : "", this.infobarRefs.drawCalls.hidden = t.drawCalls <= 0, this.infobarRefs.lineMode.textContent = this.parts.infobarLineMode && t.lineRenderMode ? this.text.t("toolbar.lineMode", { value: t.lineRenderMode.toUpperCase() }) : "", this.infobarRefs.lineMode.hidden = !this.infobarRefs.lineMode.textContent, this.infobarRefs.phase.textContent = this.parts.infobarPhase ? us(t.phase, this.text) : "", this.infobarRefs.phase.hidden = !this.infobarRefs.phase.textContent;
3760
3802
  const i = Math.round(t.fps);
3761
3803
  this.infobarRefs.fps.textContent = i > 0 ? this.text.t("toolbar.fps", { value: i }) : this.text.t("toolbar.fpsEmpty"), this.infobarRefs.fps.classList.toggle("hi", i >= 55), this.infobarRefs.fps.classList.toggle("mid", i >= 30 && i < 55), this.infobarRefs.fps.classList.toggle("low", i < 30);
3762
3804
  const r = t.blockVariantCount > 0 || t.splitBlockLayerGroupCount > 0 || t.entityCount > 0;
@@ -3767,7 +3809,7 @@ class ts {
3767
3809
  blocks: this.text.formatInteger(t.blockVariantCount),
3768
3810
  split: this.text.formatInteger(t.splitBlockLayerGroupCount)
3769
3811
  });
3770
- const n = t.renderDebugBreakdown.map((d) => rt(
3812
+ const n = t.renderDebugBreakdown.map((d) => at(
3771
3813
  d.label,
3772
3814
  this.text.t("toolbar.debug.breakdown", {
3773
3815
  renderables: this.text.formatInteger(d.renderables),
@@ -3779,8 +3821,8 @@ class ts {
3779
3821
  calls: this.text.formatInteger(t.drawCalls)
3780
3822
  })
3781
3823
  ];
3782
- n.length > 0 && a.push(st(n));
3783
- const o = t.splitBlockLayerDetails.map((d) => rt(
3824
+ n.length > 0 && a.push(ot(n));
3825
+ const o = t.splitBlockLayerDetails.map((d) => at(
3784
3826
  `${d.blockName} #${d.variantId}`,
3785
3827
  this.text.t("toolbar.debug.spreadMeta", {
3786
3828
  layers: this.text.formatInteger(d.layerCount),
@@ -3797,7 +3839,7 @@ class ts {
3797
3839
  const l = [this.text.t("toolbar.debug.splitLayerCount", {
3798
3840
  count: this.text.formatInteger(t.splitBlockLayerGroupCount)
3799
3841
  })];
3800
- o.length > 0 && l.push(st(o)), this.infobarRefs.debugBody.replaceChildren(
3842
+ o.length > 0 && l.push(ot(o)), this.infobarRefs.debugBody.replaceChildren(
3801
3843
  _("" + this.text.t("toolbar.debug.submitted"), this.text.formatInteger(t.submittedVertexRefs)),
3802
3844
  ...t.lineRenderMode ? [_(this.text.t("toolbar.debug.lineMode"), t.lineRenderMode.toUpperCase())] : [],
3803
3845
  _(this.text.t("toolbar.debug.layers"), this.text.t("toolbar.debug.layerCount", {
@@ -3817,7 +3859,7 @@ class ts {
3817
3859
  const t = this.host.cad.hud, i = t.fileCount > 0 ? this.text.t("toolbar.layerSummary", {
3818
3860
  visible: this.text.formatInteger(t.visibleLayerCount),
3819
3861
  total: this.text.formatInteger(t.totalLayerCount)
3820
- }) : "", r = Tr(t.statusMessage, this.text);
3862
+ }) : "", r = jr(t.statusMessage, this.text);
3821
3863
  this.toolbarInfoText.textContent = i && r ? `${i} | ${r}` : i || r;
3822
3864
  }
3823
3865
  this.scalebarRefs && (this.host.viewMode === "2d" && ((e = this.host.cad.hud.scaleRuler) != null && e.visible) ? (this.scalebarRefs.scaleBar.hidden = !1, this.scalebarRefs.scaleLabel.textContent = this.text.formatScaleLabel(
@@ -3828,7 +3870,7 @@ class ts {
3828
3870
  }
3829
3871
  });
3830
3872
  var i, r, n, a;
3831
- this.host = e, this.options = t, this.parts = { ...Zr, ...(i = t.cad) == null ? void 0 : i.parts }, this.themeValue = t.theme ?? "dark", this.text = Rt({ ...t, unitFormatter: (r = t.cad) == null ? void 0 : r.unitFormatter }), this.persistenceNamespace = ((a = (n = t.cad) == null ? void 0 : n.persistenceKey) == null ? void 0 : a.trim()) || t.root.id.trim() || `instance-${++Qr}`;
3873
+ this.host = e, this.options = t, this.parts = { ...ls, ...(i = t.cad) == null ? void 0 : i.parts }, this.themeValue = t.theme ?? "dark", this.text = Tt({ ...t, unitFormatter: (r = t.cad) == null ? void 0 : r.unitFormatter }), this.persistenceNamespace = ((a = (n = t.cad) == null ? void 0 : n.persistenceKey) == null ? void 0 : a.trim()) || t.root.id.trim() || `instance-${++cs}`;
3832
3874
  }
3833
3875
  mount() {
3834
3876
  var o, l;
@@ -3914,7 +3956,7 @@ class ts {
3914
3956
  const i = document.createElement("div");
3915
3957
  i.className = "vui-section";
3916
3958
  const r = document.createElement("div");
3917
- r.className = "vui-section-head", r.innerHTML = `<span class="vui-section-title">${I(this.text.t("panel.layers"))}</span><span class="vui-section-count">—</span>`;
3959
+ r.className = "vui-section-head", r.innerHTML = `<span class="vui-section-title">${M(this.text.t("panel.layers"))}</span><span class="vui-section-count">—</span>`;
3918
3960
  const n = document.createElement("div");
3919
3961
  n.className = "vui-section-filter-wrap";
3920
3962
  const a = document.createElement("input");
@@ -3927,9 +3969,9 @@ class ts {
3927
3969
  d.type = "button", d.className = "vui-btn", d.textContent = this.text.t("layer.hideAll"), d.addEventListener("click", () => this.host.cad.layers.hideAll());
3928
3970
  const c = document.createElement("button");
3929
3971
  c.type = "button", c.className = "vui-btn", c.textContent = this.text.t("layer.collapse"), c.title = this.text.t("layer.collapseTitle"), c.addEventListener("click", () => {
3930
- var b;
3931
- const m = (b = this.host.cad.inspector.selection) == null ? void 0 : b.id, v = m ? `${m.layerIndex}:${m.variantId}:${m.instanceId}` : null;
3932
- this.layerPanelState.collapseAll(v), this.refresh();
3972
+ var m;
3973
+ const v = (m = this.host.cad.inspector.selection) == null ? void 0 : m.id, y = v ? `${v.layerIndex}:${v.variantId}:${v.instanceId}` : null;
3974
+ this.layerPanelState.collapseAll(y), this.refresh();
3933
3975
  }), o.append(l, d, c);
3934
3976
  const p = document.createElement("div");
3935
3977
  p.className = "vui-section-list", i.append(r, n, o, p), t.appendChild(i), this.layerPanelRefs = {
@@ -3964,12 +4006,12 @@ class ts {
3964
4006
  const a = document.createElement("span");
3965
4007
  if (a.className = "vui-info-text", this.toolbarInfoText = a, n.appendChild(a), this.parts.fit) {
3966
4008
  this.btnFit = document.createElement("button"), this.btnFit.type = "button", this.btnFit.className = "vui-btn";
3967
- const b = this.getFitShortcut();
3968
- this.btnFit.innerHTML = b ? `${I(this.text.t("toolbar.fit"))} <span class="vui-kbd">${I(b.toUpperCase())}</span>` : I(this.text.t("toolbar.fit")), this.btnFit.addEventListener("click", () => this.host.fitSelectionOrDocument()), n.appendChild(this.btnFit);
4009
+ const m = this.getFitShortcut();
4010
+ this.btnFit.innerHTML = m ? `${M(this.text.t("toolbar.fit"))} <span class="vui-kbd">${M(m.toUpperCase())}</span>` : M(this.text.t("toolbar.fit")), this.btnFit.addEventListener("click", () => this.host.fitSelectionOrDocument()), n.appendChild(this.btnFit);
3969
4011
  }
3970
4012
  if (this.parts.viewMode) {
3971
- const b = document.createElement("div");
3972
- 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), n.appendChild(b);
4013
+ const m = document.createElement("div");
4014
+ m.className = "vui-view-toggle", m.setAttribute("role", "group"), m.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")), m.append(this.btnView2d, this.btnView3d), n.appendChild(m);
3973
4015
  }
3974
4016
  const o = document.createElement("span");
3975
4017
  o.className = "vui-seg";
@@ -3985,10 +4027,10 @@ class ts {
3985
4027
  h.className = "vui-fps";
3986
4028
  const f = document.createElement("details");
3987
4029
  f.className = "vui-debug-card";
3988
- const m = document.createElement("summary");
3989
- m.className = "vui-debug-summary", m.textContent = this.text.t("toolbar.details");
3990
- const v = document.createElement("div");
3991
- return v.className = "vui-debug-body", f.append(m, v), i.append(r, n, o, l, d, c, p, h, f), e.append(t, i), this.infobarRefs = {
4030
+ const v = document.createElement("summary");
4031
+ v.className = "vui-debug-summary", v.textContent = this.text.t("toolbar.details");
4032
+ const y = document.createElement("div");
4033
+ return y.className = "vui-debug-body", f.append(v, y), i.append(r, n, o, l, d, c, p, h, f), e.append(t, i), this.infobarRefs = {
3992
4034
  infobar: e,
3993
4035
  file: r,
3994
4036
  tools: n,
@@ -3999,8 +4041,8 @@ class ts {
3999
4041
  phase: p,
4000
4042
  fps: h,
4001
4043
  debugCard: f,
4002
- debugSummary: m,
4003
- debugBody: v
4044
+ debugSummary: v,
4045
+ debugBody: y
4004
4046
  }, this.infobar = e, this.infobarToggle = t, e;
4005
4047
  }
4006
4048
  buildPropertyPanel() {
@@ -4009,7 +4051,7 @@ class ts {
4009
4051
  const t = document.createElement("div");
4010
4052
  t.className = "vui-property-panel", t.dataset.part = "property-panel";
4011
4053
  const i = document.createElement("div");
4012
- i.className = "vui-pp-head", i.innerHTML = `<span class="vui-pp-title-text">${I(this.text.t("panel.properties"))}</span>`;
4054
+ i.className = "vui-pp-head", i.innerHTML = `<span class="vui-pp-title-text">${M(this.text.t("panel.properties"))}</span>`;
4013
4055
  const r = document.createElement("div");
4014
4056
  r.className = "vui-pp-preview-wrap", r.hidden = !0;
4015
4057
  const n = document.createElement("canvas");
@@ -4022,8 +4064,8 @@ class ts {
4022
4064
  return l.type = "button", l.className = "vui-property-panel-toggle", l.addEventListener("click", () => this.setPropertyPanelOpen(e.classList.contains("closed"))), o.appendChild(l), e.append(o, t), this.propertyPanelShell = e, this.propertyPanelToggle = l, this.propertyPanelRefs = { body: a, previewWrap: r, previewCanvas: n }, e;
4023
4065
  }
4024
4066
  bindEvents() {
4025
- this.layerPanelRefs && (this.filterCleanup = Ur(this.layerPanelRefs.filterInput, (e) => {
4026
- this.layerPanelState.filterText = e, this.layerPanelRefs && Nr(this.layerPanelRefs.list, e);
4067
+ this.layerPanelRefs && (this.filterCleanup = Qr(this.layerPanelRefs.filterInput, (e) => {
4068
+ this.layerPanelState.filterText = e, this.layerPanelRefs && Xr(this.layerPanelRefs.list, e);
4027
4069
  })), this.unsubscribers.push(
4028
4070
  this.host.cad.on("document-change", () => this.refresh()),
4029
4071
  this.host.cad.on("layer-change", () => this.syncLayerChange()),
@@ -4031,9 +4073,9 @@ class ts {
4031
4073
  this.host.cad.on("inspector-change", () => {
4032
4074
  if (this.layerPanelRefs && this.parts.layerPanel) {
4033
4075
  const e = this.host.cad.inspector.selection, t = e == null ? void 0 : e.id, i = t ? `${t.layerIndex}:${t.variantId}:${t.instanceId}` : null;
4034
- i && this.layerPanelState.needsSelectionReveal(i) ? this.renderLayerPanel() : Vr(this.layerPanelRefs.list, e);
4076
+ i && this.layerPanelState.needsSelectionReveal(i) ? this.renderLayerPanel() : Wr(this.layerPanelRefs.list, e);
4035
4077
  }
4036
- this.propertyPanelRefs && this.parts.propertyPanel && (Ze(this.propertyPanelRefs, this.host.cad.inspector, this.text, this.getCadUnit()), this.syncPropertyPanelSelectionState(), this.syncPropertyPanelPreview());
4078
+ this.propertyPanelRefs && this.parts.propertyPanel && (et(this.propertyPanelRefs, this.host.cad.inspector, this.text, this.getCadUnit()), this.syncPropertyPanelSelectionState(), this.syncPropertyPanelPreview());
4037
4079
  }),
4038
4080
  this.host.cad.on("hud-change", () => this.syncHud()),
4039
4081
  this.host.on("view-mode-change", () => {
@@ -4092,7 +4134,7 @@ class ts {
4092
4134
  return !!(e && e.isConnected && ((t = this.layerPanelRefs) != null && t.list.contains(e)));
4093
4135
  }
4094
4136
  renderLayerPanel() {
4095
- !this.layerPanelRefs || !this.parts.layerPanel || ($r(this.layerPanelRefs, this.layerPanelState, this.createLayerPanelActions()), this.renderedLayerRows = this.host.cad.layers.rows);
4137
+ !this.layerPanelRefs || !this.parts.layerPanel || (Kr(this.layerPanelRefs, this.layerPanelState, this.createLayerPanelActions()), this.renderedLayerRows = this.host.cad.layers.rows);
4096
4138
  }
4097
4139
  syncLayerChange() {
4098
4140
  if (!this.isLayerColorPreviewActive()) {
@@ -4100,7 +4142,7 @@ class ts {
4100
4142
  this.refresh();
4101
4143
  return;
4102
4144
  }
4103
- Fr(
4145
+ Gr(
4104
4146
  this.layerPanelRefs.list,
4105
4147
  this.host.cad.layers.rows,
4106
4148
  this.host.cad.layers.allColor,
@@ -4122,7 +4164,7 @@ class ts {
4122
4164
  var e;
4123
4165
  if (((e = this.options.cad) == null ? void 0 : e.persistence) === !1) return !1;
4124
4166
  try {
4125
- return this.readState(Qe) === "1";
4167
+ return this.readState(it) === "1";
4126
4168
  } catch {
4127
4169
  return !1;
4128
4170
  }
@@ -4131,7 +4173,7 @@ class ts {
4131
4173
  var e;
4132
4174
  if (((e = this.options.cad) == null ? void 0 : e.persistence) === !1) return !0;
4133
4175
  try {
4134
- return this.readState(et) !== "0";
4176
+ return this.readState(rt) !== "0";
4135
4177
  } catch {
4136
4178
  return !0;
4137
4179
  }
@@ -4144,7 +4186,7 @@ class ts {
4144
4186
  panel: this.text.t("panel.layers")
4145
4187
  })), !!t && (this.emitUiLayoutChange(), ((n = this.options.cad) == null ? void 0 : n.persistence) !== !1)))
4146
4188
  try {
4147
- this.writeState(et, e ? "1" : "0");
4189
+ this.writeState(rt, e ? "1" : "0");
4148
4190
  } catch {
4149
4191
  }
4150
4192
  }
@@ -4160,7 +4202,7 @@ class ts {
4160
4202
  panel: this.text.t("panel.properties")
4161
4203
  })), (n = i.querySelector(".vui-property-panel")) == null || n.setAttribute("aria-hidden", String(!e)), e ? this.syncPropertyPanelPreview(!0) : (this.cancelPropertyPreviewRender(), this.propertyPanelRefs && H(this.propertyPanelRefs, !1)), !!t && (this.emitUiLayoutChange(), ((a = this.options.cad) == null ? void 0 : a.persistence) !== !1)))
4162
4204
  try {
4163
- this.writeState(Qe, e ? "1" : "0");
4205
+ this.writeState(it, e ? "1" : "0");
4164
4206
  } catch {
4165
4207
  }
4166
4208
  }
@@ -4258,7 +4300,7 @@ class ts {
4258
4300
  return (t = this.propertyPanelShell) != null && t.classList.contains("closed") ? !0 : !this.isPropertyPreviewLayoutReady(e);
4259
4301
  }
4260
4302
  isPropertyPreviewLayoutReady(e) {
4261
- return e.clientWidth >= it && e.clientHeight >= it;
4303
+ return e.clientWidth >= nt && e.clientHeight >= nt;
4262
4304
  }
4263
4305
  waitForPropertyPreviewLayout(e) {
4264
4306
  if (this.isPropertyPreviewLayoutReady(e)) return Promise.resolve();
@@ -4268,37 +4310,37 @@ class ts {
4268
4310
  const l = [], d = [];
4269
4311
  let c = 0;
4270
4312
  const p = () => {
4271
- for (const y of l) window.clearTimeout(y);
4272
- for (const y of d) y();
4273
- window.clearTimeout(b), c !== 0 && cancelAnimationFrame(c), this.propertyPreviewLayoutWaitAbort = null;
4313
+ for (const b of l) window.clearTimeout(b);
4314
+ for (const b of d) b();
4315
+ window.clearTimeout(m), c !== 0 && cancelAnimationFrame(c), this.propertyPreviewLayoutWaitAbort = null;
4274
4316
  }, h = () => {
4275
4317
  n || (n = !0, p(), r());
4276
4318
  }, f = () => {
4277
- const y = e.clientWidth;
4319
+ const b = e.clientWidth;
4278
4320
  if (!this.isPropertyPreviewLayoutReady(e)) {
4279
4321
  a = 0, o = -1;
4280
4322
  return;
4281
4323
  }
4282
- if (y === o) {
4283
- a += 1, a >= Jr && h();
4324
+ if (b === o) {
4325
+ a += 1, a >= ds && h();
4284
4326
  return;
4285
4327
  }
4286
- o = y, a = 0;
4287
- }, m = (y) => {
4288
- if (!is(y)) return;
4328
+ o = b, a = 0;
4329
+ }, v = (b) => {
4330
+ if (!ps(b)) return;
4289
4331
  let g = !1;
4290
- const x = (k) => {
4291
- k.target !== y || k.propertyName !== "width" || w();
4332
+ const x = (C) => {
4333
+ C.target !== b || C.propertyName !== "width" || w();
4292
4334
  }, w = () => {
4293
- g || (g = !0, y.removeEventListener("transitionend", x), requestAnimationFrame(f));
4335
+ g || (g = !0, b.removeEventListener("transitionend", x), requestAnimationFrame(f));
4294
4336
  };
4295
- y.addEventListener("transitionend", x), l.push(window.setTimeout(w, tt)), d.push(() => {
4296
- g || (g = !0, y.removeEventListener("transitionend", x));
4337
+ b.addEventListener("transitionend", x), l.push(window.setTimeout(w, st)), d.push(() => {
4338
+ g || (g = !0, b.removeEventListener("transitionend", x));
4297
4339
  });
4298
- }, v = () => {
4299
- f(), n || (c = requestAnimationFrame(v));
4300
- }, b = window.setTimeout(h, tt);
4301
- m(i), m(t), c = requestAnimationFrame(v), this.propertyPreviewLayoutWaitAbort = () => {
4340
+ }, y = () => {
4341
+ f(), n || (c = requestAnimationFrame(y));
4342
+ }, m = window.setTimeout(h, st);
4343
+ v(i), v(t), c = requestAnimationFrame(y), this.propertyPreviewLayoutWaitAbort = () => {
4302
4344
  n = !0, p();
4303
4345
  };
4304
4346
  });
@@ -4315,7 +4357,7 @@ class ts {
4315
4357
  this.propertyPreviewRenderHandle !== null && (cancelAnimationFrame(this.propertyPreviewRenderHandle), this.propertyPreviewRenderHandle = null), (e = this.propertyPreviewLayoutWaitAbort) == null || e.call(this), this.propertyPreviewLayoutWaitAbort = null;
4316
4358
  }
4317
4359
  }
4318
- function is(s) {
4360
+ function ps(s) {
4319
4361
  const e = getComputedStyle(s), t = e.transitionDuration.split(",").map((r) => r.trim()), i = e.transitionProperty.split(",").map((r) => r.trim());
4320
4362
  for (let r = 0; r < i.length; r += 1) {
4321
4363
  const n = i[r] ?? i[0] ?? "all";
@@ -4324,8 +4366,8 @@ function is(s) {
4324
4366
  }
4325
4367
  return !1;
4326
4368
  }
4327
- const rs = ["left", "right", "top", "bottom"], te = 0.5, ss = /* @__PURE__ */ new Set(["cad", "scene"]);
4328
- class ns {
4369
+ const fs = ["left", "right", "top", "bottom"], te = 0.5, ms = /* @__PURE__ */ new Set(["cad", "scene"]);
4370
+ class vs {
4329
4371
  constructor(e) {
4330
4372
  u(this, "zoneContainers", /* @__PURE__ */ new Map());
4331
4373
  u(this, "mounts", /* @__PURE__ */ new Set());
@@ -4335,7 +4377,7 @@ class ns {
4335
4377
  u(this, "flags", { layerPanelOpen: !1, propertyPanelOpen: !1 });
4336
4378
  u(this, "lastInsets", Object.freeze({ top: 0, right: 0, bottom: 0, left: 0 }));
4337
4379
  u(this, "lastFlags", { layerPanelOpen: !1, propertyPanelOpen: !1 });
4338
- u(this, "activeGroups", ss);
4380
+ u(this, "activeGroups", ms);
4339
4381
  u(this, "warnedUnstableReference", !1);
4340
4382
  u(this, "disposed", !1);
4341
4383
  u(this, "frameHandle", null);
@@ -4345,7 +4387,7 @@ class ns {
4345
4387
  const t = this.canMeasure();
4346
4388
  this.resizeObserver = t && typeof ResizeObserver == "function" ? new ResizeObserver(() => this.schedule()) : null, t && typeof globalThis.window < "u" && globalThis.window.addEventListener("resize", this.handleWindowResize);
4347
4389
  const i = this.host.reference(), r = this.host.target();
4348
- i && O(i) && ((n = this.resizeObserver) == null || n.observe(i)), r && r !== i && O(r) && ((a = this.resizeObserver) == null || a.observe(r));
4390
+ i && z(i) && ((n = this.resizeObserver) == null || n.observe(i)), r && r !== i && z(r) && ((a = this.resizeObserver) == null || a.observe(r));
4349
4391
  }
4350
4392
  mountBuiltin(e, t) {
4351
4393
  return this.mountNode(e, t.zone, !0, t.group);
@@ -4382,7 +4424,7 @@ class ns {
4382
4424
  }
4383
4425
  canMeasure() {
4384
4426
  const e = this.host.reference();
4385
- return !!(e && O(e) && typeof e.getBoundingClientRect == "function");
4427
+ return !!(e && z(e) && typeof e.getBoundingClientRect == "function");
4386
4428
  }
4387
4429
  dispose() {
4388
4430
  var e;
@@ -4399,10 +4441,10 @@ class ns {
4399
4441
  const n = me(t, i, r), a = this.ensureZoneContainer(t, i, r);
4400
4442
  a.append(e);
4401
4443
  const o = { node: e, zone: t, builtin: i, group: r, container: a, key: n };
4402
- return this.mounts.add(o), O(e) && ((l = this.resizeObserver) == null || l.observe(e)), this.schedule(), {
4444
+ return this.mounts.add(o), z(e) && ((l = this.resizeObserver) == null || l.observe(e)), this.schedule(), {
4403
4445
  dispose: () => {
4404
4446
  var d, c;
4405
- this.mounts.delete(o) && (O(e) ? ((d = this.resizeObserver) == null || d.unobserve(e), e.remove()) : e.parentNode === a && a.removeChild(e), this.containerHasMounts(n) || ((c = this.resizeObserver) == null || c.unobserve(a), a.remove(), this.zoneContainers.delete(n)), this.schedule());
4447
+ this.mounts.delete(o) && (z(e) ? ((d = this.resizeObserver) == null || d.unobserve(e), e.remove()) : e.parentNode === a && a.removeChild(e), this.containerHasMounts(n) || ((c = this.resizeObserver) == null || c.unobserve(a), a.remove(), this.zoneContainers.delete(n)), this.schedule());
4406
4448
  }
4407
4449
  };
4408
4450
  }
@@ -4426,7 +4468,7 @@ class ns {
4426
4468
  installZoneStyles(e, t) {
4427
4469
  if (!e || typeof e.querySelector != "function" || typeof e.prepend != "function" || e.querySelector(`style[data-viewer-layout="${t}"]`)) return;
4428
4470
  const i = document.createElement("style");
4429
- i.dataset.viewerLayout = t, i.textContent = ls, e.append(i), this.installedStyles.push(i), O(e) && (e.dataset.viewerLayoutHost = "", typeof getComputedStyle == "function" && getComputedStyle(e).position === "static" && (e.style.position = "relative"));
4471
+ i.dataset.viewerLayout = t, i.textContent = ys, e.append(i), this.installedStyles.push(i), z(e) && (e.dataset.viewerLayoutHost = "", typeof getComputedStyle == "function" && getComputedStyle(e).position === "static" && (e.style.position = "relative"));
4430
4472
  }
4431
4473
  schedule() {
4432
4474
  if (!(this.disposed || this.frameHandle !== null)) {
@@ -4443,7 +4485,7 @@ class ns {
4443
4485
  if (this.disposed) return;
4444
4486
  const e = this.host.reference(), t = this.host.target();
4445
4487
  if (!e || typeof e.getBoundingClientRect != "function") return;
4446
- const i = e.getBoundingClientRect(), r = this.computeInsets(i), n = !os(r, this.lastInsets), a = this.flags.layerPanelOpen !== this.lastFlags.layerPanelOpen || this.flags.propertyPanelOpen !== this.lastFlags.propertyPanelOpen;
4488
+ const i = e.getBoundingClientRect(), r = this.computeInsets(i), n = !bs(r, this.lastInsets), a = this.flags.layerPanelOpen !== this.lastFlags.layerPanelOpen || this.flags.propertyPanelOpen !== this.lastFlags.propertyPanelOpen;
4447
4489
  !n && !a || (this.lastInsets = r, this.lastFlags = { ...this.flags }, n && this.assertStableReference(e, t) && this.applyInsets(t, r), this.host.onChange(r, this.lastFlags));
4448
4490
  }
4449
4491
  applyInsets(e, t) {
@@ -4462,9 +4504,9 @@ class ns {
4462
4504
  }
4463
4505
  for (const i of this.zoneContainers.values()) {
4464
4506
  const r = i.dataset.viewerZone;
4465
- if (!(!r || !rs.includes(r) || !this.isZoneVisible(i)))
4507
+ if (!(!r || !fs.includes(r) || !this.isZoneVisible(i)))
4466
4508
  for (const n of Array.from(i.children)) {
4467
- if (!as(n)) continue;
4509
+ if (!gs(n)) continue;
4468
4510
  const a = n.getBoundingClientRect();
4469
4511
  this.accumulateInset(
4470
4512
  t,
@@ -4494,17 +4536,17 @@ class ns {
4494
4536
  return !t || this.activeGroups.has(t);
4495
4537
  }
4496
4538
  assertStableReference(e, t) {
4497
- return !t || t === e || !O(e) || !O(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);
4539
+ return !t || t === e || !z(e) || !z(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);
4498
4540
  }
4499
4541
  }
4500
4542
  function me(s, e, t) {
4501
4543
  return `${e ? "builtin" : "plugin"}:${t ?? ""}:${s}`;
4502
4544
  }
4503
- function O(s) {
4545
+ function z(s) {
4504
4546
  return !!(s && typeof s == "object" && s.nodeType === 1);
4505
4547
  }
4506
- function as(s) {
4507
- if (!O(s) || s.hidden) return !1;
4548
+ function gs(s) {
4549
+ if (!z(s) || s.hidden) return !1;
4508
4550
  const e = typeof getComputedStyle == "function" ? getComputedStyle(s) : null;
4509
4551
  return !(e && (e.display === "none" || e.visibility === "hidden"));
4510
4552
  }
@@ -4513,10 +4555,10 @@ function ie(s, e) {
4513
4555
  const t = e > 0 ? Math.min(s, e) : s;
4514
4556
  return Math.max(0, Math.round(t * 2) / 2);
4515
4557
  }
4516
- function os(s, e) {
4558
+ function bs(s, e) {
4517
4559
  return Math.abs(s.top - e.top) <= te && Math.abs(s.right - e.right) <= te && Math.abs(s.bottom - e.bottom) <= te && Math.abs(s.left - e.left) <= te;
4518
4560
  }
4519
- const ls = `
4561
+ const ys = `
4520
4562
  [data-viewer-zone] { position: absolute; pointer-events: none; z-index: 1; }
4521
4563
  [data-viewer-zone] > * { pointer-events: auto; }
4522
4564
  [data-viewer-zone="left"] { left: 0; top: 0; bottom: 0; }
@@ -4525,7 +4567,7 @@ const ls = `
4525
4567
  [data-viewer-zone="bottom"] { left: 0; right: 0; bottom: 0; }
4526
4568
  [data-viewer-zone="overlay"] { inset: 0; }
4527
4569
  [data-viewer-zone][data-viewer-zone-active="false"] { display: none; }
4528
- `, ds = {
4570
+ `, xs = {
4529
4571
  play: '<path d="m8 5 11 7-11 7Z"/>',
4530
4572
  pause: '<path d="M8 5v14M16 5v14"/>',
4531
4573
  reset: '<path d="M3 10a9 9 0 1 1 2.5 8M3 4v6h6"/>',
@@ -4539,10 +4581,10 @@ const ls = `
4539
4581
  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"/>',
4540
4582
  moon: '<path d="M20.5 13A9 9 0 0 1 11 3.5 9 9 0 1 0 20.5 13Z"/>'
4541
4583
  };
4542
- function zt(s) {
4543
- 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">${ds[s]}</svg>`;
4584
+ function Ft(s) {
4585
+ 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">${xs[s]}</svg>`;
4544
4586
  }
4545
- const cs = {
4587
+ const ws = {
4546
4588
  filename: !0,
4547
4589
  playback: !0,
4548
4590
  reset: !0,
@@ -4552,75 +4594,75 @@ const cs = {
4552
4594
  collision: !0,
4553
4595
  theme: !0
4554
4596
  };
4555
- function us(s, e) {
4556
- const t = { ...cs, ...e.parts }, i = document.createElement("nav");
4597
+ function Cs(s, e) {
4598
+ const t = { ...ws, ...e.parts }, i = document.createElement("nav");
4557
4599
  i.className = "vpu-toolbar", i.dataset.theme = e.theme ?? "dark", i.setAttribute("aria-label", e.label);
4558
4600
  const r = document.createElement("span");
4559
4601
  r.className = "vpu-filename", r.hidden = !0;
4560
4602
  const n = document.createElement("div");
4561
4603
  n.className = "vpu-actions", i.append(r, n);
4562
4604
  const a = /* @__PURE__ */ new Map();
4563
- let o = null, l = null, d = e.theme ?? "dark", c = null;
4564
- const p = (v, b, y, g, x) => {
4565
- const w = document.createElement("button");
4566
- return w.type = "button", w.className = "vpu-btn", w.dataset.viewerControl = b, w.dataset.viewerControlId = v, w.innerHTML = zt(g), w.title = y, w.setAttribute("aria-label", y), w.addEventListener("click", x), a.set(v, { button: w, icon: g }), n.append(w), w;
4567
- }, h = (v, b) => v ? b === "filename" ? t.filename : b === "playback" ? t.playback && v.canPlay : b === "reset" ? t.reset && v.canReset : b === "fit" ? t.fit : b === "upAxis" ? t.upAxis && v.canReorientUpAxis === !0 : b === "ground" ? t.ground && v.canToggleGround === !0 : b === "collision" ? t.collision && v.canToggleCollision === !0 : t.theme : !1, f = (v) => {
4568
- var y, g, x;
4569
- c = v, n.replaceChildren(), a.clear(), o = null, l = null;
4570
- const b = (v == null ? void 0 : v.capabilities) ?? null;
4571
- if (r.hidden = !(t.filename && (v != null && v.filename)), r.textContent = (v == null ? void 0 : v.filename) ?? "", r.title = (v == null ? void 0 : v.filename) ?? "", v && h(b, "playback")) {
4572
- const w = "playback";
4573
- l = w;
4574
- const k = p(w, "playback", "运行仿真", "play", () => {
4605
+ let o = null, l = null, d = { play: "运行仿真", pause: "暂停仿真", reset: "重置仿真" }, c = e.theme ?? "dark", p = null;
4606
+ const h = (m, b, g, x, w) => {
4607
+ const C = document.createElement("button");
4608
+ return C.type = "button", C.className = "vpu-btn", C.dataset.viewerControl = b, C.dataset.viewerControlId = m, C.innerHTML = Ft(x), C.title = g, C.setAttribute("aria-label", g), C.addEventListener("click", w), a.set(m, { button: C, icon: x }), n.append(C), C;
4609
+ }, f = (m, b) => m ? b === "filename" ? t.filename : b === "playback" ? t.playback && m.canPlay : b === "reset" ? t.reset && m.canReset : b === "fit" ? t.fit : b === "upAxis" ? t.upAxis && m.canReorientUpAxis === !0 : b === "ground" ? t.ground && m.canToggleGround === !0 : b === "collision" ? t.collision && m.canToggleCollision === !0 : t.theme : !1, v = (m) => {
4610
+ var g, x, w;
4611
+ p = m, n.replaceChildren(), a.clear(), o = null, l = null;
4612
+ const b = (m == null ? void 0 : m.capabilities) ?? null;
4613
+ if (d = (b == null ? void 0 : b.hasAnimation) === !0 && b.hasPhysics !== !0 ? { play: "播放动画", pause: "暂停动画", reset: "重置动画" } : { play: "运行仿真", pause: "暂停仿真", reset: "重置仿真" }, r.hidden = !(t.filename && (m != null && m.filename)), r.textContent = (m == null ? void 0 : m.filename) ?? "", r.title = (m == null ? void 0 : m.filename) ?? "", m && f(b, "playback")) {
4614
+ const C = "playback";
4615
+ l = C;
4616
+ const D = h(C, "playback", d.play, "play", () => {
4575
4617
  s.asset.$readControl().playing ? s.commands.pause() : s.commands.play();
4576
4618
  });
4577
- k.className = "vpu-btn vpu-btn-primary";
4619
+ D.className = "vpu-btn vpu-btn-primary";
4578
4620
  }
4579
- if ((v == null ? void 0 : v.kind) === "simulation" && v.phase === "ready" && t.playback && !(b != null && b.canPlay) && (((y = v.physics) == null ? void 0 : y.status) === "unavailable" || !v.physics && ((g = v.warning) == null ? void 0 : g.stage) === "physics-fallback")) {
4580
- const w = ((x = v.physics) == null ? void 0 : x.status) === "unavailable" ? v.physics.issue.message : v.warning.message, k = p("playback", "playback", w, "play", () => {
4621
+ if ((m == null ? void 0 : m.kind) === "simulation" && m.phase === "ready" && t.playback && !(b != null && b.canPlay) && (((g = m.physics) == null ? void 0 : g.status) === "unavailable" || !m.physics && ((x = m.warning) == null ? void 0 : x.stage) === "physics-fallback")) {
4622
+ const C = ((w = m.physics) == null ? void 0 : w.status) === "unavailable" ? m.physics.issue.message : m.warning.message, D = h("playback", "playback", C, "play", () => {
4581
4623
  });
4582
- k.setAttribute("aria-disabled", "true"), k.className = "vpu-btn vpu-btn-primary";
4624
+ D.setAttribute("aria-disabled", "true"), D.className = "vpu-btn vpu-btn-primary";
4583
4625
  }
4584
- if (v && h(b, "reset") && p("reset", "reset", "重置仿真", "reset", () => {
4626
+ if (m && f(b, "reset") && h("reset", "reset", d.reset, "reset", () => {
4585
4627
  s.commands.reset();
4586
- }), v && h(b, "fit") && p("fit", "fit", "视角适应", "fit", () => {
4628
+ }), m && f(b, "fit") && h("fit", "fit", "视角适应", "fit", () => {
4587
4629
  s.commands.fitView();
4588
- }), v && h(b, "upAxis") && (o = "切换上轴", p("upAxis", "upAxis", o, "upAxisZ", () => {
4589
- const w = s.asset.$readControl().upAxis ?? "z";
4590
- s.commands.setUpAxis(w === "z" ? "y" : "z");
4591
- })), v && h(b, "ground") && p("ground", "ground", "显示地面", "ground", () => {
4592
- const w = s.asset.$readControl().groundVisible;
4593
- s.commands.setGroundVisible(!w);
4594
- }), v && h(b, "collision") && p("collision", "collision", "显示碰撞代理", "collision", () => {
4595
- const w = s.asset.$readControl().collisionVisible;
4596
- s.commands.setCollisionVisible(!w);
4597
- }), v && h(b, "theme")) {
4598
- const w = d === "dark";
4599
- p(
4630
+ }), m && f(b, "upAxis") && (o = "切换上轴", h("upAxis", "upAxis", o, "upAxisZ", () => {
4631
+ const C = s.asset.$readControl().upAxis ?? "z";
4632
+ s.commands.setUpAxis(C === "z" ? "y" : "z");
4633
+ })), m && f(b, "ground") && h("ground", "ground", "显示地面", "ground", () => {
4634
+ const C = s.asset.$readControl().groundVisible;
4635
+ s.commands.setGroundVisible(!C);
4636
+ }), m && f(b, "collision") && h("collision", "collision", "显示碰撞代理", "collision", () => {
4637
+ const C = s.asset.$readControl().collisionVisible;
4638
+ s.commands.setCollisionVisible(!C);
4639
+ }), m && f(b, "theme")) {
4640
+ const C = c === "dark";
4641
+ h(
4600
4642
  "theme",
4601
4643
  "theme",
4602
- w ? "切换浅色主题" : "切换深色主题",
4603
- w ? "sun" : "moon",
4604
- () => s.commands.setTheme(d === "dark" ? "light" : "dark")
4644
+ C ? "切换浅色主题" : "切换深色主题",
4645
+ C ? "sun" : "moon",
4646
+ () => s.commands.setTheme(c === "dark" ? "light" : "dark")
4605
4647
  );
4606
4648
  }
4607
- i.hidden = n.childElementCount === 0 && r.hidden, m(s.asset.$readControl());
4608
- }, m = (v) => {
4649
+ i.hidden = n.childElementCount === 0 && r.hidden, y(s.asset.$readControl());
4650
+ }, y = (m) => {
4609
4651
  const b = l ? a.get(l) : void 0;
4610
- b && (re(b.button, v.playing ? "暂停仿真" : "运行仿真", v.playing ? "pause" : "play", v.playing), b.icon = v.playing ? "pause" : "play");
4611
- const y = a.get("ground");
4612
- y && re(y.button, v.groundVisible ? "隐藏地面" : "显示地面", "ground", v.groundVisible);
4613
- const g = a.get("collision");
4614
- g && re(g.button, v.collisionVisible ? "隐藏碰撞代理" : "显示碰撞代理", "collision", v.collisionVisible);
4615
- const x = a.get("upAxis");
4616
- x && re(x.button, ps(v.upAxis), hs(v.upAxis), v.upAxis === "y");
4652
+ b && (re(b.button, m.playing ? d.pause : d.play, m.playing ? "pause" : "play", m.playing), b.icon = m.playing ? "pause" : "play");
4653
+ const g = a.get("ground");
4654
+ g && re(g.button, m.groundVisible ? "隐藏地面" : "显示地面", "ground", m.groundVisible);
4655
+ const x = a.get("collision");
4656
+ x && re(x.button, m.collisionVisible ? "隐藏碰撞代理" : "显示碰撞代理", "collision", m.collisionVisible);
4657
+ const w = a.get("upAxis");
4658
+ w && re(w.button, Es(m.upAxis), Ss(m.upAxis), m.upAxis === "y");
4617
4659
  };
4618
4660
  return {
4619
4661
  element: i,
4620
- update: (v) => f(v),
4621
- pressedChanged: () => m(s.asset.$readControl()),
4622
- themeChanged: (v) => {
4623
- d = v, i.dataset.theme = v, f(c);
4662
+ update: (m) => v(m),
4663
+ pressedChanged: () => y(s.asset.$readControl()),
4664
+ themeChanged: (m) => {
4665
+ c = m, i.dataset.theme = m, v(p);
4624
4666
  },
4625
4667
  dispose: () => {
4626
4668
  i.remove();
@@ -4628,15 +4670,15 @@ function us(s, e) {
4628
4670
  };
4629
4671
  }
4630
4672
  function re(s, e, t, i) {
4631
- s.innerHTML = zt(t), s.title = e, s.setAttribute("aria-label", e), s.setAttribute("aria-pressed", String(i)), s.classList.toggle("is-active", i);
4673
+ s.innerHTML = Ft(t), s.title = e, s.setAttribute("aria-label", e), s.setAttribute("aria-pressed", String(i)), s.classList.toggle("is-active", i);
4632
4674
  }
4633
- function hs(s) {
4675
+ function Ss(s) {
4634
4676
  return s === "y" ? "upAxisY" : "upAxisZ";
4635
4677
  }
4636
- function ps(s) {
4678
+ function Es(s) {
4637
4679
  return s === "y" ? "当前 Y-UP,点击切换为 Z-UP" : "当前 Z-UP,点击切换为 Y-UP";
4638
4680
  }
4639
- class fs {
4681
+ class ks {
4640
4682
  constructor(e = "dark", t) {
4641
4683
  u(this, "root");
4642
4684
  u(this, "title");
@@ -4722,7 +4764,7 @@ class fs {
4722
4764
  this.closeReport(), this.reportLink = null, !this.root.hidden && (this.root.hidden = !0, this.title.textContent = "", this.detail.textContent = "", this.detail.hidden = !0, this.toggle.hidden = !0);
4723
4765
  }
4724
4766
  }
4725
- const ms = `
4767
+ const Ps = `
4726
4768
  .vpu-root {
4727
4769
  position: absolute;
4728
4770
  inset: 0;
@@ -4888,27 +4930,27 @@ const ms = `
4888
4930
  @media (prefers-reduced-motion: reduce) {
4889
4931
  .vpu-status-spinner { animation: none; }
4890
4932
  }
4891
- `, at = "scene";
4892
- function vs(s, e) {
4933
+ `, dt = "scene";
4934
+ function As(s, e) {
4893
4935
  let t = null, i = null, r = null, n = null, a = null, o = null;
4894
4936
  return {
4895
4937
  id: "nebula.ui.scene",
4896
4938
  activate(l) {
4897
4939
  var c, p;
4898
- o = document.createElement("style"), o.dataset.viewerSceneUi = "", o.textContent = ms, (c = s.shadowRoot()) == null || c.append(o), t = us(l, {
4940
+ o = document.createElement("style"), o.dataset.viewerSceneUi = "", o.textContent = Ps, (c = s.shadowRoot()) == null || c.append(o), t = Cs(l, {
4899
4941
  label: e.label("simulation"),
4900
4942
  parts: (p = e.scene) == null ? void 0 : p.parts,
4901
4943
  theme: s.theme()
4902
- }), i = new fs(s.theme(), () => {
4944
+ }), i = new ks(s.theme(), () => {
4903
4945
  var h;
4904
4946
  return ((h = s.getVisualDiagnostics) == null ? void 0 : h.call(s)) ?? null;
4905
- }), r = s.mountBuiltin(t.element, { zone: "overlay", group: at }), n = s.mountBuiltin(i.element, { zone: "overlay", group: at }), a = s.onThemeChange((h) => {
4947
+ }), r = s.mountBuiltin(t.element, { zone: "overlay", group: dt }), n = s.mountBuiltin(i.element, { zone: "overlay", group: dt }), a = s.onThemeChange((h) => {
4906
4948
  t == null || t.themeChanged(h), i == null || i.themeChanged(h);
4907
4949
  });
4908
4950
  const d = () => {
4909
- var m, v, b;
4951
+ var v, y, m;
4910
4952
  const h = l.asset.$read();
4911
- if (((b = (v = (m = l.asset).$inspection) == null ? void 0 : v.call(m)) == null ? void 0 : b.kind) === "urdf") {
4953
+ if (((m = (y = (v = l.asset).$inspection) == null ? void 0 : y.call(v)) == null ? void 0 : m.kind) === "urdf") {
4912
4954
  t && (t.element.hidden = !0), i == null || i.update(null);
4913
4955
  return;
4914
4956
  }
@@ -4927,9 +4969,9 @@ function vs(s, e) {
4927
4969
  }
4928
4970
  };
4929
4971
  }
4930
- class gs {
4972
+ class Ms {
4931
4973
  constructor(e, t, i, r) {
4932
- u(this, "renderer", new ui());
4974
+ u(this, "renderer", new pi());
4933
4975
  u(this, "scene", new we());
4934
4976
  u(this, "labels", []);
4935
4977
  u(this, "frame", null);
@@ -4940,7 +4982,7 @@ class gs {
4940
4982
  if (n.kind !== "link" || n.visualCount === 0) continue;
4941
4983
  const a = e.ownerDocument.createElement("div");
4942
4984
  a.className = "vurdf-name-label", a.textContent = n.name;
4943
- const o = new ci(a);
4985
+ const o = new hi(a);
4944
4986
  this.scene.add(o), this.labels.push({ id: n.id.slice(5), object: o });
4945
4987
  }
4946
4988
  }
@@ -4975,14 +5017,14 @@ class gs {
4975
5017
  this.setVisible(!1), this.disposed = !0, this.scene.clear(), this.labels.length = 0;
4976
5018
  }
4977
5019
  }
4978
- function bs(s) {
4979
- const e = s.clone().invert(), t = [new S(1, 0, 0), new S(0, 1, 0), new S(0, 0, 1)], i = ["#f3656a", "#36c978", "#4789f5"];
5020
+ function Is(s) {
5021
+ const e = s.clone().invert(), t = [new E(1, 0, 0), new E(0, 1, 0), new E(0, 0, 1)], i = ["#f3656a", "#36c978", "#4789f5"];
4980
5022
  return `<svg viewBox="0 0 100 100" role="img" aria-label="世界坐标轴">${t.flatMap((n, a) => [-1, 1].map((o) => ({ p: n.clone().multiplyScalar(o).applyQuaternion(e), i: a, sign: o }))).sort((n, a) => n.p.z - a.p.z).map(({ p: n, i: a, sign: o }) => {
4981
5023
  const l = 50 + n.x * 32, d = 50 - n.y * 32, c = i[a];
4982
5024
  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>` : ""}`;
4983
5025
  }).join("")}</svg>`;
4984
5026
  }
4985
- const ys = {
5027
+ const Rs = {
4986
5028
  structure: '<rect x="9" y="3" width="6" height="5" rx="1"/><rect x="2" y="16" width="6" height="5" rx="1"/><rect x="16" y="16" width="6" height="5" rx="1"/><path d="M12 8v4M5 16v-4h14v4"/>',
4987
5029
  zoomIn: '<circle cx="10" cy="10" r="6"/><path d="m15 15 5 5M7 10h6m-3-3v6"/>',
4988
5030
  zoomOut: '<circle cx="10" cy="10" r="6"/><path d="m15 15 5 5M7 10h6"/>',
@@ -5011,12 +5053,12 @@ const ys = {
5011
5053
  moon: '<path d="M20 15.2A8 8 0 0 1 8.8 4 8.5 8.5 0 1 0 20 15.2Z"/>'
5012
5054
  };
5013
5055
  function R(s) {
5014
- return `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${ys[s]}</svg>`;
5056
+ return `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${Rs[s]}</svg>`;
5015
5057
  }
5016
5058
  function P(s) {
5017
5059
  return s.mode === "kinematic" || s.mode === "dynamics-paused" || s.mode === "dynamics-unavailable";
5018
5060
  }
5019
- function E(s) {
5061
+ function k(s) {
5020
5062
  return String(s ?? "").replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;");
5021
5063
  }
5022
5064
  function ee(s, e = 1 / 0) {
@@ -5024,61 +5066,61 @@ function ee(s, e = 1 / 0) {
5024
5066
  const t = s.controlLimits;
5025
5067
  return t && (Number.isFinite(t.lower) || Number.isFinite(t.upper)) ? { lower: Number.isFinite(t.lower) ? t.lower : -e, upper: Number.isFinite(t.upper) ? t.upper : e } : s.jointType === "continuous" ? { lower: -Math.PI, upper: Math.PI } : { lower: ((i = s.limits) == null ? void 0 : i.lower) ?? -e, upper: ((r = s.limits) == null ? void 0 : r.upper) ?? e };
5026
5068
  }
5027
- function xs(s, e, t, i) {
5069
+ function Ls(s, e, t, i) {
5028
5070
  const r = s.ownerDocument, n = r.defaultView;
5029
5071
  let a = !1, o = 0, l = null, d = null, c = "";
5030
- const p = (C) => C.composedPath().some((A) => A instanceof n.HTMLElement && (A.matches("input,textarea,select") || A.isContentEditable)), h = () => {
5072
+ const p = (S) => S.composedPath().some((A) => A instanceof n.HTMLElement && (A.matches("input,textarea,select") || A.isContentEditable)), h = () => {
5031
5073
  d && (d = null, s.style.cursor = c, s.removeAttribute("data-joint-adjusting"));
5032
- }, f = () => ["kinematic", "dynamics-paused", "dynamics-unavailable"].includes(e.getSnapshot().mode), m = (C) => {
5033
- var Le;
5034
- if (C.code === "Escape") {
5074
+ }, f = () => ["kinematic", "dynamics-paused", "dynamics-unavailable"].includes(e.getSnapshot().mode), v = (S) => {
5075
+ var Te;
5076
+ if (S.code === "Escape") {
5035
5077
  h();
5036
5078
  return;
5037
5079
  }
5038
- if (C.code !== "KeyR" || C.repeat || C.ctrlKey || C.altKey || C.metaKey || p(C) || !a && r.activeElement !== s || !f()) return;
5039
- const A = e.getSnapshot(), L = A.nodes.find((Te) => Te.id === A.selectedEntityId && Te.kind === "joint");
5080
+ if (S.code !== "KeyR" || S.repeat || S.ctrlKey || S.altKey || S.metaKey || p(S) || !a && r.activeElement !== s || !f()) return;
5081
+ const A = e.getSnapshot(), L = A.nodes.find((De) => De.id === A.selectedEntityId && De.kind === "joint");
5040
5082
  if (!(L != null && L.movable) || L.mimic) return;
5041
5083
  t();
5042
- const G = (Le = e.jointWorldFrame) == null ? void 0 : Le.call(e, L.name), K = i == null ? void 0 : i(), Vt = G && K && l !== null ? ws(K, G, s.getBoundingClientRect(), l, o, L.jointType === "prismatic") : 1;
5043
- d = { id: L.id, name: L.name, value: A.jointValues[L.name] ?? 0, sensitivity: L.jointType === "prismatic" ? 1e-3 : 5e-3, ...ee(L), direction: Vt }, c = s.style.cursor, s.style.cursor = "ew-resize", s.setAttribute("data-joint-adjusting", "true"), C.preventDefault();
5044
- }, v = (C) => {
5045
- C.code === "KeyR" && h();
5046
- }, b = (C) => {
5047
- const A = l === null ? 0 : C.clientX - l;
5048
- if (l = C.clientX, o = C.clientY, !(!d || C.pointerType === "touch")) {
5049
- if (!f() || e.getSnapshot().selectedEntityId !== d.id || C.buttons !== 0) {
5084
+ const G = (Te = e.jointWorldFrame) == null ? void 0 : Te.call(e, L.name), K = i == null ? void 0 : i(), $t = G && K && l !== null ? Ts(K, G, s.getBoundingClientRect(), l, o, L.jointType === "prismatic") : 1;
5085
+ d = { id: L.id, name: L.name, value: A.jointValues[L.name] ?? 0, sensitivity: L.jointType === "prismatic" ? 1e-3 : 5e-3, ...ee(L), direction: $t }, c = s.style.cursor, s.style.cursor = "ew-resize", s.setAttribute("data-joint-adjusting", "true"), S.preventDefault();
5086
+ }, y = (S) => {
5087
+ S.code === "KeyR" && h();
5088
+ }, m = (S) => {
5089
+ const A = l === null ? 0 : S.clientX - l;
5090
+ if (l = S.clientX, o = S.clientY, !(!d || S.pointerType === "touch")) {
5091
+ if (!f() || e.getSnapshot().selectedEntityId !== d.id || S.buttons !== 0) {
5050
5092
  h();
5051
5093
  return;
5052
5094
  }
5053
- A && (d.value = Math.max(d.lower, Math.min(d.upper, d.value + A * d.direction * d.sensitivity)), e.setJointValue(d.name, d.value), C.preventDefault(), C.stopImmediatePropagation());
5095
+ A && (d.value = Math.max(d.lower, Math.min(d.upper, d.value + A * d.direction * d.sensitivity)), e.setJointValue(d.name, d.value), S.preventDefault(), S.stopImmediatePropagation());
5054
5096
  }
5055
- }, y = (C) => {
5056
- a = !0, l = C.clientX, o = C.clientY;
5097
+ }, b = (S) => {
5098
+ a = !0, l = S.clientX, o = S.clientY;
5057
5099
  }, g = () => {
5058
5100
  a = !1, l = null, h();
5059
- }, x = (C) => {
5060
- d && (C.preventDefault(), C.stopImmediatePropagation());
5061
- }, w = (C) => {
5062
- C.composedPath()[0] !== s && h();
5063
- }, k = () => {
5101
+ }, x = (S) => {
5102
+ d && (S.preventDefault(), S.stopImmediatePropagation());
5103
+ }, w = (S) => {
5104
+ S.composedPath()[0] !== s && h();
5105
+ }, C = () => {
5064
5106
  r.hidden && h();
5065
- }, F = e.subscribe((C) => {
5066
- d && (!f() || C.selectedEntityId !== d.id) && h();
5107
+ }, D = e.subscribe((S) => {
5108
+ d && (!f() || S.selectedEntityId !== d.id) && h();
5067
5109
  });
5068
- return s.addEventListener("pointerenter", y), s.addEventListener("pointerleave", g), s.addEventListener("pointermove", b, !0), s.addEventListener("pointerdown", x, !0), r.addEventListener("keydown", m), r.addEventListener("keyup", v), r.addEventListener("focusin", w), r.addEventListener("visibilitychange", k), n.addEventListener("blur", g), () => {
5069
- h(), F(), s.removeEventListener("pointerenter", y), s.removeEventListener("pointerleave", g), s.removeEventListener("pointermove", b, !0), s.removeEventListener("pointerdown", x, !0), r.removeEventListener("keydown", m), r.removeEventListener("keyup", v), r.removeEventListener("focusin", w), r.removeEventListener("visibilitychange", k), n.removeEventListener("blur", g);
5110
+ return s.addEventListener("pointerenter", b), s.addEventListener("pointerleave", g), s.addEventListener("pointermove", m, !0), s.addEventListener("pointerdown", x, !0), r.addEventListener("keydown", v), r.addEventListener("keyup", y), r.addEventListener("focusin", w), r.addEventListener("visibilitychange", C), n.addEventListener("blur", g), () => {
5111
+ h(), D(), s.removeEventListener("pointerenter", b), s.removeEventListener("pointerleave", g), s.removeEventListener("pointermove", m, !0), s.removeEventListener("pointerdown", x, !0), r.removeEventListener("keydown", v), r.removeEventListener("keyup", y), r.removeEventListener("focusin", w), r.removeEventListener("visibilitychange", C), n.removeEventListener("blur", g);
5070
5112
  };
5071
5113
  }
5072
- function ws(s, e, t, i, r, n) {
5114
+ function Ts(s, e, t, i, r, n) {
5073
5115
  if (t.width <= 0 || t.height <= 0 || e.axis.lengthSq() < 1e-12) return 1;
5074
5116
  s.updateMatrixWorld(!0);
5075
- const a = e.axis.clone().normalize(), o = s.getWorldDirection(new S()), l = new S(1, 0, 0).transformDirection(s.matrixWorld), d = new S(0, 1, 0).transformDirection(s.matrixWorld);
5117
+ const a = e.axis.clone().normalize(), o = s.getWorldDirection(new E()), l = new E(1, 0, 0).transformDirection(s.matrixWorld), d = new E(0, 1, 0).transformDirection(s.matrixWorld);
5076
5118
  let c = a.clone();
5077
5119
  if (!n) {
5078
- const f = new wt();
5120
+ const f = new Et();
5079
5121
  f.setFromCamera(new oe((i - t.left) / t.width * 2 - 1, 1 - (r - t.top) / t.height * 2), s);
5080
- const m = f.ray.intersectPlane(new Ct().setFromNormalAndCoplanarPoint(o, e.position), new S()), v = m ? m.sub(e.position) : new S();
5081
- c = a.clone().cross(v), Math.abs(c.dot(l)) <= Math.max(v.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())));
5122
+ const v = f.ray.intersectPlane(new kt().setFromNormalAndCoplanarPoint(o, e.position), new E()), y = v ? v.sub(e.position) : new E();
5123
+ c = a.clone().cross(y), Math.abs(c.dot(l)) <= Math.max(y.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())));
5082
5124
  }
5083
5125
  const p = c.dot(l);
5084
5126
  if (Math.abs(p) > 0.05 * Math.max(c.length(), 1e-9)) return p >= 0 ? 1 : -1;
@@ -5088,7 +5130,7 @@ function ws(s, e, t, i, r, n) {
5088
5130
  function W(s, e, t) {
5089
5131
  return s.jointType === "prismatic" ? `${e.toFixed(3)} m` : t === "rad" ? `${e.toFixed(3)} rad` : `${(e * 180 / Math.PI).toFixed(1)}°`;
5090
5132
  }
5091
- function Cs(s, e) {
5133
+ function Ds(s, e) {
5092
5134
  return s.jointType !== "prismatic" && e === "deg" ? 180 / Math.PI : 1;
5093
5135
  }
5094
5136
  function ue(s, e) {
@@ -5102,21 +5144,21 @@ function ue(s, e) {
5102
5144
  return s;
5103
5145
  }
5104
5146
  function Ee(s, e, t, i = !1) {
5105
- const { lower: r, upper: n } = ee(s, Math.PI), a = e.jointValues[s.name] ?? 0, o = Cs(s, t);
5106
- return `<div class="vurdf-slider-card ${e.selectedEntityId === s.id ? "is-selected" : ""}" data-joint-card="${E(s.id)}" tabindex="0" role="group" aria-label="${E(s.name)},点击选中关节">
5107
- <div class="vurdf-slider-heading"><button class="vurdf-text-btn" data-entity="${E(s.id)}">${E(s.name)}</button><output data-joint-readout="${E(s.name)}">${W(s, a, t)}</output></div>
5108
- <small>${i ? "联动控制 · " : ""}${E(s.parentLink)} → ${E(s.childLink)}</small>
5109
- <input type="range" aria-label="${E(s.name)}${i ? " 联动控制" : " 位置"}" data-control-joint="${E(s.name)}" data-display-factor="${o}" min="${r * o}" max="${n * o}" step="any" value="${a * o}" ${!P(e) || s.mimic ? "disabled" : ""}>
5110
- ${s.mimic ? `<small>跟随 ${E(s.mimic.joint)} × ${s.mimic.multiplier} + ${W(s, s.mimic.offset, t)}</small>` : ""}
5147
+ const { lower: r, upper: n } = ee(s, Math.PI), a = e.jointValues[s.name] ?? 0, o = Ds(s, t);
5148
+ return `<div class="vurdf-slider-card ${e.selectedEntityId === s.id ? "is-selected" : ""}" data-joint-card="${k(s.id)}" tabindex="0" role="group" aria-label="${k(s.name)},点击选中关节">
5149
+ <div class="vurdf-slider-heading"><button class="vurdf-text-btn" data-entity="${k(s.id)}">${k(s.name)}</button><output data-joint-readout="${k(s.name)}">${W(s, a, t)}</output></div>
5150
+ <small>${i ? "联动控制 · " : ""}${k(s.parentLink)} → ${k(s.childLink)}</small>
5151
+ <input type="range" aria-label="${k(s.name)}${i ? " 联动控制" : " 位置"}" data-control-joint="${k(s.name)}" data-display-factor="${o}" min="${r * o}" max="${n * o}" step="any" value="${a * o}" ${!P(e) || s.mimic ? "disabled" : ""}>
5152
+ ${s.mimic ? `<small>跟随 ${k(s.mimic.joint)} × ${s.mimic.multiplier} + ${W(s, s.mimic.offset, t)}</small>` : ""}
5111
5153
  </div>`;
5112
5154
  }
5113
- function ot(s, e, t) {
5155
+ function ct(s, e, t) {
5114
5156
  const i = e.nodes.filter((o) => o.kind === "joint"), r = s.kind === "joint" ? s : i.find((o) => o.childLink === s.name);
5115
5157
  if (!r) return "";
5116
5158
  const n = ue(r, i), a = i.filter((o) => o.mimic && ue(o, i).name === n.name);
5117
- return a.length ? `<section class="vurdf-section"><div class="vurdf-section-head"><strong>联动约束 · ${a.length + 1} 个关节</strong></div>${Ee(n, e, t, !0)}<p class="vurdf-control-hint">${a.map((o) => E(o.name)).join(" · ")}</p></section>` : "";
5159
+ return a.length ? `<section class="vurdf-section"><div class="vurdf-section-head"><strong>联动约束 · ${a.length + 1} 个关节</strong></div>${Ee(n, e, t, !0)}<p class="vurdf-control-hint">${a.map((o) => k(o.name)).join(" · ")}</p></section>` : "";
5118
5160
  }
5119
- function Ss(s, e, t) {
5161
+ function Os(s, e, t) {
5120
5162
  const i = s.nodes.filter((c) => c.kind === "joint"), r = /* @__PURE__ */ new Map();
5121
5163
  for (const c of i) r.set(c.parentLink, [...r.get(c.parentLink) ?? [], c]);
5122
5164
  const n = new Set(i.map((c) => c.childLink)), a = /* @__PURE__ */ new Set(), o = [], l = (c) => {
@@ -5127,7 +5169,7 @@ function Ss(s, e, t) {
5127
5169
  const f = r.get(h.childLink) ?? [];
5128
5170
  if (f.length !== 1) {
5129
5171
  p.length && o.push(p);
5130
- for (const m of f) l(m);
5172
+ for (const v of f) l(v);
5131
5173
  return;
5132
5174
  }
5133
5175
  h = f[0];
@@ -5139,13 +5181,13 @@ function Ss(s, e, t) {
5139
5181
  const d = e.trim().toLowerCase();
5140
5182
  return o.filter((c) => c.some((p) => `${p.name} ${p.parentLink} ${p.childLink}`.toLowerCase().includes(d))).map((c) => {
5141
5183
  const p = [...new Set(c.map((h) => ue(h, i)))].filter((h) => i.some((f) => f.mimic && ue(f, i).name === h.name));
5142
- return `<section class="vurdf-joint-group"><h3>${E(c[0].parentLink)} → ${E(c[c.length - 1].childLink)}</h3>${p.filter((h) => !c.includes(h)).map((h) => Ee(h, s, t, !0)).join("")}${c.map((h) => Ee(h, s, t, p.includes(h))).join("")}</section>`;
5184
+ return `<section class="vurdf-joint-group"><h3>${k(c[0].parentLink)} → ${k(c[c.length - 1].childLink)}</h3>${p.filter((h) => !c.includes(h)).map((h) => Ee(h, s, t, !0)).join("")}${c.map((h) => Ee(h, s, t, p.includes(h))).join("")}</section>`;
5143
5185
  }).join("") || '<div class="vurdf-empty">没有符合筛选条件的可动关节。</div>';
5144
5186
  }
5145
- function Es(s) {
5187
+ function zs(s) {
5146
5188
  return `<button class="vurdf-tool" data-angle-unit aria-label="切换弧度和角度" title="切换所有关节的显示单位" aria-pressed="${s === "deg"}">${R("angleUnit")}<span>${s === "rad" ? "rad" : "°"}</span></button>`;
5147
5189
  }
5148
- class ks {
5190
+ class Ns {
5149
5191
  constructor(e, t, i) {
5150
5192
  u(this, "element", document.createElement("aside"));
5151
5193
  u(this, "root", document.createElement("div"));
@@ -5174,9 +5216,9 @@ class ks {
5174
5216
  const t = new Set(e.issues.map((d) => d.entityId)), i = this.root.querySelector(".vurdf-tree"), r = { top: (i == null ? void 0 : i.scrollTop) ?? 0, left: (i == null ? void 0 : i.scrollLeft) ?? 0 }, n = this.root.getRootNode().activeElement, a = n && (i != null && i.contains(n)) ? n.dataset.entity : void 0;
5175
5217
  this.root.innerHTML = `
5176
5218
  <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="打开结构图">${R("structure")}</button></div>
5177
- <label class="vurdf-search">${R("search")}<input aria-label="搜索模型结构" placeholder="搜索 Link 或 Joint" value="${E(this.query)}"></label>
5219
+ <label class="vurdf-search">${R("search")}<input aria-label="搜索模型结构" placeholder="搜索 Link 或 Joint" value="${k(this.query)}"></label>
5178
5220
  <div class="vurdf-filters">${ve("all", "全部", this.filter)}${ve("movable", "可动关节", this.filter)}${ve("errors", `错误 ${e.issues.length}`, this.filter)}</div>
5179
- <div class="vurdf-tree" role="${this.filter === "movable" ? "region" : "tree"}">${this.filter === "movable" ? Ss(e, this.query, this.angleUnit) : Ps(e, t, this.filter, this.query, this.collapsed, this.angleUnit)}</div>
5221
+ <div class="vurdf-tree" role="${this.filter === "movable" ? "region" : "tree"}">${this.filter === "movable" ? Os(e, this.query, this.angleUnit) : Fs(e, t, this.filter, this.query, this.collapsed, this.angleUnit)}</div>
5180
5222
  `, this.bind(e), this.setDiagramOpen(this.diagramOpen);
5181
5223
  const o = this.root.querySelector(".vurdf-tree");
5182
5224
  o && (o.scrollTop = r.top, o.scrollLeft = r.left, a && ((l = Array.from(o.querySelectorAll("[data-entity]")).find((d) => d.dataset.entity === a)) == null || l.focus({ preventScroll: !0 })));
@@ -5262,33 +5304,33 @@ class ks {
5262
5304
  });
5263
5305
  }
5264
5306
  }
5265
- function Ps(s, e, t, i, r, n) {
5307
+ function Fs(s, e, t, i, r, n) {
5266
5308
  const a = new Map(s.nodes.map((p) => [p.id, p])), o = i.trim().toLowerCase(), l = o.length > 0 || t !== "all", d = (p) => {
5267
5309
  const h = !o || p.name.toLowerCase().includes(o), f = t === "all" || t === "movable" && p.kind === "joint" && p.movable || t === "errors" && e.has(p.id);
5268
5310
  return h && f;
5269
5311
  }, c = (p, h, f = /* @__PURE__ */ new Set()) => {
5270
5312
  if (f.has(p)) return { html: "", matched: !1 };
5271
- const m = a.get(p);
5272
- if (!m) return { html: "", matched: !1 };
5273
- const v = new Set(f).add(p), b = m.childIds.map((C) => c(C, h + 1, v));
5274
- if (!(d(m) || b.some((C) => C.matched))) return { html: "", matched: !1 };
5275
- const g = b.some((C) => C.matched), x = !l && r.has(m.id), w = m.kind === "joint" ? m.jointType : m.kind, k = m.kind === "joint" && m.movable ? `${W(m, s.jointValues[m.name] ?? 0, n)}` : "", F = `<div class="vurdf-tree-item" style="--depth:${h}" role="treeitem" aria-expanded="${g ? String(!x) : "false"}">
5276
- <button class="vurdf-tree-toggle ${g ? "" : "is-placeholder"} ${x ? "" : "is-open"}" data-tree-toggle="${E(m.id)}" ${g ? "" : "disabled"} aria-label="${x ? "展开" : "折叠"} ${E(m.name)}">${R("chevron")}</button>
5277
- <button class="vurdf-row ${s.selectedEntityId === m.id ? "is-selected" : ""} ${e.has(m.id) ? "has-error" : ""}" data-entity="${E(m.id)}">
5278
- ${R(m.kind === "robot" ? "robot" : m.kind === "joint" ? "joint" : "link")}
5279
- <span class="vurdf-node-copy"><b title="${E(m.name)}">${E(m.name)}</b><small>${E(w)}</small></span>
5280
- ${e.has(m.id) ? '<span class="vurdf-node-error">!</span>' : `<span class="vurdf-node-value" ${m.kind === "joint" ? `data-joint-readout="${E(m.name)}"` : ""}>${k}</span>`}
5313
+ const v = a.get(p);
5314
+ if (!v) return { html: "", matched: !1 };
5315
+ const y = new Set(f).add(p), m = v.childIds.map((S) => c(S, h + 1, y));
5316
+ if (!(d(v) || m.some((S) => S.matched))) return { html: "", matched: !1 };
5317
+ const g = m.some((S) => S.matched), x = !l && r.has(v.id), w = v.kind === "joint" ? v.jointType : v.kind, C = v.kind === "joint" && v.movable ? `${W(v, s.jointValues[v.name] ?? 0, n)}` : "", D = `<div class="vurdf-tree-item" style="--depth:${h}" role="treeitem" aria-expanded="${g ? String(!x) : "false"}">
5318
+ <button class="vurdf-tree-toggle ${g ? "" : "is-placeholder"} ${x ? "" : "is-open"}" data-tree-toggle="${k(v.id)}" ${g ? "" : "disabled"} aria-label="${x ? "展开" : "折叠"} ${k(v.name)}">${R("chevron")}</button>
5319
+ <button class="vurdf-row ${s.selectedEntityId === v.id ? "is-selected" : ""} ${e.has(v.id) ? "has-error" : ""}" data-entity="${k(v.id)}">
5320
+ ${R(v.kind === "robot" ? "robot" : v.kind === "joint" ? "joint" : "link")}
5321
+ <span class="vurdf-node-copy"><b title="${k(v.name)}">${k(v.name)}</b><small>${k(w)}</small></span>
5322
+ ${e.has(v.id) ? '<span class="vurdf-node-error">!</span>' : `<span class="vurdf-node-value" ${v.kind === "joint" ? `data-joint-readout="${k(v.name)}"` : ""}>${C}</span>`}
5281
5323
  </button>
5282
5324
  </div>`;
5283
- return { html: `<div class="vurdf-branch ${x ? "is-collapsed" : ""}">${F}<div class="vurdf-children" ${x ? "inert" : ""}><div>${b.map((C) => C.html).join("")}</div></div></div>`, matched: !0 };
5325
+ return { html: `<div class="vurdf-branch ${x ? "is-collapsed" : ""}">${D}<div class="vurdf-children" ${x ? "inert" : ""}><div>${m.map((S) => S.html).join("")}</div></div></div>`, matched: !0 };
5284
5326
  };
5285
5327
  return c(s.rootEntityId, 0).html || '<div class="vurdf-empty">没有符合筛选条件的节点。</div>';
5286
5328
  }
5287
5329
  function ve(s, e, t) {
5288
5330
  return `<button class="vurdf-chip ${s === t ? "is-active" : ""}" data-filter="${s}">${e}</button>`;
5289
5331
  }
5290
- const As = 1800;
5291
- class Is {
5332
+ const Vs = 1800;
5333
+ class $s {
5292
5334
  constructor(e) {
5293
5335
  u(this, "element", document.createElement("aside"));
5294
5336
  u(this, "root", document.createElement("div"));
@@ -5326,9 +5368,9 @@ class Is {
5326
5368
  a.open ? this.expandedInertia.add(o) : this.expandedInertia.delete(o);
5327
5369
  }), this.root.innerHTML = `
5328
5370
  <nav class="vurdf-tabs">${ge("properties", "属性", this.tab)}${ge("source", "XML", this.tab)}${ge("issues", `错误${e.issues.length ? ` <em>${e.issues.length}</em>` : ""}`, this.tab)}</nav>
5329
- <section class="vurdf-pane ${this.tab === "properties" ? "is-active" : ""}" data-pane="properties">${t ? Ms(t, e, ((i = this.sweep) == null ? void 0 : i.jointName) === t.name, this.angleUnit, this.expandedInertia) : Ts()}</section>
5330
- <section class="vurdf-pane ${this.tab === "source" ? "is-active" : ""}" data-pane="source">${this.tab === "source" ? Rs(e, t) : ""}</section>
5331
- <section class="vurdf-pane ${this.tab === "issues" ? "is-active" : ""}" data-pane="issues">${Ls(e)}</section>
5371
+ <section class="vurdf-pane ${this.tab === "properties" ? "is-active" : ""}" data-pane="properties">${t ? Bs(t, e, ((i = this.sweep) == null ? void 0 : i.jointName) === t.name, this.angleUnit, this.expandedInertia) : js()}</section>
5372
+ <section class="vurdf-pane ${this.tab === "source" ? "is-active" : ""}" data-pane="source">${this.tab === "source" ? _s(e, t) : ""}</section>
5373
+ <section class="vurdf-pane ${this.tab === "issues" ? "is-active" : ""}" data-pane="issues">${Us(e)}</section>
5332
5374
  `, this.bind(e), this.tab === "source" && ((n = (r = this.root.querySelector(".vurdf-source .line.is-selected")) == null ? void 0 : r.scrollIntoView) == null || n.call(r, { block: "center" }));
5333
5375
  }
5334
5376
  dispose() {
@@ -5342,10 +5384,10 @@ class Is {
5342
5384
  const f = () => {
5343
5385
  P(this.inspection.getSnapshot()) && this.inspection.select(h.dataset.jointCard);
5344
5386
  };
5345
- h.addEventListener("click", (m) => {
5346
- m.target.closest("input,button,select,textarea,a") || f();
5347
- }), h.addEventListener("keydown", (m) => {
5348
- m.target !== h || !["Enter", " "].includes(m.key) || (m.preventDefault(), f());
5387
+ h.addEventListener("click", (v) => {
5388
+ v.target.closest("input,button,select,textarea,a") || f();
5389
+ }), h.addEventListener("keydown", (v) => {
5390
+ v.target !== h || !["Enter", " "].includes(v.key) || (v.preventDefault(), f());
5349
5391
  });
5350
5392
  }), this.bindListSliders(e), this.root.querySelectorAll("[data-inertia-details]").forEach((h) => h.addEventListener("toggle", () => {
5351
5393
  if (!h.isConnected) return;
@@ -5354,9 +5396,9 @@ class Is {
5354
5396
  })), this.root.querySelectorAll("[data-copy-number]").forEach((h) => h.addEventListener("click", async () => {
5355
5397
  var f;
5356
5398
  try {
5357
- const m = (f = this.root.ownerDocument.defaultView) == null ? void 0 : f.navigator.clipboard;
5358
- if (!m) throw new Error("Clipboard unavailable");
5359
- await m.writeText(h.dataset.copyNumber), h.title = "已复制完整数值";
5399
+ const v = (f = this.root.ownerDocument.defaultView) == null ? void 0 : f.navigator.clipboard;
5400
+ if (!v) throw new Error("Clipboard unavailable");
5401
+ await v.writeText(h.dataset.copyNumber), h.title = "已复制完整数值";
5360
5402
  } catch {
5361
5403
  h.title = `${h.dataset.copyNumber} · 无法访问剪贴板,请从 XML 复制`;
5362
5404
  }
@@ -5385,13 +5427,13 @@ class Is {
5385
5427
  const f = Number(h.target.value) / i;
5386
5428
  this.syncJointInputs(f), r(f);
5387
5429
  }), n == null || n.addEventListener("change", a), n == null || n.addEventListener("pointerup", a), n == null || n.addEventListener("pointercancel", a), (d = this.root.querySelector("[data-joint-number]")) == null || d.addEventListener("change", (h) => {
5388
- const m = h.target.valueAsNumber / i;
5389
- if (!Number.isFinite(m)) {
5430
+ const v = h.target.valueAsNumber / i;
5431
+ if (!Number.isFinite(v)) {
5390
5432
  this.syncJointInputs(this.inspection.getSnapshot().jointValues[t.name] ?? 0);
5391
5433
  return;
5392
5434
  }
5393
- const { lower: v, upper: b } = ee(t);
5394
- r(Math.max(v, Math.min(b, m)));
5435
+ const { lower: y, upper: m } = ee(t);
5436
+ r(Math.max(y, Math.min(m, v)));
5395
5437
  }), this.root.querySelectorAll("[data-joint-value]").forEach((h) => h.addEventListener("click", () => r(Number(h.dataset.jointValue)))), (c = this.root.querySelector("[data-reset-joint]")) == null || c.addEventListener("click", () => {
5396
5438
  P(this.inspection.getSnapshot()) && (this.stopSweep(!1), this.inspection.resetJoint(t.name));
5397
5439
  }), (p = this.root.querySelector("[data-sweep-joint]")) == null || p.addEventListener("click", () => {
@@ -5438,7 +5480,7 @@ class Is {
5438
5480
  const { lower: i, upper: r } = ee(e, Math.PI), n = () => {
5439
5481
  const a = this.sweep;
5440
5482
  if (!a || a.jointName !== e.name || this.disposed || !P(this.inspection.getSnapshot())) return;
5441
- const o = Math.min(1, (Date.now() - a.startedAt) / As), l = o < 0.5 ? o * 2 : (1 - o) * 2;
5483
+ const o = Math.min(1, (Date.now() - a.startedAt) / Vs), l = o < 0.5 ? o * 2 : (1 - o) * 2;
5442
5484
  if (this.inspection.setJointValue(e.name, i + (r - i) * l), o >= 1) {
5443
5485
  const d = a.initial;
5444
5486
  this.sweep = null, this.inspection.setJointValue(e.name, d);
@@ -5453,35 +5495,35 @@ class Is {
5453
5495
  t && (t.timer !== null && clearTimeout(t.timer), this.sweep = null, e && !this.disposed && this.inspection.setJointValue(t.jointName, t.initial));
5454
5496
  }
5455
5497
  }
5456
- function Ms(s, e, t, i, r) {
5498
+ function Bs(s, e, t, i, r) {
5457
5499
  var n, a;
5458
5500
  if (s.kind === "joint") {
5459
- const o = e.nodes.find((v) => v.kind === "link" && v.id === `link:${s.childLink}`), l = e.jointValues[s.name] ?? 0, { lower: d, upper: c } = ee(s, Math.PI), p = Pe(s, i), h = s.jointType === "prismatic" ? "m" : i === "deg" ? "°" : "rad", f = `<span class="vurdf-unit-label">${h}</span>`, m = s.mimic ? `<section class="vurdf-section vurdf-follower"><div class="vurdf-section-head"><strong>从属关节</strong>${f}<span class="vurdf-readonly-badge">只读 · 自动跟随</span></div><output class="vurdf-follower-value" data-joint-readout="${E(s.name)}">${W(s, l, i)}</output><div class="vurdf-follower-source"><span>主控关节</span><button class="vurdf-text-btn" data-entity="joint:${E(s.mimic.joint)}">${E(s.mimic.joint)}</button></div></section>` : s.movable ? `<fieldset class="vurdf-section vurdf-joint-controls" ${P(e) ? "" : "disabled"}>
5501
+ const o = e.nodes.find((y) => y.kind === "link" && y.id === `link:${s.childLink}`), l = e.jointValues[s.name] ?? 0, { lower: d, upper: c } = ee(s, Math.PI), p = Pe(s, i), h = s.jointType === "prismatic" ? "m" : i === "deg" ? "°" : "rad", f = `<span class="vurdf-unit-label">${h}</span>`, v = s.mimic ? `<section class="vurdf-section vurdf-follower"><div class="vurdf-section-head"><strong>从属关节</strong>${f}<span class="vurdf-readonly-badge">只读 · 自动跟随</span></div><output class="vurdf-follower-value" data-joint-readout="${k(s.name)}">${W(s, l, i)}</output><div class="vurdf-follower-source"><span>主控关节</span><button class="vurdf-text-btn" data-entity="joint:${k(s.mimic.joint)}">${k(s.mimic.joint)}</button></div></section>` : s.movable ? `<fieldset class="vurdf-section vurdf-joint-controls" ${P(e) ? "" : "disabled"}>
5460
5502
  <div class="vurdf-section-head"><strong>关节</strong>${f}<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>
5461
5503
  <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>
5462
5504
  <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>
5463
5505
  ${P(e) ? "" : '<p class="vurdf-control-hint">仿真运行期间只读,暂停后可选中部件并调整关节。</p>'}
5464
5506
  </fieldset>` : '<div class="vurdf-section"><div class="vurdf-empty">固定关节不可调节。</div></div>';
5465
- return `<div class="vurdf-entity"><label>${E(s.jointType.toUpperCase())} JOINT</label><h2>${E(s.name)}</h2><p>${E(s.parentLink)} → ${E(s.childLink)}</p></div>${m}${ot(s, 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>${s.originPosition.map(be).join(" ")}</dd><dt>关节原点 RPY</dt><dd>${s.originRotationRpy.map(be).join(" ")}</dd><dt>Axis xyz</dt><dd>${s.axis.map(be).join(" ")}</dd><dt>Lower</dt><dd>${((n = s.limits) == null ? void 0 : n.lower) ?? "—"}</dd><dt>Upper</dt><dd>${((a = s.limits) == null ? void 0 : a.upper) ?? "—"}</dd><dt>Effort</dt><dd>${s.effort ?? "—"}</dd><dt>Velocity</dt><dd>${s.velocity ?? "—"}</dd></dl></div>${o ? dt(o, !0, r.has(o.id)) : ""}`;
5507
+ return `<div class="vurdf-entity"><label>${k(s.jointType.toUpperCase())} JOINT</label><h2>${k(s.name)}</h2><p>${k(s.parentLink)} → ${k(s.childLink)}</p></div>${v}${ct(s, 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>${s.originPosition.map(be).join(" ")}</dd><dt>关节原点 RPY</dt><dd>${s.originRotationRpy.map(be).join(" ")}</dd><dt>Axis xyz</dt><dd>${s.axis.map(be).join(" ")}</dd><dt>Lower</dt><dd>${((n = s.limits) == null ? void 0 : n.lower) ?? "—"}</dd><dt>Upper</dt><dd>${((a = s.limits) == null ? void 0 : a.upper) ?? "—"}</dd><dt>Effort</dt><dd>${s.effort ?? "—"}</dd><dt>Velocity</dt><dd>${s.velocity ?? "—"}</dd></dl></div>${o ? ht(o, !0, r.has(o.id)) : ""}`;
5466
5508
  }
5467
- return s.kind === "link" ? `<div class="vurdf-entity"><label>LINK</label><h2>${E(s.name)}</h2><p>${s.visualCount} Visual · ${s.collisionCount} Collision</p></div>${ot(s, e, i)}${dt(s, !1, r.has(s.id))}` : `<div class="vurdf-entity"><label>ROBOT</label><h2>${E(s.name)}</h2><p>${s.rootLinkIds.length} root link</p></div>`;
5509
+ return s.kind === "link" ? `<div class="vurdf-entity"><label>LINK</label><h2>${k(s.name)}</h2><p>${s.visualCount} Visual · ${s.collisionCount} Collision</p></div>${ct(s, e, i)}${ht(s, !1, r.has(s.id))}` : `<div class="vurdf-entity"><label>ROBOT</label><h2>${k(s.name)}</h2><p>${s.rootLinkIds.length} root link</p></div>`;
5468
5510
  }
5469
5511
  function ke(s) {
5470
5512
  if (s === void 0) return "<span>—</span>";
5471
5513
  const e = String(s), t = Number.isFinite(s) ? String(Number(s.toPrecision(6))) : e;
5472
5514
  return `<button type="button" class="vurdf-source-number" data-copy-number="${e}" title="${e} · 点击复制完整数值" aria-label="复制完整数值 ${e}">${t}</button>`;
5473
5515
  }
5474
- function lt(s, e, t, i) {
5516
+ function ut(s, e, t, i) {
5475
5517
  return `<div class="vurdf-vector"><div class="vurdf-vector-title">${s}<span>${i}</span></div><dl>${e.map((r, n) => `<div><dt>${r}</dt><dd>${ke(t == null ? void 0 : t[n])}</dd></div>`).join("")}</dl></div>`;
5476
5518
  }
5477
- function dt(s, e, t) {
5519
+ function ht(s, e, t) {
5478
5520
  return `<section class="vurdf-section" data-link-inertial>
5479
- <div class="vurdf-section-head vurdf-component-title"><strong>${e ? "子部件" : "部件属性"} · ${E(s.name)}</strong></div>
5521
+ <div class="vurdf-section-head vurdf-component-title"><strong>${e ? "子部件" : "部件属性"} · ${k(s.name)}</strong></div>
5480
5522
  <dl class="vurdf-data"><dt>质量 (kg)</dt><dd>${ke(s.mass)}</dd></dl>
5481
5523
  <div class="vurdf-inertial-frame">惯性原点 · 相对于 Link</div>
5482
- ${lt("质心位置", ["X", "Y", "Z"], s.centerOfMass, "m")}
5483
- ${lt("惯性坐标系旋转", ["R", "P", "Y"], s.inertialRotationRpy, "rad")}
5484
- <details class="vurdf-inertia-details" data-inertia-details="${E(s.id)}" ${t ? "open" : ""}>
5524
+ ${ut("质心位置", ["X", "Y", "Z"], s.centerOfMass, "m")}
5525
+ ${ut("惯性坐标系旋转", ["R", "P", "Y"], s.inertialRotationRpy, "rad")}
5526
+ <details class="vurdf-inertia-details" data-inertia-details="${k(s.id)}" ${t ? "open" : ""}>
5485
5527
  <summary>${R("chevron")}<strong>惯性张量</strong><span>kg·m²</span></summary>
5486
5528
  <div class="vurdf-inertial-frame">关于质心 · 惯性坐标系</div>
5487
5529
  <dl class="vurdf-data">${["Ixx", "Iyy", "Izz", "Ixy", "Ixz", "Iyz"].map((i, r) => {
@@ -5491,30 +5533,30 @@ function dt(s, e, t) {
5491
5533
  </details>
5492
5534
  </section>`;
5493
5535
  }
5494
- function Rs(s, e) {
5536
+ function _s(s, e) {
5495
5537
  var n, a;
5496
5538
  const t = s.sourceText.split(/\r?\n/), i = ((n = e == null ? void 0 : e.source) == null ? void 0 : n.startLine) ?? 0, r = ((a = e == null ? void 0 : e.source) == null ? void 0 : a.endLine) ?? 0;
5497
- return `<pre class="vurdf-source"><code>${t.map((o, l) => `<span class="line ${e && l + 1 >= i && l + 1 <= r ? "is-selected" : ""}"><span class="ln">${l + 1}</span>${Ds(o)}</span>`).join("")}</code></pre>`;
5539
+ return `<pre class="vurdf-source"><code>${t.map((o, l) => `<span class="line ${e && l + 1 >= i && l + 1 <= r ? "is-selected" : ""}"><span class="ln">${l + 1}</span>${Hs(o)}</span>`).join("")}</code></pre>`;
5498
5540
  }
5499
- function Ls(s) {
5500
- return s.issues.length ? s.issues.map((e) => `<button class="vurdf-issue" data-issue-entity="${E(e.entityId)}">${R("error")}<span><b>${E(e.title)}</b><small>${E(e.message)}</small></span></button>`).join("") : '<div class="vurdf-empty">所有严格结构与数学检查通过。</div>';
5541
+ function Us(s) {
5542
+ return s.issues.length ? s.issues.map((e) => `<button class="vurdf-issue" data-issue-entity="${k(e.entityId)}">${R("error")}<span><b>${k(e.title)}</b><small>${k(e.message)}</small></span></button>`).join("") : '<div class="vurdf-empty">所有严格结构与数学检查通过。</div>';
5501
5543
  }
5502
5544
  function ge(s, e, t) {
5503
5545
  return `<button class="vurdf-tab ${s === t ? "is-active" : ""}" data-tab="${s}">${e}</button>`;
5504
5546
  }
5505
- function Ts() {
5547
+ function js() {
5506
5548
  return '<div class="vurdf-empty vurdf-no-selection">点击模型或结构树选择部件;点击场景空白处可取消选择。</div>';
5507
5549
  }
5508
5550
  function be(s) {
5509
5551
  return s.toFixed(3);
5510
5552
  }
5511
- function Ds(s) {
5512
- return E(s).replace(/(&lt;\/?[\w:-]+)/g, '<span class="tag">$1</span>').replace(/([\w:-]+)=(&quot;.*?&quot;)/g, '<span class="attr">$1</span>=<span class="str">$2</span>');
5553
+ function Hs(s) {
5554
+ return k(s).replace(/(&lt;\/?[\w:-]+)/g, '<span class="tag">$1</span>').replace(/([\w:-]+)=(&quot;.*?&quot;)/g, '<span class="attr">$1</span>=<span class="str">$2</span>');
5513
5555
  }
5514
5556
  function Pe(s, e) {
5515
5557
  return s.jointType !== "prismatic" && e === "deg" ? 180 / Math.PI : 1;
5516
5558
  }
5517
- function Os(s) {
5559
+ function qs(s) {
5518
5560
  const e = new Map(s.nodes.map((o) => [o.id, o])), t = /* @__PURE__ */ new Set(), i = [], r = [];
5519
5561
  let n = 0;
5520
5562
  const a = (o, l) => {
@@ -5533,7 +5575,7 @@ function Os(s) {
5533
5575
  for (const o of s.nodes) t.has(o.id) || a(o.id, 0);
5534
5576
  return { nodes: i, edges: r, width: Math.max(200, n * 210), height: Math.max(90, ...i.map((o) => o.y + 45)) };
5535
5577
  }
5536
- class zs {
5578
+ class Ys {
5537
5579
  constructor(e, t, i = () => {
5538
5580
  }) {
5539
5581
  u(this, "element", document.createElement("section"));
@@ -5586,9 +5628,9 @@ class zs {
5586
5628
  }), o.addEventListener("pointermove", (d) => {
5587
5629
  const c = this.windowResize;
5588
5630
  if (!c || c.id !== d.pointerId) return;
5589
- const p = this.element.parentElement, h = d.clientX - c.x, f = d.clientY - c.y, m = 420, v = 320;
5590
- let b = c.left, y = c.top, g = c.width, x = c.height;
5591
- (c.corner === "tr" || c.corner === "br") && (g = Math.max(m, c.width + h)), (c.corner === "tl" || c.corner === "bl") && (g = Math.max(m, c.width - h), b = c.left + c.width - g), c.corner === "tr" && (x = Math.max(v, c.height - f), y = c.top + c.height - x), (c.corner === "br" || c.corner === "bl") && (x = Math.max(v, c.height + f)), c.corner === "tl" && (x = Math.max(v, c.height - f), y = c.top + c.height - x), b = Math.max(0, Math.min(b, Math.max(0, p.clientWidth - g))), y = Math.max(0, Math.min(y, Math.max(0, p.clientHeight - x))), g = Math.min(g, p.clientWidth - b), x = Math.min(x, p.clientHeight - y), this.element.style.left = `${b}px`, this.element.style.top = `${y}px`, this.element.style.width = `${Math.max(m, g)}px`, this.element.style.height = `${Math.max(v, x)}px`;
5631
+ const p = this.element.parentElement, h = d.clientX - c.x, f = d.clientY - c.y, v = 420, y = 320;
5632
+ let m = c.left, b = c.top, g = c.width, x = c.height;
5633
+ (c.corner === "tr" || c.corner === "br") && (g = Math.max(v, c.width + h)), (c.corner === "tl" || c.corner === "bl") && (g = Math.max(v, c.width - h), m = c.left + c.width - g), c.corner === "tr" && (x = Math.max(y, c.height - f), b = c.top + c.height - x), (c.corner === "br" || c.corner === "bl") && (x = Math.max(y, c.height + f)), c.corner === "tl" && (x = Math.max(y, c.height - f), b = c.top + c.height - x), m = Math.max(0, Math.min(m, Math.max(0, p.clientWidth - g))), b = Math.max(0, Math.min(b, Math.max(0, p.clientHeight - x))), g = Math.min(g, p.clientWidth - m), x = Math.min(x, p.clientHeight - b), this.element.style.left = `${m}px`, this.element.style.top = `${b}px`, this.element.style.width = `${Math.max(v, g)}px`, this.element.style.height = `${Math.max(y, x)}px`;
5592
5634
  });
5593
5635
  const l = () => {
5594
5636
  this.windowResize = null;
@@ -5636,13 +5678,13 @@ class zs {
5636
5678
  if (this.snapshot = e, !this.opened) return;
5637
5679
  if (this.modelNodes !== e.nodes) {
5638
5680
  this.modelNodes = e.nodes;
5639
- const i = Os(e);
5681
+ const i = qs(e);
5640
5682
  this.bounds = i;
5641
5683
  const r = new Map(i.nodes.map((n) => [n.node.id, n]));
5642
5684
  this.graph.innerHTML = i.edges.map((n) => {
5643
5685
  const a = r.get(n.from), o = r.get(n.to), l = a.y + 20, d = o.y - 20, c = (l + d) / 2;
5644
5686
  return `<path class="vurdf-diagram-edge" d="M${a.x} ${l} C${a.x} ${c},${o.x} ${c},${o.x} ${d}"/>`;
5645
- }).join("") + i.nodes.map(({ node: n, x: a, y: o }) => `<g class="vurdf-diagram-node" data-diagram-node="${I(n.id)}" transform="translate(${a - 90} ${o - 20})" role="button" tabindex="0" aria-label="${I(n.name)}"><title>${I(n.name)}</title><rect width="180" height="40" rx="${n.kind === "joint" ? 20 : 5}"/><text x="90" y="16">${I(n.name.length > 26 ? n.name.slice(0, 24) + "…" : n.name)}</text><text class="vurdf-diagram-kind" x="90" y="31">${I(n.kind === "joint" ? n.jointType : n.kind)}</text></g>`).join(""), this.fit();
5687
+ }).join("") + i.nodes.map(({ node: n, x: a, y: o }) => `<g class="vurdf-diagram-node" data-diagram-node="${M(n.id)}" transform="translate(${a - 90} ${o - 20})" role="button" tabindex="0" aria-label="${M(n.name)}"><title>${M(n.name)}</title><rect width="180" height="40" rx="${n.kind === "joint" ? 20 : 5}"/><text x="90" y="16">${M(n.name.length > 26 ? n.name.slice(0, 24) + "…" : n.name)}</text><text class="vurdf-diagram-kind" x="90" y="31">${M(n.kind === "joint" ? n.jointType : n.kind)}</text></g>`).join(""), this.fit();
5646
5688
  }
5647
5689
  const t = e.mode === "dynamics-running" || e.mode === "dynamics-initializing";
5648
5690
  for (const i of this.graph.querySelectorAll("[data-diagram-node]")) {
@@ -5683,7 +5725,7 @@ class zs {
5683
5725
  this.graph.setAttribute("transform", `translate(${this.x} ${this.y}) scale(${this.scale})`);
5684
5726
  }
5685
5727
  }
5686
- class Ns {
5728
+ class Xs {
5687
5729
  constructor(e, t, i, r, n) {
5688
5730
  u(this, "namesVisible", !1);
5689
5731
  u(this, "element", document.createElement("div"));
@@ -5699,13 +5741,13 @@ class Ns {
5699
5741
  ${se("centerOfMass", "质心", e.overlays.centerOfMass, "centerOfMass")}
5700
5742
  ${se("inertia", "惯量", e.overlays.inertia === !0, "inertia")}
5701
5743
  <button class="vurdf-tool ${this.namesVisible ? "is-active" : ""}" data-name-labels aria-pressed="${this.namesVisible}" title="显示/隐藏部件名称">${R("names")}名称</button>
5702
- ${e.nodes.some((a) => a.kind === "joint" && a.movable && a.jointType !== "prismatic") ? Es(i) : ""}
5744
+ ${e.nodes.some((a) => a.kind === "joint" && a.movable && a.jointType !== "prismatic") ? zs(i) : ""}
5703
5745
  <span class="vurdf-tool-divider" aria-hidden="true"></span>
5704
- ${ne("ground", ct(this.ctx) ? "隐藏地面" : "显示地面", ct(this.ctx), "ground")}
5746
+ ${ne("ground", pt(this.ctx) ? "隐藏地面" : "显示地面", pt(this.ctx), "ground")}
5705
5747
  ${ne("fit", "适应视图", !1, "fit")}
5706
5748
  ${ne("theme", this.theme === "dark" ? "浅色主题" : "深色主题", !1, this.theme === "dark" ? "sun" : "moon")}
5707
5749
  <span class="vurdf-tool-divider" aria-hidden="true"></span>
5708
- ${Vs(e, r, n)}
5750
+ ${Ws(e, r, n)}
5709
5751
  ${ne("reset", "重置", !1, "reset")}
5710
5752
  `, this.bind(e);
5711
5753
  }
@@ -5739,50 +5781,50 @@ function ne(s, e, t, i) {
5739
5781
  const r = s === "ground" ? ` aria-pressed="${t}"` : "";
5740
5782
  return `<button class="vurdf-tool ${t ? "is-active" : ""}" data-scene-tool="${s}"${r} title="${e}" aria-label="${e}">${R(i)}${s === "reset" ? e : ""}</button>`;
5741
5783
  }
5742
- function Vs(s, e, t) {
5784
+ function Ws(s, e, t) {
5743
5785
  const i = s.mode === "dynamics-running", r = i ? "暂停仿真" : s.mode === "dynamics-initializing" ? "启动中" : "启动仿真";
5744
- return `<button class="vurdf-tool vurdf-dynamics ${i ? "is-active" : ""}" data-mode="dynamics" ${e ? "disabled" : ""} title="${E(t)}">${R(i ? "pause" : "play")}${r}</button>`;
5786
+ return `<button class="vurdf-tool vurdf-dynamics ${i ? "is-active" : ""}" data-mode="dynamics" ${e ? "disabled" : ""} title="${k(t)}">${R(i ? "pause" : "play")}${r}</button>`;
5745
5787
  }
5746
- function ct(s) {
5788
+ function pt(s) {
5747
5789
  return s.asset.$readControl().groundVisible;
5748
5790
  }
5749
- class Fs {
5791
+ class Gs {
5750
5792
  constructor() {
5751
5793
  u(this, "element", document.createElement("footer"));
5752
5794
  this.element.className = "vurdf-status";
5753
5795
  }
5754
5796
  update(e) {
5755
5797
  const t = e.nodes.find((i) => i.id === e.selectedEntityId) ?? null;
5756
- this.element.innerHTML = `<span>模型已就绪</span><span title="${E(e.sourcePath)}">${E(e.sourcePath)}</span><span>选择:${t ? E(t.name) : "无"}</span>${(t == null ? void 0 : t.kind) === "joint" && t.movable && P(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>${$s(e.mode)}</span><span class="${e.issues.length ? "vurdf-status-error" : "vurdf-status-ok"}">${e.issues.length ? `${e.issues.length} 个错误` : "严格检查通过"}</span>`;
5798
+ this.element.innerHTML = `<span>模型已就绪</span><span title="${k(e.sourcePath)}">${k(e.sourcePath)}</span><span>选择:${t ? k(t.name) : "无"}</span>${(t == null ? void 0 : t.kind) === "joint" && t.movable && P(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>${Ks(e.mode)}</span><span class="${e.issues.length ? "vurdf-status-error" : "vurdf-status-ok"}">${e.issues.length ? `${e.issues.length} 个错误` : "严格检查通过"}</span>`;
5757
5799
  }
5758
5800
  dispose() {
5759
5801
  this.element.remove();
5760
5802
  }
5761
5803
  }
5762
- function $s(s) {
5804
+ function Ks(s) {
5763
5805
  return s === "kinematic" ? "运动学预览" : s === "dynamics-running" ? "动力学仿真运行中" : s === "dynamics-paused" ? "动力学仿真已暂停" : s === "dynamics-initializing" ? "正在初始化动力学" : "动力学不可用";
5764
5806
  }
5765
- class Bs {
5807
+ class Zs {
5766
5808
  constructor(e, t, i, r, n, a, o) {
5767
5809
  u(this, "diagram");
5768
5810
  u(this, "structure");
5769
5811
  u(this, "inspector");
5770
5812
  u(this, "toolbar");
5771
- u(this, "statusbar", new Fs());
5813
+ u(this, "statusbar", new Gs());
5772
5814
  u(this, "gizmo", document.createElement("div"));
5773
5815
  u(this, "disposed", !1);
5774
5816
  u(this, "angleUnit", "rad");
5775
5817
  u(this, "nameLabels", null);
5776
5818
  u(this, "pointerCleanup", null);
5777
5819
  u(this, "resizeCleanup", null);
5778
- this.root = e, this.inspection = t, this.theme = r, this.cameraQuaternion = n, this.structure = new ks(t, () => this.diagram.open(), (l) => this.inspector.stopSweep(l)), this.inspector = new Is(t), this.toolbar = new Ns(t, i, r, (l) => {
5820
+ this.root = e, this.inspection = t, this.theme = r, this.cameraQuaternion = n, this.structure = new Ns(t, () => this.diagram.open(), (l) => this.inspector.stopSweep(l)), this.inspector = new $s(t), this.toolbar = new Xs(t, i, r, (l) => {
5779
5821
  var d;
5780
5822
  return (d = this.nameLabels) == null ? void 0 : d.setVisible(l);
5781
5823
  }, () => {
5782
5824
  this.angleUnit = this.angleUnit === "rad" ? "deg" : "rad", this.render(this.inspection.getSnapshot());
5783
- }), this.diagram = new zs((l) => this.selectFromScene(l), () => {
5825
+ }), this.diagram = new Ys((l) => this.selectFromScene(l), () => {
5784
5826
  this.structure.setDiagramOpen(!1), this.structure.focusDiagramButton();
5785
- }, () => this.structure.setDiagramOpen(!0)), this.gizmo.className = "vurdf-gizmo", this.gizmo.setAttribute("aria-label", "坐标轴方向"), this.root.append(this.structure.element, this.gizmo, this.toolbar.element, this.inspector.element, this.statusbar.element, this.diagram.element), this.bindSidebar("left"), this.bindSidebar("right"), a && o && (this.nameLabels = new gs(e, a, o, t)), a && (this.pointerCleanup = xs(a, t, () => this.inspector.stopSweep(!1), o));
5827
+ }, () => this.structure.setDiagramOpen(!0)), this.gizmo.className = "vurdf-gizmo", this.gizmo.setAttribute("aria-label", "坐标轴方向"), this.root.append(this.structure.element, this.gizmo, this.toolbar.element, this.inspector.element, this.statusbar.element, this.diagram.element), this.bindSidebar("left"), this.bindSidebar("right"), a && o && (this.nameLabels = new Ms(e, a, o, t)), a && (this.pointerCleanup = Ls(a, t, () => this.inspector.stopSweep(!1), o));
5786
5828
  }
5787
5829
  render(e) {
5788
5830
  this.disposed || !e || (this.root.dataset.theme = this.theme, this.structure.update(e, this.angleUnit), this.inspector.update(e, this.angleUnit), this.toolbar.update(e, this.theme, this.angleUnit), this.statusbar.update(e), this.diagram.update(e), this.updateGizmo());
@@ -5792,7 +5834,7 @@ class Bs {
5792
5834
  }
5793
5835
  updateGizmo() {
5794
5836
  var e;
5795
- this.gizmo.innerHTML = bs(((e = this.cameraQuaternion) == null ? void 0 : e.call(this)) ?? new Gt());
5837
+ this.gizmo.innerHTML = Is(((e = this.cameraQuaternion) == null ? void 0 : e.call(this)) ?? new Zt());
5796
5838
  }
5797
5839
  setTheme(e) {
5798
5840
  this.theme !== e && (this.theme = e, this.render(this.inspection.getSnapshot()));
@@ -5820,17 +5862,17 @@ class Bs {
5820
5862
  o.addEventListener("keydown", (d) => {
5821
5863
  d.key !== "ArrowLeft" && d.key !== "ArrowRight" || (d.preventDefault(), l(t.getBoundingClientRect().width + (d.key === "ArrowRight" ? 16 : -16) * (e === "left" ? 1 : -1)));
5822
5864
  }), o.addEventListener("pointerdown", (d) => {
5823
- var m;
5865
+ var v;
5824
5866
  if (d.button !== 0) return;
5825
- d.preventDefault(), this.root.classList.add("is-resizing"), (m = o.setPointerCapture) == null || m.call(o, d.pointerId);
5826
- const c = d.clientX, p = t.getBoundingClientRect().width, h = (v) => l(p + (e === "left" ? 1 : -1) * (v.clientX - c)), f = () => {
5867
+ d.preventDefault(), this.root.classList.add("is-resizing"), (v = o.setPointerCapture) == null || v.call(o, d.pointerId);
5868
+ const c = d.clientX, p = t.getBoundingClientRect().width, h = (y) => l(p + (e === "left" ? 1 : -1) * (y.clientX - c)), f = () => {
5827
5869
  o.removeEventListener("pointermove", h), o.removeEventListener("pointerup", f), o.removeEventListener("pointercancel", f), o.removeEventListener("lostpointercapture", f), this.resizeCleanup = null, this.root.classList.remove("is-resizing");
5828
5870
  };
5829
5871
  this.resizeCleanup = f, o.addEventListener("pointermove", h), o.addEventListener("pointerup", f), o.addEventListener("pointercancel", f), o.addEventListener("lostpointercapture", f);
5830
5872
  });
5831
5873
  }
5832
5874
  }
5833
- const _s = `
5875
+ const Js = `
5834
5876
  .vurdf-shell{--vurdf-accent:#55d6b3;--vurdf-accent-strong:#72e5c6;--vurdf-accent-soft:rgba(85,214,179,.12);--vurdf-bg:#080d0f;--vurdf-panel:#0e1416;--vurdf-panel-raised:#141b1d;--vurdf-border:#283235;--vurdf-text:#e7ecea;--vurdf-muted:#75817f;--vurdf-hover:#1b2426;position:absolute;inset:0;pointer-events:none;color:var(--vurdf-text);font:12px/1.4 'Segoe UI','Microsoft YaHei UI',system-ui,sans-serif}.vurdf-shell[data-theme=light]{--vurdf-accent:#168c70;--vurdf-accent-strong:#08755d;--vurdf-accent-soft:rgba(22,140,112,.13);--vurdf-bg:#eef3f1;--vurdf-panel:#f8faf9;--vurdf-panel-raised:#eef3f1;--vurdf-border:#cfd9d6;--vurdf-text:#1f2927;--vurdf-muted:#687572;--vurdf-hover:#e5ece9}.vurdf-shell *{box-sizing:border-box}.vurdf-shell svg{fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round}
5835
5877
  .vurdf-side{position:absolute;top:0;bottom:27px;width:270px;background:var(--vurdf-panel);pointer-events:auto;z-index:7;display:flex;flex-direction:column;min-height:0}.vurdf-left{left:0;border-right:1px solid var(--vurdf-border)}.vurdf-right{right:0;width:320px;border-left:1px solid var(--vurdf-border)}.vurdf-head{height:52px;flex:0 0 52px;display:flex;align-items:center;justify-content:space-between;padding:0 12px;border-bottom:1px solid var(--vurdf-border)}.vurdf-head strong{font-size:12px}.vurdf-head span{display:block;color:var(--vurdf-muted);font-size:9px}
5836
5878
  .vurdf-search{height:31px;margin:9px;border:1px solid var(--vurdf-border);border-radius:5px;background:var(--vurdf-panel-raised);display:flex;align-items:center;gap:7px;padding:0 8px}.vurdf-search:focus-within{border-color:var(--vurdf-accent)}.vurdf-search svg{width:14px;color:var(--vurdf-muted)}.vurdf-search input{appearance:none;box-shadow:none!important;min-width:0;flex:1;border:0!important;outline:0!important;background:transparent;color:var(--vurdf-text);font:11px inherit}.vurdf-filters{display:flex;gap:5px;padding:0 9px 8px;border-bottom:1px solid var(--vurdf-border)}.vurdf-chip{height:23px;border:1px solid var(--vurdf-border);border-radius:5px;background:transparent;color:var(--vurdf-muted);font-size:9px;padding:0 7px;cursor:pointer}.vurdf-chip.is-active{color:var(--vurdf-text);background:var(--vurdf-panel-raised)}
@@ -5955,17 +5997,17 @@ const _s = `
5955
5997
 
5956
5998
  .vurdf-diagram button:focus-visible{outline:2px solid var(--vurdf-accent)}
5957
5999
  @media(max-width:600px){.vurdf-diagram{width:calc(100% - 16px);height:calc(100% - 60px)}}
5958
- `, Us = "urdf";
5959
- function js(s) {
6000
+ `, Qs = "urdf";
6001
+ function en(s) {
5960
6002
  let e = null, t = null, i = null, r = null, n = null, a = null;
5961
6003
  const o = [];
5962
6004
  return {
5963
6005
  id: "nebula.ui.urdf",
5964
6006
  activate(l) {
5965
6007
  var p;
5966
- t = document.createElement("style"), t.dataset.viewerUrdfUi = "", t.textContent = _s, (p = s.shadowRoot()) == null || p.append(t);
6008
+ t = document.createElement("style"), t.dataset.viewerUrdfUi = "", t.textContent = Js, (p = s.shadowRoot()) == null || p.append(t);
5967
6009
  const d = document.createElement("div");
5968
- d.className = "vurdf-shell", d.hidden = !0, e = s.mountBuiltin(d, { zone: "overlay", group: Us });
6010
+ d.className = "vurdf-shell", d.hidden = !0, e = s.mountBuiltin(d, { zone: "overlay", group: Qs });
5969
6011
  const c = () => {
5970
6012
  var f;
5971
6013
  const h = l.asset.$inspection();
@@ -5977,7 +6019,7 @@ function js(s) {
5977
6019
  d.hidden = !0;
5978
6020
  return;
5979
6021
  }
5980
- d.hidden = !1, i = new Bs(d, h, l, s.theme(), s.cameraQuaternion, (f = s.interactionCanvas) == null ? void 0 : f.call(s), s.interactionCamera), r = h.subscribe((m) => i == null ? void 0 : i.render(m)), i.render(h.getSnapshot());
6022
+ d.hidden = !1, i = new Zs(d, h, l, s.theme(), s.cameraQuaternion, (f = s.interactionCanvas) == null ? void 0 : f.call(s), s.interactionCamera), r = h.subscribe((v) => i == null ? void 0 : i.render(v)), i.render(h.getSnapshot());
5981
6023
  };
5982
6024
  n = s.onThemeChange((h) => i == null ? void 0 : i.setTheme(h)), o.push(
5983
6025
  l.events.on("asset-change", c),
@@ -5987,13 +6029,13 @@ function js(s) {
5987
6029
  return i == null ? void 0 : i.render((h = l.asset.$inspection()) == null ? void 0 : h.getSnapshot());
5988
6030
  }),
5989
6031
  l.events.on("pick", (h) => {
5990
- var m;
6032
+ var v;
5991
6033
  const f = l.asset.$inspection();
5992
- (f == null ? void 0 : f.kind) === "urdf" && P(f.getSnapshot()) && (i == null || i.selectFromScene(ut(f, ((m = h.result) == null ? void 0 : m.object) ?? null)));
6034
+ (f == null ? void 0 : f.kind) === "urdf" && P(f.getSnapshot()) && (i == null || i.selectFromScene(ft(f, ((v = h.result) == null ? void 0 : v.object) ?? null)));
5993
6035
  }),
5994
6036
  l.events.on("selection-change", (h) => {
5995
6037
  const f = l.asset.$inspection();
5996
- (f == null ? void 0 : f.kind) === "urdf" && P(f.getSnapshot()) && (i == null || i.selectFromScene(ut(f, h.object)));
6038
+ (f == null ? void 0 : f.kind) === "urdf" && P(f.getSnapshot()) && (i == null || i.selectFromScene(ft(f, h.object)));
5997
6039
  })
5998
6040
  ), c();
5999
6041
  },
@@ -6003,7 +6045,7 @@ function js(s) {
6003
6045
  }
6004
6046
  };
6005
6047
  }
6006
- function Hs(s) {
6048
+ function tn(s) {
6007
6049
  let e = s;
6008
6050
  for (; e; ) {
6009
6051
  if (typeof e.userData.urdfEntityId == "string") return e.userData.urdfEntityId;
@@ -6011,12 +6053,12 @@ function Hs(s) {
6011
6053
  }
6012
6054
  return null;
6013
6055
  }
6014
- function ut(s, e) {
6056
+ function ft(s, e) {
6015
6057
  var n;
6016
- const t = Hs(e), i = s.getSnapshot(), r = i.nodes.find((a) => a.id === t && a.kind === "link");
6058
+ const t = tn(e), i = s.getSnapshot(), r = i.nodes.find((a) => a.id === t && a.kind === "link");
6017
6059
  return r ? ((n = i.nodes.find((a) => a.kind === "joint" && a.childLink === r.name)) == null ? void 0 : n.id) ?? t : t;
6018
6060
  }
6019
- class qs {
6061
+ class rn {
6020
6062
  constructor(e, t, i, r, n, a, o, l = null, d = () => null) {
6021
6063
  u(this, "pluginsById", /* @__PURE__ */ new Map());
6022
6064
  u(this, "contributions", []);
@@ -6224,7 +6266,7 @@ class qs {
6224
6266
  n.dataset.viewerContribution = "toolbar", n.dataset.viewerContributionId = t.id;
6225
6267
  for (const a of t.items) {
6226
6268
  const o = document.createElement("button");
6227
- o.type = "button", a.icon ? (o.insertAdjacentHTML("afterbegin", Ys(a.icon)), o.title = a.title ?? a.label, o.setAttribute("aria-label", a.title ?? a.label)) : (o.textContent = a.label, a.title && (o.title = a.title)), o.disabled = a.disabled === !0, a.pressed !== void 0 && (o.setAttribute("aria-pressed", String(a.pressed)), o.classList.toggle("is-active", a.pressed)), o.addEventListener("click", a.onClick), n.append(o);
6269
+ o.type = "button", a.icon ? (o.insertAdjacentHTML("afterbegin", sn(a.icon)), o.title = a.title ?? a.label, o.setAttribute("aria-label", a.title ?? a.label)) : (o.textContent = a.label, a.title && (o.title = a.title)), o.disabled = a.disabled === !0, a.pressed !== void 0 && (o.setAttribute("aria-pressed", String(a.pressed)), o.classList.toggle("is-active", a.pressed)), o.addEventListener("click", a.onClick), n.append(o);
6228
6270
  }
6229
6271
  this.hostElement.append(n), e.cleanup = () => n.remove();
6230
6272
  return;
@@ -6283,12 +6325,12 @@ class qs {
6283
6325
  if (this.disposed) throw new Error("Viewer plugin manager has been disposed.");
6284
6326
  }
6285
6327
  }
6286
- function Ys(s) {
6328
+ function sn(s) {
6287
6329
  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">${s}</svg>`;
6288
6330
  }
6289
- function Xs(s, e, t) {
6331
+ function nn(s, e, t) {
6290
6332
  var p;
6291
- const i = Ks(s), r = Gs([t, e.signal, i]), n = ((p = e.filename) == null ? void 0 : p.trim()) || Js(s), a = Ae(s) ? en(s.files, s.entry, n) : n, o = Nt(s), l = e.baseUrl ?? Qs(o), d = /* @__PURE__ */ new Set(), c = Ae(s) ? new Map(s.files.map((h) => [V(h.path), h])) : null;
6333
+ const i = ln(s), r = on([t, e.signal, i]), n = ((p = e.filename) == null ? void 0 : p.trim()) || cn(s), a = Ae(s) ? hn(s.files, s.entry, n) : n, o = Vt(s), l = e.baseUrl ?? un(o), d = /* @__PURE__ */ new Set(), c = Ae(s) ? new Map(s.files.map((h) => [V(h.path), h])) : null;
6292
6334
  return Object.freeze({
6293
6335
  original: s,
6294
6336
  entryPath: a,
@@ -6298,23 +6340,23 @@ function Xs(s, e, t) {
6298
6340
  baseUrl: l,
6299
6341
  hasResourceResolver: !!e.resourceResolver,
6300
6342
  async resolve(h) {
6301
- ht(r);
6302
- const f = V(h), m = Zs(s);
6303
- if (m && (!f || f === V(a ?? ""))) {
6304
- const y = URL.createObjectURL(m);
6305
- return d.add(y), y;
6343
+ mt(r);
6344
+ const f = V(h), v = dn(s);
6345
+ if (v && (!f || f === V(a ?? ""))) {
6346
+ const b = URL.createObjectURL(v);
6347
+ return d.add(b), b;
6306
6348
  }
6307
- const v = (c == null ? void 0 : c.get(f)) ?? tn(c, a, f);
6308
- if (v) {
6309
- const y = URL.createObjectURL(v.file);
6310
- return d.add(y), y;
6349
+ const y = (c == null ? void 0 : c.get(f)) ?? pn(c, a, f);
6350
+ if (y) {
6351
+ const b = URL.createObjectURL(y.file);
6352
+ return d.add(b), b;
6311
6353
  }
6312
- const b = await rn(e.resourceResolver, h, r);
6313
- if (ht(r), b instanceof Blob) {
6314
- const y = URL.createObjectURL(b);
6315
- return d.add(y), y;
6354
+ const m = await fn(e.resourceResolver, h, r);
6355
+ if (mt(r), m instanceof Blob) {
6356
+ const b = URL.createObjectURL(m);
6357
+ return d.add(b), b;
6316
6358
  }
6317
- return b instanceof URL ? b.href : typeof b == "string" ? b : l ? new URL(h, l).href : h;
6359
+ return m instanceof URL ? m.href : typeof m == "string" ? m : l ? new URL(h, l).href : h;
6318
6360
  },
6319
6361
  release() {
6320
6362
  for (const h of d) URL.revokeObjectURL(h);
@@ -6322,7 +6364,7 @@ function Xs(s, e, t) {
6322
6364
  }
6323
6365
  });
6324
6366
  }
6325
- function Ws(s) {
6367
+ function an(s) {
6326
6368
  var r;
6327
6369
  const e = s.entryPath ?? s.url;
6328
6370
  if (!e) return null;
@@ -6339,7 +6381,7 @@ function Ws(s) {
6339
6381
  const i = /\.([a-z0-9]+)$/i.exec(t);
6340
6382
  return ((r = i == null ? void 0 : i[1]) == null ? void 0 : r.toLowerCase()) ?? null;
6341
6383
  }
6342
- function Gs(s) {
6384
+ function on(s) {
6343
6385
  const e = s.filter((r) => !!r);
6344
6386
  if (e.length === 0) return new AbortController().signal;
6345
6387
  if (e.length === 1) return e[0];
@@ -6354,22 +6396,22 @@ function Gs(s) {
6354
6396
  }
6355
6397
  return t.signal;
6356
6398
  }
6357
- function ht(s) {
6399
+ function mt(s) {
6358
6400
  if (s.aborted)
6359
6401
  throw typeof s.throwIfAborted == "function" && s.throwIfAborted(), new DOMException("The operation was aborted.", "AbortError");
6360
6402
  }
6361
- function Ks(s) {
6403
+ function ln(s) {
6362
6404
  return typeof s == "object" && s !== null && "signal" in s ? s.signal : void 0;
6363
6405
  }
6364
- function Nt(s) {
6406
+ function Vt(s) {
6365
6407
  return typeof s == "string" ? s : typeof URL < "u" && s instanceof URL ? s.href : typeof s == "object" && s !== null && "kind" in s && s.kind === "url" ? s.url : null;
6366
6408
  }
6367
- function Zs(s) {
6409
+ function dn(s) {
6368
6410
  return typeof Blob < "u" && s instanceof Blob ? s : s instanceof ArrayBuffer ? new Blob([s]) : typeof s == "object" && s !== null && "kind" in s && s.kind === "buffer" ? new Blob([s.buffer]) : null;
6369
6411
  }
6370
- function Js(s) {
6412
+ function cn(s) {
6371
6413
  var t;
6372
- const e = Nt(s);
6414
+ const e = Vt(s);
6373
6415
  if (e)
6374
6416
  try {
6375
6417
  return decodeURIComponent(new URL(e, "https://viewer.invalid/").pathname.split("/").pop() || "") || null;
@@ -6378,7 +6420,7 @@ function Js(s) {
6378
6420
  }
6379
6421
  return Ae(s) ? s.entry ?? null : typeof File < "u" && s instanceof File && s.name || null;
6380
6422
  }
6381
- function Qs(s) {
6423
+ function un(s) {
6382
6424
  var e;
6383
6425
  if (!s) return null;
6384
6426
  try {
@@ -6390,11 +6432,11 @@ function Qs(s) {
6390
6432
  function Ae(s) {
6391
6433
  return typeof s == "object" && s !== null && "kind" in s && s.kind === "files";
6392
6434
  }
6393
- function en(s, e, t) {
6435
+ function hn(s, e, t) {
6394
6436
  if (e) {
6395
6437
  const i = V(e);
6396
6438
  if (!s.some((r) => V(r.path) === i))
6397
- throw pt(`Asset package entry not found: ${e}`, "E_ASSET_ENTRY_NOT_FOUND");
6439
+ throw vt(`Asset package entry not found: ${e}`, "E_ASSET_ENTRY_NOT_FOUND");
6398
6440
  return i;
6399
6441
  }
6400
6442
  if (t) {
@@ -6402,9 +6444,9 @@ function en(s, e, t) {
6402
6444
  if (s.filter((n) => V(n.path) === i).length === 1) return i;
6403
6445
  }
6404
6446
  if (s.length === 1) return V(s[0].path);
6405
- throw pt("Asset package has multiple files; specify an entry.", "E_ASSET_AMBIGUOUS_ENTRY");
6447
+ throw vt("Asset package has multiple files; specify an entry.", "E_ASSET_AMBIGUOUS_ENTRY");
6406
6448
  }
6407
- function tn(s, e, t) {
6449
+ function pn(s, e, t) {
6408
6450
  if (!s || !e) return;
6409
6451
  const i = e.lastIndexOf("/"), r = i < 0 ? "" : e.slice(0, i + 1);
6410
6452
  return s.get(V(`${r}${t}`));
@@ -6415,13 +6457,13 @@ function V(s) {
6415
6457
  !t || t === "." || (t === ".." ? e.pop() : e.push(t));
6416
6458
  return e.join("/");
6417
6459
  }
6418
- async function rn(s, e, t) {
6460
+ async function fn(s, e, t) {
6419
6461
  return s ? s.resolve(e, { signal: t }) : null;
6420
6462
  }
6421
- function pt(s, e) {
6463
+ function vt(s, e) {
6422
6464
  return Object.assign(new Error(s), { code: e });
6423
6465
  }
6424
- const ft = Object.freeze({
6466
+ const gt = Object.freeze({
6425
6467
  canPlay: !1,
6426
6468
  canPause: !1,
6427
6469
  canReset: !1,
@@ -6431,8 +6473,8 @@ const ft = Object.freeze({
6431
6473
  }), q = Object.freeze({
6432
6474
  light: 15265002,
6433
6475
  dark: 593167
6434
- }), sn = 0.05;
6435
- class nn {
6476
+ }), mn = 0.05;
6477
+ class vn {
6436
6478
  constructor(e) {
6437
6479
  u(this, "epoch", 0);
6438
6480
  u(this, "active", null);
@@ -6563,7 +6605,7 @@ class nn {
6563
6605
  var r;
6564
6606
  const t = this.active;
6565
6607
  if (!t || !this.current(t) || t.snapshot.phase !== "ready" || !t.dynamic || !t.playing || !((r = t.session) != null && r.update)) return !1;
6566
- const i = t.resetFrameClock ? 0 : Math.max(0, Math.min(Number.isNaN(e) ? 0 : e, sn));
6608
+ const i = t.resetFrameClock ? 0 : Math.max(0, Math.min(Number.isNaN(e) ? 0 : e, mn));
6567
6609
  t.resetFrameClock = !1;
6568
6610
  try {
6569
6611
  return !!(t.session.update(i) && this.current(t) && t.snapshot.phase === "ready" && t.playing);
@@ -6578,7 +6620,7 @@ class nn {
6578
6620
  var i, r;
6579
6621
  try {
6580
6622
  if (!this.current(e)) return;
6581
- e.source = Xs(t, e.options, e.abort.signal);
6623
+ e.source = nn(t, e.options, e.abort.signal);
6582
6624
  const n = e.source.signal, a = () => {
6583
6625
  this.stop(e, "E_ABORTED");
6584
6626
  };
@@ -6586,7 +6628,7 @@ class nn {
6586
6628
  a();
6587
6629
  return;
6588
6630
  }
6589
- const o = this.detect(e), l = mt(o) ? await o : o;
6631
+ const o = this.detect(e), l = bt(o) ? await o : o;
6590
6632
  if (!this.current(e) || (e.loader = l.loader, !this.current(e))) return;
6591
6633
  if (!this.host.loaders().includes(l.loader))
6592
6634
  throw T("Asset loader was removed.", "E_ABORTED");
@@ -6610,22 +6652,22 @@ class nn {
6610
6652
  requestRender: () => {
6611
6653
  this.current(e) && this.host.requestRender();
6612
6654
  },
6613
- fit: (m, v) => this.current(e) ? this.host.fit(m, v) : !1,
6614
- reportError: (m, v) => this.report(e, m, v),
6655
+ fit: (v, y) => this.current(e) ? this.host.fit(v, y) : !1,
6656
+ reportError: (v, y) => this.report(e, v, y),
6615
6657
  reportSessionState: () => {
6616
- var v;
6658
+ var y;
6617
6659
  if (!this.current(e) || e.snapshot.phase !== "ready" || !e.session) return;
6618
- const m = e.session;
6619
- m.isPlaying && (e.playing = m.isPlaying()), ((v = m.physics) == null ? void 0 : v.status) === "unavailable" && (e.playing = !1, e.resetFrameClock = !1, this.endGrabOf(e)), this.transition(e, {
6620
- capabilities: m.capabilities ?? ft,
6621
- physics: m.physics ?? null,
6622
- warning: m.warning ?? null
6660
+ const v = e.session;
6661
+ v.isPlaying && (e.playing = v.isPlaying()), ((y = v.physics) == null ? void 0 : y.status) === "unavailable" && (e.playing = !1, e.resetFrameClock = !1, this.endGrabOf(e)), this.transition(e, {
6662
+ capabilities: v.capabilities ?? gt,
6663
+ physics: v.physics ?? null,
6664
+ warning: v.warning ?? null
6623
6665
  }), this.publishControl(e), this.host.requestRender();
6624
6666
  },
6625
- reportProgress: (m, v) => {
6626
- this.current(e) && e.snapshot.phase === "loading" && this.transition(e, { stage: m, message: v });
6667
+ reportProgress: (v, y) => {
6668
+ this.current(e) && e.snapshot.phase === "loading" && this.transition(e, { stage: v, message: y });
6627
6669
  }
6628
- }, h = l.loader.createSession(e.source, p), f = mt(h) ? await h : h;
6670
+ }, h = l.loader.createSession(e.source, p), f = bt(h) ? await h : h;
6629
6671
  if (e.session && e.session !== f) {
6630
6672
  f.beginDispose(), await f.dispose();
6631
6673
  return;
@@ -6634,20 +6676,20 @@ class nn {
6634
6676
  this.beginDispose(e);
6635
6677
  return;
6636
6678
  }
6637
- if (await Promise.race([f.opened, new Promise((m) => {
6638
- n.aborted ? m() : n.addEventListener("abort", () => m(), { once: !0 });
6679
+ if (await Promise.race([f.opened, new Promise((v) => {
6680
+ n.aborted ? v() : n.addEventListener("abort", () => v(), { once: !0 });
6639
6681
  })]), !this.current(e) || e.snapshot.phase === "failed") return;
6640
6682
  if (f.root) {
6641
6683
  if (e.mounted = f.root, this.host.mount(f.root), !this.current(e)) return;
6642
6684
  if (((i = f.presentation ?? l.loader.presentation) == null ? void 0 : i.fitPolicy) === "fit-on-ready") {
6643
- const m = ((r = f.getFitBounds) == null ? void 0 : r.call(f)) ?? f.fitTarget ?? f.root;
6644
- if (!this.host.fit(m, { padding: 1.15 })) throw T("Asset has no displayable geometry.", "E_ASSET_EMPTY");
6685
+ const v = ((r = f.getFitBounds) == null ? void 0 : r.call(f)) ?? f.fitTarget ?? f.root;
6686
+ if (!this.host.fit(v, { padding: 1.15 })) throw T("Asset has no displayable geometry.", "E_ASSET_EMPTY");
6645
6687
  }
6646
6688
  }
6647
6689
  if (!this.current(e)) return;
6648
6690
  e.dynamic = typeof f.update == "function", e.playing = e.dynamic && f.autoPlay !== !1, e.resetFrameClock = e.playing, this.transition(e, {
6649
6691
  phase: "ready",
6650
- capabilities: f.capabilities ?? ft,
6692
+ capabilities: f.capabilities ?? gt,
6651
6693
  warning: f.warning ?? null,
6652
6694
  physics: f.physics ?? null
6653
6695
  }), this.current(e) && e.snapshot.phase === "ready" && e.ready.resolve();
@@ -6658,7 +6700,7 @@ class nn {
6658
6700
  }
6659
6701
  }
6660
6702
  detect(e) {
6661
- const t = e.source, i = this.host.loaders(), r = e.options.format, n = Ws(t), a = r && r !== "auto" ? r : n && ["dxb", "dxb3"].includes(n) ? "cad" : n;
6703
+ const t = e.source, i = this.host.loaders(), r = e.options.format, n = an(t), a = r && r !== "auto" ? r : n && ["dxb", "dxb3"].includes(n) ? "cad" : n;
6662
6704
  if (a) {
6663
6705
  const o = i.find((l) => l.formats.includes(a));
6664
6706
  if (o) return { loader: o, format: a };
@@ -6673,7 +6715,7 @@ class nn {
6673
6715
  const a = t[n], o = await ((r = a.match) == null ? void 0 : r.call(a, e.source));
6674
6716
  if (o && o.format !== "auto" && a.formats.includes(o.format)) return { loader: a, format: o.format };
6675
6717
  }
6676
- throw T("Unable to determine asset format; specify format explicitly.", "E_ASSET_UNKNOWN_FORMAT");
6718
+ throw T("Unable to determine asset format automatically; provide a supported filename or specify format explicitly.", "E_ASSET_UNKNOWN_FORMAT");
6677
6719
  }
6678
6720
  stop(e, t) {
6679
6721
  var i;
@@ -6958,10 +7000,10 @@ function ye() {
6958
7000
  function T(s, e) {
6959
7001
  return Object.assign(new Error(s), { code: e, ...e === "E_ABORTED" || e === "E_SUPERSEDED" ? { name: "AbortError" } : {} });
6960
7002
  }
6961
- function mt(s) {
7003
+ function bt(s) {
6962
7004
  return !!(s && typeof s.then == "function");
6963
7005
  }
6964
- const an = {
7006
+ const gn = {
6965
7007
  id: "nebula-asset-model",
6966
7008
  activate(s) {
6967
7009
  s.contribute({
@@ -6979,13 +7021,13 @@ const an = {
6979
7021
  clearColor: q.dark
6980
7022
  },
6981
7023
  async createSession(e, t) {
6982
- const { createModelSession: i } = await import("./session-DN0DckL_.js");
7024
+ const { createModelSession: i } = await import("./session-BvgzEStG.js");
6983
7025
  return i(e, t);
6984
7026
  }
6985
7027
  });
6986
7028
  }
6987
7029
  };
6988
- function on(s, e, t) {
7030
+ function bn(s, e, t) {
6989
7031
  let i = !1, r = !1;
6990
7032
  const n = {
6991
7033
  ...t.options.cad,
@@ -7014,7 +7056,7 @@ function on(s, e, t) {
7014
7056
  }
7015
7057
  };
7016
7058
  }
7017
- function ln(s) {
7059
+ function yn(s) {
7018
7060
  return {
7019
7061
  id: "nebula-asset-cad",
7020
7062
  activate(e) {
@@ -7029,24 +7071,24 @@ function ln(s) {
7029
7071
  uiProfile: "cad",
7030
7072
  fitPolicy: "restore-then-fit"
7031
7073
  },
7032
- createSession: (t, i) => on(s, t, i)
7074
+ createSession: (t, i) => bn(s, t, i)
7033
7075
  });
7034
7076
  }
7035
7077
  };
7036
7078
  }
7037
- function dn(s) {
7079
+ function xn(s) {
7038
7080
  const e = s.replace(/^\uFEFF/, "").replace(/^\s*(?:<\?[\s\S]*?\?>\s*)?/, "").replace(/^(?:<!--[\s\S]*?-->\s*)*/, "");
7039
7081
  return /^<\s*mujoco(?:\s|>)/i.test(e) ? "mjcf" : /^<\s*robot(?:\s|>)/i.test(e) ? "urdf" : null;
7040
7082
  }
7041
- async function cn(s) {
7083
+ async function wn(s) {
7042
7084
  const e = s.entryPath ?? s.filename ?? s.url ?? "";
7043
7085
  if (!e.toLowerCase().split(/[?#]/, 1)[0].endsWith(".xml")) return null;
7044
7086
  const t = await s.resolve(e), i = await fetch(t, { signal: s.signal });
7045
7087
  if (!i.ok) return null;
7046
- const r = dn(await i.text());
7088
+ const r = xn(await i.text());
7047
7089
  return r ? { format: r } : null;
7048
7090
  }
7049
- const un = {
7091
+ const Cn = {
7050
7092
  id: "nebula-asset-simulation",
7051
7093
  activate(s) {
7052
7094
  s.contribute({
@@ -7054,7 +7096,7 @@ const un = {
7054
7096
  id: "nebula.simulation-loader",
7055
7097
  assetKind: "simulation",
7056
7098
  formats: ["urdf", "xacro", "mjcf", "usd", "usda", "usdc", "usdz"],
7057
- match: cn,
7099
+ match: wn,
7058
7100
  presentation: {
7059
7101
  preferredViewMode: "3d",
7060
7102
  interactionMode: "simulation",
@@ -7063,12 +7105,12 @@ const un = {
7063
7105
  clearColor: q.dark
7064
7106
  },
7065
7107
  async createSession(e, t) {
7066
- const { createSimulationSession: i } = await import("./session-BaKbYHiJ.js").then((r) => r.f);
7108
+ const { createSimulationSession: i } = await import("./session-BhTeAhTq.js").then((r) => r.f);
7067
7109
  return i(e, t);
7068
7110
  }
7069
7111
  });
7070
7112
  }
7071
- }, ae = "viewer:highlight", U = "viewer:cad-selection", j = "viewer:cad-hover", vt = {
7113
+ }, ae = "viewer:highlight", U = "viewer:cad-selection", j = "viewer:cad-hover", yt = {
7072
7114
  dark: {
7073
7115
  hover: { color: 3528703, fillOpacity: 0, edgeOpacity: 0.85 },
7074
7116
  selected: { color: 5999871, fillOpacity: 0.24, edgeOpacity: 1 }
@@ -7077,8 +7119,8 @@ const un = {
7077
7119
  hover: { color: 24524, fillOpacity: 0, edgeOpacity: 0.95 },
7078
7120
  selected: { color: 24524, fillOpacity: 0.2, edgeOpacity: 1 }
7079
7121
  }
7080
- }, hn = 6, pn = 12, fn = 160, mn = 160, vn = 50, gt = 592655;
7081
- class gn {
7122
+ }, Sn = 6, En = 12, kn = 160, Pn = 160, An = 50, xt = 592655;
7123
+ class Mn {
7082
7124
  constructor(e, t) {
7083
7125
  u(this, "cad");
7084
7126
  u(this, "mountedObjects", /* @__PURE__ */ new Set());
@@ -7094,9 +7136,9 @@ class gn {
7094
7136
  u(this, "interactionRenderLastTs", null);
7095
7137
  u(this, "cadHoveredInsert", null);
7096
7138
  u(this, "cadPointerPosition", null);
7097
- u(this, "pointerDragTracker", new Er({
7098
- distancePx: hn,
7099
- pathPx: pn
7139
+ u(this, "pointerDragTracker", new zr({
7140
+ distancePx: Sn,
7141
+ pathPx: En
7100
7142
  }));
7101
7143
  u(this, "cadCapability");
7102
7144
  u(this, "cadHost");
@@ -7221,17 +7263,17 @@ class gn {
7221
7263
  u(this, "handlePointerLeave", (e) => {
7222
7264
  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));
7223
7265
  });
7224
- var i, r, n, a, o, l, d, c, p, h, f, m, v, b, y;
7225
- this.options = e, this.runtime = t, this.cameraStateStore = e.cameraStateStore === !1 ? void 0 : e.cameraStateStore ?? nr(), this.interactionMode = e.cadInteraction ?? "managed", e.previewDragPreset && this.runtime.setPreviewDragPreset(e.previewDragPreset), this.uiTheme = ((i = e.ui) == null ? void 0 : i.theme) ?? "dark", this.cadHost = this.createCadHost(), this.cadCapability = new br(this.cadHost), this.cad = this.cadCapability, this.cadCapability.open = async (g, x = {}) => {
7266
+ var i, r, n, a, o, l, d, c, p, h, f, v, y, m, b;
7267
+ this.options = e, this.runtime = t, this.cameraStateStore = e.cameraStateStore === !1 ? void 0 : e.cameraStateStore ?? hr(), this.interactionMode = e.cadInteraction ?? "managed", e.previewDragPreset && this.runtime.setPreviewDragPreset(e.previewDragPreset), this.uiTheme = ((i = e.ui) == null ? void 0 : i.theme) ?? "dark", this.cadHost = this.createCadHost(), this.cadCapability = new Ir(this.cadHost), this.cad = this.cadCapability, this.cadCapability.open = async (g, x = {}) => {
7226
7268
  this.assertActive();
7227
- const { filename: w, signal: k, ...F } = x;
7228
- await this.assetController.open(g, { format: "cad", filename: w, signal: k, cad: F }, !0).ready;
7269
+ const { filename: w, signal: C, ...D } = x;
7270
+ await this.assetController.open(g, { format: "cad", filename: w, signal: C, cad: D }, !0).ready;
7229
7271
  const A = this.cadCapability.document;
7230
7272
  if (!A) throw Object.assign(new Error("CAD open superseded"), { code: "E_SUPERSEDED", name: "AbortError" });
7231
7273
  return A;
7232
7274
  }, this.cadCapability.close = () => {
7233
7275
  this.assertActive(), this.assetController.closeKind("cad");
7234
- }, this.initialCameraSnapshot = t.captureCameraSnapshot(), this.lastCameraFingerprint = xe(this.initialCameraSnapshot), this.layoutEngine = this.createLayoutEngine(), this.pluginManager = new qs(
7276
+ }, this.initialCameraSnapshot = t.captureCameraSnapshot(), this.lastCameraFingerprint = xe(this.initialCameraSnapshot), this.layoutEngine = this.createLayoutEngine(), this.pluginManager = new rn(
7235
7277
  () => this.cadCapability.getSnapshot(),
7236
7278
  () => ({
7237
7279
  viewMode: this.runtime.viewMode,
@@ -7265,7 +7307,7 @@ class gn {
7265
7307
  e.viewport,
7266
7308
  this.layoutEngine,
7267
7309
  () => this.assetController.getActiveInspection()
7268
- ), this.assetController = new nn({
7310
+ ), this.assetController = new vn({
7269
7311
  loaders: () => this.pluginManager.getAssetLoaders(),
7270
7312
  mount: (g) => this.mountAssetObject(g),
7271
7313
  detach: (g) => this.unmountAssetObject(g),
@@ -7278,14 +7320,14 @@ class gn {
7278
7320
  cleanupError: (g) => {
7279
7321
  this.options.onCleanupError ? this.options.onCleanupError(g) : console.error("[viewer] asset cleanup failed", g);
7280
7322
  }
7281
- }), this.pluginManager.registerBuiltin(ln(this.cadCapability)), this.pluginManager.registerBuiltin(an), this.pluginManager.registerBuiltin(un), this.pluginManager.onAssetLoaderRemoved((g) => this.assetController.removeLoader(g)), this.cadInspectorUnsubscribe = this.cad.on("inspector-change", () => {
7323
+ }), this.pluginManager.registerBuiltin(yn(this.cadCapability)), this.pluginManager.registerBuiltin(gn), this.pluginManager.registerBuiltin(Cn), this.pluginManager.onAssetLoaderRemoved((g) => this.assetController.removeLoader(g)), this.cadInspectorUnsubscribe = this.cad.on("inspector-change", () => {
7282
7324
  this.interactionMode === "managed" && (this.syncCadSelectionOverlay(), this.syncCadHoverOverlay()), this.dispatchCadSelectionChange();
7283
7325
  }), this.cadDocumentUnsubscribe = this.cad.on("document-change", () => {
7284
7326
  this.setCadHoveredInsert(null), this.interactionMode === "managed" && this.syncCadSelectionOverlay();
7285
7327
  }), this.assetChangeUnsubscribe = this.on("asset-change", (g) => {
7286
7328
  const x = g.snapshot.phase;
7287
7329
  (x === "closing" || x === "failed" || x === "closed") && this.endAssetGrab();
7288
- }), e.ui && e.ui.preset !== "none" && (e.ui.preset !== "cad-readonly" && this.interactionMode === "managed" && this.pluginManager.registerBuiltin(vs(
7330
+ }), e.ui && e.ui.preset !== "none" && (e.ui.preset !== "cad-readonly" && this.interactionMode === "managed" && this.pluginManager.registerBuiltin(As(
7289
7331
  {
7290
7332
  mountBuiltin: (g, x) => this.layoutEngine.mountBuiltin(g, x),
7291
7333
  shadowRoot: () => this.builtinUiShadow(),
@@ -7297,7 +7339,7 @@ class gn {
7297
7339
  label: (g) => g === "simulation" ? "仿真控制" : "模型控制",
7298
7340
  scene: e.ui.scene
7299
7341
  }
7300
- )), e.ui.urdf !== !1 && this.interactionMode === "managed" && this.pluginManager.registerBuiltin(js({
7342
+ )), e.ui.urdf !== !1 && this.interactionMode === "managed" && this.pluginManager.registerBuiltin(en({
7301
7343
  interactionCanvas: () => this.options.canvas,
7302
7344
  interactionCamera: () => this.runtime.getActiveCamera(),
7303
7345
  cameraQuaternion: () => this.runtime.getActiveCamera().quaternion.clone(),
@@ -7308,13 +7350,13 @@ class gn {
7308
7350
  })), this.interactionMode === "managed" && this.pluginManager.register({
7309
7351
  id: "nebula.ui.cad",
7310
7352
  activate: () => {
7311
- this.ui = new ts(this.createUiHost(), e.ui), this.ui.mount();
7353
+ this.ui = new hs(this.createUiHost(), e.ui), this.ui.mount();
7312
7354
  },
7313
7355
  deactivate: () => {
7314
7356
  var g;
7315
7357
  (g = this.ui) == null || g.dispose(), this.ui = null;
7316
7358
  }
7317
- })), (n = (r = this.options.canvas).addEventListener) == null || n.call(r, "pointerdown", this.handlePointerDown), (o = (a = this.options.canvas).addEventListener) == null || o.call(a, "pointermove", this.handlePointerMove), (d = (l = this.options.canvas).addEventListener) == null || d.call(l, "pointerup", this.handlePointerUp), (p = (c = this.options.canvas).addEventListener) == null || p.call(c, "pointercancel", this.handlePointerCancel), (f = (h = this.options.canvas).addEventListener) == null || f.call(h, "pointerleave", this.handlePointerLeave), (v = (m = this.options.canvas).addEventListener) == null || v.call(m, "lostpointercapture", this.handleLostPointerCapture), (y = (b = this.options.canvas).addEventListener) == null || y.call(b, "wheel", this.handleWheel, { passive: !0 }), typeof globalThis.window < "u" && globalThis.window.addEventListener("blur", this.handleWindowBlur), typeof ResizeObserver == "function" && Cn(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({
7359
+ })), (n = (r = this.options.canvas).addEventListener) == null || n.call(r, "pointerdown", this.handlePointerDown), (o = (a = this.options.canvas).addEventListener) == null || o.call(a, "pointermove", this.handlePointerMove), (d = (l = this.options.canvas).addEventListener) == null || d.call(l, "pointerup", this.handlePointerUp), (p = (c = this.options.canvas).addEventListener) == null || p.call(c, "pointercancel", this.handlePointerCancel), (f = (h = this.options.canvas).addEventListener) == null || f.call(h, "pointerleave", this.handlePointerLeave), (y = (v = this.options.canvas).addEventListener) == null || y.call(v, "lostpointercapture", this.handleLostPointerCapture), (b = (m = this.options.canvas).addEventListener) == null || b.call(m, "wheel", this.handleWheel, { passive: !0 }), typeof globalThis.window < "u" && globalThis.window.addEventListener("blur", this.handleWindowBlur), typeof ResizeObserver == "function" && Dn(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({
7318
7360
  renderExtension: { beforeRender: (g, x, w) => this.assetController.beforeRender(g, x, w) },
7319
7361
  onFrame: (g, x) => {
7320
7362
  this.assetController.update(x) && this.runtime.requestRender();
@@ -7412,7 +7454,7 @@ class gn {
7412
7454
  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());
7413
7455
  }
7414
7456
  fitView(e, t) {
7415
- this.assertActive(), e && !(e instanceof N) && this.assertMounted(e);
7457
+ this.assertActive(), e && !(e instanceof F) && this.assertMounted(e);
7416
7458
  const i = e ?? this.assetController.getActiveFitBounds() ?? this.pluginManager.findFitPolicy() ?? this.resolveMixedBounds();
7417
7459
  if (!i) return !1;
7418
7460
  const r = this.runtime.fitView(i, t);
@@ -7446,7 +7488,7 @@ class gn {
7446
7488
  setHighlight(e, t = {}) {
7447
7489
  if (this.assertActive(), e && this.assertMounted(e), !(this.highlightedObjectValue === null && e === null)) {
7448
7490
  if (this.runtime.removeOverlay(ae), this.highlightedObjectValue = e, e) {
7449
- const i = new Kt(e, t.color ?? 6000111);
7491
+ const i = new Jt(e, t.color ?? 6000111);
7450
7492
  i.name = ae, this.runtime.mountOverlay(ae, i, { owned: !0 });
7451
7493
  }
7452
7494
  this.emit("highlight-change", { object: e });
@@ -7473,14 +7515,14 @@ class gn {
7473
7515
  this.assertActive(), this.pluginManager.use(e, t);
7474
7516
  }
7475
7517
  dispose() {
7476
- var e, t, i, r, n, a, o, l, d, c, p, h, f, m, v;
7518
+ var e, t, i, r, n, a, o, l, d, c, p, h, f, v, y;
7477
7519
  if (!this.disposed) {
7478
- 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), (r = (i = this.options.canvas).removeEventListener) == null || r.call(i, "pointermove", this.handlePointerMove), (a = (n = this.options.canvas).removeEventListener) == null || a.call(n, "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), (m = (f = this.options.canvas).removeEventListener) == null || m.call(f, "wheel", this.handleWheel), typeof globalThis.window < "u" && (globalThis.window.removeEventListener("blur", this.handleWindowBlur), this.usingWindowResizeFallback && globalThis.window.removeEventListener("resize", this.handleViewportResize)), (v = this.viewportResizeObserver) == null || v.disconnect(), this.pointerStart = null, this.cadPointerPosition = null, this.setCadHoveredInsert(null), this.setCanvasCursor(""), this.highlightedObjectValue && this.runtime.removeOverlay(ae), this.runtime.removeOverlay(U), this.runtime.removeOverlay(j), this.cadInspectorUnsubscribe(), this.cadDocumentUnsubscribe(), this.assetChangeUnsubscribe(), this.highlightedObjectValue = null, this.selectedObjectValue = null;
7479
- for (const b of this.mountedObjects)
7480
- this.runtime.removeObject(b, { dispose: !1 });
7520
+ 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), (r = (i = this.options.canvas).removeEventListener) == null || r.call(i, "pointermove", this.handlePointerMove), (a = (n = this.options.canvas).removeEventListener) == null || a.call(n, "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), (v = (f = this.options.canvas).removeEventListener) == null || v.call(f, "wheel", this.handleWheel), typeof globalThis.window < "u" && (globalThis.window.removeEventListener("blur", this.handleWindowBlur), this.usingWindowResizeFallback && globalThis.window.removeEventListener("resize", this.handleViewportResize)), (y = this.viewportResizeObserver) == null || y.disconnect(), this.pointerStart = null, this.cadPointerPosition = null, this.setCadHoveredInsert(null), this.setCanvasCursor(""), this.highlightedObjectValue && this.runtime.removeOverlay(ae), this.runtime.removeOverlay(U), this.runtime.removeOverlay(j), this.cadInspectorUnsubscribe(), this.cadDocumentUnsubscribe(), this.assetChangeUnsubscribe(), this.highlightedObjectValue = null, this.selectedObjectValue = null;
7521
+ for (const m of this.mountedObjects)
7522
+ this.runtime.removeObject(m, { dispose: !1 });
7481
7523
  this.mountedObjects.clear();
7482
- for (const b of this.mountedAssetObjects)
7483
- this.runtime.removeObject(b, { dispose: !1 });
7524
+ for (const m of this.mountedAssetObjects)
7525
+ this.runtime.removeObject(m, { dispose: !1 });
7484
7526
  this.mountedAssetObjects.clear(), this.cadCapability.dispose(), this.layoutEngine.dispose(), this.listeners.clear(), this.runtime.dispose();
7485
7527
  }
7486
7528
  }
@@ -7500,7 +7542,7 @@ class gn {
7500
7542
  createLayoutEngine() {
7501
7543
  var r;
7502
7544
  const e = this, t = this.options, i = (r = t.ui) == null ? void 0 : r.insetTarget;
7503
- return new ns({
7545
+ return new vs({
7504
7546
  reference: () => {
7505
7547
  var n;
7506
7548
  return ((n = t.ui) == null ? void 0 : n.root) ?? t.viewport;
@@ -7544,7 +7586,7 @@ class gn {
7544
7586
  */
7545
7587
  resetAssetPresentation() {
7546
7588
  var e;
7547
- this.runtime.setClearColor(this.options.clearColor ?? gt), this.runtime.setNavigationPolicy("viewer"), this.interactionMode = this.options.cadInteraction ?? "managed", (e = this.ui) == null || e.setActive(!1), this.interactionMode !== "managed" ? (this.setCadHoveredInsert(null), this.runtime.removeOverlay(U), this.runtime.removeOverlay(j), this.cadCapability.clearSelection()) : this.syncCadSelectionOverlay(), this.runtime.requestRender();
7589
+ this.runtime.setClearColor(this.options.clearColor ?? xt), this.runtime.setNavigationPolicy("viewer"), this.interactionMode = this.options.cadInteraction ?? "managed", (e = this.ui) == null || e.setActive(!1), this.interactionMode !== "managed" ? (this.setCadHoveredInsert(null), this.runtime.removeOverlay(U), this.runtime.removeOverlay(j), this.cadCapability.clearSelection()) : this.syncCadSelectionOverlay(), this.runtime.requestRender();
7548
7590
  }
7549
7591
  createCadHost() {
7550
7592
  const e = this;
@@ -7565,7 +7607,7 @@ class gn {
7565
7607
  return e.cadCapability.getVisibilityRevision();
7566
7608
  },
7567
7609
  get viewportDemandCoalesceMs() {
7568
- return e.options.viewportDemandCoalesceMs ?? mn;
7610
+ return e.options.viewportDemandCoalesceMs ?? Pn;
7569
7611
  },
7570
7612
  mountCadObject(t) {
7571
7613
  e.unmountCadObject(), e.runtime.addObject(t, { owned: !0 }), e.cadRenderRoot = t;
@@ -7604,10 +7646,10 @@ class gn {
7604
7646
  return ((n = e.runtime.screenToWorldOnPlane(t, i, r)) == null ? void 0 : n.clone()) ?? null;
7605
7647
  },
7606
7648
  readCameraSnapshot(t) {
7607
- return or(e.cameraStateStore, t);
7649
+ return fr(e.cameraStateStore, t);
7608
7650
  },
7609
7651
  persistCameraSnapshot(t, i) {
7610
- lr(e.cameraStateStore, t, i);
7652
+ mr(e.cameraStateStore, t, i);
7611
7653
  },
7612
7654
  getViewportSize() {
7613
7655
  return {
@@ -7628,12 +7670,12 @@ class gn {
7628
7670
  e.details.bbox.minY,
7629
7671
  e.details.bbox.maxX,
7630
7672
  e.details.bbox.maxY
7631
- ].every(Number.isFinite) ? e.details.bbox : null, i = t ? new N(
7632
- new S(t.minX, t.minY, -0.01),
7633
- new S(t.maxX, t.maxY, 0.01)
7634
- ) : e.textDetails ? new N(
7635
- new S(e.textDetails.x, e.textDetails.y, -0.01),
7636
- new S(
7673
+ ].every(Number.isFinite) ? e.details.bbox : null, i = t ? new F(
7674
+ new E(t.minX, t.minY, -0.01),
7675
+ new E(t.maxX, t.maxY, 0.01)
7676
+ ) : e.textDetails ? new F(
7677
+ new E(e.textDetails.x, e.textDetails.y, -0.01),
7678
+ new E(
7637
7679
  e.textDetails.x + e.textDetails.content.length * e.textDetails.height * 0.6,
7638
7680
  e.textDetails.y + e.textDetails.height,
7639
7681
  0.01
@@ -7642,7 +7684,7 @@ class gn {
7642
7684
  if (!i || i.isEmpty()) return;
7643
7685
  const r = !!((o = e.details) != null && o.bbox);
7644
7686
  if (((d = (l = this.options.cadInteractionStyle) == null ? void 0 : l.selected) == null ? void 0 : d.enabled) === !1) return;
7645
- const n = r ? this.createCadInteractionOverlay(i, "selected") : new Zt(i, ((p = (c = this.options.cadInteractionStyle) == null ? void 0 : c.selected) == null ? void 0 : p.color) ?? vt.dark.selected.color);
7687
+ const n = r ? this.createCadInteractionOverlay(i, "selected") : new Qt(i, ((p = (c = this.options.cadInteractionStyle) == null ? void 0 : c.selected) == null ? void 0 : p.color) ?? yt.dark.selected.color);
7646
7688
  n.name = U, this.runtime.mountOverlay(U, n, { owned: !0 });
7647
7689
  }
7648
7690
  dispatchCadSelectionChange() {
@@ -7661,17 +7703,17 @@ class gn {
7661
7703
  }
7662
7704
  createCadInteractionOverlay(e, t) {
7663
7705
  var h, f;
7664
- const i = ((h = this.options.ui) == null ? void 0 : h.theme) === "light" ? "light" : "dark", r = vt[i][t], n = (f = this.options.cadInteractionStyle) == null ? void 0 : f[t], a = {
7706
+ const i = ((h = this.options.ui) == null ? void 0 : h.theme) === "light" ? "light" : "dark", r = yt[i][t], n = (f = this.options.cadInteractionStyle) == null ? void 0 : f[t], a = {
7665
7707
  color: (n == null ? void 0 : n.color) ?? r.color,
7666
7708
  fillOpacity: (n == null ? void 0 : n.fillOpacity) ?? r.fillOpacity,
7667
7709
  edgeOpacity: (n == null ? void 0 : n.edgeOpacity) ?? r.edgeOpacity
7668
- }, o = new xt();
7710
+ }, o = new St();
7669
7711
  o.name = t === "hover" ? "cad-insert-hover" : "cad-insert-selected", o.renderOrder = t === "hover" ? 1300 : 1310;
7670
- const l = e.getSize(new S()), d = e.getCenter(new S()), c = new Jt(Math.max(l.x, 1e-6), Math.max(l.y, 1e-6), Math.max(l.z, 1e-3));
7712
+ const l = e.getSize(new E()), d = e.getCenter(new E()), c = new ei(Math.max(l.x, 1e-6), Math.max(l.y, 1e-6), Math.max(l.z, 1e-3));
7671
7713
  if (a.fillOpacity > 0) {
7672
- const m = new Qt(
7714
+ const v = new ti(
7673
7715
  c.clone(),
7674
- new ei({
7716
+ new ii({
7675
7717
  color: a.color,
7676
7718
  transparent: !0,
7677
7719
  opacity: a.fillOpacity,
@@ -7679,11 +7721,11 @@ class gn {
7679
7721
  depthWrite: !1
7680
7722
  })
7681
7723
  );
7682
- m.name = `${o.name}:fill`, m.position.copy(d), m.renderOrder = 1305, o.add(m);
7724
+ v.name = `${o.name}:fill`, v.position.copy(d), v.renderOrder = 1305, o.add(v);
7683
7725
  }
7684
- const p = new ti(
7685
- new ii(c),
7686
- new ri({
7726
+ const p = new ri(
7727
+ new si(c),
7728
+ new ni({
7687
7729
  color: a.color,
7688
7730
  transparent: !0,
7689
7731
  opacity: a.edgeOpacity,
@@ -7695,9 +7737,9 @@ class gn {
7695
7737
  }
7696
7738
  cadInsertDetailsToBox(e) {
7697
7739
  const t = e == null ? void 0 : e.bbox;
7698
- return !t || ![t.minX, t.minY, t.maxX, t.maxY].every(Number.isFinite) ? null : new N(
7699
- new S(t.minX, t.minY, -0.01),
7700
- new S(t.maxX, t.maxY, 0.01)
7740
+ return !t || ![t.minX, t.minY, t.maxX, t.maxY].every(Number.isFinite) ? null : new F(
7741
+ new E(t.minX, t.minY, -0.01),
7742
+ new E(t.maxX, t.maxY, 0.01)
7701
7743
  );
7702
7744
  }
7703
7745
  isSameCadInsertSelection(e, t) {
@@ -7785,14 +7827,14 @@ class gn {
7785
7827
  this.resetAssetPresentation();
7786
7828
  return;
7787
7829
  }
7788
- this.runtime.setClearColor(e.clearColor ?? this.options.clearColor ?? gt), this.runtime.setNavigationPolicy(
7830
+ this.runtime.setClearColor(e.clearColor ?? this.options.clearColor ?? xt), this.runtime.setNavigationPolicy(
7789
7831
  e.interactionMode === "object" || e.interactionMode === "simulation" ? "preview" : "viewer"
7790
- ), 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(yn(e.uiProfile)), (t = this.ui) == null || t.setActive(e.uiProfile === "cad"), this.interactionMode !== "managed" ? (this.setCadHoveredInsert(null), this.runtime.removeOverlay(U), this.runtime.removeOverlay(j), this.cadCapability.clearSelection()) : this.syncCadSelectionOverlay();
7832
+ ), 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(Rn(e.uiProfile)), (t = this.ui) == null || t.setActive(e.uiProfile === "cad"), this.interactionMode !== "managed" ? (this.setCadHoveredInsert(null), this.runtime.removeOverlay(U), this.runtime.removeOverlay(j), this.cadCapability.clearSelection()) : this.syncCadSelectionOverlay();
7791
7833
  }
7792
7834
  resolveMixedBounds() {
7793
7835
  const e = this.assetController.getActiveFitBounds();
7794
7836
  if (e) return e;
7795
- const t = new N();
7837
+ const t = new F();
7796
7838
  let i = !1;
7797
7839
  for (const n of [...this.mountedObjects, ...this.mountedAssetObjects])
7798
7840
  n.visible && (t.expandByObject(n), i = !0);
@@ -7803,7 +7845,7 @@ class gn {
7803
7845
  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());
7804
7846
  }
7805
7847
  applyCameraSnapshot(e, t) {
7806
- if (!At(e)) return !1;
7848
+ if (!Ie(e)) return !1;
7807
7849
  const i = this.runtime.viewMode;
7808
7850
  return this.runtime.applyCameraSnapshot(e) ? (this.runtime.viewMode !== i && this.emit("view-mode-change", { viewMode: this.runtime.viewMode }), this.pendingCameraReason = t, this.cadCapability.onCameraChanged(t), this.refreshCadPointerHover(), !0) : !1;
7809
7851
  }
@@ -7825,7 +7867,7 @@ class gn {
7825
7867
  shouldRenderCurrentFrame(e) {
7826
7868
  if (this.assetController.isActivePreview || this.assetController.isActiveDynamicPlaying || this.interaction !== "active" || this.interactionRenderLastTs === null) return !0;
7827
7869
  const t = e - this.interactionRenderLastTs;
7828
- return t < 0 || t >= vn;
7870
+ return t < 0 || t >= An;
7829
7871
  }
7830
7872
  markInteractionActive() {
7831
7873
  this.clearInteractionIdleTimer(), this.setInteraction("active");
@@ -7833,7 +7875,7 @@ class gn {
7833
7875
  scheduleInteractionIdle() {
7834
7876
  this.clearInteractionIdleTimer(), this.interactionIdleTimer = globalThis.setTimeout(() => {
7835
7877
  this.interactionIdleTimer = null, this.setInteraction("idle"), this.refreshCadPointerHover();
7836
- }, fn);
7878
+ }, kn);
7837
7879
  }
7838
7880
  clearInteractionIdleTimer() {
7839
7881
  this.interactionIdleTimer !== null && (globalThis.clearTimeout(this.interactionIdleTimer), this.interactionIdleTimer = null);
@@ -7908,8 +7950,8 @@ class gn {
7908
7950
  for (const i of this.listeners.get(e) ?? []) i(t);
7909
7951
  }
7910
7952
  }
7911
- function Ln(s) {
7912
- const e = new tr({
7953
+ function Un(s) {
7954
+ const e = new nr({
7913
7955
  canvasArea: s.viewport,
7914
7956
  canvas: s.canvas,
7915
7957
  clearColor: s.clearColor,
@@ -7920,22 +7962,23 @@ function Ln(s) {
7920
7962
  environment: s.environment ?? "room",
7921
7963
  navigationPolicy: "viewer"
7922
7964
  });
7923
- return bn(s, e);
7965
+ return In(s, e);
7924
7966
  }
7925
- function bn(s, e) {
7926
- return e.initialize(), new gn(s, e);
7967
+ function In(s, e) {
7968
+ return e.initialize(), new Mn(s, e);
7927
7969
  }
7928
- function yn(s) {
7929
- return s === "cad" ? xn : s === "model" ? bt : s === "simulation" ? /* @__PURE__ */ new Set([...bt, "urdf"]) : wn;
7970
+ function Rn(s) {
7971
+ return s === "cad" ? Ln : s === "model" ? wt : s === "simulation" ? /* @__PURE__ */ new Set([...wt, "urdf"]) : Tn;
7930
7972
  }
7931
- const xn = /* @__PURE__ */ new Set(["cad"]), bt = /* @__PURE__ */ new Set(["scene"]), wn = /* @__PURE__ */ new Set();
7973
+ const Ln = /* @__PURE__ */ new Set(["cad"]), wt = /* @__PURE__ */ new Set(["scene"]), Tn = /* @__PURE__ */ new Set();
7932
7974
  function xe(s) {
7933
7975
  return s ? JSON.stringify(s) : null;
7934
7976
  }
7935
- function Cn(s) {
7977
+ function Dn(s) {
7936
7978
  return !!(s && typeof s == "object" && s.nodeType === 1);
7937
7979
  }
7938
7980
  export {
7939
7981
  q as V,
7940
- Ln as c
7982
+ Un as c,
7983
+ fi as v
7941
7984
  };