@kolkrabbi/design-editor 0.24.0 → 0.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/README.md +2 -2
  2. package/dist/BindDot-CMUtpJPX.js +84 -0
  3. package/dist/BufferGeometryUtils-Cc8LNd5v.js +150 -0
  4. package/dist/ColorModesWindow-CWhL6nfm.js +1493 -0
  5. package/dist/GLTFLoader-BFir8PCc.js +1361 -0
  6. package/dist/OBJLoader-BgqC_-Jn.js +287 -0
  7. package/dist/{OrbitControls-Cql8Rn2i.js → OrbitControls-DVpLgmKv.js} +2755 -2202
  8. package/dist/STLLoader-C6DGLf6r.js +83 -0
  9. package/dist/Timeline-BObvcdXF.js +3014 -0
  10. package/dist/TreePicker-nMf17QGH.js +68 -0
  11. package/dist/core-EWu8GfXL.js +17504 -0
  12. package/dist/core.js +5 -3
  13. package/dist/design-editor.css +1 -1
  14. package/dist/design-editor.js +2114 -916
  15. package/dist/effects-DZEmfY7a.js +444 -0
  16. package/dist/effects.js +1 -1
  17. package/dist/generators-D1tFSZgG.js +2961 -0
  18. package/dist/generators.js +1 -1
  19. package/dist/{host-qtFVROOD.js → host-CRsCCafL.js} +429 -370
  20. package/dist/{host-be1CWhN1.js → host-ZLJKCZ54.js} +137 -136
  21. package/dist/motion-C_u7tsis.js +2295 -0
  22. package/dist/motion.js +1 -1
  23. package/dist/previewScale-BMkeLc6w.js +26 -0
  24. package/dist/{rolls-Bg1XHuvJ.js → rolls-BGtqxVYq.js} +2621 -1522
  25. package/dist/{src-B5fQgAVE.js → src-BpTckTDZ.js} +1 -1
  26. package/dist/{useLayerEdit-ieOjHx6x.js → useLayerEdit-BFcZhiNX.js} +20992 -12580
  27. package/package.json +9 -7
  28. package/dist/RuleRow-DIbuUt37.js +0 -650
  29. package/dist/TreePicker-DLmMl0aU.js +0 -68
  30. package/dist/core-CNI8b_83.js +0 -12314
  31. package/dist/effectCategories-0PnGZvjd.js +0 -4210
  32. package/dist/effects-BujxwoNY.js +0 -469
  33. package/dist/generators-SpRHQDMq.js +0 -2517
  34. package/dist/labels-B5qkocWy.js +0 -2007
  35. package/dist/motion-Bn3FVkCS.js +0 -2260
