@nebula-spatial/viewer 0.5.5 → 0.5.7

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.
Files changed (35) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/README.md +142 -7
  3. package/USD-VISUAL-MATERIAL-SUPPORT.md +14 -3
  4. package/basis/basis_transcoder.js +19 -0
  5. package/basis/basis_transcoder.wasm +0 -0
  6. package/dist/assets/ground-grid.d.ts +6 -0
  7. package/dist/assets/types.d.ts +49 -0
  8. package/dist/assets/usd-worker-B-HuMXLo.js +1505 -0
  9. package/dist/collision-debug-B2CISPB9.js +792 -0
  10. package/dist/index-BTAC6njT.js +10123 -0
  11. package/dist/index.d.ts +10 -2
  12. package/dist/index.js +17 -12
  13. package/dist/inspection/types.d.ts +79 -2
  14. package/dist/{mjcf-visual-zWaLqVqd.js → mjcf-visual-BVT3h87h.js} +7 -7
  15. package/dist/mujoco-runtime-CAyK0LHM.js +698 -0
  16. package/dist/resources-CHhCm2f7.js +27 -0
  17. package/dist/session-BQ8eCFRL.js +786 -0
  18. package/dist/{session-DVCZX72J.js → session-Dwoi1H46.js} +6 -5
  19. package/dist/simulation/mujoco-wasm-module.d.ts +11 -0
  20. package/dist/simulation/openusd-wasm-module.d.ts +10 -0
  21. package/dist/simulation/usd-query.d.ts +50 -0
  22. package/dist/simulation/usd-resource-policy.d.ts +28 -0
  23. package/dist/{stage-DGMYxyAS.js → stage-DUC-YNhD.js} +158 -170
  24. package/dist/{urdf-session-CF8xOenk.js → urdf-session-E0Nnr4Vs.js} +559 -546
  25. package/dist/usd-session-BUD3KtCr.js +6875 -0
  26. package/dist/version.d.ts +1 -1
  27. package/dist/{xacro-DidnrxXF.js → xacro-F7rdDouN.js} +1 -1
  28. package/openusd/openusd-runtime-manifest.json +15 -0
  29. package/openusd/openusd_probe.js +14 -14
  30. package/openusd/openusd_probe.wasm +0 -0
  31. package/package.json +5 -2
  32. package/dist/index-bTlVsOHA.js +0 -8165
  33. package/dist/mujoco-runtime-DTxVmIzc.js +0 -349
  34. package/dist/session-CZghJvw6.js +0 -883
  35. package/dist/usd-session-DkwOFmds.js +0 -4254
