@shopware-ag/dive 2.0.1-beta.8 → 2.0.1-beta.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/build/chunks/AssetCache-CWeKL4PT.cjs +1 -0
  2. package/build/chunks/AssetCache-Y5G3mQU1.mjs +84 -0
  3. package/build/chunks/{AssetExporter-QnOue3VT.mjs → AssetExporter-CcSkkmZL.mjs} +4 -3
  4. package/build/chunks/{AssetExporter-TzKB2FHh.cjs → AssetExporter-Ds2dAfxL.cjs} +18 -18
  5. package/build/chunks/AssetLoader-CMKzMJ1u.cjs +4 -0
  6. package/build/chunks/{AssetLoader-C8Teswp4.mjs → AssetLoader-DjHz5xWK.mjs} +513 -516
  7. package/build/chunks/{FileTypes-B2JRjVgw.cjs → FileTypes-CKOjpHjz.cjs} +1 -1
  8. package/build/chunks/{FileTypes-CXnW0NAe.mjs → FileTypes-Cu4s3c_0.mjs} +1 -1
  9. package/build/chunks/{SelectTool-DVqL2ebn.cjs → SelectTool-BD6Ccy_2.cjs} +1 -1
  10. package/build/chunks/{SelectTool-DFpr9XHT.mjs → SelectTool-w7sF1obN.mjs} +1 -1
  11. package/build/chunks/file-type-error-BsK7IJt7.cjs +1 -0
  12. package/build/chunks/file-type-error-aWHfMumr.mjs +8 -0
  13. package/build/chunks/isFileTypeSupported-BSpswPHU.mjs +12 -0
  14. package/build/chunks/isFileTypeSupported-CrEqYiv9.cjs +1 -0
  15. package/build/chunks/network-error-BONfHWQq.mjs +14 -0
  16. package/build/chunks/network-error-CdDXil5g.cjs +1 -0
  17. package/build/chunks/package-DXbIn_zz.mjs +39 -0
  18. package/build/chunks/package-DaKgG9tF.cjs +1 -0
  19. package/build/chunks/parse-error-IryNa_oq.mjs +8 -0
  20. package/build/chunks/parse-error-m5cNt1UV.cjs +1 -0
  21. package/build/dive.cjs +1 -1
  22. package/build/dive.mjs +27 -24
  23. package/build/plugins/ar/index.cjs +1 -1
  24. package/build/plugins/ar/index.mjs +59 -54
  25. package/build/plugins/assetcache/index.cjs +1 -0
  26. package/build/plugins/assetcache/index.d.ts +2 -0
  27. package/build/plugins/assetcache/index.mjs +5 -0
  28. package/build/plugins/assetexporter/index.cjs +1 -1
  29. package/build/plugins/assetexporter/index.mjs +1 -1
  30. package/build/plugins/assetloader/index.cjs +1 -1
  31. package/build/plugins/assetloader/index.mjs +1 -1
  32. package/build/plugins/axiscamera/index.cjs +1 -1
  33. package/build/plugins/axiscamera/index.mjs +1 -1
  34. package/build/plugins/state/index.cjs +1 -1
  35. package/build/plugins/state/index.mjs +2 -2
  36. package/build/plugins/systeminfo/index.mjs +1 -1
  37. package/build/plugins/toolbox/index.cjs +1 -1
  38. package/build/plugins/toolbox/index.mjs +2 -2
  39. package/build/src/error/file-content/file-content-error.d.ts +4 -0
  40. package/build/src/error/index.d.ts +4 -0
  41. package/build/src/error/network/network-error.d.ts +1 -1
  42. package/build/src/error/parse/parse-error.d.ts +2 -1
  43. package/build/src/events/dispatcher/EventDispatcher.d.ts +6 -0
  44. package/build/src/events/index.d.ts +1 -1
  45. package/build/src/index.d.ts +1 -3
  46. package/build/src/plugins/ar/src/error/ar-errors.d.ts +7 -1
  47. package/build/src/plugins/ar/src/webxr/raycaster/WebXRRaycaster.d.ts +1 -1
  48. package/build/src/plugins/ar/src/webxr/touchscreencontrols/WebXRTouchscreenControls.d.ts +1 -1
  49. package/build/src/plugins/assetcache/index.d.ts +1 -0
  50. package/build/src/plugins/assetcache/src/cache/AssetCache.d.ts +11 -0
  51. package/build/src/plugins/assetcache/src/chunk/Chunk.d.ts +19 -0
  52. package/build/src/plugins/assetcache/src/index.d.ts +2 -0
  53. package/build/src/plugins/assetloader/src/loader/AssetLoader.d.ts +0 -1
  54. package/build/src/plugins/systeminfo/src/SystemInfo.d.ts +1 -1
  55. package/package.json +6 -1
  56. package/build/chunks/AssetLoader-BfPa_oNd.cjs +0 -4
  57. package/build/chunks/network-error-CHvryg-4.mjs +0 -18
  58. package/build/chunks/network-error-D_pq8VU6.cjs +0 -1
  59. package/build/chunks/package-BBfJ2Cc5.cjs +0 -1
  60. package/build/chunks/package-CHFUaMpF.mjs +0 -39
  61. package/build/chunks/parse-error-BFRJyIxM.mjs +0 -14
  62. package/build/chunks/parse-error-Bd09D_1L.cjs +0 -1
  63. package/build/src/events/EventExecutor.d.ts +0 -5
@@ -1,35 +1,37 @@
1
1
  var ve = Object.defineProperty;
2
2
  var Be = (d, e, t) => e in d ? ve(d, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : d[e] = t;
3
3
  var v = (d, e, t) => Be(d, typeof e != "symbol" ? e + "" : e, t);
4
- import { TrianglesDrawMode as je, TriangleFanDrawMode as re, TriangleStripDrawMode as be, Loader as ae, LoaderUtils as X, FileLoader as K, MeshPhysicalMaterial as O, Vector2 as q, Color as U, LinearSRGBColorSpace as D, SRGBColorSpace as N, SpotLight as Ke, PointLight as Ve, DirectionalLight as We, Matrix4 as Y, Vector3 as B, Quaternion as Le, InstancedMesh as Xe, InstancedBufferAttribute as ze, Object3D as ce, TextureLoader as Me, ImageBitmapLoader as qe, BufferAttribute as P, InterleavedBuffer as Ye, InterleavedBufferAttribute as Je, LinearMipmapLinearFilter as Ie, NearestMipmapLinearFilter as Qe, LinearMipmapNearestFilter as Ze, NearestMipmapNearestFilter as $e, LinearFilter as Ce, NearestFilter as et, RepeatWrapping as J, MirroredRepeatWrapping as Ne, ClampToEdgeWrapping as De, PointsMaterial as tt, Material as Z, LineBasicMaterial as nt, MeshStandardMaterial as Oe, DoubleSide as st, MeshBasicMaterial as W, PropertyBinding as rt, BufferGeometry as ue, SkinnedMesh as ot, Mesh as Pe, LineSegments as it, Line as at, LineLoop as ct, Points as ut, Group as z, PerspectiveCamera as lt, MathUtils as ft, OrthographicCamera as dt, Skeleton as ht, AnimationClip as pt, Bone as mt, InterpolateDiscrete as gt, InterpolateLinear as ke, Texture as de, VectorKeyframeTrack as he, NumberKeyframeTrack as pe, QuaternionKeyframeTrack as me, ColorManagement as ge, FrontSide as At, Interpolant as Tt, Box3 as yt, Sphere as Rt, NoColorSpace as H } from "three";
5
- import { u as xt, a as Ae } from "./fflate.module-xyO_T3Zm.mjs";
6
- import { S as _t } from "./FileTypes-CXnW0NAe.mjs";
7
- import { N as Te, g as wt, i as Et } from "./network-error-CHvryg-4.mjs";
8
- import { F as ye, P as Re } from "./parse-error-BFRJyIxM.mjs";
9
- function xe(d, e) {
4
+ import { TrianglesDrawMode as je, TriangleFanDrawMode as re, TriangleStripDrawMode as be, Loader as ae, LoaderUtils as X, FileLoader as K, MeshPhysicalMaterial as O, Vector2 as q, Color as U, LinearSRGBColorSpace as D, SRGBColorSpace as N, SpotLight as Ke, PointLight as Ve, DirectionalLight as We, Matrix4 as Y, Vector3 as B, Quaternion as Le, InstancedMesh as Xe, InstancedBufferAttribute as ze, Object3D as ce, TextureLoader as Me, ImageBitmapLoader as qe, BufferAttribute as P, InterleavedBuffer as Ye, InterleavedBufferAttribute as Je, LinearMipmapLinearFilter as Ie, NearestMipmapLinearFilter as Qe, LinearMipmapNearestFilter as Ze, NearestMipmapNearestFilter as $e, LinearFilter as Ce, NearestFilter as et, RepeatWrapping as J, MirroredRepeatWrapping as Ne, ClampToEdgeWrapping as De, PointsMaterial as tt, Material as Z, LineBasicMaterial as nt, MeshStandardMaterial as Oe, DoubleSide as st, MeshBasicMaterial as W, PropertyBinding as rt, BufferGeometry as ue, SkinnedMesh as ot, Mesh as Pe, LineSegments as it, Line as at, LineLoop as ct, Points as ut, Group as z, PerspectiveCamera as lt, MathUtils as ft, OrthographicCamera as dt, Skeleton as ht, AnimationClip as pt, Bone as mt, InterpolateDiscrete as gt, InterpolateLinear as ke, Texture as de, VectorKeyframeTrack as he, NumberKeyframeTrack as pe, QuaternionKeyframeTrack as me, ColorManagement as ge, FrontSide as At, Interpolant as Tt, Box3 as yt, Sphere as xt, NoColorSpace as H } from "three";
5
+ import { u as Rt, a as Ae } from "./fflate.module-xyO_T3Zm.mjs";
6
+ import { S as _t } from "./FileTypes-Cu4s3c_0.mjs";
7
+ import { g as wt, i as Et } from "./isFileTypeSupported-BSpswPHU.mjs";
8
+ import { F as Te } from "./file-type-error-aWHfMumr.mjs";
9
+ import { P as ye } from "./parse-error-IryNa_oq.mjs";
10
+ import { A as xe } from "./AssetCache-Y5G3mQU1.mjs";
11
+ function Re(d, e) {
10
12
  if (e === je)
11
13
  return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."), d;
12
14
  if (e === re || e === be) {
13
15
  let t = d.getIndex();
14
16
  if (t === null) {
15
- const s = [], a = d.getAttribute("position");
17
+ const n = [], a = d.getAttribute("position");
16
18
  if (a !== void 0) {
17
19
  for (let i = 0; i < a.count; i++)
18
- s.push(i);
19
- d.setIndex(s), t = d.getIndex();
20
+ n.push(i);
21
+ d.setIndex(n), t = d.getIndex();
20
22
  } else
21
23
  return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."), d;
22
24
  }
23
- const o = t.count - 2, n = [];
25
+ const o = t.count - 2, s = [];
24
26
  if (e === re)
25
- for (let s = 1; s <= o; s++)
26
- n.push(t.getX(0)), n.push(t.getX(s)), n.push(t.getX(s + 1));
27
+ for (let n = 1; n <= o; n++)
28
+ s.push(t.getX(0)), s.push(t.getX(n)), s.push(t.getX(n + 1));
27
29
  else
28
- for (let s = 0; s < o; s++)
29
- s % 2 === 0 ? (n.push(t.getX(s)), n.push(t.getX(s + 1)), n.push(t.getX(s + 2))) : (n.push(t.getX(s + 2)), n.push(t.getX(s + 1)), n.push(t.getX(s)));
30
- n.length / 3 !== o && console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");
30
+ for (let n = 0; n < o; n++)
31
+ n % 2 === 0 ? (s.push(t.getX(n)), s.push(t.getX(n + 1)), s.push(t.getX(n + 2))) : (s.push(t.getX(n + 2)), s.push(t.getX(n + 1)), s.push(t.getX(n)));
32
+ s.length / 3 !== o && console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");
31
33
  const r = d.clone();
32
- return r.setIndex(n), r.clearGroups(), r;
34
+ return r.setIndex(s), r.clearGroups(), r;
33
35
  } else
34
36
  return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:", e), d;
35
37
  }
@@ -69,23 +71,23 @@ class St extends ae {
69
71
  return new Kt(t);
70
72
  });
71
73
  }
