@nebula-spatial/viewer 0.5.8 → 0.5.10

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,8 +1,8 @@
1
- import { DataTexture as ne, LinearMipmapLinearFilter as ke, LinearFilter as Xe, Loader as J, LoaderUtils as _e, FileLoader as Ve, TextureLoader as Me, RepeatWrapping as ue, ClampToEdgeWrapping as pe, Texture as Y, MeshPhongMaterial as W, MeshLambertMaterial as Se, ColorManagement as N, Color as k, SRGBColorSpace as X, EquirectangularReflectionMapping as Ge, Matrix4 as C, Group as ce, Bone as fe, PropertyBinding as ee, Object3D as Z, PerspectiveCamera as Ne, PointLight as he, MathUtils as B, SpotLight as $e, DirectionalLight as ze, SkinnedMesh as je, Mesh as Fe, LineBasicMaterial as He, Line as We, Vector3 as V, Skeleton as Ye, AmbientLight as qe, BufferGeometry as re, Float32BufferAttribute as j, Uint16BufferAttribute as Ke, Matrix3 as Ze, Vector2 as Qe, ShapeUtils as Je, Vector4 as et, Euler as z, AnimationClip as tt, Quaternion as G, VectorKeyframeTrack as nt, QuaternionKeyframeTrack as de, NumberKeyframeTrack as rt, LoadingManager as st, LinearSRGBColorSpace as me, RGBAFormat as Ie, UnsignedByteType as Ae, NoColorSpace as ot, MeshPhysicalMaterial as De, Box3 as at } from "three";
1
+ import { DataTexture as ne, LinearMipmapLinearFilter as ke, LinearFilter as Xe, Loader as J, LoaderUtils as _e, FileLoader as Ve, TextureLoader as Me, RepeatWrapping as ue, ClampToEdgeWrapping as pe, Texture as Y, MeshPhongMaterial as W, MeshLambertMaterial as Se, ColorManagement as N, Color as k, SRGBColorSpace as X, EquirectangularReflectionMapping as Ge, Matrix4 as L, Group as ce, Bone as fe, PropertyBinding as ee, Object3D as Z, PerspectiveCamera as Ne, PointLight as he, MathUtils as B, SpotLight as $e, DirectionalLight as ze, SkinnedMesh as je, Mesh as Fe, LineBasicMaterial as He, Line as We, Vector3 as V, Skeleton as Ye, AmbientLight as qe, BufferGeometry as re, Float32BufferAttribute as j, Uint16BufferAttribute as Ke, Matrix3 as Ze, Vector2 as Qe, ShapeUtils as Je, Vector4 as et, Euler as z, AnimationClip as tt, Quaternion as G, VectorKeyframeTrack as nt, QuaternionKeyframeTrack as de, NumberKeyframeTrack as rt, LoadingManager as st, LinearSRGBColorSpace as me, RGBAFormat as Ie, UnsignedByteType as Ae, NoColorSpace as at, MeshPhysicalMaterial as De, Box3 as ot } from "three";
2
2
  import { DRACOLoader as it } from "three/examples/jsm/loaders/DRACOLoader.js";
3
3
  import { GLTFLoader as lt } from "three/examples/jsm/loaders/GLTFLoader.js";
4
- import { D as ct } from "./index-CIMsZtyY.js";
5
- import { d as ge, a as ye, S as ut } from "./stage-C2FchK6h.js";
4
+ import { D as ct } from "./index-CZE0uuVY.js";
5
+ import { d as ge, a as ye, S as ut } from "./stage-ivvjzCbR.js";
6
6
  import { TGALoader as pt } from "three/examples/jsm/loaders/TGALoader.js";
7
7
  import * as ft from "three/examples/jsm/libs/fflate.module.js";
8
8
  import { unzlibSync as ht } from "three/examples/jsm/libs/fflate.module.js";