@@ -0,0 +1,1361 @@
1
+ import { $ as e, At as t, B as n, Ct as r, D as i, F as a, Ft as o, G as s, H as c, Ht as l, I as u, It as d, J as f, K as p, L as m, M as h, Mt as g, Ot as _, Q as v, R as ee, S as te, St as ne, Tt as y, U as re, V as ie, Vt as b, W as ae, Wt as x, X as S, Y as oe, Z as C, _ as se, at as w, bt as ce, ct as le, dt as ue, et as de, f as T, ft as fe, gt as pe, ht as me, j as he, kt as ge, l as _e, lt as ve, ot as E, p as ye, pt as D, q as be, s as xe, tt as O, u as Se, ut as Ce, v as k, vt as we, w as A, wt as Te, xt as Ee, y as j, yt as De, z as Oe } from "./OrbitControls-DVpLgmKv.js";
2
+ import { r as M } from "./BufferGeometryUtils-Cc8LNd5v.js";
3
+ //#region ../../node_modules/.pnpm/three@0.185.1/node_modules/three/examples/jsm/utils/SkeletonUtils.js
4
+ function ke(e) {
5
+ let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), r = e.clone();
6
+ return N(e, r, function(e, r) {
7
+ t.set(r, e), n.set(e, r);
8
+ }), r.traverse(function(e) {
9
+ if (!e.isSkinnedMesh) return;
10
+ let r = e, i = t.get(e), a = i.skeleton.bones;
11
+ r.skeleton = i.skeleton.clone(), r.bindMatrix.copy(i.bindMatrix), r.skeleton.bones = a.map(function(e) {
12
+ return n.get(e);
13
+ }), r.bind(r.skeleton, r.bindMatrix);
14
+ }), r;
15
+ }
16
+ function N(e, t, n) {
17
+ n(e, t);
18
+ for (let r = 0; r < e.children.length; r++) N(e.children[r], t.children[r], n);
19
+ }
20
+ //#endregion
21
+ //#region ../../node_modules/.pnpm/three@0.185.1/node_modules/three/examples/jsm/loaders/GLTFLoader.js
22
+ var Ae = class extends oe {
23
+ constructor(e) {
24
+ super(e), this.dracoLoader = null, this.ktx2Loader = null, this.meshoptDecoder = null, this.pluginCallbacks = [], this.register(function(e) {
25
+ return new Fe(e);
26
+ }), this.register(function(e) {
27
+ return new Ie(e);
28
+ }), this.register(function(e) {
29
+ return new Ge(e);
30
+ }), this.register(function(e) {
31
+ return new Ke(e);
32
+ }), this.register(function(e) {
33
+ return new qe(e);
34
+ }), this.register(function(e) {
35
+ return new Re(e);
36
+ }), this.register(function(e) {
37
+ return new ze(e);
38
+ }), this.register(function(e) {
39
+ return new Be(e);
40
+ }), this.register(function(e) {
41
+ return new Ve(e);
42
+ }), this.register(function(e) {
43
+ return new Pe(e);
44
+ }), this.register(function(e) {
45
+ return new He(e);
46
+ }), this.register(function(e) {
47
+ return new Le(e);
48
+ }), this.register(function(e) {
49
+ return new We(e);
50
+ }), this.register(function(e) {
51
+ return new Ue(e);
52
+ }), this.register(function(e) {
53
+ return new Me(e);
54
+ }), this.register(function(e) {
55
+ return new I(e, F.EXT_MESHOPT_COMPRESSION);
56
+ }), this.register(function(e) {
57
+ return new I(e, F.KHR_MESHOPT_COMPRESSION);
58
+ }), this.register(function(e) {
59
+ return new Je(e);
60
+ });
61
+ }
62
+ load(e, t, n, r) {
63
+ let i = this, a;
64
+ if (this.resourcePath !== "") a = this.resourcePath;
65
+ else if (this.path !== "") {
66
+ let t = S.extractUrlBase(e);
67
+ a = S.resolveURL(t, this.path);
68
+ } else a = S.extractUrlBase(e);
69
+ this.manager.itemStart(e);
70
+ let o = function(t) {
71
+ r ? r(t) : console.error(t), i.manager.itemError(e), i.manager.itemEnd(e);
72
+ }, s = new A(this.manager);
73
+ s.setPath(this.path), s.setResponseType("arraybuffer"), s.setRequestHeader(this.requestHeader), s.setWithCredentials(this.withCredentials), s.load(e, function(n) {
74
+ try {
75
+ i.parse(n, a, function(n) {
76
+ t(n), i.manager.itemEnd(e);
77
+ }, o);
78
+ } catch (e) {
79
+ o(e);
80
+ }
81
+ }, n, o);
82
+ }
83
+ setDRACOLoader(e) {
84
+ return this.dracoLoader = e, this;
85
+ }
86
+ setKTX2Loader(e) {
87
+ return this.ktx2Loader = e, this;
88
+ }
89
+ setMeshoptDecoder(e) {
90
+ return this.meshoptDecoder = e, this;
91
+ }
92
+ register(e) {
93
+ return this.pluginCallbacks.indexOf(e) === -1 && this.pluginCallbacks.push(e), this;
94
+ }
95
+ unregister(e) {
96
+ return this.pluginCallbacks.indexOf(e) !== -1 && this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e), 1), this;
97
+ }
98
+ parse(e, t, n, r) {
99
+ let i, a = {}, o = {}, s = new TextDecoder();
100
+ if (typeof e == "string") i = JSON.parse(e);
101
+ else if (e instanceof ArrayBuffer) if (s.decode(new Uint8Array(e, 0, 4)) === L) {
102
+ try {
103
+ a[F.KHR_BINARY_GLTF] = new Ye(e);
104
+ } catch (e) {
105
+ r && r(e);
106
+ return;
107
+ }
108
+ i = JSON.parse(a[F.KHR_BINARY_GLTF].content);
109
+ } else i = JSON.parse(s.decode(e));
110
+ else i = e;
111
+ if (i.asset === void 0 || i.asset.version[0] < 2) {
112
+ r && r(/* @__PURE__ */ Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));
113
+ return;
114
+ }
115
+ let c = new ct(i, {
116
+ path: t || this.resourcePath || "",
117
+ crossOrigin: this.crossOrigin,
118
+ requestHeader: this.requestHeader,
119
+ manager: this.manager,
120
+ ktx2Loader: this.ktx2Loader,
121
+ meshoptDecoder: this.meshoptDecoder
122
+ });
123
+ c.fileLoader.setRequestHeader(this.requestHeader);
124
+ for (let e = 0; e < this.pluginCallbacks.length; e++) {
125
+ let t = this.pluginCallbacks[e](c);
126
+ t.name || console.error("THREE.GLTFLoader: Invalid plugin found: missing name"), o[t.name] = t, a[t.name] = !0;
127
+ }
128
+ if (i.extensionsUsed) for (let e = 0; e < i.extensionsUsed.length; ++e) {
129
+ let t = i.extensionsUsed[e], n = i.extensionsRequired || [];
130
+ switch (t) {
131
+ case F.KHR_MATERIALS_UNLIT:
132
+ a[t] = new Ne();
133
+ break;
134
+ case F.KHR_DRACO_MESH_COMPRESSION:
135
+ a[t] = new Xe(i, this.dracoLoader);
136
+ break;
137
+ case F.KHR_TEXTURE_TRANSFORM:
138
+ a[t] = new Ze();
139
+ break;
140
+ case F.KHR_MESH_QUANTIZATION:
141
+ a[t] = new Qe();
142
+ break;
143
+ default: n.indexOf(t) >= 0 && o[t] === void 0 && console.warn("THREE.GLTFLoader: Unknown extension \"" + t + "\".");
144
+ }
145
+ }
146
+ c.setExtensions(a), c.setPlugins(o), c.parse(n, r);
147
+ }
148
+ parseAsync(e, t) {
149
+ let n = this;
150
+ return new Promise(function(r, i) {
151
+ n.parse(e, t, r, i);
152
+ });
153
+ }
154
+ };
155
+ function je() {
156
+ let e = {};
157
+ return {
158
+ get: function(t) {
159
+ return e[t];
160
+ },
161
+ add: function(t, n) {
162
+ e[t] = n;
163
+ },
164
+ remove: function(t) {
165
+ delete e[t];
166
+ },
167
+ removeAll: function() {
168
+ e = {};
169
+ }
170
+ };
171
+ }
172
+ function P(e, t, n) {
173
+ let r = e.json.materials[t];
174
+ return r.extensions && r.extensions[n] ? r.extensions[n] : null;
175
+ }
176
+ var F = {
177
+ KHR_BINARY_GLTF: "KHR_binary_glTF",
178
+ KHR_DRACO_MESH_COMPRESSION: "KHR_draco_mesh_compression",
179
+ KHR_LIGHTS_PUNCTUAL: "KHR_lights_punctual",
180
+ KHR_MATERIALS_CLEARCOAT: "KHR_materials_clearcoat",
181
+ KHR_MATERIALS_DISPERSION: "KHR_materials_dispersion",
182
+ KHR_MATERIALS_IOR: "KHR_materials_ior",
183
+ KHR_MATERIALS_SHEEN: "KHR_materials_sheen",
184
+ KHR_MATERIALS_SPECULAR: "KHR_materials_specular",
185
+ KHR_MATERIALS_TRANSMISSION: "KHR_materials_transmission",
186
+ KHR_MATERIALS_IRIDESCENCE: "KHR_materials_iridescence",
187
+ KHR_MATERIALS_ANISOTROPY: "KHR_materials_anisotropy",
188
+ KHR_MATERIALS_UNLIT: "KHR_materials_unlit",
189
+ KHR_MATERIALS_VOLUME: "KHR_materials_volume",
190
+ KHR_TEXTURE_BASISU: "KHR_texture_basisu",
191
+ KHR_TEXTURE_TRANSFORM: "KHR_texture_transform",
192
+ KHR_MESH_QUANTIZATION: "KHR_mesh_quantization",
193
+ KHR_MATERIALS_EMISSIVE_STRENGTH: "KHR_materials_emissive_strength",
194
+ EXT_MATERIALS_BUMP: "EXT_materials_bump",
195
+ EXT_TEXTURE_WEBP: "EXT_texture_webp",
196
+ EXT_TEXTURE_AVIF: "EXT_texture_avif",
197
+ EXT_MESHOPT_COMPRESSION: "EXT_meshopt_compression",
198
+ KHR_MESHOPT_COMPRESSION: "KHR_meshopt_compression",
199
+ EXT_MESH_GPU_INSTANCING: "EXT_mesh_gpu_instancing"
200
+ }, Me = class {
201
+ constructor(e) {
202
+ this.parser = e, this.name = F.KHR_LIGHTS_PUNCTUAL, this.cache = {
203
+ refs: {},
204
+ uses: {}
205
+ };
206
+ }
207
+ _markDefs() {
208
+ let e = this.parser, t = this.parser.json.nodes || [];
209
+ for (let n = 0, r = t.length; n < r; n++) {
210
+ let r = t[n];
211
+ r.extensions && r.extensions[this.name] && r.extensions[this.name].light !== void 0 && e._addNodeRef(this.cache, r.extensions[this.name].light);
212
+ }
213
+ }
214
+ _loadLight(e) {
215
+ let t = this.parser, n = "light:" + e, r = t.cache.get(n);
216
+ if (r) return r;
217
+ let i = t.json, a = ((i.extensions && i.extensions[this.name] || {}).lights || [])[e], o, s = new k(16777215);
218
+ a.color !== void 0 && s.setRGB(a.color[0], a.color[1], a.color[2], f);
219
+ let c = a.range === void 0 ? 0 : a.range;
220
+ switch (a.type) {
221
+ case "directional":
222
+ o = new te(s), o.target.position.set(0, 0, -1), o.add(o.target);
223
+ break;
224
+ case "point":
225
+ o = new we(s), o.distance = c;
226
+ break;
227
+ case "spot":
228
+ o = new g(s), o.distance = c, a.spot = a.spot || {}, a.spot.innerConeAngle = a.spot.innerConeAngle === void 0 ? 0 : a.spot.innerConeAngle, a.spot.outerConeAngle = a.spot.outerConeAngle === void 0 ? Math.PI / 4 : a.spot.outerConeAngle, o.angle = a.spot.outerConeAngle, o.penumbra = 1 - a.spot.innerConeAngle / a.spot.outerConeAngle, o.target.position.set(0, 0, -1), o.add(o.target);
229
+ break;
230
+ default: throw Error("THREE.GLTFLoader: Unexpected light type: " + a.type);
231
+ }
232
+ return o.position.set(0, 0, 0), X(o, a), a.intensity !== void 0 && (o.intensity = a.intensity), o.name = t.createUniqueName(a.name || "light_" + e), r = Promise.resolve(o), t.cache.add(n, r), r;
233
+ }
234
+ getDependency(e, t) {
235
+ if (e === "light") return this._loadLight(t);
236
+ }
237
+ createNodeAttachment(e) {
238
+ let t = this, n = this.parser, r = n.json.nodes[e], i = (r.extensions && r.extensions[this.name] || {}).light;
239
+ return i === void 0 ? null : this._loadLight(i).then(function(e) {
240
+ return n._getNodeRef(t.cache, i, e);
241
+ });
242
+ }
243
+ }, Ne = class {
244
+ constructor() {
245
+ this.name = F.KHR_MATERIALS_UNLIT;
246
+ }
247
+ getMaterialType() {
248
+ return O;
249
+ }
250
+ extendParams(e, t, n) {
251
+ let r = [];
252
+ e.color = new k(1, 1, 1), e.opacity = 1;
253
+ let i = t.pbrMetallicRoughness;
254
+ if (i) {
255
+ if (Array.isArray(i.baseColorFactor)) {
256
+ let t = i.baseColorFactor;
257
+ e.color.setRGB(t[0], t[1], t[2], f), e.opacity = t[3];
258
+ }
259
+ i.baseColorTexture !== void 0 && r.push(n.assignTexture(e, "map", i.baseColorTexture, y));
260
+ }
261
+ return Promise.all(r);
262
+ }
263
+ }, Pe = class {
264
+ constructor(e) {
265
+ this.parser = e, this.name = F.KHR_MATERIALS_EMISSIVE_STRENGTH;
266
+ }
267
+ extendMaterialParams(e, t) {
268
+ let n = P(this.parser, e, this.name);
269
+ return n === null || n.emissiveStrength !== void 0 && (t.emissiveIntensity = n.emissiveStrength), Promise.resolve();
270
+ }
271
+ }, Fe = class {
272
+ constructor(e) {
273
+ this.parser = e, this.name = F.KHR_MATERIALS_CLEARCOAT;
274
+ }
275
+ getMaterialType(e) {
276
+ return P(this.parser, e, this.name) === null ? null : w;
277
+ }
278
+ extendMaterialParams(e, t) {
279
+ let n = P(this.parser, e, this.name);
280
+ if (n === null) return Promise.resolve();
281
+ let r = [];
282
+ if (n.clearcoatFactor !== void 0 && (t.clearcoat = n.clearcoatFactor), n.clearcoatTexture !== void 0 && r.push(this.parser.assignTexture(t, "clearcoatMap", n.clearcoatTexture)), n.clearcoatRoughnessFactor !== void 0 && (t.clearcoatRoughness = n.clearcoatRoughnessFactor), n.clearcoatRoughnessTexture !== void 0 && r.push(this.parser.assignTexture(t, "clearcoatRoughnessMap", n.clearcoatRoughnessTexture)), n.clearcoatNormalTexture !== void 0 && (r.push(this.parser.assignTexture(t, "clearcoatNormalMap", n.clearcoatNormalTexture)), n.clearcoatNormalTexture.scale !== void 0)) {
283
+ let e = n.clearcoatNormalTexture.scale;
284
+ t.clearcoatNormalScale = new b(e, e);
285
+ }
286
+ return Promise.all(r);
287
+ }
288
+ }, Ie = class {
289
+ constructor(e) {
290
+ this.parser = e, this.name = F.KHR_MATERIALS_DISPERSION;
291
+ }
292
+ getMaterialType(e) {
293
+ return P(this.parser, e, this.name) === null ? null : w;
294
+ }
295
+ extendMaterialParams(e, t) {
296
+ let n = P(this.parser, e, this.name);
297
+ return n === null || (t.dispersion = n.dispersion === void 0 ? 0 : n.dispersion), Promise.resolve();
298
+ }
299
+ }, Le = class {
300
+ constructor(e) {
301
+ this.parser = e, this.name = F.KHR_MATERIALS_IRIDESCENCE;
302
+ }
303
+ getMaterialType(e) {
304
+ return P(this.parser, e, this.name) === null ? null : w;
305
+ }
306
+ extendMaterialParams(e, t) {
307
+ let n = P(this.parser, e, this.name);
308
+ if (n === null) return Promise.resolve();
309
+ let r = [];
310
+ return n.iridescenceFactor !== void 0 && (t.iridescence = n.iridescenceFactor), n.iridescenceTexture !== void 0 && r.push(this.parser.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(this.parser.assignTexture(t, "iridescenceThicknessMap", n.iridescenceThicknessTexture)), Promise.all(r);
311
+ }
312
+ }, Re = class {
313
+ constructor(e) {
314
+ this.parser = e, this.name = F.KHR_MATERIALS_SHEEN;
315
+ }
316
+ getMaterialType(e) {
317
+ return P(this.parser, e, this.name) === null ? null : w;
318
+ }
319
+ extendMaterialParams(e, t) {
320
+ let n = P(this.parser, e, this.name);
321
+ if (n === null) return Promise.resolve();
322
+ let r = [];
323
+ if (t.sheenColor = new k(0, 0, 0), t.sheenRoughness = 0, t.sheen = 1, n.sheenColorFactor !== void 0) {
324
+ let e = n.sheenColorFactor;
325
+ t.sheenColor.setRGB(e[0], e[1], e[2], f);
326
+ }
327
+ return n.sheenRoughnessFactor !== void 0 && (t.sheenRoughness = n.sheenRoughnessFactor), n.sheenColorTexture !== void 0 && r.push(this.parser.assignTexture(t, "sheenColorMap", n.sheenColorTexture, y)), n.sheenRoughnessTexture !== void 0 && r.push(this.parser.assignTexture(t, "sheenRoughnessMap", n.sheenRoughnessTexture)), Promise.all(r);
328
+ }
329
+ }, ze = class {
330
+ constructor(e) {
331
+ this.parser = e, this.name = F.KHR_MATERIALS_TRANSMISSION;
332
+ }
333
+ getMaterialType(e) {
334
+ return P(this.parser, e, this.name) === null ? null : w;
335
+ }
336
+ extendMaterialParams(e, t) {
337
+ let n = P(this.parser, e, this.name);
338
+ if (n === null) return Promise.resolve();
339
+ let r = [];
340
+ return n.transmissionFactor !== void 0 && (t.transmission = n.transmissionFactor), n.transmissionTexture !== void 0 && r.push(this.parser.assignTexture(t, "transmissionMap", n.transmissionTexture)), Promise.all(r);
341
+ }
342
+ }, Be = class {
343
+ constructor(e) {
344
+ this.parser = e, this.name = F.KHR_MATERIALS_VOLUME;
345
+ }
346
+ getMaterialType(e) {
347
+ return P(this.parser, e, this.name) === null ? null : w;
348
+ }
349
+ extendMaterialParams(e, t) {
350
+ let n = P(this.parser, e, this.name);
351
+ if (n === null) return Promise.resolve();
352
+ let r = [];
353
+ t.thickness = n.thicknessFactor === void 0 ? 0 : n.thicknessFactor, n.thicknessTexture !== void 0 && r.push(this.parser.assignTexture(t, "thicknessMap", n.thicknessTexture)), t.attenuationDistance = n.attenuationDistance || Infinity;
354
+ let i = n.attenuationColor || [
355
+ 1,
356
+ 1,
357
+ 1
358
+ ];
359
+ return t.attenuationColor = new k().setRGB(i[0], i[1], i[2], f), Promise.all(r);
360
+ }
361
+ }, Ve = class {
362
+ constructor(e) {
363
+ this.parser = e, this.name = F.KHR_MATERIALS_IOR;
364
+ }
365
+ getMaterialType(e) {
366
+ return P(this.parser, e, this.name) === null ? null : w;
367
+ }
368
+ extendMaterialParams(e, t) {
369
+ let n = P(this.parser, e, this.name);
370
+ return n === null ? Promise.resolve() : (t.ior = n.ior === void 0 ? 1.5 : n.ior, t.ior === 0 && (t.ior = 1e3), Promise.resolve());
371
+ }
372
+ }, He = class {
373
+ constructor(e) {
374
+ this.parser = e, this.name = F.KHR_MATERIALS_SPECULAR;
375
+ }
376
+ getMaterialType(e) {
377
+ return P(this.parser, e, this.name) === null ? null : w;
378
+ }
379
+ extendMaterialParams(e, t) {
380
+ let n = P(this.parser, e, this.name);
381
+ if (n === null) return Promise.resolve();
382
+ let r = [];
383
+ t.specularIntensity = n.specularFactor === void 0 ? 1 : n.specularFactor, n.specularTexture !== void 0 && r.push(this.parser.assignTexture(t, "specularIntensityMap", n.specularTexture));
384
+ let i = n.specularColorFactor || [
385
+ 1,
386
+ 1,
387
+ 1
388
+ ];
389
+ return t.specularColor = new k().setRGB(i[0], i[1], i[2], f), n.specularColorTexture !== void 0 && r.push(this.parser.assignTexture(t, "specularColorMap", n.specularColorTexture, y)), Promise.all(r);
390
+ }
391
+ }, Ue = class {
392
+ constructor(e) {
393
+ this.parser = e, this.name = F.EXT_MATERIALS_BUMP;
394
+ }
395
+ getMaterialType(e) {
396
+ return P(this.parser, e, this.name) === null ? null : w;
397
+ }
398
+ extendMaterialParams(e, t) {
399
+ let n = P(this.parser, e, this.name);
400
+ if (n === null) return Promise.resolve();
401
+ let r = [];
402
+ return t.bumpScale = n.bumpFactor === void 0 ? 1 : n.bumpFactor, n.bumpTexture !== void 0 && r.push(this.parser.assignTexture(t, "bumpMap", n.bumpTexture)), Promise.all(r);
403
+ }
404
+ }, We = class {
405
+ constructor(e) {
406
+ this.parser = e, this.name = F.KHR_MATERIALS_ANISOTROPY;
407
+ }
408
+ getMaterialType(e) {
409
+ return P(this.parser, e, this.name) === null ? null : w;
410
+ }
411
+ extendMaterialParams(e, t) {
412
+ let n = P(this.parser, e, this.name);
413
+ if (n === null) return Promise.resolve();
414
+ let r = [];
415
+ return n.anisotropyStrength !== void 0 && (t.anisotropy = n.anisotropyStrength), n.anisotropyRotation !== void 0 && (t.anisotropyRotation = n.anisotropyRotation), n.anisotropyTexture !== void 0 && r.push(this.parser.assignTexture(t, "anisotropyMap", n.anisotropyTexture)), Promise.all(r);
416
+ }
417
+ }, Ge = class {
418
+ constructor(e) {
419
+ this.parser = e, this.name = F.KHR_TEXTURE_BASISU;
420
+ }
421
+ loadTexture(e) {
422
+ let t = this.parser, n = t.json, r = n.textures[e];
423
+ if (!r.extensions || !r.extensions[this.name]) return null;
424
+ let i = r.extensions[this.name], a = t.options.ktx2Loader;
425
+ if (!a) {
426
+ if (n.extensionsRequired && n.extensionsRequired.indexOf(this.name) >= 0) throw Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");
427
+ return null;
428
+ }
429
+ return t.loadTextureImage(e, i.source, a);
430
+ }
431
+ }, Ke = class {
432
+ constructor(e) {
433
+ this.parser = e, this.name = F.EXT_TEXTURE_WEBP;
434
+ }
435
+ loadTexture(e) {
436
+ let t = this.name, n = this.parser, r = n.json, i = r.textures[e];
437
+ if (!i.extensions || !i.extensions[t]) return null;
438
+ let a = i.extensions[t], o = r.images[a.source], s = n.textureLoader;
439
+ if (o.uri) {
440
+ let e = n.options.manager.getHandler(o.uri);
441
+ e !== null && (s = e);
442
+ }
443
+ return n.loadTextureImage(e, a.source, s);
444
+ }
445
+ }, qe = class {
446
+ constructor(e) {
447
+ this.parser = e, this.name = F.EXT_TEXTURE_AVIF;
448
+ }
449
+ loadTexture(e) {
450
+ let t = this.name, n = this.parser, r = n.json, i = r.textures[e];
451
+ if (!i.extensions || !i.extensions[t]) return null;
452
+ let a = i.extensions[t], o = r.images[a.source], s = n.textureLoader;
453
+ if (o.uri) {
454
+ let e = n.options.manager.getHandler(o.uri);
455
+ e !== null && (s = e);
456
+ }
457
+ return n.loadTextureImage(e, a.source, s);
458
+ }
459
+ }, I = class {
460
+ constructor(e, t) {
461
+ this.name = t, this.parser = e;
462
+ }
463
+ loadBufferView(e) {
464
+ let t = this.parser.json, n = t.bufferViews[e];
465
+ if (n.extensions && n.extensions[this.name]) {
466
+ let e = n.extensions[this.name], r = this.parser.getDependency("buffer", e.buffer), i = this.parser.options.meshoptDecoder;
467
+ if (!i || !i.supported) {
468
+ if (t.extensionsRequired && t.extensionsRequired.indexOf(this.name) >= 0) throw Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");
469
+ return null;
470
+ }
471
+ return r.then(function(t) {
472
+ let n = e.byteOffset || 0, r = e.byteLength || 0, a = e.count, o = e.byteStride, s = new Uint8Array(t, n, r);
473
+ return i.decodeGltfBufferAsync ? i.decodeGltfBufferAsync(a, o, s, e.mode, e.filter).then(function(e) {
474
+ return e.buffer;
475
+ }) : i.ready.then(function() {
476
+ let t = new ArrayBuffer(a * o);
477
+ return i.decodeGltfBuffer(new Uint8Array(t), a, o, s, e.mode, e.filter), t;
478
+ });
479
+ });
480
+ } else return null;
481
+ }
482
+ }, Je = class {
483
+ constructor(e) {
484
+ this.name = F.EXT_MESH_GPU_INSTANCING, this.parser = e;
485
+ }
486
+ createNodeMesh(t) {
487
+ let n = this.parser.json, r = n.nodes[t];
488
+ if (!r.extensions || !r.extensions[this.name] || r.mesh === void 0) return null;
489
+ let i = n.meshes[r.mesh];
490
+ for (let e of i.primitives) if (e.mode !== V.TRIANGLES && e.mode !== V.TRIANGLE_STRIP && e.mode !== V.TRIANGLE_FAN && e.mode !== void 0) return null;
491
+ let o = r.extensions[this.name].attributes, s = [], c = {};
492
+ for (let e in o) s.push(this.parser.getDependency("accessor", o[e]).then((t) => (c[e] = t, c[e])));
493
+ return s.length < 1 ? null : (s.push(this.parser.createNodeMesh(t)), Promise.all(s).then((t) => {
494
+ let n = t.pop(), r = n.isGroup ? n.children : [n], i = t[0].count, o = [];
495
+ for (let t of r) {
496
+ let n = new e(), r = new l(), s = new ne(), u = new l(1, 1, 1), d = new a(t.geometry, t.material, i);
497
+ for (let e = 0; e < i; e++) c.TRANSLATION && r.fromBufferAttribute(c.TRANSLATION, e), c.ROTATION && s.fromBufferAttribute(c.ROTATION, e), c.SCALE && u.fromBufferAttribute(c.SCALE, e), d.setMatrixAt(e, n.compose(r, s, u));
498
+ for (let e in c) if (e === "_COLOR_0") {
499
+ let t = c[e];
500
+ d.instanceColor = new h(t.array, t.itemSize, t.normalized);
501
+ } else e !== "TRANSLATION" && e !== "ROTATION" && e !== "SCALE" && t.geometry.setAttribute(e, c[e]);
502
+ D.prototype.copy.call(d, t), this.parser.assignFinalMaterial(d), o.push(d);
503
+ }
504
+ return n.isGroup ? (n.clear(), n.add(...o), n) : o[0];
505
+ }));
506
+ }
507
+ }, L = "glTF", R = 12, z = {
508
+ JSON: 1313821514,
509
+ BIN: 5130562
510
+ }, Ye = class {
511
+ constructor(e) {
512
+ this.name = F.KHR_BINARY_GLTF, this.content = null, this.body = null;
513
+ let t = new DataView(e, 0, R), n = new TextDecoder();
514
+ if (this.header = {
515
+ magic: n.decode(new Uint8Array(e.slice(0, 4))),
516
+ version: t.getUint32(4, !0),
517
+ length: t.getUint32(8, !0)
518
+ }, this.header.magic !== L) throw Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");
519
+ if (this.header.version < 2) throw Error("THREE.GLTFLoader: Legacy binary file detected.");
520
+ let r = this.header.length - R, i = new DataView(e, R), a = 0;
521
+ for (; a < r;) {
522
+ let t = i.getUint32(a, !0);
523
+ a += 4;
524
+ let r = i.getUint32(a, !0);
525
+ if (a += 4, r === z.JSON) {
526
+ let r = new Uint8Array(e, R + a, t);
527
+ this.content = n.decode(r);
528
+ } else if (r === z.BIN) {
529
+ let n = R + a;
530
+ this.body = e.slice(n, n + t);
531
+ }
532
+ a += t;
533
+ }
534
+ if (this.content === null) throw Error("THREE.GLTFLoader: JSON content not found.");
535
+ }
536
+ }, Xe = class {
537
+ constructor(e, t) {
538
+ if (!t) throw Error("THREE.GLTFLoader: No DRACOLoader instance provided.");
539
+ this.name = F.KHR_DRACO_MESH_COMPRESSION, this.json = e, this.dracoLoader = t, this.dracoLoader.preload();
540
+ }
541
+ decodePrimitive(e, t) {
542
+ let n = this.json, r = this.dracoLoader, i = e.extensions[this.name].bufferView, a = e.extensions[this.name].attributes, o = {}, s = {}, c = {};
543
+ for (let e in a) {
544
+ let t = K[e] || e.toLowerCase();
545
+ o[t] = a[e];
546
+ }
547
+ for (let t in e.attributes) {
548
+ let r = K[t] || t.toLowerCase();
549
+ if (a[t] !== void 0) {
550
+ let i = n.accessors[e.attributes[t]];
551
+ c[r] = H[i.componentType].name, s[r] = i.normalized === !0;
552
+ }
553
+ }
554
+ return t.getDependency("bufferView", i).then(function(e) {
555
+ return new Promise(function(t, n) {
556
+ r.decodeDracoFile(e, function(e) {
557
+ for (let t in e.attributes) {
558
+ let n = e.attributes[t], r = s[t];
559
+ r !== void 0 && (n.normalized = r);
560
+ }
561
+ t(e);
562
+ }, o, c, f, n);
563
+ });
564
+ });
565
+ }
566
+ }, Ze = class {
567
+ constructor() {
568
+ this.name = F.KHR_TEXTURE_TRANSFORM;
569
+ }
570
+ extendTexture(e, t) {
571
+ return (t.texCoord === void 0 || t.texCoord === e.channel) && t.offset === void 0 && t.rotation === void 0 && t.scale === void 0 ? e : (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);
572
+ }
573
+ }, Qe = class {
574
+ constructor() {
575
+ this.name = F.KHR_MESH_QUANTIZATION;
576
+ }
577
+ }, B = class extends ee {
578
+ constructor(e, t, n, r) {
579
+ super(e, t, n, r);
580
+ }
581
+ copySampleValue_(e) {
582
+ let t = this.resultBuffer, n = this.sampleValues, r = this.valueSize, i = e * r * 3 + r;
583
+ for (let e = 0; e !== r; e++) t[e] = n[i + e];
584
+ return t;
585
+ }
586
+ interpolate_(e, t, n, r) {
587
+ let i = this.resultBuffer, a = this.sampleValues, o = this.valueSize, s = o * 2, c = o * 3, l = r - t, u = (n - t) / l, d = u * u, f = d * u, p = e * c, m = p - c, h = -2 * f + 3 * d, g = f - d, _ = 1 - h, v = g - d + u;
588
+ for (let e = 0; e !== o; e++) {
589
+ let t = a[m + e + o], n = a[m + e + s] * l, r = a[p + e + o], c = a[p + e] * l;
590
+ i[e] = _ * t + v * n + h * r + g * c;
591
+ }
592
+ return i;
593
+ }
594
+ }, $e = new ne(), et = class extends B {
595
+ interpolate_(e, t, n, r) {
596
+ let i = super.interpolate_(e, t, n, r);
597
+ return $e.fromArray(i).normalize().toArray(i), i;
598
+ }
599
+ }, V = {
600
+ FLOAT: 5126,
601
+ FLOAT_MAT3: 35675,
602
+ FLOAT_MAT4: 35676,
603
+ FLOAT_VEC2: 35664,
604
+ FLOAT_VEC3: 35665,
605
+ FLOAT_VEC4: 35666,
606
+ LINEAR: 9729,
607
+ REPEAT: 10497,
608
+ SAMPLER_2D: 35678,
609
+ POINTS: 0,
610
+ LINES: 1,
611
+ LINE_LOOP: 2,
612
+ LINE_STRIP: 3,
613
+ TRIANGLES: 4,
614
+ TRIANGLE_STRIP: 5,
615
+ TRIANGLE_FAN: 6,
616
+ UNSIGNED_BYTE: 5121,
617
+ UNSIGNED_SHORT: 5123
618
+ }, H = {
619
+ 5120: Int8Array,
620
+ 5121: Uint8Array,
621
+ 5122: Int16Array,
622
+ 5123: Uint16Array,
623
+ 5125: Uint32Array,
624
+ 5126: Float32Array
625
+ }, U = {
626
+ 9728: ve,
627
+ 9729: s,
628
+ 9984: ue,
629
+ 9985: be,
630
+ 9986: Ce,
631
+ 9987: p
632
+ }, W = {
633
+ 33071: se,
634
+ 33648: le,
635
+ 10497: Te
636
+ }, G = {
637
+ SCALAR: 1,
638
+ VEC2: 2,
639
+ VEC3: 3,
640
+ VEC4: 4,
641
+ MAT2: 4,
642
+ MAT3: 9,
643
+ MAT4: 16
644
+ }, K = {
645
+ POSITION: "position",
646
+ NORMAL: "normal",
647
+ TANGENT: "tangent",
648
+ TEXCOORD_0: "uv",
649
+ TEXCOORD_1: "uv1",
650
+ TEXCOORD_2: "uv2",
651
+ TEXCOORD_3: "uv3",
652
+ COLOR_0: "color",
653
+ WEIGHTS_0: "skinWeight",
654
+ JOINTS_0: "skinIndex"
655
+ }, q = {
656
+ scale: "scale",
657
+ translation: "position",
658
+ rotation: "quaternion",
659
+ weights: "morphTargetInfluences"
660
+ }, tt = {
661
+ CUBICSPLINE: void 0,
662
+ LINEAR: n,
663
+ STEP: Oe
664
+ }, J = {
665
+ OPAQUE: "OPAQUE",
666
+ MASK: "MASK",
667
+ BLEND: "BLEND"
668
+ };
669
+ function nt(e) {
670
+ return e.DefaultMaterial === void 0 && (e.DefaultMaterial = new E({
671
+ color: 16777215,
672
+ emissive: 0,
673
+ metalness: 1,
674
+ roughness: 1,
675
+ transparent: !1,
676
+ depthTest: !0,
677
+ side: 0
678
+ })), e.DefaultMaterial;
679
+ }
680
+ function Y(e, t, n) {
681
+ for (let r in n.extensions) e[r] === void 0 && (t.userData.gltfExtensions = t.userData.gltfExtensions || {}, t.userData.gltfExtensions[r] = n.extensions[r]);
682
+ }
683
+ function X(e, t) {
684
+ t.extras !== void 0 && (typeof t.extras == "object" ? Object.assign(e.userData, t.extras) : console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, " + t.extras));
685
+ }
686
+ function rt(e, t, n) {
687
+ let r = !1, i = !1, a = !1;
688
+ for (let e = 0, n = t.length; e < n; e++) {
689
+ let n = t[e];
690
+ if (n.POSITION !== void 0 && (r = !0), n.NORMAL !== void 0 && (i = !0), n.COLOR_0 !== void 0 && (a = !0), r && i && a) break;
691
+ }
692
+ if (!r && !i && !a) return Promise.resolve(e);
693
+ let o = [], s = [], c = [];
694
+ for (let l = 0, u = t.length; l < u; l++) {
695
+ let u = t[l];
696
+ if (r) {
697
+ let t = u.POSITION === void 0 ? e.attributes.position : n.getDependency("accessor", u.POSITION);
698
+ o.push(t);
699
+ }
700
+ if (i) {
701
+ let t = u.NORMAL === void 0 ? e.attributes.normal : n.getDependency("accessor", u.NORMAL);
702
+ s.push(t);
703
+ }
704
+ if (a) {
705
+ let t = u.COLOR_0 === void 0 ? e.attributes.color : n.getDependency("accessor", u.COLOR_0);
706
+ c.push(t);
707
+ }
708
+ }
709
+ return Promise.all([
710
+ Promise.all(o),
711
+ Promise.all(s),
712
+ Promise.all(c)
713
+ ]).then(function(t) {
714
+ let n = t[0], o = t[1], s = t[2];
715
+ return r && (e.morphAttributes.position = n), i && (e.morphAttributes.normal = o), a && (e.morphAttributes.color = s), e.morphTargetsRelative = !0, e;
716
+ });
717
+ }
718
+ function it(e, t) {
719
+ if (e.updateMorphTargets(), t.weights !== void 0) for (let n = 0, r = t.weights.length; n < r; n++) e.morphTargetInfluences[n] = t.weights[n];
720
+ if (t.extras && Array.isArray(t.extras.targetNames)) {
721
+ let n = t.extras.targetNames;
722
+ if (e.morphTargetInfluences.length === n.length) {
723
+ e.morphTargetDictionary = {};
724
+ for (let t = 0, r = n.length; t < r; t++) e.morphTargetDictionary[n[t]] = t;
725
+ } else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.");
726
+ }
727
+ }
728
+ function at(e) {
729
+ let t, n = e.extensions && e.extensions[F.KHR_DRACO_MESH_COMPRESSION];
730
+ if (t = n ? "draco:" + n.bufferView + ":" + n.indices + ":" + Z(n.attributes) : e.indices + ":" + Z(e.attributes) + ":" + e.mode, e.targets !== void 0) for (let n = 0, r = e.targets.length; n < r; n++) t += ":" + Z(e.targets[n]);
731
+ return t;
732
+ }
733
+ function Z(e) {
734
+ let t = "", n = Object.keys(e).sort();
735
+ for (let r = 0, i = n.length; r < i; r++) t += n[r] + ":" + e[n[r]] + ";";
736
+ return t;
737
+ }
738
+ function Q(e) {
739
+ switch (e) {
740
+ case Int8Array: return 1 / 127;
741
+ case Uint8Array: return 1 / 255;
742
+ case Int16Array: return 1 / 32767;
743
+ case Uint16Array: return 1 / 65535;
744
+ default: throw Error("THREE.GLTFLoader: Unsupported normalized accessor component type.");
745
+ }
746
+ }
747
+ function ot(e) {
748
+ return e.search(/\.jpe?g($|\?)/i) > 0 || e.search(/^data\:image\/jpeg/) === 0 ? "image/jpeg" : e.search(/\.webp($|\?)/i) > 0 || e.search(/^data\:image\/webp/) === 0 ? "image/webp" : e.search(/\.ktx2($|\?)/i) > 0 || e.search(/^data\:image\/ktx2/) === 0 ? "image/ktx2" : "image/png";
749
+ }
750
+ var st = new e(), ct = class {
751
+ constructor(e = {}, t = {}) {
752
+ this.json = e, this.extensions = {}, this.plugins = {}, this.options = t, this.cache = new je(), this.associations = /* @__PURE__ */ new Map(), this.primitiveCache = {}, this.nodeCache = {}, this.meshCache = {
753
+ refs: {},
754
+ uses: {}
755
+ }, this.cameraCache = {
756
+ refs: {},
757
+ uses: {}
758
+ }, this.lightCache = {
759
+ refs: {},
760
+ uses: {}
761
+ }, this.sourceCache = {}, this.textureCache = {}, this.nodeNamesUsed = {};
762
+ let n = !1, r = -1, i = !1, a = -1;
763
+ if (typeof navigator < "u" && navigator.userAgent !== void 0) {
764
+ let e = navigator.userAgent;
765
+ n = /^((?!chrome|android).)*safari/i.test(e) === !0;
766
+ let t = e.match(/Version\/(\d+)/);
767
+ r = n && t ? parseInt(t[1], 10) : -1, i = e.indexOf("Firefox") > -1, a = i ? e.match(/Firefox\/([0-9]+)\./)[1] : -1;
768
+ }
769
+ typeof createImageBitmap > "u" || n && r < 17 || i && a < 98 ? this.textureLoader = new d(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 A(this.options.manager), this.fileLoader.setResponseType("arraybuffer"), this.options.crossOrigin === "use-credentials" && this.fileLoader.setWithCredentials(!0);
770
+ }
771
+ setExtensions(e) {
772
+ this.extensions = e;
773
+ }
774
+ setPlugins(e) {
775
+ this.plugins = e;
776
+ }
777
+ parse(e, t) {
778
+ let n = this, r = this.json, i = this.extensions;
779
+ this.cache.removeAll(), this.nodeCache = {}, this._invokeAll(function(e) {
780
+ return e._markDefs && e._markDefs();
781
+ }), Promise.all(this._invokeAll(function(e) {
782
+ return e.beforeRoot && e.beforeRoot();
783
+ })).then(function() {
784
+ return Promise.all([
785
+ n.getDependencies("scene"),
786
+ n.getDependencies("animation"),
787
+ n.getDependencies("camera")
788
+ ]);
789
+ }).then(function(t) {
790
+ let a = {
791
+ scene: t[0][r.scene || 0],
792
+ scenes: t[0],
793
+ animations: t[1],
794
+ cameras: t[2],
795
+ asset: r.asset,
796
+ parser: n,
797
+ userData: {}
798
+ };
799
+ return Y(i, a, r), X(a, r), Promise.all(n._invokeAll(function(e) {
800
+ return e.afterRoot && e.afterRoot(a);
801
+ })).then(function() {
802
+ for (let e of a.scenes) e.updateMatrixWorld();
803
+ e(a);
804
+ });
805
+ }).catch(t);
806
+ }
807
+ _markDefs() {
808
+ let e = this.json.nodes || [], t = this.json.skins || [], n = this.json.meshes || [];
809
+ for (let n = 0, r = t.length; n < r; n++) {
810
+ let r = t[n].joints;
811
+ for (let t = 0, n = r.length; t < n; t++) e[r[t]].isBone = !0;
812
+ }
813
+ for (let t = 0, r = e.length; t < r; t++) {
814
+ let r = e[t];
815
+ r.mesh !== void 0 && (this._addNodeRef(this.meshCache, r.mesh), r.skin !== void 0 && (n[r.mesh].isSkinnedMesh = !0)), r.camera !== void 0 && this._addNodeRef(this.cameraCache, r.camera);
816
+ }
817
+ }
818
+ _addNodeRef(e, t) {
819
+ t !== void 0 && (e.refs[t] === void 0 && (e.refs[t] = e.uses[t] = 0), e.refs[t]++);
820
+ }
821
+ _getNodeRef(e, t, n) {
822
+ if (e.refs[t] <= 1) return n;
823
+ let r = n.clone(), i = (e, t) => {
824
+ let n = this.associations.get(e);
825
+ n != null && this.associations.set(t, n);
826
+ for (let [n, r] of e.children.entries()) i(r, t.children[n]);
827
+ };
828
+ return i(n, r), r.name += "_instance_" + e.uses[t]++, r;
829
+ }
830
+ _invokeOne(e) {
831
+ let t = Object.values(this.plugins);
832
+ t.push(this);
833
+ for (let n = 0; n < t.length; n++) {
834
+ let r = e(t[n]);
835
+ if (r) return r;
836
+ }
837
+ return null;
838
+ }
839
+ _invokeAll(e) {
840
+ let t = Object.values(this.plugins);
841
+ t.unshift(this);
842
+ let n = [];
843
+ for (let r = 0; r < t.length; r++) {
844
+ let i = e(t[r]);
845
+ i && n.push(i);
846
+ }
847
+ return n;
848
+ }
849
+ getDependency(e, t) {
850
+ let n = e + ":" + t, r = this.cache.get(n);
851
+ if (!r) {
852
+ switch (e) {
853
+ case "scene":
854
+ r = this.loadScene(t);
855
+ break;
856
+ case "node":
857
+ r = this._invokeOne(function(e) {
858
+ return e.loadNode && e.loadNode(t);
859
+ });
860
+ break;
861
+ case "mesh":
862
+ r = this._invokeOne(function(e) {
863
+ return e.loadMesh && e.loadMesh(t);
864
+ });
865
+ break;
866
+ case "accessor":
867
+ r = this.loadAccessor(t);
868
+ break;
869
+ case "bufferView":
870
+ r = this._invokeOne(function(e) {
871
+ return e.loadBufferView && e.loadBufferView(t);
872
+ });
873
+ break;
874
+ case "buffer":
875
+ r = this.loadBuffer(t);
876
+ break;
877
+ case "material":
878
+ r = this._invokeOne(function(e) {
879
+ return e.loadMaterial && e.loadMaterial(t);
880
+ });
881
+ break;
882
+ case "texture":
883
+ r = this._invokeOne(function(e) {
884
+ return e.loadTexture && e.loadTexture(t);
885
+ });
886
+ break;
887
+ case "skin":
888
+ r = this.loadSkin(t);
889
+ break;
890
+ case "animation":
891
+ r = this._invokeOne(function(e) {
892
+ return e.loadAnimation && e.loadAnimation(t);
893
+ });
894
+ break;
895
+ case "camera":
896
+ r = this.loadCamera(t);
897
+ break;
898
+ default:
899
+ if (r = this._invokeOne(function(n) {
900
+ return n != this && n.getDependency && n.getDependency(e, t);
901
+ }), !r) throw Error("Unknown type: " + e);
902
+ break;
903
+ }
904
+ this.cache.add(n, r);
905
+ }
906
+ return r;
907
+ }
908
+ getDependencies(e) {
909
+ let t = this.cache.get(e);
910
+ if (!t) {
911
+ let n = this, r = this.json[e + (e === "mesh" ? "es" : "s")] || [];
912
+ t = Promise.all(r.map(function(t, r) {
913
+ return n.getDependency(e, r);
914
+ })), this.cache.add(e, t);
915
+ }
916
+ return t;
917
+ }
918
+ loadBuffer(e) {
919
+ let t = this.json.buffers[e], n = this.fileLoader;
920
+ if (t.type && t.type !== "arraybuffer") throw Error("THREE.GLTFLoader: " + t.type + " buffer type is not supported.");
921
+ if (t.uri === void 0 && e === 0) return Promise.resolve(this.extensions[F.KHR_BINARY_GLTF].body);
922
+ let r = this.options;
923
+ return new Promise(function(e, i) {
924
+ n.load(S.resolveURL(t.uri, r.path), e, void 0, function() {
925
+ i(/* @__PURE__ */ Error("THREE.GLTFLoader: Failed to load buffer \"" + t.uri + "\"."));
926
+ });
927
+ });
928
+ }
929
+ loadBufferView(e) {
930
+ let t = this.json.bufferViews[e];
931
+ return this.getDependency("buffer", t.buffer).then(function(e) {
932
+ let n = t.byteLength || 0, r = t.byteOffset || 0;
933
+ return e.slice(r, r + n);
934
+ });
935
+ }
936
+ loadAccessor(e) {
937
+ let t = this, n = this.json, r = this.json.accessors[e];
938
+ if (r.bufferView === void 0 && r.sparse === void 0) {
939
+ let e = G[r.type], t = H[r.componentType], n = r.normalized === !0, i = new t(r.count * e);
940
+ return Promise.resolve(new T(i, e, n));
941
+ }
942
+ let i = [];
943
+ return r.bufferView === void 0 ? i.push(null) : i.push(this.getDependency("bufferView", r.bufferView)), r.sparse !== void 0 && (i.push(this.getDependency("bufferView", r.sparse.indices.bufferView)), i.push(this.getDependency("bufferView", r.sparse.values.bufferView))), Promise.all(i).then(function(e) {
944
+ let i = e[0], a = G[r.type], o = H[r.componentType], s = o.BYTES_PER_ELEMENT, c = s * a, l = r.byteOffset || 0, d = r.bufferView === void 0 ? void 0 : n.bufferViews[r.bufferView].byteStride, f = r.normalized === !0, p, h;
945
+ if (d && d !== c) {
946
+ let e = Math.floor(l / d), n = "InterleavedBuffer:" + r.bufferView + ":" + r.componentType + ":" + e + ":" + r.count, c = t.cache.get(n);
947
+ c || (p = new o(i, e * d, r.count * d / s), c = new u(p, d / s), t.cache.add(n, c)), h = new m(c, a, l % d / s, f);
948
+ } else p = i === null ? new o(r.count * a) : new o(i, l, r.count * a), h = new T(p, a, f);
949
+ if (r.sparse !== void 0) {
950
+ let t = G.SCALAR, n = H[r.sparse.indices.componentType], s = r.sparse.indices.byteOffset || 0, c = r.sparse.values.byteOffset || 0, l = new n(e[1], s, r.sparse.count * t), u = new o(e[2], c, r.sparse.count * a);
951
+ i !== null && (h = new T(h.array.slice(), h.itemSize, h.normalized)), h.normalized = !1;
952
+ for (let e = 0, t = l.length; e < t; e++) {
953
+ let t = l[e];
954
+ if (h.setX(t, u[e * a]), a >= 2 && h.setY(t, u[e * a + 1]), a >= 3 && h.setZ(t, u[e * a + 2]), a >= 4 && h.setW(t, u[e * a + 3]), a >= 5) throw Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
955
+ }
956
+ h.normalized = f;
957
+ }
958
+ return h;
959
+ });
960
+ }
961
+ loadTexture(e) {
962
+ let t = this.json, n = this.options, r = t.textures[e].source, i = t.images[r], a = this.textureLoader;
963
+ if (i.uri) {
964
+ let e = n.manager.getHandler(i.uri);
965
+ e !== null && (a = e);
966
+ }
967
+ return this.loadTextureImage(e, r, a);
968
+ }
969
+ loadTextureImage(e, t, n) {
970
+ let r = this, i = this.json, a = i.textures[e], o = i.images[t], s = (o.uri || o.bufferView) + ":" + a.sampler;
971
+ if (this.textureCache[s]) return this.textureCache[s];
972
+ let c = this.loadImageSource(t, n).then(function(t) {
973
+ t.flipY = !1, t.name = a.name || o.name || "", t.name === "" && typeof o.uri == "string" && o.uri.startsWith("data:image/") === !1 && (t.name = o.uri);
974
+ let n = (i.samplers || {})[a.sampler] || {};
975
+ return t.magFilter = U[n.magFilter] || 1006, t.minFilter = U[n.minFilter] || 1008, t.wrapS = W[n.wrapS] || 1e3, t.wrapT = W[n.wrapT] || 1e3, t.generateMipmaps = !t.isCompressedTexture && t.minFilter !== 1003 && t.minFilter !== 1006, r.associations.set(t, { textures: e }), t;
976
+ }).catch(function() {
977
+ return null;
978
+ });
979
+ return this.textureCache[s] = c, c;
980
+ }
981
+ loadImageSource(e, t) {
982
+ let n = this, r = this.json, i = this.options;
983
+ if (this.sourceCache[e] !== void 0) return this.sourceCache[e].then((e) => e.clone());
984
+ let a = r.images[e], s = self.URL || self.webkitURL, c = a.uri || "", l = !1;
985
+ if (a.bufferView !== void 0) c = n.getDependency("bufferView", a.bufferView).then(function(e) {
986
+ l = !0;
987
+ let t = new Blob([e], { type: a.mimeType });
988
+ return c = s.createObjectURL(t), c;
989
+ });
990
+ else if (a.uri === void 0) throw Error("THREE.GLTFLoader: Image " + e + " is missing URI and bufferView");
991
+ let u = Promise.resolve(c).then(function(e) {
992
+ return new Promise(function(n, r) {
993
+ let a = n;
994
+ t.isImageBitmapLoader === !0 && (a = function(e) {
995
+ let t = new o(e);
996
+ t.needsUpdate = !0, n(t);
997
+ }), t.load(S.resolveURL(e, i.path), a, void 0, r);
998
+ });
999
+ }).then(function(e) {
1000
+ return l === !0 && s.revokeObjectURL(c), X(e, a), e.userData.mimeType = a.mimeType || ot(a.uri), e;
1001
+ }).catch(function(e) {
1002
+ throw console.error("THREE.GLTFLoader: Couldn't load texture", c), e;
1003
+ });
1004
+ return this.sourceCache[e] = u, u;
1005
+ }
1006
+ assignTexture(e, t, n, r) {
1007
+ let i = this;
1008
+ return this.getDependency("texture", n.index).then(function(a) {
1009
+ if (!a) return null;
1010
+ if (n.texCoord !== void 0 && n.texCoord > 0 && (a = a.clone(), a.channel = n.texCoord), i.extensions[F.KHR_TEXTURE_TRANSFORM]) {
1011
+ let e = n.extensions === void 0 ? void 0 : n.extensions[F.KHR_TEXTURE_TRANSFORM];
1012
+ if (e) {
1013
+ let t = i.associations.get(a);
1014
+ a = i.extensions[F.KHR_TEXTURE_TRANSFORM].extendTexture(a, e), i.associations.set(a, t);
1015
+ }
1016
+ }
1017
+ return r !== void 0 && (a.colorSpace = r), e[t] = a, a;
1018
+ });
1019
+ }
1020
+ assignFinalMaterial(e) {
1021
+ let t = e.geometry, n = e.material, r = t.attributes.tangent === void 0, i = t.attributes.color !== void 0, a = t.attributes.normal === void 0;
1022
+ if (e.isPoints) {
1023
+ let e = "PointsMaterial:" + n.uuid, t = this.cache.get(e);
1024
+ t || (t = new ce(), C.prototype.copy.call(t, n), t.color.copy(n.color), t.map = n.map, t.sizeAttenuation = !1, this.cache.add(e, t)), n = t;
1025
+ } else if (e.isLine) {
1026
+ let e = "LineBasicMaterial:" + n.uuid, t = this.cache.get(e);
1027
+ t || (t = new c(), C.prototype.copy.call(t, n), t.color.copy(n.color), t.map = n.map, this.cache.add(e, t)), n = t;
1028
+ }
1029
+ if (r || i || a) {
1030
+ let e = "ClonedMaterial:" + n.uuid + ":";
1031
+ r && (e += "derivative-tangents:"), i && (e += "vertex-colors:"), a && (e += "flat-shading:");
1032
+ let t = this.cache.get(e);
1033
+ t || (t = n.clone(), i && (t.vertexColors = !0), a && (t.flatShading = !0), r && (t.normalScale && (t.normalScale.y *= -1), t.clearcoatNormalScale && (t.clearcoatNormalScale.y *= -1)), this.cache.add(e, t), this.associations.set(t, this.associations.get(n))), n = t;
1034
+ }
1035
+ e.material = n;
1036
+ }
1037
+ getMaterialType() {
1038
+ return E;
1039
+ }
1040
+ loadMaterial(e) {
1041
+ let t = this, n = this.json, r = this.extensions, i = n.materials[e], a, o = {}, s = i.extensions || {}, c = [];
1042
+ if (s[F.KHR_MATERIALS_UNLIT]) {
1043
+ let e = r[F.KHR_MATERIALS_UNLIT];
1044
+ a = e.getMaterialType(), c.push(e.extendParams(o, i, t));
1045
+ } else {
1046
+ let n = i.pbrMetallicRoughness || {};
1047
+ if (o.color = new k(1, 1, 1), o.opacity = 1, Array.isArray(n.baseColorFactor)) {
1048
+ let e = n.baseColorFactor;
1049
+ o.color.setRGB(e[0], e[1], e[2], f), o.opacity = e[3];
1050
+ }
1051
+ n.baseColorTexture !== void 0 && c.push(t.assignTexture(o, "map", n.baseColorTexture, y)), o.metalness = n.metallicFactor === void 0 ? 1 : n.metallicFactor, o.roughness = n.roughnessFactor === void 0 ? 1 : n.roughnessFactor, n.metallicRoughnessTexture !== void 0 && (c.push(t.assignTexture(o, "metalnessMap", n.metallicRoughnessTexture)), c.push(t.assignTexture(o, "roughnessMap", n.metallicRoughnessTexture))), a = this._invokeOne(function(t) {
1052
+ return t.getMaterialType && t.getMaterialType(e);
1053
+ }), c.push(Promise.all(this._invokeAll(function(t) {
1054
+ return t.extendMaterialParams && t.extendMaterialParams(e, o);
1055
+ })));
1056
+ }
1057
+ i.doubleSided === !0 && (o.side = 2);
1058
+ let l = i.alphaMode || J.OPAQUE;
1059
+ if (l === J.BLEND ? (o.transparent = !0, o.depthWrite = !1) : (o.transparent = !1, l === J.MASK && (o.alphaTest = i.alphaCutoff === void 0 ? .5 : i.alphaCutoff)), i.normalTexture !== void 0 && a !== O && (c.push(t.assignTexture(o, "normalMap", i.normalTexture)), o.normalScale = new b(1, 1), i.normalTexture.scale !== void 0)) {
1060
+ let e = i.normalTexture.scale;
1061
+ o.normalScale.set(e, e);
1062
+ }
1063
+ if (i.occlusionTexture !== void 0 && a !== O && (c.push(t.assignTexture(o, "aoMap", i.occlusionTexture)), i.occlusionTexture.strength !== void 0 && (o.aoMapIntensity = i.occlusionTexture.strength)), i.emissiveFactor !== void 0 && a !== O) {
1064
+ let e = i.emissiveFactor;
1065
+ o.emissive = new k().setRGB(e[0], e[1], e[2], f);
1066
+ }
1067
+ return i.emissiveTexture !== void 0 && a !== O && c.push(t.assignTexture(o, "emissiveMap", i.emissiveTexture, y)), Promise.all(c).then(function() {
1068
+ let n = new a(o);
1069
+ return i.name && (n.name = i.name), X(n, i), t.associations.set(n, { materials: e }), i.extensions && Y(r, n, i), n;
1070
+ });
1071
+ }
1072
+ createUniqueName(e) {
1073
+ let t = Ee.sanitizeNodeName(e || "");
1074
+ return t in this.nodeNamesUsed ? t + "_" + ++this.nodeNamesUsed[t] : (this.nodeNamesUsed[t] = 0, t);
1075
+ }
1076
+ loadGeometries(e) {
1077
+ let t = this, n = this.extensions, r = this.primitiveCache;
1078
+ function i(e) {
1079
+ return n[F.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e, t).then(function(n) {
1080
+ return $(n, e, t);
1081
+ });
1082
+ }
1083
+ let a = [];
1084
+ for (let n = 0, o = e.length; n < o; n++) {
1085
+ let o = e[n], s = at(o), c = r[s];
1086
+ if (c) a.push(c.promise);
1087
+ else {
1088
+ let e;
1089
+ e = o.extensions && o.extensions[F.KHR_DRACO_MESH_COMPRESSION] ? i(o) : $(new ye(), o, t), r[s] = {
1090
+ primitive: o,
1091
+ promise: e
1092
+ }, a.push(e);
1093
+ }
1094
+ }
1095
+ return Promise.all(a);
1096
+ }
1097
+ loadMesh(e) {
1098
+ let t = this, n = this.json, r = this.extensions, a = n.meshes[e], o = a.primitives, s = [];
1099
+ for (let e = 0, t = o.length; e < t; e++) {
1100
+ let t = o[e].material === void 0 ? nt(this.cache) : this.getDependency("material", o[e].material);
1101
+ s.push(t);
1102
+ }
1103
+ return s.push(t.loadGeometries(o)), Promise.all(s).then(function(n) {
1104
+ let s = n.slice(0, n.length - 1), c = n[n.length - 1], l = [];
1105
+ for (let n = 0, i = c.length; n < i; n++) {
1106
+ let i = c[n], u = o[n], d, f = s[n];
1107
+ if (u.mode === V.TRIANGLES || u.mode === V.TRIANGLE_STRIP || u.mode === V.TRIANGLE_FAN || u.mode === void 0) d = a.isSkinnedMesh === !0 ? new ge(i, f) : new de(i, f), d.isSkinnedMesh === !0 && d.normalizeSkinWeights(), u.mode === V.TRIANGLE_STRIP ? d.geometry = M(d.geometry, 1) : u.mode === V.TRIANGLE_FAN && (d.geometry = M(d.geometry, 2));
1108
+ else if (u.mode === V.LINES) d = new ae(i, f);
1109
+ else if (u.mode === V.LINE_STRIP) d = new ie(i, f);
1110
+ else if (u.mode === V.LINE_LOOP) d = new re(i, f);
1111
+ else if (u.mode === V.POINTS) d = new De(i, f);
1112
+ else throw Error("THREE.GLTFLoader: Primitive mode unsupported: " + u.mode);
1113
+ Object.keys(d.geometry.morphAttributes).length > 0 && it(d, a), d.name = t.createUniqueName(a.name || "mesh_" + e), X(d, a), u.extensions && Y(r, d, u), t.assignFinalMaterial(d), l.push(d);
1114
+ }
1115
+ for (let n = 0, r = l.length; n < r; n++) t.associations.set(l[n], {
1116
+ meshes: e,
1117
+ primitives: n
1118
+ });
1119
+ if (l.length === 1) return a.extensions && Y(r, l[0], a), l[0];
1120
+ let u = new i();
1121
+ a.extensions && Y(r, u, a), t.associations.set(u, { meshes: e });
1122
+ for (let e = 0, t = l.length; e < t; e++) u.add(l[e]);
1123
+ return u;
1124
+ });
1125
+ }
1126
+ loadCamera(e) {
1127
+ let t, n = this.json.cameras[e], r = n[n.type];
1128
+ if (!r) {
1129
+ console.warn("THREE.GLTFLoader: Missing camera parameters.");
1130
+ return;
1131
+ }
1132
+ return n.type === "perspective" ? t = new pe(v.radToDeg(r.yfov), r.aspectRatio || 1, r.znear || 1, r.zfar || 2e6) : n.type === "orthographic" && (t = new me(-r.xmag, r.xmag, r.ymag, -r.ymag, r.znear, r.zfar)), n.name && (t.name = this.createUniqueName(n.name)), X(t, n), Promise.resolve(t);
1133
+ }
1134
+ loadSkin(t) {
1135
+ let n = this.json.skins[t], r = [];
1136
+ for (let e = 0, t = n.joints.length; e < t; e++) r.push(this._loadNodeShallow(n.joints[e]));
1137
+ return n.inverseBindMatrices === void 0 ? r.push(null) : r.push(this.getDependency("accessor", n.inverseBindMatrices)), Promise.all(r).then(function(t) {
1138
+ let r = t.pop(), i = t, a = [], o = [];
1139
+ for (let t = 0, s = i.length; t < s; t++) {
1140
+ let s = i[t];
1141
+ if (s) {
1142
+ a.push(s);
1143
+ let n = new e();
1144
+ r !== null && n.fromArray(r.array, t * 16), o.push(n);
1145
+ } else console.warn("THREE.GLTFLoader: Joint \"%s\" could not be found.", n.joints[t]);
1146
+ }
1147
+ return new _(a, o);
1148
+ });
1149
+ }
1150
+ loadAnimation(e) {
1151
+ let t = this.json, n = this, r = t.animations[e], i = r.name ? r.name : "animation_" + e, a = [], o = [], s = [], c = [], l = [];
1152
+ for (let e = 0, t = r.channels.length; e < t; e++) {
1153
+ let t = r.channels[e], n = r.samplers[t.sampler], i = t.target, u = i.node, d = r.parameters === void 0 ? n.input : r.parameters[n.input], f = r.parameters === void 0 ? n.output : r.parameters[n.output];
1154
+ i.node !== void 0 && (a.push(this.getDependency("node", u)), o.push(this.getDependency("accessor", d)), s.push(this.getDependency("accessor", f)), c.push(n), l.push(i));
1155
+ }
1156
+ return Promise.all([
1157
+ Promise.all(a),
1158
+ Promise.all(o),
1159
+ Promise.all(s),
1160
+ Promise.all(c),
1161
+ Promise.all(l)
1162
+ ]).then(function(e) {
1163
+ let t = e[0], a = e[1], o = e[2], s = e[3], c = e[4], l = [];
1164
+ for (let e = 0, r = t.length; e < r; e++) {
1165
+ let r = t[e], i = a[e], u = o[e], d = s[e], f = c[e];
1166
+ if (r === void 0) continue;
1167
+ r.updateMatrix && r.updateMatrix();
1168
+ let p = n._createAnimationTracks(r, i, u, d, f);
1169
+ if (p) for (let e = 0; e < p.length; e++) l.push(p[e]);
1170
+ }
1171
+ let u = new xe(i, void 0, l);
1172
+ return X(u, r), u;
1173
+ });
1174
+ }
1175
+ createNodeMesh(e) {
1176
+ let t = this.json, n = this, r = t.nodes[e];
1177
+ return r.mesh === void 0 ? null : n.getDependency("mesh", r.mesh).then(function(e) {
1178
+ let t = n._getNodeRef(n.meshCache, r.mesh, e);
1179
+ return r.weights !== void 0 && t.traverse(function(e) {
1180
+ if (e.isMesh) for (let t = 0, n = r.weights.length; t < n; t++) e.morphTargetInfluences[t] = r.weights[t];
1181
+ }), t;
1182
+ });
1183
+ }
1184
+ loadNode(e) {
1185
+ let t = this.json, n = this, r = t.nodes[e], i = n._loadNodeShallow(e), a = [], o = r.children || [];
1186
+ for (let e = 0, t = o.length; e < t; e++) a.push(n.getDependency("node", o[e]));
1187
+ let s = r.skin === void 0 ? Promise.resolve(null) : n.getDependency("skin", r.skin);
1188
+ return Promise.all([
1189
+ i,
1190
+ Promise.all(a),
1191
+ s
1192
+ ]).then(function(e) {
1193
+ let t = e[0], n = e[1], r = e[2];
1194
+ r !== null && t.traverse(function(e) {
1195
+ e.isSkinnedMesh && e.bind(r, st);
1196
+ });
1197
+ for (let e = 0, r = n.length; e < r; e++) t.add(n[e]);
1198
+ if (t.userData.pivot !== void 0 && n.length > 0) {
1199
+ let e = t.userData.pivot, r = n[0];
1200
+ t.pivot = new l().fromArray(e), t.position.x -= e[0], t.position.y -= e[1], t.position.z -= e[2], r.position.set(0, 0, 0), delete t.userData.pivot;
1201
+ }
1202
+ return t;
1203
+ });
1204
+ }
1205
+ _loadNodeShallow(t) {
1206
+ let n = this.json, r = this.extensions, a = this;
1207
+ if (this.nodeCache[t] !== void 0) return this.nodeCache[t];
1208
+ let o = n.nodes[t], s = o.name ? a.createUniqueName(o.name) : "", c = [], l = a._invokeOne(function(e) {
1209
+ return e.createNodeMesh && e.createNodeMesh(t);
1210
+ });
1211
+ return l && c.push(l), o.camera !== void 0 && c.push(a.getDependency("camera", o.camera).then(function(e) {
1212
+ return a._getNodeRef(a.cameraCache, o.camera, e);
1213
+ })), a._invokeAll(function(e) {
1214
+ return e.createNodeAttachment && e.createNodeAttachment(t);
1215
+ }).forEach(function(e) {
1216
+ c.push(e);
1217
+ }), this.nodeCache[t] = Promise.all(c).then(function(n) {
1218
+ let c;
1219
+ if (c = o.isBone === !0 ? new _e() : n.length > 1 ? new i() : n.length === 1 ? n[0] : new D(), c !== n[0]) for (let e = 0, t = n.length; e < t; e++) c.add(n[e]);
1220
+ if (o.name && (c.userData.name = o.name, c.name = s), X(c, o), o.extensions && Y(r, c, o), o.matrix !== void 0) {
1221
+ let t = new e();
1222
+ t.fromArray(o.matrix), c.applyMatrix4(t);
1223
+ } else o.translation !== void 0 && c.position.fromArray(o.translation), o.rotation !== void 0 && c.quaternion.fromArray(o.rotation), o.scale !== void 0 && c.scale.fromArray(o.scale);
1224
+ if (!a.associations.has(c)) a.associations.set(c, {});
1225
+ else if (o.mesh !== void 0 && a.meshCache.refs[o.mesh] > 1) {
1226
+ let e = a.associations.get(c);
1227
+ a.associations.set(c, { ...e });
1228
+ }
1229
+ return a.associations.get(c).nodes = t, c;
1230
+ }), this.nodeCache[t];
1231
+ }
1232
+ loadScene(e) {
1233
+ let t = this.extensions, n = this.json.scenes[e], r = this, a = new i();
1234
+ n.name && (a.name = r.createUniqueName(n.name)), X(a, n), n.extensions && Y(t, a, n);
1235
+ let s = n.nodes || [], c = [];
1236
+ for (let e = 0, t = s.length; e < t; e++) c.push(r.getDependency("node", s[e]));
1237
+ return Promise.all(c).then(function(e) {
1238
+ for (let t = 0, n = e.length; t < n; t++) {
1239
+ let n = e[t];
1240
+ n.parent === null ? a.add(n) : a.add(ke(n));
1241
+ }
1242
+ return r.associations = ((e) => {
1243
+ let t = /* @__PURE__ */ new Map();
1244
+ for (let [e, n] of r.associations) (e instanceof C || e instanceof o) && t.set(e, n);
1245
+ return e.traverse((e) => {
1246
+ let n = r.associations.get(e);
1247
+ n != null && t.set(e, n);
1248
+ }), t;
1249
+ })(a), a;
1250
+ });
1251
+ }
1252
+ _createAnimationTracks(e, t, i, a, o) {
1253
+ let s = [], c = e.name ? e.name : e.uuid, l = [];
1254
+ function u(e) {
1255
+ e.morphTargetInfluences && l.push(e.name ? e.name : e.uuid);
1256
+ }
1257
+ q[o.path] === q.weights ? (u(e), e.isGroup && e.children.forEach(u)) : l.push(c);
1258
+ let d;
1259
+ switch (q[o.path]) {
1260
+ case q.weights:
1261
+ d = fe;
1262
+ break;
1263
+ case q.rotation:
1264
+ d = r;
1265
+ break;
1266
+ case q.translation:
1267
+ case q.scale:
1268
+ d = x;
1269
+ break;
1270
+ default:
1271
+ switch (i.itemSize) {
1272
+ case 1:
1273
+ d = fe;
1274
+ break;
1275
+ default:
1276
+ d = x;
1277
+ break;
1278
+ }
1279
+ break;
1280
+ }
1281
+ let f = a.interpolation === void 0 ? n : tt[a.interpolation], p = this._getArrayFromAccessor(i);
1282
+ for (let e = 0, n = l.length; e < n; e++) {
1283
+ let n = new d(l[e] + "." + q[o.path], t.array, p, f);
1284
+ a.interpolation === "CUBICSPLINE" && this._createCubicSplineTrackInterpolant(n), s.push(n);
1285
+ }
1286
+ return s;
1287
+ }
1288
+ _getArrayFromAccessor(e) {
1289
+ let t = e.array;
1290
+ if (e.normalized) {
1291
+ let e = Q(t.constructor), n = new Float32Array(t.length);
1292
+ for (let r = 0, i = t.length; r < i; r++) n[r] = t[r] * e;
1293
+ t = n;
1294
+ }
1295
+ return t;
1296
+ }
1297
+ _createCubicSplineTrackInterpolant(e) {
1298
+ e.createInterpolant = function(e) {
1299
+ return new (this instanceof r ? et : B)(this.times, this.values, this.getValueSize() / 3, e);
1300
+ }, e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0;
1301
+ }
1302
+ };
1303
+ function lt(e, n, r) {
1304
+ let i = n.attributes, a = new Se();
1305
+ if (i.POSITION !== void 0) {
1306
+ let e = r.json.accessors[i.POSITION], t = e.min, n = e.max;
1307
+ if (t !== void 0 && n !== void 0) {
1308
+ if (a.set(new l(t[0], t[1], t[2]), new l(n[0], n[1], n[2])), e.normalized) {
1309
+ let t = Q(H[e.componentType]);
1310
+ a.min.multiplyScalar(t), a.max.multiplyScalar(t);
1311
+ }
1312
+ } else {
1313
+ console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
1314
+ return;
1315
+ }
1316
+ } else return;
1317
+ let o = n.targets;
1318
+ if (o !== void 0) {
1319
+ let e = new l(), t = new l();
1320
+ for (let n = 0, i = o.length; n < i; n++) {
1321
+ let i = o[n];
1322
+ if (i.POSITION !== void 0) {
1323
+ let n = r.json.accessors[i.POSITION], a = n.min, o = n.max;
1324
+ if (a !== void 0 && o !== void 0) {
1325
+ if (t.setX(Math.max(Math.abs(a[0]), Math.abs(o[0]))), t.setY(Math.max(Math.abs(a[1]), Math.abs(o[1]))), t.setZ(Math.max(Math.abs(a[2]), Math.abs(o[2]))), n.normalized) {
1326
+ let e = Q(H[n.componentType]);
1327
+ t.multiplyScalar(e);
1328
+ }
1329
+ e.max(t);
1330
+ } else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
1331
+ }
1332
+ }
1333
+ a.expandByVector(e);
1334
+ }
1335
+ e.boundingBox = a;
1336
+ let s = new t();
1337
+ a.getCenter(s.center), s.radius = a.min.distanceTo(a.max) / 2, e.boundingSphere = s;
1338
+ }
1339
+ function $(e, t, n) {
1340
+ let r = t.attributes, i = [];
1341
+ function a(t, r) {
1342
+ return n.getDependency("accessor", t).then(function(t) {
1343
+ e.setAttribute(r, t);
1344
+ });
1345
+ }
1346
+ for (let t in r) {
1347
+ let n = K[t] || t.toLowerCase();
1348
+ n in e.attributes || i.push(a(r[t], n));
1349
+ }
1350
+ if (t.indices !== void 0 && !e.index) {
1351
+ let r = n.getDependency("accessor", t.indices).then(function(t) {
1352
+ e.setIndex(t);
1353
+ });
1354
+ i.push(r);
1355
+ }
1356
+ return j.workingColorSpace !== "srgb-linear" && "COLOR_0" in r && console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${j.workingColorSpace}" not supported.`), X(e, t), lt(e, t, n), Promise.all(i).then(function() {
1357
+ return t.targets === void 0 ? e : rt(e, t.targets, n);
1358
+ });
1359
+ }
1360
+ //#endregion
1361
+ export { Ae as GLTFLoader };