@nebula-spatial/viewer 0.6.0 → 0.6.2

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,54 +1,54 @@
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 Re, Box3 as ot } from "three";
2
- import { DRACOLoader as it } from "three/examples/jsm/loaders/DRACOLoader.js";
3
- import { GLTFLoader as lt } from "three/examples/jsm/loaders/GLTFLoader.js";
4
- import { z as ge, A as ye, B as ct, d as we, D as ut } from "./index-DoxM1Msk.js";
5
- import { TGALoader as pt } from "three/examples/jsm/loaders/TGALoader.js";
6
- import * as ft from "three/examples/jsm/libs/fflate.module.js";
7
- import { unzlibSync as ht } from "three/examples/jsm/libs/fflate.module.js";
8
- import { NURBSCurve as dt } from "three/examples/jsm/curves/NURBSCurve.js";
9
- import { r as mt } from "./runtime-paths-Dj0itY6G.js";
10
- const gt = 16 * 1024 * 1024;
11
- function De(i, e) {
12
- if (!i || !e || i * e > gt) throw new Error("Invalid or oversized image dimensions (maximum 16M pixels).");
1
+ import { DataTexture as ne, LinearMipmapLinearFilter as Xe, LinearFilter as _e, Loader as J, LoaderUtils as Ve, FileLoader as Ge, TextureLoader as Se, RepeatWrapping as pe, ClampToEdgeWrapping as fe, Texture as Y, MeshPhongMaterial as W, MeshLambertMaterial as Fe, ColorManagement as N, Color as k, SRGBColorSpace as X, EquirectangularReflectionMapping as Ne, Matrix4 as L, Group as ce, Bone as he, PropertyBinding as ee, Object3D as Z, PerspectiveCamera as $e, PointLight as de, MathUtils as B, SpotLight as ze, DirectionalLight as je, SkinnedMesh as He, Mesh as Ae, LineBasicMaterial as We, Line as Ye, Vector3 as V, Skeleton as qe, AmbientLight as Ke, BufferGeometry as re, Float32BufferAttribute as j, Uint16BufferAttribute as Ze, Matrix3 as Qe, Vector2 as Je, ShapeUtils as et, Vector4 as tt, Euler as z, AnimationClip as nt, Quaternion as G, VectorKeyframeTrack as rt, QuaternionKeyframeTrack as me, NumberKeyframeTrack as st, LoadingManager as at, LinearSRGBColorSpace as ge, RGBAFormat as Ie, UnsignedByteType as Re, NoColorSpace as ot, MeshPhysicalMaterial as De, Box3 as it } from "three";
2
+ import { DRACOLoader as lt } from "three/examples/jsm/loaders/DRACOLoader.js";
3
+ import { GLTFLoader as ct } from "three/examples/jsm/loaders/GLTFLoader.js";
4
+ import { z as ye, A as we, B as ut, d as ve, D as pt } from "./index-D4V1Rbos.js";
5
+ import { TGALoader as ft } from "three/examples/jsm/loaders/TGALoader.js";
6
+ import * as ht from "three/examples/jsm/libs/fflate.module.js";
7
+ import { unzlibSync as dt } from "three/examples/jsm/libs/fflate.module.js";
8
+ import { NURBSCurve as mt } from "three/examples/jsm/curves/NURBSCurve.js";
9
+ import { r as gt } from "./runtime-paths-Dj0itY6G.js";
10
+ const yt = 16 * 1024 * 1024;
11
+ function Pe(o, e) {
12
+ if (!o || !e || o * e > yt) throw new Error("Invalid or oversized image dimensions (maximum 16M pixels).");
13
13
  }
14
- function $(i, e, t) {
15
- if (e < 0 || t < 0 || e + t > i.length) throw new Error("Truncated image payload.");
14
+ function $(o, e, t) {
15
+ if (e < 0 || t < 0 || e + t > o.length) throw new Error("Truncated image payload.");
16
16
  }
17
- function yt(i) {
18
- const e = new Uint8Array(i);
17
+ function wt(o) {
18
+ const e = new Uint8Array(o);
19
19
  $(e, 0, 18);
20
- const t = new DataView(i), n = e[2], r = e[16], s = t.getUint16(12, !0), a = t.getUint16(14, !0);
21
- if (De(s, a), e[1] !== 0 || ![2, 3, 10, 11].includes(n) || !([3, 11].includes(n) ? [8, 16] : [24, 32]).includes(r) || e[17] & 192)
20
+ const t = new DataView(o), n = e[2], r = e[16], s = t.getUint16(12, !0), a = t.getUint16(14, !0);
21
+ if (Pe(s, a), e[1] !== 0 || ![2, 3, 10, 11].includes(n) || !([3, 11].includes(n) ? [8, 16] : [24, 32]).includes(r) || e[17] & 192)
22
22
  throw new Error("Unsupported TGA: require non-interleaved 24/32-bit true-color or 8/16-bit grayscale.");
23
- let o = 18 + e[0];
23
+ let i = 18 + e[0];
24
24
  $(e, 18, e[0]);
25
25
  const l = r / 8, p = s * a;
26
- if (n === 2 || n === 3) $(e, o, p * l);
26
+ if (n === 2 || n === 3) $(e, i, p * l);
27
27
  else {
28
28
  let u = 0;
29
29
  for (; u < p; ) {
30
- $(e, o, 1);
31
- const c = e[o++], h = (c & 127) + 1;
30
+ $(e, i, 1);
31
+ const c = e[i++], h = (c & 127) + 1;
32
32
  if (u + h > p) throw new Error("Invalid TGA RLE packet length.");
33
33
  const m = (c & 128 ? 1 : h) * l;
34
- $(e, o, m), o += m, u += h;
34
+ $(e, i, m), i += m, u += h;
35
35
  }
36
36
  }
37
- return { data: new pt().parse(i).data, width: s, height: a };
37
+ return { data: new ft().parse(o).data, width: s, height: a };
38
38
  }
39
- function ve(i) {
40
- const e = i >>> 11 & 31, t = i >>> 5 & 63, n = i & 31;
39
+ function Te(o) {
40
+ const e = o >>> 11 & 31, t = o >>> 5 & 63, n = o & 31;
41
41
  return [e << 3 | e >>> 2, t << 2 | t >>> 4, n << 3 | n >>> 2, 255];
42
42
  }
43
- function wt(i) {
44
- const e = new Uint8Array(i);
43
+ function vt(o) {
44
+ const e = new Uint8Array(o);
45
45
  $(e, 0, 128);
46
- const t = new DataView(i), n = (h) => t.getUint32(h, !0);
46
+ const t = new DataView(o), n = (h) => t.getUint32(h, !0);
47
47
  if (n(0) !== 542327876 || n(4) !== 124 || n(76) !== 32) throw new Error("Invalid DDS header.");
48
48
  const r = n(16), s = n(12);
49
- if (De(r, s), n(112) & 2162176 || n(24) > 1) throw new Error("DDS cubemap/volume textures are unsupported.");
50
- const a = n(80), o = String.fromCharCode(...e.subarray(84, 88)), l = (a & 4) !== 0;
51
- if (l && !["DXT1", "DXT3", "DXT5"].includes(o)) throw new Error(`Unsupported DDS FourCC: ${o}. Require DXT1/DXT3/DXT5.`);
49
+ if (Pe(r, s), n(112) & 2162176 || n(24) > 1) throw new Error("DDS cubemap/volume textures are unsupported.");
50
+ const a = n(80), i = String.fromCharCode(...e.subarray(84, 88)), l = (a & 4) !== 0;
51
+ if (l && !["DXT1", "DXT3", "DXT5"].includes(i)) throw new Error(`Unsupported DDS FourCC: ${i}. Require DXT1/DXT3/DXT5.`);
52
52
  const p = new Uint8Array(r * s * 4);
53
53
  if (!l) {
54
54
  const h = n(88), m = n(92), g = n(96), d = n(100), T = n(104);
@@ -56,43 +56,43 @@ function wt(i) {
56
56
  const F = h / 8, y = n(8) & 8 ? n(20) : r * F;
57
57
  if (y < r * F) throw new Error("Invalid DDS row pitch.");
58
58
  $(e, 128, y * s);
59
- for (let x = 0; x < s; x++) for (let I = 0; I < r; I++) {
60
- const A = 128 + x * y + I * F, M = (x * r + I) * 4;
61
- 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;
59
+ for (let x = 0; x < s; x++) for (let A = 0; A < r; A++) {
60
+ const I = 128 + x * y + A * F, b = (x * r + A) * 4;
61
+ p[b] = e[I + (m === 255 ? 0 : 2)], p[b + 1] = e[I + 1], p[b + 2] = e[I + (d === 255 ? 0 : 2)], p[b + 3] = T && a & 1 ? e[I + 3] : 255;
62
62
  }
63
63
  return { data: p, width: r, height: s };
64
64
  }
65
- const f = o === "DXT1" ? 8 : 16, u = Math.ceil(r / 4), c = Math.ceil(s / 4);
65
+ const f = i === "DXT1" ? 8 : 16, u = Math.ceil(r / 4), c = Math.ceil(s / 4);
66
66
  $(e, 128, u * c * f);
67
67
  for (let h = 0; h < c; h++) for (let m = 0; m < u; m++) {
68
- 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;
69
- 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]);
70
- const I = n(d + 4), A = [e[g], e[g + 1]];
71
- if (o === "DXT5") {
72
- const M = A[0] > A[1] ? 6 : 4;
73
- for (let v = 1; v <= M; v++) A.push(Math.floor(((M + 1 - v) * A[0] + v * A[1]) / (M + 1)));
74
- M === 4 && A.push(0, 255);
75
- }
76
- for (let M = 0; M < 16; M++) {
77
- const v = m * 4 + M % 4, S = h * 4 + Math.floor(M / 4);
68
+ 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 = [Te(T), Te(F)], x = i !== "DXT1" || T > F;
69
+ y.push([0, 1, 2].map((b) => Math.floor(x ? (2 * y[0][b] + y[1][b]) / 3 : (y[0][b] + y[1][b]) / 2)).concat(255)), y.push(x ? [0, 1, 2].map((b) => Math.floor((y[0][b] + 2 * y[1][b]) / 3)).concat(255) : [0, 0, 0, 0]);
70
+ const A = n(d + 4), I = [e[g], e[g + 1]];
71
+ if (i === "DXT5") {
72
+ const b = I[0] > I[1] ? 6 : 4;
73
+ for (let v = 1; v <= b; v++) I.push(Math.floor(((b + 1 - v) * I[0] + v * I[1]) / (b + 1)));
74
+ b === 4 && I.push(0, 255);
75
+ }
76
+ for (let b = 0; b < 16; b++) {
77
+ const v = m * 4 + b % 4, S = h * 4 + Math.floor(b / 4);
78
78
  if (v >= r || S >= s) continue;
79
- const E = y[I >>> 2 * M & 3], b = (S * r + v) * 4;
80
- if (p.set(E, b), o === "DXT3" && (p[b + 3] = (e[g + Math.floor(M / 2)] >>> M % 2 * 4 & 15) * 17), o === "DXT5") {
81
- const R = M * 3, w = g + 2 + Math.floor(R / 8), D = e[w] | (w + 1 < g + 8 ? e[w + 1] : 0) << 8;
82
- p[b + 3] = A[D >>> R % 8 & 7];
79
+ const E = y[A >>> 2 * b & 3], M = (S * r + v) * 4;
80
+ if (p.set(E, M), i === "DXT3" && (p[M + 3] = (e[g + Math.floor(b / 2)] >>> b % 2 * 4 & 15) * 17), i === "DXT5") {
81
+ const R = b * 3, w = g + 2 + Math.floor(R / 8), D = e[w] | (w + 1 < g + 8 ? e[w + 1] : 0) << 8;
82
+ p[M + 3] = I[D >>> R % 8 & 7];
83
83
  }
84
84
  }
85
85
  }
86
86
  return { data: p, width: r, height: s };
87
87
  }
88
- function vt(i, e) {
89
- const t = e === "tga" ? yt(i) : wt(i), n = new Uint8Array(t.data.length), r = t.width * 4;
88
+ function Tt(o, e) {
89
+ const t = e === "tga" ? wt(o) : vt(o), n = new Uint8Array(t.data.length), r = t.width * 4;
90
90
  for (let a = 0; a < t.height; a++) n.set(t.data.subarray(a * r, (a + 1) * r), (t.height - 1 - a) * r);
91
91
  const s = new ne(n, t.width, t.height);
92
- return s.flipY = !1, s.generateMipmaps = !0, s.minFilter = ke, s.magFilter = Xe, s.needsUpdate = !0, s;
92
+ return s.flipY = !1, s.generateMipmaps = !0, s.minFilter = Xe, s.magFilter = _e, s.needsUpdate = !0, s;
93
93
  }
94
- let C, O, U;
95
- class Tt extends J {
94
+ let C, U, O;
95
+ class xt extends J {
96
96
  /**
97
97
  * Constructs a new FBX loader.
98
98
  *
@@ -111,8 +111,8 @@ class Tt extends J {
111
111
  * @param {onErrorCallback} onError - Executed when errors occur.
112
112
  */
113
113
  load(e, t, n, r) {
114
- const s = this, a = s.path === "" ? _e.extractUrlBase(e) : s.path, o = new Ve(this.manager);
115
- o.setPath(s.path), o.setResponseType("arraybuffer"), o.setRequestHeader(s.requestHeader), o.setWithCredentials(s.withCredentials), o.load(e, function(l) {
114
+ const s = this, a = s.path === "" ? Ve.extractUrlBase(e) : s.path, i = new Ge(this.manager);
115
+ i.setPath(s.path), i.setResponseType("arraybuffer"), i.setRequestHeader(s.requestHeader), i.setWithCredentials(s.withCredentials), i.load(e, function(l) {
116
116
  try {
117
117
  t(s.parse(l, a));
118
118
  } catch (p) {
@@ -128,28 +128,28 @@ class Tt extends J {
128
128
  * @return {Group} An object representing the parsed asset.
129
129
  */
130
130
  parse(e, t) {
131
- if (Ft(e))
132
- C = new St().parse(e);
131
+ if (At(e))
132
+ C = new Ft().parse(e);
133
133
  else {
134
- const r = Le(e);
134
+ const r = Ue(e);
135
135
  if (!It(r))
136
136
  throw new Error("THREE.FBXLoader: Unknown format.");
137
- if (xe(r) < 7e3)
138
- throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: " + xe(r));
139
- C = new Mt().parse(r);
137
+ if (Ee(r) < 7e3)
138
+ throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: " + Ee(r));
139
+ C = new St().parse(r);
140
140
  }
141
- const n = new Me(this.manager).setPath(this.resourcePath || t).setCrossOrigin(this.crossOrigin);
142
- return new xt(n, this.manager).parse(C);
141
+ const n = new Se(this.manager).setPath(this.resourcePath || t).setCrossOrigin(this.crossOrigin);
142
+ return new Et(n, this.manager).parse(C);
143
143
  }
144
144
  }
145
- class xt {
145
+ class Et {
146
146
  constructor(e, t) {
147
147
  this.textureLoader = e, this.manager = t;
148
148
  }
149
149
  parse() {
150
- O = this.parseConnections();
151
- const e = this.parseImages(), t = this.parseTextures(e), n = this.parseMaterials(t), r = this.parseDeformers(), s = new Et().parse(r);
152
- return this.parseScene(r, s, n), U;
150
+ U = this.parseConnections();
151
+ const e = this.parseImages(), t = this.parseTextures(e), n = this.parseMaterials(t), r = this.parseDeformers(), s = new bt().parse(r);
152
+ return this.parseScene(r, s, n), O;
153
153
  }
154
154
  // Parses FBXTree.Connections which holds parent-child connections between objects (e.g. material -> texture, model->geometry )
155
155
  // and details the connection type
@@ -161,8 +161,8 @@ class xt {
161
161
  parents: [],
162
162
  children: []
163
163
  });
164
- const o = { ID: s, relationship: a };
165
- e.get(r).parents.push(o), e.has(s) || e.set(s, {
164
+ const i = { ID: s, relationship: a };
165
+ e.get(r).parents.push(i), e.has(s) || e.set(s, {
166
166
  parents: [],
167
167
  children: []
168
168
  });
@@ -180,8 +180,8 @@ class xt {
180
180
  for (const r in n) {
181
181
  const s = n[r], a = parseInt(r);
182
182
  if (e[a] = s.RelativeFilename || s.Filename, "Content" in s) {
183
- const o = s.Content instanceof ArrayBuffer && s.Content.byteLength > 0, l = typeof s.Content == "string" && s.Content !== "";
184
- if (o || l) {
183
+ const i = s.Content instanceof ArrayBuffer && s.Content.byteLength > 0, l = typeof s.Content == "string" && s.Content !== "";
184
+ if (i || l) {
185
185
  const p = this.parseImage(n[r]);
186
186
  t[s.RelativeFilename || s.Filename] = p;
187
187
  }
@@ -247,8 +247,8 @@ class xt {
247
247
  parseTexture(e, t) {
248
248
  const n = this.loadTexture(e, t);
249
249
  n.ID = e.id, n.name = e.attrName;
250
- const r = e.WrapModeU, s = e.WrapModeV, a = r !== void 0 ? r.value : 0, o = s !== void 0 ? s.value : 0;
251
- if (n.wrapS = a === 0 ? ue : pe, n.wrapT = o === 0 ? ue : pe, "Scaling" in e) {
250
+ const r = e.WrapModeU, s = e.WrapModeV, a = r !== void 0 ? r.value : 0, i = s !== void 0 ? s.value : 0;
251
+ if (n.wrapS = a === 0 ? pe : fe, n.wrapT = i === 0 ? pe : fe, "Scaling" in e) {
252
252
  const l = e.Scaling.value;
253
253
  n.repeat.x = l[0], n.repeat.y = l[1];
254
254
  }
@@ -265,11 +265,11 @@ class xt {
265
265
  r === null && (r = this.textureLoader);
266
266
  const s = r.path;
267
267
  s || r.setPath(this.textureLoader.path);
268
- const a = O.get(e.id).children;
269
- let o;
270
- 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)
268
+ const a = U.get(e.id).children;
269
+ let i;
270
+ if (a !== void 0 && a.length > 0 && t[a[0].ID] !== void 0 && (i = t[a[0].ID], (i.indexOf("blob:") === 0 || i.indexOf("data:") === 0) && r.setPath(void 0)), i === void 0)
271
271
  return console.warn("FBXLoader: Undefined filename, creating placeholder texture."), new Y();
272
- const l = r.load(o);
272
+ const l = r.load(i);
273
273
  return r.setPath(s), l;
274
274
  }
275
275
  // Parse nodes in FBXTree.Objects.Material
@@ -290,21 +290,21 @@ class xt {
290
290
  parseMaterial(e, t) {
291
291
  const n = e.id, r = e.attrName;
292
292
  let s = e.ShadingModel;
293
- if (typeof s == "object" && (s = s.value), !O.has(n)) return null;
293
+ if (typeof s == "object" && (s = s.value), !U.has(n)) return null;
294
294
  const a = this.parseParameters(e, t, n);
295
- let o;
295
+ let i;
296
296
  switch (s.toLowerCase()) {
297
297
  case "phong":
298
- o = new W();
298
+ i = new W();
299
299
  break;
300
300
  case "lambert":
301
- o = new Se();
301
+ i = new Fe();
302
302
  break;
303
303
  default:
304
- console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.', s), o = new W();
304
+ console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.', s), i = new W();
305
305
  break;
306
306
  }
307
- return o.setValues(a), o.name = r, o;
307
+ return i.setValues(a), i.name = r, i;
308
308
  }
309
309
  // Parse FBX material and return parameters suitable for a three.js material
310
310
  // Also parse the texture map and return any textures associated with the material
@@ -312,9 +312,9 @@ class xt {
312
312
  const r = {};
313
313
  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));
314
314
  const s = this;
315
- return O.get(n).children.forEach(function(a) {
316
- const o = a.relationship;
317
- switch (o) {
315
+ return U.get(n).children.forEach(function(a) {
316
+ const i = a.relationship;
317
+ switch (i) {
318
318
  case "Bump":
319
319
  r.bumpMap = s.getTexture(t, a.ID);
320
320
  break;
@@ -336,7 +336,7 @@ class xt {
336
336
  r.normalMap = s.getTexture(t, a.ID);
337
337
  break;
338
338
  case "ReflectionColor":
339
- r.envMap = s.getTexture(t, a.ID), r.envMap !== void 0 && (r.envMap.mapping = Ge, r.envMap.colorSpace = X);
339
+ r.envMap = s.getTexture(t, a.ID), r.envMap !== void 0 && (r.envMap.mapping = Ne, r.envMap.colorSpace = X);
340
340
  break;
341
341
  case "SpecularColor":
342
342
  r.specularMap = s.getTexture(t, a.ID), r.specularMap !== void 0 && (r.specularMap.colorSpace = X);
@@ -350,14 +350,14 @@ class xt {
350
350
  case "SpecularFactor":
351
351
  case "VectorDisplacementColor":
352
352
  default:
353
- console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.", o);
353
+ console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.", i);
354
354
  break;
355
355
  }
356
356
  }), r;
357
357
  }
358
358
  // get a texture from the textureMap for use by a material.
359
359
  getTexture(e, t) {
360
- 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);
360
+ 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 = U.get(t).children[0].ID), e.get(t);
361
361
  }
362
362
  // Parse nodes in FBXTree.Objects.Deformer
363
363
  // Deformer node can contain skinning or Vertex Cache animation data, however only skinning is supported here
@@ -367,15 +367,15 @@ class xt {
367
367
  if ("Deformer" in C.Objects) {
368
368
  const n = C.Objects.Deformer;
369
369
  for (const r in n) {
370
- const s = n[r], a = O.get(parseInt(r));
370
+ const s = n[r], a = U.get(parseInt(r));
371
371
  if (s.attrType === "Skin") {
372
- const o = this.parseSkeleton(a, n);
373
- 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;
372
+ const i = this.parseSkeleton(a, n);
373
+ i.ID = r, a.parents.length > 1 && console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."), i.geometryID = a.parents[0].ID, e[r] = i;
374
374
  } else if (s.attrType === "BlendShape") {
375
- const o = {
375
+ const i = {
376
376
  id: r
377
377
  };
378
- 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;
378
+ i.rawTargets = this.parseMorphTargets(a, n), i.id = r, a.parents.length > 1 && console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."), t[r] = i;
379
379
  }
380
380
  }
381
381
  }
@@ -410,46 +410,46 @@ class xt {
410
410
  parseMorphTargets(e, t) {
411
411
  const n = [];
412
412
  for (let r = 0; r < e.children.length; r++) {
413
- const s = e.children[r], a = t[s.ID], o = {
413
+ const s = e.children[r], a = t[s.ID], i = {
414
414
  name: a.attrName,
415
415
  initialWeight: a.DeformPercent,
416
416
  id: a.id,
417
417
  fullWeights: a.FullWeights.a
418
418
  };
419
419
  if (a.attrType !== "BlendShapeChannel") return;
420
- o.geoID = O.get(parseInt(s.ID)).children.filter(function(l) {
420
+ i.geoID = U.get(parseInt(s.ID)).children.filter(function(l) {
421
421
  return l.relationship === void 0;
422
- })[0].ID, n.push(o);
422
+ })[0].ID, n.push(i);
423
423
  }
424
424
  return n;
425
425
  }
426
426
  // create the main Group() to be returned by the loader
427
427
  parseScene(e, t, n) {
428
- U = new ce();
428
+ O = new ce();
429
429
  const r = this.parseModels(e.skeletons, t, n), s = C.Objects.Model, a = this;
430
430
  r.forEach(function(l) {
431
431
  const p = s[l.ID];
432
- a.setLookAtProperties(l, p), O.get(l.ID).parents.forEach(function(u) {
432
+ a.setLookAtProperties(l, p), U.get(l.ID).parents.forEach(function(u) {
433
433
  const c = r.get(u.ID);
434
434
  c !== void 0 && c.add(l);
435
- }), l.parent === null && U.add(l);
436
- }), this.bindSkeleton(e.skeletons, t, r), this.addGlobalSceneSettings(), U.traverse(function(l) {
435
+ }), l.parent === null && O.add(l);
436
+ }), this.bindSkeleton(e.skeletons, t, r), this.addGlobalSceneSettings(), O.traverse(function(l) {
437
437
  if (l.userData.transformData) {
438
438
  l.parent && (l.userData.transformData.parentMatrix = l.parent.matrix, l.userData.transformData.parentMatrixWorld = l.parent.matrixWorld);
439
- const p = Ce(l.userData.transformData);
439
+ const p = Le(l.userData.transformData);
440
440
  l.applyMatrix4(p), l.updateWorldMatrix();
441
441
  }
442
442
  });
443
- const o = new bt().parse();
444
- U.children.length === 1 && U.children[0].isGroup && (U.children[0].animations = o, U = U.children[0]), U.animations = o;
443
+ const i = new Mt().parse();
444
+ O.children.length === 1 && O.children[0].isGroup && (O.children[0].animations = i, O = O.children[0]), O.animations = i;
445
445
  }
446
446
  // parse nodes in FBXTree.Objects.Model
447
447
  parseModels(e, t, n) {
448
448
  const r = /* @__PURE__ */ new Map(), s = C.Objects.Model;
449
449
  for (const a in s) {
450
- const o = parseInt(a), l = s[a], p = O.get(o);
450
+ const i = parseInt(a), l = s[a], p = U.get(i);
451
451
  if (p === void 0) continue;
452
- let f = this.buildSkeleton(p, e, o, l.attrName);
452
+ let f = this.buildSkeleton(p, e, i, l.attrName);
453
453
  if (!f) {
454
454
  switch (l.attrType) {
455
455
  case "Camera":
@@ -466,28 +466,28 @@ class xt {
466
466
  break;
467
467
  case "LimbNode":
468
468
  case "Root":
469
- f = new fe();
469
+ f = new he();
470
470
  break;
471
471
  case "Null":
472
472
  default:
473
473
  f = new ce();
474
474
  break;
475
475
  }
476
- f.name = l.attrName ? ee.sanitizeNodeName(l.attrName) : "", f.userData.originalName = l.attrName, f.ID = o;
476
+ f.name = l.attrName ? ee.sanitizeNodeName(l.attrName) : "", f.userData.originalName = l.attrName, f.ID = i;
477
477
  }
478
- this.getTransformData(f, l), r.set(o, f);
478
+ this.getTransformData(f, l), r.set(i, f);
479
479
  }
480
480
  return r;
481
481
  }
482
482
  buildSkeleton(e, t, n, r) {
483
483
  let s = null;
484
484
  return e.parents.forEach(function(a) {
485
- for (const o in t) {
486
- const l = t[o];
485
+ for (const i in t) {
486
+ const l = t[i];
487
487
  l.rawBones.forEach(function(p, f) {
488
488
  if (p.ID === a.ID) {
489
489
  const u = s;
490
- 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);
490
+ s = new he(), 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);
491
491
  }
492
492
  });
493
493
  }
@@ -508,15 +508,15 @@ class xt {
508
508
  n.NearPlane !== void 0 && (s = n.NearPlane.value / 1e3);
509
509
  let a = 1e3;
510
510
  n.FarPlane !== void 0 && (a = n.FarPlane.value / 1e3);
511
- let o = window.innerWidth, l = window.innerHeight;
512
- n.AspectWidth !== void 0 && n.AspectHeight !== void 0 && (o = n.AspectWidth.value, l = n.AspectHeight.value);
513
- const p = o / l;
511
+ let i = window.innerWidth, l = window.innerHeight;
512
+ n.AspectWidth !== void 0 && n.AspectHeight !== void 0 && (i = n.AspectWidth.value, l = n.AspectHeight.value);
513
+ const p = i / l;
514
514
  let f = 45;
515
515
  n.FieldOfView !== void 0 && (f = n.FieldOfView.value);
516
516
  const u = n.FocalLength ? n.FocalLength.value : null;
517
517
  switch (r) {
518
518
  case 0:
519
- t = new Ne(f, p, s, a), u !== null && t.setFocalLength(u);
519
+ t = new $e(f, p, s, a), u !== null && t.setFocalLength(u);
520
520
  break;
521
521
  case 1:
522
522
  console.warn("THREE.FBXLoader: Orthographic cameras not supported yet."), t = new Z();
@@ -543,24 +543,24 @@ class xt {
543
543
  n.Color !== void 0 && (s = N.colorSpaceToWorking(new k().fromArray(n.Color.value), X));
544
544
  let a = n.Intensity === void 0 ? 1 : n.Intensity.value / 100;
545
545
  n.CastLightOnObject !== void 0 && n.CastLightOnObject.value === 0 && (a = 0);
546
- let o = 0;
547
- n.FarAttenuationEnd !== void 0 && (n.EnableFarAttenuation !== void 0 && n.EnableFarAttenuation.value === 0 ? o = 0 : o = n.FarAttenuationEnd.value);
546
+ let i = 0;
547
+ n.FarAttenuationEnd !== void 0 && (n.EnableFarAttenuation !== void 0 && n.EnableFarAttenuation.value === 0 ? i = 0 : i = n.FarAttenuationEnd.value);
548
548
  const l = 1;
549
549
  switch (r) {
550
550
  case 0:
551
- t = new he(s, a, o, l);
551
+ t = new de(s, a, i, l);
552
552
  break;
553
553
  case 1:
554
- t = new ze(s, a);
554
+ t = new je(s, a);
555
555
  break;
556
556
  case 2:
557
557
  let p = Math.PI / 3;
558
558
  n.InnerAngle !== void 0 && (p = B.degToRad(n.InnerAngle.value));
559
559
  let f = 0;
560
- n.OuterAngle !== void 0 && (f = B.degToRad(n.OuterAngle.value), f = Math.max(f, 1)), t = new $e(s, a, o, p, f, l);
560
+ n.OuterAngle !== void 0 && (f = B.degToRad(n.OuterAngle.value), f = Math.max(f, 1)), t = new ze(s, a, i, p, f, l);
561
561
  break;
562
562
  default:
563
- console.warn("THREE.FBXLoader: Unknown light type " + n.LightType.value + ", defaulting to a PointLight."), t = new he(s, a);
563
+ console.warn("THREE.FBXLoader: Unknown light type " + n.LightType.value + ", defaulting to a PointLight."), t = new de(s, a);
564
564
  break;
565
565
  }
566
566
  n.CastShadows !== void 0 && n.CastShadows.value === 1 && (t.castShadow = !0);
@@ -569,36 +569,36 @@ class xt {
569
569
  }
570
570
  createMesh(e, t, n) {
571
571
  let r, s = null, a = null;
572
- const o = [];
572
+ const i = [];
573
573
  if (e.children.forEach(function(l) {
574
- t.has(l.ID) && (s = t.get(l.ID)), n.has(l.ID) && o.push(n.get(l.ID));
575
- }), o.length > 1 ? a = o : o.length > 0 ? a = o[0] : (a = new W({
574
+ t.has(l.ID) && (s = t.get(l.ID)), n.has(l.ID) && i.push(n.get(l.ID));
575
+ }), i.length > 1 ? a = i : i.length > 0 ? a = i[0] : (a = new W({
576
576
  name: J.DEFAULT_MATERIAL_NAME,
577
577
  color: 13421772
578
- }), o.push(a)), "color" in s.attributes && o.forEach(function(l) {
578
+ }), i.push(a)), "color" in s.attributes && i.forEach(function(l) {
579
579
  l.vertexColors = !0;
580
580
  }), s.groups.length > 0) {
581
581
  let l = !1;
582
582
  for (let p = 0, f = s.groups.length; p < f; p++) {
583
583
  const u = s.groups[p];
584
- (u.materialIndex < 0 || u.materialIndex >= o.length) && (u.materialIndex = o.length, l = !0);
584
+ (u.materialIndex < 0 || u.materialIndex >= i.length) && (u.materialIndex = i.length, l = !0);
585
585
  }
586
586
  if (l) {
587
587
  const p = new W();
588
- o.push(p);
588
+ i.push(p);
589
589
  }
590
590
  }
591
- return s.FBX_Deformer ? (r = new je(s, a), r.normalizeSkinWeights()) : r = new Fe(s, a), r;
591
+ return s.FBX_Deformer ? (r = new He(s, a), r.normalizeSkinWeights()) : r = new Ae(s, a), r;
592
592
  }
593
593
  createCurve(e, t) {
594
594
  const n = e.children.reduce(function(s, a) {
595
595
  return t.has(a.ID) && (s = t.get(a.ID)), s;
596
- }, null), r = new He({
596
+ }, null), r = new We({
597
597
  name: J.DEFAULT_MATERIAL_NAME,
598
598
  color: 3342591,
599
599
  linewidth: 1
600
600
  });
601
- return new We(n, r);
601
+ return new Ye(n, r);
602
602
  }
603
603
  // parse the model node for transform data
604
604
  getTransformData(e, t) {
@@ -606,12 +606,12 @@ class xt {
606
606
  "InheritType" in t && (n.inheritType = parseInt(t.InheritType.value)), "RotationOrder" in t ? n.eulerOrder = q(t.RotationOrder.value) : n.eulerOrder = q(0), "Lcl_Translation" in t && (n.translation = t.Lcl_Translation.value), "PreRotation" in t && (n.preRotation = t.PreRotation.value), "Lcl_Rotation" in t && (n.rotation = t.Lcl_Rotation.value), "PostRotation" in t && (n.postRotation = t.PostRotation.value), "Lcl_Scaling" in t && (n.scale = t.Lcl_Scaling.value), "ScalingOffset" in t && (n.scalingOffset = t.ScalingOffset.value), "ScalingPivot" in t && (n.scalingPivot = t.ScalingPivot.value), "RotationOffset" in t && (n.rotationOffset = t.RotationOffset.value), "RotationPivot" in t && (n.rotationPivot = t.RotationPivot.value), e.userData.transformData = n;
607
607
  }
608
608
  setLookAtProperties(e, t) {
609
- "LookAtProperty" in t && O.get(e.ID).children.forEach(function(r) {
609
+ "LookAtProperty" in t && U.get(e.ID).children.forEach(function(r) {
610
610
  if (r.relationship === "LookAtProperty") {
611
611
  const s = C.Objects.Model[r.ID];
612
612
  if ("Lcl_Translation" in s) {
613
613
  const a = s.Lcl_Translation.value;
614
- e.target !== void 0 ? (e.target.position.fromArray(a), U.add(e.target)) : e.lookAt(new V().fromArray(a));
614
+ e.target !== void 0 ? (e.target.position.fromArray(a), O.add(e.target)) : e.lookAt(new V().fromArray(a));
615
615
  }
616
616
  }
617
617
  });
@@ -620,11 +620,11 @@ class xt {
620
620
  const r = this.parsePoseNodes();
621
621
  for (const s in e) {
622
622
  const a = e[s];
623
- O.get(parseInt(a.ID)).parents.forEach(function(l) {
623
+ U.get(parseInt(a.ID)).parents.forEach(function(l) {
624
624
  if (t.has(l.ID)) {
625
625
  const p = l.ID;
626
- O.get(p).parents.forEach(function(u) {
627
- n.has(u.ID) && n.get(u.ID).bind(new Ye(a.bones), r[u.ID]);
626
+ U.get(p).parents.forEach(function(u) {
627
+ n.has(u.ID) && n.get(u.ID).bind(new qe(a.bones), r[u.ID]);
628
628
  });
629
629
  }
630
630
  });
@@ -650,14 +650,14 @@ class xt {
650
650
  const e = C.GlobalSettings.AmbientColor.value, t = e[0], n = e[1], r = e[2];
651
651
  if (t !== 0 || n !== 0 || r !== 0) {
652
652
  const s = new k().setRGB(t, n, r, X);
653
- U.add(new qe(s, 1));
653
+ O.add(new Ke(s, 1));
654
654
  }
655
655
  }
656
- "UnitScaleFactor" in C.GlobalSettings && (U.userData.unitScaleFactor = C.GlobalSettings.UnitScaleFactor.value);
656
+ "UnitScaleFactor" in C.GlobalSettings && (O.userData.unitScaleFactor = C.GlobalSettings.UnitScaleFactor.value);
657
657
  }
658
658
  }
659
659
  }
660
- class Et {
660
+ class bt {
661
661
  constructor() {
662
662
  this.negativeMaterialIndices = !1;
663
663
  }
@@ -667,7 +667,7 @@ class Et {
667
667
  if ("Geometry" in C.Objects) {
668
668
  const n = C.Objects.Geometry;
669
669
  for (const r in n) {
670
- const s = O.get(parseInt(r)), a = this.parseGeometry(s, n[r], e);
670
+ const s = U.get(parseInt(r)), a = this.parseGeometry(s, n[r], e);
671
671
  t.set(parseInt(r), a);
672
672
  }
673
673
  }
@@ -688,7 +688,7 @@ class Et {
688
688
  return C.Objects.Model[u.ID];
689
689
  });
690
690
  if (a.length === 0) return;
691
- const o = e.children.reduce(function(u, c) {
691
+ const i = e.children.reduce(function(u, c) {
692
692
  return r[c.ID] !== void 0 && (u = r[c.ID]), u;
693
693
  }, null);
694
694
  e.children.forEach(function(u) {
@@ -696,30 +696,30 @@ class Et {
696
696
  });
697
697
  const l = a[0], p = {};
698
698
  "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);
699
- const f = Ce(p);
700
- return this.genGeometry(t, o, s, f);
699
+ const f = Le(p);
700
+ return this.genGeometry(t, i, s, f);
701
701
  }
702
702
  // Generate a BufferGeometry from a node in FBXTree.Objects.Geometry
703
703
  genGeometry(e, t, n, r) {
704
704
  const s = new re();
705
705
  e.attrName && (s.name = e.attrName);
706
- const a = this.parseGeoNode(e, t), o = this.genBuffers(a), l = new j(o.vertex, 3);
707
- 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) {
708
- const p = new Ze().getNormalMatrix(r), f = new j(o.normal, 3);
706
+ const a = this.parseGeoNode(e, t), i = this.genBuffers(a), l = new j(i.vertex, 3);
707
+ if (l.applyMatrix4(r), s.setAttribute("position", l), i.colors.length > 0 && s.setAttribute("color", new j(i.colors, 3)), t && (s.setAttribute("skinIndex", new Ze(i.weightsIndices, 4)), s.setAttribute("skinWeight", new j(i.vertexWeights, 4)), s.FBX_Deformer = t), i.normal.length > 0) {
708
+ const p = new Qe().getNormalMatrix(r), f = new j(i.normal, 3);
709
709
  f.applyNormalMatrix(p), s.setAttribute("normal", f);
710
710
  }
711
- if (o.uvs.forEach(function(p, f) {
711
+ if (i.uvs.forEach(function(p, f) {
712
712
  const u = f === 0 ? "uv" : `uv${f}`;
713
- s.setAttribute(u, new j(o.uvs[f], 2));
713
+ s.setAttribute(u, new j(i.uvs[f], 2));
714
714
  }), a.material && a.material.mappingType !== "AllSame") {
715
- let p = o.materialIndex[0], f = 0;
716
- if (o.materialIndex.forEach(function(u, c) {
715
+ let p = i.materialIndex[0], f = 0;
716
+ if (i.materialIndex.forEach(function(u, c) {
717
717
  u !== p && (s.addGroup(f, c - f, p), p = u, f = c);
718
718
  }), s.groups.length > 0) {
719
719
  const u = s.groups[s.groups.length - 1], c = u.start + u.count;
720
- c !== o.materialIndex.length && s.addGroup(c, o.materialIndex.length - c, p);
720
+ c !== i.materialIndex.length && s.addGroup(c, i.materialIndex.length - c, p);
721
721
  }
722
- s.groups.length === 0 && s.addGroup(0, o.materialIndex.length, o.materialIndex[0]);
722
+ s.groups.length === 0 && s.addGroup(0, i.materialIndex.length, i.materialIndex[0]);
723
723
  }
724
724
  return this.addMorphTargets(s, e, n, r), s;
725
725
  }
@@ -732,10 +732,10 @@ class Et {
732
732
  e.LayerElementUV[r].UV && n.uv.push(this.parseUVs(e.LayerElementUV[r])), r++;
733
733
  }
734
734
  return n.weightTable = {}, t !== null && (n.skeleton = t, t.rawBones.forEach(function(r, s) {
735
- r.indices.forEach(function(a, o) {
735
+ r.indices.forEach(function(a, i) {
736
736
  n.weightTable[a] === void 0 && (n.weightTable[a] = []), n.weightTable[a].push({
737
737
  id: s,
738
- weight: r.weights[o]
738
+ weight: r.weights[i]
739
739
  });
740
740
  });
741
741
  })), n;
@@ -750,7 +750,7 @@ class Et {
750
750
  vertexWeights: [],
751
751
  weightsIndices: []
752
752
  };
753
- let n = 0, r = 0, s = !1, a = [], o = [], l = [], p = [], f = [], u = [];
753
+ let n = 0, r = 0, s = !1, a = [], i = [], l = [], p = [], f = [], u = [];
754
754
  const c = this;
755
755
  return e.vertexIndices.forEach(function(h, m) {
756
756
  let g, d = !1;
@@ -766,11 +766,11 @@ class Et {
766
766
  }), F.length > 4) {
767
767
  s || (console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."), s = !0);
768
768
  const y = [0, 0, 0, 0], x = [0, 0, 0, 0];
769
- F.forEach(function(I, A) {
770
- let M = I, v = T[A];
771
- x.forEach(function(S, E, b) {
772
- if (M > S) {
773
- b[E] = M, M = S;
769
+ F.forEach(function(A, I) {
770
+ let b = A, v = T[I];
771
+ x.forEach(function(S, E, M) {
772
+ if (b > S) {
773
+ M[E] = b, b = S;
774
774
  const R = y[E];
775
775
  y[E] = v, v = R;
776
776
  }
@@ -784,12 +784,12 @@ class Et {
784
784
  }
785
785
  if (e.normal) {
786
786
  const y = Q(m, n, h, e.normal);
787
- o.push(y[0], y[1], y[2]);
787
+ i.push(y[0], y[1], y[2]);
788
788
  }
789
789
  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) {
790
- const I = Q(m, n, h, y);
791
- p[x] === void 0 && (p[x] = []), p[x].push(I[0]), p[x].push(I[1]);
792
- }), r++, d && (c.genFace(t, e, a, g, o, l, p, f, u, r), n++, r = 0, a = [], o = [], l = [], p = [], f = [], u = []);
790
+ const A = Q(m, n, h, y);
791
+ p[x] === void 0 && (p[x] = []), p[x].push(A[0]), p[x].push(A[1]);
792
+ }), r++, d && (c.genFace(t, e, a, g, i, l, p, f, u, r), n++, r = 0, a = [], i = [], l = [], p = [], f = [], u = []);
793
793
  }), t;
794
794
  }
795
795
  // See https://www.khronos.org/opengl/wiki/Calculating_a_Surface_Normal
@@ -810,13 +810,13 @@ class Et {
810
810
  };
811
811
  }
812
812
  flattenVertex(e, t, n) {
813
- return new Qe(
813
+ return new Je(
814
814
  e.dot(t),
815
815
  e.dot(n)
816
816
  );
817
817
  }
818
818
  // Generate data for a single face in a geometry. If the face is a quad then split it into 2 tris
819
- genFace(e, t, n, r, s, a, o, l, p, f) {
819
+ genFace(e, t, n, r, s, a, i, l, p, f) {
820
820
  let u;
821
821
  if (f > 3) {
822
822
  const c = [], h = t.baseVertexPositions || t.vertexPositions;
@@ -831,12 +831,12 @@ class Et {
831
831
  const { tangent: m, bitangent: g } = this.getNormalTangentAndBitangent(c), d = [];
832
832
  for (const T of c)
833
833
  d.push(this.flattenVertex(T, m, g));
834
- u = Je.triangulateShape(d, []);
834
+ u = et.triangulateShape(d, []);
835
835
  } else
836
836
  u = [[0, 1, 2]];
837
837
  for (const [c, h, m] of u)
838
838
  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) {
839
- 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]);
839
+ e.uvs[d] === void 0 && (e.uvs[d] = []), e.uvs[d].push(i[d][c * 2]), e.uvs[d].push(i[d][c * 2 + 1]), e.uvs[d].push(i[d][h * 2]), e.uvs[d].push(i[d][h * 2 + 1]), e.uvs[d].push(i[d][m * 2]), e.uvs[d].push(i[d][m * 2 + 1]);
840
840
  });
841
841
  }
842
842
  addMorphTargets(e, t, n, r) {
@@ -844,9 +844,9 @@ class Et {
844
844
  e.morphTargetsRelative = !0, e.morphAttributes.position = [];
845
845
  const s = this;
846
846
  n.forEach(function(a) {
847
- a.rawTargets.forEach(function(o) {
848
- const l = C.Objects.Geometry[o.geoID];
849
- l !== void 0 && s.genMorphGeometry(e, t, l, r, o.name);
847
+ a.rawTargets.forEach(function(i) {
848
+ const l = C.Objects.Geometry[i.geoID];
849
+ l !== void 0 && s.genMorphGeometry(e, t, l, r, i.name);
850
850
  });
851
851
  });
852
852
  }
@@ -855,13 +855,13 @@ class Et {
855
855
  // and a special attribute Index defining which vertices of the original geometry are affected
856
856
  // Normal and position attributes only have data for the vertices that are affected by the morph
857
857
  genMorphGeometry(e, t, n, r, s) {
858
- 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);
858
+ const a = t.Vertices !== void 0 ? t.Vertices.a : [], i = 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
859
  for (let g = 0; g < p.length; g++) {
860
860
  const d = p[g] * 3;
861
861
  u[d] = l[g * 3], u[d + 1] = l[g * 3 + 1], u[d + 2] = l[g * 3 + 2];
862
862
  }
863
863
  const c = {
864
- vertexIndices: o,
864
+ vertexIndices: i,
865
865
  vertexPositions: u,
866
866
  baseVertexPositions: a
867
867
  }, h = this.genBuffers(c), m = new j(h.vertex, 3);
@@ -896,8 +896,8 @@ class Et {
896
896
  const t = e.MappingInformationType, n = e.ReferenceInformationType, r = e.Colors.a;
897
897
  let s = [];
898
898
  n === "IndexToDirect" && (s = e.ColorIndex.a);
899
- for (let a = 0, o = new k(); a < r.length; a += 4)
900
- o.fromArray(r, a), N.colorSpaceToWorking(o, X), o.toArray(r, a);
899
+ for (let a = 0, i = new k(); a < r.length; a += 4)
900
+ i.fromArray(r, a), N.colorSpaceToWorking(i, X), i.toArray(r, a);
901
901
  return {
902
902
  dataSize: 4,
903
903
  buffer: r,
@@ -935,20 +935,20 @@ class Et {
935
935
  return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s", e.Order, e.id), new re();
936
936
  const n = t - 1, r = e.KnotVector.a, s = [], a = e.Points.a;
937
937
  for (let u = 0, c = a.length; u < c; u += 4)
938
- s.push(new et().fromArray(a, u));
939
- let o, l;
938
+ s.push(new tt().fromArray(a, u));
939
+ let i, l;
940
940
  if (e.Form === "Closed")
941
941
  s.push(s[0]);
942
942
  else if (e.Form === "Periodic") {
943
- o = n, l = r.length - 1 - o;
943
+ i = n, l = r.length - 1 - i;
944
944
  for (let u = 0; u < n; ++u)
945
945
  s.push(s[u]);
946
946
  }
947
- const f = new dt(n, r, s, o, l).getPoints(s.length * 12);
947
+ const f = new mt(n, r, s, i, l).getPoints(s.length * 12);
948
948
  return new re().setFromPoints(f);
949
949
  }
950
950
  }
951
- class bt {
951
+ class Mt {
952
952
  // take raw animation clips and turn them into three.js animation clips
953
953
  parse() {
954
954
  const e = [], t = this.parseClips();
@@ -992,12 +992,12 @@ class bt {
992
992
  for (const n in t) {
993
993
  const r = {
994
994
  id: t[n].id,
995
- times: t[n].KeyTime.a.map(At),
995
+ times: t[n].KeyTime.a.map(Rt),
996
996
  values: t[n].KeyValueFloat.a
997
- }, s = O.get(r.id);
997
+ }, s = U.get(r.id);
998
998
  if (s !== void 0) {
999
- const a = s.parents[0].ID, o = s.parents[0].relationship;
1000
- 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);
999
+ const a = s.parents[0].ID, i = s.parents[0].relationship;
1000
+ i.match(/X/) ? e.get(a).curves.x = r : i.match(/Y/) ? e.get(a).curves.y = r : i.match(/Z/) ? e.get(a).curves.z = r : i.match(/DeformPercent/) && e.has(a) && (e.get(a).curves.morph = r);
1001
1001
  }
1002
1002
  }
1003
1003
  }
@@ -1007,13 +1007,13 @@ class bt {
1007
1007
  parseAnimationLayers(e) {
1008
1008
  const t = C.Objects.AnimationLayer, n = /* @__PURE__ */ new Map();
1009
1009
  for (const r in t) {
1010
- const s = [], a = O.get(parseInt(r));
1010
+ const s = [], a = U.get(parseInt(r));
1011
1011
  a !== void 0 && (a.children.forEach(function(l, p) {
1012
1012
  if (e.has(l.ID)) {
1013
1013
  const f = e.get(l.ID);
1014
1014
  if (f.curves.x !== void 0 || f.curves.y !== void 0 || f.curves.z !== void 0) {
1015
1015
  if (s[p] === void 0) {
1016
- const u = O.get(l.ID).parents.filter(function(c) {
1016
+ const u = U.get(l.ID).parents.filter(function(c) {
1017
1017
  return c.relationship !== void 0;
1018
1018
  })[0].ID;
1019
1019
  if (u !== void 0) {
@@ -1029,7 +1029,7 @@ class bt {
1029
1029
  initialRotation: [0, 0, 0],
1030
1030
  initialScale: [1, 1, 1]
1031
1031
  };
1032
- U.traverse(function(m) {
1032
+ O.traverse(function(m) {
1033
1033
  m.ID === c.id && (h.transform = m.matrix, m.userData.transformData && (h.eulerOrder = m.userData.transformData.eulerOrder));
1034
1034
  }), 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;
1035
1035
  }
@@ -1037,9 +1037,9 @@ class bt {
1037
1037
  s[p] && (s[p][f.attr] = f);
1038
1038
  } else if (f.curves.morph !== void 0) {
1039
1039
  if (s[p] === void 0) {
1040
- const u = O.get(l.ID).parents.filter(function(T) {
1040
+ const u = U.get(l.ID).parents.filter(function(T) {
1041
1041
  return T.relationship !== void 0;
1042
- })[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 = {
1042
+ })[0].ID, c = U.get(u).parents[0].ID, h = U.get(c).parents[0].ID, m = U.get(h).parents[0].ID, g = C.Objects.Model[m], d = {
1043
1043
  modelName: g.attrName ? ee.sanitizeNodeName(g.attrName) : "",
1044
1044
  morphName: C.Objects.Deformer[u].attrName
1045
1045
  };
@@ -1057,7 +1057,7 @@ class bt {
1057
1057
  parseAnimStacks(e) {
1058
1058
  const t = C.Objects.AnimationStack, n = {};
1059
1059
  for (const r in t) {
1060
- const s = O.get(parseInt(r)).children;
1060
+ const s = U.get(parseInt(r)).children;
1061
1061
  s.length > 1 && console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");
1062
1062
  const a = e.get(s[0].ID);
1063
1063
  n[r] = {
@@ -1072,7 +1072,7 @@ class bt {
1072
1072
  const n = this;
1073
1073
  return e.layer.forEach(function(r) {
1074
1074
  t = t.concat(n.generateTracks(r));
1075
- }), new tt(e.name, -1, t);
1075
+ }), new nt(e.name, -1, t);
1076
1076
  }
1077
1077
  generateTracks(e) {
1078
1078
  const t = [];
@@ -1097,30 +1097,30 @@ class bt {
1097
1097
  }
1098
1098
  generateVectorTrack(e, t, n, r) {
1099
1099
  const s = this.getTimesForAllAxes(t), a = this.getKeyframeTrackValues(s, t, n);
1100
- return new nt(e + "." + r, s, a);
1100
+ return new rt(e + "." + r, s, a);
1101
1101
  }
1102
1102
  generateRotationTrack(e, t, n, r, s) {
1103
- let a, o;
1103
+ let a, i;
1104
1104
  if (t.x !== void 0 && t.y !== void 0 && t.z !== void 0) {
1105
1105
  const c = this.interpolateRotations(t.x, t.y, t.z, s);
1106
- a = c[0], o = c[1];
1106
+ a = c[0], i = c[1];
1107
1107
  }
1108
1108
  const l = q(0);
1109
1109
  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());
1110
1110
  const p = new G(), f = new z(), u = [];
1111
- if (!o || !a) return new de(e + ".quaternion", [0], [0]);
1112
- for (let c = 0; c < o.length; c += 3)
1113
- 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(
1111
+ if (!i || !a) return new me(e + ".quaternion", [0], [0]);
1112
+ for (let c = 0; c < i.length; c += 3)
1113
+ f.set(i[c], i[c + 1], i[c + 2], s), p.setFromEuler(f), n !== void 0 && p.premultiply(n), r !== void 0 && p.multiply(r), c > 2 && new G().fromArray(
1114
1114
  u,
1115
1115
  (c - 3) / 3 * 4
1116
1116
  ).dot(p) < 0 && p.set(-p.x, -p.y, -p.z, -p.w), p.toArray(u, c / 3 * 4);
1117
- return new de(e + ".quaternion", a, u);
1117
+ return new me(e + ".quaternion", a, u);
1118
1118
  }
1119
1119
  generateMorphTrack(e) {
1120
1120
  const t = e.DeformPercent.curves.morph, n = t.values.map(function(s) {
1121
1121
  return s / 100;
1122
- }), r = U.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];
1123
- return new rt(e.modelName + ".morphTargetInfluences[" + r + "]", t.times, n);
1122
+ }), r = O.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];
1123
+ return new st(e.modelName + ".morphTargetInfluences[" + r + "]", t.times, n);
1124
1124
  }
1125
1125
  // For all animated objects, times are defined separately for each axis
1126
1126
  // Here we'll combine the times into one sorted array without duplicates
@@ -1140,15 +1140,15 @@ class bt {
1140
1140
  }
1141
1141
  getKeyframeTrackValues(e, t, n) {
1142
1142
  const r = n, s = [];
1143
- let a = -1, o = -1, l = -1;
1143
+ let a = -1, i = -1, l = -1;
1144
1144
  return e.forEach(function(p) {
1145
- 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) {
1145
+ if (t.x && (a = t.x.times.indexOf(p)), t.y && (i = t.y.times.indexOf(p)), t.z && (l = t.z.times.indexOf(p)), a !== -1) {
1146
1146
  const f = t.x.values[a];
1147
1147
  s.push(f), r[0] = f;
1148
1148
  } else
1149
1149
  s.push(r[0]);
1150
- if (o !== -1) {
1151
- const f = t.y.values[o];
1150
+ if (i !== -1) {
1151
+ const f = t.y.values[i];
1152
1152
  s.push(f), r[1] = f;
1153
1153
  } else
1154
1154
  s.push(r[1]);
@@ -1165,18 +1165,18 @@ class bt {
1165
1165
  interpolateRotations(e, t, n, r) {
1166
1166
  const s = [], a = [];
1167
1167
  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]));
1168
- for (let o = 1; o < e.values.length; o++) {
1168
+ for (let i = 1; i < e.values.length; i++) {
1169
1169
  const l = [
1170
- e.values[o - 1],
1171
- t.values[o - 1],
1172
- n.values[o - 1]
1170
+ e.values[i - 1],
1171
+ t.values[i - 1],
1172
+ n.values[i - 1]
1173
1173
  ];
1174
1174
  if (isNaN(l[0]) || isNaN(l[1]) || isNaN(l[2]))
1175
1175
  continue;
1176
1176
  const p = l.map(B.degToRad), f = [
1177
- e.values[o],
1178
- t.values[o],
1179
- n.values[o]
1177
+ e.values[i],
1178
+ t.values[i],
1179
+ n.values[i]
1180
1180
  ];
1181
1181
  if (isNaN(f[0]) || isNaN(f[1]) || isNaN(f[2]))
1182
1182
  continue;
@@ -1192,16 +1192,16 @@ class bt {
1192
1192
  if (h[0] >= 180 || h[1] >= 180 || h[2] >= 180) {
1193
1193
  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);
1194
1194
  F.dot(y) && y.set(-y.x, -y.y, -y.z, -y.w);
1195
- const x = e.times[o - 1], I = e.times[o] - x, A = new G(), M = new z();
1195
+ const x = e.times[i - 1], A = e.times[i] - x, I = new G(), b = new z();
1196
1196
  for (let v = 0; v < 1; v += 1 / g)
1197
- 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);
1197
+ I.copy(F.clone().slerp(y.clone(), v)), s.push(x + v * A), b.setFromQuaternion(I, r), a.push(b.x), a.push(b.y), a.push(b.z);
1198
1198
  } else
1199
- 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]));
1199
+ s.push(e.times[i]), a.push(B.degToRad(e.values[i])), a.push(B.degToRad(t.values[i])), a.push(B.degToRad(n.values[i]));
1200
1200
  }
1201
1201
  return [s, a];
1202
1202
  }
1203
1203
  }
1204
- class Mt {
1204
+ class St {
1205
1205
  getPrevNode() {
1206
1206
  return this.nodeStack[this.currentIndent - 2];
1207
1207
  }
@@ -1221,11 +1221,11 @@ class Mt {
1221
1221
  this.currentProp = e, this.currentPropName = t;
1222
1222
  }
1223
1223
  parse(e) {
1224
- this.currentIndent = 0, this.allNodes = new Pe(), this.nodeStack = [], this.currentProp = [], this.currentPropName = "";
1224
+ this.currentIndent = 0, this.allNodes = new Ce(), this.nodeStack = [], this.currentProp = [], this.currentPropName = "";
1225
1225
  const t = this, n = e.split(/[\r\n]+/);
1226
1226
  return n.forEach(function(r, s) {
1227
- const a = r.match(/^[\s\t]*;/), o = r.match(/^[\s\t]*$/);
1228
- if (a || o) return;
1227
+ const a = r.match(/^[\s\t]*;/), i = r.match(/^[\s\t]*$/);
1228
+ if (a || i) return;
1229
1229
  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) + "}}");
1230
1230
  l ? t.parseNodeBegin(r, l) : p ? t.parseNodeProperty(r, p, n[++s]) : f ? t.popStack() : r.match(/^[^\s\t}]/) && t.parseNodePropertyContinued(r);
1231
1231
  }), this.allNodes;
@@ -1233,8 +1233,8 @@ class Mt {
1233
1233
  parseNodeBegin(e, t) {
1234
1234
  const n = t[1].trim().replace(/^"/, "").replace(/"$/, ""), r = t[2].split(",").map(function(l) {
1235
1235
  return l.trim().replace(/^"/, "").replace(/"$/, "");
1236
- }), s = { name: n }, a = this.parseNodeAttr(r), o = this.getCurrentNode();
1237
- 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);
1236
+ }), s = { name: n }, a = this.parseNodeAttr(r), i = this.getCurrentNode();
1237
+ this.currentIndent === 0 ? this.allNodes.add(n, s) : n in i ? (n === "PoseNode" ? i.PoseNode.push(s) : i[n].id !== void 0 && (i[n] = {}, i[n][i[n].id] = i[n]), a.id !== "" && (i[n][a.id] = s)) : typeof a.id == "number" ? (i[n] = {}, i[n][a.id] = s) : n !== "Properties70" && (n === "PoseNode" ? i[n] = [s] : i[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);
1238
1238
  }
1239
1239
  parseNodeAttr(e) {
1240
1240
  let t = e[0];
@@ -1255,7 +1255,7 @@ class Mt {
1255
1255
  let u = s.split(",").slice(3);
1256
1256
  u = u.map(function(c) {
1257
1257
  return c.trim().replace(/^"/, "");
1258
- }), r = "connections", s = [p, f], Dt(s, u), a[r] === void 0 && (a[r] = []);
1258
+ }), r = "connections", s = [p, f], Pt(s, u), a[r] === void 0 && (a[r] = []);
1259
1259
  }
1260
1260
  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));
1261
1261
  }
@@ -1267,7 +1267,7 @@ class Mt {
1267
1267
  parseNodeSpecialProperty(e, t, n) {
1268
1268
  const r = n.split('",').map(function(f) {
1269
1269
  return f.trim().replace(/^\"/, "").replace(/\s/, "_");
1270
- }), s = r[0], a = r[1], o = r[2], l = r[3];
1270
+ }), s = r[0], a = r[1], i = r[2], l = r[3];
1271
1271
  let p = r[4];
1272
1272
  switch (a) {
1273
1273
  case "int":
@@ -1290,20 +1290,20 @@ class Mt {
1290
1290
  }
1291
1291
  this.getPrevNode()[s] = {
1292
1292
  type: a,
1293
- type2: o,
1293
+ type2: i,
1294
1294
  flag: l,
1295
1295
  value: p
1296
1296
  }, this.setCurrentProp(this.getPrevNode(), s);
1297
1297
  }
1298
1298
  }
1299
- class St {
1299
+ class Ft {
1300
1300
  parse(e) {
1301
- const t = new Te(e);
1301
+ const t = new xe(e);
1302
1302
  t.skip(23);
1303
1303
  const n = t.getUint32();
1304
1304
  if (n < 6400)
1305
1305
  throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: " + n);
1306
- const r = new Pe();
1306
+ const r = new Ce();
1307
1307
  for (; !this.endOfContent(t); ) {
1308
1308
  const s = this.parseNode(t, n);
1309
1309
  s !== null && r.add(s.name, s);
@@ -1318,7 +1318,7 @@ class St {
1318
1318
  parseNode(e, t) {
1319
1319
  const n = {}, r = t >= 7500 ? e.getUint64() : e.getUint32(), s = t >= 7500 ? e.getUint64() : e.getUint32();
1320
1320
  t >= 7500 ? e.getUint64() : e.getUint32();
1321
- const a = e.getUint8(), o = e.getString(a);
1321
+ const a = e.getUint8(), i = e.getString(a);
1322
1322
  if (r === 0) return null;
1323
1323
  const l = [];
1324
1324
  for (let c = 0; c < s; c++)
@@ -1326,9 +1326,9 @@ class St {
1326
1326
  const p = l.length > 0 ? l[0] : "", f = l.length > 1 ? l[1] : "", u = l.length > 2 ? l[2] : "";
1327
1327
  for (n.singleProperty = s === 1 && e.getOffset() === r; r > e.getOffset(); ) {
1328
1328
  const c = this.parseNode(e, t);
1329
- c !== null && this.parseSubNode(o, n, c);
1329
+ c !== null && this.parseSubNode(i, n, c);
1330
1330
  }
1331
- return n.propertyList = l, typeof p == "number" && (n.id = p), f !== "" && (n.attrName = f), u !== "" && (n.attrType = u), o !== "" && (n.name = o), n;
1331
+ return n.propertyList = l, typeof p == "number" && (n.id = p), f !== "" && (n.attrName = f), u !== "" && (n.attrType = u), i !== "" && (n.name = i), n;
1332
1332
  }
1333
1333
  parseSubNode(e, t, n) {
1334
1334
  if (n.singleProperty === !0) {
@@ -1345,7 +1345,7 @@ class St {
1345
1345
  });
1346
1346
  else if (e === "Properties70" && n.name === "P") {
1347
1347
  let r = n.propertyList[0], s = n.propertyList[1];
1348
- const a = n.propertyList[2], o = n.propertyList[3];
1348
+ const a = n.propertyList[2], i = n.propertyList[3];
1349
1349
  let l;
1350
1350
  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 = [
1351
1351
  n.propertyList[4],
@@ -1354,7 +1354,7 @@ class St {
1354
1354
  ] : l = n.propertyList[4], t[r] = {
1355
1355
  type: s,
1356
1356
  type2: a,
1357
- flag: o,
1357
+ flag: i,
1358
1358
  value: l
1359
1359
  };
1360
1360
  } 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);
@@ -1400,7 +1400,7 @@ class St {
1400
1400
  case "l":
1401
1401
  return e.getInt64Array(r);
1402
1402
  }
1403
- const o = ft.unzlibSync(new Uint8Array(e.getArrayBuffer(a))), l = new Te(o.buffer);
1403
+ const i = ht.unzlibSync(new Uint8Array(e.getArrayBuffer(a))), l = new xe(i.buffer);
1404
1404
  switch (t) {
1405
1405
  case "b":
1406
1406
  case "c":
@@ -1420,7 +1420,7 @@ class St {
1420
1420
  }
1421
1421
  }
1422
1422
  }
1423
- class Te {
1423
+ class xe {
1424
1424
  constructor(e, t) {
1425
1425
  this.dv = new DataView(e), this.offset = 0, this.littleEndian = t !== void 0 ? t : !0, this._textDecoder = new TextDecoder();
1426
1426
  }
@@ -1519,42 +1519,42 @@ class Te {
1519
1519
  return r >= 0 && (n = new Uint8Array(this.dv.buffer, t, r)), this._textDecoder.decode(n);
1520
1520
  }
1521
1521
  }
1522
- class Pe {
1522
+ class Ce {
1523
1523
  add(e, t) {
1524
1524
  this[e] = t;
1525
1525
  }
1526
1526
  }
1527
- function Ft(i) {
1527
+ function At(o) {
1528
1528
  const e = "Kaydara FBX Binary \0";
1529
- return i.byteLength >= e.length && e === Le(i, 0, e.length);
1529
+ return o.byteLength >= e.length && e === Ue(o, 0, e.length);
1530
1530
  }
1531
- function It(i) {
1531
+ function It(o) {
1532
1532
  const e = ["K", "a", "y", "d", "a", "r", "a", "\\", "F", "B", "X", "\\", "B", "i", "n", "a", "r", "y", "\\", "\\"];
1533
1533
  let t = 0;
1534
1534
  function n(r) {
1535
- const s = i[r - 1];
1536
- return i = i.slice(t + r), t++, s;
1535
+ const s = o[r - 1];
1536
+ return o = o.slice(t + r), t++, s;
1537
1537
  }
1538
1538
  for (let r = 0; r < e.length; ++r)
1539
1539
  if (n(1) === e[r])
1540
1540
  return !1;
1541
1541
  return !0;
1542
1542
  }
1543
- function xe(i) {
1544
- const e = /FBXVersion: (\d+)/, t = i.match(e);
1543
+ function Ee(o) {
1544
+ const e = /FBXVersion: (\d+)/, t = o.match(e);
1545
1545
  if (t)
1546
1546
  return parseInt(t[1]);
1547
1547
  throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.");
1548
1548
  }
1549
- function At(i) {
1550
- return i / 46186158e3;
1549
+ function Rt(o) {
1550
+ return o / 46186158e3;
1551
1551
  }
1552
- const Rt = [];
1553
- function Q(i, e, t, n) {
1552
+ const Dt = [];
1553
+ function Q(o, e, t, n) {
1554
1554
  let r;
1555
1555
  switch (n.mappingType) {
1556
1556
  case "ByPolygonVertex":
1557
- r = i;
1557
+ r = o;
1558
1558
  break;
1559
1559
  case "ByPolygon":
1560
1560
  r = e;
@@ -1570,46 +1570,46 @@ function Q(i, e, t, n) {
1570
1570
  }
1571
1571
  n.referenceType === "IndexToDirect" && (r = n.indices[r]);
1572
1572
  const s = r * n.dataSize, a = s + n.dataSize;
1573
- return Pt(Rt, n.buffer, s, a);
1573
+ return Ct(Dt, n.buffer, s, a);
1574
1574
  }
1575
1575
  const se = new z(), H = new V();
1576
- function Ce(i) {
1577
- 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;
1578
- i.translation && e.setPosition(H.fromArray(i.translation));
1576
+ function Le(o) {
1577
+ const e = new L(), t = new L(), n = new L(), r = new L(), s = new L(), a = new L(), i = new L(), l = new L(), p = new L(), f = new L(), u = new L(), c = new L(), h = o.inheritType ? o.inheritType : 0;
1578
+ o.translation && e.setPosition(H.fromArray(o.translation));
1579
1579
  const m = q(0);
1580
- if (i.preRotation) {
1581
- const b = i.preRotation.map(B.degToRad);
1582
- b.push(m), t.makeRotationFromEuler(se.fromArray(b));
1580
+ if (o.preRotation) {
1581
+ const M = o.preRotation.map(B.degToRad);
1582
+ M.push(m), t.makeRotationFromEuler(se.fromArray(M));
1583
1583
  }
1584
- if (i.rotation) {
1585
- const b = i.rotation.map(B.degToRad);
1586
- b.push(i.eulerOrder || m), n.makeRotationFromEuler(se.fromArray(b));
1584
+ if (o.rotation) {
1585
+ const M = o.rotation.map(B.degToRad);
1586
+ M.push(o.eulerOrder || m), n.makeRotationFromEuler(se.fromArray(M));
1587
1587
  }
1588
- if (i.postRotation) {
1589
- const b = i.postRotation.map(B.degToRad);
1590
- b.push(m), r.makeRotationFromEuler(se.fromArray(b)), r.invert();
1588
+ if (o.postRotation) {
1589
+ const M = o.postRotation.map(B.degToRad);
1590
+ M.push(m), r.makeRotationFromEuler(se.fromArray(M)), r.invert();
1591
1591
  }
1592
- 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));
1592
+ o.scale && s.scale(H.fromArray(o.scale)), o.scalingOffset && i.setPosition(H.fromArray(o.scalingOffset)), o.scalingPivot && a.setPosition(H.fromArray(o.scalingPivot)), o.rotationOffset && l.setPosition(H.fromArray(o.rotationOffset)), o.rotationPivot && p.setPosition(H.fromArray(o.rotationPivot)), o.parentMatrixWorld && (u.copy(o.parentMatrix), f.copy(o.parentMatrixWorld));
1593
1593
  const g = t.clone().multiply(n).multiply(r), d = new L();
1594
1594
  d.extractRotation(f);
1595
1595
  const T = new L();
1596
1596
  T.copyPosition(f);
1597
- const F = T.clone().invert().multiply(f), y = d.clone().invert().multiply(F), x = s, I = new L();
1597
+ const F = T.clone().invert().multiply(f), y = d.clone().invert().multiply(F), x = s, A = new L();
1598
1598
  if (h === 0)
1599
- I.copy(d).multiply(g).multiply(y).multiply(x);
1599
+ A.copy(d).multiply(g).multiply(y).multiply(x);
1600
1600
  else if (h === 1)
1601
- I.copy(d).multiply(y).multiply(g).multiply(x);
1601
+ A.copy(d).multiply(y).multiply(g).multiply(x);
1602
1602
  else {
1603
1603
  const R = new L().scale(new V().setFromMatrixScale(u)).clone().invert(), w = y.clone().multiply(R);
1604
- I.copy(d).multiply(g).multiply(w).multiply(x);
1604
+ A.copy(d).multiply(g).multiply(w).multiply(x);
1605
1605
  }
1606
- const A = p.clone().invert(), M = a.clone().invert();
1607
- let v = e.clone().multiply(l).multiply(p).multiply(t).multiply(n).multiply(r).multiply(A).multiply(o).multiply(a).multiply(s).multiply(M);
1606
+ const I = p.clone().invert(), b = a.clone().invert();
1607
+ let v = e.clone().multiply(l).multiply(p).multiply(t).multiply(n).multiply(r).multiply(I).multiply(i).multiply(a).multiply(s).multiply(b);
1608
1608
  const S = new L().copyPosition(v), E = f.clone().multiply(S);
1609
- return c.copyPosition(E), v = c.clone().multiply(I), v.premultiply(f.invert()), v;
1609
+ return c.copyPosition(E), v = c.clone().multiply(A), v.premultiply(f.invert()), v;
1610
1610
  }
1611
- function q(i) {
1612
- i = i || 0;
1611
+ function q(o) {
1612
+ o = o || 0;
1613
1613
  const e = [
1614
1614
  "ZYX",
1615
1615
  // -> XYZ extrinsic
@@ -1625,26 +1625,26 @@ function q(i) {
1625
1625
  // -> ZYX extrinsic
1626
1626
  //'SphericXYZ', // not possible to support
1627
1627
  ];
1628
- return i === 6 ? (console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."), e[0]) : e[i];
1628
+ return o === 6 ? (console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."), e[0]) : e[o];
1629
1629
  }
1630
- function ae(i) {
1631
- return i.split(",").map(function(t) {
1630
+ function ae(o) {
1631
+ return o.split(",").map(function(t) {
1632
1632
  return parseFloat(t);
1633
1633
  });
1634
1634
  }
1635
- function Le(i, e, t) {
1636
- return e === void 0 && (e = 0), t === void 0 && (t = i.byteLength), new TextDecoder().decode(new Uint8Array(i, e, t));
1635
+ function Ue(o, e, t) {
1636
+ return e === void 0 && (e = 0), t === void 0 && (t = o.byteLength), new TextDecoder().decode(new Uint8Array(o, e, t));
1637
1637
  }
1638
- function Dt(i, e) {
1639
- for (let t = 0, n = i.length, r = e.length; t < r; t++, n++)
1640
- i[n] = e[t];
1638
+ function Pt(o, e) {
1639
+ for (let t = 0, n = o.length, r = e.length; t < r; t++, n++)
1640
+ o[n] = e[t];
1641
1641
  }
1642
- function Pt(i, e, t, n) {
1642
+ function Ct(o, e, t, n) {
1643
1643
  for (let r = t, s = 0; r < n; r++, s++)
1644
- i[s] = e[r];
1645
- return i;
1644
+ o[s] = e[r];
1645
+ return o;
1646
1646
  }
1647
- async function Ct(i, e, t) {
1647
+ async function Lt(o, e, t) {
1648
1648
  e.signal.throwIfAborted();
1649
1649
  const n = new AbortController(), r = n.signal, s = () => n.abort(e.signal.reason);
1650
1650
  e.signal.addEventListener("abort", s, { once: !0 });
@@ -1653,28 +1653,28 @@ async function Ct(i, e, t) {
1653
1653
  const x = () => {
1654
1654
  y || (y = !0, F(r.reason));
1655
1655
  };
1656
- r.aborted ? x() : r.addEventListener("abort", x, { once: !0 }), g.then((I) => {
1657
- r.removeEventListener("abort", x), y ? d == null || d(I) : (y = !0, T(I));
1658
- }, (I) => {
1659
- r.removeEventListener("abort", x), y || (y = !0, F(I));
1656
+ r.aborted ? x() : r.addEventListener("abort", x, { once: !0 }), g.then((A) => {
1657
+ r.removeEventListener("abort", x), y ? d == null || d(A) : (y = !0, T(A));
1658
+ }, (A) => {
1659
+ r.removeEventListener("abort", x), y || (y = !0, F(A));
1660
1660
  });
1661
- }), o = [], l = /* @__PURE__ */ new Set(), p = /* @__PURE__ */ new Set(), f = [], u = new st(), c = async (g) => {
1662
- var A;
1661
+ }), i = [], l = /* @__PURE__ */ new Set(), p = /* @__PURE__ */ new Set(), f = [], u = new at(), c = async (g) => {
1662
+ var I;
1663
1663
  if (/^(blob:|data:)/i.test(g))
1664
1664
  return g.startsWith("blob:") && p.add(g), g;
1665
- const d = [...new Set([...t.textures.values()].map((M) => M.path).filter(Boolean))], T = (M) => M.replaceAll("\\", "/").replace(/^\.\//, ""), F = T(g);
1666
- let y = d.filter((M) => T(M) === F);
1667
- if (y.length || (y = d.filter((M) => T(M).split("/").pop() === F.split("/").pop())), y.length > 1) throw new Error(`FBX texture path is ambiguous: ${g}`);
1668
- const x = T(y[0] ?? g), I = e.original;
1669
- if (typeof I == "object" && I !== null && "kind" in I && I.kind === "files") {
1670
- const M = ((A = e.entryPath) == null ? void 0 : A.replace(/[^/]*$/, "")) ?? "", v = (b) => {
1665
+ const d = [...new Set([...t.textures.values()].map((b) => b.path).filter(Boolean))], T = (b) => b.replaceAll("\\", "/").replace(/^\.\//, ""), F = T(g);
1666
+ let y = d.filter((b) => T(b) === F);
1667
+ if (y.length || (y = d.filter((b) => T(b).split("/").pop() === F.split("/").pop())), y.length > 1) throw new Error(`FBX texture path is ambiguous: ${g}`);
1668
+ const x = T(y[0] ?? g), A = e.original;
1669
+ if (typeof A == "object" && A !== null && "kind" in A && A.kind === "files") {
1670
+ const b = ((I = e.entryPath) == null ? void 0 : I.replace(/[^/]*$/, "")) ?? "", v = (M) => {
1671
1671
  const R = [];
1672
- for (const w of T(b).split("/"))
1672
+ for (const w of T(M).split("/"))
1673
1673
  w === ".." ? R.pop() : w && w !== "." && R.push(w);
1674
1674
  return R.join("/");
1675
- }, S = I.files.filter((b) => v(b.path) === v(M + x));
1675
+ }, S = A.files.filter((M) => v(M.path) === v(b + x));
1676
1676
  if (S.length === 1) return e.resolve(S[0].path);
1677
- const E = I.files.filter((b) => v(b.path).split("/").pop() === x.split("/").pop());
1677
+ const E = A.files.filter((M) => v(M.path).split("/").pop() === x.split("/").pop());
1678
1678
  if (E.length === 1) return e.resolve(E[0].path);
1679
1679
  if (E.length > 1) throw new Error(`FBX texture path is ambiguous: ${x}`);
1680
1680
  if (!e.hasResourceResolver) throw new Error(`FBX texture is missing from the selected files: ${x}`);
@@ -1690,50 +1690,50 @@ async function Ct(i, e, t) {
1690
1690
  load(d, T, F, y) {
1691
1691
  const x = this.binaryFormat ? new ne() : new Y();
1692
1692
  l.add(x);
1693
- const I = (async () => {
1694
- const A = await a(c(d));
1693
+ const A = (async () => {
1694
+ const I = await a(c(d));
1695
1695
  r.throwIfAborted();
1696
- const M = await fetch(A, { signal: r });
1697
- if (!M.ok) throw new Error(`FBX texture request failed (${M.status}): ${d}`);
1696
+ const b = await fetch(I, { signal: r });
1697
+ if (!b.ok) throw new Error(`FBX texture request failed (${b.status}): ${d}`);
1698
1698
  if (this.binaryFormat) {
1699
- const S = await M.arrayBuffer();
1699
+ const S = await b.arrayBuffer();
1700
1700
  r.throwIfAborted();
1701
1701
  let E;
1702
1702
  try {
1703
- E = vt(S, this.binaryFormat);
1704
- } catch (b) {
1705
- throw new Error(`FBX texture decode failed (${this.binaryFormat}): ${d}: ${String(b)}`, { cause: b });
1703
+ E = Tt(S, this.binaryFormat);
1704
+ } catch (M) {
1705
+ throw new Error(`FBX texture decode failed (${this.binaryFormat}): ${d}: ${String(M)}`, { cause: M });
1706
1706
  }
1707
1707
  x.image = E.image, x.flipY = E.flipY, x.generateMipmaps = E.generateMipmaps, x.minFilter = E.minFilter, x.magFilter = E.magFilter, x.format = E.format, x.type = E.type, E.dispose(), x.needsUpdate = !0, T == null || T(x);
1708
1708
  return;
1709
1709
  }
1710
- const v = URL.createObjectURL(await M.blob());
1710
+ const v = URL.createObjectURL(await b.blob());
1711
1711
  try {
1712
- const S = new Me().loadAsync(v).catch((b) => {
1713
- const R = b instanceof Error ? `: ${b.message}` : "";
1714
- throw new Error(`FBX texture decode failed: ${d}${R}`, { cause: b });
1715
- }), E = await a(S, (b) => {
1716
- b.dispose();
1712
+ const S = new Se().loadAsync(v).catch((M) => {
1713
+ const R = M instanceof Error ? `: ${M.message}` : "";
1714
+ throw new Error(`FBX texture decode failed: ${d}${R}`, { cause: M });
1715
+ }), E = await a(S, (M) => {
1716
+ M.dispose();
1717
1717
  });
1718
1718
  x.image = E.image, E.dispose(), r.throwIfAborted(), x.needsUpdate = !0, T == null || T(x);
1719
1719
  } finally {
1720
1720
  URL.revokeObjectURL(v);
1721
1721
  }
1722
- })().catch((A) => {
1723
- if (r.aborted) throw A;
1724
- f.push(A instanceof Error ? A.message : String(A)), console.warn(`[viewer] FBX texture skipped: ${d}`, A), y == null || y(A);
1722
+ })().catch((I) => {
1723
+ if (r.aborted) throw I;
1724
+ f.push(I instanceof Error ? I.message : String(I)), console.warn(`[viewer] FBX texture skipped: ${d}`, I), y == null || y(I);
1725
1725
  });
1726
- return I.catch(() => {
1727
- }), o.push(I), x;
1726
+ return A.catch(() => {
1727
+ }), i.push(A), x;
1728
1728
  }
1729
1729
  }
1730
1730
  u.addHandler(/\.tga$/i, new h("tga")), u.addHandler(/\.dds$/i, new h("dds")), u.addHandler(/.*/, new h());
1731
1731
  let m;
1732
1732
  try {
1733
- return m = new Tt(u).parse(i, ""), await Promise.all(o), e.signal.throwIfAborted(), { root: m, textures: l, textureFailures: f };
1733
+ return m = new xt(u).parse(o, ""), await Promise.all(i), e.signal.throwIfAborted(), { root: m, textures: l, textureFailures: f };
1734
1734
  } catch (g) {
1735
- if (n.abort(g), await Promise.allSettled(o), m) {
1736
- const { disposeModelResources: d } = await import("./index-DoxM1Msk.js").then((T) => T.ac);
1735
+ if (n.abort(g), await Promise.allSettled(i), m) {
1736
+ const { disposeModelResources: d } = await import("./index-D4V1Rbos.js").then((T) => T.ac);
1737
1737
  d(m, l);
1738
1738
  } else for (const d of l) d.dispose();
1739
1739
  throw g;
@@ -1742,30 +1742,30 @@ async function Ct(i, e, t) {
1742
1742
  for (const g of p) URL.revokeObjectURL(g);
1743
1743
  }
1744
1744
  }
1745
- const oe = "Kaydara FBX Binary \0", Lt = /(?:^|[\r\n])\s*P:\s*"UpAxis"\s*,\s*"int"\s*,\s*"Integer"\s*,\s*""\s*,\s*(-?\d+)/i, Ot = /(?:^|[\r\n])\s*P:\s*"UpAxisSign"\s*,\s*"int"\s*,\s*"Integer"\s*,\s*""\s*,\s*(-?\d+)/i;
1746
- function Ut(i) {
1745
+ const oe = "Kaydara FBX Binary \0", Ut = /(?:^|[\r\n])\s*P:\s*"UpAxis"\s*,\s*"int"\s*,\s*"Integer"\s*,\s*""\s*,\s*(-?\d+)/i, Ot = /(?:^|[\r\n])\s*P:\s*"UpAxisSign"\s*,\s*"int"\s*,\s*"Integer"\s*,\s*""\s*,\s*(-?\d+)/i;
1746
+ function Bt(o) {
1747
1747
  try {
1748
- const e = new Uint8Array(i), t = Bt(e) ? Xt(i) : kt(new TextDecoder().decode(e));
1748
+ const e = new Uint8Array(o), t = kt(e) ? _t(o) : Xt(new TextDecoder().decode(e));
1749
1749
  return !t || t.sign !== 1 ? null : t.axis === 1 ? "y" : t.axis === 2 ? "z" : null;
1750
1750
  } catch {
1751
1751
  return null;
1752
1752
  }
1753
1753
  }
1754
- function Bt(i) {
1755
- if (i.byteLength < oe.length) return !1;
1754
+ function kt(o) {
1755
+ if (o.byteLength < oe.length) return !1;
1756
1756
  for (let e = 0; e < oe.length; e += 1)
1757
- if (i[e] !== oe.charCodeAt(e)) return !1;
1757
+ if (o[e] !== oe.charCodeAt(e)) return !1;
1758
1758
  return !0;
1759
1759
  }
1760
- function kt(i) {
1760
+ function Xt(o) {
1761
1761
  var r, s;
1762
- const e = Number.parseInt(((r = Lt.exec(i)) == null ? void 0 : r[1]) ?? "", 10);
1762
+ const e = Number.parseInt(((r = Ut.exec(o)) == null ? void 0 : r[1]) ?? "", 10);
1763
1763
  if (!Number.isInteger(e)) return null;
1764
- const t = (s = Ot.exec(i)) == null ? void 0 : s[1], n = t === void 0 ? 1 : Number.parseInt(t, 10);
1764
+ const t = (s = Ot.exec(o)) == null ? void 0 : s[1], n = t === void 0 ? 1 : Number.parseInt(t, 10);
1765
1765
  return Number.isInteger(n) ? { axis: e, sign: n } : null;
1766
1766
  }
1767
- function Xt(i) {
1768
- const e = new DataView(i);
1767
+ function _t(o) {
1768
+ const e = new DataView(o);
1769
1769
  if (e.byteLength < 27) return null;
1770
1770
  const t = e.getUint32(23, !0) >= 7500;
1771
1771
  let n = 27;
@@ -1777,64 +1777,64 @@ function Xt(i) {
1777
1777
  }
1778
1778
  return null;
1779
1779
  }
1780
- function Oe(i, e, t, n) {
1780
+ function Oe(o, e, t, n) {
1781
1781
  let r = e, s = null, a = 1;
1782
1782
  for (; r < t; ) {
1783
- const o = K(i, r, n, !0);
1784
- if (!o) break;
1785
- if (o.name === "P") {
1786
- const [l, , , , p] = o.properties;
1783
+ const i = K(o, r, n, !0);
1784
+ if (!i) break;
1785
+ if (i.name === "P") {
1786
+ const [l, , , , p] = i.properties;
1787
1787
  l === "UpAxis" && typeof p == "number" && (s = p), l === "UpAxisSign" && typeof p == "number" && (a = p);
1788
1788
  }
1789
- if (o.childrenOffset < o.endOffset) {
1790
- const l = Oe(i, o.childrenOffset, o.endOffset, n);
1789
+ if (i.childrenOffset < i.endOffset) {
1790
+ const l = Oe(o, i.childrenOffset, i.endOffset, n);
1791
1791
  l && (s ?? (s = l.axis), a = l.sign);
1792
1792
  }
1793
- r = o.endOffset;
1793
+ r = i.endOffset;
1794
1794
  }
1795
1795
  return s === null ? null : { axis: s, sign: a };
1796
1796
  }
1797
- function K(i, e, t, n) {
1797
+ function K(o, e, t, n) {
1798
1798
  const r = t ? 25 : 13;
1799
- if (e + r > i.byteLength) return null;
1800
- 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));
1799
+ if (e + r > o.byteLength) return null;
1800
+ const s = ie(o, e, t), a = ie(o, e + (t ? 8 : 4), t), i = ie(o, e + (t ? 16 : 8), t), l = o.getUint8(e + (t ? 24 : 12));
1801
1801
  if (s === 0) return null;
1802
- const p = e + r, f = p + l, u = f + o;
1803
- if (s <= e || s > i.byteLength || u > s) throw new Error("Invalid FBX node bounds.");
1804
- const c = new TextDecoder().decode(new Uint8Array(i.buffer, i.byteOffset + p, l)), h = [];
1802
+ const p = e + r, f = p + l, u = f + i;
1803
+ if (s <= e || s > o.byteLength || u > s) throw new Error("Invalid FBX node bounds.");
1804
+ const c = new TextDecoder().decode(new Uint8Array(o.buffer, o.byteOffset + p, l)), h = [];
1805
1805
  if (n) {
1806
1806
  let m = f;
1807
1807
  for (let g = 0; g < a; g += 1) {
1808
- const d = _t(i, m);
1808
+ const d = Vt(o, m);
1809
1809
  if (h.push(d.value), m = d.nextOffset, m > u) return null;
1810
1810
  }
1811
1811
  }
1812
1812
  return { name: c, endOffset: s, childrenOffset: u, properties: h };
1813
1813
  }
1814
- function ie(i, e, t) {
1815
- if (!t) return i.getUint32(e, !0);
1816
- const n = i.getBigUint64(e, !0);
1814
+ function ie(o, e, t) {
1815
+ if (!t) return o.getUint32(e, !0);
1816
+ const n = o.getBigUint64(e, !0);
1817
1817
  if (n > BigInt(Number.MAX_SAFE_INTEGER)) throw new Error("FBX offset exceeds the safe integer range.");
1818
1818
  return Number(n);
1819
1819
  }
1820
- function _t(i, e) {
1821
- const t = String.fromCharCode(i.getUint8(e));
1820
+ function Vt(o, e) {
1821
+ const t = String.fromCharCode(o.getUint8(e));
1822
1822
  switch (t) {
1823
1823
  case "Y":
1824
- return { value: i.getInt16(e + 1, !0), nextOffset: e + 3 };
1824
+ return { value: o.getInt16(e + 1, !0), nextOffset: e + 3 };
1825
1825
  case "C":
1826
- return { value: i.getUint8(e + 1) !== 0, nextOffset: e + 2 };
1826
+ return { value: o.getUint8(e + 1) !== 0, nextOffset: e + 2 };
1827
1827
  case "I":
1828
- return { value: i.getInt32(e + 1, !0), nextOffset: e + 5 };
1828
+ return { value: o.getInt32(e + 1, !0), nextOffset: e + 5 };
1829
1829
  case "F":
1830
- return { value: i.getFloat32(e + 1, !0), nextOffset: e + 5 };
1830
+ return { value: o.getFloat32(e + 1, !0), nextOffset: e + 5 };
1831
1831
  case "D":
1832
- return { value: i.getFloat64(e + 1, !0), nextOffset: e + 9 };
1832
+ return { value: o.getFloat64(e + 1, !0), nextOffset: e + 9 };
1833
1833
  case "L":
1834
- return { value: Number(i.getBigInt64(e + 1, !0)), nextOffset: e + 9 };
1834
+ return { value: Number(o.getBigInt64(e + 1, !0)), nextOffset: e + 9 };
1835
1835
  case "S":
1836
1836
  case "R": {
1837
- const n = i.getUint32(e + 1, !0), r = e + 5, s = new Uint8Array(i.buffer, i.byteOffset + r, n);
1837
+ const n = o.getUint32(e + 1, !0), r = e + 5, s = new Uint8Array(o.buffer, o.byteOffset + r, n);
1838
1838
  return { value: t === "S" ? new TextDecoder().decode(s) : s, nextOffset: r + n };
1839
1839
  }
1840
1840
  case "f":
@@ -1843,39 +1843,39 @@ function _t(i, e) {
1843
1843
  case "i":
1844
1844
  case "b":
1845
1845
  case "c": {
1846
- const n = i.getUint32(e + 9, !0);
1846
+ const n = o.getUint32(e + 9, !0);
1847
1847
  return { value: null, nextOffset: e + 13 + n };
1848
1848
  }
1849
1849
  default:
1850
1850
  throw new Error(`Unsupported FBX property type: ${t}`);
1851
1851
  }
1852
1852
  }
1853
- const te = /* @__PURE__ */ new Set(["Definitions", "ObjectType", "PropertyTemplate", "Objects", "Material", "Properties70", "Connections", "Texture", "Video", "Geometry", "LayerElementUV", "LayeredTexture", "BlendModes", "Alphas"]), Ue = /* @__PURE__ */ new Set(["P", "C", "RelativeFilename", "FileName", "Filename", "ShadingModel", "UVSet", "Scaling", "Translation", "Rotation", "RotationPivot", "ScalingPivot", "Name", "UV", "a"]);
1854
- function Vt(i) {
1855
- var F, y, x, I, A, M;
1856
- const e = new Uint8Array(i), n = new TextDecoder().decode(e.subarray(0, 21)) === "Kaydara FBX Binary \0" ? Gt(i) : Nt(new TextDecoder().decode(e)), r = (v) => {
1853
+ const te = /* @__PURE__ */ new Set(["Definitions", "ObjectType", "PropertyTemplate", "Objects", "Material", "Properties70", "Connections", "Texture", "Video", "Geometry", "LayerElementUV", "LayeredTexture", "BlendModes", "Alphas"]), Be = /* @__PURE__ */ new Set(["P", "C", "RelativeFilename", "FileName", "Filename", "ShadingModel", "UVSet", "Scaling", "Translation", "Rotation", "RotationPivot", "ScalingPivot", "Name", "UV", "a"]);
1854
+ function Gt(o) {
1855
+ var F, y, x, A, I, b;
1856
+ const e = new Uint8Array(o), n = new TextDecoder().decode(e.subarray(0, 21)) === "Kaydara FBX Binary \0" ? Nt(o) : $t(new TextDecoder().decode(e)), r = (v) => {
1857
1857
  var S;
1858
1858
  return new Map(
1859
1859
  (((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)])
1860
1860
  );
1861
- }, 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) => {
1861
+ }, s = n.find((v) => v.name === "Definitions"), a = s == null ? void 0 : s.children.find((v) => v.name === "ObjectType" && v.values[0] === "Material"), i = (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) => {
1862
1862
  var E;
1863
- return (E = v == null ? void 0 : v.children.find((b) => b.name === S)) == null ? void 0 : E.values[0];
1863
+ return (E = v == null ? void 0 : v.children.find((M) => M.name === S)) == null ? void 0 : E.values[0];
1864
1864
  };
1865
1865
  for (const v of p.filter((S) => S.name === "Texture")) {
1866
- const S = Number(v.values[0]), E = (x = l.find((P) => P.values[0] === "OO" && P.values[2] === S)) == null ? void 0 : x.values[1], b = p.find((P) => P.name === "Video" && P.values[0] === E), R = String(u(b, "RelativeFilename") || u(v, "RelativeFilename") || u(b, "Filename") || u(v, "FileName") || ""), w = r(v);
1866
+ const S = Number(v.values[0]), E = (x = l.find((P) => P.values[0] === "OO" && P.values[2] === S)) == null ? void 0 : x.values[1], M = p.find((P) => P.name === "Video" && P.values[0] === E), R = String(u(M, "RelativeFilename") || u(v, "RelativeFilename") || u(M, "Filename") || u(v, "FileName") || ""), w = r(v);
1867
1867
  for (const P of ["Scaling", "Translation", "Rotation", "RotationPivot", "ScalingPivot"]) {
1868
- const _ = (I = v.children.find((Be) => Be.name === P)) == null ? void 0 : I.values;
1868
+ const _ = (A = v.children.find((ke) => ke.name === P)) == null ? void 0 : A.values;
1869
1869
  _ && w.set(P, _);
1870
1870
  }
1871
- const D = u(v, "UVSet") ?? ((A = w.get("UVSet")) == null ? void 0 : A[0]);
1871
+ const D = u(v, "UVSet") ?? ((I = w.get("UVSet")) == null ? void 0 : I[0]);
1872
1872
  f.set(S, { id: S, path: R, values: w, uvSet: typeof D == "string" ? D : null });
1873
1873
  }
1874
1874
  const c = /* @__PURE__ */ new Map(), h = (v, S) => {
1875
1875
  var R;
1876
- const E = v.children.find((w) => w.name === S), b = ((R = E == null ? void 0 : E.children.find((w) => w.name === "a")) == null ? void 0 : R.values) ?? (E == null ? void 0 : E.values) ?? [];
1877
- if (b.some((w) => typeof w != "number" || !Number.isFinite(w))) throw new Error(`Invalid FBX layered ${S}.`);
1878
- return b;
1876
+ const E = v.children.find((w) => w.name === S), M = ((R = E == null ? void 0 : E.children.find((w) => w.name === "a")) == null ? void 0 : R.values) ?? (E == null ? void 0 : E.values) ?? [];
1877
+ if (M.some((w) => typeof w != "number" || !Number.isFinite(w))) throw new Error(`Invalid FBX layered ${S}.`);
1878
+ return M;
1879
1879
  };
1880
1880
  for (const v of p.filter((S) => S.name === "LayeredTexture")) {
1881
1881
  const S = Number(v.values[0]);
@@ -1889,11 +1889,11 @@ function Vt(i) {
1889
1889
  });
1890
1890
  }
1891
1891
  const m = /* @__PURE__ */ new Map();
1892
- for (const v of ((M = n.find((S) => S.name === "Objects")) == null ? void 0 : M.children) ?? []) {
1892
+ for (const v of ((b = n.find((S) => S.name === "Objects")) == null ? void 0 : b.children) ?? []) {
1893
1893
  if (v.name !== "Material") continue;
1894
1894
  const S = v.values[0];
1895
1895
  if (typeof S != "number" || !Number.isSafeInteger(S)) throw new Error("Invalid FBX material ID.");
1896
- const E = r(v), b = l.filter((P) => P.values[0] === "OP" && P.values[2] === S).map((P) => String(P.values[3])), R = 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(), D = r(o.find((P) => String(P.values[0]).toLowerCase() === `fbxsurface${w}`));
1896
+ const E = r(v), M = l.filter((P) => P.values[0] === "OP" && P.values[2] === S).map((P) => String(P.values[3])), R = 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(), D = r(i.find((P) => String(P.values[0]).toLowerCase() === `fbxsurface${w}`));
1897
1897
  m.set(S, {
1898
1898
  textureConnections: R,
1899
1899
  shadingModel: w,
@@ -1901,86 +1901,86 @@ function Vt(i) {
1901
1901
  name: String(v.values[1] ?? ""),
1902
1902
  ownValues: E,
1903
1903
  values: new Map([...D, ...E]),
1904
- textureRoles: b
1904
+ textureRoles: M
1905
1905
  });
1906
1906
  }
1907
1907
  const g = /* @__PURE__ */ new Map();
1908
1908
  for (const v of l) {
1909
- const [S, E, b] = v.values;
1910
- if (S !== "OO" || typeof E != "number" || typeof b != "number" || !m.has(E)) continue;
1911
- const R = g.get(b) ?? [];
1912
- R.push(E), g.set(b, R);
1909
+ const [S, E, M] = v.values;
1910
+ if (S !== "OO" || typeof E != "number" || typeof M != "number" || !m.has(E)) continue;
1911
+ const R = g.get(M) ?? [];
1912
+ R.push(E), g.set(M, R);
1913
1913
  }
1914
1914
  const d = /* @__PURE__ */ new Map();
1915
1915
  for (const v of p.filter((S) => S.name === "Geometry")) {
1916
- const S = new Map(v.children.filter((b) => b.name === "LayerElementUV").map((b) => [Number(b.values[0]), b])), E = [];
1917
- for (let b = 0; S.has(b); b++) {
1918
- const R = S.get(b);
1916
+ const S = new Map(v.children.filter((M) => M.name === "LayerElementUV").map((M) => [Number(M.values[0]), M])), E = [];
1917
+ for (let M = 0; S.has(M); M++) {
1918
+ const R = S.get(M);
1919
1919
  R.children.some((w) => w.name === "UV") && E.push(String(u(R, "Name") ?? ""));
1920
1920
  }
1921
1921
  d.set(Number(v.values[0]), E);
1922
1922
  }
1923
1923
  const T = /* @__PURE__ */ new Map();
1924
1924
  for (const v of l) {
1925
- const [S, E, b] = v.values;
1926
- S === "OO" && typeof E == "number" && typeof b == "number" && d.has(E) && T.set(b, d.get(E));
1925
+ const [S, E, M] = v.values;
1926
+ S === "OO" && typeof E == "number" && typeof M == "number" && d.has(E) && T.set(M, d.get(E));
1927
1927
  }
1928
1928
  return { materials: m, modelMaterials: g, textures: f, modelUvSets: T, layeredTextures: c };
1929
1929
  }
1930
- function Gt(i) {
1931
- const e = new DataView(i);
1930
+ function Nt(o) {
1931
+ const e = new DataView(o);
1932
1932
  if (e.byteLength < 27) throw new Error("Truncated FBX header.");
1933
1933
  const t = e.getUint32(23, !0) >= 7500, n = (r, s, a) => {
1934
1934
  if (a > 16) throw new Error("Excessive FBX metadata nesting.");
1935
- const o = [];
1935
+ const i = [];
1936
1936
  let l = r;
1937
1937
  for (; l < s; ) {
1938
1938
  const p = K(e, l, t, !1);
1939
1939
  if (!p) break;
1940
1940
  if (p.endOffset > s) throw new Error("FBX child extends past its parent.");
1941
- if (te.has(p.name) || Ue.has(p.name)) {
1941
+ if (te.has(p.name) || Be.has(p.name)) {
1942
1942
  const f = K(e, l, t, p.name !== "UV");
1943
- o.push({ name: f.name, values: ["BlendModes", "Alphas"].includes(f.name) ? $t(e, l, t, f.childrenOffset) : [...f.properties], children: te.has(f.name) ? n(f.childrenOffset, f.endOffset, a + 1) : [] });
1943
+ i.push({ name: f.name, values: ["BlendModes", "Alphas"].includes(f.name) ? zt(e, l, t, f.childrenOffset) : [...f.properties], children: te.has(f.name) ? n(f.childrenOffset, f.endOffset, a + 1) : [] });
1944
1944
  }
1945
1945
  l = p.endOffset;
1946
1946
  }
1947
- return o;
1947
+ return i;
1948
1948
  };
1949
1949
  return n(27, e.byteLength, 0);
1950
1950
  }
1951
- function Nt(i) {
1951
+ function $t(o) {
1952
1952
  const e = /"(?:\\.|[^"\\])*"|;[^\r\n]*|\r?\n|[^\S\r\n]+|[{}:,]|[^\s{}:,;]+/g;
1953
1953
  let t = null;
1954
1954
  const n = () => {
1955
1955
  var a;
1956
1956
  if (t !== null) {
1957
- const o = t;
1958
- return t = null, o;
1957
+ const i = t;
1958
+ return t = null, i;
1959
1959
  }
1960
1960
  for (; ; ) {
1961
- const o = ((a = e.exec(i)) == null ? void 0 : a[0]) ?? null;
1962
- if (o === null) return null;
1963
- if (!(o.startsWith(";") || /^[^\S\r\n]+$/.test(o)))
1964
- return o;
1961
+ const i = ((a = e.exec(o)) == null ? void 0 : a[0]) ?? null;
1962
+ if (i === null) return null;
1963
+ if (!(i.startsWith(";") || /^[^\S\r\n]+$/.test(i)))
1964
+ return i;
1965
1965
  }
1966
1966
  }, r = (a) => a.startsWith('"') ? a.slice(1, -1).replace(/\\(["\\])/g, "$1") : Number.isFinite(Number(a)) ? Number(a) : a, s = (a) => {
1967
1967
  if (a > 16) throw new Error("Excessive FBX metadata nesting.");
1968
- const o = [];
1968
+ const i = [];
1969
1969
  for (; ; ) {
1970
1970
  const l = n();
1971
1971
  if (l === null) {
1972
1972
  if (a) throw new Error("Unclosed FBX block.");
1973
- return o;
1973
+ return i;
1974
1974
  }
1975
1975
  if (l === "}") {
1976
1976
  if (!a) throw new Error("Unexpected FBX closing brace.");
1977
- return o;
1977
+ return i;
1978
1978
  }
1979
1979
  if (l === `
1980
1980
  ` || l === `\r
1981
1981
  `) continue;
1982
1982
  if (n() !== ":") throw new Error("Malformed ASCII FBX metadata.");
1983
- const p = te.has(l) || Ue.has(l), f = [];
1983
+ const p = te.has(l) || Be.has(l), f = [];
1984
1984
  let u = [];
1985
1985
  for (; ; ) {
1986
1986
  const c = n();
@@ -2005,49 +2005,49 @@ function Nt(i) {
2005
2005
  }
2006
2006
  p && c !== "," && f.push(r(c));
2007
2007
  }
2008
- p && o.push({ name: l, values: f, children: u });
2008
+ p && i.push({ name: l, values: f, children: u });
2009
2009
  }
2010
2010
  };
2011
2011
  return s(0);
2012
2012
  }
2013
- function $t(i, e, t, n) {
2013
+ function zt(o, e, t, n) {
2014
2014
  const r = t ? 25 : 13;
2015
- let s = e + r + i.getUint8(e + r - 1);
2015
+ let s = e + r + o.getUint8(e + r - 1);
2016
2016
  if (s === n) return [];
2017
- const a = String.fromCharCode(i.getUint8(s));
2018
- if (!["i", "d", "f"].includes(a)) return [...K(i, e, t, !0).properties];
2017
+ const a = String.fromCharCode(o.getUint8(s));
2018
+ if (!["i", "d", "f"].includes(a)) return [...K(o, e, t, !0).properties];
2019
2019
  if (s + 13 > n) throw new Error("Truncated FBX layered array header.");
2020
- const o = i.getUint32(s + 1, !0), l = i.getUint32(s + 5, !0), p = i.getUint32(s + 9, !0), f = a === "d" ? 8 : 4;
2021
- if (o > 4096 || s + 13 + p !== n || ![0, 1].includes(l)) throw new Error("Invalid FBX layered array bounds.");
2022
- const u = new Uint8Array(i.buffer, i.byteOffset + s + 13, p), c = l === 1 ? ht(u, { out: new Uint8Array(o * f) }) : u;
2023
- if (c.length !== o * f) throw new Error("Invalid FBX layered array size.");
2020
+ const i = o.getUint32(s + 1, !0), l = o.getUint32(s + 5, !0), p = o.getUint32(s + 9, !0), f = a === "d" ? 8 : 4;
2021
+ if (i > 4096 || s + 13 + p !== n || ![0, 1].includes(l)) throw new Error("Invalid FBX layered array bounds.");
2022
+ const u = new Uint8Array(o.buffer, o.byteOffset + s + 13, p), c = l === 1 ? dt(u, { out: new Uint8Array(i * f) }) : u;
2023
+ if (c.length !== i * f) throw new Error("Invalid FBX layered array size.");
2024
2024
  const h = new DataView(c.buffer, c.byteOffset, c.byteLength);
2025
- 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));
2025
+ return Array.from({ length: i }, (m, g) => a === "i" ? h.getInt32(g * f, !0) : a === "d" ? h.getFloat64(g * f, !0) : h.getFloat32(g * f, !0));
2026
2026
  }
2027
- const Ee = (i) => i <= 0.04045 ? i / 12.92 : ((i + 0.055) / 1.055) ** 2.4, zt = (i) => i <= 31308e-7 ? i * 12.92 : 1.055 * i ** (1 / 2.4) - 0.055, jt = /* @__PURE__ */ new Set([0, 1, 2, 4, 5]), Ht = 4 * 1024 * 1024;
2028
- function be(i) {
2029
- const e = i.image, t = (e == null ? void 0 : e.naturalWidth) || (e == null ? void 0 : e.width), n = (e == null ? void 0 : e.naturalHeight) || (e == null ? void 0 : e.height);
2030
- if (!t || !n || t * n > Ht) throw new Error("missing image or image exceeds 4M pixels");
2027
+ const be = (o) => o <= 0.04045 ? o / 12.92 : ((o + 0.055) / 1.055) ** 2.4, jt = (o) => o <= 31308e-7 ? o * 12.92 : 1.055 * o ** (1 / 2.4) - 0.055, Ht = /* @__PURE__ */ new Set([0, 1, 2, 4, 5]), Wt = 4 * 1024 * 1024;
2028
+ function Me(o) {
2029
+ const e = o.image, t = (e == null ? void 0 : e.naturalWidth) || (e == null ? void 0 : e.width), n = (e == null ? void 0 : e.naturalHeight) || (e == null ? void 0 : e.height);
2030
+ if (!t || !n || t * n > Wt) throw new Error("missing image or image exceeds 4M pixels");
2031
2031
  let r;
2032
2032
  if (e.data) {
2033
- if (i.format !== Ie || i.type !== Ae || !(e.data instanceof Uint8Array) || e.data.length !== t * n * 4) throw new Error("require RGBA8 source");
2033
+ if (o.format !== Ie || o.type !== Re || !(e.data instanceof Uint8Array) || e.data.length !== t * n * 4) throw new Error("require RGBA8 source");
2034
2034
  r = e.data;
2035
2035
  } else {
2036
2036
  const a = document.createElement("canvas");
2037
2037
  a.width = t, a.height = n;
2038
- const o = a.getContext("2d", { willReadFrequently: !0 });
2039
- if (!o) throw new Error("canvas readback unavailable");
2040
- o.drawImage(i.image, 0, 0), r = o.getImageData(0, 0, t, n).data;
2038
+ const i = a.getContext("2d", { willReadFrequently: !0 });
2039
+ if (!i) throw new Error("canvas readback unavailable");
2040
+ i.drawImage(o.image, 0, 0), r = i.getImageData(0, 0, t, n).data;
2041
2041
  }
2042
2042
  const s = new Uint8Array(t * n * 4);
2043
- 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];
2043
+ for (let a = 0; a < n; a++) for (let i = 0; i < t * 4; i++) s[(o.flipY ? n - a - 1 : a) * t * 4 + i] = r[a * t * 4 + i];
2044
2044
  return { data: s, width: t, height: n };
2045
2045
  }
2046
- function Wt(i, e, t) {
2047
- if (i.issues.some((u) => u.code !== "LAYERED_TEXTURE_NOT_COMPOSITED")) throw new Error("incompatible layer graph or coordinates");
2048
- if (i.layers.length < 1 || i.layers.length > 8) throw new Error("require 1–8 layers");
2049
- if (!i.layers.every((u) => u.blendMode !== null && jt.has(u.blendMode))) throw new Error("unsupported blend mode");
2050
- const n = i.layers.map((u) => {
2046
+ function Yt(o, e, t) {
2047
+ if (o.issues.some((u) => u.code !== "LAYERED_TEXTURE_NOT_COMPOSITED")) throw new Error("incompatible layer graph or coordinates");
2048
+ if (o.layers.length < 1 || o.layers.length > 8) throw new Error("require 1–8 layers");
2049
+ if (!o.layers.every((u) => u.blendMode !== null && Ht.has(u.blendMode))) throw new Error("unsupported blend mode");
2050
+ const n = o.layers.map((u) => {
2051
2051
  const c = [...t].find((h) => h.ID === u.textureId);
2052
2052
  if (!c) throw new Error(`missing decoded texture ${u.textureId}`);
2053
2053
  return c;
@@ -2067,54 +2067,54 @@ function Wt(i, e, t) {
2067
2067
  u.matrix.elements
2068
2068
  ]);
2069
2069
  if (n.some((u) => s(u) !== s(r))) throw new Error("incompatible sampling state");
2070
- if (i.layers.some((u) => !e.textures.has(u.textureId))) throw new Error("missing source metadata");
2071
- const a = be(r), o = a.width * a.height;
2072
- 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");
2073
- const l = new Float32Array(o * 3);
2074
- 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);
2070
+ if (o.layers.some((u) => !e.textures.has(u.textureId))) throw new Error("missing source metadata");
2071
+ const a = Me(r), i = a.width * a.height;
2072
+ if (o.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");
2073
+ const l = new Float32Array(i * 3);
2074
+ for (let u = 0; u < i; u++) for (let c = 0; c < 3; c++) l[u * 3 + c] = r.colorSpace === ge ? a.data[u * 4 + c] / 255 : be(a.data[u * 4 + c] / 255);
2075
2075
  for (let u = 1; u < n.length; u++) {
2076
- const c = n[u], h = be(c), m = i.layers[u];
2076
+ const c = n[u], h = Me(c), m = o.layers[u];
2077
2077
  if (h.width !== a.width || h.height !== a.height) throw new Error("layer dimensions differ");
2078
- for (let g = 0; g < o; g++) {
2078
+ for (let g = 0; g < i; g++) {
2079
2079
  const d = m.alpha * h.data[g * 4 + 3] / 255;
2080
2080
  for (let T = 0; T < 3; T++) {
2081
- 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;
2082
- l[g * 3 + T] = F + (I - F) * d;
2081
+ const F = l[g * 3 + T], y = h.data[g * 4 + T] / 255, x = c.colorSpace === ge ? y : be(y), A = m.blendMode === 1 ? Math.min(1, F + x) : m.blendMode === 2 ? F * x : x;
2082
+ l[g * 3 + T] = F + (A - F) * d;
2083
2083
  }
2084
2084
  }
2085
2085
  }
2086
- const p = new Uint8Array(o * 4);
2087
- for (let u = 0; u < o; u++) p[u * 4 + 3] = 255;
2088
- 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, zt(l[u * 3 + c]))));
2086
+ const p = new Uint8Array(i * 4);
2087
+ for (let u = 0; u < i; u++) p[u * 4 + 3] = 255;
2088
+ for (let u = 0; u < i; u++) for (let c = 0; c < 3; c++) p[u * 4 + c] = Math.round(255 * Math.min(1, Math.max(0, jt(l[u * 3 + c]))));
2089
2089
  const f = new ne(p, a.width, a.height);
2090
- 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;
2090
+ 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 = o.layers[0].textureId, f.needsUpdate = !0, f;
2091
2091
  }
2092
- function Yt(i, e) {
2093
- return i.textureConnections.flatMap((t) => {
2092
+ function qt(o, e) {
2093
+ return o.textureConnections.flatMap((t) => {
2094
2094
  var u;
2095
2095
  const n = (u = e.layeredTextures) == null ? void 0 : u.get(t.id);
2096
2096
  if (!n) return [];
2097
2097
  const r = [], s = (c, h) => r.push({ status: "unsupported", code: c, source: `layered:${n.id}:${h}`, target: t.role });
2098
2098
  s("LAYERED_TEXTURE_NOT_COMPOSITED", "preview uses loader fallback; layers have not been composited");
2099
- const a = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), l = [], p = (c, h) => {
2099
+ const a = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), l = [], p = (c, h) => {
2100
2100
  var g;
2101
2101
  if (a.has(c)) {
2102
2102
  s("LAYERED_TEXTURE_CYCLE", String(c));
2103
2103
  return;
2104
2104
  }
2105
- if (h > 32 || o.size >= 4096) {
2105
+ if (h > 32 || i.size >= 4096) {
2106
2106
  s("LAYERED_TEXTURE_GRAPH_LIMIT", String(c));
2107
2107
  return;
2108
2108
  }
2109
- if (o.has(c)) return;
2109
+ if (i.has(c)) return;
2110
2110
  const m = (g = e.layeredTextures) == null ? void 0 : g.get(c);
2111
2111
  if (!m) {
2112
- e.textures.has(c) ? l.push(c) : s("LAYERED_TEXTURE_MISSING_SOURCE", String(c)), o.add(c);
2112
+ e.textures.has(c) ? l.push(c) : s("LAYERED_TEXTURE_MISSING_SOURCE", String(c)), i.add(c);
2113
2113
  return;
2114
2114
  }
2115
2115
  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);
2116
2116
  for (const d of m.textureIds) p(d, h + 1);
2117
- a.delete(c), o.add(c);
2117
+ a.delete(c), i.add(c);
2118
2118
  };
2119
2119
  return p(n.id, 0), new Set(l.map((c) => {
2120
2120
  const h = e.textures.get(c);
@@ -2122,7 +2122,7 @@ function Yt(i, e) {
2122
2122
  })).size > 1 && s("LAYERED_TEXTURE_COORDINATES_DIFFER", "UV sets or transforms differ; direct pixel blending is unsafe"), [{ id: n.id, role: t.role, layers: n.textureIds.map((c, h) => ({ textureId: c, blendMode: n.blendModes[h] ?? null, alpha: n.alphas[h] ?? null })), issues: r }];
2123
2123
  });
2124
2124
  }
2125
- const qt = {
2125
+ const Kt = {
2126
2126
  DiffuseColor: "map",
2127
2127
  "Maya|TEX_color_map": "map",
2128
2128
  NormalMap: "normalMap",
@@ -2139,11 +2139,11 @@ const qt = {
2139
2139
  TransparentColor: "alphaMap",
2140
2140
  TransparencyFactor: "alphaMap"
2141
2141
  };
2142
- function Kt(i, e, t, n, r, s) {
2142
+ function Zt(o, e, t, n, r, s) {
2143
2143
  var c;
2144
- const a = (c = n.modelUvSets) == null ? void 0 : c.get(i.ID ?? NaN), o = [], l = [], p = /* @__PURE__ */ new Set();
2144
+ const a = (c = n.modelUvSets) == null ? void 0 : c.get(o.ID ?? NaN), i = [], l = [], p = /* @__PURE__ */ new Set();
2145
2145
  for (const h of t.textureConnections) {
2146
- const m = qt[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);
2146
+ const m = Kt[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);
2147
2147
  if (!m || !d || p.has(m)) continue;
2148
2148
  p.add(m);
2149
2149
  const T = e[m];
@@ -2158,24 +2158,24 @@ function Kt(i, e, t, n, r, s) {
2158
2158
  continue;
2159
2159
  }
2160
2160
  }
2161
- if (y > 3 || !i.geometry.hasAttribute(y === 0 ? "uv" : `uv${y}`)) {
2161
+ if (y > 3 || !o.geometry.hasAttribute(y === 0 ? "uv" : `uv${y}`)) {
2162
2162
  F("UV_CHANNEL_UNAVAILABLE", `channel:${y}`);
2163
2163
  continue;
2164
2164
  }
2165
2165
  const x = (R, w) => {
2166
2166
  const D = d.values.get(R);
2167
2167
  return D ? D.length < 2 || !D.every((P) => typeof P == "number" && Number.isFinite(P)) ? (F("TEXTURE_TRANSFORM_INVALID", R), w) : D : w;
2168
- }, 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((R) => R !== 0) || S.some((R) => R !== 0);
2169
- 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");
2170
- const b = E ? 0 : -(M[2] ?? 0) * Math.PI / 180;
2171
- 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 });
2168
+ }, A = x("Translation", [T.offset.x, T.offset.y, 0]), I = x("Scaling", [T.repeat.x, T.repeat.y, 1]), b = x("Rotation", [0, 0, 0]), v = x("RotationPivot", [0, 0, 0]), S = x("ScalingPivot", [0, 0, 0]), E = b[0] !== 0 || b[1] !== 0 || v.some((R) => R !== 0) || S.some((R) => R !== 0);
2169
+ E && F("TEXTURE_TRANSFORM_UNSUPPORTED", "3D-rotation-or-pivot"), (A[2] || I[2] !== void 0 && I[2] !== 1) && F("TEXTURE_TRANSFORM_UNSUPPORTED", "3D-translation-or-scale");
2170
+ const M = E ? 0 : -(b[2] ?? 0) * Math.PI / 180;
2171
+ M && l.push({ status: "approximate", code: "TEXTURE_ROTATION_PROFILE", source: `texture:${h.id}:Rotation`, target: "T * Rccw * S; origin pivot" }), (y !== T.channel || A[0] !== T.offset.x || A[1] !== T.offset.y || I[0] !== T.repeat.x || I[1] !== T.repeat.y || M !== T.rotation) && i.push({ slot: m, source: T, channel: y, offset: A, scale: I, rotation: M });
2172
2172
  }
2173
- if (!o.length && !l.length) return e;
2173
+ if (!i.length && !l.length) return e;
2174
2174
  const f = e.clone();
2175
2175
  r(f);
2176
2176
  const u = f.userData.fbxConversionReport;
2177
2177
  u.issues.push(...l);
2178
- for (const h of o) {
2178
+ for (const h of i) {
2179
2179
  const m = h.source.clone();
2180
2180
  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;
2181
2181
  const g = -h.rotation, d = Math.cos(g), T = Math.sin(g);
@@ -2193,47 +2193,47 @@ function Kt(i, e, t, n, r, s) {
2193
2193
  }
2194
2194
  return f.needsUpdate = !0, f;
2195
2195
  }
2196
- function Zt(i, e) {
2197
- return Math.min(1, Math.max(0, i));
2196
+ function Qt(o, e) {
2197
+ return Math.min(1, Math.max(0, o));
2198
2198
  }
2199
- function Qt(i, e, t, n, r = "r", s = !1) {
2200
- if (!Number.isInteger(e) || !Number.isInteger(t) || e <= 0 || t <= 0 || i.length !== e * t * 4)
2199
+ function Jt(o, e, t, n, r = "r", s = !1) {
2200
+ if (!Number.isInteger(e) || !Number.isInteger(t) || e <= 0 || t <= 0 || o.length !== e * t * 4)
2201
2201
  throw new Error("Invalid FBX scalar RGBA dimensions.");
2202
- const a = new Uint8Array(i.length), o = { r: 0, g: 1, b: 2, a: 3 }[r];
2202
+ const a = new Uint8Array(o.length), i = { r: 0, g: 1, b: 2, a: 3 }[r];
2203
2203
  for (let l = 0; l < t; l++) for (let p = 0; p < e; p++) {
2204
- const f = (l * e + p) * 4, u = ((s ? t - l - 1 : l) * e + p) * 4, c = Math.round(255 * Zt(i[f + o] / 255));
2204
+ const f = (l * e + p) * 4, u = ((s ? t - l - 1 : l) * e + p) * 4, c = Math.round(255 * Qt(o[f + i] / 255));
2205
2205
  a.fill(c, u, u + 4);
2206
2206
  }
2207
2207
  return a;
2208
2208
  }
2209
- function Jt(i, e) {
2210
- const t = i.image;
2209
+ function en(o, e) {
2210
+ const t = o.image;
2211
2211
  if (!t) throw new Error("FBX scalar texture has no decoded image.");
2212
2212
  const n = t.naturalWidth || t.width, r = t.naturalHeight || t.height;
2213
2213
  if (!n || !r) throw new Error("FBX scalar texture has no decoded image.");
2214
2214
  let s;
2215
2215
  if (t.data) {
2216
- if (!(t.data instanceof Uint8Array || t.data instanceof Uint8ClampedArray) || i.format !== Ie || i.type !== Ae)
2216
+ if (!(t.data instanceof Uint8Array || t.data instanceof Uint8ClampedArray) || o.format !== Ie || o.type !== Re)
2217
2217
  throw new Error("FBX scalar conversion requires 8-bit RGBA pixels.");
2218
2218
  s = t.data;
2219
2219
  } else {
2220
- const o = document.createElement("canvas");
2221
- o.width = n, o.height = r;
2222
- const l = o.getContext("2d", { willReadFrequently: !0 });
2220
+ const i = document.createElement("canvas");
2221
+ i.width = n, i.height = r;
2222
+ const l = i.getContext("2d", { willReadFrequently: !0 });
2223
2223
  if (!l) throw new Error("FBX scalar texture conversion requires a 2D canvas.");
2224
2224
  l.drawImage(t, 0, 0), s = l.getImageData(0, 0, n, r).data;
2225
2225
  }
2226
- const a = new ne(Qt(s, n, r, e, "r", i.flipY), n, r);
2227
- 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;
2226
+ const a = new ne(Jt(s, n, r, e, "r", o.flipY), n, r);
2227
+ return a.wrapS = o.wrapS, a.wrapT = o.wrapT, a.offset.copy(o.offset), a.repeat.copy(o.repeat), a.center.copy(o.center), a.rotation = o.rotation, a.matrix.copy(o.matrix), a.matrixAutoUpdate = o.matrixAutoUpdate, a.channel = o.channel, a.magFilter = o.magFilter, a.minFilter = o.minFilter, a.generateMipmaps = o.generateMipmaps, a.anisotropy = o.anisotropy, a.colorSpace = ot, a.needsUpdate = !0, a;
2228
2228
  }
2229
- function en(i, e, t) {
2230
- const n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), l = [];
2229
+ function tn(o, e, t) {
2230
+ const n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), l = [];
2231
2231
  try {
2232
- i.traverse((c) => {
2233
- if (!(c instanceof Fe)) return;
2232
+ o.traverse((c) => {
2233
+ if (!(c instanceof Ae)) return;
2234
2234
  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) => {
2235
- const F = m(T), y = tn(d, n, F, t, e, r, s);
2236
- return y instanceof Re && F && e ? Kt(c, y, F, e, (x) => a.add(x), (x) => o.add(x)) : y;
2235
+ const F = m(T), y = nn(d, n, F, t, e, r, s);
2236
+ return y instanceof De && F && e ? Zt(c, y, F, e, (x) => a.add(x), (x) => i.add(x)) : y;
2237
2237
  };
2238
2238
  l.push({ mesh: c, material: Array.isArray(c.material) ? c.material.map(g) : g(c.material, 0) });
2239
2239
  });
@@ -2241,7 +2241,7 @@ function en(i, e, t) {
2241
2241
  for (const [h, m] of n) h !== m && m.dispose();
2242
2242
  for (const h of r.values()) h.dispose();
2243
2243
  for (const h of a) h.dispose();
2244
- for (const h of o) h.dispose();
2244
+ for (const h of i) h.dispose();
2245
2245
  for (const h of s.values()) h.dispose();
2246
2246
  throw c;
2247
2247
  }
@@ -2254,15 +2254,15 @@ function en(i, e, t) {
2254
2254
  for (const c of r.values()) f.has(c) || c.dispose();
2255
2255
  for (const c of s.values()) f.has(c) || c.dispose();
2256
2256
  const u = [...p].flatMap((c) => c.userData.fbxConversionReport ? [c.userData.fbxConversionReport] : []);
2257
- return i.userData.fbxConversionReports = u, u;
2257
+ return o.userData.fbxConversionReports = u, u;
2258
2258
  }
2259
- function tn(i, e, t, n, r, s = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map()) {
2260
- var E, b, R;
2261
- const o = e.get(i);
2262
- if (o) return o;
2263
- if (!(i instanceof W) && !(i instanceof Se))
2264
- return e.set(i, i), i;
2265
- const l = i instanceof W ? i : null, p = (w, D) => {
2259
+ function nn(o, e, t, n, r, s = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map()) {
2260
+ var E, M, R;
2261
+ const i = e.get(o);
2262
+ if (i) return i;
2263
+ if (!(o instanceof W) && !(o instanceof Fe))
2264
+ return e.set(o, o), o;
2265
+ const l = o instanceof W ? o : null, p = (w, D) => {
2266
2266
  var _;
2267
2267
  const P = (_ = t == null ? void 0 : t.values.get(w)) == null ? void 0 : _[0];
2268
2268
  return typeof P == "number" && Number.isFinite(P) ? P : D;
@@ -2270,41 +2270,41 @@ function tn(i, e, t, n, r, s = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ ne
2270
2270
  const P = t == null ? void 0 : t.values.get(w);
2271
2271
  return P && P.length >= 3 && P.slice(0, 3).every((_) => typeof _ == "number" && Number.isFinite(_)) ? new k().setRGB(P[0], P[1], P[2]) : D.clone();
2272
2272
  }, u = (w) => Math.min(1, Math.max(0, w)), c = u(p("SpecularFactor", 0.25) * 2), h = Math.sqrt(0.08 * c), m = (1 + h) / (1 - h);
2273
- let g = i.opacity;
2273
+ let g = o.opacity;
2274
2274
  if (t && (g = 1 - p("TransparencyFactor", 0), g === 0 || g === 1)) {
2275
2275
  const w = (E = t.ownValues.get("Opacity")) == null ? void 0 : E[0];
2276
2276
  g = typeof w == "number" && Number.isFinite(w) ? w : 1 - f("TransparentColor", new k(0)).r;
2277
2277
  }
2278
- const d = new Re({
2279
- name: i.name,
2278
+ const d = new De({
2279
+ name: o.name,
2280
2280
  // FBX diffuse textures supply the base color (as in Blender's importer),
2281
2281
  // not an additional tint. Multiplying the atlas by DiffuseColor can turn
2282
2282
  // blue atlas regions black when the material's constant color is red.
2283
- color: i.map ? new k(16777215) : f("DiffuseColor", t ? new k(1, 1, 1) : i.color),
2284
- map: i.map,
2285
- emissive: i.emissiveMap ? new k(16777215) : f("EmissiveColor", t ? new k(0) : i.emissive),
2286
- emissiveMap: i.emissiveMap,
2287
- emissiveIntensity: p("EmissiveFactor", t ? 1 : i.emissiveIntensity),
2288
- normalMap: i.normalMap,
2289
- normalMapType: i.normalMapType,
2290
- normalScale: i.normalScale.clone().setScalar(p("BumpFactor", 1)),
2291
- bumpMap: i.bumpMap,
2292
- bumpScale: i.bumpScale,
2293
- displacementMap: i.displacementMap,
2294
- displacementScale: i.displacementScale,
2295
- displacementBias: i.displacementBias,
2296
- aoMap: i.aoMap,
2297
- aoMapIntensity: i.aoMapIntensity,
2298
- alphaMap: i.alphaMap,
2283
+ color: o.map ? new k(16777215) : f("DiffuseColor", t ? new k(1, 1, 1) : o.color),
2284
+ map: o.map,
2285
+ emissive: o.emissiveMap ? new k(16777215) : f("EmissiveColor", t ? new k(0) : o.emissive),
2286
+ emissiveMap: o.emissiveMap,
2287
+ emissiveIntensity: p("EmissiveFactor", t ? 1 : o.emissiveIntensity),
2288
+ normalMap: o.normalMap,
2289
+ normalMapType: o.normalMapType,
2290
+ normalScale: o.normalScale.clone().setScalar(p("BumpFactor", 1)),
2291
+ bumpMap: o.bumpMap,
2292
+ bumpScale: o.bumpScale,
2293
+ displacementMap: o.displacementMap,
2294
+ displacementScale: o.displacementScale,
2295
+ displacementBias: o.displacementBias,
2296
+ aoMap: o.aoMap,
2297
+ aoMapIntensity: o.aoMapIntensity,
2298
+ alphaMap: o.alphaMap,
2299
2299
  opacity: u(g),
2300
- transparent: i.transparent || g < 1,
2301
- alphaTest: i.alphaTest,
2302
- side: i.side,
2303
- depthTest: i.depthTest,
2304
- depthWrite: i.depthWrite,
2305
- vertexColors: i.vertexColors,
2306
- wireframe: i.wireframe,
2307
- flatShading: i.flatShading,
2300
+ transparent: o.transparent || g < 1,
2301
+ alphaTest: o.alphaTest,
2302
+ side: o.side,
2303
+ depthTest: o.depthTest,
2304
+ depthWrite: o.depthWrite,
2305
+ vertexColors: o.vertexColors,
2306
+ wireframe: o.wireframe,
2307
+ flatShading: o.flatShading,
2308
2308
  metalness: u(p("ReflectionFactor", 0)),
2309
2309
  ior: m,
2310
2310
  specularIntensity: 1,
@@ -2312,20 +2312,20 @@ function tn(i, e, t, n, r, s = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ ne
2312
2312
  // This is an importer convention, not an exact BRDF conversion.
2313
2313
  roughness: t || l ? u(1 - Math.sqrt(Math.max(0, p("Shininess", t ? 20 : l.shininess))) / 10) : 1
2314
2314
  });
2315
- e.set(i, d);
2315
+ e.set(o, d);
2316
2316
  const T = (w) => {
2317
2317
  let D = s.get(w);
2318
- return D || (D = Jt(w, "identity"), s.set(w, D)), D;
2319
- }, F = t && r ? Yt(t, r) : [], y = [];
2318
+ return D || (D = en(w, "identity"), s.set(w, D)), D;
2319
+ }, F = t && r ? qt(t, r) : [], y = [];
2320
2320
  for (const w of F)
2321
2321
  if (!(!["DiffuseColor", "EmissiveColor"].includes(w.role) || !r || !n) && t.textureConnections.filter((D) => D.role === w.role).length === 1)
2322
2322
  try {
2323
2323
  let D = a.get(w.id);
2324
- D || (D = Wt(w, r, n), a.set(w.id, D)), w.role === "DiffuseColor" ? (d.map = D, d.color.setRGB(1, 1, 1)) : (d.emissiveMap = D, d.emissive.setRGB(1, 1, 1)), w.issues = [], y.push(w.id);
2324
+ D || (D = Yt(w, r, n), a.set(w.id, D)), w.role === "DiffuseColor" ? (d.map = D, d.color.setRGB(1, 1, 1)) : (d.emissiveMap = D, d.emissive.setRGB(1, 1, 1)), w.issues = [], y.push(w.id);
2325
2325
  } catch (D) {
2326
2326
  w.issues.push({ status: "unsupported", code: "LAYERED_TEXTURE_BAKE_REJECTED", source: `layered:${w.id}:${D instanceof Error ? D.message : String(D)}`, target: w.role });
2327
2327
  }
2328
- const x = /* @__PURE__ */ new Set(), I = [], A = /* @__PURE__ */ new Set(), M = {
2328
+ const x = /* @__PURE__ */ new Set(), A = [], I = /* @__PURE__ */ new Set(), b = {
2329
2329
  ReflectionFactor: "metalnessMap",
2330
2330
  ReflectionColor: "metalnessMap",
2331
2331
  ShininessExponent: "roughnessMap",
@@ -2335,18 +2335,18 @@ function tn(i, e, t, n, r, s = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ ne
2335
2335
  TransparencyFactor: "alphaMap"
2336
2336
  };
2337
2337
  for (const w of (t == null ? void 0 : t.textureConnections) ?? []) {
2338
- if ((b = r == null ? void 0 : r.layeredTextures) != null && b.has(w.id)) continue;
2338
+ if ((M = r == null ? void 0 : r.layeredTextures) != null && M.has(w.id)) continue;
2339
2339
  const D = [...n ?? []].find((_) => _.ID === w.id);
2340
2340
  if (!D) {
2341
- I.push(`texture:${w.id}:unresolved:${w.role}`);
2341
+ A.push(`texture:${w.id}:unresolved:${w.role}`);
2342
2342
  continue;
2343
2343
  }
2344
- const P = M[w.role];
2345
- if (P && A.has(P)) {
2346
- I.push(`conflicting-input:${w.role}:${P}`);
2344
+ const P = b[w.role];
2345
+ if (P && I.has(P)) {
2346
+ A.push(`conflicting-input:${w.role}:${P}`);
2347
2347
  continue;
2348
2348
  }
2349
- switch (P && A.add(P), w.role) {
2349
+ switch (P && I.add(P), w.role) {
2350
2350
  case "ReflectionFactor":
2351
2351
  case "ReflectionColor":
2352
2352
  d.metalnessMap = T(D), d.metalness = 1, x.add(w.role);
@@ -2364,7 +2364,7 @@ function tn(i, e, t, n, r, s = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ ne
2364
2364
  break;
2365
2365
  }
2366
2366
  }
2367
- d.userData = { ...i.userData, fbxMaterialId: t == null ? void 0 : t.id };
2367
+ d.userData = { ...o.userData, fbxMaterialId: t == null ? void 0 : t.id };
2368
2368
  const v = (t == null ? void 0 : t.textureRoles.filter((w) => ![
2369
2369
  "DiffuseColor",
2370
2370
  "Maya|TEX_color_map",
@@ -2377,81 +2377,97 @@ function tn(i, e, t, n, r, s = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ ne
2377
2377
  "TransparencyFactor",
2378
2378
  "Maya|TEX_ao_map"
2379
2379
  ].includes(w) && !x.has(w))) ?? [];
2380
- v.push(...I);
2380
+ v.push(...A);
2381
2381
  for (const w of (t == null ? void 0 : t.textureConnections) ?? [])
2382
2382
  !(r == null ? void 0 : r.textures.get(w.id)) && !((R = r == null ? void 0 : r.layeredTextures) != null && R.has(w.id)) && v.push(`texture:${w.id}:layered-or-unknown`);
2383
- t && !["phong", "lambert"].includes(t.shadingModel) && v.push(`shader:${t.shadingModel}`), v.length && (d.userData.fbxUnsupportedTextureRoles = v, console.warn(`[viewer] FBX material ${i.name}: unsupported texture semantics: ${v.join(", ")}`));
2383
+ t && !["phong", "lambert"].includes(t.shadingModel) && v.push(`shader:${t.shadingModel}`), v.length && (d.userData.fbxUnsupportedTextureRoles = v, console.warn(`[viewer] FBX material ${o.name}: unsupported texture semantics: ${v.join(", ")}`));
2384
2384
  const S = {
2385
2385
  layerStacks: F,
2386
2386
  strategy: "blender-compatible-v1",
2387
2387
  materialId: t == null ? void 0 : t.id,
2388
- materialName: i.name,
2388
+ materialName: o.name,
2389
2389
  mappings: [
2390
2390
  { source: "DiffuseColor", target: "color/map", rule: "texture replaces constant; raw constant RGB otherwise" },
2391
2391
  { source: "Shininess", target: "roughness", rule: "clamp(1-sqrt(max(0,s))/10); empirical approximation" },
2392
2392
  { source: "ReflectionFactor", target: "metalness", rule: "clamp(value); importer convention" },
2393
2393
  { source: "SpecularFactor", target: "ior", rule: "match normal-incidence F0 only" },
2394
- ...[...x].map((w) => ({ source: w, target: M[w], rule: "raw R; identity; replaces scalar constant" }))
2394
+ ...[...x].map((w) => ({ source: w, target: b[w], rule: "raw R; identity; replaces scalar constant" }))
2395
2395
  ],
2396
2396
  issues: [
2397
2397
  ...F.flatMap((w) => w.issues),
2398
2398
  ...y.map((w) => ({ status: "approximate", code: "LAYERED_TEXTURE_BAKED", source: `layered:${w}:linear-color-v1; opaque base; first connection bottom`, target: "RGBA8 color texture" })),
2399
- { status: "approximate", code: "PHONG_TO_PBR", source: (t == null ? void 0 : t.shadingModel) ?? i.type, target: "MeshPhysicalMaterial" },
2399
+ { status: "approximate", code: "PHONG_TO_PBR", source: (t == null ? void 0 : t.shadingModel) ?? o.type, target: "MeshPhysicalMaterial" },
2400
2400
  ...v.map((w) => ({ status: "unsupported", code: "UNSUPPORTED_SEMANTICS", source: w }))
2401
2401
  ]
2402
2402
  };
2403
- 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;
2403
+ return d.userData.fbxConversionReport = S, d.visible = o.visible, d.toneMapped = o.toneMapped, d.clippingPlanes = o.clippingPlanes, d.clipIntersection = o.clipIntersection, d.clipShadows = o.clipShadows, d.polygonOffset = o.polygonOffset, d.polygonOffsetFactor = o.polygonOffsetFactor, d.polygonOffsetUnits = o.polygonOffsetUnits, d.dithering = o.dithering, d.needsUpdate = !0, e.set(o, d), d;
2404
+ }
2405
+ const ue = "viewer-package:///";
2406
+ function rn(o) {
2407
+ const e = o.replaceAll("\\", "/").split("/").filter(Boolean).map((t) => encodeURIComponent(t)).join("/");
2408
+ return `${ue}${e}`;
2409
+ }
2410
+ function sn(o, e) {
2411
+ if (!o.resolveSync || !e.startsWith(ue)) return e;
2412
+ const t = e.slice(ue.length).split(/[?#]/, 1)[0] ?? "";
2413
+ let n = t;
2414
+ try {
2415
+ n = decodeURIComponent(t);
2416
+ } catch {
2417
+ return e;
2418
+ }
2419
+ return o.resolveSync(n) ?? e;
2404
2420
  }
2405
- function fn(i, e) {
2406
- let t = !1, n = null, r = null, s = "z", a, o = null, l;
2421
+ function mn(o, e) {
2422
+ let t = !1, n = null, r = null, s = "z", a, i = null, l;
2407
2423
  const p = () => {
2408
2424
  t = !0;
2409
2425
  }, f = (async () => {
2410
- s = e.options.upAxis ?? ge(e.format);
2426
+ s = e.options.upAxis ?? ye(e.format);
2411
2427
  let u = null;
2412
2428
  try {
2413
2429
  if (t || e.signal.aborted) throw le();
2414
- const c = i.url ?? await i.resolve(i.entryPath ?? "");
2430
+ const c = e.format !== "fbx" && typeof o.original == "object" && o.original !== null && "kind" in o.original && o.original.kind === "files" && o.entryPath && o.resolveSync ? rn(o.entryPath) : null, h = o.url ?? c ?? await o.resolve(o.entryPath ?? "");
2415
2431
  if (u = new ce(), u.name = "viewer-model-root", e.format === "fbx") {
2416
- const m = await fetch(c, { signal: e.signal });
2417
- if (!m.ok) throw new Error(`FBX request failed: ${m.status} ${m.statusText}`);
2418
- const g = await m.arrayBuffer();
2419
- s = e.options.upAxis ?? Ut(g) ?? ge(e.format);
2420
- const d = Vt(g), T = await Ct(g, i, d);
2421
- l = T.textures, u.add(T.root);
2422
- const y = en(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}`));
2423
- y.length && (o = {
2432
+ const g = await fetch(h, { signal: e.signal });
2433
+ if (!g.ok) throw new Error(`FBX request failed: ${g.status} ${g.statusText}`);
2434
+ const d = await g.arrayBuffer();
2435
+ s = e.options.upAxis ?? Bt(d) ?? ye(e.format);
2436
+ const T = Gt(d), F = await Lt(d, o, T);
2437
+ l = F.textures, u.add(F.root);
2438
+ const x = tn(u, T, l).flatMap((I) => I.issues.filter((b) => b.status === "unsupported" || b.code === "TEXTURE_ROTATION_PROFILE" || b.code === "LAYERED_TEXTURE_BAKED").map((b) => `${I.materialName || I.materialId || "material"}: ${b.source}`));
2439
+ x.length && (i = {
2424
2440
  code: "W_FBX_MATERIAL_APPROXIMATED",
2425
2441
  stage: "material-conversion",
2426
- message: `FBX 材质存在未支持或按兼容规则近似处理的语义:${[...new Set(y)].join("、")}。当前为近似预览。`
2442
+ message: `FBX 材质存在未支持或按兼容规则近似处理的语义:${[...new Set(x)].join("、")}。当前为近似预览。`
2427
2443
  });
2428
- const x = [...new Set(T.textureFailures)];
2429
- x.length && (o = {
2444
+ const A = [...new Set(F.textureFailures)];
2445
+ A.length && (i = {
2430
2446
  code: "W_FBX_TEXTURE_UNAVAILABLE",
2431
2447
  stage: "material-conversion",
2432
- message: `FBX 贴图缺失或加载失败,已按无贴图降级显示:${x.join("、")}。${o ? `另有材质近似处理:${o.message}` : ""}`
2448
+ message: `FBX 贴图缺失或加载失败,已按无贴图降级显示:${A.join("、")}。${i ? `另有材质近似处理:${i.message}` : ""}`
2433
2449
  });
2434
2450
  } else {
2435
- const m = new it(), g = new lt();
2451
+ const g = new lt(), d = new ct();
2436
2452
  try {
2437
- m.setDecoderPath(
2438
- e.options.dracoDecoderPath ?? mt("draco")
2439
- ), g.setDRACOLoader(m);
2440
- const d = await g.loadAsync(c), T = d.scenes.filter((F) => F !== d.scene);
2441
- if (u.add(d.scene), t || e.signal.aborted) {
2442
- for (const F of T) u.add(F);
2453
+ c && d.manager.setURLModifier((y) => sn(o, y)), g.setDecoderPath(
2454
+ e.options.dracoDecoderPath ?? gt("draco")
2455
+ ), d.setDRACOLoader(g);
2456
+ const T = await d.loadAsync(h), F = T.scenes.filter((y) => y !== T.scene);
2457
+ if (u.add(T.scene), t || e.signal.aborted) {
2458
+ for (const y of F) u.add(y);
2443
2459
  throw le();
2444
2460
  }
2445
2461
  } finally {
2446
- m.dispose();
2462
+ g.dispose();
2447
2463
  }
2448
2464
  }
2449
2465
  if (t || e.signal.aborted) throw le();
2450
- ye(u, s), nn(u);
2451
- const h = new ct(u, e.options.simulationTheme, void 0, "model");
2452
- h.setCacheInvalidationCallback(e.invalidateTransmissionCaches), n = u, r = h, u = null;
2466
+ we(u, s), an(u);
2467
+ const m = new ut(u, e.options.simulationTheme, void 0, "model");
2468
+ m.setCacheInvalidationCallback(e.invalidateTransmissionCaches), n = u, r = m, u = null;
2453
2469
  } finally {
2454
- u && (we(u, l), l = void 0);
2470
+ u && (ve(u, l), l = void 0);
2455
2471
  }
2456
2472
  })();
2457
2473
  return f.catch(() => {
@@ -2459,7 +2475,7 @@ function fn(i, e) {
2459
2475
  id: `model-${Math.random().toString(36).slice(2)}`,
2460
2476
  opened: f,
2461
2477
  get warning() {
2462
- return o;
2478
+ return i;
2463
2479
  },
2464
2480
  get root() {
2465
2481
  return (r == null ? void 0 : r.root) ?? null;
@@ -2488,10 +2504,10 @@ function fn(i, e) {
2488
2504
  return (r == null ? void 0 : r.getGroundVisible()) ?? !0;
2489
2505
  },
2490
2506
  getGroundGridScale() {
2491
- return (r == null ? void 0 : r.getGroundGridScale()) ?? ut;
2507
+ return (r == null ? void 0 : r.getGroundGridScale()) ?? pt;
2492
2508
  },
2493
2509
  setUpAxis(u) {
2494
- if (t || !n || !r || !ye(n, u)) return;
2510
+ if (t || !n || !r || !we(n, u)) return;
2495
2511
  s = u, r.reseatGround();
2496
2512
  const c = r.getModelBounds();
2497
2513
  e.requestRender(), e.fit(c, { padding: 1.15 });
@@ -2500,14 +2516,14 @@ function fn(i, e) {
2500
2516
  dispose() {
2501
2517
  return p(), a ?? (a = f.catch(() => {
2502
2518
  }).then(() => {
2503
- r == null || r.dispose(), r = null, n && we(n, l), n = null, l = void 0;
2519
+ r == null || r.dispose(), r = null, n && ve(n, l), n = null, l = void 0;
2504
2520
  })), a;
2505
2521
  }
2506
2522
  };
2507
2523
  }
2508
- function nn(i) {
2509
- i.updateMatrixWorld(!0);
2510
- const e = new ot().setFromObject(i);
2524
+ function an(o) {
2525
+ o.updateMatrixWorld(!0);
2526
+ const e = new it().setFromObject(o);
2511
2527
  if (e.isEmpty()) throw new Error("模型不包含可显示的几何内容。");
2512
2528
  const t = e.getSize(new V()), n = Math.max(t.x, t.y, t.z);
2513
2529
  if (!Number.isFinite(n) || n <= 0) throw new Error("模型尺寸无效。");
@@ -2516,5 +2532,5 @@ function le() {
2516
2532
  return Object.assign(new Error("Model load aborted."), { name: "AbortError", code: "E_ABORTED" });
2517
2533
  }
2518
2534
  export {
2519
- fn as createModelSession
2535
+ mn as createModelSession
2520
2536
  };