ss-component-new 1.1.739 → 1.1.741

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 (80) hide show
  1. package/dist/iconfont-CG2Sal8B.cjs +1 -0
  2. package/dist/{iconfont-qPvAStie.js → iconfont-CfLywbZr.js} +228 -228
  3. package/dist/icons/svg//345/267/262/345/244/204/347/220/206.svg +1 -0
  4. package/dist/icons/svg//345/276/205/345/244/204/347/220/206.svg +1 -0
  5. package/dist/icons/svg//346/200/273/346/234/210/346/212/245.svg +1 -0
  6. package/dist/icons/svg//346/210/221/345/217/221/350/265/267.svg +1 -0
  7. package/dist/icons/svg//350/277/233/345/272/246/350/256/241/345/210/222.svg +1 -0
  8. package/dist/{index-C11jwWIH.js → index-58FSA1fk.js} +1 -1
  9. package/dist/{index-DkhU9Fyq.cjs → index-B23sbyqS.cjs} +1 -1
  10. package/dist/{index-QJ6R_1oH.js → index-B2jHfnBi.js} +1 -1
  11. package/dist/{index-DjvGgBth.cjs → index-BJSVns4w.cjs} +1 -1
  12. package/dist/{index-DHOqgbYN.cjs → index-BOnQNWrS.cjs} +1 -1
  13. package/dist/{index-DWuuoB7a.js → index-BPAaiDYS.js} +2 -2
  14. package/dist/{index-Cfk7SWHy.cjs → index-BguzPlFU.cjs} +1 -1
  15. package/dist/index-Bs3sACSy.cjs +4 -0
  16. package/dist/{index-sv-JcYde.js → index-BxmYY9oi.js} +1 -1
  17. package/dist/{index-Cx7Wv-gm.js → index-C-iXZX_6.js} +1064 -1050
  18. package/dist/{index-CdaMozHe.js → index-C5YXsqdb.js} +12 -12
  19. package/dist/{index-CoQ_M7fB.js → index-CBwFVBlN.js} +1 -1
  20. package/dist/{index-DWx1X-8j.cjs → index-CFW_J0mq.cjs} +1 -1
  21. package/dist/{index-C_ocMwXC.cjs → index-CHookp0n.cjs} +1 -1
  22. package/dist/{index-CDHE_eph.cjs → index-CJKZCT1m.cjs} +1 -1
  23. package/dist/{index-DcNDTCaI.cjs → index-CLSUzeGK.cjs} +1 -1
  24. package/dist/{index-dP3nnmsC.js → index-CPWusFs7.js} +378 -374
  25. package/dist/{index-fCNMafkz.cjs → index-CgkRi40i.cjs} +1 -1
  26. package/dist/{index-CrGEVGu0.cjs → index-ChEr-LD6.cjs} +1 -1
  27. package/dist/{index-DbNp8EFn.js → index-CioBNOFX.js} +1 -1
  28. package/dist/{index-DfZNL6PB.js → index-CrnjysBb.js} +1 -1
  29. package/dist/{index-tmfGfG-O.js → index-CsGu6WZW.js} +2 -2
  30. package/dist/{index-DSUAIjmi.cjs → index-Cu5G4oKN.cjs} +1 -1
  31. package/dist/{index-BocEL4Jl.js → index-DCok5HS5.js} +2 -2
  32. package/dist/{index-BfkgBnPo.js → index-DFOanwRw.js} +4 -4
  33. package/dist/{index-DLjUG_pe.cjs → index-DLzfn6r-.cjs} +1 -1
  34. package/dist/{index-CzB8c7O-.cjs → index-DZiy-zVX.cjs} +2 -2
  35. package/dist/{index-BOQAKRLJ.cjs → index-DvrfOuat.cjs} +1 -1
  36. package/dist/{index-BJqD21GP.cjs → index-DyHucKXC.cjs} +1 -1
  37. package/dist/{index-DG5OVpIW.cjs → index-HV3ortf1.cjs} +1 -1
  38. package/dist/{index-Cf72dK5y.js → index-Ps0cS0S_.js} +1 -1
  39. package/dist/{index-BA3Xvf7Z.cjs → index-QeRTl7fr.cjs} +1 -1
  40. package/dist/{index-CUmC3pQz.js → index-hmAJvmph.js} +4 -4
  41. package/dist/{index-CZW5RoOR.js → index-mFuKOeN3.js} +2 -2
  42. package/dist/{index-DFOiltcr.js → index-qwea9F5R.js} +2 -2
  43. package/dist/{index-BAEPzmDe.js → index-yMjUlsQi.js} +3 -3
  44. package/dist/{index.vue_vue_type_script_setup_true_lang-C02Udtum.js → index.vue_vue_type_script_setup_true_lang-Csfnc8XO.js} +1 -1
  45. package/dist/{index.vue_vue_type_script_setup_true_lang-JkfkJZII.cjs → index.vue_vue_type_script_setup_true_lang-Mwbkilwg.cjs} +1 -1
  46. package/dist/{index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-C22LuAyj.js → index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-CIBPRoRG.js} +1718 -1713
  47. package/dist/{index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-BFxsYhWZ.cjs → index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-Cnqkd37w.cjs} +56 -56
  48. package/dist/{index.vue_vue_type_style_index_0_scoped_c80f0a23_lang-DjkPKUWJ.js → index.vue_vue_type_style_index_0_scoped_8bb4b740_lang-Au5fVfKN.js} +7 -7
  49. package/dist/{index.vue_vue_type_style_index_0_scoped_c80f0a23_lang-DK90dN5m.cjs → index.vue_vue_type_style_index_0_scoped_8bb4b740_lang-CN2oYxtZ.cjs} +1 -1
  50. package/dist/{index.vue_vue_type_style_index_0_scoped_c81d0427_lang-516uyV3e.cjs → index.vue_vue_type_style_index_0_scoped_c81d0427_lang--PhJifi0.cjs} +1 -1
  51. package/dist/{index.vue_vue_type_style_index_0_scoped_c81d0427_lang-CqT4MR7v.js → index.vue_vue_type_style_index_0_scoped_c81d0427_lang-DtoSEF10.js} +4 -4
  52. package/dist/{main-DvIAfEIC.cjs → main-BO_aEmJX.cjs} +1 -1
  53. package/dist/{main-C2noB47h.js → main-CjUS4ycM.js} +2 -2
  54. package/dist/obj/model.mtl +42 -0
  55. package/dist/obj/model.obj +26110 -0
  56. package/dist/ss-component.cjs +1 -1
  57. package/dist/ss-component.css +2 -2
  58. package/dist/ss-component.js +8 -8
  59. package/dist/ss-component2.cjs +1 -1
  60. package/dist/ss-component2.js +8 -8
  61. package/dist/{threeModel-BT9NpER2.js → threeModel-Bq0jevec.js} +1 -1
  62. package/dist/{threeModel-BBQKVqka.cjs → threeModel-ChvlK5eB.cjs} +1 -1
  63. package/dist/threePreview-BISgU_nq.cjs +1 -0
  64. package/dist/threePreview-CezYo5_-.js +1960 -0
  65. package/dist/threeSceneView-DY4Gd-tt.js +693 -0
  66. package/dist/threeSceneView-DjveszMP.cjs +1 -0
  67. package/package.json +1 -1
  68. package/public/icons/svg//345/267/262/345/244/204/347/220/206.svg +1 -0
  69. package/public/icons/svg//345/276/205/345/244/204/347/220/206.svg +1 -0
  70. package/public/icons/svg//346/200/273/346/234/210/346/212/245.svg +1 -0
  71. package/public/icons/svg//346/210/221/345/217/221/350/265/267.svg +1 -0
  72. package/public/icons/svg//350/277/233/345/272/246/350/256/241/345/210/222.svg +1 -0
  73. package/public/obj/model.mtl +42 -0
  74. package/public/obj/model.obj +26110 -0
  75. package/dist/iconfont-CZ4r8Axf.cjs +0 -1
  76. package/dist/index-CF5qxKRT.cjs +0 -4
  77. package/dist/threePreview-CRHgbXLA.cjs +0 -1
  78. package/dist/threePreview-lVI_SBuS.js +0 -1972
  79. package/dist/threeSceneView-Bvl4g83Z.js +0 -889
  80. package/dist/threeSceneView-COPlmNqY.cjs +0 -1
