aptechka 0.14.0 → 0.16.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 (83) hide show
  1. package/lib/{Animation-De9aUv3b.cjs → Animation-DI864E0i.cjs} +1 -1
  2. package/lib/{Animation-NAGXiFv5.js → Animation-w6BLTCum.js} +1 -1
  3. package/lib/{Damped-DbJKrUIf.js → Damped-DEHDEq-b.js} +1 -1
  4. package/lib/{Damped-DYJ6Z0xo.cjs → Damped-ipnDc0iX.cjs} +1 -1
  5. package/lib/Store-CDb6RMce.cjs +1 -0
  6. package/lib/Store-OTdcl6SX.js +134 -0
  7. package/lib/{Tweened-BkkD9s4n.cjs → Tweened-B1TfANfR.cjs} +1 -1
  8. package/lib/{Tweened-DOSHLCZa.js → Tweened-C52xXDLY.js} +1 -1
  9. package/lib/{Viewport-Cv4TRGiv.cjs → Viewport-BDPsnAF4.cjs} +1 -1
  10. package/lib/{Viewport-B55BvLsV.js → Viewport-taEXS8Uv.js} +1 -1
  11. package/lib/animation/index.cjs +1 -1
  12. package/lib/animation/index.js +3 -3
  13. package/lib/attribute/index.cjs +1 -1
  14. package/lib/attribute/index.js +1 -1
  15. package/lib/canvas/index.cjs +1 -7
  16. package/lib/canvas/index.js +49 -48
  17. package/lib/class-linked-status/index.cjs +1 -1
  18. package/lib/class-linked-status/index.js +1 -1
  19. package/lib/controls/index.cjs +1 -1
  20. package/lib/controls/index.js +2 -2
  21. package/lib/css-property/index.cjs +1 -1
  22. package/lib/css-property/index.js +1 -1
  23. package/lib/dev/index.cjs +1 -1
  24. package/lib/dev/index.js +1 -1
  25. package/lib/device/index.cjs +1 -1
  26. package/lib/device/index.js +1 -1
  27. package/lib/en3/index.cjs +8 -1
  28. package/lib/en3/index.js +372 -4
  29. package/lib/image/index.cjs +1 -1
  30. package/lib/image/index.js +1 -1
  31. package/lib/jss-CjccJC-K.js +21 -0
  32. package/lib/jss-GJLvaNfT.cjs +1 -0
  33. package/lib/ladder/index.cjs +1 -1
  34. package/lib/ladder/index.js +1 -1
  35. package/lib/media/index.cjs +1 -1
  36. package/lib/media/index.js +1 -1
  37. package/lib/need_redo_tweaker/index.cjs +4 -4
  38. package/lib/need_redo_tweaker/index.js +838 -460
  39. package/lib/pointer/index.cjs +1 -1
  40. package/lib/pointer/index.js +2 -2
  41. package/lib/popover/index.cjs +1 -1
  42. package/lib/popover/index.js +15 -21
  43. package/lib/scroll/index.cjs +1 -1
  44. package/lib/scroll/index.js +576 -608
  45. package/lib/sequence/index.cjs +1 -1
  46. package/lib/sequence/index.js +1 -1
  47. package/lib/source/index.cjs +2 -2
  48. package/lib/source/index.js +154 -62
  49. package/lib/store/index.cjs +1 -1
  50. package/lib/store/index.js +71 -37
  51. package/lib/utils/index.cjs +1 -1
  52. package/lib/utils/index.js +59 -56
  53. package/lib/video/index.cjs +1 -1
  54. package/lib/video/index.js +1 -1
  55. package/package.json +1 -34
  56. package/lib/Composed-C_4slJQ6.cjs +0 -1
  57. package/lib/Composed-CfWa-69I.js +0 -31
  58. package/lib/Derived-BIBU-y7Z.cjs +0 -1
  59. package/lib/Derived-Vo_RsJfi.js +0 -23
  60. package/lib/SourceManager-B6wZpXUZ.js +0 -104
  61. package/lib/SourceManager-CfHcGLUa.cjs +0 -1
  62. package/lib/Store-C46i0nvr.js +0 -137
  63. package/lib/Store-npaZHvX4.cjs +0 -1
  64. package/lib/createStylesheet-C68ja-RS.js +0 -8
  65. package/lib/createStylesheet-Csfmh-MH.cjs +0 -1
  66. package/lib/element-constructor/index.cjs +0 -1
  67. package/lib/element-constructor/index.js +0 -135
  68. package/lib/en3/helpers/index.cjs +0 -1
  69. package/lib/en3/helpers/index.js +0 -1870
  70. package/lib/en3/libs/index.cjs +0 -1
  71. package/lib/en3/libs/index.js +0 -200
  72. package/lib/en3/loaders/index.cjs +0 -1
  73. package/lib/en3/loaders/index.js +0 -1742
  74. package/lib/en3/misc/index.cjs +0 -10
  75. package/lib/en3/misc/index.js +0 -110
  76. package/lib/en3/utils/index.cjs +0 -1
  77. package/lib/en3/utils/index.js +0 -20
  78. package/lib/en3-C1fLmsjs.cjs +0 -8
  79. package/lib/en3-sK9Z-fp2.js +0 -344
  80. package/lib/tags-6_ETuR75.cjs +0 -1
  81. package/lib/tags-zft1DGBz.js +0 -833
  82. package/lib/traverseMaterials-BlZbRhgW.js +0 -29
  83. package/lib/traverseMaterials-CD_3_56D.cjs +0 -1
