@vincentt-xr/sdk 2.0.0-alpha.7 → 2.0.0-alpha.8

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