@quick-threejs/reactive 0.1.29 → 0.1.30

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