@nebula-spatial/viewer 0.5.1 → 0.5.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.
- package/CHANGELOG.md +45 -0
- package/README.md +51 -4
- package/dist/assets/types.d.ts +9 -0
- package/dist/{index-CXdFFc74.js → index-DmGuwbBM.js} +493 -433
- package/dist/index.d.ts +2 -1
- package/dist/index.js +10 -5
- package/dist/{mjcf-visual-BnZWMjcp.js → mjcf-visual-CFXIhVyT.js} +2 -2
- package/dist/session-Boljcc3d.js +844 -0
- package/dist/session-BzIziNzg.js +960 -0
- package/dist/{stage-DBmU5D0V.js → stage-C7B1_qJ0.js} +3 -3
- package/dist/{urdf-session-BtARifnH.js → urdf-session-BleSrYNu.js} +3 -3
- package/dist/usd-session-DFbFB8bP.js +2392 -0
- package/dist/version.d.ts +1 -1
- package/dist/{xacro-B8n3d29Q.js → xacro-D1hcJ9kB.js} +1 -1
- package/openusd/openusd_probe.js +1 -1
- package/openusd/openusd_probe.wasm +0 -0
- package/package.json +1 -1
- package/dist/session-BhTeAhTq.js +0 -809
- package/dist/session-BvgzEStG.js +0 -953
- package/dist/usd-session-DmO4QMLH.js +0 -2240
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
var Bt = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var u = (s, e, t) =>
|
|
4
|
-
import { Texture as
|
|
5
|
-
import { RoomEnvironment as
|
|
6
|
-
import { MapControls as
|
|
7
|
-
import { OrbitControls as
|
|
8
|
-
import { HDRLoader as
|
|
9
|
-
import { createCadDocumentSession as
|
|
10
|
-
import { CSS2DObject as
|
|
11
|
-
const
|
|
2
|
+
var Ut = (s, e, t) => e in s ? Bt(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
|
|
3
|
+
var u = (s, e, t) => Ut(s, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { Texture as jt, Vector3 as S, MathUtils as O, MOUSE as N, Object3D as Ct, Scene as we, Group as Et, Raycaster as St, Vector2 as oe, WebGLRenderer as Ht, Color as qt, Euler as Yt, OrthographicCamera as Oe, PerspectiveCamera as Xt, TOUCH as ze, Vector4 as Wt, Plane as kt, WebGLRenderTarget as Gt, Box3 as F, PMREMGenerator as Kt, EquirectangularReflectionMapping as Zt, Quaternion as Jt, BoxHelper as Qt, Box3Helper as ei, BoxGeometry as ti, Mesh as ii, MeshBasicMaterial as ri, LineSegments as si, EdgesGeometry as ni, LineBasicMaterial as ai } from "three";
|
|
5
|
+
import { RoomEnvironment as oi } from "three/addons/environments/RoomEnvironment.js";
|
|
6
|
+
import { MapControls as li } from "three/addons/controls/MapControls.js";
|
|
7
|
+
import { OrbitControls as di } from "three/addons/controls/OrbitControls.js";
|
|
8
|
+
import { HDRLoader as ci } from "three/addons/loaders/HDRLoader.js";
|
|
9
|
+
import { createCadDocumentSession as ui, getCadDocumentRenderResource as hi, formatCadInsertId as Ne } from "@nebula-spatial/cad-loader";
|
|
10
|
+
import { CSS2DObject as pi, CSS2DRenderer as fi } from "three/addons/renderers/CSS2DRenderer.js";
|
|
11
|
+
const mi = "0.5.3", vi = "@nebula-spatial/viewer", Fe = "__NEBULA_SPATIAL_VIEWER_BANNER_PRINTED__";
|
|
12
12
|
function Ve() {
|
|
13
|
-
const s = `%c ${
|
|
13
|
+
const s = `%c ${vi} %c v${mi} `;
|
|
14
14
|
console.log(s, "background:#111827;color:#ffffff;padding:4px 10px;border-radius:4px 0 0 4px;font-weight:700;", "background:#10B981;color:#ffffff;padding:4px 10px;border-radius:0 4px 4px 0;font-weight:700;");
|
|
15
15
|
}
|
|
16
16
|
try {
|
|
@@ -19,7 +19,7 @@ try {
|
|
|
19
19
|
} catch {
|
|
20
20
|
Ve();
|
|
21
21
|
}
|
|
22
|
-
const
|
|
22
|
+
const gi = [
|
|
23
23
|
"alphaMap",
|
|
24
24
|
"aoMap",
|
|
25
25
|
"bumpMap",
|
|
@@ -48,12 +48,12 @@ const vi = [
|
|
|
48
48
|
function de(s, e) {
|
|
49
49
|
e.has(s) || (e.add(s), s.dispose());
|
|
50
50
|
}
|
|
51
|
-
function
|
|
51
|
+
function bi(s, e, t) {
|
|
52
52
|
if (e) {
|
|
53
53
|
const i = s;
|
|
54
|
-
for (const r of
|
|
54
|
+
for (const r of gi) {
|
|
55
55
|
const n = i[r];
|
|
56
|
-
n instanceof
|
|
56
|
+
n instanceof jt && de(n, t);
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
de(s, t);
|
|
@@ -65,11 +65,11 @@ function $e(s, e = {}) {
|
|
|
65
65
|
n.geometry && de(n.geometry, t);
|
|
66
66
|
const a = Array.isArray(n.material) ? n.material : [n.material];
|
|
67
67
|
for (const o of a)
|
|
68
|
-
o &&
|
|
68
|
+
o && bi(o, i, t);
|
|
69
69
|
n.renderTarget && de(n.renderTarget, t);
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
|
-
function
|
|
72
|
+
function yi(s) {
|
|
73
73
|
const {
|
|
74
74
|
dxPx: e,
|
|
75
75
|
dyPx: t,
|
|
@@ -90,24 +90,24 @@ function bi(s) {
|
|
|
90
90
|
z: 0
|
|
91
91
|
};
|
|
92
92
|
}
|
|
93
|
-
function
|
|
93
|
+
function xi(s, e) {
|
|
94
94
|
return !Number.isFinite(s.x) || !Number.isFinite(s.y) || !Number.isFinite(s.z) || !Number.isFinite(e.x) || !Number.isFinite(e.y) || !Number.isFinite(e.z) ? { x: 0, y: 0, z: 0 } : {
|
|
95
95
|
x: s.x - e.x,
|
|
96
96
|
y: s.y - e.y,
|
|
97
97
|
z: 0
|
|
98
98
|
};
|
|
99
99
|
}
|
|
100
|
-
function
|
|
100
|
+
function wi(s, e, t) {
|
|
101
101
|
if (!Number.isFinite(s.x) || !Number.isFinite(s.y) || !Number.isFinite(s.z))
|
|
102
102
|
return { x: 0, y: 0, z: 0 };
|
|
103
|
-
const i =
|
|
103
|
+
const i = xi(e, t);
|
|
104
104
|
return {
|
|
105
105
|
x: s.x + i.x,
|
|
106
106
|
y: s.y + i.y,
|
|
107
107
|
z: s.z
|
|
108
108
|
};
|
|
109
109
|
}
|
|
110
|
-
const
|
|
110
|
+
const Ci = 0.35, Y = 1, Ei = 1, Si = 170;
|
|
111
111
|
function Q(s, e, t) {
|
|
112
112
|
return Math.max(e, Math.min(t, s));
|
|
113
113
|
}
|
|
@@ -116,19 +116,19 @@ function $(s, e, t, i) {
|
|
|
116
116
|
return Q(r, t, i);
|
|
117
117
|
}
|
|
118
118
|
function Pt(s) {
|
|
119
|
-
return Number.isFinite(s) ? Q(s, 0.1, 0.95) :
|
|
119
|
+
return Number.isFinite(s) ? Q(s, 0.1, 0.95) : Ci;
|
|
120
120
|
}
|
|
121
|
-
function
|
|
121
|
+
function ki(s, e) {
|
|
122
122
|
return !Number.isFinite(s) || !Number.isFinite(e) || s <= 0 || e <= 0 ? 1 : s / e;
|
|
123
123
|
}
|
|
124
124
|
function At(s) {
|
|
125
|
-
const e = $(s, 50,
|
|
125
|
+
const e = $(s, 50, Ei, Si), t = Math.tan(e * Math.PI / 360);
|
|
126
126
|
return Math.max(t, 1e-4);
|
|
127
127
|
}
|
|
128
|
-
function
|
|
128
|
+
function Pi(s) {
|
|
129
129
|
return Number.isFinite(s) ? Math.max(0.2, Math.abs(Math.sin(s))) : 0.2;
|
|
130
130
|
}
|
|
131
|
-
function
|
|
131
|
+
function Ai(s) {
|
|
132
132
|
return Number.isFinite(s) ? {
|
|
133
133
|
sinAbs: Math.max(1e-4, Math.abs(Math.sin(s))),
|
|
134
134
|
cosAbs: Math.abs(Math.cos(s))
|
|
@@ -137,15 +137,15 @@ function Pi(s) {
|
|
|
137
137
|
cosAbs: Math.sqrt(1 - 0.2 * 0.2)
|
|
138
138
|
};
|
|
139
139
|
}
|
|
140
|
-
function
|
|
141
|
-
const i = Math.max(1e-4, 2 * s * e /
|
|
140
|
+
function Rt(s, e, t) {
|
|
141
|
+
const i = Math.max(1e-4, 2 * s * e / Pi(t)), { sinAbs: r, cosAbs: n } = Ai(t), a = s * e, o = r * r - a * a * n * n;
|
|
142
142
|
if (!Number.isFinite(o) || o <= 1e-4)
|
|
143
143
|
return i;
|
|
144
144
|
const l = 2 * a * r / o;
|
|
145
145
|
return !Number.isFinite(l) || l <= 1e-4 ? i : l;
|
|
146
146
|
}
|
|
147
|
-
function
|
|
148
|
-
const e = Pt(s.ndcBand), t = s.useFixedOrientation ? s.fixedOrbitYaw : s.orbitYaw, i = s.useFixedOrientation ? s.fixedOrbitPitch : s.orbitPitch, r = Math.max($(s.orthoFrustumSize, Y, Y, Number.MAX_VALUE), Y), n = At(s.perspectiveFovDeg), a =
|
|
147
|
+
function Ri(s) {
|
|
148
|
+
const e = Pt(s.ndcBand), t = s.useFixedOrientation ? s.fixedOrbitYaw : s.orbitYaw, i = s.useFixedOrientation ? s.fixedOrbitPitch : s.orbitPitch, r = Math.max($(s.orthoFrustumSize, Y, Y, Number.MAX_VALUE), Y), n = At(s.perspectiveFovDeg), a = Rt(e, n, i), o = $(s.orbitDistanceMin, 500, 1, Number.MAX_VALUE), l = Math.max(o, $(s.orbitDistanceMax, 2e5, o, Number.MAX_VALUE)), d = Q(r / a, o, l);
|
|
149
149
|
return {
|
|
150
150
|
orbitTarget: { x: s.orthoCenterX, y: s.orthoCenterY, z: 0 },
|
|
151
151
|
orbitDistance: d,
|
|
@@ -153,25 +153,25 @@ function Ai(s) {
|
|
|
153
153
|
orbitPitch: i
|
|
154
154
|
};
|
|
155
155
|
}
|
|
156
|
-
function
|
|
157
|
-
const e =
|
|
156
|
+
function Ii(s) {
|
|
157
|
+
const e = ki(s.viewportWidthPx, s.viewportHeightPx), t = Pt(s.ndcBand), i = At(s.perspectiveFovDeg), r = Rt(t, i, s.orbitPitch), n = $(s.orthoFrustumMin, 1e3, Y, Number.MAX_VALUE), a = Math.max(n, $(s.orthoFrustumMax, 1e5, n, Number.MAX_VALUE)), o = Math.max($(s.orbitDistance, n, n, Number.MAX_VALUE), Y), l = o * r, d = Number.isFinite(l) && l >= Y ? l : Q(o / Math.max(0.5, Math.min(2, e)), n, a);
|
|
158
158
|
return {
|
|
159
159
|
orthoCenterX: s.orbitTarget.x,
|
|
160
160
|
orthoCenterY: s.orbitTarget.y,
|
|
161
161
|
orthoFrustumSize: Q(d, n, a)
|
|
162
162
|
};
|
|
163
163
|
}
|
|
164
|
-
function
|
|
164
|
+
function Mi(s) {
|
|
165
165
|
const e = Math.max(s.xmax - s.xmin, s.ymax - s.ymin, 1), t = Math.max(1e-4, Math.tan(s.fovDeg * Math.PI / 360)), i = Math.max(1e-4, Math.abs(Math.sin(s.orbitPitchRad))), r = Math.abs(Math.cos(s.orbitPitchRad)), n = s.ndcBand * t, a = i * i - n * n * r * r, o = Math.max(
|
|
166
166
|
1e-4,
|
|
167
167
|
2 * s.ndcBand * t / Math.max(0.2, i)
|
|
168
168
|
), l = Number.isFinite(a) && a > 1e-4 ? Math.max(1e-4, 2 * n * i / a) : o;
|
|
169
169
|
return e / l;
|
|
170
170
|
}
|
|
171
|
-
function
|
|
171
|
+
function Li(s, e, t, i = 40) {
|
|
172
172
|
return e === 1 ? s * i : e === 2 ? s * t : s;
|
|
173
173
|
}
|
|
174
|
-
function
|
|
174
|
+
function Ti(s) {
|
|
175
175
|
const { valuePx: e, ctrlKey: t, eventTimeMs: i, state: r, resetMs: n } = s, a = Math.abs(e), o = r.lastEventTimeMs === 0 ? 0 : i - r.lastEventTimeMs;
|
|
176
176
|
let l = r.type;
|
|
177
177
|
if (t)
|
|
@@ -190,7 +190,7 @@ function Li(s) {
|
|
|
190
190
|
type: l
|
|
191
191
|
};
|
|
192
192
|
}
|
|
193
|
-
function
|
|
193
|
+
function Di(s, e, t) {
|
|
194
194
|
if (!Number.isFinite(s) || s === 0) return 1;
|
|
195
195
|
const i = e === "wheel" ? t.wheelZoomRate : t.trackpadZoomRate;
|
|
196
196
|
if (e === "wheel") {
|
|
@@ -202,19 +202,19 @@ function Ti(s, e, t) {
|
|
|
202
202
|
const n = 1 / t.maxScalePerFrame;
|
|
203
203
|
return Math.max(n, Math.min(t.maxScalePerFrame, r));
|
|
204
204
|
}
|
|
205
|
-
const he = 500,
|
|
206
|
-
function
|
|
205
|
+
const he = 500, _e = 2e5, pe = 0.95, Be = -Math.PI / 2, Ue = O.degToRad(55), Oi = 1e3, zi = 2e6;
|
|
206
|
+
function _(s, e, t = 1e-4) {
|
|
207
207
|
return Math.abs(s - e) <= t;
|
|
208
208
|
}
|
|
209
|
-
class
|
|
209
|
+
class Ni {
|
|
210
210
|
constructor() {
|
|
211
|
-
u(this, "orbitTarget", new
|
|
211
|
+
u(this, "orbitTarget", new S(0, 0, 0));
|
|
212
212
|
u(this, "orbitDistance", 14e3);
|
|
213
|
-
u(this, "orbitYaw",
|
|
213
|
+
u(this, "orbitYaw", Be);
|
|
214
214
|
u(this, "orbitPitch", Ue);
|
|
215
215
|
u(this, "enabled", !0);
|
|
216
216
|
u(this, "orbitDistanceMin", he);
|
|
217
|
-
u(this, "orbitDistanceMax",
|
|
217
|
+
u(this, "orbitDistanceMax", _e);
|
|
218
218
|
u(this, "viewportSnapshotBefore3D", null);
|
|
219
219
|
u(this, "orbitSnapshotOn3DEntry", null);
|
|
220
220
|
u(this, "dragMode", null);
|
|
@@ -255,9 +255,9 @@ class zi {
|
|
|
255
255
|
fit3D(e, t) {
|
|
256
256
|
const i = this.runtime;
|
|
257
257
|
if (!i) return;
|
|
258
|
-
const r = Math.max(1, (t == null ? void 0 : t.padding) ?? 1.15), n = e.getSize(new
|
|
258
|
+
const r = Math.max(1, (t == null ? void 0 : t.padding) ?? 1.15), n = e.getSize(new S()), a = e.getCenter(new S());
|
|
259
259
|
this.orbitTarget.set(a.x, a.y, a.z);
|
|
260
|
-
const o =
|
|
260
|
+
const o = Mi({
|
|
261
261
|
xmin: e.min.x,
|
|
262
262
|
ymin: e.min.y,
|
|
263
263
|
xmax: e.max.x,
|
|
@@ -266,7 +266,7 @@ class zi {
|
|
|
266
266
|
orbitPitchRad: this.orbitPitch,
|
|
267
267
|
ndcBand: pe
|
|
268
268
|
}), l = i.camera3d.fov * Math.PI / 180, d = 2 * Math.atan(Math.tan(l / 2) * Math.max(i.camera3d.aspect, 1e-6)), c = Math.max(Math.min(l, d) / 2, 1e-6), p = Math.max(n.length() / 2, 1e-6) / Math.sin(c) * r, h = Math.max(o, p);
|
|
269
|
-
this.orbitDistanceMin = h < he ? Math.max(h * 0.02, 1e-6) : he, this.orbitDistanceMax = Math.max(
|
|
269
|
+
this.orbitDistanceMin = h < he ? Math.max(h * 0.02, 1e-6) : he, this.orbitDistanceMax = Math.max(_e, h * 20), this.orbitDistance = this.clampDistance(h), this.syncPerspectiveCamera();
|
|
270
270
|
}
|
|
271
271
|
getVisibleDocumentRect() {
|
|
272
272
|
const e = this.runtime;
|
|
@@ -336,7 +336,7 @@ class zi {
|
|
|
336
336
|
if (this.dragMode === "pan") {
|
|
337
337
|
const i = this.screenToGround(e.clientX, e.clientY);
|
|
338
338
|
if (this.groundPanAnchor && i) {
|
|
339
|
-
const r =
|
|
339
|
+
const r = wi(this.orbitTarget, this.groundPanAnchor, i);
|
|
340
340
|
this.translateOrbit(r.x - this.orbitTarget.x, r.y - this.orbitTarget.y);
|
|
341
341
|
} else
|
|
342
342
|
this.panByScreenDelta(
|
|
@@ -356,15 +356,15 @@ class zi {
|
|
|
356
356
|
const t = this.runtime;
|
|
357
357
|
if (!t || t.viewMode !== "3d") return;
|
|
358
358
|
(d = e.preventDefault) == null || d.call(e);
|
|
359
|
-
const i = Math.max(1, t.canvasArea.clientHeight), r =
|
|
360
|
-
this.wheelClassifier =
|
|
359
|
+
const i = Math.max(1, t.canvasArea.clientHeight), r = Li(e.deltaY, e.deltaMode, i);
|
|
360
|
+
this.wheelClassifier = Ti({
|
|
361
361
|
valuePx: r,
|
|
362
362
|
ctrlKey: e.ctrlKey,
|
|
363
363
|
eventTimeMs: typeof performance > "u" ? Date.now() : performance.now(),
|
|
364
364
|
state: this.wheelClassifier,
|
|
365
365
|
resetMs: 400
|
|
366
366
|
});
|
|
367
|
-
const n = this.wheelClassifier.type ?? "trackpad", a = n === "wheel" ? Math.sign(r) * 100 : r, o =
|
|
367
|
+
const n = this.wheelClassifier.type ?? "trackpad", a = n === "wheel" ? Math.sign(r) * 100 : r, o = Di(-a, n, {
|
|
368
368
|
trackpadZoomRate: 1 / 700,
|
|
369
369
|
wheelZoomRate: 1 / 3200,
|
|
370
370
|
maxScalePerFrame: 2
|
|
@@ -376,7 +376,7 @@ class zi {
|
|
|
376
376
|
panByScreenDelta(e, t) {
|
|
377
377
|
const i = this.runtime;
|
|
378
378
|
if (!i) return;
|
|
379
|
-
const r =
|
|
379
|
+
const r = yi({
|
|
380
380
|
dxPx: e,
|
|
381
381
|
dyPx: t,
|
|
382
382
|
viewportWidthPx: Math.max(1, i.canvasArea.clientWidth),
|
|
@@ -408,7 +408,7 @@ class zi {
|
|
|
408
408
|
var o, l;
|
|
409
409
|
const t = this.runtime;
|
|
410
410
|
if (!t) return;
|
|
411
|
-
const i = t.camera2d, r = i.zoom > 0 ? i.zoom : 1, n = Math.max((i.top - i.bottom) / r, 1), a =
|
|
411
|
+
const i = t.camera2d, r = i.zoom > 0 ? i.zoom : 1, n = Math.max((i.top - i.bottom) / r, 1), a = Ri({
|
|
412
412
|
orthoCenterX: ((o = t.controls2d.target) == null ? void 0 : o.x) ?? i.position.x,
|
|
413
413
|
orthoCenterY: ((l = t.controls2d.target) == null ? void 0 : l.y) ?? i.position.y,
|
|
414
414
|
orthoFrustumSize: n,
|
|
@@ -420,7 +420,7 @@ class zi {
|
|
|
420
420
|
orbitDistanceMin: this.orbitDistanceMin,
|
|
421
421
|
orbitDistanceMax: this.orbitDistanceMax,
|
|
422
422
|
useFixedOrientation: e,
|
|
423
|
-
fixedOrbitYaw:
|
|
423
|
+
fixedOrbitYaw: Be,
|
|
424
424
|
fixedOrbitPitch: Ue,
|
|
425
425
|
ndcBand: pe
|
|
426
426
|
});
|
|
@@ -429,7 +429,7 @@ class zi {
|
|
|
429
429
|
sync2DFromOrbit() {
|
|
430
430
|
const e = this.runtime;
|
|
431
431
|
if (!e) return;
|
|
432
|
-
const t = e.camera2d, i = Math.max(1, e.canvasArea.clientWidth), r = Math.max(1, e.canvasArea.clientHeight), n = i / r, a = t.top - t.bottom, o = a > 0 ? a : 2, l = e.controls2d.minZoom > 0 ? e.controls2d.minZoom : 2e-3, d = Math.max(l, e.controls2d.maxZoom > 0 ? e.controls2d.maxZoom : 5e4), c = Math.max(1, o / d), p = Math.max(c, o / l), h =
|
|
432
|
+
const t = e.camera2d, i = Math.max(1, e.canvasArea.clientWidth), r = Math.max(1, e.canvasArea.clientHeight), n = i / r, a = t.top - t.bottom, o = a > 0 ? a : 2, l = e.controls2d.minZoom > 0 ? e.controls2d.minZoom : 2e-3, d = Math.max(l, e.controls2d.maxZoom > 0 ? e.controls2d.maxZoom : 5e4), c = Math.max(1, o / d), p = Math.max(c, o / l), h = Ii({
|
|
433
433
|
orbitTarget: { x: this.orbitTarget.x, y: this.orbitTarget.y, z: this.orbitTarget.z },
|
|
434
434
|
orbitDistance: this.orbitDistance,
|
|
435
435
|
orbitYaw: this.orbitYaw,
|
|
@@ -456,12 +456,12 @@ class zi {
|
|
|
456
456
|
syncPerspectiveCamera(e = {}) {
|
|
457
457
|
const t = this.runtime;
|
|
458
458
|
if (!t) return;
|
|
459
|
-
const i = Math.cos(this.orbitPitch), r = new
|
|
459
|
+
const i = Math.cos(this.orbitPitch), r = new S(
|
|
460
460
|
this.orbitTarget.x + this.orbitDistance * Math.cos(this.orbitYaw) * i,
|
|
461
461
|
this.orbitTarget.y + this.orbitDistance * Math.sin(this.orbitYaw) * i,
|
|
462
462
|
this.orbitTarget.z + this.orbitDistance * Math.sin(this.orbitPitch)
|
|
463
463
|
);
|
|
464
|
-
t.camera3d.near = Math.min(
|
|
464
|
+
t.camera3d.near = Math.min(Oi, Math.max(this.orbitDistance / 100, 1e-6)), t.camera3d.far = Math.max(zi, this.orbitDistance * 20), t.setPerspectivePose(r, this.orbitTarget), e.sync2D !== !1 && this.sync2DFromOrbit();
|
|
465
465
|
}
|
|
466
466
|
capture2DSnapshot() {
|
|
467
467
|
const e = this.runtime;
|
|
@@ -481,7 +481,7 @@ class zi {
|
|
|
481
481
|
}
|
|
482
482
|
isOrbitUnchangedFrom3DEntry() {
|
|
483
483
|
const e = this.orbitSnapshotOn3DEntry;
|
|
484
|
-
return e ?
|
|
484
|
+
return e ? _(this.orbitTarget.x, e.targetX) && _(this.orbitTarget.y, e.targetY) && _(this.orbitTarget.z, e.targetZ) && _(this.orbitDistance, e.distance) && _(this.orbitYaw, e.yaw) && _(this.orbitPitch, e.pitch) : !1;
|
|
485
485
|
}
|
|
486
486
|
getPerspectiveDocumentRect() {
|
|
487
487
|
const e = this.runtime;
|
|
@@ -489,7 +489,7 @@ class zi {
|
|
|
489
489
|
const t = [];
|
|
490
490
|
for (const i of [-1, 1])
|
|
491
491
|
for (const r of [-1, 1]) {
|
|
492
|
-
const n = new
|
|
492
|
+
const n = new S(i, r, -1).unproject(e.camera3d), o = new S(i, r, 1).unproject(e.camera3d).sub(n).normalize();
|
|
493
493
|
if (Math.abs(o.z) < 1e-8) continue;
|
|
494
494
|
const l = (0 - n.z) / o.z;
|
|
495
495
|
!Number.isFinite(l) || l < 0 || t.push({
|
|
@@ -532,42 +532,42 @@ class zi {
|
|
|
532
532
|
}
|
|
533
533
|
}
|
|
534
534
|
}
|
|
535
|
-
const
|
|
535
|
+
const Fi = new S(2.4, -2.7, 1.7), Vi = new S(0, 0, 0.65), $i = Math.PI, _i = !0, Bi = new S(1.25, -1.5, 0.85).normalize(), Ui = 1.25, ji = 0.4, Hi = 12, qi = 1e3, Yi = 20, Xi = 0.1, Wi = 0.2, It = "left-rotate", Gi = {
|
|
536
536
|
"left-rotate": { LEFT: N.ROTATE, MIDDLE: N.DOLLY, RIGHT: N.PAN },
|
|
537
537
|
"left-pan": { LEFT: N.PAN, MIDDLE: N.DOLLY, RIGHT: N.ROTATE }
|
|
538
538
|
};
|
|
539
|
-
function
|
|
540
|
-
const t = Math.max(s, 0.02), i = O.degToRad(e), r = t / Math.sin(i * 0.5) *
|
|
539
|
+
function Ki({ radius: s, fovDeg: e }) {
|
|
540
|
+
const t = Math.max(s, 0.02), i = O.degToRad(e), r = t / Math.sin(i * 0.5) * Ui;
|
|
541
541
|
return {
|
|
542
542
|
distance: r,
|
|
543
|
-
minDistance: Math.max(t *
|
|
544
|
-
maxDistance: Math.max(t *
|
|
543
|
+
minDistance: Math.max(t * ji, 0.01),
|
|
544
|
+
maxDistance: Math.max(t * Hi, 1),
|
|
545
545
|
near: Math.max(
|
|
546
|
-
r /
|
|
547
|
-
Math.min(
|
|
546
|
+
r / qi,
|
|
547
|
+
Math.min(Xi, t * Wi),
|
|
548
548
|
1e-4
|
|
549
549
|
),
|
|
550
|
-
far: Math.max(r *
|
|
550
|
+
far: Math.max(r * Yi, 10)
|
|
551
551
|
};
|
|
552
552
|
}
|
|
553
|
-
function
|
|
553
|
+
function Zi(s, e, t) {
|
|
554
554
|
e.minDistance = t.minDistance, e.maxDistance = t.maxDistance, s.near = t.near, s.far = t.far, s.updateProjectionMatrix();
|
|
555
555
|
}
|
|
556
556
|
function je(s, e, t = It) {
|
|
557
|
-
s.enableDamping =
|
|
557
|
+
s.enableDamping = _i, s.maxPolarAngle = $i, s.dampingFactor = 0.1, s.enablePan = !0, s.screenSpacePanning = !0, s.mouseButtons = { ...Gi[t] }, Ct.DEFAULT_UP.set(0, 0, 1), e.up.set(0, 0, 1);
|
|
558
558
|
}
|
|
559
|
-
function
|
|
559
|
+
function Ji(s, e, t, i) {
|
|
560
560
|
if (t.isEmpty()) return null;
|
|
561
|
-
const r = t.getSize(new
|
|
562
|
-
return e.target.copy(n), s.position.copy(n).addScaledVector(Bi, o.distance),
|
|
561
|
+
const r = t.getSize(new S()), n = t.getCenter(new S()), a = Math.max(r.length() * 0.5, 0.02), o = Ki({ radius: a, fovDeg: i });
|
|
562
|
+
return e.target.copy(n), s.position.copy(n).addScaledVector(Bi, o.distance), Zi(s, e, o), s.updateMatrixWorld(), e.update(), o;
|
|
563
563
|
}
|
|
564
|
-
const
|
|
565
|
-
class
|
|
564
|
+
const Qi = 1e3, er = 2, tr = -1e4, ir = 1e4, He = 1e3, rr = 2e6, sr = 1.15, nr = 1, qe = new Yt(Math.PI / 2, 0, Math.PI * 0.98 * 0.8);
|
|
565
|
+
class ar {
|
|
566
566
|
constructor(e) {
|
|
567
567
|
u(this, "canvasArea");
|
|
568
568
|
u(this, "canvas");
|
|
569
569
|
u(this, "scene", new we());
|
|
570
|
-
u(this, "overlayRoot", new
|
|
570
|
+
u(this, "overlayRoot", new Et());
|
|
571
571
|
u(this, "renderer");
|
|
572
572
|
u(this, "camera2d");
|
|
573
573
|
u(this, "camera3d");
|
|
@@ -579,10 +579,10 @@ class nr {
|
|
|
579
579
|
u(this, "ownedObjects", /* @__PURE__ */ new Set());
|
|
580
580
|
u(this, "overlays", /* @__PURE__ */ new Map());
|
|
581
581
|
u(this, "eventCleanups", []);
|
|
582
|
-
u(this, "raycaster", new
|
|
582
|
+
u(this, "raycaster", new St());
|
|
583
583
|
u(this, "pointerNdc", new oe());
|
|
584
|
-
u(this, "reuseVector", new
|
|
585
|
-
u(this, "reuseVector2", new
|
|
584
|
+
u(this, "reuseVector", new S());
|
|
585
|
+
u(this, "reuseVector2", new S());
|
|
586
586
|
u(this, "viewModeValue");
|
|
587
587
|
u(this, "initialized", !1);
|
|
588
588
|
u(this, "disposed", !1);
|
|
@@ -609,26 +609,26 @@ class nr {
|
|
|
609
609
|
initialize() {
|
|
610
610
|
if (this.disposed) throw new Error("SceneRuntime has been disposed.");
|
|
611
611
|
if (this.initialized) return;
|
|
612
|
-
const e = this.options.factories, t = (e == null ? void 0 : e.createRenderer) ?? ((l) => new
|
|
612
|
+
const e = this.options.factories, t = (e == null ? void 0 : e.createRenderer) ?? ((l) => new Ht(l)), i = (e == null ? void 0 : e.createMapControls) ?? ((l, d) => new li(l, d)), r = (e == null ? void 0 : e.createOrbitControls) ?? ((l, d) => new di(l, d));
|
|
613
613
|
this.renderer = t({
|
|
614
614
|
canvas: this.canvas,
|
|
615
615
|
antialias: this.options.antialias ?? !0,
|
|
616
616
|
alpha: this.options.alpha ?? !1,
|
|
617
617
|
powerPreference: this.options.powerPreference ?? "high-performance"
|
|
618
|
-
}), this.options.clearColor !== void 0 && this.renderer.setClearColor(new
|
|
618
|
+
}), this.options.clearColor !== void 0 && this.renderer.setClearColor(new qt(this.options.clearColor));
|
|
619
619
|
const n = Math.max(1, this.canvasArea.clientWidth || 1), a = Math.max(1, this.canvasArea.clientHeight || 1), o = n / a;
|
|
620
620
|
if (this.renderer.setPixelRatio(this.readDevicePixelRatio()), this.renderer.setSize(n, a, !1), this.options.environment) {
|
|
621
|
-
const l = (e == null ? void 0 : e.createEnvironment) ??
|
|
622
|
-
this.scene.environmentIntensity =
|
|
621
|
+
const l = (e == null ? void 0 : e.createEnvironment) ?? or;
|
|
622
|
+
this.scene.environmentIntensity = nr, this.scene.environmentRotation.copy(qe), this.scene.backgroundRotation.copy(qe);
|
|
623
623
|
const d = ++this.environmentLoadGeneration, c = l(this.renderer, this.options.environment);
|
|
624
|
-
|
|
624
|
+
lr(c) ? c.then(
|
|
625
625
|
(p) => this.applyEnvironmentResource(p, d),
|
|
626
626
|
(p) => {
|
|
627
627
|
!this.disposed && d === this.environmentLoadGeneration && console.warn("Failed to load scene environment HDR.", p);
|
|
628
628
|
}
|
|
629
629
|
) : this.applyEnvironmentResource(c, d);
|
|
630
630
|
}
|
|
631
|
-
this.camera2d = new Oe(-o, o, 1, -1,
|
|
631
|
+
this.camera2d = new Oe(-o, o, 1, -1, tr, ir), this.camera2d.position.set(0, 0, 1), this.camera2d.lookAt(0, 0, 0), this.camera3d = new Xt(40, o, He, rr), this.camera3d.up.set(0, 0, 1), this.camera3d.position.set(1e4, 0, 1e4), this.camera3d.lookAt(0, 0, 0), this.controls2d = i(this.camera2d, this.renderer.domElement), this.controls2d.enableRotate = !1, this.controls2d.screenSpacePanning = !0, this.controls2d.zoomToCursor = !0, this.controls2d.minZoom = 2e-3, this.controls2d.maxZoom = 5e4, this.controls2d.mouseButtons = {
|
|
632
632
|
LEFT: N.PAN,
|
|
633
633
|
MIDDLE: N.DOLLY,
|
|
634
634
|
RIGHT: N.PAN
|
|
@@ -675,10 +675,10 @@ class nr {
|
|
|
675
675
|
var t, i;
|
|
676
676
|
if (this.controls3d) {
|
|
677
677
|
if (e === "viewer") {
|
|
678
|
-
this.viewerOrbit ?? (this.viewerOrbit = new
|
|
678
|
+
this.viewerOrbit ?? (this.viewerOrbit = new Ni()), this.viewerOrbit.attach(this);
|
|
679
679
|
return;
|
|
680
680
|
}
|
|
681
|
-
(t = this.viewerOrbit) == null || t.setEnabled(!1), (i = this.viewerOrbit) == null || i.dispose(), this.viewerOrbit = null, this.controls3d.enabled = e === "preview" && this.viewModeValue === "3d", e === "preview" && (je(this.controls3d, this.camera3d, this.previewDragPreset), this.camera3d.position.copy(
|
|
681
|
+
(t = this.viewerOrbit) == null || t.setEnabled(!1), (i = this.viewerOrbit) == null || i.dispose(), this.viewerOrbit = null, this.controls3d.enabled = e === "preview" && this.viewModeValue === "3d", e === "preview" && (je(this.controls3d, this.camera3d, this.previewDragPreset), this.camera3d.position.copy(Fi), this.controls3d.target.copy(Vi), this.controls3d.update());
|
|
682
682
|
}
|
|
683
683
|
}
|
|
684
684
|
/**
|
|
@@ -772,7 +772,7 @@ class nr {
|
|
|
772
772
|
if (!this.camera2d || !this.camera3d) return !1;
|
|
773
773
|
const i = this.resolveBox3(e);
|
|
774
774
|
if (!i || i.isEmpty()) return !1;
|
|
775
|
-
const r = i.getSize(new
|
|
775
|
+
const r = i.getSize(new S()), n = i.getCenter(new S());
|
|
776
776
|
if (![r.x, r.y, r.z, n.x, n.y, n.z].every(Number.isFinite)) return !1;
|
|
777
777
|
const a = Math.max(1, t.padding ?? 1.05);
|
|
778
778
|
if ((t.viewMode ?? this.viewModeValue) === "2d") {
|
|
@@ -780,7 +780,7 @@ class nr {
|
|
|
780
780
|
let f = l / 2, v = d / 2;
|
|
781
781
|
f / v < h ? f = v * h : v = f / h, this.camera2d.left = -f, this.camera2d.right = f, this.camera2d.top = v, this.camera2d.bottom = -v, this.camera2d.zoom = 1, this.camera2d.position.set(n.x, n.y, Math.max(n.z + 1, 1)), this.camera2d.updateProjectionMatrix(), this.controls2d.target.copy(n), this.controls2d.update();
|
|
782
782
|
} else if (this.navigationPolicyValue === "preview")
|
|
783
|
-
|
|
783
|
+
Ji(this.camera3d, this.controls3d, i, this.camera3d.fov);
|
|
784
784
|
else if (this.viewerOrbit)
|
|
785
785
|
this.viewerOrbit.fit3D(i, { padding: a });
|
|
786
786
|
else {
|
|
@@ -851,11 +851,11 @@ class nr {
|
|
|
851
851
|
}
|
|
852
852
|
applyPreviewOrbitSnapshot(e) {
|
|
853
853
|
if (!this.camera3d || !this.controls3d) return !1;
|
|
854
|
-
const t = Math.cos(e.pitch), i = new
|
|
854
|
+
const t = Math.cos(e.pitch), i = new S(e.targetX, e.targetY, e.targetZ), r = O.clamp(
|
|
855
855
|
e.distance,
|
|
856
856
|
this.controls3d.minDistance,
|
|
857
857
|
this.controls3d.maxDistance
|
|
858
|
-
), n = new
|
|
858
|
+
), n = new S(
|
|
859
859
|
i.x + r * Math.cos(e.yaw) * t,
|
|
860
860
|
i.y + r * Math.sin(e.yaw) * t,
|
|
861
861
|
i.z + r * Math.sin(e.pitch)
|
|
@@ -889,10 +889,10 @@ class nr {
|
|
|
889
889
|
}
|
|
890
890
|
renderOrthographicPreview(e, t, i) {
|
|
891
891
|
var G;
|
|
892
|
-
if (!this.renderer || this.disposed || t.parent || !
|
|
893
|
-
const r = Math.max(1, Math.floor(e.clientWidth || e.width || 0)), n = Math.max(1, Math.floor(e.clientHeight || e.height || 0)), a = this.resolveRendererPixelRatio(), o = Math.min(2, a), l = Math.max(1, Math.floor(r * o)), d = Math.max(1, Math.floor(n * o)), c = l / a, p = d / a, h = Math.min(c, p), f = (i.minX + i.maxX) / 2, v = (i.minY + i.maxY) / 2, m = Math.max(i.maxX - i.minX, i.maxY - i.minY, 1) *
|
|
894
|
-
g.left = -m, g.right = m, g.top = m, g.bottom = -m, g.position.set(f, v, 1), g.up.copy(((G = this.camera2d) == null ? void 0 : G.up) ?? new
|
|
895
|
-
const x = this.getOrCreatePreviewScene(), w = this.renderer, C = w.getRenderTarget(), D = w.getClearAlpha(),
|
|
892
|
+
if (!this.renderer || this.disposed || t.parent || !dr(i)) return !1;
|
|
893
|
+
const r = Math.max(1, Math.floor(e.clientWidth || e.width || 0)), n = Math.max(1, Math.floor(e.clientHeight || e.height || 0)), a = this.resolveRendererPixelRatio(), o = Math.min(2, a), l = Math.max(1, Math.floor(r * o)), d = Math.max(1, Math.floor(n * o)), c = l / a, p = d / a, h = Math.min(c, p), f = (i.minX + i.maxX) / 2, v = (i.minY + i.maxY) / 2, m = Math.max(i.maxX - i.minX, i.maxY - i.minY, 1) * sr / 2, b = this.getOrCreatePreviewRenderTarget(l, d), g = this.getOrCreatePreviewCamera();
|
|
894
|
+
g.left = -m, g.right = m, g.top = m, g.bottom = -m, g.position.set(f, v, 1), g.up.copy(((G = this.camera2d) == null ? void 0 : G.up) ?? new S(0, 1, 0)), g.lookAt(f, v, 0), g.updateProjectionMatrix(), g.updateMatrixWorld(!0);
|
|
895
|
+
const x = this.getOrCreatePreviewScene(), w = this.renderer, C = w.getRenderTarget(), D = w.getClearAlpha(), E = w.autoClear, A = new Wt();
|
|
896
896
|
w.getViewport(A);
|
|
897
897
|
const L = w.getScissorTest();
|
|
898
898
|
x.add(t);
|
|
@@ -906,7 +906,7 @@ class nr {
|
|
|
906
906
|
const K = this.getOrCreatePreviewPixelBuffer(l, d);
|
|
907
907
|
return w.readRenderTargetPixels(b, 0, 0, l, d, K), this.blitPreviewPixelsToCanvas(e, K, l, d);
|
|
908
908
|
} finally {
|
|
909
|
-
t.removeFromParent(), w.setRenderTarget(C), w.setClearAlpha(D), w.autoClear =
|
|
909
|
+
t.removeFromParent(), w.setRenderTarget(C), w.setClearAlpha(D), w.autoClear = E, w.setViewport(
|
|
910
910
|
A.x,
|
|
911
911
|
A.y,
|
|
912
912
|
A.z,
|
|
@@ -929,7 +929,7 @@ class nr {
|
|
|
929
929
|
}
|
|
930
930
|
screenToWorldOnPlane(e, t, i = 0) {
|
|
931
931
|
const r = this.clientToNdc(e, t, this.pointerNdc);
|
|
932
|
-
return !r || !this.activeCamera ? null : (this.raycaster.setFromCamera(r, this.activeCamera), this.raycaster.ray.intersectPlane(new kt(new
|
|
932
|
+
return !r || !this.activeCamera ? null : (this.raycaster.setFromCamera(r, this.activeCamera), this.raycaster.ray.intersectPlane(new kt(new S(0, 0, 1), -i), new S()));
|
|
933
933
|
}
|
|
934
934
|
worldToClient(e, t = new oe()) {
|
|
935
935
|
var a;
|
|
@@ -971,7 +971,7 @@ class nr {
|
|
|
971
971
|
startAnimation(e = {}) {
|
|
972
972
|
if (this.disposed || this.animationLoopActive) return;
|
|
973
973
|
this.animationLoopActive = !0, this.infoFrames = 0, this.infoLastTime = performance.now();
|
|
974
|
-
const t = e.infoUpdateIntervalMs ??
|
|
974
|
+
const t = e.infoUpdateIntervalMs ?? Qi, i = (r = performance.now()) => {
|
|
975
975
|
var o, l, d, c, p, h, f, v, y;
|
|
976
976
|
if (!this.animationLoopActive || this.disposed) {
|
|
977
977
|
this.animationFrameId = null;
|
|
@@ -1026,7 +1026,7 @@ class nr {
|
|
|
1026
1026
|
}
|
|
1027
1027
|
getOrCreatePreviewRenderTarget(e, t) {
|
|
1028
1028
|
var i;
|
|
1029
|
-
return this.previewRenderTarget && this.previewRenderTargetSize.width === e && this.previewRenderTargetSize.height === t ? this.previewRenderTarget : ((i = this.previewRenderTarget) == null || i.dispose(), this.previewRenderTarget = new
|
|
1029
|
+
return this.previewRenderTarget && this.previewRenderTargetSize.width === e && this.previewRenderTargetSize.height === t ? this.previewRenderTarget : ((i = this.previewRenderTarget) == null || i.dispose(), this.previewRenderTarget = new Gt(e, t), this.previewRenderTargetSize = { width: e, height: t }, this.previewRenderTarget);
|
|
1030
1030
|
}
|
|
1031
1031
|
getOrCreatePreviewPixelBuffer(e, t) {
|
|
1032
1032
|
const i = e * t * 4;
|
|
@@ -1056,13 +1056,13 @@ class nr {
|
|
|
1056
1056
|
}
|
|
1057
1057
|
readDevicePixelRatio() {
|
|
1058
1058
|
const e = globalThis.devicePixelRatio;
|
|
1059
|
-
return typeof e != "number" || !Number.isFinite(e) || e <= 0 ? 1 : Math.min(e,
|
|
1059
|
+
return typeof e != "number" || !Number.isFinite(e) || e <= 0 ? 1 : Math.min(e, er);
|
|
1060
1060
|
}
|
|
1061
1061
|
resolveBox3(e) {
|
|
1062
1062
|
if (e instanceof F) return e.clone();
|
|
1063
1063
|
if (e instanceof Ct) return new F().setFromObject(e);
|
|
1064
1064
|
const { minX: t, minY: i, maxX: r, maxY: n } = e;
|
|
1065
|
-
return ![t, i, r, n].every(Number.isFinite) || r < t || n < i ? null : new F(new
|
|
1065
|
+
return ![t, i, r, n].every(Number.isFinite) || r < t || n < i ? null : new F(new S(t, i, 0), new S(r, n, 0));
|
|
1066
1066
|
}
|
|
1067
1067
|
isDescendantOf(e, t) {
|
|
1068
1068
|
let i = e.parent;
|
|
@@ -1079,9 +1079,9 @@ class nr {
|
|
|
1079
1079
|
});
|
|
1080
1080
|
}
|
|
1081
1081
|
}
|
|
1082
|
-
function
|
|
1082
|
+
function or(s, e) {
|
|
1083
1083
|
if (e === "room") {
|
|
1084
|
-
const t = new
|
|
1084
|
+
const t = new Kt(s), i = new oi(), r = t.fromScene(i);
|
|
1085
1085
|
return i.dispose(), t.dispose(), {
|
|
1086
1086
|
texture: r.texture,
|
|
1087
1087
|
dispose: () => r.dispose()
|
|
@@ -1089,20 +1089,20 @@ function ar(s, e) {
|
|
|
1089
1089
|
}
|
|
1090
1090
|
if (e.type !== "hdr" || e.url.trim().length === 0)
|
|
1091
1091
|
throw new Error("HDR scene environment requires a non-empty URL.");
|
|
1092
|
-
return new
|
|
1092
|
+
return new ci().loadAsync(e.url).then((t) => (t.mapping = Zt, {
|
|
1093
1093
|
texture: t,
|
|
1094
1094
|
dispose: () => t.dispose()
|
|
1095
1095
|
}));
|
|
1096
1096
|
}
|
|
1097
|
-
function
|
|
1097
|
+
function lr(s) {
|
|
1098
1098
|
return typeof (s == null ? void 0 : s.then) == "function";
|
|
1099
1099
|
}
|
|
1100
|
-
function
|
|
1100
|
+
function dr(s) {
|
|
1101
1101
|
return Number.isFinite(s.minX) && Number.isFinite(s.minY) && Number.isFinite(s.maxX) && Number.isFinite(s.maxY) && s.maxX >= s.minX && s.maxY >= s.minY;
|
|
1102
1102
|
}
|
|
1103
|
-
const
|
|
1104
|
-
function
|
|
1105
|
-
return typeof globalThis.localStorage > "u" ?
|
|
1103
|
+
const Re = 1, cr = 1024, ur = 16, hr = 1e9;
|
|
1104
|
+
function pr() {
|
|
1105
|
+
return typeof globalThis.localStorage > "u" ? fr() : {
|
|
1106
1106
|
read(s) {
|
|
1107
1107
|
try {
|
|
1108
1108
|
const e = globalThis.localStorage.getItem(Ye(s));
|
|
@@ -1119,7 +1119,7 @@ function hr() {
|
|
|
1119
1119
|
}
|
|
1120
1120
|
};
|
|
1121
1121
|
}
|
|
1122
|
-
function
|
|
1122
|
+
function fr() {
|
|
1123
1123
|
const s = /* @__PURE__ */ new Map();
|
|
1124
1124
|
return {
|
|
1125
1125
|
read(e) {
|
|
@@ -1130,7 +1130,7 @@ function pr() {
|
|
|
1130
1130
|
}
|
|
1131
1131
|
};
|
|
1132
1132
|
}
|
|
1133
|
-
function
|
|
1133
|
+
function mr(s, e) {
|
|
1134
1134
|
if (!s || !e) return null;
|
|
1135
1135
|
const t = s.read(e);
|
|
1136
1136
|
return Ie(t) ? t : null;
|
|
@@ -1138,7 +1138,7 @@ function fr(s, e) {
|
|
|
1138
1138
|
function Ie(s) {
|
|
1139
1139
|
if (!s || typeof s != "object") return !1;
|
|
1140
1140
|
const e = s;
|
|
1141
|
-
if (e.schemaVersion !==
|
|
1141
|
+
if (e.schemaVersion !== Re) return !1;
|
|
1142
1142
|
if (e.viewMode === "2d") {
|
|
1143
1143
|
const t = e.orthographic;
|
|
1144
1144
|
return !t || ![
|
|
@@ -1166,60 +1166,60 @@ function Ie(s) {
|
|
|
1166
1166
|
}
|
|
1167
1167
|
return !1;
|
|
1168
1168
|
}
|
|
1169
|
-
function
|
|
1169
|
+
function vr(s, e, t) {
|
|
1170
1170
|
!s || !e || s.write(e, t);
|
|
1171
1171
|
}
|
|
1172
|
-
function
|
|
1172
|
+
function gr(s) {
|
|
1173
1173
|
return {
|
|
1174
|
-
schemaVersion:
|
|
1174
|
+
schemaVersion: Re,
|
|
1175
1175
|
viewMode: s.viewMode,
|
|
1176
1176
|
...s.orthographic ? { orthographic: s.orthographic } : {},
|
|
1177
1177
|
...s.orbit ? { orbit: s.orbit } : {}
|
|
1178
1178
|
};
|
|
1179
1179
|
}
|
|
1180
|
-
function
|
|
1180
|
+
function br(s, e) {
|
|
1181
1181
|
if (!Ie(s)) return null;
|
|
1182
|
-
const t =
|
|
1182
|
+
const t = yr(e);
|
|
1183
1183
|
if (s.viewMode === "2d") {
|
|
1184
1184
|
const r = s.orthographic;
|
|
1185
1185
|
if (!r) return null;
|
|
1186
1186
|
const n = (r.right - r.left) / r.zoom, a = (r.top - r.bottom) / r.zoom;
|
|
1187
|
-
return !Number.isFinite(n) || !Number.isFinite(a) || Math.max(n, a) > t || e && !
|
|
1187
|
+
return !Number.isFinite(n) || !Number.isFinite(a) || Math.max(n, a) > t || e && !xr(r.positionX, r.positionY, n, a, e) ? null : s;
|
|
1188
1188
|
}
|
|
1189
1189
|
const i = s.orbit;
|
|
1190
|
-
return !i || e && !
|
|
1190
|
+
return !i || e && !wr(i.targetX, i.targetY, e) ? null : s;
|
|
1191
1191
|
}
|
|
1192
|
-
function
|
|
1192
|
+
function yr(s) {
|
|
1193
1193
|
if (s) {
|
|
1194
1194
|
const e = Math.max(s.maxX - s.minX, s.maxY - s.minY);
|
|
1195
|
-
if (Number.isFinite(e) && e > 0) return e *
|
|
1195
|
+
if (Number.isFinite(e) && e > 0) return e * cr;
|
|
1196
1196
|
}
|
|
1197
|
-
return
|
|
1197
|
+
return hr;
|
|
1198
1198
|
}
|
|
1199
|
-
function
|
|
1199
|
+
function xr(s, e, t, i, r) {
|
|
1200
1200
|
const n = t / 2, a = i / 2;
|
|
1201
1201
|
return !(s + n < r.minX || s - n > r.maxX || e + a < r.minY || e - a > r.maxY);
|
|
1202
1202
|
}
|
|
1203
|
-
function
|
|
1203
|
+
function wr(s, e, t) {
|
|
1204
1204
|
const i = Math.max(t.maxX - t.minX, t.maxY - t.minY);
|
|
1205
1205
|
if (!Number.isFinite(i) || i <= 0) return !0;
|
|
1206
|
-
const r = i *
|
|
1206
|
+
const r = i * ur;
|
|
1207
1207
|
return s >= t.minX - r && s <= t.maxX + r && e >= t.minY - r && e <= t.maxY + r;
|
|
1208
1208
|
}
|
|
1209
1209
|
function Ye(s) {
|
|
1210
|
-
return `nebula-viewer:camera:v${
|
|
1210
|
+
return `nebula-viewer:camera:v${Re}:${s}`;
|
|
1211
1211
|
}
|
|
1212
1212
|
function Z(s) {
|
|
1213
1213
|
return new F(
|
|
1214
|
-
new
|
|
1215
|
-
new
|
|
1214
|
+
new S(s.minX, s.minY, s.minZ),
|
|
1215
|
+
new S(s.maxX, s.maxY, s.maxZ)
|
|
1216
1216
|
);
|
|
1217
1217
|
}
|
|
1218
|
-
function
|
|
1218
|
+
function Mt(s) {
|
|
1219
1219
|
const [e, t, i] = s;
|
|
1220
1220
|
return (e & 255) << 16 | (t & 255) << 8 | i & 255;
|
|
1221
1221
|
}
|
|
1222
|
-
class
|
|
1222
|
+
class Cr {
|
|
1223
1223
|
constructor() {
|
|
1224
1224
|
u(this, "rows", []);
|
|
1225
1225
|
u(this, "allColor", null);
|
|
@@ -1242,7 +1242,7 @@ class wr {
|
|
|
1242
1242
|
color: i.has(n.index) ? i.get(n.index) : this.allColor,
|
|
1243
1243
|
sourceColor: n.color
|
|
1244
1244
|
}));
|
|
1245
|
-
|
|
1245
|
+
Pr(this.rows, r) || (this.rows = r, this.revision += 1, t && this.onChange());
|
|
1246
1246
|
}
|
|
1247
1247
|
clear(e = !0) {
|
|
1248
1248
|
const t = this.rows.length > 0 || this.allColor !== null;
|
|
@@ -1299,7 +1299,7 @@ class wr {
|
|
|
1299
1299
|
t && (this.allColor = e, this.revision += 1, this.onChange());
|
|
1300
1300
|
}
|
|
1301
1301
|
}
|
|
1302
|
-
class
|
|
1302
|
+
class Er {
|
|
1303
1303
|
constructor() {
|
|
1304
1304
|
u(this, "usages", []);
|
|
1305
1305
|
u(this, "revision", 0);
|
|
@@ -1325,7 +1325,7 @@ class Cr {
|
|
|
1325
1325
|
canHighlight: r.canHighlight,
|
|
1326
1326
|
visible: r.visible
|
|
1327
1327
|
}));
|
|
1328
|
-
|
|
1328
|
+
Ar(this.usages, i) || (this.usages = i, this.revision += 1, t && this.onChange());
|
|
1329
1329
|
}
|
|
1330
1330
|
clear(e = !0) {
|
|
1331
1331
|
const t = this.usages.length > 0;
|
|
@@ -1370,7 +1370,7 @@ class Sr {
|
|
|
1370
1370
|
return !this.selection && !this.details && !this.textSelection && !this.textDetails ? !1 : (this.selection = null, this.details = null, this.textSelection = null, this.textDetails = null, this.revision += 1, !0);
|
|
1371
1371
|
}
|
|
1372
1372
|
}
|
|
1373
|
-
class
|
|
1373
|
+
class kr {
|
|
1374
1374
|
constructor() {
|
|
1375
1375
|
u(this, "revision", 0);
|
|
1376
1376
|
u(this, "filename", null);
|
|
@@ -1412,7 +1412,7 @@ class Er {
|
|
|
1412
1412
|
this.zoomLabel = Number.isFinite(p) && (p ?? 0) > 0 ? `${Math.round(p * 100)}%` : "", this.scaleRuler = {
|
|
1413
1413
|
visible: !0,
|
|
1414
1414
|
worldLength: c,
|
|
1415
|
-
lengthLabel:
|
|
1415
|
+
lengthLabel: Rr(c, ((l = e.units) == null ? void 0 : l.source) ?? "mm")
|
|
1416
1416
|
}, this.orbitDistanceLabel = "";
|
|
1417
1417
|
} else {
|
|
1418
1418
|
const c = (d = e.host.runtime.captureCameraSnapshot()) == null ? void 0 : d.orbit;
|
|
@@ -1423,19 +1423,19 @@ class Er {
|
|
|
1423
1423
|
return this.filename !== null || this.fileCount !== 0 || this.visibleLayerCount !== 0 || this.totalLayerCount !== 0 || this.statusMessage !== "" || this.zoomLabel !== "" || this.orbitDistanceLabel !== "" || this.scaleRuler !== null || this.viewportVertexCount !== 0 || this.drawCalls !== 0 || this.fps !== 0 || this.lineRenderMode !== "" || this.entityCount !== 0 || this.lineCount !== 0 || this.fillCount !== 0 || this.dotCount !== 0 || this.textCount !== 0 || this.renderableCount !== 0 || this.submittedVertexRefs !== 0 || this.blockVariantCount !== 0 || this.blockInstanceCount !== 0 || this.splitBlockLayerGroupCount !== 0 || this.renderDebugBreakdown.length > 0 || this.splitBlockLayerDetails.length > 0 || this.phase !== null ? (this.revision += 1, this.filename = null, this.fileCount = 0, this.visibleLayerCount = 0, this.totalLayerCount = 0, this.statusMessage = "", this.zoomLabel = "", this.orbitDistanceLabel = "", this.scaleRuler = null, this.viewportVertexCount = 0, this.drawCalls = 0, this.fps = 0, this.lineRenderMode = "", this.entityCount = 0, this.lineCount = 0, this.fillCount = 0, this.dotCount = 0, this.textCount = 0, this.renderableCount = 0, this.submittedVertexRefs = 0, this.blockVariantCount = 0, this.blockInstanceCount = 0, this.splitBlockLayerGroupCount = 0, this.renderDebugBreakdown = [], this.splitBlockLayerDetails = [], this.phase = null, !0) : !1;
|
|
1424
1424
|
}
|
|
1425
1425
|
}
|
|
1426
|
-
function
|
|
1426
|
+
function Pr(s, e) {
|
|
1427
1427
|
return s.length === e.length && s.every((t, i) => {
|
|
1428
1428
|
const r = e[i];
|
|
1429
1429
|
return r !== void 0 && t.index === r.index && t.name === r.name && t.visible === r.visible && t.color === r.color && t.sourceColor[0] === r.sourceColor[0] && t.sourceColor[1] === r.sourceColor[1] && t.sourceColor[2] === r.sourceColor[2];
|
|
1430
1430
|
});
|
|
1431
1431
|
}
|
|
1432
|
-
function
|
|
1432
|
+
function Ar(s, e) {
|
|
1433
1433
|
return s.length === e.length && s.every((t, i) => {
|
|
1434
1434
|
const r = e[i];
|
|
1435
1435
|
return r !== void 0 && t.insertId === r.insertId && t.blockName === r.blockName && t.layerName === r.layerName && t.layerIndex === r.layerIndex && t.variantId === r.variantId && t.instanceId === r.instanceId && t.label === r.label && t.canHighlight === r.canHighlight && t.visible === r.visible;
|
|
1436
1436
|
});
|
|
1437
1437
|
}
|
|
1438
|
-
function
|
|
1438
|
+
function Rr(s, e) {
|
|
1439
1439
|
if (e === "mm") {
|
|
1440
1440
|
if (s >= 1e6) return `${(s / 1e6).toFixed(2)} km`;
|
|
1441
1441
|
if (s >= 1e3) return `${(s / 1e3).toFixed(2)} m`;
|
|
@@ -1454,13 +1454,13 @@ function Xe(s) {
|
|
|
1454
1454
|
units: s.units ?? { source: "mm" }
|
|
1455
1455
|
};
|
|
1456
1456
|
}
|
|
1457
|
-
const
|
|
1458
|
-
class
|
|
1457
|
+
const Ir = 160, We = 5e3;
|
|
1458
|
+
class Mr {
|
|
1459
1459
|
constructor(e) {
|
|
1460
|
-
u(this, "layers", new
|
|
1461
|
-
u(this, "blocks", new
|
|
1460
|
+
u(this, "layers", new Cr());
|
|
1461
|
+
u(this, "blocks", new Er());
|
|
1462
1462
|
u(this, "inspector", new Sr());
|
|
1463
|
-
u(this, "hud", new
|
|
1463
|
+
u(this, "hud", new kr());
|
|
1464
1464
|
u(this, "document", null);
|
|
1465
1465
|
u(this, "loadTiming", null);
|
|
1466
1466
|
u(this, "capabilities", {
|
|
@@ -1494,10 +1494,10 @@ class Ir {
|
|
|
1494
1494
|
this.assertActive(), this.closeInternal();
|
|
1495
1495
|
const i = ++this.openEpoch;
|
|
1496
1496
|
this.cameraSettled = !1, this.initialDemandSettled = !1, this.initialCameraRestored = !1, this.cameraChangedDuringInitialLoad = !1, this.loadTiming = null;
|
|
1497
|
-
const r = t.documentKey ??
|
|
1497
|
+
const r = t.documentKey ?? zr(e);
|
|
1498
1498
|
let n;
|
|
1499
1499
|
try {
|
|
1500
|
-
n =
|
|
1500
|
+
n = ui(e, {
|
|
1501
1501
|
documentKey: r ?? void 0,
|
|
1502
1502
|
filename: t.filename,
|
|
1503
1503
|
loadAnnotations: t.loadAnnotations,
|
|
@@ -1517,7 +1517,7 @@ class Ir {
|
|
|
1517
1517
|
throw this.emit("error", { ...J(p, !0, e), error: p }), p;
|
|
1518
1518
|
}
|
|
1519
1519
|
this.session = n, this.loadTiming = n.loadTiming, this.statusMessage = "加载中…";
|
|
1520
|
-
const a =
|
|
1520
|
+
const a = hi(n);
|
|
1521
1521
|
this.renderNode = a, this.layers.bind(a, () => this.emit("layer-change", { layers: this.layers })), this.blocks.bind(a, () => this.emit("block-change", { blocks: this.blocks })), this.unsubscribers.push(
|
|
1522
1522
|
a.onChange(() => {
|
|
1523
1523
|
this.host.requestRender(), this.host.emitContentChange();
|
|
@@ -1665,11 +1665,11 @@ class Ir {
|
|
|
1665
1665
|
return this.layers.getVisibilityRevision() + this.blocks.getVisibilityRevision();
|
|
1666
1666
|
}
|
|
1667
1667
|
setInsertSelection(e, t) {
|
|
1668
|
-
|
|
1668
|
+
Lr(this.inspector.selection, e) && Dr(this.inspector.details, t) && !this.inspector.textSelection || (this.inspector.setSelection(e, t), this.emit("inspector-change", { inspector: this.inspector }));
|
|
1669
1669
|
}
|
|
1670
1670
|
/** @internal Used by the viewer's managed interaction pipeline. */
|
|
1671
1671
|
setTextSelectionInternal(e, t) {
|
|
1672
|
-
|
|
1672
|
+
Tr(this.inspector.textSelection, e) && Or(this.inspector.textDetails, t) && !this.inspector.selection || (this.inspector.setTextSelection(e, t), this.emit("inspector-change", { inspector: this.inspector }));
|
|
1673
1673
|
}
|
|
1674
1674
|
getAuthoritativeBoundsBox() {
|
|
1675
1675
|
if (!this.session) return null;
|
|
@@ -1781,7 +1781,7 @@ class Ir {
|
|
|
1781
1781
|
tryRestoreCamera(e, t) {
|
|
1782
1782
|
const i = this.host.readCameraSnapshot(e);
|
|
1783
1783
|
if (!i) return !1;
|
|
1784
|
-
const r =
|
|
1784
|
+
const r = br(i, t);
|
|
1785
1785
|
return r ? this.host.applyCameraSnapshot(r, "restore") : !1;
|
|
1786
1786
|
}
|
|
1787
1787
|
persistCurrentCamera() {
|
|
@@ -1790,7 +1790,7 @@ class Ir {
|
|
|
1790
1790
|
const e = this.host.runtime.captureCameraSnapshot();
|
|
1791
1791
|
e && this.host.persistCameraSnapshot(
|
|
1792
1792
|
this.document.documentKey,
|
|
1793
|
-
|
|
1793
|
+
gr(e)
|
|
1794
1794
|
);
|
|
1795
1795
|
}
|
|
1796
1796
|
syncDisplayContext() {
|
|
@@ -1836,7 +1836,7 @@ class Ir {
|
|
|
1836
1836
|
}
|
|
1837
1837
|
this.viewportDemandTimer === null && (this.viewportDemandTimer = globalThis.setTimeout(() => {
|
|
1838
1838
|
this.viewportDemandTimer = null, !(this.disposed || !this.session) && this.host.interaction === "active" && this.flushViewportDemand();
|
|
1839
|
-
}, Math.max(0, this.host.viewportDemandCoalesceMs ??
|
|
1839
|
+
}, Math.max(0, this.host.viewportDemandCoalesceMs ?? Ir)));
|
|
1840
1840
|
}
|
|
1841
1841
|
clearViewportDemandTimer() {
|
|
1842
1842
|
this.viewportDemandTimer !== null && (globalThis.clearTimeout(this.viewportDemandTimer), this.viewportDemandTimer = null);
|
|
@@ -1873,19 +1873,19 @@ class Ir {
|
|
|
1873
1873
|
if (this.disposed) throw new Error("Viewer has been disposed.");
|
|
1874
1874
|
}
|
|
1875
1875
|
}
|
|
1876
|
-
function
|
|
1876
|
+
function Lr(s, e) {
|
|
1877
1877
|
return s === e || !!(s && e && s.documentKey === e.documentKey && s.id.layerIndex === e.id.layerIndex && s.id.variantId === e.id.variantId && s.id.instanceId === e.id.instanceId);
|
|
1878
1878
|
}
|
|
1879
|
-
function
|
|
1879
|
+
function Tr(s, e) {
|
|
1880
1880
|
return s === e || !!(s && e && s.documentKey === e.documentKey && s.id.textId === e.id.textId);
|
|
1881
1881
|
}
|
|
1882
|
-
function
|
|
1882
|
+
function Dr(s, e) {
|
|
1883
1883
|
return s === e || !!(s && e && s.id.layerIndex === e.id.layerIndex && s.id.variantId === e.id.variantId && s.id.instanceId === e.id.instanceId && s.label === e.label && s.blockName === e.blockName && s.layerName === e.layerName && s.layerIndex === e.layerIndex && s.tx === e.tx && s.ty === e.ty && s.rotation === e.rotation && s.scaleX === e.scaleX && s.scaleY === e.scaleY && s.bbox.minX === e.bbox.minX && s.bbox.minY === e.bbox.minY && s.bbox.maxX === e.bbox.maxX && s.bbox.maxY === e.bbox.maxY);
|
|
1884
1884
|
}
|
|
1885
|
-
function
|
|
1885
|
+
function Or(s, e) {
|
|
1886
1886
|
return s === e || !!(s && e && s.id.textId === e.id.textId && s.content === e.content && s.x === e.x && s.y === e.y && s.height === e.height && s.rotation === e.rotation && s.layerName === e.layerName && s.layerIndex === e.layerIndex);
|
|
1887
1887
|
}
|
|
1888
|
-
function
|
|
1888
|
+
function zr(s) {
|
|
1889
1889
|
let e = null;
|
|
1890
1890
|
if (typeof s == "string" ? e = s : typeof URL < "u" && s instanceof URL ? e = s.href : typeof s == "object" && s !== null && "kind" in s && s.kind === "url" && (e = s.url), !e) return null;
|
|
1891
1891
|
let t = 2166136261;
|
|
@@ -1905,7 +1905,7 @@ function J(s, e, t) {
|
|
|
1905
1905
|
return { code: d, stage: d === "E_FETCH" ? "source" : d === "E_PARSE_HEADER" ? "header" : d === "E_WORKER" ? "worker" : d === "E_PARSE_GEOMETRY" ? "geometry" : d === "E_SIDECAR_FETCH" ? "sidecar" : d === "E_ANNOTATION" ? "annotation" : d === "E_FONT" ? "font" : d === "E_ABORTED" || d === "E_SUPERSEDED" ? "lifecycle" : "source", fatal: e, source: t };
|
|
1906
1906
|
}
|
|
1907
1907
|
const Ge = 1;
|
|
1908
|
-
class
|
|
1908
|
+
class Nr {
|
|
1909
1909
|
constructor(e) {
|
|
1910
1910
|
u(this, "startX", 0);
|
|
1911
1911
|
u(this, "startY", 0);
|
|
@@ -1956,7 +1956,7 @@ class zr {
|
|
|
1956
1956
|
function Ce(s, e) {
|
|
1957
1957
|
return `${s}:${e}`;
|
|
1958
1958
|
}
|
|
1959
|
-
class
|
|
1959
|
+
class Fr {
|
|
1960
1960
|
constructor() {
|
|
1961
1961
|
u(this, "expandedLayers", /* @__PURE__ */ new Set());
|
|
1962
1962
|
u(this, "expandedBlocks", /* @__PURE__ */ new Set());
|
|
@@ -2000,7 +2000,7 @@ class Nr {
|
|
|
2000
2000
|
this.revealedSelectionKey = null, this.suppressedSelectionKey = null;
|
|
2001
2001
|
}
|
|
2002
2002
|
}
|
|
2003
|
-
function
|
|
2003
|
+
function R(s) {
|
|
2004
2004
|
return s.replace(/[&<>"']/g, (e) => ({
|
|
2005
2005
|
"&": "&",
|
|
2006
2006
|
"<": "<",
|
|
@@ -2009,7 +2009,7 @@ function M(s) {
|
|
|
2009
2009
|
"'": "'"
|
|
2010
2010
|
})[e] ?? e);
|
|
2011
2011
|
}
|
|
2012
|
-
const
|
|
2012
|
+
const Vr = {
|
|
2013
2013
|
"panel.layers": "图层",
|
|
2014
2014
|
"panel.properties": "属性",
|
|
2015
2015
|
"panel.layers.aria": "图层面板",
|
|
@@ -2088,7 +2088,7 @@ const Fr = {
|
|
|
2088
2088
|
"status.parsing": "解析中…",
|
|
2089
2089
|
"status.incrementalLoading": "增量渲染中…",
|
|
2090
2090
|
"unit.mm": "mm"
|
|
2091
|
-
},
|
|
2091
|
+
}, $r = {
|
|
2092
2092
|
"panel.layers": "Layers",
|
|
2093
2093
|
"panel.properties": "Properties",
|
|
2094
2094
|
"panel.layers.aria": "Layers panel",
|
|
@@ -2168,7 +2168,7 @@ const Fr = {
|
|
|
2168
2168
|
"status.incrementalLoading": "Rendering incrementally…",
|
|
2169
2169
|
"unit.mm": "mm"
|
|
2170
2170
|
};
|
|
2171
|
-
function
|
|
2171
|
+
function _r(s, e) {
|
|
2172
2172
|
return e ? s.replace(/\{([a-zA-Z0-9_]+)\}/g, (t, i) => {
|
|
2173
2173
|
const r = e[i];
|
|
2174
2174
|
return r === void 0 ? t : String(r);
|
|
@@ -2181,7 +2181,7 @@ function Br(s) {
|
|
|
2181
2181
|
return new Intl.NumberFormat("zh-CN", { maximumFractionDigits: 4, useGrouping: !1 });
|
|
2182
2182
|
}
|
|
2183
2183
|
}
|
|
2184
|
-
function
|
|
2184
|
+
function Ur(s) {
|
|
2185
2185
|
try {
|
|
2186
2186
|
return new Intl.NumberFormat(s, { maximumFractionDigits: 0 });
|
|
2187
2187
|
} catch {
|
|
@@ -2190,7 +2190,7 @@ function _r(s) {
|
|
|
2190
2190
|
}
|
|
2191
2191
|
function Tt(s) {
|
|
2192
2192
|
var a;
|
|
2193
|
-
const e = ((a = s.locale) == null ? void 0 : a.trim()) || "zh-CN", t = e.toLowerCase().startsWith("en") ?
|
|
2193
|
+
const e = ((a = s.locale) == null ? void 0 : a.trim()) || "zh-CN", t = e.toLowerCase().startsWith("en") ? $r : Vr, i = Br(e), r = Ur(e), n = {
|
|
2194
2194
|
locale: e,
|
|
2195
2195
|
t(o, l) {
|
|
2196
2196
|
var p;
|
|
@@ -2202,7 +2202,7 @@ function Tt(s) {
|
|
|
2202
2202
|
d = void 0;
|
|
2203
2203
|
}
|
|
2204
2204
|
const c = d ?? ((p = s.messages) == null ? void 0 : p[o]) ?? t[o] ?? o;
|
|
2205
|
-
return
|
|
2205
|
+
return _r(c, l);
|
|
2206
2206
|
},
|
|
2207
2207
|
formatNumber(o) {
|
|
2208
2208
|
return o == null || !Number.isFinite(o) ? "—" : i.format(o);
|
|
@@ -2231,17 +2231,17 @@ function Tt(s) {
|
|
|
2231
2231
|
};
|
|
2232
2232
|
return n;
|
|
2233
2233
|
}
|
|
2234
|
-
const
|
|
2234
|
+
const jr = {
|
|
2235
2235
|
"加载中…": "status.loading",
|
|
2236
2236
|
"解析中…": "status.parsing",
|
|
2237
2237
|
"增量渲染中…": "status.incrementalLoading"
|
|
2238
2238
|
};
|
|
2239
|
-
function
|
|
2240
|
-
const t = s.trim(), i =
|
|
2239
|
+
function Hr(s, e) {
|
|
2240
|
+
const t = s.trim(), i = jr[t];
|
|
2241
2241
|
return i ? e.t(i) : t;
|
|
2242
2242
|
}
|
|
2243
|
-
const
|
|
2244
|
-
function
|
|
2243
|
+
const Me = Tt({});
|
|
2244
|
+
function qr(s) {
|
|
2245
2245
|
const e = /* @__PURE__ */ new Map();
|
|
2246
2246
|
for (const i of s.usages) {
|
|
2247
2247
|
const r = e.get(i.layerIndex) ?? /* @__PURE__ */ new Map(), n = Ce(i.layerIndex, i.variantId);
|
|
@@ -2266,7 +2266,7 @@ function Hr(s) {
|
|
|
2266
2266
|
t.set(i, [...r.values()]);
|
|
2267
2267
|
return t;
|
|
2268
2268
|
}
|
|
2269
|
-
function
|
|
2269
|
+
function Yr(s, e) {
|
|
2270
2270
|
return s ? e.toLowerCase().includes(s) : !0;
|
|
2271
2271
|
}
|
|
2272
2272
|
function ce(s, e, t) {
|
|
@@ -2275,7 +2275,7 @@ function ce(s, e, t) {
|
|
|
2275
2275
|
function le(s, e, t) {
|
|
2276
2276
|
s.classList.toggle("off", e === "none"), s.classList.toggle("mixed", e === "mixed"), s.textContent = e === "all" ? "●" : e === "none" ? "○" : "◐", s.title = e === "all" ? t.t("layer.hideBlock") : e === "none" ? t.t("layer.showBlockRestore") : t.t("layer.hideBlockKeep");
|
|
2277
2277
|
}
|
|
2278
|
-
function
|
|
2278
|
+
function Xr(s) {
|
|
2279
2279
|
let e = 0;
|
|
2280
2280
|
for (const t of s) t.visible && (e += 1);
|
|
2281
2281
|
return e <= 0 ? "none" : e >= s.length ? "all" : "mixed";
|
|
@@ -2312,7 +2312,7 @@ function Ot(s, e, t = 0) {
|
|
|
2312
2312
|
};
|
|
2313
2313
|
i(), typeof requestAnimationFrame == "function" && requestAnimationFrame(i);
|
|
2314
2314
|
}
|
|
2315
|
-
function
|
|
2315
|
+
function Wr(s, e) {
|
|
2316
2316
|
const t = e.trim().toLowerCase();
|
|
2317
2317
|
s.querySelectorAll(".vui-lrow-wrap").forEach((i) => {
|
|
2318
2318
|
var o, l;
|
|
@@ -2322,7 +2322,7 @@ function Xr(s, e) {
|
|
|
2322
2322
|
i.style.display = a ? "" : "none";
|
|
2323
2323
|
});
|
|
2324
2324
|
}
|
|
2325
|
-
function
|
|
2325
|
+
function Gr(s, e) {
|
|
2326
2326
|
if (s.querySelectorAll(".vui-lrow-block.active, .vui-lrow-insert.active").forEach((o) => {
|
|
2327
2327
|
o.classList.remove("active");
|
|
2328
2328
|
}), !e) return;
|
|
@@ -2335,7 +2335,7 @@ function Wr(s, e) {
|
|
|
2335
2335
|
);
|
|
2336
2336
|
a && a.classList.add("active");
|
|
2337
2337
|
}
|
|
2338
|
-
function
|
|
2338
|
+
function Kr(s, e, t, i = Me) {
|
|
2339
2339
|
var l;
|
|
2340
2340
|
const r = new Map(e.map((d) => [d.index, d]));
|
|
2341
2341
|
s.querySelectorAll(".vui-lrow[data-layer-index]:not(.vui-lrow-all)").forEach((d) => {
|
|
@@ -2349,13 +2349,13 @@ function Gr(s, e, t, i = Re) {
|
|
|
2349
2349
|
const o = n == null ? void 0 : n.querySelector('input[type="color"]');
|
|
2350
2350
|
o && o.value !== a && (o.value = a);
|
|
2351
2351
|
}
|
|
2352
|
-
function
|
|
2352
|
+
function Zr(s, e, t) {
|
|
2353
2353
|
var v;
|
|
2354
|
-
const i = t.text ??
|
|
2354
|
+
const i = t.text ?? Me;
|
|
2355
2355
|
e.resetForScope(t.scopeKey);
|
|
2356
|
-
const r = e.filterText.trim().toLowerCase(), n = t.layers.rows, a =
|
|
2356
|
+
const r = e.filterText.trim().toLowerCase(), n = t.layers.rows, a = qr(t.blocks);
|
|
2357
2357
|
if (s.list.replaceChildren(), s.count.textContent = String(n.length), n.length === 0) {
|
|
2358
|
-
s.list.appendChild(
|
|
2358
|
+
s.list.appendChild(Qr(i.t("layer.empty")));
|
|
2359
2359
|
return;
|
|
2360
2360
|
}
|
|
2361
2361
|
const o = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set();
|
|
@@ -2371,8 +2371,8 @@ function Kr(s, e, t) {
|
|
|
2371
2371
|
<span class="vui-lrow-eye">◎</span>
|
|
2372
2372
|
<span class="vui-lrow-dot"></span>
|
|
2373
2373
|
<span class="vui-lrow-toggle placeholder">▶</span>
|
|
2374
|
-
<span class="vui-lrow-name">${
|
|
2375
|
-
<span class="vui-lrow-clr" style="background: ${t.layers.allColor == null ? "#c8c8c8" : `#${t.layers.allColor.toString(16).padStart(6, "0")}`}" title="${
|
|
2374
|
+
<span class="vui-lrow-name">${R(i.t("layer.all"))}</span>
|
|
2375
|
+
<span class="vui-lrow-clr" style="background: ${t.layers.allColor == null ? "#c8c8c8" : `#${t.layers.allColor.toString(16).padStart(6, "0")}`}" title="${R(i.t("layer.colorOverrideAll"))}">
|
|
2376
2376
|
<input type="color" value="#${(t.layers.allColor ?? 13158600).toString(16).padStart(6, "0")}">
|
|
2377
2377
|
</span>`;
|
|
2378
2378
|
const h = p.querySelector('input[type="color"]');
|
|
@@ -2397,7 +2397,7 @@ function Kr(s, e, t) {
|
|
|
2397
2397
|
(m = h == null ? void 0 : h.closest(".vui-lrow-clr")) == null || m.style.setProperty("background", "#c8c8c8"), h && (h.value = "#c8c8c8"), Ze(s.list, n, null);
|
|
2398
2398
|
}), s.list.appendChild(p);
|
|
2399
2399
|
for (const y of n)
|
|
2400
|
-
|
|
2400
|
+
Yr(r, y.name) && s.list.appendChild(Jr(y, e, t, a.get(y.index) ?? [], i));
|
|
2401
2401
|
c && e.needsSelectionReveal(c) && (Ke(s.list) && e.markSelectionRevealed(c), typeof requestAnimationFrame == "function" && requestAnimationFrame(() => {
|
|
2402
2402
|
e.needsSelectionReveal(c) && Ke(s.list) && e.markSelectionRevealed(c);
|
|
2403
2403
|
}));
|
|
@@ -2406,7 +2406,7 @@ function X(s) {
|
|
|
2406
2406
|
return `#${s.toString(16).padStart(6, "0")}`;
|
|
2407
2407
|
}
|
|
2408
2408
|
function Le(s) {
|
|
2409
|
-
return s.color !== null ? X(s.color) : X(
|
|
2409
|
+
return s.color !== null ? X(s.color) : X(Mt(s.sourceColor));
|
|
2410
2410
|
}
|
|
2411
2411
|
function zt(s, e) {
|
|
2412
2412
|
var r;
|
|
@@ -2423,7 +2423,7 @@ function Ze(s, e, t) {
|
|
|
2423
2423
|
n && zt(r, t === null ? Le(n) : X(t));
|
|
2424
2424
|
});
|
|
2425
2425
|
}
|
|
2426
|
-
function
|
|
2426
|
+
function Jr(s, e, t, i, r) {
|
|
2427
2427
|
const n = i.length > 0, a = e.expandedLayers.has(s.index), o = Le(s), l = document.createElement("div");
|
|
2428
2428
|
l.className = "vui-lrow-wrap";
|
|
2429
2429
|
const d = document.createElement("div");
|
|
@@ -2476,7 +2476,7 @@ function Zr(s, e, t, i, r) {
|
|
|
2476
2476
|
}
|
|
2477
2477
|
}), m.addEventListener("click", (b) => b.stopPropagation()), y.addEventListener("contextmenu", (b) => {
|
|
2478
2478
|
b.preventDefault(), b.stopPropagation(), t.setLayerColor(s.index, null);
|
|
2479
|
-
const g = X(
|
|
2479
|
+
const g = X(Mt(s.sourceColor));
|
|
2480
2480
|
m.value = g, p.style.background = g, y.style.background = g;
|
|
2481
2481
|
}), y.appendChild(m), d.append(c, p, h, v, y), d.addEventListener("click", (b) => {
|
|
2482
2482
|
const g = b.target;
|
|
@@ -2495,7 +2495,7 @@ function Zr(s, e, t, i, r) {
|
|
|
2495
2495
|
function Je(s, e, t, i) {
|
|
2496
2496
|
const r = document.createElement("div");
|
|
2497
2497
|
r.className = "vui-lrow-block-wrap";
|
|
2498
|
-
const n = e.expandedBlocks.has(s.key), a =
|
|
2498
|
+
const n = e.expandedBlocks.has(s.key), a = Xr(s.inserts), o = Dt(t.selection, s.layerIndex, s.variantId), l = document.createElement("div");
|
|
2499
2499
|
l.className = `vui-lrow-block${o ? " active" : ""}${s.canHighlight ? "" : " disabled"}`, l.dataset.variantId = String(s.variantId), l.dataset.layerIndex = String(s.layerIndex), s.canHighlight || (l.title = i.t("layer.noHighlightBlock"));
|
|
2500
2500
|
const d = document.createElement("button");
|
|
2501
2501
|
d.type = "button", d.className = "vui-lrow-block-visibility", le(d, a, i), d.addEventListener("click", (v) => {
|
|
@@ -2578,49 +2578,49 @@ function Qe(s, e, t, i, r) {
|
|
|
2578
2578
|
}
|
|
2579
2579
|
return n;
|
|
2580
2580
|
}
|
|
2581
|
-
function
|
|
2581
|
+
function Qr(s) {
|
|
2582
2582
|
const e = document.createElement("div");
|
|
2583
2583
|
return e.className = "vui-empty-note", e.textContent = s, e;
|
|
2584
2584
|
}
|
|
2585
|
-
function
|
|
2585
|
+
function es(s, e) {
|
|
2586
2586
|
const t = () => {
|
|
2587
2587
|
e(s.value);
|
|
2588
2588
|
};
|
|
2589
2589
|
return s.addEventListener("input", t), () => s.removeEventListener("input", t);
|
|
2590
2590
|
}
|
|
2591
|
-
function et(s, e, t =
|
|
2591
|
+
function et(s, e, t = Me, i = "mm") {
|
|
2592
2592
|
if (s.body.replaceChildren(), e.textSelection && e.textDetails) {
|
|
2593
|
-
H(s, !1),
|
|
2593
|
+
H(s, !1), is(s.body, e.textDetails, t, i), tt(s.body);
|
|
2594
2594
|
return;
|
|
2595
2595
|
}
|
|
2596
2596
|
if (!e.selection || !e.details) {
|
|
2597
|
-
H(s, !1), s.body.appendChild(
|
|
2597
|
+
H(s, !1), s.body.appendChild(rs(t.t("property.empty")));
|
|
2598
2598
|
return;
|
|
2599
2599
|
}
|
|
2600
|
-
|
|
2600
|
+
ts(s.body, e.details, t, i), tt(s.body);
|
|
2601
2601
|
}
|
|
2602
2602
|
function H(s, e) {
|
|
2603
2603
|
if (!s.previewWrap || !s.previewCanvas || (s.previewWrap.hidden = !e, e)) return;
|
|
2604
2604
|
const t = s.previewCanvas.getContext("2d");
|
|
2605
2605
|
t == null || t.clearRect(0, 0, s.previewCanvas.width, s.previewCanvas.height);
|
|
2606
2606
|
}
|
|
2607
|
-
function
|
|
2608
|
-
Nt(s, t.t("property.insert"), e.blockName),
|
|
2607
|
+
function ts(s, e, t, i) {
|
|
2608
|
+
Nt(s, t.t("property.insert"), e.blockName), Ee(s, t.t("property.basic"), (r) => {
|
|
2609
2609
|
I(r, t.t("property.block"), e.blockName), I(r, t.t("property.layer"), e.layerName), I(r, t.t("property.instance"), `#${e.id.instanceId}`), I(r, t.t("property.currentShape"), t.t("property.normalShape"));
|
|
2610
|
-
}),
|
|
2610
|
+
}), Ee(s, t.t("property.transform"), (r) => {
|
|
2611
2611
|
I(r, "X", t.formatUnit(e.tx, i)), I(r, "Y", t.formatUnit(e.ty, i)), I(r, t.t("property.rotation"), t.formatUnit(e.rotation, "°")), I(r, "Sx", t.formatNumber(e.scaleX)), I(r, "Sy", t.formatNumber(e.scaleY));
|
|
2612
2612
|
});
|
|
2613
2613
|
}
|
|
2614
|
-
function
|
|
2615
|
-
Nt(s, t.t("property.text"), e.content),
|
|
2614
|
+
function is(s, e, t, i) {
|
|
2615
|
+
Nt(s, t.t("property.text"), e.content), Ee(s, t.t("property.basic"), (r) => {
|
|
2616
2616
|
I(r, t.t("property.layer"), e.layerName), I(r, t.t("property.content"), e.content), I(r, t.t("property.height"), t.formatUnit(e.height, i)), I(r, "X", t.formatUnit(e.x, i)), I(r, "Y", t.formatUnit(e.y, i)), I(r, t.t("property.rotation"), t.formatUnit(e.rotation, "°"));
|
|
2617
2617
|
});
|
|
2618
2618
|
}
|
|
2619
2619
|
function Nt(s, e, t) {
|
|
2620
2620
|
const i = document.createElement("div");
|
|
2621
|
-
i.className = "vui-pp-section vui-pp-title-row", i.innerHTML = `<strong>${
|
|
2621
|
+
i.className = "vui-pp-section vui-pp-title-row", i.innerHTML = `<strong>${R(e)}</strong><span>·</span><span>${R(t)}</span>`, s.appendChild(i);
|
|
2622
2622
|
}
|
|
2623
|
-
function
|
|
2623
|
+
function Ee(s, e, t) {
|
|
2624
2624
|
const i = document.createElement("section");
|
|
2625
2625
|
i.className = "vui-pp-section";
|
|
2626
2626
|
const r = document.createElement("div");
|
|
@@ -2628,9 +2628,9 @@ function Se(s, e, t) {
|
|
|
2628
2628
|
}
|
|
2629
2629
|
function I(s, e, t) {
|
|
2630
2630
|
const i = document.createElement("div");
|
|
2631
|
-
i.className = "vui-pp-row", i.innerHTML = `<span class="label">${
|
|
2631
|
+
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);
|
|
2632
2632
|
}
|
|
2633
|
-
function
|
|
2633
|
+
function rs(s) {
|
|
2634
2634
|
const e = document.createElement("div");
|
|
2635
2635
|
return e.className = "vui-empty-note", e.textContent = s, e;
|
|
2636
2636
|
}
|
|
@@ -2642,17 +2642,17 @@ function tt(s) {
|
|
|
2642
2642
|
if (s.querySelector("textarea"))
|
|
2643
2643
|
throw new Error("Property panel must not contain textarea elements");
|
|
2644
2644
|
}
|
|
2645
|
-
const
|
|
2645
|
+
const ss = typeof requestAnimationFrame == "function" ? requestAnimationFrame.bind(globalThis) : (s) => globalThis.setTimeout(() => s(performance.now()), 16), ns = typeof cancelAnimationFrame == "function" ? cancelAnimationFrame.bind(globalThis) : (s) => {
|
|
2646
2646
|
globalThis.clearTimeout(s);
|
|
2647
2647
|
};
|
|
2648
|
-
class
|
|
2648
|
+
class as {
|
|
2649
2649
|
constructor(e) {
|
|
2650
2650
|
u(this, "onFlush");
|
|
2651
2651
|
u(this, "requestFrame");
|
|
2652
2652
|
u(this, "cancelFrame");
|
|
2653
2653
|
u(this, "pending", /* @__PURE__ */ new Map());
|
|
2654
2654
|
u(this, "scheduledHandle", null);
|
|
2655
|
-
this.onFlush = e.onFlush, this.requestFrame = e.requestFrame ??
|
|
2655
|
+
this.onFlush = e.onFlush, this.requestFrame = e.requestFrame ?? ss, this.cancelFrame = e.cancelFrame ?? ns;
|
|
2656
2656
|
}
|
|
2657
2657
|
enqueue(e, t) {
|
|
2658
2658
|
this.pending.set(e, t), this.scheduledHandle === null && (this.scheduledHandle = this.requestFrame(() => {
|
|
@@ -2676,7 +2676,7 @@ class ns {
|
|
|
2676
2676
|
this.pending.clear(), this.scheduledHandle !== null && (this.cancelFrame(this.scheduledHandle), this.scheduledHandle = null);
|
|
2677
2677
|
}
|
|
2678
2678
|
}
|
|
2679
|
-
const
|
|
2679
|
+
const os = `
|
|
2680
2680
|
:host {
|
|
2681
2681
|
display: block;
|
|
2682
2682
|
width: 100%;
|
|
@@ -3546,7 +3546,7 @@ button, input { font: inherit; }
|
|
|
3546
3546
|
.vui-infobar-content { max-width: calc(100vw - 48px); }
|
|
3547
3547
|
.vui-infobar-tools .vui-info-text { max-width: min(180px, 45vw); }
|
|
3548
3548
|
}
|
|
3549
|
-
`,
|
|
3549
|
+
`, ls = {
|
|
3550
3550
|
dark: `
|
|
3551
3551
|
:host, .vui-root[data-theme="dark"] {
|
|
3552
3552
|
--vui-bg: #0A0B0F;
|
|
@@ -3667,13 +3667,13 @@ function fe(s = "dark", e = {}) {
|
|
|
3667
3667
|
hudBackground: "--vui-hud-bg"
|
|
3668
3668
|
}, i = Object.entries(e).filter(([, r]) => typeof r == "string" && r.trim().length > 0).map(([r, n]) => `${t[r]}: ${n};`).join(`
|
|
3669
3669
|
`);
|
|
3670
|
-
return `${
|
|
3670
|
+
return `${ls[s]}${i ? `
|
|
3671
3671
|
:host, .vui-root[data-theme="${s}"] {
|
|
3672
3672
|
${i}
|
|
3673
3673
|
}
|
|
3674
|
-
` : ""}${
|
|
3674
|
+
` : ""}${os}`;
|
|
3675
3675
|
}
|
|
3676
|
-
const
|
|
3676
|
+
const ds = {
|
|
3677
3677
|
layerPanel: !0,
|
|
3678
3678
|
propertyPanel: !0,
|
|
3679
3679
|
hud: !0,
|
|
@@ -3683,9 +3683,9 @@ const ls = {
|
|
|
3683
3683
|
infobarLineMode: !0,
|
|
3684
3684
|
infobarPhase: !0,
|
|
3685
3685
|
infobarDebug: !0
|
|
3686
|
-
}, it = "property-panel:open", rt = "layer-panel:open", st = 300, nt = 180,
|
|
3687
|
-
let
|
|
3688
|
-
function
|
|
3686
|
+
}, it = "property-panel:open", rt = "layer-panel:open", st = 300, nt = 180, cs = 2;
|
|
3687
|
+
let us = 0;
|
|
3688
|
+
function B(s, ...e) {
|
|
3689
3689
|
const t = document.createElement("div");
|
|
3690
3690
|
t.className = "vui-debug-row";
|
|
3691
3691
|
const i = document.createElement("span");
|
|
@@ -3709,7 +3709,7 @@ function ot(s) {
|
|
|
3709
3709
|
const e = document.createElement("div");
|
|
3710
3710
|
return e.className = "vui-debug-spread-list", e.append(...s), e;
|
|
3711
3711
|
}
|
|
3712
|
-
function
|
|
3712
|
+
function hs(s, e) {
|
|
3713
3713
|
switch (s) {
|
|
3714
3714
|
case "created":
|
|
3715
3715
|
return e.t("status.created");
|
|
@@ -3737,11 +3737,11 @@ function lt(s) {
|
|
|
3737
3737
|
return n === "" || n === "true" || n === "plaintext-only";
|
|
3738
3738
|
});
|
|
3739
3739
|
}
|
|
3740
|
-
class
|
|
3740
|
+
class ps {
|
|
3741
3741
|
constructor(e, t) {
|
|
3742
3742
|
u(this, "parts");
|
|
3743
3743
|
u(this, "text");
|
|
3744
|
-
u(this, "layerPanelState", new
|
|
3744
|
+
u(this, "layerPanelState", new Fr());
|
|
3745
3745
|
u(this, "shadow", null);
|
|
3746
3746
|
u(this, "layerPanelRefs", null);
|
|
3747
3747
|
u(this, "propertyPanelRefs", null);
|
|
@@ -3785,7 +3785,7 @@ class hs {
|
|
|
3785
3785
|
u(this, "filterCleanup", null);
|
|
3786
3786
|
u(this, "disposed", !1);
|
|
3787
3787
|
u(this, "persistenceNamespace");
|
|
3788
|
-
u(this, "insertToggleScheduler", new
|
|
3788
|
+
u(this, "insertToggleScheduler", new as({
|
|
3789
3789
|
onFlush: (e) => {
|
|
3790
3790
|
this.host.cad.blocks.batchToggleInserts(e);
|
|
3791
3791
|
}
|
|
@@ -3798,7 +3798,7 @@ class hs {
|
|
|
3798
3798
|
if (!(this.disposed || !this.active)) {
|
|
3799
3799
|
if (this.infobarRefs && this.parts.hud) {
|
|
3800
3800
|
const t = this.host.cad.hud;
|
|
3801
|
-
this.infobarRefs.file.textContent = t.filename ?? "", this.infobarRefs.file.title = t.filename ?? "", this.infobarRefs.file.hidden = !t.filename, this.infobarRefs.zoom.textContent = t.zoomLabel ? this.text.t("toolbar.zoom", { value: t.zoomLabel }) : "", this.infobarRefs.zoom.hidden = !t.zoomLabel, this.infobarRefs.vertices.textContent = t.viewportVertexCount > 0 ? this.text.t("toolbar.vertices", { value: this.text.formatInteger(t.viewportVertexCount) }) : "", this.infobarRefs.vertices.hidden = t.viewportVertexCount <= 0, this.infobarRefs.drawCalls.textContent = t.drawCalls > 0 ? this.text.t("toolbar.drawCalls", { value: this.text.formatInteger(t.drawCalls) }) : "", this.infobarRefs.drawCalls.hidden = t.drawCalls <= 0, this.infobarRefs.lineMode.textContent = this.parts.infobarLineMode && t.lineRenderMode ? this.text.t("toolbar.lineMode", { value: t.lineRenderMode.toUpperCase() }) : "", this.infobarRefs.lineMode.hidden = !this.infobarRefs.lineMode.textContent, this.infobarRefs.phase.textContent = this.parts.infobarPhase ?
|
|
3801
|
+
this.infobarRefs.file.textContent = t.filename ?? "", this.infobarRefs.file.title = t.filename ?? "", this.infobarRefs.file.hidden = !t.filename, this.infobarRefs.zoom.textContent = t.zoomLabel ? this.text.t("toolbar.zoom", { value: t.zoomLabel }) : "", this.infobarRefs.zoom.hidden = !t.zoomLabel, this.infobarRefs.vertices.textContent = t.viewportVertexCount > 0 ? this.text.t("toolbar.vertices", { value: this.text.formatInteger(t.viewportVertexCount) }) : "", this.infobarRefs.vertices.hidden = t.viewportVertexCount <= 0, this.infobarRefs.drawCalls.textContent = t.drawCalls > 0 ? this.text.t("toolbar.drawCalls", { value: this.text.formatInteger(t.drawCalls) }) : "", this.infobarRefs.drawCalls.hidden = t.drawCalls <= 0, this.infobarRefs.lineMode.textContent = this.parts.infobarLineMode && t.lineRenderMode ? this.text.t("toolbar.lineMode", { value: t.lineRenderMode.toUpperCase() }) : "", this.infobarRefs.lineMode.hidden = !this.infobarRefs.lineMode.textContent, this.infobarRefs.phase.textContent = this.parts.infobarPhase ? hs(t.phase, this.text) : "", this.infobarRefs.phase.hidden = !this.infobarRefs.phase.textContent;
|
|
3802
3802
|
const i = Math.round(t.fps);
|
|
3803
3803
|
this.infobarRefs.fps.textContent = i > 0 ? this.text.t("toolbar.fps", { value: i }) : this.text.t("toolbar.fpsEmpty"), this.infobarRefs.fps.classList.toggle("hi", i >= 55), this.infobarRefs.fps.classList.toggle("mid", i >= 30 && i < 55), this.infobarRefs.fps.classList.toggle("low", i < 30);
|
|
3804
3804
|
const r = t.blockVariantCount > 0 || t.splitBlockLayerGroupCount > 0 || t.entityCount > 0;
|
|
@@ -3840,18 +3840,18 @@ class hs {
|
|
|
3840
3840
|
count: this.text.formatInteger(t.splitBlockLayerGroupCount)
|
|
3841
3841
|
})];
|
|
3842
3842
|
o.length > 0 && l.push(ot(o)), this.infobarRefs.debugBody.replaceChildren(
|
|
3843
|
-
|
|
3844
|
-
...t.lineRenderMode ? [
|
|
3845
|
-
|
|
3843
|
+
B("" + this.text.t("toolbar.debug.submitted"), this.text.formatInteger(t.submittedVertexRefs)),
|
|
3844
|
+
...t.lineRenderMode ? [B(this.text.t("toolbar.debug.lineMode"), t.lineRenderMode.toUpperCase())] : [],
|
|
3845
|
+
B(this.text.t("toolbar.debug.layers"), this.text.t("toolbar.debug.layerCount", {
|
|
3846
3846
|
visible: this.text.formatInteger(t.visibleLayerCount),
|
|
3847
3847
|
total: this.text.formatInteger(t.totalLayerCount)
|
|
3848
3848
|
})),
|
|
3849
|
-
|
|
3850
|
-
|
|
3849
|
+
B(this.text.t("toolbar.debug.drawCallSource"), ...a),
|
|
3850
|
+
B(this.text.t("toolbar.debug.block"), this.text.t("toolbar.debug.blockCount", {
|
|
3851
3851
|
variants: this.text.formatInteger(t.blockVariantCount),
|
|
3852
3852
|
instances: this.text.formatInteger(t.blockInstanceCount)
|
|
3853
3853
|
})),
|
|
3854
|
-
|
|
3854
|
+
B(this.text.t("toolbar.debug.splitLayer"), ...l)
|
|
3855
3855
|
);
|
|
3856
3856
|
}
|
|
3857
3857
|
}
|
|
@@ -3859,7 +3859,7 @@ class hs {
|
|
|
3859
3859
|
const t = this.host.cad.hud, i = t.fileCount > 0 ? this.text.t("toolbar.layerSummary", {
|
|
3860
3860
|
visible: this.text.formatInteger(t.visibleLayerCount),
|
|
3861
3861
|
total: this.text.formatInteger(t.totalLayerCount)
|
|
3862
|
-
}) : "", r =
|
|
3862
|
+
}) : "", r = Hr(t.statusMessage, this.text);
|
|
3863
3863
|
this.toolbarInfoText.textContent = i && r ? `${i} | ${r}` : i || r;
|
|
3864
3864
|
}
|
|
3865
3865
|
this.scalebarRefs && (this.host.viewMode === "2d" && ((e = this.host.cad.hud.scaleRuler) != null && e.visible) ? (this.scalebarRefs.scaleBar.hidden = !1, this.scalebarRefs.scaleLabel.textContent = this.text.formatScaleLabel(
|
|
@@ -3870,7 +3870,7 @@ class hs {
|
|
|
3870
3870
|
}
|
|
3871
3871
|
});
|
|
3872
3872
|
var i, r, n, a;
|
|
3873
|
-
this.host = e, this.options = t, this.parts = { ...
|
|
3873
|
+
this.host = e, this.options = t, this.parts = { ...ds, ...(i = t.cad) == null ? void 0 : i.parts }, this.themeValue = t.theme ?? "dark", this.text = Tt({ ...t, unitFormatter: (r = t.cad) == null ? void 0 : r.unitFormatter }), this.persistenceNamespace = ((a = (n = t.cad) == null ? void 0 : n.persistenceKey) == null ? void 0 : a.trim()) || t.root.id.trim() || `instance-${++us}`;
|
|
3874
3874
|
}
|
|
3875
3875
|
mount() {
|
|
3876
3876
|
var o, l;
|
|
@@ -3956,7 +3956,7 @@ class hs {
|
|
|
3956
3956
|
const i = document.createElement("div");
|
|
3957
3957
|
i.className = "vui-section";
|
|
3958
3958
|
const r = document.createElement("div");
|
|
3959
|
-
r.className = "vui-section-head", r.innerHTML = `<span class="vui-section-title">${
|
|
3959
|
+
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>`;
|
|
3960
3960
|
const n = document.createElement("div");
|
|
3961
3961
|
n.className = "vui-section-filter-wrap";
|
|
3962
3962
|
const a = document.createElement("input");
|
|
@@ -4007,7 +4007,7 @@ class hs {
|
|
|
4007
4007
|
if (a.className = "vui-info-text", this.toolbarInfoText = a, n.appendChild(a), this.parts.fit) {
|
|
4008
4008
|
this.btnFit = document.createElement("button"), this.btnFit.type = "button", this.btnFit.className = "vui-btn";
|
|
4009
4009
|
const m = this.getFitShortcut();
|
|
4010
|
-
this.btnFit.innerHTML = m ? `${
|
|
4010
|
+
this.btnFit.innerHTML = m ? `${R(this.text.t("toolbar.fit"))} <span class="vui-kbd">${R(m.toUpperCase())}</span>` : R(this.text.t("toolbar.fit")), this.btnFit.addEventListener("click", () => this.host.fitSelectionOrDocument()), n.appendChild(this.btnFit);
|
|
4011
4011
|
}
|
|
4012
4012
|
if (this.parts.viewMode) {
|
|
4013
4013
|
const m = document.createElement("div");
|
|
@@ -4051,7 +4051,7 @@ class hs {
|
|
|
4051
4051
|
const t = document.createElement("div");
|
|
4052
4052
|
t.className = "vui-property-panel", t.dataset.part = "property-panel";
|
|
4053
4053
|
const i = document.createElement("div");
|
|
4054
|
-
i.className = "vui-pp-head", i.innerHTML = `<span class="vui-pp-title-text">${
|
|
4054
|
+
i.className = "vui-pp-head", i.innerHTML = `<span class="vui-pp-title-text">${R(this.text.t("panel.properties"))}</span>`;
|
|
4055
4055
|
const r = document.createElement("div");
|
|
4056
4056
|
r.className = "vui-pp-preview-wrap", r.hidden = !0;
|
|
4057
4057
|
const n = document.createElement("canvas");
|
|
@@ -4064,8 +4064,8 @@ class hs {
|
|
|
4064
4064
|
return l.type = "button", l.className = "vui-property-panel-toggle", l.addEventListener("click", () => this.setPropertyPanelOpen(e.classList.contains("closed"))), o.appendChild(l), e.append(o, t), this.propertyPanelShell = e, this.propertyPanelToggle = l, this.propertyPanelRefs = { body: a, previewWrap: r, previewCanvas: n }, e;
|
|
4065
4065
|
}
|
|
4066
4066
|
bindEvents() {
|
|
4067
|
-
this.layerPanelRefs && (this.filterCleanup =
|
|
4068
|
-
this.layerPanelState.filterText = e, this.layerPanelRefs &&
|
|
4067
|
+
this.layerPanelRefs && (this.filterCleanup = es(this.layerPanelRefs.filterInput, (e) => {
|
|
4068
|
+
this.layerPanelState.filterText = e, this.layerPanelRefs && Wr(this.layerPanelRefs.list, e);
|
|
4069
4069
|
})), this.unsubscribers.push(
|
|
4070
4070
|
this.host.cad.on("document-change", () => this.refresh()),
|
|
4071
4071
|
this.host.cad.on("layer-change", () => this.syncLayerChange()),
|
|
@@ -4073,7 +4073,7 @@ class hs {
|
|
|
4073
4073
|
this.host.cad.on("inspector-change", () => {
|
|
4074
4074
|
if (this.layerPanelRefs && this.parts.layerPanel) {
|
|
4075
4075
|
const e = this.host.cad.inspector.selection, t = e == null ? void 0 : e.id, i = t ? `${t.layerIndex}:${t.variantId}:${t.instanceId}` : null;
|
|
4076
|
-
i && this.layerPanelState.needsSelectionReveal(i) ? this.renderLayerPanel() :
|
|
4076
|
+
i && this.layerPanelState.needsSelectionReveal(i) ? this.renderLayerPanel() : Gr(this.layerPanelRefs.list, e);
|
|
4077
4077
|
}
|
|
4078
4078
|
this.propertyPanelRefs && this.parts.propertyPanel && (et(this.propertyPanelRefs, this.host.cad.inspector, this.text, this.getCadUnit()), this.syncPropertyPanelSelectionState(), this.syncPropertyPanelPreview());
|
|
4079
4079
|
}),
|
|
@@ -4134,7 +4134,7 @@ class hs {
|
|
|
4134
4134
|
return !!(e && e.isConnected && ((t = this.layerPanelRefs) != null && t.list.contains(e)));
|
|
4135
4135
|
}
|
|
4136
4136
|
renderLayerPanel() {
|
|
4137
|
-
!this.layerPanelRefs || !this.parts.layerPanel || (
|
|
4137
|
+
!this.layerPanelRefs || !this.parts.layerPanel || (Zr(this.layerPanelRefs, this.layerPanelState, this.createLayerPanelActions()), this.renderedLayerRows = this.host.cad.layers.rows);
|
|
4138
4138
|
}
|
|
4139
4139
|
syncLayerChange() {
|
|
4140
4140
|
if (!this.isLayerColorPreviewActive()) {
|
|
@@ -4142,7 +4142,7 @@ class hs {
|
|
|
4142
4142
|
this.refresh();
|
|
4143
4143
|
return;
|
|
4144
4144
|
}
|
|
4145
|
-
|
|
4145
|
+
Kr(
|
|
4146
4146
|
this.layerPanelRefs.list,
|
|
4147
4147
|
this.host.cad.layers.rows,
|
|
4148
4148
|
this.host.cad.layers.allColor,
|
|
@@ -4322,12 +4322,12 @@ class hs {
|
|
|
4322
4322
|
return;
|
|
4323
4323
|
}
|
|
4324
4324
|
if (b === o) {
|
|
4325
|
-
a += 1, a >=
|
|
4325
|
+
a += 1, a >= cs && h();
|
|
4326
4326
|
return;
|
|
4327
4327
|
}
|
|
4328
4328
|
o = b, a = 0;
|
|
4329
4329
|
}, v = (b) => {
|
|
4330
|
-
if (!
|
|
4330
|
+
if (!fs(b)) return;
|
|
4331
4331
|
let g = !1;
|
|
4332
4332
|
const x = (C) => {
|
|
4333
4333
|
C.target !== b || C.propertyName !== "width" || w();
|
|
@@ -4357,7 +4357,7 @@ class hs {
|
|
|
4357
4357
|
this.propertyPreviewRenderHandle !== null && (cancelAnimationFrame(this.propertyPreviewRenderHandle), this.propertyPreviewRenderHandle = null), (e = this.propertyPreviewLayoutWaitAbort) == null || e.call(this), this.propertyPreviewLayoutWaitAbort = null;
|
|
4358
4358
|
}
|
|
4359
4359
|
}
|
|
4360
|
-
function
|
|
4360
|
+
function fs(s) {
|
|
4361
4361
|
const e = getComputedStyle(s), t = e.transitionDuration.split(",").map((r) => r.trim()), i = e.transitionProperty.split(",").map((r) => r.trim());
|
|
4362
4362
|
for (let r = 0; r < i.length; r += 1) {
|
|
4363
4363
|
const n = i[r] ?? i[0] ?? "all";
|
|
@@ -4366,8 +4366,8 @@ function ps(s) {
|
|
|
4366
4366
|
}
|
|
4367
4367
|
return !1;
|
|
4368
4368
|
}
|
|
4369
|
-
const
|
|
4370
|
-
class
|
|
4369
|
+
const ms = ["left", "right", "top", "bottom"], te = 0.5, vs = /* @__PURE__ */ new Set(["cad", "scene"]);
|
|
4370
|
+
class gs {
|
|
4371
4371
|
constructor(e) {
|
|
4372
4372
|
u(this, "zoneContainers", /* @__PURE__ */ new Map());
|
|
4373
4373
|
u(this, "mounts", /* @__PURE__ */ new Set());
|
|
@@ -4377,7 +4377,7 @@ class vs {
|
|
|
4377
4377
|
u(this, "flags", { layerPanelOpen: !1, propertyPanelOpen: !1 });
|
|
4378
4378
|
u(this, "lastInsets", Object.freeze({ top: 0, right: 0, bottom: 0, left: 0 }));
|
|
4379
4379
|
u(this, "lastFlags", { layerPanelOpen: !1, propertyPanelOpen: !1 });
|
|
4380
|
-
u(this, "activeGroups",
|
|
4380
|
+
u(this, "activeGroups", vs);
|
|
4381
4381
|
u(this, "warnedUnstableReference", !1);
|
|
4382
4382
|
u(this, "disposed", !1);
|
|
4383
4383
|
u(this, "frameHandle", null);
|
|
@@ -4468,7 +4468,7 @@ class vs {
|
|
|
4468
4468
|
installZoneStyles(e, t) {
|
|
4469
4469
|
if (!e || typeof e.querySelector != "function" || typeof e.prepend != "function" || e.querySelector(`style[data-viewer-layout="${t}"]`)) return;
|
|
4470
4470
|
const i = document.createElement("style");
|
|
4471
|
-
i.dataset.viewerLayout = t, i.textContent =
|
|
4471
|
+
i.dataset.viewerLayout = t, i.textContent = xs, e.append(i), this.installedStyles.push(i), z(e) && (e.dataset.viewerLayoutHost = "", typeof getComputedStyle == "function" && getComputedStyle(e).position === "static" && (e.style.position = "relative"));
|
|
4472
4472
|
}
|
|
4473
4473
|
schedule() {
|
|
4474
4474
|
if (!(this.disposed || this.frameHandle !== null)) {
|
|
@@ -4485,7 +4485,7 @@ class vs {
|
|
|
4485
4485
|
if (this.disposed) return;
|
|
4486
4486
|
const e = this.host.reference(), t = this.host.target();
|
|
4487
4487
|
if (!e || typeof e.getBoundingClientRect != "function") return;
|
|
4488
|
-
const i = e.getBoundingClientRect(), r = this.computeInsets(i), n = !
|
|
4488
|
+
const i = e.getBoundingClientRect(), r = this.computeInsets(i), n = !ys(r, this.lastInsets), a = this.flags.layerPanelOpen !== this.lastFlags.layerPanelOpen || this.flags.propertyPanelOpen !== this.lastFlags.propertyPanelOpen;
|
|
4489
4489
|
!n && !a || (this.lastInsets = r, this.lastFlags = { ...this.flags }, n && this.assertStableReference(e, t) && this.applyInsets(t, r), this.host.onChange(r, this.lastFlags));
|
|
4490
4490
|
}
|
|
4491
4491
|
applyInsets(e, t) {
|
|
@@ -4504,9 +4504,9 @@ class vs {
|
|
|
4504
4504
|
}
|
|
4505
4505
|
for (const i of this.zoneContainers.values()) {
|
|
4506
4506
|
const r = i.dataset.viewerZone;
|
|
4507
|
-
if (!(!r || !
|
|
4507
|
+
if (!(!r || !ms.includes(r) || !this.isZoneVisible(i)))
|
|
4508
4508
|
for (const n of Array.from(i.children)) {
|
|
4509
|
-
if (!
|
|
4509
|
+
if (!bs(n)) continue;
|
|
4510
4510
|
const a = n.getBoundingClientRect();
|
|
4511
4511
|
this.accumulateInset(
|
|
4512
4512
|
t,
|
|
@@ -4545,7 +4545,7 @@ function me(s, e, t) {
|
|
|
4545
4545
|
function z(s) {
|
|
4546
4546
|
return !!(s && typeof s == "object" && s.nodeType === 1);
|
|
4547
4547
|
}
|
|
4548
|
-
function
|
|
4548
|
+
function bs(s) {
|
|
4549
4549
|
if (!z(s) || s.hidden) return !1;
|
|
4550
4550
|
const e = typeof getComputedStyle == "function" ? getComputedStyle(s) : null;
|
|
4551
4551
|
return !(e && (e.display === "none" || e.visibility === "hidden"));
|
|
@@ -4555,10 +4555,10 @@ function ie(s, e) {
|
|
|
4555
4555
|
const t = e > 0 ? Math.min(s, e) : s;
|
|
4556
4556
|
return Math.max(0, Math.round(t * 2) / 2);
|
|
4557
4557
|
}
|
|
4558
|
-
function
|
|
4558
|
+
function ys(s, e) {
|
|
4559
4559
|
return Math.abs(s.top - e.top) <= te && Math.abs(s.right - e.right) <= te && Math.abs(s.bottom - e.bottom) <= te && Math.abs(s.left - e.left) <= te;
|
|
4560
4560
|
}
|
|
4561
|
-
const
|
|
4561
|
+
const xs = `
|
|
4562
4562
|
[data-viewer-zone] { position: absolute; pointer-events: none; z-index: 1; }
|
|
4563
4563
|
[data-viewer-zone] > * { pointer-events: auto; }
|
|
4564
4564
|
[data-viewer-zone="left"] { left: 0; top: 0; bottom: 0; }
|
|
@@ -4567,7 +4567,7 @@ const ys = `
|
|
|
4567
4567
|
[data-viewer-zone="bottom"] { left: 0; right: 0; bottom: 0; }
|
|
4568
4568
|
[data-viewer-zone="overlay"] { inset: 0; }
|
|
4569
4569
|
[data-viewer-zone][data-viewer-zone-active="false"] { display: none; }
|
|
4570
|
-
`,
|
|
4570
|
+
`, ws = {
|
|
4571
4571
|
play: '<path d="m8 5 11 7-11 7Z"/>',
|
|
4572
4572
|
pause: '<path d="M8 5v14M16 5v14"/>',
|
|
4573
4573
|
reset: '<path d="M3 10a9 9 0 1 1 2.5 8M3 4v6h6"/>',
|
|
@@ -4582,9 +4582,9 @@ const ys = `
|
|
|
4582
4582
|
moon: '<path d="M20.5 13A9 9 0 0 1 11 3.5 9 9 0 1 0 20.5 13Z"/>'
|
|
4583
4583
|
};
|
|
4584
4584
|
function Ft(s) {
|
|
4585
|
-
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${
|
|
4585
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${ws[s]}</svg>`;
|
|
4586
4586
|
}
|
|
4587
|
-
const
|
|
4587
|
+
const Cs = {
|
|
4588
4588
|
filename: !0,
|
|
4589
4589
|
playback: !0,
|
|
4590
4590
|
reset: !0,
|
|
@@ -4594,8 +4594,8 @@ const ws = {
|
|
|
4594
4594
|
collision: !0,
|
|
4595
4595
|
theme: !0
|
|
4596
4596
|
};
|
|
4597
|
-
function
|
|
4598
|
-
const t = { ...
|
|
4597
|
+
function Es(s, e) {
|
|
4598
|
+
const t = { ...Cs, ...e.parts }, i = document.createElement("nav");
|
|
4599
4599
|
i.className = "vpu-toolbar", i.dataset.theme = e.theme ?? "dark", i.setAttribute("aria-label", e.label);
|
|
4600
4600
|
const r = document.createElement("span");
|
|
4601
4601
|
r.className = "vpu-filename", r.hidden = !0;
|
|
@@ -4655,7 +4655,7 @@ function Cs(s, e) {
|
|
|
4655
4655
|
const x = a.get("collision");
|
|
4656
4656
|
x && re(x.button, m.collisionVisible ? "隐藏碰撞代理" : "显示碰撞代理", "collision", m.collisionVisible);
|
|
4657
4657
|
const w = a.get("upAxis");
|
|
4658
|
-
w && re(w.button,
|
|
4658
|
+
w && re(w.button, ks(m.upAxis), Ss(m.upAxis), m.upAxis === "y");
|
|
4659
4659
|
};
|
|
4660
4660
|
return {
|
|
4661
4661
|
element: i,
|
|
@@ -4675,10 +4675,10 @@ function re(s, e, t, i) {
|
|
|
4675
4675
|
function Ss(s) {
|
|
4676
4676
|
return s === "y" ? "upAxisY" : "upAxisZ";
|
|
4677
4677
|
}
|
|
4678
|
-
function
|
|
4678
|
+
function ks(s) {
|
|
4679
4679
|
return s === "y" ? "当前 Y-UP,点击切换为 Z-UP" : "当前 Z-UP,点击切换为 Y-UP";
|
|
4680
4680
|
}
|
|
4681
|
-
class
|
|
4681
|
+
class Ps {
|
|
4682
4682
|
constructor(e = "dark", t) {
|
|
4683
4683
|
u(this, "root");
|
|
4684
4684
|
u(this, "title");
|
|
@@ -4764,7 +4764,7 @@ class ks {
|
|
|
4764
4764
|
this.closeReport(), this.reportLink = null, !this.root.hidden && (this.root.hidden = !0, this.title.textContent = "", this.detail.textContent = "", this.detail.hidden = !0, this.toggle.hidden = !0);
|
|
4765
4765
|
}
|
|
4766
4766
|
}
|
|
4767
|
-
const
|
|
4767
|
+
const As = `
|
|
4768
4768
|
.vpu-root {
|
|
4769
4769
|
position: absolute;
|
|
4770
4770
|
inset: 0;
|
|
@@ -4931,17 +4931,17 @@ const Ps = `
|
|
|
4931
4931
|
.vpu-status-spinner { animation: none; }
|
|
4932
4932
|
}
|
|
4933
4933
|
`, dt = "scene";
|
|
4934
|
-
function
|
|
4934
|
+
function Rs(s, e) {
|
|
4935
4935
|
let t = null, i = null, r = null, n = null, a = null, o = null;
|
|
4936
4936
|
return {
|
|
4937
4937
|
id: "nebula.ui.scene",
|
|
4938
4938
|
activate(l) {
|
|
4939
4939
|
var c, p;
|
|
4940
|
-
o = document.createElement("style"), o.dataset.viewerSceneUi = "", o.textContent =
|
|
4940
|
+
o = document.createElement("style"), o.dataset.viewerSceneUi = "", o.textContent = As, (c = s.shadowRoot()) == null || c.append(o), t = Es(l, {
|
|
4941
4941
|
label: e.label("simulation"),
|
|
4942
4942
|
parts: (p = e.scene) == null ? void 0 : p.parts,
|
|
4943
4943
|
theme: s.theme()
|
|
4944
|
-
}), i = new
|
|
4944
|
+
}), i = new Ps(s.theme(), () => {
|
|
4945
4945
|
var h;
|
|
4946
4946
|
return ((h = s.getVisualDiagnostics) == null ? void 0 : h.call(s)) ?? null;
|
|
4947
4947
|
}), r = s.mountBuiltin(t.element, { zone: "overlay", group: dt }), n = s.mountBuiltin(i.element, { zone: "overlay", group: dt }), a = s.onThemeChange((h) => {
|
|
@@ -4969,9 +4969,9 @@ function As(s, e) {
|
|
|
4969
4969
|
}
|
|
4970
4970
|
};
|
|
4971
4971
|
}
|
|
4972
|
-
class
|
|
4972
|
+
class Is {
|
|
4973
4973
|
constructor(e, t, i, r) {
|
|
4974
|
-
u(this, "renderer", new
|
|
4974
|
+
u(this, "renderer", new fi());
|
|
4975
4975
|
u(this, "scene", new we());
|
|
4976
4976
|
u(this, "labels", []);
|
|
4977
4977
|
u(this, "frame", null);
|
|
@@ -4982,7 +4982,7 @@ class Ms {
|
|
|
4982
4982
|
if (n.kind !== "link" || n.visualCount === 0) continue;
|
|
4983
4983
|
const a = e.ownerDocument.createElement("div");
|
|
4984
4984
|
a.className = "vurdf-name-label", a.textContent = n.name;
|
|
4985
|
-
const o = new
|
|
4985
|
+
const o = new pi(a);
|
|
4986
4986
|
this.scene.add(o), this.labels.push({ id: n.id.slice(5), object: o });
|
|
4987
4987
|
}
|
|
4988
4988
|
}
|
|
@@ -5017,14 +5017,14 @@ class Ms {
|
|
|
5017
5017
|
this.setVisible(!1), this.disposed = !0, this.scene.clear(), this.labels.length = 0;
|
|
5018
5018
|
}
|
|
5019
5019
|
}
|
|
5020
|
-
function
|
|
5021
|
-
const e = s.clone().invert(), t = [new
|
|
5020
|
+
function Ms(s) {
|
|
5021
|
+
const e = s.clone().invert(), t = [new S(1, 0, 0), new S(0, 1, 0), new S(0, 0, 1)], i = ["#f3656a", "#36c978", "#4789f5"];
|
|
5022
5022
|
return `<svg viewBox="0 0 100 100" role="img" aria-label="世界坐标轴">${t.flatMap((n, a) => [-1, 1].map((o) => ({ p: n.clone().multiplyScalar(o).applyQuaternion(e), i: a, sign: o }))).sort((n, a) => n.p.z - a.p.z).map(({ p: n, i: a, sign: o }) => {
|
|
5023
5023
|
const l = 50 + n.x * 32, d = 50 - n.y * 32, c = i[a];
|
|
5024
5024
|
return `${o > 0 ? `<path d="M50 50L${l} ${d}" stroke="${c}" stroke-width="2"/>` : ""}<circle cx="${l}" cy="${d}" r="${o > 0 ? 7.5 : 4}" fill="${c}" opacity="${o > 0 ? 1 : 0.6}" stroke="none"/>${o > 0 ? `<text x="${l}" y="${d + 3}" fill="#101b24" stroke="none" text-anchor="middle" font-size="9">${"XYZ"[a]}</text>` : ""}`;
|
|
5025
5025
|
}).join("")}</svg>`;
|
|
5026
5026
|
}
|
|
5027
|
-
const
|
|
5027
|
+
const Ls = {
|
|
5028
5028
|
structure: '<rect x="9" y="3" width="6" height="5" rx="1"/><rect x="2" y="16" width="6" height="5" rx="1"/><rect x="16" y="16" width="6" height="5" rx="1"/><path d="M12 8v4M5 16v-4h14v4"/>',
|
|
5029
5029
|
zoomIn: '<circle cx="10" cy="10" r="6"/><path d="m15 15 5 5M7 10h6m-3-3v6"/>',
|
|
5030
5030
|
zoomOut: '<circle cx="10" cy="10" r="6"/><path d="m15 15 5 5M7 10h6"/>',
|
|
@@ -5052,8 +5052,8 @@ const Rs = {
|
|
|
5052
5052
|
sun: '<circle cx="12" cy="12" r="3.5"/><path d="M12 2v2m0 16v2M4.9 4.9l1.4 1.4m11.4 11.4 1.4 1.4M2 12h2m16 0h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"/>',
|
|
5053
5053
|
moon: '<path d="M20 15.2A8 8 0 0 1 8.8 4 8.5 8.5 0 1 0 20 15.2Z"/>'
|
|
5054
5054
|
};
|
|
5055
|
-
function
|
|
5056
|
-
return `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${
|
|
5055
|
+
function M(s) {
|
|
5056
|
+
return `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${Ls[s]}</svg>`;
|
|
5057
5057
|
}
|
|
5058
5058
|
function P(s) {
|
|
5059
5059
|
return s.mode === "kinematic" || s.mode === "dynamics-paused" || s.mode === "dynamics-unavailable";
|
|
@@ -5066,60 +5066,60 @@ function ee(s, e = 1 / 0) {
|
|
|
5066
5066
|
const t = s.controlLimits;
|
|
5067
5067
|
return t && (Number.isFinite(t.lower) || Number.isFinite(t.upper)) ? { lower: Number.isFinite(t.lower) ? t.lower : -e, upper: Number.isFinite(t.upper) ? t.upper : e } : s.jointType === "continuous" ? { lower: -Math.PI, upper: Math.PI } : { lower: ((i = s.limits) == null ? void 0 : i.lower) ?? -e, upper: ((r = s.limits) == null ? void 0 : r.upper) ?? e };
|
|
5068
5068
|
}
|
|
5069
|
-
function
|
|
5069
|
+
function Ts(s, e, t, i) {
|
|
5070
5070
|
const r = s.ownerDocument, n = r.defaultView;
|
|
5071
5071
|
let a = !1, o = 0, l = null, d = null, c = "";
|
|
5072
|
-
const p = (
|
|
5072
|
+
const p = (E) => E.composedPath().some((A) => A instanceof n.HTMLElement && (A.matches("input,textarea,select") || A.isContentEditable)), h = () => {
|
|
5073
5073
|
d && (d = null, s.style.cursor = c, s.removeAttribute("data-joint-adjusting"));
|
|
5074
|
-
}, f = () => ["kinematic", "dynamics-paused", "dynamics-unavailable"].includes(e.getSnapshot().mode), v = (
|
|
5074
|
+
}, f = () => ["kinematic", "dynamics-paused", "dynamics-unavailable"].includes(e.getSnapshot().mode), v = (E) => {
|
|
5075
5075
|
var Te;
|
|
5076
|
-
if (
|
|
5076
|
+
if (E.code === "Escape") {
|
|
5077
5077
|
h();
|
|
5078
5078
|
return;
|
|
5079
5079
|
}
|
|
5080
|
-
if (
|
|
5080
|
+
if (E.code !== "KeyR" || E.repeat || E.ctrlKey || E.altKey || E.metaKey || p(E) || !a && r.activeElement !== s || !f()) return;
|
|
5081
5081
|
const A = e.getSnapshot(), L = A.nodes.find((De) => De.id === A.selectedEntityId && De.kind === "joint");
|
|
5082
5082
|
if (!(L != null && L.movable) || L.mimic) return;
|
|
5083
5083
|
t();
|
|
5084
|
-
const G = (Te = e.jointWorldFrame) == null ? void 0 : Te.call(e, L.name), K = i == null ? void 0 : i(),
|
|
5085
|
-
d = { id: L.id, name: L.name, value: A.jointValues[L.name] ?? 0, sensitivity: L.jointType === "prismatic" ? 1e-3 : 5e-3, ...ee(L), direction:
|
|
5086
|
-
}, y = (
|
|
5087
|
-
|
|
5088
|
-
}, m = (
|
|
5089
|
-
const A = l === null ? 0 :
|
|
5090
|
-
if (l =
|
|
5091
|
-
if (!f() || e.getSnapshot().selectedEntityId !== d.id ||
|
|
5084
|
+
const G = (Te = e.jointWorldFrame) == null ? void 0 : Te.call(e, L.name), K = i == null ? void 0 : i(), _t = G && K && l !== null ? Ds(K, G, s.getBoundingClientRect(), l, o, L.jointType === "prismatic") : 1;
|
|
5085
|
+
d = { id: L.id, name: L.name, value: A.jointValues[L.name] ?? 0, sensitivity: L.jointType === "prismatic" ? 1e-3 : 5e-3, ...ee(L), direction: _t }, c = s.style.cursor, s.style.cursor = "ew-resize", s.setAttribute("data-joint-adjusting", "true"), E.preventDefault();
|
|
5086
|
+
}, y = (E) => {
|
|
5087
|
+
E.code === "KeyR" && h();
|
|
5088
|
+
}, m = (E) => {
|
|
5089
|
+
const A = l === null ? 0 : E.clientX - l;
|
|
5090
|
+
if (l = E.clientX, o = E.clientY, !(!d || E.pointerType === "touch")) {
|
|
5091
|
+
if (!f() || e.getSnapshot().selectedEntityId !== d.id || E.buttons !== 0) {
|
|
5092
5092
|
h();
|
|
5093
5093
|
return;
|
|
5094
5094
|
}
|
|
5095
|
-
A && (d.value = Math.max(d.lower, Math.min(d.upper, d.value + A * d.direction * d.sensitivity)), e.setJointValue(d.name, d.value),
|
|
5095
|
+
A && (d.value = Math.max(d.lower, Math.min(d.upper, d.value + A * d.direction * d.sensitivity)), e.setJointValue(d.name, d.value), E.preventDefault(), E.stopImmediatePropagation());
|
|
5096
5096
|
}
|
|
5097
|
-
}, b = (
|
|
5098
|
-
a = !0, l =
|
|
5097
|
+
}, b = (E) => {
|
|
5098
|
+
a = !0, l = E.clientX, o = E.clientY;
|
|
5099
5099
|
}, g = () => {
|
|
5100
5100
|
a = !1, l = null, h();
|
|
5101
|
-
}, x = (
|
|
5102
|
-
d && (
|
|
5103
|
-
}, w = (
|
|
5104
|
-
|
|
5101
|
+
}, x = (E) => {
|
|
5102
|
+
d && (E.preventDefault(), E.stopImmediatePropagation());
|
|
5103
|
+
}, w = (E) => {
|
|
5104
|
+
E.composedPath()[0] !== s && h();
|
|
5105
5105
|
}, C = () => {
|
|
5106
5106
|
r.hidden && h();
|
|
5107
|
-
}, D = e.subscribe((
|
|
5108
|
-
d && (!f() ||
|
|
5107
|
+
}, D = e.subscribe((E) => {
|
|
5108
|
+
d && (!f() || E.selectedEntityId !== d.id) && h();
|
|
5109
5109
|
});
|
|
5110
5110
|
return s.addEventListener("pointerenter", b), s.addEventListener("pointerleave", g), s.addEventListener("pointermove", m, !0), s.addEventListener("pointerdown", x, !0), r.addEventListener("keydown", v), r.addEventListener("keyup", y), r.addEventListener("focusin", w), r.addEventListener("visibilitychange", C), n.addEventListener("blur", g), () => {
|
|
5111
5111
|
h(), D(), s.removeEventListener("pointerenter", b), s.removeEventListener("pointerleave", g), s.removeEventListener("pointermove", m, !0), s.removeEventListener("pointerdown", x, !0), r.removeEventListener("keydown", v), r.removeEventListener("keyup", y), r.removeEventListener("focusin", w), r.removeEventListener("visibilitychange", C), n.removeEventListener("blur", g);
|
|
5112
5112
|
};
|
|
5113
5113
|
}
|
|
5114
|
-
function
|
|
5114
|
+
function Ds(s, e, t, i, r, n) {
|
|
5115
5115
|
if (t.width <= 0 || t.height <= 0 || e.axis.lengthSq() < 1e-12) return 1;
|
|
5116
5116
|
s.updateMatrixWorld(!0);
|
|
5117
|
-
const a = e.axis.clone().normalize(), o = s.getWorldDirection(new
|
|
5117
|
+
const a = e.axis.clone().normalize(), o = s.getWorldDirection(new S()), l = new S(1, 0, 0).transformDirection(s.matrixWorld), d = new S(0, 1, 0).transformDirection(s.matrixWorld);
|
|
5118
5118
|
let c = a.clone();
|
|
5119
5119
|
if (!n) {
|
|
5120
|
-
const f = new
|
|
5120
|
+
const f = new St();
|
|
5121
5121
|
f.setFromCamera(new oe((i - t.left) / t.width * 2 - 1, 1 - (r - t.top) / t.height * 2), s);
|
|
5122
|
-
const v = f.ray.intersectPlane(new kt().setFromNormalAndCoplanarPoint(o, e.position), new
|
|
5122
|
+
const v = f.ray.intersectPlane(new kt().setFromNormalAndCoplanarPoint(o, e.position), new S()), y = v ? v.sub(e.position) : new S();
|
|
5123
5123
|
c = a.clone().cross(y), Math.abs(c.dot(l)) <= Math.max(y.length(), 1e-6) * 0.05 && (c = a.clone().cross(o.clone().negate()), Math.abs(c.dot(l)) < 0.05 && (c = a.clone().cross(d.clone().negate())));
|
|
5124
5124
|
}
|
|
5125
5125
|
const p = c.dot(l);
|
|
@@ -5130,7 +5130,7 @@ function Ts(s, e, t, i, r, n) {
|
|
|
5130
5130
|
function W(s, e, t) {
|
|
5131
5131
|
return s.jointType === "prismatic" ? `${e.toFixed(3)} m` : t === "rad" ? `${e.toFixed(3)} rad` : `${(e * 180 / Math.PI).toFixed(1)}°`;
|
|
5132
5132
|
}
|
|
5133
|
-
function
|
|
5133
|
+
function Os(s, e) {
|
|
5134
5134
|
return s.jointType !== "prismatic" && e === "deg" ? 180 / Math.PI : 1;
|
|
5135
5135
|
}
|
|
5136
5136
|
function ue(s, e) {
|
|
@@ -5143,8 +5143,8 @@ function ue(s, e) {
|
|
|
5143
5143
|
}
|
|
5144
5144
|
return s;
|
|
5145
5145
|
}
|
|
5146
|
-
function
|
|
5147
|
-
const { lower: r, upper: n } = ee(s, Math.PI), a = e.jointValues[s.name] ?? 0, o =
|
|
5146
|
+
function Se(s, e, t, i = !1) {
|
|
5147
|
+
const { lower: r, upper: n } = ee(s, Math.PI), a = e.jointValues[s.name] ?? 0, o = Os(s, t);
|
|
5148
5148
|
return `<div class="vurdf-slider-card ${e.selectedEntityId === s.id ? "is-selected" : ""}" data-joint-card="${k(s.id)}" tabindex="0" role="group" aria-label="${k(s.name)},点击选中关节">
|
|
5149
5149
|
<div class="vurdf-slider-heading"><button class="vurdf-text-btn" data-entity="${k(s.id)}">${k(s.name)}</button><output data-joint-readout="${k(s.name)}">${W(s, a, t)}</output></div>
|
|
5150
5150
|
<small>${i ? "联动控制 · " : ""}${k(s.parentLink)} → ${k(s.childLink)}</small>
|
|
@@ -5156,9 +5156,9 @@ function ct(s, e, t) {
|
|
|
5156
5156
|
const i = e.nodes.filter((o) => o.kind === "joint"), r = s.kind === "joint" ? s : i.find((o) => o.childLink === s.name);
|
|
5157
5157
|
if (!r) return "";
|
|
5158
5158
|
const n = ue(r, i), a = i.filter((o) => o.mimic && ue(o, i).name === n.name);
|
|
5159
|
-
return a.length ? `<section class="vurdf-section"><div class="vurdf-section-head"><strong>联动约束 · ${a.length + 1} 个关节</strong></div>${
|
|
5159
|
+
return a.length ? `<section class="vurdf-section"><div class="vurdf-section-head"><strong>联动约束 · ${a.length + 1} 个关节</strong></div>${Se(n, e, t, !0)}<p class="vurdf-control-hint">${a.map((o) => k(o.name)).join(" · ")}</p></section>` : "";
|
|
5160
5160
|
}
|
|
5161
|
-
function
|
|
5161
|
+
function zs(s, e, t) {
|
|
5162
5162
|
const i = s.nodes.filter((c) => c.kind === "joint"), r = /* @__PURE__ */ new Map();
|
|
5163
5163
|
for (const c of i) r.set(c.parentLink, [...r.get(c.parentLink) ?? [], c]);
|
|
5164
5164
|
const n = new Set(i.map((c) => c.childLink)), a = /* @__PURE__ */ new Set(), o = [], l = (c) => {
|
|
@@ -5181,13 +5181,13 @@ function Os(s, e, t) {
|
|
|
5181
5181
|
const d = e.trim().toLowerCase();
|
|
5182
5182
|
return o.filter((c) => c.some((p) => `${p.name} ${p.parentLink} ${p.childLink}`.toLowerCase().includes(d))).map((c) => {
|
|
5183
5183
|
const p = [...new Set(c.map((h) => ue(h, i)))].filter((h) => i.some((f) => f.mimic && ue(f, i).name === h.name));
|
|
5184
|
-
return `<section class="vurdf-joint-group"><h3>${k(c[0].parentLink)} → ${k(c[c.length - 1].childLink)}</h3>${p.filter((h) => !c.includes(h)).map((h) =>
|
|
5184
|
+
return `<section class="vurdf-joint-group"><h3>${k(c[0].parentLink)} → ${k(c[c.length - 1].childLink)}</h3>${p.filter((h) => !c.includes(h)).map((h) => Se(h, s, t, !0)).join("")}${c.map((h) => Se(h, s, t, p.includes(h))).join("")}</section>`;
|
|
5185
5185
|
}).join("") || '<div class="vurdf-empty">没有符合筛选条件的可动关节。</div>';
|
|
5186
5186
|
}
|
|
5187
|
-
function
|
|
5188
|
-
return `<button class="vurdf-tool" data-angle-unit aria-label="切换弧度和角度" title="切换所有关节的显示单位" aria-pressed="${s === "deg"}">${
|
|
5187
|
+
function Ns(s) {
|
|
5188
|
+
return `<button class="vurdf-tool" data-angle-unit aria-label="切换弧度和角度" title="切换所有关节的显示单位" aria-pressed="${s === "deg"}">${M("angleUnit")}<span>${s === "rad" ? "rad" : "°"}</span></button>`;
|
|
5189
5189
|
}
|
|
5190
|
-
class
|
|
5190
|
+
class Fs {
|
|
5191
5191
|
constructor(e, t, i) {
|
|
5192
5192
|
u(this, "element", document.createElement("aside"));
|
|
5193
5193
|
u(this, "root", document.createElement("div"));
|
|
@@ -5215,10 +5215,10 @@ class Ns {
|
|
|
5215
5215
|
this.pendingSnapshot = null;
|
|
5216
5216
|
const t = new Set(e.issues.map((d) => d.entityId)), i = this.root.querySelector(".vurdf-tree"), r = { top: (i == null ? void 0 : i.scrollTop) ?? 0, left: (i == null ? void 0 : i.scrollLeft) ?? 0 }, n = this.root.getRootNode().activeElement, a = n && (i != null && i.contains(n)) ? n.dataset.entity : void 0;
|
|
5217
5217
|
this.root.innerHTML = `
|
|
5218
|
-
<div class="vurdf-head"><div><strong>URDF模型结构</strong><span>${e.nodes.filter((d) => d.kind === "link").length} Links · ${e.nodes.filter((d) => d.kind === "joint").length} Joints</span></div><button class="vurdf-diagram-open" data-open-diagram title="打开结构图" aria-label="打开结构图">${
|
|
5219
|
-
<label class="vurdf-search">${
|
|
5218
|
+
<div class="vurdf-head"><div><strong>URDF模型结构</strong><span>${e.nodes.filter((d) => d.kind === "link").length} Links · ${e.nodes.filter((d) => d.kind === "joint").length} Joints</span></div><button class="vurdf-diagram-open" data-open-diagram title="打开结构图" aria-label="打开结构图">${M("structure")}</button></div>
|
|
5219
|
+
<label class="vurdf-search">${M("search")}<input aria-label="搜索模型结构" placeholder="搜索 Link 或 Joint" value="${k(this.query)}"></label>
|
|
5220
5220
|
<div class="vurdf-filters">${ve("all", "全部", this.filter)}${ve("movable", "可动关节", this.filter)}${ve("errors", `错误 ${e.issues.length}`, this.filter)}</div>
|
|
5221
|
-
<div class="vurdf-tree" role="${this.filter === "movable" ? "region" : "tree"}">${this.filter === "movable" ?
|
|
5221
|
+
<div class="vurdf-tree" role="${this.filter === "movable" ? "region" : "tree"}">${this.filter === "movable" ? zs(e, this.query, this.angleUnit) : Vs(e, t, this.filter, this.query, this.collapsed, this.angleUnit)}</div>
|
|
5222
5222
|
`, this.bind(e), this.setDiagramOpen(this.diagramOpen);
|
|
5223
5223
|
const o = this.root.querySelector(".vurdf-tree");
|
|
5224
5224
|
o && (o.scrollTop = r.top, o.scrollLeft = r.left, a && ((l = Array.from(o.querySelectorAll("[data-entity]")).find((d) => d.dataset.entity === a)) == null || l.focus({ preventScroll: !0 })));
|
|
@@ -5304,7 +5304,7 @@ class Ns {
|
|
|
5304
5304
|
});
|
|
5305
5305
|
}
|
|
5306
5306
|
}
|
|
5307
|
-
function
|
|
5307
|
+
function Vs(s, e, t, i, r, n) {
|
|
5308
5308
|
const a = new Map(s.nodes.map((p) => [p.id, p])), o = i.trim().toLowerCase(), l = o.length > 0 || t !== "all", d = (p) => {
|
|
5309
5309
|
const h = !o || p.name.toLowerCase().includes(o), f = t === "all" || t === "movable" && p.kind === "joint" && p.movable || t === "errors" && e.has(p.id);
|
|
5310
5310
|
return h && f;
|
|
@@ -5312,25 +5312,25 @@ function Fs(s, e, t, i, r, n) {
|
|
|
5312
5312
|
if (f.has(p)) return { html: "", matched: !1 };
|
|
5313
5313
|
const v = a.get(p);
|
|
5314
5314
|
if (!v) return { html: "", matched: !1 };
|
|
5315
|
-
const y = new Set(f).add(p), m = v.childIds.map((
|
|
5316
|
-
if (!(d(v) || m.some((
|
|
5317
|
-
const g = m.some((
|
|
5318
|
-
<button class="vurdf-tree-toggle ${g ? "" : "is-placeholder"} ${x ? "" : "is-open"}" data-tree-toggle="${k(v.id)}" ${g ? "" : "disabled"} aria-label="${x ? "展开" : "折叠"} ${k(v.name)}">${
|
|
5315
|
+
const y = new Set(f).add(p), m = v.childIds.map((E) => c(E, h + 1, y));
|
|
5316
|
+
if (!(d(v) || m.some((E) => E.matched))) return { html: "", matched: !1 };
|
|
5317
|
+
const g = m.some((E) => E.matched), x = !l && r.has(v.id), w = v.kind === "joint" ? v.jointType : v.kind, C = v.kind === "joint" && v.movable ? `${W(v, s.jointValues[v.name] ?? 0, n)}` : "", D = `<div class="vurdf-tree-item" style="--depth:${h}" role="treeitem" aria-expanded="${g ? String(!x) : "false"}">
|
|
5318
|
+
<button class="vurdf-tree-toggle ${g ? "" : "is-placeholder"} ${x ? "" : "is-open"}" data-tree-toggle="${k(v.id)}" ${g ? "" : "disabled"} aria-label="${x ? "展开" : "折叠"} ${k(v.name)}">${M("chevron")}</button>
|
|
5319
5319
|
<button class="vurdf-row ${s.selectedEntityId === v.id ? "is-selected" : ""} ${e.has(v.id) ? "has-error" : ""}" data-entity="${k(v.id)}">
|
|
5320
|
-
${
|
|
5320
|
+
${M(v.kind === "robot" ? "robot" : v.kind === "joint" ? "joint" : "link")}
|
|
5321
5321
|
<span class="vurdf-node-copy"><b title="${k(v.name)}">${k(v.name)}</b><small>${k(w)}</small></span>
|
|
5322
5322
|
${e.has(v.id) ? '<span class="vurdf-node-error">!</span>' : `<span class="vurdf-node-value" ${v.kind === "joint" ? `data-joint-readout="${k(v.name)}"` : ""}>${C}</span>`}
|
|
5323
5323
|
</button>
|
|
5324
5324
|
</div>`;
|
|
5325
|
-
return { html: `<div class="vurdf-branch ${x ? "is-collapsed" : ""}">${D}<div class="vurdf-children" ${x ? "inert" : ""}><div>${m.map((
|
|
5325
|
+
return { html: `<div class="vurdf-branch ${x ? "is-collapsed" : ""}">${D}<div class="vurdf-children" ${x ? "inert" : ""}><div>${m.map((E) => E.html).join("")}</div></div></div>`, matched: !0 };
|
|
5326
5326
|
};
|
|
5327
5327
|
return c(s.rootEntityId, 0).html || '<div class="vurdf-empty">没有符合筛选条件的节点。</div>';
|
|
5328
5328
|
}
|
|
5329
5329
|
function ve(s, e, t) {
|
|
5330
5330
|
return `<button class="vurdf-chip ${s === t ? "is-active" : ""}" data-filter="${s}">${e}</button>`;
|
|
5331
5331
|
}
|
|
5332
|
-
const
|
|
5333
|
-
class
|
|
5332
|
+
const $s = 1800;
|
|
5333
|
+
class _s {
|
|
5334
5334
|
constructor(e) {
|
|
5335
5335
|
u(this, "element", document.createElement("aside"));
|
|
5336
5336
|
u(this, "root", document.createElement("div"));
|
|
@@ -5368,9 +5368,9 @@ class $s {
|
|
|
5368
5368
|
a.open ? this.expandedInertia.add(o) : this.expandedInertia.delete(o);
|
|
5369
5369
|
}), this.root.innerHTML = `
|
|
5370
5370
|
<nav class="vurdf-tabs">${ge("properties", "属性", this.tab)}${ge("source", "XML", this.tab)}${ge("issues", `错误${e.issues.length ? ` <em>${e.issues.length}</em>` : ""}`, this.tab)}</nav>
|
|
5371
|
-
<section class="vurdf-pane ${this.tab === "properties" ? "is-active" : ""}" data-pane="properties">${t ? Bs(t, e, ((i = this.sweep) == null ? void 0 : i.jointName) === t.name, this.angleUnit, this.expandedInertia) :
|
|
5372
|
-
<section class="vurdf-pane ${this.tab === "source" ? "is-active" : ""}" data-pane="source">${this.tab === "source" ?
|
|
5373
|
-
<section class="vurdf-pane ${this.tab === "issues" ? "is-active" : ""}" data-pane="issues">${
|
|
5371
|
+
<section class="vurdf-pane ${this.tab === "properties" ? "is-active" : ""}" data-pane="properties">${t ? Bs(t, e, ((i = this.sweep) == null ? void 0 : i.jointName) === t.name, this.angleUnit, this.expandedInertia) : Hs()}</section>
|
|
5372
|
+
<section class="vurdf-pane ${this.tab === "source" ? "is-active" : ""}" data-pane="source">${this.tab === "source" ? Us(e, t) : ""}</section>
|
|
5373
|
+
<section class="vurdf-pane ${this.tab === "issues" ? "is-active" : ""}" data-pane="issues">${js(e)}</section>
|
|
5374
5374
|
`, this.bind(e), this.tab === "source" && ((n = (r = this.root.querySelector(".vurdf-source .line.is-selected")) == null ? void 0 : r.scrollIntoView) == null || n.call(r, { block: "center" }));
|
|
5375
5375
|
}
|
|
5376
5376
|
dispose() {
|
|
@@ -5480,7 +5480,7 @@ class $s {
|
|
|
5480
5480
|
const { lower: i, upper: r } = ee(e, Math.PI), n = () => {
|
|
5481
5481
|
const a = this.sweep;
|
|
5482
5482
|
if (!a || a.jointName !== e.name || this.disposed || !P(this.inspection.getSnapshot())) return;
|
|
5483
|
-
const o = Math.min(1, (Date.now() - a.startedAt) /
|
|
5483
|
+
const o = Math.min(1, (Date.now() - a.startedAt) / $s), l = o < 0.5 ? o * 2 : (1 - o) * 2;
|
|
5484
5484
|
if (this.inspection.setJointValue(e.name, i + (r - i) * l), o >= 1) {
|
|
5485
5485
|
const d = a.initial;
|
|
5486
5486
|
this.sweep = null, this.inspection.setJointValue(e.name, d);
|
|
@@ -5524,7 +5524,7 @@ function ht(s, e, t) {
|
|
|
5524
5524
|
${ut("质心位置", ["X", "Y", "Z"], s.centerOfMass, "m")}
|
|
5525
5525
|
${ut("惯性坐标系旋转", ["R", "P", "Y"], s.inertialRotationRpy, "rad")}
|
|
5526
5526
|
<details class="vurdf-inertia-details" data-inertia-details="${k(s.id)}" ${t ? "open" : ""}>
|
|
5527
|
-
<summary>${
|
|
5527
|
+
<summary>${M("chevron")}<strong>惯性张量</strong><span>kg·m²</span></summary>
|
|
5528
5528
|
<div class="vurdf-inertial-frame">关于质心 · 惯性坐标系</div>
|
|
5529
5529
|
<dl class="vurdf-data">${["Ixx", "Iyy", "Izz", "Ixy", "Ixz", "Iyz"].map((i, r) => {
|
|
5530
5530
|
var n;
|
|
@@ -5533,30 +5533,30 @@ function ht(s, e, t) {
|
|
|
5533
5533
|
</details>
|
|
5534
5534
|
</section>`;
|
|
5535
5535
|
}
|
|
5536
|
-
function
|
|
5536
|
+
function Us(s, e) {
|
|
5537
5537
|
var n, a;
|
|
5538
5538
|
const t = s.sourceText.split(/\r?\n/), i = ((n = e == null ? void 0 : e.source) == null ? void 0 : n.startLine) ?? 0, r = ((a = e == null ? void 0 : e.source) == null ? void 0 : a.endLine) ?? 0;
|
|
5539
|
-
return `<pre class="vurdf-source"><code>${t.map((o, l) => `<span class="line ${e && l + 1 >= i && l + 1 <= r ? "is-selected" : ""}"><span class="ln">${l + 1}</span>${
|
|
5539
|
+
return `<pre class="vurdf-source"><code>${t.map((o, l) => `<span class="line ${e && l + 1 >= i && l + 1 <= r ? "is-selected" : ""}"><span class="ln">${l + 1}</span>${qs(o)}</span>`).join("")}</code></pre>`;
|
|
5540
5540
|
}
|
|
5541
|
-
function
|
|
5542
|
-
return s.issues.length ? s.issues.map((e) => `<button class="vurdf-issue" data-issue-entity="${k(e.entityId)}">${
|
|
5541
|
+
function js(s) {
|
|
5542
|
+
return s.issues.length ? s.issues.map((e) => `<button class="vurdf-issue" data-issue-entity="${k(e.entityId)}">${M("error")}<span><b>${k(e.title)}</b><small>${k(e.message)}</small></span></button>`).join("") : '<div class="vurdf-empty">所有严格结构与数学检查通过。</div>';
|
|
5543
5543
|
}
|
|
5544
5544
|
function ge(s, e, t) {
|
|
5545
5545
|
return `<button class="vurdf-tab ${s === t ? "is-active" : ""}" data-tab="${s}">${e}</button>`;
|
|
5546
5546
|
}
|
|
5547
|
-
function
|
|
5547
|
+
function Hs() {
|
|
5548
5548
|
return '<div class="vurdf-empty vurdf-no-selection">点击模型或结构树选择部件;点击场景空白处可取消选择。</div>';
|
|
5549
5549
|
}
|
|
5550
5550
|
function be(s) {
|
|
5551
5551
|
return s.toFixed(3);
|
|
5552
5552
|
}
|
|
5553
|
-
function
|
|
5553
|
+
function qs(s) {
|
|
5554
5554
|
return k(s).replace(/(<\/?[\w:-]+)/g, '<span class="tag">$1</span>').replace(/([\w:-]+)=(".*?")/g, '<span class="attr">$1</span>=<span class="str">$2</span>');
|
|
5555
5555
|
}
|
|
5556
5556
|
function Pe(s, e) {
|
|
5557
5557
|
return s.jointType !== "prismatic" && e === "deg" ? 180 / Math.PI : 1;
|
|
5558
5558
|
}
|
|
5559
|
-
function
|
|
5559
|
+
function Ys(s) {
|
|
5560
5560
|
const e = new Map(s.nodes.map((o) => [o.id, o])), t = /* @__PURE__ */ new Set(), i = [], r = [];
|
|
5561
5561
|
let n = 0;
|
|
5562
5562
|
const a = (o, l) => {
|
|
@@ -5575,7 +5575,7 @@ function qs(s) {
|
|
|
5575
5575
|
for (const o of s.nodes) t.has(o.id) || a(o.id, 0);
|
|
5576
5576
|
return { nodes: i, edges: r, width: Math.max(200, n * 210), height: Math.max(90, ...i.map((o) => o.y + 45)) };
|
|
5577
5577
|
}
|
|
5578
|
-
class
|
|
5578
|
+
class Xs {
|
|
5579
5579
|
constructor(e, t, i = () => {
|
|
5580
5580
|
}) {
|
|
5581
5581
|
u(this, "element", document.createElement("section"));
|
|
@@ -5593,13 +5593,13 @@ class Ys {
|
|
|
5593
5593
|
u(this, "suppressClick", !1);
|
|
5594
5594
|
u(this, "windowDrag", null);
|
|
5595
5595
|
u(this, "windowResize", null);
|
|
5596
|
-
this.select = e, this.onClose = t, this.onOpen = i, this.element.className = "vurdf-diagram", this.element.hidden = !0, this.element.setAttribute("role", "dialog"), this.element.setAttribute("aria-label", "URDF 结构图"), this.element.innerHTML = `<header class="vurdf-diagram-head"><strong>${
|
|
5596
|
+
this.select = e, this.onClose = t, this.onOpen = i, this.element.className = "vurdf-diagram", this.element.hidden = !0, this.element.setAttribute("role", "dialog"), this.element.setAttribute("aria-label", "URDF 结构图"), this.element.innerHTML = `<header class="vurdf-diagram-head"><strong>${M("structure")}结构图</strong><div>${this.tool("zoomOut", "缩小")}${this.tool("zoomIn", "放大")}${this.tool("reset", "重置视图")}${this.tool("maximize", "最大化")}${this.tool("close", "关闭结构图")}</div></header><svg class="vurdf-diagram-canvas" aria-label="机器人结构图" tabindex="0"><g></g></svg><span class="vurdf-diagram-resize vurdf-diagram-resize-tl" data-diagram-resize="tl" aria-hidden="true"></span><span class="vurdf-diagram-resize vurdf-diagram-resize-tr" data-diagram-resize="tr" aria-hidden="true"></span><span class="vurdf-diagram-resize vurdf-diagram-resize-br" data-diagram-resize="br" aria-hidden="true"></span><span class="vurdf-diagram-resize vurdf-diagram-resize-bl" data-diagram-resize="bl" aria-hidden="true"></span>`, this.svg = this.element.querySelector("svg.vurdf-diagram-canvas"), this.graph = this.svg.querySelector("g"), this.element.querySelectorAll("[data-diagram-action]").forEach((o) => o.addEventListener("click", () => {
|
|
5597
5597
|
const l = o.dataset.diagramAction;
|
|
5598
5598
|
if (l === "close") this.close();
|
|
5599
5599
|
else if (l === "reset") this.fit();
|
|
5600
5600
|
else if (l === "maximize") {
|
|
5601
5601
|
const d = this.element.classList.toggle("is-maximized");
|
|
5602
|
-
o.setAttribute("aria-pressed", String(d)), o.innerHTML =
|
|
5602
|
+
o.setAttribute("aria-pressed", String(d)), o.innerHTML = M(d ? "minimize" : "maximize"), o.title = d ? "最小化" : "最大化", o.setAttribute("aria-label", o.title), this.syncTopLayer(), this.fit();
|
|
5603
5603
|
} else this.zoom(l === "zoomIn" ? 1.25 : 0.8);
|
|
5604
5604
|
}));
|
|
5605
5605
|
const r = this.element.querySelector(".vurdf-diagram-head");
|
|
@@ -5678,13 +5678,13 @@ class Ys {
|
|
|
5678
5678
|
if (this.snapshot = e, !this.opened) return;
|
|
5679
5679
|
if (this.modelNodes !== e.nodes) {
|
|
5680
5680
|
this.modelNodes = e.nodes;
|
|
5681
|
-
const i =
|
|
5681
|
+
const i = Ys(e);
|
|
5682
5682
|
this.bounds = i;
|
|
5683
5683
|
const r = new Map(i.nodes.map((n) => [n.node.id, n]));
|
|
5684
5684
|
this.graph.innerHTML = i.edges.map((n) => {
|
|
5685
5685
|
const a = r.get(n.from), o = r.get(n.to), l = a.y + 20, d = o.y - 20, c = (l + d) / 2;
|
|
5686
5686
|
return `<path class="vurdf-diagram-edge" d="M${a.x} ${l} C${a.x} ${c},${o.x} ${c},${o.x} ${d}"/>`;
|
|
5687
|
-
}).join("") + i.nodes.map(({ node: n, x: a, y: o }) => `<g class="vurdf-diagram-node" data-diagram-node="${
|
|
5687
|
+
}).join("") + i.nodes.map(({ node: n, x: a, y: o }) => `<g class="vurdf-diagram-node" data-diagram-node="${R(n.id)}" transform="translate(${a - 90} ${o - 20})" role="button" tabindex="0" aria-label="${R(n.name)}"><title>${R(n.name)}</title><rect width="180" height="40" rx="${n.kind === "joint" ? 20 : 5}"/><text x="90" y="16">${R(n.name.length > 26 ? n.name.slice(0, 24) + "…" : n.name)}</text><text class="vurdf-diagram-kind" x="90" y="31">${R(n.kind === "joint" ? n.jointType : n.kind)}</text></g>`).join(""), this.fit();
|
|
5688
5688
|
}
|
|
5689
5689
|
const t = e.mode === "dynamics-running" || e.mode === "dynamics-initializing";
|
|
5690
5690
|
for (const i of this.graph.querySelectorAll("[data-diagram-node]")) {
|
|
@@ -5708,7 +5708,7 @@ class Ys {
|
|
|
5708
5708
|
(e = this.observer) == null || e.disconnect(), this.element.remove();
|
|
5709
5709
|
}
|
|
5710
5710
|
tool(e, t) {
|
|
5711
|
-
return `<button type="button" data-diagram-action="${e}" title="${t}" aria-label="${t}">${
|
|
5711
|
+
return `<button type="button" data-diagram-action="${e}" title="${t}" aria-label="${t}">${M(e)}</button>`;
|
|
5712
5712
|
}
|
|
5713
5713
|
size() {
|
|
5714
5714
|
return { width: this.svg.clientWidth || 900, height: this.svg.clientHeight || 560 };
|
|
@@ -5725,7 +5725,7 @@ class Ys {
|
|
|
5725
5725
|
this.graph.setAttribute("transform", `translate(${this.x} ${this.y}) scale(${this.scale})`);
|
|
5726
5726
|
}
|
|
5727
5727
|
}
|
|
5728
|
-
class
|
|
5728
|
+
class Ws {
|
|
5729
5729
|
constructor(e, t, i, r, n) {
|
|
5730
5730
|
u(this, "namesVisible", !1);
|
|
5731
5731
|
u(this, "element", document.createElement("div"));
|
|
@@ -5740,14 +5740,14 @@ class Xs {
|
|
|
5740
5740
|
${se("jointAxis", "关节轴", e.overlays.jointAxis, "axis")}
|
|
5741
5741
|
${se("centerOfMass", "质心", e.overlays.centerOfMass, "centerOfMass")}
|
|
5742
5742
|
${se("inertia", "惯量", e.overlays.inertia === !0, "inertia")}
|
|
5743
|
-
<button class="vurdf-tool ${this.namesVisible ? "is-active" : ""}" data-name-labels aria-pressed="${this.namesVisible}" title="显示/隐藏部件名称">${
|
|
5744
|
-
${e.nodes.some((a) => a.kind === "joint" && a.movable && a.jointType !== "prismatic") ?
|
|
5743
|
+
<button class="vurdf-tool ${this.namesVisible ? "is-active" : ""}" data-name-labels aria-pressed="${this.namesVisible}" title="显示/隐藏部件名称">${M("names")}名称</button>
|
|
5744
|
+
${e.nodes.some((a) => a.kind === "joint" && a.movable && a.jointType !== "prismatic") ? Ns(i) : ""}
|
|
5745
5745
|
<span class="vurdf-tool-divider" aria-hidden="true"></span>
|
|
5746
5746
|
${ne("ground", pt(this.ctx) ? "隐藏地面" : "显示地面", pt(this.ctx), "ground")}
|
|
5747
5747
|
${ne("fit", "适应视图", !1, "fit")}
|
|
5748
5748
|
${ne("theme", this.theme === "dark" ? "浅色主题" : "深色主题", !1, this.theme === "dark" ? "sun" : "moon")}
|
|
5749
5749
|
<span class="vurdf-tool-divider" aria-hidden="true"></span>
|
|
5750
|
-
${
|
|
5750
|
+
${Gs(e, r, n)}
|
|
5751
5751
|
${ne("reset", "重置", !1, "reset")}
|
|
5752
5752
|
`, this.bind(e);
|
|
5753
5753
|
}
|
|
@@ -5775,56 +5775,56 @@ class Xs {
|
|
|
5775
5775
|
}
|
|
5776
5776
|
}
|
|
5777
5777
|
function se(s, e, t, i) {
|
|
5778
|
-
return `<button class="vurdf-tool ${t ? "is-active" : ""}" data-overlay="${s}" data-active="${t}" aria-pressed="${t}">${
|
|
5778
|
+
return `<button class="vurdf-tool ${t ? "is-active" : ""}" data-overlay="${s}" data-active="${t}" aria-pressed="${t}">${M(i)}${e}</button>`;
|
|
5779
5779
|
}
|
|
5780
5780
|
function ne(s, e, t, i) {
|
|
5781
5781
|
const r = s === "ground" ? ` aria-pressed="${t}"` : "";
|
|
5782
|
-
return `<button class="vurdf-tool ${t ? "is-active" : ""}" data-scene-tool="${s}"${r} title="${e}" aria-label="${e}">${
|
|
5782
|
+
return `<button class="vurdf-tool ${t ? "is-active" : ""}" data-scene-tool="${s}"${r} title="${e}" aria-label="${e}">${M(i)}${s === "reset" ? e : ""}</button>`;
|
|
5783
5783
|
}
|
|
5784
|
-
function
|
|
5784
|
+
function Gs(s, e, t) {
|
|
5785
5785
|
const i = s.mode === "dynamics-running", r = i ? "暂停仿真" : s.mode === "dynamics-initializing" ? "启动中" : "启动仿真";
|
|
5786
|
-
return `<button class="vurdf-tool vurdf-dynamics ${i ? "is-active" : ""}" data-mode="dynamics" ${e ? "disabled" : ""} title="${k(t)}">${
|
|
5786
|
+
return `<button class="vurdf-tool vurdf-dynamics ${i ? "is-active" : ""}" data-mode="dynamics" ${e ? "disabled" : ""} title="${k(t)}">${M(i ? "pause" : "play")}${r}</button>`;
|
|
5787
5787
|
}
|
|
5788
5788
|
function pt(s) {
|
|
5789
5789
|
return s.asset.$readControl().groundVisible;
|
|
5790
5790
|
}
|
|
5791
|
-
class
|
|
5791
|
+
class Ks {
|
|
5792
5792
|
constructor() {
|
|
5793
5793
|
u(this, "element", document.createElement("footer"));
|
|
5794
5794
|
this.element.className = "vurdf-status";
|
|
5795
5795
|
}
|
|
5796
5796
|
update(e) {
|
|
5797
5797
|
const t = e.nodes.find((i) => i.id === e.selectedEntityId) ?? null;
|
|
5798
|
-
this.element.innerHTML = `<span>模型已就绪</span><span title="${k(e.sourcePath)}">${k(e.sourcePath)}</span><span>选择:${t ? k(t.name) : "无"}</span>${(t == null ? void 0 : t.kind) === "joint" && t.movable && P(e) ? '<span class="vurdf-gesture-hint" title="选中可动关节,将鼠标移入场景,按住 R 左右移动调节,松开 R 结束。运行仿真时不可用。">按住 R + 鼠标左右移动</span>' : ""}<span class="spacer"></span><span>Z-Up</span><span>m / kg / s</span><span>${
|
|
5798
|
+
this.element.innerHTML = `<span>模型已就绪</span><span title="${k(e.sourcePath)}">${k(e.sourcePath)}</span><span>选择:${t ? k(t.name) : "无"}</span>${(t == null ? void 0 : t.kind) === "joint" && t.movable && P(e) ? '<span class="vurdf-gesture-hint" title="选中可动关节,将鼠标移入场景,按住 R 左右移动调节,松开 R 结束。运行仿真时不可用。">按住 R + 鼠标左右移动</span>' : ""}<span class="spacer"></span><span>Z-Up</span><span>m / kg / s</span><span>${Zs(e.mode)}</span><span class="${e.issues.length ? "vurdf-status-error" : "vurdf-status-ok"}">${e.issues.length ? `${e.issues.length} 个错误` : "严格检查通过"}</span>`;
|
|
5799
5799
|
}
|
|
5800
5800
|
dispose() {
|
|
5801
5801
|
this.element.remove();
|
|
5802
5802
|
}
|
|
5803
5803
|
}
|
|
5804
|
-
function
|
|
5804
|
+
function Zs(s) {
|
|
5805
5805
|
return s === "kinematic" ? "运动学预览" : s === "dynamics-running" ? "动力学仿真运行中" : s === "dynamics-paused" ? "动力学仿真已暂停" : s === "dynamics-initializing" ? "正在初始化动力学" : "动力学不可用";
|
|
5806
5806
|
}
|
|
5807
|
-
class
|
|
5807
|
+
class Js {
|
|
5808
5808
|
constructor(e, t, i, r, n, a, o) {
|
|
5809
5809
|
u(this, "diagram");
|
|
5810
5810
|
u(this, "structure");
|
|
5811
5811
|
u(this, "inspector");
|
|
5812
5812
|
u(this, "toolbar");
|
|
5813
|
-
u(this, "statusbar", new
|
|
5813
|
+
u(this, "statusbar", new Ks());
|
|
5814
5814
|
u(this, "gizmo", document.createElement("div"));
|
|
5815
5815
|
u(this, "disposed", !1);
|
|
5816
5816
|
u(this, "angleUnit", "rad");
|
|
5817
5817
|
u(this, "nameLabels", null);
|
|
5818
5818
|
u(this, "pointerCleanup", null);
|
|
5819
5819
|
u(this, "resizeCleanup", null);
|
|
5820
|
-
this.root = e, this.inspection = t, this.theme = r, this.cameraQuaternion = n, this.structure = new
|
|
5820
|
+
this.root = e, this.inspection = t, this.theme = r, this.cameraQuaternion = n, this.structure = new Fs(t, () => this.diagram.open(), (l) => this.inspector.stopSweep(l)), this.inspector = new _s(t), this.toolbar = new Ws(t, i, r, (l) => {
|
|
5821
5821
|
var d;
|
|
5822
5822
|
return (d = this.nameLabels) == null ? void 0 : d.setVisible(l);
|
|
5823
5823
|
}, () => {
|
|
5824
5824
|
this.angleUnit = this.angleUnit === "rad" ? "deg" : "rad", this.render(this.inspection.getSnapshot());
|
|
5825
|
-
}), this.diagram = new
|
|
5825
|
+
}), this.diagram = new Xs((l) => this.selectFromScene(l), () => {
|
|
5826
5826
|
this.structure.setDiagramOpen(!1), this.structure.focusDiagramButton();
|
|
5827
|
-
}, () => this.structure.setDiagramOpen(!0)), this.gizmo.className = "vurdf-gizmo", this.gizmo.setAttribute("aria-label", "坐标轴方向"), this.root.append(this.structure.element, this.gizmo, this.toolbar.element, this.inspector.element, this.statusbar.element, this.diagram.element), this.bindSidebar("left"), this.bindSidebar("right"), a && o && (this.nameLabels = new
|
|
5827
|
+
}, () => this.structure.setDiagramOpen(!0)), this.gizmo.className = "vurdf-gizmo", this.gizmo.setAttribute("aria-label", "坐标轴方向"), this.root.append(this.structure.element, this.gizmo, this.toolbar.element, this.inspector.element, this.statusbar.element, this.diagram.element), this.bindSidebar("left"), this.bindSidebar("right"), a && o && (this.nameLabels = new Is(e, a, o, t)), a && (this.pointerCleanup = Ts(a, t, () => this.inspector.stopSweep(!1), o));
|
|
5828
5828
|
}
|
|
5829
5829
|
render(e) {
|
|
5830
5830
|
this.disposed || !e || (this.root.dataset.theme = this.theme, this.structure.update(e, this.angleUnit), this.inspector.update(e, this.angleUnit), this.toolbar.update(e, this.theme, this.angleUnit), this.statusbar.update(e), this.diagram.update(e), this.updateGizmo());
|
|
@@ -5834,7 +5834,7 @@ class Zs {
|
|
|
5834
5834
|
}
|
|
5835
5835
|
updateGizmo() {
|
|
5836
5836
|
var e;
|
|
5837
|
-
this.gizmo.innerHTML =
|
|
5837
|
+
this.gizmo.innerHTML = Ms(((e = this.cameraQuaternion) == null ? void 0 : e.call(this)) ?? new Jt());
|
|
5838
5838
|
}
|
|
5839
5839
|
setTheme(e) {
|
|
5840
5840
|
this.theme !== e && (this.theme = e, this.render(this.inspection.getSnapshot()));
|
|
@@ -5845,7 +5845,7 @@ class Zs {
|
|
|
5845
5845
|
}
|
|
5846
5846
|
bindSidebar(e) {
|
|
5847
5847
|
const t = this.root.querySelector(`[data-sidebar="${e}"]`), i = t.querySelector("[data-sidebar-toggle]");
|
|
5848
|
-
i.innerHTML =
|
|
5848
|
+
i.innerHTML = M("chevron");
|
|
5849
5849
|
const r = i.querySelector("svg"), n = `${e}Width`, a = () => {
|
|
5850
5850
|
const d = this.root.dataset[`${e}Collapsed`] === "true";
|
|
5851
5851
|
t.classList.toggle("is-collapsed", d), this.root.style.setProperty(`--${e}-width`, d ? "0px" : this.root.dataset[n] ? `${this.root.dataset[n]}px` : e === "left" ? "clamp(220px, 23vw, 270px)" : "clamp(260px, 27vw, 320px)"), i.setAttribute("aria-expanded", String(!d)), i.setAttribute("aria-label", `${d ? "展开" : "收起"}${e === "left" ? "左" : "右"}侧面板`), r.style.transform = `rotate(${e === "left" !== d ? 180 : 0}deg)`;
|
|
@@ -5872,7 +5872,7 @@ class Zs {
|
|
|
5872
5872
|
});
|
|
5873
5873
|
}
|
|
5874
5874
|
}
|
|
5875
|
-
const
|
|
5875
|
+
const Qs = `
|
|
5876
5876
|
.vurdf-shell{--vurdf-accent:#55d6b3;--vurdf-accent-strong:#72e5c6;--vurdf-accent-soft:rgba(85,214,179,.12);--vurdf-bg:#080d0f;--vurdf-panel:#0e1416;--vurdf-panel-raised:#141b1d;--vurdf-border:#283235;--vurdf-text:#e7ecea;--vurdf-muted:#75817f;--vurdf-hover:#1b2426;position:absolute;inset:0;pointer-events:none;color:var(--vurdf-text);font:12px/1.4 'Segoe UI','Microsoft YaHei UI',system-ui,sans-serif}.vurdf-shell[data-theme=light]{--vurdf-accent:#168c70;--vurdf-accent-strong:#08755d;--vurdf-accent-soft:rgba(22,140,112,.13);--vurdf-bg:#eef3f1;--vurdf-panel:#f8faf9;--vurdf-panel-raised:#eef3f1;--vurdf-border:#cfd9d6;--vurdf-text:#1f2927;--vurdf-muted:#687572;--vurdf-hover:#e5ece9}.vurdf-shell *{box-sizing:border-box}.vurdf-shell svg{fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round}
|
|
5877
5877
|
.vurdf-side{position:absolute;top:0;bottom:27px;width:270px;background:var(--vurdf-panel);pointer-events:auto;z-index:7;display:flex;flex-direction:column;min-height:0}.vurdf-left{left:0;border-right:1px solid var(--vurdf-border)}.vurdf-right{right:0;width:320px;border-left:1px solid var(--vurdf-border)}.vurdf-head{height:52px;flex:0 0 52px;display:flex;align-items:center;justify-content:space-between;padding:0 12px;border-bottom:1px solid var(--vurdf-border)}.vurdf-head strong{font-size:12px}.vurdf-head span{display:block;color:var(--vurdf-muted);font-size:9px}
|
|
5878
5878
|
.vurdf-search{height:31px;margin:9px;border:1px solid var(--vurdf-border);border-radius:5px;background:var(--vurdf-panel-raised);display:flex;align-items:center;gap:7px;padding:0 8px}.vurdf-search:focus-within{border-color:var(--vurdf-accent)}.vurdf-search svg{width:14px;color:var(--vurdf-muted)}.vurdf-search input{appearance:none;box-shadow:none!important;min-width:0;flex:1;border:0!important;outline:0!important;background:transparent;color:var(--vurdf-text);font:11px inherit}.vurdf-filters{display:flex;gap:5px;padding:0 9px 8px;border-bottom:1px solid var(--vurdf-border)}.vurdf-chip{height:23px;border:1px solid var(--vurdf-border);border-radius:5px;background:transparent;color:var(--vurdf-muted);font-size:9px;padding:0 7px;cursor:pointer}.vurdf-chip.is-active{color:var(--vurdf-text);background:var(--vurdf-panel-raised)}
|
|
@@ -5997,17 +5997,17 @@ const Js = `
|
|
|
5997
5997
|
|
|
5998
5998
|
.vurdf-diagram button:focus-visible{outline:2px solid var(--vurdf-accent)}
|
|
5999
5999
|
@media(max-width:600px){.vurdf-diagram{width:calc(100% - 16px);height:calc(100% - 60px)}}
|
|
6000
|
-
`,
|
|
6001
|
-
function
|
|
6000
|
+
`, en = "urdf";
|
|
6001
|
+
function tn(s) {
|
|
6002
6002
|
let e = null, t = null, i = null, r = null, n = null, a = null;
|
|
6003
6003
|
const o = [];
|
|
6004
6004
|
return {
|
|
6005
6005
|
id: "nebula.ui.urdf",
|
|
6006
6006
|
activate(l) {
|
|
6007
6007
|
var p;
|
|
6008
|
-
t = document.createElement("style"), t.dataset.viewerUrdfUi = "", t.textContent =
|
|
6008
|
+
t = document.createElement("style"), t.dataset.viewerUrdfUi = "", t.textContent = Qs, (p = s.shadowRoot()) == null || p.append(t);
|
|
6009
6009
|
const d = document.createElement("div");
|
|
6010
|
-
d.className = "vurdf-shell", d.hidden = !0, e = s.mountBuiltin(d, { zone: "overlay", group:
|
|
6010
|
+
d.className = "vurdf-shell", d.hidden = !0, e = s.mountBuiltin(d, { zone: "overlay", group: en });
|
|
6011
6011
|
const c = () => {
|
|
6012
6012
|
var f;
|
|
6013
6013
|
const h = l.asset.$inspection();
|
|
@@ -6019,7 +6019,7 @@ function en(s) {
|
|
|
6019
6019
|
d.hidden = !0;
|
|
6020
6020
|
return;
|
|
6021
6021
|
}
|
|
6022
|
-
d.hidden = !1, i = new
|
|
6022
|
+
d.hidden = !1, i = new Js(d, h, l, s.theme(), s.cameraQuaternion, (f = s.interactionCanvas) == null ? void 0 : f.call(s), s.interactionCamera), r = h.subscribe((v) => i == null ? void 0 : i.render(v)), i.render(h.getSnapshot());
|
|
6023
6023
|
};
|
|
6024
6024
|
n = s.onThemeChange((h) => i == null ? void 0 : i.setTheme(h)), o.push(
|
|
6025
6025
|
l.events.on("asset-change", c),
|
|
@@ -6045,7 +6045,7 @@ function en(s) {
|
|
|
6045
6045
|
}
|
|
6046
6046
|
};
|
|
6047
6047
|
}
|
|
6048
|
-
function
|
|
6048
|
+
function rn(s) {
|
|
6049
6049
|
let e = s;
|
|
6050
6050
|
for (; e; ) {
|
|
6051
6051
|
if (typeof e.userData.urdfEntityId == "string") return e.userData.urdfEntityId;
|
|
@@ -6055,10 +6055,10 @@ function tn(s) {
|
|
|
6055
6055
|
}
|
|
6056
6056
|
function ft(s, e) {
|
|
6057
6057
|
var n;
|
|
6058
|
-
const t =
|
|
6058
|
+
const t = rn(e), i = s.getSnapshot(), r = i.nodes.find((a) => a.id === t && a.kind === "link");
|
|
6059
6059
|
return r ? ((n = i.nodes.find((a) => a.kind === "joint" && a.childLink === r.name)) == null ? void 0 : n.id) ?? t : t;
|
|
6060
6060
|
}
|
|
6061
|
-
class
|
|
6061
|
+
class sn {
|
|
6062
6062
|
constructor(e, t, i, r, n, a, o, l = null, d = () => null) {
|
|
6063
6063
|
u(this, "pluginsById", /* @__PURE__ */ new Map());
|
|
6064
6064
|
u(this, "contributions", []);
|
|
@@ -6266,7 +6266,7 @@ class rn {
|
|
|
6266
6266
|
n.dataset.viewerContribution = "toolbar", n.dataset.viewerContributionId = t.id;
|
|
6267
6267
|
for (const a of t.items) {
|
|
6268
6268
|
const o = document.createElement("button");
|
|
6269
|
-
o.type = "button", a.icon ? (o.insertAdjacentHTML("afterbegin",
|
|
6269
|
+
o.type = "button", a.icon ? (o.insertAdjacentHTML("afterbegin", nn(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);
|
|
6270
6270
|
}
|
|
6271
6271
|
this.hostElement.append(n), e.cleanup = () => n.remove();
|
|
6272
6272
|
return;
|
|
@@ -6325,12 +6325,12 @@ class rn {
|
|
|
6325
6325
|
if (this.disposed) throw new Error("Viewer plugin manager has been disposed.");
|
|
6326
6326
|
}
|
|
6327
6327
|
}
|
|
6328
|
-
function
|
|
6328
|
+
function nn(s) {
|
|
6329
6329
|
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${s}</svg>`;
|
|
6330
6330
|
}
|
|
6331
|
-
function
|
|
6331
|
+
function an(s, e, t) {
|
|
6332
6332
|
var p;
|
|
6333
|
-
const i =
|
|
6333
|
+
const i = dn(s), r = ln([t, e.signal, i]), n = ((p = e.filename) == null ? void 0 : p.trim()) || un(s), a = Ae(s) ? pn(s.files, s.entry, n) : n, o = Vt(s), l = e.baseUrl ?? hn(o), d = /* @__PURE__ */ new Set(), c = Ae(s) ? new Map(s.files.map((h) => [V(h.path), h])) : null;
|
|
6334
6334
|
return Object.freeze({
|
|
6335
6335
|
original: s,
|
|
6336
6336
|
entryPath: a,
|
|
@@ -6341,17 +6341,17 @@ function nn(s, e, t) {
|
|
|
6341
6341
|
hasResourceResolver: !!e.resourceResolver,
|
|
6342
6342
|
async resolve(h) {
|
|
6343
6343
|
mt(r);
|
|
6344
|
-
const f = V(h), v =
|
|
6344
|
+
const f = V(h), v = cn(s);
|
|
6345
6345
|
if (v && (!f || f === V(a ?? ""))) {
|
|
6346
6346
|
const b = URL.createObjectURL(v);
|
|
6347
6347
|
return d.add(b), b;
|
|
6348
6348
|
}
|
|
6349
|
-
const y = (c == null ? void 0 : c.get(f)) ??
|
|
6349
|
+
const y = (c == null ? void 0 : c.get(f)) ?? fn(c, a, f);
|
|
6350
6350
|
if (y) {
|
|
6351
6351
|
const b = URL.createObjectURL(y.file);
|
|
6352
6352
|
return d.add(b), b;
|
|
6353
6353
|
}
|
|
6354
|
-
const m = await
|
|
6354
|
+
const m = await mn(e.resourceResolver, h, r);
|
|
6355
6355
|
if (mt(r), m instanceof Blob) {
|
|
6356
6356
|
const b = URL.createObjectURL(m);
|
|
6357
6357
|
return d.add(b), b;
|
|
@@ -6364,7 +6364,7 @@ function nn(s, e, t) {
|
|
|
6364
6364
|
}
|
|
6365
6365
|
});
|
|
6366
6366
|
}
|
|
6367
|
-
function
|
|
6367
|
+
function on(s) {
|
|
6368
6368
|
var r;
|
|
6369
6369
|
const e = s.entryPath ?? s.url;
|
|
6370
6370
|
if (!e) return null;
|
|
@@ -6381,7 +6381,7 @@ function an(s) {
|
|
|
6381
6381
|
const i = /\.([a-z0-9]+)$/i.exec(t);
|
|
6382
6382
|
return ((r = i == null ? void 0 : i[1]) == null ? void 0 : r.toLowerCase()) ?? null;
|
|
6383
6383
|
}
|
|
6384
|
-
function
|
|
6384
|
+
function ln(s) {
|
|
6385
6385
|
const e = s.filter((r) => !!r);
|
|
6386
6386
|
if (e.length === 0) return new AbortController().signal;
|
|
6387
6387
|
if (e.length === 1) return e[0];
|
|
@@ -6400,16 +6400,16 @@ function mt(s) {
|
|
|
6400
6400
|
if (s.aborted)
|
|
6401
6401
|
throw typeof s.throwIfAborted == "function" && s.throwIfAborted(), new DOMException("The operation was aborted.", "AbortError");
|
|
6402
6402
|
}
|
|
6403
|
-
function
|
|
6403
|
+
function dn(s) {
|
|
6404
6404
|
return typeof s == "object" && s !== null && "signal" in s ? s.signal : void 0;
|
|
6405
6405
|
}
|
|
6406
6406
|
function Vt(s) {
|
|
6407
6407
|
return typeof s == "string" ? s : typeof URL < "u" && s instanceof URL ? s.href : typeof s == "object" && s !== null && "kind" in s && s.kind === "url" ? s.url : null;
|
|
6408
6408
|
}
|
|
6409
|
-
function
|
|
6409
|
+
function cn(s) {
|
|
6410
6410
|
return typeof Blob < "u" && s instanceof Blob ? s : s instanceof ArrayBuffer ? new Blob([s]) : typeof s == "object" && s !== null && "kind" in s && s.kind === "buffer" ? new Blob([s.buffer]) : null;
|
|
6411
6411
|
}
|
|
6412
|
-
function
|
|
6412
|
+
function un(s) {
|
|
6413
6413
|
var t;
|
|
6414
6414
|
const e = Vt(s);
|
|
6415
6415
|
if (e)
|
|
@@ -6420,7 +6420,7 @@ function cn(s) {
|
|
|
6420
6420
|
}
|
|
6421
6421
|
return Ae(s) ? s.entry ?? null : typeof File < "u" && s instanceof File && s.name || null;
|
|
6422
6422
|
}
|
|
6423
|
-
function
|
|
6423
|
+
function hn(s) {
|
|
6424
6424
|
var e;
|
|
6425
6425
|
if (!s) return null;
|
|
6426
6426
|
try {
|
|
@@ -6432,7 +6432,7 @@ function un(s) {
|
|
|
6432
6432
|
function Ae(s) {
|
|
6433
6433
|
return typeof s == "object" && s !== null && "kind" in s && s.kind === "files";
|
|
6434
6434
|
}
|
|
6435
|
-
function
|
|
6435
|
+
function pn(s, e, t) {
|
|
6436
6436
|
if (e) {
|
|
6437
6437
|
const i = V(e);
|
|
6438
6438
|
if (!s.some((r) => V(r.path) === i))
|
|
@@ -6446,7 +6446,7 @@ function hn(s, e, t) {
|
|
|
6446
6446
|
if (s.length === 1) return V(s[0].path);
|
|
6447
6447
|
throw vt("Asset package has multiple files; specify an entry.", "E_ASSET_AMBIGUOUS_ENTRY");
|
|
6448
6448
|
}
|
|
6449
|
-
function
|
|
6449
|
+
function fn(s, e, t) {
|
|
6450
6450
|
if (!s || !e) return;
|
|
6451
6451
|
const i = e.lastIndexOf("/"), r = i < 0 ? "" : e.slice(0, i + 1);
|
|
6452
6452
|
return s.get(V(`${r}${t}`));
|
|
@@ -6457,7 +6457,7 @@ function V(s) {
|
|
|
6457
6457
|
!t || t === "." || (t === ".." ? e.pop() : e.push(t));
|
|
6458
6458
|
return e.join("/");
|
|
6459
6459
|
}
|
|
6460
|
-
async function
|
|
6460
|
+
async function mn(s, e, t) {
|
|
6461
6461
|
return s ? s.resolve(e, { signal: t }) : null;
|
|
6462
6462
|
}
|
|
6463
6463
|
function vt(s, e) {
|
|
@@ -6473,8 +6473,8 @@ const gt = Object.freeze({
|
|
|
6473
6473
|
}), q = Object.freeze({
|
|
6474
6474
|
light: 15265002,
|
|
6475
6475
|
dark: 593167
|
|
6476
|
-
}),
|
|
6477
|
-
class
|
|
6476
|
+
}), vn = 0.05;
|
|
6477
|
+
class gn {
|
|
6478
6478
|
constructor(e) {
|
|
6479
6479
|
u(this, "epoch", 0);
|
|
6480
6480
|
u(this, "active", null);
|
|
@@ -6605,7 +6605,7 @@ class vn {
|
|
|
6605
6605
|
var r;
|
|
6606
6606
|
const t = this.active;
|
|
6607
6607
|
if (!t || !this.current(t) || t.snapshot.phase !== "ready" || !t.dynamic || !t.playing || !((r = t.session) != null && r.update)) return !1;
|
|
6608
|
-
const i = t.resetFrameClock ? 0 : Math.max(0, Math.min(Number.isNaN(e) ? 0 : e,
|
|
6608
|
+
const i = t.resetFrameClock ? 0 : Math.max(0, Math.min(Number.isNaN(e) ? 0 : e, vn));
|
|
6609
6609
|
t.resetFrameClock = !1;
|
|
6610
6610
|
try {
|
|
6611
6611
|
return !!(t.session.update(i) && this.current(t) && t.snapshot.phase === "ready" && t.playing);
|
|
@@ -6620,7 +6620,7 @@ class vn {
|
|
|
6620
6620
|
var i, r;
|
|
6621
6621
|
try {
|
|
6622
6622
|
if (!this.current(e)) return;
|
|
6623
|
-
e.source =
|
|
6623
|
+
e.source = an(t, e.options, e.abort.signal);
|
|
6624
6624
|
const n = e.source.signal, a = () => {
|
|
6625
6625
|
this.stop(e, "E_ABORTED");
|
|
6626
6626
|
};
|
|
@@ -6700,7 +6700,7 @@ class vn {
|
|
|
6700
6700
|
}
|
|
6701
6701
|
}
|
|
6702
6702
|
detect(e) {
|
|
6703
|
-
const t = e.source, i = this.host.loaders(), r = e.options.format, n =
|
|
6703
|
+
const t = e.source, i = this.host.loaders(), r = e.options.format, n = on(t), a = r && r !== "auto" ? r : n && ["dxb", "dxb3"].includes(n) ? "cad" : n;
|
|
6704
6704
|
if (a) {
|
|
6705
6705
|
const o = i.find((l) => l.formats.includes(a));
|
|
6706
6706
|
if (o) return { loader: o, format: a };
|
|
@@ -7003,7 +7003,7 @@ function T(s, e) {
|
|
|
7003
7003
|
function bt(s) {
|
|
7004
7004
|
return !!(s && typeof s.then == "function");
|
|
7005
7005
|
}
|
|
7006
|
-
const
|
|
7006
|
+
const bn = {
|
|
7007
7007
|
id: "nebula-asset-model",
|
|
7008
7008
|
activate(s) {
|
|
7009
7009
|
s.contribute({
|
|
@@ -7021,13 +7021,13 @@ const gn = {
|
|
|
7021
7021
|
clearColor: q.dark
|
|
7022
7022
|
},
|
|
7023
7023
|
async createSession(e, t) {
|
|
7024
|
-
const { createModelSession: i } = await import("./session-
|
|
7024
|
+
const { createModelSession: i } = await import("./session-BzIziNzg.js");
|
|
7025
7025
|
return i(e, t);
|
|
7026
7026
|
}
|
|
7027
7027
|
});
|
|
7028
7028
|
}
|
|
7029
7029
|
};
|
|
7030
|
-
function
|
|
7030
|
+
function yn(s, e, t) {
|
|
7031
7031
|
let i = !1, r = !1;
|
|
7032
7032
|
const n = {
|
|
7033
7033
|
...t.options.cad,
|
|
@@ -7056,7 +7056,7 @@ function bn(s, e, t) {
|
|
|
7056
7056
|
}
|
|
7057
7057
|
};
|
|
7058
7058
|
}
|
|
7059
|
-
function
|
|
7059
|
+
function xn(s) {
|
|
7060
7060
|
return {
|
|
7061
7061
|
id: "nebula-asset-cad",
|
|
7062
7062
|
activate(e) {
|
|
@@ -7071,24 +7071,24 @@ function yn(s) {
|
|
|
7071
7071
|
uiProfile: "cad",
|
|
7072
7072
|
fitPolicy: "restore-then-fit"
|
|
7073
7073
|
},
|
|
7074
|
-
createSession: (t, i) =>
|
|
7074
|
+
createSession: (t, i) => yn(s, t, i)
|
|
7075
7075
|
});
|
|
7076
7076
|
}
|
|
7077
7077
|
};
|
|
7078
7078
|
}
|
|
7079
|
-
function
|
|
7079
|
+
function wn(s) {
|
|
7080
7080
|
const e = s.replace(/^\uFEFF/, "").replace(/^\s*(?:<\?[\s\S]*?\?>\s*)?/, "").replace(/^(?:<!--[\s\S]*?-->\s*)*/, "");
|
|
7081
7081
|
return /^<\s*mujoco(?:\s|>)/i.test(e) ? "mjcf" : /^<\s*robot(?:\s|>)/i.test(e) ? "urdf" : null;
|
|
7082
7082
|
}
|
|
7083
|
-
async function
|
|
7083
|
+
async function Cn(s) {
|
|
7084
7084
|
const e = s.entryPath ?? s.filename ?? s.url ?? "";
|
|
7085
7085
|
if (!e.toLowerCase().split(/[?#]/, 1)[0].endsWith(".xml")) return null;
|
|
7086
7086
|
const t = await s.resolve(e), i = await fetch(t, { signal: s.signal });
|
|
7087
7087
|
if (!i.ok) return null;
|
|
7088
|
-
const r =
|
|
7088
|
+
const r = wn(await i.text());
|
|
7089
7089
|
return r ? { format: r } : null;
|
|
7090
7090
|
}
|
|
7091
|
-
const
|
|
7091
|
+
const En = {
|
|
7092
7092
|
id: "nebula-asset-simulation",
|
|
7093
7093
|
activate(s) {
|
|
7094
7094
|
s.contribute({
|
|
@@ -7096,7 +7096,7 @@ const Cn = {
|
|
|
7096
7096
|
id: "nebula.simulation-loader",
|
|
7097
7097
|
assetKind: "simulation",
|
|
7098
7098
|
formats: ["urdf", "xacro", "mjcf", "usd", "usda", "usdc", "usdz"],
|
|
7099
|
-
match:
|
|
7099
|
+
match: Cn,
|
|
7100
7100
|
presentation: {
|
|
7101
7101
|
preferredViewMode: "3d",
|
|
7102
7102
|
interactionMode: "simulation",
|
|
@@ -7105,7 +7105,7 @@ const Cn = {
|
|
|
7105
7105
|
clearColor: q.dark
|
|
7106
7106
|
},
|
|
7107
7107
|
async createSession(e, t) {
|
|
7108
|
-
const { createSimulationSession: i } = await import("./session-
|
|
7108
|
+
const { createSimulationSession: i } = await import("./session-Boljcc3d.js").then((r) => r.f);
|
|
7109
7109
|
return i(e, t);
|
|
7110
7110
|
}
|
|
7111
7111
|
});
|
|
@@ -7119,8 +7119,8 @@ const Cn = {
|
|
|
7119
7119
|
hover: { color: 24524, fillOpacity: 0, edgeOpacity: 0.95 },
|
|
7120
7120
|
selected: { color: 24524, fillOpacity: 0.2, edgeOpacity: 1 }
|
|
7121
7121
|
}
|
|
7122
|
-
}, Sn = 6,
|
|
7123
|
-
class
|
|
7122
|
+
}, Sn = 6, kn = 12, Pn = 160, An = 160, Rn = 50, xt = 592655;
|
|
7123
|
+
class In {
|
|
7124
7124
|
constructor(e, t) {
|
|
7125
7125
|
u(this, "cad");
|
|
7126
7126
|
u(this, "mountedObjects", /* @__PURE__ */ new Set());
|
|
@@ -7136,9 +7136,9 @@ class Mn {
|
|
|
7136
7136
|
u(this, "interactionRenderLastTs", null);
|
|
7137
7137
|
u(this, "cadHoveredInsert", null);
|
|
7138
7138
|
u(this, "cadPointerPosition", null);
|
|
7139
|
-
u(this, "pointerDragTracker", new
|
|
7139
|
+
u(this, "pointerDragTracker", new Nr({
|
|
7140
7140
|
distancePx: Sn,
|
|
7141
|
-
pathPx:
|
|
7141
|
+
pathPx: kn
|
|
7142
7142
|
}));
|
|
7143
7143
|
u(this, "cadCapability");
|
|
7144
7144
|
u(this, "cadHost");
|
|
@@ -7264,7 +7264,7 @@ class Mn {
|
|
|
7264
7264
|
this.pointerStart = null, this.cadPointerPosition = null, this.pointerDragTracker.reset(), this.setCadHoveredInsert(null), this.interactionMode !== "disabled" && this.pluginManager.dispatchInteraction("onHover", null), this.scheduleInteractionIdle(), !this.disposed && this.emit("pointer-leave", this.toPointerEvent(e));
|
|
7265
7265
|
});
|
|
7266
7266
|
var i, r, n, a, o, l, d, c, p, h, f, v, y, m, b;
|
|
7267
|
-
this.options = e, this.runtime = t, this.cameraStateStore = e.cameraStateStore === !1 ? void 0 : e.cameraStateStore ??
|
|
7267
|
+
this.options = e, this.runtime = t, this.cameraStateStore = e.cameraStateStore === !1 ? void 0 : e.cameraStateStore ?? pr(), this.interactionMode = e.cadInteraction ?? "managed", e.previewDragPreset && this.runtime.setPreviewDragPreset(e.previewDragPreset), this.uiTheme = ((i = e.ui) == null ? void 0 : i.theme) ?? "dark", this.cadHost = this.createCadHost(), this.cadCapability = new Mr(this.cadHost), this.cad = this.cadCapability, this.cadCapability.open = async (g, x = {}) => {
|
|
7268
7268
|
this.assertActive();
|
|
7269
7269
|
const { filename: w, signal: C, ...D } = x;
|
|
7270
7270
|
await this.assetController.open(g, { format: "cad", filename: w, signal: C, cad: D }, !0).ready;
|
|
@@ -7273,7 +7273,7 @@ class Mn {
|
|
|
7273
7273
|
return A;
|
|
7274
7274
|
}, this.cadCapability.close = () => {
|
|
7275
7275
|
this.assertActive(), this.assetController.closeKind("cad");
|
|
7276
|
-
}, this.initialCameraSnapshot = t.captureCameraSnapshot(), this.lastCameraFingerprint = xe(this.initialCameraSnapshot), this.layoutEngine = this.createLayoutEngine(), this.pluginManager = new
|
|
7276
|
+
}, this.initialCameraSnapshot = t.captureCameraSnapshot(), this.lastCameraFingerprint = xe(this.initialCameraSnapshot), this.layoutEngine = this.createLayoutEngine(), this.pluginManager = new sn(
|
|
7277
7277
|
() => this.cadCapability.getSnapshot(),
|
|
7278
7278
|
() => ({
|
|
7279
7279
|
viewMode: this.runtime.viewMode,
|
|
@@ -7307,7 +7307,7 @@ class Mn {
|
|
|
7307
7307
|
e.viewport,
|
|
7308
7308
|
this.layoutEngine,
|
|
7309
7309
|
() => this.assetController.getActiveInspection()
|
|
7310
|
-
), this.assetController = new
|
|
7310
|
+
), this.assetController = new gn({
|
|
7311
7311
|
loaders: () => this.pluginManager.getAssetLoaders(),
|
|
7312
7312
|
mount: (g) => this.mountAssetObject(g),
|
|
7313
7313
|
detach: (g) => this.unmountAssetObject(g),
|
|
@@ -7320,14 +7320,14 @@ class Mn {
|
|
|
7320
7320
|
cleanupError: (g) => {
|
|
7321
7321
|
this.options.onCleanupError ? this.options.onCleanupError(g) : console.error("[viewer] asset cleanup failed", g);
|
|
7322
7322
|
}
|
|
7323
|
-
}), this.pluginManager.registerBuiltin(
|
|
7323
|
+
}), this.pluginManager.registerBuiltin(xn(this.cadCapability)), this.pluginManager.registerBuiltin(bn), this.pluginManager.registerBuiltin(En), this.pluginManager.onAssetLoaderRemoved((g) => this.assetController.removeLoader(g)), this.cadInspectorUnsubscribe = this.cad.on("inspector-change", () => {
|
|
7324
7324
|
this.interactionMode === "managed" && (this.syncCadSelectionOverlay(), this.syncCadHoverOverlay()), this.dispatchCadSelectionChange();
|
|
7325
7325
|
}), this.cadDocumentUnsubscribe = this.cad.on("document-change", () => {
|
|
7326
7326
|
this.setCadHoveredInsert(null), this.interactionMode === "managed" && this.syncCadSelectionOverlay();
|
|
7327
7327
|
}), this.assetChangeUnsubscribe = this.on("asset-change", (g) => {
|
|
7328
7328
|
const x = g.snapshot.phase;
|
|
7329
7329
|
(x === "closing" || x === "failed" || x === "closed") && this.endAssetGrab();
|
|
7330
|
-
}), e.ui && e.ui.preset !== "none" && (e.ui.preset !== "cad-readonly" && this.interactionMode === "managed" && this.pluginManager.registerBuiltin(
|
|
7330
|
+
}), e.ui && e.ui.preset !== "none" && (e.ui.preset !== "cad-readonly" && this.interactionMode === "managed" && this.pluginManager.registerBuiltin(Rs(
|
|
7331
7331
|
{
|
|
7332
7332
|
mountBuiltin: (g, x) => this.layoutEngine.mountBuiltin(g, x),
|
|
7333
7333
|
shadowRoot: () => this.builtinUiShadow(),
|
|
@@ -7339,7 +7339,7 @@ class Mn {
|
|
|
7339
7339
|
label: (g) => g === "simulation" ? "仿真控制" : "模型控制",
|
|
7340
7340
|
scene: e.ui.scene
|
|
7341
7341
|
}
|
|
7342
|
-
)), e.ui.urdf !== !1 && this.interactionMode === "managed" && this.pluginManager.registerBuiltin(
|
|
7342
|
+
)), e.ui.urdf !== !1 && this.interactionMode === "managed" && this.pluginManager.registerBuiltin(tn({
|
|
7343
7343
|
interactionCanvas: () => this.options.canvas,
|
|
7344
7344
|
interactionCamera: () => this.runtime.getActiveCamera(),
|
|
7345
7345
|
cameraQuaternion: () => this.runtime.getActiveCamera().quaternion.clone(),
|
|
@@ -7350,13 +7350,13 @@ class Mn {
|
|
|
7350
7350
|
})), this.interactionMode === "managed" && this.pluginManager.register({
|
|
7351
7351
|
id: "nebula.ui.cad",
|
|
7352
7352
|
activate: () => {
|
|
7353
|
-
this.ui = new
|
|
7353
|
+
this.ui = new ps(this.createUiHost(), e.ui), this.ui.mount();
|
|
7354
7354
|
},
|
|
7355
7355
|
deactivate: () => {
|
|
7356
7356
|
var g;
|
|
7357
7357
|
(g = this.ui) == null || g.dispose(), this.ui = null;
|
|
7358
7358
|
}
|
|
7359
|
-
})), (n = (r = this.options.canvas).addEventListener) == null || n.call(r, "pointerdown", this.handlePointerDown), (o = (a = this.options.canvas).addEventListener) == null || o.call(a, "pointermove", this.handlePointerMove), (d = (l = this.options.canvas).addEventListener) == null || d.call(l, "pointerup", this.handlePointerUp), (p = (c = this.options.canvas).addEventListener) == null || p.call(c, "pointercancel", this.handlePointerCancel), (f = (h = this.options.canvas).addEventListener) == null || f.call(h, "pointerleave", this.handlePointerLeave), (y = (v = this.options.canvas).addEventListener) == null || y.call(v, "lostpointercapture", this.handleLostPointerCapture), (b = (m = this.options.canvas).addEventListener) == null || b.call(m, "wheel", this.handleWheel, { passive: !0 }), typeof globalThis.window < "u" && globalThis.window.addEventListener("blur", this.handleWindowBlur), typeof ResizeObserver == "function" &&
|
|
7359
|
+
})), (n = (r = this.options.canvas).addEventListener) == null || n.call(r, "pointerdown", this.handlePointerDown), (o = (a = this.options.canvas).addEventListener) == null || o.call(a, "pointermove", this.handlePointerMove), (d = (l = this.options.canvas).addEventListener) == null || d.call(l, "pointerup", this.handlePointerUp), (p = (c = this.options.canvas).addEventListener) == null || p.call(c, "pointercancel", this.handlePointerCancel), (f = (h = this.options.canvas).addEventListener) == null || f.call(h, "pointerleave", this.handlePointerLeave), (y = (v = this.options.canvas).addEventListener) == null || y.call(v, "lostpointercapture", this.handleLostPointerCapture), (b = (m = this.options.canvas).addEventListener) == null || b.call(m, "wheel", this.handleWheel, { passive: !0 }), typeof globalThis.window < "u" && globalThis.window.addEventListener("blur", this.handleWindowBlur), typeof ResizeObserver == "function" && On(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({
|
|
7360
7360
|
renderExtension: { beforeRender: (g, x, w) => this.assetController.beforeRender(g, x, w) },
|
|
7361
7361
|
onFrame: (g, x) => {
|
|
7362
7362
|
this.assetController.update(x) && this.runtime.requestRender();
|
|
@@ -7488,7 +7488,7 @@ class Mn {
|
|
|
7488
7488
|
setHighlight(e, t = {}) {
|
|
7489
7489
|
if (this.assertActive(), e && this.assertMounted(e), !(this.highlightedObjectValue === null && e === null)) {
|
|
7490
7490
|
if (this.runtime.removeOverlay(ae), this.highlightedObjectValue = e, e) {
|
|
7491
|
-
const i = new
|
|
7491
|
+
const i = new Qt(e, t.color ?? 6000111);
|
|
7492
7492
|
i.name = ae, this.runtime.mountOverlay(ae, i, { owned: !0 });
|
|
7493
7493
|
}
|
|
7494
7494
|
this.emit("highlight-change", { object: e });
|
|
@@ -7542,7 +7542,7 @@ class Mn {
|
|
|
7542
7542
|
createLayoutEngine() {
|
|
7543
7543
|
var r;
|
|
7544
7544
|
const e = this, t = this.options, i = (r = t.ui) == null ? void 0 : r.insetTarget;
|
|
7545
|
-
return new
|
|
7545
|
+
return new gs({
|
|
7546
7546
|
reference: () => {
|
|
7547
7547
|
var n;
|
|
7548
7548
|
return ((n = t.ui) == null ? void 0 : n.root) ?? t.viewport;
|
|
@@ -7607,7 +7607,7 @@ class Mn {
|
|
|
7607
7607
|
return e.cadCapability.getVisibilityRevision();
|
|
7608
7608
|
},
|
|
7609
7609
|
get viewportDemandCoalesceMs() {
|
|
7610
|
-
return e.options.viewportDemandCoalesceMs ??
|
|
7610
|
+
return e.options.viewportDemandCoalesceMs ?? An;
|
|
7611
7611
|
},
|
|
7612
7612
|
mountCadObject(t) {
|
|
7613
7613
|
e.unmountCadObject(), e.runtime.addObject(t, { owned: !0 }), e.cadRenderRoot = t;
|
|
@@ -7646,10 +7646,10 @@ class Mn {
|
|
|
7646
7646
|
return ((n = e.runtime.screenToWorldOnPlane(t, i, r)) == null ? void 0 : n.clone()) ?? null;
|
|
7647
7647
|
},
|
|
7648
7648
|
readCameraSnapshot(t) {
|
|
7649
|
-
return
|
|
7649
|
+
return mr(e.cameraStateStore, t);
|
|
7650
7650
|
},
|
|
7651
7651
|
persistCameraSnapshot(t, i) {
|
|
7652
|
-
|
|
7652
|
+
vr(e.cameraStateStore, t, i);
|
|
7653
7653
|
},
|
|
7654
7654
|
getViewportSize() {
|
|
7655
7655
|
return {
|
|
@@ -7671,11 +7671,11 @@ class Mn {
|
|
|
7671
7671
|
e.details.bbox.maxX,
|
|
7672
7672
|
e.details.bbox.maxY
|
|
7673
7673
|
].every(Number.isFinite) ? e.details.bbox : null, i = t ? new F(
|
|
7674
|
-
new
|
|
7675
|
-
new
|
|
7674
|
+
new S(t.minX, t.minY, -0.01),
|
|
7675
|
+
new S(t.maxX, t.maxY, 0.01)
|
|
7676
7676
|
) : e.textDetails ? new F(
|
|
7677
|
-
new
|
|
7678
|
-
new
|
|
7677
|
+
new S(e.textDetails.x, e.textDetails.y, -0.01),
|
|
7678
|
+
new S(
|
|
7679
7679
|
e.textDetails.x + e.textDetails.content.length * e.textDetails.height * 0.6,
|
|
7680
7680
|
e.textDetails.y + e.textDetails.height,
|
|
7681
7681
|
0.01
|
|
@@ -7684,7 +7684,7 @@ class Mn {
|
|
|
7684
7684
|
if (!i || i.isEmpty()) return;
|
|
7685
7685
|
const r = !!((o = e.details) != null && o.bbox);
|
|
7686
7686
|
if (((d = (l = this.options.cadInteractionStyle) == null ? void 0 : l.selected) == null ? void 0 : d.enabled) === !1) return;
|
|
7687
|
-
const n = r ? this.createCadInteractionOverlay(i, "selected") : new
|
|
7687
|
+
const n = r ? this.createCadInteractionOverlay(i, "selected") : new ei(i, ((p = (c = this.options.cadInteractionStyle) == null ? void 0 : c.selected) == null ? void 0 : p.color) ?? yt.dark.selected.color);
|
|
7688
7688
|
n.name = U, this.runtime.mountOverlay(U, n, { owned: !0 });
|
|
7689
7689
|
}
|
|
7690
7690
|
dispatchCadSelectionChange() {
|
|
@@ -7707,13 +7707,13 @@ class Mn {
|
|
|
7707
7707
|
color: (n == null ? void 0 : n.color) ?? r.color,
|
|
7708
7708
|
fillOpacity: (n == null ? void 0 : n.fillOpacity) ?? r.fillOpacity,
|
|
7709
7709
|
edgeOpacity: (n == null ? void 0 : n.edgeOpacity) ?? r.edgeOpacity
|
|
7710
|
-
}, o = new
|
|
7710
|
+
}, o = new Et();
|
|
7711
7711
|
o.name = t === "hover" ? "cad-insert-hover" : "cad-insert-selected", o.renderOrder = t === "hover" ? 1300 : 1310;
|
|
7712
|
-
const l = e.getSize(new
|
|
7712
|
+
const l = e.getSize(new S()), d = e.getCenter(new S()), c = new ti(Math.max(l.x, 1e-6), Math.max(l.y, 1e-6), Math.max(l.z, 1e-3));
|
|
7713
7713
|
if (a.fillOpacity > 0) {
|
|
7714
|
-
const v = new
|
|
7714
|
+
const v = new ii(
|
|
7715
7715
|
c.clone(),
|
|
7716
|
-
new
|
|
7716
|
+
new ri({
|
|
7717
7717
|
color: a.color,
|
|
7718
7718
|
transparent: !0,
|
|
7719
7719
|
opacity: a.fillOpacity,
|
|
@@ -7723,9 +7723,9 @@ class Mn {
|
|
|
7723
7723
|
);
|
|
7724
7724
|
v.name = `${o.name}:fill`, v.position.copy(d), v.renderOrder = 1305, o.add(v);
|
|
7725
7725
|
}
|
|
7726
|
-
const p = new
|
|
7727
|
-
new
|
|
7728
|
-
new
|
|
7726
|
+
const p = new si(
|
|
7727
|
+
new ni(c),
|
|
7728
|
+
new ai({
|
|
7729
7729
|
color: a.color,
|
|
7730
7730
|
transparent: !0,
|
|
7731
7731
|
opacity: a.edgeOpacity,
|
|
@@ -7738,8 +7738,8 @@ class Mn {
|
|
|
7738
7738
|
cadInsertDetailsToBox(e) {
|
|
7739
7739
|
const t = e == null ? void 0 : e.bbox;
|
|
7740
7740
|
return !t || ![t.minX, t.minY, t.maxX, t.maxY].every(Number.isFinite) ? null : new F(
|
|
7741
|
-
new
|
|
7742
|
-
new
|
|
7741
|
+
new S(t.minX, t.minY, -0.01),
|
|
7742
|
+
new S(t.maxX, t.maxY, 0.01)
|
|
7743
7743
|
);
|
|
7744
7744
|
}
|
|
7745
7745
|
isSameCadInsertSelection(e, t) {
|
|
@@ -7829,7 +7829,7 @@ class Mn {
|
|
|
7829
7829
|
}
|
|
7830
7830
|
this.runtime.setClearColor(e.clearColor ?? this.options.clearColor ?? xt), this.runtime.setNavigationPolicy(
|
|
7831
7831
|
e.interactionMode === "object" || e.interactionMode === "simulation" ? "preview" : "viewer"
|
|
7832
|
-
), e.preferredViewMode && e.preferredViewMode !== this.runtime.viewMode && this.setViewMode(e.preferredViewMode, { preserveOrbit: !0 }), this.interactionMode = e.interactionMode === "cad-managed" ? this.options.cadInteraction ?? "managed" : e.interactionMode === "object" || e.interactionMode === "simulation" ? "disabled" : this.options.cadInteraction ?? "managed", this.layoutEngine.setActiveGroups(
|
|
7832
|
+
), e.preferredViewMode && e.preferredViewMode !== this.runtime.viewMode && this.setViewMode(e.preferredViewMode, { preserveOrbit: !0 }), this.interactionMode = e.interactionMode === "cad-managed" ? this.options.cadInteraction ?? "managed" : e.interactionMode === "object" || e.interactionMode === "simulation" ? "disabled" : this.options.cadInteraction ?? "managed", this.layoutEngine.setActiveGroups(Ln(e.uiProfile)), (t = this.ui) == null || t.setActive(e.uiProfile === "cad"), this.interactionMode !== "managed" ? (this.setCadHoveredInsert(null), this.runtime.removeOverlay(U), this.runtime.removeOverlay(j), this.cadCapability.clearSelection()) : this.syncCadSelectionOverlay();
|
|
7833
7833
|
}
|
|
7834
7834
|
resolveMixedBounds() {
|
|
7835
7835
|
const e = this.assetController.getActiveFitBounds();
|
|
@@ -7847,7 +7847,7 @@ class Mn {
|
|
|
7847
7847
|
applyCameraSnapshot(e, t) {
|
|
7848
7848
|
if (!Ie(e)) return !1;
|
|
7849
7849
|
const i = this.runtime.viewMode;
|
|
7850
|
-
return this.runtime.applyCameraSnapshot(e) ? (this.runtime.viewMode !== i && this.emit("view-mode-change", { viewMode: this.runtime.viewMode }), this.pendingCameraReason = t, this.cadCapability.onCameraChanged(t), this.refreshCadPointerHover(), !0) : !1;
|
|
7850
|
+
return this.runtime.applyCameraSnapshot(e) ? (this.runtime.resize(), this.runtime.viewMode !== i && this.emit("view-mode-change", { viewMode: this.runtime.viewMode }), this.pendingCameraReason = t, this.cadCapability.onCameraChanged(t), this.refreshCadPointerHover(), !0) : !1;
|
|
7851
7851
|
}
|
|
7852
7852
|
detectCameraChange(e = !1) {
|
|
7853
7853
|
const t = xe(this.runtime.captureCameraSnapshot());
|
|
@@ -7867,7 +7867,7 @@ class Mn {
|
|
|
7867
7867
|
shouldRenderCurrentFrame(e) {
|
|
7868
7868
|
if (this.assetController.isActivePreview || this.assetController.isActiveDynamicPlaying || this.interaction !== "active" || this.interactionRenderLastTs === null) return !0;
|
|
7869
7869
|
const t = e - this.interactionRenderLastTs;
|
|
7870
|
-
return t < 0 || t >=
|
|
7870
|
+
return t < 0 || t >= Rn;
|
|
7871
7871
|
}
|
|
7872
7872
|
markInteractionActive() {
|
|
7873
7873
|
this.clearInteractionIdleTimer(), this.setInteraction("active");
|
|
@@ -7875,7 +7875,7 @@ class Mn {
|
|
|
7875
7875
|
scheduleInteractionIdle() {
|
|
7876
7876
|
this.clearInteractionIdleTimer(), this.interactionIdleTimer = globalThis.setTimeout(() => {
|
|
7877
7877
|
this.interactionIdleTimer = null, this.setInteraction("idle"), this.refreshCadPointerHover();
|
|
7878
|
-
},
|
|
7878
|
+
}, Pn);
|
|
7879
7879
|
}
|
|
7880
7880
|
clearInteractionIdleTimer() {
|
|
7881
7881
|
this.interactionIdleTimer !== null && (globalThis.clearTimeout(this.interactionIdleTimer), this.interactionIdleTimer = null);
|
|
@@ -7950,8 +7950,8 @@ class Mn {
|
|
|
7950
7950
|
for (const i of this.listeners.get(e) ?? []) i(t);
|
|
7951
7951
|
}
|
|
7952
7952
|
}
|
|
7953
|
-
function
|
|
7954
|
-
const e = new
|
|
7953
|
+
function Jn(s) {
|
|
7954
|
+
const e = new ar({
|
|
7955
7955
|
canvasArea: s.viewport,
|
|
7956
7956
|
canvas: s.canvas,
|
|
7957
7957
|
clearColor: s.clearColor,
|
|
@@ -7962,23 +7962,83 @@ function Un(s) {
|
|
|
7962
7962
|
environment: s.environment ?? "room",
|
|
7963
7963
|
navigationPolicy: "viewer"
|
|
7964
7964
|
});
|
|
7965
|
-
return
|
|
7965
|
+
return Mn(s, e);
|
|
7966
7966
|
}
|
|
7967
|
-
function
|
|
7968
|
-
return e.initialize(), new
|
|
7967
|
+
function Mn(s, e) {
|
|
7968
|
+
return e.initialize(), new In(s, e);
|
|
7969
7969
|
}
|
|
7970
|
-
function
|
|
7971
|
-
return s === "cad" ?
|
|
7970
|
+
function Ln(s) {
|
|
7971
|
+
return s === "cad" ? Tn : s === "model" ? wt : s === "simulation" ? /* @__PURE__ */ new Set([...wt, "urdf"]) : Dn;
|
|
7972
7972
|
}
|
|
7973
|
-
const
|
|
7973
|
+
const Tn = /* @__PURE__ */ new Set(["cad"]), wt = /* @__PURE__ */ new Set(["scene"]), Dn = /* @__PURE__ */ new Set();
|
|
7974
7974
|
function xe(s) {
|
|
7975
7975
|
return s ? JSON.stringify(s) : null;
|
|
7976
7976
|
}
|
|
7977
|
-
function
|
|
7977
|
+
function On(s) {
|
|
7978
7978
|
return !!(s && typeof s == "object" && s.nodeType === 1);
|
|
7979
7979
|
}
|
|
7980
|
+
const zn = "E_ASSET_RESOURCE_NOT_FOUND", Nn = "E_ASSET_RESOURCE_INVALID", Fn = "E_ASSET_FETCH", Vn = "E_ASSET_EXTERNAL_DENIED", $n = "E_ASSET_AUTH", _n = /* @__PURE__ */ new Set([
|
|
7981
|
+
"png",
|
|
7982
|
+
"jpg",
|
|
7983
|
+
"jpeg",
|
|
7984
|
+
"webp",
|
|
7985
|
+
"avif",
|
|
7986
|
+
"gif",
|
|
7987
|
+
"bmp",
|
|
7988
|
+
"tga",
|
|
7989
|
+
"dds",
|
|
7990
|
+
"hdr",
|
|
7991
|
+
"exr",
|
|
7992
|
+
"ktx2"
|
|
7993
|
+
]), Bn = /* @__PURE__ */ new Set(["usd", "usda", "usdc", "usdz"]);
|
|
7994
|
+
function Un(s) {
|
|
7995
|
+
var t;
|
|
7996
|
+
return ((t = (s.split(/[?#]/, 1)[0] ?? s).split(".").pop()) == null ? void 0 : t.toLowerCase()) ?? "";
|
|
7997
|
+
}
|
|
7998
|
+
function Qn(s) {
|
|
7999
|
+
const e = Un(s);
|
|
8000
|
+
return _n.has(e) && !Bn.has(e);
|
|
8001
|
+
}
|
|
8002
|
+
function ea(s, e) {
|
|
8003
|
+
return Object.assign(new Error(s), { code: e });
|
|
8004
|
+
}
|
|
8005
|
+
function jn(s) {
|
|
8006
|
+
var i;
|
|
8007
|
+
if (s instanceof Error && s.name === "AbortError") return "aborted";
|
|
8008
|
+
const e = s == null ? void 0 : s.code;
|
|
8009
|
+
if (e === zn) return "missing";
|
|
8010
|
+
if (e === Nn) return "invalid";
|
|
8011
|
+
if (e === Fn) return "unavailable";
|
|
8012
|
+
if (e === $n || e === Vn) return "denied";
|
|
8013
|
+
const t = (i = /\((\d{3})\)/.exec(s instanceof Error ? s.message : "")) == null ? void 0 : i[1];
|
|
8014
|
+
return t === "404" || t === "410" ? "missing" : t === "401" || t === "403" ? "denied" : t != null && t.startsWith("5") ? "unavailable" : "unknown";
|
|
8015
|
+
}
|
|
8016
|
+
function ta(s) {
|
|
8017
|
+
const e = jn(s);
|
|
8018
|
+
return e === "missing" || e === "invalid" || e === "unavailable";
|
|
8019
|
+
}
|
|
8020
|
+
function $t(s, e) {
|
|
8021
|
+
return s && /\bhtml\b/i.test(s) ? `返回 HTML 页面(${s})` : s && !/^text\//i.test(s) ? null : /^\uFEFF?\s*(?:<!doctype\s+html|<html|<\?xml[^>]*\bhtml)/i.test(e) ? "返回 HTML 兜底页" : null;
|
|
8022
|
+
}
|
|
8023
|
+
function ia(s, e) {
|
|
8024
|
+
return e.byteLength ? $t(s, new TextDecoder().decode(e.subarray(0, 512))) : "响应内容为空";
|
|
8025
|
+
}
|
|
8026
|
+
async function ra(s) {
|
|
8027
|
+
return s.size ? $t(s.type, await s.slice(0, 512).text()) : "响应内容为空";
|
|
8028
|
+
}
|
|
7980
8029
|
export {
|
|
8030
|
+
zn as U,
|
|
7981
8031
|
q as V,
|
|
7982
|
-
|
|
7983
|
-
|
|
8032
|
+
$n as a,
|
|
8033
|
+
Fn as b,
|
|
8034
|
+
Nn as c,
|
|
8035
|
+
jn as d,
|
|
8036
|
+
ia as e,
|
|
8037
|
+
ea as f,
|
|
8038
|
+
Qn as g,
|
|
8039
|
+
ta as h,
|
|
8040
|
+
ra as i,
|
|
8041
|
+
Vn as j,
|
|
8042
|
+
Jn as k,
|
|
8043
|
+
mi as v
|
|
7984
8044
|
};
|