@nebula-spatial/viewer 0.4.1 → 0.4.3

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,13 +1,13 @@
1
- var ht = Object.defineProperty;
2
- var ut = (s, e, t) => e in s ? ht(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
- var d = (s, e, t) => ut(s, typeof e != "symbol" ? e + "" : e, t);
4
- import { Texture as pt, Vector3 as C, MathUtils as P, MOUSE as _, Object3D as We, Scene as ve, Group as Ke, Raycaster as mt, Vector2 as Q, WebGLRenderer as ft, Color as vt, Euler as bt, OrthographicCamera as be, PerspectiveCamera as gt, TOUCH as ge, Vector4 as yt, Plane as wt, WebGLRenderTarget as xt, Box3 as M, PMREMGenerator as Ct, EquirectangularReflectionMapping as Et, BoxHelper as St, Box3Helper as Pt, BoxGeometry as At, Mesh as Rt, MeshBasicMaterial as It, LineSegments as Mt, EdgesGeometry as kt, LineBasicMaterial as Tt } from "three";
5
- import { RoomEnvironment as Dt } from "three/addons/environments/RoomEnvironment.js";
6
- import { MapControls as Ot } from "three/addons/controls/MapControls.js";
7
- import { OrbitControls as Lt } from "three/addons/controls/OrbitControls.js";
8
- import { HDRLoader as Ft } from "three/addons/loaders/HDRLoader.js";
9
- import { createCadDocumentSession as Nt, getCadDocumentRenderResource as Vt, formatCadInsertId as ye } from "@nebula-spatial/cad-loader";
10
- const Bt = [
1
+ var ut = Object.defineProperty;
2
+ var pt = (s, e, t) => e in s ? ut(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
+ var d = (s, e, t) => pt(s, typeof e != "symbol" ? e + "" : e, t);
4
+ import { Texture as mt, Vector3 as C, MathUtils as A, MOUSE as z, Object3D as Ke, Scene as ve, Group as Ze, Raycaster as ft, Vector2 as Q, WebGLRenderer as vt, Color as bt, Euler as gt, OrthographicCamera as be, PerspectiveCamera as yt, TOUCH as ge, Vector4 as wt, Plane as xt, WebGLRenderTarget as Ct, Box3 as M, PMREMGenerator as Et, EquirectangularReflectionMapping as St, BoxHelper as Pt, Box3Helper as At, BoxGeometry as Rt, Mesh as It, MeshBasicMaterial as Mt, LineSegments as kt, EdgesGeometry as Tt, LineBasicMaterial as Dt } from "three";
5
+ import { RoomEnvironment as Ot } from "three/addons/environments/RoomEnvironment.js";
6
+ import { MapControls as Lt } from "three/addons/controls/MapControls.js";
7
+ import { OrbitControls as Ft } from "three/addons/controls/OrbitControls.js";
8
+ import { HDRLoader as Nt } from "three/addons/loaders/HDRLoader.js";
9
+ import { createCadDocumentSession as Vt, getCadDocumentRenderResource as Bt, formatCadInsertId as ye } from "@nebula-spatial/cad-loader";
10
+ const zt = [
11
11
  "alphaMap",
12
12
  "aoMap",
13
13
  "bumpMap",
@@ -33,31 +33,31 @@ const Bt = [
33
33
  "thicknessMap",
34
34
  "transmissionMap"
35
35
  ];
36
- function K(s, e) {
36
+ function Z(s, e) {
37
37
  e.has(s) || (e.add(s), s.dispose());
38
38
  }
39
39
  function _t(s, e, t) {
40
40
  if (e) {
41
41
  const i = s;
42
- for (const r of Bt) {
42
+ for (const r of zt) {
43
43
  const n = i[r];
44
- n instanceof pt && K(n, t);
44
+ n instanceof mt && Z(n, t);
45
45
  }
46
46
  }
47
- K(s, t);
47
+ Z(s, t);
48
48
  }
49
49
  function we(s, e = {}) {
50
50
  const t = e.disposedResources ?? /* @__PURE__ */ new WeakSet(), i = e.disposeTextures !== !1;
51
51
  s.traverse((r) => {
52
52
  const n = r;
53
- n.geometry && K(n.geometry, t);
53
+ n.geometry && Z(n.geometry, t);
54
54
  const a = Array.isArray(n.material) ? n.material : [n.material];
55
55
  for (const o of a)
56
56
  o && _t(o, i, t);
57
- n.renderTarget && K(n.renderTarget, t);
57
+ n.renderTarget && Z(n.renderTarget, t);
58
58
  });
59
59
  }
60
- function zt(s) {
60
+ function Ut(s) {
61
61
  const {
62
62
  dxPx: e,
63
63
  dyPx: t,
@@ -71,31 +71,31 @@ function zt(s) {
71
71
  } = s;
72
72
  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(c) || i <= 0 || r <= 0 || n <= 0 || a <= 0 || a >= 180 || o <= 0)
73
73
  return { x: 0, y: 0, z: 0 };
74
- const h = 2 * n * Math.tan(a * Math.PI / 360), f = h / r, b = h * o / i, g = Math.sin(l), m = Math.cos(l), v = -g, y = m, p = -m, w = -g, x = -e * b * c, R = t * f * c;
74
+ const h = 2 * n * Math.tan(a * Math.PI / 360), f = h / r, b = h * o / i, g = Math.sin(l), p = Math.cos(l), v = -g, y = p, m = -p, x = -g, w = -e * b * c, E = t * f * c;
75
75
  return {
76
- x: v * x + p * R,
77
- y: y * x + w * R,
76
+ x: v * w + m * E,
77
+ y: y * w + x * E,
78
78
  z: 0
79
79
  };
80
80
  }
81
- function Ut(s, e) {
81
+ function Ht(s, e) {
82
82
  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 } : {
83
83
  x: s.x - e.x,
84
84
  y: s.y - e.y,
85
85
  z: 0
86
86
  };
87
87
  }
88
- function Ht(s, e, t) {
88
+ function Yt(s, e, t) {
89
89
  if (!Number.isFinite(s.x) || !Number.isFinite(s.y) || !Number.isFinite(s.z))
90
90
  return { x: 0, y: 0, z: 0 };
91
- const i = Ut(e, t);
91
+ const i = Ht(e, t);
92
92
  return {
93
93
  x: s.x + i.x,
94
94
  y: s.y + i.y,
95
95
  z: s.z
96
96
  };
97
97
  }
98
- const Yt = 0.35, z = 1, jt = 1, Xt = 170;
98
+ const jt = 0.35, _ = 1, Xt = 1, qt = 170;
99
99
  function j(s, e, t) {
100
100
  return Math.max(e, Math.min(t, s));
101
101
  }
@@ -103,20 +103,20 @@ function D(s, e, t, i) {
103
103
  const r = Number.isFinite(s) ? s : e;
104
104
  return j(r, t, i);
105
105
  }
106
- function Ze(s) {
107
- return Number.isFinite(s) ? j(s, 0.1, 0.95) : Yt;
106
+ function Je(s) {
107
+ return Number.isFinite(s) ? j(s, 0.1, 0.95) : jt;
108
108
  }
109
- function qt(s, e) {
109
+ function $t(s, e) {
110
110
  return !Number.isFinite(s) || !Number.isFinite(e) || s <= 0 || e <= 0 ? 1 : s / e;
111
111
  }
112
- function Je(s) {
113
- const e = D(s, 50, jt, Xt), t = Math.tan(e * Math.PI / 360);
112
+ function Qe(s) {
113
+ const e = D(s, 50, Xt, qt), t = Math.tan(e * Math.PI / 360);
114
114
  return Math.max(t, 1e-4);
115
115
  }
116
- function $t(s) {
116
+ function Gt(s) {
117
117
  return Number.isFinite(s) ? Math.max(0.2, Math.abs(Math.sin(s))) : 0.2;
118
118
  }
119
- function Gt(s) {
119
+ function Wt(s) {
120
120
  return Number.isFinite(s) ? {
121
121
  sinAbs: Math.max(1e-4, Math.abs(Math.sin(s))),
122
122
  cosAbs: Math.abs(Math.cos(s))
@@ -125,15 +125,15 @@ function Gt(s) {
125
125
  cosAbs: Math.sqrt(1 - 0.2 * 0.2)
126
126
  };
127
127
  }
128
- function Qe(s, e, t) {
129
- const i = Math.max(1e-4, 2 * s * e / $t(t)), { sinAbs: r, cosAbs: n } = Gt(t), a = s * e, o = r * r - a * a * n * n;
128
+ function et(s, e, t) {
129
+ const i = Math.max(1e-4, 2 * s * e / Gt(t)), { sinAbs: r, cosAbs: n } = Wt(t), a = s * e, o = r * r - a * a * n * n;
130
130
  if (!Number.isFinite(o) || o <= 1e-4)
131
131
  return i;
132
132
  const l = 2 * a * r / o;
133
133
  return !Number.isFinite(l) || l <= 1e-4 ? i : l;
134
134
  }
135
- function Wt(s) {
136
- const e = Ze(s.ndcBand), t = s.useFixedOrientation ? s.fixedOrbitYaw : s.orbitYaw, i = s.useFixedOrientation ? s.fixedOrbitPitch : s.orbitPitch, r = Math.max(D(s.orthoFrustumSize, z, z, Number.MAX_VALUE), z), n = Je(s.perspectiveFovDeg), a = Qe(e, n, i), o = D(s.orbitDistanceMin, 500, 1, Number.MAX_VALUE), l = Math.max(o, D(s.orbitDistanceMax, 2e5, o, Number.MAX_VALUE)), c = j(r / a, o, l);
135
+ function Kt(s) {
136
+ const e = Je(s.ndcBand), t = s.useFixedOrientation ? s.fixedOrbitYaw : s.orbitYaw, i = s.useFixedOrientation ? s.fixedOrbitPitch : s.orbitPitch, r = Math.max(D(s.orthoFrustumSize, _, _, Number.MAX_VALUE), _), n = Qe(s.perspectiveFovDeg), a = et(e, n, i), o = D(s.orbitDistanceMin, 500, 1, Number.MAX_VALUE), l = Math.max(o, D(s.orbitDistanceMax, 2e5, o, Number.MAX_VALUE)), c = j(r / a, o, l);
137
137
  return {
138
138
  orbitTarget: { x: s.orthoCenterX, y: s.orthoCenterY, z: 0 },
139
139
  orbitDistance: c,
@@ -141,25 +141,25 @@ function Wt(s) {
141
141
  orbitPitch: i
142
142
  };
143
143
  }
144
- function Kt(s) {
145
- const e = qt(s.viewportWidthPx, s.viewportHeightPx), t = Ze(s.ndcBand), i = Je(s.perspectiveFovDeg), r = Qe(t, i, s.orbitPitch), n = D(s.orthoFrustumMin, 1e3, z, Number.MAX_VALUE), a = Math.max(n, D(s.orthoFrustumMax, 1e5, n, Number.MAX_VALUE)), o = Math.max(D(s.orbitDistance, n, n, Number.MAX_VALUE), z), l = o * r, c = Number.isFinite(l) && l >= z ? l : j(o / Math.max(0.5, Math.min(2, e)), n, a);
144
+ function Zt(s) {
145
+ const e = $t(s.viewportWidthPx, s.viewportHeightPx), t = Je(s.ndcBand), i = Qe(s.perspectiveFovDeg), r = et(t, i, s.orbitPitch), n = D(s.orthoFrustumMin, 1e3, _, Number.MAX_VALUE), a = Math.max(n, D(s.orthoFrustumMax, 1e5, n, Number.MAX_VALUE)), o = Math.max(D(s.orbitDistance, n, n, Number.MAX_VALUE), _), l = o * r, c = Number.isFinite(l) && l >= _ ? l : j(o / Math.max(0.5, Math.min(2, e)), n, a);
146
146
  return {
147
147
  orthoCenterX: s.orbitTarget.x,
148
148
  orthoCenterY: s.orbitTarget.y,
149
149
  orthoFrustumSize: j(c, n, a)
150
150
  };
151
151
  }
152
- function Zt(s) {
152
+ function Jt(s) {
153
153
  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(
154
154
  1e-4,
155
155
  2 * s.ndcBand * t / Math.max(0.2, i)
156
156
  ), l = Number.isFinite(a) && a > 1e-4 ? Math.max(1e-4, 2 * n * i / a) : o;
157
157
  return e / l;
158
158
  }
159
- function Jt(s, e, t, i = 40) {
159
+ function Qt(s, e, t, i = 40) {
160
160
  return e === 1 ? s * i : e === 2 ? s * t : s;
161
161
  }
162
- function Qt(s) {
162
+ function ei(s) {
163
163
  const { valuePx: e, ctrlKey: t, eventTimeMs: i, state: r, resetMs: n } = s, a = Math.abs(e), o = r.lastEventTimeMs === 0 ? 0 : i - r.lastEventTimeMs;
164
164
  let l = r.type;
165
165
  if (t)
@@ -178,7 +178,7 @@ function Qt(s) {
178
178
  type: l
179
179
  };
180
180
  }
181
- function ei(s, e, t) {
181
+ function ti(s, e, t) {
182
182
  if (!Number.isFinite(s) || s === 0) return 1;
183
183
  const i = e === "wheel" ? t.wheelZoomRate : t.trackpadZoomRate;
184
184
  if (e === "wheel") {
@@ -190,11 +190,11 @@ function ei(s, e, t) {
190
190
  const n = 1 / t.maxScalePerFrame;
191
191
  return Math.max(n, Math.min(t.maxScalePerFrame, r));
192
192
  }
193
- const ee = 500, xe = 2e5, te = 0.95, Ce = -Math.PI / 2, Ee = P.degToRad(55), ti = 1e3, ii = 2e6;
193
+ const ee = 500, xe = 2e5, te = 0.95, Ce = -Math.PI / 2, Ee = A.degToRad(55), ii = 1e3, ri = 2e6;
194
194
  function O(s, e, t = 1e-4) {
195
195
  return Math.abs(s - e) <= t;
196
196
  }
197
- class ri {
197
+ class si {
198
198
  constructor() {
199
199
  d(this, "orbitTarget", new C(0, 0, 0));
200
200
  d(this, "orbitDistance", 14e3);
@@ -245,7 +245,7 @@ class ri {
245
245
  if (!i) return;
246
246
  const r = Math.max(1, (t == null ? void 0 : t.padding) ?? 1.15), n = e.getSize(new C()), a = e.getCenter(new C());
247
247
  this.orbitTarget.set(a.x, a.y, a.z);
248
- const o = Zt({
248
+ const o = Jt({
249
249
  xmin: e.min.x,
250
250
  ymin: e.min.y,
251
251
  xmax: e.max.x,
@@ -281,7 +281,7 @@ class ri {
281
281
  };
282
282
  }
283
283
  applyOrbitSnapshot(e) {
284
- this.runtime && (this.orbitTarget.set(e.targetX, e.targetY, e.targetZ), this.orbitDistance = this.clampDistance(e.distance), this.orbitYaw = e.yaw, this.orbitPitch = P.clamp(e.pitch, P.degToRad(5), P.degToRad(85)), this.syncPerspectiveCamera({ sync2D: !1 }));
284
+ this.runtime && (this.orbitTarget.set(e.targetX, e.targetY, e.targetZ), this.orbitDistance = this.clampDistance(e.distance), this.orbitYaw = e.yaw, this.orbitPitch = A.clamp(e.pitch, A.degToRad(5), A.degToRad(85)), this.syncPerspectiveCamera({ sync2D: !1 }));
285
285
  }
286
286
  bindInput(e) {
287
287
  const t = e.renderer.domElement;
@@ -324,7 +324,7 @@ class ri {
324
324
  if (this.dragMode === "pan") {
325
325
  const i = this.screenToGround(e.clientX, e.clientY);
326
326
  if (this.groundPanAnchor && i) {
327
- const r = Ht(this.orbitTarget, this.groundPanAnchor, i);
327
+ const r = Yt(this.orbitTarget, this.groundPanAnchor, i);
328
328
  this.translateOrbit(r.x - this.orbitTarget.x, r.y - this.orbitTarget.y);
329
329
  } else
330
330
  this.panByScreenDelta(
@@ -344,15 +344,15 @@ class ri {
344
344
  const t = this.runtime;
345
345
  if (!t || t.viewMode !== "3d") return;
346
346
  (c = e.preventDefault) == null || c.call(e);
347
- const i = Math.max(1, t.canvasArea.clientHeight), r = Jt(e.deltaY, e.deltaMode, i);
348
- this.wheelClassifier = Qt({
347
+ const i = Math.max(1, t.canvasArea.clientHeight), r = Qt(e.deltaY, e.deltaMode, i);
348
+ this.wheelClassifier = ei({
349
349
  valuePx: r,
350
350
  ctrlKey: e.ctrlKey,
351
351
  eventTimeMs: typeof performance > "u" ? Date.now() : performance.now(),
352
352
  state: this.wheelClassifier,
353
353
  resetMs: 400
354
354
  });
355
- const n = this.wheelClassifier.type ?? "trackpad", a = n === "wheel" ? Math.sign(r) * 100 : r, o = ei(-a, n, {
355
+ const n = this.wheelClassifier.type ?? "trackpad", a = n === "wheel" ? Math.sign(r) * 100 : r, o = ti(-a, n, {
356
356
  trackpadZoomRate: 1 / 700,
357
357
  wheelZoomRate: 1 / 3200,
358
358
  maxScalePerFrame: 2
@@ -364,7 +364,7 @@ class ri {
364
364
  panByScreenDelta(e, t) {
365
365
  const i = this.runtime;
366
366
  if (!i) return;
367
- const r = zt({
367
+ const r = Ut({
368
368
  dxPx: e,
369
369
  dyPx: t,
370
370
  viewportWidthPx: Math.max(1, i.canvasArea.clientWidth),
@@ -378,10 +378,10 @@ class ri {
378
378
  this.translateOrbit(r.x, r.y);
379
379
  }
380
380
  rotateByScreenDelta(e, t) {
381
- const i = this.orbitYaw - e * 5e-3, r = P.clamp(
381
+ const i = this.orbitYaw - e * 5e-3, r = A.clamp(
382
382
  this.orbitPitch + t * 5e-3,
383
- P.degToRad(5),
384
- P.degToRad(85)
383
+ A.degToRad(5),
384
+ A.degToRad(85)
385
385
  );
386
386
  i === this.orbitYaw && r === this.orbitPitch || (this.orbitYaw = i, this.orbitPitch = r, this.syncPerspectiveCamera());
387
387
  }
@@ -396,7 +396,7 @@ class ri {
396
396
  var o, l;
397
397
  const t = this.runtime;
398
398
  if (!t) return;
399
- const i = t.camera2d, r = i.zoom > 0 ? i.zoom : 1, n = Math.max((i.top - i.bottom) / r, 1), a = Wt({
399
+ const i = t.camera2d, r = i.zoom > 0 ? i.zoom : 1, n = Math.max((i.top - i.bottom) / r, 1), a = Kt({
400
400
  orthoCenterX: ((o = t.controls2d.target) == null ? void 0 : o.x) ?? i.position.x,
401
401
  orthoCenterY: ((l = t.controls2d.target) == null ? void 0 : l.y) ?? i.position.y,
402
402
  orthoFrustumSize: n,
@@ -417,7 +417,7 @@ class ri {
417
417
  sync2DFromOrbit() {
418
418
  const e = this.runtime;
419
419
  if (!e) return;
420
- 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, c = Math.max(l, e.controls2d.maxZoom > 0 ? e.controls2d.maxZoom : 5e4), h = Math.max(1, o / c), f = Math.max(h, o / l), u = Kt({
420
+ 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, c = Math.max(l, e.controls2d.maxZoom > 0 ? e.controls2d.maxZoom : 5e4), h = Math.max(1, o / c), f = Math.max(h, o / l), u = Zt({
421
421
  orbitTarget: { x: this.orbitTarget.x, y: this.orbitTarget.y, z: this.orbitTarget.z },
422
422
  orbitDistance: this.orbitDistance,
423
423
  orbitYaw: this.orbitYaw,
@@ -434,7 +434,7 @@ class ri {
434
434
  right: g * n,
435
435
  top: g,
436
436
  bottom: -g,
437
- zoom: P.clamp(o / b, l, c),
437
+ zoom: A.clamp(o / b, l, c),
438
438
  positionX: u.orthoCenterX,
439
439
  positionY: u.orthoCenterY,
440
440
  targetX: u.orthoCenterX,
@@ -449,7 +449,7 @@ class ri {
449
449
  this.orbitTarget.y + this.orbitDistance * Math.sin(this.orbitYaw) * i,
450
450
  this.orbitTarget.z + this.orbitDistance * Math.sin(this.orbitPitch)
451
451
  );
452
- t.camera3d.near = Math.min(ti, Math.max(this.orbitDistance / 100, 1e-6)), t.camera3d.far = Math.max(ii, this.orbitDistance * 20), t.setPerspectivePose(r, this.orbitTarget), e.sync2D !== !1 && this.sync2DFromOrbit();
452
+ t.camera3d.near = Math.min(ii, 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();
453
453
  }
454
454
  capture2DSnapshot() {
455
455
  const e = this.runtime;
@@ -502,7 +502,7 @@ class ri {
502
502
  };
503
503
  }
504
504
  clampDistance(e) {
505
- return P.clamp(
505
+ return A.clamp(
506
506
  Number.isFinite(e) ? e : this.orbitDistanceMin,
507
507
  this.orbitDistanceMin,
508
508
  this.orbitDistanceMax
@@ -520,47 +520,47 @@ class ri {
520
520
  }
521
521
  }
522
522
  }
523
- const si = new C(2.4, -2.7, 1.7), ni = new C(0, 0, 0.65), ai = Math.PI * 0.49, oi = !0, li = new C(1.25, -1.5, 0.85).normalize(), ci = 1.25, di = 0.4, hi = 12, ui = 1e3, pi = 20, mi = 0.1, fi = 0.2, ie = {
524
- LEFT: _.PAN,
525
- MIDDLE: _.DOLLY,
526
- RIGHT: _.ROTATE
523
+ const ni = new C(2.4, -2.7, 1.7), ai = new C(0, 0, 0.65), oi = Math.PI * 0.49, li = !0, ci = new C(1.25, -1.5, 0.85).normalize(), di = 1.25, hi = 0.4, ui = 12, pi = 1e3, mi = 20, fi = 0.1, vi = 0.2, ie = {
524
+ LEFT: z.PAN,
525
+ MIDDLE: z.DOLLY,
526
+ RIGHT: z.ROTATE
527
527
  };
528
- function vi({ radius: s, fovDeg: e }) {
529
- const t = Math.max(s, 0.02), i = P.degToRad(e), r = t / Math.sin(i * 0.5) * ci;
528
+ function bi({ radius: s, fovDeg: e }) {
529
+ const t = Math.max(s, 0.02), i = A.degToRad(e), r = t / Math.sin(i * 0.5) * di;
530
530
  return {
531
531
  distance: r,
532
- minDistance: Math.max(t * di, 0.01),
533
- maxDistance: Math.max(t * hi, 1),
532
+ minDistance: Math.max(t * hi, 0.01),
533
+ maxDistance: Math.max(t * ui, 1),
534
534
  near: Math.max(
535
- r / ui,
536
- Math.min(mi, t * fi),
535
+ r / pi,
536
+ Math.min(fi, t * vi),
537
537
  1e-4
538
538
  ),
539
- far: Math.max(r * pi, 10)
539
+ far: Math.max(r * mi, 10)
540
540
  };
541
541
  }
542
- function bi(s, e, t) {
542
+ function gi(s, e, t) {
543
543
  e.minDistance = t.minDistance, e.maxDistance = t.maxDistance, s.near = t.near, s.far = t.far, s.updateProjectionMatrix();
544
544
  }
545
- function gi(s, e) {
546
- s.enableDamping = oi, s.maxPolarAngle = ai, s.dampingFactor = 0.1, s.enablePan = !0, s.screenSpacePanning = !0, s.mouseButtons = {
545
+ function yi(s, e) {
546
+ s.enableDamping = li, s.maxPolarAngle = oi, s.dampingFactor = 0.1, s.enablePan = !0, s.screenSpacePanning = !0, s.mouseButtons = {
547
547
  LEFT: ie.LEFT,
548
548
  MIDDLE: ie.MIDDLE,
549
549
  RIGHT: ie.RIGHT
550
- }, We.DEFAULT_UP.set(0, 0, 1), e.up.set(0, 0, 1);
550
+ }, Ke.DEFAULT_UP.set(0, 0, 1), e.up.set(0, 0, 1);
551
551
  }
552
- function yi(s, e, t, i) {
552
+ function wi(s, e, t, i) {
553
553
  if (t.isEmpty()) return null;
554
- const r = t.getSize(new C()), n = t.getCenter(new C()), a = Math.max(r.length() * 0.5, 0.02), o = vi({ radius: a, fovDeg: i });
555
- return e.target.copy(n), s.position.copy(n).addScaledVector(li, o.distance), bi(s, e, o), s.updateMatrixWorld(), e.update(), o;
554
+ const r = t.getSize(new C()), n = t.getCenter(new C()), a = Math.max(r.length() * 0.5, 0.02), o = bi({ radius: a, fovDeg: i });
555
+ return e.target.copy(n), s.position.copy(n).addScaledVector(ci, o.distance), gi(s, e, o), s.updateMatrixWorld(), e.update(), o;
556
556
  }
557
- const wi = 1e3, xi = 2, Ci = -1e4, Ei = 1e4, Se = 1e3, Si = 2e6, Pi = 1.15, Ai = 1, Pe = new bt(Math.PI / 2, 0, Math.PI * 0.98 * 0.8);
558
- class Ri {
557
+ const xi = 1e3, Ci = 2, Ei = -1e4, Si = 1e4, Se = 1e3, Pi = 2e6, Ai = 1.15, Ri = 1, Pe = new gt(Math.PI / 2, 0, Math.PI * 0.98 * 0.8);
558
+ class Ii {
559
559
  constructor(e) {
560
560
  d(this, "canvasArea");
561
561
  d(this, "canvas");
562
562
  d(this, "scene", new ve());
563
- d(this, "overlayRoot", new Ke());
563
+ d(this, "overlayRoot", new Ze());
564
564
  d(this, "renderer");
565
565
  d(this, "camera2d");
566
566
  d(this, "camera3d");
@@ -572,7 +572,7 @@ class Ri {
572
572
  d(this, "ownedObjects", /* @__PURE__ */ new Set());
573
573
  d(this, "overlays", /* @__PURE__ */ new Map());
574
574
  d(this, "eventCleanups", []);
575
- d(this, "raycaster", new mt());
575
+ d(this, "raycaster", new ft());
576
576
  d(this, "pointerNdc", new Q());
577
577
  d(this, "reuseVector", new C());
578
578
  d(this, "reuseVector2", new C());
@@ -601,29 +601,29 @@ class Ri {
601
601
  initialize() {
602
602
  if (this.disposed) throw new Error("SceneRuntime has been disposed.");
603
603
  if (this.initialized) return;
604
- const e = this.options.factories, t = (e == null ? void 0 : e.createRenderer) ?? ((l) => new ft(l)), i = (e == null ? void 0 : e.createMapControls) ?? ((l, c) => new Ot(l, c)), r = (e == null ? void 0 : e.createOrbitControls) ?? ((l, c) => new Lt(l, c));
604
+ const e = this.options.factories, t = (e == null ? void 0 : e.createRenderer) ?? ((l) => new vt(l)), i = (e == null ? void 0 : e.createMapControls) ?? ((l, c) => new Lt(l, c)), r = (e == null ? void 0 : e.createOrbitControls) ?? ((l, c) => new Ft(l, c));
605
605
  this.renderer = t({
606
606
  canvas: this.canvas,
607
607
  antialias: this.options.antialias ?? !0,
608
608
  alpha: this.options.alpha ?? !1,
609
609
  powerPreference: this.options.powerPreference ?? "high-performance"
610
- }), this.options.clearColor !== void 0 && this.renderer.setClearColor(new vt(this.options.clearColor));
610
+ }), this.options.clearColor !== void 0 && this.renderer.setClearColor(new bt(this.options.clearColor));
611
611
  const n = Math.max(1, this.canvasArea.clientWidth || 1), a = Math.max(1, this.canvasArea.clientHeight || 1), o = n / a;
612
612
  if (this.renderer.setPixelRatio(this.readDevicePixelRatio()), this.renderer.setSize(n, a, !1), this.options.environment) {
613
- const l = (e == null ? void 0 : e.createEnvironment) ?? Ii;
614
- this.scene.environmentIntensity = Ai, this.scene.environmentRotation.copy(Pe), this.scene.backgroundRotation.copy(Pe);
613
+ const l = (e == null ? void 0 : e.createEnvironment) ?? Mi;
614
+ this.scene.environmentIntensity = Ri, this.scene.environmentRotation.copy(Pe), this.scene.backgroundRotation.copy(Pe);
615
615
  const c = ++this.environmentLoadGeneration, h = l(this.renderer, this.options.environment);
616
- Mi(h) ? h.then(
616
+ ki(h) ? h.then(
617
617
  (f) => this.applyEnvironmentResource(f, c),
618
618
  (f) => {
619
619
  !this.disposed && c === this.environmentLoadGeneration && console.warn("Failed to load scene environment HDR.", f);
620
620
  }
621
621
  ) : this.applyEnvironmentResource(h, c);
622
622
  }
623
- this.camera2d = new be(-o, o, 1, -1, Ci, Ei), this.camera2d.position.set(0, 0, 1), this.camera2d.lookAt(0, 0, 0), this.camera3d = new gt(40, o, Se, Si), 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 = {
624
- LEFT: _.PAN,
625
- MIDDLE: _.DOLLY,
626
- RIGHT: _.PAN
623
+ this.camera2d = new be(-o, o, 1, -1, Ei, Si), this.camera2d.position.set(0, 0, 1), this.camera2d.lookAt(0, 0, 0), this.camera3d = new yt(40, o, Se, Pi), 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 = {
624
+ LEFT: z.PAN,
625
+ MIDDLE: z.DOLLY,
626
+ RIGHT: z.PAN
627
627
  }, this.controls2d.touches = {
628
628
  ONE: ge.PAN,
629
629
  TWO: ge.DOLLY_PAN
@@ -667,10 +667,10 @@ class Ri {
667
667
  var t, i;
668
668
  if (this.controls3d) {
669
669
  if (e === "viewer") {
670
- this.viewerOrbit ?? (this.viewerOrbit = new ri()), this.viewerOrbit.attach(this);
670
+ this.viewerOrbit ?? (this.viewerOrbit = new si()), this.viewerOrbit.attach(this);
671
671
  return;
672
672
  }
673
- (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" && (gi(this.controls3d, this.camera3d), this.camera3d.position.copy(si), this.controls3d.target.copy(ni), this.controls3d.update());
673
+ (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" && (yi(this.controls3d, this.camera3d), this.camera3d.position.copy(ni), this.controls3d.target.copy(ai), this.controls3d.update());
674
674
  }
675
675
  }
676
676
  /**
@@ -764,7 +764,7 @@ class Ri {
764
764
  let b = l / 2, g = c / 2;
765
765
  b / g < u ? b = g * u : g = b / u, this.camera2d.left = -b, this.camera2d.right = b, this.camera2d.top = g, this.camera2d.bottom = -g, 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();
766
766
  } else if (this.navigationPolicyValue === "preview")
767
- yi(this.camera3d, this.controls3d, i, this.camera3d.fov);
767
+ wi(this.camera3d, this.controls3d, i, this.camera3d.fov);
768
768
  else if (this.viewerOrbit)
769
769
  this.viewerOrbit.fit3D(i, { padding: a });
770
770
  else {
@@ -830,12 +830,12 @@ class Ri {
830
830
  distance: i,
831
831
  // Match ViewOrbitNavigation's convention: yaw around +Z, pitch off the XY plane.
832
832
  yaw: Math.atan2(t.y, t.x),
833
- pitch: Math.asin(P.clamp(t.z / i, -1, 1))
833
+ pitch: Math.asin(A.clamp(t.z / i, -1, 1))
834
834
  };
835
835
  }
836
836
  applyPreviewOrbitSnapshot(e) {
837
837
  if (!this.camera3d || !this.controls3d) return !1;
838
- const t = Math.cos(e.pitch), i = new C(e.targetX, e.targetY, e.targetZ), r = P.clamp(
838
+ const t = Math.cos(e.pitch), i = new C(e.targetX, e.targetY, e.targetZ), r = A.clamp(
839
839
  e.distance,
840
840
  this.controls3d.minDistance,
841
841
  this.controls3d.maxDistance
@@ -873,29 +873,29 @@ class Ri {
873
873
  }
874
874
  renderOrthographicPreview(e, t, i) {
875
875
  var me;
876
- if (!this.renderer || this.disposed || t.parent || !ki(i)) return !1;
877
- 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)), c = Math.max(1, Math.floor(n * o)), h = l / a, f = c / a, u = Math.min(h, f), b = (i.minX + i.maxX) / 2, g = (i.minY + i.maxY) / 2, v = Math.max(i.maxX - i.minX, i.maxY - i.minY, 1) * Pi / 2, y = this.getOrCreatePreviewRenderTarget(l, c), p = this.getOrCreatePreviewCamera();
878
- p.left = -v, p.right = v, p.top = v, p.bottom = -v, p.position.set(b, g, 1), p.up.copy(((me = this.camera2d) == null ? void 0 : me.up) ?? new C(0, 1, 0)), p.lookAt(b, g, 0), p.updateProjectionMatrix(), p.updateMatrixWorld(!0);
879
- const w = this.getOrCreatePreviewScene(), x = this.renderer, R = x.getRenderTarget(), J = x.getClearAlpha(), pe = x.autoClear, T = new yt();
880
- x.getViewport(T);
881
- const dt = x.getScissorTest();
882
- w.add(t);
876
+ if (!this.renderer || this.disposed || t.parent || !Ti(i)) return !1;
877
+ 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)), c = Math.max(1, Math.floor(n * o)), h = l / a, f = c / a, u = Math.min(h, f), b = (i.minX + i.maxX) / 2, g = (i.minY + i.maxY) / 2, v = Math.max(i.maxX - i.minX, i.maxY - i.minY, 1) * Ai / 2, y = this.getOrCreatePreviewRenderTarget(l, c), m = this.getOrCreatePreviewCamera();
878
+ m.left = -v, m.right = v, m.top = v, m.bottom = -v, m.position.set(b, g, 1), m.up.copy(((me = this.camera2d) == null ? void 0 : me.up) ?? new C(0, 1, 0)), m.lookAt(b, g, 0), m.updateProjectionMatrix(), m.updateMatrixWorld(!0);
879
+ const x = this.getOrCreatePreviewScene(), w = this.renderer, E = w.getRenderTarget(), X = w.getClearAlpha(), pe = w.autoClear, T = new wt();
880
+ w.getViewport(T);
881
+ const ht = w.getScissorTest();
882
+ x.add(t);
883
883
  try {
884
- x.setRenderTarget(y), x.setViewport(0, 0, h, f), x.setScissorTest(!1), x.setClearAlpha(0), x.autoClear = !1, x.clear(), x.setViewport(
884
+ w.setRenderTarget(y), w.setViewport(0, 0, h, f), w.setScissorTest(!1), w.setClearAlpha(0), w.autoClear = !1, w.clear(), w.setViewport(
885
885
  Math.floor((h - u) / 2),
886
886
  Math.floor((f - u) / 2),
887
887
  u,
888
888
  u
889
- ), x.render(w, p);
889
+ ), w.render(x, m);
890
890
  const fe = this.getOrCreatePreviewPixelBuffer(l, c);
891
- return x.readRenderTargetPixels(y, 0, 0, l, c, fe), this.blitPreviewPixelsToCanvas(e, fe, l, c);
891
+ return w.readRenderTargetPixels(y, 0, 0, l, c, fe), this.blitPreviewPixelsToCanvas(e, fe, l, c);
892
892
  } finally {
893
- t.removeFromParent(), x.setRenderTarget(R), x.setClearAlpha(J), x.autoClear = pe, x.setViewport(
893
+ t.removeFromParent(), w.setRenderTarget(E), w.setClearAlpha(X), w.autoClear = pe, w.setViewport(
894
894
  T.x,
895
895
  T.y,
896
896
  T.z,
897
897
  T.w
898
- ), x.setScissorTest(dt), this.requestRender();
898
+ ), w.setScissorTest(ht), this.requestRender();
899
899
  }
900
900
  }
901
901
  bindRuntimeEvent(e, t, i, r) {
@@ -913,7 +913,7 @@ class Ri {
913
913
  }
914
914
  screenToWorldOnPlane(e, t, i = 0) {
915
915
  const r = this.clientToNdc(e, t, this.pointerNdc);
916
- return !r || !this.activeCamera ? null : (this.raycaster.setFromCamera(r, this.activeCamera), this.raycaster.ray.intersectPlane(new wt(new C(0, 0, 1), -i), new C()));
916
+ return !r || !this.activeCamera ? null : (this.raycaster.setFromCamera(r, this.activeCamera), this.raycaster.ray.intersectPlane(new xt(new C(0, 0, 1), -i), new C()));
917
917
  }
918
918
  worldToClient(e, t = new Q()) {
919
919
  var a;
@@ -948,8 +948,8 @@ class Ri {
948
948
  startAnimation(e = {}) {
949
949
  if (this.disposed || this.animationLoopActive) return;
950
950
  this.animationLoopActive = !0, this.infoFrames = 0, this.infoLastTime = performance.now();
951
- const t = e.infoUpdateIntervalMs ?? wi, i = (r = performance.now()) => {
952
- var o, l, c, h, f, u, b, g, m;
951
+ const t = e.infoUpdateIntervalMs ?? xi, i = (r = performance.now()) => {
952
+ var o, l, c, h, f, u, b, g, p;
953
953
  if (!this.animationLoopActive || this.disposed) {
954
954
  this.animationFrameId = null;
955
955
  return;
@@ -971,7 +971,7 @@ class Ri {
971
971
  if (this.infoFrames += 1, r - this.infoLastTime >= t) {
972
972
  const v = Math.max(1, r - this.infoLastTime);
973
973
  this.fpsCurrent = this.infoFrames * 1e3 / v, this.infoFrames = 0, this.infoLastTime = r, (g = e.onInfoUpdate) == null || g.call(e);
974
- } else a && ((m = e.onInfoUpdate) == null || m.call(e));
974
+ } else a && ((p = e.onInfoUpdate) == null || p.call(e));
975
975
  };
976
976
  i();
977
977
  }
@@ -1003,7 +1003,7 @@ class Ri {
1003
1003
  }
1004
1004
  getOrCreatePreviewRenderTarget(e, t) {
1005
1005
  var i;
1006
- return this.previewRenderTarget && this.previewRenderTargetSize.width === e && this.previewRenderTargetSize.height === t ? this.previewRenderTarget : ((i = this.previewRenderTarget) == null || i.dispose(), this.previewRenderTarget = new xt(e, t), this.previewRenderTargetSize = { width: e, height: t }, this.previewRenderTarget);
1006
+ return this.previewRenderTarget && this.previewRenderTargetSize.width === e && this.previewRenderTargetSize.height === t ? this.previewRenderTarget : ((i = this.previewRenderTarget) == null || i.dispose(), this.previewRenderTarget = new Ct(e, t), this.previewRenderTargetSize = { width: e, height: t }, this.previewRenderTarget);
1007
1007
  }
1008
1008
  getOrCreatePreviewPixelBuffer(e, t) {
1009
1009
  const i = e * t * 4;
@@ -1033,11 +1033,11 @@ class Ri {
1033
1033
  }
1034
1034
  readDevicePixelRatio() {
1035
1035
  const e = globalThis.devicePixelRatio;
1036
- return typeof e != "number" || !Number.isFinite(e) || e <= 0 ? 1 : Math.min(e, xi);
1036
+ return typeof e != "number" || !Number.isFinite(e) || e <= 0 ? 1 : Math.min(e, Ci);
1037
1037
  }
1038
1038
  resolveBox3(e) {
1039
1039
  if (e instanceof M) return e.clone();
1040
- if (e instanceof We) return new M().setFromObject(e);
1040
+ if (e instanceof Ke) return new M().setFromObject(e);
1041
1041
  const { minX: t, minY: i, maxX: r, maxY: n } = e;
1042
1042
  return ![t, i, r, n].every(Number.isFinite) || r < t || n < i ? null : new M(new C(t, i, 0), new C(r, n, 0));
1043
1043
  }
@@ -1056,9 +1056,9 @@ class Ri {
1056
1056
  });
1057
1057
  }
1058
1058
  }
1059
- function Ii(s, e) {
1059
+ function Mi(s, e) {
1060
1060
  if (e === "room") {
1061
- const t = new Ct(s), i = new Dt(), r = t.fromScene(i);
1061
+ const t = new Et(s), i = new Ot(), r = t.fromScene(i);
1062
1062
  return i.dispose(), t.dispose(), {
1063
1063
  texture: r.texture,
1064
1064
  dispose: () => r.dispose()
@@ -1066,20 +1066,20 @@ function Ii(s, e) {
1066
1066
  }
1067
1067
  if (e.type !== "hdr" || e.url.trim().length === 0)
1068
1068
  throw new Error("HDR scene environment requires a non-empty URL.");
1069
- return new Ft().loadAsync(e.url).then((t) => (t.mapping = Et, {
1069
+ return new Nt().loadAsync(e.url).then((t) => (t.mapping = St, {
1070
1070
  texture: t,
1071
1071
  dispose: () => t.dispose()
1072
1072
  }));
1073
1073
  }
1074
- function Mi(s) {
1074
+ function ki(s) {
1075
1075
  return typeof (s == null ? void 0 : s.then) == "function";
1076
1076
  }
1077
- function ki(s) {
1077
+ function Ti(s) {
1078
1078
  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;
1079
1079
  }
1080
1080
  const de = 1;
1081
- function Ti() {
1082
- return typeof globalThis.localStorage > "u" ? Di() : {
1081
+ function Di() {
1082
+ return typeof globalThis.localStorage > "u" ? Oi() : {
1083
1083
  read(s) {
1084
1084
  try {
1085
1085
  const e = globalThis.localStorage.getItem(Ae(s));
@@ -1096,7 +1096,7 @@ function Ti() {
1096
1096
  }
1097
1097
  };
1098
1098
  }
1099
- function Di() {
1099
+ function Oi() {
1100
1100
  const s = /* @__PURE__ */ new Map();
1101
1101
  return {
1102
1102
  read(e) {
@@ -1107,12 +1107,12 @@ function Di() {
1107
1107
  }
1108
1108
  };
1109
1109
  }
1110
- function Oi(s, e) {
1110
+ function Li(s, e) {
1111
1111
  if (!s || !e) return null;
1112
1112
  const t = s.read(e);
1113
- return et(t) ? t : null;
1113
+ return tt(t) ? t : null;
1114
1114
  }
1115
- function et(s) {
1115
+ function tt(s) {
1116
1116
  if (!s || typeof s != "object") return !1;
1117
1117
  const e = s;
1118
1118
  if (e.schemaVersion !== de) return !1;
@@ -1143,10 +1143,10 @@ function et(s) {
1143
1143
  }
1144
1144
  return !1;
1145
1145
  }
1146
- function Li(s, e, t) {
1146
+ function Fi(s, e, t) {
1147
1147
  !s || !e || s.write(e, t);
1148
1148
  }
1149
- function Fi(s) {
1149
+ function Ni(s) {
1150
1150
  return {
1151
1151
  schemaVersion: de,
1152
1152
  viewMode: s.viewMode,
@@ -1163,11 +1163,11 @@ function H(s) {
1163
1163
  new C(s.maxX, s.maxY, s.maxZ)
1164
1164
  );
1165
1165
  }
1166
- function tt(s) {
1166
+ function it(s) {
1167
1167
  const [e, t, i] = s;
1168
1168
  return (e & 255) << 16 | (t & 255) << 8 | i & 255;
1169
1169
  }
1170
- class Ni {
1170
+ class Vi {
1171
1171
  constructor() {
1172
1172
  d(this, "rows", []);
1173
1173
  d(this, "allColor", null);
@@ -1190,7 +1190,7 @@ class Ni {
1190
1190
  color: i.has(n.index) ? i.get(n.index) : this.allColor,
1191
1191
  sourceColor: n.color
1192
1192
  }));
1193
- zi(this.rows, r) || (this.rows = r, this.revision += 1, t && this.onChange());
1193
+ Ui(this.rows, r) || (this.rows = r, this.revision += 1, t && this.onChange());
1194
1194
  }
1195
1195
  clear(e = !0) {
1196
1196
  const t = this.rows.length > 0 || this.allColor !== null;
@@ -1247,7 +1247,7 @@ class Ni {
1247
1247
  t && (this.allColor = e, this.revision += 1, this.onChange());
1248
1248
  }
1249
1249
  }
1250
- class Vi {
1250
+ class Bi {
1251
1251
  constructor() {
1252
1252
  d(this, "usages", []);
1253
1253
  d(this, "revision", 0);
@@ -1273,7 +1273,7 @@ class Vi {
1273
1273
  canHighlight: r.canHighlight,
1274
1274
  visible: r.visible
1275
1275
  }));
1276
- Ui(this.usages, i) || (this.usages = i, this.revision += 1, t && this.onChange());
1276
+ Hi(this.usages, i) || (this.usages = i, this.revision += 1, t && this.onChange());
1277
1277
  }
1278
1278
  clear(e = !0) {
1279
1279
  const t = this.usages.length > 0;
@@ -1300,7 +1300,7 @@ class Vi {
1300
1300
  t.length !== 0 && (this.renderNode.setInsertVisibleBatch(t), i && (this.visibilityRevision += 1, this.revision += 1, this.onChange()));
1301
1301
  }
1302
1302
  }
1303
- class Bi {
1303
+ class zi {
1304
1304
  constructor() {
1305
1305
  d(this, "selection", null);
1306
1306
  d(this, "details", null);
@@ -1360,7 +1360,7 @@ class _i {
1360
1360
  this.zoomLabel = Number.isFinite(f) && (f ?? 0) > 0 ? `${Math.round(f * 100)}%` : "", this.scaleRuler = {
1361
1361
  visible: !0,
1362
1362
  worldLength: h,
1363
- lengthLabel: Hi(h, ((l = e.units) == null ? void 0 : l.source) ?? "mm")
1363
+ lengthLabel: Yi(h, ((l = e.units) == null ? void 0 : l.source) ?? "mm")
1364
1364
  }, this.orbitDistanceLabel = "";
1365
1365
  } else {
1366
1366
  const h = (c = e.host.runtime.captureCameraSnapshot()) == null ? void 0 : c.orbit;
@@ -1371,19 +1371,19 @@ class _i {
1371
1371
  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;
1372
1372
  }
1373
1373
  }
1374
- function zi(s, e) {
1374
+ function Ui(s, e) {
1375
1375
  return s.length === e.length && s.every((t, i) => {
1376
1376
  const r = e[i];
1377
1377
  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];
1378
1378
  });
1379
1379
  }
1380
- function Ui(s, e) {
1380
+ function Hi(s, e) {
1381
1381
  return s.length === e.length && s.every((t, i) => {
1382
1382
  const r = e[i];
1383
1383
  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;
1384
1384
  });
1385
1385
  }
1386
- function Hi(s, e) {
1386
+ function Yi(s, e) {
1387
1387
  if (e === "mm") {
1388
1388
  if (s >= 1e6) return `${(s / 1e6).toFixed(2)} km`;
1389
1389
  if (s >= 1e3) return `${(s / 1e3).toFixed(2)} m`;
@@ -1402,12 +1402,12 @@ function Re(s) {
1402
1402
  units: s.units ?? { source: "mm" }
1403
1403
  };
1404
1404
  }
1405
- const Yi = 160, Ie = 5e3;
1406
- class ji {
1405
+ const ji = 160, Ie = 5e3;
1406
+ class Xi {
1407
1407
  constructor(e) {
1408
- d(this, "layers", new Ni());
1409
- d(this, "blocks", new Vi());
1410
- d(this, "inspector", new Bi());
1408
+ d(this, "layers", new Vi());
1409
+ d(this, "blocks", new Bi());
1410
+ d(this, "inspector", new zi());
1411
1411
  d(this, "hud", new _i());
1412
1412
  d(this, "document", null);
1413
1413
  d(this, "loadTiming", null);
@@ -1442,10 +1442,10 @@ class ji {
1442
1442
  this.assertActive(), this.closeInternal();
1443
1443
  const i = ++this.openEpoch;
1444
1444
  this.cameraSettled = !1, this.initialDemandSettled = !1, this.initialCameraRestored = !1, this.cameraChangedDuringInitialLoad = !1, this.loadTiming = null;
1445
- const r = t.documentKey ?? Wi(e);
1445
+ const r = t.documentKey ?? Ki(e);
1446
1446
  let n;
1447
1447
  try {
1448
- n = Nt(e, {
1448
+ n = Vt(e, {
1449
1449
  documentKey: r ?? void 0,
1450
1450
  filename: t.filename,
1451
1451
  loadAnnotations: t.loadAnnotations,
@@ -1465,7 +1465,7 @@ class ji {
1465
1465
  throw this.emit("error", { ...Y(f, !0, e), error: f }), f;
1466
1466
  }
1467
1467
  this.session = n, this.loadTiming = n.loadTiming, this.statusMessage = "加载中…";
1468
- const a = Vt(n);
1468
+ const a = Bt(n);
1469
1469
  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(
1470
1470
  a.onChange(() => {
1471
1471
  this.host.requestRender(), this.host.emitContentChange();
@@ -1613,11 +1613,11 @@ class ji {
1613
1613
  return this.layers.getVisibilityRevision() + this.blocks.getVisibilityRevision();
1614
1614
  }
1615
1615
  setInsertSelection(e, t) {
1616
- Xi(this.inspector.selection, e) && $i(this.inspector.details, t) && !this.inspector.textSelection || (this.inspector.setSelection(e, t), this.emit("inspector-change", { inspector: this.inspector }));
1616
+ qi(this.inspector.selection, e) && Gi(this.inspector.details, t) && !this.inspector.textSelection || (this.inspector.setSelection(e, t), this.emit("inspector-change", { inspector: this.inspector }));
1617
1617
  }
1618
1618
  /** @internal Used by the viewer's managed interaction pipeline. */
1619
1619
  setTextSelectionInternal(e, t) {
1620
- qi(this.inspector.textSelection, e) && Gi(this.inspector.textDetails, t) && !this.inspector.selection || (this.inspector.setTextSelection(e, t), this.emit("inspector-change", { inspector: this.inspector }));
1620
+ $i(this.inspector.textSelection, e) && Wi(this.inspector.textDetails, t) && !this.inspector.selection || (this.inspector.setTextSelection(e, t), this.emit("inspector-change", { inspector: this.inspector }));
1621
1621
  }
1622
1622
  getAuthoritativeBoundsBox() {
1623
1623
  if (!this.session) return null;
@@ -1691,7 +1691,7 @@ class ji {
1691
1691
  hud: e(this.hud),
1692
1692
  loadTiming: e(this.loadTiming)
1693
1693
  };
1694
- return it(t);
1694
+ return rt(t);
1695
1695
  }
1696
1696
  fitDocument() {
1697
1697
  this.assertActive();
@@ -1736,7 +1736,7 @@ class ji {
1736
1736
  const e = this.host.runtime.captureCameraSnapshot();
1737
1737
  e && this.host.persistCameraSnapshot(
1738
1738
  this.document.documentKey,
1739
- Fi(e)
1739
+ Ni(e)
1740
1740
  );
1741
1741
  }
1742
1742
  syncDisplayContext() {
@@ -1782,7 +1782,7 @@ class ji {
1782
1782
  }
1783
1783
  this.viewportDemandTimer === null && (this.viewportDemandTimer = globalThis.setTimeout(() => {
1784
1784
  this.viewportDemandTimer = null, !(this.disposed || !this.session) && this.host.interaction === "active" && this.flushViewportDemand();
1785
- }, Math.max(0, this.host.viewportDemandCoalesceMs ?? Yi)));
1785
+ }, Math.max(0, this.host.viewportDemandCoalesceMs ?? ji)));
1786
1786
  }
1787
1787
  clearViewportDemandTimer() {
1788
1788
  this.viewportDemandTimer !== null && (globalThis.clearTimeout(this.viewportDemandTimer), this.viewportDemandTimer = null);
@@ -1819,19 +1819,19 @@ class ji {
1819
1819
  if (this.disposed) throw new Error("Viewer has been disposed.");
1820
1820
  }
1821
1821
  }
1822
- function Xi(s, e) {
1822
+ function qi(s, e) {
1823
1823
  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);
1824
1824
  }
1825
- function qi(s, e) {
1825
+ function $i(s, e) {
1826
1826
  return s === e || !!(s && e && s.documentKey === e.documentKey && s.id.textId === e.id.textId);
1827
1827
  }
1828
- function $i(s, e) {
1828
+ function Gi(s, e) {
1829
1829
  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);
1830
1830
  }
1831
- function Gi(s, e) {
1831
+ function Wi(s, e) {
1832
1832
  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);
1833
1833
  }
1834
- function Wi(s) {
1834
+ function Ki(s) {
1835
1835
  let e = null;
1836
1836
  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;
1837
1837
  let t = 2166136261;
@@ -1839,11 +1839,11 @@ function Wi(s) {
1839
1839
  t ^= e.charCodeAt(i), t = Math.imul(t, 16777619);
1840
1840
  return `reference:src-${(t >>> 0).toString(16)}`;
1841
1841
  }
1842
- function it(s) {
1842
+ function rt(s) {
1843
1843
  if (!s || typeof s != "object") return s;
1844
1844
  Object.freeze(s);
1845
1845
  for (const e of Object.values(s))
1846
- e && typeof e == "object" && !Object.isFrozen(e) && it(e);
1846
+ e && typeof e == "object" && !Object.isFrozen(e) && rt(e);
1847
1847
  return s;
1848
1848
  }
1849
1849
  function Y(s, e, t) {
@@ -1851,7 +1851,7 @@ function Y(s, e, t) {
1851
1851
  return { code: c, stage: c === "E_FETCH" ? "source" : c === "E_PARSE_HEADER" ? "header" : c === "E_WORKER" ? "worker" : c === "E_PARSE_GEOMETRY" ? "geometry" : c === "E_SIDECAR_FETCH" ? "sidecar" : c === "E_ANNOTATION" ? "annotation" : c === "E_FONT" ? "font" : c === "E_ABORTED" || c === "E_SUPERSEDED" ? "lifecycle" : "source", fatal: e, source: t };
1852
1852
  }
1853
1853
  const Me = 1;
1854
- class Ki {
1854
+ class Zi {
1855
1855
  constructor(e) {
1856
1856
  d(this, "startX", 0);
1857
1857
  d(this, "startY", 0);
@@ -1902,7 +1902,7 @@ class Ki {
1902
1902
  function oe(s, e) {
1903
1903
  return `${s}:${e}`;
1904
1904
  }
1905
- class Zi {
1905
+ class Ji {
1906
1906
  constructor() {
1907
1907
  d(this, "expandedLayers", /* @__PURE__ */ new Set());
1908
1908
  d(this, "expandedBlocks", /* @__PURE__ */ new Set());
@@ -1946,7 +1946,7 @@ class Zi {
1946
1946
  this.revealedSelectionKey = null, this.suppressedSelectionKey = null;
1947
1947
  }
1948
1948
  }
1949
- function A(s) {
1949
+ function R(s) {
1950
1950
  return s.replace(/[&<>"']/g, (e) => ({
1951
1951
  "&": "&amp;",
1952
1952
  "<": "&lt;",
@@ -1955,7 +1955,7 @@ function A(s) {
1955
1955
  "'": "&#39;"
1956
1956
  })[e] ?? e);
1957
1957
  }
1958
- const Ji = {
1958
+ const Qi = {
1959
1959
  "panel.layers": "图层",
1960
1960
  "panel.properties": "属性",
1961
1961
  "panel.layers.aria": "图层面板",
@@ -2034,7 +2034,7 @@ const Ji = {
2034
2034
  "status.parsing": "解析中…",
2035
2035
  "status.incrementalLoading": "增量渲染中…",
2036
2036
  "unit.mm": "mm"
2037
- }, Qi = {
2037
+ }, er = {
2038
2038
  "panel.layers": "Layers",
2039
2039
  "panel.properties": "Properties",
2040
2040
  "panel.layers.aria": "Layers panel",
@@ -2114,29 +2114,29 @@ const Ji = {
2114
2114
  "status.incrementalLoading": "Rendering incrementally…",
2115
2115
  "unit.mm": "mm"
2116
2116
  };
2117
- function er(s, e) {
2117
+ function tr(s, e) {
2118
2118
  return e ? s.replace(/\{([a-zA-Z0-9_]+)\}/g, (t, i) => {
2119
2119
  const r = e[i];
2120
2120
  return r === void 0 ? t : String(r);
2121
2121
  }) : s;
2122
2122
  }
2123
- function tr(s) {
2123
+ function ir(s) {
2124
2124
  try {
2125
2125
  return new Intl.NumberFormat(s, { maximumFractionDigits: 4, useGrouping: !1 });
2126
2126
  } catch {
2127
2127
  return new Intl.NumberFormat("zh-CN", { maximumFractionDigits: 4, useGrouping: !1 });
2128
2128
  }
2129
2129
  }
2130
- function ir(s) {
2130
+ function rr(s) {
2131
2131
  try {
2132
2132
  return new Intl.NumberFormat(s, { maximumFractionDigits: 0 });
2133
2133
  } catch {
2134
2134
  return new Intl.NumberFormat("zh-CN", { maximumFractionDigits: 0 });
2135
2135
  }
2136
2136
  }
2137
- function rt(s) {
2137
+ function st(s) {
2138
2138
  var a;
2139
- const e = ((a = s.locale) == null ? void 0 : a.trim()) || "zh-CN", t = e.toLowerCase().startsWith("en") ? Qi : Ji, i = tr(e), r = ir(e), n = {
2139
+ const e = ((a = s.locale) == null ? void 0 : a.trim()) || "zh-CN", t = e.toLowerCase().startsWith("en") ? er : Qi, i = ir(e), r = rr(e), n = {
2140
2140
  locale: e,
2141
2141
  t(o, l) {
2142
2142
  var f;
@@ -2148,7 +2148,7 @@ function rt(s) {
2148
2148
  c = void 0;
2149
2149
  }
2150
2150
  const h = c ?? ((f = s.messages) == null ? void 0 : f[o]) ?? t[o] ?? o;
2151
- return er(h, l);
2151
+ return tr(h, l);
2152
2152
  },
2153
2153
  formatNumber(o) {
2154
2154
  return o == null || !Number.isFinite(o) ? "—" : i.format(o);
@@ -2177,17 +2177,17 @@ function rt(s) {
2177
2177
  };
2178
2178
  return n;
2179
2179
  }
2180
- const rr = {
2180
+ const sr = {
2181
2181
  "加载中…": "status.loading",
2182
2182
  "解析中…": "status.parsing",
2183
2183
  "增量渲染中…": "status.incrementalLoading"
2184
2184
  };
2185
- function sr(s, e) {
2186
- const t = s.trim(), i = rr[t];
2185
+ function nr(s, e) {
2186
+ const t = s.trim(), i = sr[t];
2187
2187
  return i ? e.t(i) : t;
2188
2188
  }
2189
- const he = rt({});
2190
- function nr(s) {
2189
+ const he = st({});
2190
+ function ar(s) {
2191
2191
  const e = /* @__PURE__ */ new Map();
2192
2192
  for (const i of s.usages) {
2193
2193
  const r = e.get(i.layerIndex) ?? /* @__PURE__ */ new Map(), n = oe(i.layerIndex, i.variantId);
@@ -2212,21 +2212,21 @@ function nr(s) {
2212
2212
  t.set(i, [...r.values()]);
2213
2213
  return t;
2214
2214
  }
2215
- function ar(s, e) {
2215
+ function or(s, e) {
2216
2216
  return s ? e.toLowerCase().includes(s) : !0;
2217
2217
  }
2218
- function Z(s, e, t) {
2218
+ function J(s, e, t) {
2219
2219
  s.dataset.visible = e ? "1" : "0", s.classList.toggle("off", !e), s.textContent = e ? "●" : "○", s.title = e ? t.t("layer.hideInsert") : t.t("layer.showInsert");
2220
2220
  }
2221
- function W(s, e, t) {
2221
+ function K(s, e, t) {
2222
2222
  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");
2223
2223
  }
2224
- function or(s) {
2224
+ function lr(s) {
2225
2225
  let e = 0;
2226
2226
  for (const t of s) t.visible && (e += 1);
2227
2227
  return e <= 0 ? "none" : e >= s.length ? "all" : "mixed";
2228
2228
  }
2229
- function st(s, e, t, i) {
2229
+ function nt(s, e, t, i) {
2230
2230
  if (!s) return !1;
2231
2231
  const r = s.id;
2232
2232
  return r.layerIndex !== e || r.variantId !== t ? !1 : i === void 0 ? !0 : r.instanceId === i;
@@ -2239,7 +2239,7 @@ function ke(s) {
2239
2239
  const r = i.top - t.top, n = s.scrollTop + r - (t.height - i.height) / 2;
2240
2240
  return s.scrollTop = Math.max(0, n), !0;
2241
2241
  }
2242
- function nt(s, e, t = 0) {
2242
+ function at(s, e, t = 0) {
2243
2243
  const i = () => {
2244
2244
  const r = s.getBoundingClientRect(), n = e.getBoundingClientRect();
2245
2245
  if (r.height <= 0) return;
@@ -2258,7 +2258,7 @@ function nt(s, e, t = 0) {
2258
2258
  };
2259
2259
  i(), typeof requestAnimationFrame == "function" && requestAnimationFrame(i);
2260
2260
  }
2261
- function lr(s, e) {
2261
+ function cr(s, e) {
2262
2262
  const t = e.trim().toLowerCase();
2263
2263
  s.querySelectorAll(".vui-lrow-wrap").forEach((i) => {
2264
2264
  var o, l;
@@ -2268,7 +2268,7 @@ function lr(s, e) {
2268
2268
  i.style.display = a ? "" : "none";
2269
2269
  });
2270
2270
  }
2271
- function cr(s, e) {
2271
+ function dr(s, e) {
2272
2272
  if (s.querySelectorAll(".vui-lrow-block.active, .vui-lrow-insert.active").forEach((o) => {
2273
2273
  o.classList.remove("active");
2274
2274
  }), !e) return;
@@ -2281,33 +2281,33 @@ function cr(s, e) {
2281
2281
  );
2282
2282
  a && a.classList.add("active");
2283
2283
  }
2284
- function dr(s, e, t, i = he) {
2284
+ function hr(s, e, t, i = he) {
2285
2285
  var l;
2286
2286
  const r = new Map(e.map((c) => [c.index, c]));
2287
2287
  s.querySelectorAll(".vui-lrow[data-layer-index]:not(.vui-lrow-all)").forEach((c) => {
2288
2288
  const h = r.get(Number(c.dataset.layerIndex));
2289
2289
  if (!h) return;
2290
2290
  const f = c.querySelector(".vui-lrow-eye");
2291
- f && (f.textContent = h.visible ? "●" : "○", f.title = h.visible ? i.t("layer.hide") : i.t("layer.show")), c.classList.toggle("off", !h.visible), at(c, ue(h));
2291
+ f && (f.textContent = h.visible ? "●" : "○", f.title = h.visible ? i.t("layer.hide") : i.t("layer.show")), c.classList.toggle("off", !h.visible), ot(c, ue(h));
2292
2292
  });
2293
2293
  const n = s.querySelector(".vui-lrow-all"), a = t === null ? "#c8c8c8" : U(t);
2294
2294
  (l = n == null ? void 0 : n.querySelector(".vui-lrow-clr")) == null || l.style.setProperty("background", a);
2295
2295
  const o = n == null ? void 0 : n.querySelector('input[type="color"]');
2296
2296
  o && o.value !== a && (o.value = a);
2297
2297
  }
2298
- function hr(s, e, t) {
2298
+ function ur(s, e, t) {
2299
2299
  var g;
2300
2300
  const i = t.text ?? he;
2301
2301
  e.resetForScope(t.scopeKey);
2302
- const r = e.filterText.trim().toLowerCase(), n = t.layers.rows, a = nr(t.blocks);
2302
+ const r = e.filterText.trim().toLowerCase(), n = t.layers.rows, a = ar(t.blocks);
2303
2303
  if (s.list.replaceChildren(), s.count.textContent = String(n.length), n.length === 0) {
2304
- s.list.appendChild(pr(i.t("layer.empty")));
2304
+ s.list.appendChild(mr(i.t("layer.empty")));
2305
2305
  return;
2306
2306
  }
2307
2307
  const o = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set();
2308
- for (const m of n) {
2309
- o.add(m.index);
2310
- for (const v of a.get(m.index) ?? []) l.add(v.key);
2308
+ for (const p of n) {
2309
+ o.add(p.index);
2310
+ for (const v of a.get(p.index) ?? []) l.add(v.key);
2311
2311
  }
2312
2312
  e.prune(o, l);
2313
2313
  const c = (g = t.selection) == null ? void 0 : g.id, h = c ? `${c.layerIndex}:${c.variantId}:${c.instanceId}` : null;
@@ -2317,33 +2317,33 @@ function hr(s, e, t) {
2317
2317
  <span class="vui-lrow-eye">◎</span>
2318
2318
  <span class="vui-lrow-dot"></span>
2319
2319
  <span class="vui-lrow-toggle placeholder">▶</span>
2320
- <span class="vui-lrow-name">${A(i.t("layer.all"))}</span>
2321
- <span class="vui-lrow-clr" style="background: ${t.layers.allColor == null ? "#c8c8c8" : `#${t.layers.allColor.toString(16).padStart(6, "0")}`}" title="${A(i.t("layer.colorOverrideAll"))}">
2320
+ <span class="vui-lrow-name">${R(i.t("layer.all"))}</span>
2321
+ <span class="vui-lrow-clr" style="background: ${t.layers.allColor == null ? "#c8c8c8" : `#${t.layers.allColor.toString(16).padStart(6, "0")}`}" title="${R(i.t("layer.colorOverrideAll"))}">
2322
2322
  <input type="color" value="#${(t.layers.allColor ?? 13158600).toString(16).padStart(6, "0")}">
2323
2323
  </span>`;
2324
2324
  const u = f.querySelector('input[type="color"]');
2325
2325
  u && u.addEventListener("input", () => {
2326
- var y, p, w;
2327
- const m = Number.parseInt(u.value.slice(1), 16), v = Number.isFinite(m) ? m : null;
2326
+ var y, m, x;
2327
+ const p = Number.parseInt(u.value.slice(1), 16), v = Number.isFinite(p) ? p : null;
2328
2328
  (y = t.beginLayerColorPreview) == null || y.call(t, u);
2329
2329
  try {
2330
2330
  if (t.setAllLayerColor) t.setAllLayerColor(v);
2331
- else for (const R of n) t.setLayerColor(R.index, v);
2332
- const x = v === null ? "#c8c8c8" : U(v);
2333
- (p = u.closest(".vui-lrow-clr")) == null || p.style.setProperty("background", x), Te(s.list, n, v);
2331
+ else for (const E of n) t.setLayerColor(E.index, v);
2332
+ const w = v === null ? "#c8c8c8" : U(v);
2333
+ (m = u.closest(".vui-lrow-clr")) == null || m.style.setProperty("background", w), Te(s.list, n, v);
2334
2334
  } finally {
2335
- (w = t.endLayerColorPreview) == null || w.call(t, u);
2335
+ (x = t.endLayerColorPreview) == null || x.call(t, u);
2336
2336
  }
2337
- }), u == null || u.addEventListener("click", (m) => m.stopPropagation());
2337
+ }), u == null || u.addEventListener("click", (p) => p.stopPropagation());
2338
2338
  const b = f.querySelector(".vui-lrow-clr");
2339
- b && b.addEventListener("contextmenu", (m) => {
2339
+ b && b.addEventListener("contextmenu", (p) => {
2340
2340
  var v;
2341
- if (m.preventDefault(), m.stopPropagation(), t.setAllLayerColor) t.setAllLayerColor(null);
2341
+ if (p.preventDefault(), p.stopPropagation(), t.setAllLayerColor) t.setAllLayerColor(null);
2342
2342
  else for (const y of n) t.setLayerColor(y.index, null);
2343
2343
  (v = u == null ? void 0 : u.closest(".vui-lrow-clr")) == null || v.style.setProperty("background", "#c8c8c8"), u && (u.value = "#c8c8c8"), Te(s.list, n, null);
2344
2344
  }), s.list.appendChild(f);
2345
- for (const m of n)
2346
- ar(r, m.name) && s.list.appendChild(ur(m, e, t, a.get(m.index) ?? [], i));
2345
+ for (const p of n)
2346
+ or(r, p.name) && s.list.appendChild(pr(p, e, t, a.get(p.index) ?? [], i));
2347
2347
  h && e.needsSelectionReveal(h) && (ke(s.list) && e.markSelectionRevealed(h), typeof requestAnimationFrame == "function" && requestAnimationFrame(() => {
2348
2348
  e.needsSelectionReveal(h) && ke(s.list) && e.markSelectionRevealed(h);
2349
2349
  }));
@@ -2352,9 +2352,9 @@ function U(s) {
2352
2352
  return `#${s.toString(16).padStart(6, "0")}`;
2353
2353
  }
2354
2354
  function ue(s) {
2355
- return s.color !== null ? U(s.color) : U(tt(s.sourceColor));
2355
+ return s.color !== null ? U(s.color) : U(it(s.sourceColor));
2356
2356
  }
2357
- function at(s, e) {
2357
+ function ot(s, e) {
2358
2358
  var r;
2359
2359
  (r = s.querySelector(".vui-lrow-dot")) == null || r.style.setProperty("background", e);
2360
2360
  const t = s.querySelector(".vui-lrow-clr");
@@ -2366,10 +2366,10 @@ function Te(s, e, t) {
2366
2366
  const i = new Map(e.map((r) => [r.index, r]));
2367
2367
  s.querySelectorAll(".vui-lrow[data-layer-index]").forEach((r) => {
2368
2368
  const n = i.get(Number(r.dataset.layerIndex));
2369
- n && at(r, t === null ? ue(n) : U(t));
2369
+ n && ot(r, t === null ? ue(n) : U(t));
2370
2370
  });
2371
2371
  }
2372
- function ur(s, e, t, i, r) {
2372
+ function pr(s, e, t, i, r) {
2373
2373
  const n = i.length > 0, a = e.expandedLayers.has(s.index), o = ue(s), l = document.createElement("div");
2374
2374
  l.className = "vui-lrow-wrap";
2375
2375
  const c = document.createElement("div");
@@ -2377,8 +2377,8 @@ function ur(s, e, t, i, r) {
2377
2377
  const h = document.createElement("button");
2378
2378
  h.type = "button", h.className = "vui-lrow-eye", h.textContent = s.visible ? "●" : "○", h.title = s.visible ? r.t("layer.hide") : r.t("layer.show"), h.addEventListener("click", (y) => {
2379
2379
  y.stopPropagation();
2380
- const p = !s.visible;
2381
- h.textContent = p ? "●" : "○", h.title = p ? r.t("layer.hide") : r.t("layer.show"), c.classList.toggle("off", !p), t.toggleLayer(s.index);
2380
+ const m = !s.visible;
2381
+ h.textContent = m ? "●" : "○", h.title = m ? r.t("layer.hide") : r.t("layer.show"), c.classList.toggle("off", !m), t.toggleLayer(s.index);
2382
2382
  });
2383
2383
  const f = document.createElement("span");
2384
2384
  f.className = "vui-lrow-dot", f.style.background = o;
@@ -2387,53 +2387,53 @@ function ur(s, e, t, i, r) {
2387
2387
  const b = (y) => {
2388
2388
  if (y.stopPropagation(), !n) return;
2389
2389
  e.toggleLayerExpanded(s.index);
2390
- const p = e.expandedLayers.has(s.index);
2391
- u.textContent = p ? "▼" : "▶";
2392
- let w = l.querySelector(":scope > .vui-lrow-blocks");
2393
- if (p)
2394
- if (w)
2395
- w.classList.add("open");
2390
+ const m = e.expandedLayers.has(s.index);
2391
+ u.textContent = m ? "▼" : "▶";
2392
+ let x = l.querySelector(":scope > .vui-lrow-blocks");
2393
+ if (m)
2394
+ if (x)
2395
+ x.classList.add("open");
2396
2396
  else {
2397
- w = document.createElement("div"), w.className = "vui-lrow-blocks open";
2398
- for (const x of i)
2399
- w.appendChild(De(x, e, t, r));
2400
- l.appendChild(w);
2397
+ x = document.createElement("div"), x.className = "vui-lrow-blocks open";
2398
+ for (const w of i)
2399
+ x.appendChild(De(w, e, t, r));
2400
+ l.appendChild(x);
2401
2401
  }
2402
2402
  else {
2403
- w == null || w.classList.remove("open");
2404
- const x = l.closest(".vui-section-list") ?? l.parentElement;
2405
- x && nt(x, c, 0);
2403
+ x == null || x.classList.remove("open");
2404
+ const w = l.closest(".vui-section-list") ?? l.parentElement;
2405
+ w && at(w, c, 0);
2406
2406
  }
2407
2407
  };
2408
2408
  u.addEventListener("click", b);
2409
2409
  const g = document.createElement("span");
2410
2410
  g.className = "vui-lrow-name", g.textContent = s.name || r.t("layer.unnamed"), g.title = s.name;
2411
- const m = document.createElement("span");
2412
- m.className = "vui-lrow-clr", m.style.background = o, m.title = r.t("layer.colorOverride");
2411
+ const p = document.createElement("span");
2412
+ p.className = "vui-lrow-clr", p.style.background = o, p.title = r.t("layer.colorOverride");
2413
2413
  const v = document.createElement("input");
2414
2414
  if (v.type = "color", v.value = o, v.addEventListener("input", () => {
2415
- var p, w;
2415
+ var m, x;
2416
2416
  const y = Number.parseInt(v.value.slice(1), 16);
2417
- (p = t.beginLayerColorPreview) == null || p.call(t, v);
2417
+ (m = t.beginLayerColorPreview) == null || m.call(t, v);
2418
2418
  try {
2419
- t.setLayerColor(s.index, Number.isFinite(y) ? y : null), f.style.background = v.value, m.style.background = v.value;
2419
+ t.setLayerColor(s.index, Number.isFinite(y) ? y : null), f.style.background = v.value, p.style.background = v.value;
2420
2420
  } finally {
2421
- (w = t.endLayerColorPreview) == null || w.call(t, v);
2421
+ (x = t.endLayerColorPreview) == null || x.call(t, v);
2422
2422
  }
2423
- }), v.addEventListener("click", (y) => y.stopPropagation()), m.addEventListener("contextmenu", (y) => {
2423
+ }), v.addEventListener("click", (y) => y.stopPropagation()), p.addEventListener("contextmenu", (y) => {
2424
2424
  y.preventDefault(), y.stopPropagation(), t.setLayerColor(s.index, null);
2425
- const p = U(tt(s.sourceColor));
2426
- v.value = p, f.style.background = p, m.style.background = p;
2427
- }), m.appendChild(v), c.append(h, f, u, g, m), c.addEventListener("click", (y) => {
2428
- const p = y.target;
2429
- if (p instanceof HTMLInputElement && p.type === "color" || p.closest(".vui-lrow-clr") || p.closest(".vui-lrow-toggle") || p.closest(".vui-lrow-eye")) return;
2430
- const w = !s.visible;
2431
- h.textContent = w ? "●" : "○", h.title = w ? r.t("layer.hide") : r.t("layer.show"), c.classList.toggle("off", !w), t.toggleLayer(s.index);
2425
+ const m = U(it(s.sourceColor));
2426
+ v.value = m, f.style.background = m, p.style.background = m;
2427
+ }), p.appendChild(v), c.append(h, f, u, g, p), c.addEventListener("click", (y) => {
2428
+ const m = y.target;
2429
+ if (m instanceof HTMLInputElement && m.type === "color" || m.closest(".vui-lrow-clr") || m.closest(".vui-lrow-toggle") || m.closest(".vui-lrow-eye")) return;
2430
+ const x = !s.visible;
2431
+ h.textContent = x ? "●" : "○", h.title = x ? r.t("layer.hide") : r.t("layer.show"), c.classList.toggle("off", !x), t.toggleLayer(s.index);
2432
2432
  }), l.appendChild(c), n && a) {
2433
2433
  const y = document.createElement("div");
2434
2434
  y.className = "vui-lrow-blocks open";
2435
- for (const p of i)
2436
- y.appendChild(De(p, e, t, r));
2435
+ for (const m of i)
2436
+ y.appendChild(De(m, e, t, r));
2437
2437
  l.appendChild(y);
2438
2438
  }
2439
2439
  return l;
@@ -2441,49 +2441,49 @@ function ur(s, e, t, i, r) {
2441
2441
  function De(s, e, t, i) {
2442
2442
  const r = document.createElement("div");
2443
2443
  r.className = "vui-lrow-block-wrap";
2444
- const n = e.expandedBlocks.has(s.key), a = or(s.inserts), o = st(t.selection, s.layerIndex, s.variantId), l = document.createElement("div");
2444
+ const n = e.expandedBlocks.has(s.key), a = lr(s.inserts), o = nt(t.selection, s.layerIndex, s.variantId), l = document.createElement("div");
2445
2445
  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"));
2446
2446
  const c = document.createElement("button");
2447
- c.type = "button", c.className = "vui-lrow-block-visibility", W(c, a, i), c.addEventListener("click", (g) => {
2447
+ c.type = "button", c.className = "vui-lrow-block-visibility", K(c, a, i), c.addEventListener("click", (g) => {
2448
2448
  if (g.stopPropagation(), a === "none") {
2449
2449
  const v = e.blockVisibilitySnapshots.get(s.key), y = [];
2450
- for (const p of s.inserts) {
2451
- const w = (v == null ? void 0 : v.get(p.instanceId)) ?? !0;
2452
- p.visible !== w && y.push({ insertId: p.insertId, visible: w });
2450
+ for (const m of s.inserts) {
2451
+ const x = (v == null ? void 0 : v.get(m.instanceId)) ?? !0;
2452
+ m.visible !== x && y.push({ insertId: m.insertId, visible: x });
2453
2453
  }
2454
- if (W(c, "all", i), r.querySelectorAll(".vui-lrow-insert-visibility").forEach((p) => {
2455
- Z(p, !0, i);
2454
+ if (K(c, "all", i), r.querySelectorAll(".vui-lrow-insert-visibility").forEach((m) => {
2455
+ J(m, !0, i);
2456
2456
  }), t.batchToggleInserts && y.length > 0)
2457
2457
  t.batchToggleInserts(y);
2458
2458
  else
2459
- for (const p of y) t.toggleInsert(p.insertId, p.visible);
2459
+ for (const m of y) t.toggleInsert(m.insertId, m.visible);
2460
2460
  return;
2461
2461
  }
2462
2462
  e.blockVisibilitySnapshots.set(
2463
2463
  s.key,
2464
2464
  new Map(s.inserts.map((v) => [v.instanceId, v.visible]))
2465
2465
  );
2466
- const m = s.inserts.filter((v) => v.visible).map((v) => ({ insertId: v.insertId, visible: !1 }));
2467
- if (W(c, "none", i), r.querySelectorAll(".vui-lrow-insert-visibility").forEach((v) => {
2468
- Z(v, !1, i);
2469
- }), t.batchToggleInserts && m.length > 0)
2470
- t.batchToggleInserts(m);
2466
+ const p = s.inserts.filter((v) => v.visible).map((v) => ({ insertId: v.insertId, visible: !1 }));
2467
+ if (K(c, "none", i), r.querySelectorAll(".vui-lrow-insert-visibility").forEach((v) => {
2468
+ J(v, !1, i);
2469
+ }), t.batchToggleInserts && p.length > 0)
2470
+ t.batchToggleInserts(p);
2471
2471
  else
2472
- for (const v of m) t.toggleInsert(v.insertId, !1);
2472
+ for (const v of p) t.toggleInsert(v.insertId, !1);
2473
2473
  });
2474
2474
  const h = document.createElement("button");
2475
2475
  h.type = "button", h.className = "vui-lrow-block-toggle", h.textContent = n ? "▼" : "▶";
2476
2476
  const f = (g) => {
2477
2477
  g.stopPropagation(), e.toggleBlockExpanded(s.layerIndex, s.variantId);
2478
- const m = e.expandedBlocks.has(s.key);
2479
- h.textContent = m ? "▼" : "▶";
2478
+ const p = e.expandedBlocks.has(s.key);
2479
+ h.textContent = p ? "▼" : "▶";
2480
2480
  let v = r.querySelector(":scope > .vui-lrow-inserts");
2481
- if (m)
2481
+ if (p)
2482
2482
  v ? v.classList.add("open") : (v = Oe(s, e, t, c, i), r.appendChild(v));
2483
2483
  else {
2484
2484
  v == null || v.classList.remove("open");
2485
2485
  const y = r.closest(".vui-section-list") ?? r.parentElement;
2486
- y && nt(y, l, 24);
2486
+ y && at(y, l, 24);
2487
2487
  }
2488
2488
  };
2489
2489
  h.addEventListener("click", f);
@@ -2492,8 +2492,8 @@ function De(s, e, t, i) {
2492
2492
  const b = document.createElement("span");
2493
2493
  return b.className = "vui-lrow-block-count", b.textContent = `×${s.inserts.length}`, l.append(c, h, u, b), s.inserts.length === 1 && l.addEventListener("click", () => {
2494
2494
  if (!s.canHighlight) return;
2495
- const g = s.inserts[0], m = `${s.layerIndex}:${s.variantId}:${g.instanceId}`;
2496
- e.markSelectionRevealed(m), t.selectInsert(g.insertId);
2495
+ const g = s.inserts[0], p = `${s.layerIndex}:${s.variantId}:${g.instanceId}`;
2496
+ e.markSelectionRevealed(p), t.selectInsert(g.insertId);
2497
2497
  }), r.appendChild(l), n && r.appendChild(Oe(s, e, t, c, i)), r;
2498
2498
  }
2499
2499
  function Oe(s, e, t, i, r) {
@@ -2501,19 +2501,19 @@ function Oe(s, e, t, i, r) {
2501
2501
  n.className = "vui-lrow-inserts open";
2502
2502
  for (const a of s.inserts) {
2503
2503
  const o = document.createElement("div");
2504
- o.className = `vui-lrow-insert${st(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"));
2504
+ o.className = `vui-lrow-insert${nt(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"));
2505
2505
  const l = document.createElement("button");
2506
- l.type = "button", l.className = "vui-lrow-insert-visibility", Z(l, a.visible, r), l.addEventListener("click", (h) => {
2506
+ l.type = "button", l.className = "vui-lrow-insert-visibility", J(l, a.visible, r), l.addEventListener("click", (h) => {
2507
2507
  h.stopPropagation();
2508
2508
  const f = !a.visible;
2509
- Z(l, f, r);
2509
+ J(l, f, r);
2510
2510
  const u = n.querySelectorAll(".vui-lrow-insert-visibility");
2511
2511
  let b = 0;
2512
- u.forEach((m) => {
2513
- m.dataset.visible === "1" && b++;
2512
+ u.forEach((p) => {
2513
+ p.dataset.visible === "1" && b++;
2514
2514
  });
2515
2515
  const g = b === 0 ? "none" : b === u.length ? "all" : "mixed";
2516
- W(i, g, r), t.toggleInsert(a.insertId, f);
2516
+ K(i, g, r), t.toggleInsert(a.insertId, f);
2517
2517
  });
2518
2518
  const c = document.createElement("span");
2519
2519
  c.className = "vui-lrow-insert-label", c.textContent = a.label, c.title = a.label, o.append(l, c), o.addEventListener("click", () => {
@@ -2524,11 +2524,11 @@ function Oe(s, e, t, i, r) {
2524
2524
  }
2525
2525
  return n;
2526
2526
  }
2527
- function pr(s) {
2527
+ function mr(s) {
2528
2528
  const e = document.createElement("div");
2529
2529
  return e.className = "vui-empty-note", e.textContent = s, e;
2530
2530
  }
2531
- function mr(s, e) {
2531
+ function fr(s, e) {
2532
2532
  const t = () => {
2533
2533
  e(s.value);
2534
2534
  };
@@ -2536,35 +2536,35 @@ function mr(s, e) {
2536
2536
  }
2537
2537
  function Le(s, e, t = he, i = "mm") {
2538
2538
  if (s.body.replaceChildren(), e.textSelection && e.textDetails) {
2539
- V(s, !1), vr(s.body, e.textDetails, t, i), Fe(s.body);
2539
+ V(s, !1), br(s.body, e.textDetails, t, i), Fe(s.body);
2540
2540
  return;
2541
2541
  }
2542
2542
  if (!e.selection || !e.details) {
2543
- V(s, !1), s.body.appendChild(br(t.t("property.empty")));
2543
+ V(s, !1), s.body.appendChild(gr(t.t("property.empty")));
2544
2544
  return;
2545
2545
  }
2546
- fr(s.body, e.details, t, i), Fe(s.body);
2546
+ vr(s.body, e.details, t, i), Fe(s.body);
2547
2547
  }
2548
2548
  function V(s, e) {
2549
2549
  if (!s.previewWrap || !s.previewCanvas || (s.previewWrap.hidden = !e, e)) return;
2550
2550
  const t = s.previewCanvas.getContext("2d");
2551
2551
  t == null || t.clearRect(0, 0, s.previewCanvas.width, s.previewCanvas.height);
2552
2552
  }
2553
- function fr(s, e, t, i) {
2554
- ot(s, t.t("property.insert"), e.blockName), le(s, t.t("property.basic"), (r) => {
2555
- E(r, t.t("property.block"), e.blockName), E(r, t.t("property.layer"), e.layerName), E(r, t.t("property.instance"), `#${e.id.instanceId}`), E(r, t.t("property.currentShape"), t.t("property.normalShape"));
2553
+ function vr(s, e, t, i) {
2554
+ lt(s, t.t("property.insert"), e.blockName), le(s, t.t("property.basic"), (r) => {
2555
+ S(r, t.t("property.block"), e.blockName), S(r, t.t("property.layer"), e.layerName), S(r, t.t("property.instance"), `#${e.id.instanceId}`), S(r, t.t("property.currentShape"), t.t("property.normalShape"));
2556
2556
  }), le(s, t.t("property.transform"), (r) => {
2557
- E(r, "X", t.formatUnit(e.tx, i)), E(r, "Y", t.formatUnit(e.ty, i)), E(r, t.t("property.rotation"), t.formatUnit(e.rotation, "°")), E(r, "Sx", t.formatNumber(e.scaleX)), E(r, "Sy", t.formatNumber(e.scaleY));
2557
+ S(r, "X", t.formatUnit(e.tx, i)), S(r, "Y", t.formatUnit(e.ty, i)), S(r, t.t("property.rotation"), t.formatUnit(e.rotation, "°")), S(r, "Sx", t.formatNumber(e.scaleX)), S(r, "Sy", t.formatNumber(e.scaleY));
2558
2558
  });
2559
2559
  }
2560
- function vr(s, e, t, i) {
2561
- ot(s, t.t("property.text"), e.content), le(s, t.t("property.basic"), (r) => {
2562
- E(r, t.t("property.layer"), e.layerName), E(r, t.t("property.content"), e.content), E(r, t.t("property.height"), t.formatUnit(e.height, i)), E(r, "X", t.formatUnit(e.x, i)), E(r, "Y", t.formatUnit(e.y, i)), E(r, t.t("property.rotation"), t.formatUnit(e.rotation, "°"));
2560
+ function br(s, e, t, i) {
2561
+ lt(s, t.t("property.text"), e.content), le(s, t.t("property.basic"), (r) => {
2562
+ S(r, t.t("property.layer"), e.layerName), S(r, t.t("property.content"), e.content), S(r, t.t("property.height"), t.formatUnit(e.height, i)), S(r, "X", t.formatUnit(e.x, i)), S(r, "Y", t.formatUnit(e.y, i)), S(r, t.t("property.rotation"), t.formatUnit(e.rotation, "°"));
2563
2563
  });
2564
2564
  }
2565
- function ot(s, e, t) {
2565
+ function lt(s, e, t) {
2566
2566
  const i = document.createElement("div");
2567
- i.className = "vui-pp-section vui-pp-title-row", i.innerHTML = `<strong>${A(e)}</strong><span>·</span><span>${A(t)}</span>`, s.appendChild(i);
2567
+ i.className = "vui-pp-section vui-pp-title-row", i.innerHTML = `<strong>${R(e)}</strong><span>·</span><span>${R(t)}</span>`, s.appendChild(i);
2568
2568
  }
2569
2569
  function le(s, e, t) {
2570
2570
  const i = document.createElement("section");
@@ -2572,11 +2572,11 @@ function le(s, e, t) {
2572
2572
  const r = document.createElement("div");
2573
2573
  r.className = "vui-pp-section-label", r.textContent = e, i.appendChild(r), t(i), s.appendChild(i);
2574
2574
  }
2575
- function E(s, e, t) {
2575
+ function S(s, e, t) {
2576
2576
  const i = document.createElement("div");
2577
- i.className = "vui-pp-row", i.innerHTML = `<span class="label">${A(e)}</span><span class="value" title="${A(t)}">${A(t)}</span>`, s.appendChild(i);
2577
+ i.className = "vui-pp-row", i.innerHTML = `<span class="label">${R(e)}</span><span class="value" title="${R(t)}">${R(t)}</span>`, s.appendChild(i);
2578
2578
  }
2579
- function br(s) {
2579
+ function gr(s) {
2580
2580
  const e = document.createElement("div");
2581
2581
  return e.className = "vui-empty-note", e.textContent = s, e;
2582
2582
  }
@@ -2588,17 +2588,17 @@ function Fe(s) {
2588
2588
  if (s.querySelector("textarea"))
2589
2589
  throw new Error("Property panel must not contain textarea elements");
2590
2590
  }
2591
- const gr = typeof requestAnimationFrame == "function" ? requestAnimationFrame.bind(globalThis) : (s) => globalThis.setTimeout(() => s(performance.now()), 16), yr = typeof cancelAnimationFrame == "function" ? cancelAnimationFrame.bind(globalThis) : (s) => {
2591
+ const yr = typeof requestAnimationFrame == "function" ? requestAnimationFrame.bind(globalThis) : (s) => globalThis.setTimeout(() => s(performance.now()), 16), wr = typeof cancelAnimationFrame == "function" ? cancelAnimationFrame.bind(globalThis) : (s) => {
2592
2592
  globalThis.clearTimeout(s);
2593
2593
  };
2594
- class wr {
2594
+ class xr {
2595
2595
  constructor(e) {
2596
2596
  d(this, "onFlush");
2597
2597
  d(this, "requestFrame");
2598
2598
  d(this, "cancelFrame");
2599
2599
  d(this, "pending", /* @__PURE__ */ new Map());
2600
2600
  d(this, "scheduledHandle", null);
2601
- this.onFlush = e.onFlush, this.requestFrame = e.requestFrame ?? gr, this.cancelFrame = e.cancelFrame ?? yr;
2601
+ this.onFlush = e.onFlush, this.requestFrame = e.requestFrame ?? yr, this.cancelFrame = e.cancelFrame ?? wr;
2602
2602
  }
2603
2603
  enqueue(e, t) {
2604
2604
  this.pending.set(e, t), this.scheduledHandle === null && (this.scheduledHandle = this.requestFrame(() => {
@@ -2622,7 +2622,7 @@ class wr {
2622
2622
  this.pending.clear(), this.scheduledHandle !== null && (this.cancelFrame(this.scheduledHandle), this.scheduledHandle = null);
2623
2623
  }
2624
2624
  }
2625
- const xr = `
2625
+ const Cr = `
2626
2626
  :host {
2627
2627
  display: block;
2628
2628
  width: 100%;
@@ -3492,7 +3492,7 @@ button, input { font: inherit; }
3492
3492
  .vui-infobar-content { max-width: calc(100vw - 48px); }
3493
3493
  .vui-infobar-tools .vui-info-text { max-width: min(180px, 45vw); }
3494
3494
  }
3495
- `, Cr = {
3495
+ `, Er = {
3496
3496
  dark: `
3497
3497
  :host, .vui-root[data-theme="dark"] {
3498
3498
  --vui-bg: #0A0B0F;
@@ -3613,13 +3613,13 @@ function re(s = "dark", e = {}) {
3613
3613
  hudBackground: "--vui-hud-bg"
3614
3614
  }, i = Object.entries(e).filter(([, r]) => typeof r == "string" && r.trim().length > 0).map(([r, n]) => `${t[r]}: ${n};`).join(`
3615
3615
  `);
3616
- return `${Cr[s]}${i ? `
3616
+ return `${Er[s]}${i ? `
3617
3617
  :host, .vui-root[data-theme="${s}"] {
3618
3618
  ${i}
3619
3619
  }
3620
- ` : ""}${xr}`;
3620
+ ` : ""}${Cr}`;
3621
3621
  }
3622
- const Er = {
3622
+ const Sr = {
3623
3623
  layerPanel: !0,
3624
3624
  propertyPanel: !0,
3625
3625
  hud: !0,
@@ -3629,8 +3629,8 @@ const Er = {
3629
3629
  infobarLineMode: !0,
3630
3630
  infobarPhase: !0,
3631
3631
  infobarDebug: !0
3632
- }, Ne = "property-panel:open", Ve = "layer-panel:open", Be = 300, _e = 180, Sr = 2;
3633
- let Pr = 0;
3632
+ }, Ne = "property-panel:open", Ve = "layer-panel:open", Be = 300, ze = 180, Pr = 2;
3633
+ let Ar = 0;
3634
3634
  function L(s, ...e) {
3635
3635
  const t = document.createElement("div");
3636
3636
  t.className = "vui-debug-row";
@@ -3639,7 +3639,7 @@ function L(s, ...e) {
3639
3639
  const r = document.createElement("div");
3640
3640
  return r.className = "vui-debug-value", r.append(...e), t.append(i, r), t;
3641
3641
  }
3642
- function ze(s, e, t) {
3642
+ function _e(s, e, t) {
3643
3643
  const i = document.createElement("div");
3644
3644
  i.className = "vui-debug-spread";
3645
3645
  const r = document.createElement("b");
@@ -3655,7 +3655,7 @@ function Ue(s) {
3655
3655
  const e = document.createElement("div");
3656
3656
  return e.className = "vui-debug-spread-list", e.append(...s), e;
3657
3657
  }
3658
- function Ar(s, e) {
3658
+ function Rr(s, e) {
3659
3659
  switch (s) {
3660
3660
  case "created":
3661
3661
  return e.t("status.created");
@@ -3683,11 +3683,11 @@ function He(s) {
3683
3683
  return n === "" || n === "true" || n === "plaintext-only";
3684
3684
  });
3685
3685
  }
3686
- class Rr {
3686
+ class Ir {
3687
3687
  constructor(e, t) {
3688
3688
  d(this, "parts");
3689
3689
  d(this, "text");
3690
- d(this, "layerPanelState", new Zi());
3690
+ d(this, "layerPanelState", new Ji());
3691
3691
  d(this, "shadow", null);
3692
3692
  d(this, "layerPanelRefs", null);
3693
3693
  d(this, "propertyPanelRefs", null);
@@ -3731,7 +3731,7 @@ class Rr {
3731
3731
  d(this, "filterCleanup", null);
3732
3732
  d(this, "disposed", !1);
3733
3733
  d(this, "persistenceNamespace");
3734
- d(this, "insertToggleScheduler", new wr({
3734
+ d(this, "insertToggleScheduler", new xr({
3735
3735
  onFlush: (e) => {
3736
3736
  this.host.cad.blocks.batchToggleInserts(e);
3737
3737
  }
@@ -3744,7 +3744,7 @@ class Rr {
3744
3744
  if (!(this.disposed || !this.active)) {
3745
3745
  if (this.infobarRefs && this.parts.hud) {
3746
3746
  const t = this.host.cad.hud;
3747
- 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 ? Ar(t.phase, this.text) : "", this.infobarRefs.phase.hidden = !this.infobarRefs.phase.textContent;
3747
+ 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 ? Rr(t.phase, this.text) : "", this.infobarRefs.phase.hidden = !this.infobarRefs.phase.textContent;
3748
3748
  const i = Math.round(t.fps);
3749
3749
  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);
3750
3750
  const r = t.blockVariantCount > 0 || t.splitBlockLayerGroupCount > 0 || t.entityCount > 0;
@@ -3755,7 +3755,7 @@ class Rr {
3755
3755
  blocks: this.text.formatInteger(t.blockVariantCount),
3756
3756
  split: this.text.formatInteger(t.splitBlockLayerGroupCount)
3757
3757
  });
3758
- const n = t.renderDebugBreakdown.map((c) => ze(
3758
+ const n = t.renderDebugBreakdown.map((c) => _e(
3759
3759
  c.label,
3760
3760
  this.text.t("toolbar.debug.breakdown", {
3761
3761
  renderables: this.text.formatInteger(c.renderables),
@@ -3768,7 +3768,7 @@ class Rr {
3768
3768
  })
3769
3769
  ];
3770
3770
  n.length > 0 && a.push(Ue(n));
3771
- const o = t.splitBlockLayerDetails.map((c) => ze(
3771
+ const o = t.splitBlockLayerDetails.map((c) => _e(
3772
3772
  `${c.blockName} #${c.variantId}`,
3773
3773
  this.text.t("toolbar.debug.spreadMeta", {
3774
3774
  layers: this.text.formatInteger(c.layerCount),
@@ -3805,7 +3805,7 @@ class Rr {
3805
3805
  const t = this.host.cad.hud, i = t.fileCount > 0 ? this.text.t("toolbar.layerSummary", {
3806
3806
  visible: this.text.formatInteger(t.visibleLayerCount),
3807
3807
  total: this.text.formatInteger(t.totalLayerCount)
3808
- }) : "", r = sr(t.statusMessage, this.text);
3808
+ }) : "", r = nr(t.statusMessage, this.text);
3809
3809
  this.toolbarInfoText.textContent = i && r ? `${i} | ${r}` : i || r;
3810
3810
  }
3811
3811
  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(
@@ -3816,7 +3816,7 @@ class Rr {
3816
3816
  }
3817
3817
  });
3818
3818
  var i, r, n, a;
3819
- this.host = e, this.options = t, this.parts = { ...Er, ...(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-${++Pr}`;
3819
+ this.host = e, this.options = t, this.parts = { ...Sr, ...(i = t.cad) == null ? void 0 : i.parts }, this.themeValue = t.theme ?? "dark", this.text = st({ ...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-${++Ar}`;
3820
3820
  }
3821
3821
  mount() {
3822
3822
  var o, l;
@@ -3902,7 +3902,7 @@ class Rr {
3902
3902
  const i = document.createElement("div");
3903
3903
  i.className = "vui-section";
3904
3904
  const r = document.createElement("div");
3905
- r.className = "vui-section-head", r.innerHTML = `<span class="vui-section-title">${A(this.text.t("panel.layers"))}</span><span class="vui-section-count">—</span>`;
3905
+ r.className = "vui-section-head", r.innerHTML = `<span class="vui-section-title">${R(this.text.t("panel.layers"))}</span><span class="vui-section-count">—</span>`;
3906
3906
  const n = document.createElement("div");
3907
3907
  n.className = "vui-section-filter-wrap";
3908
3908
  const a = document.createElement("input");
@@ -3916,8 +3916,8 @@ class Rr {
3916
3916
  const h = document.createElement("button");
3917
3917
  h.type = "button", h.className = "vui-btn", h.textContent = this.text.t("layer.collapse"), h.title = this.text.t("layer.collapseTitle"), h.addEventListener("click", () => {
3918
3918
  var v;
3919
- const g = (v = this.host.cad.inspector.selection) == null ? void 0 : v.id, m = g ? `${g.layerIndex}:${g.variantId}:${g.instanceId}` : null;
3920
- this.layerPanelState.collapseAll(m), this.refresh();
3919
+ const g = (v = this.host.cad.inspector.selection) == null ? void 0 : v.id, p = g ? `${g.layerIndex}:${g.variantId}:${g.instanceId}` : null;
3920
+ this.layerPanelState.collapseAll(p), this.refresh();
3921
3921
  }), o.append(l, c, h);
3922
3922
  const f = document.createElement("div");
3923
3923
  f.className = "vui-section-list", i.append(r, n, o, f), t.appendChild(i), this.layerPanelRefs = {
@@ -3953,7 +3953,7 @@ class Rr {
3953
3953
  if (a.className = "vui-info-text", this.toolbarInfoText = a, n.appendChild(a), this.parts.fit) {
3954
3954
  this.btnFit = document.createElement("button"), this.btnFit.type = "button", this.btnFit.className = "vui-btn";
3955
3955
  const v = this.getFitShortcut();
3956
- this.btnFit.innerHTML = v ? `${A(this.text.t("toolbar.fit"))} <span class="vui-kbd">${A(v.toUpperCase())}</span>` : A(this.text.t("toolbar.fit")), this.btnFit.addEventListener("click", () => this.host.fitSelectionOrDocument()), n.appendChild(this.btnFit);
3956
+ this.btnFit.innerHTML = v ? `${R(this.text.t("toolbar.fit"))} <span class="vui-kbd">${R(v.toUpperCase())}</span>` : R(this.text.t("toolbar.fit")), this.btnFit.addEventListener("click", () => this.host.fitSelectionOrDocument()), n.appendChild(this.btnFit);
3957
3957
  }
3958
3958
  if (this.parts.viewMode) {
3959
3959
  const v = document.createElement("div");
@@ -3975,8 +3975,8 @@ class Rr {
3975
3975
  b.className = "vui-debug-card";
3976
3976
  const g = document.createElement("summary");
3977
3977
  g.className = "vui-debug-summary", g.textContent = this.text.t("toolbar.details");
3978
- const m = document.createElement("div");
3979
- return m.className = "vui-debug-body", b.append(g, m), i.append(r, n, o, l, c, h, f, u, b), e.append(t, i), this.infobarRefs = {
3978
+ const p = document.createElement("div");
3979
+ return p.className = "vui-debug-body", b.append(g, p), i.append(r, n, o, l, c, h, f, u, b), e.append(t, i), this.infobarRefs = {
3980
3980
  infobar: e,
3981
3981
  file: r,
3982
3982
  tools: n,
@@ -3988,7 +3988,7 @@ class Rr {
3988
3988
  fps: u,
3989
3989
  debugCard: b,
3990
3990
  debugSummary: g,
3991
- debugBody: m
3991
+ debugBody: p
3992
3992
  }, this.infobar = e, this.infobarToggle = t, e;
3993
3993
  }
3994
3994
  buildPropertyPanel() {
@@ -3997,7 +3997,7 @@ class Rr {
3997
3997
  const t = document.createElement("div");
3998
3998
  t.className = "vui-property-panel", t.dataset.part = "property-panel";
3999
3999
  const i = document.createElement("div");
4000
- i.className = "vui-pp-head", i.innerHTML = `<span class="vui-pp-title-text">${A(this.text.t("panel.properties"))}</span>`;
4000
+ i.className = "vui-pp-head", i.innerHTML = `<span class="vui-pp-title-text">${R(this.text.t("panel.properties"))}</span>`;
4001
4001
  const r = document.createElement("div");
4002
4002
  r.className = "vui-pp-preview-wrap", r.hidden = !0;
4003
4003
  const n = document.createElement("canvas");
@@ -4010,8 +4010,8 @@ class Rr {
4010
4010
  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;
4011
4011
  }
4012
4012
  bindEvents() {
4013
- this.layerPanelRefs && (this.filterCleanup = mr(this.layerPanelRefs.filterInput, (e) => {
4014
- this.layerPanelState.filterText = e, this.layerPanelRefs && lr(this.layerPanelRefs.list, e);
4013
+ this.layerPanelRefs && (this.filterCleanup = fr(this.layerPanelRefs.filterInput, (e) => {
4014
+ this.layerPanelState.filterText = e, this.layerPanelRefs && cr(this.layerPanelRefs.list, e);
4015
4015
  })), this.unsubscribers.push(
4016
4016
  this.host.cad.on("document-change", () => this.refresh()),
4017
4017
  this.host.cad.on("layer-change", () => this.syncLayerChange()),
@@ -4019,7 +4019,7 @@ class Rr {
4019
4019
  this.host.cad.on("inspector-change", () => {
4020
4020
  if (this.layerPanelRefs && this.parts.layerPanel) {
4021
4021
  const e = this.host.cad.inspector.selection, t = e == null ? void 0 : e.id, i = t ? `${t.layerIndex}:${t.variantId}:${t.instanceId}` : null;
4022
- i && this.layerPanelState.needsSelectionReveal(i) ? this.renderLayerPanel() : cr(this.layerPanelRefs.list, e);
4022
+ i && this.layerPanelState.needsSelectionReveal(i) ? this.renderLayerPanel() : dr(this.layerPanelRefs.list, e);
4023
4023
  }
4024
4024
  this.propertyPanelRefs && this.parts.propertyPanel && (Le(this.propertyPanelRefs, this.host.cad.inspector, this.text, this.getCadUnit()), this.syncPropertyPanelSelectionState(), this.syncPropertyPanelPreview());
4025
4025
  }),
@@ -4080,7 +4080,7 @@ class Rr {
4080
4080
  return !!(e && e.isConnected && ((t = this.layerPanelRefs) != null && t.list.contains(e)));
4081
4081
  }
4082
4082
  renderLayerPanel() {
4083
- !this.layerPanelRefs || !this.parts.layerPanel || (hr(this.layerPanelRefs, this.layerPanelState, this.createLayerPanelActions()), this.renderedLayerRows = this.host.cad.layers.rows);
4083
+ !this.layerPanelRefs || !this.parts.layerPanel || (ur(this.layerPanelRefs, this.layerPanelState, this.createLayerPanelActions()), this.renderedLayerRows = this.host.cad.layers.rows);
4084
4084
  }
4085
4085
  syncLayerChange() {
4086
4086
  if (!this.isLayerColorPreviewActive()) {
@@ -4088,7 +4088,7 @@ class Rr {
4088
4088
  this.refresh();
4089
4089
  return;
4090
4090
  }
4091
- dr(
4091
+ hr(
4092
4092
  this.layerPanelRefs.list,
4093
4093
  this.host.cad.layers.rows,
4094
4094
  this.host.cad.layers.allColor,
@@ -4246,7 +4246,7 @@ class Rr {
4246
4246
  return (t = this.propertyPanelShell) != null && t.classList.contains("closed") ? !0 : !this.isPropertyPreviewLayoutReady(e);
4247
4247
  }
4248
4248
  isPropertyPreviewLayoutReady(e) {
4249
- return e.clientWidth >= _e && e.clientHeight >= _e;
4249
+ return e.clientWidth >= ze && e.clientHeight >= ze;
4250
4250
  }
4251
4251
  waitForPropertyPreviewLayout(e) {
4252
4252
  if (this.isPropertyPreviewLayoutReady(e)) return Promise.resolve();
@@ -4268,25 +4268,25 @@ class Rr {
4268
4268
  return;
4269
4269
  }
4270
4270
  if (y === o) {
4271
- a += 1, a >= Sr && u();
4271
+ a += 1, a >= Pr && u();
4272
4272
  return;
4273
4273
  }
4274
4274
  o = y, a = 0;
4275
4275
  }, g = (y) => {
4276
- if (!Ir(y)) return;
4277
- let p = !1;
4278
- const w = (R) => {
4279
- R.target !== y || R.propertyName !== "width" || x();
4280
- }, x = () => {
4281
- p || (p = !0, y.removeEventListener("transitionend", w), requestAnimationFrame(b));
4276
+ if (!Mr(y)) return;
4277
+ let m = !1;
4278
+ const x = (E) => {
4279
+ E.target !== y || E.propertyName !== "width" || w();
4280
+ }, w = () => {
4281
+ m || (m = !0, y.removeEventListener("transitionend", x), requestAnimationFrame(b));
4282
4282
  };
4283
- y.addEventListener("transitionend", w), l.push(window.setTimeout(x, Be)), c.push(() => {
4284
- p || (p = !0, y.removeEventListener("transitionend", w));
4283
+ y.addEventListener("transitionend", x), l.push(window.setTimeout(w, Be)), c.push(() => {
4284
+ m || (m = !0, y.removeEventListener("transitionend", x));
4285
4285
  });
4286
- }, m = () => {
4287
- b(), n || (h = requestAnimationFrame(m));
4286
+ }, p = () => {
4287
+ b(), n || (h = requestAnimationFrame(p));
4288
4288
  }, v = window.setTimeout(u, Be);
4289
- g(i), g(t), h = requestAnimationFrame(m), this.propertyPreviewLayoutWaitAbort = () => {
4289
+ g(i), g(t), h = requestAnimationFrame(p), this.propertyPreviewLayoutWaitAbort = () => {
4290
4290
  n = !0, f();
4291
4291
  };
4292
4292
  });
@@ -4303,7 +4303,7 @@ class Rr {
4303
4303
  this.propertyPreviewRenderHandle !== null && (cancelAnimationFrame(this.propertyPreviewRenderHandle), this.propertyPreviewRenderHandle = null), (e = this.propertyPreviewLayoutWaitAbort) == null || e.call(this), this.propertyPreviewLayoutWaitAbort = null;
4304
4304
  }
4305
4305
  }
4306
- function Ir(s) {
4306
+ function Mr(s) {
4307
4307
  const e = getComputedStyle(s), t = e.transitionDuration.split(",").map((r) => r.trim()), i = e.transitionProperty.split(",").map((r) => r.trim());
4308
4308
  for (let r = 0; r < i.length; r += 1) {
4309
4309
  const n = i[r] ?? i[0] ?? "all";
@@ -4312,8 +4312,8 @@ function Ir(s) {
4312
4312
  }
4313
4313
  return !1;
4314
4314
  }
4315
- const Mr = ["left", "right", "top", "bottom"], X = 0.5, kr = /* @__PURE__ */ new Set(["cad", "scene"]);
4316
- class Tr {
4315
+ const kr = ["left", "right", "top", "bottom"], q = 0.5, Tr = /* @__PURE__ */ new Set(["cad", "scene"]);
4316
+ class Dr {
4317
4317
  constructor(e) {
4318
4318
  d(this, "zoneContainers", /* @__PURE__ */ new Map());
4319
4319
  d(this, "mounts", /* @__PURE__ */ new Set());
@@ -4323,7 +4323,7 @@ class Tr {
4323
4323
  d(this, "flags", { layerPanelOpen: !1, propertyPanelOpen: !1 });
4324
4324
  d(this, "lastInsets", Object.freeze({ top: 0, right: 0, bottom: 0, left: 0 }));
4325
4325
  d(this, "lastFlags", { layerPanelOpen: !1, propertyPanelOpen: !1 });
4326
- d(this, "activeGroups", kr);
4326
+ d(this, "activeGroups", Tr);
4327
4327
  d(this, "warnedUnstableReference", !1);
4328
4328
  d(this, "disposed", !1);
4329
4329
  d(this, "frameHandle", null);
@@ -4414,7 +4414,7 @@ class Tr {
4414
4414
  installZoneStyles(e, t) {
4415
4415
  if (!e || typeof e.querySelector != "function" || typeof e.prepend != "function" || e.querySelector(`style[data-viewer-layout="${t}"]`)) return;
4416
4416
  const i = document.createElement("style");
4417
- i.dataset.viewerLayout = t, i.textContent = Lr, e.append(i), this.installedStyles.push(i), I(e) && (e.dataset.viewerLayoutHost = "", typeof getComputedStyle == "function" && getComputedStyle(e).position === "static" && (e.style.position = "relative"));
4417
+ i.dataset.viewerLayout = t, i.textContent = Fr, e.append(i), this.installedStyles.push(i), I(e) && (e.dataset.viewerLayoutHost = "", typeof getComputedStyle == "function" && getComputedStyle(e).position === "static" && (e.style.position = "relative"));
4418
4418
  }
4419
4419
  schedule() {
4420
4420
  if (!(this.disposed || this.frameHandle !== null)) {
@@ -4431,7 +4431,7 @@ class Tr {
4431
4431
  if (this.disposed) return;
4432
4432
  const e = this.host.reference(), t = this.host.target();
4433
4433
  if (!e || typeof e.getBoundingClientRect != "function") return;
4434
- const i = e.getBoundingClientRect(), r = this.computeInsets(i), n = !Or(r, this.lastInsets), a = this.flags.layerPanelOpen !== this.lastFlags.layerPanelOpen || this.flags.propertyPanelOpen !== this.lastFlags.propertyPanelOpen;
4434
+ const i = e.getBoundingClientRect(), r = this.computeInsets(i), n = !Lr(r, this.lastInsets), a = this.flags.layerPanelOpen !== this.lastFlags.layerPanelOpen || this.flags.propertyPanelOpen !== this.lastFlags.propertyPanelOpen;
4435
4435
  !n && !a || (this.lastInsets = r, this.lastFlags = { ...this.flags }, n && this.assertStableReference(e, t) && this.applyInsets(t, r), this.host.onChange(r, this.lastFlags));
4436
4436
  }
4437
4437
  applyInsets(e, t) {
@@ -4450,9 +4450,9 @@ class Tr {
4450
4450
  }
4451
4451
  for (const i of this.zoneContainers.values()) {
4452
4452
  const r = i.dataset.viewerZone;
4453
- if (!(!r || !Mr.includes(r) || !this.isZoneVisible(i)))
4453
+ if (!(!r || !kr.includes(r) || !this.isZoneVisible(i)))
4454
4454
  for (const n of Array.from(i.children)) {
4455
- if (!Dr(n)) continue;
4455
+ if (!Or(n)) continue;
4456
4456
  const a = n.getBoundingClientRect();
4457
4457
  this.accumulateInset(
4458
4458
  t,
@@ -4463,10 +4463,10 @@ class Tr {
4463
4463
  }
4464
4464
  }
4465
4465
  return Object.freeze({
4466
- top: q(t.top, e.height),
4467
- right: q(t.right, e.width),
4468
- bottom: q(t.bottom, e.height),
4469
- left: q(t.left, e.width)
4466
+ top: $(t.top, e.height),
4467
+ right: $(t.right, e.width),
4468
+ bottom: $(t.bottom, e.height),
4469
+ left: $(t.left, e.width)
4470
4470
  });
4471
4471
  }
4472
4472
  accumulateInset(e, t, i, r) {
@@ -4491,20 +4491,20 @@ function se(s, e, t) {
4491
4491
  function I(s) {
4492
4492
  return !!(s && typeof s == "object" && s.nodeType === 1);
4493
4493
  }
4494
- function Dr(s) {
4494
+ function Or(s) {
4495
4495
  if (!I(s) || s.hidden) return !1;
4496
4496
  const e = typeof getComputedStyle == "function" ? getComputedStyle(s) : null;
4497
4497
  return !(e && (e.display === "none" || e.visibility === "hidden"));
4498
4498
  }
4499
- function q(s, e) {
4499
+ function $(s, e) {
4500
4500
  if (!Number.isFinite(s)) return 0;
4501
4501
  const t = e > 0 ? Math.min(s, e) : s;
4502
4502
  return Math.max(0, Math.round(t * 2) / 2);
4503
4503
  }
4504
- function Or(s, e) {
4505
- return Math.abs(s.top - e.top) <= X && Math.abs(s.right - e.right) <= X && Math.abs(s.bottom - e.bottom) <= X && Math.abs(s.left - e.left) <= X;
4504
+ function Lr(s, e) {
4505
+ return Math.abs(s.top - e.top) <= q && Math.abs(s.right - e.right) <= q && Math.abs(s.bottom - e.bottom) <= q && Math.abs(s.left - e.left) <= q;
4506
4506
  }
4507
- const Lr = `
4507
+ const Fr = `
4508
4508
  [data-viewer-zone] { position: absolute; pointer-events: none; z-index: 1; }
4509
4509
  [data-viewer-zone] > * { pointer-events: auto; }
4510
4510
  [data-viewer-zone="left"] { left: 0; top: 0; bottom: 0; }
@@ -4513,7 +4513,7 @@ const Lr = `
4513
4513
  [data-viewer-zone="bottom"] { left: 0; right: 0; bottom: 0; }
4514
4514
  [data-viewer-zone="overlay"] { inset: 0; }
4515
4515
  [data-viewer-zone][data-viewer-zone-active="false"] { display: none; }
4516
- `, Fr = {
4516
+ `, Nr = {
4517
4517
  play: '<path d="m8 5 11 7-11 7Z"/>',
4518
4518
  pause: '<path d="M8 5v14M16 5v14"/>',
4519
4519
  reset: '<path d="M3 10a9 9 0 1 1 2.5 8M3 4v6h6"/>',
@@ -4527,10 +4527,10 @@ const Lr = `
4527
4527
  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"/>',
4528
4528
  moon: '<path d="M20.5 13A9 9 0 0 1 11 3.5 9 9 0 1 0 20.5 13Z"/>'
4529
4529
  };
4530
- function lt(s) {
4531
- 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">${Fr[s]}</svg>`;
4530
+ function ct(s) {
4531
+ 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">${Nr[s]}</svg>`;
4532
4532
  }
4533
- const Nr = {
4533
+ const Vr = {
4534
4534
  filename: !0,
4535
4535
  playback: !0,
4536
4536
  reset: !0,
@@ -4540,8 +4540,8 @@ const Nr = {
4540
4540
  collision: !0,
4541
4541
  theme: !0
4542
4542
  };
4543
- function Vr(s, e) {
4544
- const t = { ...Nr, ...e.parts }, i = document.createElement("nav");
4543
+ function Br(s, e) {
4544
+ const t = { ...Vr, ...e.parts }, i = document.createElement("nav");
4545
4545
  i.className = "vpu-toolbar", i.dataset.theme = e.theme ?? "dark", i.setAttribute("aria-label", e.label);
4546
4546
  const r = document.createElement("span");
4547
4547
  r.className = "vpu-filename", r.hidden = !0;
@@ -4549,95 +4549,109 @@ function Vr(s, e) {
4549
4549
  n.className = "vpu-actions", i.append(r, n);
4550
4550
  const a = /* @__PURE__ */ new Map();
4551
4551
  let o = null, l = null, c = e.theme ?? "dark", h = null;
4552
- const f = (m, v, y, p, w) => {
4553
- const x = document.createElement("button");
4554
- return x.type = "button", x.className = "vpu-btn", x.dataset.viewerControl = v, x.dataset.viewerControlId = m, x.innerHTML = lt(p), x.title = y, x.setAttribute("aria-label", y), x.addEventListener("click", w), a.set(m, { button: x, icon: p }), n.append(x), x;
4555
- }, u = (m, v) => m ? v === "filename" ? t.filename : v === "playback" ? t.playback && m.canPlay : v === "reset" ? t.reset && m.canReset : v === "fit" ? t.fit : v === "upAxis" ? t.upAxis && m.canReorientUpAxis === !0 : v === "ground" ? t.ground && m.canToggleGround === !0 : v === "collision" ? t.collision && m.canToggleCollision === !0 : t.theme : !1, b = (m) => {
4556
- h = m, n.replaceChildren(), a.clear(), o = null, l = null;
4557
- const v = (m == null ? void 0 : m.capabilities) ?? null;
4558
- if (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 && u(v, "playback")) {
4559
- const y = "playback";
4560
- l = y;
4561
- const p = f(y, "playback", "运行仿真", "play", () => {
4552
+ const f = (p, v, y, m, x) => {
4553
+ const w = document.createElement("button");
4554
+ return w.type = "button", w.className = "vpu-btn", w.dataset.viewerControl = v, w.dataset.viewerControlId = p, w.innerHTML = ct(m), w.title = y, w.setAttribute("aria-label", y), w.addEventListener("click", x), a.set(p, { button: w, icon: m }), n.append(w), w;
4555
+ }, u = (p, v) => p ? v === "filename" ? t.filename : v === "playback" ? t.playback && p.canPlay : v === "reset" ? t.reset && p.canReset : v === "fit" ? t.fit : v === "upAxis" ? t.upAxis && p.canReorientUpAxis === !0 : v === "ground" ? t.ground && p.canToggleGround === !0 : v === "collision" ? t.collision && p.canToggleCollision === !0 : t.theme : !1, b = (p) => {
4556
+ var y, m, x;
4557
+ h = p, n.replaceChildren(), a.clear(), o = null, l = null;
4558
+ const v = (p == null ? void 0 : p.capabilities) ?? null;
4559
+ if (r.hidden = !(t.filename && (p != null && p.filename)), r.textContent = (p == null ? void 0 : p.filename) ?? "", r.title = (p == null ? void 0 : p.filename) ?? "", p && u(v, "playback")) {
4560
+ const w = "playback";
4561
+ l = w;
4562
+ const E = f(w, "playback", "运行仿真", "play", () => {
4562
4563
  s.asset.$readControl().playing ? s.commands.pause() : s.commands.play();
4563
4564
  });
4564
- p.className = "vpu-btn vpu-btn-primary";
4565
+ E.className = "vpu-btn vpu-btn-primary";
4565
4566
  }
4566
- if (m && u(v, "reset") && f("reset", "reset", "重置仿真", "reset", () => {
4567
+ if ((p == null ? void 0 : p.kind) === "simulation" && p.phase === "ready" && t.playback && !(v != null && v.canPlay) && (((y = p.physics) == null ? void 0 : y.status) === "unavailable" || !p.physics && ((m = p.warning) == null ? void 0 : m.stage) === "physics-fallback")) {
4568
+ const w = ((x = p.physics) == null ? void 0 : x.status) === "unavailable" ? p.physics.issue.message : p.warning.message, E = f("playback", "playback", w, "play", () => {
4569
+ });
4570
+ E.setAttribute("aria-disabled", "true"), E.className = "vpu-btn vpu-btn-primary";
4571
+ }
4572
+ if (p && u(v, "reset") && f("reset", "reset", "重置仿真", "reset", () => {
4567
4573
  s.commands.reset();
4568
- }), m && u(v, "fit") && f("fit", "fit", "视角适应", "fit", () => {
4574
+ }), p && u(v, "fit") && f("fit", "fit", "视角适应", "fit", () => {
4569
4575
  s.commands.fitView();
4570
- }), m && u(v, "upAxis") && (o = "切换上轴", f("upAxis", "upAxis", o, "upAxisZ", () => {
4571
- const y = s.asset.$readControl().upAxis ?? "z";
4572
- s.commands.setUpAxis(y === "z" ? "y" : "z");
4573
- })), m && u(v, "ground") && f("ground", "ground", "显示地面", "ground", () => {
4574
- const y = s.asset.$readControl().groundVisible;
4575
- s.commands.setGroundVisible(!y);
4576
- }), m && u(v, "collision") && f("collision", "collision", "显示碰撞代理", "collision", () => {
4577
- const y = s.asset.$readControl().collisionVisible;
4578
- s.commands.setCollisionVisible(!y);
4579
- }), m && u(v, "theme")) {
4580
- const y = c === "dark";
4576
+ }), p && u(v, "upAxis") && (o = "切换上轴", f("upAxis", "upAxis", o, "upAxisZ", () => {
4577
+ const w = s.asset.$readControl().upAxis ?? "z";
4578
+ s.commands.setUpAxis(w === "z" ? "y" : "z");
4579
+ })), p && u(v, "ground") && f("ground", "ground", "显示地面", "ground", () => {
4580
+ const w = s.asset.$readControl().groundVisible;
4581
+ s.commands.setGroundVisible(!w);
4582
+ }), p && u(v, "collision") && f("collision", "collision", "显示碰撞代理", "collision", () => {
4583
+ const w = s.asset.$readControl().collisionVisible;
4584
+ s.commands.setCollisionVisible(!w);
4585
+ }), p && u(v, "theme")) {
4586
+ const w = c === "dark";
4581
4587
  f(
4582
4588
  "theme",
4583
4589
  "theme",
4584
- y ? "切换浅色主题" : "切换深色主题",
4585
- y ? "sun" : "moon",
4590
+ w ? "切换浅色主题" : "切换深色主题",
4591
+ w ? "sun" : "moon",
4586
4592
  () => s.commands.setTheme(c === "dark" ? "light" : "dark")
4587
4593
  );
4588
4594
  }
4589
4595
  i.hidden = n.childElementCount === 0 && r.hidden, g(s.asset.$readControl());
4590
- }, g = (m) => {
4596
+ }, g = (p) => {
4591
4597
  const v = l ? a.get(l) : void 0;
4592
- v && ($(v.button, m.playing ? "暂停仿真" : "运行仿真", m.playing ? "pause" : "play", m.playing), v.icon = m.playing ? "pause" : "play");
4598
+ v && (G(v.button, p.playing ? "暂停仿真" : "运行仿真", p.playing ? "pause" : "play", p.playing), v.icon = p.playing ? "pause" : "play");
4593
4599
  const y = a.get("ground");
4594
- y && $(y.button, m.groundVisible ? "隐藏地面" : "显示地面", "ground", m.groundVisible);
4595
- const p = a.get("collision");
4596
- p && $(p.button, m.collisionVisible ? "隐藏碰撞代理" : "显示碰撞代理", "collision", m.collisionVisible);
4597
- const w = a.get("upAxis");
4598
- w && $(w.button, _r(m.upAxis), Br(m.upAxis), m.upAxis === "y");
4600
+ y && G(y.button, p.groundVisible ? "隐藏地面" : "显示地面", "ground", p.groundVisible);
4601
+ const m = a.get("collision");
4602
+ m && G(m.button, p.collisionVisible ? "隐藏碰撞代理" : "显示碰撞代理", "collision", p.collisionVisible);
4603
+ const x = a.get("upAxis");
4604
+ x && G(x.button, _r(p.upAxis), zr(p.upAxis), p.upAxis === "y");
4599
4605
  };
4600
4606
  return {
4601
4607
  element: i,
4602
- update: (m) => b(m),
4608
+ update: (p) => b(p),
4603
4609
  pressedChanged: () => g(s.asset.$readControl()),
4604
- themeChanged: (m) => {
4605
- c = m, i.dataset.theme = m, b(h);
4610
+ themeChanged: (p) => {
4611
+ c = p, i.dataset.theme = p, b(h);
4606
4612
  },
4607
4613
  dispose: () => {
4608
4614
  i.remove();
4609
4615
  }
4610
4616
  };
4611
4617
  }
4612
- function $(s, e, t, i) {
4613
- s.innerHTML = lt(t), s.title = e, s.setAttribute("aria-label", e), s.setAttribute("aria-pressed", String(i)), s.classList.toggle("is-active", i);
4618
+ function G(s, e, t, i) {
4619
+ s.innerHTML = ct(t), s.title = e, s.setAttribute("aria-label", e), s.setAttribute("aria-pressed", String(i)), s.classList.toggle("is-active", i);
4614
4620
  }
4615
- function Br(s) {
4621
+ function zr(s) {
4616
4622
  return s === "y" ? "upAxisY" : "upAxisZ";
4617
4623
  }
4618
4624
  function _r(s) {
4619
4625
  return s === "y" ? "当前 Y-UP,点击切换为 Z-UP" : "当前 Z-UP,点击切换为 Y-UP";
4620
4626
  }
4621
- class zr {
4622
- constructor(e = "dark") {
4627
+ class Ur {
4628
+ constructor(e = "dark", t) {
4623
4629
  d(this, "root");
4624
4630
  d(this, "title");
4625
4631
  d(this, "detail");
4626
4632
  d(this, "toggle");
4633
+ d(this, "report");
4634
+ d(this, "reportLink", null);
4627
4635
  d(this, "disposed", !1);
4628
- const t = document.createElement("div");
4629
- t.className = "vpu-status", t.dataset.theme = e, t.hidden = !0, t.setAttribute("role", "status"), t.setAttribute("aria-live", "polite"), t.setAttribute("aria-atomic", "true");
4636
+ this.readReport = t;
4630
4637
  const i = document.createElement("div");
4631
- i.className = "vpu-status-spinner", i.setAttribute("aria-hidden", "true");
4638
+ i.className = "vpu-status", i.dataset.theme = e, i.hidden = !0, i.setAttribute("role", "status"), i.setAttribute("aria-live", "polite"), i.setAttribute("aria-atomic", "true");
4632
4639
  const r = document.createElement("div");
4633
- r.className = "vpu-status-title";
4640
+ r.className = "vpu-status-spinner", r.setAttribute("aria-hidden", "true");
4634
4641
  const n = document.createElement("div");
4635
- n.className = "vpu-status-detail", n.hidden = !0;
4636
- const a = document.createElement("button");
4637
- a.className = "vpu-status-toggle", a.type = "button", a.textContent = "!", a.hidden = !0, a.setAttribute("aria-label", "展开降级提示"), a.setAttribute("aria-expanded", "false"), a.addEventListener("click", () => {
4638
- const o = t.dataset.expanded === "true";
4639
- t.dataset.expanded = o ? "false" : "true", a.setAttribute("aria-expanded", String(!o));
4640
- }), t.append(i, r, n, a), this.root = t, this.title = r, this.detail = n, this.toggle = a;
4642
+ n.className = "vpu-status-title";
4643
+ const a = document.createElement("div");
4644
+ a.className = "vpu-status-detail", a.hidden = !0;
4645
+ const o = document.createElement("button");
4646
+ o.className = "vpu-status-toggle", o.type = "button", o.textContent = "!", o.hidden = !0, o.setAttribute("aria-label", "展开降级提示"), o.setAttribute("aria-expanded", "false"), o.addEventListener("click", () => {
4647
+ const c = i.dataset.expanded === "true";
4648
+ i.dataset.expanded = c ? "false" : "true", o.setAttribute("aria-expanded", String(!c)), c && this.closeReport();
4649
+ });
4650
+ const l = document.createElement("pre");
4651
+ l.className = "vpu-status-report", l.hidden = !0, l.tabIndex = 0, l.setAttribute("role", "region"), l.setAttribute("aria-label", "USD 视觉适配详情"), i.addEventListener("keydown", (c) => {
4652
+ var h;
4653
+ c.key === "Escape" && !l.hidden && (c.stopPropagation(), this.closeReport(), (h = this.reportLink) == null || h.focus());
4654
+ }), i.append(r, n, a, l, o), this.report = l, this.root = i, this.title = n, this.detail = a, this.toggle = o;
4641
4655
  }
4642
4656
  get element() {
4643
4657
  return this.root;
@@ -4645,22 +4659,58 @@ class zr {
4645
4659
  /** Renders one asset snapshot. Returns true when the overlay is visible. */
4646
4660
  update(e) {
4647
4661
  var t, i, r;
4648
- return this.disposed ? !1 : e ? e.phase === "failed" ? (((t = e.error) == null ? void 0 : t.code) === "E_ASSET_UNKNOWN_FORMAT" ? this.show("failed", "不支持的资产格式", e.error.message || "无法识别资产格式,请指定 format。") : this.show("failed", "资产加载失败", ((i = e.error) == null ? void 0 : i.message) ?? "未知错误"), !0) : e.kind === "cad" ? (this.hide(), !1) : e.phase === "loading" ? (this.show("loading", ((r = e.message) == null ? void 0 : r.trim()) || "正在加载资产...", ""), !0) : e.phase === "ready" && e.warning ? (this.show("warning", "已降级为视觉预览", e.warning.message), !0) : (this.hide(), !1) : (this.hide(), !1);
4662
+ if (this.disposed) return !1;
4663
+ if (!e)
4664
+ return this.hide(), !1;
4665
+ if (e.phase === "failed")
4666
+ return ((t = e.error) == null ? void 0 : t.code) === "E_ASSET_UNKNOWN_FORMAT" ? this.show("failed", "不支持的资产格式", e.error.message || "无法识别资产格式,请指定 format。") : this.show("failed", "资产加载失败", ((i = e.error) == null ? void 0 : i.message) ?? "未知错误"), !0;
4667
+ if (e.kind === "cad")
4668
+ return this.hide(), !1;
4669
+ if (e.phase === "loading")
4670
+ return this.show("loading", ((r = e.message) == null ? void 0 : r.trim()) || "正在加载资产...", ""), !0;
4671
+ if (e.phase === "ready" && e.warning) {
4672
+ const n = e.warning.stage === "physics-fallback" ? "已降级为视觉预览" : e.warning.stage === "visual-adaptation" ? "部分材质细节未完全还原" : "资产加载提示";
4673
+ return this.show("warning", n, e.warning.message), !0;
4674
+ }
4675
+ return this.hide(), !1;
4649
4676
  }
4650
4677
  themeChanged(e) {
4651
4678
  this.disposed || (this.root.dataset.theme = e);
4652
4679
  }
4653
4680
  dispose() {
4654
- this.disposed || (this.disposed = !0, this.root.remove());
4681
+ this.disposed || (this.disposed = !0, this.closeReport(), this.root.remove());
4655
4682
  }
4656
4683
  show(e, t, i) {
4657
- this.root.dataset.state = e, this.root.dataset.expanded = e === "warning" ? "false" : "true", this.root.hidden = !1, this.toggle.hidden = e !== "warning", this.title.textContent = t, this.detail.textContent = i, this.detail.hidden = i.length === 0;
4684
+ this.closeReport(), this.reportLink = null, this.root.dataset.state = e, this.root.dataset.expanded = e === "warning" ? "false" : "true", this.root.hidden = !1, this.toggle.hidden = e !== "warning", this.title.textContent = t, this.detail.textContent = "";
4685
+ const r = "visualAdaptation", n = i.indexOf(r);
4686
+ if (e === "warning" && n >= 0 && this.readReport) {
4687
+ const a = document.createElement("button");
4688
+ a.type = "button", a.className = "vpu-status-report-link", a.textContent = r, a.setAttribute("aria-expanded", "false"), a.setAttribute("aria-label", "查看 visualAdaptation 报告"), a.addEventListener("click", () => {
4689
+ var o;
4690
+ if (!this.report.hidden) {
4691
+ this.closeReport();
4692
+ return;
4693
+ }
4694
+ try {
4695
+ const l = (o = this.readReport) == null ? void 0 : o.call(this);
4696
+ this.report.textContent = l ? JSON.stringify(l, null, 2) : "当前资产暂无视觉适配报告。";
4697
+ } catch {
4698
+ this.report.textContent = "暂时无法读取视觉适配报告,请重新加载资产后重试。";
4699
+ }
4700
+ this.report.hidden = !1, a.setAttribute("aria-expanded", "true");
4701
+ }), this.reportLink = a, this.detail.append(document.createTextNode(i.slice(0, n)), a, document.createTextNode(i.slice(n + r.length)));
4702
+ } else this.detail.textContent = i;
4703
+ this.detail.hidden = i.length === 0;
4704
+ }
4705
+ closeReport() {
4706
+ var e;
4707
+ this.report.hidden = !0, this.report.textContent = "", (e = this.reportLink) == null || e.setAttribute("aria-expanded", "false");
4658
4708
  }
4659
4709
  hide() {
4660
- this.root.hidden || (this.root.hidden = !0, this.title.textContent = "", this.detail.textContent = "", this.detail.hidden = !0, this.toggle.hidden = !0);
4710
+ 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);
4661
4711
  }
4662
4712
  }
4663
- const Ur = `
4713
+ const Hr = `
4664
4714
  .vpu-root {
4665
4715
  position: absolute;
4666
4716
  inset: 0;
@@ -4746,6 +4796,7 @@ const Ur = `
4746
4796
  border-color: var(--vpu-active);
4747
4797
  color: var(--vpu-active-text);
4748
4798
  }
4799
+ .vpu-btn[aria-disabled="true"], .vpu-btn[aria-disabled="true"]:hover { opacity: 0.45; cursor: not-allowed; color: var(--vpu-text-muted); border-color: var(--vpu-border); background: var(--vpu-panel-bg); }
4749
4800
  .vpu-btn-primary.is-active { background: var(--vpu-active-bg); }
4750
4801
 
4751
4802
  /* Loading / failed overlay. */
@@ -4788,13 +4839,32 @@ const Ur = `
4788
4839
  }
4789
4840
  .vpu-status-detail[hidden] { display: none; }
4790
4841
  .vpu-status[data-state="failed"] .vpu-status-title { color: var(--vui-fail); }
4791
- .vpu-status[data-state="warning"] { inset: auto auto 18px 18px; width: min(420px, calc(100% - 36px)); padding: 0; background: transparent; box-shadow: none; pointer-events: none; align-items: flex-start; }
4842
+ .vpu-status[data-state="warning"] { box-sizing: border-box; inset: auto auto 18px 18px; width: min(360px, calc(100% - 36px)); padding: 0; background: transparent; box-shadow: none; pointer-events: none; align-items: flex-start; text-align: left; }
4792
4843
  .vpu-status[data-state="warning"] .vpu-status-spinner { display: none; }
4793
4844
  .vpu-status[data-state="warning"] .vpu-status-title, .vpu-status[data-state="warning"] .vpu-status-detail { display: none; }
4794
- .vpu-status-toggle { pointer-events: auto; width: 34px; height: 34px; border: 1px solid #e8a93a; border-radius: 50%; background: #e8a93a; color: #211a0e; font-size: 22px; font-weight: 800; cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,.3); }
4795
- .vpu-status[data-state="warning"][data-expanded="true"] { padding: 12px 14px; border: 1px solid #e8a93a; border-radius: 8px; background: color-mix(in srgb, var(--vui-bg) 92%, #e8a93a 8%); pointer-events: auto; align-items: center; gap: 4px; }
4845
+ .vpu-status-toggle { pointer-events: auto; display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; padding: 0; border: 1px solid #e8a93a; border-radius: 50%; background: #e8a93a; color: #211a0e; font-family: 'Segoe UI', system-ui, sans-serif; font-size: 16px; line-height: 1; font-weight: 750; cursor: pointer; box-shadow: 0 3px 10px rgba(0,0,0,.26); }
4846
+ .vpu-status-toggle:hover { filter: brightness(1.06); }
4847
+ .vpu-status-toggle:focus-visible { outline: 2px solid color-mix(in srgb, #e8a93a 52%, white); outline-offset: 2px; }
4848
+ .vpu-status[data-state="warning"][data-expanded="true"] { padding: 10px 38px 10px 12px; border: 1px solid #e8a93a; border-radius: 7px; background: color-mix(in srgb, var(--vui-bg) 94%, #e8a93a 6%); pointer-events: auto; align-items: flex-start; gap: 3px; }
4849
+ .vpu-status[data-state="warning"][data-expanded="true"] .vpu-status-toggle { position: absolute; top: 8px; right: 8px; width: 22px; height: 22px; font-size: 14px; box-shadow: none; }
4796
4850
  .vpu-status[data-state="warning"][data-expanded="true"] .vpu-status-title, .vpu-status[data-state="warning"][data-expanded="true"] .vpu-status-detail { display: block; }
4797
- .vpu-status[data-state="warning"] .vpu-status-title { color: #e8a93a; font-weight: 650; }
4851
+ .vpu-status[data-state="warning"] .vpu-status-title { color: #e8a93a; font-size: 12px; font-weight: 650; }
4852
+ .vpu-status[data-state="warning"] .vpu-status-detail { max-width: none; font-size: 11px; line-height: 1.45; }
4853
+
4854
+ .vpu-status-report-link { padding: 0; border: 0; background: transparent; color: inherit; font: inherit; font-size: 11px; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
4855
+ .vpu-status-report-link:hover { color: var(--vui-text); }
4856
+ .vpu-status-report-link:focus-visible { outline: 1px solid currentColor; outline-offset: 2px; }
4857
+ .vpu-status-report { box-sizing: border-box; width: 100%; min-width: 0; max-height: min(220px, 30vh); margin: 5px 0 0; padding: 8px; overflow: auto; overscroll-behavior: contain; white-space: pre-wrap; overflow-wrap: anywhere; text-align: left; font: 10px/1.5 Consolas, monospace; color: var(--vui-text-dim); background: color-mix(in srgb, var(--vui-bg) 90%, var(--vui-text) 10%); border-radius: 4px; user-select: text; }
4858
+ /* Subtle, theme-aware scrollbars scoped to the visual report. */
4859
+ .vpu-status-report { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--vui-text-dim) 28%, transparent) transparent; }
4860
+ .vpu-status-report:hover { scrollbar-color: color-mix(in srgb, var(--vui-text-dim) 45%, transparent) transparent; }
4861
+ .vpu-status-report::-webkit-scrollbar { width: 5px; height: 5px; }
4862
+ .vpu-status-report::-webkit-scrollbar-track { background: transparent; }
4863
+ .vpu-status-report::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--vui-text-dim) 28%, transparent); border-radius: 8px; }
4864
+ .vpu-status-report::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--vui-text-dim) 45%, transparent); }
4865
+ .vpu-status-report::-webkit-scrollbar-button { display: none; }
4866
+ .vpu-status-report::-webkit-scrollbar-corner { background: transparent; }
4867
+ .vpu-status-report[hidden] { display: none; }
4798
4868
 
4799
4869
  @keyframes vpu-spin { to { transform: rotate(360deg); } }
4800
4870
  @media (max-width: 560px) {
@@ -4807,17 +4877,20 @@ const Ur = `
4807
4877
  .vpu-status-spinner { animation: none; }
4808
4878
  }
4809
4879
  `, Ye = "scene";
4810
- function Hr(s, e) {
4880
+ function Yr(s, e) {
4811
4881
  let t = null, i = null, r = null, n = null, a = null, o = null;
4812
4882
  return {
4813
4883
  id: "nebula.ui.scene",
4814
4884
  activate(l) {
4815
4885
  var h, f;
4816
- o = document.createElement("style"), o.dataset.viewerSceneUi = "", o.textContent = Ur, (h = s.shadowRoot()) == null || h.append(o), t = Vr(l, {
4886
+ o = document.createElement("style"), o.dataset.viewerSceneUi = "", o.textContent = Hr, (h = s.shadowRoot()) == null || h.append(o), t = Br(l, {
4817
4887
  label: e.label("simulation"),
4818
4888
  parts: (f = e.scene) == null ? void 0 : f.parts,
4819
4889
  theme: s.theme()
4820
- }), i = new zr(s.theme()), r = s.mountBuiltin(t.element, { zone: "overlay", group: Ye }), n = s.mountBuiltin(i.element, { zone: "overlay", group: Ye }), a = s.onThemeChange((u) => {
4890
+ }), i = new Ur(s.theme(), () => {
4891
+ var u;
4892
+ return ((u = s.getVisualDiagnostics) == null ? void 0 : u.call(s)) ?? null;
4893
+ }), r = s.mountBuiltin(t.element, { zone: "overlay", group: Ye }), n = s.mountBuiltin(i.element, { zone: "overlay", group: Ye }), a = s.onThemeChange((u) => {
4821
4894
  t == null || t.themeChanged(u), i == null || i.themeChanged(u);
4822
4895
  });
4823
4896
  const c = () => {
@@ -4837,7 +4910,7 @@ function Hr(s, e) {
4837
4910
  }
4838
4911
  };
4839
4912
  }
4840
- class Yr {
4913
+ class jr {
4841
4914
  constructor(e, t, i, r, n, a, o, l = null) {
4842
4915
  d(this, "pluginsById", /* @__PURE__ */ new Map());
4843
4916
  d(this, "contributions", []);
@@ -5044,7 +5117,7 @@ class Yr {
5044
5117
  n.dataset.viewerContribution = "toolbar", n.dataset.viewerContributionId = t.id;
5045
5118
  for (const a of t.items) {
5046
5119
  const o = document.createElement("button");
5047
- o.type = "button", a.icon ? (o.insertAdjacentHTML("afterbegin", jr(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);
5120
+ o.type = "button", a.icon ? (o.insertAdjacentHTML("afterbegin", Xr(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);
5048
5121
  }
5049
5122
  this.hostElement.append(n), e.cleanup = () => n.remove();
5050
5123
  return;
@@ -5103,12 +5176,12 @@ class Yr {
5103
5176
  if (this.disposed) throw new Error("Viewer plugin manager has been disposed.");
5104
5177
  }
5105
5178
  }
5106
- function jr(s) {
5179
+ function Xr(s) {
5107
5180
  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>`;
5108
5181
  }
5109
- function Xr(s, e, t) {
5182
+ function qr(s, e, t) {
5110
5183
  var f;
5111
- const i = Gr(s), r = $r([t, e.signal, i]), n = ((f = e.filename) == null ? void 0 : f.trim()) || Kr(s), a = ce(s) ? Jr(s.files, s.entry, n) : n, o = ct(s), l = e.baseUrl ?? Zr(o), c = /* @__PURE__ */ new Set(), h = ce(s) ? new Map(s.files.map((u) => [k(u.path), u])) : null;
5184
+ const i = Wr(s), r = Gr([t, e.signal, i]), n = ((f = e.filename) == null ? void 0 : f.trim()) || Zr(s), a = ce(s) ? Qr(s.files, s.entry, n) : n, o = dt(s), l = e.baseUrl ?? Jr(o), c = /* @__PURE__ */ new Set(), h = ce(s) ? new Map(s.files.map((u) => [k(u.path), u])) : null;
5112
5185
  return Object.freeze({
5113
5186
  original: s,
5114
5187
  entryPath: a,
@@ -5119,17 +5192,17 @@ function Xr(s, e, t) {
5119
5192
  hasResourceResolver: !!e.resourceResolver,
5120
5193
  async resolve(u) {
5121
5194
  je(r);
5122
- const b = k(u), g = Wr(s);
5195
+ const b = k(u), g = Kr(s);
5123
5196
  if (g && (!b || b === k(a ?? ""))) {
5124
5197
  const y = URL.createObjectURL(g);
5125
5198
  return c.add(y), y;
5126
5199
  }
5127
- const m = (h == null ? void 0 : h.get(b)) ?? Qr(h, a, b);
5128
- if (m) {
5129
- const y = URL.createObjectURL(m.file);
5200
+ const p = (h == null ? void 0 : h.get(b)) ?? es(h, a, b);
5201
+ if (p) {
5202
+ const y = URL.createObjectURL(p.file);
5130
5203
  return c.add(y), y;
5131
5204
  }
5132
- const v = await es(e.resourceResolver, u, r);
5205
+ const v = await ts(e.resourceResolver, u, r);
5133
5206
  if (je(r), v instanceof Blob) {
5134
5207
  const y = URL.createObjectURL(v);
5135
5208
  return c.add(y), y;
@@ -5142,7 +5215,7 @@ function Xr(s, e, t) {
5142
5215
  }
5143
5216
  });
5144
5217
  }
5145
- function qr(s) {
5218
+ function $r(s) {
5146
5219
  var r;
5147
5220
  const e = s.entryPath ?? s.url;
5148
5221
  if (!e) return null;
@@ -5159,7 +5232,7 @@ function qr(s) {
5159
5232
  const i = /\.([a-z0-9]+)$/i.exec(t);
5160
5233
  return ((r = i == null ? void 0 : i[1]) == null ? void 0 : r.toLowerCase()) ?? null;
5161
5234
  }
5162
- function $r(s) {
5235
+ function Gr(s) {
5163
5236
  const e = s.filter((r) => !!r);
5164
5237
  if (e.length === 0) return new AbortController().signal;
5165
5238
  if (e.length === 1) return e[0];
@@ -5178,18 +5251,18 @@ function je(s) {
5178
5251
  if (s.aborted)
5179
5252
  throw typeof s.throwIfAborted == "function" && s.throwIfAborted(), new DOMException("The operation was aborted.", "AbortError");
5180
5253
  }
5181
- function Gr(s) {
5254
+ function Wr(s) {
5182
5255
  return typeof s == "object" && s !== null && "signal" in s ? s.signal : void 0;
5183
5256
  }
5184
- function ct(s) {
5257
+ function dt(s) {
5185
5258
  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;
5186
5259
  }
5187
- function Wr(s) {
5260
+ function Kr(s) {
5188
5261
  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;
5189
5262
  }
5190
- function Kr(s) {
5263
+ function Zr(s) {
5191
5264
  var t;
5192
- const e = ct(s);
5265
+ const e = dt(s);
5193
5266
  if (e)
5194
5267
  try {
5195
5268
  return decodeURIComponent(new URL(e, "https://viewer.invalid/").pathname.split("/").pop() || "") || null;
@@ -5198,7 +5271,7 @@ function Kr(s) {
5198
5271
  }
5199
5272
  return ce(s) ? s.entry ?? null : typeof File < "u" && s instanceof File && s.name || null;
5200
5273
  }
5201
- function Zr(s) {
5274
+ function Jr(s) {
5202
5275
  var e;
5203
5276
  if (!s) return null;
5204
5277
  try {
@@ -5210,7 +5283,7 @@ function Zr(s) {
5210
5283
  function ce(s) {
5211
5284
  return typeof s == "object" && s !== null && "kind" in s && s.kind === "files";
5212
5285
  }
5213
- function Jr(s, e, t) {
5286
+ function Qr(s, e, t) {
5214
5287
  if (e) {
5215
5288
  const i = k(e);
5216
5289
  if (!s.some((r) => k(r.path) === i))
@@ -5224,7 +5297,7 @@ function Jr(s, e, t) {
5224
5297
  if (s.length === 1) return k(s[0].path);
5225
5298
  throw Xe("Asset package has multiple files; specify an entry.", "E_ASSET_AMBIGUOUS_ENTRY");
5226
5299
  }
5227
- function Qr(s, e, t) {
5300
+ function es(s, e, t) {
5228
5301
  if (!s || !e) return;
5229
5302
  const i = e.lastIndexOf("/"), r = i < 0 ? "" : e.slice(0, i + 1);
5230
5303
  return s.get(k(`${r}${t}`));
@@ -5235,13 +5308,13 @@ function k(s) {
5235
5308
  !t || t === "." || (t === ".." ? e.pop() : e.push(t));
5236
5309
  return e.join("/");
5237
5310
  }
5238
- async function es(s, e, t) {
5311
+ async function ts(s, e, t) {
5239
5312
  return s ? s.resolve(e, { signal: t }) : null;
5240
5313
  }
5241
5314
  function Xe(s, e) {
5242
5315
  return Object.assign(new Error(s), { code: e });
5243
5316
  }
5244
- const ts = Object.freeze({
5317
+ const qe = Object.freeze({
5245
5318
  canPlay: !1,
5246
5319
  canPause: !1,
5247
5320
  canReset: !1,
@@ -5306,6 +5379,10 @@ class rs {
5306
5379
  var l, c;
5307
5380
  return this.current(a) && a.snapshot.phase === "ready" ? ((c = (l = a.session) == null ? void 0 : l.getPhysicsProperties) == null ? void 0 : c.call(l)) ?? null : null;
5308
5381
  },
5382
+ getVisualDiagnostics: () => {
5383
+ var l, c;
5384
+ return this.current(a) && a.snapshot.phase === "ready" ? ((c = (l = a.session) == null ? void 0 : l.getVisualDiagnostics) == null ? void 0 : c.call(l)) ?? null : null;
5385
+ },
5309
5386
  setCollisionVisible: (l) => this.setCollisionVisible(a, l),
5310
5387
  setUpAxis: (l) => this.setUpAxis(a, l),
5311
5388
  getUpAxis: () => {
@@ -5390,7 +5467,7 @@ class rs {
5390
5467
  var i, r;
5391
5468
  try {
5392
5469
  if (!this.current(e)) return;
5393
- e.source = Xr(t, e.options, e.abort.signal);
5470
+ e.source = qr(t, e.options, e.abort.signal);
5394
5471
  const n = e.source.signal, a = () => {
5395
5472
  this.stop(e, "E_ABORTED");
5396
5473
  };
@@ -5398,10 +5475,10 @@ class rs {
5398
5475
  a();
5399
5476
  return;
5400
5477
  }
5401
- const o = this.detect(e), l = qe(o) ? await o : o;
5478
+ const o = this.detect(e), l = $e(o) ? await o : o;
5402
5479
  if (!this.current(e) || (e.loader = l.loader, !this.current(e))) return;
5403
5480
  if (!this.host.loaders().includes(l.loader))
5404
- throw S("Asset loader was removed.", "E_ABORTED");
5481
+ throw P("Asset loader was removed.", "E_ABORTED");
5405
5482
  if (this.transition(e, {
5406
5483
  phase: "loading",
5407
5484
  format: l.format,
@@ -5422,12 +5499,22 @@ class rs {
5422
5499
  requestRender: () => {
5423
5500
  this.current(e) && this.host.requestRender();
5424
5501
  },
5425
- fit: (g, m) => this.current(e) ? this.host.fit(g, m) : !1,
5426
- reportError: (g, m) => this.report(e, g, m),
5427
- reportProgress: (g, m) => {
5428
- this.current(e) && e.snapshot.phase === "loading" && this.transition(e, { stage: g, message: m });
5502
+ fit: (g, p) => this.current(e) ? this.host.fit(g, p) : !1,
5503
+ reportError: (g, p) => this.report(e, g, p),
5504
+ reportSessionState: () => {
5505
+ var p;
5506
+ if (!this.current(e) || e.snapshot.phase !== "ready" || !e.session) return;
5507
+ const g = e.session;
5508
+ ((p = g.physics) == null ? void 0 : p.status) === "unavailable" && (e.playing = !1, e.resetFrameClock = !1, this.endGrabOf(e)), this.transition(e, {
5509
+ capabilities: g.capabilities ?? qe,
5510
+ physics: g.physics ?? null,
5511
+ warning: g.warning ?? null
5512
+ }), this.publishControl(e), this.host.requestRender();
5513
+ },
5514
+ reportProgress: (g, p) => {
5515
+ this.current(e) && e.snapshot.phase === "loading" && this.transition(e, { stage: g, message: p });
5429
5516
  }
5430
- }, u = l.loader.createSession(e.source, f), b = qe(u) ? await u : u;
5517
+ }, u = l.loader.createSession(e.source, f), b = $e(u) ? await u : u;
5431
5518
  if (e.session && e.session !== b) {
5432
5519
  b.beginDispose(), await b.dispose();
5433
5520
  return;
@@ -5443,14 +5530,15 @@ class rs {
5443
5530
  if (e.mounted = b.root, this.host.mount(b.root), !this.current(e)) return;
5444
5531
  if (((i = b.presentation ?? l.loader.presentation) == null ? void 0 : i.fitPolicy) === "fit-on-ready") {
5445
5532
  const g = ((r = b.getFitBounds) == null ? void 0 : r.call(b)) ?? b.fitTarget ?? b.root;
5446
- if (!this.host.fit(g, { padding: 1.15 })) throw S("Asset has no displayable geometry.", "E_ASSET_EMPTY");
5533
+ if (!this.host.fit(g, { padding: 1.15 })) throw P("Asset has no displayable geometry.", "E_ASSET_EMPTY");
5447
5534
  }
5448
5535
  }
5449
5536
  if (!this.current(e)) return;
5450
5537
  e.dynamic = typeof b.update == "function", e.playing = e.dynamic, e.resetFrameClock = e.dynamic, this.transition(e, {
5451
5538
  phase: "ready",
5452
- capabilities: b.capabilities ?? ts,
5453
- warning: b.warning ?? null
5539
+ capabilities: b.capabilities ?? qe,
5540
+ warning: b.warning ?? null,
5541
+ physics: b.physics ?? null
5454
5542
  }), this.current(e) && e.snapshot.phase === "ready" && e.ready.resolve();
5455
5543
  } catch (n) {
5456
5544
  this.current(e) && this.report(e, n, { fatal: !0, stage: "load" });
@@ -5459,27 +5547,27 @@ class rs {
5459
5547
  }
5460
5548
  }
5461
5549
  detect(e) {
5462
- const t = e.source, i = this.host.loaders(), r = e.options.format, n = qr(t), a = r && r !== "auto" ? r : n && ["dxb", "dxb3"].includes(n) ? "cad" : n;
5550
+ const t = e.source, i = this.host.loaders(), r = e.options.format, n = $r(t), a = r && r !== "auto" ? r : n && ["dxb", "dxb3"].includes(n) ? "cad" : n;
5463
5551
  if (a) {
5464
5552
  const o = i.find((l) => l.formats.includes(a));
5465
5553
  if (o) return { loader: o, format: a };
5466
- if (r && r !== "auto") throw S(`Unsupported asset format: ${r}`, "E_ASSET_UNKNOWN_FORMAT");
5554
+ if (r && r !== "auto") throw P(`Unsupported asset format: ${r}`, "E_ASSET_UNKNOWN_FORMAT");
5467
5555
  }
5468
5556
  return this.matchLoaders(e, i, 0);
5469
5557
  }
5470
5558
  async matchLoaders(e, t, i) {
5471
5559
  var r;
5472
5560
  for (let n = i; n < t.length; n += 1) {
5473
- if (!this.current(e)) throw S("Asset open superseded.", "E_SUPERSEDED");
5561
+ if (!this.current(e)) throw P("Asset open superseded.", "E_SUPERSEDED");
5474
5562
  const a = t[n], o = await ((r = a.match) == null ? void 0 : r.call(a, e.source));
5475
5563
  if (o && o.format !== "auto" && a.formats.includes(o.format)) return { loader: a, format: o.format };
5476
5564
  }
5477
- throw S("Unable to determine asset format; specify format explicitly.", "E_ASSET_UNKNOWN_FORMAT");
5565
+ throw P("Unable to determine asset format; specify format explicitly.", "E_ASSET_UNKNOWN_FORMAT");
5478
5566
  }
5479
5567
  stop(e, t) {
5480
5568
  var i;
5481
5569
  if (e.stopped) return e.closeResult.promise;
5482
- if (e.stopped = !0, e.playing = !1, e.resetFrameClock = !1, this.endGrabOf(e), this.active === e && (this.active = null, this.host.applyProfile(void 0)), e.ready.reject(S(t === "E_SUPERSEDED" ? "Asset open superseded." : "Asset open aborted.", t)), (i = e.unsubscribeAbort) == null || i.call(e), e.abort.abort(), this.beginDispose(e), e.mounted) {
5570
+ if (e.stopped = !0, e.playing = !1, e.resetFrameClock = !1, this.endGrabOf(e), this.active === e && (this.active = null, this.host.applyProfile(void 0)), e.ready.reject(P(t === "E_SUPERSEDED" ? "Asset open superseded." : "Asset open aborted.", t)), (i = e.unsubscribeAbort) == null || i.call(e), e.abort.abort(), this.beginDispose(e), e.mounted) {
5483
5571
  const r = e.mounted;
5484
5572
  e.mounted = void 0;
5485
5573
  try {
@@ -5524,11 +5612,11 @@ class rs {
5524
5612
  }
5525
5613
  control(e, t) {
5526
5614
  var r, n;
5527
- if (!this.current(e)) throw S("Asset is inactive.", "E_ASSET_INACTIVE");
5528
- if (e.snapshot.phase !== "ready") throw S("Asset is not ready.", "E_ASSET_NOT_READY");
5615
+ if (!this.current(e)) throw P("Asset is inactive.", "E_ASSET_INACTIVE");
5616
+ if (e.snapshot.phase !== "ready") throw P("Asset is not ready.", "E_ASSET_NOT_READY");
5529
5617
  const i = t === "play" ? "canPlay" : t === "pause" ? "canPause" : "canReset";
5530
5618
  if (!((r = e.snapshot.capabilities) != null && r[i]) || !((n = e.session) != null && n[t]))
5531
- throw S(`Asset does not support ${t}.`, "E_ASSET_CAPABILITY_UNAVAILABLE");
5619
+ throw P(`Asset does not support ${t}.`, "E_ASSET_CAPABILITY_UNAVAILABLE");
5532
5620
  this.applyControl(e, t);
5533
5621
  }
5534
5622
  applyControl(e, t) {
@@ -5540,19 +5628,19 @@ class rs {
5540
5628
  * surface returns booleans instead of throwing `E_ASSET_*`.
5541
5629
  */
5542
5630
  requireReady(e) {
5543
- if (!this.current(e)) throw S("Asset is inactive.", "E_ASSET_INACTIVE");
5544
- if (e.snapshot.phase !== "ready") throw S("Asset is not ready.", "E_ASSET_NOT_READY");
5631
+ if (!this.current(e)) throw P("Asset is inactive.", "E_ASSET_INACTIVE");
5632
+ if (e.snapshot.phase !== "ready") throw P("Asset is not ready.", "E_ASSET_NOT_READY");
5545
5633
  }
5546
5634
  requireCapability(e, t, i) {
5547
5635
  var r;
5548
5636
  if (this.requireReady(e), !((r = e.snapshot.capabilities) != null && r[t]))
5549
- throw S(i, "E_ASSET_CAPABILITY_UNAVAILABLE");
5637
+ throw P(i, "E_ASSET_CAPABILITY_UNAVAILABLE");
5550
5638
  }
5551
5639
  requireSession(e, t, i) {
5552
5640
  var n;
5553
5641
  this.requireReady(e);
5554
5642
  const r = (n = e.session) == null ? void 0 : n[t];
5555
- if (typeof r != "function") throw S(i, "E_ASSET_CAPABILITY_UNAVAILABLE");
5643
+ if (typeof r != "function") throw P(i, "E_ASSET_CAPABILITY_UNAVAILABLE");
5556
5644
  return r.bind(e.session);
5557
5645
  }
5558
5646
  setCollisionVisible(e, t) {
@@ -5586,6 +5674,11 @@ class rs {
5586
5674
  const e = this.active;
5587
5675
  return e && this.current(e) ? e.snapshot : null;
5588
5676
  }
5677
+ getActiveVisualDiagnostics() {
5678
+ var t, i;
5679
+ const e = this.active;
5680
+ return !e || !this.current(e) || e.snapshot.phase !== "ready" ? null : ((i = (t = e.session) == null ? void 0 : t.getVisualDiagnostics) == null ? void 0 : i.call(t)) ?? null;
5681
+ }
5589
5682
  /** Control state for `ctx.asset.$readControl()`. */
5590
5683
  getActiveControlState() {
5591
5684
  const e = this.active;
@@ -5745,10 +5838,10 @@ function ne() {
5745
5838
  return t.catch(() => {
5746
5839
  }), { promise: t, resolve: s, reject: e };
5747
5840
  }
5748
- function S(s, e) {
5841
+ function P(s, e) {
5749
5842
  return Object.assign(new Error(s), { code: e, ...e === "E_ABORTED" || e === "E_SUPERSEDED" ? { name: "AbortError" } : {} });
5750
5843
  }
5751
- function qe(s) {
5844
+ function $e(s) {
5752
5845
  return !!(s && typeof s.then == "function");
5753
5846
  }
5754
5847
  const ss = {
@@ -5769,7 +5862,7 @@ const ss = {
5769
5862
  clearColor: B.dark
5770
5863
  },
5771
5864
  async createSession(e, t) {
5772
- const { createModelSession: i } = await import("./session-B4uKXhdV.js");
5865
+ const { createModelSession: i } = await import("./session-1duLyM88.js");
5773
5866
  return i(e, t);
5774
5867
  }
5775
5868
  });
@@ -5853,12 +5946,12 @@ const cs = {
5853
5946
  clearColor: B.dark
5854
5947
  },
5855
5948
  async createSession(e, t) {
5856
- const { createSimulationSession: i } = await import("./session-DNMxzxd5.js").then((r) => r.s);
5949
+ const { createSimulationSession: i } = await import("./session-DhZXy40-.js").then((r) => r.s);
5857
5950
  return i(e, t);
5858
5951
  }
5859
5952
  });
5860
5953
  }
5861
- }, G = "viewer:highlight", F = "viewer:cad-selection", N = "viewer:cad-hover", $e = {
5954
+ }, W = "viewer:highlight", F = "viewer:cad-selection", N = "viewer:cad-hover", Ge = {
5862
5955
  dark: {
5863
5956
  hover: { color: 3528703, fillOpacity: 0, edgeOpacity: 0.85 },
5864
5957
  selected: { color: 5999871, fillOpacity: 0.24, edgeOpacity: 1 }
@@ -5867,7 +5960,7 @@ const cs = {
5867
5960
  hover: { color: 24524, fillOpacity: 0, edgeOpacity: 0.95 },
5868
5961
  selected: { color: 24524, fillOpacity: 0.2, edgeOpacity: 1 }
5869
5962
  }
5870
- }, ds = 6, hs = 12, us = 160, ps = 160, ms = 50, Ge = 592655;
5963
+ }, ds = 6, hs = 12, us = 160, ps = 160, ms = 50, We = 592655;
5871
5964
  class fs {
5872
5965
  constructor(e, t) {
5873
5966
  d(this, "cad");
@@ -5884,7 +5977,7 @@ class fs {
5884
5977
  d(this, "interactionRenderLastTs", null);
5885
5978
  d(this, "cadHoveredInsert", null);
5886
5979
  d(this, "cadPointerPosition", null);
5887
- d(this, "pointerDragTracker", new Ki({
5980
+ d(this, "pointerDragTracker", new Zi({
5888
5981
  distancePx: ds,
5889
5982
  pathPx: hs
5890
5983
  }));
@@ -6011,17 +6104,17 @@ class fs {
6011
6104
  d(this, "handlePointerLeave", (e) => {
6012
6105
  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));
6013
6106
  });
6014
- var i, r, n, a, o, l, c, h, f, u, b, g, m, v, y;
6015
- this.options = e, this.runtime = t, this.cameraStateStore = e.cameraStateStore === !1 ? void 0 : e.cameraStateStore ?? Ti(), this.interactionMode = e.cadInteraction ?? "managed", this.uiTheme = ((i = e.ui) == null ? void 0 : i.theme) ?? "dark", this.cadHost = this.createCadHost(), this.cadCapability = new ji(this.cadHost), this.cad = this.cadCapability, this.cadCapability.open = async (p, w = {}) => {
6107
+ var i, r, n, a, o, l, c, h, f, u, b, g, p, v, y;
6108
+ this.options = e, this.runtime = t, this.cameraStateStore = e.cameraStateStore === !1 ? void 0 : e.cameraStateStore ?? Di(), this.interactionMode = e.cadInteraction ?? "managed", this.uiTheme = ((i = e.ui) == null ? void 0 : i.theme) ?? "dark", this.cadHost = this.createCadHost(), this.cadCapability = new Xi(this.cadHost), this.cad = this.cadCapability, this.cadCapability.open = async (m, x = {}) => {
6016
6109
  this.assertActive();
6017
- const { filename: x, signal: R, ...J } = w;
6018
- await this.assetController.open(p, { format: "cad", filename: x, signal: R, cad: J }, !0).ready;
6110
+ const { filename: w, signal: E, ...X } = x;
6111
+ await this.assetController.open(m, { format: "cad", filename: w, signal: E, cad: X }, !0).ready;
6019
6112
  const T = this.cadCapability.document;
6020
6113
  if (!T) throw Object.assign(new Error("CAD open superseded"), { code: "E_SUPERSEDED", name: "AbortError" });
6021
6114
  return T;
6022
6115
  }, this.cadCapability.close = () => {
6023
6116
  this.assertActive(), this.assetController.closeKind("cad");
6024
- }, this.initialCameraSnapshot = t.captureCameraSnapshot(), this.lastCameraFingerprint = ae(this.initialCameraSnapshot), this.layoutEngine = this.createLayoutEngine(), this.pluginManager = new Yr(
6117
+ }, this.initialCameraSnapshot = t.captureCameraSnapshot(), this.lastCameraFingerprint = ae(this.initialCameraSnapshot), this.layoutEngine = this.createLayoutEngine(), this.pluginManager = new jr(
6025
6118
  () => this.cadCapability.getSnapshot(),
6026
6119
  () => ({
6027
6120
  viewMode: this.runtime.viewMode,
@@ -6031,12 +6124,12 @@ class fs {
6031
6124
  }),
6032
6125
  () => this.assetController.getActiveSnapshot(),
6033
6126
  () => this.assetController.getActiveControlState(),
6034
- (p, w) => this.subscribePluginEvent(p, w),
6127
+ (m, x) => this.subscribePluginEvent(m, x),
6035
6128
  {
6036
- setLayerVisible: (p, w) => this.cad.layers.setVisible(p, w),
6037
- setSelection: (p) => this.cad.select(p),
6129
+ setLayerVisible: (m, x) => this.cad.layers.setVisible(m, x),
6130
+ setSelection: (m) => this.cad.select(m),
6038
6131
  fitDocument: () => this.cad.fitDocument(),
6039
- setViewMode: (p) => this.setViewMode(p),
6132
+ setViewMode: (m) => this.setViewMode(m),
6040
6133
  play: () => this.assetController.tryPlay(),
6041
6134
  pause: () => this.assetController.tryPause(),
6042
6135
  reset: () => this.assetController.tryReset(),
@@ -6047,61 +6140,62 @@ class fs {
6047
6140
  return !1;
6048
6141
  }
6049
6142
  },
6050
- setUpAxis: (p) => this.assetController.trySetUpAxis(p),
6051
- setGroundVisible: (p) => this.assetController.trySetGroundVisible(p),
6052
- setCollisionVisible: (p) => this.assetController.trySetCollisionVisible(p),
6053
- setTheme: (p) => this.applyUiTheme(p)
6143
+ setUpAxis: (m) => this.assetController.trySetUpAxis(m),
6144
+ setGroundVisible: (m) => this.assetController.trySetGroundVisible(m),
6145
+ setCollisionVisible: (m) => this.assetController.trySetCollisionVisible(m),
6146
+ setTheme: (m) => this.applyUiTheme(m)
6054
6147
  },
6055
6148
  e.viewport,
6056
6149
  this.layoutEngine
6057
6150
  ), this.assetController = new rs({
6058
6151
  loaders: () => this.pluginManager.getAssetLoaders(),
6059
- mount: (p) => this.mountAssetObject(p),
6060
- detach: (p) => this.unmountAssetObject(p),
6061
- applyProfile: (p) => this.applyAssetProfile(p),
6062
- fit: (p, w) => this.runtime.fitView(p, w),
6152
+ mount: (m) => this.mountAssetObject(m),
6153
+ detach: (m) => this.unmountAssetObject(m),
6154
+ applyProfile: (m) => this.applyAssetProfile(m),
6155
+ fit: (m, x) => this.runtime.fitView(m, x),
6063
6156
  requestRender: () => this.runtime.requestRender(),
6064
- change: (p) => this.emit("asset-change", p),
6065
- error: (p) => this.emit("asset-error", p),
6066
- controlChange: (p) => this.emit("asset-control-change", p),
6067
- cleanupError: (p) => {
6068
- this.options.onCleanupError ? this.options.onCleanupError(p) : console.error("[viewer] asset cleanup failed", p);
6157
+ change: (m) => this.emit("asset-change", m),
6158
+ error: (m) => this.emit("asset-error", m),
6159
+ controlChange: (m) => this.emit("asset-control-change", m),
6160
+ cleanupError: (m) => {
6161
+ this.options.onCleanupError ? this.options.onCleanupError(m) : console.error("[viewer] asset cleanup failed", m);
6069
6162
  }
6070
- }), this.pluginManager.registerBuiltin(as(this.cadCapability)), this.pluginManager.registerBuiltin(ss), this.pluginManager.registerBuiltin(cs), this.pluginManager.onAssetLoaderRemoved((p) => this.assetController.removeLoader(p)), this.cadInspectorUnsubscribe = this.cad.on("inspector-change", () => {
6163
+ }), this.pluginManager.registerBuiltin(as(this.cadCapability)), this.pluginManager.registerBuiltin(ss), this.pluginManager.registerBuiltin(cs), this.pluginManager.onAssetLoaderRemoved((m) => this.assetController.removeLoader(m)), this.cadInspectorUnsubscribe = this.cad.on("inspector-change", () => {
6071
6164
  this.interactionMode === "managed" && (this.syncCadSelectionOverlay(), this.syncCadHoverOverlay()), this.dispatchCadSelectionChange();
6072
6165
  }), this.cadDocumentUnsubscribe = this.cad.on("document-change", () => {
6073
6166
  this.setCadHoveredInsert(null), this.interactionMode === "managed" && this.syncCadSelectionOverlay();
6074
- }), this.assetChangeUnsubscribe = this.on("asset-change", (p) => {
6075
- const w = p.snapshot.phase;
6076
- (w === "closing" || w === "failed" || w === "closed") && this.endAssetGrab();
6077
- }), e.ui && e.ui.preset !== "none" && (e.ui.preset !== "cad-readonly" && this.interactionMode === "managed" && this.pluginManager.registerBuiltin(Hr(
6167
+ }), this.assetChangeUnsubscribe = this.on("asset-change", (m) => {
6168
+ const x = m.snapshot.phase;
6169
+ (x === "closing" || x === "failed" || x === "closed") && this.endAssetGrab();
6170
+ }), e.ui && e.ui.preset !== "none" && (e.ui.preset !== "cad-readonly" && this.interactionMode === "managed" && this.pluginManager.registerBuiltin(Yr(
6078
6171
  {
6079
- mountBuiltin: (p, w) => this.layoutEngine.mountBuiltin(p, w),
6172
+ mountBuiltin: (m, x) => this.layoutEngine.mountBuiltin(m, x),
6080
6173
  shadowRoot: () => this.builtinUiShadow(),
6174
+ getVisualDiagnostics: () => this.assetController.getActiveVisualDiagnostics(),
6081
6175
  theme: () => this.uiTheme,
6082
- onThemeChange: (p) => (this.uiThemeListeners.add(p), { dispose: () => this.uiThemeListeners.delete(p) })
6176
+ onThemeChange: (m) => (this.uiThemeListeners.add(m), { dispose: () => this.uiThemeListeners.delete(m) })
6083
6177
  },
6084
6178
  {
6085
- label: (p) => p === "simulation" ? "仿真控制" : "模型控制",
6179
+ label: (m) => m === "simulation" ? "仿真控制" : "模型控制",
6086
6180
  scene: e.ui.scene
6087
6181
  }
6088
6182
  )), this.interactionMode === "managed" && this.pluginManager.register({
6089
6183
  id: "nebula.ui.cad",
6090
6184
  activate: () => {
6091
- this.ui = new Rr(this.createUiHost(), e.ui), this.ui.mount();
6185
+ this.ui = new Ir(this.createUiHost(), e.ui), this.ui.mount();
6092
6186
  },
6093
6187
  deactivate: () => {
6094
- var p;
6095
- (p = this.ui) == null || p.dispose(), this.ui = null;
6188
+ var m;
6189
+ (m = this.ui) == null || m.dispose(), this.ui = null;
6096
6190
  }
6097
- })), (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), (c = (l = this.options.canvas).addEventListener) == null || c.call(l, "pointerup", this.handlePointerUp), (f = (h = this.options.canvas).addEventListener) == null || f.call(h, "pointercancel", this.handlePointerCancel), (b = (u = this.options.canvas).addEventListener) == null || b.call(u, "pointerleave", this.handlePointerLeave), (m = (g = this.options.canvas).addEventListener) == null || m.call(g, "lostpointercapture", this.handleLostPointerCapture), (y = (v = this.options.canvas).addEventListener) == null || y.call(v, "wheel", this.handleWheel, { passive: !0 }), typeof globalThis.window < "u" && globalThis.window.addEventListener("blur", this.handleWindowBlur), typeof ResizeObserver == "function" && xs(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({
6098
- renderExtension: { beforeRender: (p, w, x) => this.assetController.beforeRender(p, w, x) },
6099
- onFrame: (p, w) => {
6100
- this.assetController.update(w) && this.runtime.requestRender();
6191
+ })), (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), (c = (l = this.options.canvas).addEventListener) == null || c.call(l, "pointerup", this.handlePointerUp), (f = (h = this.options.canvas).addEventListener) == null || f.call(h, "pointercancel", this.handlePointerCancel), (b = (u = this.options.canvas).addEventListener) == null || b.call(u, "pointerleave", this.handlePointerLeave), (p = (g = this.options.canvas).addEventListener) == null || p.call(g, "lostpointercapture", this.handleLostPointerCapture), (y = (v = this.options.canvas).addEventListener) == null || y.call(v, "wheel", this.handleWheel, { passive: !0 }), typeof globalThis.window < "u" && globalThis.window.addEventListener("blur", this.handleWindowBlur), typeof ResizeObserver == "function" && xs(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({
6192
+ renderExtension: { beforeRender: (m, x, w) => this.assetController.beforeRender(m, x, w) },
6193
+ onFrame: (m, x) => {
6194
+ this.assetController.update(x) && this.runtime.requestRender();
6101
6195
  },
6102
- shouldRender: (p) => this.shouldRenderCurrentFrame(p),
6103
- beforeRender: (p) => {
6104
- this.detectCameraChange() || this.cadCapability.onBeforeRender(), this.interaction === "active" && (this.interactionRenderLastTs = p);
6196
+ shouldRender: (m) => this.shouldRenderCurrentFrame(m),
6197
+ beforeRender: (m) => {
6198
+ this.detectCameraChange() || this.cadCapability.onBeforeRender(), this.interaction === "active" && (this.interactionRenderLastTs = m);
6105
6199
  },
6106
6200
  onInfoUpdate: () => {
6107
6201
  this.detectCameraChange() || this.cadCapability.onRuntimeStatsChanged();
@@ -6222,9 +6316,9 @@ class fs {
6222
6316
  }
6223
6317
  setHighlight(e, t = {}) {
6224
6318
  if (this.assertActive(), e && this.assertMounted(e), !(this.highlightedObjectValue === null && e === null)) {
6225
- if (this.runtime.removeOverlay(G), this.highlightedObjectValue = e, e) {
6226
- const i = new St(e, t.color ?? 6000111);
6227
- i.name = G, this.runtime.mountOverlay(G, i, { owned: !0 });
6319
+ if (this.runtime.removeOverlay(W), this.highlightedObjectValue = e, e) {
6320
+ const i = new Pt(e, t.color ?? 6000111);
6321
+ i.name = W, this.runtime.mountOverlay(W, i, { owned: !0 });
6228
6322
  }
6229
6323
  this.emit("highlight-change", { object: e });
6230
6324
  }
@@ -6250,9 +6344,9 @@ class fs {
6250
6344
  this.assertActive(), this.pluginManager.use(e, t);
6251
6345
  }
6252
6346
  dispose() {
6253
- var e, t, i, r, n, a, o, l, c, h, f, u, b, g, m;
6347
+ var e, t, i, r, n, a, o, l, c, h, f, u, b, g, p;
6254
6348
  if (!this.disposed) {
6255
- 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), (h = (c = this.options.canvas).removeEventListener) == null || h.call(c, "pointerleave", this.handlePointerLeave), (u = (f = this.options.canvas).removeEventListener) == null || u.call(f, "lostpointercapture", this.handleLostPointerCapture), (g = (b = this.options.canvas).removeEventListener) == null || g.call(b, "wheel", this.handleWheel), typeof globalThis.window < "u" && (globalThis.window.removeEventListener("blur", this.handleWindowBlur), this.usingWindowResizeFallback && globalThis.window.removeEventListener("resize", this.handleViewportResize)), (m = this.viewportResizeObserver) == null || m.disconnect(), this.pointerStart = null, this.cadPointerPosition = null, this.setCadHoveredInsert(null), this.setCanvasCursor(""), this.highlightedObjectValue && this.runtime.removeOverlay(G), this.runtime.removeOverlay(F), this.runtime.removeOverlay(N), this.cadInspectorUnsubscribe(), this.cadDocumentUnsubscribe(), this.assetChangeUnsubscribe(), this.highlightedObjectValue = null, this.selectedObjectValue = null;
6349
+ 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), (h = (c = this.options.canvas).removeEventListener) == null || h.call(c, "pointerleave", this.handlePointerLeave), (u = (f = this.options.canvas).removeEventListener) == null || u.call(f, "lostpointercapture", this.handleLostPointerCapture), (g = (b = this.options.canvas).removeEventListener) == null || g.call(b, "wheel", this.handleWheel), typeof globalThis.window < "u" && (globalThis.window.removeEventListener("blur", this.handleWindowBlur), this.usingWindowResizeFallback && globalThis.window.removeEventListener("resize", this.handleViewportResize)), (p = this.viewportResizeObserver) == null || p.disconnect(), this.pointerStart = null, this.cadPointerPosition = null, this.setCadHoveredInsert(null), this.setCanvasCursor(""), this.highlightedObjectValue && this.runtime.removeOverlay(W), this.runtime.removeOverlay(F), this.runtime.removeOverlay(N), this.cadInspectorUnsubscribe(), this.cadDocumentUnsubscribe(), this.assetChangeUnsubscribe(), this.highlightedObjectValue = null, this.selectedObjectValue = null;
6256
6350
  for (const v of this.mountedObjects)
6257
6351
  this.runtime.removeObject(v, { dispose: !1 });
6258
6352
  this.mountedObjects.clear();
@@ -6277,7 +6371,7 @@ class fs {
6277
6371
  createLayoutEngine() {
6278
6372
  var r;
6279
6373
  const e = this, t = this.options, i = (r = t.ui) == null ? void 0 : r.insetTarget;
6280
- return new Tr({
6374
+ return new Dr({
6281
6375
  reference: () => {
6282
6376
  var n;
6283
6377
  return ((n = t.ui) == null ? void 0 : n.root) ?? t.viewport;
@@ -6321,7 +6415,7 @@ class fs {
6321
6415
  */
6322
6416
  resetAssetPresentation() {
6323
6417
  var e;
6324
- this.runtime.setClearColor(this.options.clearColor ?? Ge), 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(F), this.runtime.removeOverlay(N), this.cadCapability.clearSelection()) : this.syncCadSelectionOverlay(), this.runtime.requestRender();
6418
+ this.runtime.setClearColor(this.options.clearColor ?? We), 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(F), this.runtime.removeOverlay(N), this.cadCapability.clearSelection()) : this.syncCadSelectionOverlay(), this.runtime.requestRender();
6325
6419
  }
6326
6420
  createCadHost() {
6327
6421
  const e = this;
@@ -6381,10 +6475,10 @@ class fs {
6381
6475
  return ((n = e.runtime.screenToWorldOnPlane(t, i, r)) == null ? void 0 : n.clone()) ?? null;
6382
6476
  },
6383
6477
  readCameraSnapshot(t) {
6384
- return Oi(e.cameraStateStore, t);
6478
+ return Li(e.cameraStateStore, t);
6385
6479
  },
6386
6480
  persistCameraSnapshot(t, i) {
6387
- Li(e.cameraStateStore, t, i);
6481
+ Fi(e.cameraStateStore, t, i);
6388
6482
  },
6389
6483
  getViewportSize() {
6390
6484
  return {
@@ -6419,7 +6513,7 @@ class fs {
6419
6513
  if (!i || i.isEmpty()) return;
6420
6514
  const r = !!((o = e.details) != null && o.bbox);
6421
6515
  if (((c = (l = this.options.cadInteractionStyle) == null ? void 0 : l.selected) == null ? void 0 : c.enabled) === !1) return;
6422
- const n = r ? this.createCadInteractionOverlay(i, "selected") : new Pt(i, ((f = (h = this.options.cadInteractionStyle) == null ? void 0 : h.selected) == null ? void 0 : f.color) ?? $e.dark.selected.color);
6516
+ const n = r ? this.createCadInteractionOverlay(i, "selected") : new At(i, ((f = (h = this.options.cadInteractionStyle) == null ? void 0 : h.selected) == null ? void 0 : f.color) ?? Ge.dark.selected.color);
6423
6517
  n.name = F, this.runtime.mountOverlay(F, n, { owned: !0 });
6424
6518
  }
6425
6519
  dispatchCadSelectionChange() {
@@ -6438,17 +6532,17 @@ class fs {
6438
6532
  }
6439
6533
  createCadInteractionOverlay(e, t) {
6440
6534
  var u, b;
6441
- const i = ((u = this.options.ui) == null ? void 0 : u.theme) === "light" ? "light" : "dark", r = $e[i][t], n = (b = this.options.cadInteractionStyle) == null ? void 0 : b[t], a = {
6535
+ const i = ((u = this.options.ui) == null ? void 0 : u.theme) === "light" ? "light" : "dark", r = Ge[i][t], n = (b = this.options.cadInteractionStyle) == null ? void 0 : b[t], a = {
6442
6536
  color: (n == null ? void 0 : n.color) ?? r.color,
6443
6537
  fillOpacity: (n == null ? void 0 : n.fillOpacity) ?? r.fillOpacity,
6444
6538
  edgeOpacity: (n == null ? void 0 : n.edgeOpacity) ?? r.edgeOpacity
6445
- }, o = new Ke();
6539
+ }, o = new Ze();
6446
6540
  o.name = t === "hover" ? "cad-insert-hover" : "cad-insert-selected", o.renderOrder = t === "hover" ? 1300 : 1310;
6447
- const l = e.getSize(new C()), c = e.getCenter(new C()), h = new At(Math.max(l.x, 1e-6), Math.max(l.y, 1e-6), Math.max(l.z, 1e-3));
6541
+ const l = e.getSize(new C()), c = e.getCenter(new C()), h = new Rt(Math.max(l.x, 1e-6), Math.max(l.y, 1e-6), Math.max(l.z, 1e-3));
6448
6542
  if (a.fillOpacity > 0) {
6449
- const g = new Rt(
6543
+ const g = new It(
6450
6544
  h.clone(),
6451
- new It({
6545
+ new Mt({
6452
6546
  color: a.color,
6453
6547
  transparent: !0,
6454
6548
  opacity: a.fillOpacity,
@@ -6458,9 +6552,9 @@ class fs {
6458
6552
  );
6459
6553
  g.name = `${o.name}:fill`, g.position.copy(c), g.renderOrder = 1305, o.add(g);
6460
6554
  }
6461
- const f = new Mt(
6462
- new kt(h),
6463
- new Tt({
6555
+ const f = new kt(
6556
+ new Tt(h),
6557
+ new Dt({
6464
6558
  color: a.color,
6465
6559
  transparent: !0,
6466
6560
  opacity: a.edgeOpacity,
@@ -6562,7 +6656,7 @@ class fs {
6562
6656
  this.resetAssetPresentation();
6563
6657
  return;
6564
6658
  }
6565
- this.runtime.setClearColor(e.clearColor ?? this.options.clearColor ?? Ge), this.runtime.setNavigationPolicy(
6659
+ this.runtime.setClearColor(e.clearColor ?? this.options.clearColor ?? We), this.runtime.setNavigationPolicy(
6566
6660
  e.interactionMode === "object" || e.interactionMode === "simulation" ? "preview" : "viewer"
6567
6661
  ), 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(bs(e.uiProfile)), (t = this.ui) == null || t.setActive(e.uiProfile === "cad"), this.interactionMode !== "managed" ? (this.setCadHoveredInsert(null), this.runtime.removeOverlay(F), this.runtime.removeOverlay(N), this.cadCapability.clearSelection()) : this.syncCadSelectionOverlay();
6568
6662
  }
@@ -6580,7 +6674,7 @@ class fs {
6580
6674
  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());
6581
6675
  }
6582
6676
  applyCameraSnapshot(e, t) {
6583
- if (!et(e)) return !1;
6677
+ if (!tt(e)) return !1;
6584
6678
  const i = this.runtime.viewMode;
6585
6679
  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;
6586
6680
  }
@@ -6686,7 +6780,7 @@ class fs {
6686
6780
  }
6687
6781
  }
6688
6782
  function Ms(s) {
6689
- const e = new Ri({
6783
+ const e = new Ii({
6690
6784
  canvasArea: s.viewport,
6691
6785
  canvas: s.canvas,
6692
6786
  clearColor: s.clearColor,