@shopware-ag/dive 1.19.1-beta.2 → 1.19.1-beta.4

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