72
- load(e, t, o, n) {
74
+ load(e, t, o, s) {
73
75
  const r = this;
74
- let s;
76
+ let n;
75
77
  if (this.resourcePath !== "")
76
- s = this.resourcePath;
78
+ n = this.resourcePath;
77
79
  else if (this.path !== "") {
78
80
  const c = X.extractUrlBase(e);
79
- s = X.resolveURL(c, this.path);
81
+ n = X.resolveURL(c, this.path);
80
82
  } else
81
- s = X.extractUrlBase(e);
83
+ n = X.extractUrlBase(e);
82
84
  this.manager.itemStart(e);
83
85
  const a = function(c) {
84
- n ? n(c) : console.error(c), r.manager.itemError(e), r.manager.itemEnd(e);
86
+ s ? s(c) : console.error(c), r.manager.itemError(e), r.manager.itemEnd(e);
85
87
  }, i = new K(this.manager);
86
88
  i.setPath(this.path), i.setResponseType("arraybuffer"), i.setRequestHeader(this.requestHeader), i.setWithCredentials(this.withCredentials), i.load(e, function(c) {
87
89
  try {
88
- r.parse(c, s, function(u) {
90
+ r.parse(c, n, function(u) {
89
91
  t(u), r.manager.itemEnd(e);
90
92
  }, a);
91
93
  } catch (u) {
@@ -113,26 +115,26 @@ class St extends ae {
113
115
  unregister(e) {
114
116
  return this.pluginCallbacks.indexOf(e) !== -1 && this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e), 1), this;
115
117
  }
116
- parse(e, t, o, n) {
118
+ parse(e, t, o, s) {
117
119
  let r;
118
- const s = {}, a = {}, i = new TextDecoder();
120
+ const n = {}, a = {}, i = new TextDecoder();
119
121
  if (typeof e == "string")
120
122
  r = JSON.parse(e);
121
123
  else if (e instanceof ArrayBuffer)
122
124
  if (i.decode(new Uint8Array(e, 0, 4)) === Fe) {
123
125
  try {
124
- s[b.KHR_BINARY_GLTF] = new Vt(e);
126
+ n[b.KHR_BINARY_GLTF] = new Vt(e);
125
127
  } catch (l) {
126
- n && n(l);
128
+ s && s(l);
127
129
  return;
128
130
  }
129
- r = JSON.parse(s[b.KHR_BINARY_GLTF].content);
131
+ r = JSON.parse(n[b.KHR_BINARY_GLTF].content);
130
132
  } else
131
133
  r = JSON.parse(i.decode(e));
132
134
  else
133
135
  r = e;
134
136
  if (r.asset === void 0 || r.asset.version[0] < 2) {
135
- n && n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));
137
+ s && s(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));
136
138
  return;
137
139
  }
138
140
  const c = new sn(r, {
@@ -146,34 +148,34 @@ class St extends ae {
146
148
  c.fileLoader.setRequestHeader(this.requestHeader);
147
149
  for (let u = 0; u < this.pluginCallbacks.length; u++) {
148
150
  const l = this.pluginCallbacks[u](c);
149
- l.name || console.error("THREE.GLTFLoader: Invalid plugin found: missing name"), a[l.name] = l, s[l.name] = !0;
151
+ l.name || console.error("THREE.GLTFLoader: Invalid plugin found: missing name"), a[l.name] = l, n[l.name] = !0;
150
152
  }
151
153
  if (r.extensionsUsed)
152
154
  for (let u = 0; u < r.extensionsUsed.length; ++u) {
153
155
  const l = r.extensionsUsed[u], f = r.extensionsRequired || [];
154
156
  switch (l) {
155
157
  case b.KHR_MATERIALS_UNLIT:
156
- s[l] = new Mt();
158
+ n[l] = new Mt();
157
159
  break;
158
160
  case b.KHR_DRACO_MESH_COMPRESSION:
159
- s[l] = new Wt(r, this.dracoLoader);
161
+ n[l] = new Wt(r, this.dracoLoader);
160
162
  break;
161
163
  case b.KHR_TEXTURE_TRANSFORM:
162
- s[l] = new Xt();
164
+ n[l] = new Xt();
163
165
  break;
164
166
  case b.KHR_MESH_QUANTIZATION:
165
- s[l] = new zt();
167
+ n[l] = new zt();
166
168
  break;
167
169
  default:
168
170
  f.indexOf(l) >= 0 && a[l] === void 0 && console.warn('THREE.GLTFLoader: Unknown extension "' + l + '".');
169
171
  }
170
172
  }
171
- c.setExtensions(s), c.setPlugins(a), c.parse(o, n);
173
+ c.setExtensions(n), c.setPlugins(a), c.parse(o, s);
172
174
  }
173
175
  parseAsync(e, t) {
174
176
  const o = this;
175
- return new Promise(function(n, r) {
176
- o.parse(e, t, n, r);
177
+ return new Promise(function(s, r) {
178
+ o.parse(e, t, s, r);
177
179
  });
178
180
  }
179
181
  }
@@ -223,15 +225,15 @@ class Lt {
223
225
  }
224
226
  _markDefs() {
225
227
  const e = this.parser, t = this.parser.json.nodes || [];
226
- for (let o = 0, n = t.length; o < n; o++) {
228
+ for (let o = 0, s = t.length; o < s; o++) {
227
229
  const r = t[o];
228
230
  r.extensions && r.extensions[this.name] && r.extensions[this.name].light !== void 0 && e._addNodeRef(this.cache, r.extensions[this.name].light);
229
231
  }
230
232
  }
231
233
  _loadLight(e) {
232
234
  const t = this.parser, o = "light:" + e;
233
- let n = t.cache.get(o);
234
- if (n) return n;
235
+ let s = t.cache.get(o);
236
+ if (s) return s;
235
237
  const r = t.json, i = ((r.extensions && r.extensions[this.name] || {}).lights || [])[e];
236
238
  let c;
237
239
  const u = new U(16777215);
@@ -250,7 +252,7 @@ class Lt {
250
252
  default:
251
253
  throw new Error("THREE.GLTFLoader: Unexpected light type: " + i.type);
252
254
  }
253
- return c.position.set(0, 0, 0), c.decay = 2, F(c, i), i.intensity !== void 0 && (c.intensity = i.intensity), c.name = t.createUniqueName(i.name || "light_" + e), n = Promise.resolve(c), t.cache.add(o, n), n;
255
+ return c.position.set(0, 0, 0), c.decay = 2, F(c, i), i.intensity !== void 0 && (c.intensity = i.intensity), c.name = t.createUniqueName(i.name || "light_" + e), s = Promise.resolve(c), t.cache.add(o, s), s;
254
256
  }
255
257
  getDependency(e, t) {
256
258
  if (e === "light")
@@ -271,17 +273,17 @@ class Mt {
271
273
  return W;
272
274
  }
273
275
  extendParams(e, t, o) {
274
- const n = [];
276
+ const s = [];
275
277
  e.color = new U(1, 1, 1), e.opacity = 1;
276
278
  const r = t.pbrMetallicRoughness;
277
279
  if (r) {
278
280
  if (Array.isArray(r.baseColorFactor)) {
279
- const s = r.baseColorFactor;
280
- e.color.setRGB(s[0], s[1], s[2], D), e.opacity = s[3];
281
+ const n = r.baseColorFactor;
282
+ e.color.setRGB(n[0], n[1], n[2], D), e.opacity = n[3];
281
283
  }
282
- r.baseColorTexture !== void 0 && n.push(o.assignTexture(e, "map", r.baseColorTexture, N));
284
+ r.baseColorTexture !== void 0 && s.push(o.assignTexture(e, "map", r.baseColorTexture, N));
283
285
  }
284
- return Promise.all(n);
286
+ return Promise.all(s);
285
287
  }
286
288
  }
287
289
  class It {
@@ -289,10 +291,10 @@ class It {
289
291
  this.parser = e, this.name = b.KHR_MATERIALS_EMISSIVE_STRENGTH;
290
292
  }
291
293
  extendMaterialParams(e, t) {
292
- const n = this.parser.json.materials[e];
293
- if (!n.extensions || !n.extensions[this.name])
294
+ const s = this.parser.json.materials[e];
295
+ if (!s.extensions || !s.extensions[this.name])
294
296
  return Promise.resolve();
295
- const r = n.extensions[this.name].emissiveStrength;
297
+ const r = s.extensions[this.name].emissiveStrength;
296
298
  return r !== void 0 && (t.emissiveIntensity = r), Promise.resolve();
297
299
  }
298
300
  }
@@ -305,12 +307,12 @@ class Ct {
305
307
  return !o.extensions || !o.extensions[this.name] ? null : O;
306
308
  }
307
309
  extendMaterialParams(e, t) {
308
- const o = this.parser, n = o.json.materials[e];
309
- if (!n.extensions || !n.extensions[this.name])
310
+ const o = this.parser, s = o.json.materials[e];
311
+ if (!s.extensions || !s.extensions[this.name])
310
312
  return Promise.resolve();
311
- const r = [], s = n.extensions[this.name];
312
- if (s.clearcoatFactor !== void 0 && (t.clearcoat = s.clearcoatFactor), s.clearcoatTexture !== void 0 && r.push(o.assignTexture(t, "clearcoatMap", s.clearcoatTexture)), s.clearcoatRoughnessFactor !== void 0 && (t.clearcoatRoughness = s.clearcoatRoughnessFactor), s.clearcoatRoughnessTexture !== void 0 && r.push(o.assignTexture(t, "clearcoatRoughnessMap", s.clearcoatRoughnessTexture)), s.clearcoatNormalTexture !== void 0 && (r.push(o.assignTexture(t, "clearcoatNormalMap", s.clearcoatNormalTexture)), s.clearcoatNormalTexture.scale !== void 0)) {
313
- const a = s.clearcoatNormalTexture.scale;
313
+ const r = [], n = s.extensions[this.name];
314
+ if (n.clearcoatFactor !== void 0 && (t.clearcoat = n.clearcoatFactor), n.clearcoatTexture !== void 0 && r.push(o.assignTexture(t, "clearcoatMap", n.clearcoatTexture)), n.clearcoatRoughnessFactor !== void 0 && (t.clearcoatRoughness = n.clearcoatRoughnessFactor), n.clearcoatRoughnessTexture !== void 0 && r.push(o.assignTexture(t, "clearcoatRoughnessMap", n.clearcoatRoughnessTexture)), n.clearcoatNormalTexture !== void 0 && (r.push(o.assignTexture(t, "clearcoatNormalMap", n.clearcoatNormalTexture)), n.clearcoatNormalTexture.scale !== void 0)) {
315
+ const a = n.clearcoatNormalTexture.scale;
314
316
  t.clearcoatNormalScale = new q(a, a);
315
317
  }
316
318
  return Promise.all(r);
@@ -325,11 +327,11 @@ class Nt {
325
327
  return !o.extensions || !o.extensions[this.name] ? null : O;
326
328
  }
327
329
  extendMaterialParams(e, t) {
328
- const o = this.parser, n = o.json.materials[e];
329
- if (!n.extensions || !n.extensions[this.name])
330
+ const o = this.parser, s = o.json.materials[e];
331
+ if (!s.extensions || !s.extensions[this.name])
330
332
  return Promise.resolve();
331
- const r = [], s = n.extensions[this.name];
332
- return s.iridescenceFactor !== void 0 && (t.iridescence = s.iridescenceFactor), s.iridescenceTexture !== void 0 && r.push(o.assignTexture(t, "iridescenceMap", s.iridescenceTexture)), s.iridescenceIor !== void 0 && (t.iridescenceIOR = s.iridescenceIor), t.iridescenceThicknessRange === void 0 && (t.iridescenceThicknessRange = [100, 400]), s.iridescenceThicknessMinimum !== void 0 && (t.iridescenceThicknessRange[0] = s.iridescenceThicknessMinimum), s.iridescenceThicknessMaximum !== void 0 && (t.iridescenceThicknessRange[1] = s.iridescenceThicknessMaximum), s.iridescenceThicknessTexture !== void 0 && r.push(o.assignTexture(t, "iridescenceThicknessMap", s.iridescenceThicknessTexture)), Promise.all(r);
333
+ const r = [], n = s.extensions[this.name];
334
+ return n.iridescenceFactor !== void 0 && (t.iridescence = n.iridescenceFactor), n.iridescenceTexture !== void 0 && r.push(o.assignTexture(t, "iridescenceMap", n.iridescenceTexture)), n.iridescenceIor !== void 0 && (t.iridescenceIOR = n.iridescenceIor), t.iridescenceThicknessRange === void 0 && (t.iridescenceThicknessRange = [100, 400]), n.iridescenceThicknessMinimum !== void 0 && (t.iridescenceThicknessRange[0] = n.iridescenceThicknessMinimum), n.iridescenceThicknessMaximum !== void 0 && (t.iridescenceThicknessRange[1] = n.iridescenceThicknessMaximum), n.iridescenceThicknessTexture !== void 0 && r.push(o.assignTexture(t, "iridescenceThicknessMap", n.iridescenceThicknessTexture)), Promise.all(r);
333
335
  }
334
336
  }
335
337
  class Dt {
@@ -341,17 +343,17 @@ class Dt {
341
343
  return !o.extensions || !o.extensions[this.name] ? null : O;
342
344
  }
343
345
  extendMaterialParams(e, t) {
344
- const o = this.parser, n = o.json.materials[e];
345
- if (!n.extensions || !n.extensions[this.name])
346
+ const o = this.parser, s = o.json.materials[e];
347
+ if (!s.extensions || !s.extensions[this.name])
346
348
  return Promise.resolve();
347
349
  const r = [];
348
350
  t.sheenColor = new U(0, 0, 0), t.sheenRoughness = 0, t.sheen = 1;
349
- const s = n.extensions[this.name];
350
- if (s.sheenColorFactor !== void 0) {
351
- const a = s.sheenColorFactor;
351
+ const n = s.extensions[this.name];
352
+ if (n.sheenColorFactor !== void 0) {
353
+ const a = n.sheenColorFactor;
352
354
  t.sheenColor.setRGB(a[0], a[1], a[2], D);
353
355
  }
354
- return s.sheenRoughnessFactor !== void 0 && (t.sheenRoughness = s.sheenRoughnessFactor), s.sheenColorTexture !== void 0 && r.push(o.assignTexture(t, "sheenColorMap", s.sheenColorTexture, N)), s.sheenRoughnessTexture !== void 0 && r.push(o.assignTexture(t, "sheenRoughnessMap", s.sheenRoughnessTexture)), Promise.all(r);
356
+ return n.sheenRoughnessFactor !== void 0 && (t.sheenRoughness = n.sheenRoughnessFactor), n.sheenColorTexture !== void 0 && r.push(o.assignTexture(t, "sheenColorMap", n.sheenColorTexture, N)), n.sheenRoughnessTexture !== void 0 && r.push(o.assignTexture(t, "sheenRoughnessMap", n.sheenRoughnessTexture)), Promise.all(r);
355
357
  }
356
358
  }
357
359
  class Ot {
@@ -363,11 +365,11 @@ class Ot {
363
365
  return !o.extensions || !o.extensions[this.name] ? null : O;
364
366
  }
365
367
  extendMaterialParams(e, t) {
366
- const o = this.parser, n = o.json.materials[e];
367
- if (!n.extensions || !n.extensions[this.name])
368
+ const o = this.parser, s = o.json.materials[e];
369
+ if (!s.extensions || !s.extensions[this.name])
368
370
  return Promise.resolve();
369
- const r = [], s = n.extensions[this.name];
370
- return s.transmissionFactor !== void 0 && (t.transmission = s.transmissionFactor), s.transmissionTexture !== void 0 && r.push(o.assignTexture(t, "transmissionMap", s.transmissionTexture)), Promise.all(r);
371
+ const r = [], n = s.extensions[this.name];
372
+ return n.transmissionFactor !== void 0 && (t.transmission = n.transmissionFactor), n.transmissionTexture !== void 0 && r.push(o.assignTexture(t, "transmissionMap", n.transmissionTexture)), Promise.all(r);
371
373
  }
372
374
  }
373
375
  class Pt {
@@ -379,12 +381,12 @@ class Pt {
379
381
  return !o.extensions || !o.extensions[this.name] ? null : O;
380
382
  }
381
383
  extendMaterialParams(e, t) {
382
- const o = this.parser, n = o.json.materials[e];
383
- if (!n.extensions || !n.extensions[this.name])
384
+ const o = this.parser, s = o.json.materials[e];
385
+ if (!s.extensions || !s.extensions[this.name])
384
386
  return Promise.resolve();
385
- const r = [], s = n.extensions[this.name];
386
- t.thickness = s.thicknessFactor !== void 0 ? s.thicknessFactor : 0, s.thicknessTexture !== void 0 && r.push(o.assignTexture(t, "thicknessMap", s.thicknessTexture)), t.attenuationDistance = s.attenuationDistance || 1 / 0;
387
- const a = s.attenuationColor || [1, 1, 1];
387
+ const r = [], n = s.extensions[this.name];
388
+ t.thickness = n.thicknessFactor !== void 0 ? n.thicknessFactor : 0, n.thicknessTexture !== void 0 && r.push(o.assignTexture(t, "thicknessMap", n.thicknessTexture)), t.attenuationDistance = n.attenuationDistance || 1 / 0;
389
+ const a = n.attenuationColor || [1, 1, 1];
388
390
  return t.attenuationColor = new U().setRGB(a[0], a[1], a[2], D), Promise.all(r);
389
391
  }
390
392
  }
@@ -397,10 +399,10 @@ class kt {
397
399
  return !o.extensions || !o.extensions[this.name] ? null : O;
398
400
  }
399
401
  extendMaterialParams(e, t) {
400
- const n = this.parser.json.materials[e];
401
- if (!n.extensions || !n.extensions[this.name])
402
+ const s = this.parser.json.materials[e];
403
+ if (!s.extensions || !s.extensions[this.name])
402
404
  return Promise.resolve();
403
- const r = n.extensions[this.name];
405
+ const r = s.extensions[this.name];
404
406
  return t.ior = r.ior !== void 0 ? r.ior : 1.5, Promise.resolve();
405
407
  }
406
408
  }
@@ -413,13 +415,13 @@ class Ft {
413
415
  return !o.extensions || !o.extensions[this.name] ? null : O;
414
416
  }
415
417
  extendMaterialParams(e, t) {
416
- const o = this.parser, n = o.json.materials[e];
417
- if (!n.extensions || !n.extensions[this.name])
418
+ const o = this.parser, s = o.json.materials[e];
419
+ if (!s.extensions || !s.extensions[this.name])
418
420
  return Promise.resolve();
419
- const r = [], s = n.extensions[this.name];
420
- t.specularIntensity = s.specularFactor !== void 0 ? s.specularFactor : 1, s.specularTexture !== void 0 && r.push(o.assignTexture(t, "specularIntensityMap", s.specularTexture));
421
- const a = s.specularColorFactor || [1, 1, 1];
422
- return t.specularColor = new U().setRGB(a[0], a[1], a[2], D), s.specularColorTexture !== void 0 && r.push(o.assignTexture(t, "specularColorMap", s.specularColorTexture, N)), Promise.all(r);
421
+ const r = [], n = s.extensions[this.name];
422
+ t.specularIntensity = n.specularFactor !== void 0 ? n.specularFactor : 1, n.specularTexture !== void 0 && r.push(o.assignTexture(t, "specularIntensityMap", n.specularTexture));
423
+ const a = n.specularColorFactor || [1, 1, 1];
424
+ return t.specularColor = new U().setRGB(a[0], a[1], a[2], D), n.specularColorTexture !== void 0 && r.push(o.assignTexture(t, "specularColorMap", n.specularColorTexture, N)), Promise.all(r);
423
425
  }
424
426
  }
425
427
  class Ut {
@@ -431,11 +433,11 @@ class Ut {
431
433
  return !o.extensions || !o.extensions[this.name] ? null : O;
432
434
  }
433
435
  extendMaterialParams(e, t) {
434
- const o = this.parser, n = o.json.materials[e];
435
- if (!n.extensions || !n.extensions[this.name])
436
+ const o = this.parser, s = o.json.materials[e];
437
+ if (!s.extensions || !s.extensions[this.name])
436
438
  return Promise.resolve();
437
- const r = [], s = n.extensions[this.name];
438
- return t.bumpScale = s.bumpFactor !== void 0 ? s.bumpFactor : 1, s.bumpTexture !== void 0 && r.push(o.assignTexture(t, "bumpMap", s.bumpTexture)), Promise.all(r);
439
+ const r = [], n = s.extensions[this.name];
440
+ return t.bumpScale = n.bumpFactor !== void 0 ? n.bumpFactor : 1, n.bumpTexture !== void 0 && r.push(o.assignTexture(t, "bumpMap", n.bumpTexture)), Promise.all(r);
439
441
  }
440
442
  }
441
443
  class Ht {
@@ -447,11 +449,11 @@ class Ht {
447
449
  return !o.extensions || !o.extensions[this.name] ? null : O;
448
450
  }
449
451
  extendMaterialParams(e, t) {
450
- const o = this.parser, n = o.json.materials[e];
451
- if (!n.extensions || !n.extensions[this.name])
452
+ const o = this.parser, s = o.json.materials[e];
453
+ if (!s.extensions || !s.extensions[this.name])
452
454
  return Promise.resolve();
453
- const r = [], s = n.extensions[this.name];
454
- return s.anisotropyStrength !== void 0 && (t.anisotropy = s.anisotropyStrength), s.anisotropyRotation !== void 0 && (t.anisotropyRotation = s.anisotropyRotation), s.anisotropyTexture !== void 0 && r.push(o.assignTexture(t, "anisotropyMap", s.anisotropyTexture)), Promise.all(r);
455
+ const r = [], n = s.extensions[this.name];
456
+ return n.anisotropyStrength !== void 0 && (t.anisotropy = n.anisotropyStrength), n.anisotropyRotation !== void 0 && (t.anisotropyRotation = n.anisotropyRotation), n.anisotropyTexture !== void 0 && r.push(o.assignTexture(t, "anisotropyMap", n.anisotropyTexture)), Promise.all(r);
455
457
  }
456
458
  }
457
459
  class Gt {
@@ -459,16 +461,16 @@ class Gt {
459
461
  this.parser = e, this.name = b.KHR_TEXTURE_BASISU;
460
462
  }
461
463
  loadTexture(e) {
462
- const t = this.parser, o = t.json, n = o.textures[e];
463
- if (!n.extensions || !n.extensions[this.name])
464
+ const t = this.parser, o = t.json, s = o.textures[e];
465
+ if (!s.extensions || !s.extensions[this.name])
464
466
  return null;
465
- const r = n.extensions[this.name], s = t.options.ktx2Loader;
466
- if (!s) {
467
+ const r = s.extensions[this.name], n = t.options.ktx2Loader;
468
+ if (!n) {
467
469
  if (o.extensionsRequired && o.extensionsRequired.indexOf(this.name) >= 0)
468
470
  throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");
469
471
  return null;
470
472
  }
471
- return t.loadTextureImage(e, r.source, s);
473
+ return t.loadTextureImage(e, r.source, n);
472
474
  }
473
475
  }
474
476
  class vt {
@@ -476,18 +478,18 @@ class vt {
476
478
  this.parser = e, this.name = b.EXT_TEXTURE_WEBP, this.isSupported = null;
477
479
  }
478
480
  loadTexture(e) {
479
- const t = this.name, o = this.parser, n = o.json, r = n.textures[e];
481
+ const t = this.name, o = this.parser, s = o.json, r = s.textures[e];
480
482
  if (!r.extensions || !r.extensions[t])
481
483
  return null;
482
- const s = r.extensions[t], a = n.images[s.source];
484
+ const n = r.extensions[t], a = s.images[n.source];
483
485
  let i = o.textureLoader;
484
486
  if (a.uri) {
485
487
  const c = o.options.manager.getHandler(a.uri);
486
488
  c !== null && (i = c);
487
489
  }
488
490
  return this.detectSupport().then(function(c) {
489
- if (c) return o.loadTextureImage(e, s.source, i);
490
- if (n.extensionsRequired && n.extensionsRequired.indexOf(t) >= 0)
491
+ if (c) return o.loadTextureImage(e, n.source, i);
492
+ if (s.extensionsRequired && s.extensionsRequired.indexOf(t) >= 0)
491
493
  throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");
492
494
  return o.loadTexture(e);
493
495
  });
@@ -506,18 +508,18 @@ class Bt {
506
508
  this.parser = e, this.name = b.EXT_TEXTURE_AVIF, this.isSupported = null;
507
509
  }
508
510
  loadTexture(e) {
509
- const t = this.name, o = this.parser, n = o.json, r = n.textures[e];
511
+ const t = this.name, o = this.parser, s = o.json, r = s.textures[e];
510
512
  if (!r.extensions || !r.extensions[t])
511
513
  return null;
512
- const s = r.extensions[t], a = n.images[s.source];
514
+ const n = r.extensions[t], a = s.images[n.source];
513
515
  let i = o.textureLoader;
514
516
  if (a.uri) {
515
517
  const c = o.options.manager.getHandler(a.uri);
516
518
  c !== null && (i = c);
517
519
  }
518
520
  return this.detectSupport().then(function(c) {
519
- if (c) return o.loadTextureImage(e, s.source, i);
520
- if (n.extensionsRequired && n.extensionsRequired.indexOf(t) >= 0)
521
+ if (c) return o.loadTextureImage(e, n.source, i);
522
+ if (s.extensionsRequired && s.extensionsRequired.indexOf(t) >= 0)
521
523
  throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");
522
524
  return o.loadTexture(e);
523
525
  });
@@ -538,19 +540,19 @@ class jt {
538
540
  loadBufferView(e) {
539
541
  const t = this.parser.json, o = t.bufferViews[e];
540
542
  if (o.extensions && o.extensions[this.name]) {
541
- const n = o.extensions[this.name], r = this.parser.getDependency("buffer", n.buffer), s = this.parser.options.meshoptDecoder;
542
- if (!s || !s.supported) {
543
+ const s = o.extensions[this.name], r = this.parser.getDependency("buffer", s.buffer), n = this.parser.options.meshoptDecoder;
544
+ if (!n || !n.supported) {
543
545
  if (t.extensionsRequired && t.extensionsRequired.indexOf(this.name) >= 0)
544
546
  throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");
545
547
  return null;
546
548
  }
547
549
  return r.then(function(a) {
548
- const i = n.byteOffset || 0, c = n.byteLength || 0, u = n.count, l = n.byteStride, f = new Uint8Array(a, i, c);
549
- return s.decodeGltfBufferAsync ? s.decodeGltfBufferAsync(u, l, f, n.mode, n.filter).then(function(m) {
550
+ const i = s.byteOffset || 0, c = s.byteLength || 0, u = s.count, l = s.byteStride, f = new Uint8Array(a, i, c);
551
+ return n.decodeGltfBufferAsync ? n.decodeGltfBufferAsync(u, l, f, s.mode, s.filter).then(function(m) {
550
552
  return m.buffer;
551
- }) : s.ready.then(function() {
553
+ }) : n.ready.then(function() {
552
554
  const m = new ArrayBuffer(u * l);
553
- return s.decodeGltfBuffer(new Uint8Array(m), u, l, f, n.mode, n.filter), m;
555
+ return n.decodeGltfBuffer(new Uint8Array(m), u, l, f, s.mode, s.filter), m;
554
556
  });
555
557
  });
556
558
  } else
@@ -565,19 +567,19 @@ class Kt {
565
567
  const t = this.parser.json, o = t.nodes[e];
566
568
  if (!o.extensions || !o.extensions[this.name] || o.mesh === void 0)
567
569
  return null;
568
- const n = t.meshes[o.mesh];
569
- for (const c of n.primitives)
570
+ const s = t.meshes[o.mesh];
571
+ for (const c of s.primitives)
570
572
  if (c.mode !== C.TRIANGLES && c.mode !== C.TRIANGLE_STRIP && c.mode !== C.TRIANGLE_FAN && c.mode !== void 0)
571
573
  return null;
572
- const s = o.extensions[this.name].attributes, a = [], i = {};
573
- for (const c in s)
574
- a.push(this.parser.getDependency("accessor", s[c]).then((u) => (i[c] = u, i[c])));
574
+ const n = o.extensions[this.name].attributes, a = [], i = {};
575
+ for (const c in n)
576
+ a.push(this.parser.getDependency("accessor", n[c]).then((u) => (i[c] = u, i[c])));
575
577
  return a.length < 1 ? null : (a.push(this.parser.createNodeMesh(e)), Promise.all(a).then((c) => {
576
578
  const u = c.pop(), l = u.isGroup ? u.children : [u], f = c[0].count, m = [];
577
579
  for (const T of l) {
578
- const x = new Y(), y = new B(), R = new Le(), E = new B(1, 1, 1), S = new Xe(T.geometry, T.material, f);
580
+ const R = new Y(), y = new B(), x = new Le(), E = new B(1, 1, 1), S = new Xe(T.geometry, T.material, f);
579
581
  for (let _ = 0; _ < f; _++)
580
- i.TRANSLATION && y.fromBufferAttribute(i.TRANSLATION, _), i.ROTATION && R.fromBufferAttribute(i.ROTATION, _), i.SCALE && E.fromBufferAttribute(i.SCALE, _), S.setMatrixAt(_, x.compose(y, R, E));
582
+ i.TRANSLATION && y.fromBufferAttribute(i.TRANSLATION, _), i.ROTATION && x.fromBufferAttribute(i.ROTATION, _), i.SCALE && E.fromBufferAttribute(i.SCALE, _), S.setMatrixAt(_, R.compose(y, x, E));
581
583
  for (const _ in i)
582
584
  if (_ === "_COLOR_0") {
583
585
  const M = i[_];
@@ -602,20 +604,20 @@ class Vt {
602
604
  throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");
603
605
  if (this.header.version < 2)
604
606
  throw new Error("THREE.GLTFLoader: Legacy binary file detected.");
605
- const n = this.header.length - V, r = new DataView(e, V);
606
- let s = 0;
607
- for (; s < n; ) {
608
- const a = r.getUint32(s, !0);
609
- s += 4;
610
- const i = r.getUint32(s, !0);
611
- if (s += 4, i === _e.JSON) {
612
- const c = new Uint8Array(e, V + s, a);
607
+ const s = this.header.length - V, r = new DataView(e, V);
608
+ let n = 0;
609
+ for (; n < s; ) {
610
+ const a = r.getUint32(n, !0);
611
+ n += 4;
612
+ const i = r.getUint32(n, !0);
613
+ if (n += 4, i === _e.JSON) {
614
+ const c = new Uint8Array(e, V + n, a);
613
615
  this.content = o.decode(c);
614
616
  } else if (i === _e.BIN) {
615
- const c = V + s;
617
+ const c = V + n;
616
618
  this.body = e.slice(c, c + a);
617
619
  }
618
- s += a;
620
+ n += a;
619
621
  }
620
622
  if (this.content === null)
621
623
  throw new Error("THREE.GLTFLoader: JSON content not found.");
@@ -628,24 +630,24 @@ class Wt {
628
630
  this.name = b.KHR_DRACO_MESH_COMPRESSION, this.json = e, this.dracoLoader = t, this.dracoLoader.preload();
629
631
  }
630
632
  decodePrimitive(e, t) {
631
- const o = this.json, n = this.dracoLoader, r = e.extensions[this.name].bufferView, s = e.extensions[this.name].attributes, a = {}, i = {}, c = {};
632
- for (const u in s) {
633
+ const o = this.json, s = this.dracoLoader, r = e.extensions[this.name].bufferView, n = e.extensions[this.name].attributes, a = {}, i = {}, c = {};
634
+ for (const u in n) {
633
635
  const l = oe[u] || u.toLowerCase();
634
- a[l] = s[u];
636
+ a[l] = n[u];
635
637
  }
636
638
  for (const u in e.attributes) {
637
639
  const l = oe[u] || u.toLowerCase();
638
- if (s[u] !== void 0) {
640
+ if (n[u] !== void 0) {
639
641
  const f = o.accessors[e.attributes[u]], m = j[f.componentType];
640
642
  c[l] = m.name, i[l] = f.normalized === !0;
641
643
  }
642
644
  }
643
645
  return t.getDependency("bufferView", r).then(function(u) {
644
646
  return new Promise(function(l, f) {
645
- n.decodeDracoFile(u, function(m) {
647
+ s.decodeDracoFile(u, function(m) {
646
648
  for (const T in m.attributes) {
647
- const x = m.attributes[T], y = i[T];
648
- y !== void 0 && (x.normalized = y);
649
+ const R = m.attributes[T], y = i[T];
650
+ y !== void 0 && (R.normalized = y);
649
651
  }
650
652
  l(m);
651
653
  }, a, c, D, f);
@@ -667,28 +669,28 @@ class zt {
667
669
  }
668
670
  }
669
671
  class Ue extends Tt {
670
- constructor(e, t, o, n) {
671
- super(e, t, o, n);
672
+ constructor(e, t, o, s) {
673
+ super(e, t, o, s);
672
674
  }
673
675
  copySampleValue_(e) {
674
- const t = this.resultBuffer, o = this.sampleValues, n = this.valueSize, r = e * n * 3 + n;
675
- for (let s = 0; s !== n; s++)
676
- t[s] = o[r + s];
676
+ const t = this.resultBuffer, o = this.sampleValues, s = this.valueSize, r = e * s * 3 + s;
677
+ for (let n = 0; n !== s; n++)
678
+ t[n] = o[r + n];
677
679
  return t;
678
680
  }
679
- interpolate_(e, t, o, n) {
680
- const r = this.resultBuffer, s = this.sampleValues, a = this.valueSize, i = a * 2, c = a * 3, u = n - t, l = (o - t) / u, f = l * l, m = f * l, T = e * c, x = T - c, y = -2 * m + 3 * f, R = m - f, E = 1 - y, S = R - f + l;
681
+ interpolate_(e, t, o, s) {
682
+ const r = this.resultBuffer, n = this.sampleValues, a = this.valueSize, i = a * 2, c = a * 3, u = s - t, l = (o - t) / u, f = l * l, m = f * l, T = e * c, R = T - c, y = -2 * m + 3 * f, x = m - f, E = 1 - y, S = x - f + l;
681
683
  for (let _ = 0; _ !== a; _++) {
682
- const M = s[x + _ + a], I = s[x + _ + i] * u, L = s[T + _ + a], h = s[T + _] * u;
683
- r[_] = E * M + S * I + y * L + R * h;
684
+ const M = n[R + _ + a], I = n[R + _ + i] * u, L = n[T + _ + a], h = n[T + _] * u;
685
+ r[_] = E * M + S * I + y * L + x * h;
684
686
  }
685
687
  return r;
686
688
  }
687
689
  }
688
690
  const qt = new Le();
689
691
  class Yt extends Ue {
690
- interpolate_(e, t, o, n) {
691
- const r = super.interpolate_(e, t, o, n);
692
+ interpolate_(e, t, o, s) {
693
+ const r = super.interpolate_(e, t, o, s);
692
694
  return qt.fromArray(r).normalize().toArray(r), r;
693
695
  }
694
696
  }
@@ -772,20 +774,20 @@ function F(d, e) {
772
774
  e.extras !== void 0 && (typeof e.extras == "object" ? Object.assign(d.userData, e.extras) : console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, " + e.extras));
773
775
  }
774
776
  function Zt(d, e, t) {
775
- let o = !1, n = !1, r = !1;
777
+ let o = !1, s = !1, r = !1;
776
778
  for (let c = 0, u = e.length; c < u; c++) {
777
779
  const l = e[c];
778
- if (l.POSITION !== void 0 && (o = !0), l.NORMAL !== void 0 && (n = !0), l.COLOR_0 !== void 0 && (r = !0), o && n && r) break;
780
+ if (l.POSITION !== void 0 && (o = !0), l.NORMAL !== void 0 && (s = !0), l.COLOR_0 !== void 0 && (r = !0), o && s && r) break;
779
781
  }
780
- if (!o && !n && !r) return Promise.resolve(d);
781
- const s = [], a = [], i = [];
782
+ if (!o && !s && !r) return Promise.resolve(d);
783
+ const n = [], a = [], i = [];
782
784
  for (let c = 0, u = e.length; c < u; c++) {
783
785
  const l = e[c];
784
786
  if (o) {
785
787
  const f = l.POSITION !== void 0 ? t.getDependency("accessor", l.POSITION) : d.attributes.position;
786
- s.push(f);
788
+ n.push(f);
787
789
  }
788
- if (n) {
790
+ if (s) {
789
791
  const f = l.NORMAL !== void 0 ? t.getDependency("accessor", l.NORMAL) : d.attributes.normal;
790
792
  a.push(f);
791
793
  }
@@ -795,12 +797,12 @@ function Zt(d, e, t) {
795
797
  }
796
798
  }
797
799
  return Promise.all([
798
- Promise.all(s),
800
+ Promise.all(n),
799
801
  Promise.all(a),
800
802
  Promise.all(i)
801
803
  ]).then(function(c) {
802
804
  const u = c[0], l = c[1], f = c[2];
803
- return o && (d.morphAttributes.position = u), n && (d.morphAttributes.normal = l), r && (d.morphAttributes.color = f), d.morphTargetsRelative = !0, d;
805
+ return o && (d.morphAttributes.position = u), s && (d.morphAttributes.normal = l), r && (d.morphAttributes.color = f), d.morphTargetsRelative = !0, d;
804
806
  });
805
807
  }
806
808
  function $t(d, e) {
@@ -811,7 +813,7 @@ function $t(d, e) {
811
813
  const t = e.extras.targetNames;
812
814
  if (d.morphTargetInfluences.length === t.length) {
813
815
  d.morphTargetDictionary = {};
814
- for (let o = 0, n = t.length; o < n; o++)
816
+ for (let o = 0, s = t.length; o < s; o++)
815
817
  d.morphTargetDictionary[t[o]] = o;
816
818
  } else
817
819
  console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.");
@@ -821,14 +823,14 @@ function en(d) {
821
823
  let e;
822
824
  const t = d.extensions && d.extensions[b.KHR_DRACO_MESH_COMPRESSION];
823
825
  if (t ? e = "draco:" + t.bufferView + ":" + t.indices + ":" + te(t.attributes) : e = d.indices + ":" + te(d.attributes) + ":" + d.mode, d.targets !== void 0)
824
- for (let o = 0, n = d.targets.length; o < n; o++)
826
+ for (let o = 0, s = d.targets.length; o < s; o++)
825
827
  e += ":" + te(d.targets[o]);
826
828
  return e;
827
829
  }
828
830
  function te(d) {
829
831
  let e = "";
830
832
  const t = Object.keys(d).sort();
831
- for (let o = 0, n = t.length; o < n; o++)
833
+ for (let o = 0, s = t.length; o < s; o++)
832
834
  e += t[o] + ":" + d[t[o]] + ";";
833
835
  return e;
834
836
  }
@@ -853,8 +855,8 @@ const nn = new Y();
853
855
  class sn {
854
856
  constructor(e = {}, t = {}) {
855
857
  this.json = e, this.extensions = {}, this.plugins = {}, this.options = t, this.cache = new bt(), this.associations = /* @__PURE__ */ new Map(), this.primitiveCache = {}, this.nodeCache = {}, this.meshCache = { refs: {}, uses: {} }, this.cameraCache = { refs: {}, uses: {} }, this.lightCache = { refs: {}, uses: {} }, this.sourceCache = {}, this.textureCache = {}, this.nodeNamesUsed = {};
856
- let o = !1, n = !1, r = -1;
857
- typeof navigator < "u" && (o = /^((?!chrome|android).)*safari/i.test(navigator.userAgent) === !0, n = navigator.userAgent.indexOf("Firefox") > -1, r = n ? navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1] : -1), typeof createImageBitmap > "u" || o || n && r < 98 ? this.textureLoader = new Me(this.options.manager) : this.textureLoader = new qe(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.textureLoader.setRequestHeader(this.options.requestHeader), this.fileLoader = new K(this.options.manager), this.fileLoader.setResponseType("arraybuffer"), this.options.crossOrigin === "use-credentials" && this.fileLoader.setWithCredentials(!0);
858
+ let o = !1, s = !1, r = -1;
859
+ typeof navigator < "u" && (o = /^((?!chrome|android).)*safari/i.test(navigator.userAgent) === !0, s = navigator.userAgent.indexOf("Firefox") > -1, r = s ? navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1] : -1), typeof createImageBitmap > "u" || o || s && r < 98 ? this.textureLoader = new Me(this.options.manager) : this.textureLoader = new qe(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.textureLoader.setRequestHeader(this.options.requestHeader), this.fileLoader = new K(this.options.manager), this.fileLoader.setResponseType("arraybuffer"), this.options.crossOrigin === "use-credentials" && this.fileLoader.setWithCredentials(!0);
858
860
  }
859
861
  setExtensions(e) {
860
862
  this.extensions = e;
@@ -863,28 +865,28 @@ class sn {
863
865
  this.plugins = e;
864
866
  }
865
867
  parse(e, t) {
866
- const o = this, n = this.json, r = this.extensions;
867
- this.cache.removeAll(), this.nodeCache = {}, this._invokeAll(function(s) {
868
- return s._markDefs && s._markDefs();
869
- }), Promise.all(this._invokeAll(function(s) {
870
- return s.beforeRoot && s.beforeRoot();
868
+ const o = this, s = this.json, r = this.extensions;
869
+ this.cache.removeAll(), this.nodeCache = {}, this._invokeAll(function(n) {
870
+ return n._markDefs && n._markDefs();
871
+ }), Promise.all(this._invokeAll(function(n) {
872
+ return n.beforeRoot && n.beforeRoot();
871
873
  })).then(function() {
872
874
  return Promise.all([
873
875
  o.getDependencies("scene"),
874
876
  o.getDependencies("animation"),
875
877
  o.getDependencies("camera")
876
878
  ]);
877
- }).then(function(s) {
879
+ }).then(function(n) {
878
880
  const a = {
879
- scene: s[0][n.scene || 0],
880
- scenes: s[0],
881
- animations: s[1],
882
- cameras: s[2],
883
- asset: n.asset,
881
+ scene: n[0][s.scene || 0],
882
+ scenes: n[0],
883
+ animations: n[1],
884
+ cameras: n[2],
885
+ asset: s.asset,
884
886
  parser: o,
885
887
  userData: {}
886
888
  };
887
- return G(r, a, n), F(a, n), Promise.all(o._invokeAll(function(i) {
889
+ return G(r, a, s), F(a, s), Promise.all(o._invokeAll(function(i) {
888
890
  return i.afterRoot && i.afterRoot(a);
889
891
  })).then(function() {
890
892
  for (const i of a.scenes)
@@ -898,14 +900,14 @@ class sn {
898
900
  */
899
901
  _markDefs() {
900
902
  const e = this.json.nodes || [], t = this.json.skins || [], o = this.json.meshes || [];
901
- for (let n = 0, r = t.length; n < r; n++) {
902
- const s = t[n].joints;
903
- for (let a = 0, i = s.length; a < i; a++)
904
- e[s[a]].isBone = !0;
903
+ for (let s = 0, r = t.length; s < r; s++) {
904
+ const n = t[s].joints;
905
+ for (let a = 0, i = n.length; a < i; a++)
906
+ e[n[a]].isBone = !0;
905
907
  }
906
- for (let n = 0, r = e.length; n < r; n++) {
907
- const s = e[n];
908
- s.mesh !== void 0 && (this._addNodeRef(this.meshCache, s.mesh), s.skin !== void 0 && (o[s.mesh].isSkinnedMesh = !0)), s.camera !== void 0 && this._addNodeRef(this.cameraCache, s.camera);
908
+ for (let s = 0, r = e.length; s < r; s++) {
909
+ const n = e[s];
910
+ n.mesh !== void 0 && (this._addNodeRef(this.meshCache, n.mesh), n.skin !== void 0 && (o[n.mesh].isSkinnedMesh = !0)), n.camera !== void 0 && this._addNodeRef(this.cameraCache, n.camera);
909
911
  }
910
912
  }
911
913
  /**
@@ -923,20 +925,20 @@ class sn {
923
925
  /** Returns a reference to a shared resource, cloning it if necessary. */
924
926
  _getNodeRef(e, t, o) {
925
927
  if (e.refs[t] <= 1) return o;
926
- const n = o.clone(), r = (s, a) => {
927
- const i = this.associations.get(s);
928
+ const s = o.clone(), r = (n, a) => {
929
+ const i = this.associations.get(n);
928
930
  i != null && this.associations.set(a, i);
929
- for (const [c, u] of s.children.entries())
931
+ for (const [c, u] of n.children.entries())
930
932
  r(u, a.children[c]);
931
933
  };
932
- return r(o, n), n.name += "_instance_" + e.uses[t]++, n;
934
+ return r(o, s), s.name += "_instance_" + e.uses[t]++, s;
933
935
  }
934
936
  _invokeOne(e) {
935
937
  const t = Object.values(this.plugins);
936
938
  t.push(this);
937
939
  for (let o = 0; o < t.length; o++) {
938
- const n = e(t[o]);
939
- if (n) return n;
940
+ const s = e(t[o]);
941
+ if (s) return s;
940
942
  }
941
943
  return null;
942
944
  }
@@ -944,8 +946,8 @@ class sn {
944
946
  const t = Object.values(this.plugins);
945
947
  t.unshift(this);
946
948
  const o = [];
947
- for (let n = 0; n < t.length; n++) {
948
- const r = e(t[n]);
949
+ for (let s = 0; s < t.length; s++) {
950
+ const r = e(t[s]);
949
951
  r && o.push(r);
950
952
  }
951
953
  return o;
@@ -958,64 +960,64 @@ class sn {
958
960
  */
959
961
  getDependency(e, t) {
960
962
  const o = e + ":" + t;
961
- let n = this.cache.get(o);
962
- if (!n) {
963
+ let s = this.cache.get(o);
964
+ if (!s) {
963
965
  switch (e) {
964
966
  case "scene":
965
- n = this.loadScene(t);
967
+ s = this.loadScene(t);
966
968
  break;
967
969
  case "node":
968
- n = this._invokeOne(function(r) {
970
+ s = this._invokeOne(function(r) {
969
971
  return r.loadNode && r.loadNode(t);
970
972
  });
971
973
  break;
972
974
  case "mesh":
973
- n = this._invokeOne(function(r) {
975
+ s = this._invokeOne(function(r) {
974
976
  return r.loadMesh && r.loadMesh(t);
975
977
  });
976
978
  break;
977
979
  case "accessor":
978
- n = this.loadAccessor(t);
980
+ s = this.loadAccessor(t);
979
981
  break;
980
982
  case "bufferView":
981
- n = this._invokeOne(function(r) {
983
+ s = this._invokeOne(function(r) {
982
984
  return r.loadBufferView && r.loadBufferView(t);
983
985
  });
984
986
  break;
985
987
  case "buffer":
986
- n = this.loadBuffer(t);
988
+ s = this.loadBuffer(t);
987
989
  break;
988
990
  case "material":
989
- n = this._invokeOne(function(r) {
991
+ s = this._invokeOne(function(r) {
990
992
  return r.loadMaterial && r.loadMaterial(t);
991
993
  });
992
994
  break;
993
995
  case "texture":
994
- n = this._invokeOne(function(r) {
996
+ s = this._invokeOne(function(r) {
995
997
  return r.loadTexture && r.loadTexture(t);
996
998
  });
997
999
  break;
998
1000
  case "skin":
999
- n = this.loadSkin(t);
1001
+ s = this.loadSkin(t);
1000
1002
  break;
1001
1003
  case "animation":
1002
- n = this._invokeOne(function(r) {
1004
+ s = this._invokeOne(function(r) {
1003
1005
  return r.loadAnimation && r.loadAnimation(t);
1004
1006
  });
1005
1007
  break;
1006
1008
  case "camera":
1007
- n = this.loadCamera(t);
1009
+ s = this.loadCamera(t);
1008
1010
  break;
1009
1011
  default:
1010
- if (n = this._invokeOne(function(r) {
1012
+ if (s = this._invokeOne(function(r) {
1011
1013
  return r != this && r.getDependency && r.getDependency(e, t);
1012
- }), !n)
1014
+ }), !s)
1013
1015
  throw new Error("Unknown type: " + e);
1014
1016
  break;
1015
1017
  }
1016
- this.cache.add(o, n);
1018
+ this.cache.add(o, s);
1017
1019
  }
1018
- return n;
1020
+ return s;
1019
1021
  }
1020
1022
  /**
1021
1023
  * Requests all dependencies of the specified type asynchronously, with caching.
@@ -1025,9 +1027,9 @@ class sn {
1025
1027
  getDependencies(e) {
1026
1028
  let t = this.cache.get(e);
1027
1029
  if (!t) {
1028
- const o = this, n = this.json[e + (e === "mesh" ? "es" : "s")] || [];
1029
- t = Promise.all(n.map(function(r, s) {
1030
- return o.getDependency(e, s);
1030
+ const o = this, s = this.json[e + (e === "mesh" ? "es" : "s")] || [];
1031
+ t = Promise.all(s.map(function(r, n) {
1032
+ return o.getDependency(e, n);
1031
1033
  })), this.cache.add(e, t);
1032
1034
  }
1033
1035
  return t;
@@ -1043,10 +1045,10 @@ class sn {
1043
1045
  throw new Error("THREE.GLTFLoader: " + t.type + " buffer type is not supported.");
1044
1046
  if (t.uri === void 0 && e === 0)
1045
1047
  return Promise.resolve(this.extensions[b.KHR_BINARY_GLTF].body);
1046
- const n = this.options;
1047
- return new Promise(function(r, s) {
1048
- o.load(X.resolveURL(t.uri, n.path), r, void 0, function() {
1049
- s(new Error('THREE.GLTFLoader: Failed to load buffer "' + t.uri + '".'));
1048
+ const s = this.options;
1049
+ return new Promise(function(r, n) {
1050
+ o.load(X.resolveURL(t.uri, s.path), r, void 0, function() {
1051
+ n(new Error('THREE.GLTFLoader: Failed to load buffer "' + t.uri + '".'));
1050
1052
  });
1051
1053
  });
1052
1054
  }
@@ -1058,8 +1060,8 @@ class sn {
1058
1060
  loadBufferView(e) {
1059
1061
  const t = this.json.bufferViews[e];
1060
1062
  return this.getDependency("buffer", t.buffer).then(function(o) {
1061
- const n = t.byteLength || 0, r = t.byteOffset || 0;
1062
- return o.slice(r, r + n);
1063
+ const s = t.byteLength || 0, r = t.byteOffset || 0;
1064
+ return o.slice(r, r + s);
1063
1065
  });
1064
1066
  }
1065
1067
  /**
@@ -1068,23 +1070,23 @@ class sn {
1068
1070
  * @return {Promise<BufferAttribute|InterleavedBufferAttribute>}
1069
1071
  */
1070
1072
  loadAccessor(e) {
1071
- const t = this, o = this.json, n = this.json.accessors[e];
1072
- if (n.bufferView === void 0 && n.sparse === void 0) {
1073
- const s = $[n.type], a = j[n.componentType], i = n.normalized === !0, c = new a(n.count * s);
1074
- return Promise.resolve(new P(c, s, i));
1073
+ const t = this, o = this.json, s = this.json.accessors[e];
1074
+ if (s.bufferView === void 0 && s.sparse === void 0) {
1075
+ const n = $[s.type], a = j[s.componentType], i = s.normalized === !0, c = new a(s.count * n);
1076
+ return Promise.resolve(new P(c, n, i));
1075
1077
  }
1076
1078
  const r = [];
1077
- return n.bufferView !== void 0 ? r.push(this.getDependency("bufferView", n.bufferView)) : r.push(null), n.sparse !== void 0 && (r.push(this.getDependency("bufferView", n.sparse.indices.bufferView)), r.push(this.getDependency("bufferView", n.sparse.values.bufferView))), Promise.all(r).then(function(s) {
1078
- const a = s[0], i = $[n.type], c = j[n.componentType], u = c.BYTES_PER_ELEMENT, l = u * i, f = n.byteOffset || 0, m = n.bufferView !== void 0 ? o.bufferViews[n.bufferView].byteStride : void 0, T = n.normalized === !0;
1079
- let x, y;
1079
+ return s.bufferView !== void 0 ? r.push(this.getDependency("bufferView", s.bufferView)) : r.push(null), s.sparse !== void 0 && (r.push(this.getDependency("bufferView", s.sparse.indices.bufferView)), r.push(this.getDependency("bufferView", s.sparse.values.bufferView))), Promise.all(r).then(function(n) {
1080
+ const a = n[0], i = $[s.type], c = j[s.componentType], u = c.BYTES_PER_ELEMENT, l = u * i, f = s.byteOffset || 0, m = s.bufferView !== void 0 ? o.bufferViews[s.bufferView].byteStride : void 0, T = s.normalized === !0;
1081
+ let R, y;
1080
1082
  if (m && m !== l) {
1081
- const R = Math.floor(f / m), E = "InterleavedBuffer:" + n.bufferView + ":" + n.componentType + ":" + R + ":" + n.count;
1083
+ const x = Math.floor(f / m), E = "InterleavedBuffer:" + s.bufferView + ":" + s.componentType + ":" + x + ":" + s.count;
1082
1084
  let S = t.cache.get(E);
1083
- S || (x = new c(a, R * m, n.count * m / u), S = new Ye(x, m / u), t.cache.add(E, S)), y = new Je(S, i, f % m / u, T);
1085
+ S || (R = new c(a, x * m, s.count * m / u), S = new Ye(R, m / u), t.cache.add(E, S)), y = new Je(S, i, f % m / u, T);
1084
1086
  } else
1085
- a === null ? x = new c(n.count * i) : x = new c(a, f, n.count * i), y = new P(x, i, T);
1086
- if (n.sparse !== void 0) {
1087
- const R = $.SCALAR, E = j[n.sparse.indices.componentType], S = n.sparse.indices.byteOffset || 0, _ = n.sparse.values.byteOffset || 0, M = new E(s[1], S, n.sparse.count * R), I = new c(s[2], _, n.sparse.count * i);
1087
+ a === null ? R = new c(s.count * i) : R = new c(a, f, s.count * i), y = new P(R, i, T);
1088
+ if (s.sparse !== void 0) {
1089
+ const x = $.SCALAR, E = j[s.sparse.indices.componentType], S = s.sparse.indices.byteOffset || 0, _ = s.sparse.values.byteOffset || 0, M = new E(n[1], S, s.sparse.count * x), I = new c(n[2], _, s.sparse.count * i);
1088
1090
  a !== null && (y = new P(y.array.slice(), y.itemSize, y.normalized));
1089
1091
  for (let L = 0, h = M.length; L < h; L++) {
1090
1092
  const p = M[L];
@@ -1100,51 +1102,51 @@ class sn {
1100
1102
  * @return {Promise<THREE.Texture|null>}
1101
1103
  */
1102
1104
  loadTexture(e) {
1103
- const t = this.json, o = this.options, r = t.textures[e].source, s = t.images[r];
1105
+ const t = this.json, o = this.options, r = t.textures[e].source, n = t.images[r];
1104
1106
  let a = this.textureLoader;
1105
- if (s.uri) {
1106
- const i = o.manager.getHandler(s.uri);
1107
+ if (n.uri) {
1108
+ const i = o.manager.getHandler(n.uri);
1107
1109
  i !== null && (a = i);
1108
1110
  }
1109
1111
  return this.loadTextureImage(e, r, a);
1110
1112
  }
1111
1113
  loadTextureImage(e, t, o) {
1112
- const n = this, r = this.json, s = r.textures[e], a = r.images[t], i = (a.uri || a.bufferView) + ":" + s.sampler;
1114
+ const s = this, r = this.json, n = r.textures[e], a = r.images[t], i = (a.uri || a.bufferView) + ":" + n.sampler;
1113
1115
  if (this.textureCache[i])
1114
1116
  return this.textureCache[i];
1115
1117
  const c = this.loadImageSource(t, o).then(function(u) {
1116
- u.flipY = !1, u.name = s.name || a.name || "", u.name === "" && typeof a.uri == "string" && a.uri.startsWith("data:image/") === !1 && (u.name = a.uri);
1117
- const f = (r.samplers || {})[s.sampler] || {};
1118
- return u.magFilter = we[f.magFilter] || Ce, u.minFilter = we[f.minFilter] || Ie, u.wrapS = Ee[f.wrapS] || J, u.wrapT = Ee[f.wrapT] || J, n.associations.set(u, { textures: e }), u;
1118
+ u.flipY = !1, u.name = n.name || a.name || "", u.name === "" && typeof a.uri == "string" && a.uri.startsWith("data:image/") === !1 && (u.name = a.uri);
1119
+ const f = (r.samplers || {})[n.sampler] || {};
1120
+ return u.magFilter = we[f.magFilter] || Ce, u.minFilter = we[f.minFilter] || Ie, u.wrapS = Ee[f.wrapS] || J, u.wrapT = Ee[f.wrapT] || J, s.associations.set(u, { textures: e }), u;
1119
1121
  }).catch(function() {
1120
1122
  return null;
1121
1123
  });
1122
1124
  return this.textureCache[i] = c, c;
1123
1125
  }
1124
1126
  loadImageSource(e, t) {
1125
- const o = this, n = this.json, r = this.options;
1127
+ const o = this, s = this.json, r = this.options;
1126
1128
  if (this.sourceCache[e] !== void 0)
1127
1129
  return this.sourceCache[e].then((l) => l.clone());
1128
- const s = n.images[e], a = self.URL || self.webkitURL;
1129
- let i = s.uri || "", c = !1;
1130
- if (s.bufferView !== void 0)
1131
- i = o.getDependency("bufferView", s.bufferView).then(function(l) {
1130
+ const n = s.images[e], a = self.URL || self.webkitURL;
1131
+ let i = n.uri || "", c = !1;
1132
+ if (n.bufferView !== void 0)
1133
+ i = o.getDependency("bufferView", n.bufferView).then(function(l) {
1132
1134
  c = !0;
1133
- const f = new Blob([l], { type: s.mimeType });
1135
+ const f = new Blob([l], { type: n.mimeType });
1134
1136
  return i = a.createObjectURL(f), i;
1135
1137
  });
1136
- else if (s.uri === void 0)
1138
+ else if (n.uri === void 0)
1137
1139
  throw new Error("THREE.GLTFLoader: Image " + e + " is missing URI and bufferView");
1138
1140
  const u = Promise.resolve(i).then(function(l) {
1139
1141
  return new Promise(function(f, m) {
1140
1142
  let T = f;
1141
- t.isImageBitmapLoader === !0 && (T = function(x) {
1142
- const y = new de(x);
1143
+ t.isImageBitmapLoader === !0 && (T = function(R) {
1144
+ const y = new de(R);
1143
1145
  y.needsUpdate = !0, f(y);
1144
1146
  }), t.load(X.resolveURL(l, r.path), T, void 0, m);
1145
1147
  });
1146
1148
  }).then(function(l) {
1147
- return c === !0 && a.revokeObjectURL(i), l.userData.mimeType = s.mimeType || tn(s.uri), l;
1149
+ return c === !0 && a.revokeObjectURL(i), l.userData.mimeType = n.mimeType || tn(n.uri), l;
1148
1150
  }).catch(function(l) {
1149
1151
  throw console.error("THREE.GLTFLoader: Couldn't load texture", i), l;
1150
1152
  });
@@ -1157,18 +1159,18 @@ class sn {
1157
1159
  * @param {Object} mapDef
1158
1160
  * @return {Promise<Texture>}
1159
1161
  */
1160
- assignTexture(e, t, o, n) {
1162
+ assignTexture(e, t, o, s) {
1161
1163
  const r = this;
1162
- return this.getDependency("texture", o.index).then(function(s) {
1163
- if (!s) return null;
1164
- if (o.texCoord !== void 0 && o.texCoord > 0 && (s = s.clone(), s.channel = o.texCoord), r.extensions[b.KHR_TEXTURE_TRANSFORM]) {
1164
+ return this.getDependency("texture", o.index).then(function(n) {
1165
+ if (!n) return null;
1166
+ if (o.texCoord !== void 0 && o.texCoord > 0 && (n = n.clone(), n.channel = o.texCoord), r.extensions[b.KHR_TEXTURE_TRANSFORM]) {
1165
1167
  const a = o.extensions !== void 0 ? o.extensions[b.KHR_TEXTURE_TRANSFORM] : void 0;
1166
1168
  if (a) {
1167
- const i = r.associations.get(s);
1168
- s = r.extensions[b.KHR_TEXTURE_TRANSFORM].extendTexture(s, a), r.associations.set(s, i);
1169
+ const i = r.associations.get(n);
1170
+ n = r.extensions[b.KHR_TEXTURE_TRANSFORM].extendTexture(n, a), r.associations.set(n, i);
1169
1171
  }
1170
1172
  }
1171
- return n !== void 0 && (s.colorSpace = n), e[t] = s, s;
1173
+ return s !== void 0 && (n.colorSpace = s), e[t] = n, n;
1172
1174
  });
1173
1175
  }
1174
1176
  /**
@@ -1182,7 +1184,7 @@ class sn {
1182
1184
  assignFinalMaterial(e) {
1183
1185
  const t = e.geometry;
1184
1186
  let o = e.material;
1185
- const n = t.attributes.tangent === void 0, r = t.attributes.color !== void 0, s = t.attributes.normal === void 0;
1187
+ const s = t.attributes.tangent === void 0, r = t.attributes.color !== void 0, n = t.attributes.normal === void 0;
1186
1188
  if (e.isPoints) {
1187
1189
  const a = "PointsMaterial:" + o.uuid;
1188
1190
  let i = this.cache.get(a);
@@ -1192,11 +1194,11 @@ class sn {
1192
1194
  let i = this.cache.get(a);
1193
1195
  i || (i = new nt(), Z.prototype.copy.call(i, o), i.color.copy(o.color), i.map = o.map, this.cache.add(a, i)), o = i;
1194
1196
  }
1195
- if (n || r || s) {
1197
+ if (s || r || n) {
1196
1198
  let a = "ClonedMaterial:" + o.uuid + ":";
1197
- n && (a += "derivative-tangents:"), r && (a += "vertex-colors:"), s && (a += "flat-shading:");
1199
+ s && (a += "derivative-tangents:"), r && (a += "vertex-colors:"), n && (a += "flat-shading:");
1198
1200
  let i = this.cache.get(a);
1199
- i || (i = o.clone(), r && (i.vertexColors = !0), s && (i.flatShading = !0), n && (i.normalScale && (i.normalScale.y *= -1), i.clearcoatNormalScale && (i.clearcoatNormalScale.y *= -1)), this.cache.add(a, i), this.associations.set(i, this.associations.get(o))), o = i;
1201
+ i || (i = o.clone(), r && (i.vertexColors = !0), n && (i.flatShading = !0), s && (i.normalScale && (i.normalScale.y *= -1), i.clearcoatNormalScale && (i.clearcoatNormalScale.y *= -1)), this.cache.add(a, i), this.associations.set(i, this.associations.get(o))), o = i;
1200
1202
  }
1201
1203
  e.material = o;
1202
1204
  }
@@ -1209,19 +1211,19 @@ class sn {
1209
1211
  * @return {Promise<Material>}
1210
1212
  */
1211
1213
  loadMaterial(e) {
1212
- const t = this, o = this.json, n = this.extensions, r = o.materials[e];
1213
- let s;
1214
+ const t = this, o = this.json, s = this.extensions, r = o.materials[e];
1215
+ let n;
1214
1216
  const a = {}, i = r.extensions || {}, c = [];
1215
1217
  if (i[b.KHR_MATERIALS_UNLIT]) {
1216
- const l = n[b.KHR_MATERIALS_UNLIT];
1217
- s = l.getMaterialType(), c.push(l.extendParams(a, r, t));
1218
+ const l = s[b.KHR_MATERIALS_UNLIT];
1219
+ n = l.getMaterialType(), c.push(l.extendParams(a, r, t));
1218
1220
  } else {
1219
1221
  const l = r.pbrMetallicRoughness || {};
1220
1222
  if (a.color = new U(1, 1, 1), a.opacity = 1, Array.isArray(l.baseColorFactor)) {
1221
1223
  const f = l.baseColorFactor;
1222
1224
  a.color.setRGB(f[0], f[1], f[2], D), a.opacity = f[3];
1223
1225
  }
1224
- l.baseColorTexture !== void 0 && c.push(t.assignTexture(a, "map", l.baseColorTexture, N)), a.metalness = l.metallicFactor !== void 0 ? l.metallicFactor : 1, a.roughness = l.roughnessFactor !== void 0 ? l.roughnessFactor : 1, l.metallicRoughnessTexture !== void 0 && (c.push(t.assignTexture(a, "metalnessMap", l.metallicRoughnessTexture)), c.push(t.assignTexture(a, "roughnessMap", l.metallicRoughnessTexture))), s = this._invokeOne(function(f) {
1226
+ l.baseColorTexture !== void 0 && c.push(t.assignTexture(a, "map", l.baseColorTexture, N)), a.metalness = l.metallicFactor !== void 0 ? l.metallicFactor : 1, a.roughness = l.roughnessFactor !== void 0 ? l.roughnessFactor : 1, l.metallicRoughnessTexture !== void 0 && (c.push(t.assignTexture(a, "metalnessMap", l.metallicRoughnessTexture)), c.push(t.assignTexture(a, "roughnessMap", l.metallicRoughnessTexture))), n = this._invokeOne(function(f) {
1225
1227
  return f.getMaterialType && f.getMaterialType(e);
1226
1228
  }), c.push(Promise.all(this._invokeAll(function(f) {
1227
1229
  return f.extendMaterialParams && f.extendMaterialParams(e, a);
@@ -1229,17 +1231,17 @@ class sn {
1229
1231
  }
1230
1232
  r.doubleSided === !0 && (a.side = st);
1231
1233
  const u = r.alphaMode || ee.OPAQUE;
1232
- if (u === ee.BLEND ? (a.transparent = !0, a.depthWrite = !1) : (a.transparent = !1, u === ee.MASK && (a.alphaTest = r.alphaCutoff !== void 0 ? r.alphaCutoff : 0.5)), r.normalTexture !== void 0 && s !== W && (c.push(t.assignTexture(a, "normalMap", r.normalTexture)), a.normalScale = new q(1, 1), r.normalTexture.scale !== void 0)) {
1234
+ if (u === ee.BLEND ? (a.transparent = !0, a.depthWrite = !1) : (a.transparent = !1, u === ee.MASK && (a.alphaTest = r.alphaCutoff !== void 0 ? r.alphaCutoff : 0.5)), r.normalTexture !== void 0 && n !== W && (c.push(t.assignTexture(a, "normalMap", r.normalTexture)), a.normalScale = new q(1, 1), r.normalTexture.scale !== void 0)) {
1233
1235
  const l = r.normalTexture.scale;
1234
1236
  a.normalScale.set(l, l);
1235
1237
  }
1236
- if (r.occlusionTexture !== void 0 && s !== W && (c.push(t.assignTexture(a, "aoMap", r.occlusionTexture)), r.occlusionTexture.strength !== void 0 && (a.aoMapIntensity = r.occlusionTexture.strength)), r.emissiveFactor !== void 0 && s !== W) {
1238
+ if (r.occlusionTexture !== void 0 && n !== W && (c.push(t.assignTexture(a, "aoMap", r.occlusionTexture)), r.occlusionTexture.strength !== void 0 && (a.aoMapIntensity = r.occlusionTexture.strength)), r.emissiveFactor !== void 0 && n !== W) {
1237
1239
  const l = r.emissiveFactor;
1238
1240
  a.emissive = new U().setRGB(l[0], l[1], l[2], D);
1239
1241
  }
1240
- return r.emissiveTexture !== void 0 && s !== W && c.push(t.assignTexture(a, "emissiveMap", r.emissiveTexture, N)), Promise.all(c).then(function() {
1241
- const l = new s(a);
1242
- return r.name && (l.name = r.name), F(l, r), t.associations.set(l, { materials: e }), r.extensions && G(n, l, r), l;
1242
+ return r.emissiveTexture !== void 0 && n !== W && c.push(t.assignTexture(a, "emissiveMap", r.emissiveTexture, N)), Promise.all(c).then(function() {
1243
+ const l = new n(a);
1244
+ return r.name && (l.name = r.name), F(l, r), t.associations.set(l, { materials: e }), r.extensions && G(s, l, r), l;
1243
1245
  });
1244
1246
  }
1245
1247
  /** When Object3D instances are targeted by animation, they need unique names. */
@@ -1256,23 +1258,23 @@ class sn {
1256
1258
  * @return {Promise<Array<BufferGeometry>>}
1257
1259
  */
1258
1260
  loadGeometries(e) {
1259
- const t = this, o = this.extensions, n = this.primitiveCache;
1261
+ const t = this, o = this.extensions, s = this.primitiveCache;
1260
1262
  function r(a) {
1261
1263
  return o[b.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a, t).then(function(i) {
1262
1264
  return Se(i, a, t);
1263
1265
  });
1264
1266
  }
1265
- const s = [];
1267
+ const n = [];
1266
1268
  for (let a = 0, i = e.length; a < i; a++) {
1267
- const c = e[a], u = en(c), l = n[u];
1269
+ const c = e[a], u = en(c), l = s[u];
1268
1270
  if (l)
1269
- s.push(l.promise);
1271
+ n.push(l.promise);
1270
1272
  else {
1271
1273
  let f;
1272
- c.extensions && c.extensions[b.KHR_DRACO_MESH_COMPRESSION] ? f = r(c) : f = Se(new ue(), c, t), n[u] = { primitive: c, promise: f }, s.push(f);
1274
+ c.extensions && c.extensions[b.KHR_DRACO_MESH_COMPRESSION] ? f = r(c) : f = Se(new ue(), c, t), s[u] = { primitive: c, promise: f }, n.push(f);
1273
1275
  }
1274
1276
  }
1275
- return Promise.all(s);
1277
+ return Promise.all(n);
1276
1278
  }
1277
1279
  /**
1278
1280
  * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#meshes
@@ -1280,30 +1282,30 @@ class sn {
1280
1282
  * @return {Promise<Group|Mesh|SkinnedMesh>}
1281
1283
  */
1282
1284
  loadMesh(e) {
1283
- const t = this, o = this.json, n = this.extensions, r = o.meshes[e], s = r.primitives, a = [];
1284
- for (let i = 0, c = s.length; i < c; i++) {
1285
- const u = s[i].material === void 0 ? Qt(this.cache) : this.getDependency("material", s[i].material);
1285
+ const t = this, o = this.json, s = this.extensions, r = o.meshes[e], n = r.primitives, a = [];
1286
+ for (let i = 0, c = n.length; i < c; i++) {
1287
+ const u = n[i].material === void 0 ? Qt(this.cache) : this.getDependency("material", n[i].material);
1286
1288
  a.push(u);
1287
1289
  }
1288
- return a.push(t.loadGeometries(s)), Promise.all(a).then(function(i) {
1290
+ return a.push(t.loadGeometries(n)), Promise.all(a).then(function(i) {
1289
1291
  const c = i.slice(0, i.length - 1), u = i[i.length - 1], l = [];
1290
1292
  for (let m = 0, T = u.length; m < T; m++) {
1291
- const x = u[m], y = s[m];
1292
- let R;
1293
+ const R = u[m], y = n[m];
1294
+ let x;
1293
1295
  const E = c[m];
1294
1296
  if (y.mode === C.TRIANGLES || y.mode === C.TRIANGLE_STRIP || y.mode === C.TRIANGLE_FAN || y.mode === void 0)
1295
- R = r.isSkinnedMesh === !0 ? new ot(x, E) : new Pe(x, E), R.isSkinnedMesh === !0 && R.normalizeSkinWeights(), y.mode === C.TRIANGLE_STRIP ? R.geometry = xe(R.geometry, be) : y.mode === C.TRIANGLE_FAN && (R.geometry = xe(R.geometry, re));
1297
+ x = r.isSkinnedMesh === !0 ? new ot(R, E) : new Pe(R, E), x.isSkinnedMesh === !0 && x.normalizeSkinWeights(), y.mode === C.TRIANGLE_STRIP ? x.geometry = Re(x.geometry, be) : y.mode === C.TRIANGLE_FAN && (x.geometry = Re(x.geometry, re));
1296
1298
  else if (y.mode === C.LINES)
1297
- R = new it(x, E);
1299
+ x = new it(R, E);
1298
1300
  else if (y.mode === C.LINE_STRIP)
1299
- R = new at(x, E);
1301
+ x = new at(R, E);
1300
1302
  else if (y.mode === C.LINE_LOOP)
1301
- R = new ct(x, E);
1303
+ x = new ct(R, E);
1302
1304
  else if (y.mode === C.POINTS)
1303
- R = new ut(x, E);
1305
+ x = new ut(R, E);
1304
1306
  else
1305
1307
  throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + y.mode);
1306
- Object.keys(R.geometry.morphAttributes).length > 0 && $t(R, r), R.name = t.createUniqueName(r.name || "mesh_" + e), F(R, r), y.extensions && G(n, R, y), t.assignFinalMaterial(R), l.push(R);
1308
+ Object.keys(x.geometry.morphAttributes).length > 0 && $t(x, r), x.name = t.createUniqueName(r.name || "mesh_" + e), F(x, r), y.extensions && G(s, x, y), t.assignFinalMaterial(x), l.push(x);
1307
1309
  }
1308
1310
  for (let m = 0, T = l.length; m < T; m++)
1309
1311
  t.associations.set(l[m], {
@@ -1311,9 +1313,9 @@ class sn {
1311
1313
  primitives: m
1312
1314
  });
1313
1315
  if (l.length === 1)
1314
- return r.extensions && G(n, l[0], r), l[0];
1316
+ return r.extensions && G(s, l[0], r), l[0];
1315
1317
  const f = new z();
1316
- r.extensions && G(n, f, r), t.associations.set(f, { meshes: e });
1318
+ r.extensions && G(s, f, r), t.associations.set(f, { meshes: e });
1317
1319
  for (let m = 0, T = l.length; m < T; m++)
1318
1320
  f.add(l[m]);
1319
1321
  return f;
@@ -1326,12 +1328,12 @@ class sn {
1326
1328
  */
1327
1329
  loadCamera(e) {
1328
1330
  let t;
1329
- const o = this.json.cameras[e], n = o[o.type];
1330
- if (!n) {
1331
+ const o = this.json.cameras[e], s = o[o.type];
1332
+ if (!s) {
1331
1333
  console.warn("THREE.GLTFLoader: Missing camera parameters.");
1332
1334
  return;
1333
1335
  }
1334
- return o.type === "perspective" ? t = new lt(ft.radToDeg(n.yfov), n.aspectRatio || 1, n.znear || 1, n.zfar || 2e6) : o.type === "orthographic" && (t = new dt(-n.xmag, n.xmag, n.ymag, -n.ymag, n.znear, n.zfar)), o.name && (t.name = this.createUniqueName(o.name)), F(t, o), Promise.resolve(t);
1336
+ return o.type === "perspective" ? t = new lt(ft.radToDeg(s.yfov), s.aspectRatio || 1, s.znear || 1, s.zfar || 2e6) : o.type === "orthographic" && (t = new dt(-s.xmag, s.xmag, s.ymag, -s.ymag, s.znear, s.zfar)), o.name && (t.name = this.createUniqueName(o.name)), F(t, o), Promise.resolve(t);
1335
1337
  }
1336
1338
  /**
1337
1339
  * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins
@@ -1340,12 +1342,12 @@ class sn {
1340
1342
  */
1341
1343
  loadSkin(e) {
1342
1344
  const t = this.json.skins[e], o = [];
1343
- for (let n = 0, r = t.joints.length; n < r; n++)
1344
- o.push(this._loadNodeShallow(t.joints[n]));
1345
- return t.inverseBindMatrices !== void 0 ? o.push(this.getDependency("accessor", t.inverseBindMatrices)) : o.push(null), Promise.all(o).then(function(n) {
1346
- const r = n.pop(), s = n, a = [], i = [];
1347
- for (let c = 0, u = s.length; c < u; c++) {
1348
- const l = s[c];
1345
+ for (let s = 0, r = t.joints.length; s < r; s++)
1346
+ o.push(this._loadNodeShallow(t.joints[s]));
1347
+ return t.inverseBindMatrices !== void 0 ? o.push(this.getDependency("accessor", t.inverseBindMatrices)) : o.push(null), Promise.all(o).then(function(s) {
1348
+ const r = s.pop(), n = s, a = [], i = [];
1349
+ for (let c = 0, u = n.length; c < u; c++) {
1350
+ const l = n[c];
1349
1351
  if (l) {
1350
1352
  a.push(l);
1351
1353
  const f = new Y();
@@ -1362,40 +1364,40 @@ class sn {
1362
1364
  * @return {Promise<AnimationClip>}
1363
1365
  */
1364
1366
  loadAnimation(e) {
1365
- const t = this.json, o = this, n = t.animations[e], r = n.name ? n.name : "animation_" + e, s = [], a = [], i = [], c = [], u = [];
1366
- for (let l = 0, f = n.channels.length; l < f; l++) {
1367
- const m = n.channels[l], T = n.samplers[m.sampler], x = m.target, y = x.node, R = n.parameters !== void 0 ? n.parameters[T.input] : T.input, E = n.parameters !== void 0 ? n.parameters[T.output] : T.output;
1368
- x.node !== void 0 && (s.push(this.getDependency("node", y)), a.push(this.getDependency("accessor", R)), i.push(this.getDependency("accessor", E)), c.push(T), u.push(x));
1367
+ const t = this.json, o = this, s = t.animations[e], r = s.name ? s.name : "animation_" + e, n = [], a = [], i = [], c = [], u = [];
1368
+ for (let l = 0, f = s.channels.length; l < f; l++) {
1369
+ const m = s.channels[l], T = s.samplers[m.sampler], R = m.target, y = R.node, x = s.parameters !== void 0 ? s.parameters[T.input] : T.input, E = s.parameters !== void 0 ? s.parameters[T.output] : T.output;
1370
+ R.node !== void 0 && (n.push(this.getDependency("node", y)), a.push(this.getDependency("accessor", x)), i.push(this.getDependency("accessor", E)), c.push(T), u.push(R));
1369
1371
  }
1370
1372
  return Promise.all([
1371
- Promise.all(s),
1373
+ Promise.all(n),
1372
1374
  Promise.all(a),
1373
1375
  Promise.all(i),
1374
1376
  Promise.all(c),
1375
1377
  Promise.all(u)
1376
1378
  ]).then(function(l) {
1377
- const f = l[0], m = l[1], T = l[2], x = l[3], y = l[4], R = [];
1379
+ const f = l[0], m = l[1], T = l[2], R = l[3], y = l[4], x = [];
1378
1380
  for (let E = 0, S = f.length; E < S; E++) {
1379
- const _ = f[E], M = m[E], I = T[E], L = x[E], h = y[E];
1381
+ const _ = f[E], M = m[E], I = T[E], L = R[E], h = y[E];
1380
1382
  if (_ === void 0) continue;
1381
1383
  _.updateMatrix && _.updateMatrix();
1382
1384
  const p = o._createAnimationTracks(_, M, I, L, h);
1383
1385
  if (p)
1384
1386
  for (let g = 0; g < p.length; g++)
1385
- R.push(p[g]);
1387
+ x.push(p[g]);
1386
1388
  }
1387
- return new pt(r, void 0, R);
1389
+ return new pt(r, void 0, x);
1388
1390
  });
1389
1391
  }
1390
1392
  createNodeMesh(e) {
1391
- const t = this.json, o = this, n = t.nodes[e];
1392
- return n.mesh === void 0 ? null : o.getDependency("mesh", n.mesh).then(function(r) {
1393
- const s = o._getNodeRef(o.meshCache, n.mesh, r);
1394
- return n.weights !== void 0 && s.traverse(function(a) {
1393
+ const t = this.json, o = this, s = t.nodes[e];
1394
+ return s.mesh === void 0 ? null : o.getDependency("mesh", s.mesh).then(function(r) {
1395
+ const n = o._getNodeRef(o.meshCache, s.mesh, r);
1396
+ return s.weights !== void 0 && n.traverse(function(a) {
1395
1397
  if (a.isMesh)
1396
- for (let i = 0, c = n.weights.length; i < c; i++)
1397
- a.morphTargetInfluences[i] = n.weights[i];
1398
- }), s;
1398
+ for (let i = 0, c = s.weights.length; i < c; i++)
1399
+ a.morphTargetInfluences[i] = s.weights[i];
1400
+ }), n;
1399
1401
  });
1400
1402
  }
1401
1403
  /**
@@ -1404,13 +1406,13 @@ class sn {
1404
1406
  * @return {Promise<Object3D>}
1405
1407
  */
1406
1408
  loadNode(e) {
1407
- const t = this.json, o = this, n = t.nodes[e], r = o._loadNodeShallow(e), s = [], a = n.children || [];
1409
+ const t = this.json, o = this, s = t.nodes[e], r = o._loadNodeShallow(e), n = [], a = s.children || [];
1408
1410
  for (let c = 0, u = a.length; c < u; c++)
1409
- s.push(o.getDependency("node", a[c]));
1410
- const i = n.skin === void 0 ? Promise.resolve(null) : o.getDependency("skin", n.skin);
1411
+ n.push(o.getDependency("node", a[c]));
1412
+ const i = s.skin === void 0 ? Promise.resolve(null) : o.getDependency("skin", s.skin);
1411
1413
  return Promise.all([
1412
1414
  r,
1413
- Promise.all(s),
1415
+ Promise.all(n),
1414
1416
  i
1415
1417
  ]).then(function(c) {
1416
1418
  const u = c[0], l = c[1], f = c[2];
@@ -1425,15 +1427,15 @@ class sn {
1425
1427
  // ._loadNodeShallow() parses a single node.
1426
1428
  // skin and child nodes are created and added in .loadNode() (no '_' prefix).
1427
1429
  _loadNodeShallow(e) {
1428
- const t = this.json, o = this.extensions, n = this;
1430
+ const t = this.json, o = this.extensions, s = this;
1429
1431
  if (this.nodeCache[e] !== void 0)
1430
1432
  return this.nodeCache[e];
1431
- const r = t.nodes[e], s = r.name ? n.createUniqueName(r.name) : "", a = [], i = n._invokeOne(function(c) {
1433
+ const r = t.nodes[e], n = r.name ? s.createUniqueName(r.name) : "", a = [], i = s._invokeOne(function(c) {
1432
1434
  return c.createNodeMesh && c.createNodeMesh(e);
1433
1435
  });
1434
- return i && a.push(i), r.camera !== void 0 && a.push(n.getDependency("camera", r.camera).then(function(c) {
1435
- return n._getNodeRef(n.cameraCache, r.camera, c);
1436
- })), n._invokeAll(function(c) {
1436
+ return i && a.push(i), r.camera !== void 0 && a.push(s.getDependency("camera", r.camera).then(function(c) {
1437
+ return s._getNodeRef(s.cameraCache, r.camera, c);
1438
+ })), s._invokeAll(function(c) {
1437
1439
  return c.createNodeAttachment && c.createNodeAttachment(e);
1438
1440
  }).forEach(function(c) {
1439
1441
  a.push(c);
@@ -1442,12 +1444,12 @@ class sn {
1442
1444
  if (r.isBone === !0 ? u = new mt() : c.length > 1 ? u = new z() : c.length === 1 ? u = c[0] : u = new ce(), u !== c[0])
1443
1445
  for (let l = 0, f = c.length; l < f; l++)
1444
1446
  u.add(c[l]);
1445
- if (r.name && (u.userData.name = r.name, u.name = s), F(u, r), r.extensions && G(o, u, r), r.matrix !== void 0) {
1447
+ if (r.name && (u.userData.name = r.name, u.name = n), F(u, r), r.extensions && G(o, u, r), r.matrix !== void 0) {
1446
1448
  const l = new Y();
1447
1449
  l.fromArray(r.matrix), u.applyMatrix4(l);
1448
1450
  } else
1449
1451
  r.translation !== void 0 && u.position.fromArray(r.translation), r.rotation !== void 0 && u.quaternion.fromArray(r.rotation), r.scale !== void 0 && u.scale.fromArray(r.scale);
1450
- return n.associations.has(u) || n.associations.set(u, {}), n.associations.get(u).nodes = e, u;
1452
+ return s.associations.has(u) || s.associations.set(u, {}), s.associations.get(u).nodes = e, u;
1451
1453
  }), this.nodeCache[e];
1452
1454
  }
1453
1455
  /**
@@ -1456,28 +1458,28 @@ class sn {
1456
1458
  * @return {Promise<Group>}
1457
1459
  */
1458
1460
  loadScene(e) {
1459
- const t = this.extensions, o = this.json.scenes[e], n = this, r = new z();
1460
- o.name && (r.name = n.createUniqueName(o.name)), F(r, o), o.extensions && G(t, r, o);
1461
- const s = o.nodes || [], a = [];
1462
- for (let i = 0, c = s.length; i < c; i++)
1463
- a.push(n.getDependency("node", s[i]));
1461
+ const t = this.extensions, o = this.json.scenes[e], s = this, r = new z();
1462
+ o.name && (r.name = s.createUniqueName(o.name)), F(r, o), o.extensions && G(t, r, o);
1463
+ const n = o.nodes || [], a = [];
1464
+ for (let i = 0, c = n.length; i < c; i++)
1465
+ a.push(s.getDependency("node", n[i]));
1464
1466
  return Promise.all(a).then(function(i) {
1465
1467
  for (let u = 0, l = i.length; u < l; u++)
1466
1468
  r.add(i[u]);
1467
1469
  const c = (u) => {
1468
1470
  const l = /* @__PURE__ */ new Map();
1469
- for (const [f, m] of n.associations)
1471
+ for (const [f, m] of s.associations)
1470
1472
  (f instanceof Z || f instanceof de) && l.set(f, m);
1471
1473
  return u.traverse((f) => {
1472
- const m = n.associations.get(f);
1474
+ const m = s.associations.get(f);
1473
1475
  m != null && l.set(f, m);
1474
1476
  }), l;
1475
1477
  };
1476
- return n.associations = c(r), r;
1478
+ return s.associations = c(r), r;
1477
1479
  });
1478
1480
  }
1479
- _createAnimationTracks(e, t, o, n, r) {
1480
- const s = [], a = e.name ? e.name : e.uuid, i = [];
1481
+ _createAnimationTracks(e, t, o, s, r) {
1482
+ const n = [], a = e.name ? e.name : e.uuid, i = [];
1481
1483
  k[r.path] === k.weights ? e.traverse(function(f) {
1482
1484
  f.morphTargetInfluences && i.push(f.name ? f.name : f.uuid);
1483
1485
  }) : i.push(a);
@@ -1506,7 +1508,7 @@ class sn {
1506
1508
  }
1507
1509
  break;
1508
1510
  }
1509
- const u = n.interpolation !== void 0 ? Jt[n.interpolation] : ke, l = this._getArrayFromAccessor(o);
1511
+ const u = s.interpolation !== void 0 ? Jt[s.interpolation] : ke, l = this._getArrayFromAccessor(o);
1510
1512
  for (let f = 0, m = i.length; f < m; f++) {
1511
1513
  const T = new c(
1512
1514
  i[f] + "." + k[r.path],
@@ -1514,38 +1516,38 @@ class sn {
1514
1516
  l,
1515
1517
  u
1516
1518
  );
1517
- n.interpolation === "CUBICSPLINE" && this._createCubicSplineTrackInterpolant(T), s.push(T);
1519
+ s.interpolation === "CUBICSPLINE" && this._createCubicSplineTrackInterpolant(T), n.push(T);
1518
1520
  }
1519
- return s;
1521
+ return n;
1520
1522
  }
1521
1523
  _getArrayFromAccessor(e) {
1522
1524
  let t = e.array;
1523
1525
  if (e.normalized) {
1524
- const o = ie(t.constructor), n = new Float32Array(t.length);
1525
- for (let r = 0, s = t.length; r < s; r++)
1526
- n[r] = t[r] * o;
1527
- t = n;
1526
+ const o = ie(t.constructor), s = new Float32Array(t.length);
1527
+ for (let r = 0, n = t.length; r < n; r++)
1528
+ s[r] = t[r] * o;
1529
+ t = s;
1528
1530
  }
1529
1531
  return t;
1530
1532
  }
1531
1533
  _createCubicSplineTrackInterpolant(e) {
1532
1534
  e.createInterpolant = function(o) {
1533
- const n = this instanceof me ? Yt : Ue;
1534
- return new n(this.times, this.values, this.getValueSize() / 3, o);
1535
+ const s = this instanceof me ? Yt : Ue;
1536
+ return new s(this.times, this.values, this.getValueSize() / 3, o);
1535
1537
  }, e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0;
1536
1538
  }
1537
1539
  }
1538
1540
  function rn(d, e, t) {
1539
- const o = e.attributes, n = new yt();
1541
+ const o = e.attributes, s = new yt();
1540
1542
  if (o.POSITION !== void 0) {
1541
1543
  const a = t.json.accessors[o.POSITION], i = a.min, c = a.max;
1542
1544
  if (i !== void 0 && c !== void 0) {
1543
- if (n.set(
1545
+ if (s.set(
1544
1546
  new B(i[0], i[1], i[2]),
1545
1547
  new B(c[0], c[1], c[2])
1546
1548
  ), a.normalized) {
1547
1549
  const u = ie(j[a.componentType]);
1548
- n.min.multiplyScalar(u), n.max.multiplyScalar(u);
1550
+ s.min.multiplyScalar(u), s.max.multiplyScalar(u);
1549
1551
  }
1550
1552
  } else {
1551
1553
  console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
@@ -1562,38 +1564,38 @@ function rn(d, e, t) {
1562
1564
  const f = t.json.accessors[l.POSITION], m = f.min, T = f.max;
1563
1565
  if (m !== void 0 && T !== void 0) {
1564
1566
  if (i.setX(Math.max(Math.abs(m[0]), Math.abs(T[0]))), i.setY(Math.max(Math.abs(m[1]), Math.abs(T[1]))), i.setZ(Math.max(Math.abs(m[2]), Math.abs(T[2]))), f.normalized) {
1565
- const x = ie(j[f.componentType]);
1566
- i.multiplyScalar(x);
1567
+ const R = ie(j[f.componentType]);
1568
+ i.multiplyScalar(R);
1567
1569
  }
1568
1570
  a.max(i);
1569
1571
  } else
1570
1572
  console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
1571
1573
  }
1572
1574
  }
1573
- n.expandByVector(a);
1575
+ s.expandByVector(a);
1574
1576
  }
1575
- d.boundingBox = n;
1576
- const s = new Rt();
1577
- n.getCenter(s.center), s.radius = n.min.distanceTo(n.max) / 2, d.boundingSphere = s;
1577
+ d.boundingBox = s;
1578
+ const n = new xt();
1579
+ s.getCenter(n.center), n.radius = s.min.distanceTo(s.max) / 2, d.boundingSphere = n;
1578
1580
  }
1579
1581
  function Se(d, e, t) {
1580
- const o = e.attributes, n = [];
1581
- function r(s, a) {
1582
- return t.getDependency("accessor", s).then(function(i) {
1582
+ const o = e.attributes, s = [];
1583
+ function r(n, a) {
1584
+ return t.getDependency("accessor", n).then(function(i) {
1583
1585
  d.setAttribute(a, i);
1584
1586
  });
1585
1587
  }
1586
- for (const s in o) {
1587
- const a = oe[s] || s.toLowerCase();
1588
- a in d.attributes || n.push(r(o[s], a));
1588
+ for (const n in o) {
1589
+ const a = oe[n] || n.toLowerCase();
1590
+ a in d.attributes || s.push(r(o[n], a));
1589
1591
  }
1590
1592
  if (e.indices !== void 0 && !d.index) {
1591
- const s = t.getDependency("accessor", e.indices).then(function(a) {
1593
+ const n = t.getDependency("accessor", e.indices).then(function(a) {
1592
1594
  d.setIndex(a);
1593
1595
  });
1594
- n.push(s);
1596
+ s.push(n);
1595
1597
  }
1596
- return ge.workingColorSpace !== D && "COLOR_0" in o && console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${ge.workingColorSpace}" not supported.`), F(d, e), rn(d, e, t), Promise.all(n).then(function() {
1598
+ return ge.workingColorSpace !== D && "COLOR_0" in o && console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${ge.workingColorSpace}" not supported.`), F(d, e), rn(d, e, t), Promise.all(s).then(function() {
1597
1599
  return e.targets !== void 0 ? Zt(d, e.targets, t) : d;
1598
1600
  });
1599
1601
  }
@@ -1601,26 +1603,26 @@ class on {
1601
1603
  parse(e) {
1602
1604
  const t = {}, o = e.split(`
1603
1605
  `);
1604
- let n = null, r = t;
1605
- const s = [t];
1606
+ let s = null, r = t;
1607
+ const n = [t];
1606
1608
  for (const a of o)
1607
1609
  if (a.includes("=")) {
1608
1610
  const i = a.split("="), c = i[0].trim(), u = i[1].trim();
1609
1611
  if (u.endsWith("{")) {
1610
1612
  const l = {};
1611
- s.push(l), r[c] = l, r = l;
1613
+ n.push(l), r[c] = l, r = l;
1612
1614
  } else
1613
1615
  r[c] = u;
1614
1616
  } else if (a.endsWith("{")) {
1615
- const i = r[n] || {};
1616
- s.push(i), r[n] = i, r = i;
1617
+ const i = r[s] || {};
1618
+ n.push(i), r[s] = i, r = i;
1617
1619
  } else if (a.endsWith("}")) {
1618
- if (s.pop(), s.length === 0) continue;
1619
- r = s[s.length - 1];
1620
+ if (n.pop(), n.length === 0) continue;
1621
+ r = n[n.length - 1];
1620
1622
  } else if (a.endsWith("(")) {
1621
1623
  const i = {};
1622
- s.push(i), n = a.split("(")[0].trim() || n, r[n] = i, r = i;
1623
- } else a.endsWith(")") ? (s.pop(), r = s[s.length - 1]) : n = a.trim();
1624
+ n.push(i), s = a.split("(")[0].trim() || s, r[s] = i, r = i;
1625
+ } else a.endsWith(")") ? (n.pop(), r = n[n.length - 1]) : s = a.trim();
1624
1626
  return t;
1625
1627
  }
1626
1628
  }
@@ -1628,15 +1630,15 @@ class an extends ae {
1628
1630
  constructor(e) {
1629
1631
  super(e);
1630
1632
  }
1631
- load(e, t, o, n) {
1632
- const r = this, s = new K(r.manager);
1633
- s.setPath(r.path), s.setResponseType("arraybuffer"), s.setRequestHeader(r.requestHeader), s.setWithCredentials(r.withCredentials), s.load(e, function(a) {
1633
+ load(e, t, o, s) {
1634
+ const r = this, n = new K(r.manager);
1635
+ n.setPath(r.path), n.setResponseType("arraybuffer"), n.setRequestHeader(r.requestHeader), n.setWithCredentials(r.withCredentials), n.load(e, function(a) {
1634
1636
  try {
1635
1637
  t(r.parse(a));
1636
1638
  } catch (i) {
1637
- n ? n(i) : console.error(i), r.manager.itemError(e);
1639
+ s ? s(i) : console.error(i), r.manager.itemError(e);
1638
1640
  }
1639
- }, o, n);
1641
+ }, o, s);
1640
1642
  }
1641
1643
  parse(e) {
1642
1644
  const t = new on();
@@ -1649,7 +1651,7 @@ class an extends ae {
1649
1651
  p[A] = URL.createObjectURL(w);
1650
1652
  }
1651
1653
  if (A.endsWith("usd") || A.endsWith("usda")) {
1652
- if (n(h[A])) {
1654
+ if (s(h[A])) {
1653
1655
  console.warn("THREE.USDZLoader: Crate files (.usdc or binary .usd) are not supported.");
1654
1656
  continue;
1655
1657
  }
@@ -1659,7 +1661,7 @@ class an extends ae {
1659
1661
  }
1660
1662
  return p;
1661
1663
  }
1662
- function n(h) {
1664
+ function s(h) {
1663
1665
  const p = h.slice(0, 7), g = new Uint8Array([80, 88, 82, 45, 85, 83, 68, 67]);
1664
1666
  return p.every((A, w) => A === g[w]);
1665
1667
  }
@@ -1671,13 +1673,13 @@ class an extends ae {
1671
1673
  if (p.endsWith("usdc"))
1672
1674
  g = !0;
1673
1675
  else if (p.endsWith("usd"))
1674
- if (n(h[p]))
1676
+ if (s(h[p]))
1675
1677
  g = !0;
1676
1678
  else
1677
1679
  return h[p];
1678
1680
  g && console.warn("THREE.USDZLoader: Crate files (.usdc or binary .usd) are not supported.");
1679
1681
  }
1680
- const s = xt(new Uint8Array(e)), a = o(s), i = r(s);
1682
+ const n = Rt(new Uint8Array(e)), a = o(n), i = r(n);
1681
1683
  if (i === void 0)
1682
1684
  return console.warn("THREE.USDZLoader: No usda file found."), new z();
1683
1685
  const c = Ae(i), u = t.parse(c);
@@ -1745,7 +1747,7 @@ class an extends ae {
1745
1747
  }
1746
1748
  return new P(w, A);
1747
1749
  }
1748
- function x(h) {
1750
+ function R(h) {
1749
1751
  if (h) {
1750
1752
  if ("rel material:binding" in h) {
1751
1753
  const A = h["rel material:binding"].replace(/^<\//, "").replace(/>$/, "").split("/");
@@ -1765,7 +1767,7 @@ class an extends ae {
1765
1767
  }
1766
1768
  }
1767
1769
  }
1768
- function R(h, p) {
1770
+ function x(h, p) {
1769
1771
  p["float inputs:rotation"] && (h.rotation = parseFloat(p["float inputs:rotation"])), p["float2 inputs:scale"] && (h.repeat = new q().fromArray(JSON.parse("[" + p["float2 inputs:scale"].replace(/[()]*/g, "") + "]"))), p["float2 inputs:translation"] && (h.offset = new q().fromArray(JSON.parse("[" + p["float2 inputs:translation"].replace(/[()]*/g, "") + "]")));
1770
1772
  }
1771
1773
  function E(h) {
@@ -1775,41 +1777,41 @@ class an extends ae {
1775
1777
  const g = h['def Shader "PreviewSurface"'];
1776
1778
  if ("color3f inputs:diffuseColor.connect" in g) {
1777
1779
  const A = g["color3f inputs:diffuseColor.connect"], w = S(u, /(\w+).output/.exec(A)[1]);
1778
- p.map = _(w), p.map.colorSpace = N, 'def Shader "Transform2d_diffuse"' in h && R(p.map, h['def Shader "Transform2d_diffuse"']);
1780
+ p.map = _(w), p.map.colorSpace = N, 'def Shader "Transform2d_diffuse"' in h && x(p.map, h['def Shader "Transform2d_diffuse"']);
1779
1781
  } else if ("color3f inputs:diffuseColor" in g) {
1780
1782
  const A = g["color3f inputs:diffuseColor"].replace(/[()]*/g, "");
1781
1783
  p.color.fromArray(JSON.parse("[" + A + "]"));
1782
1784
  }
1783
1785
  if ("color3f inputs:emissiveColor.connect" in g) {
1784
1786
  const A = g["color3f inputs:emissiveColor.connect"], w = S(u, /(\w+).output/.exec(A)[1]);
1785
- p.emissiveMap = _(w), p.emissiveMap.colorSpace = N, p.emissive.set(16777215), 'def Shader "Transform2d_emissive"' in h && R(p.emissiveMap, h['def Shader "Transform2d_emissive"']);
1787
+ p.emissiveMap = _(w), p.emissiveMap.colorSpace = N, p.emissive.set(16777215), 'def Shader "Transform2d_emissive"' in h && x(p.emissiveMap, h['def Shader "Transform2d_emissive"']);
1786
1788
  } else if ("color3f inputs:emissiveColor" in g) {
1787
1789
  const A = g["color3f inputs:emissiveColor"].replace(/[()]*/g, "");
1788
1790
  p.emissive.fromArray(JSON.parse("[" + A + "]"));
1789
1791
  }
1790
1792
  if ("normal3f inputs:normal.connect" in g) {
1791
1793
  const A = g["normal3f inputs:normal.connect"], w = S(u, /(\w+).output/.exec(A)[1]);
1792
- p.normalMap = _(w), p.normalMap.colorSpace = H, 'def Shader "Transform2d_normal"' in h && R(p.normalMap, h['def Shader "Transform2d_normal"']);
1794
+ p.normalMap = _(w), p.normalMap.colorSpace = H, 'def Shader "Transform2d_normal"' in h && x(p.normalMap, h['def Shader "Transform2d_normal"']);
1793
1795
  }
1794
1796
  if ("float inputs:roughness.connect" in g) {
1795
1797
  const A = g["float inputs:roughness.connect"], w = S(u, /(\w+).output/.exec(A)[1]);
1796
- p.roughness = 1, p.roughnessMap = _(w), p.roughnessMap.colorSpace = H, 'def Shader "Transform2d_roughness"' in h && R(p.roughnessMap, h['def Shader "Transform2d_roughness"']);
1798
+ p.roughness = 1, p.roughnessMap = _(w), p.roughnessMap.colorSpace = H, 'def Shader "Transform2d_roughness"' in h && x(p.roughnessMap, h['def Shader "Transform2d_roughness"']);
1797
1799
  } else "float inputs:roughness" in g && (p.roughness = parseFloat(g["float inputs:roughness"]));
1798
1800
  if ("float inputs:metallic.connect" in g) {
1799
1801
  const A = g["float inputs:metallic.connect"], w = S(u, /(\w+).output/.exec(A)[1]);
1800
- p.metalness = 1, p.metalnessMap = _(w), p.metalnessMap.colorSpace = H, 'def Shader "Transform2d_metallic"' in h && R(p.metalnessMap, h['def Shader "Transform2d_metallic"']);
1802
+ p.metalness = 1, p.metalnessMap = _(w), p.metalnessMap.colorSpace = H, 'def Shader "Transform2d_metallic"' in h && x(p.metalnessMap, h['def Shader "Transform2d_metallic"']);
1801
1803
  } else "float inputs:metallic" in g && (p.metalness = parseFloat(g["float inputs:metallic"]));
1802
1804
  if ("float inputs:clearcoat.connect" in g) {
1803
1805
  const A = g["float inputs:clearcoat.connect"], w = S(u, /(\w+).output/.exec(A)[1]);
1804
- p.clearcoat = 1, p.clearcoatMap = _(w), p.clearcoatMap.colorSpace = H, 'def Shader "Transform2d_clearcoat"' in h && R(p.clearcoatMap, h['def Shader "Transform2d_clearcoat"']);
1806
+ p.clearcoat = 1, p.clearcoatMap = _(w), p.clearcoatMap.colorSpace = H, 'def Shader "Transform2d_clearcoat"' in h && x(p.clearcoatMap, h['def Shader "Transform2d_clearcoat"']);
1805
1807
  } else "float inputs:clearcoat" in g && (p.clearcoat = parseFloat(g["float inputs:clearcoat"]));
1806
1808
  if ("float inputs:clearcoatRoughness.connect" in g) {
1807
1809
  const A = g["float inputs:clearcoatRoughness.connect"], w = S(u, /(\w+).output/.exec(A)[1]);
1808
- p.clearcoatRoughness = 1, p.clearcoatRoughnessMap = _(w), p.clearcoatRoughnessMap.colorSpace = H, 'def Shader "Transform2d_clearcoatRoughness"' in h && R(p.clearcoatRoughnessMap, h['def Shader "Transform2d_clearcoatRoughness"']);
1810
+ p.clearcoatRoughness = 1, p.clearcoatRoughnessMap = _(w), p.clearcoatRoughnessMap.colorSpace = H, 'def Shader "Transform2d_clearcoatRoughness"' in h && x(p.clearcoatRoughnessMap, h['def Shader "Transform2d_clearcoatRoughness"']);
1809
1811
  } else "float inputs:clearcoatRoughness" in g && (p.clearcoatRoughness = parseFloat(g["float inputs:clearcoatRoughness"]));
1810
1812
  if ("float inputs:ior" in g && (p.ior = parseFloat(g["float inputs:ior"])), "float inputs:occlusion.connect" in g) {
1811
1813
  const A = g["float inputs:occlusion.connect"], w = S(u, /(\w+).output/.exec(A)[1]);
1812
- p.aoMap = _(w), p.aoMap.colorSpace = H, 'def Shader "Transform2d_occlusion"' in h && R(p.aoMap, h['def Shader "Transform2d_occlusion"']);
1814
+ p.aoMap = _(w), p.aoMap.colorSpace = H, 'def Shader "Transform2d_occlusion"' in h && x(p.aoMap, h['def Shader "Transform2d_occlusion"']);
1813
1815
  }
1814
1816
  }
1815
1817
  if ('def Shader "diffuseColor_texture"' in h) {
@@ -1846,7 +1848,7 @@ class an extends ae {
1846
1848
  return null;
1847
1849
  }
1848
1850
  function M(h) {
1849
- const p = m(l(h)), g = E(x(h)), A = p ? new Pe(p, g) : new ce();
1851
+ const p = m(l(h)), g = E(R(h)), A = p ? new Pe(p, g) : new ce();
1850
1852
  if ("matrix4d xformOp:transform" in h) {
1851
1853
  const w = JSON.parse("[" + h["matrix4d xformOp:transform"].replace(/[()]*/g, "") + "]");
1852
1854
  A.matrix.fromArray(w), A.matrix.decompose(A.position, A.quaternion, A.scale);
@@ -1890,25 +1892,25 @@ class cn extends ae {
1890
1892
  setWorkerLimit(e) {
1891
1893
  return this.workerLimit = e, this;
1892
1894
  }
1893
- load(e, t, o, n) {
1895
+ load(e, t, o, s) {
1894
1896
  const r = new K(this.manager);
1895
- r.setPath(this.path), r.setResponseType("arraybuffer"), r.setRequestHeader(this.requestHeader), r.setWithCredentials(this.withCredentials), r.load(e, (s) => {
1896
- this.parse(s, t, n);
1897
- }, o, n);
1897
+ r.setPath(this.path), r.setResponseType("arraybuffer"), r.setRequestHeader(this.requestHeader), r.setWithCredentials(this.withCredentials), r.load(e, (n) => {
1898
+ this.parse(n, t, s);
1899
+ }, o, s);
1898
1900
  }
1899
1901
  parse(e, t, o = () => {
1900
1902
  }) {
1901
1903
  this.decodeDracoFile(e, t, null, null, N).catch(o);
1902
1904
  }
1903
- decodeDracoFile(e, t, o, n, r = D, s = () => {
1905
+ decodeDracoFile(e, t, o, s, r = D, n = () => {
1904
1906
  }) {
1905
1907
  const a = {
1906
1908
  attributeIDs: o || this.defaultAttributeIDs,
1907
- attributeTypes: n || this.defaultAttributeTypes,
1909
+ attributeTypes: s || this.defaultAttributeTypes,
1908
1910
  useUniqueIDs: !!o,
1909
1911
  vertexColorSpace: r
1910
1912
  };
1911
- return this.decodeGeometry(e, a).then(t).catch(s);
1913
+ return this.decodeGeometry(e, a).then(t).catch(n);
1912
1914
  }
1913
1915
  decodeGeometry(e, t) {
1914
1916
  const o = JSON.stringify(t);
@@ -1921,12 +1923,12 @@ class cn extends ae {
1921
1923
  "THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred."
1922
1924
  );
1923
1925
  }
1924
- let n;
1925
- const r = this.workerNextTaskID++, s = e.byteLength, a = this._getWorker(r, s).then((i) => (n = i, new Promise((c, u) => {
1926
- n._callbacks[r] = { resolve: c, reject: u }, n.postMessage({ type: "decode", id: r, taskConfig: t, buffer: e }, [e]);
1926
+ let s;
1927
+ const r = this.workerNextTaskID++, n = e.byteLength, a = this._getWorker(r, n).then((i) => (s = i, new Promise((c, u) => {
1928
+ s._callbacks[r] = { resolve: c, reject: u }, s.postMessage({ type: "decode", id: r, taskConfig: t, buffer: e }, [e]);
1927
1929
  }))).then((i) => this._createGeometry(i.geometry));
1928
1930
  return a.catch(() => !0).then(() => {
1929
- n && r && this._releaseTask(n, r);
1931
+ s && r && this._releaseTask(s, r);
1930
1932
  }), ne.set(e, {
1931
1933
  key: o,
1932
1934
  promise: a
@@ -1936,21 +1938,21 @@ class cn extends ae {
1936
1938
  const t = new ue();
1937
1939
  e.index && t.setIndex(new P(e.index.array, 1));
1938
1940
  for (let o = 0; o < e.attributes.length; o++) {
1939
- const n = e.attributes[o], r = n.name, s = n.array, a = n.itemSize, i = new P(s, a);
1940
- r === "color" && (this._assignVertexColorSpace(i, n.vertexColorSpace), i.normalized = !(s instanceof Float32Array)), t.setAttribute(r, i);
1941
+ const s = e.attributes[o], r = s.name, n = s.array, a = s.itemSize, i = new P(n, a);
1942
+ r === "color" && (this._assignVertexColorSpace(i, s.vertexColorSpace), i.normalized = !(n instanceof Float32Array)), t.setAttribute(r, i);
1941
1943
  }
1942
1944
  return t;
1943
1945
  }
1944
1946
  _assignVertexColorSpace(e, t) {
1945
1947
  if (t !== N) return;
1946
1948
  const o = new U();
1947
- for (let n = 0, r = e.count; n < r; n++)
1948
- o.fromBufferAttribute(e, n).convertSRGBToLinear(), e.setXYZ(n, o.r, o.g, o.b);
1949
+ for (let s = 0, r = e.count; s < r; s++)
1950
+ o.fromBufferAttribute(e, s).convertSRGBToLinear(), e.setXYZ(s, o.r, o.g, o.b);
1949
1951
  }
1950
1952
  _loadLibrary(e, t) {
1951
1953
  const o = new K(this.manager);
1952
- return o.setPath(this.decoderPath), o.setResponseType(t), o.setWithCredentials(this.withCredentials), new Promise((n, r) => {
1953
- o.load(e, n, void 0, r);
1954
+ return o.setPath(this.decoderPath), o.setResponseType(t), o.setWithCredentials(this.withCredentials), new Promise((s, r) => {
1955
+ o.load(e, s, void 0, r);
1954
1956
  });
1955
1957
  }
1956
1958
  preload() {
@@ -1960,39 +1962,39 @@ class cn extends ae {
1960
1962
  if (this.decoderPending) return this.decoderPending;
1961
1963
  const e = typeof WebAssembly != "object" || this.decoderConfig.type === "js", t = [];
1962
1964
  return e ? t.push(this._loadLibrary("draco_decoder.js", "text")) : (t.push(this._loadLibrary("draco_wasm_wrapper.js", "text")), t.push(this._loadLibrary("draco_decoder.wasm", "arraybuffer"))), this.decoderPending = Promise.all(t).then((o) => {
1963
- const n = o[0];
1965
+ const s = o[0];
1964
1966
  e || (this.decoderConfig.wasmBinary = o[1]);
1965
- const r = un.toString(), s = [
1967
+ const r = un.toString(), n = [
1966
1968
  "/* draco decoder */",
1967
- n,
1969
+ s,
1968
1970
  "",
1969
1971
  "/* worker */",
1970
1972
  r.substring(r.indexOf("{") + 1, r.lastIndexOf("}"))
1971
1973
  ].join(`
1972
1974
  `);
1973
- this.workerSourceURL = URL.createObjectURL(new Blob([s]));
1975
+ this.workerSourceURL = URL.createObjectURL(new Blob([n]));
1974
1976
  }), this.decoderPending;
1975
1977
  }
1976
1978
  _getWorker(e, t) {
1977
1979
  return this._initDecoder().then(() => {
1978
1980
  if (this.workerPool.length < this.workerLimit) {
1979
- const n = new Worker(this.workerSourceURL);
1980
- n._callbacks = {}, n._taskCosts = {}, n._taskLoad = 0, n.postMessage({ type: "init", decoderConfig: this.decoderConfig }), n.onmessage = function(r) {
1981
- const s = r.data;
1982
- switch (s.type) {
1981
+ const s = new Worker(this.workerSourceURL);
1982
+ s._callbacks = {}, s._taskCosts = {}, s._taskLoad = 0, s.postMessage({ type: "init", decoderConfig: this.decoderConfig }), s.onmessage = function(r) {
1983
+ const n = r.data;
1984
+ switch (n.type) {
1983
1985
  case "decode":
1984
- n._callbacks[s.id].resolve(s);
1986
+ s._callbacks[n.id].resolve(n);
1985
1987
  break;
1986
1988
  case "error":
1987
- n._callbacks[s.id].reject(s);
1989
+ s._callbacks[n.id].reject(n);
1988
1990
  break;
1989
1991
  default:
1990
- console.error('THREE.DRACOLoader: Unexpected message, "' + s.type + '"');
1992
+ console.error('THREE.DRACOLoader: Unexpected message, "' + n.type + '"');
1991
1993
  }
1992
- }, this.workerPool.push(n);
1994
+ }, this.workerPool.push(s);
1993
1995
  } else
1994
- this.workerPool.sort(function(n, r) {
1995
- return n._taskLoad > r._taskLoad ? -1 : 1;
1996
+ this.workerPool.sort(function(s, r) {
1997
+ return s._taskLoad > r._taskLoad ? -1 : 1;
1996
1998
  });
1997
1999
  const o = this.workerPool[this.workerPool.length - 1];
1998
2000
  return o._taskCosts[e] = t, o._taskLoad += t, o;
@@ -2012,8 +2014,8 @@ class cn extends ae {
2012
2014
  }
2013
2015
  function un() {
2014
2016
  let d, e;
2015
- onmessage = function(s) {
2016
- const a = s.data;
2017
+ onmessage = function(n) {
2018
+ const a = n.data;
2017
2019
  switch (a.type) {
2018
2020
  case "init":
2019
2021
  d = a.decoderConfig, e = new Promise(function(u) {
@@ -2027,7 +2029,7 @@ function un() {
2027
2029
  e.then((u) => {
2028
2030
  const l = u.draco, f = new l.Decoder();
2029
2031
  try {
2030
- const m = t(l, f, new Int8Array(i), c), T = m.attributes.map((x) => x.array.buffer);
2032
+ const m = t(l, f, new Int8Array(i), c), T = m.attributes.map((R) => R.array.buffer);
2031
2033
  m.index && T.push(m.index.array.buffer), self.postMessage({ type: "decode", id: a.id, geometry: m }, T);
2032
2034
  } catch (m) {
2033
2035
  console.error(m), self.postMessage({ type: "error", id: a.id, error: m.message });
@@ -2038,72 +2040,72 @@ function un() {
2038
2040
  break;
2039
2041
  }
2040
2042
  };
2041
- function t(s, a, i, c) {
2043
+ function t(n, a, i, c) {
2042
2044
  const u = c.attributeIDs, l = c.attributeTypes;
2043
2045
  let f, m;
2044
2046
  const T = a.GetEncodedGeometryType(i);
2045
- if (T === s.TRIANGULAR_MESH)
2046
- f = new s.Mesh(), m = a.DecodeArrayToMesh(i, i.byteLength, f);
2047
- else if (T === s.POINT_CLOUD)
2048
- f = new s.PointCloud(), m = a.DecodeArrayToPointCloud(i, i.byteLength, f);
2047
+ if (T === n.TRIANGULAR_MESH)
2048
+ f = new n.Mesh(), m = a.DecodeArrayToMesh(i, i.byteLength, f);
2049
+ else if (T === n.POINT_CLOUD)
2050
+ f = new n.PointCloud(), m = a.DecodeArrayToPointCloud(i, i.byteLength, f);
2049
2051
  else
2050
2052
  throw new Error("THREE.DRACOLoader: Unexpected geometry type.");
2051
2053
  if (!m.ok() || f.ptr === 0)
2052
2054
  throw new Error("THREE.DRACOLoader: Decoding failed: " + m.error_msg());
2053
- const x = { index: null, attributes: [] };
2055
+ const R = { index: null, attributes: [] };
2054
2056
  for (const y in u) {
2055
- const R = self[l[y]];
2057
+ const x = self[l[y]];
2056
2058
  let E, S;
2057
2059
  if (c.useUniqueIDs)
2058
2060
  S = u[y], E = a.GetAttributeByUniqueId(f, S);
2059
2061
  else {
2060
- if (S = a.GetAttributeId(f, s[u[y]]), S === -1) continue;
2062
+ if (S = a.GetAttributeId(f, n[u[y]]), S === -1) continue;
2061
2063
  E = a.GetAttribute(f, S);
2062
2064
  }
2063
- const _ = n(s, a, f, y, R, E);
2064
- y === "color" && (_.vertexColorSpace = c.vertexColorSpace), x.attributes.push(_);
2065
+ const _ = s(n, a, f, y, x, E);
2066
+ y === "color" && (_.vertexColorSpace = c.vertexColorSpace), R.attributes.push(_);
2065
2067
  }
2066
- return T === s.TRIANGULAR_MESH && (x.index = o(s, a, f)), s.destroy(f), x;
2068
+ return T === n.TRIANGULAR_MESH && (R.index = o(n, a, f)), n.destroy(f), R;
2067
2069
  }
2068
- function o(s, a, i) {
2069
- const u = i.num_faces() * 3, l = u * 4, f = s._malloc(l);
2070
+ function o(n, a, i) {
2071
+ const u = i.num_faces() * 3, l = u * 4, f = n._malloc(l);
2070
2072
  a.GetTrianglesUInt32Array(i, l, f);
2071
- const m = new Uint32Array(s.HEAPF32.buffer, f, u).slice();
2072
- return s._free(f), { array: m, itemSize: 1 };
2073
- }
2074
- function n(s, a, i, c, u, l) {
2075
- const f = l.num_components(), T = i.num_points() * f, x = T * u.BYTES_PER_ELEMENT, y = r(s, u), R = s._malloc(x);
2076
- a.GetAttributeDataArrayForAllPoints(i, l, y, x, R);
2077
- const E = new u(s.HEAPF32.buffer, R, T).slice();
2078
- return s._free(R), {
2073
+ const m = new Uint32Array(n.HEAPF32.buffer, f, u).slice();
2074
+ return n._free(f), { array: m, itemSize: 1 };
2075
+ }
2076
+ function s(n, a, i, c, u, l) {
2077
+ const f = l.num_components(), T = i.num_points() * f, R = T * u.BYTES_PER_ELEMENT, y = r(n, u), x = n._malloc(R);
2078
+ a.GetAttributeDataArrayForAllPoints(i, l, y, R, x);
2079
+ const E = new u(n.HEAPF32.buffer, x, T).slice();
2080
+ return n._free(x), {
2079
2081
  name: c,
2080
2082
  array: E,
2081
2083
  itemSize: f
2082
2084
  };
2083
2085
  }
2084
- function r(s, a) {
2086
+ function r(n, a) {
2085
2087
  switch (a) {
2086
2088
  case Float32Array:
2087
- return s.DT_FLOAT32;
2089
+ return n.DT_FLOAT32;
2088
2090
  case Int8Array:
2089
- return s.DT_INT8;
2091
+ return n.DT_INT8;
2090
2092
  case Int16Array:
2091
- return s.DT_INT16;
2093
+ return n.DT_INT16;
2092
2094
  case Int32Array:
2093
- return s.DT_INT32;
2095
+ return n.DT_INT32;
2094
2096
  case Uint8Array:
2095
- return s.DT_UINT8;
2097
+ return n.DT_UINT8;
2096
2098
  case Uint16Array:
2097
- return s.DT_UINT16;
2099
+ return n.DT_UINT16;
2098
2100
  case Uint32Array:
2099
- return s.DT_UINT32;
2101
+ return n.DT_UINT32;
2100
2102
  }
2101
2103
  }
2102
2104
  }
2103
2105
  function ln() {
2104
2106
  let d, e;
2105
- onmessage = function(s) {
2106
- const a = s.data;
2107
+ onmessage = function(n) {
2108
+ const a = n.data;
2107
2109
  switch (a.type) {
2108
2110
  case "init":
2109
2111
  d = a.decoderConfig, e = new Promise(function(u) {
@@ -2123,7 +2125,7 @@ function ln() {
2123
2125
  new Int8Array(i),
2124
2126
  c
2125
2127
  ), T = m.attributes.map(
2126
- (x) => x.array.buffer
2128
+ (R) => R.array.buffer
2127
2129
  );
2128
2130
  m.index && T.push(m.index.array.buffer), self.postMessage(
2129
2131
  { type: "decode", id: a.id, geometry: m },
@@ -2142,18 +2144,18 @@ function ln() {
2142
2144
  break;
2143
2145
  }
2144
2146
  };
2145
- function t(s, a, i, c) {
2147
+ function t(n, a, i, c) {
2146
2148
  const u = c.attributeIDs, l = c.attributeTypes;
2147
2149
  let f, m;
2148
2150
  const T = a.GetEncodedGeometryType(i);
2149
- if (T === s.TRIANGULAR_MESH)
2150
- f = new s.Mesh(), m = a.DecodeArrayToMesh(
2151
+ if (T === n.TRIANGULAR_MESH)
2152
+ f = new n.Mesh(), m = a.DecodeArrayToMesh(
2151
2153
  i,
2152
2154
  i.byteLength,
2153
2155
  f
2154
2156
  );
2155
- else if (T === s.POINT_CLOUD)
2156
- f = new s.PointCloud(), m = a.DecodeArrayToPointCloud(
2157
+ else if (T === n.POINT_CLOUD)
2158
+ f = new n.PointCloud(), m = a.DecodeArrayToPointCloud(
2157
2159
  i,
2158
2160
  i.byteLength,
2159
2161
  f
@@ -2164,9 +2166,9 @@ function ln() {
2164
2166
  throw new Error(
2165
2167
  "THREE.DRACOLoader: Decoding failed: " + m.error_msg()
2166
2168
  );
2167
- const x = { index: null, attributes: [] };
2169
+ const R = { index: null, attributes: [] };
2168
2170
  for (const y in u) {
2169
- const R = self[l[y]];
2171
+ const x = self[l[y]];
2170
2172
  let E, S;
2171
2173
  if (c.useUniqueIDs)
2172
2174
  S = u[y], E = a.GetAttributeByUniqueId(
@@ -2176,68 +2178,68 @@ function ln() {
2176
2178
  else {
2177
2179
  if (S = a.GetAttributeId(
2178
2180
  f,
2179
- s[u[y]]
2181
+ n[u[y]]
2180
2182
  ), S === -1) continue;
2181
2183
  E = a.GetAttribute(f, S);
2182
2184
  }
2183
- const _ = n(
2184
- s,
2185
+ const _ = s(
2186
+ n,
2185
2187
  a,
2186
2188
  f,
2187
2189
  y,
2188
- R,
2190
+ x,
2189
2191
  E
2190
2192
  );
2191
- y === "color" && (_.vertexColorSpace = c.vertexColorSpace), x.attributes.push(_);
2193
+ y === "color" && (_.vertexColorSpace = c.vertexColorSpace), R.attributes.push(_);
2192
2194
  }
2193
- return T === s.TRIANGULAR_MESH && (x.index = o(s, a, f)), s.destroy(f), x;
2195
+ return T === n.TRIANGULAR_MESH && (R.index = o(n, a, f)), n.destroy(f), R;
2194
2196
  }
2195
- function o(s, a, i) {
2196
- const u = i.num_faces() * 3, l = u * 4, f = s._malloc(l);
2197
+ function o(n, a, i) {
2198
+ const u = i.num_faces() * 3, l = u * 4, f = n._malloc(l);
2197
2199
  a.GetTrianglesUInt32Array(i, l, f);
2198
2200
  const m = new Uint32Array(
2199
- s.HEAPF32.buffer,
2201
+ n.HEAPF32.buffer,
2200
2202
  f,
2201
2203
  u
2202
2204
  ).slice();
2203
- return s._free(f), { array: m, itemSize: 1 };
2205
+ return n._free(f), { array: m, itemSize: 1 };
2204
2206
  }
2205
- function n(s, a, i, c, u, l) {
2206
- const f = l.num_components(), T = i.num_points() * f, x = T * u.BYTES_PER_ELEMENT, y = r(s, u), R = s._malloc(x);
2207
+ function s(n, a, i, c, u, l) {
2208
+ const f = l.num_components(), T = i.num_points() * f, R = T * u.BYTES_PER_ELEMENT, y = r(n, u), x = n._malloc(R);
2207
2209
  a.GetAttributeDataArrayForAllPoints(
2208
2210
  i,
2209
2211
  l,
2210
2212
  y,
2211
- x,
2212
- R
2213
+ R,
2214
+ x
2213
2215
  );
2214
2216
  const E = new u(
2215
- s.HEAPF32.buffer,
2216
- R,
2217
+ n.HEAPF32.buffer,
2218
+ x,
2217
2219
  T
2218
2220
  ).slice();
2219
- return s._free(R), {
2221
+ return n._free(x), {
2220
2222
  name: c,
2221
2223
  array: E,
2222
2224
  itemSize: f
2223
2225
  };
2224
2226
  }
2225
- function r(s, a) {
2227
+ function r(n, a) {
2226
2228
  switch (a) {
2227
2229
  case Float32Array:
2228
- return s.DT_FLOAT32;
2230
+ return n.DT_FLOAT32;
2229
2231
  case Int8Array:
2230
- return s.DT_INT8;
2232
+ return n.DT_INT8;
2231
2233
  case Int16Array:
2232
- return s.DT_INT16;
2234
+ return n.DT_INT16;
2233
2235
  case Int32Array:
2234
- return s.DT_INT32;
2236
+ return n.DT_INT32;
2235
2237
  case Uint8Array:
2236
- return s.DT_UINT8;
2238
+ return n.DT_UINT8;
2237
2239
  case Uint16Array:
2238
- return s.DT_UINT16;
2240
+ return n.DT_UINT16;
2239
2241
  case Uint32Array:
2240
- return s.DT_UINT32;
2242
+ return n.DT_UINT32;
2241
2243
  }
2242
2244
  }
2243
2245
  }
@@ -2269,15 +2271,15 @@ class fn extends cn {
2269
2271
  ), o.push(
2270
2272
  se.LOAD_DRACO_WASM_DECODER()
2271
2273
  )), this.decoderPending = Promise.all(o).then(
2272
- (n) => {
2273
- const r = n[0];
2274
- t || (this.decoderConfig.wasmBinary = n[1]);
2275
- const s = ln.toString(), a = [
2274
+ (s) => {
2275
+ const r = s[0];
2276
+ t || (this.decoderConfig.wasmBinary = s[1]);
2277
+ const n = ln.toString(), a = [
2276
2278
  "/* draco decoder */",
2277
2279
  r,
2278
2280
  "",
2279
2281
  "/* worker */",
2280
- s.substring(s.indexOf("{") + 1, s.lastIndexOf("}"))
2282
+ n.substring(n.indexOf("{") + 1, n.lastIndexOf("}"))
2281
2283
  ].join(`
2282
2284
  `);
2283
2285
  this.workerSourceURL = URL.createObjectURL(new Blob([a]));
@@ -2285,54 +2287,49 @@ class fn extends cn {
2285
2287
  ), this.decoderPending;
2286
2288
  }
2287
2289
  }
2288
- class Tn {
2290
+ class xn {
2289
2291
  constructor() {
2290
2292
  v(this, "_gltfLoader");
2291
2293
  v(this, "_usdzLoader");
2292
2294
  const e = new fn();
2293
2295
  e.setDecoderConfig({ type: "wasm" }), this._gltfLoader = new St(), this._gltfLoader.setDRACOLoader(e), this._usdzLoader = new an();
2294
2296
  }
2295
- async _loadFile(e) {
2296
- const t = await fetch(e);
2297
- if (!t.ok)
2298
- throw new Te(e, `Failed to fetch file from ${e}`);
2299
- try {
2300
- return await t.arrayBuffer();
2301
- } catch {
2302
- throw new Te(e, `Failed to fetch file from ${e}`);
2303
- }
2304
- }
2305
2297
  async load(e) {
2306
2298
  const t = wt(e);
2307
2299
  if (t.length === 0)
2308
- throw new ye("No file extension found in URI", "");
2300
+ throw new Te("No file extension found in URI", "");
2309
2301
  if (!Et(t))
2310
- throw new ye(
2302
+ throw new Te(
2311
2303
  `Unsupported file type: ${t}. Supported types: ${_t.join(", ")}`,
2312
2304
  t
2313
2305
  );
2314
- const o = await this._loadFile(e);
2315
- try {
2316
- switch (t) {
2317
- case "glb":
2318
- case "gltf":
2319
- return (await this._gltfLoader.parseAsync(
2320
- o,
2321
- ""
2322
- )).scene;
2323
- case "usdz":
2324
- return await this._usdzLoader.parse(o);
2306
+ const o = xe.read(e);
2307
+ if (o)
2308
+ return o.result ? o.result : o.promise;
2309
+ const s = async (n) => {
2310
+ try {
2311
+ switch (t) {
2312
+ case "glb":
2313
+ case "gltf":
2314
+ return (await this._gltfLoader.parseAsync(
2315
+ n,
2316
+ ""
2317
+ )).scene;
2318
+ case "usdz":
2319
+ return await this._usdzLoader.parse(n);
2320
+ }
2321
+ } catch (a) {
2322
+ throw a instanceof Error ? new ye(
2323
+ `Failed to parse ${t} file: ${a.message}`,
2324
+ a
2325
+ ) : new ye(`Failed to parse ${t} file`);
2325
2326
  }
2326
- } catch (n) {
2327
- throw n instanceof Error ? new Re(
2328
- `Failed to parse ${t} file: ${n.message}`,
2329
- n
2330
- ) : new Re(`Failed to parse ${t} file`);
2331
- }
2327
+ };
2328
+ return xe.create(e, s).fetch();
2332
2329
  }
2333
2330
  }
2334
2331
  export {
2335
- Tn as A,
2332
+ xn as A,
2336
2333
  fn as D,
2337
2334
  ln as a
2338
2335
  };