@quick-threejs/reactive 0.1.30 → 0.1.31

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.
package/dist/main.mjs CHANGED
@@ -1,10 +1,10 @@
1
- var Xe = Object.defineProperty;
2
- var We = (o, e, t) => e in o ? Xe(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
- var _ = (o, e, t) => We(o, typeof e != "symbol" ? e + "" : e, t);
4
- import { s as V, C as $e, P as qe, a as Ce, f as Ye, m as ce, b as Me, J as ee, K as Qe, i as L, S as Je, c as Ze, W as Te, d as Ie, e as et, L as tt, R as st, U as nt, g as rt, h as Oe, A as z, D as X, j as _e, Q as it } from "./app.module-BHCAJZLN.mjs";
5
- import { k as Zs, o as en, n as tn, l as sn } from "./app.module-BHCAJZLN.mjs";
6
- import { TrianglesDrawMode as ot, TriangleFanDrawMode as le, TriangleStripDrawMode as Ne, Loader as Pe, FileLoader as W, SRGBColorSpace as N, LinearSRGBColorSpace as S, BufferGeometry as De, BufferAttribute as j, Color as P, ColorManagement as ue, LoaderUtils as K, SpotLight as at, PointLight as ct, DirectionalLight as lt, MeshBasicMaterial as B, MeshPhysicalMaterial as v, Vector2 as ke, Matrix4 as $, Vector3 as F, Quaternion as Fe, InstancedMesh as ut, InstancedBufferAttribute as dt, Object3D as He, TextureLoader as ht, ImageBitmapLoader as Ue, InterleavedBuffer as ft, InterleavedBufferAttribute as pt, LinearFilter as de, LinearMipmapLinearFilter as Ge, RepeatWrapping as he, NearestFilter as Be, PointsMaterial as mt, Material as te, LineBasicMaterial as gt, MeshStandardMaterial as je, DoubleSide as At, PropertyBinding as Tt, SkinnedMesh as _t, Mesh as Rt, LineSegments as Et, Line as wt, LineLoop as xt, Points as yt, Group as se, PerspectiveCamera as Lt, MathUtils as bt, OrthographicCamera as St, Skeleton as vt, AnimationClip as Ct, Bone as Mt, InterpolateLinear as Ke, NearestMipmapNearestFilter as It, LinearMipmapNearestFilter as Ot, NearestMipmapLinearFilter as Nt, ClampToEdgeWrapping as Pt, MirroredRepeatWrapping as Dt, InterpolateDiscrete as kt, FrontSide as Ft, Texture as Re, VectorKeyframeTrack as Ee, NumberKeyframeTrack as we, QuaternionKeyframeTrack as xe, Box3 as Ht, Sphere as Ut, Interpolant as Gt, LoadingManager as Bt, AudioLoader as jt } from "three";
7
- class Ae {
1
+ var $e = Object.defineProperty;
2
+ var qe = (o, e, t) => e in o ? $e(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
+ var _ = (o, e, t) => qe(o, typeof e != "symbol" ? e + "" : e, t);
4
+ import { s as z, C as Ye, P as Qe, a as Me, f as Je, m as $, b as Ie, J as j, K as Ze, i as L, S as et, c as se, W as _e, U as Oe, d as Ne, e as tt, L as st, R as nt, g as rt, h as Pe, A as X, D as W, j as Re, Q as it } from "./app.module-BbeIDure.mjs";
5
+ import { k as Zs, o as en, n as tn, l as sn } from "./app.module-BbeIDure.mjs";
6
+ import { TrianglesDrawMode as ot, TriangleFanDrawMode as ue, TriangleStripDrawMode as De, Loader as ke, FileLoader as q, SRGBColorSpace as N, LinearSRGBColorSpace as S, BufferGeometry as Fe, BufferAttribute as K, Color as P, ColorManagement as de, LoaderUtils as V, SpotLight as at, PointLight as ct, DirectionalLight as lt, MeshBasicMaterial as B, MeshPhysicalMaterial as v, Vector2 as He, Matrix4 as Y, Vector3 as F, Quaternion as Ue, InstancedMesh as ut, InstancedBufferAttribute as dt, Object3D as Ge, TextureLoader as ht, ImageBitmapLoader as Be, InterleavedBuffer as ft, InterleavedBufferAttribute as pt, LinearFilter as he, LinearMipmapLinearFilter as je, RepeatWrapping as fe, NearestFilter as Ke, PointsMaterial as mt, Material as ne, LineBasicMaterial as gt, MeshStandardMaterial as Ve, DoubleSide as At, PropertyBinding as Tt, SkinnedMesh as _t, Mesh as Rt, LineSegments as Et, Line as wt, LineLoop as xt, Points as yt, Group as re, PerspectiveCamera as Lt, MathUtils as bt, OrthographicCamera as St, Skeleton as vt, AnimationClip as Ct, Bone as Mt, InterpolateLinear as ze, NearestMipmapNearestFilter as It, LinearMipmapNearestFilter as Ot, NearestMipmapLinearFilter as Nt, ClampToEdgeWrapping as Pt, MirroredRepeatWrapping as Dt, InterpolateDiscrete as kt, FrontSide as Ft, Texture as Ee, VectorKeyframeTrack as we, NumberKeyframeTrack as xe, QuaternionKeyframeTrack as ye, Box3 as Ht, Sphere as Ut, Interpolant as Gt, LoadingManager as Bt, AudioLoader as jt } from "three";
7
+ class Te {
8
8
  constructor() {
9
9
  /**
10
10
  * @description The app worker logic location.
@@ -125,35 +125,35 @@ class qs {
125
125
  _(this, "onReady");
126
126
  }
127
127
  }
128
- function ye(o, e) {
128
+ function Le(o, e) {
129
129
  if (e === ot)
130
130
  return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."), o;
131
- if (e === le || e === Ne) {
131
+ if (e === ue || e === De) {
132
132
  let t = o.getIndex();
133
133
  if (t === null) {
134
- const n = [], c = o.getAttribute("position");
135
- if (c !== void 0) {
136
- for (let a = 0; a < c.count; a++)
137
- n.push(a);
134
+ const n = [], a = o.getAttribute("position");
135
+ if (a !== void 0) {
136
+ for (let c = 0; c < a.count; c++)
137
+ n.push(c);
138
138
  o.setIndex(n), t = o.getIndex();
139
139
  } else
140
140
  return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."), o;
141
141
  }
142
- const i = t.count - 2, s = [];
143
- if (e === le)
144
- for (let n = 1; n <= i; n++)
142
+ const r = t.count - 2, s = [];
143
+ if (e === ue)
144
+ for (let n = 1; n <= r; n++)
145
145
  s.push(t.getX(0)), s.push(t.getX(n)), s.push(t.getX(n + 1));
146
146
  else
147
- for (let n = 0; n < i; n++)
147
+ for (let n = 0; n < r; n++)
148
148
  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)));
149
- s.length / 3 !== i && console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");
150
- const r = o.clone();
151
- return r.setIndex(s), r.clearGroups(), r;
149
+ s.length / 3 !== r && console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");
150
+ const i = o.clone();
151
+ return i.setIndex(s), i.clearGroups(), i;
152
152
  } else
153
153
  return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:", e), o;
154
154
  }
155
- const ne = /* @__PURE__ */ new WeakMap();
156
- class Kt extends Pe {
155
+ const ie = /* @__PURE__ */ new WeakMap();
156
+ class Kt extends ke {
157
157
  constructor(e) {
158
158
  super(e), this.decoderPath = "", this.decoderConfig = {}, this.decoderBinary = null, this.decoderPending = null, this.workerLimit = 4, this.workerPool = [], this.workerNextTaskID = 1, this.workerSourceURL = "", this.defaultAttributeIDs = {
159
159
  position: "POSITION",
@@ -176,67 +176,67 @@ class Kt extends Pe {
176
176
  setWorkerLimit(e) {
177
177
  return this.workerLimit = e, this;
178
178
  }
179
- load(e, t, i, s) {
180
- const r = new W(this.manager);
181
- r.setPath(this.path), r.setResponseType("arraybuffer"), r.setRequestHeader(this.requestHeader), r.setWithCredentials(this.withCredentials), r.load(e, (n) => {
179
+ load(e, t, r, s) {
180
+ const i = new q(this.manager);
181
+ i.setPath(this.path), i.setResponseType("arraybuffer"), i.setRequestHeader(this.requestHeader), i.setWithCredentials(this.withCredentials), i.load(e, (n) => {
182
182
  this.parse(n, t, s);
183
- }, i, s);
183
+ }, r, s);
184
184
  }
185
- parse(e, t, i = () => {
185
+ parse(e, t, r = () => {
186
186
  }) {
187
- this.decodeDracoFile(e, t, null, null, N, i).catch(i);
187
+ this.decodeDracoFile(e, t, null, null, N, r).catch(r);
188
188
  }
189
- decodeDracoFile(e, t, i, s, r = S, n = () => {
189
+ decodeDracoFile(e, t, r, s, i = S, n = () => {
190
190
  }) {
191
- const c = {
192
- attributeIDs: i || this.defaultAttributeIDs,
191
+ const a = {
192
+ attributeIDs: r || this.defaultAttributeIDs,
193
193
  attributeTypes: s || this.defaultAttributeTypes,
194
- useUniqueIDs: !!i,
195
- vertexColorSpace: r
194
+ useUniqueIDs: !!r,
195
+ vertexColorSpace: i
196
196
  };
197
- return this.decodeGeometry(e, c).then(t).catch(n);
197
+ return this.decodeGeometry(e, a).then(t).catch(n);
198
198
  }
199
199
  decodeGeometry(e, t) {
200
- const i = JSON.stringify(t);
201
- if (ne.has(e)) {
202
- const a = ne.get(e);
203
- if (a.key === i)
204
- return a.promise;
200
+ const r = JSON.stringify(t);
201
+ if (ie.has(e)) {
202
+ const c = ie.get(e);
203
+ if (c.key === r)
204
+ return c.promise;
205
205
  if (e.byteLength === 0)
206
206
  throw new Error(
207
207
  "THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred."
208
208
  );
209
209
  }
210
210
  let s;
211
- const r = this.workerNextTaskID++, n = e.byteLength, c = this._getWorker(r, n).then((a) => (s = a, new Promise((l, d) => {
212
- s._callbacks[r] = { resolve: l, reject: d }, s.postMessage({ type: "decode", id: r, taskConfig: t, buffer: e }, [e]);
213
- }))).then((a) => this._createGeometry(a.geometry));
214
- return c.catch(() => !0).then(() => {
215
- s && r && this._releaseTask(s, r);
216
- }), ne.set(e, {
217
- key: i,
218
- promise: c
219
- }), c;
211
+ const i = this.workerNextTaskID++, n = e.byteLength, a = this._getWorker(i, n).then((c) => (s = c, new Promise((l, d) => {
212
+ s._callbacks[i] = { resolve: l, reject: d }, s.postMessage({ type: "decode", id: i, taskConfig: t, buffer: e }, [e]);
213
+ }))).then((c) => this._createGeometry(c.geometry));
214
+ return a.catch(() => !0).then(() => {
215
+ s && i && this._releaseTask(s, i);
216
+ }), ie.set(e, {
217
+ key: r,
218
+ promise: a
219
+ }), a;
220
220
  }
221
221
  _createGeometry(e) {
222
- const t = new De();
223
- e.index && t.setIndex(new j(e.index.array, 1));
224
- for (let i = 0; i < e.attributes.length; i++) {
225
- const s = e.attributes[i], r = s.name, n = s.array, c = s.itemSize, a = new j(n, c);
226
- r === "color" && (this._assignVertexColorSpace(a, s.vertexColorSpace), a.normalized = !(n instanceof Float32Array)), t.setAttribute(r, a);
222
+ const t = new Fe();
223
+ e.index && t.setIndex(new K(e.index.array, 1));
224
+ for (let r = 0; r < e.attributes.length; r++) {
225
+ const s = e.attributes[r], i = s.name, n = s.array, a = s.itemSize, c = new K(n, a);
226
+ i === "color" && (this._assignVertexColorSpace(c, s.vertexColorSpace), c.normalized = !(n instanceof Float32Array)), t.setAttribute(i, c);
227
227
  }
228
228
  return t;
229
229
  }
230
230
  _assignVertexColorSpace(e, t) {
231
231
  if (t !== N) return;
232
- const i = new P();
233
- for (let s = 0, r = e.count; s < r; s++)
234
- i.fromBufferAttribute(e, s), ue.toWorkingColorSpace(i, N), e.setXYZ(s, i.r, i.g, i.b);
232
+ const r = new P();
233
+ for (let s = 0, i = e.count; s < i; s++)
234
+ r.fromBufferAttribute(e, s), de.toWorkingColorSpace(r, N), e.setXYZ(s, r.r, r.g, r.b);
235
235
  }
236
236
  _loadLibrary(e, t) {
237
- const i = new W(this.manager);
238
- return i.setPath(this.decoderPath), i.setResponseType(t), i.setWithCredentials(this.withCredentials), new Promise((s, r) => {
239
- i.load(e, s, void 0, r);
237
+ const r = new q(this.manager);
238
+ return r.setPath(this.decoderPath), r.setResponseType(t), r.setWithCredentials(this.withCredentials), new Promise((s, i) => {
239
+ r.load(e, s, void 0, i);
240
240
  });
241
241
  }
242
242
  preload() {
@@ -245,15 +245,15 @@ class Kt extends Pe {
245
245
  _initDecoder() {
246
246
  if (this.decoderPending) return this.decoderPending;
247
247
  const e = typeof WebAssembly != "object" || this.decoderConfig.type === "js", t = [];
248
- 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((i) => {
249
- const s = i[0];
250
- e || (this.decoderConfig.wasmBinary = i[1]);
251
- const r = Vt.toString(), n = [
248
+ 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((r) => {
249
+ const s = r[0];
250
+ e || (this.decoderConfig.wasmBinary = r[1]);
251
+ const i = Vt.toString(), n = [
252
252
  "/* draco decoder */",
253
253
  s,
254
254
  "",
255
255
  "/* worker */",
256
- r.substring(r.indexOf("{") + 1, r.lastIndexOf("}"))
256
+ i.substring(i.indexOf("{") + 1, i.lastIndexOf("}"))
257
257
  ].join(`
258
258
  `);
259
259
  this.workerSourceURL = URL.createObjectURL(new Blob([n]));
@@ -263,8 +263,8 @@ class Kt extends Pe {
263
263
  return this._initDecoder().then(() => {
264
264
  if (this.workerPool.length < this.workerLimit) {
265
265
  const s = new Worker(this.workerSourceURL);
266
- s._callbacks = {}, s._taskCosts = {}, s._taskLoad = 0, s.postMessage({ type: "init", decoderConfig: this.decoderConfig }), s.onmessage = function(r) {
267
- const n = r.data;
266
+ s._callbacks = {}, s._taskCosts = {}, s._taskLoad = 0, s.postMessage({ type: "init", decoderConfig: this.decoderConfig }), s.onmessage = function(i) {
267
+ const n = i.data;
268
268
  switch (n.type) {
269
269
  case "decode":
270
270
  s._callbacks[n.id].resolve(n);
@@ -277,11 +277,11 @@ class Kt extends Pe {
277
277
  }
278
278
  }, this.workerPool.push(s);
279
279
  } else
280
- this.workerPool.sort(function(s, r) {
281
- return s._taskLoad > r._taskLoad ? -1 : 1;
280
+ this.workerPool.sort(function(s, i) {
281
+ return s._taskLoad > i._taskLoad ? -1 : 1;
282
282
  });
283
- const i = this.workerPool[this.workerPool.length - 1];
284
- return i._taskCosts[e] = t, i._taskLoad += t, i;
283
+ const r = this.workerPool[this.workerPool.length - 1];
284
+ return r._taskCosts[e] = t, r._taskLoad += t, r;
285
285
  });
286
286
  }
287
287
  _releaseTask(e, t) {
@@ -299,24 +299,24 @@ class Kt extends Pe {
299
299
  function Vt() {
300
300
  let o, e;
301
301
  onmessage = function(n) {
302
- const c = n.data;
303
- switch (c.type) {
302
+ const a = n.data;
303
+ switch (a.type) {
304
304
  case "init":
305
- o = c.decoderConfig, e = new Promise(function(d) {
305
+ o = a.decoderConfig, e = new Promise(function(d) {
306
306
  o.onModuleLoaded = function(u) {
307
307
  d({ draco: u });
308
308
  }, DracoDecoderModule(o);
309
309
  });
310
310
  break;
311
311
  case "decode":
312
- const a = c.buffer, l = c.taskConfig;
312
+ const c = a.buffer, l = a.taskConfig;
313
313
  e.then((d) => {
314
314
  const u = d.draco, h = new u.Decoder();
315
315
  try {
316
- const f = t(u, h, new Int8Array(a), l), p = f.attributes.map((A) => A.array.buffer);
317
- f.index && p.push(f.index.array.buffer), self.postMessage({ type: "decode", id: c.id, geometry: f }, p);
316
+ const f = t(u, h, new Int8Array(c), l), p = f.attributes.map((A) => A.array.buffer);
317
+ f.index && p.push(f.index.array.buffer), self.postMessage({ type: "decode", id: a.id, geometry: f }, p);
318
318
  } catch (f) {
319
- console.error(f), self.postMessage({ type: "error", id: c.id, error: f.message });
319
+ console.error(f), self.postMessage({ type: "error", id: a.id, error: f.message });
320
320
  } finally {
321
321
  u.destroy(h);
322
322
  }
@@ -324,14 +324,14 @@ function Vt() {
324
324
  break;
325
325
  }
326
326
  };
327
- function t(n, c, a, l) {
327
+ function t(n, a, c, l) {
328
328
  const d = l.attributeIDs, u = l.attributeTypes;
329
329
  let h, f;
330
- const p = c.GetEncodedGeometryType(a);
330
+ const p = a.GetEncodedGeometryType(c);
331
331
  if (p === n.TRIANGULAR_MESH)
332
- h = new n.Mesh(), f = c.DecodeArrayToMesh(a, a.byteLength, h);
332
+ h = new n.Mesh(), f = a.DecodeArrayToMesh(c, c.byteLength, h);
333
333
  else if (p === n.POINT_CLOUD)
334
- h = new n.PointCloud(), f = c.DecodeArrayToPointCloud(a, a.byteLength, h);
334
+ h = new n.PointCloud(), f = a.DecodeArrayToPointCloud(c, c.byteLength, h);
335
335
  else
336
336
  throw new Error("THREE.DRACOLoader: Unexpected geometry type.");
337
337
  if (!f.ok() || h.ptr === 0)
@@ -341,25 +341,25 @@ function Vt() {
341
341
  const g = self[u[m]];
342
342
  let R, w;
343
343
  if (l.useUniqueIDs)
344
- w = d[m], R = c.GetAttributeByUniqueId(h, w);
344
+ w = d[m], R = a.GetAttributeByUniqueId(h, w);
345
345
  else {
346
- if (w = c.GetAttributeId(h, n[d[m]]), w === -1) continue;
347
- R = c.GetAttribute(h, w);
346
+ if (w = a.GetAttributeId(h, n[d[m]]), w === -1) continue;
347
+ R = a.GetAttribute(h, w);
348
348
  }
349
- const E = s(n, c, h, m, g, R);
349
+ const E = s(n, a, h, m, g, R);
350
350
  m === "color" && (E.vertexColorSpace = l.vertexColorSpace), A.attributes.push(E);
351
351
  }
352
- return p === n.TRIANGULAR_MESH && (A.index = i(n, c, h)), n.destroy(h), A;
352
+ return p === n.TRIANGULAR_MESH && (A.index = r(n, a, h)), n.destroy(h), A;
353
353
  }
354
- function i(n, c, a) {
355
- const d = a.num_faces() * 3, u = d * 4, h = n._malloc(u);
356
- c.GetTrianglesUInt32Array(a, u, h);
354
+ function r(n, a, c) {
355
+ const d = c.num_faces() * 3, u = d * 4, h = n._malloc(u);
356
+ a.GetTrianglesUInt32Array(c, u, h);
357
357
  const f = new Uint32Array(n.HEAPF32.buffer, h, d).slice();
358
358
  return n._free(h), { array: f, itemSize: 1 };
359
359
  }
360
- function s(n, c, a, l, d, u) {
361
- const h = u.num_components(), p = a.num_points() * h, A = p * d.BYTES_PER_ELEMENT, m = r(n, d), g = n._malloc(A);
362
- c.GetAttributeDataArrayForAllPoints(a, u, m, A, g);
360
+ function s(n, a, c, l, d, u) {
361
+ const h = u.num_components(), p = c.num_points() * h, A = p * d.BYTES_PER_ELEMENT, m = i(n, d), g = n._malloc(A);
362
+ a.GetAttributeDataArrayForAllPoints(c, u, m, A, g);
363
363
  const R = new d(n.HEAPF32.buffer, g, p).slice();
364
364
  return n._free(g), {
365
365
  name: l,
@@ -367,8 +367,8 @@ function Vt() {
367
367
  itemSize: h
368
368
  };
369
369
  }
370
- function r(n, c) {
371
- switch (c) {
370
+ function i(n, a) {
371
+ switch (a) {
372
372
  case Float32Array:
373
373
  return n.DT_FLOAT32;
374
374
  case Int8Array:
@@ -386,7 +386,7 @@ function Vt() {
386
386
  }
387
387
  }
388
388
  }
389
- class zt extends Pe {
389
+ class zt extends ke {
390
390
  constructor(e) {
391
391
  super(e), this.dracoLoader = null, this.ktx2Loader = null, this.meshoptDecoder = null, this.pluginCallbacks = [], this.register(function(t) {
392
392
  return new Yt(t);
@@ -424,29 +424,29 @@ class zt extends Pe {
424
424
  return new us(t);
425
425
  });
426
426
  }
427
- load(e, t, i, s) {
428
- const r = this;
427
+ load(e, t, r, s) {
428
+ const i = this;
429
429
  let n;
430
430
  if (this.resourcePath !== "")
431
431
  n = this.resourcePath;
432
432
  else if (this.path !== "") {
433
- const l = K.extractUrlBase(e);
434
- n = K.resolveURL(l, this.path);
433
+ const l = V.extractUrlBase(e);
434
+ n = V.resolveURL(l, this.path);
435
435
  } else
436
- n = K.extractUrlBase(e);
436
+ n = V.extractUrlBase(e);
437
437
  this.manager.itemStart(e);
438
- const c = function(l) {
439
- s ? s(l) : console.error(l), r.manager.itemError(e), r.manager.itemEnd(e);
440
- }, a = new W(this.manager);
441
- a.setPath(this.path), a.setResponseType("arraybuffer"), a.setRequestHeader(this.requestHeader), a.setWithCredentials(this.withCredentials), a.load(e, function(l) {
438
+ const a = function(l) {
439
+ s ? s(l) : console.error(l), i.manager.itemError(e), i.manager.itemEnd(e);
440
+ }, c = new q(this.manager);
441
+ c.setPath(this.path), c.setResponseType("arraybuffer"), c.setRequestHeader(this.requestHeader), c.setWithCredentials(this.withCredentials), c.load(e, function(l) {
442
442
  try {
443
- r.parse(l, n, function(d) {
444
- t(d), r.manager.itemEnd(e);
445
- }, c);
443
+ i.parse(l, n, function(d) {
444
+ t(d), i.manager.itemEnd(e);
445
+ }, a);
446
446
  } catch (d) {
447
- c(d);
447
+ a(d);
448
448
  }
449
- }, i, c);
449
+ }, r, a);
450
450
  }
451
451
  setDRACOLoader(e) {
452
452
  return this.dracoLoader = e, this;
@@ -463,29 +463,29 @@ class zt extends Pe {
463
463
  unregister(e) {
464
464
  return this.pluginCallbacks.indexOf(e) !== -1 && this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e), 1), this;
465
465
  }
466
- parse(e, t, i, s) {
467
- let r;
468
- const n = {}, c = {}, a = new TextDecoder();
466
+ parse(e, t, r, s) {
467
+ let i;
468
+ const n = {}, a = {}, c = new TextDecoder();
469
469
  if (typeof e == "string")
470
- r = JSON.parse(e);
470
+ i = JSON.parse(e);
471
471
  else if (e instanceof ArrayBuffer)
472
- if (a.decode(new Uint8Array(e, 0, 4)) === Ve) {
472
+ if (c.decode(new Uint8Array(e, 0, 4)) === Xe) {
473
473
  try {
474
474
  n[T.KHR_BINARY_GLTF] = new ds(e);
475
475
  } catch (u) {
476
476
  s && s(u);
477
477
  return;
478
478
  }
479
- r = JSON.parse(n[T.KHR_BINARY_GLTF].content);
479
+ i = JSON.parse(n[T.KHR_BINARY_GLTF].content);
480
480
  } else
481
- r = JSON.parse(a.decode(e));
481
+ i = JSON.parse(c.decode(e));
482
482
  else
483
- r = e;
484
- if (r.asset === void 0 || r.asset.version[0] < 2) {
483
+ i = e;
484
+ if (i.asset === void 0 || i.asset.version[0] < 2) {
485
485
  s && s(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));
486
486
  return;
487
487
  }
488
- const l = new ys(r, {
488
+ const l = new ys(i, {
489
489
  path: t || this.resourcePath || "",
490
490
  crossOrigin: this.crossOrigin,
491
491
  requestHeader: this.requestHeader,
@@ -496,17 +496,17 @@ class zt extends Pe {
496
496
  l.fileLoader.setRequestHeader(this.requestHeader);
497
497
  for (let d = 0; d < this.pluginCallbacks.length; d++) {
498
498
  const u = this.pluginCallbacks[d](l);
499
- u.name || console.error("THREE.GLTFLoader: Invalid plugin found: missing name"), c[u.name] = u, n[u.name] = !0;
499
+ u.name || console.error("THREE.GLTFLoader: Invalid plugin found: missing name"), a[u.name] = u, n[u.name] = !0;
500
500
  }
501
- if (r.extensionsUsed)
502
- for (let d = 0; d < r.extensionsUsed.length; ++d) {
503
- const u = r.extensionsUsed[d], h = r.extensionsRequired || [];
501
+ if (i.extensionsUsed)
502
+ for (let d = 0; d < i.extensionsUsed.length; ++d) {
503
+ const u = i.extensionsUsed[d], h = i.extensionsRequired || [];
504
504
  switch (u) {
505
505
  case T.KHR_MATERIALS_UNLIT:
506
506
  n[u] = new $t();
507
507
  break;
508
508
  case T.KHR_DRACO_MESH_COMPRESSION:
509
- n[u] = new hs(r, this.dracoLoader);
509
+ n[u] = new hs(i, this.dracoLoader);
510
510
  break;
511
511
  case T.KHR_TEXTURE_TRANSFORM:
512
512
  n[u] = new fs();
@@ -515,15 +515,15 @@ class zt extends Pe {
515
515
  n[u] = new ps();
516
516
  break;
517
517
  default:
518
- h.indexOf(u) >= 0 && c[u] === void 0 && console.warn('THREE.GLTFLoader: Unknown extension "' + u + '".');
518
+ h.indexOf(u) >= 0 && a[u] === void 0 && console.warn('THREE.GLTFLoader: Unknown extension "' + u + '".');
519
519
  }
520
520
  }
521
- l.setExtensions(n), l.setPlugins(c), l.parse(i, s);
521
+ l.setExtensions(n), l.setPlugins(a), l.parse(r, s);
522
522
  }
523
523
  parseAsync(e, t) {
524
- const i = this;
525
- return new Promise(function(s, r) {
526
- i.parse(e, t, s, r);
524
+ const r = this;
525
+ return new Promise(function(s, i) {
526
+ r.parse(e, t, s, i);
527
527
  });
528
528
  }
529
529
  }
@@ -574,21 +574,21 @@ class Wt {
574
574
  }
575
575
  _markDefs() {
576
576
  const e = this.parser, t = this.parser.json.nodes || [];
577
- for (let i = 0, s = t.length; i < s; i++) {
578
- const r = t[i];
579
- r.extensions && r.extensions[this.name] && r.extensions[this.name].light !== void 0 && e._addNodeRef(this.cache, r.extensions[this.name].light);
577
+ for (let r = 0, s = t.length; r < s; r++) {
578
+ const i = t[r];
579
+ i.extensions && i.extensions[this.name] && i.extensions[this.name].light !== void 0 && e._addNodeRef(this.cache, i.extensions[this.name].light);
580
580
  }
581
581
  }
582
582
  _loadLight(e) {
583
- const t = this.parser, i = "light:" + e;
584
- let s = t.cache.get(i);
583
+ const t = this.parser, r = "light:" + e;
584
+ let s = t.cache.get(r);
585
585
  if (s) return s;
586
- const r = t.json, a = ((r.extensions && r.extensions[this.name] || {}).lights || [])[e];
586
+ const i = t.json, c = ((i.extensions && i.extensions[this.name] || {}).lights || [])[e];
587
587
  let l;
588
588
  const d = new P(16777215);
589
- a.color !== void 0 && d.setRGB(a.color[0], a.color[1], a.color[2], S);
590
- const u = a.range !== void 0 ? a.range : 0;
591
- switch (a.type) {
589
+ c.color !== void 0 && d.setRGB(c.color[0], c.color[1], c.color[2], S);
590
+ const u = c.range !== void 0 ? c.range : 0;
591
+ switch (c.type) {
592
592
  case "directional":
593
593
  l = new lt(d), l.target.position.set(0, 0, -1), l.add(l.target);
594
594
  break;
@@ -596,21 +596,21 @@ class Wt {
596
596
  l = new ct(d), l.distance = u;
597
597
  break;
598
598
  case "spot":
599
- l = new at(d), l.distance = u, a.spot = a.spot || {}, a.spot.innerConeAngle = a.spot.innerConeAngle !== void 0 ? a.spot.innerConeAngle : 0, a.spot.outerConeAngle = a.spot.outerConeAngle !== void 0 ? a.spot.outerConeAngle : Math.PI / 4, l.angle = a.spot.outerConeAngle, l.penumbra = 1 - a.spot.innerConeAngle / a.spot.outerConeAngle, l.target.position.set(0, 0, -1), l.add(l.target);
599
+ l = new at(d), l.distance = u, c.spot = c.spot || {}, c.spot.innerConeAngle = c.spot.innerConeAngle !== void 0 ? c.spot.innerConeAngle : 0, c.spot.outerConeAngle = c.spot.outerConeAngle !== void 0 ? c.spot.outerConeAngle : Math.PI / 4, l.angle = c.spot.outerConeAngle, l.penumbra = 1 - c.spot.innerConeAngle / c.spot.outerConeAngle, l.target.position.set(0, 0, -1), l.add(l.target);
600
600
  break;
601
601
  default:
602
- throw new Error("THREE.GLTFLoader: Unexpected light type: " + a.type);
602
+ throw new Error("THREE.GLTFLoader: Unexpected light type: " + c.type);
603
603
  }
604
- return l.position.set(0, 0, 0), l.decay = 2, C(l, a), a.intensity !== void 0 && (l.intensity = a.intensity), l.name = t.createUniqueName(a.name || "light_" + e), s = Promise.resolve(l), t.cache.add(i, s), s;
604
+ return l.position.set(0, 0, 0), l.decay = 2, C(l, c), c.intensity !== void 0 && (l.intensity = c.intensity), l.name = t.createUniqueName(c.name || "light_" + e), s = Promise.resolve(l), t.cache.add(r, s), s;
605
605
  }
606
606
  getDependency(e, t) {
607
607
  if (e === "light")
608
608
  return this._loadLight(t);
609
609
  }
610
610
  createNodeAttachment(e) {
611
- const t = this, i = this.parser, r = i.json.nodes[e], c = (r.extensions && r.extensions[this.name] || {}).light;
612
- return c === void 0 ? null : this._loadLight(c).then(function(a) {
613
- return i._getNodeRef(t.cache, c, a);
611
+ const t = this, r = this.parser, i = r.json.nodes[e], a = (i.extensions && i.extensions[this.name] || {}).light;
612
+ return a === void 0 ? null : this._loadLight(a).then(function(c) {
613
+ return r._getNodeRef(t.cache, a, c);
614
614
  });
615
615
  }
616
616
  }
@@ -621,16 +621,16 @@ class $t {
621
621
  getMaterialType() {
622
622
  return B;
623
623
  }
624
- extendParams(e, t, i) {
624
+ extendParams(e, t, r) {
625
625
  const s = [];
626
626
  e.color = new P(1, 1, 1), e.opacity = 1;
627
- const r = t.pbrMetallicRoughness;
628
- if (r) {
629
- if (Array.isArray(r.baseColorFactor)) {
630
- const n = r.baseColorFactor;
627
+ const i = t.pbrMetallicRoughness;
628
+ if (i) {
629
+ if (Array.isArray(i.baseColorFactor)) {
630
+ const n = i.baseColorFactor;
631
631
  e.color.setRGB(n[0], n[1], n[2], S), e.opacity = n[3];
632
632
  }
633
- r.baseColorTexture !== void 0 && s.push(i.assignTexture(e, "map", r.baseColorTexture, N));
633
+ i.baseColorTexture !== void 0 && s.push(r.assignTexture(e, "map", i.baseColorTexture, N));
634
634
  }
635
635
  return Promise.all(s);
636
636
  }
@@ -643,8 +643,8 @@ class qt {
643
643
  const s = this.parser.json.materials[e];
644
644
  if (!s.extensions || !s.extensions[this.name])
645
645
  return Promise.resolve();
646
- const r = s.extensions[this.name].emissiveStrength;
647
- return r !== void 0 && (t.emissiveIntensity = r), Promise.resolve();
646
+ const i = s.extensions[this.name].emissiveStrength;
647
+ return i !== void 0 && (t.emissiveIntensity = i), Promise.resolve();
648
648
  }
649
649
  }
650
650
  class Yt {
@@ -652,19 +652,19 @@ class Yt {
652
652
  this.parser = e, this.name = T.KHR_MATERIALS_CLEARCOAT;
653
653
  }
654
654
  getMaterialType(e) {
655
- const i = this.parser.json.materials[e];
656
- return !i.extensions || !i.extensions[this.name] ? null : v;
655
+ const r = this.parser.json.materials[e];
656
+ return !r.extensions || !r.extensions[this.name] ? null : v;
657
657
  }
658
658
  extendMaterialParams(e, t) {
659
- const i = this.parser, s = i.json.materials[e];
659
+ const r = this.parser, s = r.json.materials[e];
660
660
  if (!s.extensions || !s.extensions[this.name])
661
661
  return Promise.resolve();
662
- const r = [], n = s.extensions[this.name];
663
- if (n.clearcoatFactor !== void 0 && (t.clearcoat = n.clearcoatFactor), n.clearcoatTexture !== void 0 && r.push(i.assignTexture(t, "clearcoatMap", n.clearcoatTexture)), n.clearcoatRoughnessFactor !== void 0 && (t.clearcoatRoughness = n.clearcoatRoughnessFactor), n.clearcoatRoughnessTexture !== void 0 && r.push(i.assignTexture(t, "clearcoatRoughnessMap", n.clearcoatRoughnessTexture)), n.clearcoatNormalTexture !== void 0 && (r.push(i.assignTexture(t, "clearcoatNormalMap", n.clearcoatNormalTexture)), n.clearcoatNormalTexture.scale !== void 0)) {
664
- const c = n.clearcoatNormalTexture.scale;
665
- t.clearcoatNormalScale = new ke(c, c);
662
+ const i = [], n = s.extensions[this.name];
663
+ if (n.clearcoatFactor !== void 0 && (t.clearcoat = n.clearcoatFactor), n.clearcoatTexture !== void 0 && i.push(r.assignTexture(t, "clearcoatMap", n.clearcoatTexture)), n.clearcoatRoughnessFactor !== void 0 && (t.clearcoatRoughness = n.clearcoatRoughnessFactor), n.clearcoatRoughnessTexture !== void 0 && i.push(r.assignTexture(t, "clearcoatRoughnessMap", n.clearcoatRoughnessTexture)), n.clearcoatNormalTexture !== void 0 && (i.push(r.assignTexture(t, "clearcoatNormalMap", n.clearcoatNormalTexture)), n.clearcoatNormalTexture.scale !== void 0)) {
664
+ const a = n.clearcoatNormalTexture.scale;
665
+ t.clearcoatNormalScale = new He(a, a);
666
666
  }
667
- return Promise.all(r);
667
+ return Promise.all(i);
668
668
  }
669
669
  }
670
670
  class Qt {
@@ -672,15 +672,15 @@ class Qt {
672
672
  this.parser = e, this.name = T.KHR_MATERIALS_DISPERSION;
673
673
  }
674
674
  getMaterialType(e) {
675
- const i = this.parser.json.materials[e];
676
- return !i.extensions || !i.extensions[this.name] ? null : v;
675
+ const r = this.parser.json.materials[e];
676
+ return !r.extensions || !r.extensions[this.name] ? null : v;
677
677
  }
678
678
  extendMaterialParams(e, t) {
679
679
  const s = this.parser.json.materials[e];
680
680
  if (!s.extensions || !s.extensions[this.name])
681
681
  return Promise.resolve();
682
- const r = s.extensions[this.name];
683
- return t.dispersion = r.dispersion !== void 0 ? r.dispersion : 0, Promise.resolve();
682
+ const i = s.extensions[this.name];
683
+ return t.dispersion = i.dispersion !== void 0 ? i.dispersion : 0, Promise.resolve();
684
684
  }
685
685
  }
686
686
  class Jt {
@@ -688,15 +688,15 @@ class Jt {
688
688
  this.parser = e, this.name = T.KHR_MATERIALS_IRIDESCENCE;
689
689
  }
690
690
  getMaterialType(e) {
691
- const i = this.parser.json.materials[e];
692
- return !i.extensions || !i.extensions[this.name] ? null : v;
691
+ const r = this.parser.json.materials[e];
692
+ return !r.extensions || !r.extensions[this.name] ? null : v;
693
693
  }
694
694
  extendMaterialParams(e, t) {
695
- const i = this.parser, s = i.json.materials[e];
695
+ const r = this.parser, s = r.json.materials[e];
696
696
  if (!s.extensions || !s.extensions[this.name])
697
697
  return Promise.resolve();
698
- const r = [], n = s.extensions[this.name];
699
- return n.iridescenceFactor !== void 0 && (t.iridescence = n.iridescenceFactor), n.iridescenceTexture !== void 0 && r.push(i.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(i.assignTexture(t, "iridescenceThicknessMap", n.iridescenceThicknessTexture)), Promise.all(r);
698
+ const i = [], n = s.extensions[this.name];
699
+ return n.iridescenceFactor !== void 0 && (t.iridescence = n.iridescenceFactor), n.iridescenceTexture !== void 0 && i.push(r.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 && i.push(r.assignTexture(t, "iridescenceThicknessMap", n.iridescenceThicknessTexture)), Promise.all(i);
700
700
  }
701
701
  }
702
702
  class Zt {
@@ -704,21 +704,21 @@ class Zt {
704
704
  this.parser = e, this.name = T.KHR_MATERIALS_SHEEN;
705
705
  }
706
706
  getMaterialType(e) {
707
- const i = this.parser.json.materials[e];
708
- return !i.extensions || !i.extensions[this.name] ? null : v;
707
+ const r = this.parser.json.materials[e];
708
+ return !r.extensions || !r.extensions[this.name] ? null : v;
709
709
  }
710
710
  extendMaterialParams(e, t) {
711
- const i = this.parser, s = i.json.materials[e];
711
+ const r = this.parser, s = r.json.materials[e];
712
712
  if (!s.extensions || !s.extensions[this.name])
713
713
  return Promise.resolve();
714
- const r = [];
714
+ const i = [];
715
715
  t.sheenColor = new P(0, 0, 0), t.sheenRoughness = 0, t.sheen = 1;
716
716
  const n = s.extensions[this.name];
717
717
  if (n.sheenColorFactor !== void 0) {
718
- const c = n.sheenColorFactor;
719
- t.sheenColor.setRGB(c[0], c[1], c[2], S);
718
+ const a = n.sheenColorFactor;
719
+ t.sheenColor.setRGB(a[0], a[1], a[2], S);
720
720
  }
721
- return n.sheenRoughnessFactor !== void 0 && (t.sheenRoughness = n.sheenRoughnessFactor), n.sheenColorTexture !== void 0 && r.push(i.assignTexture(t, "sheenColorMap", n.sheenColorTexture, N)), n.sheenRoughnessTexture !== void 0 && r.push(i.assignTexture(t, "sheenRoughnessMap", n.sheenRoughnessTexture)), Promise.all(r);
721
+ return n.sheenRoughnessFactor !== void 0 && (t.sheenRoughness = n.sheenRoughnessFactor), n.sheenColorTexture !== void 0 && i.push(r.assignTexture(t, "sheenColorMap", n.sheenColorTexture, N)), n.sheenRoughnessTexture !== void 0 && i.push(r.assignTexture(t, "sheenRoughnessMap", n.sheenRoughnessTexture)), Promise.all(i);
722
722
  }
723
723
  }
724
724
  class es {
@@ -726,15 +726,15 @@ class es {
726
726
  this.parser = e, this.name = T.KHR_MATERIALS_TRANSMISSION;
727
727
  }
728
728
  getMaterialType(e) {
729
- const i = this.parser.json.materials[e];
730
- return !i.extensions || !i.extensions[this.name] ? null : v;
729
+ const r = this.parser.json.materials[e];
730
+ return !r.extensions || !r.extensions[this.name] ? null : v;
731
731
  }
732
732
  extendMaterialParams(e, t) {
733
- const i = this.parser, s = i.json.materials[e];
733
+ const r = this.parser, s = r.json.materials[e];
734
734
  if (!s.extensions || !s.extensions[this.name])
735
735
  return Promise.resolve();
736
- const r = [], n = s.extensions[this.name];
737
- return n.transmissionFactor !== void 0 && (t.transmission = n.transmissionFactor), n.transmissionTexture !== void 0 && r.push(i.assignTexture(t, "transmissionMap", n.transmissionTexture)), Promise.all(r);
736
+ const i = [], n = s.extensions[this.name];
737
+ return n.transmissionFactor !== void 0 && (t.transmission = n.transmissionFactor), n.transmissionTexture !== void 0 && i.push(r.assignTexture(t, "transmissionMap", n.transmissionTexture)), Promise.all(i);
738
738
  }
739
739
  }
740
740
  class ts {
@@ -742,17 +742,17 @@ class ts {
742
742
  this.parser = e, this.name = T.KHR_MATERIALS_VOLUME;
743
743
  }
744
744
  getMaterialType(e) {
745
- const i = this.parser.json.materials[e];
746
- return !i.extensions || !i.extensions[this.name] ? null : v;
745
+ const r = this.parser.json.materials[e];
746
+ return !r.extensions || !r.extensions[this.name] ? null : v;
747
747
  }
748
748
  extendMaterialParams(e, t) {
749
- const i = this.parser, s = i.json.materials[e];
749
+ const r = this.parser, s = r.json.materials[e];
750
750
  if (!s.extensions || !s.extensions[this.name])
751
751
  return Promise.resolve();
752
- const r = [], n = s.extensions[this.name];
753
- t.thickness = n.thicknessFactor !== void 0 ? n.thicknessFactor : 0, n.thicknessTexture !== void 0 && r.push(i.assignTexture(t, "thicknessMap", n.thicknessTexture)), t.attenuationDistance = n.attenuationDistance || 1 / 0;
754
- const c = n.attenuationColor || [1, 1, 1];
755
- return t.attenuationColor = new P().setRGB(c[0], c[1], c[2], S), Promise.all(r);
752
+ const i = [], n = s.extensions[this.name];
753
+ t.thickness = n.thicknessFactor !== void 0 ? n.thicknessFactor : 0, n.thicknessTexture !== void 0 && i.push(r.assignTexture(t, "thicknessMap", n.thicknessTexture)), t.attenuationDistance = n.attenuationDistance || 1 / 0;
754
+ const a = n.attenuationColor || [1, 1, 1];
755
+ return t.attenuationColor = new P().setRGB(a[0], a[1], a[2], S), Promise.all(i);
756
756
  }
757
757
  }
758
758
  class ss {
@@ -760,15 +760,15 @@ class ss {
760
760
  this.parser = e, this.name = T.KHR_MATERIALS_IOR;
761
761
  }
762
762
  getMaterialType(e) {
763
- const i = this.parser.json.materials[e];
764
- return !i.extensions || !i.extensions[this.name] ? null : v;
763
+ const r = this.parser.json.materials[e];
764
+ return !r.extensions || !r.extensions[this.name] ? null : v;
765
765
  }
766
766
  extendMaterialParams(e, t) {
767
767
  const s = this.parser.json.materials[e];
768
768
  if (!s.extensions || !s.extensions[this.name])
769
769
  return Promise.resolve();
770
- const r = s.extensions[this.name];
771
- return t.ior = r.ior !== void 0 ? r.ior : 1.5, Promise.resolve();
770
+ const i = s.extensions[this.name];
771
+ return t.ior = i.ior !== void 0 ? i.ior : 1.5, Promise.resolve();
772
772
  }
773
773
  }
774
774
  class ns {
@@ -776,17 +776,17 @@ class ns {
776
776
  this.parser = e, this.name = T.KHR_MATERIALS_SPECULAR;
777
777
  }
778
778
  getMaterialType(e) {
779
- const i = this.parser.json.materials[e];
780
- return !i.extensions || !i.extensions[this.name] ? null : v;
779
+ const r = this.parser.json.materials[e];
780
+ return !r.extensions || !r.extensions[this.name] ? null : v;
781
781
  }
782
782
  extendMaterialParams(e, t) {
783
- const i = this.parser, s = i.json.materials[e];
783
+ const r = this.parser, s = r.json.materials[e];
784
784
  if (!s.extensions || !s.extensions[this.name])
785
785
  return Promise.resolve();
786
- const r = [], n = s.extensions[this.name];
787
- t.specularIntensity = n.specularFactor !== void 0 ? n.specularFactor : 1, n.specularTexture !== void 0 && r.push(i.assignTexture(t, "specularIntensityMap", n.specularTexture));
788
- const c = n.specularColorFactor || [1, 1, 1];
789
- return t.specularColor = new P().setRGB(c[0], c[1], c[2], S), n.specularColorTexture !== void 0 && r.push(i.assignTexture(t, "specularColorMap", n.specularColorTexture, N)), Promise.all(r);
786
+ const i = [], n = s.extensions[this.name];
787
+ t.specularIntensity = n.specularFactor !== void 0 ? n.specularFactor : 1, n.specularTexture !== void 0 && i.push(r.assignTexture(t, "specularIntensityMap", n.specularTexture));
788
+ const a = n.specularColorFactor || [1, 1, 1];
789
+ return t.specularColor = new P().setRGB(a[0], a[1], a[2], S), n.specularColorTexture !== void 0 && i.push(r.assignTexture(t, "specularColorMap", n.specularColorTexture, N)), Promise.all(i);
790
790
  }
791
791
  }
792
792
  class rs {
@@ -794,15 +794,15 @@ class rs {
794
794
  this.parser = e, this.name = T.EXT_MATERIALS_BUMP;
795
795
  }
796
796
  getMaterialType(e) {
797
- const i = this.parser.json.materials[e];
798
- return !i.extensions || !i.extensions[this.name] ? null : v;
797
+ const r = this.parser.json.materials[e];
798
+ return !r.extensions || !r.extensions[this.name] ? null : v;
799
799
  }
800
800
  extendMaterialParams(e, t) {
801
- const i = this.parser, s = i.json.materials[e];
801
+ const r = this.parser, s = r.json.materials[e];
802
802
  if (!s.extensions || !s.extensions[this.name])
803
803
  return Promise.resolve();
804
- const r = [], n = s.extensions[this.name];
805
- return t.bumpScale = n.bumpFactor !== void 0 ? n.bumpFactor : 1, n.bumpTexture !== void 0 && r.push(i.assignTexture(t, "bumpMap", n.bumpTexture)), Promise.all(r);
804
+ const i = [], n = s.extensions[this.name];
805
+ return t.bumpScale = n.bumpFactor !== void 0 ? n.bumpFactor : 1, n.bumpTexture !== void 0 && i.push(r.assignTexture(t, "bumpMap", n.bumpTexture)), Promise.all(i);
806
806
  }
807
807
  }
808
808
  class is {
@@ -810,15 +810,15 @@ class is {
810
810
  this.parser = e, this.name = T.KHR_MATERIALS_ANISOTROPY;
811
811
  }
812
812
  getMaterialType(e) {
813
- const i = this.parser.json.materials[e];
814
- return !i.extensions || !i.extensions[this.name] ? null : v;
813
+ const r = this.parser.json.materials[e];
814
+ return !r.extensions || !r.extensions[this.name] ? null : v;
815
815
  }
816
816
  extendMaterialParams(e, t) {
817
- const i = this.parser, s = i.json.materials[e];
817
+ const r = this.parser, s = r.json.materials[e];
818
818
  if (!s.extensions || !s.extensions[this.name])
819
819
  return Promise.resolve();
820
- const r = [], n = s.extensions[this.name];
821
- return n.anisotropyStrength !== void 0 && (t.anisotropy = n.anisotropyStrength), n.anisotropyRotation !== void 0 && (t.anisotropyRotation = n.anisotropyRotation), n.anisotropyTexture !== void 0 && r.push(i.assignTexture(t, "anisotropyMap", n.anisotropyTexture)), Promise.all(r);
820
+ const i = [], n = s.extensions[this.name];
821
+ return n.anisotropyStrength !== void 0 && (t.anisotropy = n.anisotropyStrength), n.anisotropyRotation !== void 0 && (t.anisotropyRotation = n.anisotropyRotation), n.anisotropyTexture !== void 0 && i.push(r.assignTexture(t, "anisotropyMap", n.anisotropyTexture)), Promise.all(i);
822
822
  }
823
823
  }
824
824
  class os {
@@ -826,16 +826,16 @@ class os {
826
826
  this.parser = e, this.name = T.KHR_TEXTURE_BASISU;
827
827
  }
828
828
  loadTexture(e) {
829
- const t = this.parser, i = t.json, s = i.textures[e];
829
+ const t = this.parser, r = t.json, s = r.textures[e];
830
830
  if (!s.extensions || !s.extensions[this.name])
831
831
  return null;
832
- const r = s.extensions[this.name], n = t.options.ktx2Loader;
832
+ const i = s.extensions[this.name], n = t.options.ktx2Loader;
833
833
  if (!n) {
834
- if (i.extensionsRequired && i.extensionsRequired.indexOf(this.name) >= 0)
834
+ if (r.extensionsRequired && r.extensionsRequired.indexOf(this.name) >= 0)
835
835
  throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");
836
836
  return null;
837
837
  }
838
- return t.loadTextureImage(e, r.source, n);
838
+ return t.loadTextureImage(e, i.source, n);
839
839
  }
840
840
  }
841
841
  class as {
@@ -843,20 +843,20 @@ class as {
843
843
  this.parser = e, this.name = T.EXT_TEXTURE_WEBP, this.isSupported = null;
844
844
  }
845
845
  loadTexture(e) {
846
- const t = this.name, i = this.parser, s = i.json, r = s.textures[e];
847
- if (!r.extensions || !r.extensions[t])
846
+ const t = this.name, r = this.parser, s = r.json, i = s.textures[e];
847
+ if (!i.extensions || !i.extensions[t])
848
848
  return null;
849
- const n = r.extensions[t], c = s.images[n.source];
850
- let a = i.textureLoader;
851
- if (c.uri) {
852
- const l = i.options.manager.getHandler(c.uri);
853
- l !== null && (a = l);
849
+ const n = i.extensions[t], a = s.images[n.source];
850
+ let c = r.textureLoader;
851
+ if (a.uri) {
852
+ const l = r.options.manager.getHandler(a.uri);
853
+ l !== null && (c = l);
854
854
  }
855
855
  return this.detectSupport().then(function(l) {
856
- if (l) return i.loadTextureImage(e, n.source, a);
856
+ if (l) return r.loadTextureImage(e, n.source, c);
857
857
  if (s.extensionsRequired && s.extensionsRequired.indexOf(t) >= 0)
858
858
  throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");
859
- return i.loadTexture(e);
859
+ return r.loadTexture(e);
860
860
  });
861
861
  }
862
862
  detectSupport() {
@@ -873,20 +873,20 @@ class cs {
873
873
  this.parser = e, this.name = T.EXT_TEXTURE_AVIF, this.isSupported = null;
874
874
  }
875
875
  loadTexture(e) {
876
- const t = this.name, i = this.parser, s = i.json, r = s.textures[e];
877
- if (!r.extensions || !r.extensions[t])
876
+ const t = this.name, r = this.parser, s = r.json, i = s.textures[e];
877
+ if (!i.extensions || !i.extensions[t])
878
878
  return null;
879
- const n = r.extensions[t], c = s.images[n.source];
880
- let a = i.textureLoader;
881
- if (c.uri) {
882
- const l = i.options.manager.getHandler(c.uri);
883
- l !== null && (a = l);
879
+ const n = i.extensions[t], a = s.images[n.source];
880
+ let c = r.textureLoader;
881
+ if (a.uri) {
882
+ const l = r.options.manager.getHandler(a.uri);
883
+ l !== null && (c = l);
884
884
  }
885
885
  return this.detectSupport().then(function(l) {
886
- if (l) return i.loadTextureImage(e, n.source, a);
886
+ if (l) return r.loadTextureImage(e, n.source, c);
887
887
  if (s.extensionsRequired && s.extensionsRequired.indexOf(t) >= 0)
888
888
  throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");
889
- return i.loadTexture(e);
889
+ return r.loadTexture(e);
890
890
  });
891
891
  }
892
892
  detectSupport() {
@@ -903,16 +903,16 @@ class ls {
903
903
  this.name = T.EXT_MESHOPT_COMPRESSION, this.parser = e;
904
904
  }
905
905
  loadBufferView(e) {
906
- const t = this.parser.json, i = t.bufferViews[e];
907
- if (i.extensions && i.extensions[this.name]) {
908
- const s = i.extensions[this.name], r = this.parser.getDependency("buffer", s.buffer), n = this.parser.options.meshoptDecoder;
906
+ const t = this.parser.json, r = t.bufferViews[e];
907
+ if (r.extensions && r.extensions[this.name]) {
908
+ const s = r.extensions[this.name], i = this.parser.getDependency("buffer", s.buffer), n = this.parser.options.meshoptDecoder;
909
909
  if (!n || !n.supported) {
910
910
  if (t.extensionsRequired && t.extensionsRequired.indexOf(this.name) >= 0)
911
911
  throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");
912
912
  return null;
913
913
  }
914
- return r.then(function(c) {
915
- const a = s.byteOffset || 0, l = s.byteLength || 0, d = s.count, u = s.byteStride, h = new Uint8Array(c, a, l);
914
+ return i.then(function(a) {
915
+ const c = s.byteOffset || 0, l = s.byteLength || 0, d = s.count, u = s.byteStride, h = new Uint8Array(a, c, l);
916
916
  return n.decodeGltfBufferAsync ? n.decodeGltfBufferAsync(d, u, h, s.mode, s.filter).then(function(f) {
917
917
  return f.buffer;
918
918
  }) : n.ready.then(function() {
@@ -929,60 +929,60 @@ class us {
929
929
  this.name = T.EXT_MESH_GPU_INSTANCING, this.parser = e;
930
930
  }
931
931
  createNodeMesh(e) {
932
- const t = this.parser.json, i = t.nodes[e];
933
- if (!i.extensions || !i.extensions[this.name] || i.mesh === void 0)
932
+ const t = this.parser.json, r = t.nodes[e];
933
+ if (!r.extensions || !r.extensions[this.name] || r.mesh === void 0)
934
934
  return null;
935
- const s = t.meshes[i.mesh];
935
+ const s = t.meshes[r.mesh];
936
936
  for (const l of s.primitives)
937
937
  if (l.mode !== x.TRIANGLES && l.mode !== x.TRIANGLE_STRIP && l.mode !== x.TRIANGLE_FAN && l.mode !== void 0)
938
938
  return null;
939
- const n = i.extensions[this.name].attributes, c = [], a = {};
939
+ const n = r.extensions[this.name].attributes, a = [], c = {};
940
940
  for (const l in n)
941
- c.push(this.parser.getDependency("accessor", n[l]).then((d) => (a[l] = d, a[l])));
942
- return c.length < 1 ? null : (c.push(this.parser.createNodeMesh(e)), Promise.all(c).then((l) => {
941
+ a.push(this.parser.getDependency("accessor", n[l]).then((d) => (c[l] = d, c[l])));
942
+ return a.length < 1 ? null : (a.push(this.parser.createNodeMesh(e)), Promise.all(a).then((l) => {
943
943
  const d = l.pop(), u = d.isGroup ? d.children : [d], h = l[0].count, f = [];
944
944
  for (const p of u) {
945
- const A = new $(), m = new F(), g = new Fe(), R = new F(1, 1, 1), w = new ut(p.geometry, p.material, h);
945
+ const A = new Y(), m = new F(), g = new Ue(), R = new F(1, 1, 1), w = new ut(p.geometry, p.material, h);
946
946
  for (let E = 0; E < h; E++)
947
- a.TRANSLATION && m.fromBufferAttribute(a.TRANSLATION, E), a.ROTATION && g.fromBufferAttribute(a.ROTATION, E), a.SCALE && R.fromBufferAttribute(a.SCALE, E), w.setMatrixAt(E, A.compose(m, g, R));
948
- for (const E in a)
947
+ c.TRANSLATION && m.fromBufferAttribute(c.TRANSLATION, E), c.ROTATION && g.fromBufferAttribute(c.ROTATION, E), c.SCALE && R.fromBufferAttribute(c.SCALE, E), w.setMatrixAt(E, A.compose(m, g, R));
948
+ for (const E in c)
949
949
  if (E === "_COLOR_0") {
950
- const b = a[E];
950
+ const b = c[E];
951
951
  w.instanceColor = new dt(b.array, b.itemSize, b.normalized);
952
- } else E !== "TRANSLATION" && E !== "ROTATION" && E !== "SCALE" && p.geometry.setAttribute(E, a[E]);
953
- He.prototype.copy.call(w, p), this.parser.assignFinalMaterial(w), f.push(w);
952
+ } else E !== "TRANSLATION" && E !== "ROTATION" && E !== "SCALE" && p.geometry.setAttribute(E, c[E]);
953
+ Ge.prototype.copy.call(w, p), this.parser.assignFinalMaterial(w), f.push(w);
954
954
  }
955
955
  return d.isGroup ? (d.clear(), d.add(...f), d) : f[0];
956
956
  }));
957
957
  }
958
958
  }
959
- const Ve = "glTF", G = 12, Le = { JSON: 1313821514, BIN: 5130562 };
959
+ const Xe = "glTF", G = 12, be = { JSON: 1313821514, BIN: 5130562 };
960
960
  class ds {
961
961
  constructor(e) {
962
962
  this.name = T.KHR_BINARY_GLTF, this.content = null, this.body = null;
963
- const t = new DataView(e, 0, G), i = new TextDecoder();
963
+ const t = new DataView(e, 0, G), r = new TextDecoder();
964
964
  if (this.header = {
965
- magic: i.decode(new Uint8Array(e.slice(0, 4))),
965
+ magic: r.decode(new Uint8Array(e.slice(0, 4))),
966
966
  version: t.getUint32(4, !0),
967
967
  length: t.getUint32(8, !0)
968
- }, this.header.magic !== Ve)
968
+ }, this.header.magic !== Xe)
969
969
  throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");
970
970
  if (this.header.version < 2)
971
971
  throw new Error("THREE.GLTFLoader: Legacy binary file detected.");
972
- const s = this.header.length - G, r = new DataView(e, G);
972
+ const s = this.header.length - G, i = new DataView(e, G);
973
973
  let n = 0;
974
974
  for (; n < s; ) {
975
- const c = r.getUint32(n, !0);
975
+ const a = i.getUint32(n, !0);
976
976
  n += 4;
977
- const a = r.getUint32(n, !0);
978
- if (n += 4, a === Le.JSON) {
979
- const l = new Uint8Array(e, G + n, c);
980
- this.content = i.decode(l);
981
- } else if (a === Le.BIN) {
977
+ const c = i.getUint32(n, !0);
978
+ if (n += 4, c === be.JSON) {
979
+ const l = new Uint8Array(e, G + n, a);
980
+ this.content = r.decode(l);
981
+ } else if (c === be.BIN) {
982
982
  const l = G + n;
983
- this.body = e.slice(l, l + c);
983
+ this.body = e.slice(l, l + a);
984
984
  }
985
- n += c;
985
+ n += a;
986
986
  }
987
987
  if (this.content === null)
988
988
  throw new Error("THREE.GLTFLoader: JSON content not found.");
@@ -995,27 +995,27 @@ class hs {
995
995
  this.name = T.KHR_DRACO_MESH_COMPRESSION, this.json = e, this.dracoLoader = t, this.dracoLoader.preload();
996
996
  }
997
997
  decodePrimitive(e, t) {
998
- const i = this.json, s = this.dracoLoader, r = e.extensions[this.name].bufferView, n = e.extensions[this.name].attributes, c = {}, a = {}, l = {};
998
+ const r = this.json, s = this.dracoLoader, i = e.extensions[this.name].bufferView, n = e.extensions[this.name].attributes, a = {}, c = {}, l = {};
999
999
  for (const d in n) {
1000
- const u = fe[d] || d.toLowerCase();
1001
- c[u] = n[d];
1000
+ const u = pe[d] || d.toLowerCase();
1001
+ a[u] = n[d];
1002
1002
  }
1003
1003
  for (const d in e.attributes) {
1004
- const u = fe[d] || d.toLowerCase();
1004
+ const u = pe[d] || d.toLowerCase();
1005
1005
  if (n[d] !== void 0) {
1006
- const h = i.accessors[e.attributes[d]], f = H[h.componentType];
1007
- l[u] = f.name, a[u] = h.normalized === !0;
1006
+ const h = r.accessors[e.attributes[d]], f = H[h.componentType];
1007
+ l[u] = f.name, c[u] = h.normalized === !0;
1008
1008
  }
1009
1009
  }
1010
- return t.getDependency("bufferView", r).then(function(d) {
1010
+ return t.getDependency("bufferView", i).then(function(d) {
1011
1011
  return new Promise(function(u, h) {
1012
1012
  s.decodeDracoFile(d, function(f) {
1013
1013
  for (const p in f.attributes) {
1014
- const A = f.attributes[p], m = a[p];
1014
+ const A = f.attributes[p], m = c[p];
1015
1015
  m !== void 0 && (A.normalized = m);
1016
1016
  }
1017
1017
  u(f);
1018
- }, c, l, S, h);
1018
+ }, a, l, S, h);
1019
1019
  });
1020
1020
  });
1021
1021
  }
@@ -1033,30 +1033,30 @@ class ps {
1033
1033
  this.name = T.KHR_MESH_QUANTIZATION;
1034
1034
  }
1035
1035
  }
1036
- class ze extends Gt {
1037
- constructor(e, t, i, s) {
1038
- super(e, t, i, s);
1036
+ class We extends Gt {
1037
+ constructor(e, t, r, s) {
1038
+ super(e, t, r, s);
1039
1039
  }
1040
1040
  copySampleValue_(e) {
1041
- const t = this.resultBuffer, i = this.sampleValues, s = this.valueSize, r = e * s * 3 + s;
1041
+ const t = this.resultBuffer, r = this.sampleValues, s = this.valueSize, i = e * s * 3 + s;
1042
1042
  for (let n = 0; n !== s; n++)
1043
- t[n] = i[r + n];
1043
+ t[n] = r[i + n];
1044
1044
  return t;
1045
1045
  }
1046
- interpolate_(e, t, i, s) {
1047
- const r = this.resultBuffer, n = this.sampleValues, c = this.valueSize, a = c * 2, l = c * 3, d = s - t, u = (i - t) / d, h = u * u, f = h * u, p = e * l, A = p - l, m = -2 * f + 3 * h, g = f - h, R = 1 - m, w = g - h + u;
1048
- for (let E = 0; E !== c; E++) {
1049
- const b = n[A + E + c], M = n[A + E + a] * d, y = n[p + E + c], U = n[p + E] * d;
1050
- r[E] = R * b + w * M + m * y + g * U;
1046
+ interpolate_(e, t, r, s) {
1047
+ const i = this.resultBuffer, n = this.sampleValues, a = this.valueSize, c = a * 2, l = a * 3, d = s - t, u = (r - t) / d, h = u * u, f = h * u, p = e * l, A = p - l, m = -2 * f + 3 * h, g = f - h, R = 1 - m, w = g - h + u;
1048
+ for (let E = 0; E !== a; E++) {
1049
+ const b = n[A + E + a], M = n[A + E + c] * d, y = n[p + E + a], U = n[p + E] * d;
1050
+ i[E] = R * b + w * M + m * y + g * U;
1051
1051
  }
1052
- return r;
1052
+ return i;
1053
1053
  }
1054
1054
  }
1055
- const ms = new Fe();
1056
- class gs extends ze {
1057
- interpolate_(e, t, i, s) {
1058
- const r = super.interpolate_(e, t, i, s);
1059
- return ms.fromArray(r).normalize().toArray(r), r;
1055
+ const ms = new Ue();
1056
+ class gs extends We {
1057
+ interpolate_(e, t, r, s) {
1058
+ const i = super.interpolate_(e, t, r, s);
1059
+ return ms.fromArray(i).normalize().toArray(i), i;
1060
1060
  }
1061
1061
  }
1062
1062
  const x = {
@@ -1086,18 +1086,18 @@ const x = {
1086
1086
  5123: Uint16Array,
1087
1087
  5125: Uint32Array,
1088
1088
  5126: Float32Array
1089
- }, be = {
1090
- 9728: Be,
1091
- 9729: de,
1089
+ }, Se = {
1090
+ 9728: Ke,
1091
+ 9729: he,
1092
1092
  9984: It,
1093
1093
  9985: Ot,
1094
1094
  9986: Nt,
1095
- 9987: Ge
1096
- }, Se = {
1095
+ 9987: je
1096
+ }, ve = {
1097
1097
  33071: Pt,
1098
1098
  33648: Dt,
1099
- 10497: he
1100
- }, re = {
1099
+ 10497: fe
1100
+ }, oe = {
1101
1101
  SCALAR: 1,
1102
1102
  VEC2: 2,
1103
1103
  VEC3: 3,
@@ -1105,7 +1105,7 @@ const x = {
1105
1105
  MAT2: 4,
1106
1106
  MAT3: 9,
1107
1107
  MAT4: 16
1108
- }, fe = {
1108
+ }, pe = {
1109
1109
  POSITION: "position",
1110
1110
  NORMAL: "normal",
1111
1111
  TANGENT: "tangent",
@@ -1125,15 +1125,15 @@ const x = {
1125
1125
  CUBICSPLINE: void 0,
1126
1126
  // We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each
1127
1127
  // keyframe track will be initialized with a default interpolation type, then modified.
1128
- LINEAR: Ke,
1128
+ LINEAR: ze,
1129
1129
  STEP: kt
1130
- }, ie = {
1130
+ }, ae = {
1131
1131
  OPAQUE: "OPAQUE",
1132
1132
  MASK: "MASK",
1133
1133
  BLEND: "BLEND"
1134
1134
  };
1135
1135
  function Ts(o) {
1136
- return o.DefaultMaterial === void 0 && (o.DefaultMaterial = new je({
1136
+ return o.DefaultMaterial === void 0 && (o.DefaultMaterial = new Ve({
1137
1137
  color: 16777215,
1138
1138
  emissive: 0,
1139
1139
  metalness: 1,
@@ -1144,54 +1144,54 @@ function Ts(o) {
1144
1144
  })), o.DefaultMaterial;
1145
1145
  }
1146
1146
  function D(o, e, t) {
1147
- for (const i in t.extensions)
1148
- o[i] === void 0 && (e.userData.gltfExtensions = e.userData.gltfExtensions || {}, e.userData.gltfExtensions[i] = t.extensions[i]);
1147
+ for (const r in t.extensions)
1148
+ o[r] === void 0 && (e.userData.gltfExtensions = e.userData.gltfExtensions || {}, e.userData.gltfExtensions[r] = t.extensions[r]);
1149
1149
  }
1150
1150
  function C(o, e) {
1151
1151
  e.extras !== void 0 && (typeof e.extras == "object" ? Object.assign(o.userData, e.extras) : console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, " + e.extras));
1152
1152
  }
1153
1153
  function _s(o, e, t) {
1154
- let i = !1, s = !1, r = !1;
1154
+ let r = !1, s = !1, i = !1;
1155
1155
  for (let l = 0, d = e.length; l < d; l++) {
1156
1156
  const u = e[l];
1157
- if (u.POSITION !== void 0 && (i = !0), u.NORMAL !== void 0 && (s = !0), u.COLOR_0 !== void 0 && (r = !0), i && s && r) break;
1157
+ if (u.POSITION !== void 0 && (r = !0), u.NORMAL !== void 0 && (s = !0), u.COLOR_0 !== void 0 && (i = !0), r && s && i) break;
1158
1158
  }
1159
- if (!i && !s && !r) return Promise.resolve(o);
1160
- const n = [], c = [], a = [];
1159
+ if (!r && !s && !i) return Promise.resolve(o);
1160
+ const n = [], a = [], c = [];
1161
1161
  for (let l = 0, d = e.length; l < d; l++) {
1162
1162
  const u = e[l];
1163
- if (i) {
1163
+ if (r) {
1164
1164
  const h = u.POSITION !== void 0 ? t.getDependency("accessor", u.POSITION) : o.attributes.position;
1165
1165
  n.push(h);
1166
1166
  }
1167
1167
  if (s) {
1168
1168
  const h = u.NORMAL !== void 0 ? t.getDependency("accessor", u.NORMAL) : o.attributes.normal;
1169
- c.push(h);
1169
+ a.push(h);
1170
1170
  }
1171
- if (r) {
1171
+ if (i) {
1172
1172
  const h = u.COLOR_0 !== void 0 ? t.getDependency("accessor", u.COLOR_0) : o.attributes.color;
1173
- a.push(h);
1173
+ c.push(h);
1174
1174
  }
1175
1175
  }
1176
1176
  return Promise.all([
1177
1177
  Promise.all(n),
1178
- Promise.all(c),
1179
- Promise.all(a)
1178
+ Promise.all(a),
1179
+ Promise.all(c)
1180
1180
  ]).then(function(l) {
1181
1181
  const d = l[0], u = l[1], h = l[2];
1182
- return i && (o.morphAttributes.position = d), s && (o.morphAttributes.normal = u), r && (o.morphAttributes.color = h), o.morphTargetsRelative = !0, o;
1182
+ return r && (o.morphAttributes.position = d), s && (o.morphAttributes.normal = u), i && (o.morphAttributes.color = h), o.morphTargetsRelative = !0, o;
1183
1183
  });
1184
1184
  }
1185
1185
  function Rs(o, e) {
1186
1186
  if (o.updateMorphTargets(), e.weights !== void 0)
1187
- for (let t = 0, i = e.weights.length; t < i; t++)
1187
+ for (let t = 0, r = e.weights.length; t < r; t++)
1188
1188
  o.morphTargetInfluences[t] = e.weights[t];
1189
1189
  if (e.extras && Array.isArray(e.extras.targetNames)) {
1190
1190
  const t = e.extras.targetNames;
1191
1191
  if (o.morphTargetInfluences.length === t.length) {
1192
1192
  o.morphTargetDictionary = {};
1193
- for (let i = 0, s = t.length; i < s; i++)
1194
- o.morphTargetDictionary[t[i]] = i;
1193
+ for (let r = 0, s = t.length; r < s; r++)
1194
+ o.morphTargetDictionary[t[r]] = r;
1195
1195
  } else
1196
1196
  console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.");
1197
1197
  }
@@ -1199,19 +1199,19 @@ function Rs(o, e) {
1199
1199
  function Es(o) {
1200
1200
  let e;
1201
1201
  const t = o.extensions && o.extensions[T.KHR_DRACO_MESH_COMPRESSION];
1202
- if (t ? e = "draco:" + t.bufferView + ":" + t.indices + ":" + oe(t.attributes) : e = o.indices + ":" + oe(o.attributes) + ":" + o.mode, o.targets !== void 0)
1203
- for (let i = 0, s = o.targets.length; i < s; i++)
1204
- e += ":" + oe(o.targets[i]);
1202
+ if (t ? e = "draco:" + t.bufferView + ":" + t.indices + ":" + ce(t.attributes) : e = o.indices + ":" + ce(o.attributes) + ":" + o.mode, o.targets !== void 0)
1203
+ for (let r = 0, s = o.targets.length; r < s; r++)
1204
+ e += ":" + ce(o.targets[r]);
1205
1205
  return e;
1206
1206
  }
1207
- function oe(o) {
1207
+ function ce(o) {
1208
1208
  let e = "";
1209
1209
  const t = Object.keys(o).sort();
1210
- for (let i = 0, s = t.length; i < s; i++)
1211
- e += t[i] + ":" + o[t[i]] + ";";
1210
+ for (let r = 0, s = t.length; r < s; r++)
1211
+ e += t[r] + ":" + o[t[r]] + ";";
1212
1212
  return e;
1213
1213
  }
1214
- function pe(o) {
1214
+ function me(o) {
1215
1215
  switch (o) {
1216
1216
  case Int8Array:
1217
1217
  return 1 / 127;
@@ -1228,18 +1228,18 @@ function pe(o) {
1228
1228
  function ws(o) {
1229
1229
  return o.search(/\.jpe?g($|\?)/i) > 0 || o.search(/^data\:image\/jpeg/) === 0 ? "image/jpeg" : o.search(/\.webp($|\?)/i) > 0 || o.search(/^data\:image\/webp/) === 0 ? "image/webp" : o.search(/\.ktx2($|\?)/i) > 0 || o.search(/^data\:image\/ktx2/) === 0 ? "image/ktx2" : "image/png";
1230
1230
  }
1231
- const xs = new $();
1231
+ const xs = new Y();
1232
1232
  class ys {
1233
1233
  constructor(e = {}, t = {}) {
1234
1234
  this.json = e, this.extensions = {}, this.plugins = {}, this.options = t, this.cache = new Xt(), 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 = {};
1235
- let i = !1, s = -1, r = !1, n = -1;
1235
+ let r = !1, s = -1, i = !1, n = -1;
1236
1236
  if (typeof navigator < "u") {
1237
- const c = navigator.userAgent;
1238
- i = /^((?!chrome|android).)*safari/i.test(c) === !0;
1239
- const a = c.match(/Version\/(\d+)/);
1240
- s = i && a ? parseInt(a[1], 10) : -1, r = c.indexOf("Firefox") > -1, n = r ? c.match(/Firefox\/([0-9]+)\./)[1] : -1;
1237
+ const a = navigator.userAgent;
1238
+ r = /^((?!chrome|android).)*safari/i.test(a) === !0;
1239
+ const c = a.match(/Version\/(\d+)/);
1240
+ s = r && c ? parseInt(c[1], 10) : -1, i = a.indexOf("Firefox") > -1, n = i ? a.match(/Firefox\/([0-9]+)\./)[1] : -1;
1241
1241
  }
1242
- typeof createImageBitmap > "u" || i && s < 17 || r && n < 98 ? this.textureLoader = new ht(this.options.manager) : this.textureLoader = new Ue(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.textureLoader.setRequestHeader(this.options.requestHeader), this.fileLoader = new W(this.options.manager), this.fileLoader.setResponseType("arraybuffer"), this.options.crossOrigin === "use-credentials" && this.fileLoader.setWithCredentials(!0);
1242
+ typeof createImageBitmap > "u" || r && s < 17 || i && n < 98 ? this.textureLoader = new ht(this.options.manager) : this.textureLoader = new Be(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.textureLoader.setRequestHeader(this.options.requestHeader), this.fileLoader = new q(this.options.manager), this.fileLoader.setResponseType("arraybuffer"), this.options.crossOrigin === "use-credentials" && this.fileLoader.setWithCredentials(!0);
1243
1243
  }
1244
1244
  setExtensions(e) {
1245
1245
  this.extensions = e;
@@ -1248,33 +1248,33 @@ class ys {
1248
1248
  this.plugins = e;
1249
1249
  }
1250
1250
  parse(e, t) {
1251
- const i = this, s = this.json, r = this.extensions;
1251
+ const r = this, s = this.json, i = this.extensions;
1252
1252
  this.cache.removeAll(), this.nodeCache = {}, this._invokeAll(function(n) {
1253
1253
  return n._markDefs && n._markDefs();
1254
1254
  }), Promise.all(this._invokeAll(function(n) {
1255
1255
  return n.beforeRoot && n.beforeRoot();
1256
1256
  })).then(function() {
1257
1257
  return Promise.all([
1258
- i.getDependencies("scene"),
1259
- i.getDependencies("animation"),
1260
- i.getDependencies("camera")
1258
+ r.getDependencies("scene"),
1259
+ r.getDependencies("animation"),
1260
+ r.getDependencies("camera")
1261
1261
  ]);
1262
1262
  }).then(function(n) {
1263
- const c = {
1263
+ const a = {
1264
1264
  scene: n[0][s.scene || 0],
1265
1265
  scenes: n[0],
1266
1266
  animations: n[1],
1267
1267
  cameras: n[2],
1268
1268
  asset: s.asset,
1269
- parser: i,
1269
+ parser: r,
1270
1270
  userData: {}
1271
1271
  };
1272
- return D(r, c, s), C(c, s), Promise.all(i._invokeAll(function(a) {
1273
- return a.afterRoot && a.afterRoot(c);
1272
+ return D(i, a, s), C(a, s), Promise.all(r._invokeAll(function(c) {
1273
+ return c.afterRoot && c.afterRoot(a);
1274
1274
  })).then(function() {
1275
- for (const a of c.scenes)
1276
- a.updateMatrixWorld();
1277
- e(c);
1275
+ for (const c of a.scenes)
1276
+ c.updateMatrixWorld();
1277
+ e(a);
1278
1278
  });
1279
1279
  }).catch(t);
1280
1280
  }
@@ -1282,15 +1282,15 @@ class ys {
1282
1282
  * Marks the special nodes/meshes in json for efficient parse.
1283
1283
  */
1284
1284
  _markDefs() {
1285
- const e = this.json.nodes || [], t = this.json.skins || [], i = this.json.meshes || [];
1286
- for (let s = 0, r = t.length; s < r; s++) {
1285
+ const e = this.json.nodes || [], t = this.json.skins || [], r = this.json.meshes || [];
1286
+ for (let s = 0, i = t.length; s < i; s++) {
1287
1287
  const n = t[s].joints;
1288
- for (let c = 0, a = n.length; c < a; c++)
1289
- e[n[c]].isBone = !0;
1288
+ for (let a = 0, c = n.length; a < c; a++)
1289
+ e[n[a]].isBone = !0;
1290
1290
  }
1291
- for (let s = 0, r = e.length; s < r; s++) {
1291
+ for (let s = 0, i = e.length; s < i; s++) {
1292
1292
  const n = e[s];
1293
- n.mesh !== void 0 && (this._addNodeRef(this.meshCache, n.mesh), n.skin !== void 0 && (i[n.mesh].isSkinnedMesh = !0)), n.camera !== void 0 && this._addNodeRef(this.cameraCache, n.camera);
1293
+ n.mesh !== void 0 && (this._addNodeRef(this.meshCache, n.mesh), n.skin !== void 0 && (r[n.mesh].isSkinnedMesh = !0)), n.camera !== void 0 && this._addNodeRef(this.cameraCache, n.camera);
1294
1294
  }
1295
1295
  }
1296
1296
  /**
@@ -1316,21 +1316,21 @@ class ys {
1316
1316
  * @param {Object} object
1317
1317
  * @return {Object}
1318
1318
  */
1319
- _getNodeRef(e, t, i) {
1320
- if (e.refs[t] <= 1) return i;
1321
- const s = i.clone(), r = (n, c) => {
1322
- const a = this.associations.get(n);
1323
- a != null && this.associations.set(c, a);
1319
+ _getNodeRef(e, t, r) {
1320
+ if (e.refs[t] <= 1) return r;
1321
+ const s = r.clone(), i = (n, a) => {
1322
+ const c = this.associations.get(n);
1323
+ c != null && this.associations.set(a, c);
1324
1324
  for (const [l, d] of n.children.entries())
1325
- r(d, c.children[l]);
1325
+ i(d, a.children[l]);
1326
1326
  };
1327
- return r(i, s), s.name += "_instance_" + e.uses[t]++, s;
1327
+ return i(r, s), s.name += "_instance_" + e.uses[t]++, s;
1328
1328
  }
1329
1329
  _invokeOne(e) {
1330
1330
  const t = Object.values(this.plugins);
1331
1331
  t.push(this);
1332
- for (let i = 0; i < t.length; i++) {
1333
- const s = e(t[i]);
1332
+ for (let r = 0; r < t.length; r++) {
1333
+ const s = e(t[r]);
1334
1334
  if (s) return s;
1335
1335
  }
1336
1336
  return null;
@@ -1338,12 +1338,12 @@ class ys {
1338
1338
  _invokeAll(e) {
1339
1339
  const t = Object.values(this.plugins);
1340
1340
  t.unshift(this);
1341
- const i = [];
1341
+ const r = [];
1342
1342
  for (let s = 0; s < t.length; s++) {
1343
- const r = e(t[s]);
1344
- r && i.push(r);
1343
+ const i = e(t[s]);
1344
+ i && r.push(i);
1345
1345
  }
1346
- return i;
1346
+ return r;
1347
1347
  }
1348
1348
  /**
1349
1349
  * Requests the specified dependency asynchronously, with caching.
@@ -1352,63 +1352,63 @@ class ys {
1352
1352
  * @return {Promise<Object3D|Material|THREE.Texture|AnimationClip|ArrayBuffer|Object>}
1353
1353
  */
1354
1354
  getDependency(e, t) {
1355
- const i = e + ":" + t;
1356
- let s = this.cache.get(i);
1355
+ const r = e + ":" + t;
1356
+ let s = this.cache.get(r);
1357
1357
  if (!s) {
1358
1358
  switch (e) {
1359
1359
  case "scene":
1360
1360
  s = this.loadScene(t);
1361
1361
  break;
1362
1362
  case "node":
1363
- s = this._invokeOne(function(r) {
1364
- return r.loadNode && r.loadNode(t);
1363
+ s = this._invokeOne(function(i) {
1364
+ return i.loadNode && i.loadNode(t);
1365
1365
  });
1366
1366
  break;
1367
1367
  case "mesh":
1368
- s = this._invokeOne(function(r) {
1369
- return r.loadMesh && r.loadMesh(t);
1368
+ s = this._invokeOne(function(i) {
1369
+ return i.loadMesh && i.loadMesh(t);
1370
1370
  });
1371
1371
  break;
1372
1372
  case "accessor":
1373
1373
  s = this.loadAccessor(t);
1374
1374
  break;
1375
1375
  case "bufferView":
1376
- s = this._invokeOne(function(r) {
1377
- return r.loadBufferView && r.loadBufferView(t);
1376
+ s = this._invokeOne(function(i) {
1377
+ return i.loadBufferView && i.loadBufferView(t);
1378
1378
  });
1379
1379
  break;
1380
1380
  case "buffer":
1381
1381
  s = this.loadBuffer(t);
1382
1382
  break;
1383
1383
  case "material":
1384
- s = this._invokeOne(function(r) {
1385
- return r.loadMaterial && r.loadMaterial(t);
1384
+ s = this._invokeOne(function(i) {
1385
+ return i.loadMaterial && i.loadMaterial(t);
1386
1386
  });
1387
1387
  break;
1388
1388
  case "texture":
1389
- s = this._invokeOne(function(r) {
1390
- return r.loadTexture && r.loadTexture(t);
1389
+ s = this._invokeOne(function(i) {
1390
+ return i.loadTexture && i.loadTexture(t);
1391
1391
  });
1392
1392
  break;
1393
1393
  case "skin":
1394
1394
  s = this.loadSkin(t);
1395
1395
  break;
1396
1396
  case "animation":
1397
- s = this._invokeOne(function(r) {
1398
- return r.loadAnimation && r.loadAnimation(t);
1397
+ s = this._invokeOne(function(i) {
1398
+ return i.loadAnimation && i.loadAnimation(t);
1399
1399
  });
1400
1400
  break;
1401
1401
  case "camera":
1402
1402
  s = this.loadCamera(t);
1403
1403
  break;
1404
1404
  default:
1405
- if (s = this._invokeOne(function(r) {
1406
- return r != this && r.getDependency && r.getDependency(e, t);
1405
+ if (s = this._invokeOne(function(i) {
1406
+ return i != this && i.getDependency && i.getDependency(e, t);
1407
1407
  }), !s)
1408
1408
  throw new Error("Unknown type: " + e);
1409
1409
  break;
1410
1410
  }
1411
- this.cache.add(i, s);
1411
+ this.cache.add(r, s);
1412
1412
  }
1413
1413
  return s;
1414
1414
  }
@@ -1420,9 +1420,9 @@ class ys {
1420
1420
  getDependencies(e) {
1421
1421
  let t = this.cache.get(e);
1422
1422
  if (!t) {
1423
- const i = this, s = this.json[e + (e === "mesh" ? "es" : "s")] || [];
1424
- t = Promise.all(s.map(function(r, n) {
1425
- return i.getDependency(e, n);
1423
+ const r = this, s = this.json[e + (e === "mesh" ? "es" : "s")] || [];
1424
+ t = Promise.all(s.map(function(i, n) {
1425
+ return r.getDependency(e, n);
1426
1426
  })), this.cache.add(e, t);
1427
1427
  }
1428
1428
  return t;
@@ -1433,14 +1433,14 @@ class ys {
1433
1433
  * @return {Promise<ArrayBuffer>}
1434
1434
  */
1435
1435
  loadBuffer(e) {
1436
- const t = this.json.buffers[e], i = this.fileLoader;
1436
+ const t = this.json.buffers[e], r = this.fileLoader;
1437
1437
  if (t.type && t.type !== "arraybuffer")
1438
1438
  throw new Error("THREE.GLTFLoader: " + t.type + " buffer type is not supported.");
1439
1439
  if (t.uri === void 0 && e === 0)
1440
1440
  return Promise.resolve(this.extensions[T.KHR_BINARY_GLTF].body);
1441
1441
  const s = this.options;
1442
- return new Promise(function(r, n) {
1443
- i.load(K.resolveURL(t.uri, s.path), r, void 0, function() {
1442
+ return new Promise(function(i, n) {
1443
+ r.load(V.resolveURL(t.uri, s.path), i, void 0, function() {
1444
1444
  n(new Error('THREE.GLTFLoader: Failed to load buffer "' + t.uri + '".'));
1445
1445
  });
1446
1446
  });
@@ -1452,9 +1452,9 @@ class ys {
1452
1452
  */
1453
1453
  loadBufferView(e) {
1454
1454
  const t = this.json.bufferViews[e];
1455
- return this.getDependency("buffer", t.buffer).then(function(i) {
1456
- const s = t.byteLength || 0, r = t.byteOffset || 0;
1457
- return i.slice(r, r + s);
1455
+ return this.getDependency("buffer", t.buffer).then(function(r) {
1456
+ const s = t.byteLength || 0, i = t.byteOffset || 0;
1457
+ return r.slice(i, i + s);
1458
1458
  });
1459
1459
  }
1460
1460
  /**
@@ -1463,27 +1463,27 @@ class ys {
1463
1463
  * @return {Promise<BufferAttribute|InterleavedBufferAttribute>}
1464
1464
  */
1465
1465
  loadAccessor(e) {
1466
- const t = this, i = this.json, s = this.json.accessors[e];
1466
+ const t = this, r = this.json, s = this.json.accessors[e];
1467
1467
  if (s.bufferView === void 0 && s.sparse === void 0) {
1468
- const n = re[s.type], c = H[s.componentType], a = s.normalized === !0, l = new c(s.count * n);
1469
- return Promise.resolve(new j(l, n, a));
1468
+ const n = oe[s.type], a = H[s.componentType], c = s.normalized === !0, l = new a(s.count * n);
1469
+ return Promise.resolve(new K(l, n, c));
1470
1470
  }
1471
- const r = [];
1472
- 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) {
1473
- const c = n[0], a = re[s.type], l = H[s.componentType], d = l.BYTES_PER_ELEMENT, u = d * a, h = s.byteOffset || 0, f = s.bufferView !== void 0 ? i.bufferViews[s.bufferView].byteStride : void 0, p = s.normalized === !0;
1471
+ const i = [];
1472
+ return s.bufferView !== void 0 ? i.push(this.getDependency("bufferView", s.bufferView)) : i.push(null), s.sparse !== void 0 && (i.push(this.getDependency("bufferView", s.sparse.indices.bufferView)), i.push(this.getDependency("bufferView", s.sparse.values.bufferView))), Promise.all(i).then(function(n) {
1473
+ const a = n[0], c = oe[s.type], l = H[s.componentType], d = l.BYTES_PER_ELEMENT, u = d * c, h = s.byteOffset || 0, f = s.bufferView !== void 0 ? r.bufferViews[s.bufferView].byteStride : void 0, p = s.normalized === !0;
1474
1474
  let A, m;
1475
1475
  if (f && f !== u) {
1476
1476
  const g = Math.floor(h / f), R = "InterleavedBuffer:" + s.bufferView + ":" + s.componentType + ":" + g + ":" + s.count;
1477
1477
  let w = t.cache.get(R);
1478
- w || (A = new l(c, g * f, s.count * f / d), w = new ft(A, f / d), t.cache.add(R, w)), m = new pt(w, a, h % f / d, p);
1478
+ w || (A = new l(a, g * f, s.count * f / d), w = new ft(A, f / d), t.cache.add(R, w)), m = new pt(w, c, h % f / d, p);
1479
1479
  } else
1480
- c === null ? A = new l(s.count * a) : A = new l(c, h, s.count * a), m = new j(A, a, p);
1480
+ a === null ? A = new l(s.count * c) : A = new l(a, h, s.count * c), m = new K(A, c, p);
1481
1481
  if (s.sparse !== void 0) {
1482
- const g = re.SCALAR, R = H[s.sparse.indices.componentType], w = s.sparse.indices.byteOffset || 0, E = s.sparse.values.byteOffset || 0, b = new R(n[1], w, s.sparse.count * g), M = new l(n[2], E, s.sparse.count * a);
1483
- c !== null && (m = new j(m.array.slice(), m.itemSize, m.normalized)), m.normalized = !1;
1482
+ const g = oe.SCALAR, R = H[s.sparse.indices.componentType], w = s.sparse.indices.byteOffset || 0, E = s.sparse.values.byteOffset || 0, b = new R(n[1], w, s.sparse.count * g), M = new l(n[2], E, s.sparse.count * c);
1483
+ a !== null && (m = new K(m.array.slice(), m.itemSize, m.normalized)), m.normalized = !1;
1484
1484
  for (let y = 0, U = b.length; y < U; y++) {
1485
1485
  const I = b[y];
1486
- if (m.setX(I, M[y * a]), a >= 2 && m.setY(I, M[y * a + 1]), a >= 3 && m.setZ(I, M[y * a + 2]), a >= 4 && m.setW(I, M[y * a + 3]), a >= 5) throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
1486
+ if (m.setX(I, M[y * c]), c >= 2 && m.setY(I, M[y * c + 1]), c >= 3 && m.setZ(I, M[y * c + 2]), c >= 4 && m.setW(I, M[y * c + 3]), c >= 5) throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
1487
1487
  }
1488
1488
  m.normalized = p;
1489
1489
  }
@@ -1496,53 +1496,53 @@ class ys {
1496
1496
  * @return {Promise<THREE.Texture|null>}
1497
1497
  */
1498
1498
  loadTexture(e) {
1499
- const t = this.json, i = this.options, r = t.textures[e].source, n = t.images[r];
1500
- let c = this.textureLoader;
1499
+ const t = this.json, r = this.options, i = t.textures[e].source, n = t.images[i];
1500
+ let a = this.textureLoader;
1501
1501
  if (n.uri) {
1502
- const a = i.manager.getHandler(n.uri);
1503
- a !== null && (c = a);
1502
+ const c = r.manager.getHandler(n.uri);
1503
+ c !== null && (a = c);
1504
1504
  }
1505
- return this.loadTextureImage(e, r, c);
1506
- }
1507
- loadTextureImage(e, t, i) {
1508
- const s = this, r = this.json, n = r.textures[e], c = r.images[t], a = (c.uri || c.bufferView) + ":" + n.sampler;
1509
- if (this.textureCache[a])
1510
- return this.textureCache[a];
1511
- const l = this.loadImageSource(t, i).then(function(d) {
1512
- d.flipY = !1, d.name = n.name || c.name || "", d.name === "" && typeof c.uri == "string" && c.uri.startsWith("data:image/") === !1 && (d.name = c.uri);
1513
- const h = (r.samplers || {})[n.sampler] || {};
1514
- return d.magFilter = be[h.magFilter] || de, d.minFilter = be[h.minFilter] || Ge, d.wrapS = Se[h.wrapS] || he, d.wrapT = Se[h.wrapT] || he, d.generateMipmaps = !d.isCompressedTexture && d.minFilter !== Be && d.minFilter !== de, s.associations.set(d, { textures: e }), d;
1505
+ return this.loadTextureImage(e, i, a);
1506
+ }
1507
+ loadTextureImage(e, t, r) {
1508
+ const s = this, i = this.json, n = i.textures[e], a = i.images[t], c = (a.uri || a.bufferView) + ":" + n.sampler;
1509
+ if (this.textureCache[c])
1510
+ return this.textureCache[c];
1511
+ const l = this.loadImageSource(t, r).then(function(d) {
1512
+ d.flipY = !1, d.name = n.name || a.name || "", d.name === "" && typeof a.uri == "string" && a.uri.startsWith("data:image/") === !1 && (d.name = a.uri);
1513
+ const h = (i.samplers || {})[n.sampler] || {};
1514
+ return d.magFilter = Se[h.magFilter] || he, d.minFilter = Se[h.minFilter] || je, d.wrapS = ve[h.wrapS] || fe, d.wrapT = ve[h.wrapT] || fe, d.generateMipmaps = !d.isCompressedTexture && d.minFilter !== Ke && d.minFilter !== he, s.associations.set(d, { textures: e }), d;
1515
1515
  }).catch(function() {
1516
1516
  return null;
1517
1517
  });
1518
- return this.textureCache[a] = l, l;
1518
+ return this.textureCache[c] = l, l;
1519
1519
  }
1520
1520
  loadImageSource(e, t) {
1521
- const i = this, s = this.json, r = this.options;
1521
+ const r = this, s = this.json, i = this.options;
1522
1522
  if (this.sourceCache[e] !== void 0)
1523
1523
  return this.sourceCache[e].then((u) => u.clone());
1524
- const n = s.images[e], c = self.URL || self.webkitURL;
1525
- let a = n.uri || "", l = !1;
1524
+ const n = s.images[e], a = self.URL || self.webkitURL;
1525
+ let c = n.uri || "", l = !1;
1526
1526
  if (n.bufferView !== void 0)
1527
- a = i.getDependency("bufferView", n.bufferView).then(function(u) {
1527
+ c = r.getDependency("bufferView", n.bufferView).then(function(u) {
1528
1528
  l = !0;
1529
1529
  const h = new Blob([u], { type: n.mimeType });
1530
- return a = c.createObjectURL(h), a;
1530
+ return c = a.createObjectURL(h), c;
1531
1531
  });
1532
1532
  else if (n.uri === void 0)
1533
1533
  throw new Error("THREE.GLTFLoader: Image " + e + " is missing URI and bufferView");
1534
- const d = Promise.resolve(a).then(function(u) {
1534
+ const d = Promise.resolve(c).then(function(u) {
1535
1535
  return new Promise(function(h, f) {
1536
1536
  let p = h;
1537
1537
  t.isImageBitmapLoader === !0 && (p = function(A) {
1538
- const m = new Re(A);
1538
+ const m = new Ee(A);
1539
1539
  m.needsUpdate = !0, h(m);
1540
- }), t.load(K.resolveURL(u, r.path), p, void 0, f);
1540
+ }), t.load(V.resolveURL(u, i.path), p, void 0, f);
1541
1541
  });
1542
1542
  }).then(function(u) {
1543
- return l === !0 && c.revokeObjectURL(a), C(u, n), u.userData.mimeType = n.mimeType || ws(n.uri), u;
1543
+ return l === !0 && a.revokeObjectURL(c), C(u, n), u.userData.mimeType = n.mimeType || ws(n.uri), u;
1544
1544
  }).catch(function(u) {
1545
- throw console.error("THREE.GLTFLoader: Couldn't load texture", a), u;
1545
+ throw console.error("THREE.GLTFLoader: Couldn't load texture", c), u;
1546
1546
  });
1547
1547
  return this.sourceCache[e] = d, d;
1548
1548
  }
@@ -1555,15 +1555,15 @@ class ys {
1555
1555
  * @param {string} colorSpace
1556
1556
  * @return {Promise<Texture>}
1557
1557
  */
1558
- assignTexture(e, t, i, s) {
1559
- const r = this;
1560
- return this.getDependency("texture", i.index).then(function(n) {
1558
+ assignTexture(e, t, r, s) {
1559
+ const i = this;
1560
+ return this.getDependency("texture", r.index).then(function(n) {
1561
1561
  if (!n) return null;
1562
- if (i.texCoord !== void 0 && i.texCoord > 0 && (n = n.clone(), n.channel = i.texCoord), r.extensions[T.KHR_TEXTURE_TRANSFORM]) {
1563
- const c = i.extensions !== void 0 ? i.extensions[T.KHR_TEXTURE_TRANSFORM] : void 0;
1564
- if (c) {
1565
- const a = r.associations.get(n);
1566
- n = r.extensions[T.KHR_TEXTURE_TRANSFORM].extendTexture(n, c), r.associations.set(n, a);
1562
+ if (r.texCoord !== void 0 && r.texCoord > 0 && (n = n.clone(), n.channel = r.texCoord), i.extensions[T.KHR_TEXTURE_TRANSFORM]) {
1563
+ const a = r.extensions !== void 0 ? r.extensions[T.KHR_TEXTURE_TRANSFORM] : void 0;
1564
+ if (a) {
1565
+ const c = i.associations.get(n);
1566
+ n = i.extensions[T.KHR_TEXTURE_TRANSFORM].extendTexture(n, a), i.associations.set(n, c);
1567
1567
  }
1568
1568
  }
1569
1569
  return s !== void 0 && (n.colorSpace = s), e[t] = n, n;
@@ -1579,27 +1579,27 @@ class ys {
1579
1579
  */
1580
1580
  assignFinalMaterial(e) {
1581
1581
  const t = e.geometry;
1582
- let i = e.material;
1583
- const s = t.attributes.tangent === void 0, r = t.attributes.color !== void 0, n = t.attributes.normal === void 0;
1582
+ let r = e.material;
1583
+ const s = t.attributes.tangent === void 0, i = t.attributes.color !== void 0, n = t.attributes.normal === void 0;
1584
1584
  if (e.isPoints) {
1585
- const c = "PointsMaterial:" + i.uuid;
1586
- let a = this.cache.get(c);
1587
- a || (a = new mt(), te.prototype.copy.call(a, i), a.color.copy(i.color), a.map = i.map, a.sizeAttenuation = !1, this.cache.add(c, a)), i = a;
1585
+ const a = "PointsMaterial:" + r.uuid;
1586
+ let c = this.cache.get(a);
1587
+ c || (c = new mt(), ne.prototype.copy.call(c, r), c.color.copy(r.color), c.map = r.map, c.sizeAttenuation = !1, this.cache.add(a, c)), r = c;
1588
1588
  } else if (e.isLine) {
1589
- const c = "LineBasicMaterial:" + i.uuid;
1590
- let a = this.cache.get(c);
1591
- a || (a = new gt(), te.prototype.copy.call(a, i), a.color.copy(i.color), a.map = i.map, this.cache.add(c, a)), i = a;
1589
+ const a = "LineBasicMaterial:" + r.uuid;
1590
+ let c = this.cache.get(a);
1591
+ c || (c = new gt(), ne.prototype.copy.call(c, r), c.color.copy(r.color), c.map = r.map, this.cache.add(a, c)), r = c;
1592
1592
  }
1593
- if (s || r || n) {
1594
- let c = "ClonedMaterial:" + i.uuid + ":";
1595
- s && (c += "derivative-tangents:"), r && (c += "vertex-colors:"), n && (c += "flat-shading:");
1596
- let a = this.cache.get(c);
1597
- a || (a = i.clone(), r && (a.vertexColors = !0), n && (a.flatShading = !0), s && (a.normalScale && (a.normalScale.y *= -1), a.clearcoatNormalScale && (a.clearcoatNormalScale.y *= -1)), this.cache.add(c, a), this.associations.set(a, this.associations.get(i))), i = a;
1593
+ if (s || i || n) {
1594
+ let a = "ClonedMaterial:" + r.uuid + ":";
1595
+ s && (a += "derivative-tangents:"), i && (a += "vertex-colors:"), n && (a += "flat-shading:");
1596
+ let c = this.cache.get(a);
1597
+ c || (c = r.clone(), i && (c.vertexColors = !0), n && (c.flatShading = !0), s && (c.normalScale && (c.normalScale.y *= -1), c.clearcoatNormalScale && (c.clearcoatNormalScale.y *= -1)), this.cache.add(a, c), this.associations.set(c, this.associations.get(r))), r = c;
1598
1598
  }
1599
- e.material = i;
1599
+ e.material = r;
1600
1600
  }
1601
1601
  getMaterialType() {
1602
- return je;
1602
+ return Ve;
1603
1603
  }
1604
1604
  /**
1605
1605
  * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials
@@ -1607,37 +1607,37 @@ class ys {
1607
1607
  * @return {Promise<Material>}
1608
1608
  */
1609
1609
  loadMaterial(e) {
1610
- const t = this, i = this.json, s = this.extensions, r = i.materials[e];
1610
+ const t = this, r = this.json, s = this.extensions, i = r.materials[e];
1611
1611
  let n;
1612
- const c = {}, a = r.extensions || {}, l = [];
1613
- if (a[T.KHR_MATERIALS_UNLIT]) {
1612
+ const a = {}, c = i.extensions || {}, l = [];
1613
+ if (c[T.KHR_MATERIALS_UNLIT]) {
1614
1614
  const u = s[T.KHR_MATERIALS_UNLIT];
1615
- n = u.getMaterialType(), l.push(u.extendParams(c, r, t));
1615
+ n = u.getMaterialType(), l.push(u.extendParams(a, i, t));
1616
1616
  } else {
1617
- const u = r.pbrMetallicRoughness || {};
1618
- if (c.color = new P(1, 1, 1), c.opacity = 1, Array.isArray(u.baseColorFactor)) {
1617
+ const u = i.pbrMetallicRoughness || {};
1618
+ if (a.color = new P(1, 1, 1), a.opacity = 1, Array.isArray(u.baseColorFactor)) {
1619
1619
  const h = u.baseColorFactor;
1620
- c.color.setRGB(h[0], h[1], h[2], S), c.opacity = h[3];
1620
+ a.color.setRGB(h[0], h[1], h[2], S), a.opacity = h[3];
1621
1621
  }
1622
- u.baseColorTexture !== void 0 && l.push(t.assignTexture(c, "map", u.baseColorTexture, N)), c.metalness = u.metallicFactor !== void 0 ? u.metallicFactor : 1, c.roughness = u.roughnessFactor !== void 0 ? u.roughnessFactor : 1, u.metallicRoughnessTexture !== void 0 && (l.push(t.assignTexture(c, "metalnessMap", u.metallicRoughnessTexture)), l.push(t.assignTexture(c, "roughnessMap", u.metallicRoughnessTexture))), n = this._invokeOne(function(h) {
1622
+ u.baseColorTexture !== void 0 && l.push(t.assignTexture(a, "map", u.baseColorTexture, N)), a.metalness = u.metallicFactor !== void 0 ? u.metallicFactor : 1, a.roughness = u.roughnessFactor !== void 0 ? u.roughnessFactor : 1, u.metallicRoughnessTexture !== void 0 && (l.push(t.assignTexture(a, "metalnessMap", u.metallicRoughnessTexture)), l.push(t.assignTexture(a, "roughnessMap", u.metallicRoughnessTexture))), n = this._invokeOne(function(h) {
1623
1623
  return h.getMaterialType && h.getMaterialType(e);
1624
1624
  }), l.push(Promise.all(this._invokeAll(function(h) {
1625
- return h.extendMaterialParams && h.extendMaterialParams(e, c);
1625
+ return h.extendMaterialParams && h.extendMaterialParams(e, a);
1626
1626
  })));
1627
1627
  }
1628
- r.doubleSided === !0 && (c.side = At);
1629
- const d = r.alphaMode || ie.OPAQUE;
1630
- if (d === ie.BLEND ? (c.transparent = !0, c.depthWrite = !1) : (c.transparent = !1, d === ie.MASK && (c.alphaTest = r.alphaCutoff !== void 0 ? r.alphaCutoff : 0.5)), r.normalTexture !== void 0 && n !== B && (l.push(t.assignTexture(c, "normalMap", r.normalTexture)), c.normalScale = new ke(1, 1), r.normalTexture.scale !== void 0)) {
1631
- const u = r.normalTexture.scale;
1632
- c.normalScale.set(u, u);
1628
+ i.doubleSided === !0 && (a.side = At);
1629
+ const d = i.alphaMode || ae.OPAQUE;
1630
+ if (d === ae.BLEND ? (a.transparent = !0, a.depthWrite = !1) : (a.transparent = !1, d === ae.MASK && (a.alphaTest = i.alphaCutoff !== void 0 ? i.alphaCutoff : 0.5)), i.normalTexture !== void 0 && n !== B && (l.push(t.assignTexture(a, "normalMap", i.normalTexture)), a.normalScale = new He(1, 1), i.normalTexture.scale !== void 0)) {
1631
+ const u = i.normalTexture.scale;
1632
+ a.normalScale.set(u, u);
1633
1633
  }
1634
- if (r.occlusionTexture !== void 0 && n !== B && (l.push(t.assignTexture(c, "aoMap", r.occlusionTexture)), r.occlusionTexture.strength !== void 0 && (c.aoMapIntensity = r.occlusionTexture.strength)), r.emissiveFactor !== void 0 && n !== B) {
1635
- const u = r.emissiveFactor;
1636
- c.emissive = new P().setRGB(u[0], u[1], u[2], S);
1634
+ if (i.occlusionTexture !== void 0 && n !== B && (l.push(t.assignTexture(a, "aoMap", i.occlusionTexture)), i.occlusionTexture.strength !== void 0 && (a.aoMapIntensity = i.occlusionTexture.strength)), i.emissiveFactor !== void 0 && n !== B) {
1635
+ const u = i.emissiveFactor;
1636
+ a.emissive = new P().setRGB(u[0], u[1], u[2], S);
1637
1637
  }
1638
- return r.emissiveTexture !== void 0 && n !== B && l.push(t.assignTexture(c, "emissiveMap", r.emissiveTexture, N)), Promise.all(l).then(function() {
1639
- const u = new n(c);
1640
- return r.name && (u.name = r.name), C(u, r), t.associations.set(u, { materials: e }), r.extensions && D(s, u, r), u;
1638
+ return i.emissiveTexture !== void 0 && n !== B && l.push(t.assignTexture(a, "emissiveMap", i.emissiveTexture, N)), Promise.all(l).then(function() {
1639
+ const u = new n(a);
1640
+ return i.name && (u.name = i.name), C(u, i), t.associations.set(u, { materials: e }), i.extensions && D(s, u, i), u;
1641
1641
  });
1642
1642
  }
1643
1643
  /**
@@ -1659,20 +1659,20 @@ class ys {
1659
1659
  * @return {Promise<Array<BufferGeometry>>}
1660
1660
  */
1661
1661
  loadGeometries(e) {
1662
- const t = this, i = this.extensions, s = this.primitiveCache;
1663
- function r(c) {
1664
- return i[T.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(c, t).then(function(a) {
1665
- return ve(a, c, t);
1662
+ const t = this, r = this.extensions, s = this.primitiveCache;
1663
+ function i(a) {
1664
+ return r[T.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a, t).then(function(c) {
1665
+ return Ce(c, a, t);
1666
1666
  });
1667
1667
  }
1668
1668
  const n = [];
1669
- for (let c = 0, a = e.length; c < a; c++) {
1670
- const l = e[c], d = Es(l), u = s[d];
1669
+ for (let a = 0, c = e.length; a < c; a++) {
1670
+ const l = e[a], d = Es(l), u = s[d];
1671
1671
  if (u)
1672
1672
  n.push(u.promise);
1673
1673
  else {
1674
1674
  let h;
1675
- l.extensions && l.extensions[T.KHR_DRACO_MESH_COMPRESSION] ? h = r(l) : h = ve(new De(), l, t), s[d] = { primitive: l, promise: h }, n.push(h);
1675
+ l.extensions && l.extensions[T.KHR_DRACO_MESH_COMPRESSION] ? h = i(l) : h = Ce(new Fe(), l, t), s[d] = { primitive: l, promise: h }, n.push(h);
1676
1676
  }
1677
1677
  }
1678
1678
  return Promise.all(n);
@@ -1683,19 +1683,19 @@ class ys {
1683
1683
  * @return {Promise<Group|Mesh|SkinnedMesh>}
1684
1684
  */
1685
1685
  loadMesh(e) {
1686
- const t = this, i = this.json, s = this.extensions, r = i.meshes[e], n = r.primitives, c = [];
1687
- for (let a = 0, l = n.length; a < l; a++) {
1688
- const d = n[a].material === void 0 ? Ts(this.cache) : this.getDependency("material", n[a].material);
1689
- c.push(d);
1686
+ const t = this, r = this.json, s = this.extensions, i = r.meshes[e], n = i.primitives, a = [];
1687
+ for (let c = 0, l = n.length; c < l; c++) {
1688
+ const d = n[c].material === void 0 ? Ts(this.cache) : this.getDependency("material", n[c].material);
1689
+ a.push(d);
1690
1690
  }
1691
- return c.push(t.loadGeometries(n)), Promise.all(c).then(function(a) {
1692
- const l = a.slice(0, a.length - 1), d = a[a.length - 1], u = [];
1691
+ return a.push(t.loadGeometries(n)), Promise.all(a).then(function(c) {
1692
+ const l = c.slice(0, c.length - 1), d = c[c.length - 1], u = [];
1693
1693
  for (let f = 0, p = d.length; f < p; f++) {
1694
1694
  const A = d[f], m = n[f];
1695
1695
  let g;
1696
1696
  const R = l[f];
1697
1697
  if (m.mode === x.TRIANGLES || m.mode === x.TRIANGLE_STRIP || m.mode === x.TRIANGLE_FAN || m.mode === void 0)
1698
- g = r.isSkinnedMesh === !0 ? new _t(A, R) : new Rt(A, R), g.isSkinnedMesh === !0 && g.normalizeSkinWeights(), m.mode === x.TRIANGLE_STRIP ? g.geometry = ye(g.geometry, Ne) : m.mode === x.TRIANGLE_FAN && (g.geometry = ye(g.geometry, le));
1698
+ g = i.isSkinnedMesh === !0 ? new _t(A, R) : new Rt(A, R), g.isSkinnedMesh === !0 && g.normalizeSkinWeights(), m.mode === x.TRIANGLE_STRIP ? g.geometry = Le(g.geometry, De) : m.mode === x.TRIANGLE_FAN && (g.geometry = Le(g.geometry, ue));
1699
1699
  else if (m.mode === x.LINES)
1700
1700
  g = new Et(A, R);
1701
1701
  else if (m.mode === x.LINE_STRIP)
@@ -1706,7 +1706,7 @@ class ys {
1706
1706
  g = new yt(A, R);
1707
1707
  else
1708
1708
  throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + m.mode);
1709
- Object.keys(g.geometry.morphAttributes).length > 0 && Rs(g, r), g.name = t.createUniqueName(r.name || "mesh_" + e), C(g, r), m.extensions && D(s, g, m), t.assignFinalMaterial(g), u.push(g);
1709
+ Object.keys(g.geometry.morphAttributes).length > 0 && Rs(g, i), g.name = t.createUniqueName(i.name || "mesh_" + e), C(g, i), m.extensions && D(s, g, m), t.assignFinalMaterial(g), u.push(g);
1710
1710
  }
1711
1711
  for (let f = 0, p = u.length; f < p; f++)
1712
1712
  t.associations.set(u[f], {
@@ -1714,9 +1714,9 @@ class ys {
1714
1714
  primitives: f
1715
1715
  });
1716
1716
  if (u.length === 1)
1717
- return r.extensions && D(s, u[0], r), u[0];
1718
- const h = new se();
1719
- r.extensions && D(s, h, r), t.associations.set(h, { meshes: e });
1717
+ return i.extensions && D(s, u[0], i), u[0];
1718
+ const h = new re();
1719
+ i.extensions && D(s, h, i), t.associations.set(h, { meshes: e });
1720
1720
  for (let f = 0, p = u.length; f < p; f++)
1721
1721
  h.add(u[f]);
1722
1722
  return h;
@@ -1729,12 +1729,12 @@ class ys {
1729
1729
  */
1730
1730
  loadCamera(e) {
1731
1731
  let t;
1732
- const i = this.json.cameras[e], s = i[i.type];
1732
+ const r = this.json.cameras[e], s = r[r.type];
1733
1733
  if (!s) {
1734
1734
  console.warn("THREE.GLTFLoader: Missing camera parameters.");
1735
1735
  return;
1736
1736
  }
1737
- return i.type === "perspective" ? t = new Lt(bt.radToDeg(s.yfov), s.aspectRatio || 1, s.znear || 1, s.zfar || 2e6) : i.type === "orthographic" && (t = new St(-s.xmag, s.xmag, s.ymag, -s.ymag, s.znear, s.zfar)), i.name && (t.name = this.createUniqueName(i.name)), C(t, i), Promise.resolve(t);
1737
+ return r.type === "perspective" ? t = new Lt(bt.radToDeg(s.yfov), s.aspectRatio || 1, s.znear || 1, s.zfar || 2e6) : r.type === "orthographic" && (t = new St(-s.xmag, s.xmag, s.ymag, -s.ymag, s.znear, s.zfar)), r.name && (t.name = this.createUniqueName(r.name)), C(t, r), Promise.resolve(t);
1738
1738
  }
1739
1739
  /**
1740
1740
  * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins
@@ -1742,21 +1742,21 @@ class ys {
1742
1742
  * @return {Promise<Skeleton>}
1743
1743
  */
1744
1744
  loadSkin(e) {
1745
- const t = this.json.skins[e], i = [];
1746
- for (let s = 0, r = t.joints.length; s < r; s++)
1747
- i.push(this._loadNodeShallow(t.joints[s]));
1748
- return t.inverseBindMatrices !== void 0 ? i.push(this.getDependency("accessor", t.inverseBindMatrices)) : i.push(null), Promise.all(i).then(function(s) {
1749
- const r = s.pop(), n = s, c = [], a = [];
1745
+ const t = this.json.skins[e], r = [];
1746
+ for (let s = 0, i = t.joints.length; s < i; s++)
1747
+ r.push(this._loadNodeShallow(t.joints[s]));
1748
+ return t.inverseBindMatrices !== void 0 ? r.push(this.getDependency("accessor", t.inverseBindMatrices)) : r.push(null), Promise.all(r).then(function(s) {
1749
+ const i = s.pop(), n = s, a = [], c = [];
1750
1750
  for (let l = 0, d = n.length; l < d; l++) {
1751
1751
  const u = n[l];
1752
1752
  if (u) {
1753
- c.push(u);
1754
- const h = new $();
1755
- r !== null && h.fromArray(r.array, l * 16), a.push(h);
1753
+ a.push(u);
1754
+ const h = new Y();
1755
+ i !== null && h.fromArray(i.array, l * 16), c.push(h);
1756
1756
  } else
1757
1757
  console.warn('THREE.GLTFLoader: Joint "%s" could not be found.', t.joints[l]);
1758
1758
  }
1759
- return new vt(c, a);
1759
+ return new vt(a, c);
1760
1760
  });
1761
1761
  }
1762
1762
  /**
@@ -1765,15 +1765,15 @@ class ys {
1765
1765
  * @return {Promise<AnimationClip>}
1766
1766
  */
1767
1767
  loadAnimation(e) {
1768
- const t = this.json, i = this, s = t.animations[e], r = s.name ? s.name : "animation_" + e, n = [], c = [], a = [], l = [], d = [];
1768
+ const t = this.json, r = this, s = t.animations[e], i = s.name ? s.name : "animation_" + e, n = [], a = [], c = [], l = [], d = [];
1769
1769
  for (let u = 0, h = s.channels.length; u < h; u++) {
1770
1770
  const f = s.channels[u], p = s.samplers[f.sampler], A = f.target, m = A.node, g = s.parameters !== void 0 ? s.parameters[p.input] : p.input, R = s.parameters !== void 0 ? s.parameters[p.output] : p.output;
1771
- A.node !== void 0 && (n.push(this.getDependency("node", m)), c.push(this.getDependency("accessor", g)), a.push(this.getDependency("accessor", R)), l.push(p), d.push(A));
1771
+ A.node !== void 0 && (n.push(this.getDependency("node", m)), a.push(this.getDependency("accessor", g)), c.push(this.getDependency("accessor", R)), l.push(p), d.push(A));
1772
1772
  }
1773
1773
  return Promise.all([
1774
1774
  Promise.all(n),
1775
- Promise.all(c),
1776
1775
  Promise.all(a),
1776
+ Promise.all(c),
1777
1777
  Promise.all(l),
1778
1778
  Promise.all(d)
1779
1779
  ]).then(function(u) {
@@ -1782,22 +1782,22 @@ class ys {
1782
1782
  const E = h[R], b = f[R], M = p[R], y = A[R], U = m[R];
1783
1783
  if (E === void 0) continue;
1784
1784
  E.updateMatrix && E.updateMatrix();
1785
- const I = i._createAnimationTracks(E, b, M, y, U);
1785
+ const I = r._createAnimationTracks(E, b, M, y, U);
1786
1786
  if (I)
1787
- for (let Z = 0; Z < I.length; Z++)
1788
- g.push(I[Z]);
1787
+ for (let te = 0; te < I.length; te++)
1788
+ g.push(I[te]);
1789
1789
  }
1790
- return new Ct(r, void 0, g);
1790
+ return new Ct(i, void 0, g);
1791
1791
  });
1792
1792
  }
1793
1793
  createNodeMesh(e) {
1794
- const t = this.json, i = this, s = t.nodes[e];
1795
- return s.mesh === void 0 ? null : i.getDependency("mesh", s.mesh).then(function(r) {
1796
- const n = i._getNodeRef(i.meshCache, s.mesh, r);
1797
- return s.weights !== void 0 && n.traverse(function(c) {
1798
- if (c.isMesh)
1799
- for (let a = 0, l = s.weights.length; a < l; a++)
1800
- c.morphTargetInfluences[a] = s.weights[a];
1794
+ const t = this.json, r = this, s = t.nodes[e];
1795
+ return s.mesh === void 0 ? null : r.getDependency("mesh", s.mesh).then(function(i) {
1796
+ const n = r._getNodeRef(r.meshCache, s.mesh, i);
1797
+ return s.weights !== void 0 && n.traverse(function(a) {
1798
+ if (a.isMesh)
1799
+ for (let c = 0, l = s.weights.length; c < l; c++)
1800
+ a.morphTargetInfluences[c] = s.weights[c];
1801
1801
  }), n;
1802
1802
  });
1803
1803
  }
@@ -1807,14 +1807,14 @@ class ys {
1807
1807
  * @return {Promise<Object3D>}
1808
1808
  */
1809
1809
  loadNode(e) {
1810
- const t = this.json, i = this, s = t.nodes[e], r = i._loadNodeShallow(e), n = [], c = s.children || [];
1811
- for (let l = 0, d = c.length; l < d; l++)
1812
- n.push(i.getDependency("node", c[l]));
1813
- const a = s.skin === void 0 ? Promise.resolve(null) : i.getDependency("skin", s.skin);
1810
+ const t = this.json, r = this, s = t.nodes[e], i = r._loadNodeShallow(e), n = [], a = s.children || [];
1811
+ for (let l = 0, d = a.length; l < d; l++)
1812
+ n.push(r.getDependency("node", a[l]));
1813
+ const c = s.skin === void 0 ? Promise.resolve(null) : r.getDependency("skin", s.skin);
1814
1814
  return Promise.all([
1815
- r,
1815
+ i,
1816
1816
  Promise.all(n),
1817
- a
1817
+ c
1818
1818
  ]).then(function(l) {
1819
1819
  const d = l[0], u = l[1], h = l[2];
1820
1820
  h !== null && d.traverse(function(f) {
@@ -1828,28 +1828,28 @@ class ys {
1828
1828
  // ._loadNodeShallow() parses a single node.
1829
1829
  // skin and child nodes are created and added in .loadNode() (no '_' prefix).
1830
1830
  _loadNodeShallow(e) {
1831
- const t = this.json, i = this.extensions, s = this;
1831
+ const t = this.json, r = this.extensions, s = this;
1832
1832
  if (this.nodeCache[e] !== void 0)
1833
1833
  return this.nodeCache[e];
1834
- const r = t.nodes[e], n = r.name ? s.createUniqueName(r.name) : "", c = [], a = s._invokeOne(function(l) {
1834
+ const i = t.nodes[e], n = i.name ? s.createUniqueName(i.name) : "", a = [], c = s._invokeOne(function(l) {
1835
1835
  return l.createNodeMesh && l.createNodeMesh(e);
1836
1836
  });
1837
- return a && c.push(a), r.camera !== void 0 && c.push(s.getDependency("camera", r.camera).then(function(l) {
1838
- return s._getNodeRef(s.cameraCache, r.camera, l);
1837
+ return c && a.push(c), i.camera !== void 0 && a.push(s.getDependency("camera", i.camera).then(function(l) {
1838
+ return s._getNodeRef(s.cameraCache, i.camera, l);
1839
1839
  })), s._invokeAll(function(l) {
1840
1840
  return l.createNodeAttachment && l.createNodeAttachment(e);
1841
1841
  }).forEach(function(l) {
1842
- c.push(l);
1843
- }), this.nodeCache[e] = Promise.all(c).then(function(l) {
1842
+ a.push(l);
1843
+ }), this.nodeCache[e] = Promise.all(a).then(function(l) {
1844
1844
  let d;
1845
- if (r.isBone === !0 ? d = new Mt() : l.length > 1 ? d = new se() : l.length === 1 ? d = l[0] : d = new He(), d !== l[0])
1845
+ if (i.isBone === !0 ? d = new Mt() : l.length > 1 ? d = new re() : l.length === 1 ? d = l[0] : d = new Ge(), d !== l[0])
1846
1846
  for (let u = 0, h = l.length; u < h; u++)
1847
1847
  d.add(l[u]);
1848
- if (r.name && (d.userData.name = r.name, d.name = n), C(d, r), r.extensions && D(i, d, r), r.matrix !== void 0) {
1849
- const u = new $();
1850
- u.fromArray(r.matrix), d.applyMatrix4(u);
1848
+ if (i.name && (d.userData.name = i.name, d.name = n), C(d, i), i.extensions && D(r, d, i), i.matrix !== void 0) {
1849
+ const u = new Y();
1850
+ u.fromArray(i.matrix), d.applyMatrix4(u);
1851
1851
  } else
1852
- r.translation !== void 0 && d.position.fromArray(r.translation), r.rotation !== void 0 && d.quaternion.fromArray(r.rotation), r.scale !== void 0 && d.scale.fromArray(r.scale);
1852
+ i.translation !== void 0 && d.position.fromArray(i.translation), i.rotation !== void 0 && d.quaternion.fromArray(i.rotation), i.scale !== void 0 && d.scale.fromArray(i.scale);
1853
1853
  return s.associations.has(d) || s.associations.set(d, {}), s.associations.get(d).nodes = e, d;
1854
1854
  }), this.nodeCache[e];
1855
1855
  }
@@ -1859,60 +1859,60 @@ class ys {
1859
1859
  * @return {Promise<Group>}
1860
1860
  */
1861
1861
  loadScene(e) {
1862
- const t = this.extensions, i = this.json.scenes[e], s = this, r = new se();
1863
- i.name && (r.name = s.createUniqueName(i.name)), C(r, i), i.extensions && D(t, r, i);
1864
- const n = i.nodes || [], c = [];
1865
- for (let a = 0, l = n.length; a < l; a++)
1866
- c.push(s.getDependency("node", n[a]));
1867
- return Promise.all(c).then(function(a) {
1868
- for (let d = 0, u = a.length; d < u; d++)
1869
- r.add(a[d]);
1862
+ const t = this.extensions, r = this.json.scenes[e], s = this, i = new re();
1863
+ r.name && (i.name = s.createUniqueName(r.name)), C(i, r), r.extensions && D(t, i, r);
1864
+ const n = r.nodes || [], a = [];
1865
+ for (let c = 0, l = n.length; c < l; c++)
1866
+ a.push(s.getDependency("node", n[c]));
1867
+ return Promise.all(a).then(function(c) {
1868
+ for (let d = 0, u = c.length; d < u; d++)
1869
+ i.add(c[d]);
1870
1870
  const l = (d) => {
1871
1871
  const u = /* @__PURE__ */ new Map();
1872
1872
  for (const [h, f] of s.associations)
1873
- (h instanceof te || h instanceof Re) && u.set(h, f);
1873
+ (h instanceof ne || h instanceof Ee) && u.set(h, f);
1874
1874
  return d.traverse((h) => {
1875
1875
  const f = s.associations.get(h);
1876
1876
  f != null && u.set(h, f);
1877
1877
  }), u;
1878
1878
  };
1879
- return s.associations = l(r), r;
1879
+ return s.associations = l(i), i;
1880
1880
  });
1881
1881
  }
1882
- _createAnimationTracks(e, t, i, s, r) {
1883
- const n = [], c = e.name ? e.name : e.uuid, a = [];
1884
- O[r.path] === O.weights ? e.traverse(function(h) {
1885
- h.morphTargetInfluences && a.push(h.name ? h.name : h.uuid);
1886
- }) : a.push(c);
1882
+ _createAnimationTracks(e, t, r, s, i) {
1883
+ const n = [], a = e.name ? e.name : e.uuid, c = [];
1884
+ O[i.path] === O.weights ? e.traverse(function(h) {
1885
+ h.morphTargetInfluences && c.push(h.name ? h.name : h.uuid);
1886
+ }) : c.push(a);
1887
1887
  let l;
1888
- switch (O[r.path]) {
1888
+ switch (O[i.path]) {
1889
1889
  case O.weights:
1890
- l = we;
1890
+ l = xe;
1891
1891
  break;
1892
1892
  case O.rotation:
1893
- l = xe;
1893
+ l = ye;
1894
1894
  break;
1895
1895
  case O.position:
1896
1896
  case O.scale:
1897
- l = Ee;
1897
+ l = we;
1898
1898
  break;
1899
1899
  default:
1900
- switch (i.itemSize) {
1900
+ switch (r.itemSize) {
1901
1901
  case 1:
1902
- l = we;
1902
+ l = xe;
1903
1903
  break;
1904
1904
  case 2:
1905
1905
  case 3:
1906
1906
  default:
1907
- l = Ee;
1907
+ l = we;
1908
1908
  break;
1909
1909
  }
1910
1910
  break;
1911
1911
  }
1912
- const d = s.interpolation !== void 0 ? As[s.interpolation] : Ke, u = this._getArrayFromAccessor(i);
1913
- for (let h = 0, f = a.length; h < f; h++) {
1912
+ const d = s.interpolation !== void 0 ? As[s.interpolation] : ze, u = this._getArrayFromAccessor(r);
1913
+ for (let h = 0, f = c.length; h < f; h++) {
1914
1914
  const p = new l(
1915
- a[h] + "." + O[r.path],
1915
+ c[h] + "." + O[i.path],
1916
1916
  t.array,
1917
1917
  u,
1918
1918
  d
@@ -1924,30 +1924,30 @@ class ys {
1924
1924
  _getArrayFromAccessor(e) {
1925
1925
  let t = e.array;
1926
1926
  if (e.normalized) {
1927
- const i = pe(t.constructor), s = new Float32Array(t.length);
1928
- for (let r = 0, n = t.length; r < n; r++)
1929
- s[r] = t[r] * i;
1927
+ const r = me(t.constructor), s = new Float32Array(t.length);
1928
+ for (let i = 0, n = t.length; i < n; i++)
1929
+ s[i] = t[i] * r;
1930
1930
  t = s;
1931
1931
  }
1932
1932
  return t;
1933
1933
  }
1934
1934
  _createCubicSplineTrackInterpolant(e) {
1935
- e.createInterpolant = function(i) {
1936
- const s = this instanceof xe ? gs : ze;
1937
- return new s(this.times, this.values, this.getValueSize() / 3, i);
1935
+ e.createInterpolant = function(r) {
1936
+ const s = this instanceof ye ? gs : We;
1937
+ return new s(this.times, this.values, this.getValueSize() / 3, r);
1938
1938
  }, e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0;
1939
1939
  }
1940
1940
  }
1941
1941
  function Ls(o, e, t) {
1942
- const i = e.attributes, s = new Ht();
1943
- if (i.POSITION !== void 0) {
1944
- const c = t.json.accessors[i.POSITION], a = c.min, l = c.max;
1945
- if (a !== void 0 && l !== void 0) {
1942
+ const r = e.attributes, s = new Ht();
1943
+ if (r.POSITION !== void 0) {
1944
+ const a = t.json.accessors[r.POSITION], c = a.min, l = a.max;
1945
+ if (c !== void 0 && l !== void 0) {
1946
1946
  if (s.set(
1947
- new F(a[0], a[1], a[2]),
1947
+ new F(c[0], c[1], c[2]),
1948
1948
  new F(l[0], l[1], l[2])
1949
- ), c.normalized) {
1950
- const d = pe(H[c.componentType]);
1949
+ ), a.normalized) {
1950
+ const d = me(H[a.componentType]);
1951
1951
  s.min.multiplyScalar(d), s.max.multiplyScalar(d);
1952
1952
  }
1953
1953
  } else {
@@ -1956,58 +1956,58 @@ function Ls(o, e, t) {
1956
1956
  }
1957
1957
  } else
1958
1958
  return;
1959
- const r = e.targets;
1960
- if (r !== void 0) {
1961
- const c = new F(), a = new F();
1962
- for (let l = 0, d = r.length; l < d; l++) {
1963
- const u = r[l];
1959
+ const i = e.targets;
1960
+ if (i !== void 0) {
1961
+ const a = new F(), c = new F();
1962
+ for (let l = 0, d = i.length; l < d; l++) {
1963
+ const u = i[l];
1964
1964
  if (u.POSITION !== void 0) {
1965
1965
  const h = t.json.accessors[u.POSITION], f = h.min, p = h.max;
1966
1966
  if (f !== void 0 && p !== void 0) {
1967
- if (a.setX(Math.max(Math.abs(f[0]), Math.abs(p[0]))), a.setY(Math.max(Math.abs(f[1]), Math.abs(p[1]))), a.setZ(Math.max(Math.abs(f[2]), Math.abs(p[2]))), h.normalized) {
1968
- const A = pe(H[h.componentType]);
1969
- a.multiplyScalar(A);
1967
+ if (c.setX(Math.max(Math.abs(f[0]), Math.abs(p[0]))), c.setY(Math.max(Math.abs(f[1]), Math.abs(p[1]))), c.setZ(Math.max(Math.abs(f[2]), Math.abs(p[2]))), h.normalized) {
1968
+ const A = me(H[h.componentType]);
1969
+ c.multiplyScalar(A);
1970
1970
  }
1971
- c.max(a);
1971
+ a.max(c);
1972
1972
  } else
1973
1973
  console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
1974
1974
  }
1975
1975
  }
1976
- s.expandByVector(c);
1976
+ s.expandByVector(a);
1977
1977
  }
1978
1978
  o.boundingBox = s;
1979
1979
  const n = new Ut();
1980
1980
  s.getCenter(n.center), n.radius = s.min.distanceTo(s.max) / 2, o.boundingSphere = n;
1981
1981
  }
1982
- function ve(o, e, t) {
1983
- const i = e.attributes, s = [];
1984
- function r(n, c) {
1985
- return t.getDependency("accessor", n).then(function(a) {
1986
- o.setAttribute(c, a);
1982
+ function Ce(o, e, t) {
1983
+ const r = e.attributes, s = [];
1984
+ function i(n, a) {
1985
+ return t.getDependency("accessor", n).then(function(c) {
1986
+ o.setAttribute(a, c);
1987
1987
  });
1988
1988
  }
1989
- for (const n in i) {
1990
- const c = fe[n] || n.toLowerCase();
1991
- c in o.attributes || s.push(r(i[n], c));
1989
+ for (const n in r) {
1990
+ const a = pe[n] || n.toLowerCase();
1991
+ a in o.attributes || s.push(i(r[n], a));
1992
1992
  }
1993
1993
  if (e.indices !== void 0 && !o.index) {
1994
- const n = t.getDependency("accessor", e.indices).then(function(c) {
1995
- o.setIndex(c);
1994
+ const n = t.getDependency("accessor", e.indices).then(function(a) {
1995
+ o.setIndex(a);
1996
1996
  });
1997
1997
  s.push(n);
1998
1998
  }
1999
- return ue.workingColorSpace !== S && "COLOR_0" in i && console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${ue.workingColorSpace}" not supported.`), C(o, e), Ls(o, e, t), Promise.all(s).then(function() {
1999
+ return de.workingColorSpace !== S && "COLOR_0" in r && console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${de.workingColorSpace}" not supported.`), C(o, e), Ls(o, e, t), Promise.all(s).then(function() {
2000
2000
  return e.targets !== void 0 ? _s(o, e.targets, t) : o;
2001
2001
  });
2002
2002
  }
2003
- var bs = Object.defineProperty, Ss = Object.getOwnPropertyDescriptor, vs = (o, e, t, i) => {
2004
- for (var s = i > 1 ? void 0 : i ? Ss(e, t) : e, r = o.length - 1, n; r >= 0; r--)
2005
- (n = o[r]) && (s = (i ? n(e, t, s) : n(s)) || s);
2006
- return i && s && bs(e, t, s), s;
2003
+ var bs = Object.defineProperty, Ss = Object.getOwnPropertyDescriptor, vs = (o, e, t, r) => {
2004
+ for (var s = r > 1 ? void 0 : r ? Ss(e, t) : e, i = o.length - 1, n; i >= 0; i--)
2005
+ (n = o[i]) && (s = (r ? n(e, t, s) : n(s)) || s);
2006
+ return r && s && bs(e, t, s), s;
2007
2007
  };
2008
- let q = class {
2008
+ let Q = class {
2009
2009
  constructor() {
2010
- _(this, "workerPool", $e(void 0, !0));
2010
+ _(this, "workerPool", Ye(void 0, !0));
2011
2011
  _(this, "canvas");
2012
2012
  _(this, "worker");
2013
2013
  _(this, "thread");
@@ -2016,15 +2016,15 @@ let q = class {
2016
2016
  this.worker = o.worker, this.thread = o.thread;
2017
2017
  }
2018
2018
  };
2019
- q = vs([
2020
- V()
2021
- ], q);
2022
- var Cs = Object.defineProperty, Ms = Object.getOwnPropertyDescriptor, Is = (o, e, t, i) => {
2023
- for (var s = i > 1 ? void 0 : i ? Ms(e, t) : e, r = o.length - 1, n; r >= 0; r--)
2024
- (n = o[r]) && (s = (i ? n(e, t, s) : n(s)) || s);
2025
- return i && s && Cs(e, t, s), s;
2026
- }, Os = (o, e) => (t, i) => e(t, i, o);
2027
- let me = class extends qe {
2019
+ Q = vs([
2020
+ z()
2021
+ ], Q);
2022
+ var Cs = Object.defineProperty, Ms = Object.getOwnPropertyDescriptor, Is = (o, e, t, r) => {
2023
+ for (var s = r > 1 ? void 0 : r ? Ms(e, t) : e, i = o.length - 1, n; i >= 0; i--)
2024
+ (n = o[i]) && (s = (r ? n(e, t, s) : n(s)) || s);
2025
+ return r && s && Cs(e, t, s), s;
2026
+ }, Os = (o, e) => (t, r) => e(t, r, o);
2027
+ let ge = class extends Qe {
2028
2028
  constructor(e) {
2029
2029
  super();
2030
2030
  _(this, "canvas");
@@ -2032,18 +2032,18 @@ let me = class extends qe {
2032
2032
  }
2033
2033
  init(e) {
2034
2034
  this.canvas = e;
2035
- for (const t of Ce) {
2036
- const i = t.startsWith("mouse") || t.startsWith("pointer") || t.startsWith("touch") ? this.mouseEventHandler : t.startsWith("key") ? this.keyEventHandler : t === "resize" ? this.uiEventHandler : t === "wheel" ? this.wheelEventHandler : this.preventDefaultHandler;
2037
- this[`${t}$`] = Ye(
2035
+ for (const t of Me) {
2036
+ const r = t.startsWith("mouse") || t.startsWith("pointer") || t.startsWith("touch") ? this.mouseEventHandler : t.startsWith("key") ? this.keyEventHandler : t === "resize" ? this.uiEventHandler : t === "wheel" ? this.wheelEventHandler : this.preventDefaultHandler;
2037
+ this[`${t}$`] = Je(
2038
2038
  t === "resize" ? window : e,
2039
2039
  t
2040
2040
  ).pipe(
2041
2041
  // @ts-ignore
2042
- ce(i.bind(this)),
2043
- Me((s) => !(t === "keydown" && !s))
2042
+ $(r.bind(this)),
2043
+ Ie((s) => !(t === "keydown" && !s))
2044
2044
  ), this[`${t}$`].subscribe((s) => {
2045
- var r, n;
2046
- (n = (r = this._service.thread) == null ? void 0 : r[t]) == null || n.call(r, s);
2045
+ var i, n;
2046
+ (n = (i = this._service.thread) == null ? void 0 : i[t]) == null || n.call(i, s);
2047
2047
  });
2048
2048
  }
2049
2049
  }
@@ -2072,7 +2072,7 @@ let me = class extends qe {
2072
2072
  mouseEventHandler(e) {
2073
2073
  return {
2074
2074
  ...this.getScreenSizes(),
2075
- ...ee(e, [
2075
+ ...j(e, [
2076
2076
  "ctrlKey",
2077
2077
  "metaKey",
2078
2078
  "shiftKey",
@@ -2086,40 +2086,40 @@ let me = class extends qe {
2086
2086
  };
2087
2087
  }
2088
2088
  touchEventHandler(e) {
2089
- const t = [], i = { type: e.type, touches: t };
2089
+ const t = [], r = { type: e.type, touches: t };
2090
2090
  for (let s = 0; s < e.touches.length; ++s) {
2091
- const r = e.touches[s];
2091
+ const i = e.touches[s];
2092
2092
  t.push({
2093
- pageX: (r == null ? void 0 : r.pageX) ?? 0,
2094
- pageY: (r == null ? void 0 : r.pageY) ?? 0
2093
+ pageX: (i == null ? void 0 : i.pageX) ?? 0,
2094
+ pageY: (i == null ? void 0 : i.pageY) ?? 0
2095
2095
  });
2096
2096
  }
2097
- return { ...this.getScreenSizes(), ...i };
2097
+ return { ...this.getScreenSizes(), ...r };
2098
2098
  }
2099
2099
  wheelEventHandler(e) {
2100
2100
  return e.preventDefault(), {
2101
2101
  ...this.getScreenSizes(),
2102
- ...ee(e, ["deltaX", "deltaY"])
2102
+ ...j(e, ["deltaX", "deltaY"])
2103
2103
  };
2104
2104
  }
2105
2105
  keyEventHandler(e) {
2106
- if (Qe.includes(e.code))
2106
+ if (Ze.includes(e.code))
2107
2107
  return e.preventDefault(), {
2108
2108
  ...this.getScreenSizes(),
2109
- ...ee(e, ["ctrlKey", "metaKey", "shiftKey", "keyCode"])
2109
+ ...j(e, ["ctrlKey", "metaKey", "shiftKey", "keyCode"])
2110
2110
  };
2111
2111
  }
2112
2112
  };
2113
- me = Is([
2114
- V(),
2115
- Os(0, L(q))
2116
- ], me);
2117
- var Ns = Object.defineProperty, Ps = Object.getOwnPropertyDescriptor, Ds = (o, e, t, i) => {
2118
- for (var s = i > 1 ? void 0 : i ? Ps(e, t) : e, r = o.length - 1, n; r >= 0; r--)
2119
- (n = o[r]) && (s = (i ? n(e, t, s) : n(s)) || s);
2120
- return i && s && Ns(e, t, s), s;
2113
+ ge = Is([
2114
+ z(),
2115
+ Os(0, L(Q))
2116
+ ], ge);
2117
+ var Ns = Object.defineProperty, Ps = Object.getOwnPropertyDescriptor, Ds = (o, e, t, r) => {
2118
+ for (var s = r > 1 ? void 0 : r ? Ps(e, t) : e, i = o.length - 1, n; i >= 0; i--)
2119
+ (n = o[i]) && (s = (r ? n(e, t, s) : n(s)) || s);
2120
+ return r && s && Ns(e, t, s), s;
2121
2121
  };
2122
- let Y = class {
2122
+ let J = class {
2123
2123
  constructor() {
2124
2124
  _(this, "loadingManager", new Bt());
2125
2125
  _(this, "loaders", {});
@@ -2134,39 +2134,15 @@ let Y = class {
2134
2134
  load: (o, e) => {
2135
2135
  const t = document.createElement("video");
2136
2136
  t.muted = !0, t.loop = !0, t.crossOrigin = "anonymous", t.controls = !1, t.playsInline = !0, t.src = o, t.autoplay = !0;
2137
- async function i(r) {
2138
- const n = new OffscreenCanvas(
2139
- r.videoWidth,
2140
- r.videoHeight
2141
- ), c = n.getContext("2d"), a = 30, l = [];
2142
- return console.log("Extracting frames from video"), new Promise((d) => {
2143
- for (r.currentTime = 0; r.currentTime < r.duration; ) {
2144
- c == null || c.drawImage(
2145
- r,
2146
- 0,
2147
- 0,
2148
- n.width,
2149
- n.height
2150
- );
2151
- const u = n.transferToImageBitmap();
2152
- l.push(u), r.currentTime < r.duration && (r.currentTime += 1 / a);
2153
- }
2154
- d(l), r.onerror = (u) => {
2155
- console.error("Error while extracting frames:", u);
2156
- }, r.currentTime = 0;
2157
- });
2158
- }
2159
- const s = async () => {
2160
- if (!t) return;
2161
- const r = await i(t);
2162
- console.log("Video loaded", r), e(r), t.removeEventListener("loadeddata", s);
2137
+ const r = async () => {
2138
+ e(t), t.removeEventListener("canplaythrough", r);
2163
2139
  };
2164
- t.addEventListener("loadeddata", s);
2140
+ t.addEventListener("canplaythrough", r);
2165
2141
  }
2166
2142
  };
2167
2143
  }
2168
2144
  _initLoaders() {
2169
- this.loaders.dracoLoader = new Kt(this.loadingManager), this.loaders.audioLoader = new jt(this.loadingManager), this.loaders.gltfLoader = new zt(this.loadingManager), this.loaders.imageLoader = new Ue(this.loadingManager), this.loaders.videoLoader = this.videoLoader;
2145
+ this.loaders.dracoLoader = new Kt(this.loadingManager), this.loaders.audioLoader = new jt(this.loadingManager), this.loaders.gltfLoader = new zt(this.loadingManager), this.loaders.imageLoader = new Be(this.loadingManager), this.loaders.videoLoader = this.videoLoader;
2170
2146
  }
2171
2147
  _initSources(o) {
2172
2148
  this.sources = o, this.toLoadCount = this.sources.length, this.loadedCount = 0;
@@ -2184,12 +2160,12 @@ let Y = class {
2184
2160
  source: o,
2185
2161
  resource: e,
2186
2162
  toLoadCount: t,
2187
- loadedCount: i
2163
+ loadedCount: r
2188
2164
  }) {
2189
- e && (this.loadedResources[o.name] = e, this.loadedCount = i, this.toLoadCount = t);
2165
+ e && (this.loadedResources[o.name] = e, this.loadedCount = r, this.toLoadCount = t);
2190
2166
  }
2191
2167
  load(o) {
2192
- var t, i, s, r;
2168
+ var t, r, s, i;
2193
2169
  const e = this.sources[0];
2194
2170
  if (e) {
2195
2171
  o == null || o(e);
@@ -2198,82 +2174,135 @@ let Y = class {
2198
2174
  return;
2199
2175
  n.type === "gltf" && ((t = this.loaders.gltfLoader) == null || t.load(
2200
2176
  n.path,
2201
- (c) => o == null ? void 0 : o(n, c)
2202
- )), n.type === "audio" && ((i = this.loaders.audioLoader) == null || i.load(n.path, (c) => {
2203
- o == null || o(n, c);
2204
- })), n.type === "image" && ((s = this.loaders.imageLoader) == null || s.load(n.path, (c) => {
2205
- o == null || o(n, c);
2206
- })), n.type === "video" && ((r = this.loaders.videoLoader) == null || r.load(
2177
+ (a) => o == null ? void 0 : o(n, a)
2178
+ )), n.type === "audio" && ((r = this.loaders.audioLoader) == null || r.load(n.path, (a) => {
2179
+ o == null || o(n, a);
2180
+ })), n.type === "image" && ((s = this.loaders.imageLoader) == null || s.load(n.path, (a) => {
2181
+ o == null || o(n, a);
2182
+ })), n.type === "video" && ((i = this.loaders.videoLoader) == null || i.load(
2207
2183
  n.path,
2208
- (c) => o == null ? void 0 : o(n, c)
2184
+ (a) => o == null ? void 0 : o(n, a)
2209
2185
  ));
2210
2186
  }
2211
2187
  }
2212
2188
  }
2213
2189
  };
2214
- Y = Ds([
2215
- V()
2216
- ], Y);
2217
- var ks = Object.defineProperty, Fs = Object.getOwnPropertyDescriptor, Hs = (o, e, t, i) => {
2218
- for (var s = i > 1 ? void 0 : i ? Fs(e, t) : e, r = o.length - 1, n; r >= 0; r--)
2219
- (n = o[r]) && (s = (i ? n(e, t, s) : n(s)) || s);
2220
- return i && s && ks(e, t, s), s;
2221
- }, Us = (o, e) => (t, i) => e(t, i, o);
2222
- let Q = class {
2190
+ J = Ds([
2191
+ z()
2192
+ ], J);
2193
+ var ks = Object.defineProperty, Fs = Object.getOwnPropertyDescriptor, Hs = (o, e, t, r) => {
2194
+ for (var s = r > 1 ? void 0 : r ? Fs(e, t) : e, i = o.length - 1, n; i >= 0; i--)
2195
+ (n = o[i]) && (s = (r ? n(e, t, s) : n(s)) || s);
2196
+ return r && s && ks(e, t, s), s;
2197
+ }, Us = (o, e) => (t, r) => e(t, r, o);
2198
+ let Z = class {
2223
2199
  constructor(o) {
2224
- _(this, "load$$", new Je());
2200
+ _(this, "load$$", new et());
2225
2201
  _(this, "load$", this.load$$.pipe(
2226
- ce((o) => ({
2202
+ $((o) => ({
2227
2203
  ...o,
2228
2204
  loadedCount: o.resource ? this._service.loadedCount + 1 : this._service.loadedCount,
2229
2205
  toLoadCount: this._service.toLoadCount
2230
2206
  })),
2231
- Ze()
2207
+ se()
2232
2208
  ));
2233
2209
  _(this, "serializedLoad$", this.load$.pipe(
2234
- ce((o) => {
2235
- var t, i;
2210
+ $((o) => {
2211
+ var t, r, s;
2236
2212
  let e = o.resource;
2237
2213
  if ((t = o == null ? void 0 : o.resource) != null && t.parser) {
2238
- const s = o.resource, r = s.scenes.map(
2239
- (n) => Te(n)
2214
+ const i = o.resource, n = i.scenes.map(
2215
+ (a) => _e(a)
2240
2216
  );
2241
2217
  e = {
2242
2218
  animations: (o == null ? void 0 : o.resource).animations.map(
2243
2219
  // @ts-ignore <<toJSON methods doesn't require a parameter>>
2244
- (n) => n.toJSON()
2220
+ (a) => a.toJSON()
2245
2221
  ),
2246
- cameras: s.cameras.map(
2247
- (n) => Te(n)
2222
+ cameras: i.cameras.map(
2223
+ (a) => _e(a)
2248
2224
  ),
2249
- parser: { json: s.parser.json },
2250
- scene: r == null ? void 0 : r[0],
2251
- scenes: r,
2252
- userData: s.userData
2225
+ parser: { json: i.parser.json },
2226
+ scene: n == null ? void 0 : n[0],
2227
+ scenes: n,
2228
+ userData: i.userData
2253
2229
  };
2254
2230
  }
2255
- return ((i = o == null ? void 0 : o.source) == null ? void 0 : i.type) === "video" && Array.isArray(o.resource) && console.log("Serialized Texture ===>", o.resource), {
2231
+ return ((r = o == null ? void 0 : o.source) == null ? void 0 : r.type) === "audio" && o.resource instanceof AudioBuffer && (e = {
2232
+ arrayBuffer: o.resource.getChannelData(0),
2233
+ length: o.resource.length,
2234
+ sampleRate: o.resource.sampleRate,
2235
+ duration: o.resource.duration
2236
+ }), ((s = o == null ? void 0 : o.source) == null ? void 0 : s.type) === "video" && o.resource instanceof HTMLVideoElement && (e = {
2237
+ ...j(o.resource, [
2238
+ "autoplay",
2239
+ "baseURI",
2240
+ "controls",
2241
+ "crossOrigin",
2242
+ "currentTime",
2243
+ "defaultMuted",
2244
+ "disablePictureInPicture",
2245
+ "draggable",
2246
+ "duration",
2247
+ "ended",
2248
+ "height",
2249
+ "hidden",
2250
+ "loop",
2251
+ "muted",
2252
+ "nodeName",
2253
+ "nodeType",
2254
+ "paused",
2255
+ "playbackRate",
2256
+ "playsInline",
2257
+ "poster",
2258
+ "preload",
2259
+ "readyState",
2260
+ "seeking",
2261
+ "spellcheck",
2262
+ "src",
2263
+ "tabIndex",
2264
+ "translate",
2265
+ "videoHeight",
2266
+ "videoWidth",
2267
+ "volume",
2268
+ "width"
2269
+ ]),
2270
+ buffered: o.resource.buffered.length,
2271
+ error: o.resource.error ? Oe(o.resource.error, []) : {},
2272
+ played: o.resource.played.length,
2273
+ seekable: o.resource.seekable.length,
2274
+ textTracks: o.resource.textTracks.length
2275
+ }), {
2256
2276
  ...o,
2257
2277
  resource: e
2258
2278
  };
2259
- })
2279
+ }),
2280
+ se()
2260
2281
  ));
2261
2282
  _(this, "loadCompleted$", this.load$.pipe(
2262
- Me((o) => o.toLoadCount === o.loadedCount)
2283
+ Ie((o) => o.toLoadCount === o.loadedCount),
2284
+ $(
2285
+ () => j(this._service, [
2286
+ "loadedCount",
2287
+ "loadedResources",
2288
+ "toLoadCount"
2289
+ ])
2290
+ ),
2291
+ se()
2263
2292
  ));
2264
2293
  this._service = o;
2265
2294
  }
2266
2295
  };
2267
- Q = Hs([
2268
- V(),
2269
- Us(0, L(Y))
2270
- ], Q);
2271
- var Gs = Object.defineProperty, Bs = Object.getOwnPropertyDescriptor, js = (o, e, t, i) => {
2272
- for (var s = i > 1 ? void 0 : i ? Bs(e, t) : e, r = o.length - 1, n; r >= 0; r--)
2273
- (n = o[r]) && (s = (i ? n(e, t, s) : n(s)) || s);
2274
- return i && s && Gs(e, t, s), s;
2275
- }, ae = (o, e) => (t, i) => e(t, i, o);
2276
- let J = class {
2296
+ Z = Hs([
2297
+ z(),
2298
+ Us(0, L(J))
2299
+ ], Z);
2300
+ var Gs = Object.defineProperty, Bs = Object.getOwnPropertyDescriptor, js = (o, e, t, r) => {
2301
+ for (var s = r > 1 ? void 0 : r ? Bs(e, t) : e, i = o.length - 1, n; i >= 0; i--)
2302
+ (n = o[i]) && (s = (r ? n(e, t, s) : n(s)) || s);
2303
+ return r && s && Gs(e, t, s), s;
2304
+ }, le = (o, e) => (t, r) => e(t, r, o);
2305
+ let ee = class {
2277
2306
  constructor(o, e, t) {
2278
2307
  _(this, "_subscriptions", []);
2279
2308
  this._controller = o, this._service = e, this._props = t, this._subscriptions.push(
@@ -2322,23 +2351,23 @@ let J = class {
2322
2351
  this._controller.load$$.complete();
2323
2352
  }
2324
2353
  };
2325
- J = js([
2326
- V(),
2327
- ae(0, L(Q)),
2328
- ae(1, L(Y)),
2329
- ae(2, L(Ae))
2330
- ], J);
2331
- Ie.resolve(J);
2332
- var Ks = Object.defineProperty, Vs = Object.getOwnPropertyDescriptor, zs = (o, e, t, i) => {
2333
- for (var s = i > 1 ? void 0 : i ? Vs(e, t) : e, r = o.length - 1, n; r >= 0; r--)
2334
- (n = o[r]) && (s = (i ? n(e, t, s) : n(s)) || s);
2335
- return i && s && Ks(e, t, s), s;
2336
- }, k = (o, e) => (t, i) => e(t, i, o);
2337
- let ge = class extends st {
2338
- constructor(e, t, i, s, r, n) {
2354
+ ee = js([
2355
+ z(),
2356
+ le(0, L(Z)),
2357
+ le(1, L(J)),
2358
+ le(2, L(Te))
2359
+ ], ee);
2360
+ Ne.resolve(ee);
2361
+ var Ks = Object.defineProperty, Vs = Object.getOwnPropertyDescriptor, zs = (o, e, t, r) => {
2362
+ for (var s = r > 1 ? void 0 : r ? Vs(e, t) : e, i = o.length - 1, n; i >= 0; i--)
2363
+ (n = o[i]) && (s = (r ? n(e, t, s) : n(s)) || s);
2364
+ return r && s && Ks(e, t, s), s;
2365
+ }, k = (o, e) => (t, r) => e(t, r, o);
2366
+ let Ae = class extends nt {
2367
+ constructor(e, t, r, s, i, n) {
2339
2368
  super();
2340
2369
  _(this, "initialized", !1);
2341
- this._service = e, this._controller = t, this._loaderController = i, this.props = s, this.loader = r, this.container = n, this.props.initOnConstruct && this.init();
2370
+ this._service = e, this._controller = t, this._loaderController = r, this.props = s, this.loader = i, this.container = n, this.props.initOnConstruct && this.init();
2342
2371
  }
2343
2372
  async _initCanvas() {
2344
2373
  try {
@@ -2364,7 +2393,7 @@ ${e instanceof Error ? e.message : "Something went wrong"}`
2364
2393
  var e, t;
2365
2394
  if (!this._service.canvas)
2366
2395
  throw new Error("Canvas element is not initialized.");
2367
- this._controller.init(this._service.canvas), !(!this._service.thread || !this._service.worker) && ((t = (e = this._service.thread) == null ? void 0 : e.resize) == null || t.call(e, {
2396
+ this._controller.init(this._service.canvas), !(!this._service.thread || !this._service.worker) && this.props.fullScreen && ((t = (e = this._service.thread) == null ? void 0 : e.resize) == null || t.call(e, {
2368
2397
  ...this._controller.uiEventHandler({ type: "resize" })
2369
2398
  }));
2370
2399
  }
@@ -2373,11 +2402,11 @@ ${e instanceof Error ? e.message : "Something went wrong"}`
2373
2402
  throw new Error("Canvas element is not initialized.");
2374
2403
  const e = this._service.canvas.transferControlToOffscreen();
2375
2404
  e.width = this._service.canvas.clientWidth, e.height = this._service.canvas.clientHeight;
2376
- const [t, i] = await this._service.workerPool.run({
2405
+ const [t, r] = await this._service.workerPool.run({
2377
2406
  payload: {
2378
2407
  path: this.props.location,
2379
2408
  subject: {
2380
- ...nt(this.props, [
2409
+ ...Oe(this.props, [
2381
2410
  "canvas",
2382
2411
  "location",
2383
2412
  "onReady",
@@ -2388,12 +2417,12 @@ ${e instanceof Error ? e.message : "Something went wrong"}`
2388
2417
  transferSubject: [e]
2389
2418
  }
2390
2419
  });
2391
- if (!t || i)
2420
+ if (!t || r)
2392
2421
  throw new Error("Unable to retrieve the worker-thread info.");
2393
2422
  this._service.worker = t.worker, this._service.thread = t.thread;
2394
2423
  }
2395
2424
  async _initObservableProxyEvents() {
2396
- Ce.forEach(
2425
+ Me.forEach(
2397
2426
  (e) => this[`${e}$`] = () => {
2398
2427
  var t;
2399
2428
  return (t = this._controller) == null ? void 0 : t[`${e}$`];
@@ -2401,15 +2430,17 @@ ${e instanceof Error ? e.message : "Something went wrong"}`
2401
2430
  );
2402
2431
  }
2403
2432
  async _initLoader() {
2404
- this.loader.init(this.props.loaderDataSources), this._loaderController.serializedLoad$.subscribe(
2405
- (e) => {
2406
- var t;
2407
- return (t = this._service.worker) == null ? void 0 : t.postMessage({
2408
- token: rt,
2409
- payload: e
2410
- });
2411
- }
2412
- );
2433
+ this.loader.init(this.props.loaderDataSources), this._loaderController.serializedLoad$.subscribe((e) => {
2434
+ var t, r;
2435
+ if (e.resource instanceof ArrayBuffer)
2436
+ return (t = this._service.worker) == null ? void 0 : t.postMessage(e.resource, [
2437
+ e.resource
2438
+ ]);
2439
+ (r = this._service.worker) == null || r.postMessage({
2440
+ token: rt,
2441
+ payload: e
2442
+ });
2443
+ });
2413
2444
  }
2414
2445
  isInitialized() {
2415
2446
  return this.initialized;
@@ -2435,23 +2466,23 @@ ${e instanceof Error ? e.message : "Something went wrong"}`
2435
2466
  await this._service.workerPool.terminateAll(), ((e = this._service.canvas) == null ? void 0 : e.dataset.reactive) === "true" && (this._service.canvas.remove(), this._service.canvas = void 0), this.initialized = !1;
2436
2467
  }
2437
2468
  };
2438
- ge = zs([
2439
- et(tt.ContainerScoped),
2440
- k(0, L(q)),
2441
- k(1, L(me)),
2442
- k(2, L(Q)),
2443
- k(3, L(Ae)),
2444
- k(4, L(J)),
2445
- k(5, L(Oe))
2446
- ], ge);
2469
+ Ae = zs([
2470
+ tt(st.ContainerScoped),
2471
+ k(0, L(Q)),
2472
+ k(1, L(ge)),
2473
+ k(2, L(Z)),
2474
+ k(3, L(Te)),
2475
+ k(4, L(ee)),
2476
+ k(5, L(Pe))
2477
+ ], Ae);
2447
2478
  const Ys = (o) => {
2448
2479
  if (typeof (o == null ? void 0 : o.location) != "string" && !((o == null ? void 0 : o.location) instanceof URL))
2449
2480
  throw new Error(
2450
2481
  "Invalid register props detected. location path is required"
2451
2482
  );
2452
- const e = Ie.createChildContainer();
2453
- o.initOnConstruct = z(o.initOnConstruct) || !X(o.initOnConstruct) ? !0 : o.initOnConstruct, o.defaultCamera = o != null && o.defaultCamera && o.defaultCamera in _e ? o.defaultCamera : _e.PERSPECTIVE, o.withMiniCamera = z(o.withMiniCamera) || !X(o.withMiniCamera) ? !1 : o.withMiniCamera, o.startTimer = z(o.startTimer) || !X(o.startTimer) ? !0 : o.startTimer, o.fullScreen = z(o.fullScreen) || !X(o.fullScreen) ? !0 : o.fullScreen, o.onReady = it(o.onReady) ? o.onReady : void 0, e.register(Oe, { useValue: e }), e.register(Ae, { useValue: o });
2454
- const t = e.resolve(ge);
2483
+ const e = Ne.createChildContainer();
2484
+ o.initOnConstruct = X(o.initOnConstruct) || !W(o.initOnConstruct) ? !0 : o.initOnConstruct, o.defaultCamera = o != null && o.defaultCamera && o.defaultCamera in Re ? o.defaultCamera : Re.PERSPECTIVE, o.withMiniCamera = X(o.withMiniCamera) || !W(o.withMiniCamera) ? !1 : o.withMiniCamera, o.startTimer = X(o.startTimer) || !W(o.startTimer) ? !0 : o.startTimer, o.fullScreen = X(o.fullScreen) || !W(o.fullScreen) ? !0 : o.fullScreen, o.onReady = it(o.onReady) ? o.onReady : void 0, e.register(Pe, { useValue: e }), e.register(Te, { useValue: o });
2485
+ const t = e.resolve(Ae);
2455
2486
  return t.initialized = !0, {
2456
2487
  container: e,
2457
2488
  module: t
@@ -2460,17 +2491,17 @@ const Ys = (o) => {
2460
2491
  export {
2461
2492
  Zs as AppModule,
2462
2493
  en as AppProxyEventHandlersBlueprint,
2463
- Oe as CONTAINER_TOKEN,
2464
- _e as DefaultCameraType,
2465
- Qe as KEYBOARD_EVENT_CODES,
2494
+ Pe as CONTAINER_TOKEN,
2495
+ Re as DefaultCameraType,
2496
+ Ze as KEYBOARD_EVENT_CODES,
2466
2497
  rt as LOADER_SERIALIZED_LOAD_TOKEN,
2467
2498
  qs as LaunchAppProps,
2468
- Ce as PROXY_EVENT_LISTENERS,
2469
- qe as ProxyEventHandlersBlueprint,
2499
+ Me as PROXY_EVENT_LISTENERS,
2500
+ Qe as ProxyEventHandlersBlueprint,
2470
2501
  tn as ProxyEventObservablesBlueprint,
2471
2502
  sn as ProxyEventSubjectsBlueprint,
2472
- ge as RegisterModule,
2473
- Ae as RegisterPropsBlueprint,
2474
- st as RegisterProxyEventHandlersBlueprint,
2503
+ Ae as RegisterModule,
2504
+ Te as RegisterPropsBlueprint,
2505
+ nt as RegisterProxyEventHandlersBlueprint,
2475
2506
  Ys as register
2476
2507
  };