@@ -0,0 +1,1505 @@
1
+ function Ie(e, t) {
2
+ return /^https?:$/.test(t.protocol) && e.origin === t.origin && !e.username && !e.password && e.pathname.startsWith(new URL(".", t).pathname);
3
+ }
4
+ function Le(e, t) {
5
+ for (const n of e) for (const a of n.shaders) for (const i of Object.values(a.inputs)) {
6
+ if (!i || typeof i != "object" || Array.isArray(i)) continue;
7
+ const r = i, s = [r.path, r.url, r.resolvedPath].find((c) => typeof c == "string" && c);
8
+ !s || /^(?:data|blob):/i.test(s) || /\.mdl(?:[?#].*)?$/i.test(s) || t(r, s);
9
+ }
10
+ }
11
+ function Ce(e, t, n) {
12
+ const a = [];
13
+ try {
14
+ return Le(e, (i, r) => {
15
+ if (t(r)) return;
16
+ const s = {};
17
+ for (const c of ["path", "resolvedPath", "url"])
18
+ c in i && (s[c] = i[c], delete i[c]);
19
+ a.push({ asset: i, values: s });
20
+ }), n();
21
+ } finally {
22
+ for (const { asset: i, values: r } of a) Object.assign(i, r);
23
+ }
24
+ }
25
+ const je = "E_ASSET_RESOURCE_NOT_FOUND", Me = "E_ASSET_RESOURCE_INVALID", Ve = "E_ASSET_FETCH", Ge = "E_ASSET_EXTERNAL_DENIED", Be = "E_ASSET_AUTH", Fe = /* @__PURE__ */ new Set([
26
+ "png",
27
+ "jpg",
28
+ "jpeg",
29
+ "webp",
30
+ "avif",
31
+ "gif",
32
+ "bmp",
33
+ "tga",
34
+ "dds",
35
+ "hdr",
36
+ "exr",
37
+ "ktx2"
38
+ ]), ze = /* @__PURE__ */ new Set(["usd", "usda", "usdc", "usdz"]);
39
+ function He(e) {
40
+ var n;
41
+ return ((n = (e.split(/[?#]/, 1)[0] ?? e).split(".").pop()) == null ? void 0 : n.toLowerCase()) ?? "";
42
+ }
43
+ function We(e) {
44
+ const t = He(e);
45
+ return Fe.has(t) && !ze.has(t);
46
+ }
47
+ function Xe(e, t) {
48
+ return Object.assign(new Error(e), { code: t });
49
+ }
50
+ function Je(e) {
51
+ var a;
52
+ if (e instanceof Error && e.name === "AbortError") return "aborted";
53
+ const t = e == null ? void 0 : e.code;
54
+ if (t === je) return "missing";
55
+ if (t === Me) return "invalid";
56
+ if (t === Ve) return "unavailable";
57
+ if (t === Be || t === Ge) return "denied";
58
+ const n = (a = /\((\d{3})\)/.exec(e instanceof Error ? e.message : "")) == null ? void 0 : a[1];
59
+ return n === "404" || n === "410" ? "missing" : n === "401" || n === "403" ? "denied" : n != null && n.startsWith("5") ? "unavailable" : "unknown";
60
+ }
61
+ function Ze(e) {
62
+ const t = Je(e);
63
+ return t === "missing" || t === "invalid" || t === "unavailable";
64
+ }
65
+ function Ye(e, t) {
66
+ return e && /\bhtml\b/i.test(e) ? `返回 HTML 页面(${e})` : e && !/^text\//i.test(e) ? null : /^\uFEFF?\s*(?:<!doctype\s+html|<html|<\?xml[^>]*\bhtml)/i.test(t) ? "返回 HTML 兜底页" : null;
67
+ }
68
+ function qe(e, t) {
69
+ return t.byteLength ? Ye(e, new TextDecoder().decode(t.subarray(0, 512))) : "响应内容为空";
70
+ }
71
+ const Ke = /<UDIM>/i;
72
+ function Qe(e, t) {
73
+ const n = me(e).replaceAll("\\", "/");
74
+ if (!Ke.test(n)) return null;
75
+ const a = we(n), i = a.split("/").at(-1);
76
+ if (!i) return { paths: [], tiles: [] };
77
+ const r = et(i);
78
+ if (!r) return { paths: [], tiles: [] };
79
+ const s = [];
80
+ for (const u of new Set(t)) {
81
+ const h = me(u).replaceAll("\\", "/"), g = we(h), l = g.split("/").at(-1);
82
+ if (!l) continue;
83
+ const f = r.exec(l);
84
+ if (!f) continue;
85
+ const p = Number(f[1]);
86
+ !Number.isInteger(p) || p < 1001 || p > 9999 || s.push({
87
+ path: u,
88
+ tile: p,
89
+ score: tt(a, g)
90
+ });
91
+ }
92
+ if (!s.length) return { paths: [], tiles: [] };
93
+ const c = Math.max(...s.map((u) => u.score)), o = s.filter((u) => u.score === c).sort((u, h) => u.tile - h.tile || u.path.localeCompare(h.path));
94
+ return {
95
+ paths: o.map((u) => u.path),
96
+ tiles: o.map((u) => u.tile)
97
+ };
98
+ }
99
+ function et(e) {
100
+ const t = e.split(/<UDIM>/i);
101
+ return t.length !== 2 ? null : new RegExp(`^${ye(t[0])}(\\d{4})${ye(t[1])}$`, "i");
102
+ }
103
+ function tt(e, t) {
104
+ const n = e.split("/").slice(0, -1).filter(Boolean), a = t.split("/").slice(0, -1).filter(Boolean);
105
+ let i = 0;
106
+ for (; i < n.length && i < a.length; ) {
107
+ const r = n.at(-1 - i), s = a.at(-1 - i);
108
+ if ((r == null ? void 0 : r.toLowerCase()) !== (s == null ? void 0 : s.toLowerCase())) break;
109
+ i += 1;
110
+ }
111
+ return i;
112
+ }
113
+ function me(e) {
114
+ const t = e.replace(/%3CUDIM%3E/gi, "<UDIM>");
115
+ try {
116
+ return decodeURIComponent(t);
117
+ } catch {
118
+ return t;
119
+ }
120
+ }
121
+ function we(e) {
122
+ const t = e.search(/[?#]/);
123
+ return t < 0 ? e : e.slice(0, t);
124
+ }
125
+ function ye(e) {
126
+ return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
127
+ }
128
+ const nt = 67324752, rt = 33639248, st = 101010256, ie = 4294967295, ot = /* @__PURE__ */ new Set(["png", "jpg", "jpeg", "webp"]);
129
+ function at(e) {
130
+ return e.length > 3 && e[0] === 80 && e[1] === 75;
131
+ }
132
+ async function it(e, t = {}) {
133
+ const n = new DataView(e.buffer, e.byteOffset, e.byteLength), a = ht(n);
134
+ if (a < 0) throw new Error("Not a zip package: end of central directory not found.");
135
+ const i = n.getUint16(a + 10, !0);
136
+ let r = n.getUint32(a + 16, !0);
137
+ if (i === 65535 || r === ie) throw new Error("ZIP64 usdz packages are not supported.");
138
+ const s = /* @__PURE__ */ new Map(), c = [];
139
+ for (let o = 0; o < i; o += 1) {
140
+ if (r + 46 > n.byteLength || n.getUint32(r, !0) !== rt)
141
+ throw new Error(`Corrupt zip central directory at entry ${o}.`);
142
+ const u = n.getUint16(r + 10, !0), h = n.getUint32(r + 20, !0), g = n.getUint16(r + 28, !0), l = n.getUint16(r + 30, !0), f = n.getUint16(r + 32, !0), p = n.getUint32(r + 42, !0);
143
+ if (h === ie || p === ie)
144
+ throw new Error("ZIP64 usdz packages are not supported.");
145
+ const y = new TextDecoder().decode(e.subarray(r + 46, r + 46 + g));
146
+ r += 46 + g + l + f, !y.endsWith("/") && (t.include && !t.include(y) || c.push(ut(e, n, p, h, u).then((w) => ({ name: y, data: w }))));
147
+ }
148
+ for (const { name: o, data: u } of await Promise.all(c)) s.set(o, u);
149
+ return s;
150
+ }
151
+ function ct(e) {
152
+ if (typeof URL > "u" || typeof URL.createObjectURL != "function") return null;
153
+ const t = new Map([...e].filter(([s]) => Ae(s)));
154
+ if (t.size === 0) return null;
155
+ const n = /* @__PURE__ */ new Map();
156
+ for (const s of t.keys()) {
157
+ const c = s.split("/").pop() ?? s;
158
+ n.set(c, n.has(c) ? null : s);
159
+ }
160
+ const a = /* @__PURE__ */ new Map(), i = (s) => {
161
+ let c = a.get(s);
162
+ if (!c) {
163
+ const o = t.get(s);
164
+ c = URL.createObjectURL(new Blob([new Uint8Array(o)], { type: ft(s) })), a.set(s, c);
165
+ }
166
+ return c;
167
+ }, r = (s) => {
168
+ if (!s) return null;
169
+ const c = dt(lt(s));
170
+ if (!c) return null;
171
+ if (t.has(c)) return i(c);
172
+ const o = [...t.keys()].filter((g) => g.endsWith(`/${c}`));
173
+ if (o.length === 1) return i(o[0]);
174
+ const u = [...t.keys()].filter((g) => c.endsWith(`/${g}`));
175
+ if (u.length === 1) return i(u[0]);
176
+ const h = n.get(c.split("/").pop() ?? "");
177
+ return h ? i(h) : null;
178
+ };
179
+ for (const s of t.keys()) i(s);
180
+ return {
181
+ urls: a,
182
+ resolve: (s) => r(s.resolvedPath) ?? r(s.path) ?? r(s.url) ?? null,
183
+ dispose: () => {
184
+ for (const s of a.values()) URL.revokeObjectURL(s);
185
+ a.clear();
186
+ }
187
+ };
188
+ }
189
+ function Ae(e) {
190
+ return ot.has(ke(e));
191
+ }
192
+ async function ut(e, t, n, a, i) {
193
+ if (t.getUint32(n, !0) !== nt) throw new Error("Corrupt zip local file header.");
194
+ const r = t.getUint16(n + 26, !0), s = t.getUint16(n + 28, !0), c = n + 30 + r + s, o = e.subarray(c, c + a);
195
+ if (i === 0) return o.slice();
196
+ if (i !== 8) throw new Error(`Unsupported zip compression method ${i}.`);
197
+ const u = new Blob([new Uint8Array(o)]).stream().pipeThrough(new DecompressionStream("deflate-raw"));
198
+ return new Uint8Array(await new Response(u).arrayBuffer());
199
+ }
200
+ function lt(e) {
201
+ const t = e.indexOf("[");
202
+ return t >= 0 && e.endsWith("]") ? e.slice(t + 1, -1) : e;
203
+ }
204
+ function dt(e) {
205
+ const t = [];
206
+ for (const n of e.replaceAll("\\", "/").split("/"))
207
+ !n || n === "." || (n === ".." ? t.pop() : t.push(n));
208
+ return t.join("/");
209
+ }
210
+ function ke(e) {
211
+ const t = e.split(/[?#]/)[0] ?? e, n = t.lastIndexOf(".");
212
+ return n < 0 ? "" : t.slice(n + 1).toLowerCase();
213
+ }
214
+ function ft(e) {
215
+ switch (ke(e)) {
216
+ case "png":
217
+ return "image/png";
218
+ case "jpg":
219
+ case "jpeg":
220
+ return "image/jpeg";
221
+ case "webp":
222
+ return "image/webp";
223
+ default:
224
+ return "application/octet-stream";
225
+ }
226
+ }
227
+ function ht(e) {
228
+ const t = Math.max(0, e.byteLength - 65535 - 22);
229
+ for (let n = e.byteLength - 22; n >= t; n -= 1)
230
+ if (e.getUint32(n, !0) === st) return n;
231
+ return -1;
232
+ }
233
+ const pt = 1, gt = 1, mt = "9590c7fb3e7636719062", wt = {
234
+ file: "openusd_probe.js",
235
+ sha256: "83a14d264f2348a0899de8f1bc0c021fdcd8cae554ef545fb9e5b88da6f30b4e",
236
+ bytes: 95918
237
+ }, yt = {
238
+ file: "openusd_probe.wasm",
239
+ sha256: "e5fdec65f543d38b9ab956b7698fbd597cd7c49c0f8dbd13f334086a59c9670f",
240
+ bytes: 10652138
241
+ };
242
+ var _t = {
243
+ schemaVersion: pt,
244
+ apiVersion: gt,
245
+ runtimeId: mt,
246
+ js: wt,
247
+ wasm: yt
248
+ };
249
+ const bt = St(_t);
250
+ function St(e) {
251
+ if (!e || typeof e != "object") throw new Error("OpenUSD runtime manifest is missing.");
252
+ const t = e;
253
+ if (t.schemaVersion !== 1 || !Number.isInteger(t.apiVersion) || Number(t.apiVersion) < 1 || typeof t.runtimeId != "string" || !/^[0-9a-f]{20}$/.test(t.runtimeId))
254
+ throw new Error("OpenUSD runtime manifest metadata is invalid.");
255
+ return Object.freeze({
256
+ schemaVersion: t.schemaVersion,
257
+ apiVersion: Number(t.apiVersion),
258
+ runtimeId: t.runtimeId,
259
+ js: _e(t.js, "openusd_probe.js"),
260
+ wasm: _e(t.wasm, "openusd_probe.wasm")
261
+ });
262
+ }
263
+ function _e(e, t) {
264
+ if (!e || typeof e != "object") throw new Error(`OpenUSD runtime manifest omits ${t}.`);
265
+ const n = e;
266
+ if (n.file !== t || typeof n.sha256 != "string" || !/^[0-9a-f]{64}$/.test(n.sha256) || !Number.isInteger(n.bytes) || Number(n.bytes) < 1)
267
+ throw new Error(`OpenUSD runtime manifest is invalid for ${t}.`);
268
+ return Object.freeze({
269
+ file: t,
270
+ sha256: n.sha256,
271
+ bytes: Number(n.bytes)
272
+ });
273
+ }
274
+ function Ut(e, t, n) {
275
+ return WebAssembly.instantiate(e, t).then(
276
+ (a) => n(a, e),
277
+ (a) => {
278
+ setTimeout(() => {
279
+ throw a;
280
+ });
281
+ }
282
+ ), {};
283
+ }
284
+ function xe(e, t) {
285
+ const n = async (r, s) => {
286
+ var o;
287
+ const c = e.GetPrimAtPath(r);
288
+ try {
289
+ return s(c);
290
+ } finally {
291
+ (o = c == null ? void 0 : c.delete) == null || o.call(c);
292
+ }
293
+ }, a = (r, s) => {
294
+ var o, u, h, g;
295
+ const c = (o = r == null ? void 0 : r.GetAttribute) == null ? void 0 : o.call(r, s);
296
+ if (!c) return [];
297
+ try {
298
+ return ((u = c.IsValid) == null ? void 0 : u.call(c)) !== !0 ? [] : (((h = c.GetConnections) == null ? void 0 : h.call(c)) ?? []).map((l) => {
299
+ var p, y;
300
+ if (typeof l == "string") return l;
301
+ const f = String(((p = l.GetString) == null ? void 0 : p.call(l)) ?? l.path ?? "");
302
+ return (y = l.delete) == null || y.call(l), f;
303
+ }).filter(Boolean);
304
+ } finally {
305
+ (g = c.delete) == null || g.call(c);
306
+ }
307
+ }, i = (r) => {
308
+ var c;
309
+ const s = r && ((c = t.UsdShade) != null && c.ComputeBoundMaterialPath) ? t.UsdShade.ComputeBoundMaterialPath(r) : null;
310
+ return s ? {
311
+ found: !0,
312
+ materialPath: String(s.materialPath ?? ""),
313
+ resolvedTargetPath: String(s.resolvedTargetPath ?? ""),
314
+ bindingRelationshipPath: String(s.bindingRelationshipPath ?? "")
315
+ } : { found: !1, materialPath: "", resolvedTargetPath: "", bindingRelationshipPath: "" };
316
+ };
317
+ return {
318
+ async stageMetadata(r) {
319
+ var c;
320
+ const s = e.GetPseudoRoot();
321
+ try {
322
+ const o = s.GetMetadata(r);
323
+ return { valid: !0, found: o != null, value: o };
324
+ } finally {
325
+ (c = s.delete) == null || c.call(s);
326
+ }
327
+ },
328
+ async primInfo(r) {
329
+ return n(r, (s) => {
330
+ var c, o, u, h;
331
+ return {
332
+ valid: !!s && ((c = s.IsValid) == null ? void 0 : c.call(s)) !== !1,
333
+ name: String(((o = s.GetName) == null ? void 0 : o.call(s)) ?? r.split("/").pop() ?? ""),
334
+ path: r,
335
+ typeName: String(((u = s.GetTypeName) == null ? void 0 : u.call(s)) ?? ""),
336
+ instance: ((h = s.IsInstance) == null ? void 0 : h.call(s)) === !0
337
+ };
338
+ });
339
+ },
340
+ async primChildren(r) {
341
+ return n(r, (s) => {
342
+ var c;
343
+ return (((c = s.GetChildren) == null ? void 0 : c.call(s)) ?? []).map((o) => {
344
+ var h, g;
345
+ const u = String(o.__path ?? ((h = o.GetPath) == null ? void 0 : h.call(o)) ?? "");
346
+ return (g = o.delete) == null || g.call(o), u;
347
+ });
348
+ });
349
+ },
350
+ async primDescendants(r, s = "") {
351
+ var c;
352
+ return (((c = e.GetDescendants) == null ? void 0 : c.call(e, r, s)) ?? []).map(String);
353
+ },
354
+ async primAttributes(r) {
355
+ return n(r, (s) => {
356
+ var c;
357
+ return (((c = s.GetAttributes) == null ? void 0 : c.call(s)) ?? []).map((o) => {
358
+ var h, g;
359
+ const u = String(((h = o.GetName) == null ? void 0 : h.call(o)) ?? "");
360
+ return (g = o.delete) == null || g.call(o), u;
361
+ });
362
+ });
363
+ },
364
+ async primMetadata(r, s) {
365
+ return n(r, (c) => {
366
+ var h;
367
+ const o = (h = c == null ? void 0 : c.GetMetadata) == null ? void 0 : h.call(c, s), u = typeof o == "string" ? o : o && typeof o == "object" && typeof o.string == "string" ? String(o.string) : void 0;
368
+ return {
369
+ valid: !0,
370
+ found: o != null,
371
+ ...o != null ? { value: o } : {},
372
+ ...u !== void 0 ? { text: u } : {}
373
+ };
374
+ });
375
+ },
376
+ async relationshipTargets(r, s) {
377
+ return n(r, (c) => {
378
+ var u, h, g;
379
+ const o = (u = c == null ? void 0 : c.GetRelationship) == null ? void 0 : u.call(c, s);
380
+ if (!o) return [];
381
+ try {
382
+ return (((h = o.GetTargets) == null ? void 0 : h.call(o)) ?? []).map((l) => {
383
+ var f;
384
+ return typeof l == "string" ? l : String(((f = l.GetString) == null ? void 0 : f.call(l)) ?? l.path ?? "");
385
+ }).filter(Boolean);
386
+ } finally {
387
+ (g = o.delete) == null || g.call(o);
388
+ }
389
+ });
390
+ },
391
+ async attributeValue(r, s) {
392
+ return n(r, (c) => {
393
+ var u, h, g, l;
394
+ const o = (u = c == null ? void 0 : c.GetAttribute) == null ? void 0 : u.call(c, s);
395
+ if (!o) return { valid: !1, authored: !1, value: null };
396
+ try {
397
+ const f = ((h = o.IsValid) == null ? void 0 : h.call(o)) === !0;
398
+ return {
399
+ valid: f,
400
+ authored: f && ((g = o.HasAuthoredValue) == null ? void 0 : g.call(o)) === !0,
401
+ value: f ? o.Get() : null
402
+ };
403
+ } finally {
404
+ (l = o.delete) == null || l.call(o);
405
+ }
406
+ });
407
+ },
408
+ async attributeValues(r) {
409
+ const s = {};
410
+ for (const c of r)
411
+ s[c.path] = await n(c.path, (o) => Object.fromEntries(
412
+ c.names.map((u) => {
413
+ var g, l, f, p;
414
+ const h = (g = o == null ? void 0 : o.GetAttribute) == null ? void 0 : g.call(o, u);
415
+ if (!h) return [u, { valid: !1, authored: !1, value: null }];
416
+ try {
417
+ const y = ((l = h.IsValid) == null ? void 0 : l.call(h)) === !0;
418
+ return [u, {
419
+ valid: y,
420
+ authored: y && ((f = h.HasAuthoredValue) == null ? void 0 : f.call(h)) === !0,
421
+ value: y ? h.Get() : null
422
+ }];
423
+ } finally {
424
+ (p = h.delete) == null || p.call(h);
425
+ }
426
+ })
427
+ ));
428
+ return s;
429
+ },
430
+ async attributeMetadata(r, s, c) {
431
+ return n(r, (o) => {
432
+ var h, g, l;
433
+ const u = (h = o == null ? void 0 : o.GetAttribute) == null ? void 0 : h.call(o, s);
434
+ if (!u) return { valid: !1, found: !1 };
435
+ try {
436
+ if (((g = u.IsValid) == null ? void 0 : g.call(u)) !== !0) return { valid: !1, found: !1 };
437
+ const f = u.GetMetadata(c);
438
+ return {
439
+ valid: !0,
440
+ found: f != null,
441
+ ...f != null ? { value: f } : {}
442
+ };
443
+ } finally {
444
+ (l = u.delete) == null || l.call(u);
445
+ }
446
+ });
447
+ },
448
+ async attributeConnections(r, s) {
449
+ return n(r, (c) => a(c, s));
450
+ },
451
+ async boundMaterial(r) {
452
+ return n(r, i);
453
+ }
454
+ };
455
+ }
456
+ const Et = /^physics$/i, vt = /^(newton|mjc|mujoco)(?:[_-]|$)/i, Pt = /^(physx|newton|mjc|mujoco)(?:[_-]|)/i;
457
+ function It(e, t = []) {
458
+ const n = new Set(t.map(be)), a = [];
459
+ for (const i of e) {
460
+ if (!Et.test(i.setName) || n.has(be(i))) continue;
461
+ const r = i.variantNames.map((o, u) => ({ selection: o, index: u, rank: Mt(o) })).filter((o) => o.rank !== null);
462
+ if (r.length === 0 || i.selection && vt.test(i.selection)) continue;
463
+ const s = ce(i.selection), c = [...r].sort((o, u) => {
464
+ const h = s !== null && ce(o.selection) === s, g = s !== null && ce(u.selection) === s;
465
+ return Number(g) - Number(h) || o.rank - u.rank || o.index - u.index;
466
+ })[0];
467
+ a.push({
468
+ primPath: i.primPath,
469
+ setName: i.setName,
470
+ selection: c.selection
471
+ });
472
+ }
473
+ return a;
474
+ }
475
+ function Mt(e) {
476
+ return /^newton(?:[_-]|$)/i.test(e) ? 0 : /^mjc(?:[_-]|$)/i.test(e) ? 1 : /^mujoco(?:[_-]|$)/i.test(e) ? 2 : null;
477
+ }
478
+ function ce(e) {
479
+ return e && e.replace(Pt, "").toLowerCase() || null;
480
+ }
481
+ function be(e) {
482
+ return `${e.primPath}\0${e.setName}`;
483
+ }
484
+ function At(e) {
485
+ let t = 0;
486
+ const n = () => {
487
+ for (; t < e.length; ) {
488
+ const o = e[t];
489
+ if (/\s/.test(o)) {
490
+ t++;
491
+ continue;
492
+ }
493
+ if (o === "#") {
494
+ for (; t < e.length && e[t] !== `
495
+ `; ) t++;
496
+ continue;
497
+ }
498
+ if (o === '"' || o === "@" || o === "<") {
499
+ const h = o === "<" ? ">" : o, g = o === '"' && e.slice(t, t + 3) === '"""';
500
+ t += g ? 3 : 1;
501
+ const l = t;
502
+ for (; t < e.length; ) {
503
+ if (e[t] === "\\") {
504
+ t += 2;
505
+ continue;
506
+ }
507
+ if (g ? e.slice(t, t + 3) === '"""' : e[t] === h) {
508
+ const f = e.slice(l, t);
509
+ return t += g ? 3 : 1, { kind: o === "<" ? "path" : "string", value: f };
510
+ }
511
+ t++;
512
+ }
513
+ throw new Error("Unterminated USDA string or path");
514
+ }
515
+ if ("{}()[]=,".includes(o))
516
+ return t++, { kind: "symbol", value: o };
517
+ const u = t;
518
+ for (; t < e.length && !/[\s{}()\[\]=,<>"@#]/.test(e[t]); ) t++;
519
+ if (u === t) {
520
+ t++;
521
+ continue;
522
+ }
523
+ return { kind: "word", value: e.slice(u, t) };
524
+ }
525
+ }, a = () => {
526
+ let o = 1, u;
527
+ for (; o && (u = n()); )
528
+ u.value === "[" && u.kind === "symbol" ? o++ : u.value === "]" && u.kind === "symbol" && o--;
529
+ if (o) throw new Error("Unterminated USDA list");
530
+ }, i = () => {
531
+ let o = 1, u;
532
+ for (; o && (u = n()); )
533
+ u.value === "{" && u.kind === "symbol" ? o++ : u.value === "}" && u.kind === "symbol" && o--;
534
+ if (o) throw new Error("Unterminated USDA dictionary");
535
+ }, r = /* @__PURE__ */ new Map(), s = [];
536
+ let c;
537
+ for (; c = n(); ) {
538
+ if (c.kind !== "word") {
539
+ c.kind === "symbol" && c.value === "[" ? a() : c.kind === "symbol" && c.value === "{" ? i() : c.kind === "symbol" && c.value === "}" && s.pop();
540
+ continue;
541
+ }
542
+ if (["def", "over", "class"].includes(c.value)) {
543
+ const l = n(), f = (l == null ? void 0 : l.kind) === "string" ? l : n();
544
+ if (!f || f.kind !== "string") throw new Error("Invalid USDA prim header");
545
+ const p = [...s].reverse().find(Boolean), y = `${(p == null ? void 0 : p.path) ?? ""}/${f.value}`, w = { schemas: [], relationships: /* @__PURE__ */ new Map() };
546
+ let d, m = 0;
547
+ for (; (d = n()) && !(d.kind === "symbol" && d.value === "{" && m === 0); ) {
548
+ if (d.kind === "symbol" && d.value === "(") m++;
549
+ else if (d.kind === "symbol" && d.value === ")") m--;
550
+ else if (d.kind === "symbol" && d.value === "{") {
551
+ i();
552
+ continue;
553
+ }
554
+ if (d.kind === "word" && d.value === "apiSchemas") {
555
+ const S = n(), b = n();
556
+ if ((S == null ? void 0 : S.value) !== "=") throw new Error("Invalid USDA apiSchemas");
557
+ if ((b == null ? void 0 : b.kind) === "word" && b.value === "None") continue;
558
+ if ((b == null ? void 0 : b.value) !== "[") throw new Error(`Invalid USDA apiSchemas at ${y}: ${b == null ? void 0 : b.value}`);
559
+ for (; (d = n()) && d.value !== "]"; )
560
+ d.kind === "string" && d.value.startsWith("PhysxMimicJointAPI:") && w.schemas.push(d.value);
561
+ if (!d) throw new Error("Unterminated USDA apiSchemas");
562
+ } else d.value === "[" && d.kind === "symbol" && a();
563
+ }
564
+ if (!d) throw new Error("Unterminated USDA prim header");
565
+ r.set(y, w), s.push({ path: y, prim: w });
566
+ continue;
567
+ }
568
+ if (c.value !== "rel" || !s.at(-1)) continue;
569
+ const o = n();
570
+ if (!o || o.kind !== "word" || !/^physxMimicJoint:[^:]+:referenceJoint$/.test(o.value)) continue;
571
+ const u = n(), h = n();
572
+ if ((u == null ? void 0 : u.value) !== "=" || !h) continue;
573
+ const g = [];
574
+ if (h.kind === "path") g.push(h.value);
575
+ else if (h.value === "[") {
576
+ let l;
577
+ for (; (l = n()) && l.value !== "]"; ) l.kind === "path" && g.push(l.value);
578
+ if (!l) throw new Error("Unterminated USDA relationship");
579
+ }
580
+ s.at(-1).prim.relationships.set(o.value, g);
581
+ }
582
+ return new Map([...r].filter(([, o]) => o.schemas.length || o.relationships.size));
583
+ }
584
+ const kt = [
585
+ 1,
586
+ 0,
587
+ 0,
588
+ 0,
589
+ 0,
590
+ 1,
591
+ 0,
592
+ 0,
593
+ 0,
594
+ 0,
595
+ 1,
596
+ 0,
597
+ 0,
598
+ 0,
599
+ 0,
600
+ 1
601
+ ];
602
+ function xt(e) {
603
+ const t = new Map(e.map((r) => [r.path, r])), n = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Set(), i = (r) => {
604
+ const s = n.get(r.path);
605
+ if (s) return s;
606
+ if (a.has(r.path)) return Se(r.localMatrix);
607
+ a.add(r.path);
608
+ const c = Se(r.localMatrix), o = r.parentPath ? t.get(r.parentPath) : void 0, u = !o || r.resetsXformStack ? c : Ue(c, i(o));
609
+ return a.delete(r.path), n.set(r.path, u), u;
610
+ };
611
+ return e.map((r) => {
612
+ if (!r.resetsXformStack || !r.parentPath) return r;
613
+ const s = t.get(r.parentPath);
614
+ if (!s) return r;
615
+ const c = i(s), o = Dt(c);
616
+ return o ? {
617
+ ...r,
618
+ localMatrix: Ue(i(r), o)
619
+ } : r;
620
+ });
621
+ }
622
+ function Se(e) {
623
+ return Rt(e) ? e : kt;
624
+ }
625
+ function Rt(e) {
626
+ return (e == null ? void 0 : e.length) === 16 && e.every(Number.isFinite);
627
+ }
628
+ function Ue(e, t) {
629
+ const n = new Array(16);
630
+ for (let a = 0; a < 4; a++)
631
+ for (let i = 0; i < 4; i++) {
632
+ let r = 0;
633
+ for (let s = 0; s < 4; s++)
634
+ r += e[a * 4 + s] * t[s * 4 + i];
635
+ n[a * 4 + i] = r;
636
+ }
637
+ return n;
638
+ }
639
+ function Dt(e) {
640
+ const [
641
+ t,
642
+ n,
643
+ a,
644
+ ,
645
+ i,
646
+ r,
647
+ s,
648
+ ,
649
+ c,
650
+ o,
651
+ u,
652
+ ,
653
+ h,
654
+ g,
655
+ l
656
+ ] = e, f = r * u - s * o, p = a * o - n * u, y = n * s - a * r, w = t * f + i * p + c * y, d = Math.max(
657
+ Math.abs(t * r * u),
658
+ Math.abs(t * s * o),
659
+ Math.abs(n * i * u),
660
+ Math.abs(n * s * c),
661
+ Math.abs(a * i * o),
662
+ Math.abs(a * r * c),
663
+ 1
664
+ );
665
+ if (!Number.isFinite(w) || Math.abs(w) <= Number.EPSILON * d * 16)
666
+ return null;
667
+ const m = 1 / w, S = f * m, b = p * m, k = y * m, j = (s * c - i * u) * m, V = (t * u - a * c) * m, G = (a * i - t * s) * m, U = (i * o - r * c) * m, M = (n * c - t * o) * m, E = (t * r - n * i) * m;
668
+ return [
669
+ S,
670
+ b,
671
+ k,
672
+ 0,
673
+ j,
674
+ V,
675
+ G,
676
+ 0,
677
+ U,
678
+ M,
679
+ E,
680
+ 0,
681
+ -(h * S + g * j + l * U),
682
+ -(h * b + g * V + l * M),
683
+ -(h * k + g * G + l * E),
684
+ 1
685
+ ];
686
+ }
687
+ function Nt(e, t = []) {
688
+ return {
689
+ stage: e.stage,
690
+ view: {
691
+ ...e.view,
692
+ prims: xt(e.view.prims)
693
+ },
694
+ elements: e.elements,
695
+ materials: e.materials,
696
+ materialAliases: e.materialAliases,
697
+ physics: $t(),
698
+ joints: [],
699
+ cameras: [],
700
+ lights: [],
701
+ skels: e.skels,
702
+ animations: e.animations,
703
+ variants: t
704
+ };
705
+ }
706
+ function Tt(e, t) {
707
+ e.physics = t.physics, e.joints = t.joints;
708
+ }
709
+ function $t() {
710
+ return {
711
+ scenes: [],
712
+ rigidBodies: [],
713
+ colliders: [],
714
+ materials: [],
715
+ articulationRoots: []
716
+ };
717
+ }
718
+ const Ot = /* @__PURE__ */ new Set(["usd", "usda", "usdc", "usdz"]);
719
+ async function Lt(e) {
720
+ const t = await import(
721
+ /* @vite-ignore */
722
+ e.moduleUrl
723
+ ), n = t.default ?? t.createOpenUsdProbe, a = e.wasmModule ? {
724
+ instantiateWasm(w, d) {
725
+ return Ut(e.wasmModule, w, d);
726
+ }
727
+ } : {
728
+ wasmBinary: await (typeof e.wasmBinary == "function" ? e.wasmBinary() : e.wasmBinary ?? Wt(e.wasmUrl))
729
+ }, i = await n(a), r = e.apiVersion ?? bt.apiVersion, s = Number(i.ccall("usd_probe_api_version", "number", [], []));
730
+ if (s !== r)
731
+ throw Object.assign(
732
+ new Error(`OpenUSD runtime API mismatch: expected ${r}, received ${s}.`),
733
+ { code: "E_USD_RUNTIME_VERSION" }
734
+ );
735
+ const c = e.memfsRoot ?? "/asset", o = e.fetchBytes ?? (async (w) => {
736
+ const d = await fetch(w);
737
+ if (!d.ok) throw Object.assign(new Error(`USD resource request failed (${d.status}): ${w}`), {
738
+ code: d.status === 401 || d.status === 403 ? "E_ASSET_AUTH" : "E_ASSET_FETCH"
739
+ });
740
+ const m = new Uint8Array(await d.arrayBuffer()), S = qe(d.headers.get("content-type"), m);
741
+ if (S) throw Xe(`USD resource is not usable (${S}): ${w}`, Me);
742
+ return m;
743
+ }), u = (w, d, m) => JSON.parse(i.ccall(w, "string", d, m)), h = /* @__PURE__ */ new Set(), g = Ee(i);
744
+ let l = 0, f = null;
745
+ async function p() {
746
+ return f || (f = (async () => {
747
+ const w = `${c}/__viewer_warmup__`, d = `${w}/empty.usda`;
748
+ i.FS.mkdirTree(w), i.FS.writeFile(d, new TextEncoder().encode(`#usda 1.0
749
+ `));
750
+ let m;
751
+ try {
752
+ const S = u("usd_probe_stage_open", ["string"], [d]);
753
+ if (S.ok !== !0 || S.stageId === void 0)
754
+ throw new Error(S.error ?? "Failed to initialize the USD Stage runtime.");
755
+ m = S.stageId;
756
+ } finally {
757
+ m !== void 0 && u("usd_probe_stage_release", ["number"], [m]), i.FS.analyzePath(d, !0).exists && i.FS.unlink(d);
758
+ }
759
+ })(), f);
760
+ }
761
+ async function y(w, d) {
762
+ const m = new URL(d.sourcePath, "file:///"), S = `${c}/load-${++l}`, b = J(m.href, S), k = /* @__PURE__ */ new Set(), j = /* @__PURE__ */ new Map(), V = /* @__PURE__ */ new Map(), G = d.readTextureBytes ?? !0, U = d.collectTextureUrls ?? !G, M = U || G ? Re : zt, E = /* @__PURE__ */ new Map();
763
+ let z, x = null, P = null;
764
+ const A = () => {
765
+ z !== void 0 && h.delete(z) && u("usd_probe_stage_release", ["number"], [z]), x == null || x.dispose(), Te(i.FS, S);
766
+ };
767
+ try {
768
+ const T = await Pe(w);
769
+ de(i, b, T, k), j.set(b, M(T));
770
+ for (const [_, I] of Object.entries(d.files ?? {})) {
771
+ const v = J(new URL(_, m).href, S), F = await Pe(I);
772
+ k.has(v) || j.set(v, M(F)), de(i, v, F, k);
773
+ }
774
+ const H = new Set(k);
775
+ for (const _ of d.packagePaths ?? [])
776
+ H.add(J(new URL(_, m).href, S));
777
+ const O = d.externalReferenceMode ?? "complete", L = at(T) ? await it(T, { include: Ae }) : null;
778
+ let B = {};
779
+ if (!L && d.autoResolveAssets !== !1) {
780
+ const _ = d.resolveBytes ?? ((I) => o(I));
781
+ B = await Gt(
782
+ i,
783
+ m,
784
+ S,
785
+ _,
786
+ u,
787
+ k,
788
+ E,
789
+ U ? V : null,
790
+ j,
791
+ d.maxFiles ?? 1024,
792
+ d.maxDepth ?? 8,
793
+ d.maxConcurrency ?? 1,
794
+ O,
795
+ H,
796
+ G,
797
+ d.onReferenceSkipped,
798
+ d.onResourceFailed
799
+ );
800
+ }
801
+ x = L ? ct(L) : null;
802
+ const Z = d.textureResolver || x ? (_) => {
803
+ var I;
804
+ return ((I = d.textureResolver) == null ? void 0 : I.call(d, _)) ?? (x == null ? void 0 : x.resolve(_)) ?? null;
805
+ } : void 0, R = Object.keys(B).length > 0;
806
+ if (R && typeof i._usd_probe_stage_open_mapped != "function")
807
+ throw Object.assign(new Error("USD dependency mapping requires the matching packaged openusd_probe.js and .wasm runtime."), { code: "E_USD_RUNTIME_VERSION" });
808
+ const D = R ? u("usd_probe_stage_open_mapped", ["string", "string"], [b, JSON.stringify(B)]) : u("usd_probe_stage_open", ["string"], [b]);
809
+ if (!D.ok) throw new Error(D.error ?? `Failed to open ${b}`);
810
+ z = D.stageId, h.add(D.stageId);
811
+ const $ = d.variantSelections ?? [];
812
+ let ne = [], W = $;
813
+ if (d.selectMuJoCoPhysicsVariant !== !1) {
814
+ if (typeof i._usd_probe_stage_variants != "function")
815
+ throw Object.assign(
816
+ new Error("USD variant discovery requires the matching packaged openusd_probe runtime."),
817
+ { code: "E_USD_RUNTIME_VERSION" }
818
+ );
819
+ const _ = u("usd_probe_stage_variants", ["number"], [D.stageId]);
820
+ if (_.ok !== !0)
821
+ throw new Error(String(_.error ?? "Failed to enumerate USD variants."));
822
+ ne = _.variants ?? [], W = [
823
+ ...$,
824
+ ...It(ne, $)
825
+ ];
826
+ }
827
+ for (const _ of W) {
828
+ const I = u(
829
+ "usd_probe_stage_set_variant",
830
+ ["number", "string", "string", "string"],
831
+ [D.stageId, _.primPath, _.setName, _.selection]
832
+ );
833
+ if (I.ok !== !0)
834
+ throw new Error(String(I.error ?? `Failed to select USD variant ${_.primPath}:${_.setName}=${_.selection}`));
835
+ }
836
+ const re = Ee(i, E, b), se = re.openStage(D.stageId);
837
+ if (d.selectMuJoCoPhysicsVariant !== !1) {
838
+ const _ = new Set($.map(ue)), I = /* @__PURE__ */ new Set();
839
+ for (const v of W) {
840
+ const F = ue(v);
841
+ if (_.has(F)) continue;
842
+ const C = ne.find((ge) => ge.primPath === v.primPath && ge.setName === v.setName);
843
+ if (!(C != null && C.selection) || C.selection === v.selection || se.GetDescendants(v.primPath, "MjcActuator").length === 0) continue;
844
+ const pe = u(
845
+ "usd_probe_stage_set_variant",
846
+ ["number", "string", "string", "string"],
847
+ [D.stageId, v.primPath, v.setName, C.selection]
848
+ );
849
+ if (pe.ok !== !0)
850
+ throw new Error(String(pe.error ?? `Failed to restore authored USD variant ${v.primPath}:${v.setName}=${C.selection}`));
851
+ I.add(F);
852
+ }
853
+ I.size > 0 && (W = W.filter((v) => !I.has(ue(v))));
854
+ }
855
+ const fe = await Ct(i, D.stageId, b, {
856
+ batchSize: d.geometryBatchSize,
857
+ onProgress: d.onGeometryProgress
858
+ });
859
+ Ne(fe.materials, E);
860
+ const $e = new Map(W.map((_) => [
861
+ `${_.primPath}\0${_.setName}`,
862
+ _.selection
863
+ ])), Oe = ne.map((_) => ({
864
+ ..._,
865
+ selection: $e.get(`${_.primPath}\0${_.setName}`) ?? _.selection
866
+ })), ae = Nt(fe, Oe), he = L ? void 0 : d.isTextureAllowed ?? (O === "package" ? (_) => {
867
+ const I = new URL(_, m);
868
+ return H.has(J(I.href, S)) || Ie(I, m);
869
+ } : void 0);
870
+ return {
871
+ data: ae,
872
+ pxr: re,
873
+ stage: se,
874
+ entryPath: b,
875
+ textureURLs: V,
876
+ buildModel: async () => {
877
+ const { createUSDLoadedModel: _ } = await import("@openusd-wasm/three-loader"), I = () => _(
878
+ ae,
879
+ re,
880
+ b,
881
+ {
882
+ sourcePath: d.sourcePath,
883
+ // The Viewer normalises USD to world Z-up and draws its own studio
884
+ // lighting. Textures remain enabled unless the host explicitly
885
+ // injects its own loader/cache.
886
+ convertZUp: d.convertZUp ?? !1,
887
+ loadLights: d.loadLights ?? !1,
888
+ loadTextures: d.loadTextures ?? !0,
889
+ ...d.textureLoader ? { textureLoader: d.textureLoader } : {},
890
+ ...d.textureCache ? { textureCache: d.textureCache } : {},
891
+ ...Z ? { textureResolver: Z } : {}
892
+ },
893
+ se,
894
+ {
895
+ // Keep package texture identities on the model so the visual adapter
896
+ // can resolve textures referenced by unsupported-but-known MDL nodes.
897
+ usdzTextureURLs: (x == null ? void 0 : x.urls) ?? /* @__PURE__ */ new Map(),
898
+ autoTextureURLs: /* @__PURE__ */ new Map()
899
+ }
900
+ ), v = he ? Ce(ae.materials, he, I) : I();
901
+ v.usdQuery = xe(se, re);
902
+ const F = v.dispose.bind(v);
903
+ let C = !1;
904
+ return v.dispose = () => {
905
+ C || (C = !0, F(), A());
906
+ }, v;
907
+ },
908
+ readPhysics() {
909
+ return P || (P = (async () => {
910
+ if (typeof i._usd_probe_scene_physics != "function")
911
+ throw Object.assign(
912
+ new Error("USD physics phase requires the matching packaged openusd_probe runtime."),
913
+ { code: "E_USD_RUNTIME_VERSION" }
914
+ );
915
+ const _ = u("usd_probe_scene_physics", ["number"], [D.stageId]);
916
+ if (_.ok !== !0) throw new Error(String(_.error ?? "Failed to extract USD physics."));
917
+ return _;
918
+ })(), P);
919
+ },
920
+ release: A
921
+ };
922
+ } catch (T) {
923
+ throw A(), T;
924
+ }
925
+ }
926
+ return {
927
+ runtime: i,
928
+ pxr: g,
929
+ warmup: p,
930
+ async parseAsync(w, d) {
931
+ const m = await y(w, d);
932
+ try {
933
+ return Tt(m.data, await m.readPhysics()), await m.buildModel();
934
+ } catch (S) {
935
+ throw m.release(), S;
936
+ }
937
+ },
938
+ async parseVisualSceneAsync(w, d) {
939
+ return await y(w, d);
940
+ }
941
+ };
942
+ }
943
+ function Ee(e, t = /* @__PURE__ */ new Map(), n) {
944
+ const a = (l, f, p) => JSON.parse(e.ccall(l, "string", f, p));
945
+ class i {
946
+ constructor(f) {
947
+ this.path = f;
948
+ }
949
+ GetString() {
950
+ return this.path;
951
+ }
952
+ delete() {
953
+ }
954
+ }
955
+ let r;
956
+ const s = /* @__PURE__ */ new Map(), c = (l, f) => {
957
+ if (!r) {
958
+ const S = e._usd_probe_flatten_stage;
959
+ if (n && typeof S == "function") {
960
+ const b = e.ccall("usd_probe_flatten_stage", "string", ["string"], [n]);
961
+ if (typeof b != "string" || !b.startsWith("#usda")) throw new Error("Unable to read flattened USD joint metadata");
962
+ r = At(b);
963
+ } else
964
+ r = /* @__PURE__ */ new Map();
965
+ }
966
+ const p = r.get(f);
967
+ if (p || s.has(f)) return p ?? s.get(f);
968
+ const y = ["rotX", "rotY", "rotZ", "transX", "transY", "transZ", "X", "Y", "Z"], w = [], d = /* @__PURE__ */ new Map();
969
+ for (const S of y) {
970
+ const b = `physxMimicJoint:${S}:referenceJoint`, k = a("usd_probe_relationship_targets", ["number", "string", "string"], [l, f, b]).paths ?? [];
971
+ k.length && (w.push(`PhysxMimicJointAPI:${S}`), d.set(b, k));
972
+ }
973
+ const m = w.length ? { schemas: w, relationships: d } : void 0;
974
+ return m && s.set(f, m), m;
975
+ }, o = (l, f, p) => {
976
+ let y = null;
977
+ const w = () => y ?? (y = a(
978
+ "usd_probe_attribute_value",
979
+ ["number", "string", "string"],
980
+ [l, f, p]
981
+ ));
982
+ return {
983
+ IsValid: () => w().valid === !0,
984
+ Get: () => {
985
+ const d = w();
986
+ return d.valid === !0 ? typeof d.value == "string" ? t.get(d.value) ?? d.value : d.value : null;
987
+ },
988
+ HasAuthoredValue: () => w().authored === !0,
989
+ GetName: () => p,
990
+ GetMetadata: (d) => {
991
+ const m = a("usd_probe_attribute_metadata", ["number", "string", "string", "string"], [l, f, p, d]);
992
+ return m.valid === !0 && m.found === !0 ? m.value ?? null : null;
993
+ },
994
+ // The viewer accepts either plain strings or objects with GetString().
995
+ GetConnections: () => a("usd_probe_attribute_connections", ["number", "string", "string"], [l, f, p]).paths ?? [],
996
+ delete: () => {
997
+ }
998
+ };
999
+ }, u = (l, f) => ({
1000
+ __path: f,
1001
+ __stageId: l,
1002
+ IsValid: () => a("usd_probe_prim_info", ["number", "string"], [l, f]).valid === !0,
1003
+ GetName: () => String(f.split("/").pop() ?? ""),
1004
+ GetPath: () => new i(f),
1005
+ GetTypeName: () => String(a("usd_probe_prim_info", ["number", "string"], [l, f]).typeName ?? ""),
1006
+ IsInstance: () => a("usd_probe_prim_info", ["number", "string"], [l, f]).instance === !0,
1007
+ GetAppliedSchemas: () => {
1008
+ var p;
1009
+ return ((p = c(l, f)) == null ? void 0 : p.schemas) ?? [];
1010
+ },
1011
+ GetRelationships: () => {
1012
+ var p;
1013
+ return [...((p = c(l, f)) == null ? void 0 : p.relationships) ?? []].map(([y, w]) => ({
1014
+ GetName: () => y,
1015
+ GetTargets: () => w.map((d) => new i(d)),
1016
+ delete: () => {
1017
+ }
1018
+ }));
1019
+ },
1020
+ GetAttribute: (p) => o(l, f, p),
1021
+ GetAttributes: () => (a("usd_probe_prim_attributes", ["number", "string"], [l, f]).names ?? []).map((p) => o(l, f, p)),
1022
+ GetChildren: () => (a("usd_probe_prim_children", ["number", "string"], [l, f]).paths ?? []).map((p) => u(l, p)),
1023
+ GetRelationship: (p) => {
1024
+ const y = a(
1025
+ "usd_probe_relationship_targets",
1026
+ ["number", "string", "string"],
1027
+ [l, f, p]
1028
+ ).paths ?? [];
1029
+ return {
1030
+ GetName: () => p,
1031
+ GetTargets: () => y.map((w) => new i(w)),
1032
+ delete: () => {
1033
+ }
1034
+ };
1035
+ },
1036
+ GetMetadata: (p) => {
1037
+ const y = a("usd_probe_prim_metadata", ["number", "string", "string"], [l, f, p]);
1038
+ return y.valid !== !0 ? null : typeof y.text == "string" ? y.text : y.found === !0 ? y.value : null;
1039
+ },
1040
+ delete: () => {
1041
+ }
1042
+ }), h = (l) => ({
1043
+ GetPrimAtPath: (f) => u(l, typeof f == "string" ? f : f.path),
1044
+ GetPseudoRoot: () => Object.assign(u(l, "/"), {
1045
+ // Stage-level metadata (metersPerUnit, upAxis, defaultPrim) is authored on
1046
+ // the layer, not composed onto the pseudo-root prim.
1047
+ GetMetadata: (f) => {
1048
+ const p = a("usd_probe_stage_metadata", ["number", "string"], [l, f]);
1049
+ return p.found === !0 ? p.value : null;
1050
+ },
1051
+ GetName: () => "",
1052
+ IsValid: () => !0
1053
+ }),
1054
+ GetDescendants: (f, p = "") => a(
1055
+ "usd_probe_prim_descendants",
1056
+ ["number", "string", "string"],
1057
+ [l, f, p]
1058
+ ).paths ?? [],
1059
+ delete: () => {
1060
+ }
1061
+ }), { FS: g } = e;
1062
+ return {
1063
+ FS: {
1064
+ createDir: (l) => g.mkdirTree(l),
1065
+ writeFile: (l, f) => g.writeFile(l, f),
1066
+ exists: (l) => g.analyzePath(l, !0).exists,
1067
+ listDir: (l) => g.readdir(l).filter((f) => f !== "." && f !== "..").map((f) => {
1068
+ const p = `${l.replace(/\/+$/, "")}/${f}`;
1069
+ return { path: p, name: f, isDir: g.isDir(g.stat(p).mode) };
1070
+ }),
1071
+ deleteFile: (l) => g.unlink(l),
1072
+ deleteDir: (l) => g.rmdir(l)
1073
+ },
1074
+ Sdf: { Path: i },
1075
+ Usd: { TimeCode: { Default: () => ({ delete: () => {
1076
+ } }) } },
1077
+ UsdShade: {
1078
+ ComputeBoundMaterialPath: (l) => {
1079
+ const f = a("usd_probe_bound_material", ["number", "string"], [l.__stageId, l.__path]);
1080
+ return f.found !== !0 ? null : {
1081
+ materialPath: String(f.materialPath ?? ""),
1082
+ resolvedTargetPath: String(f.resolvedTargetPath ?? ""),
1083
+ bindingRelationshipPath: String(f.bindingRelationshipPath ?? "")
1084
+ };
1085
+ }
1086
+ },
1087
+ UsdUtils: {
1088
+ ExtractSanitizedExternalReferences: (l) => a("usd_probe_external_references", ["string"], [l]).paths ?? []
1089
+ },
1090
+ openStage: h
1091
+ };
1092
+ }
1093
+ async function Ct(e, t, n, a = {}) {
1094
+ var c;
1095
+ if (typeof e._usd_probe_scene_visual != "function" || typeof e._usd_probe_scene_geometry != "function" || typeof e._usd_probe_scene_geometry_end != "function")
1096
+ throw Object.assign(
1097
+ new Error("USD visual phases require the matching packaged openusd_probe runtime."),
1098
+ { code: "E_USD_RUNTIME_VERSION" }
1099
+ );
1100
+ const i = JSON.parse(e.ccall(
1101
+ "usd_probe_scene_visual",
1102
+ "string",
1103
+ ["number", "string"],
1104
+ [t, n]
1105
+ ));
1106
+ if (i.error) throw new Error(i.error);
1107
+ const r = i, s = Math.max(1, Math.floor(a.batchSize ?? 8));
1108
+ try {
1109
+ for (const [o, u] of r.elements.entries()) {
1110
+ const g = u.geometry.streamIndex;
1111
+ if (!Number.isInteger(g))
1112
+ throw new Error(`USD scene geometry is missing a stream index for ${u.path}`);
1113
+ const l = JSON.parse(e.ccall(
1114
+ "usd_probe_scene_geometry",
1115
+ "string",
1116
+ ["number", "number"],
1117
+ [t, g]
1118
+ ));
1119
+ if (!l.ok) throw new Error(l.error ?? `Failed to stream USD geometry for ${u.path}`);
1120
+ u.geometry = Object.fromEntries(
1121
+ Object.entries(l.geometry ?? {}).map(([f, p]) => [f, Vt(e, p)])
1122
+ ), (c = a.onProgress) == null || c.call(a, o + 1, r.elements.length, u.path), (o + 1) % s === 0 && await jt();
1123
+ }
1124
+ } finally {
1125
+ e.ccall("usd_probe_scene_geometry_end", "string", ["number"], [t]);
1126
+ }
1127
+ return r;
1128
+ }
1129
+ function jt() {
1130
+ return new Promise((e) => setTimeout(e, 0));
1131
+ }
1132
+ function Vt(e, t) {
1133
+ if (!t || typeof t != "object") return t ?? null;
1134
+ const { ptr: n, length: a, kind: i } = t;
1135
+ return typeof n != "number" ? t : a ? (i === "i32" ? new Int32Array(e.HEAP32.buffer, n, a) : new Float32Array(e.HEAPF32.buffer, n, a)).slice() : i === "i32" ? new Int32Array() : new Float32Array();
1136
+ }
1137
+ async function Gt(e, t, n, a, i, r, s, c, o, u, h, g, l, f, p, y, w) {
1138
+ const d = {}, m = [...f];
1139
+ let S = [
1140
+ { url: t, depth: 0, recurse: !0, absolute: !1 }
1141
+ ];
1142
+ const b = /* @__PURE__ */ new Set(), k = /* @__PURE__ */ new Set();
1143
+ for (; S.length; ) {
1144
+ const j = S;
1145
+ S = [];
1146
+ const V = [];
1147
+ for (const U of j) {
1148
+ const M = U.absolute ? U.url.href : ve(U.url.href, t);
1149
+ if (!b.has(M)) {
1150
+ if (U.depth > h) throw new Error(`USD dependency depth limit exceeded (${h}): ${M}`);
1151
+ if (b.size >= u) throw new Error(`USD dependency limit exceeded (${u}).`);
1152
+ b.add(M), V.push({ item: U, identifier: M });
1153
+ }
1154
+ }
1155
+ S = (await Bt(
1156
+ V,
1157
+ Math.max(1, g),
1158
+ async ({ item: U, identifier: M }) => {
1159
+ const E = J(U.url.href, n);
1160
+ if (!r.has(E) || U.absolute && !f.has(E)) {
1161
+ let P;
1162
+ try {
1163
+ P = await a(U.url, M);
1164
+ } catch (A) {
1165
+ if (!U.owner || !We(M) || !Ze(A)) throw A;
1166
+ const T = `${n}/__unavailable__/${encodeURIComponent(M)}`;
1167
+ return d[U.owner.path][U.owner.reference] = T, s.set(T, M), w == null || w(M, A), [];
1168
+ }
1169
+ o.set(E, Re(P)), de(e, E, P, r);
1170
+ }
1171
+ if (s.set(E, M), !U.recurse) return [];
1172
+ if (d[E] ?? (d[E] = {}), o.get(E) === !1) return [];
1173
+ const z = i("usd_probe_external_references", ["string"], [E]).paths ?? [], x = [];
1174
+ for (const P of z) {
1175
+ if (!P || /^(?:data|blob):/i.test(P) || /\.mdl(?:[?#].*)?$/i.test(P)) continue;
1176
+ let A;
1177
+ try {
1178
+ A = new URL(P, U.url);
1179
+ } catch {
1180
+ continue;
1181
+ }
1182
+ const T = /^(?:[a-z][a-z\d+.-]*:|\/)/i.test(P), H = J(A.href, n), O = Qe(H, m), L = (O == null ? void 0 : O.paths.length) === 1 ? O.paths[0] : null, B = L ?? H, Z = U.absolute || T, R = Z ? A.href : ve(A.href, t), D = Ft(A.pathname);
1183
+ if (L && s.set(L, R), l === "package" && O && O.paths.length > 1) {
1184
+ const $ = `${n}/__deferred_udim__/${encodeURIComponent(R)}`;
1185
+ d[E][P] = $, s.set($, R);
1186
+ continue;
1187
+ }
1188
+ if (l === "package" && !f.has(B) && !Ie(A, t)) {
1189
+ const $ = `${n}/__skipped__/${encodeURIComponent(R)}`;
1190
+ d[E][P] = $, s.set($, R), k.has(R) || (k.add(R), y == null || y(R));
1191
+ continue;
1192
+ }
1193
+ if (!D && c && (c.set(R, A.href), c.set(P, A.href)), d[E][P] = B, !D && !p) {
1194
+ s.set(B, R);
1195
+ continue;
1196
+ }
1197
+ !L && !b.has(R) && x.push({
1198
+ url: A,
1199
+ depth: U.depth + 1,
1200
+ recurse: D,
1201
+ absolute: Z,
1202
+ owner: { path: E, reference: P }
1203
+ });
1204
+ }
1205
+ return x;
1206
+ }
1207
+ )).flat();
1208
+ }
1209
+ return d;
1210
+ }
1211
+ async function Bt(e, t, n) {
1212
+ const a = new Array(e.length);
1213
+ let i = 0;
1214
+ const r = Array.from({ length: Math.min(t, e.length) }, async () => {
1215
+ for (; i < e.length; ) {
1216
+ const s = i++;
1217
+ a[s] = await n(e[s]);
1218
+ }
1219
+ });
1220
+ return await Promise.all(r), a;
1221
+ }
1222
+ function Ft(e) {
1223
+ var n, a;
1224
+ const t = (a = (n = e.split(/[?#]/, 1)[0]) == null ? void 0 : n.split(".").pop()) == null ? void 0 : a.toLowerCase();
1225
+ return t != null && Ot.has(t);
1226
+ }
1227
+ function Re(e) {
1228
+ return De(e) ? e.includes(64) : !0;
1229
+ }
1230
+ function zt(e) {
1231
+ return De(e) ? Ht(e, [
1232
+ "subLayers",
1233
+ "references",
1234
+ "payload",
1235
+ "payloads",
1236
+ "clipAssetPaths"
1237
+ ]) : !0;
1238
+ }
1239
+ function De(e) {
1240
+ let t = e[0] === 239 && e[1] === 187 && e[2] === 191 ? 3 : 0;
1241
+ for (; t < e.length && t < 64 && /\s/.test(String.fromCharCode(e[t])); ) t += 1;
1242
+ return e[t] === 35 && e[t + 1] === 117 && e[t + 2] === 115 && e[t + 3] === 100 && e[t + 4] === 97;
1243
+ }
1244
+ function Ht(e, t) {
1245
+ const n = /* @__PURE__ */ new Map();
1246
+ let a = 1;
1247
+ for (const r of t) {
1248
+ const s = r.charCodeAt(0);
1249
+ n.set(s, [...n.get(s) ?? [], r]), a = Math.max(a, r.length);
1250
+ }
1251
+ const i = e.length - a;
1252
+ for (let r = 0; r <= i; ++r) {
1253
+ const s = n.get(e[r]);
1254
+ if (s)
1255
+ for (const c of s) {
1256
+ let o = !0;
1257
+ for (let u = 1; u < c.length; ++u)
1258
+ if (e[r + u] !== c.charCodeAt(u)) {
1259
+ o = !1;
1260
+ break;
1261
+ }
1262
+ if (o) return !0;
1263
+ }
1264
+ }
1265
+ return !1;
1266
+ }
1267
+ function ve(e, t) {
1268
+ const n = new URL(e);
1269
+ if (n.protocol !== t.protocol || n.host !== t.host) return n.href;
1270
+ const a = new URL(".", t).pathname.split("/").filter(Boolean), i = n.pathname.split("/").filter(Boolean);
1271
+ let r = 0;
1272
+ for (; r < a.length && a[r] === i[r]; ) r++;
1273
+ const s = [...a.slice(r).map(() => ".."), ...i.slice(r)].join("/");
1274
+ return decodeURIComponent(s) + n.search + n.hash;
1275
+ }
1276
+ function J(e, t) {
1277
+ const n = new URL(e), a = encodeURIComponent(`${n.protocol}//${n.host}`);
1278
+ let i = n.pathname.split("/").map((r) => decodeURIComponent(r).replaceAll("/", "%2F").replaceAll("\\", "%5C")).join("/");
1279
+ if (n.search || n.hash) {
1280
+ const r = i.lastIndexOf("."), s = r > i.lastIndexOf("/") ? r : i.length;
1281
+ i = `${i.slice(0, s)}.__url_${encodeURIComponent(n.search + n.hash)}${i.slice(s)}`;
1282
+ }
1283
+ return `${t}/${a}${i}`;
1284
+ }
1285
+ function Ne(e, t) {
1286
+ if (!e || typeof e != "object" || ArrayBuffer.isView(e)) return;
1287
+ const n = e;
1288
+ if (typeof n.path == "string" && typeof n.resolvedPath == "string") {
1289
+ for (const a of ["path", "resolvedPath"]) {
1290
+ const i = n[a];
1291
+ n[a] = t.get(i) ?? i;
1292
+ }
1293
+ return;
1294
+ }
1295
+ for (const a of Object.values(e)) Ne(a, t);
1296
+ }
1297
+ function Te(e, t) {
1298
+ if (e.analyzePath(t).exists) {
1299
+ for (const n of e.readdir(t)) {
1300
+ if (n === "." || n === "..") continue;
1301
+ const a = `${t}/${n}`;
1302
+ e.isDir(e.stat(a).mode) ? Te(e, a) : e.unlink(a);
1303
+ }
1304
+ e.rmdir(t);
1305
+ }
1306
+ }
1307
+ function de(e, t, n, a) {
1308
+ a.has(t) || (e.FS.mkdirTree(t.split("/").slice(0, -1).join("/") || "/"), e.FS.writeFile(t, n), a.add(t));
1309
+ }
1310
+ function ue(e) {
1311
+ return `${e.primPath}\0${e.setName}`;
1312
+ }
1313
+ async function Pe(e) {
1314
+ return typeof e == "string" ? new TextEncoder().encode(e) : ArrayBuffer.isView(e) ? new Uint8Array(e.buffer, e.byteOffset, e.byteLength) : e instanceof ArrayBuffer ? new Uint8Array(e) : new Uint8Array(await e.arrayBuffer());
1315
+ }
1316
+ async function Wt(e) {
1317
+ if (!e) throw new Error("createSingleThreadUsd needs wasmUrl or wasmBinary.");
1318
+ return (await fetch(e)).arrayBuffer();
1319
+ }
1320
+ function Xt(e) {
1321
+ if (e.length < 30) return null;
1322
+ const t = new DataView(e.buffer, e.byteOffset, e.byteLength), n = (a, i) => {
1323
+ for (let r = 0; r < i.length; r += 1)
1324
+ if (e[a + r] !== i.charCodeAt(r)) return !1;
1325
+ return !0;
1326
+ };
1327
+ if (e[0] === 137 && n(1, "PNG") && n(12, "IHDR"))
1328
+ return Y(t.getUint32(16), t.getUint32(20));
1329
+ if (e[0] === 255 && e[1] === 216) {
1330
+ let a = 2;
1331
+ for (; a + 9 < e.length; ) {
1332
+ if (e[a] !== 255) return null;
1333
+ const i = e[a + 1], r = e[a + 2] << 8 | e[a + 3];
1334
+ if (i >= 192 && i <= 207 && i !== 196 && i !== 200 && i !== 204)
1335
+ return Y(
1336
+ e[a + 7] << 8 | e[a + 8],
1337
+ e[a + 5] << 8 | e[a + 6]
1338
+ );
1339
+ if (r < 2) return null;
1340
+ a += 2 + r;
1341
+ }
1342
+ return null;
1343
+ }
1344
+ if (n(0, "RIFF") && n(8, "WEBP")) {
1345
+ if (n(12, "VP8 "))
1346
+ return Y(
1347
+ t.getUint16(26, !0) & 16383,
1348
+ t.getUint16(28, !0) & 16383
1349
+ );
1350
+ if (n(12, "VP8L")) {
1351
+ const a = t.getUint32(21, !0);
1352
+ return Y((a & 16383) + 1, (a >>> 14 & 16383) + 1);
1353
+ }
1354
+ if (n(12, "VP8X")) {
1355
+ const a = (i) => e[i] | e[i + 1] << 8 | e[i + 2] << 16;
1356
+ return Y(a(24) + 1, a(27) + 1);
1357
+ }
1358
+ }
1359
+ return null;
1360
+ }
1361
+ function Jt(e, t) {
1362
+ const n = Math.max(e.width, e.height);
1363
+ if (t <= 0 || n <= t) return e;
1364
+ const a = t / n;
1365
+ return {
1366
+ width: Math.max(1, Math.round(e.width * a)),
1367
+ height: Math.max(1, Math.round(e.height * a))
1368
+ };
1369
+ }
1370
+ function Y(e, t) {
1371
+ return e > 0 && t > 0 ? { width: e, height: t } : null;
1372
+ }
1373
+ function X(e) {
1374
+ return e instanceof Error ? {
1375
+ name: e.name,
1376
+ message: e.message,
1377
+ ...typeof e.code == "string" ? { code: e.code } : {},
1378
+ ...e.stack ? { stack: e.stack } : {}
1379
+ } : { name: "Error", message: String(e) };
1380
+ }
1381
+ const K = globalThis;
1382
+ let ee = null, q = null, te = null, oe = null, le = !1, Zt = 1;
1383
+ const Q = /* @__PURE__ */ new Map();
1384
+ function N(e, t) {
1385
+ K.postMessage(e, t);
1386
+ }
1387
+ function Yt(e, t) {
1388
+ const n = Zt++;
1389
+ return new Promise((a, i) => {
1390
+ Q.set(n, { resolve: a, reject: i }), N({ type: "resource-request", id: n, url: e.href, identifier: t });
1391
+ });
1392
+ }
1393
+ function qt(e) {
1394
+ return ee ?? (ee = Lt(e)), ee;
1395
+ }
1396
+ function Kt(e) {
1397
+ const t = /* @__PURE__ */ new Set();
1398
+ for (const n of e.elements)
1399
+ for (const a of Object.values(n.geometry ?? {}))
1400
+ ArrayBuffer.isView(a) && t.add(a.buffer);
1401
+ return [...t];
1402
+ }
1403
+ async function Qt(e) {
1404
+ if (!te) throw new Error("USD worker has no live stage");
1405
+ const t = te[e.method];
1406
+ return { type: "query-result", id: e.id, value: await t.apply(te, e.args) };
1407
+ }
1408
+ async function en(e, t) {
1409
+ if (typeof createImageBitmap != "function")
1410
+ throw new Error("This browser cannot decode USD textures in a worker.");
1411
+ const n = await fetch(e);
1412
+ if (!n.ok) throw new Error(`HTTP ${n.status} for ${e}`);
1413
+ const a = new Uint8Array(await n.arrayBuffer()), i = Xt(a), r = {
1414
+ imageOrientation: "flipY",
1415
+ premultiplyAlpha: "none",
1416
+ colorSpaceConversion: "none"
1417
+ };
1418
+ if (i) {
1419
+ const s = Jt(i, Math.min(4096, Math.max(1, t)));
1420
+ (s.width !== i.width || s.height !== i.height) && (r.resizeWidth = s.width, r.resizeHeight = s.height, r.resizeQuality = "high");
1421
+ }
1422
+ return createImageBitmap(new Blob([a]), r);
1423
+ }
1424
+ K.onmessage = async (e) => {
1425
+ const t = e.data;
1426
+ if (t.type === "resource-result") {
1427
+ const n = Q.get(t.id);
1428
+ if (!n) return;
1429
+ Q.delete(t.id), t.error ? n.reject(Object.assign(new Error(t.error.message), {
1430
+ name: t.error.name,
1431
+ ...t.error.code ? { code: t.error.code } : {}
1432
+ })) : n.resolve(t.bytes ?? new Uint8Array());
1433
+ return;
1434
+ }
1435
+ if (t.type === "query") {
1436
+ try {
1437
+ N(await Qt(t));
1438
+ } catch (n) {
1439
+ N({ type: "error", id: t.id, error: X(n) });
1440
+ }
1441
+ return;
1442
+ }
1443
+ if (t.type === "decode-texture") {
1444
+ try {
1445
+ const n = await en(t.url, t.maxDimension);
1446
+ N({
1447
+ type: "texture-decoded",
1448
+ id: t.id,
1449
+ bitmap: n,
1450
+ width: n.width,
1451
+ height: n.height
1452
+ }, [n]);
1453
+ } catch (n) {
1454
+ N({ type: "error", id: t.id, error: X(n) });
1455
+ }
1456
+ return;
1457
+ }
1458
+ if (t.type === "dispose") {
1459
+ for (const n of Q.values()) n.reject(new Error("USD worker disposed"));
1460
+ Q.clear(), q == null || q(), te = null, oe = null, le = !1, ee = null, q = null, K.close();
1461
+ return;
1462
+ }
1463
+ if (t.type === "extract-physics") {
1464
+ if (le || !oe) return;
1465
+ le = !0;
1466
+ try {
1467
+ N({ type: "physics-ready", phase: await oe() });
1468
+ } catch (n) {
1469
+ N({ type: "physics-failed", error: X(n) });
1470
+ }
1471
+ return;
1472
+ }
1473
+ if (t.type === "prepare") {
1474
+ try {
1475
+ const n = await qt(t.runtime);
1476
+ t.warmup && await n.warmup(), N({ type: "worker-ready" });
1477
+ } catch (n) {
1478
+ N({ type: "error", error: X(n) }), K.close();
1479
+ }
1480
+ return;
1481
+ }
1482
+ try {
1483
+ if (!ee) throw new Error("USD worker was not prepared before load");
1484
+ const a = await (await ee).parseVisualSceneAsync(t.input, {
1485
+ ...t.options,
1486
+ packagePaths: t.options.packagePaths,
1487
+ readTextureBytes: !1,
1488
+ loadTextures: !1,
1489
+ convertZUp: !1,
1490
+ loadLights: !1,
1491
+ resolveBytes: Yt,
1492
+ onReferenceSkipped: (s) => N({ type: "event", event: "reference-skipped", identifier: s }),
1493
+ onResourceFailed: (s, c) => N({ type: "event", event: "resource-failed", identifier: s, error: X(c) })
1494
+ });
1495
+ q = a.release, te = xe(a.stage, a.pxr), oe = a.readPhysics;
1496
+ const i = a.data, r = Kt(i);
1497
+ N({
1498
+ type: "visual-ready",
1499
+ data: i,
1500
+ textureURLs: [...a.textureURLs ?? []]
1501
+ }, r);
1502
+ } catch (n) {
1503
+ N({ type: "error", error: X(n) }), K.close();
1504
+ }
1505
+ };