ss-component-new 1.2.12 → 1.2.13

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