@@ -1,1742 +0,0 @@
1
- var ce = (d) => {
2
- throw TypeError(d);
3
- };
4
- var ue = (d, t, e) => t.has(d) || ce("Cannot " + e);
5
- var S = (d, t, e) => (ue(d, t, "read from private field"), e ? e.call(d) : t.get(d)), j = (d, t, e) => t.has(d) ? ce("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(d) : t.set(d, e), Z = (d, t, e, r) => (ue(d, t, "write to private field"), r ? r.call(d, e) : t.set(d, e), e);
6
- var le = (d, t, e) => new Promise((r, n) => {
7
- var s = (o) => {
8
- try {
9
- a(e.next(o));
10
- } catch (c) {
11
- n(c);
12
- }
13
- }, i = (o) => {
14
- try {
15
- a(e.throw(o));
16
- } catch (c) {
17
- n(c);
18
- }
19
- }, a = (o) => o.done ? r(o.value) : Promise.resolve(o.value).then(s, i);
20
- a((e = e.apply(d, t)).next());
21
- });
22
- import { TrianglesDrawMode as Fe, TriangleFanDrawMode as re, TriangleStripDrawMode as Le, Loader as Pe, LoaderUtils as X, FileLoader as _e, Color as G, LinearSRGBColorSpace as I, SpotLight as ke, PointLight as He, DirectionalLight as Ge, MeshBasicMaterial as V, SRGBColorSpace as z, MeshPhysicalMaterial as y, Vector2 as Se, Matrix4 as Y, Vector3 as B, Quaternion as Me, InstancedMesh as Be, InstancedBufferAttribute as Ue, Object3D as ye, TextureLoader as we, ImageBitmapLoader as ve, BufferAttribute as J, InterleavedBuffer as je, InterleavedBufferAttribute as Ke, LinearFilter as be, LinearMipmapLinearFilter as Ne, RepeatWrapping as ie, PointsMaterial as Ve, Material as $, LineBasicMaterial as Xe, MeshStandardMaterial as Ie, DoubleSide as ze, PropertyBinding as qe, BufferGeometry as We, SkinnedMesh as Ye, Mesh as Qe, LineSegments as Ze, Line as Je, LineLoop as $e, Points as et, Group as ee, PerspectiveCamera as tt, MathUtils as nt, OrthographicCamera as st, Skeleton as rt, AnimationClip as it, Bone as ot, InterpolateLinear as Oe, ColorManagement as de, NearestFilter as at, NearestMipmapNearestFilter as ct, LinearMipmapNearestFilter as ut, NearestMipmapLinearFilter as lt, ClampToEdgeWrapping as dt, MirroredRepeatWrapping as ft, InterpolateDiscrete as ht, FrontSide as pt, Texture as fe, VectorKeyframeTrack as he, NumberKeyframeTrack as pe, QuaternionKeyframeTrack as me, Box3 as mt, Sphere as At, Interpolant as gt } from "three";
23
- import { e as N, a as b, d as Ae } from "../../en3-sK9Z-fp2.js";
24
- function ge(d, t) {
25
- if (t === Fe)
26
- return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."), d;
27
- if (t === re || t === Le) {
28
- let e = d.getIndex();
29
- if (e === null) {
30
- const i = [], a = d.getAttribute("position");
31
- if (a !== void 0) {
32
- for (let o = 0; o < a.count; o++)
33
- i.push(o);
34
- d.setIndex(i), e = d.getIndex();
35
- } else
36
- return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."), d;
37
- }
38
- const r = e.count - 2, n = [];
39
- if (t === re)
40
- for (let i = 1; i <= r; i++)
41
- n.push(e.getX(0)), n.push(e.getX(i)), n.push(e.getX(i + 1));
42
- else
43
- for (let i = 0; i < r; i++)
44
- i % 2 === 0 ? (n.push(e.getX(i)), n.push(e.getX(i + 1)), n.push(e.getX(i + 2))) : (n.push(e.getX(i + 2)), n.push(e.getX(i + 1)), n.push(e.getX(i)));
45
- n.length / 3 !== r && console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");
46
- const s = d.clone();
47
- return s.setIndex(n), s.clearGroups(), s;
48
- } else
49
- return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:", t), d;
50
- }
51
- class Tt extends Pe {
52
- constructor(t) {
53
- super(t), this.dracoLoader = null, this.ktx2Loader = null, this.meshoptDecoder = null, this.pluginCallbacks = [], this.register(function(e) {
54
- return new _t(e);
55
- }), this.register(function(e) {
56
- return new St(e);
57
- }), this.register(function(e) {
58
- return new Dt(e);
59
- }), this.register(function(e) {
60
- return new Ft(e);
61
- }), this.register(function(e) {
62
- return new Pt(e);
63
- }), this.register(function(e) {
64
- return new yt(e);
65
- }), this.register(function(e) {
66
- return new wt(e);
67
- }), this.register(function(e) {
68
- return new bt(e);
69
- }), this.register(function(e) {
70
- return new Nt(e);
71
- }), this.register(function(e) {
72
- return new Lt(e);
73
- }), this.register(function(e) {
74
- return new It(e);
75
- }), this.register(function(e) {
76
- return new Mt(e);
77
- }), this.register(function(e) {
78
- return new Ct(e);
79
- }), this.register(function(e) {
80
- return new Ot(e);
81
- }), this.register(function(e) {
82
- return new Rt(e);
83
- }), this.register(function(e) {
84
- return new kt(e);
85
- }), this.register(function(e) {
86
- return new Ht(e);
87
- });
88
- }
89
- load(t, e, r, n) {
90
- const s = this;
91
- let i;
92
- if (this.resourcePath !== "")
93
- i = this.resourcePath;
94
- else if (this.path !== "") {
95
- const c = X.extractUrlBase(t);
96
- i = X.resolveURL(c, this.path);
97
- } else
98
- i = X.extractUrlBase(t);
99
- this.manager.itemStart(t);
100
- const a = function(c) {
101
- n ? n(c) : console.error(c), s.manager.itemError(t), s.manager.itemEnd(t);
102
- }, o = new _e(this.manager);
103
- o.setPath(this.path), o.setResponseType("arraybuffer"), o.setRequestHeader(this.requestHeader), o.setWithCredentials(this.withCredentials), o.load(t, function(c) {
104
- try {
105
- s.parse(c, i, function(l) {
106
- e(l), s.manager.itemEnd(t);
107
- }, a);
108
- } catch (l) {
109
- a(l);
110
- }
111
- }, r, a);
112
- }
113
- setDRACOLoader(t) {
114
- return this.dracoLoader = t, this;
115
- }
116
- setDDSLoader() {
117
- throw new Error(
118
- 'THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".'
119
- );
120
- }
121
- setKTX2Loader(t) {
122
- return this.ktx2Loader = t, this;
123
- }
124
- setMeshoptDecoder(t) {
125
- return this.meshoptDecoder = t, this;
126
- }
127
- register(t) {
128
- return this.pluginCallbacks.indexOf(t) === -1 && this.pluginCallbacks.push(t), this;
129
- }
130
- unregister(t) {
131
- return this.pluginCallbacks.indexOf(t) !== -1 && this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(t), 1), this;
132
- }
133
- parse(t, e, r, n) {
134
- let s;
135
- const i = {}, a = {}, o = new TextDecoder();
136
- if (typeof t == "string")
137
- s = JSON.parse(t);
138
- else if (t instanceof ArrayBuffer)
139
- if (o.decode(new Uint8Array(t, 0, 4)) === Ce) {
140
- try {
141
- i[A.KHR_BINARY_GLTF] = new Gt(t);
142
- } catch (u) {
143
- n && n(u);
144
- return;
145
- }
146
- s = JSON.parse(i[A.KHR_BINARY_GLTF].content);
147
- } else
148
- s = JSON.parse(o.decode(t));
149
- else
150
- s = t;
151
- if (s.asset === void 0 || s.asset.version[0] < 2) {
152
- n && n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));
153
- return;
154
- }
155
- const c = new Zt(s, {
156
- path: e || this.resourcePath || "",
157
- crossOrigin: this.crossOrigin,
158
- requestHeader: this.requestHeader,
159
- manager: this.manager,
160
- ktx2Loader: this.ktx2Loader,
161
- meshoptDecoder: this.meshoptDecoder
162
- });
163
- c.fileLoader.setRequestHeader(this.requestHeader);
164
- for (let l = 0; l < this.pluginCallbacks.length; l++) {
165
- const u = this.pluginCallbacks[l](c);
166
- u.name || console.error("THREE.GLTFLoader: Invalid plugin found: missing name"), a[u.name] = u, i[u.name] = !0;
167
- }
168
- if (s.extensionsUsed)
169
- for (let l = 0; l < s.extensionsUsed.length; ++l) {
170
- const u = s.extensionsUsed[l], f = s.extensionsRequired || [];
171
- switch (u) {
172
- case A.KHR_MATERIALS_UNLIT:
173
- i[u] = new Et();
174
- break;
175
- case A.KHR_DRACO_MESH_COMPRESSION:
176
- i[u] = new Bt(s, this.dracoLoader);
177
- break;
178
- case A.KHR_TEXTURE_TRANSFORM:
179
- i[u] = new Ut();
180
- break;
181
- case A.KHR_MESH_QUANTIZATION:
182
- i[u] = new vt();
183
- break;
184
- default:
185
- f.indexOf(u) >= 0 && a[u] === void 0 && console.warn('THREE.GLTFLoader: Unknown extension "' + u + '".');
186
- }
187
- }
188
- c.setExtensions(i), c.setPlugins(a), c.parse(r, n);
189
- }
190
- parseAsync(t, e) {
191
- const r = this;
192
- return new Promise(function(n, s) {
193
- r.parse(t, e, n, s);
194
- });
195
- }
196
- }
197
- function xt() {
198
- let d = {};
199
- return {
200
- get: function(t) {
201
- return d[t];
202
- },
203
- add: function(t, e) {
204
- d[t] = e;
205
- },
206
- remove: function(t) {
207
- delete d[t];
208
- },
209
- removeAll: function() {
210
- d = {};
211
- }
212
- };
213
- }
214
- const A = {
215
- KHR_BINARY_GLTF: "KHR_binary_glTF",
216
- KHR_DRACO_MESH_COMPRESSION: "KHR_draco_mesh_compression",
217
- KHR_LIGHTS_PUNCTUAL: "KHR_lights_punctual",
218
- KHR_MATERIALS_CLEARCOAT: "KHR_materials_clearcoat",
219
- KHR_MATERIALS_DISPERSION: "KHR_materials_dispersion",
220
- KHR_MATERIALS_IOR: "KHR_materials_ior",
221
- KHR_MATERIALS_SHEEN: "KHR_materials_sheen",
222
- KHR_MATERIALS_SPECULAR: "KHR_materials_specular",
223
- KHR_MATERIALS_TRANSMISSION: "KHR_materials_transmission",
224
- KHR_MATERIALS_IRIDESCENCE: "KHR_materials_iridescence",
225
- KHR_MATERIALS_ANISOTROPY: "KHR_materials_anisotropy",
226
- KHR_MATERIALS_UNLIT: "KHR_materials_unlit",
227
- KHR_MATERIALS_VOLUME: "KHR_materials_volume",
228
- KHR_TEXTURE_BASISU: "KHR_texture_basisu",
229
- KHR_TEXTURE_TRANSFORM: "KHR_texture_transform",
230
- KHR_MESH_QUANTIZATION: "KHR_mesh_quantization",
231
- KHR_MATERIALS_EMISSIVE_STRENGTH: "KHR_materials_emissive_strength",
232
- EXT_MATERIALS_BUMP: "EXT_materials_bump",
233
- EXT_TEXTURE_WEBP: "EXT_texture_webp",
234
- EXT_TEXTURE_AVIF: "EXT_texture_avif",
235
- EXT_MESHOPT_COMPRESSION: "EXT_meshopt_compression",
236
- EXT_MESH_GPU_INSTANCING: "EXT_mesh_gpu_instancing"
237
- };
238
- class Rt {
239
- constructor(t) {
240
- this.parser = t, this.name = A.KHR_LIGHTS_PUNCTUAL, this.cache = { refs: {}, uses: {} };
241
- }
242
- _markDefs() {
243
- const t = this.parser, e = this.parser.json.nodes || [];
244
- for (let r = 0, n = e.length; r < n; r++) {
245
- const s = e[r];
246
- s.extensions && s.extensions[this.name] && s.extensions[this.name].light !== void 0 && t._addNodeRef(this.cache, s.extensions[this.name].light);
247
- }
248
- }
249
- _loadLight(t) {
250
- const e = this.parser, r = "light:" + t;
251
- let n = e.cache.get(r);
252
- if (n) return n;
253
- const s = e.json, o = ((s.extensions && s.extensions[this.name] || {}).lights || [])[t];
254
- let c;
255
- const l = new G(16777215);
256
- o.color !== void 0 && l.setRGB(o.color[0], o.color[1], o.color[2], I);
257
- const u = o.range !== void 0 ? o.range : 0;
258
- switch (o.type) {
259
- case "directional":
260
- c = new Ge(l), c.target.position.set(0, 0, -1), c.add(c.target);
261
- break;
262
- case "point":
263
- c = new He(l), c.distance = u;
264
- break;
265
- case "spot":
266
- c = new ke(l), c.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, c.angle = o.spot.outerConeAngle, c.penumbra = 1 - o.spot.innerConeAngle / o.spot.outerConeAngle, c.target.position.set(0, 0, -1), c.add(c.target);
267
- break;
268
- default:
269
- throw new Error("THREE.GLTFLoader: Unexpected light type: " + o.type);
270
- }
271
- return c.position.set(0, 0, 0), c.decay = 2, w(c, o), o.intensity !== void 0 && (c.intensity = o.intensity), c.name = e.createUniqueName(o.name || "light_" + t), n = Promise.resolve(c), e.cache.add(r, n), n;
272
- }
273
- getDependency(t, e) {
274
- if (t === "light")
275
- return this._loadLight(e);
276
- }
277
- createNodeAttachment(t) {
278
- const e = this, r = this.parser, s = r.json.nodes[t], a = (s.extensions && s.extensions[this.name] || {}).light;
279
- return a === void 0 ? null : this._loadLight(a).then(function(o) {
280
- return r._getNodeRef(e.cache, a, o);
281
- });
282
- }
283
- }
284
- class Et {
285
- constructor() {
286
- this.name = A.KHR_MATERIALS_UNLIT;
287
- }
288
- getMaterialType() {
289
- return V;
290
- }
291
- extendParams(t, e, r) {
292
- const n = [];
293
- t.color = new G(1, 1, 1), t.opacity = 1;
294
- const s = e.pbrMetallicRoughness;
295
- if (s) {
296
- if (Array.isArray(s.baseColorFactor)) {
297
- const i = s.baseColorFactor;
298
- t.color.setRGB(i[0], i[1], i[2], I), t.opacity = i[3];
299
- }
300
- s.baseColorTexture !== void 0 && n.push(r.assignTexture(t, "map", s.baseColorTexture, z));
301
- }
302
- return Promise.all(n);
303
- }
304
- }
305
- class Lt {
306
- constructor(t) {
307
- this.parser = t, this.name = A.KHR_MATERIALS_EMISSIVE_STRENGTH;
308
- }
309
- extendMaterialParams(t, e) {
310
- const n = this.parser.json.materials[t];
311
- if (!n.extensions || !n.extensions[this.name])
312
- return Promise.resolve();
313
- const s = n.extensions[this.name].emissiveStrength;
314
- return s !== void 0 && (e.emissiveIntensity = s), Promise.resolve();
315
- }
316
- }
317
- class _t {
318
- constructor(t) {
319
- this.parser = t, this.name = A.KHR_MATERIALS_CLEARCOAT;
320
- }
321
- getMaterialType(t) {
322
- const r = this.parser.json.materials[t];
323
- return !r.extensions || !r.extensions[this.name] ? null : y;
324
- }
325
- extendMaterialParams(t, e) {
326
- const r = this.parser, n = r.json.materials[t];
327
- if (!n.extensions || !n.extensions[this.name])
328
- return Promise.resolve();
329
- const s = [], i = n.extensions[this.name];
330
- if (i.clearcoatFactor !== void 0 && (e.clearcoat = i.clearcoatFactor), i.clearcoatTexture !== void 0 && s.push(r.assignTexture(e, "clearcoatMap", i.clearcoatTexture)), i.clearcoatRoughnessFactor !== void 0 && (e.clearcoatRoughness = i.clearcoatRoughnessFactor), i.clearcoatRoughnessTexture !== void 0 && s.push(r.assignTexture(e, "clearcoatRoughnessMap", i.clearcoatRoughnessTexture)), i.clearcoatNormalTexture !== void 0 && (s.push(r.assignTexture(e, "clearcoatNormalMap", i.clearcoatNormalTexture)), i.clearcoatNormalTexture.scale !== void 0)) {
331
- const a = i.clearcoatNormalTexture.scale;
332
- e.clearcoatNormalScale = new Se(a, a);
333
- }
334
- return Promise.all(s);
335
- }
336
- }
337
- class St {
338
- constructor(t) {
339
- this.parser = t, this.name = A.KHR_MATERIALS_DISPERSION;
340
- }
341
- getMaterialType(t) {
342
- const r = this.parser.json.materials[t];
343
- return !r.extensions || !r.extensions[this.name] ? null : y;
344
- }
345
- extendMaterialParams(t, e) {
346
- const n = this.parser.json.materials[t];
347
- if (!n.extensions || !n.extensions[this.name])
348
- return Promise.resolve();
349
- const s = n.extensions[this.name];
350
- return e.dispersion = s.dispersion !== void 0 ? s.dispersion : 0, Promise.resolve();
351
- }
352
- }
353
- class Mt {
354
- constructor(t) {
355
- this.parser = t, this.name = A.KHR_MATERIALS_IRIDESCENCE;
356
- }
357
- getMaterialType(t) {
358
- const r = this.parser.json.materials[t];
359
- return !r.extensions || !r.extensions[this.name] ? null : y;
360
- }
361
- extendMaterialParams(t, e) {
362
- const r = this.parser, n = r.json.materials[t];
363
- if (!n.extensions || !n.extensions[this.name])
364
- return Promise.resolve();
365
- const s = [], i = n.extensions[this.name];
366
- return i.iridescenceFactor !== void 0 && (e.iridescence = i.iridescenceFactor), i.iridescenceTexture !== void 0 && s.push(r.assignTexture(e, "iridescenceMap", i.iridescenceTexture)), i.iridescenceIor !== void 0 && (e.iridescenceIOR = i.iridescenceIor), e.iridescenceThicknessRange === void 0 && (e.iridescenceThicknessRange = [100, 400]), i.iridescenceThicknessMinimum !== void 0 && (e.iridescenceThicknessRange[0] = i.iridescenceThicknessMinimum), i.iridescenceThicknessMaximum !== void 0 && (e.iridescenceThicknessRange[1] = i.iridescenceThicknessMaximum), i.iridescenceThicknessTexture !== void 0 && s.push(r.assignTexture(e, "iridescenceThicknessMap", i.iridescenceThicknessTexture)), Promise.all(s);
367
- }
368
- }
369
- class yt {
370
- constructor(t) {
371
- this.parser = t, this.name = A.KHR_MATERIALS_SHEEN;
372
- }
373
- getMaterialType(t) {
374
- const r = this.parser.json.materials[t];
375
- return !r.extensions || !r.extensions[this.name] ? null : y;
376
- }
377
- extendMaterialParams(t, e) {
378
- const r = this.parser, n = r.json.materials[t];
379
- if (!n.extensions || !n.extensions[this.name])
380
- return Promise.resolve();
381
- const s = [];
382
- e.sheenColor = new G(0, 0, 0), e.sheenRoughness = 0, e.sheen = 1;
383
- const i = n.extensions[this.name];
384
- if (i.sheenColorFactor !== void 0) {
385
- const a = i.sheenColorFactor;
386
- e.sheenColor.setRGB(a[0], a[1], a[2], I);
387
- }
388
- return i.sheenRoughnessFactor !== void 0 && (e.sheenRoughness = i.sheenRoughnessFactor), i.sheenColorTexture !== void 0 && s.push(r.assignTexture(e, "sheenColorMap", i.sheenColorTexture, z)), i.sheenRoughnessTexture !== void 0 && s.push(r.assignTexture(e, "sheenRoughnessMap", i.sheenRoughnessTexture)), Promise.all(s);
389
- }
390
- }
391
- class wt {
392
- constructor(t) {
393
- this.parser = t, this.name = A.KHR_MATERIALS_TRANSMISSION;
394
- }
395
- getMaterialType(t) {
396
- const r = this.parser.json.materials[t];
397
- return !r.extensions || !r.extensions[this.name] ? null : y;
398
- }
399
- extendMaterialParams(t, e) {
400
- const r = this.parser, n = r.json.materials[t];
401
- if (!n.extensions || !n.extensions[this.name])
402
- return Promise.resolve();
403
- const s = [], i = n.extensions[this.name];
404
- return i.transmissionFactor !== void 0 && (e.transmission = i.transmissionFactor), i.transmissionTexture !== void 0 && s.push(r.assignTexture(e, "transmissionMap", i.transmissionTexture)), Promise.all(s);
405
- }
406
- }
407
- class bt {
408
- constructor(t) {
409
- this.parser = t, this.name = A.KHR_MATERIALS_VOLUME;
410
- }
411
- getMaterialType(t) {
412
- const r = this.parser.json.materials[t];
413
- return !r.extensions || !r.extensions[this.name] ? null : y;
414
- }
415
- extendMaterialParams(t, e) {
416
- const r = this.parser, n = r.json.materials[t];
417
- if (!n.extensions || !n.extensions[this.name])
418
- return Promise.resolve();
419
- const s = [], i = n.extensions[this.name];
420
- e.thickness = i.thicknessFactor !== void 0 ? i.thicknessFactor : 0, i.thicknessTexture !== void 0 && s.push(r.assignTexture(e, "thicknessMap", i.thicknessTexture)), e.attenuationDistance = i.attenuationDistance || 1 / 0;
421
- const a = i.attenuationColor || [1, 1, 1];
422
- return e.attenuationColor = new G().setRGB(a[0], a[1], a[2], I), Promise.all(s);
423
- }
424
- }
425
- class Nt {
426
- constructor(t) {
427
- this.parser = t, this.name = A.KHR_MATERIALS_IOR;
428
- }
429
- getMaterialType(t) {
430
- const r = this.parser.json.materials[t];
431
- return !r.extensions || !r.extensions[this.name] ? null : y;
432
- }
433
- extendMaterialParams(t, e) {
434
- const n = this.parser.json.materials[t];
435
- if (!n.extensions || !n.extensions[this.name])
436
- return Promise.resolve();
437
- const s = n.extensions[this.name];
438
- return e.ior = s.ior !== void 0 ? s.ior : 1.5, Promise.resolve();
439
- }
440
- }
441
- class It {
442
- constructor(t) {
443
- this.parser = t, this.name = A.KHR_MATERIALS_SPECULAR;
444
- }
445
- getMaterialType(t) {
446
- const r = this.parser.json.materials[t];
447
- return !r.extensions || !r.extensions[this.name] ? null : y;
448
- }
449
- extendMaterialParams(t, e) {
450
- const r = this.parser, n = r.json.materials[t];
451
- if (!n.extensions || !n.extensions[this.name])
452
- return Promise.resolve();
453
- const s = [], i = n.extensions[this.name];
454
- e.specularIntensity = i.specularFactor !== void 0 ? i.specularFactor : 1, i.specularTexture !== void 0 && s.push(r.assignTexture(e, "specularIntensityMap", i.specularTexture));
455
- const a = i.specularColorFactor || [1, 1, 1];
456
- return e.specularColor = new G().setRGB(a[0], a[1], a[2], I), i.specularColorTexture !== void 0 && s.push(r.assignTexture(e, "specularColorMap", i.specularColorTexture, z)), Promise.all(s);
457
- }
458
- }
459
- class Ot {
460
- constructor(t) {
461
- this.parser = t, this.name = A.EXT_MATERIALS_BUMP;
462
- }
463
- getMaterialType(t) {
464
- const r = this.parser.json.materials[t];
465
- return !r.extensions || !r.extensions[this.name] ? null : y;
466
- }
467
- extendMaterialParams(t, e) {
468
- const r = this.parser, n = r.json.materials[t];
469
- if (!n.extensions || !n.extensions[this.name])
470
- return Promise.resolve();
471
- const s = [], i = n.extensions[this.name];
472
- return e.bumpScale = i.bumpFactor !== void 0 ? i.bumpFactor : 1, i.bumpTexture !== void 0 && s.push(r.assignTexture(e, "bumpMap", i.bumpTexture)), Promise.all(s);
473
- }
474
- }
475
- class Ct {
476
- constructor(t) {
477
- this.parser = t, this.name = A.KHR_MATERIALS_ANISOTROPY;
478
- }
479
- getMaterialType(t) {
480
- const r = this.parser.json.materials[t];
481
- return !r.extensions || !r.extensions[this.name] ? null : y;
482
- }
483
- extendMaterialParams(t, e) {
484
- const r = this.parser, n = r.json.materials[t];
485
- if (!n.extensions || !n.extensions[this.name])
486
- return Promise.resolve();
487
- const s = [], i = n.extensions[this.name];
488
- return i.anisotropyStrength !== void 0 && (e.anisotropy = i.anisotropyStrength), i.anisotropyRotation !== void 0 && (e.anisotropyRotation = i.anisotropyRotation), i.anisotropyTexture !== void 0 && s.push(r.assignTexture(e, "anisotropyMap", i.anisotropyTexture)), Promise.all(s);
489
- }
490
- }
491
- class Dt {
492
- constructor(t) {
493
- this.parser = t, this.name = A.KHR_TEXTURE_BASISU;
494
- }
495
- loadTexture(t) {
496
- const e = this.parser, r = e.json, n = r.textures[t];
497
- if (!n.extensions || !n.extensions[this.name])
498
- return null;
499
- const s = n.extensions[this.name], i = e.options.ktx2Loader;
500
- if (!i) {
501
- if (r.extensionsRequired && r.extensionsRequired.indexOf(this.name) >= 0)
502
- throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");
503
- return null;
504
- }
505
- return e.loadTextureImage(t, s.source, i);
506
- }
507
- }
508
- class Ft {
509
- constructor(t) {
510
- this.parser = t, this.name = A.EXT_TEXTURE_WEBP, this.isSupported = null;
511
- }
512
- loadTexture(t) {
513
- const e = this.name, r = this.parser, n = r.json, s = n.textures[t];
514
- if (!s.extensions || !s.extensions[e])
515
- return null;
516
- const i = s.extensions[e], a = n.images[i.source];
517
- let o = r.textureLoader;
518
- if (a.uri) {
519
- const c = r.options.manager.getHandler(a.uri);
520
- c !== null && (o = c);
521
- }
522
- return this.detectSupport().then(function(c) {
523
- if (c) return r.loadTextureImage(t, i.source, o);
524
- if (n.extensionsRequired && n.extensionsRequired.indexOf(e) >= 0)
525
- throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");
526
- return r.loadTexture(t);
527
- });
528
- }
529
- detectSupport() {
530
- return this.isSupported || (this.isSupported = new Promise(function(t) {
531
- const e = new Image();
532
- e.src = "data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA", e.onload = e.onerror = function() {
533
- t(e.height === 1);
534
- };
535
- })), this.isSupported;
536
- }
537
- }
538
- class Pt {
539
- constructor(t) {
540
- this.parser = t, this.name = A.EXT_TEXTURE_AVIF, this.isSupported = null;
541
- }
542
- loadTexture(t) {
543
- const e = this.name, r = this.parser, n = r.json, s = n.textures[t];
544
- if (!s.extensions || !s.extensions[e])
545
- return null;
546
- const i = s.extensions[e], a = n.images[i.source];
547
- let o = r.textureLoader;
548
- if (a.uri) {
549
- const c = r.options.manager.getHandler(a.uri);
550
- c !== null && (o = c);
551
- }
552
- return this.detectSupport().then(function(c) {
553
- if (c) return r.loadTextureImage(t, i.source, o);
554
- if (n.extensionsRequired && n.extensionsRequired.indexOf(e) >= 0)
555
- throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");
556
- return r.loadTexture(t);
557
- });
558
- }
559
- detectSupport() {
560
- return this.isSupported || (this.isSupported = new Promise(function(t) {
561
- const e = new Image();
562
- e.src = "data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=", e.onload = e.onerror = function() {
563
- t(e.height === 1);
564
- };
565
- })), this.isSupported;
566
- }
567
- }
568
- class kt {
569
- constructor(t) {
570
- this.name = A.EXT_MESHOPT_COMPRESSION, this.parser = t;
571
- }
572
- loadBufferView(t) {
573
- const e = this.parser.json, r = e.bufferViews[t];
574
- if (r.extensions && r.extensions[this.name]) {
575
- const n = r.extensions[this.name], s = this.parser.getDependency("buffer", n.buffer), i = this.parser.options.meshoptDecoder;
576
- if (!i || !i.supported) {
577
- if (e.extensionsRequired && e.extensionsRequired.indexOf(this.name) >= 0)
578
- throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");
579
- return null;
580
- }
581
- return s.then(function(a) {
582
- const o = n.byteOffset || 0, c = n.byteLength || 0, l = n.count, u = n.byteStride, f = new Uint8Array(a, o, c);
583
- return i.decodeGltfBufferAsync ? i.decodeGltfBufferAsync(l, u, f, n.mode, n.filter).then(function(h) {
584
- return h.buffer;
585
- }) : i.ready.then(function() {
586
- const h = new ArrayBuffer(l * u);
587
- return i.decodeGltfBuffer(new Uint8Array(h), l, u, f, n.mode, n.filter), h;
588
- });
589
- });
590
- } else
591
- return null;
592
- }
593
- }
594
- class Ht {
595
- constructor(t) {
596
- this.name = A.EXT_MESH_GPU_INSTANCING, this.parser = t;
597
- }
598
- createNodeMesh(t) {
599
- const e = this.parser.json, r = e.nodes[t];
600
- if (!r.extensions || !r.extensions[this.name] || r.mesh === void 0)
601
- return null;
602
- const n = e.meshes[r.mesh];
603
- for (const c of n.primitives)
604
- if (c.mode !== L.TRIANGLES && c.mode !== L.TRIANGLE_STRIP && c.mode !== L.TRIANGLE_FAN && c.mode !== void 0)
605
- return null;
606
- const i = r.extensions[this.name].attributes, a = [], o = {};
607
- for (const c in i)
608
- a.push(this.parser.getDependency("accessor", i[c]).then((l) => (o[c] = l, o[c])));
609
- return a.length < 1 ? null : (a.push(this.parser.createNodeMesh(t)), Promise.all(a).then((c) => {
610
- const l = c.pop(), u = l.isGroup ? l.children : [l], f = c[0].count, h = [];
611
- for (const p of u) {
612
- const T = new Y(), m = new B(), g = new Me(), R = new B(1, 1, 1), E = new Be(p.geometry, p.material, f);
613
- for (let x = 0; x < f; x++)
614
- o.TRANSLATION && m.fromBufferAttribute(o.TRANSLATION, x), o.ROTATION && g.fromBufferAttribute(o.ROTATION, x), o.SCALE && R.fromBufferAttribute(o.SCALE, x), E.setMatrixAt(x, T.compose(m, g, R));
615
- for (const x in o)
616
- if (x === "_COLOR_0") {
617
- const M = o[x];
618
- E.instanceColor = new Ue(M.array, M.itemSize, M.normalized);
619
- } else x !== "TRANSLATION" && x !== "ROTATION" && x !== "SCALE" && p.geometry.setAttribute(x, o[x]);
620
- ye.prototype.copy.call(E, p), this.parser.assignFinalMaterial(E), h.push(E);
621
- }
622
- return l.isGroup ? (l.clear(), l.add(...h), l) : h[0];
623
- }));
624
- }
625
- }
626
- const Ce = "glTF", K = 12, Te = { JSON: 1313821514, BIN: 5130562 };
627
- class Gt {
628
- constructor(t) {
629
- this.name = A.KHR_BINARY_GLTF, this.content = null, this.body = null;
630
- const e = new DataView(t, 0, K), r = new TextDecoder();
631
- if (this.header = {
632
- magic: r.decode(new Uint8Array(t.slice(0, 4))),
633
- version: e.getUint32(4, !0),
634
- length: e.getUint32(8, !0)
635
- }, this.header.magic !== Ce)
636
- throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");
637
- if (this.header.version < 2)
638
- throw new Error("THREE.GLTFLoader: Legacy binary file detected.");
639
- const n = this.header.length - K, s = new DataView(t, K);
640
- let i = 0;
641
- for (; i < n; ) {
642
- const a = s.getUint32(i, !0);
643
- i += 4;
644
- const o = s.getUint32(i, !0);
645
- if (i += 4, o === Te.JSON) {
646
- const c = new Uint8Array(t, K + i, a);
647
- this.content = r.decode(c);
648
- } else if (o === Te.BIN) {
649
- const c = K + i;
650
- this.body = t.slice(c, c + a);
651
- }
652
- i += a;
653
- }
654
- if (this.content === null)
655
- throw new Error("THREE.GLTFLoader: JSON content not found.");
656
- }
657
- }
658
- class Bt {
659
- constructor(t, e) {
660
- if (!e)
661
- throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");
662
- this.name = A.KHR_DRACO_MESH_COMPRESSION, this.json = t, this.dracoLoader = e, this.dracoLoader.preload();
663
- }
664
- decodePrimitive(t, e) {
665
- const r = this.json, n = this.dracoLoader, s = t.extensions[this.name].bufferView, i = t.extensions[this.name].attributes, a = {}, o = {}, c = {};
666
- for (const l in i) {
667
- const u = oe[l] || l.toLowerCase();
668
- a[u] = i[l];
669
- }
670
- for (const l in t.attributes) {
671
- const u = oe[l] || l.toLowerCase();
672
- if (i[l] !== void 0) {
673
- const f = r.accessors[t.attributes[l]], h = U[f.componentType];
674
- c[u] = h.name, o[u] = f.normalized === !0;
675
- }
676
- }
677
- return e.getDependency("bufferView", s).then(function(l) {
678
- return new Promise(function(u, f) {
679
- n.decodeDracoFile(l, function(h) {
680
- for (const p in h.attributes) {
681
- const T = h.attributes[p], m = o[p];
682
- m !== void 0 && (T.normalized = m);
683
- }
684
- u(h);
685
- }, a, c, I, f);
686
- });
687
- });
688
- }
689
- }
690
- class Ut {
691
- constructor() {
692
- this.name = A.KHR_TEXTURE_TRANSFORM;
693
- }
694
- extendTexture(t, e) {
695
- return (e.texCoord === void 0 || e.texCoord === t.channel) && e.offset === void 0 && e.rotation === void 0 && e.scale === void 0 || (t = t.clone(), e.texCoord !== void 0 && (t.channel = e.texCoord), e.offset !== void 0 && t.offset.fromArray(e.offset), e.rotation !== void 0 && (t.rotation = e.rotation), e.scale !== void 0 && t.repeat.fromArray(e.scale), t.needsUpdate = !0), t;
696
- }
697
- }
698
- class vt {
699
- constructor() {
700
- this.name = A.KHR_MESH_QUANTIZATION;
701
- }
702
- }
703
- class De extends gt {
704
- constructor(t, e, r, n) {
705
- super(t, e, r, n);
706
- }
707
- copySampleValue_(t) {
708
- const e = this.resultBuffer, r = this.sampleValues, n = this.valueSize, s = t * n * 3 + n;
709
- for (let i = 0; i !== n; i++)
710
- e[i] = r[s + i];
711
- return e;
712
- }
713
- interpolate_(t, e, r, n) {
714
- const s = this.resultBuffer, i = this.sampleValues, a = this.valueSize, o = a * 2, c = a * 3, l = n - e, u = (r - e) / l, f = u * u, h = f * u, p = t * c, T = p - c, m = -2 * h + 3 * f, g = h - f, R = 1 - m, E = g - f + u;
715
- for (let x = 0; x !== a; x++) {
716
- const M = i[T + x + a], O = i[T + x + o] * l, _ = i[p + x + a], v = i[p + x] * l;
717
- s[x] = R * M + E * O + m * _ + g * v;
718
- }
719
- return s;
720
- }
721
- }
722
- const jt = new Me();
723
- class Kt extends De {
724
- interpolate_(t, e, r, n) {
725
- const s = super.interpolate_(t, e, r, n);
726
- return jt.fromArray(s).normalize().toArray(s), s;
727
- }
728
- }
729
- const L = {
730
- FLOAT: 5126,
731
- //FLOAT_MAT2: 35674,
732
- FLOAT_MAT3: 35675,
733
- FLOAT_MAT4: 35676,
734
- FLOAT_VEC2: 35664,
735
- FLOAT_VEC3: 35665,
736
- FLOAT_VEC4: 35666,
737
- LINEAR: 9729,
738
- REPEAT: 10497,
739
- SAMPLER_2D: 35678,
740
- POINTS: 0,
741
- LINES: 1,
742
- LINE_LOOP: 2,
743
- LINE_STRIP: 3,
744
- TRIANGLES: 4,
745
- TRIANGLE_STRIP: 5,
746
- TRIANGLE_FAN: 6,
747
- UNSIGNED_BYTE: 5121,
748
- UNSIGNED_SHORT: 5123
749
- }, U = {
750
- 5120: Int8Array,
751
- 5121: Uint8Array,
752
- 5122: Int16Array,
753
- 5123: Uint16Array,
754
- 5125: Uint32Array,
755
- 5126: Float32Array
756
- }, xe = {
757
- 9728: at,
758
- 9729: be,
759
- 9984: ct,
760
- 9985: ut,
761
- 9986: lt,
762
- 9987: Ne
763
- }, Re = {
764
- 33071: dt,
765
- 33648: ft,
766
- 10497: ie
767
- }, te = {
768
- SCALAR: 1,
769
- VEC2: 2,
770
- VEC3: 3,
771
- VEC4: 4,
772
- MAT2: 4,
773
- MAT3: 9,
774
- MAT4: 16
775
- }, oe = {
776
- POSITION: "position",
777
- NORMAL: "normal",
778
- TANGENT: "tangent",
779
- TEXCOORD_0: "uv",
780
- TEXCOORD_1: "uv1",
781
- TEXCOORD_2: "uv2",
782
- TEXCOORD_3: "uv3",
783
- COLOR_0: "color",
784
- WEIGHTS_0: "skinWeight",
785
- JOINTS_0: "skinIndex"
786
- }, D = {
787
- scale: "scale",
788
- translation: "position",
789
- rotation: "quaternion",
790
- weights: "morphTargetInfluences"
791
- }, Vt = {
792
- CUBICSPLINE: void 0,
793
- // We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each
794
- // keyframe track will be initialized with a default interpolation type, then modified.
795
- LINEAR: Oe,
796
- STEP: ht
797
- }, ne = {
798
- OPAQUE: "OPAQUE",
799
- MASK: "MASK",
800
- BLEND: "BLEND"
801
- };
802
- function Xt(d) {
803
- return d.DefaultMaterial === void 0 && (d.DefaultMaterial = new Ie({
804
- color: 16777215,
805
- emissive: 0,
806
- metalness: 1,
807
- roughness: 1,
808
- transparent: !1,
809
- depthTest: !0,
810
- side: pt
811
- })), d.DefaultMaterial;
812
- }
813
- function P(d, t, e) {
814
- for (const r in e.extensions)
815
- d[r] === void 0 && (t.userData.gltfExtensions = t.userData.gltfExtensions || {}, t.userData.gltfExtensions[r] = e.extensions[r]);
816
- }
817
- function w(d, t) {
818
- t.extras !== void 0 && (typeof t.extras == "object" ? Object.assign(d.userData, t.extras) : console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, " + t.extras));
819
- }
820
- function zt(d, t, e) {
821
- let r = !1, n = !1, s = !1;
822
- for (let c = 0, l = t.length; c < l; c++) {
823
- const u = t[c];
824
- if (u.POSITION !== void 0 && (r = !0), u.NORMAL !== void 0 && (n = !0), u.COLOR_0 !== void 0 && (s = !0), r && n && s) break;
825
- }
826
- if (!r && !n && !s) return Promise.resolve(d);
827
- const i = [], a = [], o = [];
828
- for (let c = 0, l = t.length; c < l; c++) {
829
- const u = t[c];
830
- if (r) {
831
- const f = u.POSITION !== void 0 ? e.getDependency("accessor", u.POSITION) : d.attributes.position;
832
- i.push(f);
833
- }
834
- if (n) {
835
- const f = u.NORMAL !== void 0 ? e.getDependency("accessor", u.NORMAL) : d.attributes.normal;
836
- a.push(f);
837
- }
838
- if (s) {
839
- const f = u.COLOR_0 !== void 0 ? e.getDependency("accessor", u.COLOR_0) : d.attributes.color;
840
- o.push(f);
841
- }
842
- }
843
- return Promise.all([
844
- Promise.all(i),
845
- Promise.all(a),
846
- Promise.all(o)
847
- ]).then(function(c) {
848
- const l = c[0], u = c[1], f = c[2];
849
- return r && (d.morphAttributes.position = l), n && (d.morphAttributes.normal = u), s && (d.morphAttributes.color = f), d.morphTargetsRelative = !0, d;
850
- });
851
- }
852
- function qt(d, t) {
853
- if (d.updateMorphTargets(), t.weights !== void 0)
854
- for (let e = 0, r = t.weights.length; e < r; e++)
855
- d.morphTargetInfluences[e] = t.weights[e];
856
- if (t.extras && Array.isArray(t.extras.targetNames)) {
857
- const e = t.extras.targetNames;
858
- if (d.morphTargetInfluences.length === e.length) {
859
- d.morphTargetDictionary = {};
860
- for (let r = 0, n = e.length; r < n; r++)
861
- d.morphTargetDictionary[e[r]] = r;
862
- } else
863
- console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.");
864
- }
865
- }
866
- function Wt(d) {
867
- let t;
868
- const e = d.extensions && d.extensions[A.KHR_DRACO_MESH_COMPRESSION];
869
- if (e ? t = "draco:" + e.bufferView + ":" + e.indices + ":" + se(e.attributes) : t = d.indices + ":" + se(d.attributes) + ":" + d.mode, d.targets !== void 0)
870
- for (let r = 0, n = d.targets.length; r < n; r++)
871
- t += ":" + se(d.targets[r]);
872
- return t;
873
- }
874
- function se(d) {
875
- let t = "";
876
- const e = Object.keys(d).sort();
877
- for (let r = 0, n = e.length; r < n; r++)
878
- t += e[r] + ":" + d[e[r]] + ";";
879
- return t;
880
- }
881
- function ae(d) {
882
- switch (d) {
883
- case Int8Array:
884
- return 1 / 127;
885
- case Uint8Array:
886
- return 1 / 255;
887
- case Int16Array:
888
- return 1 / 32767;
889
- case Uint16Array:
890
- return 1 / 65535;
891
- default:
892
- throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.");
893
- }
894
- }
895
- function Yt(d) {
896
- return d.search(/\.jpe?g($|\?)/i) > 0 || d.search(/^data\:image\/jpeg/) === 0 ? "image/jpeg" : d.search(/\.webp($|\?)/i) > 0 || d.search(/^data\:image\/webp/) === 0 ? "image/webp" : "image/png";
897
- }
898
- const Qt = new Y();
899
- class Zt {
900
- constructor(t = {}, e = {}) {
901
- this.json = t, this.extensions = {}, this.plugins = {}, this.options = e, 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 = {};
902
- let r = !1, n = -1, s = !1, i = -1;
903
- if (typeof navigator != "undefined") {
904
- const a = navigator.userAgent;
905
- r = /^((?!chrome|android).)*safari/i.test(a) === !0;
906
- const o = a.match(/Version\/(\d+)/);
907
- n = r && o ? parseInt(o[1], 10) : -1, s = a.indexOf("Firefox") > -1, i = s ? a.match(/Firefox\/([0-9]+)\./)[1] : -1;
908
- }
909
- typeof createImageBitmap == "undefined" || r && n < 17 || s && i < 98 ? this.textureLoader = new we(this.options.manager) : this.textureLoader = new ve(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.textureLoader.setRequestHeader(this.options.requestHeader), this.fileLoader = new _e(this.options.manager), this.fileLoader.setResponseType("arraybuffer"), this.options.crossOrigin === "use-credentials" && this.fileLoader.setWithCredentials(!0);
910
- }
911
- setExtensions(t) {
912
- this.extensions = t;
913
- }
914
- setPlugins(t) {
915
- this.plugins = t;
916
- }
917
- parse(t, e) {
918
- const r = this, n = this.json, s = this.extensions;
919
- this.cache.removeAll(), this.nodeCache = {}, this._invokeAll(function(i) {
920
- return i._markDefs && i._markDefs();
921
- }), Promise.all(this._invokeAll(function(i) {
922
- return i.beforeRoot && i.beforeRoot();
923
- })).then(function() {
924
- return Promise.all([
925
- r.getDependencies("scene"),
926
- r.getDependencies("animation"),
927
- r.getDependencies("camera")
928
- ]);
929
- }).then(function(i) {
930
- const a = {
931
- scene: i[0][n.scene || 0],
932
- scenes: i[0],
933
- animations: i[1],
934
- cameras: i[2],
935
- asset: n.asset,
936
- parser: r,
937
- userData: {}
938
- };
939
- return P(s, a, n), w(a, n), Promise.all(r._invokeAll(function(o) {
940
- return o.afterRoot && o.afterRoot(a);
941
- })).then(function() {
942
- for (const o of a.scenes)
943
- o.updateMatrixWorld();
944
- t(a);
945
- });
946
- }).catch(e);
947
- }
948
- /**
949
- * Marks the special nodes/meshes in json for efficient parse.
950
- */
951
- _markDefs() {
952
- const t = this.json.nodes || [], e = this.json.skins || [], r = this.json.meshes || [];
953
- for (let n = 0, s = e.length; n < s; n++) {
954
- const i = e[n].joints;
955
- for (let a = 0, o = i.length; a < o; a++)
956
- t[i[a]].isBone = !0;
957
- }
958
- for (let n = 0, s = t.length; n < s; n++) {
959
- const i = t[n];
960
- i.mesh !== void 0 && (this._addNodeRef(this.meshCache, i.mesh), i.skin !== void 0 && (r[i.mesh].isSkinnedMesh = !0)), i.camera !== void 0 && this._addNodeRef(this.cameraCache, i.camera);
961
- }
962
- }
963
- /**
964
- * Counts references to shared node / Object3D resources. These resources
965
- * can be reused, or "instantiated", at multiple nodes in the scene
966
- * hierarchy. Mesh, Camera, and Light instances are instantiated and must
967
- * be marked. Non-scenegraph resources (like Materials, Geometries, and
968
- * Textures) can be reused directly and are not marked here.
969
- *
970
- * Example: CesiumMilkTruck sample model reuses "Wheel" meshes.
971
- */
972
- _addNodeRef(t, e) {
973
- e !== void 0 && (t.refs[e] === void 0 && (t.refs[e] = t.uses[e] = 0), t.refs[e]++);
974
- }
975
- /** Returns a reference to a shared resource, cloning it if necessary. */
976
- _getNodeRef(t, e, r) {
977
- if (t.refs[e] <= 1) return r;
978
- const n = r.clone(), s = (i, a) => {
979
- const o = this.associations.get(i);
980
- o != null && this.associations.set(a, o);
981
- for (const [c, l] of i.children.entries())
982
- s(l, a.children[c]);
983
- };
984
- return s(r, n), n.name += "_instance_" + t.uses[e]++, n;
985
- }
986
- _invokeOne(t) {
987
- const e = Object.values(this.plugins);
988
- e.push(this);
989
- for (let r = 0; r < e.length; r++) {
990
- const n = t(e[r]);
991
- if (n) return n;
992
- }
993
- return null;
994
- }
995
- _invokeAll(t) {
996
- const e = Object.values(this.plugins);
997
- e.unshift(this);
998
- const r = [];
999
- for (let n = 0; n < e.length; n++) {
1000
- const s = t(e[n]);
1001
- s && r.push(s);
1002
- }
1003
- return r;
1004
- }
1005
- /**
1006
- * Requests the specified dependency asynchronously, with caching.
1007
- * @param {string} type
1008
- * @param {number} index
1009
- * @return {Promise<Object3D|Material|THREE.Texture|AnimationClip|ArrayBuffer|Object>}
1010
- */
1011
- getDependency(t, e) {
1012
- const r = t + ":" + e;
1013
- let n = this.cache.get(r);
1014
- if (!n) {
1015
- switch (t) {
1016
- case "scene":
1017
- n = this.loadScene(e);
1018
- break;
1019
- case "node":
1020
- n = this._invokeOne(function(s) {
1021
- return s.loadNode && s.loadNode(e);
1022
- });
1023
- break;
1024
- case "mesh":
1025
- n = this._invokeOne(function(s) {
1026
- return s.loadMesh && s.loadMesh(e);
1027
- });
1028
- break;
1029
- case "accessor":
1030
- n = this.loadAccessor(e);
1031
- break;
1032
- case "bufferView":
1033
- n = this._invokeOne(function(s) {
1034
- return s.loadBufferView && s.loadBufferView(e);
1035
- });
1036
- break;
1037
- case "buffer":
1038
- n = this.loadBuffer(e);
1039
- break;
1040
- case "material":
1041
- n = this._invokeOne(function(s) {
1042
- return s.loadMaterial && s.loadMaterial(e);
1043
- });
1044
- break;
1045
- case "texture":
1046
- n = this._invokeOne(function(s) {
1047
- return s.loadTexture && s.loadTexture(e);
1048
- });
1049
- break;
1050
- case "skin":
1051
- n = this.loadSkin(e);
1052
- break;
1053
- case "animation":
1054
- n = this._invokeOne(function(s) {
1055
- return s.loadAnimation && s.loadAnimation(e);
1056
- });
1057
- break;
1058
- case "camera":
1059
- n = this.loadCamera(e);
1060
- break;
1061
- default:
1062
- if (n = this._invokeOne(function(s) {
1063
- return s != this && s.getDependency && s.getDependency(t, e);
1064
- }), !n)
1065
- throw new Error("Unknown type: " + t);
1066
- break;
1067
- }
1068
- this.cache.add(r, n);
1069
- }
1070
- return n;
1071
- }
1072
- /**
1073
- * Requests all dependencies of the specified type asynchronously, with caching.
1074
- * @param {string} type
1075
- * @return {Promise<Array<Object>>}
1076
- */
1077
- getDependencies(t) {
1078
- let e = this.cache.get(t);
1079
- if (!e) {
1080
- const r = this, n = this.json[t + (t === "mesh" ? "es" : "s")] || [];
1081
- e = Promise.all(n.map(function(s, i) {
1082
- return r.getDependency(t, i);
1083
- })), this.cache.add(t, e);
1084
- }
1085
- return e;
1086
- }
1087
- /**
1088
- * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views
1089
- * @param {number} bufferIndex
1090
- * @return {Promise<ArrayBuffer>}
1091
- */
1092
- loadBuffer(t) {
1093
- const e = this.json.buffers[t], r = this.fileLoader;
1094
- if (e.type && e.type !== "arraybuffer")
1095
- throw new Error("THREE.GLTFLoader: " + e.type + " buffer type is not supported.");
1096
- if (e.uri === void 0 && t === 0)
1097
- return Promise.resolve(this.extensions[A.KHR_BINARY_GLTF].body);
1098
- const n = this.options;
1099
- return new Promise(function(s, i) {
1100
- r.load(X.resolveURL(e.uri, n.path), s, void 0, function() {
1101
- i(new Error('THREE.GLTFLoader: Failed to load buffer "' + e.uri + '".'));
1102
- });
1103
- });
1104
- }
1105
- /**
1106
- * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views
1107
- * @param {number} bufferViewIndex
1108
- * @return {Promise<ArrayBuffer>}
1109
- */
1110
- loadBufferView(t) {
1111
- const e = this.json.bufferViews[t];
1112
- return this.getDependency("buffer", e.buffer).then(function(r) {
1113
- const n = e.byteLength || 0, s = e.byteOffset || 0;
1114
- return r.slice(s, s + n);
1115
- });
1116
- }
1117
- /**
1118
- * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#accessors
1119
- * @param {number} accessorIndex
1120
- * @return {Promise<BufferAttribute|InterleavedBufferAttribute>}
1121
- */
1122
- loadAccessor(t) {
1123
- const e = this, r = this.json, n = this.json.accessors[t];
1124
- if (n.bufferView === void 0 && n.sparse === void 0) {
1125
- const i = te[n.type], a = U[n.componentType], o = n.normalized === !0, c = new a(n.count * i);
1126
- return Promise.resolve(new J(c, i, o));
1127
- }
1128
- const s = [];
1129
- return n.bufferView !== void 0 ? s.push(this.getDependency("bufferView", n.bufferView)) : s.push(null), n.sparse !== void 0 && (s.push(this.getDependency("bufferView", n.sparse.indices.bufferView)), s.push(this.getDependency("bufferView", n.sparse.values.bufferView))), Promise.all(s).then(function(i) {
1130
- const a = i[0], o = te[n.type], c = U[n.componentType], l = c.BYTES_PER_ELEMENT, u = l * o, f = n.byteOffset || 0, h = n.bufferView !== void 0 ? r.bufferViews[n.bufferView].byteStride : void 0, p = n.normalized === !0;
1131
- let T, m;
1132
- if (h && h !== u) {
1133
- const g = Math.floor(f / h), R = "InterleavedBuffer:" + n.bufferView + ":" + n.componentType + ":" + g + ":" + n.count;
1134
- let E = e.cache.get(R);
1135
- E || (T = new c(a, g * h, n.count * h / l), E = new je(T, h / l), e.cache.add(R, E)), m = new Ke(E, o, f % h / l, p);
1136
- } else
1137
- a === null ? T = new c(n.count * o) : T = new c(a, f, n.count * o), m = new J(T, o, p);
1138
- if (n.sparse !== void 0) {
1139
- const g = te.SCALAR, R = U[n.sparse.indices.componentType], E = n.sparse.indices.byteOffset || 0, x = n.sparse.values.byteOffset || 0, M = new R(i[1], E, n.sparse.count * g), O = new c(i[2], x, n.sparse.count * o);
1140
- a !== null && (m = new J(m.array.slice(), m.itemSize, m.normalized));
1141
- for (let _ = 0, v = M.length; _ < v; _++) {
1142
- const C = M[_];
1143
- if (m.setX(C, O[_ * o]), o >= 2 && m.setY(C, O[_ * o + 1]), o >= 3 && m.setZ(C, O[_ * o + 2]), o >= 4 && m.setW(C, O[_ * o + 3]), o >= 5) throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
1144
- }
1145
- }
1146
- return m;
1147
- });
1148
- }
1149
- /**
1150
- * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#textures
1151
- * @param {number} textureIndex
1152
- * @return {Promise<THREE.Texture|null>}
1153
- */
1154
- loadTexture(t) {
1155
- const e = this.json, r = this.options, s = e.textures[t].source, i = e.images[s];
1156
- let a = this.textureLoader;
1157
- if (i.uri) {
1158
- const o = r.manager.getHandler(i.uri);
1159
- o !== null && (a = o);
1160
- }
1161
- return this.loadTextureImage(t, s, a);
1162
- }
1163
- loadTextureImage(t, e, r) {
1164
- const n = this, s = this.json, i = s.textures[t], a = s.images[e], o = (a.uri || a.bufferView) + ":" + i.sampler;
1165
- if (this.textureCache[o])
1166
- return this.textureCache[o];
1167
- const c = this.loadImageSource(e, r).then(function(l) {
1168
- l.flipY = !1, l.name = i.name || a.name || "", l.name === "" && typeof a.uri == "string" && a.uri.startsWith("data:image/") === !1 && (l.name = a.uri);
1169
- const f = (s.samplers || {})[i.sampler] || {};
1170
- return l.magFilter = xe[f.magFilter] || be, l.minFilter = xe[f.minFilter] || Ne, l.wrapS = Re[f.wrapS] || ie, l.wrapT = Re[f.wrapT] || ie, n.associations.set(l, { textures: t }), l;
1171
- }).catch(function() {
1172
- return null;
1173
- });
1174
- return this.textureCache[o] = c, c;
1175
- }
1176
- loadImageSource(t, e) {
1177
- const r = this, n = this.json, s = this.options;
1178
- if (this.sourceCache[t] !== void 0)
1179
- return this.sourceCache[t].then((u) => u.clone());
1180
- const i = n.images[t], a = self.URL || self.webkitURL;
1181
- let o = i.uri || "", c = !1;
1182
- if (i.bufferView !== void 0)
1183
- o = r.getDependency("bufferView", i.bufferView).then(function(u) {
1184
- c = !0;
1185
- const f = new Blob([u], { type: i.mimeType });
1186
- return o = a.createObjectURL(f), o;
1187
- });
1188
- else if (i.uri === void 0)
1189
- throw new Error("THREE.GLTFLoader: Image " + t + " is missing URI and bufferView");
1190
- const l = Promise.resolve(o).then(function(u) {
1191
- return new Promise(function(f, h) {
1192
- let p = f;
1193
- e.isImageBitmapLoader === !0 && (p = function(T) {
1194
- const m = new fe(T);
1195
- m.needsUpdate = !0, f(m);
1196
- }), e.load(X.resolveURL(u, s.path), p, void 0, h);
1197
- });
1198
- }).then(function(u) {
1199
- return c === !0 && a.revokeObjectURL(o), w(u, i), u.userData.mimeType = i.mimeType || Yt(i.uri), u;
1200
- }).catch(function(u) {
1201
- throw console.error("THREE.GLTFLoader: Couldn't load texture", o), u;
1202
- });
1203
- return this.sourceCache[t] = l, l;
1204
- }
1205
- /**
1206
- * Asynchronously assigns a texture to the given material parameters.
1207
- * @param {Object} materialParams
1208
- * @param {string} mapName
1209
- * @param {Object} mapDef
1210
- * @return {Promise<Texture>}
1211
- */
1212
- assignTexture(t, e, r, n) {
1213
- const s = this;
1214
- return this.getDependency("texture", r.index).then(function(i) {
1215
- if (!i) return null;
1216
- if (r.texCoord !== void 0 && r.texCoord > 0 && (i = i.clone(), i.channel = r.texCoord), s.extensions[A.KHR_TEXTURE_TRANSFORM]) {
1217
- const a = r.extensions !== void 0 ? r.extensions[A.KHR_TEXTURE_TRANSFORM] : void 0;
1218
- if (a) {
1219
- const o = s.associations.get(i);
1220
- i = s.extensions[A.KHR_TEXTURE_TRANSFORM].extendTexture(i, a), s.associations.set(i, o);
1221
- }
1222
- }
1223
- return n !== void 0 && (i.colorSpace = n), t[e] = i, i;
1224
- });
1225
- }
1226
- /**
1227
- * Assigns final material to a Mesh, Line, or Points instance. The instance
1228
- * already has a material (generated from the glTF material options alone)
1229
- * but reuse of the same glTF material may require multiple threejs materials
1230
- * to accommodate different primitive types, defines, etc. New materials will
1231
- * be created if necessary, and reused from a cache.
1232
- * @param {Object3D} mesh Mesh, Line, or Points instance.
1233
- */
1234
- assignFinalMaterial(t) {
1235
- const e = t.geometry;
1236
- let r = t.material;
1237
- const n = e.attributes.tangent === void 0, s = e.attributes.color !== void 0, i = e.attributes.normal === void 0;
1238
- if (t.isPoints) {
1239
- const a = "PointsMaterial:" + r.uuid;
1240
- let o = this.cache.get(a);
1241
- o || (o = new Ve(), $.prototype.copy.call(o, r), o.color.copy(r.color), o.map = r.map, o.sizeAttenuation = !1, this.cache.add(a, o)), r = o;
1242
- } else if (t.isLine) {
1243
- const a = "LineBasicMaterial:" + r.uuid;
1244
- let o = this.cache.get(a);
1245
- o || (o = new Xe(), $.prototype.copy.call(o, r), o.color.copy(r.color), o.map = r.map, this.cache.add(a, o)), r = o;
1246
- }
1247
- if (n || s || i) {
1248
- let a = "ClonedMaterial:" + r.uuid + ":";
1249
- n && (a += "derivative-tangents:"), s && (a += "vertex-colors:"), i && (a += "flat-shading:");
1250
- let o = this.cache.get(a);
1251
- o || (o = r.clone(), s && (o.vertexColors = !0), i && (o.flatShading = !0), n && (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;
1252
- }
1253
- t.material = r;
1254
- }
1255
- getMaterialType() {
1256
- return Ie;
1257
- }
1258
- /**
1259
- * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials
1260
- * @param {number} materialIndex
1261
- * @return {Promise<Material>}
1262
- */
1263
- loadMaterial(t) {
1264
- const e = this, r = this.json, n = this.extensions, s = r.materials[t];
1265
- let i;
1266
- const a = {}, o = s.extensions || {}, c = [];
1267
- if (o[A.KHR_MATERIALS_UNLIT]) {
1268
- const u = n[A.KHR_MATERIALS_UNLIT];
1269
- i = u.getMaterialType(), c.push(u.extendParams(a, s, e));
1270
- } else {
1271
- const u = s.pbrMetallicRoughness || {};
1272
- if (a.color = new G(1, 1, 1), a.opacity = 1, Array.isArray(u.baseColorFactor)) {
1273
- const f = u.baseColorFactor;
1274
- a.color.setRGB(f[0], f[1], f[2], I), a.opacity = f[3];
1275
- }
1276
- u.baseColorTexture !== void 0 && c.push(e.assignTexture(a, "map", u.baseColorTexture, z)), a.metalness = u.metallicFactor !== void 0 ? u.metallicFactor : 1, a.roughness = u.roughnessFactor !== void 0 ? u.roughnessFactor : 1, u.metallicRoughnessTexture !== void 0 && (c.push(e.assignTexture(a, "metalnessMap", u.metallicRoughnessTexture)), c.push(e.assignTexture(a, "roughnessMap", u.metallicRoughnessTexture))), i = this._invokeOne(function(f) {
1277
- return f.getMaterialType && f.getMaterialType(t);
1278
- }), c.push(Promise.all(this._invokeAll(function(f) {
1279
- return f.extendMaterialParams && f.extendMaterialParams(t, a);
1280
- })));
1281
- }
1282
- s.doubleSided === !0 && (a.side = ze);
1283
- const l = s.alphaMode || ne.OPAQUE;
1284
- if (l === ne.BLEND ? (a.transparent = !0, a.depthWrite = !1) : (a.transparent = !1, l === ne.MASK && (a.alphaTest = s.alphaCutoff !== void 0 ? s.alphaCutoff : 0.5)), s.normalTexture !== void 0 && i !== V && (c.push(e.assignTexture(a, "normalMap", s.normalTexture)), a.normalScale = new Se(1, 1), s.normalTexture.scale !== void 0)) {
1285
- const u = s.normalTexture.scale;
1286
- a.normalScale.set(u, u);
1287
- }
1288
- if (s.occlusionTexture !== void 0 && i !== V && (c.push(e.assignTexture(a, "aoMap", s.occlusionTexture)), s.occlusionTexture.strength !== void 0 && (a.aoMapIntensity = s.occlusionTexture.strength)), s.emissiveFactor !== void 0 && i !== V) {
1289
- const u = s.emissiveFactor;
1290
- a.emissive = new G().setRGB(u[0], u[1], u[2], I);
1291
- }
1292
- return s.emissiveTexture !== void 0 && i !== V && c.push(e.assignTexture(a, "emissiveMap", s.emissiveTexture, z)), Promise.all(c).then(function() {
1293
- const u = new i(a);
1294
- return s.name && (u.name = s.name), w(u, s), e.associations.set(u, { materials: t }), s.extensions && P(n, u, s), u;
1295
- });
1296
- }
1297
- /** When Object3D instances are targeted by animation, they need unique names. */
1298
- createUniqueName(t) {
1299
- const e = qe.sanitizeNodeName(t || "");
1300
- return e in this.nodeNamesUsed ? e + "_" + ++this.nodeNamesUsed[e] : (this.nodeNamesUsed[e] = 0, e);
1301
- }
1302
- /**
1303
- * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#geometry
1304
- *
1305
- * Creates BufferGeometries from primitives.
1306
- *
1307
- * @param {Array<GLTF.Primitive>} primitives
1308
- * @return {Promise<Array<BufferGeometry>>}
1309
- */
1310
- loadGeometries(t) {
1311
- const e = this, r = this.extensions, n = this.primitiveCache;
1312
- function s(a) {
1313
- return r[A.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a, e).then(function(o) {
1314
- return Ee(o, a, e);
1315
- });
1316
- }
1317
- const i = [];
1318
- for (let a = 0, o = t.length; a < o; a++) {
1319
- const c = t[a], l = Wt(c), u = n[l];
1320
- if (u)
1321
- i.push(u.promise);
1322
- else {
1323
- let f;
1324
- c.extensions && c.extensions[A.KHR_DRACO_MESH_COMPRESSION] ? f = s(c) : f = Ee(new We(), c, e), n[l] = { primitive: c, promise: f }, i.push(f);
1325
- }
1326
- }
1327
- return Promise.all(i);
1328
- }
1329
- /**
1330
- * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#meshes
1331
- * @param {number} meshIndex
1332
- * @return {Promise<Group|Mesh|SkinnedMesh>}
1333
- */
1334
- loadMesh(t) {
1335
- const e = this, r = this.json, n = this.extensions, s = r.meshes[t], i = s.primitives, a = [];
1336
- for (let o = 0, c = i.length; o < c; o++) {
1337
- const l = i[o].material === void 0 ? Xt(this.cache) : this.getDependency("material", i[o].material);
1338
- a.push(l);
1339
- }
1340
- return a.push(e.loadGeometries(i)), Promise.all(a).then(function(o) {
1341
- const c = o.slice(0, o.length - 1), l = o[o.length - 1], u = [];
1342
- for (let h = 0, p = l.length; h < p; h++) {
1343
- const T = l[h], m = i[h];
1344
- let g;
1345
- const R = c[h];
1346
- if (m.mode === L.TRIANGLES || m.mode === L.TRIANGLE_STRIP || m.mode === L.TRIANGLE_FAN || m.mode === void 0)
1347
- g = s.isSkinnedMesh === !0 ? new Ye(T, R) : new Qe(T, R), g.isSkinnedMesh === !0 && g.normalizeSkinWeights(), m.mode === L.TRIANGLE_STRIP ? g.geometry = ge(g.geometry, Le) : m.mode === L.TRIANGLE_FAN && (g.geometry = ge(g.geometry, re));
1348
- else if (m.mode === L.LINES)
1349
- g = new Ze(T, R);
1350
- else if (m.mode === L.LINE_STRIP)
1351
- g = new Je(T, R);
1352
- else if (m.mode === L.LINE_LOOP)
1353
- g = new $e(T, R);
1354
- else if (m.mode === L.POINTS)
1355
- g = new et(T, R);
1356
- else
1357
- throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + m.mode);
1358
- Object.keys(g.geometry.morphAttributes).length > 0 && qt(g, s), g.name = e.createUniqueName(s.name || "mesh_" + t), w(g, s), m.extensions && P(n, g, m), e.assignFinalMaterial(g), u.push(g);
1359
- }
1360
- for (let h = 0, p = u.length; h < p; h++)
1361
- e.associations.set(u[h], {
1362
- meshes: t,
1363
- primitives: h
1364
- });
1365
- if (u.length === 1)
1366
- return s.extensions && P(n, u[0], s), u[0];
1367
- const f = new ee();
1368
- s.extensions && P(n, f, s), e.associations.set(f, { meshes: t });
1369
- for (let h = 0, p = u.length; h < p; h++)
1370
- f.add(u[h]);
1371
- return f;
1372
- });
1373
- }
1374
- /**
1375
- * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#cameras
1376
- * @param {number} cameraIndex
1377
- * @return {Promise<THREE.Camera>}
1378
- */
1379
- loadCamera(t) {
1380
- let e;
1381
- const r = this.json.cameras[t], n = r[r.type];
1382
- if (!n) {
1383
- console.warn("THREE.GLTFLoader: Missing camera parameters.");
1384
- return;
1385
- }
1386
- return r.type === "perspective" ? e = new tt(nt.radToDeg(n.yfov), n.aspectRatio || 1, n.znear || 1, n.zfar || 2e6) : r.type === "orthographic" && (e = new st(-n.xmag, n.xmag, n.ymag, -n.ymag, n.znear, n.zfar)), r.name && (e.name = this.createUniqueName(r.name)), w(e, r), Promise.resolve(e);
1387
- }
1388
- /**
1389
- * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins
1390
- * @param {number} skinIndex
1391
- * @return {Promise<Skeleton>}
1392
- */
1393
- loadSkin(t) {
1394
- const e = this.json.skins[t], r = [];
1395
- for (let n = 0, s = e.joints.length; n < s; n++)
1396
- r.push(this._loadNodeShallow(e.joints[n]));
1397
- return e.inverseBindMatrices !== void 0 ? r.push(this.getDependency("accessor", e.inverseBindMatrices)) : r.push(null), Promise.all(r).then(function(n) {
1398
- const s = n.pop(), i = n, a = [], o = [];
1399
- for (let c = 0, l = i.length; c < l; c++) {
1400
- const u = i[c];
1401
- if (u) {
1402
- a.push(u);
1403
- const f = new Y();
1404
- s !== null && f.fromArray(s.array, c * 16), o.push(f);
1405
- } else
1406
- console.warn('THREE.GLTFLoader: Joint "%s" could not be found.', e.joints[c]);
1407
- }
1408
- return new rt(a, o);
1409
- });
1410
- }
1411
- /**
1412
- * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#animations
1413
- * @param {number} animationIndex
1414
- * @return {Promise<AnimationClip>}
1415
- */
1416
- loadAnimation(t) {
1417
- const e = this.json, r = this, n = e.animations[t], s = n.name ? n.name : "animation_" + t, i = [], a = [], o = [], c = [], l = [];
1418
- for (let u = 0, f = n.channels.length; u < f; u++) {
1419
- const h = n.channels[u], p = n.samplers[h.sampler], T = h.target, m = T.node, g = n.parameters !== void 0 ? n.parameters[p.input] : p.input, R = n.parameters !== void 0 ? n.parameters[p.output] : p.output;
1420
- T.node !== void 0 && (i.push(this.getDependency("node", m)), a.push(this.getDependency("accessor", g)), o.push(this.getDependency("accessor", R)), c.push(p), l.push(T));
1421
- }
1422
- return Promise.all([
1423
- Promise.all(i),
1424
- Promise.all(a),
1425
- Promise.all(o),
1426
- Promise.all(c),
1427
- Promise.all(l)
1428
- ]).then(function(u) {
1429
- const f = u[0], h = u[1], p = u[2], T = u[3], m = u[4], g = [];
1430
- for (let R = 0, E = f.length; R < E; R++) {
1431
- const x = f[R], M = h[R], O = p[R], _ = T[R], v = m[R];
1432
- if (x === void 0) continue;
1433
- x.updateMatrix && x.updateMatrix();
1434
- const C = r._createAnimationTracks(x, M, O, _, v);
1435
- if (C)
1436
- for (let Q = 0; Q < C.length; Q++)
1437
- g.push(C[Q]);
1438
- }
1439
- return new it(s, void 0, g);
1440
- });
1441
- }
1442
- createNodeMesh(t) {
1443
- const e = this.json, r = this, n = e.nodes[t];
1444
- return n.mesh === void 0 ? null : r.getDependency("mesh", n.mesh).then(function(s) {
1445
- const i = r._getNodeRef(r.meshCache, n.mesh, s);
1446
- return n.weights !== void 0 && i.traverse(function(a) {
1447
- if (a.isMesh)
1448
- for (let o = 0, c = n.weights.length; o < c; o++)
1449
- a.morphTargetInfluences[o] = n.weights[o];
1450
- }), i;
1451
- });
1452
- }
1453
- /**
1454
- * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#nodes-and-hierarchy
1455
- * @param {number} nodeIndex
1456
- * @return {Promise<Object3D>}
1457
- */
1458
- loadNode(t) {
1459
- const e = this.json, r = this, n = e.nodes[t], s = r._loadNodeShallow(t), i = [], a = n.children || [];
1460
- for (let c = 0, l = a.length; c < l; c++)
1461
- i.push(r.getDependency("node", a[c]));
1462
- const o = n.skin === void 0 ? Promise.resolve(null) : r.getDependency("skin", n.skin);
1463
- return Promise.all([
1464
- s,
1465
- Promise.all(i),
1466
- o
1467
- ]).then(function(c) {
1468
- const l = c[0], u = c[1], f = c[2];
1469
- f !== null && l.traverse(function(h) {
1470
- h.isSkinnedMesh && h.bind(f, Qt);
1471
- });
1472
- for (let h = 0, p = u.length; h < p; h++)
1473
- l.add(u[h]);
1474
- return l;
1475
- });
1476
- }
1477
- // ._loadNodeShallow() parses a single node.
1478
- // skin and child nodes are created and added in .loadNode() (no '_' prefix).
1479
- _loadNodeShallow(t) {
1480
- const e = this.json, r = this.extensions, n = this;
1481
- if (this.nodeCache[t] !== void 0)
1482
- return this.nodeCache[t];
1483
- const s = e.nodes[t], i = s.name ? n.createUniqueName(s.name) : "", a = [], o = n._invokeOne(function(c) {
1484
- return c.createNodeMesh && c.createNodeMesh(t);
1485
- });
1486
- return o && a.push(o), s.camera !== void 0 && a.push(n.getDependency("camera", s.camera).then(function(c) {
1487
- return n._getNodeRef(n.cameraCache, s.camera, c);
1488
- })), n._invokeAll(function(c) {
1489
- return c.createNodeAttachment && c.createNodeAttachment(t);
1490
- }).forEach(function(c) {
1491
- a.push(c);
1492
- }), this.nodeCache[t] = Promise.all(a).then(function(c) {
1493
- let l;
1494
- if (s.isBone === !0 ? l = new ot() : c.length > 1 ? l = new ee() : c.length === 1 ? l = c[0] : l = new ye(), l !== c[0])
1495
- for (let u = 0, f = c.length; u < f; u++)
1496
- l.add(c[u]);
1497
- if (s.name && (l.userData.name = s.name, l.name = i), w(l, s), s.extensions && P(r, l, s), s.matrix !== void 0) {
1498
- const u = new Y();
1499
- u.fromArray(s.matrix), l.applyMatrix4(u);
1500
- } else
1501
- s.translation !== void 0 && l.position.fromArray(s.translation), s.rotation !== void 0 && l.quaternion.fromArray(s.rotation), s.scale !== void 0 && l.scale.fromArray(s.scale);
1502
- return n.associations.has(l) || n.associations.set(l, {}), n.associations.get(l).nodes = t, l;
1503
- }), this.nodeCache[t];
1504
- }
1505
- /**
1506
- * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#scenes
1507
- * @param {number} sceneIndex
1508
- * @return {Promise<Group>}
1509
- */
1510
- loadScene(t) {
1511
- const e = this.extensions, r = this.json.scenes[t], n = this, s = new ee();
1512
- r.name && (s.name = n.createUniqueName(r.name)), w(s, r), r.extensions && P(e, s, r);
1513
- const i = r.nodes || [], a = [];
1514
- for (let o = 0, c = i.length; o < c; o++)
1515
- a.push(n.getDependency("node", i[o]));
1516
- return Promise.all(a).then(function(o) {
1517
- for (let l = 0, u = o.length; l < u; l++)
1518
- s.add(o[l]);
1519
- const c = (l) => {
1520
- const u = /* @__PURE__ */ new Map();
1521
- for (const [f, h] of n.associations)
1522
- (f instanceof $ || f instanceof fe) && u.set(f, h);
1523
- return l.traverse((f) => {
1524
- const h = n.associations.get(f);
1525
- h != null && u.set(f, h);
1526
- }), u;
1527
- };
1528
- return n.associations = c(s), s;
1529
- });
1530
- }
1531
- _createAnimationTracks(t, e, r, n, s) {
1532
- const i = [], a = t.name ? t.name : t.uuid, o = [];
1533
- D[s.path] === D.weights ? t.traverse(function(f) {
1534
- f.morphTargetInfluences && o.push(f.name ? f.name : f.uuid);
1535
- }) : o.push(a);
1536
- let c;
1537
- switch (D[s.path]) {
1538
- case D.weights:
1539
- c = pe;
1540
- break;
1541
- case D.rotation:
1542
- c = me;
1543
- break;
1544
- case D.position:
1545
- case D.scale:
1546
- c = he;
1547
- break;
1548
- default:
1549
- switch (r.itemSize) {
1550
- case 1:
1551
- c = pe;
1552
- break;
1553
- case 2:
1554
- case 3:
1555
- default:
1556
- c = he;
1557
- break;
1558
- }
1559
- break;
1560
- }
1561
- const l = n.interpolation !== void 0 ? Vt[n.interpolation] : Oe, u = this._getArrayFromAccessor(r);
1562
- for (let f = 0, h = o.length; f < h; f++) {
1563
- const p = new c(
1564
- o[f] + "." + D[s.path],
1565
- e.array,
1566
- u,
1567
- l
1568
- );
1569
- n.interpolation === "CUBICSPLINE" && this._createCubicSplineTrackInterpolant(p), i.push(p);
1570
- }
1571
- return i;
1572
- }
1573
- _getArrayFromAccessor(t) {
1574
- let e = t.array;
1575
- if (t.normalized) {
1576
- const r = ae(e.constructor), n = new Float32Array(e.length);
1577
- for (let s = 0, i = e.length; s < i; s++)
1578
- n[s] = e[s] * r;
1579
- e = n;
1580
- }
1581
- return e;
1582
- }
1583
- _createCubicSplineTrackInterpolant(t) {
1584
- t.createInterpolant = function(r) {
1585
- const n = this instanceof me ? Kt : De;
1586
- return new n(this.times, this.values, this.getValueSize() / 3, r);
1587
- }, t.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0;
1588
- }
1589
- }
1590
- function Jt(d, t, e) {
1591
- const r = t.attributes, n = new mt();
1592
- if (r.POSITION !== void 0) {
1593
- const a = e.json.accessors[r.POSITION], o = a.min, c = a.max;
1594
- if (o !== void 0 && c !== void 0) {
1595
- if (n.set(
1596
- new B(o[0], o[1], o[2]),
1597
- new B(c[0], c[1], c[2])
1598
- ), a.normalized) {
1599
- const l = ae(U[a.componentType]);
1600
- n.min.multiplyScalar(l), n.max.multiplyScalar(l);
1601
- }
1602
- } else {
1603
- console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
1604
- return;
1605
- }
1606
- } else
1607
- return;
1608
- const s = t.targets;
1609
- if (s !== void 0) {
1610
- const a = new B(), o = new B();
1611
- for (let c = 0, l = s.length; c < l; c++) {
1612
- const u = s[c];
1613
- if (u.POSITION !== void 0) {
1614
- const f = e.json.accessors[u.POSITION], h = f.min, p = f.max;
1615
- if (h !== void 0 && p !== void 0) {
1616
- if (o.setX(Math.max(Math.abs(h[0]), Math.abs(p[0]))), o.setY(Math.max(Math.abs(h[1]), Math.abs(p[1]))), o.setZ(Math.max(Math.abs(h[2]), Math.abs(p[2]))), f.normalized) {
1617
- const T = ae(U[f.componentType]);
1618
- o.multiplyScalar(T);
1619
- }
1620
- a.max(o);
1621
- } else
1622
- console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
1623
- }
1624
- }
1625
- n.expandByVector(a);
1626
- }
1627
- d.boundingBox = n;
1628
- const i = new At();
1629
- n.getCenter(i.center), i.radius = n.min.distanceTo(n.max) / 2, d.boundingSphere = i;
1630
- }
1631
- function Ee(d, t, e) {
1632
- const r = t.attributes, n = [];
1633
- function s(i, a) {
1634
- return e.getDependency("accessor", i).then(function(o) {
1635
- d.setAttribute(a, o);
1636
- });
1637
- }
1638
- for (const i in r) {
1639
- const a = oe[i] || i.toLowerCase();
1640
- a in d.attributes || n.push(s(r[i], a));
1641
- }
1642
- if (t.indices !== void 0 && !d.index) {
1643
- const i = e.getDependency("accessor", t.indices).then(function(a) {
1644
- d.setIndex(a);
1645
- });
1646
- n.push(i);
1647
- }
1648
- return de.workingColorSpace !== I && "COLOR_0" in r && console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${de.workingColorSpace}" not supported.`), w(d, t), Jt(d, t, e), Promise.all(n).then(function() {
1649
- return t.targets !== void 0 ? zt(d, t.targets, e) : d;
1650
- });
1651
- }
1652
- var k;
1653
- class nn {
1654
- constructor() {
1655
- j(this, k, new Tt());
1656
- }
1657
- get gltfLoader() {
1658
- return S(this, k);
1659
- }
1660
- setLoaders(t) {
1661
- if (t != null && t.draco && F.dracoLoader) {
1662
- const e = typeof t.draco == "boolean" ? `${N.CDNVersion}/examples/jsm/libs/draco/gltf/` : t.draco;
1663
- F.dracoLoader.setDecoderPath(e), S(this, k).setDRACOLoader(F.dracoLoader);
1664
- }
1665
- if (t != null && t.ktx2 && F.ktx2Loader) {
1666
- const e = typeof t.ktx2 == "boolean" ? `${N.CDNVersion}/examples/jsm/libs/basis/` : t.ktx2;
1667
- F.ktx2Loader.setTranscoderPath(e), S(this, k).setKTX2Loader(
1668
- F.ktx2Loader.detectSupport(N.webglRenderer)
1669
- );
1670
- }
1671
- t != null && t.meshopt && F.meshoptDecoder && S(this, k).setMeshoptDecoder(F.meshoptDecoder);
1672
- }
1673
- load(...t) {
1674
- const [e, r, ...n] = t;
1675
- if (N.cacheAssets && b.has(e)) {
1676
- const s = b.get(e).data;
1677
- r(s);
1678
- } else
1679
- this.gltfLoader.load(
1680
- e,
1681
- (s) => {
1682
- N.cacheAssets && b.set(e, {
1683
- data: s,
1684
- dispose: () => {
1685
- s.cameras.forEach((i) => Ae(i)), s.scenes.forEach((i) => {
1686
- Ae(i);
1687
- });
1688
- }
1689
- }), r(s);
1690
- },
1691
- ...n
1692
- );
1693
- }
1694
- }
1695
- k = new WeakMap();
1696
- var H, q, W;
1697
- class sn {
1698
- constructor() {
1699
- j(this, H, new we());
1700
- j(this, q);
1701
- j(this, W);
1702
- Z(this, q, S(this, H).load.bind(S(this, H))), Z(this, W, S(this, H).loadAsync.bind(S(this, H)));
1703
- }
1704
- load(...t) {
1705
- const [e, r, ...n] = t;
1706
- if (N.cacheAssets && b.has(e)) {
1707
- const s = b.get(e);
1708
- return r == null || r(s.data), s.data;
1709
- }
1710
- return S(this, q).call(this, e, (s) => {
1711
- N.cacheAssets && b.set(e, {
1712
- data: s,
1713
- dispose: () => s.dispose()
1714
- }), r == null || r(s);
1715
- }, ...n);
1716
- }
1717
- loadSync(...t) {
1718
- return le(this, null, function* () {
1719
- const [e, ...r] = t;
1720
- if (N.cacheAssets && b.has(e))
1721
- return b.get(e).data;
1722
- const n = yield S(this, W).call(this, e, ...r);
1723
- return N.cacheAssets && b.set(e, {
1724
- data: n,
1725
- dispose: () => n.dispose()
1726
- }), n;
1727
- });
1728
- }
1729
- }
1730
- H = new WeakMap(), q = new WeakMap(), W = new WeakMap();
1731
- const F = {
1732
- gltfLoader: null,
1733
- textureLoader: null,
1734
- dracoLoader: null,
1735
- ktx2Loader: null,
1736
- meshoptDecoder: null
1737
- };
1738
- export {
1739
- nn as En3GLTFLoader,
1740
- sn as En3TextureLoader,
1741
- F as loaders
1742
- };