@@ -0,0 +1,1960 @@
1
+ import { ref as G, shallowRef as He, defineComponent as Ue, watch as J, onMounted as Ge, nextTick as je, onBeforeUnmount as Be, resolveComponent as Ke, createElementBlock as Q, openBlock as Z, createElementVNode as M, withDirectives as B, createCommentVNode as de, createVNode as H, unref as S, toDisplayString as fe, withCtx as Ve, isRef as W, vModelRadio as Y, vShow as Xe } from "vue";
2
+ import { u as ze, a as qe, b as We, S as K } from "./iconfont-CfLywbZr.js";
3
+ import { ag as Ye, ah as oe, ai as Me, q as $e, x as z, F as we, aj as C, Q as ye, C as D, ak as k, b as q, Y as Je, g as Qe, D as Ze, k as $, V as U, al as en, Z as be, am as nn, a8 as Se, z as tn, an as sn, ae as ee, ao as rn, w as Ne, ap as on, aq as an, ar as cn, as as ae, at as Ie, a6 as ce, au as ln, a7 as un, t as dn, av as ne, a1 as fn, ad as Ce, i as hn, y as X, aw as pn, r as mn, a2 as gn, e as Oe, a4 as Tn, a3 as xn, ax as Rn, u as En, n as te, P as An, l as Ln, U as _n, a5 as Mn, J as wn, a0 as yn, ay as bn, az as ve, aA as Sn, aB as he, _ as pe, aC as me, $ as ge, N as Te, R as Nn, aD as In, B as ke, aE as Cn, p as On, O as vn, o as kn, h as Fn } from "./STLLoader-DofhZbOw.js";
4
+ import { E as xe } from "./index-DHX6rKjz.js";
5
+ import { _ as Pn } from "./_plugin-vue_export-helper-CHgC5LLL.js";
6
+ function Re(d, n) {
7
+ if (n === Ye)
8
+ return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."), d;
9
+ if (n === oe || n === Me) {
10
+ let e = d.getIndex();
11
+ if (e === null) {
12
+ const r = [], a = d.getAttribute("position");
13
+ if (a !== void 0) {
14
+ for (let o = 0; o < a.count; o++)
15
+ r.push(o);
16
+ d.setIndex(r), e = d.getIndex();
17
+ } else
18
+ return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."), d;
19
+ }
20
+ const i = e.count - 2, t = [];
21
+ if (n === oe)
22
+ for (let r = 1; r <= i; r++)
23
+ t.push(e.getX(0)), t.push(e.getX(r)), t.push(e.getX(r + 1));
24
+ else
25
+ for (let r = 0; r < i; r++)
26
+ r % 2 === 0 ? (t.push(e.getX(r)), t.push(e.getX(r + 1)), t.push(e.getX(r + 2))) : (t.push(e.getX(r + 2)), t.push(e.getX(r + 1)), t.push(e.getX(r)));
27
+ t.length / 3 !== i && console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");
28
+ const s = d.clone();
29
+ return s.setIndex(t), s.clearGroups(), s;
30
+ } else
31
+ return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:", n), d;
32
+ }
33
+ class Dn extends $e {
34
+ /**
35
+ * Constructs a new glTF loader.
36
+ *
37
+ * @param {LoadingManager} [manager] - The loading manager.
38
+ */
39
+ constructor(n) {
40
+ super(n), this.dracoLoader = null, this.ktx2Loader = null, this.meshoptDecoder = null, this.pluginCallbacks = [], this.register(function(e) {
41
+ return new Bn(e);
42
+ }), this.register(function(e) {
43
+ return new Kn(e);
44
+ }), this.register(function(e) {
45
+ return new Qn(e);
46
+ }), this.register(function(e) {
47
+ return new Zn(e);
48
+ }), this.register(function(e) {
49
+ return new et(e);
50
+ }), this.register(function(e) {
51
+ return new Xn(e);
52
+ }), this.register(function(e) {
53
+ return new zn(e);
54
+ }), this.register(function(e) {
55
+ return new qn(e);
56
+ }), this.register(function(e) {
57
+ return new Wn(e);
58
+ }), this.register(function(e) {
59
+ return new jn(e);
60
+ }), this.register(function(e) {
61
+ return new Yn(e);
62
+ }), this.register(function(e) {
63
+ return new Vn(e);
64
+ }), this.register(function(e) {
65
+ return new Jn(e);
66
+ }), this.register(function(e) {
67
+ return new $n(e);
68
+ }), this.register(function(e) {
69
+ return new Un(e);
70
+ }), this.register(function(e) {
71
+ return new nt(e);
72
+ }), this.register(function(e) {
73
+ return new tt(e);
74
+ });
75
+ }
76
+ /**
77
+ * Starts loading from the given URL and passes the loaded glTF asset
78
+ * to the `onLoad()` callback.
79
+ *
80
+ * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
81
+ * @param {function(GLTFLoader~LoadObject)} onLoad - Executed when the loading process has been finished.
82
+ * @param {onProgressCallback} onProgress - Executed while the loading is in progress.
83
+ * @param {onErrorCallback} onError - Executed when errors occur.
84
+ */
85
+ load(n, e, i, t) {
86
+ const s = this;
87
+ let r;
88
+ if (this.resourcePath !== "")
89
+ r = this.resourcePath;
90
+ else if (this.path !== "") {
91
+ const c = z.extractUrlBase(n);
92
+ r = z.resolveURL(c, this.path);
93
+ } else
94
+ r = z.extractUrlBase(n);
95
+ this.manager.itemStart(n);
96
+ const a = function(c) {
97
+ t ? t(c) : console.error(c), s.manager.itemError(n), s.manager.itemEnd(n);
98
+ }, o = new we(this.manager);
99
+ o.setPath(this.path), o.setResponseType("arraybuffer"), o.setRequestHeader(this.requestHeader), o.setWithCredentials(this.withCredentials), o.load(n, function(c) {
100
+ try {
101
+ s.parse(c, r, function(u) {
102
+ e(u), s.manager.itemEnd(n);
103
+ }, a);
104
+ } catch (u) {
105
+ a(u);
106
+ }
107
+ }, i, a);
108
+ }
109
+ /**
110
+ * Sets the given Draco loader to this loader. Required for decoding assets
111
+ * compressed with the `KHR_draco_mesh_compression` extension.
112
+ *
113
+ * @param {DRACOLoader} dracoLoader - The Draco loader to set.
114
+ * @return {GLTFLoader} A reference to this loader.
115
+ */
116
+ setDRACOLoader(n) {
117
+ return this.dracoLoader = n, this;
118
+ }
119
+ /**
120
+ * Sets the given KTX2 loader to this loader. Required for loading KTX2
121
+ * compressed textures.
122
+ *
123
+ * @param {KTX2Loader} ktx2Loader - The KTX2 loader to set.
124
+ * @return {GLTFLoader} A reference to this loader.
125
+ */
126
+ setKTX2Loader(n) {
127
+ return this.ktx2Loader = n, this;
128
+ }
129
+ /**
130
+ * Sets the given meshopt decoder. Required for decoding assets
131
+ * compressed with the `EXT_meshopt_compression` extension.
132
+ *
133
+ * @param {Object} meshoptDecoder - The meshopt decoder to set.
134
+ * @return {GLTFLoader} A reference to this loader.
135
+ */
136
+ setMeshoptDecoder(n) {
137
+ return this.meshoptDecoder = n, this;
138
+ }
139
+ /**
140
+ * Registers a plugin callback. This API is internally used to implement the various
141
+ * glTF extensions but can also used by third-party code to add additional logic
142
+ * to the loader.
143
+ *
144
+ * @param {function(parser:GLTFParser)} callback - The callback function to register.
145
+ * @return {GLTFLoader} A reference to this loader.
146
+ */
147
+ register(n) {
148
+ return this.pluginCallbacks.indexOf(n) === -1 && this.pluginCallbacks.push(n), this;
149
+ }
150
+ /**
151
+ * Unregisters a plugin callback.
152
+ *
153
+ * @param {Function} callback - The callback function to unregister.
154
+ * @return {GLTFLoader} A reference to this loader.
155
+ */
156
+ unregister(n) {
157
+ return this.pluginCallbacks.indexOf(n) !== -1 && this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(n), 1), this;
158
+ }
159
+ /**
160
+ * Parses the given FBX data and returns the resulting group.
161
+ *
162
+ * @param {string|ArrayBuffer} data - The raw glTF data.
163
+ * @param {string} path - The URL base path.
164
+ * @param {function(GLTFLoader~LoadObject)} onLoad - Executed when the loading process has been finished.
165
+ * @param {onErrorCallback} onError - Executed when errors occur.
166
+ */
167
+ parse(n, e, i, t) {
168
+ let s;
169
+ const r = {}, a = {}, o = new TextDecoder();
170
+ if (typeof n == "string")
171
+ s = JSON.parse(n);
172
+ else if (n instanceof ArrayBuffer)
173
+ if (o.decode(new Uint8Array(n, 0, 4)) === Fe) {
174
+ try {
175
+ r[E.KHR_BINARY_GLTF] = new st(n);
176
+ } catch (l) {
177
+ t && t(l);
178
+ return;
179
+ }
180
+ s = JSON.parse(r[E.KHR_BINARY_GLTF].content);
181
+ } else
182
+ s = JSON.parse(o.decode(n));
183
+ else
184
+ s = n;
185
+ if (s.asset === void 0 || s.asset.version[0] < 2) {
186
+ t && t(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));
187
+ return;
188
+ }
189
+ const c = new gt(s, {
190
+ path: e || this.resourcePath || "",
191
+ crossOrigin: this.crossOrigin,
192
+ requestHeader: this.requestHeader,
193
+ manager: this.manager,
194
+ ktx2Loader: this.ktx2Loader,
195
+ meshoptDecoder: this.meshoptDecoder
196
+ });
197
+ c.fileLoader.setRequestHeader(this.requestHeader);
198
+ for (let u = 0; u < this.pluginCallbacks.length; u++) {
199
+ const l = this.pluginCallbacks[u](c);
200
+ l.name || console.error("THREE.GLTFLoader: Invalid plugin found: missing name"), a[l.name] = l, r[l.name] = !0;
201
+ }
202
+ if (s.extensionsUsed)
203
+ for (let u = 0; u < s.extensionsUsed.length; ++u) {
204
+ const l = s.extensionsUsed[u], f = s.extensionsRequired || [];
205
+ switch (l) {
206
+ case E.KHR_MATERIALS_UNLIT:
207
+ r[l] = new Gn();
208
+ break;
209
+ case E.KHR_DRACO_MESH_COMPRESSION:
210
+ r[l] = new rt(s, this.dracoLoader);
211
+ break;
212
+ case E.KHR_TEXTURE_TRANSFORM:
213
+ r[l] = new it();
214
+ break;
215
+ case E.KHR_MESH_QUANTIZATION:
216
+ r[l] = new ot();
217
+ break;
218
+ default:
219
+ f.indexOf(l) >= 0 && a[l] === void 0 && console.warn('THREE.GLTFLoader: Unknown extension "' + l + '".');
220
+ }
221
+ }
222
+ c.setExtensions(r), c.setPlugins(a), c.parse(i, t);
223
+ }
224
+ /**
225
+ * Async version of {@link GLTFLoader#parse}.
226
+ *
227
+ * @async
228
+ * @param {string|ArrayBuffer} data - The raw glTF data.
229
+ * @param {string} path - The URL base path.
230
+ * @return {Promise<GLTFLoader~LoadObject>} A Promise that resolves with the loaded glTF when the parsing has been finished.
231
+ */
232
+ parseAsync(n, e) {
233
+ const i = this;
234
+ return new Promise(function(t, s) {
235
+ i.parse(n, e, t, s);
236
+ });
237
+ }
238
+ }
239
+ function Hn() {
240
+ let d = {};
241
+ return {
242
+ get: function(n) {
243
+ return d[n];
244
+ },
245
+ add: function(n, e) {
246
+ d[n] = e;
247
+ },
248
+ remove: function(n) {
249
+ delete d[n];
250
+ },
251
+ removeAll: function() {
252
+ d = {};
253
+ }
254
+ };
255
+ }
256
+ const E = {
257
+ KHR_BINARY_GLTF: "KHR_binary_glTF",
258
+ KHR_DRACO_MESH_COMPRESSION: "KHR_draco_mesh_compression",
259
+ KHR_LIGHTS_PUNCTUAL: "KHR_lights_punctual",
260
+ KHR_MATERIALS_CLEARCOAT: "KHR_materials_clearcoat",
261
+ KHR_MATERIALS_DISPERSION: "KHR_materials_dispersion",
262
+ KHR_MATERIALS_IOR: "KHR_materials_ior",
263
+ KHR_MATERIALS_SHEEN: "KHR_materials_sheen",
264
+ KHR_MATERIALS_SPECULAR: "KHR_materials_specular",
265
+ KHR_MATERIALS_TRANSMISSION: "KHR_materials_transmission",
266
+ KHR_MATERIALS_IRIDESCENCE: "KHR_materials_iridescence",
267
+ KHR_MATERIALS_ANISOTROPY: "KHR_materials_anisotropy",
268
+ KHR_MATERIALS_UNLIT: "KHR_materials_unlit",
269
+ KHR_MATERIALS_VOLUME: "KHR_materials_volume",
270
+ KHR_TEXTURE_BASISU: "KHR_texture_basisu",
271
+ KHR_TEXTURE_TRANSFORM: "KHR_texture_transform",
272
+ KHR_MESH_QUANTIZATION: "KHR_mesh_quantization",
273
+ KHR_MATERIALS_EMISSIVE_STRENGTH: "KHR_materials_emissive_strength",
274
+ EXT_MATERIALS_BUMP: "EXT_materials_bump",
275
+ EXT_TEXTURE_WEBP: "EXT_texture_webp",
276
+ EXT_TEXTURE_AVIF: "EXT_texture_avif",
277
+ EXT_MESHOPT_COMPRESSION: "EXT_meshopt_compression",
278
+ EXT_MESH_GPU_INSTANCING: "EXT_mesh_gpu_instancing"
279
+ };
280
+ class Un {
281
+ constructor(n) {
282
+ this.parser = n, this.name = E.KHR_LIGHTS_PUNCTUAL, this.cache = { refs: {}, uses: {} };
283
+ }
284
+ _markDefs() {
285
+ const n = this.parser, e = this.parser.json.nodes || [];
286
+ for (let i = 0, t = e.length; i < t; i++) {
287
+ const s = e[i];
288
+ s.extensions && s.extensions[this.name] && s.extensions[this.name].light !== void 0 && n._addNodeRef(this.cache, s.extensions[this.name].light);
289
+ }
290
+ }
291
+ _loadLight(n) {
292
+ const e = this.parser, i = "light:" + n;
293
+ let t = e.cache.get(i);
294
+ if (t) return t;
295
+ const s = e.json, o = ((s.extensions && s.extensions[this.name] || {}).lights || [])[n];
296
+ let c;
297
+ const u = new D(16777215);
298
+ o.color !== void 0 && u.setRGB(o.color[0], o.color[1], o.color[2], k);
299
+ const l = o.range !== void 0 ? o.range : 0;
300
+ switch (o.type) {
301
+ case "directional":
302
+ c = new Ze(u), c.target.position.set(0, 0, -1), c.add(c.target);
303
+ break;
304
+ case "point":
305
+ c = new Qe(u), c.distance = l;
306
+ break;
307
+ case "spot":
308
+ c = new Je(u), c.distance = l, 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);
309
+ break;
310
+ default:
311
+ throw new Error("THREE.GLTFLoader: Unexpected light type: " + o.type);
312
+ }
313
+ return c.position.set(0, 0, 0), v(c, o), o.intensity !== void 0 && (c.intensity = o.intensity), c.name = e.createUniqueName(o.name || "light_" + n), t = Promise.resolve(c), e.cache.add(i, t), t;
314
+ }
315
+ getDependency(n, e) {
316
+ if (n === "light")
317
+ return this._loadLight(e);
318
+ }
319
+ createNodeAttachment(n) {
320
+ const e = this, i = this.parser, s = i.json.nodes[n], a = (s.extensions && s.extensions[this.name] || {}).light;
321
+ return a === void 0 ? null : this._loadLight(a).then(function(o) {
322
+ return i._getNodeRef(e.cache, a, o);
323
+ });
324
+ }
325
+ }
326
+ class Gn {
327
+ constructor() {
328
+ this.name = E.KHR_MATERIALS_UNLIT;
329
+ }
330
+ getMaterialType() {
331
+ return X;
332
+ }
333
+ extendParams(n, e, i) {
334
+ const t = [];
335
+ n.color = new D(1, 1, 1), n.opacity = 1;
336
+ const s = e.pbrMetallicRoughness;
337
+ if (s) {
338
+ if (Array.isArray(s.baseColorFactor)) {
339
+ const r = s.baseColorFactor;
340
+ n.color.setRGB(r[0], r[1], r[2], k), n.opacity = r[3];
341
+ }
342
+ s.baseColorTexture !== void 0 && t.push(i.assignTexture(n, "map", s.baseColorTexture, q));
343
+ }
344
+ return Promise.all(t);
345
+ }
346
+ }
347
+ class jn {
348
+ constructor(n) {
349
+ this.parser = n, this.name = E.KHR_MATERIALS_EMISSIVE_STRENGTH;
350
+ }
351
+ extendMaterialParams(n, e) {
352
+ const t = this.parser.json.materials[n];
353
+ if (!t.extensions || !t.extensions[this.name])
354
+ return Promise.resolve();
355
+ const s = t.extensions[this.name].emissiveStrength;
356
+ return s !== void 0 && (e.emissiveIntensity = s), Promise.resolve();
357
+ }
358
+ }
359
+ class Bn {
360
+ constructor(n) {
361
+ this.parser = n, this.name = E.KHR_MATERIALS_CLEARCOAT;
362
+ }
363
+ getMaterialType(n) {
364
+ const i = this.parser.json.materials[n];
365
+ return !i.extensions || !i.extensions[this.name] ? null : C;
366
+ }
367
+ extendMaterialParams(n, e) {
368
+ const i = this.parser, t = i.json.materials[n];
369
+ if (!t.extensions || !t.extensions[this.name])
370
+ return Promise.resolve();
371
+ const s = [], r = t.extensions[this.name];
372
+ if (r.clearcoatFactor !== void 0 && (e.clearcoat = r.clearcoatFactor), r.clearcoatTexture !== void 0 && s.push(i.assignTexture(e, "clearcoatMap", r.clearcoatTexture)), r.clearcoatRoughnessFactor !== void 0 && (e.clearcoatRoughness = r.clearcoatRoughnessFactor), r.clearcoatRoughnessTexture !== void 0 && s.push(i.assignTexture(e, "clearcoatRoughnessMap", r.clearcoatRoughnessTexture)), r.clearcoatNormalTexture !== void 0 && (s.push(i.assignTexture(e, "clearcoatNormalMap", r.clearcoatNormalTexture)), r.clearcoatNormalTexture.scale !== void 0)) {
373
+ const a = r.clearcoatNormalTexture.scale;
374
+ e.clearcoatNormalScale = new ye(a, a);
375
+ }
376
+ return Promise.all(s);
377
+ }
378
+ }
379
+ class Kn {
380
+ constructor(n) {
381
+ this.parser = n, this.name = E.KHR_MATERIALS_DISPERSION;
382
+ }
383
+ getMaterialType(n) {
384
+ const i = this.parser.json.materials[n];
385
+ return !i.extensions || !i.extensions[this.name] ? null : C;
386
+ }
387
+ extendMaterialParams(n, e) {
388
+ const t = this.parser.json.materials[n];
389
+ if (!t.extensions || !t.extensions[this.name])
390
+ return Promise.resolve();
391
+ const s = t.extensions[this.name];
392
+ return e.dispersion = s.dispersion !== void 0 ? s.dispersion : 0, Promise.resolve();
393
+ }
394
+ }
395
+ class Vn {
396
+ constructor(n) {
397
+ this.parser = n, this.name = E.KHR_MATERIALS_IRIDESCENCE;
398
+ }
399
+ getMaterialType(n) {
400
+ const i = this.parser.json.materials[n];
401
+ return !i.extensions || !i.extensions[this.name] ? null : C;
402
+ }
403
+ extendMaterialParams(n, e) {
404
+ const i = this.parser, t = i.json.materials[n];
405
+ if (!t.extensions || !t.extensions[this.name])
406
+ return Promise.resolve();
407
+ const s = [], r = t.extensions[this.name];
408
+ return r.iridescenceFactor !== void 0 && (e.iridescence = r.iridescenceFactor), r.iridescenceTexture !== void 0 && s.push(i.assignTexture(e, "iridescenceMap", r.iridescenceTexture)), r.iridescenceIor !== void 0 && (e.iridescenceIOR = r.iridescenceIor), e.iridescenceThicknessRange === void 0 && (e.iridescenceThicknessRange = [100, 400]), r.iridescenceThicknessMinimum !== void 0 && (e.iridescenceThicknessRange[0] = r.iridescenceThicknessMinimum), r.iridescenceThicknessMaximum !== void 0 && (e.iridescenceThicknessRange[1] = r.iridescenceThicknessMaximum), r.iridescenceThicknessTexture !== void 0 && s.push(i.assignTexture(e, "iridescenceThicknessMap", r.iridescenceThicknessTexture)), Promise.all(s);
409
+ }
410
+ }
411
+ class Xn {
412
+ constructor(n) {
413
+ this.parser = n, this.name = E.KHR_MATERIALS_SHEEN;
414
+ }
415
+ getMaterialType(n) {
416
+ const i = this.parser.json.materials[n];
417
+ return !i.extensions || !i.extensions[this.name] ? null : C;
418
+ }
419
+ extendMaterialParams(n, e) {
420
+ const i = this.parser, t = i.json.materials[n];
421
+ if (!t.extensions || !t.extensions[this.name])
422
+ return Promise.resolve();
423
+ const s = [];
424
+ e.sheenColor = new D(0, 0, 0), e.sheenRoughness = 0, e.sheen = 1;
425
+ const r = t.extensions[this.name];
426
+ if (r.sheenColorFactor !== void 0) {
427
+ const a = r.sheenColorFactor;
428
+ e.sheenColor.setRGB(a[0], a[1], a[2], k);
429
+ }
430
+ return r.sheenRoughnessFactor !== void 0 && (e.sheenRoughness = r.sheenRoughnessFactor), r.sheenColorTexture !== void 0 && s.push(i.assignTexture(e, "sheenColorMap", r.sheenColorTexture, q)), r.sheenRoughnessTexture !== void 0 && s.push(i.assignTexture(e, "sheenRoughnessMap", r.sheenRoughnessTexture)), Promise.all(s);
431
+ }
432
+ }
433
+ class zn {
434
+ constructor(n) {
435
+ this.parser = n, this.name = E.KHR_MATERIALS_TRANSMISSION;
436
+ }
437
+ getMaterialType(n) {
438
+ const i = this.parser.json.materials[n];
439
+ return !i.extensions || !i.extensions[this.name] ? null : C;
440
+ }
441
+ extendMaterialParams(n, e) {
442
+ const i = this.parser, t = i.json.materials[n];
443
+ if (!t.extensions || !t.extensions[this.name])
444
+ return Promise.resolve();
445
+ const s = [], r = t.extensions[this.name];
446
+ return r.transmissionFactor !== void 0 && (e.transmission = r.transmissionFactor), r.transmissionTexture !== void 0 && s.push(i.assignTexture(e, "transmissionMap", r.transmissionTexture)), Promise.all(s);
447
+ }
448
+ }
449
+ class qn {
450
+ constructor(n) {
451
+ this.parser = n, this.name = E.KHR_MATERIALS_VOLUME;
452
+ }
453
+ getMaterialType(n) {
454
+ const i = this.parser.json.materials[n];
455
+ return !i.extensions || !i.extensions[this.name] ? null : C;
456
+ }
457
+ extendMaterialParams(n, e) {
458
+ const i = this.parser, t = i.json.materials[n];
459
+ if (!t.extensions || !t.extensions[this.name])
460
+ return Promise.resolve();
461
+ const s = [], r = t.extensions[this.name];
462
+ e.thickness = r.thicknessFactor !== void 0 ? r.thicknessFactor : 0, r.thicknessTexture !== void 0 && s.push(i.assignTexture(e, "thicknessMap", r.thicknessTexture)), e.attenuationDistance = r.attenuationDistance || 1 / 0;
463
+ const a = r.attenuationColor || [1, 1, 1];
464
+ return e.attenuationColor = new D().setRGB(a[0], a[1], a[2], k), Promise.all(s);
465
+ }
466
+ }
467
+ class Wn {
468
+ constructor(n) {
469
+ this.parser = n, this.name = E.KHR_MATERIALS_IOR;
470
+ }
471
+ getMaterialType(n) {
472
+ const i = this.parser.json.materials[n];
473
+ return !i.extensions || !i.extensions[this.name] ? null : C;
474
+ }
475
+ extendMaterialParams(n, e) {
476
+ const t = this.parser.json.materials[n];
477
+ if (!t.extensions || !t.extensions[this.name])
478
+ return Promise.resolve();
479
+ const s = t.extensions[this.name];
480
+ return e.ior = s.ior !== void 0 ? s.ior : 1.5, Promise.resolve();
481
+ }
482
+ }
483
+ class Yn {
484
+ constructor(n) {
485
+ this.parser = n, this.name = E.KHR_MATERIALS_SPECULAR;
486
+ }
487
+ getMaterialType(n) {
488
+ const i = this.parser.json.materials[n];
489
+ return !i.extensions || !i.extensions[this.name] ? null : C;
490
+ }
491
+ extendMaterialParams(n, e) {
492
+ const i = this.parser, t = i.json.materials[n];
493
+ if (!t.extensions || !t.extensions[this.name])
494
+ return Promise.resolve();
495
+ const s = [], r = t.extensions[this.name];
496
+ e.specularIntensity = r.specularFactor !== void 0 ? r.specularFactor : 1, r.specularTexture !== void 0 && s.push(i.assignTexture(e, "specularIntensityMap", r.specularTexture));
497
+ const a = r.specularColorFactor || [1, 1, 1];
498
+ return e.specularColor = new D().setRGB(a[0], a[1], a[2], k), r.specularColorTexture !== void 0 && s.push(i.assignTexture(e, "specularColorMap", r.specularColorTexture, q)), Promise.all(s);
499
+ }
500
+ }
501
+ class $n {
502
+ constructor(n) {
503
+ this.parser = n, this.name = E.EXT_MATERIALS_BUMP;
504
+ }
505
+ getMaterialType(n) {
506
+ const i = this.parser.json.materials[n];
507
+ return !i.extensions || !i.extensions[this.name] ? null : C;
508
+ }
509
+ extendMaterialParams(n, e) {
510
+ const i = this.parser, t = i.json.materials[n];
511
+ if (!t.extensions || !t.extensions[this.name])
512
+ return Promise.resolve();
513
+ const s = [], r = t.extensions[this.name];
514
+ return e.bumpScale = r.bumpFactor !== void 0 ? r.bumpFactor : 1, r.bumpTexture !== void 0 && s.push(i.assignTexture(e, "bumpMap", r.bumpTexture)), Promise.all(s);
515
+ }
516
+ }
517
+ class Jn {
518
+ constructor(n) {
519
+ this.parser = n, this.name = E.KHR_MATERIALS_ANISOTROPY;
520
+ }
521
+ getMaterialType(n) {
522
+ const i = this.parser.json.materials[n];
523
+ return !i.extensions || !i.extensions[this.name] ? null : C;
524
+ }
525
+ extendMaterialParams(n, e) {
526
+ const i = this.parser, t = i.json.materials[n];
527
+ if (!t.extensions || !t.extensions[this.name])
528
+ return Promise.resolve();
529
+ const s = [], r = t.extensions[this.name];
530
+ return r.anisotropyStrength !== void 0 && (e.anisotropy = r.anisotropyStrength), r.anisotropyRotation !== void 0 && (e.anisotropyRotation = r.anisotropyRotation), r.anisotropyTexture !== void 0 && s.push(i.assignTexture(e, "anisotropyMap", r.anisotropyTexture)), Promise.all(s);
531
+ }
532
+ }
533
+ class Qn {
534
+ constructor(n) {
535
+ this.parser = n, this.name = E.KHR_TEXTURE_BASISU;
536
+ }
537
+ loadTexture(n) {
538
+ const e = this.parser, i = e.json, t = i.textures[n];
539
+ if (!t.extensions || !t.extensions[this.name])
540
+ return null;
541
+ const s = t.extensions[this.name], r = e.options.ktx2Loader;
542
+ if (!r) {
543
+ if (i.extensionsRequired && i.extensionsRequired.indexOf(this.name) >= 0)
544
+ throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");
545
+ return null;
546
+ }
547
+ return e.loadTextureImage(n, s.source, r);
548
+ }
549
+ }
550
+ class Zn {
551
+ constructor(n) {
552
+ this.parser = n, this.name = E.EXT_TEXTURE_WEBP;
553
+ }
554
+ loadTexture(n) {
555
+ const e = this.name, i = this.parser, t = i.json, s = t.textures[n];
556
+ if (!s.extensions || !s.extensions[e])
557
+ return null;
558
+ const r = s.extensions[e], a = t.images[r.source];
559
+ let o = i.textureLoader;
560
+ if (a.uri) {
561
+ const c = i.options.manager.getHandler(a.uri);
562
+ c !== null && (o = c);
563
+ }
564
+ return i.loadTextureImage(n, r.source, o);
565
+ }
566
+ }
567
+ class et {
568
+ constructor(n) {
569
+ this.parser = n, this.name = E.EXT_TEXTURE_AVIF;
570
+ }
571
+ loadTexture(n) {
572
+ const e = this.name, i = this.parser, t = i.json, s = t.textures[n];
573
+ if (!s.extensions || !s.extensions[e])
574
+ return null;
575
+ const r = s.extensions[e], a = t.images[r.source];
576
+ let o = i.textureLoader;
577
+ if (a.uri) {
578
+ const c = i.options.manager.getHandler(a.uri);
579
+ c !== null && (o = c);
580
+ }
581
+ return i.loadTextureImage(n, r.source, o);
582
+ }
583
+ }
584
+ class nt {
585
+ constructor(n) {
586
+ this.name = E.EXT_MESHOPT_COMPRESSION, this.parser = n;
587
+ }
588
+ loadBufferView(n) {
589
+ const e = this.parser.json, i = e.bufferViews[n];
590
+ if (i.extensions && i.extensions[this.name]) {
591
+ const t = i.extensions[this.name], s = this.parser.getDependency("buffer", t.buffer), r = this.parser.options.meshoptDecoder;
592
+ if (!r || !r.supported) {
593
+ if (e.extensionsRequired && e.extensionsRequired.indexOf(this.name) >= 0)
594
+ throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");
595
+ return null;
596
+ }
597
+ return s.then(function(a) {
598
+ const o = t.byteOffset || 0, c = t.byteLength || 0, u = t.count, l = t.byteStride, f = new Uint8Array(a, o, c);
599
+ return r.decodeGltfBufferAsync ? r.decodeGltfBufferAsync(u, l, f, t.mode, t.filter).then(function(h) {
600
+ return h.buffer;
601
+ }) : r.ready.then(function() {
602
+ const h = new ArrayBuffer(u * l);
603
+ return r.decodeGltfBuffer(new Uint8Array(h), u, l, f, t.mode, t.filter), h;
604
+ });
605
+ });
606
+ } else
607
+ return null;
608
+ }
609
+ }
610
+ class tt {
611
+ constructor(n) {
612
+ this.name = E.EXT_MESH_GPU_INSTANCING, this.parser = n;
613
+ }
614
+ createNodeMesh(n) {
615
+ const e = this.parser.json, i = e.nodes[n];
616
+ if (!i.extensions || !i.extensions[this.name] || i.mesh === void 0)
617
+ return null;
618
+ const t = e.meshes[i.mesh];
619
+ for (const c of t.primitives)
620
+ if (c.mode !== I.TRIANGLES && c.mode !== I.TRIANGLE_STRIP && c.mode !== I.TRIANGLE_FAN && c.mode !== void 0)
621
+ return null;
622
+ const r = i.extensions[this.name].attributes, a = [], o = {};
623
+ for (const c in r)
624
+ a.push(this.parser.getDependency("accessor", r[c]).then((u) => (o[c] = u, o[c])));
625
+ return a.length < 1 ? null : (a.push(this.parser.createNodeMesh(n)), Promise.all(a).then((c) => {
626
+ const u = c.pop(), l = u.isGroup ? u.children : [u], f = c[0].count, h = [];
627
+ for (const p of l) {
628
+ const R = new $(), m = new U(), T = new be(), A = new U(1, 1, 1), w = new en(p.geometry, p.material, f);
629
+ for (let x = 0; x < f; x++)
630
+ o.TRANSLATION && m.fromBufferAttribute(o.TRANSLATION, x), o.ROTATION && T.fromBufferAttribute(o.ROTATION, x), o.SCALE && A.fromBufferAttribute(o.SCALE, x), w.setMatrixAt(x, R.compose(m, T, A));
631
+ for (const x in o)
632
+ if (x === "_COLOR_0") {
633
+ const L = o[x];
634
+ w.instanceColor = new nn(L.array, L.itemSize, L.normalized);
635
+ } else x !== "TRANSLATION" && x !== "ROTATION" && x !== "SCALE" && p.geometry.setAttribute(x, o[x]);
636
+ Se.prototype.copy.call(w, p), this.parser.assignFinalMaterial(w), h.push(w);
637
+ }
638
+ return u.isGroup ? (u.clear(), u.add(...h), u) : h[0];
639
+ }));
640
+ }
641
+ }
642
+ const Fe = "glTF", V = 12, Ee = { JSON: 1313821514, BIN: 5130562 };
643
+ class st {
644
+ constructor(n) {
645
+ this.name = E.KHR_BINARY_GLTF, this.content = null, this.body = null;
646
+ const e = new DataView(n, 0, V), i = new TextDecoder();
647
+ if (this.header = {
648
+ magic: i.decode(new Uint8Array(n.slice(0, 4))),
649
+ version: e.getUint32(4, !0),
650
+ length: e.getUint32(8, !0)
651
+ }, this.header.magic !== Fe)
652
+ throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");
653
+ if (this.header.version < 2)
654
+ throw new Error("THREE.GLTFLoader: Legacy binary file detected.");
655
+ const t = this.header.length - V, s = new DataView(n, V);
656
+ let r = 0;
657
+ for (; r < t; ) {
658
+ const a = s.getUint32(r, !0);
659
+ r += 4;
660
+ const o = s.getUint32(r, !0);
661
+ if (r += 4, o === Ee.JSON) {
662
+ const c = new Uint8Array(n, V + r, a);
663
+ this.content = i.decode(c);
664
+ } else if (o === Ee.BIN) {
665
+ const c = V + r;
666
+ this.body = n.slice(c, c + a);
667
+ }
668
+ r += a;
669
+ }
670
+ if (this.content === null)
671
+ throw new Error("THREE.GLTFLoader: JSON content not found.");
672
+ }
673
+ }
674
+ class rt {
675
+ constructor(n, e) {
676
+ if (!e)
677
+ throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");
678
+ this.name = E.KHR_DRACO_MESH_COMPRESSION, this.json = n, this.dracoLoader = e, this.dracoLoader.preload();
679
+ }
680
+ decodePrimitive(n, e) {
681
+ const i = this.json, t = this.dracoLoader, s = n.extensions[this.name].bufferView, r = n.extensions[this.name].attributes, a = {}, o = {}, c = {};
682
+ for (const u in r) {
683
+ const l = le[u] || u.toLowerCase();
684
+ a[l] = r[u];
685
+ }
686
+ for (const u in n.attributes) {
687
+ const l = le[u] || u.toLowerCase();
688
+ if (r[u] !== void 0) {
689
+ const f = i.accessors[n.attributes[u]], h = j[f.componentType];
690
+ c[l] = h.name, o[l] = f.normalized === !0;
691
+ }
692
+ }
693
+ return e.getDependency("bufferView", s).then(function(u) {
694
+ return new Promise(function(l, f) {
695
+ t.decodeDracoFile(u, function(h) {
696
+ for (const p in h.attributes) {
697
+ const R = h.attributes[p], m = o[p];
698
+ m !== void 0 && (R.normalized = m);
699
+ }
700
+ l(h);
701
+ }, a, c, k, f);
702
+ });
703
+ });
704
+ }
705
+ }
706
+ class it {
707
+ constructor() {
708
+ this.name = E.KHR_TEXTURE_TRANSFORM;
709
+ }
710
+ extendTexture(n, e) {
711
+ return (e.texCoord === void 0 || e.texCoord === n.channel) && e.offset === void 0 && e.rotation === void 0 && e.scale === void 0 || (n = n.clone(), e.texCoord !== void 0 && (n.channel = e.texCoord), e.offset !== void 0 && n.offset.fromArray(e.offset), e.rotation !== void 0 && (n.rotation = e.rotation), e.scale !== void 0 && n.repeat.fromArray(e.scale), n.needsUpdate = !0), n;
712
+ }
713
+ }
714
+ class ot {
715
+ constructor() {
716
+ this.name = E.KHR_MESH_QUANTIZATION;
717
+ }
718
+ }
719
+ class Pe extends In {
720
+ constructor(n, e, i, t) {
721
+ super(n, e, i, t);
722
+ }
723
+ copySampleValue_(n) {
724
+ const e = this.resultBuffer, i = this.sampleValues, t = this.valueSize, s = n * t * 3 + t;
725
+ for (let r = 0; r !== t; r++)
726
+ e[r] = i[s + r];
727
+ return e;
728
+ }
729
+ interpolate_(n, e, i, t) {
730
+ const s = this.resultBuffer, r = this.sampleValues, a = this.valueSize, o = a * 2, c = a * 3, u = t - e, l = (i - e) / u, f = l * l, h = f * l, p = n * c, R = p - c, m = -2 * h + 3 * f, T = h - f, A = 1 - m, w = T - f + l;
731
+ for (let x = 0; x !== a; x++) {
732
+ const L = r[R + x + a], N = r[R + x + o] * u, y = r[p + x + a], O = r[p + x] * u;
733
+ s[x] = A * L + w * N + m * y + T * O;
734
+ }
735
+ return s;
736
+ }
737
+ }
738
+ const at = new be();
739
+ class ct extends Pe {
740
+ interpolate_(n, e, i, t) {
741
+ const s = super.interpolate_(n, e, i, t);
742
+ return at.fromArray(s).normalize().toArray(s), s;
743
+ }
744
+ }
745
+ const I = {
746
+ POINTS: 0,
747
+ LINES: 1,
748
+ LINE_LOOP: 2,
749
+ LINE_STRIP: 3,
750
+ TRIANGLES: 4,
751
+ TRIANGLE_STRIP: 5,
752
+ TRIANGLE_FAN: 6
753
+ }, j = {
754
+ 5120: Int8Array,
755
+ 5121: Uint8Array,
756
+ 5122: Int16Array,
757
+ 5123: Uint16Array,
758
+ 5125: Uint32Array,
759
+ 5126: Float32Array
760
+ }, Ae = {
761
+ 9728: Ie,
762
+ 9729: ae,
763
+ 9984: cn,
764
+ 9985: an,
765
+ 9986: on,
766
+ 9987: Ne
767
+ }, Le = {
768
+ 33071: un,
769
+ 33648: ln,
770
+ 10497: ce
771
+ }, se = {
772
+ SCALAR: 1,
773
+ VEC2: 2,
774
+ VEC3: 3,
775
+ VEC4: 4,
776
+ MAT2: 4,
777
+ MAT3: 9,
778
+ MAT4: 16
779
+ }, le = {
780
+ POSITION: "position",
781
+ NORMAL: "normal",
782
+ TANGENT: "tangent",
783
+ TEXCOORD_0: "uv",
784
+ TEXCOORD_1: "uv1",
785
+ TEXCOORD_2: "uv2",
786
+ TEXCOORD_3: "uv3",
787
+ COLOR_0: "color",
788
+ WEIGHTS_0: "skinWeight",
789
+ JOINTS_0: "skinIndex"
790
+ }, F = {
791
+ scale: "scale",
792
+ translation: "position",
793
+ rotation: "quaternion",
794
+ weights: "morphTargetInfluences"
795
+ }, lt = {
796
+ CUBICSPLINE: void 0,
797
+ // We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each
798
+ // keyframe track will be initialized with a default interpolation type, then modified.
799
+ LINEAR: ve,
800
+ STEP: bn
801
+ }, re = {
802
+ OPAQUE: "OPAQUE",
803
+ MASK: "MASK",
804
+ BLEND: "BLEND"
805
+ };
806
+ function ut(d) {
807
+ return d.DefaultMaterial === void 0 && (d.DefaultMaterial = new Ce({
808
+ color: 16777215,
809
+ emissive: 0,
810
+ metalness: 1,
811
+ roughness: 1,
812
+ transparent: !1,
813
+ depthTest: !0,
814
+ side: Nn
815
+ })), d.DefaultMaterial;
816
+ }
817
+ function P(d, n, e) {
818
+ for (const i in e.extensions)
819
+ d[i] === void 0 && (n.userData.gltfExtensions = n.userData.gltfExtensions || {}, n.userData.gltfExtensions[i] = e.extensions[i]);
820
+ }
821
+ function v(d, n) {
822
+ n.extras !== void 0 && (typeof n.extras == "object" ? Object.assign(d.userData, n.extras) : console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, " + n.extras));
823
+ }
824
+ function dt(d, n, e) {
825
+ let i = !1, t = !1, s = !1;
826
+ for (let c = 0, u = n.length; c < u; c++) {
827
+ const l = n[c];
828
+ if (l.POSITION !== void 0 && (i = !0), l.NORMAL !== void 0 && (t = !0), l.COLOR_0 !== void 0 && (s = !0), i && t && s) break;
829
+ }
830
+ if (!i && !t && !s) return Promise.resolve(d);
831
+ const r = [], a = [], o = [];
832
+ for (let c = 0, u = n.length; c < u; c++) {
833
+ const l = n[c];
834
+ if (i) {
835
+ const f = l.POSITION !== void 0 ? e.getDependency("accessor", l.POSITION) : d.attributes.position;
836
+ r.push(f);
837
+ }
838
+ if (t) {
839
+ const f = l.NORMAL !== void 0 ? e.getDependency("accessor", l.NORMAL) : d.attributes.normal;
840
+ a.push(f);
841
+ }
842
+ if (s) {
843
+ const f = l.COLOR_0 !== void 0 ? e.getDependency("accessor", l.COLOR_0) : d.attributes.color;
844
+ o.push(f);
845
+ }
846
+ }
847
+ return Promise.all([
848
+ Promise.all(r),
849
+ Promise.all(a),
850
+ Promise.all(o)
851
+ ]).then(function(c) {
852
+ const u = c[0], l = c[1], f = c[2];
853
+ return i && (d.morphAttributes.position = u), t && (d.morphAttributes.normal = l), s && (d.morphAttributes.color = f), d.morphTargetsRelative = !0, d;
854
+ });
855
+ }
856
+ function ft(d, n) {
857
+ if (d.updateMorphTargets(), n.weights !== void 0)
858
+ for (let e = 0, i = n.weights.length; e < i; e++)
859
+ d.morphTargetInfluences[e] = n.weights[e];
860
+ if (n.extras && Array.isArray(n.extras.targetNames)) {
861
+ const e = n.extras.targetNames;
862
+ if (d.morphTargetInfluences.length === e.length) {
863
+ d.morphTargetDictionary = {};
864
+ for (let i = 0, t = e.length; i < t; i++)
865
+ d.morphTargetDictionary[e[i]] = i;
866
+ } else
867
+ console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.");
868
+ }
869
+ }
870
+ function ht(d) {
871
+ let n;
872
+ const e = d.extensions && d.extensions[E.KHR_DRACO_MESH_COMPRESSION];
873
+ if (e ? n = "draco:" + e.bufferView + ":" + e.indices + ":" + ie(e.attributes) : n = d.indices + ":" + ie(d.attributes) + ":" + d.mode, d.targets !== void 0)
874
+ for (let i = 0, t = d.targets.length; i < t; i++)
875
+ n += ":" + ie(d.targets[i]);
876
+ return n;
877
+ }
878
+ function ie(d) {
879
+ let n = "";
880
+ const e = Object.keys(d).sort();
881
+ for (let i = 0, t = e.length; i < t; i++)
882
+ n += e[i] + ":" + d[e[i]] + ";";
883
+ return n;
884
+ }
885
+ function ue(d) {
886
+ switch (d) {
887
+ case Int8Array:
888
+ return 1 / 127;
889
+ case Uint8Array:
890
+ return 1 / 255;
891
+ case Int16Array:
892
+ return 1 / 32767;
893
+ case Uint16Array:
894
+ return 1 / 65535;
895
+ default:
896
+ throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.");
897
+ }
898
+ }
899
+ function pt(d) {
900
+ 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" : d.search(/\.ktx2($|\?)/i) > 0 || d.search(/^data\:image\/ktx2/) === 0 ? "image/ktx2" : "image/png";
901
+ }
902
+ const mt = new $();
903
+ class gt {
904
+ constructor(n = {}, e = {}) {
905
+ this.json = n, this.extensions = {}, this.plugins = {}, this.options = e, this.cache = new Hn(), 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 = {};
906
+ let i = !1, t = -1, s = !1, r = -1;
907
+ if (typeof navigator < "u") {
908
+ const a = navigator.userAgent;
909
+ i = /^((?!chrome|android).)*safari/i.test(a) === !0;
910
+ const o = a.match(/Version\/(\d+)/);
911
+ t = i && o ? parseInt(o[1], 10) : -1, s = a.indexOf("Firefox") > -1, r = s ? a.match(/Firefox\/([0-9]+)\./)[1] : -1;
912
+ }
913
+ typeof createImageBitmap > "u" || i && t < 17 || s && r < 98 ? this.textureLoader = new tn(this.options.manager) : this.textureLoader = new sn(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.textureLoader.setRequestHeader(this.options.requestHeader), this.fileLoader = new we(this.options.manager), this.fileLoader.setResponseType("arraybuffer"), this.options.crossOrigin === "use-credentials" && this.fileLoader.setWithCredentials(!0);
914
+ }
915
+ setExtensions(n) {
916
+ this.extensions = n;
917
+ }
918
+ setPlugins(n) {
919
+ this.plugins = n;
920
+ }
921
+ parse(n, e) {
922
+ const i = this, t = this.json, s = this.extensions;
923
+ this.cache.removeAll(), this.nodeCache = {}, this._invokeAll(function(r) {
924
+ return r._markDefs && r._markDefs();
925
+ }), Promise.all(this._invokeAll(function(r) {
926
+ return r.beforeRoot && r.beforeRoot();
927
+ })).then(function() {
928
+ return Promise.all([
929
+ i.getDependencies("scene"),
930
+ i.getDependencies("animation"),
931
+ i.getDependencies("camera")
932
+ ]);
933
+ }).then(function(r) {
934
+ const a = {
935
+ scene: r[0][t.scene || 0],
936
+ scenes: r[0],
937
+ animations: r[1],
938
+ cameras: r[2],
939
+ asset: t.asset,
940
+ parser: i,
941
+ userData: {}
942
+ };
943
+ return P(s, a, t), v(a, t), Promise.all(i._invokeAll(function(o) {
944
+ return o.afterRoot && o.afterRoot(a);
945
+ })).then(function() {
946
+ for (const o of a.scenes)
947
+ o.updateMatrixWorld();
948
+ n(a);
949
+ });
950
+ }).catch(e);
951
+ }
952
+ /**
953
+ * Marks the special nodes/meshes in json for efficient parse.
954
+ *
955
+ * @private
956
+ */
957
+ _markDefs() {
958
+ const n = this.json.nodes || [], e = this.json.skins || [], i = this.json.meshes || [];
959
+ for (let t = 0, s = e.length; t < s; t++) {
960
+ const r = e[t].joints;
961
+ for (let a = 0, o = r.length; a < o; a++)
962
+ n[r[a]].isBone = !0;
963
+ }
964
+ for (let t = 0, s = n.length; t < s; t++) {
965
+ const r = n[t];
966
+ r.mesh !== void 0 && (this._addNodeRef(this.meshCache, r.mesh), r.skin !== void 0 && (i[r.mesh].isSkinnedMesh = !0)), r.camera !== void 0 && this._addNodeRef(this.cameraCache, r.camera);
967
+ }
968
+ }
969
+ /**
970
+ * Counts references to shared node / Object3D resources. These resources
971
+ * can be reused, or "instantiated", at multiple nodes in the scene
972
+ * hierarchy. Mesh, Camera, and Light instances are instantiated and must
973
+ * be marked. Non-scenegraph resources (like Materials, Geometries, and
974
+ * Textures) can be reused directly and are not marked here.
975
+ *
976
+ * Example: CesiumMilkTruck sample model reuses "Wheel" meshes.
977
+ *
978
+ * @private
979
+ * @param {Object} cache
980
+ * @param {Object3D} index
981
+ */
982
+ _addNodeRef(n, e) {
983
+ e !== void 0 && (n.refs[e] === void 0 && (n.refs[e] = n.uses[e] = 0), n.refs[e]++);
984
+ }
985
+ /**
986
+ * Returns a reference to a shared resource, cloning it if necessary.
987
+ *
988
+ * @private
989
+ * @param {Object} cache
990
+ * @param {number} index
991
+ * @param {Object} object
992
+ * @return {Object}
993
+ */
994
+ _getNodeRef(n, e, i) {
995
+ if (n.refs[e] <= 1) return i;
996
+ const t = i.clone(), s = (r, a) => {
997
+ const o = this.associations.get(r);
998
+ o != null && this.associations.set(a, o);
999
+ for (const [c, u] of r.children.entries())
1000
+ s(u, a.children[c]);
1001
+ };
1002
+ return s(i, t), t.name += "_instance_" + n.uses[e]++, t;
1003
+ }
1004
+ _invokeOne(n) {
1005
+ const e = Object.values(this.plugins);
1006
+ e.push(this);
1007
+ for (let i = 0; i < e.length; i++) {
1008
+ const t = n(e[i]);
1009
+ if (t) return t;
1010
+ }
1011
+ return null;
1012
+ }
1013
+ _invokeAll(n) {
1014
+ const e = Object.values(this.plugins);
1015
+ e.unshift(this);
1016
+ const i = [];
1017
+ for (let t = 0; t < e.length; t++) {
1018
+ const s = n(e[t]);
1019
+ s && i.push(s);
1020
+ }
1021
+ return i;
1022
+ }
1023
+ /**
1024
+ * Requests the specified dependency asynchronously, with caching.
1025
+ *
1026
+ * @private
1027
+ * @param {string} type
1028
+ * @param {number} index
1029
+ * @return {Promise<Object3D|Material|THREE.Texture|AnimationClip|ArrayBuffer|Object>}
1030
+ */
1031
+ getDependency(n, e) {
1032
+ const i = n + ":" + e;
1033
+ let t = this.cache.get(i);
1034
+ if (!t) {
1035
+ switch (n) {
1036
+ case "scene":
1037
+ t = this.loadScene(e);
1038
+ break;
1039
+ case "node":
1040
+ t = this._invokeOne(function(s) {
1041
+ return s.loadNode && s.loadNode(e);
1042
+ });
1043
+ break;
1044
+ case "mesh":
1045
+ t = this._invokeOne(function(s) {
1046
+ return s.loadMesh && s.loadMesh(e);
1047
+ });
1048
+ break;
1049
+ case "accessor":
1050
+ t = this.loadAccessor(e);
1051
+ break;
1052
+ case "bufferView":
1053
+ t = this._invokeOne(function(s) {
1054
+ return s.loadBufferView && s.loadBufferView(e);
1055
+ });
1056
+ break;
1057
+ case "buffer":
1058
+ t = this.loadBuffer(e);
1059
+ break;
1060
+ case "material":
1061
+ t = this._invokeOne(function(s) {
1062
+ return s.loadMaterial && s.loadMaterial(e);
1063
+ });
1064
+ break;
1065
+ case "texture":
1066
+ t = this._invokeOne(function(s) {
1067
+ return s.loadTexture && s.loadTexture(e);
1068
+ });
1069
+ break;
1070
+ case "skin":
1071
+ t = this.loadSkin(e);
1072
+ break;
1073
+ case "animation":
1074
+ t = this._invokeOne(function(s) {
1075
+ return s.loadAnimation && s.loadAnimation(e);
1076
+ });
1077
+ break;
1078
+ case "camera":
1079
+ t = this.loadCamera(e);
1080
+ break;
1081
+ default:
1082
+ if (t = this._invokeOne(function(s) {
1083
+ return s != this && s.getDependency && s.getDependency(n, e);
1084
+ }), !t)
1085
+ throw new Error("Unknown type: " + n);
1086
+ break;
1087
+ }
1088
+ this.cache.add(i, t);
1089
+ }
1090
+ return t;
1091
+ }
1092
+ /**
1093
+ * Requests all dependencies of the specified type asynchronously, with caching.
1094
+ *
1095
+ * @private
1096
+ * @param {string} type
1097
+ * @return {Promise<Array<Object>>}
1098
+ */
1099
+ getDependencies(n) {
1100
+ let e = this.cache.get(n);
1101
+ if (!e) {
1102
+ const i = this, t = this.json[n + (n === "mesh" ? "es" : "s")] || [];
1103
+ e = Promise.all(t.map(function(s, r) {
1104
+ return i.getDependency(n, r);
1105
+ })), this.cache.add(n, e);
1106
+ }
1107
+ return e;
1108
+ }
1109
+ /**
1110
+ * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views
1111
+ *
1112
+ * @private
1113
+ * @param {number} bufferIndex
1114
+ * @return {Promise<ArrayBuffer>}
1115
+ */
1116
+ loadBuffer(n) {
1117
+ const e = this.json.buffers[n], i = this.fileLoader;
1118
+ if (e.type && e.type !== "arraybuffer")
1119
+ throw new Error("THREE.GLTFLoader: " + e.type + " buffer type is not supported.");
1120
+ if (e.uri === void 0 && n === 0)
1121
+ return Promise.resolve(this.extensions[E.KHR_BINARY_GLTF].body);
1122
+ const t = this.options;
1123
+ return new Promise(function(s, r) {
1124
+ i.load(z.resolveURL(e.uri, t.path), s, void 0, function() {
1125
+ r(new Error('THREE.GLTFLoader: Failed to load buffer "' + e.uri + '".'));
1126
+ });
1127
+ });
1128
+ }
1129
+ /**
1130
+ * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views
1131
+ *
1132
+ * @private
1133
+ * @param {number} bufferViewIndex
1134
+ * @return {Promise<ArrayBuffer>}
1135
+ */
1136
+ loadBufferView(n) {
1137
+ const e = this.json.bufferViews[n];
1138
+ return this.getDependency("buffer", e.buffer).then(function(i) {
1139
+ const t = e.byteLength || 0, s = e.byteOffset || 0;
1140
+ return i.slice(s, s + t);
1141
+ });
1142
+ }
1143
+ /**
1144
+ * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#accessors
1145
+ *
1146
+ * @private
1147
+ * @param {number} accessorIndex
1148
+ * @return {Promise<BufferAttribute|InterleavedBufferAttribute>}
1149
+ */
1150
+ loadAccessor(n) {
1151
+ const e = this, i = this.json, t = this.json.accessors[n];
1152
+ if (t.bufferView === void 0 && t.sparse === void 0) {
1153
+ const r = se[t.type], a = j[t.componentType], o = t.normalized === !0, c = new a(t.count * r);
1154
+ return Promise.resolve(new ee(c, r, o));
1155
+ }
1156
+ const s = [];
1157
+ return t.bufferView !== void 0 ? s.push(this.getDependency("bufferView", t.bufferView)) : s.push(null), t.sparse !== void 0 && (s.push(this.getDependency("bufferView", t.sparse.indices.bufferView)), s.push(this.getDependency("bufferView", t.sparse.values.bufferView))), Promise.all(s).then(function(r) {
1158
+ const a = r[0], o = se[t.type], c = j[t.componentType], u = c.BYTES_PER_ELEMENT, l = u * o, f = t.byteOffset || 0, h = t.bufferView !== void 0 ? i.bufferViews[t.bufferView].byteStride : void 0, p = t.normalized === !0;
1159
+ let R, m;
1160
+ if (h && h !== l) {
1161
+ const T = Math.floor(f / h), A = "InterleavedBuffer:" + t.bufferView + ":" + t.componentType + ":" + T + ":" + t.count;
1162
+ let w = e.cache.get(A);
1163
+ w || (R = new c(a, T * h, t.count * h / u), w = new rn(R, h / u), e.cache.add(A, w)), m = new Sn(w, o, f % h / u, p);
1164
+ } else
1165
+ a === null ? R = new c(t.count * o) : R = new c(a, f, t.count * o), m = new ee(R, o, p);
1166
+ if (t.sparse !== void 0) {
1167
+ const T = se.SCALAR, A = j[t.sparse.indices.componentType], w = t.sparse.indices.byteOffset || 0, x = t.sparse.values.byteOffset || 0, L = new A(r[1], w, t.sparse.count * T), N = new c(r[2], x, t.sparse.count * o);
1168
+ a !== null && (m = new ee(m.array.slice(), m.itemSize, m.normalized)), m.normalized = !1;
1169
+ for (let y = 0, O = L.length; y < O; y++) {
1170
+ const _ = L[y];
1171
+ if (m.setX(_, N[y * o]), o >= 2 && m.setY(_, N[y * o + 1]), o >= 3 && m.setZ(_, N[y * o + 2]), o >= 4 && m.setW(_, N[y * o + 3]), o >= 5) throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
1172
+ }
1173
+ m.normalized = p;
1174
+ }
1175
+ return m;
1176
+ });
1177
+ }
1178
+ /**
1179
+ * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#textures
1180
+ *
1181
+ * @private
1182
+ * @param {number} textureIndex
1183
+ * @return {Promise<THREE.Texture|null>}
1184
+ */
1185
+ loadTexture(n) {
1186
+ const e = this.json, i = this.options, s = e.textures[n].source, r = e.images[s];
1187
+ let a = this.textureLoader;
1188
+ if (r.uri) {
1189
+ const o = i.manager.getHandler(r.uri);
1190
+ o !== null && (a = o);
1191
+ }
1192
+ return this.loadTextureImage(n, s, a);
1193
+ }
1194
+ loadTextureImage(n, e, i) {
1195
+ const t = this, s = this.json, r = s.textures[n], a = s.images[e], o = (a.uri || a.bufferView) + ":" + r.sampler;
1196
+ if (this.textureCache[o])
1197
+ return this.textureCache[o];
1198
+ const c = this.loadImageSource(e, i).then(function(u) {
1199
+ u.flipY = !1, u.name = r.name || a.name || "", u.name === "" && typeof a.uri == "string" && a.uri.startsWith("data:image/") === !1 && (u.name = a.uri);
1200
+ const f = (s.samplers || {})[r.sampler] || {};
1201
+ return u.magFilter = Ae[f.magFilter] || ae, u.minFilter = Ae[f.minFilter] || Ne, u.wrapS = Le[f.wrapS] || ce, u.wrapT = Le[f.wrapT] || ce, u.generateMipmaps = !u.isCompressedTexture && u.minFilter !== Ie && u.minFilter !== ae, t.associations.set(u, { textures: n }), u;
1202
+ }).catch(function() {
1203
+ return null;
1204
+ });
1205
+ return this.textureCache[o] = c, c;
1206
+ }
1207
+ loadImageSource(n, e) {
1208
+ const i = this, t = this.json, s = this.options;
1209
+ if (this.sourceCache[n] !== void 0)
1210
+ return this.sourceCache[n].then((l) => l.clone());
1211
+ const r = t.images[n], a = self.URL || self.webkitURL;
1212
+ let o = r.uri || "", c = !1;
1213
+ if (r.bufferView !== void 0)
1214
+ o = i.getDependency("bufferView", r.bufferView).then(function(l) {
1215
+ c = !0;
1216
+ const f = new Blob([l], { type: r.mimeType });
1217
+ return o = a.createObjectURL(f), o;
1218
+ });
1219
+ else if (r.uri === void 0)
1220
+ throw new Error("THREE.GLTFLoader: Image " + n + " is missing URI and bufferView");
1221
+ const u = Promise.resolve(o).then(function(l) {
1222
+ return new Promise(function(f, h) {
1223
+ let p = f;
1224
+ e.isImageBitmapLoader === !0 && (p = function(R) {
1225
+ const m = new he(R);
1226
+ m.needsUpdate = !0, f(m);
1227
+ }), e.load(z.resolveURL(l, s.path), p, void 0, h);
1228
+ });
1229
+ }).then(function(l) {
1230
+ return c === !0 && a.revokeObjectURL(o), v(l, r), l.userData.mimeType = r.mimeType || pt(r.uri), l;
1231
+ }).catch(function(l) {
1232
+ throw console.error("THREE.GLTFLoader: Couldn't load texture", o), l;
1233
+ });
1234
+ return this.sourceCache[n] = u, u;
1235
+ }
1236
+ /**
1237
+ * Asynchronously assigns a texture to the given material parameters.
1238
+ *
1239
+ * @private
1240
+ * @param {Object} materialParams
1241
+ * @param {string} mapName
1242
+ * @param {Object} mapDef
1243
+ * @param {string} [colorSpace]
1244
+ * @return {Promise<Texture>}
1245
+ */
1246
+ assignTexture(n, e, i, t) {
1247
+ const s = this;
1248
+ return this.getDependency("texture", i.index).then(function(r) {
1249
+ if (!r) return null;
1250
+ if (i.texCoord !== void 0 && i.texCoord > 0 && (r = r.clone(), r.channel = i.texCoord), s.extensions[E.KHR_TEXTURE_TRANSFORM]) {
1251
+ const a = i.extensions !== void 0 ? i.extensions[E.KHR_TEXTURE_TRANSFORM] : void 0;
1252
+ if (a) {
1253
+ const o = s.associations.get(r);
1254
+ r = s.extensions[E.KHR_TEXTURE_TRANSFORM].extendTexture(r, a), s.associations.set(r, o);
1255
+ }
1256
+ }
1257
+ return t !== void 0 && (r.colorSpace = t), n[e] = r, r;
1258
+ });
1259
+ }
1260
+ /**
1261
+ * Assigns final material to a Mesh, Line, or Points instance. The instance
1262
+ * already has a material (generated from the glTF material options alone)
1263
+ * but reuse of the same glTF material may require multiple threejs materials
1264
+ * to accommodate different primitive types, defines, etc. New materials will
1265
+ * be created if necessary, and reused from a cache.
1266
+ *
1267
+ * @private
1268
+ * @param {Object3D} mesh Mesh, Line, or Points instance.
1269
+ */
1270
+ assignFinalMaterial(n) {
1271
+ const e = n.geometry;
1272
+ let i = n.material;
1273
+ const t = e.attributes.tangent === void 0, s = e.attributes.color !== void 0, r = e.attributes.normal === void 0;
1274
+ if (n.isPoints) {
1275
+ const a = "PointsMaterial:" + i.uuid;
1276
+ let o = this.cache.get(a);
1277
+ o || (o = new dn(), ne.prototype.copy.call(o, i), o.color.copy(i.color), o.map = i.map, o.sizeAttenuation = !1, this.cache.add(a, o)), i = o;
1278
+ } else if (n.isLine) {
1279
+ const a = "LineBasicMaterial:" + i.uuid;
1280
+ let o = this.cache.get(a);
1281
+ o || (o = new fn(), ne.prototype.copy.call(o, i), o.color.copy(i.color), o.map = i.map, this.cache.add(a, o)), i = o;
1282
+ }
1283
+ if (t || s || r) {
1284
+ let a = "ClonedMaterial:" + i.uuid + ":";
1285
+ t && (a += "derivative-tangents:"), s && (a += "vertex-colors:"), r && (a += "flat-shading:");
1286
+ let o = this.cache.get(a);
1287
+ o || (o = i.clone(), s && (o.vertexColors = !0), r && (o.flatShading = !0), t && (o.normalScale && (o.normalScale.y *= -1), o.clearcoatNormalScale && (o.clearcoatNormalScale.y *= -1)), this.cache.add(a, o), this.associations.set(o, this.associations.get(i))), i = o;
1288
+ }
1289
+ n.material = i;
1290
+ }
1291
+ getMaterialType() {
1292
+ return Ce;
1293
+ }
1294
+ /**
1295
+ * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials
1296
+ *
1297
+ * @private
1298
+ * @param {number} materialIndex
1299
+ * @return {Promise<Material>}
1300
+ */
1301
+ loadMaterial(n) {
1302
+ const e = this, i = this.json, t = this.extensions, s = i.materials[n];
1303
+ let r;
1304
+ const a = {}, o = s.extensions || {}, c = [];
1305
+ if (o[E.KHR_MATERIALS_UNLIT]) {
1306
+ const l = t[E.KHR_MATERIALS_UNLIT];
1307
+ r = l.getMaterialType(), c.push(l.extendParams(a, s, e));
1308
+ } else {
1309
+ const l = s.pbrMetallicRoughness || {};
1310
+ if (a.color = new D(1, 1, 1), a.opacity = 1, Array.isArray(l.baseColorFactor)) {
1311
+ const f = l.baseColorFactor;
1312
+ a.color.setRGB(f[0], f[1], f[2], k), a.opacity = f[3];
1313
+ }
1314
+ l.baseColorTexture !== void 0 && c.push(e.assignTexture(a, "map", l.baseColorTexture, q)), a.metalness = l.metallicFactor !== void 0 ? l.metallicFactor : 1, a.roughness = l.roughnessFactor !== void 0 ? l.roughnessFactor : 1, l.metallicRoughnessTexture !== void 0 && (c.push(e.assignTexture(a, "metalnessMap", l.metallicRoughnessTexture)), c.push(e.assignTexture(a, "roughnessMap", l.metallicRoughnessTexture))), r = this._invokeOne(function(f) {
1315
+ return f.getMaterialType && f.getMaterialType(n);
1316
+ }), c.push(Promise.all(this._invokeAll(function(f) {
1317
+ return f.extendMaterialParams && f.extendMaterialParams(n, a);
1318
+ })));
1319
+ }
1320
+ s.doubleSided === !0 && (a.side = hn);
1321
+ const u = s.alphaMode || re.OPAQUE;
1322
+ if (u === re.BLEND ? (a.transparent = !0, a.depthWrite = !1) : (a.transparent = !1, u === re.MASK && (a.alphaTest = s.alphaCutoff !== void 0 ? s.alphaCutoff : 0.5)), s.normalTexture !== void 0 && r !== X && (c.push(e.assignTexture(a, "normalMap", s.normalTexture)), a.normalScale = new ye(1, 1), s.normalTexture.scale !== void 0)) {
1323
+ const l = s.normalTexture.scale;
1324
+ a.normalScale.set(l, l);
1325
+ }
1326
+ if (s.occlusionTexture !== void 0 && r !== X && (c.push(e.assignTexture(a, "aoMap", s.occlusionTexture)), s.occlusionTexture.strength !== void 0 && (a.aoMapIntensity = s.occlusionTexture.strength)), s.emissiveFactor !== void 0 && r !== X) {
1327
+ const l = s.emissiveFactor;
1328
+ a.emissive = new D().setRGB(l[0], l[1], l[2], k);
1329
+ }
1330
+ return s.emissiveTexture !== void 0 && r !== X && c.push(e.assignTexture(a, "emissiveMap", s.emissiveTexture, q)), Promise.all(c).then(function() {
1331
+ const l = new r(a);
1332
+ return s.name && (l.name = s.name), v(l, s), e.associations.set(l, { materials: n }), s.extensions && P(t, l, s), l;
1333
+ });
1334
+ }
1335
+ /**
1336
+ * When Object3D instances are targeted by animation, they need unique names.
1337
+ *
1338
+ * @private
1339
+ * @param {string} originalName
1340
+ * @return {string}
1341
+ */
1342
+ createUniqueName(n) {
1343
+ const e = pn.sanitizeNodeName(n || "");
1344
+ return e in this.nodeNamesUsed ? e + "_" + ++this.nodeNamesUsed[e] : (this.nodeNamesUsed[e] = 0, e);
1345
+ }
1346
+ /**
1347
+ * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#geometry
1348
+ *
1349
+ * Creates BufferGeometries from primitives.
1350
+ *
1351
+ * @private
1352
+ * @param {Array<GLTF.Primitive>} primitives
1353
+ * @return {Promise<Array<BufferGeometry>>}
1354
+ */
1355
+ loadGeometries(n) {
1356
+ const e = this, i = this.extensions, t = this.primitiveCache;
1357
+ function s(a) {
1358
+ return i[E.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a, e).then(function(o) {
1359
+ return _e(o, a, e);
1360
+ });
1361
+ }
1362
+ const r = [];
1363
+ for (let a = 0, o = n.length; a < o; a++) {
1364
+ const c = n[a], u = ht(c), l = t[u];
1365
+ if (l)
1366
+ r.push(l.promise);
1367
+ else {
1368
+ let f;
1369
+ c.extensions && c.extensions[E.KHR_DRACO_MESH_COMPRESSION] ? f = s(c) : f = _e(new mn(), c, e), t[u] = { primitive: c, promise: f }, r.push(f);
1370
+ }
1371
+ }
1372
+ return Promise.all(r);
1373
+ }
1374
+ /**
1375
+ * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#meshes
1376
+ *
1377
+ * @private
1378
+ * @param {number} meshIndex
1379
+ * @return {Promise<Group|Mesh|SkinnedMesh|Line|Points>}
1380
+ */
1381
+ loadMesh(n) {
1382
+ const e = this, i = this.json, t = this.extensions, s = i.meshes[n], r = s.primitives, a = [];
1383
+ for (let o = 0, c = r.length; o < c; o++) {
1384
+ const u = r[o].material === void 0 ? ut(this.cache) : this.getDependency("material", r[o].material);
1385
+ a.push(u);
1386
+ }
1387
+ return a.push(e.loadGeometries(r)), Promise.all(a).then(function(o) {
1388
+ const c = o.slice(0, o.length - 1), u = o[o.length - 1], l = [];
1389
+ for (let h = 0, p = u.length; h < p; h++) {
1390
+ const R = u[h], m = r[h];
1391
+ let T;
1392
+ const A = c[h];
1393
+ if (m.mode === I.TRIANGLES || m.mode === I.TRIANGLE_STRIP || m.mode === I.TRIANGLE_FAN || m.mode === void 0)
1394
+ T = s.isSkinnedMesh === !0 ? new gn(R, A) : new Oe(R, A), T.isSkinnedMesh === !0 && T.normalizeSkinWeights(), m.mode === I.TRIANGLE_STRIP ? T.geometry = Re(T.geometry, Me) : m.mode === I.TRIANGLE_FAN && (T.geometry = Re(T.geometry, oe));
1395
+ else if (m.mode === I.LINES)
1396
+ T = new Tn(R, A);
1397
+ else if (m.mode === I.LINE_STRIP)
1398
+ T = new xn(R, A);
1399
+ else if (m.mode === I.LINE_LOOP)
1400
+ T = new Rn(R, A);
1401
+ else if (m.mode === I.POINTS)
1402
+ T = new En(R, A);
1403
+ else
1404
+ throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + m.mode);
1405
+ Object.keys(T.geometry.morphAttributes).length > 0 && ft(T, s), T.name = e.createUniqueName(s.name || "mesh_" + n), v(T, s), m.extensions && P(t, T, m), e.assignFinalMaterial(T), l.push(T);
1406
+ }
1407
+ for (let h = 0, p = l.length; h < p; h++)
1408
+ e.associations.set(l[h], {
1409
+ meshes: n,
1410
+ primitives: h
1411
+ });
1412
+ if (l.length === 1)
1413
+ return s.extensions && P(t, l[0], s), l[0];
1414
+ const f = new te();
1415
+ s.extensions && P(t, f, s), e.associations.set(f, { meshes: n });
1416
+ for (let h = 0, p = l.length; h < p; h++)
1417
+ f.add(l[h]);
1418
+ return f;
1419
+ });
1420
+ }
1421
+ /**
1422
+ * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#cameras
1423
+ *
1424
+ * @private
1425
+ * @param {number} cameraIndex
1426
+ * @return {Promise<THREE.Camera>}
1427
+ */
1428
+ loadCamera(n) {
1429
+ let e;
1430
+ const i = this.json.cameras[n], t = i[i.type];
1431
+ if (!t) {
1432
+ console.warn("THREE.GLTFLoader: Missing camera parameters.");
1433
+ return;
1434
+ }
1435
+ return i.type === "perspective" ? e = new An(Ln.radToDeg(t.yfov), t.aspectRatio || 1, t.znear || 1, t.zfar || 2e6) : i.type === "orthographic" && (e = new _n(-t.xmag, t.xmag, t.ymag, -t.ymag, t.znear, t.zfar)), i.name && (e.name = this.createUniqueName(i.name)), v(e, i), Promise.resolve(e);
1436
+ }
1437
+ /**
1438
+ * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins
1439
+ *
1440
+ * @private
1441
+ * @param {number} skinIndex
1442
+ * @return {Promise<Skeleton>}
1443
+ */
1444
+ loadSkin(n) {
1445
+ const e = this.json.skins[n], i = [];
1446
+ for (let t = 0, s = e.joints.length; t < s; t++)
1447
+ i.push(this._loadNodeShallow(e.joints[t]));
1448
+ return e.inverseBindMatrices !== void 0 ? i.push(this.getDependency("accessor", e.inverseBindMatrices)) : i.push(null), Promise.all(i).then(function(t) {
1449
+ const s = t.pop(), r = t, a = [], o = [];
1450
+ for (let c = 0, u = r.length; c < u; c++) {
1451
+ const l = r[c];
1452
+ if (l) {
1453
+ a.push(l);
1454
+ const f = new $();
1455
+ s !== null && f.fromArray(s.array, c * 16), o.push(f);
1456
+ } else
1457
+ console.warn('THREE.GLTFLoader: Joint "%s" could not be found.', e.joints[c]);
1458
+ }
1459
+ return new Mn(a, o);
1460
+ });
1461
+ }
1462
+ /**
1463
+ * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#animations
1464
+ *
1465
+ * @private
1466
+ * @param {number} animationIndex
1467
+ * @return {Promise<AnimationClip>}
1468
+ */
1469
+ loadAnimation(n) {
1470
+ const e = this.json, i = this, t = e.animations[n], s = t.name ? t.name : "animation_" + n, r = [], a = [], o = [], c = [], u = [];
1471
+ for (let l = 0, f = t.channels.length; l < f; l++) {
1472
+ const h = t.channels[l], p = t.samplers[h.sampler], R = h.target, m = R.node, T = t.parameters !== void 0 ? t.parameters[p.input] : p.input, A = t.parameters !== void 0 ? t.parameters[p.output] : p.output;
1473
+ R.node !== void 0 && (r.push(this.getDependency("node", m)), a.push(this.getDependency("accessor", T)), o.push(this.getDependency("accessor", A)), c.push(p), u.push(R));
1474
+ }
1475
+ return Promise.all([
1476
+ Promise.all(r),
1477
+ Promise.all(a),
1478
+ Promise.all(o),
1479
+ Promise.all(c),
1480
+ Promise.all(u)
1481
+ ]).then(function(l) {
1482
+ const f = l[0], h = l[1], p = l[2], R = l[3], m = l[4], T = [];
1483
+ for (let A = 0, w = f.length; A < w; A++) {
1484
+ const x = f[A], L = h[A], N = p[A], y = R[A], O = m[A];
1485
+ if (x === void 0) continue;
1486
+ x.updateMatrix && x.updateMatrix();
1487
+ const _ = i._createAnimationTracks(x, L, N, y, O);
1488
+ if (_)
1489
+ for (let g = 0; g < _.length; g++)
1490
+ T.push(_[g]);
1491
+ }
1492
+ return new wn(s, void 0, T);
1493
+ });
1494
+ }
1495
+ createNodeMesh(n) {
1496
+ const e = this.json, i = this, t = e.nodes[n];
1497
+ return t.mesh === void 0 ? null : i.getDependency("mesh", t.mesh).then(function(s) {
1498
+ const r = i._getNodeRef(i.meshCache, t.mesh, s);
1499
+ return t.weights !== void 0 && r.traverse(function(a) {
1500
+ if (a.isMesh)
1501
+ for (let o = 0, c = t.weights.length; o < c; o++)
1502
+ a.morphTargetInfluences[o] = t.weights[o];
1503
+ }), r;
1504
+ });
1505
+ }
1506
+ /**
1507
+ * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#nodes-and-hierarchy
1508
+ *
1509
+ * @private
1510
+ * @param {number} nodeIndex
1511
+ * @return {Promise<Object3D>}
1512
+ */
1513
+ loadNode(n) {
1514
+ const e = this.json, i = this, t = e.nodes[n], s = i._loadNodeShallow(n), r = [], a = t.children || [];
1515
+ for (let c = 0, u = a.length; c < u; c++)
1516
+ r.push(i.getDependency("node", a[c]));
1517
+ const o = t.skin === void 0 ? Promise.resolve(null) : i.getDependency("skin", t.skin);
1518
+ return Promise.all([
1519
+ s,
1520
+ Promise.all(r),
1521
+ o
1522
+ ]).then(function(c) {
1523
+ const u = c[0], l = c[1], f = c[2];
1524
+ f !== null && u.traverse(function(h) {
1525
+ h.isSkinnedMesh && h.bind(f, mt);
1526
+ });
1527
+ for (let h = 0, p = l.length; h < p; h++)
1528
+ u.add(l[h]);
1529
+ return u;
1530
+ });
1531
+ }
1532
+ // ._loadNodeShallow() parses a single node.
1533
+ // skin and child nodes are created and added in .loadNode() (no '_' prefix).
1534
+ _loadNodeShallow(n) {
1535
+ const e = this.json, i = this.extensions, t = this;
1536
+ if (this.nodeCache[n] !== void 0)
1537
+ return this.nodeCache[n];
1538
+ const s = e.nodes[n], r = s.name ? t.createUniqueName(s.name) : "", a = [], o = t._invokeOne(function(c) {
1539
+ return c.createNodeMesh && c.createNodeMesh(n);
1540
+ });
1541
+ return o && a.push(o), s.camera !== void 0 && a.push(t.getDependency("camera", s.camera).then(function(c) {
1542
+ return t._getNodeRef(t.cameraCache, s.camera, c);
1543
+ })), t._invokeAll(function(c) {
1544
+ return c.createNodeAttachment && c.createNodeAttachment(n);
1545
+ }).forEach(function(c) {
1546
+ a.push(c);
1547
+ }), this.nodeCache[n] = Promise.all(a).then(function(c) {
1548
+ let u;
1549
+ if (s.isBone === !0 ? u = new yn() : c.length > 1 ? u = new te() : c.length === 1 ? u = c[0] : u = new Se(), u !== c[0])
1550
+ for (let l = 0, f = c.length; l < f; l++)
1551
+ u.add(c[l]);
1552
+ if (s.name && (u.userData.name = s.name, u.name = r), v(u, s), s.extensions && P(i, u, s), s.matrix !== void 0) {
1553
+ const l = new $();
1554
+ l.fromArray(s.matrix), u.applyMatrix4(l);
1555
+ } else
1556
+ s.translation !== void 0 && u.position.fromArray(s.translation), s.rotation !== void 0 && u.quaternion.fromArray(s.rotation), s.scale !== void 0 && u.scale.fromArray(s.scale);
1557
+ if (!t.associations.has(u))
1558
+ t.associations.set(u, {});
1559
+ else if (s.mesh !== void 0 && t.meshCache.refs[s.mesh] > 1) {
1560
+ const l = t.associations.get(u);
1561
+ t.associations.set(u, { ...l });
1562
+ }
1563
+ return t.associations.get(u).nodes = n, u;
1564
+ }), this.nodeCache[n];
1565
+ }
1566
+ /**
1567
+ * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#scenes
1568
+ *
1569
+ * @private
1570
+ * @param {number} sceneIndex
1571
+ * @return {Promise<Group>}
1572
+ */
1573
+ loadScene(n) {
1574
+ const e = this.extensions, i = this.json.scenes[n], t = this, s = new te();
1575
+ i.name && (s.name = t.createUniqueName(i.name)), v(s, i), i.extensions && P(e, s, i);
1576
+ const r = i.nodes || [], a = [];
1577
+ for (let o = 0, c = r.length; o < c; o++)
1578
+ a.push(t.getDependency("node", r[o]));
1579
+ return Promise.all(a).then(function(o) {
1580
+ for (let u = 0, l = o.length; u < l; u++)
1581
+ s.add(o[u]);
1582
+ const c = (u) => {
1583
+ const l = /* @__PURE__ */ new Map();
1584
+ for (const [f, h] of t.associations)
1585
+ (f instanceof ne || f instanceof he) && l.set(f, h);
1586
+ return u.traverse((f) => {
1587
+ const h = t.associations.get(f);
1588
+ h != null && l.set(f, h);
1589
+ }), l;
1590
+ };
1591
+ return t.associations = c(s), s;
1592
+ });
1593
+ }
1594
+ _createAnimationTracks(n, e, i, t, s) {
1595
+ const r = [], a = n.name ? n.name : n.uuid, o = [];
1596
+ F[s.path] === F.weights ? n.traverse(function(f) {
1597
+ f.morphTargetInfluences && o.push(f.name ? f.name : f.uuid);
1598
+ }) : o.push(a);
1599
+ let c;
1600
+ switch (F[s.path]) {
1601
+ case F.weights:
1602
+ c = me;
1603
+ break;
1604
+ case F.rotation:
1605
+ c = ge;
1606
+ break;
1607
+ case F.translation:
1608
+ case F.scale:
1609
+ c = pe;
1610
+ break;
1611
+ default:
1612
+ switch (i.itemSize) {
1613
+ case 1:
1614
+ c = me;
1615
+ break;
1616
+ case 2:
1617
+ case 3:
1618
+ default:
1619
+ c = pe;
1620
+ break;
1621
+ }
1622
+ break;
1623
+ }
1624
+ const u = t.interpolation !== void 0 ? lt[t.interpolation] : ve, l = this._getArrayFromAccessor(i);
1625
+ for (let f = 0, h = o.length; f < h; f++) {
1626
+ const p = new c(
1627
+ o[f] + "." + F[s.path],
1628
+ e.array,
1629
+ l,
1630
+ u
1631
+ );
1632
+ t.interpolation === "CUBICSPLINE" && this._createCubicSplineTrackInterpolant(p), r.push(p);
1633
+ }
1634
+ return r;
1635
+ }
1636
+ _getArrayFromAccessor(n) {
1637
+ let e = n.array;
1638
+ if (n.normalized) {
1639
+ const i = ue(e.constructor), t = new Float32Array(e.length);
1640
+ for (let s = 0, r = e.length; s < r; s++)
1641
+ t[s] = e[s] * i;
1642
+ e = t;
1643
+ }
1644
+ return e;
1645
+ }
1646
+ _createCubicSplineTrackInterpolant(n) {
1647
+ n.createInterpolant = function(i) {
1648
+ const t = this instanceof ge ? ct : Pe;
1649
+ return new t(this.times, this.values, this.getValueSize() / 3, i);
1650
+ }, n.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0;
1651
+ }
1652
+ }
1653
+ function Tt(d, n, e) {
1654
+ const i = n.attributes, t = new ke();
1655
+ if (i.POSITION !== void 0) {
1656
+ const a = e.json.accessors[i.POSITION], o = a.min, c = a.max;
1657
+ if (o !== void 0 && c !== void 0) {
1658
+ if (t.set(
1659
+ new U(o[0], o[1], o[2]),
1660
+ new U(c[0], c[1], c[2])
1661
+ ), a.normalized) {
1662
+ const u = ue(j[a.componentType]);
1663
+ t.min.multiplyScalar(u), t.max.multiplyScalar(u);
1664
+ }
1665
+ } else {
1666
+ console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
1667
+ return;
1668
+ }
1669
+ } else
1670
+ return;
1671
+ const s = n.targets;
1672
+ if (s !== void 0) {
1673
+ const a = new U(), o = new U();
1674
+ for (let c = 0, u = s.length; c < u; c++) {
1675
+ const l = s[c];
1676
+ if (l.POSITION !== void 0) {
1677
+ const f = e.json.accessors[l.POSITION], h = f.min, p = f.max;
1678
+ if (h !== void 0 && p !== void 0) {
1679
+ 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) {
1680
+ const R = ue(j[f.componentType]);
1681
+ o.multiplyScalar(R);
1682
+ }
1683
+ a.max(o);
1684
+ } else
1685
+ console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
1686
+ }
1687
+ }
1688
+ t.expandByVector(a);
1689
+ }
1690
+ d.boundingBox = t;
1691
+ const r = new Cn();
1692
+ t.getCenter(r.center), r.radius = t.min.distanceTo(t.max) / 2, d.boundingSphere = r;
1693
+ }
1694
+ function _e(d, n, e) {
1695
+ const i = n.attributes, t = [];
1696
+ function s(r, a) {
1697
+ return e.getDependency("accessor", r).then(function(o) {
1698
+ d.setAttribute(a, o);
1699
+ });
1700
+ }
1701
+ for (const r in i) {
1702
+ const a = le[r] || r.toLowerCase();
1703
+ a in d.attributes || t.push(s(i[r], a));
1704
+ }
1705
+ if (n.indices !== void 0 && !d.index) {
1706
+ const r = e.getDependency("accessor", n.indices).then(function(a) {
1707
+ d.setIndex(a);
1708
+ });
1709
+ t.push(r);
1710
+ }
1711
+ return Te.workingColorSpace !== k && "COLOR_0" in i && console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${Te.workingColorSpace}" not supported.`), v(d, n), Tt(d, n, e), Promise.all(t).then(function() {
1712
+ return n.targets !== void 0 ? dt(d, n.targets, e) : d;
1713
+ });
1714
+ }
1715
+ function xt() {
1716
+ const d = G(!1), n = G(""), e = He([]), i = G(null), t = new On(), s = new vn(), r = new kn(), a = new Dn();
1717
+ return {
1718
+ isLoading: d,
1719
+ loadingProgress: n,
1720
+ loadedModels: e,
1721
+ error: i,
1722
+ loadModelsFromBlobs: async (c) => {
1723
+ var h;
1724
+ if (!c || c.length === 0) {
1725
+ console.warn("loadModelsFromBlobs 加载的文件数组为空!");
1726
+ return;
1727
+ }
1728
+ d.value = !0, n.value = "准备加载...", e.value = [], i.value = null;
1729
+ const u = /* @__PURE__ */ new Map();
1730
+ c.forEach((p) => {
1731
+ p instanceof File && u.set(p.name.toLowerCase(), p);
1732
+ });
1733
+ const l = [], f = [];
1734
+ try {
1735
+ for (const p of c) {
1736
+ const R = p.name || "unknown_file", m = (h = R.split(".").pop()) == null ? void 0 : h.toLowerCase();
1737
+ if (m === "mtl") continue;
1738
+ const T = URL.createObjectURL(p);
1739
+ l.push(T);
1740
+ let A = null;
1741
+ const w = (x) => {
1742
+ const L = x.lengthComputable ? x.loaded / x.total * 100 : 0;
1743
+ n.value = `正在加载 ${R}... ${Math.round(L)}%`;
1744
+ };
1745
+ switch (n.value = `正在加载 ${R}... 0%`, m) {
1746
+ case "obj":
1747
+ const x = R.replace(/\.obj$/i, ".mtl").toLowerCase();
1748
+ if (u.has(x)) {
1749
+ const O = u.get(x), _ = URL.createObjectURL(O);
1750
+ l.push(_);
1751
+ const g = await t.loadAsync(_);
1752
+ g.preload(), s.setMaterials(g);
1753
+ } else
1754
+ s.setMaterials(null);
1755
+ A = await s.loadAsync(T, w);
1756
+ break;
1757
+ case "stl":
1758
+ const L = await r.loadAsync(T, w), N = new Fn({ color: 11184810, specular: 1118481, shininess: 200 });
1759
+ A = new Oe(L, N);
1760
+ break;
1761
+ case "gltf":
1762
+ case "glb":
1763
+ A = (await a.loadAsync(T, w)).scene;
1764
+ break;
1765
+ default:
1766
+ console.warn(`不支持的文件类型: .${m}`), n.value = `不支持的文件类型: ${R}`;
1767
+ continue;
1768
+ }
1769
+ A && (A.userData.boundingBox = new ke().setFromObject(A), f.push(A));
1770
+ }
1771
+ e.value = f, n.value = "加载完成!";
1772
+ } catch (p) {
1773
+ throw console.error("加载模型时出错:", p), i.value = `加载失败: ${p.message || "未知错误"}`, n.value = "加载失败!", e.value = [], p;
1774
+ } finally {
1775
+ d.value = !1, l.forEach((p) => URL.revokeObjectURL(p));
1776
+ }
1777
+ }
1778
+ };
1779
+ }
1780
+ const Rt = { class: "obj-viewer-container" }, Et = { class: "buttonGroup-topLeft" }, At = { class: "buttonGroup-left" }, Lt = { class: "left-panel" }, _t = { class: "panel-header" }, Mt = {
1781
+ key: 0,
1782
+ class: "clipping-content"
1783
+ }, wt = { class: "radio-group" }, yt = { class: "radio-label" }, bt = { class: "radio-label" }, St = { class: "radio-label" }, Nt = { class: "radio-label" }, It = {
1784
+ key: 0,
1785
+ class: "loading-overlay"
1786
+ }, Ct = /* @__PURE__ */ Ue({
1787
+ __name: "threePreview",
1788
+ props: {
1789
+ fileBlobs: { default: () => [] }
1790
+ },
1791
+ setup(d) {
1792
+ const n = d, e = G(null), i = G(!1), t = G(""), {
1793
+ currentModels: s,
1794
+ resetView: r,
1795
+ initThreeJS: a,
1796
+ handleResize: o,
1797
+ getThreeJSObjects: c,
1798
+ cleanup: u,
1799
+ setModels: l
1800
+ } = ze(e), {
1801
+ isLoading: f,
1802
+ loadingProgress: h,
1803
+ loadedModels: p,
1804
+ error: R,
1805
+ loadModelsFromBlobs: m
1806
+ } = xt(), { isAnimating: T, toggleAnimation: A, stopAnimation: w } = qe(c, s), { isClipping: x, activeClippingAxis: L, toggleClipping: N, updateClippingPlanes: y } = We(
1807
+ c,
1808
+ s
1809
+ );
1810
+ J(() => n.fileBlobs, (_) => {
1811
+ _ && _.length > 0 && m(_).catch((g) => {
1812
+ console.error("加载错误:", g);
1813
+ });
1814
+ }, {
1815
+ immediate: !0,
1816
+ deep: !0
1817
+ }), J(p, (_) => {
1818
+ _ && _.length > 0 && l(_);
1819
+ }), J(R, (_) => {
1820
+ _ && xe.error(`模型加载失败: ${_}`);
1821
+ });
1822
+ const O = (_) => {
1823
+ i.value = !0, t.value = _, x.value || N();
1824
+ };
1825
+ return Ge(async () => {
1826
+ await je();
1827
+ try {
1828
+ a(), window.addEventListener("resize", o);
1829
+ } catch (_) {
1830
+ console.error("Three.js 初始化失败:", _), xe.error("渲染引擎初始化失败!");
1831
+ }
1832
+ }), Be(() => {
1833
+ t.value = "", window.removeEventListener("resize", o), T.value && w(), u();
1834
+ }), (_, g) => {
1835
+ const De = Ke("el-scrollbar");
1836
+ return Z(), Q("div", Rt, [
1837
+ M("div", {
1838
+ ref_key: "threejsContainer",
1839
+ ref: e,
1840
+ class: "threejs-container"
1841
+ }, null, 512),
1842
+ g[15] || (g[15] = M("div", { class: "buttonGroup-top" }, null, -1)),
1843
+ M("div", Et, [
1844
+ H(K, {
1845
+ name: "viewReset",
1846
+ size: "24",
1847
+ onClick: S(r),
1848
+ title: "重置"
1849
+ }, null, 8, ["onClick"]),
1850
+ H(K, {
1851
+ name: "fangda",
1852
+ size: "24",
1853
+ title: "放大"
1854
+ }),
1855
+ H(K, {
1856
+ name: "suoxiao",
1857
+ size: "24",
1858
+ title: "缩小"
1859
+ }),
1860
+ H(K, {
1861
+ name: "lookAround",
1862
+ size: "24",
1863
+ onClick: S(A),
1864
+ title: S(T) ? "停止动画" : "动画视图"
1865
+ }, null, 8, ["onClick", "title"])
1866
+ ]),
1867
+ M("div", At, [
1868
+ H(K, {
1869
+ name: "clipping",
1870
+ size: "24",
1871
+ onClick: g[0] || (g[0] = (b) => O("剖面视图")),
1872
+ active: i.value && t.value === "剖面视图",
1873
+ title: "剖面视图"
1874
+ }, null, 8, ["active"])
1875
+ ]),
1876
+ g[16] || (g[16] = M("div", { class: "buttonGroup-right" }, null, -1)),
1877
+ g[17] || (g[17] = M("div", { class: "buttonGroup-bottom" }, null, -1)),
1878
+ B(M("div", Lt, [
1879
+ M("div", _t, [
1880
+ M("span", null, fe(t.value), 1),
1881
+ M("span", {
1882
+ class: "close",
1883
+ onClick: g[1] || (g[1] = (b) => i.value = !1)
1884
+ }, " X ")
1885
+ ]),
1886
+ H(De, { "max-height": "650px" }, {
1887
+ default: Ve(() => [
1888
+ t.value === "剖面视图" ? (Z(), Q("div", Mt, [
1889
+ M("div", wt, [
1890
+ M("label", yt, [
1891
+ B(M("input", {
1892
+ type: "radio",
1893
+ name: "clipping-axis",
1894
+ value: "none",
1895
+ "onUpdate:modelValue": g[2] || (g[2] = (b) => W(L) ? L.value = b : null),
1896
+ onChange: g[3] || (g[3] = //@ts-ignore
1897
+ (...b) => S(y) && S(y)(...b))
1898
+ }, null, 544), [
1899
+ [Y, S(L)]
1900
+ ]),
1901
+ g[10] || (g[10] = M("span", { class: "radio-text" }, "无切割", -1))
1902
+ ]),
1903
+ M("label", bt, [
1904
+ B(M("input", {
1905
+ type: "radio",
1906
+ name: "clipping-axis",
1907
+ value: "x",
1908
+ "onUpdate:modelValue": g[4] || (g[4] = (b) => W(L) ? L.value = b : null),
1909
+ onChange: g[5] || (g[5] = //@ts-ignore
1910
+ (...b) => S(y) && S(y)(...b))
1911
+ }, null, 544), [
1912
+ [Y, S(L)]
1913
+ ]),
1914
+ g[11] || (g[11] = M("span", { class: "radio-text" }, "X轴切割", -1))
1915
+ ]),
1916
+ M("label", St, [
1917
+ B(M("input", {
1918
+ type: "radio",
1919
+ name: "clipping-axis",
1920
+ value: "y",
1921
+ "onUpdate:modelValue": g[6] || (g[6] = (b) => W(L) ? L.value = b : null),
1922
+ onChange: g[7] || (g[7] = //@ts-ignore
1923
+ (...b) => S(y) && S(y)(...b))
1924
+ }, null, 544), [
1925
+ [Y, S(L)]
1926
+ ]),
1927
+ g[12] || (g[12] = M("span", { class: "radio-text" }, "Y轴切割", -1))
1928
+ ]),
1929
+ M("label", Nt, [
1930
+ B(M("input", {
1931
+ type: "radio",
1932
+ name: "clipping-axis",
1933
+ value: "z",
1934
+ "onUpdate:modelValue": g[8] || (g[8] = (b) => W(L) ? L.value = b : null),
1935
+ onChange: g[9] || (g[9] = //@ts-ignore
1936
+ (...b) => S(y) && S(y)(...b))
1937
+ }, null, 544), [
1938
+ [Y, S(L)]
1939
+ ]),
1940
+ g[13] || (g[13] = M("span", { class: "radio-text" }, "Z轴切割", -1))
1941
+ ])
1942
+ ])
1943
+ ])) : de("", !0)
1944
+ ]),
1945
+ _: 1
1946
+ })
1947
+ ], 512), [
1948
+ [Xe, i.value]
1949
+ ]),
1950
+ S(f) ? (Z(), Q("div", It, [
1951
+ g[14] || (g[14] = M("div", { class: "loading-spinner" }, null, -1)),
1952
+ M("p", null, fe(S(h)), 1)
1953
+ ])) : de("", !0)
1954
+ ]);
1955
+ };
1956
+ }
1957
+ }), Dt = /* @__PURE__ */ Pn(Ct, [["__scopeId", "data-v-bd3231bf"]]);
1958
+ export {
1959
+ Dt as default
1960
+ };