@@ -18,24 +18,24 @@ function $(i, e, t) {
18
18
  function gt(i) {
19
19
  const e = new Uint8Array(i);
20
20
  $(e, 0, 18);
21
- const t = new DataView(i), n = e[2], r = e[16], s = t.getUint16(12, !0), o = t.getUint16(14, !0);
22
- if (Re(s, o), e[1] !== 0 || ![2, 3, 10, 11].includes(n) || !([3, 11].includes(n) ? [8, 16] : [24, 32]).includes(r) || e[17] & 192)
21
+ const t = new DataView(i), n = e[2], r = e[16], s = t.getUint16(12, !0), a = t.getUint16(14, !0);
22
+ if (Re(s, a), e[1] !== 0 || ![2, 3, 10, 11].includes(n) || !([3, 11].includes(n) ? [8, 16] : [24, 32]).includes(r) || e[17] & 192)
23
23
  throw new Error("Unsupported TGA: require non-interleaved 24/32-bit true-color or 8/16-bit grayscale.");
24
- let a = 18 + e[0];
24
+ let o = 18 + e[0];
25
25
  $(e, 18, e[0]);
26
- const l = r / 8, p = s * o;
27
- if (n === 2 || n === 3) $(e, a, p * l);
26
+ const l = r / 8, p = s * a;
27
+ if (n === 2 || n === 3) $(e, o, p * l);
28
28
  else {
29
29
  let u = 0;
30
30
  for (; u < p; ) {
31
- $(e, a, 1);
32
- const c = e[a++], h = (c & 127) + 1;
31
+ $(e, o, 1);
32
+ const c = e[o++], h = (c & 127) + 1;
33
33
  if (u + h > p) throw new Error("Invalid TGA RLE packet length.");
34
34
  const m = (c & 128 ? 1 : h) * l;
35
- $(e, a, m), a += m, u += h;
35
+ $(e, o, m), o += m, u += h;
36
36
  }
37
37
  }
38
- return { data: new pt().parse(i).data, width: s, height: o };
38
+ return { data: new pt().parse(i).data, width: s, height: a };
39
39
  }
40
40
  function ve(i) {
41
41
  const e = i >>> 11 & 31, t = i >>> 5 & 63, n = i & 31;
@@ -48,28 +48,28 @@ function yt(i) {
48
48
  if (n(0) !== 542327876 || n(4) !== 124 || n(76) !== 32) throw new Error("Invalid DDS header.");
49
49
  const r = n(16), s = n(12);
50
50
  if (Re(r, s), n(112) & 2162176 || n(24) > 1) throw new Error("DDS cubemap/volume textures are unsupported.");
51
- const o = n(80), a = String.fromCharCode(...e.subarray(84, 88)), l = (o & 4) !== 0;
52
- if (l && !["DXT1", "DXT3", "DXT5"].includes(a)) throw new Error(`Unsupported DDS FourCC: ${a}. Require DXT1/DXT3/DXT5.`);
51
+ const a = n(80), o = String.fromCharCode(...e.subarray(84, 88)), l = (a & 4) !== 0;
52
+ if (l && !["DXT1", "DXT3", "DXT5"].includes(o)) throw new Error(`Unsupported DDS FourCC: ${o}. Require DXT1/DXT3/DXT5.`);
53
53
  const p = new Uint8Array(r * s * 4);
54
54
  if (!l) {
55
55
  const h = n(88), m = n(92), g = n(96), d = n(100), T = n(104);
56
- if (!(o & 64) || ![24, 32].includes(h) || g !== 65280 || !(m === 16711680 && d === 255 || m === 255 && d === 16711680) || (h === 24 ? T !== 0 : T !== 0 && T !== 4278190080)) throw new Error("Unsupported DDS RGB bit masks.");
56
+ if (!(a & 64) || ![24, 32].includes(h) || g !== 65280 || !(m === 16711680 && d === 255 || m === 255 && d === 16711680) || (h === 24 ? T !== 0 : T !== 0 && T !== 4278190080)) throw new Error("Unsupported DDS RGB bit masks.");
57
57
  const F = h / 8, y = n(8) & 8 ? n(20) : r * F;
58
58
  if (y < r * F) throw new Error("Invalid DDS row pitch.");
59
59
  $(e, 128, y * s);
60
60
  for (let x = 0; x < s; x++) for (let I = 0; I < r; I++) {
61
61
  const A = 128 + x * y + I * F, M = (x * r + I) * 4;
62
- p[M] = e[A + (m === 255 ? 0 : 2)], p[M + 1] = e[A + 1], p[M + 2] = e[A + (d === 255 ? 0 : 2)], p[M + 3] = T && o & 1 ? e[A + 3] : 255;
62
+ p[M] = e[A + (m === 255 ? 0 : 2)], p[M + 1] = e[A + 1], p[M + 2] = e[A + (d === 255 ? 0 : 2)], p[M + 3] = T && a & 1 ? e[A + 3] : 255;
63
63
  }
64
64
  return { data: p, width: r, height: s };
65
65
  }
66
- const f = a === "DXT1" ? 8 : 16, u = Math.ceil(r / 4), c = Math.ceil(s / 4);
66
+ const f = o === "DXT1" ? 8 : 16, u = Math.ceil(r / 4), c = Math.ceil(s / 4);
67
67
  $(e, 128, u * c * f);
68
68
  for (let h = 0; h < c; h++) for (let m = 0; m < u; m++) {
69
- const g = 128 + (h * u + m) * f, d = g + (f === 8 ? 0 : 8), T = t.getUint16(d, !0), F = t.getUint16(d + 2, !0), y = [ve(T), ve(F)], x = a !== "DXT1" || T > F;
69
+ const g = 128 + (h * u + m) * f, d = g + (f === 8 ? 0 : 8), T = t.getUint16(d, !0), F = t.getUint16(d + 2, !0), y = [ve(T), ve(F)], x = o !== "DXT1" || T > F;
70
70
  y.push([0, 1, 2].map((M) => Math.floor(x ? (2 * y[0][M] + y[1][M]) / 3 : (y[0][M] + y[1][M]) / 2)).concat(255)), y.push(x ? [0, 1, 2].map((M) => Math.floor((y[0][M] + 2 * y[1][M]) / 3)).concat(255) : [0, 0, 0, 0]);
71
71
  const I = n(d + 4), A = [e[g], e[g + 1]];
72
- if (a === "DXT5") {
72
+ if (o === "DXT5") {
73
73
  const M = A[0] > A[1] ? 6 : 4;
74
74
  for (let v = 1; v <= M; v++) A.push(Math.floor(((M + 1 - v) * A[0] + v * A[1]) / (M + 1)));
75
75
  M === 4 && A.push(0, 255);
@@ -78,7 +78,7 @@ function yt(i) {
78
78
  const v = m * 4 + M % 4, S = h * 4 + Math.floor(M / 4);
79
79
  if (v >= r || S >= s) continue;
80
80
  const E = y[I >>> 2 * M & 3], b = (S * r + v) * 4;
81
- if (p.set(E, b), a === "DXT3" && (p[b + 3] = (e[g + Math.floor(M / 2)] >>> M % 2 * 4 & 15) * 17), a === "DXT5") {
81
+ if (p.set(E, b), o === "DXT3" && (p[b + 3] = (e[g + Math.floor(M / 2)] >>> M % 2 * 4 & 15) * 17), o === "DXT5") {
82
82
  const D = M * 3, w = g + 2 + Math.floor(D / 8), R = e[w] | (w + 1 < g + 8 ? e[w + 1] : 0) << 8;
83
83
  p[b + 3] = A[R >>> D % 8 & 7];
84
84
  }
@@ -88,11 +88,11 @@ function yt(i) {
88
88
  }
89
89
  function wt(i, e) {
90
90
  const t = e === "tga" ? gt(i) : yt(i), n = new Uint8Array(t.data.length), r = t.width * 4;
91
- for (let o = 0; o < t.height; o++) n.set(t.data.subarray(o * r, (o + 1) * r), (t.height - 1 - o) * r);
91
+ for (let a = 0; a < t.height; a++) n.set(t.data.subarray(a * r, (a + 1) * r), (t.height - 1 - a) * r);
92
92
  const s = new ne(n, t.width, t.height);
93
93
  return s.flipY = !1, s.generateMipmaps = !0, s.minFilter = ke, s.magFilter = Xe, s.needsUpdate = !0, s;
94
94
  }
95
- let L, O, U;
95
+ let C, O, U;
96
96
  class vt extends J {
97
97
  /**
98
98
  * Constructs a new FBX loader.
@@ -112,10 +112,10 @@ class vt extends J {
112
112
  * @param {onErrorCallback} onError - Executed when errors occur.
113
113
  */
114
114
  load(e, t, n, r) {
115
- const s = this, o = s.path === "" ? _e.extractUrlBase(e) : s.path, a = new Ve(this.manager);
116
- a.setPath(s.path), a.setResponseType("arraybuffer"), a.setRequestHeader(s.requestHeader), a.setWithCredentials(s.withCredentials), a.load(e, function(l) {
115
+ const s = this, a = s.path === "" ? _e.extractUrlBase(e) : s.path, o = new Ve(this.manager);
116
+ o.setPath(s.path), o.setResponseType("arraybuffer"), o.setRequestHeader(s.requestHeader), o.setWithCredentials(s.withCredentials), o.load(e, function(l) {
117
117
  try {
118
- t(s.parse(l, o));
118
+ t(s.parse(l, a));
119
119
  } catch (p) {
120
120
  r ? r(p) : console.error(p), s.manager.itemError(e);
121
121
  }
@@ -130,17 +130,17 @@ class vt extends J {
130
130
  */
131
131
  parse(e, t) {
132
132
  if (St(e))
133
- L = new Mt().parse(e);
133
+ C = new Mt().parse(e);
134
134
  else {
135
- const r = Ce(e);
135
+ const r = Le(e);
136
136
  if (!Ft(r))
137
137
  throw new Error("THREE.FBXLoader: Unknown format.");
138
138
  if (xe(r) < 7e3)
139
139
  throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: " + xe(r));
140
- L = new bt().parse(r);
140
+ C = new bt().parse(r);
141
141
  }
142
142
  const n = new Me(this.manager).setPath(this.resourcePath || t).setCrossOrigin(this.crossOrigin);
143
- return new Tt(n, this.manager).parse(L);
143
+ return new Tt(n, this.manager).parse(C);
144
144
  }
145
145
  }
146
146
  class Tt {
@@ -156,18 +156,18 @@ class Tt {
156
156
  // and details the connection type
157
157
  parseConnections() {
158
158
  const e = /* @__PURE__ */ new Map();
159
- return "Connections" in L && L.Connections.connections.forEach(function(n) {
160
- const r = n[0], s = n[1], o = n[2];
159
+ return "Connections" in C && C.Connections.connections.forEach(function(n) {
160
+ const r = n[0], s = n[1], a = n[2];
161
161
  e.has(r) || e.set(r, {
162
162
  parents: [],
163
163
  children: []
164
164
  });
165
- const a = { ID: s, relationship: o };
166
- e.get(r).parents.push(a), e.has(s) || e.set(s, {
165
+ const o = { ID: s, relationship: a };
166
+ e.get(r).parents.push(o), e.has(s) || e.set(s, {
167
167
  parents: [],
168
168
  children: []
169
169
  });
170
- const l = { ID: r, relationship: o };
170
+ const l = { ID: r, relationship: a };
171
171
  e.get(s).children.push(l);
172
172
  }), e;
173
173
  }
@@ -176,13 +176,13 @@ class Tt {
176
176
  // via FBXTree.Connections.
177
177
  parseImages() {
178
178
  const e = {}, t = {};
179
- if ("Video" in L.Objects) {
180
- const n = L.Objects.Video;
179
+ if ("Video" in C.Objects) {
180
+ const n = C.Objects.Video;
181
181
  for (const r in n) {
182
- const s = n[r], o = parseInt(r);
183
- if (e[o] = s.RelativeFilename || s.Filename, "Content" in s) {
184
- const a = s.Content instanceof ArrayBuffer && s.Content.byteLength > 0, l = typeof s.Content == "string" && s.Content !== "";
185
- if (a || l) {
182
+ const s = n[r], a = parseInt(r);
183
+ if (e[a] = s.RelativeFilename || s.Filename, "Content" in s) {
184
+ const o = s.Content instanceof ArrayBuffer && s.Content.byteLength > 0, l = typeof s.Content == "string" && s.Content !== "";
185
+ if (o || l) {
186
186
  const p = this.parseImage(n[r]);
187
187
  t[s.RelativeFilename || s.Filename] = p;
188
188
  }
@@ -226,8 +226,8 @@ class Tt {
226
226
  if (typeof t == "string")
227
227
  return "data:" + s + ";base64," + t;
228
228
  {
229
- const o = new Uint8Array(t);
230
- return window.URL.createObjectURL(new Blob([o], { type: s }));
229
+ const a = new Uint8Array(t);
230
+ return window.URL.createObjectURL(new Blob([a], { type: s }));
231
231
  }
232
232
  }
233
233
  // Parse nodes in FBXTree.Objects.Texture
@@ -235,8 +235,8 @@ class Tt {
235
235
  // to images in FBXTree.Objects.Video
236
236
  parseTextures(e) {
237
237
  const t = /* @__PURE__ */ new Map();
238
- if ("Texture" in L.Objects) {
239
- const n = L.Objects.Texture;
238
+ if ("Texture" in C.Objects) {
239
+ const n = C.Objects.Texture;
240
240
  for (const r in n) {
241
241
  const s = this.parseTexture(n[r], e);
242
242
  t.set(parseInt(r), s);
@@ -248,8 +248,8 @@ class Tt {
248
248
  parseTexture(e, t) {
249
249
  const n = this.loadTexture(e, t);
250
250
  n.ID = e.id, n.name = e.attrName;
251
- const r = e.WrapModeU, s = e.WrapModeV, o = r !== void 0 ? r.value : 0, a = s !== void 0 ? s.value : 0;
252
- if (n.wrapS = o === 0 ? ue : pe, n.wrapT = a === 0 ? ue : pe, "Scaling" in e) {
251
+ const r = e.WrapModeU, s = e.WrapModeV, a = r !== void 0 ? r.value : 0, o = s !== void 0 ? s.value : 0;
252
+ if (n.wrapS = a === 0 ? ue : pe, n.wrapT = o === 0 ? ue : pe, "Scaling" in e) {
253
253
  const l = e.Scaling.value;
254
254
  n.repeat.x = l[0], n.repeat.y = l[1];
255
255
  }
@@ -266,18 +266,18 @@ class Tt {
266
266
  r === null && (r = this.textureLoader);
267
267
  const s = r.path;
268
268
  s || r.setPath(this.textureLoader.path);
269
- const o = O.get(e.id).children;
270
- let a;
271
- if (o !== void 0 && o.length > 0 && t[o[0].ID] !== void 0 && (a = t[o[0].ID], (a.indexOf("blob:") === 0 || a.indexOf("data:") === 0) && r.setPath(void 0)), a === void 0)
269
+ const a = O.get(e.id).children;
270
+ let o;
271
+ if (a !== void 0 && a.length > 0 && t[a[0].ID] !== void 0 && (o = t[a[0].ID], (o.indexOf("blob:") === 0 || o.indexOf("data:") === 0) && r.setPath(void 0)), o === void 0)
272
272
  return console.warn("FBXLoader: Undefined filename, creating placeholder texture."), new Y();
273
- const l = r.load(a);
273
+ const l = r.load(o);
274
274
  return r.setPath(s), l;
275
275
  }
276
276
  // Parse nodes in FBXTree.Objects.Material
277
277
  parseMaterials(e) {
278
278
  const t = /* @__PURE__ */ new Map();
279
- if ("Material" in L.Objects) {
280
- const n = L.Objects.Material;
279
+ if ("Material" in C.Objects) {
280
+ const n = C.Objects.Material;
281
281
  for (const r in n) {
282
282
  const s = this.parseMaterial(n[r], e);
283
283
  s !== null && t.set(parseInt(r), s);
@@ -292,20 +292,20 @@ class Tt {
292
292
  const n = e.id, r = e.attrName;
293
293
  let s = e.ShadingModel;
294
294
  if (typeof s == "object" && (s = s.value), !O.has(n)) return null;
295
- const o = this.parseParameters(e, t, n);
296
- let a;
295
+ const a = this.parseParameters(e, t, n);
296
+ let o;
297
297
  switch (s.toLowerCase()) {
298
298
  case "phong":
299
- a = new W();
299
+ o = new W();
300
300
  break;
301
301
  case "lambert":
302
- a = new Se();
302
+ o = new Se();
303
303
  break;
304
304
  default:
305
- console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.', s), a = new W();
305
+ console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.', s), o = new W();
306
306
  break;
307
307
  }
308
- return a.setValues(o), a.name = r, a;
308
+ return o.setValues(a), o.name = r, o;
309
309
  }
310
310
  // Parse FBX material and return parameters suitable for a three.js material
311
311
  // Also parse the texture map and return any textures associated with the material
@@ -313,70 +313,70 @@ class Tt {
313
313
  const r = {};
314
314
  e.BumpFactor && (r.bumpScale = e.BumpFactor.value), e.Diffuse ? r.color = N.colorSpaceToWorking(new k().fromArray(e.Diffuse.value), X) : e.DiffuseColor && (e.DiffuseColor.type === "Color" || e.DiffuseColor.type === "ColorRGB") && (r.color = N.colorSpaceToWorking(new k().fromArray(e.DiffuseColor.value), X)), e.DisplacementFactor && (r.displacementScale = e.DisplacementFactor.value), e.Emissive ? r.emissive = N.colorSpaceToWorking(new k().fromArray(e.Emissive.value), X) : e.EmissiveColor && (e.EmissiveColor.type === "Color" || e.EmissiveColor.type === "ColorRGB") && (r.emissive = N.colorSpaceToWorking(new k().fromArray(e.EmissiveColor.value), X)), e.EmissiveFactor && (r.emissiveIntensity = parseFloat(e.EmissiveFactor.value)), r.opacity = 1 - (e.TransparencyFactor ? parseFloat(e.TransparencyFactor.value) : 0), (r.opacity === 1 || r.opacity === 0) && (r.opacity = e.Opacity ? parseFloat(e.Opacity.value) : null, r.opacity === null && (r.opacity = 1 - (e.TransparentColor ? parseFloat(e.TransparentColor.value[0]) : 0))), r.opacity < 1 && (r.transparent = !0), e.ReflectionFactor && (r.reflectivity = e.ReflectionFactor.value), e.Shininess && (r.shininess = e.Shininess.value), e.Specular ? r.specular = N.colorSpaceToWorking(new k().fromArray(e.Specular.value), X) : e.SpecularColor && e.SpecularColor.type === "Color" && (r.specular = N.colorSpaceToWorking(new k().fromArray(e.SpecularColor.value), X));
315
315
  const s = this;
316
- return O.get(n).children.forEach(function(o) {
317
- const a = o.relationship;
318
- switch (a) {
316
+ return O.get(n).children.forEach(function(a) {
317
+ const o = a.relationship;
318
+ switch (o) {
319
319
  case "Bump":
320
- r.bumpMap = s.getTexture(t, o.ID);
320
+ r.bumpMap = s.getTexture(t, a.ID);
321
321
  break;
322
322
  case "Maya|TEX_ao_map":
323
- r.aoMap = s.getTexture(t, o.ID);
323
+ r.aoMap = s.getTexture(t, a.ID);
324
324
  break;
325
325
  case "DiffuseColor":
326
326
  case "Maya|TEX_color_map":
327
- r.map = s.getTexture(t, o.ID), r.map !== void 0 && (r.map.colorSpace = X);
327
+ r.map = s.getTexture(t, a.ID), r.map !== void 0 && (r.map.colorSpace = X);
328
328
  break;
329
329
  case "DisplacementColor":
330
- r.displacementMap = s.getTexture(t, o.ID);
330
+ r.displacementMap = s.getTexture(t, a.ID);
331
331
  break;
332
332
  case "EmissiveColor":
333
- r.emissiveMap = s.getTexture(t, o.ID), r.emissiveMap !== void 0 && (r.emissiveMap.colorSpace = X);
333
+ r.emissiveMap = s.getTexture(t, a.ID), r.emissiveMap !== void 0 && (r.emissiveMap.colorSpace = X);
334
334
  break;
335
335
  case "NormalMap":
336
336
  case "Maya|TEX_normal_map":
337
- r.normalMap = s.getTexture(t, o.ID);
337
+ r.normalMap = s.getTexture(t, a.ID);
338
338
  break;
339
339
  case "ReflectionColor":
340
- r.envMap = s.getTexture(t, o.ID), r.envMap !== void 0 && (r.envMap.mapping = Ge, r.envMap.colorSpace = X);
340
+ r.envMap = s.getTexture(t, a.ID), r.envMap !== void 0 && (r.envMap.mapping = Ge, r.envMap.colorSpace = X);
341
341
  break;
342
342
  case "SpecularColor":
343
- r.specularMap = s.getTexture(t, o.ID), r.specularMap !== void 0 && (r.specularMap.colorSpace = X);
343
+ r.specularMap = s.getTexture(t, a.ID), r.specularMap !== void 0 && (r.specularMap.colorSpace = X);
344
344
  break;
345
345
  case "TransparentColor":
346
346
  case "TransparencyFactor":
347
- r.alphaMap = s.getTexture(t, o.ID), r.transparent = !0;
347
+ r.alphaMap = s.getTexture(t, a.ID), r.transparent = !0;
348
348
  break;
349
349
  case "AmbientColor":
350
350
  case "ShininessExponent":
351
351
  case "SpecularFactor":
352
352
  case "VectorDisplacementColor":
353
353
  default:
354
- console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.", a);
354
+ console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.", o);
355
355
  break;
356
356
  }
357
357
  }), r;
358
358
  }
359
359
  // get a texture from the textureMap for use by a material.
360
360
  getTexture(e, t) {
361
- return "LayeredTexture" in L.Objects && t in L.Objects.LayeredTexture && (console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."), t = O.get(t).children[0].ID), e.get(t);
361
+ return "LayeredTexture" in C.Objects && t in C.Objects.LayeredTexture && (console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."), t = O.get(t).children[0].ID), e.get(t);
362
362
  }
363
363
  // Parse nodes in FBXTree.Objects.Deformer
364
364
  // Deformer node can contain skinning or Vertex Cache animation data, however only skinning is supported here
365
365
  // Generates map of Skeleton-like objects for use later when generating and binding skeletons.
366
366
  parseDeformers() {
367
367
  const e = {}, t = {};
368
- if ("Deformer" in L.Objects) {
369
- const n = L.Objects.Deformer;
368
+ if ("Deformer" in C.Objects) {
369
+ const n = C.Objects.Deformer;
370
370
  for (const r in n) {
371
- const s = n[r], o = O.get(parseInt(r));
371
+ const s = n[r], a = O.get(parseInt(r));
372
372
  if (s.attrType === "Skin") {
373
- const a = this.parseSkeleton(o, n);
374
- a.ID = r, o.parents.length > 1 && console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."), a.geometryID = o.parents[0].ID, e[r] = a;
373
+ const o = this.parseSkeleton(a, n);
374
+ o.ID = r, a.parents.length > 1 && console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."), o.geometryID = a.parents[0].ID, e[r] = o;
375
375
  } else if (s.attrType === "BlendShape") {
376
- const a = {
376
+ const o = {
377
377
  id: r
378
378
  };
379
- a.rawTargets = this.parseMorphTargets(o, n), a.id = r, o.parents.length > 1 && console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."), t[r] = a;
379
+ o.rawTargets = this.parseMorphTargets(a, n), o.id = r, a.parents.length > 1 && console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."), t[r] = o;
380
380
  }
381
381
  }
382
382
  }
@@ -393,15 +393,15 @@ class Tt {
393
393
  return e.children.forEach(function(r) {
394
394
  const s = t[r.ID];
395
395
  if (s.attrType !== "Cluster") return;
396
- const o = {
396
+ const a = {
397
397
  ID: r.ID,
398
398
  indices: [],
399
399
  weights: [],
400
- transformLink: new C().fromArray(s.TransformLink.a)
400
+ transformLink: new L().fromArray(s.TransformLink.a)
401
401
  // transform: new Matrix4().fromArray( boneNode.Transform.a ),
402
402
  // linkMode: boneNode.Mode,
403
403
  };
404
- "Indexes" in s && (o.indices = s.Indexes.a, o.weights = s.Weights.a), n.push(o);
404
+ "Indexes" in s && (a.indices = s.Indexes.a, a.weights = s.Weights.a), n.push(a);
405
405
  }), {
406
406
  rawBones: n,
407
407
  bones: []
@@ -411,46 +411,46 @@ class Tt {
411
411
  parseMorphTargets(e, t) {
412
412
  const n = [];
413
413
  for (let r = 0; r < e.children.length; r++) {
414
- const s = e.children[r], o = t[s.ID], a = {
415
- name: o.attrName,
416
- initialWeight: o.DeformPercent,
417
- id: o.id,
418
- fullWeights: o.FullWeights.a
414
+ const s = e.children[r], a = t[s.ID], o = {
415
+ name: a.attrName,
416
+ initialWeight: a.DeformPercent,
417
+ id: a.id,
418
+ fullWeights: a.FullWeights.a
419
419
  };
420
- if (o.attrType !== "BlendShapeChannel") return;
421
- a.geoID = O.get(parseInt(s.ID)).children.filter(function(l) {
420
+ if (a.attrType !== "BlendShapeChannel") return;
421
+ o.geoID = O.get(parseInt(s.ID)).children.filter(function(l) {
422
422
  return l.relationship === void 0;
423
- })[0].ID, n.push(a);
423
+ })[0].ID, n.push(o);
424
424
  }
425
425
  return n;
426
426
  }
427
427
  // create the main Group() to be returned by the loader
428
428
  parseScene(e, t, n) {
429
429
  U = new ce();
430
- const r = this.parseModels(e.skeletons, t, n), s = L.Objects.Model, o = this;
430
+ const r = this.parseModels(e.skeletons, t, n), s = C.Objects.Model, a = this;
431
431
  r.forEach(function(l) {
432
432
  const p = s[l.ID];
433
- o.setLookAtProperties(l, p), O.get(l.ID).parents.forEach(function(u) {
433
+ a.setLookAtProperties(l, p), O.get(l.ID).parents.forEach(function(u) {
434
434
  const c = r.get(u.ID);
435
435
  c !== void 0 && c.add(l);
436
436
  }), l.parent === null && U.add(l);
437
437
  }), this.bindSkeleton(e.skeletons, t, r), this.addGlobalSceneSettings(), U.traverse(function(l) {
438
438
  if (l.userData.transformData) {
439
439
  l.parent && (l.userData.transformData.parentMatrix = l.parent.matrix, l.userData.transformData.parentMatrixWorld = l.parent.matrixWorld);
440
- const p = Le(l.userData.transformData);
440
+ const p = Ce(l.userData.transformData);
441
441
  l.applyMatrix4(p), l.updateWorldMatrix();
442
442
  }
443
443
  });
444
- const a = new Et().parse();
445
- U.children.length === 1 && U.children[0].isGroup && (U.children[0].animations = a, U = U.children[0]), U.animations = a;
444
+ const o = new Et().parse();
445
+ U.children.length === 1 && U.children[0].isGroup && (U.children[0].animations = o, U = U.children[0]), U.animations = o;
446
446
  }
447
447
  // parse nodes in FBXTree.Objects.Model
448
448
  parseModels(e, t, n) {
449
- const r = /* @__PURE__ */ new Map(), s = L.Objects.Model;
450
- for (const o in s) {
451
- const a = parseInt(o), l = s[o], p = O.get(a);
449
+ const r = /* @__PURE__ */ new Map(), s = C.Objects.Model;
450
+ for (const a in s) {
451
+ const o = parseInt(a), l = s[a], p = O.get(o);
452
452
  if (p === void 0) continue;
453
- let f = this.buildSkeleton(p, e, a, l.attrName);
453
+ let f = this.buildSkeleton(p, e, o, l.attrName);
454
454
  if (!f) {
455
455
  switch (l.attrType) {
456
456
  case "Camera":
@@ -474,19 +474,19 @@ class Tt {
474
474
  f = new ce();
475
475
  break;
476
476
  }
477
- f.name = l.attrName ? ee.sanitizeNodeName(l.attrName) : "", f.userData.originalName = l.attrName, f.ID = a;
477
+ f.name = l.attrName ? ee.sanitizeNodeName(l.attrName) : "", f.userData.originalName = l.attrName, f.ID = o;
478
478
  }
479
- this.getTransformData(f, l), r.set(a, f);
479
+ this.getTransformData(f, l), r.set(o, f);
480
480
  }
481
481
  return r;
482
482
  }
483
483
  buildSkeleton(e, t, n, r) {
484
484
  let s = null;
485
- return e.parents.forEach(function(o) {
486
- for (const a in t) {
487
- const l = t[a];
485
+ return e.parents.forEach(function(a) {
486
+ for (const o in t) {
487
+ const l = t[o];
488
488
  l.rawBones.forEach(function(p, f) {
489
- if (p.ID === o.ID) {
489
+ if (p.ID === a.ID) {
490
490
  const u = s;
491
491
  s = new fe(), s.matrixWorld.copy(p.transformLink), s.name = r ? ee.sanitizeNodeName(r) : "", s.userData.originalName = r, s.ID = n, l.bones[f] = s, u !== null && s.add(u);
492
492
  }
@@ -498,7 +498,7 @@ class Tt {
498
498
  createCamera(e) {
499
499
  let t, n;
500
500
  if (e.children.forEach(function(r) {
501
- const s = L.Objects.NodeAttribute[r.ID];
501
+ const s = C.Objects.NodeAttribute[r.ID];
502
502
  s !== void 0 && (n = s);
503
503
  }), n === void 0)
504
504
  t = new Z();
@@ -507,17 +507,17 @@ class Tt {
507
507
  n.CameraProjectionType !== void 0 && n.CameraProjectionType.value === 1 && (r = 1);
508
508
  let s = 1;
509
509
  n.NearPlane !== void 0 && (s = n.NearPlane.value / 1e3);
510
- let o = 1e3;
511
- n.FarPlane !== void 0 && (o = n.FarPlane.value / 1e3);
512
- let a = window.innerWidth, l = window.innerHeight;
513
- n.AspectWidth !== void 0 && n.AspectHeight !== void 0 && (a = n.AspectWidth.value, l = n.AspectHeight.value);
514
- const p = a / l;
510
+ let a = 1e3;
511
+ n.FarPlane !== void 0 && (a = n.FarPlane.value / 1e3);
512
+ let o = window.innerWidth, l = window.innerHeight;
513
+ n.AspectWidth !== void 0 && n.AspectHeight !== void 0 && (o = n.AspectWidth.value, l = n.AspectHeight.value);
514
+ const p = o / l;
515
515
  let f = 45;
516
516
  n.FieldOfView !== void 0 && (f = n.FieldOfView.value);
517
517
  const u = n.FocalLength ? n.FocalLength.value : null;
518
518
  switch (r) {
519
519
  case 0:
520
- t = new Ne(f, p, s, o), u !== null && t.setFocalLength(u);
520
+ t = new Ne(f, p, s, a), u !== null && t.setFocalLength(u);
521
521
  break;
522
522
  case 1:
523
523
  console.warn("THREE.FBXLoader: Orthographic cameras not supported yet."), t = new Z();
@@ -533,7 +533,7 @@ class Tt {
533
533
  createLight(e) {
534
534
  let t, n;
535
535
  if (e.children.forEach(function(r) {
536
- const s = L.Objects.NodeAttribute[r.ID];
536
+ const s = C.Objects.NodeAttribute[r.ID];
537
537
  s !== void 0 && (n = s);
538
538
  }), n === void 0)
539
539
  t = new Z();
@@ -542,26 +542,26 @@ class Tt {
542
542
  n.LightType === void 0 ? r = 0 : r = n.LightType.value;
543
543
  let s = 16777215;
544
544
  n.Color !== void 0 && (s = N.colorSpaceToWorking(new k().fromArray(n.Color.value), X));
545
- let o = n.Intensity === void 0 ? 1 : n.Intensity.value / 100;
546
- n.CastLightOnObject !== void 0 && n.CastLightOnObject.value === 0 && (o = 0);
547
- let a = 0;
548
- n.FarAttenuationEnd !== void 0 && (n.EnableFarAttenuation !== void 0 && n.EnableFarAttenuation.value === 0 ? a = 0 : a = n.FarAttenuationEnd.value);
545
+ let a = n.Intensity === void 0 ? 1 : n.Intensity.value / 100;
546
+ n.CastLightOnObject !== void 0 && n.CastLightOnObject.value === 0 && (a = 0);
547
+ let o = 0;
548
+ n.FarAttenuationEnd !== void 0 && (n.EnableFarAttenuation !== void 0 && n.EnableFarAttenuation.value === 0 ? o = 0 : o = n.FarAttenuationEnd.value);
549
549
  const l = 1;
550
550
  switch (r) {
551
551
  case 0:
552
- t = new he(s, o, a, l);
552
+ t = new he(s, a, o, l);
553
553
  break;
554
554
  case 1:
555
- t = new ze(s, o);
555
+ t = new ze(s, a);
556
556
  break;
557
557
  case 2:
558
558
  let p = Math.PI / 3;
559
559
  n.InnerAngle !== void 0 && (p = B.degToRad(n.InnerAngle.value));
560
560
  let f = 0;
561
- n.OuterAngle !== void 0 && (f = B.degToRad(n.OuterAngle.value), f = Math.max(f, 1)), t = new $e(s, o, a, p, f, l);
561
+ n.OuterAngle !== void 0 && (f = B.degToRad(n.OuterAngle.value), f = Math.max(f, 1)), t = new $e(s, a, o, p, f, l);
562
562
  break;
563
563
  default:
564
- console.warn("THREE.FBXLoader: Unknown light type " + n.LightType.value + ", defaulting to a PointLight."), t = new he(s, o);
564
+ console.warn("THREE.FBXLoader: Unknown light type " + n.LightType.value + ", defaulting to a PointLight."), t = new he(s, a);
565
565
  break;
566
566
  }
567
567
  n.CastShadows !== void 0 && n.CastShadows.value === 1 && (t.castShadow = !0);
@@ -569,31 +569,31 @@ class Tt {
569
569
  return t;
570
570
  }
571
571
  createMesh(e, t, n) {
572
- let r, s = null, o = null;
573
- const a = [];
572
+ let r, s = null, a = null;
573
+ const o = [];
574
574
  if (e.children.forEach(function(l) {
575
- t.has(l.ID) && (s = t.get(l.ID)), n.has(l.ID) && a.push(n.get(l.ID));
576
- }), a.length > 1 ? o = a : a.length > 0 ? o = a[0] : (o = new W({
575
+ t.has(l.ID) && (s = t.get(l.ID)), n.has(l.ID) && o.push(n.get(l.ID));
576
+ }), o.length > 1 ? a = o : o.length > 0 ? a = o[0] : (a = new W({
577
577
  name: J.DEFAULT_MATERIAL_NAME,
578
578
  color: 13421772
579
- }), a.push(o)), "color" in s.attributes && a.forEach(function(l) {
579
+ }), o.push(a)), "color" in s.attributes && o.forEach(function(l) {
580
580
  l.vertexColors = !0;
581
581
  }), s.groups.length > 0) {
582
582
  let l = !1;
583
583
  for (let p = 0, f = s.groups.length; p < f; p++) {
584
584
  const u = s.groups[p];
585
- (u.materialIndex < 0 || u.materialIndex >= a.length) && (u.materialIndex = a.length, l = !0);
585
+ (u.materialIndex < 0 || u.materialIndex >= o.length) && (u.materialIndex = o.length, l = !0);
586
586
  }
587
587
  if (l) {
588
588
  const p = new W();
589
- a.push(p);
589
+ o.push(p);
590
590
  }
591
591
  }
592
- return s.FBX_Deformer ? (r = new je(s, o), r.normalizeSkinWeights()) : r = new Fe(s, o), r;
592
+ return s.FBX_Deformer ? (r = new je(s, a), r.normalizeSkinWeights()) : r = new Fe(s, a), r;
593
593
  }
594
594
  createCurve(e, t) {
595
- const n = e.children.reduce(function(s, o) {
596
- return t.has(o.ID) && (s = t.get(o.ID)), s;
595
+ const n = e.children.reduce(function(s, a) {
596
+ return t.has(a.ID) && (s = t.get(a.ID)), s;
597
597
  }, null), r = new He({
598
598
  name: J.DEFAULT_MATERIAL_NAME,
599
599
  color: 3342591,
@@ -609,10 +609,10 @@ class Tt {
609
609
  setLookAtProperties(e, t) {
610
610
  "LookAtProperty" in t && O.get(e.ID).children.forEach(function(r) {
611
611
  if (r.relationship === "LookAtProperty") {
612
- const s = L.Objects.Model[r.ID];
612
+ const s = C.Objects.Model[r.ID];
613
613
  if ("Lcl_Translation" in s) {
614
- const o = s.Lcl_Translation.value;
615
- e.target !== void 0 ? (e.target.position.fromArray(o), U.add(e.target)) : e.lookAt(new V().fromArray(o));
614
+ const a = s.Lcl_Translation.value;
615
+ e.target !== void 0 ? (e.target.position.fromArray(a), U.add(e.target)) : e.lookAt(new V().fromArray(a));
616
616
  }
617
617
  }
618
618
  });
@@ -620,12 +620,12 @@ class Tt {
620
620
  bindSkeleton(e, t, n) {
621
621
  const r = this.parsePoseNodes();
622
622
  for (const s in e) {
623
- const o = e[s];
624
- O.get(parseInt(o.ID)).parents.forEach(function(l) {
623
+ const a = e[s];
624
+ O.get(parseInt(a.ID)).parents.forEach(function(l) {
625
625
  if (t.has(l.ID)) {
626
626
  const p = l.ID;
627
627
  O.get(p).parents.forEach(function(u) {
628
- n.has(u.ID) && n.get(u.ID).bind(new Ye(o.bones), r[u.ID]);
628
+ n.has(u.ID) && n.get(u.ID).bind(new Ye(a.bones), r[u.ID]);
629
629
  });
630
630
  }
631
631
  });
@@ -633,28 +633,28 @@ class Tt {
633
633
  }
634
634
  parsePoseNodes() {
635
635
  const e = {};
636
- if ("Pose" in L.Objects) {
637
- const t = L.Objects.Pose;
636
+ if ("Pose" in C.Objects) {
637
+ const t = C.Objects.Pose;
638
638
  for (const n in t)
639
639
  if (t[n].attrType === "BindPose" && t[n].NbPoseNodes > 0) {
640
640
  const r = t[n].PoseNode;
641
641
  Array.isArray(r) ? r.forEach(function(s) {
642
- e[s.Node] = new C().fromArray(s.Matrix.a);
643
- }) : e[r.Node] = new C().fromArray(r.Matrix.a);
642
+ e[s.Node] = new L().fromArray(s.Matrix.a);
643
+ }) : e[r.Node] = new L().fromArray(r.Matrix.a);
644
644
  }
645
645
  }
646
646
  return e;
647
647
  }
648
648
  addGlobalSceneSettings() {
649
- if ("GlobalSettings" in L) {
650
- if ("AmbientColor" in L.GlobalSettings) {
651
- const e = L.GlobalSettings.AmbientColor.value, t = e[0], n = e[1], r = e[2];
649
+ if ("GlobalSettings" in C) {
650
+ if ("AmbientColor" in C.GlobalSettings) {
651
+ const e = C.GlobalSettings.AmbientColor.value, t = e[0], n = e[1], r = e[2];
652
652
  if (t !== 0 || n !== 0 || r !== 0) {
653
653
  const s = new k().setRGB(t, n, r, X);
654
654
  U.add(new qe(s, 1));
655
655
  }
656
656
  }
657
- "UnitScaleFactor" in L.GlobalSettings && (U.userData.unitScaleFactor = L.GlobalSettings.UnitScaleFactor.value);
657
+ "UnitScaleFactor" in C.GlobalSettings && (U.userData.unitScaleFactor = C.GlobalSettings.UnitScaleFactor.value);
658
658
  }
659
659
  }
660
660
  }
@@ -665,11 +665,11 @@ class xt {
665
665
  // Parse nodes in FBXTree.Objects.Geometry
666
666
  parse(e) {
667
667
  const t = /* @__PURE__ */ new Map();
668
- if ("Geometry" in L.Objects) {
669
- const n = L.Objects.Geometry;
668
+ if ("Geometry" in C.Objects) {
669
+ const n = C.Objects.Geometry;
670
670
  for (const r in n) {
671
- const s = O.get(parseInt(r)), o = this.parseGeometry(s, n[r], e);
672
- t.set(parseInt(r), o);
671
+ const s = O.get(parseInt(r)), a = this.parseGeometry(s, n[r], e);
672
+ t.set(parseInt(r), a);
673
673
  }
674
674
  }
675
675
  return this.negativeMaterialIndices === !0 && console.warn("THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected."), t;
@@ -685,42 +685,42 @@ class xt {
685
685
  }
686
686
  // Parse single node mesh geometry in FBXTree.Objects.Geometry
687
687
  parseMeshGeometry(e, t, n) {
688
- const r = n.skeletons, s = [], o = e.parents.map(function(u) {
689
- return L.Objects.Model[u.ID];
688
+ const r = n.skeletons, s = [], a = e.parents.map(function(u) {
689
+ return C.Objects.Model[u.ID];
690
690
  });
691
- if (o.length === 0) return;
692
- const a = e.children.reduce(function(u, c) {
691
+ if (a.length === 0) return;
692
+ const o = e.children.reduce(function(u, c) {
693
693
  return r[c.ID] !== void 0 && (u = r[c.ID]), u;
694
694
  }, null);
695
695
  e.children.forEach(function(u) {
696
696
  n.morphTargets[u.ID] !== void 0 && s.push(n.morphTargets[u.ID]);
697
697
  });
698
- const l = o[0], p = {};
698
+ const l = a[0], p = {};
699
699
  "RotationOrder" in l && (p.eulerOrder = q(l.RotationOrder.value)), "InheritType" in l && (p.inheritType = parseInt(l.InheritType.value)), "GeometricTranslation" in l && (p.translation = l.GeometricTranslation.value), "GeometricRotation" in l && (p.rotation = l.GeometricRotation.value), "GeometricScaling" in l && (p.scale = l.GeometricScaling.value);
700
- const f = Le(p);
701
- return this.genGeometry(t, a, s, f);
700
+ const f = Ce(p);
701
+ return this.genGeometry(t, o, s, f);
702
702
  }
703
703
  // Generate a BufferGeometry from a node in FBXTree.Objects.Geometry
704
704
  genGeometry(e, t, n, r) {
705
705
  const s = new re();
706
706
  e.attrName && (s.name = e.attrName);
707
- const o = this.parseGeoNode(e, t), a = this.genBuffers(o), l = new j(a.vertex, 3);
708
- if (l.applyMatrix4(r), s.setAttribute("position", l), a.colors.length > 0 && s.setAttribute("color", new j(a.colors, 3)), t && (s.setAttribute("skinIndex", new Ke(a.weightsIndices, 4)), s.setAttribute("skinWeight", new j(a.vertexWeights, 4)), s.FBX_Deformer = t), a.normal.length > 0) {
709
- const p = new Ze().getNormalMatrix(r), f = new j(a.normal, 3);
707
+ const a = this.parseGeoNode(e, t), o = this.genBuffers(a), l = new j(o.vertex, 3);
708
+ if (l.applyMatrix4(r), s.setAttribute("position", l), o.colors.length > 0 && s.setAttribute("color", new j(o.colors, 3)), t && (s.setAttribute("skinIndex", new Ke(o.weightsIndices, 4)), s.setAttribute("skinWeight", new j(o.vertexWeights, 4)), s.FBX_Deformer = t), o.normal.length > 0) {
709
+ const p = new Ze().getNormalMatrix(r), f = new j(o.normal, 3);
710
710
  f.applyNormalMatrix(p), s.setAttribute("normal", f);
711
711
  }
712
- if (a.uvs.forEach(function(p, f) {
712
+ if (o.uvs.forEach(function(p, f) {
713
713
  const u = f === 0 ? "uv" : `uv${f}`;
714
- s.setAttribute(u, new j(a.uvs[f], 2));
715
- }), o.material && o.material.mappingType !== "AllSame") {
716
- let p = a.materialIndex[0], f = 0;
717
- if (a.materialIndex.forEach(function(u, c) {
714
+ s.setAttribute(u, new j(o.uvs[f], 2));
715
+ }), a.material && a.material.mappingType !== "AllSame") {
716
+ let p = o.materialIndex[0], f = 0;
717
+ if (o.materialIndex.forEach(function(u, c) {
718
718
  u !== p && (s.addGroup(f, c - f, p), p = u, f = c);
719
719
  }), s.groups.length > 0) {
720
720
  const u = s.groups[s.groups.length - 1], c = u.start + u.count;
721
- c !== a.materialIndex.length && s.addGroup(c, a.materialIndex.length - c, p);
721
+ c !== o.materialIndex.length && s.addGroup(c, o.materialIndex.length - c, p);
722
722
  }
723
- s.groups.length === 0 && s.addGroup(0, a.materialIndex.length, a.materialIndex[0]);
723
+ s.groups.length === 0 && s.addGroup(0, o.materialIndex.length, o.materialIndex[0]);
724
724
  }
725
725
  return this.addMorphTargets(s, e, n, r), s;
726
726
  }
@@ -733,10 +733,10 @@ class xt {
733
733
  e.LayerElementUV[r].UV && n.uv.push(this.parseUVs(e.LayerElementUV[r])), r++;
734
734
  }
735
735
  return n.weightTable = {}, t !== null && (n.skeleton = t, t.rawBones.forEach(function(r, s) {
736
- r.indices.forEach(function(o, a) {
737
- n.weightTable[o] === void 0 && (n.weightTable[o] = []), n.weightTable[o].push({
736
+ r.indices.forEach(function(a, o) {
737
+ n.weightTable[a] === void 0 && (n.weightTable[a] = []), n.weightTable[a].push({
738
738
  id: s,
739
- weight: r.weights[a]
739
+ weight: r.weights[o]
740
740
  });
741
741
  });
742
742
  })), n;
@@ -751,13 +751,13 @@ class xt {
751
751
  vertexWeights: [],
752
752
  weightsIndices: []
753
753
  };
754
- let n = 0, r = 0, s = !1, o = [], a = [], l = [], p = [], f = [], u = [];
754
+ let n = 0, r = 0, s = !1, a = [], o = [], l = [], p = [], f = [], u = [];
755
755
  const c = this;
756
756
  return e.vertexIndices.forEach(function(h, m) {
757
757
  let g, d = !1;
758
758
  h < 0 && (h = h ^ -1, d = !0);
759
759
  let T = [], F = [];
760
- if (o.push(h * 3, h * 3 + 1, h * 3 + 2), e.color) {
760
+ if (a.push(h * 3, h * 3 + 1, h * 3 + 2), e.color) {
761
761
  const y = Q(m, n, h, e.color);
762
762
  l.push(y[0], y[1], y[2]);
763
763
  }
@@ -785,12 +785,12 @@ class xt {
785
785
  }
786
786
  if (e.normal) {
787
787
  const y = Q(m, n, h, e.normal);
788
- a.push(y[0], y[1], y[2]);
788
+ o.push(y[0], y[1], y[2]);
789
789
  }
790
790
  e.material && e.material.mappingType !== "AllSame" && (g = Q(m, n, h, e.material)[0], g < 0 && (c.negativeMaterialIndices = !0, g = 0)), e.uv && e.uv.forEach(function(y, x) {
791
791
  const I = Q(m, n, h, y);
792
792
  p[x] === void 0 && (p[x] = []), p[x].push(I[0]), p[x].push(I[1]);
793
- }), r++, d && (c.genFace(t, e, o, g, a, l, p, f, u, r), n++, r = 0, o = [], a = [], l = [], p = [], f = [], u = []);
793
+ }), r++, d && (c.genFace(t, e, a, g, o, l, p, f, u, r), n++, r = 0, a = [], o = [], l = [], p = [], f = [], u = []);
794
794
  }), t;
795
795
  }
796
796
  // See https://www.khronos.org/opengl/wiki/Calculating_a_Surface_Normal
@@ -817,7 +817,7 @@ class xt {
817
817
  );
818
818
  }
819
819
  // Generate data for a single face in a geometry. If the face is a quad then split it into 2 tris
820
- genFace(e, t, n, r, s, o, a, l, p, f) {
820
+ genFace(e, t, n, r, s, a, o, l, p, f) {
821
821
  let u;
822
822
  if (f > 3) {
823
823
  const c = [], h = t.baseVertexPositions || t.vertexPositions;
@@ -836,18 +836,18 @@ class xt {
836
836
  } else
837
837
  u = [[0, 1, 2]];
838
838
  for (const [c, h, m] of u)
839
- e.vertex.push(t.vertexPositions[n[c * 3]]), e.vertex.push(t.vertexPositions[n[c * 3 + 1]]), e.vertex.push(t.vertexPositions[n[c * 3 + 2]]), e.vertex.push(t.vertexPositions[n[h * 3]]), e.vertex.push(t.vertexPositions[n[h * 3 + 1]]), e.vertex.push(t.vertexPositions[n[h * 3 + 2]]), e.vertex.push(t.vertexPositions[n[m * 3]]), e.vertex.push(t.vertexPositions[n[m * 3 + 1]]), e.vertex.push(t.vertexPositions[n[m * 3 + 2]]), t.skeleton && (e.vertexWeights.push(l[c * 4]), e.vertexWeights.push(l[c * 4 + 1]), e.vertexWeights.push(l[c * 4 + 2]), e.vertexWeights.push(l[c * 4 + 3]), e.vertexWeights.push(l[h * 4]), e.vertexWeights.push(l[h * 4 + 1]), e.vertexWeights.push(l[h * 4 + 2]), e.vertexWeights.push(l[h * 4 + 3]), e.vertexWeights.push(l[m * 4]), e.vertexWeights.push(l[m * 4 + 1]), e.vertexWeights.push(l[m * 4 + 2]), e.vertexWeights.push(l[m * 4 + 3]), e.weightsIndices.push(p[c * 4]), e.weightsIndices.push(p[c * 4 + 1]), e.weightsIndices.push(p[c * 4 + 2]), e.weightsIndices.push(p[c * 4 + 3]), e.weightsIndices.push(p[h * 4]), e.weightsIndices.push(p[h * 4 + 1]), e.weightsIndices.push(p[h * 4 + 2]), e.weightsIndices.push(p[h * 4 + 3]), e.weightsIndices.push(p[m * 4]), e.weightsIndices.push(p[m * 4 + 1]), e.weightsIndices.push(p[m * 4 + 2]), e.weightsIndices.push(p[m * 4 + 3])), t.color && (e.colors.push(o[c * 3]), e.colors.push(o[c * 3 + 1]), e.colors.push(o[c * 3 + 2]), e.colors.push(o[h * 3]), e.colors.push(o[h * 3 + 1]), e.colors.push(o[h * 3 + 2]), e.colors.push(o[m * 3]), e.colors.push(o[m * 3 + 1]), e.colors.push(o[m * 3 + 2])), t.material && t.material.mappingType !== "AllSame" && (e.materialIndex.push(r), e.materialIndex.push(r), e.materialIndex.push(r)), t.normal && (e.normal.push(s[c * 3]), e.normal.push(s[c * 3 + 1]), e.normal.push(s[c * 3 + 2]), e.normal.push(s[h * 3]), e.normal.push(s[h * 3 + 1]), e.normal.push(s[h * 3 + 2]), e.normal.push(s[m * 3]), e.normal.push(s[m * 3 + 1]), e.normal.push(s[m * 3 + 2])), t.uv && t.uv.forEach(function(g, d) {
840
- e.uvs[d] === void 0 && (e.uvs[d] = []), e.uvs[d].push(a[d][c * 2]), e.uvs[d].push(a[d][c * 2 + 1]), e.uvs[d].push(a[d][h * 2]), e.uvs[d].push(a[d][h * 2 + 1]), e.uvs[d].push(a[d][m * 2]), e.uvs[d].push(a[d][m * 2 + 1]);
839
+ e.vertex.push(t.vertexPositions[n[c * 3]]), e.vertex.push(t.vertexPositions[n[c * 3 + 1]]), e.vertex.push(t.vertexPositions[n[c * 3 + 2]]), e.vertex.push(t.vertexPositions[n[h * 3]]), e.vertex.push(t.vertexPositions[n[h * 3 + 1]]), e.vertex.push(t.vertexPositions[n[h * 3 + 2]]), e.vertex.push(t.vertexPositions[n[m * 3]]), e.vertex.push(t.vertexPositions[n[m * 3 + 1]]), e.vertex.push(t.vertexPositions[n[m * 3 + 2]]), t.skeleton && (e.vertexWeights.push(l[c * 4]), e.vertexWeights.push(l[c * 4 + 1]), e.vertexWeights.push(l[c * 4 + 2]), e.vertexWeights.push(l[c * 4 + 3]), e.vertexWeights.push(l[h * 4]), e.vertexWeights.push(l[h * 4 + 1]), e.vertexWeights.push(l[h * 4 + 2]), e.vertexWeights.push(l[h * 4 + 3]), e.vertexWeights.push(l[m * 4]), e.vertexWeights.push(l[m * 4 + 1]), e.vertexWeights.push(l[m * 4 + 2]), e.vertexWeights.push(l[m * 4 + 3]), e.weightsIndices.push(p[c * 4]), e.weightsIndices.push(p[c * 4 + 1]), e.weightsIndices.push(p[c * 4 + 2]), e.weightsIndices.push(p[c * 4 + 3]), e.weightsIndices.push(p[h * 4]), e.weightsIndices.push(p[h * 4 + 1]), e.weightsIndices.push(p[h * 4 + 2]), e.weightsIndices.push(p[h * 4 + 3]), e.weightsIndices.push(p[m * 4]), e.weightsIndices.push(p[m * 4 + 1]), e.weightsIndices.push(p[m * 4 + 2]), e.weightsIndices.push(p[m * 4 + 3])), t.color && (e.colors.push(a[c * 3]), e.colors.push(a[c * 3 + 1]), e.colors.push(a[c * 3 + 2]), e.colors.push(a[h * 3]), e.colors.push(a[h * 3 + 1]), e.colors.push(a[h * 3 + 2]), e.colors.push(a[m * 3]), e.colors.push(a[m * 3 + 1]), e.colors.push(a[m * 3 + 2])), t.material && t.material.mappingType !== "AllSame" && (e.materialIndex.push(r), e.materialIndex.push(r), e.materialIndex.push(r)), t.normal && (e.normal.push(s[c * 3]), e.normal.push(s[c * 3 + 1]), e.normal.push(s[c * 3 + 2]), e.normal.push(s[h * 3]), e.normal.push(s[h * 3 + 1]), e.normal.push(s[h * 3 + 2]), e.normal.push(s[m * 3]), e.normal.push(s[m * 3 + 1]), e.normal.push(s[m * 3 + 2])), t.uv && t.uv.forEach(function(g, d) {
840
+ e.uvs[d] === void 0 && (e.uvs[d] = []), e.uvs[d].push(o[d][c * 2]), e.uvs[d].push(o[d][c * 2 + 1]), e.uvs[d].push(o[d][h * 2]), e.uvs[d].push(o[d][h * 2 + 1]), e.uvs[d].push(o[d][m * 2]), e.uvs[d].push(o[d][m * 2 + 1]);
841
841
  });
842
842
  }
843
843
  addMorphTargets(e, t, n, r) {
844
844
  if (n.length === 0) return;
845
845
  e.morphTargetsRelative = !0, e.morphAttributes.position = [];
846
846
  const s = this;
847
- n.forEach(function(o) {
848
- o.rawTargets.forEach(function(a) {
849
- const l = L.Objects.Geometry[a.geoID];
850
- l !== void 0 && s.genMorphGeometry(e, t, l, r, a.name);
847
+ n.forEach(function(a) {
848
+ a.rawTargets.forEach(function(o) {
849
+ const l = C.Objects.Geometry[o.geoID];
850
+ l !== void 0 && s.genMorphGeometry(e, t, l, r, o.name);
851
851
  });
852
852
  });
853
853
  }
@@ -856,15 +856,15 @@ class xt {
856
856
  // and a special attribute Index defining which vertices of the original geometry are affected
857
857
  // Normal and position attributes only have data for the vertices that are affected by the morph
858
858
  genMorphGeometry(e, t, n, r, s) {
859
- const o = t.Vertices !== void 0 ? t.Vertices.a : [], a = t.PolygonVertexIndex !== void 0 ? t.PolygonVertexIndex.a : [], l = n.Vertices !== void 0 ? n.Vertices.a : [], p = n.Indexes !== void 0 ? n.Indexes.a : [], f = e.attributes.position.count * 3, u = new Float32Array(f);
859
+ const a = t.Vertices !== void 0 ? t.Vertices.a : [], o = t.PolygonVertexIndex !== void 0 ? t.PolygonVertexIndex.a : [], l = n.Vertices !== void 0 ? n.Vertices.a : [], p = n.Indexes !== void 0 ? n.Indexes.a : [], f = e.attributes.position.count * 3, u = new Float32Array(f);
860
860
  for (let g = 0; g < p.length; g++) {
861
861
  const d = p[g] * 3;
862
862
  u[d] = l[g * 3], u[d + 1] = l[g * 3 + 1], u[d + 2] = l[g * 3 + 2];
863
863
  }
864
864
  const c = {
865
- vertexIndices: a,
865
+ vertexIndices: o,
866
866
  vertexPositions: u,
867
- baseVertexPositions: o
867
+ baseVertexPositions: a
868
868
  }, h = this.genBuffers(c), m = new j(h.vertex, 3);
869
869
  m.name = s || n.attrName, m.applyMatrix4(r), e.morphAttributes.position.push(m);
870
870
  }
@@ -897,8 +897,8 @@ class xt {
897
897
  const t = e.MappingInformationType, n = e.ReferenceInformationType, r = e.Colors.a;
898
898
  let s = [];
899
899
  n === "IndexToDirect" && (s = e.ColorIndex.a);
900
- for (let o = 0, a = new k(); o < r.length; o += 4)
901
- a.fromArray(r, o), N.colorSpaceToWorking(a, X), a.toArray(r, o);
900
+ for (let a = 0, o = new k(); a < r.length; a += 4)
901
+ o.fromArray(r, a), N.colorSpaceToWorking(o, X), o.toArray(r, a);
902
902
  return {
903
903
  dataSize: 4,
904
904
  buffer: r,
@@ -919,8 +919,8 @@ class xt {
919
919
  referenceType: n
920
920
  };
921
921
  const r = e.Materials.a, s = [];
922
- for (let o = 0; o < r.length; ++o)
923
- s.push(o);
922
+ for (let a = 0; a < r.length; ++a)
923
+ s.push(a);
924
924
  return {
925
925
  dataSize: 1,
926
926
  buffer: r,
@@ -934,18 +934,18 @@ class xt {
934
934
  const t = parseInt(e.Order);
935
935
  if (isNaN(t))
936
936
  return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s", e.Order, e.id), new re();
937
- const n = t - 1, r = e.KnotVector.a, s = [], o = e.Points.a;
938
- for (let u = 0, c = o.length; u < c; u += 4)
939
- s.push(new et().fromArray(o, u));
940
- let a, l;
937
+ const n = t - 1, r = e.KnotVector.a, s = [], a = e.Points.a;
938
+ for (let u = 0, c = a.length; u < c; u += 4)
939
+ s.push(new et().fromArray(a, u));
940
+ let o, l;
941
941
  if (e.Form === "Closed")
942
942
  s.push(s[0]);
943
943
  else if (e.Form === "Periodic") {
944
- a = n, l = r.length - 1 - a;
944
+ o = n, l = r.length - 1 - o;
945
945
  for (let u = 0; u < n; ++u)
946
946
  s.push(s[u]);
947
947
  }
948
- const f = new dt(n, r, s, a, l).getPoints(s.length * 12);
948
+ const f = new dt(n, r, s, o, l).getPoints(s.length * 12);
949
949
  return new re().setFromPoints(f);
950
950
  }
951
951
  }
@@ -961,7 +961,7 @@ class Et {
961
961
  return e;
962
962
  }
963
963
  parseClips() {
964
- if (L.Objects.AnimationCurve === void 0) return;
964
+ if (C.Objects.AnimationCurve === void 0) return;
965
965
  const e = this.parseAnimationCurveNodes();
966
966
  this.parseAnimationCurves(e);
967
967
  const t = this.parseAnimationLayers(e);
@@ -971,7 +971,7 @@ class Et {
971
971
  // each AnimationCurveNode holds data for an animation transform for a model (e.g. left arm rotation )
972
972
  // and is referenced by an AnimationLayer
973
973
  parseAnimationCurveNodes() {
974
- const e = L.Objects.AnimationCurveNode, t = /* @__PURE__ */ new Map();
974
+ const e = C.Objects.AnimationCurveNode, t = /* @__PURE__ */ new Map();
975
975
  for (const n in e) {
976
976
  const r = e[n];
977
977
  if (r.attrName.match(/S|R|T|DeformPercent/) !== null) {
@@ -989,7 +989,7 @@ class Et {
989
989
  // previously parsed AnimationCurveNodes. Each AnimationCurve holds data for a single animated
990
990
  // axis ( e.g. times and values of x rotation)
991
991
  parseAnimationCurves(e) {
992
- const t = L.Objects.AnimationCurve;
992
+ const t = C.Objects.AnimationCurve;
993
993
  for (const n in t) {
994
994
  const r = {
995
995
  id: t[n].id,
@@ -997,8 +997,8 @@ class Et {
997
997
  values: t[n].KeyValueFloat.a
998
998
  }, s = O.get(r.id);
999
999
  if (s !== void 0) {
1000
- const o = s.parents[0].ID, a = s.parents[0].relationship;
1001
- a.match(/X/) ? e.get(o).curves.x = r : a.match(/Y/) ? e.get(o).curves.y = r : a.match(/Z/) ? e.get(o).curves.z = r : a.match(/DeformPercent/) && e.has(o) && (e.get(o).curves.morph = r);
1000
+ const a = s.parents[0].ID, o = s.parents[0].relationship;
1001
+ o.match(/X/) ? e.get(a).curves.x = r : o.match(/Y/) ? e.get(a).curves.y = r : o.match(/Z/) ? e.get(a).curves.z = r : o.match(/DeformPercent/) && e.has(a) && (e.get(a).curves.morph = r);
1002
1002
  }
1003
1003
  }
1004
1004
  }
@@ -1006,10 +1006,10 @@ class Et {
1006
1006
  // to various AnimationCurveNodes and is referenced by an AnimationStack node
1007
1007
  // note: theoretically a stack can have multiple layers, however in practice there always seems to be one per stack
1008
1008
  parseAnimationLayers(e) {
1009
- const t = L.Objects.AnimationLayer, n = /* @__PURE__ */ new Map();
1009
+ const t = C.Objects.AnimationLayer, n = /* @__PURE__ */ new Map();
1010
1010
  for (const r in t) {
1011
- const s = [], o = O.get(parseInt(r));
1012
- o !== void 0 && (o.children.forEach(function(l, p) {
1011
+ const s = [], a = O.get(parseInt(r));
1012
+ a !== void 0 && (a.children.forEach(function(l, p) {
1013
1013
  if (e.has(l.ID)) {
1014
1014
  const f = e.get(l.ID);
1015
1015
  if (f.curves.x !== void 0 || f.curves.y !== void 0 || f.curves.z !== void 0) {
@@ -1018,7 +1018,7 @@ class Et {
1018
1018
  return c.relationship !== void 0;
1019
1019
  })[0].ID;
1020
1020
  if (u !== void 0) {
1021
- const c = L.Objects.Model[u.toString()];
1021
+ const c = C.Objects.Model[u.toString()];
1022
1022
  if (c === void 0) {
1023
1023
  console.warn("THREE.FBXLoader: Encountered a unused curve.", l);
1024
1024
  return;
@@ -1032,7 +1032,7 @@ class Et {
1032
1032
  };
1033
1033
  U.traverse(function(m) {
1034
1034
  m.ID === c.id && (h.transform = m.matrix, m.userData.transformData && (h.eulerOrder = m.userData.transformData.eulerOrder));
1035
- }), h.transform || (h.transform = new C()), "PreRotation" in c && (h.preRotation = c.PreRotation.value), "PostRotation" in c && (h.postRotation = c.PostRotation.value), s[p] = h;
1035
+ }), h.transform || (h.transform = new L()), "PreRotation" in c && (h.preRotation = c.PreRotation.value), "PostRotation" in c && (h.postRotation = c.PostRotation.value), s[p] = h;
1036
1036
  }
1037
1037
  }
1038
1038
  s[p] && (s[p][f.attr] = f);
@@ -1040,9 +1040,9 @@ class Et {
1040
1040
  if (s[p] === void 0) {
1041
1041
  const u = O.get(l.ID).parents.filter(function(T) {
1042
1042
  return T.relationship !== void 0;
1043
- })[0].ID, c = O.get(u).parents[0].ID, h = O.get(c).parents[0].ID, m = O.get(h).parents[0].ID, g = L.Objects.Model[m], d = {
1043
+ })[0].ID, c = O.get(u).parents[0].ID, h = O.get(c).parents[0].ID, m = O.get(h).parents[0].ID, g = C.Objects.Model[m], d = {
1044
1044
  modelName: g.attrName ? ee.sanitizeNodeName(g.attrName) : "",
1045
- morphName: L.Objects.Deformer[u].attrName
1045
+ morphName: C.Objects.Deformer[u].attrName
1046
1046
  };
1047
1047
  s[p] = d;
1048
1048
  }
@@ -1056,14 +1056,14 @@ class Et {
1056
1056
  // parse nodes in FBXTree.Objects.AnimationStack. These are the top level node in the animation
1057
1057
  // hierarchy. Each Stack node will be used to create an AnimationClip
1058
1058
  parseAnimStacks(e) {
1059
- const t = L.Objects.AnimationStack, n = {};
1059
+ const t = C.Objects.AnimationStack, n = {};
1060
1060
  for (const r in t) {
1061
1061
  const s = O.get(parseInt(r)).children;
1062
1062
  s.length > 1 && console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");
1063
- const o = e.get(s[0].ID);
1063
+ const a = e.get(s[0].ID);
1064
1064
  n[r] = {
1065
1065
  name: t[r].attrName,
1066
- layer: o
1066
+ layer: a
1067
1067
  };
1068
1068
  }
1069
1069
  return n;
@@ -1097,25 +1097,25 @@ class Et {
1097
1097
  return t;
1098
1098
  }
1099
1099
  generateVectorTrack(e, t, n, r) {
1100
- const s = this.getTimesForAllAxes(t), o = this.getKeyframeTrackValues(s, t, n);
1101
- return new nt(e + "." + r, s, o);
1100
+ const s = this.getTimesForAllAxes(t), a = this.getKeyframeTrackValues(s, t, n);
1101
+ return new nt(e + "." + r, s, a);
1102
1102
  }
1103
1103
  generateRotationTrack(e, t, n, r, s) {
1104
- let o, a;
1104
+ let a, o;
1105
1105
  if (t.x !== void 0 && t.y !== void 0 && t.z !== void 0) {
1106
1106
  const c = this.interpolateRotations(t.x, t.y, t.z, s);
1107
- o = c[0], a = c[1];
1107
+ a = c[0], o = c[1];
1108
1108
  }
1109
1109
  const l = q(0);
1110
1110
  n !== void 0 && (n = n.map(B.degToRad), n.push(l), n = new z().fromArray(n), n = new G().setFromEuler(n)), r !== void 0 && (r = r.map(B.degToRad), r.push(l), r = new z().fromArray(r), r = new G().setFromEuler(r).invert());
1111
1111
  const p = new G(), f = new z(), u = [];
1112
- if (!a || !o) return new de(e + ".quaternion", [0], [0]);
1113
- for (let c = 0; c < a.length; c += 3)
1114
- f.set(a[c], a[c + 1], a[c + 2], s), p.setFromEuler(f), n !== void 0 && p.premultiply(n), r !== void 0 && p.multiply(r), c > 2 && new G().fromArray(
1112
+ if (!o || !a) return new de(e + ".quaternion", [0], [0]);
1113
+ for (let c = 0; c < o.length; c += 3)
1114
+ f.set(o[c], o[c + 1], o[c + 2], s), p.setFromEuler(f), n !== void 0 && p.premultiply(n), r !== void 0 && p.multiply(r), c > 2 && new G().fromArray(
1115
1115
  u,
1116
1116
  (c - 3) / 3 * 4
1117
1117
  ).dot(p) < 0 && p.set(-p.x, -p.y, -p.z, -p.w), p.toArray(u, c / 3 * 4);
1118
- return new de(e + ".quaternion", o, u);
1118
+ return new de(e + ".quaternion", a, u);
1119
1119
  }
1120
1120
  generateMorphTrack(e) {
1121
1121
  const t = e.DeformPercent.curves.morph, n = t.values.map(function(s) {
@@ -1132,8 +1132,8 @@ class Et {
1132
1132
  }), t.length > 1) {
1133
1133
  let n = 1, r = t[0];
1134
1134
  for (let s = 1; s < t.length; s++) {
1135
- const o = t[s];
1136
- o !== r && (t[n] = o, r = o, n++);
1135
+ const a = t[s];
1136
+ a !== r && (t[n] = a, r = a, n++);
1137
1137
  }
1138
1138
  t = t.slice(0, n);
1139
1139
  }
@@ -1141,15 +1141,15 @@ class Et {
1141
1141
  }
1142
1142
  getKeyframeTrackValues(e, t, n) {
1143
1143
  const r = n, s = [];
1144
- let o = -1, a = -1, l = -1;
1144
+ let a = -1, o = -1, l = -1;
1145
1145
  return e.forEach(function(p) {
1146
- if (t.x && (o = t.x.times.indexOf(p)), t.y && (a = t.y.times.indexOf(p)), t.z && (l = t.z.times.indexOf(p)), o !== -1) {
1147
- const f = t.x.values[o];
1146
+ if (t.x && (a = t.x.times.indexOf(p)), t.y && (o = t.y.times.indexOf(p)), t.z && (l = t.z.times.indexOf(p)), a !== -1) {
1147
+ const f = t.x.values[a];
1148
1148
  s.push(f), r[0] = f;
1149
1149
  } else
1150
1150
  s.push(r[0]);
1151
- if (a !== -1) {
1152
- const f = t.y.values[a];
1151
+ if (o !== -1) {
1152
+ const f = t.y.values[o];
1153
1153
  s.push(f), r[1] = f;
1154
1154
  } else
1155
1155
  s.push(r[1]);
@@ -1164,20 +1164,20 @@ class Et {
1164
1164
  // These will be converted to quaternions which don't support values greater than
1165
1165
  // PI, so we'll interpolate large rotations
1166
1166
  interpolateRotations(e, t, n, r) {
1167
- const s = [], o = [];
1168
- s.push(e.times[0]), o.push(B.degToRad(e.values[0])), o.push(B.degToRad(t.values[0])), o.push(B.degToRad(n.values[0]));
1169
- for (let a = 1; a < e.values.length; a++) {
1167
+ const s = [], a = [];
1168
+ s.push(e.times[0]), a.push(B.degToRad(e.values[0])), a.push(B.degToRad(t.values[0])), a.push(B.degToRad(n.values[0]));
1169
+ for (let o = 1; o < e.values.length; o++) {
1170
1170
  const l = [
1171
- e.values[a - 1],
1172
- t.values[a - 1],
1173
- n.values[a - 1]
1171
+ e.values[o - 1],
1172
+ t.values[o - 1],
1173
+ n.values[o - 1]
1174
1174
  ];
1175
1175
  if (isNaN(l[0]) || isNaN(l[1]) || isNaN(l[2]))
1176
1176
  continue;
1177
1177
  const p = l.map(B.degToRad), f = [
1178
- e.values[a],
1179
- t.values[a],
1180
- n.values[a]
1178
+ e.values[o],
1179
+ t.values[o],
1180
+ n.values[o]
1181
1181
  ];
1182
1182
  if (isNaN(f[0]) || isNaN(f[1]) || isNaN(f[2]))
1183
1183
  continue;
@@ -1193,13 +1193,13 @@ class Et {
1193
1193
  if (h[0] >= 180 || h[1] >= 180 || h[2] >= 180) {
1194
1194
  const g = Math.max(...h) / 180, d = new z(...p, r), T = new z(...u, r), F = new G().setFromEuler(d), y = new G().setFromEuler(T);
1195
1195
  F.dot(y) && y.set(-y.x, -y.y, -y.z, -y.w);
1196
- const x = e.times[a - 1], I = e.times[a] - x, A = new G(), M = new z();
1196
+ const x = e.times[o - 1], I = e.times[o] - x, A = new G(), M = new z();
1197
1197
  for (let v = 0; v < 1; v += 1 / g)
1198
- A.copy(F.clone().slerp(y.clone(), v)), s.push(x + v * I), M.setFromQuaternion(A, r), o.push(M.x), o.push(M.y), o.push(M.z);
1198
+ A.copy(F.clone().slerp(y.clone(), v)), s.push(x + v * I), M.setFromQuaternion(A, r), a.push(M.x), a.push(M.y), a.push(M.z);
1199
1199
  } else
1200
- s.push(e.times[a]), o.push(B.degToRad(e.values[a])), o.push(B.degToRad(t.values[a])), o.push(B.degToRad(n.values[a]));
1200
+ s.push(e.times[o]), a.push(B.degToRad(e.values[o])), a.push(B.degToRad(t.values[o])), a.push(B.degToRad(n.values[o]));
1201
1201
  }
1202
- return [s, o];
1202
+ return [s, a];
1203
1203
  }
1204
1204
  }
1205
1205
  class bt {
@@ -1225,8 +1225,8 @@ class bt {
1225
1225
  this.currentIndent = 0, this.allNodes = new Pe(), this.nodeStack = [], this.currentProp = [], this.currentPropName = "";
1226
1226
  const t = this, n = e.split(/[\r\n]+/);
1227
1227
  return n.forEach(function(r, s) {
1228
- const o = r.match(/^[\s\t]*;/), a = r.match(/^[\s\t]*$/);
1229
- if (o || a) return;
1228
+ const a = r.match(/^[\s\t]*;/), o = r.match(/^[\s\t]*$/);
1229
+ if (a || o) return;
1230
1230
  const l = r.match("^\\t{" + t.currentIndent + "}(\\w+):(.*){", ""), p = r.match("^\\t{" + t.currentIndent + "}(\\w+):[\\s\\t\\r\\n](.*)"), f = r.match("^\\t{" + (t.currentIndent - 1) + "}}");
1231
1231
  l ? t.parseNodeBegin(r, l) : p ? t.parseNodeProperty(r, p, n[++s]) : f ? t.popStack() : r.match(/^[^\s\t}]/) && t.parseNodePropertyContinued(r);
1232
1232
  }), this.allNodes;
@@ -1234,8 +1234,8 @@ class bt {
1234
1234
  parseNodeBegin(e, t) {
1235
1235
  const n = t[1].trim().replace(/^"/, "").replace(/"$/, ""), r = t[2].split(",").map(function(l) {
1236
1236
  return l.trim().replace(/^"/, "").replace(/"$/, "");
1237
- }), s = { name: n }, o = this.parseNodeAttr(r), a = this.getCurrentNode();
1238
- this.currentIndent === 0 ? this.allNodes.add(n, s) : n in a ? (n === "PoseNode" ? a.PoseNode.push(s) : a[n].id !== void 0 && (a[n] = {}, a[n][a[n].id] = a[n]), o.id !== "" && (a[n][o.id] = s)) : typeof o.id == "number" ? (a[n] = {}, a[n][o.id] = s) : n !== "Properties70" && (n === "PoseNode" ? a[n] = [s] : a[n] = s), typeof o.id == "number" && (s.id = o.id), o.name !== "" && (s.attrName = o.name), o.type !== "" && (s.attrType = o.type), this.pushStack(s);
1237
+ }), s = { name: n }, a = this.parseNodeAttr(r), o = this.getCurrentNode();
1238
+ this.currentIndent === 0 ? this.allNodes.add(n, s) : n in o ? (n === "PoseNode" ? o.PoseNode.push(s) : o[n].id !== void 0 && (o[n] = {}, o[n][o[n].id] = o[n]), a.id !== "" && (o[n][a.id] = s)) : typeof a.id == "number" ? (o[n] = {}, o[n][a.id] = s) : n !== "Properties70" && (n === "PoseNode" ? o[n] = [s] : o[n] = s), typeof a.id == "number" && (s.id = a.id), a.name !== "" && (s.attrName = a.name), a.type !== "" && (s.attrType = a.type), this.pushStack(s);
1239
1239
  }
1240
1240
  parseNodeAttr(e) {
1241
1241
  let t = e[0];
@@ -1246,8 +1246,8 @@ class bt {
1246
1246
  parseNodeProperty(e, t, n) {
1247
1247
  let r = t[1].replace(/^"/, "").replace(/"$/, "").trim(), s = t[2].replace(/^"/, "").replace(/"$/, "").trim();
1248
1248
  r === "Content" && s === "," && (s = n.replace(/"/g, "").replace(/,$/, "").trim());
1249
- const o = this.getCurrentNode();
1250
- if (o.name === "Properties70") {
1249
+ const a = this.getCurrentNode();
1250
+ if (a.name === "Properties70") {
1251
1251
  this.parseNodeSpecialProperty(e, r, s);
1252
1252
  return;
1253
1253
  }
@@ -1256,21 +1256,21 @@ class bt {
1256
1256
  let u = s.split(",").slice(3);
1257
1257
  u = u.map(function(c) {
1258
1258
  return c.trim().replace(/^"/, "");
1259
- }), r = "connections", s = [p, f], Dt(s, u), o[r] === void 0 && (o[r] = []);
1259
+ }), r = "connections", s = [p, f], Dt(s, u), a[r] === void 0 && (a[r] = []);
1260
1260
  }
1261
- r === "Node" && (o.id = s), r in o && Array.isArray(o[r]) ? o[r].push(s) : r !== "a" ? o[r] = s : o.a = s, this.setCurrentProp(o, r), r === "a" && s.slice(-1) !== "," && (o.a = oe(s));
1261
+ r === "Node" && (a.id = s), r in a && Array.isArray(a[r]) ? a[r].push(s) : r !== "a" ? a[r] = s : a.a = s, this.setCurrentProp(a, r), r === "a" && s.slice(-1) !== "," && (a.a = ae(s));
1262
1262
  }
1263
1263
  parseNodePropertyContinued(e) {
1264
1264
  const t = this.getCurrentNode();
1265
- t.a += e, e.slice(-1) !== "," && (t.a = oe(t.a));
1265
+ t.a += e, e.slice(-1) !== "," && (t.a = ae(t.a));
1266
1266
  }
1267
1267
  // parse "Property70"
1268
1268
  parseNodeSpecialProperty(e, t, n) {
1269
1269
  const r = n.split('",').map(function(f) {
1270
1270
  return f.trim().replace(/^\"/, "").replace(/\s/, "_");
1271
- }), s = r[0], o = r[1], a = r[2], l = r[3];
1271
+ }), s = r[0], a = r[1], o = r[2], l = r[3];
1272
1272
  let p = r[4];
1273
- switch (o) {
1273
+ switch (a) {
1274
1274
  case "int":
1275
1275
  case "enum":
1276
1276
  case "bool":
@@ -1286,12 +1286,12 @@ class bt {
1286
1286
  case "Lcl_Translation":
1287
1287
  case "Lcl_Rotation":
1288
1288
  case "Lcl_Scaling":
1289
- p = oe(p);
1289
+ p = ae(p);
1290
1290
  break;
1291
1291
  }
1292
1292
  this.getPrevNode()[s] = {
1293
- type: o,
1294
- type2: a,
1293
+ type: a,
1294
+ type2: o,
1295
1295
  flag: l,
1296
1296
  value: p
1297
1297
  }, this.setCurrentProp(this.getPrevNode(), s);
@@ -1319,7 +1319,7 @@ class Mt {
1319
1319
  parseNode(e, t) {
1320
1320
  const n = {}, r = t >= 7500 ? e.getUint64() : e.getUint32(), s = t >= 7500 ? e.getUint64() : e.getUint32();
1321
1321
  t >= 7500 ? e.getUint64() : e.getUint32();
1322
- const o = e.getUint8(), a = e.getString(o);
1322
+ const a = e.getUint8(), o = e.getString(a);
1323
1323
  if (r === 0) return null;
1324
1324
  const l = [];
1325
1325
  for (let c = 0; c < s; c++)
@@ -1327,9 +1327,9 @@ class Mt {
1327
1327
  const p = l.length > 0 ? l[0] : "", f = l.length > 1 ? l[1] : "", u = l.length > 2 ? l[2] : "";
1328
1328
  for (n.singleProperty = s === 1 && e.getOffset() === r; r > e.getOffset(); ) {
1329
1329
  const c = this.parseNode(e, t);
1330
- c !== null && this.parseSubNode(a, n, c);
1330
+ c !== null && this.parseSubNode(o, n, c);
1331
1331
  }
1332
- return n.propertyList = l, typeof p == "number" && (n.id = p), f !== "" && (n.attrName = f), u !== "" && (n.attrType = u), a !== "" && (n.name = a), n;
1332
+ return n.propertyList = l, typeof p == "number" && (n.id = p), f !== "" && (n.attrName = f), u !== "" && (n.attrType = u), o !== "" && (n.name = o), n;
1333
1333
  }
1334
1334
  parseSubNode(e, t, n) {
1335
1335
  if (n.singleProperty === !0) {
@@ -1337,8 +1337,8 @@ class Mt {
1337
1337
  Array.isArray(r) ? (t[n.name] = n, n.a = r) : t[n.name] = r;
1338
1338
  } else if (e === "Connections" && n.name === "C") {
1339
1339
  const r = [];
1340
- n.propertyList.forEach(function(s, o) {
1341
- o !== 0 && r.push(s);
1340
+ n.propertyList.forEach(function(s, a) {
1341
+ a !== 0 && r.push(s);
1342
1342
  }), t.connections === void 0 && (t.connections = []), t.connections.push(r);
1343
1343
  } else if (n.name === "Properties70")
1344
1344
  Object.keys(n).forEach(function(s) {
@@ -1346,7 +1346,7 @@ class Mt {
1346
1346
  });
1347
1347
  else if (e === "Properties70" && n.name === "P") {
1348
1348
  let r = n.propertyList[0], s = n.propertyList[1];
1349
- const o = n.propertyList[2], a = n.propertyList[3];
1349
+ const a = n.propertyList[2], o = n.propertyList[3];
1350
1350
  let l;
1351
1351
  r.indexOf("Lcl ") === 0 && (r = r.replace("Lcl ", "Lcl_")), s.indexOf("Lcl ") === 0 && (s = s.replace("Lcl ", "Lcl_")), s === "Color" || s === "ColorRGB" || s === "Vector" || s === "Vector3D" || s.indexOf("Lcl_") === 0 ? l = [
1352
1352
  n.propertyList[4],
@@ -1354,8 +1354,8 @@ class Mt {
1354
1354
  n.propertyList[6]
1355
1355
  ] : l = n.propertyList[4], t[r] = {
1356
1356
  type: s,
1357
- type2: o,
1358
- flag: a,
1357
+ type2: a,
1358
+ flag: o,
1359
1359
  value: l
1360
1360
  };
1361
1361
  } else t[n.name] === void 0 ? typeof n.id == "number" ? (t[n.name] = {}, t[n.name][n.id] = n) : t[n.name] = n : n.name === "PoseNode" ? (Array.isArray(t[n.name]) || (t[n.name] = [t[n.name]]), t[n.name].push(n)) : t[n.name][n.id] === void 0 && (t[n.name][n.id] = n);
@@ -1386,7 +1386,7 @@ class Mt {
1386
1386
  case "f":
1387
1387
  case "i":
1388
1388
  case "l":
1389
- const r = e.getUint32(), s = e.getUint32(), o = e.getUint32();
1389
+ const r = e.getUint32(), s = e.getUint32(), a = e.getUint32();
1390
1390
  if (s === 0)
1391
1391
  switch (t) {
1392
1392
  case "b":
@@ -1401,7 +1401,7 @@ class Mt {
1401
1401
  case "l":
1402
1402
  return e.getInt64Array(r);
1403
1403
  }
1404
- const a = ft.unzlibSync(new Uint8Array(e.getArrayBuffer(o))), l = new Te(a.buffer);
1404
+ const o = ft.unzlibSync(new Uint8Array(e.getArrayBuffer(a))), l = new Te(o.buffer);
1405
1405
  switch (t) {
1406
1406
  case "b":
1407
1407
  case "c":
@@ -1527,7 +1527,7 @@ class Pe {
1527
1527
  }
1528
1528
  function St(i) {
1529
1529
  const e = "Kaydara FBX Binary \0";
1530
- return i.byteLength >= e.length && e === Ce(i, 0, e.length);
1530
+ return i.byteLength >= e.length && e === Le(i, 0, e.length);
1531
1531
  }
1532
1532
  function Ft(i) {
1533
1533
  const e = ["K", "a", "y", "d", "a", "r", "a", "\\", "F", "B", "X", "\\", "B", "i", "n", "a", "r", "y", "\\", "\\"];
@@ -1570,12 +1570,12 @@ function Q(i, e, t, n) {
1570
1570
  console.warn("THREE.FBXLoader: unknown attribute mapping type " + n.mappingType);
1571
1571
  }
1572
1572
  n.referenceType === "IndexToDirect" && (r = n.indices[r]);
1573
- const s = r * n.dataSize, o = s + n.dataSize;
1574
- return Rt(At, n.buffer, s, o);
1573
+ const s = r * n.dataSize, a = s + n.dataSize;
1574
+ return Rt(At, n.buffer, s, a);
1575
1575
  }
1576
1576
  const se = new z(), H = new V();
1577
- function Le(i) {
1578
- const e = new C(), t = new C(), n = new C(), r = new C(), s = new C(), o = new C(), a = new C(), l = new C(), p = new C(), f = new C(), u = new C(), c = new C(), h = i.inheritType ? i.inheritType : 0;
1577
+ function Ce(i) {
1578
+ const e = new L(), t = new L(), n = new L(), r = new L(), s = new L(), a = new L(), o = new L(), l = new L(), p = new L(), f = new L(), u = new L(), c = new L(), h = i.inheritType ? i.inheritType : 0;
1579
1579
  i.translation && e.setPosition(H.fromArray(i.translation));
1580
1580
  const m = q(0);
1581
1581
  if (i.preRotation) {
@@ -1590,23 +1590,23 @@ function Le(i) {
1590
1590
  const b = i.postRotation.map(B.degToRad);
1591
1591
  b.push(m), r.makeRotationFromEuler(se.fromArray(b)), r.invert();
1592
1592
  }
1593
- i.scale && s.scale(H.fromArray(i.scale)), i.scalingOffset && a.setPosition(H.fromArray(i.scalingOffset)), i.scalingPivot && o.setPosition(H.fromArray(i.scalingPivot)), i.rotationOffset && l.setPosition(H.fromArray(i.rotationOffset)), i.rotationPivot && p.setPosition(H.fromArray(i.rotationPivot)), i.parentMatrixWorld && (u.copy(i.parentMatrix), f.copy(i.parentMatrixWorld));
1594
- const g = t.clone().multiply(n).multiply(r), d = new C();
1593
+ i.scale && s.scale(H.fromArray(i.scale)), i.scalingOffset && o.setPosition(H.fromArray(i.scalingOffset)), i.scalingPivot && a.setPosition(H.fromArray(i.scalingPivot)), i.rotationOffset && l.setPosition(H.fromArray(i.rotationOffset)), i.rotationPivot && p.setPosition(H.fromArray(i.rotationPivot)), i.parentMatrixWorld && (u.copy(i.parentMatrix), f.copy(i.parentMatrixWorld));
1594
+ const g = t.clone().multiply(n).multiply(r), d = new L();
1595
1595
  d.extractRotation(f);
1596
- const T = new C();
1596
+ const T = new L();
1597
1597
  T.copyPosition(f);
1598
- const F = T.clone().invert().multiply(f), y = d.clone().invert().multiply(F), x = s, I = new C();
1598
+ const F = T.clone().invert().multiply(f), y = d.clone().invert().multiply(F), x = s, I = new L();
1599
1599
  if (h === 0)
1600
1600
  I.copy(d).multiply(g).multiply(y).multiply(x);
1601
1601
  else if (h === 1)
1602
1602
  I.copy(d).multiply(y).multiply(g).multiply(x);
1603
1603
  else {
1604
- const D = new C().scale(new V().setFromMatrixScale(u)).clone().invert(), w = y.clone().multiply(D);
1604
+ const D = new L().scale(new V().setFromMatrixScale(u)).clone().invert(), w = y.clone().multiply(D);
1605
1605
  I.copy(d).multiply(g).multiply(w).multiply(x);
1606
1606
  }
1607
- const A = p.clone().invert(), M = o.clone().invert();
1608
- let v = e.clone().multiply(l).multiply(p).multiply(t).multiply(n).multiply(r).multiply(A).multiply(a).multiply(o).multiply(s).multiply(M);
1609
- const S = new C().copyPosition(v), E = f.clone().multiply(S);
1607
+ const A = p.clone().invert(), M = a.clone().invert();
1608
+ let v = e.clone().multiply(l).multiply(p).multiply(t).multiply(n).multiply(r).multiply(A).multiply(o).multiply(a).multiply(s).multiply(M);
1609
+ const S = new L().copyPosition(v), E = f.clone().multiply(S);
1610
1610
  return c.copyPosition(E), v = c.clone().multiply(I), v.premultiply(f.invert()), v;
1611
1611
  }
1612
1612
  function q(i) {
@@ -1628,12 +1628,12 @@ function q(i) {
1628
1628
  ];
1629
1629
  return i === 6 ? (console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."), e[0]) : e[i];
1630
1630
  }
1631
- function oe(i) {
1631
+ function ae(i) {
1632
1632
  return i.split(",").map(function(t) {
1633
1633
  return parseFloat(t);
1634
1634
  });
1635
1635
  }
1636
- function Ce(i, e, t) {
1636
+ function Le(i, e, t) {
1637
1637
  return e === void 0 && (e = 0), t === void 0 && (t = i.byteLength), new TextDecoder().decode(new Uint8Array(i, e, t));
1638
1638
  }
1639
1639
  function Dt(i, e) {
@@ -1649,7 +1649,7 @@ async function Pt(i, e, t) {
1649
1649
  e.signal.throwIfAborted();
1650
1650
  const n = new AbortController(), r = n.signal, s = () => n.abort(e.signal.reason);
1651
1651
  e.signal.addEventListener("abort", s, { once: !0 });
1652
- const o = (g, d) => new Promise((T, F) => {
1652
+ const a = (g, d) => new Promise((T, F) => {
1653
1653
  let y = !1;
1654
1654
  const x = () => {
1655
1655
  y || (y = !0, F(r.reason));
@@ -1659,7 +1659,7 @@ async function Pt(i, e, t) {
1659
1659
  }, (I) => {
1660
1660
  r.removeEventListener("abort", x), y || (y = !0, F(I));
1661
1661
  });
1662
- }), a = [], l = /* @__PURE__ */ new Set(), p = /* @__PURE__ */ new Set(), f = [], u = new st(), c = async (g) => {
1662
+ }), o = [], l = /* @__PURE__ */ new Set(), p = /* @__PURE__ */ new Set(), f = [], u = new st(), c = async (g) => {
1663
1663
  var A;
1664
1664
  if (/^(blob:|data:)/i.test(g))
1665
1665
  return g.startsWith("blob:") && p.add(g), g;
@@ -1692,7 +1692,7 @@ async function Pt(i, e, t) {
1692
1692
  const x = this.binaryFormat ? new ne() : new Y();
1693
1693
  l.add(x);
1694
1694
  const I = (async () => {
1695
- const A = await o(c(d));
1695
+ const A = await a(c(d));
1696
1696
  r.throwIfAborted();
1697
1697
  const M = await fetch(A, { signal: r });
1698
1698
  if (!M.ok) throw new Error(`FBX texture request failed (${M.status}): ${d}`);
@@ -1713,7 +1713,7 @@ async function Pt(i, e, t) {
1713
1713
  const S = new Me().loadAsync(v).catch((b) => {
1714
1714
  const D = b instanceof Error ? `: ${b.message}` : "";
1715
1715
  throw new Error(`FBX texture decode failed: ${d}${D}`, { cause: b });
1716
- }), E = await o(S, (b) => {
1716
+ }), E = await a(S, (b) => {
1717
1717
  b.dispose();
1718
1718
  });
1719
1719
  x.image = E.image, E.dispose(), r.throwIfAborted(), x.needsUpdate = !0, T == null || T(x);
@@ -1725,15 +1725,15 @@ async function Pt(i, e, t) {
1725
1725
  f.push(A instanceof Error ? A.message : String(A)), console.warn(`[viewer] FBX texture skipped: ${d}`, A), y == null || y(A);
1726
1726
  });
1727
1727
  return I.catch(() => {
1728
- }), a.push(I), x;
1728
+ }), o.push(I), x;
1729
1729
  }
1730
1730
  }
1731
1731
  u.addHandler(/\.tga$/i, new h("tga")), u.addHandler(/\.dds$/i, new h("dds")), u.addHandler(/.*/, new h());
1732
1732
  let m;
1733
1733
  try {
1734
- return m = new vt(u).parse(i, ""), await Promise.all(a), e.signal.throwIfAborted(), { root: m, textures: l, textureFailures: f };
1734
+ return m = new vt(u).parse(i, ""), await Promise.all(o), e.signal.throwIfAborted(), { root: m, textures: l, textureFailures: f };
1735
1735
  } catch (g) {
1736
- if (n.abort(g), await Promise.allSettled(a), m) {
1736
+ if (n.abort(g), await Promise.allSettled(o), m) {
1737
1737
  const { disposeModelResources: d } = await import("./resources-CHhCm2f7.js");
1738
1738
  d(m, l);
1739
1739
  } else for (const d of l) d.dispose();
@@ -1743,7 +1743,7 @@ async function Pt(i, e, t) {
1743
1743
  for (const g of p) URL.revokeObjectURL(g);
1744
1744
  }
1745
1745
  }
1746
- const ae = "Kaydara FBX Binary \0", Lt = /(?:^|[\r\n])\s*P:\s*"UpAxis"\s*,\s*"int"\s*,\s*"Integer"\s*,\s*""\s*,\s*(-?\d+)/i, Ct = /(?:^|[\r\n])\s*P:\s*"UpAxisSign"\s*,\s*"int"\s*,\s*"Integer"\s*,\s*""\s*,\s*(-?\d+)/i;
1746
+ const oe = "Kaydara FBX Binary \0", Ct = /(?:^|[\r\n])\s*P:\s*"UpAxis"\s*,\s*"int"\s*,\s*"Integer"\s*,\s*""\s*,\s*(-?\d+)/i, Lt = /(?:^|[\r\n])\s*P:\s*"UpAxisSign"\s*,\s*"int"\s*,\s*"Integer"\s*,\s*""\s*,\s*(-?\d+)/i;
1747
1747
  function Ot(i) {
1748
1748
  try {
1749
1749
  const e = new Uint8Array(i), t = Ut(e) ? kt(i) : Bt(new TextDecoder().decode(e));
@@ -1753,16 +1753,16 @@ function Ot(i) {
1753
1753
  }
1754
1754
  }
1755
1755
  function Ut(i) {
1756
- if (i.byteLength < ae.length) return !1;
1757
- for (let e = 0; e < ae.length; e += 1)
1758
- if (i[e] !== ae.charCodeAt(e)) return !1;
1756
+ if (i.byteLength < oe.length) return !1;
1757
+ for (let e = 0; e < oe.length; e += 1)
1758
+ if (i[e] !== oe.charCodeAt(e)) return !1;
1759
1759
  return !0;
1760
1760
  }
1761
1761
  function Bt(i) {
1762
1762
  var r, s;
1763
- const e = Number.parseInt(((r = Lt.exec(i)) == null ? void 0 : r[1]) ?? "", 10);
1763
+ const e = Number.parseInt(((r = Ct.exec(i)) == null ? void 0 : r[1]) ?? "", 10);
1764
1764
  if (!Number.isInteger(e)) return null;
1765
- const t = (s = Ct.exec(i)) == null ? void 0 : s[1], n = t === void 0 ? 1 : Number.parseInt(t, 10);
1765
+ const t = (s = Lt.exec(i)) == null ? void 0 : s[1], n = t === void 0 ? 1 : Number.parseInt(t, 10);
1766
1766
  return Number.isInteger(n) ? { axis: e, sign: n } : null;
1767
1767
  }
1768
1768
  function kt(i) {
@@ -1779,33 +1779,33 @@ function kt(i) {
1779
1779
  return null;
1780
1780
  }
1781
1781
  function Oe(i, e, t, n) {
1782
- let r = e, s = null, o = 1;
1782
+ let r = e, s = null, a = 1;
1783
1783
  for (; r < t; ) {
1784
- const a = K(i, r, n, !0);
1785
- if (!a) break;
1786
- if (a.name === "P") {
1787
- const [l, , , , p] = a.properties;
1788
- l === "UpAxis" && typeof p == "number" && (s = p), l === "UpAxisSign" && typeof p == "number" && (o = p);
1784
+ const o = K(i, r, n, !0);
1785
+ if (!o) break;
1786
+ if (o.name === "P") {
1787
+ const [l, , , , p] = o.properties;
1788
+ l === "UpAxis" && typeof p == "number" && (s = p), l === "UpAxisSign" && typeof p == "number" && (a = p);
1789
1789
  }
1790
- if (a.childrenOffset < a.endOffset) {
1791
- const l = Oe(i, a.childrenOffset, a.endOffset, n);
1792
- l && (s ?? (s = l.axis), o = l.sign);
1790
+ if (o.childrenOffset < o.endOffset) {
1791
+ const l = Oe(i, o.childrenOffset, o.endOffset, n);
1792
+ l && (s ?? (s = l.axis), a = l.sign);
1793
1793
  }
1794
- r = a.endOffset;
1794
+ r = o.endOffset;
1795
1795
  }
1796
- return s === null ? null : { axis: s, sign: o };
1796
+ return s === null ? null : { axis: s, sign: a };
1797
1797
  }
1798
1798
  function K(i, e, t, n) {
1799
1799
  const r = t ? 25 : 13;
1800
1800
  if (e + r > i.byteLength) return null;
1801
- const s = ie(i, e, t), o = ie(i, e + (t ? 8 : 4), t), a = ie(i, e + (t ? 16 : 8), t), l = i.getUint8(e + (t ? 24 : 12));
1801
+ const s = ie(i, e, t), a = ie(i, e + (t ? 8 : 4), t), o = ie(i, e + (t ? 16 : 8), t), l = i.getUint8(e + (t ? 24 : 12));
1802
1802
  if (s === 0) return null;
1803
- const p = e + r, f = p + l, u = f + a;
1803
+ const p = e + r, f = p + l, u = f + o;
1804
1804
  if (s <= e || s > i.byteLength || u > s) throw new Error("Invalid FBX node bounds.");
1805
1805
  const c = new TextDecoder().decode(new Uint8Array(i.buffer, i.byteOffset + p, l)), h = [];
1806
1806
  if (n) {
1807
1807
  let m = f;
1808
- for (let g = 0; g < o; g += 1) {
1808
+ for (let g = 0; g < a; g += 1) {
1809
1809
  const d = Xt(i, m);
1810
1810
  if (h.push(d.value), m = d.nextOffset, m > u) return null;
1811
1811
  }
@@ -1859,7 +1859,7 @@ function _t(i) {
1859
1859
  return new Map(
1860
1860
  (((S = v == null ? void 0 : v.children.find((E) => E.name === "Properties70")) == null ? void 0 : S.children) ?? []).filter((E) => E.name === "P" && typeof E.values[0] == "string").map((E) => [E.values[0], E.values.slice(4)])
1861
1861
  );
1862
- }, s = n.find((v) => v.name === "Definitions"), o = s == null ? void 0 : s.children.find((v) => v.name === "ObjectType" && v.values[0] === "Material"), a = (o == null ? void 0 : o.children.filter((v) => v.name === "PropertyTemplate")) ?? [], l = ((F = n.find((v) => v.name === "Connections")) == null ? void 0 : F.children.filter((v) => v.name === "C")) ?? [], p = ((y = n.find((v) => v.name === "Objects")) == null ? void 0 : y.children) ?? [], f = /* @__PURE__ */ new Map(), u = (v, S) => {
1862
+ }, s = n.find((v) => v.name === "Definitions"), a = s == null ? void 0 : s.children.find((v) => v.name === "ObjectType" && v.values[0] === "Material"), o = (a == null ? void 0 : a.children.filter((v) => v.name === "PropertyTemplate")) ?? [], l = ((F = n.find((v) => v.name === "Connections")) == null ? void 0 : F.children.filter((v) => v.name === "C")) ?? [], p = ((y = n.find((v) => v.name === "Objects")) == null ? void 0 : y.children) ?? [], f = /* @__PURE__ */ new Map(), u = (v, S) => {
1863
1863
  var E;
1864
1864
  return (E = v == null ? void 0 : v.children.find((b) => b.name === S)) == null ? void 0 : E.values[0];
1865
1865
  };
@@ -1894,7 +1894,7 @@ function _t(i) {
1894
1894
  if (v.name !== "Material") continue;
1895
1895
  const S = v.values[0];
1896
1896
  if (typeof S != "number" || !Number.isSafeInteger(S)) throw new Error("Invalid FBX material ID.");
1897
- const E = r(v), b = l.filter((P) => P.values[0] === "OP" && P.values[2] === S).map((P) => String(P.values[3])), D = l.filter((P) => P.values[0] === "OP" && P.values[2] === S).map((P) => ({ id: Number(P.values[1]), role: String(P.values[3]) })), w = String(u(v, "ShadingModel") ?? "phong").toLowerCase(), R = r(a.find((P) => String(P.values[0]).toLowerCase() === `fbxsurface${w}`));
1897
+ const E = r(v), b = l.filter((P) => P.values[0] === "OP" && P.values[2] === S).map((P) => String(P.values[3])), D = l.filter((P) => P.values[0] === "OP" && P.values[2] === S).map((P) => ({ id: Number(P.values[1]), role: String(P.values[3]) })), w = String(u(v, "ShadingModel") ?? "phong").toLowerCase(), R = r(o.find((P) => String(P.values[0]).toLowerCase() === `fbxsurface${w}`));
1898
1898
  m.set(S, {
1899
1899
  textureConnections: D,
1900
1900
  shadingModel: w,
@@ -1931,9 +1931,9 @@ function _t(i) {
1931
1931
  function Vt(i) {
1932
1932
  const e = new DataView(i);
1933
1933
  if (e.byteLength < 27) throw new Error("Truncated FBX header.");
1934
- const t = e.getUint32(23, !0) >= 7500, n = (r, s, o) => {
1935
- if (o > 16) throw new Error("Excessive FBX metadata nesting.");
1936
- const a = [];
1934
+ const t = e.getUint32(23, !0) >= 7500, n = (r, s, a) => {
1935
+ if (a > 16) throw new Error("Excessive FBX metadata nesting.");
1936
+ const o = [];
1937
1937
  let l = r;
1938
1938
  for (; l < s; ) {
1939
1939
  const p = K(e, l, t, !1);
@@ -1941,11 +1941,11 @@ function Vt(i) {
1941
1941
  if (p.endOffset > s) throw new Error("FBX child extends past its parent.");
1942
1942
  if (te.has(p.name) || Ue.has(p.name)) {
1943
1943
  const f = K(e, l, t, p.name !== "UV");
1944
- a.push({ name: f.name, values: ["BlendModes", "Alphas"].includes(f.name) ? Nt(e, l, t, f.childrenOffset) : [...f.properties], children: te.has(f.name) ? n(f.childrenOffset, f.endOffset, o + 1) : [] });
1944
+ o.push({ name: f.name, values: ["BlendModes", "Alphas"].includes(f.name) ? Nt(e, l, t, f.childrenOffset) : [...f.properties], children: te.has(f.name) ? n(f.childrenOffset, f.endOffset, a + 1) : [] });
1945
1945
  }
1946
1946
  l = p.endOffset;
1947
1947
  }
1948
- return a;
1948
+ return o;
1949
1949
  };
1950
1950
  return n(27, e.byteLength, 0);
1951
1951
  }
@@ -1953,29 +1953,29 @@ function Gt(i) {
1953
1953
  const e = /"(?:\\.|[^"\\])*"|;[^\r\n]*|\r?\n|[^\S\r\n]+|[{}:,]|[^\s{}:,;]+/g;
1954
1954
  let t = null;
1955
1955
  const n = () => {
1956
- var o;
1956
+ var a;
1957
1957
  if (t !== null) {
1958
- const a = t;
1959
- return t = null, a;
1958
+ const o = t;
1959
+ return t = null, o;
1960
1960
  }
1961
1961
  for (; ; ) {
1962
- const a = ((o = e.exec(i)) == null ? void 0 : o[0]) ?? null;
1963
- if (a === null) return null;
1964
- if (!(a.startsWith(";") || /^[^\S\r\n]+$/.test(a)))
1965
- return a;
1966
- }
1967
- }, r = (o) => o.startsWith('"') ? o.slice(1, -1).replace(/\\(["\\])/g, "$1") : Number.isFinite(Number(o)) ? Number(o) : o, s = (o) => {
1968
- if (o > 16) throw new Error("Excessive FBX metadata nesting.");
1969
- const a = [];
1962
+ const o = ((a = e.exec(i)) == null ? void 0 : a[0]) ?? null;
1963
+ if (o === null) return null;
1964
+ if (!(o.startsWith(";") || /^[^\S\r\n]+$/.test(o)))
1965
+ return o;
1966
+ }
1967
+ }, r = (a) => a.startsWith('"') ? a.slice(1, -1).replace(/\\(["\\])/g, "$1") : Number.isFinite(Number(a)) ? Number(a) : a, s = (a) => {
1968
+ if (a > 16) throw new Error("Excessive FBX metadata nesting.");
1969
+ const o = [];
1970
1970
  for (; ; ) {
1971
1971
  const l = n();
1972
1972
  if (l === null) {
1973
- if (o) throw new Error("Unclosed FBX block.");
1974
- return a;
1973
+ if (a) throw new Error("Unclosed FBX block.");
1974
+ return o;
1975
1975
  }
1976
1976
  if (l === "}") {
1977
- if (!o) throw new Error("Unexpected FBX closing brace.");
1978
- return a;
1977
+ if (!a) throw new Error("Unexpected FBX closing brace.");
1978
+ return o;
1979
1979
  }
1980
1980
  if (l === `
1981
1981
  ` || l === `\r
@@ -1993,7 +1993,7 @@ function Gt(i) {
1993
1993
  break;
1994
1994
  }
1995
1995
  if (c === "{") {
1996
- if (te.has(l)) u = s(o + 1);
1996
+ if (te.has(l)) u = s(a + 1);
1997
1997
  else {
1998
1998
  let h = 1;
1999
1999
  for (; h; ) {
@@ -2006,7 +2006,7 @@ function Gt(i) {
2006
2006
  }
2007
2007
  p && c !== "," && f.push(r(c));
2008
2008
  }
2009
- p && a.push({ name: l, values: f, children: u });
2009
+ p && o.push({ name: l, values: f, children: u });
2010
2010
  }
2011
2011
  };
2012
2012
  return s(0);
@@ -2015,15 +2015,15 @@ function Nt(i, e, t, n) {
2015
2015
  const r = t ? 25 : 13;
2016
2016
  let s = e + r + i.getUint8(e + r - 1);
2017
2017
  if (s === n) return [];
2018
- const o = String.fromCharCode(i.getUint8(s));
2019
- if (!["i", "d", "f"].includes(o)) return [...K(i, e, t, !0).properties];
2018
+ const a = String.fromCharCode(i.getUint8(s));
2019
+ if (!["i", "d", "f"].includes(a)) return [...K(i, e, t, !0).properties];
2020
2020
  if (s + 13 > n) throw new Error("Truncated FBX layered array header.");
2021
- const a = i.getUint32(s + 1, !0), l = i.getUint32(s + 5, !0), p = i.getUint32(s + 9, !0), f = o === "d" ? 8 : 4;
2022
- if (a > 4096 || s + 13 + p !== n || ![0, 1].includes(l)) throw new Error("Invalid FBX layered array bounds.");
2023
- const u = new Uint8Array(i.buffer, i.byteOffset + s + 13, p), c = l === 1 ? ht(u, { out: new Uint8Array(a * f) }) : u;
2024
- if (c.length !== a * f) throw new Error("Invalid FBX layered array size.");
2021
+ const o = i.getUint32(s + 1, !0), l = i.getUint32(s + 5, !0), p = i.getUint32(s + 9, !0), f = a === "d" ? 8 : 4;
2022
+ if (o > 4096 || s + 13 + p !== n || ![0, 1].includes(l)) throw new Error("Invalid FBX layered array bounds.");
2023
+ const u = new Uint8Array(i.buffer, i.byteOffset + s + 13, p), c = l === 1 ? ht(u, { out: new Uint8Array(o * f) }) : u;
2024
+ if (c.length !== o * f) throw new Error("Invalid FBX layered array size.");
2025
2025
  const h = new DataView(c.buffer, c.byteOffset, c.byteLength);
2026
- return Array.from({ length: a }, (m, g) => o === "i" ? h.getInt32(g * f, !0) : o === "d" ? h.getFloat64(g * f, !0) : h.getFloat32(g * f, !0));
2026
+ return Array.from({ length: o }, (m, g) => a === "i" ? h.getInt32(g * f, !0) : a === "d" ? h.getFloat64(g * f, !0) : h.getFloat32(g * f, !0));
2027
2027
  }
2028
2028
  const Ee = (i) => i <= 0.04045 ? i / 12.92 : ((i + 0.055) / 1.055) ** 2.4, $t = (i) => i <= 31308e-7 ? i * 12.92 : 1.055 * i ** (1 / 2.4) - 0.055, zt = /* @__PURE__ */ new Set([0, 1, 2, 4, 5]), jt = 4 * 1024 * 1024;
2029
2029
  function be(i) {
@@ -2034,14 +2034,14 @@ function be(i) {
2034
2034
  if (i.format !== Ie || i.type !== Ae || !(e.data instanceof Uint8Array) || e.data.length !== t * n * 4) throw new Error("require RGBA8 source");
2035
2035
  r = e.data;
2036
2036
  } else {
2037
- const o = document.createElement("canvas");
2038
- o.width = t, o.height = n;
2039
- const a = o.getContext("2d", { willReadFrequently: !0 });
2040
- if (!a) throw new Error("canvas readback unavailable");
2041
- a.drawImage(i.image, 0, 0), r = a.getImageData(0, 0, t, n).data;
2037
+ const a = document.createElement("canvas");
2038
+ a.width = t, a.height = n;
2039
+ const o = a.getContext("2d", { willReadFrequently: !0 });
2040
+ if (!o) throw new Error("canvas readback unavailable");
2041
+ o.drawImage(i.image, 0, 0), r = o.getImageData(0, 0, t, n).data;
2042
2042
  }
2043
2043
  const s = new Uint8Array(t * n * 4);
2044
- for (let o = 0; o < n; o++) for (let a = 0; a < t * 4; a++) s[(i.flipY ? n - o - 1 : o) * t * 4 + a] = r[o * t * 4 + a];
2044
+ for (let a = 0; a < n; a++) for (let o = 0; o < t * 4; o++) s[(i.flipY ? n - a - 1 : a) * t * 4 + o] = r[a * t * 4 + o];
2045
2045
  return { data: s, width: t, height: n };
2046
2046
  }
2047
2047
  function Ht(i, e, t) {
@@ -2069,14 +2069,14 @@ function Ht(i, e, t) {
2069
2069
  ]);
2070
2070
  if (n.some((u) => s(u) !== s(r))) throw new Error("incompatible sampling state");
2071
2071
  if (i.layers.some((u) => !e.textures.has(u.textureId))) throw new Error("missing source metadata");
2072
- const o = be(r), a = o.width * o.height;
2073
- if (i.layers[0].alpha !== 1 || o.data.some((u, c) => c % 4 === 3 && u !== 255)) throw new Error("base layer must be fully opaque with weight 1");
2074
- const l = new Float32Array(a * 3);
2075
- for (let u = 0; u < a; u++) for (let c = 0; c < 3; c++) l[u * 3 + c] = r.colorSpace === me ? o.data[u * 4 + c] / 255 : Ee(o.data[u * 4 + c] / 255);
2072
+ const a = be(r), o = a.width * a.height;
2073
+ if (i.layers[0].alpha !== 1 || a.data.some((u, c) => c % 4 === 3 && u !== 255)) throw new Error("base layer must be fully opaque with weight 1");
2074
+ const l = new Float32Array(o * 3);
2075
+ for (let u = 0; u < o; u++) for (let c = 0; c < 3; c++) l[u * 3 + c] = r.colorSpace === me ? a.data[u * 4 + c] / 255 : Ee(a.data[u * 4 + c] / 255);
2076
2076
  for (let u = 1; u < n.length; u++) {
2077
2077
  const c = n[u], h = be(c), m = i.layers[u];
2078
- if (h.width !== o.width || h.height !== o.height) throw new Error("layer dimensions differ");
2079
- for (let g = 0; g < a; g++) {
2078
+ if (h.width !== a.width || h.height !== a.height) throw new Error("layer dimensions differ");
2079
+ for (let g = 0; g < o; g++) {
2080
2080
  const d = m.alpha * h.data[g * 4 + 3] / 255;
2081
2081
  for (let T = 0; T < 3; T++) {
2082
2082
  const F = l[g * 3 + T], y = h.data[g * 4 + T] / 255, x = c.colorSpace === me ? y : Ee(y), I = m.blendMode === 1 ? Math.min(1, F + x) : m.blendMode === 2 ? F * x : x;
@@ -2084,10 +2084,10 @@ function Ht(i, e, t) {
2084
2084
  }
2085
2085
  }
2086
2086
  }
2087
- const p = new Uint8Array(a * 4);
2088
- for (let u = 0; u < a; u++) p[u * 4 + 3] = 255;
2089
- for (let u = 0; u < a; u++) for (let c = 0; c < 3; c++) p[u * 4 + c] = Math.round(255 * Math.min(1, Math.max(0, $t(l[u * 3 + c]))));
2090
- const f = new ne(p, o.width, o.height);
2087
+ const p = new Uint8Array(o * 4);
2088
+ for (let u = 0; u < o; u++) p[u * 4 + 3] = 255;
2089
+ for (let u = 0; u < o; u++) for (let c = 0; c < 3; c++) p[u * 4 + c] = Math.round(255 * Math.min(1, Math.max(0, $t(l[u * 3 + c]))));
2090
+ const f = new ne(p, a.width, a.height);
2091
2091
  return f.colorSpace = X, f.generateMipmaps = r.generateMipmaps, f.wrapS = r.wrapS, f.wrapT = r.wrapT, f.minFilter = r.minFilter, f.magFilter = r.magFilter, f.anisotropy = r.anisotropy, f.offset.copy(r.offset), f.repeat.copy(r.repeat), f.center.copy(r.center), f.rotation = r.rotation, f.matrix.copy(r.matrix), f.matrixAutoUpdate = r.matrixAutoUpdate, f.channel = r.channel, f.mapping = r.mapping, f.userData.fbxLayerBaseId = i.layers[0].textureId, f.needsUpdate = !0, f;
2092
2092
  }
2093
2093
  function Wt(i, e) {
@@ -2097,25 +2097,25 @@ function Wt(i, e) {
2097
2097
  if (!n) return [];
2098
2098
  const r = [], s = (c, h) => r.push({ status: "unsupported", code: c, source: `layered:${n.id}:${h}`, target: t.role });
2099
2099
  s("LAYERED_TEXTURE_NOT_COMPOSITED", "preview uses loader fallback; layers have not been composited");
2100
- const o = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), l = [], p = (c, h) => {
2100
+ const a = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), l = [], p = (c, h) => {
2101
2101
  var g;
2102
- if (o.has(c)) {
2102
+ if (a.has(c)) {
2103
2103
  s("LAYERED_TEXTURE_CYCLE", String(c));
2104
2104
  return;
2105
2105
  }
2106
- if (h > 32 || a.size >= 4096) {
2106
+ if (h > 32 || o.size >= 4096) {
2107
2107
  s("LAYERED_TEXTURE_GRAPH_LIMIT", String(c));
2108
2108
  return;
2109
2109
  }
2110
- if (a.has(c)) return;
2110
+ if (o.has(c)) return;
2111
2111
  const m = (g = e.layeredTextures) == null ? void 0 : g.get(c);
2112
2112
  if (!m) {
2113
- e.textures.has(c) ? l.push(c) : s("LAYERED_TEXTURE_MISSING_SOURCE", String(c)), a.add(c);
2113
+ e.textures.has(c) ? l.push(c) : s("LAYERED_TEXTURE_MISSING_SOURCE", String(c)), o.add(c);
2114
2114
  return;
2115
2115
  }
2116
- h && s("LAYERED_TEXTURE_NESTED", String(c)), m.textureIds.length || s("LAYERED_TEXTURE_EMPTY", String(c)), (m.blendModes.length !== m.textureIds.length || m.alphas.length !== m.textureIds.length) && s("LAYERED_TEXTURE_METADATA_MISMATCH", `${c}:sources=${m.textureIds.length},modes=${m.blendModes.length},alphas=${m.alphas.length}`), m.blendModes.some((d) => !Number.isInteger(d) || d < 0) && s("LAYERED_TEXTURE_INVALID_MODE", String(c)), m.alphas.some((d) => !Number.isFinite(d) || d < 0 || d > 1) && s("LAYERED_TEXTURE_INVALID_ALPHA", String(c)), o.add(c);
2116
+ h && s("LAYERED_TEXTURE_NESTED", String(c)), m.textureIds.length || s("LAYERED_TEXTURE_EMPTY", String(c)), (m.blendModes.length !== m.textureIds.length || m.alphas.length !== m.textureIds.length) && s("LAYERED_TEXTURE_METADATA_MISMATCH", `${c}:sources=${m.textureIds.length},modes=${m.blendModes.length},alphas=${m.alphas.length}`), m.blendModes.some((d) => !Number.isInteger(d) || d < 0) && s("LAYERED_TEXTURE_INVALID_MODE", String(c)), m.alphas.some((d) => !Number.isFinite(d) || d < 0 || d > 1) && s("LAYERED_TEXTURE_INVALID_ALPHA", String(c)), a.add(c);
2117
2117
  for (const d of m.textureIds) p(d, h + 1);
2118
- o.delete(c), a.add(c);
2118
+ a.delete(c), o.add(c);
2119
2119
  };
2120
2120
  return p(n.id, 0), new Set(l.map((c) => {
2121
2121
  const h = e.textures.get(c);
@@ -2142,7 +2142,7 @@ const Yt = {
2142
2142
  };
2143
2143
  function qt(i, e, t, n, r, s) {
2144
2144
  var c;
2145
- const o = (c = n.modelUvSets) == null ? void 0 : c.get(i.ID ?? NaN), a = [], l = [], p = /* @__PURE__ */ new Set();
2145
+ const a = (c = n.modelUvSets) == null ? void 0 : c.get(i.ID ?? NaN), o = [], l = [], p = /* @__PURE__ */ new Set();
2146
2146
  for (const h of t.textureConnections) {
2147
2147
  const m = Yt[h.role], g = m ? e[m] : void 0, d = n.textures.get(h.id) ?? (g instanceof Y ? n.textures.get(g.userData.fbxLayerBaseId) : void 0);
2148
2148
  if (!m || !d || p.has(m)) continue;
@@ -2152,7 +2152,7 @@ function qt(i, e, t, n, r, s) {
2152
2152
  const F = (D, w) => l.push({ status: "unsupported", code: D, source: `texture:${h.id}:${w}`, target: String(m) });
2153
2153
  let y = 0;
2154
2154
  if (d.uvSet) {
2155
- const D = (o == null ? void 0 : o.flatMap((w, R) => w === d.uvSet ? [R] : [])) ?? [];
2155
+ const D = (a == null ? void 0 : a.flatMap((w, R) => w === d.uvSet ? [R] : [])) ?? [];
2156
2156
  if (D.length === 1) y = D[0];
2157
2157
  else if (D.length > 1 || d.uvSet !== "default") {
2158
2158
  F("UV_SET_UNRESOLVED", `UVSet:${d.uvSet}:${D.length > 1 ? "ambiguous" : "missing"}`);
@@ -2169,14 +2169,14 @@ function qt(i, e, t, n, r, s) {
2169
2169
  }, I = x("Translation", [T.offset.x, T.offset.y, 0]), A = x("Scaling", [T.repeat.x, T.repeat.y, 1]), M = x("Rotation", [0, 0, 0]), v = x("RotationPivot", [0, 0, 0]), S = x("ScalingPivot", [0, 0, 0]), E = M[0] !== 0 || M[1] !== 0 || v.some((D) => D !== 0) || S.some((D) => D !== 0);
2170
2170
  E && F("TEXTURE_TRANSFORM_UNSUPPORTED", "3D-rotation-or-pivot"), (I[2] || A[2] !== void 0 && A[2] !== 1) && F("TEXTURE_TRANSFORM_UNSUPPORTED", "3D-translation-or-scale");
2171
2171
  const b = E ? 0 : -(M[2] ?? 0) * Math.PI / 180;
2172
- b && l.push({ status: "approximate", code: "TEXTURE_ROTATION_PROFILE", source: `texture:${h.id}:Rotation`, target: "T * Rccw * S; origin pivot" }), (y !== T.channel || I[0] !== T.offset.x || I[1] !== T.offset.y || A[0] !== T.repeat.x || A[1] !== T.repeat.y || b !== T.rotation) && a.push({ slot: m, source: T, channel: y, offset: I, scale: A, rotation: b });
2172
+ b && l.push({ status: "approximate", code: "TEXTURE_ROTATION_PROFILE", source: `texture:${h.id}:Rotation`, target: "T * Rccw * S; origin pivot" }), (y !== T.channel || I[0] !== T.offset.x || I[1] !== T.offset.y || A[0] !== T.repeat.x || A[1] !== T.repeat.y || b !== T.rotation) && o.push({ slot: m, source: T, channel: y, offset: I, scale: A, rotation: b });
2173
2173
  }
2174
- if (!a.length && !l.length) return e;
2174
+ if (!o.length && !l.length) return e;
2175
2175
  const f = e.clone();
2176
2176
  r(f);
2177
2177
  const u = f.userData.fbxConversionReport;
2178
2178
  u.issues.push(...l);
2179
- for (const h of a) {
2179
+ for (const h of o) {
2180
2180
  const m = h.source.clone();
2181
2181
  s(m), m.channel = h.channel, m.offset.set(h.offset[0], h.offset[1]), m.repeat.set(h.scale[0], h.scale[1]), m.center.set(0, 0), m.rotation = h.rotation;
2182
2182
  const g = -h.rotation, d = Math.cos(g), T = Math.sin(g);
@@ -2200,12 +2200,12 @@ function Kt(i, e) {
2200
2200
  function Zt(i, e, t, n, r = "r", s = !1) {
2201
2201
  if (!Number.isInteger(e) || !Number.isInteger(t) || e <= 0 || t <= 0 || i.length !== e * t * 4)
2202
2202
  throw new Error("Invalid FBX scalar RGBA dimensions.");
2203
- const o = new Uint8Array(i.length), a = { r: 0, g: 1, b: 2, a: 3 }[r];
2203
+ const a = new Uint8Array(i.length), o = { r: 0, g: 1, b: 2, a: 3 }[r];
2204
2204
  for (let l = 0; l < t; l++) for (let p = 0; p < e; p++) {
2205
- const f = (l * e + p) * 4, u = ((s ? t - l - 1 : l) * e + p) * 4, c = Math.round(255 * Kt(i[f + a] / 255));
2206
- o.fill(c, u, u + 4);
2205
+ const f = (l * e + p) * 4, u = ((s ? t - l - 1 : l) * e + p) * 4, c = Math.round(255 * Kt(i[f + o] / 255));
2206
+ a.fill(c, u, u + 4);
2207
2207
  }
2208
- return o;
2208
+ return a;
2209
2209
  }
2210
2210
  function Qt(i, e) {
2211
2211
  const t = i.image;
@@ -2218,31 +2218,31 @@ function Qt(i, e) {
2218
2218
  throw new Error("FBX scalar conversion requires 8-bit RGBA pixels.");
2219
2219
  s = t.data;
2220
2220
  } else {
2221
- const a = document.createElement("canvas");
2222
- a.width = n, a.height = r;
2223
- const l = a.getContext("2d", { willReadFrequently: !0 });
2221
+ const o = document.createElement("canvas");
2222
+ o.width = n, o.height = r;
2223
+ const l = o.getContext("2d", { willReadFrequently: !0 });
2224
2224
  if (!l) throw new Error("FBX scalar texture conversion requires a 2D canvas.");
2225
2225
  l.drawImage(t, 0, 0), s = l.getImageData(0, 0, n, r).data;
2226
2226
  }
2227
- const o = new ne(Zt(s, n, r, e, "r", i.flipY), n, r);
2228
- return o.wrapS = i.wrapS, o.wrapT = i.wrapT, o.offset.copy(i.offset), o.repeat.copy(i.repeat), o.center.copy(i.center), o.rotation = i.rotation, o.matrix.copy(i.matrix), o.matrixAutoUpdate = i.matrixAutoUpdate, o.channel = i.channel, o.magFilter = i.magFilter, o.minFilter = i.minFilter, o.generateMipmaps = i.generateMipmaps, o.anisotropy = i.anisotropy, o.colorSpace = ot, o.needsUpdate = !0, o;
2227
+ const a = new ne(Zt(s, n, r, e, "r", i.flipY), n, r);
2228
+ return a.wrapS = i.wrapS, a.wrapT = i.wrapT, a.offset.copy(i.offset), a.repeat.copy(i.repeat), a.center.copy(i.center), a.rotation = i.rotation, a.matrix.copy(i.matrix), a.matrixAutoUpdate = i.matrixAutoUpdate, a.channel = i.channel, a.magFilter = i.magFilter, a.minFilter = i.minFilter, a.generateMipmaps = i.generateMipmaps, a.anisotropy = i.anisotropy, a.colorSpace = at, a.needsUpdate = !0, a;
2229
2229
  }
2230
2230
  function Jt(i, e, t) {
2231
- const n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), l = [];
2231
+ const n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), l = [];
2232
2232
  try {
2233
2233
  i.traverse((c) => {
2234
2234
  if (!(c instanceof Fe)) return;
2235
2235
  const h = e == null ? void 0 : e.modelMaterials.get(c.ID ?? NaN), m = (d) => h ? e == null ? void 0 : e.materials.get(h[d]) : void 0, g = (d, T) => {
2236
2236
  const F = m(T), y = en(d, n, F, t, e, r, s);
2237
- return y instanceof De && F && e ? qt(c, y, F, e, (x) => o.add(x), (x) => a.add(x)) : y;
2237
+ return y instanceof De && F && e ? qt(c, y, F, e, (x) => a.add(x), (x) => o.add(x)) : y;
2238
2238
  };
2239
2239
  l.push({ mesh: c, material: Array.isArray(c.material) ? c.material.map(g) : g(c.material, 0) });
2240
2240
  });
2241
2241
  } catch (c) {
2242
2242
  for (const [h, m] of n) h !== m && m.dispose();
2243
2243
  for (const h of r.values()) h.dispose();
2244
- for (const h of o) h.dispose();
2245
2244
  for (const h of a) h.dispose();
2245
+ for (const h of o) h.dispose();
2246
2246
  for (const h of s.values()) h.dispose();
2247
2247
  throw c;
2248
2248
  }
@@ -2257,10 +2257,10 @@ function Jt(i, e, t) {
2257
2257
  const u = [...p].flatMap((c) => c.userData.fbxConversionReport ? [c.userData.fbxConversionReport] : []);
2258
2258
  return i.userData.fbxConversionReports = u, u;
2259
2259
  }
2260
- function en(i, e, t, n, r, s = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map()) {
2260
+ function en(i, e, t, n, r, s = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map()) {
2261
2261
  var E, b, D;
2262
- const a = e.get(i);
2263
- if (a) return a;
2262
+ const o = e.get(i);
2263
+ if (o) return o;
2264
2264
  if (!(i instanceof W) && !(i instanceof Se))
2265
2265
  return e.set(i, i), i;
2266
2266
  const l = i instanceof W ? i : null, p = (w, R) => {
@@ -2321,8 +2321,8 @@ function en(i, e, t, n, r, s = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ ne
2321
2321
  for (const w of F)
2322
2322
  if (!(!["DiffuseColor", "EmissiveColor"].includes(w.role) || !r || !n) && t.textureConnections.filter((R) => R.role === w.role).length === 1)
2323
2323
  try {
2324
- let R = o.get(w.id);
2325
- R || (R = Ht(w, r, n), o.set(w.id, R)), w.role === "DiffuseColor" ? (d.map = R, d.color.setRGB(1, 1, 1)) : (d.emissiveMap = R, d.emissive.setRGB(1, 1, 1)), w.issues = [], y.push(w.id);
2324
+ let R = a.get(w.id);
2325
+ R || (R = Ht(w, r, n), a.set(w.id, R)), w.role === "DiffuseColor" ? (d.map = R, d.color.setRGB(1, 1, 1)) : (d.emissiveMap = R, d.emissive.setRGB(1, 1, 1)), w.issues = [], y.push(w.id);
2326
2326
  } catch (R) {
2327
2327
  w.issues.push({ status: "unsupported", code: "LAYERED_TEXTURE_BAKE_REJECTED", source: `layered:${w.id}:${R instanceof Error ? R.message : String(R)}`, target: w.role });
2328
2328
  }
@@ -2404,7 +2404,7 @@ function en(i, e, t, n, r, s = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ ne
2404
2404
  return d.userData.fbxConversionReport = S, d.visible = i.visible, d.toneMapped = i.toneMapped, d.clippingPlanes = i.clippingPlanes, d.clipIntersection = i.clipIntersection, d.clipShadows = i.clipShadows, d.polygonOffset = i.polygonOffset, d.polygonOffsetFactor = i.polygonOffsetFactor, d.polygonOffsetUnits = i.polygonOffsetUnits, d.dithering = i.dithering, d.needsUpdate = !0, e.set(i, d), d;
2405
2405
  }
2406
2406
  function fn(i, e) {
2407
- let t = !1, n = null, r = null, s = "z", o, a = null, l;
2407
+ let t = !1, n = null, r = null, s = "z", a, o = null, l;
2408
2408
  const p = () => {
2409
2409
  t = !0;
2410
2410
  }, f = (async () => {
@@ -2421,16 +2421,16 @@ function fn(i, e) {
2421
2421
  const d = _t(g), T = await Pt(g, i, d);
2422
2422
  l = T.textures, u.add(T.root);
2423
2423
  const y = Jt(u, d, l).flatMap((I) => I.issues.filter((A) => A.status === "unsupported" || A.code === "TEXTURE_ROTATION_PROFILE" || A.code === "LAYERED_TEXTURE_BAKED").map((A) => `${I.materialName || I.materialId || "material"}: ${A.source}`));
2424
- y.length && (a = {
2424
+ y.length && (o = {
2425
2425
  code: "W_FBX_MATERIAL_APPROXIMATED",
2426
2426
  stage: "material-conversion",
2427
2427
  message: `FBX 材质存在未支持或按兼容规则近似处理的语义:${[...new Set(y)].join("、")}。当前为近似预览。`
2428
2428
  });
2429
2429
  const x = [...new Set(T.textureFailures)];
2430
- x.length && (a = {
2430
+ x.length && (o = {
2431
2431
  code: "W_FBX_TEXTURE_UNAVAILABLE",
2432
2432
  stage: "material-conversion",
2433
- message: `FBX 贴图缺失或加载失败,已按无贴图降级显示:${x.join("、")}。${a ? `另有材质近似处理:${a.message}` : ""}`
2433
+ message: `FBX 贴图缺失或加载失败,已按无贴图降级显示:${x.join("、")}。${o ? `另有材质近似处理:${o.message}` : ""}`
2434
2434
  });
2435
2435
  } else {
2436
2436
  const m = new it(), g = new lt();
@@ -2448,7 +2448,7 @@ function fn(i, e) {
2448
2448
  if (t || e.signal.aborted) throw le();
2449
2449
  ye(u, s), tn(u);
2450
2450
  const h = new ut(u, e.options.simulationTheme, void 0, "model");
2451
- n = u, r = h, u = null;
2451
+ h.setCacheInvalidationCallback(e.invalidateTransmissionCaches), n = u, r = h, u = null;
2452
2452
  } finally {
2453
2453
  u && (we(u, l), l = void 0);
2454
2454
  }
@@ -2458,7 +2458,7 @@ function fn(i, e) {
2458
2458
  id: `model-${Math.random().toString(36).slice(2)}`,
2459
2459
  opened: f,
2460
2460
  get warning() {
2461
- return a;
2461
+ return o;
2462
2462
  },
2463
2463
  get root() {
2464
2464
  return (r == null ? void 0 : r.root) ?? null;
@@ -2497,16 +2497,16 @@ function fn(i, e) {
2497
2497
  },
2498
2498
  beginDispose: p,
2499
2499
  dispose() {
2500
- return p(), o ?? (o = f.catch(() => {
2500
+ return p(), a ?? (a = f.catch(() => {
2501
2501
  }).then(() => {
2502
2502
  r == null || r.dispose(), r = null, n && we(n, l), n = null, l = void 0;
2503
- })), o;
2503
+ })), a;
2504
2504
  }
2505
2505
  };
2506
2506
  }
2507
2507
  function tn(i) {
2508
2508
  i.updateMatrixWorld(!0);
2509
- const e = new at().setFromObject(i);
2509
+ const e = new ot().setFromObject(i);
2510
2510
  if (e.isEmpty()) throw new Error("模型不包含可显示的几何内容。");
2511
2511
  const t = e.getSize(new V()), n = Math.max(t.x, t.y, t.z);
2512
2512
  if (!Number.isFinite(n) || n <= 0) throw new Error("模型尺寸无效。");