@nebula-spatial/viewer 0.5.14 → 0.5.15

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