three-stdlib 2.22.4 → 2.22.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (1091) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +0 -2
  3. package/package.json +34 -14
  4. package/BufferGeometryUtils-903f7ecb.js +0 -1
  5. package/BufferGeometryUtils-f2288d1c.js +0 -740
  6. package/Nodes-2106b101.js +0 -352
  7. package/Nodes-8947ba9a.js +0 -1
  8. package/_polyfill/CompressedArrayTexture.cjs.js +0 -1
  9. package/_polyfill/CompressedArrayTexture.js +0 -13
  10. package/_polyfill/Data3DTexture.cjs.js +0 -1
  11. package/_polyfill/Data3DTexture.js +0 -23
  12. package/animation/AnimationClipCreator.cjs.js +0 -1
  13. package/animation/AnimationClipCreator.d.ts +0 -12
  14. package/animation/AnimationClipCreator.js +0 -77
  15. package/animation/CCDIKSolver.cjs.js +0 -1
  16. package/animation/CCDIKSolver.d.ts +0 -25
  17. package/animation/CCDIKSolver.js +0 -304
  18. package/animation/MMDAnimationHelper.cjs.js +0 -1
  19. package/animation/MMDAnimationHelper.d.ts +0 -103
  20. package/animation/MMDAnimationHelper.js +0 -705
  21. package/animation/MMDPhysics.cjs.js +0 -1
  22. package/animation/MMDPhysics.d.ts +0 -119
  23. package/animation/MMDPhysics.js +0 -976
  24. package/cameras/CinematicCamera.cjs.js +0 -1
  25. package/cameras/CinematicCamera.d.ts +0 -41
  26. package/cameras/CinematicCamera.js +0 -139
  27. package/controls/ArcballControls.cjs.js +0 -1
  28. package/controls/ArcballControls.d.ts +0 -161
  29. package/controls/ArcballControls.js +0 -2642
  30. package/controls/DeviceOrientationControls.cjs.js +0 -1
  31. package/controls/DeviceOrientationControls.d.ts +0 -24
  32. package/controls/DeviceOrientationControls.js +0 -119
  33. package/controls/DragControls.cjs.js +0 -1
  34. package/controls/DragControls.d.ts +0 -34
  35. package/controls/DragControls.js +0 -274
  36. package/controls/FirstPersonControls.cjs.js +0 -1
  37. package/controls/FirstPersonControls.d.ts +0 -48
  38. package/controls/FirstPersonControls.js +0 -290
  39. package/controls/FlyControls.cjs.js +0 -1
  40. package/controls/FlyControls.d.ts +0 -32
  41. package/controls/FlyControls.js +0 -309
  42. package/controls/OrbitControls.cjs.js +0 -1
  43. package/controls/OrbitControls.d.ts +0 -63
  44. package/controls/OrbitControls.js +0 -980
  45. package/controls/PointerLockControls.cjs.js +0 -1
  46. package/controls/PointerLockControls.d.ts +0 -24
  47. package/controls/PointerLockControls.js +0 -135
  48. package/controls/TrackballControls.cjs.js +0 -1
  49. package/controls/TrackballControls.d.ts +0 -95
  50. package/controls/TrackballControls.js +0 -653
  51. package/controls/TransformControls.cjs.js +0 -1
  52. package/controls/TransformControls.d.ts +0 -151
  53. package/controls/TransformControls.js +0 -1275
  54. package/controls/experimental/CameraControls.cjs.js +0 -1
  55. package/controls/experimental/CameraControls.d.ts +0 -170
  56. package/controls/experimental/CameraControls.js +0 -953
  57. package/csm/CSM.cjs.js +0 -1
  58. package/csm/CSM.d.ts +0 -61
  59. package/csm/CSM.js +0 -305
  60. package/csm/CSMFrustum.cjs.js +0 -1
  61. package/csm/CSMFrustum.d.ts +0 -19
  62. package/csm/CSMFrustum.js +0 -90
  63. package/csm/CSMHelper.cjs.js +0 -1
  64. package/csm/CSMHelper.d.ts +0 -26
  65. package/csm/CSMHelper.js +0 -128
  66. package/csm/CSMShader.cjs.js +0 -1
  67. package/csm/CSMShader.d.ts +0 -4
  68. package/csm/CSMShader.js +0 -255
  69. package/curves/CurveExtras.cjs.js +0 -1
  70. package/curves/CurveExtras.d.ts +0 -68
  71. package/curves/CurveExtras.js +0 -266
  72. package/curves/NURBSCurve.cjs.js +0 -1
  73. package/curves/NURBSCurve.d.ts +0 -11
  74. package/curves/NURBSCurve.js +0 -63
  75. package/curves/NURBSSurface.cjs.js +0 -1
  76. package/curves/NURBSSurface.d.ts +0 -13
  77. package/curves/NURBSSurface.js +0 -44
  78. package/curves/NURBSUtils.cjs.js +0 -1
  79. package/curves/NURBSUtils.d.ts +0 -22
  80. package/curves/NURBSUtils.js +0 -375
  81. package/custom.d.cjs.js +0 -1
  82. package/custom.d.js +0 -1
  83. package/deprecated/Geometry.cjs.js +0 -1
  84. package/deprecated/Geometry.d.ts +0 -342
  85. package/deprecated/Geometry.js +0 -1261
  86. package/effects/AnaglyphEffect.cjs.js +0 -1
  87. package/effects/AnaglyphEffect.d.ts +0 -11
  88. package/effects/AnaglyphEffect.js +0 -85
  89. package/effects/AsciiEffect.cjs.js +0 -1
  90. package/effects/AsciiEffect.d.ts +0 -18
  91. package/effects/AsciiEffect.js +0 -203
  92. package/effects/OutlineEffect.cjs.js +0 -1
  93. package/effects/OutlineEffect.d.ts +0 -28
  94. package/effects/OutlineEffect.js +0 -378
  95. package/effects/ParallaxBarrierEffect.cjs.js +0 -1
  96. package/effects/ParallaxBarrierEffect.d.ts +0 -8
  97. package/effects/ParallaxBarrierEffect.js +0 -63
  98. package/effects/PeppersGhostEffect.cjs.js +0 -1
  99. package/effects/PeppersGhostEffect.d.ts +0 -10
  100. package/effects/PeppersGhostEffect.js +0 -134
  101. package/effects/StereoEffect.cjs.js +0 -1
  102. package/effects/StereoEffect.d.ts +0 -9
  103. package/effects/StereoEffect.js +0 -36
  104. package/environments/RoomEnvironment.cjs.js +0 -1
  105. package/environments/RoomEnvironment.d.ts +0 -5
  106. package/environments/RoomEnvironment.js +0 -92
  107. package/exporters/ColladaExporter.cjs.js +0 -1
  108. package/exporters/ColladaExporter.d.ts +0 -39
  109. package/exporters/ColladaExporter.js +0 -425
  110. package/exporters/DRACOExporter.cjs.js +0 -1
  111. package/exporters/DRACOExporter.d.ts +0 -23
  112. package/exporters/DRACOExporter.js +0 -186
  113. package/exporters/GLTFExporter.cjs.js +0 -1
  114. package/exporters/GLTFExporter.d.ts +0 -270
  115. package/exporters/GLTFExporter.js +0 -1932
  116. package/exporters/MMDExporter.cjs.js +0 -1
  117. package/exporters/MMDExporter.d.ts +0 -8
  118. package/exporters/MMDExporter.js +0 -160
  119. package/exporters/OBJExporter.cjs.js +0 -1
  120. package/exporters/OBJExporter.d.ts +0 -18
  121. package/exporters/OBJExporter.js +0 -228
  122. package/exporters/PLYExporter.cjs.js +0 -1
  123. package/exporters/PLYExporter.d.ts +0 -11
  124. package/exporters/PLYExporter.js +0 -339
  125. package/exporters/STLExporter.cjs.js +0 -1
  126. package/exporters/STLExporter.d.ts +0 -23
  127. package/exporters/STLExporter.js +0 -180
  128. package/exporters/USDZExporter.cjs.js +0 -1
  129. package/exporters/USDZExporter.d.ts +0 -27
  130. package/exporters/USDZExporter.js +0 -388
  131. package/geometries/BoxLineGeometry.cjs.js +0 -1
  132. package/geometries/BoxLineGeometry.d.ts +0 -12
  133. package/geometries/BoxLineGeometry.js +0 -52
  134. package/geometries/ConvexGeometry.cjs.js +0 -1
  135. package/geometries/ConvexGeometry.d.ts +0 -5
  136. package/geometries/ConvexGeometry.js +0 -38
  137. package/geometries/DecalGeometry.cjs.js +0 -1
  138. package/geometries/DecalGeometry.d.ts +0 -10
  139. package/geometries/DecalGeometry.js +0 -238
  140. package/geometries/LightningStrike.cjs.js +0 -1
  141. package/geometries/LightningStrike.d.ts +0 -108
  142. package/geometries/LightningStrike.js +0 -740
  143. package/geometries/ParametricGeometries.cjs.js +0 -1
  144. package/geometries/ParametricGeometries.d.ts +0 -32
  145. package/geometries/ParametricGeometries.js +0 -179
  146. package/geometries/ParametricGeometry.cjs.js +0 -1
  147. package/geometries/ParametricGeometry.d.ts +0 -18
  148. package/geometries/ParametricGeometry.js +0 -87
  149. package/geometries/RoundedBoxGeometry.cjs.js +0 -1
  150. package/geometries/RoundedBoxGeometry.d.ts +0 -5
  151. package/geometries/RoundedBoxGeometry.js +0 -122
  152. package/geometries/TeapotGeometry.cjs.js +0 -1
  153. package/geometries/TeapotGeometry.d.ts +0 -13
  154. package/geometries/TeapotGeometry.js +0 -297
  155. package/geometries/TextGeometry.cjs.js +0 -1
  156. package/geometries/TextGeometry.d.ts +0 -18
  157. package/geometries/TextGeometry.js +0 -37
  158. package/helpers/LightProbeHelper.cjs.js +0 -1
  159. package/helpers/LightProbeHelper.d.ts +0 -10
  160. package/helpers/LightProbeHelper.js +0 -40
  161. package/helpers/PositionalAudioHelper.cjs.js +0 -1
  162. package/helpers/PositionalAudioHelper.d.ts +0 -13
  163. package/helpers/PositionalAudioHelper.js +0 -75
  164. package/helpers/RectAreaLightHelper.cjs.js +0 -1
  165. package/helpers/RectAreaLightHelper.d.ts +0 -10
  166. package/helpers/RectAreaLightHelper.js +0 -60
  167. package/helpers/VertexNormalsHelper.cjs.js +0 -1
  168. package/helpers/VertexNormalsHelper.d.ts +0 -10
  169. package/helpers/VertexNormalsHelper.js +0 -75
  170. package/helpers/VertexTangentsHelper.cjs.js +0 -1
  171. package/helpers/VertexTangentsHelper.d.ts +0 -10
  172. package/helpers/VertexTangentsHelper.js +0 -63
  173. package/index.cjs.js +0 -1
  174. package/index.d.ts +0 -254
  175. package/index.js +0 -337
  176. package/interactive/HTMLMesh.cjs.js +0 -1
  177. package/interactive/HTMLMesh.d.ts +0 -6
  178. package/interactive/HTMLMesh.js +0 -406
  179. package/interactive/InteractiveGroup.cjs.js +0 -1
  180. package/interactive/InteractiveGroup.d.ts +0 -5
  181. package/interactive/InteractiveGroup.js +0 -87
  182. package/interactive/SelectionBox.cjs.js +0 -1
  183. package/interactive/SelectionBox.d.ts +0 -15
  184. package/interactive/SelectionBox.js +0 -152
  185. package/interactive/SelectionHelper.cjs.js +0 -1
  186. package/interactive/SelectionHelper.d.ts +0 -17
  187. package/interactive/SelectionHelper.js +0 -59
  188. package/libs/MeshoptDecoder.cjs.js +0 -1
  189. package/libs/MeshoptDecoder.d.ts +0 -12
  190. package/libs/MeshoptDecoder.js +0 -124
  191. package/libs/MotionControllers.cjs.js +0 -1
  192. package/libs/MotionControllers.d.ts +0 -132
  193. package/libs/MotionControllers.js +0 -455
  194. package/lights/LightProbeGenerator.cjs.js +0 -1
  195. package/lights/LightProbeGenerator.d.ts +0 -6
  196. package/lights/LightProbeGenerator.js +0 -200
  197. package/lights/RectAreaLightUniformsLib.cjs.js +0 -1
  198. package/lights/RectAreaLightUniformsLib.d.ts +0 -3
  199. package/lights/RectAreaLightUniformsLib.js +0 -9
  200. package/lines/Line2.cjs.js +0 -1
  201. package/lines/Line2.d.ts +0 -11
  202. package/lines/Line2.js +0 -16
  203. package/lines/LineGeometry.cjs.js +0 -1
  204. package/lines/LineGeometry.d.ts +0 -10
  205. package/lines/LineGeometry.js +0 -56
  206. package/lines/LineMaterial.cjs.js +0 -1
  207. package/lines/LineMaterial.d.ts +0 -31
  208. package/lines/LineMaterial.js +0 -577
  209. package/lines/LineSegments2.cjs.js +0 -1
  210. package/lines/LineSegments2.d.ts +0 -14
  211. package/lines/LineSegments2.js +0 -311
  212. package/lines/LineSegmentsGeometry.cjs.js +0 -1
  213. package/lines/LineSegmentsGeometry.d.ts +0 -23
  214. package/lines/LineSegmentsGeometry.js +0 -166
  215. package/lines/Wireframe.cjs.js +0 -1
  216. package/lines/Wireframe.d.ts +0 -11
  217. package/lines/Wireframe.js +0 -45
  218. package/lines/WireframeGeometry2.cjs.js +0 -1
  219. package/lines/WireframeGeometry2.d.ts +0 -8
  220. package/lines/WireframeGeometry2.js +0 -14
  221. package/loaders/3DMLoader.cjs.js +0 -1
  222. package/loaders/3DMLoader.d.ts +0 -17
  223. package/loaders/3DMLoader.js +0 -1037
  224. package/loaders/3MFLoader.cjs.js +0 -1
  225. package/loaders/3MFLoader.d.ts +0 -16
  226. package/loaders/3MFLoader.js +0 -1053
  227. package/loaders/AMFLoader.cjs.js +0 -1
  228. package/loaders/AMFLoader.d.ts +0 -14
  229. package/loaders/AMFLoader.js +0 -389
  230. package/loaders/AssimpLoader.cjs.js +0 -1
  231. package/loaders/AssimpLoader.js +0 -1793
  232. package/loaders/BVHLoader.cjs.js +0 -1
  233. package/loaders/BVHLoader.d.ts +0 -21
  234. package/loaders/BVHLoader.js +0 -313
  235. package/loaders/BasisTextureLoader.cjs.js +0 -1
  236. package/loaders/BasisTextureLoader.d.ts +0 -32
  237. package/loaders/BasisTextureLoader.js +0 -602
  238. package/loaders/ColladaLoader.cjs.js +0 -1
  239. package/loaders/ColladaLoader.d.ts +0 -20
  240. package/loaders/ColladaLoader.js +0 -2993
  241. package/loaders/DDSLoader.cjs.js +0 -1
  242. package/loaders/DDSLoader.d.ts +0 -16
  243. package/loaders/DDSLoader.js +0 -214
  244. package/loaders/DRACOLoader.cjs.js +0 -1
  245. package/loaders/DRACOLoader.d.ts +0 -18
  246. package/loaders/DRACOLoader.js +0 -447
  247. package/loaders/EXRLoader.cjs.js +0 -1
  248. package/loaders/EXRLoader.d.ts +0 -18
  249. package/loaders/EXRLoader.js +0 -1699
  250. package/loaders/FBXLoader.cjs.js +0 -1
  251. package/loaders/FBXLoader.d.ts +0 -14
  252. package/loaders/FBXLoader.js +0 -2917
  253. package/loaders/FontLoader.cjs.js +0 -1
  254. package/loaders/FontLoader.d.ts +0 -36
  255. package/loaders/FontLoader.js +0 -144
  256. package/loaders/GCodeLoader.cjs.js +0 -1
  257. package/loaders/GCodeLoader.d.ts +0 -15
  258. package/loaders/GCodeLoader.js +0 -189
  259. package/loaders/GLTFLoader.cjs.js +0 -1
  260. package/loaders/GLTFLoader.d.ts +0 -151
  261. package/loaders/GLTFLoader.js +0 -3136
  262. package/loaders/HDRCubeTextureLoader.cjs.js +0 -1
  263. package/loaders/HDRCubeTextureLoader.d.ts +0 -18
  264. package/loaders/HDRCubeTextureLoader.js +0 -77
  265. package/loaders/KMZLoader.cjs.js +0 -1
  266. package/loaders/KMZLoader.d.ts +0 -16
  267. package/loaders/KMZLoader.js +0 -88
  268. package/loaders/KTX2Loader.cjs.js +0 -1
  269. package/loaders/KTX2Loader.d.ts +0 -16
  270. package/loaders/KTX2Loader.js +0 -596
  271. package/loaders/KTXLoader.cjs.js +0 -1
  272. package/loaders/KTXLoader.d.ts +0 -16
  273. package/loaders/KTXLoader.js +0 -149
  274. package/loaders/LDrawLoader.cjs.js +0 -1
  275. package/loaders/LDrawLoader.d.ts +0 -26
  276. package/loaders/LDrawLoader.js +0 -1842
  277. package/loaders/LUT3dlLoader.cjs.js +0 -1
  278. package/loaders/LUT3dlLoader.d.ts +0 -20
  279. package/loaders/LUT3dlLoader.js +0 -115
  280. package/loaders/LUTCubeLoader.cjs.js +0 -1
  281. package/loaders/LUTCubeLoader.d.ts +0 -23
  282. package/loaders/LUTCubeLoader.js +0 -118
  283. package/loaders/LWOLoader.cjs.js +0 -1
  284. package/loaders/LWOLoader.d.ts +0 -26
  285. package/loaders/LWOLoader.js +0 -737
  286. package/loaders/LottieLoader.cjs.js +0 -1
  287. package/loaders/LottieLoader.d.ts +0 -15
  288. package/loaders/LottieLoader.js +0 -49
  289. package/loaders/MD2Loader.cjs.js +0 -1
  290. package/loaders/MD2Loader.d.ts +0 -14
  291. package/loaders/MD2Loader.js +0 -202
  292. package/loaders/MDDLoader.cjs.js +0 -1
  293. package/loaders/MDDLoader.d.ts +0 -19
  294. package/loaders/MDDLoader.js +0 -78
  295. package/loaders/MMDLoader.cjs.js +0 -1
  296. package/loaders/MMDLoader.d.ts +0 -63
  297. package/loaders/MMDLoader.js +0 -1434
  298. package/loaders/MTLLoader.cjs.js +0 -1
  299. package/loaders/MTLLoader.d.ts +0 -112
  300. package/loaders/MTLLoader.js +0 -390
  301. package/loaders/NRRDLoader.cjs.js +0 -1
  302. package/loaders/NRRDLoader.d.ts +0 -21
  303. package/loaders/NRRDLoader.js +0 -482
  304. package/loaders/NodeMaterialLoader.cjs.js +0 -1
  305. package/loaders/NodeMaterialLoader.js +0 -39
  306. package/loaders/OBJLoader.cjs.js +0 -1
  307. package/loaders/OBJLoader.d.ts +0 -17
  308. package/loaders/OBJLoader.js +0 -609
  309. package/loaders/PCDLoader.cjs.js +0 -1
  310. package/loaders/PCDLoader.d.ts +0 -15
  311. package/loaders/PCDLoader.js +0 -267
  312. package/loaders/PDBLoader.cjs.js +0 -1
  313. package/loaders/PDBLoader.d.ts +0 -22
  314. package/loaders/PDBLoader.js +0 -264
  315. package/loaders/PLYLoader.cjs.js +0 -1
  316. package/loaders/PLYLoader.d.ts +0 -16
  317. package/loaders/PLYLoader.js +0 -414
  318. package/loaders/PRWMLoader.cjs.js +0 -1
  319. package/loaders/PRWMLoader.d.ts +0 -16
  320. package/loaders/PRWMLoader.js +0 -197
  321. package/loaders/PVRLoader.cjs.js +0 -1
  322. package/loaders/PVRLoader.d.ts +0 -16
  323. package/loaders/PVRLoader.js +0 -192
  324. package/loaders/RGBELoader.cjs.js +0 -1
  325. package/loaders/RGBELoader.d.ts +0 -20
  326. package/loaders/RGBELoader.js +0 -382
  327. package/loaders/RGBMLoader.cjs.js +0 -1
  328. package/loaders/RGBMLoader.d.ts +0 -32
  329. package/loaders/RGBMLoader.js +0 -1168
  330. package/loaders/STLLoader.cjs.js +0 -1
  331. package/loaders/STLLoader.d.ts +0 -14
  332. package/loaders/STLLoader.js +0 -296
  333. package/loaders/SVGLoader.cjs.js +0 -1
  334. package/loaders/SVGLoader.d.ts +0 -63
  335. package/loaders/SVGLoader.js +0 -2083
  336. package/loaders/TDSLoader.cjs.js +0 -1
  337. package/loaders/TDSLoader.d.ts +0 -42
  338. package/loaders/TDSLoader.js +0 -870
  339. package/loaders/TGALoader.cjs.js +0 -1
  340. package/loaders/TGALoader.d.ts +0 -14
  341. package/loaders/TGALoader.js +0 -396
  342. package/loaders/TTFLoader.cjs.js +0 -1
  343. package/loaders/TTFLoader.d.ts +0 -15
  344. package/loaders/TTFLoader.js +0 -152
  345. package/loaders/TiltLoader.cjs.js +0 -1
  346. package/loaders/TiltLoader.d.ts +0 -14
  347. package/loaders/TiltLoader.js +0 -411
  348. package/loaders/VOXLoader.cjs.js +0 -1
  349. package/loaders/VOXLoader.d.ts +0 -28
  350. package/loaders/VOXLoader.js +0 -196
  351. package/loaders/VRMLLoader.cjs.js +0 -1
  352. package/loaders/VRMLLoader.d.ts +0 -14
  353. package/loaders/VRMLLoader.js +0 -2575
  354. package/loaders/VRMLoader.cjs.js +0 -1
  355. package/loaders/VRMLoader.js +0 -46
  356. package/loaders/VTKLoader.cjs.js +0 -1
  357. package/loaders/VTKLoader.d.ts +0 -14
  358. package/loaders/VTKLoader.js +0 -834
  359. package/loaders/XLoader.cjs.js +0 -1
  360. package/loaders/XLoader.js +0 -1434
  361. package/loaders/XYZLoader.cjs.js +0 -1
  362. package/loaders/XYZLoader.d.ts +0 -14
  363. package/loaders/XYZLoader.js +0 -66
  364. package/loaders/lwo/IFFParser.cjs.js +0 -1
  365. package/loaders/lwo/IFFParser.js +0 -951
  366. package/loaders/lwo/LWO2Parser.cjs.js +0 -1
  367. package/loaders/lwo/LWO2Parser.js +0 -430
  368. package/loaders/lwo/LWO3Parser.cjs.js +0 -1
  369. package/loaders/lwo/LWO3Parser.js +0 -385
  370. package/math/Capsule.cjs.js +0 -1
  371. package/math/Capsule.d.ts +0 -27
  372. package/math/Capsule.js +0 -87
  373. package/math/ColorConverter.cjs.js +0 -1
  374. package/math/ColorConverter.d.ts +0 -21
  375. package/math/ColorConverter.js +0 -65
  376. package/math/ConvexHull.cjs.js +0 -1
  377. package/math/ConvexHull.d.ts +0 -89
  378. package/math/ConvexHull.js +0 -834
  379. package/math/ImprovedNoise.cjs.js +0 -1
  380. package/math/ImprovedNoise.d.ts +0 -4
  381. package/math/ImprovedNoise.js +0 -52
  382. package/math/Lut.cjs.js +0 -1
  383. package/math/Lut.d.ts +0 -27
  384. package/math/Lut.js +0 -119
  385. package/math/MeshSurfaceSampler.cjs.js +0 -1
  386. package/math/MeshSurfaceSampler.d.ts +0 -15
  387. package/math/MeshSurfaceSampler.js +0 -150
  388. package/math/OBB.cjs.js +0 -1
  389. package/math/OBB.d.ts +0 -24
  390. package/math/OBB.js +0 -296
  391. package/math/Octree.cjs.js +0 -1
  392. package/math/Octree.d.ts +0 -24
  393. package/math/Octree.js +0 -341
  394. package/math/SimplexNoise.cjs.js +0 -1
  395. package/math/SimplexNoise.d.ts +0 -17
  396. package/math/SimplexNoise.js +0 -446
  397. package/misc/ConvexObjectBreaker.cjs.js +0 -1
  398. package/misc/ConvexObjectBreaker.d.ts +0 -25
  399. package/misc/ConvexObjectBreaker.js +0 -398
  400. package/misc/GPUComputationRenderer.cjs.js +0 -1
  401. package/misc/GPUComputationRenderer.d.ts +0 -52
  402. package/misc/GPUComputationRenderer.js +0 -296
  403. package/misc/Gyroscope.cjs.js +0 -1
  404. package/misc/Gyroscope.d.ts +0 -5
  405. package/misc/Gyroscope.js +0 -41
  406. package/misc/MD2Character.cjs.js +0 -1
  407. package/misc/MD2Character.d.ts +0 -33
  408. package/misc/MD2Character.js +0 -184
  409. package/misc/MD2CharacterComplex.cjs.js +0 -1
  410. package/misc/MD2CharacterComplex.d.ts +0 -47
  411. package/misc/MD2CharacterComplex.js +0 -379
  412. package/misc/MorphAnimMesh.cjs.js +0 -1
  413. package/misc/MorphAnimMesh.d.ts +0 -13
  414. package/misc/MorphAnimMesh.js +0 -48
  415. package/misc/MorphBlendMesh.cjs.js +0 -1
  416. package/misc/MorphBlendMesh.d.ts +0 -21
  417. package/misc/MorphBlendMesh.js +0 -203
  418. package/misc/ProgressiveLightmap.cjs.js +0 -1
  419. package/misc/ProgressiveLightmap.js +0 -285
  420. package/misc/RollerCoaster.cjs.js +0 -1
  421. package/misc/RollerCoaster.d.ts +0 -21
  422. package/misc/RollerCoaster.js +0 -375
  423. package/misc/Timer.cjs.js +0 -1
  424. package/misc/Timer.d.ts +0 -27
  425. package/misc/Timer.js +0 -125
  426. package/misc/TubePainter.cjs.js +0 -1
  427. package/misc/TubePainter.d.ts +0 -10
  428. package/misc/TubePainter.js +0 -141
  429. package/misc/Volume.cjs.js +0 -1
  430. package/misc/Volume.d.ts +0 -37
  431. package/misc/Volume.js +0 -406
  432. package/misc/VolumeSlice.cjs.js +0 -1
  433. package/misc/VolumeSlice.d.ts +0 -28
  434. package/misc/VolumeSlice.js +0 -194
  435. package/misc/WebGL.cjs.js +0 -1
  436. package/misc/WebGL.d.ts +0 -5
  437. package/misc/WebGL.js +0 -71
  438. package/modifiers/CurveModifier.cjs.js +0 -1
  439. package/modifiers/CurveModifier.d.ts +0 -39
  440. package/modifiers/CurveModifier.js +0 -288
  441. package/modifiers/EdgeSplitModifier.cjs.js +0 -1
  442. package/modifiers/EdgeSplitModifier.d.ts +0 -19
  443. package/modifiers/EdgeSplitModifier.js +0 -205
  444. package/modifiers/SimplifyModifier.cjs.js +0 -1
  445. package/modifiers/SimplifyModifier.d.ts +0 -12
  446. package/modifiers/SimplifyModifier.js +0 -407
  447. package/modifiers/TessellateModifier.cjs.js +0 -1
  448. package/modifiers/TessellateModifier.d.ts +0 -8
  449. package/modifiers/TessellateModifier.js +0 -231
  450. package/nodes/Nodes.cjs.js +0 -1
  451. package/nodes/Nodes.js +0 -204
  452. package/nodes/ShaderNode.cjs.js +0 -1
  453. package/nodes/ShaderNode.js +0 -308
  454. package/nodes/accessors/BufferNode.cjs.js +0 -1
  455. package/nodes/accessors/BufferNode.js +0 -18
  456. package/nodes/accessors/CameraNode.cjs.js +0 -1
  457. package/nodes/accessors/CameraNode.js +0 -48
  458. package/nodes/accessors/CubeTextureNode.cjs.js +0 -1
  459. package/nodes/accessors/CubeTextureNode.js +0 -53
  460. package/nodes/accessors/MaterialNode.cjs.js +0 -1
  461. package/nodes/accessors/MaterialNode.js +0 -80
  462. package/nodes/accessors/MaterialReferenceNode.cjs.js +0 -1
  463. package/nodes/accessors/MaterialReferenceNode.js +0 -16
  464. package/nodes/accessors/ModelNode.cjs.js +0 -1
  465. package/nodes/accessors/ModelNode.js +0 -10
  466. package/nodes/accessors/ModelViewProjectionNode.cjs.js +0 -1
  467. package/nodes/accessors/ModelViewProjectionNode.js +0 -22
  468. package/nodes/accessors/NormalNode.cjs.js +0 -1
  469. package/nodes/accessors/NormalNode.js +0 -60
  470. package/nodes/accessors/Object3DNode.cjs.js +0 -1
  471. package/nodes/accessors/Object3DNode.js +0 -85
  472. package/nodes/accessors/PointUVNode.cjs.js +0 -1
  473. package/nodes/accessors/PointUVNode.js +0 -16
  474. package/nodes/accessors/PositionNode.cjs.js +0 -1
  475. package/nodes/accessors/PositionNode.js +0 -63
  476. package/nodes/accessors/ReferenceNode.cjs.js +0 -1
  477. package/nodes/accessors/ReferenceNode.js +0 -43
  478. package/nodes/accessors/ReflectNode.cjs.js +0 -1
  479. package/nodes/accessors/ReflectNode.js +0 -45
  480. package/nodes/accessors/SkinningNode.cjs.js +0 -1
  481. package/nodes/accessors/SkinningNode.js +0 -59
  482. package/nodes/accessors/TextureNode.cjs.js +0 -1
  483. package/nodes/accessors/TextureNode.js +0 -68
  484. package/nodes/accessors/UVNode.cjs.js +0 -1
  485. package/nodes/accessors/UVNode.js +0 -28
  486. package/nodes/core/ArrayUniformNode.cjs.js +0 -1
  487. package/nodes/core/ArrayUniformNode.js +0 -17
  488. package/nodes/core/AttributeNode.cjs.js +0 -1
  489. package/nodes/core/AttributeNode.js +0 -36
  490. package/nodes/core/BypassNode.cjs.js +0 -1
  491. package/nodes/core/BypassNode.js +0 -28
  492. package/nodes/core/CodeNode.cjs.js +0 -1
  493. package/nodes/core/CodeNode.js +0 -35
  494. package/nodes/core/ConstNode.cjs.js +0 -1
  495. package/nodes/core/ConstNode.js +0 -17
  496. package/nodes/core/ContextNode.cjs.js +0 -1
  497. package/nodes/core/ContextNode.js +0 -26
  498. package/nodes/core/ExpressionNode.cjs.js +0 -1
  499. package/nodes/core/ExpressionNode.js +0 -22
  500. package/nodes/core/FunctionCallNode.cjs.js +0 -1
  501. package/nodes/core/FunctionCallNode.js +0 -45
  502. package/nodes/core/FunctionNode.cjs.js +0 -1
  503. package/nodes/core/FunctionNode.js +0 -70
  504. package/nodes/core/InputNode.cjs.js +0 -1
  505. package/nodes/core/InputNode.js +0 -48
  506. package/nodes/core/Node.cjs.js +0 -1
  507. package/nodes/core/Node.js +0 -178
  508. package/nodes/core/NodeAttribute.cjs.js +0 -1
  509. package/nodes/core/NodeAttribute.js +0 -11
  510. package/nodes/core/NodeBuilder.cjs.js +0 -1
  511. package/nodes/core/NodeBuilder.js +0 -509
  512. package/nodes/core/NodeCode.cjs.js +0 -1
  513. package/nodes/core/NodeCode.js +0 -13
  514. package/nodes/core/NodeFrame.cjs.js +0 -1
  515. package/nodes/core/NodeFrame.js +0 -37
  516. package/nodes/core/NodeFunction.cjs.js +0 -1
  517. package/nodes/core/NodeFunction.js +0 -17
  518. package/nodes/core/NodeFunctionInput.cjs.js +0 -1
  519. package/nodes/core/NodeFunctionInput.js +0 -14
  520. package/nodes/core/NodeKeywords.cjs.js +0 -1
  521. package/nodes/core/NodeKeywords.js +0 -54
  522. package/nodes/core/NodeParser.cjs.js +0 -1
  523. package/nodes/core/NodeParser.js +0 -8
  524. package/nodes/core/NodeUniform.cjs.js +0 -1
  525. package/nodes/core/NodeUniform.js +0 -21
  526. package/nodes/core/NodeUtils.cjs.js +0 -1
  527. package/nodes/core/NodeUtils.js +0 -61
  528. package/nodes/core/NodeVar.cjs.js +0 -1
  529. package/nodes/core/NodeVar.js +0 -11
  530. package/nodes/core/NodeVary.cjs.js +0 -1
  531. package/nodes/core/NodeVary.js +0 -11
  532. package/nodes/core/PropertyNode.cjs.js +0 -1
  533. package/nodes/core/PropertyNode.js +0 -26
  534. package/nodes/core/TempNode.cjs.js +0 -1
  535. package/nodes/core/TempNode.js +0 -30
  536. package/nodes/core/UniformNode.cjs.js +0 -1
  537. package/nodes/core/UniformNode.js +0 -28
  538. package/nodes/core/VarNode.cjs.js +0 -1
  539. package/nodes/core/VarNode.js +0 -38
  540. package/nodes/core/VaryNode.cjs.js +0 -1
  541. package/nodes/core/VaryNode.js +0 -38
  542. package/nodes/core/constants.cjs.js +0 -1
  543. package/nodes/core/constants.js +0 -11
  544. package/nodes/display/ColorSpaceNode.cjs.js +0 -1
  545. package/nodes/display/ColorSpaceNode.js +0 -66
  546. package/nodes/display/NormalMapNode.cjs.js +0 -1
  547. package/nodes/display/NormalMapNode.js +0 -71
  548. package/nodes/fog/FogNode.cjs.js +0 -1
  549. package/nodes/fog/FogNode.js +0 -18
  550. package/nodes/fog/FogRangeNode.cjs.js +0 -1
  551. package/nodes/fog/FogRangeNode.js +0 -20
  552. package/nodes/functions/BSDFs.cjs.js +0 -1
  553. package/nodes/functions/BSDFs.js +0 -121
  554. package/nodes/functions/PhysicalMaterialFunctions.cjs.js +0 -1
  555. package/nodes/functions/PhysicalMaterialFunctions.js +0 -57
  556. package/nodes/lights/LightContextNode.cjs.js +0 -1
  557. package/nodes/lights/LightContextNode.js +0 -43
  558. package/nodes/lights/LightNode.cjs.js +0 -1
  559. package/nodes/lights/LightNode.js +0 -61
  560. package/nodes/lights/LightsNode.cjs.js +0 -1
  561. package/nodes/lights/LightsNode.js +0 -77
  562. package/nodes/loaders/NodeLoader.cjs.js +0 -1
  563. package/nodes/loaders/NodeLoader.js +0 -212
  564. package/nodes/loaders/NodeMaterialLoader.cjs.js +0 -1
  565. package/nodes/loaders/NodeMaterialLoader.js +0 -29
  566. package/nodes/loaders/NodeObjectLoader.cjs.js +0 -1
  567. package/nodes/loaders/NodeObjectLoader.js +0 -49
  568. package/nodes/materials/LineBasicNodeMaterial.cjs.js +0 -1
  569. package/nodes/materials/LineBasicNodeMaterial.js +0 -31
  570. package/nodes/materials/Materials.cjs.js +0 -1
  571. package/nodes/materials/Materials.js +0 -27
  572. package/nodes/materials/MeshBasicNodeMaterial.cjs.js +0 -1
  573. package/nodes/materials/MeshBasicNodeMaterial.js +0 -32
  574. package/nodes/materials/MeshStandardNodeMaterial.cjs.js +0 -1
  575. package/nodes/materials/MeshStandardNodeMaterial.js +0 -43
  576. package/nodes/materials/NodeMaterial.cjs.js +0 -1
  577. package/nodes/materials/NodeMaterial.js +0 -79
  578. package/nodes/materials/PointsNodeMaterial.cjs.js +0 -1
  579. package/nodes/materials/PointsNodeMaterial.js +0 -34
  580. package/nodes/math/CondNode.cjs.js +0 -1
  581. package/nodes/math/CondNode.js +0 -49
  582. package/nodes/math/MathNode.cjs.js +0 -1
  583. package/nodes/math/MathNode.js +0 -206
  584. package/nodes/math/OperatorNode.cjs.js +0 -1
  585. package/nodes/math/OperatorNode.js +0 -124
  586. package/nodes/parsers/GLSLNodeFunction.cjs.js +0 -1
  587. package/nodes/parsers/GLSLNodeFunction.js +0 -101
  588. package/nodes/parsers/GLSLNodeParser.cjs.js +0 -1
  589. package/nodes/parsers/GLSLNodeParser.js +0 -13
  590. package/nodes/parsers/WGSLNodeFunction.cjs.js +0 -1
  591. package/nodes/parsers/WGSLNodeFunction.js +0 -71
  592. package/nodes/parsers/WGSLNodeParser.cjs.js +0 -1
  593. package/nodes/parsers/WGSLNodeParser.js +0 -13
  594. package/nodes/procedural/CheckerNode.cjs.js +0 -1
  595. package/nodes/procedural/CheckerNode.js +0 -26
  596. package/nodes/utils/ArrayElementNode.cjs.js +0 -1
  597. package/nodes/utils/ArrayElementNode.js +0 -22
  598. package/nodes/utils/ConvertNode.cjs.js +0 -1
  599. package/nodes/utils/ConvertNode.js +0 -29
  600. package/nodes/utils/JoinNode.cjs.js +0 -1
  601. package/nodes/utils/JoinNode.js +0 -29
  602. package/nodes/utils/MatcapUVNode.cjs.js +0 -1
  603. package/nodes/utils/MatcapUVNode.js +0 -18
  604. package/nodes/utils/OscNode.cjs.js +0 -1
  605. package/nodes/utils/OscNode.js +0 -55
  606. package/nodes/utils/SplitNode.cjs.js +0 -1
  607. package/nodes/utils/SplitNode.js +0 -58
  608. package/nodes/utils/SpriteSheetUVNode.cjs.js +0 -1
  609. package/nodes/utils/SpriteSheetUVNode.js +0 -39
  610. package/nodes/utils/TimerNode.cjs.js +0 -1
  611. package/nodes/utils/TimerNode.js +0 -47
  612. package/objects/GroundProjectedEnv.cjs.js +0 -1
  613. package/objects/GroundProjectedEnv.d.ts +0 -12
  614. package/objects/GroundProjectedEnv.js +0 -145
  615. package/objects/Lensflare.cjs.js +0 -1
  616. package/objects/Lensflare.d.ts +0 -17
  617. package/objects/Lensflare.js +0 -332
  618. package/objects/LightningStorm.cjs.js +0 -1
  619. package/objects/LightningStorm.d.ts +0 -32
  620. package/objects/LightningStorm.js +0 -174
  621. package/objects/MarchingCubes.cjs.js +0 -1
  622. package/objects/MarchingCubes.d.ts +0 -75
  623. package/objects/MarchingCubes.js +0 -610
  624. package/objects/Reflector.cjs.js +0 -1
  625. package/objects/Reflector.d.ts +0 -19
  626. package/objects/Reflector.js +0 -188
  627. package/objects/ReflectorForSSRPass.cjs.js +0 -1
  628. package/objects/ReflectorForSSRPass.d.ts +0 -57
  629. package/objects/ReflectorForSSRPass.js +0 -298
  630. package/objects/ReflectorRTT.cjs.js +0 -1
  631. package/objects/ReflectorRTT.js +0 -11
  632. package/objects/Refractor.cjs.js +0 -1
  633. package/objects/Refractor.d.ts +0 -19
  634. package/objects/Refractor.js +0 -220
  635. package/objects/ShadowMesh.cjs.js +0 -1
  636. package/objects/ShadowMesh.d.ts +0 -7
  637. package/objects/ShadowMesh.js +0 -50
  638. package/objects/Sky.cjs.js +0 -1
  639. package/objects/Sky.d.ts +0 -30
  640. package/objects/Sky.js +0 -85
  641. package/objects/Water.cjs.js +0 -1
  642. package/objects/Water.d.ts +0 -22
  643. package/objects/Water.js +0 -279
  644. package/objects/Water2.cjs.js +0 -1
  645. package/objects/Water2.d.ts +0 -30
  646. package/objects/Water2.js +0 -288
  647. package/offscreen/jank.cjs.js +0 -1
  648. package/offscreen/jank.js +0 -30
  649. package/offscreen/offscreen.cjs.js +0 -1
  650. package/offscreen/offscreen.js +0 -7
  651. package/offscreen/scene.cjs.js +0 -1
  652. package/offscreen/scene.js +0 -73
  653. package/physics/AmmoPhysics.cjs.js +0 -1
  654. package/physics/AmmoPhysics.d.ts +0 -7
  655. package/physics/AmmoPhysics.js +0 -206
  656. package/postprocessing/AdaptiveToneMappingPass.cjs.js +0 -1
  657. package/postprocessing/AdaptiveToneMappingPass.d.ts +0 -29
  658. package/postprocessing/AdaptiveToneMappingPass.js +0 -247
  659. package/postprocessing/AfterimagePass.cjs.js +0 -1
  660. package/postprocessing/AfterimagePass.d.ts +0 -15
  661. package/postprocessing/AfterimagePass.js +0 -76
  662. package/postprocessing/BloomPass.cjs.js +0 -1
  663. package/postprocessing/BloomPass.d.ts +0 -16
  664. package/postprocessing/BloomPass.js +0 -116
  665. package/postprocessing/BokehPass.cjs.js +0 -1
  666. package/postprocessing/BokehPass.d.ts +0 -23
  667. package/postprocessing/BokehPass.js +0 -106
  668. package/postprocessing/ClearPass.cjs.js +0 -1
  669. package/postprocessing/ClearPass.d.ts +0 -10
  670. package/postprocessing/ClearPass.js +0 -42
  671. package/postprocessing/CubeTexturePass.cjs.js +0 -1
  672. package/postprocessing/CubeTexturePass.d.ts +0 -14
  673. package/postprocessing/CubeTexturePass.js +0 -48
  674. package/postprocessing/DotScreenPass.cjs.js +0 -1
  675. package/postprocessing/DotScreenPass.d.ts +0 -10
  676. package/postprocessing/DotScreenPass.js +0 -48
  677. package/postprocessing/EffectComposer.cjs.js +0 -1
  678. package/postprocessing/EffectComposer.d.ts +0 -27
  679. package/postprocessing/EffectComposer.js +0 -186
  680. package/postprocessing/FilmPass.cjs.js +0 -1
  681. package/postprocessing/FilmPass.d.ts +0 -10
  682. package/postprocessing/FilmPass.js +0 -47
  683. package/postprocessing/GlitchPass.cjs.js +0 -1
  684. package/postprocessing/GlitchPass.d.ts +0 -15
  685. package/postprocessing/GlitchPass.js +0 -96
  686. package/postprocessing/HalftonePass.cjs.js +0 -1
  687. package/postprocessing/HalftonePass.d.ts +0 -23
  688. package/postprocessing/HalftonePass.js +0 -64
  689. package/postprocessing/LUTPass.cjs.js +0 -1
  690. package/postprocessing/LUTPass.d.ts +0 -13
  691. package/postprocessing/LUTPass.js +0 -161
  692. package/postprocessing/MaskPass.cjs.js +0 -1
  693. package/postprocessing/MaskPass.d.ts +0 -14
  694. package/postprocessing/MaskPass.js +0 -79
  695. package/postprocessing/OutlinePass.cjs.js +0 -1
  696. package/postprocessing/OutlinePass.d.ts +0 -53
  697. package/postprocessing/OutlinePass.js +0 -580
  698. package/postprocessing/Pass.cjs.js +0 -1
  699. package/postprocessing/Pass.d.ts +0 -20
  700. package/postprocessing/Pass.js +0 -61
  701. package/postprocessing/RenderPass.cjs.js +0 -1
  702. package/postprocessing/RenderPass.d.ts +0 -14
  703. package/postprocessing/RenderPass.js +0 -71
  704. package/postprocessing/RenderPixelatedPass.cjs.js +0 -1
  705. package/postprocessing/RenderPixelatedPass.js +0 -213
  706. package/postprocessing/SAOPass.cjs.js +0 -1
  707. package/postprocessing/SAOPass.d.ts +0 -79
  708. package/postprocessing/SAOPass.js +0 -317
  709. package/postprocessing/SMAAPass.cjs.js +0 -1
  710. package/postprocessing/SMAAPass.d.ts +0 -21
  711. package/postprocessing/SMAAPass.js +0 -132
  712. package/postprocessing/SSAARenderPass.cjs.js +0 -1
  713. package/postprocessing/SSAARenderPass.d.ts +0 -17
  714. package/postprocessing/SSAARenderPass.js +0 -118
  715. package/postprocessing/SSAOPass.cjs.js +0 -1
  716. package/postprocessing/SSAOPass.d.ts +0 -71
  717. package/postprocessing/SSAOPass.js +0 -314
  718. package/postprocessing/SSRPass.cjs.js +0 -1
  719. package/postprocessing/SSRPass.d.ts +0 -124
  720. package/postprocessing/SSRPass.js +0 -508
  721. package/postprocessing/SavePass.cjs.js +0 -1
  722. package/postprocessing/SavePass.d.ts +0 -12
  723. package/postprocessing/SavePass.js +0 -42
  724. package/postprocessing/ShaderPass.cjs.js +0 -1
  725. package/postprocessing/ShaderPass.d.ts +0 -13
  726. package/postprocessing/ShaderPass.js +0 -55
  727. package/postprocessing/TAARenderPass.cjs.js +0 -1
  728. package/postprocessing/TAARenderPass.d.ts +0 -8
  729. package/postprocessing/TAARenderPass.js +0 -107
  730. package/postprocessing/TexturePass.cjs.js +0 -1
  731. package/postprocessing/TexturePass.d.ts +0 -12
  732. package/postprocessing/TexturePass.js +0 -40
  733. package/postprocessing/UnrealBloomPass.cjs.js +0 -1
  734. package/postprocessing/UnrealBloomPass.d.ts +0 -31
  735. package/postprocessing/UnrealBloomPass.js +0 -273
  736. package/postprocessing/WaterPass.cjs.js +0 -1
  737. package/postprocessing/WaterPass.d.ts +0 -12
  738. package/postprocessing/WaterPass.js +0 -102
  739. package/renderers/CSS2DRenderer.cjs.js +0 -1
  740. package/renderers/CSS2DRenderer.d.ts +0 -22
  741. package/renderers/CSS2DRenderer.js +0 -152
  742. package/renderers/CSS3DRenderer.cjs.js +0 -1
  743. package/renderers/CSS3DRenderer.d.ts +0 -26
  744. package/renderers/CSS3DRenderer.js +0 -166
  745. package/renderers/Projector.cjs.js +0 -1
  746. package/renderers/Projector.d.ts +0 -60
  747. package/renderers/Projector.js +0 -678
  748. package/renderers/SVGRenderer.cjs.js +0 -1
  749. package/renderers/SVGRenderer.d.ts +0 -25
  750. package/renderers/SVGRenderer.js +0 -416
  751. package/renderers/nodes/accessors/CameraNode.cjs.js +0 -1
  752. package/renderers/nodes/accessors/CameraNode.js +0 -73
  753. package/renderers/nodes/accessors/ModelNode.cjs.js +0 -1
  754. package/renderers/nodes/accessors/ModelNode.js +0 -69
  755. package/renderers/nodes/accessors/ModelViewProjectionNode.cjs.js +0 -1
  756. package/renderers/nodes/accessors/ModelViewProjectionNode.js +0 -33
  757. package/renderers/nodes/accessors/NormalNode.cjs.js +0 -1
  758. package/renderers/nodes/accessors/NormalNode.js +0 -70
  759. package/renderers/nodes/accessors/PositionNode.cjs.js +0 -1
  760. package/renderers/nodes/accessors/PositionNode.js +0 -30
  761. package/renderers/nodes/accessors/UVNode.cjs.js +0 -1
  762. package/renderers/nodes/accessors/UVNode.js +0 -17
  763. package/renderers/nodes/core/AttributeNode.cjs.js +0 -1
  764. package/renderers/nodes/core/AttributeNode.js +0 -43
  765. package/renderers/nodes/core/InputNode.cjs.js +0 -1
  766. package/renderers/nodes/core/InputNode.js +0 -40
  767. package/renderers/nodes/core/Node.cjs.js +0 -1
  768. package/renderers/nodes/core/Node.js +0 -43
  769. package/renderers/nodes/core/NodeAttribute.cjs.js +0 -1
  770. package/renderers/nodes/core/NodeAttribute.js +0 -12
  771. package/renderers/nodes/core/NodeBuilder.cjs.js +0 -1
  772. package/renderers/nodes/core/NodeBuilder.js +0 -309
  773. package/renderers/nodes/core/NodeFrame.cjs.js +0 -1
  774. package/renderers/nodes/core/NodeFrame.js +0 -37
  775. package/renderers/nodes/core/NodeSlot.cjs.js +0 -1
  776. package/renderers/nodes/core/NodeSlot.js +0 -10
  777. package/renderers/nodes/core/NodeUniform.cjs.js +0 -1
  778. package/renderers/nodes/core/NodeUniform.js +0 -22
  779. package/renderers/nodes/core/NodeVary.cjs.js +0 -1
  780. package/renderers/nodes/core/NodeVary.js +0 -13
  781. package/renderers/nodes/core/VaryNode.cjs.js +0 -1
  782. package/renderers/nodes/core/VaryNode.js +0 -27
  783. package/renderers/nodes/core/constants.cjs.js +0 -1
  784. package/renderers/nodes/core/constants.js +0 -19
  785. package/renderers/nodes/inputs/ColorNode.cjs.js +0 -1
  786. package/renderers/nodes/inputs/ColorNode.js +0 -16
  787. package/renderers/nodes/inputs/FloatNode.cjs.js +0 -1
  788. package/renderers/nodes/inputs/FloatNode.js +0 -16
  789. package/renderers/nodes/inputs/Matrix3Node.cjs.js +0 -1
  790. package/renderers/nodes/inputs/Matrix3Node.js +0 -17
  791. package/renderers/nodes/inputs/Matrix4Node.cjs.js +0 -1
  792. package/renderers/nodes/inputs/Matrix4Node.js +0 -17
  793. package/renderers/nodes/inputs/TextureNode.cjs.js +0 -1
  794. package/renderers/nodes/inputs/TextureNode.js +0 -27
  795. package/renderers/nodes/inputs/Vector2Node.cjs.js +0 -1
  796. package/renderers/nodes/inputs/Vector2Node.js +0 -16
  797. package/renderers/nodes/inputs/Vector3Node.cjs.js +0 -1
  798. package/renderers/nodes/inputs/Vector3Node.js +0 -17
  799. package/renderers/nodes/inputs/Vector4Node.cjs.js +0 -1
  800. package/renderers/nodes/inputs/Vector4Node.js +0 -17
  801. package/renderers/nodes/math/MathNode.cjs.js +0 -1
  802. package/renderers/nodes/math/MathNode.js +0 -64
  803. package/renderers/nodes/math/OperatorNode.cjs.js +0 -1
  804. package/renderers/nodes/math/OperatorNode.js +0 -57
  805. package/renderers/nodes/utils/SwitchNode.cjs.js +0 -1
  806. package/renderers/nodes/utils/SwitchNode.js +0 -24
  807. package/renderers/nodes/utils/TimerNode.cjs.js +0 -1
  808. package/renderers/nodes/utils/TimerNode.js +0 -18
  809. package/renderers/webgpu/WebGPU.cjs.js +0 -1
  810. package/renderers/webgpu/WebGPU.js +0 -25
  811. package/renderers/webgpu/WebGPUAttributes.cjs.js +0 -1
  812. package/renderers/webgpu/WebGPUAttributes.js +0 -75
  813. package/renderers/webgpu/WebGPUBackground.cjs.js +0 -1
  814. package/renderers/webgpu/WebGPUBackground.js +0 -77
  815. package/renderers/webgpu/WebGPUBinding.cjs.js +0 -1
  816. package/renderers/webgpu/WebGPUBinding.js +0 -16
  817. package/renderers/webgpu/WebGPUBindings.cjs.js +0 -1
  818. package/renderers/webgpu/WebGPUBindings.js +0 -190
  819. package/renderers/webgpu/WebGPUComputePipelines.cjs.js +0 -1
  820. package/renderers/webgpu/WebGPUComputePipelines.js +0 -54
  821. package/renderers/webgpu/WebGPUGeometries.cjs.js +0 -1
  822. package/renderers/webgpu/WebGPUGeometries.js +0 -50
  823. package/renderers/webgpu/WebGPUInfo.cjs.js +0 -1
  824. package/renderers/webgpu/WebGPUInfo.js +0 -50
  825. package/renderers/webgpu/WebGPUObjects.cjs.js +0 -1
  826. package/renderers/webgpu/WebGPUObjects.js +0 -29
  827. package/renderers/webgpu/WebGPUProperties.cjs.js +0 -1
  828. package/renderers/webgpu/WebGPUProperties.js +0 -27
  829. package/renderers/webgpu/WebGPURenderLists.cjs.js +0 -1
  830. package/renderers/webgpu/WebGPURenderLists.js +0 -134
  831. package/renderers/webgpu/WebGPURenderPipelines.cjs.js +0 -1
  832. package/renderers/webgpu/WebGPURenderPipelines.js +0 -671
  833. package/renderers/webgpu/WebGPURenderer.cjs.js +0 -1
  834. package/renderers/webgpu/WebGPURenderer.js +0 -713
  835. package/renderers/webgpu/WebGPUSampledTexture.cjs.js +0 -1
  836. package/renderers/webgpu/WebGPUSampledTexture.js +0 -53
  837. package/renderers/webgpu/WebGPUSampler.cjs.js +0 -1
  838. package/renderers/webgpu/WebGPUSampler.js +0 -19
  839. package/renderers/webgpu/WebGPUStorageBuffer.cjs.js +0 -1
  840. package/renderers/webgpu/WebGPUStorageBuffer.js +0 -19
  841. package/renderers/webgpu/WebGPUTextureRenderer.cjs.js +0 -1
  842. package/renderers/webgpu/WebGPUTextureRenderer.js +0 -28
  843. package/renderers/webgpu/WebGPUTextureUtils.cjs.js +0 -1
  844. package/renderers/webgpu/WebGPUTextureUtils.js +0 -108
  845. package/renderers/webgpu/WebGPUTextures.cjs.js +0 -1
  846. package/renderers/webgpu/WebGPUTextures.js +0 -630
  847. package/renderers/webgpu/WebGPUUniform.cjs.js +0 -1
  848. package/renderers/webgpu/WebGPUUniform.js +0 -107
  849. package/renderers/webgpu/WebGPUUniformsGroup.cjs.js +0 -1
  850. package/renderers/webgpu/WebGPUUniformsGroup.js +0 -215
  851. package/renderers/webgpu/constants.cjs.js +0 -1
  852. package/renderers/webgpu/constants.js +0 -221
  853. package/renderers/webgpu/nodes/ShaderLib.cjs.js +0 -1
  854. package/renderers/webgpu/nodes/ShaderLib.js +0 -41
  855. package/renderers/webgpu/nodes/WebGPUNodeBuilder.cjs.js +0 -1
  856. package/renderers/webgpu/nodes/WebGPUNodeBuilder.js +0 -235
  857. package/renderers/webgpu/nodes/WebGPUNodeUniform.cjs.js +0 -1
  858. package/renderers/webgpu/nodes/WebGPUNodeUniform.js +0 -87
  859. package/renderers/webgpu/nodes/WebGPUNodeUniformsGroup.cjs.js +0 -1
  860. package/renderers/webgpu/nodes/WebGPUNodeUniformsGroup.js +0 -15
  861. package/renderers/webgpu/nodes/WebGPUNodes.cjs.js +0 -1
  862. package/renderers/webgpu/nodes/WebGPUNodes.js +0 -77
  863. package/shaders/ACESFilmicToneMappingShader.cjs.js +0 -1
  864. package/shaders/ACESFilmicToneMappingShader.d.ts +0 -9
  865. package/shaders/ACESFilmicToneMappingShader.js +0 -28
  866. package/shaders/AfterimageShader.cjs.js +0 -1
  867. package/shaders/AfterimageShader.d.ts +0 -10
  868. package/shaders/AfterimageShader.js +0 -22
  869. package/shaders/BasicShader.cjs.js +0 -1
  870. package/shaders/BasicShader.d.ts +0 -5
  871. package/shaders/BasicShader.js +0 -10
  872. package/shaders/BleachBypassShader.cjs.js +0 -1
  873. package/shaders/BleachBypassShader.d.ts +0 -9
  874. package/shaders/BleachBypassShader.js +0 -19
  875. package/shaders/BlendShader.cjs.js +0 -1
  876. package/shaders/BlendShader.d.ts +0 -18
  877. package/shaders/BlendShader.js +0 -23
  878. package/shaders/BokehShader.cjs.js +0 -1
  879. package/shaders/BokehShader.d.ts +0 -19
  880. package/shaders/BokehShader.js +0 -44
  881. package/shaders/BokehShader2.cjs.js +0 -1
  882. package/shaders/BokehShader2.d.ts +0 -43
  883. package/shaders/BokehShader2.js +0 -98
  884. package/shaders/BrightnessContrastShader.cjs.js +0 -1
  885. package/shaders/BrightnessContrastShader.d.ts +0 -15
  886. package/shaders/BrightnessContrastShader.js +0 -23
  887. package/shaders/ColorCorrectionShader.cjs.js +0 -1
  888. package/shaders/ColorCorrectionShader.d.ts +0 -19
  889. package/shaders/ColorCorrectionShader.js +0 -26
  890. package/shaders/ColorifyShader.cjs.js +0 -1
  891. package/shaders/ColorifyShader.d.ts +0 -13
  892. package/shaders/ColorifyShader.js +0 -20
  893. package/shaders/ConvolutionShader.cjs.js +0 -1
  894. package/shaders/ConvolutionShader.d.ts +0 -16
  895. package/shaders/ConvolutionShader.js +0 -51
  896. package/shaders/CopyShader.cjs.js +0 -1
  897. package/shaders/CopyShader.d.ts +0 -9
  898. package/shaders/CopyShader.js +0 -17
  899. package/shaders/DOFMipMapShader.cjs.js +0 -1
  900. package/shaders/DOFMipMapShader.d.ts +0 -18
  901. package/shaders/DOFMipMapShader.js +0 -25
  902. package/shaders/DepthLimitedBlurShader.cjs.js +0 -1
  903. package/shaders/DepthLimitedBlurShader.d.ts +0 -28
  904. package/shaders/DepthLimitedBlurShader.js +0 -69
  905. package/shaders/DigitalGlitch.cjs.js +0 -1
  906. package/shaders/DigitalGlitch.d.ts +0 -39
  907. package/shaders/DigitalGlitch.js +0 -106
  908. package/shaders/DotScreenShader.cjs.js +0 -1
  909. package/shaders/DotScreenShader.d.ts +0 -22
  910. package/shaders/DotScreenShader.js +0 -31
  911. package/shaders/FXAAShader.cjs.js +0 -1
  912. package/shaders/FXAAShader.d.ts +0 -13
  913. package/shaders/FXAAShader.js +0 -23
  914. package/shaders/FilmShader.cjs.js +0 -1
  915. package/shaders/FilmShader.d.ts +0 -24
  916. package/shaders/FilmShader.js +0 -56
  917. package/shaders/FocusShader.cjs.js +0 -1
  918. package/shaders/FocusShader.d.ts +0 -21
  919. package/shaders/FocusShader.js +0 -28
  920. package/shaders/FreiChenShader.cjs.js +0 -1
  921. package/shaders/FreiChenShader.d.ts +0 -13
  922. package/shaders/FreiChenShader.js +0 -28
  923. package/shaders/FresnelShader.cjs.js +0 -1
  924. package/shaders/FresnelShader.d.ts +0 -21
  925. package/shaders/FresnelShader.js +0 -26
  926. package/shaders/GammaCorrectionShader.cjs.js +0 -1
  927. package/shaders/GammaCorrectionShader.d.ts +0 -8
  928. package/shaders/GammaCorrectionShader.js +0 -15
  929. package/shaders/GodRaysShader.cjs.js +0 -1
  930. package/shaders/GodRaysShader.d.ts +0 -58
  931. package/shaders/GodRaysShader.js +0 -137
  932. package/shaders/HalftoneShader.cjs.js +0 -1
  933. package/shaders/HalftoneShader.d.ts +0 -45
  934. package/shaders/HalftoneShader.js +0 -69
  935. package/shaders/HorizontalBlurShader.cjs.js +0 -1
  936. package/shaders/HorizontalBlurShader.d.ts +0 -9
  937. package/shaders/HorizontalBlurShader.js +0 -59
  938. package/shaders/HorizontalTiltShiftShader.cjs.js +0 -1
  939. package/shaders/HorizontalTiltShiftShader.d.ts +0 -15
  940. package/shaders/HorizontalTiltShiftShader.js +0 -25
  941. package/shaders/HueSaturationShader.cjs.js +0 -1
  942. package/shaders/HueSaturationShader.d.ts +0 -15
  943. package/shaders/HueSaturationShader.js +0 -25
  944. package/shaders/KaleidoShader.cjs.js +0 -1
  945. package/shaders/KaleidoShader.d.ts +0 -15
  946. package/shaders/KaleidoShader.js +0 -26
  947. package/shaders/LuminosityHighPassShader.cjs.js +0 -1
  948. package/shaders/LuminosityHighPassShader.d.ts +0 -23
  949. package/shaders/LuminosityHighPassShader.js +0 -31
  950. package/shaders/LuminosityShader.cjs.js +0 -1
  951. package/shaders/LuminosityShader.d.ts +0 -9
  952. package/shaders/LuminosityShader.js +0 -15
  953. package/shaders/MirrorShader.cjs.js +0 -1
  954. package/shaders/MirrorShader.d.ts +0 -12
  955. package/shaders/MirrorShader.js +0 -20
  956. package/shaders/NormalMapShader.cjs.js +0 -1
  957. package/shaders/NormalMapShader.d.ts +0 -19
  958. package/shaders/NormalMapShader.js +0 -27
  959. package/shaders/ParallaxShader.cjs.js +0 -1
  960. package/shaders/ParallaxShader.d.ts +0 -28
  961. package/shaders/ParallaxShader.js +0 -54
  962. package/shaders/PixelShader.cjs.js +0 -1
  963. package/shaders/PixelShader.d.ts +0 -15
  964. package/shaders/PixelShader.js +0 -20
  965. package/shaders/RGBShiftShader.cjs.js +0 -1
  966. package/shaders/RGBShiftShader.d.ts +0 -15
  967. package/shaders/RGBShiftShader.js +0 -26
  968. package/shaders/SAOShader.cjs.js +0 -1
  969. package/shaders/SAOShader.d.ts +0 -25
  970. package/shaders/SAOShader.js +0 -60
  971. package/shaders/SMAAShader.cjs.js +0 -1
  972. package/shaders/SMAAShader.d.ts +0 -55
  973. package/shaders/SMAAShader.js +0 -151
  974. package/shaders/SSAOShader.cjs.js +0 -1
  975. package/shaders/SSAOShader.d.ts +0 -80
  976. package/shaders/SSAOShader.js +0 -100
  977. package/shaders/SSRShader.cjs.js +0 -1
  978. package/shaders/SSRShader.d.ts +0 -90
  979. package/shaders/SSRShader.js +0 -379
  980. package/shaders/SepiaShader.cjs.js +0 -1
  981. package/shaders/SepiaShader.d.ts +0 -12
  982. package/shaders/SepiaShader.js +0 -19
  983. package/shaders/SobelOperatorShader.cjs.js +0 -1
  984. package/shaders/SobelOperatorShader.d.ts +0 -13
  985. package/shaders/SobelOperatorShader.js +0 -33
  986. package/shaders/SubsurfaceScatteringShader.cjs.js +0 -1
  987. package/shaders/SubsurfaceScatteringShader.d.ts +0 -5
  988. package/shaders/SubsurfaceScatteringShader.js +0 -45
  989. package/shaders/TechnicolorShader.cjs.js +0 -1
  990. package/shaders/TechnicolorShader.d.ts +0 -9
  991. package/shaders/TechnicolorShader.js +0 -17
  992. package/shaders/ToneMapShader.cjs.js +0 -1
  993. package/shaders/ToneMapShader.d.ts +0 -24
  994. package/shaders/ToneMapShader.js +0 -32
  995. package/shaders/ToonShader.cjs.js +0 -1
  996. package/shaders/ToonShader.d.ts +0 -100
  997. package/shaders/ToonShader.js +0 -112
  998. package/shaders/TriangleBlurShader.cjs.js +0 -1
  999. package/shaders/TriangleBlurShader.d.ts +0 -13
  1000. package/shaders/TriangleBlurShader.js +0 -27
  1001. package/shaders/UnpackDepthRGBAShader.cjs.js +0 -1
  1002. package/shaders/UnpackDepthRGBAShader.d.ts +0 -12
  1003. package/shaders/UnpackDepthRGBAShader.js +0 -18
  1004. package/shaders/VerticalBlurShader.cjs.js +0 -1
  1005. package/shaders/VerticalBlurShader.d.ts +0 -9
  1006. package/shaders/VerticalBlurShader.js +0 -60
  1007. package/shaders/VerticalTiltShiftShader.cjs.js +0 -1
  1008. package/shaders/VerticalTiltShiftShader.d.ts +0 -15
  1009. package/shaders/VerticalTiltShiftShader.js +0 -25
  1010. package/shaders/VignetteShader.cjs.js +0 -1
  1011. package/shaders/VignetteShader.d.ts +0 -15
  1012. package/shaders/VignetteShader.js +0 -32
  1013. package/shaders/VolumeShader.cjs.js +0 -1
  1014. package/shaders/VolumeShader.d.ts +0 -25
  1015. package/shaders/VolumeShader.js +0 -81
  1016. package/shaders/WaterRefractionShader.cjs.js +0 -1
  1017. package/shaders/WaterRefractionShader.d.ts +0 -21
  1018. package/shaders/WaterRefractionShader.js +0 -25
  1019. package/shaders/types.cjs.js +0 -1
  1020. package/shaders/types.d.ts +0 -14
  1021. package/shaders/types.js +0 -1
  1022. package/textures/FlakesTexture.cjs.js +0 -1
  1023. package/textures/FlakesTexture.d.ts +0 -4
  1024. package/textures/FlakesTexture.js +0 -32
  1025. package/types/helpers.cjs.js +0 -1
  1026. package/types/helpers.d.ts +0 -1
  1027. package/types/helpers.js +0 -3
  1028. package/types/shared.cjs.js +0 -1
  1029. package/types/shared.d.ts +0 -2
  1030. package/types/shared.js +0 -1
  1031. package/types/utils.cjs.js +0 -1
  1032. package/types/utils.d.ts +0 -3
  1033. package/types/utils.js +0 -1
  1034. package/utils/BufferGeometryUtils.cjs.js +0 -1
  1035. package/utils/BufferGeometryUtils.d.ts +0 -15
  1036. package/utils/BufferGeometryUtils.js +0 -728
  1037. package/utils/GeometryCompressionUtils.cjs.js +0 -1
  1038. package/utils/GeometryCompressionUtils.d.ts +0 -7
  1039. package/utils/GeometryCompressionUtils.js +0 -545
  1040. package/utils/GeometryUtils.cjs.js +0 -1
  1041. package/utils/GeometryUtils.d.ts +0 -6
  1042. package/utils/GeometryUtils.js +0 -161
  1043. package/utils/LDrawUtils.cjs.js +0 -1
  1044. package/utils/LDrawUtils.d.ts +0 -5
  1045. package/utils/LDrawUtils.js +0 -144
  1046. package/utils/RoughnessMipmapper.cjs.js +0 -1
  1047. package/utils/RoughnessMipmapper.js +0 -257
  1048. package/utils/SceneUtils.cjs.js +0 -1
  1049. package/utils/SceneUtils.d.ts +0 -9
  1050. package/utils/SceneUtils.js +0 -41
  1051. package/utils/ShadowMapViewer.cjs.js +0 -1
  1052. package/utils/ShadowMapViewer.d.ts +0 -24
  1053. package/utils/ShadowMapViewer.js +0 -160
  1054. package/utils/SkeletonUtils.cjs.js +0 -1
  1055. package/utils/SkeletonUtils.d.ts +0 -30
  1056. package/utils/SkeletonUtils.js +0 -383
  1057. package/utils/UVsDebug.cjs.js +0 -1
  1058. package/utils/UVsDebug.d.ts +0 -3
  1059. package/utils/UVsDebug.js +0 -115
  1060. package/utils/WorkerPool.cjs.js +0 -1
  1061. package/utils/WorkerPool.js +0 -82
  1062. package/webxr/ARButton.cjs.js +0 -1
  1063. package/webxr/ARButton.d.ts +0 -5
  1064. package/webxr/ARButton.js +0 -145
  1065. package/webxr/OculusHandModel.cjs.js +0 -1
  1066. package/webxr/OculusHandModel.d.ts +0 -22
  1067. package/webxr/OculusHandModel.js +0 -90
  1068. package/webxr/OculusHandPointerModel.cjs.js +0 -1
  1069. package/webxr/OculusHandPointerModel.d.ts +0 -63
  1070. package/webxr/OculusHandPointerModel.js +0 -248
  1071. package/webxr/Text2D.cjs.js +0 -1
  1072. package/webxr/Text2D.d.ts +0 -3
  1073. package/webxr/Text2D.js +0 -32
  1074. package/webxr/VRButton.cjs.js +0 -1
  1075. package/webxr/VRButton.d.ts +0 -7
  1076. package/webxr/VRButton.js +0 -136
  1077. package/webxr/XRControllerModelFactory.cjs.js +0 -1
  1078. package/webxr/XRControllerModelFactory.d.ts +0 -19
  1079. package/webxr/XRControllerModelFactory.js +0 -237
  1080. package/webxr/XREstimatedLight.cjs.js +0 -1
  1081. package/webxr/XREstimatedLight.d.ts +0 -32
  1082. package/webxr/XREstimatedLight.js +0 -153
  1083. package/webxr/XRHandMeshModel.cjs.js +0 -1
  1084. package/webxr/XRHandMeshModel.d.ts +0 -9
  1085. package/webxr/XRHandMeshModel.js +0 -62
  1086. package/webxr/XRHandModelFactory.cjs.js +0 -1
  1087. package/webxr/XRHandModelFactory.d.ts +0 -25
  1088. package/webxr/XRHandModelFactory.js +0 -64
  1089. package/webxr/XRHandPrimitiveModel.cjs.js +0 -1
  1090. package/webxr/XRHandPrimitiveModel.d.ts +0 -24
  1091. package/webxr/XRHandPrimitiveModel.js +0 -54
package/index.cjs.js DELETED
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("three"),t=require("@babel/runtime/helpers/defineProperty"),r=require("potpack"),n=require("fflate"),s=require("mmd-parser"),o=require("chevrotain"),a=require("ktx-parse"),l=require("zstddec"),c=require("opentype.js");function h(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function u(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var d=u(e),p=h(t),m=h(r);const f=[[-.525731,0,.850651],[-.442863,.238856,.864188],[-.295242,0,.955423],[-.309017,.5,.809017],[-.16246,.262866,.951056],[0,0,1],[0,.850651,.525731],[-.147621,.716567,.681718],[.147621,.716567,.681718],[0,.525731,.850651],[.309017,.5,.809017],[.525731,0,.850651],[.295242,0,.955423],[.442863,.238856,.864188],[.16246,.262866,.951056],[-.681718,.147621,.716567],[-.809017,.309017,.5],[-.587785,.425325,.688191],[-.850651,.525731,0],[-.864188,.442863,.238856],[-.716567,.681718,.147621],[-.688191,.587785,.425325],[-.5,.809017,.309017],[-.238856,.864188,.442863],[-.425325,.688191,.587785],[-.716567,.681718,-.147621],[-.5,.809017,-.309017],[-.525731,.850651,0],[0,.850651,-.525731],[-.238856,.864188,-.442863],[0,.955423,-.295242],[-.262866,.951056,-.16246],[0,1,0],[0,.955423,.295242],[-.262866,.951056,.16246],[.238856,.864188,.442863],[.262866,.951056,.16246],[.5,.809017,.309017],[.238856,.864188,-.442863],[.262866,.951056,-.16246],[.5,.809017,-.309017],[.850651,.525731,0],[.716567,.681718,.147621],[.716567,.681718,-.147621],[.525731,.850651,0],[.425325,.688191,.587785],[.864188,.442863,.238856],[.688191,.587785,.425325],[.809017,.309017,.5],[.681718,.147621,.716567],[.587785,.425325,.688191],[.955423,.295242,0],[1,0,0],[.951056,.16246,.262866],[.850651,-.525731,0],[.955423,-.295242,0],[.864188,-.442863,.238856],[.951056,-.16246,.262866],[.809017,-.309017,.5],[.681718,-.147621,.716567],[.850651,0,.525731],[.864188,.442863,-.238856],[.809017,.309017,-.5],[.951056,.16246,-.262866],[.525731,0,-.850651],[.681718,.147621,-.716567],[.681718,-.147621,-.716567],[.850651,0,-.525731],[.809017,-.309017,-.5],[.864188,-.442863,-.238856],[.951056,-.16246,-.262866],[.147621,.716567,-.681718],[.309017,.5,-.809017],[.425325,.688191,-.587785],[.442863,.238856,-.864188],[.587785,.425325,-.688191],[.688191,.587785,-.425325],[-.147621,.716567,-.681718],[-.309017,.5,-.809017],[0,.525731,-.850651],[-.525731,0,-.850651],[-.442863,.238856,-.864188],[-.295242,0,-.955423],[-.16246,.262866,-.951056],[0,0,-1],[.295242,0,-.955423],[.16246,.262866,-.951056],[-.442863,-.238856,-.864188],[-.309017,-.5,-.809017],[-.16246,-.262866,-.951056],[0,-.850651,-.525731],[-.147621,-.716567,-.681718],[.147621,-.716567,-.681718],[0,-.525731,-.850651],[.309017,-.5,-.809017],[.442863,-.238856,-.864188],[.16246,-.262866,-.951056],[.238856,-.864188,-.442863],[.5,-.809017,-.309017],[.425325,-.688191,-.587785],[.716567,-.681718,-.147621],[.688191,-.587785,-.425325],[.587785,-.425325,-.688191],[0,-.955423,-.295242],[0,-1,0],[.262866,-.951056,-.16246],[0,-.850651,.525731],[0,-.955423,.295242],[.238856,-.864188,.442863],[.262866,-.951056,.16246],[.5,-.809017,.309017],[.716567,-.681718,.147621],[.525731,-.850651,0],[-.238856,-.864188,-.442863],[-.5,-.809017,-.309017],[-.262866,-.951056,-.16246],[-.850651,-.525731,0],[-.716567,-.681718,-.147621],[-.716567,-.681718,.147621],[-.525731,-.850651,0],[-.5,-.809017,.309017],[-.238856,-.864188,.442863],[-.262866,-.951056,.16246],[-.864188,-.442863,.238856],[-.809017,-.309017,.5],[-.688191,-.587785,.425325],[-.681718,-.147621,.716567],[-.442863,-.238856,.864188],[-.587785,-.425325,.688191],[-.309017,-.5,.809017],[-.147621,-.716567,.681718],[-.425325,-.688191,.587785],[-.16246,-.262866,.951056],[.442863,-.238856,.864188],[.16246,-.262866,.951056],[.309017,-.5,.809017],[.147621,-.716567,.681718],[0,-.525731,.850651],[.425325,-.688191,.587785],[.587785,-.425325,.688191],[.688191,-.587785,.425325],[-.955423,.295242,0],[-.951056,.16246,.262866],[-1,0,0],[-.850651,0,.525731],[-.955423,-.295242,0],[-.951056,-.16246,.262866],[-.864188,.442863,-.238856],[-.951056,.16246,-.262866],[-.809017,.309017,-.5],[-.864188,-.442863,-.238856],[-.951056,-.16246,-.262866],[-.809017,-.309017,-.5],[-.681718,.147621,-.716567],[-.681718,-.147621,-.716567],[-.850651,0,-.525731],[-.688191,.587785,-.425325],[-.587785,.425325,-.688191],[-.425325,.688191,-.587785],[-.425325,-.688191,-.587785],[-.587785,-.425325,-.688191],[-.688191,-.587785,-.425325]];class g extends e.Loader{constructor(e){super(e)}load(t,r,i,n){const s=this,o=new e.FileLoader(s.manager);o.setPath(s.path),o.setResponseType("arraybuffer"),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(t,(function(e){try{r(s.parse(e))}catch(e){n?n(e):console.error(e),s.manager.itemError(t)}}),i,n)}parse(t){const r=new DataView(t),i={},n=["ident","version","skinwidth","skinheight","framesize","num_skins","num_vertices","num_st","num_tris","num_glcmds","num_frames","offset_skins","offset_st","offset_tris","offset_frames","offset_glcmds","offset_end"];for(let e=0;e<n.length;e++)i[n[e]]=r.getInt32(4*e,!0);if(844121161!==i.ident||8!==i.version)return void console.error("Not a valid MD2 file");if(i.offset_end!==r.byteLength)return void console.error("Corrupted MD2 file");const s=new e.BufferGeometry,o=[];let a=i.offset_st;for(let e=0,t=i.num_st;e<t;e++){const e=r.getInt16(a+0,!0),t=r.getInt16(a+2,!0);o.push(e/i.skinwidth,1-t/i.skinheight),a+=4}a=i.offset_tris;const l=[],c=[];for(let e=0,t=i.num_tris;e<t;e++)l.push(r.getUint16(a+0,!0),r.getUint16(a+2,!0),r.getUint16(a+4,!0)),c.push(r.getUint16(a+6,!0),r.getUint16(a+8,!0),r.getUint16(a+10,!0)),a+=12;const h=new e.Vector3,u=new e.Vector3,d=[],p=[];a=i.offset_frames;for(let e=0,t=i.num_frames;e<t;e++){u.set(r.getFloat32(a+0,!0),r.getFloat32(a+4,!0),r.getFloat32(a+8,!0)),h.set(r.getFloat32(a+12,!0),r.getFloat32(a+16,!0),r.getFloat32(a+20,!0)),a+=24;for(let e=0;e<16;e++){const t=r.getUint8(a+e,!0);if(0===t)break;d[e]=t}const e={name:String.fromCharCode.apply(null,d),vertices:[],normals:[]};a+=16;for(let t=0;t<i.num_vertices;t++){let t=r.getUint8(a++,!0),i=r.getUint8(a++,!0),n=r.getUint8(a++,!0);const s=f[r.getUint8(a++,!0)];t=t*u.x+h.x,i=i*u.y+h.y,n=n*u.z+h.z,e.vertices.push(t,n,i),e.normals.push(s[0],s[2],s[1])}p.push(e)}const m=[],g=[],v=[],x=p[0].vertices,y=p[0].normals;for(let e=0,t=l.length;e<t;e++){let t=3*l[e];const r=x[t],i=x[t+1],n=x[t+2];m.push(r,i,n);const s=y[t],a=y[t+1],h=y[t+2];g.push(s,a,h);t=2*c[e];const u=o[t],d=o[t+1];v.push(u,d)}s.setAttribute("position",new e.Float32BufferAttribute(m,3)),s.setAttribute("normal",new e.Float32BufferAttribute(g,3)),s.setAttribute("uv",new e.Float32BufferAttribute(v,2));const b=[],A=[];for(let t=0,r=p.length;t<r;t++){const r=p[t],i=r.name;if(r.vertices.length>0){const t=[];for(let e=0,i=l.length;e<i;e++){const i=3*l[e],n=r.vertices[i],s=r.vertices[i+1],o=r.vertices[i+2];t.push(n,s,o)}const n=new e.Float32BufferAttribute(t,3);n.name=i,b.push(n)}if(r.normals.length>0){const t=[];for(let e=0,i=l.length;e<i;e++){const i=3*l[e],n=r.normals[i],s=r.normals[i+1],o=r.normals[i+2];t.push(n,s,o)}const n=new e.Float32BufferAttribute(t,3);n.name=i,A.push(n)}}return s.morphAttributes.position=b,s.morphAttributes.normal=A,s.morphTargetsRelative=!1,s.animations=e.AnimationClip.CreateClipsFromMorphTargetSequences(p,10),s}}var v=function(t,r){e.Mesh.call(this,t,r),this.animationsMap={},this.animationsList=[];var i=Object.keys(this.morphTargetDictionary).length,n="__default",s=i-1,o=i/1;this.createAnimation(n,0,s,o),this.setAnimationWeight(n,1)};v.prototype=Object.assign(Object.create(e.Mesh.prototype),{constructor:v,createAnimation:function(e,t,r,i){var n={start:t,end:r,length:r-t+1,fps:i,duration:(r-t)/i,lastFrame:0,currentFrame:0,active:!1,time:0,direction:1,weight:1,directionBackwards:!1,mirroredLoop:!1};this.animationsMap[e]=n,this.animationsList.push(n)},autoCreateAnimations:function(e){var t,r=/([a-z]+)_?(\d+)/i,i={},n=0;for(let e in this.morphTargetDictionary){var s=e.match(r);if(s&&s.length>1){var o=s[1];i[o]||(i[o]={start:1/0,end:-1/0}),n<(a=i[o]).start&&(a.start=n),n>a.end&&(a.end=n),t||(t=o)}n++}for(let t in i){var a=i[t];this.createAnimation(t,a.start,a.end,e)}this.firstAnimation=t},setAnimationDirectionForward:function(e){var t=this.animationsMap[e];t&&(t.direction=1,t.directionBackwards=!1)},setAnimationDirectionBackward:function(e){var t=this.animationsMap[e];t&&(t.direction=-1,t.directionBackwards=!0)},setAnimationFPS:function(e,t){var r=this.animationsMap[e];r&&(r.fps=t,r.duration=(r.end-r.start)/r.fps)},setAnimationDuration:function(e,t){var r=this.animationsMap[e];r&&(r.duration=t,r.fps=(r.end-r.start)/r.duration)},setAnimationWeight:function(e,t){var r=this.animationsMap[e];r&&(r.weight=t)},setAnimationTime:function(e,t){var r=this.animationsMap[e];r&&(r.time=t)},getAnimationTime:function(e){var t=0,r=this.animationsMap[e];return r&&(t=r.time),t},getAnimationDuration:function(e){var t=-1,r=this.animationsMap[e];return r&&(t=r.duration),t},playAnimation:function(e){var t=this.animationsMap[e];t?(t.time=0,t.active=!0):console.warn("THREE.MorphBlendMesh: animation["+e+"] undefined in .playAnimation()")},stopAnimation:function(e){var t=this.animationsMap[e];t&&(t.active=!1)},update:function(t){for(let a=0,l=this.animationsList.length;a<l;a++){var r=this.animationsList[a];if(r.active){var i=r.duration/r.length;r.time+=r.direction*t,r.mirroredLoop?(r.time>r.duration||r.time<0)&&(r.direction*=-1,r.time>r.duration&&(r.time=r.duration,r.directionBackwards=!0),r.time<0&&(r.time=0,r.directionBackwards=!1)):(r.time=r.time%r.duration,r.time<0&&(r.time+=r.duration));var n=r.start+e.MathUtils.clamp(Math.floor(r.time/i),0,r.length-1),s=r.weight;n!==r.currentFrame&&(this.morphTargetInfluences[r.lastFrame]=0,this.morphTargetInfluences[r.currentFrame]=1*s,this.morphTargetInfluences[n]=0,r.lastFrame=r.currentFrame,r.currentFrame=n);var o=r.time%i/i;r.directionBackwards&&(o=1-o),r.currentFrame!==r.lastFrame?(this.morphTargetInfluences[r.currentFrame]=o*s,this.morphTargetInfluences[r.lastFrame]=(1-o)*s):this.morphTargetInfluences[r.currentFrame]=s}}}});const x=new e.Vector3,y=new e.Line3,b=new e.Plane,A=new e.Vector3,w=new e.Triangle;class M{constructor(){this.tolerance=-1,this.faces=[],this.newFaces=[],this.assigned=new F,this.unassigned=new F,this.vertices=[]}setFromPoints(e){if(e.length>=4){this.makeEmpty();for(let t=0,r=e.length;t<r;t++)this.vertices.push(new C(e[t]));this.compute()}return this}setFromObject(t){const r=[];return t.updateMatrixWorld(!0),t.traverse((function(t){const i=t.geometry;if(void 0!==i){if(i.isGeometry)return void console.error("THREE.ConvexHull no longer supports Geometry. Use THREE.BufferGeometry instead.");if(i.isBufferGeometry){const n=i.attributes.position;if(void 0!==n)for(let i=0,s=n.count;i<s;i++){const s=new e.Vector3;s.fromBufferAttribute(n,i).applyMatrix4(t.matrixWorld),r.push(s)}}}})),this.setFromPoints(r)}containsPoint(e){const t=this.faces;for(let r=0,i=t.length;r<i;r++){if(t[r].distanceToPoint(e)>this.tolerance)return!1}return!0}intersectRay(e,t){const r=this.faces;let i=-1/0,n=1/0;for(let t=0,s=r.length;t<s;t++){const s=r[t],o=s.distanceToPoint(e.origin),a=s.normal.dot(e.direction);if(o>0&&a>=0)return null;const l=0!==a?-o/a:0;if(!(l<=0)&&(a>0?n=Math.min(l,n):i=Math.max(l,i),i>n))return null}return i!==-1/0?e.at(i,t):e.at(n,t),t}intersectsRay(e){return null!==this.intersectRay(e,x)}makeEmpty(){return this.faces=[],this.vertices=[],this}addVertexToFace(e,t){return e.face=t,null===t.outside?this.assigned.append(e):this.assigned.insertBefore(t.outside,e),t.outside=e,this}removeVertexFromFace(e,t){return e===t.outside&&(null!==e.next&&e.next.face===t?t.outside=e.next:t.outside=null),this.assigned.remove(e),this}removeAllVerticesFromFace(e){if(null!==e.outside){const t=e.outside;let r=e.outside;for(;null!==r.next&&r.next.face===e;)r=r.next;return this.assigned.removeSubList(t,r),t.prev=r.next=null,e.outside=null,t}}deleteFaceVertices(e,t){const r=this.removeAllVerticesFromFace(e);if(void 0!==r)if(void 0===t)this.unassigned.appendChain(r);else{let e=r;do{const r=e.next;t.distanceToPoint(e.point)>this.tolerance?this.addVertexToFace(e,t):this.unassigned.append(e),e=r}while(null!==e)}return this}resolveUnassignedPoints(e){if(!1===this.unassigned.isEmpty()){let t=this.unassigned.first();do{const r=t.next;let i=this.tolerance,n=null;for(let r=0;r<e.length;r++){const s=e[r];if(0===s.mark){const e=s.distanceToPoint(t.point);if(e>i&&(i=e,n=s),i>1e3*this.tolerance)break}}null!==n&&this.addVertexToFace(t,n),t=r}while(null!==t)}return this}computeExtremes(){const t=new e.Vector3,r=new e.Vector3,i=[],n=[];for(let e=0;e<3;e++)i[e]=n[e]=this.vertices[0];t.copy(this.vertices[0].point),r.copy(this.vertices[0].point);for(let e=0,s=this.vertices.length;e<s;e++){const s=this.vertices[e],o=s.point;for(let e=0;e<3;e++)o.getComponent(e)<t.getComponent(e)&&(t.setComponent(e,o.getComponent(e)),i[e]=s);for(let e=0;e<3;e++)o.getComponent(e)>r.getComponent(e)&&(r.setComponent(e,o.getComponent(e)),n[e]=s)}return this.tolerance=3*Number.EPSILON*(Math.max(Math.abs(t.x),Math.abs(r.x))+Math.max(Math.abs(t.y),Math.abs(r.y))+Math.max(Math.abs(t.z),Math.abs(r.z))),{min:i,max:n}}computeInitialHull(){const e=this.vertices,t=this.computeExtremes(),r=t.min,i=t.max;let n=0,s=0;for(let e=0;e<3;e++){const t=i[e].point.getComponent(e)-r[e].point.getComponent(e);t>n&&(n=t,s=e)}const o=r[s],a=i[s];let l,c;n=0,y.set(o.point,a.point);for(let t=0,r=this.vertices.length;t<r;t++){const r=e[t];if(r!==o&&r!==a){y.closestPointToPoint(r.point,!0,A);const e=A.distanceToSquared(r.point);e>n&&(n=e,l=r)}}n=-1,b.setFromCoplanarPoints(o.point,a.point,l.point);for(let t=0,r=this.vertices.length;t<r;t++){const r=e[t];if(r!==o&&r!==a&&r!==l){const e=Math.abs(b.distanceToPoint(r.point));e>n&&(n=e,c=r)}}const h=[];if(b.distanceToPoint(c.point)<0){h.push(T.create(o,a,l),T.create(c,a,o),T.create(c,l,a),T.create(c,o,l));for(let e=0;e<3;e++){const t=(e+1)%3;h[e+1].getEdge(2).setTwin(h[0].getEdge(t)),h[e+1].getEdge(1).setTwin(h[t+1].getEdge(0))}}else{h.push(T.create(o,l,a),T.create(c,o,a),T.create(c,a,l),T.create(c,l,o));for(let e=0;e<3;e++){const t=(e+1)%3;h[e+1].getEdge(2).setTwin(h[0].getEdge((3-e)%3)),h[e+1].getEdge(0).setTwin(h[t+1].getEdge(1))}}for(let e=0;e<4;e++)this.faces.push(h[e]);for(let t=0,r=e.length;t<r;t++){const r=e[t];if(r!==o&&r!==a&&r!==l&&r!==c){n=this.tolerance;let e=null;for(let t=0;t<4;t++){const i=this.faces[t].distanceToPoint(r.point);i>n&&(n=i,e=this.faces[t])}null!==e&&this.addVertexToFace(r,e)}}return this}reindexFaces(){const e=[];for(let t=0;t<this.faces.length;t++){const r=this.faces[t];0===r.mark&&e.push(r)}return this.faces=e,this}nextVertexToAdd(){if(!1===this.assigned.isEmpty()){let e,t=0;const r=this.assigned.first().face;let i=r.outside;do{const n=r.distanceToPoint(i.point);n>t&&(t=n,e=i),i=i.next}while(null!==i&&i.face===r);return e}}computeHorizon(e,t,r,i){let n;this.deleteFaceVertices(r),r.mark=1,n=null===t?t=r.getEdge(0):t.next;do{const t=n.twin,r=t.face;0===r.mark&&(r.distanceToPoint(e)>this.tolerance?this.computeHorizon(e,t,r,i):i.push(n)),n=n.next}while(n!==t);return this}addAdjoiningFace(e,t){const r=T.create(e,t.tail(),t.head());return this.faces.push(r),r.getEdge(-1).setTwin(t.twin),r.getEdge(0)}addNewFaces(e,t){this.newFaces=[];let r=null,i=null;for(let n=0;n<t.length;n++){const s=t[n],o=this.addAdjoiningFace(e,s);null===r?r=o:o.next.setTwin(i),this.newFaces.push(o.face),i=o}return r.next.setTwin(i),this}addVertexToHull(e){const t=[];return this.unassigned.clear(),this.removeVertexFromFace(e,e.face),this.computeHorizon(e.point,null,e.face,t),this.addNewFaces(e,t),this.resolveUnassignedPoints(this.newFaces),this}cleanup(){return this.assigned.clear(),this.unassigned.clear(),this.newFaces=[],this}compute(){let e;for(this.computeInitialHull();void 0!==(e=this.nextVertexToAdd());)this.addVertexToHull(e);return this.reindexFaces(),this.cleanup(),this}}class T{constructor(){this.normal=new e.Vector3,this.midpoint=new e.Vector3,this.area=0,this.constant=0,this.outside=null,this.mark=0,this.edge=null}static create(e,t,r){const i=new T,n=new S(e,i),s=new S(t,i),o=new S(r,i);return n.next=o.prev=s,s.next=n.prev=o,o.next=s.prev=n,i.edge=n,i.compute()}getEdge(e){let t=this.edge;for(;e>0;)t=t.next,e--;for(;e<0;)t=t.prev,e++;return t}compute(){const e=this.edge.tail(),t=this.edge.head(),r=this.edge.next.head();return w.set(e.point,t.point,r.point),w.getNormal(this.normal),w.getMidpoint(this.midpoint),this.area=w.getArea(),this.constant=this.normal.dot(this.midpoint),this}distanceToPoint(e){return this.normal.dot(e)-this.constant}}class S{constructor(e,t){this.vertex=e,this.prev=null,this.next=null,this.twin=null,this.face=t}head(){return this.vertex}tail(){return this.prev?this.prev.vertex:null}length(){const e=this.head(),t=this.tail();return null!==t?t.point.distanceTo(e.point):-1}lengthSquared(){const e=this.head(),t=this.tail();return null!==t?t.point.distanceToSquared(e.point):-1}setTwin(e){return this.twin=e,e.twin=this,this}}class C{constructor(e){this.point=e,this.prev=null,this.next=null,this.face=null}}class F{constructor(){this.head=null,this.tail=null}first(){return this.head}last(){return this.tail}clear(){return this.head=this.tail=null,this}insertBefore(e,t){return t.prev=e.prev,t.next=e,null===t.prev?this.head=t:t.prev.next=t,e.prev=t,this}insertAfter(e,t){return t.prev=e,t.next=e.next,null===t.next?this.tail=t:t.next.prev=t,e.next=t,this}append(e){return null===this.head?this.head=e:this.tail.next=e,e.prev=this.tail,e.next=null,this.tail=e,this}appendChain(e){for(null===this.head?this.head=e:this.tail.next=e,e.prev=this.tail;null!==e.next;)e=e.next;return this.tail=e,this}remove(e){return null===e.prev?this.head=e.next:e.prev.next=e.next,null===e.next?this.tail=e.prev:e.next.prev=e.prev,this}removeSubList(e,t){return null===e.prev?this.head=t.next:e.prev.next=t.next,null===t.next?this.tail=e.prev:t.next.prev=e.prev,this}isEmpty(){return null===this.head}}class E extends e.BufferGeometry{constructor(t=[]){super();const r=[],i=[];void 0===M&&console.error("THREE.ConvexGeometry: ConvexGeometry relies on ConvexHull");const n=(new M).setFromPoints(t).faces;for(let e=0;e<n.length;e++){const t=n[e];let s=t.edge;do{const e=s.head().point;r.push(e.x,e.y,e.z),i.push(t.normal.x,t.normal.y,t.normal.z),s=s.next}while(s!==t.edge)}this.setAttribute("position",new e.Float32BufferAttribute(r,3)),this.setAttribute("normal",new e.Float32BufferAttribute(i,3))}}var _=function(t,r){this.minSizeForBreak=t||1.4,this.smallDelta=r||1e-4,this.tempLine1=new e.Line3,this.tempPlane1=new e.Plane,this.tempPlane2=new e.Plane,this.tempPlane_Cut=new e.Plane,this.tempCM1=new e.Vector3,this.tempCM2=new e.Vector3,this.tempVector3=new e.Vector3,this.tempVector3_2=new e.Vector3,this.tempVector3_3=new e.Vector3,this.tempVector3_P0=new e.Vector3,this.tempVector3_P1=new e.Vector3,this.tempVector3_P2=new e.Vector3,this.tempVector3_N0=new e.Vector3,this.tempVector3_N1=new e.Vector3,this.tempVector3_AB=new e.Vector3,this.tempVector3_CB=new e.Vector3,this.tempResultObjects={object1:null,object2:null},this.segments=[];for(let e=0;e<900;e++)this.segments[e]=!1};_.prototype={constructor:_,prepareBreakableObject:function(e,t,r,i,n){e.geometry.isBufferGeometry||console.error("THREE.ConvexObjectBreaker.prepareBreakableObject(): Parameter object must have a BufferGeometry.");var s=e.userData;s.mass=t,s.velocity=r.clone(),s.angularVelocity=i.clone(),s.breakable=n},subdivideByImpact:function(e,t,r,i,n){var s=[],o=this.tempPlane1,a=this.tempPlane2;this.tempVector3.addVectors(t,r),o.setFromCoplanarPoints(t,e.position,this.tempVector3);var l=n+i,c=this;return function n(h,u,d,p){if(Math.random()<.05*p||p>l)s.push(h);else{var m=Math.PI;0===p?(a.normal.copy(o.normal),a.constant=o.constant):p<=i?(m=(d-u)*(.2+.6*Math.random())+u,c.tempVector3_2.copy(e.position).sub(t).applyAxisAngle(r,m).add(t),a.setFromCoplanarPoints(t,c.tempVector3,c.tempVector3_2)):(m=(.5*(1&p)+.2*(2-Math.random()))*Math.PI,c.tempVector3_2.copy(t).sub(h.position).applyAxisAngle(r,m).add(h.position),c.tempVector3_3.copy(r).add(h.position),a.setFromCoplanarPoints(h.position,c.tempVector3_3,c.tempVector3_2)),c.cutByPlane(h,a,c.tempResultObjects);var f=c.tempResultObjects.object1,g=c.tempResultObjects.object2;f&&n(f,u,m,p+1),g&&n(g,m,d,p+1)}}(e,0,2*Math.PI,0),s},cutByPlane:function(t,r,i){var n=t.geometry,s=n.attributes.position.array,o=n.attributes.normal.array,a=s.length/3,l=a/3,c=n.getIndex();function h(e,t){var r=3*e+t;return c?c[r]:r}c&&(l=(c=c.array).length/3);var u=[],d=[],p=this.smallDelta,m=a*a;for(let e=0;e<m;e++)this.segments[e]=!1;var f=this.tempVector3_P0,g=this.tempVector3_P1,v=this.tempVector3_N0,x=this.tempVector3_N1;for(let e=0;e<l-1;e++){var y=h(e,0),b=h(e,1),A=h(e,2);v.set(o[y],o[y]+1,o[y]+2);for(let t=e+1;t<l;t++){var w=h(t,0),M=h(t,1),T=h(t,2);x.set(o[w],o[w]+1,o[w]+2),1-v.dot(x)<p&&(y===w||y===M||y===T?b===w||b===M||b===T?(this.segments[y*a+b]=!0,this.segments[b*a+y]=!0):(this.segments[A*a+y]=!0,this.segments[y*a+A]=!0):b!==w&&b!==M&&b!==T||(this.segments[A*a+b]=!0,this.segments[b*a+A]=!0))}}var S=this.tempPlane_Cut;t.updateMatrix(),_.transformPlaneToLocalSpace(r,t.matrix,S);for(let t=0;t<l;t++){var C=h(t,0),F=h(t,1),P=h(t,2);for(let t=0;t<3;t++){var B=0===t?C:1===t?F:P,L=0===t?F:1===t?P:C;if(!this.segments[B*a+L]){this.segments[B*a+L]=!0,this.segments[L*a+B]=!0,f.set(s[3*B],s[3*B+1],s[3*B+2]),g.set(s[3*L],s[3*L+1],s[3*L+2]);var R=0;(N=S.distanceToPoint(f))>p?(R=2,d.push(f.clone())):N<-p?(R=1,u.push(f.clone())):(R=3,u.push(f.clone()),d.push(f.clone()));var N,D=0;if((N=S.distanceToPoint(g))>p?(D=2,d.push(g.clone())):N<-p?(D=1,u.push(g.clone())):(D=3,u.push(g.clone()),d.push(g.clone())),1===R&&2===D||2===R&&1===D){this.tempLine1.start.copy(f),this.tempLine1.end.copy(g);var I=new e.Vector3;if(void 0===(I=S.intersectLine(this.tempLine1,I)))return console.error("Internal error: segment does not intersect plane."),i.segmentedObject1=null,i.segmentedObject2=null,0;u.push(I),d.push(I.clone())}}}}var U=.5*t.userData.mass;this.tempCM1.set(0,0,0);var O=0,k=u.length;if(k>0){for(let e=0;e<k;e++)this.tempCM1.add(u[e]);this.tempCM1.divideScalar(k);for(let e=0;e<k;e++){(z=u[e]).sub(this.tempCM1),O=Math.max(O,z.x,z.y,z.z)}this.tempCM1.add(t.position)}this.tempCM2.set(0,0,0);var V=0,G=d.length;if(G>0){for(let e=0;e<G;e++)this.tempCM2.add(d[e]);this.tempCM2.divideScalar(G);for(let e=0;e<G;e++){var z;(z=d[e]).sub(this.tempCM2),V=Math.max(V,z.x,z.y,z.z)}this.tempCM2.add(t.position)}var H=null,j=null,W=0;return k>4&&((H=new e.Mesh(new E(u),t.material)).position.copy(this.tempCM1),H.quaternion.copy(t.quaternion),this.prepareBreakableObject(H,U,t.userData.velocity,t.userData.angularVelocity,2*O>this.minSizeForBreak),W++),G>4&&((j=new e.Mesh(new E(d),t.material)).position.copy(this.tempCM2),j.quaternion.copy(t.quaternion),this.prepareBreakableObject(j,U,t.userData.velocity,t.userData.angularVelocity,2*V>this.minSizeForBreak),W++),i.object1=H,i.object2=j,W}},_.transformFreeVector=function(e,t){var r=e.x,i=e.y,n=e.z,s=t.elements;return e.x=s[0]*r+s[4]*i+s[8]*n,e.y=s[1]*r+s[5]*i+s[9]*n,e.z=s[2]*r+s[6]*i+s[10]*n,e},_.transformFreeVectorInverse=function(e,t){var r=e.x,i=e.y,n=e.z,s=t.elements;return e.x=s[0]*r+s[1]*i+s[2]*n,e.y=s[4]*r+s[5]*i+s[6]*n,e.z=s[8]*r+s[9]*i+s[10]*n,e},_.transformTiedVectorInverse=function(e,t){var r=e.x,i=e.y,n=e.z,s=t.elements;return e.x=s[0]*r+s[1]*i+s[2]*n-s[12],e.y=s[4]*r+s[5]*i+s[6]*n-s[13],e.z=s[8]*r+s[9]*i+s[10]*n-s[14],e},_.transformPlaneToLocalSpace=function(){var t=new e.Vector3;return function(e,r,i){i.normal.copy(e.normal),i.constant=e.constant;var n=_.transformTiedVectorInverse(e.coplanarPoint(t),r);_.transformFreeVectorInverse(i.normal,r),i.constant=-n.dot(i.normal)}}();var P,B,L,R,N,D,I=function(){e.Object3D.call(this)};(I.prototype=Object.create(e.Object3D.prototype)).constructor=I,I.prototype.updateMatrixWorld=(P=new e.Vector3,B=new e.Quaternion,L=new e.Vector3,R=new e.Vector3,N=new e.Quaternion,D=new e.Vector3,function(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(null!==this.parent?(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorld.decompose(R,N,D),this.matrix.decompose(P,B,L),this.matrixWorld.compose(R,B,D)):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);for(let t=0,r=this.children.length;t<r;t++)this.children[t].updateMatrixWorld(e)});var U=function(t,r){e.Mesh.call(this,t,r),this.type="MorphAnimMesh",this.mixer=new e.AnimationMixer(this),this.activeAction=null};(U.prototype=Object.create(e.Mesh.prototype)).constructor=U,U.prototype.setDirectionForward=function(){this.mixer.timeScale=1},U.prototype.setDirectionBackward=function(){this.mixer.timeScale=-1},U.prototype.playAnimation=function(t,r){this.activeAction&&(this.activeAction.stop(),this.activeAction=null);var i=e.AnimationClip.findByName(this,t);if(!i)throw new Error("THREE.MorphAnimMesh: animations["+t+"] undefined in .playAnimation()");var n=this.mixer.clipAction(i);n.timeScale=i.tracks.length*r/i.duration,this.activeAction=n.play()},U.prototype.updateAnimation=function(e){this.mixer.update(e)},U.prototype.copy=function(t){return e.Mesh.prototype.copy.call(this,t),this.mixer=new e.AnimationMixer(this),this};var O=function(t,r){e.BufferGeometry.call(this);var i=[],n=[],s=[],o=[1,1,1],a=[1,1,0],l=new e.Vector3(0,1,0),c=new e.Vector3,h=new e.Vector3,u=new e.Quaternion,d=new e.Quaternion;d.setFromAxisAngle(l,Math.PI/2);var p=new e.Vector3,m=new e.Vector3;m.copy(t.getPointAt(0));var f=[new e.Vector3(-.225,0,0),new e.Vector3(0,-.05,0),new e.Vector3(0,-.175,0),new e.Vector3(0,-.05,0),new e.Vector3(.225,0,0),new e.Vector3(0,-.175,0)],g=2*Math.PI,v=5,x=[];for(let t=0;t<v;t++){var y=t/v*g;x.push(new e.Vector3(.06*Math.sin(y),.06*Math.cos(y),0))}v=6;var b=[];for(let t=0;t<v;t++){y=t/v*g;b.push(new e.Vector3(.025*Math.sin(y),.025*Math.cos(y),0))}var A=new e.Vector3,w=new e.Vector3;function M(e,t){w.set(0,0,-1).applyQuaternion(u);for(let r=0;r<e.length;r++)A.copy(e[r]),A.applyQuaternion(u),A.add(p),i.push(A.x,A.y,A.z),n.push(w.x,w.y,w.z),s.push(t[0],t[1],t[2]);w.set(0,0,1).applyQuaternion(u);for(let r=e.length-1;r>=0;r--)A.copy(e[r]),A.applyQuaternion(u),A.add(p),i.push(A.x,A.y,A.z),n.push(w.x,w.y,w.z),s.push(t[0],t[1],t[2])}var T=new e.Vector3,S=new e.Vector3,C=new e.Vector3,F=new e.Vector3,E=new e.Vector3,_=new e.Vector3,P=new e.Vector3,B=new e.Vector3;function L(e,t,r){for(let l=0,c=e.length;l<c;l++){var o=e[l],a=e[(l+1)%c];T.copy(o).add(t),T.applyQuaternion(u),T.add(p),S.copy(a).add(t),S.applyQuaternion(u),S.add(p),C.copy(a).add(t),C.applyQuaternion(d),C.add(m),F.copy(o).add(t),F.applyQuaternion(d),F.add(m),i.push(T.x,T.y,T.z),i.push(S.x,S.y,S.z),i.push(F.x,F.y,F.z),i.push(S.x,S.y,S.z),i.push(C.x,C.y,C.z),i.push(F.x,F.y,F.z),E.copy(o),E.applyQuaternion(u),E.normalize(),_.copy(a),_.applyQuaternion(u),_.normalize(),P.copy(a),P.applyQuaternion(d),P.normalize(),B.copy(o),B.applyQuaternion(d),B.normalize(),n.push(E.x,E.y,E.z),n.push(_.x,_.y,_.z),n.push(B.x,B.y,B.z),n.push(_.x,_.y,_.z),n.push(P.x,P.y,P.z),n.push(B.x,B.y,B.z),s.push(r[0],r[1],r[2]),s.push(r[0],r[1],r[2]),s.push(r[0],r[1],r[2]),s.push(r[0],r[1],r[2]),s.push(r[0],r[1],r[2]),s.push(r[0],r[1],r[2])}}var R=new e.Vector3;for(let e=1;e<=r;e++){p.copy(t.getPointAt(e/r)),l.set(0,1,0),c.subVectors(p,m).normalize(),h.crossVectors(l,c).normalize(),l.crossVectors(c,h);y=Math.atan2(c.x,c.z);u.setFromAxisAngle(l,y),e%2==0&&M(f,a),L(x,R.set(0,-.125,0),a),L(b,R.set(.2,0,0),o),L(b,R.set(-.2,0,0),o),m.copy(p),d.copy(u)}this.setAttribute("position",new e.BufferAttribute(new Float32Array(i),3)),this.setAttribute("normal",new e.BufferAttribute(new Float32Array(n),3)),this.setAttribute("color",new e.BufferAttribute(new Float32Array(s),3))};O.prototype=Object.create(e.BufferGeometry.prototype);var k=function(t,r){e.BufferGeometry.call(this);var i=[],n=[],s=new e.Quaternion,o=new e.Vector3(0,1,0),a=new e.Vector3,l=new e.Vector3,c=[new e.Vector3(0,.05,-.05),new e.Vector3(0,.05,.05),new e.Vector3(0,-.05,0)],h=[new e.Vector3(-.05,0,.05),new e.Vector3(-.05,0,-.05),new e.Vector3(.05,0,0)],u=[new e.Vector3(.05,0,-.05),new e.Vector3(.05,0,.05),new e.Vector3(-.05,0,0)],d=new e.Vector3,p=new e.Vector3,m=new e.Vector3,f=new e.Vector3,g=new e.Vector3,v=new e.Vector3,x=new e.Vector3,y=new e.Vector3;function b(e,t,r){for(let l=0,c=e.length;l<c;l++){var o=e[l],a=e[(l+1)%c];d.copy(o),d.applyQuaternion(s),d.add(t),p.copy(a),p.applyQuaternion(s),p.add(t),m.copy(a),m.applyQuaternion(s),m.add(r),f.copy(o),f.applyQuaternion(s),f.add(r),i.push(d.x,d.y,d.z),i.push(p.x,p.y,p.z),i.push(f.x,f.y,f.z),i.push(p.x,p.y,p.z),i.push(m.x,m.y,m.z),i.push(f.x,f.y,f.z),g.copy(o),g.applyQuaternion(s),g.normalize(),v.copy(a),v.applyQuaternion(s),v.normalize(),x.copy(a),x.applyQuaternion(s),x.normalize(),y.copy(o),y.applyQuaternion(s),y.normalize(),n.push(g.x,g.y,g.z),n.push(v.x,v.y,v.z),n.push(y.x,y.y,y.z),n.push(v.x,v.y,v.z),n.push(x.x,x.y,x.z),n.push(y.x,y.y,y.z)}}var A=new e.Vector3,w=new e.Vector3;for(let e=1;e<=r;e++){a.copy(t.getPointAt(e/r)),l.copy(t.getTangentAt(e/r));var M=Math.atan2(l.x,l.z);s.setFromAxisAngle(o,M),a.y>10?(A.set(-.75,-.35,0),A.applyQuaternion(s),A.add(a),w.set(.75,-.35,0),w.applyQuaternion(s),w.add(a),b(c,A,w),A.set(-.7,-.3,0),A.applyQuaternion(s),A.add(a),w.set(-.7,-a.y,0),w.applyQuaternion(s),w.add(a),b(h,A,w),A.set(.7,-.3,0),A.applyQuaternion(s),A.add(a),w.set(.7,-a.y,0),w.applyQuaternion(s),w.add(a),b(u,A,w)):(A.set(0,-.2,0),A.applyQuaternion(s),A.add(a),w.set(0,-a.y,0),w.applyQuaternion(s),w.add(a),b(u,A,w))}this.setAttribute("position",new e.BufferAttribute(new Float32Array(i),3)),this.setAttribute("normal",new e.BufferAttribute(new Float32Array(n),3))};k.prototype=Object.create(e.BufferGeometry.prototype);var V=function(t,r){e.BufferGeometry.call(this);var i=[],n=new e.Vector3(0,1,0),s=new e.Vector3,o=new e.Quaternion,a=new e.Quaternion;a.setFromAxisAngle(n,Math.PI/2);var l=new e.Vector3,c=new e.Vector3;c.copy(t.getPointAt(0)),c.y=0;var h=new e.Vector3,u=new e.Vector3,d=new e.Vector3,p=new e.Vector3;for(let e=1;e<=r;e++){l.copy(t.getPointAt(e/r)),l.y=0,s.subVectors(l,c);var m=Math.atan2(s.x,s.z);o.setFromAxisAngle(n,m),h.set(-.3,0,0),h.applyQuaternion(o),h.add(l),u.set(.3,0,0),u.applyQuaternion(o),u.add(l),d.set(.3,0,0),d.applyQuaternion(a),d.add(c),p.set(-.3,0,0),p.applyQuaternion(a),p.add(c),i.push(h.x,h.y,h.z),i.push(u.x,u.y,u.z),i.push(p.x,p.y,p.z),i.push(u.x,u.y,u.z),i.push(d.x,d.y,d.z),i.push(p.x,p.y,p.z),c.copy(l),a.copy(o)}this.setAttribute("position",new e.BufferAttribute(new Float32Array(i),3))};V.prototype=Object.create(e.BufferGeometry.prototype);var G=function(){e.BufferGeometry.call(this);var t=[];for(let e=0;e<100;e++){var r=800*Math.random()-400,i=50*Math.random()+50,n=800*Math.random()-400,s=40*Math.random()+20;t.push(r-s,i,n-s),t.push(r+s,i,n-s),t.push(r-s,i,n+s),t.push(r+s,i,n-s),t.push(r+s,i,n+s),t.push(r-s,i,n+s)}this.setAttribute("position",new e.BufferAttribute(new Float32Array(t),3))};G.prototype=Object.create(e.BufferGeometry.prototype);var z=function(t){e.BufferGeometry.call(this);var r=[],i=[],n=new e.Raycaster;n.ray.direction.set(0,-1,0);for(let e=0;e<2e3;e++){var s=500*Math.random()-250,o=500*Math.random()-250;n.ray.origin.set(s,50,o);var a=n.intersectObject(t);if(0!==a.length){var l=a[0].point.y,c=5*Math.random()+.5,h=Math.random()*Math.PI*2;r.push(s+Math.sin(h),l,o+Math.cos(h)),r.push(s,l+c,o),r.push(s+Math.sin(h+Math.PI),l,o+Math.cos(h+Math.PI)),h+=Math.PI/2,r.push(s+Math.sin(h),l,o+Math.cos(h)),r.push(s,l+c,o),r.push(s+Math.sin(h+Math.PI),l,o+Math.cos(h+Math.PI));var u=.1*Math.random();for(let e=0;e<6;e++)i.push(.2+u,.4+u,0)}}this.setAttribute("position",new e.BufferAttribute(new Float32Array(r),3)),this.setAttribute("color",new e.BufferAttribute(new Float32Array(i),3))};z.prototype=Object.create(e.BufferGeometry.prototype);function H(){!1===document.hidden&&this.reset()}let W,X;var Q=function(t,r,i){var n=this;this.volume=t,r=r||0,Object.defineProperty(this,"index",{get:function(){return r},set:function(e){return r=e,n.geometryNeedsUpdate=!0,r}}),this.axis=i||"z",this.canvas=document.createElement("canvas"),this.canvasBuffer=document.createElement("canvas"),this.updateGeometry();var s=new e.Texture(this.canvas);s.minFilter=e.LinearFilter,s.wrapS=s.wrapT=e.ClampToEdgeWrapping;var o=new e.MeshBasicMaterial({map:s,side:e.DoubleSide,transparent:!0});this.mesh=new e.Mesh(this.geometry,o),this.mesh.matrixAutoUpdate=!1,this.geometryNeedsUpdate=!0,this.repaint()};Q.prototype={constructor:Q,repaint:function(){this.geometryNeedsUpdate&&this.updateGeometry();var e=this.iLength,t=this.jLength,r=this.sliceAccess,i=this.volume,n=this.canvasBuffer,s=this.ctxBuffer,o=s.getImageData(0,0,e,t),a=o.data,l=i.data,c=i.upperThreshold,h=i.lowerThreshold,u=i.windowLow,d=i.windowHigh,p=0;if("label"===i.dataType)for(let i=0;i<t;i++)for(let t=0;t<e;t++){var m=l[r(t,i)];m=m>=this.colorMap.length?m%this.colorMap.length+1:m;var f=this.colorMap[m];a[4*p]=f>>24&255,a[4*p+1]=f>>16&255,a[4*p+2]=f>>8&255,a[4*p+3]=255&f,p++}else for(let i=0;i<t;i++)for(let t=0;t<e;t++){var g=l[r(t,i)],v=255;v=c>=g&&h<=g?v:0,g=(g=Math.floor(255*(g-u)/(d-u)))>255?255:g<0?0:0|g,a[4*p]=g,a[4*p+1]=g,a[4*p+2]=g,a[4*p+3]=v,p++}s.putImageData(o,0,0),this.ctx.drawImage(n,0,0,e,t,0,0,this.canvas.width,this.canvas.height),this.mesh.material.map.needsUpdate=!0},updateGeometry:function(){var t=this.volume.extractPerpendicularPlane(this.axis,this.index);this.sliceAccess=t.sliceAccess,this.jLength=t.jLength,this.iLength=t.iLength,this.matrix=t.matrix,this.canvas.width=t.planeWidth,this.canvas.height=t.planeHeight,this.canvasBuffer.width=this.iLength,this.canvasBuffer.height=this.jLength,this.ctx=this.canvas.getContext("2d"),this.ctxBuffer=this.canvasBuffer.getContext("2d"),this.geometry&&this.geometry.dispose(),this.geometry=new e.PlaneGeometry(t.planeWidth,t.planeHeight),this.mesh&&(this.mesh.geometry=this.geometry,this.mesh.matrix.identity(),this.mesh.applyMatrix4(this.matrix)),this.geometryNeedsUpdate=!1}};var Y=function(t,r,i,n,s){if(arguments.length>0){switch(this.xLength=Number(t)||1,this.yLength=Number(r)||1,this.zLength=Number(i)||1,n){case"Uint8":case"uint8":case"uchar":case"unsigned char":case"uint8_t":this.data=new Uint8Array(s);break;case"Int8":case"int8":case"signed char":case"int8_t":this.data=new Int8Array(s);break;case"Int16":case"int16":case"short":case"short int":case"signed short":case"signed short int":case"int16_t":this.data=new Int16Array(s);break;case"Uint16":case"uint16":case"ushort":case"unsigned short":case"unsigned short int":case"uint16_t":this.data=new Uint16Array(s);break;case"Int32":case"int32":case"int":case"signed int":case"int32_t":this.data=new Int32Array(s);break;case"Uint32":case"uint32":case"uint":case"unsigned int":case"uint32_t":this.data=new Uint32Array(s);break;case"longlong":case"long long":case"long long int":case"signed long long":case"signed long long int":case"int64":case"int64_t":case"ulonglong":case"unsigned long long":case"unsigned long long int":case"uint64":case"uint64_t":throw"Error in Volume constructor : this type is not supported in JavaScript";case"Float32":case"float32":case"float":this.data=new Float32Array(s);break;case"Float64":case"float64":case"double":this.data=new Float64Array(s);break;default:this.data=new Uint8Array(s)}if(this.data.length!==this.xLength*this.yLength*this.zLength)throw"Error in Volume constructor, lengths are not matching arrayBuffer size"}this.spacing=[1,1,1],this.offset=[0,0,0],this.matrix=new e.Matrix3,this.matrix.identity();var o=-1/0;Object.defineProperty(this,"lowerThreshold",{get:function(){return o},set:function(e){o=e,this.sliceList.forEach((function(e){e.geometryNeedsUpdate=!0}))}});var a=1/0;Object.defineProperty(this,"upperThreshold",{get:function(){return a},set:function(e){a=e,this.sliceList.forEach((function(e){e.geometryNeedsUpdate=!0}))}}),this.sliceList=[]};Y.prototype={constructor:Y,getData:function(e,t,r){return this.data[r*this.xLength*this.yLength+t*this.xLength+e]},access:function(e,t,r){return r*this.xLength*this.yLength+t*this.xLength+e},reverseAccess:function(e){var t=Math.floor(e/(this.yLength*this.xLength)),r=Math.floor((e-t*this.yLength*this.xLength)/this.xLength);return[e-t*this.yLength*this.xLength-r*this.xLength,r,t]},map:function(e,t){var r=this.data.length;t=t||this;for(let i=0;i<r;i++)this.data[i]=e.call(t,this.data[i],i,this.data);return this},extractPerpendicularPlane:function(t,r){var i,n,s,o,a,l,c,h,u=(new e.Matrix4).identity(),d=this,p=new e.Vector3,m=new e.Vector3,f=new e.Vector3,g=new e.Vector3(this.xLength,this.yLength,this.zLength);switch(t){case"x":p.set(1,0,0),m.set(0,0,-1),f.set(0,-1,0),a=this.spacing[2],l=this.spacing[1],h=new e.Vector3(r,0,0),u.multiply((new e.Matrix4).makeRotationY(Math.PI/2)),c=(d.RASDimensions[0]-1)/2,u.setPosition(new e.Vector3(r-c,0,0));break;case"y":p.set(0,1,0),m.set(1,0,0),f.set(0,0,1),a=this.spacing[0],l=this.spacing[2],h=new e.Vector3(0,r,0),u.multiply((new e.Matrix4).makeRotationX(-Math.PI/2)),c=(d.RASDimensions[1]-1)/2,u.setPosition(new e.Vector3(0,r-c,0));break;case"z":default:p.set(0,0,1),m.set(1,0,0),f.set(0,-1,0),a=this.spacing[0],l=this.spacing[1],h=new e.Vector3(0,0,r),c=(d.RASDimensions[2]-1)/2,u.setPosition(new e.Vector3(0,0,r-c))}m.applyMatrix4(d.inverseMatrix).normalize(),m.argVar="i",f.applyMatrix4(d.inverseMatrix).normalize(),f.argVar="j",p.applyMatrix4(d.inverseMatrix).normalize(),i=Math.floor(Math.abs(m.dot(g))),n=Math.floor(Math.abs(f.dot(g))),s=Math.abs(i*a),o=Math.abs(n*l),h=Math.abs(Math.round(h.applyMatrix4(d.inverseMatrix).dot(p)));var v=[new e.Vector3(1,0,0),new e.Vector3(0,1,0),new e.Vector3(0,0,1)],x=[m,f,p].find((function(e){return Math.abs(e.dot(v[0]))>.9})),y=[m,f,p].find((function(e){return Math.abs(e.dot(v[1]))>.9})),b=[m,f,p].find((function(e){return Math.abs(e.dot(v[2]))>.9}));return{iLength:i,jLength:n,sliceAccess:function(e,t){var r=x===p?h:"i"===x.argVar?e:t,i=y===p?h:"i"===y.argVar?e:t,n=b===p?h:"i"===b.argVar?e:t,s=x.dot(v[0])>0?r:d.xLength-1-r,o=y.dot(v[1])>0?i:d.yLength-1-i,a=b.dot(v[2])>0?n:d.zLength-1-n;return d.access(s,o,a)},matrix:u,planeWidth:s,planeHeight:o}},extractSlice:function(e,t){var r=new Q(this,t,e);return this.sliceList.push(r),r},repaintAllSlices:function(){return this.sliceList.forEach((function(e){e.repaint()})),this},computeMinMax:function(){var e=1/0,t=-1/0,r=this.data.length,i=0;for(i=0;i<r;i++)if(!isNaN(this.data[i])){var n=this.data[i];e=Math.min(e,n),t=Math.max(t,n)}return this.min=e,this.max=t,[e,t]}};class K extends e.Object3D{constructor(e=document.createElement("div")){super(),this.isCSS2DObject=!0,this.element=e,this.element.style.position="absolute",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.addEventListener("removed",(function(){this.traverse((function(e){e.element instanceof Element&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))}))}copy(e,t){return super.copy(e,t),this.element=e.element.cloneNode(!0),this}}const q=new e.Vector3,J=new e.Matrix4,Z=new e.Matrix4,$=new e.Vector3,ee=new e.Vector3;const te={UniformBuffer:"uniform-buffer",StorageBuffer:"storage-buffer",ReadonlyStorageBuffer:"readonly-storage-buffer",Sampler:"sampler",ComparisonSampler:"comparison-sampler",SampledTexture:"sampled-texture",MultisampledTexture:"multisampled-texture",ReadonlyStorageTexture:"readonly-storage-texture",WriteonlyStorageTexture:"writeonly-storage-texture"},re={OneD:"1d",TwoD:"2d",TwoDArray:"2d-array",Cube:"cube",CubeArray:"cube-array",ThreeD:"3d"};class ie{constructor(e,t=null){this.name=e,this.value=t,this.boundary=0,this.itemSize=0,this.offset=0}setValue(e){this.value=e}getValue(){return this.value}}class ne extends ie{constructor(e,t=0){super(e,t),this.boundary=4,this.itemSize=1,Object.defineProperty(this,"isFloatUniform",{value:!0})}}class se extends ie{constructor(t,r=new e.Vector2){super(t,r),this.boundary=8,this.itemSize=2,Object.defineProperty(this,"isVector2Uniform",{value:!0})}}class oe extends ie{constructor(t,r=new e.Vector3){super(t,r),this.boundary=16,this.itemSize=3,Object.defineProperty(this,"isVector3Uniform",{value:!0})}}class ae extends ie{constructor(t,r=new e.Vector4){super(t,r),this.boundary=16,this.itemSize=4,Object.defineProperty(this,"isVector4Uniform",{value:!0})}}class le extends ie{constructor(t,r=new e.Color){super(t,r),this.boundary=16,this.itemSize=3,Object.defineProperty(this,"isColorUniform",{value:!0})}}class ce extends ie{constructor(t,r=new e.Matrix3){super(t,r),this.boundary=48,this.itemSize=12,Object.defineProperty(this,"isMatrix3Uniform",{value:!0})}}class he extends ie{constructor(t,r=new e.Matrix4){super(t,r),this.boundary=64,this.itemSize=16,Object.defineProperty(this,"isMatrix4Uniform",{value:!0})}}class ue extends class{constructor(e=""){this.name=e,this.visibility=null,this.type=null,this.isShared=!1}setVisibility(e){this.visibility=e}}{constructor(e,t){super(e),this.texture=t,this.dimension=re.TwoD,this.type=te.SampledTexture,this.visibility=GPUShaderStage.FRAGMENT,this.textureGPU=null,Object.defineProperty(this,"isSampledTexture",{value:!0})}}var de=function(t){e.Object3D.call(this),this.element=t||document.createElement("div"),this.element.style.position="absolute",this.element.style.pointerEvents="auto",this.addEventListener("removed",(function(){this.traverse((function(e){e.element instanceof Element&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))}))};de.prototype=Object.assign(Object.create(e.Object3D.prototype),{constructor:de,copy:function(t,r){return e.Object3D.prototype.copy.call(this,t,r),this.element=t.element.cloneNode(!0),this}});var pe=function(e){de.call(this,e)};(pe.prototype=Object.create(de.prototype)).constructor=pe;var me=function(){this.id=0,this.object=null,this.z=0,this.renderOrder=0},fe=function(){this.id=0,this.v1=new ge,this.v2=new ge,this.v3=new ge,this.normalModel=new e.Vector3,this.vertexNormalsModel=[new e.Vector3,new e.Vector3,new e.Vector3],this.vertexNormalsLength=0,this.color=new e.Color,this.material=null,this.uvs=[new e.Vector2,new e.Vector2,new e.Vector2],this.z=0,this.renderOrder=0},ge=function(){this.position=new e.Vector3,this.positionWorld=new e.Vector3,this.positionScreen=new e.Vector4,this.visible=!0};ge.prototype.copy=function(e){this.positionWorld.copy(e.positionWorld),this.positionScreen.copy(e.positionScreen)};var ve=function(){this.id=0,this.v1=new ge,this.v2=new ge,this.vertexColors=[new e.Color,new e.Color],this.material=null,this.z=0,this.renderOrder=0},xe=function(){this.id=0,this.object=null,this.x=0,this.y=0,this.z=0,this.rotation=0,this.scale=new e.Vector2,this.material=null,this.renderOrder=0},ye=function(){var t,r,i,n,s,o,a,l,c,h,u,d=[],p=0,m=[],f=0,g=[],v=0,x=[],y=0,b=[],A=0,w={objects:[],lights:[],elements:[]},M=new e.Vector3,T=new e.Vector4,S=new e.Box3(new e.Vector3(-1,-1,-1),new e.Vector3(1,1,1)),C=new e.Box3,F=new Array(3),E=new e.Matrix4,_=new e.Matrix4,P=new e.Matrix4,B=new e.Frustum;this.projectVector=function(e,t){console.warn("THREE.Projector: .projectVector() is now vector.project()."),e.project(t)},this.unprojectVector=function(e,t){console.warn("THREE.Projector: .unprojectVector() is now vector.unproject()."),e.unproject(t)},this.pickingRay=function(){console.error("THREE.Projector: .pickingRay() is now raycaster.setFromCamera().")};var L=new function(){var t=[],r=[],o=[],c=null,h=new e.Matrix3;function d(e){var t=e.position,r=e.positionWorld,i=e.positionScreen;r.copy(t).applyMatrix4(u),i.copy(r).applyMatrix4(_);var n=1/i.w;i.x*=n,i.y*=n,i.z*=n,e.visible=i.x>=-1&&i.x<=1&&i.y>=-1&&i.y<=1&&i.z>=-1&&i.z<=1}function p(e,t,r){return!0===e.visible||!0===t.visible||!0===r.visible||(F[0]=e.positionScreen,F[1]=t.positionScreen,F[2]=r.positionScreen,S.intersectsBox(C.setFromPoints(F)))}function g(e,t,r){return(r.positionScreen.x-e.positionScreen.x)*(t.positionScreen.y-e.positionScreen.y)-(r.positionScreen.y-e.positionScreen.y)*(t.positionScreen.x-e.positionScreen.x)<0}return{setObject:function(e){c=e,h.getNormalMatrix(c.matrixWorld),t.length=0,r.length=0,o.length=0},projectVertex:d,checkTriangleVisibility:p,checkBackfaceCulling:g,pushVertex:function(e,t,r){(i=function(){if(n===f){var e=new ge;return m.push(e),f++,n++,e}return m[n++]}()).position.set(e,t,r),d(i)},pushNormal:function(e,r,i){t.push(e,r,i)},pushColor:function(e,t,i){r.push(e,t,i)},pushUv:function(e,t){o.push(e,t)},pushLine:function(e,t){var i,n,s,o,h,u,d,p,f=m[e],g=m[t];f.positionScreen.copy(f.position).applyMatrix4(P),g.positionScreen.copy(g.position).applyMatrix4(P),!0==(i=f.positionScreen,n=g.positionScreen,s=0,o=1,h=i.z+i.w,u=n.z+n.w,d=-i.z+i.w,p=-n.z+n.w,h>=0&&u>=0&&d>=0&&p>=0||!(h<0&&u<0||d<0&&p<0)&&(h<0?s=Math.max(s,h/(h-u)):u<0&&(o=Math.min(o,h/(h-u))),d<0?s=Math.max(s,d/(d-p)):p<0&&(o=Math.min(o,d/(d-p))),!(o<s||(i.lerp(n,s),n.lerp(i,1-o),0))))&&(f.positionScreen.multiplyScalar(1/f.positionScreen.w),g.positionScreen.multiplyScalar(1/g.positionScreen.w),(a=function(){if(l===y){var e=new ve;return x.push(e),y++,l++,e}return x[l++]}()).id=c.id,a.v1.copy(f),a.v2.copy(g),a.z=Math.max(f.positionScreen.z,g.positionScreen.z),a.renderOrder=c.renderOrder,a.material=c.material,c.material.vertexColors&&(a.vertexColors[0].fromArray(r,3*e),a.vertexColors[1].fromArray(r,3*t)),w.elements.push(a))},pushTriangle:function(i,n,a,l){var u=m[i],d=m[n],f=m[a];if(!1!==p(u,d,f)&&(l.side===e.DoubleSide||!0===g(u,d,f))){(s=I()).id=c.id,s.v1.copy(u),s.v2.copy(d),s.v3.copy(f),s.z=(u.positionScreen.z+d.positionScreen.z+f.positionScreen.z)/3,s.renderOrder=c.renderOrder,M.subVectors(f.position,d.position),T.subVectors(u.position,d.position),M.cross(T),s.normalModel.copy(M),s.normalModel.applyMatrix3(h).normalize();for(let e=0;e<3;e++){var v=s.vertexNormalsModel[e];v.fromArray(t,3*arguments[e]),v.applyMatrix3(h).normalize();var x=s.uvs[e];x.fromArray(o,2*arguments[e])}s.vertexNormalsLength=3,s.material=l,l.vertexColors&&s.color.fromArray(r,3*i),w.elements.push(s)}}}};function R(e){if(!1!==e.visible){if(e.isLight)w.lights.push(e);else if(e.isMesh||e.isLine||e.isPoints){if(!1===e.material.visible)return;if(!0===e.frustumCulled&&!1===B.intersectsObject(e))return;N(e)}else if(e.isSprite){if(!1===e.material.visible)return;if(!0===e.frustumCulled&&!1===B.intersectsSprite(e))return;N(e)}var t=e.children;for(let e=0,r=t.length;e<r;e++)R(t[e])}}function N(e){(t=function(){if(r===p){var e=new me;return d.push(e),p++,r++,e}return d[r++]}()).id=e.id,t.object=e,M.setFromMatrixPosition(e.matrixWorld),M.applyMatrix4(_),t.z=M.z,t.renderOrder=e.renderOrder,w.objects.push(t)}function D(e,t,r){var i=1/e.w;e.z*=i,e.z>=-1&&e.z<=1&&((c=function(){if(h===A){var e=new xe;return b.push(e),A++,h++,e}return b[h++]}()).id=t.id,c.x=e.x*i,c.y=e.y*i,c.z=e.z,c.renderOrder=t.renderOrder,c.object=t,c.rotation=t.rotation,c.scale.x=t.scale.x*Math.abs(c.x-(e.x+r.projectionMatrix.elements[0])/(e.w+r.projectionMatrix.elements[12])),c.scale.y=t.scale.y*Math.abs(c.y-(e.y+r.projectionMatrix.elements[5])/(e.w+r.projectionMatrix.elements[13])),c.material=t.material,w.elements.push(c))}function I(){if(o===v){var e=new fe;return g.push(e),v++,o++,e}return g[o++]}function U(e,t){return e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id!==t.id?e.id-t.id:0}this.projectScene=function(e,t,i,s){o=0,l=0,h=0,w.elements.length=0,!0===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),E.copy(t.matrixWorldInverse),_.multiplyMatrices(t.projectionMatrix,E),B.setFromProjectionMatrix(_),r=0,w.objects.length=0,w.lights.length=0,R(e),!0===i&&w.objects.sort(U);var a=w.objects;for(let e=0,r=a.length;e<r;e++){var c=a[e].object,d=c.geometry;if(L.setObject(c),u=c.matrixWorld,n=0,c.isMesh){if(d.isBufferGeometry){var p=c.material,m=Array.isArray(p),f=d.attributes,g=d.groups;if(void 0===f.position)continue;for(let e=0,t=(G=f.position.array).length;e<t;e+=3){var v=G[e],x=G[e+1],y=G[e+2];if(!0===p.morphTargets){var b=d.morphAttributes.position,A=d.morphTargetsRelative,M=c.morphTargetInfluences;for(let t=0,r=b.length;t<r;t++){var S=M[t];if(0!==S){var C=b[t];A?(v+=C.getX(e/3)*S,x+=C.getY(e/3)*S,y+=C.getZ(e/3)*S):(v+=(C.getX(e/3)-G[e])*S,x+=(C.getY(e/3)-G[e+1])*S,y+=(C.getZ(e/3)-G[e+2])*S)}}}L.pushVertex(v,x,y)}if(void 0!==f.normal){var F=f.normal.array;for(let e=0,t=F.length;e<t;e+=3)L.pushNormal(F[e],F[e+1],F[e+2])}if(void 0!==f.color)for(let e=0,t=(k=f.color.array).length;e<t;e+=3)L.pushColor(k[e],k[e+1],k[e+2]);if(void 0!==f.uv){var N=f.uv.array;for(let e=0,t=N.length;e<t;e+=2)L.pushUv(N[e],N[e+1])}if(null!==d.index){var I=d.index.array;if(g.length>0)for(let e=0;e<g.length;e++){var O=g[e];if(void 0!==(p=!0===m?c.material[O.materialIndex]:c.material))for(let e=O.start,t=O.start+O.count;e<t;e+=3)L.pushTriangle(I[e],I[e+1],I[e+2],p)}else for(let e=0,t=I.length;e<t;e+=3)L.pushTriangle(I[e],I[e+1],I[e+2],p)}else if(g.length>0)for(let e=0;e<g.length;e++){O=g[e];if(void 0!==(p=!0===m?c.material[O.materialIndex]:c.material))for(let e=O.start,t=O.start+O.count;e<t;e+=3)L.pushTriangle(e,e+1,e+2,p)}else for(let e=0,t=G.length/3;e<t;e+=3)L.pushTriangle(e,e+1,e+2,p)}else if(d.isGeometry)return void console.error("THREE.Projector no longer supports Geometry. Use THREE.BufferGeometry instead.")}else if(c.isLine){if(P.multiplyMatrices(_,u),d.isBufferGeometry){if(void 0!==(f=d.attributes).position){var k;for(let e=0,t=(G=f.position.array).length;e<t;e+=3)L.pushVertex(G[e],G[e+1],G[e+2]);if(void 0!==f.color)for(let e=0,t=(k=f.color.array).length;e<t;e+=3)L.pushColor(k[e],k[e+1],k[e+2]);if(null!==d.index){for(let e=0,t=(I=d.index.array).length;e<t;e+=2)L.pushLine(I[e],I[e+1])}else{var V=c.isLineSegments?2:1;for(let e=0,t=G.length/3-1;e<t;e+=V)L.pushLine(e,e+1)}}}else if(d.isGeometry)return void console.error("THREE.Projector no longer supports Geometry. Use THREE.BufferGeometry instead.")}else if(c.isPoints){if(P.multiplyMatrices(_,u),d.isGeometry)return void console.error("THREE.Projector no longer supports Geometry. Use THREE.BufferGeometry instead.");var G;if(d.isBufferGeometry&&void 0!==(f=d.attributes).position)for(let e=0,r=(G=f.position.array).length;e<r;e+=3)T.set(G[e],G[e+1],G[e+2],1),T.applyMatrix4(P),D(T,c,t)}else c.isSprite&&(c.modelViewMatrix.multiplyMatrices(t.matrixWorldInverse,c.matrixWorld),T.set(u.elements[12],u.elements[13],u.elements[14],1),T.applyMatrix4(_),D(T,c,t))}return!0===s&&w.elements.sort(U),w}},be=function(t){e.Object3D.call(this),this.node=t};(be.prototype=Object.create(e.Object3D.prototype)).constructor=be;const Ae=(t=1)=>{const r=new Float32Array(4096*t*4),i=new e.DataTexture(r,1024,4*t,e.RGBAFormat,e.FloatType);return i.wrapS=e.RepeatWrapping,i.wrapT=e.RepeatWrapping,i.magFilter=e.NearestFilter,i.needsUpdate=!0,i},we=(e,t,r=0)=>{const i=Math.floor(1024);t.arcLengthDivisions=i/2,t.updateArcLengths();const n=t.getSpacedPoints(i),s=t.computeFrenetFrames(i,!0);for(let t=0;t<i;t++){const i=Math.floor(t/1024),o=t%1024;let a=n[t];Me(e,o,a.x,a.y,a.z,0+i+4*r),a=s.tangents[t],Me(e,o,a.x,a.y,a.z,1+i+4*r),a=s.normals[t],Me(e,o,a.x,a.y,a.z,2+i+4*r),a=s.binormals[t],Me(e,o,a.x,a.y,a.z,3+i+4*r)}e.needsUpdate=!0},Me=(e,t,r,i,n,s)=>{const o=e.image,{data:a}=o,l=4096*s;a[4*t+l+0]=r,a[4*t+l+1]=i,a[4*t+l+2]=n,a[4*t+l+3]=1},Te=e=>({spineTexture:{value:e},pathOffset:{type:"f",value:0},pathSegment:{type:"f",value:1},spineOffset:{type:"f",value:161},spineLength:{type:"f",value:400},flow:{type:"i",value:1}});function Se(e,t,r=1){e.__ok||(e.__ok=!0,e.onBeforeCompile=e=>{if(e.__modified)return;e.__modified=!0,Object.assign(e.uniforms,t);const i=`\n\t\tuniform sampler2D spineTexture;\n\t\tuniform float pathOffset;\n\t\tuniform float pathSegment;\n\t\tuniform float spineOffset;\n\t\tuniform float spineLength;\n\t\tuniform int flow;\n\n\t\tfloat textureLayers = ${4*r}.;\n\t\tfloat textureStacks = 1.;\n\n\t\t${e.vertexShader}\n\t\t`.replace("#include <beginnormal_vertex>","").replace("#include <defaultnormal_vertex>","").replace("#include <begin_vertex>","").replace(/void\s*main\s*\(\)\s*\{/,"\n void main() {\n #include <beginnormal_vertex>\n\n vec4 worldPos = modelMatrix * vec4(position, 1.);\n\n bool bend = flow > 0;\n float xWeight = bend ? 0. : 1.;\n\n #ifdef USE_INSTANCING\n float pathOffsetFromInstanceMatrix = instanceMatrix[3][2];\n float spineLengthFromInstanceMatrix = instanceMatrix[3][0];\n float spinePortion = bend ? (worldPos.x + spineOffset) / spineLengthFromInstanceMatrix : 0.;\n float mt = (spinePortion * pathSegment + pathOffset + pathOffsetFromInstanceMatrix)*textureStacks;\n #else\n float spinePortion = bend ? (worldPos.x + spineOffset) / spineLength : 0.;\n float mt = (spinePortion * pathSegment + pathOffset)*textureStacks;\n #endif\n\n mt = mod(mt, textureStacks);\n float rowOffset = floor(mt);\n\n #ifdef USE_INSTANCING\n rowOffset += instanceMatrix[3][1] * 4.;\n #endif\n\n vec3 spinePos = texture2D(spineTexture, vec2(mt, (0. + rowOffset + 0.5) / textureLayers)).xyz;\n vec3 a = texture2D(spineTexture, vec2(mt, (1. + rowOffset + 0.5) / textureLayers)).xyz;\n vec3 b = texture2D(spineTexture, vec2(mt, (2. + rowOffset + 0.5) / textureLayers)).xyz;\n vec3 c = texture2D(spineTexture, vec2(mt, (3. + rowOffset + 0.5) / textureLayers)).xyz;\n mat3 basis = mat3(a, b, c);\n\n vec3 transformed = basis\n * vec3(worldPos.x * xWeight, worldPos.y * 1., worldPos.z * 1.)\n + spinePos;\n\n vec3 transformedNormal = normalMatrix * (basis * objectNormal);\n\t\t\t").replace("#include <project_vertex>","vec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\n\t\t\t\tgl_Position = projectionMatrix * mvPosition;");e.vertexShader=i})}class Ce{constructor(t,r=1){p.default(this,"curveArray",void 0),p.default(this,"curveLengthArray",void 0),p.default(this,"object3D",void 0),p.default(this,"splineTexure",void 0),p.default(this,"uniforms",void 0);const i=t.clone(),n=Ae(r),s=Te(n);i.traverse((t=>{(t instanceof e.Mesh||t instanceof e.InstancedMesh)&&(t.material=t.material.clone(),Se(t.material,s,r))})),this.curveArray=new Array(r),this.curveLengthArray=new Array(r),this.object3D=i,this.splineTexure=n,this.uniforms=s}updateCurve(e,t){if(e>=this.curveArray.length)throw Error("Index out of range for Flow");const r=t.getLength();this.uniforms.spineLength.value=r,this.curveLengthArray[e]=r,this.curveArray[e]=t,we(this.splineTexure,t,e)}moveAlongCurve(e){this.uniforms.pathOffset.value+=e}}const Fe=new e.Matrix4;const Ee=(e,t)=>e[t],_e=(t,r)=>{const i=null!==t[0].index,n=new Set(Object.keys(t[0].attributes)),s=new Set(Object.keys(t[0].morphAttributes)),o={},a={},l=t[0].morphTargetsRelative,c=new e.BufferGeometry;let h=0;if(t.forEach(((e,t)=>{let u=0;if(i!==(null!==e.index))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+t+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let r in e.attributes){if(!n.has(r))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+t+'. All geometries must have compatible attributes; make sure "'+r+'" attribute exists among all geometries, or in none of them.'),null;void 0===o[r]&&(o[r]=[]),o[r].push(e.attributes[r]),u++}if(u!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+t+". Make sure all geometries have the same number of attributes."),null;if(l!==e.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+t+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let r in e.morphAttributes){if(!s.has(r))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+t+". .morphAttributes must be consistent throughout all geometries."),null;void 0===a[r]&&(a[r]=[]),a[r].push(e.morphAttributes[r])}if(c.userData.mergedUserData=c.userData.mergedUserData||[],c.userData.mergedUserData.push(e.userData),r){let r;if(e.index)r=e.index.count;else{if(void 0===e.attributes.position)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+t+". The geometry must have either an index or a position attribute"),null;r=e.attributes.position.count}c.addGroup(h,r,t),h+=r}})),i){let e=0;const r=[];t.forEach((t=>{const i=t.index;for(let t=0;t<i.count;++t)r.push(i.getX(t)+e);e+=t.attributes.position.count})),c.setIndex(r)}for(let e in o){const t=Pe(o[e]);if(!t)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+e+" attribute."),null;c.setAttribute(e,t)}for(let e in a){const t=a[e][0].length;if(0===t)break;c.morphAttributes=c.morphAttributes||{},c.morphAttributes[e]=[];for(let r=0;r<t;++r){const t=[];for(let i=0;i<a[e].length;++i)t.push(a[e][i][r]);const i=Pe(t);if(!i)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+e+" morphAttribute."),null;c.morphAttributes[e].push(i)}}return c},Pe=t=>{let r,i,n,s=0;if(t.forEach((e=>(void 0===r&&(r=e.array.constructor),r!==e.array.constructor?(console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null):(void 0===i&&(i=e.itemSize),i!==e.itemSize?(console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null):(void 0===n&&(n=e.normalized),n!==e.normalized?(console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null):void(s+=e.array.length)))))),r&&i){const o=new r(s);let a=0;return t.forEach((e=>{o.set(e.array,a),a+=e.array.length})),new e.BufferAttribute(o,i,n)}},Be=t=>{let r,i=0,n=0;for(let e=0,s=t.length;e<s;++e){const s=t[e];if(void 0===r&&(r=s.array.constructor),r!==s.array.constructor)return console.error("AttributeBuffers of different types cannot be interleaved"),null;i+=s.array.length,n+=s.itemSize}const s=new e.InterleavedBuffer(new r(i),n);let o=0;const a=[],l=["getX","getY","getZ","getW"],c=["setX","setY","setZ","setW"];for(let r=0,i=t.length;r<i;r++){const i=t[r],n=i.itemSize,h=i.count,u=new e.InterleavedBufferAttribute(s,n,o,i.normalized);a.push(u),o+=n;for(let e=0;e<h;e++)for(let t=0;t<n;t++){Ee(u,c[t])(e,Ee(i,l[t])(e))}}return a};function Le(e){let t=0;for(let r in e.attributes){const i=e.getAttribute(r);t+=i.count*i.itemSize*i.array.BYTES_PER_ELEMENT}const r=e.getIndex();return t+=r?r.count*r.itemSize*r.array.BYTES_PER_ELEMENT:0,t}function Re(t,r=1e-4){r=Math.max(r,Number.EPSILON);const i={},n=t.getIndex(),s=t.getAttribute("position"),o=n?n.count:s.count;let a=0;const l=Object.keys(t.attributes),c={},h={},u=[],d=["getX","getY","getZ","getW"];for(let e=0,r=l.length;e<r;e++){const r=l[e];c[r]=[];const i=t.morphAttributes[r];i&&(h[r]=new Array(i.length).fill(0).map((()=>[])))}const p=Math.log10(1/r),m=Math.pow(10,p);for(let e=0;e<o;e++){const r=n?n.getX(e):e;let s="";for(let e=0,i=l.length;e<i;e++){const i=l[e],n=t.getAttribute(i),o=n.itemSize;for(let e=0;e<o;e++)s+=~~(n[d[e]](r)*m)+","}if(s in i)u.push(i[s]);else{for(let e=0,i=l.length;e<i;e++){const i=l[e],n=t.getAttribute(i),s=t.morphAttributes[i],o=n.itemSize,a=c[i],u=h[i];for(let e=0;e<o;e++){const t=d[e];if(a.push(n[t](r)),s)for(let e=0,i=s.length;e<i;e++)u[e].push(s[e][t](r))}}i[s]=a,u.push(a),a++}}const f=t.clone();for(let r=0,i=l.length;r<i;r++){const i=l[r],n=t.getAttribute(i),s=new n.array.constructor(c[i]),o=new e.BufferAttribute(s,n.itemSize,n.normalized);if(f.setAttribute(i,o),i in h)for(let r=0;r<h[i].length;r++){const n=t.morphAttributes[i][r],s=new n.array.constructor(h[i][r]),o=new e.BufferAttribute(s,n.itemSize,n.normalized);f.morphAttributes[i][r]=o}}return f.setIndex(u),f}function Ne(t,r){if(r===e.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),t;if(r===e.TriangleFanDrawMode||r===e.TriangleStripDrawMode){let i=t.getIndex();if(null===i){const e=[],r=t.getAttribute("position");if(void 0===r)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),t;for(let t=0;t<r.count;t++)e.push(t);t.setIndex(e),i=t.getIndex()}const n=i.count-2,s=[];if(i)if(r===e.TriangleFanDrawMode)for(let e=1;e<=n;e++)s.push(i.getX(0)),s.push(i.getX(e)),s.push(i.getX(e+1));else for(let e=0;e<n;e++)e%2==0?(s.push(i.getX(e)),s.push(i.getX(e+1)),s.push(i.getX(e+2))):(s.push(i.getX(e+2)),s.push(i.getX(e+1)),s.push(i.getX(e)));s.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const o=t.clone();return o.setIndex(s),o.clearGroups(),o}return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",r),t}function De(t){if(!0!==t.geometry.isBufferGeometry)return console.error("THREE.BufferGeometryUtils: Geometry is not of type BufferGeometry."),null;const r=new e.Vector3,i=new e.Vector3,n=new e.Vector3,s=new e.Vector3,o=new e.Vector3,a=new e.Vector3,l=new e.Vector3,c=new e.Vector3,h=new e.Vector3;function u(e,t,u,d,p,m,f,g,v){r.fromBufferAttribute(u,m),i.fromBufferAttribute(u,f),n.fromBufferAttribute(u,g);const x=e.morphTargetInfluences;if(t.morphTargets&&d&&x){l.set(0,0,0),c.set(0,0,0),h.set(0,0,0);for(let e=0,t=d.length;e<t;e++){const t=x[e],u=d[e];0!==t&&(s.fromBufferAttribute(u,m),o.fromBufferAttribute(u,f),a.fromBufferAttribute(u,g),p?(l.addScaledVector(s,t),c.addScaledVector(o,t),h.addScaledVector(a,t)):(l.addScaledVector(s.sub(r),t),c.addScaledVector(o.sub(i),t),h.addScaledVector(a.sub(n),t)))}r.add(l),i.add(c),n.add(h)}e.isSkinnedMesh&&(e.boneTransform(m,r),e.boneTransform(f,i),e.boneTransform(g,n)),v[3*m+0]=r.x,v[3*m+1]=r.y,v[3*m+2]=r.z,v[3*f+0]=i.x,v[3*f+1]=i.y,v[3*f+2]=i.z,v[3*g+0]=n.x,v[3*g+1]=n.y,v[3*g+2]=n.z}const d=t.geometry,p=t.material;let m,f,g;const v=d.index,x=d.attributes.position,y=d.morphAttributes.position,b=d.morphTargetsRelative,A=d.attributes.normal,w=d.morphAttributes.position,M=d.groups,T=d.drawRange;let S,C,F,E,_,P,B,L;const R=new Float32Array(x.count*x.itemSize),N=new Float32Array(A.count*A.itemSize);if(null!==v)if(Array.isArray(p))for(S=0,F=M.length;S<F;S++)for(_=M[S],P=p[_.materialIndex],B=Math.max(_.start,T.start),L=Math.min(_.start+_.count,T.start+T.count),C=B,E=L;C<E;C+=3)m=v.getX(C),f=v.getX(C+1),g=v.getX(C+2),u(t,P,x,y,b,m,f,g,R),u(t,P,A,w,b,m,f,g,N);else for(B=Math.max(0,T.start),L=Math.min(v.count,T.start+T.count),S=B,F=L;S<F;S+=3)m=v.getX(S),f=v.getX(S+1),g=v.getX(S+2),u(t,p,x,y,b,m,f,g,R),u(t,p,A,w,b,m,f,g,N);else if(void 0!==x)if(Array.isArray(p))for(S=0,F=M.length;S<F;S++)for(_=M[S],P=p[_.materialIndex],B=Math.max(_.start,T.start),L=Math.min(_.start+_.count,T.start+T.count),C=B,E=L;C<E;C+=3)m=C,f=C+1,g=C+2,u(t,P,x,y,b,m,f,g,R),u(t,P,A,w,b,m,f,g,N);else for(B=Math.max(0,T.start),L=Math.min(x.count,T.start+T.count),S=B,F=L;S<F;S+=3)m=S,f=S+1,g=S+2,u(t,p,x,y,b,m,f,g,R),u(t,p,A,w,b,m,f,g,N);return{positionAttribute:x,normalAttribute:A,morphedPositionAttribute:new e.Float32BufferAttribute(R,3),morphedNormalAttribute:new e.Float32BufferAttribute(N,3)}}function Ie(t,r=Math.PI/3){const i=Math.cos(r),n=100*(1+1e-10),s=[new e.Vector3,new e.Vector3,new e.Vector3],o=new e.Vector3,a=new e.Vector3,l=new e.Vector3,c=new e.Vector3;function h(e){return`${~~(e.x*n)},${~~(e.y*n)},${~~(e.z*n)}`}const u=t.toNonIndexed(),d=u.attributes.position,p={};for(let t=0,r=d.count/3;t<r;t++){const r=3*t,i=s[0].fromBufferAttribute(d,r+0),n=s[1].fromBufferAttribute(d,r+1),l=s[2].fromBufferAttribute(d,r+2);o.subVectors(l,n),a.subVectors(i,n);const c=(new e.Vector3).crossVectors(o,a).normalize();for(let e=0;e<3;e++){const t=h(s[e]);t in p||(p[t]=[]),p[t].push(c)}}const m=new Float32Array(3*d.count),f=new e.BufferAttribute(m,3,!1);for(let e=0,t=d.count/3;e<t;e++){const t=3*e,r=s[0].fromBufferAttribute(d,t+0),n=s[1].fromBufferAttribute(d,t+1),u=s[2].fromBufferAttribute(d,t+2);o.subVectors(u,n),a.subVectors(r,n),l.crossVectors(o,a).normalize();for(let e=0;e<3;e++){const r=p[h(s[e])];c.set(0,0,0);for(let e=0,t=r.length;e<t;e++){const t=r[e];l.dot(t)>i&&c.add(t)}c.normalize(),f.setXYZ(t+e,c.x,c.y,c.z)}}return u.setAttribute("normal",f),u}var Ue=Object.freeze({__proto__:null,mergeBufferGeometries:_e,mergeBufferAttributes:Pe,interleaveAttributes:Be,estimateBytesUsed:Le,mergeVertices:Re,toTrianglesDrawMode:Ne,computeMorphedAttributes:De,toCreasedNormals:Ie});const Oe=new e.Vector3,ke=new e.Vector3;function Ve(e,t){const r=e.indexOf(t);r>-1&&e.splice(r,1)}class Ge{constructor(e,t){p.default(this,"position",void 0),p.default(this,"id",void 0),p.default(this,"faces",void 0),p.default(this,"neighbors",void 0),p.default(this,"collapseCost",void 0),p.default(this,"collapseNeighbor",void 0),p.default(this,"minCost",0),p.default(this,"totalCost",0),p.default(this,"costCount",0),this.position=e,this.id=t,this.faces=[],this.neighbors=[],this.collapseCost=0,this.collapseNeighbor=null}addUniqueNeighbor(e){var t,r;t=this.neighbors,r=e,-1===t.indexOf(r)&&t.push(r)}removeIfNonNeighbor(e){const t=this.neighbors,r=this.faces,i=t.indexOf(e);if(-1!==i){for(let t=0;t<r.length;t++)if(r[t].hasVertex(e))return;t.splice(i,1)}}}class ze{constructor(t,r,i,n,s,o){p.default(this,"a",void 0),p.default(this,"b",void 0),p.default(this,"c",void 0),p.default(this,"v1",void 0),p.default(this,"v2",void 0),p.default(this,"v3",void 0),p.default(this,"normal",new e.Vector3),this.a=n,this.b=s,this.c=o,this.v1=t,this.v2=r,this.v3=i,this.computeNormal(),t.faces.push(this),t.addUniqueNeighbor(r),t.addUniqueNeighbor(i),r.faces.push(this),r.addUniqueNeighbor(t),r.addUniqueNeighbor(i),i.faces.push(this),i.addUniqueNeighbor(t),i.addUniqueNeighbor(r)}computeNormal(){const e=this.v1.position,t=this.v2.position,r=this.v3.position;Oe.subVectors(r,t),ke.subVectors(e,t),Oe.cross(ke).normalize(),this.normal.copy(Oe)}hasVertex(e){return e===this.v1||e===this.v2||e===this.v3}replaceVertex(e,t){e===this.v1?this.v1=t:e===this.v2?this.v2=t:e===this.v3&&(this.v3=t),Ve(e.faces,this),t.faces.push(this),e.removeIfNonNeighbor(this.v1),this.v1.removeIfNonNeighbor(e),e.removeIfNonNeighbor(this.v2),this.v2.removeIfNonNeighbor(e),e.removeIfNonNeighbor(this.v3),this.v3.removeIfNonNeighbor(e),this.v1.addUniqueNeighbor(this.v2),this.v1.addUniqueNeighbor(this.v3),this.v2.addUniqueNeighbor(this.v1),this.v2.addUniqueNeighbor(this.v3),this.v3.addUniqueNeighbor(this.v1),this.v3.addUniqueNeighbor(this.v2),this.computeNormal()}}const He="vertex",je="none",We="frame",Xe="object",Qe=e=>{const t=[];for(const r in e){const i=e[r];i&&!0===i.isNode&&t.push(r)}return t},Ye=e=>"number"==typeof e?"float":"boolean"==typeof e?"bool":!0===(null==e?void 0:e.isVector2)?"vec2":!0===(null==e?void 0:e.isVector3)?"vec3":!0===(null==e?void 0:e.isVector4)?"vec4":!0===(null==e?void 0:e.isMatrix3)?"mat3":!0===(null==e?void 0:e.isMatrix4)?"mat4":!0===(null==e?void 0:e.isColor)?"color":null,Ke=(t,...r)=>{const i=null==t?void 0:t.slice(-4);return"color"===t?new e.Color(...r):"vec2"===i?new e.Vector2(...r):"vec3"===i?new e.Vector3(...r):"vec4"===i?new e.Vector4(...r):"mat3"===i?new e.Matrix3(...r):"mat4"===i?new e.Matrix4(...r):"bool"!==t&&("float"===t||"int"===t||"uint"===t?0:null)};let qe=0;class Je{constructor(t=null){this.nodeType=t,this.updateType=je,this.uuid=e.MathUtils.generateUUID(),Object.defineProperty(this,"id",{value:qe++})}get type(){return this.constructor.name}getHash(){return this.uuid}getUpdateType(){return this.updateType}getNodeType(){return this.nodeType}update(){console.warn("Abstract function.")}generate(){console.warn("Abstract function.")}analyze(e){const t=this.getHash(e),r=e.getNodeFromHash(t);if(void 0!==r&&this!==r)return r.analyze(e);const i=e.getDataFromNode(this);i.dependenciesCount=void 0===i.dependenciesCount?1:i.dependenciesCount+1;const n=Qe(this);for(const t of n)this[t].analyze(e)}build(e,t=null){const r=this.getHash(e),i=e.getNodeFromHash(r);if(void 0!==i&&this!==i)return i.build(e,t);e.addNode(this),e.addStack(this);const n=e.getDataFromNode(this);let s=null;if(1===this.generate.length){const r=this.getNodeType(e);s=n.snippet,void 0===s&&(s=this.generate(e)||"",n.snippet=s),s=e.format(s,r,t)}else s=this.generate(e,t)||"";return e.removeStack(this),s}serialize(e){const t=Qe(this);if(t.length>0){const r={};for(const i of t)r[i]=this[i].toJSON(e.meta).uuid;e.inputNodes=r}}deserialize(e){if(void 0!==e.inputNodes){const t=e.meta.nodes;for(const r in e.inputNodes){const i=e.inputNodes[r];this[r]=t[i]}}}toJSON(e){const{uuid:t,type:r}=this,i=void 0===e||"string"==typeof e;i&&(e={textures:{},images:{},nodes:{}});let n=e.nodes[t];function s(e){const t=[];for(const r in e){const i=e[r];delete i.metadata,t.push(i)}return t}if(void 0===n&&(n={uuid:t,type:r,meta:e,metadata:{version:4.5,type:"Node",generator:"Node.toJSON"}},e.nodes[n.uuid]=n,this.serialize(n),delete n.meta),i){const t=s(e.textures),r=s(e.images),i=s(e.nodes);t.length>0&&(n.textures=t),r.length>0&&(n.images=r),i.length>0&&(n.nodes=i)}return n}}Je.prototype.isNode=!0;class Ze extends Je{constructor(e,t=null){super(t),this.value=e}getNodeType(){return null===this.nodeType?Ye(this.value):this.nodeType}getInputType(e){return this.getNodeType(e)}serialize(e){var t,r;super.serialize(e),e.value=(null===(t=this.value)||void 0===t||null===(r=t.toArray)||void 0===r?void 0:r.call(t))||this.value,e.valueType=Ye(this.value),e.nodeType=this.nodeType}deserialize(e){var t,r;super.deserialize(e),this.nodeType=e.nodeType,this.value=Ke(e.valueType),this.value=(null===(t=this.value)||void 0===t||null===(r=t.fromArray)||void 0===r?void 0:r.call(t,e.value))||e.value}generate(){console.warn("Abstract function.")}}Ze.prototype.isInputNode=!0;class $e extends Ze{getUniformHash(e){return this.getHash(e)}generate(e,t){const r=this.getNodeType(e),i=this.getUniformHash(e);let n=e.getNodeFromHash(i);void 0===n&&(e.setHashNode(this,i),n=this);const s=n.getInputType(e),o=e.getUniformFromNode(n,e.shaderStage,s),a=e.getPropertyName(o);return e.format(a,r,t)}}$e.prototype.isUniformNode=!0;class et extends $e{constructor(e=[]){super(),this.nodes=e}getNodeType(e){return this.nodes[0].getNodeType(e)}}et.prototype.isArrayUniformNode=!0;class tt extends Je{constructor(e,t=null){super(),this.node=e,this.name=t}getHash(e){return this.name||super.getHash(e)}getNodeType(e){return this.node.getNodeType(e)}generate(e){const t=this.getNodeType(e),r=this.node,i=this.name,n=e.getVaryFromNode(this,t);null!==i&&(n.name=i);const s=e.getPropertyName(n,He);return e.flowNodeFromShaderStage(He,r,t,s),e.getPropertyName(n)}}class rt extends Je{constructor(e,t){super(t),this._attributeName=e}getHash(e){return this.getAttributeName(e)}setAttributeName(e){return this._attributeName=e,this}getAttributeName(){return this._attributeName}generate(e){const t=e.getAttribute(this.getAttributeName(e),this.getNodeType(e));if(e.isShaderStage("vertex"))return t.name;return new tt(this).build(e,t.type)}}class it extends Je{constructor(e,t){super(),this.outputNode=e,this.callNode=t}getNodeType(e){return this.outputNode.getNodeType(e)}generate(e,t){const r=this.callNode.build(e,"void");return""!==r&&e.addFlowCode(r),this.outputNode.build(e,t)}}it.prototype.isBypassNode=!0;class nt extends Je{constructor(e="",t="code"){super(t),this.code=e,this._includes=[]}setIncludes(e){return this._includes=e,this}getIncludes(){return this._includes}generate(e){const t=this.getIncludes(e);for(const r of t)r.build(e);const r=e.getCodeFromNode(this,this.getNodeType(e));return r.code=this.code,r.code}}nt.prototype.isCodeNode=!0;class st extends Ze{generateConst(e){return e.getConst(this.getNodeType(e),this.value)}generate(e,t){const r=this.getNodeType(e);return e.format(this.generateConst(e),r,t)}}st.prototype.isConstNode=!0;class ot extends Je{constructor(e,t={}){super(),this.node=e,this.context=t}getNodeType(e){return this.node.getNodeType(e)}generate(e,t){const r=e.getContext();e.setContext(Object.assign({},e.context,this.context));const i=this.node.build(e,t);return e.setContext(r),i}}ot.prototype.isContextNode=!0;class at extends Je{constructor(e){super(e)}build(e,t){const r=e.getVectorType(this.getNodeType(e,t)),i=e.getDataFromNode(this);if(!1!==e.context.temp&&"void "!==r&&"void"!==t&&i.dependenciesCount>1){if(void 0===i.snippet){const t=super.build(e,r),n=e.getVarFromNode(this,r),s=e.getPropertyName(n);e.addFlowCode(`${s} = ${t}`),i.snippet=t,i.propertyName=s}return e.format(i.propertyName,r,t)}return super.build(e,t)}}class lt extends at{constructor(e="",t="void"){super(t),this.snipped=e}generate(e){const t=this.getNodeType(e),r=this.snipped;if("void"!==t)return`( ${r} )`;e.addFlowCode(r)}}class ct extends at{constructor(e=null,t={}){super(),this.functionNode=e,this.parameters=t}setParameters(e){return this.parameters=e,this}getParameters(){return this.parameters}getNodeType(e){return this.functionNode.getNodeType(e)}generate(e){const t=[],r=this.functionNode,i=r.getInputs(e),n=this.parameters;for(const r of i){const i=n[r.name];if(void 0===i)throw new Error(`FunctionCallNode: Input '${r.name}' not found in FunctionNode.`);t.push(i.build(e,r.type))}return`${r.build(e,"property")}( ${t.join(", ")} )`}}class ht extends nt{constructor(e=""){super(e),this.keywords={}}getNodeType(e){return this.getNodeFunction(e).type}getInputs(e){return this.getNodeFunction(e).inputs}getNodeFunction(e){const t=e.getDataFromNode(this);let r=t.nodeFunction;return void 0===r&&(r=e.parser.parseFunction(this.code),t.nodeFunction=r),r}call(e={}){return new ct(this,e)}generate(e,t){super.generate(e);const r=this.getNodeFunction(e),i=r.name,n=r.type,s=e.getCodeFromNode(this,n);""!==i&&(s.name=i);const o=e.getPropertyName(s);let a=this.getNodeFunction(e).getCode(o);const l=this.keywords,c=Object.keys(l);if(c.length>0)for(const t of c){const r=new RegExp(`\\b${t}\\b`,"g"),i=l[t].build(e,"property");a=a.replace(r,i)}return s.code=a,"property"===t?o:e.format(`${o}()`,n,t)}}class ut{constructor(e,t){this.name=e,this.type=t}}ut.prototype.isNodeAttribute=!0;class dt{constructor(e,t,r,i){this.name=e,this.type=t,this.node=r,this.needsUpdate=i}get value(){return this.node.value}set value(e){this.node.value=e}}dt.prototype.isNodeUniform=!0;class pt{constructor(e,t){this.name=e,this.type=t}}pt.prototype.isNodeVary=!0;class mt{constructor(e,t){this.name=e,this.type=t}}mt.prototype.isNodeVar=!0;class ft{constructor(e,t,r=""){this.name=e,this.type=t,this.code=r,Object.defineProperty(this,"isNodeCode",{value:!0})}}class gt{constructor(){this.keywords=[],this.nodes=[],this.keywordsCallback={}}getNode(e){let t=this.nodes[e];return void 0===t&&void 0!==this.keywordsCallback[e]&&(t=this.keywordsCallback[e](e),this.nodes[e]=t),t}addKeyword(e,t){return this.keywords.push(e),this.keywordsCallback[e]=t,this}parse(e){const t=this.keywords,r=new RegExp(`\\b${t.join("\\b|\\b")}\\b`,"g"),i=e.match(r),n=[];if(null!==i)for(const e of i){const t=this.getNode(e);void 0!==t&&-1===n.indexOf(t)&&n.push(t)}return n}include(e,t){const r=this.parse(t);for(const t of r)t.build(e)}}const vt=["fragment","vertex"],xt=["x","y","z","w"],yt=e=>(e=Number(e))+(e%1?"":".0");class bt{constructor(e,t,r){this.object=e,this.material=e.material,this.renderer=t,this.parser=r,this.nodes=[],this.updateNodes=[],this.hashNodes={},this.vertexShader=null,this.fragmentShader=null,this.flowNodes={vertex:[],fragment:[]},this.flowCode={vertex:"",fragment:""},this.uniforms={vertex:[],fragment:[],index:0},this.codes={vertex:[],fragment:[]},this.attributes=[],this.varys=[],this.vars={vertex:[],fragment:[]},this.flow={code:""},this.stack=[],this.context={keywords:new gt,material:e.material},this.nodesData=new WeakMap,this.flowsData=new WeakMap,this.shaderStage=null,this.node=null}addStack(e){this.stack.push(e)}removeStack(e){if(this.stack.pop()!==e)throw new Error("NodeBuilder: Invalid node stack!")}setHashNode(e,t){this.hashNodes[t]=e}addNode(e){if(-1===this.nodes.indexOf(e)){e.getUpdateType(this)!==je&&this.updateNodes.push(e),this.nodes.push(e),this.setHashNode(e,e.getHash(this))}}getMethod(e){return e}getNodeFromHash(e){return this.hashNodes[e]}addFlow(e,t){return this.flowNodes[e].push(t),t}setContext(e){this.context=e}getContext(){return this.context}getTexture(){console.warn("Abstract function.")}getTextureBias(){console.warn("Abstract function.")}getCubeTexture(){console.warn("Abstract function.")}getCubeTextureBias(){console.warn("Abstract function.")}getConst(e,t){if("float"===e)return yt(t);if("int"===e)return`${Math.round(t)}`;if("uint"===e)return t>=0?`${Math.round(t)}u`:"0u";if("bool"===e)return t?"true":"false";if("color"===e)return`${this.getType("vec3")}( ${yt(t.r)}, ${yt(t.g)}, ${yt(t.b)} )`;const r=this.getTypeLength(e),i=this.getComponentType(e),n=e=>this.getConst(i,e);if(2===r)return`${this.getType(e)}( ${n(t.x)}, ${n(t.y)} )`;if(3===r)return`${this.getType(e)}( ${n(t.x)}, ${n(t.y)}, ${n(t.z)} )`;if(4===r)return`${this.getType(e)}( ${n(t.x)}, ${n(t.y)}, ${n(t.z)}, ${n(t.w)} )`;throw new Error(`NodeBuilder: Type '${e}' not found in generate constant attempt.`)}getType(e){return e}generateMethod(e){return e}getAttribute(e,t){const r=this.attributes;for(const t of r)if(t.name===e)return t;const i=new ut(e,t);return r.push(i),i}getPropertyName(e){return e.name}isVector(e){return/vec\d/.test(e)}isMatrix(e){return/mat\d/.test(e)}isReference(e){return"void"===e||"property"===e||"sampler"===e}isShaderStage(e){return this.shaderStage===e}getTextureEncodingFromMap(e){let t;return t=e&&e.isTexture?"colorSpace"in e?"srgb"===e.colorSpace?3001:3e3:e.encoding:e&&e.isWebGLRenderTarget?"colorSpace"in e.texture?"srgb"===e.texture.colorSpace?3001:3e3:e.texture.encoding:3e3,t}getComponentType(e){e=this.getVectorType(e);const t=/(b|i|u|)(vec|mat)([2-4])/.exec(e);return null===t?null:"b"===t[1]?"bool":"i"===t[1]?"int":"u"===t[1]?"uint":"float"}getVectorType(e){return"color"===e?"vec3":"texture"===e?"vec4":e}getTypeFromLength(e){return 1===e?"float":2===e?"vec2":3===e?"vec3":4===e?"vec4":0}getTypeLength(e){const t=this.getVectorType(e),r=/vec([2-4])/.exec(t);return null!==r?Number(r[1]):"float"===t||"bool"===t||"int"===t||"uint"===t?1:0}getVectorFromMatrix(e){return e.replace("mat","vec")}getDataFromNode(e,t=this.shaderStage){let r=this.nodesData.get(e);return void 0===r&&(r={vertex:{},fragment:{}},this.nodesData.set(e,r)),null!==t?r[t]:r}getUniformFromNode(e,t,r){const i=this.getDataFromNode(e,t);let n=i.uniform;if(void 0===n){const s=this.uniforms.index++;n=new dt("nodeUniform"+s,r,e),this.uniforms[t].push(n),i.uniform=n}return n}getVarFromNode(e,t,r=this.shaderStage){const i=this.getDataFromNode(e,r);let n=i.variable;if(void 0===n){const e=this.vars[r],s=e.length;n=new mt("nodeVar"+s,t),e.push(n),i.variable=n}return n}getVaryFromNode(e,t){const r=this.getDataFromNode(e,null);let i=r.vary;if(void 0===i){const e=this.varys,n=e.length;i=new pt("nodeVary"+n,t),e.push(i),r.vary=i}return i}getCodeFromNode(e,t,r=this.shaderStage){const i=this.getDataFromNode(e);let n=i.code;if(void 0===n){const e=this.codes[r],s=e.length;n=new ft("nodeCode"+s,t),e.push(n),i.code=n}return n}addFlowCode(e){this.flow.code+=e}getFlowData(e,t){return this.flowsData.get(t)}flowNode(e){this.node=e;const t=e.getNodeType(this),r=this.flowChildNode(e,t);return this.flowsData.set(e,r),this.node=null,r}flowChildNode(e,t=null){const r=this.flow,i={code:""};return this.flow=i,i.result=e.build(this,t),this.flow=r,i}flowNodeFromShaderStage(e,t,r=null,i=null){const n=this.shaderStage;this.setShaderStage(e);const s=this.flowChildNode(t,r);return null!==i&&(s.code+=`${i} = ${s.result};\n\t`),this.flowCode[e]=this.flowCode[e]+s.code,this.setShaderStage(n),s}getAttributes(){console.warn("Abstract function.")}getVarys(){console.warn("Abstract function.")}getVars(e){let t="";const r=this.vars[e];for(let e=0;e<r.length;e++){const i=r[e];t+=`${i.type} ${i.name}; `}return t}getUniforms(){console.warn("Abstract function.")}getCodes(e){const t=this.codes[e];let r="";for(const e of t)r+=e.code+"\n";return r}getHash(){return this.vertexShader+this.fragmentShader}getShaderStage(){return this.shaderStage}setShaderStage(e){this.shaderStage=e}buildCode(){console.warn("Abstract function.")}build(){for(const e of vt){this.setShaderStage(e);const t=this.flowNodes[e];for(const e of t)e.analyze(this)}this.context.vertex&&this.context.vertex.isNode&&this.flowNodeFromShaderStage("vertex",this.context.vertex);for(const e of vt){this.setShaderStage(e);const t=this.flowNodes[e];for(const r of t)this.flowNode(r,e)}return this.setShaderStage(null),this.buildCode(),this}format(e,t,r){if((t=this.getVectorType(t))===(r=this.getVectorType(r))||null===r||this.isReference(r))return e;const i=this.getTypeLength(t),n=this.getTypeLength(r);if(0===i){const i=this.getVectorFromMatrix(t);return this.format(`( ${e} * ${this.getType(i)}( 1.0 ) )`,i,r)}return 0===n?e:i===n?`${this.getType(r)}( ${e} )`:i>n?this.format(`${e}.${"xyz".slice(0,n)}`,this.getTypeFromLength(n),r):4===n?`${this.getType(r)}( ${this.format(e,t,"vec3")}, 1.0 )`:2===i?`${this.getType(r)}( ${this.format(e,t,"vec2")}, 0.0 )`:`${this.getType(r)}( ${e} )`}getSignature(){return`// Three.js r${e.REVISION} - NodeMaterial System\n`}}class At{constructor(){this.time=0,this.deltaTime=0,this.frameId=0,this.startTime=null,this.updateMap=new WeakMap,this.renderer=null,this.material=null,this.camera=null,this.object=null}updateNode(e){e.updateType===We?this.updateMap.get(e)!==this.frameId&&(this.updateMap.set(e,this.frameId),e.update(this)):e.updateType===Xe&&e.update(this)}update(){this.frameId++,void 0===this.lastTime&&(this.lastTime=performance.now()),this.deltaTime=(performance.now()-this.lastTime)/1e3,this.lastTime=performance.now(),this.time+=this.deltaTime}}class wt{constructor(e,t,r=null,i="",n=!1){this.type=e,this.name=t,this.count=r,this.qualifier=i,this.isConst=n}}wt.isNodeFunctionInput=!0;class Mt extends Je{constructor(e=null,t="vec4"){super(t),this.name=e}getHash(e){return this.name||super.getHash(e)}generate(e){const t=e.getVarFromNode(this,this.getNodeType(e)),r=this.name;return null!==r&&(t.name=r),e.getPropertyName(t)}}class Tt extends Je{constructor(e,t=null,r=null){super(r),this.node=e,this.name=t}getHash(e){return this.name||super.getHash(e)}getNodeType(e){return super.getNodeType(e)||this.node.getNodeType(e)}generate(e){const t=e.getVectorType(this.getNodeType(e)),r=this.node,i=this.name,n=r.build(e,t),s=e.getVarFromNode(this,t);null!==i&&(s.name=i);const o=e.getPropertyName(s);return e.addFlowCode(`${o} = ${n}`),o}}Tt.prototype.isVarNode=!0;class St extends $e{constructor(e,t,r=0){super(e,t),this.bufferType=t,this.bufferCount=r}getInputType(){return"buffer"}}St.prototype.isBufferNode=!0;class Ct extends Je{constructor(e=Ct.VIEW_MATRIX,t=null){super(),this.scope=e,this.object3d=t,this.updateType=Xe,this._uniformNode=new $e(null)}getNodeType(){const e=this.scope;return e===Ct.WORLD_MATRIX||e===Ct.VIEW_MATRIX?"mat4":e===Ct.NORMAL_MATRIX?"mat3":e===Ct.POSITION||e===Ct.VIEW_POSITION?"vec3":void 0}update(e){const t=null!==this.object3d?this.object3d:e.object,r=this._uniformNode,i=e.camera,n=this.scope;n===Ct.VIEW_MATRIX?r.value=t.modelViewMatrix:n===Ct.NORMAL_MATRIX?r.value=t.normalMatrix:n===Ct.WORLD_MATRIX?r.value=t.matrixWorld:n===Ct.POSITION?r.value.setFromMatrixPosition(t.matrixWorld):n===Ct.VIEW_POSITION&&(r.value.setFromMatrixPosition(t.matrixWorld),r.value.applyMatrix4(i.matrixWorldInverse))}generate(t){const r=this.scope;return r===Ct.WORLD_MATRIX||r===Ct.VIEW_MATRIX?this._uniformNode.nodeType="mat4":r===Ct.NORMAL_MATRIX?this._uniformNode.nodeType="mat3":r!==Ct.POSITION&&r!==Ct.VIEW_POSITION||(this._uniformNode.nodeType="vec3",this._uniformNode.value=new e.Vector3),this._uniformNode.build(t)}serialize(e){super.serialize(e),e.scope=this.scope}deserialize(e){super.deserialize(e),this.scope=e.scope}}p.default(Ct,"VIEW_MATRIX","viewMatrix"),p.default(Ct,"NORMAL_MATRIX","normalMatrix"),p.default(Ct,"WORLD_MATRIX","worldMatrix"),p.default(Ct,"POSITION","position"),p.default(Ct,"VIEW_POSITION","viewPosition");class Ft extends Ct{constructor(e=Ft.POSITION){super(e)}getNodeType(e){return this.scope===Ft.PROJECTION_MATRIX?"mat4":super.getNodeType(e)}update(e){const t=e.camera,r=this._uniformNode,i=this.scope;i===Ft.PROJECTION_MATRIX?r.value=t.projectionMatrix:i===Ft.VIEW_MATRIX?r.value=t.matrixWorldInverse:(this.object3d=t,super.update(e))}generate(e){return this.scope===Ft.PROJECTION_MATRIX&&(this._uniformNode.nodeType="mat4"),super.generate(e)}}p.default(Ft,"PROJECTION_MATRIX","projectionMatrix");class Et extends rt{constructor(e=0){super(null,"vec2"),this.index=e}getAttributeName(){const e=this.index;return"uv"+(e>0?e+1:"")}serialize(e){super.serialize(e),e.index=this.index}deserialize(e){super.deserialize(e),this.index=e.index}}Et.prototype.isUVNode=!0;class _t extends $e{constructor(e,t=new Et,r=null){super(e,"vec4"),this.uvNode=t,this.biasNode=r}getUniformHash(){return this.value.uuid}getInputType(){return"texture"}generate(e,t){const r=this.value;if(!r||!0!==r.isTexture)throw new Error("TextureNode: Need a three.js texture.");const i=super.generate(e,"texture");if("sampler"===t)return i+"_sampler";if(e.isReference(t))return i;{const r=e.getDataFromNode(this);let n=r.snippet;if(void 0===n){const t=this.uvNode.build(e,"vec2"),s=this.biasNode;if(null!==s){const r=s.build(e,"float");n=e.getTextureBias(i,t,r)}else n=e.getTexture(i,t);r.snippet=n}return e.format(n,"vec4",t)}}serialize(e){super.serialize(e),e.value=this.value.toJSON(e.meta).uuid}deserialize(e){super.deserialize(e),this.value=e.meta.textures[e.value]}}_t.prototype.isTextureNode=!0;class Pt extends Ct{constructor(e=Pt.VIEW_MATRIX){super(e)}}class Bt extends Je{constructor(e=[]){super(),this.nodes=e}getNodeType(e){return e.getTypeFromLength(this.nodes.reduce(((t,r)=>t+e.getTypeLength(r.getNodeType(e))),0))}generate(e){const t=this.getNodeType(e),r=this.nodes,i=[];for(let t=0;t<r.length;t++){const n=r[t].build(e);i.push(n)}return`${e.getType(t)}( ${i.join(", ")} )`}}class Lt extends Je{constructor(e,t="x"){super(),this.node=e,this.components=t}getVectorLength(){let e=this.components.length;for(const t of this.components)e=Math.max(xt.indexOf(t)+1,e);return e}getNodeType(e){return e.getTypeFromLength(this.components.length)}generate(e){const t=this.node,r=e.getTypeLength(t.getNodeType(e));if(r>1){let i=null;this.getVectorLength()>=r&&(i=e.getTypeFromLength(this.getVectorLength()));return`${t.build(e,i)}.${this.components}`}return t.build(e)}serialize(e){super.serialize(e),e.components=this.components}deserialize(e){super.deserialize(e),this.components=e.components}}class Rt extends at{constructor(e,t,r,...i){if(super(),this.op=e,i.length>0){let t=r;for(let r=0;r<i.length;r++)t=new Rt(e,t,i[r]);r=t}this.aNode=t,this.bNode=r}getNodeType(e,t){const r=this.op,i=this.aNode,n=this.bNode,s=i.getNodeType(e),o=n.getNodeType(e);if("void"===s||"void"===o)return"void";if("="===r||"%"===r)return s;if("&"===r||"|"===r||"^"===r||">>"===r||"<<"===r)return"int";if("=="===r||"&&"===r||"||"===r||"^^"===r)return"bool";if("<"===r||">"===r||"<="===r||">="===r){const r=e.getTypeLength(t);return r>1?`bvec${r}`:"bool"}return"float"===s&&e.isMatrix(o)?o:e.isMatrix(s)&&e.isVector(o)?e.getVectorFromMatrix(s):e.isVector(s)&&e.isMatrix(o)?e.getVectorFromMatrix(o):e.getTypeLength(o)>e.getTypeLength(s)?o:s}generate(e,t){const r=this.op,i=this.aNode,n=this.bNode,s=this.getNodeType(e,t);let o=null,a=null;"void"!==s?(o=i.getNodeType(e),a=n.getNodeType(e),"="===r?a=o:"<"===r||">"===r||"<="===r||">="===r?e.isVector(o)?a=o:o=a="float":e.isMatrix(o)&&e.isVector(a)?a=e.getVectorFromMatrix(o):o=e.isVector(o)&&e.isMatrix(a)?e.getVectorFromMatrix(a):a=s):o=a=s;const l=i.build(e,o),c=n.build(e,a),h=e.getTypeLength(t);return"void"!==t?"="===r?(e.addFlowCode(`${l} ${this.op} ${c}`),l):">"===r&&h>1?e.format(`${e.getMethod("greaterThan")}( ${l}, ${c} )`,s,t):"<="===r&&h>1?e.format(`${e.getMethod("lessThanEqual")}( ${l}, ${c} )`,s,t):e.format(`( ${l} ${this.op} ${c} )`,s,t):"void"!==o?e.format(`${l} ${this.op} ${c}`,s,t):void 0}serialize(e){super.serialize(e),e.op=this.op}deserialize(e){super.deserialize(e),this.op=e.op}}class Nt extends at{constructor(e,t,r=null,i=null){super(),this.method=e,this.aNode=t,this.bNode=r,this.cNode=i}getInputType(e){const t=this.aNode.getNodeType(e),r=this.bNode?this.bNode.getNodeType(e):null,i=this.cNode?this.cNode.getNodeType(e):null,n=e.getTypeLength(t),s=e.getTypeLength(r),o=e.getTypeLength(i);return n>s&&n>o?t:s>o?r:o>n?i:t}getNodeType(e){const t=this.method;return t===Nt.LENGTH||t===Nt.DISTANCE||t===Nt.DOT?"float":t===Nt.CROSS?"vec3":this.getInputType(e)}generate(e,t){const r=this.method,i=this.getNodeType(e),n=this.getInputType(e),s=this.aNode,o=this.bNode,a=this.cNode,l=!0===e.renderer.isWebGLRenderer;if(!l||r!==Nt.DFDX&&r!==Nt.DFDY||"vec3"!==t){if(r===Nt.TRANSFORM_DIRECTION){let t=s,r=o;e.isMatrix(t.getNodeType(e))?r=new lt(`${e.getType("vec4")}( ${r.build(e,"vec3")}, 0.0 )`,"vec4"):t=new lt(`${e.getType("vec4")}( ${t.build(e,"vec3")}, 0.0 )`,"vec4");const i=new Lt(new Rt("*",t,r),"xyz");return new Nt(Nt.NORMALIZE,i).build(e)}if(r===Nt.SATURATE)return e.format(`clamp( ${s.build(e,n)}, 0.0, 1.0 )`,i,t);if(r===Nt.NEGATE)return e.format("( -"+s.build(e,n)+" )",i,t);if(r===Nt.INVERT)return e.format("( 1.0 - "+s.build(e,n)+" )",i,t);{const c=[];return r===Nt.CROSS?c.push(s.build(e,i),o.build(e,i)):r===Nt.STEP?c.push(s.build(e,1===e.getTypeLength(s.getNodeType(e))?"float":n),o.build(e,n)):l&&(r===Nt.MIN||r===Nt.MAX)||r===Nt.MOD?c.push(s.build(e,n),o.build(e,1===e.getTypeLength(o.getNodeType(e))?"float":n)):r===Nt.REFRACT?c.push(s.build(e,n),o.build(e,n),a.build(e,"float")):r===Nt.MIX?c.push(s.build(e,n),o.build(e,n),a.build(e,1===e.getTypeLength(a.getNodeType(e))?"float":n)):(c.push(s.build(e,n)),null!==a?c.push(o.build(e,n),a.build(e,n)):null!==o&&c.push(o.build(e,n))),e.format(`${e.getMethod(r)}( ${c.join(", ")} )`,i,t)}}return new Bt([new Nt(r,new Lt(s,"x")),new Nt(r,new Lt(s,"y")),new Nt(r,new Lt(s,"z"))]).build(e)}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}}p.default(Nt,"RAD","radians"),p.default(Nt,"DEG","degrees"),p.default(Nt,"EXP","exp"),p.default(Nt,"EXP2","exp2"),p.default(Nt,"LOG","log"),p.default(Nt,"LOG2","log2"),p.default(Nt,"SQRT","sqrt"),p.default(Nt,"INV_SQRT","inversesqrt"),p.default(Nt,"FLOOR","floor"),p.default(Nt,"CEIL","ceil"),p.default(Nt,"NORMALIZE","normalize"),p.default(Nt,"FRACT","fract"),p.default(Nt,"SIN","sin"),p.default(Nt,"COS","cos"),p.default(Nt,"TAN","tan"),p.default(Nt,"ASIN","asin"),p.default(Nt,"ACOS","acos"),p.default(Nt,"ATAN","atan"),p.default(Nt,"ABS","abs"),p.default(Nt,"SIGN","sign"),p.default(Nt,"LENGTH","length"),p.default(Nt,"NEGATE","negate"),p.default(Nt,"INVERT","invert"),p.default(Nt,"DFDX","dFdx"),p.default(Nt,"DFDY","dFdy"),p.default(Nt,"SATURATE","saturate"),p.default(Nt,"ROUND","round"),p.default(Nt,"MIN","min"),p.default(Nt,"MAX","max"),p.default(Nt,"MOD","mod"),p.default(Nt,"STEP","step"),p.default(Nt,"REFLECT","reflect"),p.default(Nt,"DISTANCE","distance"),p.default(Nt,"DOT","dot"),p.default(Nt,"CROSS","cross"),p.default(Nt,"POW","pow"),p.default(Nt,"TRANSFORM_DIRECTION","transformDirection"),p.default(Nt,"MIX","mix"),p.default(Nt,"CLAMP","clamp"),p.default(Nt,"REFRACT","refract"),p.default(Nt,"SMOOTHSTEP","smoothstep"),p.default(Nt,"FACEFORWARD","faceforward");class Dt extends Je{constructor(e=Dt.LOCAL){super("vec3"),this.scope=e}getHash(){return`position-${this.scope}`}generate(e){const t=this.scope;let r=null;if(t===Dt.GEOMETRY)r=new rt("position","vec3");else if(t===Dt.LOCAL)r=new tt(new Dt(Dt.GEOMETRY));else if(t===Dt.WORLD){const e=new Nt(Nt.TRANSFORM_DIRECTION,new Pt(Pt.WORLD_MATRIX),new Dt(Dt.LOCAL));r=new tt(e)}else if(t===Dt.VIEW){const e=new Rt("*",new Pt(Pt.VIEW_MATRIX),new Dt(Dt.LOCAL));r=new tt(e)}else if(t===Dt.VIEW_DIRECTION){const e=new Nt(Nt.NEGATE,new Dt(Dt.VIEW));r=new Nt(Nt.NORMALIZE,new tt(e))}return r.build(e,this.getNodeType(e))}serialize(e){super.serialize(e),e.scope=this.scope}deserialize(e){super.deserialize(e),this.scope=e.scope}}p.default(Dt,"GEOMETRY","geometry"),p.default(Dt,"LOCAL","local"),p.default(Dt,"WORLD","world"),p.default(Dt,"VIEW","view"),p.default(Dt,"VIEW_DIRECTION","viewDirection");class It extends Je{constructor(e=It.LOCAL){super("vec3"),this.scope=e}getHash(){return`normal-${this.scope}`}generate(e){const t=this.scope;let r=null;if(t===It.GEOMETRY)r=new rt("normal","vec3");else if(t===It.LOCAL)r=new tt(new It(It.GEOMETRY));else if(t===It.VIEW){const e=new Rt("*",new Pt(Pt.NORMAL_MATRIX),new It(It.LOCAL));r=new Nt(Nt.NORMALIZE,new tt(e))}else if(t===It.WORLD){const e=new Nt(Nt.TRANSFORM_DIRECTION,new It(It.VIEW),new Ft(Ft.VIEW_MATRIX));r=new Nt(Nt.NORMALIZE,new tt(e))}return r.build(e)}serialize(e){super.serialize(e),e.scope=this.scope}deserialize(e){super.deserialize(e),this.scope=e.scope}}p.default(It,"GEOMETRY","geometry"),p.default(It,"LOCAL","local"),p.default(It,"WORLD","world"),p.default(It,"VIEW","view");class Ut extends Je{constructor(e,t,r){super(),this.node=e,this.ifNode=t,this.elseNode=r}getNodeType(e){const t=this.ifNode.getNodeType(e),r=this.elseNode.getNodeType(e);return e.getTypeLength(r)>e.getTypeLength(t)?r:t}generate(e){const t=this.getNodeType(e),r={temp:!1},i=new Mt(null,t).build(e),n=new ot(this.node).build(e,"bool"),s=new ot(this.ifNode,r).build(e,t),o=new ot(this.elseNode,r).build(e,t);return e.addFlowCode(`if ( ${n} ) {\n\n\t\t${i} = ${s};\n\n\t} else {\n\n\t\t${i} = ${o};\n\n\t}`),i}}class Ot extends Je{constructor(e,t){super(),this.node=e,this.indexNode=t}getNodeType(e){return this.node.getNodeType(e)}generate(e){return`${this.node.build(e)}[ ${this.indexNode.build(e,"int")} ]`}}class kt extends Je{constructor(e,t){super(),this.node=e,this.convertTo=t}getNodeType(){return this.convertTo}generate(e){const t=this.convertTo,r=this.node;if(!1===e.isReference(t)){const i=e.getType(t),n=r.build(e,t);return`${e.getVectorType(i)}( ${n} )`}return r.build(e,t)}}const Vt={construct(e,t){const r=t.shift();return e(new Ht(r),...t)},get:function(e,t){if("string"==typeof t&&void 0===e[t]){if(!0===/^[xyzwrgbastpq]{1,4}$/.test(t))return t=t.replace(/r|s/g,"x").replace(/g|t/g,"y").replace(/b|p/g,"z").replace(/a|q/g,"w"),new zt(new Lt(e,t));if(!0===/^\d+$/.test(t))return new zt(new Ot(e,cr(Number(t))))}return e[t]}},Gt=new WeakMap,zt=function(e){const t=typeof e;if("number"===t||"boolean"===t)return new zt(tr(e));if("object"===t&&!0===e.isNode){let t=Gt.get(e);return void 0===t&&(t=new Proxy(e,Vt),Gt.set(e,t),Gt.set(t,t)),t}return e},Ht=function(e){for(const t in e)e[t]=new zt(e[t]);return e},jt=e=>{const t=e.length;for(let r=0;r<t;r++)e[r]=new zt(e[r]);return e},Wt=function(e,t=null,r=null){return null===t?(...t)=>new zt(new e(...jt(t))):null===r?(...r)=>new zt(new e(t,...jt(r))):(r=new zt(r),(...i)=>new zt(new e(t,...jt(i),r)))},Xt=[!1,!0],Qt=[0,1,2,3],Yt=[-1,-2],Kt=[.5,1.5,1/3,1e-6,1e6,Math.PI,2*Math.PI,1/Math.PI,2/Math.PI,1/(2*Math.PI),Math.PI/2],qt=new Map;for(let e of Xt)qt.set(e,new st(e));const Jt=new Map;for(let e of Qt)Jt.set(e,new st(e,"uint"));const Zt=new Map([...Jt].map((e=>new st(e.value,"int"))));for(let e of Yt)Zt.set(e,new st(e,"int"));const $t=new Map([...Zt].map((e=>new st(e.value))));for(let e of Kt)$t.set(e,new st(e));for(let e of Kt)$t.set(-e,new st(-e));const er=new Map([...qt,...$t]),tr=e=>er.has(e)?er.get(e):!0===e.isNode?e:new st(e),rr=function(e,t=null){return(...r)=>{if(0===r.length)return nr(new st(Ke(e),e));{if("color"===e&&!0!==r[0].isNode&&(r=[Ke(e,...r)]),1===r.length&&null!==t&&t.has(r[0]))return t.get(r[0]);const i=r.map(tr);return nr(new kt(1===i.length?i[0]:new Bt(i),e))}}},ir=new Proxy((function(e){return(t,r)=>(new Ht(t),new zt(e(t,r)))}),Vt),nr=e=>new zt(e),sr=e=>{var t;return e=!0===e.isNode?(null===(t=e.node)||void 0===t?void 0:t.value)||e.value:e,nr(new $e(e,e.nodeType))},or=new rr("color"),ar=new rr("float",$t),lr=new rr("int",Zt),cr=new rr("uint",Jt),hr=new rr("bool",qt),ur=new rr("vec2"),dr=new rr("ivec2"),pr=new rr("uvec2"),mr=new rr("bvec2"),fr=new rr("vec3"),gr=new rr("ivec3"),vr=new rr("uvec3"),xr=new rr("bvec3"),yr=new rr("vec4"),br=new rr("ivec4"),Ar=new rr("uvec4"),wr=new rr("bvec4"),Mr=new rr("mat3"),Tr=new rr("imat3"),Sr=new rr("umat3"),Cr=new rr("bmat3"),Fr=new rr("mat4"),Er=new rr("imat4"),_r=new rr("umat4"),Pr=new rr("bmat4"),Br=(...e)=>nr(new Bt(jt(e))),Lr=(...e)=>nr(new Et(...e)),Rr=(...e)=>nr(new rt(...e)),Nr=(...e)=>nr(new St(...e)),Dr=(...e)=>nr(new Ut(...jt(e))),Ir=(e,...t)=>(e.node=Ur(e.node,...jt(t)),nr(e)),Ur=new Wt(Rt,"+"),Or=new Wt(Rt,"-"),kr=new Wt(Rt,"*"),Vr=new Wt(Rt,"/"),Gr=new Wt(Rt,"%"),zr=new Wt(Rt,"=="),Hr=new Wt(Rt,"="),jr=new Wt(Rt,"<"),Wr=new Wt(Rt,">"),Xr=new Wt(Rt,"<="),Qr=new Wt(Rt,">="),Yr=new Wt(Rt,"&&"),Kr=new Wt(Rt,"||"),qr=new Wt(Rt,"^^"),Jr=new Wt(Rt,"&"),Zr=new Wt(Rt,"|"),$r=new Wt(Rt,"^"),ei=new Wt(Rt,"<<"),ti=new Wt(Rt,">>"),ri=new Wt(Ot),ii=new zt(new It(It.GEOMETRY)),ni=new zt(new It(It.LOCAL)),si=new zt(new It(It.WORLD)),oi=new zt(new It(It.VIEW)),ai=new zt(new Tt(new It(It.VIEW),"TransformedNormalView","vec3")),li=new zt(new Dt(Dt.LOCAL)),ci=new zt(new Dt(Dt.WORLD)),hi=new zt(new Dt(Dt.VIEW)),ui=new zt(new Dt(Dt.VIEW_DIRECTION)),di=new zt(new Pt(Pt.VIEW_MATRIX)),pi=new zt(new Ft(Ft.POSITION)),mi=new zt(new Mt("DiffuseColor","vec4")),fi=new zt(new Mt("Roughness","float")),gi=new zt(new Mt("Metalness","float")),vi=new zt(new Mt("AlphaTest","float")),xi=new zt(new Mt("SpecularColor","color")),yi=new Wt(Nt,"abs"),bi=new Wt(Nt,"acos"),Ai=new Wt(Nt,"asin"),wi=new Wt(Nt,"atan"),Mi=new Wt(Nt,"ceil"),Ti=new Wt(Nt,"clamp"),Si=new Wt(Nt,"cos"),Ci=new Wt(Nt,"cross"),Fi=new Wt(Nt,"degrees"),Ei=new Wt(Nt,"dFdx"),_i=new Wt(Nt,"dFdy"),Pi=new Wt(Nt,"distance"),Bi=new Wt(Nt,"dot"),Li=new Wt(Nt,"exp"),Ri=new Wt(Nt,"exp2"),Ni=new Wt(Nt,"faceforward"),Di=new Wt(Nt,"floor"),Ii=new Wt(Nt,"fract"),Ui=new Wt(Nt,"invert"),Oi=new Wt(Nt,"inversesqrt"),ki=new Wt(Nt,"length"),Vi=new Wt(Nt,"log"),Gi=new Wt(Nt,"log2"),zi=new Wt(Nt,"max"),Hi=new Wt(Nt,"min"),ji=new Wt(Nt,"mix"),Wi=new Wt(Nt,"mod"),Xi=new Wt(Nt,"negate"),Qi=new Wt(Nt,"normalize"),Yi=new Wt(Nt,"pow"),Ki=new Wt(Nt,"pow",2),qi=new Wt(Nt,"pow",3),Ji=new Wt(Nt,"pow",4),Zi=new Wt(Nt,"radians"),$i=new Wt(Nt,"reflect"),en=new Wt(Nt,"refract"),tn=new Wt(Nt,"round"),rn=new Wt(Nt,"saturate"),nn=new Wt(Nt,"sign"),sn=new Wt(Nt,"sin"),on=new Wt(Nt,"smoothstep"),an=new Wt(Nt,"sqrt"),ln=new Wt(Nt,"step"),cn=new Wt(Nt,"tan"),hn=new Wt(Nt,"transformDirection"),un=ar(1e-6),dn=ar(1e6);class pn extends Je{constructor(e=pn.CUBE){super("vec3"),this.scope=e}getHash(){return`reflect-${this.scope}`}generate(e){const t=this.scope;if(t===pn.VECTOR){const t=Qi(Or(ci,pi));return $i(t,si).build(e)}if(t===pn.CUBE){const t=nr(new pn(pn.VECTOR));return Br(Xi(t.x),t.yz).build(e)}}serialize(e){super.serialize(e),e.scope=this.scope}deserialize(e){super.deserialize(e),this.scope=e.scope}}p.default(pn,"VECTOR","vector"),p.default(pn,"CUBE","cube");class mn extends _t{constructor(e,t=new pn,r=null){super(e,t,r)}getInputType(){return"cubeTexture"}generate(e,t){const r=this.value;if(!r||!0!==r.isCubeTexture)throw new Error("CubeTextureNode: Need a three.js cube texture.");const i=$e.prototype.generate.call(this,e,"cubeTexture");if("sampler"===t)return i+"_sampler";if(e.isReference(t))return i;{const r=e.getDataFromNode(this);let n=r.snippet;if(void 0===n){const t=this.uvNode.build(e,"vec3"),s=this.biasNode;if(null!==s){const r=s.build(e,"float");n=e.getCubeTextureBias(i,t,r)}else n=e.getCubeTexture(i,t);r.snippet=n}return e.format(n,"vec4",t)}}}mn.prototype.isCubeTextureNode=!0;class fn extends Je{constructor(e,t,r=null){super(),this.property=e,this.uniformType=t,this.object=r,this.node=null,this.updateType=Xe,this.setNodeType(t)}setNodeType(e){this.node=new $e(null,e),this.nodeType=e,"color"===e?this.nodeType="vec3":"texture"===e&&(this.nodeType="vec4")}getNodeType(){return this.uniformType}update(e){const t=(null!==this.object?this.object:e.object)[this.property];this.node.value=t}generate(e){return this.node.build(e,this.getNodeType(e))}}class gn extends fn{constructor(e,t,r=null){super(e,t,r),this.material=r}update(e){this.object=null!==this.material?this.material:e.material,super.update(e)}}class vn extends Je{constructor(e=vn.COLOR){super(),this.scope=e}getNodeType(e){const t=this.scope,r=e.context.material;return t===vn.COLOR?null!==r.map?"vec4":"vec3":t===vn.OPACITY?"float":t===vn.SPECULAR?"vec3":t===vn.ROUGHNESS||t===vn.METALNESS?"float":void 0}generate(e,t){const r=e.context.material,i=this.scope;let n=null;if(i===vn.ALPHA_TEST)n=new gn("alphaTest","float");else if(i===vn.COLOR){const e=new gn("color","color");n=null!==r.map&&void 0!==r.map&&!0===r.map.isTexture?new Rt("*",e,new gn("map","texture")):e}else if(i===vn.OPACITY){const e=new gn("opacity","float");n=null!==r.alphaMap&&void 0!==r.alphaMap&&!0===r.alphaMap.isTexture?new Rt("*",e,new gn("alphaMap","texture")):e}else if(i===vn.SPECULAR){const e=new gn("specularColor","color");n=null!==r.specularColorMap&&void 0!==r.specularColorMap&&!0===r.specularColorMap.isTexture?new Rt("*",e,new gn("specularColorMap","texture")):e}else{const t=this.getNodeType(e);n=new gn(i,t)}return n.build(e,t)}}p.default(vn,"ALPHA_TEST","alphaTest"),p.default(vn,"COLOR","color"),p.default(vn,"OPACITY","opacity"),p.default(vn,"SPECULAR","specular"),p.default(vn,"ROUGHNESS","roughness"),p.default(vn,"METALNESS","metalness");class xn extends Je{constructor(e=new Dt){super("vec4"),this.position=e}generate(e){const t=this.position,r=new Rt("*",new Ft(Ft.PROJECTION_MATRIX),new Pt(Pt.VIEW_MATRIX));return new Rt("*",r,t).build(e)}}class yn extends Je{constructor(){super("vec2")}generate(){return"vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y )"}}yn.prototype.isPointUVNode=!0;const bn=new ir(((e,t)=>{const{index:r,weight:i,bindMatrix:n,bindMatrixInverse:s,boneMatrices:o}=e,a=ri(o,r.x),l=ri(o,r.y),c=ri(o,r.z),h=ri(o,r.w),u=kr(n,li),d=Ur(kr(kr(a,u),i.x),kr(kr(l,u),i.y),kr(kr(c,u),i.z),kr(kr(h,u),i.w)),p=kr(s,d).xyz;let m=Ur(kr(i.x,a),kr(i.y,l),kr(i.z,c),kr(i.w,h));m=kr(kr(s,m),n);const f=hn(m,ni).xyz;Hr(li,p).build(t),Hr(ni,f).build(t)}));class An extends Je{constructor(e){super("void"),this.skinnedMesh=e,this.updateType=Xe,this.skinIndexNode=Rr("skinIndex","uvec4"),this.skinWeightNode=Rr("skinWeight","vec4"),this.bindMatrixNode=sr(Fr(e.bindMatrix)),this.bindMatrixInverseNode=sr(Fr(e.bindMatrixInverse)),this.boneMatricesNode=Nr(e.skeleton.boneMatrices,"mat4",e.skeleton.bones.length)}generate(e){bn({index:this.skinIndexNode,weight:this.skinWeightNode,bindMatrix:this.bindMatrixNode,bindMatrixInverse:this.bindMatrixInverseNode,boneMatrices:this.boneMatricesNode},e)}update(){this.skinnedMesh.skeleton.update()}}const wn={LinearToLinear:new ir((e=>e.value)),LinearTosRGB:new ir((e=>{const{value:t}=e,r=t.rgb,i=Or(kr(Yi(t.rgb,fr(.41666)),1.055),fr(.055)),n=kr(r,12.92),s=fr(Xr(r,fr(.0031308))),o=ji(i,n,s);return Br(o.r,o.g,o.b,t.a)}))};class Mn extends Je{constructor(e,t){super("vec4"),this.method=e,this.node=t}fromEncoding(e){let t=null;return 3e3===e?t="Linear":3001===e&&(t="sRGB"),this.method="LinearTo"+t,this}generate(e){const t=this.getNodeType(e),r=this.method,i=this.node;if(r!==Mn.LINEAR_TO_LINEAR){return(0,wn[r])({value:i}).build(e,t)}return i.build(e,t)}}p.default(Mn,"LINEAR_TO_LINEAR","LinearToLinear"),p.default(Mn,"LINEAR_TO_SRGB","LinearTosRGB");const Tn=new ir((e=>{const{eye_pos:t,surf_norm:r,mapN:i,faceDirection:n,uv:s}=e,o=Ei(t.xyz),a=_i(t.xyz),l=Ei(s.st),c=_i(s.st),h=r,u=Ci(a,h),d=Ci(h,o),p=Ur(kr(u,l.x),kr(d,c.x)),m=Ur(kr(u,l.y),kr(d,c.y)),f=zi(Bi(p,p),Bi(m,m)),g=Dr(zr(f,0),0,kr(n,Oi(f)));return Qi(Ur(kr(p,kr(i.x,g)),kr(m,kr(i.y,g)),kr(h,i.z)))}));class Sn extends at{constructor(t,r=null){super("vec3"),this.node=t,this.scaleNode=r,this.normalMapType=e.TangentSpaceNormalMap}generate(t){const r=this.getNodeType(t),{normalMapType:i,scaleNode:n}=this,s=kr(this.node,2);let o=Or(s,1);if(null!==n){const e=kr(o.xy,n);o=Br(e,o.z)}if(i===e.ObjectSpaceNormalMap){const e=kr(new Pt(Pt.NORMAL_MATRIX),o);return Qi(e).build(t,r)}if(i===e.TangentSpaceNormalMap){return Tn({eye_pos:hi,surf_norm:oi,mapN:o,faceDirection:1,uv:Lr()}).build(t,r)}}}const Cn=new ir((e=>{const{f0:t,f90:r,dotVH:i}=e,n=Ri(kr(Or(kr(-5.55473,i),6.98316),i));return Ur(kr(t,Or(1,n)),kr(r,n))})),Fn=new ir((e=>kr(1/Math.PI,e.diffuseColor))),En=new ir((e=>{const{lightDistance:t,cutoffDistance:r,decayExponent:i}=e;return Dr(Yr(Wr(r,0),Wr(i,0)),Yi(rn(Ur(Vr(Xi(t),r),1)),i),1)})),_n=new ir((e=>{const{alpha:t,dotNL:r,dotNV:i}=e,n=Ki(t),s=kr(r,an(Ur(n,kr(Or(1,n),Ki(i))))),o=kr(i,an(Ur(n,kr(Or(1,n),Ki(r)))));return Vr(.5,zi(Ur(s,o),un))})),Pn=new ir((e=>{const{alpha:t,dotNH:r}=e,i=Ki(t),n=Ur(kr(Ki(r),Or(i,1)),1);return kr(1/Math.PI,Vr(i,Ki(n)))})),Bn=new ir((e=>{const{lightDirection:t,f0:r,f90:i,roughness:n}=e,s=Ki(n),o=Qi(Ur(t,ui)),a=rn(Bi(ai,t)),l=rn(Bi(ai,ui)),c=rn(Bi(ai,o)),h=rn(Bi(ui,o)),u=Cn({f0:r,f90:i,dotVH:h}),d=_n({alpha:s,dotNL:a,dotNV:l}),p=Pn({alpha:s,dotNH:c});return kr(u,kr(d,p))})),Ln=new ir((e=>{const{lightDirection:t,lightColor:r,directDiffuse:i,directSpecular:n}=e,s=rn(Bi(ai,t));let o=kr(s,r);o=kr(o,Math.PI),Ir(i,kr(o,Fn({diffuseColor:mi.rgb}))),Ir(n,kr(o,Bn({lightDirection:t,f0:xi,f90:1,roughness:fi})))})),Rn=new ir((e=>{Ln(e)}));class Nn extends ot{constructor(e){super(e)}getNodeType(){return"vec3"}generate(t){let r=null;!0===t.material.isMeshStandardMaterial&&(r=Rn);const i=new Tt(new $e(new e.Vector3),"DirectDiffuse","vec3"),n=new Tt(new $e(new e.Vector3),"DirectSpecular","vec3");this.context.directDiffuse=i,this.context.directSpecular=n,null!==r&&(this.context.lightingModel=r);const s=this.getNodeType(t);super.generate(t,s);return new Rt("+",i,n).build(t,s)}}class Dn extends Je{constructor(t=null){super("vec3"),this.updateType=Xe,this.light=t,this._colorNode=new $e(new e.Color),this._lightCutoffDistanceNode=new $e(0),this._lightDecayExponentNode=new $e(0)}getHash(){return this.light.uuid}update(){this._colorNode.value.copy(this.light.color).multiplyScalar(this.light.intensity),this._lightCutoffDistanceNode.value=this.light.distance,this._lightDecayExponentNode.value=this.light.decay}generate(e){const t=new Ct(Ct.VIEW_POSITION),r=new Dt(Dt.VIEW),i=new Rt("-",t,r),n=new Nt(Nt.NORMALIZE,i),s=new Nt(Nt.LENGTH,i),o=En({lightDistance:s,cutoffDistance:this._lightCutoffDistanceNode,decayExponent:this._lightDecayExponentNode}),a=new Rt("*",this._colorNode,o);t.object3d=this.light;const l=e.context.lightingModel;if(void 0!==l){l({lightDirection:n,lightColor:a,directDiffuse:e.context.directDiffuse,directSpecular:e.context.directSpecular},e)}}}class In extends Je{constructor(e=[]){super("vec3"),this.lightNodes=e,this._hash=null}get hasLight(){return this.lightNodes.length>0}generate(e){const t=this.lightNodes;for(const r of t)r.build(e);return"vec3( 0.0 )"}getHash(){if(null===this._hash){let e="";const t=this.lightNodes;for(const r of t)e+=r.light.uuid+" ";this._hash=e}return this._hash}getLightNodeByHash(e){const t=this.lightNodes;for(const r of t)if(r.light.uuid===e)return r;return null}fromLights(e){const t=[];e=(e=>e.sort(((e,t)=>e.id-t.id)))(e);for(const r of e){let e=this.getLightNodeByHash(r.uuid);null===e&&(e=new Dn(r)),t.push(e)}return this.lightNodes=t,this._hash=null,this}}class Un extends Je{constructor(e,t=new Et,r=new st(0)){super("vec2"),this.countNode=e,this.uvNode=t,this.frameNode=r}generate(e){const t=this.countNode,r=this.uvNode,i=this.frameNode,n=new st(1),s=new Lt(t,"x"),o=new Lt(t,"y"),a=new Rt("*",s,o),l=new Nt(Nt.FLOOR,new Nt(Nt.MOD,i,a)),c=new Rt("+",l,n),h=new Nt(Nt.MOD,l,s),u=new Nt(Nt.CEIL,new Rt("/",c,s)),d=new Rt("-",o,u),p=new Rt("/",n,t),m=new Bt([new Rt("*",h,new Lt(p,"x")),new Rt("*",d,new Lt(p,"y"))]),f=new Rt("*",r,p);return new Rt("+",f,m).build(e,this.getNodeType(e))}}class On extends at{constructor(){super("vec2")}generate(e){const t=Qi(Br(ui.z,0,Xi(ui.x))),r=Ci(ui,t);return Ur(kr(Br(Bi(t,ai),Bi(r,ai)),.495),.5).build(e,this.getNodeType(e))}}class kn extends $e{constructor(e=kn.LOCAL){super(0),this.scope=e,this.scale=1,this.updateType=We}update(e){const t=this.scope,r=this.scale;t===kn.LOCAL?this.value+=e.deltaTime*r:this.value=t===kn.DELTA?e.deltaTime*r:e.time*r}serialize(e){super.serialize(e),e.scope=this.scope,e.scale=this.scale}deserialize(e){super.deserialize(e),this.scope=e.scope,this.scale=e.scale}}p.default(kn,"LOCAL","local"),p.default(kn,"GLOBAL","global"),p.default(kn,"DELTA","delta");class Vn extends Je{constructor(e=Vn.SINE,t=new kn){super(),this.method=e,this.timeNode=t}getNodeType(e){return this.timeNode.getNodeType(e)}generate(e){const t=this.method,r=this.timeNode;let i=null;return t===Vn.SINE?i=Ur(kr(sn(kr(Ur(r,.75),2*Math.PI)),.5),.5):t===Vn.SQUARE?i=tn(Ii(r)):t===Vn.TRIANGLE?i=yi(Or(1,kr(Ii(Ur(r,.5)),2))):t===Vn.SAWTOOTH&&(i=Ii(r)),i.build(e)}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}}p.default(Vn,"SINE","sine"),p.default(Vn,"SQUARE","square"),p.default(Vn,"TRIANGLE","triangle"),p.default(Vn,"SAWTOOTH","sawtooth");const Gn=new ir((e=>{const t=kr(e.uv,2),r=Di(t.x),i=Di(t.y),n=Wi(Ur(r,i),2);return nn(n)}));class zn extends Je{constructor(e=Lr()){super("float"),this.uvNode=e}generate(e){return Gn({uv:this.uvNode}).build(e)}}class Hn extends Je{constructor(e,t){super("float"),this.colorNode=e,this.factorNode=t}generate(e){return this.factorNode.build(e,"float")}}Hn.prototype.isFogNode=!0;class jn extends Hn{constructor(e,t,r){super(e),this.nearNode=t,this.farNode=r}generate(e){return this.factorNode=on(this.nearNode,this.farNode,Xi(hi.z)),super.generate(e)}}jn.prototype.isFogRangeNode=!0;const Wn={ArrayUniformNode:et,AttributeNode:rt,BypassNode:it,CodeNode:nt,ContextNode:ot,ConstNode:st,ExpressionNode:lt,FunctionCallNode:ct,FunctionNode:ht,Node:Je,NodeAttribute:ut,NodeBuilder:bt,NodeCode:ft,NodeFrame:At,NodeFunctionInput:wt,NodeKeywords:gt,NodeUniform:dt,NodeVar:mt,NodeVary:pt,PropertyNode:Mt,TempNode:at,UniformNode:$e,VarNode:Tt,VaryNode:tt,BufferNode:St,CameraNode:Ft,CubeTextureNode:mn,MaterialNode:vn,MaterialReferenceNode:gn,ModelNode:Pt,ModelViewProjectionNode:xn,NormalNode:It,Object3DNode:Ct,PointUVNode:yn,PositionNode:Dt,ReferenceNode:fn,ReflectNode:pn,SkinningNode:An,TextureNode:_t,UVNode:Et,ColorSpaceNode:Mn,NormalMapNode:Sn,MathNode:Nt,OperatorNode:Rt,CondNode:Ut,LightContextNode:Nn,LightNode:Dn,LightsNode:In,ArrayElementNode:Ot,ConvertNode:kt,JoinNode:Bt,SplitNode:Lt,SpriteSheetUVNode:Un,MatcapUVNode:On,OscNode:Vn,TimerNode:kn,CheckerNode:zn,FogNode:Hn,FogRangeNode:jn},Xn=e=>new Wn[e];class Qn extends e.Loader{constructor(e){super(e),this.textures={}}load(e,t,r,i){const n=new FileLoader(this.manager);n.setPath(this.path),n.setRequestHeader(this.requestHeader),n.setWithCredentials(this.withCredentials),n.load(e,(r=>{try{t(this.parse(JSON.parse(r)))}catch(t){i?i(t):console.error(t),this.manager.itemError(e)}}),r,i)}parseNodes(e){const t={};if(void 0!==e){for(const r of e){const{uuid:e,type:i}=r;t[e]=Xn(i),t[e].uuid=e}const r={nodes:t,textures:this.textures};for(const i of e){i.meta=r;t[i.uuid].deserialize(i),delete i.meta}}return t}parse(e){const t=Xn(type);t.uuid=e.uuid;const r={nodes:this.parseNodes(e.inputNodes),textures:this.textures};return e.meta=r,t.deserialize(e),delete e.meta,t}setTextures(e){return this.textures=e,this}}class Yn extends e.MaterialLoader{constructor(e){super(e),this.nodes={}}parse(e){const t=super.parse(e),r=this.nodes,i=e.inputNodes;for(const e in i){const n=i[e];t[e]=r[n]}return t}setNodes(e){return this.nodes=e,this}}class Kn extends e.ObjectLoader{constructor(e){super(e),this._nodesJSON=null}parse(e,t){this._nodesJSON=e.nodes;const r=super.parse(e,t);return this._nodesJSON=null,r}parseNodes(e,t){if(void 0!==e){const r=new Qn;return r.setTextures(t),r.parseNodes(e)}return{}}parseMaterials(e,t){const r={};if(void 0!==e){const i=this.parseNodes(this._nodesJSON,t),n=new Yn;n.setTextures(t),n.setNodes(i);for(let t=0,i=e.length;t<i;t++){const i=e[t];r[i.uuid]=n.parse(i)}}return r}}class qn extends e.ShaderMaterial{constructor(){super(),this.type=this.constructor.name,this.lights=!0}setDefaultValues(e){let t;for(const r in e)t=e[r],void 0===this[r]&&(t&&"function"==typeof t.clone?this[r]=t.clone():this[r]=t);Object.assign(this.defines,e.defines)}toJSON(t){const r=void 0===t||"string"==typeof t;r&&(t={textures:{},images:{},nodes:{}});const i=e.Material.prototype.toJSON.call(this,t),n=Qe(this);i.inputNodes={};for(const e of n)i.inputNodes[e]=this[e].toJSON(t).uuid;function s(e){const t=[];for(const r in e){const i=e[r];delete i.metadata,t.push(i)}return t}if(r){const e=s(t.textures),r=s(t.images),n=s(t.nodes);e.length>0&&(i.textures=e),r.length>0&&(i.images=r),n.length>0&&(i.nodes=n)}return i}}qn.prototype.isNodeMaterial=!0;const Jn=new e.LineBasicMaterial;class Zn extends qn{constructor(e){super(),this.colorNode=null,this.opacityNode=null,this.alphaTestNode=null,this.lightNode=null,this.positionNode=null,this.setDefaultValues(Jn),this.setValues(e)}copy(e){return this.colorNode=e.colorNode,this.opacityNode=e.opacityNode,this.alphaTestNode=e.alphaTestNode,this.lightNode=e.lightNode,this.positionNode=e.positionNode,super.copy(e)}}Zn.prototype.isLineBasicNodeMaterial=!0;const $n=new e.MeshBasicMaterial;class es extends qn{constructor(e){super(),this.lights=!0,this.colorNode=null,this.opacityNode=null,this.alphaTestNode=null,this.lightNode=null,this.positionNode=null,this.setDefaultValues($n),this.setValues(e)}copy(e){return this.colorNode=e.colorNode,this.opacityNode=e.opacityNode,this.alphaTestNode=e.alphaTestNode,this.lightNode=e.lightNode,this.positionNode=e.positionNode,super.copy(e)}}es.prototype.isMeshBasicNodeMaterial=!0;const ts=new e.MeshStandardMaterial;class rs extends qn{constructor(e){super(),this.colorNode=null,this.opacityNode=null,this.alphaTestNode=null,this.normalNode=null,this.emissiveNode=null,this.metalnessNode=null,this.roughnessNode=null,this.clearcoatNode=null,this.clearcoatRoughnessNode=null,this.envNode=null,this.lightNode=null,this.positionNode=null,this.setDefaultValues(ts),this.setValues(e)}copy(e){return this.colorNode=e.colorNode,this.opacityNode=e.opacityNode,this.alphaTestNode=e.alphaTestNode,this.normalNode=e.normalNode,this.emissiveNode=e.emissiveNode,this.metalnessNode=e.metalnessNode,this.roughnessNode=e.roughnessNode,this.clearcoatNode=e.clearcoatNode,this.clearcoatRoughnessNode=e.clearcoatRoughnessNode,this.envNode=e.envNode,this.lightNode=e.lightNode,this.positionNode=e.positionNode,super.copy(e)}}rs.prototype.isMeshStandardNodeMaterial=!0;const is=new e.PointsMaterial;class ns extends qn{constructor(e){super(),this.transparent=!0,this.colorNode=null,this.opacityNode=null,this.alphaTestNode=null,this.lightNode=null,this.sizeNode=null,this.positionNode=null,this.setDefaultValues(is),this.setValues(e)}copy(e){return this.colorNode=e.colorNode,this.opacityNode=e.opacityNode,this.alphaTestNode=e.alphaTestNode,this.lightNode=e.lightNode,this.sizeNode=e.sizeNode,this.positionNode=e.positionNode,super.copy(e)}}ns.prototype.isPointsNodeMaterial=!0;const ss={ArrayUniformNode:et,AttributeNode:rt,BypassNode:it,CodeNode:nt,ContextNode:ot,ConstNode:st,ExpressionNode:lt,FunctionCallNode:ct,FunctionNode:ht,Node:Je,NodeAttribute:ut,NodeBuilder:bt,NodeCode:ft,NodeFrame:At,NodeFunctionInput:wt,NodeKeywords:gt,NodeUniform:dt,NodeVar:mt,NodeVary:pt,PropertyNode:Mt,TempNode:at,UniformNode:$e,VarNode:Tt,VaryNode:tt,BufferNode:St,CameraNode:Ft,CubeTextureNode:mn,MaterialNode:vn,MaterialReferenceNode:gn,ModelNode:Pt,ModelViewProjectionNode:xn,NormalNode:It,Object3DNode:Ct,PointUVNode:yn,PositionNode:Dt,ReferenceNode:fn,ReflectNode:pn,SkinningNode:An,TextureNode:_t,UVNode:Et,ColorSpaceNode:Mn,NormalMapNode:Sn,MathNode:Nt,OperatorNode:Rt,CondNode:Ut,LightContextNode:Nn,LightNode:Dn,LightsNode:In,ArrayElementNode:Ot,ConvertNode:kt,JoinNode:Bt,SplitNode:Lt,SpriteSheetUVNode:Un,MatcapUVNode:On,OscNode:Vn,TimerNode:kn,CheckerNode:zn,FogNode:Hn,FogRangeNode:jn,NodeLoader:Qn,NodeObjectLoader:Kn,NodeMaterialLoader:Yn};class os{constructor(){p.default(this,"pluginCallbacks",void 0),this.pluginCallbacks=[],this.register((function(e){return new Ps(e)})),this.register((function(e){return new Bs(e)})),this.register((function(e){return new Ls(e)})),this.register((function(e){return new Rs(e)})),this.register((function(e){return new Ns(e)}))}register(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}unregister(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,r){const i=new _s,n=[];for(let e=0,t=this.pluginCallbacks.length;e<t;e++)n.push(this.pluginCallbacks[e](i));i.setPlugins(n),i.write(e,t,r)}}p.default(os,"Utils",{insertKeyframe:function(e,t){const r=.001,i=e.getValueSize(),n=new e.TimeBufferType(e.times.length+1),s=new e.ValueBufferType(e.values.length+i),o=e.createInterpolant(new e.ValueBufferType(i));let a;if(0===e.times.length){n[0]=t;for(let e=0;e<i;e++)s[e]=0;a=0}else if(t<e.times[0]){if(Math.abs(e.times[0]-t)<r)return 0;n[0]=t,n.set(e.times,1),s.set(o.evaluate(t),0),s.set(e.values,i),a=0}else if(t>e.times[e.times.length-1]){if(Math.abs(e.times[e.times.length-1]-t)<r)return e.times.length-1;n[n.length-1]=t,n.set(e.times,0),s.set(e.values,0),s.set(o.evaluate(t),e.values.length),a=n.length-1}else for(let l=0;l<e.times.length;l++){if(Math.abs(e.times[l]-t)<r)return l;if(e.times[l]<t&&e.times[l+1]>t){n.set(e.times.slice(0,l+1),0),n[l+1]=t,n.set(e.times.slice(l+1),l+2),s.set(e.values.slice(0,(l+1)*i),0),s.set(o.evaluate(t),(l+1)*i),s.set(e.values.slice((l+1)*i),(l+2)*i),a=l+1;break}}return e.times=n,e.values=s,a},mergeMorphTargetTracks:function(t,r){const i=[],n={},s=t.tracks;for(let t=0;t<s.length;++t){let o=s[t];const a=e.PropertyBinding.parseTrackName(o.name),l=e.PropertyBinding.findNode(r,a.nodeName);if("morphTargetInfluences"!==a.propertyName||void 0===a.propertyIndex){i.push(o);continue}if(o.createInterpolant!==o.InterpolantFactoryMethodDiscrete&&o.createInterpolant!==o.InterpolantFactoryMethodLinear){if(o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."),o=o.clone(),o.setInterpolation(e.InterpolateLinear)}const c=l.morphTargetInfluences.length,h=l.morphTargetDictionary[a.propertyIndex];if(void 0===h)throw new Error("THREE.GLTFExporter: Morph target name not found: "+a.propertyIndex);let u;if(void 0===n[l.uuid]){u=o.clone();const e=new u.ValueBufferType(c*u.times.length);for(let t=0;t<u.times.length;t++)e[t*c+h]=u.values[t];u.name=(a.nodeName||"")+".morphTargetInfluences",u.values=e,n[l.uuid]=u,i.push(u);continue}const d=o.createInterpolant(new o.ValueBufferType(1));u=n[l.uuid];for(let e=0;e<u.times.length;e++)u.values[e*c+h]=d.evaluate(u.times[e]);for(let e=0;e<o.times.length;e++){const t=this.insertKeyframe(u,o.times[e]);u.values[t*c+h]=o.values[e]}}return t.tracks=i,t}});const as=0,ls=1,cs=2,hs=3,us=4,ds=5121,ps=5123,ms=5126,fs=5125,gs=34962,vs=34963,xs=9728,ys=9729,bs=9984,As=9985,ws=9986,Ms=9987,Ts=33071,Ss=33648,Cs=10497,Fs={};Fs[e.NearestFilter]=xs,Fs[e.NearestMipmapNearestFilter]=bs,Fs[e.NearestMipmapLinearFilter]=ws,Fs[e.LinearFilter]=ys,Fs[e.LinearMipmapNearestFilter]=As,Fs[e.LinearMipmapLinearFilter]=Ms,Fs[e.ClampToEdgeWrapping]=Ts,Fs[e.RepeatWrapping]=Cs,Fs[e.MirroredRepeatWrapping]=Ss;const Es={scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"};class _s{constructor(){p.default(this,"plugins",void 0),p.default(this,"options",void 0),p.default(this,"pending",void 0),p.default(this,"buffers",void 0),p.default(this,"byteOffset",void 0),p.default(this,"nodeMap",void 0),p.default(this,"skins",void 0),p.default(this,"extensionsUsed",void 0),p.default(this,"uids",void 0),p.default(this,"uid",void 0),p.default(this,"json",void 0),p.default(this,"cache",void 0),p.default(this,"cachedCanvas",void 0),this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter"}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map},this.cachedCanvas=null}setPlugins(e){this.plugins=e}write(e,t,r){this.options=Object.assign({},{binary:!1,trs:!1,onlyVisible:!0,truncateDrawRange:!0,embedImages:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},r),void 0!==this.options.animations&&this.options.animations.length>0&&(this.options.trs=!0),this.processInput(e);const i=this;Promise.all(this.pending).then((()=>{const e=i.buffers,r=i.json,n=i.options,s=i.extensionsUsed,o=new Blob(e,{type:"application/octet-stream"}),a=Object.keys(s);if(a.length>0&&(r.extensionsUsed=a),r.buffers&&r.buffers.length>0&&(r.buffers[0].byteLength=o.size),n.binary){const e=new window.FileReader;e.readAsArrayBuffer(o),e.onloadend=()=>{if(null!==e.result&&"string"!=typeof e.result){const i=this.getPaddedArrayBuffer(e.result),n=new DataView(new ArrayBuffer(8));n.setUint32(0,i.byteLength,!0),n.setUint32(4,5130562,!0);const s=this.getPaddedArrayBuffer(this.stringToArrayBuffer(JSON.stringify(r)),32),o=new DataView(new ArrayBuffer(8));o.setUint32(0,s.byteLength,!0),o.setUint32(4,1313821514,!0);const a=new ArrayBuffer(12),l=new DataView(a);l.setUint32(0,1179937895,!0),l.setUint32(4,2,!0);const c=12+o.byteLength+s.byteLength+n.byteLength+i.byteLength;l.setUint32(8,c,!0);const h=new Blob([a,o,s,n,i],{type:"application/octet-stream"}),u=new window.FileReader;u.readAsArrayBuffer(h),u.onloadend=function(){null!==u.result&&"string"!=typeof u.result&&t(u.result)}}}}else if(r.buffers&&r.buffers.length>0){const e=new window.FileReader;e.readAsDataURL(o),e.onloadend=function(){const i=e.result;void 0!==r.buffers&&null!==i&&(r.buffers[0].uri=i,t(r))}}else t(r)}))}serializeUserData(e,t){if(0===Object.keys(e.userData).length)return;const r=this.options,i=this.extensionsUsed;try{const n=JSON.parse(JSON.stringify(e.userData));if(r.includeCustomExtensions&&n.gltfExtensions){void 0===t.extensions&&(t.extensions={});for(const e in n.gltfExtensions)t.extensions[e]=n.gltfExtensions[e],i[e]=!0;delete n.gltfExtensions}Object.keys(n).length>0&&(t.extras=n)}catch(t){t instanceof Error&&console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+t.message)}}getUID(e){return this.uids.has(e)||this.uids.set(e,this.uid++),this.uids.get(e)}isNormalizedNormalAttribute(t){if(this.cache.attributesNormalized.has(t))return!1;const r=new e.Vector3;for(let e=0,i=t.count;e<i;e++)if(Math.abs(r.fromBufferAttribute(t,e).length()-1)>5e-4)return!1;return!0}createNormalizedNormalAttribute(t){const r=this.cache;if(r.attributesNormalized.has(t))return r.attributesNormalized.get(t);const i=t.clone(),n=new e.Vector3;for(let e=0,t=i.count;e<t;e++)n.fromBufferAttribute(i,e),0===n.x&&0===n.y&&0===n.z?n.setX(1):n.normalize(),i.setXYZ(e,n.x,n.y,n.z);return r.attributesNormalized.set(t,i),i}applyTextureTransform(e,t){let r=!1;const i={};0===t.offset.x&&0===t.offset.y||(i.offset=t.offset.toArray(),r=!0),0!==t.rotation&&(i.rotation=t.rotation,r=!0),1===t.repeat.x&&1===t.repeat.y||(i.scale=t.repeat.toArray(),r=!0),r&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=i,this.extensionsUsed.KHR_texture_transform=!0)}processBuffer(e){const t=this.json,r=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),r.push(e),0}processBufferView(e,t,r,i,n){const s=this.json;let o;s.bufferViews||(s.bufferViews=[]),o=t===ds?1:t===ps?2:4;const a=this.getPaddedBufferSize(i*e.itemSize*o),l=new DataView(new ArrayBuffer(a));let c=0;for(let n=r;n<r+i;n++)for(let r=0;r<e.itemSize;r++){let i;e.itemSize>4?i=e.array[n*e.itemSize+r]:0===r?i=e.getX(n):1===r?i=e.getY(n):2===r?i=e.getZ(n):3===r&&(i=e.getW(n)),void 0!==i&&(t===ms?l.setFloat32(c,i,!0):t===fs?l.setUint32(c,i,!0):t===ps?l.setUint16(c,i,!0):t===ds&&l.setUint8(c,i)),c+=o}const h={buffer:this.processBuffer(l.buffer),byteOffset:this.byteOffset,byteLength:a};void 0!==n&&(h.target=n),n===gs&&(h.byteStride=e.itemSize*o),this.byteOffset+=a,s.bufferViews.push(h);return{id:s.bufferViews.length-1,byteLength:0}}processBufferViewImage(e){const t=this,r=t.json;return r.bufferViews||(r.bufferViews=[]),new Promise((i=>{const n=new window.FileReader;n.readAsArrayBuffer(e),n.onloadend=()=>{if(null!==n.result&&"string"!=typeof n.result&&void 0!==r.bufferViews){const e=this.getPaddedArrayBuffer(n.result),s={buffer:t.processBuffer(e),byteOffset:t.byteOffset,byteLength:e.byteLength};t.byteOffset+=e.byteLength,i(r.bufferViews.push(s)-1)}}}))}processAccessor(e,t,r,i){const n=this.options,s=this.json,o={1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",16:"MAT4"};let a;if(e.array.constructor===Float32Array)a=ms;else if(e.array.constructor===Uint32Array)a=fs;else if(e.array.constructor===Uint16Array)a=ps;else{if(e.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");a=ds}if(void 0===r&&(r=0),void 0===i&&(i=e.count),n.truncateDrawRange&&void 0!==t&&null===t.index){const n=r+i,s=t.drawRange.count===1/0?e.count:t.drawRange.start+t.drawRange.count;r=Math.max(r,t.drawRange.start),(i=Math.min(n,s)-r)<0&&(i=0)}if(0===i)return null;const l=this.getMinMax(e,r,i);let c;if(void 0!==t&&(c=e===t.index?vs:gs),void 0!==c){const t=this.processBufferView(e,a,r,i,c),n={bufferView:t.id,byteOffset:t.byteOffset,componentType:a,count:i,max:l.max,min:l.min,type:o[e.itemSize]};return e.normalized&&(n.normalized=!0),s.accessors||(s.accessors=[]),s.accessors.push(n)-1}}processImage(t,r,i){const n=this,s=n.cache,o=n.json,a=n.options,l=n.pending;s.images.has(t)||s.images.set(t,{});const c=s.images.get(t),h=r===e.RGBAFormat?"image/png":"image/jpeg",u=h+":flipY/"+i.toString();if(void 0!==c&&void 0!==c[u])return c[u];o.images||(o.images=[]);const d={mimeType:h};if(a.embedImages&&void 0!==a.maxTextureSize){const s=this.cachedCanvas=this.cachedCanvas||document.createElement("canvas");s.width=Math.min(t.width,a.maxTextureSize),s.height=Math.min(t.height,a.maxTextureSize);const o=s.getContext("2d");if(i&&(null==o||o.translate(0,s.height),null==o||o.scale(1,-1)),"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap)null==o||o.drawImage(t,0,0,s.width,s.height);else{r!==e.RGBAFormat&&console.error("GLTFExporter: Only RGBA format is supported."),(t.width>a.maxTextureSize||t.height>a.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",t);const i=new Uint8ClampedArray(t.height*t.width*4);if(t instanceof ImageData)for(let e=0;e<i.length;e+=4)i[e+0]=t.data[e+0],i[e+1]=t.data[e+1],i[e+2]=t.data[e+2],i[e+3]=t.data[e+3];null==o||o.putImageData(new ImageData(i,t.width,t.height),0,0)}a.binary?l.push(new Promise((function(e){s.toBlob((function(t){null!==t&&n.processBufferViewImage(t).then((function(t){d.bufferView=t,e()}))}),h)}))):d.uri=s.toDataURL(h)}else t instanceof Image&&(d.uri=t.src);const p=o.images.push(d)-1;return void 0!==c&&(c[u]=p),p}processSampler(e){const t=this.json;t.samplers||(t.samplers=[]);const r={magFilter:Fs[e.magFilter],minFilter:Fs[e.minFilter],wrapS:Fs[e.wrapS],wrapT:Fs[e.wrapT]};return t.samplers.push(r)-1}processTexture(e){const t=this.cache,r=this.json;if(t.textures.has(e))return t.textures.get(e);r.textures||(r.textures=[]);const i={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY)};e.name&&(i.name=e.name),this._invokeAll((function(t){t.writeTexture&&t.writeTexture(e,i)}));const n=r.textures.push(i)-1;return t.textures.set(e,n),n}processMaterial(t){const r=this.cache,i=this.json;if(r.materials.has(t))return r.materials.get(t);if(t instanceof e.ShaderMaterial&&t.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;i.materials||(i.materials=[]);const n={pbrMetallicRoughness:{}};if(t instanceof e.MeshStandardMaterial&&t.isMeshStandardMaterial&&t instanceof e.MeshBasicMaterial&&t.isMeshBasicMaterial||console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results."),t instanceof e.MeshStandardMaterial||t instanceof e.MeshPhysicalMaterial){const e=t.color.toArray().concat([t.opacity]);this.equalArray(e,[1,1,1,1])||(n.pbrMetallicRoughness.baseColorFactor=e)}if(t instanceof e.MeshStandardMaterial&&t.isMeshStandardMaterial?(n.pbrMetallicRoughness.metallicFactor=t.metalness,n.pbrMetallicRoughness.roughnessFactor=t.roughness):(n.pbrMetallicRoughness.metallicFactor=.5,n.pbrMetallicRoughness.roughnessFactor=.5),t instanceof e.MeshStandardMaterial&&t.metalnessMap||t instanceof e.MeshStandardMaterial&&t.roughnessMap)if(t.metalnessMap===t.roughnessMap&&null!==t.metalnessMap){const e={index:this.processTexture(t.metalnessMap)};this.applyTextureTransform(e,t.metalnessMap),n.pbrMetallicRoughness.metallicRoughnessTexture=e}else console.warn("THREE.GLTFExporter: Ignoring metalnessMap and roughnessMap because they are not the same Texture.");if((t instanceof e.MeshStandardMaterial||t instanceof e.MeshPhysicalMaterial)&&t.map){const e={index:this.processTexture(t.map)};this.applyTextureTransform(e,t.map),n.pbrMetallicRoughness.baseColorTexture=e}if((t instanceof e.MeshStandardMaterial||t instanceof e.MeshPhysicalMaterial)&&t.emissive){const e=t.emissive.clone().multiplyScalar(t.emissiveIntensity),r=Math.max(e.r,e.g,e.b);if(r>1&&(e.multiplyScalar(1/r),console.warn("THREE.GLTFExporter: Some emissive components exceed 1; emissive has been limited")),r>0&&(n.emissiveFactor=e.toArray()),t.emissiveMap){const e={index:this.processTexture(t.emissiveMap)};this.applyTextureTransform(e,t.emissiveMap),n.emissiveTexture=e}}if((t instanceof e.MeshMatcapMaterial||t instanceof e.MeshNormalMaterial||t instanceof e.MeshPhongMaterial||t instanceof e.MeshStandardMaterial||t instanceof e.MeshToonMaterial)&&t.normalMap){const e={index:this.processTexture(t.normalMap)};t.normalScale&&1!==t.normalScale.x&&(e.scale=t.normalScale.x),this.applyTextureTransform(e,t.normalMap),n.normalTexture=e}if((t instanceof e.MeshBasicMaterial||t instanceof e.MeshLambertMaterial||t instanceof e.MeshPhongMaterial||t instanceof e.MeshStandardMaterial||t instanceof e.MeshToonMaterial)&&t.aoMap){const e={index:this.processTexture(t.aoMap),texCoord:1};1!==t.aoMapIntensity&&(e.strength=t.aoMapIntensity),this.applyTextureTransform(e,t.aoMap),n.occlusionTexture=e}t.transparent?n.alphaMode="BLEND":t.alphaTest>0&&(n.alphaMode="MASK",n.alphaCutoff=t.alphaTest),t.side===e.DoubleSide&&(n.doubleSided=!0),""!==t.name&&(n.name=t.name),this.serializeUserData(t,n),this._invokeAll((function(e){e.writeMaterial&&e.writeMaterial(t,n)}));const s=i.materials.push(n)-1;return r.materials.set(t,s),s}processMesh(t){const r=this.cache,i=this.json,n=[t.geometry.uuid];if(Array.isArray(t.material))for(let e=0,r=t.material.length;e<r;e++)n.push(t.material[e].uuid);else n.push(t.material.uuid);const s=n.join(":");if(r.meshes.has(s))return r.meshes.get(s);const o=t.geometry;let a;if(a=t instanceof e.LineSegments&&t.isLineSegments?ls:t instanceof e.LineLoop&&t.isLineLoop?cs:t instanceof e.Line&&t.isLine?hs:t instanceof e.Points&&t.isPoints?as:(t.material instanceof e.MeshBasicMaterial||t.material instanceof e.MeshDepthMaterial||t.material instanceof e.MeshLambertMaterial||t.material instanceof e.MeshNormalMaterial||t.material instanceof e.MeshPhongMaterial||t.material instanceof e.MeshStandardMaterial||t.material instanceof e.MeshToonMaterial||t.material instanceof e.ShaderMaterial)&&t.material.wireframe?ls:us,!o.isBufferGeometry)throw new Error("THREE.GLTFExporter: Geometry is not of type THREE.BufferGeometry.");const l={},c={},h=[],u=[],d={uv:"TEXCOORD_0",uv2:"TEXCOORD_1",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},p=o.getAttribute("normal");void 0===p||p instanceof e.InterleavedBufferAttribute||this.isNormalizedNormalAttribute(p)||(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),o.setAttribute("normal",this.createNormalizedNormalAttribute(p)));let m=null;for(let t in o.attributes){if("morph"===t.substr(0,5))continue;const i=o.attributes[t];t=d[t]||t.toUpperCase();if(/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(t)||(t="_"+t),r.attributes.has(this.getUID(i))){c[t]=r.attributes.get(this.getUID(i));continue}m=null;const n=i.array;"JOINTS_0"!==t||n instanceof Uint16Array||n instanceof Uint8Array||(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),m=new e.BufferAttribute(new Uint16Array(n),i.itemSize,i.normalized));const s=null!==m&&this.processAccessor(m||i,o);s&&(c[t]=s,r.attributes.set(this.getUID(i),s))}if(void 0!==p&&o.setAttribute("normal",p),0===Object.keys(c).length)return null;if(void 0!==t.morphTargetInfluences&&t.morphTargetInfluences.length>0){const e=[],i=[],n={};if(void 0!==t.morphTargetDictionary)for(const e in t.morphTargetDictionary)n[t.morphTargetDictionary[e]]=e;for(let s=0;s<t.morphTargetInfluences.length;++s){const a={};let l=!1;for(const e in o.morphAttributes){if("position"!==e&&"normal"!==e){l||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),l=!0);continue}const t=o.morphAttributes[e][s],i=e.toUpperCase(),n=o.attributes[e];if(r.attributes.has(this.getUID(t))){a[i]=r.attributes.get(this.getUID(t));continue}const c=t.clone();if(!o.morphTargetsRelative)for(let e=0,r=t.count;e<r;e++)c.setXYZ(e,t.getX(e)-n.getX(e),t.getY(e)-n.getY(e),t.getZ(e)-n.getZ(e));const h=this.processAccessor(c,o);null!=h&&(a[i]=h),r.attributes.set(this.getUID(n),a[i])}u.push(a),e.push(t.morphTargetInfluences[s]),void 0!==t.morphTargetDictionary&&i.push(n[s])}l.weights=e,i.length>0&&(l.extras={},l.extras.targetNames=i)}const f=Array.isArray(t.material);if(f&&0===o.groups.length)return null;const g=f?t.material:[t.material],v=f?o.groups:[{materialIndex:0,start:void 0,count:void 0}];for(let t=0,i=v.length;t<i;t++){const i={mode:a,attributes:c};if((o instanceof e.Object3D||o instanceof e.Material)&&this.serializeUserData(o,i),u.length>0&&(i.targets=u),null!==o.index){let e=this.getUID(o.index);void 0===v[t].start&&void 0===v[t].count||(e+=`:${v[t].start}:${v[t].count}`),r.attributes.has(e)?i.indices=r.attributes.get(e):(i.indices=this.processAccessor(o.index,o,v[t].start,v[t].count),r.attributes.set(e,i.indices)),null===i.indices&&delete i.indices}const n=v[t].materialIndex;if(void 0!==n&&Array.isArray(g)){const e=g[n];if(!Array.isArray(e)){const t=this.processMaterial(e);null!==t&&(i.material=t),h.push(i)}}}l.primitives=h,i.meshes||(i.meshes=[]),this._invokeAll((function(e){e.writeMesh&&e.writeMesh(t,l)}));const x=i.meshes.push(l)-1;return r.meshes.set(s,x),x}processCamera(t){const r=this.json;r.cameras||(r.cameras=[]);const i=t instanceof e.OrthographicCamera&&t.isOrthographicCamera,n={type:i?"orthographic":"perspective"};return t instanceof e.OrthographicCamera&&i?n.orthographic={xmag:2*t.right,ymag:2*t.top,zfar:t.far<=0?.001:t.far,znear:t.near<0?0:t.near}:t instanceof e.PerspectiveCamera&&(n.perspective={aspectRatio:t.aspect,yfov:e.MathUtils.degToRad(t.fov),zfar:t.far<=0?.001:t.far,znear:t.near<0?0:t.near}),""!==t.name&&(n.name=t.type),r.cameras.push(n)-1}processAnimation(t,r){const i=this.json,n=this.nodeMap;i.animations||(i.animations=[]);const s=(t=os.Utils.mergeMorphTargetTracks(t.clone(),r)).tracks,o=[],a=[];for(let t=0;t<s.length;++t){const i=s[t],l=e.PropertyBinding.parseTrackName(i.name);let c=e.PropertyBinding.findNode(r,l.nodeName);const h=Es[l.propertyName];if("bones"===l.objectName&&(c=c.isSkinnedMesh?c.skeleton.getBoneByName(l.objectIndex):void 0),!c||!h)return console.warn('THREE.GLTFExporter: Could not export animation track "%s".',i.name),null;const u=1;let d,p=i.values.length/i.times.length;h===Es.morphTargetInfluences&&(p/=c.morphTargetInfluences.length),i.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(d="CUBICSPLINE",p/=3):d=i.getInterpolation()===e.InterpolateDiscrete?"STEP":"LINEAR",a.push({input:this.processAccessor(new e.BufferAttribute(i.times,u)),output:this.processAccessor(new e.BufferAttribute(i.values,p)),interpolation:d}),o.push({sampler:a.length-1,target:{node:n.get(c),path:h}})}return i.animations.push({name:t.name||"clip_"+i.animations.length,samplers:a,channels:o}),i.animations.length-1}processSkin(t){const r=this.json,i=this.nodeMap;if(void 0!==r.nodes&&t instanceof e.SkinnedMesh){const n=r.nodes[i.get(t)],s=t.skeleton;if(void 0===s)return null;const o=t.skeleton.bones[0];if(void 0===o)return null;const a=[],l=new Float32Array(16*s.bones.length),c=new e.Matrix4;for(let e=0;e<s.bones.length;++e)a.push(i.get(s.bones[e])),c.copy(s.boneInverses[e]),c.multiply(t.bindMatrix).toArray(l,16*e);void 0===r.skins&&(r.skins=[]),r.skins.push({inverseBindMatrices:this.processAccessor(new e.BufferAttribute(l,16)),joints:a,skeleton:i.get(o)});return n.skin=r.skins.length-1}return null}processNode(t){const r=this.json,i=this.options,n=this.nodeMap;r.nodes||(r.nodes=[]);const s={};if(i.trs){const e=t.quaternion.toArray(),r=t.position.toArray(),i=t.scale.toArray();this.equalArray(e,[0,0,0,1])||(s.rotation=e),this.equalArray(r,[0,0,0])||(s.translation=r),this.equalArray(i,[1,1,1])||(s.scale=i)}else t.matrixAutoUpdate&&t.updateMatrix(),this.isIdentityMatrix(t.matrix)||(s.matrix=t.matrix.elements);if(""!==t.name&&(s.name=String(t.name)),this.serializeUserData(t,s),(t instanceof e.Mesh&&t.isMesh||t instanceof e.Line&&t.isLine||t instanceof e.Points&&t.isPoints)&&t instanceof e.Mesh){const e=this.processMesh(t);null!==e&&(s.mesh=e)}else t instanceof e.Camera&&t.isCamera&&(s.camera=this.processCamera(t));if(t instanceof e.SkinnedMesh&&t.isSkinnedMesh&&this.skins.push(t),t.children.length>0){const e=[];for(let r=0,n=t.children.length;r<n;r++){const n=t.children[r];if(n.visible||!i.onlyVisible){const t=this.processNode(n);null!==t&&e.push(t)}}e.length>0&&(s.children=e)}this._invokeAll((function(e){e.writeNode&&e.writeNode(t,s)}));const o=r.nodes.push(s)-1;return n.set(t,o),o}processScene(e){const t=this.json,r=this.options;t.scenes||(t.scenes=[],t.scene=0);const i={};""!==e.name&&(i.name=e.name),t.scenes.push(i);const n=[];for(let t=0,i=e.children.length;t<i;t++){const i=e.children[t];if(i.visible||!r.onlyVisible){const e=this.processNode(i);null!==e&&n.push(e)}}n.length>0&&(i.nodes=n),this.serializeUserData(e,i)}processObjects(t){const r=new e.Scene;r.name="AuxScene";for(let e=0;e<t.length;e++)r.children.push(t[e]);this.processScene(r)}processInput(t){const r=this.options;t=t instanceof Array?t:[t],this._invokeAll((function(e){e.beforeParse&&e.beforeParse(t)}));const i=[];for(let r=0;r<t.length;r++){const n=t[r];n instanceof e.Scene?this.processScene(n):i.push(t[r])}i.length>0&&this.processObjects(i);for(let e=0;e<this.skins.length;++e)this.processSkin(this.skins[e]);for(let e=0;void 0!==r.animations&&e<r.animations.length;++e)this.processAnimation(r.animations[e],t[0]);this._invokeAll((function(e){e.afterParse&&e.afterParse(t)}))}_invokeAll(e){for(let t=0,r=this.plugins.length;t<r;t++)e(this.plugins[t])}equalArray(e,t){return e.length===t.length&&e.every((function(e,r){return e===t[r]}))}stringToArrayBuffer(e){if(void 0!==window.TextEncoder)return(new TextEncoder).encode(e).buffer;const t=new Uint8Array(new ArrayBuffer(e.length));for(let r=0,i=e.length;r<i;r++){const i=e.charCodeAt(r);t[r]=i>255?32:i}return t.buffer}isIdentityMatrix(e){return this.equalArray(e.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}getMinMax(e,t,r){const i={min:new Array(e.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(e.itemSize).fill(Number.NEGATIVE_INFINITY)};for(let n=t;n<t+r;n++)for(let t=0;t<e.itemSize;t++){let r;e.itemSize>4?r=e.array[n*e.itemSize+t]:0===t?r=e.getX(n):1===t?r=e.getY(n):2===t?r=e.getZ(n):3===t&&(r=e.getW(n)),void 0!==r&&(i.min[t]=Math.min(i.min[t],r),i.max[t]=Math.max(i.max[t],r))}return i}getPaddedBufferSize(e){return 4*Math.ceil(e/4)}getPaddedArrayBuffer(e,t=0){const r=this.getPaddedBufferSize(e.byteLength);if(r!==e.byteLength){const i=new Uint8Array(r);if(i.set(new Uint8Array(e)),0!==t)for(let n=e.byteLength;n<r;n++)i[n]=t;return i.buffer}return e}}class Ps{constructor(e){p.default(this,"writer",void 0),p.default(this,"name",void 0),this.writer=e,this.name="KHR_lights_punctual"}writeNode(t,r){if(!t.isLight)return;if(!(t instanceof e.DirectionalLight&&t.isDirectionalLight||t instanceof e.PointLight&&t.isPointLight||t instanceof e.SpotLight&&t.isSpotLight))return void console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",t);const i=this.writer,n=i.json,s=i.extensionsUsed,o={};if(t.name&&(o.name=t.name),o.color=t.color.toArray(),o.intensity=t.intensity,t instanceof e.DirectionalLight&&t.isDirectionalLight?o.type="directional":t instanceof e.PointLight&&t.isPointLight?(o.type="point",t.distance>0&&(o.range=t.distance)):t instanceof e.SpotLight&&t.isSpotLight&&(o.type="spot",t.distance>0&&(o.range=t.distance),o.spot={},o.spot.innerConeAngle=(t.penumbra-1)*t.angle*-1,o.spot.outerConeAngle=t.angle),t instanceof e.DirectionalLight||void 0===t.decay||2===t.decay||console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),t instanceof e.PointLight||!t.target||t.target.parent===t&&0===t.target.position.x&&0===t.target.position.y&&-1===t.target.position.z||console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),s[this.name]||(n.extensions=n.extensions||{},n.extensions[this.name]={lights:[]},s[this.name]=!0),void 0!==n.extensions){const e=n.extensions[this.name].lights;e.push(o),r.extensions=r.extensions||{},r.extensions[this.name]={light:e.length-1}}}}class Bs{constructor(e){p.default(this,"writer",void 0),p.default(this,"name",void 0),this.writer=e,this.name="KHR_materials_unlit"}writeMaterial(t,r){if(!(t instanceof e.MeshBasicMaterial&&t.isMeshBasicMaterial))return;const i=this.writer.extensionsUsed;r.extensions=r.extensions||{},r.extensions[this.name]={},i[this.name]=!0,r.pbrMetallicRoughness.metallicFactor=0,r.pbrMetallicRoughness.roughnessFactor=.9}}class Ls{constructor(e){p.default(this,"writer",void 0),p.default(this,"name",void 0),this.writer=e,this.name="KHR_materials_pbrSpecularGlossiness"}writeMaterial(t,r){if(!t.isGLTFSpecularGlossinessMaterial)return;const i=this.writer,n=i.extensionsUsed,s={};if(r.pbrMetallicRoughness.baseColorFactor&&(s.diffuseFactor=r.pbrMetallicRoughness.baseColorFactor),t instanceof e.MeshPhongMaterial){const e=[1,1,1];t.specular.toArray(e,0),s.specularFactor=e,s.glossinessFactor=t.glossiness}if(r.pbrMetallicRoughness.baseColorTexture&&(s.diffuseTexture=r.pbrMetallicRoughness.baseColorTexture),(t instanceof e.MeshBasicMaterial||t instanceof e.MeshLambertMaterial||t instanceof e.MeshPhongMaterial)&&t.specularMap){const e={index:i.processTexture(t.specularMap)};i.applyTextureTransform(e,t.specularMap),s.specularGlossinessTexture=e}r.extensions=r.extensions||{},r.extensions[this.name]=s,n[this.name]=!0}}class Rs{constructor(e){p.default(this,"writer",void 0),p.default(this,"name",void 0),this.writer=e,this.name="KHR_materials_transmission"}writeMaterial(t,r){if(!(t instanceof e.MeshPhysicalMaterial&&t.isMeshPhysicalMaterial)||0===t.transmission)return;const i=this.writer,n=i.extensionsUsed,s={};if(s.transmissionFactor=t.transmission,t.transmissionMap){const e={index:i.processTexture(t.transmissionMap)};i.applyTextureTransform(e,t.transmissionMap),s.transmissionTexture=e}r.extensions=r.extensions||{},r.extensions[this.name]=s,n[this.name]=!0}}class Ns{constructor(e){p.default(this,"writer",void 0),p.default(this,"name",void 0),this.writer=e,this.name="KHR_materials_volume"}writeMaterial(t,r){if(!(t instanceof e.MeshPhysicalMaterial&&t.isMeshPhysicalMaterial)||0===t.thickness)return;const i=this.writer,n=i.extensionsUsed,s={};if(s.thickness=t.thickness,t.thicknessMap){const e={index:i.processTexture(t.thicknessMap)};i.applyTextureTransform(e,t.thicknessMap),s.thicknessTexture=e}s.attenuationDistance=t.attenuationDistance,s.attenuationColor=t.attenuationTint.toArray(),r.extensions=r.extensions||{},r.extensions[this.name]=s,n[this.name]=!0}}class Ds{parse(t,r={decodeSpeed:5,encodeSpeed:5,encoderMethod:Ds.MESH_EDGEBREAKER_ENCODING,quantization:[16,8,8,8,8],exportUvs:!0,exportNormals:!0,exportColor:!1}){if(t instanceof e.BufferGeometry&&t.isBufferGeometry)throw new Error("DRACOExporter: The first parameter of parse() is now an instance of Mesh or Points.");if(void 0===DracoEncoderModule)throw new Error("THREE.DRACOExporter: required the draco_encoder to work.");const i=t.geometry,n=DracoEncoderModule(),s=new n.Encoder;let o,a;if(!i.isBufferGeometry)throw new Error("THREE.DRACOExporter.parse(geometry, options): geometry is not a THREE.BufferGeometry instance.");if(t instanceof e.Mesh&&t.isMesh){o=new n.MeshBuilder,a=new n.Mesh;const e=i.getAttribute("position");o.AddFloatAttributeToMesh(a,n.POSITION,e.count,e.itemSize,e.array);const t=i.getIndex();if(null!==t)o.AddFacesToMesh(a,t.count/3,t.array);else{const t=new(e.count>65535?Uint32Array:Uint16Array)(e.count);for(let e=0;e<t.length;e++)t[e]=e;o.AddFacesToMesh(a,e.count,t)}if(r.exportNormals){const e=i.getAttribute("normal");void 0!==e&&o.AddFloatAttributeToMesh(a,n.NORMAL,e.count,e.itemSize,e.array)}if(r.exportUvs){const e=i.getAttribute("uv");void 0!==e&&o.AddFloatAttributeToMesh(a,n.TEX_COORD,e.count,e.itemSize,e.array)}if(r.exportColor){const e=i.getAttribute("color");void 0!==e&&o.AddFloatAttributeToMesh(a,n.COLOR,e.count,e.itemSize,e.array)}}else{if(!(t instanceof e.Points&&t.isPoints))throw new Error("DRACOExporter: Unsupported object type.");{o=new n.PointCloudBuilder,a=new n.PointCloud;const e=i.getAttribute("position");if(o.AddFloatAttribute(a,n.POSITION,e.count,e.itemSize,e.array),r.exportColor){const e=i.getAttribute("color");void 0!==e&&o.AddFloatAttribute(a,n.COLOR,e.count,e.itemSize,e.array)}}}const l=new n.DracoInt8Array,c=void 0!==r.encodeSpeed?r.encodeSpeed:5,h=void 0!==r.decodeSpeed?r.decodeSpeed:5;if(s.SetSpeedOptions(c,h),void 0!==r.encoderMethod&&s.SetEncodingMethod(r.encoderMethod),void 0!==r.quantization)for(let e=0;e<5;e++)void 0!==r.quantization[e]&&s.SetAttributeQuantization(e,r.quantization[e]);let u;if(u=t instanceof e.Mesh&&t.isMesh?s.EncodeMeshToDracoBuffer(a,l):s.EncodePointCloudToDracoBuffer(a,!0,l),n.destroy(a),0===u)throw new Error("THREE.DRACOExporter: Draco encoding failed.");const d=new Int8Array(new ArrayBuffer(u));for(let e=0;e<u;e++)d[e]=l.GetValue(e);return n.destroy(l),n.destroy(s),n.destroy(o),d}}p.default(Ds,"MESH_EDGEBREAKER_ENCODING",1),p.default(Ds,"MESH_SEQUENTIAL_ENCODING",0),p.default(Ds,"POINT_CLOUD",0),p.default(Ds,"TRIANGULAR_MESH",1),p.default(Ds,"INVALID",-1),p.default(Ds,"POSITION",0),p.default(Ds,"NORMAL",1),p.default(Ds,"COLOR",2),p.default(Ds,"TEX_COORD",3),p.default(Ds,"GENERIC",4);const Is=()=>{};Is.CreateRotationAnimation=(t,r)=>{const i=[0,t],n=`.rotation[${r=r||"x"}]`,s=new e.NumberKeyframeTrack(n,i,[0,360]);return new e.AnimationClip(null,t,[s])},Is.CreateScaleAxisAnimation=(t,r)=>{const i=[0,t],n=`.scale[${r=r||"x"}]`,s=new e.NumberKeyframeTrack(n,i,[0,1]);return new e.AnimationClip(null,t,[s])},Is.CreateShakeAnimation=(t,r)=>{const i=[],n=[],s=new e.Vector3;for(let e=0;e<10*t;e++)i.push(e/10),s.set(2*Math.random()-1,2*Math.random()-1,2*Math.random()-1).multiply(r).toArray(n,n.length);const o=new e.VectorKeyframeTrack(".position",i,n);return new e.AnimationClip(null,t,[o])},Is.CreatePulsationAnimation=(t,r)=>{const i=[],n=[],s=new e.Vector3;for(let e=0;e<10*t;e++){i.push(e/10);const t=Math.random()*r;s.set(t,t,t).toArray(n,n.length)}const o=new e.VectorKeyframeTrack(".scale",i,n);return new e.AnimationClip(null,t,[o])},Is.CreateVisibilityAnimation=t=>{const r=[0,t/2,t],i=new e.BooleanKeyframeTrack(".visible",r,[!0,!1,!0]);return new e.AnimationClip(null,t,[i])},Is.CreateMaterialColorAnimation=(t,r)=>{const i=[],n=[],s=t/r.length;for(let e=0;e<=r.length;e++)i.push(e*s),n.push(r[e%r.length]);const o=new e.ColorKeyframeTrack(".material[0].color",i,n);return new e.AnimationClip(null,t,[o])};class Us extends e.Object3D{constructor(t,r=[],i=.25){super(),p.default(this,"_m",new e.Matrix4),p.default(this,"_v",new e.Vector3),this.root=t,this.iks=r,this.matrix.copy(t.matrixWorld),this.matrixAutoUpdate=!1,this.sphereGeometry=new e.SphereGeometry(i,16,8),this.targetSphereMaterial=new e.MeshBasicMaterial({color:new e.Color(16746632),depthTest:!1,depthWrite:!1,transparent:!0}),this.effectorSphereMaterial=new e.MeshBasicMaterial({color:new e.Color(8978312),depthTest:!1,depthWrite:!1,transparent:!0}),this.linkSphereMaterial=new e.MeshBasicMaterial({color:new e.Color(8947967),depthTest:!1,depthWrite:!1,transparent:!0}),this.lineMaterial=new e.LineBasicMaterial({color:new e.Color(16711680),depthTest:!1,depthWrite:!1,transparent:!0});const n=this;function s(t){return new e.Line(function(t){const r=new e.BufferGeometry,i=new Float32Array(3*(2+t.links.length));return r.setAttribute("position",new e.BufferAttribute(i,3)),r}(t),n.lineMaterial)}for(let t=0,i=r.length;t<i;t++){const i=r[t];this.add(new e.Mesh(n.sphereGeometry,n.targetSphereMaterial)),this.add(new e.Mesh(n.sphereGeometry,n.effectorSphereMaterial));for(let t=0,r=i.links.length;t<r;t++)this.add(new e.Mesh(n.sphereGeometry,n.linkSphereMaterial));this.add(s(i))}}_getPosition(e,t){return this._v.setFromMatrixPosition(e.matrixWorld).applyMatrix4(t)}_setPositionOfBoneToAttributeArray(e,t,r,i){const n=this._getPosition(r,i);e[3*t+0]=n.x,e[3*t+1]=n.y,e[3*t+2]=n.z}updateMatrixWorld(e){const t=this.root;if(this.visible){let e=0;const r=this.iks,i=t.skeleton.bones;this._m.copy(t.matrixWorld).invert();for(let t=0,n=r.length;t<n;t++){const n=r[t],s=i[n.target],o=i[n.effector],a=this.children[e++],l=this.children[e++];a.position.copy(this._getPosition(s,this._m)),l.position.copy(this._getPosition(o,this._m));for(let t=0,r=n.links.length;t<r;t++){const r=i[n.links[t].index];this.children[e++].position.copy(this._getPosition(r,this._m))}const c=this.children[e++],h=c.geometry.attributes.position.array;this._setPositionOfBoneToAttributeArray(h,0,s,this._m),this._setPositionOfBoneToAttributeArray(h,1,o,this._m);for(let e=0,t=n.links.length;e<t;e++){const t=i[n.links[e].index];this._setPositionOfBoneToAttributeArray(h,e+2,t,this._m)}c.geometry.attributes.position.needsUpdate=!0}}this.matrix.copy(t.matrixWorld),super.updateMatrixWorld(e)}}class Os{constructor(t,r){p.default(this,"q",new e.Quaternion),p.default(this,"targetPos",new e.Vector3),p.default(this,"targetVec",new e.Vector3),p.default(this,"effectorPos",new e.Vector3),p.default(this,"effectorVec",new e.Vector3),p.default(this,"linkPos",new e.Vector3),p.default(this,"invLinkQ",new e.Quaternion),p.default(this,"linkScale",new e.Vector3),p.default(this,"axis",new e.Vector3),p.default(this,"vector",new e.Vector3),this.mesh=t,this.iks=r;const i=this.mesh.skeleton.bones;for(let e=0,t=this.iks.length;e<t;e++){const t=this.iks[e],r=i[t.effector],n=t.links;let s,o;s=r;for(let e=0,t=n.length;e<t;e++)o=i[n[e].index],s.parent!==o&&console.warn(`THREE.CCDIKSolver: bone ${s.name} is not the child of bone ${o.name}`),s=o}}update(){const e=this.mesh.skeleton.bones,t=this.iks,r=Math;for(let i=0,n=t.length;i<n;i++){const n=t[i],s=e[n.effector],o=e[n.target];this.targetPos.setFromMatrixPosition(o.matrixWorld);const a=n.links,l=void 0!==n.iteration?n.iteration:1;for(let t=0;t<l;t++){let t=!1;for(let i=0,o=a.length;i<o;i++){const o=e[a[i].index];if(!1===a[i].enabled)break;const l=a[i].limitation,c=a[i].rotationMin,h=a[i].rotationMax;o.matrixWorld.decompose(this.linkPos,this.invLinkQ,this.linkScale),this.invLinkQ.invert(),this.effectorPos.setFromMatrixPosition(s.matrixWorld),this.effectorVec.subVectors(this.effectorPos,this.linkPos),this.effectorVec.applyQuaternion(this.invLinkQ),this.effectorVec.normalize(),this.targetVec.subVectors(this.targetPos,this.linkPos),this.targetVec.applyQuaternion(this.invLinkQ),this.targetVec.normalize();let u=this.targetVec.dot(this.effectorVec);if(u>1?u=1:u<-1&&(u=-1),u=r.acos(u),!(u<1e-5)){if(void 0!==n.minAngle&&u<n.minAngle&&(u=n.minAngle),void 0!==n.maxAngle&&u>n.maxAngle&&(u=n.maxAngle),this.axis.crossVectors(this.effectorVec,this.targetVec),this.axis.normalize(),this.q.setFromAxisAngle(this.axis,u),o.quaternion.multiply(this.q),void 0!==l){let e=o.quaternion.w;e>1&&(e=1);const t=r.sqrt(1-e*e);o.quaternion.set(l.x*t,l.y*t,l.z*t,e)}void 0!==c&&o.rotation.setFromVector3(this.vector.setFromEuler(o.rotation).max(c)),void 0!==h&&o.rotation.setFromVector3(this.vector.setFromEuler(o.rotation).min(h)),o.updateMatrixWorld(!0),t=!0}}if(!t)break}}return this}createHelper(){return new Us(this.mesh,this.mesh.geometry.userData.MMD.iks)}}const ks=(()=>{function t(t,i,n,s){if("undefined"==typeof Ammo)throw new Error("THREE.MMDPhysics: Import ammo.js https://github.com/kripken/ammo.js");n=n||[],s=s||{},this.manager=new r,this.mesh=t,this.unitStep=void 0!==s.unitStep?s.unitStep:1/65,this.maxStepNum=void 0!==s.maxStepNum?s.maxStepNum:3,this.gravity=new e.Vector3(0,-98,0),void 0!==s.gravity&&this.gravity.copy(s.gravity),this.world=void 0!==s.world?s.world:null,this.bodies=[],this.constraints=[],this._init(t,i,n)}function r(){this.threeVector3s=[],this.threeMatrix4s=[],this.threeQuaternions=[],this.threeEulers=[],this.transforms=[],this.quaternions=[],this.vector3s=[]}function i(e,t,r,i){this.mesh=e,this.world=t,this.params=r,this.manager=i,this.body=null,this.bone=null,this.boneOffsetForm=null,this.boneOffsetFormInverse=null,this._init()}function n(e,t,r,i,n,s){this.mesh=e,this.world=t,this.bodyA=r,this.bodyB=i,this.params=n,this.manager=s,this.constraint=null,this._init()}function s(t,r){e.Object3D.call(this),this.root=t,this.physics=r,this.matrix.copy(t.matrixWorld),this.matrixAutoUpdate=!1,this.materials=[],this.materials.push(new e.MeshBasicMaterial({color:new e.Color(16746632),wireframe:!0,depthTest:!1,depthWrite:!1,opacity:.25,transparent:!0})),this.materials.push(new e.MeshBasicMaterial({color:new e.Color(8978312),wireframe:!0,depthTest:!1,depthWrite:!1,opacity:.25,transparent:!0})),this.materials.push(new e.MeshBasicMaterial({color:new e.Color(8947967),wireframe:!0,depthTest:!1,depthWrite:!1,opacity:.25,transparent:!0})),this._init()}return t.prototype={constructor:t,update:function(e){const t=this.manager,r=this.mesh;let i=!1;const n=t.allocThreeVector3(),s=t.allocThreeQuaternion(),o=t.allocThreeVector3();let a;return r.matrixWorld.decompose(n,s,o),1===o.x&&1===o.y&&1===o.z||(i=!0),i&&(a=r.parent,null!==a&&(r.parent=null),o.copy(this.mesh.scale),r.scale.set(1,1,1),r.updateMatrixWorld(!0)),this._updateRigidBodies(),this._stepSimulation(e),this._updateBones(),i&&(null!==a&&(r.parent=a),r.scale.copy(o)),t.freeThreeVector3(o),t.freeThreeQuaternion(s),t.freeThreeVector3(n),this},reset:function(){for(let e=0,t=this.bodies.length;e<t;e++)this.bodies[e].reset();return this},warmup:function(e){for(let t=0;t<e;t++)this.update(1/60);return this},setGravity:function(e){return this.world.setGravity(new Ammo.btVector3(e.x,e.y,e.z)),this.gravity.copy(e),this},createHelper:function(){return new s(this.mesh,this)},_init:function(e,t,r){const i=this.manager;let n=e.parent;null!==n&&(n=null);const s=i.allocThreeVector3(),o=i.allocThreeQuaternion(),a=i.allocThreeVector3();s.copy(e.position),o.copy(e.quaternion),a.copy(e.scale),e.position.set(0,0,0),e.quaternion.set(0,0,0,1),e.scale.set(1,1,1),e.updateMatrixWorld(!0),null===this.world&&(this.world=this._createWorld(),this.setGravity(this.gravity)),this._initRigidBodies(t),this._initConstraints(r),null!==n&&(e.parent=n),e.position.copy(s),e.quaternion.copy(o),e.scale.copy(a),e.updateMatrixWorld(!0),this.reset(),i.freeThreeVector3(s),i.freeThreeQuaternion(o),i.freeThreeVector3(a)},_createWorld:function(){const e=new Ammo.btDefaultCollisionConfiguration,t=new Ammo.btCollisionDispatcher(e),r=new Ammo.btDbvtBroadphase,i=new Ammo.btSequentialImpulseConstraintSolver;return new Ammo.btDiscreteDynamicsWorld(t,r,i,e)},_initRigidBodies:function(e){for(let t=0,r=e.length;t<r;t++)this.bodies.push(new i(this.mesh,this.world,e[t],this.manager))},_initConstraints:function(e){for(let t=0,r=e.length;t<r;t++){const r=e[t],i=this.bodies[r.rigidBodyIndex1],s=this.bodies[r.rigidBodyIndex2];this.constraints.push(new n(this.mesh,this.world,i,s,r,this.manager))}},_stepSimulation:function(e){const t=this.unitStep;let r=e,i=1+(e/t|0);r<t&&(r=t,i=1),i>this.maxStepNum&&(i=this.maxStepNum),this.world.stepSimulation(r,i,t)},_updateRigidBodies:function(){for(let e=0,t=this.bodies.length;e<t;e++)this.bodies[e].updateFromBone()},_updateBones:function(){for(let e=0,t=this.bodies.length;e<t;e++)this.bodies[e].updateBone()}},r.prototype={constructor:r,allocThreeVector3:function(){return this.threeVector3s.length>0?this.threeVector3s.pop():new e.Vector3},freeThreeVector3:function(e){this.threeVector3s.push(e)},allocThreeMatrix4:function(){return this.threeMatrix4s.length>0?this.threeMatrix4s.pop():new e.Matrix4},freeThreeMatrix4:function(e){this.threeMatrix4s.push(e)},allocThreeQuaternion:function(){return this.threeQuaternions.length>0?this.threeQuaternions.pop():new e.Quaternion},freeThreeQuaternion:function(e){this.threeQuaternions.push(e)},allocThreeEuler:function(){return this.threeEulers.length>0?this.threeEulers.pop():new e.Euler},freeThreeEuler:function(e){this.threeEulers.push(e)},allocTransform:function(){return this.transforms.length>0?this.transforms.pop():new Ammo.btTransform},freeTransform:function(e){this.transforms.push(e)},allocQuaternion:function(){return this.quaternions.length>0?this.quaternions.pop():new Ammo.btQuaternion},freeQuaternion:function(e){this.quaternions.push(e)},allocVector3:function(){return this.vector3s.length>0?this.vector3s.pop():new Ammo.btVector3},freeVector3:function(e){this.vector3s.push(e)},setIdentity:function(e){e.setIdentity()},getBasis:function(e){const t=this.allocQuaternion();return e.getBasis().getRotation(t),t},getBasisAsMatrix3:function(e){const t=this.getBasis(e),r=this.quaternionToMatrix3(t);return this.freeQuaternion(t),r},getOrigin:function(e){return e.getOrigin()},setOrigin:function(e,t){e.getOrigin().setValue(t.x(),t.y(),t.z())},copyOrigin:function(e,t){const r=t.getOrigin();this.setOrigin(e,r)},setBasis:function(e,t){e.setRotation(t)},setBasisFromMatrix3:function(e,t){const r=this.matrix3ToQuaternion(t);this.setBasis(e,r),this.freeQuaternion(r)},setOriginFromArray3:function(e,t){e.getOrigin().setValue(t[0],t[1],t[2])},setOriginFromThreeVector3:function(e,t){e.getOrigin().setValue(t.x,t.y,t.z)},setBasisFromArray3:function(e,t){const r=this.allocThreeQuaternion(),i=this.allocThreeEuler();i.set(t[0],t[1],t[2]),this.setBasisFromThreeQuaternion(e,r.setFromEuler(i)),this.freeThreeEuler(i),this.freeThreeQuaternion(r)},setBasisFromThreeQuaternion:function(e,t){const r=this.allocQuaternion();r.setX(t.x),r.setY(t.y),r.setZ(t.z),r.setW(t.w),this.setBasis(e,r),this.freeQuaternion(r)},multiplyTransforms:function(e,t){const r=this.allocTransform();this.setIdentity(r);const i=this.getBasisAsMatrix3(e),n=this.getBasisAsMatrix3(t),s=this.getOrigin(e),o=this.getOrigin(t),a=this.multiplyMatrix3ByVector3(i,o),l=this.addVector3(a,s);this.setOrigin(r,l);const c=this.multiplyMatrices3(i,n);return this.setBasisFromMatrix3(r,c),this.freeVector3(a),this.freeVector3(l),r},inverseTransform:function(e){const t=this.allocTransform(),r=this.getBasisAsMatrix3(e),i=this.getOrigin(e),n=this.transposeMatrix3(r),s=this.negativeVector3(i),o=this.multiplyMatrix3ByVector3(n,s);return this.setOrigin(t,o),this.setBasisFromMatrix3(t,n),this.freeVector3(s),this.freeVector3(o),t},multiplyMatrices3:function(e,t){const r=[],i=this.rowOfMatrix3(e,0),n=this.rowOfMatrix3(e,1),s=this.rowOfMatrix3(e,2),o=this.columnOfMatrix3(t,0),a=this.columnOfMatrix3(t,1),l=this.columnOfMatrix3(t,2);return r[0]=this.dotVectors3(i,o),r[1]=this.dotVectors3(i,a),r[2]=this.dotVectors3(i,l),r[3]=this.dotVectors3(n,o),r[4]=this.dotVectors3(n,a),r[5]=this.dotVectors3(n,l),r[6]=this.dotVectors3(s,o),r[7]=this.dotVectors3(s,a),r[8]=this.dotVectors3(s,l),this.freeVector3(i),this.freeVector3(n),this.freeVector3(s),this.freeVector3(o),this.freeVector3(a),this.freeVector3(l),r},addVector3:function(e,t){const r=this.allocVector3();return r.setValue(e.x()+t.x(),e.y()+t.y(),e.z()+t.z()),r},dotVectors3:function(e,t){return e.x()*t.x()+e.y()*t.y()+e.z()*t.z()},rowOfMatrix3:function(e,t){const r=this.allocVector3();return r.setValue(e[3*t+0],e[3*t+1],e[3*t+2]),r},columnOfMatrix3:function(e,t){const r=this.allocVector3();return r.setValue(e[t+0],e[t+3],e[t+6]),r},negativeVector3:function(e){const t=this.allocVector3();return t.setValue(-e.x(),-e.y(),-e.z()),t},multiplyMatrix3ByVector3:function(e,t){const r=this.allocVector3(),i=this.rowOfMatrix3(e,0),n=this.rowOfMatrix3(e,1),s=this.rowOfMatrix3(e,2),o=this.dotVectors3(i,t),a=this.dotVectors3(n,t),l=this.dotVectors3(s,t);return r.setValue(o,a,l),this.freeVector3(i),this.freeVector3(n),this.freeVector3(s),r},transposeMatrix3:function(e){const t=[];return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],t},quaternionToMatrix3:function(e){const t=[],r=e.x(),i=e.y(),n=e.z(),s=e.w(),o=r*r,a=i*i,l=n*n,c=r*i,h=i*n,u=n*r,d=r*s,p=i*s,m=n*s;return t[0]=1-2*(a+l),t[1]=2*(c-m),t[2]=2*(u+p),t[3]=2*(c+m),t[4]=1-2*(l+o),t[5]=2*(h-d),t[6]=2*(u-p),t[7]=2*(h+d),t[8]=1-2*(o+a),t},matrix3ToQuaternion:function(e){const t=e[0]+e[4]+e[8];let r,i,n,s,o;t>0?(r=2*Math.sqrt(t+1),o=.25*r,i=(e[7]-e[5])/r,n=(e[2]-e[6])/r,s=(e[3]-e[1])/r):e[0]>e[4]&&e[0]>e[8]?(r=2*Math.sqrt(1+e[0]-e[4]-e[8]),o=(e[7]-e[5])/r,i=.25*r,n=(e[1]+e[3])/r,s=(e[2]+e[6])/r):e[4]>e[8]?(r=2*Math.sqrt(1+e[4]-e[0]-e[8]),o=(e[2]-e[6])/r,i=(e[1]+e[3])/r,n=.25*r,s=(e[5]+e[7])/r):(r=2*Math.sqrt(1+e[8]-e[0]-e[4]),o=(e[3]-e[1])/r,i=(e[2]+e[6])/r,n=(e[5]+e[7])/r,s=.25*r);const a=this.allocQuaternion();return a.setX(i),a.setY(n),a.setZ(s),a.setW(o),a}},i.prototype={constructor:t.RigidBody,reset:function(){return this._setTransformFromBone(),this},updateFromBone:function(){return-1!==this.params.boneIndex&&0===this.params.type&&this._setTransformFromBone(),this},updateBone:function(){return 0===this.params.type||-1===this.params.boneIndex||(this._updateBoneRotation(),1===this.params.type&&this._updateBonePosition(),this.bone.updateMatrixWorld(!0),2===this.params.type&&this._setPositionFromBone()),this},_init:function(){const t=this.manager,r=this.params,i=this.mesh.skeleton.bones,n=-1===r.boneIndex?new e.Bone:i[r.boneIndex],s=function(e){switch(e.shapeType){case 0:return new Ammo.btSphereShape(e.width);case 1:return new Ammo.btBoxShape(new Ammo.btVector3(e.width,e.height,e.depth));case 2:return new Ammo.btCapsuleShape(e.width,e.height);default:throw`unknown shape type ${e.shapeType}`}}(r),o=0===r.type?0:r.weight,a=t.allocVector3();a.setValue(0,0,0),0!==o&&s.calculateLocalInertia(o,a);const l=t.allocTransform();t.setIdentity(l),t.setOriginFromArray3(l,r.position),t.setBasisFromArray3(l,r.rotation);const c=t.allocThreeVector3(),h=t.allocTransform();t.setIdentity(h),t.setOriginFromThreeVector3(h,n.getWorldPosition(c));const u=t.multiplyTransforms(h,l),d=new Ammo.btDefaultMotionState(u),p=new Ammo.btRigidBodyConstructionInfo(o,d,s,a);p.set_m_friction(r.friction),p.set_m_restitution(r.restitution);const m=new Ammo.btRigidBody(p);0===r.type&&(m.setCollisionFlags(2|m.getCollisionFlags()),m.setActivationState(4)),m.setDamping(r.positionDamping,r.rotationDamping),m.setSleepingThresholds(0,0),this.world.addRigidBody(m,1<<r.groupIndex,r.groupTarget),this.body=m,this.bone=n,this.boneOffsetForm=l,this.boneOffsetFormInverse=t.inverseTransform(l),t.freeVector3(a),t.freeTransform(u),t.freeTransform(h),t.freeThreeVector3(c)},_getBoneTransform:function(){const e=this.manager,t=e.allocThreeVector3(),r=e.allocThreeQuaternion(),i=e.allocThreeVector3();this.bone.matrixWorld.decompose(t,r,i);const n=e.allocTransform();e.setOriginFromThreeVector3(n,t),e.setBasisFromThreeQuaternion(n,r);const s=e.multiplyTransforms(n,this.boneOffsetForm);return e.freeTransform(n),e.freeThreeVector3(i),e.freeThreeQuaternion(r),e.freeThreeVector3(t),s},_getWorldTransformForBone:function(){const e=this.manager,t=this.body.getCenterOfMassTransform();return e.multiplyTransforms(t,this.boneOffsetFormInverse)},_setTransformFromBone:function(){const e=this.manager,t=this._getBoneTransform();this.body.setCenterOfMassTransform(t),this.body.getMotionState().setWorldTransform(t),e.freeTransform(t)},_setPositionFromBone:function(){const e=this.manager,t=this._getBoneTransform(),r=e.allocTransform();this.body.getMotionState().getWorldTransform(r),e.copyOrigin(r,t),this.body.setCenterOfMassTransform(r),this.body.getMotionState().setWorldTransform(r),e.freeTransform(r),e.freeTransform(t)},_updateBoneRotation:function(){const e=this.manager,t=this._getWorldTransformForBone(),r=e.getBasis(t),i=e.allocThreeQuaternion(),n=e.allocThreeQuaternion(),s=e.allocThreeQuaternion();i.set(r.x(),r.y(),r.z(),r.w()),n.setFromRotationMatrix(this.bone.matrixWorld),n.conjugate(),n.multiply(i),s.setFromRotationMatrix(this.bone.matrix),this.bone.quaternion.copy(n.multiply(s).normalize()),e.freeThreeQuaternion(i),e.freeThreeQuaternion(n),e.freeThreeQuaternion(s),e.freeQuaternion(r),e.freeTransform(t)},_updateBonePosition:function(){const e=this.manager,t=this._getWorldTransformForBone(),r=e.allocThreeVector3(),i=e.getOrigin(t);r.set(i.x(),i.y(),i.z()),this.bone.parent&&this.bone.parent.worldToLocal(r),this.bone.position.copy(r),e.freeThreeVector3(r),e.freeTransform(t)}},n.prototype={constructor:n,_init:function(){const e=this.manager,t=this.params,r=this.bodyA,i=this.bodyB,n=e.allocTransform();e.setIdentity(n),e.setOriginFromArray3(n,t.position),e.setBasisFromArray3(n,t.rotation);const s=e.allocTransform(),o=e.allocTransform();r.body.getMotionState().getWorldTransform(s),i.body.getMotionState().getWorldTransform(o);const a=e.inverseTransform(s),l=e.inverseTransform(o),c=e.multiplyTransforms(a,n),h=e.multiplyTransforms(l,n),u=new Ammo.btGeneric6DofSpringConstraint(r.body,i.body,c,h,!0),d=e.allocVector3(),p=e.allocVector3(),m=e.allocVector3(),f=e.allocVector3();d.setValue(t.translationLimitation1[0],t.translationLimitation1[1],t.translationLimitation1[2]),p.setValue(t.translationLimitation2[0],t.translationLimitation2[1],t.translationLimitation2[2]),m.setValue(t.rotationLimitation1[0],t.rotationLimitation1[1],t.rotationLimitation1[2]),f.setValue(t.rotationLimitation2[0],t.rotationLimitation2[1],t.rotationLimitation2[2]),u.setLinearLowerLimit(d),u.setLinearUpperLimit(p),u.setAngularLowerLimit(m),u.setAngularUpperLimit(f);for(let e=0;e<3;e++)0!==t.springPosition[e]&&(u.enableSpring(e,!0),u.setStiffness(e,t.springPosition[e]));for(let e=0;e<3;e++)0!==t.springRotation[e]&&(u.enableSpring(e+3,!0),u.setStiffness(e+3,t.springRotation[e]));if(void 0!==u.setParam)for(let e=0;e<6;e++)u.setParam(2,.475,e);this.world.addConstraint(u,!0),this.constraint=u,e.freeTransform(n),e.freeTransform(s),e.freeTransform(o),e.freeTransform(a),e.freeTransform(l),e.freeTransform(c),e.freeTransform(h),e.freeVector3(d),e.freeVector3(p),e.freeVector3(m),e.freeVector3(f)}},s.prototype=Object.assign(Object.create(e.Object3D.prototype),{constructor:s,updateMatrixWorld:(()=>{const t=new e.Vector3,r=new e.Quaternion,i=new e.Vector3,n=new e.Matrix4;return function(s){const o=this.root;if(this.visible){const e=this.physics.bodies;n.copy(o.matrixWorld).decompose(t,r,i).compose(t,r,i.set(1,1,1)).invert();for(let t=0,i=e.length;t<i;t++){const i=e[t].body,s=this.children[t],o=i.getCenterOfMassTransform(),a=o.getOrigin(),l=o.getRotation();s.position.set(a.x(),a.y(),a.z()).applyMatrix4(n),s.quaternion.setFromRotationMatrix(n).multiply(r.set(l.x(),l.y(),l.z(),l.w()))}}this.matrix.copy(o.matrixWorld).decompose(t,r,i).compose(t,r,i.set(1,1,1)),e.Object3D.prototype.updateMatrixWorld.call(this,s)}})(),_init:function(){const t=this.physics.bodies;function r(t){switch(t.shapeType){case 0:return new e.SphereGeometry(t.width,16,8);case 1:return new e.BoxGeometry(2*t.width,2*t.height,2*t.depth,8,8,8);case 2:return new i(t.width,t.height,16,8);default:return null}}function i(t,r,i,n){const s=new e.CylinderGeometry(t,t,r,i,n,!0),o=new e.Mesh(new e.SphereGeometry(t,i,n,0,2*Math.PI,0,Math.PI/2)),a=new e.Mesh(new e.SphereGeometry(t,i,n,0,2*Math.PI,Math.PI/2,Math.PI/2));return o.position.set(0,r/2,0),a.position.set(0,-r/2,0),o.updateMatrix(),a.updateMatrix(),s.merge(o.geometry,o.matrix),s.merge(a.geometry,a.matrix),s}for(let i=0,n=t.length;i<n;i++){const n=t[i].params;this.add(new e.Mesh(r(n),this.materials[n.type]))}}}),t})(),Vs=(()=>{function t(t){t=t||{},this.meshes=[],this.camera=null,this.cameraTarget=new e.Object3D,this.cameraTarget.name="target",this.audio=null,this.audioManager=null,this.objects=new WeakMap,this.configuration={sync:void 0===t.sync||t.sync,afterglow:void 0!==t.afterglow?t.afterglow:0,resetPhysicsOnLoop:void 0===t.resetPhysicsOnLoop||t.resetPhysicsOnLoop},this.enabled={animation:!0,ik:!0,grant:!0,physics:!0,cameraAnimation:!0},this.onBeforePhysics=()=>{},this.sharedPhysics=!1,this.masterPhysics=null}function r(e,t){t=t||{},this.audio=e,this.elapsedTime=0,this.currentTime=0,this.delayTime=void 0!==t.delayTime?t.delayTime:0,this.audioDuration=this.audio.buffer.duration,this.duration=this.audioDuration+this.delayTime}function i(e,t){this.mesh=e,this.grants=t||[]}return t.prototype={constructor:t,add:function(e,t){if(t=t||{},e.isSkinnedMesh)this._addMesh(e,t);else if(e.isCamera)this._setupCamera(e,t);else{if("Audio"!==e.type)throw new Error("THREE.MMDAnimationHelper.add: accepts only THREE.SkinnedMesh or THREE.Camera or THREE.Audio instance.");this._setupAudio(e,t)}return this.configuration.sync&&this._syncDuration(),this},remove:function(e){if(e.isSkinnedMesh)this._removeMesh(e);else if(e.isCamera)this._clearCamera(e);else{if("Audio"!==e.type)throw new Error("THREE.MMDAnimationHelper.remove: accepts only THREE.SkinnedMesh or THREE.Camera or THREE.Audio instance.");this._clearAudio(e)}return this.configuration.sync&&this._syncDuration(),this},update:function(e){null!==this.audioManager&&this.audioManager.control(e);for(let t=0;t<this.meshes.length;t++)this._animateMesh(this.meshes[t],e);return this.sharedPhysics&&this._updateSharedPhysics(e),null!==this.camera&&this._animateCamera(this.camera,e),this},pose:function(t,r,i){!1!==(i=i||{}).resetPose&&t.pose();const n=t.skeleton.bones,s=r.bones,o={};for(let e=0,t=n.length;e<t;e++)o[n[e].name]=e;const a=new e.Vector3,l=new e.Quaternion;for(let e=0,t=s.length;e<t;e++){const t=s[e],r=o[t.name];if(void 0===r)continue;const i=n[r];i.position.add(a.fromArray(t.translation)),i.quaternion.multiply(l.fromArray(t.quaternion))}return t.updateMatrixWorld(!0),!1!==i.ik&&this._createCCDIKSolver(t).update(i.saveOriginalBonesBeforeIK),!1!==i.grant&&this.createGrantSolver(t).update(),this},enable:function(e,t){if(void 0===this.enabled[e])throw new Error(`THREE.MMDAnimationHelper.enable: unknown key ${e}`);if(this.enabled[e]=t,"physics"===e)for(let e=0,r=this.meshes.length;e<r;e++)this._optimizeIK(this.meshes[e],t);return this},createGrantSolver:function(e){return new i(e,e.geometry.userData.MMD.grants)},_addMesh:function(e,t){if(this.meshes.indexOf(e)>=0)throw new Error(`THREE.MMDAnimationHelper._addMesh: SkinnedMesh '${e.name}' has already been added.`);return this.meshes.push(e),this.objects.set(e,{looped:!1}),this._setupMeshAnimation(e,t.animation),!1!==t.physics&&this._setupMeshPhysics(e,t),this},_setupCamera:function(e,t){if(this.camera===e)throw new Error(`THREE.MMDAnimationHelper._setupCamera: Camera '${e.name}' has already been set.`);return this.camera&&this.clearCamera(this.camera),this.camera=e,e.add(this.cameraTarget),this.objects.set(e,{}),void 0!==t.animation&&this._setupCameraAnimation(e,t.animation),this},_setupAudio:function(e,t){if(this.audio===e)throw new Error(`THREE.MMDAnimationHelper._setupAudio: Audio '${e.name}' has already been set.`);return this.audio&&this.clearAudio(this.audio),this.audio=e,this.audioManager=new r(e,t),this.objects.set(this.audioManager,{duration:this.audioManager.duration}),this},_removeMesh:function(e){let t=!1,r=0;for(let i=0,n=this.meshes.length;i<n;i++)this.meshes[i]!==e?this.meshes[r++]=this.meshes[i]:(this.objects.delete(e),t=!0);if(!t)throw new Error(`THREE.MMDAnimationHelper._removeMesh: SkinnedMesh '${e.name}' has not been added yet.`);return this.meshes.length=r,this},_clearCamera:function(e){if(e!==this.camera)throw new Error(`THREE.MMDAnimationHelper._clearCamera: Camera '${e.name}' has not been set yet.`);return this.camera.remove(this.cameraTarget),this.objects.delete(this.camera),this.camera=null,this},_clearAudio:function(e){if(e!==this.audio)throw new Error(`THREE.MMDAnimationHelper._clearAudio: Audio '${e.name}' has not been set yet.`);return this.objects.delete(this.audioManager),this.audio=null,this.audioManager=null,this},_setupMeshAnimation:function(t,r){const i=this.objects.get(t);if(void 0!==r){const n=Array.isArray(r)?r:[r];i.mixer=new e.AnimationMixer(t);for(let e=0,t=n.length;e<t;e++)i.mixer.clipAction(n[e]).play();i.mixer.addEventListener("loop",(e=>{const t=e.action._clip.tracks;t.length>0&&".bones"!==t[0].name.slice(0,6)||(i.looped=!0)}))}return i.ikSolver=this._createCCDIKSolver(t),i.grantSolver=this.createGrantSolver(t),this},_setupCameraAnimation:function(t,r){const i=Array.isArray(r)?r:[r],n=this.objects.get(t);n.mixer=new e.AnimationMixer(t);for(let e=0,t=i.length;e<t;e++)n.mixer.clipAction(i[e]).play()},_setupMeshPhysics:function(e,t){const r=this.objects.get(e);if(void 0===t.world&&this.sharedPhysics){const e=this._getMasterPhysics();null!==e&&(world=e.world)}r.physics=this._createMMDPhysics(e,t),r.mixer&&!1!==t.animationWarmup&&(this._animateMesh(e,0),r.physics.reset()),r.physics.warmup(void 0!==t.warmup?t.warmup:60),this._optimizeIK(e,!0)},_animateMesh:function(e,t){const r=this.objects.get(e),i=r.mixer,n=r.ikSolver,s=r.grantSolver,o=r.physics,a=r.looped;i&&this.enabled.animation&&(this._restoreBones(e),i.update(t),this._saveBones(e),n&&this.enabled.ik&&(e.updateMatrixWorld(!0),n.update()),s&&this.enabled.grant&&s.update()),!0===a&&this.enabled.physics&&(o&&this.configuration.resetPhysicsOnLoop&&o.reset(),r.looped=!1),o&&this.enabled.physics&&!this.sharedPhysics&&(this.onBeforePhysics(e),o.update(t))},_animateCamera:function(e,t){const r=this.objects.get(e).mixer;r&&this.enabled.cameraAnimation&&(r.update(t),e.updateProjectionMatrix(),e.up.set(0,1,0),e.up.applyQuaternion(e.quaternion),e.lookAt(this.cameraTarget.position))},_optimizeIK:function(e,t){const r=e.geometry.userData.MMD.iks,i=e.geometry.userData.MMD.bones;for(let e=0,n=r.length;e<n;e++){const n=r[e].links;for(let e=0,r=n.length;e<r;e++){const r=n[e];r.enabled=!0!==t||!(i[r.index].rigidBodyType>0)}}},_createCCDIKSolver:function(e){if(void 0===Os)throw new Error("THREE.MMDAnimationHelper: Import CCDIKSolver.");return new Os(e,e.geometry.userData.MMD.iks)},_createMMDPhysics:function(e,t){if(void 0===ks)throw new Error("THREE.MMDPhysics: Import MMDPhysics.");return new ks(e,e.geometry.userData.MMD.rigidBodies,e.geometry.userData.MMD.constraints,t)},_syncDuration:function(){let e=0;const t=this.objects,r=this.meshes,i=this.camera,n=this.audioManager;for(let i=0,n=r.length;i<n;i++){if(void 0!==(o=this.objects.get(r[i]).mixer))for(let r=0;r<o._actions.length;r++){var s=o._actions[r]._clip;t.has(s)||t.set(s,{duration:s.duration}),e=Math.max(e,t.get(s).duration)}}if(null!==i&&void 0!==(o=this.objects.get(i).mixer))for(let r=0,i=o._actions.length;r<i;r++){s=o._actions[r]._clip;t.has(s)||t.set(s,{duration:s.duration}),e=Math.max(e,t.get(s).duration)}null!==n&&(e=Math.max(e,t.get(n).duration)),e+=this.configuration.afterglow;for(let t=0,r=this.meshes.length;t<r;t++){var o;if(void 0!==(o=this.objects.get(this.meshes[t]).mixer))for(let t=0,r=o._actions.length;t<r;t++)o._actions[t]._clip.duration=e}if(null!==i&&void 0!==(o=this.objects.get(i).mixer))for(let t=0,r=o._actions.length;t<r;t++)o._actions[t]._clip.duration=e;null!==n&&(n.duration=e)},_updatePropertyMixersBuffer:function(e){const t=this.objects.get(e).mixer,r=t._bindings,i=t._accuIndex;for(let e=0,t=r.length;e<t;e++){const t=r[e],n=t.buffer,s=(i+1)*t.valueSize;t.binding.getValue(n,s)}},_saveBones:function(e){const t=this.objects.get(e),r=e.skeleton.bones;let i=t.backupBones;void 0===i&&(i=new Float32Array(7*r.length),t.backupBones=i);for(let e=0,t=r.length;e<t;e++){const t=r[e];t.position.toArray(i,7*e),t.quaternion.toArray(i,7*e+3)}},_restoreBones:function(e){const t=this.objects.get(e).backupBones;if(void 0===t)return;const r=e.skeleton.bones;for(let e=0,i=r.length;e<i;e++){const i=r[e];i.position.fromArray(t,7*e),i.quaternion.fromArray(t,7*e+3)}},_getMasterPhysics:function(){if(null!==this.masterPhysics)return this.masterPhysics;for(let e=0,t=this.meshes.length;e<t;e++){const t=this.meshes[e].physics;if(null!=t)return this.masterPhysics=t,this.masterPhysics}return null},_updateSharedPhysics:function(e){if(0===this.meshes.length||!this.enabled.physics||!this.sharedPhysics)return;const t=this._getMasterPhysics();if(null!==t){for(let e=0,t=this.meshes.length;e<t;e++){null!=(r=this.meshes[e].physics)&&r.updateRigidBodies()}t.stepSimulation(e);for(let e=0,t=this.meshes.length;e<t;e++){var r;null!=(r=this.meshes[e].physics)&&r.updateBones()}}}},r.prototype={constructor:r,control:function(e){return this.elapsed+=e,this.currentTime+=e,this._shouldStopAudio()&&this.audio.stop(),this._shouldStartAudio()&&this.audio.play(),this},_shouldStartAudio:function(){if(this.audio.isPlaying)return!1;for(;this.currentTime>=this.duration;)this.currentTime-=this.duration;return!(this.currentTime<this.delayTime)&&!(this.currentTime-this.delayTime>this.audioDuration)},_shouldStopAudio:function(){return this.audio.isPlaying&&this.currentTime>=this.duration}},i.prototype={constructor:i,update:(()=>{const t=new e.Quaternion;return function(){const e=this.mesh.skeleton.bones,r=this.grants;for(let i=0,n=r.length;i<n;i++){const n=r[i],s=e[n.index],o=e[n.parentIndex];n.isLocal?(n.affectPosition,n.affectRotation):(n.affectPosition,n.affectRotation&&(t.set(0,0,0,1),t.slerp(o.quaternion,n.ratio),s.quaternion.multiply(t)))}return this}})()},t})();class Gs extends e.Mesh{constructor(t,r={}){super(t),this.type="Reflector";const i=this,n=void 0!==r.color?new e.Color(r.color):new e.Color(8355711),s=r.textureWidth||512,o=r.textureHeight||512,a=r.clipBias||0,l=r.shader||Gs.ReflectorShader,c=new e.Plane,h=new e.Vector3,u=new e.Vector3,d=new e.Vector3,p=new e.Matrix4,m=new e.Vector3(0,0,-1),f=new e.Vector4,g=new e.Vector3,v=new e.Vector3,x=new e.Vector4,y=new e.Matrix4,b=new e.PerspectiveCamera,A=new e.WebGLRenderTarget(s,o),w=new e.ShaderMaterial({uniforms:e.UniformsUtils.clone(l.uniforms),fragmentShader:l.fragmentShader,vertexShader:l.vertexShader});w.uniforms.tDiffuse.value=A.texture,w.uniforms.color.value=n,w.uniforms.textureMatrix.value=y,this.material=w,this.onBeforeRender=function(e,t,r){if(u.setFromMatrixPosition(i.matrixWorld),d.setFromMatrixPosition(r.matrixWorld),p.extractRotation(i.matrixWorld),h.set(0,0,1),h.applyMatrix4(p),g.subVectors(u,d),g.dot(h)>0)return;g.reflect(h).negate(),g.add(u),p.extractRotation(r.matrixWorld),m.set(0,0,-1),m.applyMatrix4(p),m.add(d),v.subVectors(u,m),v.reflect(h).negate(),v.add(u),b.position.copy(g),b.up.set(0,1,0),b.up.applyMatrix4(p),b.up.reflect(h),b.lookAt(v),b.far=r.far,b.updateMatrixWorld(),b.projectionMatrix.copy(r.projectionMatrix),y.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),y.multiply(b.projectionMatrix),y.multiply(b.matrixWorldInverse),y.multiply(i.matrixWorld),c.setFromNormalAndCoplanarPoint(h,u),c.applyMatrix4(b.matrixWorldInverse),f.set(c.normal.x,c.normal.y,c.normal.z,c.constant);const n=b.projectionMatrix;x.x=(Math.sign(f.x)+n.elements[8])/n.elements[0],x.y=(Math.sign(f.y)+n.elements[9])/n.elements[5],x.z=-1,x.w=(1+n.elements[10])/n.elements[14],f.multiplyScalar(2/f.dot(x)),n.elements[2]=f.x,n.elements[6]=f.y,n.elements[10]=f.z+1-a,n.elements[14]=f.w,"colorSpace"in A.texture?A.texture.colorSpace=e.outputColorSpace:A.texture.encoding=e.outputEncoding,i.visible=!1;const s=e.getRenderTarget(),o=e.xr.enabled,l=e.shadowMap.autoUpdate;e.xr.enabled=!1,e.shadowMap.autoUpdate=!1,e.setRenderTarget(A),e.state.buffers.depth.setMask(!0),!1===e.autoClear&&e.clear(),e.render(t,b),e.xr.enabled=o,e.shadowMap.autoUpdate=l,e.setRenderTarget(s);const w=r.viewport;void 0!==w&&e.state.viewport(w),i.visible=!0},this.getRenderTarget=function(){return A},this.dispose=function(){A.dispose(),i.material.dispose()}}}Gs.prototype.isReflector=!0,Gs.ReflectorShader={uniforms:{color:{value:null},tDiffuse:{value:null},textureMatrix:{value:null}},vertexShader:"\n\t\tuniform mat4 textureMatrix;\n\t\tvarying vec4 vUv;\n\n\t\t#include <common>\n\t\t#include <logdepthbuf_pars_vertex>\n\n\t\tvoid main() {\n\n\t\t\tvUv = textureMatrix * vec4( position, 1.0 );\n\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t\t#include <logdepthbuf_vertex>\n\n\t\t}",fragmentShader:"\n\t\tuniform vec3 color;\n\t\tuniform sampler2D tDiffuse;\n\t\tvarying vec4 vUv;\n\n\t\t#include <logdepthbuf_pars_fragment>\n\n\t\tfloat blendOverlay( float base, float blend ) {\n\n\t\t\treturn( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) );\n\n\t\t}\n\n\t\tvec3 blendOverlay( vec3 base, vec3 blend ) {\n\n\t\t\treturn vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ), blendOverlay( base.b, blend.b ) );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#include <logdepthbuf_fragment>\n\n\t\t\tvec4 base = texture2DProj( tDiffuse, vUv );\n\t\t\tgl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 );\n\n\t\t}"};class zs extends e.Mesh{constructor(t,r={}){super(t),this.type="Refractor";const i=this,n=void 0!==r.color?new e.Color(r.color):new e.Color(8355711),s=r.textureWidth||512,o=r.textureHeight||512,a=r.clipBias||0,l=r.shader||zs.RefractorShader,c=new e.PerspectiveCamera;c.matrixAutoUpdate=!1,c.userData.refractor=!0;const h=new e.Plane,u=new e.Matrix4,d=new e.WebGLRenderTarget(s,o);this.material=new e.ShaderMaterial({uniforms:e.UniformsUtils.clone(l.uniforms),vertexShader:l.vertexShader,fragmentShader:l.fragmentShader,transparent:!0}),this.material.uniforms.color.value=n,this.material.uniforms.tDiffuse.value=d.texture,this.material.uniforms.textureMatrix.value=u;const p=function(){const t=new e.Vector3,r=new e.Vector3,n=new e.Matrix4,s=new e.Vector3,o=new e.Vector3;return function(e){return t.setFromMatrixPosition(i.matrixWorld),r.setFromMatrixPosition(e.matrixWorld),s.subVectors(t,r),n.extractRotation(i.matrixWorld),o.set(0,0,1),o.applyMatrix4(n),s.dot(o)<0}}(),m=function(){const t=new e.Vector3,r=new e.Vector3,n=new e.Quaternion,s=new e.Vector3;return function(){i.matrixWorld.decompose(r,n,s),t.set(0,0,1).applyQuaternion(n).normalize(),t.negate(),h.setFromNormalAndCoplanarPoint(t,r)}}(),f=function(){const t=new e.Plane,r=new e.Vector4,i=new e.Vector4;return function(e){c.matrixWorld.copy(e.matrixWorld),c.matrixWorldInverse.copy(c.matrixWorld).invert(),c.projectionMatrix.copy(e.projectionMatrix),c.far=e.far,t.copy(h),t.applyMatrix4(c.matrixWorldInverse),r.set(t.normal.x,t.normal.y,t.normal.z,t.constant);const n=c.projectionMatrix;i.x=(Math.sign(r.x)+n.elements[8])/n.elements[0],i.y=(Math.sign(r.y)+n.elements[9])/n.elements[5],i.z=-1,i.w=(1+n.elements[10])/n.elements[14],r.multiplyScalar(2/r.dot(i)),n.elements[2]=r.x,n.elements[6]=r.y,n.elements[10]=r.z+1-a,n.elements[14]=r.w}}();this.onBeforeRender=function(e,t,r){"colorSpace"in d.texture?d.texture.colorSpace=e.outputColorSpace:d.texture.encoding=e.outputEncoding,!0!==r.userData.refractor&&!0!=!p(r)&&(m(),function(e){u.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),u.multiply(e.projectionMatrix),u.multiply(e.matrixWorldInverse),u.multiply(i.matrixWorld)}(r),f(r),function(e,t,r){i.visible=!1;const n=e.getRenderTarget(),s=e.xr.enabled,o=e.shadowMap.autoUpdate;e.xr.enabled=!1,e.shadowMap.autoUpdate=!1,e.setRenderTarget(d),!1===e.autoClear&&e.clear(),e.render(t,c),e.xr.enabled=s,e.shadowMap.autoUpdate=o,e.setRenderTarget(n);const a=r.viewport;void 0!==a&&e.state.viewport(a),i.visible=!0}(e,t,r))},this.getRenderTarget=function(){return d},this.dispose=function(){d.dispose(),i.material.dispose()}}}zs.prototype.isRefractor=!0,zs.RefractorShader={uniforms:{color:{value:null},tDiffuse:{value:null},textureMatrix:{value:null}},vertexShader:"\n\n\t\tuniform mat4 textureMatrix;\n\n\t\tvarying vec4 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = textureMatrix * vec4( position, 1.0 );\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform vec3 color;\n\t\tuniform sampler2D tDiffuse;\n\n\t\tvarying vec4 vUv;\n\n\t\tfloat blendOverlay( float base, float blend ) {\n\n\t\t\treturn( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) );\n\n\t\t}\n\n\t\tvec3 blendOverlay( vec3 base, vec3 blend ) {\n\n\t\t\treturn vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ), blendOverlay( base.b, blend.b ) );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvec4 base = texture2DProj( tDiffuse, vUv );\n\t\t\tgl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 );\n\n\t\t}"};const Hs=new e.Matrix4;class js extends e.Mesh{constructor(t){const r=new e.MeshBasicMaterial({color:0,transparent:!0,opacity:.6,depthWrite:!1});super(t.geometry,r),this.meshMatrix=t.matrixWorld,this.frustumCulled=!1,this.matrixAutoUpdate=!1}update(e,t){const r=e.normal.x*t.x+e.normal.y*t.y+e.normal.z*t.z+-e.constant*t.w,i=Hs.elements;i[0]=r-t.x*e.normal.x,i[4]=-t.x*e.normal.y,i[8]=-t.x*e.normal.z,i[12]=-t.x*-e.constant,i[1]=-t.y*e.normal.x,i[5]=r-t.y*e.normal.y,i[9]=-t.y*e.normal.z,i[13]=-t.y*-e.constant,i[2]=-t.z*e.normal.x,i[6]=-t.z*e.normal.y,i[10]=r-t.z*e.normal.z,i[14]=-t.z*-e.constant,i[3]=-t.w*e.normal.x,i[7]=-t.w*e.normal.y,i[11]=-t.w*e.normal.z,i[15]=r-t.w*-e.constant,this.matrix.multiplyMatrices(Hs,this.meshMatrix)}}js.prototype.isShadowMesh=!0;class Ws extends e.Mesh{constructor(){super(Ws.Geometry,new e.MeshBasicMaterial({opacity:0,transparent:!0})),this.type="Lensflare",this.frustumCulled=!1,this.renderOrder=1/0;const t=new e.Vector3,r=new e.Vector3,i=new e.DataTexture(new Uint8Array(768),16,16,e.RGBAFormat);i.minFilter=e.NearestFilter,i.magFilter=e.NearestFilter,i.wrapS=e.ClampToEdgeWrapping,i.wrapT=e.ClampToEdgeWrapping;const n=new e.DataTexture(new Uint8Array(768),16,16,e.RGBAFormat);n.minFilter=e.NearestFilter,n.magFilter=e.NearestFilter,n.wrapS=e.ClampToEdgeWrapping,n.wrapT=e.ClampToEdgeWrapping;const s=Ws.Geometry,o=new e.RawShaderMaterial({uniforms:{scale:{value:null},screenPosition:{value:null}},vertexShader:"\n\n\t\t\t\tprecision highp float;\n\n\t\t\t\tuniform vec3 screenPosition;\n\t\t\t\tuniform vec2 scale;\n\n\t\t\t\tattribute vec3 position;\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tgl_Position = vec4( position.xy * scale + screenPosition.xy, screenPosition.z, 1.0 );\n\n\t\t\t\t}",fragmentShader:"\n\n\t\t\t\tprecision highp float;\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tgl_FragColor = vec4( 1.0, 0.0, 1.0, 1.0 );\n\n\t\t\t\t}",depthTest:!0,depthWrite:!1,transparent:!1}),a=new e.RawShaderMaterial({uniforms:{map:{value:i},scale:{value:null},screenPosition:{value:null}},vertexShader:"\n\n\t\t\t\tprecision highp float;\n\n\t\t\t\tuniform vec3 screenPosition;\n\t\t\t\tuniform vec2 scale;\n\n\t\t\t\tattribute vec3 position;\n\t\t\t\tattribute vec2 uv;\n\n\t\t\t\tvarying vec2 vUV;\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvUV = uv;\n\n\t\t\t\t\tgl_Position = vec4( position.xy * scale + screenPosition.xy, screenPosition.z, 1.0 );\n\n\t\t\t\t}",fragmentShader:"\n\n\t\t\t\tprecision highp float;\n\n\t\t\t\tuniform sampler2D map;\n\n\t\t\t\tvarying vec2 vUV;\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tgl_FragColor = texture2D( map, vUV );\n\n\t\t\t\t}",depthTest:!1,depthWrite:!1,transparent:!1}),l=new e.Mesh(s,o),c=[],h=Xs.Shader,u=new e.RawShaderMaterial({uniforms:{map:{value:null},occlusionMap:{value:n},color:{value:new e.Color(16777215)},scale:{value:new e.Vector2},screenPosition:{value:new e.Vector3}},vertexShader:h.vertexShader,fragmentShader:h.fragmentShader,blending:e.AdditiveBlending,transparent:!0,depthWrite:!1}),d=new e.Mesh(s,u);this.addElement=function(e){c.push(e)};const p=new e.Vector2,m=new e.Vector2,f=new e.Box2,g=new e.Vector4;this.onBeforeRender=function(e,h,v){e.getCurrentViewport(g);const x=g.w/g.z,y=g.z/2,b=g.w/2;let A=16/g.w;if(p.set(A*x,A),f.min.set(g.x,g.y),f.max.set(g.x+(g.z-16),g.y+(g.w-16)),r.setFromMatrixPosition(this.matrixWorld),r.applyMatrix4(v.matrixWorldInverse),!(r.z>0)&&(t.copy(r).applyMatrix4(v.projectionMatrix),m.x=g.x+t.x*y+y-8,m.y=g.y+t.y*b+b-8,f.containsPoint(m))){e.copyFramebufferToTexture(m,i);let r=o.uniforms;r.scale.value=p,r.screenPosition.value=t,e.renderBufferDirect(v,null,s,o,l,null),e.copyFramebufferToTexture(m,n),r=a.uniforms,r.scale.value=p,r.screenPosition.value=t,e.renderBufferDirect(v,null,s,a,l,null);const h=2*-t.x,f=2*-t.y;for(let r=0,i=c.length;r<i;r++){const i=c[r],n=u.uniforms;n.color.value.copy(i.color),n.map.value=i.texture,n.screenPosition.value.x=t.x+h*i.distance,n.screenPosition.value.y=t.y+f*i.distance,A=i.size/g.w;const o=g.w/g.z;n.scale.value.set(A*o,A),u.uniformsNeedUpdate=!0,e.renderBufferDirect(v,null,s,u,d,null)}}},this.dispose=function(){o.dispose(),a.dispose(),u.dispose(),i.dispose(),n.dispose();for(let e=0,t=c.length;e<t;e++)c[e].texture.dispose()}}}Ws.prototype.isLensflare=!0;class Xs{constructor(t,r=1,i=0,n=new e.Color(16777215)){this.texture=t,this.size=r,this.distance=i,this.color=n}}Xs.Shader={uniforms:{map:{value:null},occlusionMap:{value:null},color:{value:null},scale:{value:null},screenPosition:{value:null}},vertexShader:"\n\n\t\tprecision highp float;\n\n\t\tuniform vec3 screenPosition;\n\t\tuniform vec2 scale;\n\n\t\tuniform sampler2D occlusionMap;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\n\t\tvarying vec2 vUV;\n\t\tvarying float vVisibility;\n\n\t\tvoid main() {\n\n\t\t\tvUV = uv;\n\n\t\t\tvec2 pos = position.xy;\n\n\t\t\tvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );\n\t\t\tvisibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );\n\t\t\tvisibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );\n\t\t\tvisibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );\n\t\t\tvisibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );\n\t\t\tvisibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );\n\t\t\tvisibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );\n\t\t\tvisibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );\n\t\t\tvisibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );\n\n\t\t\tvVisibility = visibility.r / 9.0;\n\t\t\tvVisibility *= 1.0 - visibility.g / 9.0;\n\t\t\tvVisibility *= visibility.b / 9.0;\n\n\t\t\tgl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tprecision highp float;\n\n\t\tuniform sampler2D map;\n\t\tuniform vec3 color;\n\n\t\tvarying vec2 vUV;\n\t\tvarying float vVisibility;\n\n\t\tvoid main() {\n\n\t\t\tvec4 texture = texture2D( map, vUV );\n\t\t\ttexture.a *= vVisibility;\n\t\t\tgl_FragColor = texture;\n\t\t\tgl_FragColor.rgb *= color;\n\n\t\t}"},Ws.Geometry=function(){const t=new e.BufferGeometry,r=new Float32Array([-1,-1,0,0,0,1,-1,0,1,0,1,1,0,1,1,-1,1,0,0,1]),i=new e.InterleavedBuffer(r,5);return t.setIndex([0,1,2,0,2,3]),t.setAttribute("position",new e.InterleavedBufferAttribute(i,3,0,!1)),t.setAttribute("uv",new e.InterleavedBufferAttribute(i,2,3,!1)),t}();class Qs extends e.Mesh{constructor(t,r={}){super(t);const i=this,n=void 0!==r.textureWidth?r.textureWidth:512,s=void 0!==r.textureHeight?r.textureHeight:512,o=void 0!==r.clipBias?r.clipBias:0,a=void 0!==r.alpha?r.alpha:1,l=void 0!==r.time?r.time:0,c=void 0!==r.waterNormals?r.waterNormals:null,h=void 0!==r.sunDirection?r.sunDirection:new e.Vector3(.70707,.70707,0),u=new e.Color(void 0!==r.sunColor?r.sunColor:16777215),d=new e.Color(void 0!==r.waterColor?r.waterColor:8355711),p=void 0!==r.eye?r.eye:new e.Vector3(0,0,0),m=void 0!==r.distortionScale?r.distortionScale:20,f=void 0!==r.side?r.side:e.FrontSide,g=void 0!==r.fog&&r.fog,v=new e.Plane,x=new e.Vector3,y=new e.Vector3,b=new e.Vector3,A=new e.Matrix4,w=new e.Vector3(0,0,-1),M=new e.Vector4,T=new e.Vector3,S=new e.Vector3,C=new e.Vector4,F=new e.Matrix4,E=new e.PerspectiveCamera,_=new e.WebGLRenderTarget(n,s),P={uniforms:e.UniformsUtils.merge([e.UniformsLib.fog,e.UniformsLib.lights,{normalSampler:{value:null},mirrorSampler:{value:null},alpha:{value:1},time:{value:0},size:{value:1},distortionScale:{value:20},textureMatrix:{value:new e.Matrix4},sunColor:{value:new e.Color(8355711)},sunDirection:{value:new e.Vector3(.70707,.70707,0)},eye:{value:new e.Vector3},waterColor:{value:new e.Color(5592405)}}]),vertexShader:"\n\t\t\t\tuniform mat4 textureMatrix;\n\t\t\t\tuniform float time;\n\n\t\t\t\tvarying vec4 mirrorCoord;\n\t\t\t\tvarying vec4 worldPosition;\n\n\t\t\t\t#include <common>\n\t\t\t\t#include <fog_pars_vertex>\n\t\t\t\t#include <shadowmap_pars_vertex>\n\t\t\t\t#include <logdepthbuf_pars_vertex>\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tmirrorCoord = modelMatrix * vec4( position, 1.0 );\n\t\t\t\t\tworldPosition = mirrorCoord.xyzw;\n\t\t\t\t\tmirrorCoord = textureMatrix * mirrorCoord;\n\t\t\t\t\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t\tgl_Position = projectionMatrix * mvPosition;\n\n\t\t\t\t#include <beginnormal_vertex>\n\t\t\t\t#include <defaultnormal_vertex>\n\t\t\t\t#include <logdepthbuf_vertex>\n\t\t\t\t#include <fog_vertex>\n\t\t\t\t#include <shadowmap_vertex>\n\t\t\t}",fragmentShader:"\n\t\t\t\tuniform sampler2D mirrorSampler;\n\t\t\t\tuniform float alpha;\n\t\t\t\tuniform float time;\n\t\t\t\tuniform float size;\n\t\t\t\tuniform float distortionScale;\n\t\t\t\tuniform sampler2D normalSampler;\n\t\t\t\tuniform vec3 sunColor;\n\t\t\t\tuniform vec3 sunDirection;\n\t\t\t\tuniform vec3 eye;\n\t\t\t\tuniform vec3 waterColor;\n\n\t\t\t\tvarying vec4 mirrorCoord;\n\t\t\t\tvarying vec4 worldPosition;\n\n\t\t\t\tvec4 getNoise( vec2 uv ) {\n\t\t\t\t\tvec2 uv0 = ( uv / 103.0 ) + vec2(time / 17.0, time / 29.0);\n\t\t\t\t\tvec2 uv1 = uv / 107.0-vec2( time / -19.0, time / 31.0 );\n\t\t\t\t\tvec2 uv2 = uv / vec2( 8907.0, 9803.0 ) + vec2( time / 101.0, time / 97.0 );\n\t\t\t\t\tvec2 uv3 = uv / vec2( 1091.0, 1027.0 ) - vec2( time / 109.0, time / -113.0 );\n\t\t\t\t\tvec4 noise = texture2D( normalSampler, uv0 ) +\n\t\t\t\t\t\ttexture2D( normalSampler, uv1 ) +\n\t\t\t\t\t\ttexture2D( normalSampler, uv2 ) +\n\t\t\t\t\t\ttexture2D( normalSampler, uv3 );\n\t\t\t\t\treturn noise * 0.5 - 1.0;\n\t\t\t\t}\n\n\t\t\t\tvoid sunLight( const vec3 surfaceNormal, const vec3 eyeDirection, float shiny, float spec, float diffuse, inout vec3 diffuseColor, inout vec3 specularColor ) {\n\t\t\t\t\tvec3 reflection = normalize( reflect( -sunDirection, surfaceNormal ) );\n\t\t\t\t\tfloat direction = max( 0.0, dot( eyeDirection, reflection ) );\n\t\t\t\t\tspecularColor += pow( direction, shiny ) * sunColor * spec;\n\t\t\t\t\tdiffuseColor += max( dot( sunDirection, surfaceNormal ), 0.0 ) * sunColor * diffuse;\n\t\t\t\t}\n\n\t\t\t\t#include <common>\n\t\t\t\t#include <packing>\n\t\t\t\t#include <bsdfs>\n\t\t\t\t#include <fog_pars_fragment>\n\t\t\t\t#include <logdepthbuf_pars_fragment>\n\t\t\t\t#include <lights_pars_begin>\n\t\t\t\t#include <shadowmap_pars_fragment>\n\t\t\t\t#include <shadowmask_pars_fragment>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\t#include <logdepthbuf_fragment>\n\t\t\t\t\tvec4 noise = getNoise( worldPosition.xz * size );\n\t\t\t\t\tvec3 surfaceNormal = normalize( noise.xzy * vec3( 1.5, 1.0, 1.5 ) );\n\n\t\t\t\t\tvec3 diffuseLight = vec3(0.0);\n\t\t\t\t\tvec3 specularLight = vec3(0.0);\n\n\t\t\t\t\tvec3 worldToEye = eye-worldPosition.xyz;\n\t\t\t\t\tvec3 eyeDirection = normalize( worldToEye );\n\t\t\t\t\tsunLight( surfaceNormal, eyeDirection, 100.0, 2.0, 0.5, diffuseLight, specularLight );\n\n\t\t\t\t\tfloat distance = length(worldToEye);\n\n\t\t\t\t\tvec2 distortion = surfaceNormal.xz * ( 0.001 + 1.0 / distance ) * distortionScale;\n\t\t\t\t\tvec3 reflectionSample = vec3( texture2D( mirrorSampler, mirrorCoord.xy / mirrorCoord.w + distortion ) );\n\n\t\t\t\t\tfloat theta = max( dot( eyeDirection, surfaceNormal ), 0.0 );\n\t\t\t\t\tfloat rf0 = 0.3;\n\t\t\t\t\tfloat reflectance = rf0 + ( 1.0 - rf0 ) * pow( ( 1.0 - theta ), 5.0 );\n\t\t\t\t\tvec3 scatter = max( 0.0, dot( surfaceNormal, eyeDirection ) ) * waterColor;\n\t\t\t\t\tvec3 albedo = mix( ( sunColor * diffuseLight * 0.3 + scatter ) * getShadowMask(), ( vec3( 0.1 ) + reflectionSample * 0.9 + reflectionSample * specularLight ), reflectance);\n\t\t\t\t\tvec3 outgoingLight = albedo;\n\t\t\t\t\tgl_FragColor = vec4( outgoingLight, alpha );\n\n\t\t\t\t\t#include <tonemapping_fragment>\n\t\t\t\t\t#include <fog_fragment>\n\t\t\t\t}"},B=new e.ShaderMaterial({fragmentShader:P.fragmentShader,vertexShader:P.vertexShader,uniforms:e.UniformsUtils.clone(P.uniforms),lights:!0,side:f,fog:g});B.uniforms.mirrorSampler.value=_.texture,B.uniforms.textureMatrix.value=F,B.uniforms.alpha.value=a,B.uniforms.time.value=l,B.uniforms.normalSampler.value=c,B.uniforms.sunColor.value=u,B.uniforms.waterColor.value=d,B.uniforms.sunDirection.value=h,B.uniforms.distortionScale.value=m,B.uniforms.eye.value=p,i.material=B,i.onBeforeRender=function(e,t,r){if(y.setFromMatrixPosition(i.matrixWorld),b.setFromMatrixPosition(r.matrixWorld),A.extractRotation(i.matrixWorld),x.set(0,0,1),x.applyMatrix4(A),T.subVectors(y,b),T.dot(x)>0)return;T.reflect(x).negate(),T.add(y),A.extractRotation(r.matrixWorld),w.set(0,0,-1),w.applyMatrix4(A),w.add(b),S.subVectors(y,w),S.reflect(x).negate(),S.add(y),E.position.copy(T),E.up.set(0,1,0),E.up.applyMatrix4(A),E.up.reflect(x),E.lookAt(S),E.far=r.far,E.updateMatrixWorld(),E.projectionMatrix.copy(r.projectionMatrix),F.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),F.multiply(E.projectionMatrix),F.multiply(E.matrixWorldInverse),v.setFromNormalAndCoplanarPoint(x,y),v.applyMatrix4(E.matrixWorldInverse),M.set(v.normal.x,v.normal.y,v.normal.z,v.constant);const n=E.projectionMatrix;C.x=(Math.sign(M.x)+n.elements[8])/n.elements[0],C.y=(Math.sign(M.y)+n.elements[9])/n.elements[5],C.z=-1,C.w=(1+n.elements[10])/n.elements[14],M.multiplyScalar(2/M.dot(C)),n.elements[2]=M.x,n.elements[6]=M.y,n.elements[10]=M.z+1-o,n.elements[14]=M.w,p.setFromMatrixPosition(r.matrixWorld);const s=e.getRenderTarget(),a=e.xr.enabled,l=e.shadowMap.autoUpdate;i.visible=!1,e.xr.enabled=!1,e.shadowMap.autoUpdate=!1,e.setRenderTarget(_),e.state.buffers.depth.setMask(!0),!1===e.autoClear&&e.clear(),e.render(t,E),i.visible=!0,e.xr.enabled=a,e.shadowMap.autoUpdate=l,e.setRenderTarget(s);const c=r.viewport;void 0!==c&&e.state.viewport(c)}}}Qs.prototype.isWater=!0;class Ys extends e.Mesh{constructor(t,r,i=!1,n=!1,s=1e4){const o=new e.BufferGeometry;super(o,r);const a=this,l=new Float32Array(36),c=new Float32Array(36),h=new Float32Array(36);function u(e,t,r){return e+(t-e)*r}function d(e,t,r,i,n,s,o,d,p,m){const f=(r-o)/(d-o),g=a.normal_cache;l[t+0]=i+f*a.delta,l[t+1]=n,l[t+2]=s,c[t+0]=u(g[e+0],g[e+3],f),c[t+1]=u(g[e+1],g[e+4],f),c[t+2]=u(g[e+2],g[e+5],f),h[t+0]=u(a.palette[3*p+0],a.palette[3*m+0],f),h[t+1]=u(a.palette[3*p+1],a.palette[3*m+1],f),h[t+2]=u(a.palette[3*p+2],a.palette[3*m+2],f)}function p(e,t,r,i,n,s,o,d,p,m){const f=(r-o)/(d-o),g=a.normal_cache;l[t+0]=i,l[t+1]=n+f*a.delta,l[t+2]=s;const v=e+3*a.yd;c[t+0]=u(g[e+0],g[v+0],f),c[t+1]=u(g[e+1],g[v+1],f),c[t+2]=u(g[e+2],g[v+2],f),h[t+0]=u(a.palette[3*p+0],a.palette[3*m+0],f),h[t+1]=u(a.palette[3*p+1],a.palette[3*m+1],f),h[t+2]=u(a.palette[3*p+2],a.palette[3*m+2],f)}function m(e,t,r,i,n,s,o,d,p,m){const f=(r-o)/(d-o),g=a.normal_cache;l[t+0]=i,l[t+1]=n,l[t+2]=s+f*a.delta;const v=e+3*a.zd;c[t+0]=u(g[e+0],g[v+0],f),c[t+1]=u(g[e+1],g[v+1],f),c[t+2]=u(g[e+2],g[v+2],f),h[t+0]=u(a.palette[3*p+0],a.palette[3*m+0],f),h[t+1]=u(a.palette[3*p+1],a.palette[3*m+1],f),h[t+2]=u(a.palette[3*p+2],a.palette[3*m+2],f)}function f(e){const t=3*e;0===a.normal_cache[t]&&(a.normal_cache[t+0]=a.field[e-1]-a.field[e+1],a.normal_cache[t+1]=a.field[e-a.yd]-a.field[e+a.yd],a.normal_cache[t+2]=a.field[e-a.zd]-a.field[e+a.zd])}function g(e,t,r,i,n){const s=i+1,o=i+a.yd,u=i+a.zd,g=s+a.yd,x=s+a.zd,y=i+a.yd+a.zd,b=s+a.yd+a.zd;let A=0;const w=a.field[i],M=a.field[s],T=a.field[o],S=a.field[g],C=a.field[u],F=a.field[x],E=a.field[y],_=a.field[b];w<n&&(A|=1),M<n&&(A|=2),T<n&&(A|=8),S<n&&(A|=4),C<n&&(A|=16),F<n&&(A|=32),E<n&&(A|=128),_<n&&(A|=64);const P=Ks[A];if(0===P)return 0;const B=a.delta,L=e+B,R=t+B,N=r+B;1&P&&(f(i),f(s),d(3*i,0,n,e,t,r,w,M,i,s)),2&P&&(f(s),f(g),p(3*s,3,n,L,t,r,M,S,s,g)),4&P&&(f(o),f(g),d(3*o,6,n,e,R,r,T,S,o,g)),8&P&&(f(i),f(o),p(3*i,9,n,e,t,r,w,T,i,o)),16&P&&(f(u),f(x),d(3*u,12,n,e,t,N,C,F,u,x)),32&P&&(f(x),f(b),p(3*x,15,n,L,t,N,F,_,x,b)),64&P&&(f(y),f(b),d(3*y,18,n,e,R,N,E,_,y,b)),128&P&&(f(u),f(y),p(3*u,21,n,e,t,N,C,E,u,y)),256&P&&(f(i),f(u),m(3*i,24,n,e,t,r,w,C,i,u)),512&P&&(f(s),f(x),m(3*s,27,n,L,t,r,M,F,s,x)),1024&P&&(f(g),f(b),m(3*g,30,n,L,R,r,S,_,g,b)),2048&P&&(f(o),f(y),m(3*o,33,n,e,R,r,T,E,o,y)),A<<=4;let D,I,U,O=0,k=0;for(;-1!=qs[A+k];)D=A+k,I=D+1,U=D+2,v(l,c,h,3*qs[D],3*qs[I],3*qs[U]),k+=3,O++;return O}function v(e,t,r,i,n,s){const o=3*a.count;if(a.positionArray[o+0]=e[i],a.positionArray[o+1]=e[i+1],a.positionArray[o+2]=e[i+2],a.positionArray[o+3]=e[n],a.positionArray[o+4]=e[n+1],a.positionArray[o+5]=e[n+2],a.positionArray[o+6]=e[s],a.positionArray[o+7]=e[s+1],a.positionArray[o+8]=e[s+2],!0===a.material.flatShading){const e=(t[i+0]+t[n+0]+t[s+0])/3,r=(t[i+1]+t[n+1]+t[s+1])/3,l=(t[i+2]+t[n+2]+t[s+2])/3;a.normalArray[o+0]=e,a.normalArray[o+1]=r,a.normalArray[o+2]=l,a.normalArray[o+3]=e,a.normalArray[o+4]=r,a.normalArray[o+5]=l,a.normalArray[o+6]=e,a.normalArray[o+7]=r,a.normalArray[o+8]=l}else a.normalArray[o+0]=t[i+0],a.normalArray[o+1]=t[i+1],a.normalArray[o+2]=t[i+2],a.normalArray[o+3]=t[n+0],a.normalArray[o+4]=t[n+1],a.normalArray[o+5]=t[n+2],a.normalArray[o+6]=t[s+0],a.normalArray[o+7]=t[s+1],a.normalArray[o+8]=t[s+2];if(a.enableUvs){const t=2*a.count;a.uvArray[t+0]=e[i+0],a.uvArray[t+1]=e[i+2],a.uvArray[t+2]=e[n+0],a.uvArray[t+3]=e[n+2],a.uvArray[t+4]=e[s+0],a.uvArray[t+5]=e[s+2]}a.enableColors&&(a.colorArray[o+0]=r[i+0],a.colorArray[o+1]=r[i+1],a.colorArray[o+2]=r[i+2],a.colorArray[o+3]=r[n+0],a.colorArray[o+4]=r[n+1],a.colorArray[o+5]=r[n+2],a.colorArray[o+6]=r[s+0],a.colorArray[o+7]=r[s+1],a.colorArray[o+8]=r[s+2]),a.count+=3}this.enableUvs=i,this.enableColors=n,this.init=function(t){this.resolution=t,this.isolation=80,this.size=t,this.size2=this.size*this.size,this.size3=this.size2*this.size,this.halfsize=this.size/2,this.delta=2/this.size,this.yd=this.size,this.zd=this.size2,this.field=new Float32Array(this.size3),this.normal_cache=new Float32Array(3*this.size3),this.palette=new Float32Array(3*this.size3),this.count=0;const r=3*s;this.positionArray=new Float32Array(3*r);const i=new e.BufferAttribute(this.positionArray,3);i.setUsage(e.DynamicDrawUsage),o.setAttribute("position",i),this.normalArray=new Float32Array(3*r);const n=new e.BufferAttribute(this.normalArray,3);if(n.setUsage(e.DynamicDrawUsage),o.setAttribute("normal",n),this.enableUvs){this.uvArray=new Float32Array(2*r);const t=new e.BufferAttribute(this.uvArray,2);t.setUsage(e.DynamicDrawUsage),o.setAttribute("uv",t)}if(this.enableColors){this.colorArray=new Float32Array(3*r);const t=new e.BufferAttribute(this.colorArray,3);t.setUsage(e.DynamicDrawUsage),o.setAttribute("color",t)}},this.addBall=function(t,r,i,n,s,o){const a=Math.sign(n);n=Math.abs(n);const l=!(null==o);let c=new e.Color(t,r,i);if(l)try{c=o instanceof e.Color?o:Array.isArray(o)?new e.Color(Math.min(Math.abs(o[0]),1),Math.min(Math.abs(o[1]),1),Math.min(Math.abs(o[2]),1)):new e.Color(o)}catch(n){c=new e.Color(t,r,i)}const h=this.size*Math.sqrt(n/s),u=i*this.size,d=r*this.size,p=t*this.size;let m=Math.floor(u-h);m<1&&(m=1);let f=Math.floor(u+h);f>this.size-1&&(f=this.size-1);let g=Math.floor(d-h);g<1&&(g=1);let v=Math.floor(d+h);v>this.size-1&&(v=this.size-1);let x=Math.floor(p-h);x<1&&(x=1);let y,b,A,w,M,T,S,C,F,E,_,P=Math.floor(p+h);for(P>this.size-1&&(P=this.size-1),A=m;A<f;A++)for(M=this.size2*A,C=A/this.size-i,F=C*C,b=g;b<v;b++)for(w=M+this.size*b,S=b/this.size-r,E=S*S,y=x;y<P;y++)if(T=y/this.size-t,_=n/(1e-6+T*T+E+F)-s,_>0){this.field[w+y]+=_*a;const e=Math.sqrt((y-p)*(y-p)+(b-d)*(b-d)+(A-u)*(A-u))/h,t=1-e*e*e*(e*(6*e-15)+10);this.palette[3*(w+y)+0]+=c.r*t,this.palette[3*(w+y)+1]+=c.g*t,this.palette[3*(w+y)+2]+=c.b*t}},this.addPlaneX=function(e,t){const r=this.size,i=this.yd,n=this.zd,s=this.field;let o,a,l,c,h,u,d,p=r*Math.sqrt(e/t);for(p>r&&(p=r),o=0;o<p;o++)if(u=o/r,c=u*u,h=e/(1e-4+c)-t,h>0)for(a=0;a<r;a++)for(d=o+a*i,l=0;l<r;l++)s[n*l+d]+=h},this.addPlaneY=function(e,t){const r=this.size,i=this.yd,n=this.zd,s=this.field;let o,a,l,c,h,u,d,p,m=r*Math.sqrt(e/t);for(m>r&&(m=r),a=0;a<m;a++)if(u=a/r,c=u*u,h=e/(1e-4+c)-t,h>0)for(d=a*i,o=0;o<r;o++)for(p=d+o,l=0;l<r;l++)s[n*l+p]+=h},this.addPlaneZ=function(e,t){const r=this.size,i=this.yd,n=this.zd,s=this.field;let o,a,l,c,h,u,d,p,m=r*Math.sqrt(e/t);for(m>r&&(m=r),l=0;l<m;l++)if(u=l/r,c=u*u,h=e/(1e-4+c)-t,h>0)for(d=n*l,a=0;a<r;a++)for(p=d+a*i,o=0;o<r;o++)s[p+o]+=h},this.setCell=function(e,t,r,i){const n=this.size2*r+this.size*t+e;this.field[n]=i},this.getCell=function(e,t,r){const i=this.size2*r+this.size*t+e;return this.field[i]},this.blur=function(e=1){const t=this.field,r=t.slice(),i=this.size,n=this.size2;for(let s=0;s<i;s++)for(let o=0;o<i;o++)for(let a=0;a<i;a++){const l=n*a+i*o+s;let c=r[l],h=1;for(let t=-1;t<=1;t+=2){const l=t+s;if(!(l<0||l>=i))for(let t=-1;t<=1;t+=2){const s=t+o;if(!(s<0||s>=i))for(let t=-1;t<=1;t+=2){const o=t+a;if(o<0||o>=i)continue;const u=r[n*o+i*s+l];h++,c+=e*(u-c)/h}}}t[l]=c}},this.reset=function(){for(let e=0;e<this.size3;e++)this.normal_cache[3*e]=0,this.field[e]=0,this.palette[3*e]=this.palette[3*e+1]=this.palette[3*e+2]=0},this.onBeforeRender=function(){this.count=0;const e=this.size-2;for(let t=1;t<e;t++){const r=this.size2*t,i=(t-this.halfsize)/this.halfsize;for(let t=1;t<e;t++){const n=r+this.size*t,s=(t-this.halfsize)/this.halfsize;for(let t=1;t<e;t++){g((t-this.halfsize)/this.halfsize,s,i,n+t,this.isolation)}}}for(let e=3*this.count;e<this.positionArray.length;e++)this.positionArray[e]=0;o.getAttribute("position").needsUpdate=!0,o.getAttribute("normal").needsUpdate=!0,this.enableUvs&&(o.getAttribute("uv").needsUpdate=!0),this.enableColors&&(o.getAttribute("color").needsUpdate=!0),this.count/3>s&&console.warn("MarchingCubes: Geometry buffers too small for rendering. Please create an instance with a higher poly count.")},this.init(t)}}Ys.prototype.isMarchingCubes=!0;const Ks=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]),qs=new Int32Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,8,3,9,8,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,1,2,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,2,10,0,2,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,8,3,2,10,8,10,9,8,-1,-1,-1,-1,-1,-1,-1,3,11,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,11,2,8,11,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,9,0,2,3,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,11,2,1,9,11,9,8,11,-1,-1,-1,-1,-1,-1,-1,3,10,1,11,10,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,10,1,0,8,10,8,11,10,-1,-1,-1,-1,-1,-1,-1,3,9,0,3,11,9,11,10,9,-1,-1,-1,-1,-1,-1,-1,9,8,10,10,8,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,7,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,3,0,7,3,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,8,4,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,1,9,4,7,1,7,3,1,-1,-1,-1,-1,-1,-1,-1,1,2,10,8,4,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,4,7,3,0,4,1,2,10,-1,-1,-1,-1,-1,-1,-1,9,2,10,9,0,2,8,4,7,-1,-1,-1,-1,-1,-1,-1,2,10,9,2,9,7,2,7,3,7,9,4,-1,-1,-1,-1,8,4,7,3,11,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,4,7,11,2,4,2,0,4,-1,-1,-1,-1,-1,-1,-1,9,0,1,8,4,7,2,3,11,-1,-1,-1,-1,-1,-1,-1,4,7,11,9,4,11,9,11,2,9,2,1,-1,-1,-1,-1,3,10,1,3,11,10,7,8,4,-1,-1,-1,-1,-1,-1,-1,1,11,10,1,4,11,1,0,4,7,11,4,-1,-1,-1,-1,4,7,8,9,0,11,9,11,10,11,0,3,-1,-1,-1,-1,4,7,11,4,11,9,9,11,10,-1,-1,-1,-1,-1,-1,-1,9,5,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,5,4,0,8,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,5,4,1,5,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,5,4,8,3,5,3,1,5,-1,-1,-1,-1,-1,-1,-1,1,2,10,9,5,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,8,1,2,10,4,9,5,-1,-1,-1,-1,-1,-1,-1,5,2,10,5,4,2,4,0,2,-1,-1,-1,-1,-1,-1,-1,2,10,5,3,2,5,3,5,4,3,4,8,-1,-1,-1,-1,9,5,4,2,3,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,11,2,0,8,11,4,9,5,-1,-1,-1,-1,-1,-1,-1,0,5,4,0,1,5,2,3,11,-1,-1,-1,-1,-1,-1,-1,2,1,5,2,5,8,2,8,11,4,8,5,-1,-1,-1,-1,10,3,11,10,1,3,9,5,4,-1,-1,-1,-1,-1,-1,-1,4,9,5,0,8,1,8,10,1,8,11,10,-1,-1,-1,-1,5,4,0,5,0,11,5,11,10,11,0,3,-1,-1,-1,-1,5,4,8,5,8,10,10,8,11,-1,-1,-1,-1,-1,-1,-1,9,7,8,5,7,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,3,0,9,5,3,5,7,3,-1,-1,-1,-1,-1,-1,-1,0,7,8,0,1,7,1,5,7,-1,-1,-1,-1,-1,-1,-1,1,5,3,3,5,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,7,8,9,5,7,10,1,2,-1,-1,-1,-1,-1,-1,-1,10,1,2,9,5,0,5,3,0,5,7,3,-1,-1,-1,-1,8,0,2,8,2,5,8,5,7,10,5,2,-1,-1,-1,-1,2,10,5,2,5,3,3,5,7,-1,-1,-1,-1,-1,-1,-1,7,9,5,7,8,9,3,11,2,-1,-1,-1,-1,-1,-1,-1,9,5,7,9,7,2,9,2,0,2,7,11,-1,-1,-1,-1,2,3,11,0,1,8,1,7,8,1,5,7,-1,-1,-1,-1,11,2,1,11,1,7,7,1,5,-1,-1,-1,-1,-1,-1,-1,9,5,8,8,5,7,10,1,3,10,3,11,-1,-1,-1,-1,5,7,0,5,0,9,7,11,0,1,0,10,11,10,0,-1,11,10,0,11,0,3,10,5,0,8,0,7,5,7,0,-1,11,10,5,7,11,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,6,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,5,10,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,0,1,5,10,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,8,3,1,9,8,5,10,6,-1,-1,-1,-1,-1,-1,-1,1,6,5,2,6,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,6,5,1,2,6,3,0,8,-1,-1,-1,-1,-1,-1,-1,9,6,5,9,0,6,0,2,6,-1,-1,-1,-1,-1,-1,-1,5,9,8,5,8,2,5,2,6,3,2,8,-1,-1,-1,-1,2,3,11,10,6,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,0,8,11,2,0,10,6,5,-1,-1,-1,-1,-1,-1,-1,0,1,9,2,3,11,5,10,6,-1,-1,-1,-1,-1,-1,-1,5,10,6,1,9,2,9,11,2,9,8,11,-1,-1,-1,-1,6,3,11,6,5,3,5,1,3,-1,-1,-1,-1,-1,-1,-1,0,8,11,0,11,5,0,5,1,5,11,6,-1,-1,-1,-1,3,11,6,0,3,6,0,6,5,0,5,9,-1,-1,-1,-1,6,5,9,6,9,11,11,9,8,-1,-1,-1,-1,-1,-1,-1,5,10,6,4,7,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,3,0,4,7,3,6,5,10,-1,-1,-1,-1,-1,-1,-1,1,9,0,5,10,6,8,4,7,-1,-1,-1,-1,-1,-1,-1,10,6,5,1,9,7,1,7,3,7,9,4,-1,-1,-1,-1,6,1,2,6,5,1,4,7,8,-1,-1,-1,-1,-1,-1,-1,1,2,5,5,2,6,3,0,4,3,4,7,-1,-1,-1,-1,8,4,7,9,0,5,0,6,5,0,2,6,-1,-1,-1,-1,7,3,9,7,9,4,3,2,9,5,9,6,2,6,9,-1,3,11,2,7,8,4,10,6,5,-1,-1,-1,-1,-1,-1,-1,5,10,6,4,7,2,4,2,0,2,7,11,-1,-1,-1,-1,0,1,9,4,7,8,2,3,11,5,10,6,-1,-1,-1,-1,9,2,1,9,11,2,9,4,11,7,11,4,5,10,6,-1,8,4,7,3,11,5,3,5,1,5,11,6,-1,-1,-1,-1,5,1,11,5,11,6,1,0,11,7,11,4,0,4,11,-1,0,5,9,0,6,5,0,3,6,11,6,3,8,4,7,-1,6,5,9,6,9,11,4,7,9,7,11,9,-1,-1,-1,-1,10,4,9,6,4,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,10,6,4,9,10,0,8,3,-1,-1,-1,-1,-1,-1,-1,10,0,1,10,6,0,6,4,0,-1,-1,-1,-1,-1,-1,-1,8,3,1,8,1,6,8,6,4,6,1,10,-1,-1,-1,-1,1,4,9,1,2,4,2,6,4,-1,-1,-1,-1,-1,-1,-1,3,0,8,1,2,9,2,4,9,2,6,4,-1,-1,-1,-1,0,2,4,4,2,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,3,2,8,2,4,4,2,6,-1,-1,-1,-1,-1,-1,-1,10,4,9,10,6,4,11,2,3,-1,-1,-1,-1,-1,-1,-1,0,8,2,2,8,11,4,9,10,4,10,6,-1,-1,-1,-1,3,11,2,0,1,6,0,6,4,6,1,10,-1,-1,-1,-1,6,4,1,6,1,10,4,8,1,2,1,11,8,11,1,-1,9,6,4,9,3,6,9,1,3,11,6,3,-1,-1,-1,-1,8,11,1,8,1,0,11,6,1,9,1,4,6,4,1,-1,3,11,6,3,6,0,0,6,4,-1,-1,-1,-1,-1,-1,-1,6,4,8,11,6,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,10,6,7,8,10,8,9,10,-1,-1,-1,-1,-1,-1,-1,0,7,3,0,10,7,0,9,10,6,7,10,-1,-1,-1,-1,10,6,7,1,10,7,1,7,8,1,8,0,-1,-1,-1,-1,10,6,7,10,7,1,1,7,3,-1,-1,-1,-1,-1,-1,-1,1,2,6,1,6,8,1,8,9,8,6,7,-1,-1,-1,-1,2,6,9,2,9,1,6,7,9,0,9,3,7,3,9,-1,7,8,0,7,0,6,6,0,2,-1,-1,-1,-1,-1,-1,-1,7,3,2,6,7,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,11,10,6,8,10,8,9,8,6,7,-1,-1,-1,-1,2,0,7,2,7,11,0,9,7,6,7,10,9,10,7,-1,1,8,0,1,7,8,1,10,7,6,7,10,2,3,11,-1,11,2,1,11,1,7,10,6,1,6,7,1,-1,-1,-1,-1,8,9,6,8,6,7,9,1,6,11,6,3,1,3,6,-1,0,9,1,11,6,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,8,0,7,0,6,3,11,0,11,6,0,-1,-1,-1,-1,7,11,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,6,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,8,11,7,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,11,7,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,1,9,8,3,1,11,7,6,-1,-1,-1,-1,-1,-1,-1,10,1,2,6,11,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,10,3,0,8,6,11,7,-1,-1,-1,-1,-1,-1,-1,2,9,0,2,10,9,6,11,7,-1,-1,-1,-1,-1,-1,-1,6,11,7,2,10,3,10,8,3,10,9,8,-1,-1,-1,-1,7,2,3,6,2,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,0,8,7,6,0,6,2,0,-1,-1,-1,-1,-1,-1,-1,2,7,6,2,3,7,0,1,9,-1,-1,-1,-1,-1,-1,-1,1,6,2,1,8,6,1,9,8,8,7,6,-1,-1,-1,-1,10,7,6,10,1,7,1,3,7,-1,-1,-1,-1,-1,-1,-1,10,7,6,1,7,10,1,8,7,1,0,8,-1,-1,-1,-1,0,3,7,0,7,10,0,10,9,6,10,7,-1,-1,-1,-1,7,6,10,7,10,8,8,10,9,-1,-1,-1,-1,-1,-1,-1,6,8,4,11,8,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,6,11,3,0,6,0,4,6,-1,-1,-1,-1,-1,-1,-1,8,6,11,8,4,6,9,0,1,-1,-1,-1,-1,-1,-1,-1,9,4,6,9,6,3,9,3,1,11,3,6,-1,-1,-1,-1,6,8,4,6,11,8,2,10,1,-1,-1,-1,-1,-1,-1,-1,1,2,10,3,0,11,0,6,11,0,4,6,-1,-1,-1,-1,4,11,8,4,6,11,0,2,9,2,10,9,-1,-1,-1,-1,10,9,3,10,3,2,9,4,3,11,3,6,4,6,3,-1,8,2,3,8,4,2,4,6,2,-1,-1,-1,-1,-1,-1,-1,0,4,2,4,6,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,9,0,2,3,4,2,4,6,4,3,8,-1,-1,-1,-1,1,9,4,1,4,2,2,4,6,-1,-1,-1,-1,-1,-1,-1,8,1,3,8,6,1,8,4,6,6,10,1,-1,-1,-1,-1,10,1,0,10,0,6,6,0,4,-1,-1,-1,-1,-1,-1,-1,4,6,3,4,3,8,6,10,3,0,3,9,10,9,3,-1,10,9,4,6,10,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,9,5,7,6,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,4,9,5,11,7,6,-1,-1,-1,-1,-1,-1,-1,5,0,1,5,4,0,7,6,11,-1,-1,-1,-1,-1,-1,-1,11,7,6,8,3,4,3,5,4,3,1,5,-1,-1,-1,-1,9,5,4,10,1,2,7,6,11,-1,-1,-1,-1,-1,-1,-1,6,11,7,1,2,10,0,8,3,4,9,5,-1,-1,-1,-1,7,6,11,5,4,10,4,2,10,4,0,2,-1,-1,-1,-1,3,4,8,3,5,4,3,2,5,10,5,2,11,7,6,-1,7,2,3,7,6,2,5,4,9,-1,-1,-1,-1,-1,-1,-1,9,5,4,0,8,6,0,6,2,6,8,7,-1,-1,-1,-1,3,6,2,3,7,6,1,5,0,5,4,0,-1,-1,-1,-1,6,2,8,6,8,7,2,1,8,4,8,5,1,5,8,-1,9,5,4,10,1,6,1,7,6,1,3,7,-1,-1,-1,-1,1,6,10,1,7,6,1,0,7,8,7,0,9,5,4,-1,4,0,10,4,10,5,0,3,10,6,10,7,3,7,10,-1,7,6,10,7,10,8,5,4,10,4,8,10,-1,-1,-1,-1,6,9,5,6,11,9,11,8,9,-1,-1,-1,-1,-1,-1,-1,3,6,11,0,6,3,0,5,6,0,9,5,-1,-1,-1,-1,0,11,8,0,5,11,0,1,5,5,6,11,-1,-1,-1,-1,6,11,3,6,3,5,5,3,1,-1,-1,-1,-1,-1,-1,-1,1,2,10,9,5,11,9,11,8,11,5,6,-1,-1,-1,-1,0,11,3,0,6,11,0,9,6,5,6,9,1,2,10,-1,11,8,5,11,5,6,8,0,5,10,5,2,0,2,5,-1,6,11,3,6,3,5,2,10,3,10,5,3,-1,-1,-1,-1,5,8,9,5,2,8,5,6,2,3,8,2,-1,-1,-1,-1,9,5,6,9,6,0,0,6,2,-1,-1,-1,-1,-1,-1,-1,1,5,8,1,8,0,5,6,8,3,8,2,6,2,8,-1,1,5,6,2,1,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,6,1,6,10,3,8,6,5,6,9,8,9,6,-1,10,1,0,10,0,6,9,5,0,5,6,0,-1,-1,-1,-1,0,3,8,5,6,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,5,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,5,10,7,5,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,5,10,11,7,5,8,3,0,-1,-1,-1,-1,-1,-1,-1,5,11,7,5,10,11,1,9,0,-1,-1,-1,-1,-1,-1,-1,10,7,5,10,11,7,9,8,1,8,3,1,-1,-1,-1,-1,11,1,2,11,7,1,7,5,1,-1,-1,-1,-1,-1,-1,-1,0,8,3,1,2,7,1,7,5,7,2,11,-1,-1,-1,-1,9,7,5,9,2,7,9,0,2,2,11,7,-1,-1,-1,-1,7,5,2,7,2,11,5,9,2,3,2,8,9,8,2,-1,2,5,10,2,3,5,3,7,5,-1,-1,-1,-1,-1,-1,-1,8,2,0,8,5,2,8,7,5,10,2,5,-1,-1,-1,-1,9,0,1,5,10,3,5,3,7,3,10,2,-1,-1,-1,-1,9,8,2,9,2,1,8,7,2,10,2,5,7,5,2,-1,1,3,5,3,7,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,7,0,7,1,1,7,5,-1,-1,-1,-1,-1,-1,-1,9,0,3,9,3,5,5,3,7,-1,-1,-1,-1,-1,-1,-1,9,8,7,5,9,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5,8,4,5,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,5,0,4,5,11,0,5,10,11,11,3,0,-1,-1,-1,-1,0,1,9,8,4,10,8,10,11,10,4,5,-1,-1,-1,-1,10,11,4,10,4,5,11,3,4,9,4,1,3,1,4,-1,2,5,1,2,8,5,2,11,8,4,5,8,-1,-1,-1,-1,0,4,11,0,11,3,4,5,11,2,11,1,5,1,11,-1,0,2,5,0,5,9,2,11,5,4,5,8,11,8,5,-1,9,4,5,2,11,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,5,10,3,5,2,3,4,5,3,8,4,-1,-1,-1,-1,5,10,2,5,2,4,4,2,0,-1,-1,-1,-1,-1,-1,-1,3,10,2,3,5,10,3,8,5,4,5,8,0,1,9,-1,5,10,2,5,2,4,1,9,2,9,4,2,-1,-1,-1,-1,8,4,5,8,5,3,3,5,1,-1,-1,-1,-1,-1,-1,-1,0,4,5,1,0,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,4,5,8,5,3,9,0,5,0,3,5,-1,-1,-1,-1,9,4,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,11,7,4,9,11,9,10,11,-1,-1,-1,-1,-1,-1,-1,0,8,3,4,9,7,9,11,7,9,10,11,-1,-1,-1,-1,1,10,11,1,11,4,1,4,0,7,4,11,-1,-1,-1,-1,3,1,4,3,4,8,1,10,4,7,4,11,10,11,4,-1,4,11,7,9,11,4,9,2,11,9,1,2,-1,-1,-1,-1,9,7,4,9,11,7,9,1,11,2,11,1,0,8,3,-1,11,7,4,11,4,2,2,4,0,-1,-1,-1,-1,-1,-1,-1,11,7,4,11,4,2,8,3,4,3,2,4,-1,-1,-1,-1,2,9,10,2,7,9,2,3,7,7,4,9,-1,-1,-1,-1,9,10,7,9,7,4,10,2,7,8,7,0,2,0,7,-1,3,7,10,3,10,2,7,4,10,1,10,0,4,0,10,-1,1,10,2,8,7,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,7,1,3,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,0,8,1,8,7,1,-1,-1,-1,-1,4,0,3,7,4,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,8,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,11,9,10,-1,-1,-1,-1,-1,-1,-1,0,1,10,0,10,8,8,10,11,-1,-1,-1,-1,-1,-1,-1,3,1,10,11,3,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,11,1,11,9,9,11,8,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,1,2,9,2,11,9,-1,-1,-1,-1,0,2,11,8,0,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,2,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,10,8,9,-1,-1,-1,-1,-1,-1,-1,9,10,2,0,9,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,0,1,8,1,10,8,-1,-1,-1,-1,1,10,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,8,9,1,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]);class Js{constructor(e=Math){p.default(this,"grad3",[[1,1,0],[-1,1,0],[1,-1,0],[-1,-1,0],[1,0,1],[-1,0,1],[1,0,-1],[-1,0,-1],[0,1,1],[0,-1,1],[0,1,-1],[0,-1,-1]]),p.default(this,"grad4",[[0,1,1,1],[0,1,1,-1],[0,1,-1,1],[0,1,-1,-1],[0,-1,1,1],[0,-1,1,-1],[0,-1,-1,1],[0,-1,-1,-1],[1,0,1,1],[1,0,1,-1],[1,0,-1,1],[1,0,-1,-1],[-1,0,1,1],[-1,0,1,-1],[-1,0,-1,1],[-1,0,-1,-1],[1,1,0,1],[1,1,0,-1],[1,-1,0,1],[1,-1,0,-1],[-1,1,0,1],[-1,1,0,-1],[-1,-1,0,1],[-1,-1,0,-1],[1,1,1,0],[1,1,-1,0],[1,-1,1,0],[1,-1,-1,0],[-1,1,1,0],[-1,1,-1,0],[-1,-1,1,0],[-1,-1,-1,0]]),p.default(this,"p",[]),p.default(this,"perm",[]),p.default(this,"simplex",[[0,1,2,3],[0,1,3,2],[0,0,0,0],[0,2,3,1],[0,0,0,0],[0,0,0,0],[0,0,0,0],[1,2,3,0],[0,2,1,3],[0,0,0,0],[0,3,1,2],[0,3,2,1],[0,0,0,0],[0,0,0,0],[0,0,0,0],[1,3,2,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[1,2,0,3],[0,0,0,0],[1,3,0,2],[0,0,0,0],[0,0,0,0],[0,0,0,0],[2,3,0,1],[2,3,1,0],[1,0,2,3],[1,0,3,2],[0,0,0,0],[0,0,0,0],[0,0,0,0],[2,0,3,1],[0,0,0,0],[2,1,3,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[2,0,1,3],[0,0,0,0],[0,0,0,0],[0,0,0,0],[3,0,1,2],[3,0,2,1],[0,0,0,0],[3,1,2,0],[2,1,0,3],[0,0,0,0],[0,0,0,0],[0,0,0,0],[3,1,0,2],[0,0,0,0],[3,2,0,1],[3,2,1,0]]),p.default(this,"dot",((e,t,r)=>e[0]*t+e[1]*r)),p.default(this,"dot3",((e,t,r,i)=>e[0]*t+e[1]*r+e[2]*i)),p.default(this,"dot4",((e,t,r,i,n)=>e[0]*t+e[1]*r+e[2]*i+e[3]*n)),p.default(this,"noise",((e,t)=>{let r,i,n;const s=(e+t)*(.5*(Math.sqrt(3)-1)),o=Math.floor(e+s),a=Math.floor(t+s),l=(3-Math.sqrt(3))/6,c=(o+a)*l,h=e-(o-c),u=t-(a-c);let d=0,p=1;h>u&&(d=1,p=0);const m=h-d+l,f=u-p+l,g=h-1+2*l,v=u-1+2*l,x=255&o,y=255&a,b=this.perm[x+this.perm[y]]%12,A=this.perm[x+d+this.perm[y+p]]%12,w=this.perm[x+1+this.perm[y+1]]%12;let M=.5-h*h-u*u;M<0?r=0:(M*=M,r=M*M*this.dot(this.grad3[b],h,u));let T=.5-m*m-f*f;T<0?i=0:(T*=T,i=T*T*this.dot(this.grad3[A],m,f));let S=.5-g*g-v*v;return S<0?n=0:(S*=S,n=S*S*this.dot(this.grad3[w],g,v)),70*(r+i+n)})),p.default(this,"noise3d",((e,t,r)=>{let i,n,s,o;const a=(e+t+r)*(1/3),l=Math.floor(e+a),c=Math.floor(t+a),h=Math.floor(r+a),u=1/6,d=(l+c+h)*u,p=e-(l-d),m=t-(c-d),f=r-(h-d);let g,v,x,y,b,A;p>=m?m>=f?(g=1,v=0,x=0,y=1,b=1,A=0):p>=f?(g=1,v=0,x=0,y=1,b=0,A=1):(g=0,v=0,x=1,y=1,b=0,A=1):m<f?(g=0,v=0,x=1,y=0,b=1,A=1):p<f?(g=0,v=1,x=0,y=0,b=1,A=1):(g=0,v=1,x=0,y=1,b=1,A=0);const w=p-g+u,M=m-v+u,T=f-x+u,S=p-y+2*u,C=m-b+2*u,F=f-A+2*u,E=p-1+.5,_=m-1+.5,P=f-1+.5,B=255&l,L=255&c,R=255&h,N=this.perm[B+this.perm[L+this.perm[R]]]%12,D=this.perm[B+g+this.perm[L+v+this.perm[R+x]]]%12,I=this.perm[B+y+this.perm[L+b+this.perm[R+A]]]%12,U=this.perm[B+1+this.perm[L+1+this.perm[R+1]]]%12;let O=.6-p*p-m*m-f*f;O<0?i=0:(O*=O,i=O*O*this.dot3(this.grad3[N],p,m,f));let k=.6-w*w-M*M-T*T;k<0?n=0:(k*=k,n=k*k*this.dot3(this.grad3[D],w,M,T));let V=.6-S*S-C*C-F*F;V<0?s=0:(V*=V,s=V*V*this.dot3(this.grad3[I],S,C,F));let G=.6-E*E-_*_-P*P;return G<0?o=0:(G*=G,o=G*G*this.dot3(this.grad3[U],E,_,P)),32*(i+n+s+o)})),p.default(this,"noise4d",((e,t,r,i)=>{const n=this.grad4,s=this.simplex,o=this.perm,a=(Math.sqrt(5)-1)/4,l=(5-Math.sqrt(5))/20;let c,h,u,d,p;const m=(e+t+r+i)*a,f=Math.floor(e+m),g=Math.floor(t+m),v=Math.floor(r+m),x=Math.floor(i+m),y=(f+g+v+x)*l,b=e-(f-y),A=t-(g-y),w=r-(v-y),M=i-(x-y),T=(b>A?32:0)+(b>w?16:0)+(A>w?8:0)+(b>M?4:0)+(A>M?2:0)+(w>M?1:0);let S,C,F,E,_,P,B,L,R,N,D,I;S=s[T][0]>=3?1:0,C=s[T][1]>=3?1:0,F=s[T][2]>=3?1:0,E=s[T][3]>=3?1:0,_=s[T][0]>=2?1:0,P=s[T][1]>=2?1:0,B=s[T][2]>=2?1:0,L=s[T][3]>=2?1:0,R=s[T][0]>=1?1:0,N=s[T][1]>=1?1:0,D=s[T][2]>=1?1:0,I=s[T][3]>=1?1:0;const U=b-S+l,O=A-C+l,k=w-F+l,V=M-E+l,G=b-_+2*l,z=A-P+2*l,H=w-B+2*l,j=M-L+2*l,W=b-R+3*l,X=A-N+3*l,Q=w-D+3*l,Y=M-I+3*l,K=b-1+4*l,q=A-1+4*l,J=w-1+4*l,Z=M-1+4*l,$=255&f,ee=255&g,te=255&v,re=255&x,ie=o[$+o[ee+o[te+o[re]]]]%32,ne=o[$+S+o[ee+C+o[te+F+o[re+E]]]]%32,se=o[$+_+o[ee+P+o[te+B+o[re+L]]]]%32,oe=o[$+R+o[ee+N+o[te+D+o[re+I]]]]%32,ae=o[$+1+o[ee+1+o[te+1+o[re+1]]]]%32;let le=.6-b*b-A*A-w*w-M*M;le<0?c=0:(le*=le,c=le*le*this.dot4(n[ie],b,A,w,M));let ce=.6-U*U-O*O-k*k-V*V;ce<0?h=0:(ce*=ce,h=ce*ce*this.dot4(n[ne],U,O,k,V));let he=.6-G*G-z*z-H*H-j*j;he<0?u=0:(he*=he,u=he*he*this.dot4(n[se],G,z,H,j));let ue=.6-W*W-X*X-Q*Q-Y*Y;ue<0?d=0:(ue*=ue,d=ue*ue*this.dot4(n[oe],W,X,Q,Y));let de=.6-K*K-q*q-J*J-Z*Z;return de<0?p=0:(de*=de,p=de*de*this.dot4(n[ae],K,q,J,Z)),27*(c+h+u+d+p)}));for(let t=0;t<256;t++)this.p[t]=Math.floor(256*e.random());for(let e=0;e<512;e++)this.perm[e]=this.p[255&e]}}class Zs extends e.BufferGeometry{constructor(e){super(),this.type="LightningStrike",e=e||{},this.init(Zs.copyParameters(e,e)),this.createMesh()}update(e){this.isStatic||(this.rayParameters.isEternal||this.rayParameters.birthTime<=e&&e<=this.rayParameters.deathTime?(this.updateMesh(e),e<this.subrays[0].endPropagationTime?this.state=Zs.RAY_PROPAGATING:e>this.subrays[0].beginVanishingTime?this.state=Zs.RAY_VANISHING:this.state=Zs.RAY_STEADY,this.visible=!0):(this.visible=!1,e<this.rayParameters.birthTime?this.state=Zs.RAY_UNBORN:this.state=Zs.RAY_EXTINGUISHED))}init(t){this.rayParameters=t,this.maxIterations=void 0!==t.maxIterations?Math.floor(t.maxIterations):9,t.maxIterations=this.maxIterations,this.isStatic=void 0!==t.isStatic&&t.isStatic,t.isStatic=this.isStatic,this.ramification=void 0!==t.ramification?Math.floor(t.ramification):5,t.ramification=this.ramification,this.maxSubrayRecursion=void 0!==t.maxSubrayRecursion?Math.floor(t.maxSubrayRecursion):3,t.maxSubrayRecursion=this.maxSubrayRecursion,this.recursionProbability=void 0!==t.recursionProbability?t.recursionProbability:.6,t.recursionProbability=this.recursionProbability,this.generateUVs=void 0!==t.generateUVs&&t.generateUVs,t.generateUVs=this.generateUVs,void 0!==t.randomGenerator?(this.randomGenerator=t.randomGenerator,this.seedGenerator=t.randomGenerator,void 0!==t.noiseSeed&&this.seedGenerator.setSeed(t.noiseSeed)):(this.randomGenerator=Zs.createRandomGenerator(),this.seedGenerator=Math),void 0!==t.onDecideSubrayCreation?this.onDecideSubrayCreation=t.onDecideSubrayCreation:(this.createDefaultSubrayCreationCallbacks(),void 0!==t.onSubrayCreation&&(this.onSubrayCreation=t.onSubrayCreation)),this.state=Zs.RAY_INITIALIZED,this.maxSubrays=Math.ceil(1+Math.pow(this.ramification,Math.max(0,this.maxSubrayRecursion-1))),t.maxSubrays=this.maxSubrays,this.maxRaySegments=2*(1<<this.maxIterations),this.subrays=[];for(let e=0;e<this.maxSubrays;e++)this.subrays.push(this.createSubray());this.raySegments=[];for(let e=0;e<this.maxRaySegments;e++)this.raySegments.push(this.createSegment());this.time=0,this.timeFraction=0,this.currentSegmentCallback=null,this.currentCreateTriangleVertices=this.generateUVs?this.createTriangleVerticesWithUVs:this.createTriangleVerticesWithoutUVs,this.numSubrays=0,this.currentSubray=null,this.currentSegmentIndex=0,this.isInitialSegment=!1,this.subrayProbability=0,this.currentVertex=0,this.currentIndex=0,this.currentCoordinate=0,this.currentUVCoordinate=0,this.vertices=null,this.uvs=null,this.indices=null,this.positionAttribute=null,this.uvsAttribute=null,this.simplexX=new Js(this.seedGenerator),this.simplexY=new Js(this.seedGenerator),this.simplexZ=new Js(this.seedGenerator),this.forwards=new e.Vector3,this.forwardsFill=new e.Vector3,this.side=new e.Vector3,this.down=new e.Vector3,this.middlePos=new e.Vector3,this.middleLinPos=new e.Vector3,this.newPos=new e.Vector3,this.vPos=new e.Vector3,this.cross1=new e.Vector3}createMesh(){const t=1<<this.maxIterations,r=3*(t+1)*this.maxSubrays,i=18*t*this.maxSubrays;this.vertices=new Float32Array(3*r),this.indices=new Uint32Array(i),this.generateUVs&&(this.uvs=new Float32Array(2*r)),this.fillMesh(0),this.setIndex(new e.Uint32BufferAttribute(this.indices,1)),this.positionAttribute=new e.Float32BufferAttribute(this.vertices,3),this.setAttribute("position",this.positionAttribute),this.generateUVs&&(this.uvsAttribute=new e.Float32BufferAttribute(new Float32Array(this.uvs),2),this.setAttribute("uv",this.uvsAttribute)),this.isStatic||(this.index.usage=e.DynamicDrawUsage,this.positionAttribute.usage=e.DynamicDrawUsage,this.generateUVs&&(this.uvsAttribute.usage=e.DynamicDrawUsage)),this.vertices=this.positionAttribute.array,this.indices=this.index.array,this.generateUVs&&(this.uvs=this.uvsAttribute.array)}updateMesh(e){this.fillMesh(e),this.drawRange.count=this.currentIndex,this.index.needsUpdate=!0,this.positionAttribute.needsUpdate=!0,this.generateUVs&&(this.uvsAttribute.needsUpdate=!0)}fillMesh(e){const t=this;this.currentVertex=0,this.currentIndex=0,this.currentCoordinate=0,this.currentUVCoordinate=0,this.fractalRay(e,(function(r){const i=t.currentSubray;e<i.birthTime||(this.rayParameters.isEternal&&0==t.currentSubray.recursion?(t.createPrism(r),t.onDecideSubrayCreation(r,t)):e<i.endPropagationTime?t.timeFraction>=r.fraction0*i.propagationTimeFactor&&(t.createPrism(r),t.onDecideSubrayCreation(r,t)):e<i.beginVanishingTime?(t.createPrism(r),t.onDecideSubrayCreation(r,t)):(t.timeFraction<=i.vanishingTimeFactor+r.fraction1*(1-i.vanishingTimeFactor)&&t.createPrism(r),t.onDecideSubrayCreation(r,t)))}))}addNewSubray(){return this.subrays[this.numSubrays++]}initSubray(e,t){e.pos0.copy(t.sourceOffset),e.pos1.copy(t.destOffset),e.up0.copy(t.up0),e.up1.copy(t.up1),e.radius0=t.radius0,e.radius1=t.radius1,e.birthTime=t.birthTime,e.deathTime=t.deathTime,e.timeScale=t.timeScale,e.roughness=t.roughness,e.straightness=t.straightness,e.propagationTimeFactor=t.propagationTimeFactor,e.vanishingTimeFactor=t.vanishingTimeFactor,e.maxIterations=this.maxIterations,e.seed=void 0!==t.noiseSeed?t.noiseSeed:0,e.recursion=0}fractalRay(t,r){this.time=t,this.currentSegmentCallback=r,this.numSubrays=0,this.initSubray(this.addNewSubray(),this.rayParameters);for(let r=0;r<this.numSubrays;r++){const i=this.subrays[r];this.currentSubray=i,this.randomGenerator.setSeed(i.seed),i.endPropagationTime=e.MathUtils.lerp(i.birthTime,i.deathTime,i.propagationTimeFactor),i.beginVanishingTime=e.MathUtils.lerp(i.deathTime,i.birthTime,1-i.vanishingTimeFactor);const n=this.randomGenerator.random;i.linPos0.set(n(),n(),n()).multiplyScalar(1e3),i.linPos1.set(n(),n(),n()).multiplyScalar(1e3),this.timeFraction=(t-i.birthTime)/(i.deathTime-i.birthTime),this.currentSegmentIndex=0,this.isInitialSegment=!0;const s=this.getNewSegment();s.iteration=0,s.pos0.copy(i.pos0),s.pos1.copy(i.pos1),s.linPos0.copy(i.linPos0),s.linPos1.copy(i.linPos1),s.up0.copy(i.up0),s.up1.copy(i.up1),s.radius0=i.radius0,s.radius1=i.radius1,s.fraction0=0,s.fraction1=1,s.positionVariationFactor=1-i.straightness,this.subrayProbability=this.ramification*Math.pow(this.recursionProbability,i.recursion)/(1<<i.maxIterations),this.fractalRayRecursive(s)}this.currentSegmentCallback=null,this.currentSubray=null}fractalRayRecursive(e){if(e.iteration>=this.currentSubray.maxIterations)return void this.currentSegmentCallback(e);this.forwards.subVectors(e.pos1,e.pos0);let t=this.forwards.length();t<1e-6&&(this.forwards.set(0,0,.01),t=this.forwards.length());const r=.5*(e.radius0+e.radius1),i=.5*(e.fraction0+e.fraction1),n=this.time*this.currentSubray.timeScale*Math.pow(2,e.iteration);this.middlePos.lerpVectors(e.pos0,e.pos1,.5),this.middleLinPos.lerpVectors(e.linPos0,e.linPos1,.5);const s=this.middleLinPos;this.newPos.set(this.simplexX.noise4d(s.x,s.y,s.z,n),this.simplexY.noise4d(s.x,s.y,s.z,n),this.simplexZ.noise4d(s.x,s.y,s.z,n)),this.newPos.multiplyScalar(e.positionVariationFactor*t),this.newPos.add(this.middlePos);const o=this.getNewSegment();o.pos0.copy(e.pos0),o.pos1.copy(this.newPos),o.linPos0.copy(e.linPos0),o.linPos1.copy(this.middleLinPos),o.up0.copy(e.up0),o.up1.copy(e.up1),o.radius0=e.radius0,o.radius1=r,o.fraction0=e.fraction0,o.fraction1=i,o.positionVariationFactor=e.positionVariationFactor*this.currentSubray.roughness,o.iteration=e.iteration+1;const a=this.getNewSegment();a.pos0.copy(this.newPos),a.pos1.copy(e.pos1),a.linPos0.copy(this.middleLinPos),a.linPos1.copy(e.linPos1),this.cross1.crossVectors(e.up0,this.forwards.normalize()),a.up0.crossVectors(this.forwards,this.cross1).normalize(),a.up1.copy(e.up1),a.radius0=r,a.radius1=e.radius1,a.fraction0=i,a.fraction1=e.fraction1,a.positionVariationFactor=e.positionVariationFactor*this.currentSubray.roughness,a.iteration=e.iteration+1,this.fractalRayRecursive(o),this.fractalRayRecursive(a)}createPrism(e){this.forwardsFill.subVectors(e.pos1,e.pos0).normalize(),this.isInitialSegment&&(this.currentCreateTriangleVertices(e.pos0,e.up0,this.forwardsFill,e.radius0,0),this.isInitialSegment=!1),this.currentCreateTriangleVertices(e.pos1,e.up0,this.forwardsFill,e.radius1,e.fraction1),this.createPrismFaces()}createTriangleVerticesWithoutUVs(e,t,r,i){this.side.crossVectors(t,r).multiplyScalar(i*Zs.COS30DEG),this.down.copy(t).multiplyScalar(-i*Zs.SIN30DEG);const n=this.vPos,s=this.vertices;n.copy(e).sub(this.side).add(this.down),s[this.currentCoordinate++]=n.x,s[this.currentCoordinate++]=n.y,s[this.currentCoordinate++]=n.z,n.copy(e).add(this.side).add(this.down),s[this.currentCoordinate++]=n.x,s[this.currentCoordinate++]=n.y,s[this.currentCoordinate++]=n.z,n.copy(t).multiplyScalar(i).add(e),s[this.currentCoordinate++]=n.x,s[this.currentCoordinate++]=n.y,s[this.currentCoordinate++]=n.z,this.currentVertex+=3}createTriangleVerticesWithUVs(e,t,r,i,n){this.side.crossVectors(t,r).multiplyScalar(i*Zs.COS30DEG),this.down.copy(t).multiplyScalar(-i*Zs.SIN30DEG);const s=this.vPos,o=this.vertices,a=this.uvs;s.copy(e).sub(this.side).add(this.down),o[this.currentCoordinate++]=s.x,o[this.currentCoordinate++]=s.y,o[this.currentCoordinate++]=s.z,a[this.currentUVCoordinate++]=n,a[this.currentUVCoordinate++]=0,s.copy(e).add(this.side).add(this.down),o[this.currentCoordinate++]=s.x,o[this.currentCoordinate++]=s.y,o[this.currentCoordinate++]=s.z,a[this.currentUVCoordinate++]=n,a[this.currentUVCoordinate++]=.5,s.copy(t).multiplyScalar(i).add(e),o[this.currentCoordinate++]=s.x,o[this.currentCoordinate++]=s.y,o[this.currentCoordinate++]=s.z,a[this.currentUVCoordinate++]=n,a[this.currentUVCoordinate++]=1,this.currentVertex+=3}createPrismFaces(e){const t=this.indices;e=this.currentVertex-6;t[this.currentIndex++]=e+1,t[this.currentIndex++]=e+2,t[this.currentIndex++]=e+5,t[this.currentIndex++]=e+1,t[this.currentIndex++]=e+5,t[this.currentIndex++]=e+4,t[this.currentIndex++]=e+0,t[this.currentIndex++]=e+1,t[this.currentIndex++]=e+4,t[this.currentIndex++]=e+0,t[this.currentIndex++]=e+4,t[this.currentIndex++]=e+3,t[this.currentIndex++]=e+2,t[this.currentIndex++]=e+0,t[this.currentIndex++]=e+3,t[this.currentIndex++]=e+2,t[this.currentIndex++]=e+3,t[this.currentIndex++]=e+5}createDefaultSubrayCreationCallbacks(){const t=this.randomGenerator.random;this.onDecideSubrayCreation=(r,i)=>{const n=i.currentSubray,s=i.rayParameters.subrayPeriod,o=i.rayParameters.subrayDutyCycle,a=i.rayParameters.isEternal&&0==n.recursion?-t()*s:e.MathUtils.lerp(n.birthTime,n.endPropagationTime,r.fraction0)-t()*s,l=i.time-a,c=Math.floor(l/s),h=t()*(c+1);let u=0;if(l%s<=o*s&&(u=i.subrayProbability),n.recursion<i.maxSubrayRecursion&&i.numSubrays<i.maxSubrays&&t()<u){const e=i.addNewSubray(),l=i.randomGenerator.getSeed();e.seed=h,i.randomGenerator.setSeed(h),e.recursion=n.recursion+1,e.maxIterations=Math.max(1,n.maxIterations-1),e.linPos0.set(t(),t(),t()).multiplyScalar(1e3),e.linPos1.set(t(),t(),t()).multiplyScalar(1e3),e.up0.copy(n.up0),e.up1.copy(n.up1),e.radius0=r.radius0*i.rayParameters.radius0Factor,e.radius1=Math.min(i.rayParameters.minRadius,r.radius1*i.rayParameters.radius1Factor),e.birthTime=a+c*s,e.deathTime=e.birthTime+s*o,i.rayParameters.isEternal||0!=n.recursion||(e.birthTime=Math.max(e.birthTime,n.birthTime),e.deathTime=Math.min(e.deathTime,n.deathTime)),e.timeScale=2*n.timeScale,e.roughness=n.roughness,e.straightness=n.straightness,e.propagationTimeFactor=n.propagationTimeFactor,e.vanishingTimeFactor=n.vanishingTimeFactor,i.onSubrayCreation(r,n,e,i),i.randomGenerator.setSeed(l)}};const r=new e.Vector3,i=new e.Vector3,n=new e.Vector3,s=new e.Vector3;this.onSubrayCreation=(e,t,r,i)=>{i.subrayCylinderPosition(e,t,r,.5,.6,.2)},this.subrayConePosition=(e,o,a,l,c,h)=>{a.pos0.copy(e.pos0),r.subVectors(o.pos1,o.pos0),i.copy(r).normalize(),r.multiplyScalar(e.fraction0+(1-e.fraction0)*(t()*l));const u=r.length();n.crossVectors(o.up0,i);const d=2*Math.PI*t();n.multiplyScalar(Math.cos(d)),s.copy(o.up0).multiplyScalar(Math.sin(d)),a.pos1.copy(n).add(s).multiplyScalar(u*c*(h+t()*(1-h))).add(r).add(o.pos0)},this.subrayCylinderPosition=(e,o,a,l,c,h)=>{a.pos0.copy(e.pos0),r.subVectors(o.pos1,o.pos0),i.copy(r).normalize(),r.multiplyScalar(e.fraction0+(1-e.fraction0)*((2*t()-1)*l));const u=r.length();n.crossVectors(o.up0,i);const d=2*Math.PI*t();n.multiplyScalar(Math.cos(d)),s.copy(o.up0).multiplyScalar(Math.sin(d)),a.pos1.copy(n).add(s).multiplyScalar(u*c*(h+t()*(1-h))).add(r).add(o.pos0)}}createSubray(){return{seed:0,maxIterations:0,recursion:0,pos0:new e.Vector3,pos1:new e.Vector3,linPos0:new e.Vector3,linPos1:new e.Vector3,up0:new e.Vector3,up1:new e.Vector3,radius0:0,radius1:0,birthTime:0,deathTime:0,timeScale:0,roughness:0,straightness:0,propagationTimeFactor:0,vanishingTimeFactor:0,endPropagationTime:0,beginVanishingTime:0}}createSegment(){return{iteration:0,pos0:new e.Vector3,pos1:new e.Vector3,linPos0:new e.Vector3,linPos1:new e.Vector3,up0:new e.Vector3,up1:new e.Vector3,radius0:0,radius1:0,fraction0:0,fraction1:0,positionVariationFactor:0}}getNewSegment(){return this.raySegments[this.currentSegmentIndex++]}copy(e){return super.copy(e),this.init(Zs.copyParameters({},e.rayParameters)),this}clone(){return new this.constructor(Zs.copyParameters({},this.rayParameters))}}Zs.prototype.isLightningStrike=!0,Zs.RAY_INITIALIZED=0,Zs.RAY_UNBORN=1,Zs.RAY_PROPAGATING=2,Zs.RAY_STEADY=3,Zs.RAY_VANISHING=4,Zs.RAY_EXTINGUISHED=5,Zs.COS30DEG=Math.cos(30*Math.PI/180),Zs.SIN30DEG=Math.sin(30*Math.PI/180),Zs.createRandomGenerator=()=>{const e=2053,t=[];for(let r=0;r<e;r++)t.push(Math.random());const r={currentSeed:0,random:function(){const i=t[r.currentSeed];return r.currentSeed=(r.currentSeed+1)%e,i},getSeed:function(){return r.currentSeed/e},setSeed:function(t){r.currentSeed=Math.floor(t*e)%e}};return r},Zs.copyParameters=(t,r)=>{r=r||{};const i=e=>r===t?e:e.clone();return(t=t||{}).sourceOffset=void 0!==r.sourceOffset?i(r.sourceOffset):new e.Vector3(0,100,0),t.destOffset=void 0!==r.destOffset?i(r.destOffset):new e.Vector3(0,0,0),t.timeScale=void 0!==r.timeScale?r.timeScale:1,t.roughness=void 0!==r.roughness?r.roughness:.9,t.straightness=void 0!==r.straightness?r.straightness:.7,t.up0=void 0!==r.up0?i(r.up0):new e.Vector3(0,0,1),t.up1=void 0!==r.up1?i(r.up1):new e.Vector3(0,0,1),t.radius0=void 0!==r.radius0?r.radius0:1,t.radius1=void 0!==r.radius1?r.radius1:1,t.radius0Factor=void 0!==r.radius0Factor?r.radius0Factor:.5,t.radius1Factor=void 0!==r.radius1Factor?r.radius1Factor:.2,t.minRadius=void 0!==r.minRadius?r.minRadius:.2,t.isEternal=void 0!==r.isEternal?r.isEternal:void 0===r.birthTime||void 0===r.deathTime,t.birthTime=r.birthTime,t.deathTime=r.deathTime,t.propagationTimeFactor=void 0!==r.propagationTimeFactor?r.propagationTimeFactor:.1,t.vanishingTimeFactor=void 0!==r.vanishingTimeFactor?r.vanishingTimeFactor:.9,t.subrayPeriod=void 0!==r.subrayPeriod?r.subrayPeriod:4,t.subrayDutyCycle=void 0!==r.subrayDutyCycle?r.subrayDutyCycle:.6,t.maxIterations=void 0!==r.maxIterations?r.maxIterations:9,t.isStatic=void 0!==r.isStatic&&r.isStatic,t.ramification=void 0!==r.ramification?r.ramification:5,t.maxSubrayRecursion=void 0!==r.maxSubrayRecursion?r.maxSubrayRecursion:3,t.recursionProbability=void 0!==r.recursionProbability?r.recursionProbability:.6,t.generateUVs=void 0!==r.generateUVs&&r.generateUVs,t.randomGenerator=r.randomGenerator,t.noiseSeed=r.noiseSeed,t.onDecideSubrayCreation=r.onDecideSubrayCreation,t.onSubrayCreation=r.onSubrayCreation,t};class $s extends e.Object3D{constructor(t={}){super(),this.stormParams=t,t.size=void 0!==t.size?t.size:1e3,t.minHeight=void 0!==t.minHeight?t.minHeight:80,t.maxHeight=void 0!==t.maxHeight?t.maxHeight:100,t.maxSlope=void 0!==t.maxSlope?t.maxSlope:1.1,t.maxLightnings=void 0!==t.maxLightnings?t.maxLightnings:3,t.lightningMinPeriod=void 0!==t.lightningMinPeriod?t.lightningMinPeriod:3,t.lightningMaxPeriod=void 0!==t.lightningMaxPeriod?t.lightningMaxPeriod:7,t.lightningMinDuration=void 0!==t.lightningMinDuration?t.lightningMinDuration:1,t.lightningMaxDuration=void 0!==t.lightningMaxDuration?t.lightningMaxDuration:2.5,this.lightningParameters=Zs.copyParameters(t.lightningParameters,t.lightningParameters),this.lightningParameters.isEternal=!1,this.lightningMaterial=void 0!==t.lightningMaterial?t.lightningMaterial:new e.MeshBasicMaterial({color:11599871}),void 0!==t.onRayPosition?this.onRayPosition=t.onRayPosition:this.onRayPosition=function(r,i){i.set((Math.random()-.5)*t.size,0,(Math.random()-.5)*t.size);const n=e.MathUtils.lerp(t.minHeight,t.maxHeight,Math.random());r.set(t.maxSlope*(2*Math.random()-1),1,t.maxSlope*(2*Math.random()-1)).multiplyScalar(n).add(i)},this.onLightningDown=t.onLightningDown,this.inited=!1,this.nextLightningTime=0,this.lightningsMeshes=[],this.deadLightningsMeshes=[];for(let t=0;t<this.stormParams.maxLightnings;t++){const t=new Zs(Zs.copyParameters({},this.lightningParameters)),r=new e.Mesh(t,this.lightningMaterial);this.deadLightningsMeshes.push(r)}}update(t){if(this.inited||(this.nextLightningTime=this.getNextLightningTime(t)*Math.random(),this.inited=!0),t>=this.nextLightningTime){const r=this.deadLightningsMeshes.pop();if(r){const i=Zs.copyParameters(r.geometry.rayParameters,this.lightningParameters);i.birthTime=t,i.deathTime=t+e.MathUtils.lerp(this.stormParams.lightningMinDuration,this.stormParams.lightningMaxDuration,Math.random()),this.onRayPosition(i.sourceOffset,i.destOffset),i.noiseSeed=Math.random(),this.add(r),this.lightningsMeshes.push(r)}this.nextLightningTime=this.getNextLightningTime(t)}let r=0,i=this.lightningsMeshes.length;for(;r<i;){const e=this.lightningsMeshes[r],n=e.geometry,s=n.state;n.update(t),s===Zs.RAY_PROPAGATING&&n.state>s&&this.onLightningDown&&this.onLightningDown(n),n.state===Zs.RAY_EXTINGUISHED?(this.lightningsMeshes.splice(this.lightningsMeshes.indexOf(e),1),this.deadLightningsMeshes.push(e),this.remove(e),i--):r++}}getNextLightningTime(t){return t+e.MathUtils.lerp(this.stormParams.lightningMinPeriod,this.stormParams.lightningMaxPeriod,Math.random())/(this.stormParams.maxLightnings+1)}copy(e){return super.copy(e),this.stormParams.size=e.stormParams.size,this.stormParams.minHeight=e.stormParams.minHeight,this.stormParams.maxHeight=e.stormParams.maxHeight,this.stormParams.maxSlope=e.stormParams.maxSlope,this.stormParams.maxLightnings=e.stormParams.maxLightnings,this.stormParams.lightningMinPeriod=e.stormParams.lightningMinPeriod,this.stormParams.lightningMaxPeriod=e.stormParams.lightningMaxPeriod,this.stormParams.lightningMinDuration=e.stormParams.lightningMinDuration,this.stormParams.lightningMaxDuration=e.stormParams.lightningMaxDuration,this.lightningParameters=Zs.copyParameters({},e.lightningParameters),this.lightningMaterial=e.stormParams.lightningMaterial,this.onLightningDown=e.onLightningDown,this}clone(){return new this.constructor(this.stormParams).copy(this)}}$s.prototype.isLightningStorm=!0;class eo extends e.Mesh{constructor(t,r={}){super(t),this.type="ReflectorForSSRPass";const i=this,n=void 0!==r.color?new e.Color(r.color):new e.Color(8355711),s=r.textureWidth||512,o=r.textureHeight||512,a=r.clipBias||0,l=r.shader||eo.ReflectorShader,c=!0===r.useDepthTexture,h=new e.Vector3(0,1,0),u=new e.Vector3,d=new e.Vector3;i.needsUpdate=!1,i.maxDistance=eo.ReflectorShader.uniforms.maxDistance.value,i.opacity=eo.ReflectorShader.uniforms.opacity.value,i.color=n,i.resolution=r.resolution||new e.Vector2(window.innerWidth,window.innerHeight),i._distanceAttenuation=eo.ReflectorShader.defines.DISTANCE_ATTENUATION,Object.defineProperty(i,"distanceAttenuation",{get:()=>i._distanceAttenuation,set(e){i._distanceAttenuation!==e&&(i._distanceAttenuation=e,i.material.defines.DISTANCE_ATTENUATION=e,i.material.needsUpdate=!0)}}),i._fresnel=eo.ReflectorShader.defines.FRESNEL,Object.defineProperty(i,"fresnel",{get:()=>i._fresnel,set(e){i._fresnel!==e&&(i._fresnel=e,i.material.defines.FRESNEL=e,i.material.needsUpdate=!0)}});const p=new e.Vector3,m=new e.Vector3,f=new e.Vector3,g=new e.Matrix4,v=new e.Vector3(0,0,-1),x=new e.Vector3,y=new e.Vector3,b=new e.Matrix4,A=new e.PerspectiveCamera;let w;c&&(w=new e.DepthTexture,w.type=e.UnsignedShortType,w.minFilter=e.NearestFilter,w.magFilter=e.NearestFilter);const M={depthTexture:c?w:null},T=new e.WebGLRenderTarget(s,o,M),S=new e.ShaderMaterial({transparent:c,defines:Object.assign({},eo.ReflectorShader.defines,{useDepthTexture:c}),uniforms:e.UniformsUtils.clone(l.uniforms),fragmentShader:l.fragmentShader,vertexShader:l.vertexShader});S.uniforms.tDiffuse.value=T.texture,S.uniforms.color.value=i.color,S.uniforms.textureMatrix.value=b,c&&(S.uniforms.tDepth.value=T.depthTexture),this.material=S;const C=[new e.Plane(new e.Vector3(0,1,0),a)];this.doRender=function(e,t,r){if(S.uniforms.maxDistance.value=i.maxDistance,S.uniforms.color.value=i.color,S.uniforms.opacity.value=i.opacity,u.copy(r.position).normalize(),d.copy(u).reflect(h),S.uniforms.fresnelCoe.value=(u.dot(d)+1)/2,m.setFromMatrixPosition(i.matrixWorld),f.setFromMatrixPosition(r.matrixWorld),g.extractRotation(i.matrixWorld),p.set(0,0,1),p.applyMatrix4(g),x.subVectors(m,f),x.dot(p)>0)return;x.reflect(p).negate(),x.add(m),g.extractRotation(r.matrixWorld),v.set(0,0,-1),v.applyMatrix4(g),v.add(f),y.subVectors(m,v),y.reflect(p).negate(),y.add(m),A.position.copy(x),A.up.set(0,1,0),A.up.applyMatrix4(g),A.up.reflect(p),A.lookAt(y),A.far=r.far,A.updateMatrixWorld(),A.projectionMatrix.copy(r.projectionMatrix),S.uniforms.virtualCameraNear.value=r.near,S.uniforms.virtualCameraFar.value=r.far,S.uniforms.virtualCameraMatrixWorld.value=A.matrixWorld,S.uniforms.virtualCameraProjectionMatrix.value=r.projectionMatrix,S.uniforms.virtualCameraProjectionMatrixInverse.value=r.projectionMatrixInverse,S.uniforms.resolution.value=i.resolution,b.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),b.multiply(A.projectionMatrix),b.multiply(A.matrixWorldInverse),b.multiply(i.matrixWorld),"colorSpace"in T.texture?T.texture.colorSpace=e.outputColorSpace:T.texture.encoding=e.outputEncoding;const n=e.getRenderTarget(),s=e.xr.enabled,o=e.shadowMap.autoUpdate,a=e.clippingPlanes;e.xr.enabled=!1,e.shadowMap.autoUpdate=!1,e.clippingPlanes=C,e.setRenderTarget(T),e.state.buffers.depth.setMask(!0),!1===e.autoClear&&e.clear(),e.render(t,A),e.xr.enabled=s,e.shadowMap.autoUpdate=o,e.clippingPlanes=a,e.setRenderTarget(n);const l=r.viewport;void 0!==l&&e.state.viewport(l)},this.getRenderTarget=function(){return T}}}eo.prototype.isReflectorForSSRPass=!0,eo.ReflectorShader={defines:{DISTANCE_ATTENUATION:!0,FRESNEL:!0},uniforms:{color:{value:null},tDiffuse:{value:null},tDepth:{value:null},textureMatrix:{value:new e.Matrix4},maxDistance:{value:180},opacity:{value:.5},fresnelCoe:{value:null},virtualCameraNear:{value:null},virtualCameraFar:{value:null},virtualCameraProjectionMatrix:{value:new e.Matrix4},virtualCameraMatrixWorld:{value:new e.Matrix4},virtualCameraProjectionMatrixInverse:{value:new e.Matrix4},resolution:{value:new e.Vector2}},vertexShader:"\n\t\tuniform mat4 textureMatrix;\n\t\tvarying vec4 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = textureMatrix * vec4( position, 1.0 );\n\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\t\tuniform vec3 color;\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform sampler2D tDepth;\n\t\tuniform float maxDistance;\n\t\tuniform float opacity;\n\t\tuniform float fresnelCoe;\n\t\tuniform float virtualCameraNear;\n\t\tuniform float virtualCameraFar;\n\t\tuniform mat4 virtualCameraProjectionMatrix;\n\t\tuniform mat4 virtualCameraProjectionMatrixInverse;\n\t\tuniform mat4 virtualCameraMatrixWorld;\n\t\tuniform vec2 resolution;\n\t\tvarying vec4 vUv;\n\t\t#include <packing>\n\t\tfloat blendOverlay( float base, float blend ) {\n\t\t\treturn( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) );\n\t\t}\n\t\tvec3 blendOverlay( vec3 base, vec3 blend ) {\n\t\t\treturn vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ), blendOverlay( base.b, blend.b ) );\n\t\t}\n\t\tfloat getDepth( const in vec2 uv ) {\n\t\t\treturn texture2D( tDepth, uv ).x;\n\t\t}\n\t\tfloat getViewZ( const in float depth ) {\n\t\t\treturn perspectiveDepthToViewZ( depth, virtualCameraNear, virtualCameraFar );\n\t\t}\n\t\tvec3 getViewPosition( const in vec2 uv, const in float depth/*clip space*/, const in float clipW ) {\n\t\t\tvec4 clipPosition = vec4( ( vec3( uv, depth ) - 0.5 ) * 2.0, 1.0 );//ndc\n\t\t\tclipPosition *= clipW; //clip\n\t\t\treturn ( virtualCameraProjectionMatrixInverse * clipPosition ).xyz;//view\n\t\t}\n\t\tvoid main() {\n\t\t\tvec4 base = texture2DProj( tDiffuse, vUv );\n\t\t\t#ifdef useDepthTexture\n\t\t\t\tvec2 uv=(gl_FragCoord.xy-.5)/resolution.xy;\n\t\t\t\tuv.x=1.-uv.x;\n\t\t\t\tfloat depth = texture2DProj( tDepth, vUv ).r;\n\t\t\t\tfloat viewZ = getViewZ( depth );\n\t\t\t\tfloat clipW = virtualCameraProjectionMatrix[2][3] * viewZ+virtualCameraProjectionMatrix[3][3];\n\t\t\t\tvec3 viewPosition=getViewPosition( uv, depth, clipW );\n\t\t\t\tvec3 worldPosition=(virtualCameraMatrixWorld*vec4(viewPosition,1)).xyz;\n\t\t\t\tif(worldPosition.y>maxDistance) discard;\n\t\t\t\tfloat op=opacity;\n\t\t\t\t#ifdef DISTANCE_ATTENUATION\n\t\t\t\t\tfloat ratio=1.-(worldPosition.y/maxDistance);\n\t\t\t\t\tfloat attenuation=ratio*ratio;\n\t\t\t\t\top=opacity*attenuation;\n\t\t\t\t#endif\n\t\t\t\t#ifdef FRESNEL\n\t\t\t\t\top*=fresnelCoe;\n\t\t\t\t#endif\n\t\t\t\tgl_FragColor = vec4( blendOverlay( base.rgb, color ), op );\n\t\t\t#else\n\t\t\t\tgl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 );\n\t\t\t#endif\n\t\t}\n\t"};class to extends e.Mesh{constructor(){super(new e.BoxGeometry(1,1,1),to.material)}}p.default(to,"SkyShader",{uniforms:{turbidity:{value:2},rayleigh:{value:1},mieCoefficient:{value:.005},mieDirectionalG:{value:.8},sunPosition:{value:new e.Vector3},up:{value:new e.Vector3(0,1,0)}},vertexShader:["uniform vec3 sunPosition;","uniform float rayleigh;","uniform float turbidity;","uniform float mieCoefficient;","uniform vec3 up;","varying vec3 vWorldPosition;","varying vec3 vSunDirection;","varying float vSunfade;","varying vec3 vBetaR;","varying vec3 vBetaM;","varying float vSunE;","const float e = 2.71828182845904523536028747135266249775724709369995957;","const float pi = 3.141592653589793238462643383279502884197169;","const vec3 lambda = vec3( 680E-9, 550E-9, 450E-9 );","const vec3 totalRayleigh = vec3( 5.804542996261093E-6, 1.3562911419845635E-5, 3.0265902468824876E-5 );","const float v = 4.0;","const vec3 K = vec3( 0.686, 0.678, 0.666 );","const vec3 MieConst = vec3( 1.8399918514433978E14, 2.7798023919660528E14, 4.0790479543861094E14 );","const float cutoffAngle = 1.6110731556870734;","const float steepness = 1.5;","const float EE = 1000.0;","float sunIntensity( float zenithAngleCos ) {","\tzenithAngleCos = clamp( zenithAngleCos, -1.0, 1.0 );","\treturn EE * max( 0.0, 1.0 - pow( e, -( ( cutoffAngle - acos( zenithAngleCos ) ) / steepness ) ) );","}","vec3 totalMie( float T ) {","\tfloat c = ( 0.2 * T ) * 10E-18;","\treturn 0.434 * c * MieConst;","}","void main() {","\tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );","\tvWorldPosition = worldPosition.xyz;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","\tgl_Position.z = gl_Position.w;","\tvSunDirection = normalize( sunPosition );","\tvSunE = sunIntensity( dot( vSunDirection, up ) );","\tvSunfade = 1.0 - clamp( 1.0 - exp( ( sunPosition.y / 450000.0 ) ), 0.0, 1.0 );","\tfloat rayleighCoefficient = rayleigh - ( 1.0 * ( 1.0 - vSunfade ) );","\tvBetaR = totalRayleigh * rayleighCoefficient;","\tvBetaM = totalMie( turbidity ) * mieCoefficient;","}"].join("\n"),fragmentShader:["varying vec3 vWorldPosition;","varying vec3 vSunDirection;","varying float vSunfade;","varying vec3 vBetaR;","varying vec3 vBetaM;","varying float vSunE;","uniform float mieDirectionalG;","uniform vec3 up;","const vec3 cameraPos = vec3( 0.0, 0.0, 0.0 );","const float pi = 3.141592653589793238462643383279502884197169;","const float n = 1.0003;","const float N = 2.545E25;","const float rayleighZenithLength = 8.4E3;","const float mieZenithLength = 1.25E3;","const float sunAngularDiameterCos = 0.999956676946448443553574619906976478926848692873900859324;","const float THREE_OVER_SIXTEENPI = 0.05968310365946075;","const float ONE_OVER_FOURPI = 0.07957747154594767;","float rayleighPhase( float cosTheta ) {","\treturn THREE_OVER_SIXTEENPI * ( 1.0 + pow( cosTheta, 2.0 ) );","}","float hgPhase( float cosTheta, float g ) {","\tfloat g2 = pow( g, 2.0 );","\tfloat inverse = 1.0 / pow( 1.0 - 2.0 * g * cosTheta + g2, 1.5 );","\treturn ONE_OVER_FOURPI * ( ( 1.0 - g2 ) * inverse );","}","void main() {","\tvec3 direction = normalize( vWorldPosition - cameraPos );","\tfloat zenithAngle = acos( max( 0.0, dot( up, direction ) ) );","\tfloat inverse = 1.0 / ( cos( zenithAngle ) + 0.15 * pow( 93.885 - ( ( zenithAngle * 180.0 ) / pi ), -1.253 ) );","\tfloat sR = rayleighZenithLength * inverse;","\tfloat sM = mieZenithLength * inverse;","\tvec3 Fex = exp( -( vBetaR * sR + vBetaM * sM ) );","\tfloat cosTheta = dot( direction, vSunDirection );","\tfloat rPhase = rayleighPhase( cosTheta * 0.5 + 0.5 );","\tvec3 betaRTheta = vBetaR * rPhase;","\tfloat mPhase = hgPhase( cosTheta, mieDirectionalG );","\tvec3 betaMTheta = vBetaM * mPhase;","\tvec3 Lin = pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * ( 1.0 - Fex ), vec3( 1.5 ) );","\tLin *= mix( vec3( 1.0 ), pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * Fex, vec3( 1.0 / 2.0 ) ), clamp( pow( 1.0 - dot( up, vSunDirection ), 5.0 ), 0.0, 1.0 ) );","\tfloat theta = acos( direction.y ); // elevation --\x3e y-axis, [-pi/2, pi/2]","\tfloat phi = atan( direction.z, direction.x ); // azimuth --\x3e x-axis [-pi/2, pi/2]","\tvec2 uv = vec2( phi, theta ) / vec2( 2.0 * pi, pi ) + vec2( 0.5, 0.0 );","\tvec3 L0 = vec3( 0.1 ) * Fex;","\tfloat sundisk = smoothstep( sunAngularDiameterCos, sunAngularDiameterCos + 0.00002, cosTheta );","\tL0 += ( vSunE * 19000.0 * Fex ) * sundisk;","\tvec3 texColor = ( Lin + L0 ) * 0.04 + vec3( 0.0, 0.0003, 0.00075 );","\tvec3 retColor = pow( texColor, vec3( 1.0 / ( 1.2 + ( 1.2 * vSunfade ) ) ) );","\tgl_FragColor = vec4( retColor, 1.0 );","#include <tonemapping_fragment>","#include <encodings_fragment>","}"].join("\n")}),p.default(to,"material",new e.ShaderMaterial({name:"SkyShader",fragmentShader:to.SkyShader.fragmentShader,vertexShader:to.SkyShader.vertexShader,uniforms:e.UniformsUtils.clone(to.SkyShader.uniforms),side:e.BackSide,depthWrite:!1}));class ro extends e.Mesh{constructor(t,r={}){super(t),this.type="Water";const i=this,n=void 0!==r.color?new e.Color(r.color):new e.Color(16777215),s=r.textureWidth||512,o=r.textureHeight||512,a=r.clipBias||0,l=r.flowDirection||new e.Vector2(1,0),c=r.flowSpeed||.03,h=r.reflectivity||.02,u=r.scale||1,d=r.shader||ro.WaterShader,p=void 0!==r.encoding?r.encoding:3e3,m=new e.TextureLoader,f=r.flowMap||void 0,g=r.normalMap0||m.load("textures/water/Water_1_M_Normal.jpg"),v=r.normalMap1||m.load("textures/water/Water_2_M_Normal.jpg"),x=.15,y=.075,b=new e.Matrix4,A=new e.Clock;if(void 0===Gs)return void console.error("THREE.Water: Required component Reflector not found.");if(void 0===zs)return void console.error("THREE.Water: Required component Refractor not found.");const w=new Gs(t,{textureWidth:s,textureHeight:o,clipBias:a,encoding:p}),M=new zs(t,{textureWidth:s,textureHeight:o,clipBias:a,encoding:p});w.matrixAutoUpdate=!1,M.matrixAutoUpdate=!1,this.material=new e.ShaderMaterial({uniforms:e.UniformsUtils.merge([e.UniformsLib.fog,d.uniforms]),vertexShader:d.vertexShader,fragmentShader:d.fragmentShader,transparent:!0,fog:!0}),void 0!==f?(this.material.defines.USE_FLOWMAP="",this.material.uniforms.tFlowMap={type:"t",value:f}):this.material.uniforms.flowDirection={type:"v2",value:l},g.wrapS=g.wrapT=e.RepeatWrapping,v.wrapS=v.wrapT=e.RepeatWrapping,this.material.uniforms.tReflectionMap.value=w.getRenderTarget().texture,this.material.uniforms.tRefractionMap.value=M.getRenderTarget().texture,this.material.uniforms.tNormalMap0.value=g,this.material.uniforms.tNormalMap1.value=v,this.material.uniforms.color.value=n,this.material.uniforms.reflectivity.value=h,this.material.uniforms.textureMatrix.value=b,this.material.uniforms.config.value.x=0,this.material.uniforms.config.value.y=y,this.material.uniforms.config.value.z=y,this.material.uniforms.config.value.w=u,this.onBeforeRender=function(e,t,r){!function(e){b.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),b.multiply(e.projectionMatrix),b.multiply(e.matrixWorldInverse),b.multiply(i.matrixWorld)}(r),function(){const e=A.getDelta(),t=i.material.uniforms.config;t.value.x+=c*e,t.value.y=t.value.x+y,t.value.x>=x?(t.value.x=0,t.value.y=y):t.value.y>=x&&(t.value.y=t.value.y-x)}(),i.visible=!1,w.matrixWorld.copy(i.matrixWorld),M.matrixWorld.copy(i.matrixWorld),w.onBeforeRender(e,t,r),M.onBeforeRender(e,t,r),i.visible=!0}}}ro.prototype.isWater=!0,ro.WaterShader={uniforms:{color:{type:"c",value:null},reflectivity:{type:"f",value:0},tReflectionMap:{type:"t",value:null},tRefractionMap:{type:"t",value:null},tNormalMap0:{type:"t",value:null},tNormalMap1:{type:"t",value:null},textureMatrix:{type:"m4",value:null},config:{type:"v4",value:new e.Vector4}},vertexShader:"\n\n\t\t#include <common>\n\t\t#include <fog_pars_vertex>\n\t\t#include <logdepthbuf_pars_vertex>\n\n\t\tuniform mat4 textureMatrix;\n\n\t\tvarying vec4 vCoord;\n\t\tvarying vec2 vUv;\n\t\tvarying vec3 vToEye;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tvCoord = textureMatrix * vec4( position, 1.0 );\n\n\t\t\tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n\t\t\tvToEye = cameraPosition - worldPosition.xyz;\n\n\t\t\tvec4 mvPosition = viewMatrix * worldPosition; // used in fog_vertex\n\t\t\tgl_Position = projectionMatrix * mvPosition;\n\n\t\t\t#include <logdepthbuf_vertex>\n\t\t\t#include <fog_vertex>\n\n\t\t}",fragmentShader:"\n\n\t\t#include <common>\n\t\t#include <fog_pars_fragment>\n\t\t#include <logdepthbuf_pars_fragment>\n\n\t\tuniform sampler2D tReflectionMap;\n\t\tuniform sampler2D tRefractionMap;\n\t\tuniform sampler2D tNormalMap0;\n\t\tuniform sampler2D tNormalMap1;\n\n\t\t#ifdef USE_FLOWMAP\n\t\t\tuniform sampler2D tFlowMap;\n\t\t#else\n\t\t\tuniform vec2 flowDirection;\n\t\t#endif\n\n\t\tuniform vec3 color;\n\t\tuniform float reflectivity;\n\t\tuniform vec4 config;\n\n\t\tvarying vec4 vCoord;\n\t\tvarying vec2 vUv;\n\t\tvarying vec3 vToEye;\n\n\t\tvoid main() {\n\n\t\t\t#include <logdepthbuf_fragment>\n\n\t\t\tfloat flowMapOffset0 = config.x;\n\t\t\tfloat flowMapOffset1 = config.y;\n\t\t\tfloat halfCycle = config.z;\n\t\t\tfloat scale = config.w;\n\n\t\t\tvec3 toEye = normalize( vToEye );\n\n\t\t\t// determine flow direction\n\t\t\tvec2 flow;\n\t\t\t#ifdef USE_FLOWMAP\n\t\t\t\tflow = texture2D( tFlowMap, vUv ).rg * 2.0 - 1.0;\n\t\t\t#else\n\t\t\t\tflow = flowDirection;\n\t\t\t#endif\n\t\t\tflow.x *= - 1.0;\n\n\t\t\t// sample normal maps (distort uvs with flowdata)\n\t\t\tvec4 normalColor0 = texture2D( tNormalMap0, ( vUv * scale ) + flow * flowMapOffset0 );\n\t\t\tvec4 normalColor1 = texture2D( tNormalMap1, ( vUv * scale ) + flow * flowMapOffset1 );\n\n\t\t\t// linear interpolate to get the final normal color\n\t\t\tfloat flowLerp = abs( halfCycle - flowMapOffset0 ) / halfCycle;\n\t\t\tvec4 normalColor = mix( normalColor0, normalColor1, flowLerp );\n\n\t\t\t// calculate normal vector\n\t\t\tvec3 normal = normalize( vec3( normalColor.r * 2.0 - 1.0, normalColor.b, normalColor.g * 2.0 - 1.0 ) );\n\n\t\t\t// calculate the fresnel term to blend reflection and refraction maps\n\t\t\tfloat theta = max( dot( toEye, normal ), 0.0 );\n\t\t\tfloat reflectance = reflectivity + ( 1.0 - reflectivity ) * pow( ( 1.0 - theta ), 5.0 );\n\n\t\t\t// calculate final uv coords\n\t\t\tvec3 coord = vCoord.xyz / vCoord.w;\n\t\t\tvec2 uv = coord.xy + coord.z * normal.xz * 0.05;\n\n\t\t\tvec4 reflectColor = texture2D( tReflectionMap, vec2( 1.0 - uv.x, uv.y ) );\n\t\t\tvec4 refractColor = texture2D( tRefractionMap, uv );\n\n\t\t\t// multiply water color with the mix of both textures\n\t\t\tgl_FragColor = vec4( color, 1.0 ) * mix( refractColor, reflectColor, reflectance );\n\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <encodings_fragment>\n\t\t\t#include <fog_fragment>\n\n\t\t}"};class io extends e.Mesh{constructor(t,r){var i,n;const s=(o=t)&&o.isCubeTexture;var o;const a=(null!=(i=s?null===(n=t.image[0])||void 0===n?void 0:n.width:t.image.width)?i:1024)/4,l=Math.floor(Math.log2(a)),c=Math.pow(2,l),h=[s?"#define ENVMAP_TYPE_CUBE":"","#define CUBEUV_TEXEL_WIDTH "+1/(3*Math.max(c,112)),"#define CUBEUV_TEXEL_HEIGHT "+1/(4*c),`#define CUBEUV_MAX_MIP ${l}.0`].join("\n")+"\n #define ENVMAP_TYPE_CUBE_UV\n varying vec3 vWorldPosition;\n uniform float radius;\n uniform float height;\n uniform float angle;\n #ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube map;\n #else\n uniform sampler2D map;\n #endif\n // From: https://www.shadertoy.com/view/4tsBD7\n float diskIntersectWithBackFaceCulling( vec3 ro, vec3 rd, vec3 c, vec3 n, float r ) \n {\n float d = dot ( rd, n );\n \n if( d > 0.0 ) { return 1e6; }\n \n vec3 o = ro - c;\n float t = - dot( n, o ) / d;\n vec3 q = o + rd * t;\n \n return ( dot( q, q ) < r * r ) ? t : 1e6;\n }\n // From: https://www.iquilezles.org/www/articles/intersectors/intersectors.htm\n float sphereIntersect( vec3 ro, vec3 rd, vec3 ce, float ra ) \n {\n vec3 oc = ro - ce;\n float b = dot( oc, rd );\n float c = dot( oc, oc ) - ra * ra;\n float h = b * b - c;\n \n if( h < 0.0 ) { return -1.0; }\n \n h = sqrt( h );\n \n return - b + h;\n }\n vec3 project() \n {\n vec3 p = normalize( vWorldPosition );\n vec3 camPos = cameraPosition;\n camPos.y -= height;\n float intersection = sphereIntersect( camPos, p, vec3( 0.0 ), radius );\n if( intersection > 0.0 ) {\n \n vec3 h = vec3( 0.0, - height, 0.0 );\n float intersection2 = diskIntersectWithBackFaceCulling( camPos, p, h, vec3( 0.0, 1.0, 0.0 ), radius );\n p = ( camPos + min( intersection, intersection2 ) * p ) / radius;\n } else {\n p = vec3( 0.0, 1.0, 0.0 );\n }\n return p;\n }\n #include <common>\n #include <cube_uv_reflection_fragment>\n void main() \n {\n vec3 projectedWorldPosition = project();\n \n #ifdef ENVMAP_TYPE_CUBE\n vec3 outcolor = textureCube( map, projectedWorldPosition ).rgb;\n #else\n vec3 direction = normalize( projectedWorldPosition );\n vec2 uv = equirectUv( direction );\n vec3 outcolor = texture2D( map, uv ).rgb;\n #endif\n gl_FragColor = vec4( outcolor, 1.0 );\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n }\n ",u={map:{value:t},height:{value:(null==r?void 0:r.height)||15},radius:{value:(null==r?void 0:r.radius)||100}};super(new e.IcosahedronGeometry(1,16),new e.ShaderMaterial({uniforms:u,fragmentShader:h,vertexShader:"\n varying vec3 vWorldPosition;\n void main() \n {\n vec4 worldPosition = ( modelMatrix * vec4( position, 1.0 ) );\n vWorldPosition = worldPosition.xyz;\n \n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }\n ",side:e.DoubleSide}))}set radius(e){this.material.uniforms.radius.value=e}get radius(){return this.material.uniforms.radius.value}set height(e){this.material.uniforms.height.value=e}get height(){return this.material.uniforms.height.value}}const no={createMeshesFromInstancedMesh:function(t){const r=new e.Group,i=t.count,n=t.geometry,s=t.material;for(let o=0;o<i;o++){const i=new e.Mesh(n,s);t.getMatrixAt(o,i.matrix),i.matrix.decompose(i.position,i.quaternion,i.scale),r.add(i)}return r.copy(t),r.updateMatrixWorld(),r},createMultiMaterialObject:function(t,r){const i=new e.Group;for(let n=0,s=r.length;n<s;n++)i.add(new e.Mesh(t,r[n]));return i},detach:function(e,t,r){console.warn("THREE.SceneUtils: detach() has been deprecated. Use scene.attach( child ) instead."),r.attach(e)},attach:function(e,t,r){console.warn("THREE.SceneUtils: attach() has been deprecated. Use parent.attach( child ) instead."),r.attach(e)}};const so=(t=new e.Vector3(0,0,0),r=10,i=1,n=0,s=1,o=2,a=3)=>{const l=r/2,c=[new e.Vector3(t.x-l,t.y,t.z-l),new e.Vector3(t.x-l,t.y,t.z+l),new e.Vector3(t.x+l,t.y,t.z+l),new e.Vector3(t.x+l,t.y,t.z-l)],h=[c[n],c[s],c[o],c[a]];if(0<=--i){const e=[];return Array.prototype.push.apply(e,so(h[0],l,i,n,a,o,s)),Array.prototype.push.apply(e,so(h[1],l,i,n,s,o,a)),Array.prototype.push.apply(e,so(h[2],l,i,n,s,o,a)),Array.prototype.push.apply(e,so(h[3],l,i,o,s,n,a)),e}return h},oo=(t=new e.Vector3(0,0,0),r=10,i=1,n=0,s=1,o=2,a=3,l=4,c=5,h=6,u=7)=>{const d=r/2,p=[new e.Vector3(t.x-d,t.y+d,t.z-d),new e.Vector3(t.x-d,t.y+d,t.z+d),new e.Vector3(t.x-d,t.y-d,t.z+d),new e.Vector3(t.x-d,t.y-d,t.z-d),new e.Vector3(t.x+d,t.y-d,t.z-d),new e.Vector3(t.x+d,t.y-d,t.z+d),new e.Vector3(t.x+d,t.y+d,t.z+d),new e.Vector3(t.x+d,t.y+d,t.z-d)],m=[p[n],p[s],p[o],p[a],p[l],p[c],p[h],p[u]];if(--i>=0){const e=[];return Array.prototype.push.apply(e,oo(m[0],d,i,n,a,l,u,h,c,o,s)),Array.prototype.push.apply(e,oo(m[1],d,i,n,u,h,s,o,c,l,a)),Array.prototype.push.apply(e,oo(m[2],d,i,n,u,h,s,o,c,l,a)),Array.prototype.push.apply(e,oo(m[3],d,i,o,a,n,s,h,u,l,c)),Array.prototype.push.apply(e,oo(m[4],d,i,o,a,n,s,h,u,l,c)),Array.prototype.push.apply(e,oo(m[5],d,i,l,a,o,c,h,s,n,u)),Array.prototype.push.apply(e,oo(m[6],d,i,l,a,o,c,h,s,n,u)),Array.prototype.push.apply(e,oo(m[7],d,i,h,c,o,s,n,a,l,u)),e}return m},ao={hilbert3D:oo,gosper:(e=1)=>function(e){let t=0,r=0,i=0;const n=[0,0,0],s=e.fractal;for(let o=0,a=s.length;o<a;o++){const a=s[o];"+"===a?i+=e.angle:"-"===a?i-=e.angle:"F"===a&&(t+=e.size*Math.cos(i),r+=-e.size*Math.sin(i),n.push(t,r,0))}return n}({fractal:function(e){let t="",r=e.axiom;for(let i=0,n=e.steps;0<=n?i<n:i>n;0<=n?i++:i--){t="";for(let i=0,n=r.length;i<n;i++){const n=r[i];n in e.rules?t+=e.rules[n]:t+=n}r=t}return t}({axiom:"A",steps:4,rules:{A:"A+BF++BF-FA--FAFA-BF+",B:"-FA+BFBF++BF+FA--FA-B"}}),size:e,angle:Math.PI/3}),hilbert2D:so};var lo,co=((lo=new e.RawShaderMaterial({uniforms:{roughnessMap:{value:null},normalMap:{value:null},texelSize:{value:new e.Vector2(1,1)}},vertexShader:"\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tattribute vec3 position;\n\t\t\tattribute vec2 uv;\n\n\t\t\tvarying vec2 vUv;\n\n\t\t\tvoid main() {\n\n\t\t\t\tvUv = uv;\n\n\t\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t\t}\n\t\t",fragmentShader:"\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec2 vUv;\n\n\t\t\tuniform sampler2D roughnessMap;\n\t\t\tuniform sampler2D normalMap;\n\t\t\tuniform vec2 texelSize;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\n\t\t\tvec4 envMapTexelToLinear( vec4 a ) { return a; }\n\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tfloat roughnessToVariance( float roughness ) {\n\n\t\t\t\tfloat variance = 0.0;\n\n\t\t\t\tif ( roughness >= r1 ) {\n\n\t\t\t\t\tvariance = ( r0 - roughness ) * ( v1 - v0 ) / ( r0 - r1 ) + v0;\n\n\t\t\t\t} else if ( roughness >= r4 ) {\n\n\t\t\t\t\tvariance = ( r1 - roughness ) * ( v4 - v1 ) / ( r1 - r4 ) + v1;\n\n\t\t\t\t} else if ( roughness >= r5 ) {\n\n\t\t\t\t\tvariance = ( r4 - roughness ) * ( v5 - v4 ) / ( r4 - r5 ) + v4;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tfloat roughness2 = roughness * roughness;\n\n\t\t\t\t\tvariance = 1.79 * roughness2 * roughness2;\n\n\t\t\t\t}\n\n\t\t\t\treturn variance;\n\n\t\t\t}\n\n\t\t\tfloat varianceToRoughness( float variance ) {\n\n\t\t\t\tfloat roughness = 0.0;\n\n\t\t\t\tif ( variance >= v1 ) {\n\n\t\t\t\t\troughness = ( v0 - variance ) * ( r1 - r0 ) / ( v0 - v1 ) + r0;\n\n\t\t\t\t} else if ( variance >= v4 ) {\n\n\t\t\t\t\troughness = ( v1 - variance ) * ( r4 - r1 ) / ( v1 - v4 ) + r1;\n\n\t\t\t\t} else if ( variance >= v5 ) {\n\n\t\t\t\t\troughness = ( v4 - variance ) * ( r5 - r4 ) / ( v4 - v5 ) + r4;\n\n\t\t\t\t} else {\n\n\t\t\t\t\troughness = pow( 0.559 * variance, 0.25 ); // 0.559 = 1.0 / 1.79\n\n\t\t\t\t}\n\n\t\t\t\treturn roughness;\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = texture2D( roughnessMap, vUv, - 1.0 );\n\n\t\t\t\tif ( texelSize.x == 0.0 ) return;\n\n\t\t\t\tfloat roughness = gl_FragColor.g;\n\n\t\t\t\tfloat variance = roughnessToVariance( roughness );\n\n\t\t\t\tvec3 avgNormal;\n\n\t\t\t\tfor ( float x = - 1.0; x < 2.0; x += 2.0 ) {\n\n\t\t\t\t\tfor ( float y = - 1.0; y < 2.0; y += 2.0 ) {\n\n\t\t\t\t\t\tvec2 uv = vUv + vec2( x, y ) * 0.25 * texelSize;\n\n\t\t\t\t\t\tavgNormal += normalize( texture2D( normalMap, uv, - 1.0 ).xyz - 0.5 );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tvariance += 1.0 - 0.25 * length( avgNormal );\n\n\t\t\t\tgl_FragColor.g = varianceToRoughness( variance );\n\n\t\t\t}\n\t\t",blending:e.NoBlending,depthTest:!1,depthWrite:!1})).type="RoughnessMipmapper",lo),ho=new e.Mesh(new e.PlaneGeometry(2,2),co),uo=new e.OrthographicCamera(0,1,0,1,0,1),po=null,mo=null;function fo(e){(mo=e).compile(ho,uo)}fo.prototype={constructor:fo,generateMipmaps:function(t){if("roughnessMap"in t!=!1){var{roughnessMap:r,normalMap:i}=t;if(null!==r&&null!==i&&r.generateMipmaps&&!t.userData.roughnessUpdated){t.userData.roughnessUpdated=!0;var n=Math.max(r.image.width,i.image.width),s=Math.max(r.image.height,i.image.height);if(e.MathUtils.isPowerOfTwo(n)&&e.MathUtils.isPowerOfTwo(s)){var o=mo.getRenderTarget(),a=mo.autoClear;if(mo.autoClear=!1,null!==po&&po.width===n&&po.height===s||(null!==po&&po.dispose(),(po=new e.WebGLRenderTarget(n,s,{depthBuffer:!1})).scissorTest=!0),n!==r.image.width||s!==r.image.height){var l={wrapS:r.wrapS,wrapT:r.wrapT,magFilter:r.magFilter,minFilter:r.minFilter,depthBuffer:!1},c=new e.WebGLRenderTarget(n,s,l);c.texture.generateMipmaps=!0,mo.setRenderTarget(c),t.roughnessMap=c.texture,t.metalnessMap==r&&(t.metalnessMap=t.roughnessMap),t.aoMap==r&&(t.aoMap=t.roughnessMap)}co.uniforms.roughnessMap.value=r,co.uniforms.normalMap.value=i;var h=new e.Vector2(0,0),u=co.uniforms.texelSize.value;for(let e=0;n>=1&&s>=1;++e,n/=2,s/=2)u.set(1/n,1/s),0==e&&u.set(0,0),po.viewport.set(h.x,h.y,n,s),po.scissor.set(h.x,h.y,n,s),mo.setRenderTarget(po),mo.render(ho,uo),mo.copyFramebufferToTexture(h,t.roughnessMap,e),co.uniforms.roughnessMap.value=t.roughnessMap;r!==t.roughnessMap&&r.dispose(),mo.setRenderTarget(o),mo.autoClear=a}}}},dispose:function(){co.dispose(),ho.geometry.dispose(),null!=po&&po.dispose()}};var go,vo,xo,yo,bo,Ao,wo,Mo,To,So,Co,Fo,Eo={retarget:(wo=new e.Vector3,Mo=new e.Quaternion,To=new e.Vector3,So=new e.Matrix4,Co=new e.Matrix4,Fo=new e.Matrix4,function(e,t,r){(r=r||{}).preserveMatrix=void 0===r.preserveMatrix||r.preserveMatrix,r.preservePosition=void 0===r.preservePosition||r.preservePosition,r.preserveHipPosition=void 0!==r.preserveHipPosition&&r.preserveHipPosition,r.useTargetMatrix=void 0!==r.useTargetMatrix&&r.useTargetMatrix,r.hip=void 0!==r.hip?r.hip:"hip",r.names=r.names||{};var i,n,s,o,a,l,c=t.isObject3D?t.skeleton.bones:this.getBones(t),h=e.isObject3D?e.skeleton.bones:this.getBones(e);if(e.isObject3D?e.skeleton.pose():(r.useTargetMatrix=!0,r.preserveMatrix=!1),r.preservePosition)for(a=[],l=0;l<h.length;l++)a.push(h[l].position.clone());if(r.preserveMatrix)for(e.updateMatrixWorld(),e.matrixWorld.identity(),l=0;l<e.children.length;++l)e.children[l].updateMatrixWorld(!0);if(r.offsets)for(i=[],l=0;l<h.length;++l)n=h[l],s=r.names[n.name]||n.name,r.offsets&&r.offsets[s]&&(n.matrix.multiply(r.offsets[s]),n.matrix.decompose(n.position,n.quaternion,n.scale),n.updateMatrixWorld()),i.push(n.matrixWorld.clone());for(l=0;l<h.length;++l){if(n=h[l],s=r.names[n.name]||n.name,o=this.getBoneByName(s,c),Fo.copy(n.matrixWorld),o){if(o.updateMatrixWorld(),r.useTargetMatrix?Co.copy(o.matrixWorld):(Co.copy(e.matrixWorld).invert(),Co.multiply(o.matrixWorld)),To.setFromMatrixScale(Co),Co.scale(To.set(1/To.x,1/To.y,1/To.z)),Fo.makeRotationFromQuaternion(Mo.setFromRotationMatrix(Co)),e.isObject3D){var u=h.indexOf(n),d=i?i[u]:So.copy(e.skeleton.boneInverses[u]).invert();Fo.multiply(d)}Fo.copyPosition(Co)}n.parent&&n.parent.isBone?(n.matrix.copy(n.parent.matrixWorld).invert(),n.matrix.multiply(Fo)):n.matrix.copy(Fo),r.preserveHipPosition&&s===r.hip&&n.matrix.setPosition(wo.set(0,n.position.y,0)),n.matrix.decompose(n.position,n.quaternion,n.scale),n.updateMatrixWorld()}if(r.preservePosition)for(l=0;l<h.length;++l)n=h[l],(s=r.names[n.name]||n.name)!==r.hip&&n.position.copy(a[l]);r.preserveMatrix&&e.updateMatrixWorld(!0)}),retargetClip:function(t,r,i,n){(n=n||{}).useFirstFramePosition=void 0!==n.useFirstFramePosition&&n.useFirstFramePosition,n.fps=void 0!==n.fps?n.fps:30,n.names=n.names||[],r.isObject3D||(r=this.getHelperFromSkeleton(r));var s,o,a,l,c,h,u=Math.round(i.duration*(n.fps/1e3)*1e3),d=1/n.fps,p=[],m=new e.AnimationMixer(r),f=this.getBones(t.skeleton),g=[];for(m.clipAction(i).play(),m.update(0),r.updateMatrixWorld(),c=0;c<u;++c){var v=c*d;for(this.retarget(t,r,n),h=0;h<f.length;++h)l=n.names[f[h].name]||f[h].name,this.getBoneByName(l,r.skeleton)&&(o=f[h],a=g[h]=g[h]||{bone:o},n.hip===l&&(a.pos||(a.pos={times:new Float32Array(u),values:new Float32Array(3*u)}),n.useFirstFramePosition&&(0===c&&(s=o.position.clone()),o.position.sub(s)),a.pos.times[c]=v,o.position.toArray(a.pos.values,3*c)),a.quat||(a.quat={times:new Float32Array(u),values:new Float32Array(4*u)}),a.quat.times[c]=v,o.quaternion.toArray(a.quat.values,4*c));m.update(d),r.updateMatrixWorld()}for(c=0;c<g.length;++c)(a=g[c])&&(a.pos&&p.push(new e.VectorKeyframeTrack(".bones["+a.bone.name+"].position",a.pos.times,a.pos.values)),p.push(new e.QuaternionKeyframeTrack(".bones["+a.bone.name+"].quaternion",a.quat.times,a.quat.values)));return m.uncacheAction(i),new e.AnimationClip(i.name,-1,p)},getHelperFromSkeleton:function(t){var r=new e.SkeletonHelper(t.bones[0]);return r.skeleton=t,r},getSkeletonOffsets:(go=new e.Vector3,vo=new e.Vector3,xo=new e.Vector3,yo=new e.Vector3,bo=new e.Vector2,Ao=new e.Vector2,function(t,r,i){(i=i||{}).hip=void 0!==i.hip?i.hip:"hip",i.names=i.names||{},r.isObject3D||(r=this.getHelperFromSkeleton(r));var n,s,o,a,l=Object.keys(i.names),c=Object.values(i.names),h=r.isObject3D?r.skeleton.bones:this.getBones(r),u=t.isObject3D?t.skeleton.bones:this.getBones(t),d=[];for(t.skeleton.pose(),a=0;a<u.length;++a)if(n=u[a],o=i.names[n.name]||n.name,(s=this.getBoneByName(o,h))&&o!==i.hip){var p=this.getNearestBone(n.parent,l),m=this.getNearestBone(s.parent,c);p.updateMatrixWorld(),m.updateMatrixWorld(),go.setFromMatrixPosition(p.matrixWorld),vo.setFromMatrixPosition(n.matrixWorld),xo.setFromMatrixPosition(m.matrixWorld),yo.setFromMatrixPosition(s.matrixWorld),bo.subVectors(new e.Vector2(vo.x,vo.y),new e.Vector2(go.x,go.y)).normalize(),Ao.subVectors(new e.Vector2(yo.x,yo.y),new e.Vector2(xo.x,xo.y)).normalize();var f=bo.angle()-Ao.angle(),g=(new e.Matrix4).makeRotationFromEuler(new e.Euler(0,0,f));n.matrix.multiply(g),n.matrix.decompose(n.position,n.quaternion,n.scale),n.updateMatrixWorld(),d[o]=g}return d}),renameBones:function(e,t){var r=this.getBones(e);for(let e=0;e<r.length;++e){var i=r[e];t[i.name]&&(i.name=t[i.name])}return this},getBones:function(e){return Array.isArray(e)?e:e.bones},getBoneByName:function(e,t){for(let r=0,i=this.getBones(t);r<i.length;r++)if(e===i[r].name)return i[r]},getNearestBone:function(e,t){for(;e.isBone;){if(-1!==t.indexOf(e.name))return e;e=e.parent}},findBoneTrackData:function(e,t){var r=/\[(.*)\]\.(.*)/,i={name:e};for(let s=0;s<t.length;++s){var n=r.exec(t[s].name);n&&e===n[1]&&(i[n[2]]=s)}return i},getEqualsBonesNames:function(e,t){var r=this.getBones(e),i=this.getBones(t),n=[];e:for(let e=0;e<r.length;e++){var s=r[e].name;for(let e=0;e<i.length;e++)if(s===i[e].name){n.push(s);continue e}}return n},clone:function(e){var t=new Map,r=new Map,i=e.clone();return _o(e,i,(function(e,i){t.set(i,e),r.set(e,i)})),i.traverse((function(e){if(e.isSkinnedMesh){var i=e,n=t.get(e),s=n.skeleton.bones;i.skeleton=n.skeleton.clone(),i.bindMatrix.copy(n.bindMatrix),i.skeleton.bones=s.map((function(e){return r.get(e)})),i.bind(i.skeleton,i.bindMatrix)}})),i}};function _o(e,t,r){r(e,t);for(let i=0;i<e.children.length;i++)_o(e.children[i],t.children[i],r)}const Po={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform float opacity;","uniform sampler2D tDiffuse;","varying vec2 vUv;","#include <packing>","void main() {","\tfloat depth = 1.0 - unpackRGBAToDepth( texture2D( tDiffuse, vUv ) );","\tgl_FragColor = vec4( vec3( depth ), opacity );","}"].join("\n")};var Bo=function(t){var r,i=this,n=void 0!==t.name&&""!==t.name,s=10,o=10,a=256,l=256,c=new e.OrthographicCamera(window.innerWidth/-2,window.innerWidth/2,window.innerHeight/2,window.innerHeight/-2,1,10);c.position.set(0,0,2);var h,u,d=new e.Scene,p=Po,m=e.UniformsUtils.clone(p.uniforms),f=new e.ShaderMaterial({uniforms:m,vertexShader:p.vertexShader,fragmentShader:p.fragmentShader}),g=new e.PlaneGeometry(a,l),v=new e.Mesh(g,f);if(d.add(v),n){var x=(h=document.createElement("canvas")).getContext("2d");x.font="Bold 20px Arial";var y=x.measureText(t.name).width;h.width=y,h.height=25,x.font="Bold 20px Arial",x.fillStyle="rgba( 255, 0, 0, 1 )",x.fillText(t.name,0,20);var b=new e.Texture(h);b.magFilter=e.LinearFilter,b.minFilter=e.LinearFilter,b.needsUpdate=!0;var A=new e.MeshBasicMaterial({map:b,side:e.DoubleSide});A.transparent=!0;var w=new e.PlaneGeometry(h.width,h.height);u=new e.Mesh(w,A),d.add(u)}this.enabled=!0,this.size={width:a,height:l,set:function(e,t){this.width=e,this.height=t,v.scale.set(this.width/a,this.height/l,1),i.position.set(i.position.x,i.position.y)}},this.position={x:s,y:o,set:function(e,t){this.x=e,this.y=t;var r=i.size.width,s=i.size.height;v.position.set(-window.innerWidth/2+r/2+this.x,window.innerHeight/2-s/2-this.y,0),n&&u.position.set(v.position.x,v.position.y-i.size.height/2+h.height/2,0)}},this.render=function(e){this.enabled&&(m.tDiffuse.value=t.shadow.map.texture,r=e.autoClear,e.autoClear=!1,e.clearDepth(),e.render(d,c),e.autoClear=r)},this.updateForWindowResize=function(){this.enabled&&(c.left=window.innerWidth/-2,c.right=window.innerWidth/2,c.top=window.innerHeight/2,c.bottom=window.innerHeight/-2,c.updateProjectionMatrix(),this.update())},this.update=function(){this.position.set(this.position.x,this.position.y),this.size.set(this.size.width,this.size.height)},this.update()};Bo.prototype.constructor=Bo;var Lo={compressNormals:function(t,r){t.geometry||console.error("Mesh must contain geometry. ");const i=t.geometry.attributes.normal;if(i||console.error("Geometry must contain normal attribute. "),i.isPacked)return;3!=i.itemSize&&console.error("normal.itemSize is not 3, which cannot be encoded. ");const n=i.array,s=i.count;let o;if("DEFAULT"==r){o=new Uint8Array(3*s);for(let e=0;e<n.length;e+=3){const t=this.EncodingFuncs.defaultEncode(n[e],n[e+1],n[e+2],1);o[e+0]=t[0],o[e+1]=t[1],o[e+2]=t[2]}t.geometry.setAttribute("normal",new e.BufferAttribute(o,3,!0)),t.geometry.attributes.normal.bytes=1*o.length}else if("OCT1Byte"==r){o=new Int8Array(2*s);for(let e=0;e<n.length;e+=3){const t=this.EncodingFuncs.octEncodeBest(n[e],n[e+1],n[e+2],1);o[e/3*2+0]=t[0],o[e/3*2+1]=t[1]}t.geometry.setAttribute("normal",new e.BufferAttribute(o,2,!0)),t.geometry.attributes.normal.bytes=1*o.length}else if("OCT2Byte"==r){o=new Int16Array(2*s);for(let e=0;e<n.length;e+=3){const t=this.EncodingFuncs.octEncodeBest(n[e],n[e+1],n[e+2],2);o[e/3*2+0]=t[0],o[e/3*2+1]=t[1]}t.geometry.setAttribute("normal",new e.BufferAttribute(o,2,!0)),t.geometry.attributes.normal.bytes=2*o.length}else if("ANGLES"==r){o=new Uint16Array(2*s);for(let e=0;e<n.length;e+=3){const t=this.EncodingFuncs.anglesEncode(n[e],n[e+1],n[e+2]);o[e/3*2+0]=t[0],o[e/3*2+1]=t[1]}t.geometry.setAttribute("normal",new e.BufferAttribute(o,2,!0)),t.geometry.attributes.normal.bytes=2*o.length}else console.error("Unrecognized encoding method, should be `DEFAULT` or `ANGLES` or `OCT`. ");t.geometry.attributes.normal.needsUpdate=!0,t.geometry.attributes.normal.isPacked=!0,t.geometry.attributes.normal.packingMethod=r,t.material instanceof Ro||(t.material=(new Ro).copy(t.material)),"ANGLES"==r&&(t.material.defines.USE_PACKED_NORMAL=0),"OCT1Byte"==r&&(t.material.defines.USE_PACKED_NORMAL=1),"OCT2Byte"==r&&(t.material.defines.USE_PACKED_NORMAL=1),"DEFAULT"==r&&(t.material.defines.USE_PACKED_NORMAL=2)},compressPositions:function(t){t.geometry||console.error("Mesh must contain geometry. ");const r=t.geometry.attributes.position;if(r||console.error("Geometry must contain position attribute. "),r.isPacked)return;3!=r.itemSize&&console.error("position.itemSize is not 3, which cannot be packed. ");const i=r.array,n=this.EncodingFuncs.quantizedEncode(i,2),s=n.quantized,o=n.decodeMat;null==t.geometry.boundingBox&&t.geometry.computeBoundingBox(),null==t.geometry.boundingSphere&&t.geometry.computeBoundingSphere(),t.geometry.setAttribute("position",new e.BufferAttribute(s,3)),t.geometry.attributes.position.isPacked=!0,t.geometry.attributes.position.needsUpdate=!0,t.geometry.attributes.position.bytes=2*s.length,t.material instanceof Ro||(t.material=(new Ro).copy(t.material)),t.material.defines.USE_PACKED_POSITION=0,t.material.uniforms.quantizeMatPos.value=o,t.material.uniforms.quantizeMatPos.needsUpdate=!0},compressUvs:function(t){t.geometry||console.error("Mesh must contain geometry property. ");const r=t.geometry.attributes.uv;if(r||console.error("Geometry must contain uv attribute. "),r.isPacked)return;const i={min:1/0,max:-1/0},n=r.array;for(let e=0;e<n.length;e++)i.min=Math.min(i.min,n[e]),i.max=Math.max(i.max,n[e]);let s;if(i.min>=-1&&i.max<=1){s=new Uint16Array(n.length);for(let e=0;e<n.length;e+=2){const t=this.EncodingFuncs.defaultEncode(n[e],n[e+1],0,2);s[e]=t[0],s[e+1]=t[1]}t.geometry.setAttribute("uv",new e.BufferAttribute(s,2,!0)),t.geometry.attributes.uv.isPacked=!0,t.geometry.attributes.uv.needsUpdate=!0,t.geometry.attributes.uv.bytes=2*s.length,t.material instanceof Ro||(t.material=(new Ro).copy(t.material)),t.material.defines.USE_PACKED_UV=0}else s=this.EncodingFuncs.quantizedEncodeUV(n,2),t.geometry.setAttribute("uv",new e.BufferAttribute(s.quantized,2)),t.geometry.attributes.uv.isPacked=!0,t.geometry.attributes.uv.needsUpdate=!0,t.geometry.attributes.uv.bytes=2*s.quantized.length,t.material instanceof Ro||(t.material=(new Ro).copy(t.material)),t.material.defines.USE_PACKED_UV=1,t.material.uniforms.quantizeMatUV.value=s.decodeMat,t.material.uniforms.quantizeMatUV.needsUpdate=!0},EncodingFuncs:{defaultEncode:function(e,t,r,i){if(1==i){const i=Math.round(.5*(e+1)*255),n=Math.round(.5*(t+1)*255),s=Math.round(.5*(r+1)*255);return new Uint8Array([i,n,s])}if(2==i){const i=Math.round(.5*(e+1)*65535),n=Math.round(.5*(t+1)*65535),s=Math.round(.5*(r+1)*65535);return new Uint16Array([i,n,s])}console.error("number of bytes must be 1 or 2")},defaultDecode:function(e,t){return 1==t?[e[0]/255*2-1,e[1]/255*2-1,e[2]/255*2-1]:2==t?[e[0]/65535*2-1,e[1]/65535*2-1,e[2]/65535*2-1]:void console.error("number of bytes must be 1 or 2")},anglesEncode:function(e,t,r){const i=parseInt(.5*(1+Math.atan2(t,e)/Math.PI)*65535),n=parseInt(.5*(1+r)*65535);return new Uint16Array([i,n])},octEncodeBest:function(e,t,r,i){var n,s,o,a,l;return o=n=c(e,t,r,"floor","floor"),s=h(n),l=u(e,t,r,s),s=h(n=c(e,t,r,"ceil","floor")),(a=u(e,t,r,s))>l&&(o=n,l=a),s=h(n=c(e,t,r,"floor","ceil")),(a=u(e,t,r,s))>l&&(o=n,l=a),s=h(n=c(e,t,r,"ceil","ceil")),(a=u(e,t,r,s))>l&&(o=n),o;function c(e,t,n,s,o){var a=e/(Math.abs(e)+Math.abs(t)+Math.abs(n)),l=t/(Math.abs(e)+Math.abs(t)+Math.abs(n));if(r<0){var c=(1-Math.abs(l))*(a>=0?1:-1),h=(1-Math.abs(a))*(l>=0?1:-1);a=c,l=h;var u=1-Math.abs(a)-Math.abs(l);u>0&&(u+=.001,a+=a>0?u/2:-u/2,l+=l>0?u/2:-u/2)}return 1==i?new Int8Array([Math[s](127.5*a+(a<0?1:0)),Math[o](127.5*l+(l<0?1:0))]):2==i?new Int16Array([Math[s](32767.5*a+(a<0?1:0)),Math[o](32767.5*l+(l<0?1:0))]):void 0}function h(e){var t=e[0],r=e[1];1==i?(t/=t<0?127:128,r/=r<0?127:128):2==i&&(t/=t<0?32767:32768,r/=r<0?32767:32768);var n=1-Math.abs(t)-Math.abs(r);if(n<0){var s=t;t=(1-Math.abs(r))*(t>=0?1:-1),r=(1-Math.abs(s))*(r>=0?1:-1)}var o=Math.sqrt(t*t+r*r+n*n);return[t/o,r/o,n/o]}function u(e,t,r,i){return e*i[0]+t*i[1]+r*i[2]}},quantizedEncode:function(t,r){let i,n;1==r?(i=new Uint8Array(t.length),n=255):2==r?(i=new Uint16Array(t.length),n=65535):console.error("number of bytes error! ");const s=new e.Matrix4,o=new Float32Array(3),a=new Float32Array(3);o[0]=o[1]=o[2]=Number.MAX_VALUE,a[0]=a[1]=a[2]=-Number.MAX_VALUE;for(let e=0;e<t.length;e+=3)o[0]=Math.min(o[0],t[e+0]),o[1]=Math.min(o[1],t[e+1]),o[2]=Math.min(o[2],t[e+2]),a[0]=Math.max(a[0],t[e+0]),a[1]=Math.max(a[1],t[e+1]),a[2]=Math.max(a[2],t[e+2]);s.scale(new e.Vector3((a[0]-o[0])/n,(a[1]-o[1])/n,(a[2]-o[2])/n)),s.elements[12]=o[0],s.elements[13]=o[1],s.elements[14]=o[2],s.transpose();const l=new Float32Array([a[0]!==o[0]?n/(a[0]-o[0]):0,a[1]!==o[1]?n/(a[1]-o[1]):0,a[2]!==o[2]?n/(a[2]-o[2]):0]);for(let e=0;e<t.length;e+=3)i[e+0]=Math.floor((t[e+0]-o[0])*l[0]),i[e+1]=Math.floor((t[e+1]-o[1])*l[1]),i[e+2]=Math.floor((t[e+2]-o[2])*l[2]);return{quantized:i,decodeMat:s}},quantizedEncodeUV:function(t,r){let i,n;1==r?(i=new Uint8Array(t.length),n=255):2==r?(i=new Uint16Array(t.length),n=65535):console.error("number of bytes error! ");const s=new e.Matrix3,o=new Float32Array(2),a=new Float32Array(2);o[0]=o[1]=Number.MAX_VALUE,a[0]=a[1]=-Number.MAX_VALUE;for(let e=0;e<t.length;e+=2)o[0]=Math.min(o[0],t[e+0]),o[1]=Math.min(o[1],t[e+1]),a[0]=Math.max(a[0],t[e+0]),a[1]=Math.max(a[1],t[e+1]);s.scale((a[0]-o[0])/n,(a[1]-o[1])/n),s.elements[6]=o[0],s.elements[7]=o[1],s.transpose();const l=new Float32Array([a[0]!==o[0]?n/(a[0]-o[0]):0,a[1]!==o[1]?n/(a[1]-o[1]):0]);for(let e=0;e<t.length;e+=2)i[e+0]=Math.floor((t[e+0]-o[0])*l[0]),i[e+1]=Math.floor((t[e+1]-o[1])*l[1]);return{quantized:i,decodeMat:s}}}};class Ro extends e.MeshPhongMaterial{constructor(t){super(),this.defines={},this.type="PackedPhongMaterial",this.uniforms=e.UniformsUtils.merge([e.ShaderLib.phong.uniforms,{quantizeMatPos:{value:null},quantizeMatUV:{value:null}}]),this.vertexShader=["#define PHONG","varying vec3 vViewPosition;","#ifndef FLAT_SHADED","varying vec3 vNormal;","#endif",e.ShaderChunk.common,e.ShaderChunk.uv_pars_vertex,e.ShaderChunk.uv2_pars_vertex,e.ShaderChunk.displacementmap_pars_vertex,e.ShaderChunk.envmap_pars_vertex,e.ShaderChunk.color_pars_vertex,e.ShaderChunk.fog_pars_vertex,e.ShaderChunk.morphtarget_pars_vertex,e.ShaderChunk.skinning_pars_vertex,e.ShaderChunk.shadowmap_pars_vertex,e.ShaderChunk.logdepthbuf_pars_vertex,e.ShaderChunk.clipping_planes_pars_vertex,"#ifdef USE_PACKED_NORMAL\n\t\t\t\t\t#if USE_PACKED_NORMAL == 0\n\t\t\t\t\t\tvec3 decodeNormal(vec3 packedNormal)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfloat x = packedNormal.x * 2.0 - 1.0;\n\t\t\t\t\t\t\tfloat y = packedNormal.y * 2.0 - 1.0;\n\t\t\t\t\t\t\tvec2 scth = vec2(sin(x * PI), cos(x * PI));\n\t\t\t\t\t\t\tvec2 scphi = vec2(sqrt(1.0 - y * y), y);\n\t\t\t\t\t\t\treturn normalize( vec3(scth.y * scphi.x, scth.x * scphi.x, scphi.y) );\n\t\t\t\t\t\t}\n\t\t\t\t\t#endif\n\n\t\t\t\t\t#if USE_PACKED_NORMAL == 1\n\t\t\t\t\t\tvec3 decodeNormal(vec3 packedNormal)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tvec3 v = vec3(packedNormal.xy, 1.0 - abs(packedNormal.x) - abs(packedNormal.y));\n\t\t\t\t\t\t\tif (v.z < 0.0)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tv.xy = (1.0 - abs(v.yx)) * vec2((v.x >= 0.0) ? +1.0 : -1.0, (v.y >= 0.0) ? +1.0 : -1.0);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn normalize(v);\n\t\t\t\t\t\t}\n\t\t\t\t\t#endif\n\n\t\t\t\t\t#if USE_PACKED_NORMAL == 2\n\t\t\t\t\t\tvec3 decodeNormal(vec3 packedNormal)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tvec3 v = (packedNormal * 2.0) - 1.0;\n\t\t\t\t\t\t\treturn normalize(v);\n\t\t\t\t\t\t}\n\t\t\t\t\t#endif\n\t\t\t\t#endif","#ifdef USE_PACKED_POSITION\n\t\t\t\t\t#if USE_PACKED_POSITION == 0\n\t\t\t\t\t\tuniform mat4 quantizeMatPos;\n\t\t\t\t\t#endif\n\t\t\t\t#endif","#ifdef USE_PACKED_UV\n\t\t\t\t\t#if USE_PACKED_UV == 1\n\t\t\t\t\t\tuniform mat3 quantizeMatUV;\n\t\t\t\t\t#endif\n\t\t\t\t#endif","#ifdef USE_PACKED_UV\n\t\t\t\t\t#if USE_PACKED_UV == 0\n\t\t\t\t\t\tvec2 decodeUV(vec2 packedUV)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tvec2 uv = (packedUV * 2.0) - 1.0;\n\t\t\t\t\t\t\treturn uv;\n\t\t\t\t\t\t}\n\t\t\t\t\t#endif\n\n\t\t\t\t\t#if USE_PACKED_UV == 1\n\t\t\t\t\t\tvec2 decodeUV(vec2 packedUV)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tvec2 uv = ( vec3(packedUV, 1.0) * quantizeMatUV ).xy;\n\t\t\t\t\t\t\treturn uv;\n\t\t\t\t\t\t}\n\t\t\t\t\t#endif\n\t\t\t\t#endif","void main() {",e.ShaderChunk.uv_vertex,"#ifdef USE_UV\n\t\t\t\t\t#ifdef USE_PACKED_UV\n\t\t\t\t\t\tvUv = decodeUV(vUv);\n\t\t\t\t\t#endif\n\t\t\t\t#endif",e.ShaderChunk.uv2_vertex,e.ShaderChunk.color_vertex,e.ShaderChunk.beginnormal_vertex,"#ifdef USE_PACKED_NORMAL\n\t\t\t\t\tobjectNormal = decodeNormal(objectNormal);\n\t\t\t\t#endif\n\n\t\t\t\t#ifdef USE_TANGENT\n\t\t\t\t\tvec3 objectTangent = vec3( tangent.xyz );\n\t\t\t\t#endif\n\t\t\t\t",e.ShaderChunk.morphnormal_vertex,e.ShaderChunk.skinbase_vertex,e.ShaderChunk.skinnormal_vertex,e.ShaderChunk.defaultnormal_vertex,"#ifndef FLAT_SHADED","\tvNormal = normalize( transformedNormal );","#endif",e.ShaderChunk.begin_vertex,"#ifdef USE_PACKED_POSITION\n\t\t\t\t\t#if USE_PACKED_POSITION == 0\n\t\t\t\t\t\ttransformed = ( vec4(transformed, 1.0) * quantizeMatPos ).xyz;\n\t\t\t\t\t#endif\n\t\t\t\t#endif",e.ShaderChunk.morphtarget_vertex,e.ShaderChunk.skinning_vertex,e.ShaderChunk.displacementmap_vertex,e.ShaderChunk.project_vertex,e.ShaderChunk.logdepthbuf_vertex,e.ShaderChunk.clipping_planes_vertex,"vViewPosition = - mvPosition.xyz;",e.ShaderChunk.worldpos_vertex,e.ShaderChunk.envmap_vertex,e.ShaderChunk.shadowmap_vertex,e.ShaderChunk.fog_vertex,"}"].join("\n"),this.fragmentShader=["#define PHONG","uniform vec3 diffuse;","uniform vec3 emissive;","uniform vec3 specular;","uniform float shininess;","uniform float opacity;",e.ShaderChunk.common,e.ShaderChunk.packing,e.ShaderChunk.dithering_pars_fragment,e.ShaderChunk.color_pars_fragment,e.ShaderChunk.uv_pars_fragment,e.ShaderChunk.uv2_pars_fragment,e.ShaderChunk.map_pars_fragment,e.ShaderChunk.alphamap_pars_fragment,e.ShaderChunk.aomap_pars_fragment,e.ShaderChunk.lightmap_pars_fragment,e.ShaderChunk.emissivemap_pars_fragment,e.ShaderChunk.envmap_common_pars_fragment,e.ShaderChunk.envmap_pars_fragment,e.ShaderChunk.cube_uv_reflection_fragment,e.ShaderChunk.fog_pars_fragment,e.ShaderChunk.bsdfs,e.ShaderChunk.lights_pars_begin,e.ShaderChunk.lights_phong_pars_fragment,e.ShaderChunk.shadowmap_pars_fragment,e.ShaderChunk.bumpmap_pars_fragment,e.ShaderChunk.normalmap_pars_fragment,e.ShaderChunk.specularmap_pars_fragment,e.ShaderChunk.logdepthbuf_pars_fragment,e.ShaderChunk.clipping_planes_pars_fragment,"void main() {",e.ShaderChunk.clipping_planes_fragment,"vec4 diffuseColor = vec4( diffuse, opacity );","ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );","vec3 totalEmissiveRadiance = emissive;",e.ShaderChunk.logdepthbuf_fragment,e.ShaderChunk.map_fragment,e.ShaderChunk.color_fragment,e.ShaderChunk.alphamap_fragment,e.ShaderChunk.alphatest_fragment,e.ShaderChunk.specularmap_fragment,e.ShaderChunk.normal_fragment_begin,e.ShaderChunk.normal_fragment_maps,e.ShaderChunk.emissivemap_fragment,e.ShaderChunk.lights_phong_fragment,e.ShaderChunk.lights_fragment_begin,e.ShaderChunk.lights_fragment_maps,e.ShaderChunk.lights_fragment_end,e.ShaderChunk.aomap_fragment,"vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;",e.ShaderChunk.envmap_fragment,"gl_FragColor = vec4( outgoingLight, diffuseColor.a );",e.ShaderChunk.tonemapping_fragment,e.ShaderChunk.encodings_fragment,e.ShaderChunk.fog_fragment,e.ShaderChunk.premultiplied_alpha_fragment,e.ShaderChunk.dithering_fragment,"}"].join("\n"),this.setValues(t)}}const No={uniforms:{textureWidth:{value:1},textureHeight:{value:1},focalDepth:{value:1},focalLength:{value:24},fstop:{value:.9},tColor:{value:null},tDepth:{value:null},maxblur:{value:1},showFocus:{value:0},manualdof:{value:0},vignetting:{value:0},depthblur:{value:0},threshold:{value:.5},gain:{value:2},bias:{value:.5},fringe:{value:.7},znear:{value:.1},zfar:{value:100},noise:{value:1},dithering:{value:1e-4},pentagon:{value:0},shaderFocus:{value:1},focusCoords:{value:new e.Vector2}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["#include <common>","varying vec2 vUv;","uniform sampler2D tColor;","uniform sampler2D tDepth;","uniform float textureWidth;","uniform float textureHeight;","uniform float focalDepth; //focal distance value in meters, but you may use autofocus option below","uniform float focalLength; //focal length in mm","uniform float fstop; //f-stop value","uniform bool showFocus; //show debug focus point and focal range (red = focal point, green = focal range)","/*","make sure that these two values are the same for your camera, otherwise distances will be wrong.","*/","uniform float znear; // camera clipping start","uniform float zfar; // camera clipping end","//------------------------------------------","//user variables","const int samples = SAMPLES; //samples on the first ring","const int rings = RINGS; //ring count","const int maxringsamples = rings * samples;","uniform bool manualdof; // manual dof calculation","float ndofstart = 1.0; // near dof blur start","float ndofdist = 2.0; // near dof blur falloff distance","float fdofstart = 1.0; // far dof blur start","float fdofdist = 3.0; // far dof blur falloff distance","float CoC = 0.03; //circle of confusion size in mm (35mm film = 0.03mm)","uniform bool vignetting; // use optical lens vignetting","float vignout = 1.3; // vignetting outer border","float vignin = 0.0; // vignetting inner border","float vignfade = 22.0; // f-stops till vignete fades","uniform bool shaderFocus;","// disable if you use external focalDepth value","uniform vec2 focusCoords;","// autofocus point on screen (0.0,0.0 - left lower corner, 1.0,1.0 - upper right)","// if center of screen use vec2(0.5, 0.5);","uniform float maxblur;","//clamp value of max blur (0.0 = no blur, 1.0 default)","uniform float threshold; // highlight threshold;","uniform float gain; // highlight gain;","uniform float bias; // bokeh edge bias","uniform float fringe; // bokeh chromatic aberration / fringing","uniform bool noise; //use noise instead of pattern for sample dithering","uniform float dithering;","uniform bool depthblur; // blur the depth buffer","float dbsize = 1.25; // depth blur size","/*","next part is experimental","not looking good with small sample and ring count","looks okay starting from samples = 4, rings = 4","*/","uniform bool pentagon; //use pentagon as bokeh shape?","float feather = 0.4; //pentagon shape feather","//------------------------------------------","float penta(vec2 coords) {","\t//pentagonal shape","\tfloat scale = float(rings) - 1.3;","\tvec4 HS0 = vec4( 1.0, 0.0, 0.0, 1.0);","\tvec4 HS1 = vec4( 0.309016994, 0.951056516, 0.0, 1.0);","\tvec4 HS2 = vec4(-0.809016994, 0.587785252, 0.0, 1.0);","\tvec4 HS3 = vec4(-0.809016994,-0.587785252, 0.0, 1.0);","\tvec4 HS4 = vec4( 0.309016994,-0.951056516, 0.0, 1.0);","\tvec4 HS5 = vec4( 0.0 ,0.0 , 1.0, 1.0);","\tvec4 one = vec4( 1.0 );","\tvec4 P = vec4((coords),vec2(scale, scale));","\tvec4 dist = vec4(0.0);","\tfloat inorout = -4.0;","\tdist.x = dot( P, HS0 );","\tdist.y = dot( P, HS1 );","\tdist.z = dot( P, HS2 );","\tdist.w = dot( P, HS3 );","\tdist = smoothstep( -feather, feather, dist );","\tinorout += dot( dist, one );","\tdist.x = dot( P, HS4 );","\tdist.y = HS5.w - abs( P.z );","\tdist = smoothstep( -feather, feather, dist );","\tinorout += dist.x;","\treturn clamp( inorout, 0.0, 1.0 );","}","float bdepth(vec2 coords) {","\t// Depth buffer blur","\tfloat d = 0.0;","\tfloat kernel[9];","\tvec2 offset[9];","\tvec2 wh = vec2(1.0/textureWidth,1.0/textureHeight) * dbsize;","\toffset[0] = vec2(-wh.x,-wh.y);","\toffset[1] = vec2( 0.0, -wh.y);","\toffset[2] = vec2( wh.x -wh.y);","\toffset[3] = vec2(-wh.x, 0.0);","\toffset[4] = vec2( 0.0, 0.0);","\toffset[5] = vec2( wh.x, 0.0);","\toffset[6] = vec2(-wh.x, wh.y);","\toffset[7] = vec2( 0.0, wh.y);","\toffset[8] = vec2( wh.x, wh.y);","\tkernel[0] = 1.0/16.0; kernel[1] = 2.0/16.0; kernel[2] = 1.0/16.0;","\tkernel[3] = 2.0/16.0; kernel[4] = 4.0/16.0; kernel[5] = 2.0/16.0;","\tkernel[6] = 1.0/16.0; kernel[7] = 2.0/16.0; kernel[8] = 1.0/16.0;","\tfor( int i=0; i<9; i++ ) {","\t\tfloat tmp = texture2D(tDepth, coords + offset[i]).r;","\t\td += tmp * kernel[i];","\t}","\treturn d;","}","vec3 color(vec2 coords,float blur) {","\t//processing the sample","\tvec3 col = vec3(0.0);","\tvec2 texel = vec2(1.0/textureWidth,1.0/textureHeight);","\tcol.r = texture2D(tColor,coords + vec2(0.0,1.0)*texel*fringe*blur).r;","\tcol.g = texture2D(tColor,coords + vec2(-0.866,-0.5)*texel*fringe*blur).g;","\tcol.b = texture2D(tColor,coords + vec2(0.866,-0.5)*texel*fringe*blur).b;","\tvec3 lumcoeff = vec3(0.299,0.587,0.114);","\tfloat lum = dot(col.rgb, lumcoeff);","\tfloat thresh = max((lum-threshold)*gain, 0.0);","\treturn col+mix(vec3(0.0),col,thresh*blur);","}","vec3 debugFocus(vec3 col, float blur, float depth) {","\tfloat edge = 0.002*depth; //distance based edge smoothing","\tfloat m = clamp(smoothstep(0.0,edge,blur),0.0,1.0);","\tfloat e = clamp(smoothstep(1.0-edge,1.0,blur),0.0,1.0);","\tcol = mix(col,vec3(1.0,0.5,0.0),(1.0-m)*0.6);","\tcol = mix(col,vec3(0.0,0.5,1.0),((1.0-e)-(1.0-m))*0.2);","\treturn col;","}","float linearize(float depth) {","\treturn -zfar * znear / (depth * (zfar - znear) - zfar);","}","float vignette() {","\tfloat dist = distance(vUv.xy, vec2(0.5,0.5));","\tdist = smoothstep(vignout+(fstop/vignfade), vignin+(fstop/vignfade), dist);","\treturn clamp(dist,0.0,1.0);","}","float gather(float i, float j, int ringsamples, inout vec3 col, float w, float h, float blur) {","\tfloat rings2 = float(rings);","\tfloat step = PI*2.0 / float(ringsamples);","\tfloat pw = cos(j*step)*i;","\tfloat ph = sin(j*step)*i;","\tfloat p = 1.0;","\tif (pentagon) {","\t\tp = penta(vec2(pw,ph));","\t}","\tcol += color(vUv.xy + vec2(pw*w,ph*h), blur) * mix(1.0, i/rings2, bias) * p;","\treturn 1.0 * mix(1.0, i /rings2, bias) * p;","}","void main() {","\t//scene depth calculation","\tfloat depth = linearize(texture2D(tDepth,vUv.xy).x);","\t// Blur depth?","\tif ( depthblur ) {","\t\tdepth = linearize(bdepth(vUv.xy));","\t}","\t//focal plane calculation","\tfloat fDepth = focalDepth;","\tif (shaderFocus) {","\t\tfDepth = linearize(texture2D(tDepth,focusCoords).x);","\t}","\t// dof blur factor calculation","\tfloat blur = 0.0;","\tif (manualdof) {","\t\tfloat a = depth-fDepth; // Focal plane","\t\tfloat b = (a-fdofstart)/fdofdist; // Far DoF","\t\tfloat c = (-a-ndofstart)/ndofdist; // Near Dof","\t\tblur = (a>0.0) ? b : c;","\t} else {","\t\tfloat f = focalLength; // focal length in mm","\t\tfloat d = fDepth*1000.0; // focal plane in mm","\t\tfloat o = depth*1000.0; // depth in mm","\t\tfloat a = (o*f)/(o-f);","\t\tfloat b = (d*f)/(d-f);","\t\tfloat c = (d-f)/(d*fstop*CoC);","\t\tblur = abs(a-b)*c;","\t}","\tblur = clamp(blur,0.0,1.0);","\t// calculation of pattern for dithering","\tvec2 noise = vec2(rand(vUv.xy), rand( vUv.xy + vec2( 0.4, 0.6 ) ) )*dithering*blur;","\t// getting blur x and y step factor","\tfloat w = (1.0/textureWidth)*blur*maxblur+noise.x;","\tfloat h = (1.0/textureHeight)*blur*maxblur+noise.y;","\t// calculation of final color","\tvec3 col = vec3(0.0);","\tif(blur < 0.05) {","\t\t//some optimization thingy","\t\tcol = texture2D(tColor, vUv.xy).rgb;","\t} else {","\t\tcol = texture2D(tColor, vUv.xy).rgb;","\t\tfloat s = 1.0;","\t\tint ringsamples;","\t\tfor (int i = 1; i <= rings; i++) {","\t\t\t/*unboxstart*/","\t\t\tringsamples = i * samples;","\t\t\tfor (int j = 0 ; j < maxringsamples ; j++) {","\t\t\t\tif (j >= ringsamples) break;","\t\t\t\ts += gather(float(i), float(j), ringsamples, col, w, h, blur);","\t\t\t}","\t\t\t/*unboxend*/","\t\t}","\t\tcol /= s; //divide by sample count","\t}","\tif (showFocus) {","\t\tcol = debugFocus(col, blur, depth);","\t}","\tif (vignetting) {","\t\tcol *= vignette();","\t}","\tgl_FragColor.rgb = col;","\tgl_FragColor.a = 1.0;","} "].join("\n")},Do={uniforms:{mNear:{value:1},mFar:{value:1e3}},vertexShader:["varying float vViewZDepth;","void main() {","\t#include <begin_vertex>","\t#include <project_vertex>","\tvViewZDepth = - mvPosition.z;","}"].join("\n"),fragmentShader:["uniform float mNear;","uniform float mFar;","varying float vViewZDepth;","void main() {","\tfloat color = 1.0 - smoothstep( mNear, mFar, vViewZDepth );","\tgl_FragColor = vec4( vec3( color ), 1.0 );","} "].join("\n")};class Io extends e.PerspectiveCamera{constructor(t,r,i,n){super(t,r,i,n),this.type="CinematicCamera",this.postprocessing={enabled:!0},this.shaderSettings={rings:3,samples:4};const s=Do;this.materialDepth=new e.ShaderMaterial({uniforms:s.uniforms,vertexShader:s.vertexShader,fragmentShader:s.fragmentShader}),this.materialDepth.uniforms.mNear.value=i,this.materialDepth.uniforms.mFar.value=n,this.setLens(),this.initPostProcessing()}setLens(e,t,r,i){void 0===e&&(e=35),void 0!==t&&(this.filmGauge=t),this.setFocalLength(e),void 0===r&&(r=8),void 0===i&&(i=.019),this.fNumber=r,this.coc=i,this.aperture=e/this.fNumber,this.hyperFocal=e*e/(this.aperture*this.coc)}linearize(e){const t=this.far,r=this.near;return-t*r/(e*(t-r)-t)}smoothstep(e,t,r){const i=this.saturate((r-e)/(t-e));return i*i*(3-2*i)}saturate(e){return Math.max(0,Math.min(1,e))}focusAt(e){void 0===e&&(e=20);const t=this.getFocalLength();this.focus=e,this.nearPoint=this.hyperFocal*this.focus/(this.hyperFocal+(this.focus-t)),this.farPoint=this.hyperFocal*this.focus/(this.hyperFocal-(this.focus-t)),this.depthOfField=this.farPoint-this.nearPoint,this.depthOfField<0&&(this.depthOfField=0),this.sdistance=this.smoothstep(this.near,this.far,this.focus),this.ldistance=this.linearize(1-this.sdistance),this.postprocessing.bokeh_uniforms.focalDepth.value=this.ldistance}initPostProcessing(){if(this.postprocessing.enabled){this.postprocessing.scene=new e.Scene,this.postprocessing.camera=new e.OrthographicCamera(window.innerWidth/-2,window.innerWidth/2,window.innerHeight/2,window.innerHeight/-2,-1e4,1e4),this.postprocessing.scene.add(this.postprocessing.camera),this.postprocessing.rtTextureDepth=new e.WebGLRenderTarget(window.innerWidth,window.innerHeight),this.postprocessing.rtTextureColor=new e.WebGLRenderTarget(window.innerWidth,window.innerHeight);const t=No;this.postprocessing.bokeh_uniforms=e.UniformsUtils.clone(t.uniforms),this.postprocessing.bokeh_uniforms.tColor.value=this.postprocessing.rtTextureColor.texture,this.postprocessing.bokeh_uniforms.tDepth.value=this.postprocessing.rtTextureDepth.texture,this.postprocessing.bokeh_uniforms.manualdof.value=0,this.postprocessing.bokeh_uniforms.shaderFocus.value=0,this.postprocessing.bokeh_uniforms.fstop.value=2.8,this.postprocessing.bokeh_uniforms.showFocus.value=1,this.postprocessing.bokeh_uniforms.focalDepth.value=.1,this.postprocessing.bokeh_uniforms.znear.value=this.near,this.postprocessing.bokeh_uniforms.zfar.value=this.near,this.postprocessing.bokeh_uniforms.textureWidth.value=window.innerWidth,this.postprocessing.bokeh_uniforms.textureHeight.value=window.innerHeight,this.postprocessing.materialBokeh=new e.ShaderMaterial({uniforms:this.postprocessing.bokeh_uniforms,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader,defines:{RINGS:this.shaderSettings.rings,SAMPLES:this.shaderSettings.samples,DEPTH_PACKING:1}}),this.postprocessing.quad=new e.Mesh(new e.PlaneGeometry(window.innerWidth,window.innerHeight),this.postprocessing.materialBokeh),this.postprocessing.quad.position.z=-500,this.postprocessing.scene.add(this.postprocessing.quad)}}renderCinematic(e,t){if(this.postprocessing.enabled){const r=t.getRenderTarget();t.clear(),e.overrideMaterial=null,t.setRenderTarget(this.postprocessing.rtTextureColor),t.clear(),t.render(e,this),e.overrideMaterial=this.materialDepth,t.setRenderTarget(this.postprocessing.rtTextureDepth),t.clear(),t.render(e,this),t.setRenderTarget(null),t.render(this.postprocessing.scene,this.postprocessing.camera),t.setRenderTarget(r)}}}var Uo=function(){var t=new e.Triangle,r=new e.Vector3;function i(e){var t=e.geometry;if(!t.isBufferGeometry||3!==t.attributes.position.itemSize)throw new Error("THREE.MeshSurfaceSampler: Requires BufferGeometry triangle mesh.");t.index&&(console.warn("THREE.MeshSurfaceSampler: Converting geometry to non-indexed BufferGeometry."),t=t.toNonIndexed()),this.geometry=t,this.randomFunction=Math.random,this.positionAttribute=this.geometry.getAttribute("position"),this.colorAttribute=this.geometry.getAttribute("color"),this.weightAttribute=null,this.distribution=null}return i.prototype={constructor:i,setWeightAttribute:function(e){return this.weightAttribute=e?this.geometry.getAttribute(e):null,this},build:function(){var e=this.positionAttribute,r=this.weightAttribute,i=new Float32Array(e.count/3);for(let s=0;s<e.count;s+=3){var n=1;r&&(n=r.getX(s)+r.getX(s+1)+r.getX(s+2)),t.a.fromBufferAttribute(e,s),t.b.fromBufferAttribute(e,s+1),t.c.fromBufferAttribute(e,s+2),n*=t.getArea(),i[s/3]=n}this.distribution=new Float32Array(e.count/3);var s=0;for(let e=0;e<i.length;e++)s+=i[e],this.distribution[e]=s;return this},setRandomGenerator:function(e){return this.randomFunction=e,this},sample:function(e,t,r){var i=this.distribution[this.distribution.length-1],n=this.binarySearch(this.randomFunction()*i);return this.sampleFace(n,e,t,r)},binarySearch:function(e){for(var t=this.distribution,r=0,i=t.length-1,n=-1;r<=i;){var s=Math.ceil((r+i)/2);if(0===s||t[s-1]<=e&&t[s]>e){n=s;break}e<t[s]?i=s-1:r=s+1}return n},sampleFace:function(e,i,n,s){var o=this.randomFunction(),a=this.randomFunction();return o+a>1&&(o=1-o,a=1-a),t.a.fromBufferAttribute(this.positionAttribute,3*e),t.b.fromBufferAttribute(this.positionAttribute,3*e+1),t.c.fromBufferAttribute(this.positionAttribute,3*e+2),i.set(0,0,0).addScaledVector(t.a,o).addScaledVector(t.b,a).addScaledVector(t.c,1-(o+a)),void 0!==n&&t.getNormal(n),void 0!==s&&void 0!==this.colorAttribute&&(t.a.fromBufferAttribute(this.colorAttribute,3*e),t.b.fromBufferAttribute(this.colorAttribute,3*e+1),t.c.fromBufferAttribute(this.colorAttribute,3*e+2),r.set(0,0,0).addScaledVector(t.a,o).addScaledVector(t.b,a).addScaledVector(t.c,1-(o+a)),s.r=r.x,s.g=r.y,s.b=r.z),this}},i}(),Oo={c:null,u:[new e.Vector3,new e.Vector3,new e.Vector3],e:[]},ko={c:null,u:[new e.Vector3,new e.Vector3,new e.Vector3],e:[]},Vo=[[],[],[]],Go=[[],[],[]],zo=[],Ho=new e.Vector3,jo=new e.Vector3,Wo=new e.Vector3,Xo=new e.Vector3,Qo=new e.Vector3,Yo=new e.Vector3,Ko=new e.Matrix3,qo=new e.Box3,Jo=new e.Matrix4,Zo=new e.Matrix4,$o=new e.Ray;function ea(t=new e.Vector3,r=new e.Vector3,i=new e.Matrix3){this.center=t,this.halfSize=r,this.rotation=i}Object.assign(ea.prototype,{set:function(e,t,r){return this.center=e,this.halfSize=t,this.rotation=r,this},copy:function(e){return this.center.copy(e.center),this.halfSize.copy(e.halfSize),this.rotation.copy(e.rotation),this},clone:function(){return(new this.constructor).copy(this)},getSize:function(e){return e.copy(this.halfSize).multiplyScalar(2)},clampPoint:function(t,r){var i=this.halfSize;Xo.subVectors(t,this.center),this.rotation.extractBasis(Ho,jo,Wo),r.copy(this.center);var n=e.MathUtils.clamp(Xo.dot(Ho),-i.x,i.x);r.add(Ho.multiplyScalar(n));var s=e.MathUtils.clamp(Xo.dot(jo),-i.y,i.y);r.add(jo.multiplyScalar(s));var o=e.MathUtils.clamp(Xo.dot(Wo),-i.z,i.z);return r.add(Wo.multiplyScalar(o)),r},containsPoint:function(e){return Xo.subVectors(e,this.center),this.rotation.extractBasis(Ho,jo,Wo),Math.abs(Xo.dot(Ho))<=this.halfSize.x&&Math.abs(Xo.dot(jo))<=this.halfSize.y&&Math.abs(Xo.dot(Wo))<=this.halfSize.z},intersectsBox3:function(e){return this.intersectsOBB(ra.fromBox3(e))},intersectsSphere:function(e){return this.clampPoint(e.center,Yo),Yo.distanceToSquared(e.center)<=e.radius*e.radius},intersectsOBB:function(e,t=Number.EPSILON){Oo.c=this.center,Oo.e[0]=this.halfSize.x,Oo.e[1]=this.halfSize.y,Oo.e[2]=this.halfSize.z,this.rotation.extractBasis(Oo.u[0],Oo.u[1],Oo.u[2]),ko.c=e.center,ko.e[0]=e.halfSize.x,ko.e[1]=e.halfSize.y,ko.e[2]=e.halfSize.z,e.rotation.extractBasis(ko.u[0],ko.u[1],ko.u[2]);for(let e=0;e<3;e++)for(let t=0;t<3;t++)Vo[e][t]=Oo.u[e].dot(ko.u[t]);Xo.subVectors(ko.c,Oo.c),zo[0]=Xo.dot(Oo.u[0]),zo[1]=Xo.dot(Oo.u[1]),zo[2]=Xo.dot(Oo.u[2]);for(let e=0;e<3;e++)for(let r=0;r<3;r++)Go[e][r]=Math.abs(Vo[e][r])+t;var r,i;for(let e=0;e<3;e++)if(r=Oo.e[e],i=ko.e[0]*Go[e][0]+ko.e[1]*Go[e][1]+ko.e[2]*Go[e][2],Math.abs(zo[e])>r+i)return!1;for(let e=0;e<3;e++)if(r=Oo.e[0]*Go[0][e]+Oo.e[1]*Go[1][e]+Oo.e[2]*Go[2][e],i=ko.e[e],Math.abs(zo[0]*Vo[0][e]+zo[1]*Vo[1][e]+zo[2]*Vo[2][e])>r+i)return!1;return r=Oo.e[1]*Go[2][0]+Oo.e[2]*Go[1][0],i=ko.e[1]*Go[0][2]+ko.e[2]*Go[0][1],!(Math.abs(zo[2]*Vo[1][0]-zo[1]*Vo[2][0])>r+i)&&(r=Oo.e[1]*Go[2][1]+Oo.e[2]*Go[1][1],i=ko.e[0]*Go[0][2]+ko.e[2]*Go[0][0],!(Math.abs(zo[2]*Vo[1][1]-zo[1]*Vo[2][1])>r+i)&&(r=Oo.e[1]*Go[2][2]+Oo.e[2]*Go[1][2],i=ko.e[0]*Go[0][1]+ko.e[1]*Go[0][0],!(Math.abs(zo[2]*Vo[1][2]-zo[1]*Vo[2][2])>r+i)&&(r=Oo.e[0]*Go[2][0]+Oo.e[2]*Go[0][0],i=ko.e[1]*Go[1][2]+ko.e[2]*Go[1][1],!(Math.abs(zo[0]*Vo[2][0]-zo[2]*Vo[0][0])>r+i)&&(r=Oo.e[0]*Go[2][1]+Oo.e[2]*Go[0][1],i=ko.e[0]*Go[1][2]+ko.e[2]*Go[1][0],!(Math.abs(zo[0]*Vo[2][1]-zo[2]*Vo[0][1])>r+i)&&(r=Oo.e[0]*Go[2][2]+Oo.e[2]*Go[0][2],i=ko.e[0]*Go[1][1]+ko.e[1]*Go[1][0],!(Math.abs(zo[0]*Vo[2][2]-zo[2]*Vo[0][2])>r+i)&&(r=Oo.e[0]*Go[1][0]+Oo.e[1]*Go[0][0],i=ko.e[1]*Go[2][2]+ko.e[2]*Go[2][1],!(Math.abs(zo[1]*Vo[0][0]-zo[0]*Vo[1][0])>r+i)&&(r=Oo.e[0]*Go[1][1]+Oo.e[1]*Go[0][1],i=ko.e[0]*Go[2][2]+ko.e[2]*Go[2][0],!(Math.abs(zo[1]*Vo[0][1]-zo[0]*Vo[1][1])>r+i)&&(r=Oo.e[0]*Go[1][2]+Oo.e[1]*Go[0][2],i=ko.e[0]*Go[2][1]+ko.e[1]*Go[2][0],!(Math.abs(zo[1]*Vo[0][2]-zo[0]*Vo[1][2])>r+i)))))))))},intersectsPlane:function(e){this.rotation.extractBasis(Ho,jo,Wo);const t=this.halfSize.x*Math.abs(e.normal.dot(Ho))+this.halfSize.y*Math.abs(e.normal.dot(jo))+this.halfSize.z*Math.abs(e.normal.dot(Wo)),r=e.normal.dot(this.center)-e.constant;return Math.abs(r)<=t},intersectRay:function(e,t){var r,i,n,s;return this.getSize(Qo),qo.setFromCenterAndSize(Xo.set(0,0,0),Qo),r=Jo,i=this.rotation,n=r.elements,s=i.elements,n[0]=s[0],n[1]=s[1],n[2]=s[2],n[3]=0,n[4]=s[3],n[5]=s[4],n[6]=s[5],n[7]=0,n[8]=s[6],n[9]=s[7],n[10]=s[8],n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,Jo.setPosition(this.center),Zo.copy(Jo).invert(),$o.copy(e).applyMatrix4(Zo),$o.intersectBox(qo,t)?t.applyMatrix4(Jo):null},intersectsRay:function(e){return null!==this.intersectRay(e,Xo)},fromBox3:function(e){return e.getCenter(this.center),e.getSize(this.halfSize).multiplyScalar(.5),this.rotation.identity(),this},equals:function(e){return e.center.equals(this.center)&&e.halfSize.equals(this.halfSize)&&e.rotation.equals(this.rotation)},applyMatrix4:function(e){var t=e.elements,r=Xo.set(t[0],t[1],t[2]).length(),i=Xo.set(t[4],t[5],t[6]).length(),n=Xo.set(t[8],t[9],t[10]).length();e.determinant()<0&&(r=-r),Ko.setFromMatrix4(e);var s=1/r,o=1/i,a=1/n;return Ko.elements[0]*=s,Ko.elements[1]*=s,Ko.elements[2]*=s,Ko.elements[3]*=o,Ko.elements[4]*=o,Ko.elements[5]*=o,Ko.elements[6]*=a,Ko.elements[7]*=a,Ko.elements[8]*=a,this.rotation.multiply(Ko),this.halfSize.x*=r,this.halfSize.y*=i,this.halfSize.z*=n,Xo.setFromMatrixPosition(e),this.center.add(Xo),this}});var ta,ra=new ea,ia=function(){var t=new e.Vector3,r=new e.Vector3,i=new e.Vector3;function n(t,r,i){this.start=null==t?new e.Vector3(0,0,0):t,this.end=null==r?new e.Vector3(0,1,0):r,this.radius=null==i?1:i}return Object.assign(n.prototype,{clone:function(){return new n(this.start.clone(),this.end.clone(),this.radius)},set:function(e,t,r){this.start.copy(e),this.end.copy(t),this.radius=r},copy:function(e){this.start.copy(e.start),this.end.copy(e.end),this.radius=e.radius},getCenter:function(e){return e.copy(this.end).add(this.start).multiplyScalar(.5)},translate:function(e){this.start.add(e),this.end.add(e)},checkAABBAxis:function(e,t,r,i,n,s,o,a,l){return(n-e<l||n-r<l)&&(e-s<l||r-s<l)&&(o-t<l||o-i<l)&&(t-a<l||i-a<l)},intersectsBox:function(e){return this.checkAABBAxis(this.start.x,this.start.y,this.end.x,this.end.y,e.min.x,e.max.x,e.min.y,e.max.y,this.radius)&&this.checkAABBAxis(this.start.x,this.start.z,this.end.x,this.end.z,e.min.x,e.max.x,e.min.z,e.max.z,this.radius)&&this.checkAABBAxis(this.start.y,this.start.z,this.end.y,this.end.z,e.min.y,e.max.y,e.min.z,e.max.z,this.radius)},lineLineMinimumPoints:function(e,n){var s,o,a=t.copy(e.end).sub(e.start),l=r.copy(n.end).sub(n.start),c=i.copy(n.start).sub(e.start),h=a.dot(l),u=a.dot(a),d=l.dot(l),p=l.dot(c),m=a.dot(c),f=u*d-h*h;if(Math.abs(f)<1e-10){var g=-p/d,v=(h-p)/d;Math.abs(g-.5)<Math.abs(v-.5)?(s=0,o=g):(s=1,o=v)}else o=((s=(p*h+m*d)/f)*h-p)/d;return o=Math.max(0,Math.min(1,o)),s=Math.max(0,Math.min(1,s)),[a.multiplyScalar(s).add(e.start),l.multiplyScalar(o).add(n.start)]}}),n}(),na={setHSV:function(t,r,i,n){return r=e.MathUtils.euclideanModulo(r,1),i=e.MathUtils.clamp(i,0,1),n=e.MathUtils.clamp(n,0,1),t.setHSL(r,i*n/((r=(2-i)*n)<1?r:2-r),.5*r)},getHSV:(ta={},function(e,t){return void 0===t&&(console.warn("THREE.ColorConverter: .getHSV() target is now required"),t={h:0,s:0,l:0}),e.getHSL(ta),ta.s*=ta.l<.5?ta.l:1-ta.l,t.h=ta.h,t.s=2*ta.s/(ta.l+ta.s),t.v=ta.l+ta.s,t}),setCMYK:function(e,t,r,i,n){var s=(1-t)*(1-n),o=(1-r)*(1-n),a=(1-i)*(1-n);return e.setRGB(s,o,a)},getCMYK:function(e,t){void 0===t&&(console.warn("THREE.ColorConverter: .getCMYK() target is now required"),t={c:0,m:0,y:0,k:0});var r=e.r,i=e.g,n=e.b,s=1-Math.max(r,i,n),o=(1-r-s)/(1-s),a=(1-i-s)/(1-s),l=(1-n-s)/(1-s);return t.c=o,t.m=a,t.y=l,t.k=s,t}},sa=function(){var t=new e.Vector3,r=new e.Vector3,i=new e.Plane,n=new e.Line3,s=new e.Line3,o=new e.Sphere,a=new ia;function l(e){this.triangles=[],this.box=e,this.subTrees=[]}return Object.assign(l.prototype,{addTriangle:function(t){return this.bounds||(this.bounds=new e.Box3),this.bounds.min.x=Math.min(this.bounds.min.x,t.a.x,t.b.x,t.c.x),this.bounds.min.y=Math.min(this.bounds.min.y,t.a.y,t.b.y,t.c.y),this.bounds.min.z=Math.min(this.bounds.min.z,t.a.z,t.b.z,t.c.z),this.bounds.max.x=Math.max(this.bounds.max.x,t.a.x,t.b.x,t.c.x),this.bounds.max.y=Math.max(this.bounds.max.y,t.a.y,t.b.y,t.c.y),this.bounds.max.z=Math.max(this.bounds.max.z,t.a.z,t.b.z,t.c.z),this.triangles.push(t),this},calcBox:function(){return this.box=this.bounds.clone(),this.box.min.x-=.01,this.box.min.y-=.01,this.box.min.z-=.01,this},split:function(i){if(this.box){var n,s,o,a=[],c=r.copy(this.box.max).sub(this.box.min).multiplyScalar(.5);for(let r=0;r<2;r++)for(let i=0;i<2;i++)for(let o=0;o<2;o++)n=new e.Box3,s=t.set(r,i,o),n.min.copy(this.box.min).add(s.multiply(c)),n.max.copy(n.min).add(c),a.push(new l(n));for(;o=this.triangles.pop();)for(let e=0;e<a.length;e++)a[e].box.intersectsTriangle(o)&&a[e].triangles.push(o);for(let e=0;e<a.length;e++){var h=a[e].triangles.length;h>8&&i<16&&a[e].split(i+1),0!=h&&this.subTrees.push(a[e])}return this}},build:function(){return this.calcBox(),this.split(0),this},getRayTriangles:function(e,t){for(let i=0;i<this.subTrees.length;i++){var r=this.subTrees[i];if(e.intersectsBox(r.box))if(r.triangles.length>0)for(let e=0;e<r.triangles.length;e++)-1===t.indexOf(r.triangles[e])&&t.push(r.triangles[e]);else r.getRayTriangles(e,t)}return t},triangleCapsuleIntersect:function(e,r){var o,a,l,c;r.getPlane(i);var h=i.distanceToPoint(e.start)-e.radius,u=i.distanceToPoint(e.end)-e.radius;if(h>0&&u>0||h<-e.radius&&u<-e.radius)return!1;var d=Math.abs(h/(Math.abs(h)+Math.abs(u))),p=t.copy(e.start).lerp(e.end,d);if(r.containsPoint(p))return{normal:i.normal.clone(),point:p.clone(),depth:Math.abs(Math.min(h,u))};var m=e.radius*e.radius;l=n.set(e.start,e.end);var f=[[r.a,r.b],[r.b,r.c],[r.c,r.a]];for(let t=0;t<f.length;t++)if(c=s.set(f[t][0],f[t][1]),[o,a]=e.lineLineMinimumPoints(l,c),o.distanceToSquared(a)<m)return{normal:o.clone().sub(a).normalize(),point:a.clone(),depth:e.radius-o.distanceTo(a)};return!1},triangleSphereIntersect:function(e,s){if(s.getPlane(i),!e.intersectsPlane(i))return!1;var o=Math.abs(i.distanceToSphere(e)),a=e.radius*e.radius-o*o,l=i.projectPoint(e.center,t);if(s.containsPoint(e.center))return{normal:i.normal.clone(),point:l.clone(),depth:Math.abs(i.distanceToSphere(e))};var c=[[s.a,s.b],[s.b,s.c],[s.c,s.a]];for(let t=0;t<c.length;t++){n.set(c[t][0],c[t][1]),n.closestPointToPoint(l,!0,r);var h=r.distanceToSquared(e.center);if(h<a)return{normal:e.center.clone().sub(r).normalize(),point:r.clone(),depth:e.radius-Math.sqrt(h)}}return!1},getSphereTriangles:function(e,t){for(let i=0;i<this.subTrees.length;i++){var r=this.subTrees[i];if(e.intersectsBox(r.box))if(r.triangles.length>0)for(let e=0;e<r.triangles.length;e++)-1===t.indexOf(r.triangles[e])&&t.push(r.triangles[e]);else r.getSphereTriangles(e,t)}},getCapsuleTriangles:function(e,t){for(let i=0;i<this.subTrees.length;i++){var r=this.subTrees[i];if(e.intersectsBox(r.box))if(r.triangles.length>0)for(let e=0;e<r.triangles.length;e++)-1===t.indexOf(r.triangles[e])&&t.push(r.triangles[e]);else r.getCapsuleTriangles(e,t)}},sphereIntersect(e){o.copy(e);var t,r=[],i=!1;this.getSphereTriangles(e,r);for(let e=0;e<r.length;e++)(t=this.triangleSphereIntersect(o,r[e]))&&(i=!0,o.center.add(t.normal.multiplyScalar(t.depth)));if(i){var n=o.center.clone().sub(e.center),s=n.length();return{normal:n.normalize(),depth:s}}return!1},capsuleIntersect:function(r){a.copy(r);var i,n=[],s=!1;this.getCapsuleTriangles(a,n);for(let e=0;e<n.length;e++)(i=this.triangleCapsuleIntersect(a,n[e]))&&(s=!0,a.translate(i.normal.multiplyScalar(i.depth)));if(s){var o=a.getCenter(new e.Vector3).sub(r.getCenter(t)),l=o.length();return{normal:o.normalize(),depth:l}}return!1},rayIntersect:function(e){if(0!==e.direction.length()){var r,i,n,s=[],o=1e100;this.getRayTriangles(e,s);for(let l=0;l<s.length;l++)if(n=e.intersectTriangle(s[l].a,s[l].b,s[l].c,!0,t)){var a=n.sub(e.origin).length();o>a&&(i=n.clone().add(e.origin),o=a,r=s[l])}return o<1e100&&{distance:o,triangle:r,position:i}}},fromGraphNode:function(t){return t.traverse((t=>{if("Mesh"===t.type){t.updateMatrix(),t.updateWorldMatrix();var r,i=!1;t.geometry.index?(i=!0,r=t.geometry.clone().toNonIndexed()):r=t.geometry;var n=r.attributes.position.array,s=t.matrixWorld;for(let t=0;t<n.length;t+=9){var o=new e.Vector3(n[t],n[t+1],n[t+2]),a=new e.Vector3(n[t+3],n[t+4],n[t+5]),l=new e.Vector3(n[t+6],n[t+7],n[t+8]);o.applyMatrix4(s),a.applyMatrix4(s),l.applyMatrix4(s),this.addTriangle(new e.Triangle(o,a,l))}i&&r.dispose()}})),this.build(),this}}),l}(),oa=function(e,t){return this.lut=[],this.setColorMap(e,t),this};oa.prototype={constructor:oa,lut:[],map:[],n:256,minV:0,maxV:1,set:function(e){return e instanceof oa&&this.copy(e),this},setMin:function(e){return this.minV=e,this},setMax:function(e){return this.maxV=e,this},setColorMap:function(t,r){this.map=aa[t]||aa.rainbow,this.n=r||32;var i=1/this.n;this.lut.length=0;for(let t=0;t<=1;t+=i)for(let r=0;r<this.map.length-1;r++)if(t>=this.map[r][0]&&t<this.map[r+1][0]){var n=this.map[r][0],s=this.map[r+1][0],o=new e.Color(this.map[r][1]),a=new e.Color(this.map[r+1][1]),l=o.lerp(a,(t-n)/(s-n));this.lut.push(l)}return this},copy:function(e){return this.lut=e.lut,this.map=e.map,this.n=e.n,this.minV=e.minV,this.maxV=e.maxV,this},getColor:function(e){e<=this.minV?e=this.minV:e>=this.maxV&&(e=this.maxV),e=(e-this.minV)/(this.maxV-this.minV);var t=Math.round(e*this.n);return t==this.n&&(t-=1),this.lut[t]},addColorMap:function(e,t){aa[e]=t},createCanvas:function(){var e=document.createElement("canvas");return e.width=1,e.height=this.n,this.updateCanvas(e),e},updateCanvas:function(t){var r=t.getContext("2d",{alpha:!1}),i=r.getImageData(0,0,1,this.n),n=i.data,s=0,o=1/this.n;for(let t=1;t>=0;t-=o)for(let r=this.map.length-1;r>=0;r--)if(t<this.map[r][0]&&t>=this.map[r-1][0]){var a=this.map[r-1][0],l=this.map[r][0],c=new e.Color(this.map[r-1][1]),h=new e.Color(this.map[r][1]),u=c.lerp(h,(t-a)/(l-a));n[4*s]=Math.round(255*u.r),n[4*s+1]=Math.round(255*u.g),n[4*s+2]=Math.round(255*u.b),n[4*s+3]=255,s+=1}return r.putImageData(i,0,0),t}};var aa={rainbow:[[0,255],[.2,65535],[.5,65280],[.8,16776960],[1,16711680]],cooltowarm:[[0,3952322],[.2,10206463],[.5,14474460],[.8,16163717],[1,11797542]],blackbody:[[0,0],[.2,7864320],[.5,15086080],[.8,16776960],[1,16777215]],grayscale:[[0,0],[.2,4210752],[.5,8355712],[.8,12566463],[1,16777215]]};exports.STATE=void 0,function(e){e[e.NONE=-1]="NONE",e[e.ROTATE=0]="ROTATE",e[e.DOLLY=1]="DOLLY",e[e.PAN=2]="PAN",e[e.TOUCH_ROTATE=3]="TOUCH_ROTATE",e[e.TOUCH_PAN=4]="TOUCH_PAN",e[e.TOUCH_DOLLY_PAN=5]="TOUCH_DOLLY_PAN",e[e.TOUCH_DOLLY_ROTATE=6]="TOUCH_DOLLY_ROTATE"}(exports.STATE||(exports.STATE={}));class la extends e.EventDispatcher{constructor(t,r){super(),p.default(this,"object",void 0),p.default(this,"domElement",void 0),p.default(this,"enabled",!0),p.default(this,"target",new e.Vector3),p.default(this,"trackball",!1),p.default(this,"minDistance",0),p.default(this,"maxDistance",1/0),p.default(this,"minZoom",0),p.default(this,"maxZoom",1/0),p.default(this,"minPolarAngle",0),p.default(this,"maxPolarAngle",Math.PI),p.default(this,"minAzimuthAngle",-1/0),p.default(this,"maxAzimuthAngle",1/0),p.default(this,"enableDamping",!1),p.default(this,"dampingFactor",.05),p.default(this,"enableZoom",!0),p.default(this,"zoomSpeed",1),p.default(this,"enableRotate",!0),p.default(this,"rotateSpeed",1),p.default(this,"enablePan",!0),p.default(this,"panSpeed",1),p.default(this,"screenSpacePanning",!1),p.default(this,"keyPanSpeed",7),p.default(this,"autoRotate",!1),p.default(this,"autoRotateSpeed",2),p.default(this,"enableKeys",!0),p.default(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),p.default(this,"mouseButtons",void 0),p.default(this,"touches",{ONE:e.TOUCH.ROTATE,TWO:e.TOUCH.DOLLY_PAN}),p.default(this,"target0",void 0),p.default(this,"position0",void 0),p.default(this,"quaternion0",void 0),p.default(this,"zoom0",void 0),p.default(this,"spherical",new e.Spherical),p.default(this,"sphericalDelta",new e.Spherical),p.default(this,"changeEvent",{type:"change"}),p.default(this,"startEvent",{type:"start"}),p.default(this,"endEvent",{type:"end"}),p.default(this,"state",exports.STATE.NONE),p.default(this,"EPS",1e-6),p.default(this,"scale",1),p.default(this,"panOffset",new e.Vector3),p.default(this,"zoomChanged",!1),p.default(this,"rotateStart",new e.Vector2),p.default(this,"rotateEnd",new e.Vector2),p.default(this,"rotateDelta",new e.Vector2),p.default(this,"panStart",new e.Vector2),p.default(this,"panEnd",new e.Vector2),p.default(this,"panDelta",new e.Vector2),p.default(this,"dollyStart",new e.Vector2),p.default(this,"dollyEnd",new e.Vector2),p.default(this,"dollyDelta",new e.Vector2),p.default(this,"offset",new e.Vector3),p.default(this,"lastPosition",new e.Vector3),p.default(this,"lastQuaternion",new e.Quaternion),p.default(this,"q",new e.Quaternion),p.default(this,"v",new e.Vector3),p.default(this,"vec",new e.Vector3),p.default(this,"quat",void 0),p.default(this,"quatInverse",void 0),p.default(this,"getPolarAngle",(()=>this.spherical.phi)),p.default(this,"getAzimuthalAngle",(()=>this.spherical.theta)),p.default(this,"saveState",(()=>{this.target0.copy(this.target),this.position0.copy(this.object.position),this.quaternion0.copy(this.object.quaternion),this.zoom0=this.object.zoom})),p.default(this,"reset",(()=>{this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.quaternion.copy(this.quaternion0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(this.changeEvent),this.update(),this.state=exports.STATE.NONE})),p.default(this,"dispose",(()=>{this.domElement.removeEventListener("contextmenu",this.onContextMenu,!1),this.domElement.removeEventListener("mousedown",this.onMouseDown,!1),this.domElement.removeEventListener("wheel",this.onMouseWheel,!1),this.domElement.removeEventListener("touchstart",this.onTouchStart,!1),this.domElement.removeEventListener("touchend",this.onTouchEnd,!1),this.domElement.removeEventListener("touchmove",this.onTouchMove,!1),document.removeEventListener("mousemove",this.onMouseMove,!1),document.removeEventListener("mouseup",this.onMouseUp,!1),this.domElement.removeEventListener("keydown",this.onKeyDown,!1)})),p.default(this,"update",(()=>{const e=this.object.position;if(this.offset.copy(e).sub(this.target),this.trackball){if(this.sphericalDelta.theta){this.vec.set(0,1,0).applyQuaternion(this.object.quaternion);const e=this.enableDamping?this.dampingFactor:1;this.q.setFromAxisAngle(this.vec,this.sphericalDelta.theta*e),this.object.quaternion.premultiply(this.q),this.offset.applyQuaternion(this.q)}if(this.sphericalDelta.phi){this.vec.set(1,0,0).applyQuaternion(this.object.quaternion);const e=this.enableDamping?this.dampingFactor:1;this.q.setFromAxisAngle(this.vec,this.sphericalDelta.phi*e),this.object.quaternion.premultiply(this.q),this.offset.applyQuaternion(this.q)}this.offset.multiplyScalar(this.scale),this.offset.clampLength(this.minDistance,this.maxDistance)}else this.offset.applyQuaternion(this.quat),this.autoRotate&&this.state===exports.STATE.NONE&&this.rotateLeft(this.getAutoRotationAngle()),this.spherical.setFromVector3(this.offset),this.enableDamping?(this.spherical.theta+=this.sphericalDelta.theta*this.dampingFactor,this.spherical.phi+=this.sphericalDelta.phi*this.dampingFactor):(this.spherical.theta+=this.sphericalDelta.theta,this.spherical.phi+=this.sphericalDelta.phi),this.spherical.theta=Math.max(this.minAzimuthAngle,Math.min(this.maxAzimuthAngle,this.spherical.theta)),this.spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this.spherical.phi)),this.spherical.makeSafe(),this.spherical.radius*=this.scale,this.spherical.radius=Math.max(this.minDistance,Math.min(this.maxDistance,this.spherical.radius)),this.offset.setFromSpherical(this.spherical),this.offset.applyQuaternion(this.quatInverse);return!0===this.enableDamping?this.target.addScaledVector(this.panOffset,this.dampingFactor):this.target.add(this.panOffset),e.copy(this.target).add(this.offset),!1===this.trackball&&this.object.lookAt(this.target),!0===this.enableDamping?(this.sphericalDelta.theta*=1-this.dampingFactor,this.sphericalDelta.phi*=1-this.dampingFactor,this.panOffset.multiplyScalar(1-this.dampingFactor)):(this.sphericalDelta.set(0,0,0),this.panOffset.set(0,0,0)),this.scale=1,!!(this.zoomChanged||this.lastPosition.distanceToSquared(this.object.position)>this.EPS||8*(1-this.lastQuaternion.dot(this.object.quaternion))>this.EPS)&&(this.dispatchEvent(this.changeEvent),this.lastPosition.copy(this.object.position),this.lastQuaternion.copy(this.object.quaternion),this.zoomChanged=!1,!0)})),p.default(this,"getAutoRotationAngle",(()=>2*Math.PI/60/60*this.autoRotateSpeed)),p.default(this,"getZoomScale",(()=>Math.pow(.95,this.zoomSpeed))),p.default(this,"rotateLeft",(e=>{this.sphericalDelta.theta-=e})),p.default(this,"rotateUp",(e=>{this.sphericalDelta.phi-=e})),p.default(this,"panLeft",((e,t)=>{this.v.setFromMatrixColumn(t,0),this.v.multiplyScalar(-e),this.panOffset.add(this.v)})),p.default(this,"panUp",((e,t)=>{!0===this.screenSpacePanning?this.v.setFromMatrixColumn(t,1):(this.v.setFromMatrixColumn(t,0),this.v.crossVectors(this.object.up,this.v)),this.v.multiplyScalar(e),this.panOffset.add(this.v)})),p.default(this,"pan",((t,r)=>{const i=this.domElement;if(this.object instanceof e.PerspectiveCamera){const e=this.object.position;this.offset.copy(e).sub(this.target);let n=this.offset.length();n*=Math.tan(this.object.fov/2*Math.PI/180),this.panLeft(2*t*n/i.clientHeight,this.object.matrix),this.panUp(2*r*n/i.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this.panLeft(t*(this.object.right-this.object.left)/this.object.zoom/i.clientWidth,this.object.matrix),this.panUp(r*(this.object.top-this.object.bottom)/this.object.zoom/i.clientHeight,this.object.matrix)):(console.warn("WARNING: CameraControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)})),p.default(this,"dollyIn",(t=>{this.object instanceof e.PerspectiveCamera?this.scale/=t:this.object instanceof e.OrthographicCamera?(this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom*t)),this.object.updateProjectionMatrix(),this.zoomChanged=!0):(console.warn("WARNING: CameraControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)})),p.default(this,"dollyOut",(t=>{this.object instanceof e.PerspectiveCamera?this.scale*=t:this.object instanceof e.OrthographicCamera?(this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/t)),this.object.updateProjectionMatrix(),this.zoomChanged=!0):(console.warn("WARNING: CameraControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)})),p.default(this,"handleMouseDownRotate",(e=>{this.rotateStart.set(e.clientX,e.clientY)})),p.default(this,"handleMouseDownDolly",(e=>{this.dollyStart.set(e.clientX,e.clientY)})),p.default(this,"handleMouseDownPan",(e=>{this.panStart.set(e.clientX,e.clientY)})),p.default(this,"handleMouseMoveRotate",(e=>{this.rotateEnd.set(e.clientX,e.clientY),this.rotateDelta.subVectors(this.rotateEnd,this.rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this.rotateLeft(2*Math.PI*this.rotateDelta.x/t.clientHeight),this.rotateUp(2*Math.PI*this.rotateDelta.y/t.clientHeight),this.rotateStart.copy(this.rotateEnd),this.update()})),p.default(this,"handleMouseMoveDolly",(e=>{this.dollyEnd.set(e.clientX,e.clientY),this.dollyDelta.subVectors(this.dollyEnd,this.dollyStart),this.dollyDelta.y>0?this.dollyIn(this.getZoomScale()):this.dollyDelta.y<0&&this.dollyOut(this.getZoomScale()),this.dollyStart.copy(this.dollyEnd),this.update()})),p.default(this,"handleMouseMovePan",(e=>{this.panEnd.set(e.clientX,e.clientY),this.panDelta.subVectors(this.panEnd,this.panStart).multiplyScalar(this.panSpeed),this.pan(this.panDelta.x,this.panDelta.y),this.panStart.copy(this.panEnd),this.update()})),p.default(this,"handleMouseWheel",(e=>{e.deltaY<0?this.dollyOut(this.getZoomScale()):e.deltaY>0&&this.dollyIn(this.getZoomScale()),this.update()})),p.default(this,"handleKeyDown",(e=>{let t=!1;switch(e.code){case this.keys.UP:this.pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:this.pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:this.pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:this.pan(-this.keyPanSpeed,0),t=!0}t&&(e.preventDefault(),this.update())})),p.default(this,"handleTouchStartRotate",(e=>{if(1==e.touches.length)this.rotateStart.set(e.touches[0].pageX,e.touches[0].pageY);else{const t=.5*(e.touches[0].pageX+e.touches[1].pageX),r=.5*(e.touches[0].pageY+e.touches[1].pageY);this.rotateStart.set(t,r)}})),p.default(this,"handleTouchStartPan",(e=>{if(1==e.touches.length)this.panStart.set(e.touches[0].pageX,e.touches[0].pageY);else{const t=.5*(e.touches[0].pageX+e.touches[1].pageX),r=.5*(e.touches[0].pageY+e.touches[1].pageY);this.panStart.set(t,r)}})),p.default(this,"handleTouchStartDolly",(e=>{const t=e.touches[0].pageX-e.touches[1].pageX,r=e.touches[0].pageY-e.touches[1].pageY,i=Math.sqrt(t*t+r*r);this.dollyStart.set(0,i)})),p.default(this,"handleTouchStartDollyPan",(e=>{this.enableZoom&&this.handleTouchStartDolly(e),this.enablePan&&this.handleTouchStartPan(e)})),p.default(this,"handleTouchStartDollyRotate",(e=>{this.enableZoom&&this.handleTouchStartDolly(e),this.enableRotate&&this.handleTouchStartRotate(e)})),p.default(this,"handleTouchMoveRotate",(e=>{if(1==e.touches.length)this.rotateEnd.set(e.touches[0].pageX,e.touches[0].pageY);else{const t=.5*(e.touches[0].pageX+e.touches[1].pageX),r=.5*(e.touches[0].pageY+e.touches[1].pageY);this.rotateEnd.set(t,r)}this.rotateDelta.subVectors(this.rotateEnd,this.rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this.rotateLeft(2*Math.PI*this.rotateDelta.x/t.clientHeight),this.rotateUp(2*Math.PI*this.rotateDelta.y/t.clientHeight),this.rotateStart.copy(this.rotateEnd)})),p.default(this,"handleTouchMovePan",(e=>{if(1==e.touches.length)this.panEnd.set(e.touches[0].pageX,e.touches[0].pageY);else{const t=.5*(e.touches[0].pageX+e.touches[1].pageX),r=.5*(e.touches[0].pageY+e.touches[1].pageY);this.panEnd.set(t,r)}this.panDelta.subVectors(this.panEnd,this.panStart).multiplyScalar(this.panSpeed),this.pan(this.panDelta.x,this.panDelta.y),this.panStart.copy(this.panEnd)})),p.default(this,"handleTouchMoveDolly",(e=>{const t=e.touches[0].pageX-e.touches[1].pageX,r=e.touches[0].pageY-e.touches[1].pageY,i=Math.sqrt(t*t+r*r);this.dollyEnd.set(0,i),this.dollyDelta.set(0,Math.pow(this.dollyEnd.y/this.dollyStart.y,this.zoomSpeed)),this.dollyIn(this.dollyDelta.y),this.dollyStart.copy(this.dollyEnd)})),p.default(this,"handleTouchMoveDollyPan",(e=>{this.enableZoom&&this.handleTouchMoveDolly(e),this.enablePan&&this.handleTouchMovePan(e)})),p.default(this,"handleTouchMoveDollyRotate",(e=>{this.enableZoom&&this.handleTouchMoveDolly(e),this.enableRotate&&this.handleTouchMoveRotate(e)})),p.default(this,"onMouseDown",(t=>{if(!1===this.enabled)return;let r;switch(t.preventDefault(),this.domElement.focus?this.domElement.focus():window.focus(),t.button){case 0:r=this.mouseButtons.LEFT;break;case 1:r=this.mouseButtons.MIDDLE;break;case 2:r=this.mouseButtons.RIGHT;break;default:r=-1}switch(r){case e.MOUSE.DOLLY:if(!1===this.enableZoom)return;this.handleMouseDownDolly(t),this.state=exports.STATE.DOLLY;break;case e.MOUSE.ROTATE:if(t.ctrlKey||t.metaKey||t.shiftKey){if(!1===this.enablePan)return;this.handleMouseDownPan(t),this.state=exports.STATE.PAN}else{if(!1===this.enableRotate)return;this.handleMouseDownRotate(t),this.state=exports.STATE.ROTATE}break;case e.MOUSE.PAN:if(t.ctrlKey||t.metaKey||t.shiftKey){if(!1===this.enableRotate)return;this.handleMouseDownRotate(t),this.state=exports.STATE.ROTATE}else{if(!1===this.enablePan)return;this.handleMouseDownPan(t),this.state=exports.STATE.PAN}break;default:this.state=exports.STATE.NONE}this.state!==exports.STATE.NONE&&(document.addEventListener("mousemove",this.onMouseMove,!1),document.addEventListener("mouseup",this.onMouseUp,!1),this.dispatchEvent(this.startEvent))})),p.default(this,"onMouseMove",(e=>{if(!1!==this.enabled)switch(e.preventDefault(),this.state){case exports.STATE.ROTATE:if(!1===this.enableRotate)return;this.handleMouseMoveRotate(e);break;case exports.STATE.DOLLY:if(!1===this.enableZoom)return;this.handleMouseMoveDolly(e);break;case exports.STATE.PAN:if(!1===this.enablePan)return;this.handleMouseMovePan(e)}})),p.default(this,"onMouseUp",(()=>{!1!==this.enabled&&(document.removeEventListener("mousemove",this.onMouseMove,!1),document.removeEventListener("mouseup",this.onMouseUp,!1),this.dispatchEvent(this.endEvent),this.state=exports.STATE.NONE)})),p.default(this,"onMouseWheel",(e=>{!1===this.enabled||!1===this.enableZoom||this.state!==exports.STATE.NONE&&this.state!==exports.STATE.ROTATE||(e.preventDefault(),this.dispatchEvent(this.startEvent),this.handleMouseWheel(e),this.dispatchEvent(this.endEvent))})),p.default(this,"onKeyDown",(e=>{!1!==this.enabled&&!1!==this.enableKeys&&!1!==this.enablePan&&this.handleKeyDown(e)})),p.default(this,"onTouchStart",(t=>{if(!1!==this.enabled){switch(t.preventDefault(),t.touches.length){case 1:switch(this.touches.ONE){case e.TOUCH.ROTATE:if(!1===this.enableRotate)return;this.handleTouchStartRotate(t),this.state=exports.STATE.TOUCH_ROTATE;break;case e.TOUCH.PAN:if(!1===this.enablePan)return;this.handleTouchStartPan(t),this.state=exports.STATE.TOUCH_PAN;break;default:this.state=exports.STATE.NONE}break;case 2:switch(this.touches.TWO){case e.TOUCH.DOLLY_PAN:if(!1===this.enableZoom&&!1===this.enablePan)return;this.handleTouchStartDollyPan(t),this.state=exports.STATE.TOUCH_DOLLY_PAN;break;case e.TOUCH.DOLLY_ROTATE:if(!1===this.enableZoom&&!1===this.enableRotate)return;this.handleTouchStartDollyRotate(t),this.state=exports.STATE.TOUCH_DOLLY_ROTATE;break;default:this.state=exports.STATE.NONE}break;default:this.state=exports.STATE.NONE}this.state!==exports.STATE.NONE&&this.dispatchEvent(this.startEvent)}})),p.default(this,"onTouchMove",(e=>{if(!1!==this.enabled)switch(e.preventDefault(),this.state){case exports.STATE.TOUCH_ROTATE:if(!1===this.enableRotate)return;this.handleTouchMoveRotate(e),this.update();break;case exports.STATE.TOUCH_PAN:if(!1===this.enablePan)return;this.handleTouchMovePan(e),this.update();break;case exports.STATE.TOUCH_DOLLY_PAN:if(!1===this.enableZoom&&!1===this.enablePan)return;this.handleTouchMoveDollyPan(e),this.update();break;case exports.STATE.TOUCH_DOLLY_ROTATE:if(!1===this.enableZoom&&!1===this.enableRotate)return;this.handleTouchMoveDollyRotate(e),this.update();break;default:this.state=exports.STATE.NONE}})),p.default(this,"onTouchEnd",(()=>{!1!==this.enabled&&(this.dispatchEvent(this.endEvent),this.state=exports.STATE.NONE)})),p.default(this,"onContextMenu",(e=>{!1!==this.enabled&&e.preventDefault()})),void 0===r&&console.warn('THREE.CameraControls: The second parameter "domElement" is now mandatory.'),r instanceof Document&&console.error('THREE.CameraControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.object=t,this.domElement=r,this.mouseButtons={LEFT:e.MOUSE.ROTATE,MIDDLE:e.MOUSE.DOLLY,RIGHT:e.MOUSE.PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.quaternion0=this.object.quaternion.clone(),this.zoom0=this.object.zoom,this.quat=(new e.Quaternion).setFromUnitVectors(this.object.up,new e.Vector3(0,1,0)),this.quatInverse=this.quat.clone().invert(),this.lastPosition=new e.Vector3,this.lastQuaternion=new e.Quaternion,this.domElement.addEventListener("contextmenu",this.onContextMenu,!1),this.domElement.addEventListener("mousedown",this.onMouseDown,!1),this.domElement.addEventListener("wheel",this.onMouseWheel,!1),this.domElement.addEventListener("touchstart",this.onTouchStart,!1),this.domElement.addEventListener("touchend",this.onTouchEnd,!1),this.domElement.addEventListener("touchmove",this.onTouchMove,!1),this.domElement.addEventListener("keydown",this.onKeyDown,!1),-1===this.domElement.tabIndex&&(this.domElement.tabIndex=0),this.object.lookAt(this.target),this.update(),this.saveState()}handleMouseUp(){}handleTouchEnd(){}}const ca=new e.Vector3;class ha extends e.EventDispatcher{constructor(t,r){super(),p.default(this,"object",void 0),p.default(this,"domElement",void 0),p.default(this,"enabled",!0),p.default(this,"movementSpeed",1),p.default(this,"lookSpeed",.005),p.default(this,"lookVertical",!0),p.default(this,"autoForward",!1),p.default(this,"activeLook",!0),p.default(this,"heightSpeed",!1),p.default(this,"heightCoef",1),p.default(this,"heightMin",0),p.default(this,"heightMax",1),p.default(this,"constrainVertical",!1),p.default(this,"verticalMin",0),p.default(this,"verticalMax",Math.PI),p.default(this,"mouseDragOn",!1),p.default(this,"autoSpeedFactor",0),p.default(this,"mouseX",0),p.default(this,"mouseY",0),p.default(this,"moveForward",!1),p.default(this,"moveBackward",!1),p.default(this,"moveLeft",!1),p.default(this,"moveRight",!1),p.default(this,"moveUp",!1),p.default(this,"moveDown",!1),p.default(this,"viewHalfX",0),p.default(this,"viewHalfY",0),p.default(this,"lat",0),p.default(this,"lon",0),p.default(this,"lookDirection",new e.Vector3),p.default(this,"spherical",new e.Spherical),p.default(this,"target",new e.Vector3),p.default(this,"connect",(e=>{e.setAttribute("tabindex","-1"),e.style.touchAction="none",e.addEventListener("contextmenu",this.contextmenu),e.addEventListener("mousemove",this.onMouseMove),e.addEventListener("mousedown",this.onMouseDown),e.addEventListener("mouseup",this.onMouseUp),this.domElement=e,window.addEventListener("keydown",this.onKeyDown),window.addEventListener("keyup",this.onKeyUp),this.handleResize()})),p.default(this,"dispose",(()=>{var e,t,r,i;null===(e=this.domElement)||void 0===e||e.removeEventListener("contextmenu",this.contextmenu),null===(t=this.domElement)||void 0===t||t.removeEventListener("mousedown",this.onMouseDown),null===(r=this.domElement)||void 0===r||r.removeEventListener("mousemove",this.onMouseMove),null===(i=this.domElement)||void 0===i||i.removeEventListener("mouseup",this.onMouseUp),window.removeEventListener("keydown",this.onKeyDown),window.removeEventListener("keyup",this.onKeyUp)})),p.default(this,"handleResize",(()=>{this.domElement&&(this.viewHalfX=this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2)})),p.default(this,"onMouseDown",(e=>{var t;if(null===(t=this.domElement)||void 0===t||t.focus(),this.activeLook)switch(e.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0})),p.default(this,"onMouseUp",(e=>{if(this.activeLook)switch(e.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1})),p.default(this,"onMouseMove",(e=>{this.domElement&&(this.mouseX=e.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=e.pageY-this.domElement.offsetTop-this.viewHalfY)})),p.default(this,"onKeyDown",(e=>{switch(e.code){case"ArrowUp":case"KeyW":this.moveForward=!0;break;case"ArrowLeft":case"KeyA":this.moveLeft=!0;break;case"ArrowDown":case"KeyS":this.moveBackward=!0;break;case"ArrowRight":case"KeyD":this.moveRight=!0;break;case"KeyR":this.moveUp=!0;break;case"KeyF":this.moveDown=!0}})),p.default(this,"onKeyUp",(e=>{switch(e.code){case"ArrowUp":case"KeyW":this.moveForward=!1;break;case"ArrowLeft":case"KeyA":this.moveLeft=!1;break;case"ArrowDown":case"KeyS":this.moveBackward=!1;break;case"ArrowRight":case"KeyD":this.moveRight=!1;break;case"KeyR":this.moveUp=!1;break;case"KeyF":this.moveDown=!1}})),p.default(this,"lookAt",((t,r,i)=>(t instanceof e.Vector3?this.target.copy(t):r&&i&&this.target.set(t,r,i),this.object.lookAt(this.target),this.setOrientation(),this))),p.default(this,"update",(t=>{if(!this.enabled)return;if(this.heightSpeed){const r=e.MathUtils.clamp(this.object.position.y,this.heightMin,this.heightMax)-this.heightMin;this.autoSpeedFactor=t*(r*this.heightCoef)}else this.autoSpeedFactor=0;const r=t*this.movementSpeed;(this.moveForward||this.autoForward&&!this.moveBackward)&&this.object.translateZ(-(r+this.autoSpeedFactor)),this.moveBackward&&this.object.translateZ(r),this.moveLeft&&this.object.translateX(-r),this.moveRight&&this.object.translateX(r),this.moveUp&&this.object.translateY(r),this.moveDown&&this.object.translateY(-r);let i=t*this.lookSpeed;this.activeLook||(i=0);let n=1;this.constrainVertical&&(n=Math.PI/(this.verticalMax-this.verticalMin)),this.lon-=this.mouseX*i,this.lookVertical&&(this.lat-=this.mouseY*i*n),this.lat=Math.max(-85,Math.min(85,this.lat));let s=e.MathUtils.degToRad(90-this.lat);const o=e.MathUtils.degToRad(this.lon);this.constrainVertical&&(s=e.MathUtils.mapLinear(s,0,Math.PI,this.verticalMin,this.verticalMax));const a=this.object.position;ca.setFromSphericalCoords(1,s,o).add(a),this.object.lookAt(ca)})),p.default(this,"contextmenu",(e=>e.preventDefault())),p.default(this,"setOrientation",(()=>{this.lookDirection.set(0,0,-1).applyQuaternion(this.object.quaternion),this.spherical.setFromVector3(this.lookDirection),this.lat=90-e.MathUtils.radToDeg(this.spherical.phi),this.lon=e.MathUtils.radToDeg(this.spherical.theta)})),this.object=t,this.domElement=r,this.setOrientation(),r&&this.connect(r)}}class ua extends e.Object3D{constructor(t,r){super(),p.default(this,"isTransformControls",!0),p.default(this,"visible",!1),p.default(this,"domElement",void 0),p.default(this,"raycaster",new e.Raycaster),p.default(this,"gizmo",void 0),p.default(this,"plane",void 0),p.default(this,"tempVector",new e.Vector3),p.default(this,"tempVector2",new e.Vector3),p.default(this,"tempQuaternion",new e.Quaternion),p.default(this,"unit",{X:new e.Vector3(1,0,0),Y:new e.Vector3(0,1,0),Z:new e.Vector3(0,0,1)}),p.default(this,"pointStart",new e.Vector3),p.default(this,"pointEnd",new e.Vector3),p.default(this,"offset",new e.Vector3),p.default(this,"rotationAxis",new e.Vector3),p.default(this,"startNorm",new e.Vector3),p.default(this,"endNorm",new e.Vector3),p.default(this,"rotationAngle",0),p.default(this,"cameraPosition",new e.Vector3),p.default(this,"cameraQuaternion",new e.Quaternion),p.default(this,"cameraScale",new e.Vector3),p.default(this,"parentPosition",new e.Vector3),p.default(this,"parentQuaternion",new e.Quaternion),p.default(this,"parentQuaternionInv",new e.Quaternion),p.default(this,"parentScale",new e.Vector3),p.default(this,"worldPositionStart",new e.Vector3),p.default(this,"worldQuaternionStart",new e.Quaternion),p.default(this,"worldScaleStart",new e.Vector3),p.default(this,"worldPosition",new e.Vector3),p.default(this,"worldQuaternion",new e.Quaternion),p.default(this,"worldQuaternionInv",new e.Quaternion),p.default(this,"worldScale",new e.Vector3),p.default(this,"eye",new e.Vector3),p.default(this,"positionStart",new e.Vector3),p.default(this,"quaternionStart",new e.Quaternion),p.default(this,"scaleStart",new e.Vector3),p.default(this,"camera",void 0),p.default(this,"object",void 0),p.default(this,"enabled",!0),p.default(this,"axis",null),p.default(this,"mode","translate"),p.default(this,"translationSnap",null),p.default(this,"rotationSnap",null),p.default(this,"scaleSnap",null),p.default(this,"space","world"),p.default(this,"size",1),p.default(this,"dragging",!1),p.default(this,"showX",!0),p.default(this,"showY",!0),p.default(this,"showZ",!0),p.default(this,"changeEvent",{type:"change"}),p.default(this,"mouseDownEvent",{type:"mouseDown",mode:this.mode}),p.default(this,"mouseUpEvent",{type:"mouseUp",mode:this.mode}),p.default(this,"objectChangeEvent",{type:"objectChange"}),p.default(this,"intersectObjectWithRay",((e,t,r)=>{const i=t.intersectObject(e,!0);for(let e=0;e<i.length;e++)if(i[e].object.visible||r)return i[e];return!1})),p.default(this,"attach",(e=>(this.object=e,this.visible=!0,this))),p.default(this,"detach",(()=>(this.object=void 0,this.visible=!1,this.axis=null,this))),p.default(this,"reset",(()=>this.enabled?(this.dragging&&void 0!==this.object&&(this.object.position.copy(this.positionStart),this.object.quaternion.copy(this.quaternionStart),this.object.scale.copy(this.scaleStart),this.dispatchEvent(this.changeEvent),this.dispatchEvent(this.objectChangeEvent),this.pointStart.copy(this.pointEnd)),this):this)),p.default(this,"updateMatrixWorld",(()=>{void 0!==this.object&&(this.object.updateMatrixWorld(),null===this.object.parent?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):this.object.parent.matrixWorld.decompose(this.parentPosition,this.parentQuaternion,this.parentScale),this.object.matrixWorld.decompose(this.worldPosition,this.worldQuaternion,this.worldScale),this.parentQuaternionInv.copy(this.parentQuaternion).invert(),this.worldQuaternionInv.copy(this.worldQuaternion).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(this.cameraPosition,this.cameraQuaternion,this.cameraScale),this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(),super.updateMatrixWorld()})),p.default(this,"pointerHover",(e=>{if(void 0===this.object||!0===this.dragging)return;this.raycaster.setFromCamera(e,this.camera);const t=this.intersectObjectWithRay(this.gizmo.picker[this.mode],this.raycaster);this.axis=t?t.object.name:null})),p.default(this,"pointerDown",(e=>{if(void 0!==this.object&&!0!==this.dragging&&0===e.button&&null!==this.axis){this.raycaster.setFromCamera(e,this.camera);const t=this.intersectObjectWithRay(this.plane,this.raycaster,!0);if(t){let e=this.space;if("scale"===this.mode?e="local":"E"!==this.axis&&"XYZE"!==this.axis&&"XYZ"!==this.axis||(e="world"),"local"===e&&"rotate"===this.mode){const e=this.rotationSnap;"X"===this.axis&&e&&(this.object.rotation.x=Math.round(this.object.rotation.x/e)*e),"Y"===this.axis&&e&&(this.object.rotation.y=Math.round(this.object.rotation.y/e)*e),"Z"===this.axis&&e&&(this.object.rotation.z=Math.round(this.object.rotation.z/e)*e)}this.object.updateMatrixWorld(),this.object.parent&&this.object.parent.updateMatrixWorld(),this.positionStart.copy(this.object.position),this.quaternionStart.copy(this.object.quaternion),this.scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this.worldScaleStart),this.pointStart.copy(t.point).sub(this.worldPositionStart)}this.dragging=!0,this.mouseDownEvent.mode=this.mode,this.dispatchEvent(this.mouseDownEvent)}})),p.default(this,"pointerMove",(e=>{const t=this.axis,r=this.mode,i=this.object;let n=this.space;if("scale"===r?n="local":"E"!==t&&"XYZE"!==t&&"XYZ"!==t||(n="world"),void 0===i||null===t||!1===this.dragging||-1!==e.button)return;this.raycaster.setFromCamera(e,this.camera);const s=this.intersectObjectWithRay(this.plane,this.raycaster,!0);if(s){if(this.pointEnd.copy(s.point).sub(this.worldPositionStart),"translate"===r)this.offset.copy(this.pointEnd).sub(this.pointStart),"local"===n&&"XYZ"!==t&&this.offset.applyQuaternion(this.worldQuaternionInv),-1===t.indexOf("X")&&(this.offset.x=0),-1===t.indexOf("Y")&&(this.offset.y=0),-1===t.indexOf("Z")&&(this.offset.z=0),"local"===n&&"XYZ"!==t?this.offset.applyQuaternion(this.quaternionStart).divide(this.parentScale):this.offset.applyQuaternion(this.parentQuaternionInv).divide(this.parentScale),i.position.copy(this.offset).add(this.positionStart),this.translationSnap&&("local"===n&&(i.position.applyQuaternion(this.tempQuaternion.copy(this.quaternionStart).invert()),-1!==t.search("X")&&(i.position.x=Math.round(i.position.x/this.translationSnap)*this.translationSnap),-1!==t.search("Y")&&(i.position.y=Math.round(i.position.y/this.translationSnap)*this.translationSnap),-1!==t.search("Z")&&(i.position.z=Math.round(i.position.z/this.translationSnap)*this.translationSnap),i.position.applyQuaternion(this.quaternionStart)),"world"===n&&(i.parent&&i.position.add(this.tempVector.setFromMatrixPosition(i.parent.matrixWorld)),-1!==t.search("X")&&(i.position.x=Math.round(i.position.x/this.translationSnap)*this.translationSnap),-1!==t.search("Y")&&(i.position.y=Math.round(i.position.y/this.translationSnap)*this.translationSnap),-1!==t.search("Z")&&(i.position.z=Math.round(i.position.z/this.translationSnap)*this.translationSnap),i.parent&&i.position.sub(this.tempVector.setFromMatrixPosition(i.parent.matrixWorld))));else if("scale"===r){if(-1!==t.search("XYZ")){let e=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(e*=-1),this.tempVector2.set(e,e,e)}else this.tempVector.copy(this.pointStart),this.tempVector2.copy(this.pointEnd),this.tempVector.applyQuaternion(this.worldQuaternionInv),this.tempVector2.applyQuaternion(this.worldQuaternionInv),this.tempVector2.divide(this.tempVector),-1===t.search("X")&&(this.tempVector2.x=1),-1===t.search("Y")&&(this.tempVector2.y=1),-1===t.search("Z")&&(this.tempVector2.z=1);i.scale.copy(this.scaleStart).multiply(this.tempVector2),this.scaleSnap&&this.object&&(-1!==t.search("X")&&(this.object.scale.x=Math.round(i.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==t.search("Y")&&(i.scale.y=Math.round(i.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==t.search("Z")&&(i.scale.z=Math.round(i.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if("rotate"===r){this.offset.copy(this.pointEnd).sub(this.pointStart);const e=20/this.worldPosition.distanceTo(this.tempVector.setFromMatrixPosition(this.camera.matrixWorld));"E"===t?(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this.startNorm.copy(this.pointStart).normalize(),this.endNorm.copy(this.pointEnd).normalize(),this.rotationAngle*=this.endNorm.cross(this.startNorm).dot(this.eye)<0?1:-1):"XYZE"===t?(this.rotationAxis.copy(this.offset).cross(this.eye).normalize(),this.rotationAngle=this.offset.dot(this.tempVector.copy(this.rotationAxis).cross(this.eye))*e):"X"!==t&&"Y"!==t&&"Z"!==t||(this.rotationAxis.copy(this.unit[t]),this.tempVector.copy(this.unit[t]),"local"===n&&this.tempVector.applyQuaternion(this.worldQuaternion),this.rotationAngle=this.offset.dot(this.tempVector.cross(this.eye).normalize())*e),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),"local"===n&&"E"!==t&&"XYZE"!==t?(i.quaternion.copy(this.quaternionStart),i.quaternion.multiply(this.tempQuaternion.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this.parentQuaternionInv),i.quaternion.copy(this.tempQuaternion.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),i.quaternion.multiply(this.quaternionStart).normalize())}this.dispatchEvent(this.changeEvent),this.dispatchEvent(this.objectChangeEvent)}})),p.default(this,"pointerUp",(e=>{0===e.button&&(this.dragging&&null!==this.axis&&(this.mouseUpEvent.mode=this.mode,this.dispatchEvent(this.mouseUpEvent)),this.dragging=!1,this.axis=null)})),p.default(this,"getPointer",(e=>{var t;if(this.domElement&&null!==(t=this.domElement.ownerDocument)&&void 0!==t&&t.pointerLockElement)return{x:0,y:0,button:e.button};{var r;const t=e.changedTouches?e.changedTouches[0]:e,i=null===(r=this.domElement)||void 0===r?void 0:r.getBoundingClientRect();return{x:(t.clientX-i.left)/i.width*2-1,y:-(t.clientY-i.top)/i.height*2+1,button:e.button}}})),p.default(this,"onPointerHover",(e=>{if(this.enabled)switch(e.pointerType){case"mouse":case"pen":this.pointerHover(this.getPointer(e))}})),p.default(this,"onPointerDown",(e=>{this.enabled&&this.domElement&&(this.domElement.style.touchAction="none",this.domElement.ownerDocument.addEventListener("pointermove",this.onPointerMove),this.pointerHover(this.getPointer(e)),this.pointerDown(this.getPointer(e)))})),p.default(this,"onPointerMove",(e=>{this.enabled&&this.pointerMove(this.getPointer(e))})),p.default(this,"onPointerUp",(e=>{this.enabled&&this.domElement&&(this.domElement.style.touchAction="",this.domElement.ownerDocument.removeEventListener("pointermove",this.onPointerMove),this.pointerUp(this.getPointer(e)))})),p.default(this,"getMode",(()=>this.mode)),p.default(this,"setMode",(e=>{this.mode=e})),p.default(this,"setTranslationSnap",(e=>{this.translationSnap=e})),p.default(this,"setRotationSnap",(e=>{this.rotationSnap=e})),p.default(this,"setScaleSnap",(e=>{this.scaleSnap=e})),p.default(this,"setSize",(e=>{this.size=e})),p.default(this,"setSpace",(e=>{this.space=e})),p.default(this,"update",(()=>{console.warn("THREE.TransformControls: update function has no more functionality and therefore has been deprecated.")})),p.default(this,"connect",(e=>{e===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.domElement=e,this.domElement.addEventListener("pointerdown",this.onPointerDown),this.domElement.addEventListener("pointermove",this.onPointerHover),this.domElement.ownerDocument.addEventListener("pointerup",this.onPointerUp)})),p.default(this,"dispose",(()=>{var e,t,r,i,n,s;null===(e=this.domElement)||void 0===e||e.removeEventListener("pointerdown",this.onPointerDown),null===(t=this.domElement)||void 0===t||t.removeEventListener("pointermove",this.onPointerHover),null===(r=this.domElement)||void 0===r||null===(i=r.ownerDocument)||void 0===i||i.removeEventListener("pointermove",this.onPointerMove),null===(n=this.domElement)||void 0===n||null===(s=n.ownerDocument)||void 0===s||s.removeEventListener("pointerup",this.onPointerUp),this.traverse((e=>{const t=e;t.geometry&&t.geometry.dispose(),t.material&&t.material.dispose()}))})),this.domElement=r,this.camera=t,this.gizmo=new da,this.add(this.gizmo),this.plane=new pa,this.add(this.plane);const i=(e,t)=>{let r=t;Object.defineProperty(this,e,{get:function(){return void 0!==r?r:t},set:function(t){r!==t&&(r=t,this.plane[e]=t,this.gizmo[e]=t,this.dispatchEvent({type:e+"-changed",value:t}),this.dispatchEvent(this.changeEvent))}}),this[e]=t,this.plane[e]=t,this.gizmo[e]=t};i("camera",this.camera),i("object",this.object),i("enabled",this.enabled),i("axis",this.axis),i("mode",this.mode),i("translationSnap",this.translationSnap),i("rotationSnap",this.rotationSnap),i("scaleSnap",this.scaleSnap),i("space",this.space),i("size",this.size),i("dragging",this.dragging),i("showX",this.showX),i("showY",this.showY),i("showZ",this.showZ),i("worldPosition",this.worldPosition),i("worldPositionStart",this.worldPositionStart),i("worldQuaternion",this.worldQuaternion),i("worldQuaternionStart",this.worldQuaternionStart),i("cameraPosition",this.cameraPosition),i("cameraQuaternion",this.cameraQuaternion),i("pointStart",this.pointStart),i("pointEnd",this.pointEnd),i("rotationAxis",this.rotationAxis),i("rotationAngle",this.rotationAngle),i("eye",this.eye),void 0!==r&&this.connect(r)}}class da extends e.Object3D{constructor(){super(),p.default(this,"isTransformControlsGizmo",!0),p.default(this,"type","TransformControlsGizmo"),p.default(this,"tempVector",new e.Vector3(0,0,0)),p.default(this,"tempEuler",new e.Euler),p.default(this,"alignVector",new e.Vector3(0,1,0)),p.default(this,"zeroVector",new e.Vector3(0,0,0)),p.default(this,"lookAtMatrix",new e.Matrix4),p.default(this,"tempQuaternion",new e.Quaternion),p.default(this,"tempQuaternion2",new e.Quaternion),p.default(this,"identityQuaternion",new e.Quaternion),p.default(this,"unitX",new e.Vector3(1,0,0)),p.default(this,"unitY",new e.Vector3(0,1,0)),p.default(this,"unitZ",new e.Vector3(0,0,1)),p.default(this,"gizmo",void 0),p.default(this,"picker",void 0),p.default(this,"helper",void 0),p.default(this,"rotationAxis",new e.Vector3),p.default(this,"cameraPosition",new e.Vector3),p.default(this,"worldPositionStart",new e.Vector3),p.default(this,"worldQuaternionStart",new e.Quaternion),p.default(this,"worldPosition",new e.Vector3),p.default(this,"worldQuaternion",new e.Quaternion),p.default(this,"eye",new e.Vector3),p.default(this,"camera",null),p.default(this,"enabled",!0),p.default(this,"axis",null),p.default(this,"mode","translate"),p.default(this,"space","world"),p.default(this,"size",1),p.default(this,"dragging",!1),p.default(this,"showX",!0),p.default(this,"showY",!0),p.default(this,"showZ",!0),p.default(this,"updateMatrixWorld",(()=>{let t=this.space;"scale"===this.mode&&(t="local");const r="local"===t?this.worldQuaternion:this.identityQuaternion;this.gizmo.translate.visible="translate"===this.mode,this.gizmo.rotate.visible="rotate"===this.mode,this.gizmo.scale.visible="scale"===this.mode,this.helper.translate.visible="translate"===this.mode,this.helper.rotate.visible="rotate"===this.mode,this.helper.scale.visible="scale"===this.mode;let i=[];i=i.concat(this.picker[this.mode].children),i=i.concat(this.gizmo[this.mode].children),i=i.concat(this.helper[this.mode].children);for(let t=0;t<i.length;t++){const n=i[t];let s;if(n.visible=!0,n.rotation.set(0,0,0),n.position.copy(this.worldPosition),s=this.camera.isOrthographicCamera?(this.camera.top-this.camera.bottom)/this.camera.zoom:this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),n.scale.set(1,1,1).multiplyScalar(s*this.size/7),"helper"!==n.tag){if(n.quaternion.copy(r),"translate"===this.mode||"scale"===this.mode){const e=.99,t=.2,i=0;"X"!==n.name&&"XYZX"!==n.name||Math.abs(this.alignVector.copy(this.unitX).applyQuaternion(r).dot(this.eye))>e&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),"Y"!==n.name&&"XYZY"!==n.name||Math.abs(this.alignVector.copy(this.unitY).applyQuaternion(r).dot(this.eye))>e&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),"Z"!==n.name&&"XYZZ"!==n.name||Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion(r).dot(this.eye))>e&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),"XY"===n.name&&Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion(r).dot(this.eye))<t&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),"YZ"===n.name&&Math.abs(this.alignVector.copy(this.unitX).applyQuaternion(r).dot(this.eye))<t&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),"XZ"===n.name&&Math.abs(this.alignVector.copy(this.unitY).applyQuaternion(r).dot(this.eye))<t&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),-1!==n.name.search("X")&&(this.alignVector.copy(this.unitX).applyQuaternion(r).dot(this.eye)<i?"fwd"===n.tag?n.visible=!1:n.scale.x*=-1:"bwd"===n.tag&&(n.visible=!1)),-1!==n.name.search("Y")&&(this.alignVector.copy(this.unitY).applyQuaternion(r).dot(this.eye)<i?"fwd"===n.tag?n.visible=!1:n.scale.y*=-1:"bwd"===n.tag&&(n.visible=!1)),-1!==n.name.search("Z")&&(this.alignVector.copy(this.unitZ).applyQuaternion(r).dot(this.eye)<i?"fwd"===n.tag?n.visible=!1:n.scale.z*=-1:"bwd"===n.tag&&(n.visible=!1))}else"rotate"===this.mode&&(this.tempQuaternion2.copy(r),this.alignVector.copy(this.eye).applyQuaternion(this.tempQuaternion.copy(r).invert()),-1!==n.name.search("E")&&n.quaternion.setFromRotationMatrix(this.lookAtMatrix.lookAt(this.eye,this.zeroVector,this.unitY)),"X"===n.name&&(this.tempQuaternion.setFromAxisAngle(this.unitX,Math.atan2(-this.alignVector.y,this.alignVector.z)),this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2,this.tempQuaternion),n.quaternion.copy(this.tempQuaternion)),"Y"===n.name&&(this.tempQuaternion.setFromAxisAngle(this.unitY,Math.atan2(this.alignVector.x,this.alignVector.z)),this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2,this.tempQuaternion),n.quaternion.copy(this.tempQuaternion)),"Z"===n.name&&(this.tempQuaternion.setFromAxisAngle(this.unitZ,Math.atan2(this.alignVector.y,this.alignVector.x)),this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2,this.tempQuaternion),n.quaternion.copy(this.tempQuaternion)));n.visible=n.visible&&(-1===n.name.indexOf("X")||this.showX),n.visible=n.visible&&(-1===n.name.indexOf("Y")||this.showY),n.visible=n.visible&&(-1===n.name.indexOf("Z")||this.showZ),n.visible=n.visible&&(-1===n.name.indexOf("E")||this.showX&&this.showY&&this.showZ),n.material.tempOpacity=n.material.tempOpacity||n.material.opacity,n.material.tempColor=n.material.tempColor||n.material.color.clone(),n.material.color.copy(n.material.tempColor),n.material.opacity=n.material.tempOpacity,this.enabled?this.axis&&(n.name===this.axis||this.axis.split("").some((function(e){return n.name===e}))?(n.material.opacity=1,n.material.color.lerp(new e.Color(1,1,1),.5)):(n.material.opacity*=.25,n.material.color.lerp(new e.Color(1,1,1),.5))):(n.material.opacity*=.5,n.material.color.lerp(new e.Color(1,1,1),.5))}else n.visible=!1,"AXIS"===n.name?(n.position.copy(this.worldPositionStart),n.visible=!!this.axis,"X"===this.axis&&(this.tempQuaternion.setFromEuler(this.tempEuler.set(0,0,0)),n.quaternion.copy(r).multiply(this.tempQuaternion),Math.abs(this.alignVector.copy(this.unitX).applyQuaternion(r).dot(this.eye))>.9&&(n.visible=!1)),"Y"===this.axis&&(this.tempQuaternion.setFromEuler(this.tempEuler.set(0,0,Math.PI/2)),n.quaternion.copy(r).multiply(this.tempQuaternion),Math.abs(this.alignVector.copy(this.unitY).applyQuaternion(r).dot(this.eye))>.9&&(n.visible=!1)),"Z"===this.axis&&(this.tempQuaternion.setFromEuler(this.tempEuler.set(0,Math.PI/2,0)),n.quaternion.copy(r).multiply(this.tempQuaternion),Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion(r).dot(this.eye))>.9&&(n.visible=!1)),"XYZE"===this.axis&&(this.tempQuaternion.setFromEuler(this.tempEuler.set(0,Math.PI/2,0)),this.alignVector.copy(this.rotationAxis),n.quaternion.setFromRotationMatrix(this.lookAtMatrix.lookAt(this.zeroVector,this.alignVector,this.unitY)),n.quaternion.multiply(this.tempQuaternion),n.visible=this.dragging),"E"===this.axis&&(n.visible=!1)):"START"===n.name?(n.position.copy(this.worldPositionStart),n.visible=this.dragging):"END"===n.name?(n.position.copy(this.worldPosition),n.visible=this.dragging):"DELTA"===n.name?(n.position.copy(this.worldPositionStart),n.quaternion.copy(this.worldQuaternionStart),this.tempVector.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),this.tempVector.applyQuaternion(this.worldQuaternionStart.clone().invert()),n.scale.copy(this.tempVector),n.visible=this.dragging):(n.quaternion.copy(r),this.dragging?n.position.copy(this.worldPositionStart):n.position.copy(this.worldPosition),this.axis&&(n.visible=-1!==this.axis.search(n.name)))}super.updateMatrixWorld()}));const t=new e.MeshBasicMaterial({depthTest:!1,depthWrite:!1,transparent:!0,side:e.DoubleSide,fog:!1,toneMapped:!1}),r=new e.LineBasicMaterial({depthTest:!1,depthWrite:!1,transparent:!0,linewidth:1,fog:!1,toneMapped:!1}),i=t.clone();i.opacity=.15;const n=t.clone();n.opacity=.33;const s=t.clone();s.color.set(16711680);const o=t.clone();o.color.set(65280);const a=t.clone();a.color.set(255);const l=t.clone();l.opacity=.25;const c=l.clone();c.color.set(16776960);const h=l.clone();h.color.set(65535);const u=l.clone();u.color.set(16711935);t.clone().color.set(16776960);const d=r.clone();d.color.set(16711680);const m=r.clone();m.color.set(65280);const f=r.clone();f.color.set(255);const g=r.clone();g.color.set(65535);const v=r.clone();v.color.set(16711935);const x=r.clone();x.color.set(16776960);const y=r.clone();y.color.set(7895160);const b=x.clone();b.opacity=.25;const A=new e.CylinderGeometry(0,.05,.2,12,1,!1),w=new e.BoxGeometry(.125,.125,.125),M=new e.BufferGeometry;M.setAttribute("position",new e.Float32BufferAttribute([0,0,0,1,0,0],3));const T=(t,r)=>{const i=new e.BufferGeometry,n=[];for(let e=0;e<=64*r;++e)n.push(0,Math.cos(e/32*Math.PI)*t,Math.sin(e/32*Math.PI)*t);return i.setAttribute("position",new e.Float32BufferAttribute(n,3)),i},S={X:[[new e.Mesh(A,s),[1,0,0],[0,0,-Math.PI/2],null,"fwd"],[new e.Mesh(A,s),[1,0,0],[0,0,Math.PI/2],null,"bwd"],[new e.Line(M,d)]],Y:[[new e.Mesh(A,o),[0,1,0],null,null,"fwd"],[new e.Mesh(A,o),[0,1,0],[Math.PI,0,0],null,"bwd"],[new e.Line(M,m),null,[0,0,Math.PI/2]]],Z:[[new e.Mesh(A,a),[0,0,1],[Math.PI/2,0,0],null,"fwd"],[new e.Mesh(A,a),[0,0,1],[-Math.PI/2,0,0],null,"bwd"],[new e.Line(M,f),null,[0,-Math.PI/2,0]]],XYZ:[[new e.Mesh(new e.OctahedronGeometry(.1,0),l.clone()),[0,0,0],[0,0,0]]],XY:[[new e.Mesh(new e.PlaneGeometry(.295,.295),c.clone()),[.15,.15,0]],[new e.Line(M,x),[.18,.3,0],null,[.125,1,1]],[new e.Line(M,x),[.3,.18,0],[0,0,Math.PI/2],[.125,1,1]]],YZ:[[new e.Mesh(new e.PlaneGeometry(.295,.295),h.clone()),[0,.15,.15],[0,Math.PI/2,0]],[new e.Line(M,g),[0,.18,.3],[0,0,Math.PI/2],[.125,1,1]],[new e.Line(M,g),[0,.3,.18],[0,-Math.PI/2,0],[.125,1,1]]],XZ:[[new e.Mesh(new e.PlaneGeometry(.295,.295),u.clone()),[.15,0,.15],[-Math.PI/2,0,0]],[new e.Line(M,v),[.18,0,.3],null,[.125,1,1]],[new e.Line(M,v),[.3,0,.18],[0,-Math.PI/2,0],[.125,1,1]]]},C={X:[[new e.Mesh(new e.CylinderGeometry(.2,0,1,4,1,!1),i),[.6,0,0],[0,0,-Math.PI/2]]],Y:[[new e.Mesh(new e.CylinderGeometry(.2,0,1,4,1,!1),i),[0,.6,0]]],Z:[[new e.Mesh(new e.CylinderGeometry(.2,0,1,4,1,!1),i),[0,0,.6],[Math.PI/2,0,0]]],XYZ:[[new e.Mesh(new e.OctahedronGeometry(.2,0),i)]],XY:[[new e.Mesh(new e.PlaneGeometry(.4,.4),i),[.2,.2,0]]],YZ:[[new e.Mesh(new e.PlaneGeometry(.4,.4),i),[0,.2,.2],[0,Math.PI/2,0]]],XZ:[[new e.Mesh(new e.PlaneGeometry(.4,.4),i),[.2,0,.2],[-Math.PI/2,0,0]]]},F={START:[[new e.Mesh(new e.OctahedronGeometry(.01,2),n),null,null,null,"helper"]],END:[[new e.Mesh(new e.OctahedronGeometry(.01,2),n),null,null,null,"helper"]],DELTA:[[new e.Line((()=>{const t=new e.BufferGeometry;return t.setAttribute("position",new e.Float32BufferAttribute([0,0,0,1,1,1],3)),t})(),n),null,null,null,"helper"]],X:[[new e.Line(M,n.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new e.Line(M,n.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new e.Line(M,n.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},E={X:[[new e.Line(T(1,.5),d)],[new e.Mesh(new e.OctahedronGeometry(.04,0),s),[0,0,.99],null,[1,3,1]]],Y:[[new e.Line(T(1,.5),m),null,[0,0,-Math.PI/2]],[new e.Mesh(new e.OctahedronGeometry(.04,0),o),[0,0,.99],null,[3,1,1]]],Z:[[new e.Line(T(1,.5),f),null,[0,Math.PI/2,0]],[new e.Mesh(new e.OctahedronGeometry(.04,0),a),[.99,0,0],null,[1,3,1]]],E:[[new e.Line(T(1.25,1),b),null,[0,Math.PI/2,0]],[new e.Mesh(new e.CylinderGeometry(.03,0,.15,4,1,!1),b),[1.17,0,0],[0,0,-Math.PI/2],[1,1,.001]],[new e.Mesh(new e.CylinderGeometry(.03,0,.15,4,1,!1),b),[-1.17,0,0],[0,0,Math.PI/2],[1,1,.001]],[new e.Mesh(new e.CylinderGeometry(.03,0,.15,4,1,!1),b),[0,-1.17,0],[Math.PI,0,0],[1,1,.001]],[new e.Mesh(new e.CylinderGeometry(.03,0,.15,4,1,!1),b),[0,1.17,0],[0,0,0],[1,1,.001]]],XYZE:[[new e.Line(T(1,1),y),null,[0,Math.PI/2,0]]]},_={AXIS:[[new e.Line(M,n.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},P={X:[[new e.Mesh(new e.TorusGeometry(1,.1,4,24),i),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new e.Mesh(new e.TorusGeometry(1,.1,4,24),i),[0,0,0],[Math.PI/2,0,0]]],Z:[[new e.Mesh(new e.TorusGeometry(1,.1,4,24),i),[0,0,0],[0,0,-Math.PI/2]]],E:[[new e.Mesh(new e.TorusGeometry(1.25,.1,2,24),i)]],XYZE:[[new e.Mesh(new e.SphereGeometry(.7,10,8),i)]]},B={X:[[new e.Mesh(w,s),[.8,0,0],[0,0,-Math.PI/2]],[new e.Line(M,d),null,null,[.8,1,1]]],Y:[[new e.Mesh(w,o),[0,.8,0]],[new e.Line(M,m),null,[0,0,Math.PI/2],[.8,1,1]]],Z:[[new e.Mesh(w,a),[0,0,.8],[Math.PI/2,0,0]],[new e.Line(M,f),null,[0,-Math.PI/2,0],[.8,1,1]]],XY:[[new e.Mesh(w,c),[.85,.85,0],null,[2,2,.2]],[new e.Line(M,x),[.855,.98,0],null,[.125,1,1]],[new e.Line(M,x),[.98,.855,0],[0,0,Math.PI/2],[.125,1,1]]],YZ:[[new e.Mesh(w,h),[0,.85,.85],null,[.2,2,2]],[new e.Line(M,g),[0,.855,.98],[0,0,Math.PI/2],[.125,1,1]],[new e.Line(M,g),[0,.98,.855],[0,-Math.PI/2,0],[.125,1,1]]],XZ:[[new e.Mesh(w,u),[.85,0,.85],null,[2,.2,2]],[new e.Line(M,v),[.855,0,.98],null,[.125,1,1]],[new e.Line(M,v),[.98,0,.855],[0,-Math.PI/2,0],[.125,1,1]]],XYZX:[[new e.Mesh(new e.BoxGeometry(.125,.125,.125),l.clone()),[1.1,0,0]]],XYZY:[[new e.Mesh(new e.BoxGeometry(.125,.125,.125),l.clone()),[0,1.1,0]]],XYZZ:[[new e.Mesh(new e.BoxGeometry(.125,.125,.125),l.clone()),[0,0,1.1]]]},L={X:[[new e.Mesh(new e.CylinderGeometry(.2,0,.8,4,1,!1),i),[.5,0,0],[0,0,-Math.PI/2]]],Y:[[new e.Mesh(new e.CylinderGeometry(.2,0,.8,4,1,!1),i),[0,.5,0]]],Z:[[new e.Mesh(new e.CylinderGeometry(.2,0,.8,4,1,!1),i),[0,0,.5],[Math.PI/2,0,0]]],XY:[[new e.Mesh(w,i),[.85,.85,0],null,[3,3,.2]]],YZ:[[new e.Mesh(w,i),[0,.85,.85],null,[.2,3,3]]],XZ:[[new e.Mesh(w,i),[.85,0,.85],null,[3,.2,3]]],XYZX:[[new e.Mesh(new e.BoxGeometry(.2,.2,.2),i),[1.1,0,0]]],XYZY:[[new e.Mesh(new e.BoxGeometry(.2,.2,.2),i),[0,1.1,0]]],XYZZ:[[new e.Mesh(new e.BoxGeometry(.2,.2,.2),i),[0,0,1.1]]]},R={X:[[new e.Line(M,n.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new e.Line(M,n.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new e.Line(M,n.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},N=t=>{const r=new e.Object3D;for(let e in t)for(let i=t[e].length;i--;){const n=t[e][i][0].clone(),s=t[e][i][1],o=t[e][i][2],a=t[e][i][3],l=t[e][i][4];n.name=e,n.tag=l,s&&n.position.set(s[0],s[1],s[2]),o&&n.rotation.set(o[0],o[1],o[2]),a&&n.scale.set(a[0],a[1],a[2]),n.updateMatrix();const c=n.geometry.clone();c.applyMatrix4(n.matrix),n.geometry=c,n.renderOrder=1/0,n.position.set(0,0,0),n.rotation.set(0,0,0),n.scale.set(1,1,1),r.add(n)}return r};this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=N(S)),this.add(this.gizmo.rotate=N(E)),this.add(this.gizmo.scale=N(B)),this.add(this.picker.translate=N(C)),this.add(this.picker.rotate=N(P)),this.add(this.picker.scale=N(L)),this.add(this.helper.translate=N(F)),this.add(this.helper.rotate=N(_)),this.add(this.helper.scale=N(R)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}}class pa extends e.Mesh{constructor(){super(new e.PlaneGeometry(1e5,1e5,2,2),new e.MeshBasicMaterial({visible:!1,wireframe:!0,side:e.DoubleSide,transparent:!0,opacity:.1,toneMapped:!1})),p.default(this,"isTransformControlsPlane",!0),p.default(this,"type","TransformControlsPlane"),p.default(this,"unitX",new e.Vector3(1,0,0)),p.default(this,"unitY",new e.Vector3(0,1,0)),p.default(this,"unitZ",new e.Vector3(0,0,1)),p.default(this,"tempVector",new e.Vector3),p.default(this,"dirVector",new e.Vector3),p.default(this,"alignVector",new e.Vector3),p.default(this,"tempMatrix",new e.Matrix4),p.default(this,"identityQuaternion",new e.Quaternion),p.default(this,"cameraQuaternion",new e.Quaternion),p.default(this,"worldPosition",new e.Vector3),p.default(this,"worldQuaternion",new e.Quaternion),p.default(this,"eye",new e.Vector3),p.default(this,"axis",null),p.default(this,"mode","translate"),p.default(this,"space","world"),p.default(this,"updateMatrixWorld",(()=>{let e=this.space;switch(this.position.copy(this.worldPosition),"scale"===this.mode&&(e="local"),this.unitX.set(1,0,0).applyQuaternion("local"===e?this.worldQuaternion:this.identityQuaternion),this.unitY.set(0,1,0).applyQuaternion("local"===e?this.worldQuaternion:this.identityQuaternion),this.unitZ.set(0,0,1).applyQuaternion("local"===e?this.worldQuaternion:this.identityQuaternion),this.alignVector.copy(this.unitY),this.mode){case"translate":case"scale":switch(this.axis){case"X":this.alignVector.copy(this.eye).cross(this.unitX),this.dirVector.copy(this.unitX).cross(this.alignVector);break;case"Y":this.alignVector.copy(this.eye).cross(this.unitY),this.dirVector.copy(this.unitY).cross(this.alignVector);break;case"Z":this.alignVector.copy(this.eye).cross(this.unitZ),this.dirVector.copy(this.unitZ).cross(this.alignVector);break;case"XY":this.dirVector.copy(this.unitZ);break;case"YZ":this.dirVector.copy(this.unitX);break;case"XZ":this.alignVector.copy(this.unitZ),this.dirVector.copy(this.unitY);break;case"XYZ":case"E":this.dirVector.set(0,0,0)}break;case"rotate":default:this.dirVector.set(0,0,0)}0===this.dirVector.length()?this.quaternion.copy(this.cameraQuaternion):(this.tempMatrix.lookAt(this.tempVector.set(0,0,0),this.dirVector,this.alignVector),this.quaternion.setFromRotationMatrix(this.tempMatrix)),super.updateMatrixWorld()}))}}class ma extends e.EventDispatcher{constructor(t,r,i){super(),p.default(this,"enabled",!0),p.default(this,"transformGroup",!1),p.default(this,"_objects",void 0),p.default(this,"_camera",void 0),p.default(this,"_domElement",void 0),p.default(this,"_plane",new e.Plane),p.default(this,"_raycaster",new e.Raycaster),p.default(this,"_mouse",new e.Vector2),p.default(this,"_offset",new e.Vector3),p.default(this,"_intersection",new e.Vector3),p.default(this,"_worldPosition",new e.Vector3),p.default(this,"_inverseMatrix",new e.Matrix4),p.default(this,"_intersections",[]),p.default(this,"_selected",null),p.default(this,"_hovered",null),p.default(this,"activate",(()=>{this._domElement.addEventListener("pointermove",this.onPointerMove),this._domElement.addEventListener("pointerdown",this.onPointerDown),this._domElement.addEventListener("pointerup",this.onPointerCancel),this._domElement.addEventListener("pointerleave",this.onPointerCancel),this._domElement.addEventListener("touchmove",this.onTouchMove),this._domElement.addEventListener("touchstart",this.onTouchStart),this._domElement.addEventListener("touchend",this.onTouchEnd)})),p.default(this,"deactivate",(()=>{this._domElement.removeEventListener("pointermove",this.onPointerMove),this._domElement.removeEventListener("pointerdown",this.onPointerDown),this._domElement.removeEventListener("pointerup",this.onPointerCancel),this._domElement.removeEventListener("pointerleave",this.onPointerCancel),this._domElement.removeEventListener("touchmove",this.onTouchMove),this._domElement.removeEventListener("touchstart",this.onTouchStart),this._domElement.removeEventListener("touchend",this.onTouchEnd),this._domElement.style.cursor=""})),p.default(this,"dispose",(()=>this.deactivate())),p.default(this,"getObjects",(()=>this._objects)),p.default(this,"getRaycaster",(()=>this._raycaster)),p.default(this,"onMouseMove",(e=>{const t=this._domElement.getBoundingClientRect();if(this._mouse.x=(e.clientX-t.left)/t.width*2-1,this._mouse.y=-(e.clientY-t.top)/t.height*2+1,this._raycaster.setFromCamera(this._mouse,this._camera),this._selected&&this.enabled)return this._raycaster.ray.intersectPlane(this._plane,this._intersection)&&this._selected.position.copy(this._intersection.sub(this._offset).applyMatrix4(this._inverseMatrix)),void this.dispatchEvent({type:"drag",object:this._selected});if(this._intersections.length=0,this._raycaster.setFromCamera(this._mouse,this._camera),this._raycaster.intersectObjects(this._objects,!0,this._intersections),this._intersections.length>0){const e=this._intersections[0].object;this._plane.setFromNormalAndCoplanarPoint(this._camera.getWorldDirection(this._plane.normal),this._worldPosition.setFromMatrixPosition(e.matrixWorld)),this._hovered!==e&&(this.dispatchEvent({type:"hoveron",object:e}),this._domElement.style.cursor="pointer",this._hovered=e)}else null!==this._hovered&&(this.dispatchEvent({type:"hoveroff",object:this._hovered}),this._domElement.style.cursor="auto",this._hovered=null)})),p.default(this,"onMouseDown",(()=>{this._intersections.length=0,this._raycaster.setFromCamera(this._mouse,this._camera),this._raycaster.intersectObjects(this._objects,!0,this._intersections),this._intersections.length>0&&(this._selected=!0===this.transformGroup?this._objects[0]:this._intersections[0].object,this._raycaster.ray.intersectPlane(this._plane,this._intersection)&&this._selected.parent&&(this._inverseMatrix.copy(this._selected.parent.matrixWorld).invert(),this._offset.copy(this._intersection).sub(this._worldPosition.setFromMatrixPosition(this._selected.matrixWorld))),this._domElement.style.cursor="move",this.dispatchEvent({type:"dragstart",object:this._selected}))})),p.default(this,"onMouseCancel",(()=>{this._selected&&(this.dispatchEvent({type:"dragend",object:this._selected}),this._selected=null),this._domElement.style.cursor=this._hovered?"pointer":"auto"})),p.default(this,"onPointerMove",(e=>{switch(e.pointerType){case"mouse":case"pen":this.onMouseMove(e)}})),p.default(this,"onPointerDown",(e=>{switch(e.pointerType){case"mouse":case"pen":this.onMouseDown()}})),p.default(this,"onPointerCancel",(e=>{switch(e.pointerType){case"mouse":case"pen":this.onMouseCancel()}})),p.default(this,"onTouchMove",(e=>{e.preventDefault();const t=e.changedTouches[0],r=this._domElement.getBoundingClientRect();if(this._mouse.x=(t.clientX-r.left)/r.width*2-1,this._mouse.y=-(t.clientY-r.top)/r.height*2+1,this._raycaster.setFromCamera(this._mouse,this._camera),this._selected&&this.enabled)return this._raycaster.ray.intersectPlane(this._plane,this._intersection)&&this._selected.position.copy(this._intersection.sub(this._offset).applyMatrix4(this._inverseMatrix)),void this.dispatchEvent({type:"drag",object:this._selected})})),p.default(this,"onTouchStart",(e=>{e.preventDefault();const t=e.changedTouches[0],r=this._domElement.getBoundingClientRect();this._mouse.x=(t.clientX-r.left)/r.width*2-1,this._mouse.y=-(t.clientY-r.top)/r.height*2+1,this._intersections.length=0,this._raycaster.setFromCamera(this._mouse,this._camera),this._raycaster.intersectObjects(this._objects,!0,this._intersections),this._intersections.length>0&&(this._selected=!0===this.transformGroup?this._objects[0]:this._intersections[0].object,this._plane.setFromNormalAndCoplanarPoint(this._camera.getWorldDirection(this._plane.normal),this._worldPosition.setFromMatrixPosition(this._selected.matrixWorld)),this._raycaster.ray.intersectPlane(this._plane,this._intersection)&&this._selected.parent&&(this._inverseMatrix.copy(this._selected.parent.matrixWorld).invert(),this._offset.copy(this._intersection).sub(this._worldPosition.setFromMatrixPosition(this._selected.matrixWorld))),this._domElement.style.cursor="move",this.dispatchEvent({type:"dragstart",object:this._selected}))})),p.default(this,"onTouchEnd",(e=>{e.preventDefault(),this._selected&&(this.dispatchEvent({type:"dragend",object:this._selected}),this._selected=null),this._domElement.style.cursor="auto"})),this._objects=t,this._camera=r,this._domElement=i,this.activate()}}const fa=new e.Euler(0,0,0,"YXZ"),ga=new e.Vector3,va={type:"change"},xa={type:"lock"},ya={type:"unlock"},ba=Math.PI/2;class Aa extends e.EventDispatcher{constructor(t,r){super(),p.default(this,"camera",void 0),p.default(this,"domElement",void 0),p.default(this,"isLocked",void 0),p.default(this,"minPolarAngle",void 0),p.default(this,"maxPolarAngle",void 0),p.default(this,"pointerSpeed",void 0),p.default(this,"onMouseMove",(e=>{if(!this.domElement||!1===this.isLocked)return;const t=e.movementX||e.mozMovementX||e.webkitMovementX||0,r=e.movementY||e.mozMovementY||e.webkitMovementY||0;fa.setFromQuaternion(this.camera.quaternion),fa.y-=.002*t*this.pointerSpeed,fa.x-=.002*r*this.pointerSpeed,fa.x=Math.max(ba-this.maxPolarAngle,Math.min(ba-this.minPolarAngle,fa.x)),this.camera.quaternion.setFromEuler(fa),this.dispatchEvent(va)})),p.default(this,"onPointerlockChange",(()=>{this.domElement&&(this.domElement.ownerDocument.pointerLockElement===this.domElement?(this.dispatchEvent(xa),this.isLocked=!0):(this.dispatchEvent(ya),this.isLocked=!1))})),p.default(this,"onPointerlockError",(()=>{console.error("THREE.PointerLockControls: Unable to use Pointer Lock API")})),p.default(this,"connect",(e=>{this.domElement=e||this.domElement,this.domElement&&(this.domElement.ownerDocument.addEventListener("mousemove",this.onMouseMove),this.domElement.ownerDocument.addEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.addEventListener("pointerlockerror",this.onPointerlockError))})),p.default(this,"disconnect",(()=>{this.domElement&&(this.domElement.ownerDocument.removeEventListener("mousemove",this.onMouseMove),this.domElement.ownerDocument.removeEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.removeEventListener("pointerlockerror",this.onPointerlockError))})),p.default(this,"dispose",(()=>{this.disconnect()})),p.default(this,"getObject",(()=>this.camera)),p.default(this,"direction",new e.Vector3(0,0,-1)),p.default(this,"getDirection",(e=>e.copy(this.direction).applyQuaternion(this.camera.quaternion))),p.default(this,"moveForward",(e=>{ga.setFromMatrixColumn(this.camera.matrix,0),ga.crossVectors(this.camera.up,ga),this.camera.position.addScaledVector(ga,e)})),p.default(this,"moveRight",(e=>{ga.setFromMatrixColumn(this.camera.matrix,0),this.camera.position.addScaledVector(ga,e)})),p.default(this,"lock",(()=>{this.domElement&&this.domElement.requestPointerLock()})),p.default(this,"unlock",(()=>{this.domElement&&this.domElement.ownerDocument.exitPointerLock()})),this.camera=t,this.domElement=r,this.isLocked=!1,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.pointerSpeed=1,r&&this.connect(r)}}class wa extends e.EventDispatcher{constructor(t){super(),p.default(this,"object",void 0),p.default(this,"changeEvent",{type:"change"}),p.default(this,"EPS",1e-6),p.default(this,"enabled",!0),p.default(this,"deviceOrientation",{alpha:0,beta:0,gamma:0}),p.default(this,"screenOrientation",0),p.default(this,"alphaOffset",0),p.default(this,"onDeviceOrientationChangeEvent",(e=>{this.deviceOrientation=e})),p.default(this,"onScreenOrientationChangeEvent",(()=>{this.screenOrientation=window.orientation||0})),p.default(this,"zee",new e.Vector3(0,0,1)),p.default(this,"euler",new e.Euler),p.default(this,"q0",new e.Quaternion),p.default(this,"q1",new e.Quaternion(-Math.sqrt(.5),0,0,Math.sqrt(.5))),p.default(this,"setObjectQuaternion",((e,t,r,i,n)=>{this.euler.set(r,t,-i,"YXZ"),e.setFromEuler(this.euler),e.multiply(this.q1),e.multiply(this.q0.setFromAxisAngle(this.zee,-n))})),p.default(this,"connect",(()=>{this.onScreenOrientationChangeEvent(),void 0!==window.DeviceOrientationEvent&&"function"==typeof window.DeviceOrientationEvent.requestPermission?window.DeviceOrientationEvent.requestPermission().then((e=>{"granted"==e&&(window.addEventListener("orientationchange",this.onScreenOrientationChangeEvent),window.addEventListener("deviceorientation",this.onDeviceOrientationChangeEvent))})).catch((e=>{console.error("THREE.DeviceOrientationControls: Unable to use DeviceOrientation API:",e)})):(window.addEventListener("orientationchange",this.onScreenOrientationChangeEvent),window.addEventListener("deviceorientation",this.onDeviceOrientationChangeEvent)),this.enabled=!0})),p.default(this,"disconnect",(()=>{window.removeEventListener("orientationchange",this.onScreenOrientationChangeEvent),window.removeEventListener("deviceorientation",this.onDeviceOrientationChangeEvent),this.enabled=!1})),p.default(this,"lastQuaternion",new e.Quaternion),p.default(this,"update",(()=>{if(!1===this.enabled)return;const t=this.deviceOrientation;if(t){const r=t.alpha?e.MathUtils.degToRad(t.alpha)+this.alphaOffset:0,i=t.beta?e.MathUtils.degToRad(t.beta):0,n=t.gamma?e.MathUtils.degToRad(t.gamma):0,s=this.screenOrientation?e.MathUtils.degToRad(this.screenOrientation):0;this.setObjectQuaternion(this.object.quaternion,r,i,n,s),8*(1-this.lastQuaternion.dot(this.object.quaternion))>this.EPS&&(this.lastQuaternion.copy(this.object.quaternion),this.dispatchEvent(this.changeEvent))}})),p.default(this,"dispose",(()=>this.disconnect())),this.object=t,this.object.rotation.reorder("YXZ"),this.connect()}}class Ma extends e.EventDispatcher{constructor(t,r){super(),p.default(this,"enabled",!0),p.default(this,"screen",{left:0,top:0,width:0,height:0}),p.default(this,"rotateSpeed",1),p.default(this,"zoomSpeed",1.2),p.default(this,"panSpeed",.3),p.default(this,"noRotate",!1),p.default(this,"noZoom",!1),p.default(this,"noPan",!1),p.default(this,"staticMoving",!1),p.default(this,"dynamicDampingFactor",.2),p.default(this,"minDistance",0),p.default(this,"maxDistance",1/0),p.default(this,"keys",["KeyA","KeyS","KeyD"]),p.default(this,"mouseButtons",{LEFT:e.MOUSE.ROTATE,MIDDLE:e.MOUSE.DOLLY,RIGHT:e.MOUSE.PAN}),p.default(this,"object",void 0),p.default(this,"domElement",void 0),p.default(this,"cursorZoom",!1),p.default(this,"target",new e.Vector3),p.default(this,"mousePosition",new e.Vector2),p.default(this,"STATE",{NONE:-1,ROTATE:0,ZOOM:1,PAN:2,TOUCH_ROTATE:3,TOUCH_ZOOM_PAN:4}),p.default(this,"EPS",1e-6),p.default(this,"lastZoom",1),p.default(this,"lastPosition",new e.Vector3),p.default(this,"cursorVector",new e.Vector3),p.default(this,"targetVector",new e.Vector3),p.default(this,"_state",this.STATE.NONE),p.default(this,"_keyState",this.STATE.NONE),p.default(this,"_eye",new e.Vector3),p.default(this,"_movePrev",new e.Vector2),p.default(this,"_moveCurr",new e.Vector2),p.default(this,"_lastAxis",new e.Vector3),p.default(this,"_lastAngle",0),p.default(this,"_zoomStart",new e.Vector2),p.default(this,"_zoomEnd",new e.Vector2),p.default(this,"_touchZoomDistanceStart",0),p.default(this,"_touchZoomDistanceEnd",0),p.default(this,"_panStart",new e.Vector2),p.default(this,"_panEnd",new e.Vector2),p.default(this,"target0",void 0),p.default(this,"position0",void 0),p.default(this,"up0",void 0),p.default(this,"zoom0",void 0),p.default(this,"changeEvent",{type:"change"}),p.default(this,"startEvent",{type:"start"}),p.default(this,"endEvent",{type:"end"}),p.default(this,"onScreenVector",new e.Vector2),p.default(this,"getMouseOnScreen",((e,t)=>(this.onScreenVector.set((e-this.screen.left)/this.screen.width,(t-this.screen.top)/this.screen.height),this.onScreenVector))),p.default(this,"onCircleVector",new e.Vector2),p.default(this,"getMouseOnCircle",((e,t)=>(this.onCircleVector.set((e-.5*this.screen.width-this.screen.left)/(.5*this.screen.width),(this.screen.height+2*(this.screen.top-t))/this.screen.width),this.onCircleVector))),p.default(this,"axis",new e.Vector3),p.default(this,"quaternion",new e.Quaternion),p.default(this,"eyeDirection",new e.Vector3),p.default(this,"objectUpDirection",new e.Vector3),p.default(this,"objectSidewaysDirection",new e.Vector3),p.default(this,"moveDirection",new e.Vector3),p.default(this,"angle",0),p.default(this,"rotateCamera",(()=>{this.moveDirection.set(this._moveCurr.x-this._movePrev.x,this._moveCurr.y-this._movePrev.y,0),this.angle=this.moveDirection.length(),this.angle?(this._eye.copy(this.object.position).sub(this.target),this.eyeDirection.copy(this._eye).normalize(),this.objectUpDirection.copy(this.object.up).normalize(),this.objectSidewaysDirection.crossVectors(this.objectUpDirection,this.eyeDirection).normalize(),this.objectUpDirection.setLength(this._moveCurr.y-this._movePrev.y),this.objectSidewaysDirection.setLength(this._moveCurr.x-this._movePrev.x),this.moveDirection.copy(this.objectUpDirection.add(this.objectSidewaysDirection)),this.axis.crossVectors(this.moveDirection,this._eye).normalize(),this.angle*=this.rotateSpeed,this.quaternion.setFromAxisAngle(this.axis,this.angle),this._eye.applyQuaternion(this.quaternion),this.object.up.applyQuaternion(this.quaternion),this._lastAxis.copy(this.axis),this._lastAngle=this.angle):!this.staticMoving&&this._lastAngle&&(this._lastAngle*=Math.sqrt(1-this.dynamicDampingFactor),this._eye.copy(this.object.position).sub(this.target),this.quaternion.setFromAxisAngle(this._lastAxis,this._lastAngle),this._eye.applyQuaternion(this.quaternion),this.object.up.applyQuaternion(this.quaternion)),this._movePrev.copy(this._moveCurr)})),p.default(this,"zoomCamera",(()=>{let e;if(this._state===this.STATE.TOUCH_ZOOM_PAN)e=this._touchZoomDistanceStart/this._touchZoomDistanceEnd,this._touchZoomDistanceStart=this._touchZoomDistanceEnd,this.object.isPerspectiveCamera?this._eye.multiplyScalar(e):this.object.isOrthographicCamera?(this.object.zoom/=e,this.object.updateProjectionMatrix()):console.warn("THREE.TrackballControls: Unsupported camera type");else{if(e=1+(this._zoomEnd.y-this._zoomStart.y)*this.zoomSpeed,Math.abs(e-1)>this.EPS&&e>0&&(this.object.isPerspectiveCamera?(e>1&&this._eye.length()>=this.maxDistance-this.EPS&&(e=1),this._eye.multiplyScalar(e)):this.object.isOrthographicCamera?(e>1&&this.object.zoom<this.maxDistance*this.maxDistance&&(e=1),this.object.zoom/=e):console.warn("THREE.TrackballControls: Unsupported camera type")),this.staticMoving?this._zoomStart.copy(this._zoomEnd):this._zoomStart.y+=(this._zoomEnd.y-this._zoomStart.y)*this.dynamicDampingFactor,this.cursorZoom){this.targetVector.copy(this.target).project(this.object);let t=this.cursorVector.set(this.mousePosition.x,this.mousePosition.y,this.targetVector.z).unproject(this.object);this.target.lerpVectors(t,this.target,e)}this.object.isOrthographicCamera&&this.object.updateProjectionMatrix()}})),p.default(this,"mouseChange",new e.Vector2),p.default(this,"objectUp",new e.Vector3),p.default(this,"pan",new e.Vector3),p.default(this,"panCamera",(()=>{if(this.domElement&&(this.mouseChange.copy(this._panEnd).sub(this._panStart),this.mouseChange.lengthSq()>this.EPS)){if(this.object.isOrthographicCamera){const e=this.object,t=(e.right-e.left)/this.object.zoom,r=(e.top-e.bottom)/this.object.zoom;this.mouseChange.x*=t,this.mouseChange.y*=r}else this.mouseChange.multiplyScalar(this._eye.length()*this.panSpeed);this.pan.copy(this._eye).cross(this.object.up).setLength(this.mouseChange.x),this.pan.add(this.objectUp.copy(this.object.up).setLength(this.mouseChange.y)),this.object.position.add(this.pan),this.target.add(this.pan),this.staticMoving?this._panStart.copy(this._panEnd):this._panStart.add(this.mouseChange.subVectors(this._panEnd,this._panStart).multiplyScalar(this.dynamicDampingFactor))}})),p.default(this,"checkDistances",(()=>{this.noZoom&&this.noPan||(this._eye.lengthSq()>this.maxDistance*this.maxDistance&&(this.object.position.addVectors(this.target,this._eye.setLength(this.maxDistance)),this._zoomStart.copy(this._zoomEnd)),this._eye.lengthSq()<this.minDistance*this.minDistance&&(this.object.position.addVectors(this.target,this._eye.setLength(this.minDistance)),this._zoomStart.copy(this._zoomEnd)))})),p.default(this,"handleResize",(()=>{if(!this.domElement)return;const e=this.domElement.getBoundingClientRect(),t=this.domElement.ownerDocument.documentElement;this.screen.left=e.left+window.pageXOffset-t.clientLeft,this.screen.top=e.top+window.pageYOffset-t.clientTop,this.screen.width=e.width,this.screen.height=e.height})),p.default(this,"update",(()=>{this._eye.subVectors(this.object.position,this.target),this.noRotate||this.rotateCamera(),this.noZoom||this.zoomCamera(),this.noPan||this.panCamera(),this.object.position.addVectors(this.target,this._eye),this.object.isPerspectiveCamera?(this.checkDistances(),this.object.lookAt(this.target),this.lastPosition.distanceToSquared(this.object.position)>this.EPS&&(this.dispatchEvent(this.changeEvent),this.lastPosition.copy(this.object.position))):this.object.isOrthographicCamera?(this.object.lookAt(this.target),(this.lastPosition.distanceToSquared(this.object.position)>this.EPS||this.lastZoom!==this.object.zoom)&&(this.dispatchEvent(this.changeEvent),this.lastPosition.copy(this.object.position),this.lastZoom=this.object.zoom)):console.warn("THREE.TrackballControls: Unsupported camera type")})),p.default(this,"reset",(()=>{this._state=this.STATE.NONE,this._keyState=this.STATE.NONE,this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.up.copy(this.up0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this._eye.subVectors(this.object.position,this.target),this.object.lookAt(this.target),this.dispatchEvent(this.changeEvent),this.lastPosition.copy(this.object.position),this.lastZoom=this.object.zoom})),p.default(this,"keydown",(e=>{!1!==this.enabled&&(window.removeEventListener("keydown",this.keydown),this._keyState===this.STATE.NONE&&(e.code!==this.keys[this.STATE.ROTATE]||this.noRotate?e.code!==this.keys[this.STATE.ZOOM]||this.noZoom?e.code!==this.keys[this.STATE.PAN]||this.noPan||(this._keyState=this.STATE.PAN):this._keyState=this.STATE.ZOOM:this._keyState=this.STATE.ROTATE))})),p.default(this,"onPointerDown",(e=>{if(!1!==this.enabled)switch(e.pointerType){case"mouse":case"pen":this.onMouseDown(e)}})),p.default(this,"onPointerMove",(e=>{if(!1!==this.enabled)switch(e.pointerType){case"mouse":case"pen":this.onMouseMove(e)}})),p.default(this,"onPointerUp",(e=>{if(!1!==this.enabled)switch(e.pointerType){case"mouse":case"pen":this.onMouseUp()}})),p.default(this,"keyup",(()=>{!1!==this.enabled&&(this._keyState=this.STATE.NONE,window.addEventListener("keydown",this.keydown))})),p.default(this,"onMouseDown",(e=>{if(!this.domElement)return;if(this._state===this.STATE.NONE)switch(e.button){case this.mouseButtons.LEFT:this._state=this.STATE.ROTATE;break;case this.mouseButtons.MIDDLE:this._state=this.STATE.ZOOM;break;case this.mouseButtons.RIGHT:this._state=this.STATE.PAN;break;default:this._state=this.STATE.NONE}const t=this._keyState!==this.STATE.NONE?this._keyState:this._state;t!==this.STATE.ROTATE||this.noRotate?t!==this.STATE.ZOOM||this.noZoom?t!==this.STATE.PAN||this.noPan||(this._panStart.copy(this.getMouseOnScreen(e.pageX,e.pageY)),this._panEnd.copy(this._panStart)):(this._zoomStart.copy(this.getMouseOnScreen(e.pageX,e.pageY)),this._zoomEnd.copy(this._zoomStart)):(this._moveCurr.copy(this.getMouseOnCircle(e.pageX,e.pageY)),this._movePrev.copy(this._moveCurr)),this.domElement.ownerDocument.addEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this.onPointerUp),this.dispatchEvent(this.startEvent)})),p.default(this,"onMouseMove",(e=>{if(!1===this.enabled)return;const t=this._keyState!==this.STATE.NONE?this._keyState:this._state;t!==this.STATE.ROTATE||this.noRotate?t!==this.STATE.ZOOM||this.noZoom?t!==this.STATE.PAN||this.noPan||this._panEnd.copy(this.getMouseOnScreen(e.pageX,e.pageY)):this._zoomEnd.copy(this.getMouseOnScreen(e.pageX,e.pageY)):(this._movePrev.copy(this._moveCurr),this._moveCurr.copy(this.getMouseOnCircle(e.pageX,e.pageY)))})),p.default(this,"onMouseUp",(()=>{this.domElement&&!1!==this.enabled&&(this._state=this.STATE.NONE,this.domElement.ownerDocument.removeEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this.onPointerUp),this.dispatchEvent(this.endEvent))})),p.default(this,"mousewheel",(e=>{if(!1!==this.enabled&&!0!==this.noZoom){switch(e.preventDefault(),e.deltaMode){case 2:this._zoomStart.y-=.025*e.deltaY;break;case 1:this._zoomStart.y-=.01*e.deltaY;break;default:this._zoomStart.y-=25e-5*e.deltaY}this.mousePosition.x=e.offsetX/this.screen.width*2-1,this.mousePosition.y=-e.offsetY/this.screen.height*2+1,this.dispatchEvent(this.startEvent),this.dispatchEvent(this.endEvent)}})),p.default(this,"touchstart",(e=>{if(!1!==this.enabled){switch(e.preventDefault(),e.touches.length){case 1:this._state=this.STATE.TOUCH_ROTATE,this._moveCurr.copy(this.getMouseOnCircle(e.touches[0].pageX,e.touches[0].pageY)),this._movePrev.copy(this._moveCurr);break;default:this._state=this.STATE.TOUCH_ZOOM_PAN;const t=e.touches[0].pageX-e.touches[1].pageX,r=e.touches[0].pageY-e.touches[1].pageY;this._touchZoomDistanceEnd=this._touchZoomDistanceStart=Math.sqrt(t*t+r*r);const i=(e.touches[0].pageX+e.touches[1].pageX)/2,n=(e.touches[0].pageY+e.touches[1].pageY)/2;this._panStart.copy(this.getMouseOnScreen(i,n)),this._panEnd.copy(this._panStart)}this.dispatchEvent(this.startEvent)}})),p.default(this,"touchmove",(e=>{if(!1!==this.enabled)switch(e.preventDefault(),e.touches.length){case 1:this._movePrev.copy(this._moveCurr),this._moveCurr.copy(this.getMouseOnCircle(e.touches[0].pageX,e.touches[0].pageY));break;default:const t=e.touches[0].pageX-e.touches[1].pageX,r=e.touches[0].pageY-e.touches[1].pageY;this._touchZoomDistanceEnd=Math.sqrt(t*t+r*r);const i=(e.touches[0].pageX+e.touches[1].pageX)/2,n=(e.touches[0].pageY+e.touches[1].pageY)/2;this._panEnd.copy(this.getMouseOnScreen(i,n))}})),p.default(this,"touchend",(e=>{if(!1!==this.enabled){switch(e.touches.length){case 0:this._state=this.STATE.NONE;break;case 1:this._state=this.STATE.TOUCH_ROTATE,this._moveCurr.copy(this.getMouseOnCircle(e.touches[0].pageX,e.touches[0].pageY)),this._movePrev.copy(this._moveCurr)}this.dispatchEvent(this.endEvent)}})),p.default(this,"contextmenu",(e=>{!1!==this.enabled&&e.preventDefault()})),p.default(this,"connect",(e=>{e===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.domElement=e,this.domElement.addEventListener("contextmenu",this.contextmenu),this.domElement.addEventListener("pointerdown",this.onPointerDown),this.domElement.addEventListener("wheel",this.mousewheel),this.domElement.addEventListener("touchstart",this.touchstart),this.domElement.addEventListener("touchend",this.touchend),this.domElement.addEventListener("touchmove",this.touchmove),this.domElement.ownerDocument.addEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this.onPointerUp),window.addEventListener("keydown",this.keydown),window.addEventListener("keyup",this.keyup),this.handleResize()})),p.default(this,"dispose",(()=>{this.domElement&&(this.domElement.removeEventListener("contextmenu",this.contextmenu),this.domElement.removeEventListener("pointerdown",this.onPointerDown),this.domElement.removeEventListener("wheel",this.mousewheel),this.domElement.removeEventListener("touchstart",this.touchstart),this.domElement.removeEventListener("touchend",this.touchend),this.domElement.removeEventListener("touchmove",this.touchmove),this.domElement.ownerDocument.removeEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this.onPointerUp),window.removeEventListener("keydown",this.keydown),window.removeEventListener("keyup",this.keyup))})),this.object=t,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.up0=this.object.up.clone(),this.zoom0=this.object.zoom,void 0!==r&&this.connect(r),this.update()}}const Ta=(e,t)=>(e%t+t)%t;class Sa extends e.EventDispatcher{constructor(t,r){super(),p.default(this,"object",void 0),p.default(this,"domElement",void 0),p.default(this,"enabled",!0),p.default(this,"target",new e.Vector3),p.default(this,"minDistance",0),p.default(this,"maxDistance",1/0),p.default(this,"minZoom",0),p.default(this,"maxZoom",1/0),p.default(this,"minPolarAngle",0),p.default(this,"maxPolarAngle",Math.PI),p.default(this,"minAzimuthAngle",-1/0),p.default(this,"maxAzimuthAngle",1/0),p.default(this,"enableDamping",!1),p.default(this,"dampingFactor",.05),p.default(this,"enableZoom",!0),p.default(this,"zoomSpeed",1),p.default(this,"enableRotate",!0),p.default(this,"rotateSpeed",1),p.default(this,"enablePan",!0),p.default(this,"panSpeed",1),p.default(this,"screenSpacePanning",!0),p.default(this,"keyPanSpeed",7),p.default(this,"autoRotate",!1),p.default(this,"autoRotateSpeed",2),p.default(this,"reverseOrbit",!1),p.default(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),p.default(this,"mouseButtons",{LEFT:e.MOUSE.ROTATE,MIDDLE:e.MOUSE.DOLLY,RIGHT:e.MOUSE.PAN}),p.default(this,"touches",{ONE:e.TOUCH.ROTATE,TWO:e.TOUCH.DOLLY_PAN}),p.default(this,"target0",void 0),p.default(this,"position0",void 0),p.default(this,"zoom0",void 0),p.default(this,"_domElementKeyEvents",null),p.default(this,"getPolarAngle",void 0),p.default(this,"getAzimuthalAngle",void 0),p.default(this,"setPolarAngle",void 0),p.default(this,"setAzimuthalAngle",void 0),p.default(this,"getDistance",void 0),p.default(this,"listenToKeyEvents",void 0),p.default(this,"saveState",void 0),p.default(this,"reset",void 0),p.default(this,"update",void 0),p.default(this,"connect",void 0),p.default(this,"dispose",void 0),this.object=t,this.domElement=r,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object instanceof e.PerspectiveCamera?this.object.zoom:1,this.getPolarAngle=()=>h.phi,this.getAzimuthalAngle=()=>h.theta,this.setPolarAngle=e=>{let t=Ta(e,2*Math.PI),r=h.phi;r<0&&(r+=2*Math.PI),t<0&&(t+=2*Math.PI);let n=Math.abs(t-r);2*Math.PI-n<n&&(t<r?t+=2*Math.PI:r+=2*Math.PI),u.phi=t-r,i.update()},this.setAzimuthalAngle=e=>{let t=Ta(e,2*Math.PI),r=h.theta;r<0&&(r+=2*Math.PI),t<0&&(t+=2*Math.PI);let n=Math.abs(t-r);2*Math.PI-n<n&&(t<r?t+=2*Math.PI:r+=2*Math.PI),u.theta=t-r,i.update()},this.getDistance=()=>i.object.position.distanceTo(i.target),this.listenToKeyEvents=e=>{e.addEventListener("keydown",Y),this._domElementKeyEvents=e},this.saveState=()=>{i.target0.copy(i.target),i.position0.copy(i.object.position),i.zoom0=i.object instanceof e.PerspectiveCamera?i.object.zoom:1},this.reset=()=>{i.target.copy(i.target0),i.object.position.copy(i.position0),i.object instanceof e.PerspectiveCamera&&(i.object.zoom=i.zoom0,i.object.updateProjectionMatrix()),i.dispatchEvent(n),i.update(),l=a.NONE},this.update=(()=>{const r=new e.Vector3,s=(new e.Quaternion).setFromUnitVectors(t.up,new e.Vector3(0,1,0)),o=s.clone().invert(),p=new e.Vector3,g=new e.Quaternion,v=2*Math.PI;return function(){const e=i.object.position;r.copy(e).sub(i.target),r.applyQuaternion(s),h.setFromVector3(r),i.autoRotate&&l===a.NONE&&E(2*Math.PI/60/60*i.autoRotateSpeed),i.enableDamping?(h.theta+=u.theta*i.dampingFactor,h.phi+=u.phi*i.dampingFactor):(h.theta+=u.theta,h.phi+=u.phi);let t=i.minAzimuthAngle,x=i.maxAzimuthAngle;return isFinite(t)&&isFinite(x)&&(t<-Math.PI?t+=v:t>Math.PI&&(t-=v),x<-Math.PI?x+=v:x>Math.PI&&(x-=v),h.theta=t<=x?Math.max(t,Math.min(x,h.theta)):h.theta>(t+x)/2?Math.max(t,h.theta):Math.min(x,h.theta)),h.phi=Math.max(i.minPolarAngle,Math.min(i.maxPolarAngle,h.phi)),h.makeSafe(),h.radius*=d,h.radius=Math.max(i.minDistance,Math.min(i.maxDistance,h.radius)),!0===i.enableDamping?i.target.addScaledVector(m,i.dampingFactor):i.target.add(m),r.setFromSpherical(h),r.applyQuaternion(o),e.copy(i.target).add(r),i.object.lookAt(i.target),!0===i.enableDamping?(u.theta*=1-i.dampingFactor,u.phi*=1-i.dampingFactor,m.multiplyScalar(1-i.dampingFactor)):(u.set(0,0,0),m.set(0,0,0)),d=1,!!(f||p.distanceToSquared(i.object.position)>c||8*(1-g.dot(i.object.quaternion))>c)&&(i.dispatchEvent(n),p.copy(i.object.position),g.copy(i.object.quaternion),f=!1,!0)}})(),this.connect=e=>{e===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),i.domElement=e,i.domElement.style.touchAction="none",i.domElement.addEventListener("contextmenu",K),i.domElement.addEventListener("pointerdown",H),i.domElement.addEventListener("pointercancel",X),i.domElement.addEventListener("wheel",Q)},this.dispose=()=>{var e,t,r,n,s,o;null===(e=i.domElement)||void 0===e||e.removeEventListener("contextmenu",K),null===(t=i.domElement)||void 0===t||t.removeEventListener("pointerdown",H),null===(r=i.domElement)||void 0===r||r.removeEventListener("pointercancel",X),null===(n=i.domElement)||void 0===n||n.removeEventListener("wheel",Q),null===(s=i.domElement)||void 0===s||s.ownerDocument.removeEventListener("pointermove",j),null===(o=i.domElement)||void 0===o||o.ownerDocument.removeEventListener("pointerup",W),null!==i._domElementKeyEvents&&i._domElementKeyEvents.removeEventListener("keydown",Y)};const i=this,n={type:"change"},s={type:"start"},o={type:"end"},a={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let l=a.NONE;const c=1e-6,h=new e.Spherical,u=new e.Spherical;let d=1;const m=new e.Vector3;let f=!1;const g=new e.Vector2,v=new e.Vector2,x=new e.Vector2,y=new e.Vector2,b=new e.Vector2,A=new e.Vector2,w=new e.Vector2,M=new e.Vector2,T=new e.Vector2,S=[],C={};function F(){return Math.pow(.95,i.zoomSpeed)}function E(e){i.reverseOrbit?u.theta+=e:u.theta-=e}function _(e){i.reverseOrbit?u.phi+=e:u.phi-=e}const P=(()=>{const t=new e.Vector3;return function(e,r){t.setFromMatrixColumn(r,0),t.multiplyScalar(-e),m.add(t)}})(),B=(()=>{const t=new e.Vector3;return function(e,r){!0===i.screenSpacePanning?t.setFromMatrixColumn(r,1):(t.setFromMatrixColumn(r,0),t.crossVectors(i.object.up,t)),t.multiplyScalar(e),m.add(t)}})(),L=(()=>{const t=new e.Vector3;return function(r,n){const s=i.domElement;if(s&&i.object instanceof e.PerspectiveCamera&&i.object.isPerspectiveCamera){const e=i.object.position;t.copy(e).sub(i.target);let o=t.length();o*=Math.tan(i.object.fov/2*Math.PI/180),P(2*r*o/s.clientHeight,i.object.matrix),B(2*n*o/s.clientHeight,i.object.matrix)}else s&&i.object instanceof e.OrthographicCamera&&i.object.isOrthographicCamera?(P(r*(i.object.right-i.object.left)/i.object.zoom/s.clientWidth,i.object.matrix),B(n*(i.object.top-i.object.bottom)/i.object.zoom/s.clientHeight,i.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),i.enablePan=!1)}})();function R(t){i.object instanceof e.PerspectiveCamera&&i.object.isPerspectiveCamera?d/=t:i.object instanceof e.OrthographicCamera&&i.object.isOrthographicCamera?(i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom*t)),i.object.updateProjectionMatrix(),f=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function N(t){i.object instanceof e.PerspectiveCamera&&i.object.isPerspectiveCamera?d*=t:i.object instanceof e.OrthographicCamera&&i.object.isOrthographicCamera?(i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom/t)),i.object.updateProjectionMatrix(),f=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function D(e){g.set(e.clientX,e.clientY)}function I(e){y.set(e.clientX,e.clientY)}function U(){if(1==S.length)g.set(S[0].pageX,S[0].pageY);else{const e=.5*(S[0].pageX+S[1].pageX),t=.5*(S[0].pageY+S[1].pageY);g.set(e,t)}}function O(){if(1==S.length)y.set(S[0].pageX,S[0].pageY);else{const e=.5*(S[0].pageX+S[1].pageX),t=.5*(S[0].pageY+S[1].pageY);y.set(e,t)}}function k(){const e=S[0].pageX-S[1].pageX,t=S[0].pageY-S[1].pageY,r=Math.sqrt(e*e+t*t);w.set(0,r)}function V(e){if(1==S.length)v.set(e.pageX,e.pageY);else{const t=Z(e),r=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);v.set(r,i)}x.subVectors(v,g).multiplyScalar(i.rotateSpeed);const t=i.domElement;t&&(E(2*Math.PI*x.x/t.clientHeight),_(2*Math.PI*x.y/t.clientHeight)),g.copy(v)}function G(e){if(1==S.length)b.set(e.pageX,e.pageY);else{const t=Z(e),r=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);b.set(r,i)}A.subVectors(b,y).multiplyScalar(i.panSpeed),L(A.x,A.y),y.copy(b)}function z(e){const t=Z(e),r=e.pageX-t.x,n=e.pageY-t.y,s=Math.sqrt(r*r+n*n);M.set(0,s),T.set(0,Math.pow(M.y/w.y,i.zoomSpeed)),R(T.y),w.copy(M)}function H(t){if(!1!==i.enabled){var r,n;if(0===S.length)null===(r=i.domElement)||void 0===r||r.ownerDocument.addEventListener("pointermove",j),null===(n=i.domElement)||void 0===n||n.ownerDocument.addEventListener("pointerup",W);!function(e){S.push(e)}(t),"touch"===t.pointerType?function(t){switch(J(t),S.length){case 1:switch(i.touches.ONE){case e.TOUCH.ROTATE:if(!1===i.enableRotate)return;U(),l=a.TOUCH_ROTATE;break;case e.TOUCH.PAN:if(!1===i.enablePan)return;O(),l=a.TOUCH_PAN;break;default:l=a.NONE}break;case 2:switch(i.touches.TWO){case e.TOUCH.DOLLY_PAN:if(!1===i.enableZoom&&!1===i.enablePan)return;i.enableZoom&&k(),i.enablePan&&O(),l=a.TOUCH_DOLLY_PAN;break;case e.TOUCH.DOLLY_ROTATE:if(!1===i.enableZoom&&!1===i.enableRotate)return;i.enableZoom&&k(),i.enableRotate&&U(),l=a.TOUCH_DOLLY_ROTATE;break;default:l=a.NONE}break;default:l=a.NONE}l!==a.NONE&&i.dispatchEvent(s)}(t):function(t){let r;switch(t.button){case 0:r=i.mouseButtons.LEFT;break;case 1:r=i.mouseButtons.MIDDLE;break;case 2:r=i.mouseButtons.RIGHT;break;default:r=-1}switch(r){case e.MOUSE.DOLLY:if(!1===i.enableZoom)return;!function(e){w.set(e.clientX,e.clientY)}(t),l=a.DOLLY;break;case e.MOUSE.ROTATE:if(t.ctrlKey||t.metaKey||t.shiftKey){if(!1===i.enablePan)return;I(t),l=a.PAN}else{if(!1===i.enableRotate)return;D(t),l=a.ROTATE}break;case e.MOUSE.PAN:if(t.ctrlKey||t.metaKey||t.shiftKey){if(!1===i.enableRotate)return;D(t),l=a.ROTATE}else{if(!1===i.enablePan)return;I(t),l=a.PAN}break;default:l=a.NONE}l!==a.NONE&&i.dispatchEvent(s)}(t)}}function j(e){!1!==i.enabled&&("touch"===e.pointerType?function(e){switch(J(e),l){case a.TOUCH_ROTATE:if(!1===i.enableRotate)return;V(e),i.update();break;case a.TOUCH_PAN:if(!1===i.enablePan)return;G(e),i.update();break;case a.TOUCH_DOLLY_PAN:if(!1===i.enableZoom&&!1===i.enablePan)return;!function(e){i.enableZoom&&z(e),i.enablePan&&G(e)}(e),i.update();break;case a.TOUCH_DOLLY_ROTATE:if(!1===i.enableZoom&&!1===i.enableRotate)return;!function(e){i.enableZoom&&z(e),i.enableRotate&&V(e)}(e),i.update();break;default:l=a.NONE}}(e):function(e){if(!1===i.enabled)return;switch(l){case a.ROTATE:if(!1===i.enableRotate)return;!function(e){v.set(e.clientX,e.clientY),x.subVectors(v,g).multiplyScalar(i.rotateSpeed);const t=i.domElement;t&&(E(2*Math.PI*x.x/t.clientHeight),_(2*Math.PI*x.y/t.clientHeight)),g.copy(v),i.update()}(e);break;case a.DOLLY:if(!1===i.enableZoom)return;!function(e){M.set(e.clientX,e.clientY),T.subVectors(M,w),T.y>0?R(F()):T.y<0&&N(F()),w.copy(M),i.update()}(e);break;case a.PAN:if(!1===i.enablePan)return;!function(e){b.set(e.clientX,e.clientY),A.subVectors(b,y).multiplyScalar(i.panSpeed),L(A.x,A.y),y.copy(b),i.update()}(e)}}(e))}function W(e){var t,r,n;(q(e),0===S.length)&&(null===(t=i.domElement)||void 0===t||t.releasePointerCapture(e.pointerId),null===(r=i.domElement)||void 0===r||r.ownerDocument.removeEventListener("pointermove",j),null===(n=i.domElement)||void 0===n||n.ownerDocument.removeEventListener("pointerup",W));i.dispatchEvent(o),l=a.NONE}function X(e){q(e)}function Q(e){!1===i.enabled||!1===i.enableZoom||l!==a.NONE&&l!==a.ROTATE||(e.preventDefault(),i.dispatchEvent(s),function(e){e.deltaY<0?N(F()):e.deltaY>0&&R(F()),i.update()}(e),i.dispatchEvent(o))}function Y(e){!1!==i.enabled&&!1!==i.enablePan&&function(e){let t=!1;switch(e.code){case i.keys.UP:L(0,i.keyPanSpeed),t=!0;break;case i.keys.BOTTOM:L(0,-i.keyPanSpeed),t=!0;break;case i.keys.LEFT:L(i.keyPanSpeed,0),t=!0;break;case i.keys.RIGHT:L(-i.keyPanSpeed,0),t=!0}t&&(e.preventDefault(),i.update())}(e)}function K(e){!1!==i.enabled&&e.preventDefault()}function q(e){delete C[e.pointerId];for(let t=0;t<S.length;t++)if(S[t].pointerId==e.pointerId)return void S.splice(t,1)}function J(t){let r=C[t.pointerId];void 0===r&&(r=new e.Vector2,C[t.pointerId]=r),r.set(t.pageX,t.pageY)}function Z(e){const t=e.pointerId===S[0].pointerId?S[1]:S[0];return C[t.pointerId]}void 0!==r&&this.connect(r),this.update()}}const Ca={IDLE:Symbol(),ROTATE:Symbol(),PAN:Symbol(),SCALE:Symbol(),FOV:Symbol(),FOCUS:Symbol(),ZROTATE:Symbol(),TOUCH_MULTI:Symbol(),ANIMATION_FOCUS:Symbol(),ANIMATION_ROTATE:Symbol()},Fa={NONE:Symbol(),ONE_FINGER:Symbol(),ONE_FINGER_SWITCHED:Symbol(),TWO_FINGER:Symbol(),MULT_FINGER:Symbol(),CURSOR:Symbol()},Ea={x:0,y:0},_a={camera:new e.Matrix4,gizmos:new e.Matrix4},Pa={type:"change"},Ba={type:"start"},La={type:"end"};class Ra extends e.EventDispatcher{constructor(t,r=null,i=null){super(),p.default(this,"camera",void 0),p.default(this,"domElement",void 0),p.default(this,"scene",void 0),p.default(this,"mouseActions",void 0),p.default(this,"_mouseOp",void 0),p.default(this,"_v2_1",void 0),p.default(this,"_v3_1",void 0),p.default(this,"_v3_2",void 0),p.default(this,"_m4_1",void 0),p.default(this,"_m4_2",void 0),p.default(this,"_quat",void 0),p.default(this,"_translationMatrix",void 0),p.default(this,"_rotationMatrix",void 0),p.default(this,"_scaleMatrix",void 0),p.default(this,"_rotationAxis",void 0),p.default(this,"_cameraMatrixState",void 0),p.default(this,"_cameraProjectionState",void 0),p.default(this,"_fovState",void 0),p.default(this,"_upState",void 0),p.default(this,"_zoomState",void 0),p.default(this,"_nearPos",void 0),p.default(this,"_farPos",void 0),p.default(this,"_gizmoMatrixState",void 0),p.default(this,"_up0",void 0),p.default(this,"_zoom0",void 0),p.default(this,"_fov0",void 0),p.default(this,"_initialNear",void 0),p.default(this,"_nearPos0",void 0),p.default(this,"_initialFar",void 0),p.default(this,"_farPos0",void 0),p.default(this,"_cameraMatrixState0",void 0),p.default(this,"_gizmoMatrixState0",void 0),p.default(this,"_button",void 0),p.default(this,"_touchStart",void 0),p.default(this,"_touchCurrent",void 0),p.default(this,"_input",void 0),p.default(this,"_switchSensibility",void 0),p.default(this,"_startFingerDistance",void 0),p.default(this,"_currentFingerDistance",void 0),p.default(this,"_startFingerRotation",void 0),p.default(this,"_currentFingerRotation",void 0),p.default(this,"_devPxRatio",void 0),p.default(this,"_downValid",void 0),p.default(this,"_nclicks",void 0),p.default(this,"_downEvents",void 0),p.default(this,"_clickStart",void 0),p.default(this,"_maxDownTime",void 0),p.default(this,"_maxInterval",void 0),p.default(this,"_posThreshold",void 0),p.default(this,"_movementThreshold",void 0),p.default(this,"_currentCursorPosition",void 0),p.default(this,"_startCursorPosition",void 0),p.default(this,"_grid",void 0),p.default(this,"_gridPosition",void 0),p.default(this,"_gizmos",void 0),p.default(this,"_curvePts",void 0),p.default(this,"_timeStart",void 0),p.default(this,"_animationId",void 0),p.default(this,"focusAnimationTime",void 0),p.default(this,"_timePrev",void 0),p.default(this,"_timeCurrent",void 0),p.default(this,"_anglePrev",void 0),p.default(this,"_angleCurrent",void 0),p.default(this,"_cursorPosPrev",void 0),p.default(this,"_cursorPosCurr",void 0),p.default(this,"_wPrev",void 0),p.default(this,"_wCurr",void 0),p.default(this,"adjustNearFar",void 0),p.default(this,"scaleFactor",void 0),p.default(this,"dampingFactor",void 0),p.default(this,"wMax",void 0),p.default(this,"enableAnimations",void 0),p.default(this,"enableGrid",void 0),p.default(this,"cursorZoom",void 0),p.default(this,"minFov",void 0),p.default(this,"maxFov",void 0),p.default(this,"enabled",void 0),p.default(this,"enablePan",void 0),p.default(this,"enableRotate",void 0),p.default(this,"enableZoom",void 0),p.default(this,"minDistance",void 0),p.default(this,"maxDistance",void 0),p.default(this,"minZoom",void 0),p.default(this,"maxZoom",void 0),p.default(this,"target",void 0),p.default(this,"_currentTarget",void 0),p.default(this,"_tbRadius",void 0),p.default(this,"_state",void 0),p.default(this,"onWindowResize",(()=>{const t=(this._gizmos.scale.x+this._gizmos.scale.y+this._gizmos.scale.z)/3;if(this.camera){const e=this.calculateTbRadius(this.camera);void 0!==e&&(this._tbRadius=e)}const r=this._tbRadius/t,i=new e.EllipseCurve(0,0,r,r).getPoints(this._curvePts),n=(new e.BufferGeometry).setFromPoints(i);for(const e in this._gizmos.children){this._gizmos.children[e].geometry=n}this.dispatchEvent(Pa)})),p.default(this,"onContextMenu",(e=>{if(this.enabled)for(let t=0;t<this.mouseActions.length;t++)if(2==this.mouseActions[t].mouse){e.preventDefault();break}})),p.default(this,"onPointerCancel",(()=>{this._touchStart.splice(0,this._touchStart.length),this._touchCurrent.splice(0,this._touchCurrent.length),this._input=Fa.NONE})),p.default(this,"onPointerDown",(e=>{if(0==e.button&&e.isPrimary?(this._downValid=!0,this._downEvents.push(e)):this._downValid=!1,"touch"==e.pointerType&&this._input!=Fa.CURSOR)switch(this._touchStart.push(e),this._touchCurrent.push(e),this._input){case Fa.NONE:this._input=Fa.ONE_FINGER,this.onSinglePanStart(e,"ROTATE"),window.addEventListener("pointermove",this.onPointerMove),window.addEventListener("pointerup",this.onPointerUp);break;case Fa.ONE_FINGER:case Fa.ONE_FINGER_SWITCHED:this._input=Fa.TWO_FINGER,this.onRotateStart(),this.onPinchStart(),this.onDoublePanStart();break;case Fa.TWO_FINGER:this._input=Fa.MULT_FINGER,this.onTriplePanStart()}else if("touch"!=e.pointerType&&this._input==Fa.NONE){let t=null;e.ctrlKey||e.metaKey?t="CTRL":e.shiftKey&&(t="SHIFT"),this._mouseOp=this.getOpFromAction(e.button,t),this._mouseOp&&(window.addEventListener("pointermove",this.onPointerMove),window.addEventListener("pointerup",this.onPointerUp),this._input=Fa.CURSOR,this._button=e.button,this.onSinglePanStart(e,this._mouseOp))}})),p.default(this,"onPointerMove",(e=>{if("touch"==e.pointerType&&this._input!=Fa.CURSOR)switch(this._input){case Fa.ONE_FINGER:this.updateTouchEvent(e),this.onSinglePanMove(e,Ca.ROTATE);break;case Fa.ONE_FINGER_SWITCHED:if(this.calculatePointersDistance(this._touchCurrent[0],e)*this._devPxRatio>=this._switchSensibility){this._input=Fa.ONE_FINGER,this.updateTouchEvent(e),this.onSinglePanStart(e,"ROTATE");break}break;case Fa.TWO_FINGER:this.updateTouchEvent(e),this.onRotateMove(),this.onPinchMove(),this.onDoublePanMove();break;case Fa.MULT_FINGER:this.updateTouchEvent(e),this.onTriplePanMove()}else if("touch"!=e.pointerType&&this._input==Fa.CURSOR){let t=null;e.ctrlKey||e.metaKey?t="CTRL":e.shiftKey&&(t="SHIFT");const r=this.getOpStateFromAction(this._button,t);r&&this.onSinglePanMove(e,r)}if(this._downValid){this.calculatePointersDistance(this._downEvents[this._downEvents.length-1],e)*this._devPxRatio>this._movementThreshold&&(this._downValid=!1)}})),p.default(this,"onPointerUp",(e=>{if("touch"==e.pointerType&&this._input!=Fa.CURSOR){const t=this._touchCurrent.length;for(let r=0;r<t;r++)if(this._touchCurrent[r].pointerId==e.pointerId){this._touchCurrent.splice(r,1),this._touchStart.splice(r,1);break}switch(this._input){case Fa.ONE_FINGER:case Fa.ONE_FINGER_SWITCHED:window.removeEventListener("pointermove",this.onPointerMove),window.removeEventListener("pointerup",this.onPointerUp),this._input=Fa.NONE,this.onSinglePanEnd();break;case Fa.TWO_FINGER:this.onDoublePanEnd(),this.onPinchEnd(),this.onRotateEnd(),this._input=Fa.ONE_FINGER_SWITCHED;break;case Fa.MULT_FINGER:0==this._touchCurrent.length&&(window.removeEventListener("pointermove",this.onPointerMove),window.removeEventListener("pointerup",this.onPointerUp),this._input=Fa.NONE,this.onTriplePanEnd())}}else"touch"!=e.pointerType&&this._input==Fa.CURSOR&&(window.removeEventListener("pointermove",this.onPointerMove),window.removeEventListener("pointerup",this.onPointerUp),this._input=Fa.NONE,this.onSinglePanEnd(),this._button=-1);if(e.isPrimary)if(this._downValid){if(e.timeStamp-this._downEvents[this._downEvents.length-1].timeStamp<=this._maxDownTime)if(0==this._nclicks)this._nclicks=1,this._clickStart=performance.now();else{const t=e.timeStamp-this._clickStart,r=this.calculatePointersDistance(this._downEvents[1],this._downEvents[0])*this._devPxRatio;t<=this._maxInterval&&r<=this._posThreshold?(this._nclicks=0,this._downEvents.splice(0,this._downEvents.length),this.onDoubleTap(e)):(this._nclicks=1,this._downEvents.shift(),this._clickStart=performance.now())}else this._downValid=!1,this._nclicks=0,this._downEvents.splice(0,this._downEvents.length)}else this._nclicks=0,this._downEvents.splice(0,this._downEvents.length)})),p.default(this,"onWheel",(t=>{var r;if(this.enabled&&this.enableZoom&&this.domElement){let a=null;t.ctrlKey||t.metaKey?a="CTRL":t.shiftKey&&(a="SHIFT");const l=this.getOpFromAction("WHEEL",a);if(l){t.preventDefault(),this.dispatchEvent(Ba);const a=125;let c=t.deltaY/a,h=1;switch(c>0?h=1/this.scaleFactor:c<0&&(h=this.scaleFactor),l){case"ZOOM":if(this.updateTbState(Ca.SCALE,!0),c>0?h=1/Math.pow(this.scaleFactor,c):c<0&&(h=Math.pow(this.scaleFactor,-c)),this.cursorZoom&&this.enablePan){var i,n;let e;var s,o;if("OrthographicCamera"===(null===(i=this.camera)||void 0===i?void 0:i.type))e=null===(s=this.unprojectOnTbPlane(this.camera,t.clientX,t.clientY,this.domElement))||void 0===s?void 0:s.applyQuaternion(this.camera.quaternion).multiplyScalar(1/this.camera.zoom).add(this._gizmos.position);if("PerspectiveCamera"===(null===(n=this.camera)||void 0===n?void 0:n.type))e=null===(o=this.unprojectOnTbPlane(this.camera,t.clientX,t.clientY,this.domElement))||void 0===o?void 0:o.applyQuaternion(this.camera.quaternion).add(this._gizmos.position);void 0!==e&&this.applyTransformMatrix(this.applyScale(h,e))}else this.applyTransformMatrix(this.applyScale(h,this._gizmos.position));this._grid&&(this.disposeGrid(),this.drawGrid()),this.updateTbState(Ca.IDLE,!1),this.dispatchEvent(Pa),this.dispatchEvent(La);break;case"FOV":if("PerspectiveCamera"===(null===(r=this.camera)||void 0===r?void 0:r.type)){this.updateTbState(Ca.FOV,!0),0!=t.deltaX&&(c=t.deltaX/a,h=1,c>0?h=1/Math.pow(this.scaleFactor,c):c<0&&(h=Math.pow(this.scaleFactor,-c))),this._v3_1.setFromMatrixPosition(this._cameraMatrixState);const r=this._v3_1.distanceTo(this._gizmos.position);let i=r/h;i=e.MathUtils.clamp(i,this.minDistance,this.maxDistance);const n=r*Math.tan(e.MathUtils.DEG2RAD*this.camera.fov*.5);let s=e.MathUtils.RAD2DEG*(2*Math.atan(n/i));s>this.maxFov?s=this.maxFov:s<this.minFov&&(s=this.minFov);h=r/(n/Math.tan(e.MathUtils.DEG2RAD*(s/2))),this.setFov(s),this.applyTransformMatrix(this.applyScale(h,this._gizmos.position,!1))}this._grid&&(this.disposeGrid(),this.drawGrid()),this.updateTbState(Ca.IDLE,!1),this.dispatchEvent(Pa),this.dispatchEvent(La)}}}})),p.default(this,"onSinglePanStart",((e,t)=>{var r;if(this.enabled&&this.domElement)switch(this.dispatchEvent(Ba),this.setCenter(e.clientX,e.clientY),t){case"PAN":if(!this.enablePan)return;if(-1!=this._animationId&&(cancelAnimationFrame(this._animationId),this._animationId=-1,this._timeStart=-1,this.activateGizmos(!1),this.dispatchEvent(Pa)),this.camera){this.updateTbState(Ca.PAN,!0);const e=this.unprojectOnTbPlane(this.camera,Ea.x,Ea.y,this.domElement);void 0!==e&&this._startCursorPosition.copy(e),this.enableGrid&&(this.drawGrid(),this.dispatchEvent(Pa))}break;case"ROTATE":if(!this.enableRotate)return;if(-1!=this._animationId&&(cancelAnimationFrame(this._animationId),this._animationId=-1,this._timeStart=-1),this.camera){this.updateTbState(Ca.ROTATE,!0);const e=this.unprojectOnTbSurface(this.camera,Ea.x,Ea.y,this.domElement,this._tbRadius);void 0!==e&&this._startCursorPosition.copy(e),this.activateGizmos(!0),this.enableAnimations&&(this._timePrev=this._timeCurrent=performance.now(),this._angleCurrent=this._anglePrev=0,this._cursorPosPrev.copy(this._startCursorPosition),this._cursorPosCurr.copy(this._cursorPosPrev),this._wCurr=0,this._wPrev=this._wCurr)}this.dispatchEvent(Pa);break;case"FOV":if(!this.enableZoom)return;"PerspectiveCamera"===(null===(r=this.camera)||void 0===r?void 0:r.type)&&(-1!=this._animationId&&(cancelAnimationFrame(this._animationId),this._animationId=-1,this._timeStart=-1,this.activateGizmos(!1),this.dispatchEvent(Pa)),this.updateTbState(Ca.FOV,!0),this._startCursorPosition.setY(.5*this.getCursorNDC(Ea.x,Ea.y,this.domElement).y),this._currentCursorPosition.copy(this._startCursorPosition));break;case"ZOOM":if(!this.enableZoom)return;-1!=this._animationId&&(cancelAnimationFrame(this._animationId),this._animationId=-1,this._timeStart=-1,this.activateGizmos(!1),this.dispatchEvent(Pa)),this.updateTbState(Ca.SCALE,!0),this._startCursorPosition.setY(.5*this.getCursorNDC(Ea.x,Ea.y,this.domElement).y),this._currentCursorPosition.copy(this._startCursorPosition)}})),p.default(this,"onSinglePanMove",((t,r)=>{var i;if(this.enabled&&this.domElement){const n=r!=this._state;switch(this.setCenter(t.clientX,t.clientY),r){case Ca.PAN:if(this.enablePan&&this.camera)if(n){this.dispatchEvent(La),this.dispatchEvent(Ba),this.updateTbState(r,!0);const e=this.unprojectOnTbPlane(this.camera,Ea.x,Ea.y,this.domElement);void 0!==e&&this._startCursorPosition.copy(e),this.enableGrid&&this.drawGrid(),this.activateGizmos(!1)}else{const e=this.unprojectOnTbPlane(this.camera,Ea.x,Ea.y,this.domElement);void 0!==e&&this._currentCursorPosition.copy(e),this.applyTransformMatrix(this.pan(this._startCursorPosition,this._currentCursorPosition))}break;case Ca.ROTATE:if(this.enableRotate&&this.camera)if(n){this.dispatchEvent(La),this.dispatchEvent(Ba),this.updateTbState(r,!0);const e=this.unprojectOnTbSurface(this.camera,Ea.x,Ea.y,this.domElement,this._tbRadius);void 0!==e&&this._startCursorPosition.copy(e),this.enableGrid&&this.disposeGrid(),this.activateGizmos(!0)}else{const e=this.unprojectOnTbSurface(this.camera,Ea.x,Ea.y,this.domElement,this._tbRadius);void 0!==e&&this._currentCursorPosition.copy(e);const t=this._startCursorPosition.distanceTo(this._currentCursorPosition),r=this._startCursorPosition.angleTo(this._currentCursorPosition),i=Math.max(t/this._tbRadius,r);this.applyTransformMatrix(this.rotate(this.calculateRotationAxis(this._startCursorPosition,this._currentCursorPosition),i)),this.enableAnimations&&(this._timePrev=this._timeCurrent,this._timeCurrent=performance.now(),this._anglePrev=this._angleCurrent,this._angleCurrent=i,this._cursorPosPrev.copy(this._cursorPosCurr),this._cursorPosCurr.copy(this._currentCursorPosition),this._wPrev=this._wCurr,this._wCurr=this.calculateAngularSpeed(this._anglePrev,this._angleCurrent,this._timePrev,this._timeCurrent))}break;case Ca.SCALE:if(this.enableZoom)if(n)this.dispatchEvent(La),this.dispatchEvent(Ba),this.updateTbState(r,!0),this._startCursorPosition.setY(.5*this.getCursorNDC(Ea.x,Ea.y,this.domElement).y),this._currentCursorPosition.copy(this._startCursorPosition),this.enableGrid&&this.disposeGrid(),this.activateGizmos(!1);else{const e=8;this._currentCursorPosition.setY(.5*this.getCursorNDC(Ea.x,Ea.y,this.domElement).y);const t=this._currentCursorPosition.y-this._startCursorPosition.y;let r=1;t<0?r=1/Math.pow(this.scaleFactor,-t*e):t>0&&(r=Math.pow(this.scaleFactor,t*e)),this.applyTransformMatrix(this.applyScale(r,this._gizmos.position))}break;case Ca.FOV:if(this.enableZoom&&"PerspectiveCamera"===(null===(i=this.camera)||void 0===i?void 0:i.type))if(n)this.dispatchEvent(La),this.dispatchEvent(Ba),this.updateTbState(r,!0),this._startCursorPosition.setY(.5*this.getCursorNDC(Ea.x,Ea.y,this.domElement).y),this._currentCursorPosition.copy(this._startCursorPosition),this.enableGrid&&this.disposeGrid(),this.activateGizmos(!1);else{const t=8;this._currentCursorPosition.setY(.5*this.getCursorNDC(Ea.x,Ea.y,this.domElement).y);const r=this._currentCursorPosition.y-this._startCursorPosition.y;let i=1;r<0?i=1/Math.pow(this.scaleFactor,-r*t):r>0&&(i=Math.pow(this.scaleFactor,r*t)),this._v3_1.setFromMatrixPosition(this._cameraMatrixState);const n=this._v3_1.distanceTo(this._gizmos.position);let s=n/i;s=e.MathUtils.clamp(s,this.minDistance,this.maxDistance);const o=n*Math.tan(e.MathUtils.DEG2RAD*this._fovState*.5);let a=e.MathUtils.RAD2DEG*(2*Math.atan(o/s));a=e.MathUtils.clamp(a,this.minFov,this.maxFov);const l=o/Math.tan(e.MathUtils.DEG2RAD*(a/2));i=n/l,this._v3_2.setFromMatrixPosition(this._gizmoMatrixState),this.setFov(a),this.applyTransformMatrix(this.applyScale(i,this._v3_2,!1));const c=this._gizmos.position.clone().sub(this.camera.position).normalize().multiplyScalar(l/n);this._m4_1.makeTranslation(c.x,c.y,c.z)}}this.dispatchEvent(Pa)}})),p.default(this,"onSinglePanEnd",(()=>{if(this._state==Ca.ROTATE){if(!this.enableRotate)return;if(this.enableAnimations){if(performance.now()-this._timeCurrent<120){const e=Math.abs((this._wPrev+this._wCurr)/2),t=this;this._animationId=window.requestAnimationFrame((function(r){t.updateTbState(Ca.ANIMATION_ROTATE,!0);const i=t.calculateRotationAxis(t._cursorPosPrev,t._cursorPosCurr);t.onRotationAnim(r,i,Math.min(e,t.wMax))}))}else this.updateTbState(Ca.IDLE,!1),this.activateGizmos(!1),this.dispatchEvent(Pa)}else this.updateTbState(Ca.IDLE,!1),this.activateGizmos(!1),this.dispatchEvent(Pa)}else this._state!=Ca.PAN&&this._state!=Ca.IDLE||(this.updateTbState(Ca.IDLE,!1),this.enableGrid&&this.disposeGrid(),this.activateGizmos(!1),this.dispatchEvent(Pa));this.dispatchEvent(La)})),p.default(this,"onDoubleTap",(e=>{if(this.enabled&&this.enablePan&&this.scene&&this.camera&&this.domElement){this.dispatchEvent(Ba),this.setCenter(e.clientX,e.clientY);const t=this.unprojectOnObj(this.getCursorNDC(Ea.x,Ea.y,this.domElement),this.camera);if(t&&this.enableAnimations){const e=this;-1!=this._animationId&&window.cancelAnimationFrame(this._animationId),this._timeStart=-1,this._animationId=window.requestAnimationFrame((function(r){e.updateTbState(Ca.ANIMATION_FOCUS,!0),e.onFocusAnim(r,t,e._cameraMatrixState,e._gizmoMatrixState)}))}else t&&!this.enableAnimations&&(this.updateTbState(Ca.FOCUS,!0),this.focus(t,this.scaleFactor),this.updateTbState(Ca.IDLE,!1),this.dispatchEvent(Pa))}this.dispatchEvent(La)})),p.default(this,"onDoublePanStart",(()=>{if(this.enabled&&this.enablePan&&this.camera&&this.domElement){this.dispatchEvent(Ba),this.updateTbState(Ca.PAN,!0),this.setCenter((this._touchCurrent[0].clientX+this._touchCurrent[1].clientX)/2,(this._touchCurrent[0].clientY+this._touchCurrent[1].clientY)/2);const e=this.unprojectOnTbPlane(this.camera,Ea.x,Ea.y,this.domElement,!0);void 0!==e&&this._startCursorPosition.copy(e),this._currentCursorPosition.copy(this._startCursorPosition),this.activateGizmos(!1)}})),p.default(this,"onDoublePanMove",(()=>{if(this.enabled&&this.enablePan&&this.camera&&this.domElement){this.setCenter((this._touchCurrent[0].clientX+this._touchCurrent[1].clientX)/2,(this._touchCurrent[0].clientY+this._touchCurrent[1].clientY)/2),this._state!=Ca.PAN&&(this.updateTbState(Ca.PAN,!0),this._startCursorPosition.copy(this._currentCursorPosition));const e=this.unprojectOnTbPlane(this.camera,Ea.x,Ea.y,this.domElement,!0);void 0!==e&&this._currentCursorPosition.copy(e),this.applyTransformMatrix(this.pan(this._startCursorPosition,this._currentCursorPosition,!0)),this.dispatchEvent(Pa)}})),p.default(this,"onDoublePanEnd",(()=>{this.updateTbState(Ca.IDLE,!1),this.dispatchEvent(La)})),p.default(this,"onRotateStart",(()=>{var e;this.enabled&&this.enableRotate&&(this.dispatchEvent(Ba),this.updateTbState(Ca.ZROTATE,!0),this._startFingerRotation=this.getAngle(this._touchCurrent[1],this._touchCurrent[0])+this.getAngle(this._touchStart[1],this._touchStart[0]),this._currentFingerRotation=this._startFingerRotation,null===(e=this.camera)||void 0===e||e.getWorldDirection(this._rotationAxis),this.enablePan||this.enableZoom||this.activateGizmos(!0))})),p.default(this,"onRotateMove",(()=>{if(this.enabled&&this.enableRotate&&this.camera&&this.domElement){let r;if(this.setCenter((this._touchCurrent[0].clientX+this._touchCurrent[1].clientX)/2,(this._touchCurrent[0].clientY+this._touchCurrent[1].clientY)/2),this._state!=Ca.ZROTATE&&(this.updateTbState(Ca.ZROTATE,!0),this._startFingerRotation=this._currentFingerRotation),this._currentFingerRotation=this.getAngle(this._touchCurrent[1],this._touchCurrent[0])+this.getAngle(this._touchStart[1],this._touchStart[0]),this.enablePan){if(this.camera){var t;this._v3_2.setFromMatrixPosition(this._gizmoMatrixState),r=null===(t=this.unprojectOnTbPlane(this.camera,Ea.x,Ea.y,this.domElement))||void 0===t?void 0:t.applyQuaternion(this.camera.quaternion).multiplyScalar(1/this.camera.zoom).add(this._v3_2)}}else r=(new e.Vector3).setFromMatrixPosition(this._gizmoMatrixState);const i=e.MathUtils.DEG2RAD*(this._startFingerRotation-this._currentFingerRotation);void 0!==r&&this.applyTransformMatrix(this.zRotate(r,i)),this.dispatchEvent(Pa)}})),p.default(this,"onRotateEnd",(()=>{this.updateTbState(Ca.IDLE,!1),this.activateGizmos(!1),this.dispatchEvent(La)})),p.default(this,"onPinchStart",(()=>{this.enabled&&this.enableZoom&&(this.dispatchEvent(Ba),this.updateTbState(Ca.SCALE,!0),this._startFingerDistance=this.calculatePointersDistance(this._touchCurrent[0],this._touchCurrent[1]),this._currentFingerDistance=this._startFingerDistance,this.activateGizmos(!1))})),p.default(this,"onPinchMove",(()=>{if(this.enabled&&this.enableZoom&&this.domElement){this.setCenter((this._touchCurrent[0].clientX+this._touchCurrent[1].clientX)/2,(this._touchCurrent[0].clientY+this._touchCurrent[1].clientY)/2);const n=12;this._state!=Ca.SCALE&&(this._startFingerDistance=this._currentFingerDistance,this.updateTbState(Ca.SCALE,!0)),this._currentFingerDistance=Math.max(this.calculatePointersDistance(this._touchCurrent[0],this._touchCurrent[1]),n*this._devPxRatio);const s=this._currentFingerDistance/this._startFingerDistance;let o;var e,t,r;if(this.enablePan){if("OrthographicCamera"===(null===(e=this.camera)||void 0===e?void 0:e.type))o=null===(r=this.unprojectOnTbPlane(this.camera,Ea.x,Ea.y,this.domElement))||void 0===r?void 0:r.applyQuaternion(this.camera.quaternion).multiplyScalar(1/this.camera.zoom).add(this._gizmos.position);else if("PerspectiveCamera"===(null===(t=this.camera)||void 0===t?void 0:t.type)){var i;o=null===(i=this.unprojectOnTbPlane(this.camera,Ea.x,Ea.y,this.domElement))||void 0===i?void 0:i.applyQuaternion(this.camera.quaternion).add(this._gizmos.position)}}else o=this._gizmos.position;void 0!==o&&this.applyTransformMatrix(this.applyScale(s,o)),this.dispatchEvent(Pa)}})),p.default(this,"onPinchEnd",(()=>{this.updateTbState(Ca.IDLE,!1),this.dispatchEvent(La)})),p.default(this,"onTriplePanStart",(()=>{if(this.enabled&&this.enableZoom&&this.domElement){this.dispatchEvent(Ba),this.updateTbState(Ca.SCALE,!0);let e=0,t=0;const r=this._touchCurrent.length;for(let i=0;i<r;i++)e+=this._touchCurrent[i].clientX,t+=this._touchCurrent[i].clientY;this.setCenter(e/r,t/r),this._startCursorPosition.setY(.5*this.getCursorNDC(Ea.x,Ea.y,this.domElement).y),this._currentCursorPosition.copy(this._startCursorPosition)}})),p.default(this,"onTriplePanMove",(()=>{if(this.enabled&&this.enableZoom&&this.camera&&this.domElement){let t=0,r=0;const i=this._touchCurrent.length;for(let e=0;e<i;e++)t+=this._touchCurrent[e].clientX,r+=this._touchCurrent[e].clientY;this.setCenter(t/i,r/i);const n=8;this._currentCursorPosition.setY(.5*this.getCursorNDC(Ea.x,Ea.y,this.domElement).y);const s=this._currentCursorPosition.y-this._startCursorPosition.y;let o=1;s<0?o=1/Math.pow(this.scaleFactor,-s*n):s>0&&(o=Math.pow(this.scaleFactor,s*n)),this._v3_1.setFromMatrixPosition(this._cameraMatrixState);const a=this._v3_1.distanceTo(this._gizmos.position);let l=a/o;l=e.MathUtils.clamp(l,this.minDistance,this.maxDistance);const c=a*Math.tan(e.MathUtils.DEG2RAD*this._fovState*.5);let h=e.MathUtils.RAD2DEG*(2*Math.atan(c/l));h=e.MathUtils.clamp(h,this.minFov,this.maxFov);const u=c/Math.tan(e.MathUtils.DEG2RAD*(h/2));o=a/u,this._v3_2.setFromMatrixPosition(this._gizmoMatrixState),this.setFov(h),this.applyTransformMatrix(this.applyScale(o,this._v3_2,!1));const d=this._gizmos.position.clone().sub(this.camera.position).normalize().multiplyScalar(u/a);this._m4_1.makeTranslation(d.x,d.y,d.z),this.dispatchEvent(Pa)}})),p.default(this,"onTriplePanEnd",(()=>{this.updateTbState(Ca.IDLE,!1),this.dispatchEvent(La)})),p.default(this,"setCenter",((e,t)=>{Ea.x=e,Ea.y=t})),p.default(this,"initializeMouseActions",(()=>{this.setMouseAction("PAN",0,"CTRL"),this.setMouseAction("PAN",2),this.setMouseAction("ROTATE",0),this.setMouseAction("ZOOM","WHEEL"),this.setMouseAction("ZOOM",1),this.setMouseAction("FOV","WHEEL","SHIFT"),this.setMouseAction("FOV",1,"SHIFT")})),p.default(this,"setMouseAction",((e,t,r=null)=>{let i;if(!["PAN","ROTATE","ZOOM","FOV"].includes(e)||![0,1,2,"WHEEL"].includes(t)||!["CTRL","SHIFT",null].includes(r))return!1;if("WHEEL"==t&&"ZOOM"!=e&&"FOV"!=e)return!1;switch(e){case"PAN":i=Ca.PAN;break;case"ROTATE":i=Ca.ROTATE;break;case"ZOOM":i=Ca.SCALE;break;case"FOV":i=Ca.FOV}const n={operation:e,mouse:t,key:r,state:i};for(let e=0;e<this.mouseActions.length;e++)if(this.mouseActions[e].mouse==n.mouse&&this.mouseActions[e].key==n.key)return this.mouseActions.splice(e,1,n),!0;return this.mouseActions.push(n),!0})),p.default(this,"getOpFromAction",((e,t)=>{let r;for(let i=0;i<this.mouseActions.length;i++)if(r=this.mouseActions[i],r.mouse==e&&r.key==t)return r.operation;if(t)for(let t=0;t<this.mouseActions.length;t++)if(r=this.mouseActions[t],r.mouse==e&&null==r.key)return r.operation;return null})),p.default(this,"getOpStateFromAction",((e,t)=>{let r;for(let i=0;i<this.mouseActions.length;i++)if(r=this.mouseActions[i],r.mouse==e&&r.key==t)return r.state;if(t)for(let t=0;t<this.mouseActions.length;t++)if(r=this.mouseActions[t],r.mouse==e&&null==r.key)return r.state;return null})),p.default(this,"getAngle",((e,t)=>180*Math.atan2(t.clientY-e.clientY,t.clientX-e.clientX)/Math.PI)),p.default(this,"updateTouchEvent",(e=>{for(let t=0;t<this._touchCurrent.length;t++)if(this._touchCurrent[t].pointerId==e.pointerId){this._touchCurrent.splice(t,1,e);break}})),p.default(this,"calculateAngularSpeed",((e,t,r,i)=>{const n=(i-r)/1e3;return 0==n?0:(t-e)/n})),p.default(this,"calculatePointersDistance",((e,t)=>Math.sqrt(Math.pow(t.clientX-e.clientX,2)+Math.pow(t.clientY-e.clientY,2)))),p.default(this,"calculateRotationAxis",((e,t)=>(this._rotationMatrix.extractRotation(this._cameraMatrixState),this._quat.setFromRotationMatrix(this._rotationMatrix),this._rotationAxis.crossVectors(e,t).applyQuaternion(this._quat),this._rotationAxis.normalize().clone()))),p.default(this,"calculateTbRadius",(t=>{const r=t.position.distanceTo(this._gizmos.position);if("PerspectiveCamera"==t.type){const i=e.MathUtils.DEG2RAD*t.fov*.5,n=Math.atan(t.aspect*Math.tan(i));return Math.tan(Math.min(i,n))*r*.67}if("OrthographicCamera"==t.type)return.67*Math.min(t.top,t.right)})),p.default(this,"focus",((e,t,r=1)=>{if(this.camera){const i=e.clone();i.sub(this._gizmos.position).multiplyScalar(r),this._translationMatrix.makeTranslation(i.x,i.y,i.z);const n=this._gizmoMatrixState.clone();this._gizmoMatrixState.premultiply(this._translationMatrix),this._gizmoMatrixState.decompose(this._gizmos.position,this._gizmos.quaternion,this._gizmos.scale);const s=this._cameraMatrixState.clone();this._cameraMatrixState.premultiply(this._translationMatrix),this._cameraMatrixState.decompose(this.camera.position,this.camera.quaternion,this.camera.scale),this.enableZoom&&this.applyTransformMatrix(this.applyScale(t,this._gizmos.position)),this._gizmoMatrixState.copy(n),this._cameraMatrixState.copy(s)}})),p.default(this,"drawGrid",(()=>{if(this.scene){var t,r;const i=8947848,n=3;let s,o,a,l;if("OrthographicCamera"===(null===(t=this.camera)||void 0===t?void 0:t.type)){const e=this.camera.right-this.camera.left,t=this.camera.bottom-this.camera.top;a=Math.max(e,t),l=a/20,s=a/this.camera.zoom*n,o=s/l*this.camera.zoom}else if("PerspectiveCamera"===(null===(r=this.camera)||void 0===r?void 0:r.type)){const t=this.camera.position.distanceTo(this._gizmos.position),r=e.MathUtils.DEG2RAD*this.camera.fov*.5,i=Math.atan(this.camera.aspect*Math.tan(r));a=Math.tan(Math.max(r,i))*t*2,l=a/20,s=a*n,o=s/l}null==this._grid&&this.camera&&(this._grid=new e.GridHelper(s,o,i,i),this._grid.position.copy(this._gizmos.position),this._gridPosition.copy(this._grid.position),this._grid.quaternion.copy(this.camera.quaternion),this._grid.rotateX(.5*Math.PI),this.scene.add(this._grid))}})),p.default(this,"connect",(e=>{e===document&&console.error('THREE.ArcballControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.domElement=e,this.domElement.style.touchAction="none",this.domElement.addEventListener("contextmenu",this.onContextMenu),this.domElement.addEventListener("pointerdown",this.onPointerDown),this.domElement.addEventListener("pointercancel",this.onPointerCancel),this.domElement.addEventListener("wheel",this.onWheel)})),p.default(this,"dispose",(()=>{var e,t,r,i,n;-1!=this._animationId&&window.cancelAnimationFrame(this._animationId),null===(e=this.domElement)||void 0===e||e.removeEventListener("pointerdown",this.onPointerDown),null===(t=this.domElement)||void 0===t||t.removeEventListener("pointercancel",this.onPointerCancel),null===(r=this.domElement)||void 0===r||r.removeEventListener("wheel",this.onWheel),null===(i=this.domElement)||void 0===i||i.removeEventListener("contextmenu",this.onContextMenu),window.removeEventListener("pointermove",this.onPointerMove),window.removeEventListener("pointerup",this.onPointerUp),window.removeEventListener("resize",this.onWindowResize),null===(n=this.scene)||void 0===n||n.remove(this._gizmos),this.disposeGrid()})),p.default(this,"disposeGrid",(()=>{this._grid&&this.scene&&(this.scene.remove(this._grid),this._grid=null)})),p.default(this,"easeOutCubic",(e=>1-Math.pow(1-e,3))),p.default(this,"activateGizmos",(e=>{for(const t of this._gizmos.children)t.material.setValues({opacity:e?1:.6})})),p.default(this,"getCursorNDC",((e,t,r)=>{const i=r.getBoundingClientRect();return this._v2_1.setX((e-i.left)/i.width*2-1),this._v2_1.setY((i.bottom-t)/i.height*2-1),this._v2_1.clone()})),p.default(this,"getCursorPosition",((e,t,r)=>{var i;return this._v2_1.copy(this.getCursorNDC(e,t,r)),"OrthographicCamera"===(null===(i=this.camera)||void 0===i?void 0:i.type)&&(this._v2_1.x*=.5*(this.camera.right-this.camera.left),this._v2_1.y*=.5*(this.camera.top-this.camera.bottom)),this._v2_1.clone()})),p.default(this,"setCamera",(e=>{if(e){e.lookAt(this.target),e.updateMatrix(),"PerspectiveCamera"==(null==e?void 0:e.type)&&(this._fov0=e.fov,this._fovState=e.fov),this._cameraMatrixState0.copy(e.matrix),this._cameraMatrixState.copy(this._cameraMatrixState0),this._cameraProjectionState.copy(e.projectionMatrix),this._zoom0=e.zoom,this._zoomState=this._zoom0,this._initialNear=e.near,this._nearPos0=e.position.distanceTo(this.target)-e.near,this._nearPos=this._initialNear,this._initialFar=e.far,this._farPos0=e.position.distanceTo(this.target)-e.far,this._farPos=this._initialFar,this._up0.copy(e.up),this._upState.copy(e.up),this.camera=e,this.camera.updateProjectionMatrix();const t=this.calculateTbRadius(e);void 0!==t&&(this._tbRadius=t),this.makeGizmos(this.target,this._tbRadius)}})),p.default(this,"makeGizmos",((t,r)=>{const i=new e.EllipseCurve(0,0,r,r).getPoints(this._curvePts),n=(new e.BufferGeometry).setFromPoints(i),s=new e.LineBasicMaterial({color:16744576,fog:!1,transparent:!0,opacity:.6}),o=new e.LineBasicMaterial({color:8454016,fog:!1,transparent:!0,opacity:.6}),a=new e.LineBasicMaterial({color:8421631,fog:!1,transparent:!0,opacity:.6}),l=new e.Line(n,s),c=new e.Line(n,o),h=new e.Line(n,a),u=.5*Math.PI;if(l.rotation.x=u,c.rotation.y=u,this._gizmoMatrixState0.identity().setPosition(t),this._gizmoMatrixState.copy(this._gizmoMatrixState0),this.camera&&1!=this.camera.zoom){const e=1/this.camera.zoom;this._scaleMatrix.makeScale(e,e,e),this._translationMatrix.makeTranslation(-t.x,-t.y,-t.z),this._gizmoMatrixState.premultiply(this._translationMatrix).premultiply(this._scaleMatrix),this._translationMatrix.makeTranslation(t.x,t.y,t.z),this._gizmoMatrixState.premultiply(this._translationMatrix)}this._gizmoMatrixState.decompose(this._gizmos.position,this._gizmos.quaternion,this._gizmos.scale),this._gizmos.clear(),this._gizmos.add(l),this._gizmos.add(c),this._gizmos.add(h)})),p.default(this,"onFocusAnim",((e,t,r,i)=>{if(-1==this._timeStart&&(this._timeStart=e),this._state==Ca.ANIMATION_FOCUS){const n=(e-this._timeStart)/this.focusAnimationTime;if(this._gizmoMatrixState.copy(i),n>=1)this._gizmoMatrixState.decompose(this._gizmos.position,this._gizmos.quaternion,this._gizmos.scale),this.focus(t,this.scaleFactor),this._timeStart=-1,this.updateTbState(Ca.IDLE,!1),this.activateGizmos(!1),this.dispatchEvent(Pa);else{const e=this.easeOutCubic(n),s=1-e+this.scaleFactor*e;this._gizmoMatrixState.decompose(this._gizmos.position,this._gizmos.quaternion,this._gizmos.scale),this.focus(t,s,e),this.dispatchEvent(Pa);const o=this;this._animationId=window.requestAnimationFrame((function(e){o.onFocusAnim(e,t,r,i.clone())}))}}else this._animationId=-1,this._timeStart=-1})),p.default(this,"onRotationAnim",((e,t,r)=>{if(-1==this._timeStart&&(this._anglePrev=0,this._angleCurrent=0,this._timeStart=e),this._state==Ca.ANIMATION_ROTATE){const i=(e-this._timeStart)/1e3;if(r+-this.dampingFactor*i>0){this._angleCurrent=.5*-this.dampingFactor*Math.pow(i,2)+r*i+0,this.applyTransformMatrix(this.rotate(t,this._angleCurrent)),this.dispatchEvent(Pa);const e=this;this._animationId=window.requestAnimationFrame((function(i){e.onRotationAnim(i,t,r)}))}else this._animationId=-1,this._timeStart=-1,this.updateTbState(Ca.IDLE,!1),this.activateGizmos(!1),this.dispatchEvent(Pa)}else this._animationId=-1,this._timeStart=-1,this._state!=Ca.ROTATE&&(this.activateGizmos(!1),this.dispatchEvent(Pa))})),p.default(this,"pan",((e,t,r=!1)=>{if(this.camera){const i=e.clone().sub(t);if("OrthographicCamera"===this.camera.type&&i.multiplyScalar(1/this.camera.zoom),"PerspectiveCamera"===this.camera.type&&r){this._v3_1.setFromMatrixPosition(this._cameraMatrixState0),this._v3_2.setFromMatrixPosition(this._gizmoMatrixState0);const e=this._v3_1.distanceTo(this._v3_2)/this.camera.position.distanceTo(this._gizmos.position);i.multiplyScalar(1/e)}this._v3_1.set(i.x,i.y,0).applyQuaternion(this.camera.quaternion),this._m4_1.makeTranslation(this._v3_1.x,this._v3_1.y,this._v3_1.z),this.setTransformationMatrices(this._m4_1,this._m4_1)}return _a})),p.default(this,"reset",(()=>{if(this.camera){this.camera.zoom=this._zoom0,"PerspectiveCamera"===this.camera.type&&(this.camera.fov=this._fov0),this.camera.near=this._nearPos,this.camera.far=this._farPos,this._cameraMatrixState.copy(this._cameraMatrixState0),this._cameraMatrixState.decompose(this.camera.position,this.camera.quaternion,this.camera.scale),this.camera.up.copy(this._up0),this.camera.updateMatrix(),this.camera.updateProjectionMatrix(),this._gizmoMatrixState.copy(this._gizmoMatrixState0),this._gizmoMatrixState0.decompose(this._gizmos.position,this._gizmos.quaternion,this._gizmos.scale),this._gizmos.updateMatrix();const e=this.calculateTbRadius(this.camera);void 0!==e&&(this._tbRadius=e),this.makeGizmos(this._gizmos.position,this._tbRadius),this.camera.lookAt(this._gizmos.position),this.updateTbState(Ca.IDLE,!1),this.dispatchEvent(Pa)}})),p.default(this,"rotate",((e,t)=>{const r=this._gizmos.position;return this._translationMatrix.makeTranslation(-r.x,-r.y,-r.z),this._rotationMatrix.makeRotationAxis(e,-t),this._m4_1.makeTranslation(r.x,r.y,r.z),this._m4_1.multiply(this._rotationMatrix),this._m4_1.multiply(this._translationMatrix),this.setTransformationMatrices(this._m4_1),_a})),p.default(this,"copyState",(()=>{if(this.camera){var e;const t=JSON.stringify("OrthographicCamera"===(null===(e=this.camera)||void 0===e?void 0:e.type)?{arcballState:{cameraFar:this.camera.far,cameraMatrix:this.camera.matrix,cameraNear:this.camera.near,cameraUp:this.camera.up,cameraZoom:this.camera.zoom,gizmoMatrix:this._gizmos.matrix}}:{arcballState:{cameraFar:this.camera.far,cameraFov:this.camera.fov,cameraMatrix:this.camera.matrix,cameraNear:this.camera.near,cameraUp:this.camera.up,cameraZoom:this.camera.zoom,gizmoMatrix:this._gizmos.matrix}});navigator.clipboard.writeText(t)}})),p.default(this,"pasteState",(()=>{const e=this;navigator.clipboard.readText().then((function(t){e.setStateFromJSON(t)}))})),p.default(this,"saveState",(()=>{this.camera&&(this._cameraMatrixState0.copy(this.camera.matrix),this._gizmoMatrixState0.copy(this._gizmos.matrix),this._nearPos=this.camera.near,this._farPos=this.camera.far,this._zoom0=this.camera.zoom,this._up0.copy(this.camera.up),"PerspectiveCamera"===this.camera.type&&(this._fov0=this.camera.fov))})),p.default(this,"applyScale",((e,t,r=!0)=>{if(!this.camera)return;const i=t.clone();let n=1/e;if("OrthographicCamera"===this.camera.type){this.camera.zoom=this._zoomState,this.camera.zoom*=e,this.camera.zoom>this.maxZoom?(this.camera.zoom=this.maxZoom,n=this._zoomState/this.maxZoom):this.camera.zoom<this.minZoom&&(this.camera.zoom=this.minZoom,n=this._zoomState/this.minZoom),this.camera.updateProjectionMatrix(),this._v3_1.setFromMatrixPosition(this._gizmoMatrixState),this._scaleMatrix.makeScale(n,n,n),this._translationMatrix.makeTranslation(-this._v3_1.x,-this._v3_1.y,-this._v3_1.z),this._m4_2.makeTranslation(this._v3_1.x,this._v3_1.y,this._v3_1.z).multiply(this._scaleMatrix),this._m4_2.multiply(this._translationMatrix),i.sub(this._v3_1);const t=i.clone().multiplyScalar(n);return i.sub(t),this._m4_1.makeTranslation(i.x,i.y,i.z),this._m4_2.premultiply(this._m4_1),this.setTransformationMatrices(this._m4_1,this._m4_2),_a}if("PerspectiveCamera"===this.camera.type){this._v3_1.setFromMatrixPosition(this._cameraMatrixState),this._v3_2.setFromMatrixPosition(this._gizmoMatrixState);let e=this._v3_1.distanceTo(i),t=e-e*n;const s=e-t;s<this.minDistance?(n=this.minDistance/e,t=e-e*n):s>this.maxDistance&&(n=this.maxDistance/e,t=e-e*n);let o=i.clone().sub(this._v3_1).normalize().multiplyScalar(t);if(this._m4_1.makeTranslation(o.x,o.y,o.z),r){const r=this._v3_2;e=r.distanceTo(i),t=e-e*n,o=i.clone().sub(this._v3_2).normalize().multiplyScalar(t),this._translationMatrix.makeTranslation(r.x,r.y,r.z),this._scaleMatrix.makeScale(n,n,n),this._m4_2.makeTranslation(o.x,o.y,o.z).multiply(this._translationMatrix),this._m4_2.multiply(this._scaleMatrix),this._translationMatrix.makeTranslation(-r.x,-r.y,-r.z),this._m4_2.multiply(this._translationMatrix),this.setTransformationMatrices(this._m4_1,this._m4_2)}else this.setTransformationMatrices(this._m4_1);return _a}})),p.default(this,"setFov",(t=>{var r;"PerspectiveCamera"===(null===(r=this.camera)||void 0===r?void 0:r.type)&&(this.camera.fov=e.MathUtils.clamp(t,this.minFov,this.maxFov),this.camera.updateProjectionMatrix())})),p.default(this,"setTarget",((e,t,r)=>{if(this.camera){this.target.set(e,t,r),this._gizmos.position.set(e,t,r);const i=this.calculateTbRadius(this.camera);void 0!==i&&(this._tbRadius=i),this.makeGizmos(this.target,this._tbRadius),this.camera.lookAt(this.target)}})),p.default(this,"zRotate",((e,t)=>(this._rotationMatrix.makeRotationAxis(this._rotationAxis,t),this._translationMatrix.makeTranslation(-e.x,-e.y,-e.z),this._m4_1.makeTranslation(e.x,e.y,e.z),this._m4_1.multiply(this._rotationMatrix),this._m4_1.multiply(this._translationMatrix),this._v3_1.setFromMatrixPosition(this._gizmoMatrixState).sub(e),this._v3_2.copy(this._v3_1).applyAxisAngle(this._rotationAxis,t),this._v3_2.sub(this._v3_1),this._m4_2.makeTranslation(this._v3_2.x,this._v3_2.y,this._v3_2.z),this.setTransformationMatrices(this._m4_1,this._m4_2),_a))),p.default(this,"unprojectOnObj",((t,r)=>{if(!this.scene)return null;const i=new e.Raycaster;i.near=r.near,i.far=r.far,i.setFromCamera(t,r);const n=i.intersectObjects(this.scene.children,!0);for(let e=0;e<n.length;e++)if(n[e].object.uuid!=this._gizmos.uuid&&n[e].face)return n[e].point.clone();return null})),p.default(this,"unprojectOnTbSurface",((t,r,i,n,s)=>{if("OrthographicCamera"==t.type){this._v2_1.copy(this.getCursorPosition(r,i,n)),this._v3_1.set(this._v2_1.x,this._v2_1.y,0);const e=Math.pow(this._v2_1.x,2),t=Math.pow(this._v2_1.y,2),s=Math.pow(this._tbRadius,2);return e+t<=.5*s?this._v3_1.setZ(Math.sqrt(s-(e+t))):this._v3_1.setZ(.5*s/Math.sqrt(e+t)),this._v3_1}if("PerspectiveCamera"==t.type){this._v2_1.copy(this.getCursorNDC(r,i,n)),this._v3_1.set(this._v2_1.x,this._v2_1.y,-1),this._v3_1.applyMatrix4(t.projectionMatrixInverse);const o=this._v3_1.clone().normalize(),a=t.position.distanceTo(this._gizmos.position),l=Math.pow(s,2),c=this._v3_1.z,h=Math.sqrt(Math.pow(this._v3_1.x,2)+Math.pow(this._v3_1.y,2));if(0==h)return o.set(this._v3_1.x,this._v3_1.y,s),o;const u=c/h,d=a;let p=Math.pow(u,2)+1,m=2*u*d,f=Math.pow(d,2)-l,g=Math.pow(m,2)-4*p*f;if(g>=0){this._v2_1.setX((-m-Math.sqrt(g))/(2*p)),this._v2_1.setY(u*this._v2_1.x+d);if(e.MathUtils.RAD2DEG*this._v2_1.angle()>=45){const e=Math.sqrt(Math.pow(this._v2_1.x,2)+Math.pow(a-this._v2_1.y,2));return o.multiplyScalar(e),o.z+=a,o}}p=u,m=d,f=.5*-l,g=Math.pow(m,2)-4*p*f,this._v2_1.setX((-m-Math.sqrt(g))/(2*p)),this._v2_1.setY(u*this._v2_1.x+d);const v=Math.sqrt(Math.pow(this._v2_1.x,2)+Math.pow(a-this._v2_1.y,2));return o.multiplyScalar(v),o.z+=a,o}})),p.default(this,"unprojectOnTbPlane",((e,t,r,i,n=!1)=>{if("OrthographicCamera"==e.type)return this._v2_1.copy(this.getCursorPosition(t,r,i)),this._v3_1.set(this._v2_1.x,this._v2_1.y,0),this._v3_1.clone();if("PerspectiveCamera"==e.type){this._v2_1.copy(this.getCursorNDC(t,r,i)),this._v3_1.set(this._v2_1.x,this._v2_1.y,-1),this._v3_1.applyMatrix4(e.projectionMatrixInverse);const s=this._v3_1.clone().normalize(),o=this._v3_1.z,a=Math.sqrt(Math.pow(this._v3_1.x,2)+Math.pow(this._v3_1.y,2));let l;if(l=n?this._v3_1.setFromMatrixPosition(this._cameraMatrixState0).distanceTo(this._v3_2.setFromMatrixPosition(this._gizmoMatrixState0)):e.position.distanceTo(this._gizmos.position),0==a)return s.set(0,0,0),s;const c=l,h=-c/(o/a),u=Math.sqrt(Math.pow(c,2)+Math.pow(h,2));return s.multiplyScalar(u),s.z=0,s}})),p.default(this,"updateMatrixState",(()=>{this.camera&&(this._cameraMatrixState.copy(this.camera.matrix),this._gizmoMatrixState.copy(this._gizmos.matrix),"OrthographicCamera"===this.camera.type&&(this._cameraProjectionState.copy(this.camera.projectionMatrix),this.camera.updateProjectionMatrix(),this._zoomState=this.camera.zoom),"PerspectiveCamera"===this.camera.type&&(this._fovState=this.camera.fov))})),p.default(this,"updateTbState",((e,t)=>{this._state=e,t&&this.updateMatrixState()})),p.default(this,"update",(()=>{const t=1e-6;if(!this.target.equals(this._currentTarget)&&this.camera){this._gizmos.position.set(this.target.x,this.target.y,this.target.z);const e=this.calculateTbRadius(this.camera);void 0!==e&&(this._tbRadius=e),this.makeGizmos(this.target,this._tbRadius),this._currentTarget.copy(this.target)}if(this.camera){if("OrthographicCamera"===this.camera.type&&(this.camera.zoom>this.maxZoom||this.camera.zoom<this.minZoom)){const t=e.MathUtils.clamp(this.camera.zoom,this.minZoom,this.maxZoom);this.applyTransformMatrix(this.applyScale(t/this.camera.zoom,this._gizmos.position,!0))}if("PerspectiveCamera"===this.camera.type){const r=this.camera.position.distanceTo(this._gizmos.position);if(r>this.maxDistance+t||r<this.minDistance-t){const t=e.MathUtils.clamp(r,this.minDistance,this.maxDistance);this.applyTransformMatrix(this.applyScale(t/r,this._gizmos.position)),this.updateMatrixState()}(this.camera.fov<this.minFov||this.camera.fov>this.maxFov)&&(this.camera.fov=e.MathUtils.clamp(this.camera.fov,this.minFov,this.maxFov),this.camera.updateProjectionMatrix());const i=this._tbRadius,n=this.calculateTbRadius(this.camera);if(void 0!==n&&(this._tbRadius=n),i<this._tbRadius-t||i>this._tbRadius+t){const t=(this._gizmos.scale.x+this._gizmos.scale.y+this._gizmos.scale.z)/3,r=this._tbRadius/t,i=new e.EllipseCurve(0,0,r,r).getPoints(this._curvePts),n=(new e.BufferGeometry).setFromPoints(i);for(const e in this._gizmos.children){this._gizmos.children[e].geometry=n}}}this.camera.lookAt(this._gizmos.position)}})),p.default(this,"setStateFromJSON",(t=>{const r=JSON.parse(t);if(r.arcballState&&this.camera){this._cameraMatrixState.fromArray(r.arcballState.cameraMatrix.elements),this._cameraMatrixState.decompose(this.camera.position,this.camera.quaternion,this.camera.scale),this.camera.up.copy(r.arcballState.cameraUp),this.camera.near=r.arcballState.cameraNear,this.camera.far=r.arcballState.cameraFar,this.camera.zoom=r.arcballState.cameraZoom,"PerspectiveCamera"===this.camera.type&&(this.camera.fov=r.arcballState.cameraFov),this._gizmoMatrixState.fromArray(r.arcballState.gizmoMatrix.elements),this._gizmoMatrixState.decompose(this._gizmos.position,this._gizmos.quaternion,this._gizmos.scale),this.camera.updateMatrix(),this.camera.updateProjectionMatrix(),this._gizmos.updateMatrix();const t=this.calculateTbRadius(this.camera);void 0!==t&&(this._tbRadius=t);const i=(new e.Matrix4).copy(this._gizmoMatrixState0);this.makeGizmos(this._gizmos.position,this._tbRadius),this._gizmoMatrixState0.copy(i),this.camera.lookAt(this._gizmos.position),this.updateTbState(Ca.IDLE,!1),this.dispatchEvent(Pa)}})),this.camera=null,this.domElement=r,this.scene=i,this.mouseActions=[],this._mouseOp=null,this._v2_1=new e.Vector2,this._v3_1=new e.Vector3,this._v3_2=new e.Vector3,this._m4_1=new e.Matrix4,this._m4_2=new e.Matrix4,this._quat=new e.Quaternion,this._translationMatrix=new e.Matrix4,this._rotationMatrix=new e.Matrix4,this._scaleMatrix=new e.Matrix4,this._rotationAxis=new e.Vector3,this._cameraMatrixState=new e.Matrix4,this._cameraProjectionState=new e.Matrix4,this._fovState=1,this._upState=new e.Vector3,this._zoomState=1,this._nearPos=0,this._farPos=0,this._gizmoMatrixState=new e.Matrix4,this._up0=new e.Vector3,this._zoom0=1,this._fov0=0,this._initialNear=0,this._nearPos0=0,this._initialFar=0,this._farPos0=0,this._cameraMatrixState0=new e.Matrix4,this._gizmoMatrixState0=new e.Matrix4,this._button=-1,this._touchStart=[],this._touchCurrent=[],this._input=Fa.NONE,this._switchSensibility=32,this._startFingerDistance=0,this._currentFingerDistance=0,this._startFingerRotation=0,this._currentFingerRotation=0,this._devPxRatio=0,this._downValid=!0,this._nclicks=0,this._downEvents=[],this._clickStart=0,this._maxDownTime=250,this._maxInterval=300,this._posThreshold=24,this._movementThreshold=24,this._currentCursorPosition=new e.Vector3,this._startCursorPosition=new e.Vector3,this._grid=null,this._gridPosition=new e.Vector3,this._gizmos=new e.Group,this._curvePts=128,this._timeStart=-1,this._animationId=-1,this.focusAnimationTime=500,this._timePrev=0,this._timeCurrent=0,this._anglePrev=0,this._angleCurrent=0,this._cursorPosPrev=new e.Vector3,this._cursorPosCurr=new e.Vector3,this._wPrev=0,this._wCurr=0,this.adjustNearFar=!1,this.scaleFactor=1.1,this.dampingFactor=25,this.wMax=20,this.enableAnimations=!0,this.enableGrid=!1,this.cursorZoom=!1,this.minFov=5,this.maxFov=90,this.enabled=!0,this.enablePan=!0,this.enableRotate=!0,this.enableZoom=!0,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.target=new e.Vector3(0,0,0),this._currentTarget=new e.Vector3(0,0,0),this._tbRadius=1,this._state=Ca.IDLE,this.setCamera(t),this.scene&&this.scene.add(this._gizmos),this._devPxRatio=window.devicePixelRatio,this.initializeMouseActions(),this.domElement&&this.connect(this.domElement),window.addEventListener("resize",this.onWindowResize)}applyTransformMatrix(t){if(null!=t&&t.camera&&this.camera&&(this._m4_1.copy(this._cameraMatrixState).premultiply(t.camera),this._m4_1.decompose(this.camera.position,this.camera.quaternion,this.camera.scale),this.camera.updateMatrix(),this._state!=Ca.ROTATE&&this._state!=Ca.ZROTATE&&this._state!=Ca.ANIMATION_ROTATE||this.camera.up.copy(this._upState).applyQuaternion(this.camera.quaternion)),null!=t&&t.gizmos&&(this._m4_1.copy(this._gizmoMatrixState).premultiply(t.gizmos),this._m4_1.decompose(this._gizmos.position,this._gizmos.quaternion,this._gizmos.scale),this._gizmos.updateMatrix()),(this._state==Ca.SCALE||this._state==Ca.FOCUS||this._state==Ca.ANIMATION_FOCUS)&&this.camera){const t=this.calculateTbRadius(this.camera);if(void 0!==t&&(this._tbRadius=t),this.adjustNearFar){const t=this.camera.position.distanceTo(this._gizmos.position),r=new e.Box3;r.setFromObject(this._gizmos);const i=new e.Sphere;r.getBoundingSphere(i);const n=Math.max(this._nearPos0,i.radius+i.center.length()),s=t-this._initialNear,o=Math.min(n,s);this.camera.near=t-o;const a=Math.min(this._farPos0,-i.radius+i.center.length()),l=t-this._initialFar,c=Math.min(a,l);this.camera.far=t-c,this.camera.updateProjectionMatrix()}else{let e=!1;this.camera.near!=this._initialNear&&(this.camera.near=this._initialNear,e=!0),this.camera.far!=this._initialFar&&(this.camera.far=this._initialFar,e=!0),e&&this.camera.updateProjectionMatrix()}}}setGizmosVisible(e){this._gizmos.visible=e,this.dispatchEvent(Pa)}setTransformationMatrices(e=null,t=null){e?_a.camera?_a.camera.copy(e):_a.camera=e.clone():_a.camera=null,t?_a.gizmos?_a.gizmos.copy(t):_a.gizmos=t.clone():_a.gizmos=null}}function Na(e){e.preventDefault()}class Da extends e.EventDispatcher{constructor(t,r){super(),p.default(this,"object",void 0),p.default(this,"domElement",null),p.default(this,"movementSpeed",1),p.default(this,"rollSpeed",.005),p.default(this,"dragToLook",!1),p.default(this,"autoForward",!1),p.default(this,"changeEvent",{type:"change"}),p.default(this,"EPS",1e-6),p.default(this,"tmpQuaternion",new e.Quaternion),p.default(this,"mouseStatus",0),p.default(this,"movementSpeedMultiplier",1),p.default(this,"moveState",{up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0}),p.default(this,"moveVector",new e.Vector3(0,0,0)),p.default(this,"rotationVector",new e.Vector3(0,0,0)),p.default(this,"keydown",(e=>{if(!e.altKey){switch(e.code){case"ShiftLeft":case"ShiftRight":this.movementSpeedMultiplier=.1;break;case"KeyW":this.moveState.forward=1;break;case"KeyS":this.moveState.back=1;break;case"KeyA":this.moveState.left=1;break;case"KeyD":this.moveState.right=1;break;case"KeyR":this.moveState.up=1;break;case"KeyF":this.moveState.down=1;break;case"ArrowUp":this.moveState.pitchUp=1;break;case"ArrowDown":this.moveState.pitchDown=1;break;case"ArrowLeft":this.moveState.yawLeft=1;break;case"ArrowRight":this.moveState.yawRight=1;break;case"KeyQ":this.moveState.rollLeft=1;break;case"KeyE":this.moveState.rollRight=1}this.updateMovementVector(),this.updateRotationVector()}})),p.default(this,"keyup",(e=>{switch(e.code){case"ShiftLeft":case"ShiftRight":this.movementSpeedMultiplier=1;break;case"KeyW":this.moveState.forward=0;break;case"KeyS":this.moveState.back=0;break;case"KeyA":this.moveState.left=0;break;case"KeyD":this.moveState.right=0;break;case"KeyR":this.moveState.up=0;break;case"KeyF":this.moveState.down=0;break;case"ArrowUp":this.moveState.pitchUp=0;break;case"ArrowDown":this.moveState.pitchDown=0;break;case"ArrowLeft":this.moveState.yawLeft=0;break;case"ArrowRight":this.moveState.yawRight=0;break;case"KeyQ":this.moveState.rollLeft=0;break;case"KeyE":this.moveState.rollRight=0}this.updateMovementVector(),this.updateRotationVector()})),p.default(this,"pointerdown",(e=>{if(this.dragToLook)this.mouseStatus++;else{switch(e.button){case 0:this.moveState.forward=1;break;case 2:this.moveState.back=1}this.updateMovementVector()}})),p.default(this,"pointermove",(e=>{if(!this.dragToLook||this.mouseStatus>0){const t=this.getContainerDimensions(),r=t.size[0]/2,i=t.size[1]/2;this.moveState.yawLeft=-(e.pageX-t.offset[0]-r)/r,this.moveState.pitchDown=(e.pageY-t.offset[1]-i)/i,this.updateRotationVector()}})),p.default(this,"pointerup",(e=>{if(this.dragToLook)this.mouseStatus--,this.moveState.yawLeft=this.moveState.pitchDown=0;else{switch(e.button){case 0:this.moveState.forward=0;break;case 2:this.moveState.back=0}this.updateMovementVector()}this.updateRotationVector()})),p.default(this,"lastQuaternion",new e.Quaternion),p.default(this,"lastPosition",new e.Vector3),p.default(this,"update",(e=>{const t=e*this.movementSpeed,r=e*this.rollSpeed;this.object.translateX(this.moveVector.x*t),this.object.translateY(this.moveVector.y*t),this.object.translateZ(this.moveVector.z*t),this.tmpQuaternion.set(this.rotationVector.x*r,this.rotationVector.y*r,this.rotationVector.z*r,1).normalize(),this.object.quaternion.multiply(this.tmpQuaternion),(this.lastPosition.distanceToSquared(this.object.position)>this.EPS||8*(1-this.lastQuaternion.dot(this.object.quaternion))>this.EPS)&&(this.dispatchEvent(this.changeEvent),this.lastQuaternion.copy(this.object.quaternion),this.lastPosition.copy(this.object.position))})),p.default(this,"updateMovementVector",(()=>{const e=this.moveState.forward||this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right,this.moveVector.y=-this.moveState.down+this.moveState.up,this.moveVector.z=-e+this.moveState.back})),p.default(this,"updateRotationVector",(()=>{this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp,this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft,this.rotationVector.z=-this.moveState.rollRight+this.moveState.rollLeft})),p.default(this,"getContainerDimensions",(()=>this.domElement==document||this.domElement instanceof Document?{size:[window.innerWidth,window.innerHeight],offset:[0,0]}:{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]})),p.default(this,"connect",(e=>{this.domElement=e,!e||e instanceof Document||e.setAttribute("tabindex",-1),this.domElement.addEventListener("contextmenu",Na),this.domElement.addEventListener("pointermove",this.pointermove),this.domElement.addEventListener("pointerdown",this.pointerdown),this.domElement.addEventListener("pointerup",this.pointerup),window.addEventListener("keydown",this.keydown),window.addEventListener("keyup",this.keyup)})),p.default(this,"dispose",(()=>{this.domElement.removeEventListener("contextmenu",Na),this.domElement.removeEventListener("pointermove",this.pointermove),this.domElement.removeEventListener("pointerdown",this.pointerdown),this.domElement.removeEventListener("pointerup",this.pointerup),window.removeEventListener("keydown",this.keydown),window.removeEventListener("keyup",this.keyup)})),this.object=t,void 0!==r&&this.connect(r),this.updateMovementVector(),this.updateRotationVector()}}class Ia{constructor(){p.default(this,"enabled",!0),p.default(this,"needsSwap",!0),p.default(this,"clear",!1),p.default(this,"renderToScreen",!1)}setSize(e,t){}render(e,t,r,i,n){console.error("THREE.Pass: .render() must be implemented in derived pass.")}}class Ua{constructor(t){p.default(this,"camera",new e.OrthographicCamera(-1,1,1,-1,0,1)),p.default(this,"geometry",new e.PlaneGeometry(2,2)),p.default(this,"mesh",void 0),this.mesh=new e.Mesh(this.geometry,t)}get material(){return this.mesh.material}set material(e){this.mesh.material=e}dispose(){this.mesh.geometry.dispose()}render(e){e.render(this.mesh,this.camera)}}class Oa extends Ia{constructor(t,r="tDiffuse"){super(),p.default(this,"textureID",void 0),p.default(this,"uniforms",void 0),p.default(this,"material",void 0),p.default(this,"fsQuad",void 0),this.textureID=r,t instanceof e.ShaderMaterial?(this.uniforms=t.uniforms,this.material=t):(this.uniforms=e.UniformsUtils.clone(t.uniforms),this.material=new e.ShaderMaterial({defines:Object.assign({},t.defines),uniforms:this.uniforms,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader})),this.fsQuad=new Ua(this.material)}render(e,t,r){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=r.texture),this.fsQuad.material=this.material,this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this.fsQuad.render(e))}}const ka={defines:{USE_3DTEXTURE:1},uniforms:{lut3d:{value:null},lut:{value:null},lutSize:{value:0},tDiffuse:{value:null},intensity:{value:1}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}\n\n\t",fragmentShader:"\n\n\t\tuniform float lutSize;\n\t\t#if USE_3DTEXTURE\n\t\tprecision highp sampler3D;\n\t\tuniform sampler3D lut3d;\n\t\t#else\n\t\tuniform sampler2D lut;\n\n\t\tvec3 lutLookup( sampler2D tex, float size, vec3 rgb ) {\n\n\t\t\tfloat sliceHeight = 1.0 / size;\n\t\t\tfloat yPixelHeight = 1.0 / ( size * size );\n\n\t\t\t// Get the slices on either side of the sample\n\t\t\tfloat slice = rgb.b * size;\n\t\t\tfloat interp = fract( slice );\n\t\t\tfloat slice0 = slice - interp;\n\t\t\tfloat centeredInterp = interp - 0.5;\n\n\t\t\tfloat slice1 = slice0 + sign( centeredInterp );\n\n\t\t\t// Pull y sample in by half a pixel in each direction to avoid color\n\t\t\t// bleeding from adjacent slices.\n\t\t\tfloat greenOffset = clamp( rgb.g * sliceHeight, yPixelHeight * 0.5, sliceHeight - yPixelHeight * 0.5 );\n\n\t\t\tvec2 uv0 = vec2(\n\t\t\t\trgb.r,\n\t\t\t\tslice0 * sliceHeight + greenOffset\n\t\t\t);\n\t\t\tvec2 uv1 = vec2(\n\t\t\t\trgb.r,\n\t\t\t\tslice1 * sliceHeight + greenOffset\n\t\t\t);\n\n\t\t\tvec3 sample0 = texture2D( tex, uv0 ).rgb;\n\t\t\tvec3 sample1 = texture2D( tex, uv1 ).rgb;\n\n\t\t\treturn mix( sample0, sample1, abs( centeredInterp ) );\n\n\t\t}\n\t\t#endif\n\n\t\tvarying vec2 vUv;\n\t\tuniform float intensity;\n\t\tuniform sampler2D tDiffuse;\n\t\tvoid main() {\n\n\t\t\tvec4 val = texture2D( tDiffuse, vUv );\n\t\t\tvec4 lutVal;\n\n\t\t\t// pull the sample in by half a pixel so the sample begins\n\t\t\t// at the center of the edge pixels.\n\t\t\tfloat pixelWidth = 1.0 / lutSize;\n\t\t\tfloat halfPixelWidth = 0.5 / lutSize;\n\t\t\tvec3 uvw = vec3( halfPixelWidth ) + val.rgb * ( 1.0 - pixelWidth );\n\n\t\t\t#if USE_3DTEXTURE\n\n\t\t\tlutVal = vec4( texture( lut3d, uvw ).rgb, val.a );\n\n\t\t\t#else\n\n\t\t\tlutVal = vec4( lutLookup( lut, lutSize, uvw ), val.a );\n\n\t\t\t#endif\n\n\t\t\tgl_FragColor = vec4( mix( val, lutVal, intensity ) );\n\n\t\t}\n\n\t"};const Va={uniforms:{tDiffuse:{value:null},tDisp:{value:null},byp:{value:0},amount:{value:.08},angle:{value:.02},seed:{value:.02},seed_x:{value:.02},seed_y:{value:.02},distortion_x:{value:.5},distortion_y:{value:.6},col_s:{value:.05}},vertexShader:"varying vec2 vUv;\n void main() {\n \t vUv = uv;\n \t gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }",fragmentShader:"uniform int byp; //should we apply the glitch ?\n uniform sampler2D tDiffuse;\n uniform sampler2D tDisp;\n uniform float amount;\n uniform float angle;\n uniform float seed;\n uniform float seed_x;\n uniform float seed_y;\n uniform float distortion_x;\n uniform float distortion_y;\n uniform float col_s;\n\n varying vec2 vUv;\n\n float rand(vec2 co){\n \t return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);\n }\n\n void main() {\n \tif(byp<1) {\n \t\tvec2 p = vUv;\n \t\tfloat xs = floor(gl_FragCoord.x / 0.5);\n \t\tfloat ys = floor(gl_FragCoord.y / 0.5);\n //based on staffantans glitch shader for unity https://github.com/staffantan/unityglitch\n \t\tvec4 normal = texture2D (tDisp, p*seed*seed);\n \t\tif(p.y<distortion_x+col_s && p.y>distortion_x-col_s*seed) {\n \t\t\tif(seed_x>0.){\n \t\t\t\tp.y = 1. - (p.y + distortion_y);\n \t\t\t}\n \t\t\telse {\n \t\t\t\tp.y = distortion_y;\n \t\t\t}\n \t\t}\n \t\tif(p.x<distortion_y+col_s && p.x>distortion_y-col_s*seed) {\n \t\t\tif(seed_y>0.){\n \t\t\t\tp.x=distortion_x;\n \t\t\t}\n \t\t\telse {\n \t\t\t\tp.x = 1. - (p.x + distortion_x);\n \t\t\t}\n \t\t}\n \t\tp.x+=normal.x*seed_x*(seed/5.);\n \t\tp.y+=normal.y*seed_y*(seed/5.);\n //base from RGB shift shader\n \t\tvec2 offset = amount * vec2( cos(angle), sin(angle));\n \t\tvec4 cr = texture2D(tDiffuse, p + offset);\n \t\tvec4 cga = texture2D(tDiffuse, p);\n \t\tvec4 cb = texture2D(tDiffuse, p - offset);\n \t\tgl_FragColor = vec4(cr.r, cga.g, cb.b, cga.a);\n //add noise\n \t\tvec4 snow = 200.*amount*vec4(rand(vec2(xs * seed,ys * seed*50.))*0.2);\n \t\tgl_FragColor = gl_FragColor+ snow;\n \t}\n \telse {\n \t\tgl_FragColor=texture2D (tDiffuse, vUv);\n \t}\n }"};const Ga={uniforms:{tDiffuse:{value:null},shape:{value:1},radius:{value:4},rotateR:{value:Math.PI/12*1},rotateG:{value:Math.PI/12*2},rotateB:{value:Math.PI/12*3},scatter:{value:0},width:{value:1},height:{value:1},blending:{value:1},blendingMode:{value:1},greyscale:{value:!1},disable:{value:!1}},vertexShader:["varying vec2 vUV;","void main() {","\tvUV = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);","}"].join("\n"),fragmentShader:["#define SQRT2_MINUS_ONE 0.41421356","#define SQRT2_HALF_MINUS_ONE 0.20710678","#define PI2 6.28318531","#define SHAPE_DOT 1","#define SHAPE_ELLIPSE 2","#define SHAPE_LINE 3","#define SHAPE_SQUARE 4","#define BLENDING_LINEAR 1","#define BLENDING_MULTIPLY 2","#define BLENDING_ADD 3","#define BLENDING_LIGHTER 4","#define BLENDING_DARKER 5","uniform sampler2D tDiffuse;","uniform float radius;","uniform float rotateR;","uniform float rotateG;","uniform float rotateB;","uniform float scatter;","uniform float width;","uniform float height;","uniform int shape;","uniform bool disable;","uniform float blending;","uniform int blendingMode;","varying vec2 vUV;","uniform bool greyscale;","const int samples = 8;","float blend( float a, float b, float t ) {","\treturn a * ( 1.0 - t ) + b * t;","}","float hypot( float x, float y ) {","\treturn sqrt( x * x + y * y );","}","float rand( vec2 seed ){","return fract( sin( dot( seed.xy, vec2( 12.9898, 78.233 ) ) ) * 43758.5453 );","}","float distanceToDotRadius( float channel, vec2 coord, vec2 normal, vec2 p, float angle, float rad_max ) {","\tfloat dist = hypot( coord.x - p.x, coord.y - p.y );","\tfloat rad = channel;","\tif ( shape == SHAPE_DOT ) {","\t\trad = pow( abs( rad ), 1.125 ) * rad_max;","\t} else if ( shape == SHAPE_ELLIPSE ) {","\t\trad = pow( abs( rad ), 1.125 ) * rad_max;","\t\tif ( dist != 0.0 ) {","\t\t\tfloat dot_p = abs( ( p.x - coord.x ) / dist * normal.x + ( p.y - coord.y ) / dist * normal.y );","\t\t\tdist = ( dist * ( 1.0 - SQRT2_HALF_MINUS_ONE ) ) + dot_p * dist * SQRT2_MINUS_ONE;","\t\t}","\t} else if ( shape == SHAPE_LINE ) {","\t\trad = pow( abs( rad ), 1.5) * rad_max;","\t\tfloat dot_p = ( p.x - coord.x ) * normal.x + ( p.y - coord.y ) * normal.y;","\t\tdist = hypot( normal.x * dot_p, normal.y * dot_p );","\t} else if ( shape == SHAPE_SQUARE ) {","\t\tfloat theta = atan( p.y - coord.y, p.x - coord.x ) - angle;","\t\tfloat sin_t = abs( sin( theta ) );","\t\tfloat cos_t = abs( cos( theta ) );","\t\trad = pow( abs( rad ), 1.4 );","\t\trad = rad_max * ( rad + ( ( sin_t > cos_t ) ? rad - sin_t * rad : rad - cos_t * rad ) );","\t}","\treturn rad - dist;","}","struct Cell {","\tvec2 normal;","\tvec2 p1;","\tvec2 p2;","\tvec2 p3;","\tvec2 p4;","\tfloat samp2;","\tfloat samp1;","\tfloat samp3;","\tfloat samp4;","};","vec4 getSample( vec2 point ) {","\tvec4 tex = texture2D( tDiffuse, vec2( point.x / width, point.y / height ) );","\tfloat base = rand( vec2( floor( point.x ), floor( point.y ) ) ) * PI2;","\tfloat step = PI2 / float( samples );","\tfloat dist = radius * 0.66;","\tfor ( int i = 0; i < samples; ++i ) {","\t\tfloat r = base + step * float( i );","\t\tvec2 coord = point + vec2( cos( r ) * dist, sin( r ) * dist );","\t\ttex += texture2D( tDiffuse, vec2( coord.x / width, coord.y / height ) );","\t}","\ttex /= float( samples ) + 1.0;","\treturn tex;","}","float getDotColour( Cell c, vec2 p, int channel, float angle, float aa ) {","\tfloat dist_c_1, dist_c_2, dist_c_3, dist_c_4, res;","\tif ( channel == 0 ) {","\t\tc.samp1 = getSample( c.p1 ).r;","\t\tc.samp2 = getSample( c.p2 ).r;","\t\tc.samp3 = getSample( c.p3 ).r;","\t\tc.samp4 = getSample( c.p4 ).r;","\t} else if (channel == 1) {","\t\tc.samp1 = getSample( c.p1 ).g;","\t\tc.samp2 = getSample( c.p2 ).g;","\t\tc.samp3 = getSample( c.p3 ).g;","\t\tc.samp4 = getSample( c.p4 ).g;","\t} else {","\t\tc.samp1 = getSample( c.p1 ).b;","\t\tc.samp3 = getSample( c.p3 ).b;","\t\tc.samp2 = getSample( c.p2 ).b;","\t\tc.samp4 = getSample( c.p4 ).b;","\t}","\tdist_c_1 = distanceToDotRadius( c.samp1, c.p1, c.normal, p, angle, radius );","\tdist_c_2 = distanceToDotRadius( c.samp2, c.p2, c.normal, p, angle, radius );","\tdist_c_3 = distanceToDotRadius( c.samp3, c.p3, c.normal, p, angle, radius );","\tdist_c_4 = distanceToDotRadius( c.samp4, c.p4, c.normal, p, angle, radius );","\tres = ( dist_c_1 > 0.0 ) ? clamp( dist_c_1 / aa, 0.0, 1.0 ) : 0.0;","\tres += ( dist_c_2 > 0.0 ) ? clamp( dist_c_2 / aa, 0.0, 1.0 ) : 0.0;","\tres += ( dist_c_3 > 0.0 ) ? clamp( dist_c_3 / aa, 0.0, 1.0 ) : 0.0;","\tres += ( dist_c_4 > 0.0 ) ? clamp( dist_c_4 / aa, 0.0, 1.0 ) : 0.0;","\tres = clamp( res, 0.0, 1.0 );","\treturn res;","}","Cell getReferenceCell( vec2 p, vec2 origin, float grid_angle, float step ) {","\tCell c;","\tvec2 n = vec2( cos( grid_angle ), sin( grid_angle ) );","\tfloat threshold = step * 0.5;","\tfloat dot_normal = n.x * ( p.x - origin.x ) + n.y * ( p.y - origin.y );","\tfloat dot_line = -n.y * ( p.x - origin.x ) + n.x * ( p.y - origin.y );","\tvec2 offset = vec2( n.x * dot_normal, n.y * dot_normal );","\tfloat offset_normal = mod( hypot( offset.x, offset.y ), step );","\tfloat normal_dir = ( dot_normal < 0.0 ) ? 1.0 : -1.0;","\tfloat normal_scale = ( ( offset_normal < threshold ) ? -offset_normal : step - offset_normal ) * normal_dir;","\tfloat offset_line = mod( hypot( ( p.x - offset.x ) - origin.x, ( p.y - offset.y ) - origin.y ), step );","\tfloat line_dir = ( dot_line < 0.0 ) ? 1.0 : -1.0;","\tfloat line_scale = ( ( offset_line < threshold ) ? -offset_line : step - offset_line ) * line_dir;","\tc.normal = n;","\tc.p1.x = p.x - n.x * normal_scale + n.y * line_scale;","\tc.p1.y = p.y - n.y * normal_scale - n.x * line_scale;","\tif ( scatter != 0.0 ) {","\t\tfloat off_mag = scatter * threshold * 0.5;","\t\tfloat off_angle = rand( vec2( floor( c.p1.x ), floor( c.p1.y ) ) ) * PI2;","\t\tc.p1.x += cos( off_angle ) * off_mag;","\t\tc.p1.y += sin( off_angle ) * off_mag;","\t}","\tfloat normal_step = normal_dir * ( ( offset_normal < threshold ) ? step : -step );","\tfloat line_step = line_dir * ( ( offset_line < threshold ) ? step : -step );","\tc.p2.x = c.p1.x - n.x * normal_step;","\tc.p2.y = c.p1.y - n.y * normal_step;","\tc.p3.x = c.p1.x + n.y * line_step;","\tc.p3.y = c.p1.y - n.x * line_step;","\tc.p4.x = c.p1.x - n.x * normal_step + n.y * line_step;","\tc.p4.y = c.p1.y - n.y * normal_step - n.x * line_step;","\treturn c;","}","float blendColour( float a, float b, float t ) {","\tif ( blendingMode == BLENDING_LINEAR ) {","\t\treturn blend( a, b, 1.0 - t );","\t} else if ( blendingMode == BLENDING_ADD ) {","\t\treturn blend( a, min( 1.0, a + b ), t );","\t} else if ( blendingMode == BLENDING_MULTIPLY ) {","\t\treturn blend( a, max( 0.0, a * b ), t );","\t} else if ( blendingMode == BLENDING_LIGHTER ) {","\t\treturn blend( a, max( a, b ), t );","\t} else if ( blendingMode == BLENDING_DARKER ) {","\t\treturn blend( a, min( a, b ), t );","\t} else {","\t\treturn blend( a, b, 1.0 - t );","\t}","}","void main() {","\tif ( ! disable ) {","\t\tvec2 p = vec2( vUV.x * width, vUV.y * height );","\t\tvec2 origin = vec2( 0, 0 );","\t\tfloat aa = ( radius < 2.5 ) ? radius * 0.5 : 1.25;","\t\tCell cell_r = getReferenceCell( p, origin, rotateR, radius );","\t\tCell cell_g = getReferenceCell( p, origin, rotateG, radius );","\t\tCell cell_b = getReferenceCell( p, origin, rotateB, radius );","\t\tfloat r = getDotColour( cell_r, p, 0, rotateR, aa );","\t\tfloat g = getDotColour( cell_g, p, 1, rotateG, aa );","\t\tfloat b = getDotColour( cell_b, p, 2, rotateB, aa );","\t\tvec4 colour = texture2D( tDiffuse, vUV );","\t\tr = blendColour( r, colour.r, blending );","\t\tg = blendColour( g, colour.g, blending );","\t\tb = blendColour( b, colour.b, blending );","\t\tif ( greyscale ) {","\t\t\tr = g = b = (r + b + g) / 3.0;","\t\t}","\t\tgl_FragColor = vec4( r, g, b, 1.0 );","\t} else {","\t\tgl_FragColor = texture2D( tDiffuse, vUV );","\t}","}"].join("\n")};const za={defines:{SMAA_THRESHOLD:"0.1"},uniforms:{tDiffuse:{value:null},resolution:{value:new e.Vector2(1/1024,1/512)}},vertexShader:["uniform vec2 resolution;","varying vec2 vUv;","varying vec4 vOffset[ 3 ];","void SMAAEdgeDetectionVS( vec2 texcoord ) {","\tvOffset[ 0 ] = texcoord.xyxy + resolution.xyxy * vec4( -1.0, 0.0, 0.0, 1.0 );","\tvOffset[ 1 ] = texcoord.xyxy + resolution.xyxy * vec4( 1.0, 0.0, 0.0, -1.0 );","\tvOffset[ 2 ] = texcoord.xyxy + resolution.xyxy * vec4( -2.0, 0.0, 0.0, 2.0 );","}","void main() {","\tvUv = uv;","\tSMAAEdgeDetectionVS( vUv );","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","varying vec2 vUv;","varying vec4 vOffset[ 3 ];","vec4 SMAAColorEdgeDetectionPS( vec2 texcoord, vec4 offset[3], sampler2D colorTex ) {","\tvec2 threshold = vec2( SMAA_THRESHOLD, SMAA_THRESHOLD );","\tvec4 delta;","\tvec3 C = texture2D( colorTex, texcoord ).rgb;","\tvec3 Cleft = texture2D( colorTex, offset[0].xy ).rgb;","\tvec3 t = abs( C - Cleft );","\tdelta.x = max( max( t.r, t.g ), t.b );","\tvec3 Ctop = texture2D( colorTex, offset[0].zw ).rgb;","\tt = abs( C - Ctop );","\tdelta.y = max( max( t.r, t.g ), t.b );","\tvec2 edges = step( threshold, delta.xy );","\tif ( dot( edges, vec2( 1.0, 1.0 ) ) == 0.0 )","\t\tdiscard;","\tvec3 Cright = texture2D( colorTex, offset[1].xy ).rgb;","\tt = abs( C - Cright );","\tdelta.z = max( max( t.r, t.g ), t.b );","\tvec3 Cbottom = texture2D( colorTex, offset[1].zw ).rgb;","\tt = abs( C - Cbottom );","\tdelta.w = max( max( t.r, t.g ), t.b );","\tfloat maxDelta = max( max( max( delta.x, delta.y ), delta.z ), delta.w );","\tvec3 Cleftleft = texture2D( colorTex, offset[2].xy ).rgb;","\tt = abs( C - Cleftleft );","\tdelta.z = max( max( t.r, t.g ), t.b );","\tvec3 Ctoptop = texture2D( colorTex, offset[2].zw ).rgb;","\tt = abs( C - Ctoptop );","\tdelta.w = max( max( t.r, t.g ), t.b );","\tmaxDelta = max( max( maxDelta, delta.z ), delta.w );","\tedges.xy *= step( 0.5 * maxDelta, delta.xy );","\treturn vec4( edges, 0.0, 0.0 );","}","void main() {","\tgl_FragColor = SMAAColorEdgeDetectionPS( vUv, vOffset, tDiffuse );","}"].join("\n")},Ha={defines:{SMAA_MAX_SEARCH_STEPS:"8",SMAA_AREATEX_MAX_DISTANCE:"16",SMAA_AREATEX_PIXEL_SIZE:"( 1.0 / vec2( 160.0, 560.0 ) )",SMAA_AREATEX_SUBTEX_SIZE:"( 1.0 / 7.0 )"},uniforms:{tDiffuse:{value:null},tArea:{value:null},tSearch:{value:null},resolution:{value:new e.Vector2(1/1024,1/512)}},vertexShader:["uniform vec2 resolution;","varying vec2 vUv;","varying vec4 vOffset[ 3 ];","varying vec2 vPixcoord;","void SMAABlendingWeightCalculationVS( vec2 texcoord ) {","\tvPixcoord = texcoord / resolution;","\tvOffset[ 0 ] = texcoord.xyxy + resolution.xyxy * vec4( -0.25, 0.125, 1.25, 0.125 );","\tvOffset[ 1 ] = texcoord.xyxy + resolution.xyxy * vec4( -0.125, 0.25, -0.125, -1.25 );","\tvOffset[ 2 ] = vec4( vOffset[ 0 ].xz, vOffset[ 1 ].yw ) + vec4( -2.0, 2.0, -2.0, 2.0 ) * resolution.xxyy * float( SMAA_MAX_SEARCH_STEPS );","}","void main() {","\tvUv = uv;","\tSMAABlendingWeightCalculationVS( vUv );","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["#define SMAASampleLevelZeroOffset( tex, coord, offset ) texture2D( tex, coord + float( offset ) * resolution, 0.0 )","uniform sampler2D tDiffuse;","uniform sampler2D tArea;","uniform sampler2D tSearch;","uniform vec2 resolution;","varying vec2 vUv;","varying vec4 vOffset[3];","varying vec2 vPixcoord;","#if __VERSION__ == 100","vec2 round( vec2 x ) {","\treturn sign( x ) * floor( abs( x ) + 0.5 );","}","#endif","float SMAASearchLength( sampler2D searchTex, vec2 e, float bias, float scale ) {","\te.r = bias + e.r * scale;","\treturn 255.0 * texture2D( searchTex, e, 0.0 ).r;","}","float SMAASearchXLeft( sampler2D edgesTex, sampler2D searchTex, vec2 texcoord, float end ) {","\tvec2 e = vec2( 0.0, 1.0 );","\tfor ( int i = 0; i < SMAA_MAX_SEARCH_STEPS; i ++ ) {","\t\te = texture2D( edgesTex, texcoord, 0.0 ).rg;","\t\ttexcoord -= vec2( 2.0, 0.0 ) * resolution;","\t\tif ( ! ( texcoord.x > end && e.g > 0.8281 && e.r == 0.0 ) ) break;","\t}","\ttexcoord.x += 0.25 * resolution.x;","\ttexcoord.x += resolution.x;","\ttexcoord.x += 2.0 * resolution.x;","\ttexcoord.x -= resolution.x * SMAASearchLength(searchTex, e, 0.0, 0.5);","\treturn texcoord.x;","}","float SMAASearchXRight( sampler2D edgesTex, sampler2D searchTex, vec2 texcoord, float end ) {","\tvec2 e = vec2( 0.0, 1.0 );","\tfor ( int i = 0; i < SMAA_MAX_SEARCH_STEPS; i ++ ) {","\t\te = texture2D( edgesTex, texcoord, 0.0 ).rg;","\t\ttexcoord += vec2( 2.0, 0.0 ) * resolution;","\t\tif ( ! ( texcoord.x < end && e.g > 0.8281 && e.r == 0.0 ) ) break;","\t}","\ttexcoord.x -= 0.25 * resolution.x;","\ttexcoord.x -= resolution.x;","\ttexcoord.x -= 2.0 * resolution.x;","\ttexcoord.x += resolution.x * SMAASearchLength( searchTex, e, 0.5, 0.5 );","\treturn texcoord.x;","}","float SMAASearchYUp( sampler2D edgesTex, sampler2D searchTex, vec2 texcoord, float end ) {","\tvec2 e = vec2( 1.0, 0.0 );","\tfor ( int i = 0; i < SMAA_MAX_SEARCH_STEPS; i ++ ) {","\t\te = texture2D( edgesTex, texcoord, 0.0 ).rg;","\t\ttexcoord += vec2( 0.0, 2.0 ) * resolution;","\t\tif ( ! ( texcoord.y > end && e.r > 0.8281 && e.g == 0.0 ) ) break;","\t}","\ttexcoord.y -= 0.25 * resolution.y;","\ttexcoord.y -= resolution.y;","\ttexcoord.y -= 2.0 * resolution.y;","\ttexcoord.y += resolution.y * SMAASearchLength( searchTex, e.gr, 0.0, 0.5 );","\treturn texcoord.y;","}","float SMAASearchYDown( sampler2D edgesTex, sampler2D searchTex, vec2 texcoord, float end ) {","\tvec2 e = vec2( 1.0, 0.0 );","\tfor ( int i = 0; i < SMAA_MAX_SEARCH_STEPS; i ++ ) {","\t\te = texture2D( edgesTex, texcoord, 0.0 ).rg;","\t\ttexcoord -= vec2( 0.0, 2.0 ) * resolution;","\t\tif ( ! ( texcoord.y < end && e.r > 0.8281 && e.g == 0.0 ) ) break;","\t}","\ttexcoord.y += 0.25 * resolution.y;","\ttexcoord.y += resolution.y;","\ttexcoord.y += 2.0 * resolution.y;","\ttexcoord.y -= resolution.y * SMAASearchLength( searchTex, e.gr, 0.5, 0.5 );","\treturn texcoord.y;","}","vec2 SMAAArea( sampler2D areaTex, vec2 dist, float e1, float e2, float offset ) {","\tvec2 texcoord = float( SMAA_AREATEX_MAX_DISTANCE ) * round( 4.0 * vec2( e1, e2 ) ) + dist;","\ttexcoord = SMAA_AREATEX_PIXEL_SIZE * texcoord + ( 0.5 * SMAA_AREATEX_PIXEL_SIZE );","\ttexcoord.y += SMAA_AREATEX_SUBTEX_SIZE * offset;","\treturn texture2D( areaTex, texcoord, 0.0 ).rg;","}","vec4 SMAABlendingWeightCalculationPS( vec2 texcoord, vec2 pixcoord, vec4 offset[ 3 ], sampler2D edgesTex, sampler2D areaTex, sampler2D searchTex, ivec4 subsampleIndices ) {","\tvec4 weights = vec4( 0.0, 0.0, 0.0, 0.0 );","\tvec2 e = texture2D( edgesTex, texcoord ).rg;","\tif ( e.g > 0.0 ) {","\t\tvec2 d;","\t\tvec2 coords;","\t\tcoords.x = SMAASearchXLeft( edgesTex, searchTex, offset[ 0 ].xy, offset[ 2 ].x );","\t\tcoords.y = offset[ 1 ].y;","\t\td.x = coords.x;","\t\tfloat e1 = texture2D( edgesTex, coords, 0.0 ).r;","\t\tcoords.x = SMAASearchXRight( edgesTex, searchTex, offset[ 0 ].zw, offset[ 2 ].y );","\t\td.y = coords.x;","\t\td = d / resolution.x - pixcoord.x;","\t\tvec2 sqrt_d = sqrt( abs( d ) );","\t\tcoords.y -= 1.0 * resolution.y;","\t\tfloat e2 = SMAASampleLevelZeroOffset( edgesTex, coords, ivec2( 1, 0 ) ).r;","\t\tweights.rg = SMAAArea( areaTex, sqrt_d, e1, e2, float( subsampleIndices.y ) );","\t}","\tif ( e.r > 0.0 ) {","\t\tvec2 d;","\t\tvec2 coords;","\t\tcoords.y = SMAASearchYUp( edgesTex, searchTex, offset[ 1 ].xy, offset[ 2 ].z );","\t\tcoords.x = offset[ 0 ].x;","\t\td.x = coords.y;","\t\tfloat e1 = texture2D( edgesTex, coords, 0.0 ).g;","\t\tcoords.y = SMAASearchYDown( edgesTex, searchTex, offset[ 1 ].zw, offset[ 2 ].w );","\t\td.y = coords.y;","\t\td = d / resolution.y - pixcoord.y;","\t\tvec2 sqrt_d = sqrt( abs( d ) );","\t\tcoords.y -= 1.0 * resolution.y;","\t\tfloat e2 = SMAASampleLevelZeroOffset( edgesTex, coords, ivec2( 0, 1 ) ).g;","\t\tweights.ba = SMAAArea( areaTex, sqrt_d, e1, e2, float( subsampleIndices.x ) );","\t}","\treturn weights;","}","void main() {","\tgl_FragColor = SMAABlendingWeightCalculationPS( vUv, vPixcoord, vOffset, tDiffuse, tArea, tSearch, ivec4( 0.0 ) );","}"].join("\n")},ja={uniforms:{tDiffuse:{value:null},tColor:{value:null},resolution:{value:new e.Vector2(1/1024,1/512)}},vertexShader:["uniform vec2 resolution;","varying vec2 vUv;","varying vec4 vOffset[ 2 ];","void SMAANeighborhoodBlendingVS( vec2 texcoord ) {","\tvOffset[ 0 ] = texcoord.xyxy + resolution.xyxy * vec4( -1.0, 0.0, 0.0, 1.0 );","\tvOffset[ 1 ] = texcoord.xyxy + resolution.xyxy * vec4( 1.0, 0.0, 0.0, -1.0 );","}","void main() {","\tvUv = uv;","\tSMAANeighborhoodBlendingVS( vUv );","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","uniform sampler2D tColor;","uniform vec2 resolution;","varying vec2 vUv;","varying vec4 vOffset[ 2 ];","vec4 SMAANeighborhoodBlendingPS( vec2 texcoord, vec4 offset[ 2 ], sampler2D colorTex, sampler2D blendTex ) {","\tvec4 a;","\ta.xz = texture2D( blendTex, texcoord ).xz;","\ta.y = texture2D( blendTex, offset[ 1 ].zw ).g;","\ta.w = texture2D( blendTex, offset[ 1 ].xy ).a;","\tif ( dot(a, vec4( 1.0, 1.0, 1.0, 1.0 )) < 1e-5 ) {","\t\treturn texture2D( colorTex, texcoord, 0.0 );","\t} else {","\t\tvec2 offset;","\t\toffset.x = a.a > a.b ? a.a : -a.b;","\t\toffset.y = a.g > a.r ? -a.g : a.r;","\t\tif ( abs( offset.x ) > abs( offset.y )) {","\t\t\toffset.y = 0.0;","\t\t} else {","\t\t\toffset.x = 0.0;","\t\t}","\t\tvec4 C = texture2D( colorTex, texcoord, 0.0 );","\t\ttexcoord += sign( offset ) * resolution;","\t\tvec4 Cop = texture2D( colorTex, texcoord, 0.0 );","\t\tfloat s = abs( offset.x ) > abs( offset.y ) ? abs( offset.x ) : abs( offset.y );","\t\tC.xyz = pow(C.xyz, vec3(2.2));","\t\tCop.xyz = pow(Cop.xyz, vec3(2.2));","\t\tvec4 mixed = mix(C, Cop, s);","\t\tmixed.xyz = pow(mixed.xyz, vec3(1.0 / 2.2));","\t\treturn mixed;","\t}","}","void main() {","\tgl_FragColor = SMAANeighborhoodBlendingPS( vUv, vOffset, tColor, tDiffuse );","}"].join("\n")};const Wa={uniforms:{tDiffuse:{value:null},time:{value:0},nIntensity:{value:.5},sIntensity:{value:.05},sCount:{value:4096},grayscale:{value:1}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["#include <common>","uniform float time;","uniform bool grayscale;","uniform float nIntensity;","uniform float sIntensity;","uniform float sCount;","uniform sampler2D tDiffuse;","varying vec2 vUv;","void main() {","\tvec4 cTextureScreen = texture2D( tDiffuse, vUv );","\tfloat dx = rand( vUv + time );","\tvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx, 0.0, 1.0 );","\tvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );","\tcResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;","\tcResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );","\tif( grayscale ) {","\t\tcResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );","\t}","\tgl_FragColor = vec4( cResult, cTextureScreen.a );","}"].join("\n")};const Xa={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform float opacity;","uniform sampler2D tDiffuse;","varying vec2 vUv;","void main() {","\tvec4 texel = texture2D( tDiffuse, vUv );","\tgl_FragColor = opacity * texel;","}"].join("\n")};const Qa={defines:{PERSPECTIVE_CAMERA:1,KERNEL_SIZE:32},uniforms:{tDiffuse:{value:null},tNormal:{value:null},tDepth:{value:null},tNoise:{value:null},kernel:{value:null},cameraNear:{value:null},cameraFar:{value:null},resolution:{value:new e.Vector2},cameraProjectionMatrix:{value:new e.Matrix4},cameraInverseProjectionMatrix:{value:new e.Matrix4},kernelRadius:{value:8},minDistance:{value:.005},maxDistance:{value:.05}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","uniform sampler2D tNormal;","uniform sampler2D tDepth;","uniform sampler2D tNoise;","uniform vec3 kernel[ KERNEL_SIZE ];","uniform vec2 resolution;","uniform float cameraNear;","uniform float cameraFar;","uniform mat4 cameraProjectionMatrix;","uniform mat4 cameraInverseProjectionMatrix;","uniform float kernelRadius;","uniform float minDistance;","uniform float maxDistance;","varying vec2 vUv;","#include <packing>","float getDepth( const in vec2 screenPosition ) {","\treturn texture2D( tDepth, screenPosition ).x;","}","float getLinearDepth( const in vec2 screenPosition ) {","\t#if PERSPECTIVE_CAMERA == 1","\t\tfloat fragCoordZ = texture2D( tDepth, screenPosition ).x;","\t\tfloat viewZ = perspectiveDepthToViewZ( fragCoordZ, cameraNear, cameraFar );","\t\treturn viewZToOrthographicDepth( viewZ, cameraNear, cameraFar );","\t#else","\t\treturn texture2D( tDepth, screenPosition ).x;","\t#endif","}","float getViewZ( const in float depth ) {","\t#if PERSPECTIVE_CAMERA == 1","\t\treturn perspectiveDepthToViewZ( depth, cameraNear, cameraFar );","\t#else","\t\treturn orthographicDepthToViewZ( depth, cameraNear, cameraFar );","\t#endif","}","vec3 getViewPosition( const in vec2 screenPosition, const in float depth, const in float viewZ ) {","\tfloat clipW = cameraProjectionMatrix[2][3] * viewZ + cameraProjectionMatrix[3][3];","\tvec4 clipPosition = vec4( ( vec3( screenPosition, depth ) - 0.5 ) * 2.0, 1.0 );","\tclipPosition *= clipW; // unprojection.","\treturn ( cameraInverseProjectionMatrix * clipPosition ).xyz;","}","vec3 getViewNormal( const in vec2 screenPosition ) {","\treturn unpackRGBToNormal( texture2D( tNormal, screenPosition ).xyz );","}","void main() {","\tfloat depth = getDepth( vUv );","\tfloat viewZ = getViewZ( depth );","\tvec3 viewPosition = getViewPosition( vUv, depth, viewZ );","\tvec3 viewNormal = getViewNormal( vUv );"," vec2 noiseScale = vec2( resolution.x / 4.0, resolution.y / 4.0 );","\tvec3 random = texture2D( tNoise, vUv * noiseScale ).xyz;","\tvec3 tangent = normalize( random - viewNormal * dot( random, viewNormal ) );","\tvec3 bitangent = cross( viewNormal, tangent );","\tmat3 kernelMatrix = mat3( tangent, bitangent, viewNormal );"," float occlusion = 0.0;"," for ( int i = 0; i < KERNEL_SIZE; i ++ ) {","\t\tvec3 sampleVector = kernelMatrix * kernel[ i ];","\t\tvec3 samplePoint = viewPosition + ( sampleVector * kernelRadius );","\t\tvec4 samplePointNDC = cameraProjectionMatrix * vec4( samplePoint, 1.0 );","\t\tsamplePointNDC /= samplePointNDC.w;","\t\tvec2 samplePointUv = samplePointNDC.xy * 0.5 + 0.5;","\t\tfloat realDepth = getLinearDepth( samplePointUv );","\t\tfloat sampleDepth = viewZToOrthographicDepth( samplePoint.z, cameraNear, cameraFar );","\t\tfloat delta = sampleDepth - realDepth;","\t\tif ( delta > minDistance && delta < maxDistance ) {","\t\t\tocclusion += 1.0;","\t\t}","\t}","\tocclusion = clamp( occlusion / float( KERNEL_SIZE ), 0.0, 1.0 );","\tgl_FragColor = vec4( vec3( 1.0 - occlusion ), 1.0 );","}"].join("\n")},Ya={defines:{PERSPECTIVE_CAMERA:1},uniforms:{tDepth:{value:null},cameraNear:{value:null},cameraFar:{value:null}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDepth;","uniform float cameraNear;","uniform float cameraFar;","varying vec2 vUv;","#include <packing>","float getLinearDepth( const in vec2 screenPosition ) {","\t#if PERSPECTIVE_CAMERA == 1","\t\tfloat fragCoordZ = texture2D( tDepth, screenPosition ).x;","\t\tfloat viewZ = perspectiveDepthToViewZ( fragCoordZ, cameraNear, cameraFar );","\t\treturn viewZToOrthographicDepth( viewZ, cameraNear, cameraFar );","\t#else","\t\treturn texture2D( tDepth, screenPosition ).x;","\t#endif","}","void main() {","\tfloat depth = getLinearDepth( vUv );","\tgl_FragColor = vec4( vec3( 1.0 - depth ), 1.0 );","}"].join("\n")},Ka={uniforms:{tDiffuse:{value:null},resolution:{value:new e.Vector2}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","uniform vec2 resolution;","varying vec2 vUv;","void main() {","\tvec2 texelSize = ( 1.0 / resolution );","\tfloat result = 0.0;","\tfor ( int i = - 2; i <= 2; i ++ ) {","\t\tfor ( int j = - 2; j <= 2; j ++ ) {","\t\t\tvec2 offset = ( vec2( float( i ), float( j ) ) ) * texelSize;","\t\t\tresult += texture2D( tDiffuse, vUv + offset ).r;","\t\t}","\t}","\tgl_FragColor = vec4( vec3( result / ( 5.0 * 5.0 ) ), 1.0 );","}"].join("\n")};class qa extends Ia{constructor(t,r,i,n){super(),this.width=void 0!==i?i:512,this.height=void 0!==n?n:512,this.clear=!0,this.camera=r,this.scene=t,this.kernelRadius=8,this.kernelSize=32,this.kernel=[],this.noiseTexture=null,this.output=0,this.minDistance=.005,this.maxDistance=.1,this._visibilityCache=new Map,this.generateSampleKernel(),this.generateRandomKernelRotations();const s=new e.DepthTexture;s.format=e.DepthStencilFormat,s.type=e.UnsignedInt248Type,this.beautyRenderTarget=new e.WebGLRenderTarget(this.width,this.height),this.normalRenderTarget=new e.WebGLRenderTarget(this.width,this.height,{minFilter:e.NearestFilter,magFilter:e.NearestFilter,depthTexture:s}),this.ssaoRenderTarget=new e.WebGLRenderTarget(this.width,this.height),this.blurRenderTarget=this.ssaoRenderTarget.clone(),void 0===Qa&&console.error("THREE.SSAOPass: The pass relies on SSAOShader."),this.ssaoMaterial=new e.ShaderMaterial({defines:Object.assign({},Qa.defines),uniforms:e.UniformsUtils.clone(Qa.uniforms),vertexShader:Qa.vertexShader,fragmentShader:Qa.fragmentShader,blending:e.NoBlending}),this.ssaoMaterial.uniforms.tDiffuse.value=this.beautyRenderTarget.texture,this.ssaoMaterial.uniforms.tNormal.value=this.normalRenderTarget.texture,this.ssaoMaterial.uniforms.tDepth.value=this.normalRenderTarget.depthTexture,this.ssaoMaterial.uniforms.tNoise.value=this.noiseTexture,this.ssaoMaterial.uniforms.kernel.value=this.kernel,this.ssaoMaterial.uniforms.cameraNear.value=this.camera.near,this.ssaoMaterial.uniforms.cameraFar.value=this.camera.far,this.ssaoMaterial.uniforms.resolution.value.set(this.width,this.height),this.ssaoMaterial.uniforms.cameraProjectionMatrix.value.copy(this.camera.projectionMatrix),this.ssaoMaterial.uniforms.cameraInverseProjectionMatrix.value.copy(this.camera.projectionMatrixInverse),this.normalMaterial=new e.MeshNormalMaterial,this.normalMaterial.blending=e.NoBlending,this.blurMaterial=new e.ShaderMaterial({defines:Object.assign({},Ka.defines),uniforms:e.UniformsUtils.clone(Ka.uniforms),vertexShader:Ka.vertexShader,fragmentShader:Ka.fragmentShader}),this.blurMaterial.uniforms.tDiffuse.value=this.ssaoRenderTarget.texture,this.blurMaterial.uniforms.resolution.value.set(this.width,this.height),this.depthRenderMaterial=new e.ShaderMaterial({defines:Object.assign({},Ya.defines),uniforms:e.UniformsUtils.clone(Ya.uniforms),vertexShader:Ya.vertexShader,fragmentShader:Ya.fragmentShader,blending:e.NoBlending}),this.depthRenderMaterial.uniforms.tDepth.value=this.normalRenderTarget.depthTexture,this.depthRenderMaterial.uniforms.cameraNear.value=this.camera.near,this.depthRenderMaterial.uniforms.cameraFar.value=this.camera.far,this.copyMaterial=new e.ShaderMaterial({uniforms:e.UniformsUtils.clone(Xa.uniforms),vertexShader:Xa.vertexShader,fragmentShader:Xa.fragmentShader,transparent:!0,depthTest:!1,depthWrite:!1,blendSrc:e.DstColorFactor,blendDst:e.ZeroFactor,blendEquation:e.AddEquation,blendSrcAlpha:e.DstAlphaFactor,blendDstAlpha:e.ZeroFactor,blendEquationAlpha:e.AddEquation}),this.fsQuad=new Ua(null),this.originalClearColor=new e.Color}dispose(){this.beautyRenderTarget.dispose(),this.normalRenderTarget.dispose(),this.ssaoRenderTarget.dispose(),this.blurRenderTarget.dispose(),this.normalMaterial.dispose(),this.blurMaterial.dispose(),this.copyMaterial.dispose(),this.depthRenderMaterial.dispose(),this.fsQuad.dispose()}render(t,r){switch(!1===t.capabilities.isWebGL2&&(this.noiseTexture.format=e.LuminanceFormat),t.setRenderTarget(this.beautyRenderTarget),t.clear(),t.render(this.scene,this.camera),this.overrideVisibility(),this.renderOverride(t,this.normalMaterial,this.normalRenderTarget,7829503,1),this.restoreVisibility(),this.ssaoMaterial.uniforms.kernelRadius.value=this.kernelRadius,this.ssaoMaterial.uniforms.minDistance.value=this.minDistance,this.ssaoMaterial.uniforms.maxDistance.value=this.maxDistance,this.renderPass(t,this.ssaoMaterial,this.ssaoRenderTarget),this.renderPass(t,this.blurMaterial,this.blurRenderTarget),this.output){case qa.OUTPUT.SSAO:this.copyMaterial.uniforms.tDiffuse.value=this.ssaoRenderTarget.texture,this.copyMaterial.blending=e.NoBlending,this.renderPass(t,this.copyMaterial,this.renderToScreen?null:r);break;case qa.OUTPUT.Blur:this.copyMaterial.uniforms.tDiffuse.value=this.blurRenderTarget.texture,this.copyMaterial.blending=e.NoBlending,this.renderPass(t,this.copyMaterial,this.renderToScreen?null:r);break;case qa.OUTPUT.Beauty:this.copyMaterial.uniforms.tDiffuse.value=this.beautyRenderTarget.texture,this.copyMaterial.blending=e.NoBlending,this.renderPass(t,this.copyMaterial,this.renderToScreen?null:r);break;case qa.OUTPUT.Depth:this.renderPass(t,this.depthRenderMaterial,this.renderToScreen?null:r);break;case qa.OUTPUT.Normal:this.copyMaterial.uniforms.tDiffuse.value=this.normalRenderTarget.texture,this.copyMaterial.blending=e.NoBlending,this.renderPass(t,this.copyMaterial,this.renderToScreen?null:r);break;case qa.OUTPUT.Default:this.copyMaterial.uniforms.tDiffuse.value=this.beautyRenderTarget.texture,this.copyMaterial.blending=e.NoBlending,this.renderPass(t,this.copyMaterial,this.renderToScreen?null:r),this.copyMaterial.uniforms.tDiffuse.value=this.blurRenderTarget.texture,this.copyMaterial.blending=e.CustomBlending,this.renderPass(t,this.copyMaterial,this.renderToScreen?null:r);break;default:console.warn("THREE.SSAOPass: Unknown output type.")}}renderPass(e,t,r,i,n){e.getClearColor(this.originalClearColor);const s=e.getClearAlpha(),o=e.autoClear;e.setRenderTarget(r),e.autoClear=!1,null!=i&&(e.setClearColor(i),e.setClearAlpha(n||0),e.clear()),this.fsQuad.material=t,this.fsQuad.render(e),e.autoClear=o,e.setClearColor(this.originalClearColor),e.setClearAlpha(s)}renderOverride(e,t,r,i,n){e.getClearColor(this.originalClearColor);const s=e.getClearAlpha(),o=e.autoClear;e.setRenderTarget(r),e.autoClear=!1,i=t.clearColor||i,n=t.clearAlpha||n,null!=i&&(e.setClearColor(i),e.setClearAlpha(n||0),e.clear()),this.scene.overrideMaterial=t,e.render(this.scene,this.camera),this.scene.overrideMaterial=null,e.autoClear=o,e.setClearColor(this.originalClearColor),e.setClearAlpha(s)}setSize(e,t){this.width=e,this.height=t,this.beautyRenderTarget.setSize(e,t),this.ssaoRenderTarget.setSize(e,t),this.normalRenderTarget.setSize(e,t),this.blurRenderTarget.setSize(e,t),this.ssaoMaterial.uniforms.resolution.value.set(e,t),this.ssaoMaterial.uniforms.cameraProjectionMatrix.value.copy(this.camera.projectionMatrix),this.ssaoMaterial.uniforms.cameraInverseProjectionMatrix.value.copy(this.camera.projectionMatrixInverse),this.blurMaterial.uniforms.resolution.value.set(e,t)}generateSampleKernel(){const t=this.kernelSize,r=this.kernel;for(let i=0;i<t;i++){const n=new e.Vector3;n.x=2*Math.random()-1,n.y=2*Math.random()-1,n.z=Math.random(),n.normalize();let s=i/t;s=e.MathUtils.lerp(.1,1,s*s),n.multiplyScalar(s),r.push(n)}}generateRandomKernelRotations(){void 0===Js&&console.error("THREE.SSAOPass: The pass relies on SimplexNoise.");const t=new Js,r=new Float32Array(16);for(let e=0;e<16;e++){const i=2*Math.random()-1,n=2*Math.random()-1,s=0;r[e]=t.noise3d(i,n,s)}this.noiseTexture=new e.DataTexture(r,4,4,e.RedFormat,e.FloatType),this.noiseTexture.wrapS=e.RepeatWrapping,this.noiseTexture.wrapT=e.RepeatWrapping,this.noiseTexture.needsUpdate=!0}overrideVisibility(){const e=this.scene,t=this._visibilityCache;e.traverse((function(e){t.set(e,e.visible),(e.isPoints||e.isLine)&&(e.visible=!1)}))}restoreVisibility(){const e=this.scene,t=this._visibilityCache;e.traverse((function(e){const r=t.get(e);e.visible=r})),t.clear()}}qa.OUTPUT={Default:0,SSAO:1,Blur:2,Beauty:3,Depth:4,Normal:5};const Ja={defines:{DEPTH_PACKING:1,PERSPECTIVE_CAMERA:1},uniforms:{tColor:{value:null},tDepth:{value:null},focus:{value:1},aspect:{value:1},aperture:{value:.025},maxblur:{value:.01},nearClip:{value:1},farClip:{value:1e3}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["#include <common>","varying vec2 vUv;","uniform sampler2D tColor;","uniform sampler2D tDepth;","uniform float maxblur;","uniform float aperture;","uniform float nearClip;","uniform float farClip;","uniform float focus;","uniform float aspect;","#include <packing>","float getDepth( const in vec2 screenPosition ) {","\t#if DEPTH_PACKING == 1","\treturn unpackRGBAToDepth( texture2D( tDepth, screenPosition ) );","\t#else","\treturn texture2D( tDepth, screenPosition ).x;","\t#endif","}","float getViewZ( const in float depth ) {","\t#if PERSPECTIVE_CAMERA == 1","\treturn perspectiveDepthToViewZ( depth, nearClip, farClip );","\t#else","\treturn orthographicDepthToViewZ( depth, nearClip, farClip );","\t#endif","}","void main() {","\tvec2 aspectcorrect = vec2( 1.0, aspect );","\tfloat viewZ = getViewZ( getDepth( vUv ) );","\tfloat factor = ( focus + viewZ );","\tvec2 dofblur = vec2 ( clamp( factor * aperture, -maxblur, maxblur ) );","\tvec2 dofblur9 = dofblur * 0.9;","\tvec2 dofblur7 = dofblur * 0.7;","\tvec2 dofblur4 = dofblur * 0.4;","\tvec4 col = vec4( 0.0 );","\tcol += texture2D( tColor, vUv.xy );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.0, 0.4 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.15, 0.37 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.29, 0.29 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.37, 0.15 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.40, 0.0 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.37, -0.15 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.29, -0.29 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.15, -0.37 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.0, -0.4 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.15, 0.37 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.29, 0.29 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.37, 0.15 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.4, 0.0 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.37, -0.15 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.15, -0.37 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.15, 0.37 ) * aspectcorrect ) * dofblur9 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.37, 0.15 ) * aspectcorrect ) * dofblur9 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.37, -0.15 ) * aspectcorrect ) * dofblur9 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.15, -0.37 ) * aspectcorrect ) * dofblur9 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.15, 0.37 ) * aspectcorrect ) * dofblur9 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.37, 0.15 ) * aspectcorrect ) * dofblur9 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.37, -0.15 ) * aspectcorrect ) * dofblur9 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.15, -0.37 ) * aspectcorrect ) * dofblur9 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.29, 0.29 ) * aspectcorrect ) * dofblur7 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.40, 0.0 ) * aspectcorrect ) * dofblur7 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.29, -0.29 ) * aspectcorrect ) * dofblur7 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.0, -0.4 ) * aspectcorrect ) * dofblur7 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.29, 0.29 ) * aspectcorrect ) * dofblur7 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.4, 0.0 ) * aspectcorrect ) * dofblur7 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur7 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.0, 0.4 ) * aspectcorrect ) * dofblur7 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.29, 0.29 ) * aspectcorrect ) * dofblur4 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.4, 0.0 ) * aspectcorrect ) * dofblur4 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.29, -0.29 ) * aspectcorrect ) * dofblur4 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.0, -0.4 ) * aspectcorrect ) * dofblur4 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.29, 0.29 ) * aspectcorrect ) * dofblur4 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.4, 0.0 ) * aspectcorrect ) * dofblur4 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur4 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.0, 0.4 ) * aspectcorrect ) * dofblur4 );","\tgl_FragColor = col / 41.0;","\tgl_FragColor.a = 1.0;","}"].join("\n")};var Za=function(t,r){void 0===Xa&&console.error("THREE.TexturePass relies on CopyShader");var i=Xa;this.map=t,this.opacity=void 0!==r?r:1,this.uniforms=e.UniformsUtils.clone(i.uniforms),this.material=new e.ShaderMaterial({uniforms:this.uniforms,vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,depthTest:!1,depthWrite:!1}),this.needsSwap=!1,this.fsQuad=new Ua(null)};Za.prototype=Object.assign(Object.create(Ia.prototype),{constructor:Za,render:function(e,t,r){var i=e.autoClear;e.autoClear=!1,this.fsQuad.material=this.material,this.uniforms.opacity.value=this.opacity,this.uniforms.tDiffuse.value=this.map,this.material.transparent=this.opacity<1,e.setRenderTarget(this.renderToScreen?null:r),this.clear&&e.clear(),this.fsQuad.render(e),e.autoClear=i}});const $a={uniforms:{tDiffuse:{value:null}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["#include <common>","uniform sampler2D tDiffuse;","varying vec2 vUv;","void main() {","\tvec4 texel = texture2D( tDiffuse, vUv );","\tfloat l = linearToRelativeLuminance( texel.rgb );","\tgl_FragColor = vec4( l, l, l, texel.w );","}"].join("\n")},el={uniforms:{tDiffuse:{value:null},averageLuminance:{value:1},luminanceMap:{value:null},maxLuminance:{value:16},minLuminance:{value:.01},middleGrey:{value:.6}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["#include <common>","uniform sampler2D tDiffuse;","varying vec2 vUv;","uniform float middleGrey;","uniform float minLuminance;","uniform float maxLuminance;","#ifdef ADAPTED_LUMINANCE","\tuniform sampler2D luminanceMap;","#else","\tuniform float averageLuminance;","#endif","vec3 ToneMap( vec3 vColor ) {","\t#ifdef ADAPTED_LUMINANCE","\t\tfloat fLumAvg = texture2D(luminanceMap, vec2(0.5, 0.5)).r;","\t#else","\t\tfloat fLumAvg = averageLuminance;","\t#endif","\tfloat fLumPixel = linearToRelativeLuminance( vColor );","\tfloat fLumScaled = (fLumPixel * middleGrey) / max( minLuminance, fLumAvg );","\tfloat fLumCompressed = (fLumScaled * (1.0 + (fLumScaled / (maxLuminance * maxLuminance)))) / (1.0 + fLumScaled);","\treturn fLumCompressed * vColor;","}","void main() {","\tvec4 texel = texture2D( tDiffuse, vUv );","\tgl_FragColor = vec4( ToneMap( texel.xyz ), texel.w );","}"].join("\n")};var tl=function(t,r){this.resolution=void 0!==r?r:256,this.needsInit=!0,this.adaptive=void 0===t||!!t,this.luminanceRT=null,this.previousLuminanceRT=null,this.currentLuminanceRT=null,void 0===Xa&&console.error("THREE.AdaptiveToneMappingPass relies on CopyShader");var i=Xa;this.copyUniforms=e.UniformsUtils.clone(i.uniforms),this.materialCopy=new e.ShaderMaterial({uniforms:this.copyUniforms,vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,blending:e.NoBlending,depthTest:!1}),void 0===$a&&console.error("THREE.AdaptiveToneMappingPass relies on LuminosityShader"),this.materialLuminance=new e.ShaderMaterial({uniforms:e.UniformsUtils.clone($a.uniforms),vertexShader:$a.vertexShader,fragmentShader:$a.fragmentShader,blending:e.NoBlending}),this.adaptLuminanceShader={defines:{MIP_LEVEL_1X1:(Math.log(this.resolution)/Math.log(2)).toFixed(1)},uniforms:{lastLum:{value:null},currentLum:{value:null},minLuminance:{value:.01},delta:{value:.016},tau:{value:1}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["varying vec2 vUv;","uniform sampler2D lastLum;","uniform sampler2D currentLum;","uniform float minLuminance;","uniform float delta;","uniform float tau;","void main() {","\tvec4 lastLum = texture2D( lastLum, vUv, MIP_LEVEL_1X1 );","\tvec4 currentLum = texture2D( currentLum, vUv, MIP_LEVEL_1X1 );","\tfloat fLastLum = max( minLuminance, lastLum.r );","\tfloat fCurrentLum = max( minLuminance, currentLum.r );","\tfCurrentLum *= fCurrentLum;","\tfloat fAdaptedLum = fLastLum + (fCurrentLum - fLastLum) * (1.0 - exp(-delta * tau));","\tgl_FragColor.r = fAdaptedLum;","}"].join("\n")},this.materialAdaptiveLum=new e.ShaderMaterial({uniforms:e.UniformsUtils.clone(this.adaptLuminanceShader.uniforms),vertexShader:this.adaptLuminanceShader.vertexShader,fragmentShader:this.adaptLuminanceShader.fragmentShader,defines:Object.assign({},this.adaptLuminanceShader.defines),blending:e.NoBlending}),void 0===el&&console.error("THREE.AdaptiveToneMappingPass relies on ToneMapShader"),this.materialToneMap=new e.ShaderMaterial({uniforms:e.UniformsUtils.clone(el.uniforms),vertexShader:el.vertexShader,fragmentShader:el.fragmentShader,blending:e.NoBlending}),this.fsQuad=new Ua(null)};tl.prototype=Object.assign(Object.create(Ia.prototype),{constructor:tl,render:function(e,t,r,i){this.needsInit&&(this.reset(e),this.luminanceRT.texture.type=r.texture.type,this.previousLuminanceRT.texture.type=r.texture.type,this.currentLuminanceRT.texture.type=r.texture.type,this.needsInit=!1),this.adaptive&&(this.fsQuad.material=this.materialLuminance,this.materialLuminance.uniforms.tDiffuse.value=r.texture,e.setRenderTarget(this.currentLuminanceRT),this.fsQuad.render(e),this.fsQuad.material=this.materialAdaptiveLum,this.materialAdaptiveLum.uniforms.delta.value=i,this.materialAdaptiveLum.uniforms.lastLum.value=this.previousLuminanceRT.texture,this.materialAdaptiveLum.uniforms.currentLum.value=this.currentLuminanceRT.texture,e.setRenderTarget(this.luminanceRT),this.fsQuad.render(e),this.fsQuad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=this.luminanceRT.texture,e.setRenderTarget(this.previousLuminanceRT),this.fsQuad.render(e)),this.fsQuad.material=this.materialToneMap,this.materialToneMap.uniforms.tDiffuse.value=r.texture,this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(),this.fsQuad.render(e))},reset:function(){this.luminanceRT&&this.luminanceRT.dispose(),this.currentLuminanceRT&&this.currentLuminanceRT.dispose(),this.previousLuminanceRT&&this.previousLuminanceRT.dispose();var t={minFilter:e.LinearFilter,magFilter:e.LinearFilter,format:e.RGBAFormat};this.luminanceRT=new e.WebGLRenderTarget(this.resolution,this.resolution,t),this.luminanceRT.texture.name="AdaptiveToneMappingPass.l",this.luminanceRT.texture.generateMipmaps=!1,this.previousLuminanceRT=new e.WebGLRenderTarget(this.resolution,this.resolution,t),this.previousLuminanceRT.texture.name="AdaptiveToneMappingPass.pl",this.previousLuminanceRT.texture.generateMipmaps=!1,t.minFilter=e.LinearMipmapLinearFilter,t.generateMipmaps=!0,this.currentLuminanceRT=new e.WebGLRenderTarget(this.resolution,this.resolution,t),this.currentLuminanceRT.texture.name="AdaptiveToneMappingPass.cl",this.adaptive&&(this.materialToneMap.defines.ADAPTED_LUMINANCE="",this.materialToneMap.uniforms.luminanceMap.value=this.luminanceRT.texture),this.fsQuad.material=new e.MeshBasicMaterial({color:7829367}),this.materialLuminance.needsUpdate=!0,this.materialAdaptiveLum.needsUpdate=!0,this.materialToneMap.needsUpdate=!0},setAdaptive:function(e){e?(this.adaptive=!0,this.materialToneMap.defines.ADAPTED_LUMINANCE="",this.materialToneMap.uniforms.luminanceMap.value=this.luminanceRT.texture):(this.adaptive=!1,delete this.materialToneMap.defines.ADAPTED_LUMINANCE,this.materialToneMap.uniforms.luminanceMap.value=null),this.materialToneMap.needsUpdate=!0},setAdaptionRate:function(e){e&&(this.materialAdaptiveLum.uniforms.tau.value=Math.abs(e))},setMinLuminance:function(e){e&&(this.materialToneMap.uniforms.minLuminance.value=e,this.materialAdaptiveLum.uniforms.minLuminance.value=e)},setMaxLuminance:function(e){e&&(this.materialToneMap.uniforms.maxLuminance.value=e)},setAverageLuminance:function(e){e&&(this.materialToneMap.uniforms.averageLuminance.value=e)},setMiddleGrey:function(e){e&&(this.materialToneMap.uniforms.middleGrey.value=e)},dispose:function(){this.luminanceRT&&this.luminanceRT.dispose(),this.previousLuminanceRT&&this.previousLuminanceRT.dispose(),this.currentLuminanceRT&&this.currentLuminanceRT.dispose(),this.materialLuminance&&this.materialLuminance.dispose(),this.materialAdaptiveLum&&this.materialAdaptiveLum.dispose(),this.materialCopy&&this.materialCopy.dispose(),this.materialToneMap&&this.materialToneMap.dispose()}});const rl={shaderID:"luminosityHighPass",uniforms:{tDiffuse:{value:null},luminosityThreshold:{value:1},smoothWidth:{value:1},defaultColor:{value:new e.Color(0)},defaultOpacity:{value:0}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","uniform vec3 defaultColor;","uniform float defaultOpacity;","uniform float luminosityThreshold;","uniform float smoothWidth;","varying vec2 vUv;","void main() {","\tvec4 texel = texture2D( tDiffuse, vUv );","\tvec3 luma = vec3( 0.299, 0.587, 0.114 );","\tfloat v = dot( texel.xyz, luma );","\tvec4 outputColor = vec4( defaultColor.rgb, defaultOpacity );","\tfloat alpha = smoothstep( luminosityThreshold, luminosityThreshold + smoothWidth, v );","\tgl_FragColor = mix( outputColor, texel, alpha );","}"].join("\n")};var il=function(t,r,i,n){this.strength=void 0!==r?r:1,this.radius=i,this.threshold=n,this.resolution=void 0!==t?new e.Vector2(t.x,t.y):new e.Vector2(256,256),this.clearColor=new e.Color(0,0,0);var s={minFilter:e.LinearFilter,magFilter:e.LinearFilter,format:e.RGBAFormat};this.renderTargetsHorizontal=[],this.renderTargetsVertical=[],this.nMips=5;var o=Math.round(this.resolution.x/2),a=Math.round(this.resolution.y/2);this.renderTargetBright=new e.WebGLRenderTarget(o,a,s),this.renderTargetBright.texture.name="UnrealBloomPass.bright",this.renderTargetBright.texture.generateMipmaps=!1;for(let t=0;t<this.nMips;t++){var l=new e.WebGLRenderTarget(o,a,s);l.texture.name="UnrealBloomPass.h"+t,l.texture.generateMipmaps=!1,this.renderTargetsHorizontal.push(l);var c=new e.WebGLRenderTarget(o,a,s);c.texture.name="UnrealBloomPass.v"+t,c.texture.generateMipmaps=!1,this.renderTargetsVertical.push(c),o=Math.round(o/2),a=Math.round(a/2)}void 0===rl&&console.error("THREE.UnrealBloomPass relies on LuminosityHighPassShader");var h=rl;this.highPassUniforms=e.UniformsUtils.clone(h.uniforms),this.highPassUniforms.luminosityThreshold.value=n,this.highPassUniforms.smoothWidth.value=.01,this.materialHighPassFilter=new e.ShaderMaterial({uniforms:this.highPassUniforms,vertexShader:h.vertexShader,fragmentShader:h.fragmentShader,defines:{}}),this.separableBlurMaterials=[];var u=[3,5,7,9,11];o=Math.round(this.resolution.x/2),a=Math.round(this.resolution.y/2);for(let t=0;t<this.nMips;t++)this.separableBlurMaterials.push(this.getSeperableBlurMaterial(u[t])),this.separableBlurMaterials[t].uniforms.texSize.value=new e.Vector2(o,a),o=Math.round(o/2),a=Math.round(a/2);this.compositeMaterial=this.getCompositeMaterial(this.nMips),this.compositeMaterial.uniforms.blurTexture1.value=this.renderTargetsVertical[0].texture,this.compositeMaterial.uniforms.blurTexture2.value=this.renderTargetsVertical[1].texture,this.compositeMaterial.uniforms.blurTexture3.value=this.renderTargetsVertical[2].texture,this.compositeMaterial.uniforms.blurTexture4.value=this.renderTargetsVertical[3].texture,this.compositeMaterial.uniforms.blurTexture5.value=this.renderTargetsVertical[4].texture,this.compositeMaterial.uniforms.bloomStrength.value=r,this.compositeMaterial.uniforms.bloomRadius.value=.1,this.compositeMaterial.needsUpdate=!0;this.compositeMaterial.uniforms.bloomFactors.value=[1,.8,.6,.4,.2],this.bloomTintColors=[new e.Vector3(1,1,1),new e.Vector3(1,1,1),new e.Vector3(1,1,1),new e.Vector3(1,1,1),new e.Vector3(1,1,1)],this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,void 0===Xa&&console.error("THREE.UnrealBloomPass relies on CopyShader");var d=Xa;this.copyUniforms=e.UniformsUtils.clone(d.uniforms),this.copyUniforms.opacity.value=1,this.materialCopy=new e.ShaderMaterial({uniforms:this.copyUniforms,vertexShader:d.vertexShader,fragmentShader:d.fragmentShader,blending:e.AdditiveBlending,depthTest:!1,depthWrite:!1,transparent:!0}),this.enabled=!0,this.needsSwap=!1,this._oldClearColor=new e.Color,this.oldClearAlpha=1,this.basic=new e.MeshBasicMaterial,this.fsQuad=new Ua(null)};il.prototype=Object.assign(Object.create(Ia.prototype),{constructor:il,dispose:function(){for(let e=0;e<this.renderTargetsHorizontal.length;e++)this.renderTargetsHorizontal[e].dispose();for(let e=0;e<this.renderTargetsVertical.length;e++)this.renderTargetsVertical[e].dispose();this.renderTargetBright.dispose()},setSize:function(t,r){var i=Math.round(t/2),n=Math.round(r/2);this.renderTargetBright.setSize(i,n);for(let t=0;t<this.nMips;t++)this.renderTargetsHorizontal[t].setSize(i,n),this.renderTargetsVertical[t].setSize(i,n),this.separableBlurMaterials[t].uniforms.texSize.value=new e.Vector2(i,n),i=Math.round(i/2),n=Math.round(n/2)},render:function(e,t,r,i,n){e.getClearColor(this._oldClearColor),this.oldClearAlpha=e.getClearAlpha();var s=e.autoClear;e.autoClear=!1,e.setClearColor(this.clearColor,0),n&&e.state.buffers.stencil.setTest(!1),this.renderToScreen&&(this.fsQuad.material=this.basic,this.basic.map=r.texture,e.setRenderTarget(null),e.clear(),this.fsQuad.render(e)),this.highPassUniforms.tDiffuse.value=r.texture,this.highPassUniforms.luminosityThreshold.value=this.threshold,this.fsQuad.material=this.materialHighPassFilter,e.setRenderTarget(this.renderTargetBright),e.clear(),this.fsQuad.render(e);var o=this.renderTargetBright;for(let t=0;t<this.nMips;t++)this.fsQuad.material=this.separableBlurMaterials[t],this.separableBlurMaterials[t].uniforms.colorTexture.value=o.texture,this.separableBlurMaterials[t].uniforms.direction.value=il.BlurDirectionX,e.setRenderTarget(this.renderTargetsHorizontal[t]),e.clear(),this.fsQuad.render(e),this.separableBlurMaterials[t].uniforms.colorTexture.value=this.renderTargetsHorizontal[t].texture,this.separableBlurMaterials[t].uniforms.direction.value=il.BlurDirectionY,e.setRenderTarget(this.renderTargetsVertical[t]),e.clear(),this.fsQuad.render(e),o=this.renderTargetsVertical[t];this.fsQuad.material=this.compositeMaterial,this.compositeMaterial.uniforms.bloomStrength.value=this.strength,this.compositeMaterial.uniforms.bloomRadius.value=this.radius,this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,e.setRenderTarget(this.renderTargetsHorizontal[0]),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=this.renderTargetsHorizontal[0].texture,n&&e.state.buffers.stencil.setTest(!0),this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(r),this.fsQuad.render(e)),e.setClearColor(this._oldClearColor,this.oldClearAlpha),e.autoClear=s},getSeperableBlurMaterial:function(t){return new e.ShaderMaterial({defines:{KERNEL_RADIUS:t,SIGMA:t},uniforms:{colorTexture:{value:null},texSize:{value:new e.Vector2(.5,.5)},direction:{value:new e.Vector2(.5,.5)}},vertexShader:"varying vec2 vUv;\nvoid main() {\n\tvUv = uv;\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"#include <common>varying vec2 vUv;\nuniform sampler2D colorTexture;\nuniform vec2 texSize;uniform vec2 direction;\nfloat gaussianPdf(in float x, in float sigma) {\treturn 0.39894 * exp( -0.5 * x * x/( sigma * sigma))/sigma;}void main() {\n\tvec2 invSize = 1.0 / texSize;\tfloat fSigma = float(SIGMA);\tfloat weightSum = gaussianPdf(0.0, fSigma);\tvec3 diffuseSum = texture2D( colorTexture, vUv).rgb * weightSum;\tfor( int i = 1; i < KERNEL_RADIUS; i ++ ) {\t\tfloat x = float(i);\t\tfloat w = gaussianPdf(x, fSigma);\t\tvec2 uvOffset = direction * invSize * x;\t\tvec3 sample1 = texture2D( colorTexture, vUv + uvOffset).rgb;\t\tvec3 sample2 = texture2D( colorTexture, vUv - uvOffset).rgb;\t\tdiffuseSum += (sample1 + sample2) * w;\t\tweightSum += 2.0 * w;\t}\tgl_FragColor = vec4(diffuseSum/weightSum, 1.0);\n}"})},getCompositeMaterial:function(t){return new e.ShaderMaterial({defines:{NUM_MIPS:t},uniforms:{blurTexture1:{value:null},blurTexture2:{value:null},blurTexture3:{value:null},blurTexture4:{value:null},blurTexture5:{value:null},dirtTexture:{value:null},bloomStrength:{value:1},bloomFactors:{value:null},bloomTintColors:{value:null},bloomRadius:{value:0}},vertexShader:"varying vec2 vUv;\nvoid main() {\n\tvUv = uv;\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;uniform sampler2D blurTexture1;uniform sampler2D blurTexture2;uniform sampler2D blurTexture3;uniform sampler2D blurTexture4;uniform sampler2D blurTexture5;uniform sampler2D dirtTexture;uniform float bloomStrength;uniform float bloomRadius;uniform float bloomFactors[NUM_MIPS];uniform vec3 bloomTintColors[NUM_MIPS];float lerpBloomFactor(const in float factor) { \tfloat mirrorFactor = 1.2 - factor;\treturn mix(factor, mirrorFactor, bloomRadius);}void main() {\tgl_FragColor = bloomStrength * ( lerpBloomFactor(bloomFactors[0]) * vec4(bloomTintColors[0], 1.0) * texture2D(blurTexture1, vUv) + \t\t\t\t\t\t\t\t\t lerpBloomFactor(bloomFactors[1]) * vec4(bloomTintColors[1], 1.0) * texture2D(blurTexture2, vUv) + \t\t\t\t\t\t\t\t\t lerpBloomFactor(bloomFactors[2]) * vec4(bloomTintColors[2], 1.0) * texture2D(blurTexture3, vUv) + \t\t\t\t\t\t\t\t\t lerpBloomFactor(bloomFactors[3]) * vec4(bloomTintColors[3], 1.0) * texture2D(blurTexture4, vUv) + \t\t\t\t\t\t\t\t\t lerpBloomFactor(bloomFactors[4]) * vec4(bloomTintColors[4], 1.0) * texture2D(blurTexture5, vUv) );}"})}}),il.BlurDirectionX=new e.Vector2(1,0),il.BlurDirectionY=new e.Vector2(0,1);var nl=function(t,r,i){this.camera=t,this.needsSwap=!1,this.cubeShader=e.ShaderLib.cube,this.cubeMesh=new e.Mesh(new e.BoxGeometry(10,10,10),new e.ShaderMaterial({uniforms:e.UniformsUtils.clone(this.cubeShader.uniforms),vertexShader:this.cubeShader.vertexShader,fragmentShader:this.cubeShader.fragmentShader,depthTest:!1,depthWrite:!1,side:e.BackSide})),Object.defineProperty(this.cubeMesh.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),this.envMap=r,this.opacity=void 0!==i?i:1,this.cubeScene=new e.Scene,this.cubeCamera=new e.PerspectiveCamera,this.cubeScene.add(this.cubeMesh)};nl.prototype=Object.assign(Object.create(Ia.prototype),{constructor:nl,render:function(e,t,r){var i=e.autoClear;e.autoClear=!1,this.cubeCamera.projectionMatrix.copy(this.camera.projectionMatrix),this.cubeCamera.quaternion.setFromRotationMatrix(this.camera.matrixWorld),this.cubeMesh.material.uniforms.envMap.value=this.envMap,this.cubeMesh.material.uniforms.flipEnvMap.value=this.envMap.isCubeTexture&&this.envMap._needsFlipEnvMap?-1:1,this.cubeMesh.material.uniforms.opacity.value=this.opacity,this.cubeMesh.material.transparent=this.opacity<1,e.setRenderTarget(this.renderToScreen?null:r),this.clear&&e.clear(),e.render(this.cubeScene,this.cubeCamera),e.autoClear=i}});const sl={defines:{NUM_SAMPLES:7,NUM_RINGS:4,NORMAL_TEXTURE:0,DIFFUSE_TEXTURE:0,DEPTH_PACKING:1,PERSPECTIVE_CAMERA:1},uniforms:{tDepth:{value:null},tDiffuse:{value:null},tNormal:{value:null},size:{value:new e.Vector2(512,512)},cameraNear:{value:1},cameraFar:{value:100},cameraProjectionMatrix:{value:new e.Matrix4},cameraInverseProjectionMatrix:{value:new e.Matrix4},scale:{value:1},intensity:{value:.1},bias:{value:.5},minResolution:{value:0},kernelRadius:{value:100},randomSeed:{value:0}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["#include <common>","varying vec2 vUv;","#if DIFFUSE_TEXTURE == 1","uniform sampler2D tDiffuse;","#endif","uniform sampler2D tDepth;","#if NORMAL_TEXTURE == 1","uniform sampler2D tNormal;","#endif","uniform float cameraNear;","uniform float cameraFar;","uniform mat4 cameraProjectionMatrix;","uniform mat4 cameraInverseProjectionMatrix;","uniform float scale;","uniform float intensity;","uniform float bias;","uniform float kernelRadius;","uniform float minResolution;","uniform vec2 size;","uniform float randomSeed;","// RGBA depth","#include <packing>","vec4 getDefaultColor( const in vec2 screenPosition ) {","\t#if DIFFUSE_TEXTURE == 1","\treturn texture2D( tDiffuse, vUv );","\t#else","\treturn vec4( 1.0 );","\t#endif","}","float getDepth( const in vec2 screenPosition ) {","\t#if DEPTH_PACKING == 1","\treturn unpackRGBAToDepth( texture2D( tDepth, screenPosition ) );","\t#else","\treturn texture2D( tDepth, screenPosition ).x;","\t#endif","}","float getViewZ( const in float depth ) {","\t#if PERSPECTIVE_CAMERA == 1","\treturn perspectiveDepthToViewZ( depth, cameraNear, cameraFar );","\t#else","\treturn orthographicDepthToViewZ( depth, cameraNear, cameraFar );","\t#endif","}","vec3 getViewPosition( const in vec2 screenPosition, const in float depth, const in float viewZ ) {","\tfloat clipW = cameraProjectionMatrix[2][3] * viewZ + cameraProjectionMatrix[3][3];","\tvec4 clipPosition = vec4( ( vec3( screenPosition, depth ) - 0.5 ) * 2.0, 1.0 );","\tclipPosition *= clipW; // unprojection.","\treturn ( cameraInverseProjectionMatrix * clipPosition ).xyz;","}","vec3 getViewNormal( const in vec3 viewPosition, const in vec2 screenPosition ) {","\t#if NORMAL_TEXTURE == 1","\treturn unpackRGBToNormal( texture2D( tNormal, screenPosition ).xyz );","\t#else","\treturn normalize( cross( dFdx( viewPosition ), dFdy( viewPosition ) ) );","\t#endif","}","float scaleDividedByCameraFar;","float minResolutionMultipliedByCameraFar;","float getOcclusion( const in vec3 centerViewPosition, const in vec3 centerViewNormal, const in vec3 sampleViewPosition ) {","\tvec3 viewDelta = sampleViewPosition - centerViewPosition;","\tfloat viewDistance = length( viewDelta );","\tfloat scaledScreenDistance = scaleDividedByCameraFar * viewDistance;","\treturn max(0.0, (dot(centerViewNormal, viewDelta) - minResolutionMultipliedByCameraFar) / scaledScreenDistance - bias) / (1.0 + pow2( scaledScreenDistance ) );","}","// moving costly divides into consts","const float ANGLE_STEP = PI2 * float( NUM_RINGS ) / float( NUM_SAMPLES );","const float INV_NUM_SAMPLES = 1.0 / float( NUM_SAMPLES );","float getAmbientOcclusion( const in vec3 centerViewPosition ) {","\t// precompute some variables require in getOcclusion.","\tscaleDividedByCameraFar = scale / cameraFar;","\tminResolutionMultipliedByCameraFar = minResolution * cameraFar;","\tvec3 centerViewNormal = getViewNormal( centerViewPosition, vUv );","\t// jsfiddle that shows sample pattern: https://jsfiddle.net/a16ff1p7/","\tfloat angle = rand( vUv + randomSeed ) * PI2;","\tvec2 radius = vec2( kernelRadius * INV_NUM_SAMPLES ) / size;","\tvec2 radiusStep = radius;","\tfloat occlusionSum = 0.0;","\tfloat weightSum = 0.0;","\tfor( int i = 0; i < NUM_SAMPLES; i ++ ) {","\t\tvec2 sampleUv = vUv + vec2( cos( angle ), sin( angle ) ) * radius;","\t\tradius += radiusStep;","\t\tangle += ANGLE_STEP;","\t\tfloat sampleDepth = getDepth( sampleUv );","\t\tif( sampleDepth >= ( 1.0 - EPSILON ) ) {","\t\t\tcontinue;","\t\t}","\t\tfloat sampleViewZ = getViewZ( sampleDepth );","\t\tvec3 sampleViewPosition = getViewPosition( sampleUv, sampleDepth, sampleViewZ );","\t\tocclusionSum += getOcclusion( centerViewPosition, centerViewNormal, sampleViewPosition );","\t\tweightSum += 1.0;","\t}","\tif( weightSum == 0.0 ) discard;","\treturn occlusionSum * ( intensity / weightSum );","}","void main() {","\tfloat centerDepth = getDepth( vUv );","\tif( centerDepth >= ( 1.0 - EPSILON ) ) {","\t\tdiscard;","\t}","\tfloat centerViewZ = getViewZ( centerDepth );","\tvec3 viewPosition = getViewPosition( vUv, centerDepth, centerViewZ );","\tfloat ambientOcclusion = getAmbientOcclusion( viewPosition );","\tgl_FragColor = getDefaultColor( vUv );","\tgl_FragColor.xyz *= 1.0 - ambientOcclusion;","}"].join("\n")},ol={defines:{KERNEL_RADIUS:4,DEPTH_PACKING:1,PERSPECTIVE_CAMERA:1},uniforms:{tDiffuse:{value:null},size:{value:new e.Vector2(512,512)},sampleUvOffsets:{value:[new e.Vector2(0,0)]},sampleWeights:{value:[1]},tDepth:{value:null},cameraNear:{value:10},cameraFar:{value:1e3},depthCutoff:{value:10}},vertexShader:["#include <common>","uniform vec2 size;","varying vec2 vUv;","varying vec2 vInvSize;","void main() {","\tvUv = uv;","\tvInvSize = 1.0 / size;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["#include <common>","#include <packing>","uniform sampler2D tDiffuse;","uniform sampler2D tDepth;","uniform float cameraNear;","uniform float cameraFar;","uniform float depthCutoff;","uniform vec2 sampleUvOffsets[ KERNEL_RADIUS + 1 ];","uniform float sampleWeights[ KERNEL_RADIUS + 1 ];","varying vec2 vUv;","varying vec2 vInvSize;","float getDepth( const in vec2 screenPosition ) {","\t#if DEPTH_PACKING == 1","\treturn unpackRGBAToDepth( texture2D( tDepth, screenPosition ) );","\t#else","\treturn texture2D( tDepth, screenPosition ).x;","\t#endif","}","float getViewZ( const in float depth ) {","\t#if PERSPECTIVE_CAMERA == 1","\treturn perspectiveDepthToViewZ( depth, cameraNear, cameraFar );","\t#else","\treturn orthographicDepthToViewZ( depth, cameraNear, cameraFar );","\t#endif","}","void main() {","\tfloat depth = getDepth( vUv );","\tif( depth >= ( 1.0 - EPSILON ) ) {","\t\tdiscard;","\t}","\tfloat centerViewZ = -getViewZ( depth );","\tbool rBreak = false, lBreak = false;","\tfloat weightSum = sampleWeights[0];","\tvec4 diffuseSum = texture2D( tDiffuse, vUv ) * weightSum;","\tfor( int i = 1; i <= KERNEL_RADIUS; i ++ ) {","\t\tfloat sampleWeight = sampleWeights[i];","\t\tvec2 sampleUvOffset = sampleUvOffsets[i] * vInvSize;","\t\tvec2 sampleUv = vUv + sampleUvOffset;","\t\tfloat viewZ = -getViewZ( getDepth( sampleUv ) );","\t\tif( abs( viewZ - centerViewZ ) > depthCutoff ) rBreak = true;","\t\tif( ! rBreak ) {","\t\t\tdiffuseSum += texture2D( tDiffuse, sampleUv ) * sampleWeight;","\t\t\tweightSum += sampleWeight;","\t\t}","\t\tsampleUv = vUv - sampleUvOffset;","\t\tviewZ = -getViewZ( getDepth( sampleUv ) );","\t\tif( abs( viewZ - centerViewZ ) > depthCutoff ) lBreak = true;","\t\tif( ! lBreak ) {","\t\t\tdiffuseSum += texture2D( tDiffuse, sampleUv ) * sampleWeight;","\t\t\tweightSum += sampleWeight;","\t\t}","\t}","\tgl_FragColor = diffuseSum / weightSum;","}"].join("\n")},al={createSampleWeights:(e,t)=>{const r=(e,t)=>Math.exp(-e*e/(t*t*2))/(Math.sqrt(2*Math.PI)*t),i=[];for(let n=0;n<=e;n++)i.push(r(n,t));return i},createSampleOffsets:(e,t)=>{const r=[];for(let i=0;i<=e;i++)r.push(t.clone().multiplyScalar(i));return r},configure:(e,t,r,i)=>{e.defines.KERNEL_RADIUS=t,e.uniforms.sampleUvOffsets.value=al.createSampleOffsets(t,i),e.uniforms.sampleWeights.value=al.createSampleWeights(t,r),e.needsUpdate=!0}};var ll=function(t,r,i,n,s){(this.scene=t,this.camera=r,this.clear=!0,this.needsSwap=!1,this.supportsDepthTextureExtension=void 0!==i&&i,this.supportsNormalTexture=void 0!==n&&n,this.originalClearColor=new e.Color,this._oldClearColor=new e.Color,this.oldClearAlpha=1,this.params={output:0,saoBias:.5,saoIntensity:.18,saoScale:1,saoKernelRadius:100,saoMinResolution:0,saoBlur:!0,saoBlurRadius:8,saoBlurStdDev:4,saoBlurDepthCutoff:.01},this.resolution=void 0!==s?new e.Vector2(s.x,s.y):new e.Vector2(256,256),this.saoRenderTarget=new e.WebGLRenderTarget(this.resolution.x,this.resolution.y,{minFilter:e.LinearFilter,magFilter:e.LinearFilter,format:e.RGBAFormat}),this.blurIntermediateRenderTarget=this.saoRenderTarget.clone(),this.beautyRenderTarget=this.saoRenderTarget.clone(),this.normalRenderTarget=new e.WebGLRenderTarget(this.resolution.x,this.resolution.y,{minFilter:e.NearestFilter,magFilter:e.NearestFilter,format:e.RGBAFormat}),this.depthRenderTarget=this.normalRenderTarget.clone(),this.supportsDepthTextureExtension)&&((i=new e.DepthTexture).type=e.UnsignedShortType,this.beautyRenderTarget.depthTexture=i,this.beautyRenderTarget.depthBuffer=!0);this.depthMaterial=new e.MeshDepthMaterial,this.depthMaterial.depthPacking=e.RGBADepthPacking,this.depthMaterial.blending=e.NoBlending,this.normalMaterial=new e.MeshNormalMaterial,this.normalMaterial.blending=e.NoBlending,void 0===sl&&console.error("THREE.SAOPass relies on SAOShader"),this.saoMaterial=new e.ShaderMaterial({defines:Object.assign({},sl.defines),fragmentShader:sl.fragmentShader,vertexShader:sl.vertexShader,uniforms:e.UniformsUtils.clone(sl.uniforms)}),this.saoMaterial.extensions.derivatives=!0,this.saoMaterial.defines.DEPTH_PACKING=this.supportsDepthTextureExtension?0:1,this.saoMaterial.defines.NORMAL_TEXTURE=this.supportsNormalTexture?1:0,this.saoMaterial.defines.PERSPECTIVE_CAMERA=this.camera.isPerspectiveCamera?1:0,this.saoMaterial.uniforms.tDepth.value=this.supportsDepthTextureExtension?i:this.depthRenderTarget.texture,this.saoMaterial.uniforms.tNormal.value=this.normalRenderTarget.texture,this.saoMaterial.uniforms.size.value.set(this.resolution.x,this.resolution.y),this.saoMaterial.uniforms.cameraInverseProjectionMatrix.value.copy(this.camera.projectionMatrixInverse),this.saoMaterial.uniforms.cameraProjectionMatrix.value=this.camera.projectionMatrix,this.saoMaterial.blending=e.NoBlending,void 0===ol&&console.error("THREE.SAOPass relies on DepthLimitedBlurShader"),this.vBlurMaterial=new e.ShaderMaterial({uniforms:e.UniformsUtils.clone(ol.uniforms),defines:Object.assign({},ol.defines),vertexShader:ol.vertexShader,fragmentShader:ol.fragmentShader}),this.vBlurMaterial.defines.DEPTH_PACKING=this.supportsDepthTextureExtension?0:1,this.vBlurMaterial.defines.PERSPECTIVE_CAMERA=this.camera.isPerspectiveCamera?1:0,this.vBlurMaterial.uniforms.tDiffuse.value=this.saoRenderTarget.texture,this.vBlurMaterial.uniforms.tDepth.value=this.supportsDepthTextureExtension?i:this.depthRenderTarget.texture,this.vBlurMaterial.uniforms.size.value.set(this.resolution.x,this.resolution.y),this.vBlurMaterial.blending=e.NoBlending,this.hBlurMaterial=new e.ShaderMaterial({uniforms:e.UniformsUtils.clone(ol.uniforms),defines:Object.assign({},ol.defines),vertexShader:ol.vertexShader,fragmentShader:ol.fragmentShader}),this.hBlurMaterial.defines.DEPTH_PACKING=this.supportsDepthTextureExtension?0:1,this.hBlurMaterial.defines.PERSPECTIVE_CAMERA=this.camera.isPerspectiveCamera?1:0,this.hBlurMaterial.uniforms.tDiffuse.value=this.blurIntermediateRenderTarget.texture,this.hBlurMaterial.uniforms.tDepth.value=this.supportsDepthTextureExtension?i:this.depthRenderTarget.texture,this.hBlurMaterial.uniforms.size.value.set(this.resolution.x,this.resolution.y),this.hBlurMaterial.blending=e.NoBlending,void 0===Xa&&console.error("THREE.SAOPass relies on CopyShader"),this.materialCopy=new e.ShaderMaterial({uniforms:e.UniformsUtils.clone(Xa.uniforms),vertexShader:Xa.vertexShader,fragmentShader:Xa.fragmentShader,blending:e.NoBlending}),this.materialCopy.transparent=!0,this.materialCopy.depthTest=!1,this.materialCopy.depthWrite=!1,this.materialCopy.blending=e.CustomBlending,this.materialCopy.blendSrc=e.DstColorFactor,this.materialCopy.blendDst=e.ZeroFactor,this.materialCopy.blendEquation=e.AddEquation,this.materialCopy.blendSrcAlpha=e.DstAlphaFactor,this.materialCopy.blendDstAlpha=e.ZeroFactor,this.materialCopy.blendEquationAlpha=e.AddEquation,void 0===Po&&console.error("THREE.SAOPass relies on UnpackDepthRGBAShader"),this.depthCopy=new e.ShaderMaterial({uniforms:e.UniformsUtils.clone(Po.uniforms),vertexShader:Po.vertexShader,fragmentShader:Po.fragmentShader,blending:e.NoBlending}),this.fsQuad=new Ua(null)};ll.OUTPUT={Beauty:1,Default:0,SAO:2,Depth:3,Normal:4},ll.prototype=Object.assign(Object.create(Ia.prototype),{constructor:ll,render:function(t,r,i){if(this.renderToScreen&&(this.materialCopy.blending=e.NoBlending,this.materialCopy.uniforms.tDiffuse.value=i.texture,this.materialCopy.needsUpdate=!0,this.renderPass(t,this.materialCopy,null)),1!==this.params.output){t.getClearColor(this._oldClearColor),this.oldClearAlpha=t.getClearAlpha();var n=t.autoClear;t.autoClear=!1,t.setRenderTarget(this.depthRenderTarget),t.clear(),this.saoMaterial.uniforms.bias.value=this.params.saoBias,this.saoMaterial.uniforms.intensity.value=this.params.saoIntensity,this.saoMaterial.uniforms.scale.value=this.params.saoScale,this.saoMaterial.uniforms.kernelRadius.value=this.params.saoKernelRadius,this.saoMaterial.uniforms.minResolution.value=this.params.saoMinResolution,this.saoMaterial.uniforms.cameraNear.value=this.camera.near,this.saoMaterial.uniforms.cameraFar.value=this.camera.far;var s=this.params.saoBlurDepthCutoff*(this.camera.far-this.camera.near);this.vBlurMaterial.uniforms.depthCutoff.value=s,this.hBlurMaterial.uniforms.depthCutoff.value=s,this.vBlurMaterial.uniforms.cameraNear.value=this.camera.near,this.vBlurMaterial.uniforms.cameraFar.value=this.camera.far,this.hBlurMaterial.uniforms.cameraNear.value=this.camera.near,this.hBlurMaterial.uniforms.cameraFar.value=this.camera.far,this.params.saoBlurRadius=Math.floor(this.params.saoBlurRadius),this.prevStdDev===this.params.saoBlurStdDev&&this.prevNumSamples===this.params.saoBlurRadius||(al.configure(this.vBlurMaterial,this.params.saoBlurRadius,this.params.saoBlurStdDev,new e.Vector2(0,1)),al.configure(this.hBlurMaterial,this.params.saoBlurRadius,this.params.saoBlurStdDev,new e.Vector2(1,0)),this.prevStdDev=this.params.saoBlurStdDev,this.prevNumSamples=this.params.saoBlurRadius),t.setClearColor(0),t.setRenderTarget(this.beautyRenderTarget),t.clear(),t.render(this.scene,this.camera),this.supportsDepthTextureExtension||this.renderOverride(t,this.depthMaterial,this.depthRenderTarget,0,1),this.supportsNormalTexture&&this.renderOverride(t,this.normalMaterial,this.normalRenderTarget,7829503,1),this.renderPass(t,this.saoMaterial,this.saoRenderTarget,16777215,1),this.params.saoBlur&&(this.renderPass(t,this.vBlurMaterial,this.blurIntermediateRenderTarget,16777215,1),this.renderPass(t,this.hBlurMaterial,this.saoRenderTarget,16777215,1));var o=this.materialCopy;3===this.params.output?this.supportsDepthTextureExtension?(this.materialCopy.uniforms.tDiffuse.value=this.beautyRenderTarget.depthTexture,this.materialCopy.needsUpdate=!0):(this.depthCopy.uniforms.tDiffuse.value=this.depthRenderTarget.texture,this.depthCopy.needsUpdate=!0,o=this.depthCopy):4===this.params.output?(this.materialCopy.uniforms.tDiffuse.value=this.normalRenderTarget.texture,this.materialCopy.needsUpdate=!0):(this.materialCopy.uniforms.tDiffuse.value=this.saoRenderTarget.texture,this.materialCopy.needsUpdate=!0),0===this.params.output?o.blending=e.CustomBlending:o.blending=e.NoBlending,this.renderPass(t,o,this.renderToScreen?null:i),t.setClearColor(this._oldClearColor,this.oldClearAlpha),t.autoClear=n}},renderPass:function(e,t,r,i,n){e.getClearColor(this.originalClearColor);var s=e.getClearAlpha(),o=e.autoClear;e.setRenderTarget(r),e.autoClear=!1,null!=i&&(e.setClearColor(i),e.setClearAlpha(n||0),e.clear()),this.fsQuad.material=t,this.fsQuad.render(e),e.autoClear=o,e.setClearColor(this.originalClearColor),e.setClearAlpha(s)},renderOverride:function(e,t,r,i,n){e.getClearColor(this.originalClearColor);var s=e.getClearAlpha(),o=e.autoClear;e.setRenderTarget(r),e.autoClear=!1,i=t.clearColor||i,n=t.clearAlpha||n,null!=i&&(e.setClearColor(i),e.setClearAlpha(n||0),e.clear()),this.scene.overrideMaterial=t,e.render(this.scene,this.camera),this.scene.overrideMaterial=null,e.autoClear=o,e.setClearColor(this.originalClearColor),e.setClearAlpha(s)},setSize:function(e,t){this.beautyRenderTarget.setSize(e,t),this.saoRenderTarget.setSize(e,t),this.blurIntermediateRenderTarget.setSize(e,t),this.normalRenderTarget.setSize(e,t),this.depthRenderTarget.setSize(e,t),this.saoMaterial.uniforms.size.value.set(e,t),this.saoMaterial.uniforms.cameraInverseProjectionMatrix.value.copy(this.camera.projectionMatrixInverse),this.saoMaterial.uniforms.cameraProjectionMatrix.value=this.camera.projectionMatrix,this.saoMaterial.needsUpdate=!0,this.vBlurMaterial.uniforms.size.value.set(e,t),this.vBlurMaterial.needsUpdate=!0,this.hBlurMaterial.uniforms.size.value.set(e,t),this.hBlurMaterial.needsUpdate=!0}});const cl={uniforms:{damp:{value:.96},tOld:{value:null},tNew:{value:null}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform float damp;","uniform sampler2D tOld;","uniform sampler2D tNew;","varying vec2 vUv;","vec4 when_gt( vec4 x, float y ) {","\treturn max( sign( x - y ), 0.0 );","}","void main() {","\tvec4 texelOld = texture2D( tOld, vUv );","\tvec4 texelNew = texture2D( tNew, vUv );","\ttexelOld *= damp * when_gt( texelOld, 0.1 );","\tgl_FragColor = max(texelNew, texelOld);","}"].join("\n")};class hl extends Ia{constructor(e,t){super(),p.default(this,"scene",void 0),p.default(this,"camera",void 0),p.default(this,"inverse",void 0),this.scene=e,this.camera=t,this.clear=!0,this.needsSwap=!1,this.inverse=!1}render(e,t,r){const i=e.getContext(),n=e.state;let s,o;n.buffers.color.setMask(!1),n.buffers.depth.setMask(!1),n.buffers.color.setLocked(!0),n.buffers.depth.setLocked(!0),this.inverse?(s=0,o=1):(s=1,o=0),n.buffers.stencil.setTest(!0),n.buffers.stencil.setOp(i.REPLACE,i.REPLACE,i.REPLACE),n.buffers.stencil.setFunc(i.ALWAYS,s,4294967295),n.buffers.stencil.setClear(o),n.buffers.stencil.setLocked(!0),e.setRenderTarget(r),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),n.buffers.color.setLocked(!1),n.buffers.depth.setLocked(!1),n.buffers.stencil.setLocked(!1),n.buffers.stencil.setFunc(i.EQUAL,1,4294967295),n.buffers.stencil.setOp(i.KEEP,i.KEEP,i.KEEP),n.buffers.stencil.setLocked(!0)}}class ul extends Ia{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}const dl={uniforms:{tDiffuse:{value:null},tSize:{value:new e.Vector2(256,256)},center:{value:new e.Vector2(.5,.5)},angle:{value:1.57},scale:{value:1}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform vec2 center;","uniform float angle;","uniform float scale;","uniform vec2 tSize;","uniform sampler2D tDiffuse;","varying vec2 vUv;","float pattern() {","\tfloat s = sin( angle ), c = cos( angle );","\tvec2 tex = vUv * tSize - center;","\tvec2 point = vec2( c * tex.x - s * tex.y, s * tex.x + c * tex.y ) * scale;","\treturn ( sin( point.x ) * sin( point.y ) ) * 4.0;","}","void main() {","\tvec4 color = texture2D( tDiffuse, vUv );","\tfloat average = ( color.r + color.g + color.b ) / 3.0;","\tgl_FragColor = vec4( vec3( average * 10.0 - 5.0 + pattern() ), color.a );","}"].join("\n")};const pl={defines:{MAX_STEP:0,isPerspectiveCamera:!0,isDistanceAttenuation:!0,isFresnel:!0,isInfiniteThick:!1,isSelective:!1},uniforms:{tDiffuse:{value:null},tNormal:{value:null},tMetalness:{value:null},tDepth:{value:null},cameraNear:{value:null},cameraFar:{value:null},resolution:{value:new e.Vector2},cameraProjectionMatrix:{value:new e.Matrix4},cameraInverseProjectionMatrix:{value:new e.Matrix4},opacity:{value:.5},maxDistance:{value:180},cameraRange:{value:0},surfDist:{value:.007},thickTolerance:{value:.03}},vertexShader:"\n\n varying vec2 vUv;\n\n void main() {\n\n\t\t\tvUv = uv;\n\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n }\n\n ",fragmentShader:"\n\t\t// precision highp float;\n\t\tprecision highp sampler2D;\n\t\tvarying vec2 vUv;\n\t\tuniform sampler2D tDepth;\n\t\tuniform sampler2D tNormal;\n\t\tuniform sampler2D tMetalness;\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float cameraRange;\n\t\tuniform vec2 resolution;\n\t\tuniform float opacity;\n\t\tuniform float cameraNear;\n\t\tuniform float cameraFar;\n\t\tuniform float maxDistance;\n\t\tuniform float surfDist;\n\t\tuniform mat4 cameraProjectionMatrix;\n\t\tuniform mat4 cameraInverseProjectionMatrix;\n\t\tuniform float thickTolerance;\n\t\t#include <packing>\n\t\tfloat pointToLineDistance(vec3 x0, vec3 x1, vec3 x2) {\n\t\t\t//x0: point, x1: linePointA, x2: linePointB\n\t\t\t//https://mathworld.wolfram.com/Point-LineDistance3-Dimensional.html\n\t\t\treturn length(cross(x0-x1,x0-x2))/length(x2-x1);\n\t\t}\n\t\tfloat pointPlaneDistance(vec3 point,vec3 planePoint,vec3 planeNormal){\n\t\t\t// https://mathworld.wolfram.com/Point-PlaneDistance.html\n\t\t\t//// https://en.wikipedia.org/wiki/Plane_(geometry)\n\t\t\t//// http://paulbourke.net/geometry/pointlineplane/\n\t\t\tfloat a=planeNormal.x,b=planeNormal.y,c=planeNormal.z;\n\t\t\tfloat x0=point.x,y0=point.y,z0=point.z;\n\t\t\tfloat x=planePoint.x,y=planePoint.y,z=planePoint.z;\n\t\t\tfloat d=-(a*x+b*y+c*z);\n\t\t\tfloat distance=(a*x0+b*y0+c*z0+d)/sqrt(a*a+b*b+c*c);\n\t\t\treturn distance;\n\t\t}\n\t\tfloat getDepth( const in vec2 uv ) {\n\t\t\treturn texture2D( tDepth, uv ).x;\n\t\t}\n\t\tfloat getViewZ( const in float depth ) {\n\t\t\t#ifdef isPerspectiveCamera\n\t\t\t\treturn perspectiveDepthToViewZ( depth, cameraNear, cameraFar );\n\t\t\t#else\n\t\t\t\treturn orthographicDepthToViewZ( depth, cameraNear, cameraFar );\n\t\t\t#endif\n\t\t}\n\t\tvec3 getViewPosition( const in vec2 uv, const in float depth/*clip space*/, const in float clipW ) {\n\t\t\tvec4 clipPosition = vec4( ( vec3( uv, depth ) - 0.5 ) * 2.0, 1.0 );//ndc\n\t\t\tclipPosition *= clipW; //clip\n\t\t\treturn ( cameraInverseProjectionMatrix * clipPosition ).xyz;//view\n\t\t}\n\t\tvec3 getViewNormal( const in vec2 uv ) {\n\t\t\treturn unpackRGBToNormal( texture2D( tNormal, uv ).xyz );\n\t\t}\n\t\tvec2 viewPositionToXY(vec3 viewPosition){\n\t\t\tvec2 xy;\n\t\t\tvec4 clip=cameraProjectionMatrix*vec4(viewPosition,1);\n\t\t\txy=clip.xy;//clip\n\t\t\tfloat clipW=clip.w;\n\t\t\txy/=clipW;//NDC\n\t\t\txy=(xy+1.)/2.;//uv\n\t\t\txy*=resolution;//screen\n\t\t\treturn xy;\n\t\t}\n\t\tvoid main(){\n\t\t\t#ifdef isSelective\n\t\t\t\tfloat metalness=texture2D(tMetalness,vUv).r;\n\t\t\t\tif(metalness==0.) return;\n\t\t\t#endif\n\n\t\t\tfloat depth = getDepth( vUv );\n\t\t\tfloat viewZ = getViewZ( depth );\n\t\t\tif(-viewZ>=cameraFar) return;\n\n\t\t\tfloat clipW = cameraProjectionMatrix[2][3] * viewZ+cameraProjectionMatrix[3][3];\n\t\t\tvec3 viewPosition=getViewPosition( vUv, depth, clipW );\n\n\t\t\tvec2 d0=gl_FragCoord.xy;\n\t\t\tvec2 d1;\n\n\t\t\tvec3 viewNormal=getViewNormal( vUv );\n\n\t\t\t#ifdef isPerspectiveCamera\n\t\t\t\tvec3 viewIncidenceDir=normalize(viewPosition);\n\t\t\t\tvec3 viewReflectDir=reflect(viewIncidenceDir,viewNormal);\n\t\t\t#else\n\t\t\t\tvec3 viewIncidenceDir=vec3(0,0,-1);\n\t\t\t\tvec3 viewReflectDir=reflect(viewIncidenceDir,viewNormal);\n\t\t\t#endif\n\n\t\t\tfloat maxReflectRayLen=maxDistance/dot(-viewIncidenceDir,viewNormal);\n\t\t\t// dot(a,b)==length(a)*length(b)*cos(theta) // https://www.mathsisfun.com/algebra/vectors-dot-product.html\n\t\t\t// if(a.isNormalized&&b.isNormalized) dot(a,b)==cos(theta)\n\t\t\t// maxDistance/maxReflectRayLen=cos(theta)\n\t\t\t// maxDistance/maxReflectRayLen==dot(a,b)\n\t\t\t// maxReflectRayLen==maxDistance/dot(a,b)\n\n\t\t\tvec3 d1viewPosition=viewPosition+viewReflectDir*maxReflectRayLen;\n\t\t\t#ifdef isPerspectiveCamera\n\t\t\t\tif(d1viewPosition.z>-cameraNear){\n\t\t\t\t\t//https://tutorial.math.lamar.edu/Classes/CalcIII/EqnsOfLines.aspx\n\t\t\t\t\tfloat t=(-cameraNear-viewPosition.z)/viewReflectDir.z;\n\t\t\t\t\td1viewPosition=viewPosition+viewReflectDir*t;\n\t\t\t\t}\n\t\t\t#endif\n\t\t\td1=viewPositionToXY(d1viewPosition);\n\n\t\t\tfloat totalLen=length(d1-d0);\n\t\t\tfloat xLen=d1.x-d0.x;\n\t\t\tfloat yLen=d1.y-d0.y;\n\t\t\tfloat totalStep=max(abs(xLen),abs(yLen));\n\t\t\tfloat xSpan=xLen/totalStep;\n\t\t\tfloat ySpan=yLen/totalStep;\n\t\t\tfor(float i=0.;i<MAX_STEP;i++){\n\t\t\t\tif(i>=totalStep) break;\n\t\t\t\tvec2 xy=vec2(d0.x+i*xSpan,d0.y+i*ySpan);\n\t\t\t\tif(xy.x<0.||xy.x>resolution.x||xy.y<0.||xy.y>resolution.y) break;\n\t\t\t\tfloat s=length(xy-d0)/totalLen;\n\t\t\t\tvec2 uv=xy/resolution;\n\n\t\t\t\tfloat d = getDepth(uv);\n\t\t\t\tfloat vZ = getViewZ( d );\n\t\t\t\tif(-vZ>=cameraFar) continue;\n\t\t\t\tfloat cW = cameraProjectionMatrix[2][3] * vZ+cameraProjectionMatrix[3][3];\n\t\t\t\tvec3 vP=getViewPosition( uv, d, cW );\n\n\t\t\t\t#ifdef isPerspectiveCamera\n\t\t\t\t\t// https://www.comp.nus.edu.sg/~lowkl/publications/lowk_persp_interp_techrep.pdf\n\t\t\t\t\tfloat recipVPZ=1./viewPosition.z;\n\t\t\t\t\tfloat viewReflectRayZ=1./(recipVPZ+s*(1./d1viewPosition.z-recipVPZ));\n\t\t\t\t\tfloat sD=surfDist*cW;\n\t\t\t\t#else\n\t\t\t\t\tfloat viewReflectRayZ=viewPosition.z+s*(d1viewPosition.z-viewPosition.z);\n\t\t\t\t\tfloat sD=surfDist;\n\t\t\t\t#endif\n\t\t\t\tif(viewReflectRayZ-sD>vZ) continue;\n\n\t\t\t\t#ifdef isInfiniteThick\n\t\t\t\t\tif(viewReflectRayZ+thickTolerance*clipW<vP.z) break;\n\t\t\t\t#endif\n\t\t\t\tfloat away=pointToLineDistance(vP,viewPosition,d1viewPosition);\n\n\t\t\t\tfloat op=opacity;\n\n\t\t\t\tif(away<sD){\n\t\t\t\t\tvec3 vN=getViewNormal( uv );\n\t\t\t\t\tif(dot(viewReflectDir,vN)>=0.) continue;\n\t\t\t\t\tfloat distance=pointPlaneDistance(vP,viewPosition,viewNormal);\n\t\t\t\t\tif(distance>maxDistance) break;\n\t\t\t\t\t#ifdef isDistanceAttenuation\n\t\t\t\t\t\tfloat ratio=1.-(distance/maxDistance);\n\t\t\t\t\t\tfloat attenuation=ratio*ratio;\n\t\t\t\t\t\top=opacity*attenuation;\n\t\t\t\t\t#endif\n\t\t\t\t\t#ifdef isFresnel\n\t\t\t\t\t\tfloat fresnel=(dot(viewIncidenceDir,viewReflectDir)+1.)/2.;\n\t\t\t\t\t\top*=fresnel;\n\t\t\t\t\t#endif\n\t\t\t\t\tvec4 reflectColor=texture2D(tDiffuse,uv);\n\t\t\t\t\tgl_FragColor.xyz=reflectColor.xyz;\n\t\t\t\t\tgl_FragColor.a=op;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t"},ml={defines:{PERSPECTIVE_CAMERA:1},uniforms:{tDepth:{value:null},cameraNear:{value:null},cameraFar:{value:null}},vertexShader:"\n\n varying vec2 vUv;\n\n void main() {\n\n \tvUv = uv;\n \tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n }\n\n ",fragmentShader:"\n\n uniform sampler2D tDepth;\n\n uniform float cameraNear;\n uniform float cameraFar;\n\n varying vec2 vUv;\n\n #include <packing>\n\n\t\tfloat getLinearDepth( const in vec2 uv ) {\n\n\t\t\t#if PERSPECTIVE_CAMERA == 1\n\n\t\t\t\tfloat fragCoordZ = texture2D( tDepth, uv ).x;\n\t\t\t\tfloat viewZ = perspectiveDepthToViewZ( fragCoordZ, cameraNear, cameraFar );\n\t\t\t\treturn viewZToOrthographicDepth( viewZ, cameraNear, cameraFar );\n\n\t\t\t#else\n\n\t\t\t\treturn texture2D( tDepth, uv ).x;\n\n\t\t\t#endif\n\n\t\t}\n\n void main() {\n\n \tfloat depth = getLinearDepth( vUv );\n\t\t\tfloat d = 1.0 - depth;\n\t\t\t// d=(d-.999)*1000.;\n \tgl_FragColor = vec4( vec3( d ), 1.0 );\n\n }\n\n "},fl={uniforms:{tDiffuse:{value:null},resolution:{value:new e.Vector2},opacity:{value:.5}},vertexShader:"\n\n varying vec2 vUv;\n\n void main() {\n\n \tvUv = uv;\n \tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n }\n\n ",fragmentShader:"\n\n uniform sampler2D tDiffuse;\n uniform vec2 resolution;\n varying vec2 vUv;\n void main() {\n\t\t\t//reverse engineering from PhotoShop blur filter, then change coefficient\n\n \tvec2 texelSize = ( 1.0 / resolution );\n\n\t\t\tvec4 c=texture2D(tDiffuse,vUv);\n\n\t\t\tvec2 offset;\n\n\t\t\toffset=(vec2(-1,0))*texelSize;\n\t\t\tvec4 cl=texture2D(tDiffuse,vUv+offset);\n\n\t\t\toffset=(vec2(1,0))*texelSize;\n\t\t\tvec4 cr=texture2D(tDiffuse,vUv+offset);\n\n\t\t\toffset=(vec2(0,-1))*texelSize;\n\t\t\tvec4 cb=texture2D(tDiffuse,vUv+offset);\n\n\t\t\toffset=(vec2(0,1))*texelSize;\n\t\t\tvec4 ct=texture2D(tDiffuse,vUv+offset);\n\n\t\t\t// float coeCenter=.5;\n\t\t\t// float coeSide=.125;\n\t\t\tfloat coeCenter=.2;\n\t\t\tfloat coeSide=.2;\n\t\t\tfloat a=c.a*coeCenter+cl.a*coeSide+cr.a*coeSide+cb.a*coeSide+ct.a*coeSide;\n\t\t\tvec3 rgb=(c.rgb*c.a*coeCenter+cl.rgb*cl.a*coeSide+cr.rgb*cr.a*coeSide+cb.rgb*cb.a*coeSide+ct.rgb*ct.a*coeSide)/a;\n\t\t\tgl_FragColor=vec4(rgb,a);\n\n\t\t}\n\t"};var gl=function({renderer:t,scene:r,camera:i,width:n,height:s,selects:o,encoding:a,isPerspectiveCamera:l=!0,isBouncing:c=!1,morphTargets:h=!1,groundReflector:u}){this.width=void 0!==n?n:512,this.height=void 0!==s?s:512,this.clear=!0,this.renderer=t,this.scene=r,this.camera=i,this.groundReflector=u,this.opacity=pl.uniforms.opacity.value,this.output=0,this.maxDistance=pl.uniforms.maxDistance.value,this.surfDist=pl.uniforms.surfDist.value,this.encoding=a,this.tempColor=new e.Color,this._selects=o,this.isSelective=Array.isArray(this._selects),Object.defineProperty(this,"selects",{get(){return this._selects},set(e){this._selects!==e&&(this._selects=e,Array.isArray(e)?(this.isSelective=!0,this.ssrMaterial.defines.isSelective=!0,this.ssrMaterial.needsUpdate=!0):(this.isSelective=!1,this.ssrMaterial.defines.isSelective=!1,this.ssrMaterial.needsUpdate=!0))}}),this._isBouncing=c,Object.defineProperty(this,"isBouncing",{get(){return this._isBouncing},set(e){this._isBouncing!==e&&(this._isBouncing=e,this.ssrMaterial.uniforms.tDiffuse.value=e?this.prevRenderTarget.texture:this.beautyRenderTarget.texture)}}),this.isBlur=!0,this._isDistanceAttenuation=pl.defines.isDistanceAttenuation,Object.defineProperty(this,"isDistanceAttenuation",{get(){return this._isDistanceAttenuation},set(e){this._isDistanceAttenuation!==e&&(this._isDistanceAttenuation=e,this.ssrMaterial.defines.isDistanceAttenuation=e,this.ssrMaterial.needsUpdate=!0)}}),this._isFresnel=pl.defines.isFresnel,Object.defineProperty(this,"isFresnel",{get(){return this._isFresnel},set(e){this._isFresnel!==e&&(this._isFresnel=e,this.ssrMaterial.defines.isFresnel=e,this.ssrMaterial.needsUpdate=!0)}}),this._isInfiniteThick=pl.defines.isInfiniteThick,Object.defineProperty(this,"isInfiniteThick",{get(){return this._isInfiniteThick},set(e){this._isInfiniteThick!==e&&(this._isInfiniteThick=e,this.ssrMaterial.defines.isInfiniteThick=e,this.ssrMaterial.needsUpdate=!0)}}),this.thickTolerance=pl.uniforms.thickTolerance.value;var d=new e.DepthTexture;d.type=e.UnsignedShortType,d.minFilter=e.NearestFilter,d.maxFilter=e.NearestFilter,this.beautyRenderTarget=new e.WebGLRenderTarget(this.width,this.height,{minFilter:e.LinearFilter,magFilter:e.LinearFilter,format:e.RGBAFormat,depthTexture:d,depthBuffer:!0}),this.prevRenderTarget=new e.WebGLRenderTarget(this.width,this.height,{minFilter:e.LinearFilter,magFilter:e.LinearFilter,format:e.RGBAFormat}),this.normalRenderTarget=new e.WebGLRenderTarget(this.width,this.height,{minFilter:e.NearestFilter,magFilter:e.NearestFilter,format:e.RGBAFormat,type:e.HalfFloatType}),this.metalnessRenderTarget=new e.WebGLRenderTarget(this.width,this.height,{minFilter:e.NearestFilter,magFilter:e.NearestFilter,format:e.RGBAFormat}),this.ssrRenderTarget=new e.WebGLRenderTarget(this.width,this.height,{minFilter:e.LinearFilter,magFilter:e.LinearFilter,format:e.RGBAFormat}),this.blurRenderTarget=this.ssrRenderTarget.clone(),this.blurRenderTarget2=this.ssrRenderTarget.clone(),void 0===pl&&console.error("THREE.SSRPass: The pass relies on SSRShader."),this.ssrMaterial=new e.ShaderMaterial({defines:Object.assign({MAX_STEP:Math.sqrt(window.innerWidth*window.innerWidth+window.innerHeight*window.innerHeight)},pl.defines),uniforms:e.UniformsUtils.clone(pl.uniforms),vertexShader:pl.vertexShader,fragmentShader:pl.fragmentShader,blending:e.NoBlending}),l||(this.ssrMaterial.defines.isPerspectiveCamera=l,this.ssrMaterial.needsUpdate=!0),this.ssrMaterial.uniforms.tDiffuse.value=this.beautyRenderTarget.texture,this.ssrMaterial.uniforms.tNormal.value=this.normalRenderTarget.texture,this.ssrMaterial.defines.isSelective=this.isSelective,this.ssrMaterial.needsUpdate=!0,this.ssrMaterial.uniforms.tMetalness.value=this.metalnessRenderTarget.texture,this.ssrMaterial.uniforms.tDepth.value=this.beautyRenderTarget.depthTexture,this.ssrMaterial.uniforms.cameraNear.value=this.camera.near,this.ssrMaterial.uniforms.cameraFar.value=this.camera.far,this.ssrMaterial.uniforms.surfDist.value=this.surfDist,this.ssrMaterial.uniforms.resolution.value.set(this.width,this.height),this.ssrMaterial.uniforms.cameraProjectionMatrix.value.copy(this.camera.projectionMatrix),this.ssrMaterial.uniforms.cameraInverseProjectionMatrix.value.copy(this.camera.projectionMatrixInverse),this.normalMaterial=new e.MeshNormalMaterial({morphTargets:h}),this.normalMaterial.blending=e.NoBlending,this.metalnessOnMaterial=new e.MeshBasicMaterial({color:"white"}),this.metalnessOffMaterial=new e.MeshBasicMaterial({color:"black"}),this.blurMaterial=new e.ShaderMaterial({defines:Object.assign({},fl.defines),uniforms:e.UniformsUtils.clone(fl.uniforms),vertexShader:fl.vertexShader,fragmentShader:fl.fragmentShader}),this.blurMaterial.uniforms.tDiffuse.value=this.ssrRenderTarget.texture,this.blurMaterial.uniforms.resolution.value.set(this.width,this.height),this.blurMaterial2=new e.ShaderMaterial({defines:Object.assign({},fl.defines),uniforms:e.UniformsUtils.clone(fl.uniforms),vertexShader:fl.vertexShader,fragmentShader:fl.fragmentShader}),this.blurMaterial2.uniforms.tDiffuse.value=this.blurRenderTarget.texture,this.blurMaterial2.uniforms.resolution.value.set(this.width,this.height),this.depthRenderMaterial=new e.ShaderMaterial({defines:Object.assign({},ml.defines),uniforms:e.UniformsUtils.clone(ml.uniforms),vertexShader:ml.vertexShader,fragmentShader:ml.fragmentShader,blending:e.NoBlending}),this.depthRenderMaterial.uniforms.tDepth.value=this.beautyRenderTarget.depthTexture,this.depthRenderMaterial.uniforms.cameraNear.value=this.camera.near,this.depthRenderMaterial.uniforms.cameraFar.value=this.camera.far,this.copyMaterial=new e.ShaderMaterial({uniforms:e.UniformsUtils.clone(Xa.uniforms),vertexShader:Xa.vertexShader,fragmentShader:Xa.fragmentShader,transparent:!0,depthTest:!1,depthWrite:!1,blendSrc:e.SrcAlphaFactor,blendDst:e.OneMinusSrcAlphaFactor,blendEquation:e.AddEquation,blendSrcAlpha:e.SrcAlphaFactor,blendDstAlpha:e.OneMinusSrcAlphaFactor,blendEquationAlpha:e.AddEquation}),this.fsQuad=new Ua(null),this.originalClearColor=new e.Color};gl.prototype=Object.assign(Object.create(Ia.prototype),{constructor:gl,dispose:function(){this.beautyRenderTarget.dispose(),this.prevRenderTarget.dispose(),this.normalRenderTarget.dispose(),this.metalnessRenderTarget.dispose(),this.ssrRenderTarget.dispose(),this.blurRenderTarget.dispose(),this.blurRenderTarget2.dispose(),this.normalMaterial.dispose(),this.metalnessOnMaterial.dispose(),this.metalnessOffMaterial.dispose(),this.blurMaterial.dispose(),this.blurMaterial2.dispose(),this.copyMaterial.dispose(),this.depthRenderMaterial.dispose(),this.fsQuad.dispose()},render:function(t,r){switch(this.encoding&&("colorSpace"in this.beautyRenderTarget.texture?this.beautyRenderTarget.texture.colorSpace=3001===this.encoding?"srgb":"srgb-linear":this.beautyRenderTarget.texture.encoding=this.encoding),t.setRenderTarget(this.beautyRenderTarget),t.clear(),this.groundReflector&&(this.groundReflector.doRender(this.renderer,this.scene,this.camera),this.groundReflector.visible=!0),t.render(this.scene,this.camera),this.groundReflector&&(this.groundReflector.visible=!1),this.renderOverride(t,this.normalMaterial,this.normalRenderTarget,0,0),this.isSelective&&this.renderMetalness(t,this.metalnessOnMaterial,this.metalnessRenderTarget,0,0),this.ssrMaterial.uniforms.opacity.value=this.opacity,this.ssrMaterial.uniforms.maxDistance.value=this.maxDistance,this.ssrMaterial.uniforms.surfDist.value=this.surfDist,this.ssrMaterial.uniforms.thickTolerance.value=this.thickTolerance,this.renderPass(t,this.ssrMaterial,this.ssrRenderTarget),this.isBlur&&(this.renderPass(t,this.blurMaterial,this.blurRenderTarget),this.renderPass(t,this.blurMaterial2,this.blurRenderTarget2)),this.output){case gl.OUTPUT.Default:this.isBouncing?(this.copyMaterial.uniforms.tDiffuse.value=this.beautyRenderTarget.texture,this.copyMaterial.blending=e.NoBlending,this.renderPass(t,this.copyMaterial,this.prevRenderTarget),this.isBlur?this.copyMaterial.uniforms.tDiffuse.value=this.blurRenderTarget2.texture:this.copyMaterial.uniforms.tDiffuse.value=this.ssrRenderTarget.texture,this.copyMaterial.blending=e.NormalBlending,this.renderPass(t,this.copyMaterial,this.prevRenderTarget),this.copyMaterial.uniforms.tDiffuse.value=this.prevRenderTarget.texture,this.copyMaterial.blending=e.NoBlending,this.renderPass(t,this.copyMaterial,this.renderToScreen?null:r)):(this.copyMaterial.uniforms.tDiffuse.value=this.beautyRenderTarget.texture,this.copyMaterial.blending=e.NoBlending,this.renderPass(t,this.copyMaterial,this.renderToScreen?null:r),this.isBlur?this.copyMaterial.uniforms.tDiffuse.value=this.blurRenderTarget2.texture:this.copyMaterial.uniforms.tDiffuse.value=this.ssrRenderTarget.texture,this.copyMaterial.blending=e.NormalBlending,this.renderPass(t,this.copyMaterial,this.renderToScreen?null:r));break;case gl.OUTPUT.SSR:this.isBlur?this.copyMaterial.uniforms.tDiffuse.value=this.blurRenderTarget2.texture:this.copyMaterial.uniforms.tDiffuse.value=this.ssrRenderTarget.texture,this.copyMaterial.blending=e.NoBlending,this.renderPass(t,this.copyMaterial,this.renderToScreen?null:r),this.isBouncing&&(this.isBlur?this.copyMaterial.uniforms.tDiffuse.value=this.blurRenderTarget2.texture:this.copyMaterial.uniforms.tDiffuse.value=this.beautyRenderTarget.texture,this.copyMaterial.blending=e.NoBlending,this.renderPass(t,this.copyMaterial,this.prevRenderTarget),this.copyMaterial.uniforms.tDiffuse.value=this.ssrRenderTarget.texture,this.copyMaterial.blending=e.NormalBlending,this.renderPass(t,this.copyMaterial,this.prevRenderTarget));break;case gl.OUTPUT.Beauty:this.copyMaterial.uniforms.tDiffuse.value=this.beautyRenderTarget.texture,this.copyMaterial.blending=e.NoBlending,this.renderPass(t,this.copyMaterial,this.renderToScreen?null:r);break;case gl.OUTPUT.Depth:this.renderPass(t,this.depthRenderMaterial,this.renderToScreen?null:r);break;case gl.OUTPUT.Normal:this.copyMaterial.uniforms.tDiffuse.value=this.normalRenderTarget.texture,this.copyMaterial.blending=e.NoBlending,this.renderPass(t,this.copyMaterial,this.renderToScreen?null:r);break;case gl.OUTPUT.Metalness:this.copyMaterial.uniforms.tDiffuse.value=this.metalnessRenderTarget.texture,this.copyMaterial.blending=e.NoBlending,this.renderPass(t,this.copyMaterial,this.renderToScreen?null:r);break;default:console.warn("THREE.SSRPass: Unknown output type.")}},renderPass:function(e,t,r,i,n){this.originalClearColor.copy(e.getClearColor(this.tempColor));var s=e.getClearAlpha(this.tempColor),o=e.autoClear;e.setRenderTarget(r),e.autoClear=!1,null!=i&&(e.setClearColor(i),e.setClearAlpha(n||0),e.clear()),this.fsQuad.material=t,this.fsQuad.render(e),e.autoClear=o,e.setClearColor(this.originalClearColor),e.setClearAlpha(s)},renderOverride:function(e,t,r,i,n){this.originalClearColor.copy(e.getClearColor(this.tempColor));var s=e.getClearAlpha(this.tempColor),o=e.autoClear;e.setRenderTarget(r),e.autoClear=!1,i=t.clearColor||i,n=t.clearAlpha||n,null!=i&&(e.setClearColor(i),e.setClearAlpha(n||0),e.clear()),this.scene.overrideMaterial=t,e.render(this.scene,this.camera),this.scene.overrideMaterial=null,e.autoClear=o,e.setClearColor(this.originalClearColor),e.setClearAlpha(s)},renderMetalness:function(e,t,r,i,n){this.originalClearColor.copy(e.getClearColor(this.tempColor));var s=e.getClearAlpha(this.tempColor),o=e.autoClear;e.setRenderTarget(r),e.autoClear=!1,i=t.clearColor||i,n=t.clearAlpha||n,null!=i&&(e.setClearColor(i),e.setClearAlpha(n||0),e.clear()),this.scene.traverseVisible((e=>{e._SSRPassMaterialBack=e.material,this._selects.includes(e)?e.material=this.metalnessOnMaterial:e.material=this.metalnessOffMaterial})),e.render(this.scene,this.camera),this.scene.traverseVisible((e=>{e.material=e._SSRPassMaterialBack})),e.autoClear=o,e.setClearColor(this.originalClearColor),e.setClearAlpha(s)},setSize:function(e,t){this.width=e,this.height=t,this.ssrMaterial.defines.MAX_STEP=Math.sqrt(e*e+t*t),this.ssrMaterial.needsUpdate=!0,this.beautyRenderTarget.setSize(e,t),this.prevRenderTarget.setSize(e,t),this.ssrRenderTarget.setSize(e,t),this.normalRenderTarget.setSize(e,t),this.metalnessRenderTarget.setSize(e,t),this.blurRenderTarget.setSize(e,t),this.blurRenderTarget2.setSize(e,t),this.ssrMaterial.uniforms.resolution.value.set(e,t),this.ssrMaterial.uniforms.cameraProjectionMatrix.value.copy(this.camera.projectionMatrix),this.ssrMaterial.uniforms.cameraInverseProjectionMatrix.value.copy(this.camera.projectionMatrixInverse),this.blurMaterial.uniforms.resolution.value.set(e,t),this.blurMaterial2.uniforms.resolution.value.set(e,t)}}),gl.OUTPUT={Default:0,SSR:1,Beauty:3,Depth:4,Normal:5,Metalness:7};var vl=function(t,r,i,n){this.scene=t,this.camera=r,this.sampleLevel=4,this.unbiased=!0,this.clearColor=void 0!==i?i:0,this.clearAlpha=void 0!==n?n:0,this._oldClearColor=new e.Color,void 0===Xa&&console.error("THREE.SSAARenderPass relies on CopyShader");var s=Xa;this.copyUniforms=e.UniformsUtils.clone(s.uniforms),this.copyMaterial=new e.ShaderMaterial({uniforms:this.copyUniforms,vertexShader:s.vertexShader,fragmentShader:s.fragmentShader,premultipliedAlpha:!0,transparent:!0,blending:e.AdditiveBlending,depthTest:!1,depthWrite:!1}),this.fsQuad=new Ua(this.copyMaterial)};vl.prototype=Object.assign(Object.create(Ia.prototype),{constructor:vl,dispose:function(){this.sampleRenderTarget&&(this.sampleRenderTarget.dispose(),this.sampleRenderTarget=null)},setSize:function(e,t){this.sampleRenderTarget&&this.sampleRenderTarget.setSize(e,t)},render:function(t,r,i){this.sampleRenderTarget||(this.sampleRenderTarget=new e.WebGLRenderTarget(i.width,i.height,{minFilter:e.LinearFilter,magFilter:e.LinearFilter,format:e.RGBAFormat}),this.sampleRenderTarget.texture.name="SSAARenderPass.sample");var n=vl.JitterVectors[Math.max(0,Math.min(this.sampleLevel,5))],s=t.autoClear;t.autoClear=!1,t.getClearColor(this._oldClearColor);var o=t.getClearAlpha(),a=1/n.length;this.copyUniforms.tDiffuse.value=this.sampleRenderTarget.texture;var l=i.width,c=i.height;for(let e=0;e<n.length;e++){var h=n[e];this.camera.setViewOffset&&this.camera.setViewOffset(l,c,.0625*h[0],.0625*h[1],l,c);var u=a;if(this.unbiased)u+=.03125*((e+.5)/n.length-.5);this.copyUniforms.opacity.value=u,t.setClearColor(this.clearColor,this.clearAlpha),t.setRenderTarget(this.sampleRenderTarget),t.clear(),t.render(this.scene,this.camera),t.setRenderTarget(this.renderToScreen?null:r),0===e&&(t.setClearColor(0,0),t.clear()),this.fsQuad.render(t)}this.camera.clearViewOffset&&this.camera.clearViewOffset(),t.autoClear=s,t.setClearColor(this._oldClearColor,o)}});var xl=function(e,t,r,i){void 0===vl&&console.error("THREE.TAARenderPass relies on SSAARenderPass"),vl.call(this,e,t,r,i),this.sampleLevel=0,this.accumulate=!1};xl.JitterVectors=vl.JitterVectors=[[[0,0]],[[4,4],[-4,-4]],[[-2,-6],[6,-2],[-6,2],[2,6]],[[1,-3],[-1,3],[5,1],[-3,-5],[-5,5],[-7,-1],[3,7],[7,-7]],[[1,1],[-1,-3],[-3,2],[4,-1],[-5,-2],[2,5],[5,3],[3,-5],[-2,6],[0,-7],[-4,-6],[-6,4],[-8,0],[7,-4],[6,7],[-7,-8]],[[-4,-7],[-7,-5],[-3,-5],[-5,-4],[-1,-4],[-2,-2],[-6,-1],[-4,0],[-7,1],[-1,2],[-6,3],[-3,3],[-7,6],[-3,6],[-5,7],[-1,7],[5,-7],[1,-6],[6,-5],[4,-4],[2,-3],[7,-2],[1,-1],[4,-1],[2,1],[6,2],[0,4],[4,4],[2,5],[7,5],[5,6],[3,7]]],xl.prototype=Object.assign(Object.create(vl.prototype),{constructor:xl,render:function(t,r,i,n){if(!this.accumulate)return vl.prototype.render.call(this,t,r,i,n),void(this.accumulateIndex=-1);var s=xl.JitterVectors[5];this.sampleRenderTarget||(this.sampleRenderTarget=new e.WebGLRenderTarget(i.width,i.height,this.params),this.sampleRenderTarget.texture.name="TAARenderPass.sample"),this.holdRenderTarget||(this.holdRenderTarget=new e.WebGLRenderTarget(i.width,i.height,this.params),this.holdRenderTarget.texture.name="TAARenderPass.hold"),this.accumulate&&-1===this.accumulateIndex&&(vl.prototype.render.call(this,t,this.holdRenderTarget,i,n),this.accumulateIndex=0);var o=t.autoClear;t.autoClear=!1;var a=1/s.length;if(this.accumulateIndex>=0&&this.accumulateIndex<s.length){this.copyUniforms.opacity.value=a,this.copyUniforms.tDiffuse.value=r.texture;var l=Math.pow(2,this.sampleLevel);for(let e=0;e<l;e++){var c=s[this.accumulateIndex];if(this.camera.setViewOffset&&this.camera.setViewOffset(i.width,i.height,.0625*c[0],.0625*c[1],i.width,i.height),t.setRenderTarget(r),t.clear(),t.render(this.scene,this.camera),t.setRenderTarget(this.sampleRenderTarget),0===this.accumulateIndex&&t.clear(),this.fsQuad.render(t),this.accumulateIndex++,this.accumulateIndex>=s.length)break}this.camera.clearViewOffset&&this.camera.clearViewOffset()}var h=this.accumulateIndex*a;h>0&&(this.copyUniforms.opacity.value=1,this.copyUniforms.tDiffuse.value=this.sampleRenderTarget.texture,t.setRenderTarget(r),t.clear(),this.fsQuad.render(t)),h<1&&(this.copyUniforms.opacity.value=1-h,this.copyUniforms.tDiffuse.value=this.holdRenderTarget.texture,t.setRenderTarget(r),0===h&&t.clear(),this.fsQuad.render(t)),t.autoClear=o}});function yl(t,r,i){const n=new e.WebGLRenderTarget(t.x,t.y,i?{depthTexture:new e.DepthTexture(t.x,t.y),depthBuffer:!0}:void 0);return n.texture.format=r,n.texture.minFilter=e.NearestFilter,n.texture.magFilter=e.NearestFilter,n.texture.generateMipmaps=!1,n.stencilBuffer=!1,n}const bl={defines:{KERNEL_SIZE_FLOAT:"25.0",KERNEL_SIZE_INT:"25"},uniforms:{tDiffuse:{value:null},uImageIncrement:{value:new e.Vector2(.001953125,0)},cKernel:{value:[]}},vertexShader:["uniform vec2 uImageIncrement;","varying vec2 vUv;","void main() {","\tvUv = uv - ( ( KERNEL_SIZE_FLOAT - 1.0 ) / 2.0 ) * uImageIncrement;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform float cKernel[ KERNEL_SIZE_INT ];","uniform sampler2D tDiffuse;","uniform vec2 uImageIncrement;","varying vec2 vUv;","void main() {","\tvec2 imageCoord = vUv;","\tvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );","\tfor( int i = 0; i < KERNEL_SIZE_INT; i ++ ) {","\t\tsum += texture2D( tDiffuse, imageCoord ) * cKernel[ i ];","\t\timageCoord += uImageIncrement;","\t}","\tgl_FragColor = sum;","}"].join("\n"),buildKernel:function(e){function t(e,t){return Math.exp(-e*e/(2*t*t))}const r=Math.min(2*Math.ceil(3*e)+1,25),i=.5*(r-1),n=new Array(r);let s=0;for(let o=0;o<r;++o)n[o]=t(o-i,e),s+=n[o];for(let e=0;e<r;++e)n[e]/=s;return n}};const Al={uniforms:{tDiffuse:{value:null},strength:{value:1}},vertexShader:"\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }",fragmentShader:"\n uniform float strength;\n uniform sampler2D tDiffuse;\n varying vec2 vUv;\n void main() {\n vec4 texel = texture2D( tDiffuse, vUv );\n gl_FragColor = strength * texel;\n }"};class wl extends e.Loader{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register((function(e){return new El(e)})),this.register((function(e){return new Dl(e)})),this.register((function(e){return new Il(e)})),this.register((function(e){return new Ul(e)})),this.register((function(e){return new Pl(e)})),this.register((function(e){return new Bl(e)})),this.register((function(e){return new Ll(e)})),this.register((function(e){return new Rl(e)})),this.register((function(e){return new Fl(e)})),this.register((function(e){return new Nl(e)})),this.register((function(e){return new _l(e)})),this.register((function(e){return new Sl(e)})),this.register((function(e){return new Ol(e)})),this.register((function(e){return new kl(e)}))}load(t,r,i,n){const s=this;let o;o=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:e.LoaderUtils.extractUrlBase(t),this.manager.itemStart(t);const a=function(e){n?n(e):console.error(e),s.manager.itemError(t),s.manager.itemEnd(t)},l=new e.FileLoader(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(t,(function(e){try{s.parse(e,o,(function(e){r(e),s.manager.itemEnd(t)}),a)}catch(e){a(e)}}),i,a)}setDRACOLoader(e){return this.dracoLoader=e,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}unregister(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(t,r,i,n){let s;const o={},a={};if("string"==typeof t)s=JSON.parse(t);else if(t instanceof ArrayBuffer){if(e.LoaderUtils.decodeText(new Uint8Array(t.slice(0,4)))===Vl){try{o[Tl.KHR_BINARY_GLTF]=new Hl(t)}catch(e){return void(n&&n(e))}s=JSON.parse(o[Tl.KHR_BINARY_GLTF].content)}else s=JSON.parse(e.LoaderUtils.decodeText(new Uint8Array(t)))}else s=t;if(void 0===s.asset||s.asset.version[0]<2)return void(n&&n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.")));const l=new fc(s,{path:r||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e<this.pluginCallbacks.length;e++){const t=this.pluginCallbacks[e](l);a[t.name]=t,o[t.name]=!0}if(s.extensionsUsed)for(let e=0;e<s.extensionsUsed.length;++e){const t=s.extensionsUsed[e],r=s.extensionsRequired||[];switch(t){case Tl.KHR_MATERIALS_UNLIT:o[t]=new Cl;break;case Tl.KHR_DRACO_MESH_COMPRESSION:o[t]=new Wl(s,this.dracoLoader);break;case Tl.KHR_TEXTURE_TRANSFORM:o[t]=new Xl;break;case Tl.KHR_MESH_QUANTIZATION:o[t]=new Ql;break;default:r.indexOf(t)>=0&&void 0===a[t]&&console.warn('THREE.GLTFLoader: Unknown extension "'+t+'".')}}l.setExtensions(o),l.setPlugins(a),l.parse(i,n)}parseAsync(e,t){const r=this;return new Promise((function(i,n){r.parse(e,t,i,n)}))}}function Ml(){let e={};return{get:function(t){return e[t]},add:function(t,r){e[t]=r},remove:function(t){delete e[t]},removeAll:function(){e={}}}}const Tl={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class Sl{constructor(e){this.parser=e,this.name=Tl.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let r=0,i=t.length;r<i;r++){const i=t[r];i.extensions&&i.extensions[this.name]&&void 0!==i.extensions[this.name].light&&e._addNodeRef(this.cache,i.extensions[this.name].light)}}_loadLight(t){const r=this.parser,i="light:"+t;let n=r.cache.get(i);if(n)return n;const s=r.json,o=((s.extensions&&s.extensions[this.name]||{}).lights||[])[t];let a;const l=new e.Color(16777215);void 0!==o.color&&l.fromArray(o.color);const c=void 0!==o.range?o.range:0;switch(o.type){case"directional":a=new e.DirectionalLight(l),a.target.position.set(0,0,-1),a.add(a.target);break;case"point":a=new e.PointLight(l),a.distance=c;break;case"spot":a=new e.SpotLight(l),a.distance=c,o.spot=o.spot||{},o.spot.innerConeAngle=void 0!==o.spot.innerConeAngle?o.spot.innerConeAngle:0,o.spot.outerConeAngle=void 0!==o.spot.outerConeAngle?o.spot.outerConeAngle:Math.PI/4,a.angle=o.spot.outerConeAngle,a.penumbra=1-o.spot.innerConeAngle/o.spot.outerConeAngle,a.target.position.set(0,0,-1),a.add(a.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+o.type)}return a.position.set(0,0,0),a.decay=2,cc(a,o),void 0!==o.intensity&&(a.intensity=o.intensity),a.name=r.createUniqueName(o.name||"light_"+t),n=Promise.resolve(a),r.cache.add(i,n),n}getDependency(e,t){if("light"===e)return this._loadLight(t)}createNodeAttachment(e){const t=this,r=this.parser,i=r.json.nodes[e],n=(i.extensions&&i.extensions[this.name]||{}).light;return void 0===n?null:this._loadLight(n).then((function(e){return r._getNodeRef(t.cache,n,e)}))}}class Cl{constructor(){this.name=Tl.KHR_MATERIALS_UNLIT}getMaterialType(){return e.MeshBasicMaterial}extendParams(t,r,i){const n=[];t.color=new e.Color(1,1,1),t.opacity=1;const s=r.pbrMetallicRoughness;if(s){if(Array.isArray(s.baseColorFactor)){const e=s.baseColorFactor;t.color.fromArray(e),t.opacity=e[3]}void 0!==s.baseColorTexture&&n.push(i.assignTexture(t,"map",s.baseColorTexture,3001))}return Promise.all(n)}}class Fl{constructor(e){this.parser=e,this.name=Tl.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const i=r.extensions[this.name].emissiveStrength;return void 0!==i&&(t.emissiveIntensity=i),Promise.resolve()}}class El{constructor(e){this.parser=e,this.name=Tl.KHR_MATERIALS_CLEARCOAT}getMaterialType(t){const r=this.parser.json.materials[t];return r.extensions&&r.extensions[this.name]?e.MeshPhysicalMaterial:null}extendMaterialParams(t,r){const i=this.parser,n=i.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[],o=n.extensions[this.name];if(void 0!==o.clearcoatFactor&&(r.clearcoat=o.clearcoatFactor),void 0!==o.clearcoatTexture&&s.push(i.assignTexture(r,"clearcoatMap",o.clearcoatTexture)),void 0!==o.clearcoatRoughnessFactor&&(r.clearcoatRoughness=o.clearcoatRoughnessFactor),void 0!==o.clearcoatRoughnessTexture&&s.push(i.assignTexture(r,"clearcoatRoughnessMap",o.clearcoatRoughnessTexture)),void 0!==o.clearcoatNormalTexture&&(s.push(i.assignTexture(r,"clearcoatNormalMap",o.clearcoatNormalTexture)),void 0!==o.clearcoatNormalTexture.scale)){const t=o.clearcoatNormalTexture.scale;r.clearcoatNormalScale=new e.Vector2(t,t)}return Promise.all(s)}}class _l{constructor(e){this.parser=e,this.name=Tl.KHR_MATERIALS_IRIDESCENCE}getMaterialType(t){const r=this.parser.json.materials[t];return r.extensions&&r.extensions[this.name]?e.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const n=[],s=i.extensions[this.name];return void 0!==s.iridescenceFactor&&(t.iridescence=s.iridescenceFactor),void 0!==s.iridescenceTexture&&n.push(r.assignTexture(t,"iridescenceMap",s.iridescenceTexture)),void 0!==s.iridescenceIor&&(t.iridescenceIOR=s.iridescenceIor),void 0===t.iridescenceThicknessRange&&(t.iridescenceThicknessRange=[100,400]),void 0!==s.iridescenceThicknessMinimum&&(t.iridescenceThicknessRange[0]=s.iridescenceThicknessMinimum),void 0!==s.iridescenceThicknessMaximum&&(t.iridescenceThicknessRange[1]=s.iridescenceThicknessMaximum),void 0!==s.iridescenceThicknessTexture&&n.push(r.assignTexture(t,"iridescenceThicknessMap",s.iridescenceThicknessTexture)),Promise.all(n)}}class Pl{constructor(e){this.parser=e,this.name=Tl.KHR_MATERIALS_SHEEN}getMaterialType(t){const r=this.parser.json.materials[t];return r.extensions&&r.extensions[this.name]?e.MeshPhysicalMaterial:null}extendMaterialParams(t,r){const i=this.parser,n=i.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[];r.sheenColor=new e.Color(0,0,0),r.sheenRoughness=0,r.sheen=1;const o=n.extensions[this.name];return void 0!==o.sheenColorFactor&&r.sheenColor.fromArray(o.sheenColorFactor),void 0!==o.sheenRoughnessFactor&&(r.sheenRoughness=o.sheenRoughnessFactor),void 0!==o.sheenColorTexture&&s.push(i.assignTexture(r,"sheenColorMap",o.sheenColorTexture,3001)),void 0!==o.sheenRoughnessTexture&&s.push(i.assignTexture(r,"sheenRoughnessMap",o.sheenRoughnessTexture)),Promise.all(s)}}class Bl{constructor(e){this.parser=e,this.name=Tl.KHR_MATERIALS_TRANSMISSION}getMaterialType(t){const r=this.parser.json.materials[t];return r.extensions&&r.extensions[this.name]?e.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const n=[],s=i.extensions[this.name];return void 0!==s.transmissionFactor&&(t.transmission=s.transmissionFactor),void 0!==s.transmissionTexture&&n.push(r.assignTexture(t,"transmissionMap",s.transmissionTexture)),Promise.all(n)}}class Ll{constructor(e){this.parser=e,this.name=Tl.KHR_MATERIALS_VOLUME}getMaterialType(t){const r=this.parser.json.materials[t];return r.extensions&&r.extensions[this.name]?e.MeshPhysicalMaterial:null}extendMaterialParams(t,r){const i=this.parser,n=i.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[],o=n.extensions[this.name];r.thickness=void 0!==o.thicknessFactor?o.thicknessFactor:0,void 0!==o.thicknessTexture&&s.push(i.assignTexture(r,"thicknessMap",o.thicknessTexture)),r.attenuationDistance=o.attenuationDistance||1/0;const a=o.attenuationColor||[1,1,1];return r.attenuationColor=new e.Color(a[0],a[1],a[2]),Promise.all(s)}}class Rl{constructor(e){this.parser=e,this.name=Tl.KHR_MATERIALS_IOR}getMaterialType(t){const r=this.parser.json.materials[t];return r.extensions&&r.extensions[this.name]?e.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const i=r.extensions[this.name];return t.ior=void 0!==i.ior?i.ior:1.5,Promise.resolve()}}class Nl{constructor(e){this.parser=e,this.name=Tl.KHR_MATERIALS_SPECULAR}getMaterialType(t){const r=this.parser.json.materials[t];return r.extensions&&r.extensions[this.name]?e.MeshPhysicalMaterial:null}extendMaterialParams(t,r){const i=this.parser,n=i.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[],o=n.extensions[this.name];r.specularIntensity=void 0!==o.specularFactor?o.specularFactor:1,void 0!==o.specularTexture&&s.push(i.assignTexture(r,"specularIntensityMap",o.specularTexture));const a=o.specularColorFactor||[1,1,1];return r.specularColor=new e.Color(a[0],a[1],a[2]),void 0!==o.specularColorTexture&&s.push(i.assignTexture(r,"specularColorMap",o.specularColorTexture,3001)),Promise.all(s)}}class Dl{constructor(e){this.parser=e,this.name=Tl.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,r=t.json,i=r.textures[e];if(!i.extensions||!i.extensions[this.name])return null;const n=i.extensions[this.name],s=t.options.ktx2Loader;if(!s){if(r.extensionsRequired&&r.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,n.source,s)}}class Il{constructor(e){this.parser=e,this.name=Tl.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,r=this.parser,i=r.json,n=i.textures[e];if(!n.extensions||!n.extensions[t])return null;const s=n.extensions[t],o=i.images[s.source];let a=r.textureLoader;if(o.uri){const e=r.options.manager.getHandler(o.uri);null!==e&&(a=e)}return this.detectSupport().then((function(n){if(n)return r.loadTextureImage(e,s.source,a);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.loadTexture(e)}))}detectSupport(){return this.isSupported||(this.isSupported=new Promise((function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}}))),this.isSupported}}class Ul{constructor(e){this.parser=e,this.name=Tl.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,r=this.parser,i=r.json,n=i.textures[e];if(!n.extensions||!n.extensions[t])return null;const s=n.extensions[t],o=i.images[s.source];let a=r.textureLoader;if(o.uri){const e=r.options.manager.getHandler(o.uri);null!==e&&(a=e)}return this.detectSupport().then((function(n){if(n)return r.loadTextureImage(e,s.source,a);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return r.loadTexture(e)}))}detectSupport(){return this.isSupported||(this.isSupported=new Promise((function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(1===t.height)}}))),this.isSupported}}class Ol{constructor(e){this.name=Tl.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,r=t.bufferViews[e];if(r.extensions&&r.extensions[this.name]){const e=r.extensions[this.name],i=this.parser.getDependency("buffer",e.buffer),n=this.parser.options.meshoptDecoder;if(!n||!n.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return i.then((function(t){const r=e.byteOffset||0,i=e.byteLength||0,s=e.count,o=e.byteStride,a=new Uint8Array(t,r,i);return n.decodeGltfBufferAsync?n.decodeGltfBufferAsync(s,o,a,e.mode,e.filter).then((function(e){return e.buffer})):n.ready.then((function(){const t=new ArrayBuffer(s*o);return n.decodeGltfBuffer(new Uint8Array(t),s,o,a,e.mode,e.filter),t}))}))}return null}}class kl{constructor(e){this.name=Tl.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(t){const r=this.parser.json,i=r.nodes[t];if(!i.extensions||!i.extensions[this.name]||void 0===i.mesh)return null;const n=r.meshes[i.mesh];for(const e of n.primitives)if(e.mode!==Jl.TRIANGLES&&e.mode!==Jl.TRIANGLE_STRIP&&e.mode!==Jl.TRIANGLE_FAN&&void 0!==e.mode)return null;const s=i.extensions[this.name].attributes,o=[],a={};for(const e in s)o.push(this.parser.getDependency("accessor",s[e]).then((t=>(a[e]=t,a[e]))));return o.length<1?null:(o.push(this.parser.createNodeMesh(t)),Promise.all(o).then((t=>{const r=t.pop(),i=r.isGroup?r.children:[r],n=t[0].count,s=[];for(const t of i){const r=new e.Matrix4,i=new e.Vector3,o=new e.Quaternion,l=new e.Vector3(1,1,1),c=new e.InstancedMesh(t.geometry,t.material,n);for(let e=0;e<n;e++)a.TRANSLATION&&i.fromBufferAttribute(a.TRANSLATION,e),a.ROTATION&&o.fromBufferAttribute(a.ROTATION,e),a.SCALE&&l.fromBufferAttribute(a.SCALE,e),c.setMatrixAt(e,r.compose(i,o,l));for(const e in a)"TRANSLATION"!==e&&"ROTATION"!==e&&"SCALE"!==e&&t.geometry.setAttribute(e,a[e]);e.Object3D.prototype.copy.call(c,t),this.parser.assignFinalMaterial(c),s.push(c)}return r.isGroup?(r.clear(),r.add(...s),r):s[0]})))}}const Vl="glTF",Gl=1313821514,zl=5130562;class Hl{constructor(t){this.name=Tl.KHR_BINARY_GLTF,this.content=null,this.body=null;const r=new DataView(t,0,12);if(this.header={magic:e.LoaderUtils.decodeText(new Uint8Array(t.slice(0,4))),version:r.getUint32(4,!0),length:r.getUint32(8,!0)},this.header.magic!==Vl)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const i=this.header.length-12,n=new DataView(t,12);let s=0;for(;s<i;){const r=n.getUint32(s,!0);s+=4;const i=n.getUint32(s,!0);if(s+=4,i===Gl){const i=new Uint8Array(t,12+s,r);this.content=e.LoaderUtils.decodeText(i)}else if(i===zl){const e=12+s;this.body=t.slice(e,e+r)}s+=r}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class Wl{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=Tl.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const r=this.json,i=this.dracoLoader,n=e.extensions[this.name].bufferView,s=e.extensions[this.name].attributes,o={},a={},l={};for(const e in s){const t=rc[e]||e.toLowerCase();o[t]=s[e]}for(const t in e.attributes){const i=rc[t]||t.toLowerCase();if(void 0!==s[t]){const n=r.accessors[e.attributes[t]],s=Zl[n.componentType];l[i]=s.name,a[i]=!0===n.normalized}}return t.getDependency("bufferView",n).then((function(e){return new Promise((function(t){i.decodeDracoFile(e,(function(e){for(const t in e.attributes){const r=e.attributes[t],i=a[t];void 0!==i&&(r.normalized=i)}t(e)}),o,l)}))}))}}class Xl{constructor(){this.name=Tl.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return void 0!==t.texCoord&&t.texCoord!==e.channel||void 0!==t.offset||void 0!==t.rotation||void 0!==t.scale?(e=e.clone(),void 0!==t.texCoord&&(e.channel=t.texCoord),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),e.needsUpdate=!0,e):e}}class Ql{constructor(){this.name=Tl.KHR_MESH_QUANTIZATION}}class Yl extends e.Interpolant{constructor(e,t,r,i){super(e,t,r,i)}copySampleValue_(e){const t=this.resultBuffer,r=this.sampleValues,i=this.valueSize,n=e*i*3+i;for(let e=0;e!==i;e++)t[e]=r[n+e];return t}interpolate_(e,t,r,i){const n=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=2*o,l=3*o,c=i-t,h=(r-t)/c,u=h*h,d=u*h,p=e*l,m=p-l,f=-2*d+3*u,g=d-u,v=1-f,x=g-u+h;for(let e=0;e!==o;e++){const t=s[m+e+o],r=s[m+e+a]*c,i=s[p+e+o],l=s[p+e]*c;n[e]=v*t+x*r+f*i+g*l}return n}}const Kl=new e.Quaternion;class ql extends Yl{interpolate_(e,t,r,i){const n=super.interpolate_(e,t,r,i);return Kl.fromArray(n).normalize().toArray(n),n}}const Jl={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},Zl={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},$l={9728:e.NearestFilter,9729:e.LinearFilter,9984:e.NearestMipmapNearestFilter,9985:e.LinearMipmapNearestFilter,9986:e.NearestMipmapLinearFilter,9987:e.LinearMipmapLinearFilter},ec={33071:e.ClampToEdgeWrapping,33648:e.MirroredRepeatWrapping,10497:e.RepeatWrapping},tc={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},rc={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",...e.REVISION.replace(/\D+/g,"")>=152?{TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3"}:{TEXCOORD_0:"uv",TEXCOORD_1:"uv2"},COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},ic={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},nc={CUBICSPLINE:void 0,LINEAR:e.InterpolateLinear,STEP:e.InterpolateDiscrete},sc="OPAQUE",oc="MASK",ac="BLEND";function lc(e,t,r){for(const i in r.extensions)void 0===e[i]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[i]=r.extensions[i])}function cc(e,t){void 0!==t.extras&&("object"==typeof t.extras?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function hc(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(let r=0,i=t.weights.length;r<i;r++)e.morphTargetInfluences[r]=t.weights[r];if(t.extras&&Array.isArray(t.extras.targetNames)){const r=t.extras.targetNames;if(e.morphTargetInfluences.length===r.length){e.morphTargetDictionary={};for(let t=0,i=r.length;t<i;t++)e.morphTargetDictionary[r[t]]=t}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function uc(e){const t=e.extensions&&e.extensions[Tl.KHR_DRACO_MESH_COMPRESSION];let r;return r=t?"draco:"+t.bufferView+":"+t.indices+":"+dc(t.attributes):e.indices+":"+dc(e.attributes)+":"+e.mode,r}function dc(e){let t="";const r=Object.keys(e).sort();for(let i=0,n=r.length;i<n;i++)t+=r[i]+":"+e[r[i]]+";";return t}function pc(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}const mc=new e.Matrix4;class fc{constructor(t={},r={}){this.json=t,this.extensions={},this.plugins={},this.options=r,this.cache=new Ml,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let i=!1,n=!1,s=-1;"undefined"!=typeof navigator&&(i=!0===/^((?!chrome|android).)*safari/i.test(navigator.userAgent),n=navigator.userAgent.indexOf("Firefox")>-1,s=n?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),"undefined"==typeof createImageBitmap||i||n&&s<98?this.textureLoader=new e.TextureLoader(this.options.manager):this.textureLoader=new e.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new e.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const r=this,i=this.json,n=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll((function(e){return e._markDefs&&e._markDefs()})),Promise.all(this._invokeAll((function(e){return e.beforeRoot&&e.beforeRoot()}))).then((function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])})).then((function(t){const s={scene:t[0][i.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:i.asset,parser:r,userData:{}};lc(n,s,i),cc(s,i),Promise.all(r._invokeAll((function(e){return e.afterRoot&&e.afterRoot(s)}))).then((function(){e(s)}))})).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],r=this.json.meshes||[];for(let r=0,i=t.length;r<i;r++){const i=t[r].joints;for(let t=0,r=i.length;t<r;t++)e[i[t]].isBone=!0}for(let t=0,i=e.length;t<i;t++){const i=e[t];void 0!==i.mesh&&(this._addNodeRef(this.meshCache,i.mesh),void 0!==i.skin&&(r[i.mesh].isSkinnedMesh=!0)),void 0!==i.camera&&this._addNodeRef(this.cameraCache,i.camera)}}_addNodeRef(e,t){void 0!==t&&(void 0===e.refs[t]&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,r){if(e.refs[t]<=1)return r;const i=r.clone(),n=(e,t)=>{const r=this.associations.get(e);null!=r&&this.associations.set(t,r);for(const[r,i]of e.children.entries())n(i,t.children[r])};return n(r,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let r=0;r<t.length;r++){const i=e(t[r]);if(i)return i}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const r=[];for(let i=0;i<t.length;i++){const n=e(t[i]);n&&r.push(n)}return r}getDependency(e,t){const r=e+":"+t;let i=this.cache.get(r);if(!i){switch(e){case"scene":i=this.loadScene(t);break;case"node":i=this._invokeOne((function(e){return e.loadNode&&e.loadNode(t)}));break;case"mesh":i=this._invokeOne((function(e){return e.loadMesh&&e.loadMesh(t)}));break;case"accessor":i=this.loadAccessor(t);break;case"bufferView":i=this._invokeOne((function(e){return e.loadBufferView&&e.loadBufferView(t)}));break;case"buffer":i=this.loadBuffer(t);break;case"material":i=this._invokeOne((function(e){return e.loadMaterial&&e.loadMaterial(t)}));break;case"texture":i=this._invokeOne((function(e){return e.loadTexture&&e.loadTexture(t)}));break;case"skin":i=this.loadSkin(t);break;case"animation":i=this._invokeOne((function(e){return e.loadAnimation&&e.loadAnimation(t)}));break;case"camera":i=this.loadCamera(t);break;default:if(i=this._invokeOne((function(r){return r!=this&&r.getDependency&&r.getDependency(e,t)})),!i)throw new Error("Unknown type: "+e)}this.cache.add(r,i)}return i}getDependencies(e){let t=this.cache.get(e);if(!t){const r=this,i=this.json[e+("mesh"===e?"es":"s")]||[];t=Promise.all(i.map((function(t,i){return r.getDependency(e,i)}))),this.cache.add(e,t)}return t}loadBuffer(t){const r=this.json.buffers[t],i=this.fileLoader;if(r.type&&"arraybuffer"!==r.type)throw new Error("THREE.GLTFLoader: "+r.type+" buffer type is not supported.");if(void 0===r.uri&&0===t)return Promise.resolve(this.extensions[Tl.KHR_BINARY_GLTF].body);const n=this.options;return new Promise((function(t,s){i.load(e.LoaderUtils.resolveURL(r.uri,n.path),t,void 0,(function(){s(new Error('THREE.GLTFLoader: Failed to load buffer "'+r.uri+'".'))}))}))}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then((function(e){const r=t.byteLength||0,i=t.byteOffset||0;return e.slice(i,i+r)}))}loadAccessor(t){const r=this,i=this.json,n=this.json.accessors[t];if(void 0===n.bufferView&&void 0===n.sparse){const t=tc[n.type],r=Zl[n.componentType],i=!0===n.normalized,s=new r(n.count*t);return Promise.resolve(new e.BufferAttribute(s,t,i))}const s=[];return void 0!==n.bufferView?s.push(this.getDependency("bufferView",n.bufferView)):s.push(null),void 0!==n.sparse&&(s.push(this.getDependency("bufferView",n.sparse.indices.bufferView)),s.push(this.getDependency("bufferView",n.sparse.values.bufferView))),Promise.all(s).then((function(t){const s=t[0],o=tc[n.type],a=Zl[n.componentType],l=a.BYTES_PER_ELEMENT,c=l*o,h=n.byteOffset||0,u=void 0!==n.bufferView?i.bufferViews[n.bufferView].byteStride:void 0,d=!0===n.normalized;let p,m;if(u&&u!==c){const t=Math.floor(h/u),i="InterleavedBuffer:"+n.bufferView+":"+n.componentType+":"+t+":"+n.count;let c=r.cache.get(i);c||(p=new a(s,t*u,n.count*u/l),c=new e.InterleavedBuffer(p,u/l),r.cache.add(i,c)),m=new e.InterleavedBufferAttribute(c,o,h%u/l,d)}else p=null===s?new a(n.count*o):new a(s,h,n.count*o),m=new e.BufferAttribute(p,o,d);if(void 0!==n.sparse){const r=tc.SCALAR,i=Zl[n.sparse.indices.componentType],l=n.sparse.indices.byteOffset||0,c=n.sparse.values.byteOffset||0,h=new i(t[1],l,n.sparse.count*r),u=new a(t[2],c,n.sparse.count*o);null!==s&&(m=new e.BufferAttribute(m.array.slice(),m.itemSize,m.normalized));for(let e=0,t=h.length;e<t;e++){const t=h[e];if(m.setX(t,u[e*o]),o>=2&&m.setY(t,u[e*o+1]),o>=3&&m.setZ(t,u[e*o+2]),o>=4&&m.setW(t,u[e*o+3]),o>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return m}))}loadTexture(e){const t=this.json,r=this.options,i=t.textures[e].source,n=t.images[i];let s=this.textureLoader;if(n.uri){const e=r.manager.getHandler(n.uri);null!==e&&(s=e)}return this.loadTextureImage(e,i,s)}loadTextureImage(t,r,i){const n=this,s=this.json,o=s.textures[t],a=s.images[r],l=(a.uri||a.bufferView)+":"+o.sampler;if(this.textureCache[l])return this.textureCache[l];const c=this.loadImageSource(r,i).then((function(r){r.flipY=!1,r.name=o.name||a.name||"",""===r.name&&"string"==typeof a.uri&&!1===a.uri.startsWith("data:image/")&&(r.name=a.uri);const i=(s.samplers||{})[o.sampler]||{};return r.magFilter=$l[i.magFilter]||e.LinearFilter,r.minFilter=$l[i.minFilter]||e.LinearMipmapLinearFilter,r.wrapS=ec[i.wrapS]||e.RepeatWrapping,r.wrapT=ec[i.wrapT]||e.RepeatWrapping,n.associations.set(r,{textures:t}),r})).catch((function(){return null}));return this.textureCache[l]=c,c}loadImageSource(t,r){const i=this,n=this.json,s=this.options;if(void 0!==this.sourceCache[t])return this.sourceCache[t].then((e=>e.clone()));const o=n.images[t],a=self.URL||self.webkitURL;let l=o.uri||"",c=!1;if(void 0!==o.bufferView)l=i.getDependency("bufferView",o.bufferView).then((function(e){c=!0;const t=new Blob([e],{type:o.mimeType});return l=a.createObjectURL(t),l}));else if(void 0===o.uri)throw new Error("THREE.GLTFLoader: Image "+t+" is missing URI and bufferView");const h=Promise.resolve(l).then((function(t){return new Promise((function(i,n){let o=i;!0===r.isImageBitmapLoader&&(o=function(t){const r=new e.Texture(t);r.needsUpdate=!0,i(r)}),r.load(e.LoaderUtils.resolveURL(t,s.path),o,void 0,n)}))})).then((function(e){var t;return!0===c&&a.revokeObjectURL(l),e.userData.mimeType=o.mimeType||((t=o.uri).search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/)?"image/jpeg":t.search(/\.webp($|\?)/i)>0||0===t.search(/^data\:image\/webp/)?"image/webp":"image/png"),e})).catch((function(e){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),e}));return this.sourceCache[t]=h,h}assignTexture(e,t,r,i){const n=this;return this.getDependency("texture",r.index).then((function(s){if(!s)return null;if(void 0!==r.texCoord&&r.texCoord>0&&((s=s.clone()).channel=r.texCoord),n.extensions[Tl.KHR_TEXTURE_TRANSFORM]){const e=void 0!==r.extensions?r.extensions[Tl.KHR_TEXTURE_TRANSFORM]:void 0;if(e){const t=n.associations.get(s);s=n.extensions[Tl.KHR_TEXTURE_TRANSFORM].extendTexture(s,e),n.associations.set(s,t)}}return void 0!==i&&("colorSpace"in s?s.colorSpace=3001===i?"srgb":"srgb-linear":s.encoding=i),e[t]=s,s}))}assignFinalMaterial(t){const r=t.geometry;let i=t.material;const n=void 0===r.attributes.tangent,s=void 0!==r.attributes.color,o=void 0===r.attributes.normal;if(t.isPoints){const t="PointsMaterial:"+i.uuid;let r=this.cache.get(t);r||(r=new e.PointsMaterial,e.Material.prototype.copy.call(r,i),r.color.copy(i.color),r.map=i.map,r.sizeAttenuation=!1,this.cache.add(t,r)),i=r}else if(t.isLine){const t="LineBasicMaterial:"+i.uuid;let r=this.cache.get(t);r||(r=new e.LineBasicMaterial,e.Material.prototype.copy.call(r,i),r.color.copy(i.color),r.map=i.map,this.cache.add(t,r)),i=r}if(n||s||o){let e="ClonedMaterial:"+i.uuid+":";n&&(e+="derivative-tangents:"),s&&(e+="vertex-colors:"),o&&(e+="flat-shading:");let t=this.cache.get(e);t||(t=i.clone(),s&&(t.vertexColors=!0),o&&(t.flatShading=!0),n&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(i))),i=t}t.material=i}getMaterialType(){return e.MeshStandardMaterial}loadMaterial(t){const r=this,i=this.json,n=this.extensions,s=i.materials[t];let o;const a={},l=[];if((s.extensions||{})[Tl.KHR_MATERIALS_UNLIT]){const e=n[Tl.KHR_MATERIALS_UNLIT];o=e.getMaterialType(),l.push(e.extendParams(a,s,r))}else{const i=s.pbrMetallicRoughness||{};if(a.color=new e.Color(1,1,1),a.opacity=1,Array.isArray(i.baseColorFactor)){const e=i.baseColorFactor;a.color.fromArray(e),a.opacity=e[3]}void 0!==i.baseColorTexture&&l.push(r.assignTexture(a,"map",i.baseColorTexture,3001)),a.metalness=void 0!==i.metallicFactor?i.metallicFactor:1,a.roughness=void 0!==i.roughnessFactor?i.roughnessFactor:1,void 0!==i.metallicRoughnessTexture&&(l.push(r.assignTexture(a,"metalnessMap",i.metallicRoughnessTexture)),l.push(r.assignTexture(a,"roughnessMap",i.metallicRoughnessTexture))),o=this._invokeOne((function(e){return e.getMaterialType&&e.getMaterialType(t)})),l.push(Promise.all(this._invokeAll((function(e){return e.extendMaterialParams&&e.extendMaterialParams(t,a)}))))}!0===s.doubleSided&&(a.side=e.DoubleSide);const c=s.alphaMode||sc;if(c===ac?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,c===oc&&(a.alphaTest=void 0!==s.alphaCutoff?s.alphaCutoff:.5)),void 0!==s.normalTexture&&o!==e.MeshBasicMaterial&&(l.push(r.assignTexture(a,"normalMap",s.normalTexture)),a.normalScale=new e.Vector2(1,1),void 0!==s.normalTexture.scale)){const e=s.normalTexture.scale;a.normalScale.set(e,e)}return void 0!==s.occlusionTexture&&o!==e.MeshBasicMaterial&&(l.push(r.assignTexture(a,"aoMap",s.occlusionTexture)),void 0!==s.occlusionTexture.strength&&(a.aoMapIntensity=s.occlusionTexture.strength)),void 0!==s.emissiveFactor&&o!==e.MeshBasicMaterial&&(a.emissive=(new e.Color).fromArray(s.emissiveFactor)),void 0!==s.emissiveTexture&&o!==e.MeshBasicMaterial&&l.push(r.assignTexture(a,"emissiveMap",s.emissiveTexture,sRGBEncoding)),Promise.all(l).then((function(){const e=new o(a);return s.name&&(e.name=s.name),cc(e,s),r.associations.set(e,{materials:t}),s.extensions&&lc(n,e,s),e}))}createUniqueName(t){const r=e.PropertyBinding.sanitizeNodeName(t||"");let i=r;for(let e=1;this.nodeNamesUsed[i];++e)i=r+"_"+e;return this.nodeNamesUsed[i]=!0,i}loadGeometries(t){const r=this,i=this.extensions,n=this.primitiveCache;function s(e){return i[Tl.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,r).then((function(t){return gc(t,e,r)}))}const o=[];for(let i=0,a=t.length;i<a;i++){const a=t[i],l=uc(a),c=n[l];if(c)o.push(c.promise);else{let t;t=a.extensions&&a.extensions[Tl.KHR_DRACO_MESH_COMPRESSION]?s(a):gc(new e.BufferGeometry,a,r),n[l]={primitive:a,promise:t},o.push(t)}}return Promise.all(o)}loadMesh(t){const r=this,i=this.json,n=this.extensions,s=i.meshes[t],o=s.primitives,a=[];for(let t=0,r=o.length;t<r;t++){const r=void 0===o[t].material?(void 0===(l=this.cache).DefaultMaterial&&(l.DefaultMaterial=new e.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:e.FrontSide})),l.DefaultMaterial):this.getDependency("material",o[t].material);a.push(r)}var l;return a.push(r.loadGeometries(o)),Promise.all(a).then((function(i){const a=i.slice(0,i.length-1),l=i[i.length-1],c=[];for(let i=0,h=l.length;i<h;i++){const h=l[i],u=o[i];let d;const p=a[i];if(u.mode===Jl.TRIANGLES||u.mode===Jl.TRIANGLE_STRIP||u.mode===Jl.TRIANGLE_FAN||void 0===u.mode)d=!0===s.isSkinnedMesh?new e.SkinnedMesh(h,p):new e.Mesh(h,p),!0===d.isSkinnedMesh&&d.normalizeSkinWeights(),u.mode===Jl.TRIANGLE_STRIP?d.geometry=Ne(d.geometry,e.TriangleStripDrawMode):u.mode===Jl.TRIANGLE_FAN&&(d.geometry=Ne(d.geometry,e.TriangleFanDrawMode));else if(u.mode===Jl.LINES)d=new e.LineSegments(h,p);else if(u.mode===Jl.LINE_STRIP)d=new e.Line(h,p);else if(u.mode===Jl.LINE_LOOP)d=new e.LineLoop(h,p);else{if(u.mode!==Jl.POINTS)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+u.mode);d=new e.Points(h,p)}Object.keys(d.geometry.morphAttributes).length>0&&hc(d,s),d.name=r.createUniqueName(s.name||"mesh_"+t),cc(d,s),u.extensions&&lc(n,d,u),r.assignFinalMaterial(d),c.push(d)}for(let e=0,i=c.length;e<i;e++)r.associations.set(c[e],{meshes:t,primitives:e});if(1===c.length)return c[0];const h=new e.Group;r.associations.set(h,{meshes:t});for(let e=0,t=c.length;e<t;e++)h.add(c[e]);return h}))}loadCamera(t){let r;const i=this.json.cameras[t],n=i[i.type];if(n)return"perspective"===i.type?r=new e.PerspectiveCamera(e.MathUtils.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):"orthographic"===i.type&&(r=new e.OrthographicCamera(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar)),i.name&&(r.name=this.createUniqueName(i.name)),cc(r,i),Promise.resolve(r);console.warn("THREE.GLTFLoader: Missing camera parameters.")}loadSkin(t){const r=this.json.skins[t],i=[];for(let e=0,t=r.joints.length;e<t;e++)i.push(this._loadNodeShallow(r.joints[e]));return void 0!==r.inverseBindMatrices?i.push(this.getDependency("accessor",r.inverseBindMatrices)):i.push(null),Promise.all(i).then((function(t){const i=t.pop(),n=t,s=[],o=[];for(let t=0,a=n.length;t<a;t++){const a=n[t];if(a){s.push(a);const r=new e.Matrix4;null!==i&&r.fromArray(i.array,16*t),o.push(r)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',r.joints[t])}return new e.Skeleton(s,o)}))}loadAnimation(t){const r=this.json.animations[t],i=r.name?r.name:"animation_"+t,n=[],s=[],o=[],a=[],l=[];for(let e=0,t=r.channels.length;e<t;e++){const t=r.channels[e],i=r.samplers[t.sampler],c=t.target,h=c.node,u=void 0!==r.parameters?r.parameters[i.input]:i.input,d=void 0!==r.parameters?r.parameters[i.output]:i.output;void 0!==c.node&&(n.push(this.getDependency("node",h)),s.push(this.getDependency("accessor",u)),o.push(this.getDependency("accessor",d)),a.push(i),l.push(c))}return Promise.all([Promise.all(n),Promise.all(s),Promise.all(o),Promise.all(a),Promise.all(l)]).then((function(t){const r=t[0],n=t[1],s=t[2],o=t[3],a=t[4],l=[];for(let t=0,i=r.length;t<i;t++){const i=r[t],c=n[t],h=s[t],u=o[t],d=a[t];if(void 0===i)continue;let p;switch(i.updateMatrix(),ic[d.path]){case ic.weights:p=e.NumberKeyframeTrack;break;case ic.rotation:p=e.QuaternionKeyframeTrack;break;case ic.position:case ic.scale:default:p=e.VectorKeyframeTrack}const m=i.name?i.name:i.uuid,f=void 0!==u.interpolation?nc[u.interpolation]:e.InterpolateLinear,g=[];ic[d.path]===ic.weights?i.traverse((function(e){e.morphTargetInfluences&&g.push(e.name?e.name:e.uuid)})):g.push(m);let v=h.array;if(h.normalized){const e=pc(v.constructor),t=new Float32Array(v.length);for(let r=0,i=v.length;r<i;r++)t[r]=v[r]*e;v=t}for(let t=0,r=g.length;t<r;t++){const r=new p(g[t]+"."+ic[d.path],c.array,v,f);"CUBICSPLINE"===u.interpolation&&(r.createInterpolant=function(t){return new(this instanceof e.QuaternionKeyframeTrack?ql:Yl)(this.times,this.values,this.getValueSize()/3,t)},r.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),l.push(r)}}return new e.AnimationClip(i,void 0,l)}))}createNodeMesh(e){const t=this.json,r=this,i=t.nodes[e];return void 0===i.mesh?null:r.getDependency("mesh",i.mesh).then((function(e){const t=r._getNodeRef(r.meshCache,i.mesh,e);return void 0!==i.weights&&t.traverse((function(e){if(e.isMesh)for(let t=0,r=i.weights.length;t<r;t++)e.morphTargetInfluences[t]=i.weights[t]})),t}))}loadNode(e){const t=this,r=this.json.nodes[e],i=t._loadNodeShallow(e),n=[],s=r.children||[];for(let e=0,r=s.length;e<r;e++)n.push(t.getDependency("node",s[e]));const o=void 0===r.skin?Promise.resolve(null):t.getDependency("skin",r.skin);return Promise.all([i,Promise.all(n),o]).then((function(e){const t=e[0],r=e[1],i=e[2];null!==i&&t.traverse((function(e){e.isSkinnedMesh&&e.bind(i,mc)}));for(let e=0,i=r.length;e<i;e++)t.add(r[e]);return t}))}_loadNodeShallow(t){const r=this.json,i=this.extensions,n=this;if(void 0!==this.nodeCache[t])return this.nodeCache[t];const s=r.nodes[t],o=s.name?n.createUniqueName(s.name):"",a=[],l=n._invokeOne((function(e){return e.createNodeMesh&&e.createNodeMesh(t)}));return l&&a.push(l),void 0!==s.camera&&a.push(n.getDependency("camera",s.camera).then((function(e){return n._getNodeRef(n.cameraCache,s.camera,e)}))),n._invokeAll((function(e){return e.createNodeAttachment&&e.createNodeAttachment(t)})).forEach((function(e){a.push(e)})),this.nodeCache[t]=Promise.all(a).then((function(r){let a;if(a=!0===s.isBone?new e.Bone:r.length>1?new e.Group:1===r.length?r[0]:new e.Object3D,a!==r[0])for(let e=0,t=r.length;e<t;e++)a.add(r[e]);if(s.name&&(a.userData.name=s.name,a.name=o),cc(a,s),s.extensions&&lc(i,a,s),void 0!==s.matrix){const t=new e.Matrix4;t.fromArray(s.matrix),a.applyMatrix4(t)}else void 0!==s.translation&&a.position.fromArray(s.translation),void 0!==s.rotation&&a.quaternion.fromArray(s.rotation),void 0!==s.scale&&a.scale.fromArray(s.scale);return n.associations.has(a)||n.associations.set(a,{}),n.associations.get(a).nodes=t,a})),this.nodeCache[t]}loadScene(t){const r=this.extensions,i=this.json.scenes[t],n=this,s=new e.Group;i.name&&(s.name=n.createUniqueName(i.name)),cc(s,i),i.extensions&&lc(r,s,i);const o=i.nodes||[],a=[];for(let e=0,t=o.length;e<t;e++)a.push(n.getDependency("node",o[e]));return Promise.all(a).then((function(t){for(let e=0,r=t.length;e<r;e++)s.add(t[e]);return n.associations=(t=>{const r=new Map;for(const[t,i]of n.associations)(t instanceof e.Material||t instanceof e.Texture)&&r.set(t,i);return t.traverse((e=>{const t=n.associations.get(e);null!=t&&r.set(e,t)})),r})(s),s}))}}function gc(t,r,i){const n=r.attributes,s=[];function o(e,r){return i.getDependency("accessor",e).then((function(e){t.setAttribute(r,e)}))}for(const e in n){const r=rc[e]||e.toLowerCase();r in t.attributes||s.push(o(n[e],r))}if(void 0!==r.indices&&!t.index){const e=i.getDependency("accessor",r.indices).then((function(e){t.setIndex(e)}));s.push(e)}return cc(t,r),function(t,r,i){const n=r.attributes,s=new e.Box3;if(void 0===n.POSITION)return;{const t=i.json.accessors[n.POSITION],r=t.min,o=t.max;if(void 0===r||void 0===o)return void console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");if(s.set(new e.Vector3(r[0],r[1],r[2]),new e.Vector3(o[0],o[1],o[2])),t.normalized){const e=pc(Zl[t.componentType]);s.min.multiplyScalar(e),s.max.multiplyScalar(e)}}const o=r.targets;if(void 0!==o){const t=new e.Vector3,r=new e.Vector3;for(let e=0,n=o.length;e<n;e++){const n=o[e];if(void 0!==n.POSITION){const e=i.json.accessors[n.POSITION],s=e.min,o=e.max;if(void 0!==s&&void 0!==o){if(r.setX(Math.max(Math.abs(s[0]),Math.abs(o[0]))),r.setY(Math.max(Math.abs(s[1]),Math.abs(o[1]))),r.setZ(Math.max(Math.abs(s[2]),Math.abs(o[2]))),e.normalized){const t=pc(Zl[e.componentType]);r.multiplyScalar(t)}t.max(r)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}s.expandByVector(t)}t.boundingBox=s;const a=new e.Sphere;s.getCenter(a.center),a.radius=s.min.distanceTo(s.max)/2,t.boundingSphere=a}(t,r,i),Promise.all(s).then((function(){return void 0!==r.targets?function(e,t,r){let i=!1,n=!1,s=!1;for(let e=0,r=t.length;e<r;e++){const r=t[e];if(void 0!==r.POSITION&&(i=!0),void 0!==r.NORMAL&&(n=!0),void 0!==r.COLOR_0&&(s=!0),i&&n&&s)break}if(!i&&!n&&!s)return Promise.resolve(e);const o=[],a=[],l=[];for(let c=0,h=t.length;c<h;c++){const h=t[c];if(i){const t=void 0!==h.POSITION?r.getDependency("accessor",h.POSITION):e.attributes.position;o.push(t)}if(n){const t=void 0!==h.NORMAL?r.getDependency("accessor",h.NORMAL):e.attributes.normal;a.push(t)}if(s){const t=void 0!==h.COLOR_0?r.getDependency("accessor",h.COLOR_0):e.attributes.color;l.push(t)}}return Promise.all([Promise.all(o),Promise.all(a),Promise.all(l)]).then((function(t){const r=t[0],o=t[1],a=t[2];return i&&(e.morphAttributes.position=r),n&&(e.morphAttributes.normal=o),s&&(e.morphAttributes.color=a),e.morphTargetsRelative=!0,e}))}(t,r.targets,i):t}))}class vc{constructor(e,t,r="https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles/generic-hand/",i,n){p.default(this,"controller",void 0),p.default(this,"handModel",void 0),p.default(this,"bones",void 0),this.controller=t,this.handModel=e,this.bones=[];const s=new wl;n||s.setPath(r),s.load(null!=n?n:`${i}.glb`,(e=>{const t=e.scene.children[0];this.handModel.add(t);const r=t.getObjectByProperty("type","SkinnedMesh");r.frustumCulled=!1,r.castShadow=!0,r.receiveShadow=!0;["wrist","thumb-metacarpal","thumb-phalanx-proximal","thumb-phalanx-distal","thumb-tip","index-finger-metacarpal","index-finger-phalanx-proximal","index-finger-phalanx-intermediate","index-finger-phalanx-distal","index-finger-tip","middle-finger-metacarpal","middle-finger-phalanx-proximal","middle-finger-phalanx-intermediate","middle-finger-phalanx-distal","middle-finger-tip","ring-finger-metacarpal","ring-finger-phalanx-proximal","ring-finger-phalanx-intermediate","ring-finger-phalanx-distal","ring-finger-tip","pinky-finger-metacarpal","pinky-finger-phalanx-proximal","pinky-finger-phalanx-intermediate","pinky-finger-phalanx-distal","pinky-finger-tip"].forEach((e=>{const r=t.getObjectByName(e);void 0!==r?r.jointName=e:console.warn(`Couldn't find ${e} in ${i} hand mesh`),this.bones.push(r)}))}))}updateMesh(){const e=this.controller.joints;for(let t=0;t<this.bones.length;t++){const r=this.bones[t];if(r){const t=e[r.jointName];if(t.visible){const e=t.position;r.position.copy(e),r.quaternion.copy(t.quaternion)}}}}}class xc extends e.Object3D{constructor(e,t,r){super(),p.default(this,"controller",void 0),p.default(this,"motionController",void 0),p.default(this,"envMap",void 0),p.default(this,"mesh",void 0),p.default(this,"xrInputSource",void 0),this.controller=e,this.motionController=null,this.envMap=null,this.mesh=null,this.xrInputSource=null,e.addEventListener("connected",(i=>{const n=i.data;n.hand&&!this.motionController&&(this.xrInputSource=n,this.motionController=new vc(this,e,void 0,n.handedness,"left"===n.handedness?t:r))})),e.addEventListener("disconnected",(()=>{this.dispose()}))}updateMatrixWorld(e){super.updateMatrixWorld(e),this.motionController&&this.motionController.updateMesh()}getPointerPosition(){const e=this.controller.joints["index-finger-tip"];return e?e.position:null}intersectBoxObject(t){const r=this.getPointerPosition();if(r){const i=new e.Sphere(r,.01),n=(new e.Box3).setFromObject(t);return i.intersectsBox(n)}return!1}checkButton(e){this.intersectBoxObject(e)?e.onPress():e.onClear(),e.isPressed()&&e.whilePressed()}dispose(){this.clear(),this.motionController=null}}const yc=new d.Vector3(0,1,0),bc=new d.Vector3(0,0,1);class Ac extends d.Object3D{constructor(e,t){super(),this.hand=e,this.controller=t,this.motionController=null,this.envMap=null,this.mesh=null,this.pointerGeometry=null,this.pointerMesh=null,this.pointerObject=null,this.pinched=!1,this.attached=!1,this.cursorObject=null,this.raycaster=null,e.addEventListener("connected",(e=>{const t=e.data;t.hand&&(this.visible=!0,this.xrInputSource=t,this.createPointer())}))}_drawVerticesRing(e,t,r){const i=t.clone();for(var n=0;n<16;n++){i.applyAxisAngle(bc,2*Math.PI/16);const t=16*r+n;e[3*t]=i.x,e[3*t+1]=i.y,e[3*t+2]=i.z}}_updatePointerVertices(e){const t=this.pointerGeometry.attributes.position.array,r=new d.Vector3(.002,0,-1*(.035-e));this._drawVerticesRing(t,r,0);const i=new d.Vector3(Math.sin(110*Math.PI/180)*e,Math.cos(110*Math.PI/180)*e,0);for(var n=0;n<12;n++)this._drawVerticesRing(t,i,n+1),i.applyAxisAngle(yc,110*Math.PI/180/-24);const s=new d.Vector3(0,0,-1*(.035-e));t[624]=s.x,t[625]=s.y,t[626]=s.z;const o=new d.Vector3(0,0,e);t[627]=o.x,t[628]=o.y,t[629]=o.z,this.pointerGeometry.setAttribute("position",new d.Float32BufferAttribute(t,3))}createPointer(){var e,t;const r=new Array(630).fill(0),i=[];for(this.pointerGeometry=new d.BufferGeometry,this.pointerGeometry.setAttribute("position",new d.Float32BufferAttribute(r,3)),this._updatePointerVertices(.01),e=0;e<12;e++){for(t=0;t<15;t++)i.push(16*e+t,16*e+t+1,16*(e+1)+t),i.push(16*e+t+1,16*(e+1)+t+1,16*(e+1)+t);i.push(16*(e+1)-1,16*e,16*(e+2)-1),i.push(16*e,16*(e+1),16*(e+2)-1)}for(e=0;e<15;e++)i.push(208,e+1,e),i.push(209,e+192,e+192+1);i.push(208,0,15),i.push(209,207,192);const n=new d.MeshBasicMaterial;n.transparent=!0,n.opacity=.4,this.pointerGeometry.setIndex(i),this.pointerMesh=new d.Mesh(this.pointerGeometry,n),this.pointerMesh.position.set(0,0,-.01),this.pointerObject=new d.Object3D,this.pointerObject.add(this.pointerMesh),this.raycaster=new d.Raycaster;const s=new d.SphereGeometry(.02,10,10),o=new d.MeshBasicMaterial;o.transparent=!0,o.opacity=.4,this.cursorObject=new d.Mesh(s,o),this.pointerObject.add(this.cursorObject),this.add(this.pointerObject)}_updateRaycaster(){if(this.raycaster){const e=this.pointerObject.matrixWorld,t=new d.Matrix4;t.identity().extractRotation(e),this.raycaster.ray.origin.setFromMatrixPosition(e),this.raycaster.ray.direction.set(0,0,-1).applyMatrix4(t)}}_updatePointer(){this.pointerObject.visible=this.controller.visible;const e=this.hand.joints["index-finger-tip"],t=this.hand.joints["thumb-tip"],r=e.position.distanceTo(t.position),i=e.position.clone().add(t.position).multiplyScalar(.5);this.pointerObject.position.copy(i),this.pointerObject.quaternion.copy(this.controller.quaternion),this.pinched=r<=.02;const n=(r-.01)/.04,s=(r-.01)/.01;if(n>1)this._updatePointerVertices(.01),this.pointerMesh.position.set(0,0,-.01),this.pointerMesh.material.opacity=.4;else if(n>0){const e=.007*n+.003;this._updatePointerVertices(e),s<1?(this.pointerMesh.position.set(0,0,-1*e-.02*(1-s)),this.pointerMesh.material.opacity=.4+.6*(1-s)):(this.pointerMesh.position.set(0,0,-1*e),this.pointerMesh.material.opacity=.4)}else this._updatePointerVertices(.003),this.pointerMesh.position.set(0,0,-.023),this.pointerMesh.material.opacity=1;this.cursorObject.material.opacity=this.pointerMesh.material.opacity}updateMatrixWorld(e){super.updateMatrixWorld(e),this.pointerGeometry&&(this._updatePointer(),this._updateRaycaster())}isPinched(){return this.pinched}setAttached(e){this.attached=e}isAttached(){return this.attached}intersectObject(e,t=!0){if(this.raycaster)return this.raycaster.intersectObject(e,t)}intersectObjects(e,t=!0){if(this.raycaster)return this.raycaster.intersectObjects(e,t)}checkIntersections(e,t=!1){if(this.raycaster&&!this.attached){const r=this.raycaster.intersectObjects(e,t),i=new d.Vector3(0,0,-1);if(r.length>0){const e=r[0].distance;this.cursorObject.position.copy(i.multiplyScalar(e))}else this.cursorObject.position.copy(i.multiplyScalar(1.5))}}setCursor(e){const t=new d.Vector3(0,0,-1);this.raycaster&&!this.attached&&this.cursorObject.position.copy(t.multiplyScalar(e))}}class wc{static createButton(e,t={}){const r=document.createElement("button");function i(){r.style.display="",r.style.cursor="auto",r.style.left="calc(50% - 75px)",r.style.width="150px",r.onmouseenter=null,r.onmouseleave=null,r.onclick=null,r.textContent="VR NOT SUPPORTED"}function n(e){e.style.position="absolute",e.style.bottom="20px",e.style.padding="12px 6px",e.style.border="1px solid #fff",e.style.borderRadius="4px",e.style.background="rgba(0,0,0,0.1)",e.style.color="#fff",e.style.font="normal 13px sans-serif",e.style.textAlign="center",e.style.opacity="0.5",e.style.outline="none",e.style.zIndex="999"}if("xr"in navigator)return n(r),r.id="VRButton",r.style.display="none",navigator.xr.isSessionSupported("immersive-vr").then((n=>{n?function(){let i=null;async function n(t){t.addEventListener("end",s),await e.xr.setSession(t),r.textContent="EXIT VR",i=t}function s(){i.removeEventListener("end",s),r.textContent="ENTER VR",i=null}r.style.display="",r.style.cursor="pointer",r.style.left="calc(50% - 50px)",r.style.width="100px",r.textContent="ENTER VR",r.onmouseenter=()=>{r.style.opacity="1.0"},r.onmouseleave=()=>{r.style.opacity="0.5"},r.onclick=()=>{if(null===i){var e;const r=[t.optionalFeatures,"local-floor","bounded-floor","hand-tracking"].flat().filter(Boolean);null===(e=navigator.xr)||void 0===e||e.requestSession("immersive-vr",{...t,optionalFeatures:r}).then(n)}else i.end()}}():i(),n&&wc.xrSessionIsGranted&&r.click()})),r;{const e=document.createElement("a");return!1===window.isSecureContext?(e.href=document.location.href.replace(/^http:/,"https:"),e.innerHTML="WEBXR NEEDS HTTPS"):(e.href="https://immersiveweb.dev/",e.innerHTML="WEBXR NOT AVAILABLE"),e.style.left="calc(50% - 90px)",e.style.width="180px",e.style.textDecoration="none",n(e),e}}static registerSessionGrantedListener(){"xr"in navigator&&navigator.xr.addEventListener("sessiongranted",(()=>{wc.xrSessionIsGranted=!0}))}}p.default(wc,"xrSessionIsGranted",!1);const Mc={Handedness:Object.freeze({NONE:"none",LEFT:"left",RIGHT:"right"}),ComponentState:Object.freeze({DEFAULT:"default",TOUCHED:"touched",PRESSED:"pressed"}),ComponentProperty:Object.freeze({BUTTON:"button",X_AXIS:"xAxis",Y_AXIS:"yAxis",STATE:"state"}),ComponentType:Object.freeze({TRIGGER:"trigger",SQUEEZE:"squeeze",TOUCHPAD:"touchpad",THUMBSTICK:"thumbstick",BUTTON:"button"}),ButtonTouchThreshold:.05,AxisTouchThreshold:.1,VisualResponseProperty:Object.freeze({TRANSFORM:"transform",VISIBILITY:"visibility"})};async function Tc(e){const t=await fetch(e);if(t.ok)return t.json();throw new Error(t.statusText)}async function Sc(e){if(!e)throw new Error("No basePath supplied");return await Tc(`${e}/profilesList.json`)}async function Cc(e,t,r=null,i=!0){if(!e)throw new Error("No xrInputSource supplied");if(!t)throw new Error("No basePath supplied");const n=await Sc(t);let s;if(e.profiles.some((e=>{const r=n[e];return r&&(s={profileId:e,profilePath:`${t}/${r.path}`,deprecated:!!r.deprecated}),!!s})),!s){if(!r)throw new Error("No matching profile name found");const e=n[r];if(!e)throw new Error(`No matching profile name found and default profile "${r}" missing.`);s={profileId:r,profilePath:`${t}/${e.path}`,deprecated:!!e.deprecated}}const o=await Tc(s.profilePath);let a;if(i){let t;if(t="any"===e.handedness?o.layouts[Object.keys(o.layouts)[0]]:o.layouts[e.handedness],!t)throw new Error(`No matching handedness, ${e.handedness}, in profile ${s.profileId}`);t.assetPath&&(a=s.profilePath.replace("profile.json",t.assetPath))}return{profile:o,assetPath:a}}const Fc={xAxis:0,yAxis:0,button:0,state:Mc.ComponentState.DEFAULT};class Ec{constructor(e){p.default(this,"value",void 0),p.default(this,"componentProperty",void 0),p.default(this,"states",void 0),p.default(this,"valueNodeName",void 0),p.default(this,"valueNodeProperty",void 0),p.default(this,"minNodeName",void 0),p.default(this,"maxNodeName",void 0),p.default(this,"valueNode",void 0),p.default(this,"minNode",void 0),p.default(this,"maxNode",void 0),this.componentProperty=e.componentProperty,this.states=e.states,this.valueNodeName=e.valueNodeName,this.valueNodeProperty=e.valueNodeProperty,this.valueNodeProperty===Mc.VisualResponseProperty.TRANSFORM&&(this.minNodeName=e.minNodeName,this.maxNodeName=e.maxNodeName),this.value=0,this.updateFromComponent(Fc)}updateFromComponent({xAxis:e,yAxis:t,button:r,state:i}){const{normalizedXAxis:n,normalizedYAxis:s}=function(e=0,t=0){let r=e,i=t;if(Math.sqrt(e*e+t*t)>1){const n=Math.atan2(t,e);r=Math.cos(n),i=Math.sin(n)}return{normalizedXAxis:.5*r+.5,normalizedYAxis:.5*i+.5}}(e,t);switch(this.componentProperty){case Mc.ComponentProperty.X_AXIS:this.value=this.states.includes(i)?n:.5;break;case Mc.ComponentProperty.Y_AXIS:this.value=this.states.includes(i)?s:.5;break;case Mc.ComponentProperty.BUTTON:this.value=this.states.includes(i)&&r?r:0;break;case Mc.ComponentProperty.STATE:this.valueNodeProperty===Mc.VisualResponseProperty.VISIBILITY?this.value=this.states.includes(i):this.value=this.states.includes(i)?1:0;break;default:throw new Error(`Unexpected visualResponse componentProperty ${this.componentProperty}`)}}}class _c{constructor(e,t){if(p.default(this,"id",void 0),p.default(this,"values",void 0),p.default(this,"type",void 0),p.default(this,"gamepadIndices",void 0),p.default(this,"rootNodeName",void 0),p.default(this,"visualResponses",void 0),p.default(this,"touchPointNodeName",void 0),p.default(this,"touchPointNode",void 0),!(e&&t&&t.visualResponses&&t.gamepadIndices&&0!==Object.keys(t.gamepadIndices).length))throw new Error("Invalid arguments supplied");this.id=e,this.type=t.type,this.rootNodeName=t.rootNodeName,this.touchPointNodeName=t.touchPointNodeName,this.visualResponses={},Object.keys(t.visualResponses).forEach((e=>{const r=new Ec(t.visualResponses[e]);this.visualResponses[e]=r})),this.gamepadIndices=Object.assign({},t.gamepadIndices),this.values={state:Mc.ComponentState.DEFAULT,button:void 0!==this.gamepadIndices.button?0:void 0,xAxis:void 0!==this.gamepadIndices.xAxis?0:void 0,yAxis:void 0!==this.gamepadIndices.yAxis?0:void 0}}get data(){return{id:this.id,...this.values}}updateFromGamepad(e){if(this.values.state=Mc.ComponentState.DEFAULT,void 0!==this.gamepadIndices.button&&e.buttons.length>this.gamepadIndices.button){const t=e.buttons[this.gamepadIndices.button];this.values.button=t.value,this.values.button=this.values.button<0?0:this.values.button,this.values.button=this.values.button>1?1:this.values.button,t.pressed||1===this.values.button?this.values.state=Mc.ComponentState.PRESSED:(t.touched||this.values.button>Mc.ButtonTouchThreshold)&&(this.values.state=Mc.ComponentState.TOUCHED)}void 0!==this.gamepadIndices.xAxis&&e.axes.length>this.gamepadIndices.xAxis&&(this.values.xAxis=e.axes[this.gamepadIndices.xAxis],this.values.xAxis=this.values.xAxis<-1?-1:this.values.xAxis,this.values.xAxis=this.values.xAxis>1?1:this.values.xAxis,this.values.state===Mc.ComponentState.DEFAULT&&Math.abs(this.values.xAxis)>Mc.AxisTouchThreshold&&(this.values.state=Mc.ComponentState.TOUCHED)),void 0!==this.gamepadIndices.yAxis&&e.axes.length>this.gamepadIndices.yAxis&&(this.values.yAxis=e.axes[this.gamepadIndices.yAxis],this.values.yAxis=this.values.yAxis<-1?-1:this.values.yAxis,this.values.yAxis=this.values.yAxis>1?1:this.values.yAxis,this.values.state===Mc.ComponentState.DEFAULT&&Math.abs(this.values.yAxis)>Mc.AxisTouchThreshold&&(this.values.state=Mc.ComponentState.TOUCHED)),Object.values(this.visualResponses).forEach((e=>{e.updateFromComponent(this.values)}))}}class Pc{constructor(e,t,r){if(p.default(this,"xrInputSource",void 0),p.default(this,"assetUrl",void 0),p.default(this,"layoutDescription",void 0),p.default(this,"id",void 0),p.default(this,"components",void 0),!e)throw new Error("No xrInputSource supplied");if(!t)throw new Error("No profile supplied");if(!t.layouts[e.handedness])throw new Error("No layout for "+e.handedness+" handedness");this.xrInputSource=e,this.assetUrl=r,this.id=t.profileId,this.layoutDescription=t.layouts[e.handedness],this.components={},Object.keys(this.layoutDescription.components).forEach((e=>{const t=this.layoutDescription.components[e];this.components[e]=new _c(e,t)})),this.updateFromGamepad()}get gripSpace(){return this.xrInputSource.gripSpace}get targetRaySpace(){return this.xrInputSource.targetRaySpace}get data(){const e=[];return Object.values(this.components).forEach((t=>{e.push(t.data)})),e}updateFromGamepad(){Object.values(this.components).forEach((e=>{e.updateFromGamepad(this.xrInputSource.gamepad)}))}}const Bc=(t,r)=>{r.traverse((r=>{r instanceof e.Mesh&&"envMap"in r.material&&(r.material.envMap=t,r.material.needsUpdate=!0)}))};class Lc extends e.Object3D{constructor(){super(),p.default(this,"envMap",void 0),p.default(this,"motionController",void 0),this.motionController=null,this.envMap=null}setEnvironmentMap(e){return this.envMap==e||(this.envMap=e,Bc(this.envMap,this)),this}updateMatrixWorld(e){super.updateMatrixWorld(e),this.motionController&&(this.motionController.updateFromGamepad(),Object.values(this.motionController.components).forEach((e=>{Object.values(e.visualResponses).forEach((e=>{const{valueNode:t,minNode:r,maxNode:i,value:n,valueNodeProperty:s}=e;t&&(s===Mc.VisualResponseProperty.VISIBILITY&&"boolean"==typeof n?t.visible=n:s===Mc.VisualResponseProperty.TRANSFORM&&r&&i&&"number"==typeof n&&(t.quaternion.slerpQuaternions(r.quaternion,i.quaternion,n),t.position.lerpVectors(r.position,i.position,n)))}))})))}}function Rc(t,r){!function(t,r){Object.values(t.components).forEach((t=>{const{type:i,touchPointNodeName:n,visualResponses:s}=t;if(i===Mc.ComponentType.TOUCHPAD&&n)if(t.touchPointNode=r.getObjectByName(n),t.touchPointNode){const r=new e.SphereGeometry(.001),i=new e.MeshBasicMaterial({color:255}),n=new e.Mesh(r,i);t.touchPointNode.add(n)}else console.warn(`Could not find touch dot, ${t.touchPointNodeName}, in touchpad component ${t.id}`);Object.values(s).forEach((e=>{const{valueNodeName:t,minNodeName:i,maxNodeName:n,valueNodeProperty:s}=e;if(s===Mc.VisualResponseProperty.TRANSFORM&&i&&n){if(e.minNode=r.getObjectByName(i),e.maxNode=r.getObjectByName(n),!e.minNode)return void console.warn(`Could not find ${i} in the model`);if(!e.maxNode)return void console.warn(`Could not find ${n} in the model`)}e.valueNode=r.getObjectByName(t),e.valueNode||console.warn(`Could not find ${t} in the model`)}))}))}(t.motionController,r),t.envMap&&Bc(t.envMap,r),t.add(r)}class Nc{constructor(t,r,i,n,s){this.xrLight=t,this.renderer=r,this.lightProbe=i,this.xrWebGLBinding=null,this.estimationStartCallback=s,this.frameCallback=this.onXRFrame.bind(this);const o=r.xr.getSession();if(n&&"XRWebGLBinding"in window){const i=new e.WebGLCubeRenderTarget(16);t.environment=i.texture;const n=r.getContext();switch(o.preferredReflectionFormat){case"srgba8":n.getExtension("EXT_sRGB");break;case"rgba16f":n.getExtension("OES_texture_half_float")}this.xrWebGLBinding=new XRWebGLBinding(o,n),this.lightProbe.addEventListener("reflectionchange",(()=>{this.updateReflection()}))}o.requestAnimationFrame(this.frameCallback)}updateReflection(){const e=this.renderer.properties.get(this.xrLight.environment);if(e){const t=this.xrWebGLBinding.getReflectionCubeMap(this.lightProbe);t&&(e.__webglTexture=t,this.xrLight.environment.needsPMREMUpdate=!0)}}onXRFrame(e,t){if(!this.xrLight)return;t.session.requestAnimationFrame(this.frameCallback);const r=t.getLightEstimate(this.lightProbe);if(r){this.xrLight.lightProbe.sh.fromArray(r.sphericalHarmonicsCoefficients),this.xrLight.lightProbe.intensity=1;const e=Math.max(1,Math.max(r.primaryLightIntensity.x,Math.max(r.primaryLightIntensity.y,r.primaryLightIntensity.z)));this.xrLight.directionalLight.color.setRGB(r.primaryLightIntensity.x/e,r.primaryLightIntensity.y/e,r.primaryLightIntensity.z/e),this.xrLight.directionalLight.intensity=e,this.xrLight.directionalLight.position.copy(r.primaryLightDirection),this.estimationStartCallback&&(this.estimationStartCallback(),this.estimationStartCallback=null)}}dispose(){this.xrLight=null,this.renderer=null,this.lightProbe=null,this.xrWebGLBinding=null}}class Dc extends e.Group{constructor(t,r=!0){super(),this.lightProbe=new e.LightProbe,this.lightProbe.intensity=0,this.add(this.lightProbe),this.directionalLight=new e.DirectionalLight,this.directionalLight.intensity=0,this.add(this.directionalLight),this.environment=null;let i=null,n=!1;t.xr.addEventListener("sessionstart",(()=>{const e=t.xr.getSession();"requestLightProbe"in e&&e.requestLightProbe({reflectionFormat:e.preferredReflectionFormat}).then((e=>{i=new Nc(this,t,e,r,(()=>{n=!0,this.dispatchEvent({type:"estimationstart"})}))}))})),t.xr.addEventListener("sessionend",(()=>{i&&(i.dispose(),i=null),n&&this.dispatchEvent({type:"estimationend"})})),this.dispose=()=>{i&&(i.dispose(),i=null),this.remove(this.lightProbe),this.lightProbe=null,this.remove(this.directionalLight),this.directionalLight=null,this.environment=null}}}const Ic=new e.Matrix4,Uc=new e.Vector3;class Oc{constructor(t,r,i,n,s){let o;this.controller=r,this.handModel=t,this.envMap=null,s&&s.primitive&&"sphere"!==s.primitive?"box"===s.primitive&&(o=new e.BoxGeometry(1,1,1)):o=new e.SphereGeometry(1,10,10);const a=new e.MeshStandardMaterial;this.handMesh=new e.InstancedMesh(o,a,30),this.handMesh.instanceMatrix.setUsage(e.DynamicDrawUsage),this.handMesh.castShadow=!0,this.handMesh.receiveShadow=!0,this.handModel.add(this.handMesh),this.joints=["wrist","thumb-metacarpal","thumb-phalanx-proximal","thumb-phalanx-distal","thumb-tip","index-finger-metacarpal","index-finger-phalanx-proximal","index-finger-phalanx-intermediate","index-finger-phalanx-distal","index-finger-tip","middle-finger-metacarpal","middle-finger-phalanx-proximal","middle-finger-phalanx-intermediate","middle-finger-phalanx-distal","middle-finger-tip","ring-finger-metacarpal","ring-finger-phalanx-proximal","ring-finger-phalanx-intermediate","ring-finger-phalanx-distal","ring-finger-tip","pinky-finger-metacarpal","pinky-finger-phalanx-proximal","pinky-finger-phalanx-intermediate","pinky-finger-phalanx-distal","pinky-finger-tip"]}updateMesh(){const e=this.controller.joints;let t=0;for(let r=0;r<this.joints.length;r++){const i=e[this.joints[r]];i.visible&&(Uc.setScalar(i.jointRadius||.008),Ic.compose(i.position,i.quaternion,Uc),this.handMesh.setMatrixAt(r,Ic),t++)}this.handMesh.count=t,this.handMesh.instanceMatrix.needsUpdate=!0}}class kc extends e.Object3D{constructor(e){super(),this.controller=e,this.motionController=null,this.envMap=null,this.mesh=null}updateMatrixWorld(e){super.updateMatrixWorld(e),this.motionController&&this.motionController.updateMesh()}}class Vc extends e.BufferGeometry{constructor(t=((e,t,r)=>r.set(e,t,Math.cos(e)*Math.sin(t))),r=8,i=8){super(),this.type="ParametricGeometry",this.parameters={func:t,slices:r,stacks:i};const n=[],s=[],o=[],a=[],l=1e-5,c=new e.Vector3,h=new e.Vector3,u=new e.Vector3,d=new e.Vector3,p=new e.Vector3,m=r+1;for(let e=0;e<=i;e++){const n=e/i;for(let e=0;e<=r;e++){const i=e/r;t(i,n,h),s.push(h.x,h.y,h.z),i-l>=0?(t(i-l,n,u),d.subVectors(h,u)):(t(i+l,n,u),d.subVectors(u,h)),n-l>=0?(t(i,n-l,u),p.subVectors(h,u)):(t(i,n+l,u),p.subVectors(u,h)),c.crossVectors(d,p).normalize(),o.push(c.x,c.y,c.z),a.push(i,n)}}for(let e=0;e<i;e++)for(let t=0;t<r;t++){const r=e*m+t,i=e*m+t+1,s=(e+1)*m+t+1,o=(e+1)*m+t;n.push(r,i,o),n.push(i,s,o)}this.setIndex(n),this.setAttribute("position",new e.Float32BufferAttribute(s,3)),this.setAttribute("normal",new e.Float32BufferAttribute(o,3)),this.setAttribute("uv",new e.Float32BufferAttribute(a,2))}}const Gc={klein:function(e,t,r){let i,n;t*=Math.PI,e*=2*Math.PI,(t*=2)<Math.PI?(i=3*Math.cos(t)*(1+Math.sin(t))+2*(1-Math.cos(t)/2)*Math.cos(t)*Math.cos(e),n=-8*Math.sin(t)-2*(1-Math.cos(t)/2)*Math.sin(t)*Math.cos(e)):(i=3*Math.cos(t)*(1+Math.sin(t))+2*(1-Math.cos(t)/2)*Math.cos(e+Math.PI),n=-8*Math.sin(t));const s=-2*(1-Math.cos(t)/2)*Math.sin(e);r.set(i,s,n)},plane:function(e,t){return function(r,i,n){const s=r*e,o=i*t;n.set(s,0,o)}},mobius:function(e,t,r){e-=.5;const i=2*Math.PI*t,n=Math.cos(i)*(2+e*Math.cos(i/2)),s=Math.sin(i)*(2+e*Math.cos(i/2)),o=e*Math.sin(i/2);r.set(n,s,o)},mobius3d:function(e,t,r){e*=Math.PI,t*=2*Math.PI;const i=(e*=2)/2;let n=.125*Math.cos(t)*Math.cos(i)-.65*Math.sin(t)*Math.sin(i);const s=.125*Math.cos(t)*Math.sin(i)+.65*Math.sin(t)*Math.cos(i),o=(2.25+n)*Math.sin(e);n=(2.25+n)*Math.cos(e),r.set(n,o,s)}};Gc.TubeGeometry=class extends Vc{constructor(t,r=64,i=1,n=8,s=!1){const o=r+1,a=t.computeFrenetFrames(r,s),l=a.tangents,c=a.normals,h=a.binormals,u=new e.Vector3;super((function(e,r,n){r*=2*Math.PI;const s=Math.floor(e*(o-1));t.getPointAt(e,u);const a=c[s],l=h[s],d=-i*Math.cos(r),p=i*Math.sin(r);u.x+=d*a.x+p*l.x,u.y+=d*a.y+p*l.y,u.z+=d*a.z+p*l.z,n.copy(u)}),r,n),this.tangents=l,this.normals=c,this.binormals=h,this.path=t,this.segments=r,this.radius=i,this.segmentsRadius=n,this.closed=s}},Gc.TorusKnotGeometry=class extends Gc.TubeGeometry{constructor(t=200,r=40,i=64,n=8,s=2,o=3){class a extends e.Curve{getPoint(r,i=new e.Vector3){const n=i;r*=2*Math.PI;const a=(1+.5*Math.cos(o*r))*Math.cos(s*r),l=(1+.5*Math.cos(o*r))*Math.sin(s*r),c=.5*Math.sin(o*r);return n.set(a,l,c).multiplyScalar(t)}}const l=i,c=n;super(new a,l,r,c,!0,!1),this.radius=t,this.tube=r,this.segmentsT=i,this.segmentsR=n,this.p=s,this.q=o}},Gc.SphereGeometry=class extends Vc{constructor(e,t,r){super((function(t,r,i){t*=Math.PI,r*=2*Math.PI;const n=e*Math.sin(t)*Math.cos(r),s=e*Math.sin(t)*Math.sin(r),o=e*Math.cos(t);i.set(n,s,o)}),t,r)}},Gc.PlaneGeometry=class extends Vc{constructor(e,t,r,i){super((function(r,i,n){const s=r*e,o=i*t;n.set(s,0,o)}),r,i)}};const zc=new e.Vector3;function Hc(e,t,r,i,n,s){const o=2*Math.PI*n/4,a=Math.max(s-2*n,0),l=Math.PI/4;zc.copy(t),zc[i]=0,zc.normalize();const c=.5*o/(o+a),h=1-zc.angleTo(e)/l;if(1===Math.sign(zc[r]))return h*c;return a/(o+a)+c+c*(1-h)}class jc extends e.BoxGeometry{constructor(t=1,r=1,i=1,n=2,s=.1){if(n=2*n+1,s=Math.min(t/2,r/2,i/2,s),super(1,1,1,n,n,n),1===n)return;const o=this.toNonIndexed();this.index=null,this.attributes.position=o.attributes.position,this.attributes.normal=o.attributes.normal,this.attributes.uv=o.attributes.uv;const a=new e.Vector3,l=new e.Vector3,c=new e.Vector3(t,r,i).divideScalar(2).subScalar(s),h=this.attributes.position.array,u=this.attributes.normal.array,d=this.attributes.uv.array,p=h.length/6,m=new e.Vector3,f=.5/n;for(let e=0,n=0;e<h.length;e+=3,n+=2){a.fromArray(h,e),l.copy(a),l.x-=Math.sign(l.x)*f,l.y-=Math.sign(l.y)*f,l.z-=Math.sign(l.z)*f,l.normalize(),h[e+0]=c.x*Math.sign(a.x)+l.x*s,h[e+1]=c.y*Math.sign(a.y)+l.y*s,h[e+2]=c.z*Math.sign(a.z)+l.z*s,u[e+0]=l.x,u[e+1]=l.y,u[e+2]=l.z;switch(Math.floor(e/p)){case 0:m.set(1,0,0),d[n+0]=Hc(m,l,"z","y",s,i),d[n+1]=1-Hc(m,l,"y","z",s,r);break;case 1:m.set(-1,0,0),d[n+0]=1-Hc(m,l,"z","y",s,i),d[n+1]=1-Hc(m,l,"y","z",s,r);break;case 2:m.set(0,1,0),d[n+0]=1-Hc(m,l,"x","z",s,t),d[n+1]=Hc(m,l,"z","x",s,i);break;case 3:m.set(0,-1,0),d[n+0]=1-Hc(m,l,"x","z",s,t),d[n+1]=1-Hc(m,l,"z","x",s,i);break;case 4:m.set(0,0,1),d[n+0]=1-Hc(m,l,"x","y",s,t),d[n+1]=1-Hc(m,l,"y","x",s,r);break;case 5:m.set(0,0,-1),d[n+0]=Hc(m,l,"x","y",s,t),d[n+1]=1-Hc(m,l,"y","x",s,r)}}}}class Wc extends e.BufferGeometry{constructor(t,r,i,n,s,o){super();const a=(t=t||1)/2,l=(r=r||1)/2,c=(i=i||1)/2,h=t/(n=Math.floor(n)||1),u=r/(s=Math.floor(s)||1),d=i/(o=Math.floor(o)||1),p=[];let m=-a,f=-l,g=-c;for(let e=0;e<=n;e++)p.push(m,-l,-c,m,l,-c),p.push(m,l,-c,m,l,c),p.push(m,l,c,m,-l,c),p.push(m,-l,c,m,-l,-c),m+=h;for(let e=0;e<=s;e++)p.push(-a,f,-c,a,f,-c),p.push(a,f,-c,a,f,c),p.push(a,f,c,-a,f,c),p.push(-a,f,c,-a,f,-c),f+=u;for(let e=0;e<=o;e++)p.push(-a,-l,g,-a,l,g),p.push(-a,l,g,a,l,g),p.push(a,l,g,a,-l,g),p.push(a,-l,g,-a,-l,g),g+=d;this.setAttribute("position",new e.Float32BufferAttribute(p,3))}}class Xc extends e.BufferGeometry{constructor(t,r,i,n){super();const s=[],o=[],a=[],l=new e.Vector3,c=new e.Matrix4;c.makeRotationFromEuler(i),c.setPosition(r);const h=new e.Matrix4;function u(e,r,i){r.applyMatrix4(t.matrixWorld),r.applyMatrix4(h),i.transformDirection(t.matrixWorld),e.push(new Qc(r.clone(),i.clone()))}function d(e,t){const r=[],i=.5*Math.abs(n.dot(t));for(let n=0;n<e.length;n+=3){let s,o,a,l,c,h,u,d=0;const m=e[n+0].position.dot(t)-i,f=e[n+1].position.dot(t)-i,g=e[n+2].position.dot(t)-i;switch(s=m>0,o=f>0,a=g>0,d=(s?1:0)+(o?1:0)+(a?1:0),d){case 0:r.push(e[n]),r.push(e[n+1]),r.push(e[n+2]);break;case 1:if(s&&(l=e[n+1],c=e[n+2],h=p(e[n],l,t,i),u=p(e[n],c,t,i)),o){l=e[n],c=e[n+2],h=p(e[n+1],l,t,i),u=p(e[n+1],c,t,i),r.push(h),r.push(c.clone()),r.push(l.clone()),r.push(c.clone()),r.push(h.clone()),r.push(u);break}a&&(l=e[n],c=e[n+1],h=p(e[n+2],l,t,i),u=p(e[n+2],c,t,i)),r.push(l.clone()),r.push(c.clone()),r.push(h),r.push(u),r.push(h.clone()),r.push(c.clone());break;case 2:s||(l=e[n].clone(),c=p(l,e[n+1],t,i),h=p(l,e[n+2],t,i),r.push(l),r.push(c),r.push(h)),o||(l=e[n+1].clone(),c=p(l,e[n+2],t,i),h=p(l,e[n],t,i),r.push(l),r.push(c),r.push(h)),a||(l=e[n+2].clone(),c=p(l,e[n],t,i),h=p(l,e[n+1],t,i),r.push(l),r.push(c),r.push(h))}}return r}function p(t,r,i,n){const s=t.position.dot(i)-n,o=s/(s-(r.position.dot(i)-n));return new Qc(new e.Vector3(t.position.x+o*(r.position.x-t.position.x),t.position.y+o*(r.position.y-t.position.y),t.position.z+o*(r.position.z-t.position.z)),new e.Vector3(t.normal.x+o*(r.normal.x-t.normal.x),t.normal.y+o*(r.normal.y-t.normal.y),t.normal.z+o*(r.normal.z-t.normal.z)))}h.copy(c).invert(),function(){let r,i=[];const h=new e.Vector3,p=new e.Vector3;if(!0===t.geometry.isGeometry)return void console.error("THREE.DecalGeometry no longer supports THREE.Geometry. Use BufferGeometry instead.");const m=t.geometry,f=m.attributes.position,g=m.attributes.normal;if(null!==m.index){const e=m.index;for(r=0;r<e.count;r++)h.fromBufferAttribute(f,e.getX(r)),p.fromBufferAttribute(g,e.getX(r)),u(i,h,p)}else for(r=0;r<f.count;r++)h.fromBufferAttribute(f,r),p.fromBufferAttribute(g,r),u(i,h,p);for(i=d(i,l.set(1,0,0)),i=d(i,l.set(-1,0,0)),i=d(i,l.set(0,1,0)),i=d(i,l.set(0,-1,0)),i=d(i,l.set(0,0,1)),i=d(i,l.set(0,0,-1)),r=0;r<i.length;r++){const e=i[r];a.push(.5+e.position.x/n.x,.5+e.position.y/n.y),e.position.applyMatrix4(c),s.push(e.position.x,e.position.y,e.position.z),o.push(e.normal.x,e.normal.y,e.normal.z)}}(),this.setAttribute("position",new e.Float32BufferAttribute(s,3)),this.setAttribute("normal",new e.Float32BufferAttribute(o,3)),this.setAttribute("uv",new e.Float32BufferAttribute(a,2))}}class Qc{constructor(e,t){this.position=e,this.normal=t}clone(){return new this.constructor(this.position.clone(),this.normal.clone())}}class Yc extends e.BufferGeometry{constructor(t,r,i,n,s,o,a){const l=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,3,16,17,18,7,19,20,21,11,22,23,24,15,25,26,27,18,28,29,30,21,31,32,33,24,34,35,36,27,37,38,39,30,40,41,0,33,42,43,4,36,44,45,8,39,46,47,12,12,13,14,15,48,49,50,51,52,53,54,55,56,57,58,59,15,25,26,27,51,60,61,62,55,63,64,65,59,66,67,68,27,37,38,39,62,69,70,71,65,72,73,74,68,75,76,77,39,46,47,12,71,78,79,48,74,80,81,52,77,82,83,56,56,57,58,59,84,85,86,87,88,89,90,91,92,93,94,95,59,66,67,68,87,96,97,98,91,99,100,101,95,102,103,104,68,75,76,77,98,105,106,107,101,108,109,110,104,111,112,113,77,82,83,56,107,114,115,84,110,116,117,88,113,118,119,92,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,123,136,137,120,127,138,139,124,131,140,141,128,135,142,143,132,132,133,134,135,144,145,146,147,148,149,150,151,68,152,153,154,135,142,143,132,147,155,156,144,151,157,158,148,154,159,160,68,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,164,177,178,161,168,179,180,165,172,181,182,169,176,183,184,173,173,174,175,176,185,186,187,188,189,190,191,192,193,194,195,196,176,183,184,173,188,197,198,185,192,199,200,189,196,201,202,193,203,203,203,203,204,205,206,207,208,208,208,208,209,210,211,212,203,203,203,203,207,213,214,215,208,208,208,208,212,216,217,218,203,203,203,203,215,219,220,221,208,208,208,208,218,222,223,224,203,203,203,203,221,225,226,204,208,208,208,208,224,227,228,209,209,210,211,212,229,230,231,232,233,234,235,236,237,238,239,240,212,216,217,218,232,241,242,243,236,244,245,246,240,247,248,249,218,222,223,224,243,250,251,252,246,253,254,255,249,256,257,258,224,227,228,209,252,259,260,229,255,261,262,233,258,263,264,237,265,265,265,265,266,267,268,269,270,271,272,273,92,119,118,113,265,265,265,265,269,274,275,276,273,277,278,279,113,112,111,104,265,265,265,265,276,280,281,282,279,283,284,285,104,103,102,95,265,265,265,265,282,286,287,266,285,288,289,270,95,94,93,92],c=[1.4,0,2.4,1.4,-.784,2.4,.784,-1.4,2.4,0,-1.4,2.4,1.3375,0,2.53125,1.3375,-.749,2.53125,.749,-1.3375,2.53125,0,-1.3375,2.53125,1.4375,0,2.53125,1.4375,-.805,2.53125,.805,-1.4375,2.53125,0,-1.4375,2.53125,1.5,0,2.4,1.5,-.84,2.4,.84,-1.5,2.4,0,-1.5,2.4,-.784,-1.4,2.4,-1.4,-.784,2.4,-1.4,0,2.4,-.749,-1.3375,2.53125,-1.3375,-.749,2.53125,-1.3375,0,2.53125,-.805,-1.4375,2.53125,-1.4375,-.805,2.53125,-1.4375,0,2.53125,-.84,-1.5,2.4,-1.5,-.84,2.4,-1.5,0,2.4,-1.4,.784,2.4,-.784,1.4,2.4,0,1.4,2.4,-1.3375,.749,2.53125,-.749,1.3375,2.53125,0,1.3375,2.53125,-1.4375,.805,2.53125,-.805,1.4375,2.53125,0,1.4375,2.53125,-1.5,.84,2.4,-.84,1.5,2.4,0,1.5,2.4,.784,1.4,2.4,1.4,.784,2.4,.749,1.3375,2.53125,1.3375,.749,2.53125,.805,1.4375,2.53125,1.4375,.805,2.53125,.84,1.5,2.4,1.5,.84,2.4,1.75,0,1.875,1.75,-.98,1.875,.98,-1.75,1.875,0,-1.75,1.875,2,0,1.35,2,-1.12,1.35,1.12,-2,1.35,0,-2,1.35,2,0,.9,2,-1.12,.9,1.12,-2,.9,0,-2,.9,-.98,-1.75,1.875,-1.75,-.98,1.875,-1.75,0,1.875,-1.12,-2,1.35,-2,-1.12,1.35,-2,0,1.35,-1.12,-2,.9,-2,-1.12,.9,-2,0,.9,-1.75,.98,1.875,-.98,1.75,1.875,0,1.75,1.875,-2,1.12,1.35,-1.12,2,1.35,0,2,1.35,-2,1.12,.9,-1.12,2,.9,0,2,.9,.98,1.75,1.875,1.75,.98,1.875,1.12,2,1.35,2,1.12,1.35,1.12,2,.9,2,1.12,.9,2,0,.45,2,-1.12,.45,1.12,-2,.45,0,-2,.45,1.5,0,.225,1.5,-.84,.225,.84,-1.5,.225,0,-1.5,.225,1.5,0,.15,1.5,-.84,.15,.84,-1.5,.15,0,-1.5,.15,-1.12,-2,.45,-2,-1.12,.45,-2,0,.45,-.84,-1.5,.225,-1.5,-.84,.225,-1.5,0,.225,-.84,-1.5,.15,-1.5,-.84,.15,-1.5,0,.15,-2,1.12,.45,-1.12,2,.45,0,2,.45,-1.5,.84,.225,-.84,1.5,.225,0,1.5,.225,-1.5,.84,.15,-.84,1.5,.15,0,1.5,.15,1.12,2,.45,2,1.12,.45,.84,1.5,.225,1.5,.84,.225,.84,1.5,.15,1.5,.84,.15,-1.6,0,2.025,-1.6,-.3,2.025,-1.5,-.3,2.25,-1.5,0,2.25,-2.3,0,2.025,-2.3,-.3,2.025,-2.5,-.3,2.25,-2.5,0,2.25,-2.7,0,2.025,-2.7,-.3,2.025,-3,-.3,2.25,-3,0,2.25,-2.7,0,1.8,-2.7,-.3,1.8,-3,-.3,1.8,-3,0,1.8,-1.5,.3,2.25,-1.6,.3,2.025,-2.5,.3,2.25,-2.3,.3,2.025,-3,.3,2.25,-2.7,.3,2.025,-3,.3,1.8,-2.7,.3,1.8,-2.7,0,1.575,-2.7,-.3,1.575,-3,-.3,1.35,-3,0,1.35,-2.5,0,1.125,-2.5,-.3,1.125,-2.65,-.3,.9375,-2.65,0,.9375,-2,-.3,.9,-1.9,-.3,.6,-1.9,0,.6,-3,.3,1.35,-2.7,.3,1.575,-2.65,.3,.9375,-2.5,.3,1.125,-1.9,.3,.6,-2,.3,.9,1.7,0,1.425,1.7,-.66,1.425,1.7,-.66,.6,1.7,0,.6,2.6,0,1.425,2.6,-.66,1.425,3.1,-.66,.825,3.1,0,.825,2.3,0,2.1,2.3,-.25,2.1,2.4,-.25,2.025,2.4,0,2.025,2.7,0,2.4,2.7,-.25,2.4,3.3,-.25,2.4,3.3,0,2.4,1.7,.66,.6,1.7,.66,1.425,3.1,.66,.825,2.6,.66,1.425,2.4,.25,2.025,2.3,.25,2.1,3.3,.25,2.4,2.7,.25,2.4,2.8,0,2.475,2.8,-.25,2.475,3.525,-.25,2.49375,3.525,0,2.49375,2.9,0,2.475,2.9,-.15,2.475,3.45,-.15,2.5125,3.45,0,2.5125,2.8,0,2.4,2.8,-.15,2.4,3.2,-.15,2.4,3.2,0,2.4,3.525,.25,2.49375,2.8,.25,2.475,3.45,.15,2.5125,2.9,.15,2.475,3.2,.15,2.4,2.8,.15,2.4,0,0,3.15,.8,0,3.15,.8,-.45,3.15,.45,-.8,3.15,0,-.8,3.15,0,0,2.85,.2,0,2.7,.2,-.112,2.7,.112,-.2,2.7,0,-.2,2.7,-.45,-.8,3.15,-.8,-.45,3.15,-.8,0,3.15,-.112,-.2,2.7,-.2,-.112,2.7,-.2,0,2.7,-.8,.45,3.15,-.45,.8,3.15,0,.8,3.15,-.2,.112,2.7,-.112,.2,2.7,0,.2,2.7,.45,.8,3.15,.8,.45,3.15,.112,.2,2.7,.2,.112,2.7,.4,0,2.55,.4,-.224,2.55,.224,-.4,2.55,0,-.4,2.55,1.3,0,2.55,1.3,-.728,2.55,.728,-1.3,2.55,0,-1.3,2.55,1.3,0,2.4,1.3,-.728,2.4,.728,-1.3,2.4,0,-1.3,2.4,-.224,-.4,2.55,-.4,-.224,2.55,-.4,0,2.55,-.728,-1.3,2.55,-1.3,-.728,2.55,-1.3,0,2.55,-.728,-1.3,2.4,-1.3,-.728,2.4,-1.3,0,2.4,-.4,.224,2.55,-.224,.4,2.55,0,.4,2.55,-1.3,.728,2.55,-.728,1.3,2.55,0,1.3,2.55,-1.3,.728,2.4,-.728,1.3,2.4,0,1.3,2.4,.224,.4,2.55,.4,.224,2.55,.728,1.3,2.55,1.3,.728,2.55,.728,1.3,2.4,1.3,.728,2.4,0,0,0,1.425,0,0,1.425,.798,0,.798,1.425,0,0,1.425,0,1.5,0,.075,1.5,.84,.075,.84,1.5,.075,0,1.5,.075,-.798,1.425,0,-1.425,.798,0,-1.425,0,0,-.84,1.5,.075,-1.5,.84,.075,-1.5,0,.075,-1.425,-.798,0,-.798,-1.425,0,0,-1.425,0,-1.5,-.84,.075,-.84,-1.5,.075,0,-1.5,.075,.798,-1.425,0,1.425,-.798,0,.84,-1.5,.075,1.5,-.84,.075];super(),t=t||50,r=void 0!==r?Math.max(2,Math.floor(r)||10):10,o=void 0===o||o;const h=3.15*((a=void 0===a||a)?1:1.3)/2,u=t/h;let d=(i=void 0===i||i)?(8*r-4)*r:0;d+=(n=void 0===n||n)?(16*r-4)*r:0,d+=(s=void 0===s||s)?40*r*r:0;const p=new Uint32Array(3*d);let m=i?4:0;m+=n?8:0,m+=s?20:0,m*=(r+1)*(r+1);const f=new Float32Array(3*m),g=new Float32Array(3*m),v=new Float32Array(2*m),x=new e.Matrix4;x.set(-1,3,-3,1,3,-6,3,0,-3,3,0,0,1,0,0,0);const y=[];let b,A,w;const M=[],T=[],S=[],C=[],F=[],E=[],_=[],P=[],B=new e.Vector3;let L,R,N,D,I,U,O,k,V,G=0,z=0;const H=new e.Vector3;let j,W,X,Q;const Y=new e.Matrix4,K=new e.Matrix4,q=new e.Vector4,J=new e.Vector4,Z=new e.Vector4,$=new e.Vector4,ee=new e.Vector3,te=new e.Vector3,re=x.clone();re.transpose();const ie=(e,t,r)=>!(f[3*e]===f[3*t]&&f[3*e+1]===f[3*t+1]&&f[3*e+2]===f[3*t+2]||f[3*e]===f[3*r]&&f[3*e+1]===f[3*r+1]&&f[3*e+2]===f[3*r+2]||f[3*t]===f[3*r]&&f[3*t+1]===f[3*r+1]&&f[3*t+2]===f[3*r+2]);for(b=0;b<3;b++)F[b]=new e.Matrix4;const ne=i?32:28;D=r+1;let se=0,oe=0,ae=0,le=0,ce=0;for(let e=s?0:20;e<ne;e++)if(n||e<20||e>=28){for(b=0;b<3;b++){for(A=0;A<4;A++)for(w=0;w<4;w++)y[4*w+A]=c[3*l[16*e+4*A+w]+b],o&&e>=20&&e<28&&2!==b&&(y[4*w+A]*=1.077),a||2!==b||(y[4*w+A]*=1.3);Y.set(y[0],y[1],y[2],y[3],y[4],y[5],y[6],y[7],y[8],y[9],y[10],y[11],y[12],y[13],y[14],y[15]),K.multiplyMatrices(Y,x),F[b].multiplyMatrices(re,K)}for(R=0;R<=r;R++)for(I=R/r,N=0;N<=r;N++){for(U=N/r,V=4,O=k=1;V--;)M[V]=O,T[V]=k,O*=I,k*=U,3===V?(S[V]=C[V]=0,G=z=1):(S[V]=G*(3-V),C[V]=z*(3-V),G*=I,z*=U);for(q.fromArray(M),J.fromArray(T),Z.fromArray(S),$.fromArray(C),b=0;b<3;b++)L=q.clone(),L.applyMatrix4(F[b]),E[b]=L.dot(J),L=Z.clone(),L.applyMatrix4(F[b]),_[b]=L.dot(J),L=q.clone(),L.applyMatrix4(F[b]),P[b]=L.dot($);ee.fromArray(_),te.fromArray(P),B.crossVectors(te,ee),B.normalize(),0===E[0]&&0===E[1]?H.set(0,E[2]>h?1:-1,0):H.set(B.x,B.z,-B.y),f[oe++]=u*E[0],f[oe++]=u*(E[2]-h),f[oe++]=-u*E[1],g[ae++]=H.x,g[ae++]=H.y,g[ae++]=H.z,v[le++]=1-U,v[le++]=1-I}for(R=0;R<r;R++)for(N=0;N<r;N++)j=se*D*D+R*D+N,W=j+1,X=W+D,Q=j+D,ie(j,W,X)&&(p[ce++]=j,p[ce++]=W,p[ce++]=X),ie(j,X,Q)&&(p[ce++]=j,p[ce++]=X,p[ce++]=Q);se++}this.setIndex(new e.BufferAttribute(p,1)),this.setAttribute("position",new e.BufferAttribute(f,3)),this.setAttribute("normal",new e.BufferAttribute(g,3)),this.setAttribute("uv",new e.BufferAttribute(v,2)),this.computeBoundingSphere()}}class Kc extends e.ExtrudeGeometry{constructor(e,t={}){const{bevelEnabled:r=!1,bevelSize:i=8,bevelThickness:n=10,font:s,height:o=50,size:a=100,lineHeight:l=1,letterSpacing:c=0,...h}=t;if(void 0===s)super();else{super(s.generateShapes(e,a,{lineHeight:l,letterSpacing:c}),{...h,bevelEnabled:r,bevelSize:i,bevelThickness:n,depth:o})}this.type="TextGeometry"}}const qc=new e.Matrix4;class Jc{constructor(t){t=t||{},this.vertices={near:[new e.Vector3,new e.Vector3,new e.Vector3,new e.Vector3],far:[new e.Vector3,new e.Vector3,new e.Vector3,new e.Vector3]},void 0!==t.projectionMatrix&&this.setFromProjectionMatrix(t.projectionMatrix,t.maxFar||1e4)}setFromProjectionMatrix(e,t){const r=0===e.elements[11];return qc.copy(e).invert(),this.vertices.near[0].set(1,1,-1),this.vertices.near[1].set(1,-1,-1),this.vertices.near[2].set(-1,-1,-1),this.vertices.near[3].set(-1,1,-1),this.vertices.near.forEach((function(e){e.applyMatrix4(qc)})),this.vertices.far[0].set(1,1,1),this.vertices.far[1].set(1,-1,1),this.vertices.far[2].set(-1,-1,1),this.vertices.far[3].set(-1,1,1),this.vertices.far.forEach((function(e){e.applyMatrix4(qc);const i=Math.abs(e.z);r?e.z*=Math.min(t/i,1):e.multiplyScalar(Math.min(t/i,1))})),this.vertices}split(e,t){for(;e.length>t.length;)t.push(new Jc);t.length=e.length;for(let r=0;r<e.length;r++){const i=t[r];if(0===r)for(let e=0;e<4;e++)i.vertices.near[e].copy(this.vertices.near[e]);else for(let t=0;t<4;t++)i.vertices.near[t].lerpVectors(this.vertices.near[t],this.vertices.far[t],e[r-1]);if(r===e.length-1)for(let e=0;e<4;e++)i.vertices.far[e].copy(this.vertices.far[e]);else for(let t=0;t<4;t++)i.vertices.far[t].lerpVectors(this.vertices.near[t],this.vertices.far[t],e[r])}}toSpace(e,t){for(let r=0;r<4;r++)t.vertices.near[r].copy(this.vertices.near[r]).applyMatrix4(e),t.vertices.far[r].copy(this.vertices.far[r]).applyMatrix4(e)}}const Zc={lights_fragment_begin:"\nGeometricContext geometry;\n\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n\n#ifdef CLEARCOAT\n\n\tgeometry.clearcoatNormal = clearcoatNormal;\n\n#endif\n\nIncidentLight directLight;\n\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\n\t\tpointLight = pointLights[ i ];\n\n\t\tgetPointLightInfo( pointLight, geometry, directLight );\n\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\n\tSpotLight spotLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\n\t\tspotLight = spotLights[ i ];\n\n\t\tgetSpotLightInfo( spotLight, geometry, directLight );\n\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if ( NUM_DIR_LIGHTS > 0) && defined( RE_Direct ) && defined( USE_CSM ) && defined( CSM_CASCADES )\n\n\tDirectionalLight directionalLight;\n\tfloat linearDepth = (vViewPosition.z) / (shadowFar - cameraNear);\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\n\t#if defined( USE_SHADOWMAP ) && defined( CSM_FADE )\n\tvec2 cascade;\n\tfloat cascadeCenter;\n\tfloat closestEdge;\n\tfloat margin;\n\tfloat csmx;\n\tfloat csmy;\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\n\n\t \t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\t\t// NOTE: Depth gets larger away from the camera.\n\t\t\t// cascade.x is closer, cascade.y is further\n\t\t\tcascade = CSM_cascades[ i ];\n\t\t\tcascadeCenter = ( cascade.x + cascade.y ) / 2.0;\n\t\t\tclosestEdge = linearDepth < cascadeCenter ? cascade.x : cascade.y;\n\t\t\tmargin = 0.25 * pow( closestEdge, 2.0 );\n\t\t\tcsmx = cascade.x - margin / 2.0;\n\t\t\tcsmy = cascade.y + margin / 2.0;\n\t\t\tif( linearDepth >= csmx && ( linearDepth < csmy || UNROLLED_LOOP_INDEX == CSM_CASCADES - 1 ) ) {\n\n\t\t\t\tfloat dist = min( linearDepth - csmx, csmy - linearDepth );\n\t\t\t\tfloat ratio = clamp( dist / margin, 0.0, 1.0 );\n\n\t\t\t\tvec3 prevColor = directLight.color;\n\t\t\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\t\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\n\t\t\t\tbool shouldFadeLastCascade = UNROLLED_LOOP_INDEX == CSM_CASCADES - 1 && linearDepth > cascadeCenter;\n\t\t\t\tdirectLight.color = mix( prevColor, directLight.color, shouldFadeLastCascade ? ratio : 1.0 );\n\n\t\t\t\tReflectedLight prevLight = reflectedLight;\n\t\t\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\n\t\t\t\tbool shouldBlend = UNROLLED_LOOP_INDEX != CSM_CASCADES - 1 || UNROLLED_LOOP_INDEX == CSM_CASCADES - 1 && linearDepth < cascadeCenter;\n\t\t\t\tfloat blendRatio = shouldBlend ? ratio : 1.0;\n\n\t\t\t\treflectedLight.directDiffuse = mix( prevLight.directDiffuse, reflectedLight.directDiffuse, blendRatio );\n\t\t\t\treflectedLight.directSpecular = mix( prevLight.directSpecular, reflectedLight.directSpecular, blendRatio );\n\t\t\t\treflectedLight.indirectDiffuse = mix( prevLight.indirectDiffuse, reflectedLight.indirectDiffuse, blendRatio );\n\t\t\t\treflectedLight.indirectSpecular = mix( prevLight.indirectSpecular, reflectedLight.indirectSpecular, blendRatio );\n\n\t\t\t}\n\t \t#endif\n\n\t}\n\t#pragma unroll_loop_end\n\t#else\n\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\n\t\t\tdirectionalLight = directionalLights[ i ];\n\t\t\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\n\n\t\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\n\t\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\t\tif(linearDepth >= CSM_cascades[UNROLLED_LOOP_INDEX].x && linearDepth < CSM_cascades[UNROLLED_LOOP_INDEX].y) directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\n\t\t\tif(linearDepth >= CSM_cascades[UNROLLED_LOOP_INDEX].x && (linearDepth < CSM_cascades[UNROLLED_LOOP_INDEX].y || UNROLLED_LOOP_INDEX == CSM_CASCADES - 1)) RE_Direct( directLight, geometry, material, reflectedLight );\n\n\t\t\t#endif\n\n\t\t}\n\t\t#pragma unroll_loop_end\n\n\t#endif\n\n\t#if ( NUM_DIR_LIGHTS > NUM_DIR_LIGHT_SHADOWS)\n\t\t// compute the lights not casting shadows (if any)\n\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = NUM_DIR_LIGHT_SHADOWS; i < NUM_DIR_LIGHTS; i ++ ) {\n\n\t\t\tdirectionalLight = directionalLights[ i ];\n\n\t\t\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\n\n\t\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\n\t\t}\n\t\t#pragma unroll_loop_end\n\n\t#endif\n\n#endif\n\n\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) && !defined( USE_CSM ) && !defined( CSM_CASCADES )\n\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\n\t\tdirectionalLight = directionalLights[ i ];\n\n\t\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\n\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\n\tRectAreaLight rectAreaLight;\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if defined( RE_IndirectDiffuse )\n\n\tvec3 iblIrradiance = vec3( 0.0 );\n\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\n\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\n\t\t}\n\t\t#pragma unroll_loop_end\n\n\t#endif\n\n#endif\n\n#if defined( RE_IndirectSpecular )\n\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n\n#endif\n",lights_pars_begin:"\n#if defined( USE_CSM ) && defined( CSM_CASCADES )\nuniform vec2 CSM_cascades[CSM_CASCADES];\nuniform float cameraNear;\nuniform float shadowFar;\n#endif\n\t"+e.ShaderChunk.lights_pars_begin},$c=new e.Matrix4,eh=new Jc,th=new e.Vector3,rh=new e.Box3,ih=[],nh=[];class sh extends e.Group{constructor(t){super(),this.csm=t,this.displayFrustum=!0,this.displayPlanes=!0,this.displayShadowBounds=!0;const r=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(24),n=new e.BufferGeometry;n.setIndex(new e.BufferAttribute(r,1)),n.setAttribute("position",new e.BufferAttribute(i,3,!1));const s=new e.LineSegments(n,new e.LineBasicMaterial);this.add(s),this.frustumLines=s,this.cascadeLines=[],this.cascadePlanes=[],this.shadowLines=[]}updateVisibility(){const e=this.displayFrustum,t=this.displayPlanes,r=this.displayShadowBounds,i=this.frustumLines,n=this.cascadeLines,s=this.cascadePlanes,o=this.shadowLines;for(let i=0,a=n.length;i<a;i++){const a=n[i],l=s[i],c=o[i];a.visible=e,l.visible=e&&t,c.visible=r}i.visible=e}update(){const t=this.csm,r=t.camera,i=t.cascades,n=t.mainFrustum,s=t.frustums,o=t.lights,a=this.frustumLines.geometry.getAttribute("position"),l=this.cascadeLines,c=this.cascadePlanes,h=this.shadowLines;for(this.position.copy(r.position),this.quaternion.copy(r.quaternion),this.scale.copy(r.scale),this.updateMatrixWorld(!0);l.length>i;)this.remove(l.pop()),this.remove(c.pop()),this.remove(h.pop());for(;l.length<i;){const t=new e.Box3Helper(new e.Box3,16777215),r=new e.MeshBasicMaterial({transparent:!0,opacity:.1,depthWrite:!1,side:e.DoubleSide}),i=new e.Mesh(new e.PlaneGeometry,r),n=new e.Group,s=new e.Box3Helper(new e.Box3,16776960);n.add(s),this.add(t),this.add(i),this.add(n),l.push(t),c.push(i),h.push(n)}for(let e=0;e<i;e++){const t=s[e],r=o[e].shadow.camera,i=t.vertices.far,n=l[e],a=c[e],u=h[e],d=u.children[0];n.box.min.copy(i[2]),n.box.max.copy(i[0]),n.box.max.z+=1e-4,a.position.addVectors(i[0],i[2]),a.position.multiplyScalar(.5),a.scale.subVectors(i[0],i[2]),a.scale.z=1e-4,this.remove(u),u.position.copy(r.position),u.quaternion.copy(r.quaternion),u.scale.copy(r.scale),u.updateMatrixWorld(!0),this.attach(u),d.box.min.set(r.bottom,r.left,-r.far),d.box.max.set(r.top,r.right,-r.near)}const u=n.vertices.near,d=n.vertices.far;a.setXYZ(0,d[0].x,d[0].y,d[0].z),a.setXYZ(1,d[3].x,d[3].y,d[3].z),a.setXYZ(2,d[2].x,d[2].y,d[2].z),a.setXYZ(3,d[1].x,d[1].y,d[1].z),a.setXYZ(4,u[0].x,u[0].y,u[0].z),a.setXYZ(5,u[3].x,u[3].y,u[3].z),a.setXYZ(6,u[2].x,u[2].y,u[2].z),a.setXYZ(7,u[1].x,u[1].y,u[1].z),a.needsUpdate=!0}}const oh={uniforms:{tDiffuse:{value:null},exposure:{value:1}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["#define saturate(a) clamp( a, 0.0, 1.0 )","uniform sampler2D tDiffuse;","uniform float exposure;","varying vec2 vUv;","vec3 RRTAndODTFit( vec3 v ) {","\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;","\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;","\treturn a / b;","}","vec3 ACESFilmicToneMapping( vec3 color ) {","\tconst mat3 ACESInputMat = mat3(","\t\tvec3( 0.59719, 0.07600, 0.02840 ),","\t\tvec3( 0.35458, 0.90834, 0.13383 ),","\t\tvec3( 0.04823, 0.01566, 0.83777 )","\t);","\tconst mat3 ACESOutputMat = mat3(","\t\tvec3( 1.60475, -0.10208, -0.00327 ),","\t\tvec3( -0.53108, 1.10813, -0.07276 ),","\t\tvec3( -0.07367, -0.00605, 1.07602 )","\t);","\tcolor = ACESInputMat * color;","\tcolor = RRTAndODTFit( color );","\tcolor = ACESOutputMat * color;","\treturn saturate( color );","}","void main() {","\tvec4 tex = texture2D( tDiffuse, vUv );","\ttex.rgb *= exposure / 0.6;","\tgl_FragColor = vec4( ACESFilmicToneMapping( tex.rgb ), tex.a );","}"].join("\n")},ah={uniforms:{},vertexShader:["void main() {","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["void main() {","\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );","}"].join("\n")},lh={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform float opacity;","uniform sampler2D tDiffuse;","varying vec2 vUv;","void main() {","\tvec4 base = texture2D( tDiffuse, vUv );","\tvec3 lumCoeff = vec3( 0.25, 0.65, 0.1 );","\tfloat lum = dot( lumCoeff, base.rgb );","\tvec3 blend = vec3( lum );","\tfloat L = min( 1.0, max( 0.0, 10.0 * ( lum - 0.45 ) ) );","\tvec3 result1 = 2.0 * base.rgb * blend;","\tvec3 result2 = 1.0 - 2.0 * ( 1.0 - blend ) * ( 1.0 - base.rgb );","\tvec3 newColor = mix( result1, result2, L );","\tfloat A2 = opacity * base.a;","\tvec3 mixRGB = A2 * newColor.rgb;","\tmixRGB += ( ( 1.0 - A2 ) * base.rgb );","\tgl_FragColor = vec4( mixRGB, base.a );","}"].join("\n")},ch={uniforms:{tDiffuse1:{value:null},tDiffuse2:{value:null},mixRatio:{value:.5},opacity:{value:1}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform float opacity;","uniform float mixRatio;","uniform sampler2D tDiffuse1;","uniform sampler2D tDiffuse2;","varying vec2 vUv;","void main() {","\tvec4 texel1 = texture2D( tDiffuse1, vUv );","\tvec4 texel2 = texture2D( tDiffuse2, vUv );","\tgl_FragColor = opacity * mix( texel1, texel2, mixRatio );","}"].join("\n")},hh={uniforms:{tDiffuse:{value:null},brightness:{value:0},contrast:{value:0}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","uniform float brightness;","uniform float contrast;","varying vec2 vUv;","void main() {","\tgl_FragColor = texture2D( tDiffuse, vUv );","\tgl_FragColor.rgb += brightness;","\tif (contrast > 0.0) {","\t\tgl_FragColor.rgb = (gl_FragColor.rgb - 0.5) / (1.0 - contrast) + 0.5;","\t} else {","\t\tgl_FragColor.rgb = (gl_FragColor.rgb - 0.5) * (1.0 + contrast) + 0.5;","\t}","}"].join("\n")},uh={uniforms:{tDiffuse:{value:null},powRGB:{value:new e.Vector3(2,2,2)},mulRGB:{value:new e.Vector3(1,1,1)},addRGB:{value:new e.Vector3(0,0,0)}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","uniform vec3 powRGB;","uniform vec3 mulRGB;","uniform vec3 addRGB;","varying vec2 vUv;","void main() {","\tgl_FragColor = texture2D( tDiffuse, vUv );","\tgl_FragColor.rgb = mulRGB * pow( ( gl_FragColor.rgb + addRGB ), powRGB );","}"].join("\n")},dh={uniforms:{tDiffuse:{value:null},color:{value:new e.Color(16777215)}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform vec3 color;","uniform sampler2D tDiffuse;","varying vec2 vUv;","void main() {","\tvec4 texel = texture2D( tDiffuse, vUv );","\tvec3 luma = vec3( 0.299, 0.587, 0.114 );","\tfloat v = dot( texel.xyz, luma );","\tgl_FragColor = vec4( v * color, texel.w );","}"].join("\n")},ph={uniforms:{tColor:{value:null},tDepth:{value:null},focus:{value:1},maxblur:{value:1}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform float focus;","uniform float maxblur;","uniform sampler2D tColor;","uniform sampler2D tDepth;","varying vec2 vUv;","void main() {","\tvec4 depth = texture2D( tDepth, vUv );","\tfloat factor = depth.x - focus;","\tvec4 col = texture2D( tColor, vUv, 2.0 * maxblur * abs( focus - depth.x ) );","\tgl_FragColor = col;","\tgl_FragColor.a = 1.0;","}"].join("\n")},mh={uniforms:{tDiffuse:{value:null},resolution:{value:new e.Vector2(1/1024,1/512)}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["precision highp float;","","uniform sampler2D tDiffuse;","","uniform vec2 resolution;","","varying vec2 vUv;","","// FXAA 3.11 implementation by NVIDIA, ported to WebGL by Agost Biro (biro@archilogic.com)","","//----------------------------------------------------------------------------------","// File: es3-keplerFXAAassetsshaders/FXAA_DefaultES.frag","// SDK Version: v3.00","// Email: gameworks@nvidia.com","// Site: http://developer.nvidia.com/","//","// Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.","//","// Redistribution and use in source and binary forms, with or without","// modification, are permitted provided that the following conditions","// are met:","// * Redistributions of source code must retain the above copyright","// notice, this list of conditions and the following disclaimer.","// * Redistributions in binary form must reproduce the above copyright","// notice, this list of conditions and the following disclaimer in the","// documentation and/or other materials provided with the distribution.","// * Neither the name of NVIDIA CORPORATION nor the names of its","// contributors may be used to endorse or promote products derived","// from this software without specific prior written permission.","//","// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY","// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE","// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR","// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR","// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,","// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,","// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR","// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY","// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT","// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE","// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.","//","//----------------------------------------------------------------------------------","","#define FXAA_PC 1","#define FXAA_GLSL_100 1","#define FXAA_QUALITY_PRESET 12","","#define FXAA_GREEN_AS_LUMA 1","","/*--------------------------------------------------------------------------*/","#ifndef FXAA_PC_CONSOLE"," //"," // The console algorithm for PC is included"," // for developers targeting really low spec machines."," // Likely better to just run FXAA_PC, and use a really low preset."," //"," #define FXAA_PC_CONSOLE 0","#endif","/*--------------------------------------------------------------------------*/","#ifndef FXAA_GLSL_120"," #define FXAA_GLSL_120 0","#endif","/*--------------------------------------------------------------------------*/","#ifndef FXAA_GLSL_130"," #define FXAA_GLSL_130 0","#endif","/*--------------------------------------------------------------------------*/","#ifndef FXAA_HLSL_3"," #define FXAA_HLSL_3 0","#endif","/*--------------------------------------------------------------------------*/","#ifndef FXAA_HLSL_4"," #define FXAA_HLSL_4 0","#endif","/*--------------------------------------------------------------------------*/","#ifndef FXAA_HLSL_5"," #define FXAA_HLSL_5 0","#endif","/*==========================================================================*/","#ifndef FXAA_GREEN_AS_LUMA"," //"," // For those using non-linear color,"," // and either not able to get luma in alpha, or not wanting to,"," // this enables FXAA to run using green as a proxy for luma."," // So with this enabled, no need to pack luma in alpha."," //"," // This will turn off AA on anything which lacks some amount of green."," // Pure red and blue or combination of only R and B, will get no AA."," //"," // Might want to lower the settings for both,"," // fxaaConsoleEdgeThresholdMin"," // fxaaQualityEdgeThresholdMin"," // In order to insure AA does not get turned off on colors"," // which contain a minor amount of green."," //"," // 1 = On."," // 0 = Off."," //"," #define FXAA_GREEN_AS_LUMA 0","#endif","/*--------------------------------------------------------------------------*/","#ifndef FXAA_EARLY_EXIT"," //"," // Controls algorithm's early exit path."," // On PS3 turning this ON adds 2 cycles to the shader."," // On 360 turning this OFF adds 10ths of a millisecond to the shader."," // Turning this off on console will result in a more blurry image."," // So this defaults to on."," //"," // 1 = On."," // 0 = Off."," //"," #define FXAA_EARLY_EXIT 1","#endif","/*--------------------------------------------------------------------------*/","#ifndef FXAA_DISCARD"," //"," // Only valid for PC OpenGL currently."," // Probably will not work when FXAA_GREEN_AS_LUMA = 1."," //"," // 1 = Use discard on pixels which don't need AA."," // For APIs which enable concurrent TEX+ROP from same surface."," // 0 = Return unchanged color on pixels which don't need AA."," //"," #define FXAA_DISCARD 0","#endif","/*--------------------------------------------------------------------------*/","#ifndef FXAA_FAST_PIXEL_OFFSET"," //"," // Used for GLSL 120 only."," //"," // 1 = GL API supports fast pixel offsets"," // 0 = do not use fast pixel offsets"," //"," #ifdef GL_EXT_gpu_shader4"," #define FXAA_FAST_PIXEL_OFFSET 1"," #endif"," #ifdef GL_NV_gpu_shader5"," #define FXAA_FAST_PIXEL_OFFSET 1"," #endif"," #ifdef GL_ARB_gpu_shader5"," #define FXAA_FAST_PIXEL_OFFSET 1"," #endif"," #ifndef FXAA_FAST_PIXEL_OFFSET"," #define FXAA_FAST_PIXEL_OFFSET 0"," #endif","#endif","/*--------------------------------------------------------------------------*/","#ifndef FXAA_GATHER4_ALPHA"," //"," // 1 = API supports gather4 on alpha channel."," // 0 = API does not support gather4 on alpha channel."," //"," #if (FXAA_HLSL_5 == 1)"," #define FXAA_GATHER4_ALPHA 1"," #endif"," #ifdef GL_ARB_gpu_shader5"," #define FXAA_GATHER4_ALPHA 1"," #endif"," #ifdef GL_NV_gpu_shader5"," #define FXAA_GATHER4_ALPHA 1"," #endif"," #ifndef FXAA_GATHER4_ALPHA"," #define FXAA_GATHER4_ALPHA 0"," #endif","#endif","","","/*============================================================================"," FXAA QUALITY - TUNING KNOBS","------------------------------------------------------------------------------","NOTE the other tuning knobs are now in the shader function inputs!","============================================================================*/","#ifndef FXAA_QUALITY_PRESET"," //"," // Choose the quality preset."," // This needs to be compiled into the shader as it effects code."," // Best option to include multiple presets is to"," // in each shader define the preset, then include this file."," //"," // OPTIONS"," // -----------------------------------------------------------------------"," // 10 to 15 - default medium dither (10=fastest, 15=highest quality)"," // 20 to 29 - less dither, more expensive (20=fastest, 29=highest quality)"," // 39 - no dither, very expensive"," //"," // NOTES"," // -----------------------------------------------------------------------"," // 12 = slightly faster then FXAA 3.9 and higher edge quality (default)"," // 13 = about same speed as FXAA 3.9 and better than 12"," // 23 = closest to FXAA 3.9 visually and performance wise"," // _ = the lowest digit is directly related to performance"," // _ = the highest digit is directly related to style"," //"," #define FXAA_QUALITY_PRESET 12","#endif","","","/*============================================================================",""," FXAA QUALITY - PRESETS","","============================================================================*/","","/*============================================================================"," FXAA QUALITY - MEDIUM DITHER PRESETS","============================================================================*/","#if (FXAA_QUALITY_PRESET == 10)"," #define FXAA_QUALITY_PS 3"," #define FXAA_QUALITY_P0 1.5"," #define FXAA_QUALITY_P1 3.0"," #define FXAA_QUALITY_P2 12.0","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_QUALITY_PRESET == 11)"," #define FXAA_QUALITY_PS 4"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.5"," #define FXAA_QUALITY_P2 3.0"," #define FXAA_QUALITY_P3 12.0","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_QUALITY_PRESET == 12)"," #define FXAA_QUALITY_PS 5"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.5"," #define FXAA_QUALITY_P2 2.0"," #define FXAA_QUALITY_P3 4.0"," #define FXAA_QUALITY_P4 12.0","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_QUALITY_PRESET == 13)"," #define FXAA_QUALITY_PS 6"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.5"," #define FXAA_QUALITY_P2 2.0"," #define FXAA_QUALITY_P3 2.0"," #define FXAA_QUALITY_P4 4.0"," #define FXAA_QUALITY_P5 12.0","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_QUALITY_PRESET == 14)"," #define FXAA_QUALITY_PS 7"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.5"," #define FXAA_QUALITY_P2 2.0"," #define FXAA_QUALITY_P3 2.0"," #define FXAA_QUALITY_P4 2.0"," #define FXAA_QUALITY_P5 4.0"," #define FXAA_QUALITY_P6 12.0","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_QUALITY_PRESET == 15)"," #define FXAA_QUALITY_PS 8"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.5"," #define FXAA_QUALITY_P2 2.0"," #define FXAA_QUALITY_P3 2.0"," #define FXAA_QUALITY_P4 2.0"," #define FXAA_QUALITY_P5 2.0"," #define FXAA_QUALITY_P6 4.0"," #define FXAA_QUALITY_P7 12.0","#endif","","/*============================================================================"," FXAA QUALITY - LOW DITHER PRESETS","============================================================================*/","#if (FXAA_QUALITY_PRESET == 20)"," #define FXAA_QUALITY_PS 3"," #define FXAA_QUALITY_P0 1.5"," #define FXAA_QUALITY_P1 2.0"," #define FXAA_QUALITY_P2 8.0","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_QUALITY_PRESET == 21)"," #define FXAA_QUALITY_PS 4"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.5"," #define FXAA_QUALITY_P2 2.0"," #define FXAA_QUALITY_P3 8.0","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_QUALITY_PRESET == 22)"," #define FXAA_QUALITY_PS 5"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.5"," #define FXAA_QUALITY_P2 2.0"," #define FXAA_QUALITY_P3 2.0"," #define FXAA_QUALITY_P4 8.0","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_QUALITY_PRESET == 23)"," #define FXAA_QUALITY_PS 6"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.5"," #define FXAA_QUALITY_P2 2.0"," #define FXAA_QUALITY_P3 2.0"," #define FXAA_QUALITY_P4 2.0"," #define FXAA_QUALITY_P5 8.0","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_QUALITY_PRESET == 24)"," #define FXAA_QUALITY_PS 7"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.5"," #define FXAA_QUALITY_P2 2.0"," #define FXAA_QUALITY_P3 2.0"," #define FXAA_QUALITY_P4 2.0"," #define FXAA_QUALITY_P5 3.0"," #define FXAA_QUALITY_P6 8.0","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_QUALITY_PRESET == 25)"," #define FXAA_QUALITY_PS 8"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.5"," #define FXAA_QUALITY_P2 2.0"," #define FXAA_QUALITY_P3 2.0"," #define FXAA_QUALITY_P4 2.0"," #define FXAA_QUALITY_P5 2.0"," #define FXAA_QUALITY_P6 4.0"," #define FXAA_QUALITY_P7 8.0","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_QUALITY_PRESET == 26)"," #define FXAA_QUALITY_PS 9"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.5"," #define FXAA_QUALITY_P2 2.0"," #define FXAA_QUALITY_P3 2.0"," #define FXAA_QUALITY_P4 2.0"," #define FXAA_QUALITY_P5 2.0"," #define FXAA_QUALITY_P6 2.0"," #define FXAA_QUALITY_P7 4.0"," #define FXAA_QUALITY_P8 8.0","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_QUALITY_PRESET == 27)"," #define FXAA_QUALITY_PS 10"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.5"," #define FXAA_QUALITY_P2 2.0"," #define FXAA_QUALITY_P3 2.0"," #define FXAA_QUALITY_P4 2.0"," #define FXAA_QUALITY_P5 2.0"," #define FXAA_QUALITY_P6 2.0"," #define FXAA_QUALITY_P7 2.0"," #define FXAA_QUALITY_P8 4.0"," #define FXAA_QUALITY_P9 8.0","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_QUALITY_PRESET == 28)"," #define FXAA_QUALITY_PS 11"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.5"," #define FXAA_QUALITY_P2 2.0"," #define FXAA_QUALITY_P3 2.0"," #define FXAA_QUALITY_P4 2.0"," #define FXAA_QUALITY_P5 2.0"," #define FXAA_QUALITY_P6 2.0"," #define FXAA_QUALITY_P7 2.0"," #define FXAA_QUALITY_P8 2.0"," #define FXAA_QUALITY_P9 4.0"," #define FXAA_QUALITY_P10 8.0","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_QUALITY_PRESET == 29)"," #define FXAA_QUALITY_PS 12"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.5"," #define FXAA_QUALITY_P2 2.0"," #define FXAA_QUALITY_P3 2.0"," #define FXAA_QUALITY_P4 2.0"," #define FXAA_QUALITY_P5 2.0"," #define FXAA_QUALITY_P6 2.0"," #define FXAA_QUALITY_P7 2.0"," #define FXAA_QUALITY_P8 2.0"," #define FXAA_QUALITY_P9 2.0"," #define FXAA_QUALITY_P10 4.0"," #define FXAA_QUALITY_P11 8.0","#endif","","/*============================================================================"," FXAA QUALITY - EXTREME QUALITY","============================================================================*/","#if (FXAA_QUALITY_PRESET == 39)"," #define FXAA_QUALITY_PS 12"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.0"," #define FXAA_QUALITY_P2 1.0"," #define FXAA_QUALITY_P3 1.0"," #define FXAA_QUALITY_P4 1.0"," #define FXAA_QUALITY_P5 1.5"," #define FXAA_QUALITY_P6 2.0"," #define FXAA_QUALITY_P7 2.0"," #define FXAA_QUALITY_P8 2.0"," #define FXAA_QUALITY_P9 2.0"," #define FXAA_QUALITY_P10 4.0"," #define FXAA_QUALITY_P11 8.0","#endif","","","","/*============================================================================",""," API PORTING","","============================================================================*/","#if (FXAA_GLSL_100 == 1) || (FXAA_GLSL_120 == 1) || (FXAA_GLSL_130 == 1)"," #define FxaaBool bool"," #define FxaaDiscard discard"," #define FxaaFloat float"," #define FxaaFloat2 vec2"," #define FxaaFloat3 vec3"," #define FxaaFloat4 vec4"," #define FxaaHalf float"," #define FxaaHalf2 vec2"," #define FxaaHalf3 vec3"," #define FxaaHalf4 vec4"," #define FxaaInt2 ivec2"," #define FxaaSat(x) clamp(x, 0.0, 1.0)"," #define FxaaTex sampler2D","#else"," #define FxaaBool bool"," #define FxaaDiscard clip(-1)"," #define FxaaFloat float"," #define FxaaFloat2 float2"," #define FxaaFloat3 float3"," #define FxaaFloat4 float4"," #define FxaaHalf half"," #define FxaaHalf2 half2"," #define FxaaHalf3 half3"," #define FxaaHalf4 half4"," #define FxaaSat(x) saturate(x)","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_GLSL_100 == 1)"," #define FxaaTexTop(t, p) texture2D(t, p, 0.0)"," #define FxaaTexOff(t, p, o, r) texture2D(t, p + (o * r), 0.0)","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_GLSL_120 == 1)"," // Requires,"," // #version 120"," // And at least,"," // #extension GL_EXT_gpu_shader4 : enable"," // (or set FXAA_FAST_PIXEL_OFFSET 1 to work like DX9)"," #define FxaaTexTop(t, p) texture2DLod(t, p, 0.0)"," #if (FXAA_FAST_PIXEL_OFFSET == 1)"," #define FxaaTexOff(t, p, o, r) texture2DLodOffset(t, p, 0.0, o)"," #else"," #define FxaaTexOff(t, p, o, r) texture2DLod(t, p + (o * r), 0.0)"," #endif"," #if (FXAA_GATHER4_ALPHA == 1)"," // use #extension GL_ARB_gpu_shader5 : enable"," #define FxaaTexAlpha4(t, p) textureGather(t, p, 3)"," #define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3)"," #define FxaaTexGreen4(t, p) textureGather(t, p, 1)"," #define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1)"," #endif","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_GLSL_130 == 1)",' // Requires "#version 130" or better'," #define FxaaTexTop(t, p) textureLod(t, p, 0.0)"," #define FxaaTexOff(t, p, o, r) textureLodOffset(t, p, 0.0, o)"," #if (FXAA_GATHER4_ALPHA == 1)"," // use #extension GL_ARB_gpu_shader5 : enable"," #define FxaaTexAlpha4(t, p) textureGather(t, p, 3)"," #define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3)"," #define FxaaTexGreen4(t, p) textureGather(t, p, 1)"," #define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1)"," #endif","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_HLSL_3 == 1)"," #define FxaaInt2 float2"," #define FxaaTex sampler2D"," #define FxaaTexTop(t, p) tex2Dlod(t, float4(p, 0.0, 0.0))"," #define FxaaTexOff(t, p, o, r) tex2Dlod(t, float4(p + (o * r), 0, 0))","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_HLSL_4 == 1)"," #define FxaaInt2 int2"," struct FxaaTex { SamplerState smpl; Texture2D tex; };"," #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0)"," #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o)","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_HLSL_5 == 1)"," #define FxaaInt2 int2"," struct FxaaTex { SamplerState smpl; Texture2D tex; };"," #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0)"," #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o)"," #define FxaaTexAlpha4(t, p) t.tex.GatherAlpha(t.smpl, p)"," #define FxaaTexOffAlpha4(t, p, o) t.tex.GatherAlpha(t.smpl, p, o)"," #define FxaaTexGreen4(t, p) t.tex.GatherGreen(t.smpl, p)"," #define FxaaTexOffGreen4(t, p, o) t.tex.GatherGreen(t.smpl, p, o)","#endif","","","/*============================================================================"," GREEN AS LUMA OPTION SUPPORT FUNCTION","============================================================================*/","#if (FXAA_GREEN_AS_LUMA == 0)"," FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.w; }","#else"," FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.y; }","#endif","","","","","/*============================================================================",""," FXAA3 QUALITY - PC","","============================================================================*/","#if (FXAA_PC == 1)","/*--------------------------------------------------------------------------*/","FxaaFloat4 FxaaPixelShader("," //"," // Use noperspective interpolation here (turn off perspective interpolation)."," // {xy} = center of pixel"," FxaaFloat2 pos,"," //"," // Used only for FXAA Console, and not used on the 360 version."," // Use noperspective interpolation here (turn off perspective interpolation)."," // {xy_} = upper left of pixel"," // {_zw} = lower right of pixel"," FxaaFloat4 fxaaConsolePosPos,"," //"," // Input color texture."," // {rgb_} = color in linear or perceptual color space"," // if (FXAA_GREEN_AS_LUMA == 0)"," // {__a} = luma in perceptual color space (not linear)"," FxaaTex tex,"," //"," // Only used on the optimized 360 version of FXAA Console.",' // For everything but 360, just use the same input here as for "tex".'," // For 360, same texture, just alias with a 2nd sampler."," // This sampler needs to have an exponent bias of -1."," FxaaTex fxaaConsole360TexExpBiasNegOne,"," //"," // Only used on the optimized 360 version of FXAA Console.",' // For everything but 360, just use the same input here as for "tex".'," // For 360, same texture, just alias with a 3nd sampler."," // This sampler needs to have an exponent bias of -2."," FxaaTex fxaaConsole360TexExpBiasNegTwo,"," //"," // Only used on FXAA Quality."," // This must be from a constant/uniform."," // {x_} = 1.0/screenWidthInPixels"," // {_y} = 1.0/screenHeightInPixels"," FxaaFloat2 fxaaQualityRcpFrame,"," //"," // Only used on FXAA Console."," // This must be from a constant/uniform."," // This effects sub-pixel AA quality and inversely sharpness."," // Where N ranges between,"," // N = 0.50 (default)"," // N = 0.33 (sharper)"," // {x__} = -N/screenWidthInPixels"," // {_y_} = -N/screenHeightInPixels"," // {_z_} = N/screenWidthInPixels"," // {__w} = N/screenHeightInPixels"," FxaaFloat4 fxaaConsoleRcpFrameOpt,"," //"," // Only used on FXAA Console."," // Not used on 360, but used on PS3 and PC."," // This must be from a constant/uniform."," // {x__} = -2.0/screenWidthInPixels"," // {_y_} = -2.0/screenHeightInPixels"," // {_z_} = 2.0/screenWidthInPixels"," // {__w} = 2.0/screenHeightInPixels"," FxaaFloat4 fxaaConsoleRcpFrameOpt2,"," //"," // Only used on FXAA Console."," // Only used on 360 in place of fxaaConsoleRcpFrameOpt2."," // This must be from a constant/uniform."," // {x__} = 8.0/screenWidthInPixels"," // {_y_} = 8.0/screenHeightInPixels"," // {_z_} = -4.0/screenWidthInPixels"," // {__w} = -4.0/screenHeightInPixels"," FxaaFloat4 fxaaConsole360RcpFrameOpt2,"," //"," // Only used on FXAA Quality."," // This used to be the FXAA_QUALITY_SUBPIX define."," // It is here now to allow easier tuning."," // Choose the amount of sub-pixel aliasing removal."," // This can effect sharpness."," // 1.00 - upper limit (softer)"," // 0.75 - default amount of filtering"," // 0.50 - lower limit (sharper, less sub-pixel aliasing removal)"," // 0.25 - almost off"," // 0.00 - completely off"," FxaaFloat fxaaQualitySubpix,"," //"," // Only used on FXAA Quality."," // This used to be the FXAA_QUALITY_EDGE_THRESHOLD define."," // It is here now to allow easier tuning."," // The minimum amount of local contrast required to apply algorithm."," // 0.333 - too little (faster)"," // 0.250 - low quality"," // 0.166 - default"," // 0.125 - high quality"," // 0.063 - overkill (slower)"," FxaaFloat fxaaQualityEdgeThreshold,"," //"," // Only used on FXAA Quality."," // This used to be the FXAA_QUALITY_EDGE_THRESHOLD_MIN define."," // It is here now to allow easier tuning."," // Trims the algorithm from processing darks."," // 0.0833 - upper limit (default, the start of visible unfiltered edges)"," // 0.0625 - high quality (faster)"," // 0.0312 - visible limit (slower)"," // Special notes when using FXAA_GREEN_AS_LUMA,"," // Likely want to set this to zero."," // As colors that are mostly not-green"," // will appear very dark in the green channel!"," // Tune by looking at mostly non-green content,"," // then start at zero and increase until aliasing is a problem."," FxaaFloat fxaaQualityEdgeThresholdMin,"," //"," // Only used on FXAA Console."," // This used to be the FXAA_CONSOLE_EDGE_SHARPNESS define."," // It is here now to allow easier tuning."," // This does not effect PS3, as this needs to be compiled in."," // Use FXAA_CONSOLE_PS3_EDGE_SHARPNESS for PS3."," // Due to the PS3 being ALU bound,"," // there are only three safe values here: 2 and 4 and 8."," // These options use the shaders ability to a free *|/ by 2|4|8."," // For all other platforms can be a non-power of two."," // 8.0 is sharper (default!!!)"," // 4.0 is softer"," // 2.0 is really soft (good only for vector graphics inputs)"," FxaaFloat fxaaConsoleEdgeSharpness,"," //"," // Only used on FXAA Console."," // This used to be the FXAA_CONSOLE_EDGE_THRESHOLD define."," // It is here now to allow easier tuning."," // This does not effect PS3, as this needs to be compiled in."," // Use FXAA_CONSOLE_PS3_EDGE_THRESHOLD for PS3."," // Due to the PS3 being ALU bound,"," // there are only two safe values here: 1/4 and 1/8."," // These options use the shaders ability to a free *|/ by 2|4|8."," // The console setting has a different mapping than the quality setting."," // Other platforms can use other values."," // 0.125 leaves less aliasing, but is softer (default!!!)"," // 0.25 leaves more aliasing, and is sharper"," FxaaFloat fxaaConsoleEdgeThreshold,"," //"," // Only used on FXAA Console."," // This used to be the FXAA_CONSOLE_EDGE_THRESHOLD_MIN define."," // It is here now to allow easier tuning."," // Trims the algorithm from processing darks."," // The console setting has a different mapping than the quality setting."," // This only applies when FXAA_EARLY_EXIT is 1."," // This does not apply to PS3,"," // PS3 was simplified to avoid more shader instructions."," // 0.06 - faster but more aliasing in darks"," // 0.05 - default"," // 0.04 - slower and less aliasing in darks"," // Special notes when using FXAA_GREEN_AS_LUMA,"," // Likely want to set this to zero."," // As colors that are mostly not-green"," // will appear very dark in the green channel!"," // Tune by looking at mostly non-green content,"," // then start at zero and increase until aliasing is a problem."," FxaaFloat fxaaConsoleEdgeThresholdMin,"," //"," // Extra constants for 360 FXAA Console only."," // Use zeros or anything else for other platforms."," // These must be in physical constant registers and NOT immediates."," // Immediates will result in compiler un-optimizing."," // {xyzw} = float4(1.0, -1.0, 0.25, -0.25)"," FxaaFloat4 fxaaConsole360ConstDir",") {","/*--------------------------------------------------------------------------*/"," FxaaFloat2 posM;"," posM.x = pos.x;"," posM.y = pos.y;"," #if (FXAA_GATHER4_ALPHA == 1)"," #if (FXAA_DISCARD == 0)"," FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);"," #if (FXAA_GREEN_AS_LUMA == 0)"," #define lumaM rgbyM.w"," #else"," #define lumaM rgbyM.y"," #endif"," #endif"," #if (FXAA_GREEN_AS_LUMA == 0)"," FxaaFloat4 luma4A = FxaaTexAlpha4(tex, posM);"," FxaaFloat4 luma4B = FxaaTexOffAlpha4(tex, posM, FxaaInt2(-1, -1));"," #else"," FxaaFloat4 luma4A = FxaaTexGreen4(tex, posM);"," FxaaFloat4 luma4B = FxaaTexOffGreen4(tex, posM, FxaaInt2(-1, -1));"," #endif"," #if (FXAA_DISCARD == 1)"," #define lumaM luma4A.w"," #endif"," #define lumaE luma4A.z"," #define lumaS luma4A.x"," #define lumaSE luma4A.y"," #define lumaNW luma4B.w"," #define lumaN luma4B.z"," #define lumaW luma4B.x"," #else"," FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);"," #if (FXAA_GREEN_AS_LUMA == 0)"," #define lumaM rgbyM.w"," #else"," #define lumaM rgbyM.y"," #endif"," #if (FXAA_GLSL_100 == 1)"," FxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 0.0, 1.0), fxaaQualityRcpFrame.xy));"," FxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 1.0, 0.0), fxaaQualityRcpFrame.xy));"," FxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 0.0,-1.0), fxaaQualityRcpFrame.xy));"," FxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0, 0.0), fxaaQualityRcpFrame.xy));"," #else"," FxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0, 1), fxaaQualityRcpFrame.xy));"," FxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 0), fxaaQualityRcpFrame.xy));"," FxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0,-1), fxaaQualityRcpFrame.xy));"," FxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 0), fxaaQualityRcpFrame.xy));"," #endif"," #endif","/*--------------------------------------------------------------------------*/"," FxaaFloat maxSM = max(lumaS, lumaM);"," FxaaFloat minSM = min(lumaS, lumaM);"," FxaaFloat maxESM = max(lumaE, maxSM);"," FxaaFloat minESM = min(lumaE, minSM);"," FxaaFloat maxWN = max(lumaN, lumaW);"," FxaaFloat minWN = min(lumaN, lumaW);"," FxaaFloat rangeMax = max(maxWN, maxESM);"," FxaaFloat rangeMin = min(minWN, minESM);"," FxaaFloat rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold;"," FxaaFloat range = rangeMax - rangeMin;"," FxaaFloat rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled);"," FxaaBool earlyExit = range < rangeMaxClamped;","/*--------------------------------------------------------------------------*/"," if(earlyExit)"," #if (FXAA_DISCARD == 1)"," FxaaDiscard;"," #else"," return rgbyM;"," #endif","/*--------------------------------------------------------------------------*/"," #if (FXAA_GATHER4_ALPHA == 0)"," #if (FXAA_GLSL_100 == 1)"," FxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0,-1.0), fxaaQualityRcpFrame.xy));"," FxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 1.0, 1.0), fxaaQualityRcpFrame.xy));"," FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 1.0,-1.0), fxaaQualityRcpFrame.xy));"," FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0, 1.0), fxaaQualityRcpFrame.xy));"," #else"," FxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1,-1), fxaaQualityRcpFrame.xy));"," FxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 1), fxaaQualityRcpFrame.xy));"," FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1,-1), fxaaQualityRcpFrame.xy));"," FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));"," #endif"," #else"," FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(1, -1), fxaaQualityRcpFrame.xy));"," FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));"," #endif","/*--------------------------------------------------------------------------*/"," FxaaFloat lumaNS = lumaN + lumaS;"," FxaaFloat lumaWE = lumaW + lumaE;"," FxaaFloat subpixRcpRange = 1.0/range;"," FxaaFloat subpixNSWE = lumaNS + lumaWE;"," FxaaFloat edgeHorz1 = (-2.0 * lumaM) + lumaNS;"," FxaaFloat edgeVert1 = (-2.0 * lumaM) + lumaWE;","/*--------------------------------------------------------------------------*/"," FxaaFloat lumaNESE = lumaNE + lumaSE;"," FxaaFloat lumaNWNE = lumaNW + lumaNE;"," FxaaFloat edgeHorz2 = (-2.0 * lumaE) + lumaNESE;"," FxaaFloat edgeVert2 = (-2.0 * lumaN) + lumaNWNE;","/*--------------------------------------------------------------------------*/"," FxaaFloat lumaNWSW = lumaNW + lumaSW;"," FxaaFloat lumaSWSE = lumaSW + lumaSE;"," FxaaFloat edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2);"," FxaaFloat edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2);"," FxaaFloat edgeHorz3 = (-2.0 * lumaW) + lumaNWSW;"," FxaaFloat edgeVert3 = (-2.0 * lumaS) + lumaSWSE;"," FxaaFloat edgeHorz = abs(edgeHorz3) + edgeHorz4;"," FxaaFloat edgeVert = abs(edgeVert3) + edgeVert4;","/*--------------------------------------------------------------------------*/"," FxaaFloat subpixNWSWNESE = lumaNWSW + lumaNESE;"," FxaaFloat lengthSign = fxaaQualityRcpFrame.x;"," FxaaBool horzSpan = edgeHorz >= edgeVert;"," FxaaFloat subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;","/*--------------------------------------------------------------------------*/"," if(!horzSpan) lumaN = lumaW;"," if(!horzSpan) lumaS = lumaE;"," if(horzSpan) lengthSign = fxaaQualityRcpFrame.y;"," FxaaFloat subpixB = (subpixA * (1.0/12.0)) - lumaM;","/*--------------------------------------------------------------------------*/"," FxaaFloat gradientN = lumaN - lumaM;"," FxaaFloat gradientS = lumaS - lumaM;"," FxaaFloat lumaNN = lumaN + lumaM;"," FxaaFloat lumaSS = lumaS + lumaM;"," FxaaBool pairN = abs(gradientN) >= abs(gradientS);"," FxaaFloat gradient = max(abs(gradientN), abs(gradientS));"," if(pairN) lengthSign = -lengthSign;"," FxaaFloat subpixC = FxaaSat(abs(subpixB) * subpixRcpRange);","/*--------------------------------------------------------------------------*/"," FxaaFloat2 posB;"," posB.x = posM.x;"," posB.y = posM.y;"," FxaaFloat2 offNP;"," offNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;"," offNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;"," if(!horzSpan) posB.x += lengthSign * 0.5;"," if( horzSpan) posB.y += lengthSign * 0.5;","/*--------------------------------------------------------------------------*/"," FxaaFloat2 posN;"," posN.x = posB.x - offNP.x * FXAA_QUALITY_P0;"," posN.y = posB.y - offNP.y * FXAA_QUALITY_P0;"," FxaaFloat2 posP;"," posP.x = posB.x + offNP.x * FXAA_QUALITY_P0;"," posP.y = posB.y + offNP.y * FXAA_QUALITY_P0;"," FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0;"," FxaaFloat lumaEndN = FxaaLuma(FxaaTexTop(tex, posN));"," FxaaFloat subpixE = subpixC * subpixC;"," FxaaFloat lumaEndP = FxaaLuma(FxaaTexTop(tex, posP));","/*--------------------------------------------------------------------------*/"," if(!pairN) lumaNN = lumaSS;"," FxaaFloat gradientScaled = gradient * 1.0/4.0;"," FxaaFloat lumaMM = lumaM - lumaNN * 0.5;"," FxaaFloat subpixF = subpixD * subpixE;"," FxaaBool lumaMLTZero = lumaMM < 0.0;","/*--------------------------------------------------------------------------*/"," lumaEndN -= lumaNN * 0.5;"," lumaEndP -= lumaNN * 0.5;"," FxaaBool doneN = abs(lumaEndN) >= gradientScaled;"," FxaaBool doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P1;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P1;"," FxaaBool doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P1;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P1;","/*--------------------------------------------------------------------------*/"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P2;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P2;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P2;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P2;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 3)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P3;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P3;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P3;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P3;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 4)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P4;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P4;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P4;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P4;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 5)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P5;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P5;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P5;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P5;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 6)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P6;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P6;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P6;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P6;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 7)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P7;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P7;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P7;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P7;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 8)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P8;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P8;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P8;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P8;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 9)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P9;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P9;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P9;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P9;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 10)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P10;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P10;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P10;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P10;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 11)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P11;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P11;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P11;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P11;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 12)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P12;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P12;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P12;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P12;","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }","/*--------------------------------------------------------------------------*/"," FxaaFloat dstN = posM.x - posN.x;"," FxaaFloat dstP = posP.x - posM.x;"," if(!horzSpan) dstN = posM.y - posN.y;"," if(!horzSpan) dstP = posP.y - posM.y;","/*--------------------------------------------------------------------------*/"," FxaaBool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;"," FxaaFloat spanLength = (dstP + dstN);"," FxaaBool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;"," FxaaFloat spanLengthRcp = 1.0/spanLength;","/*--------------------------------------------------------------------------*/"," FxaaBool directionN = dstN < dstP;"," FxaaFloat dst = min(dstN, dstP);"," FxaaBool goodSpan = directionN ? goodSpanN : goodSpanP;"," FxaaFloat subpixG = subpixF * subpixF;"," FxaaFloat pixelOffset = (dst * (-spanLengthRcp)) + 0.5;"," FxaaFloat subpixH = subpixG * fxaaQualitySubpix;","/*--------------------------------------------------------------------------*/"," FxaaFloat pixelOffsetGood = goodSpan ? pixelOffset : 0.0;"," FxaaFloat pixelOffsetSubpix = max(pixelOffsetGood, subpixH);"," if(!horzSpan) posM.x += pixelOffsetSubpix * lengthSign;"," if( horzSpan) posM.y += pixelOffsetSubpix * lengthSign;"," #if (FXAA_DISCARD == 1)"," return FxaaTexTop(tex, posM);"," #else"," return FxaaFloat4(FxaaTexTop(tex, posM).xyz, lumaM);"," #endif","}","/*==========================================================================*/","#endif","","void main() {"," gl_FragColor = FxaaPixelShader("," vUv,"," vec4(0.0),"," tDiffuse,"," tDiffuse,"," tDiffuse,"," resolution,"," vec4(0.0),"," vec4(0.0),"," vec4(0.0),"," 0.75,"," 0.166,"," 0.0833,"," 0.0,"," 0.0,"," 0.0,"," vec4(0.0)"," );",""," // TODO avoid querying texture twice for same texel"," gl_FragColor.a = texture2D(tDiffuse, vUv).a;","}"].join("\n")},fh={uniforms:{tDiffuse:{value:null},screenWidth:{value:1024},screenHeight:{value:1024},sampleDistance:{value:.94},waveFactor:{value:.00125}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform float screenWidth;","uniform float screenHeight;","uniform float sampleDistance;","uniform float waveFactor;","uniform sampler2D tDiffuse;","varying vec2 vUv;","void main() {","\tvec4 color, org, tmp, add;","\tfloat sample_dist, f;","\tvec2 vin;","\tvec2 uv = vUv;","\tadd = color = org = texture2D( tDiffuse, uv );","\tvin = ( uv - vec2( 0.5 ) ) * vec2( 1.4 );","\tsample_dist = dot( vin, vin ) * 2.0;","\tf = ( waveFactor * 100.0 + sample_dist ) * sampleDistance * 4.0;","\tvec2 sampleSize = vec2( 1.0 / screenWidth, 1.0 / screenHeight ) * vec2( f );","\tadd += tmp = texture2D( tDiffuse, uv + vec2( 0.111964, 0.993712 ) * sampleSize );","\tif( tmp.b < color.b ) color = tmp;","\tadd += tmp = texture2D( tDiffuse, uv + vec2( 0.846724, 0.532032 ) * sampleSize );","\tif( tmp.b < color.b ) color = tmp;","\tadd += tmp = texture2D( tDiffuse, uv + vec2( 0.943883, -0.330279 ) * sampleSize );","\tif( tmp.b < color.b ) color = tmp;","\tadd += tmp = texture2D( tDiffuse, uv + vec2( 0.330279, -0.943883 ) * sampleSize );","\tif( tmp.b < color.b ) color = tmp;","\tadd += tmp = texture2D( tDiffuse, uv + vec2( -0.532032, -0.846724 ) * sampleSize );","\tif( tmp.b < color.b ) color = tmp;","\tadd += tmp = texture2D( tDiffuse, uv + vec2( -0.993712, -0.111964 ) * sampleSize );","\tif( tmp.b < color.b ) color = tmp;","\tadd += tmp = texture2D( tDiffuse, uv + vec2( -0.707107, 0.707107 ) * sampleSize );","\tif( tmp.b < color.b ) color = tmp;","\tcolor = color * vec4( 2.0 ) - ( add / vec4( 8.0 ) );","\tcolor = color + ( add / vec4( 8.0 ) - color ) * ( vec4( 1.0 ) - vec4( sample_dist * 0.5 ) );","\tgl_FragColor = vec4( color.rgb * color.rgb * vec3( 0.95 ) + color.rgb, 1.0 );","}"].join("\n")},gh={uniforms:{tDiffuse:{value:null},aspect:{value:new e.Vector2(512,512)}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","varying vec2 vUv;","uniform vec2 aspect;","vec2 texel = vec2(1.0 / aspect.x, 1.0 / aspect.y);","mat3 G[9];","const mat3 g0 = mat3( 0.3535533845424652, 0, -0.3535533845424652, 0.5, 0, -0.5, 0.3535533845424652, 0, -0.3535533845424652 );","const mat3 g1 = mat3( 0.3535533845424652, 0.5, 0.3535533845424652, 0, 0, 0, -0.3535533845424652, -0.5, -0.3535533845424652 );","const mat3 g2 = mat3( 0, 0.3535533845424652, -0.5, -0.3535533845424652, 0, 0.3535533845424652, 0.5, -0.3535533845424652, 0 );","const mat3 g3 = mat3( 0.5, -0.3535533845424652, 0, -0.3535533845424652, 0, 0.3535533845424652, 0, 0.3535533845424652, -0.5 );","const mat3 g4 = mat3( 0, -0.5, 0, 0.5, 0, 0.5, 0, -0.5, 0 );","const mat3 g5 = mat3( -0.5, 0, 0.5, 0, 0, 0, 0.5, 0, -0.5 );","const mat3 g6 = mat3( 0.1666666716337204, -0.3333333432674408, 0.1666666716337204, -0.3333333432674408, 0.6666666865348816, -0.3333333432674408, 0.1666666716337204, -0.3333333432674408, 0.1666666716337204 );","const mat3 g7 = mat3( -0.3333333432674408, 0.1666666716337204, -0.3333333432674408, 0.1666666716337204, 0.6666666865348816, 0.1666666716337204, -0.3333333432674408, 0.1666666716337204, -0.3333333432674408 );","const mat3 g8 = mat3( 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408 );","void main(void)","{","\tG[0] = g0,","\tG[1] = g1,","\tG[2] = g2,","\tG[3] = g3,","\tG[4] = g4,","\tG[5] = g5,","\tG[6] = g6,","\tG[7] = g7,","\tG[8] = g8;","\tmat3 I;","\tfloat cnv[9];","\tvec3 sample;","\tfor (float i=0.0; i<3.0; i++) {","\t\tfor (float j=0.0; j<3.0; j++) {","\t\t\tsample = texture2D(tDiffuse, vUv + texel * vec2(i-1.0,j-1.0) ).rgb;","\t\t\tI[int(i)][int(j)] = length(sample);","\t\t}","\t}","\tfor (int i=0; i<9; i++) {","\t\tfloat dp3 = dot(G[i][0], I[0]) + dot(G[i][1], I[1]) + dot(G[i][2], I[2]);","\t\tcnv[i] = dp3 * dp3;","\t}","\tfloat M = (cnv[0] + cnv[1]) + (cnv[2] + cnv[3]);","\tfloat S = (cnv[4] + cnv[5]) + (cnv[6] + cnv[7]) + (cnv[8] + M);","\tgl_FragColor = vec4(vec3(sqrt(M/S)), 1.0);","}"].join("\n")},vh={uniforms:{mRefractionRatio:{value:1.02},mFresnelBias:{value:.1},mFresnelPower:{value:2},mFresnelScale:{value:1},tCube:{value:null}},vertexShader:["uniform float mRefractionRatio;","uniform float mFresnelBias;","uniform float mFresnelScale;","uniform float mFresnelPower;","varying vec3 vReflect;","varying vec3 vRefract[3];","varying float vReflectionFactor;","void main() {","\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );","\tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );","\tvec3 worldNormal = normalize( mat3( modelMatrix[0].xyz, modelMatrix[1].xyz, modelMatrix[2].xyz ) * normal );","\tvec3 I = worldPosition.xyz - cameraPosition;","\tvReflect = reflect( I, worldNormal );","\tvRefract[0] = refract( normalize( I ), worldNormal, mRefractionRatio );","\tvRefract[1] = refract( normalize( I ), worldNormal, mRefractionRatio * 0.99 );","\tvRefract[2] = refract( normalize( I ), worldNormal, mRefractionRatio * 0.98 );","\tvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), worldNormal ), mFresnelPower );","\tgl_Position = projectionMatrix * mvPosition;","}"].join("\n"),fragmentShader:["uniform samplerCube tCube;","varying vec3 vReflect;","varying vec3 vRefract[3];","varying float vReflectionFactor;","void main() {","\tvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );","\tvec4 refractedColor = vec4( 1.0 );","\trefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;","\trefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;","\trefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;","\tgl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );","}"].join("\n")},xh={uniforms:{tDiffuse:{value:null}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","varying vec2 vUv;","void main() {","\tvec4 tex = texture2D( tDiffuse, vUv );","\tgl_FragColor = LinearTosRGB( tex );","}"].join("\n")},yh={uniforms:{tInput:{value:null}},vertexShader:["varying vec2 vUv;","void main() {"," vUv = uv;"," gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["varying vec2 vUv;","uniform sampler2D tInput;","void main() {","\tgl_FragColor = vec4( 1.0 ) - texture2D( tInput, vUv );","}"].join("\n")},bh={uniforms:{tInput:{value:null},fStepSize:{value:1},vSunPositionScreenSpace:{value:new e.Vector3}},vertexShader:["varying vec2 vUv;","void main() {"," vUv = uv;"," gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["#define TAPS_PER_PASS 6.0","varying vec2 vUv;","uniform sampler2D tInput;","uniform vec3 vSunPositionScreenSpace;","uniform float fStepSize;","void main() {","\tvec2 delta = vSunPositionScreenSpace.xy - vUv;","\tfloat dist = length( delta );","\tvec2 stepv = fStepSize * delta / dist;","\tfloat iters = dist/fStepSize;","\tvec2 uv = vUv.xy;","\tfloat col = 0.0;","\tfloat f = min( 1.0, max( vSunPositionScreenSpace.z / 1000.0, 0.0 ) );","\tif ( 0.0 <= iters && uv.y < 1.0 ) col += texture2D( tInput, uv ).r * f;","\tuv += stepv;","\tif ( 1.0 <= iters && uv.y < 1.0 ) col += texture2D( tInput, uv ).r * f;","\tuv += stepv;","\tif ( 2.0 <= iters && uv.y < 1.0 ) col += texture2D( tInput, uv ).r * f;","\tuv += stepv;","\tif ( 3.0 <= iters && uv.y < 1.0 ) col += texture2D( tInput, uv ).r * f;","\tuv += stepv;","\tif ( 4.0 <= iters && uv.y < 1.0 ) col += texture2D( tInput, uv ).r * f;","\tuv += stepv;","\tif ( 5.0 <= iters && uv.y < 1.0 ) col += texture2D( tInput, uv ).r * f;","\tuv += stepv;","\tgl_FragColor = vec4( col/TAPS_PER_PASS );","\tgl_FragColor.a = 1.0;","}"].join("\n")},Ah={uniforms:{tColors:{value:null},tGodRays:{value:null},fGodRayIntensity:{value:.69}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["varying vec2 vUv;","uniform sampler2D tColors;","uniform sampler2D tGodRays;","uniform float fGodRayIntensity;","void main() {","\tgl_FragColor = texture2D( tColors, vUv ) + fGodRayIntensity * vec4( 1.0 - texture2D( tGodRays, vUv ).r );","\tgl_FragColor.a = 1.0;","}"].join("\n")},wh={uniforms:{vSunPositionScreenSpace:{value:new e.Vector3},fAspect:{value:1},sunColor:{value:new e.Color(16772608)},bgColor:{value:new e.Color(0)}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["varying vec2 vUv;","uniform vec3 vSunPositionScreenSpace;","uniform float fAspect;","uniform vec3 sunColor;","uniform vec3 bgColor;","void main() {","\tvec2 diff = vUv - vSunPositionScreenSpace.xy;","\tdiff.x *= fAspect;","\tfloat prop = clamp( length( diff ) / 0.5, 0.0, 1.0 );","\tprop = 0.35 * pow( 1.0 - prop, 3.0 );","\tgl_FragColor.xyz = ( vSunPositionScreenSpace.z > 0.0 ) ? mix( sunColor, bgColor, 1.0 - prop ) : bgColor;","\tgl_FragColor.w = 1.0;","}"].join("\n")},Mh={uniforms:{tDiffuse:{value:null},h:{value:1/512}},vertexShader:"\n varying vec2 vUv;\n\n void main() {\n\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n }\n ",fragmentShader:"\n uniform sampler2D tDiffuse;\n uniform float h;\n\n varying vec2 vUv;\n\n void main() {\n\n \tvec4 sum = vec4( 0.0 );\n\n \tsum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051;\n \tsum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918;\n \tsum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245;\n \tsum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531;\n \tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n \tsum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531;\n \tsum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245;\n \tsum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918;\n \tsum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051;\n\n \tgl_FragColor = sum;\n\n }\n "},Th={uniforms:{tDiffuse:{value:null},h:{value:1/512},r:{value:.35}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","uniform float h;","uniform float r;","varying vec2 vUv;","void main() {","\tvec4 sum = vec4( 0.0 );","\tfloat hh = h * abs( r - vUv.y );","\tsum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * hh, vUv.y ) ) * 0.051;","\tsum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * hh, vUv.y ) ) * 0.0918;","\tsum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * hh, vUv.y ) ) * 0.12245;","\tsum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * hh, vUv.y ) ) * 0.1531;","\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;","\tsum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * hh, vUv.y ) ) * 0.1531;","\tsum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * hh, vUv.y ) ) * 0.12245;","\tsum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * hh, vUv.y ) ) * 0.0918;","\tsum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * hh, vUv.y ) ) * 0.051;","\tgl_FragColor = sum;","}"].join("\n")},Sh={uniforms:{tDiffuse:{value:null},hue:{value:0},saturation:{value:0}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","uniform float hue;","uniform float saturation;","varying vec2 vUv;","void main() {","\tgl_FragColor = texture2D( tDiffuse, vUv );","\tfloat angle = hue * 3.14159265;","\tfloat s = sin(angle), c = cos(angle);","\tvec3 weights = (vec3(2.0 * c, -sqrt(3.0) * s - c, sqrt(3.0) * s - c) + 1.0) / 3.0;","\tfloat len = length(gl_FragColor.rgb);","\tgl_FragColor.rgb = vec3(","\t\tdot(gl_FragColor.rgb, weights.xyz),","\t\tdot(gl_FragColor.rgb, weights.zxy),","\t\tdot(gl_FragColor.rgb, weights.yzx)","\t);","\tfloat average = (gl_FragColor.r + gl_FragColor.g + gl_FragColor.b) / 3.0;","\tif (saturation > 0.0) {","\t\tgl_FragColor.rgb += (average - gl_FragColor.rgb) * (1.0 - 1.0 / (1.001 - saturation));","\t} else {","\t\tgl_FragColor.rgb += (average - gl_FragColor.rgb) * (-saturation);","\t}","}"].join("\n")},Ch={uniforms:{tDiffuse:{value:null},sides:{value:6},angle:{value:0}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","uniform float sides;","uniform float angle;","varying vec2 vUv;","void main() {","\tvec2 p = vUv - 0.5;","\tfloat r = length(p);","\tfloat a = atan(p.y, p.x) + angle;","\tfloat tau = 2. * 3.1416 ;","\ta = mod(a, tau/sides);","\ta = abs(a - tau/sides/2.) ;","\tp = r * vec2(cos(a), sin(a));","\tvec4 color = texture2D(tDiffuse, p + 0.5);","\tgl_FragColor = color;","}"].join("\n")},Fh={uniforms:{tDiffuse:{value:null},side:{value:1}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","uniform int side;","varying vec2 vUv;","void main() {","\tvec2 p = vUv;","\tif (side == 0){","\t\tif (p.x > 0.5) p.x = 1.0 - p.x;","\t}else if (side == 1){","\t\tif (p.x < 0.5) p.x = 1.0 - p.x;","\t}else if (side == 2){","\t\tif (p.y < 0.5) p.y = 1.0 - p.y;","\t}else if (side == 3){","\t\tif (p.y > 0.5) p.y = 1.0 - p.y;","\t} ","\tvec4 color = texture2D(tDiffuse, p);","\tgl_FragColor = color;","}"].join("\n")},Eh={uniforms:{heightMap:{value:null},resolution:{value:new e.Vector2(512,512)},scale:{value:new e.Vector2(1,1)},height:{value:.05}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform float height;","uniform vec2 resolution;","uniform sampler2D heightMap;","varying vec2 vUv;","void main() {","\tfloat val = texture2D( heightMap, vUv ).x;","\tfloat valU = texture2D( heightMap, vUv + vec2( 1.0 / resolution.x, 0.0 ) ).x;","\tfloat valV = texture2D( heightMap, vUv + vec2( 0.0, 1.0 / resolution.y ) ).x;","\tgl_FragColor = vec4( ( 0.5 * normalize( vec3( val - valU, val - valV, height ) ) + 0.5 ), 1.0 );","}"].join("\n")},_h={modes:{none:"NO_PARALLAX",basic:"USE_BASIC_PARALLAX",steep:"USE_STEEP_PARALLAX",occlusion:"USE_OCLUSION_PARALLAX",relief:"USE_RELIEF_PARALLAX"},uniforms:{bumpMap:{value:null},map:{value:null},parallaxScale:{value:null},parallaxMinLayers:{value:null},parallaxMaxLayers:{value:null}},vertexShader:["varying vec2 vUv;","varying vec3 vViewPosition;","varying vec3 vNormal;","void main() {","\tvUv = uv;","\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );","\tvViewPosition = -mvPosition.xyz;","\tvNormal = normalize( normalMatrix * normal );","\tgl_Position = projectionMatrix * mvPosition;","}"].join("\n"),fragmentShader:["uniform sampler2D bumpMap;","uniform sampler2D map;","uniform float parallaxScale;","uniform float parallaxMinLayers;","uniform float parallaxMaxLayers;","varying vec2 vUv;","varying vec3 vViewPosition;","varying vec3 vNormal;","#ifdef USE_BASIC_PARALLAX","\tvec2 parallaxMap( in vec3 V ) {","\t\tfloat initialHeight = texture2D( bumpMap, vUv ).r;","\t\tvec2 texCoordOffset = parallaxScale * V.xy * initialHeight;","\t\treturn vUv - texCoordOffset;","\t}","#else","\tvec2 parallaxMap( in vec3 V ) {","\t\tfloat numLayers = mix( parallaxMaxLayers, parallaxMinLayers, abs( dot( vec3( 0.0, 0.0, 1.0 ), V ) ) );","\t\tfloat layerHeight = 1.0 / numLayers;","\t\tfloat currentLayerHeight = 0.0;","\t\tvec2 dtex = parallaxScale * V.xy / V.z / numLayers;","\t\tvec2 currentTextureCoords = vUv;","\t\tfloat heightFromTexture = texture2D( bumpMap, currentTextureCoords ).r;","\t\tfor ( int i = 0; i < 30; i += 1 ) {","\t\t\tif ( heightFromTexture <= currentLayerHeight ) {","\t\t\t\tbreak;","\t\t\t}","\t\t\tcurrentLayerHeight += layerHeight;","\t\t\tcurrentTextureCoords -= dtex;","\t\t\theightFromTexture = texture2D( bumpMap, currentTextureCoords ).r;","\t\t}","\t\t#ifdef USE_STEEP_PARALLAX","\t\t\treturn currentTextureCoords;","\t\t#elif defined( USE_RELIEF_PARALLAX )","\t\t\tvec2 deltaTexCoord = dtex / 2.0;","\t\t\tfloat deltaHeight = layerHeight / 2.0;","\t\t\tcurrentTextureCoords += deltaTexCoord;","\t\t\tcurrentLayerHeight -= deltaHeight;","\t\t\tconst int numSearches = 5;","\t\t\tfor ( int i = 0; i < numSearches; i += 1 ) {","\t\t\t\tdeltaTexCoord /= 2.0;","\t\t\t\tdeltaHeight /= 2.0;","\t\t\t\theightFromTexture = texture2D( bumpMap, currentTextureCoords ).r;","\t\t\t\tif( heightFromTexture > currentLayerHeight ) {","\t\t\t\t\tcurrentTextureCoords -= deltaTexCoord;","\t\t\t\t\tcurrentLayerHeight += deltaHeight;","\t\t\t\t} else {","\t\t\t\t\tcurrentTextureCoords += deltaTexCoord;","\t\t\t\t\tcurrentLayerHeight -= deltaHeight;","\t\t\t\t}","\t\t\t}","\t\t\treturn currentTextureCoords;","\t\t#elif defined( USE_OCLUSION_PARALLAX )","\t\t\tvec2 prevTCoords = currentTextureCoords + dtex;","\t\t\tfloat nextH = heightFromTexture - currentLayerHeight;","\t\t\tfloat prevH = texture2D( bumpMap, prevTCoords ).r - currentLayerHeight + layerHeight;","\t\t\tfloat weight = nextH / ( nextH - prevH );","\t\t\treturn prevTCoords * weight + currentTextureCoords * ( 1.0 - weight );","\t\t#else","\t\t\treturn vUv;","\t\t#endif","\t}","#endif","vec2 perturbUv( vec3 surfPosition, vec3 surfNormal, vec3 viewPosition ) {","\tvec2 texDx = dFdx( vUv );","\tvec2 texDy = dFdy( vUv );","\tvec3 vSigmaX = dFdx( surfPosition );","\tvec3 vSigmaY = dFdy( surfPosition );","\tvec3 vR1 = cross( vSigmaY, surfNormal );","\tvec3 vR2 = cross( surfNormal, vSigmaX );","\tfloat fDet = dot( vSigmaX, vR1 );","\tvec2 vProjVscr = ( 1.0 / fDet ) * vec2( dot( vR1, viewPosition ), dot( vR2, viewPosition ) );","\tvec3 vProjVtex;","\tvProjVtex.xy = texDx * vProjVscr.x + texDy * vProjVscr.y;","\tvProjVtex.z = dot( surfNormal, viewPosition );","\treturn parallaxMap( vProjVtex );","}","void main() {","\tvec2 mapUv = perturbUv( -vViewPosition, normalize( vNormal ), normalize( vViewPosition ) );","\tgl_FragColor = texture2D( map, mapUv );","}"].join("\n")},Ph={uniforms:{tDiffuse:{value:null},resolution:{value:null},pixelSize:{value:1}},vertexShader:["varying highp vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","uniform float pixelSize;","uniform vec2 resolution;","varying highp vec2 vUv;","void main(){","vec2 dxy = pixelSize / resolution;","vec2 coord = dxy * floor( vUv / dxy );","gl_FragColor = texture2D(tDiffuse, coord);","}"].join("\n")},Bh={uniforms:{tDiffuse:{value:null},amount:{value:.005},angle:{value:0}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","uniform float amount;","uniform float angle;","varying vec2 vUv;","void main() {","\tvec2 offset = amount * vec2( cos(angle), sin(angle));","\tvec4 cr = texture2D(tDiffuse, vUv + offset);","\tvec4 cga = texture2D(tDiffuse, vUv);","\tvec4 cb = texture2D(tDiffuse, vUv - offset);","\tgl_FragColor = vec4(cr.r, cga.g, cb.b, cga.a);","}"].join("\n")},Lh={uniforms:{tDiffuse:{value:null},amount:{value:1}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform float amount;","uniform sampler2D tDiffuse;","varying vec2 vUv;","void main() {","\tvec4 color = texture2D( tDiffuse, vUv );","\tvec3 c = color.rgb;","\tcolor.r = dot( c, vec3( 1.0 - 0.607 * amount, 0.769 * amount, 0.189 * amount ) );","\tcolor.g = dot( c, vec3( 0.349 * amount, 1.0 - 0.314 * amount, 0.168 * amount ) );","\tcolor.b = dot( c, vec3( 0.272 * amount, 0.534 * amount, 1.0 - 0.869 * amount ) );","\tgl_FragColor = vec4( min( vec3( 1.0 ), color.rgb ), color.a );","}"].join("\n")},Rh={uniforms:{tDiffuse:{value:null},resolution:{value:new e.Vector2}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","uniform vec2 resolution;","varying vec2 vUv;","void main() {","\tvec2 texel = vec2( 1.0 / resolution.x, 1.0 / resolution.y );","\tconst mat3 Gx = mat3( -1, -2, -1, 0, 0, 0, 1, 2, 1 );","\tconst mat3 Gy = mat3( -1, 0, 1, -2, 0, 2, -1, 0, 1 );","\tfloat tx0y0 = texture2D( tDiffuse, vUv + texel * vec2( -1, -1 ) ).r;","\tfloat tx0y1 = texture2D( tDiffuse, vUv + texel * vec2( -1, 0 ) ).r;","\tfloat tx0y2 = texture2D( tDiffuse, vUv + texel * vec2( -1, 1 ) ).r;","\tfloat tx1y0 = texture2D( tDiffuse, vUv + texel * vec2( 0, -1 ) ).r;","\tfloat tx1y1 = texture2D( tDiffuse, vUv + texel * vec2( 0, 0 ) ).r;","\tfloat tx1y2 = texture2D( tDiffuse, vUv + texel * vec2( 0, 1 ) ).r;","\tfloat tx2y0 = texture2D( tDiffuse, vUv + texel * vec2( 1, -1 ) ).r;","\tfloat tx2y1 = texture2D( tDiffuse, vUv + texel * vec2( 1, 0 ) ).r;","\tfloat tx2y2 = texture2D( tDiffuse, vUv + texel * vec2( 1, 1 ) ).r;","\tfloat valueGx = Gx[0][0] * tx0y0 + Gx[1][0] * tx1y0 + Gx[2][0] * tx2y0 + ","\t\tGx[0][1] * tx0y1 + Gx[1][1] * tx1y1 + Gx[2][1] * tx2y1 + ","\t\tGx[0][2] * tx0y2 + Gx[1][2] * tx1y2 + Gx[2][2] * tx2y2; ","\tfloat valueGy = Gy[0][0] * tx0y0 + Gy[1][0] * tx1y0 + Gy[2][0] * tx2y0 + ","\t\tGy[0][1] * tx0y1 + Gy[1][1] * tx1y1 + Gy[2][1] * tx2y1 + ","\t\tGy[0][2] * tx0y2 + Gy[1][2] * tx1y2 + Gy[2][2] * tx2y2; ","\tfloat G = sqrt( ( valueGx * valueGx ) + ( valueGy * valueGy ) );","\tgl_FragColor = vec4( vec3( G ), 1 );","}"].join("\n")};const Nh=e.ShaderChunk.meshphong_frag.slice(0,e.ShaderChunk.meshphong_frag.indexOf("void main() {")),Dh=e.ShaderChunk.meshphong_frag.slice(e.ShaderChunk.meshphong_frag.indexOf("void main() {")),Ih={uniforms:e.UniformsUtils.merge([e.ShaderLib.phong.uniforms,{thicknessMap:{value:null},thicknessColor:{value:new e.Color(16777215)},thicknessDistortion:{value:.1},thicknessAmbient:{value:0},thicknessAttenuation:{value:.1},thicknessPower:{value:2},thicknessScale:{value:10}}]),vertexShader:["#define USE_UV",e.ShaderChunk.meshphong_vert].join("\n"),fragmentShader:["#define USE_UV","#define SUBSURFACE",Nh,"uniform sampler2D thicknessMap;","uniform float thicknessPower;","uniform float thicknessScale;","uniform float thicknessDistortion;","uniform float thicknessAmbient;","uniform float thicknessAttenuation;","uniform vec3 thicknessColor;","void RE_Direct_Scattering(const in IncidentLight directLight, const in vec2 uv, const in GeometricContext geometry, inout ReflectedLight reflectedLight) {","\tvec3 thickness = thicknessColor * texture2D(thicknessMap, uv).r;","\tvec3 scatteringHalf = normalize(directLight.direction + (geometry.normal * thicknessDistortion));","\tfloat scatteringDot = pow(saturate(dot(geometry.viewDir, -scatteringHalf)), thicknessPower) * thicknessScale;","\tvec3 scatteringIllu = (scatteringDot + thicknessAmbient) * thickness;","\treflectedLight.directDiffuse += scatteringIllu * thicknessAttenuation * directLight.color;","}",Dh.replace("#include <lights_fragment_begin>",(Uh=e.ShaderChunk.lights_fragment_begin,Oh="RE_Direct( directLight, geometry, material, reflectedLight );",kh=["RE_Direct( directLight, geometry, material, reflectedLight );","#if defined( SUBSURFACE ) && defined( USE_UV )"," RE_Direct_Scattering(directLight, vUv, geometry, reflectedLight);","#endif"].join("\n"),Uh.split(Oh).join(kh)))].join("\n")};var Uh,Oh,kh;const Vh={uniforms:{tDiffuse:{value:null}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","varying vec2 vUv;","void main() {","\tvec4 tex = texture2D( tDiffuse, vec2( vUv.x, vUv.y ) );","\tvec4 newTex = vec4(tex.r, (tex.g + tex.b) * .5, (tex.g + tex.b) * .5, 1.0);","\tgl_FragColor = newTex;","}"].join("\n")},Gh={uniforms:{uDirLightPos:{value:new e.Vector3},uDirLightColor:{value:new e.Color(15658734)},uAmbientLightColor:{value:new e.Color(328965)},uBaseColor:{value:new e.Color(16777215)}},vertexShader:["varying vec3 vNormal;","varying vec3 vRefract;","void main() {","\tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );","\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );","\tvec3 worldNormal = normalize ( mat3( modelMatrix[0].xyz, modelMatrix[1].xyz, modelMatrix[2].xyz ) * normal );","\tvNormal = normalize( normalMatrix * normal );","\tvec3 I = worldPosition.xyz - cameraPosition;","\tvRefract = refract( normalize( I ), worldNormal, 1.02 );","\tgl_Position = projectionMatrix * mvPosition;","}"].join("\n"),fragmentShader:["uniform vec3 uBaseColor;","uniform vec3 uDirLightPos;","uniform vec3 uDirLightColor;","uniform vec3 uAmbientLightColor;","varying vec3 vNormal;","varying vec3 vRefract;","void main() {","\tfloat directionalLightWeighting = max( dot( normalize( vNormal ), uDirLightPos ), 0.0);","\tvec3 lightWeighting = uAmbientLightColor + uDirLightColor * directionalLightWeighting;","\tfloat intensity = smoothstep( - 0.5, 1.0, pow( length(lightWeighting), 20.0 ) );","\tintensity += length(lightWeighting) * 0.2;","\tfloat cameraWeighting = dot( normalize( vNormal ), vRefract );","\tintensity += pow( 1.0 - length( cameraWeighting ), 6.0 );","\tintensity = intensity * 0.2 + 0.3;","\tif ( intensity < 0.50 ) {","\t\tgl_FragColor = vec4( 2.0 * intensity * uBaseColor, 1.0 );","\t} else {","\t\tgl_FragColor = vec4( 1.0 - 2.0 * ( 1.0 - intensity ) * ( 1.0 - uBaseColor ), 1.0 );","}","}"].join("\n")},zh={uniforms:{uDirLightPos:{value:new e.Vector3},uDirLightColor:{value:new e.Color(15658734)},uAmbientLightColor:{value:new e.Color(328965)},uBaseColor:{value:new e.Color(15658734)},uLineColor1:{value:new e.Color(8421504)},uLineColor2:{value:new e.Color(0)},uLineColor3:{value:new e.Color(0)},uLineColor4:{value:new e.Color(0)}},vertexShader:["varying vec3 vNormal;","void main() {","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","\tvNormal = normalize( normalMatrix * normal );","}"].join("\n"),fragmentShader:["uniform vec3 uBaseColor;","uniform vec3 uLineColor1;","uniform vec3 uLineColor2;","uniform vec3 uLineColor3;","uniform vec3 uLineColor4;","uniform vec3 uDirLightPos;","uniform vec3 uDirLightColor;","uniform vec3 uAmbientLightColor;","varying vec3 vNormal;","void main() {","\tfloat camera = max( dot( normalize( vNormal ), vec3( 0.0, 0.0, 1.0 ) ), 0.4);","\tfloat light = max( dot( normalize( vNormal ), uDirLightPos ), 0.0);","\tgl_FragColor = vec4( uBaseColor, 1.0 );","\tif ( length(uAmbientLightColor + uDirLightColor * light) < 1.00 ) {","\t\tgl_FragColor *= vec4( uLineColor1, 1.0 );","\t}","\tif ( length(uAmbientLightColor + uDirLightColor * camera) < 0.50 ) {","\t\tgl_FragColor *= vec4( uLineColor2, 1.0 );","\t}","}"].join("\n")},Hh={uniforms:{uDirLightPos:{value:new e.Vector3},uDirLightColor:{value:new e.Color(15658734)},uAmbientLightColor:{value:new e.Color(328965)},uBaseColor:{value:new e.Color(16777215)},uLineColor1:{value:new e.Color(0)},uLineColor2:{value:new e.Color(0)},uLineColor3:{value:new e.Color(0)},uLineColor4:{value:new e.Color(0)}},vertexShader:["varying vec3 vNormal;","void main() {","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","\tvNormal = normalize( normalMatrix * normal );","}"].join("\n"),fragmentShader:["uniform vec3 uBaseColor;","uniform vec3 uLineColor1;","uniform vec3 uLineColor2;","uniform vec3 uLineColor3;","uniform vec3 uLineColor4;","uniform vec3 uDirLightPos;","uniform vec3 uDirLightColor;","uniform vec3 uAmbientLightColor;","varying vec3 vNormal;","void main() {","\tfloat directionalLightWeighting = max( dot( normalize(vNormal), uDirLightPos ), 0.0);","\tvec3 lightWeighting = uAmbientLightColor + uDirLightColor * directionalLightWeighting;","\tgl_FragColor = vec4( uBaseColor, 1.0 );","\tif ( length(lightWeighting) < 1.00 ) {","\t\tif ( mod(gl_FragCoord.x + gl_FragCoord.y, 10.0) == 0.0) {","\t\t\tgl_FragColor = vec4( uLineColor1, 1.0 );","\t\t}","\t}","\tif ( length(lightWeighting) < 0.75 ) {","\t\tif (mod(gl_FragCoord.x - gl_FragCoord.y, 10.0) == 0.0) {","\t\t\tgl_FragColor = vec4( uLineColor2, 1.0 );","\t\t}","\t}","\tif ( length(lightWeighting) < 0.50 ) {","\t\tif (mod(gl_FragCoord.x + gl_FragCoord.y - 5.0, 10.0) == 0.0) {","\t\t\tgl_FragColor = vec4( uLineColor3, 1.0 );","\t\t}","\t}","\tif ( length(lightWeighting) < 0.3465 ) {","\t\tif (mod(gl_FragCoord.x - gl_FragCoord.y - 5.0, 10.0) == 0.0) {","\t\t\tgl_FragColor = vec4( uLineColor4, 1.0 );","\t}","\t}","}"].join("\n")},jh={uniforms:{uDirLightPos:{value:new e.Vector3},uDirLightColor:{value:new e.Color(15658734)},uAmbientLightColor:{value:new e.Color(328965)},uBaseColor:{value:new e.Color(16777215)},uLineColor1:{value:new e.Color(0)}},vertexShader:["varying vec3 vNormal;","void main() {","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","\tvNormal = normalize( normalMatrix * normal );","}"].join("\n"),fragmentShader:["uniform vec3 uBaseColor;","uniform vec3 uLineColor1;","uniform vec3 uLineColor2;","uniform vec3 uLineColor3;","uniform vec3 uLineColor4;","uniform vec3 uDirLightPos;","uniform vec3 uDirLightColor;","uniform vec3 uAmbientLightColor;","varying vec3 vNormal;","void main() {","float directionalLightWeighting = max( dot( normalize(vNormal), uDirLightPos ), 0.0);","vec3 lightWeighting = uAmbientLightColor + uDirLightColor * directionalLightWeighting;","gl_FragColor = vec4( uBaseColor, 1.0 );","if ( length(lightWeighting) < 1.00 ) {","\t\tif ( ( mod(gl_FragCoord.x, 4.001) + mod(gl_FragCoord.y, 4.0) ) > 6.00 ) {","\t\t\tgl_FragColor = vec4( uLineColor1, 1.0 );","\t\t}","\t}","\tif ( length(lightWeighting) < 0.50 ) {","\t\tif ( ( mod(gl_FragCoord.x + 2.0, 4.001) + mod(gl_FragCoord.y + 2.0, 4.0) ) > 6.00 ) {","\t\t\tgl_FragColor = vec4( uLineColor1, 1.0 );","\t\t}","\t}","}"].join("\n")},Wh={uniforms:{texture:{value:null},delta:{value:new e.Vector2(1,1)}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["#include <common>","#define ITERATIONS 10.0","uniform sampler2D texture;","uniform vec2 delta;","varying vec2 vUv;","void main() {","\tvec4 color = vec4( 0.0 );","\tfloat total = 0.0;","\tfloat offset = rand( vUv );","\tfor ( float t = -ITERATIONS; t <= ITERATIONS; t ++ ) {","\t\tfloat percent = ( t + offset - 0.5 ) / ITERATIONS;","\t\tfloat weight = 1.0 - abs( percent );","\t\tcolor += texture2D( texture, vUv + delta * percent ) * weight;","\t\ttotal += weight;","\t}","\tgl_FragColor = color / total;","}"].join("\n")},Xh={uniforms:{tDiffuse:{value:null},v:{value:1/512}},vertexShader:"\n varying vec2 vUv;\n\n void main() {\n\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n }\n ",fragmentShader:"\n\n uniform sampler2D tDiffuse;\n uniform float v;\n\n varying vec2 vUv;\n\n void main() {\n\n vec4 sum = vec4( 0.0 );\n\n sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051;\n sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918;\n sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245;\n sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531;\n sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531;\n sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245;\n sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918;\n sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051;\n\n gl_FragColor = sum;\n\n }\n "},Qh={uniforms:{tDiffuse:{value:null},v:{value:1/512},r:{value:.35}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","uniform float v;","uniform float r;","varying vec2 vUv;","void main() {","\tvec4 sum = vec4( 0.0 );","\tfloat vv = v * abs( r - vUv.y );","\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * vv ) ) * 0.051;","\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * vv ) ) * 0.0918;","\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * vv ) ) * 0.12245;","\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * vv ) ) * 0.1531;","\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;","\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * vv ) ) * 0.1531;","\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * vv ) ) * 0.12245;","\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * vv ) ) * 0.0918;","\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * vv ) ) * 0.051;","\tgl_FragColor = sum;","}"].join("\n")},Yh={uniforms:{tDiffuse:{value:null},offset:{value:1},darkness:{value:1}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform float offset;","uniform float darkness;","uniform sampler2D tDiffuse;","varying vec2 vUv;","void main() {","\tvec4 texel = texture2D( tDiffuse, vUv );","\tvec2 uv = ( vUv - vec2( 0.5 ) ) * vec2( offset );","\tgl_FragColor = vec4( mix( texel.rgb, vec3( 1.0 - darkness ), dot( uv, uv ) ), texel.a );","}"].join("\n")},Kh={uniforms:{u_size:{value:new e.Vector3(1,1,1)},u_renderstyle:{value:0},u_renderthreshold:{value:.5},u_clim:{value:new e.Vector2(1,1)},u_data:{value:null},u_cmdata:{value:null}},vertexShader:["\t\tvarying vec4 v_nearpos;","\t\tvarying vec4 v_farpos;","\t\tvarying vec3 v_position;","\t\tvoid main() {","\t\t\t\tmat4 viewtransformf = modelViewMatrix;","\t\t\t\tmat4 viewtransformi = inverse(modelViewMatrix);","\t\t\t\tvec4 position4 = vec4(position, 1.0);","\t\t\t\tvec4 pos_in_cam = viewtransformf * position4;","\t\t\t\tpos_in_cam.z = -pos_in_cam.w;","\t\t\t\tv_nearpos = viewtransformi * pos_in_cam;","\t\t\t\tpos_in_cam.z = pos_in_cam.w;","\t\t\t\tv_farpos = viewtransformi * pos_in_cam;","\t\t\t\tv_position = position;","\t\t\t\tgl_Position = projectionMatrix * viewMatrix * modelMatrix * position4;","\t\t}"].join("\n"),fragmentShader:["\t\tprecision highp float;","\t\tprecision mediump sampler3D;","\t\tuniform vec3 u_size;","\t\tuniform int u_renderstyle;","\t\tuniform float u_renderthreshold;","\t\tuniform vec2 u_clim;","\t\tuniform sampler3D u_data;","\t\tuniform sampler2D u_cmdata;","\t\tvarying vec3 v_position;","\t\tvarying vec4 v_nearpos;","\t\tvarying vec4 v_farpos;","\t\tconst int MAX_STEPS = 887;\t// 887 for 512^3, 1774 for 1024^3","\t\tconst int REFINEMENT_STEPS = 4;","\t\tconst float relative_step_size = 1.0;","\t\tconst vec4 ambient_color = vec4(0.2, 0.4, 0.2, 1.0);","\t\tconst vec4 diffuse_color = vec4(0.8, 0.2, 0.2, 1.0);","\t\tconst vec4 specular_color = vec4(1.0, 1.0, 1.0, 1.0);","\t\tconst float shininess = 40.0;","\t\tvoid cast_mip(vec3 start_loc, vec3 step, int nsteps, vec3 view_ray);","\t\tvoid cast_iso(vec3 start_loc, vec3 step, int nsteps, vec3 view_ray);","\t\tfloat sample1(vec3 texcoords);","\t\tvec4 apply_colormap(float val);","\t\tvec4 add_lighting(float val, vec3 loc, vec3 step, vec3 view_ray);","\t\tvoid main() {","\t\t\t\tvec3 farpos = v_farpos.xyz / v_farpos.w;","\t\t\t\tvec3 nearpos = v_nearpos.xyz / v_nearpos.w;","\t\t\t\tvec3 view_ray = normalize(nearpos.xyz - farpos.xyz);","\t\t\t\tfloat distance = dot(nearpos - v_position, view_ray);","\t\t\t\tdistance = max(distance, min((-0.5 - v_position.x) / view_ray.x,","\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(u_size.x - 0.5 - v_position.x) / view_ray.x));","\t\t\t\tdistance = max(distance, min((-0.5 - v_position.y) / view_ray.y,","\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(u_size.y - 0.5 - v_position.y) / view_ray.y));","\t\t\t\tdistance = max(distance, min((-0.5 - v_position.z) / view_ray.z,","\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(u_size.z - 0.5 - v_position.z) / view_ray.z));","\t\t\t\tvec3 front = v_position + view_ray * distance;","\t\t\t\tint nsteps = int(-distance / relative_step_size + 0.5);","\t\t\t\tif ( nsteps < 1 )","\t\t\t\t\t\tdiscard;","\t\t\t\tvec3 step = ((v_position - front) / u_size) / float(nsteps);","\t\t\t\tvec3 start_loc = front / u_size;","\t\t\t\tif (u_renderstyle == 0)","\t\t\t\t\t\tcast_mip(start_loc, step, nsteps, view_ray);","\t\t\t\telse if (u_renderstyle == 1)","\t\t\t\t\t\tcast_iso(start_loc, step, nsteps, view_ray);","\t\t\t\tif (gl_FragColor.a < 0.05)","\t\t\t\t\t\tdiscard;","\t\t}","\t\tfloat sample1(vec3 texcoords) {","\t\t\t\t/* Sample float value from a 3D texture. Assumes intensity data. */","\t\t\t\treturn texture(u_data, texcoords.xyz).r;","\t\t}","\t\tvec4 apply_colormap(float val) {","\t\t\t\tval = (val - u_clim[0]) / (u_clim[1] - u_clim[0]);","\t\t\t\treturn texture2D(u_cmdata, vec2(val, 0.5));","\t\t}","\t\tvoid cast_mip(vec3 start_loc, vec3 step, int nsteps, vec3 view_ray) {","\t\t\t\tfloat max_val = -1e6;","\t\t\t\tint max_i = 100;","\t\t\t\tvec3 loc = start_loc;","\t\t\t\tfor (int iter=0; iter<MAX_STEPS; iter++) {","\t\t\t\t\t\tif (iter >= nsteps)","\t\t\t\t\t\t\t\tbreak;","\t\t\t\t\t\tfloat val = sample1(loc);","\t\t\t\t\t\tif (val > max_val) {","\t\t\t\t\t\t\t\tmax_val = val;","\t\t\t\t\t\t\t\tmax_i = iter;","\t\t\t\t\t\t}","\t\t\t\t\t\tloc += step;","\t\t\t\t}","\t\t\t\tvec3 iloc = start_loc + step * (float(max_i) - 0.5);","\t\t\t\tvec3 istep = step / float(REFINEMENT_STEPS);","\t\t\t\tfor (int i=0; i<REFINEMENT_STEPS; i++) {","\t\t\t\t\t\tmax_val = max(max_val, sample1(iloc));","\t\t\t\t\t\tiloc += istep;","\t\t\t\t}","\t\t\t\tgl_FragColor = apply_colormap(max_val);","\t\t}","\t\tvoid cast_iso(vec3 start_loc, vec3 step, int nsteps, vec3 view_ray) {","\t\t\t\tgl_FragColor = vec4(0.0);\t// init transparent","\t\t\t\tvec4 color3 = vec4(0.0);\t// final color","\t\t\t\tvec3 dstep = 1.5 / u_size;\t// step to sample derivative","\t\t\t\tvec3 loc = start_loc;","\t\t\t\tfloat low_threshold = u_renderthreshold - 0.02 * (u_clim[1] - u_clim[0]);","\t\t\t\tfor (int iter=0; iter<MAX_STEPS; iter++) {","\t\t\t\t\t\tif (iter >= nsteps)","\t\t\t\t\t\t\t\tbreak;","\t\t\t\t\t\tfloat val = sample1(loc);","\t\t\t\t\t\tif (val > low_threshold) {","\t\t\t\t\t\t\t\tvec3 iloc = loc - 0.5 * step;","\t\t\t\t\t\t\t\tvec3 istep = step / float(REFINEMENT_STEPS);","\t\t\t\t\t\t\t\tfor (int i=0; i<REFINEMENT_STEPS; i++) {","\t\t\t\t\t\t\t\t\t\tval = sample1(iloc);","\t\t\t\t\t\t\t\t\t\tif (val > u_renderthreshold) {","\t\t\t\t\t\t\t\t\t\t\t\tgl_FragColor = add_lighting(val, iloc, dstep, view_ray);","\t\t\t\t\t\t\t\t\t\t\t\treturn;","\t\t\t\t\t\t\t\t\t\t}","\t\t\t\t\t\t\t\t\t\tiloc += istep;","\t\t\t\t\t\t\t\t}","\t\t\t\t\t\t}","\t\t\t\t\t\tloc += step;","\t\t\t\t}","\t\t}","\t\tvec4 add_lighting(float val, vec3 loc, vec3 step, vec3 view_ray)","\t\t{","\t\t\t\tvec3 V = normalize(view_ray);","\t\t\t\tvec3 N;","\t\t\t\tfloat val1, val2;","\t\t\t\tval1 = sample1(loc + vec3(-step[0], 0.0, 0.0));","\t\t\t\tval2 = sample1(loc + vec3(+step[0], 0.0, 0.0));","\t\t\t\tN[0] = val1 - val2;","\t\t\t\tval = max(max(val1, val2), val);","\t\t\t\tval1 = sample1(loc + vec3(0.0, -step[1], 0.0));","\t\t\t\tval2 = sample1(loc + vec3(0.0, +step[1], 0.0));","\t\t\t\tN[1] = val1 - val2;","\t\t\t\tval = max(max(val1, val2), val);","\t\t\t\tval1 = sample1(loc + vec3(0.0, 0.0, -step[2]));","\t\t\t\tval2 = sample1(loc + vec3(0.0, 0.0, +step[2]));","\t\t\t\tN[2] = val1 - val2;","\t\t\t\tval = max(max(val1, val2), val);","\t\t\t\tfloat gm = length(N); // gradient magnitude","\t\t\t\tN = normalize(N);","\t\t\t\tfloat Nselect = float(dot(N, V) > 0.0);","\t\t\t\tN = (2.0 * Nselect - 1.0) * N;\t// ==\tNselect * N - (1.0-Nselect)*N;","\t\t\t\tvec4 ambient_color = vec4(0.0, 0.0, 0.0, 0.0);","\t\t\t\tvec4 diffuse_color = vec4(0.0, 0.0, 0.0, 0.0);","\t\t\t\tvec4 specular_color = vec4(0.0, 0.0, 0.0, 0.0);","\t\t\t\tfor (int i=0; i<1; i++)","\t\t\t\t{","\t\t\t\t\t\tvec3 L = normalize(view_ray);\t//lightDirs[i];","\t\t\t\t\t\tfloat lightEnabled = float( length(L) > 0.0 );","\t\t\t\t\t\tL = normalize(L + (1.0 - lightEnabled));","\t\t\t\t\t\tfloat lambertTerm = clamp(dot(N, L), 0.0, 1.0);","\t\t\t\t\t\tvec3 H = normalize(L+V); // Halfway vector","\t\t\t\t\t\tfloat specularTerm = pow(max(dot(H, N), 0.0), shininess);","\t\t\t\t\t\tfloat mask1 = lightEnabled;","\t\t\t\t\t\tambient_color +=\tmask1 * ambient_color;\t// * gl_LightSource[i].ambient;","\t\t\t\t\t\tdiffuse_color +=\tmask1 * lambertTerm;","\t\t\t\t\t\tspecular_color += mask1 * specularTerm * specular_color;","\t\t\t\t}","\t\t\t\tvec4 final_color;","\t\t\t\tvec4 color = apply_colormap(val);","\t\t\t\tfinal_color = color * (ambient_color + diffuse_color) + specular_color;","\t\t\t\tfinal_color.a = color.a;","\t\t\t\treturn final_color;","\t\t}"].join("\n")},qh={uniforms:{color:{value:null},time:{value:0},tDiffuse:{value:null},tDudv:{value:null},textureMatrix:{value:null}},vertexShader:["uniform mat4 textureMatrix;","varying vec2 vUv;","varying vec4 vUvRefraction;","void main() {","\tvUv = uv;","\tvUvRefraction = textureMatrix * vec4( position, 1.0 );","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform vec3 color;","uniform float time;","uniform sampler2D tDiffuse;","uniform sampler2D tDudv;","varying vec2 vUv;","varying vec4 vUvRefraction;","float blendOverlay( float base, float blend ) {","\treturn( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) );","}","vec3 blendOverlay( vec3 base, vec3 blend ) {","\treturn vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ),blendOverlay( base.b, blend.b ) );","}","void main() {"," float waveStrength = 0.1;"," float waveSpeed = 0.03;","\tvec2 distortedUv = texture2D( tDudv, vec2( vUv.x + time * waveSpeed, vUv.y ) ).rg * waveStrength;","\tdistortedUv = vUv.xy + vec2( distortedUv.x, distortedUv.y + time * waveSpeed );","\tvec2 distortion = ( texture2D( tDudv, distortedUv ).rg * 2.0 - 1.0 ) * waveStrength;"," vec4 uv = vec4( vUvRefraction );"," uv.xy += distortion;","\tvec4 base = texture2DProj( tDiffuse, uv );","\tgl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 );","}"].join("\n")};class Jh extends e.Mesh{constructor(t){const r=new Zh(t),i=new e.PlaneGeometry(.001*r.image.width,.001*r.image.height),n=new e.MeshBasicMaterial({map:r,toneMapped:!1,transparent:!0});function s(e){n.map.dispatchDOMEvent(e)}super(i,n),this.addEventListener("mousedown",s),this.addEventListener("mousemove",s),this.addEventListener("mouseup",s),this.addEventListener("click",s),this.dispose=function(){i.dispose(),n.dispose(),n.map.dispose(),$h.delete(t),this.removeEventListener("mousedown",s),this.removeEventListener("mousemove",s),this.removeEventListener("mouseup",s),this.removeEventListener("click",s)}}}class Zh extends e.CanvasTexture{constructor(t){super(eu(t)),this.dom=t,this.anisotropy=16,"colorSpace"in this?this.colorSpace="srgb":this.encoding=3001,this.minFilter=e.LinearFilter,this.magFilter=e.LinearFilter;const r=new MutationObserver((()=>{this.scheduleUpdate||(this.scheduleUpdate=setTimeout((()=>this.update()),16))}));r.observe(t,{attributes:!0,childList:!0,subtree:!0,characterData:!0}),this.observer=r}dispatchDOMEvent(e){e.data&&function(e,t,r,i){const n={clientX:r*e.offsetWidth+e.offsetLeft,clientY:i*e.offsetHeight+e.offsetTop,view:e.ownerDocument.defaultView};window.dispatchEvent(new MouseEvent(t,n));const s=e.getBoundingClientRect();function o(e){if(e.nodeType!==Node.TEXT_NODE&&e.nodeType!==Node.COMMENT_NODE){const s=e.getBoundingClientRect();if(r>s.left&&r<s.right&&i>s.top&&i<s.bottom&&(e.dispatchEvent(new MouseEvent(t,n)),e instanceof HTMLInputElement&&"range"===e.type&&("mousedown"===t||"click"===t))){const[t,i]=["min","max"].map((t=>parseFloat(e[t]))),n=s.width,o=(r-s.x)/n;e.value=t+(i-t)*o,e.dispatchEvent(new InputEvent("input",{bubbles:!0}))}for(let t=0;t<e.childNodes.length;t++)o(e.childNodes[t])}}r=r*s.width+s.left,i=i*s.height+s.top,o(e)}(this.dom,e.type,e.data.x,e.data.y)}update(){this.image=eu(this.dom),this.needsUpdate=!0,this.scheduleUpdate=null}dispose(){this.observer&&this.observer.disconnect(),this.scheduleUpdate=clearTimeout(this.scheduleUpdate),super.dispose()}}const $h=new WeakMap;function eu(t){const r=document.createRange(),i=new e.Color;function n(e,t,r,i){""!==i&&("uppercase"===e.textTransform&&(i=i.toUpperCase()),c.font=e.fontWeight+" "+e.fontSize+" "+e.fontFamily,c.textBaseline="top",c.fillStyle=e.color,c.fillText(i,t,r+.1*parseFloat(e.fontSize)))}function s(e,t,r,i,n){r<2*n&&(n=r/2),i<2*n&&(n=i/2),c.beginPath(),c.moveTo(e+n,t),c.arcTo(e+r,t,e+r,t+i,n),c.arcTo(e+r,t+i,e,t+i,n),c.arcTo(e,t+i,e,t,n),c.arcTo(e,t,e+r,t,n),c.closePath()}function o(e,t,r,i,n,s){const o=e[t+"Width"],a=e[t+"Style"],l=e[t+"Color"];"0px"!==o&&"none"!==a&&"transparent"!==l&&"rgba(0, 0, 0, 0)"!==l&&(c.strokeStyle=l,c.lineWidth=parseFloat(o),c.beginPath(),c.moveTo(r,i),c.lineTo(r+n,i+s),c.stroke())}const a=t.getBoundingClientRect();let l=$h.get(t);void 0===l&&(l=document.createElement("canvas"),l.width=a.width,l.height=a.height,$h.set(t,l));const c=l.getContext("2d"),h=new function(e){const t=[];let r=!1;function i(){if(r&&(r=!1,e.restore()),0===t.length)return;let i=-1/0,n=-1/0,s=1/0,o=1/0;for(let e=0;e<t.length;e++){const r=t[e];i=Math.max(i,r.x),n=Math.max(n,r.y),s=Math.min(s,r.x+r.width),o=Math.min(o,r.y+r.height)}e.save(),e.beginPath(),e.rect(i,n,s-i,o-n),e.clip(),r=!0}return{add:function(e){t.push(e),i()},remove:function(){t.pop(),i()}}}(c);return function e(t,l){let u=0,d=0,p=0,m=0;if(t.nodeType===Node.TEXT_NODE){r.selectNode(t);const e=r.getBoundingClientRect();u=e.left-a.left-.5,d=e.top-a.top-.5,p=e.width,m=e.height,n(l,u,d,t.nodeValue.trim())}else{if(t.nodeType===Node.COMMENT_NODE)return;if(t instanceof HTMLCanvasElement){if("none"===t.style.display)return;c.save();const e=window.devicePixelRatio;c.scale(1/e,1/e),c.drawImage(t,0,0),c.restore()}else{if("none"===t.style.display)return;const e=t.getBoundingClientRect();u=e.left-a.left-.5,d=e.top-a.top-.5,p=e.width,m=e.height,l=window.getComputedStyle(t),s(u,d,p,m,parseFloat(l.borderRadius));const r=l.backgroundColor;"transparent"!==r&&"rgba(0, 0, 0, 0)"!==r&&(c.fillStyle=r,c.fill());const f=["borderTop","borderLeft","borderBottom","borderRight"];let g=!0,v=null;for(const e of f){if(null!==v&&(g=l[e+"Width"]===l[v+"Width"]&&l[e+"Color"]===l[v+"Color"]&&l[e+"Style"]===l[v+"Style"]),!1===g)break;v=e}if(!0===g){const e=parseFloat(l.borderTopWidth);"0px"!==l.borderTopWidth&&"none"!==l.borderTopStyle&&"transparent"!==l.borderTopColor&&"rgba(0, 0, 0, 0)"!==l.borderTopColor&&(c.strokeStyle=l.borderTopColor,c.lineWidth=e,c.stroke())}else o(l,"borderTop",u,d,p,0),o(l,"borderLeft",u,d,0,m),o(l,"borderBottom",u,d+m,p,0),o(l,"borderRight",u+p,d,0,m);if(t instanceof HTMLInputElement){let e=l.accentColor;void 0!==e&&"auto"!==e||(e=l.color),i.set(e);const r=Math.sqrt(.299*i.r**2+.587*i.g**2+.114*i.b**2)<.5?"white":"#111111";if("radio"===t.type&&(s(u,d,p,m,m),c.fillStyle="white",c.strokeStyle=e,c.lineWidth=1,c.fill(),c.stroke(),t.checked&&(s(u+2,d+2,p-4,m-4,m),c.fillStyle=e,c.strokeStyle=r,c.lineWidth=2,c.fill(),c.stroke())),"checkbox"===t.type&&(s(u,d,p,m,2),c.fillStyle=t.checked?e:"white",c.strokeStyle=t.checked?r:e,c.lineWidth=1,c.stroke(),c.fill(),t.checked)){const e=c.textAlign;c.textAlign="center";n({color:r,fontFamily:l.fontFamily,fontSize:m+"px",fontWeight:"bold"},u+p/2,d,"✔"),c.textAlign=e}if("range"===t.type){const[i,n,o]=["min","max","value"].map((e=>parseFloat(t[e]))),a=(o-i)/(n-i)*(p-m);s(u,d+m/4,p,m/2,m/4),c.fillStyle=r,c.strokeStyle=e,c.lineWidth=1,c.fill(),c.stroke(),s(u,d+m/4,a+m/2,m/2,m/4),c.fillStyle=e,c.fill(),s(u+a,d,m,m,m/2),c.fillStyle=e,c.fill()}"color"!==t.type&&"text"!==t.type&&"number"!==t.type||(h.add({x:u,y:d,width:p,height:m}),n(l,u+parseInt(l.paddingLeft),d+parseInt(l.paddingTop),t.value),h.remove())}}}const f="auto"===l.overflow||"hidden"===l.overflow;f&&h.add({x:u,y:d,width:p,height:m});for(let r=0;r<t.childNodes.length;r++)e(t.childNodes[r],l);f&&h.remove()}(t),l}const tu=new e.Vector2,ru={type:"",data:tu};class iu extends e.Group{constructor(t,r){super();const i=this,n=new e.Raycaster,s=new e.Matrix4,o=t.domElement;function a(e){e.stopPropagation(),tu.x=e.clientX/o.clientWidth*2-1,tu.y=-e.clientY/o.clientHeight*2+1,n.setFromCamera(tu,r);const t=n.intersectObjects(i.children,!1);if(t.length>0){const r=t[0],i=r.object,n=r.uv;ru.type=e.type,ru.data.set(n.x,1-n.y),i.dispatchEvent(ru)}}o.addEventListener("pointerdown",a),o.addEventListener("pointerup",a),o.addEventListener("pointermove",a),o.addEventListener("mousedown",a),o.addEventListener("mouseup",a),o.addEventListener("mousemove",a),o.addEventListener("click",a);const l={move:"mousemove",select:"click",selectstart:"mousedown",selectend:"mouseup"};function c(e){const t=e.target;s.identity().extractRotation(t.matrixWorld),n.ray.origin.setFromMatrixPosition(t.matrixWorld),n.ray.direction.set(0,0,-1).applyMatrix4(s);const r=n.intersectObjects(i.children,!1);if(r.length>0){const t=r[0],i=t.object,n=t.uv;ru.type=l[e.type],ru.data.set(n.x,1-n.y),i.dispatchEvent(ru)}}const h=t.xr.getController(0);h.addEventListener("move",c),h.addEventListener("select",c),h.addEventListener("selectstart",c),h.addEventListener("selectend",c);const u=t.xr.getController(1);u.addEventListener("move",c),u.addEventListener("select",c),u.addEventListener("selectstart",c),u.addEventListener("selectend",c)}}const nu=class{constructor(t,r,i){this.element=document.createElement("div"),this.element.classList.add(i),this.element.style.pointerEvents="none",this.renderer=r,this.startPoint=new e.Vector2,this.pointTopLeft=new e.Vector2,this.pointBottomRight=new e.Vector2,this.isDown=!1,this.renderer.domElement.addEventListener("pointerdown",(e=>{this.isDown=!0,this.onSelectStart(e)})),this.renderer.domElement.addEventListener("pointermove",(e=>{this.isDown&&this.onSelectMove(e)})),this.renderer.domElement.addEventListener("pointerup",(e=>{this.isDown=!1,this.onSelectOver(e)}))}onSelectStart(e){this.renderer.domElement.parentElement.appendChild(this.element),this.element.style.left=`${e.clientX}px`,this.element.style.top=`${e.clientY}px`,this.element.style.width="0px",this.element.style.height="0px",this.startPoint.x=e.clientX,this.startPoint.y=e.clientY}onSelectMove(e){this.pointBottomRight.x=Math.max(this.startPoint.x,e.clientX),this.pointBottomRight.y=Math.max(this.startPoint.y,e.clientY),this.pointTopLeft.x=Math.min(this.startPoint.x,e.clientX),this.pointTopLeft.y=Math.min(this.startPoint.y,e.clientY),this.element.style.left=`${this.pointTopLeft.x}px`,this.element.style.top=`${this.pointTopLeft.y}px`,this.element.style.width=this.pointBottomRight.x-this.pointTopLeft.x+"px",this.element.style.height=this.pointBottomRight.y-this.pointTopLeft.y+"px"}onSelectOver(){this.element.parentElement.removeChild(this.element)}},su=(()=>{const t=new e.Frustum,r=new e.Vector3,i=new e.Vector3,n=new e.Vector3,s=new e.Vector3,o=new e.Vector3,a=new e.Vector3,l=new e.Vector3,c=new e.Vector3,h=new e.Vector3,u=new e.Vector3,d=new e.Vector3,p=new e.Vector3,m=new e.Vector3,f=new e.Vector3;return class{constructor(t,r,i){this.camera=t,this.scene=r,this.startPoint=new e.Vector3,this.endPoint=new e.Vector3,this.collection=[],this.deep=i||Number.MAX_VALUE}select(e,r){return this.startPoint=e||this.startPoint,this.endPoint=r||this.endPoint,this.collection=[],this.updateFrustum(this.startPoint,this.endPoint),this.searchChildInFrustum(t,this.scene),this.collection}updateFrustum(e,r){if(e=e||this.startPoint,r=r||this.endPoint,e.x===r.x&&(r.x+=Number.EPSILON),e.y===r.y&&(r.y+=Number.EPSILON),this.camera.updateProjectionMatrix(),this.camera.updateMatrixWorld(),this.camera.isPerspectiveCamera)i.copy(e),i.x=Math.min(e.x,r.x),i.y=Math.max(e.y,r.y),r.x=Math.max(e.x,r.x),r.y=Math.min(e.y,r.y),n.setFromMatrixPosition(this.camera.matrixWorld),s.copy(i),o.set(r.x,i.y,0),a.copy(r),l.set(i.x,r.y,0),s.unproject(this.camera),o.unproject(this.camera),a.unproject(this.camera),l.unproject(this.camera),p.copy(s).sub(n),m.copy(o).sub(n),f.copy(a).sub(n),p.normalize(),m.normalize(),f.normalize(),p.multiplyScalar(this.deep),m.multiplyScalar(this.deep),f.multiplyScalar(this.deep),p.add(n),m.add(n),f.add(n),(g=t.planes)[0].setFromCoplanarPoints(n,s,o),g[1].setFromCoplanarPoints(n,o,a),g[2].setFromCoplanarPoints(a,l,n),g[3].setFromCoplanarPoints(l,s,n),g[4].setFromCoplanarPoints(o,a,l),g[5].setFromCoplanarPoints(f,m,p),g[5].normal.multiplyScalar(-1);else if(this.camera.isOrthographicCamera){const i=Math.min(e.x,r.x),n=Math.max(e.y,r.y),p=Math.max(e.x,r.x),m=Math.min(e.y,r.y);var g;s.set(i,n,-1),o.set(p,n,-1),a.set(p,m,-1),l.set(i,m,-1),c.set(i,n,1),h.set(p,n,1),u.set(p,m,1),d.set(i,m,1),s.unproject(this.camera),o.unproject(this.camera),a.unproject(this.camera),l.unproject(this.camera),c.unproject(this.camera),h.unproject(this.camera),u.unproject(this.camera),d.unproject(this.camera),(g=t.planes)[0].setFromCoplanarPoints(s,c,h),g[1].setFromCoplanarPoints(o,h,u),g[2].setFromCoplanarPoints(u,d,l),g[3].setFromCoplanarPoints(d,c,s),g[4].setFromCoplanarPoints(o,a,l),g[5].setFromCoplanarPoints(u,h,c),g[5].normal.multiplyScalar(-1)}else console.error("THREE.SelectionBox: Unsupported camera type.")}searchChildInFrustum(e,t){if((t.isMesh||t.isLine||t.isPoints)&&void 0!==t.material&&(null===t.geometry.boundingSphere&&t.geometry.computeBoundingSphere(),r.copy(t.geometry.boundingSphere.center),r.applyMatrix4(t.matrixWorld),e.containsPoint(r)&&this.collection.push(t)),t.children.length>0)for(let r=0;r<t.children.length;r++)this.searchChildInFrustum(e,t.children[r])}}})();function ou(e,t,r,i){const n=t.x(),s=t.y(),o=t.z(),a=t.w(),l=n+n,c=s+s,h=o+o,u=n*l,d=n*c,p=n*h,m=s*c,f=s*h,g=o*h,v=a*l,x=a*c,y=a*h;r[i+0]=1-(m+g),r[i+1]=d+y,r[i+2]=p-x,r[i+3]=0,r[i+4]=d-y,r[i+5]=1-(u+g),r[i+6]=f+v,r[i+7]=0,r[i+8]=p+x,r[i+9]=f-v,r[i+10]=1-(u+m),r[i+11]=0,r[i+12]=e.x(),r[i+13]=e.y(),r[i+14]=e.z(),r[i+15]=1}function au(e,t,r){const i=r.length-e-1;if(t>=r[i])return i-1;if(t<=r[e])return e;let n=e,s=i,o=Math.floor((n+s)/2);for(;t<r[o]||t>=r[o+1];)t<r[o]?s=o:n=o,o=Math.floor((n+s)/2);return o}function lu(e,t,r,i){const n=[],s=[],o=[];n[0]=1;for(let a=1;a<=r;++a){s[a]=t-i[e+1-a],o[a]=i[e+a]-t;let r=0;for(let e=0;e<a;++e){const t=o[e+1],i=s[a-e],l=n[e]/(t+i);n[e]=r+t*l,r=i*l}n[a]=r}return n}function cu(t,r,i,n){const s=au(t,n,r),o=lu(s,n,t,r),a=new e.Vector4(0,0,0,0);for(let e=0;e<=t;++e){const r=i[s-t+e],n=o[e],l=r.w*n;a.x+=r.x*l,a.y+=r.y*l,a.z+=r.z*l,a.w+=r.w*n}return a}function hu(e,t,r,i,n){const s=[];for(let e=0;e<=r;++e)s[e]=0;const o=[];for(let e=0;e<=i;++e)o[e]=s.slice(0);const a=[];for(let e=0;e<=r;++e)a[e]=s.slice(0);a[0][0]=1;const l=s.slice(0),c=s.slice(0);for(let i=1;i<=r;++i){l[i]=t-n[e+1-i],c[i]=n[e+i]-t;let r=0;for(let e=0;e<i;++e){const t=c[e+1],n=l[i-e];a[i][e]=t+n;const s=a[e][i-1]/a[i][e];a[e][i]=r+t*s,r=n*s}a[i][i]=r}for(let e=0;e<=r;++e)o[0][e]=a[e][r];for(let e=0;e<=r;++e){let t=0,n=1;const l=[];for(let e=0;e<=r;++e)l[e]=s.slice(0);l[0][0]=1;for(let s=1;s<=i;++s){let i=0;const c=e-s,u=r-s;e>=s&&(l[n][0]=l[t][0]/a[u+1][c],i=l[n][0]*a[c][u]);const d=e-1<=u?s-1:r-e;for(let e=c>=-1?1:-c;e<=d;++e)l[n][e]=(l[t][e]-l[t][e-1])/a[u+1][c+e],i+=l[n][e]*a[c+e][u];e<=u&&(l[n][s]=-l[t][s-1]/a[u+1][e],i+=l[n][s]*a[e][u]),o[s][e]=i;var h=t;t=n,n=h}}var u=r;for(let e=1;e<=i;++e){for(let t=0;t<=r;++t)o[e][t]*=u;u*=r-e}return o}function uu(t,r,i,n,s){const o=s<t?s:t,a=[],l=au(t,n,r),c=hu(l,n,t,o,r),h=[];for(let e=0;e<i.length;++e){const t=(u=i[e].clone()).w;u.x*=t,u.y*=t,u.z*=t,h[e]=u}for(let e=0;e<=o;++e){var u=h[l-t].clone().multiplyScalar(c[e][0]);for(let r=1;r<=t;++r)u.add(h[l-t+r].clone().multiplyScalar(c[e][r]));a[e]=u}for(let t=o+1;t<=s+1;++t)a[t]=new e.Vector4(0,0,0);return a}function du(e,t){let r=1;for(let t=2;t<=e;++t)r*=t;let i=1;for(let e=2;e<=t;++e)i*=e;for(let r=2;r<=e-t;++r)i*=r;return r/i}function pu(t){const r=t.length,i=[],n=[];for(let s=0;s<r;++s){const r=t[s];i[s]=new e.Vector3(r.x,r.y,r.z),n[s]=r.w}const s=[];for(let e=0;e<r;++e){const t=i[e].clone();for(let r=1;r<=e;++r)t.sub(s[e-r].clone().multiplyScalar(du(e,r)*n[r]));s[e]=t.divideScalar(n[0])}return s}function mu(e,t,r,i,n){return pu(uu(e,t,r,i,n))}function fu(t,r,i,n,s,o,a,l){const c=au(t,o,i),h=au(r,a,n),u=lu(c,o,t,i),d=lu(h,a,r,n),p=[];for(let i=0;i<=r;++i){p[i]=new e.Vector4(0,0,0,0);for(let e=0;e<=t;++e){const n=s[c-t+e][h-r+i].clone(),o=n.w;n.x*=o,n.y*=o,n.z*=o,p[i].add(n.multiplyScalar(u[e]))}}const m=new e.Vector4(0,0,0,0);for(let e=0;e<=r;++e)m.add(p[e].multiplyScalar(d[e]));m.divideScalar(m.w),l.set(m.x,m.y,m.z)}class gu extends e.Curve{constructor(t,r,i,n,s){super(),this.degree=t,this.knots=r,this.controlPoints=[],this.startKnot=n||0,this.endKnot=s||this.knots.length-1;for(let t=0;t<i.length;++t){const r=i[t];this.controlPoints[t]=new e.Vector4(r.x,r.y,r.z,r.w)}}getPoint(t,r){const i=r||new e.Vector3,n=this.knots[this.startKnot]+t*(this.knots[this.endKnot]-this.knots[this.startKnot]),s=cu(this.degree,this.knots,this.controlPoints,n);return 1!=s.w&&s.divideScalar(s.w),i.set(s.x,s.y,s.z)}getTangent(t,r){const i=r||new e.Vector3,n=this.knots[0]+t*(this.knots[this.knots.length-1]-this.knots[0]),s=mu(this.degree,this.knots,this.controlPoints,n,1);return i.copy(s[1]).normalize(),i}}let vu,xu,yu;class bu extends e.Loader{constructor(e){super(e)}load(t,r,i,n){const s=this,o=""===s.path?e.LoaderUtils.extractUrlBase(t):s.path,a=new e.FileLoader(this.manager);a.setPath(s.path),a.setResponseType("arraybuffer"),a.setRequestHeader(s.requestHeader),a.setWithCredentials(s.withCredentials),a.load(t,(function(e){try{r(s.parse(e,o))}catch(e){n?n(e):console.error(e),s.manager.itemError(t)}}),i,n)}parse(t,r){if(function(e){const t="Kaydara FBX Binary \0";return e.byteLength>=t.length&&t===Uu(e,0,t.length)}(t))vu=(new Su).parse(t);else{const e=Uu(t);if(!function(e){const t=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"];let r=0;function i(t){const i=e[t-1];return e=e.slice(r+t),r++,i}for(let e=0;e<t.length;++e){if(i(1)===t[e])return!1}return!0}(e))throw new Error("THREE.FBXLoader: Unknown format.");if(Eu(e)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+Eu(e));vu=(new Tu).parse(e)}const i=new e.TextureLoader(this.manager).setPath(this.resourcePath||r).setCrossOrigin(this.crossOrigin);return new Au(i,this.manager).parse(vu)}}class Au{constructor(e,t){this.textureLoader=e,this.manager=t}parse(){xu=this.parseConnections();const e=this.parseImages(),t=this.parseTextures(e),r=this.parseMaterials(t),i=this.parseDeformers(),n=(new wu).parse(i);return this.parseScene(i,n,r),yu}parseConnections(){const e=new Map;if("Connections"in vu){vu.Connections.connections.forEach((function(t){const r=t[0],i=t[1],n=t[2];e.has(r)||e.set(r,{parents:[],children:[]});const s={ID:i,relationship:n};e.get(r).parents.push(s),e.has(i)||e.set(i,{parents:[],children:[]});const o={ID:r,relationship:n};e.get(i).children.push(o)}))}return e}parseImages(){const e={},t={};if("Video"in vu.Objects){const r=vu.Objects.Video;for(const i in r){const n=r[i];if(e[parseInt(i)]=n.RelativeFilename||n.Filename,"Content"in n){const e=n.Content instanceof ArrayBuffer&&n.Content.byteLength>0,s="string"==typeof n.Content&&""!==n.Content;if(e||s){const e=this.parseImage(r[i]);t[n.RelativeFilename||n.Filename]=e}}}}for(const r in e){const i=e[r];void 0!==t[i]?e[r]=t[i]:e[r]=e[r].split("\\").pop()}return e}parseImage(e){const t=e.Content,r=e.RelativeFilename||e.Filename,i=r.slice(r.lastIndexOf(".")+1).toLowerCase();let n;switch(i){case"bmp":n="image/bmp";break;case"jpg":case"jpeg":n="image/jpeg";break;case"png":n="image/png";break;case"tif":n="image/tiff";break;case"tga":null===this.manager.getHandler(".tga")&&console.warn("FBXLoader: TGA loader not found, skipping ",r),n="image/tga";break;default:return void console.warn('FBXLoader: Image type "'+i+'" is not supported.')}if("string"==typeof t)return"data:"+n+";base64,"+t;{const e=new Uint8Array(t);return window.URL.createObjectURL(new Blob([e],{type:n}))}}parseTextures(e){const t=new Map;if("Texture"in vu.Objects){const r=vu.Objects.Texture;for(const i in r){const n=this.parseTexture(r[i],e);t.set(parseInt(i),n)}}return t}parseTexture(t,r){const i=this.loadTexture(t,r);i.ID=t.id,i.name=t.attrName;const n=t.WrapModeU,s=t.WrapModeV,o=void 0!==n?n.value:0,a=void 0!==s?s.value:0;if(i.wrapS=0===o?e.RepeatWrapping:e.ClampToEdgeWrapping,i.wrapT=0===a?e.RepeatWrapping:e.ClampToEdgeWrapping,"Scaling"in t){const e=t.Scaling.value;i.repeat.x=e[0],i.repeat.y=e[1]}return i}loadTexture(t,r){let i;const n=this.textureLoader.path,s=xu.get(t.id).children;let o;void 0!==s&&s.length>0&&void 0!==r[s[0].ID]&&(i=r[s[0].ID],0!==i.indexOf("blob:")&&0!==i.indexOf("data:")||this.textureLoader.setPath(void 0));const a=t.FileName.slice(-3).toLowerCase();if("tga"===a){const r=this.manager.getHandler(".tga");null===r?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",t.RelativeFilename),o=new e.Texture):(r.setPath(this.textureLoader.path),o=r.load(i))}else"psd"===a?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",t.RelativeFilename),o=new e.Texture):o=this.textureLoader.load(i);return this.textureLoader.setPath(n),o}parseMaterials(e){const t=new Map;if("Material"in vu.Objects){const r=vu.Objects.Material;for(const i in r){const n=this.parseMaterial(r[i],e);null!==n&&t.set(parseInt(i),n)}}return t}parseMaterial(t,r){const i=t.id,n=t.attrName;let s=t.ShadingModel;if("object"==typeof s&&(s=s.value),!xu.has(i))return null;const o=this.parseParameters(t,r,i);let a;switch(s.toLowerCase()){case"phong":a=new e.MeshPhongMaterial;break;case"lambert":a=new e.MeshLambertMaterial;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',s),a=new e.MeshPhongMaterial}return a.setValues(o),a.name=n,a}parseParameters(t,r,i){const n={};t.BumpFactor&&(n.bumpScale=t.BumpFactor.value),t.Diffuse?n.color=(new e.Color).fromArray(t.Diffuse.value):!t.DiffuseColor||"Color"!==t.DiffuseColor.type&&"ColorRGB"!==t.DiffuseColor.type||(n.color=(new e.Color).fromArray(t.DiffuseColor.value)),t.DisplacementFactor&&(n.displacementScale=t.DisplacementFactor.value),t.Emissive?n.emissive=(new e.Color).fromArray(t.Emissive.value):!t.EmissiveColor||"Color"!==t.EmissiveColor.type&&"ColorRGB"!==t.EmissiveColor.type||(n.emissive=(new e.Color).fromArray(t.EmissiveColor.value)),t.EmissiveFactor&&(n.emissiveIntensity=parseFloat(t.EmissiveFactor.value)),t.Opacity&&(n.opacity=parseFloat(t.Opacity.value)),n.opacity<1&&(n.transparent=!0),t.ReflectionFactor&&(n.reflectivity=t.ReflectionFactor.value),t.Shininess&&(n.shininess=t.Shininess.value),t.Specular?n.specular=(new e.Color).fromArray(t.Specular.value):t.SpecularColor&&"Color"===t.SpecularColor.type&&(n.specular=(new e.Color).fromArray(t.SpecularColor.value));const s=this;return xu.get(i).children.forEach((function(t){const i=t.relationship;switch(i){case"Bump":n.bumpMap=s.getTexture(r,t.ID);break;case"Maya|TEX_ao_map":n.aoMap=s.getTexture(r,t.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":n.map=s.getTexture(r,t.ID),void 0!==n.map&&("colorSpace"in n.map?n.map.colorSpace="srgb":n.map.encoding=3001);break;case"DisplacementColor":n.displacementMap=s.getTexture(r,t.ID);break;case"EmissiveColor":n.emissiveMap=s.getTexture(r,t.ID),void 0!==n.emissiveMap&&("colorSpace"in n.emissiveMap?n.emissiveMap.colorSpace="srgb":n.emissiveMap.encoding=3001);break;case"NormalMap":case"Maya|TEX_normal_map":n.normalMap=s.getTexture(r,t.ID);break;case"ReflectionColor":n.envMap=s.getTexture(r,t.ID),void 0!==n.envMap&&(n.envMap.mapping=e.EquirectangularReflectionMapping,"colorSpace"in n.envMap?n.envMap.colorSpace="srgb":n.envMap.encoding=3001);break;case"SpecularColor":n.specularMap=s.getTexture(r,t.ID),void 0!==n.specularMap&&("colorSpace"in n.specularMap?n.specularMap.colorSpace="srgb":n.specularMap.encoding=3001);break;case"TransparentColor":case"TransparencyFactor":n.alphaMap=s.getTexture(r,t.ID),n.transparent=!0;break;case"AmbientColor":case"ShininessExponent":case"SpecularFactor":case"VectorDisplacementColor":default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",i)}})),n}getTexture(e,t){return"LayeredTexture"in vu.Objects&&t in vu.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=xu.get(t).children[0].ID),e.get(t)}parseDeformers(){const e={},t={};if("Deformer"in vu.Objects){const r=vu.Objects.Deformer;for(const i in r){const n=r[i],s=xu.get(parseInt(i));if("Skin"===n.attrType){const t=this.parseSkeleton(s,r);t.ID=i,s.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),t.geometryID=s.parents[0].ID,e[i]=t}else if("BlendShape"===n.attrType){const e={id:i};e.rawTargets=this.parseMorphTargets(s,r),e.id=i,s.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[i]=e}}}return{skeletons:e,morphTargets:t}}parseSkeleton(t,r){const i=[];return t.children.forEach((function(t){const n=r[t.ID];if("Cluster"!==n.attrType)return;const s={ID:t.ID,indices:[],weights:[],transformLink:(new e.Matrix4).fromArray(n.TransformLink.a)};"Indexes"in n&&(s.indices=n.Indexes.a,s.weights=n.Weights.a),i.push(s)})),{rawBones:i,bones:[]}}parseMorphTargets(e,t){const r=[];for(let i=0;i<e.children.length;i++){const n=e.children[i],s=t[n.ID],o={name:s.attrName,initialWeight:s.DeformPercent,id:s.id,fullWeights:s.FullWeights.a};if("BlendShapeChannel"!==s.attrType)return;o.geoID=xu.get(parseInt(n.ID)).children.filter((function(e){return void 0===e.relationship}))[0].ID,r.push(o)}return r}parseScene(t,r,i){yu=new e.Group;const n=this.parseModels(t.skeletons,r,i),s=vu.Objects.Model,o=this;n.forEach((function(e){const t=s[e.ID];o.setLookAtProperties(e,t);xu.get(e.ID).parents.forEach((function(t){const r=n.get(t.ID);void 0!==r&&r.add(e)})),null===e.parent&&yu.add(e)})),this.bindSkeleton(t.skeletons,r,n),this.createAmbientLight(),yu.traverse((function(e){if(e.userData.transformData){e.parent&&(e.userData.transformData.parentMatrix=e.parent.matrix,e.userData.transformData.parentMatrixWorld=e.parent.matrixWorld);const t=Nu(e.userData.transformData);e.applyMatrix4(t),e.updateWorldMatrix()}}));const a=(new Mu).parse();1===yu.children.length&&yu.children[0].isGroup&&(yu.children[0].animations=a,yu=yu.children[0]),yu.animations=a}parseModels(t,r,i){const n=new Map,s=vu.Objects.Model;for(const o in s){const a=parseInt(o),l=s[o],c=xu.get(a);let h=this.buildSkeleton(c,t,a,l.attrName);if(!h){switch(l.attrType){case"Camera":h=this.createCamera(c);break;case"Light":h=this.createLight(c);break;case"Mesh":h=this.createMesh(c,r,i);break;case"NurbsCurve":h=this.createCurve(c,r);break;case"LimbNode":case"Root":h=new e.Bone;break;case"Null":default:h=new e.Group}h.name=l.attrName?e.PropertyBinding.sanitizeNodeName(l.attrName):"",h.ID=a}this.getTransformData(h,l),n.set(a,h)}return n}buildSkeleton(t,r,i,n){let s=null;return t.parents.forEach((function(t){for(const o in r){const a=r[o];a.rawBones.forEach((function(r,o){if(r.ID===t.ID){const t=s;s=new e.Bone,s.matrixWorld.copy(r.transformLink),s.name=n?e.PropertyBinding.sanitizeNodeName(n):"",s.ID=i,a.bones[o]=s,null!==t&&s.add(t)}}))}})),s}createCamera(t){let r,i;if(t.children.forEach((function(e){const t=vu.Objects.NodeAttribute[e.ID];void 0!==t&&(i=t)})),void 0===i)r=new e.Object3D;else{let t=0;void 0!==i.CameraProjectionType&&1===i.CameraProjectionType.value&&(t=1);let n=1;void 0!==i.NearPlane&&(n=i.NearPlane.value/1e3);let s=1e3;void 0!==i.FarPlane&&(s=i.FarPlane.value/1e3);let o=window.innerWidth,a=window.innerHeight;void 0!==i.AspectWidth&&void 0!==i.AspectHeight&&(o=i.AspectWidth.value,a=i.AspectHeight.value);const l=o/a;let c=45;void 0!==i.FieldOfView&&(c=i.FieldOfView.value);const h=i.FocalLength?i.FocalLength.value:null;switch(t){case 0:r=new e.PerspectiveCamera(c,l,n,s),null!==h&&r.setFocalLength(h);break;case 1:r=new e.OrthographicCamera(-o/2,o/2,a/2,-a/2,n,s);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+t+"."),r=new e.Object3D}}return r}createLight(t){let r,i;if(t.children.forEach((function(e){const t=vu.Objects.NodeAttribute[e.ID];void 0!==t&&(i=t)})),void 0===i)r=new e.Object3D;else{let t;t=void 0===i.LightType?0:i.LightType.value;let n=16777215;void 0!==i.Color&&(n=(new e.Color).fromArray(i.Color.value));let s=void 0===i.Intensity?1:i.Intensity.value/100;void 0!==i.CastLightOnObject&&0===i.CastLightOnObject.value&&(s=0);let o=0;void 0!==i.FarAttenuationEnd&&(o=void 0!==i.EnableFarAttenuation&&0===i.EnableFarAttenuation.value?0:i.FarAttenuationEnd.value);const a=1;switch(t){case 0:r=new e.PointLight(n,s,o,a);break;case 1:r=new e.DirectionalLight(n,s);break;case 2:let t=Math.PI/3;void 0!==i.InnerAngle&&(t=e.MathUtils.degToRad(i.InnerAngle.value));let l=0;void 0!==i.OuterAngle&&(l=e.MathUtils.degToRad(i.OuterAngle.value),l=Math.max(l,1)),r=new e.SpotLight(n,s,o,t,l,a);break;default:console.warn("THREE.FBXLoader: Unknown light type "+i.LightType.value+", defaulting to a PointLight."),r=new e.PointLight(n,s)}void 0!==i.CastShadows&&1===i.CastShadows.value&&(r.castShadow=!0)}return r}createMesh(t,r,i){let n,s=null,o=null;const a=[];return t.children.forEach((function(e){r.has(e.ID)&&(s=r.get(e.ID)),i.has(e.ID)&&a.push(i.get(e.ID))})),a.length>1?o=a:a.length>0?o=a[0]:(o=new e.MeshPhongMaterial({color:13421772}),a.push(o)),"color"in s.attributes&&a.forEach((function(e){e.vertexColors=!0})),s.FBX_Deformer?(n=new e.SkinnedMesh(s,o),n.normalizeSkinWeights()):n=new e.Mesh(s,o),n}createCurve(t,r){const i=t.children.reduce((function(e,t){return r.has(t.ID)&&(e=r.get(t.ID)),e}),null),n=new e.LineBasicMaterial({color:3342591,linewidth:1});return new e.Line(i,n)}getTransformData(e,t){const r={};"InheritType"in t&&(r.inheritType=parseInt(t.InheritType.value)),r.eulerOrder="RotationOrder"in t?Du(t.RotationOrder.value):"ZYX","Lcl_Translation"in t&&(r.translation=t.Lcl_Translation.value),"PreRotation"in t&&(r.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(r.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(r.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(r.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(r.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(r.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(r.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(r.rotationPivot=t.RotationPivot.value),e.userData.transformData=r}setLookAtProperties(t,r){if("LookAtProperty"in r){xu.get(t.ID).children.forEach((function(r){if("LookAtProperty"===r.relationship){const i=vu.Objects.Model[r.ID];if("Lcl_Translation"in i){const r=i.Lcl_Translation.value;void 0!==t.target?(t.target.position.fromArray(r),yu.add(t.target)):t.lookAt((new e.Vector3).fromArray(r))}}}))}}bindSkeleton(t,r,i){const n=this.parsePoseNodes();for(const s in t){const o=t[s];xu.get(parseInt(o.ID)).parents.forEach((function(t){if(r.has(t.ID)){const r=t.ID;xu.get(r).parents.forEach((function(t){if(i.has(t.ID)){i.get(t.ID).bind(new e.Skeleton(o.bones),n[t.ID])}}))}}))}}parsePoseNodes(){const t={};if("Pose"in vu.Objects){const r=vu.Objects.Pose;for(const i in r)if("BindPose"===r[i].attrType&&r[i].NbPoseNodes>0){const n=r[i].PoseNode;Array.isArray(n)?n.forEach((function(r){t[r.Node]=(new e.Matrix4).fromArray(r.Matrix.a)})):t[n.Node]=(new e.Matrix4).fromArray(n.Matrix.a)}}return t}createAmbientLight(){if("GlobalSettings"in vu&&"AmbientColor"in vu.GlobalSettings){const t=vu.GlobalSettings.AmbientColor.value,r=t[0],i=t[1],n=t[2];if(0!==r||0!==i||0!==n){const t=new e.Color(r,i,n);yu.add(new e.AmbientLight(t,1))}}}}class wu{parse(e){const t=new Map;if("Geometry"in vu.Objects){const r=vu.Objects.Geometry;for(const i in r){const n=xu.get(parseInt(i)),s=this.parseGeometry(n,r[i],e);t.set(parseInt(i),s)}}return t}parseGeometry(e,t,r){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,r);case"NurbsCurve":return this.parseNurbsGeometry(t)}}parseMeshGeometry(e,t,r){const i=r.skeletons,n=[],s=e.parents.map((function(e){return vu.Objects.Model[e.ID]}));if(0===s.length)return;const o=e.children.reduce((function(e,t){return void 0!==i[t.ID]&&(e=i[t.ID]),e}),null);e.children.forEach((function(e){void 0!==r.morphTargets[e.ID]&&n.push(r.morphTargets[e.ID])}));const a=s[0],l={};"RotationOrder"in a&&(l.eulerOrder=Du(a.RotationOrder.value)),"InheritType"in a&&(l.inheritType=parseInt(a.InheritType.value)),"GeometricTranslation"in a&&(l.translation=a.GeometricTranslation.value),"GeometricRotation"in a&&(l.rotation=a.GeometricRotation.value),"GeometricScaling"in a&&(l.scale=a.GeometricScaling.value);const c=Nu(l);return this.genGeometry(t,o,n,c)}genGeometry(t,r,i,n){const s=new e.BufferGeometry;t.attrName&&(s.name=t.attrName);const o=this.parseGeoNode(t,r),a=this.genBuffers(o),l=new e.Float32BufferAttribute(a.vertex,3);if(l.applyMatrix4(n),s.setAttribute("position",l),a.colors.length>0&&s.setAttribute("color",new e.Float32BufferAttribute(a.colors,3)),r&&(s.setAttribute("skinIndex",new e.Uint16BufferAttribute(a.weightsIndices,4)),s.setAttribute("skinWeight",new e.Float32BufferAttribute(a.vertexWeights,4)),s.FBX_Deformer=r),a.normal.length>0){const t=(new e.Matrix3).getNormalMatrix(n),r=new e.Float32BufferAttribute(a.normal,3);r.applyNormalMatrix(t),s.setAttribute("normal",r)}if(a.uvs.forEach((function(t,r){let i="uv"+(r+1).toString();0===r&&(i="uv"),s.setAttribute(i,new e.Float32BufferAttribute(a.uvs[r],2))})),o.material&&"AllSame"!==o.material.mappingType){let e=a.materialIndex[0],t=0;if(a.materialIndex.forEach((function(r,i){r!==e&&(s.addGroup(t,i-t,e),e=r,t=i)})),s.groups.length>0){const t=s.groups[s.groups.length-1],r=t.start+t.count;r!==a.materialIndex.length&&s.addGroup(r,a.materialIndex.length-r,e)}0===s.groups.length&&s.addGroup(0,a.materialIndex.length,a.materialIndex[0])}return this.addMorphTargets(s,t,i,n),s}parseGeoNode(e,t){const r={};if(r.vertexPositions=void 0!==e.Vertices?e.Vertices.a:[],r.vertexIndices=void 0!==e.PolygonVertexIndex?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(r.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(r.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(r.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){r.uv=[];let t=0;for(;e.LayerElementUV[t];)e.LayerElementUV[t].UV&&r.uv.push(this.parseUVs(e.LayerElementUV[t])),t++}return r.weightTable={},null!==t&&(r.skeleton=t,t.rawBones.forEach((function(e,t){e.indices.forEach((function(i,n){void 0===r.weightTable[i]&&(r.weightTable[i]=[]),r.weightTable[i].push({id:t,weight:e.weights[n]})}))}))),r}genBuffers(e){const t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]};let r=0,i=0,n=!1,s=[],o=[],a=[],l=[],c=[],h=[];const u=this;return e.vertexIndices.forEach((function(d,p){let m,f=!1;d<0&&(d^=-1,f=!0);let g=[],v=[];if(s.push(3*d,3*d+1,3*d+2),e.color){const t=Bu(p,r,d,e.color);a.push(t[0],t[1],t[2])}if(e.skeleton){if(void 0!==e.weightTable[d]&&e.weightTable[d].forEach((function(e){v.push(e.weight),g.push(e.id)})),v.length>4){n||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),n=!0);const e=[0,0,0,0],t=[0,0,0,0];v.forEach((function(r,i){let n=r,s=g[i];t.forEach((function(t,r,i){if(n>t){i[r]=n,n=t;const o=e[r];e[r]=s,s=o}}))})),g=e,v=t}for(;v.length<4;)v.push(0),g.push(0);for(let e=0;e<4;++e)c.push(v[e]),h.push(g[e])}if(e.normal){const t=Bu(p,r,d,e.normal);o.push(t[0],t[1],t[2])}e.material&&"AllSame"!==e.material.mappingType&&(m=Bu(p,r,d,e.material)[0]),e.uv&&e.uv.forEach((function(e,t){const i=Bu(p,r,d,e);void 0===l[t]&&(l[t]=[]),l[t].push(i[0]),l[t].push(i[1])})),i++,f&&(u.genFace(t,e,s,m,o,a,l,c,h,i),r++,i=0,s=[],o=[],a=[],l=[],c=[],h=[])})),t}genFace(e,t,r,i,n,s,o,a,l,c){for(let h=2;h<c;h++)e.vertex.push(t.vertexPositions[r[0]]),e.vertex.push(t.vertexPositions[r[1]]),e.vertex.push(t.vertexPositions[r[2]]),e.vertex.push(t.vertexPositions[r[3*(h-1)]]),e.vertex.push(t.vertexPositions[r[3*(h-1)+1]]),e.vertex.push(t.vertexPositions[r[3*(h-1)+2]]),e.vertex.push(t.vertexPositions[r[3*h]]),e.vertex.push(t.vertexPositions[r[3*h+1]]),e.vertex.push(t.vertexPositions[r[3*h+2]]),t.skeleton&&(e.vertexWeights.push(a[0]),e.vertexWeights.push(a[1]),e.vertexWeights.push(a[2]),e.vertexWeights.push(a[3]),e.vertexWeights.push(a[4*(h-1)]),e.vertexWeights.push(a[4*(h-1)+1]),e.vertexWeights.push(a[4*(h-1)+2]),e.vertexWeights.push(a[4*(h-1)+3]),e.vertexWeights.push(a[4*h]),e.vertexWeights.push(a[4*h+1]),e.vertexWeights.push(a[4*h+2]),e.vertexWeights.push(a[4*h+3]),e.weightsIndices.push(l[0]),e.weightsIndices.push(l[1]),e.weightsIndices.push(l[2]),e.weightsIndices.push(l[3]),e.weightsIndices.push(l[4*(h-1)]),e.weightsIndices.push(l[4*(h-1)+1]),e.weightsIndices.push(l[4*(h-1)+2]),e.weightsIndices.push(l[4*(h-1)+3]),e.weightsIndices.push(l[4*h]),e.weightsIndices.push(l[4*h+1]),e.weightsIndices.push(l[4*h+2]),e.weightsIndices.push(l[4*h+3])),t.color&&(e.colors.push(s[0]),e.colors.push(s[1]),e.colors.push(s[2]),e.colors.push(s[3*(h-1)]),e.colors.push(s[3*(h-1)+1]),e.colors.push(s[3*(h-1)+2]),e.colors.push(s[3*h]),e.colors.push(s[3*h+1]),e.colors.push(s[3*h+2])),t.material&&"AllSame"!==t.material.mappingType&&(e.materialIndex.push(i),e.materialIndex.push(i),e.materialIndex.push(i)),t.normal&&(e.normal.push(n[0]),e.normal.push(n[1]),e.normal.push(n[2]),e.normal.push(n[3*(h-1)]),e.normal.push(n[3*(h-1)+1]),e.normal.push(n[3*(h-1)+2]),e.normal.push(n[3*h]),e.normal.push(n[3*h+1]),e.normal.push(n[3*h+2])),t.uv&&t.uv.forEach((function(t,r){void 0===e.uvs[r]&&(e.uvs[r]=[]),e.uvs[r].push(o[r][0]),e.uvs[r].push(o[r][1]),e.uvs[r].push(o[r][2*(h-1)]),e.uvs[r].push(o[r][2*(h-1)+1]),e.uvs[r].push(o[r][2*h]),e.uvs[r].push(o[r][2*h+1])}))}addMorphTargets(e,t,r,i){if(0===r.length)return;e.morphTargetsRelative=!0,e.morphAttributes.position=[];const n=this;r.forEach((function(r){r.rawTargets.forEach((function(r){const s=vu.Objects.Geometry[r.geoID];void 0!==s&&n.genMorphGeometry(e,t,s,i,r.name)}))}))}genMorphGeometry(t,r,i,n,s){const o=void 0!==r.PolygonVertexIndex?r.PolygonVertexIndex.a:[],a=void 0!==i.Vertices?i.Vertices.a:[],l=void 0!==i.Indexes?i.Indexes.a:[],c=3*t.attributes.position.count,h=new Float32Array(c);for(let e=0;e<l.length;e++){const t=3*l[e];h[t]=a[3*e],h[t+1]=a[3*e+1],h[t+2]=a[3*e+2]}const u={vertexIndices:o,vertexPositions:h},d=this.genBuffers(u),p=new e.Float32BufferAttribute(d.vertex,3);p.name=s||i.attrName,p.applyMatrix4(n),t.morphAttributes.position.push(p)}parseNormals(e){const t=e.MappingInformationType,r=e.ReferenceInformationType,i=e.Normals.a;let n=[];return"IndexToDirect"===r&&("NormalIndex"in e?n=e.NormalIndex.a:"NormalsIndex"in e&&(n=e.NormalsIndex.a)),{dataSize:3,buffer:i,indices:n,mappingType:t,referenceType:r}}parseUVs(e){const t=e.MappingInformationType,r=e.ReferenceInformationType,i=e.UV.a;let n=[];return"IndexToDirect"===r&&(n=e.UVIndex.a),{dataSize:2,buffer:i,indices:n,mappingType:t,referenceType:r}}parseVertexColors(e){const t=e.MappingInformationType,r=e.ReferenceInformationType,i=e.Colors.a;let n=[];return"IndexToDirect"===r&&(n=e.ColorIndex.a),{dataSize:4,buffer:i,indices:n,mappingType:t,referenceType:r}}parseMaterialIndices(e){const t=e.MappingInformationType,r=e.ReferenceInformationType;if("NoMappingInformation"===t)return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:r};const i=e.Materials.a,n=[];for(let e=0;e<i.length;++e)n.push(e);return{dataSize:1,buffer:i,indices:n,mappingType:t,referenceType:r}}parseNurbsGeometry(t){if(void 0===gu)return console.error("THREE.FBXLoader: The loader relies on NURBSCurve for any nurbs present in the model. Nurbs will show up as empty geometry."),new e.BufferGeometry;const r=parseInt(t.Order);if(isNaN(r))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",t.Order,t.id),new e.BufferGeometry;const i=r-1,n=t.KnotVector.a,s=[],o=t.Points.a;for(let t=0,r=o.length;t<r;t+=4)s.push((new e.Vector4).fromArray(o,t));let a,l;if("Closed"===t.Form)s.push(s[0]);else if("Periodic"===t.Form){a=i,l=n.length-1-a;for(let e=0;e<i;++e)s.push(s[e])}const c=new gu(i,n,s,a,l).getPoints(12*s.length);return(new e.BufferGeometry).setFromPoints(c)}}class Mu{parse(){const e=[],t=this.parseClips();if(void 0!==t)for(const r in t){const i=t[r],n=this.addClip(i);e.push(n)}return e}parseClips(){if(void 0===vu.Objects.AnimationCurve)return;const e=this.parseAnimationCurveNodes();this.parseAnimationCurves(e);const t=this.parseAnimationLayers(e);return this.parseAnimStacks(t)}parseAnimationCurveNodes(){const e=vu.Objects.AnimationCurveNode,t=new Map;for(const r in e){const i=e[r];if(null!==i.attrName.match(/S|R|T|DeformPercent/)){const e={id:i.id,attr:i.attrName,curves:{}};t.set(e.id,e)}}return t}parseAnimationCurves(e){const t=vu.Objects.AnimationCurve;for(const r in t){const i={id:t[r].id,times:t[r].KeyTime.a.map(_u),values:t[r].KeyValueFloat.a},n=xu.get(i.id);if(void 0!==n){const t=n.parents[0].ID,r=n.parents[0].relationship;r.match(/X/)?e.get(t).curves.x=i:r.match(/Y/)?e.get(t).curves.y=i:r.match(/Z/)?e.get(t).curves.z=i:r.match(/d|DeformPercent/)&&e.has(t)&&(e.get(t).curves.morph=i)}}}parseAnimationLayers(t){const r=vu.Objects.AnimationLayer,i=new Map;for(const n in r){const r=[],s=xu.get(parseInt(n));if(void 0!==s){s.children.forEach((function(i,n){if(t.has(i.ID)){const s=t.get(i.ID);if(void 0!==s.curves.x||void 0!==s.curves.y||void 0!==s.curves.z){if(void 0===r[n]){const t=xu.get(i.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID;if(void 0!==t){const s=vu.Objects.Model[t.toString()];if(void 0===s)return void console.warn("THREE.FBXLoader: Encountered a unused curve.",i);const o={modelName:s.attrName?e.PropertyBinding.sanitizeNodeName(s.attrName):"",ID:s.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};yu.traverse((function(e){e.ID===s.id&&(o.transform=e.matrix,e.userData.transformData&&(o.eulerOrder=e.userData.transformData.eulerOrder))})),o.transform||(o.transform=new e.Matrix4),"PreRotation"in s&&(o.preRotation=s.PreRotation.value),"PostRotation"in s&&(o.postRotation=s.PostRotation.value),r[n]=o}}r[n]&&(r[n][s.attr]=s)}else if(void 0!==s.curves.morph){if(void 0===r[n]){const t=xu.get(i.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID,s=xu.get(t).parents[0].ID,o=xu.get(s).parents[0].ID,a=xu.get(o).parents[0].ID,l=vu.Objects.Model[a],c={modelName:l.attrName?e.PropertyBinding.sanitizeNodeName(l.attrName):"",morphName:vu.Objects.Deformer[t].attrName};r[n]=c}r[n][s.attr]=s}}})),i.set(parseInt(n),r)}}return i}parseAnimStacks(e){const t=vu.Objects.AnimationStack,r={};for(const i in t){const n=xu.get(parseInt(i)).children;n.length>1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");const s=e.get(n[0].ID);r[i]={name:t[i].attrName,layer:s}}return r}addClip(t){let r=[];const i=this;return t.layer.forEach((function(e){r=r.concat(i.generateTracks(e))})),new e.AnimationClip(t.name,-1,r)}generateTracks(t){const r=[];let i=new e.Vector3,n=new e.Quaternion,s=new e.Vector3;if(t.transform&&t.transform.decompose(i,n,s),i=i.toArray(),n=(new e.Euler).setFromQuaternion(n,t.eulerOrder).toArray(),s=s.toArray(),void 0!==t.T&&Object.keys(t.T.curves).length>0){const e=this.generateVectorTrack(t.modelName,t.T.curves,i,"position");void 0!==e&&r.push(e)}if(void 0!==t.R&&Object.keys(t.R.curves).length>0){const e=this.generateRotationTrack(t.modelName,t.R.curves,n,t.preRotation,t.postRotation,t.eulerOrder);void 0!==e&&r.push(e)}if(void 0!==t.S&&Object.keys(t.S.curves).length>0){const e=this.generateVectorTrack(t.modelName,t.S.curves,s,"scale");void 0!==e&&r.push(e)}if(void 0!==t.DeformPercent){const e=this.generateMorphTrack(t);void 0!==e&&r.push(e)}return r}generateVectorTrack(t,r,i,n){const s=this.getTimesForAllAxes(r),o=this.getKeyframeTrackValues(s,r,i);return new e.VectorKeyframeTrack(t+"."+n,s,o)}generateRotationTrack(t,r,i,n,s,o){void 0!==r.x&&(this.interpolateRotations(r.x),r.x.values=r.x.values.map(e.MathUtils.degToRad)),void 0!==r.y&&(this.interpolateRotations(r.y),r.y.values=r.y.values.map(e.MathUtils.degToRad)),void 0!==r.z&&(this.interpolateRotations(r.z),r.z.values=r.z.values.map(e.MathUtils.degToRad));const a=this.getTimesForAllAxes(r),l=this.getKeyframeTrackValues(a,r,i);void 0!==n&&((n=n.map(e.MathUtils.degToRad)).push(o),n=(new e.Euler).fromArray(n),n=(new e.Quaternion).setFromEuler(n)),void 0!==s&&((s=s.map(e.MathUtils.degToRad)).push(o),s=(new e.Euler).fromArray(s),s=(new e.Quaternion).setFromEuler(s).invert());const c=new e.Quaternion,h=new e.Euler,u=[];for(let e=0;e<l.length;e+=3)h.set(l[e],l[e+1],l[e+2],o),c.setFromEuler(h),void 0!==n&&c.premultiply(n),void 0!==s&&c.multiply(s),c.toArray(u,e/3*4);return new e.QuaternionKeyframeTrack(t+".quaternion",a,u)}generateMorphTrack(t){const r=t.DeformPercent.curves.morph,i=r.values.map((function(e){return e/100})),n=yu.getObjectByName(t.modelName).morphTargetDictionary[t.morphName];return new e.NumberKeyframeTrack(t.modelName+".morphTargetInfluences["+n+"]",r.times,i)}getTimesForAllAxes(e){let t=[];if(void 0!==e.x&&(t=t.concat(e.x.times)),void 0!==e.y&&(t=t.concat(e.y.times)),void 0!==e.z&&(t=t.concat(e.z.times)),t=t.sort((function(e,t){return e-t})),t.length>1){let e=1,r=t[0];for(let i=1;i<t.length;i++){const n=t[i];n!==r&&(t[e]=n,r=n,e++)}t=t.slice(0,e)}return t}getKeyframeTrackValues(e,t,r){const i=r,n=[];let s=-1,o=-1,a=-1;return e.forEach((function(e){if(t.x&&(s=t.x.times.indexOf(e)),t.y&&(o=t.y.times.indexOf(e)),t.z&&(a=t.z.times.indexOf(e)),-1!==s){const e=t.x.values[s];n.push(e),i[0]=e}else n.push(i[0]);if(-1!==o){const e=t.y.values[o];n.push(e),i[1]=e}else n.push(i[1]);if(-1!==a){const e=t.z.values[a];n.push(e),i[2]=e}else n.push(i[2])})),n}interpolateRotations(e){for(let t=1;t<e.values.length;t++){const r=e.values[t-1],i=e.values[t]-r,n=Math.abs(i);if(n>=180){const s=n/180,o=i/s;let a=r+o;const l=e.times[t-1],c=(e.times[t]-l)/s;let h=l+c;const u=[],d=[];for(;h<e.times[t];)u.push(h),h+=c,d.push(a),a+=o;e.times=Ou(e.times,t,u),e.values=Ou(e.values,t,d)}}}}class Tu{getPrevNode(){return this.nodeStack[this.currentIndent-2]}getCurrentNode(){return this.nodeStack[this.currentIndent-1]}getCurrentProp(){return this.currentProp}pushStack(e){this.nodeStack.push(e),this.currentIndent+=1}popStack(){this.nodeStack.pop(),this.currentIndent-=1}setCurrentProp(e,t){this.currentProp=e,this.currentPropName=t}parse(e){this.currentIndent=0,this.allNodes=new Fu,this.nodeStack=[],this.currentProp=[],this.currentPropName="";const t=this,r=e.split(/[\r\n]+/);return r.forEach((function(e,i){const n=e.match(/^[\s\t]*;/),s=e.match(/^[\s\t]*$/);if(n||s)return;const o=e.match("^\\t{"+t.currentIndent+"}(\\w+):(.*){",""),a=e.match("^\\t{"+t.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),l=e.match("^\\t{"+(t.currentIndent-1)+"}}");o?t.parseNodeBegin(e,o):a?t.parseNodeProperty(e,a,r[++i]):l?t.popStack():e.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(e)})),this.allNodes}parseNodeBegin(e,t){const r=t[1].trim().replace(/^"/,"").replace(/"$/,""),i=t[2].split(",").map((function(e){return e.trim().replace(/^"/,"").replace(/"$/,"")})),n={name:r},s=this.parseNodeAttr(i),o=this.getCurrentNode();0===this.currentIndent?this.allNodes.add(r,n):r in o?("PoseNode"===r?o.PoseNode.push(n):void 0!==o[r].id&&(o[r]={},o[r][o[r].id]=o[r]),""!==s.id&&(o[r][s.id]=n)):"number"==typeof s.id?(o[r]={},o[r][s.id]=n):"Properties70"!==r&&(o[r]="PoseNode"===r?[n]:n),"number"==typeof s.id&&(n.id=s.id),""!==s.name&&(n.attrName=s.name),""!==s.type&&(n.attrType=s.type),this.pushStack(n)}parseNodeAttr(e){let t=e[0];""!==e[0]&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0]));let r="",i="";return e.length>1&&(r=e[1].replace(/^(\w+)::/,""),i=e[2]),{id:t,name:r,type:i}}parseNodeProperty(e,t,r){let i=t[1].replace(/^"/,"").replace(/"$/,"").trim(),n=t[2].replace(/^"/,"").replace(/"$/,"").trim();"Content"===i&&","===n&&(n=r.replace(/"/g,"").replace(/,$/,"").trim());const s=this.getCurrentNode();if("Properties70"!==s.name){if("C"===i){const e=n.split(",").slice(1),t=parseInt(e[0]),r=parseInt(e[1]);let o=n.split(",").slice(3);o=o.map((function(e){return e.trim().replace(/^"/,"")})),i="connections",n=[t,r],function(e,t){for(let r=0,i=e.length,n=t.length;r<n;r++,i++)e[i]=t[r]}(n,o),void 0===s[i]&&(s[i]=[])}"Node"===i&&(s.id=n),i in s&&Array.isArray(s[i])?s[i].push(n):"a"!==i?s[i]=n:s.a=n,this.setCurrentProp(s,i),"a"===i&&","!==n.slice(-1)&&(s.a=Iu(n))}else this.parseNodeSpecialProperty(e,i,n)}parseNodePropertyContinued(e){const t=this.getCurrentNode();t.a+=e,","!==e.slice(-1)&&(t.a=Iu(t.a))}parseNodeSpecialProperty(e,t,r){const i=r.split('",').map((function(e){return e.trim().replace(/^\"/,"").replace(/\s/,"_")})),n=i[0],s=i[1],o=i[2],a=i[3];let l=i[4];switch(s){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":l=parseFloat(l);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":l=Iu(l)}this.getPrevNode()[n]={type:s,type2:o,flag:a,value:l},this.setCurrentProp(this.getPrevNode(),n)}}class Su{parse(e){const t=new Cu(e);t.skip(23);const r=t.getUint32();if(r<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+r);const i=new Fu;for(;!this.endOfContent(t);){const e=this.parseNode(t,r);null!==e&&i.add(e.name,e)}return i}endOfContent(e){return e.size()%16==0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}parseNode(e,t){const r={},i=t>=7500?e.getUint64():e.getUint32(),n=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();const s=e.getUint8(),o=e.getString(s);if(0===i)return null;const a=[];for(let t=0;t<n;t++)a.push(this.parseProperty(e));const l=a.length>0?a[0]:"",c=a.length>1?a[1]:"",h=a.length>2?a[2]:"";for(r.singleProperty=1===n&&e.getOffset()===i;i>e.getOffset();){const i=this.parseNode(e,t);null!==i&&this.parseSubNode(o,r,i)}return r.propertyList=a,"number"==typeof l&&(r.id=l),""!==c&&(r.attrName=c),""!==h&&(r.attrType=h),""!==o&&(r.name=o),r}parseSubNode(e,t,r){if(!0===r.singleProperty){const e=r.propertyList[0];Array.isArray(e)?(t[r.name]=r,r.a=e):t[r.name]=e}else if("Connections"===e&&"C"===r.name){const e=[];r.propertyList.forEach((function(t,r){0!==r&&e.push(t)})),void 0===t.connections&&(t.connections=[]),t.connections.push(e)}else if("Properties70"===r.name){Object.keys(r).forEach((function(e){t[e]=r[e]}))}else if("Properties70"===e&&"P"===r.name){let e=r.propertyList[0],i=r.propertyList[1];const n=r.propertyList[2],s=r.propertyList[3];let o;0===e.indexOf("Lcl ")&&(e=e.replace("Lcl ","Lcl_")),0===i.indexOf("Lcl ")&&(i=i.replace("Lcl ","Lcl_")),o="Color"===i||"ColorRGB"===i||"Vector"===i||"Vector3D"===i||0===i.indexOf("Lcl_")?[r.propertyList[4],r.propertyList[5],r.propertyList[6]]:r.propertyList[4],t[e]={type:i,type2:n,flag:s,value:o}}else void 0===t[r.name]?"number"==typeof r.id?(t[r.name]={},t[r.name][r.id]=r):t[r.name]=r:"PoseNode"===r.name?(Array.isArray(t[r.name])||(t[r.name]=[t[r.name]]),t[r.name].push(r)):void 0===t[r.name][r.id]&&(t[r.name][r.id]=r)}parseProperty(e){const t=e.getString(1);let r;switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":return r=e.getUint32(),e.getArrayBuffer(r);case"S":return r=e.getUint32(),e.getString(r);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":const i=e.getUint32(),s=e.getUint32(),o=e.getUint32();if(0===s)switch(t){case"b":case"c":return e.getBooleanArray(i);case"d":return e.getFloat64Array(i);case"f":return e.getFloat32Array(i);case"i":return e.getInt32Array(i);case"l":return e.getInt64Array(i)}const a=n.unzlibSync(new Uint8Array(e.getArrayBuffer(o))),l=new Cu(a.buffer);switch(t){case"b":case"c":return l.getBooleanArray(i);case"d":return l.getFloat64Array(i);case"f":return l.getFloat32Array(i);case"i":return l.getInt32Array(i);case"l":return l.getInt64Array(i)}default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}}class Cu{constructor(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=void 0===t||t}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(e){this.offset+=e}getBoolean(){return 1==(1&this.getUint8())}getBooleanArray(e){const t=[];for(let r=0;r<e;r++)t.push(this.getBoolean());return t}getUint8(){const e=this.dv.getUint8(this.offset);return this.offset+=1,e}getInt16(){const e=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,e}getInt32(){const e=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,e}getInt32Array(e){const t=[];for(let r=0;r<e;r++)t.push(this.getInt32());return t}getUint32(){const e=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,e}getInt64(){let e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),2147483648&t?(t=4294967295&~t,e=4294967295&~e,4294967295===e&&(t=t+1&4294967295),e=e+1&4294967295,-(4294967296*t+e)):4294967296*t+e}getInt64Array(e){const t=[];for(let r=0;r<e;r++)t.push(this.getInt64());return t}getUint64(){let e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),4294967296*t+e}getFloat32(){const e=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e}getFloat32Array(e){const t=[];for(let r=0;r<e;r++)t.push(this.getFloat32());return t}getFloat64(){const e=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e}getFloat64Array(e){const t=[];for(let r=0;r<e;r++)t.push(this.getFloat64());return t}getArrayBuffer(e){const t=this.dv.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}getString(t){let r=[];for(let e=0;e<t;e++)r[e]=this.getUint8();const i=r.indexOf(0);return i>=0&&(r=r.slice(0,i)),e.LoaderUtils.decodeText(new Uint8Array(r))}}class Fu{add(e,t){this[e]=t}}function Eu(e){const t=e.match(/FBXVersion: (\d+)/);if(t){return parseInt(t[1])}throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function _u(e){return e/46186158e3}const Pu=[];function Bu(e,t,r,i){let n;switch(i.mappingType){case"ByPolygonVertex":n=e;break;case"ByPolygon":n=t;break;case"ByVertice":n=r;break;case"AllSame":n=i.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+i.mappingType)}"IndexToDirect"===i.referenceType&&(n=i.indices[n]);const s=n*i.dataSize,o=s+i.dataSize;return function(e,t,r,i){for(let n=r,s=0;n<i;n++,s++)e[s]=t[n];return e}(Pu,i.buffer,s,o)}const Lu=new e.Euler,Ru=new e.Vector3;function Nu(t){const r=new e.Matrix4,i=new e.Matrix4,n=new e.Matrix4,s=new e.Matrix4,o=new e.Matrix4,a=new e.Matrix4,l=new e.Matrix4,c=new e.Matrix4,h=new e.Matrix4,u=new e.Matrix4,d=new e.Matrix4,p=new e.Matrix4,m=t.inheritType?t.inheritType:0;if(t.translation&&r.setPosition(Ru.fromArray(t.translation)),t.preRotation){const r=t.preRotation.map(e.MathUtils.degToRad);r.push(t.eulerOrder),i.makeRotationFromEuler(Lu.fromArray(r))}if(t.rotation){const r=t.rotation.map(e.MathUtils.degToRad);r.push(t.eulerOrder),n.makeRotationFromEuler(Lu.fromArray(r))}if(t.postRotation){const r=t.postRotation.map(e.MathUtils.degToRad);r.push(t.eulerOrder),s.makeRotationFromEuler(Lu.fromArray(r)),s.invert()}t.scale&&o.scale(Ru.fromArray(t.scale)),t.scalingOffset&&l.setPosition(Ru.fromArray(t.scalingOffset)),t.scalingPivot&&a.setPosition(Ru.fromArray(t.scalingPivot)),t.rotationOffset&&c.setPosition(Ru.fromArray(t.rotationOffset)),t.rotationPivot&&h.setPosition(Ru.fromArray(t.rotationPivot)),t.parentMatrixWorld&&(d.copy(t.parentMatrix),u.copy(t.parentMatrixWorld));const f=i.clone().multiply(n).multiply(s),g=new e.Matrix4;g.extractRotation(u);const v=new e.Matrix4;v.copyPosition(u);const x=v.clone().invert().multiply(u),y=g.clone().invert().multiply(x),b=o,A=new e.Matrix4;if(0===m)A.copy(g).multiply(f).multiply(y).multiply(b);else if(1===m)A.copy(g).multiply(y).multiply(f).multiply(b);else{const t=(new e.Matrix4).scale((new e.Vector3).setFromMatrixScale(d)).clone().invert(),r=y.clone().multiply(t);A.copy(g).multiply(f).multiply(r).multiply(b)}const w=h.clone().invert(),M=a.clone().invert();let T=r.clone().multiply(c).multiply(h).multiply(i).multiply(n).multiply(s).multiply(w).multiply(l).multiply(a).multiply(o).multiply(M);const S=(new e.Matrix4).copyPosition(T),C=u.clone().multiply(S);return p.copyPosition(C),T=p.clone().multiply(A),T.premultiply(u.invert()),T}function Du(e){const t=["ZYX","YZX","XZY","ZXY","YXZ","XYZ"];return 6===(e=e||0)?(console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."),t[0]):t[e]}function Iu(e){return e.split(",").map((function(e){return parseFloat(e)}))}function Uu(t,r,i){return void 0===r&&(r=0),void 0===i&&(i=t.byteLength),e.LoaderUtils.decodeText(new Uint8Array(t,r,i))}function Ou(e,t,r){return e.slice(0,t).concat(r).concat(e.slice(t))}class ku extends e.Loader{constructor(e){super(e)}load(t,r,i,n){const s=new e.FileLoader(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(t,(e=>{if("string"!=typeof e)throw new Error("unsupported data type");const t=JSON.parse(e),i=this.parse(t);r&&r(i)}),i,n)}parse(e){return new Vu(e)}}class Vu{constructor(e){p.default(this,"data",void 0),this.data=e}generateShapes(e,t=100,r){const i=[],n={letterSpacing:0,lineHeight:1,...r},s=function(e,t,r,i){const n=Array.from(e),s=t/r.resolution,o=(r.boundingBox.yMax-r.boundingBox.yMin+r.underlineThickness)*s,a=[];let l=0,c=0;for(let e=0;e<n.length;e++){const t=n[e];if("\n"===t)l=0,c-=o*i.lineHeight;else{const e=Gu(t,s,l,c,r);e&&(l+=e.offsetX+i.letterSpacing,a.push(e.path))}}return a}(e,t,this.data,n);for(let e=0,t=s.length;e<t;e++)Array.prototype.push.apply(i,s[e].toShapes(!1));return i}}function Gu(t,r,i,n,s){const o=s.glyphs[t]||s.glyphs["?"];if(!o)return void console.error('THREE.Font: character "'+t+'" does not exists in font family '+s.familyName+".");const a=new e.ShapePath;let l,c,h,u,d,p,m,f;if(o.o){const e=o._cachedOutline||(o._cachedOutline=o.o.split(" "));for(let t=0,s=e.length;t<s;){switch(e[t++]){case"m":l=parseInt(e[t++])*r+i,c=parseInt(e[t++])*r+n,a.moveTo(l,c);break;case"l":l=parseInt(e[t++])*r+i,c=parseInt(e[t++])*r+n,a.lineTo(l,c);break;case"q":h=parseInt(e[t++])*r+i,u=parseInt(e[t++])*r+n,d=parseInt(e[t++])*r+i,p=parseInt(e[t++])*r+n,a.quadraticCurveTo(d,p,h,u);break;case"b":h=parseInt(e[t++])*r+i,u=parseInt(e[t++])*r+n,d=parseInt(e[t++])*r+i,p=parseInt(e[t++])*r+n,m=parseInt(e[t++])*r+i,f=parseInt(e[t++])*r+n,a.bezierCurveTo(d,p,m,f,h,u)}}}return{offsetX:o.ha*r,path:a}}p.default(Vu,"isFont",void 0),p.default(Vu,"type",void 0);class zu extends e.DataTextureLoader{constructor(e){super(e)}parse(t){const r=0,i=1,n=2,s=3,o=9,a=10,l=11,c=48,h=4,u=0,d=1,p=2,m=3;t.length<19&&console.error("THREE.TGALoader: Not enough data to contain header.");let f=0;const g=new Uint8Array(t),v={id_length:g[f++],colormap_type:g[f++],image_type:g[f++],colormap_index:g[f++]|g[f++]<<8,colormap_length:g[f++]|g[f++]<<8,colormap_size:g[f++],origin:[g[f++]|g[f++]<<8,g[f++]|g[f++]<<8],width:g[f++]|g[f++]<<8,height:g[f++]|g[f++]<<8,pixel_size:g[f++],flags:g[f++]};!function(e){switch(e.image_type){case i:case o:(e.colormap_length>256||24!==e.colormap_size||1!==e.colormap_type)&&console.error("THREE.TGALoader: Invalid type colormap data for indexed type.");break;case n:case s:case a:case l:e.colormap_type&&console.error("THREE.TGALoader: Invalid type colormap data for colormap type.");break;case r:console.error("THREE.TGALoader: No data.");default:console.error('THREE.TGALoader: Invalid type "%s".',e.image_type)}(e.width<=0||e.height<=0)&&console.error("THREE.TGALoader: Invalid image size."),8!==e.pixel_size&&16!==e.pixel_size&&24!==e.pixel_size&&32!==e.pixel_size&&console.error('THREE.TGALoader: Invalid pixel size "%s".',e.pixel_size)}(v),v.id_length+f>t.length&&console.error("THREE.TGALoader: No data."),f+=v.id_length;let x=!1,y=!1,b=!1;switch(v.image_type){case o:x=!0,y=!0;break;case i:y=!0;break;case a:x=!0;break;case n:break;case l:x=!0,b=!0;break;case s:b=!0}const A=new Uint8Array(v.width*v.height*4),w=function(e,t,r,i,n){let s,o;const a=r.pixel_size>>3,l=r.width*r.height*a;if(t&&(o=n.subarray(i,i+=r.colormap_length*(r.colormap_size>>3))),e){let e,t,r;s=new Uint8Array(l);let o=0;const c=new Uint8Array(a);for(;o<l;)if(e=n[i++],t=1+(127&e),128&e){for(r=0;r<a;++r)c[r]=n[i++];for(r=0;r<t;++r)s.set(c,o+r*a);o+=a*t}else{for(t*=a,r=0;r<t;++r)s[o+r]=n[i++];o+=t}}else s=n.subarray(i,i+=t?r.width*r.height:l);return{pixel_data:s,palettes:o}}(x,y,v,f,g);return function(e,t,r,i,n){let s,o,a,l,f,g;switch((v.flags&c)>>h){default:case p:s=0,a=1,f=t,o=0,l=1,g=r;break;case u:s=0,a=1,f=t,o=r-1,l=-1,g=-1;break;case m:s=t-1,a=-1,f=-1,o=0,l=1,g=r;break;case d:s=t-1,a=-1,f=-1,o=r-1,l=-1,g=-1}if(b)switch(v.pixel_size){case 8:!function(e,t,r,i,n,s,o,a){let l,c,h,u=0;const d=v.width;for(h=t;h!==i;h+=r)for(c=n;c!==o;c+=s,u++)l=a[u],e[4*(c+d*h)+0]=l,e[4*(c+d*h)+1]=l,e[4*(c+d*h)+2]=l,e[4*(c+d*h)+3]=255}(e,o,l,g,s,a,f,i);break;case 16:!function(e,t,r,i,n,s,o,a){let l,c,h=0;const u=v.width;for(c=t;c!==i;c+=r)for(l=n;l!==o;l+=s,h+=2)e[4*(l+u*c)+0]=a[h+0],e[4*(l+u*c)+1]=a[h+0],e[4*(l+u*c)+2]=a[h+0],e[4*(l+u*c)+3]=a[h+1]}(e,o,l,g,s,a,f,i);break;default:console.error("THREE.TGALoader: Format not supported.")}else switch(v.pixel_size){case 8:!function(e,t,r,i,n,s,o,a,l){const c=l;let h,u,d,p=0;const m=v.width;for(d=t;d!==i;d+=r)for(u=n;u!==o;u+=s,p++)h=a[p],e[4*(u+m*d)+3]=255,e[4*(u+m*d)+2]=c[3*h+0],e[4*(u+m*d)+1]=c[3*h+1],e[4*(u+m*d)+0]=c[3*h+2]}(e,o,l,g,s,a,f,i,n);break;case 16:!function(e,t,r,i,n,s,o,a){let l,c,h,u=0;const d=v.width;for(h=t;h!==i;h+=r)for(c=n;c!==o;c+=s,u+=2)l=a[u+0]+(a[u+1]<<8),e[4*(c+d*h)+0]=(31744&l)>>7,e[4*(c+d*h)+1]=(992&l)>>2,e[4*(c+d*h)+2]=(31&l)>>3,e[4*(c+d*h)+3]=32768&l?0:255}(e,o,l,g,s,a,f,i);break;case 24:!function(e,t,r,i,n,s,o,a){let l,c,h=0;const u=v.width;for(c=t;c!==i;c+=r)for(l=n;l!==o;l+=s,h+=3)e[4*(l+u*c)+3]=255,e[4*(l+u*c)+2]=a[h+0],e[4*(l+u*c)+1]=a[h+1],e[4*(l+u*c)+0]=a[h+2]}(e,o,l,g,s,a,f,i);break;case 32:!function(e,t,r,i,n,s,o,a){let l,c,h=0;const u=v.width;for(c=t;c!==i;c+=r)for(l=n;l!==o;l+=s,h+=4)e[4*(l+u*c)+2]=a[h+0],e[4*(l+u*c)+1]=a[h+1],e[4*(l+u*c)+0]=a[h+2],e[4*(l+u*c)+3]=a[h+3]}(e,o,l,g,s,a,f,i);break;default:console.error("THREE.TGALoader: Format not supported.")}}(A,v.width,v.height,w.pixel_data,w.palettes),{data:A,width:v.width,height:v.height,flipY:!0,generateMipmaps:!0,minFilter:e.LinearMipmapLinearFilter}}}class Hu extends e.Texture{constructor(t=null,r=1,i=1,n=1){super(null),this.isData3DTexture=!0,this.image={data:t,width:r,height:i,depth:n},this.magFilter=e.NearestFilter,this.minFilter=e.NearestFilter,this.wrapR=e.ClampToEdgeWrapping,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class ju extends e.Loader{load(t,r,i,n){const s=new e.FileLoader(this.manager);s.setPath(this.path),s.setResponseType("text"),s.load(t,(e=>{try{r(this.parse(e))}catch(e){n?n(e):console.error(e),this.manager.itemError(t)}}),i,n)}parse(t){t=t.replace(/^#.*?(\n|\r)/gm,"").replace(/^\s*?(\n|\r)/gm,"").trim();let r=null,i=null;const n=new e.Vector3(0,0,0),s=new e.Vector3(1,1,1),o=t.split(/[\n\r]+/g);let a=null,l=0;for(let e=0,t=o.length;e<t;e++){const t=o[e].trim(),c=t.split(/\s/g);switch(c[0]){case"TITLE":r=t.substring(7,t.length-1);break;case"LUT_3D_SIZE":const e=c[1];i=parseFloat(e),a=new Uint8Array(i*i*i*4);break;case"DOMAIN_MIN":n.x=parseFloat(c[1]),n.y=parseFloat(c[2]),n.z=parseFloat(c[3]);break;case"DOMAIN_MAX":s.x=parseFloat(c[1]),s.y=parseFloat(c[2]),s.z=parseFloat(c[3]);break;default:const o=parseFloat(c[0]),h=parseFloat(c[1]),u=parseFloat(c[2]);if(o>1||o<0||h>1||h<0||u>1||u<0)throw new Error("LUTCubeLoader : Non normalized values not supported.");a[l+0]=255*o,a[l+1]=255*h,a[l+2]=255*u,a[l+3]=255,l+=4}}const c=new e.DataTexture;c.image.data=a,c.image.width=i,c.image.height=i*i,c.type=e.UnsignedByteType,c.magFilter=e.LinearFilter,c.minFilter=e.LinearFilter,c.wrapS=e.ClampToEdgeWrapping,c.wrapT=e.ClampToEdgeWrapping,c.generateMipmaps=!1,c.needsUpdate=!0;const h=new Hu;return h.image.data=a,h.image.width=i,h.image.height=i,h.image.depth=i,h.type=e.UnsignedByteType,h.magFilter=e.LinearFilter,h.minFilter=e.LinearFilter,h.wrapS=e.ClampToEdgeWrapping,h.wrapT=e.ClampToEdgeWrapping,h.wrapR=e.ClampToEdgeWrapping,h.generateMipmaps=!1,h.needsUpdate=!0,{title:r,size:i,domainMin:n,domainMax:s,texture:c,texture3D:h}}}class Wu extends e.Loader{constructor(e){super(e)}load(t,r,i,n){const s=this,o=new e.FileLoader(s.manager);o.setPath(s.path),o.setResponseType("arraybuffer"),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(t,(function(e){try{r(s.parse(e))}catch(e){n?n(e):console.error(e),s.manager.itemError(t)}}),i,n)}parse(t){let r=t,i=0;const s=new Int8Array(new Int16Array([1]).buffer)[0]>0,o={};const a=function(e,t){null==t&&(t=1);let n=1,o=Uint8Array;switch(e){case"uchar":break;case"schar":o=Int8Array;break;case"ushort":o=Uint16Array,n=2;break;case"sshort":o=Int16Array,n=2;break;case"uint":o=Uint32Array,n=4;break;case"sint":o=Int32Array,n=4;break;case"float":o=Float32Array,n=4;break;case"complex":case"double":o=Float64Array,n=8}let a=new o(r.slice(i,i+=t*n));return true!=s&&(a=function(e,t){const r=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);for(let i=0;i<e.byteLength;i+=t)for(let e=i+t-1,n=i;e>n;e--,n++){const t=r[n];r[n]=r[e],r[e]=t}return e}(a,n)),1==t?a[0]:a}("uchar",t.byteLength),l=a.length;let c,h=null,u=0;for(c=1;c<l;c++)if(10==a[c-1]&&10==a[c]){h=this.parseChars(a,0,c-2),u=c+1;break}if(function(t){let r,i,n,s,a,l,c,h;const u=t.split(/\r?\n/);for(c=0,h=u.length;c<h;c++)a=u[c],a.match(/NRRD\d+/)?o.isNrrd=!0:a.match(/^#/)||(l=a.match(/(.*):(.*)/))&&(i=l[1].trim(),r=l[2].trim(),n=Xu[i],n?n.call(o,r):o[i]=r);if(!o.isNrrd)throw new Error("Not an NRRD file");if("bz2"===o.encoding||"bzip2"===o.encoding)throw new Error("Bzip is not supported");if(!o.vectors&&(o.vectors=[new e.Vector3(1,0,0),new e.Vector3(0,1,0),new e.Vector3(0,0,1)],o.spacings))for(s=0;s<=2;s++)isNaN(o.spacings[s])||o.vectors[s].multiplyScalar(o.spacings[s])}(h),r=a.subarray(u),"gz"===o.encoding.substring(0,2))r=n.gunzipSync(new Uint8Array(r));else if("ascii"===o.encoding||"text"===o.encoding||"txt"===o.encoding||"hex"===o.encoding)r=function(e,t,r){let i,n="";t=t||0,r=r||e.length;const s=o.sizes.reduce((function(e,t){return e*t}),1);let a=10;"hex"===o.encoding&&(a=16);const l=new o.__array(s);let c=0,h=parseInt;o.__array!==Float32Array&&o.__array!==Float64Array||(h=parseFloat);for(let s=t;s<r;s++)i=e[s],(i<9||i>13)&&32!==i?n+=String.fromCharCode(i):(""!==n&&(l[c]=h(n,a),c++),n="");return""!==n&&(l[c]=h(n,a),c++),l}(r);else if("raw"===o.encoding){const e=new Uint8Array(r.length);for(let t=0;t<r.length;t++)e[t]=r[t];r=e}r=r.buffer;const d=new Y;d.header=o,d.data=new o.__array(r);const p=d.computeMinMax(),m=p[0],f=p[1];d.windowLow=m,d.windowHigh=f,d.dimensions=[o.sizes[0],o.sizes[1],o.sizes[2]],d.xLength=d.dimensions[0],d.yLength=d.dimensions[1],d.zLength=d.dimensions[2];const g=new e.Vector3(o.vectors[0][0],o.vectors[0][1],o.vectors[0][2]).length(),v=new e.Vector3(o.vectors[1][0],o.vectors[1][1],o.vectors[1][2]).length(),x=new e.Vector3(o.vectors[2][0],o.vectors[2][1],o.vectors[2][2]).length();d.spacing=[g,v,x],d.matrix=new e.Matrix4;let y=1,b=1;if("left-posterior-superior"==o.space?(y=-1,b=-1):"left-anterior-superior"===o.space&&(y=-1),o.vectors){const e=o.vectors;d.matrix.set(y*e[0][0],y*e[1][0],y*e[2][0],0,b*e[0][1],b*e[1][1],b*e[2][1],0,1*e[0][2],1*e[1][2],1*e[2][2],0,0,0,0,1)}else d.matrix.set(y,0,0,0,0,b,0,0,0,0,1,0,0,0,0,1);return d.inverseMatrix=new e.Matrix4,d.inverseMatrix.copy(d.matrix).invert(),d.RASDimensions=new e.Vector3(d.xLength,d.yLength,d.zLength).applyMatrix4(d.matrix).round().toArray().map(Math.abs),d.lowerThreshold===-1/0&&(d.lowerThreshold=m),d.upperThreshold===1/0&&(d.upperThreshold=f),d}parseChars(e,t,r){void 0===t&&(t=0),void 0===r&&(r=e.length);let i="",n=0;for(n=t;n<r;++n)i+=String.fromCharCode(e[n]);return i}}const Xu={type:function(e){switch(e){case"uchar":case"unsigned char":case"uint8":case"uint8_t":this.__array=Uint8Array;break;case"signed char":case"int8":case"int8_t":this.__array=Int8Array;break;case"short":case"short int":case"signed short":case"signed short int":case"int16":case"int16_t":this.__array=Int16Array;break;case"ushort":case"unsigned short":case"unsigned short int":case"uint16":case"uint16_t":this.__array=Uint16Array;break;case"int":case"signed int":case"int32":case"int32_t":this.__array=Int32Array;break;case"uint":case"unsigned int":case"uint32":case"uint32_t":this.__array=Uint32Array;break;case"float":this.__array=Float32Array;break;case"double":this.__array=Float64Array;break;default:throw new Error("Unsupported NRRD data type: "+e)}return this.type=e},endian:function(e){return this.endian=e},encoding:function(e){return this.encoding=e},dimension:function(e){return this.dim=parseInt(e,10)},sizes:function(e){let t;return this.sizes=function(){const r=e.split(/\s+/),i=[];for(let e=0,n=r.length;e<n;e++)t=r[e],i.push(parseInt(t,10));return i}()},space:function(e){return this.space=e},"space origin":function(e){return this.space_origin=e.split("(")[1].split(")")[0].split(",")},"space directions":function(e){let t,r;const i=e.match(/\(.*?\)/g);return this.vectors=function(){const e=[];for(let n=0,s=i.length;n<s;n++)r=i[n],e.push(function(){const e=r.slice(1,-1).split(/,/),i=[];for(let r=0,n=e.length;r<n;r++)t=e[r],i.push(parseFloat(t));return i}());return e}()},spacings:function(e){let t;const r=e.split(/\s+/);return this.spacings=function(){const e=[];for(let i=0,n=r.length;i<n;i++)t=r[i],e.push(parseFloat(t));return e}()}};class Qu extends e.Loader{constructor(e){super(e)}load(t,r,i,n){const s=this,o=new e.FileLoader(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,(function(e){try{r(s.parse(e))}catch(e){n?n(e):console.error(e),s.manager.itemError(t)}}),i,n)}parse(t){function r(e,t,r){for(let i=0,n=e.length;i<n;i++)if(e[i]!==t.getUint8(r+i,!1))return!1;return!0}const i=function(e){if("string"==typeof e){const t=new Uint8Array(e.length);for(let r=0;r<e.length;r++)t[r]=255&e.charCodeAt(r);return t.buffer||t}return e}(t);return function(e){const t=new DataView(e);if(84+50*t.getUint32(80,!0)===t.byteLength)return!0;const i=[115,111,108,105,100];for(let e=0;e<5;e++)if(r(i,t,e))return!1;return!0}(i)?function(t){const r=new DataView(t),i=r.getUint32(80,!0);let n,s,o,a,l,c,h,u,d=!1;for(let e=0;e<70;e++)1129270351==r.getUint32(e,!1)&&82==r.getUint8(e+4)&&61==r.getUint8(e+5)&&(d=!0,a=new Float32Array(3*i*3),l=r.getUint8(e+6)/255,c=r.getUint8(e+7)/255,h=r.getUint8(e+8)/255,u=r.getUint8(e+9)/255);const p=new e.BufferGeometry,m=new Float32Array(3*i*3),f=new Float32Array(3*i*3);for(let e=0;e<i;e++){const t=84+50*e,i=r.getFloat32(t,!0),u=r.getFloat32(t+4,!0),p=r.getFloat32(t+8,!0);if(d){const e=r.getUint16(t+48,!0);0==(32768&e)?(n=(31&e)/31,s=(e>>5&31)/31,o=(e>>10&31)/31):(n=l,s=c,o=h)}for(let l=1;l<=3;l++){const c=t+12*l,h=3*e*3+3*(l-1);m[h]=r.getFloat32(c,!0),m[h+1]=r.getFloat32(c+4,!0),m[h+2]=r.getFloat32(c+8,!0),f[h]=i,f[h+1]=u,f[h+2]=p,d&&(a[h]=n,a[h+1]=s,a[h+2]=o)}}return p.setAttribute("position",new e.BufferAttribute(m,3)),p.setAttribute("normal",new e.BufferAttribute(f,3)),d&&(p.setAttribute("color",new e.BufferAttribute(a,3)),p.hasColors=!0,p.alpha=u),p}(i):function(t){const r=new e.BufferGeometry,i=/solid([\s\S]*?)endsolid/g,n=/facet([\s\S]*?)endfacet/g;let s=0;const o=/[\s]+([+-]?(?:\d*)(?:\.\d*)?(?:[eE][+-]?\d+)?)/.source,a=new RegExp("vertex"+o+o+o,"g"),l=new RegExp("normal"+o+o+o,"g"),c=[],h=[],u=new e.Vector3;let d,p=0,m=0,f=0;for(;null!==(d=i.exec(t));){m=f;const e=d[0];for(;null!==(d=n.exec(e));){let e=0,t=0;const r=d[0];for(;null!==(d=l.exec(r));)u.x=parseFloat(d[1]),u.y=parseFloat(d[2]),u.z=parseFloat(d[3]),t++;for(;null!==(d=a.exec(r));)c.push(parseFloat(d[1]),parseFloat(d[2]),parseFloat(d[3])),h.push(u.x,u.y,u.z),e++,f++;1!==t&&console.error("THREE.STLLoader: Something isn't right with the normal of face number "+s),3!==e&&console.error("THREE.STLLoader: Something isn't right with the vertices of face number "+s),s++}const t=m,i=f-m;r.addGroup(t,i,p),p++}return r.setAttribute("position",new e.Float32BufferAttribute(c,3)),r.setAttribute("normal",new e.Float32BufferAttribute(h,3)),r}(function(t){return"string"!=typeof t?e.LoaderUtils.decodeText(new Uint8Array(t)):t}(t))}}class Yu extends e.Loader{constructor(e){super(e)}load(t,r,i,n){const s=this,o=""===this.path?e.LoaderUtils.extractUrlBase(t):this.path,a=new e.FileLoader(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(t,(function(e){try{r(s.parse(e,o))}catch(e){n?n(e):console.error(e),s.manager.itemError(t)}}),i,n)}setMaterialOptions(e){return this.materialOptions=e,this}parse(e,t){const r=e.split("\n");let i={};const n=/\s+/,s={};for(let e=0;e<r.length;e++){let t=r[e];if(t=t.trim(),0===t.length||"#"===t.charAt(0))continue;const o=t.indexOf(" ");let a=o>=0?t.substring(0,o):t;a=a.toLowerCase();let l=o>=0?t.substring(o+1):"";if(l=l.trim(),"newmtl"===a)i={name:l},s[l]=i;else if("ka"===a||"kd"===a||"ks"===a||"ke"===a){const e=l.split(n,3);i[a]=[parseFloat(e[0]),parseFloat(e[1]),parseFloat(e[2])]}else i[a]=l}const o=new Ku(this.resourcePath||t,this.materialOptions);return o.setCrossOrigin(this.crossOrigin),o.setManager(this.manager),o.setMaterials(s),o}}class Ku{constructor(t="",r={}){this.baseUrl=t,this.options=r,this.materialsInfo={},this.materials={},this.materialsArray=[],this.nameLookup={},this.crossOrigin="anonymous",this.side=void 0!==this.options.side?this.options.side:e.FrontSide,this.wrap=void 0!==this.options.wrap?this.options.wrap:e.RepeatWrapping}setCrossOrigin(e){return this.crossOrigin=e,this}setManager(e){this.manager=e}setMaterials(e){this.materialsInfo=this.convert(e),this.materials={},this.materialsArray=[],this.nameLookup={}}convert(e){if(!this.options)return e;const t={};for(const r in e){const i=e[r],n={};t[r]=n;for(const e in i){let t=!0,r=i[e];const s=e.toLowerCase();switch(s){case"kd":case"ka":case"ks":this.options&&this.options.normalizeRGB&&(r=[r[0]/255,r[1]/255,r[2]/255]),this.options&&this.options.ignoreZeroRGBs&&0===r[0]&&0===r[1]&&0===r[2]&&(t=!1)}t&&(n[s]=r)}}return t}preload(){for(const e in this.materialsInfo)this.create(e)}getIndex(e){return this.nameLookup[e]}getAsArray(){let e=0;for(const t in this.materialsInfo)this.materialsArray[e]=this.create(t),this.nameLookup[t]=e,e++;return this.materialsArray}create(e){return void 0===this.materials[e]&&this.createMaterial_(e),this.materials[e]}createMaterial_(t){const r=this,i=this.materialsInfo[t],n={name:t,side:this.side};function s(e,t){if(n[e])return;const i=r.getTextureParams(t,n),s=r.loadTexture((o=r.baseUrl,"string"!=typeof(a=i.url)||""===a?"":/^https?:\/\//i.test(a)?a:o+a));var o,a;s.repeat.copy(i.scale),s.offset.copy(i.offset),s.wrapS=r.wrap,s.wrapT=r.wrap,n[e]=s}for(const t in i){const r=i[t];let o;if(""!==r)switch(t.toLowerCase()){case"kd":n.color=(new e.Color).fromArray(r);break;case"ks":n.specular=(new e.Color).fromArray(r);break;case"ke":n.emissive=(new e.Color).fromArray(r);break;case"map_kd":s("map",r);break;case"map_ks":s("specularMap",r);break;case"map_ke":s("emissiveMap",r);break;case"norm":s("normalMap",r);break;case"map_bump":case"bump":s("bumpMap",r);break;case"map_d":s("alphaMap",r),n.transparent=!0;break;case"ns":n.shininess=parseFloat(r);break;case"d":o=parseFloat(r),o<1&&(n.opacity=o,n.transparent=!0);break;case"tr":o=parseFloat(r),this.options&&this.options.invertTrProperty&&(o=1-o),o>0&&(n.opacity=1-o,n.transparent=!0)}}return this.materials[t]=new e.MeshPhongMaterial(n),this.materials[t]}getTextureParams(t,r){const i={scale:new e.Vector2(1,1),offset:new e.Vector2(0,0)},n=t.split(/\s+/);let s;return s=n.indexOf("-bm"),s>=0&&(r.bumpScale=parseFloat(n[s+1]),n.splice(s,2)),s=n.indexOf("-s"),s>=0&&(i.scale.set(parseFloat(n[s+1]),parseFloat(n[s+2])),n.splice(s,4)),s=n.indexOf("-o"),s>=0&&(i.offset.set(parseFloat(n[s+1]),parseFloat(n[s+2])),n.splice(s,4)),i.url=n.join(" ").trim(),i}loadTexture(t,r,i,n,s){const o=void 0!==this.manager?this.manager:e.DefaultLoadingManager;let a=o.getHandler(t);null===a&&(a=new e.TextureLoader(o)),a.setCrossOrigin&&a.setCrossOrigin(this.crossOrigin);const l=a.load(t,i,n,s);return void 0!==r&&(l.mapping=r),l}}var qu,Ju,Zu,$u,ed,td,rd=(qu=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},Ju=function(){function e(e,t){for(let i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),Zu=function e(){qu(this,e),this.boneName="",this.BoneIndex=0,this.Indeces=[],this.Weights=[],this.initMatrix=null,this.OffsetMatrix=null},$u=function e(){qu(this,e),this.animeName="",this.boneName="",this.targetBone=null,this.keyType=4,this.frameStartLv=0,this.keyFrames=[],this.InverseMx=null},ed=function(){function t(e){qu(this,t),this.fps=30,this.name="xanimation",this.length=0,this.hierarchy=[],this.putFlags=e,void 0===this.putFlags.putPos&&(this.putFlags.putPos=!0),void 0===this.putFlags.putRot&&(this.putFlags.putRot=!0),void 0===this.putFlags.putScl&&(this.putFlags.putScl=!0)}return Ju(t,[{key:"make",value:function(e){for(let t=0;t<e.length;t++)this.hierarchy.push(this.makeBonekeys(e[t]));this.length=this.hierarchy[0].keys[this.hierarchy[0].keys.length-1].time}},{key:"clone",value:function(){return Object.assign({},this)}},{key:"makeBonekeys",value:function(e){var t={};return t.name=e.boneName,t.parent="",t.keys=this.keyFrameRefactor(e),t.copy=function(){return Object.assign({},this)},t}},{key:"keyFrameRefactor",value:function(t){var r=[];for(let n=0;n<t.keyFrames.length;n++){var i={};i.time=t.keyFrames[n].time*this.fps,t.keyFrames[n].pos&&this.putFlags.putPos&&(i.pos=t.keyFrames[n].pos),t.keyFrames[n].rot&&this.putFlags.putRot&&(i.rot=t.keyFrames[n].rot),t.keyFrames[n].scl&&this.putFlags.putScl&&(i.scl=t.keyFrames[n].scl),t.keyFrames[n].matrix&&(i.matrix=t.keyFrames[n].matrix,this.putFlags.putPos&&(i.pos=(new e.Vector3).setFromMatrixPosition(i.matrix)),this.putFlags.putRot&&(i.rot=(new e.Quaternion).setFromRotationMatrix(i.matrix)),this.putFlags.putScl&&(i.scl=(new e.Vector3).setFromMatrixScale(i.matrix))),r.push(i)}return r}}]),t}(),td=function e(){qu(this,e),this.index=0,this.Frame=0,this.time=0,this.matrix=null},function(){function t(r){e.Loader.call(this,r),qu(this,t),this.debug=!1,this.texloader=new e.TextureLoader(this.manager),this.url="",this._putMatLength=0,this._nowMat=null,this._nowFrameName="",this.frameHierarchie=[],this.Hierarchies={},this.HieStack=[],this._currentObject={},this._currentFrame={},this._data=null,this.onLoad=null,this.IsUvYReverse=!0,this.Meshes=[],this.animations=[],this.animTicksPerSecond=30,this._currentGeo=null,this._currentAnime=null,this._currentAnimeFrames=null}return Ju(t,[{key:"_setArgOption",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(e){for(let r=t;r<e.length;r++)switch(r){case 0:this.url=e[r];break;case 1:this.options=e[r]}void 0===this.options&&(this.options={})}}},{key:"load",value:function(t,r,i,n){var s=this;this._setArgOption(t);var o=new e.FileLoader(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(this.url,(function(e){try{s.parse(e,r)}catch(e){n?n(e):console.error(e),s.manager.itemError(s.url)}}),i,n)}},{key:"_readLine",value:function(e){for(var t=0;;){var r=-1;if(-1===(r=e.indexOf("//",t))&&(r=e.indexOf("#",t)),!(r>-1&&r<2))break;var i=-1;t=(i=e.indexOf("\r\n",t))>0?i+2:(i=e.indexOf("\r",t))>0?i+1:e.indexOf("\n",t)+1}return e.substr(t)}},{key:"_readLine",value:function(e){for(var t=0;;){var r=-1;if(-1===(r=e.indexOf("//",t))&&(r=e.indexOf("#",t)),!(r>-1&&r<2))break;var i=-1;t=(i=e.indexOf("\r\n",t))>0?i+2:(i=e.indexOf("\r",t))>0?i+1:e.indexOf("\n",t)+1}return e.substr(t)}},{key:"_isBinary",value:function(e){var t=new DataView(e);if(84+50*t.getUint32(80,!0)===t.byteLength)return!0;var r=t.byteLength;for(let e=0;e<r;e++)if(t.getUint8(e,!1)>127)return!0;return!1}},{key:"_ensureBinary",value:function(e){if("string"==typeof e){var t=new Uint8Array(e.length);for(let r=0;r<e.length;r++)t[r]=255&e.charCodeAt(r);return t.buffer||t}return e}},{key:"_ensureString",value:function(t){return"string"!=typeof t?e.LoaderUtils.decodeText(new Uint8Array(t)):t}},{key:"parse",value:function(e,t){var r=this._ensureBinary(e);return this._data=this._ensureString(e),this.onLoad=t,this._isBinary(r)?this._parseBinary(r):this._parseASCII()}},{key:"_parseBinary",value:function(t){return this._parseASCII(e.LoaderUtils.decodeText(new Uint8Array(t)))}},{key:"_parseASCII",value:function(){var t;t=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:e.LoaderUtils.extractUrlBase(this.url),this.texloader.setPath(t).setCrossOrigin(this.crossOrigin),this.Hierarchies.children=[],this._hierarchieParse(this.Hierarchies,16),this._changeRoot(),this._currentObject=this.Hierarchies.children.shift(),this._mainloop()}},{key:"_hierarchieParse",value:function(e,t){for(var r=t;;){var i=this._data.indexOf("{",r)+1,n=this._data.indexOf("}",r),s=this._data.indexOf("{",i)+1;if(!(i>0&&n>i)){r=-1===i?this._data.length:n+1;break}var o={children:[]},a=this._readLine(this._data.substr(r,i-r-1)).trim(),l=a.split(/ /g);if(l.length>0?(o.type=l[0],l.length>=2?o.name=l[1]:o.name=l[0]+this.Hierarchies.children.length):(o.name=a,o.type=""),"Animation"===o.type){o.data=this._data.substr(s,n-s).trim();var c=this._hierarchieParse(o,n+1);r=c.end,o.children=c.parent.children}else{var h=this._data.lastIndexOf(";",s>0?Math.min(s,n):n);if(o.data=this._data.substr(i,h-i).trim(),s<=0||n<s)r=n+1;else{var u=Math.max(h+1,i),d=this._hierarchieParse(o,u);r=d.end,o.children=d.parent.children}}o.parent=e,"template"!=o.type&&e.children.push(o)}return{parent:e,end:r}}},{key:"_mainloop",value:function(){var e=this;this._mainProc(),this._currentObject.parent||this._currentObject.children.length>0||!this._currentObject.worked?setTimeout((function(){e._mainloop()}),1):setTimeout((function(){e.onLoad({models:e.Meshes,animations:e.animations})}),1)}},{key:"_mainProc",value:function(){for(var e=!1;;){if(!this._currentObject.worked){switch(this._currentObject.type){case"template":break;case"AnimTicksPerSecond":this.animTicksPerSecond=parseInt(this._currentObject.data);break;case"Frame":this._setFrame();break;case"FrameTransformMatrix":this._setFrameTransformMatrix();break;case"Mesh":this._changeRoot(),this._currentGeo={},this._currentGeo.name=this._currentObject.name.trim(),this._currentGeo.parentName=this._getParentName(this._currentObject).trim(),this._currentGeo.VertexSetedBoneCount=[],this._currentGeo.GeometryData={vertices:[],normals:[],uvs:[],skinIndices:[],skinWeights:[],indices:[],materialIndices:[]},this._currentGeo.Materials=[],this._currentGeo.normalVectors=[],this._currentGeo.BoneInfs=[],this._currentGeo.baseFrame=this._currentFrame,this._makeBoneFrom_CurrentFrame(),this._readVertexDatas(),e=!0;break;case"MeshNormals":this._readVertexDatas();break;case"MeshTextureCoords":this._setMeshTextureCoords();break;case"VertexDuplicationIndices":break;case"MeshMaterialList":this._setMeshMaterialList();break;case"Material":this._setMaterial();break;case"SkinWeights":this._setSkinWeights();break;case"AnimationSet":this._changeRoot(),this._currentAnime={},this._currentAnime.name=this._currentObject.name.trim(),this._currentAnime.AnimeFrames=[];break;case"Animation":this._currentAnimeFrames&&this._currentAnime.AnimeFrames.push(this._currentAnimeFrames),this._currentAnimeFrames=new $u,this._currentAnimeFrames.boneName=this._currentObject.data.trim();break;case"AnimationKey":this._readAnimationKey(),e=!0}this._currentObject.worked=!0}if(this._currentObject.children.length>0){if(this._currentObject=this._currentObject.children.shift(),this.debug&&console.log("processing "+this._currentObject.name),e)break}else if(this._currentObject.worked&&this._currentObject.parent&&!this._currentObject.parent.parent&&this._changeRoot(),this._currentObject.parent?this._currentObject=this._currentObject.parent:e=!0,e)break}}},{key:"_changeRoot",value:function(){null!=this._currentGeo&&this._currentGeo.name&&this._makeOutputGeometry(),this._currentGeo={},null!=this._currentAnime&&this._currentAnime.name&&(this._currentAnimeFrames&&(this._currentAnime.AnimeFrames.push(this._currentAnimeFrames),this._currentAnimeFrames=null),this._makeOutputAnimation()),this._currentAnime={}}},{key:"_getParentName",value:function(e){return e.parent?e.parent.name?e.parent.name:this._getParentName(e.parent):""}},{key:"_setFrame",value:function(){this._nowFrameName=this._currentObject.name.trim(),this._currentFrame={},this._currentFrame.name=this._nowFrameName,this._currentFrame.children=[],this._currentObject.parent&&this._currentObject.parent.name&&(this._currentFrame.parentName=this._currentObject.parent.name),this.frameHierarchie.push(this._nowFrameName),this.HieStack[this._nowFrameName]=this._currentFrame}},{key:"_setFrameTransformMatrix",value:function(){this._currentFrame.FrameTransformMatrix=new e.Matrix4;var t=this._currentObject.data.split(",");this._ParseMatrixData(this._currentFrame.FrameTransformMatrix,t),this._makeBoneFrom_CurrentFrame()}},{key:"_makeBoneFrom_CurrentFrame",value:function(){if(this._currentFrame.FrameTransformMatrix){var t=new e.Bone;if(t.name=this._currentFrame.name,t.applyMatrix4(this._currentFrame.FrameTransformMatrix),t.matrixWorld=t.matrix,t.FrameTransformMatrix=this._currentFrame.FrameTransformMatrix,this._currentFrame.putBone=t,this._currentFrame.parentName)for(let e in this.HieStack)this.HieStack[e].name===this._currentFrame.parentName&&this.HieStack[e].putBone.add(this._currentFrame.putBone)}}},{key:"_readVertexDatas",value:function(){for(var e=0,t=0,r=0,i=0;;){var n=!1;if(0===r)e=this._readInt1(e).endRead,r=1,(i=this._currentObject.data.indexOf(";;",e)+1)<=0&&(i=this._currentObject.data.length);else{var s=0;switch(t){case 0:s=this._currentObject.data.indexOf(",",e)+1;break;case 1:s=this._currentObject.data.indexOf(";,",e)+1}switch((0===s||s>i)&&(s=i,r=0,n=!0),this._currentObject.type){case"Mesh":switch(t){case 0:this._readVertex1(this._currentObject.data.substr(e,s-e));break;case 1:this._readFace1(this._currentObject.data.substr(e,s-e))}break;case"MeshNormals":switch(t){case 0:this._readNormalVector1(this._currentObject.data.substr(e,s-e))}}e=s+1,n&&t++}if(e>=this._currentObject.data.length)break}}},{key:"_readInt1",value:function(e){var t=this._currentObject.data.indexOf(";",e);return{refI:parseInt(this._currentObject.data.substr(e,t-e)),endRead:t+1}}},{key:"_readVertex1",value:function(e){var t=this._readLine(e.trim()).substr(0,e.length-2).split(";");this._currentGeo.GeometryData.vertices.push(parseFloat(t[0]),parseFloat(t[1]),parseFloat(t[2])),this._currentGeo.GeometryData.skinIndices.push(0,0,0,0),this._currentGeo.GeometryData.skinWeights.push(1,0,0,0),this._currentGeo.VertexSetedBoneCount.push(0)}},{key:"_readFace1",value:function(e){var t=this._readLine(e.trim()).substr(2,e.length-4).split(",");this._currentGeo.GeometryData.indices.push(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10))}},{key:"_readNormalVector1",value:function(e){var t=this._readLine(e.trim()).substr(0,e.length-2).split(";");this._currentGeo.GeometryData.normals.push(parseFloat(t[0]),parseFloat(t[1]),parseFloat(t[2]))}},{key:"_buildGeometry",value:function(){var t=new e.BufferGeometry,r=[],i=[],n=[],s=[],o=[],a=this._currentGeo.GeometryData;for(let e=0,t=a.indices.length;e<t;e++){var l=2*a.indices[e],c=3*a.indices[e],h=4*a.indices[e];r.push(a.vertices[c],a.vertices[c+1],a.vertices[c+2]),i.push(a.normals[c],a.normals[c+1],a.normals[c+2]),s.push(a.skinIndices[h],a.skinIndices[h+1],a.skinIndices[h+2],a.skinIndices[h+3]),o.push(a.skinWeights[h],a.skinWeights[h+1],a.skinWeights[h+2],a.skinWeights[h+3]),n.push(a.uvs[l],a.uvs[l+1])}return t.setAttribute("position",new e.Float32BufferAttribute(r,3)),t.setAttribute("normal",new e.Float32BufferAttribute(i,3)),t.setAttribute("uv",new e.Float32BufferAttribute(n,2)),t.setAttribute("skinIndex",new e.Uint16BufferAttribute(s,4)),t.setAttribute("skinWeight",new e.Float32BufferAttribute(o,4)),this._computeGroups(t,a.materialIndices),t}},{key:"_computeGroups",value:function(e,t){var r,n=[],s=void 0;for(let e=0;e<t.length;e++){var o=t[e];o!==s&&(s=o,void 0!==r&&(r.count=3*e-r.start,n.push(r)),r={start:3*e,materialIndex:s})}void 0!==r&&(r.count=3*i-r.start,n.push(r)),e.groups=n}},{key:"_setMeshTextureCoords",value:function(){for(var e=0,t=0,r=0;;){switch(t){case 0:if(0===r)e=this._readInt1(0).endRead,r=1;else{var i=this._currentObject.data.indexOf(",",e)+1;0===i&&(i=this._currentObject.data.length,t=2,r=0);var n=this._currentObject.data.substr(e,i-e),s=this._readLine(n.trim()).split(";");this.IsUvYReverse?this._currentGeo.GeometryData.uvs.push(parseFloat(s[0]),1-parseFloat(s[1])):this._currentGeo.GeometryData.uvs.push(parseFloat(s[0]),parseFloat(s[1])),e=i+1}}if(e>=this._currentObject.data.length)break}}},{key:"_setMeshMaterialList",value:function(){for(var e=0,t=0,r=0;;){if(r<2)e=this._readInt1(e).endRead,r++;else{var i=this._currentObject.data.indexOf(";",e);-1===i&&(i=this._currentObject.data.length,t=3,r=0);var n=this._currentObject.data.substr(e,i-e),s=this._readLine(n.trim()).split(",");for(let e=0;e<s.length;e++)this._currentGeo.GeometryData.materialIndices[e]=parseInt(s[e]);e=this._currentObject.data.length}if(e>=this._currentObject.data.length||t>=3)break}}},{key:"_setMaterial",value:function(){var t=new e.MeshPhongMaterial({color:16777215*Math.random()});t.side=e.FrontSide,t.name=this._currentObject.name;var r=0,i=this._currentObject.data.indexOf(";;",r),n=this._currentObject.data.substr(r,i-r),s=this._readLine(n.trim()).split(";");t.color.r=parseFloat(s[0]),t.color.g=parseFloat(s[1]),t.color.b=parseFloat(s[2]),r=i+2,i=this._currentObject.data.indexOf(";",r),n=this._currentObject.data.substr(r,i-r),t.shininess=parseFloat(this._readLine(n)),r=i+1,i=this._currentObject.data.indexOf(";;",r),n=this._currentObject.data.substr(r,i-r);var o=this._readLine(n.trim()).split(";");t.specular.r=parseFloat(o[0]),t.specular.g=parseFloat(o[1]),t.specular.b=parseFloat(o[2]),r=i+2,-1===(i=this._currentObject.data.indexOf(";;",r))&&(i=this._currentObject.data.length),n=this._currentObject.data.substr(r,i-r);var a=this._readLine(n.trim()).split(";");t.emissive.r=parseFloat(a[0]),t.emissive.g=parseFloat(a[1]),t.emissive.b=parseFloat(a[2]);for(var l=null;this._currentObject.children.length>0;){l=this._currentObject.children.shift(),this.debug&&console.log("processing "+l.name);var c=l.data.substr(1,l.data.length-2);switch(l.type){case"TextureFilename":t.map=this.texloader.load(c);break;case"BumpMapFilename":t.bumpMap=this.texloader.load(c),t.bumpScale=.05;break;case"NormalMapFilename":t.normalMap=this.texloader.load(c),t.normalScale=new e.Vector2(2,2);break;case"EmissiveMapFilename":t.emissiveMap=this.texloader.load(c);break;case"LightMapFilename":t.lightMap=this.texloader.load(c)}}this._currentGeo.Materials.push(t)}},{key:"_setSkinWeights",value:function(){var t=new Zu,r=0,i=this._currentObject.data.indexOf(";",r),n=this._currentObject.data.substr(r,i-r);r=i+1,t.boneName=n.substr(1,n.length-2),t.BoneIndex=this._currentGeo.BoneInfs.length,r=(i=this._currentObject.data.indexOf(";",r))+1,i=this._currentObject.data.indexOf(";",r),n=this._currentObject.data.substr(r,i-r);var s=this._readLine(n.trim()).split(",");for(let e=0;e<s.length;e++)t.Indeces.push(parseInt(s[e]));r=i+1,i=this._currentObject.data.indexOf(";",r),n=this._currentObject.data.substr(r,i-r);var o=this._readLine(n.trim()).split(",");for(let e=0;e<o.length;e++)t.Weights.push(parseFloat(o[e]));r=i+1,(i=this._currentObject.data.indexOf(";",r))<=0&&(i=this._currentObject.data.length),n=this._currentObject.data.substr(r,i-r);var a=this._readLine(n.trim()).split(",");t.OffsetMatrix=new e.Matrix4,this._ParseMatrixData(t.OffsetMatrix,a),this._currentGeo.BoneInfs.push(t)}},{key:"_makePutBoneList",value:function(t,r){var i=!1;for(let s in this.HieStack)if(this.HieStack[s].name===t||i){i=!0;var n=new e.Bone;if(n.name=this.HieStack[s].name,n.applyMatrix4(this.HieStack[s].FrameTransformMatrix),n.matrixWorld=n.matrix,n.FrameTransformMatrix=this.HieStack[s].FrameTransformMatrix,n.pos=(new e.Vector3).setFromMatrixPosition(n.FrameTransformMatrix).toArray(),n.rotq=(new e.Quaternion).setFromRotationMatrix(n.FrameTransformMatrix).toArray(),n.scl=(new e.Vector3).setFromMatrixScale(n.FrameTransformMatrix).toArray(),this.HieStack[s].parentName&&this.HieStack[s].parentName.length>0)for(let e=0;e<r.length;e++)if(this.HieStack[s].parentName===r[e].name){r[e].add(n),n.parent=e;break}r.push(n)}}},{key:"_makeOutputGeometry",value:function(){var t=null;if(this._currentGeo.BoneInfs.length>0){var r=[];this._makePutBoneList(this._currentGeo.baseFrame.parentName,r);for(let t=0;t<this._currentGeo.BoneInfs.length;t++){var i=0;for(let n=0;n<r.length;n++)if(r[n].name===this._currentGeo.BoneInfs[t].boneName){i=n,r[n].OffsetMatrix=new e.Matrix4,r[n].OffsetMatrix.copy(this._currentGeo.BoneInfs[t].OffsetMatrix);break}for(let e=0;e<this._currentGeo.BoneInfs[t].Indeces.length;e++){var n=this._currentGeo.BoneInfs[t].Indeces[e],s=this._currentGeo.BoneInfs[t].Weights[e],o=4*n;switch(this._currentGeo.VertexSetedBoneCount[n]){case 0:this._currentGeo.GeometryData.skinIndices[o]=i,this._currentGeo.GeometryData.skinWeights[o]=s;break;case 1:this._currentGeo.GeometryData.skinIndices[o+1]=i,this._currentGeo.GeometryData.skinWeights[o+1]=s;break;case 2:this._currentGeo.GeometryData.skinIndices[o+2]=i,this._currentGeo.GeometryData.skinWeights[o+2]=s;break;case 3:this._currentGeo.GeometryData.skinIndices[o+3]=i,this._currentGeo.GeometryData.skinWeights[o+3]=s}this._currentGeo.VertexSetedBoneCount[n]++,this._currentGeo.VertexSetedBoneCount[n]>4&&console.log("warn! over 4 bone weight! :"+n)}}for(let e=0;e<this._currentGeo.Materials.length;e++)this._currentGeo.Materials[e].skinning=!0;var a=[];for(let t=0;t<r.length;t++)r[t].OffsetMatrix?a.push(r[t].OffsetMatrix):a.push(new e.Matrix4);var l=this._buildGeometry();t=new e.SkinnedMesh(l,1===this._currentGeo.Materials.length?this._currentGeo.Materials[0]:this._currentGeo.Materials),this._initSkeleton(t,r,a)}else{var c=this._buildGeometry();t=new e.Mesh(c,1===this._currentGeo.Materials.length?this._currentGeo.Materials[0]:this._currentGeo.Materials)}t.name=this._currentGeo.name;var h=new e.Matrix4,u=this._currentGeo.baseFrame.putBone;if(u&&u.parent){for(;u=u.parent;)h.multiply(u.FrameTransformMatrix);t.applyMatrix4(h)}this.Meshes.push(t)}},{key:"_initSkeleton",value:function(t,r,i){var n,s,o,a,l=[];for(o=0,a=r.length;o<a;o++)s=r[o],n=new e.Bone,l.push(n),n.name=s.name,n.position.fromArray(s.pos),n.quaternion.fromArray(s.rotq),void 0!==s.scl&&n.scale.fromArray(s.scl);for(o=0,a=r.length;o<a;o++)-1!==(s=r[o]).parent&&null!==s.parent&&void 0!==l[s.parent]?l[s.parent].add(l[o]):t.add(l[o]);t.updateMatrixWorld(!0);var c=new e.Skeleton(l,i);t.bind(c,t.matrixWorld)}},{key:"_readAnimationKey",value:function(){var t=0,r=this._currentObject.data.indexOf(";",t),i=this._currentObject.data.substr(t,r-t);t=r+1;var n=parseInt(this._readLine(i));t=(r=this._currentObject.data.indexOf(";",t))+1,i=this._currentObject.data.substr(t);var s=this._readLine(i.trim()).split(";;,");for(let t=0;t<s.length;t++){var o=s[t].split(";"),a=new td;if(a.type=n,a.Frame=parseInt(o[0]),a.index=this._currentAnimeFrames.keyFrames.length,a.time=a.Frame,4!=n){var l=!1;for(let e=0;e<this._currentAnimeFrames.keyFrames.length;e++)if(this._currentAnimeFrames.keyFrames[e].Frame===a.Frame){a=this._currentAnimeFrames.keyFrames[e],l=!0;break}var c=o[2].split(",");switch(n){case 0:a.rot=new e.Quaternion(parseFloat(c[1]),parseFloat(c[2]),parseFloat(c[3]),-1*parseFloat(c[0]));break;case 1:a.scl=new e.Vector3(parseFloat(c[0]),parseFloat(c[1]),parseFloat(c[2]));break;case 2:a.pos=new e.Vector3(parseFloat(c[0]),parseFloat(c[1]),parseFloat(c[2]))}l||this._currentAnimeFrames.keyFrames.push(a)}else a.matrix=new e.Matrix4,this._ParseMatrixData(a.matrix,o[2].split(",")),this._currentAnimeFrames.keyFrames.push(a)}}},{key:"_makeOutputAnimation",value:function(){var e=new ed(this.options);e.fps=this.animTicksPerSecond,e.name=this._currentAnime.name,e.make(this._currentAnime.AnimeFrames),this.animations.push(e)}},{key:"assignAnimation",value:function(t,r){var i=t,n=r;if(i||(i=this.Meshes[0]),n||(n=this.animations[0]),!i||!n)return null;var s={};s.fps=n.fps,s.name=n.name,s.length=n.length,s.hierarchy=[];for(let e=0;e<i.skeleton.bones.length;e++){var o=!1;for(let t=0;t<n.hierarchy.length;t++)if(i.skeleton.bones[e].name===n.hierarchy[t].name){o=!0;var a=n.hierarchy[t].copy();if(a.parent=-1,i.skeleton.bones[e].parent&&"Bone"===i.skeleton.bones[e].parent.type)for(let t=0;t<s.hierarchy.length;t++)s.hierarchy[t].name===i.skeleton.bones[e].parent.name&&(a.parent=t,a.parentName=i.skeleton.bones[e].parent.name);s.hierarchy.push(a);break}if(!o){var l=n.hierarchy[0].copy();l.name=i.skeleton.bones[e].name,l.parent=-1;for(let e=0;e<l.keys.length;e++)l.keys[e].pos&&l.keys[e].pos.set(0,0,0),l.keys[e].scl&&l.keys[e].scl.set(1,1,1),l.keys[e].rot&&l.keys[e].rot.set(0,0,0,1);s.hierarchy.push(l)}}return i.geometry.animations||(i.geometry.animations=[]),i.geometry.animations.push(e.AnimationClip.parseAnimation(s,i.skeleton.bones)),i.animationMixer||(i.animationMixer=new e.AnimationMixer(i)),s}},{key:"_ParseMatrixData",value:function(e,t){e.set(parseFloat(t[0]),parseFloat(t[4]),parseFloat(t[8]),parseFloat(t[12]),parseFloat(t[1]),parseFloat(t[5]),parseFloat(t[9]),parseFloat(t[13]),parseFloat(t[2]),parseFloat(t[6]),parseFloat(t[10]),parseFloat(t[14]),parseFloat(t[3]),parseFloat(t[7]),parseFloat(t[11]),parseFloat(t[15]))}}]),t}());class id extends e.Loader{constructor(e){super(e),this.animateBonePositions=!0,this.animateBoneRotations=!0}load(t,r,i,n){const s=this,o=new e.FileLoader(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(t,(function(e){try{r(s.parse(e))}catch(e){n?n(e):console.error(e),s.manager.itemError(t)}}),i,n)}parse(t){function r(t,i,n){if("ENDSITE"===n.type)return;const s={time:i,position:new e.Vector3,rotation:new e.Quaternion};n.frames.push(s);const o=new e.Quaternion,a=new e.Vector3(1,0,0),l=new e.Vector3(0,1,0),c=new e.Vector3(0,0,1);for(let e=0;e<n.channels.length;e++)switch(n.channels[e]){case"Xposition":s.position.x=parseFloat(t.shift().trim());break;case"Yposition":s.position.y=parseFloat(t.shift().trim());break;case"Zposition":s.position.z=parseFloat(t.shift().trim());break;case"Xrotation":o.setFromAxisAngle(a,parseFloat(t.shift().trim())*Math.PI/180),s.rotation.multiply(o);break;case"Yrotation":o.setFromAxisAngle(l,parseFloat(t.shift().trim())*Math.PI/180),s.rotation.multiply(o);break;case"Zrotation":o.setFromAxisAngle(c,parseFloat(t.shift().trim())*Math.PI/180),s.rotation.multiply(o);break;default:console.warn("THREE.BVHLoader: Invalid channel type.")}for(let e=0;e<n.children.length;e++)r(t,i,n.children[e])}function i(t,r,s){const o={name:"",type:"",frames:[]};s.push(o);let a=r.split(/[\s]+/);"END"===a[0].toUpperCase()&&"SITE"===a[1].toUpperCase()?(o.type="ENDSITE",o.name="ENDSITE"):(o.name=a[1],o.type=a[0].toUpperCase()),"{"!==n(t)&&console.error("THREE.BVHLoader: Expected opening { after type & name"),a=n(t).split(/[\s]+/),"OFFSET"!==a[0]&&console.error("THREE.BVHLoader: Expected OFFSET but got: "+a[0]),4!==a.length&&console.error("THREE.BVHLoader: Invalid number of values for OFFSET.");const l=new e.Vector3(parseFloat(a[1]),parseFloat(a[2]),parseFloat(a[3]));if((isNaN(l.x)||isNaN(l.y)||isNaN(l.z))&&console.error("THREE.BVHLoader: Invalid values of OFFSET."),o.offset=l,"ENDSITE"!==o.type){a=n(t).split(/[\s]+/),"CHANNELS"!==a[0]&&console.error("THREE.BVHLoader: Expected CHANNELS definition.");const e=parseInt(a[1]);o.channels=a.splice(2,e),o.children=[]}for(;;){const e=n(t);if("}"===e)return o;o.children.push(i(t,e,s))}}function n(e){let t;for(;0===(t=e.shift().trim()).length;);return t}const s=this,o=function(e){"HIERARCHY"!==n(e)&&console.error("THREE.BVHLoader: HIERARCHY expected.");const t=[],s=i(e,n(e),t);"MOTION"!==n(e)&&console.error("THREE.BVHLoader: MOTION expected.");let o=n(e).split(/[\s]+/);const a=parseInt(o[1]);isNaN(a)&&console.error("THREE.BVHLoader: Failed to read number of frames."),o=n(e).split(/[\s]+/);const l=parseFloat(o[2]);isNaN(l)&&console.error("THREE.BVHLoader: Failed to read frame time.");for(let t=0;t<a;t++)o=n(e).split(/[\s]+/),r(o,t*l,s);return t}(t.split(/[\r\n]+/g)),a=[];!function t(r,i){const n=new e.Bone;if(i.push(n),n.position.add(r.offset),n.name=r.name,"ENDSITE"!==r.type)for(let e=0;e<r.children.length;e++)n.add(t(r.children[e],i));return n}(o[0],a);const l=function(t){const r=[];for(let i=0;i<t.length;i++){const n=t[i];if("ENDSITE"===n.type)continue;const o=[],a=[],l=[];for(let e=0;e<n.frames.length;e++){const t=n.frames[e];o.push(t.time),a.push(t.position.x+n.offset.x),a.push(t.position.y+n.offset.y),a.push(t.position.z+n.offset.z),l.push(t.rotation.x),l.push(t.rotation.y),l.push(t.rotation.z),l.push(t.rotation.w)}s.animateBonePositions&&r.push(new e.VectorKeyframeTrack(".bones["+n.name+"].position",o,a)),s.animateBoneRotations&&r.push(new e.QuaternionKeyframeTrack(".bones["+n.name+"].quaternion",o,l))}return new e.AnimationClip("animation",-1,r)}(o);return{skeleton:new e.Skeleton(a),clip:l}}}class nd extends e.Loader{constructor(e){super(e)}load(t,r,i,n){const s=this,o=""===s.path?e.LoaderUtils.extractUrlBase(t):s.path,a=new e.FileLoader(s.manager);a.setPath(s.path),a.setRequestHeader(s.requestHeader),a.setWithCredentials(s.withCredentials),a.load(t,(function(e){try{r(s.parse(e,o))}catch(e){n?n(e):console.error(e),s.manager.itemError(t)}}),i,n)}parse(t,r){function i(e,t){const r=[],i=e.childNodes;for(let e=0,n=i.length;e<n;e++){const n=i[e];n.nodeName===t&&r.push(n)}return r}function n(e){if(0===e.length)return[];const t=e.trim().split(/\s+/),r=new Array(t.length);for(let e=0,i=t.length;e<i;e++)r[e]=t[e];return r}function s(e){if(0===e.length)return[];const t=e.trim().split(/\s+/),r=new Array(t.length);for(let e=0,i=t.length;e<i;e++)r[e]=parseFloat(t[e]);return r}function o(e){if(0===e.length)return[];const t=e.trim().split(/\s+/),r=new Array(t.length);for(let e=0,i=t.length;e<i;e++)r[e]=parseInt(t[e]);return r}function a(e){return e.substring(1)}function l(e){return 0===Object.keys(e).length}function c(e){return void 0!==e&&!0===e.hasAttribute("meter")?parseFloat(e.getAttribute("meter")):1}function h(e){return void 0!==e?e.textContent:"Y_UP"}function u(e,t,r,n){const s=i(e,t)[0];if(void 0!==s){const e=i(s,r);for(let t=0;t<e.length;t++)n(e[t])}}function d(e,t){for(const r in e){e[r].build=t(e[r])}}function p(e,t){return void 0!==e.build||(e.build=t(e)),e.build}function m(e){const t={inputs:{}};for(let r=0,i=e.childNodes.length;r<i;r++){const i=e.childNodes[r];if(1===i.nodeType)switch(i.nodeName){case"input":const e=a(i.getAttribute("source")),r=i.getAttribute("semantic");t.inputs[r]=e}}return t}function f(e){const t={};let r=e.getAttribute("target").split("/");const i=r.shift();let n=r.shift();const s=-1!==n.indexOf("("),o=-1!==n.indexOf(".");if(o)r=n.split("."),n=r.shift(),t.member=r.shift();else if(s){const e=n.split("(");n=e.shift();for(let t=0;t<e.length;t++)e[t]=parseInt(e[t].replace(/\)/,""));t.indices=e}return t.id=i,t.sid=n,t.arraySyntax=s,t.memberSyntax=o,t.sampler=a(e.getAttribute("source")),t}function g(e){const t=[],r=e.channels,i=e.samplers,n=e.sources;for(const e in r)if(r.hasOwnProperty(e)){const s=r[e],o=i[s.sampler],a=o.inputs.INPUT,l=o.inputs.OUTPUT;w(x(s,n[a],n[l]),t)}return t}function v(e){return p(qe.animations[e],g)}function x(e,t,r){const i=qe.nodes[e.id],n=Ue(i.id),s=i.transforms[e.sid],o=i.matrix.clone().transpose();let a,l,c,h,u,d;const p={};switch(s){case"matrix":for(c=0,h=t.array.length;c<h;c++)if(a=t.array[c],l=c*r.stride,void 0===p[a]&&(p[a]={}),!0===e.arraySyntax){const t=r.array[l],i=e.indices[0]+4*e.indices[1];p[a][i]=t}else for(u=0,d=r.stride;u<d;u++)p[a][u]=r.array[l+u];break;case"translate":case"rotate":case"scale":console.warn('THREE.ColladaLoader: Animation transform type "%s" not yet implemented.',s)}const m=function(e,t){const r=[];for(const t in e)r.push({time:parseFloat(t),value:e[t]});r.sort(i);for(let e=0;e<16;e++)M(r,e,t.elements[e]);return r;function i(e,t){return e.time-t.time}}(p,o);return{name:n.uuid,keyframes:m}}const y=new e.Vector3,b=new e.Vector3,A=new e.Quaternion;function w(t,r){const i=t.keyframes,n=t.name,s=[],o=[],a=[],l=[];for(let e=0,t=i.length;e<t;e++){const t=i[e],r=t.time,n=t.value;Ce.fromArray(n).transpose(),Ce.decompose(y,A,b),s.push(r),o.push(y.x,y.y,y.z),a.push(A.x,A.y,A.z,A.w),l.push(b.x,b.y,b.z)}return o.length>0&&r.push(new e.VectorKeyframeTrack(n+".position",s,o)),a.length>0&&r.push(new e.QuaternionKeyframeTrack(n+".quaternion",s,a)),l.length>0&&r.push(new e.VectorKeyframeTrack(n+".scale",s,l)),r}function M(e,t,r){let i,n,s,o=!0;for(n=0,s=e.length;n<s;n++)i=e[n],void 0===i.value[t]?i.value[t]=null:o=!1;if(!0===o)for(n=0,s=e.length;n<s;n++)i=e[n],i.value[t]=r;else!function(e,t){let r,i;for(let n=0,s=e.length;n<s;n++){const s=e[n];if(null===s.value[t]){if(r=T(e,n,t),i=S(e,n,t),null===r){s.value[t]=i.value[t];continue}if(null===i){s.value[t]=r.value[t];continue}C(s,r,i,t)}}}(e,t)}function T(e,t,r){for(;t>=0;){const i=e[t];if(null!==i.value[r])return i;t--}return null}function S(e,t,r){for(;t<e.length;){const i=e[t];if(null!==i.value[r])return i;t++}return null}function C(e,t,r,i){r.time-t.time!=0?e.value[i]=(e.time-t.time)*(r.value[i]-t.value[i])/(r.time-t.time)+t.value[i]:e.value[i]=t.value[i]}function F(t){const r=[],i=t.name,n=t.end-t.start||-1,s=t.animations;for(let e=0,t=s.length;e<t;e++){const t=v(s[e]);for(let e=0,i=t.length;e<i;e++)r.push(t[e])}return new e.AnimationClip(i,n,r)}function E(e){return p(qe.clips[e],F)}function _(e){const t={sources:{}};for(let r=0,i=e.childNodes.length;r<i;r++){const i=e.childNodes[r];if(1===i.nodeType)switch(i.nodeName){case"bind_shape_matrix":t.bindShapeMatrix=s(i.textContent);break;case"source":const e=i.getAttribute("id");t.sources[e]=oe(i);break;case"joints":t.joints=P(i);break;case"vertex_weights":t.vertexWeights=B(i)}}return t}function P(e){const t={inputs:{}};for(let r=0,i=e.childNodes.length;r<i;r++){const i=e.childNodes[r];if(1===i.nodeType)switch(i.nodeName){case"input":const e=i.getAttribute("semantic"),r=a(i.getAttribute("source"));t.inputs[e]=r}}return t}function B(e){const t={inputs:{}};for(let r=0,i=e.childNodes.length;r<i;r++){const i=e.childNodes[r];if(1===i.nodeType)switch(i.nodeName){case"input":const e=i.getAttribute("semantic"),r=a(i.getAttribute("source")),n=parseInt(i.getAttribute("offset"));t.inputs[e]={id:r,offset:n};break;case"vcount":t.vcount=o(i.textContent);break;case"v":t.v=o(i.textContent)}}return t}function L(t){const r={id:t.id},i=qe.geometries[r.id];return void 0!==t.skin&&(r.skin=function(t){const r=4,i={joints:[],indices:{array:[],stride:r},weights:{array:[],stride:r}},n=t.sources,s=t.vertexWeights,o=s.vcount,a=s.v,l=s.inputs.JOINT.offset,c=s.inputs.WEIGHT.offset,h=t.sources[t.joints.inputs.JOINT],u=t.sources[t.joints.inputs.INV_BIND_MATRIX],d=n[s.inputs.WEIGHT.id].array;let p,m,f,g=0;for(p=0,f=o.length;p<f;p++){const e=o[p],t=[];for(m=0;m<e;m++){const e=a[g+l],r=d[a[g+c]];t.push({index:e,weight:r}),g+=2}for(t.sort(v),m=0;m<r;m++){const e=t[m];void 0!==e?(i.indices.array.push(e.index),i.weights.array.push(e.weight)):(i.indices.array.push(0),i.weights.array.push(0))}}t.bindShapeMatrix?i.bindMatrix=(new e.Matrix4).fromArray(t.bindShapeMatrix).transpose():i.bindMatrix=(new e.Matrix4).identity();for(p=0,f=h.array.length;p<f;p++){const t=h.array[p],r=(new e.Matrix4).fromArray(u.array,p*u.stride).transpose();i.joints.push({name:t,boneInverse:r})}return i;function v(e,t){return t.weight-e.weight}}(t.skin),i.sources.skinIndices=r.skin.indices,i.sources.skinWeights=r.skin.weights),r}function R(e){return void 0!==e.build?e.build:e.init_from}function N(e){const t=qe.images[e];return void 0!==t?p(t,R):(console.warn("THREE.ColladaLoader: Couldn't find image with ID:",e),null)}function D(e){const t={surfaces:{},samplers:{}};for(let r=0,i=e.childNodes.length;r<i;r++){const i=e.childNodes[r];if(1===i.nodeType)switch(i.nodeName){case"newparam":I(i,t);break;case"technique":t.technique=k(i);break;case"extra":t.extra=W(i)}}return t}function I(e,t){const r=e.getAttribute("sid");for(let i=0,n=e.childNodes.length;i<n;i++){const n=e.childNodes[i];if(1===n.nodeType)switch(n.nodeName){case"surface":t.surfaces[r]=U(n);break;case"sampler2D":t.samplers[r]=O(n)}}}function U(e){const t={};for(let r=0,i=e.childNodes.length;r<i;r++){const i=e.childNodes[r];if(1===i.nodeType)switch(i.nodeName){case"init_from":t.init_from=i.textContent}}return t}function O(e){const t={};for(let r=0,i=e.childNodes.length;r<i;r++){const i=e.childNodes[r];if(1===i.nodeType)switch(i.nodeName){case"source":t.source=i.textContent}}return t}function k(e){const t={};for(let r=0,i=e.childNodes.length;r<i;r++){const i=e.childNodes[r];if(1===i.nodeType)switch(i.nodeName){case"constant":case"lambert":case"blinn":case"phong":t.type=i.nodeName,t.parameters=V(i);break;case"extra":t.extra=W(i)}}return t}function V(e){const t={};for(let r=0,i=e.childNodes.length;r<i;r++){const i=e.childNodes[r];if(1===i.nodeType)switch(i.nodeName){case"emission":case"diffuse":case"specular":case"bump":case"ambient":case"shininess":case"transparency":t[i.nodeName]=G(i);break;case"transparent":t[i.nodeName]={opaque:i.hasAttribute("opaque")?i.getAttribute("opaque"):"A_ONE",data:G(i)}}}return t}function G(e){const t={};for(let r=0,i=e.childNodes.length;r<i;r++){const i=e.childNodes[r];if(1===i.nodeType)switch(i.nodeName){case"color":t[i.nodeName]=s(i.textContent);break;case"float":t[i.nodeName]=parseFloat(i.textContent);break;case"texture":t[i.nodeName]={id:i.getAttribute("texture"),extra:z(i)}}}return t}function z(e){const t={technique:{}};for(let r=0,i=e.childNodes.length;r<i;r++){const i=e.childNodes[r];if(1===i.nodeType)switch(i.nodeName){case"extra":H(i,t)}}return t}function H(e,t){for(let r=0,i=e.childNodes.length;r<i;r++){const i=e.childNodes[r];if(1===i.nodeType)switch(i.nodeName){case"technique":j(i,t)}}}function j(e,t){for(let r=0,i=e.childNodes.length;r<i;r++){const i=e.childNodes[r];if(1===i.nodeType)switch(i.nodeName){case"repeatU":case"repeatV":case"offsetU":case"offsetV":t.technique[i.nodeName]=parseFloat(i.textContent);break;case"wrapU":case"wrapV":"TRUE"===i.textContent.toUpperCase()?t.technique[i.nodeName]=1:"FALSE"===i.textContent.toUpperCase()?t.technique[i.nodeName]=0:t.technique[i.nodeName]=parseInt(i.textContent);break;case"bump":t[i.nodeName]=Q(i)}}}function W(e){const t={};for(let r=0,i=e.childNodes.length;r<i;r++){const i=e.childNodes[r];if(1===i.nodeType)switch(i.nodeName){case"technique":t.technique=X(i)}}return t}function X(e){const t={};for(let r=0,i=e.childNodes.length;r<i;r++){const i=e.childNodes[r];if(1===i.nodeType)switch(i.nodeName){case"double_sided":t[i.nodeName]=parseInt(i.textContent);break;case"bump":t[i.nodeName]=Q(i)}}return t}function Q(e){for(var t={},r=0,i=e.childNodes.length;r<i;r++){var n=e.childNodes[r];if(1===n.nodeType)switch(n.nodeName){case"texture":t[n.nodeName]={id:n.getAttribute("texture"),texcoord:n.getAttribute("texcoord"),extra:z(n)}}}return t}function Y(e){return e}function K(t){const r=(i=t.url,p(qe.effects[i],Y));var i;const n=r.profile.technique;let s;switch(n.type){case"phong":case"blinn":s=new e.MeshPhongMaterial;break;case"lambert":s=new e.MeshLambertMaterial;break;default:s=new e.MeshBasicMaterial}function o(t){const i=r.profile.samplers[t.id];let n=null;if(void 0!==i){n=N(r.profile.surfaces[i.source].init_from)}else console.warn("THREE.ColladaLoader: Undefined sampler. Access image directly (see #12530)."),n=N(t.id);if(null!==n){const r=function(e){let t,r=e.slice(2+(e.lastIndexOf(".")-1>>>0));switch(r=r.toLowerCase(),r){case"tga":t=Xe;break;default:t=We}return t}(n);if(void 0!==r){const i=r.load(n),s=t.extra;if(void 0!==s&&void 0!==s.technique&&!1===l(s.technique)){const t=s.technique;i.wrapS=t.wrapU?e.RepeatWrapping:e.ClampToEdgeWrapping,i.wrapT=t.wrapV?e.RepeatWrapping:e.ClampToEdgeWrapping,i.offset.set(t.offsetU||0,t.offsetV||0),i.repeat.set(t.repeatU||1,t.repeatV||1)}else i.wrapS=e.RepeatWrapping,i.wrapT=e.RepeatWrapping;return i}return console.warn("THREE.ColladaLoader: Loader for texture %s not found.",n),null}return console.warn("THREE.ColladaLoader: Couldn't create texture with ID:",t.id),null}s.name=t.name||"";const a=n.parameters;for(const e in a){const t=a[e];switch(e){case"diffuse":t.color&&s.color.fromArray(t.color),t.texture&&(s.map=o(t.texture));break;case"specular":t.color&&s.specular&&s.specular.fromArray(t.color),t.texture&&(s.specularMap=o(t.texture));break;case"bump":t.texture&&(s.normalMap=o(t.texture));break;case"ambient":t.texture&&(s.lightMap=o(t.texture));break;case"shininess":t.float&&s.shininess&&(s.shininess=t.float);break;case"emission":t.color&&s.emissive&&s.emissive.fromArray(t.color),t.texture&&(s.emissiveMap=o(t.texture))}}let c=a.transparent,h=a.transparency;if(void 0===h&&c&&(h={float:1}),void 0===c&&h&&(c={opaque:"A_ONE",data:{color:[1,1,1,1]}}),c&&h)if(c.data.texture)s.transparent=!0;else{const e=c.data.color;switch(c.opaque){case"A_ONE":s.opacity=e[3]*h.float;break;case"RGB_ZERO":s.opacity=1-e[0]*h.float;break;case"A_ZERO":s.opacity=1-e[3]*h.float;break;case"RGB_ONE":s.opacity=e[0]*h.float;break;default:console.warn('THREE.ColladaLoader: Invalid opaque type "%s" of transparent tag.',c.opaque)}s.opacity<1&&(s.transparent=!0)}if(void 0!==n.extra&&void 0!==n.extra.technique){const t=n.extra.technique;for(const r in t){const i=t[r];switch(r){case"double_sided":s.side=1===i?e.DoubleSide:e.FrontSide;break;case"bump":s.normalMap=o(i.texture),s.normalScale=new e.Vector2(1,1)}}}return s}function q(e){return p(qe.materials[e],K)}function J(e){for(let t=0;t<e.childNodes.length;t++){const r=e.childNodes[t];switch(r.nodeName){case"technique_common":return Z(r)}}return{}}function Z(e){const t={};for(let r=0;r<e.childNodes.length;r++){const i=e.childNodes[r];switch(i.nodeName){case"perspective":case"orthographic":t.technique=i.nodeName,t.parameters=$(i)}}return t}function $(e){const t={};for(let r=0;r<e.childNodes.length;r++){const i=e.childNodes[r];switch(i.nodeName){case"xfov":case"yfov":case"xmag":case"ymag":case"znear":case"zfar":case"aspect_ratio":t[i.nodeName]=parseFloat(i.textContent)}}return t}function ee(t){let r;switch(t.optics.technique){case"perspective":r=new e.PerspectiveCamera(t.optics.parameters.yfov,t.optics.parameters.aspect_ratio,t.optics.parameters.znear,t.optics.parameters.zfar);break;case"orthographic":let i=t.optics.parameters.ymag,n=t.optics.parameters.xmag;const s=t.optics.parameters.aspect_ratio;n=void 0===n?i*s:n,i=void 0===i?n/s:i,n*=.5,i*=.5,r=new e.OrthographicCamera(-n,n,i,-i,t.optics.parameters.znear,t.optics.parameters.zfar);break;default:r=new e.PerspectiveCamera}return r.name=t.name||"",r}function te(e){const t=qe.cameras[e];return void 0!==t?p(t,ee):(console.warn("THREE.ColladaLoader: Couldn't find camera with ID:",e),null)}function re(e){const t={};for(let r=0,i=e.childNodes.length;r<i;r++){const i=e.childNodes[r];if(1===i.nodeType)switch(i.nodeName){case"directional":case"point":case"spot":case"ambient":t.technique=i.nodeName,t.parameters=ie(i)}}return t}function ie(t){const r={};for(let i=0,n=t.childNodes.length;i<n;i++){const n=t.childNodes[i];if(1===n.nodeType)switch(n.nodeName){case"color":const t=s(n.textContent);r.color=(new e.Color).fromArray(t);break;case"falloff_angle":r.falloffAngle=parseFloat(n.textContent);break;case"quadratic_attenuation":const i=parseFloat(n.textContent);r.distance=i?Math.sqrt(1/i):0}}return r}function ne(t){let r;switch(t.technique){case"directional":r=new e.DirectionalLight;break;case"point":r=new e.PointLight;break;case"spot":r=new e.SpotLight;break;case"ambient":r=new e.AmbientLight}return t.parameters.color&&r.color.copy(t.parameters.color),t.parameters.distance&&(r.distance=t.parameters.distance),r}function se(e){const t=qe.lights[e];return void 0!==t?p(t,ne):(console.warn("THREE.ColladaLoader: Couldn't find light with ID:",e),null)}function oe(e){const t={array:[],stride:3};for(let r=0;r<e.childNodes.length;r++){const o=e.childNodes[r];if(1===o.nodeType)switch(o.nodeName){case"float_array":t.array=s(o.textContent);break;case"Name_array":t.array=n(o.textContent);break;case"technique_common":const e=i(o,"accessor")[0];void 0!==e&&(t.stride=parseInt(e.getAttribute("stride")))}}return t}function ae(e){const t={};for(let r=0;r<e.childNodes.length;r++){const i=e.childNodes[r];1===i.nodeType&&(t[i.getAttribute("semantic")]=a(i.getAttribute("source")))}return t}function le(e){const t={type:e.nodeName,material:e.getAttribute("material"),count:parseInt(e.getAttribute("count")),inputs:{},stride:0,hasUV:!1};for(let r=0,i=e.childNodes.length;r<i;r++){const i=e.childNodes[r];if(1===i.nodeType)switch(i.nodeName){case"input":const e=a(i.getAttribute("source")),r=i.getAttribute("semantic"),n=parseInt(i.getAttribute("offset")),s=parseInt(i.getAttribute("set")),l=s>0?r+s:r;t.inputs[l]={id:e,offset:n},t.stride=Math.max(t.stride,n+1),"TEXCOORD"===r&&(t.hasUV=!0);break;case"vcount":t.vcount=o(i.textContent);break;case"p":t.p=o(i.textContent)}}return t}function ce(e){let t=0;for(let r=0,i=e.length;r<i;r++){!0===e[r].hasUV&&t++}t>0&&t<e.length&&(e.uvsNeedsFix=!0)}function he(e){const t={},r=e.sources,i=e.vertices,n=e.primitives;if(0===n.length)return{};const s=function(e){const t={};for(let r=0;r<e.length;r++){const i=e[r];void 0===t[i.type]&&(t[i.type]=[]),t[i.type].push(i)}return t}(n);for(const e in s){const n=s[e];ce(n),t[e]=ue(n,r,i)}return t}function ue(t,r,i){const n={},s={array:[],stride:0},o={array:[],stride:0},a={array:[],stride:0},l={array:[],stride:0},c={array:[],stride:0},h=[],u=4,d=[],p=4,m=new e.BufferGeometry,f=[];let g=0;for(let e=0;e<t.length;e++){const n=t[e],u=n.inputs;let p=0;switch(n.type){case"lines":case"linestrips":p=2*n.count;break;case"triangles":p=3*n.count;break;case"polylist":for(let e=0;e<n.count;e++){const t=n.vcount[e];switch(t){case 3:p+=3;break;case 4:p+=6;break;default:p+=3*(t-2)}}break;default:console.warn("THREE.ColladaLoader: Unknow primitive type:",n.type)}m.addGroup(g,p,e),g+=p,n.material&&f.push(n.material);for(const e in u){const p=u[e];switch(e){case"VERTEX":for(const e in i){const u=i[e];switch(e){case"POSITION":const i=s.array.length;if(de(n,r[u],p.offset,s.array),s.stride=r[u].stride,r.skinWeights&&r.skinIndices&&(de(n,r.skinIndices,p.offset,h),de(n,r.skinWeights,p.offset,d)),!1===n.hasUV&&!0===t.uvsNeedsFix){const e=(s.array.length-i)/s.stride;for(let t=0;t<e;t++)a.array.push(0,0)}break;case"NORMAL":de(n,r[u],p.offset,o.array),o.stride=r[u].stride;break;case"COLOR":de(n,r[u],p.offset,c.array),c.stride=r[u].stride;break;case"TEXCOORD":de(n,r[u],p.offset,a.array),a.stride=r[u].stride;break;case"TEXCOORD1":de(n,r[u],p.offset,l.array),a.stride=r[u].stride;break;default:console.warn('THREE.ColladaLoader: Semantic "%s" not handled in geometry build process.',e)}}break;case"NORMAL":de(n,r[p.id],p.offset,o.array),o.stride=r[p.id].stride;break;case"COLOR":de(n,r[p.id],p.offset,c.array),c.stride=r[p.id].stride;break;case"TEXCOORD":de(n,r[p.id],p.offset,a.array),a.stride=r[p.id].stride;break;case"TEXCOORD1":de(n,r[p.id],p.offset,l.array),l.stride=r[p.id].stride}}}return s.array.length>0&&m.setAttribute("position",new e.Float32BufferAttribute(s.array,s.stride)),o.array.length>0&&m.setAttribute("normal",new e.Float32BufferAttribute(o.array,o.stride)),c.array.length>0&&m.setAttribute("color",new e.Float32BufferAttribute(c.array,c.stride)),a.array.length>0&&m.setAttribute("uv",new e.Float32BufferAttribute(a.array,a.stride)),l.array.length>0&&m.setAttribute("uv2",new e.Float32BufferAttribute(l.array,l.stride)),h.length>0&&m.setAttribute("skinIndex",new e.Float32BufferAttribute(h,u)),d.length>0&&m.setAttribute("skinWeight",new e.Float32BufferAttribute(d,p)),n.data=m,n.type=t[0].type,n.materialKeys=f,n}function de(e,t,r,i){const n=e.p,s=e.stride,o=e.vcount;function a(e){let t=n[e+r]*c;const s=t+c;for(;t<s;t++)i.push(l[t])}const l=t.array,c=t.stride;if(void 0!==e.vcount){let e=0;for(let t=0,r=o.length;t<r;t++){const r=o[t];if(4===r){const t=e+1*s,r=e+2*s,i=e+3*s;a(e+0*s),a(t),a(i),a(t),a(r),a(i)}else if(3===r){const t=e+1*s,r=e+2*s;a(e+0*s),a(t),a(r)}else if(r>4)for(let t=1,i=r-2;t<=i;t++){const r=e+s*t,i=e+s*(t+1);a(e+0*s),a(r),a(i)}e+=s*r}}else for(let e=0,t=n.length;e<t;e+=s)a(e)}function pe(e){return p(qe.geometries[e],he)}function me(e){return void 0!==e.build?e.build:e}function fe(e,t){for(let r=0;r<e.childNodes.length;r++){const i=e.childNodes[r];if(1===i.nodeType)switch(i.nodeName){case"joint":t.joints[i.getAttribute("sid")]=ge(i);break;case"link":t.links.push(xe(i))}}}function ge(e){let t;for(let r=0;r<e.childNodes.length;r++){const i=e.childNodes[r];if(1===i.nodeType)switch(i.nodeName){case"prismatic":case"revolute":t=ve(i)}}return t}function ve(t){const r={sid:t.getAttribute("sid"),name:t.getAttribute("name")||"",axis:new e.Vector3,limits:{min:0,max:0},type:t.nodeName,static:!1,zeroPosition:0,middlePosition:0};for(let e=0;e<t.childNodes.length;e++){const i=t.childNodes[e];if(1===i.nodeType)switch(i.nodeName){case"axis":const e=s(i.textContent);r.axis.fromArray(e);break;case"limits":const t=i.getElementsByTagName("max")[0],n=i.getElementsByTagName("min")[0];r.limits.max=parseFloat(t.textContent),r.limits.min=parseFloat(n.textContent)}}return r.limits.min>=r.limits.max&&(r.static=!0),r.middlePosition=(r.limits.min+r.limits.max)/2,r}function xe(e){const t={sid:e.getAttribute("sid"),name:e.getAttribute("name")||"",attachments:[],transforms:[]};for(let r=0;r<e.childNodes.length;r++){const i=e.childNodes[r];if(1===i.nodeType)switch(i.nodeName){case"attachment_full":t.attachments.push(ye(i));break;case"matrix":case"translate":case"rotate":t.transforms.push(be(i))}}return t}function ye(e){const t={joint:e.getAttribute("joint").split("/").pop(),transforms:[],links:[]};for(let r=0;r<e.childNodes.length;r++){const i=e.childNodes[r];if(1===i.nodeType)switch(i.nodeName){case"link":t.links.push(xe(i));break;case"matrix":case"translate":case"rotate":t.transforms.push(be(i))}}return t}function be(t){const r={type:t.nodeName},i=s(t.textContent);switch(r.type){case"matrix":r.obj=new e.Matrix4,r.obj.fromArray(i).transpose();break;case"translate":r.obj=new e.Vector3,r.obj.fromArray(i);break;case"rotate":r.obj=new e.Vector3,r.obj.fromArray(i),r.angle=e.MathUtils.degToRad(i[3])}return r}function Ae(e,t){for(let r=0;r<e.childNodes.length;r++){const i=e.childNodes[r];if(1===i.nodeType)switch(i.nodeName){case"technique_common":we(i,t)}}}function we(e,t){for(let r=0;r<e.childNodes.length;r++){const i=e.childNodes[r];if(1===i.nodeType)switch(i.nodeName){case"inertia":t.inertia=s(i.textContent);break;case"mass":t.mass=s(i.textContent)[0]}}}function Me(e){const t={target:e.getAttribute("target").split("/").pop()};for(let r=0;r<e.childNodes.length;r++){const i=e.childNodes[r];if(1===i.nodeType)switch(i.nodeName){case"axis":const e=i.getElementsByTagName("param")[0];t.axis=e.textContent;const r=t.axis.split("inst_").pop().split("axis")[0];t.jointIndex=r.substr(0,r.length-1)}}return t}function Te(e){return void 0!==e.build?e.build:e}function Se(t){const r=[],i=Ge.querySelector('[id="'+t.id+'"]');for(let t=0;t<i.childNodes.length;t++){const n=i.childNodes[t];if(1!==n.nodeType)continue;let o,a;switch(n.nodeName){case"matrix":o=s(n.textContent);const t=(new e.Matrix4).fromArray(o).transpose();r.push({sid:n.getAttribute("sid"),type:n.nodeName,obj:t});break;case"translate":case"scale":o=s(n.textContent),a=(new e.Vector3).fromArray(o),r.push({sid:n.getAttribute("sid"),type:n.nodeName,obj:a});break;case"rotate":o=s(n.textContent),a=(new e.Vector3).fromArray(o);const i=e.MathUtils.degToRad(o[3]);r.push({sid:n.getAttribute("sid"),type:n.nodeName,obj:a,angle:i})}}return r}const Ce=new e.Matrix4,Fe=new e.Vector3;function Ee(t){const r={name:t.getAttribute("name")||"",type:t.getAttribute("type"),id:t.getAttribute("id"),sid:t.getAttribute("sid"),matrix:new e.Matrix4,nodes:[],instanceCameras:[],instanceControllers:[],instanceLights:[],instanceGeometries:[],instanceNodes:[],transforms:{}};for(let i=0;i<t.childNodes.length;i++){const n=t.childNodes[i];if(1!==n.nodeType)continue;let o;switch(n.nodeName){case"node":r.nodes.push(n.getAttribute("id")),Ee(n);break;case"instance_camera":r.instanceCameras.push(a(n.getAttribute("url")));break;case"instance_controller":r.instanceControllers.push(_e(n));break;case"instance_light":r.instanceLights.push(a(n.getAttribute("url")));break;case"instance_geometry":r.instanceGeometries.push(_e(n));break;case"instance_node":r.instanceNodes.push(a(n.getAttribute("url")));break;case"matrix":o=s(n.textContent),r.matrix.multiply(Ce.fromArray(o).transpose()),r.transforms[n.getAttribute("sid")]=n.nodeName;break;case"translate":o=s(n.textContent),Fe.fromArray(o),r.matrix.multiply(Ce.makeTranslation(Fe.x,Fe.y,Fe.z)),r.transforms[n.getAttribute("sid")]=n.nodeName;break;case"rotate":o=s(n.textContent);const t=e.MathUtils.degToRad(o[3]);r.matrix.multiply(Ce.makeRotationAxis(Fe.fromArray(o),t)),r.transforms[n.getAttribute("sid")]=n.nodeName;break;case"scale":o=s(n.textContent),r.matrix.scale(Fe.fromArray(o)),r.transforms[n.getAttribute("sid")]=n.nodeName;break;case"extra":break;default:console.log(n)}}return Ie(r.id)?console.warn("THREE.ColladaLoader: There is already a node with ID %s. Exclude current node from further processing.",r.id):qe.nodes[r.id]=r,r}function _e(e){const t={id:a(e.getAttribute("url")),materials:{},skeletons:[]};for(let r=0;r<e.childNodes.length;r++){const i=e.childNodes[r];switch(i.nodeName){case"bind_material":const e=i.getElementsByTagName("instance_material");for(let r=0;r<e.length;r++){const i=e[r],n=i.getAttribute("symbol"),s=i.getAttribute("target");t.materials[n]=a(s)}break;case"skeleton":t.skeletons.push(a(i.textContent))}}return t}function Pe(t,r){const i=[],n=[];let s,o,a;for(s=0;s<t.length;s++){const e=t[s];let n;if(Ie(e))n=Ue(e),Be(n,r,i);else if(l=e,void 0!==qe.visualScenes[l]){const t=qe.visualScenes[e].children;for(let e=0;e<t.length;e++){const n=t[e];if("JOINT"===n.type){Be(Ue(n.id),r,i)}}}else console.error("THREE.ColladaLoader: Unable to find root bone of skeleton with ID:",e)}var l;for(s=0;s<r.length;s++)for(o=0;o<i.length;o++)if(a=i[o],a.bone.name===r[s].name){n[s]=a,a.processed=!0;break}for(s=0;s<i.length;s++)a=i[s],!1===a.processed&&(n.push(a),a.processed=!0);const c=[],h=[];for(s=0;s<n.length;s++)a=n[s],c.push(a.bone),h.push(a.boneInverse);return new e.Skeleton(c,h)}function Be(t,r,i){t.traverse((function(t){if(!0===t.isBone){let n;for(let e=0;e<r.length;e++){const i=r[e];if(i.name===t.name){n=i.boneInverse;break}}void 0===n&&(n=new e.Matrix4),i.push({bone:t,boneInverse:n,processed:!1})}}))}function Le(t){const r=[],i=t.matrix,n=t.nodes,s=t.type,o=t.instanceCameras,a=t.instanceControllers,l=t.instanceLights,c=t.instanceGeometries,h=t.instanceNodes;for(let e=0,t=n.length;e<t;e++)r.push(Ue(n[e]));for(let e=0,t=o.length;e<t;e++){const t=te(o[e]);null!==t&&r.push(t.clone())}for(let e=0,t=a.length;e<t;e++){const t=a[e],i=(u=t.id,p(qe.controllers[u],L)),n=De(pe(i.id),t.materials),s=Pe(t.skeletons,i.skin.joints);for(let e=0,t=n.length;e<t;e++){const t=n[e];t.isSkinnedMesh&&(t.bind(s,i.skin.bindMatrix),t.normalizeSkinWeights()),r.push(t)}}var u;for(let e=0,t=l.length;e<t;e++){const t=se(l[e]);null!==t&&r.push(t.clone())}for(let e=0,t=c.length;e<t;e++){const t=c[e],i=De(pe(t.id),t.materials);for(let e=0,t=i.length;e<t;e++)r.push(i[e])}for(let e=0,t=h.length;e<t;e++)r.push(Ue(h[e]).clone());let d;if(0===n.length&&1===r.length)d=r[0];else{d="JOINT"===s?new e.Bone:new e.Group;for(let e=0;e<r.length;e++)d.add(r[e])}return d.name="JOINT"===s?t.sid:t.name,d.matrix.copy(i),d.matrix.decompose(d.position,d.quaternion,d.scale),d}const Re=new e.MeshBasicMaterial({color:16711935});function Ne(e,t){const r=[];for(let i=0,n=e.length;i<n;i++){const n=t[e[i]];void 0===n?(console.warn("THREE.ColladaLoader: Material with key %s not found. Apply fallback material.",e[i]),r.push(Re)):r.push(q(n))}return r}function De(t,r){const i=[];for(const n in t){const s=t[n],o=Ne(s.materialKeys,r);0===o.length&&("lines"===n||"linestrips"===n?o.push(new e.LineBasicMaterial):o.push(new e.MeshPhongMaterial));const a=void 0!==s.data.attributes.skinIndex,l=1===o.length?o[0]:o;let c;switch(n){case"lines":c=new e.LineSegments(s.data,l);break;case"linestrips":c=new e.Line(s.data,l);break;case"triangles":case"polylist":c=a?new e.SkinnedMesh(s.data,l):new e.Mesh(s.data,l)}i.push(c)}return i}function Ie(e){return void 0!==qe.nodes[e]}function Ue(e){return p(qe.nodes[e],Le)}function Oe(t){const r=new e.Group;r.name=t.name;const i=t.children;for(let e=0;e<i.length;e++){const t=i[e];r.add(Ue(t.id))}return r}function ke(e){return p(qe.visualScenes[e],Oe)}if(0===t.length)return{scene:new e.Scene};const Ve=(new DOMParser).parseFromString(t,"application/xml"),Ge=i(Ve,"COLLADA")[0],ze=Ve.getElementsByTagName("parsererror")[0];if(void 0!==ze){const e=i(ze,"div")[0];let t;return t=e?e.textContent:function(e){let t="";const r=[e];for(;r.length;){const e=r.shift();e.nodeType===Node.TEXT_NODE?t+=e.textContent:(t+="\n",r.push.apply(r,e.childNodes))}return t.trim()}(ze),console.error("THREE.ColladaLoader: Failed to parse collada file.\n",t),null}const He=Ge.getAttribute("version");console.log("THREE.ColladaLoader: File version",He);const je=function(e){return{unit:c(i(e,"unit")[0]),upAxis:h(i(e,"up_axis")[0])}}(i(Ge,"asset")[0]),We=new e.TextureLoader(this.manager);let Xe;We.setPath(this.resourcePath||r).setCrossOrigin(this.crossOrigin),zu&&(Xe=new zu(this.manager),Xe.setPath(this.resourcePath||r));const Qe=[];let Ye={},Ke=0;const qe={animations:{},clips:{},controllers:{},images:{},effects:{},materials:{},cameras:{},lights:{},geometries:{},nodes:{},visualScenes:{},kinematicsModels:{},physicsModels:{},kinematicsScenes:{}};u(Ge,"library_animations","animation",(function t(r){const i={sources:{},samplers:{},channels:{}};let n=!1;for(let e=0,s=r.childNodes.length;e<s;e++){const s=r.childNodes[e];if(1!==s.nodeType)continue;let o;switch(s.nodeName){case"source":o=s.getAttribute("id"),i.sources[o]=oe(s);break;case"sampler":o=s.getAttribute("id"),i.samplers[o]=m(s);break;case"channel":o=s.getAttribute("target"),i.channels[o]=f(s);break;case"animation":t(s),n=!0;break;default:console.log(s)}}!1===n&&(qe.animations[r.getAttribute("id")||e.MathUtils.generateUUID()]=i)})),u(Ge,"library_animation_clips","animation_clip",(function(e){const t={name:e.getAttribute("id")||"default",start:parseFloat(e.getAttribute("start")||0),end:parseFloat(e.getAttribute("end")||0),animations:[]};for(let r=0,i=e.childNodes.length;r<i;r++){const i=e.childNodes[r];if(1===i.nodeType)switch(i.nodeName){case"instance_animation":t.animations.push(a(i.getAttribute("url")))}}qe.clips[e.getAttribute("id")]=t})),u(Ge,"library_controllers","controller",(function(e){const t={};for(let r=0,i=e.childNodes.length;r<i;r++){const i=e.childNodes[r];if(1===i.nodeType)switch(i.nodeName){case"skin":t.id=a(i.getAttribute("source")),t.skin=_(i);break;case"morph":t.id=a(i.getAttribute("source")),console.warn("THREE.ColladaLoader: Morph target animation not supported yet.")}}qe.controllers[e.getAttribute("id")]=t})),u(Ge,"library_images","image",(function(e){const t={init_from:i(e,"init_from")[0].textContent};qe.images[e.getAttribute("id")]=t})),u(Ge,"library_effects","effect",(function(e){const t={};for(let r=0,i=e.childNodes.length;r<i;r++){const i=e.childNodes[r];if(1===i.nodeType)switch(i.nodeName){case"profile_COMMON":t.profile=D(i)}}qe.effects[e.getAttribute("id")]=t})),u(Ge,"library_materials","material",(function(e){const t={name:e.getAttribute("name")};for(let r=0,i=e.childNodes.length;r<i;r++){const i=e.childNodes[r];if(1===i.nodeType)switch(i.nodeName){case"instance_effect":t.url=a(i.getAttribute("url"))}}qe.materials[e.getAttribute("id")]=t})),u(Ge,"library_cameras","camera",(function(e){const t={name:e.getAttribute("name")};for(let r=0,i=e.childNodes.length;r<i;r++){const i=e.childNodes[r];if(1===i.nodeType)switch(i.nodeName){case"optics":t.optics=J(i)}}qe.cameras[e.getAttribute("id")]=t})),u(Ge,"library_lights","light",(function(e){let t={};for(let r=0,i=e.childNodes.length;r<i;r++){const i=e.childNodes[r];if(1===i.nodeType)switch(i.nodeName){case"technique_common":t=re(i)}}qe.lights[e.getAttribute("id")]=t})),u(Ge,"library_geometries","geometry",(function(e){const t={name:e.getAttribute("name"),sources:{},vertices:{},primitives:[]},r=i(e,"mesh")[0];if(void 0!==r){for(let e=0;e<r.childNodes.length;e++){const i=r.childNodes[e];if(1!==i.nodeType)continue;const n=i.getAttribute("id");switch(i.nodeName){case"source":t.sources[n]=oe(i);break;case"vertices":t.vertices=ae(i);break;case"polygons":console.warn("THREE.ColladaLoader: Unsupported primitive type: ",i.nodeName);break;case"lines":case"linestrips":case"polylist":case"triangles":t.primitives.push(le(i));break;default:console.log(i)}}qe.geometries[e.getAttribute("id")]=t}})),u(Ge,"library_nodes","node",Ee),u(Ge,"library_visual_scenes","visual_scene",(function(e){const t={name:e.getAttribute("name"),children:[]};!function(e){const t=e.getElementsByTagName("node");for(let e=0;e<t.length;e++){const r=t[e];!1===r.hasAttribute("id")&&r.setAttribute("id","three_default_"+Ke++)}}(e);const r=i(e,"node");for(let e=0;e<r.length;e++)t.children.push(Ee(r[e]));qe.visualScenes[e.getAttribute("id")]=t})),u(Ge,"library_kinematics_models","kinematics_model",(function(e){const t={name:e.getAttribute("name")||"",joints:{},links:[]};for(let r=0;r<e.childNodes.length;r++){const i=e.childNodes[r];if(1===i.nodeType)switch(i.nodeName){case"technique_common":fe(i,t)}}qe.kinematicsModels[e.getAttribute("id")]=t})),u(Ge,"library_physics_models","physics_model",(function(e){const t={name:e.getAttribute("name")||"",rigidBodies:{}};for(let r=0;r<e.childNodes.length;r++){const i=e.childNodes[r];if(1===i.nodeType)switch(i.nodeName){case"rigid_body":t.rigidBodies[i.getAttribute("name")]={},Ae(i,t.rigidBodies[i.getAttribute("name")])}}qe.physicsModels[e.getAttribute("id")]=t})),u(Ge,"scene","instance_kinematics_scene",(function(e){const t={bindJointAxis:[]};for(let r=0;r<e.childNodes.length;r++){const i=e.childNodes[r];if(1===i.nodeType)switch(i.nodeName){case"bind_joint_axis":t.bindJointAxis.push(Me(i))}}qe.kinematicsScenes[a(e.getAttribute("url"))]=t})),d(qe.animations,g),d(qe.clips,F),d(qe.controllers,L),d(qe.images,R),d(qe.effects,Y),d(qe.materials,K),d(qe.cameras,ee),d(qe.lights,ne),d(qe.geometries,he),d(qe.visualScenes,Oe),function(){const t=qe.clips;if(!0===l(t)){if(!1===l(qe.animations)){const t=[];for(const e in qe.animations){const r=v(e);for(let e=0,i=r.length;e<i;e++)t.push(r[e])}Qe.push(new e.AnimationClip("default",-1,t))}}else for(const e in t)Qe.push(E(e))}(),function(){const t=Object.keys(qe.kinematicsModels)[0],r=Object.keys(qe.kinematicsScenes)[0],i=Object.keys(qe.visualScenes)[0];if(void 0===t||void 0===r)return;const n=(s=t,p(qe.kinematicsModels[s],me));var s;const o=function(e){return p(qe.kinematicsScenes[e],Te)}(r),a=ke(i),l=o.bindJointAxis,c={};for(let e=0,t=l.length;e<t;e++){const t=l[e],r=Ge.querySelector('[sid="'+t.target+'"]');if(r){const e=r.parentElement;h(t.jointIndex,e)}}function h(e,t){const r=t.getAttribute("name"),i=n.joints[e];a.traverse((function(n){n.name===r&&(c[e]={object:n,transforms:Se(t),joint:i,position:i.zeroPosition})}))}const u=new e.Matrix4;Ye={joints:n&&n.joints,getJointValue:function(e){const t=c[e];if(t)return t.position;console.warn("THREE.ColladaLoader: Joint "+e+" doesn't exist.")},setJointValue:function(t,r){const i=c[t];if(i){const n=i.joint;if(r>n.limits.max||r<n.limits.min)console.warn("THREE.ColladaLoader: Joint "+t+" value "+r+" outside of limits (min: "+n.limits.min+", max: "+n.limits.max+").");else if(n.static)console.warn("THREE.ColladaLoader: Joint "+t+" is static.");else{const s=i.object,o=n.axis,a=i.transforms;Ce.identity();for(let i=0;i<a.length;i++){const s=a[i];if(s.sid&&-1!==s.sid.indexOf(t))switch(n.type){case"revolute":Ce.multiply(u.makeRotationAxis(o,e.MathUtils.degToRad(r)));break;case"prismatic":Ce.multiply(u.makeTranslation(o.x*r,o.y*r,o.z*r));break;default:console.warn("THREE.ColladaLoader: Unknown joint type: "+n.type)}else switch(s.type){case"matrix":Ce.multiply(s.obj);break;case"translate":Ce.multiply(u.makeTranslation(s.obj.x,s.obj.y,s.obj.z));break;case"scale":Ce.scale(s.obj);break;case"rotate":Ce.multiply(u.makeRotationAxis(s.obj,s.angle))}}s.matrix.copy(Ce),s.matrix.decompose(s.position,s.quaternion,s.scale),c[t].position=r}}else console.log("THREE.ColladaLoader: "+t+" does not exist.")}}}();const Je=function(e){return ke(a(i(e,"instance_visual_scene")[0].getAttribute("url")))}(i(Ge,"scene")[0]);return Je.animations=Qe,"Z_UP"===je.upAxis&&Je.quaternion.setFromEuler(new e.Euler(-Math.PI/2,0,0)),Je.scale.multiplyScalar(je.unit),{get animations(){return console.warn("THREE.ColladaLoader: Please access animations over scene.animations now."),Qe},kinematics:Ye,library:qe,scene:Je}}}class sd extends e.Loader{constructor(e){super(e)}load(t,r,i,n){const s=this,o=new e.FileLoader(s.manager);o.setPath(s.path),o.setResponseType("arraybuffer"),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(t,(function(e){try{r(s.parse(e))}catch(e){n?n(e):console.error(e),s.manager.itemError(t)}}),i,n)}parse(t){const r=new e.LoadingManager;r.setURLModifier((function(e){const t=function(e){for(const t in i)if(t.substr(-e.length)===e)return i[t]}(e);if(t){console.log("Loading",e);const r=new Blob([t.buffer],{type:"application/octet-stream"});return URL.createObjectURL(r)}return e}));const i=n.unzipSync(new Uint8Array(t));if(i["doc.kml"]){const e=(new DOMParser).parseFromString(fflate.strFromU8(i["doc.kml"]),"application/xml").querySelector("Placemark Model Link href");if(e){return new nd(r).parse(fflate.strFromU8(i[e.textContent]))}}else{console.warn("KMZLoader: Missing doc.kml file.");for(const e in i){if("dae"===e.split(".").pop().toLowerCase()){return new nd(r).parse(fflate.strFromU8(i[e]))}}}return console.error("KMZLoader: Couldn't find .dae file."),{scene:new e.Group}}}class od extends e.Loader{constructor(e){super(e),this.gltfLoader=new wl(e)}load(e,t,r,i){const n=this;this.gltfLoader.load(e,(function(r){try{n.parse(r,t)}catch(t){i?i(t):console.error(t),n.manager.itemError(e)}}),r,i)}setDRACOLoader(e){return this.gltfLoader.setDRACOLoader(e),this}parse(e,t){t(e)}}class ad extends e.Loader{constructor(e){super(e)}load(t,r,i,n){const s=this,o=""===s.path?e.LoaderUtils.extractUrlBase(t):s.path,a=new e.FileLoader(s.manager);a.setPath(s.path),a.setRequestHeader(s.requestHeader),a.setWithCredentials(s.withCredentials),a.load(t,(function(e){try{r(s.parse(e,o))}catch(e){n?n(e):console.error(e),s.manager.itemError(t)}}),i,n)}parse(t,r){const i={};function n(e){e.DEF&&(i[e.DEF]=e);const t=e.fields;for(let e=0,r=t.length;e<r;e++){const r=t[e];if("node"===r.type){const e=r.values;for(let t=0,r=e.length;t<r;t++)n(e[t])}}}function s(t){return t.USE?function(e){const t=s(i[e]);return t.isObject3D||t.isMaterial?t.clone():t}(t.USE):(void 0!==t.build||(t.build=function(t){const r=t.name;let i;switch(r){case"Group":case"Transform":case"Collision":i=function(t){const r=new e.Group,i=t.fields;for(let t=0,n=i.length;t<n;t++){const n=i[t],s=n.name,o=n.values;switch(s){case"bboxCenter":case"bboxSize":case"center":break;case"children":c(o,r);break;case"collide":break;case"rotation":const t=new e.Vector3(o[0],o[1],o[2]),i=o[3];r.quaternion.setFromAxisAngle(t,i);break;case"scale":r.scale.set(o[0],o[1],o[2]);break;case"scaleOrientation":break;case"translation":r.position.set(o[0],o[1],o[2]);break;case"proxy":break;default:console.warn("THREE.VRMLLoader: Unknown field:",s)}}return r}(t);break;case"Background":i=function(t){const r=new e.Group;let i,n,s,o;const a=t.fields;for(let e=0,t=a.length;e<t;e++){const t=a[e],r=t.name,l=t.values;switch(r){case"groundAngle":i=l;break;case"groundColor":n=l;break;case"backUrl":case"bottomUrl":case"frontUrl":case"leftUrl":case"rightUrl":case"topUrl":break;case"skyAngle":s=l;break;case"skyColor":o=l;break;default:console.warn("THREE.VRMLLoader: Unknown field:",r)}}const l=1e4;if(o){const t=new e.SphereGeometry(l,32,16),i=new e.MeshBasicMaterial({fog:!1,side:e.BackSide,depthWrite:!1,depthTest:!1});o.length>3?(P(t,l,s,_(o),!0),i.vertexColors=!0):i.color.setRGB(o[0],o[1],o[2]);const n=new e.Mesh(t,i);r.add(n)}if(n&&n.length>0){const t=new e.SphereGeometry(l,32,16,0,2*Math.PI,.5*Math.PI,1.5*Math.PI),s=new e.MeshBasicMaterial({fog:!1,side:e.BackSide,vertexColors:!0,depthWrite:!1,depthTest:!1});P(t,l,i,_(n),!1);const o=new e.Mesh(t,s);r.add(o)}return r.renderOrder=-1/0,r}(t);break;case"Shape":i=function(t){const r=t.fields;let i,n,o=new e.MeshBasicMaterial({color:0});for(let e=0,t=r.length;e<t;e++){const t=r[e],n=t.name,a=t.values;switch(n){case"appearance":null!==a[0]&&(o=s(a[0]));break;case"geometry":null!==a[0]&&(i=s(a[0]));break;default:console.warn("THREE.VRMLLoader: Unknown field:",n)}}if(i&&i.attributes.position){const t=i._type;if("points"===t){const t=new e.PointsMaterial({color:16777215});void 0!==i.attributes.color?t.vertexColors=!0:o.isMeshPhongMaterial&&t.color.copy(o.emissive),n=new e.Points(i,t)}else if("line"===t){const t=new e.LineBasicMaterial({color:16777215});void 0!==i.attributes.color?t.vertexColors=!0:o.isMeshPhongMaterial&&t.color.copy(o.emissive),n=new e.LineSegments(i,t)}else void 0!==i._solid&&(o.side=i._solid?e.FrontSide:e.DoubleSide),void 0!==i.attributes.color&&(o.vertexColors=!0),n=new e.Mesh(i,o)}else n=new e.Object3D,n.visible=!1;return n}(t);break;case"Appearance":i=function(t){let r,i=new e.MeshPhongMaterial;const n=t.fields;for(let t=0,o=n.length;t<o;t++){const o=n[t],a=o.name,l=o.values;switch(a){case"material":if(null!==l[0]){const e=s(l[0]);e.diffuseColor&&i.color.copy(e.diffuseColor),e.emissiveColor&&i.emissive.copy(e.emissiveColor),e.shininess&&(i.shininess=e.shininess),e.specularColor&&i.specular.copy(e.specularColor),e.transparency&&(i.opacity=1-e.transparency),e.transparency>0&&(i.transparent=!0)}else i=new e.MeshBasicMaterial({color:0});break;case"texture":const t=l[0];null!==t&&("ImageTexture"!==t.name&&"PixelTexture"!==t.name||(i.map=s(t)));break;case"textureTransform":null!==l[0]&&(r=s(l[0]));break;default:console.warn("THREE.VRMLLoader: Unknown field:",a)}}if(i.map){if(i.map.__type){switch(i.map.__type){case ud.INTENSITY_ALPHA:i.opacity=1;break;case ud.RGB:i.color.set(16777215);break;case ud.RGBA:i.color.set(16777215),i.opacity=1}delete i.map.__type}r&&(i.map.center.copy(r.center),i.map.rotation=r.rotation,i.map.repeat.copy(r.scale),i.map.offset.copy(r.translation))}return i}(t);break;case"Material":i=function(t){const r={},i=t.fields;for(let t=0,n=i.length;t<n;t++){const n=i[t],s=n.name,o=n.values;switch(s){case"ambientIntensity":break;case"diffuseColor":r.diffuseColor=new e.Color(o[0],o[1],o[2]);break;case"emissiveColor":r.emissiveColor=new e.Color(o[0],o[1],o[2]);break;case"shininess":r.shininess=o[0];break;case"specularColor":r.emissiveColor=new e.Color(o[0],o[1],o[2]);break;case"transparency":r.transparency=o[0];break;default:console.warn("THREE.VRMLLoader: Unknown field:",s)}}return r}(t);break;case"ImageTexture":i=function(t){let r,i=e.RepeatWrapping,n=e.RepeatWrapping;const s=t.fields;for(let t=0,o=s.length;t<o;t++){const o=s[t],a=o.name,l=o.values;switch(a){case"url":const t=l[0];t&&(r=B.load(t));break;case"repeatS":!1===l[0]&&(i=e.ClampToEdgeWrapping);break;case"repeatT":!1===l[0]&&(n=e.ClampToEdgeWrapping);break;default:console.warn("THREE.VRMLLoader: Unknown field:",a)}}r&&(r.wrapS=i,r.wrapT=n);return r}(t);break;case"PixelTexture":i=function(t){let r,i=e.RepeatWrapping,n=e.RepeatWrapping;const s=t.fields;for(let t=0,o=s.length;t<o;t++){const o=s[t],c=o.name,h=o.values;switch(c){case"image":const t=h[0],s=h[1],o=l(h[2]),u=new Uint8Array(4*t*s),d={r:0,g:0,b:0,a:0};for(let e=3,t=0,r=h.length;e<r;e++,t++){a(h[e],o,d);const r=4*t;u[r+0]=d.r,u[r+1]=d.g,u[r+2]=d.b,u[r+3]=d.a}r=new e.DataTexture(u,t,s),r.needsUpdate=!0,r.__type=o;break;case"repeatS":!1===h[0]&&(i=e.ClampToEdgeWrapping);break;case"repeatT":!1===h[0]&&(n=e.ClampToEdgeWrapping);break;default:console.warn("THREE.VRMLLoader: Unknown field:",c)}}r&&(r.wrapS=i,r.wrapT=n);return r}(t);break;case"TextureTransform":i=function(t){const r={center:new e.Vector2,rotation:new e.Vector2,scale:new e.Vector2,translation:new e.Vector2},i=t.fields;for(let e=0,t=i.length;e<t;e++){const t=i[e],n=t.name,s=t.values;switch(n){case"center":r.center.set(s[0],s[1]);break;case"rotation":r.rotation=s[0];break;case"scale":r.scale.set(s[0],s[1]);break;case"translation":r.translation.set(s[0],s[1]);break;default:console.warn("THREE.VRMLLoader: Unknown field:",n)}}return r}(t);break;case"IndexedFaceSet":i=function(t){let r,i,n,o,a,l,c,p,m=!0,f=!0,g=0,v=!0,x=!0;const y=t.fields;for(let e=0,t=y.length;e<t;e++){const t=y[e],h=t.name,u=t.values;switch(h){case"color":const e=u[0];null!==e&&(r=s(e));break;case"coord":const t=u[0];null!==t&&(i=s(t));break;case"normal":const d=u[0];null!==d&&(n=s(d));break;case"texCoord":const y=u[0];null!==y&&(o=s(y));break;case"ccw":m=u[0];break;case"colorIndex":a=u;break;case"colorPerVertex":v=u[0];break;case"convex":break;case"coordIndex":l=u;break;case"creaseAngle":g=u[0];break;case"normalIndex":c=u;break;case"normalPerVertex":x=u[0];break;case"solid":f=u[0];break;case"texCoordIndex":p=u;break;default:console.warn("THREE.VRMLLoader: Unknown field:",h)}}if(void 0===l)return console.warn("THREE.VRMLLoader: Missing coordIndex."),new e.BufferGeometry;const b=h(l,m);let M,S,C;if(r)if(!0===v)if(a&&a.length>0){M=A(b,h(a,m),r,3)}else M=T(b,new e.Float32BufferAttribute(r,3));else if(a&&a.length>0){M=w(b,u(d(r,a),l))}else{M=w(b,u(r,l))}if(n)if(!0===x)if(c&&c.length>0){S=A(b,h(c,m),n,3)}else S=T(b,new e.Float32BufferAttribute(n,3));else if(c&&c.length>0){S=w(b,u(d(n,c),l))}else{S=w(b,u(n,l))}else S=F(b,i,g);if(o)if(p&&p.length>0){C=A(b,h(p,m),o,2)}else C=T(b,new e.Float32BufferAttribute(o,2));const E=new e.BufferGeometry,_=T(b,new e.Float32BufferAttribute(i,3));E.setAttribute("position",_),E.setAttribute("normal",S),M&&E.setAttribute("color",M);C&&E.setAttribute("uv",C);return E._solid=f,E._type="mesh",E}(t);break;case"IndexedLineSet":i=function(t){let r,i,n,o,a=!0;const l=t.fields;for(let e=0,t=l.length;e<t;e++){const t=l[e],c=t.name,h=t.values;switch(c){case"color":const e=h[0];null!==e&&(r=s(e));break;case"coord":const t=h[0];null!==t&&(i=s(t));break;case"colorIndex":n=h;break;case"colorPerVertex":a=h[0];break;case"coordIndex":o=h;break;default:console.warn("THREE.VRMLLoader: Unknown field:",c)}}let c;const h=p(o);if(r)if(!0===a)if(n.length>0){c=A(h,p(n),r,3)}else c=T(h,new e.Float32BufferAttribute(r,3));else if(n.length>0){c=M(h,m(d(r,n),o))}else{c=M(h,m(r,o))}const u=new e.BufferGeometry,f=T(h,new e.Float32BufferAttribute(i,3));u.setAttribute("position",f),c&&u.setAttribute("color",c);return u._type="line",u}(t);break;case"PointSet":i=function(t){let r,i;const n=t.fields;for(let e=0,t=n.length;e<t;e++){const t=n[e],o=t.name,a=t.values;switch(o){case"color":const e=a[0];null!==e&&(r=s(e));break;case"coord":const t=a[0];null!==t&&(i=s(t));break;default:console.warn("THREE.VRMLLoader: Unknown field:",o)}}const o=new e.BufferGeometry;o.setAttribute("position",new e.Float32BufferAttribute(i,3)),r&&o.setAttribute("color",new e.Float32BufferAttribute(r,3));return o._type="points",o}(t);break;case"Box":i=function(t){const r=new e.Vector3(2,2,2),i=t.fields;for(let e=0,t=i.length;e<t;e++){const t=i[e],n=t.name,s=t.values;switch(n){case"size":r.x=s[0],r.y=s[1],r.z=s[2];break;default:console.warn("THREE.VRMLLoader: Unknown field:",n)}}return new e.BoxGeometry(r.x,r.y,r.z)}(t);break;case"Cone":i=function(t){let r=1,i=2,n=!1;const s=t.fields;for(let e=0,t=s.length;e<t;e++){const t=s[e],o=t.name,a=t.values;switch(o){case"bottom":n=!a[0];break;case"bottomRadius":r=a[0];break;case"height":i=a[0];break;case"side":break;default:console.warn("THREE.VRMLLoader: Unknown field:",o)}}return new e.ConeGeometry(r,i,16,1,n)}(t);break;case"Cylinder":i=function(t){let r=1,i=2;const n=t.fields;for(let e=0,t=n.length;e<t;e++){const t=n[e],s=t.name,o=t.values;switch(s){case"bottom":break;case"radius":r=o[0];break;case"height":i=o[0];break;case"side":case"top":break;default:console.warn("THREE.VRMLLoader: Unknown field:",s)}}return new e.CylinderGeometry(r,r,i,16,1)}(t);break;case"Sphere":i=function(t){let r=1;const i=t.fields;for(let e=0,t=i.length;e<t;e++){const t=i[e],n=t.name,s=t.values;switch(n){case"radius":r=s[0];break;default:console.warn("THREE.VRMLLoader: Unknown field:",n)}}return new e.SphereGeometry(r,16,16)}(t);break;case"ElevationGrid":i=function(t){let r,i,n,o,a=!0,l=!0,c=!0,h=!0,u=0,d=2,p=2,m=1,f=1;const g=t.fields;for(let e=0,t=g.length;e<t;e++){const t=g[e],v=t.name,x=t.values;switch(v){case"color":const e=x[0];null!==e&&(r=s(e));break;case"normal":const t=x[0];null!==t&&(i=s(t));break;case"texCoord":const g=x[0];null!==g&&(n=s(g));break;case"height":o=x;break;case"ccw":h=x[0];break;case"colorPerVertex":a=x[0];break;case"creaseAngle":u=x[0];break;case"normalPerVertex":l=x[0];break;case"solid":c=x[0];break;case"xDimension":d=x[0];break;case"xSpacing":m=x[0];break;case"zDimension":p=x[0];break;case"zSpacing":f=x[0];break;default:console.warn("THREE.VRMLLoader: Unknown field:",v)}}const v=[],x=[],y=[],b=[];for(let e=0;e<p;e++)for(let t=0;t<d;t++){const s=e*d+t,c=m*e,h=o[s],u=f*t;if(v.push(c,h,u),r&&!0===a){const e=r[3*s+0],t=r[3*s+1],i=r[3*s+2];y.push(e,t,i)}if(i&&!0===l){const e=i[3*s+0],t=i[3*s+1],r=i[3*s+2];x.push(e,t,r)}if(n){const e=n[2*s+0],t=n[2*s+1];b.push(e,t)}else b.push(e/(d-1),t/(p-1))}const A=[];for(let e=0;e<d-1;e++)for(let t=0;t<p-1;t++){const r=e+t*d,i=e+(t+1)*d,n=e+1+(t+1)*d,s=e+1+t*d;!0===h?(A.push(r,n,i),A.push(n,r,s)):(A.push(r,i,n),A.push(n,s,r))}const w=T(A,new e.Float32BufferAttribute(v,3)),M=T(A,new e.Float32BufferAttribute(b,2));let S,C;if(r)if(!1===a){for(let e=0;e<d-1;e++)for(let t=0;t<p-1;t++){const i=e+t*(d-1),n=r[3*i+0],s=r[3*i+1],o=r[3*i+2];y.push(n,s,o),y.push(n,s,o),y.push(n,s,o),y.push(n,s,o),y.push(n,s,o),y.push(n,s,o)}S=new e.Float32BufferAttribute(y,3)}else S=T(A,new e.Float32BufferAttribute(y,3));if(i)if(!1===l){for(let e=0;e<d-1;e++)for(let t=0;t<p-1;t++){const r=e+t*(d-1),n=i[3*r+0],s=i[3*r+1],o=i[3*r+2];x.push(n,s,o),x.push(n,s,o),x.push(n,s,o),x.push(n,s,o),x.push(n,s,o),x.push(n,s,o)}C=new e.Float32BufferAttribute(x,3)}else C=T(A,new e.Float32BufferAttribute(x,3));else C=F(A,v,u);const E=new e.BufferGeometry;E.setAttribute("position",w),E.setAttribute("normal",C),E.setAttribute("uv",M),S&&E.setAttribute("color",S);return E._solid=c,E._type="mesh",E}(t);break;case"Extrusion":i=function(t){let r,i,n=[1,1,1,-1,-1,-1,-1,1,1,1],s=[0,0,0,0,1,0],o=!0,a=!0,l=0,c=!0,h=!0;const u=t.fields;for(let e=0,t=u.length;e<t;e++){const t=u[e],d=t.name,p=t.values;switch(d){case"beginCap":o=p[0];break;case"ccw":a=p[0];break;case"convex":break;case"creaseAngle":l=p[0];break;case"crossSection":n=p;break;case"endCap":c=p[0];break;case"orientation":i=p;break;case"scale":r=p;break;case"solid":h=p[0];break;case"spine":s=p;break;default:console.warn("THREE.VRMLLoader: Unknown field:",d)}}const d=n[0]===n[n.length-2]&&n[1]===n[n.length-1],p=[],m=new e.Vector3,f=new e.Vector3,g=new e.Vector3,v=new e.Vector3,x=new e.Quaternion;for(let e=0,t=0,o=0,a=s.length;e<a;e+=3,t+=2,o+=4){m.fromArray(s,e),f.x=r?r[t+0]:1,f.y=1,f.z=r?r[t+1]:1,g.x=i?i[o+0]:0,g.y=i?i[o+1]:0,g.z=i?i[o+2]:1;const a=i?i[o+3]:0;for(let e=0,t=n.length;e<t;e+=2)v.x=n[e+0],v.y=0,v.z=n[e+1],v.multiply(f),x.setFromAxisAngle(g,a),v.applyQuaternion(x),v.add(m),p.push(v.x,v.y,v.z)}const y=[],b=s.length/3,A=n.length/2;for(let e=0;e<b-1;e++)for(let t=0;t<A-1;t++){const r=t+e*A;let i=t+1+e*A;const n=t+(e+1)*A;let s=t+1+(e+1)*A;t===A-2&&!0===d&&(i=e*A,s=(e+1)*A),!0===a?(y.push(r,i,n),y.push(n,i,s)):(y.push(r,n,i),y.push(n,s,i))}if(!0===o||!0===c){const t=[];for(let r=0,i=n.length;r<i;r+=2)t.push(new e.Vector2(n[r],n[r+1]));const r=e.ShapeUtils.triangulateShape(t,[]),i=[];for(let e=0,t=r.length;e<t;e++){const t=r[e];i.push(t[0],t[1],t[2])}if(!0===o)for(let e=0,t=i.length;e<t;e+=3)!0===a?y.push(i[e+0],i[e+1],i[e+2]):y.push(i[e+0],i[e+2],i[e+1]);if(!0===c){const e=A*(b-1);for(let t=0,r=i.length;t<r;t+=3)!0===a?y.push(e+i[t+0],e+i[t+2],e+i[t+1]):y.push(e+i[t+0],e+i[t+1],e+i[t+2])}}const w=T(y,new e.Float32BufferAttribute(p,3)),M=F(y,p,l),S=new e.BufferGeometry;return S.setAttribute("position",w),S.setAttribute("normal",M),S._solid=h,S._type="mesh",S}(t);break;case"Color":case"Coordinate":case"Normal":case"TextureCoordinate":i=function(e){return e.fields[0].values}(t);break;case"WorldInfo":i=function(e){const t={},r=e.fields;for(let e=0,i=r.length;e<i;e++){const i=r[e],n=i.name,s=i.values;switch(n){case"title":t.title=s[0];break;case"info":t.info=s;break;default:console.warn("THREE.VRMLLoader: Unknown field:",n)}}return t}(t);break;case"Anchor":case"Billboard":case"Inline":case"LOD":case"Switch":case"AudioClip":case"DirectionalLight":case"PointLight":case"Script":case"Sound":case"SpotLight":case"CylinderSensor":case"PlaneSensor":case"ProximitySensor":case"SphereSensor":case"TimeSensor":case"TouchSensor":case"VisibilitySensor":case"Text":case"FontStyle":case"MovieTexture":case"ColorInterpolator":case"CoordinateInterpolator":case"NormalInterpolator":case"OrientationInterpolator":case"PositionInterpolator":case"ScalarInterpolator":case"Fog":case"NavigationInfo":case"Viewpoint":break;default:console.warn("THREE.VRMLLoader: Unknown node:",r)}void 0!==i&&void 0!==t.DEF&&!0===i.hasOwnProperty("name")&&(i.name=t.DEF);return i}(t)),t.build)}function a(e,t,r){let i;switch(t){case ud.INTENSITY:i=parseInt(e),r.r=i,r.g=i,r.b=i,r.a=1;break;case ud.INTENSITY_ALPHA:i=parseInt("0x"+e.substring(2,4)),r.r=i,r.g=i,r.b=i,r.a=parseInt("0x"+e.substring(4,6));break;case ud.RGB:r.r=parseInt("0x"+e.substring(2,4)),r.g=parseInt("0x"+e.substring(4,6)),r.b=parseInt("0x"+e.substring(6,8)),r.a=1;break;case ud.RGBA:r.r=parseInt("0x"+e.substring(2,4)),r.g=parseInt("0x"+e.substring(4,6)),r.b=parseInt("0x"+e.substring(6,8)),r.a=parseInt("0x"+e.substring(8,10))}}function l(e){let t;switch(e){case 1:t=ud.INTENSITY;break;case 2:t=ud.INTENSITY_ALPHA;break;case 3:t=ud.RGB;break;case 4:t=ud.RGBA}return t}function c(t,r){for(let i=0,n=t.length;i<n;i++){const n=s(t[i]);n instanceof e.Object3D&&r.add(n)}}function h(e,t){const r=[];let i=0;for(let n=0,s=e.length;n<s;n++){const o=e[i],a=e[n+(t?1:2)],l=e[n+(t?2:1)];r.push(o,a,l),(-1===e[n+3]||n+3>=s)&&(n+=3,i=n+1)}return r}function u(e,t){const r=[];let i=0;for(let n=0,s=t.length;n<s;n++){const o=3*i,a=e[o],l=e[o+1],c=e[o+2];r.push(a,l,c),(-1===t[n+3]||n+3>=s)&&(n+=3,i++)}return r}function d(e,t){const r=[];for(let i=0,n=t.length;i<n;i++){const n=3*t[i],s=e[n],o=e[n+1],a=e[n+2];r.push(s,o,a)}return r}function p(e){const t=[];for(let r=0,i=e.length;r<i;r++){const n=e[r],s=e[r+1];t.push(n,s),(-1===e[r+2]||r+2>=i)&&(r+=2)}return t}function m(e,t){const r=[];let i=0;for(let n=0,s=t.length;n<s;n++){const o=3*i,a=e[o],l=e[o+1],c=e[o+2];r.push(a,l,c),(-1===t[n+2]||n+2>=s)&&(n+=2,i++)}return r}const f=new e.Vector3,g=new e.Vector3,v=new e.Vector3,x=new e.Vector2,y=new e.Vector2,b=new e.Vector2;function A(t,r,i,n){const s=[];for(let e=0,o=t.length;e<o;e+=3){const t=r[e],o=r[e+1],a=r[e+2];2===n?(x.fromArray(i,t*n),y.fromArray(i,o*n),b.fromArray(i,a*n),s.push(x.x,x.y),s.push(y.x,y.y),s.push(b.x,b.y)):(f.fromArray(i,t*n),g.fromArray(i,o*n),v.fromArray(i,a*n),s.push(f.x,f.y,f.z),s.push(g.x,g.y,g.z),s.push(v.x,v.y,v.z))}return new e.Float32BufferAttribute(s,n)}function w(t,r){const i=[];for(let e=0,n=0,s=t.length;e<s;e+=3,n++)f.fromArray(r,3*n),i.push(f.x,f.y,f.z),i.push(f.x,f.y,f.z),i.push(f.x,f.y,f.z);return new e.Float32BufferAttribute(i,3)}function M(t,r){const i=[];for(let e=0,n=0,s=t.length;e<s;e+=2,n++)f.fromArray(r,3*n),i.push(f.x,f.y,f.z),i.push(f.x,f.y,f.z);return new e.Float32BufferAttribute(i,3)}function T(t,r){const i=r.array,n=r.itemSize,s=new i.constructor(t.length*n);let o=0,a=0;for(let e=0,r=t.length;e<r;e++){o=t[e]*n;for(let e=0;e<n;e++)s[a++]=i[o++]}return new e.Float32BufferAttribute(s,n)}const S=new e.Vector3,C=new e.Vector3;function F(t,r,i){const n=[],s={};for(let e=0,i=t.length;e<i;e+=3){const i=t[e],o=t[e+1],a=t[e+2],l=new hd(i,o,a);f.fromArray(r,3*i),g.fromArray(r,3*o),v.fromArray(r,3*a),C.subVectors(v,g),S.subVectors(f,g),C.cross(S),C.normalize(),l.normal.copy(C),void 0===s[i]&&(s[i]=[]),void 0===s[o]&&(s[o]=[]),void 0===s[a]&&(s[a]=[]),s[i].push(l.normal),s[o].push(l.normal),s[a].push(l.normal),n.push(l)}const o=[];for(let e=0,t=n.length;e<t;e++){const t=n[e],a=E(s[t.a],t.normal,i),l=E(s[t.b],t.normal,i),c=E(s[t.c],t.normal,i);f.fromArray(r,3*t.a),g.fromArray(r,3*t.b),v.fromArray(r,3*t.c),o.push(a.x,a.y,a.z),o.push(l.x,l.y,l.z),o.push(c.x,c.y,c.z)}return new e.Float32BufferAttribute(o,3)}function E(t,r,i){const n=new e.Vector3;if(0===i)n.copy(r);else for(let e=0,s=t.length;e<s;e++)t[e].angleTo(r)<i&&n.add(t[e]);return n.normalize()}function _(t){const r=[];for(let i=0,n=t.length;i<n;i+=3)r.push(new e.Color(t[i],t[i+1],t[i+2]));return r}function P(t,r,i,n,s){const o=[],a=!0===s?0:Math.PI;for(let t=0,l=n.length;t<l;t++){let n=0===t?0:i[t-1];n=!0===s?n:a-n;const l=new e.Vector3;l.setFromSphericalCoords(r,n,0),o.push(l)}const l=t.index,c=t.attributes.position,h=new e.BufferAttribute(new Float32Array(3*t.attributes.position.count),3),u=new e.Vector3,d=new e.Color;for(let e=0;e<l.count;e++){const t=l.getX(e);let r,i;u.fromBufferAttribute(c,t);let a=1;for(let e=1;e<o.length;e++){r=e-1,i=e;const t=o[r],n=o[i];if(!0===s){if(u.y<=t.y&&u.y>n.y){a=Math.abs(t.y-u.y)/Math.abs(t.y-n.y);break}}else if(u.y>=t.y&&u.y<n.y){a=Math.abs(t.y-u.y)/Math.abs(t.y-n.y);break}}const p=n[r],m=n[i];d.copy(p).lerp(m,a),h.setXYZ(t,d.r,d.g,d.b)}t.setAttribute("color",h)}const B=new e.TextureLoader(this.manager);if(B.setPath(this.resourcePath||r).setCrossOrigin(this.crossOrigin),-1===t.indexOf("#VRML V2.0"))throw Error("THREE.VRMLLexer: Version of VRML asset not supported.");return function(t){const r=t.nodes,i=new e.Scene;for(let e=0,t=r.length;e<t;e++){n(r[e])}for(let t=0,n=r.length;t<n;t++){const n=r[t],o=s(n);o instanceof e.Object3D&&i.add(o),"WorldInfo"===n.name&&(i.userData.worldInfo=o)}return i}(function(e){const t=function(){const e=o.createToken({name:"RouteIdentifier",pattern:/[^\x30-\x39\0-\x20\x22\x27\x23\x2b\x2c\x2d\x2e\x5b\x5d\x5c\x7b\x7d][^\0-\x20\x22\x27\x23\x2b\x2c\x2d\x2e\x5b\x5d\x5c\x7b\x7d]*[\.][^\x30-\x39\0-\x20\x22\x27\x23\x2b\x2c\x2d\x2e\x5b\x5d\x5c\x7b\x7d][^\0-\x20\x22\x27\x23\x2b\x2c\x2d\x2e\x5b\x5d\x5c\x7b\x7d]*/}),t=o.createToken({name:"Identifier",pattern:/[^\x30-\x39\0-\x20\x22\x27\x23\x2b\x2c\x2d\x2e\x5b\x5d\x5c\x7b\x7d][^\0-\x20\x22\x27\x23\x2b\x2c\x2d\x2e\x5b\x5d\x5c\x7b\x7d]*/,longer_alt:e}),r=["Anchor","Billboard","Collision","Group","Transform","Inline","LOD","Switch","AudioClip","DirectionalLight","PointLight","Script","Shape","Sound","SpotLight","WorldInfo","CylinderSensor","PlaneSensor","ProximitySensor","SphereSensor","TimeSensor","TouchSensor","VisibilitySensor","Box","Cone","Cylinder","ElevationGrid","Extrusion","IndexedFaceSet","IndexedLineSet","PointSet","Sphere","Color","Coordinate","Normal","TextureCoordinate","Appearance","FontStyle","ImageTexture","Material","MovieTexture","PixelTexture","TextureTransform","ColorInterpolator","CoordinateInterpolator","NormalInterpolator","OrientationInterpolator","PositionInterpolator","ScalarInterpolator","Background","Fog","NavigationInfo","Viewpoint","Text"],i=o.createToken({name:"Version",pattern:/#VRML.*/,longer_alt:t}),n=o.createToken({name:"NodeName",pattern:new RegExp(r.join("|")),longer_alt:t}),s=o.createToken({name:"DEF",pattern:/DEF/,longer_alt:t}),a=o.createToken({name:"USE",pattern:/USE/,longer_alt:t}),l=o.createToken({name:"ROUTE",pattern:/ROUTE/,longer_alt:t}),c=o.createToken({name:"TO",pattern:/TO/,longer_alt:t}),h=o.createToken({name:"StringLiteral",pattern:/"(?:[^\\"\n\r]|\\[bfnrtv"\\/]|\\u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])*"/}),u=o.createToken({name:"HexLiteral",pattern:/0[xX][0-9a-fA-F]+/}),d=o.createToken({name:"NumberLiteral",pattern:/[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?/}),p=o.createToken({name:"TrueLiteral",pattern:/TRUE/}),m=o.createToken({name:"FalseLiteral",pattern:/FALSE/}),f=o.createToken({name:"NullLiteral",pattern:/NULL/}),g=o.createToken({name:"LSquare",pattern:/\[/}),v=o.createToken({name:"RSquare",pattern:/]/}),x=o.createToken({name:"LCurly",pattern:/{/}),y=o.createToken({name:"RCurly",pattern:/}/}),b=o.createToken({name:"Comment",pattern:/#.*/,group:o.Lexer.SKIPPED}),A=[o.createToken({name:"WhiteSpace",pattern:/[ ,\s]/,group:o.Lexer.SKIPPED}),n,s,a,l,c,p,m,f,i,t,e,h,u,d,g,v,x,y,b],w={};for(let e=0,t=A.length;e<t;e++){const t=A[e];w[t.name]=t}return{tokens:A,tokenVocabulary:w}}(),r=new ld(t.tokens),i=new cd(t.tokenVocabulary),n=function(e){function t(){e.call(this),this.validateVisitor()}function r(e,t){const r={type:null,values:[]};if(t.node){r.type="node";for(let i=0,n=t.node.length;i<n;i++){const n=t.node[i];r.values.push(e.visit(n))}}if(t.use){r.type="use";for(let i=0,n=t.use.length;i<n;i++){const n=t.use[i];r.values.push(e.visit(n))}}if(t.StringLiteral){r.type="string";for(let e=0,i=t.StringLiteral.length;e<i;e++){const i=t.StringLiteral[e];r.values.push(i.image.replace(/'|"/g,""))}}if(t.NumberLiteral){r.type="number";for(let e=0,i=t.NumberLiteral.length;e<i;e++){const i=t.NumberLiteral[e];r.values.push(parseFloat(i.image))}}if(t.HexLiteral){r.type="hex";for(let e=0,i=t.HexLiteral.length;e<i;e++){const i=t.HexLiteral[e];r.values.push(i.image)}}if(t.TrueLiteral){r.type="boolean";for(let e=0,i=t.TrueLiteral.length;e<i;e++){"TRUE"===t.TrueLiteral[e].image&&r.values.push(!0)}}if(t.FalseLiteral){r.type="boolean";for(let e=0,i=t.FalseLiteral.length;e<i;e++){"FALSE"===t.FalseLiteral[e].image&&r.values.push(!1)}}return t.NullLiteral&&(r.type="null",t.NullLiteral.forEach((function(){r.values.push(null)}))),r}return t.prototype=Object.assign(Object.create(e.prototype),{constructor:t,vrml:function(e){const t={version:this.visit(e.version),nodes:[],routes:[]};for(let r=0,i=e.node.length;r<i;r++){const i=e.node[r];t.nodes.push(this.visit(i))}if(e.route)for(let r=0,i=e.route.length;r<i;r++){const i=e.route[r];t.routes.push(this.visit(i))}return t},version:function(e){return e.Version[0].image},node:function(e){const t={name:e.NodeName[0].image,fields:[]};if(e.field)for(let r=0,i=e.field.length;r<i;r++){const i=e.field[r];t.fields.push(this.visit(i))}return e.def&&(t.DEF=this.visit(e.def[0])),t},field:function(e){const t={name:e.Identifier[0].image,type:null,values:null};let r;return e.singleFieldValue&&(r=this.visit(e.singleFieldValue[0])),e.multiFieldValue&&(r=this.visit(e.multiFieldValue[0])),t.type=r.type,t.values=r.values,t},def:function(e){return(e.Identifier||e.NodeName)[0].image},use:function(e){return{USE:(e.Identifier||e.NodeName)[0].image}},singleFieldValue:function(e){return r(this,e)},multiFieldValue:function(e){return r(this,e)},route:function(e){return{FROM:e.RouteIdentifier[0].image,TO:e.RouteIdentifier[1].image}}}),new t}(i.getBaseCstVisitorConstructor()),s=r.lex(e);i.input=s.tokens;const a=i.vrml();if(i.errors.length>0)throw console.error(i.errors),Error("THREE.VRMLLoader: Parsing errors detected.");return n.visit(a)}(t))}}class ld{constructor(e){this.lexer=new o.Lexer(e)}lex(e){const t=this.lexer.tokenize(e);if(t.errors.length>0)throw console.error(t.errors),Error("THREE.VRMLLexer: Lexing errors detected.");return t}}class cd extends o.CstParser{constructor(e){super(e);const t=this,r=e.Version,i=e.LCurly,n=e.RCurly,s=e.LSquare,o=e.RSquare,a=e.Identifier,l=e.RouteIdentifier,c=e.StringLiteral,h=e.HexLiteral,u=e.NumberLiteral,d=e.TrueLiteral,p=e.FalseLiteral,m=e.NullLiteral,f=e.DEF,g=e.USE,v=e.ROUTE,x=e.TO,y=e.NodeName;t.RULE("vrml",(function(){t.SUBRULE(t.version),t.AT_LEAST_ONE((function(){t.SUBRULE(t.node)})),t.MANY((function(){t.SUBRULE(t.route)}))})),t.RULE("version",(function(){t.CONSUME(r)})),t.RULE("node",(function(){t.OPTION((function(){t.SUBRULE(t.def)})),t.CONSUME(y),t.CONSUME(i),t.MANY((function(){t.SUBRULE(t.field)})),t.CONSUME(n)})),t.RULE("field",(function(){t.CONSUME(a),t.OR2([{ALT:function(){t.SUBRULE(t.singleFieldValue)}},{ALT:function(){t.SUBRULE(t.multiFieldValue)}}])})),t.RULE("def",(function(){t.CONSUME(f),t.OR([{ALT:function(){t.CONSUME(a)}},{ALT:function(){t.CONSUME(y)}}])})),t.RULE("use",(function(){t.CONSUME(g),t.OR([{ALT:function(){t.CONSUME(a)}},{ALT:function(){t.CONSUME(y)}}])})),t.RULE("singleFieldValue",(function(){t.AT_LEAST_ONE((function(){t.OR([{ALT:function(){t.SUBRULE(t.node)}},{ALT:function(){t.SUBRULE(t.use)}},{ALT:function(){t.CONSUME(c)}},{ALT:function(){t.CONSUME(h)}},{ALT:function(){t.CONSUME(u)}},{ALT:function(){t.CONSUME(d)}},{ALT:function(){t.CONSUME(p)}},{ALT:function(){t.CONSUME(m)}}])}))})),t.RULE("multiFieldValue",(function(){t.CONSUME(s),t.MANY((function(){t.OR([{ALT:function(){t.SUBRULE(t.node)}},{ALT:function(){t.SUBRULE(t.use)}},{ALT:function(){t.CONSUME(c)}},{ALT:function(){t.CONSUME(h)}},{ALT:function(){t.CONSUME(u)}},{ALT:function(){t.CONSUME(m)}}])})),t.CONSUME(o)})),t.RULE("route",(function(){t.CONSUME(v),t.CONSUME(l),t.CONSUME(x),t.CONSUME2(l)})),this.performSelfAnalysis()}}class hd{constructor(t,r,i){this.a=t,this.b=r,this.c=i,this.normal=new e.Vector3}}const ud={INTENSITY:1,INTENSITY_ALPHA:2,RGB:3,RGBA:4};class dd{constructor(e=4){this.pool=e,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0}_initWorker(e){if(!this.workers[e]){const t=this.workerCreator();t.addEventListener("message",this._onMessage.bind(this,e)),this.workers[e]=t}}_getIdleWorker(){for(let e=0;e<this.pool;e++)if(!(this.workerStatus&1<<e))return e;return-1}_onMessage(e,t){const r=this.workersResolve[e];if(r&&r(t),this.queue.length){const{resolve:t,msg:r,transfer:i}=this.queue.shift();this.workersResolve[e]=t,this.workers[e].postMessage(r,i)}else this.workerStatus^=1<<e}setWorkerCreator(e){this.workerCreator=e}setWorkerLimit(e){this.pool=e}postMessage(e,t){return new Promise((r=>{const i=this._getIdleWorker();-1!==i?(this._initWorker(i),this.workerStatus|=1<<i,this.workersResolve[i]=r,this.workers[i].postMessage(e,t)):this.queue.push({resolve:r,msg:e,transfer:t})}))}dispose(){this.workers.forEach((e=>e.terminate())),this.workersResolve.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0}}class pd extends e.CompressedTexture{constructor(t,r,i,n,s,o){super(t,r,i,s,o),this.isCompressedArrayTexture=!0,this.image.depth=n,this.wrapR=e.ClampToEdgeWrapping}}const md=new WeakMap;let fd,gd=0;class vd extends e.Loader{constructor(e){super(e),this.transcoderPath="",this.transcoderBinary=null,this.transcoderPending=null,this.workerPool=new dd,this.workerSourceURL="",this.workerConfig=null,"undefined"!=typeof MSC_TRANSCODER&&console.warn('THREE.KTX2Loader: Please update to latest "basis_transcoder". "msc_basis_transcoder" is no longer supported in three.js r125+.')}setTranscoderPath(e){return this.transcoderPath=e,this}setWorkerLimit(e){return this.workerPool.setWorkerLimit(e),this}detectSupport(e){return this.workerConfig={astcSupported:e.extensions.has("WEBGL_compressed_texture_astc"),etc1Supported:e.extensions.has("WEBGL_compressed_texture_etc1"),etc2Supported:e.extensions.has("WEBGL_compressed_texture_etc"),dxtSupported:e.extensions.has("WEBGL_compressed_texture_s3tc"),bptcSupported:e.extensions.has("EXT_texture_compression_bptc"),pvrtcSupported:e.extensions.has("WEBGL_compressed_texture_pvrtc")||e.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")},e.capabilities.isWebGL2&&(this.workerConfig.etc1Supported=!1),this}init(){if(!this.transcoderPending){const t=new e.FileLoader(this.manager);t.setPath(this.transcoderPath),t.setWithCredentials(this.withCredentials);const r=t.loadAsync("basis_transcoder.js"),i=new e.FileLoader(this.manager);i.setPath(this.transcoderPath),i.setResponseType("arraybuffer"),i.setWithCredentials(this.withCredentials);const n=i.loadAsync("basis_transcoder.wasm");this.transcoderPending=Promise.all([r,n]).then((([e,t])=>{const r=vd.BasisWorker.toString(),i=["/* constants */","let _EngineFormat = "+JSON.stringify(vd.EngineFormat),"let _TranscoderFormat = "+JSON.stringify(vd.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(vd.BasisFormat),"/* basis_transcoder.js */",e,"/* worker */",r.substring(r.indexOf("{")+1,r.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([i])),this.transcoderBinary=t,this.workerPool.setWorkerCreator((()=>{const e=new Worker(this.workerSourceURL),t=this.transcoderBinary.slice(0);return e.postMessage({type:"init",config:this.workerConfig,transcoderBinary:t},[t]),e}))})),gd>0&&console.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),gd++}return this.transcoderPending}load(t,r,i,n){if(null===this.workerConfig)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");const s=new e.FileLoader(this.manager);s.setResponseType("arraybuffer"),s.setWithCredentials(this.withCredentials),s.load(t,(e=>{if(md.has(e)){return md.get(e).promise.then(r).catch(n)}this._createTexture(e).then((e=>r?r(e):null)).catch(n)}),i,n)}_createTextureFrom(t,r){const{mipmaps:i,width:n,height:s,format:o,type:l,error:c,dfdTransferFn:h,dfdFlags:u}=t;if("error"===l)return Promise.reject(c);const d=r.layerCount>1?new pd(i,n,s,r.layerCount,o,e.UnsignedByteType):new e.CompressedTexture(i,n,s,o,e.UnsignedByteType);return d.minFilter=1===i.length?e.LinearFilter:e.LinearMipmapLinearFilter,d.magFilter=e.LinearFilter,d.generateMipmaps=!1,d.needsUpdate=!0,"colorSpace"in d?d.colorSpace=h===a.KHR_DF_TRANSFER_SRGB?"srgb":"srgb-linear":d.encoding=h===a.KHR_DF_TRANSFER_SRGB?3001:3e3,d.premultiplyAlpha=!!(u&a.KHR_DF_FLAG_ALPHA_PREMULTIPLIED),d}async _createTexture(t,r={}){const i=a.read(new Uint8Array(t));if(i.vkFormat!==a.VK_FORMAT_UNDEFINED)return async function(t){const{vkFormat:r,pixelWidth:i,pixelHeight:n,pixelDepth:s}=t;if(void 0===xd[r])throw new Error("THREE.KTX2Loader: Unsupported vkFormat.");const o=t.levels[0];let c,h;if(t.supercompressionScheme===a.KHR_SUPERCOMPRESSION_NONE)c=o.levelData;else{if(t.supercompressionScheme!==a.KHR_SUPERCOMPRESSION_ZSTD)throw new Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");fd||(fd=new Promise((async e=>{const t=new l.ZSTDDecoder;await t.init(),e(t)}))),c=(await fd).decode(o.levelData,o.uncompressedByteLength)}h=yd[r]===e.FloatType?new Float32Array(c.buffer,c.byteOffset,c.byteLength/Float32Array.BYTES_PER_ELEMENT):yd[r]===e.HalfFloatType?new Uint16Array(c.buffer,c.byteOffset,c.byteLength/Uint16Array.BYTES_PER_ELEMENT):c;const u=0===s?new e.DataTexture(h,i,n):new Hu(h,i,n,s);return u.type=yd[r],u.format=xd[r],u.encoding=bd[r]||3e3,u.needsUpdate=!0,Promise.resolve(u)}(i);const n=r,s=this.init().then((()=>this.workerPool.postMessage({type:"transcode",buffer:t,taskConfig:n},[t]))).then((e=>this._createTextureFrom(e.data,i)));return md.set(t,{promise:s}),s}dispose(){return this.workerPool.dispose(),this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),gd--,this}}vd.BasisFormat={ETC1S:0,UASTC_4x4:1},vd.TranscoderFormat={ETC1:0,ETC2:1,BC1:2,BC3:3,BC4:4,BC5:5,BC7_M6_OPAQUE_ONLY:6,BC7_M5:7,PVRTC1_4_RGB:8,PVRTC1_4_RGBA:9,ASTC_4x4:10,ATC_RGB:11,ATC_RGBA_INTERPOLATED_ALPHA:12,RGBA32:13,RGB565:14,BGR565:15,RGBA4444:16},vd.EngineFormat={RGBAFormat:e.RGBAFormat,RGBA_ASTC_4x4_Format:e.RGBA_ASTC_4x4_Format,RGBA_BPTC_Format:e.RGBA_BPTC_Format,RGBA_ETC2_EAC_Format:e.RGBA_ETC2_EAC_Format,RGBA_PVRTC_4BPPV1_Format:e.RGBA_PVRTC_4BPPV1_Format,RGBA_S3TC_DXT5_Format:e.RGBA_S3TC_DXT5_Format,RGB_ETC1_Format:e.RGB_ETC1_Format,RGB_ETC2_Format:e.RGB_ETC2_Format,RGB_PVRTC_4BPPV1_Format:e.RGB_PVRTC_4BPPV1_Format,RGB_S3TC_DXT1_Format:e.RGB_S3TC_DXT1_Format},vd.BasisWorker=function(){let e,t,r;const i=_EngineFormat,n=_TranscoderFormat,s=_BasisFormat;self.addEventListener("message",(function(o){const u=o.data;switch(u.type){case"init":e=u.config,d=u.transcoderBinary,t=new Promise((e=>{r={wasmBinary:d,onRuntimeInitialized:e},BASIS(r)})).then((()=>{r.initializeBasis(),void 0===r.KTX2File&&console.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.")}));break;case"transcode":t.then((()=>{try{const{width:t,height:o,hasAlpha:d,mipmaps:p,format:m,dfdTransferFn:f,dfdFlags:g}=function(t){const o=new r.KTX2File(new Uint8Array(t));function u(){o.close(),o.delete()}if(!o.isValid())throw u(),new Error("THREE.KTX2Loader:\tInvalid or unsupported .ktx2 file");const d=o.isUASTC()?s.UASTC_4x4:s.ETC1S,p=o.getWidth(),m=o.getHeight(),f=o.getLayers()||1,g=o.getLevels(),v=o.getHasAlpha(),x=o.getDFDTransferFunc(),y=o.getDFDFlags(),{transcoderFormat:b,engineFormat:A}=function(t,r,o,h){let u,d;const p=t===s.ETC1S?a:l;for(let i=0;i<p.length;i++){const n=p[i];if(e[n.if]&&(n.basisFormat.includes(t)&&!(h&&n.transcoderFormat.length<2)&&(!n.needsPowerOfTwo||c(r)&&c(o))))return u=n.transcoderFormat[h?1:0],d=n.engineFormat[h?1:0],{transcoderFormat:u,engineFormat:d}}return console.warn("THREE.KTX2Loader: No suitable compressed texture format found. Decoding to RGBA32."),u=n.RGBA32,d=i.RGBAFormat,{transcoderFormat:u,engineFormat:d}}(d,p,m,v);if(!p||!m||!g)throw u(),new Error("THREE.KTX2Loader:\tInvalid texture");if(!o.startTranscoding())throw u(),new Error("THREE.KTX2Loader: .startTranscoding failed");const w=[];for(let e=0;e<g;e++){const t=[];let r,i;for(let n=0;n<f;n++){const s=o.getImageLevelInfo(e,n,0);r=s.origWidth<4?s.origWidth:s.width,i=s.origHeight<4?s.origHeight:s.height;const a=new Uint8Array(o.getImageTranscodedSizeInBytes(e,n,0,b));if(!o.transcodeImage(a,e,n,0,b,0,-1,-1))throw u(),new Error("THREE.KTX2Loader: .transcodeImage failed.");t.push(a)}w.push({data:h(t),width:r,height:i})}return u(),{width:p,height:m,hasAlpha:v,mipmaps:w,format:A,dfdTransferFn:x,dfdFlags:y}}(u.buffer),v=[];for(let e=0;e<p.length;++e)v.push(p[e].data.buffer);self.postMessage({type:"transcode",id:u.id,width:t,height:o,hasAlpha:d,mipmaps:p,format:m,dfdTransferFn:f,dfdFlags:g},v)}catch(e){console.error(e),self.postMessage({type:"error",id:u.id,error:e.message})}}))}var d}));const o=[{if:"astcSupported",basisFormat:[s.UASTC_4x4],transcoderFormat:[n.ASTC_4x4,n.ASTC_4x4],engineFormat:[i.RGBA_ASTC_4x4_Format,i.RGBA_ASTC_4x4_Format],priorityETC1S:1/0,priorityUASTC:1,needsPowerOfTwo:!1},{if:"bptcSupported",basisFormat:[s.ETC1S,s.UASTC_4x4],transcoderFormat:[n.BC7_M5,n.BC7_M5],engineFormat:[i.RGBA_BPTC_Format,i.RGBA_BPTC_Format],priorityETC1S:3,priorityUASTC:2,needsPowerOfTwo:!1},{if:"dxtSupported",basisFormat:[s.ETC1S,s.UASTC_4x4],transcoderFormat:[n.BC1,n.BC3],engineFormat:[i.RGB_S3TC_DXT1_Format,i.RGBA_S3TC_DXT5_Format],priorityETC1S:4,priorityUASTC:5,needsPowerOfTwo:!1},{if:"etc2Supported",basisFormat:[s.ETC1S,s.UASTC_4x4],transcoderFormat:[n.ETC1,n.ETC2],engineFormat:[i.RGB_ETC2_Format,i.RGBA_ETC2_EAC_Format],priorityETC1S:1,priorityUASTC:3,needsPowerOfTwo:!1},{if:"etc1Supported",basisFormat:[s.ETC1S,s.UASTC_4x4],transcoderFormat:[n.ETC1],engineFormat:[i.RGB_ETC1_Format],priorityETC1S:2,priorityUASTC:4,needsPowerOfTwo:!1},{if:"pvrtcSupported",basisFormat:[s.ETC1S,s.UASTC_4x4],transcoderFormat:[n.PVRTC1_4_RGB,n.PVRTC1_4_RGBA],engineFormat:[i.RGB_PVRTC_4BPPV1_Format,i.RGBA_PVRTC_4BPPV1_Format],priorityETC1S:5,priorityUASTC:6,needsPowerOfTwo:!0}],a=o.sort((function(e,t){return e.priorityETC1S-t.priorityETC1S})),l=o.sort((function(e,t){return e.priorityUASTC-t.priorityUASTC}));function c(e){return e<=2||0==(e&e-1)&&0!==e}function h(e){let t=0;for(let r=0;r<e.length;r++){t+=e[r].byteLength}const r=new Uint8Array(t);let i=0;for(let t=0;t<e.length;t++){const n=e[t];r.set(n,i),i+=n.byteLength}return r}};const xd={[a.VK_FORMAT_R32G32B32A32_SFLOAT]:e.RGBAFormat,[a.VK_FORMAT_R16G16B16A16_SFLOAT]:e.RGBAFormat,[a.VK_FORMAT_R8G8B8A8_UNORM]:e.RGBAFormat,[a.VK_FORMAT_R8G8B8A8_SRGB]:e.RGBAFormat,[a.VK_FORMAT_R32G32_SFLOAT]:e.RGFormat,[a.VK_FORMAT_R16G16_SFLOAT]:e.RGFormat,[a.VK_FORMAT_R8G8_UNORM]:e.RGFormat,[a.VK_FORMAT_R8G8_SRGB]:e.RGFormat,[a.VK_FORMAT_R32_SFLOAT]:e.RedFormat,[a.VK_FORMAT_R16_SFLOAT]:e.RedFormat,[a.VK_FORMAT_R8_SRGB]:e.RedFormat,[a.VK_FORMAT_R8_UNORM]:e.RedFormat},yd={[a.VK_FORMAT_R32G32B32A32_SFLOAT]:e.FloatType,[a.VK_FORMAT_R16G16B16A16_SFLOAT]:e.HalfFloatType,[a.VK_FORMAT_R8G8B8A8_UNORM]:e.UnsignedByteType,[a.VK_FORMAT_R8G8B8A8_SRGB]:e.UnsignedByteType,[a.VK_FORMAT_R32G32_SFLOAT]:e.FloatType,[a.VK_FORMAT_R16G16_SFLOAT]:e.HalfFloatType,[a.VK_FORMAT_R8G8_UNORM]:e.UnsignedByteType,[a.VK_FORMAT_R8G8_SRGB]:e.UnsignedByteType,[a.VK_FORMAT_R32_SFLOAT]:e.FloatType,[a.VK_FORMAT_R16_SFLOAT]:e.HalfFloatType,[a.VK_FORMAT_R8_SRGB]:e.UnsignedByteType,[a.VK_FORMAT_R8_UNORM]:e.UnsignedByteType},bd={[a.VK_FORMAT_R8G8B8A8_SRGB]:3001,[a.VK_FORMAT_R8G8_SRGB]:3001,[a.VK_FORMAT_R8_SRGB]:3001};class Ad extends e.Loader{setQuality(e){this._quality=e}load(t,r,i,n){const s=this._quality||1,o=new e.CanvasTexture;o.minFilter=e.NearestFilter;const a=new e.FileLoader(this.manager);return a.setPath(this.path),a.setWithCredentials(this.withCredentials),a.load(t,(function(e){const t=JSON.parse(e),i=document.createElement("div");i.style.width=t.w+"px",i.style.height=t.h+"px",document.body.appendChild(i);const n=bodymovin.loadAnimation({container:i,animType:"canvas",loop:!0,autoplay:!0,animationData:t,rendererSettings:{dpr:s}});o.animation=n,o.image=n.container,n.addEventListener("enterFrame",(function(){o.needsUpdate=!0})),i.style.display="none",void 0!==r&&r(o)}),i,n),o}}class wd extends e.Loader{constructor(e){super(e),this.reversed=!1}load(t,r,i,n){const s=this,o=new e.FileLoader(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,(function(e){try{r(c.parse(e))}catch(e){n?n(e):console.error(e),s.manager.itemError(t)}}),i,n)}parse(e){function t(e){const t=[];let r;e.forEach((function(e){"m"===e.type.toLowerCase()?(r=[e],t.push(r)):"z"!==e.type.toLowerCase()&&r.push(e)}));const i=[];return t.forEach((function(e){const t={type:"m",x:e[e.length-1].x,y:e[e.length-1].y};i.push(t);for(let t=e.length-1;t>0;t--){const r=e[t],n={type:r.type};void 0!==r.x2&&void 0!==r.y2?(n.x1=r.x2,n.y1=r.y2,n.x2=r.x1,n.y2=r.y1):void 0!==r.x1&&void 0!==r.y1&&(n.x1=r.x1,n.y1=r.y1),n.x=e[t-1].x,n.y=e[t-1].y,i.push(n)}})),i}return function(e,r){const i=Math.round,n={},s=1e5/(72*(e.unitsPerEm||2048)),o=e.encoding.cmap.glyphIndexMap,a=Object.keys(o);for(let l=0;l<a.length;l++){const c=a[l],h=e.glyphs.glyphs[o[c]];if(void 0!==c){const e={ha:i(h.advanceWidth*s),x_min:i(h.xMin*s),x_max:i(h.xMax*s),o:""};r&&(h.path.commands=t(h.path.commands)),h.path.commands.forEach((function(t){"c"===t.type.toLowerCase()&&(t.type="b"),e.o+=t.type.toLowerCase()+" ",void 0!==t.x&&void 0!==t.y&&(e.o+=i(t.x*s)+" "+i(t.y*s)+" "),void 0!==t.x1&&void 0!==t.y1&&(e.o+=i(t.x1*s)+" "+i(t.y1*s)+" "),void 0!==t.x2&&void 0!==t.y2&&(e.o+=i(t.x2*s)+" "+i(t.y2*s)+" ")})),n[String.fromCodePoint(h.unicode)]=e}}return{glyphs:n,familyName:e.getEnglishName("fullName"),ascender:i(e.ascender*s),descender:i(e.descender*s),underlinePosition:e.tables.post.underlinePosition,underlineThickness:e.tables.post.underlineThickness,boundingBox:{xMin:e.tables.head.xMin,xMax:e.tables.head.xMax,yMin:e.tables.head.yMin,yMax:e.tables.head.yMax},resolution:1e3,original_font_information:e.tables.name}}(c.parse(e),this.reversed)}}class Md extends e.DataTextureLoader{constructor(t){super(t),this.type=e.HalfFloatType}parse(t){const r=function(e,t){switch(e){case 1:console.error("THREE.RGBELoader Read Error: "+(t||""));break;case 2:console.error("THREE.RGBELoader Write Error: "+(t||""));break;case 3:console.error("THREE.RGBELoader Bad File Format: "+(t||""));break;default:case 4:console.error("THREE.RGBELoader: Error: "+(t||""))}return-1},i=function(e,t,r){t=t||1024;let i=e.pos,n=-1,s=0,o="",a=String.fromCharCode.apply(null,new Uint16Array(e.subarray(i,i+128)));for(;0>(n=a.indexOf("\n"))&&s<t&&i<e.byteLength;)o+=a,s+=a.length,i+=128,a+=String.fromCharCode.apply(null,new Uint16Array(e.subarray(i,i+128)));return-1<n&&(!1!==r&&(e.pos+=s+n+1),o+a.slice(0,n))},n=function(e,t,r,i){const n=e[t+3],s=Math.pow(2,n-128)/255;r[i+0]=e[t+0]*s,r[i+1]=e[t+1]*s,r[i+2]=e[t+2]*s,r[i+3]=1},s=function(t,r,i,n){const s=t[r+3],o=Math.pow(2,s-128)/255;i[n+0]=e.DataUtils.toHalfFloat(Math.min(t[r+0]*o,65504)),i[n+1]=e.DataUtils.toHalfFloat(Math.min(t[r+1]*o,65504)),i[n+2]=e.DataUtils.toHalfFloat(Math.min(t[r+2]*o,65504)),i[n+3]=e.DataUtils.toHalfFloat(1)},o=new Uint8Array(t);o.pos=0;const a=function(e){const t=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,n=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,s=/^\s*FORMAT=(\S+)\s*$/,o=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,a={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};let l,c;if(e.pos>=e.byteLength||!(l=i(e)))return r(1,"no header found");if(!(c=l.match(/^#\?(\S+)/)))return r(3,"bad initial token");for(a.valid|=1,a.programtype=c[1],a.string+=l+"\n";l=i(e),!1!==l;)if(a.string+=l+"\n","#"!==l.charAt(0)){if((c=l.match(t))&&(a.gamma=parseFloat(c[1])),(c=l.match(n))&&(a.exposure=parseFloat(c[1])),(c=l.match(s))&&(a.valid|=2,a.format=c[1]),(c=l.match(o))&&(a.valid|=4,a.height=parseInt(c[1],10),a.width=parseInt(c[2],10)),2&a.valid&&4&a.valid)break}else a.comments+=l+"\n";return 2&a.valid?4&a.valid?a:r(3,"missing image size specifier"):r(3,"missing format specifier")}(o);if(-1!==a){const t=a.width,i=a.height,l=function(e,t,i){const n=t;if(n<8||n>32767||2!==e[0]||2!==e[1]||128&e[2])return new Uint8Array(e);if(n!==(e[2]<<8|e[3]))return r(3,"wrong scanline width");const s=new Uint8Array(4*t*i);if(!s.length)return r(4,"unable to allocate buffer space");let o=0,a=0;const l=4*n,c=new Uint8Array(4),h=new Uint8Array(l);let u=i;for(;u>0&&a<e.byteLength;){if(a+4>e.byteLength)return r(1);if(c[0]=e[a++],c[1]=e[a++],c[2]=e[a++],c[3]=e[a++],2!=c[0]||2!=c[1]||(c[2]<<8|c[3])!=n)return r(3,"bad rgbe scanline format");let t,i=0;for(;i<l&&a<e.byteLength;){t=e[a++];const n=t>128;if(n&&(t-=128),0===t||i+t>l)return r(3,"bad scanline data");if(n){const r=e[a++];for(let e=0;e<t;e++)h[i++]=r}else h.set(e.subarray(a,a+t),i),i+=t,a+=t}const d=n;for(let e=0;e<d;e++){let t=0;s[o]=h[e+t],t+=n,s[o+1]=h[e+t],t+=n,s[o+2]=h[e+t],t+=n,s[o+3]=h[e+t],o+=4}u--}return s}(o.subarray(o.pos),t,i);if(-1!==l){let r,o,c;switch(this.type){case e.FloatType:c=l.length/4;const t=new Float32Array(4*c);for(let e=0;e<c;e++)n(l,4*e,t,4*e);r=t,o=e.FloatType;break;case e.HalfFloatType:c=l.length/4;const i=new Uint16Array(4*c);for(let e=0;e<c;e++)s(l,4*e,i,4*e);r=i,o=e.HalfFloatType;break;default:console.error("THREE.RGBELoader: unsupported type: ",this.type)}return{width:t,height:i,data:r,header:a.string,gamma:a.gamma,exposure:a.exposure,type:o}}}return null}setDataType(e){return this.type=e,this}load(t,r,i,n){return super.load(t,(function(t,i){switch(t.type){case e.FloatType:case e.HalfFloatType:"colorSpace"in t?t.colorSpace="srgb-linear":t.encoding=3e3,t.minFilter=e.LinearFilter,t.magFilter=e.LinearFilter,t.generateMipmaps=!1,t.flipY=!0}r&&r(t,i)}),i,n)}}var Td=function(t){e.Loader.call(this,t)};Td.prototype=Object.assign(Object.create(e.Loader.prototype),{constructor:Td,load:function(t,r,i,n){var s=this,o=""===s.path?e.LoaderUtils.extractUrlBase(t):s.path,a=new e.FileLoader(s.manager);a.setPath(s.path),a.setResponseType("arraybuffer"),a.setRequestHeader(s.requestHeader),a.setWithCredentials(s.withCredentials),a.load(t,(function(e){try{r(s.parse(e,o))}catch(e){n?n(e):console.error(e),s.manager.itemError(t)}}),i,n)},parse:function(t,r){var i=new e.TextureLoader(this.manager);i.setPath(this.resourcePath||r).setCrossOrigin(this.crossOrigin);var n={KeyFrame:function(t,r){this.time=t,this.matrix=r.clone(),this.position=new e.Vector3,this.quaternion=new e.Quaternion,this.scale=new e.Vector3(1,1,1),this.matrix.decompose(this.position,this.quaternion,this.scale),this.clone=function(){return new n.KeyFrame(this.time,this.matrix)},this.lerp=function(e,t){var r=(t-=this.time)/(e.time-this.time),i=1-r,s=this.position,o=this.quaternion,a=e.position,l=e.quaternion;return n.KeyFrame.tempAniPos.x=s.x*i+a.x*r,n.KeyFrame.tempAniPos.y=s.y*i+a.y*r,n.KeyFrame.tempAniPos.z=s.z*i+a.z*r,n.KeyFrame.tempAniQuat.set(o.x,o.y,o.z,o.w),n.KeyFrame.tempAniQuat.slerp(l,r),n.KeyFrame.tempAniMatrix.compose(n.KeyFrame.tempAniPos,n.KeyFrame.tempAniQuat,n.KeyFrame.tempAniScale)}}};n.KeyFrame.tempAniPos=new e.Vector3,n.KeyFrame.tempAniQuat=new e.Quaternion,n.KeyFrame.tempAniScale=new e.Vector3(1,1,1),n.KeyFrame.tempAniMatrix=new e.Matrix4,n.KeyFrameTrack=function(){this.keys=[],this.target=null,this.time=0,this.length=0,this._accelTable={},this.fps=20,this.addKey=function(e){this.keys.push(e)},this.init=function(){if(this.sortKeys(),this.keys.length>0?this.length=this.keys[this.keys.length-1].time:this.length=0,this.fps)for(let e=0;e<this.length*this.fps;e++)for(let t=0;t<this.keys.length;t++){if(this.keys[t].time==e){this._accelTable[e]=t;break}if(this.keys[t].time<e/this.fps&&this.keys[t+1]&&this.keys[t+1].time>=e/this.fps){this._accelTable[e]=t;break}}},this.parseFromThree=function(e){var t=e.fps;this.target=e.node;var r=e.hierarchy[0].keys;for(let e=0;e<r.length;e++)this.addKey(new n.KeyFrame(e/t||r[e].time,r[e].targets[0].data));this.init()},this.parseFromCollada=function(e){var t=e.keys,r=this.fps;for(let e=0;e<t.length;e++)this.addKey(new n.KeyFrame(e/r||t[e].time,t[e].matrix));this.init()},this.sortKeys=function(){this.keys.sort(this.keySortFunc)},this.keySortFunc=function(e,t){return e.time-t.time},this.clone=function(){var e=new n.KeyFrameTrack;e.target=this.target,e.time=this.time,e.length=this.length;for(let t=0;t<this.keys.length;t++)e.addKey(this.keys[t].clone());return e.init(),e},this.reTarget=function(e,t){t||(t=n.TrackTargetNodeNameCompare),this.target=t(e,this.target)},this.keySearchAccel=function(e){return e*=this.fps,e=Math.floor(e),this._accelTable[e]||0},this.setTime=function(e){e=Math.abs(e),this.length&&(e=e%this.length+.05);var t=null,r=null;for(let i=this.keySearchAccel(e);i<this.keys.length;i++){if(this.keys[i].time==e){t=this.keys[i],r=this.keys[i];break}if(this.keys[i].time<e&&this.keys[i+1]&&this.keys[i+1].time>e){t=this.keys[i],r=this.keys[i+1];break}if(this.keys[i].time<e&&i==this.keys.length-1){t=this.keys[i],(r=this.keys[0].clone()).time+=this.length+.05;break}}return t&&r&&t!==r?(this.target.matrixAutoUpdate=!1,this.target.matrix.copy(t.lerp(r,e)),void(this.target.matrixWorldNeedsUpdate=!0)):t&&r&&t==r?(this.target.matrixAutoUpdate=!1,this.target.matrix.copy(t.matrix),void(this.target.matrixWorldNeedsUpdate=!0)):void 0}},n.TrackTargetNodeNameCompare=function(e,t){return function e(t,r){if(t.name==r)return t;for(let n=0;n<t.children.length;n++){var i=e(t.children[n],r);if(i)return i}return null}(e,t.name)},n.Animation=function(){this.tracks=[],this.length=0,this.addTrack=function(e){this.tracks.push(e),this.length=Math.max(e.length,this.length)},this.setTime=function(e){this.time=e;for(let t=0;t<this.tracks.length;t++)this.tracks[t].setTime(e)},this.clone=function(e,t){t||(t=n.TrackTargetNodeNameCompare);var r=new n.Animation;r.target=e;for(let n=0;n<this.tracks.length;n++){var i=this.tracks[n].clone();i.reTarget(e,t),r.addTrack(i)}return r}};function s(e){return 256<<e}function o(e){return 65536<<e}function a(t,r){var i=new e.Bone;i.matrix.copy(t.matrix),i.matrixWorld.copy(t.matrixWorld),i.position.copy(t.position),i.quaternion.copy(t.quaternion),i.scale.copy(t.scale),r.nodeCount++,i.name="bone_"+t.name+r.nodeCount.toString(),r.nodeToBoneMap[t.name]||(r.nodeToBoneMap[t.name]=[]),r.nodeToBoneMap[t.name].push(i);for(let e in t.children){var n=a(t.children[e],r);i.add(n)}return i}function l(e,t){var r=[];for(let i=0;i<e.length;i++)r.push({i:e[i],w:t[i]});for(r.sort((function(e,t){return t.w-e.w}));r.length<4;)r.push({i:0,w:0});r.length>4&&(r.length=4);var i=0;for(let e=0;e<4;e++)i+=r[e].w*r[e].w;i=Math.sqrt(i);for(let n=0;n<4;n++)r[n].w=r[n].w/i,e[n]=r[n].i,t[n]=r[n].w}function c(e,t){if(0==e.name.indexOf("bone_"+t))return e;for(let i in e.children){var r=c(e.children[i],t);if(r)return r}}function h(){this.mPrimitiveTypes=0,this.mNumVertices=0,this.mNumFaces=0,this.mNumBones=0,this.mMaterialIndex=0,this.mVertices=[],this.mNormals=[],this.mTangents=[],this.mBitangents=[],this.mColors=[[]],this.mTextureCoords=[[]],this.mFaces=[],this.mBones=[],this.hookupSkeletons=function(t){if(0!=this.mBones.length){for(var r=[],i=[],n=t.findNode(this.mBones[0].mName);n.mParent&&n.mParent.isBone;)n=n.mParent;var s=a(n.toTHREE(t),t);this.threeNode.add(s);for(let e=0;e<this.mBones.length;e++){if(l=c(s,this.mBones[e].mName)){var o=l;r.push(o),i.push(this.mBones[e].mOffsetMatrix.toTHREE())}else{if(!(n=t.findNode(this.mBones[e].mName)))return;s=a(n.toTHREE(t),t);this.threeNode.add(s);var l;o=l=c(s,this.mBones[e].mName);r.push(o),i.push(this.mBones[e].mOffsetMatrix.toTHREE())}}var h=new e.Skeleton(r,i);this.threeNode.bind(h,new e.Matrix4),this.threeNode.material.skinning=!0}},this.toTHREE=function(t){if(this.threeNode)return this.threeNode;var r,i,n=new e.BufferGeometry;if(r=t.mMaterials[this.mMaterialIndex]?t.mMaterials[this.mMaterialIndex].toTHREE(t):new e.MeshLambertMaterial,n.setIndex(new e.BufferAttribute(new Uint32Array(this.mIndexArray),1)),n.setAttribute("position",new e.BufferAttribute(this.mVertexBuffer,3)),this.mNormalBuffer&&this.mNormalBuffer.length>0&&n.setAttribute("normal",new e.BufferAttribute(this.mNormalBuffer,3)),this.mColorBuffer&&this.mColorBuffer.length>0&&n.setAttribute("color",new e.BufferAttribute(this.mColorBuffer,4)),this.mTexCoordsBuffers[0]&&this.mTexCoordsBuffers[0].length>0&&n.setAttribute("uv",new e.BufferAttribute(new Float32Array(this.mTexCoordsBuffers[0]),2)),this.mTexCoordsBuffers[1]&&this.mTexCoordsBuffers[1].length>0&&n.setAttribute("uv1",new e.BufferAttribute(new Float32Array(this.mTexCoordsBuffers[1]),2)),this.mTangentBuffer&&this.mTangentBuffer.length>0&&n.setAttribute("tangents",new e.BufferAttribute(this.mTangentBuffer,3)),this.mBitangentBuffer&&this.mBitangentBuffer.length>0&&n.setAttribute("bitangents",new e.BufferAttribute(this.mBitangentBuffer,3)),this.mBones.length>0){var s=[],o=[];for(let e=0;e<this.mBones.length;e++)for(let t=0;t<this.mBones[e].mWeights.length;t++){var a=this.mBones[e].mWeights[t];a&&(s[a.mVertexId]||(s[a.mVertexId]=[]),o[a.mVertexId]||(o[a.mVertexId]=[]),s[a.mVertexId].push(a.mWeight),o[a.mVertexId].push(parseInt(e)))}for(let e in o)l(o[e],s[e]);var c=[],h=[];for(let e=0;e<s.length;e++)for(let t=0;t<4;t++)s[e]&&o[e]?(c.push(s[e][t]),h.push(o[e][t])):(c.push(0),h.push(0));n.setAttribute("skinWeight",new e.BufferAttribute(new Float32Array(c),4)),n.setAttribute("skinIndex",new e.BufferAttribute(new Float32Array(h),4))}return 0==this.mBones.length&&(i=new e.Mesh(n,r)),this.mBones.length>0&&(i=new e.SkinnedMesh(n,r)).normalizeSkinWeights(),this.threeNode=i,i}}function u(){this.mNumIndices=0,this.mIndices=[]}function d(){this.x=0,this.y=0,this.z=0,this.toTHREE=function(){return new e.Vector3(this.x,this.y,this.z)}}function p(){this.r=0,this.g=0,this.b=0,this.a=0,this.toTHREE=function(){return new e.Color(this.r,this.g,this.b)}}function m(){this.x=0,this.y=0,this.z=0,this.w=0,this.toTHREE=function(){return new e.Quaternion(this.x,this.y,this.z,this.w)}}function f(){this.mVertexId=0,this.mWeight=0}function g(){this.data=[],this.toString=function(){var e="";return this.data.forEach((function(t){e+=String.fromCharCode(t)})),e.replace(/[^\x20-\x7E]+/g,"")}}function v(){this.mTime=0,this.mValue=null}function x(){this.mTime=0,this.mValue=null}function y(){this.mName="",this.mTransformation=[],this.mNumChildren=0,this.mNumMeshes=0,this.mMeshes=[],this.mChildren=[],this.toTHREE=function(t){if(this.threeNode)return this.threeNode;var r=new e.Object3D;r.name=this.mName,r.matrix=this.mTransformation.toTHREE();for(let e=0;e<this.mChildren.length;e++)r.add(this.mChildren[e].toTHREE(t));for(let e=0;e<this.mMeshes.length;e++)r.add(t.mMeshes[this.mMeshes[e]].toTHREE(t));return this.threeNode=r,r.matrix.decompose(r.position,r.quaternion,r.scale),r}}function b(){this.mName="",this.mNumWeights=0,this.mOffsetMatrix=0}function A(){this.mKey="",this.mSemantic=0,this.mIndex=0,this.mData=[],this.mDataLength=0,this.mType=0,this.dataAsColor=function(){var t=new Uint8Array(this.mData).buffer,r=new DataView(t),i=r.getFloat32(0,!0),n=r.getFloat32(4,!0),s=r.getFloat32(8,!0);return new e.Color(i,n,s)},this.dataAsFloat=function(){var e=new Uint8Array(this.mData).buffer;return new DataView(e).getFloat32(0,!0)},this.dataAsBool=function(){var e=new Uint8Array(this.mData).buffer;return!!new DataView(e).getFloat32(0,!0)},this.dataAsString=function(){var e=new g;return e.data=this.mData,e.toString()},this.dataAsMap=function(){var e=new g;e.data=this.mData;var t=e.toString();return-1!=(t=t.replace(/\\/g,"/")).indexOf("/")&&(t=t.substr(t.lastIndexOf("/")+1)),i.load(t)}}var w={"?mat.name":"name","$mat.shadingm":"shading","$mat.twosided":"twoSided","$mat.wireframe":"wireframe","$clr.ambient":"ambient","$clr.diffuse":"color","$clr.specular":"specular","$clr.emissive":"emissive","$clr.transparent":"transparent","$clr.reflective":"reflect","$mat.shininess":"shininess","$mat.reflectivity":"reflectivity","$mat.refracti":"refraction","$tex.file":"map"},M={"?mat.name":"string","$mat.shadingm":"bool","$mat.twosided":"bool","$mat.wireframe":"bool","$clr.ambient":"color","$clr.diffuse":"color","$clr.specular":"color","$clr.emissive":"color","$clr.transparent":"color","$clr.reflective":"color","$mat.shininess":"float","$mat.reflectivity":"float","$mat.refracti":"float","$tex.file":"map"};function T(){this.mNumAllocated=0,this.mNumProperties=0,this.mProperties=[],this.toTHREE=function(){var t=new e.MeshPhongMaterial;for(let e=0;e<this.mProperties.length;e++)if("float"==M[this.mProperties[e].mKey]&&(t[w[this.mProperties[e].mKey]]=this.mProperties[e].dataAsFloat()),"color"==M[this.mProperties[e].mKey]&&(t[w[this.mProperties[e].mKey]]=this.mProperties[e].dataAsColor()),"bool"==M[this.mProperties[e].mKey]&&(t[w[this.mProperties[e].mKey]]=this.mProperties[e].dataAsBool()),"string"==M[this.mProperties[e].mKey]&&(t[w[this.mProperties[e].mKey]]=this.mProperties[e].dataAsString()),"map"==M[this.mProperties[e].mKey]){var r=this.mProperties[e];1==r.mSemantic&&(t.map=this.mProperties[e].dataAsMap()),6==r.mSemantic&&(t.normalMap=this.mProperties[e].dataAsMap()),10==r.mSemantic&&(t.lightMap=this.mProperties[e].dataAsMap()),8==r.mSemantic&&(t.alphaMap=this.mProperties[e].dataAsMap())}return t.ambient.r=.53,t.ambient.g=.53,t.ambient.b=.53,t.color.r=1,t.color.g=1,t.color.b=1,t}}function S(t,r,i){var n=new e.Vector3,s=1-i;return n.x=t.x*i+r.x*s,n.y=t.y*i+r.y*s,n.z=t.z*i+r.z*s,n}function C(e,t,r){return e.clone().slerp(t,1-r)}function F(e,t,r,i){if(1==e.length)return e[0].mValue.toTHREE();var n=1/0,s=null,o=null;for(let r=0;r<e.length;r++){var a=Math.abs(e[r].mTime-t);a<n&&e[r].mTime<=t&&(n=a,s=e[r],o=e[r+1])}if(s){if(o){var l=o.mTime-s.mTime,c=(s.mTime-t)/l;return i(s.mValue.toTHREE(),o.mValue.toTHREE(),c)}(o=e[0].clone()).mTime+=r;l=o.mTime-s.mTime,c=(s.mTime-t)/l;return i(s.mValue.toTHREE(),o.mValue.toTHREE(),c)}return null}function E(){this.mNodeName="",this.mNumPositionKeys=0,this.mNumRotationKeys=0,this.mNumScalingKeys=0,this.mPositionKeys=[],this.mRotationKeys=[],this.mScalingKeys=[],this.mPreState="",this.mPostState="",this.init=function(e){function t(t){t.mTime/=e}e||(e=1),this.mPositionKeys.forEach(t),this.mRotationKeys.forEach(t),this.mScalingKeys.forEach(t)},this.sortKeys=function(){function e(e,t){return e.mTime-t.mTime}this.mPositionKeys.sort(e),this.mRotationKeys.sort(e),this.mScalingKeys.sort(e)},this.getLength=function(){return Math.max(Math.max.apply(null,this.mPositionKeys.map((function(e){return e.mTime}))),Math.max.apply(null,this.mRotationKeys.map((function(e){return e.mTime}))),Math.max.apply(null,this.mScalingKeys.map((function(e){return e.mTime}))))},this.toTHREE=function(t){this.sortKeys();var r=this.getLength(),i=new n.KeyFrameTrack;for(let t=0;t<r;t+=.05){var s=new e.Matrix4,o=t,a=F(this.mPositionKeys,o,r,S),l=F(this.mScalingKeys,o,r,S),c=F(this.mRotationKeys,o,r,C);s.compose(a,c,l);var h=new n.KeyFrame(o,s);i.addKey(h)}i.target=t.findNode(this.mNodeName).toTHREE();var u=[i];if(t.nodeToBoneMap[this.mNodeName])for(let e=0;e<t.nodeToBoneMap[this.mNodeName].length;e++){var d=i.clone();d.target=t.nodeToBoneMap[this.mNodeName][e],u.push(d)}return u}}function _(){this.mName="",this.mDuration=0,this.mTicksPerSecond=0,this.mNumChannels=0,this.mChannels=[],this.toTHREE=function(e){var t=new n.Animation;for(let i in this.mChannels){this.mChannels[i].init(this.mTicksPerSecond);var r=this.mChannels[i].toTHREE(e);for(let e in r)r[e].init(),t.addTrack(r[e])}return t.length=Math.max.apply(null,t.tracks.map((function(e){return e.length}))),t}}function P(){this.mWidth=0,this.mHeight=0,this.texAchFormatHint=[],this.pcData=[]}function B(){this.mName="",this.mType=0,this.mAttenuationConstant=0,this.mAttenuationLinear=0,this.mAttenuationQuadratic=0,this.mAngleInnerCone=0,this.mAngleOuterCone=0,this.mColorDiffuse=null,this.mColorSpecular=null,this.mColorAmbient=null}function L(){this.mName="",this.mPosition=null,this.mLookAt=null,this.mUp=null,this.mHorizontalFOV=0,this.mClipPlaneNear=0,this.mClipPlaneFar=0,this.mAspect=0}function R(){this.versionMajor=0,this.versionMinor=0,this.versionRevision=0,this.compileFlags=0,this.mFlags=0,this.mNumMeshes=0,this.mNumMaterials=0,this.mNumAnimations=0,this.mNumTextures=0,this.mNumLights=0,this.mNumCameras=0,this.mRootNode=null,this.mMeshes=[],this.mMaterials=[],this.mAnimations=[],this.mLights=[],this.mCameras=[],this.nodeToBoneMap={},this.findNode=function(e,t){if(t||(t=this.mRootNode),t.mName==e)return t;for(let i=0;i<t.mChildren.length;i++){var r=this.findNode(e,t.mChildren[i]);if(r)return r}return null},this.toTHREE=function(){this.nodeCount=0,function(e){for(let i in e.mMeshes){var t=e.mMeshes[i];for(let i in t.mBones){var r=e.findNode(t.mBones[i].mName);r&&(r.isBone=!0)}}}(this);var e=this.mRootNode.toTHREE(this);for(let e in this.mMeshes)this.mMeshes[e].hookupSkeletons(this);if(this.mAnimations.length>0)var t=this.mAnimations[0].toTHREE(this);return{object:e,animation:t}}}function N(){this.elements=[[],[],[],[]],this.toTHREE=function(){var t=new e.Matrix4;for(let e=0;e<4;++e)for(let r=0;r<4;++r)t.elements[4*e+r]=this.elements[r][e];return t}}var D=!0;function I(e){var t=e.getFloat32(e.readOffset,D);return e.readOffset+=4,t}function U(e){var t=e.getFloat64(e.readOffset,D);return e.readOffset+=8,t}function O(e){var t=e.getUint16(e.readOffset,D);return e.readOffset+=2,t}function k(e){var t=e.getUint32(e.readOffset,D);return e.readOffset+=4,t}function V(e){var t=e.getUint32(e.readOffset,D);return e.readOffset+=4,t}function G(e){var t=new d;return t.x=I(e),t.y=I(e),t.z=I(e),t}function z(e){var t=new p;return t.r=I(e),t.g=I(e),t.b=I(e),t}function H(e){var t=new g,r=k(e);return e.ReadBytes(t.data,1,r),t.toString()}function j(e){var t=new f;return t.mVertexId=k(e),t.mWeight=I(e),t}function W(e){var t=new N;for(let r=0;r<4;++r)for(let i=0;i<4;++i)t.elements[r][i]=I(e);return t}function X(e){var t=new v;return t.mTime=U(e),t.mValue=G(e),t}function Q(e){var t=new x;return t.mTime=U(e),t.mValue=function(e){var t=new m;return t.w=I(e),t.x=I(e),t.y=I(e),t.z=I(e),t}(e),t}function Y(e,t,r){for(let i=0;i<r;i++)t[i]=X(e)}function K(e,t,r){return e.Seek(sizeof(t)*r,he)}function q(e){if(!e)throw"asset failed"}function J(e,t,r){q(4668==V(e)),V(e);var i=new y;if(i.mParent=t,i.mDepth=r,i.mName=H(e),i.mTransformation=W(e),i.mNumChildren=k(e),i.mNumMeshes=k(e),i.mNumMeshes){i.mMeshes=[];for(let t=0;t<i.mNumMeshes;++t)i.mMeshes[t]=k(e)}if(i.mNumChildren){i.mChildren=[];for(let t=0;t<i.mNumChildren;++t){var n=J(e,i,r++);i.mChildren[t]=n}}return i}function Z(e,t){return q(4666==V(e)),V(e),t.mName=H(e),t.mNumWeights=k(e),t.mOffsetMatrix=W(e),le?K(e,t.mWeights,t.mNumWeights):(t.mWeights=[],function(e,t,r){for(let i=0;i<r;i++)t[i]=j(e)}(e,t.mWeights,t.mNumWeights)),t}function $(e,t){q(4663==V(e)),V(e),t.mPrimitiveTypes=k(e),t.mNumVertices=k(e),t.mNumFaces=k(e),t.mNumBones=k(e),t.mMaterialIndex=k(e),t.mNumUVComponents=[];var r=k(e);1&r&&(le?K(e,t.mVertices,t.mNumVertices):(t.mVertices=[],t.mVertexBuffer=e.subArray32(e.readOffset,e.readOffset+3*t.mNumVertices*4),e.Seek(3*t.mNumVertices*4,he))),2&r&&(le?K(e,t.mNormals,t.mNumVertices):(t.mNormals=[],t.mNormalBuffer=e.subArray32(e.readOffset,e.readOffset+3*t.mNumVertices*4),e.Seek(3*t.mNumVertices*4,he))),4&r&&(le?(K(e,t.mTangents,t.mNumVertices),K(e,t.mBitangents,t.mNumVertices)):(t.mTangents=[],t.mTangentBuffer=e.subArray32(e.readOffset,e.readOffset+3*t.mNumVertices*4),e.Seek(3*t.mNumVertices*4,he),t.mBitangents=[],t.mBitangentBuffer=e.subArray32(e.readOffset,e.readOffset+3*t.mNumVertices*4),e.Seek(3*t.mNumVertices*4,he)));for(let i=0;i<1&&r&o(i);++i)le?K(e,t.mColors[i],t.mNumVertices):(t.mColors[i]=[],t.mColorBuffer=e.subArray32(e.readOffset,e.readOffset+4*t.mNumVertices*4),e.Seek(4*t.mNumVertices*4,he));t.mTexCoordsBuffers=[];for(let i=0;i<4&&r&s(i);++i)if(t.mNumUVComponents[i]=k(e),le)K(e,t.mTextureCoords[i],t.mNumVertices);else{t.mTextureCoords[i]=[],t.mTexCoordsBuffers[i]=[];for(let r=0;r<t.mNumVertices;r++)t.mTexCoordsBuffers[i].push(I(e)),t.mTexCoordsBuffers[i].push(I(e)),I(e)}if(le)k(e);else{t.mFaces=[],t.mIndexArray=[];for(let r=0;r<t.mNumFaces;++r){var i=t.mFaces[r]=new u;i.mNumIndices=O(e),i.mIndices=[];for(let r=0;r<i.mNumIndices;++r)t.mNumVertices<65536?i.mIndices[r]=O(e):i.mIndices[r]=k(e);if(3===i.mNumIndices)t.mIndexArray.push(i.mIndices[0]),t.mIndexArray.push(i.mIndices[1]),t.mIndexArray.push(i.mIndices[2]);else{if(4!==i.mNumIndices)throw new Error("Sorry, can't currently triangulate polys. Use the triangulate preprocessor in Assimp.");t.mIndexArray.push(i.mIndices[0]),t.mIndexArray.push(i.mIndices[1]),t.mIndexArray.push(i.mIndices[2]),t.mIndexArray.push(i.mIndices[2]),t.mIndexArray.push(i.mIndices[3]),t.mIndexArray.push(i.mIndices[0])}}}if(t.mNumBones){t.mBones=[];for(let r=0;r<t.mNumBones;++r)t.mBones[r]=new b,Z(e,t.mBones[r])}}function ee(e,t){q(4670==V(e)),V(e),t.mKey=H(e),t.mSemantic=k(e),t.mIndex=k(e),t.mDataLength=k(e),t.mType=k(e),t.mData=[],e.ReadBytes(t.mData,1,t.mDataLength)}function te(e,t){if(q(4669==V(e)),V(e),t.mNumAllocated=t.mNumProperties=k(e),t.mNumProperties){t.mProperties&&delete t.mProperties,t.mProperties=[];for(let r=0;r<t.mNumProperties;++r)t.mProperties[r]=new A,ee(e,t.mProperties[r])}}function re(e,t){q(4664==V(e)),V(e),t.mNodeName=H(e),t.mNumPositionKeys=k(e),t.mNumRotationKeys=k(e),t.mNumScalingKeys=k(e),t.mPreState=k(e),t.mPostState=k(e),t.mNumPositionKeys&&(le?K(e,t.mPositionKeys,t.mNumPositionKeys):(t.mPositionKeys=[],Y(e,t.mPositionKeys,t.mNumPositionKeys))),t.mNumRotationKeys&&(le?K(e,t.mRotationKeys,t.mNumRotationKeys):(t.mRotationKeys=[],function(e,t,r){for(let i=0;i<r;i++)t[i]=Q(e)}(e,t.mRotationKeys,t.mNumRotationKeys))),t.mNumScalingKeys&&(le?K(e,t.mScalingKeys,t.mNumScalingKeys):(t.mScalingKeys=[],Y(e,t.mScalingKeys,t.mNumScalingKeys)))}function ie(e,t){if(q(4667==V(e)),V(e),t.mName=H(e),t.mDuration=U(e),t.mTicksPerSecond=U(e),t.mNumChannels=k(e),t.mNumChannels){t.mChannels=[];for(let r=0;r<t.mNumChannels;++r)t.mChannels[r]=new E,re(e,t.mChannels[r])}}function ne(e,t){q(4662==V(e)),V(e),t.mWidth=k(e),t.mHeight=k(e),e.ReadBytes(t.achFormatHint,1,4),le||(t.mHeight?(t.pcData=[],e.ReadBytes(t.pcData,1,t.mWidth*t.mHeight*4)):(t.pcData=[],e.ReadBytes(t.pcData,1,t.mWidth)))}function se(e,t){q(4661==V(e)),V(e),t.mName=H(e),t.mType=k(e),1!=t.mType&&(t.mAttenuationConstant=I(e),t.mAttenuationLinear=I(e),t.mAttenuationQuadratic=I(e)),t.mColorDiffuse=z(e),t.mColorSpecular=z(e),t.mColorAmbient=z(e),3==t.mType&&(t.mAngleInnerCone=I(e),t.mAngleOuterCone=I(e))}function oe(e,t){q(4660==V(e)),V(e),t.mName=H(e),t.mPosition=G(e),t.mLookAt=G(e),t.mUp=G(e),t.mHorizontalFOV=I(e),t.mClipPlaneNear=I(e),t.mClipPlaneFar=I(e),t.mAspect=I(e)}function ae(e,t){if(q(4665==V(e)),V(e),t.mFlags=k(e),t.mNumMeshes=k(e),t.mNumMaterials=k(e),t.mNumAnimations=k(e),t.mNumTextures=k(e),t.mNumLights=k(e),t.mNumCameras=k(e),t.mRootNode=new y,t.mRootNode=J(e,null,0),t.mNumMeshes){t.mMeshes=[];for(let r=0;r<t.mNumMeshes;++r)t.mMeshes[r]=new h,$(e,t.mMeshes[r])}if(t.mNumMaterials){t.mMaterials=[];for(let r=0;r<t.mNumMaterials;++r)t.mMaterials[r]=new T,te(e,t.mMaterials[r])}if(t.mNumAnimations){t.mAnimations=[];for(let r=0;r<t.mNumAnimations;++r)t.mAnimations[r]=new _,ie(e,t.mAnimations[r])}if(t.mNumTextures){t.mTextures=[];for(let r=0;r<t.mNumTextures;++r)t.mTextures[r]=new P,ne(e,t.mTextures[r])}if(t.mNumLights){t.mLights=[];for(let r=0;r<t.mNumLights;++r)t.mLights[r]=new B,se(e,t.mLights[r])}if(t.mNumCameras){t.mCameras=[];for(let r=0;r<t.mNumCameras;++r)t.mCameras[r]=new L,oe(e,t.mCameras[r])}}var le,ce,he=0;return function(e){var t=new R,r=new DataView(e);if(function(e){e.readOffset=0,e.Seek=function(t,r){r==he&&(e.readOffset+=t),1==r&&(e.readOffset=t)},e.ReadBytes=function(e,t,r){var i,n,s=t*r;for(let t=0;t<s;t++)e[t]=(n=void 0,n=(i=this).getUint8(i.readOffset),i.readOffset+=1,n)},e.subArray32=function(e,t){var r=this.buffer.slice(e,t);return new Float32Array(r)},e.subArrayUint16=function(e,t){var r=this.buffer.slice(e,t);return new Uint16Array(r)},e.subArrayUint8=function(e,t){var r=this.buffer.slice(e,t);return new Uint8Array(r)},e.subArrayUint32=function(e,t){var r=this.buffer.slice(e,t);return new Uint32Array(r)}}(r),r.Seek(44,he),t.versionMajor=k(r),t.versionMinor=k(r),t.versionRevision=k(r),t.compileFlags=k(r),le=O(r)>0,ce=O(r)>0,le)throw"Shortened binaries are not supported!";if(r.Seek(256,he),r.Seek(128,he),r.Seek(64,he),ce){var i=V(r),n=r.FileSize()-r.Tell(),s=[];r.Read(s,1,n);var o=[];uncompress(o,i,s,n),ae(new ArrayBuffer(o),t)}else ae(r,t);return t.toTHREE()}(t)}});class Sd extends e.Loader{constructor(e){super(e)}load(t,r,i,n){const s=this,o=new e.FileLoader(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.load(t,(function(e){r(s.parse(e))}),i,n)}parse(t){const r=new DataView(t),i=r.getUint32(0),n=r.getUint32(4);let s=8;const o=new Float32Array(i),a=new Float32Array(i*i).fill(0);for(let e=0;e<i;e++)o[e]=r.getFloat32(s),s+=4,a[i*e+e]=1;const l=new e.NumberKeyframeTrack(".morphTargetInfluences",o,a),c=new e.AnimationClip("default",o[o.length-1],[l]),h=[];for(let t=0;t<i;t++){const i=new Float32Array(3*n);for(let e=0;e<n;e++){const t=3*e;i[t+0]=r.getFloat32(s),s+=4,i[t+1]=r.getFloat32(s),s+=4,i[t+2]=r.getFloat32(s),s+=4}const o=new e.BufferAttribute(i,3);o.name="morph_"+t,h.push(o)}return{morphTargets:h,clip:c}}}class Cd extends e.DataTextureLoader{constructor(t){super(t),this.type=e.HalfFloatType}parse(t){const r=65536,i=14,s=65537,o=16384,a=Math.pow(2.7182818,2.2);const l={l:0,c:0,lc:0};function c(e,t,r,i,n){for(;r<e;)t=t<<8|H(i,n),r+=8;r-=e,l.l=t>>r&(1<<e)-1,l.c=t,l.lc=r}const h=new Array(59);function u(e,t,r,i,n,o,a){for(var u=r,d=0,p=0;n<=o;n++){if(u.value-r.value>i)return!1;c(6,d,p,e,u);var m=l.l;if(d=l.c,p=l.lc,a[n]=m,63==m){if(u.value-r.value>i)throw"Something wrong with hufUnpackEncTable";c(8,d,p,e,u);var f=l.l+6;if(d=l.c,p=l.lc,n+f>o+1)throw"Something wrong with hufUnpackEncTable";for(;f--;)a[n++]=0;n--}else if(m>=59){if(n+(f=m-59+2)>o+1)throw"Something wrong with hufUnpackEncTable";for(;f--;)a[n++]=0;n--}}!function(e){for(var t=0;t<=58;++t)h[t]=0;for(t=0;t<s;++t)h[e[t]]+=1;var r=0;for(t=58;t>0;--t){var i=r+h[t]>>1;h[t]=r,r=i}for(t=0;t<s;++t){var n=e[t];n>0&&(e[t]=n|h[n]++<<6)}}(a)}function d(e){return 63&e}function p(e){return e>>6}const m={c:0,lc:0};function f(e,t,r,i){e=e<<8|H(r,i),t+=8,m.c=e,m.lc=t}const g={c:0,lc:0};function v(e,t,r,i,n,s,o,a,l,c){if(e==t){i<8&&(f(r,i,n,o),r=m.c,i=m.lc);var h=r>>(i-=8);h=new Uint8Array([h])[0];if(l.value+h>c)return!1;for(var u=a[l.value-1];h-- >0;)a[l.value++]=u}else{if(!(l.value<c))return!1;a[l.value++]=e}g.c=r,g.lc=i}function x(e){return 65535&e}function y(e){var t=x(e);return t>32767?t-65536:t}const b={a:0,b:0};function A(e,t){var r=y(e),i=y(t),n=r+(1&i)+(i>>1),s=n,o=n-i;b.a=s,b.b=o}function w(e,t){var r=x(e),i=x(t),n=r-(i>>1)&65535,s=i+n-32768&65535;b.a=s,b.b=n}function M(e,t,r,i,n,s,o){for(var a,l=o<16384,c=r>n?n:r,h=1;h<=c;)h<<=1;for(a=h>>=1,h>>=1;h>=1;){for(var u,d,p,m,f=0,g=f+s*(n-a),v=s*h,x=s*a,y=i*h,M=i*a;f<=g;f+=x){for(var T=f,S=f+i*(r-a);T<=S;T+=M){var C=T+y,F=(E=T+v)+y;l?(A(e[T+t],e[E+t]),u=b.a,p=b.b,A(e[C+t],e[F+t]),d=b.a,m=b.b,A(u,d),e[T+t]=b.a,e[C+t]=b.b,A(p,m),e[E+t]=b.a,e[F+t]=b.b):(w(e[T+t],e[E+t]),u=b.a,p=b.b,w(e[C+t],e[F+t]),d=b.a,m=b.b,w(u,d),e[T+t]=b.a,e[C+t]=b.b,w(p,m),e[E+t]=b.a,e[F+t]=b.b)}if(r&h){var E=T+v;l?A(e[T+t],e[E+t]):w(e[T+t],e[E+t]),u=b.a,e[E+t]=b.b,e[T+t]=u}}if(n&h)for(T=f,S=f+i*(r-a);T<=S;T+=M){C=T+y;l?A(e[T+t],e[C+t]):w(e[T+t],e[C+t]),u=b.a,e[C+t]=b.b,e[T+t]=u}a=h,h>>=1}return f}function T(e,t,r,n,a,l){var c=r.value,h=z(t,r),x=z(t,r);r.value+=4;var y=z(t,r);if(r.value+=4,h<0||h>=s||x<0||x>=s)throw"Something wrong with HUF_ENCSIZE";var b=new Array(s),A=new Array(o);if(function(e){for(var t=0;t<o;t++)e[t]={},e[t].len=0,e[t].lit=0,e[t].p=null}(A),u(e,0,r,n-(r.value-c),h,x,b),y>8*(n-(r.value-c)))throw"Something wrong with hufUncompress";!function(e,t,r,n){for(;t<=r;t++){var s=p(e[t]),o=d(e[t]);if(s>>o)throw"Invalid table entry";if(o>i){if((h=n[s>>o-i]).len)throw"Invalid table entry";if(h.lit++,h.p){var a=h.p;h.p=new Array(h.lit);for(var l=0;l<h.lit-1;++l)h.p[l]=a[l]}else h.p=new Array(1);h.p[h.lit-1]=t}else if(o){var c=0;for(l=1<<i-o;l>0;l--){var h;if((h=n[(s<<i-o)+c]).len||h.p)throw"Invalid table entry";h.len=o,h.lit=t,c++}}}}(b,h,x,A),function(e,t,r,n,s,o,a,l,c,h){for(var u=0,x=0,y=l,b=Math.trunc(s.value+(o+7)/8);s.value<b;)for(f(u,x,r,s),u=m.c,x=m.lc;x>=i;)if((T=t[u>>x-i&16383]).len)x-=T.len,v(T.lit,a,u,x,r,0,s,c,h,y),u=g.c,x=g.lc;else{if(!T.p)throw"hufDecode issues";var A;for(A=0;A<T.lit;A++){for(var w=d(e[T.p[A]]);x<w&&s.value<b;)f(u,x,r,s),u=m.c,x=m.lc;if(x>=w&&p(e[T.p[A]])==(u>>x-w&(1<<w)-1)){x-=w,v(T.p[A],a,u,x,r,0,s,c,h,y),u=g.c,x=g.lc;break}}if(A==T.lit)throw"hufDecode issues"}var M=8-o&7;for(u>>=M,x-=M;x>0;){var T;if(!(T=t[u<<i-x&16383]).len)throw"hufDecode issues";x-=T.len,v(T.lit,a,u,x,r,0,s,c,h,y),u=g.c,x=g.lc}}(b,A,e,0,r,y,x,l,a,{value:0})}function S(e){for(var t=1;t<e.length;t++){var r=e[t-1]+e[t]-128;e[t]=r}}function C(e,t){for(var r=0,i=Math.floor((e.length+1)/2),n=0,s=e.length-1;!(n>s||(t[n++]=e[r++],n>s));)t[n++]=e[i++]}function F(e){for(var t=e.byteLength,r=new Array,i=0,n=new DataView(e);t>0;){var s=n.getInt8(i++);if(s<0){t-=(a=-s)+1;for(var o=0;o<a;o++)r.push(n.getUint8(i++))}else{var a=s;t-=2;var l=n.getUint8(i++);for(o=0;o<a+1;o++)r.push(l)}}return r}function E(e,t,r){for(var i,n=1;n<64;)65280==(i=t[e.value])?n=64:i>>8==255?n+=255&i:(r[n]=i,n++),e.value++}function _(e,t){t[0]=Y(e[0]),t[1]=Y(e[1]),t[2]=Y(e[5]),t[3]=Y(e[6]),t[4]=Y(e[14]),t[5]=Y(e[15]),t[6]=Y(e[27]),t[7]=Y(e[28]),t[8]=Y(e[2]),t[9]=Y(e[4]),t[10]=Y(e[7]),t[11]=Y(e[13]),t[12]=Y(e[16]),t[13]=Y(e[26]),t[14]=Y(e[29]),t[15]=Y(e[42]),t[16]=Y(e[3]),t[17]=Y(e[8]),t[18]=Y(e[12]),t[19]=Y(e[17]),t[20]=Y(e[25]),t[21]=Y(e[30]),t[22]=Y(e[41]),t[23]=Y(e[43]),t[24]=Y(e[9]),t[25]=Y(e[11]),t[26]=Y(e[18]),t[27]=Y(e[24]),t[28]=Y(e[31]),t[29]=Y(e[40]),t[30]=Y(e[44]),t[31]=Y(e[53]),t[32]=Y(e[10]),t[33]=Y(e[19]),t[34]=Y(e[23]),t[35]=Y(e[32]),t[36]=Y(e[39]),t[37]=Y(e[45]),t[38]=Y(e[52]),t[39]=Y(e[54]),t[40]=Y(e[20]),t[41]=Y(e[22]),t[42]=Y(e[33]),t[43]=Y(e[38]),t[44]=Y(e[46]),t[45]=Y(e[51]),t[46]=Y(e[55]),t[47]=Y(e[60]),t[48]=Y(e[21]),t[49]=Y(e[34]),t[50]=Y(e[37]),t[51]=Y(e[47]),t[52]=Y(e[50]),t[53]=Y(e[56]),t[54]=Y(e[59]),t[55]=Y(e[61]),t[56]=Y(e[35]),t[57]=Y(e[36]),t[58]=Y(e[48]),t[59]=Y(e[49]),t[60]=Y(e[57]),t[61]=Y(e[58]),t[62]=Y(e[62]),t[63]=Y(e[63])}function P(e){const t=.5*Math.cos(.7853975),r=.5*Math.cos(3.14159/16),i=.5*Math.cos(3.14159/8),n=.5*Math.cos(3*3.14159/16),s=.5*Math.cos(.981746875),o=.5*Math.cos(3*3.14159/8),a=.5*Math.cos(1.374445625);for(var l=new Array(4),c=new Array(4),h=new Array(4),u=new Array(4),d=0;d<8;++d){var p=8*d;l[0]=i*e[p+2],l[1]=o*e[p+2],l[2]=i*e[p+6],l[3]=o*e[p+6],c[0]=r*e[p+1]+n*e[p+3]+s*e[p+5]+a*e[p+7],c[1]=n*e[p+1]-a*e[p+3]-r*e[p+5]-s*e[p+7],c[2]=s*e[p+1]-r*e[p+3]+a*e[p+5]+n*e[p+7],c[3]=a*e[p+1]-s*e[p+3]+n*e[p+5]-r*e[p+7],h[0]=t*(e[p+0]+e[p+4]),h[3]=t*(e[p+0]-e[p+4]),h[1]=l[0]+l[3],h[2]=l[1]-l[2],u[0]=h[0]+h[1],u[1]=h[3]+h[2],u[2]=h[3]-h[2],u[3]=h[0]-h[1],e[p+0]=u[0]+c[0],e[p+1]=u[1]+c[1],e[p+2]=u[2]+c[2],e[p+3]=u[3]+c[3],e[p+4]=u[3]-c[3],e[p+5]=u[2]-c[2],e[p+6]=u[1]-c[1],e[p+7]=u[0]-c[0]}for(var m=0;m<8;++m)l[0]=i*e[16+m],l[1]=o*e[16+m],l[2]=i*e[48+m],l[3]=o*e[48+m],c[0]=r*e[8+m]+n*e[24+m]+s*e[40+m]+a*e[56+m],c[1]=n*e[8+m]-a*e[24+m]-r*e[40+m]-s*e[56+m],c[2]=s*e[8+m]-r*e[24+m]+a*e[40+m]+n*e[56+m],c[3]=a*e[8+m]-s*e[24+m]+n*e[40+m]-r*e[56+m],h[0]=t*(e[m]+e[32+m]),h[3]=t*(e[m]-e[32+m]),h[1]=l[0]+l[3],h[2]=l[1]-l[2],u[0]=h[0]+h[1],u[1]=h[3]+h[2],u[2]=h[3]-h[2],u[3]=h[0]-h[1],e[0+m]=u[0]+c[0],e[8+m]=u[1]+c[1],e[16+m]=u[2]+c[2],e[24+m]=u[3]+c[3],e[32+m]=u[3]-c[3],e[40+m]=u[2]-c[2],e[48+m]=u[1]-c[1],e[56+m]=u[0]-c[0]}function B(e){for(var t=0;t<64;++t){var r=e[0][t],i=e[1][t],n=e[2][t];e[0][t]=r+1.5747*n,e[1][t]=r-.1873*i-.4682*n,e[2][t]=r+1.8556*i}}function L(t,r,i){for(var n=0;n<64;++n)r[i+n]=e.DataUtils.toHalfFloat(R(t[n]))}function R(e){return e<=1?Math.sign(e)*Math.pow(Math.abs(e),2.2):Math.sign(e)*Math.pow(a,Math.abs(e)-1)}function N(e){return new DataView(e.array.buffer,e.offset.value,e.size)}function D(e){var t=e.viewer.buffer.slice(e.offset.value,e.offset.value+e.size),r=new Uint8Array(F(t)),i=new Uint8Array(r.length);return S(r),C(r,i),new DataView(i.buffer)}function I(e){var t=e.array.slice(e.offset.value,e.offset.value+e.size),r=n.unzlibSync(t),i=new Uint8Array(r.length);return S(r),C(r,i),new DataView(i.buffer)}function U(e){for(var t=e.viewer,i={value:e.offset.value},n=new Uint16Array(e.width*e.scanlineBlockSize*(e.channels*e.type)),s=new Uint8Array(8192),o=0,a=new Array(e.channels),l=0;l<e.channels;l++)a[l]={},a[l].start=o,a[l].end=a[l].start,a[l].nx=e.width,a[l].ny=e.lines,a[l].size=e.type,o+=a[l].nx*a[l].ny*a[l].size;var c=K(t,i),h=K(t,i);if(h>=8192)throw"Something is wrong with PIZ_COMPRESSION BITMAP_SIZE";if(c<=h)for(l=0;l<h-c+1;l++)s[l+c]=j(t,i);var u=new Uint16Array(r),d=function(e,t){for(var i=0,n=0;n<r;++n)(0==n||e[n>>3]&1<<(7&n))&&(t[i++]=n);for(var s=i-1;i<r;)t[i++]=0;return s}(s,u),p=z(t,i);T(e.array,t,i,p,n,o);for(l=0;l<e.channels;++l)for(var m=a[l],f=0;f<a[l].size;++f)M(n,m.start+f,m.nx,m.size,m.ny,m.nx*m.size,d);!function(e,t,r){for(var i=0;i<r;++i)t[i]=e[t[i]]}(u,n,o);for(var g=0,v=new Uint8Array(n.buffer.byteLength),x=0;x<e.lines;x++)for(var y=0;y<e.channels;y++){var b=(m=a[y]).nx*m.size,A=new Uint8Array(n.buffer,2*m.end,2*b);v.set(A,g),g+=2*b,m.end+=b}return new DataView(v.buffer)}function O(e){var t=e.array.slice(e.offset.value,e.offset.value+e.size),r=n.unzlibSync(t);const i=e.lines*e.channels*e.width,s=1==e.type?new Uint16Array(i):new Uint32Array(i);let o=0,a=0;const l=new Array(4);for(let t=0;t<e.lines;t++)for(let t=0;t<e.channels;t++){let t=0;switch(e.type){case 1:l[0]=o,l[1]=l[0]+e.width,o=l[1]+e.width;for(let i=0;i<e.width;++i){t+=r[l[0]++]<<8|r[l[1]++],s[a]=t,a++}break;case 2:l[0]=o,l[1]=l[0]+e.width,l[2]=l[1]+e.width,o=l[2]+e.width;for(let i=0;i<e.width;++i){t+=r[l[0]++]<<24|r[l[1]++]<<16|r[l[2]++]<<8,s[a]=t,a++}}}return new DataView(s.buffer)}function k(e){var t=e.viewer,r={value:e.offset.value},i=new Uint8Array(e.width*e.lines*(e.channels*e.type*2)),s={version:W(t,r),unknownUncompressedSize:W(t,r),unknownCompressedSize:W(t,r),acCompressedSize:W(t,r),dcCompressedSize:W(t,r),rleCompressedSize:W(t,r),rleUncompressedSize:W(t,r),rleRawSize:W(t,r),totalAcUncompressedCount:W(t,r),totalDcUncompressedCount:W(t,r),acCompression:W(t,r)};if(s.version<2)throw"EXRLoader.parse: "+te.compression+" version "+s.version+" is unsupported";for(var o=new Array,a=K(t,r)-2;a>0;){var l=V(t.buffer,r),c=j(t,r),h=c>>2&3,u=new Int8Array([(c>>4)-1])[0],d=j(t,r);o.push({name:l,index:u,type:d,compression:h}),a-=l.length+3}for(var p=te.channels,m=new Array(e.channels),f=0;f<e.channels;++f){var g=m[f]={},v=p[f];g.name=v.name,g.compression=0,g.decoded=!1,g.type=v.pixelType,g.pLinear=v.pLinear,g.width=e.width,g.height=e.lines}for(var x={idx:new Array(3)},y=0;y<e.channels;++y)for(g=m[y],f=0;f<o.length;++f){var b=o[f];g.name==b.name&&(g.compression=b.compression,b.index>=0&&(x.idx[b.index]=y),g.offset=y)}if(s.acCompressedSize>0)switch(s.acCompression){case 0:var A=new Uint16Array(s.totalAcUncompressedCount);T(e.array,t,r,s.acCompressedSize,A,s.totalAcUncompressedCount);break;case 1:var w=e.array.slice(r.value,r.value+s.totalAcUncompressedCount),M=n.unzlibSync(w);A=new Uint16Array(M.buffer);r.value+=s.totalAcUncompressedCount}if(s.dcCompressedSize>0){var S={array:e.array,offset:r,size:s.dcCompressedSize},C=new Uint16Array(I(S).buffer);r.value+=s.dcCompressedSize}if(s.rleRawSize>0){w=e.array.slice(r.value,r.value+s.rleCompressedSize);var R=F((M=n.unzlibSync(w)).buffer);r.value+=s.rleCompressedSize}var N=0,D=new Array(m.length);for(f=0;f<D.length;++f)D[f]=new Array;for(var U=0;U<e.lines;++U)for(var O=0;O<m.length;++O)D[O].push(N),N+=m[O].width*e.type*2;!function(e,t,r,i,n,s){var o=new DataView(s.buffer),a=r[e.idx[0]].width,l=r[e.idx[0]].height,c=Math.floor(a/8),h=Math.ceil(a/8),u=Math.ceil(l/8),d=a-8*(h-1),p=l-8*(u-1),m={value:0},f=new Array(3),g=new Array(3),v=new Array(3),x=new Array(3),y=new Array(3);for(let r=0;r<3;++r)y[r]=t[e.idx[r]],f[r]=r<1?0:f[r-1]+h*u,g[r]=new Float32Array(64),v[r]=new Uint16Array(64),x[r]=new Uint16Array(64*h);for(let t=0;t<u;++t){var b=8;t==u-1&&(b=p);var A=8;for(let e=0;e<h;++e){e==h-1&&(A=d);for(let e=0;e<3;++e)v[e].fill(0),v[e][0]=n[f[e]++],E(m,i,v[e]),_(v[e],g[e]),P(g[e]);B(g);for(let t=0;t<3;++t)L(g[t],x[t],64*e)}let s=0;for(let i=0;i<3;++i){const n=r[e.idx[i]].type;for(let e=8*t;e<8*t+b;++e){s=y[i][e];for(let t=0;t<c;++t){const r=64*t+8*(7&e);o.setUint16(s+0*n,x[i][r+0],!0),o.setUint16(s+2*n,x[i][r+1],!0),o.setUint16(s+4*n,x[i][r+2],!0),o.setUint16(s+6*n,x[i][r+3],!0),o.setUint16(s+8*n,x[i][r+4],!0),o.setUint16(s+10*n,x[i][r+5],!0),o.setUint16(s+12*n,x[i][r+6],!0),o.setUint16(s+14*n,x[i][r+7],!0),s+=16*n}}if(c!=h)for(let e=8*t;e<8*t+b;++e){const t=y[i][e]+8*c*2*n,r=64*c+8*(7&e);for(let e=0;e<A;++e)o.setUint16(t+2*e*n,x[i][r+e],!0)}}}for(var w=new Uint16Array(a),M=(o=new DataView(s.buffer),0);M<3;++M){r[e.idx[M]].decoded=!0;var T=r[e.idx[M]].type;if(2==r[M].type)for(var S=0;S<l;++S){const e=y[M][S];for(var C=0;C<a;++C)w[C]=o.getUint16(e+2*C*T,!0);for(C=0;C<a;++C)o.setFloat32(e+2*C*T,Y(w[C]),!0)}}}(x,D,m,A,C,i);for(f=0;f<m.length;++f){if(!(g=m[f]).decoded)switch(g.compression){case 2:var k=0,G=0;for(U=0;U<e.lines;++U){for(var z=D[f][k],H=0;H<g.width;++H){for(var X=0;X<2*g.type;++X)i[z++]=R[G+X*g.width*g.height];G++}k++}break;case 1:default:throw"EXRLoader.parse: unsupported channel compression"}}return new DataView(i.buffer)}function V(e,t){for(var r=new Uint8Array(e),i=0;0!=r[t.value+i];)i+=1;var n=(new TextDecoder).decode(r.slice(t.value,t.value+i));return t.value=t.value+i+1,n}function G(e,t){var r=e.getInt32(t.value,!0);return t.value=t.value+4,r}function z(e,t){var r=e.getUint32(t.value,!0);return t.value=t.value+4,r}function H(e,t){var r=e[t.value];return t.value=t.value+1,r}function j(e,t){var r=e.getUint8(t.value);return t.value=t.value+1,r}const W=function(e,t){let r;return r="getBigInt64"in DataView.prototype?Number(e.getBigInt64(t.value,!0)):e.getUint32(t.value+4,!0)+Number(e.getUint32(t.value,!0)<<32),t.value+=8,r};function X(e,t){var r=e.getFloat32(t.value,!0);return t.value+=4,r}function Q(t,r){return e.DataUtils.toHalfFloat(X(t,r))}function Y(e){var t=(31744&e)>>10,r=1023&e;return(e>>15?-1:1)*(t?31===t?r?NaN:1/0:Math.pow(2,t-15)*(1+r/1024):r/1024*6103515625e-14)}function K(e,t){var r=e.getUint16(t.value,!0);return t.value+=2,r}function q(e,t){return Y(K(e,t))}function J(e,t,r,i,n){return"string"===i||"stringvector"===i||"iccProfile"===i?function(e,t,r){var i=(new TextDecoder).decode(new Uint8Array(e).slice(t.value,t.value+r));return t.value=t.value+r,i}(t,r,n):"chlist"===i?function(e,t,r,i){for(var n=r.value,s=[];r.value<n+i-1;){var o=V(t,r),a=G(e,r),l=j(e,r);r.value+=3;var c=G(e,r),h=G(e,r);s.push({name:o,pixelType:a,pLinear:l,xSampling:c,ySampling:h})}return r.value+=1,s}(e,t,r,n):"chromaticities"===i?function(e,t){return{redX:X(e,t),redY:X(e,t),greenX:X(e,t),greenY:X(e,t),blueX:X(e,t),blueY:X(e,t),whiteX:X(e,t),whiteY:X(e,t)}}(e,r):"compression"===i?function(e,t){return["NO_COMPRESSION","RLE_COMPRESSION","ZIPS_COMPRESSION","ZIP_COMPRESSION","PIZ_COMPRESSION","PXR24_COMPRESSION","B44_COMPRESSION","B44A_COMPRESSION","DWAA_COMPRESSION","DWAB_COMPRESSION"][j(e,t)]}(e,r):"box2i"===i?function(e,t){return{xMin:z(e,t),yMin:z(e,t),xMax:z(e,t),yMax:z(e,t)}}(e,r):"lineOrder"===i?function(e,t){return["INCREASING_Y"][j(e,t)]}(e,r):"float"===i?X(e,r):"v2f"===i?function(e,t){return[X(e,t),X(e,t)]}(e,r):"v3f"===i?function(e,t){return[X(e,t),X(e,t),X(e,t)]}(e,r):"int"===i?G(e,r):"rational"===i?function(e,t){return[G(e,t),z(e,t)]}(e,r):"timecode"===i?function(e,t){return[z(e,t),z(e,t)]}(e,r):"preview"===i?(r.value+=n,"skipped"):void(r.value+=n)}const Z=new DataView(t),$=new Uint8Array(t),ee={value:0},te=function(e,t,r){const i={};if(20000630!=e.getUint32(0,!0))throw"THREE.EXRLoader: provided file doesn't appear to be in OpenEXR format.";i.version=e.getUint8(4);const n=e.getUint8(5);i.spec={singleTile:!!(2&n),longName:!!(4&n),deepFormat:!!(8&n),multiPart:!!(16&n)},r.value=8;for(var s=!0;s;){var o=V(t,r);if(0==o)s=!1;else{var a=V(t,r),l=J(e,t,r,a,z(e,r));void 0===l?console.warn(`EXRLoader.parse: skipped unknown header attribute type '${a}'.`):i[o]=l}}if(0!=n)throw console.error("EXRHeader:",i),"THREE.EXRLoader: provided file is currently unsupported.";return i}(Z,t,ee),re=function(t,r,i,n,s){const o={size:0,viewer:r,array:i,offset:n,width:t.dataWindow.xMax-t.dataWindow.xMin+1,height:t.dataWindow.yMax-t.dataWindow.yMin+1,channels:t.channels.length,bytesPerLine:null,lines:null,inputSize:null,type:t.channels[0].pixelType,uncompress:null,getter:null,format:null,encoding:null};switch(t.compression){case"NO_COMPRESSION":o.lines=1,o.uncompress=N;break;case"RLE_COMPRESSION":o.lines=1,o.uncompress=D;break;case"ZIPS_COMPRESSION":o.lines=1,o.uncompress=I;break;case"ZIP_COMPRESSION":o.lines=16,o.uncompress=I;break;case"PIZ_COMPRESSION":o.lines=32,o.uncompress=U;break;case"PXR24_COMPRESSION":o.lines=16,o.uncompress=O;break;case"DWAA_COMPRESSION":o.lines=32,o.uncompress=k;break;case"DWAB_COMPRESSION":o.lines=256,o.uncompress=k;break;default:throw"EXRLoader.parse: "+t.compression+" is unsupported"}if(o.scanlineBlockSize=o.lines,1==o.type)switch(s){case e.FloatType:o.getter=q,o.inputSize=2;break;case e.HalfFloatType:o.getter=K,o.inputSize=2}else{if(2!=o.type)throw"EXRLoader.parse: unsupported pixelType "+o.type+" for "+t.compression+".";switch(s){case e.FloatType:o.getter=X,o.inputSize=4;break;case e.HalfFloatType:o.getter=Q,o.inputSize=4}}o.blockCount=(t.dataWindow.yMax+1)/o.scanlineBlockSize;for(var a=0;a<o.blockCount;a++)W(r,n);o.outputChannels=3==o.channels?4:o.channels;const l=o.width*o.height*o.outputChannels;switch(s){case e.FloatType:o.byteArray=new Float32Array(l),o.channels<o.outputChannels&&o.byteArray.fill(1,0,l);break;case e.HalfFloatType:o.byteArray=new Uint16Array(l),o.channels<o.outputChannels&&o.byteArray.fill(15360,0,l);break;default:console.error("THREE.EXRLoader: unsupported type: ",s)}return o.bytesPerLine=o.width*o.inputSize*o.channels,4==o.outputChannels?(o.format=e.RGBAFormat,o.encoding=3e3):(o.format=e.RedFormat,o.encoding=3e3),o}(te,Z,$,ee,this.type),ie={value:0},ne={R:0,G:1,B:2,A:3,Y:0};for(let e=0;e<re.height/re.scanlineBlockSize;e++){const t=z(Z,ee);re.size=z(Z,ee),re.lines=t+re.scanlineBlockSize>re.height?re.height-t:re.scanlineBlockSize;const r=re.size<re.lines*re.bytesPerLine?re.uncompress(re):N(re);ee.value+=re.size;for(let t=0;t<re.scanlineBlockSize;t++){const i=t+e*re.scanlineBlockSize;if(i>=re.height)break;for(let e=0;e<re.channels;e++){const n=ne[te.channels[e].name];for(let s=0;s<re.width;s++){ie.value=(t*(re.channels*re.width)+e*re.width+s)*re.inputSize;const o=(re.height-1-i)*(re.width*re.outputChannels)+s*re.outputChannels+n;re.byteArray[o]=re.getter(r,ie)}}}}return{header:te,width:re.width,height:re.height,data:re.byteArray,format:re.format,encoding:re.encoding,type:this.type}}setDataType(e){return this.type=e,this}load(t,r,i,n){return super.load(t,(function(t,i){"colorSpace"in t?t.colorSpace=3001===i.encoding?"srgb":"srgb-linear":t.encoding=i.encoding,t.minFilter=e.LinearFilter,t.magFilter=e.LinearFilter,t.generateMipmaps=!1,t.flipY=!1,r&&r(t,i)}),i,n)}}class Fd extends e.Loader{constructor(e){super(e),this.availableExtensions=[]}load(t,r,i,n){const s=this,o=new e.FileLoader(s.manager);o.setPath(s.path),o.setResponseType("arraybuffer"),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(t,(function(e){try{r(s.parse(e))}catch(e){n?n(e):console.error(e),s.manager.itemError(t)}}),i,n)}parse(t){const r=this,i=new e.TextureLoader(this.manager);function s(e){const t=[],r=(new DOMParser).parseFromString(e,"application/xml").querySelectorAll("Relationship");for(let e=0;e<r.length;e++){const i=r[e],n={target:i.getAttribute("Target"),id:i.getAttribute("Id"),type:i.getAttribute("Type")};t.push(n)}return t}function o(e){const t={id:e.getAttribute("id"),basematerials:[]},r=e.querySelectorAll("base");for(let e=0;e<r.length;e++){const i=h(r[e]);i.index=e,t.basematerials.push(i)}return t}function a(e){const t={id:e.getAttribute("id"),texid:e.getAttribute("texid"),displaypropertiesid:e.getAttribute("displaypropertiesid")},r=e.querySelectorAll("tex2coord"),i=[];for(let e=0;e<r.length;e++){const t=r[e],n=t.getAttribute("u"),s=t.getAttribute("v");i.push(parseFloat(n),parseFloat(s))}return t.uvs=new Float32Array(i),t}function l(t){const r={id:t.getAttribute("id"),displaypropertiesid:t.getAttribute("displaypropertiesid")},i=t.querySelectorAll("color"),n=[],s=new e.Color;for(let e=0;e<i.length;e++){const t=i[e].getAttribute("color");s.setStyle(t.substring(0,7)),s.convertSRGBToLinear(),n.push(s.r,s.g,s.b)}return r.colors=new Float32Array(n),r}function c(e){const t={id:e.getAttribute("id")},r=e.querySelectorAll("pbmetallic"),i=[];for(let e=0;e<r.length;e++){const t=r[e];i.push({name:t.getAttribute("name"),metallicness:parseFloat(t.getAttribute("metallicness")),roughness:parseFloat(t.getAttribute("roughness"))})}return t.data=i,t}function h(e){const t={};return t.name=e.getAttribute("name"),t.displaycolor=e.getAttribute("displaycolor"),t.displaypropertiesid=e.getAttribute("displaypropertiesid"),t}function u(e){const t={};t.objectId=e.getAttribute("objectid");const r=e.getAttribute("transform");return r&&(t.transform=d(r)),t}function d(t){const r=[];t.split(" ").forEach((function(e){r.push(parseFloat(e))}));const i=new e.Matrix4;return i.set(r[0],r[3],r[6],r[9],r[1],r[4],r[7],r[10],r[2],r[5],r[8],r[11],0,0,0,1),i}function p(e){const t={type:e.getAttribute("type")},r=e.getAttribute("id");r&&(t.id=r);const i=e.getAttribute("pid");i&&(t.pid=i);const n=e.getAttribute("pindex");n&&(t.pindex=n);const s=e.getAttribute("thumbnail");s&&(t.thumbnail=s);const o=e.getAttribute("partnumber");o&&(t.partnumber=o);const a=e.getAttribute("name");a&&(t.name=a);const l=e.querySelector("mesh");l&&(t.mesh=function(e){const t={},r=[],i=e.querySelectorAll("vertices vertex");for(let e=0;e<i.length;e++){const t=i[e],n=t.getAttribute("x"),s=t.getAttribute("y"),o=t.getAttribute("z");r.push(parseFloat(n),parseFloat(s),parseFloat(o))}t.vertices=new Float32Array(r);const n=[],s=[],o=e.querySelectorAll("triangles triangle");for(let e=0;e<o.length;e++){const t=o[e],r=t.getAttribute("v1"),i=t.getAttribute("v2"),a=t.getAttribute("v3"),l=t.getAttribute("p1"),c=t.getAttribute("p2"),h=t.getAttribute("p3"),u=t.getAttribute("pid"),d={};d.v1=parseInt(r,10),d.v2=parseInt(i,10),d.v3=parseInt(a,10),s.push(d.v1,d.v2,d.v3),l&&(d.p1=parseInt(l,10)),c&&(d.p2=parseInt(c,10)),h&&(d.p3=parseInt(h,10)),u&&(d.pid=u),0<Object.keys(d).length&&n.push(d)}return t.triangleProperties=n,t.triangles=new Uint32Array(s),t}(l));const c=e.querySelector("components");return c&&(t.components=function(e){const t=[],r=e.querySelectorAll("component");for(let e=0;e<r.length;e++){const i=u(r[e]);t.push(i)}return t}(c)),t}function m(e){const t={unit:e.getAttribute("unit")||"millimeter"},r=e.querySelectorAll("metadata");r&&(t.metadata=function(e){const t={};for(let r=0;r<e.length;r++){const i=e[r],n=i.getAttribute("name");0<=["Title","Designer","Description","Copyright","LicenseTerms","Rating","CreationDate","ModificationDate"].indexOf(n)&&(t[n]=i.textContent)}return t}(r));const i=e.querySelector("resources");i&&(t.resources=function(e){const t={basematerials:{}},r=e.querySelectorAll("basematerials");for(let e=0;e<r.length;e++){const i=o(r[e]);t.basematerials[i.id]=i}t.texture2d={};const i=e.querySelectorAll("texture2d");for(let e=0;e<i.length;e++){const r={id:(n=i[e]).getAttribute("id"),path:n.getAttribute("path"),contenttype:n.getAttribute("contenttype"),tilestyleu:n.getAttribute("tilestyleu"),tilestylev:n.getAttribute("tilestylev"),filter:n.getAttribute("filter")};t.texture2d[r.id]=r}var n;t.colorgroup={};const s=e.querySelectorAll("colorgroup");for(let e=0;e<s.length;e++){const r=l(s[e]);t.colorgroup[r.id]=r}t.pbmetallicdisplayproperties={};const h=e.querySelectorAll("pbmetallicdisplayproperties");for(let e=0;e<h.length;e++){const r=c(h[e]);t.pbmetallicdisplayproperties[r.id]=r}t.texture2dgroup={};const u=e.querySelectorAll("texture2dgroup");for(let e=0;e<u.length;e++){const r=a(u[e]);t.texture2dgroup[r.id]=r}t.object={};const d=e.querySelectorAll("object");for(let e=0;e<d.length;e++){const r=p(d[e]);t.object[r.id]=r}return t}(i));const n=e.querySelector("build");return n&&(t.build=function(e){const t=[],r=e.querySelectorAll("item");for(let e=0;e<r.length;e++){const i=r[e],n={objectId:i.getAttribute("objectid")},s=i.getAttribute("transform");s&&(n.transform=d(s)),t.push(n)}return t}(n)),t}function f(t,r,n,s){const o=t.texid,a=n.resources.texture2d[o];if(a){const t=s[a.path],r=a.contenttype,n=new Blob([t],{type:r}),o=URL.createObjectURL(n),l=i.load(o,(function(){URL.revokeObjectURL(o)}));switch("colorSpace"in l?l.colorSpace="srgb":l.encoding=3001,a.tilestyleu){case"wrap":l.wrapS=e.RepeatWrapping;break;case"mirror":l.wrapS=e.MirroredRepeatWrapping;break;case"none":case"clamp":l.wrapS=e.ClampToEdgeWrapping;break;default:l.wrapS=e.RepeatWrapping}switch(a.tilestylev){case"wrap":l.wrapT=e.RepeatWrapping;break;case"mirror":l.wrapT=e.MirroredRepeatWrapping;break;case"none":case"clamp":l.wrapT=e.ClampToEdgeWrapping;break;default:l.wrapT=e.RepeatWrapping}switch(a.filter){case"auto":l.magFilter=e.LinearFilter,l.minFilter=e.LinearMipmapLinearFilter;break;case"linear":l.magFilter=e.LinearFilter,l.minFilter=e.LinearFilter;break;case"nearest":l.magFilter=e.NearestFilter,l.minFilter=e.NearestFilter;break;default:l.magFilter=e.LinearFilter,l.minFilter=e.LinearMipmapLinearFilter}return l}return null}function g(t,r,i,n,s,o,a){const l=a.pindex,c={};for(let e=0,t=r.length;e<t;e++){const t=r[e],i=void 0!==t.p1?t.p1:l;void 0===c[i]&&(c[i]=[]),c[i].push(t)}const h=Object.keys(c),u=[];for(let r=0,l=h.length;r<l;r++){const l=h[r],d=c[l],p=w(t.basematerials[l],n,s,o,a,M),m=new e.BufferGeometry,f=[],g=i.vertices;for(let e=0,t=d.length;e<t;e++){const t=d[e];f.push(g[3*t.v1+0]),f.push(g[3*t.v1+1]),f.push(g[3*t.v1+2]),f.push(g[3*t.v2+0]),f.push(g[3*t.v2+1]),f.push(g[3*t.v2+2]),f.push(g[3*t.v3+0]),f.push(g[3*t.v3+1]),f.push(g[3*t.v3+2])}m.setAttribute("position",new e.Float32BufferAttribute(f,3));const v=new e.Mesh(m,p);u.push(v)}return u}function v(t,r,i,n,s,o,a){const l=new e.BufferGeometry,c=[],h=[],u=i.vertices,d=t.uvs;for(let e=0,t=r.length;e<t;e++){const t=r[e];c.push(u[3*t.v1+0]),c.push(u[3*t.v1+1]),c.push(u[3*t.v1+2]),c.push(u[3*t.v2+0]),c.push(u[3*t.v2+1]),c.push(u[3*t.v2+2]),c.push(u[3*t.v3+0]),c.push(u[3*t.v3+1]),c.push(u[3*t.v3+2]),h.push(d[2*t.p1+0]),h.push(d[2*t.p1+1]),h.push(d[2*t.p2+0]),h.push(d[2*t.p2+1]),h.push(d[2*t.p3+0]),h.push(d[2*t.p3+1])}l.setAttribute("position",new e.Float32BufferAttribute(c,3)),l.setAttribute("uv",new e.Float32BufferAttribute(h,2));const p=w(t,n,s,o,a,f),m=new e.MeshPhongMaterial({map:p,flatShading:!0});return new e.Mesh(l,m)}function x(t,r,i,n,s,o){const a=new e.BufferGeometry,l=[],c=[],h=i.vertices,u=t.colors;for(let e=0,t=r.length;e<t;e++){const t=r[e],i=t.v1,n=t.v2,s=t.v3;l.push(h[3*i+0]),l.push(h[3*i+1]),l.push(h[3*i+2]),l.push(h[3*n+0]),l.push(h[3*n+1]),l.push(h[3*n+2]),l.push(h[3*s+0]),l.push(h[3*s+1]),l.push(h[3*s+2]);const a=void 0!==t.p1?t.p1:o.pindex,d=void 0!==t.p2?t.p2:a,p=void 0!==t.p3?t.p3:a;c.push(u[3*a+0]),c.push(u[3*a+1]),c.push(u[3*a+2]),c.push(u[3*d+0]),c.push(u[3*d+1]),c.push(u[3*d+2]),c.push(u[3*p+0]),c.push(u[3*p+1]),c.push(u[3*p+2])}a.setAttribute("position",new e.Float32BufferAttribute(l,3)),a.setAttribute("color",new e.Float32BufferAttribute(c,3));const d=new e.MeshPhongMaterial({vertexColors:!0,flatShading:!0});return new e.Mesh(a,d)}function y(t){const r=new e.BufferGeometry;r.setIndex(new e.BufferAttribute(t.triangles,1)),r.setAttribute("position",new e.BufferAttribute(t.vertices,3));const i=new e.MeshPhongMaterial({color:11184895,flatShading:!0});return new e.Mesh(r,i)}function b(e,t){return void 0!==t.resources.texture2dgroup[e]?"texture":void 0!==t.resources.basematerials[e]?"material":void 0!==t.resources.colorgroup[e]?"vertexColors":"default"===e?"default":void 0}function A(t,r,i,n,s){const o=new e.Group,a=function(e,t,r,i,n,s){const o=Object.keys(e),a=[];for(let l=0,c=o.length;l<c;l++){const c=o[l],h=e[c];switch(b(c,i)){case"material":const e=g(i.resources.basematerials[c],h,t,r,i,n,s);for(let t=0,r=e.length;t<r;t++)a.push(e[t]);break;case"texture":const o=i.resources.texture2dgroup[c];a.push(v(o,h,t,r,i,n,s));break;case"vertexColors":const l=i.resources.colorgroup[c];a.push(x(l,h,t,0,0,s));break;case"default":a.push(y(t));break;default:console.error("THREE.3MFLoader: Unsupported resource type.")}}return a}(function(e,t,r){const i={},n=t.triangleProperties,s=r.pid;for(let e=0,t=n.length;e<t;e++){const t=n[e];let r=void 0!==t.pid?t.pid:s;void 0===r&&(r="default"),void 0===i[r]&&(i[r]=[]),i[r].push(t)}return i}(0,t,s),t,r,i,n,s);for(let e=0,t=a.length;e<t;e++)o.add(a[e]);return o}function w(e,t,r,i,n,s){return void 0!==e.build||(e.build=s(e,t,r,i,n)),e.build}function M(t,r,i){let n;const s=t.displaypropertiesid,o=i.resources.pbmetallicdisplayproperties;if(null!==s&&void 0!==o[s]){const r=o[s].data[t.index];n=new e.MeshStandardMaterial({flatShading:!0,roughness:r.roughness,metalness:r.metallicness})}else n=new e.MeshPhongMaterial({flatShading:!0});n.name=t.name;const a=t.displaycolor,l=a.substring(0,7);return n.color.setStyle(l),n.color.convertSRGBToLinear(),9===a.length&&(n.opacity=parseInt(a.charAt(7)+a.charAt(8),16)/255),n}function T(t,r,i,n){const s=new e.Group;for(let e=0;e<t.length;e++){const o=t[e];let a=r[o.objectId];void 0===a&&(S(o.objectId,r,i,n),a=r[o.objectId]);const l=a.clone(),c=o.transform;c&&l.applyMatrix4(c),s.add(l)}return s}function S(e,t,i,n){const s=i.resources.object[e];if(s.mesh){const e=s.mesh;!function(e,t,i){if(!e)return;const n=[],s=Object.keys(e);for(let e=0;e<s.length;e++){const t=s[e];for(let e=0;e<r.availableExtensions.length;e++){const i=r.availableExtensions[e];i.ns===t&&n.push(i)}}for(let r=0;r<n.length;r++){const s=n[r];s.apply(i,e[s.ns],t)}}(i.extensions,e,i.xml),t[s.id]=w(e,t,i,n,s,A)}else{const e=s.components;t[s.id]=w(e,t,i,n,s,T)}}const C=function(t){let r,i,o=null,a=null;const l=[],c=[];let h;const u={},d={};try{o=n.unzipSync(new Uint8Array(t))}catch(e){if(e instanceof ReferenceError)return console.error("THREE.3MFLoader: fflate missing and file is compressed."),null}for(a in o)a.match(/\_rels\/.rels$/)?r=a:a.match(/3D\/_rels\/.*\.model\.rels$/)?i=a:a.match(/^3D\/.*\.model$/)?l.push(a):a.match(/^3D\/Metadata\/.*\.xml$/)||(a.match(/^3D\/Textures?\/.*/)?c.push(a):a.match(/^3D\/Other\/.*/));const p=o[r],f=s(e.LoaderUtils.decodeText(p));if(i){const t=o[i];h=s(e.LoaderUtils.decodeText(t))}for(let t=0;t<l.length;t++){const r=l[t],i=o[r],n=e.LoaderUtils.decodeText(i),s=(new DOMParser).parseFromString(n,"application/xml");"model"!==s.documentElement.nodeName.toLowerCase()&&console.error("THREE.3MFLoader: Error loading 3MF - no 3MF document found: ",r);const a=s.querySelector("model"),c={};for(let e=0;e<a.attributes.length;e++){const t=a.attributes[e];t.name.match(/^xmlns:(.+)$/)&&(c[t.value]=RegExp.$1)}const h=m(a);h.xml=a,0<Object.keys(c).length&&(h.extensions=c),u[r]=h}for(let e=0;e<c.length;e++){const t=c[e];d[t]=o[t].buffer}return{rels:f,modelRels:h,model:u,printTicket:{},texture:d,other:{}}}(t);return function(t,r){const i=new e.Group,n=function(e){for(let t=0;t<e.length;t++){const r=e[t];if("model"===r.target.split(".").pop().toLowerCase())return r}}(r.rels),s=r.model[n.target.substring(1)].build;for(let e=0;e<s.length;e++){const r=s[e],n=t[r.objectId],o=r.transform;o&&n.applyMatrix4(o),i.add(n)}return i}(function(e){const t=e.model,r=e.modelRels,i={},n=Object.keys(t),s={};if(r)for(let t=0,i=r.length;t<i;t++){const i=r[t],n=i.target.substring(1);e.texture[n]&&(s[i.target]=e.texture[n])}for(let e=0;e<n.length;e++){const r=t[n[e]],o=Object.keys(r.resources.object);for(let e=0;e<o.length;e++){S(o[e],i,r,s)}}return i}(C),C)}addExtension(e){this.availableExtensions.push(e)}}class Ed extends e.Loader{load(t,r,i,n){const s=this,o=new e.FileLoader(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,(function(e){try{r(s.parse(e))}catch(e){n?n(e):console.error(e),s.manager.itemError(t)}}),i,n)}parse(t){const r=t.split("\n"),i=[],n=[];for(let e of r){if(e=e.trim(),"#"===e.charAt(0))continue;const t=e.split(/\s+/);3===t.length&&(i.push(parseFloat(t[0])),i.push(parseFloat(t[1])),i.push(parseFloat(t[2]))),6===t.length&&(i.push(parseFloat(t[0])),i.push(parseFloat(t[1])),i.push(parseFloat(t[2])),n.push(parseFloat(t[3])/255),n.push(parseFloat(t[4])/255),n.push(parseFloat(t[5])/255))}const s=new e.BufferGeometry;return s.setAttribute("position",new e.Float32BufferAttribute(i,3)),n.length>0&&s.setAttribute("color",new e.Float32BufferAttribute(n,3)),s}}class _d extends e.Loader{constructor(e){super(e)}load(t,r,i,n){const s=this,o=new e.FileLoader(s.manager);o.setPath(s.path),o.setResponseType("arraybuffer"),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(t,(function(e){try{r(s.parse(e))}catch(e){n?n(e):console.error(e),s.manager.itemError(t)}}),i,n)}parse(t){function r(e,t){const r=e.length,i=new Float32Array(r+t.length);return i.set(e),i.set(t,r),i}var i=e.LoaderUtils.decodeText(new Uint8Array(t,0,250)).split("\n");return-1!==i[0].indexOf("xml")?function(t){function i(e){var t,r,i,n,s,o,a="undefined"!=typeof Uint8Array?Uint8Array:Array,l=[],c=[],h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=h.length;for(t=0;t<u;t++)l[t]=h[t];for(t=0;t<u;++t)c[h.charCodeAt(t)]=t;if(c["-".charCodeAt(0)]=62,c["_".charCodeAt(0)]=63,(u=e.length)%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o=new a(3*u/4-(s="="===e[u-2]?2:"="===e[u-1]?1:0)),i=s>0?u-4:u;var d=0;for(t=0,r=0;t<i;t+=4,r+=3)n=c[e.charCodeAt(t)]<<18|c[e.charCodeAt(t+1)]<<12|c[e.charCodeAt(t+2)]<<6|c[e.charCodeAt(t+3)],o[d++]=(16711680&n)>>16,o[d++]=(65280&n)>>8,o[d++]=255&n;return 2===s?(n=c[e.charCodeAt(t)]<<2|c[e.charCodeAt(t+1)]>>4,o[d++]=255&n):1===s&&(n=c[e.charCodeAt(t)]<<10|c[e.charCodeAt(t+1)]<<4|c[e.charCodeAt(t+2)]>>2,o[d++]=n>>8&255,o[d++]=255&n),o}function s(e,t){var s,o,l,c,h=0;if("UInt64"===a.attributes.header_type?h=8:"UInt32"===a.attributes.header_type&&(h=4),"binary"===e.attributes.format&&t){var u,d,p,m,f,g;if("Float32"===e.attributes.type)var v=new Float32Array;else"Int64"===e.attributes.type&&(v=new Int32Array);d=(u=i(e["#text"]))[0];for(var x=1;x<h-1;x++)d|=u[x]<<x*h;for(m=(d+3)*h,g=m+=m%3>0?3-m%3:0,(f=[]).push(g),p=3*h,x=0;x<d;x++){for(var y=u[x*h+p],b=1;b<h-1;b++)y|=u[x*h+p+b]<<8*b;g+=y,f.push(g)}for(x=0;x<f.length-1;x++)A=n.unzlibSync(u.slice(f[x],f[x+1])).buffer,"Float32"===e.attributes.type?v=r(v,A=new Float32Array(A)):"Int64"===e.attributes.type&&(o=A=new Int32Array(A),l=void 0,c=void 0,l=(s=v).length,(c=new Int32Array(l+o.length)).set(s),c.set(o,l),v=c);delete e["#text"],"Int64"===e.attributes.type&&"binary"===e.attributes.format&&(v=v.filter((function(e,t){if(t%2!=1)return!0})))}else{if("binary"!==e.attributes.format||t)if(e["#text"])var A=e["#text"].split(/\s+/).filter((function(e){if(""!==e)return e}));else A=new Int32Array(0).buffer;else A=(A=i(e["#text"])).slice(h).buffer;delete e["#text"],"Float32"===e.attributes.type?v=new Float32Array(A):"Int32"===e.attributes.type?v=new Int32Array(A):"Int64"===e.attributes.type&&(v=new Int32Array(A),"binary"===e.attributes.format&&(v=v.filter((function(e,t){if(t%2!=1)return!0}))))}return v}var o=null;if(window.DOMParser)try{o=(new DOMParser).parseFromString(t,"text/xml")}catch(e){o=null}else{if(!window.ActiveXObject)throw new Error("Cannot parse xml string!");try{if((o=new ActiveXObject("Microsoft.XMLDOM")).async=!1,!o.loadXML())throw new Error(o.parseError.reason+o.parseError.srcText)}catch(e){o=null}}var a=function e(t){var r={};if(1===t.nodeType){if(t.attributes&&t.attributes.length>0){r.attributes={};for(var i=0;i<t.attributes.length;i++){var n=t.attributes.item(i);r.attributes[n.nodeName]=n.nodeValue.trim()}}}else 3===t.nodeType&&(r=t.nodeValue.trim());if(t.hasChildNodes())for(var s=0;s<t.childNodes.length;s++){var o=t.childNodes.item(s),a=o.nodeName;if(void 0===r[a])""!==(c=e(o))&&(r[a]=c);else{if(void 0===r[a].push){var l=r[a];r[a]=[l]}var c;""!==(c=e(o))&&r[a].push(c)}}return r}(o.documentElement),l=[],c=[],h=[];if(a.PolyData){for(var u=a.PolyData.Piece,d=a.attributes.hasOwnProperty("compressor"),p=["PointData","Points","Strips","Polys"],m=0,f=p.length;m<f;){var g=u[p[m]];if(g&&g.DataArray){if("[object Array]"===Object.prototype.toString.call(g.DataArray))var v=g.DataArray;else v=[g.DataArray];for(var x=0,y=v.length;x<y;)"#text"in v[x]&&v[x]["#text"].length>0&&(v[x].text=s(v[x],d)),x++;switch(p[m]){case"PointData":var b=parseInt(u.attributes.NumberOfPoints),A=g.attributes.Normals;if(b>0)for(var w=0,M=v.length;w<M;w++)if(A===v[w].attributes.Name){var T=v[w].attributes.NumberOfComponents;(c=new Float32Array(b*T)).set(v[w].text,0)}break;case"Points":(b=parseInt(u.attributes.NumberOfPoints))>0&&(T=g.DataArray.attributes.NumberOfComponents,(l=new Float32Array(b*T)).set(g.DataArray.text,0));break;case"Strips":var S=parseInt(u.attributes.NumberOfStrips);if(S>0){var C=new Int32Array(g.DataArray[0].text.length),F=new Int32Array(g.DataArray[1].text.length);C.set(g.DataArray[0].text,0),F.set(g.DataArray[1].text,0);var E=S+C.length;h=new Uint32Array(3*E-9*S);var _=0;for(w=0,M=S;w<M;w++){for(var P=[],B=0,L=F[w],R=0;B<L-R;B++)P.push(C[B]),w>0&&(R=F[w-1]);var N=0;for(L=F[w],R=0;N<L-R-2;N++)N%2?(h[_++]=P[N],h[_++]=P[N+2],h[_++]=P[N+1]):(h[_++]=P[N],h[_++]=P[N+1],h[_++]=P[N+2]),w>0&&(R=F[w-1])}}break;case"Polys":var D=parseInt(u.attributes.NumberOfPolys);if(D>0){C=new Int32Array(g.DataArray[0].text.length),F=new Int32Array(g.DataArray[1].text.length),C.set(g.DataArray[0].text,0),F.set(g.DataArray[1].text,0),E=D+C.length,h=new Uint32Array(3*E-9*D),_=0;var I=0;for(w=0,M=D,R=0;w<M;){var U=[];for(B=0,L=F[w];B<L-R;)U.push(C[I++]),B++;for(N=1;N<L-R-1;)h[_++]=U[0],h[_++]=U[N],h[_++]=U[N+1],N++;R=F[++w-1]}}}}m++}var O=new e.BufferGeometry;return O.setIndex(new e.BufferAttribute(h,1)),O.setAttribute("position",new e.BufferAttribute(l,3)),c.length===l.length&&O.setAttribute("normal",new e.BufferAttribute(c,3)),O}throw new Error("Unsupported DATASET type")}(e.LoaderUtils.decodeText(t)):i[2].includes("ASCII")?function(t){var r,i=[],n=[],s=[],o=[],a=/^[^\d.\s-]+/,l=/(\-?\d+\.?[\d\-\+e]*)\s+(\-?\d+\.?[\d\-\+e]*)\s+(\-?\d+\.?[\d\-\+e]*)/g,c=/^(\d+)\s+([\s\d]*)/,h=/^POINTS /,u=/^POLYGONS /,d=/^TRIANGLE_STRIPS /,p=/^POINT_DATA[ ]+(\d+)/,m=/^CELL_DATA[ ]+(\d+)/,f=/^COLOR_SCALARS[ ]+(\w+)[ ]+3/,g=/^NORMALS[ ]+(\w+)[ ]+(\w+)/,v=!1,x=!1,y=!1,b=!1,A=!1,w=!1,M=!1,T=t.split("\n");for(var S in T){var C=T[S].trim();if(0===C.indexOf("DATASET")){var F=C.split(" ")[1];if("POLYDATA"!==F)throw new Error("Unsupported DATASET type: "+F)}else if(v)for(;null!==(r=l.exec(C))&&null===a.exec(C);){var E=parseFloat(r[1]),_=parseFloat(r[2]),P=parseFloat(r[3]);n.push(E,_,P)}else if(x){if(null!==(r=c.exec(C))){var B=parseInt(r[1]),L=r[2].split(/\s+/);if(B>=3)for(var R=parseInt(L[0]),N=1,D=0;D<B-2;++D)I=parseInt(L[N]),U=parseInt(L[N+1]),i.push(R,I,U),N++}}else if(y){if(null!==(r=c.exec(C))){var I,U;if(B=parseInt(r[1]),L=r[2].split(/\s+/),B>=3)for(D=0;D<B-2;D++)D%2==1?(R=parseInt(L[D]),I=parseInt(L[D+2]),U=parseInt(L[D+1]),i.push(R,I,U)):(R=parseInt(L[D]),I=parseInt(L[D+1]),U=parseInt(L[D+2]),i.push(R,I,U))}}else if(b||A)if(w)for(;null!==(r=l.exec(C))&&null===a.exec(C);){var O=parseFloat(r[1]),k=parseFloat(r[2]),V=parseFloat(r[3]);s.push(O,k,V)}else if(M)for(;null!==(r=l.exec(C))&&null===a.exec(C);){var G=parseFloat(r[1]),z=parseFloat(r[2]),H=parseFloat(r[3]);o.push(G,z,H)}null!==u.exec(C)?(x=!0,v=!1,y=!1):null!==h.exec(C)?(x=!1,v=!0,y=!1):null!==d.exec(C)?(x=!1,v=!1,y=!0):null!==p.exec(C)?(b=!0,v=!1,x=!1,y=!1):null!==m.exec(C)?(A=!0,v=!1,x=!1,y=!1):null!==f.exec(C)?(w=!0,M=!1,v=!1,x=!1,y=!1):null!==g.exec(C)&&(M=!0,w=!1,v=!1,x=!1,y=!1)}var j=new e.BufferGeometry;if(j.setIndex(i),j.setAttribute("position",new e.Float32BufferAttribute(n,3)),o.length===n.length&&j.setAttribute("normal",new e.Float32BufferAttribute(o,3)),s.length!==i.length)s.length===n.length&&j.setAttribute("color",new e.Float32BufferAttribute(s,3));else{var W=(j=j.toNonIndexed()).attributes.position.count/3;if(s.length===3*W){var X=[];for(S=0;S<W;S++)O=s[3*S+0],k=s[3*S+1],V=s[3*S+2],X.push(O,k,V),X.push(O,k,V),X.push(O,k,V);j.setAttribute("color",new e.Float32BufferAttribute(X,3))}}return j}(e.LoaderUtils.decodeText(t)):function(t){var r,i,n,s,o,a,l,c=new Uint8Array(t),h=new DataView(t),u=[],d=[],p=[],m=0;function f(e,t){for(var r=t,i=e[r],n=[];10!==i;)n.push(String.fromCharCode(i)),i=e[++r];return{start:t,end:r,next:r+1,parsedString:n.join("")}}for(;;){if(0===(l=(a=f(c,m)).parsedString).indexOf("DATASET")){var g=l.split(" ")[1];if("POLYDATA"!==g)throw new Error("Unsupported DATASET type: "+g)}else if(0===l.indexOf("POINTS")){for(r=4*(s=parseInt(l.split(" ")[1],10))*3,u=new Float32Array(3*s),i=a.next,n=0;n<s;n++)u[3*n]=h.getFloat32(i,!1),u[3*n+1]=h.getFloat32(i+4,!1),u[3*n+2]=h.getFloat32(i+8,!1),i+=12;a.next=a.next+r+1}else if(0===l.indexOf("TRIANGLE_STRIPS")){var v=parseInt(l.split(" ")[1],10);r=4*(w=parseInt(l.split(" ")[2],10)),p=new Uint32Array(3*w-9*v);var x=0;for(i=a.next,n=0;n<v;n++){var y=h.getInt32(i,!1),b=[];for(i+=4,o=0;o<y;o++)b.push(h.getInt32(i,!1)),i+=4;for(var A=0;A<y-2;A++)A%2?(p[x++]=b[A],p[x++]=b[A+2],p[x++]=b[A+1]):(p[x++]=b[A],p[x++]=b[A+1],p[x++]=b[A+2])}a.next=a.next+r+1}else if(0===l.indexOf("POLYGONS")){var w;for(v=parseInt(l.split(" ")[1],10),r=4*(w=parseInt(l.split(" ")[2],10)),p=new Uint32Array(3*w-9*v),x=0,i=a.next,n=0;n<v;n++){for(y=h.getInt32(i,!1),b=[],i+=4,o=0;o<y;o++)b.push(h.getInt32(i,!1)),i+=4;for(A=1;A<y-1;A++)p[x++]=b[0],p[x++]=b[A],p[x++]=b[A+1]}a.next=a.next+r+1}else if(0===l.indexOf("POINT_DATA")){for(s=parseInt(l.split(" ")[1],10),a=f(c,a.next),r=4*s*3,d=new Float32Array(3*s),i=a.next,n=0;n<s;n++)d[3*n]=h.getFloat32(i,!1),d[3*n+1]=h.getFloat32(i+4,!1),d[3*n+2]=h.getFloat32(i+8,!1),i+=12;a.next=a.next+r}if((m=a.next)>=c.byteLength)break}var M=new e.BufferGeometry;return M.setIndex(new e.BufferAttribute(p,1)),M.setAttribute("position",new e.BufferAttribute(u,3)),d.length===u.length&&M.setAttribute("normal",new e.BufferAttribute(d,3)),M}(t)}}class Pd extends e.Loader{load(t,r,i,n){const s=new e.FileLoader(this.manager);s.setPath(this.path),s.setResponseType("text"),s.load(t,(e=>{try{r(this.parse(e))}catch(e){n?n(e):console.error(e),this.manager.itemError(t)}}),i,n)}parse(t){const r=(t=t.replace(/^#.*?(\n|\r)/gm,"").replace(/^\s*?(\n|\r)/gm,"").trim()).split(/[\n\r]+/g),i=r[0].trim().split(/\s+/g).map((e=>parseFloat(e))),n=i[1]-i[0],s=i.length;for(let e=1,t=i.length;e<t;e++)if(n!==i[e]-i[e-1])throw new Error("LUT3dlLoader: Inconsistent grid size not supported.");const o=new Array(s*s*s*4);let a=0,l=0;for(let e=1,t=r.length;e<t;e++){const t=r[e].trim().split(/\s/g),i=parseFloat(t[0]),n=parseFloat(t[1]),c=parseFloat(t[2]);l=Math.max(l,i,n,c);const h=a%s*s*s+Math.floor(a/s)%s*s+Math.floor(a/(s*s))%s;o[4*h+0]=i,o[4*h+1]=n,o[4*h+2]=c,o[4*h+3]=1,a+=1}const c=Math.ceil(Math.log2(l)),h=Math.pow(2,c);for(let e=0,t=o.length;e<t;e+=4){const t=o[e+0],r=o[e+1],i=o[e+2];o[e+0]=255*t/h,o[e+1]=255*r/h,o[e+2]=255*i/h}const u=new Uint8Array(o),d=new e.DataTexture;d.image.data=u,d.image.width=s,d.image.height=s*s,d.format=e.RGBAFormat,d.type=e.UnsignedByteType,d.magFilter=e.LinearFilter,d.minFilter=e.LinearFilter,d.wrapS=e.ClampToEdgeWrapping,d.wrapT=e.ClampToEdgeWrapping,d.generateMipmaps=!1,d.needsUpdate=!0;const p=new Hu;return p.image.data=u,p.image.width=s,p.image.height=s,p.image.depth=s,p.format=e.RGBAFormat,p.type=e.UnsignedByteType,p.magFilter=e.LinearFilter,p.minFilter=e.LinearFilter,p.wrapS=e.ClampToEdgeWrapping,p.wrapT=e.ClampToEdgeWrapping,p.wrapR=e.ClampToEdgeWrapping,p.generateMipmaps=!1,p.needsUpdate=!0,{size:s,texture:d,texture3D:p}}}class Bd extends e.CompressedTextureLoader{constructor(e){super(e)}parse(t,r){const i={mipmaps:[],width:0,height:0,format:null,mipmapCount:1};function n(e){return e.charCodeAt(0)+(e.charCodeAt(1)<<8)+(e.charCodeAt(2)<<16)+(e.charCodeAt(3)<<24)}function s(e,t,r,i){const n=r*i*4,s=new Uint8Array(e,t,n),o=new Uint8Array(n);let a=0,l=0;for(let e=0;e<i;e++)for(let e=0;e<r;e++){const e=s[l];l++;const t=s[l];l++;const r=s[l];l++;const i=s[l];l++,o[a]=r,a++,o[a]=t,a++,o[a]=e,a++,o[a]=i,a++}return o}const o=n("DXT1"),a=n("DXT3"),l=n("DXT5"),c=n("ETC1"),h=new Int32Array(t,0,31);if(542327876!==h[0])return console.error("THREE.DDSLoader.parse: Invalid magic number in DDS header."),i;if(4&!h[20])return console.error("THREE.DDSLoader.parse: Unsupported format, must contain a FourCC code."),i;let u;const d=h[21];let p=!1;switch(d){case o:u=8,i.format=e.RGB_S3TC_DXT1_Format;break;case a:u=16,i.format=e.RGBA_S3TC_DXT3_Format;break;case l:u=16,i.format=e.RGBA_S3TC_DXT5_Format;break;case c:u=8,i.format=e.RGB_ETC1_Format;break;default:if(!(32===h[22]&&16711680&h[23]&&65280&h[24]&&255&h[25]&&4278190080&h[26]))return console.error("THREE.DDSLoader.parse: Unsupported FourCC code ",(m=d,String.fromCharCode(255&m,m>>8&255,m>>16&255,m>>24&255))),i;p=!0,u=64,i.format=e.RGBAFormat}var m;i.mipmapCount=1,131072&h[2]&&!1!==r&&(i.mipmapCount=Math.max(1,h[7]));const f=h[28];if(i.isCubemap=!!(512&f),i.isCubemap&&(!(1024&f)||!(2048&f)||!(4096&f)||!(8192&f)||!(16384&f)||!(32768&f)))return console.error("THREE.DDSLoader.parse: Incomplete cubemap faces"),i;i.width=h[4],i.height=h[3];let g=h[1]+4;const v=i.isCubemap?6:1;for(let e=0;e<v;e++){let e=i.width,r=i.height;for(let n=0;n<i.mipmapCount;n++){let n,o;p?(n=s(t,g,e,r),o=n.length):(o=Math.max(4,e)/4*Math.max(4,r)/4*u,n=new Uint8Array(t,g,o));const a={data:n,width:e,height:r};i.mipmaps.push(a),g+=o,e=Math.max(e>>1,1),r=Math.max(r>>1,1)}}return i}}class Ld extends e.CompressedTextureLoader{constructor(e){super(e)}parse(t,r){const i=new Uint32Array(t,0,13),n={buffer:t,header:i,loadMipmaps:r};return 55727696===i[0]?function(t){const r=t.header;let i,n;const s=r[12],o=r[2],a=r[6],l=r[7],c=r[10],h=r[11];switch(o){case 0:i=2,n=e.RGB_PVRTC_2BPPV1_Format;break;case 1:i=2,n=e.RGBA_PVRTC_2BPPV1_Format;break;case 2:i=4,n=e.RGB_PVRTC_4BPPV1_Format;break;case 3:i=4,n=e.RGBA_PVRTC_4BPPV1_Format;break;default:console.error("THREE.PVRLoader: Unsupported PVR format:",o)}return t.dataPtr=52+s,t.bpp=i,t.format=n,t.width=l,t.height=a,t.numSurfaces=c,t.numMipmaps=h,t.isCubemap=6===c,Rd(t)}(n):559044176===i[11]?function(t){const r=t.header,i=r[0],n=r[1],s=r[2],o=r[3],a=r[4],l=r[10],c=r[12],h=24,u=255&a;let d,p;const m=l>0;25===u?(p=m?e.RGBA_PVRTC_4BPPV1_Format:e.RGB_PVRTC_4BPPV1_Format,d=4):u===h?(p=m?e.RGBA_PVRTC_2BPPV1_Format:e.RGB_PVRTC_2BPPV1_Format,d=2):console.error("THREE.PVRLoader: Unknown PVR format:",u);return t.dataPtr=i,t.bpp=d,t.format=p,t.width=s,t.height=n,t.numSurfaces=c,t.numMipmaps=o+1,t.isCubemap=6===c,Rd(t)}(n):void console.error("THREE.PVRLoader: Unknown PVR format.")}}function Rd(e){const t={mipmaps:[],width:e.width,height:e.height,format:e.format,mipmapCount:e.numMipmaps,isCubemap:e.isCubemap},r=e.buffer;let i=e.dataPtr,n=0,s=0,o=0,a=0,l=0,c=0;const h=e.bpp,u=e.numSurfaces;2===h?(o=8,a=4):(o=4,a=4),s=o*a*h/8,t.mipmaps.length=e.numMipmaps*u;let d=0;for(;d<e.numMipmaps;){const h=e.width>>d,p=e.height>>d;l=h/o,c=p/a,l<2&&(l=2),c<2&&(c=2),n=l*c*s;for(let s=0;s<u;s++){const o={data:new Uint8Array(r,i,n),width:h,height:p};t.mipmaps[s*e.numMipmaps+d]=o,i+=n}d++}return t}class Nd extends e.Loader{constructor(e){super(e),this.splitLayer=!1}load(t,r,i,n){const s=this,o=new e.FileLoader(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(t,(function(e){try{r(s.parse(e))}catch(e){n?n(e):console.error(e),s.manager.itemError(t)}}),i,n)}parse(t){let r,i={x:0,y:0,z:0,e:0,f:0,extruding:!1,relative:!1},n=[];const s=new e.LineBasicMaterial({color:16711680});s.name="path";const o=new e.LineBasicMaterial({color:65280});function a(e){r={vertex:[],pathVertex:[],z:e.z},n.push(r)}function l(e,t){return i.relative?t:t-e}function c(e,t){return i.relative?e+t:t}o.name="extruded";let h=t.replace(/;.+/g,"").split("\n");for(let e=0;e<h.length;e++){let t=h[e].split(" "),n=t[0].toUpperCase(),s={};if(t.splice(1).forEach((function(e){if(void 0!==e[0]){let t=e[0].toLowerCase(),r=parseFloat(e.substring(1));s[t]=r}})),"G0"===n||"G1"===n){let e={x:void 0!==s.x?c(i.x,s.x):i.x,y:void 0!==s.y?c(i.y,s.y):i.y,z:void 0!==s.z?c(i.z,s.z):i.z,e:void 0!==s.e?c(i.e,s.e):i.e,f:void 0!==s.f?c(i.f,s.f):i.f};l(i.e,e.e)>0&&(e.extruding=l(i.e,e.e)>0,null!=r&&e.z==r.z||a(e)),u=i,d=e,void 0===r&&a(u),i.extruding?(r.vertex.push(u.x,u.y,u.z),r.vertex.push(d.x,d.y,d.z)):(r.pathVertex.push(u.x,u.y,u.z),r.pathVertex.push(d.x,d.y,d.z)),i=e}else if("G2"===n||"G3"===n);else if("G90"===n)i.relative=!1;else if("G91"===n)i.relative=!0;else if("G92"===n){let e=i;e.x=void 0!==s.x?s.x:e.x,e.y=void 0!==s.y?s.y:e.y,e.z=void 0!==s.z?s.z:e.z,e.e=void 0!==s.e?s.e:e.e,i=e}}var u,d;function p(t,r,i){let n=new e.BufferGeometry;n.setAttribute("position",new e.Float32BufferAttribute(t,3));let a=new e.LineSegments(n,r?o:s);a.name="layer"+i,m.add(a)}const m=new e.Group;if(m.name="gcode",this.splitLayer)for(let e=0;e<n.length;e++){let t=n[e];p(t.vertex,!0,e),p(t.pathVertex,!1,e)}else{const e=[],t=[];for(let r=0;r<n.length;r++){let i=n[r],s=i.vertex,o=i.pathVertex;for(let t=0;t<s.length;t++)e.push(s[t]);for(let e=0;e<o.length;e++)t.push(o[e])}p(e,!0,n.length),p(t,!1,n.length)}return m.quaternion.setFromEuler(new e.Euler(-Math.PI/2,0,0)),m}}const Dd=new WeakMap;class Id extends e.Loader{constructor(e){super(e),this.transcoderPath="",this.transcoderBinary=null,this.transcoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.workerConfig=null}setTranscoderPath(e){return this.transcoderPath=e,this}setWorkerLimit(e){return this.workerLimit=e,this}detectSupport(e){return this.workerConfig={astcSupported:e.extensions.has("WEBGL_compressed_texture_astc"),etc1Supported:e.extensions.has("WEBGL_compressed_texture_etc1"),etc2Supported:e.extensions.has("WEBGL_compressed_texture_etc"),dxtSupported:e.extensions.has("WEBGL_compressed_texture_s3tc"),bptcSupported:e.extensions.has("EXT_texture_compression_bptc"),pvrtcSupported:e.extensions.has("WEBGL_compressed_texture_pvrtc")||e.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")},this}load(t,r,i,n){const s=new e.FileLoader(this.manager);s.setResponseType("arraybuffer"),s.setWithCredentials(this.withCredentials);const o=new e.CompressedTexture;return s.load(t,(e=>{if(Dd.has(e)){return Dd.get(e).promise.then(r).catch(n)}this._createTexture([e]).then((function(e){o.copy(e),o.needsUpdate=!0,r&&r(o)})).catch(n)}),i,n),o}parseInternalAsync(e){const{levels:t}=e,r=new Set;for(let e=0;e<t.length;e++)r.add(t[e].data.buffer);return this._createTexture(Array.from(r),{...e,lowLevel:!0})}_createTexture(t,r={}){let i,n;const s=r;let o=0;for(let e=0;e<t.length;e++)o+=t[e].byteLength;const a=this._allocateWorker(o).then((e=>(i=e,n=this.workerNextTaskID++,new Promise(((e,r)=>{i._callbacks[n]={resolve:e,reject:r},i.postMessage({type:"transcode",id:n,buffers:t,taskConfig:s},t)}))))).then((t=>{const{mipmaps:r,width:i,height:n,format:s}=t,o=new e.CompressedTexture(r,i,n,s,e.UnsignedByteType);return o.minFilter=1===r.length?e.LinearFilter:e.LinearMipmapLinearFilter,o.magFilter=e.LinearFilter,o.generateMipmaps=!1,o.needsUpdate=!0,o}));return a.catch((()=>!0)).then((()=>{i&&n&&(i._taskLoad-=o,delete i._callbacks[n])})),Dd.set(t[0],{promise:a}),a}_initTranscoder(){if(!this.transcoderPending){const t=new e.FileLoader(this.manager);t.setPath(this.transcoderPath),t.setWithCredentials(this.withCredentials);const r=new Promise(((e,r)=>{t.load("basis_transcoder.js",e,void 0,r)})),i=new e.FileLoader(this.manager);i.setPath(this.transcoderPath),i.setResponseType("arraybuffer"),i.setWithCredentials(this.withCredentials);const n=new Promise(((e,t)=>{i.load("basis_transcoder.wasm",e,void 0,t)}));this.transcoderPending=Promise.all([r,n]).then((([e,t])=>{const r=Id.BasisWorker.toString(),i=["/* constants */","let _EngineFormat = "+JSON.stringify(Id.EngineFormat),"let _TranscoderFormat = "+JSON.stringify(Id.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(Id.BasisFormat),"/* basis_transcoder.js */",e,"/* worker */",r.substring(r.indexOf("{")+1,r.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([i])),this.transcoderBinary=t}))}return this.transcoderPending}_allocateWorker(e){return this._initTranscoder().then((()=>{if(this.workerPool.length<this.workerLimit){const e=new Worker(this.workerSourceURL);e._callbacks={},e._taskLoad=0,e.postMessage({type:"init",config:this.workerConfig,transcoderBinary:this.transcoderBinary}),e.onmessage=function(t){const r=t.data;switch(r.type){case"transcode":e._callbacks[r.id].resolve(r);break;case"error":e._callbacks[r.id].reject(r);break;default:console.error('THREE.BasisTextureLoader: Unexpected message, "'+r.type+'"')}},this.workerPool.push(e)}else this.workerPool.sort((function(e,t){return e._taskLoad>t._taskLoad?-1:1}));const t=this.workerPool[this.workerPool.length-1];return t._taskLoad+=e,t}))}dispose(){for(let e=0;e<this.workerPool.length;e++)this.workerPool[e].terminate();return this.workerPool.length=0,this}}Id.BasisFormat={ETC1S:0,UASTC_4x4:1},Id.TranscoderFormat={ETC1:0,ETC2:1,BC1:2,BC3:3,BC4:4,BC5:5,BC7_M6_OPAQUE_ONLY:6,BC7_M5:7,PVRTC1_4_RGB:8,PVRTC1_4_RGBA:9,ASTC_4x4:10,ATC_RGB:11,ATC_RGBA_INTERPOLATED_ALPHA:12,RGBA32:13,RGB565:14,BGR565:15,RGBA4444:16},Id.EngineFormat={RGBAFormat:e.RGBAFormat,RGBA_ASTC_4x4_Format:e.RGBA_ASTC_4x4_Format,RGBA_BPTC_Format:e.RGBA_BPTC_Format,RGBA_ETC2_EAC_Format:e.RGBA_ETC2_EAC_Format,RGBA_PVRTC_4BPPV1_Format:e.RGBA_PVRTC_4BPPV1_Format,RGBA_S3TC_DXT5_Format:e.RGBA_S3TC_DXT5_Format,RGB_ETC1_Format:e.RGB_ETC1_Format,RGB_ETC2_Format:e.RGB_ETC2_Format,RGB_PVRTC_4BPPV1_Format:e.RGB_PVRTC_4BPPV1_Format,RGB_S3TC_DXT1_Format:e.RGB_S3TC_DXT1_Format},Id.BasisWorker=function(){let e,t,r;const i=_EngineFormat,n=_TranscoderFormat,s=_BasisFormat;onmessage=function(i){const n=i.data;switch(n.type){case"init":e=n.config,o=n.transcoderBinary,t=new Promise((e=>{r={wasmBinary:o,onRuntimeInitialized:e},BASIS(r)})).then((()=>{r.initializeBasis()}));break;case"transcode":t.then((()=>{try{const{width:e,height:t,hasAlpha:i,mipmaps:o,format:a}=n.taskConfig.lowLevel?function(e){const{basisFormat:t,width:i,height:n,hasAlpha:o}=e,{transcoderFormat:a,engineFormat:l}=c(t,i,n,o),m=r.getBytesPerBlockOrPixel(a);h(r.isFormatSupported(a),"THREE.BasisTextureLoader: Unsupported format.");const f=[];if(t===s.ETC1S){const t=new r.LowLevelETC1SImageTranscoder,{endpointCount:i,endpointsData:n,selectorCount:s,selectorsData:l,tablesData:c}=e.globalData;try{let r;r=t.decodePalettes(i,n,s,l),h(r,"THREE.BasisTextureLoader: decodePalettes() failed."),r=t.decodeTables(c),h(r,"THREE.BasisTextureLoader: decodeTables() failed.");for(let i=0;i<e.levels.length;i++){const n=e.levels[i],s=e.globalData.imageDescs[i],l=p(a,n.width,n.height),c=new Uint8Array(l);r=t.transcodeImage(a,c,l/m,n.data,u(a,n.width),d(a,n.height),n.width,n.height,n.index,s.rgbSliceByteOffset,s.rgbSliceByteLength,s.alphaSliceByteOffset,s.alphaSliceByteLength,s.imageFlags,o,!1,0,0),h(r,"THREE.BasisTextureLoader: transcodeImage() failed for level "+n.index+"."),f.push({data:c,width:n.width,height:n.height})}}finally{t.delete()}}else for(let t=0;t<e.levels.length;t++){const i=e.levels[t],n=p(a,i.width,i.height),s=new Uint8Array(n);h(r.transcodeUASTCImage(a,s,n/m,i.data,u(a,i.width),d(a,i.height),i.width,i.height,i.index,0,i.data.byteLength,0,o,!1,0,0,-1,-1),"THREE.BasisTextureLoader: transcodeUASTCImage() failed for level "+i.index+"."),f.push({data:s,width:i.width,height:i.height})}return{width:i,height:n,hasAlpha:o,mipmaps:f,format:l}}(n.taskConfig):function(e){const t=new r.BasisFile(new Uint8Array(e)),i=t.isUASTC()?s.UASTC_4x4:s.ETC1S,n=t.getImageWidth(0,0),o=t.getImageHeight(0,0),a=t.getNumLevels(0),l=t.getHasAlpha();function h(){t.close(),t.delete()}const{transcoderFormat:u,engineFormat:d}=c(i,n,o,l);if(!n||!o||!a)throw h(),new Error("THREE.BasisTextureLoader:\tInvalid texture");if(!t.startTranscoding())throw h(),new Error("THREE.BasisTextureLoader: .startTranscoding failed");const p=[];for(let e=0;e<a;e++){const r=t.getImageWidth(0,e),i=t.getImageHeight(0,e),n=new Uint8Array(t.getImageTranscodedSizeInBytes(0,e,u));if(!t.transcodeImage(n,0,e,u,0,l))throw h(),new Error("THREE.BasisTextureLoader: .transcodeImage failed.");p.push({data:n,width:r,height:i})}return h(),{width:n,height:o,hasAlpha:l,mipmaps:p,format:d}}(n.buffers[0]),l=[];for(let e=0;e<o.length;++e)l.push(o[e].data.buffer);self.postMessage({type:"transcode",id:n.id,width:e,height:t,hasAlpha:i,mipmaps:o,format:a},l)}catch(e){console.error(e),self.postMessage({type:"error",id:n.id,error:e.message})}}))}var o};const o=[{if:"astcSupported",basisFormat:[s.UASTC_4x4],transcoderFormat:[n.ASTC_4x4,n.ASTC_4x4],engineFormat:[i.RGBA_ASTC_4x4_Format,i.RGBA_ASTC_4x4_Format],priorityETC1S:1/0,priorityUASTC:1,needsPowerOfTwo:!1},{if:"bptcSupported",basisFormat:[s.ETC1S,s.UASTC_4x4],transcoderFormat:[n.BC7_M5,n.BC7_M5],engineFormat:[i.RGBA_BPTC_Format,i.RGBA_BPTC_Format],priorityETC1S:3,priorityUASTC:2,needsPowerOfTwo:!1},{if:"dxtSupported",basisFormat:[s.ETC1S,s.UASTC_4x4],transcoderFormat:[n.BC1,n.BC3],engineFormat:[i.RGB_S3TC_DXT1_Format,i.RGBA_S3TC_DXT5_Format],priorityETC1S:4,priorityUASTC:5,needsPowerOfTwo:!1},{if:"etc2Supported",basisFormat:[s.ETC1S,s.UASTC_4x4],transcoderFormat:[n.ETC1,n.ETC2],engineFormat:[i.RGB_ETC2_Format,i.RGBA_ETC2_EAC_Format],priorityETC1S:1,priorityUASTC:3,needsPowerOfTwo:!1},{if:"etc1Supported",basisFormat:[s.ETC1S,s.UASTC_4x4],transcoderFormat:[n.ETC1,n.ETC1],engineFormat:[i.RGB_ETC1_Format,i.RGB_ETC1_Format],priorityETC1S:2,priorityUASTC:4,needsPowerOfTwo:!1},{if:"pvrtcSupported",basisFormat:[s.ETC1S,s.UASTC_4x4],transcoderFormat:[n.PVRTC1_4_RGB,n.PVRTC1_4_RGBA],engineFormat:[i.RGB_PVRTC_4BPPV1_Format,i.RGBA_PVRTC_4BPPV1_Format],priorityETC1S:5,priorityUASTC:6,needsPowerOfTwo:!0}],a=o.sort((function(e,t){return e.priorityETC1S-t.priorityETC1S})),l=o.sort((function(e,t){return e.priorityUASTC-t.priorityUASTC}));function c(t,r,o,c){let h,u;const d=t===s.ETC1S?a:l;for(let i=0;i<d.length;i++){const n=d[i];if(e[n.if]&&(n.basisFormat.includes(t)&&(!n.needsPowerOfTwo||m(r)&&m(o))))return h=n.transcoderFormat[c?1:0],u=n.engineFormat[c?1:0],{transcoderFormat:h,engineFormat:u}}return console.warn("THREE.BasisTextureLoader: No suitable compressed texture format found. Decoding to RGBA32."),h=n.RGBA32,u=i.RGBAFormat,{transcoderFormat:h,engineFormat:u}}function h(e,t){if(!e)throw new Error(t)}function u(e,t){return Math.ceil(t/r.getFormatBlockWidth(e))}function d(e,t){return Math.ceil(t/r.getFormatBlockHeight(e))}function p(e,t,i){const s=r.getBytesPerBlockOrPixel(e);if(r.formatIsUncompressed(e))return t*i*s;if(e===n.PVRTC1_4_RGB||e===n.PVRTC1_4_RGBA){const e=t+3&-4,r=i+3&-4;return(Math.max(8,e)*Math.max(8,r)*4+7)/8}return u(e,t)*d(e,i)*s}function m(e){return e<=2||0==(e&e-1)&&0!==e}};class Ud extends e.Loader{constructor(e){super(e),this.debug=!1,this.group=null,this.position=0,this.materials=[],this.meshes=[]}load(t,r,i,n){const s=this,o=""===this.path?e.LoaderUtils.extractUrlBase(t):this.path,a=new e.FileLoader(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(t,(function(e){try{r(s.parse(e,o))}catch(e){n?n(e):console.error(e),s.manager.itemError(t)}}),i,n)}parse(t,r){this.group=new e.Group,this.position=0,this.materials=[],this.meshes=[],this.readFile(t,r);for(let e=0;e<this.meshes.length;e++)this.group.add(this.meshes[e]);return this.group}readFile(e,t){const r=new DataView(e),i=this.readChunk(r);if(i.id===kd||i.id===Vd||i.id===Od){let e=this.nextChunk(r,i);for(;0!==e;){if(e===Gd){const e=this.readDWord(r);this.debugMessage("3DS file version: "+e)}else e===Yd?(this.resetPosition(r),this.readMeshData(r,t)):this.debugMessage("Unknown main chunk: "+e.toString(16));e=this.nextChunk(r,i)}}this.debugMessage("Parsed "+this.meshes.length+" meshes")}readMeshData(e,t){const r=this.readChunk(e);let i=this.nextChunk(e,r);for(;0!==i;){if(i===Kd){const t=+this.readDWord(e);this.debugMessage("Mesh Version: "+t)}else if(i===qd){const t=this.readFloat(e);this.debugMessage("Master scale: "+t),this.group.scale.set(t,t,t)}else i===vp?(this.debugMessage("Named Object"),this.resetPosition(e),this.readNamedObject(e)):i===Jd?(this.debugMessage("Material"),this.resetPosition(e),this.readMaterialEntry(e,t)):this.debugMessage("Unknown MDATA chunk: "+i.toString(16));i=this.nextChunk(e,r)}}readNamedObject(e){const t=this.readChunk(e),r=this.readString(e,64);t.cur=this.position;let i=this.nextChunk(e,t);for(;0!==i;){if(i===xp){this.resetPosition(e);const t=this.readMesh(e);t.name=r,this.meshes.push(t)}else this.debugMessage("Unknown named object chunk: "+i.toString(16));i=this.nextChunk(e,t)}this.endChunk(t)}readMaterialEntry(t,r){const i=this.readChunk(t);let n=this.nextChunk(t,i);const s=new e.MeshPhongMaterial;for(;0!==n;){if(n===Zd)s.name=this.readString(t,64),this.debugMessage(" Name: "+s.name);else if(n===op)this.debugMessage(" Wireframe"),s.wireframe=!0;else if(n===ap){const e=this.readByte(t);s.wireframeLinewidth=e,this.debugMessage(" Wireframe Thickness: "+e)}else if(n===np)s.side=e.DoubleSide,this.debugMessage(" DoubleSided");else if(n===sp)this.debugMessage(" Additive Blending"),s.blending=e.AdditiveBlending;else if(n===ep)this.debugMessage(" Diffuse Color"),s.color=this.readColor(t);else if(n===tp)this.debugMessage(" Specular Color"),s.specular=this.readColor(t);else if(n===$d)this.debugMessage(" Ambient color"),s.color=this.readColor(t);else if(n===rp){const e=this.readPercentage(t);s.shininess=100*e,this.debugMessage(" Shininess : "+e)}else if(n===ip){const e=this.readPercentage(t);s.opacity=1-e,this.debugMessage(" Transparency : "+e),s.transparent=s.opacity<1}else n===lp?(this.debugMessage(" ColorMap"),this.resetPosition(t),s.map=this.readMap(t,r)):n===hp?(this.debugMessage(" BumpMap"),this.resetPosition(t),s.bumpMap=this.readMap(t,r)):n===cp?(this.debugMessage(" OpacityMap"),this.resetPosition(t),s.alphaMap=this.readMap(t,r)):n===up?(this.debugMessage(" SpecularMap"),this.resetPosition(t),s.specularMap=this.readMap(t,r)):this.debugMessage(" Unknown material chunk: "+n.toString(16));n=this.nextChunk(t,i)}this.endChunk(i),this.materials[s.name]=s}readMesh(t){const r=this.readChunk(t);let i=this.nextChunk(t,r);const n=new e.BufferGeometry,s=new e.MeshPhongMaterial,o=new e.Mesh(n,s);for(o.name="mesh";0!==i;){if(i===yp){const r=this.readWord(t);this.debugMessage(" Vertex: "+r);const i=[];for(let e=0;e<r;e++)i.push(this.readFloat(t)),i.push(this.readFloat(t)),i.push(this.readFloat(t));n.setAttribute("position",new e.Float32BufferAttribute(i,3))}else if(i===bp)this.resetPosition(t),this.readFaceArray(t,o);else if(i===wp){const r=this.readWord(t);this.debugMessage(" UV: "+r);const i=[];for(let e=0;e<r;e++)i.push(this.readFloat(t)),i.push(this.readFloat(t));n.setAttribute("uv",new e.Float32BufferAttribute(i,2))}else if(i===Mp){this.debugMessage(" Tranformation Matrix (TODO)");const r=[];for(let e=0;e<12;e++)r[e]=this.readFloat(t);const i=new e.Matrix4;i.elements[0]=r[0],i.elements[1]=r[6],i.elements[2]=r[3],i.elements[3]=r[9],i.elements[4]=r[2],i.elements[5]=r[8],i.elements[6]=r[5],i.elements[7]=r[11],i.elements[8]=r[1],i.elements[9]=r[7],i.elements[10]=r[4],i.elements[11]=r[10],i.elements[12]=0,i.elements[13]=0,i.elements[14]=0,i.elements[15]=1,i.transpose();const s=new e.Matrix4;s.copy(i).invert(),n.applyMatrix4(s),i.decompose(o.position,o.quaternion,o.scale)}else this.debugMessage(" Unknown mesh chunk: "+i.toString(16));i=this.nextChunk(t,r)}return this.endChunk(r),n.computeVertexNormals(),o}readFaceArray(e,t){const r=this.readChunk(e),i=this.readWord(e);this.debugMessage(" Faces: "+i);const n=[];for(let t=0;t<i;++t)n.push(this.readWord(e),this.readWord(e),this.readWord(e)),this.readWord(e);t.geometry.setIndex(n);let s=0,o=0;for(;this.position<r.end;){const r=this.readChunk(e);if(r.id===Ap){this.debugMessage(" Material Group"),this.resetPosition(e);const r=this.readMaterialGroup(e),i=3*r.index.length;t.geometry.addGroup(o,i,s),o+=i,s++;const n=this.materials[r.name];!1===Array.isArray(t.material)&&(t.material=[]),void 0!==n&&t.material.push(n)}else this.debugMessage(" Unknown face array chunk: "+r.toString(16));this.endChunk(r)}1===t.material.length&&(t.material=t.material[0]),this.endChunk(r)}readMap(t,r){const i=this.readChunk(t);let n=this.nextChunk(t,i),s={};const o=new e.TextureLoader(this.manager);for(o.setPath(this.resourcePath||r).setCrossOrigin(this.crossOrigin);0!==n;){if(n===dp){const e=this.readString(t,128);s=o.load(e),this.debugMessage(" File: "+r+e)}else n===fp?(s.offset.x=this.readFloat(t),this.debugMessage(" OffsetX: "+s.offset.x)):n===gp?(s.offset.y=this.readFloat(t),this.debugMessage(" OffsetY: "+s.offset.y)):n===pp?(s.repeat.x=this.readFloat(t),this.debugMessage(" RepeatX: "+s.repeat.x)):n===mp?(s.repeat.y=this.readFloat(t),this.debugMessage(" RepeatY: "+s.repeat.y)):this.debugMessage(" Unknown map chunk: "+n.toString(16));n=this.nextChunk(t,i)}return this.endChunk(i),s}readMaterialGroup(e){this.readChunk(e);const t=this.readString(e,64),r=this.readWord(e);this.debugMessage(" Name: "+t),this.debugMessage(" Faces: "+r);const i=[];for(let t=0;t<r;++t)i.push(this.readWord(e));return{name:t,index:i}}readColor(t){const r=this.readChunk(t),i=new e.Color;if(r.id===Hd||r.id===jd){const e=this.readByte(t),r=this.readByte(t),n=this.readByte(t);i.setRGB(e/255,r/255,n/255),this.debugMessage(" Color: "+i.r+", "+i.g+", "+i.b)}else if(r.id===zd||r.id===Wd){const e=this.readFloat(t),r=this.readFloat(t),n=this.readFloat(t);i.setRGB(e,r,n),this.debugMessage(" Color: "+i.r+", "+i.g+", "+i.b)}else this.debugMessage(" Unknown color chunk: "+r.toString(16));return this.endChunk(r),i}readChunk(e){const t={};return t.cur=this.position,t.id=this.readWord(e),t.size=this.readDWord(e),t.end=t.cur+t.size,t.cur+=6,t}endChunk(e){this.position=e.end}nextChunk(e,t){if(t.cur>=t.end)return 0;this.position=t.cur;try{const r=this.readChunk(e);return t.cur+=r.size,r.id}catch(e){return this.debugMessage("Unable to read chunk at "+this.position),0}}resetPosition(){this.position-=6}readByte(e){const t=e.getUint8(this.position,!0);return this.position+=1,t}readFloat(e){try{const t=e.getFloat32(this.position,!0);return this.position+=4,t}catch(t){this.debugMessage(t+" "+this.position+" "+e.byteLength)}}readInt(e){const t=e.getInt32(this.position,!0);return this.position+=4,t}readShort(e){const t=e.getInt16(this.position,!0);return this.position+=2,t}readDWord(e){const t=e.getUint32(this.position,!0);return this.position+=4,t}readWord(e){const t=e.getUint16(this.position,!0);return this.position+=2,t}readString(e,t){let r="";for(let i=0;i<t;i++){const t=this.readByte(e);if(!t)break;r+=String.fromCharCode(t)}return r}readPercentage(e){const t=this.readChunk(e);let r;switch(t.id){case Xd:r=this.readShort(e)/100;break;case Qd:r=this.readFloat(e);break;default:this.debugMessage(" Unknown percentage chunk: "+t.toString(16))}return this.endChunk(t),r}debugMessage(e){this.debug&&console.log(e)}}const Od=19789,kd=15786,Vd=49725,Gd=2,zd=16,Hd=17,jd=18,Wd=19,Xd=48,Qd=49,Yd=15677,Kd=15678,qd=256,Jd=45055,Zd=40960,$d=40976,ep=40992,tp=41008,rp=41024,ip=41040,np=41089,sp=41091,op=41093,ap=41095,lp=41472,cp=41488,hp=41520,up=41476,dp=41728,pp=41812,mp=41814,fp=41816,gp=41818,vp=16384,xp=16640,yp=16656,bp=16672,Ap=16688,wp=16704,Mp=16736,Tp=new e.Vector3,Sp=new e.Vector3;class Cp extends e.ShaderMaterial{constructor(t){super({uniforms:e.UniformsUtils.merge([e.UniformsLib.fog,{diffuse:{value:new e.Color},opacity:{value:1}}]),vertexShader:"\n attribute vec3 control0;\n attribute vec3 control1;\n attribute vec3 direction;\n varying float discardFlag;\n\n #include <common>\n #include <color_pars_vertex>\n #include <fog_pars_vertex>\n #include <logdepthbuf_pars_vertex>\n #include <clipping_planes_pars_vertex>\n\n void main() {\n #include <color_vertex>\n\n vec4 mvPosition = modelViewMatrix * vec4(position, 1.0);\n gl_Position = projectionMatrix * mvPosition;\n\n // Transform the line segment ends and control points into camera clip space\n vec4 c0 = projectionMatrix * modelViewMatrix * vec4(control0, 1.0);\n vec4 c1 = projectionMatrix * modelViewMatrix * vec4(control1, 1.0);\n vec4 p0 = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n vec4 p1 = projectionMatrix * modelViewMatrix * vec4(position + direction, 1.0);\n\n c0.xy /= c0.w;\n c1.xy /= c1.w;\n p0.xy /= p0.w;\n p1.xy /= p1.w;\n\n // Get the direction of the segment and an orthogonal vector\n vec2 dir = p1.xy - p0.xy;\n vec2 norm = vec2(-dir.y, dir.x);\n\n // Get control point directions from the line\n vec2 c0dir = c0.xy - p1.xy;\n vec2 c1dir = c1.xy - p1.xy;\n\n // If the vectors to the controls points are pointed in different directions away\n // from the line segment then the line should not be drawn.\n float d0 = dot(normalize(norm), normalize(c0dir));\n float d1 = dot(normalize(norm), normalize(c1dir));\n discardFlag = float(sign(d0) != sign(d1));\n\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n }\n ",fragmentShader:"\n uniform vec3 diffuse;\n uniform float opacity;\n varying float discardFlag;\n\n #include <common>\n #include <color_pars_fragment>\n #include <fog_pars_fragment>\n #include <logdepthbuf_pars_fragment>\n #include <clipping_planes_pars_fragment>\n\n void main() {\n if (discardFlag > 0.5) discard;\n\n #include <clipping_planes_fragment>\n vec3 outgoingLight = vec3(0.0);\n vec4 diffuseColor = vec4(diffuse, opacity);\n #include <logdepthbuf_fragment>\n #include <color_fragment>\n outgoingLight = diffuseColor.rgb; // simple shader\n gl_FragColor = vec4(outgoingLight, diffuseColor.a);\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n }\n "}),Object.defineProperties(this,{opacity:{get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e}},color:{get:function(){return this.uniforms.diffuse.value}}}),this.setValues(t),this.isLDrawConditionalLineMaterial=!0}}class Fp extends e.LineSegments{constructor(e,t){super(e,t),this.isConditionalLine=!0}}const Ep=new e.Ray;function _p(e){return"Part"===e||"Unofficial_Part"===e}function Pp(e){return/primitive/i.test(e)||"Subpart"===e}class Bp{constructor(e,t){this.line=e,this.lineLength=e.length,this.currentCharIndex=0,this.currentChar=" ",this.lineNumber=t}seekNonSpace(){for(;this.currentCharIndex<this.lineLength;){if(this.currentChar=this.line.charAt(this.currentCharIndex)," "!==this.currentChar&&"\t"!==this.currentChar)return;this.currentCharIndex++}}getToken(){const e=this.currentCharIndex++;for(;this.currentCharIndex<this.lineLength&&(this.currentChar=this.line.charAt(this.currentCharIndex)," "!==this.currentChar&&"\t"!==this.currentChar);)this.currentCharIndex++;const t=this.currentCharIndex;return this.seekNonSpace(),this.line.substring(e,t)}getVector(){return new e.Vector3(parseFloat(this.getToken()),parseFloat(this.getToken()),parseFloat(this.getToken()))}getRemainingString(){return this.line.substring(this.currentCharIndex,this.lineLength)}isAtTheEnd(){return this.currentCharIndex>=this.lineLength}setToEnd(){this.currentCharIndex=this.lineLength}getLineNumberString(){return this.lineNumber>=0?" at line "+this.lineNumber:""}}class Lp{constructor(e){this.loader=e,this._cache={}}cloneResult(e){const t={};return t.faces=e.faces.map((e=>({colorCode:e.colorCode,material:e.material,vertices:e.vertices.map((e=>e.clone())),normals:e.normals.map((()=>null)),faceNormal:null}))),t.conditionalSegments=e.conditionalSegments.map((e=>({colorCode:e.colorCode,material:e.material,vertices:e.vertices.map((e=>e.clone())),controlPoints:e.controlPoints.map((e=>e.clone()))}))),t.lineSegments=e.lineSegments.map((e=>({colorCode:e.colorCode,material:e.material,vertices:e.vertices.map((e=>e.clone()))}))),t.type=e.type,t.category=e.category,t.keywords=e.keywords,t.subobjects=e.subobjects,t.totalFaces=e.totalFaces,t.startingConstructionStep=e.startingConstructionStep,t.materials=e.materials,t.group=null,t}async fetchData(t){let r=!1,i=0;for(;6!==i;){let n=t;switch(i){case 0:i+=1;break;case 1:n="parts/"+n,i+=1;break;case 2:n="p/"+n,i+=1;break;case 3:n="models/"+n,i+=1;break;case 4:n=t.substring(0,t.lastIndexOf("/")+1)+n,i+=1;break;case 5:r?i=6:(n=t=t.toLowerCase(),r=!0,i=0)}const s=this.loader,o=new e.FileLoader(s.manager);o.setPath(s.partsLibraryPath),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials);try{return await o.loadAsync(n)}catch{continue}}throw new Error('LDrawLoader: Subobject "'+t+'" could not be loaded.')}parse(t,r=null){const i=this.loader,n=[],s=[],o=[],a=[],l={},c=e=>l[e]||null;let h="Model",u=null,d=null,p=0;-1!==t.indexOf("\r\n")&&(t=t.replace(/\r\n/g,"\n"));const m=t.split("\n"),f=m.length;let g=!1,v=null,x=null,y=!1,b=!0,A=!1,w=!0,M=!1;for(let t=0;t<f;t++){const r=m[t];if(0===r.length)continue;if(g){r.startsWith("0 FILE ")?(this.setData(v,x),v=r.substring(7),x=""):x+=r+"\n";continue}const f=new Bp(r,t+1);if(f.seekNonSpace(),f.isAtTheEnd())continue;const T=f.getToken();let S,C,F,E,_,P,B,L,R,N,D;switch(T){case"0":const r=f.getToken();if(r)switch(r){case"!LDRAW_ORG":h=f.getToken();break;case"!COLOUR":S=i.parseColorMetaDirective(f),S?l[S.userData.code]=S:console.warn("LDrawLoader: Error parsing material"+f.getLineNumberString());break;case"!CATEGORY":u=f.getToken();break;case"!KEYWORDS":const e=f.getRemainingString().split(",");e.length>0&&(d||(d=[]),e.forEach((function(e){d.push(e.trim())})));break;case"FILE":t>0&&(g=!0,v=f.getRemainingString(),x="",y=!1,b=!0);break;case"BFC":for(;!f.isAtTheEnd();){const e=f.getToken();switch(e){case"CERTIFY":case"NOCERTIFY":y="CERTIFY"===e,b=!0;break;case"CW":case"CCW":b="CCW"===e;break;case"INVERTNEXT":A=!0;break;case"CLIP":case"NOCLIP":w="CLIP"===e;break;default:console.warn('THREE.LDrawLoader: BFC directive "'+e+'" is unknown.')}}break;case"STEP":M=!0}break;case"1":C=f.getToken(),S=c(C);const m=parseFloat(f.getToken()),I=parseFloat(f.getToken()),U=parseFloat(f.getToken()),O=parseFloat(f.getToken()),k=parseFloat(f.getToken()),V=parseFloat(f.getToken()),G=parseFloat(f.getToken()),z=parseFloat(f.getToken()),H=parseFloat(f.getToken()),j=parseFloat(f.getToken()),W=parseFloat(f.getToken()),X=parseFloat(f.getToken()),Q=(new e.Matrix4).set(O,k,V,m,G,z,H,I,j,W,X,U,0,0,0,1);let Y=f.getRemainingString().trim().replace(/\\/g,"/");i.fileMap[Y]?Y=i.fileMap[Y]:Y.startsWith("s/")?Y="parts/"+Y:Y.startsWith("48/")&&(Y="p/"+Y),a.push({material:S,colorCode:C,matrix:Q,fileName:Y,inverted:A,startingConstructionStep:M}),A=!1;break;case"2":C=f.getToken(),S=c(C),P=f.getVector(),B=f.getVector(),F={material:S,colorCode:C,vertices:[P,B]},s.push(F);break;case"5":C=f.getToken(),S=c(C),P=f.getVector(),B=f.getVector(),N=f.getVector(),D=f.getVector(),F={material:S,colorCode:C,vertices:[P,B],controlPoints:[N,D]},o.push(F);break;case"3":C=f.getToken(),S=c(C),E=b,_=!y||!w,!0===E?(P=f.getVector(),B=f.getVector(),L=f.getVector()):(L=f.getVector(),B=f.getVector(),P=f.getVector()),n.push({material:S,colorCode:C,faceNormal:null,vertices:[P,B,L],normals:[null,null,null]}),p++,!0===_&&(n.push({material:S,colorCode:C,faceNormal:null,vertices:[L,B,P],normals:[null,null,null]}),p++);break;case"4":C=f.getToken(),S=c(C),E=b,_=!y||!w,!0===E?(P=f.getVector(),B=f.getVector(),L=f.getVector(),R=f.getVector()):(R=f.getVector(),L=f.getVector(),B=f.getVector(),P=f.getVector()),n.push({material:S,colorCode:C,faceNormal:null,vertices:[P,B,L,R],normals:[null,null,null,null]}),p+=2,!0===_&&(n.push({material:S,colorCode:C,faceNormal:null,vertices:[R,L,B,P],normals:[null,null,null,null]}),p+=2);break;default:throw new Error('LDrawLoader: Unknown line type "'+T+'"'+f.getLineNumberString()+".")}}return g&&this.setData(v,x),{faces:n,conditionalSegments:o,lineSegments:s,type:h,category:u,keywords:d,subobjects:a,totalFaces:p,startingConstructionStep:M,materials:l,fileName:r,group:null}}getData(e,t=!0){const r=e.toLowerCase(),i=this._cache[r];return null===i||i instanceof Promise?null:t?this.cloneResult(i):i}async ensureDataLoaded(e){const t=e.toLowerCase();t in this._cache||(this._cache[t]=this.fetchData(e).then((r=>{const i=this.parse(r,e);return this._cache[t]=i,i}))),await this._cache[t]}setData(e,t){const r=e.toLowerCase();this._cache[r]=this.parse(t,e)}}function Rp(e,t,r,i){return(!i&&"16"===e||i&&"24"===e)&&(e=t),r[e]||null}class Np{constructor(e){this.loader=e,this.parseCache=new Lp(e),this._cache={}}async processIntoMesh(t){const r=this.loader,i=this.parseCache,n=new Set,s=async(t,o=null)=>{const a=t.subobjects,l=[];for(let e=0,t=a.length;e<t;e++){const t=a[e],r=i.ensureDataLoaded(t.fileName).then((()=>Pp(i.getData(t.fileName,!1).type)?s(i.getData(t.fileName),t):this.loadModel(t.fileName).catch((e=>(console.warn(e),null)))));l.push(r)}const c=new e.Group;c.userData.category=t.category,c.userData.keywords=t.keywords,t.group=c;const h=await Promise.all(l);for(let e=0,i=h.length;e<i;e++){const i=t.subobjects[e],s=h[e];if(null===s)continue;if(s.isGroup){const e=s;i.matrix.decompose(e.position,e.quaternion,e.scale),e.userData.startingConstructionStep=i.startingConstructionStep,e.name=i.fileName,r.applyMaterialsToMesh(e,i.colorCode,t.materials),c.add(e);continue}s.group.children.length&&c.add(s.group);const o=t.lineSegments,a=t.conditionalSegments,l=t.faces,u=s.lineSegments,d=s.conditionalSegments,p=s.faces,m=i.matrix,f=i.inverted,g=m.determinant()<0,v=i.colorCode,x="16"===v?"24":v;for(let e=0,r=u.length;e<r;e++){const r=u[e],i=r.vertices;i[0].applyMatrix4(m),i[1].applyMatrix4(m),r.colorCode="24"===r.colorCode?x:r.colorCode,r.material=r.material||Rp(r.colorCode,r.colorCode,t.materials,!0),o.push(r)}for(let e=0,r=d.length;e<r;e++){const r=d[e],i=r.vertices,n=r.controlPoints;i[0].applyMatrix4(m),i[1].applyMatrix4(m),n[0].applyMatrix4(m),n[1].applyMatrix4(m),r.colorCode="24"===r.colorCode?x:r.colorCode,r.material=r.material||Rp(r.colorCode,r.colorCode,t.materials,!0),a.push(r)}for(let e=0,r=p.length;e<r;e++){const r=p[e],i=r.vertices;for(let e=0,t=i.length;e<t;e++)i[e].applyMatrix4(m);r.colorCode="16"===r.colorCode?v:r.colorCode,r.material=r.material||Rp(r.colorCode,v,t.materials,!1),n.add(r.colorCode),g!==f&&i.reverse(),l.push(r)}t.totalFaces+=s.totalFaces}return o&&r.applyMaterialsToMesh(c,o.colorCode,t.materials),t};for(let e=0,r=t.faces;e<r;e++)n.add(t.faces[e].colorCode);if(await s(t),r.smoothNormals){const r=n.size>1;!function(t){for(let r=0,i=t.length;r<i;r++){const i=t[r],n=i.vertices,s=n[0],o=n[1],a=n[2];Tp.subVectors(o,s),Sp.subVectors(a,o),i.faceNormal=(new e.Vector3).crossVectors(Tp,Sp).normalize()}}(t.faces),function(t,r,i=!1){const n=100*(1+1e-10);function s(e){return`${~~(e.x*n)},${~~(e.y*n)},${~~(e.z*n)}`}function o(e,t){return`${s(e)}_${s(t)}`}function a(e,t,r){r.direction.subVectors(t,e).normalize();const i=e.dot(r.direction);return r.origin.copy(e).addScaledVector(r.direction,-i),r}function l(e){return o(e.origin,e.direction)}const c=new Set,h=new Map,u={},d=[];for(let t=0,n=r.length;t<n;t++){const n=r[t].vertices,s=n[0],u=n[1];if(c.add(o(s,u)),c.add(o(u,s)),i){const t=a(s,u,new e.Ray),r=l(t);if(!h.has(r)){a(u,s,t);const e=l(t),i={ray:t,distances:[]};h.set(r,i),h.set(e,i)}const i=h.get(r);let n=i.ray.direction.dot(s),o=i.ray.direction.dot(u);n>o&&([n,o]=[o,n]),i.distances.push(n,o)}}for(let e=0,r=t.length;e<r;e++){const r=t[e],n=r.vertices,s=n.length;for(let e=0;e<s;e++){const t=e,d=(e+1)%s,p=n[t],m=n[d],f=o(p,m);if(c.has(f))continue;if(i){a(p,m,Ep);const e=l(Ep);if(h.has(e)){const t=h.get(e),{ray:r,distances:i}=t;let n=r.direction.dot(p),s=r.direction.dot(m);n>s&&([n,s]=[s,n]);let o=!1;for(let e=0,t=i.length;e<t;e+=2)if(n>=i[e]&&s<=i[e+1]){o=!0;break}if(o)continue}}const g={index:t,tri:r};u[f]=g}}for(;;){let t=null;for(const e in u){t=u[e];break}if(null===t)break;const r=[t];for(;r.length>0;){const t=r.pop().tri,i=t.vertices,n=t.normals,s=t.faceNormal,a=i.length;for(let l=0;l<a;l++){const c=l,h=(l+1)%a,p=i[c],m=i[h];delete u[o(p,m)];const f=o(m,p),g=u[f];if(g){const i=g.tri,o=g.index,a=i.normals,l=a.length,p=i.faceNormal;if(Math.abs(i.faceNormal.dot(t.faceNormal))<.25)continue;f in u&&(r.push(g),delete u[f]);const m=(o+1)%l;n[c]&&a[m]&&n[c]!==a[m]&&(a[m].norm.add(n[c].norm),n[c].norm=a[m].norm);let v=n[c]||a[m];null===v&&(v={norm:new e.Vector3},d.push(v.norm)),null===n[c]&&(n[c]=v,v.norm.add(s)),null===a[m]&&(a[m]=v,v.norm.add(p)),n[h]&&a[o]&&n[h]!==a[o]&&(a[o].norm.add(n[h].norm),n[h].norm=a[o].norm);let x=n[h]||a[o];null===x&&(x={norm:new e.Vector3},d.push(x.norm)),null===n[h]&&(n[h]=x,x.norm.add(s)),null===a[o]&&(a[o]=x,x.norm.add(p))}}}}for(let e=0,t=d.length;e<t;e++)d[e].normalize()}(t.faces,t.lineSegments,r)}const o=t.group;return t.faces.length>0&&o.add(Ip(t.faces,3,!1,t.totalFaces)),t.lineSegments.length>0&&o.add(Ip(t.lineSegments,2)),t.conditionalSegments.length>0&&o.add(Ip(t.conditionalSegments,2,!0)),o}hasCachedModel(e){return null!==e&&e.toLowerCase()in this._cache}async getCachedModel(e){if(null!==e&&this.hasCachedModel(e)){const t=e.toLowerCase();return(await this._cache[t]).clone()}return null}async loadModel(e){const t=this.parseCache,r=e.toLowerCase();if(this.hasCachedModel(e))return this.getCachedModel(e);{await t.ensureDataLoaded(e);const i=t.getData(e),n=this.processIntoMesh(i);if(this.hasCachedModel(e))return this.getCachedModel(e);_p(i.type)&&(this._cache[r]=n);return(await n).clone()}}async parseModel(e){const t=this.parseCache.parse(e);return _p(t.type)&&this.hasCachedModel(t.fileName)?this.getCachedModel(t.fileName):this.processIntoMesh(t)}}function Dp(e,t){return e.colorCode===t.colorCode?0:e.colorCode<t.colorCode?-1:1}function Ip(t,r,i=!1,n=null){t.sort(Dp),null===n&&(n=t.length);const s=new Float32Array(r*n*3),o=3===r?new Float32Array(r*n*3):null,a=[],l=new Array(6),c=new e.BufferGeometry;let h=null,u=0,d=0,p=0;for(let n=0,m=t.length;n<m;n++){const m=t[n];let f=m.vertices;4===f.length&&(l[0]=f[0],l[1]=f[1],l[2]=f[2],l[3]=f[0],l[4]=f[2],l[5]=f[3],f=l);for(let e=0,t=f.length;e<t;e++){const t=f[e],r=p+3*e;s[r+0]=t.x,s[r+1]=t.y,s[r+2]=t.z}if(3===r){if(!m.faceNormal){const t=f[0],r=f[1],i=f[2];Tp.subVectors(r,t),Sp.subVectors(i,r),m.faceNormal=(new e.Vector3).crossVectors(Tp,Sp).normalize()}let t=m.normals;4===t.length&&(l[0]=t[0],l[1]=t[1],l[2]=t[2],l[3]=t[0],l[4]=t[2],l[5]=t[3],t=l);for(let e=0,r=t.length;e<r;e++){let r=m.faceNormal;t[e]&&(r=t[e].norm);const i=p+3*e;o[i+0]=r.x,o[i+1]=r.y,o[i+2]=r.z}}if(h!==m.colorCode){null!==h&&c.addGroup(u,d,a.length-1);const e=m.material;null!==e?3===r?a.push(e):2===r&&(null!==e?i?a.push(e.userData.edgeMaterial.userData.conditionalEdgeMaterial):a.push(e.userData.edgeMaterial):a.push(null)):a.push(m.colorCode),h=m.colorCode,u=p/3,d=f.length}else d+=f.length;p+=3*f.length}d>0&&c.addGroup(u,1/0,a.length-1),c.setAttribute("position",new e.BufferAttribute(s,3)),null!==o&&c.setAttribute("normal",new e.BufferAttribute(o,3));let m=null;if(2===r?m=i?new Fp(c,1===a.length?a[0]:a):new e.LineSegments(c,1===a.length?a[0]:a):3===r&&(m=new e.Mesh(c,1===a.length?a[0]:a)),i){m.isConditionalLine=!0;const r=new Float32Array(3*t.length*2),i=new Float32Array(3*t.length*2),n=new Float32Array(3*t.length*2);for(let e=0,s=t.length;e<s;e++){const s=t[e],o=s.vertices,a=s.controlPoints,l=a[0],c=a[1],h=o[0],u=o[1],d=3*e*2;r[d+0]=l.x,r[d+1]=l.y,r[d+2]=l.z,r[d+3]=l.x,r[d+4]=l.y,r[d+5]=l.z,i[d+0]=c.x,i[d+1]=c.y,i[d+2]=c.z,i[d+3]=c.x,i[d+4]=c.y,i[d+5]=c.z,n[d+0]=u.x-h.x,n[d+1]=u.y-h.y,n[d+2]=u.z-h.z,n[d+3]=u.x-h.x,n[d+4]=u.y-h.y,n[d+5]=u.z-h.z}c.setAttribute("control0",new e.BufferAttribute(r,3,!1)),c.setAttribute("control1",new e.BufferAttribute(i,3,!1)),c.setAttribute("direction",new e.BufferAttribute(n,3,!1))}return m}class Up extends e.Loader{constructor(e){super(e),this.materials=[],this.materialLibrary={},this.partsCache=new Np(this),this.fileMap={},this.setMaterials([]),this.smoothNormals=!0,this.partsLibraryPath=""}setPartsLibraryPath(e){return this.partsLibraryPath=e,this}async preloadMaterials(t){const r=new e.FileLoader(this.manager);r.setPath(this.path),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials);const i=/^0 !COLOUR/,n=(await r.loadAsync(t)).split(/[\n\r]/g),s=[];for(let e=0,t=n.length;e<t;e++){const t=n[e];if(i.test(t)){const e=t.replace(i,""),r=this.parseColorMetaDirective(new Bp(e));s.push(r)}}this.setMaterials(s)}load(t,r,i,n){const s=new e.FileLoader(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(t,(e=>{this.partsCache.parseModel(e,this.materialLibrary).then((e=>{this.applyMaterialsToMesh(e,"16",this.materialLibrary,!0),this.computeConstructionSteps(e),r(e)})).catch(n)}),i,n)}parse(e,t){this.partsCache.parseModel(e,this.materialLibrary).then((e=>{this.computeConstructionSteps(e),t(e)}))}setMaterials(e){this.materialLibrary={},this.materials=[];for(let t=0,r=e.length;t<r;t++)this.addMaterial(e[t]);return this.addMaterial(this.parseColorMetaDirective(new Bp("Main_Colour CODE 16 VALUE #FF8080 EDGE #333333"))),this.addMaterial(this.parseColorMetaDirective(new Bp("Edge_Colour CODE 24 VALUE #A0A0A0 EDGE #333333"))),this}setFileMap(e){return this.fileMap=e,this}addMaterial(e){const t=this.materialLibrary;return t[e.userData.code]||(this.materials.push(e),t[e.userData.code]=e),this}getMaterial(e){if(e.startsWith("0x2")){const t=e.substring(3);return this.parseColorMetaDirective(new Bp("Direct_Color_"+t+" CODE -1 VALUE #"+t+" EDGE #"+t))}return this.materialLibrary[e]||null}applyMaterialsToMesh(e,t,r,i=!1){const n=this,s="16"===t;function o(e,o){if(s&&!(o in r)&&!i)return o;const a=e.isLineSegments||e.isConditionalLine;(!a&&"16"===o||a&&"24"===o)&&(o=t);let l=null;if(o in r)l=r[o];else{if(!i)return o;if(l=n.getMaterial(o),null===l)throw new Error(`LDrawLoader: Material properties for code ${o} not available.`)}return e.isLineSegments&&(l=l.userData.edgeMaterial,e.isConditionalLine&&(l=l.userData.conditionalEdgeMaterial)),l}e.traverse((e=>{if(e.isMesh||e.isLineSegments)if(Array.isArray(e.material))for(let t=0,r=e.material.length;t<r;t++)e.material[t].isMaterial||(e.material[t]=o(e,e.material[t]));else e.material.isMaterial||(e.material=o(e,e.material))}))}getMainMaterial(){return this.getMaterial("16")}getMainEdgeMaterial(){return this.getMaterial("24")}parseColorMetaDirective(t){let r=null,i=16711935,n=16711935,s=1,o=!1,a=0,l=0,c=null;const h=t.getToken();if(!h)throw new Error('LDrawLoader: Material name was expected after "!COLOUR tag'+t.getLineNumberString()+".");let u=null;for(;u=t.getToken(),u;)switch(u.toUpperCase()){case"CODE":r=t.getToken();break;case"VALUE":if(i=t.getToken(),i.startsWith("0x"))i="#"+i.substring(2);else if(!i.startsWith("#"))throw new Error("LDrawLoader: Invalid color while parsing material"+t.getLineNumberString()+".");break;case"EDGE":if(n=t.getToken(),n.startsWith("0x"))n="#"+n.substring(2);else if(!n.startsWith("#")){if(c=this.getMaterial(n),!c)throw new Error("LDrawLoader: Invalid edge color while parsing material"+t.getLineNumberString()+".");c=c.userData.edgeMaterial}break;case"ALPHA":if(s=parseInt(t.getToken()),isNaN(s))throw new Error("LDrawLoader: Invalid alpha value in material definition"+t.getLineNumberString()+".");s=Math.max(0,Math.min(1,s/255)),s<1&&(o=!0);break;case"LUMINANCE":if(a=parseInt(t.getToken()),isNaN(a))throw new Error("LDrawLoader: Invalid luminance value in material definition"+Bp.getLineNumberString()+".");a=Math.max(0,Math.min(1,a/255));break;case"CHROME":l=1;break;case"PEARLESCENT":l=2;break;case"RUBBER":l=3;break;case"MATTE_METALLIC":l=4;break;case"METAL":l=5;break;case"MATERIAL":t.setToEnd();break;default:throw new Error('LDrawLoader: Unknown token "'+u+'" while parsing material'+t.getLineNumberString()+".")}let d=null;switch(l){case 0:d=new e.MeshStandardMaterial({color:i,roughness:.3,metalness:0});break;case 2:d=new e.MeshStandardMaterial({color:i,roughness:.3,metalness:.25});break;case 1:d=new e.MeshStandardMaterial({color:i,roughness:0,metalness:1});break;case 3:d=new e.MeshStandardMaterial({color:i,roughness:.9,metalness:0});break;case 4:d=new e.MeshStandardMaterial({color:i,roughness:.8,metalness:.4});break;case 5:d=new e.MeshStandardMaterial({color:i,roughness:.2,metalness:.85})}return d.transparent=o,d.premultipliedAlpha=!0,d.opacity=s,d.depthWrite=!o,d.polygonOffset=!0,d.polygonOffsetFactor=1,0!==a&&d.emissive.set(d.color).multiplyScalar(a),c||(c=new e.LineBasicMaterial({color:n,transparent:o,opacity:s,depthWrite:!o}),c.userData.code=r,c.name=h+" - Edge",c.userData.conditionalEdgeMaterial=new Cp({fog:!0,transparent:o,depthWrite:!o,color:n,opacity:s})),d.userData.code=r,d.name=h,d.userData.edgeMaterial=c,this.addMaterial(d),d}computeConstructionSteps(e){let t=0;e.traverse((e=>{e.isGroup&&(e.userData.startingConstructionStep&&t++,e.userData.constructionStep=t)})),e.userData.numConstructionSteps=t+1}}function Op(e){this.IFF=e}function kp(e){this.IFF=e}function Vp(){this.debugger=new zp}function Gp(e){this.dv=new DataView(e),this.offset=0}function zp(){this.active=!1,this.depth=0,this.formList=[]}function Hp(e){return e%2}function jp(e){return e.length+1+(Hp(e.length+1)?1:0)}Op.prototype={constructor:Op,parseBlock:function(){this.IFF.debugger.offset=this.IFF.reader.offset,this.IFF.debugger.closeForms();var e=this.IFF.reader.getIDTag(),t=this.IFF.reader.getUint32();switch(this.IFF.debugger.dataOffset=this.IFF.reader.offset,this.IFF.debugger.length=t,e){case"FORM":this.IFF.parseForm(t);break;case"ICON":case"VMPA":case"BBOX":case"NORM":case"PRE ":case"POST":case"KEY ":case"SPAN":case"TIME":case"CLRS":case"CLRA":case"FILT":case"DITH":case"CONT":case"BRIT":case"SATR":case"HUE ":case"GAMM":case"NEGA":case"IFLT":case"PFLT":case"PROJ":case"AXIS":case"AAST":case"PIXB":case"STCK":case"VALU":case"PNAM":case"INAM":case"GRST":case"GREN":case"GRPT":case"FKEY":case"IKEY":case"CSYS":case"OPAQ":case"CMAP":case"NLOC":case"NZOM":case"NVER":case"NSRV":case"NCRD":case"NMOD":case"NSEL":case"NPRW":case"NPLA":case"VERS":case"ENUM":case"TAG ":case"CGMD":case"CGTY":case"CGST":case"CGEN":case"CGTS":case"CGTE":case"OSMP":case"OMDE":case"OUTR":case"FLAG":case"TRNL":case"SHRP":case"RFOP":case"RSAN":case"TROP":case"RBLR":case"TBLR":case"CLRH":case"CLRF":case"ADTR":case"GLOW":case"LINE":case"ALPH":case"VCOL":case"ENAB":this.IFF.debugger.skipped=!0,this.IFF.reader.skip(t);break;case"IPIX":case"IMIP":case"IMOD":case"AMOD":case"IINV":case"INCR":case"IAXS":case"IFOT":case"ITIM":case"IWRL":case"IUTI":case"IINX":case"IINY":case"IINZ":case"IREF":4===t?this.IFF.currentNode[e]=this.IFF.reader.getInt32():this.IFF.reader.skip(t);break;case"OTAG":this.IFF.parseObjectTag();break;case"LAYR":this.IFF.parseLayer(t);break;case"PNTS":this.IFF.parsePoints(t);break;case"VMAP":this.IFF.parseVertexMapping(t);break;case"POLS":this.IFF.parsePolygonList(t);break;case"TAGS":this.IFF.parseTagStrings(t);break;case"PTAG":this.IFF.parsePolygonTagMapping(t);break;case"VMAD":this.IFF.parseVertexMapping(t,!0);break;case"DESC":this.IFF.currentForm.description=this.IFF.reader.getString();break;case"TEXT":case"CMNT":case"NCOM":this.IFF.currentForm.comment=this.IFF.reader.getString();break;case"NAME":this.IFF.currentForm.channelName=this.IFF.reader.getString();break;case"WRAP":this.IFF.currentForm.wrap={w:this.IFF.reader.getUint16(),h:this.IFF.reader.getUint16()};break;case"IMAG":var r=this.IFF.reader.getVariableLengthIndex();this.IFF.currentForm.imageIndex=r;break;case"OREF":this.IFF.currentForm.referenceObject=this.IFF.reader.getString();break;case"ROID":this.IFF.currentForm.referenceObjectID=this.IFF.reader.getUint32();break;case"SSHN":this.IFF.currentSurface.surfaceShaderName=this.IFF.reader.getString();break;case"AOVN":this.IFF.currentSurface.surfaceCustomAOVName=this.IFF.reader.getString();break;case"NSTA":this.IFF.currentForm.disabled=this.IFF.reader.getUint16();break;case"NRNM":this.IFF.currentForm.realName=this.IFF.reader.getString();break;case"NNME":this.IFF.currentForm.refName=this.IFF.reader.getString(),this.IFF.currentSurface.nodes[this.IFF.currentForm.refName]=this.IFF.currentForm;break;case"INME":this.IFF.currentForm.nodeName||(this.IFF.currentForm.nodeName=[]),this.IFF.currentForm.nodeName.push(this.IFF.reader.getString());break;case"IINN":this.IFF.currentForm.inputNodeName||(this.IFF.currentForm.inputNodeName=[]),this.IFF.currentForm.inputNodeName.push(this.IFF.reader.getString());break;case"IINM":this.IFF.currentForm.inputName||(this.IFF.currentForm.inputName=[]),this.IFF.currentForm.inputName.push(this.IFF.reader.getString());break;case"IONM":this.IFF.currentForm.inputOutputName||(this.IFF.currentForm.inputOutputName=[]),this.IFF.currentForm.inputOutputName.push(this.IFF.reader.getString());break;case"FNAM":this.IFF.currentForm.fileName=this.IFF.reader.getString();break;case"CHAN":4===t?this.IFF.currentForm.textureChannel=this.IFF.reader.getIDTag():this.IFF.reader.skip(t);break;case"SMAN":var i=this.IFF.reader.getFloat32();this.IFF.currentSurface.attributes.smooth=!(i<0);break;case"COLR":this.IFF.currentSurface.attributes.Color={value:this.IFF.reader.getFloat32Array(3)},this.IFF.reader.skip(2);break;case"LUMI":this.IFF.currentSurface.attributes.Luminosity={value:this.IFF.reader.getFloat32()},this.IFF.reader.skip(2);break;case"SPEC":this.IFF.currentSurface.attributes.Specular={value:this.IFF.reader.getFloat32()},this.IFF.reader.skip(2);break;case"DIFF":this.IFF.currentSurface.attributes.Diffuse={value:this.IFF.reader.getFloat32()},this.IFF.reader.skip(2);break;case"REFL":this.IFF.currentSurface.attributes.Reflection={value:this.IFF.reader.getFloat32()},this.IFF.reader.skip(2);break;case"GLOS":this.IFF.currentSurface.attributes.Glossiness={value:this.IFF.reader.getFloat32()},this.IFF.reader.skip(2);break;case"TRAN":this.IFF.currentSurface.attributes.opacity=this.IFF.reader.getFloat32(),this.IFF.reader.skip(2);break;case"BUMP":this.IFF.currentSurface.attributes.bumpStrength=this.IFF.reader.getFloat32(),this.IFF.reader.skip(2);break;case"SIDE":this.IFF.currentSurface.attributes.side=this.IFF.reader.getUint16();break;case"RIMG":this.IFF.currentSurface.attributes.reflectionMap=this.IFF.reader.getVariableLengthIndex();break;case"RIND":this.IFF.currentSurface.attributes.refractiveIndex=this.IFF.reader.getFloat32(),this.IFF.reader.skip(2);break;case"TIMG":this.IFF.currentSurface.attributes.refractionMap=this.IFF.reader.getVariableLengthIndex();break;case"IMAP":this.IFF.currentSurface.attributes.imageMapIndex=this.IFF.reader.getUint32();break;case"IUVI":this.IFF.currentNode.UVChannel=this.IFF.reader.getString(t);break;case"IUTL":this.IFF.currentNode.widthWrappingMode=this.IFF.reader.getUint32();break;case"IVTL":this.IFF.currentNode.heightWrappingMode=this.IFF.reader.getUint32();break;default:this.IFF.parseUnknownCHUNK(e,t)}"FORM"!=e&&(this.IFF.debugger.node=1,this.IFF.debugger.nodeID=e,this.IFF.debugger.log()),this.IFF.reader.offset>=this.IFF.currentFormEnd&&(this.IFF.currentForm=this.IFF.parentForm)}},kp.prototype={constructor:kp,parseBlock:function(){this.IFF.debugger.offset=this.IFF.reader.offset,this.IFF.debugger.closeForms();var e=this.IFF.reader.getIDTag(),t=this.IFF.reader.getUint32();switch(t>this.IFF.reader.dv.byteLength-this.IFF.reader.offset&&(this.IFF.reader.offset-=4,t=this.IFF.reader.getUint16()),this.IFF.debugger.dataOffset=this.IFF.reader.offset,this.IFF.debugger.length=t,e){case"FORM":this.IFF.parseForm(t);break;case"ICON":case"VMPA":case"BBOX":case"NORM":case"PRE ":case"POST":case"KEY ":case"SPAN":case"TIME":case"CLRS":case"CLRA":case"FILT":case"DITH":case"CONT":case"BRIT":case"SATR":case"HUE ":case"GAMM":case"NEGA":case"IFLT":case"PFLT":case"PROJ":case"AXIS":case"AAST":case"PIXB":case"AUVO":case"STCK":case"PROC":case"VALU":case"FUNC":case"PNAM":case"INAM":case"GRST":case"GREN":case"GRPT":case"FKEY":case"IKEY":case"CSYS":case"OPAQ":case"CMAP":case"NLOC":case"NZOM":case"NVER":case"NSRV":case"NVSK":case"NCRD":case"WRPW":case"WRPH":case"NMOD":case"NPRW":case"NPLA":case"NODS":case"VERS":case"ENUM":case"TAG ":case"OPAC":case"CGMD":case"CGTY":case"CGST":case"CGEN":case"CGTS":case"CGTE":case"OSMP":case"OMDE":case"OUTR":case"FLAG":case"TRNL":case"GLOW":case"GVAL":case"SHRP":case"RFOP":case"RSAN":case"TROP":case"RBLR":case"TBLR":case"CLRH":case"CLRF":case"ADTR":case"LINE":case"ALPH":case"VCOL":case"ENAB":this.IFF.debugger.skipped=!0,this.IFF.reader.skip(t);break;case"SURF":this.IFF.parseSurfaceLwo2(t);break;case"CLIP":this.IFF.parseClipLwo2(t);break;case"IPIX":case"IMIP":case"IMOD":case"AMOD":case"IINV":case"INCR":case"IAXS":case"IFOT":case"ITIM":case"IWRL":case"IUTI":case"IINX":case"IINY":case"IINZ":case"IREF":4===t?this.IFF.currentNode[e]=this.IFF.reader.getInt32():this.IFF.reader.skip(t);break;case"OTAG":this.IFF.parseObjectTag();break;case"LAYR":this.IFF.parseLayer(t);break;case"PNTS":this.IFF.parsePoints(t);break;case"VMAP":this.IFF.parseVertexMapping(t);break;case"AUVU":case"AUVN":this.IFF.reader.skip(t-1),this.IFF.reader.getVariableLengthIndex();break;case"POLS":this.IFF.parsePolygonList(t);break;case"TAGS":this.IFF.parseTagStrings(t);break;case"PTAG":this.IFF.parsePolygonTagMapping(t);break;case"VMAD":this.IFF.parseVertexMapping(t,!0);break;case"DESC":this.IFF.currentForm.description=this.IFF.reader.getString();break;case"TEXT":case"CMNT":case"NCOM":this.IFF.currentForm.comment=this.IFF.reader.getString();break;case"NAME":this.IFF.currentForm.channelName=this.IFF.reader.getString();break;case"WRAP":this.IFF.currentForm.wrap={w:this.IFF.reader.getUint16(),h:this.IFF.reader.getUint16()};break;case"IMAG":var r=this.IFF.reader.getVariableLengthIndex();this.IFF.currentForm.imageIndex=r;break;case"OREF":this.IFF.currentForm.referenceObject=this.IFF.reader.getString();break;case"ROID":this.IFF.currentForm.referenceObjectID=this.IFF.reader.getUint32();break;case"SSHN":this.IFF.currentSurface.surfaceShaderName=this.IFF.reader.getString();break;case"AOVN":this.IFF.currentSurface.surfaceCustomAOVName=this.IFF.reader.getString();break;case"NSTA":this.IFF.currentForm.disabled=this.IFF.reader.getUint16();break;case"NRNM":this.IFF.currentForm.realName=this.IFF.reader.getString();break;case"NNME":this.IFF.currentForm.refName=this.IFF.reader.getString(),this.IFF.currentSurface.nodes[this.IFF.currentForm.refName]=this.IFF.currentForm;break;case"INME":this.IFF.currentForm.nodeName||(this.IFF.currentForm.nodeName=[]),this.IFF.currentForm.nodeName.push(this.IFF.reader.getString());break;case"IINN":this.IFF.currentForm.inputNodeName||(this.IFF.currentForm.inputNodeName=[]),this.IFF.currentForm.inputNodeName.push(this.IFF.reader.getString());break;case"IINM":this.IFF.currentForm.inputName||(this.IFF.currentForm.inputName=[]),this.IFF.currentForm.inputName.push(this.IFF.reader.getString());break;case"IONM":this.IFF.currentForm.inputOutputName||(this.IFF.currentForm.inputOutputName=[]),this.IFF.currentForm.inputOutputName.push(this.IFF.reader.getString());break;case"FNAM":this.IFF.currentForm.fileName=this.IFF.reader.getString();break;case"CHAN":4===t?this.IFF.currentForm.textureChannel=this.IFF.reader.getIDTag():this.IFF.reader.skip(t);break;case"SMAN":var i=this.IFF.reader.getFloat32();this.IFF.currentSurface.attributes.smooth=!(i<0);break;case"COLR":this.IFF.currentSurface.attributes.Color={value:this.IFF.reader.getFloat32Array(3)},this.IFF.reader.skip(2);break;case"LUMI":this.IFF.currentSurface.attributes.Luminosity={value:this.IFF.reader.getFloat32()},this.IFF.reader.skip(2);break;case"SPEC":this.IFF.currentSurface.attributes.Specular={value:this.IFF.reader.getFloat32()},this.IFF.reader.skip(2);break;case"DIFF":this.IFF.currentSurface.attributes.Diffuse={value:this.IFF.reader.getFloat32()},this.IFF.reader.skip(2);break;case"REFL":this.IFF.currentSurface.attributes.Reflection={value:this.IFF.reader.getFloat32()},this.IFF.reader.skip(2);break;case"GLOS":this.IFF.currentSurface.attributes.Glossiness={value:this.IFF.reader.getFloat32()},this.IFF.reader.skip(2);break;case"TRAN":this.IFF.currentSurface.attributes.opacity=this.IFF.reader.getFloat32(),this.IFF.reader.skip(2);break;case"BUMP":this.IFF.currentSurface.attributes.bumpStrength=this.IFF.reader.getFloat32(),this.IFF.reader.skip(2);break;case"SIDE":this.IFF.currentSurface.attributes.side=this.IFF.reader.getUint16();break;case"RIMG":this.IFF.currentSurface.attributes.reflectionMap=this.IFF.reader.getVariableLengthIndex();break;case"RIND":this.IFF.currentSurface.attributes.refractiveIndex=this.IFF.reader.getFloat32(),this.IFF.reader.skip(2);break;case"TIMG":this.IFF.currentSurface.attributes.refractionMap=this.IFF.reader.getVariableLengthIndex();break;case"IMAP":this.IFF.reader.skip(2);break;case"TMAP":this.IFF.debugger.skipped=!0,this.IFF.reader.skip(t);break;case"IUVI":this.IFF.currentNode.UVChannel=this.IFF.reader.getString(t);break;case"IUTL":this.IFF.currentNode.widthWrappingMode=this.IFF.reader.getUint32();break;case"IVTL":this.IFF.currentNode.heightWrappingMode=this.IFF.reader.getUint32();break;case"BLOK":break;default:this.IFF.parseUnknownCHUNK(e,t)}"FORM"!=e&&(this.IFF.debugger.node=1,this.IFF.debugger.nodeID=e,this.IFF.debugger.log()),this.IFF.reader.offset>=this.IFF.currentFormEnd&&(this.IFF.currentForm=this.IFF.parentForm)}},Vp.prototype={constructor:Vp,parse:function(e){if(this.reader=new Gp(e),this.tree={materials:{},layers:[],tags:[],textures:[]},this.currentLayer=this.tree,this.currentForm=this.tree,this.parseTopForm(),void 0!==this.tree.format){if("LWO2"===this.tree.format)for(this.parser=new kp(this);!this.reader.endOfFile();)this.parser.parseBlock();else if("LWO3"===this.tree.format)for(this.parser=new Op(this);!this.reader.endOfFile();)this.parser.parseBlock();return this.debugger.offset=this.reader.offset,this.debugger.closeForms(),this.tree}},parseTopForm(){if(this.debugger.offset=this.reader.offset,"FORM"===this.reader.getIDTag()){var e=this.reader.getUint32();this.debugger.dataOffset=this.reader.offset,this.debugger.length=e;var t=this.reader.getIDTag();("LWO2"===t||"LWO3"===t)&&(this.tree.format=t),this.debugger.node=0,this.debugger.nodeID=t,this.debugger.log()}else console.warn("LWOLoader: Top-level FORM missing.")},parseForm(e){var t=this.reader.getIDTag();switch(t){case"ISEQ":case"ANIM":case"STCC":case"VPVL":case"VPRM":case"NROT":case"WRPW":case"WRPH":case"FUNC":case"FALL":case"OPAC":case"GRAD":case"ENVS":case"VMOP":case"VMBG":case"OMAX":case"STEX":case"CKBG":case"CKEY":case"VMLA":case"VMLB":this.debugger.skipped=!0,this.skipForm(e);break;case"META":case"NNDS":case"NODS":case"NDTA":case"ADAT":case"AOVS":case"BLOK":case"IBGC":case"IOPC":case"IIMG":case"TXTR":this.debugger.length=4,this.debugger.skipped=!0;break;case"IFAL":case"ISCL":case"IPOS":case"IROT":case"IBMP":case"IUTD":case"IVTD":this.parseTextureNodeAttribute(t);break;case"ENVL":this.parseEnvelope(e);break;case"CLIP":"LWO2"===this.tree.format?this.parseForm(e):this.parseClip(e);break;case"STIL":this.parseImage();break;case"XREF":this.reader.skip(8),this.currentForm.referenceTexture={index:this.reader.getUint32(),refName:this.reader.getString()};break;case"IMST":this.parseImageStateForm(e);break;case"SURF":this.parseSurfaceForm(e);break;case"VALU":this.parseValueForm(e);break;case"NTAG":this.parseSubNode(e);break;case"ATTR":case"SATR":this.setupForm("attributes",e);break;case"NCON":this.parseConnections(e);break;case"SSHA":this.parentForm=this.currentForm,this.currentForm=this.currentSurface,this.setupForm("surfaceShader",e);break;case"SSHD":this.setupForm("surfaceShaderData",e);break;case"ENTR":this.parseEntryForm(e);break;case"IMAP":this.parseImageMap(e);break;case"TAMP":this.parseXVAL("amplitude",e);break;case"TMAP":this.setupForm("textureMap",e);break;case"CNTR":this.parseXVAL3("center",e);break;case"SIZE":this.parseXVAL3("scale",e);break;case"ROTA":this.parseXVAL3("rotation",e);break;default:this.parseUnknownForm(t,e)}this.debugger.node=0,this.debugger.nodeID=t,this.debugger.log()},setupForm(e,t){this.currentForm||(this.currentForm=this.currentNode),this.currentFormEnd=this.reader.offset+t,this.parentForm=this.currentForm,this.currentForm[e]?(console.warn("LWOLoader: form already exists on parent: ",e,this.currentForm),this.currentForm=this.currentForm[e]):(this.currentForm[e]={},this.currentForm=this.currentForm[e])},skipForm(e){this.reader.skip(e-4)},parseUnknownForm(t,r){console.warn("LWOLoader: unknown FORM encountered: "+t,r),function(t,r,i){console.log(e.LoaderUtils.decodeText(new Uint8Array(t,r,i)))}(this.reader.dv.buffer,this.reader.offset,r-4),this.reader.skip(r-4)},parseSurfaceForm(e){this.reader.skip(8);var t=this.reader.getString(),r={attributes:{},connections:{},name:t,inputName:t,nodes:{},source:this.reader.getString()};this.tree.materials[t]=r,this.currentSurface=r,this.parentForm=this.tree.materials,this.currentForm=r,this.currentFormEnd=this.reader.offset+e},parseSurfaceLwo2(e){var t=this.reader.getString(),r={attributes:{},connections:{},name:t,nodes:{},source:this.reader.getString()};this.tree.materials[t]=r,this.currentSurface=r,this.parentForm=this.tree.materials,this.currentForm=r,this.currentFormEnd=this.reader.offset+e},parseSubNode(e){this.reader.skip(8);var t={name:this.reader.getString()};this.currentForm=t,this.currentNode=t,this.currentFormEnd=this.reader.offset+e},parseConnections(e){this.currentFormEnd=this.reader.offset+e,this.parentForm=this.currentForm,this.currentForm=this.currentSurface.connections},parseEntryForm(e){this.reader.skip(8);var t=this.reader.getString();this.currentForm=this.currentNode.attributes,this.setupForm(t,e)},parseValueForm(){this.reader.skip(8);var e=this.reader.getString();"double"===e?this.currentForm.value=this.reader.getUint64():"int"===e?this.currentForm.value=this.reader.getUint32():"vparam"===e?(this.reader.skip(24),this.currentForm.value=this.reader.getFloat64()):"vparam3"===e&&(this.reader.skip(24),this.currentForm.value=this.reader.getFloat64Array(3))},parseImageStateForm(){this.reader.skip(8),this.currentForm.mipMapLevel=this.reader.getFloat32()},parseImageMap(e){this.currentFormEnd=this.reader.offset+e,this.parentForm=this.currentForm,this.currentForm.maps||(this.currentForm.maps=[]);var t={};this.currentForm.maps.push(t),this.currentForm=t,this.reader.skip(10)},parseTextureNodeAttribute(e){switch(this.reader.skip(28),this.reader.skip(20),e){case"ISCL":this.currentNode.scale=this.reader.getFloat32Array(3);break;case"IPOS":this.currentNode.position=this.reader.getFloat32Array(3);break;case"IROT":this.currentNode.rotation=this.reader.getFloat32Array(3);break;case"IFAL":this.currentNode.falloff=this.reader.getFloat32Array(3);break;case"IBMP":this.currentNode.amplitude=this.reader.getFloat32();break;case"IUTD":this.currentNode.uTiles=this.reader.getFloat32();break;case"IVTD":this.currentNode.vTiles=this.reader.getFloat32()}this.reader.skip(2)},parseEnvelope(e){this.reader.skip(e-4)},parseClip(e){if("FORM"===this.reader.getIDTag())return this.reader.skip(16),void(this.currentNode.fileName=this.reader.getString());this.reader.setOffset(this.reader.offset-4),this.currentFormEnd=this.reader.offset+e,this.parentForm=this.currentForm,this.reader.skip(8);var t={index:this.reader.getUint32()};this.tree.textures.push(t),this.currentForm=t},parseClipLwo2(e){for(var t={index:this.reader.getUint32(),fileName:""};;){var r=this.reader.getIDTag(),i=this.reader.getUint16();if("STIL"===r){t.fileName=this.reader.getString();break}if(i>=e)break}this.tree.textures.push(t),this.currentForm=t},parseImage(){this.reader.skip(8),this.currentForm.fileName=this.reader.getString()},parseXVAL(e,t){var r=this.reader.offset+t-4;this.reader.skip(8),this.currentForm[e]=this.reader.getFloat32(),this.reader.setOffset(r)},parseXVAL3(e,t){var r=this.reader.offset+t-4;this.reader.skip(8),this.currentForm[e]={x:this.reader.getFloat32(),y:this.reader.getFloat32(),z:this.reader.getFloat32()},this.reader.setOffset(r)},parseObjectTag(){this.tree.objectTags||(this.tree.objectTags={}),this.tree.objectTags[this.reader.getIDTag()]={tagString:this.reader.getString()}},parseLayer(e){var t={number:this.reader.getUint16(),flags:this.reader.getUint16(),pivot:this.reader.getFloat32Array(3),name:this.reader.getString()};this.tree.layers.push(t),this.currentLayer=t;var r=16+jp(this.currentLayer.name);this.currentLayer.parent=r<e?this.reader.getUint16():-1},parsePoints(e){this.currentPoints=[];for(let t=0;t<e/4;t+=3)this.currentPoints.push(this.reader.getFloat32(),this.reader.getFloat32(),-this.reader.getFloat32())},parseVertexMapping(e,t){var r=this.reader.offset+e,i=this.reader.getString();if(this.reader.offset!==r){this.reader.setOffset(this.reader.offset-jp(i));var n=this.reader.getIDTag();this.reader.getUint16();var s=this.reader.getString(),o=e-6-jp(s);switch(n){case"TXUV":this.parseUVMapping(s,r,t);break;case"MORF":case"SPOT":this.parseMorphTargets(s,r,n);break;case"APSL":case"NORM":case"WGHT":case"MNVW":case"PICK":case"RGB ":case"RGBA":this.reader.skip(o);break;default:console.warn("LWOLoader: unknown vertex map type: "+n),this.reader.skip(o)}}else this.currentForm.UVChannel=i},parseUVMapping(e,t,r){for(var i=[],n=[],s=[];this.reader.offset<t;)i.push(this.reader.getVariableLengthIndex()),r&&n.push(this.reader.getVariableLengthIndex()),s.push(this.reader.getFloat32(),this.reader.getFloat32());r?(this.currentLayer.discontinuousUVs||(this.currentLayer.discontinuousUVs={}),this.currentLayer.discontinuousUVs[e]={uvIndices:i,polyIndices:n,uvs:s}):(this.currentLayer.uvs||(this.currentLayer.uvs={}),this.currentLayer.uvs[e]={uvIndices:i,uvs:s})},parseMorphTargets(e,t,r){var i=[],n=[];for(r="MORF"===r?"relative":"absolute";this.reader.offset<t;)i.push(this.reader.getVariableLengthIndex()),n.push(this.reader.getFloat32(),this.reader.getFloat32(),-this.reader.getFloat32());this.currentLayer.morphTargets||(this.currentLayer.morphTargets={}),this.currentLayer.morphTargets[e]={indices:i,points:n,type:r}},parsePolygonList(e){for(var t=this.reader.offset+e,r=this.reader.getIDTag(),i=[],n=[];this.reader.offset<t;){var s=this.reader.getUint16();s&=1023,n.push(s);for(let e=0;e<s;e++)i.push(this.reader.getVariableLengthIndex())}var o={type:r,vertexIndices:i,polygonDimensions:n,points:this.currentPoints};1===n[0]?o.type="points":2===n[0]&&(o.type="lines"),this.currentLayer.geometry=o},parseTagStrings(e){this.tree.tags=this.reader.getStringArray(e)},parsePolygonTagMapping(e){var t=this.reader.offset+e;"SURF"===this.reader.getIDTag()?this.parseMaterialIndices(t):this.reader.skip(e-4)},parseMaterialIndices(e){for(this.currentLayer.geometry.materialIndices=[];this.reader.offset<e;){var t=this.reader.getVariableLengthIndex(),r=this.reader.getUint16();this.currentLayer.geometry.materialIndices.push(t,r)}},parseUnknownCHUNK(e,t){console.warn("LWOLoader: unknown chunk type: "+e+" length: "+t);var r=this.reader.getString(t);this.currentForm[e]=r}},Gp.prototype={constructor:Gp,size:function(){return this.dv.buffer.byteLength},setOffset(e){e>0&&e<this.dv.buffer.byteLength?this.offset=e:console.error("LWOLoader: invalid buffer offset")},endOfFile:function(){return this.offset>=this.size()},skip:function(e){this.offset+=e},getUint8:function(){var e=this.dv.getUint8(this.offset);return this.offset+=1,e},getUint16:function(){var e=this.dv.getUint16(this.offset);return this.offset+=2,e},getInt32:function(){var e=this.dv.getInt32(this.offset,!1);return this.offset+=4,e},getUint32:function(){var e=this.dv.getUint32(this.offset,!1);return this.offset+=4,e},getUint64:function(){return 4294967296*this.getUint32()+this.getUint32()},getFloat32:function(){var e=this.dv.getFloat32(this.offset,!1);return this.offset+=4,e},getFloat32Array:function(e){var t=[];for(let r=0;r<e;r++)t.push(this.getFloat32());return t},getFloat64:function(){var e=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e},getFloat64Array:function(e){var t=[];for(let r=0;r<e;r++)t.push(this.getFloat64());return t},getVariableLengthIndex(){var e=this.getUint8();return 255===e?65536*this.getUint8()+256*this.getUint8()+this.getUint8():256*e+this.getUint8()},getIDTag(){return this.getString(4)},getString:function(t){if(0!==t){var r=[];if(t)for(let e=0;e<t;e++)r[e]=this.getUint8();else{for(var i,n=0;0!==i;)0!==(i=this.getUint8())&&r.push(i),n++;Hp(n+1)||this.getUint8()}return e.LoaderUtils.decodeText(new Uint8Array(r))}},getStringArray:function(e){var t=this.getString(e);return(t=t.split("\0")).filter(Boolean)}},zp.prototype={constructor:zp,enable:function(){this.active=!0},log:function(){if(this.active){var e;switch(this.node){case 0:e="FORM";break;case 1:e="CHK";break;case 2:e="S-CHK"}console.log("| ".repeat(this.depth)+e,this.nodeID,`( ${this.offset} ) -> ( ${this.dataOffset+this.length} )`,0==this.node?" {":"",this.skipped?"SKIPPED":"",0==this.node&&this.skipped?"}":""),0!=this.node||this.skipped||(this.depth+=1,this.formList.push(this.dataOffset+this.length)),this.skipped=!1}},closeForms:function(){if(this.active)for(let e=this.formList.length-1;e>=0;e--)this.offset>=this.formList[e]&&(this.depth-=1,console.log("| ".repeat(this.depth)+"}"),this.formList.splice(-1,1))}};class Wp extends e.Loader{constructor(e){super(e),this.defaultDPI=90,this.defaultUnit="px"}load(t,r,i,n){const s=this,o=new e.FileLoader(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(t,(function(e){try{r(s.parse(e))}catch(e){n?n(e):console.error(e),s.manager.itemError(t)}}),i,n)}parse(t){const r=this;function i(e,t,r,i,s,o,a,l){if(0==t||0==r)return void e.lineTo(l.x,l.y);i=i*Math.PI/180,t=Math.abs(t),r=Math.abs(r);const c=(a.x-l.x)/2,h=(a.y-l.y)/2,u=Math.cos(i)*c+Math.sin(i)*h,d=-Math.sin(i)*c+Math.cos(i)*h;let p=t*t,m=r*r;const f=u*u,g=d*d,v=f/p+g/m;if(v>1){const e=Math.sqrt(v);p=(t*=e)*t,m=(r*=e)*r}const x=p*g+m*f,y=(p*m-x)/x;let b=Math.sqrt(Math.max(0,y));s===o&&(b=-b);const A=b*t*d/r,w=-b*r*u/t,M=Math.cos(i)*A-Math.sin(i)*w+(a.x+l.x)/2,T=Math.sin(i)*A+Math.cos(i)*w+(a.y+l.y)/2,S=n(1,0,(u-A)/t,(d-w)/r),C=n((u-A)/t,(d-w)/r,(-u-A)/t,(-d-w)/r)%(2*Math.PI);e.currentPath.absellipse(M,T,t,r,S,S+C,0===o,i)}function n(e,t,r,i){const n=e*r+t*i,s=Math.sqrt(e*e+t*t)*Math.sqrt(r*r+i*i);let o=Math.acos(Math.max(-1,Math.min(1,n/s)));return e*i-t*r<0&&(o=-o),o}function s(e,t){t=Object.assign({},t);let r={};if(e.hasAttribute("class")){const t=e.getAttribute("class").split(/\s/).filter(Boolean).map((e=>e.trim()));for(let e=0;e<t.length;e++)r=Object.assign(r,m["."+t[e]])}function i(i,n,s){void 0===s&&(s=function(e){return e.startsWith("url")&&console.warn("SVGLoader: url access in attributes is not implemented."),e}),e.hasAttribute(i)&&(t[n]=s(e.getAttribute(i))),r[i]&&(t[n]=s(r[i])),e.style&&""!==e.style[i]&&(t[n]=s(e.style[i]))}function n(e){return Math.max(0,Math.min(1,h(e)))}function s(e){return Math.max(0,h(e))}return e.hasAttribute("id")&&(r=Object.assign(r,m["#"+e.getAttribute("id")])),i("fill","fill"),i("fill-opacity","fillOpacity",n),i("fill-rule","fillRule"),i("opacity","opacity",n),i("stroke","stroke"),i("stroke-opacity","strokeOpacity",n),i("stroke-width","strokeWidth",s),i("stroke-linejoin","strokeLineJoin"),i("stroke-linecap","strokeLineCap"),i("stroke-miterlimit","strokeMiterLimit",s),i("visibility","visibility"),t}function o(e,t){return e-(t-e)}function a(e,t,r){if("string"!=typeof e)throw new TypeError("Invalid input: "+typeof e);const i={SEPARATOR:/[ \t\r\n\,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/[\d]/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};let n=0,s=!0,o="",a="";const l=[];function c(e,t,r){const i=new SyntaxError('Unexpected character "'+e+'" at index '+t+".");throw i.partial=r,i}function h(){""!==o&&(""===a?l.push(Number(o)):l.push(Number(o)*Math.pow(10,Number(a)))),o="",a=""}let u;const d=e.length;for(let p=0;p<d;p++)if(u=e[p],Array.isArray(t)&&t.includes(l.length%r)&&i.FLAGS.test(u))n=1,o=u,h();else{if(0===n){if(i.WHITESPACE.test(u))continue;if(i.DIGIT.test(u)||i.SIGN.test(u)){n=1,o=u;continue}if(i.POINT.test(u)){n=2,o=u;continue}i.COMMA.test(u)&&(s&&c(u,p,l),s=!0)}if(1===n){if(i.DIGIT.test(u)){o+=u;continue}if(i.POINT.test(u)){o+=u,n=2;continue}if(i.EXP.test(u)){n=3;continue}i.SIGN.test(u)&&1===o.length&&i.SIGN.test(o[0])&&c(u,p,l)}if(2===n){if(i.DIGIT.test(u)){o+=u;continue}if(i.EXP.test(u)){n=3;continue}i.POINT.test(u)&&"."===o[o.length-1]&&c(u,p,l)}if(3===n){if(i.DIGIT.test(u)){a+=u;continue}if(i.SIGN.test(u)){if(""===a){a+=u;continue}1===a.length&&i.SIGN.test(a)&&c(u,p,l)}}i.WHITESPACE.test(u)?(h(),n=0,s=!1):i.COMMA.test(u)?(h(),n=0,s=!0):i.SIGN.test(u)?(h(),n=1,o=u):i.POINT.test(u)?(h(),n=2,o=u):c(u,p,l)}return h(),l}const l=["mm","cm","in","pt","pc","px"],c={mm:{mm:1,cm:.1,in:1/25.4,pt:72/25.4,pc:6/25.4,px:-1},cm:{mm:10,cm:1,in:1/2.54,pt:72/2.54,pc:6/2.54,px:-1},in:{mm:25.4,cm:2.54,in:1,pt:72,pc:6,px:-1},pt:{mm:25.4/72,cm:2.54/72,in:1/72,pt:1,pc:6/72,px:-1},pc:{mm:25.4/6,cm:2.54/6,in:1/6,pt:12,pc:1,px:-1},px:{px:1}};function h(e){let t,i="px";if("string"==typeof e||e instanceof String)for(let t=0,r=l.length;t<r;t++){const r=l[t];if(e.endsWith(r)){i=r,e=e.substring(0,e.length-r.length);break}}return"px"===i&&"px"!==r.defaultUnit?t=c.in[r.defaultUnit]/r.defaultDPI:(t=c[i][r.defaultUnit],t<0&&(t=c[i].in*r.defaultDPI)),t*parseFloat(e)}function u(e){const t=e.elements;return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function d(e){const t=e.elements;return Math.sqrt(t[3]*t[3]+t[4]*t[4])}const p=[],m={},f=[],g=new e.Matrix3,v=new e.Matrix3,x=new e.Matrix3,y=new e.Matrix3,b=new e.Vector2,A=new e.Vector3,w=new e.Matrix3,M=(new DOMParser).parseFromString(t,"image/svg+xml");!function t(r,n){if(1!==r.nodeType)return;const l=function(t){if(!(t.hasAttribute("transform")||"use"===t.nodeName&&(t.hasAttribute("x")||t.hasAttribute("y"))))return null;const r=function(t){const r=new e.Matrix3,i=g;if("use"===t.nodeName&&(t.hasAttribute("x")||t.hasAttribute("y"))){const e=h(t.getAttribute("x")),i=h(t.getAttribute("y"));r.translate(e,i)}if(t.hasAttribute("transform")){const e=t.getAttribute("transform").split(")");for(let t=e.length-1;t>=0;t--){const n=e[t].trim();if(""===n)continue;const s=n.indexOf("("),o=n.length;if(s>0&&s<o){const e=n.substr(0,s),t=a(n.substr(s+1,o-s-1));switch(i.identity(),e){case"translate":if(t.length>=1){const e=t[0];let r=e;t.length>=2&&(r=t[1]),i.translate(e,r)}break;case"rotate":if(t.length>=1){let e=0,r=0,n=0;e=-t[0]*Math.PI/180,t.length>=3&&(r=t[1],n=t[2]),v.identity().translate(-r,-n),x.identity().rotate(e),y.multiplyMatrices(x,v),v.identity().translate(r,n),i.multiplyMatrices(v,y)}break;case"scale":if(t.length>=1){const e=t[0];let r=e;t.length>=2&&(r=t[1]),i.scale(e,r)}break;case"skewX":1===t.length&&i.set(1,Math.tan(t[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":1===t.length&&i.set(1,0,0,Math.tan(t[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":6===t.length&&i.set(t[0],t[2],t[4],t[1],t[3],t[5],0,0,1)}}r.premultiply(i)}}return r}(t);f.length>0&&r.premultiply(f[f.length-1]);return w.copy(r),f.push(r),r}(r);let c=!0,M=null;switch(r.nodeName){case"svg":break;case"style":!function(e){if(!e.sheet||!e.sheet.cssRules||!e.sheet.cssRules.length)return;for(let t=0;t<e.sheet.cssRules.length;t++){const r=e.sheet.cssRules[t];if(1!==r.type)continue;const i=r.selectorText.split(/,/gm).filter(Boolean).map((e=>e.trim()));for(let e=0;e<i.length;e++)m[i[e]]=Object.assign(m[i[e]]||{},r.style)}}(r);break;case"g":n=s(r,n);break;case"path":n=s(r,n),r.hasAttribute("d")&&(M=function(t){const r=new e.ShapePath,n=new e.Vector2,s=new e.Vector2,l=new e.Vector2;let c=!0,h=!1;const u=t.getAttribute("d").match(/[a-df-z][^a-df-z]*/gi);for(let e=0,t=u.length;e<t;e++){const t=u[e],d=t.charAt(0),p=t.substr(1).trim();let m;switch(!0===c&&(h=!0,c=!1),d){case"M":m=a(p);for(let e=0,t=m.length;e<t;e+=2)n.x=m[e+0],n.y=m[e+1],s.x=n.x,s.y=n.y,0===e?r.moveTo(n.x,n.y):r.lineTo(n.x,n.y),0===e&&l.copy(n);break;case"H":m=a(p);for(let e=0,t=m.length;e<t;e++)n.x=m[e],s.x=n.x,s.y=n.y,r.lineTo(n.x,n.y),0===e&&!0===h&&l.copy(n);break;case"V":m=a(p);for(let e=0,t=m.length;e<t;e++)n.y=m[e],s.x=n.x,s.y=n.y,r.lineTo(n.x,n.y),0===e&&!0===h&&l.copy(n);break;case"L":m=a(p);for(let e=0,t=m.length;e<t;e+=2)n.x=m[e+0],n.y=m[e+1],s.x=n.x,s.y=n.y,r.lineTo(n.x,n.y),0===e&&!0===h&&l.copy(n);break;case"C":m=a(p);for(let e=0,t=m.length;e<t;e+=6)r.bezierCurveTo(m[e+0],m[e+1],m[e+2],m[e+3],m[e+4],m[e+5]),s.x=m[e+2],s.y=m[e+3],n.x=m[e+4],n.y=m[e+5],0===e&&!0===h&&l.copy(n);break;case"S":m=a(p);for(let e=0,t=m.length;e<t;e+=4)r.bezierCurveTo(o(n.x,s.x),o(n.y,s.y),m[e+0],m[e+1],m[e+2],m[e+3]),s.x=m[e+0],s.y=m[e+1],n.x=m[e+2],n.y=m[e+3],0===e&&!0===h&&l.copy(n);break;case"Q":m=a(p);for(let e=0,t=m.length;e<t;e+=4)r.quadraticCurveTo(m[e+0],m[e+1],m[e+2],m[e+3]),s.x=m[e+0],s.y=m[e+1],n.x=m[e+2],n.y=m[e+3],0===e&&!0===h&&l.copy(n);break;case"T":m=a(p);for(let e=0,t=m.length;e<t;e+=2){const t=o(n.x,s.x),i=o(n.y,s.y);r.quadraticCurveTo(t,i,m[e+0],m[e+1]),s.x=t,s.y=i,n.x=m[e+0],n.y=m[e+1],0===e&&!0===h&&l.copy(n)}break;case"A":m=a(p,[3,4],7);for(let e=0,t=m.length;e<t;e+=7){if(m[e+5]==n.x&&m[e+6]==n.y)continue;const t=n.clone();n.x=m[e+5],n.y=m[e+6],s.x=n.x,s.y=n.y,i(r,m[e],m[e+1],m[e+2],m[e+3],m[e+4],t,n),0===e&&!0===h&&l.copy(n)}break;case"m":m=a(p);for(let e=0,t=m.length;e<t;e+=2)n.x+=m[e+0],n.y+=m[e+1],s.x=n.x,s.y=n.y,0===e?r.moveTo(n.x,n.y):r.lineTo(n.x,n.y),0===e&&l.copy(n);break;case"h":m=a(p);for(let e=0,t=m.length;e<t;e++)n.x+=m[e],s.x=n.x,s.y=n.y,r.lineTo(n.x,n.y),0===e&&!0===h&&l.copy(n);break;case"v":m=a(p);for(let e=0,t=m.length;e<t;e++)n.y+=m[e],s.x=n.x,s.y=n.y,r.lineTo(n.x,n.y),0===e&&!0===h&&l.copy(n);break;case"l":m=a(p);for(let e=0,t=m.length;e<t;e+=2)n.x+=m[e+0],n.y+=m[e+1],s.x=n.x,s.y=n.y,r.lineTo(n.x,n.y),0===e&&!0===h&&l.copy(n);break;case"c":m=a(p);for(let e=0,t=m.length;e<t;e+=6)r.bezierCurveTo(n.x+m[e+0],n.y+m[e+1],n.x+m[e+2],n.y+m[e+3],n.x+m[e+4],n.y+m[e+5]),s.x=n.x+m[e+2],s.y=n.y+m[e+3],n.x+=m[e+4],n.y+=m[e+5],0===e&&!0===h&&l.copy(n);break;case"s":m=a(p);for(let e=0,t=m.length;e<t;e+=4)r.bezierCurveTo(o(n.x,s.x),o(n.y,s.y),n.x+m[e+0],n.y+m[e+1],n.x+m[e+2],n.y+m[e+3]),s.x=n.x+m[e+0],s.y=n.y+m[e+1],n.x+=m[e+2],n.y+=m[e+3],0===e&&!0===h&&l.copy(n);break;case"q":m=a(p);for(let e=0,t=m.length;e<t;e+=4)r.quadraticCurveTo(n.x+m[e+0],n.y+m[e+1],n.x+m[e+2],n.y+m[e+3]),s.x=n.x+m[e+0],s.y=n.y+m[e+1],n.x+=m[e+2],n.y+=m[e+3],0===e&&!0===h&&l.copy(n);break;case"t":m=a(p);for(let e=0,t=m.length;e<t;e+=2){const t=o(n.x,s.x),i=o(n.y,s.y);r.quadraticCurveTo(t,i,n.x+m[e+0],n.y+m[e+1]),s.x=t,s.y=i,n.x=n.x+m[e+0],n.y=n.y+m[e+1],0===e&&!0===h&&l.copy(n)}break;case"a":m=a(p,[3,4],7);for(let e=0,t=m.length;e<t;e+=7){if(0==m[e+5]&&0==m[e+6])continue;const t=n.clone();n.x+=m[e+5],n.y+=m[e+6],s.x=n.x,s.y=n.y,i(r,m[e],m[e+1],m[e+2],m[e+3],m[e+4],t,n),0===e&&!0===h&&l.copy(n)}break;case"Z":case"z":r.currentPath.autoClose=!0,r.currentPath.curves.length>0&&(n.copy(l),r.currentPath.currentPoint.copy(n),c=!0);break;default:console.warn(t)}h=!1}return r}(r));break;case"rect":n=s(r,n),M=function(t){const r=h(t.getAttribute("x")||0),i=h(t.getAttribute("y")||0),n=h(t.getAttribute("rx")||t.getAttribute("ry")||0),s=h(t.getAttribute("ry")||t.getAttribute("rx")||0),o=h(t.getAttribute("width")),a=h(t.getAttribute("height")),l=.448084975506,c=new e.ShapePath;c.moveTo(r+n,i),c.lineTo(r+o-n,i),(0!==n||0!==s)&&c.bezierCurveTo(r+o-n*l,i,r+o,i+s*l,r+o,i+s);c.lineTo(r+o,i+a-s),(0!==n||0!==s)&&c.bezierCurveTo(r+o,i+a-s*l,r+o-n*l,i+a,r+o-n,i+a);c.lineTo(r+n,i+a),(0!==n||0!==s)&&c.bezierCurveTo(r+n*l,i+a,r,i+a-s*l,r,i+a-s);c.lineTo(r,i+s),(0!==n||0!==s)&&c.bezierCurveTo(r,i+s*l,r+n*l,i,r+n,i);return c}(r);break;case"polygon":n=s(r,n),M=function(t){function r(e,t,r){const i=h(t),o=h(r);0===s?n.moveTo(i,o):n.lineTo(i,o),s++}const i=/(-?[\d\.?]+)[,|\s](-?[\d\.?]+)/g,n=new e.ShapePath;let s=0;return t.getAttribute("points").replace(i,r),n.currentPath.autoClose=!0,n}(r);break;case"polyline":n=s(r,n),M=function(t){function r(e,t,r){const i=h(t),o=h(r);0===s?n.moveTo(i,o):n.lineTo(i,o),s++}const i=/(-?[\d\.?]+)[,|\s](-?[\d\.?]+)/g,n=new e.ShapePath;let s=0;return t.getAttribute("points").replace(i,r),n.currentPath.autoClose=!1,n}(r);break;case"circle":n=s(r,n),M=function(t){const r=h(t.getAttribute("cx")||0),i=h(t.getAttribute("cy")||0),n=h(t.getAttribute("r")||0),s=new e.Path;s.absarc(r,i,n,0,2*Math.PI);const o=new e.ShapePath;return o.subPaths.push(s),o}(r);break;case"ellipse":n=s(r,n),M=function(t){const r=h(t.getAttribute("cx")||0),i=h(t.getAttribute("cy")||0),n=h(t.getAttribute("rx")||0),s=h(t.getAttribute("ry")||0),o=new e.Path;o.absellipse(r,i,n,s,0,2*Math.PI);const a=new e.ShapePath;return a.subPaths.push(o),a}(r);break;case"line":n=s(r,n),M=function(t){const r=h(t.getAttribute("x1")||0),i=h(t.getAttribute("y1")||0),n=h(t.getAttribute("x2")||0),s=h(t.getAttribute("y2")||0),o=new e.ShapePath;return o.moveTo(r,i),o.lineTo(n,s),o.currentPath.autoClose=!1,o}(r);break;case"defs":case"mask":c=!1;break;case"use":n=s(r,n);const l=r.href.baseVal.substring(1),u=r.viewportElement.getElementById(l);u?t(u,n):console.warn("SVGLoader: 'use node' references non-existent node id: "+l)}if(M&&(void 0!==n.fill&&"none"!==n.fill&&M.color.setStyle(n.fill),function(e,t){function r(e){A.set(e.x,e.y,1).applyMatrix3(t),e.set(A.x,A.y)}const i=function(e){return 0!==e.elements[1]||0!==e.elements[3]}(t),n=e.subPaths;for(let e=0,s=n.length;e<s;e++){const s=n[e].curves;for(let e=0;e<s.length;e++){const n=s[e];n.isLineCurve?(r(n.v1),r(n.v2)):n.isCubicBezierCurve?(r(n.v0),r(n.v1),r(n.v2),r(n.v3)):n.isQuadraticBezierCurve?(r(n.v0),r(n.v1),r(n.v2)):n.isEllipseCurve&&(i&&console.warn("SVGLoader: Elliptic arc or ellipse rotation or skewing is not implemented."),b.set(n.aX,n.aY),r(b),n.aX=b.x,n.aY=b.y,n.xRadius*=u(t),n.yRadius*=d(t))}}}(M,w),p.push(M),M.userData={node:r,style:n}),c){const e=r.childNodes;for(let r=0;r<e.length;r++)t(e[r],n)}l&&(f.pop(),f.length>0?w.copy(f[f.length-1]):w.identity())}(M.documentElement,{fill:"#000",fillOpacity:1,strokeOpacity:1,strokeWidth:1,strokeLineJoin:"miter",strokeLineCap:"butt",strokeMiterLimit:4});return{paths:p,xml:M.documentElement}}static createShapes(t){const r=999999999,i=0,n=1,s=2,o=3,a=4,l=5,c=6,h={loc:i,t:0};function u(e,t,r,n){const o=e.x,a=t.x,l=r.x,c=n.x,u=e.y,p=t.y,m=r.y,f=n.y,g=(c-l)*(u-m)-(f-m)*(o-l),v=(f-m)*(a-o)-(c-l)*(p-u),x=g/v,y=((a-o)*(u-m)-(p-u)*(o-l))/v;if(0===v&&0!==g||x<=0||x>=1||y<0||y>1)return null;if(0===g&&0===v){for(let l=0;l<2;l++){if(d(0===l?r:n,e,t),h.loc==i){const e=0===l?r:n;return{x:e.x,y:e.y,t:h.t}}if(h.loc==s){return{x:+(o+h.t*(a-o)).toPrecision(10),y:+(u+h.t*(p-u)).toPrecision(10),t:h.t}}}return null}for(let s=0;s<2;s++)if(d(0===s?r:n,e,t),h.loc==i){const e=0===s?r:n;return{x:e.x,y:e.y,t:h.t}}return{x:+(o+x*(a-o)).toPrecision(10),y:+(u+x*(p-u)).toPrecision(10),t:x}}function d(e,t,r){const u=r.x-t.x,d=r.y-t.y,p=e.x-t.x,m=e.y-t.y,f=u*m-p*d;if(e.x===t.x&&e.y===t.y)return h.loc=i,void(h.t=0);if(e.x===r.x&&e.y===r.y)return h.loc=n,void(h.t=1);if(f<-Number.EPSILON)return void(h.loc=o);if(f>Number.EPSILON)return void(h.loc=a);if(u*p<0||d*m<0)return void(h.loc=l);if(Math.sqrt(u*u+d*d)<Math.sqrt(p*p+m*m))return void(h.loc=c);let g;g=0!==u?p/u:m/d,h.loc=s,h.t=g}function p(t,r,i){const n=new e.Vector2;r.getCenter(n);const s=[];return i.forEach((r=>{if(r.boundingBox.containsPoint(n)){(function(t,r){const i=[],n=[];for(let s=1;s<t.length;s++){const o=t[s-1],a=t[s];for(let t=1;t<r.length;t++){const s=u(o,a,r[t-1],r[t]);null!==s&&void 0===i.find((e=>e.t<=s.t+Number.EPSILON&&e.t>=s.t-Number.EPSILON))&&(i.push(s),n.push(new e.Vector2(s.x,s.y)))}}return n})(t,r.points).forEach((e=>{s.push({identifier:r.identifier,isCW:r.isCW,point:e})}))}})),s.sort(((e,t)=>e.point.x-t.point.x)),s}let m=0,f=r,g=-999999999,v=t.subPaths.map((t=>{const i=t.getPoints();let n=-999999999,s=r,o=-999999999,a=r;for(let e=0;e<i.length;e++){const t=i[e];t.y>n&&(n=t.y),t.y<s&&(s=t.y),t.x>o&&(o=t.x),t.x<a&&(a=t.x)}return g<=o&&(g=o+1),f>=a&&(f=a-1),{curves:t.curves,points:i,isCW:e.ShapeUtils.isClockWise(i),identifier:m++,boundingBox:new e.Box2(new e.Vector2(a,s),new e.Vector2(o,n))}}));v=v.filter((e=>e.points.length>1));const x=v.map((r=>function(t,r,i,n,s){null!=s&&""!==s||(s="nonzero");const o=new e.Vector2;t.boundingBox.getCenter(o);const a=p([new e.Vector2(i,o.y),new e.Vector2(n,o.y)],t.boundingBox,r);a.sort(((e,t)=>e.point.x-t.point.x));const l=[],c=[];a.forEach((e=>{e.identifier===t.identifier?l.push(e):c.push(e)}));const h=l[0].point.x,u=[];let d=0;for(;d<c.length&&c[d].point.x<h;)u.length>0&&u[u.length-1]===c[d].identifier?u.pop():u.push(c[d].identifier),d++;if(u.push(t.identifier),"evenodd"===s){const e=u.length%2==0,r=u[u.length-2];return{identifier:t.identifier,isHole:e,for:r}}if("nonzero"===s){let e=!0,i=null,n=null;for(let t=0;t<u.length;t++){const s=u[t];e?(n=r[s].isCW,e=!1,i=s):n!==r[s].isCW&&(n=r[s].isCW,e=!0)}return{identifier:t.identifier,isHole:e,for:i}}console.warn('fill-rule: "'+s+'" is currently not implemented.')}(r,v,f,g,t.userData.style.fillRule))),y=[];return v.forEach((t=>{if(!x[t.identifier].isHole){const r=new e.Shape;r.curves=t.curves;x.filter((e=>e.isHole&&e.for===t.identifier)).forEach((t=>{const i=v[t.identifier],n=new e.Path;n.curves=i.curves,r.holes.push(n)})),y.push(r)}})),y}static getStrokeStyle(e,t,r,i,n){return{strokeColor:t=void 0!==t?t:"#000",strokeWidth:e=void 0!==e?e:1,strokeLineJoin:r=void 0!==r?r:"miter",strokeLineCap:i=void 0!==i?i:"butt",strokeMiterLimit:n=void 0!==n?n:4}}static pointsToStroke(t,r,i,n){const s=[],o=[],a=[];if(0===Wp.pointsToStrokeWithBuffers(t,r,i,n,s,o,a))return null;const l=new e.BufferGeometry;return l.setAttribute("position",new e.Float32BufferAttribute(s,3)),l.setAttribute("normal",new e.Float32BufferAttribute(o,3)),l.setAttribute("uv",new e.Float32BufferAttribute(a,2)),l}static pointsToStrokeWithBuffers(t,r,i,n,s,o,a,l){const c=new e.Vector2,h=new e.Vector2,u=new e.Vector2,d=new e.Vector2,p=new e.Vector2,m=new e.Vector2,f=new e.Vector2,g=new e.Vector2,v=new e.Vector2,x=new e.Vector2,y=new e.Vector2,b=new e.Vector2,A=new e.Vector2,w=new e.Vector2,M=new e.Vector2,T=new e.Vector2,S=new e.Vector2;i=void 0!==i?i:12,n=void 0!==n?n:.001,l=void 0!==l?l:0;const C=(t=function(e){let t=!1;for(let r=1,i=e.length-1;r<i;r++)if(e[r].distanceTo(e[r+1])<n){t=!0;break}if(!t)return e;const r=[];r.push(e[0]);for(let t=1,i=e.length-1;t<i;t++)e[t].distanceTo(e[t+1])>=n&&r.push(e[t]);return r.push(e[e.length-1]),r}(t)).length;if(C<2)return 0;const F=t[0].equals(t[C-1]);let E,_,P=t[0];const B=r.strokeWidth/2,L=1/(C-1);let R,N,D,I,U=0,O=!1,k=0,V=3*l,G=2*l;z(t[0],t[1],c).multiplyScalar(B),g.copy(t[0]).sub(c),v.copy(t[0]).add(c),x.copy(g),y.copy(v);for(let e=1;e<C;e++){E=t[e],_=e===C-1?F?t[1]:void 0:t[e+1];const i=c;if(z(P,E,i),u.copy(i).multiplyScalar(B),b.copy(E).sub(u),A.copy(E).add(u),R=U+L,N=!1,void 0!==_){z(E,_,h),u.copy(h).multiplyScalar(B),w.copy(E).sub(u),M.copy(E).add(u),D=!0,u.subVectors(_,P),i.dot(u)<0&&(D=!1),1===e&&(O=D),u.subVectors(_,E),u.normalize();const t=Math.abs(i.dot(u));if(0!==t){const e=B/t;u.multiplyScalar(-e),d.subVectors(E,P),p.copy(d).setLength(e).add(u),T.copy(p).negate();const i=p.length(),n=d.length();d.divideScalar(n),m.subVectors(_,E);const s=m.length();switch(m.divideScalar(s),d.dot(T)<n&&m.dot(T)<s&&(N=!0),S.copy(p).add(E),T.add(E),I=!1,N?D?(M.copy(T),A.copy(T)):(w.copy(T),b.copy(T)):W(),r.strokeLineJoin){case"bevel":X(D,N,R);break;case"round":Q(D,N),D?j(E,b,w,R,0):j(E,M,A,R,1);break;case"miter":case"miter-clip":default:const e=B*r.strokeMiterLimit/i;if(e<1){if("miter-clip"!==r.strokeLineJoin){X(D,N,R);break}Q(D,N),D?(m.subVectors(S,b).multiplyScalar(e).add(b),f.subVectors(S,w).multiplyScalar(e).add(w),H(b,R,0),H(m,R,0),H(E,R,.5),H(E,R,.5),H(m,R,0),H(f,R,0),H(E,R,.5),H(f,R,0),H(w,R,0)):(m.subVectors(S,A).multiplyScalar(e).add(A),f.subVectors(S,M).multiplyScalar(e).add(M),H(A,R,1),H(m,R,1),H(E,R,.5),H(E,R,.5),H(m,R,1),H(f,R,1),H(E,R,.5),H(f,R,1),H(M,R,1))}else N?(D?(H(v,U,1),H(g,U,0),H(S,R,0),H(v,U,1),H(S,R,0),H(T,R,1)):(H(v,U,1),H(g,U,0),H(S,R,1),H(g,U,0),H(T,R,0),H(S,R,1)),D?w.copy(S):M.copy(S)):D?(H(b,R,0),H(S,R,0),H(E,R,.5),H(E,R,.5),H(S,R,0),H(w,R,0)):(H(A,R,1),H(S,R,1),H(E,R,.5),H(E,R,.5),H(S,R,1),H(M,R,1)),I=!0}}else W()}else W();F||e!==C-1||Y(t[0],x,y,D,!0,U),U=R,P=E,g.copy(w),v.copy(M)}if(F){if(N&&s){let e=S,t=T;O!==D&&(e=T,t=S),D?(I||O)&&(t.toArray(s,0),t.toArray(s,9),I&&e.toArray(s,3)):!I&&O||(t.toArray(s,3),t.toArray(s,9),I&&e.toArray(s,0))}}else Y(E,b,A,D,!1,R);return k;function z(e,t,r){return r.subVectors(t,e),r.set(-r.y,r.x).normalize()}function H(e,t,r){s&&(s[V]=e.x,s[V+1]=e.y,s[V+2]=0,o&&(o[V]=0,o[V+1]=0,o[V+2]=1),V+=3,a&&(a[G]=t,a[G+1]=r,G+=2)),k+=3}function j(e,t,r,n,s){c.copy(t).sub(e).normalize(),h.copy(r).sub(e).normalize();let o=Math.PI;const a=c.dot(h);Math.abs(a)<1&&(o=Math.abs(Math.acos(a))),o/=i,u.copy(t);for(let t=0,r=i-1;t<r;t++)d.copy(u).rotateAround(e,o),H(u,n,s),H(d,n,s),H(e,n,.5),u.copy(d);H(d,n,s),H(r,n,s),H(e,n,.5)}function W(){H(v,U,1),H(g,U,0),H(b,R,0),H(v,U,1),H(b,R,1),H(A,R,0)}function X(e,t,r){t?e?(H(v,U,1),H(g,U,0),H(b,R,0),H(v,U,1),H(b,R,0),H(T,R,1),H(b,r,0),H(w,r,0),H(T,r,.5)):(H(v,U,1),H(g,U,0),H(A,R,1),H(g,U,0),H(T,R,0),H(A,R,1),H(A,r,1),H(M,r,0),H(T,r,.5)):e?(H(b,r,0),H(w,r,0),H(E,r,.5)):(H(A,r,1),H(M,r,0),H(E,r,.5))}function Q(e,t){t&&(e?(H(v,U,1),H(g,U,0),H(b,R,0),H(v,U,1),H(b,R,0),H(T,R,1),H(b,U,0),H(E,R,.5),H(T,R,1),H(E,R,.5),H(w,U,0),H(T,R,1)):(H(v,U,1),H(g,U,0),H(A,R,1),H(g,U,0),H(T,R,0),H(A,R,1),H(A,U,1),H(T,R,0),H(E,R,.5),H(E,R,.5),H(T,R,0),H(M,U,1)))}function Y(e,t,i,n,o,a){switch(r.strokeLineCap){case"round":o?j(e,i,t,a,.5):j(e,t,i,a,.5);break;case"square":if(o)c.subVectors(t,e),h.set(c.y,-c.x),u.addVectors(c,h).add(e),d.subVectors(h,c).add(e),n?(u.toArray(s,3),d.toArray(s,0),d.toArray(s,9)):(u.toArray(s,3),u.toArray(s,9),d.toArray(s,0));else{c.subVectors(i,e),h.set(c.y,-c.x),u.addVectors(c,h).add(e),d.subVectors(h,c).add(e);const t=s.length;n?(u.toArray(s,t-3),d.toArray(s,t-6),d.toArray(s,t-12)):(u.toArray(s,t-6),d.toArray(s,t-3),d.toArray(s,t-12))}}}}}const Xp=new WeakMap;class Qp extends e.Loader{constructor(e){super(e),this.libraryPath="",this.libraryPending=null,this.libraryBinary=null,this.libraryConfig={},this.url="",this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.workerConfig={},this.materials=[]}setLibraryPath(e){return this.libraryPath=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(t,r,i,n){const s=new e.FileLoader(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),this.url=t,s.load(t,(e=>{if(Xp.has(e)){return Xp.get(e).promise.then(r).catch(n)}this.decodeObjects(e,t).then(r).catch(n)}),i,n)}debug(){console.log("Task load: ",this.workerPool.map((e=>e._taskLoad)))}decodeObjects(e,t){let r,i;const n=e.byteLength,s=this._getWorker(n).then((t=>(r=t,i=this.workerNextTaskID++,new Promise(((t,n)=>{r._callbacks[i]={resolve:t,reject:n},r.postMessage({type:"decode",id:i,buffer:e},[e])}))))).then((e=>this._createGeometry(e.data)));return s.catch((()=>!0)).then((()=>{r&&i&&this._releaseTask(r,i)})),Xp.set(e,{url:t,promise:s}),s}parse(e,t,r){this.decodeObjects(e,"").then(t).catch(r)}_compareMaterials(e){const t={};t.name=e.name,t.color={},t.color.r=e.color.r,t.color.g=e.color.g,t.color.b=e.color.b,t.type=e.type;for(let e=0;e<this.materials.length;e++){const r=this.materials[e],i={};if(i.name=r.name,i.color={},i.color.r=r.color.r,i.color.g=r.color.g,i.color.b=r.color.b,i.type=r.type,JSON.stringify(t)===JSON.stringify(i))return r}return this.materials.push(e),e}_createMaterial(t){if(void 0===t)return new e.MeshStandardMaterial({color:new e.Color(1,1,1),metalness:.8,name:"default",side:2});const r=t.diffuseColor,i=new e.Color(r.r/255,r.g/255,r.b/255);0===r.r&&0===r.g&&0===r.b&&(i.r=1,i.g=1,i.b=1);const n=new e.MeshStandardMaterial({color:i,name:t.name,side:2,transparent:t.transparency>0,opacity:1-t.transparency}),s=new e.TextureLoader;for(let e=0;e<t.textures.length;e++){const r=t.textures[e];if(null!==r.image){const e=s.load(r.image);switch(r.type){case"Diffuse":n.map=e;break;case"Bump":n.bumpMap=e;break;case"Transparency":n.alphaMap=e,n.transparent=!0;break;case"Emap":n.envMap=e}}}return n}_createGeometry(t){const r=new e.Object3D,i=[],n=[],s=[];r.userData.layers=t.layers,r.userData.groups=t.groups,r.userData.settings=t.settings,r.userData.objectType="File3dm",r.userData.materials=null,r.name=this.url;let o=t.objects;const a=t.materials;for(let e=0;e<o.length;e++){const l=o[e],c=l.attributes;switch(l.objectType){case"InstanceDefinition":n.push(l);break;case"InstanceReference":s.push(l);break;default:let e;if(c.materialIndex>=0){const t=a[c.materialIndex];let r=this._createMaterial(t);r=this._compareMaterials(r),e=this._createObject(l,r)}else{const t=this._createMaterial();e=this._createObject(l,t)}if(void 0===e)continue;const o=t.layers[c.layerIndex];e.visible=!o||t.layers[c.layerIndex].visible,c.isInstanceDefinitionObject?i.push(e):r.add(e)}}for(let t=0;t<n.length;t++){const a=n[t];o=[];for(let e=0;e<a.attributes.objectIds.length;e++){const t=a.attributes.objectIds[e];for(let e=0;e<i.length;e++){t===i[e].userData.attributes.id&&o.push(i[e])}}for(let t=0;t<s.length;t++){const i=s[t];if(i.geometry.parentIdefId===a.attributes.id){const t=new e.Object3D,n=i.geometry.xform.array,s=new e.Matrix4;s.set(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],n[8],n[9],n[10],n[11],n[12],n[13],n[14],n[15]),t.applyMatrix4(s);for(let e=0;e<o.length;e++)t.add(o[e].clone(!0));r.add(t)}}}return r.userData.materials=this.materials,r}_createObject(t,r){const i=new e.BufferGeometryLoader,n=t.attributes;let s,o,a,l;switch(t.objectType){case"Point":case"PointSet":s=i.parse(t.geometry),s.attributes.hasOwnProperty("color")?o=new e.PointsMaterial({vertexColors:!0,sizeAttenuation:!1,size:2}):(a=n.drawColor,l=new e.Color(a.r/255,a.g/255,a.b/255),o=new e.PointsMaterial({color:l,sizeAttenuation:!1,size:2})),o=this._compareMaterials(o);const c=new e.Points(s,o);return c.userData.attributes=n,c.userData.objectType=t.objectType,n.name&&(c.name=n.name),c;case"Mesh":case"Extrusion":case"SubD":case"Brep":if(null===t.geometry)return;s=i.parse(t.geometry),s.attributes.hasOwnProperty("color")&&(r.vertexColors=!0),null===r&&(r=this._createMaterial(),r=this._compareMaterials(r));const h=new e.Mesh(s,r);return h.castShadow=n.castsShadows,h.receiveShadow=n.receivesShadows,h.userData.attributes=n,h.userData.objectType=t.objectType,n.name&&(h.name=n.name),h;case"Curve":s=i.parse(t.geometry),a=n.drawColor,l=new e.Color(a.r/255,a.g/255,a.b/255),o=new e.LineBasicMaterial({color:l}),o=this._compareMaterials(o);const u=new e.Line(s,o);return u.userData.attributes=n,u.userData.objectType=t.objectType,n.name&&(u.name=n.name),u;case"TextDot":s=t.geometry;const d=document.createElement("canvas").getContext("2d"),p=`${s.fontHeight}px ${s.fontFace}`;d.font=p;const m=d.measureText(s.text).width+10,f=s.fontHeight+10,g=window.devicePixelRatio;d.canvas.width=m*g,d.canvas.height=f*g,d.canvas.style.width=m+"px",d.canvas.style.height=f+"px",d.setTransform(g,0,0,g,0,0),d.font=p,d.textBaseline="middle",d.textAlign="center",l=n.drawColor,d.fillStyle=`rgba(${l.r},${l.g},${l.b},${l.a})`,d.fillRect(0,0,m,f),d.fillStyle="white",d.fillText(s.text,m/2,f/2);const v=new e.CanvasTexture(d.canvas);v.minFilter=e.LinearFilter,v.wrapS=e.ClampToEdgeWrapping,v.wrapT=e.ClampToEdgeWrapping,o=new e.SpriteMaterial({map:v,depthTest:!1});const x=new e.Sprite(o);return x.position.set(s.point[0],s.point[1],s.point[2]),x.scale.set(m/10,f/10,1),x.userData.attributes=n,x.userData.objectType=t.objectType,n.name&&(x.name=n.name),x;case"Light":let y;if(s=t.geometry,s.isDirectionalLight)y=new e.DirectionalLight,y.castShadow=n.castsShadows,y.position.set(s.location[0],s.location[1],s.location[2]),y.target.position.set(s.direction[0],s.direction[1],s.direction[2]),y.shadow.normalBias=.1;else if(s.isPointLight)y=new e.PointLight,y.castShadow=n.castsShadows,y.position.set(s.location[0],s.location[1],s.location[2]),y.shadow.normalBias=.1;else if(s.isRectangularLight){y=new e.RectAreaLight;const t=Math.abs(s.width[2]),r=Math.abs(s.length[0]);y.position.set(s.location[0]-r/2,s.location[1],s.location[2]-t/2),y.height=r,y.width=t,y.lookAt(new e.Vector3(s.direction[0],s.direction[1],s.direction[2]))}else if(s.isSpotLight)y=new e.SpotLight,y.castShadow=n.castsShadows,y.position.set(s.location[0],s.location[1],s.location[2]),y.target.position.set(s.direction[0],s.direction[1],s.direction[2]),y.angle=s.spotAngleRadians,y.shadow.normalBias=.1;else if(s.isLinearLight)return void console.warn("THREE.3DMLoader: No conversion exists for linear lights.");return y&&(y.intensity=s.intensity,a=s.diffuse,l=new e.Color(a.r/255,a.g/255,a.b/255),y.color=l,y.userData.attributes=n,y.userData.objectType=t.objectType),y}}_initLibrary(){if(!this.libraryPending){const t=new e.FileLoader(this.manager);t.setPath(this.libraryPath);const r=new Promise(((e,r)=>{t.load("rhino3dm.js",e,void 0,r)})),i=new e.FileLoader(this.manager);i.setPath(this.libraryPath),i.setResponseType("arraybuffer");const n=new Promise(((e,t)=>{i.load("rhino3dm.wasm",e,void 0,t)}));this.libraryPending=Promise.all([r,n]).then((([e,t])=>{this.libraryConfig.wasmBinary=t;const r=Yp.toString(),i=["/* rhino3dm.js */",e,"/* worker */",r.substring(r.indexOf("{")+1,r.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([i]))}))}return this.libraryPending}_getWorker(e){return this._initLibrary().then((()=>{if(this.workerPool.length<this.workerLimit){const e=new Worker(this.workerSourceURL);e._callbacks={},e._taskCosts={},e._taskLoad=0,e.postMessage({type:"init",libraryConfig:this.libraryConfig}),e.onmessage=function(t){const r=t.data;switch(r.type){case"decode":e._callbacks[r.id].resolve(r);break;case"error":e._callbacks[r.id].reject(r);break;default:console.error('THREE.Rhino3dmLoader: Unexpected message, "'+r.type+'"')}},this.workerPool.push(e)}else this.workerPool.sort((function(e,t){return e._taskLoad>t._taskLoad?-1:1}));const t=this.workerPool[this.workerPool.length-1];return t._taskLoad+=e,t}))}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this}}function Yp(){let e,t,r;function i(e,t){const i=e.geometry(),o=e.attributes();let a,l,c,h,u,d=i.objectType;switch(d){case r.ObjectType.Curve:const e=s(i,100);c={},l={},h={},c.itemSize=3,c.type="Float32Array",c.array=[];for(let t=0;t<e.length;t++)c.array.push(e[t][0]),c.array.push(e[t][1]),c.array.push(e[t][2]);l.position=c,h.attributes=l,a={data:h};break;case r.ObjectType.Point:const p=i.location;c={};const m={};l={},h={},c.itemSize=3,c.type="Float32Array",c.array=[p[0],p[1],p[2]];const f=o.drawColor(t);m.itemSize=3,m.type="Float32Array",m.array=[f.r/255,f.g/255,f.b/255],l.position=c,l.color=m,h.attributes=l,a={data:h};break;case r.ObjectType.PointSet:case r.ObjectType.Mesh:a=i.toThreejsJSON();break;case r.ObjectType.Brep:const g=i.faces();u=new r.Mesh;for(let e=0;e<g.count;e++){const t=g.get(e),i=t.getMesh(r.MeshType.Any);i&&(u.append(i),i.delete()),t.delete()}u.faces().count>0&&(u.compact(),a=u.toThreejsJSON(),g.delete()),u.delete();break;case r.ObjectType.Extrusion:u=i.getMesh(r.MeshType.Any),u&&(a=u.toThreejsJSON(),u.delete());break;case r.ObjectType.TextDot:case r.ObjectType.Light:a=n(i);break;case r.ObjectType.InstanceReference:a=n(i),a.xform=n(i.xform),a.xform.array=i.xform.toFloatArray(!0);break;case r.ObjectType.SubD:i.subdivide(3),u=r.Mesh.createFromSubDControlNet(i),u&&(a=u.toThreejsJSON(),u.delete());break;default:console.warn(`THREE.3DMLoader: TODO: Implement ${d.constructor.name}`)}if(a)return l=n(o),l.geometry=n(i),o.groupCount>0&&(l.groupIds=o.getGroupList()),o.userStringCount>0&&(l.userStrings=o.getUserStrings()),i.userStringCount>0&&(l.geometry.userStrings=i.getUserStrings()),l.drawColor=o.drawColor(t),d=d.constructor.name,d=d.substring(11,d.length),{geometry:a,attributes:l,objectType:d};console.warn(`THREE.3DMLoader: ${d.constructor.name} has no associated mesh geometry.`)}function n(e){const t={};for(const r in e){const i=e[r];"function"!=typeof i&&("object"==typeof i&&null!==i&&i.hasOwnProperty("constructor")?t[r]={name:i.constructor.name,value:i.value}:t[r]=i)}return t}function s(e,t){let i=t,n=[];const o=[];if(e instanceof r.LineCurve)return[e.pointAtStart,e.pointAtEnd];if(e instanceof r.PolylineCurve){i=e.pointCount;for(let t=0;t<i;t++)n.push(e.point(t));return n}if(e instanceof r.PolyCurve){const t=e.segmentCount;for(let r=0;r<t;r++){const t=e.segmentCurve(r),o=s(t,i);n=n.concat(o),t.delete()}return n}if(e instanceof r.ArcCurve&&(i=Math.floor(e.angleDegrees/5),i=i<2?2:i),e instanceof r.NurbsCurve&&1===e.degree){const t=e.tryGetPolyline();for(let e=0;e<t.count;e++)n.push(t.get(e));return t.delete(),n}const a=e.domain,l=i-1;for(let t=0;t<i;t++){const r=a[0]+t/l*(a[1]-a[0]);if(r===a[0]||r===a[1]){o.push(r);continue}const i=e.tangentAt(r),n=e.tangentAt(o.slice(-1)[0]),s=i[0]*i[0]+i[1]*i[1]+i[2]*i[2],c=n[0]*n[0]+n[1]*n[1]+n[2]*n[2],h=Math.sqrt(s*c);let u;if(0===h)u=Math.PI/2;else{const e=(i.x*n.x+i.y*n.y+i.z*n.z)/h;u=Math.acos(Math.max(-1,Math.min(1,e)))}u<.1||o.push(r)}return n=o.map((t=>e.pointAt(t))),n}onmessage=function(s){const o=s.data;switch(o.type){case"init":t=o.libraryConfig;const s=t.wasmBinary;let a;e=new Promise((function(e){a={wasmBinary:s,onRuntimeInitialized:e},rhino3dm(a)})).then((()=>{r=a}));break;case"decode":const l=o.buffer;e.then((()=>{const e=function(e,t){const r=new Uint8Array(t),s=e.File3dm.fromByteArray(r),o=[],a=[],l=[],c=[],h=[],u=[],d=s.objects(),p=d.count;for(let e=0;e<p;e++){const t=d.get(e),r=i(t,s);t.delete(),r&&o.push(r)}for(let e=0;e<s.instanceDefinitions().count();e++){const t=s.instanceDefinitions().get(e),r=n(t);r.objectIds=t.getObjectIds(),o.push({geometry:null,attributes:r,objectType:"InstanceDefinition"})}const m=[e.TextureType.Diffuse,e.TextureType.Bump,e.TextureType.Transparency,e.TextureType.Opacity,e.TextureType.Emap],f=[e.TextureType.PBR_BaseColor,e.TextureType.PBR_Subsurface,e.TextureType.PBR_SubsurfaceScattering,e.TextureType.PBR_SubsurfaceScatteringRadius,e.TextureType.PBR_Metallic,e.TextureType.PBR_Specular,e.TextureType.PBR_SpecularTint,e.TextureType.PBR_Roughness,e.TextureType.PBR_Anisotropic,e.TextureType.PBR_Anisotropic_Rotation,e.TextureType.PBR_Sheen,e.TextureType.PBR_SheenTint,e.TextureType.PBR_Clearcoat,e.TextureType.PBR_ClearcoatBump,e.TextureType.PBR_ClearcoatRoughness,e.TextureType.PBR_OpacityIor,e.TextureType.PBR_OpacityRoughness,e.TextureType.PBR_Emission,e.TextureType.PBR_AmbientOcclusion,e.TextureType.PBR_Displacement];for(let e=0;e<s.materials().count();e++){const t=s.materials().get(e),r=t.physicallyBased();let i=n(t);const o=[];for(let e=0;e<m.length;e++){const r=t.getTexture(m[e]);if(r){let t=m[e].constructor.name;t=t.substring(12,t.length);const i={type:t},n=s.getEmbeddedFileAsBase64(r.fileName);n?i.image="data:image/png;base64,"+n:(console.warn(`THREE.3DMLoader: Image for ${t} texture not embedded in file.`),i.image=null),o.push(i),r.delete()}}if(i.textures=o,r.supported){console.log("pbr true");for(let e=0;e<f.length;e++){const r=t.getTexture(m[e]);if(r){const t=s.getEmbeddedFileAsBase64(r.fileName);let i=m[e].constructor.name;i=i.substring(12,i.length);const n={type:i,image:"data:image/png;base64,"+t};o.push(n),r.delete()}}const e=n(t.physicallyBased());i=Object.assign(e,i)}a.push(i),t.delete(),r.delete()}for(let e=0;e<s.layers().count();e++){const t=s.layers().get(e),r=n(t);l.push(r),t.delete()}for(let e=0;e<s.views().count();e++){const t=s.views().get(e),r=n(t);c.push(r),t.delete()}for(let e=0;e<s.namedViews().count();e++){const t=s.namedViews().get(e),r=n(t);h.push(r),t.delete()}for(let e=0;e<s.groups().count();e++){const t=s.groups().get(e),r=n(t);u.push(r),t.delete()}const g=n(s.settings());return s.delete(),{objects:o,materials:a,layers:l,views:c,namedViews:h,groups:u,settings:g}}(r,l);self.postMessage({type:"decode",id:o.id,data:e})}))}}}const Kp=/^[og]\s*(.+)?/,qp=/^mtllib /,Jp=/^usemtl /,Zp=/^usemap /,$p=new e.Vector3,em=new e.Vector3,tm=new e.Vector3,rm=new e.Vector3,im=new e.Vector3;function nm(){const e={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materials:{},materialLibraries:[],startObject:function(e,t){if(this.object&&!1===this.object.fromDeclaration)return this.object.name=e,void(this.object.fromDeclaration=!1!==t);const r=this.object&&"function"==typeof this.object.currentMaterial?this.object.currentMaterial():void 0;if(this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0),this.object={name:e||"",fromDeclaration:!1!==t,geometry:{vertices:[],normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function(e,t){const r=this._finalize(!1);r&&(r.inherited||r.groupCount<=0)&&this.materials.splice(r.index,1);const i={index:this.materials.length,name:e||"",mtllib:Array.isArray(t)&&t.length>0?t[t.length-1]:"",smooth:void 0!==r?r.smooth:this.smooth,groupStart:void 0!==r?r.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(e){const t={index:"number"==typeof e?e:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return t.clone=this.clone.bind(t),t}};return this.materials.push(i),i},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(e){const t=this.currentMaterial();if(t&&-1===t.groupEnd&&(t.groupEnd=this.geometry.vertices.length/3,t.groupCount=t.groupEnd-t.groupStart,t.inherited=!1),e&&this.materials.length>1)for(let e=this.materials.length-1;e>=0;e--)this.materials[e].groupCount<=0&&this.materials.splice(e,1);return e&&0===this.materials.length&&this.materials.push({name:"",smooth:this.smooth}),t}},r&&r.name&&"function"==typeof r.clone){const e=r.clone(0);e.inherited=!0,this.object.materials.push(e)}this.objects.push(this.object)},finalize:function(){this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0)},parseVertexIndex:function(e,t){const r=parseInt(e,10);return 3*(r>=0?r-1:r+t/3)},parseNormalIndex:function(e,t){const r=parseInt(e,10);return 3*(r>=0?r-1:r+t/3)},parseUVIndex:function(e,t){const r=parseInt(e,10);return 2*(r>=0?r-1:r+t/2)},addVertex:function(e,t,r){const i=this.vertices,n=this.object.geometry.vertices;n.push(i[e+0],i[e+1],i[e+2]),n.push(i[t+0],i[t+1],i[t+2]),n.push(i[r+0],i[r+1],i[r+2])},addVertexPoint:function(e){const t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addVertexLine:function(e){const t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addNormal:function(e,t,r){const i=this.normals,n=this.object.geometry.normals;n.push(i[e+0],i[e+1],i[e+2]),n.push(i[t+0],i[t+1],i[t+2]),n.push(i[r+0],i[r+1],i[r+2])},addFaceNormal:function(e,t,r){const i=this.vertices,n=this.object.geometry.normals;$p.fromArray(i,e),em.fromArray(i,t),tm.fromArray(i,r),im.subVectors(tm,em),rm.subVectors($p,em),im.cross(rm),im.normalize(),n.push(im.x,im.y,im.z),n.push(im.x,im.y,im.z),n.push(im.x,im.y,im.z)},addColor:function(e,t,r){const i=this.colors,n=this.object.geometry.colors;void 0!==i[e]&&n.push(i[e+0],i[e+1],i[e+2]),void 0!==i[t]&&n.push(i[t+0],i[t+1],i[t+2]),void 0!==i[r]&&n.push(i[r+0],i[r+1],i[r+2])},addUV:function(e,t,r){const i=this.uvs,n=this.object.geometry.uvs;n.push(i[e+0],i[e+1]),n.push(i[t+0],i[t+1]),n.push(i[r+0],i[r+1])},addDefaultUV:function(){const e=this.object.geometry.uvs;e.push(0,0),e.push(0,0),e.push(0,0)},addUVLine:function(e){const t=this.uvs;this.object.geometry.uvs.push(t[e+0],t[e+1])},addFace:function(e,t,r,i,n,s,o,a,l){const c=this.vertices.length;let h=this.parseVertexIndex(e,c),u=this.parseVertexIndex(t,c),d=this.parseVertexIndex(r,c);if(this.addVertex(h,u,d),this.addColor(h,u,d),void 0!==o&&""!==o){const e=this.normals.length;h=this.parseNormalIndex(o,e),u=this.parseNormalIndex(a,e),d=this.parseNormalIndex(l,e),this.addNormal(h,u,d)}else this.addFaceNormal(h,u,d);if(void 0!==i&&""!==i){const e=this.uvs.length;h=this.parseUVIndex(i,e),u=this.parseUVIndex(n,e),d=this.parseUVIndex(s,e),this.addUV(h,u,d),this.object.geometry.hasUVIndices=!0}else this.addDefaultUV()},addPointGeometry:function(e){this.object.geometry.type="Points";const t=this.vertices.length;for(let r=0,i=e.length;r<i;r++){const i=this.parseVertexIndex(e[r],t);this.addVertexPoint(i),this.addColor(i)}},addLineGeometry:function(e,t){this.object.geometry.type="Line";const r=this.vertices.length,i=this.uvs.length;for(let t=0,i=e.length;t<i;t++)this.addVertexLine(this.parseVertexIndex(e[t],r));for(let e=0,r=t.length;e<r;e++)this.addUVLine(this.parseUVIndex(t[e],i))}};return e.startObject("",!1),e}class sm extends e.Loader{constructor(e){super(e),this.materials=null}load(t,r,i,n){const s=this,o=new e.FileLoader(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,(function(e){try{r(s.parse(e))}catch(e){n?n(e):console.error(e),s.manager.itemError(t)}}),i,n)}setMaterials(e){return this.materials=e,this}parse(t){const r=new nm;-1!==t.indexOf("\r\n")&&(t=t.replace(/\r\n/g,"\n")),-1!==t.indexOf("\\\n")&&(t=t.replace(/\\\n/g,""));const i=t.split("\n");let n="",s="",o=0,a=[];const l="function"==typeof"".trimLeft;for(let e=0,t=i.length;e<t;e++)if(n=i[e],n=l?n.trimLeft():n.trim(),o=n.length,0!==o&&(s=n.charAt(0),"#"!==s))if("v"===s){const e=n.split(/\s+/);switch(e[0]){case"v":r.vertices.push(parseFloat(e[1]),parseFloat(e[2]),parseFloat(e[3])),e.length>=7?r.colors.push(parseFloat(e[4]),parseFloat(e[5]),parseFloat(e[6])):r.colors.push(void 0,void 0,void 0);break;case"vn":r.normals.push(parseFloat(e[1]),parseFloat(e[2]),parseFloat(e[3]));break;case"vt":r.uvs.push(parseFloat(e[1]),parseFloat(e[2]))}}else if("f"===s){const e=n.substr(1).trim().split(/\s+/),t=[];for(let r=0,i=e.length;r<i;r++){const i=e[r];if(i.length>0){const e=i.split("/");t.push(e)}}const i=t[0];for(let e=1,n=t.length-1;e<n;e++){const n=t[e],s=t[e+1];r.addFace(i[0],n[0],s[0],i[1],n[1],s[1],i[2],n[2],s[2])}}else if("l"===s){const e=n.substring(1).trim().split(" ");let t=[];const i=[];if(-1===n.indexOf("/"))t=e;else for(let r=0,n=e.length;r<n;r++){const n=e[r].split("/");""!==n[0]&&t.push(n[0]),""!==n[1]&&i.push(n[1])}r.addLineGeometry(t,i)}else if("p"===s){const e=n.substr(1).trim().split(" ");r.addPointGeometry(e)}else if(null!==(a=Kp.exec(n))){const e=(" "+a[0].substr(1).trim()).substr(1);r.startObject(e)}else if(Jp.test(n))r.object.startMaterial(n.substring(7).trim(),r.materialLibraries);else if(qp.test(n))r.materialLibraries.push(n.substring(7).trim());else if(Zp.test(n))console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');else if("s"===s){if(a=n.split(" "),a.length>1){const e=a[1].trim().toLowerCase();r.object.smooth="0"!==e&&"off"!==e}else r.object.smooth=!0;const e=r.object.currentMaterial();e&&(e.smooth=r.object.smooth)}else{if("\0"===n)continue;console.warn('THREE.OBJLoader: Unexpected line: "'+n+'"')}r.finalize();const c=new e.Group;c.materialLibraries=[].concat(r.materialLibraries);if(!0===!(1===r.objects.length&&0===r.objects[0].geometry.vertices.length))for(let t=0,i=r.objects.length;t<i;t++){const i=r.objects[t],n=i.geometry,s=i.materials,o="Line"===n.type,a="Points"===n.type;let l=!1;if(0===n.vertices.length)continue;const h=new e.BufferGeometry;h.setAttribute("position",new e.Float32BufferAttribute(n.vertices,3)),n.normals.length>0&&h.setAttribute("normal",new e.Float32BufferAttribute(n.normals,3)),n.colors.length>0&&(l=!0,h.setAttribute("color",new e.Float32BufferAttribute(n.colors,3))),!0===n.hasUVIndices&&h.setAttribute("uv",new e.Float32BufferAttribute(n.uvs,2));const u=[];for(let t=0,i=s.length;t<i;t++){const i=s[t],n=i.name+"_"+i.smooth+"_"+l;let c=r.materials[n];if(null!==this.materials)if(c=this.materials.create(i.name),!o||!c||c instanceof e.LineBasicMaterial){if(a&&c&&!(c instanceof e.PointsMaterial)){const t=new e.PointsMaterial({size:10,sizeAttenuation:!1});e.Material.prototype.copy.call(t,c),t.color.copy(c.color),t.map=c.map,c=t}}else{const t=new e.LineBasicMaterial;e.Material.prototype.copy.call(t,c),t.color.copy(c.color),c=t}void 0===c&&(c=o?new e.LineBasicMaterial:a?new e.PointsMaterial({size:1,sizeAttenuation:!1}):new e.MeshPhongMaterial,c.name=i.name,c.flatShading=!i.smooth,c.vertexColors=l,r.materials[n]=c),u.push(c)}let d;if(u.length>1){for(let e=0,t=s.length;e<t;e++){const t=s[e];h.addGroup(t.groupStart,t.groupCount,e)}d=o?new e.LineSegments(h,u):a?new e.Points(h,u):new e.Mesh(h,u)}else d=o?new e.LineSegments(h,u[0]):a?new e.Points(h,u[0]):new e.Mesh(h,u[0]);d.name=i.name,c.add(d)}else if(r.vertices.length>0){const t=new e.PointsMaterial({size:1,sizeAttenuation:!1}),i=new e.BufferGeometry;i.setAttribute("position",new e.Float32BufferAttribute(r.vertices,3)),r.colors.length>0&&void 0!==r.colors[0]&&(i.setAttribute("color",new e.Float32BufferAttribute(r.colors,3)),t.vertexColors=!0);const n=new e.Points(i,t);c.add(n)}return c}}class om extends e.Loader{constructor(e){super(e)}load(t,r,i,n){const s=this,o=new e.FileLoader(s.manager);o.setPath(s.path),o.setResponseType("arraybuffer"),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(t,(function(e){try{r(s.parse(e))}catch(e){n?n(e):console.error(e),s.manager.itemError(t)}}),i,n)}parse(t){function r(t){let r="AMF Material";const n=t.attributes.id.textContent;let s={r:1,g:1,b:1,a:1},o=null;for(let e=0;e<t.childNodes.length;e++){const n=t.childNodes[e];"metadata"===n.nodeName&&void 0!==n.attributes.type?"name"===n.attributes.type.value&&(r=n.textContent):"color"===n.nodeName&&(s=i(n))}return o=new e.MeshPhongMaterial({flatShading:!0,color:new e.Color(s.r,s.g,s.b),name:r}),1!==s.a&&(o.transparent=!0,o.opacity=s.a),{id:n,material:o}}function i(e){const t={r:1,g:1,b:1,a:1};for(let r=0;r<e.childNodes.length;r++){const i=e.childNodes[r];"r"===i.nodeName?t.r=i.textContent:"g"===i.nodeName?t.g=i.textContent:"b"===i.nodeName?t.b=i.textContent:"a"===i.nodeName&&(t.a=i.textContent)}return t}function s(e){const t={name:"",triangles:[],materialid:null};let r=e.firstElementChild;for(void 0!==e.attributes.materialid&&(t.materialId=e.attributes.materialid.nodeValue);r;){if("metadata"===r.nodeName)void 0!==r.attributes.type&&"name"===r.attributes.type.value&&(t.name=r.textContent);else if("triangle"===r.nodeName){const e=r.getElementsByTagName("v1")[0].textContent,i=r.getElementsByTagName("v2")[0].textContent,n=r.getElementsByTagName("v3")[0].textContent;t.triangles.push(e,i,n)}r=r.nextElementSibling}return t}function o(e){const t=[],r=[];let i=e.firstElementChild;for(;i;){if("vertex"===i.nodeName){let e=i.firstElementChild;for(;e;){if("coordinates"===e.nodeName){const r=e.getElementsByTagName("x")[0].textContent,i=e.getElementsByTagName("y")[0].textContent,n=e.getElementsByTagName("z")[0].textContent;t.push(r,i,n)}else if("normal"===e.nodeName){const t=e.getElementsByTagName("nx")[0].textContent,i=e.getElementsByTagName("ny")[0].textContent,n=e.getElementsByTagName("nz")[0].textContent;r.push(t,i,n)}e=e.nextElementSibling}}i=i.nextElementSibling}return{vertices:t,normals:r}}function a(e){const t=e.attributes.id.textContent,r={name:"amfobject",meshes:[]};let n=null,a=e.firstElementChild;for(;a;){if("metadata"===a.nodeName)void 0!==a.attributes.type&&"name"===a.attributes.type.value&&(r.name=a.textContent);else if("color"===a.nodeName)n=i(a);else if("mesh"===a.nodeName){let e=a.firstElementChild;const t={vertices:[],normals:[],volumes:[],color:n};for(;e;){if("vertices"===e.nodeName){const r=o(e);t.normals=t.normals.concat(r.normals),t.vertices=t.vertices.concat(r.vertices)}else"volume"===e.nodeName&&t.volumes.push(s(e));e=e.nextElementSibling}r.meshes.push(t)}a=a.nextElementSibling}return{id:t,obj:r}}const l=function(t){let r=new DataView(t);if("PK"===String.fromCharCode(r.getUint8(0),r.getUint8(1))){let e=null,i=null;console.log("THREE.AMFLoader: Loading Zip");try{e=n.unzipSync(new Uint8Array(t))}catch(e){if(e instanceof ReferenceError)return console.log("THREE.AMFLoader: fflate missing and file is compressed."),null}for(i in e)if(".amf"===i.toLowerCase().substr(-4))break;console.log("THREE.AMFLoader: Trying to load file asset: "+i),r=new DataView(e[i].buffer)}const i=e.LoaderUtils.decodeText(r),s=(new DOMParser).parseFromString(i,"application/xml");return"amf"!==s.documentElement.nodeName.toLowerCase()?(console.log("THREE.AMFLoader: Error loading AMF - no AMF document found."),null):s}(t);let c="",h="";const u=function(e){let t=1,r="millimeter";void 0!==e.documentElement.attributes.unit&&(r=e.documentElement.attributes.unit.value.toLowerCase());const i={millimeter:1,inch:25.4,feet:304.8,meter:1e3,micron:.001};return void 0!==i[r]&&(t=i[r]),console.log("THREE.AMFLoader: Unit scale: "+t),t}(l),d={},p={},m=l.documentElement.childNodes;let f,g;for(f=0;f<m.length;f++){const e=m[f];if("metadata"===e.nodeName)void 0!==e.attributes.type&&("name"===e.attributes.type.value?c=e.textContent:"author"===e.attributes.type.value&&(h=e.textContent));else if("material"===e.nodeName){const t=r(e);d[t.id]=t.material}else if("object"===e.nodeName){const t=a(e);p[t.id]=t.obj}}const v=new e.Group,x=new e.MeshPhongMaterial({color:11184895,flatShading:!0});v.name=c,v.userData.author=h,v.userData.loader="AMF";for(const t in p){const r=p[t],i=r.meshes,n=new e.Group;for(n.name=r.name||"",f=0;f<i.length;f++){let t=x;const r=i[f],s=new e.Float32BufferAttribute(r.vertices,3);let o=null;if(r.normals.length&&(o=new e.Float32BufferAttribute(r.normals,3)),r.color){const i=r.color;t=x.clone(),t.color=new e.Color(i.r,i.g,i.b),1!==i.a&&(t.transparent=!0,t.opacity=i.a)}const a=r.volumes;for(g=0;g<a.length;g++){const r=a[g],i=new e.BufferGeometry;let l=t;i.setIndex(r.triangles),i.setAttribute("position",s.clone()),o&&i.setAttribute("normal",o.clone()),void 0!==d[r.materialId]&&(l=d[r.materialId]),i.scale(u,u,u),n.add(new e.Mesh(i,l.clone()))}}v.add(n)}return v}}class am extends e.Loader{constructor(t){super(t),this.loader=new e.FileLoader(this.manager),this.parser=null,this.meshBuilder=new cm(this.manager),this.animationBuilder=new dm}setAnimationPath(e){return this.animationPath=e,this}load(t,r,i,n){const s=this.meshBuilder.setCrossOrigin(this.crossOrigin);let o;o=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:e.LoaderUtils.extractUrlBase(t);const a=this._extractExtension(t).toLowerCase();"pmd"===a||"pmx"===a?this["pmd"===a?"loadPMD":"loadPMX"](t,(function(e){r(s.build(e,o,i,n))}),i,n):n&&n(new Error("THREE.MMDLoader: Unknown model file extension ."+a+"."))}loadAnimation(e,t,r,i,n){const s=this.animationBuilder;this.loadVMD(e,(function(e){r(t.isCamera?s.buildCameraAnimation(e):s.build(e,t))}),i,n)}loadWithAnimation(e,t,r,i,n){const s=this;this.load(e,(function(e){s.loadAnimation(t,e,(function(t){r({mesh:e,animation:t})}),i,n)}),i,n)}loadPMD(e,t,r,i){const n=this._getParser();this.loader.setMimeType(void 0).setPath(this.path).setResponseType("arraybuffer").setRequestHeader(this.requestHeader).setWithCredentials(this.withCredentials).load(e,(function(e){t(n.parsePmd(e,!0))}),r,i)}loadPMX(e,t,r,i){const n=this._getParser();this.loader.setMimeType(void 0).setPath(this.path).setResponseType("arraybuffer").setRequestHeader(this.requestHeader).setWithCredentials(this.withCredentials).load(e,(function(e){t(n.parsePmx(e,!0))}),r,i)}loadVMD(e,t,r,i){const n=Array.isArray(e)?e:[e],s=[],o=n.length,a=this._getParser();this.loader.setMimeType(void 0).setPath(this.animationPath).setResponseType("arraybuffer").setRequestHeader(this.requestHeader).setWithCredentials(this.withCredentials);for(let e=0,l=n.length;e<l;e++)this.loader.load(n[e],(function(e){s.push(a.parseVmd(e,!0)),s.length===o&&t(a.mergeVmds(s))}),r,i)}loadVPD(e,t,r,i,n){const s=this._getParser();this.loader.setMimeType(t?void 0:"text/plain; charset=shift_jis").setPath(this.animationPath).setResponseType("text").setRequestHeader(this.requestHeader).setWithCredentials(this.withCredentials).load(e,(function(e){r(s.parseVpd(e,!0))}),i,n)}_extractExtension(e){const t=e.lastIndexOf(".");return t<0?"":e.slice(t+1)}_getParser(){return null===this.parser&&(this.parser=new s.Parser),this.parser}}const lm=["data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAL0lEQVRYR+3QQREAAAzCsOFfNJPBJ1XQS9r2hsUAAQIECBAgQIAAAQIECBAgsBZ4MUx/ofm2I/kAAAAASUVORK5CYII=","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAN0lEQVRYR+3WQREAMBACsZ5/bWiiMvgEBTt5cW37hjsBBAgQIECAwFwgyfYPCCBAgAABAgTWAh8aBHZBl14e8wAAAABJRU5ErkJggg==","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAOUlEQVRYR+3WMREAMAwDsYY/yoDI7MLwIiP40+RJklfcCCBAgAABAgTqArfb/QMCCBAgQIAAgbbAB3z/e0F3js2cAAAAAElFTkSuQmCC","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAN0lEQVRYR+3WQREAMBACsZ5/B5ilMvgEBTt5cW37hjsBBAgQIECAwFwgyfYPCCBAgAABAgTWAh81dWyx0gFwKAAAAABJRU5ErkJggg==","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAOklEQVRYR+3WoREAMAwDsWb/UQtCy9wxTOQJ/oQ8SXKKGwEECBAgQIBAXeDt7f4BAQQIECBAgEBb4AOz8Hzx7WLY4wAAAABJRU5ErkJggg==","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAABPUlEQVRYR+1XwW7CMAy1+f9fZOMysSEOEweEOPRNdm3HbdOyIhAcklPrOs/PLy9RygBALxzcCDQFmgJNgaZAU6Ap0BR4PwX8gsRMVLssMRH5HcpzJEaWL7EVg9F1IHRlyqQohgVr4FGUlUcMJSjcUlDw0zvjeun70cLWmneoyf7NgBTQSniBTQQSuJAZsOnnaczjIMb5hCiuHKxokCrJfVnrctyZL0PkJAJe1HMil4nxeyi3Ypfn1kX51jpPvo/JeCNC4PhVdHdJw2XjBR8brF8PEIhNVn12AgP7uHsTBguBn53MUZCqv7Lp07Pn5k1Ro+uWmUNn7D+M57rtk7aG0Vo73xyF/fbFf0bPJjDXngnGocDTdFhygZjwUQrMNrDcmZlQT50VJ/g/UwNyHpu778+yW+/ksOz/BFo54P4AsUXMfRq7XWsAAAAASUVORK5CYII=","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAACMElEQVRYR+2Xv4pTQRTGf2dubhLdICiii2KnYKHVolhauKWPoGAnNr6BD6CvIVaihYuI2i1ia0BY0MZGRHQXjZj/mSPnnskfNWiWZUlzJ5k7M2cm833nO5Mziej2DWWJRUoCpQKlAntSQCqgw39/iUWAGmh37jrRnVsKlgpiqmkoGVABA7E57fvY+pJDdgKqF6HzFCSADkDq+F6AHABtQ+UMVE5D7zXod7fFNhTEckTbj5XQgHzNN+5tQvc5NG7C6BNkp6D3EmpXHDR+dQAjFLchW3VS9rlw3JBh+B7ys5Cf9z0GW1C/7P32AyBAOAz1q4jGliIH3YPuBnSfQX4OGreTIgEYQb/pBDtPnEQ4CivXYPAWBk13oHrB54yA9QuSn2H4AcKRpEILDt0BUzj+RLR1V5EqjD66NPRBVpLcQwjHoHYJOhsQv6U4mnzmrIXJCFr4LDwm/xBUoboG9XX4cc9VKdYoSA2yk5NQLJaKDUjTBoveG3Z2TElTxwjNK4M3LEZgUdDdruvcXzKBpStgp2NPiWi3ks9ZXxIoFVi+AvHLdc9TqtjL3/aYjpPlrzOcEnK62Szhimdd7xX232zFDTgtxezOu3WNMRLjiKgjtOhHVMd1loynVHvOgjuIIJMaELEqhJAV/RCSLbWTcfPFakFgFlALTRRvx+ok6Hlp/Q+v3fmx90bMyUzaEAhmM3KvHlXTL5DxnbGf/1M8RNNACLL5MNtPxP/mypJAqcDSFfgFhpYqWUzhTEAAAAAASUVORK5CYII=","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAL0lEQVRYR+3QQREAAAzCsOFfNJPBJ1XQS9r2hsUAAQIECBAgQIAAAQIECBAgsBZ4MUx/ofm2I/kAAAAASUVORK5CYII=","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAL0lEQVRYR+3QQREAAAzCsOFfNJPBJ1XQS9r2hsUAAQIECBAgQIAAAQIECBAgsBZ4MUx/ofm2I/kAAAAASUVORK5CYII=","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAL0lEQVRYR+3QQREAAAzCsOFfNJPBJ1XQS9r2hsUAAQIECBAgQIAAAQIECBAgsBZ4MUx/ofm2I/kAAAAASUVORK5CYII=","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAL0lEQVRYR+3QQREAAAzCsOFfNJPBJ1XQS9r2hsUAAQIECBAgQIAAAQIECBAgsBZ4MUx/ofm2I/kAAAAASUVORK5CYII="];class cm{constructor(e){this.crossOrigin="anonymous",this.geometryBuilder=new hm,this.materialBuilder=new um(e)}setCrossOrigin(e){return this.crossOrigin=e,this}build(t,r,i,n){const s=this.geometryBuilder.build(t),o=this.materialBuilder.setCrossOrigin(this.crossOrigin).setResourcePath(r).build(t,s,i,n),a=new e.SkinnedMesh(s,o),l=new e.Skeleton(function(t){const r=t.geometry,i=[];if(r&&void 0!==r.bones){for(let t=0,n=r.bones.length;t<n;t++){const n=r.bones[t],s=new e.Bone;i.push(s),s.name=n.name,s.position.fromArray(n.pos),s.quaternion.fromArray(n.rotq),void 0!==n.scl&&s.scale.fromArray(n.scl)}for(let e=0,n=r.bones.length;e<n;e++){const n=r.bones[e];-1!==n.parent&&null!==n.parent&&void 0!==i[n.parent]?i[n.parent].add(i[e]):t.add(i[e])}}return t.updateMatrixWorld(!0),i}(a));return a.bind(l),a}}class hm{build(t){const r=[],i=[],n=[],s=[],o=[],a=[],l=[],c=[],h=[],u=[],d=[],p=[],m=[],f=[];let g=0;const v={};for(let e=0;e<t.metadata.vertexCount;e++){const s=t.vertices[e];for(let e=0,t=s.position.length;e<t;e++)r.push(s.position[e]);for(let e=0,t=s.normal.length;e<t;e++)n.push(s.normal[e]);for(let e=0,t=s.uv.length;e<t;e++)i.push(s.uv[e]);for(let e=0;e<4;e++)l.push(s.skinIndices.length-1>=e?s.skinIndices[e]:0);for(let e=0;e<4;e++)c.push(s.skinWeights.length-1>=e?s.skinWeights[e]:0)}for(let e=0;e<t.metadata.faceCount;e++){const r=t.faces[e];for(let e=0,t=r.indices.length;e<t;e++)s.push(r.indices[e])}for(let e=0;e<t.metadata.materialCount;e++){const r=t.materials[e];o.push({offset:3*g,count:3*r.faceCount}),g+=r.faceCount}for(let e=0;e<t.metadata.rigidBodyCount;e++){const r=t.rigidBodies[e];let i=v[r.boneIndex];i=void 0===i?r.type:Math.max(r.type,i),v[r.boneIndex]=i}for(let e=0;e<t.metadata.boneCount;e++){const r=t.bones[e],i={index:e,transformationClass:r.transformationClass,parent:r.parentIndex,name:r.name,pos:r.position.slice(0,3),rotq:[0,0,0,1],scl:[1,1,1],rigidBodyType:void 0!==v[e]?v[e]:-1};-1!==i.parent&&(i.pos[0]-=t.bones[i.parent].position[0],i.pos[1]-=t.bones[i.parent].position[1],i.pos[2]-=t.bones[i.parent].position[2]),a.push(i)}if("pmd"===t.metadata.format)for(let r=0;r<t.metadata.ikCount;r++){const i=t.iks[r],n={target:i.target,effector:i.effector,iteration:i.iteration,maxAngle:4*i.maxAngle,links:[]};for(let r=0,s=i.links.length;r<s;r++){const s={};s.index=i.links[r].index,s.enabled=!0,t.bones[s.index].name.indexOf("ひざ")>=0&&(s.limitation=new e.Vector3(1,0,0)),n.links.push(s)}d.push(n)}else for(let r=0;r<t.metadata.boneCount;r++){const i=t.bones[r].ik;if(void 0===i)continue;const n={target:r,effector:i.effector,iteration:i.iteration,maxAngle:i.maxAngle,links:[]};for(let t=0,r=i.links.length;t<r;t++){const r={};if(r.index=i.links[t].index,r.enabled=!0,1===i.links[t].angleLimitation){const n=i.links[t].lowerLimitationAngle,s=i.links[t].upperLimitationAngle,o=-s[0],a=-s[1];s[0]=-n[0],s[1]=-n[1],n[0]=o,n[1]=a,r.rotationMin=(new e.Vector3).fromArray(n),r.rotationMax=(new e.Vector3).fromArray(s)}n.links.push(r)}d.push(n),a[r].ik=n}if("pmx"===t.metadata.format){const e={};for(let r=0;r<t.metadata.boneCount;r++){const i=t.bones[r],n=i.grant;if(void 0===n)continue;const s={index:r,parentIndex:n.parentIndex,ratio:n.ratio,isLocal:n.isLocal,affectRotation:n.affectRotation,affectPosition:n.affectPosition,transformationClass:i.transformationClass};e[r]={parent:null,children:[],param:s,visited:!1}}const r={parent:null,children:[],param:null,visited:!1};for(const t in e){const i=e[t],n=e[i.parentIndex]||r;i.parent=n,n.children.push(i)}!function e(t){t.param&&(p.push(t.param),a[t.param.index].grant=t.param),t.visited=!0;for(let r=0,i=t.children.length;r<i;r++){const i=t.children[r];i.visited||e(i)}}(r)}function x(e,r,i){for(let n=0;n<r.elementCount;n++){const s=r.elements[n];let o;o="pmd"===t.metadata.format?t.morphs[0].elements[s.index].index:s.index,e.array[3*o+0]+=s.position[0]*i,e.array[3*o+1]+=s.position[1]*i,e.array[3*o+2]+=s.position[2]*i}}for(let i=0;i<t.metadata.morphCount;i++){const n=t.morphs[i],s={name:n.name},o=new e.Float32BufferAttribute(3*t.metadata.vertexCount,3);o.name=n.name;for(let e=0;e<3*t.metadata.vertexCount;e++)o.array[e]=r[e];if("pmd"===t.metadata.format)0!==i&&x(o,n,1);else if(0===n.type)for(let e=0;e<n.elementCount;e++){const r=t.morphs[n.elements[e].index],i=n.elements[e].ratio;1===r.type&&x(o,r,i)}else 1===n.type?x(o,n,1):2===n.type||3===n.type||4===n.type||5===n.type||6===n.type||7===n.type||n.type;h.push(s),u.push(o)}for(let e=0;e<t.metadata.rigidBodyCount;e++){const r=t.rigidBodies[e],i={};for(const e in r)i[e]=r[e];if("pmx"===t.metadata.format&&-1!==i.boneIndex){const e=t.bones[i.boneIndex];i.position[0]-=e.position[0],i.position[1]-=e.position[1],i.position[2]-=e.position[2]}m.push(i)}for(let e=0;e<t.metadata.constraintCount;e++){const r=t.constraints[e],i={};for(const e in r)i[e]=r[e];const n=m[i.rigidBodyIndex1],s=m[i.rigidBodyIndex2];0!==n.type&&2===s.type&&-1!==n.boneIndex&&-1!==s.boneIndex&&t.bones[s.boneIndex].parentIndex===n.boneIndex&&(s.type=1),f.push(i)}const y=new e.BufferGeometry;y.setAttribute("position",new e.Float32BufferAttribute(r,3)),y.setAttribute("normal",new e.Float32BufferAttribute(n,3)),y.setAttribute("uv",new e.Float32BufferAttribute(i,2)),y.setAttribute("skinIndex",new e.Uint16BufferAttribute(l,4)),y.setAttribute("skinWeight",new e.Float32BufferAttribute(c,4)),y.setIndex(s);for(let e=0,t=o.length;e<t;e++)y.addGroup(o[e].offset,o[e].count,e);return y.bones=a,y.morphTargets=h,y.morphAttributes.position=u,y.morphTargetsRelative=!1,y.userData.MMD={bones:a,iks:d,grants:p,rigidBodies:m,constraints:f,format:t.metadata.format},y.computeBoundingSphere(),y}}class um{constructor(t){this.manager=t,this.textureLoader=new e.TextureLoader(this.manager),this.tgaLoader=null,this.crossOrigin="anonymous",this.resourcePath=void 0}setCrossOrigin(e){return this.crossOrigin=e,this}setResourcePath(e){return this.resourcePath=e,this}build(t,r){const i=[],n={};this.textureLoader.setCrossOrigin(this.crossOrigin);for(let s=0;s<t.metadata.materialCount;s++){const o=t.materials[s],a={userData:{}};if(void 0!==o.name&&(a.name=o.name),a.color=(new e.Color).fromArray(o.diffuse),a.opacity=o.diffuse[3],a.emissive=(new e.Color).fromArray(o.ambient),a.transparent=1!==a.opacity,a.skinning=r.bones.length>0,a.morphTargets=r.morphTargets.length>0,a.fog=!0,a.blending=e.CustomBlending,a.blendSrc=e.SrcAlphaFactor,a.blendDst=e.OneMinusSrcAlphaFactor,a.blendSrcAlpha=e.SrcAlphaFactor,a.blendDstAlpha=e.DstAlphaFactor,"pmx"===t.metadata.format&&1==(1&o.flag)?a.side=e.DoubleSide:a.side=1===a.opacity?e.FrontSide:e.DoubleSide,"pmd"===t.metadata.format){if(o.fileName){const t=o.fileName.split("*");if(a.map=this._loadTexture(t[0],n),t.length>1){const r=t[1].slice(-4).toLowerCase();a.envMap=this._loadTexture(t[1],n),a.combine=".sph"===r?e.MultiplyOperation:e.AddOperation}}const r=-1===o.toonIndex?"toon00.bmp":t.toonTextures[o.toonIndex].fileName;a.gradientMap=this._loadTexture(r,n,{isToonTexture:!0,isDefaultToonTexture:this._isDefaultToonTexture(r)}),a.userData.outlineParameters={thickness:1===o.edgeFlag?.003:0,color:[0,0,0],alpha:1,visible:1===o.edgeFlag}}else{let r,i;-1!==o.textureIndex&&(a.map=this._loadTexture(t.textures[o.textureIndex],n)),-1===o.envTextureIndex||1!==o.envFlag&&2!=o.envFlag||(a.envMap=this._loadTexture(t.textures[o.envTextureIndex],n),a.combine=1===o.envFlag?e.MultiplyOperation:e.AddOperation),-1===o.toonIndex||0!==o.toonFlag?(r="toon"+("0"+(o.toonIndex+1)).slice(-2)+".bmp",i=!0):(r=t.textures[o.toonIndex],i=!1),a.gradientMap=this._loadTexture(r,n,{isToonTexture:!0,isDefaultToonTexture:i}),a.userData.outlineParameters={thickness:o.edgeSize/300,color:o.edgeColor.slice(0,3),alpha:o.edgeColor[3],visible:0!=(16&o.flag)&&o.edgeSize>0}}void 0!==a.map&&(a.transparent||this._checkImageTransparency(a.map,r,s),a.emissive.multiplyScalar(.2)),i.push(new e.MeshToonMaterial(a))}if("pmx"===t.metadata.format){function s(e,t){for(let r=0,i=e.length;r<i;r++){const i=e[r];if(-1===i.index)continue;const n=t[i.index];n.opacity!==i.diffuse[3]&&(n.transparent=!0)}}for(let e=0,r=t.morphs.length;e<r;e++){const r=t.morphs[e],n=r.elements;if(0===r.type)for(let e=0,r=n.length;e<r;e++){const r=t.morphs[n[e].index];8===r.type&&s(r.elements,i)}else 8===r.type&&s(n,i)}}return i}_getTGALoader(){if(null===this.tgaLoader){if(void 0===zu)throw new Error("THREE.MMDLoader: Import TGALoader");this.tgaLoader=new zu(this.manager)}return this.tgaLoader}_isDefaultToonTexture(e){return 10===e.length&&/toon(10|0[0-9])\.bmp/.test(e)}_loadTexture(t,r,i,n,s){const o=this;let a;if(!0===(i=i||{}).isDefaultToonTexture){let e;try{e=parseInt(t.match(/toon([0-9]{2})\.bmp$/)[1])}catch(r){console.warn("THREE.MMDLoader: "+t+" seems like a not right default texture path. Using toon00.bmp instead."),e=0}a=lm[e]}else a=this.resourcePath+t;if(void 0!==r[a])return r[a];let l=this.manager.getHandler(a);null===l&&(l=".tga"===t.slice(-4).toLowerCase()?this._getTGALoader():this.textureLoader);const c=l.load(a,(function(t){!0===i.isToonTexture&&(t.image=o._getRotatedImage(t.image),t.magFilter=e.NearestFilter,t.minFilter=e.NearestFilter),t.flipY=!1,t.wrapS=e.RepeatWrapping,t.wrapT=e.RepeatWrapping;for(let e=0;e<c.readyCallbacks.length;e++)c.readyCallbacks[e](c);delete c.readyCallbacks}),n,s);return c.readyCallbacks=[],r[a]=c,c}_getRotatedImage(e){const t=document.createElement("canvas"),r=t.getContext("2d"),i=e.width,n=e.height;return t.width=i,t.height=n,r.clearRect(0,0,i,n),r.translate(i/2,n/2),r.rotate(.5*Math.PI),r.translate(-i/2,-n/2),r.drawImage(e,0,0),r.getImageData(0,0,i,n)}_checkImageTransparency(e,t,r){e.readyCallbacks.push((function(i){function n(e,t){const r=e.width,i=e.height;let n=Math.round(t.x*r)%r,s=Math.round(t.y*i)%i;n<0&&(n+=r),s<0&&(s+=i);const o=s*r+n;return e.data[4*o+3]}const s=void 0!==i.image.data?i.image:function(e){const t=document.createElement("canvas");t.width=e.width,t.height=e.height;const r=t.getContext("2d");return r.drawImage(e,0,0),r.getImageData(0,0,t.width,t.height)}(i.image),o=t.groups[r];(function(e,t,r){const i=e.width,s=e.height;if(e.data.length/(i*s)!=4)return!1;for(let i=0;i<r.length;i+=3){const s={x:0,y:0};for(let o=0;o<3;o++){const a=r[3*i+o],l={x:t[2*a+0],y:t[2*a+1]};if(n(e,l)<253)return!0;s.x+=l.x,s.y+=l.y}if(s.x/=3,s.y/=3,n(e,s)<253)return!0}return!1})(s,t.attributes.uv.array,t.index.array.slice(o.start,o.start+o.count))&&(e.transparent=!0)}))}}class dm{build(t,r){const i=this.buildSkeletalAnimation(t,r).tracks,n=this.buildMorphAnimation(t,r).tracks;for(let e=0,t=n.length;e<t;e++)i.push(n[e]);return new e.AnimationClip("",-1,i)}buildSkeletalAnimation(t,r){function i(e,t,r){e.push(t[r+0]/127),e.push(t[r+8]/127),e.push(t[r+4]/127),e.push(t[r+12]/127)}const n=[],s={},o=r.skeleton.bones,a={};for(let e=0,t=o.length;e<t;e++)a[o[e].name]=!0;for(let e=0;e<t.metadata.motionCount;e++){const r=t.motions[e],i=r.boneName;void 0!==a[i]&&(s[i]=s[i]||[],s[i].push(r))}for(const t in s){const o=s[t];o.sort((function(e,t){return e.frameNum-t.frameNum}));const a=[],l=[],c=[],h=[],u=[],d=r.skeleton.getBoneByName(t).position.toArray();for(let e=0,t=o.length;e<t;e++){const t=o[e].frameNum/30,r=o[e].position,n=o[e].rotation,s=o[e].interpolation;a.push(t);for(let e=0;e<3;e++)l.push(d[e]+r[e]);for(let e=0;e<4;e++)c.push(n[e]);for(let e=0;e<3;e++)i(h,s,e);i(u,s,3)}const p=".bones["+t+"]";n.push(this._createTrack(p+".position",e.VectorKeyframeTrack,a,l,h)),n.push(this._createTrack(p+".quaternion",e.QuaternionKeyframeTrack,a,c,u))}return new e.AnimationClip("",-1,n)}buildMorphAnimation(t,r){const i=[],n={},s=r.morphTargetDictionary;for(let e=0;e<t.metadata.morphCount;e++){const r=t.morphs[e],i=r.morphName;void 0!==s[i]&&(n[i]=n[i]||[],n[i].push(r))}for(const t in n){const r=n[t];r.sort((function(e,t){return e.frameNum-t.frameNum}));const o=[],a=[];for(let e=0,t=r.length;e<t;e++)o.push(r[e].frameNum/30),a.push(r[e].weight);i.push(new e.NumberKeyframeTrack(".morphTargetInfluences["+s[t]+"]",o,a))}return new e.AnimationClip("",-1,i)}buildCameraAnimation(t){function r(e,t){e.push(t.x),e.push(t.y),e.push(t.z)}function i(e,t,r){e.push(t[4*r+0]/127),e.push(t[4*r+1]/127),e.push(t[4*r+2]/127),e.push(t[4*r+3]/127)}const n=void 0===t.cameras?[]:t.cameras.slice();n.sort((function(e,t){return e.frameNum-t.frameNum}));const s=[],o=[],a=[],l=[],c=[],h=[],u=[],d=[],p=[],m=new e.Quaternion,f=new e.Euler,g=new e.Vector3,v=new e.Vector3;for(let e=0,t=n.length;e<t;e++){const t=n[e],b=t.frameNum/30,A=t.position,w=t.rotation,M=t.distance,T=t.fov,S=t.interpolation;s.push(b),g.set(0,0,-M),v.set(A[0],A[1],A[2]),f.set(-w[0],-w[1],-w[2]),m.setFromEuler(f),g.add(v),g.applyQuaternion(m),r(o,v),(x=a).push((y=m).x),x.push(y.y),x.push(y.z),x.push(y.w),r(l,g),c.push(T);for(let e=0;e<3;e++)i(h,S,e);i(u,S,3);for(let e=0;e<3;e++)i(d,S,4);i(p,S,5)}var x,y;const b=[];return b.push(this._createTrack("target.position",e.VectorKeyframeTrack,s,o,h)),b.push(this._createTrack(".quaternion",e.QuaternionKeyframeTrack,s,a,u)),b.push(this._createTrack(".position",e.VectorKeyframeTrack,s,l,d)),b.push(this._createTrack(".fov",e.NumberKeyframeTrack,s,c,p)),new e.AnimationClip("",-1,b)}_createTrack(e,t,r,i,n){if(r.length>2){r=r.slice(),i=i.slice(),n=n.slice();const e=i.length/r.length,t=n.length/r.length;let s=1;for(let o=2,a=r.length;o<a;o++){for(let t=0;t<e;t++)if(i[s*e+t]!==i[(s-1)*e+t]||i[s*e+t]!==i[o*e+t]){s++;break}if(o>s){r[s]=r[o];for(let t=0;t<e;t++)i[s*e+t]=i[o*e+t];for(let e=0;e<t;e++)n[s*t+e]=n[o*t+e]}}r.length=s+1,i.length=(s+1)*e,n.length=(s+1)*t}const s=new t(e,r,i);return s.createInterpolant=function(e){return new pm(this.times,this.values,this.getValueSize(),e,new Float32Array(n))},s}}class pm extends e.Interpolant{constructor(e,t,r,i,n){super(e,t,r,i),this.interpolationParams=n}interpolate_(t,r,i,n){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=this.interpolationParams,c=t*a,h=c-a,u=n-r<.05?0:(i-r)/(n-r);if(4===a){const r=l[4*t+0],i=l[4*t+1],n=l[4*t+2],a=l[4*t+3],d=this._calculate(r,i,n,a,u);e.Quaternion.slerpFlat(s,0,o,h,o,c,d)}else if(3===a)for(let e=0;e!==a;++e){const r=l[12*t+4*e+0],i=l[12*t+4*e+1],n=l[12*t+4*e+2],a=l[12*t+4*e+3],d=this._calculate(r,i,n,a,u);s[e]=o[h+e]*(1-d)+o[c+e]*d}else{const e=l[4*t+0],r=l[4*t+1],i=l[4*t+2],n=l[4*t+3],a=this._calculate(e,r,i,n,u);s[0]=o[h]*(1-a)+o[c]*a}return s}_calculate(e,t,r,i,n){let s=.5,o=s,a=1-o;const l=Math;let c,h,u;for(let r=0;r<15;r++){c=3*a*a*o,h=3*a*o*o,u=o*o*o;const r=c*e+h*t+u-n;if(l.abs(r)<1e-5)break;s/=2,o+=r<0?s:-s,a=1-o}return c*r+h*i+u}}class mm extends e.CompressedTextureLoader{constructor(e){super(e)}parse(e,t){const r=new fm(e,1);return{mipmaps:r.mipmaps(t),width:r.pixelWidth,height:r.pixelHeight,format:r.glInternalFormat,isCubemap:6===r.numberOfFaces,mipmapCount:r.numberOfMipmapLevels}}}class fm{constructor(e,t){this.arrayBuffer=e;const r=new Uint8Array(this.arrayBuffer,0,12);if(171!==r[0]||75!==r[1]||84!==r[2]||88!==r[3]||32!==r[4]||49!==r[5]||49!==r[6]||187!==r[7]||13!==r[8]||10!==r[9]||26!==r[10]||10!==r[11])return void console.error("texture missing KTX identifier");const i=Uint32Array.BYTES_PER_ELEMENT,n=new DataView(this.arrayBuffer,12,13*i),s=67305985===n.getUint32(0,!0);this.glType=n.getUint32(1*i,s),this.glTypeSize=n.getUint32(2*i,s),this.glFormat=n.getUint32(3*i,s),this.glInternalFormat=n.getUint32(4*i,s),this.glBaseInternalFormat=n.getUint32(5*i,s),this.pixelWidth=n.getUint32(6*i,s),this.pixelHeight=n.getUint32(7*i,s),this.pixelDepth=n.getUint32(8*i,s),this.numberOfArrayElements=n.getUint32(9*i,s),this.numberOfFaces=n.getUint32(10*i,s),this.numberOfMipmapLevels=n.getUint32(11*i,s),this.bytesOfKeyValueData=n.getUint32(12*i,s),0===this.glType?(this.numberOfMipmapLevels=Math.max(1,this.numberOfMipmapLevels),0!==this.pixelHeight&&0===this.pixelDepth?0===this.numberOfArrayElements?this.numberOfFaces===t?this.loadType=0:console.warn("number of faces expected"+t+", but found "+this.numberOfFaces):console.warn("texture arrays not currently supported"):console.warn("only 2D textures currently supported")):console.warn("only compressed formats currently supported")}mipmaps(e){const t=[];let r=64+this.bytesOfKeyValueData,i=this.pixelWidth,n=this.pixelHeight;const s=e?this.numberOfMipmapLevels:1;for(let e=0;e<s;e++){const e=new Int32Array(this.arrayBuffer,r,1)[0];r+=4;for(let s=0;s<this.numberOfFaces;s++){const s=new Uint8Array(this.arrayBuffer,r,e);t.push({data:s,width:i,height:n}),r+=e,r+=3-(e+3)%4}i=Math.max(1,.5*i),n=Math.max(1,.5*n)}return t}}class gm extends e.Loader{load(t,r,i,n){const s=this,o=new e.FileLoader(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setWithCredentials(this.withCredentials),o.load(t,(function(e){try{r(s.parse(e))}catch(e){n?n(e):console.error(e),s.manager.itemError(t)}}),i,n)}parse(t){const r=new e.Group,i=n.unzipSync(new Uint8Array(t.slice(16))),s=JSON.parse(n.strFromU8(i["metadata.json"])),o=new DataView(i["data.sketch"].buffer),a=o.getInt32(16,!0),l={};let c=20;for(let e=0;e<a;e++){const e=o.getInt32(c,!0),t=[o.getFloat32(c+4,!0),o.getFloat32(c+8,!0),o.getFloat32(c+12,!0),o.getFloat32(c+16,!0)],r=o.getFloat32(c+20,!0),i=o.getUint32(c+24,!0),n=o.getUint32(c+28,!0);let s=0,a=0;for(let e=0;e<4;e++){const t=1<<e;(i&t)>0&&(s+=4),(n&t)>0&&(a+=4)}c=c+28+s+4;const h=o.getInt32(c,!0),u=new Float32Array(3*h),d=new Float32Array(4*h);c+=4;for(let e=0,t=0;e<u.length;e+=3,t+=4)u[e+0]=o.getFloat32(c+0,!0),u[e+1]=o.getFloat32(c+4,!0),u[e+2]=o.getFloat32(c+8,!0),d[t+0]=o.getFloat32(c+12,!0),d[t+1]=o.getFloat32(c+16,!0),d[t+2]=o.getFloat32(c+20,!0),d[t+3]=o.getFloat32(c+24,!0),c=c+28+a;e in l==!1&&(l[e]=[]),l[e].push([u,d,r,t])}for(const t in l){const i=new vm(l[t]),n=bm(s.BrushIndex[t]);r.add(new e.Mesh(i,n))}return r}}class vm extends e.BufferGeometry{constructor(t){super();const r=[],i=[],n=[],s=new e.Vector3,o=new e.Vector3,a=new e.Quaternion,l=new e.Quaternion,c=new e.Vector3,h=new e.Vector3,u=new e.Vector3,d=new e.Vector3;for(const e in t){const p=t[e],m=p[0],f=p[1],g=p[2],v=p[3];o.fromArray(m,0),l.fromArray(f,0);for(let e=3,t=4,p=m.length;e<p;e+=3,t+=4){s.fromArray(m,e),a.fromArray(f,t),c.set(-g,0,0),c.applyQuaternion(a),c.add(s),h.set(g,0,0),h.applyQuaternion(a),h.add(s),u.set(g,0,0),u.applyQuaternion(l),u.add(o),d.set(-g,0,0),d.applyQuaternion(l),d.add(o),r.push(c.x,c.y,-c.z),r.push(h.x,h.y,-h.z),r.push(d.x,d.y,-d.z),r.push(h.x,h.y,-h.z),r.push(u.x,u.y,-u.z),r.push(d.x,d.y,-d.z),o.copy(s),l.copy(a),i.push(...v),i.push(...v),i.push(...v),i.push(...v),i.push(...v),i.push(...v);const x=e/p,y=(e-3)/p;n.push(x,0),n.push(x,1),n.push(y,0),n.push(x,1),n.push(y,1),n.push(y,0)}}this.setAttribute("position",new e.BufferAttribute(new Float32Array(r),3)),this.setAttribute("color",new e.BufferAttribute(new Float32Array(i),4)),this.setAttribute("uv",new e.BufferAttribute(new Float32Array(n),2))}}const xm={"89d104cd-d012-426b-b5b3-bbaee63ac43c":"Bubbles","700f3aa8-9a7c-2384-8b8a-ea028905dd8c":"CelVinyl","0f0ff7b2-a677-45eb-a7d6-0cd7206f4816":"ChromaticWave","1161af82-50cf-47db-9706-0c3576d43c43":"CoarseBristles","79168f10-6961-464a-8be1-57ed364c5600":"CoarseBristlesSingleSided","1caa6d7d-f015-3f54-3a4b-8b5354d39f81":"Comet","c8313697-2563-47fc-832e-290f4c04b901":"DiamondHull","4391aaaa-df73-4396-9e33-31e4e4930b27":"Disco","d1d991f2-e7a0-4cf1-b328-f57e915e6260":"DotMarker","6a1cf9f9-032c-45ec-9b1d-a6680bee30f7":"Dots","0d3889f3-3ede-470c-8af4-f44813306126":"DoubleTaperedFlat","0d3889f3-3ede-470c-8af4-de4813306126":"DoubleTaperedMarker","d0262945-853c-4481-9cbd-88586bed93cb":"DuctTape","3ca16e2f-bdcd-4da2-8631-dcef342f40f1":"DuctTapeSingleSided","f6e85de3-6dcc-4e7f-87fd-cee8c3d25d51":"Electricity","02ffb866-7fb2-4d15-b761-1012cefb1360":"Embers","cb92b597-94ca-4255-b017-0e3f42f12f9e":"Fire","2d35bcf0-e4d8-452c-97b1-3311be063130":"Flat","55303bc4-c749-4a72-98d9-d23e68e76e18":"FlatDeprecated","280c0a7a-aad8-416c-a7d2-df63d129ca70":"FlatSingleSided","cf019139-d41c-4eb0-a1d0-5cf54b0a42f3":"Highlighter","6a1cf9f9-032c-45ec-9b6e-a6680bee32e9":"HyperGrid","dce872c2-7b49-4684-b59b-c45387949c5c":"Hypercolor","e8ef32b1-baa8-460a-9c2c-9cf8506794f5":"HypercolorSingleSided","2f212815-f4d3-c1a4-681a-feeaf9c6dc37":"Icing","f5c336cf-5108-4b40-ade9-c687504385ab":"Ink","c0012095-3ffd-4040-8ee1-fc180d346eaa":"InkSingleSided","4a76a27a-44d8-4bfe-9a8c-713749a499b0":"Leaves","ea19de07-d0c0-4484-9198-18489a3c1487":"LeavesSingleSided","2241cd32-8ba2-48a5-9ee7-2caef7e9ed62":"Light","4391aaaa-df81-4396-9e33-31e4e4930b27":"LightWire","d381e0f5-3def-4a0d-8853-31e9200bcbda":"Lofted","429ed64a-4e97-4466-84d3-145a861ef684":"Marker","79348357-432d-4746-8e29-0e25c112e3aa":"MatteHull","b2ffef01-eaaa-4ab5-aa64-95a2c4f5dbc6":"NeonPulse","f72ec0e7-a844-4e38-82e3-140c44772699":"OilPaint","c515dad7-4393-4681-81ad-162ef052241b":"OilPaintSingleSided","f1114e2e-eb8d-4fde-915a-6e653b54e9f5":"Paper","759f1ebd-20cd-4720-8d41-234e0da63716":"PaperSingleSided","e0abbc80-0f80-e854-4970-8924a0863dcc":"Petal","c33714d1-b2f9-412e-bd50-1884c9d46336":"Plasma","ad1ad437-76e2-450d-a23a-e17f8310b960":"Rainbow","faaa4d44-fcfb-4177-96be-753ac0421ba3":"ShinyHull","70d79cca-b159-4f35-990c-f02193947fe8":"Smoke","d902ed8b-d0d1-476c-a8de-878a79e3a34c":"Snow","accb32f5-4509-454f-93f8-1df3fd31df1b":"SoftHighlighter","cf7f0059-7aeb-53a4-2b67-c83d863a9ffa":"Spikes","8dc4a70c-d558-4efd-a5ed-d4e860f40dc3":"Splatter","7a1c8107-50c5-4b70-9a39-421576d6617e":"SplatterSingleSided","0eb4db27-3f82-408d-b5a1-19ebd7d5b711":"Stars","44bb800a-fbc3-4592-8426-94ecb05ddec3":"Streamers","0077f88c-d93a-42f3-b59b-b31c50cdb414":"Taffy","b468c1fb-f254-41ed-8ec9-57030bc5660c":"TaperedFlat","c8ccb53d-ae13-45ef-8afb-b730d81394eb":"TaperedFlatSingleSided","d90c6ad8-af0f-4b54-b422-e0f92abe1b3c":"TaperedMarker","1a26b8c0-8a07-4f8a-9fac-d2ef36e0cad0":"TaperedMarker_Flat","75b32cf0-fdd6-4d89-a64b-e2a00b247b0f":"ThickPaint","fdf0326a-c0d1-4fed-b101-9db0ff6d071f":"ThickPaintSingleSided","4391385a-df73-4396-9e33-31e4e4930b27":"Toon","a8fea537-da7c-4d4b-817f-24f074725d6d":"UnlitHull","d229d335-c334-495a-a801-660ac8a87360":"VelvetInk","10201aa3-ebc2-42d8-84b7-2e63f6eeb8ab":"Waveform","b67c0e81-ce6d-40a8-aeb0-ef036b081aa3":"WetPaint","dea67637-cd1a-27e4-c9b1-52f4bbcb84e5":"WetPaintSingleSided","5347acf0-a8e2-47b6-8346-30c70719d763":"WigglyGraphite","e814fef1-97fd-7194-4a2f-50c2bb918be2":"WigglyGraphiteSingleSided","4391385a-cf83-4396-9e33-31e4e4930b27":"Wire"},ym={BloomColor:"\n\t\t\tvec3 BloomColor(vec3 color, float gain) {\n\t\t\t\t// Guarantee that there's at least a little bit of all 3 channels.\n\t\t\t\t// This makes fully-saturated strokes (which only have 2 non-zero\n\t\t\t\t// color channels) eventually clip to white rather than to a secondary.\n\t\t\t\tfloat cmin = length(color.rgb) * .05;\n\t\t\t\tcolor.rgb = max(color.rgb, vec3(cmin, cmin, cmin));\n\t\t\t\t// If we try to remove this pow() from .a, it brightens up\n\t\t\t\t// pressure-sensitive strokes; looks better as-is.\n\t\t\t\tcolor = pow(color, vec3(2.2));\n\t\t\t\tcolor.rgb *= 2. * exp(gain * 10.);\n\t\t\t\treturn color;\n\t\t\t}\n\t\t",LinearToSrgb:"\n\t\t\tvec3 LinearToSrgb(vec3 color) {\n\t\t\t\t// Approximation http://chilliant.blogspot.com/2012/08/srgb-approximations-for-hlsl.html\n\t\t\t\tvec3 linearColor = color.rgb;\n\t\t\t\tvec3 S1 = sqrt(linearColor);\n\t\t\t\tvec3 S2 = sqrt(S1);\n\t\t\t\tvec3 S3 = sqrt(S2);\n\t\t\t\tcolor.rgb = 0.662002687 * S1 + 0.684122060 * S2 - 0.323583601 * S3 - 0.0225411470 * linearColor;\n\t\t\t\treturn color;\n\t\t\t}\n\t\t",hsv:"\n\t\t\t// uniform sampler2D lookupTex;\n\t\t\tvec4 lookup(vec4 textureColor) {\n\t\t\t\treturn textureColor;\n\t\t\t}\n\n\t\t\tvec3 lookup(vec3 textureColor) {\n\t\t\t\treturn textureColor;\n\t\t\t}\n\n\t\t\tvec3 hsv2rgb( vec3 hsv ) {\n\t\t\t\tvec3 rgb = clamp( abs(mod(hsv.x*6.0+vec3(0.0,4.0,2.0),6.0)-3.0)-1.0, 0.0, 1.0 );\n\t\t\t\treturn hsv.z * mix( vec3(1.0), rgb, hsv.y);\n\t\t\t}\n\n\t\t\tvec3 rgb2hsv( vec3 rgb ) {\n\t\t\t\tvec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);\n\t\t\t\tvec4 p = mix(vec4(rgb.bg, K.wz), vec4(rgb.gb, K.xy), step(rgb.b, rgb.g));\n\t\t\t\tvec4 q = mix(vec4(p.xyw, rgb.r), vec4(rgb.r, p.yzx), step(p.x, rgb.r));\n\n\t\t\t\tfloat d = q.x - min(q.w, q.y);\n\t\t\t\tfloat e = 1.0e-10;\n\n\t\t\t\treturn vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);\n\t\t\t}\n\t\t",SrgbToLinear:"\n\t\t\tvec3 SrgbToLinear(vec3 color) {\n\t\t\t\t// Approximation http://chilliant.blogspot.com/2012/08/srgb-approximations-for-hlsl.html\n\t\t\t\tvec3 sRGB = color.rgb;\n\t\t\t\tcolor.rgb = sRGB * (sRGB * (sRGB * 0.305306011 + 0.682171111) + 0.012522878);\n\t\t\t\treturn color;\n\t\t\t}\n\t\t"};function bm(t){switch(xm[t]){case"Light":return new e.RawShaderMaterial({uniforms:{mainTex:{value:(new e.TextureLoader).setPath("./textures/tiltbrush/").loader.load("Light.webp")},alphaTest:{value:.067},emission_gain:{value:.45},alpha:{value:1}},vertexShader:`\n\t\t\tprecision highp float;\n\t\t\tprecision highp int;\n\n\t\t\tattribute vec2 uv;\n\t\t\tattribute vec4 color;\n\t\t\tattribute vec3 position;\n\n\t\t\tuniform mat4 modelMatrix;\n\t\t\tuniform mat4 modelViewMatrix;\n\t\t\tuniform mat4 projectionMatrix;\n\t\t\tuniform mat4 viewMatrix;\n\t\t\tuniform mat3 normalMatrix;\n\t\t\tuniform vec3 cameraPosition;\n\n\t\t\tvarying vec2 vUv;\n\t\t\tvarying vec3 vColor;\n\n\t\t\t${ym.LinearToSrgb}\n\t\t\t${ym.hsv}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvUv = uv;\n\n\t\t\t\tvColor = lookup(color.rgb);\n\n\t\t\t\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\n\t\t\t\tgl_Position = projectionMatrix * mvPosition;\n\n\t\t\t}\n\t\t`,fragmentShader:`\n\t\t\tprecision highp float;\n\t\t\tprecision highp int;\n\n\t\t\tuniform float emission_gain;\n\n\t\t\tuniform sampler2D mainTex;\n\t\t\tuniform float alphaTest;\n\n\t\t\tvarying vec2 vUv;\n\t\t\tvarying vec3 vColor;\n\n\t\t\t${ym.BloomColor}\n\t\t\t${ym.SrgbToLinear}\n\n\t\t\tvoid main(){\n\t\t\t\tvec4 col = texture2D(mainTex, vUv);\n\t\t\t\tvec3 color = vColor;\n\t\t\t\tcolor = BloomColor(color, emission_gain);\n\t\t\t\tcolor = color * col.rgb;\n\t\t\t\tcolor = color * col.a;\n\t\t\t\tcolor = SrgbToLinear(color);\n\t\t\t\tgl_FragColor = vec4(color, 1.0);\n\t\t\t}\n\t\t`,side:2,transparent:!0,depthFunc:2,depthWrite:!0,depthTest:!1,blending:5,blendDst:201,blendDstAlpha:201,blendEquation:100,blendEquationAlpha:100,blendSrc:201,blendSrcAlpha:201});default:return new e.MeshBasicMaterial({vertexColors:!0,side:e.DoubleSide})}}const Am=new WeakMap;class wm extends e.Loader{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(t,r,i,n){const s=new e.FileLoader(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(t,(e=>{const t={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(e,t).then(r).catch(n)}),i,n)}decodeDracoFile(e,t,r,i){const n={attributeIDs:r||this.defaultAttributeIDs,attributeTypes:i||this.defaultAttributeTypes,useUniqueIDs:!!r};this.decodeGeometry(e,n).then(t)}decodeGeometry(e,t){for(const e in t.attributeTypes){const r=t.attributeTypes[e];void 0!==r.BYTES_PER_ELEMENT&&(t.attributeTypes[e]=r.name)}const r=JSON.stringify(t);if(Am.has(e)){const t=Am.get(e);if(t.key===r)return t.promise;if(0===e.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let i;const n=this.workerNextTaskID++,s=e.byteLength,o=this._getWorker(n,s).then((r=>(i=r,new Promise(((r,s)=>{i._callbacks[n]={resolve:r,reject:s},i.postMessage({type:"decode",id:n,taskConfig:t,buffer:e},[e])}))))).then((e=>this._createGeometry(e.geometry)));return o.catch((()=>!0)).then((()=>{i&&n&&this._releaseTask(i,n)})),Am.set(e,{key:r,promise:o}),o}_createGeometry(t){const r=new e.BufferGeometry;t.index&&r.setIndex(new e.BufferAttribute(t.index.array,1));for(let i=0;i<t.attributes.length;i++){const n=t.attributes[i],s=n.name,o=n.array,a=n.itemSize;r.setAttribute(s,new e.BufferAttribute(o,a))}return r}_loadLibrary(t,r){const i=new e.FileLoader(this.manager);return i.setPath(this.decoderPath),i.setResponseType(r),i.setWithCredentials(this.withCredentials),new Promise(((e,r)=>{i.load(t,e,void 0,r)}))}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then((t=>{const r=t[0];e||(this.decoderConfig.wasmBinary=t[1]);const i=Mm.toString(),n=["/* draco decoder */",r,"","/* worker */",i.substring(i.indexOf("{")+1,i.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([n]))})),this.decoderPending}_getWorker(e,t){return this._initDecoder().then((()=>{if(this.workerPool.length<this.workerLimit){const e=new Worker(this.workerSourceURL);e._callbacks={},e._taskCosts={},e._taskLoad=0,e.postMessage({type:"init",decoderConfig:this.decoderConfig}),e.onmessage=function(t){const r=t.data;switch(r.type){case"decode":e._callbacks[r.id].resolve(r);break;case"error":e._callbacks[r.id].reject(r);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+r.type+'"')}},this.workerPool.push(e)}else this.workerPool.sort((function(e,t){return e._taskLoad>t._taskLoad?-1:1}));const r=this.workerPool[this.workerPool.length-1];return r._taskCosts[e]=t,r._taskLoad+=t,r}))}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map((e=>e._taskLoad)))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this}}function Mm(){let e,t;function r(e,t,r,i,n,s){const o=s.num_components(),a=r.num_points()*o,l=a*n.BYTES_PER_ELEMENT,c=function(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32}}(e,n),h=e._malloc(l);t.GetAttributeDataArrayForAllPoints(r,s,c,l,h);const u=new n(e.HEAPF32.buffer,h,a).slice();return e._free(h),{name:i,array:u,itemSize:o}}onmessage=function(i){const n=i.data;switch(n.type){case"init":e=n.decoderConfig,t=new Promise((function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)}));break;case"decode":const i=n.buffer,s=n.taskConfig;t.then((e=>{const t=e.draco,o=new t.Decoder,a=new t.DecoderBuffer;a.Init(new Int8Array(i),i.byteLength);try{const e=function(e,t,i,n){const s=n.attributeIDs,o=n.attributeTypes;let a,l;const c=t.GetEncodedGeometryType(i);if(c===e.TRIANGULAR_MESH)a=new e.Mesh,l=t.DecodeBufferToMesh(i,a);else{if(c!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");a=new e.PointCloud,l=t.DecodeBufferToPointCloud(i,a)}if(!l.ok()||0===a.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+l.error_msg());const h={index:null,attributes:[]};for(const i in s){const l=self[o[i]];let c,u;if(n.useUniqueIDs)u=s[i],c=t.GetAttributeByUniqueId(a,u);else{if(u=t.GetAttributeId(a,e[s[i]]),-1===u)continue;c=t.GetAttribute(a,u)}h.attributes.push(r(e,t,a,i,l,c))}c===e.TRIANGULAR_MESH&&(h.index=function(e,t,r){const i=3*r.num_faces(),n=4*i,s=e._malloc(n);t.GetTrianglesUInt32Array(r,n,s);const o=new Uint32Array(e.HEAPF32.buffer,s,i).slice();return e._free(s),{array:o,itemSize:1}}(e,t,a));return e.destroy(a),h}(t,o,a,s),i=e.attributes.map((e=>e.array.buffer));e.index&&i.push(e.index.array.buffer),self.postMessage({type:"decode",id:n.id,geometry:e},i)}catch(e){console.error(e),self.postMessage({type:"error",id:n.id,error:e.message})}finally{t.destroy(a),t.destroy(o)}}))}}}class Tm extends e.Loader{constructor(t){super(t),this.hdrLoader=new Md,this.type=e.HalfFloatType}load(t,r,i,n){Array.isArray(t)||(console.warn("THREE.HDRCubeTextureLoader signature has changed. Use .setDataType() instead."),this.setDataType(t),t=r,r=i,i=n,n=arguments[4]);const s=new e.CubeTexture;switch(s.type=this.type,s.type){case e.FloatType:case e.HalfFloatType:"colorSpace"in s?s.colorSpace="srgb-linear":s.encoding=3e3,s.minFilter=e.LinearFilter,s.magFilter=e.LinearFilter,s.generateMipmaps=!1}const o=this;let a=0;function l(r,i,n,l){new e.FileLoader(o.manager).setPath(o.path).setResponseType("arraybuffer").setWithCredentials(o.withCredentials).load(t[r],(function(t){a++;const n=o.hdrLoader.parse(t);if(n){if(void 0!==n.data){const t=new e.DataTexture(n.data,n.width,n.height);t.type=s.type,t.encoding=s.encoding,t.format=s.format,t.minFilter=s.minFilter,t.magFilter=s.magFilter,t.generateMipmaps=s.generateMipmaps,s.images[r]=t}6===a&&(s.needsUpdate=!0,i&&i(s))}}),n,l)}for(let e=0;e<t.length;e++)l(e,r,i,n);return s}setDataType(e){return this.type=e,this.hdrLoader.setDataType(e),this}}class Sm extends e.Loader{constructor(e){super(e)}load(t,r,i,n){const s=this,o=new e.FileLoader(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(t,(function(e){try{r(s.parse(e))}catch(e){n?n(e):console.error(e),s.manager.itemError(t)}}),i,n)}parse(t){function r(e){return e.replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function i(e){return e.charAt(0).toUpperCase()+e.substr(1).toLowerCase()}function n(e,t,r,i){const n=parseInt(h[i].substr(e,t));if(n){const e=(s=r,o=n,"s"+Math.min(s,o)+"e"+Math.max(s,o));void 0===l[e]&&(a.push([r-1,n-1,1]),l[e]=a.length-1)}var s,o}const s={h:[255,255,255],he:[217,255,255],li:[204,128,255],be:[194,255,0],b:[255,181,181],c:[144,144,144],n:[48,80,248],o:[255,13,13],f:[144,224,80],ne:[179,227,245],na:[171,92,242],mg:[138,255,0],al:[191,166,166],si:[240,200,160],p:[255,128,0],s:[255,255,48],cl:[31,240,31],ar:[128,209,227],k:[143,64,212],ca:[61,255,0],sc:[230,230,230],ti:[191,194,199],v:[166,166,171],cr:[138,153,199],mn:[156,122,199],fe:[224,102,51],co:[240,144,160],ni:[80,208,80],cu:[200,128,51],zn:[125,128,176],ga:[194,143,143],ge:[102,143,143],as:[189,128,227],se:[255,161,0],br:[166,41,41],kr:[92,184,209],rb:[112,46,176],sr:[0,255,0],y:[148,255,255],zr:[148,224,224],nb:[115,194,201],mo:[84,181,181],tc:[59,158,158],ru:[36,143,143],rh:[10,125,140],pd:[0,105,133],ag:[192,192,192],cd:[255,217,143],in:[166,117,115],sn:[102,128,128],sb:[158,99,181],te:[212,122,0],i:[148,0,148],xe:[66,158,176],cs:[87,23,143],ba:[0,201,0],la:[112,212,255],ce:[255,255,199],pr:[217,255,199],nd:[199,255,199],pm:[163,255,199],sm:[143,255,199],eu:[97,255,199],gd:[69,255,199],tb:[48,255,199],dy:[31,255,199],ho:[0,255,156],er:[0,230,117],tm:[0,212,82],yb:[0,191,56],lu:[0,171,36],hf:[77,194,255],ta:[77,166,255],w:[33,148,214],re:[38,125,171],os:[38,102,150],ir:[23,84,135],pt:[208,208,224],au:[255,209,35],hg:[184,184,208],tl:[166,84,77],pb:[87,89,97],bi:[158,79,181],po:[171,92,0],at:[117,79,69],rn:[66,130,150],fr:[66,0,102],ra:[0,125,0],ac:[112,171,250],th:[0,186,255],pa:[0,161,255],u:[0,143,255],np:[0,128,255],pu:[0,107,255],am:[84,92,242],cm:[120,92,227],bk:[138,79,227],cf:[161,54,212],es:[179,31,212],fm:[179,31,186],md:[179,13,166],no:[189,13,135],lr:[199,0,102],rf:[204,0,89],db:[209,0,79],sg:[217,0,69],bh:[224,0,56],hs:[230,0,46],mt:[235,0,38],ds:[235,0,38],rg:[235,0,38],cn:[235,0,38],uut:[235,0,38],uuq:[235,0,38],uup:[235,0,38],uuh:[235,0,38],uus:[235,0,38],uuo:[235,0,38]},o=[],a=[],l={},c={},h=t.split("\n");for(let e=0,t=h.length;e<t;e++)if("ATOM"===h[e].substr(0,4)||"HETATM"===h[e].substr(0,6)){const t=parseFloat(h[e].substr(30,7)),n=parseFloat(h[e].substr(38,7)),a=parseFloat(h[e].substr(46,7)),l=parseInt(h[e].substr(6,5))-1;let u=r(h[e].substr(76,2)).toLowerCase();""===u&&(u=r(h[e].substr(12,2)).toLowerCase());const d=[t,n,a,s[u],i(u)];o.push(d),c[l]=d}else if("CONECT"===h[e].substr(0,6)){const t=parseInt(h[e].substr(6,5));n(11,5,t,e),n(16,5,t,e),n(21,5,t,e),n(26,5,t,e)}return function(){const t={geometryAtoms:new e.BufferGeometry,geometryBonds:new e.BufferGeometry,json:{atoms:o}},r=t.geometryAtoms,i=t.geometryBonds,n=[],s=[],l=[];for(let e=0,t=o.length;e<t;e++){const t=o[e],r=t[0],i=t[1],a=t[2];n.push(r,i,a);const l=t[3][0]/255,c=t[3][1]/255,h=t[3][2]/255;s.push(l,c,h)}for(let e=0,t=a.length;e<t;e++){const t=a[e],r=t[0],i=t[1],n=c[r],s=c[i];let o=n[0],h=n[1],u=n[2];l.push(o,h,u),o=s[0],h=s[1],u=s[2],l.push(o,h,u)}return r.setAttribute("position",new e.Float32BufferAttribute(n,3)),r.setAttribute("color",new e.Float32BufferAttribute(s,3)),i.setAttribute("position",new e.Float32BufferAttribute(l,3)),t}()}}let Cm=null;function Fm(){if(null===Cm){const e=new ArrayBuffer(2),t=new Uint8Array(e),r=new Uint16Array(e);t[0]=170,t[1]=187,Cm=43707===r[0]}return Cm}const Em=[null,Float32Array,null,Int8Array,Int16Array,null,Int32Array,Uint8Array,Uint16Array,null,Uint32Array],_m={Uint16Array:"getUint16",Uint32Array:"getUint32",Int16Array:"getInt16",Int32Array:"getInt32",Float32Array:"getFloat32",Float64Array:"getFloat64"};function Pm(e,t,r,i,n){const s=t.BYTES_PER_ELEMENT;let o;if(n===Fm()||1===s)o=new t(e,r,i);else{const a=new DataView(e,r,i*s),l=_m[t.name],c=!n;o=new t(i);for(let e=0;e<i;e++)o[e]=a[l](e*s,c)}return o}class Bm extends e.Loader{constructor(e){super(e)}load(t,r,i,n){const s=this,o=new e.FileLoader(s.manager);o.setPath(s.path),o.setResponseType("arraybuffer"),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),t=t.replace(/\*/g,Fm()?"be":"le"),o.load(t,(function(e){try{r(s.parse(e))}catch(e){n?n(e):console.error(e),s.manager.itemError(t)}}),i,n)}parse(t){const r=function(e){const t=new Uint8Array(e),r=t[0];let i=t[1];const n=!!(i>>7&1),s=i>>6&1,o=1==(i>>5&1),a=31&i;let l=0,c=0;if(o?(l=(t[2]<<16)+(t[3]<<8)+t[4],c=(t[5]<<16)+(t[6]<<8)+t[7]):(l=t[2]+(t[3]<<8)+(t[4]<<16),c=t[5]+(t[6]<<8)+(t[7]<<16)),0===r)throw new Error("PRWM decoder: Invalid format version: 0");if(1!==r)throw new Error("PRWM decoder: Unsupported format version: "+r);if(!n){if(0!==s)throw new Error("PRWM decoder: Indices type must be set to 0 for non-indexed geometries");if(0!==c)throw new Error("PRWM decoder: Number of indices must be set to 0 for non-indexed geometries")}let h=8;const u={};for(let r=0;r<a;r++){let r="";for(;h<t.length;){const e=t[h];if(h++,0===e)break;r+=String.fromCharCode(e)}i=t[h];const n=i>>7&1,s=1+(i>>4&3),a=Em[15&i];h++,h=4*Math.ceil(h/4);const c=Pm(e,a,h,s*l,o);h+=a.BYTES_PER_ELEMENT*s*l,u[r]={type:n,cardinality:s,values:c}}h=4*Math.ceil(h/4);let d=null;return n&&(d=Pm(e,1===s?Uint32Array:Uint16Array,h,c,o)),{version:r,attributes:u,indices:d}}(t),i=Object.keys(r.attributes),n=new e.BufferGeometry;for(let t=0;t<i.length;t++){const s=r.attributes[i[t]];n.setAttribute(i[t],new e.BufferAttribute(s.values,s.cardinality,s.normalized))}return null!==r.indices&&n.setIndex(new e.BufferAttribute(r.indices,1)),n}static isBigEndianPlatform(){return Fm()}}class Lm extends e.DataTextureLoader{constructor(t){super(t),this.type=e.HalfFloatType,this.maxRange=7}setDataType(e){return this.type=e,this}setMaxRange(e){return this.maxRange=e,this}loadCubemap(t,r,i,n){const s=new e.CubeTexture;let o=0;const a=this;function l(e){a.load(t[e],(function(t){s.images[e]=t,o++,6===o&&(s.needsUpdate=!0,r&&r(s))}),void 0,n)}for(let e=0;e<t.length;++e)l(e);return s.type=this.type,s.format=e.RGBAFormat,s.minFilter=e.LinearFilter,s.generateMipmaps=!1,s}parse(t){const r=Im.decode(t),i=Im.toRGBA8(r)[0],n=new Uint8Array(i),s=r.width*r.height*4,o=this.type===e.HalfFloatType?new Uint16Array(s):new Float32Array(s);for(let t=0;t<n.length;t+=4){const r=n[t+0]/255,i=n[t+1]/255,s=n[t+2]/255,a=n[t+3]/255;this.type===e.HalfFloatType?(o[t+0]=e.DataUtils.toHalfFloat(Math.min(r*a*this.maxRange,65504)),o[t+1]=e.DataUtils.toHalfFloat(Math.min(i*a*this.maxRange,65504)),o[t+2]=e.DataUtils.toHalfFloat(Math.min(s*a*this.maxRange,65504)),o[t+3]=e.DataUtils.toHalfFloat(1)):(o[t+0]=r*a*this.maxRange,o[t+1]=i*a*this.maxRange,o[t+2]=s*a*this.maxRange,o[t+3]=1)}return{width:r.width,height:r.height,data:o,format:e.RGBAFormat,type:this.type,flipY:!0}}}var Rm,Nm,Dm,Im={};Im.toRGBA8=function(e){var t=e.width,r=e.height;if(null==e.tabs.acTL)return[Im.toRGBA8.decodeImage(e.data,t,r,e).buffer];var i=[];null==e.frames[0].data&&(e.frames[0].data=e.data);for(var n=t*r*4,s=new Uint8Array(n),o=new Uint8Array(n),a=new Uint8Array(n),l=0;l<e.frames.length;l++){var c=e.frames[l],h=c.rect.x,u=c.rect.y,d=c.rect.width,p=c.rect.height,m=Im.toRGBA8.decodeImage(c.data,d,p,e);if(0!=l)for(var f=0;f<n;f++)a[f]=s[f];if(0==c.blend?Im._copyTile(m,d,p,s,t,r,h,u,0):1==c.blend&&Im._copyTile(m,d,p,s,t,r,h,u,1),i.push(s.buffer.slice(0)),1==c.dispose)Im._copyTile(o,d,p,s,t,r,h,u,0);else if(2==c.dispose)for(f=0;f<n;f++)s[f]=a[f]}return i},Im.toRGBA8.decodeImage=function(e,t,r,i){var n=t*r,s=Im.decode._getBPP(i),o=Math.ceil(t*s/8),a=new Uint8Array(4*n),l=new Uint32Array(a.buffer),c=i.ctype,h=i.depth,u=Im._bin.readUshort;if(6==c){var d=n<<2;if(8==h)for(var p=0;p<d;p+=4)a[p]=e[p],a[p+1]=e[p+1],a[p+2]=e[p+2],a[p+3]=e[p+3];if(16==h)for(p=0;p<d;p++)a[p]=e[p<<1]}else if(2==c){var m=i.tabs.tRNS;if(null==m){if(8==h)for(p=0;p<n;p++){var f=3*p;l[p]=255<<24|e[f+2]<<16|e[f+1]<<8|e[f]}if(16==h)for(p=0;p<n;p++){f=6*p;l[p]=255<<24|e[f+4]<<16|e[f+2]<<8|e[f]}}else{var g=m[0],v=m[1],x=m[2];if(8==h)for(p=0;p<n;p++){var y=p<<2;f=3*p;l[p]=255<<24|e[f+2]<<16|e[f+1]<<8|e[f],e[f]==g&&e[f+1]==v&&e[f+2]==x&&(a[y+3]=0)}if(16==h)for(p=0;p<n;p++){y=p<<2,f=6*p;l[p]=255<<24|e[f+4]<<16|e[f+2]<<8|e[f],u(e,f)==g&&u(e,f+2)==v&&u(e,f+4)==x&&(a[y+3]=0)}}}else if(3==c){var b=i.tabs.PLTE,A=i.tabs.tRNS,w=A?A.length:0;if(1==h)for(var M=0;M<r;M++){var T=M*o,S=M*t;for(p=0;p<t;p++){y=S+p<<2;var C=3*(F=e[T+(p>>3)]>>7-((7&p)<<0)&1);a[y]=b[C],a[y+1]=b[C+1],a[y+2]=b[C+2],a[y+3]=F<w?A[F]:255}}if(2==h)for(M=0;M<r;M++)for(T=M*o,S=M*t,p=0;p<t;p++){y=S+p<<2,C=3*(F=e[T+(p>>2)]>>6-((3&p)<<1)&3);a[y]=b[C],a[y+1]=b[C+1],a[y+2]=b[C+2],a[y+3]=F<w?A[F]:255}if(4==h)for(M=0;M<r;M++)for(T=M*o,S=M*t,p=0;p<t;p++){y=S+p<<2,C=3*(F=e[T+(p>>1)]>>4-((1&p)<<2)&15);a[y]=b[C],a[y+1]=b[C+1],a[y+2]=b[C+2],a[y+3]=F<w?A[F]:255}if(8==h)for(p=0;p<n;p++){var F;y=p<<2,C=3*(F=e[p]);a[y]=b[C],a[y+1]=b[C+1],a[y+2]=b[C+2],a[y+3]=F<w?A[F]:255}}else if(4==c){if(8==h)for(p=0;p<n;p++){y=p<<2;var E=e[_=p<<1];a[y]=E,a[y+1]=E,a[y+2]=E,a[y+3]=e[_+1]}if(16==h)for(p=0;p<n;p++){var _;y=p<<2,E=e[_=p<<2];a[y]=E,a[y+1]=E,a[y+2]=E,a[y+3]=e[_+2]}}else if(0==c)for(g=i.tabs.tRNS?i.tabs.tRNS:-1,M=0;M<r;M++){var P=M*o,B=M*t;if(1==h)for(var L=0;L<t;L++){var R=(E=255*(e[P+(L>>>3)]>>>7-(7&L)&1))==255*g?0:255;l[B+L]=R<<24|E<<16|E<<8|E}else if(2==h)for(L=0;L<t;L++){R=(E=85*(e[P+(L>>>2)]>>>6-((3&L)<<1)&3))==85*g?0:255;l[B+L]=R<<24|E<<16|E<<8|E}else if(4==h)for(L=0;L<t;L++){R=(E=17*(e[P+(L>>>1)]>>>4-((1&L)<<2)&15))==17*g?0:255;l[B+L]=R<<24|E<<16|E<<8|E}else if(8==h)for(L=0;L<t;L++){R=(E=e[P+L])==g?0:255;l[B+L]=R<<24|E<<16|E<<8|E}else if(16==h)for(L=0;L<t;L++){E=e[P+(L<<1)],R=u(e,P+(L<<1))==g?0:255;l[B+L]=R<<24|E<<16|E<<8|E}}return a},Im.decode=function(e){for(var t,r,i,n,s=new Uint8Array(e),o=8,a=Im._bin,l=a.readUshort,c=a.readUint,h={tabs:{},frames:[]},u=new Uint8Array(s.length),d=0,p=0,m=[137,80,78,71,13,10,26,10],f=0;f<8;f++)if(s[f]!=m[f])throw new Error("The input is not a PNG file!");for(;o<s.length;){var g=a.readUint(s,o);o+=4;var v=a.readASCII(s,o,4);if(o+=4,"IHDR"==v)Im.decode._IHDR(s,o,h);else if("CgBI"==v)h.tabs[v]=s.slice(o,o+4);else if("IDAT"==v){for(f=0;f<g;f++)u[d+f]=s[o+f];d+=g}else if("acTL"==v)h.tabs[v]={num_frames:c(s,o),num_plays:c(s,o+4)},t=new Uint8Array(s.length);else if("fcTL"==v){var x;if(0!=p)(x=h.frames[h.frames.length-1]).data=Im.decode._decompress(h,t.slice(0,p),x.rect.width,x.rect.height),p=0;var y={x:c(s,o+12),y:c(s,o+16),width:c(s,o+4),height:c(s,o+8)},b=l(s,o+22);b=l(s,o+20)/(0==b?100:b);var A={rect:y,delay:Math.round(1e3*b),dispose:s[o+24],blend:s[o+25]};h.frames.push(A)}else if("fdAT"==v){for(f=0;f<g-4;f++)t[p+f]=s[o+f+4];p+=g-4}else if("pHYs"==v)h.tabs[v]=[a.readUint(s,o),a.readUint(s,o+4),s[o+8]];else if("cHRM"==v){h.tabs[v]=[];for(f=0;f<8;f++)h.tabs[v].push(a.readUint(s,o+4*f))}else if("tEXt"==v||"zTXt"==v){null==h.tabs[v]&&(h.tabs[v]={});var w=a.nextZero(s,o);i=a.readASCII(s,o,w-o);var M=o+g-w-1;"tEXt"==v?r=a.readASCII(s,w+1,M):(n=Im.decode._inflate(s.slice(w+2,w+2+M)),r=a.readUTF8(n,0,n.length)),h.tabs[v][i]=r}else if("iTXt"==v){null==h.tabs[v]&&(h.tabs[v]={});w=0;var T=o;w=a.nextZero(s,T),i=a.readASCII(s,T,w-T);var S=s[T=w+1];T+=2,w=a.nextZero(s,T),a.readASCII(s,T,w-T),T=w+1,w=a.nextZero(s,T),a.readUTF8(s,T,w-T);M=g-((T=w+1)-o);0==S?r=a.readUTF8(s,T,M):(n=Im.decode._inflate(s.slice(T,T+M)),r=a.readUTF8(n,0,n.length)),h.tabs[v][i]=r}else if("PLTE"==v)h.tabs[v]=a.readBytes(s,o,g);else if("hIST"==v){var C=h.tabs.PLTE.length/3;h.tabs[v]=[];for(f=0;f<C;f++)h.tabs[v].push(l(s,o+2*f))}else if("tRNS"==v)3==h.ctype?h.tabs[v]=a.readBytes(s,o,g):0==h.ctype?h.tabs[v]=l(s,o):2==h.ctype&&(h.tabs[v]=[l(s,o),l(s,o+2),l(s,o+4)]);else if("gAMA"==v)h.tabs[v]=a.readUint(s,o)/1e5;else if("sRGB"==v)h.tabs[v]=s[o];else if("bKGD"==v)0==h.ctype||4==h.ctype?h.tabs[v]=[l(s,o)]:2==h.ctype||6==h.ctype?h.tabs[v]=[l(s,o),l(s,o+2),l(s,o+4)]:3==h.ctype&&(h.tabs[v]=s[o]);else if("IEND"==v)break;o+=g,a.readUint(s,o),o+=4}0!=p&&((x=h.frames[h.frames.length-1]).data=Im.decode._decompress(h,t.slice(0,p),x.rect.width,x.rect.height));return h.data=Im.decode._decompress(h,u,h.width,h.height),delete h.compress,delete h.interlace,delete h.filter,h},Im.decode._decompress=function(e,t,r,i){var n=Im.decode._getBPP(e),s=Math.ceil(r*n/8),o=new Uint8Array((s+1+e.interlace)*i);return t=e.tabs.CgBI?Im.inflateRaw(t,o):Im.decode._inflate(t,o),0==e.interlace?t=Im.decode._filterZero(t,e,0,r,i):1==e.interlace&&(t=Im.decode._readInterlace(t,e)),t},Im.decode._inflate=function(e,t){return Im.inflateRaw(new Uint8Array(e.buffer,2,e.length-6),t)},Im.inflateRaw=((Dm={}).H={},Dm.H.N=function(e,t){var r,i,n=Uint8Array,s=0,o=0,a=0,l=0,c=0,h=0,u=0,d=0,p=0;if(3==e[0]&&0==e[1])return t||new n(0);var m=Dm.H,f=m.b,g=m.e,v=m.R,x=m.n,y=m.A,b=m.Z,A=m.m,w=null==t;for(w&&(t=new n(e.length>>>2<<5));0==s;)if(s=f(e,p,1),o=f(e,p+1,2),p+=3,0!=o){if(w&&(t=Dm.H.W(t,d+(1<<17))),1==o&&(r=A.J,i=A.h,h=511,u=31),2==o){a=g(e,p,5)+257,l=g(e,p+5,5)+1,c=g(e,p+10,4)+4,p+=14;for(var M=1,T=0;T<38;T+=2)A.Q[T]=0,A.Q[T+1]=0;for(T=0;T<c;T++){var S=g(e,p+3*T,3);A.Q[1+(A.X[T]<<1)]=S,S>M&&(M=S)}p+=3*c,x(A.Q,M),y(A.Q,M,A.u),r=A.w,i=A.d,p=v(A.u,(1<<M)-1,a+l,e,p,A.v);var C=m.V(A.v,0,a,A.C);h=(1<<C)-1;var F=m.V(A.v,a,l,A.D);u=(1<<F)-1,x(A.C,C),y(A.C,C,r),x(A.D,F),y(A.D,F,i)}for(;;){var E=r[b(e,p)&h];p+=15&E;var _=E>>>4;if(_>>>8==0)t[d++]=_;else{if(256==_)break;var P=d+_-254;if(_>264){var B=A.q[_-257];P=d+(B>>>3)+g(e,p,7&B),p+=7&B}var L=i[b(e,p)&u];p+=15&L;var R=L>>>4,N=A.c[R],D=(N>>>4)+f(e,p,15&N);for(p+=15&N;d<P;)t[d]=t[d++-D],t[d]=t[d++-D],t[d]=t[d++-D],t[d]=t[d++-D];d=P}}}else{0!=(7&p)&&(p+=8-(7&p));var I=4+(p>>>3),U=e[I-4]|e[I-3]<<8;w&&(t=Dm.H.W(t,d+U)),t.set(new n(e.buffer,e.byteOffset+I,U),d),p=I+U<<3,d+=U}return t.length==d?t:t.slice(0,d)},Dm.H.W=function(e,t){var r=e.length;if(t<=r)return e;var i=new Uint8Array(r<<1);return i.set(e,0),i},Dm.H.R=function(e,t,r,i,n,s){for(var o=Dm.H.e,a=Dm.H.Z,l=0;l<r;){var c=e[a(i,n)&t];n+=15&c;var h=c>>>4;if(h<=15)s[l]=h,l++;else{var u=0,d=0;16==h?(d=3+o(i,n,2),n+=2,u=s[l-1]):17==h?(d=3+o(i,n,3),n+=3):18==h&&(d=11+o(i,n,7),n+=7);for(var p=l+d;l<p;)s[l]=u,l++}}return n},Dm.H.V=function(e,t,r,i){for(var n=0,s=0,o=i.length>>>1;s<r;){var a=e[s+t];i[s<<1]=0,i[1+(s<<1)]=a,a>n&&(n=a),s++}for(;s<o;)i[s<<1]=0,i[1+(s<<1)]=0,s++;return n},Dm.H.n=function(e,t){for(var r,i,n,s,o=Dm.H.m,a=e.length,l=o.j,c=0;c<=t;c++)l[c]=0;for(c=1;c<a;c+=2)l[e[c]]++;var h=o.K;for(r=0,l[0]=0,i=1;i<=t;i++)r=r+l[i-1]<<1,h[i]=r;for(n=0;n<a;n+=2)0!=(s=e[n+1])&&(e[n]=h[s],h[s]++)},Dm.H.A=function(e,t,r){for(var i=e.length,n=Dm.H.m.r,s=0;s<i;s+=2)if(0!=e[s+1])for(var o=s>>1,a=e[s+1],l=o<<4|a,c=t-a,h=e[s]<<c,u=h+(1<<c);h!=u;)r[n[h]>>>15-t]=l,h++},Dm.H.l=function(e,t){for(var r=Dm.H.m.r,i=15-t,n=0;n<e.length;n+=2){var s=e[n]<<t-e[n+1];e[n]=r[s]>>>i}},Dm.H.M=function(e,t,r){r<<=7&t;var i=t>>>3;e[i]|=r,e[i+1]|=r>>>8},Dm.H.I=function(e,t,r){r<<=7&t;var i=t>>>3;e[i]|=r,e[i+1]|=r>>>8,e[i+2]|=r>>>16},Dm.H.e=function(e,t,r){return(e[t>>>3]|e[1+(t>>>3)]<<8)>>>(7&t)&(1<<r)-1},Dm.H.b=function(e,t,r){return(e[t>>>3]|e[1+(t>>>3)]<<8|e[2+(t>>>3)]<<16)>>>(7&t)&(1<<r)-1},Dm.H.Z=function(e,t){return(e[t>>>3]|e[1+(t>>>3)]<<8|e[2+(t>>>3)]<<16)>>>(7&t)},Dm.H.i=function(e,t){return(e[t>>>3]|e[1+(t>>>3)]<<8|e[2+(t>>>3)]<<16|e[3+(t>>>3)]<<24)>>>(7&t)},Dm.H.m=(Rm=Uint16Array,Nm=Uint32Array,{K:new Rm(16),j:new Rm(16),X:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],S:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],T:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],q:new Rm(32),p:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],z:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],c:new Nm(32),J:new Rm(512),_:[],h:new Rm(32),$:[],w:new Rm(32768),C:[],v:[],d:new Rm(32768),D:[],u:new Rm(512),Q:[],r:new Rm(32768),s:new Nm(286),Y:new Nm(30),a:new Nm(19),t:new Nm(15e3),k:new Rm(65536),g:new Rm(32768)}),function(){for(var e=Dm.H.m,t=0;t<32768;t++){var r=t;r=(4278255360&(r=(4042322160&(r=(3435973836&(r=(2863311530&r)>>>1|(1431655765&r)<<1))>>>2|(858993459&r)<<2))>>>4|(252645135&r)<<4))>>>8|(16711935&r)<<8,e.r[t]=(r>>>16|r<<16)>>>17}function i(e,t,r){for(;0!=t--;)e.push(0,r)}for(t=0;t<32;t++)e.q[t]=e.S[t]<<3|e.T[t],e.c[t]=e.p[t]<<4|e.z[t];i(e._,144,8),i(e._,112,9),i(e._,24,7),i(e._,8,8),Dm.H.n(e._,9),Dm.H.A(e._,9,e.J),Dm.H.l(e._,9),i(e.$,32,5),Dm.H.n(e.$,5),Dm.H.A(e.$,5,e.h),Dm.H.l(e.$,5),i(e.Q,19,0),i(e.C,286,0),i(e.D,30,0),i(e.v,320,0)}(),Dm.H.N),Im.decode._readInterlace=function(e,t){for(var r=t.width,i=t.height,n=Im.decode._getBPP(t),s=n>>3,o=Math.ceil(r*n/8),a=new Uint8Array(i*o),l=0,c=[0,0,4,0,2,0,1],h=[0,4,0,2,0,1,0],u=[8,8,8,4,4,2,2],d=[8,8,4,4,2,2,1],p=0;p<7;){for(var m=u[p],f=d[p],g=0,v=0,x=c[p];x<i;)x+=m,v++;for(var y=h[p];y<r;)y+=f,g++;var b=Math.ceil(g*n/8);Im.decode._filterZero(e,t,l,g,v);for(var A,w=0,M=c[p];M<i;){for(var T=h[p],S=l+w*b<<3;T<r;){if(1==n&&(A=(A=e[S>>3])>>7-(7&S)&1,a[M*o+(T>>3)]|=A<<7-((7&T)<<0)),2==n&&(A=(A=e[S>>3])>>6-(7&S)&3,a[M*o+(T>>2)]|=A<<6-((3&T)<<1)),4==n&&(A=(A=e[S>>3])>>4-(7&S)&15,a[M*o+(T>>1)]|=A<<4-((1&T)<<2)),n>=8)for(var C=M*o+T*s,F=0;F<s;F++)a[C+F]=e[(S>>3)+F];S+=n,T+=f}w++,M+=m}g*v!=0&&(l+=v*(1+b)),p+=1}return a},Im.decode._getBPP=function(e){return[1,null,3,1,2,null,4][e.ctype]*e.depth},Im.decode._filterZero=function(e,t,r,i,n){var s=Im.decode._getBPP(t),o=Math.ceil(i*s/8),a=Im.decode._paeth;s=Math.ceil(s/8);var l,c,h=e[r],u=0;if(h>1&&(e[r]=[0,0,1][h-2]),3==h)for(u=s;u<o;u++)e[u+1]=e[u+1]+(e[u+1-s]>>>1)&255;for(var d=0;d<n;d++)if(u=0,0==(h=e[(c=(l=r+d*o)+d+1)-1]))for(;u<o;u++)e[l+u]=e[c+u];else if(1==h){for(;u<s;u++)e[l+u]=e[c+u];for(;u<o;u++)e[l+u]=e[c+u]+e[l+u-s]}else if(2==h)for(;u<o;u++)e[l+u]=e[c+u]+e[l+u-o];else if(3==h){for(;u<s;u++)e[l+u]=e[c+u]+(e[l+u-o]>>>1);for(;u<o;u++)e[l+u]=e[c+u]+(e[l+u-o]+e[l+u-s]>>>1)}else{for(;u<s;u++)e[l+u]=e[c+u]+a(0,e[l+u-o],0);for(;u<o;u++)e[l+u]=e[c+u]+a(e[l+u-s],e[l+u-o],e[l+u-s-o])}return e},Im.decode._paeth=function(e,t,r){var i=e+t-r,n=i-e,s=i-t,o=i-r;return n*n<=s*s&&n*n<=o*o?e:s*s<=o*o?t:r},Im.decode._IHDR=function(e,t,r){var i=Im._bin;r.width=i.readUint(e,t),t+=4,r.height=i.readUint(e,t),t+=4,r.depth=e[t],t++,r.ctype=e[t],t++,r.compress=e[t],t++,r.filter=e[t],t++,r.interlace=e[t],t++},Im._bin={nextZero:function(e,t){for(;0!=e[t];)t++;return t},readUshort:function(e,t){return e[t]<<8|e[t+1]},writeUshort:function(e,t,r){e[t]=r>>8&255,e[t+1]=255&r},readUint:function(e,t){return 16777216*e[t]+(e[t+1]<<16|e[t+2]<<8|e[t+3])},writeUint:function(e,t,r){e[t]=r>>24&255,e[t+1]=r>>16&255,e[t+2]=r>>8&255,e[t+3]=255&r},readASCII:function(e,t,r){for(var i="",n=0;n<r;n++)i+=String.fromCharCode(e[t+n]);return i},writeASCII:function(e,t,r){for(var i=0;i<r.length;i++)e[t+i]=r.charCodeAt(i)},readBytes:function(e,t,r){for(var i=[],n=0;n<r;n++)i.push(e[t+n]);return i},pad:function(e){return e.length<2?"0"+e:e},readUTF8:function(e,t,r){for(var i,n="",s=0;s<r;s++)n+="%"+Im._bin.pad(e[t+s].toString(16));try{i=decodeURIComponent(n)}catch(i){return Im._bin.readASCII(e,t,r)}return i}},Im._copyTile=function(e,t,r,i,n,s,o,a,l){for(var c=Math.min(t,n),h=Math.min(r,s),u=0,d=0,p=0;p<h;p++)for(var m=0;m<c;m++)if(o>=0&&a>=0?(u=p*t+m<<2,d=(a+p)*n+o+m<<2):(u=(-a+p)*t-o+m<<2,d=p*n+m<<2),0==l)i[d]=e[u],i[d+1]=e[u+1],i[d+2]=e[u+2],i[d+3]=e[u+3];else if(1==l){var f=e[u+3]*(1/255),g=e[u]*f,v=e[u+1]*f,x=e[u+2]*f,y=i[d+3]*(1/255),b=i[d]*y,A=i[d+1]*y,w=i[d+2]*y,M=1-f,T=f+y*M,S=0==T?0:1/T;i[d+3]=255*T,i[d+0]=(g+b*M)*S,i[d+1]=(v+A*M)*S,i[d+2]=(x+w*M)*S}else if(2==l){f=e[u+3],g=e[u],v=e[u+1],x=e[u+2],y=i[d+3],b=i[d],A=i[d+1],w=i[d+2];f==y&&g==b&&v==A&&x==w?(i[d]=0,i[d+1]=0,i[d+2]=0,i[d+3]=0):(i[d]=g,i[d+1]=v,i[d+2]=x,i[d+3]=f)}else if(3==l){f=e[u+3],g=e[u],v=e[u+1],x=e[u+2],y=i[d+3],b=i[d],A=i[d+1],w=i[d+2];if(f==y&&g==b&&v==A&&x==w)continue;if(f<220&&y>20)return!1}return!0};class Um extends e.Loader{load(t,r,i,n){const s=this,o=new e.FileLoader(s.manager);o.setPath(s.path),o.setResponseType("arraybuffer"),o.setRequestHeader(s.requestHeader),o.load(t,(function(e){try{r(s.parse(e))}catch(e){n?n(e):console.error(e),s.manager.itemError(t)}}),i,n)}parse(e){const t=new DataView(e),r=t.getUint32(0,!0),i=t.getUint32(4,!0);if(542658390!==r||150!==i)return void console.error("Not a valid VOX file");const n=[0,4294967295,4291624959,4288282623,4284940287,4281597951,4278255615,4294954239,4291611903,4288269567,4284927231,4281584895,4278242559,4294941183,4291598847,4288256511,4284914175,4281571839,4278229503,4294928127,4291585791,4288243455,4284901119,4281558783,4278216447,4294915071,4291572735,4288230399,4284888063,4281545727,4278203391,4294902015,4291559679,4288217343,4284875007,4281532671,4278190335,4294967244,4291624908,4288282572,4284940236,4281597900,4278255564,4294954188,4291611852,4288269516,4284927180,4281584844,4278242508,4294941132,4291598796,4288256460,4284914124,4281571788,4278229452,4294928076,4291585740,4288243404,4284901068,4281558732,4278216396,4294915020,4291572684,4288230348,4284888012,4281545676,4278203340,4294901964,4291559628,4288217292,4284874956,4281532620,4278190284,4294967193,4291624857,4288282521,4284940185,4281597849,4278255513,4294954137,4291611801,4288269465,4284927129,4281584793,4278242457,4294941081,4291598745,4288256409,4284914073,4281571737,4278229401,4294928025,4291585689,4288243353,4284901017,4281558681,4278216345,4294914969,4291572633,4288230297,4284887961,4281545625,4278203289,4294901913,4291559577,4288217241,4284874905,4281532569,4278190233,4294967142,4291624806,4288282470,4284940134,4281597798,4278255462,4294954086,4291611750,4288269414,4284927078,4281584742,4278242406,4294941030,4291598694,4288256358,4284914022,4281571686,4278229350,4294927974,4291585638,4288243302,4284900966,4281558630,4278216294,4294914918,4291572582,4288230246,4284887910,4281545574,4278203238,4294901862,4291559526,4288217190,4284874854,4281532518,4278190182,4294967091,4291624755,4288282419,4284940083,4281597747,4278255411,4294954035,4291611699,4288269363,4284927027,4281584691,4278242355,4294940979,4291598643,4288256307,4284913971,4281571635,4278229299,4294927923,4291585587,4288243251,4284900915,4281558579,4278216243,4294914867,4291572531,4288230195,4284887859,4281545523,4278203187,4294901811,4291559475,4288217139,4284874803,4281532467,4278190131,4294967040,4291624704,4288282368,4284940032,4281597696,4278255360,4294953984,4291611648,4288269312,4284926976,4281584640,4278242304,4294940928,4291598592,4288256256,4284913920,4281571584,4278229248,4294927872,4291585536,4288243200,4284900864,4281558528,4278216192,4294914816,4291572480,4288230144,4284887808,4281545472,4278203136,4294901760,4291559424,4288217088,4284874752,4281532416,4278190318,4278190301,4278190267,4278190250,4278190216,4278190199,4278190165,4278190148,4278190114,4278190097,4278251008,4278246656,4278237952,4278233600,4278224896,4278220544,4278211840,4278207488,4278198784,4278194432,4293787648,4292673536,4290445312,4289331200,4287102976,4285988864,4283760640,4282646528,4280418304,4279304192,4293848814,4292730333,4290493371,4289374890,4287137928,4286019447,4283782485,4282664004,4280427042,4279308561];let s,o=8;const a=[];for(;o<t.byteLength;){let r="";for(let e=0;e<4;e++)r+=String.fromCharCode(t.getUint8(o++));const i=t.getUint32(o,!0);if(o+=4,o+=4,"SIZE"===r){const e=t.getUint32(o,!0);o+=4;const r=t.getUint32(o,!0);o+=4;const l=t.getUint32(o,!0);o+=4,s={palette:n,size:{x:e,y:r,z:l}},a.push(s),o+=i-12}else if("XYZI"===r){const r=t.getUint32(o,!0);o+=4,s.data=new Uint8Array(e,o,4*r),o+=4*r}else if("RGBA"===r){const e=[0];for(let r=0;r<256;r++)e[r+1]=t.getUint32(o,!0),o+=4;s.palette=e}else o+=i}return a}}class Om extends e.Mesh{constructor(t){const r=t.data,i=t.size,n=t.palette,s=[],o=[],a=[0,0,0,0,0,1,0,1,0,0,1,1,0,1,0,0,0,1],l=[1,0,0,1,1,0,1,0,1,1,1,1,1,0,1,1,1,0],c=[0,0,1,1,0,1,0,1,1,1,1,1,0,1,1,1,0,1],h=[0,0,0,0,1,0,1,0,0,1,1,0,1,0,0,0,1,0],u=[0,0,1,0,0,0,1,0,1,1,0,0,1,0,1,0,0,0],d=[0,1,1,1,1,1,0,1,0,1,1,0,0,1,0,1,1,1];function p(e,t,r,n,a,l,c){t-=i.x/2,r-=i.z/2,n+=i.y/2;for(let i=0;i<18;i+=3)s.push(e[i+0]+t,e[i+1]+r,e[i+2]+n),o.push(a,l,c)}const m=i.x,f=i.x*i.y,g=new Uint8Array(i.x*i.y*i.z);for(let e=0;e<r.length;e+=4){g[r[e+0]+r[e+1]*m+r[e+2]*f]=255}let v=!1;for(let e=0;e<r.length;e+=4){const t=r[e+0],s=r[e+1],o=r[e+2],x=n[r[e+3]],y=(x>>0&255)/255,b=(x>>8&255)/255,A=(x>>16&255)/255;(y>0||b>0||A>0)&&(v=!0);const w=t+s*m+o*f;0!==g[w+1]&&t!==i.x-1||p(l,t,o,-s,y,b,A),0!==g[w-1]&&0!==t||p(a,t,o,-s,y,b,A),0!==g[w+m]&&s!==i.y-1||p(h,t,o,-s,y,b,A),0!==g[w-m]&&0!==s||p(c,t,o,-s,y,b,A),0!==g[w+f]&&o!==i.z-1||p(d,t,o,-s,y,b,A),0!==g[w-f]&&0!==o||p(u,t,o,-s,y,b,A)}const x=new e.BufferGeometry;x.setAttribute("position",new e.Float32BufferAttribute(s,3)),x.computeVertexNormals();const y=new e.MeshStandardMaterial;v&&(x.setAttribute("color",new e.Float32BufferAttribute(o,3)),y.vertexColors=!0),super(x,y)}}class km extends e.Loader{constructor(e){super(e),this.littleEndian=!0}load(t,r,i,n){const s=this,o=new e.FileLoader(s.manager);o.setPath(s.path),o.setResponseType("arraybuffer"),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(t,(function(e){try{r(s.parse(e,t))}catch(e){n?n(e):console.error(e),s.manager.itemError(t)}}),i,n)}parse(t,r){const i=e.LoaderUtils.decodeText(new Uint8Array(t)),n=function(e){const t={},r=e.search(/[\r\n]DATA\s(\S*)\s/i),i=/[\r\n]DATA\s(\S*)\s/i.exec(e.substr(r-1));if(t.data=i[1],t.headerLen=i[0].length+r,t.str=e.substr(0,t.headerLen),t.str=t.str.replace(/\#.*/gi,""),t.version=/VERSION (.*)/i.exec(t.str),t.fields=/FIELDS (.*)/i.exec(t.str),t.size=/SIZE (.*)/i.exec(t.str),t.type=/TYPE (.*)/i.exec(t.str),t.count=/COUNT (.*)/i.exec(t.str),t.width=/WIDTH (.*)/i.exec(t.str),t.height=/HEIGHT (.*)/i.exec(t.str),t.viewpoint=/VIEWPOINT (.*)/i.exec(t.str),t.points=/POINTS (.*)/i.exec(t.str),null!==t.version&&(t.version=parseFloat(t.version[1])),null!==t.fields&&(t.fields=t.fields[1].split(" ")),null!==t.type&&(t.type=t.type[1].split(" ")),null!==t.width&&(t.width=parseInt(t.width[1])),null!==t.height&&(t.height=parseInt(t.height[1])),null!==t.viewpoint&&(t.viewpoint=t.viewpoint[1]),null!==t.points&&(t.points=parseInt(t.points[1],10)),null===t.points&&(t.points=t.width*t.height),null!==t.size&&(t.size=t.size[1].split(" ").map((function(e){return parseInt(e,10)}))),null!==t.count)t.count=t.count[1].split(" ").map((function(e){return parseInt(e,10)}));else{t.count=[];for(let e=0,r=t.fields.length;e<r;e++)t.count.push(1)}t.offset={};let n=0;for(let e=0,r=t.fields.length;e<r;e++)"ascii"===t.data?t.offset[t.fields[e]]=e:(t.offset[t.fields[e]]=n,n+=t.size[e]*t.count[e]);return t.rowSize=n,t}(i),s=[],o=[],a=[];if("ascii"===n.data){const e=n.offset,t=i.substr(n.headerLen).split("\n");for(let r=0,i=t.length;r<i;r++){if(""===t[r])continue;const i=t[r].split(" ");if(void 0!==e.x&&(s.push(parseFloat(i[e.x])),s.push(parseFloat(i[e.y])),s.push(parseFloat(i[e.z]))),void 0!==e.rgb){const t=parseFloat(i[e.rgb]),r=t>>16&255,n=t>>8&255,s=t>>0&255;a.push(r/255,n/255,s/255)}void 0!==e.normal_x&&(o.push(parseFloat(i[e.normal_x])),o.push(parseFloat(i[e.normal_y])),o.push(parseFloat(i[e.normal_z])))}}if("binary_compressed"===n.data){const e=new Uint32Array(t.slice(n.headerLen,n.headerLen+8)),r=e[0],i=e[1],l=function(e,t){const r=e.length,i=new Uint8Array(t);let n,s,o,a=0,l=0;do{if(n=e[a++],n<32){if(n++,l+n>t)throw new Error("Output buffer is not large enough");if(a+n>r)throw new Error("Invalid compressed data");do{i[l++]=e[a++]}while(--n)}else{if(s=n>>5,o=l-((31&n)<<8)-1,a>=r)throw new Error("Invalid compressed data");if(7===s&&(s+=e[a++],a>=r))throw new Error("Invalid compressed data");if(o-=e[a++],l+s+2>t)throw new Error("Output buffer is not large enough");if(o<0)throw new Error("Invalid compressed data");if(o>=l)throw new Error("Invalid compressed data");do{i[l++]=i[o++]}while(2+--s)}}while(a<r);return i}(new Uint8Array(t,n.headerLen+8,r),i),c=new DataView(l.buffer),h=n.offset;for(let e=0;e<n.points;e++)void 0!==h.x&&(s.push(c.getFloat32(n.points*h.x+n.size[0]*e,this.littleEndian)),s.push(c.getFloat32(n.points*h.y+n.size[1]*e,this.littleEndian)),s.push(c.getFloat32(n.points*h.z+n.size[2]*e,this.littleEndian))),void 0!==h.rgb&&(a.push(c.getUint8(n.points*h.rgb+n.size[3]*e+2)/255),a.push(c.getUint8(n.points*h.rgb+n.size[3]*e+1)/255),a.push(c.getUint8(n.points*h.rgb+n.size[3]*e+0)/255)),void 0!==h.normal_x&&(o.push(c.getFloat32(n.points*h.normal_x+n.size[4]*e,this.littleEndian)),o.push(c.getFloat32(n.points*h.normal_y+n.size[5]*e,this.littleEndian)),o.push(c.getFloat32(n.points*h.normal_z+n.size[6]*e,this.littleEndian)))}if("binary"===n.data){const e=new DataView(t,n.headerLen),r=n.offset;for(let t=0,i=0;t<n.points;t++,i+=n.rowSize)void 0!==r.x&&(s.push(e.getFloat32(i+r.x,this.littleEndian)),s.push(e.getFloat32(i+r.y,this.littleEndian)),s.push(e.getFloat32(i+r.z,this.littleEndian))),void 0!==r.rgb&&(a.push(e.getUint8(i+r.rgb+2)/255),a.push(e.getUint8(i+r.rgb+1)/255),a.push(e.getUint8(i+r.rgb+0)/255)),void 0!==r.normal_x&&(o.push(e.getFloat32(i+r.normal_x,this.littleEndian)),o.push(e.getFloat32(i+r.normal_y,this.littleEndian)),o.push(e.getFloat32(i+r.normal_z,this.littleEndian)))}const l=new e.BufferGeometry;s.length>0&&l.setAttribute("position",new e.Float32BufferAttribute(s,3)),o.length>0&&l.setAttribute("normal",new e.Float32BufferAttribute(o,3)),a.length>0&&l.setAttribute("color",new e.Float32BufferAttribute(a,3)),l.computeBoundingSphere();const c=new e.PointsMaterial({size:.005});a.length>0?c.vertexColors=!0:c.color.setHex(16777215*Math.random());const h=new e.Points(l,c);let u=r.split("").reverse().join("");return u=/([^\/]*)/.exec(u),u=u[1].split("").reverse().join(""),h.name=u,h}}let Vm;class Gm extends e.Loader{constructor(e,t={}){super(e),this.resourcePath=void 0!==t.resourcePath?t.resourcePath:""}load(t,r,i,n){const s=this,o=""===s.path?function(e,t){const r=e.indexOf(t);return-1===r?"./":e.substr(0,r)}(t,"Objects"):s.path,a=t.split(o).pop().split(".")[0],l=new e.FileLoader(this.manager);l.setPath(s.path),l.setResponseType("arraybuffer"),l.load(t,(function(e){try{r(s.parse(e,o,a))}catch(e){n?n(e):console.error(e),s.manager.itemError(t)}}),i,n)}parse(t,r,i){Vm=(new Vp).parse(t);const n=new e.TextureLoader(this.manager).setPath(this.resourcePath||r).setCrossOrigin(this.crossOrigin);return new zm(n).parse(i)}}class zm{constructor(e){this.textureLoader=e}parse(e){return this.materials=new Hm(this.textureLoader).parse(),this.defaultLayerName=e,this.meshes=this.parseLayers(),{materials:this.materials,meshes:this.meshes}}parseLayers(){const e=[],t=[],r=new jm,i=this;return Vm.layers.forEach((function(n){const s=r.parse(n.geometry,n),o=i.parseMesh(s,n);e[n.number]=o,-1===n.parent?t.push(o):e[n.parent].add(o)})),this.applyPivots(t),t}parseMesh(t,r){let i;const n=this.getMaterials(t.userData.matNames,r.geometry.type);return this.duplicateUVs(t,n),i="points"===r.geometry.type?new e.Points(t,n):"lines"===r.geometry.type?new e.LineSegments(t,n):new e.Mesh(t,n),r.name?i.name=r.name:i.name=this.defaultLayerName+"_layer_"+r.number,i.userData.pivot=r.pivot,i}applyPivots(e){e.forEach((function(e){e.traverse((function(e){const t=e.userData.pivot;if(e.position.x+=t[0],e.position.y+=t[1],e.position.z+=t[2],e.parent){const t=e.parent.userData.pivot;e.position.x-=t[0],e.position.y-=t[1],e.position.z-=t[2]}}))}))}getMaterials(t,r){const i=[],n=this;t.forEach((function(e,t){i[t]=n.getMaterialByName(e)})),"points"!==r&&"lines"!==r||i.forEach((function(t,n){const s={color:t.color};"points"===r?(s.size=.1,s.map=t.map,s.morphTargets=t.morphTargets,i[n]=new e.PointsMaterial(s)):"lines"===r&&(i[n]=new e.LineBasicMaterial(s))}));const s=i.filter(Boolean);return 1===s.length?s[0]:i}getMaterialByName(e){return this.materials.filter((function(t){return t.name===e}))[0]}duplicateUVs(t,r){let i=!1;Array.isArray(r)?r.forEach((function(e){e.aoMap&&(i=!0)})):r.aoMap&&(i=!0),i&&t.setAttribute("uv2",new e.BufferAttribute(t.attributes.uv.array,2))}}class Hm{constructor(e){this.textureLoader=e}parse(){const e=[];this.textures={};for(const t in Vm.materials)"LWO3"===Vm.format?e.push(this.parseMaterial(Vm.materials[t],t,Vm.textures)):"LWO2"===Vm.format&&e.push(this.parseMaterialLwo2(Vm.materials[t],t,Vm.textures));return e}parseMaterial(e,t,r){let i={name:t,side:this.getSide(e.attributes),flatShading:this.getSmooth(e.attributes)};const n=this.parseConnections(e.connections,e.nodes),s=this.parseTextureNodes(n.maps);this.parseAttributeImageMaps(n.attributes,r,s,e.maps);const o=this.parseAttributes(n.attributes,s);this.parseEnvMap(n,s,o),i=Object.assign(s,i),i=Object.assign(i,o);return new(this.getMaterialType(n.attributes))(i)}parseMaterialLwo2(t,r){let i={name:r,side:this.getSide(t.attributes),flatShading:this.getSmooth(t.attributes)};const n=this.parseAttributes(t.attributes,{});return i=Object.assign(i,n),new e.MeshPhongMaterial(i)}getSide(t){if(!t.side)return e.BackSide;switch(t.side){case 0:case 1:return e.BackSide;case 2:return e.FrontSide;case 3:return e.DoubleSide}}getSmooth(e){return!e.smooth||!e.smooth}parseConnections(e,t){const r={maps:{}},i=e.inputName,n=e.inputNodeName,s=e.nodeName,o=this;return i.forEach((function(e,i){if("Material"===e){const e=o.getNodeByRefName(n[i],t);r.attributes=e.attributes,r.envMap=e.fileName,r.name=n[i]}})),s.forEach((function(e,s){e===r.name&&(r.maps[i[s]]=o.getNodeByRefName(n[s],t))})),r}getNodeByRefName(e,t){for(const r in t)if(t[r].refName===e)return t[r]}parseTextureNodes(t){const r={};for(const i in t){const n=t[i],s=n.fileName;if(!s)return;const o=this.loadTexture(s);switch(void 0!==n.widthWrappingMode&&(o.wrapS=this.getWrappingType(n.widthWrappingMode)),void 0!==n.heightWrappingMode&&(o.wrapT=this.getWrappingType(n.heightWrappingMode)),i){case"Color":r.map=o;break;case"Roughness":r.roughnessMap=o,r.roughness=.5;break;case"Specular":r.specularMap=o,r.specular=16777215;break;case"Luminous":r.emissiveMap=o,r.emissive=8421504;break;case"Luminous Color":r.emissive=8421504;break;case"Metallic":r.metalnessMap=o,r.metalness=.5;break;case"Transparency":case"Alpha":r.alphaMap=o,r.transparent=!0;break;case"Normal":r.normalMap=o,void 0!==n.amplitude&&(r.normalScale=new e.Vector2(n.amplitude,n.amplitude));break;case"Bump":r.bumpMap=o}}return r.roughnessMap&&r.specularMap&&delete r.specularMap,r}parseAttributeImageMaps(e,t,r){for(const i in e){const n=e[i];if(n.maps){const e=n.maps[0],s=this.getTexturePathByIndex(e.imageIndex,t);if(!s)return;const o=this.loadTexture(s);switch(void 0!==e.wrap&&(o.wrapS=this.getWrappingType(e.wrap.w)),void 0!==e.wrap&&(o.wrapT=this.getWrappingType(e.wrap.h)),i){case"Color":r.map=o;break;case"Diffuse":r.aoMap=o;break;case"Roughness":r.roughnessMap=o,r.roughness=1;break;case"Specular":r.specularMap=o,r.specular=16777215;break;case"Luminosity":r.emissiveMap=o,r.emissive=8421504;break;case"Metallic":r.metalnessMap=o,r.metalness=1;break;case"Transparency":case"Alpha":r.alphaMap=o,r.transparent=!0;break;case"Normal":r.normalMap=o;break;case"Bump":r.bumpMap=o}}}}parseAttributes(t,r){const i={};return t.Color&&!r.map?i.color=(new e.Color).fromArray(t.Color.value):i.color=new e.Color,t.Transparency&&0!==t.Transparency.value&&(i.opacity=1-t.Transparency.value,i.transparent=!0),t["Bump Height"]&&(i.bumpScale=.1*t["Bump Height"].value),t["Refraction Index"]&&(i.refractionRatio=1/t["Refraction Index"].value),this.parsePhysicalAttributes(i,t,r),this.parseStandardAttributes(i,t,r),this.parsePhongAttributes(i,t,r),i}parsePhysicalAttributes(e,t){t.Clearcoat&&t.Clearcoat.value>0&&(e.clearcoat=t.Clearcoat.value,t["Clearcoat Gloss"]&&(e.clearcoatRoughness=.5*(1-t["Clearcoat Gloss"].value)))}parseStandardAttributes(t,r,i){r.Luminous&&(t.emissiveIntensity=r.Luminous.value,r["Luminous Color"]&&!i.emissive?t.emissive=(new e.Color).fromArray(r["Luminous Color"].value):t.emissive=new e.Color(8421504)),r.Roughness&&!i.roughnessMap&&(t.roughness=r.Roughness.value),r.Metallic&&!i.metalnessMap&&(t.metalness=r.Metallic.value)}parsePhongAttributes(t,r,i){r.Diffuse&&t.color.multiplyScalar(r.Diffuse.value),r.Reflection&&(t.reflectivity=r.Reflection.value,t.combine=e.AddOperation),r.Luminosity&&(t.emissiveIntensity=r.Luminosity.value,i.emissiveMap||i.map?t.emissive=new e.Color(8421504):t.emissive=t.color),r.Roughness||!r.Specular||i.specularMap||(r["Color Highlight"]?t.specular=(new e.Color).setScalar(r.Specular.value).lerp(t.color.clone().multiplyScalar(r.Specular.value),r["Color Highlight"].value):t.specular=(new e.Color).setScalar(r.Specular.value)),t.specular&&r.Glossiness&&(t.shininess=7+Math.pow(2,12*r.Glossiness.value+2))}parseEnvMap(t,r,i){if(t.envMap){const n=this.loadTexture(t.envMap);i.transparent&&i.opacity<.999?(n.mapping=e.EquirectangularRefractionMapping,void 0!==i.reflectivity&&(delete i.reflectivity,delete i.combine),void 0!==i.metalness&&delete i.metalness):n.mapping=e.EquirectangularReflectionMapping,r.envMap=n}}getTexturePathByIndex(e){let t="";return Vm.textures?(Vm.textures.forEach((function(r){r.index===e&&(t=r.fileName)})),t):t}loadTexture(e){if(!e)return null;return this.textureLoader.load(e,void 0,void 0,(function(){console.warn("LWOLoader: non-standard resource hierarchy. Use `resourcePath` parameter to specify root content directory.")}))}getWrappingType(t){switch(t){case 0:return console.warn('LWOLoader: "Reset" texture wrapping type is not supported in three.js'),e.ClampToEdgeWrapping;case 1:return e.RepeatWrapping;case 2:return e.MirroredRepeatWrapping;case 3:return e.ClampToEdgeWrapping}}getMaterialType(t){return t.Clearcoat&&t.Clearcoat.value>0?e.MeshPhysicalMaterial:t.Roughness?e.MeshStandardMaterial:e.MeshPhongMaterial}}class jm{parse(t,r){const i=new e.BufferGeometry;i.setAttribute("position",new e.Float32BufferAttribute(t.points,3));const n=this.splitIndices(t.vertexIndices,t.polygonDimensions);return i.setIndex(n),this.parseGroups(i,t),i.computeVertexNormals(),this.parseUVs(i,r,n),this.parseMorphTargets(i,r,n),i.translate(-r.pivot[0],-r.pivot[1],-r.pivot[2]),i}splitIndices(e,t){const r=[];let i=0;return t.forEach((function(t){if(t<4)for(let n=0;n<t;n++)r.push(e[i+n]);else if(4===t)r.push(e[i],e[i+1],e[i+2],e[i],e[i+2],e[i+3]);else if(t>4){for(let n=1;n<t-1;n++)r.push(e[i],e[i+n],e[i+n+1]);console.warn("LWOLoader: polygons with greater than 4 sides are not supported")}i+=t})),r}parseGroups(e,t){const r=Vm.tags,i=[];let n=3;"lines"===t.type&&(n=2),"points"===t.type&&(n=1);const s=this.splitMaterialIndices(t.polygonDimensions,t.materialIndices);let o=0;const a={};let l,c,h=0,u=0;for(let t=0;t<s.length;t+=2){if(c=s[t+1],0===t&&(i[o]=r[c]),void 0===l&&(l=c),c!==l){let t;a[r[l]]?t=a[r[l]]:(t=o,a[r[l]]=o,i[o]=r[l],o++),e.addGroup(h,u,t),h+=u,l=c,u=0}u+=n}if(e.groups.length>0){let t;a[r[c]]?t=a[r[c]]:(t=o,a[r[c]]=o,i[o]=r[c]),e.addGroup(h,u,t)}e.userData.matNames=i}splitMaterialIndices(e,t){const r=[];return e.forEach((function(e,i){if(e<=3)r.push(t[2*i],t[2*i+1]);else if(4===e)r.push(t[2*i],t[2*i+1],t[2*i],t[2*i+1]);else for(let n=0;n<e-2;n++)r.push(t[2*i],t[2*i+1])})),r}parseUVs(t,r){const i=Array.from(Array(2*t.attributes.position.count),(function(){return 0}));for(const e in r.uvs){const t=r.uvs[e].uvs;r.uvs[e].uvIndices.forEach((function(e,r){i[2*e]=t[2*r],i[2*e+1]=t[2*r+1]}))}t.setAttribute("uv",new e.Float32BufferAttribute(i,2))}parseMorphTargets(t,r){let i=0;for(const n in r.morphTargets){const s=t.attributes.position.array.slice();t.morphAttributes.position||(t.morphAttributes.position=[]);const o=r.morphTargets[n].points,a=r.morphTargets[n].indices,l=r.morphTargets[n].type;a.forEach((function(e,t){"relative"===l?(s[3*e]+=o[3*t],s[3*e+1]+=o[3*t+1],s[3*e+2]+=o[3*t+2]):(s[3*e]=o[3*t],s[3*e+1]=o[3*t+1],s[3*e+2]=o[3*t+2])})),t.morphAttributes.position[i]=new e.Float32BufferAttribute(s,3),t.morphAttributes.position[i].name=n,i++}t.morphTargetsRelative=!1}}class Wm extends e.Loader{constructor(e){super(e),this.propertyNameMapping={}}load(t,r,i,n){const s=this,o=new e.FileLoader(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,(function(e){try{r(s.parse(e))}catch(e){n?n(e):console.error(e),s.manager.itemError(t)}}),i,n)}setPropertyNameMapping(e){this.propertyNameMapping=e}parse(t){function r(e){let t="",r=0;const i=/ply([\s\S]*)end_header\r?\n/.exec(e);null!==i&&(t=i[1],r=new Blob([i[0]]).size);const n={comments:[],elements:[],headerLength:r,objInfo:""},s=t.split("\n");let o;function a(e,t){const r={type:e[0]};return"list"===r.type?(r.name=e[3],r.countType=e[1],r.itemType=e[2]):r.name=e[1],r.name in t&&(r.name=t[r.name]),r}for(let e=0;e<s.length;e++){let t=s[e];if(t=t.trim(),""===t)continue;const r=t.split(/\s+/),i=r.shift();switch(t=r.join(" "),i){case"format":n.format=r[0],n.version=r[1];break;case"comment":n.comments.push(t);break;case"element":void 0!==o&&n.elements.push(o),o={},o.name=r[0],o.count=parseInt(r[1]),o.properties=[];break;case"property":o.properties.push(a(r,u.propertyNameMapping));break;case"obj_info":n.objInfo=t;break;default:console.log("unhandled",i,r)}}return void 0!==o&&n.elements.push(o),n}function i(e,t){switch(t){case"char":case"uchar":case"short":case"ushort":case"int":case"uint":case"int8":case"uint8":case"int16":case"uint16":case"int32":case"uint32":return parseInt(e);case"float":case"double":case"float32":case"float64":return parseFloat(e)}}function n(e,t){const r=t.split(/\s+/),n={};for(let t=0;t<e.length;t++)if("list"===e[t].type){const s=[],o=i(r.shift(),e[t].countType);for(let n=0;n<o;n++)s.push(i(r.shift(),e[t].itemType));n[e[t].name]=s}else n[e[t].name]=i(r.shift(),e[t].type);return n}function s(e,t){const r={indices:[],vertices:[],normals:[],uvs:[],faceVertexUvs:[],colors:[]};let i;let s="";null!==(i=/end_header\s([\s\S]*)$/.exec(e))&&(s=i[1]);const l=s.split("\n");let c=0,h=0;for(let e=0;e<l.length;e++){let i=l[e];if(i=i.trim(),""===i)continue;h>=t.elements[c].count&&(c++,h=0);const s=n(t.elements[c].properties,i);a(r,t.elements[c].name,s),h++}return o(r)}function o(t){let r=new e.BufferGeometry;return t.indices.length>0&&r.setIndex(t.indices),r.setAttribute("position",new e.Float32BufferAttribute(t.vertices,3)),t.normals.length>0&&r.setAttribute("normal",new e.Float32BufferAttribute(t.normals,3)),t.uvs.length>0&&r.setAttribute("uv",new e.Float32BufferAttribute(t.uvs,2)),t.colors.length>0&&r.setAttribute("color",new e.Float32BufferAttribute(t.colors,3)),t.faceVertexUvs.length>0&&(r=r.toNonIndexed(),r.setAttribute("uv",new e.Float32BufferAttribute(t.faceVertexUvs,2))),r.computeBoundingSphere(),r}function a(e,t,r){if("vertex"===t)e.vertices.push(r.x,r.y,r.z),"nx"in r&&"ny"in r&&"nz"in r&&e.normals.push(r.nx,r.ny,r.nz),"s"in r&&"t"in r&&e.uvs.push(r.s,r.t),"red"in r&&"green"in r&&"blue"in r&&e.colors.push(r.red/255,r.green/255,r.blue/255);else if("face"===t){const t=r.vertex_indices||r.vertex_index,i=r.texcoord;3===t.length?(e.indices.push(t[0],t[1],t[2]),i&&6===i.length&&(e.faceVertexUvs.push(i[0],i[1]),e.faceVertexUvs.push(i[2],i[3]),e.faceVertexUvs.push(i[4],i[5]))):4===t.length&&(e.indices.push(t[0],t[1],t[3]),e.indices.push(t[1],t[2],t[3]))}}function l(e,t,r,i){switch(r){case"int8":case"char":return[e.getInt8(t),1];case"uint8":case"uchar":return[e.getUint8(t),1];case"int16":case"short":return[e.getInt16(t,i),2];case"uint16":case"ushort":return[e.getUint16(t,i),2];case"int32":case"int":return[e.getInt32(t,i),4];case"uint32":case"uint":return[e.getUint32(t,i),4];case"float32":case"float":return[e.getFloat32(t,i),4];case"float64":case"double":return[e.getFloat64(t,i),8]}}function c(e,t,r,i){const n={};let s,o=0;for(let a=0;a<r.length;a++)if("list"===r[a].type){const c=[];s=l(e,t+o,r[a].countType,i);const h=s[0];o+=s[1];for(let n=0;n<h;n++)s=l(e,t+o,r[a].itemType,i),c.push(s[0]),o+=s[1];n[r[a].name]=c}else s=l(e,t+o,r[a].type,i),n[r[a].name]=s[0],o+=s[1];return[n,o]}let h;const u=this;if(t instanceof ArrayBuffer){const i=e.LoaderUtils.decodeText(new Uint8Array(t)),n=r(i);h="ascii"===n.format?s(i,n):function(e,t){const r={indices:[],vertices:[],normals:[],uvs:[],faceVertexUvs:[],colors:[]},i="binary_little_endian"===t.format,n=new DataView(e,t.headerLength);let s,l=0;for(let e=0;e<t.elements.length;e++)for(let o=0;o<t.elements[e].count;o++){s=c(n,l,t.elements[e].properties,i),l+=s[1];const o=s[0];a(r,t.elements[e].name,o)}return o(r)}(t,n)}else h=s(t,r(t));return h}}const Xm=new e.Box3,Qm=new e.Vector3;class Ym extends e.InstancedBufferGeometry{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";this.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),this.setAttribute("position",new e.Float32BufferAttribute([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),this.setAttribute("uv",new e.Float32BufferAttribute([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2))}applyMatrix4(e){const t=this.attributes.instanceStart,r=this.attributes.instanceEnd;return void 0!==t&&(t.applyMatrix4(e),r.applyMatrix4(e),t.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}setPositions(t){let r;t instanceof Float32Array?r=t:Array.isArray(t)&&(r=new Float32Array(t));const i=new e.InstancedInterleavedBuffer(r,6,1);return this.setAttribute("instanceStart",new e.InterleavedBufferAttribute(i,3,0)),this.setAttribute("instanceEnd",new e.InterleavedBufferAttribute(i,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(t){let r;t instanceof Float32Array?r=t:Array.isArray(t)&&(r=new Float32Array(t));const i=new e.InstancedInterleavedBuffer(r,6,1);return this.setAttribute("instanceColorStart",new e.InterleavedBufferAttribute(i,3,0)),this.setAttribute("instanceColorEnd",new e.InterleavedBufferAttribute(i,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(t){return this.fromWireframeGeometry(new e.WireframeGeometry(t.geometry)),this}fromLineSegments(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new e.Box3);const t=this.attributes.instanceStart,r=this.attributes.instanceEnd;void 0!==t&&void 0!==r&&(this.boundingBox.setFromBufferAttribute(t),Xm.setFromBufferAttribute(r),this.boundingBox.union(Xm))}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new e.Sphere),null===this.boundingBox&&this.computeBoundingBox();const t=this.attributes.instanceStart,r=this.attributes.instanceEnd;if(void 0!==t&&void 0!==r){const e=this.boundingSphere.center;this.boundingBox.getCenter(e);let i=0;for(let n=0,s=t.count;n<s;n++)Qm.fromBufferAttribute(t,n),i=Math.max(i,e.distanceToSquared(Qm)),Qm.fromBufferAttribute(r,n),i=Math.max(i,e.distanceToSquared(Qm));this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}applyMatrix(e){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(e)}}class Km extends Ym{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(e){const t=e.length-3,r=new Float32Array(2*t);for(let i=0;i<t;i+=3)r[2*i]=e[i],r[2*i+1]=e[i+1],r[2*i+2]=e[i+2],r[2*i+3]=e[i+3],r[2*i+4]=e[i+4],r[2*i+5]=e[i+5];return super.setPositions(r),this}setColors(e){const t=e.length-3,r=new Float32Array(2*t);for(let i=0;i<t;i+=3)r[2*i]=e[i],r[2*i+1]=e[i+1],r[2*i+2]=e[i+2],r[2*i+3]=e[i+3],r[2*i+4]=e[i+4],r[2*i+5]=e[i+5];return super.setColors(r),this}fromLine(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}}e.UniformsLib.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new e.Vector2(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},e.ShaderLib.line={uniforms:e.UniformsUtils.merge([e.UniformsLib.common,e.UniformsLib.fog,e.UniformsLib.line]),vertexShader:"\n\t\t#include <common>\n\t\t#include <color_pars_vertex>\n\t\t#include <fog_pars_vertex>\n\t\t#include <logdepthbuf_pars_vertex>\n\t\t#include <clipping_planes_pars_vertex>\n\n\t\tuniform float linewidth;\n\t\tuniform vec2 resolution;\n\n\t\tattribute vec3 instanceStart;\n\t\tattribute vec3 instanceEnd;\n\n\t\tattribute vec3 instanceColorStart;\n\t\tattribute vec3 instanceColorEnd;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashScale;\n\t\t\tattribute float instanceDistanceStart;\n\t\t\tattribute float instanceDistanceEnd;\n\t\t\tvarying float vLineDistance;\n\n\t\t#endif\n\n\t\tvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\n\t\t\t// trim end segment so it terminates between the camera plane and the near plane\n\n\t\t\t// conservative estimate of the near plane\n\t\t\tfloat a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n\t\t\tfloat b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\t\t\tfloat nearEstimate = - 0.5 * b / a;\n\n\t\t\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n\t\t\tend.xyz = mix( start.xyz, end.xyz, alpha );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#ifdef USE_COLOR\n\n\t\t\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n\t\t\t#endif\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\tfloat aspect = resolution.x / resolution.y;\n\n\t\t\t// camera space\n\t\t\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\tworldStart = start.xyz;\n\t\t\t\tworldEnd = end.xyz;\n\n\t\t\t#else\n\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\t// special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n\t\t\t// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n\t\t\t// but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n\t\t\t// perhaps there is a more elegant solution -- WestLangley\n\n\t\t\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n\t\t\tif ( perspective ) {\n\n\t\t\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( start, end );\n\n\t\t\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( end, start );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// clip space\n\t\t\tvec4 clipStart = projectionMatrix * start;\n\t\t\tvec4 clipEnd = projectionMatrix * end;\n\n\t\t\t// ndc space\n\t\t\tvec3 ndcStart = clipStart.xyz / clipStart.w;\n\t\t\tvec3 ndcEnd = clipEnd.xyz / clipEnd.w;\n\n\t\t\t// direction\n\t\t\tvec2 dir = ndcEnd.xy - ndcStart.xy;\n\n\t\t\t// account for clip-space aspect ratio\n\t\t\tdir.x *= aspect;\n\t\t\tdir = normalize( dir );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// get the offset direction as perpendicular to the view vector\n\t\t\t\tvec3 worldDir = normalize( end.xyz - start.xyz );\n\t\t\t\tvec3 offset;\n\t\t\t\tif ( position.y < 0.5 ) {\n\n\t\t\t\t\toffset = normalize( cross( start.xyz, worldDir ) );\n\n\t\t\t\t} else {\n\n\t\t\t\t\toffset = normalize( cross( end.xyz, worldDir ) );\n\n\t\t\t\t}\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\tfloat forwardOffset = dot( worldDir, vec3( 0.0, 0.0, 1.0 ) );\n\n\t\t\t\t// don't extend the line if we're rendering dashes because we\n\t\t\t\t// won't be rendering the endcaps\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t// extend the line bounds to encompass endcaps\n\t\t\t\t\tstart.xyz += - worldDir * linewidth * 0.5;\n\t\t\t\t\tend.xyz += worldDir * linewidth * 0.5;\n\n\t\t\t\t\t// shift the position of the quad so it hugs the forward edge of the line\n\t\t\t\t\toffset.xy -= dir * forwardOffset;\n\t\t\t\t\toffset.z += 0.5;\n\n\t\t\t\t#endif\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y > 1.0 || position.y < 0.0 ) {\n\n\t\t\t\t\toffset.xy += dir * 2.0 * forwardOffset;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for linewidth\n\t\t\t\toffset *= linewidth * 0.5;\n\n\t\t\t\t// set the world position\n\t\t\t\tworldPos = ( position.y < 0.5 ) ? start : end;\n\t\t\t\tworldPos.xyz += offset;\n\n\t\t\t\t// project the worldpos\n\t\t\t\tvec4 clip = projectionMatrix * worldPos;\n\n\t\t\t\t// shift the depth of the projected points so the line\n\t\t\t\t// segments overlap neatly\n\t\t\t\tvec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;\n\t\t\t\tclip.z = clipPose.z * clip.w;\n\n\t\t\t#else\n\n\t\t\t\tvec2 offset = vec2( dir.y, - dir.x );\n\t\t\t\t// undo aspect ratio adjustment\n\t\t\t\tdir.x /= aspect;\n\t\t\t\toffset.x /= aspect;\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y < 0.0 ) {\n\n\t\t\t\t\toffset += - dir;\n\n\t\t\t\t} else if ( position.y > 1.0 ) {\n\n\t\t\t\t\toffset += dir;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for linewidth\n\t\t\t\toffset *= linewidth;\n\n\t\t\t\t// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n\t\t\t\toffset /= resolution.y;\n\n\t\t\t\t// select end\n\t\t\t\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n\t\t\t\t// back to clip space\n\t\t\t\toffset *= clip.w;\n\n\t\t\t\tclip.xy += offset;\n\n\t\t\t#endif\n\n\t\t\tgl_Position = clip;\n\n\t\t\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n\t\t\t#include <logdepthbuf_vertex>\n\t\t\t#include <clipping_planes_vertex>\n\t\t\t#include <fog_vertex>\n\n\t\t}\n\t\t",fragmentShader:"\n\t\tuniform vec3 diffuse;\n\t\tuniform float opacity;\n\t\tuniform float linewidth;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashOffset;\n\t\t\tuniform float dashSize;\n\t\t\tuniform float gapSize;\n\n\t\t#endif\n\n\t\tvarying float vLineDistance;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#include <common>\n\t\t#include <color_pars_fragment>\n\t\t#include <fog_pars_fragment>\n\t\t#include <logdepthbuf_pars_fragment>\n\t\t#include <clipping_planes_pars_fragment>\n\n\t\tvec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {\n\n\t\t\tfloat mua;\n\t\t\tfloat mub;\n\n\t\t\tvec3 p13 = p1 - p3;\n\t\t\tvec3 p43 = p4 - p3;\n\n\t\t\tvec3 p21 = p2 - p1;\n\n\t\t\tfloat d1343 = dot( p13, p43 );\n\t\t\tfloat d4321 = dot( p43, p21 );\n\t\t\tfloat d1321 = dot( p13, p21 );\n\t\t\tfloat d4343 = dot( p43, p43 );\n\t\t\tfloat d2121 = dot( p21, p21 );\n\n\t\t\tfloat denom = d2121 * d4343 - d4321 * d4321;\n\n\t\t\tfloat numer = d1343 * d4321 - d1321 * d4343;\n\n\t\t\tmua = numer / denom;\n\t\t\tmua = clamp( mua, 0.0, 1.0 );\n\t\t\tmub = ( d1343 + d4321 * ( mua ) ) / d4343;\n\t\t\tmub = clamp( mub, 0.0, 1.0 );\n\n\t\t\treturn vec2( mua, mub );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#include <clipping_planes_fragment>\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n\t\t\t\tif ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n\t\t\t#endif\n\n\t\t\tfloat alpha = opacity;\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// Find the closest points on the view ray and the line segment\n\t\t\t\tvec3 rayEnd = normalize( worldPos.xyz ) * 1e5;\n\t\t\t\tvec3 lineDir = worldEnd - worldStart;\n\t\t\t\tvec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );\n\n\t\t\t\tvec3 p1 = worldStart + lineDir * params.x;\n\t\t\t\tvec3 p2 = rayEnd * params.y;\n\t\t\t\tvec3 delta = p1 - p2;\n\t\t\t\tfloat len = length( delta );\n\t\t\t\tfloat norm = len / linewidth;\n\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t\tfloat dnorm = fwidth( norm );\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );\n\n\t\t\t\t\t#else\n\n\t\t\t\t\t\tif ( norm > 0.5 ) {\n\n\t\t\t\t\t\t\tdiscard;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t#endif\n\n\t\t\t\t#endif\n\n\t\t\t#else\n\n\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t// artifacts appear on some hardware if a derivative is taken within a conditional\n\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\tfloat len2 = a * a + b * b;\n\t\t\t\t\tfloat dlen = fwidth( len2 );\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t#else\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\t\tfloat len2 = a * a + b * b;\n\n\t\t\t\t\t\tif ( len2 > 1.0 ) discard;\n\n\t\t\t\t\t}\n\n\t\t\t\t#endif\n\n\t\t\t#endif\n\n\t\t\tvec4 diffuseColor = vec4( diffuse, alpha );\n\n\t\t\t#include <logdepthbuf_fragment>\n\t\t\t#include <color_fragment>\n\n\t\t\tgl_FragColor = vec4( diffuseColor.rgb, alpha );\n\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <encodings_fragment>\n\t\t\t#include <fog_fragment>\n\t\t\t#include <premultiplied_alpha_fragment>\n\n\t\t}\n\t\t"};class qm extends e.ShaderMaterial{constructor(t){super({type:"LineMaterial",uniforms:e.UniformsUtils.clone(e.ShaderLib.line.uniforms),vertexShader:e.ShaderLib.line.vertexShader,fragmentShader:e.ShaderLib.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,Object.defineProperties(this,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(e){this.uniforms.diffuse.value=e}},worldUnits:{enumerable:!0,get:function(){return"WORLD_UNITS"in this.defines},set:function(e){!0===e?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(e){this.uniforms.linewidth.value=e}},dashed:{enumerable:!0,get:function(){return Boolean("USE_DASH"in this.defines)},set(e){Boolean(e)!==Boolean("USE_DASH"in this.defines)&&(this.needsUpdate=!0),!0===e?this.defines.USE_DASH="":delete this.defines.USE_DASH}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(e){this.uniforms.dashScale.value=e}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(e){this.uniforms.dashSize.value=e}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(e){this.uniforms.dashOffset.value=e}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(e){this.uniforms.gapSize.value=e}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(e){this.uniforms.resolution.value.copy(e)}},alphaToCoverage:{enumerable:!0,get:function(){return Boolean("USE_ALPHA_TO_COVERAGE"in this.defines)},set:function(e){Boolean(e)!==Boolean("USE_ALPHA_TO_COVERAGE"in this.defines)&&(this.needsUpdate=!0),!0===e?(this.defines.USE_ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.USE_ALPHA_TO_COVERAGE,this.extensions.derivatives=!1)}}}),this.setValues(t)}}const Jm=new e.Vector3,Zm=new e.Vector3;class $m extends e.Mesh{constructor(e=new Ym,t=new qm({color:16777215*Math.random()})){super(e,t),this.isWireframe=!0,this.type="Wireframe"}computeLineDistances(){const t=this.geometry,r=t.attributes.instanceStart,i=t.attributes.instanceEnd,n=new Float32Array(2*r.count);for(let e=0,t=0,s=r.count;e<s;e++,t+=2)Jm.fromBufferAttribute(r,e),Zm.fromBufferAttribute(i,e),n[t]=0===t?0:n[t-1],n[t+1]=n[t]+Jm.distanceTo(Zm);const s=new e.InstancedInterleavedBuffer(n,2,1);return t.setAttribute("instanceDistanceStart",new e.InterleavedBufferAttribute(s,1,0)),t.setAttribute("instanceDistanceEnd",new e.InterleavedBufferAttribute(s,1,1)),this}}const ef=new e.Vector3,tf=new e.Vector3,rf=new e.Vector4,nf=new e.Vector4,sf=new e.Vector4,of=new e.Vector3,af=new e.Matrix4,lf=new e.Line3,cf=new e.Vector3,hf=new e.Box3,uf=new e.Sphere,df=new e.Vector4;let pf,mf,ff,gf;function vf(e,t,r){return df.set(0,0,-t,1).applyMatrix4(e.projectionMatrix),df.multiplyScalar(1/df.w),df.x=gf/r.width,df.y=gf/r.height,df.applyMatrix4(e.projectionMatrixInverse),df.multiplyScalar(1/df.w),Math.abs(Math.max(df.x,df.y))}class xf extends e.Mesh{constructor(e=new Ym,t=new qm({color:16777215*Math.random()})){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const t=this.geometry,r=t.attributes.instanceStart,i=t.attributes.instanceEnd,n=new Float32Array(2*r.count);for(let e=0,t=0,s=r.count;e<s;e++,t+=2)ef.fromBufferAttribute(r,e),tf.fromBufferAttribute(i,e),n[t]=0===t?0:n[t-1],n[t+1]=n[t]+ef.distanceTo(tf);const s=new e.InstancedInterleavedBuffer(n,2,1);return t.setAttribute("instanceDistanceStart",new e.InterleavedBufferAttribute(s,1,0)),t.setAttribute("instanceDistanceEnd",new e.InterleavedBufferAttribute(s,1,1)),this}raycast(t,r){const i=this.material.worldUnits,n=t.camera;null!==n||i||console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const s=void 0!==t.params.Line2&&t.params.Line2.threshold||0;pf=t.ray;const o=this.matrixWorld,a=this.geometry,l=this.material;let c,h;if(gf=l.linewidth+s,mf=a.attributes.instanceStart,ff=a.attributes.instanceEnd,null===a.boundingSphere&&a.computeBoundingSphere(),uf.copy(a.boundingSphere).applyMatrix4(o),i)c=.5*gf;else{c=vf(n,Math.max(n.near,uf.distanceToPoint(pf.origin)),l.resolution)}if(uf.radius+=c,!1!==pf.intersectsSphere(uf)){if(null===a.boundingBox&&a.computeBoundingBox(),hf.copy(a.boundingBox).applyMatrix4(o),i)h=.5*gf;else{h=vf(n,Math.max(n.near,hf.distanceToPoint(pf.origin)),l.resolution)}hf.expandByScalar(h),!1!==pf.intersectsBox(hf)&&(i?function(t,r){for(let i=0,n=mf.count;i<n;i++){lf.start.fromBufferAttribute(mf,i),lf.end.fromBufferAttribute(ff,i);const n=new e.Vector3,s=new e.Vector3;pf.distanceSqToSegment(lf.start,lf.end,s,n),s.distanceTo(n)<.5*gf&&r.push({point:s,pointOnLine:n,distance:pf.origin.distanceTo(s),object:t,face:null,faceIndex:i,uv:null,uv2:null})}}(this,r):function(t,r,i){const n=r.projectionMatrix,s=t.material.resolution,o=t.matrixWorld,a=t.geometry,l=a.attributes.instanceStart,c=a.attributes.instanceEnd,h=-r.near;pf.at(1,sf),sf.w=1,sf.applyMatrix4(r.matrixWorldInverse),sf.applyMatrix4(n),sf.multiplyScalar(1/sf.w),sf.x*=s.x/2,sf.y*=s.y/2,sf.z=0,of.copy(sf),af.multiplyMatrices(r.matrixWorldInverse,o);for(let r=0,a=l.count;r<a;r++){if(rf.fromBufferAttribute(l,r),nf.fromBufferAttribute(c,r),rf.w=1,nf.w=1,rf.applyMatrix4(af),nf.applyMatrix4(af),rf.z>h&&nf.z>h)continue;if(rf.z>h){const e=rf.z-nf.z,t=(rf.z-h)/e;rf.lerp(nf,t)}else if(nf.z>h){const e=nf.z-rf.z,t=(nf.z-h)/e;nf.lerp(rf,t)}rf.applyMatrix4(n),nf.applyMatrix4(n),rf.multiplyScalar(1/rf.w),nf.multiplyScalar(1/nf.w),rf.x*=s.x/2,rf.y*=s.y/2,nf.x*=s.x/2,nf.y*=s.y/2,lf.start.copy(rf),lf.start.z=0,lf.end.copy(nf),lf.end.z=0;const a=lf.closestPointToPointParameter(of,!0);lf.at(a,cf);const u=e.MathUtils.lerp(rf.z,nf.z,a),d=u>=-1&&u<=1,p=of.distanceTo(cf)<.5*gf;if(d&&p){lf.start.fromBufferAttribute(l,r),lf.end.fromBufferAttribute(c,r),lf.start.applyMatrix4(o),lf.end.applyMatrix4(o);const n=new e.Vector3,s=new e.Vector3;pf.distanceSqToSegment(lf.start,lf.end,s,n),i.push({point:s,pointOnLine:n,distance:pf.origin.distanceTo(s),object:t,face:null,faceIndex:r,uv:null,uv2:null})}}}(this,n,r))}}}class yf extends e.Mesh{constructor(t,r){const i=new e.ShaderMaterial({type:"LightProbeHelperMaterial",uniforms:{sh:{value:t.sh.coefficients},intensity:{value:t.intensity}},vertexShader:["varying vec3 vNormal;","void main() {","\tvNormal = normalize( normalMatrix * normal );","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["#define RECIPROCAL_PI 0.318309886","vec3 inverseTransformDirection( in vec3 normal, in mat4 matrix ) {","\t// matrix is assumed to be orthogonal","\treturn normalize( ( vec4( normal, 0.0 ) * matrix ).xyz );","}","// source: https://graphics.stanford.edu/papers/envmap/envmap.pdf","vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {","\t// normal is assumed to have unit length","\tfloat x = normal.x, y = normal.y, z = normal.z;","\t// band 0","\tvec3 result = shCoefficients[ 0 ] * 0.886227;","\t// band 1","\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;","\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;","\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;","\t// band 2","\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;","\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;","\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );","\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;","\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );","\treturn result;","}","uniform vec3 sh[ 9 ]; // sh coefficients","uniform float intensity; // light probe intensity","varying vec3 vNormal;","void main() {","\tvec3 normal = normalize( vNormal );","\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );","\tvec3 irradiance = shGetIrradianceAt( worldNormal, sh );","\tvec3 outgoingLight = RECIPROCAL_PI * irradiance * intensity;","\tgl_FragColor = linearToOutputTexel( vec4( outgoingLight, 1.0 ) );","}"].join("\n")});super(new e.SphereGeometry(1,32,16),i),this.lightProbe=t,this.size=r,this.type="LightProbeHelper",this.onBeforeRender()}dispose(){this.geometry.dispose(),this.material.dispose()}onBeforeRender(){this.position.copy(this.lightProbe.position),this.scale.set(1,1,1).multiplyScalar(this.size),this.material.uniforms.intensity.value=this.lightProbe.intensity}}const bf=new e.Vector3,Af=new e.Vector3;class wf extends e.LineSegments{constructor(t,r,i){const n=void 0!==i?i:65535,s=t.geometry;if(!s||!s.isBufferGeometry)return void console.error("THREE.VertexTangentsHelper: geometry not an instance of THREE.BufferGeometry.",s);const o=s.attributes.tangent.count,a=new e.BufferGeometry,l=new e.Float32BufferAttribute(2*o*3,3);a.setAttribute("position",l),super(a,new e.LineBasicMaterial({color:n,toneMapped:!1})),this.type="VertexTangentsHelper",this.object=t,this.size=void 0!==r?r:1,this.matrixAutoUpdate=!1,this.update()}update(){this.object.updateMatrixWorld(!0);const e=this.object.matrixWorld,t=this.geometry.attributes.position,r=this.object.geometry,i=r.attributes.position,n=r.attributes.tangent;let s=0;for(let r=0,o=i.count;r<o;r++)bf.set(i.getX(r),i.getY(r),i.getZ(r)).applyMatrix4(e),Af.set(n.getX(r),n.getY(r),n.getZ(r)),Af.transformDirection(e).multiplyScalar(this.size).add(bf),t.setXYZ(s,bf.x,bf.y,bf.z),s+=1,t.setXYZ(s,Af.x,Af.y,Af.z),s+=1;t.needsUpdate=!0}}class Mf extends e.Line{constructor(t,r=1,i=16,n=2){const s=new e.BufferGeometry,o=new Float32Array(3*(3*(i+2*n)+3));s.setAttribute("position",new e.BufferAttribute(o,3));const a=new e.LineBasicMaterial({color:65280});super(s,[new e.LineBasicMaterial({color:16776960}),a]),this.type="PositionalAudioHelper",this.audio=t,this.range=r,this.divisionsInnerAngle=i,this.divisionsOuterAngle=n,this.update()}update(){const t=this.audio,r=this.range,i=this.divisionsInnerAngle,n=this.divisionsOuterAngle,s=e.MathUtils.degToRad(t.panner.coneInnerAngle),o=e.MathUtils.degToRad(t.panner.coneOuterAngle),a=s/2,l=o/2;let c,h,u=0,d=0;const p=this.geometry,m=p.attributes.position;function f(e,t,i,n){const s=(t-e)/i;for(m.setXYZ(u,0,0,0),d++,c=e;c<t;c+=s)h=u+d,m.setXYZ(h,Math.sin(c)*r,0,Math.cos(c)*r),m.setXYZ(h+1,Math.sin(Math.min(c+s,t))*r,0,Math.cos(Math.min(c+s,t))*r),m.setXYZ(h+2,0,0,0),d+=3;p.addGroup(u,d,n),u+=d,d=0}p.clearGroups(),f(-l,-a,n,0),f(-a,a,i,1),f(a,l,n,0),m.needsUpdate=!0,s===o&&(this.material[0].visible=!1)}dispose(){this.geometry.dispose(),this.material[0].dispose(),this.material[1].dispose()}}const Tf=new e.Vector3,Sf=new e.Vector3,Cf=new e.Matrix3;class Ff extends e.LineSegments{constructor(t,r,i){const n=new e.BufferGeometry,s=void 0!==i?i:16711680;super(n,new e.LineBasicMaterial({color:s,toneMapped:!1})),this.object=t,this.size=void 0!==r?r:.1;let o=0;const a=this.object.geometry;if(a&&a.isGeometry)return void console.error("THREE.VertexNormalsHelper no longer supports Geometry. Use BufferGeometry instead.");a&&a.isBufferGeometry&&(o=a.attributes.normal.count);const l=new e.Float32BufferAttribute(2*o*3,3);n.setAttribute("position",l),this.type="VertexNormalsHelper",this.matrixAutoUpdate=!1,this.update()}update(){this.object.updateMatrixWorld(!0),Cf.getNormalMatrix(this.object.matrixWorld);const e=this.object.matrixWorld,t=this.geometry.attributes.position,r=this.object.geometry;if(r&&r.isGeometry)console.error("THREE.VertexNormalsHelper no longer supports Geometry. Use BufferGeometry instead.");else{if(r&&r.isBufferGeometry){const i=r.attributes.position,n=r.attributes.normal;let s=0;for(let r=0,o=i.count;r<o;r++)Tf.set(i.getX(r),i.getY(r),i.getZ(r)).applyMatrix4(e),Sf.set(n.getX(r),n.getY(r),n.getZ(r)),Sf.applyMatrix3(Cf).normalize().multiplyScalar(this.size).add(Tf),t.setXYZ(s,Tf.x,Tf.y,Tf.z),s+=1,t.setXYZ(s,Sf.x,Sf.y,Sf.z),s+=1}t.needsUpdate=!0}}}class Ef extends e.Line{constructor(t,r){const i=new e.BufferGeometry;i.setAttribute("position",new e.Float32BufferAttribute([1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],3)),i.computeBoundingSphere();super(i,new e.LineBasicMaterial({fog:!1})),this.type="RectAreaLightHelper",this.light=t,this.color=r;const n=new e.BufferGeometry;n.setAttribute("position",new e.Float32BufferAttribute([1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],3)),n.computeBoundingSphere(),this.add(new e.Mesh(n,new e.MeshBasicMaterial({side:e.BackSide,fog:!1})))}updateMatrixWorld(){if(this.scale.set(.5*this.light.width,.5*this.light.height,1),void 0!==this.color)this.material.color.set(this.color),this.children[0].material.color.set(this.color);else{this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity);const e=this.material.color,t=Math.max(e.r,e.g,e.b);t>1&&e.multiplyScalar(1/t),this.children[0].material.color.copy(this.material.color)}this.matrixWorld.copy(this.light.matrixWorld).scale(this.scale),this.children[0].matrixWorld.copy(this.matrixWorld)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}var _f={init:function(){var t=[1,0,0,2e-5,1,0,0,503905e-9,1,0,0,.00201562,1,0,0,.00453516,1,0,0,.00806253,1,0,0,.0125978,1,0,0,.018141,1,0,0,.0246924,1,0,0,.0322525,1,0,0,.0408213,1,0,0,.0503999,1,0,0,.0609894,1,0,0,.0725906,1,0,0,.0852058,1,0,0,.0988363,1,0,0,.113484,1,0,0,.129153,1,0,0,.145839,1,0,0,.163548,1,0,0,.182266,1,0,0,.201942,1,0,0,.222314,1,0,0,.241906,1,0,0,.262314,1,0,0,.285754,1,0,0,.310159,1,0,0,.335426,1,0,0,.361341,1,0,0,.387445,1,0,0,.412784,1,0,0,.438197,1,0,0,.466966,1,0,0,.49559,1,0,0,.523448,1,0,0,.549938,1,0,0,.57979,1,0,0,.608746,1,0,0,.636185,1,0,0,.664748,1,0,0,.69313,1,0,0,.71966,1,0,0,.747662,1,0,0,.774023,1,0,0,.799775,1,0,0,.825274,1,0,0,.849156,1,0,0,.873248,1,0,0,.89532,1,0,0,.917565,1,0,0,.937863,1,0,0,.958139,1,0,0,.976563,1,0,0,.994658,1,0,0,1.0112,1,0,0,1.02712,1,0,0,1.04189,1,0,0,1.05568,1,0,0,1.06877,1,0,0,1.08058,1,0,0,1.09194,1,0,0,1.10191,1,0,0,1.11161,1,0,0,1.1199,1,0,0,1.12813,.999547,-4.48815e-7,.0224417,199902e-10,.999495,-113079e-10,.0224406,503651e-9,.999496,-452317e-10,.0224406,.00201461,.999496,-101772e-9,.0224406,.00453287,.999495,-180928e-9,.0224406,.00805845,.999497,-282702e-9,.0224406,.0125914,.999496,-407096e-9,.0224406,.0181319,.999498,-554114e-9,.0224406,.02468,.999499,-723768e-9,.0224406,.0322363,.999495,-916058e-9,.0224405,.0408009,.999499,-.00113101,.0224408,.050375,.999494,-.00136863,.0224405,.0609586,.999489,-.00162896,.0224401,.0725537,.999489,-.00191201,.0224414,.0851619,.999498,-.00221787,.0224413,.0987867,.999492,-.00254642,.0224409,.113426,.999507,-.00289779,.0224417,.129088,.999494,-.0032716,.0224386,.145767,.999546,-.0036673,.0224424,.163472,.999543,-.00408166,.0224387,.182182,.999499,-.00450056,.0224338,.201843,.999503,-.00483661,.0224203,.222198,.999546,-.00452928,.022315,.241714,.999508,-.00587403,.0224329,.262184,.999509,-.00638806,.0224271,.285609,.999501,-.00691028,.0224166,.309998,.999539,-.00741979,.0223989,.335262,.999454,-.00786282,.0223675,.361154,.999529,-.00811928,.0222828,.387224,.999503,-.00799941,.0221063,.41252,.999561,-.00952753,.0223057,.438006,.999557,-.0099134,.0222065,.466735,.999541,-.0100935,.0220402,.495332,.999562,-.00996821,.0218067,.523197,.999556,-.0105031,.0217096,.550223,.999561,-.0114191,.0217215,.579498,.999588,-.0111818,.0213357,.608416,.999633,-.0107725,.0208689,.635965,.999527,-.0121671,.0210149,.664476,.999508,-.0116005,.020431,.692786,.999568,-.0115604,.0199791,.719709,.999671,-.0121117,.0197415,.74737,.999688,-.0110769,.0188846,.773692,.99962,-.0122368,.0188452,.799534,.999823,-.0110325,.0178001,.825046,.999599,-.0114923,.0174221,.849075,.999619,-.0105923,.0164345,.872999,.999613,-.0105988,.0158227,.895371,.99964,-.00979861,.0148131,.917364,.99977,-.00967238,.0140721,.938002,.999726,-.00869175,.0129543,.957917,.99973,-.00866872,.0122329,.976557,.999773,-.00731956,.0108958,.994459,.999811,-.00756027,.0102715,1.01118,.999862,-.00583732,.00878781,1.02701,.999835,-.00631438,.00827529,1.04186,.999871,-.00450785,.00674583,1.05569,.999867,-.00486079,.00621041,1.06861,.999939,-.00322072,.00478301,1.08064,.999918,-.00318199,.00406395,1.09181,1.00003,-.00193348,.00280682,1.10207,.999928,-.00153729,.00198741,1.11152,.999933,-623666e-9,917714e-9,1.12009,1,-102387e-11,9.07581e-7,1.12813,.997866,-8.96716e-7,.0448334,199584e-10,.997987,-225945e-10,.0448389,502891e-9,.997987,-903781e-10,.0448388,.00201156,.997985,-203351e-9,.0448388,.00452602,.997986,-361514e-9,.0448388,.00804629,.997987,-56487e-8,.0448389,.0125724,.997988,-813423e-9,.0448389,.0181045,.997984,-.00110718,.0448387,.0246427,.997985,-.00144616,.0448388,.0321875,.997987,-.00183038,.044839,.0407392,.997983,-.00225987,.0448387,.0502986,.997991,-.00273467,.0448389,.0608667,.997984,-.00325481,.0448384,.0724444,.998002,-.00382043,.044839,.0850348,.997997,-.00443145,.0448396,.0986372,.998007,-.00508796,.0448397,.113255,.998008,-.00578985,.04484,.128891,.998003,-.00653683,.0448384,.145548,.997983,-.00732713,.0448358,.163221,.997985,-.00815454,.0448358,.181899,.998005,-.00898985,.0448286,.201533,.998026,-.00964404,.0447934,.221821,.998055,-.00922677,.044611,.241282,.99804,-.0117361,.0448245,.261791,.998048,-.0127628,.0448159,.285181,.998088,-.0138055,.0447996,.30954,.998058,-.0148206,.0447669,.334751,.998099,-.0156998,.044697,.36061,.998116,-.0161976,.0445122,.386603,.998195,-.015945,.0441711,.411844,.998168,-.0183947,.0444255,.43773,.998184,-.0197913,.0443809,.466009,.998251,-.0201426,.0440689,.494574,.998305,-.0198847,.0435632,.522405,.998273,-.0210577,.043414,.549967,.998254,-.0227901,.0433943,.578655,.998349,-.0223108,.0426529,.60758,.99843,-.0223088,.042,.635524,.998373,-.0241141,.0418987,.663621,.998425,-.0231446,.0408118,.691906,.998504,-.0233684,.0400565,.719339,.998443,-.0241652,.0394634,.74643,.99848,-.0228715,.0380002,.773086,.998569,-.023519,.0372322,.798988,.998619,-.0223108,.0356468,.824249,.998594,-.0223105,.034523,.848808,.998622,-.0213426,.0328887,.87227,.998669,-.0207912,.0314374,.895157,.998705,-.0198416,.0296925,.916769,.998786,-.0189168,.0279634,.937773,.998888,-.0178811,.0261597,.957431,.99906,-.0166845,.0242159,.976495,.999038,-.0155464,.0222638,.994169,.999237,-.0141349,.0201967,1.01112,.999378,-.0129324,.0181744,1.02692,.999433,-.0113192,.0159898,1.04174,.999439,-.0101244,.0140385,1.05559,.999614,-.00837456,.0117826,1.06852,.999722,-.00721769,.00983745,1.08069,.999817,-.00554067,.00769002,1.09176,.99983,-.00426961,.005782,1.10211,.999964,-.00273904,.00374503,1.11152,1.00001,-.00136739,.00187176,1.12031,.999946,393227e-10,-28919e-9,1.12804,.995847,-13435e-10,.0671785,19916e-9,.995464,-338387e-10,.0671527,501622e-9,.99547,-135355e-9,.0671531,.00200649,.995471,-30455e-8,.0671532,.00451461,.99547,-541423e-9,.0671531,.008026,.995471,-84598e-8,.0671531,.0125407,.99547,-.00121823,.0671531,.0180589,.99547,-.00165817,.0671531,.0245806,.995463,-.00216583,.0671526,.0321062,.995468,-.00274127,.0671527,.0406366,.995474,-.00338447,.0671534,.0501717,.995473,-.00409554,.0671533,.0607131,.995478,-.00487451,.0671531,.0722618,.995476,-.00572148,.0671532,.0848191,.995477,-.00663658,.0671539,.0983882,.995498,-.00761986,.0671541,.112972,.995509,-.00867094,.0671542,.128568,.995509,-.00978951,.0671531,.145183,.995503,-.0109725,.0671491,.162808,.995501,-.012211,.0671465,.181441,.99553,-.0134565,.0671371,.201015,.99555,-.014391,.0670831,.221206,.99558,-.014351,.0668883,.240813,.995577,-.0173997,.0671055,.261257,.995602,-.0191111,.0671178,.284467,.995623,-.0206705,.0670946,.308765,.995658,-.022184,.0670472,.333905,.995705,-.0234832,.0669417,.359677,.995719,-.0241933,.0666714,.385554,.995786,-.0243539,.066266,.410951,.995887,-.0271866,.0664367,.437163,.995944,-.0296012,.0664931,.464842,.996004,-.0301045,.0660105,.49332,.996128,-.0298311,.0652694,.521131,.996253,-.0316426,.0650739,.549167,.996244,-.0339043,.0649433,.57737,.996309,-.033329,.0638926,.606073,.996417,-.0338935,.0630849,.634527,.996372,-.0353104,.0625083,.66256,.996542,-.0348942,.0611986,.690516,.996568,-.0351614,.060069,.718317,.996711,-.0354317,.0588522,.74528,.996671,-.0349513,.0571902,.772061,.996865,-.0345622,.0555321,.798089,.996802,-.0342566,.0537816,.823178,.996992,-.0330862,.0516095,.847949,.996944,-.0324666,.0495537,.871431,.997146,-.0309544,.0470302,.894357,.997189,-.0299372,.0446043,.916142,.997471,-.0281389,.0418812,.937193,.997515,-.0268702,.0391823,.957,.997812,-.0247166,.0361338,.975936,.998027,-.0233525,.0333945,.99391,.998233,-.0209839,.0301917,1.01075,.998481,-.0194309,.027271,1.02669,.998859,-.0169728,.0240162,1.04173,.99894,-.0152322,.0210517,1.05551,.999132,-.0127497,.0178632,1.06856,.999369,-.0108282,.014787,1.08054,.999549,-.00845886,.0116185,1.09185,.999805,-.0063937,.00867209,1.10207,.99985,-.00414582,.00566823,1.1117,.999912,-.00207443,.00277562,1.12022,1.00001,870226e-10,-53766e-9,1.12832,.991943,-178672e-11,.0893382,198384e-10,.991952,-450183e-10,.089339,499849e-9,.991956,-180074e-9,.0893394,.0019994,.991955,-405167e-9,.0893393,.00449867,.991953,-720298e-9,.0893391,.00799764,.991955,-.00112548,.0893393,.0124964,.991957,-.0016207,.0893395,.0179951,.991958,-.00220601,.0893396,.0244939,.991947,-.00288137,.0893385,.0319929,.991962,-.00364693,.0893399,.0404933,.991965,-.00450264,.0893399,.049995,.99198,-.00544862,.0893411,.0604995,.99197,-.00648491,.0893397,.0720074,.991976,-.00761164,.089341,.0845207,.99198,-.00882891,.0893405,.0980413,.991982,-.0101367,.0893396,.112571,.992008,-.011535,.0893415,.128115,.992026,-.0130228,.0893414,.144672,.992064,-.0145966,.0893418,.162241,.992041,-.0162421,.0893359,.180801,.992086,-.0178888,.0893214,.200302,.992157,-.0190368,.0892401,.220332,.992181,-.0195584,.0890525,.240144,.992175,-.0227257,.0892153,.260728,.99221,-.0254195,.089304,.283473,.99222,-.0274883,.0892703,.307673,.992317,-.0294905,.0892027,.332729,.992374,-.0311861,.0890577,.358387,.992505,-.0320656,.0886994,.384102,.992568,-.0329715,.0883198,.409767,.992675,-.036006,.0883602,.436145,.992746,-.0392897,.0884591,.463217,.992873,-.0399337,.0878287,.491557,.992934,-.040231,.0870108,.519516,.993091,-.0422013,.0865857,.547741,.993259,-.0443503,.0861937,.575792,.993455,-.0446368,.0851187,.604233,.993497,-.0454299,.0840576,.632925,.993694,-.0463296,.0829671,.660985,.993718,-.0470619,.0817185,.688714,.993973,-.0468838,.0800294,.716743,.994207,-.046705,.0781286,.74377,.994168,-.0469698,.0763337,.77042,.9945,-.0456816,.0738184,.796659,.994356,-.0455518,.0715545,.821868,.994747,-.0439488,.0686085,.846572,.994937,-.0430056,.065869,.870435,.995142,-.0413414,.0626446,.893272,.995451,-.0396521,.05929,.915376,.995445,-.0378453,.0558503,.936196,.995967,-.0355219,.0520949,.956376,.996094,-.0335146,.048377,.975327,.996622,-.030682,.0442575,.993471,.996938,-.0285504,.0404693,1.01052,.997383,-.0253399,.0360903,1.02637,.997714,-.0231651,.0322176,1.04139,.998249,-.0198138,.0278433,1.05542,.998596,-.0174337,.0238759,1.06846,.998946,-.0141349,.0195944,1.08056,.99928,-.0115603,.0156279,1.09181,.999507,-.00839065,.0114607,1.10213,.999697,-.005666,.00763325,1.11169,.999869,-.00269902,.00364946,1.12042,1.00001,623836e-10,-319288e-10,1.12832,.987221,-222675e-11,.111332,197456e-10,.98739,-561116e-10,.111351,497563e-9,.987448,-224453e-9,.111357,.00199031,.987441,-505019e-9,.111357,.0044782,.987442,-897816e-9,.111357,.00796129,.987442,-.00140284,.111357,.0124396,.987444,-.00202012,.111357,.0179132,.987442,-.00274964,.111357,.0243824,.987446,-.00359147,.111357,.0318474,.987435,-.00454562,.111356,.0403086,.987461,-.00561225,.111358,.0497678,.987458,-.00679125,.111358,.0602239,.987443,-.0080828,.111356,.0716792,.987476,-.0094872,.111358,.0841364,.98749,-.0110044,.111361,.097597,.987508,-.0126344,.111362,.112062,.987494,-.0143767,.111357,.127533,.987526,-.0162307,.111359,.144015,.987558,-.0181912,.111361,.161502,.987602,-.0202393,.111355,.179979,.987692,-.022273,.111346,.199386,.987702,-.0235306,.111215,.219183,.987789,-.0247628,.111061,.239202,.987776,-.0280668,.111171,.259957,.987856,-.0316751,.111327,.282198,.987912,-.0342468,.111282,.306294,.988,-.0367205,.111198,.331219,.988055,-.0387766,.110994,.356708,.988241,-.0397722,.110547,.382234,.988399,-.0416076,.110198,.408227,.988539,-.0448192,.110137,.434662,.988661,-.0483793,.110143,.461442,.988967,-.0495895,.109453,.489318,.989073,-.0506797,.108628,.517516,.989274,-.0526953,.108003,.545844,.989528,-.054578,.107255,.573823,.989709,-.0561503,.106294,.601944,.989991,-.056866,.104896,.630855,.990392,-.0572914,.103336,.658925,.990374,-.0586224,.10189,.686661,.990747,-.0584764,.099783,.714548,.991041,-.0582662,.0974309,.74186,.991236,-.0584118,.0951678,.768422,.991585,-.0573055,.0921581,.794817,.991984,-.0564241,.0891167,.820336,.9921,-.0553608,.085805,.84493,.992749,-.0533816,.0820354,.868961,.99288,-.0518661,.0782181,.891931,.993511,-.0492492,.0738935,.914186,.993617,-.0471956,.0696402,.93532,.99411,-.044216,.0649659,.95543,.994595,-.0416654,.0603177,.974685,.994976,-.0384314,.0553493,.992807,.995579,-.0353491,.0503942,1.00996,.996069,-.0319787,.0452123,1.02606,.996718,-.028472,.0400112,1.04114,.997173,-.0250789,.0349456,1.05517,.997818,-.0213326,.029653,1.0683,.998318,-.0178509,.024549,1.0805,.998853,-.0141118,.0194197,1.09177,.999218,-.0105914,.0143869,1.1022,.999594,-.00693474,.00943517,1.11175,.99975,-.00340478,.00464051,1.12056,1.00001,109172e-9,-112821e-9,1.12853,.983383,-266524e-11,.133358,196534e-10,.981942,-671009e-10,.133162,494804e-9,.981946,-268405e-9,.133163,.00197923,.981944,-603912e-9,.133163,.00445326,.981941,-.00107362,.133162,.00791693,.981946,-.00167755,.133163,.0123703,.981944,-.00241569,.133162,.0178135,.981945,-.00328807,.133163,.0242466,.981945,-.00429472,.133162,.03167,.981955,-.00543573,.133164,.0400846,.981951,-.00671105,.133163,.0494901,.981968,-.00812092,.133165,.0598886,.981979,-.00966541,.133166,.0712811,.981996,-.0113446,.133168,.083669,.982014,-.0131585,.133169,.0970533,.982011,-.0151073,.133167,.111438,.982062,-.0171906,.133172,.126826,.9821,-.0194067,.133175,.143215,.982149,-.0217502,.133176,.160609,.982163,-.0241945,.133173,.178981,.982247,-.0265907,.133148,.198249,.982291,-.027916,.132974,.217795,.982396,-.0299663,.132868,.238042,.982456,-.0334544,.132934,.258901,.982499,-.0378636,.133137,.280639,.982617,-.0409274,.133085,.304604,.98274,-.0438523,.132985,.329376,.982944,-.0462288,.132728,.354697,.98308,-.0475995,.132228,.380102,.983391,-.0501901,.131924,.406256,.983514,-.0535899,.131737,.432735,.98373,-.0571858,.131567,.459359,.984056,-.0592353,.130932,.486637,.984234,-.0610488,.130092,.51509,.984748,-.0630758,.12923,.543461,.985073,-.0647398,.128174,.571376,.985195,-.0671941,.127133,.599414,.985734,-.0681345,.125576,.628134,.986241,-.0686089,.123639,.656399,.986356,-.0698511,.121834,.684258,.986894,-.0700931,.119454,.711818,.987382,-.0698321,.116718,.739511,.988109,-.0693975,.113699,.766267,.988363,-.0689584,.110454,.792456,.989112,-.0672353,.106602,.81813,.989241,-.0662034,.10267,.842889,.990333,-.0638938,.0981381,.867204,.990591,-.0618534,.0935388,.89038,.991106,-.0593117,.088553,.912576,.991919,-.0562676,.0832187,.934118,.992111,-.0534085,.0778302,.954254,.992997,-.0495459,.0720453,.973722,.993317,-.0463707,.0663458,.991949,.994133,-.0421245,.0601883,1.00936,.994705,-.0384977,.0542501,1.02559,.995495,-.0340956,.0479862,1.04083,.996206,-.030105,.041887,1.05497,.996971,-.0256095,.0355355,1.06824,.997796,-.0213932,.0293655,1.08056,.998272,-.0169612,.0232926,1.09182,.998857,-.0126756,.0172786,1.10219,.99939,-.00832486,.0113156,1.11192,.999752,-.00410826,.00557892,1.12075,1,150957e-9,-119101e-9,1.12885,.975169,-309397e-11,.154669,195073e-10,.975439,-779608e-10,.154712,491534e-9,.975464,-311847e-9,.154716,.00196617,.975464,-701656e-9,.154716,.00442387,.975462,-.0012474,.154715,.0078647,.975461,-.00194906,.154715,.0122886,.975464,-.00280667,.154715,.0176959,.975468,-.00382025,.154716,.0240867,.975471,-.00498985,.154716,.0314612,.975472,-.00631541,.154717,.0398199,.975486,-.00779719,.154718,.0491639,.975489,-.00943505,.154718,.0594932,.975509,-.0112295,.154721,.0708113,.97554,-.0131802,.154724,.0831176,.975557,-.0152876,.154726,.096415,.975585,-.0175512,.154728,.110705,.975605,-.0199713,.154729,.125992,.975645,-.0225447,.154729,.142272,.975711,-.0252649,.154735,.159549,.975788,-.0280986,.154736,.177805,.975872,-.0308232,.154704,.196911,.975968,-.0324841,.154525,.216324,.976063,-.0351281,.154432,.236628,.976157,-.0388618,.15446,.257539,.976204,-.0437704,.154665,.278975,.976358,-.047514,.154652,.302606,.976571,-.0508638,.154535,.327204,.976725,-.0534995,.154221,.352276,.977013,-.0555547,.153737,.377696,.977294,-.0586728,.153403,.403855,.977602,-.0622715,.15312,.430333,.977932,-.0658166,.152755,.456855,.978241,-.0689877,.152233,.483668,.978602,-.0712805,.15132,.512097,.979234,-.0732775,.150235,.540455,.97977,-.075163,.148978,.568486,.979995,-.0778026,.147755,.596524,.98078,-.0791854,.146019,.624825,.981628,-.0799666,.143906,.653403,.982067,-.0808532,.141561,.681445,.98271,-.0816024,.139025,.708918,.983734,-.0812511,.135764,.736594,.98431,-.0806201,.132152,.763576,.985071,-.0801605,.12846,.789797,.98618,-.0784208,.124084,.815804,.986886,-.0766643,.1193,.840869,.987485,-.0747744,.114236,.864952,.988431,-.0716701,.108654,.888431,.988886,-.0691609,.102994,.910963,.990024,-.0654048,.0967278,.932629,.990401,-.0619765,.090384,.95313,.991093,-.0579296,.0837885,.972587,.992018,-.0536576,.0770171,.991184,.992536,-.0493719,.0701486,1.00863,.993421,-.0444813,.062953,1.02494,.993928,-.040008,.0560455,1.04017,.994994,-.0347982,.04856,1.05463,.995866,-.0301017,.0416152,1.06807,.996916,-.0248225,.0342597,1.08039,.997766,-.0199229,.0271668,1.09177,.998479,-.0147422,.0201387,1.10235,.99921,-.00980173,.0131944,1.11206,.999652,-.0047426,.00640712,1.12104,.999998,891673e-10,-10379e-8,1.12906,.967868,-351885e-11,.175947,193569e-10,.968001,-886733e-10,.175972,487782e-9,.96801,-354697e-9,.175973,.00195115,.968012,-798063e-9,.175974,.00439006,.968011,-.00141879,.175973,.00780461,.968011,-.00221686,.175973,.0121948,.968016,-.00319231,.175974,.0175607,.968019,-.00434515,.175974,.0239027,.968018,-.00567538,.175974,.0312208,.968033,-.00718308,.175977,.0395158,.968049,-.00886836,.175979,.0487885,.968047,-.0107312,.175978,.0590394,.968072,-.0127719,.175981,.0702705,.968108,-.0149905,.175986,.0824836,.968112,-.0173866,.175985,.0956783,.968173,-.0199611,.175993,.109862,.96827,-.0227128,.176008,.125033,.968292,-.025639,.17601,.141193,.968339,-.0287299,.176007,.158336,.968389,-.0319399,.176001,.176441,.968501,-.034941,.175962,.195359,.968646,-.0370812,.175793,.214686,.968789,-.0402329,.175708,.234973,.96886,-.0442601,.1757,.255871,.969013,-.049398,.175876,.277238,.969242,-.0539932,.17594,.300326,.969419,-.0577299,.175781,.324702,.969763,-.0605643,.175432,.349527,.970093,-.0634488,.174992,.374976,.970361,-.0670589,.174611,.401097,.970825,-.0708246,.174226,.427496,.971214,-.0742871,.173684,.453858,.971622,-.0782608,.173186,.480637,.972175,-.0813151,.172288,.508655,.972944,-.0832678,.170979,.536973,.973595,-.0855964,.169573,.565138,.974345,-.0882163,.168152,.593222,.975233,-.0901671,.166314,.621201,.976239,-.0912111,.163931,.649919,.977289,-.0916959,.161106,.678011,.978076,-.0927061,.158272,.705717,.979533,-.0925562,.15475,.733228,.980335,-.0918159,.150638,.760454,.981808,-.0908508,.146201,.786918,.983061,-.0896172,.141386,.812953,.984148,-.0871588,.135837,.838281,.985047,-.0850624,.130135,.862594,.986219,-.0818541,.123882,.88633,.987043,-.0784523,.117126,.908952,.988107,-.0749601,.110341,.930744,.988955,-.0703548,.102885,.951728,.989426,-.0662798,.0954167,.971166,.990421,-.0610834,.0876331,.989984,.991032,-.0562936,.0797785,1.00765,.992041,-.0508154,.0718166,1.02434,.992794,-.0454045,.0637125,1.03976,.993691,-.0398194,.0555338,1.05418,.994778,-.0341482,.0473388,1.06772,.995915,-.028428,.0391016,1.08028,.997109,-.022642,.0309953,1.09185,.998095,-.0168738,.0230288,1.10247,.998985,-.0111274,.0150722,1.11229,.999581,-.00543881,.00740605,1.12131,1.00003,162239e-9,-105549e-9,1.12946,.959505,-393734e-11,.196876,191893e-10,.959599,-992157e-10,.196895,483544e-9,.959641,-396868e-9,.196903,.0019342,.959599,-892948e-9,.196895,.00435193,.959603,-.00158747,.196896,.0077368,.959604,-.00248042,.196896,.0120888,.959605,-.00357184,.196896,.0174082,.959605,-.00486169,.196896,.0236949,.959613,-.00635008,.196897,.0309497,.959619,-.00803696,.196898,.0391725,.959636,-.00992255,.196901,.0483649,.959634,-.0120067,.1969,.0585266,.959675,-.0142898,.196906,.0696609,.959712,-.0167717,.196911,.0817678,.959752,-.0194524,.196918,.0948494,.959807,-.0223321,.196925,.10891,.959828,-.0254091,.196924,.123947,.959906,-.0286815,.196934,.139968,.960005,-.0321371,.196944,.156968,.960071,-.0357114,.196936,.17491,.960237,-.0389064,.196882,.193597,.960367,-.041623,.196731,.21285,.960562,-.0452655,.196654,.233075,.960735,-.0496207,.196643,.253941,.960913,-.0549379,.196774,.275278,.961121,-.0603414,.196893,.297733,.96139,-.0644244,.196717,.321877,.961818,-.067556,.196314,.346476,.962175,-.0712709,.195917,.371907,.96255,-.0752848,.1955,.397916,.963164,-.0792073,.195026,.424229,.963782,-.0828225,.194424,.450637,.964306,-.0873119,.193831,.477288,.964923,-.0911051,.192973,.504716,.966048,-.093251,.19151,.533053,.967024,-.0958983,.190013,.561366,.968038,-.09835,.188253,.589464,.969152,-.100754,.186257,.617433,.970557,-.102239,.183775,.645801,.972104,-.102767,.180645,.674278,.973203,-.103492,.177242,.702004,.975123,-.103793,.17345,.729529,.97641,-.102839,.168886,.756712,.978313,-.101687,.163892,.783801,.980036,-.100314,.158439,.809671,.981339,-.097836,.152211,.835402,.982794,-.0950006,.145679,.860081,.984123,-.0920994,.138949,.883757,.984918,-.0878641,.131283,.90685,.985999,-.083939,.123464,.928786,.987151,-.0791234,.115324,.94983,.987827,-.0739332,.106854,.96962,.988806,-.0688088,.0982691,.98861,.989588,-.0628962,.0893456,1.00667,.990438,-.0573146,.0805392,1.02344,.991506,-.0509433,.0713725,1.03933,.992492,-.0448724,.0623732,1.05378,.993663,-.0383497,.0530838,1.06747,.994956,-.0319593,.0439512,1.08007,.99634,-.025401,.0347803,1.09182,.99761,-.0189687,.0257954,1.1025,.99863,-.0124441,.0169893,1.11247,.99947,-.00614003,.00829498,1.12151,1.00008,216624e-9,-146107e-9,1.12993,.950129,-434955e-11,.217413,190081e-10,.950264,-10957e-8,.217444,47884e-8,.9503,-438299e-9,.217451,.00191543,.950246,-986124e-9,.21744,.00430951,.950246,-.00175311,.21744,.00766137,.950245,-.00273923,.21744,.011971,.950253,-.00394453,.217441,.0172385,.950258,-.00536897,.217442,.0234641,.950267,-.00701262,.217444,.030648,.950277,-.00887551,.217446,.038791,.950284,-.0109576,.217446,.0478931,.950312,-.0132591,.217451,.0579568,.950334,-.01578,.217454,.0689821,.950378,-.0185204,.217462,.0809714,.950417,-.0214803,.217467,.0939265,.950488,-.0246594,.217479,.10785,.950534,-.0280565,.217483,.122743,.950633,-.0316685,.217498,.138611,.950698,-.0354787,.217499,.155442,.950844,-.0394003,.217507,.173208,.950999,-.0426812,.217419,.191605,.951221,-.0461302,.217317,.21084,.951412,-.0502131,.217238,.230945,.951623,-.0549183,.21722,.251745,.951867,-.0604493,.217306,.273001,.952069,-.0665189,.217466,.294874,.952459,-.0709179,.217266,.318732,.952996,-.0746112,.216891,.34318,.953425,-.0789252,.216503,.36849,.953885,-.0833293,.216042,.394373,.954617,-.087371,.215469,.420505,.955429,-.0914054,.214802,.446907,.956068,-.0961671,.214146,.473522,.957094,-.10048,.213286,.50052,.958372,-.103248,.211796,.528715,.959654,-.106033,.21016,.557065,.961305,-.108384,.208149,.585286,.962785,-.111122,.206024,.613334,.964848,-.112981,.203442,.641334,.966498,-.113717,.19996,.669955,.968678,-.114121,.196105,.698094,.970489,-.114524,.191906,.725643,.972903,-.113792,.186963,.752856,.974701,-.112406,.181343,.780013,.976718,-.110685,.175185,.806268,.978905,-.108468,.168535,.832073,.980267,-.105061,.161106,.857149,.981967,-.101675,.153387,.881145,.983063,-.0974492,.145199,.904255,.984432,-.0925815,.136527,.926686,.985734,-.0877983,.127584,.947901,.986228,-.081884,.118125,.968111,.98719,-.0761208,.108594,.98719,.988228,-.0698196,.0989996,1.00559,.989046,-.0632739,.0890074,1.02246,.990242,-.056522,.0790832,1.03841,.991252,-.0495272,.0689182,1.05347,.992542,-.0425373,.0588592,1.06724,.994096,-.0353198,.0486833,1.08009,.995593,-.028235,.0385977,1.09177,.99711,-.0209511,.0286457,1.10274,.998263,-.0139289,.0188497,1.11262,.999254,-.0067359,.009208,1.12191,.999967,141846e-9,-657764e-10,1.13024,.935608,-474692e-11,.236466,187817e-10,.93996,-11971e-8,.237568,473646e-9,.939959,-478845e-9,.237567,.0018946,.939954,-.0010774,.237566,.00426284,.939956,-.00191538,.237566,.00757842,.939954,-.00299277,.237566,.0118413,.93996,-.00430961,.237567,.0170518,.939969,-.00586589,.237569,.02321,.939982,-.00766166,.237572,.0303164,.939987,-.00969686,.237572,.0383711,.939997,-.0119715,.237574,.0473751,.940031,-.0144858,.237581,.0573298,.940073,-.0172399,.237589,.0682366,.94012,-.0202335,.237598,.080097,.940162,-.0234663,.237604,.0929116,.940237,-.0269387,.237615,.106686,.940328,-.0306489,.237632,.121421,.940419,-.0345917,.237645,.137115,.940522,-.0387481,.237654,.153766,.940702,-.0429906,.237661,.17133,.940871,-.0465089,.237561,.189502,.941103,-.050531,.23748,.208616,.941369,-.0550657,.237423,.228595,.941641,-.0601337,.237399,.249287,.941903,-.0658804,.237443,.270467,.942224,-.0722674,.237597,.292024,.942633,-.0771788,.237419,.315272,.943172,-.0815623,.237068,.339579,.943691,-.0863973,.236682,.364717,.944382,-.0911536,.236213,.390435,.945392,-.0952967,.235562,.416425,.946185,-.0998948,.234832,.442772,.947212,-.104796,.234114,.469347,.948778,-.10928,.233222,.496162,.950149,-.113081,.231845,.523978,.951989,-.115893,.230005,.552295,.953921,-.11846,.227862,.580569,.955624,-.12115,.225439,.608698,.958234,-.123373,.222635,.636696,.960593,-.124519,.219093,.665208,.963201,-.124736,.214749,.693557,.965642,-.125012,.210059,.721334,.968765,-.124661,.204935,.748613,.971753,-.122996,.198661,.776224,.973751,-.120998,.191823,.802461,.976709,-.118583,.184359,.828399,.977956,-.115102,.176437,.853693,.979672,-.111077,.167681,.877962,.981816,-.10688,.158872,.901564,.98238,-.101469,.149398,.924057,.983964,-.0960013,.139436,.945751,.984933,-.0899626,.12943,.966272,.985694,-.0832973,.11894,.985741,.986822,-.0767082,.108349,1.00407,.987725,-.0693614,.0976026,1.02154,.98877,-.06211,.086652,1.03757,.990129,-.0544143,.0756182,1.05296,.991337,-.046744,.0645753,1.06683,.992978,-.0387931,.0534683,1.0798,.994676,-.030973,.0424137,1.09181,.99645,-.0230311,.0314035,1.10286,.997967,-.0152065,.0206869,1.11291,.99922,-.00744837,.010155,1.12237,1.00002,240209e-9,-752767e-10,1.13089,.922948,-515351e-11,.255626,186069e-10,.928785,-129623e-9,.257244,468009e-9,.928761,-51849e-8,.257237,.00187202,.928751,-.0011666,.257235,.00421204,.928751,-.00207395,.257234,.0074881,.928754,-.00324055,.257235,.0117002,.92876,-.00466639,.257236,.0168486,.928763,-.00635149,.257237,.0229334,.928774,-.00829584,.257239,.029955,.928791,-.0104995,.257243,.0379139,.928804,-.0129623,.257245,.0468108,.928847,-.0156846,.257255,.0566473,.92889,-.0186661,.257263,.0674246,.928924,-.0219067,.257268,.0791433,.928989,-.0254066,.257282,.0918076,.92909,-.0291651,.257301,.105419,.92918,-.0331801,.257316,.119978,.92929,-.0374469,.257332,.135491,.929453,-.041939,.257357,.151948,.929586,-.0464612,.257347,.169275,.929858,-.0503426,.257269,.187257,.930125,-.0548409,.257199,.206204,.930403,-.0598063,.257149,.22601,.930726,-.0652437,.257122,.246561,.931098,-.0712376,.257153,.267618,.931396,-.0777506,.257237,.288993,.931947,-.0832374,.257124,.311527,.932579,-.0883955,.25683,.335697,.933194,-.0937037,.256444,.360634,.934013,-.0987292,.255939,.386126,.935307,-.103215,.255282,.412018,.936374,-.108234,.254538,.438292,.93776,-.113234,.253728,.464805,.939599,-.118013,.25275,.491464,.941036,-.122661,.251404,.518751,.94337,-.125477,.249435,.547133,.945318,-.128374,.247113,.575456,.947995,-.130996,.244441,.60372,.950818,-.133438,.241352,.63174,.954378,-.135004,.237849,.659971,.957151,-.135313,.233188,.688478,.960743,-.13521,.228001,.716767,.964352,-.135007,.222249,.744349,.967273,-.133523,.21542,.771786,.969767,-.131155,.208039,.798639,.973195,-.128492,.200076,.824774,.975557,-.125094,.191451,.850222,.977692,-.120578,.18184,.874761,.98026,-.115882,.172102,.898497,.981394,-.110372,.161859,.921636,.982386,-.10415,.15108,.943467,.983783,-.0978128,.140407,.964045,.98422,-.0906171,.129058,.98398,.985447,-.0832921,.117614,1.00276,.986682,-.0754412,.10585,1.02047,.987326,-.0673885,.0940943,1.03678,.988707,-.0592565,.0822093,1.05218,.990185,-.050717,.070192,1.06652,.991866,-.0423486,.0582081,1.07965,.993897,-.0336118,.0460985,1.09188,.995841,-.0252178,.0342737,1.10307,.997605,-.0164893,.0224829,1.11324,.999037,-.00817112,.0110647,1.12262,1.00003,291686e-9,-168673e-9,1.13139,.915304,-552675e-11,.275999,183285e-10,.91668,-139285e-9,.276414,461914e-9,.916664,-55713e-8,.276409,.00184763,.916653,-.00125354,.276406,.00415715,.916651,-.00222851,.276405,.00739053,.916655,-.00348205,.276406,.0115478,.916653,-.00501414,.276405,.0166291,.916667,-.00682478,.276409,.0226346,.91668,-.00891398,.276412,.0295648,.91669,-.0112817,.276413,.0374199,.916727,-.013928,.276422,.0462016,.916759,-.0168528,.276429,.0559101,.916793,-.0200558,.276436,.0665466,.916849,-.0235373,.276448,.0781139,.916964,-.0272973,.276474,.0906156,.917047,-.0313344,.276491,.104051,.917152,-.0356465,.276511,.118424,.917286,-.0402271,.276533,.133736,.917469,-.0450408,.276564,.149978,.917686,-.0497872,.276563,.167057,.917953,-.0540937,.276493,.184846,.918228,-.0590709,.276437,.203614,.918572,-.0644277,.276398,.223212,.918918,-.0702326,.276362,.243584,.919356,-.076484,.276383,.264465,.919842,-.0830808,.276434,.285701,.920451,-.0892972,.276407,.307559,.921113,-.095016,.276128,.331501,.921881,-.100771,.275754,.356207,.923027,-.106029,.275254,.381477,.924364,-.111029,.274595,.40722,.925818,-.116345,.273841,.433385,.92746,-.121424,.272913,.459848,.929167,-.12657,.271837,.486493,.931426,-.131581,.270575,.513432,.934001,-.135038,.268512,.541502,.936296,-.138039,.266135,.569658,.939985,-.140687,.263271,.598375,.943516,-.143247,.260058,.626563,.94782,-.145135,.256138,.654711,.951023,-.145733,.251154,.683285,.955338,-.145554,.245562,.711831,.959629,-.145008,.239265,.739573,.963123,-.144003,.232064,.767027,.966742,-.141289,.224036,.794359,.969991,-.138247,.215305,.820361,.973403,-.134786,.206051,.846548,.975317,-.129966,.195914,.871541,.977647,-.12471,.185184,.895313,.980137,-.119086,.174161,.918398,.981031,-.112297,.162792,.940679,.982037,-.105372,.150952,.961991,.983164,-.097821,.138921,.981913,.983757,-.0897245,.126611,1.00109,.985036,-.0815974,.114228,1.01902,.986289,-.0727725,.101389,1.03604,.987329,-.0639323,.0886476,1.05149,.989193,-.0548109,.0756837,1.06619,.990716,-.045687,.0627581,1.07948,.992769,-.0364315,.0498337,1.09172,.99524,-.0271761,.0370305,1.1033,.997154,-.0179609,.0243959,1.11353,.998845,-.00878063,.0119567,1.12319,1.00002,259038e-9,-108146e-9,1.13177,.903945,-591681e-11,.295126,181226e-10,.903668,-148672e-9,.295037,455367e-9,.903677,-594683e-9,.29504,.00182145,.903673,-.00133805,.295039,.00409831,.903666,-.00237872,.295036,.00728584,.903668,-.00371676,.295037,.0113842,.903679,-.00535212,.29504,.0163936,.903684,-.00728479,.295041,.0223141,.903698,-.00951473,.295044,.0291462,.903718,-.0120419,.295049,.0368904,.903754,-.0148664,.295058,.0455477,.903801,-.017988,.29507,.0551194,.903851,-.0214064,.295082,.0656058,.903921,-.0251219,.295097,.0770109,.904002,-.0291337,.295116,.0893354,.904111,-.033441,.29514,.102583,.904246,-.0380415,.295169,.116755,.904408,-.0429258,.295202,.131853,.904637,-.0480468,.295245,.147869,.904821,-.0529208,.295214,.164658,.905163,-.0577748,.295185,.182274,.905469,-.0631763,.295143,.200828,.905851,-.068917,.295112,.2202,.906322,-.0750861,.295104,.240372,.906761,-.0815855,.295086,.261082,.90735,-.0882138,.295095,.282123,.908087,-.095082,.295139,.303563,.908826,-.101488,.29492,.327028,.909832,-.107577,.294577,.351464,.911393,-.113033,.294115,.376497,.912804,-.118629,.293446,.402115,.914081,-.124232,.292581,.428111,.91637,-.129399,.29166,.454442,.91814,-.134892,.290422,.481024,.921179,-.140069,.289194,.507924,.924544,-.144431,.287421,.535557,.927995,-.147498,.284867,.563984,.931556,-.150197,.281722,.5923,.935777,-.152711,.278207,.620832,.940869,-.154836,.274148,.649069,.945994,-.155912,.269057,.677746,.949634,-.155641,.262799,.706293,.955032,-.154809,.256097,.734278,.95917,-.153678,.248618,.761751,.962931,-.151253,.239794,.789032,.966045,-.147625,.230281,.815422,.96971,-.143964,.220382,.841787,.972747,-.139464,.209846,.867446,.975545,-.133459,.198189,.892004,.978381,-.127424,.186362,.915458,.979935,-.120506,.173964,.937948,.980948,-.11282,.161429,.959732,.982234,-.104941,.148557,.980118,.982767,-.0962905,.135508,.999463,.983544,-.0873625,.122338,1.01756,.984965,-.0783447,.108669,1.03492,.986233,-.0684798,.0949911,1.05087,.987796,-.0590867,.0811386,1.0656,.989885,-.0489145,.0673099,1.0794,.991821,-.0391,.0535665,1.09174,.99448,-.029087,.0397529,1.10341,.996769,-.019114,.0261463,1.11383,.998641,-.00947007,.0128731,1.1237,.999978,446316e-9,-169093e-9,1.13253,.888362,-627064e-11,.312578,178215e-10,.889988,-157791e-9,.313148,448451e-9,.889825,-631076e-9,.313092,.00179356,.88984,-.00141994,.313097,.00403554,.889828,-.0025243,.313092,.00717429,.889831,-.00394421,.313093,.0112099,.889831,-.00567962,.313093,.0161425,.889844,-.00773051,.313096,.0219724,.889858,-.0100968,.3131,.0286999,.889882,-.0127786,.313106,.0363256,.889918,-.0157757,.313116,.0448509,.889967,-.0190878,.313129,.0542758,.89003,-.022715,.313145,.0646032,.890108,-.0266566,.313165,.0758339,.890218,-.0309131,.313193,.0879729,.890351,-.0354819,.313226,.101019,.89051,-.0403613,.313263,.114979,.890672,-.0455385,.313294,.129848,.890882,-.0509444,.313333,.145616,.891189,-.0559657,.313324,.162122,.891457,-.0613123,.313281,.179524,.891856,-.0671488,.313281,.197855,.892312,-.0732732,.313268,.216991,.892819,-.0797865,.313263,.236924,.893369,-.0865269,.313247,.257433,.894045,-.0931592,.313205,.278215,.894884,-.100532,.313276,.299467,.895832,-.107716,.313205,.322276,.897043,-.114099,.312873,.34642,.898515,-.119941,.312331,.371187,.900191,-.126044,.311731,.396656,.90188,-.131808,.310859,.422488,.904359,-.137289,.309857,.448744,.906923,-.142991,.308714,.475239,.910634,-.148253,.307465,.501983,.914502,-.153332,.305774,.529254,.919046,-.156646,.303156,.557709,.923194,-.159612,.299928,.586267,.928858,-.162027,.296245,.614925,.934464,-.164203,.291832,.643187,.939824,-.165602,.286565,.671601,.944582,-.165383,.280073,.700213,.949257,-.164439,.272891,.728432,.954389,-.162953,.264771,.756082,.958595,-.161007,.255927,.78369,.962138,-.157243,.245769,.810769,.966979,-.152872,.235127,.836999,.969566,-.148209,.22347,.862684,.972372,-.142211,.211147,.887847,.975916,-.135458,.198606,.911843,.978026,-.128398,.185498,.934795,.979686,-.120313,.17171,.956787,.980748,-.11166,.158159,.978046,.981622,-.103035,.144399,.997693,.982356,-.0930328,.13001,1.01642,.983308,-.0834627,.115778,1.03366,.985037,-.0732249,.101327,1.05014,.986493,-.0628145,.086554,1.06507,.988484,-.0526556,.0720413,1.07907,.991051,-.0415744,.0571151,1.09189,.993523,-.0314275,.0426643,1.10369,.99628,-.0203603,.0279325,1.11423,.998344,-.0102446,.0138182,1.12421,.999997,42612e-8,-193628e-9,1.1333,.871555,-660007e-11,.329176,174749e-10,.875255,-166579e-9,.330571,441051e-9,.875644,-666394e-9,.330718,.00176441,.875159,-.00149903,.330536,.00396899,.87516,-.00266493,.330536,.007056,.875158,-.00416393,.330535,.0110251,.87516,-.00599598,.330535,.0158764,.875163,-.00816108,.330536,.0216101,.875174,-.0106591,.330538,.0282266,.875199,-.0134899,.330545,.0357266,.875257,-.0166538,.330563,.0441117,.875304,-.0201501,.330575,.0533821,.875373,-.0239785,.330595,.0635395,.875464,-.0281389,.330619,.0745872,.875565,-.0326301,.330645,.0865255,.875691,-.0374516,.330676,.0993599,.875897,-.0425993,.330733,.113093,.876091,-.0480576,.330776,.127722,.876353,-.0537216,.330826,.143227,.876649,-.0589807,.330809,.159462,.877034,-.0647865,.330819,.176642,.877443,-.0709789,.330817,.194702,.877956,-.0774782,.330832,.213577,.878499,-.0843175,.330822,.233246,.879144,-.0912714,.330804,.253512,.879982,-.0980824,.330766,.274137,.88097,-.105823,.330864,.295209,.882051,-.113671,.330896,.317226,.883397,-.120303,.330545,.341068,.884987,-.12667,.330068,.365613,.886789,-.133118,.329418,.390807,.889311,-.139024,.328683,.416494,.891995,-.144971,.327729,.442618,.895106,-.150747,.326521,.469131,.899527,-.156283,.325229,.495921,.90504,-.161707,.32378,.523162,.909875,-.165661,.32122,.55092,.91561,-.168755,.317942,.579928,.921225,-.171193,.313983,.608539,.927308,-.17319,.309636,.636854,.933077,-.174819,.304262,.66523,.938766,-.175002,.297563,.693609,.943667,-.173946,.289613,.722157,.949033,-.172221,.281227,.750021,.953765,-.169869,.271545,.777466,.95804,-.166578,.261034,.804853,.962302,-.161761,.249434,.831569,.966544,-.156636,.237484,.857779,.969372,-.150784,.224395,.883051,.972486,-.143672,.210786,.907864,.975853,-.135772,.196556,.931223,.977975,-.127942,.182307,.954061,.979122,-.118347,.167607,.97531,.980719,-.109112,.152739,.995666,.981223,-.0991789,.137932,1.01475,.98216,-.0883553,.122692,1.03253,.983379,-.0780825,.107493,1.04917,.985434,-.0665646,.0917791,1.06464,.987332,-.0557714,.0764949,1.07896,.990004,-.0442805,.060721,1.09199,.992975,-.0331676,.0452284,1.10393,.995811,-.0219547,.0297934,1.11476,.9982,-.0107613,.0146415,1.12484,1.00002,248678e-9,-14555e-8,1.13413,.859519,-693595e-11,.347264,171673e-10,.859843,-17503e-8,.347394,433219e-9,.859656,-700076e-9,.347319,.00173277,.859671,-.00157517,.347325,.00389875,.859669,-.00280028,.347324,.00693112,.85967,-.0043754,.347324,.01083,.859665,-.00630049,.347321,.0155954,.859685,-.0085755,.347328,.0212278,.859694,-.0112003,.347329,.0277273,.859718,-.0141747,.347336,.0350946,.85976,-.0174988,.347348,.0433314,.85982,-.0211722,.347366,.0524384,.859892,-.0251941,.347387,.0624168,.860006,-.0295649,.347422,.0732708,.860122,-.0342825,.347453,.0849999,.860282,-.0393462,.347499,.0976102,.860482,-.0447513,.347554,.111104,.860719,-.0504775,.347614,.125479,.860998,-.0563577,.347666,.140703,.861322,-.0619473,.347662,.156681,.861724,-.0681277,.347684,.173597,.862198,-.0746567,.347709,.191371,.862733,-.0815234,.347727,.209976,.863371,-.0886643,.347744,.229351,.86414,-.0957908,.347734,.24934,.865138,-.102912,.34772,.269797,.866182,-.110924,.3478,.290654,.867436,-.119223,.347911,.312074,.869087,-.126197,.347649,.335438,.870859,-.133145,.347222,.359732,.872997,-.139869,.346645,.38467,.875939,-.146089,.345935,.41019,.879012,-.152334,.345012,.436218,.883353,-.15821,.343924,.462641,.888362,-.164097,.342636,.489449,.895026,-.169528,.341351,.516629,.900753,-.174408,.339115,.544109,.906814,-.17751,.335809,.572857,.912855,-.180101,.331597,.601554,.919438,-.182116,.32698,.630198,.925962,-.183494,.321449,.658404,.931734,-.184159,.314595,.686625,.93762,-.18304,.306462,.71531,.943858,-.181323,.297514,.744272,.948662,-.178683,.287447,.771462,.953299,-.175379,.276166,.798593,.957346,-.170395,.263758,.8256,.962565,-.165042,.251019,.852575,.966075,-.158655,.237011,.878316,.969048,-.151707,.222518,.90329,.972423,-.143271,.207848,.927745,.975833,-.134824,.192463,.950859,.977629,-.125444,.1768,.972947,.978995,-.114949,.161033,.993263,.980533,-.104936,.145523,1.01337,.980745,-.0935577,.129799,1.03128,.981814,-.0822956,.113486,1.04825,.983943,-.0710082,.0972925,1.06405,.986141,-.0587931,.0808138,1.0785,.988878,-.0472755,.0644915,1.09204,.992132,-.0349128,.0478128,1.10413,.9953,-.0232407,.031621,1.11527,.998117,-.0112713,.0154935,1.12551,1.00003,339743e-9,-195763e-9,1.13504,.845441,-729126e-11,.364305,169208e-10,.843588,-183164e-9,.363506,425067e-9,.843412,-73253e-8,.36343,.00169999,.843401,-.00164818,.363426,.00382495,.843399,-.00293008,.363425,.00679993,.843401,-.00457822,.363425,.010625,.843394,-.00659249,.363421,.0153002,.843398,-.00897282,.363421,.0208258,.843415,-.0117191,.363426,.0272024,.843438,-.0148312,.363432,.0344305,.843483,-.018309,.363447,.0425116,.84356,-.0221521,.363472,.0514471,.843646,-.0263597,.363499,.061238,.843743,-.0309315,.363527,.0718873,.84388,-.0358658,.363569,.0833969,.844079,-.0411624,.363631,.0957742,.844279,-.0468128,.363688,.109015,.844549,-.0527923,.363761,.123124,.844858,-.0588204,.363817,.138044,.84522,-.0647573,.36383,.153755,.845669,-.0713181,.363879,.170394,.846155,-.0781697,.363908,.187861,.846789,-.0853913,.363969,.206176,.847502,-.0928086,.363999,.225244,.8484,-.10005,.363997,.244926,.849461,-.107615,.364008,.265188,.850562,-.115814,.364055,.28587,.851962,-.124334,.364179,.306926,.854326,-.131995,.364233,.329605,.856295,-.139338,.363856,.35359,.858857,-.146346,.363347,.37831,.862428,-.152994,.362807,.403722,.866203,-.159463,.361963,.429537,.871629,-.165623,.36112,.456,.877365,-.171649,.359917,.482773,.883744,-.177151,.35848,.509705,.890693,-.182381,.356523,.537215,.897278,-.186076,.3533,.565493,.903958,-.188602,.349095,.594293,.910908,-.190755,.344215,.623165,.918117,-.192063,.338606,.651573,.924644,-.192758,.331544,.679869,.931054,-.192238,.323163,.708668,.937303,-.190035,.313529,.737201,.943387,-.187162,.303152,.764977,.948494,-.183876,.29146,.792683,.952546,-.178901,.277917,.819228,.958077,-.173173,.264753,.846559,.962462,-.16645,.25002,.872962,.966569,-.159452,.234873,.898729,.969108,-.15074,.218752,.923126,.973072,-.141523,.202673,.947278,.975452,-.132075,.186326,.969938,.977784,-.121257,.169396,.991325,.97899,-.110182,.153044,1.01123,.979777,-.0989634,.136485,1.0299,.980865,-.0865894,.119343,1.04727,.982432,-.0746115,.102452,1.06341,.984935,-.0621822,.0852423,1.07834,.987776,-.0495694,.0678546,1.092,.99103,-.0372386,.0506917,1.1043,.99474,-.0244353,.0333316,1.11576,.997768,-.0121448,.0164348,1.12617,1.00003,31774e-8,-169504e-9,1.13598,.825551,-756799e-11,.378425,165099e-10,.82664,-190922e-9,.378923,416504e-9,.826323,-763495e-9,.378779,.0016656,.826359,-.00171789,.378795,.00374768,.82636,-.00305402,.378795,.00666259,.826368,-.00477185,.378798,.0104104,.826364,-.00687131,.378795,.0149912,.826368,-.00935232,.378795,.0204054,.826376,-.0122146,.378797,.0266532,.826399,-.0154581,.378803,.0337355,.82646,-.0190825,.378824,.0416537,.826525,-.0230873,.378846,.0504091,.826614,-.0274719,.378876,.0600032,.82674,-.0322355,.378917,.0704393,.826888,-.0373766,.378964,.0817195,.827078,-.0428936,.379024,.0938492,.827318,-.0487778,.379099,.106828,.82764,-.0549935,.379199,.120659,.827926,-.0611058,.379227,.13526,.828325,-.0675054,.379275,.150713,.828801,-.0743455,.379332,.167034,.8294,-.0815523,.379415,.184209,.830094,-.0890779,.379495,.202203,.8309,-.096736,.379555,.220945,.831943,-.104135,.379577,.240306,.833037,-.112106,.379604,.260317,.834278,-.120554,.379668,.2808,.836192,-.129128,.3799,.301654,.838671,-.137541,.380109,.323502,.840939,-.14523,.379809,.347176,.844575,-.15248,.379593,.371706,.848379,-.159607,.37909,.39688,.853616,-.166267,.378617,.422702,.858921,-.172698,.377746,.448919,.865324,-.178823,.376749,.475661,.872207,-.184542,.375363,.502599,.880018,-.189836,.373657,.529914,.88694,-.194294,.370673,.557683,.894779,-.197022,.36662,.586848,.902242,-.199108,.36138,.615831,.909914,-.200398,.355434,.644478,.917088,-.20094,.348173,.672905,.923888,-.200671,.339482,.701327,.930495,-.198773,.32956,.730101,.937247,-.195394,.318363,.758383,.943108,-.191956,.306323,.786539,.948296,-.187227,.292576,.813637,.953472,-.181165,.278234,.840793,.958485,-.174119,.263054,.867712,.962714,-.166564,.246756,.893635,.966185,-.158181,.229945,.919028,.970146,-.148275,.212633,.943413,.973491,-.138157,.195229,.966627,.975741,-.127574,.178048,.988817,.977238,-.11554,.160312,1.00924,.978411,-.10364,.142857,1.02845,.979811,-.0913122,.125317,1.04648,.98116,-.0782558,.107627,1.06284,.983543,-.0655957,.0895862,1.07798,.986789,-.0520411,.0713756,1.092,.990292,-.0389727,.053228,1.10484,.994187,-.025808,.0351945,1.11642,.997499,-.0126071,.0173198,1.12703,.999999,275604e-9,-148602e-9,1.13674,.81075,-78735e-10,.394456,161829e-10,.808692,-198293e-9,.393453,407564e-9,.80846,-792877e-9,.39334,.00162965,.808595,-.00178416,.393407,.00366711,.808597,-.00317182,.393408,.00651934,.808598,-.00495589,.393408,.0101866,.808591,-.00713627,.393403,.0146689,.808592,-.00971285,.393402,.0199667,.80861,-.0126855,.393407,.0260803,.808633,-.0160538,.393413,.0330107,.80868,-.0198175,.393429,.0407589,.808748,-.0239758,.393453,.0493264,.808854,-.0285286,.39349,.0587161,.808992,-.0334748,.39354,.0689304,.809141,-.0388116,.393588,.0799707,.809352,-.0445375,.39366,.0918432,.809608,-.0506427,.393742,.104549,.809915,-.0570708,.393834,.118085,.810253,-.0633526,.393885,.132377,.810687,-.0700966,.393953,.147537,.811233,-.0772274,.394047,.163543,.811865,-.0847629,.394148,.180394,.812648,-.0925663,.394265,.198051,.813583,-.100416,.394363,.216443,.814683,-.108119,.394402,.235502,.815948,-.11644,.394489,.255242,.817278,-.125036,.394542,.275441,.819605,-.133655,.39486,.296094,.822256,-.142682,.395248,.317309,.825349,-.150756,.395241,.340516,.829605,-.158392,.395285,.364819,.83391,-.165801,.394922,.389736,.839808,-.172677,.394691,.415409,.845708,-.179448,.394006,.441546,.853025,-.185746,.393279,.46832,.859666,-.191684,.391655,.495302,.86789,-.197146,.390068,.52262,.875845,-.201904,.38727,.550336,.882634,-.205023,.382688,.578825,.891076,-.207098,.377543,.608103,.900589,-.208474,.371752,.63723,.90791,-.209068,.364016,.665769,.915971,-.208655,.355593,.694428,.923455,-.20729,.345439,.723224,.931514,-.203821,.334099,.751925,.937885,-.19986,.321069,.780249,.943136,-.194993,.306571,.8077,.948818,-.189132,.291556,.83497,.954433,-.181617,.275745,.86188,.959078,-.173595,.258695,.888562,.962705,-.164855,.240825,.914008,.966753,-.155129,.22268,.939145,.970704,-.144241,.204542,.963393,.973367,-.133188,.185927,.985983,.975984,-.121146,.167743,1.00704,.976994,-.108366,.149218,1.02715,.978485,-.0956746,.13131,1.0455,.980074,-.0820733,.112513,1.06221,.98225,-.0684061,.0938323,1.07782,.98553,-.0549503,.0749508,1.09199,.989529,-.0407857,.055848,1.10508,.993536,-.0271978,.0368581,1.11684,.997247,-.0132716,.0181845,1.12789,1,431817e-9,-198809e-9,1.13792,.785886,-812608e-11,.405036,157669e-10,.790388,-205278e-9,.407355,398297e-9,.790145,-820824e-9,.407231,.00159263,.790135,-.00184681,.407226,.00358336,.790119,-.00328316,.407218,.00637039,.790126,-.00512988,.40722,.0099539,.79013,-.00738684,.407221,.0143339,.790135,-.0100538,.407221,.0195107,.790134,-.0131306,.407217,.0254848,.79016,-.0166169,.407224,.0322572,.790197,-.020512,.407236,.0398284,.790273,-.0248157,.407263,.0482014,.790381,-.029527,.407304,.0573777,.790521,-.0346446,.407355,.0673602,.790704,-.0401665,.40742,.0781522,.790925,-.0460896,.407499,.0897582,.791195,-.0524017,.407589,.10218,.791522,-.0590121,.407691,.11541,.791878,-.0654876,.407748,.12939,.792361,-.0725207,.407849,.144237,.792942,-.0799844,.407963,.159924,.79362,-.0877896,.408087,.176425,.794529,-.0958451,.408259,.193733,.795521,-.103827,.408362,.211756,.796778,-.111937,.408482,.230524,.798027,-.120521,.408547,.249967,.799813,-.129242,.408721,.269926,.802387,-.138048,.409148,.290338,.805279,-.147301,.409641,.311193,.809251,-.155895,.410154,.333611,.813733,-.163942,.410297,.357615,.819081,-.171666,.410373,.382339,.825427,-.178905,.410348,.407828,.83172,-.185812,.409486,.434034,.83877,-.192318,.408776,.460493,.845817,-.198249,.407176,.487346,.854664,-.204034,.405719,.514832,.863495,-.208908,.403282,.542401,.871883,-.212765,.399293,.570683,.88065,-.214911,.393803,.599947,.89004,-.216214,.387536,.62932,.898476,-.216745,.379846,.658319,.906738,-.216387,.370625,.687138,.914844,-.215053,.360139,.71601,.923877,-.212007,.348849,.745124,.931925,-.207481,.335639,.773366,.938054,-.202418,.320798,.801636,.943895,-.196507,.304772,.829055,.949468,-.189009,.288033,.856097,.955152,-.180539,.270532,.88301,.959403,-.171437,.251639,.909296,.963309,-.161661,.232563,.934868,.967399,-.150425,.213231,.959662,.972009,-.138659,.194247,.98302,.97433,-.126595,.174718,1.00517,.975823,-.113205,.155518,1.02566,.976371,-.0996096,.136709,1.04418,.978705,-.0860754,.117571,1.06146,.981477,-.0714438,.0980046,1.07777,.984263,-.0572304,.0782181,1.09214,.988423,-.0428875,.0584052,1.10553,.993,-.0282442,.038522,1.11758,.99704,-.0140183,.0190148,1.12864,.999913,369494e-9,-145203e-9,1.13901,.777662,-84153e-10,.423844,154403e-10,.770458,-211714e-9,.419915,38845e-8,.770716,-846888e-9,.420055,.00155386,.770982,-.00190567,.420202,.00349653,.770981,-.00338782,.420201,.00621606,.77098,-.00529338,.4202,.00971274,.770983,-.00762223,.4202,.0139867,.770985,-.0103741,.420198,.0190381,.770996,-.0135489,.4202,.0248677,.771029,-.0171461,.420212,.0314764,.771052,-.0211647,.420215,.0388648,.771131,-.0256048,.420245,.047036,.771235,-.0304647,.420284,.0559911,.771383,-.0357436,.420341,.0657346,.771591,-.0414392,.420423,.0762694,.771819,-.0475462,.420506,.0875984,.772123,-.0540506,.420617,.099727,.772464,-.060797,.42072,.112637,.772855,-.0675393,.420799,.126313,.773317,-.0748323,.420893,.140824,.773981,-.0825681,.421058,.15617,.774746,-.0906307,.421226,.172322,.77566,-.0988982,.421397,.189253,.776837,-.106994,.421569,.206912,.778097,-.115528,.421704,.225359,.779588,-.124317,.421849,.24447,.781574,-.133139,.422097,.264156,.784451,-.142179,.422615,.284318,.787682,-.15165,.423269,.304902,.792433,-.160771,.424396,.3265,.797359,-.169166,.424772,.35014,.803986,-.177149,.425475,.374768,.809504,-.184745,.424996,.399928,.815885,-.19173,.424247,.425796,.823513,-.198525,.423515,.452287,.832549,-.204709,.422787,.479321,.841653,-.210447,.421187,.506718,.850401,-.215501,.418519,.53432,.859854,-.219752,.414715,.56242,.869364,-.222305,.409462,.591558,.878837,-.223744,.402926,.621074,.888636,-.224065,.395043,.650538,.898132,-.223742,.38564,.679538,.907181,-.222308,.375378,.708674,.915621,-.219837,.363212,.737714,.9239,-.215233,.349313,.767014,.931644,-.209592,.334162,.795133,.938887,-.203644,.317943,.823228,.945282,-.196349,.300581,.850822,.950758,-.18742,.282195,.877594,.956146,-.177879,.262481,.904564,.960355,-.167643,.242487,.930741,.965256,-.156671,.222668,.955868,.968029,-.144123,.201907,.979869,.97251,-.131305,.18202,1.00291,.974925,-.118335,.161909,1.02392,.975402,-.103714,.142129,1.0433,.976987,-.089415,.122447,1.06089,.979677,-.0748858,.102248,1.07713,.983184,-.0596086,.0814851,1.09218,.987466,-.0447671,.0609484,1.10585,.992348,-.0295217,.0401835,1.11829,.996674,-.0143917,.0198163,1.12966,1.00003,321364e-9,-149983e-9,1.1402,.757901,-869074e-11,.436176,151011e-10,.751195,-217848e-9,.432317,378533e-9,.751178,-871373e-9,.432307,.0015141,.751195,-.00196061,.432317,.0034068,.751198,-.00348552,.432318,.00605659,.751195,-.00544599,.432315,.00946353,.751207,-.00784203,.43232,.013628,.751213,-.0106732,.43232,.0185499,.751221,-.0139393,.432319,.0242302,.751244,-.0176398,.432325,.0306694,.7513,-.0217743,.432348,.0378698,.751358,-.0263412,.432367,.0458321,.751458,-.0313396,.432404,.0545587,.751608,-.0367682,.432464,.0640543,.7518,-.0426246,.43254,.0743222,.752065,-.0489031,.432645,.0853668,.752376,-.0555828,.432762,.0971911,.752715,-.0623861,.432859,.109768,.753137,-.069415,.432958,.123126,.753676,-.0770039,.433099,.137308,.754345,-.084971,.433272,.15229,.755235,-.0932681,.433504,.168075,.756186,-.10171,.433693,.184625,.757363,-.110019,.433857,.201897,.75884,-.11887,.434102,.220014,.760467,-.127881,.434306,.238778,.762969,-.136766,.434751,.258172,.765823,-.14612,.43529,.278062,.769676,-.15566,.436236,.298437,.774909,-.165177,.437754,.319532,.77994,-.17402,.438343,.342505,.785757,-.182201,.438609,.366693,.792487,-.190104,.438762,.391668,.80038,-.197438,.438795,.417494,.808494,-.204365,.438226,.443933,.817695,-.210714,.437283,.470929,.828111,-.216651,.436087,.498569,.837901,-.221804,.433717,.526165,.847813,-.226318,.430133,.554155,.858314,-.229297,.425213,.582822,.868891,-.230999,.418576,.612847,.878941,-.231155,.410405,.642445,.888809,-.230935,.400544,.672024,.898089,-.229343,.389613,.701366,.908081,-.226886,.377197,.730763,.916819,-.222676,.363397,.759642,.924968,-.216835,.347437,.788775,.932906,-.210245,.32995,.817135,.940025,-.202992,.312262,.844912,.946101,-.19436,.293313,.872164,.952835,-.184125,.273638,.899443,.957347,-.173657,.252385,.926389,.961434,-.162204,.231038,.951947,.965522,-.14979,.209834,.976751,.969412,-.136307,.188821,1.00022,.973902,-.122527,.168013,1.02229,.974045,-.108213,.147634,1.04199,.975775,-.0927397,.12705,1.06019,.978383,-.0778212,.106309,1.07711,.98211,-.0621216,.0849279,1.09245,.986517,-.0463847,.0633519,1.10651,.991696,-.0309353,.0419698,1.11903,.996349,-.0150914,.0206272,1.13073,1.00003,442449e-9,-231396e-9,1.14146,.727498,-885074e-11,.441528,145832e-10,.730897,-223525e-9,.443589,368298e-9,.730796,-893996e-9,.443528,.00147303,.730805,-.00201149,.443533,.00331433,.730814,-.00357596,.443538,.00589222,.730815,-.00558734,.443538,.00920678,.730822,-.00804544,.44354,.0132582,.730836,-.0109501,.443545,.0180468,.730848,-.0143008,.443546,.0235732,.730871,-.0180969,.443552,.0298382,.730915,-.022338,.443567,.0368438,.730982,-.0270225,.443591,.044591,.731076,-.0321491,.443627,.0530831,.731245,-.0377166,.443699,.0623243,.73144,-.0437216,.443777,.0723181,.7317,-.0501576,.443881,.0830691,.732034,-.0569942,.444014,.0945809,.732388,-.0638756,.444113,.106825,.732853,-.071203,.444247,.119859,.733473,-.0790076,.444442,.13369,.734195,-.0871937,.444645,.148304,.735069,-.095696,.444877,.163702,.736169,-.10426,.445133,.179861,.73747,-.112853,.44537,.196778,.738991,-.12199,.445651,.214496,.740865,-.131153,.445958,.232913,.743637,-.140245,.446548,.251977,.746797,-.149722,.447246,.271551,.751517,-.159341,.448656,.291774,.756156,-.169106,.449866,.312455,.761519,-.178436,.450919,.334552,.768295,-.186904,.451776,.358491,.776613,-.195117,.452832,.383446,.783966,-.202695,.45249,.408945,.793542,-.20985,.452587,.435364,.803192,-.216403,.451852,.462336,.813892,-.22251,.450708,.48987,.824968,-.227676,.4486,.517697,.835859,-.232443,.445156,.545975,.846825,-.235775,.440351,.574483,.858085,-.237897,.433641,.604246,.868825,-.238074,.425354,.634101,.879638,-.237661,.415383,.664201,.889966,-.236186,.404136,.693918,.899479,-.233599,.390917,.723481,.908769,-.229737,.376352,.75258,.917966,-.223836,.360372,.781764,.926304,-.217067,.342551,.811139,.934626,-.209309,.324238,.839585,.941841,-.20071,.304484,.867044,.94789,-.190602,.283607,.894579,.954196,-.179253,.262205,.921743,.958383,-.167646,.239847,.948026,.963119,-.155073,.218078,.973296,.966941,-.141426,.195899,.998135,.970836,-.126849,.174121,1.02021,.973301,-.112296,.153052,1.04085,.97448,-.0964965,.131733,1.05946,.977045,-.080489,.10997,1.07693,.980751,-.064844,.0881657,1.09254,.985475,-.0481938,.0657987,1.10697,.991089,-.0319185,.0435215,1.12004,.996122,-.0158088,.0214779,1.13173,1.00001,372455e-9,-200295e-9,1.14291,.708622,-907597e-11,.45304,141962e-10,.711162,-228911e-9,.454662,358052e-9,.709812,-914446e-9,.453797,.00143034,.709865,-.00205819,.453834,.00321935,.709864,-.00365894,.453833,.00572331,.709855,-.00571692,.453826,.00894278,.709862,-.00823201,.453828,.012878,.709875,-.011204,.453832,.0175295,.709896,-.0146323,.453839,.0228978,.709925,-.0185163,.453847,.0289839,.709974,-.0228551,.453866,.0357894,.710045,-.0276473,.453892,.0433161,.710133,-.032891,.453924,.0515665,.710292,-.0385851,.453992,.0605458,.710485,-.0447254,.45407,.0702574,.710769,-.0513051,.454192,.0807077,.711106,-.0582733,.454329,.091896,.711516,-.0652866,.45446,.103814,.712071,-.0728426,.454653,.116508,.712676,-.0808307,.45484,.129968,.713476,-.0892216,.455096,.144206,.714377,-.0979047,.455346,.159212,.715579,-.106531,.455647,.174973,.716977,-.115492,.455961,.191504,.71862,-.124821,.456315,.208835,.72084,-.134079,.4568,.226869,.723786,-.143427,.457521,.245582,.727464,-.153061,.458475,.264957,.732771,-.162768,.460239,.284948,.736515,-.172627,.460899,.30522,.743519,-.182487,.463225,.326717,.750041,-.191295,.464027,.350113,.758589,-.199746,.465227,.374782,.767703,-.207584,.465877,.400226,.777484,-.214973,.465996,.426442,.788792,-.221796,.466019,.453688,.800194,-.228038,.465083,.481246,.811234,-.233346,.462506,.509086,.822859,-.238073,.459257,.537338,.835082,-.241764,.454863,.566108,.846332,-.244241,.448163,.595126,.858355,-.244736,.439709,.625574,.87034,-.244278,.429837,.65617,.881027,-.24255,.418002,.686029,.891007,-.239912,.404325,.716039,.900874,-.236133,.389222,.745518,.911072,-.230672,.373269,.775026,.920359,-.22356,.355083,.804521,.928604,-.215591,.335533,.834045,.937175,-.206503,.315278,.861612,.942825,-.196684,.293653,.889131,.949805,-.185116,.271503,.916853,.955535,-.172703,.248821,.943541,.959843,-.159978,.225591,.970132,.964393,-.146375,.202719,.994709,.968008,-.131269,.179928,1.0186,.971013,-.11569,.158007,1.03928,.973334,-.1003,.13624,1.05887,.975775,-.0833352,.1138,1.07652,.979579,-.0668981,.0913141,1.09297,.984323,-.0500902,.0683051,1.10734,.990351,-.0332377,.0451771,1.12084,.995823,-.0161491,.0221705,1.13296,1.0001,234083e-9,-108712e-9,1.14441,.683895,-924677e-11,.46015,137429e-10,.68833,-233383e-9,.463134,346865e-9,.688368,-933547e-9,.463159,.00138748,.688367,-.00210049,.463159,.00312187,.688369,-.00373415,.463159,.00555004,.688377,-.00583449,.463163,.00867216,.688386,-.00840128,.463166,.0124884,.688398,-.0114343,.463169,.0169993,.688418,-.0149329,.463175,.0222054,.688453,-.0188964,.463188,.028108,.688515,-.0233239,.463214,.0347085,.68857,-.0282136,.463231,.0420091,.688679,-.033564,.463276,.0500132,.688854,-.0393733,.463356,.0587255,.689038,-.0456354,.46343,.0681476,.689321,-.0523433,.463553,.0782897,.689662,-.059412,.463693,.0891501,.690188,-.0665736,.4639,.100735,.690755,-.0743106,.464107,.113074,.691405,-.0824722,.464329,.126161,.692198,-.0910484,.464585,.140007,.693196,-.0998778,.464893,.154612,.69454,-.108651,.465285,.169984,.695921,-.117855,.465596,.186106,.697749,-.12734,.466056,.203034,.700375,-.136714,.466771,.220703,.703395,-.146386,.467579,.239062,.707904,-.156096,.469067,.258188,.711673,-.165904,.469851,.277759,.717489,-.175812,.471815,.297935,.724051,-.185931,.47389,.318916,.731965,-.195238,.47587,.341591,.741151,-.204021,.477523,.366062,.751416,-.212113,.478881,.391396,.761848,-.21979,.479226,.417599,.771886,-.2267,.478495,.444401,.783998,-.232991,.477622,.472084,.796523,-.238645,.475833,.500193,.808851,-.243396,.472568,.52865,.821191,-.247226,.467857,.557362,.834261,-.250102,.461871,.586768,.846762,-.251056,.453543,.617085,.859867,-.250604,.443494,.647659,.871948,-.248783,.431711,.678119,.882967,-.245855,.417911,.708399,.892826,-.242168,.401993,.738256,.90332,-.237062,.385371,.767999,.913633,-.22997,.366837,.798191,.922774,-.221687,.346372,.827756,.931371,-.212345,.325682,.856425,.938929,-.20206,.303665,.884299,.944821,-.190981,.280786,.912023,.951792,-.178065,.2573,.939669,.957712,-.164634,.233448,.96655,.961912,-.150863,.209504,.992366,.966382,-.13577,.18597,1.01633,.969588,-.119593,.162905,1.03843,.971777,-.103203,.14053,1.05841,.97433,-.0865888,.117909,1.07632,.978686,-.0690829,.0944101,1.09326,.983281,-.0516568,.0705671,1.10796,.989562,-.034558,.0468592,1.12182,.995465,-.0167808,.0229846,1.1342,.999991,373016e-9,-235606e-9,1.1459,.662251,-939016e-11,.468575,132714e-10,.666634,-237624e-9,.471675,335842e-9,.666411,-950385e-9,.471516,.00134321,.666399,-.00213833,.471509,.00302221,.666386,-.0038014,.471499,.00537283,.666405,-.00593958,.471511,.00839533,.666406,-.00855253,.471508,.0120898,.666428,-.0116401,.471519,.0164569,.666444,-.0152015,.471522,.0214971,.66649,-.0192362,.471543,.027212,.666537,-.0237428,.471558,.033603,.666617,-.0287198,.471591,.0406728,.666718,-.0341647,.471631,.0484238,.666889,-.0400759,.47171,.0568621,.667104,-.0464479,.471805,.0659915,.667374,-.0532677,.471923,.0758178,.667772,-.0603805,.472098,.0863425,.668371,-.0677392,.472363,.0975917,.668971,-.0756028,.472596,.109567,.669696,-.0839293,.472869,.122272,.670481,-.0926683,.473126,.135718,.6715,-.1016,.473442,.149914,.672911,-.110566,.47389,.164882,.674512,-.119984,.474354,.180602,.67651,-.129574,.474922,.19711,.679292,-.139106,.475764,.214371,.682798,-.148993,.476886,.232405,.686955,-.158737,.478179,.251153,.691406,-.168754,.479432,.270436,.697438,-.178703,.481481,.290374,.704761,-.188955,.484143,.311044,.713599,-.198814,.487007,.333003,.723194,-.207869,.488962,.357144,.732601,-.216189,.489815,.382169,.744193,-.22398,.490888,.408227,.754907,-.231156,.490355,.434928,.767403,-.23747,.489548,.462599,.78107,-.243503,.488274,.490908,.793893,-.248114,.484843,.519421,.807296,-.25222,.4803,.548561,.820529,-.255265,.474097,.577772,.833716,-.256741,.466041,.607782,.848403,-.25637,.456547,.638807,.860755,-.254804,.443946,.670058,.874012,-.251834,.430852,.700749,.885619,-.247867,.414903,.731446,.896069,-.242634,.397276,.761191,.906266,-.236093,.378535,.791053,.916759,-.227543,.358038,.821298,.92523,-.21783,.335705,.850747,.93436,-.207534,.313797,.879258,.941631,-.195983,.289671,.907734,.947564,-.183567,.265319,.935206,.953681,-.169345,.240815,.962739,.960008,-.154909,.216119,.989227,.964145,-.140161,.192096,1.01465,.968171,-.123411,.167855,1.03737,.969859,-.106525,.144817,1.05767,.972666,-.0891023,.12149,1.0761,.977055,-.0718094,.0975306,1.09336,.982527,-.0534213,.0730217,1.10878,.989001,-.0355579,.0483366,1.12285,.99512,-.0176383,.023938,1.13548,1.00007,368831e-9,-211581e-9,1.14744,.651047,-960845e-11,.484101,12922e-9,.644145,-241347e-9,.478968,324578e-9,.64396,-965142e-9,.478831,.00129798,.64396,-.00217154,.47883,.00292046,.643968,-.00386049,.478835,.00519202,.643974,-.00603186,.478838,.0081128,.643977,-.0086854,.478836,.011683,.643982,-.0118207,.478834,.0159031,.644024,-.0154374,.478856,.0207743,.644059,-.0195343,.478868,.0262975,.644122,-.0241103,.478896,.0324747,.644207,-.0291638,.478933,.039309,.64432,-.0346919,.478981,.0468029,.644481,-.0406919,.479053,.0549614,.644722,-.047159,.479169,.0637909,.645013,-.0540748,.479302,.0732974,.645503,-.0612001,.479541,.0834898,.646117,-.0687303,.479829,.0943873,.646707,-.0767846,.480061,.105991,.647431,-.0852465,.480343,.11831,.64831,-.0940719,.48066,.131348,.649486,-.103056,.481083,.14514,.650864,-.112261,.481528,.159676,.652604,-.121852,.482102,.174979,.654825,-.131505,.482813,.191079,.657876,-.141189,.483876,.207927,.661339,-.151239,.48499,.225586,.665463,-.161091,.486279,.243947,.670542,-.171235,.487968,.262957,.677361,-.181347,.49053,.282781,.685672,-.191679,.493862,.303311,.694551,-.201781,.49699,.324607,.703753,-.211164,.498884,.347916,.713703,-.219675,.500086,.372628,.725911,-.227836,.501554,.398694,.73862,-.23533,.502193,.425529,.752118,-.241786,.501811,.453209,.76579,-.247865,.500185,.481381,.779568,-.252696,.497159,.51011,.793991,-.256802,.492765,.539322,.808182,-.259942,.486827,.569078,.821698,-.261703,.478386,.598818,.836009,-.262006,.468772,.629762,.849824,-.260333,.456352,.661366,.863888,-.257398,.442533,.69295,.876585,-.253264,.426573,.723608,.888665,-.248026,.408964,.754378,.899537,-.241487,.389677,.784761,.9094,-.233463,.368516,.814688,.920166,-.223397,.346624,.845009,.928899,-.21255,.322717,.874431,.937156,-.200869,.298698,.902922,.943861,-.188387,.273491,.931356,.949557,-.174341,.247866,.958854,.955862,-.158994,.222496,.986098,.961721,-.143664,.197522,1.01229,.965976,-.127412,.17302,1.03571,.968652,-.109798,.148954,1.05699,.971084,-.0916787,.125044,1.07587,.975584,-.0739634,.100577,1.09372,.98122,-.055322,.0753666,1.10948,.988253,-.0366825,.0498899,1.12394,.99482,-.0180389,.024611,1.13694,1.00001,229839e-9,-188283e-9,1.14919,.613867,-964198e-11,.479449,123452e-10,.621485,-244534e-9,.485399,313091e-9,.621429,-978202e-9,.485353,.00125245,.62112,-.00220004,.485114,.00281687,.621119,-.0039111,.485112,.00500783,.621122,-.00611091,.485112,.00782498,.621133,-.00879922,.485117,.0112687,.621152,-.0119756,.485125,.0153394,.621183,-.0156396,.485139,.0200382,.621227,-.0197898,.485158,.0253663,.621298,-.0244253,.485192,.0313261,.621388,-.0295441,.485233,.0379204,.621507,-.0351432,.485286,.0451523,.621693,-.0412198,.485378,.0530277,.621933,-.0477673,.485495,.0615522,.622232,-.0547574,.485635,.0707316,.622809,-.0619417,.485943,.0805883,.623407,-.069625,.486232,.0911267,.62406,-.077796,.486516,.102354,.624835,-.0863731,.486838,.114279,.625758,-.095251,.487188,.126902,.627043,-.104299,.487695,.140285,.628438,-.113724,.488163,.154397,.630325,-.123417,.488858,.169267,.632801,-.133137,.489754,.184941,.635784,-.143052,.490815,.20136,.639406,-.153132,.492048,.218643,.643872,-.163143,.49363,.236615,.6499,-.17333,.496009,.255449,.657201,-.183622,.498994,.275006,.666221,-.194019,.502888,.295354,.674419,-.204192,.505459,.316244,.683729,-.21406,.507771,.33849,.695584,-.222854,.510245,.363166,.708583,-.231315,.512293,.389071,.721233,-.238911,.512747,.415737,.735134,-.245657,.512482,.443331,.750179,-.251879,.511526,.471891,.765073,-.256911,.508935,.500892,.779794,-.261144,.504341,.530294,.794801,-.264316,.498515,.560144,.810339,-.266276,.491015,.590213,.824818,-.266981,.481126,.620865,.839375,-.265778,.468685,.652687,.853043,-.262748,.453925,.684759,.867335,-.258474,.437912,.716209,.88037,-.253187,.419648,.747508,.891711,-.246476,.39982,.77797,.902896,-.238735,.37879,.808586,.913601,-.22885,.355891,.838843,.923019,-.217656,.331773,.869014,.933432,-.205539,.307356,.898512,.939691,-.192595,.281321,.9269,.946938,-.178945,.255441,.955297,.952372,-.163587,.229013,.983231,.95909,-.147214,.203179,1.00971,.963675,-.13064,.17792,1.03438,.968247,-.113121,.152898,1.05625,.97001,-.0945824,.128712,1.07598,.974458,-.0755648,.103349,1.094,.980168,-.0571998,.0776731,1.1104,.987295,-.0377994,.0514445,1.12491,.994432,-.0186417,.025429,1.13851,.999975,542714e-9,-282356e-9,1.15108,.592656,-980249e-11,.486018,119532e-10,.598467,-247275e-9,.490781,301531e-9,.597934,-988317e-9,.490343,.00120517,.597903,-.00222366,.490319,.0027116,.597913,-.00395315,.490327,.00482077,.597919,-.00617653,.490329,.00753264,.597936,-.00889375,.490339,.0108478,.597956,-.0121043,.490347,.0147668,.597992,-.0158073,.490365,.0192905,.598032,-.0200017,.490382,.0244204,.598109,-.0246865,.49042,.0301593,.598215,-.0298594,.490474,.03651,.59833,-.0355167,.490524,.0434757,.598525,-.0416559,.490624,.0510629,.598778,-.0482692,.490753,.0592781,.599135,-.0553114,.49094,.0681304,.599802,-.062542,.491328,.0776467,.600361,-.0703638,.491598,.0878184,.60101,-.0786256,.491882,.0986573,.601811,-.0872962,.492232,.11018,.602861,-.0962284,.492684,.1224,.604167,-.10538,.493213,.135354,.605693,-.114896,.493799,.149034,.607682,-.124654,.494576,.163469,.610672,-.13456,.4959,.178747,.613313,-.144581,.496713,.194723,.617603,-.154703,.498499,.211617,.622174,-.16489,.500188,.229183,.628855,-.175164,.503072,.247786,.636963,-.185565,.506798,.267116,.644866,-.195911,.509719,.28702,.653741,-.206104,.512776,.307763,.664942,-.216447,.516812,.329631,.67633,-.22552,.519181,.353515,.690012,-.234316,.521681,.379226,.704243,-.242032,.523129,.405901,.719396,-.249172,.523768,.433585,.734471,-.255543,.522541,.462085,.750539,-.260697,.520217,.491233,.766365,-.26501,.516293,.521094,.781677,-.268409,.509708,.551014,.797132,-.270399,.501944,.581463,.812655,-.271247,.492025,.612402,.828592,-.270708,.480424,.643798,.844044,-.268085,.465955,.67682,.857305,-.263459,.448425,.708496,.87114,-.258151,.430243,.74046,.884936,-.251171,.410578,.771583,.895772,-.243305,.38862,.802234,.906961,-.234037,.365214,.833179,.917775,-.222714,.34116,.86353,.927883,-.210175,.31572,.893557,.936617,-.196925,.289159,.922976,.943384,-.182788,.261996,.951606,.949713,-.167965,.235324,.979958,.955818,-.151109,.208408,1.00765,.961344,-.133834,.182591,1.03329,.965469,-.115987,.156958,1.0557,.968693,-.09746,.132239,1.07583,.973165,-.0778514,.106195,1.09451,.979387,-.0585067,.0797669,1.11137,.98671,-.0390409,.0530263,1.12643,.994093,-.019408,.0263163,1.14016,1.00002,540029e-9,-194487e-9,1.15299,.574483,-989066e-11,.494533,114896e-10,.574478,-249127e-9,.494528,289403e-9,.574607,-996811e-9,.494637,.00115797,.574396,-.00224241,.494458,.00260498,.574377,-.00398632,.49444,.00463102,.574386,-.00622836,.494445,.00723623,.574401,-.0089683,.494453,.010421,.574419,-.0122056,.49446,.0141859,.574459,-.0159396,.494481,.0185322,.574525,-.0201692,.49452,.0234617,.574587,-.0248924,.494547,.0289762,.574697,-.0301074,.494604,.0350797,.574853,-.0358114,.494688,.0417767,.575027,-.041999,.494772,.0490718,.575294,-.0486618,.494915,.0569728,.575733,-.0557148,.495173,.0654955,.576356,-.0630489,.495537,.0746612,.576944,-.0709285,.495836,.0844615,.57765,-.0792723,.496177,.0949142,.578491,-.0880167,.496563,.10603,.579639,-.0969462,.497096,.117841,.580989,-.10622,.497684,.130367,.582587,-.115861,.498337,.143609,.584951,-.125605,.499414,.157625,.587602,-.135608,.500518,.172413,.59076,-.145742,.501767,.187999,.594992,-.155934,.503542,.20445,.600656,-.166303,.506135,.221764,.607816,-.176681,.509542,.24002,.61522,-.187071,.51263,.258992,.623702,-.197465,.516021,.278773,.634192,-.207816,.520422,.299377,.644936,-.218183,.524073,.320802,.657888,-.2278,.528049,.34384,.670666,-.236747,.52986,.36916,.685626,-.24484,.531892,.395867,.701304,-.252071,.532727,.423488,.717727,-.258714,.532146,.452201,.733914,-.264211,.529883,.481579,.750529,-.26859,.5259,.511558,.76747,-.272046,.51999,.542042,.785189,-.274225,.513083,.572799,.800954,-.275189,.502936,.603816,.816962,-.274946,.490921,.635461,.83336,-.272695,.47684,.6676,.848143,-.268223,.459405,.70051,.861818,-.262768,.440319,.732902,.876828,-.255872,.420123,.765084,.889312,-.247703,.398379,.796391,.900412,-.238381,.374496,.827333,.912251,-.227783,.349874,.858385,.921792,-.214832,.323181,.888652,.931273,-.200949,.296624,.917763,.940295,-.186537,.269211,.947878,.946812,-.171538,.241447,.977016,.953588,-.155254,.213829,1.00501,.958841,-.137156,.186807,1.03179,.963746,-.118699,.160706,1.05502,.966468,-.0998358,.135504,1.07568,.971178,-.0805186,.109131,1.09479,.97831,-.0599348,.0818293,1.1123,.985886,-.0399661,.0545872,1.12771,.994021,-.0198682,.0269405,1.14186,1.00009,271022e-9,-12989e-8,1.15514,.538716,-990918e-11,.486732,109675e-10,.550656,-250642e-9,.497518,277412e-9,.55057,-.00100265,.497441,.00110974,.550903,-.00225672,.497733,.00249779,.550568,-.00401046,.497438,.00443906,.550574,-.00626613,.49744,.00693637,.550591,-.0090226,.497449,.00998921,.550623,-.0122795,.497469,.0135984,.550667,-.0160361,.497495,.0177654,.550724,-.0202908,.497526,.0224915,.550792,-.0250421,.497557,.0277795,.550918,-.0302878,.49763,.0336334,.551058,-.0360241,.497701,.0400573,.551276,-.0422473,.497824,.0470585,.551551,-.0489441,.497977,.0546433,.552074,-.0559596,.498312,.0628367,.552681,-.0633978,.498679,.071646,.553324,-.0713176,.499031,.0810746,.554011,-.0797268,.499365,.091129,.55488,-.0885238,.499779,.101837,.556171,-.0974417,.500444,.113239,.557498,-.106841,.501025,.125316,.559299,-.116533,.501864,.138128,.561647,-.126298,.502967,.151695,.564347,-.136388,.504129,.16604,.567863,-.146576,.505713,.181207,.572569,-.156832,.507953,.197259,.578919,-.167323,.511186,.214258,.585387,-.177712,.514042,.232038,.593134,-.188184,.517484,.250733,.603295,-.198717,.522345,.270454,.613854,-.209177,.526751,.290807,.626092,-.219644,.531595,.312202,.637868,-.229494,.534721,.334435,.652458,-.238718,.538304,.359184,.666985,-.247061,.539875,.385637,.683301,-.254652,.541042,.41328,.69998,-.261376,.540735,.441903,.717824,-.267085,.539139,.471609,.734617,-.271465,.534958,.501446,.753663,-.27528,.53032,.532571,.770512,-.277617,.522134,.563641,.787356,-.278525,.51206,.595067,.806252,-.278512,.50119,.627226,.822061,-.277023,.486791,.659402,.838959,-.273175,.470467,.692874,.85379,-.267238,.450688,.725702,.868268,-.260327,.429741,.75832,.881994,-.251946,.407223,.790189,.893885,-.242432,.383214,.821625,.905118,-.231904,.357297,.853011,.916045,-.219545,.330733,.883773,.927614,-.205378,.303916,.914435,.936005,-.190388,.275941,.944502,.944533,-.1749,.247493,.974439,.950758,-.158588,.218996,1.00286,.957078,-.141027,.191559,1.0304,.962448,-.121507,.164457,1.05466,.964993,-.102068,.138636,1.0761,.970017,-.0822598,.111861,1.09541,.97661,-.062033,.0843438,1.11317,.985073,-.0409832,.0558496,1.12911,.993515,-.020146,.0275331,1.1438,1.00006,27329e-8,-107883e-9,1.15736,.525324,-999341e-11,.498153,105385e-10,.526513,-251605e-9,.499277,265329e-9,.526517,-.00100641,.499282,.0010613,.526588,-.00226466,.499337,.00238823,.526539,-.0040255,.499302,.00424535,.526547,-.00628954,.499306,.00663364,.526561,-.00905628,.499313,.00955337,.526593,-.0123253,.499334,.0130054,.526642,-.0160957,.499365,.0169911,.5267,-.0203661,.499396,.0215122,.526792,-.0251347,.499451,.0265718,.526904,-.0303985,.499511,.0321732,.527079,-.0361554,.499617,.0383231,.527285,-.0423982,.499731,.045026,.527602,-.0491121,.499924,.0522936,.528166,-.0561127,.500306,.0601528,.52879,-.0635988,.5007,.0686059,.529421,-.071581,.501048,.0776518,.530144,-.0799854,.501421,.0873148,.531062,-.0888032,.501884,.0976084,.532374,-.0977643,.50259,.108588,.533828,-.107197,.50329,.120234,.53581,-.116887,.504312,.132602,.538063,-.126755,.505365,.145721,.5409,-.136819,.506668,.159617,.544882,-.147117,.508731,.174369,.550238,-.157446,.511601,.190028,.556038,-.167988,.514431,.206587,.563031,-.178364,.517808,.224046,.571543,-.189007,.521937,.242503,.582255,-.199546,.527415,.261977,.59272,-.210084,.531682,.282162,.605648,-.220448,.537123,.303426,.61785,-.230593,.540664,.325323,.632223,-.240238,.544467,.348993,.648819,-.24887,.547594,.375462,.665825,-.256657,.54912,.403024,.683389,-.263711,.549294,.431773,.701495,-.269666,.547649,.461494,.719197,-.274169,.543786,.491623,.737906,-.278124,.538644,.522994,.756652,-.280632,.531057,.554775,.775279,-.281741,.521972,.586441,.792688,-.281652,.509613,.618596,.811894,-.280345,.496497,.651462,.827938,-.277128,.47968,.684023,.844837,-.271646,.460688,.718024,.859239,-.264397,.438872,.751207,.874088,-.256144,.41577,.784232,.887693,-.246311,.391369,.816191,.899402,-.235497,.365872,.847828,.910973,-.223631,.338618,.87934,.92204,-.209874,.310803,.910325,.930987,-.194265,.281802,.940695,.94,-.178125,.252836,.970958,.948018,-.161479,.224239,1.00078,.955141,-.144038,.195857,1.0288,.960513,-.124915,.168487,1.05371,.963964,-.104284,.141495,1.07596,.968713,-.0838732,.114437,1.09628,.975524,-.0635579,.0863105,1.11448,.98431,-.042291,.0574774,1.13069,.992916,-.0209131,.0284343,1.14568,.999926,743097e-9,-379265e-9,1.15955,.501042,-998428e-11,.498726,100306e-10,.502992,-252112e-9,.500665,253283e-9,.502417,-.00100791,.500092,.00101259,.502965,-.00226919,.500621,.00227978,.502318,-.00403109,.499994,.00405011,.502333,-.00629832,.500005,.00632868,.502362,-.00906907,.500027,.00911446,.502369,-.0123423,.500023,.0124078,.50243,-.0161178,.500066,.016211,.502493,-.0203937,.500103,.0205256,.502592,-.0251684,.500166,.0253548,.502707,-.0304389,.50023,.0307029,.502881,-.0362015,.500335,.0365753,.503124,-.0424507,.500488,.0429798,.503443,-.0491582,.500686,.0499268,.504083,-.0561476,.501155,.0574541,.504668,-.0636846,.501524,.0655408,.505319,-.0716834,.501904,.0742072,.50609,-.0800925,.502321,.0834699,.507122,-.0888425,.502896,.0933603,.508414,-.097855,.503603,.10391,.509955,-.107304,.504416,.115113,.512061,-.116921,.505565,.127054,.514419,-.12689,.506732,.139709,.517529,-.136934,.508338,.153173,.522085,-.147327,.510987,.167528,.526986,-.157612,.513527,.182708,.533122,-.168213,.516717,.198881,.540807,-.178688,.520832,.215986,.550687,-.189511,.52632,.234335,.560567,-.199998,.531009,.253375,.571698,-.210652,.535839,.273499,.584364,-.220917,.541091,.294355,.599066,-.23137,.546875,.316525,.614148,-.241206,.551306,.339671,.631157,-.250379,.555187,.36531,.647919,-.258397,.556595,.392767,.666112,-.265528,.556949,.421397,.686158,-.271827,.556617,.451433,.704838,-.27674,.552975,.482131,.723957,-.280733,.547814,.513458,.74262,-.283359,.53997,.545446,.762009,-.284541,.530422,.57775,.781314,-.284507,.518546,.610434,.799116,-.283309,.504178,.643178,.817604,-.280378,.48843,.676248,.83459,-.275619,.469457,.709698,.850974,-.26856,.447698,.744245,.866747,-.260094,.424791,.777695,.881412,-.249929,.399913,.810392,.8936,-.239137,.37308,.842872,.905943,-.226818,.345705,.874677,.916408,-.213699,.31706,.906257,.927215,-.198428,.288444,.936881,.935625,-.181643,.258329,.96795,.944076,-.164386,.228488,.998216,.951229,-.146339,.199763,1.02689,.958793,-.127709,.172153,1.0535,.963219,-.107244,.144989,1.07646,.967562,-.0857764,.11685,1.09675,.974866,-.0645377,.0880571,1.11576,.983353,-.0431732,.0587352,1.13227,.992503,-.0218356,.0294181,1.1478,1.00003,605203e-9,-231013e-9,1.16207,.482935,-101177e-10,.504695,968142e-11,.477554,-251521e-9,.499071,240676e-9,.477904,-.00100683,.499436,96342e-8,.478368,-.00226636,.499899,.0021687,.477977,-.00402719,.499513,.00385384,.477993,-.00629226,.499525,.0060221,.478011,-.00906011,.499536,.00867289,.478051,-.0123305,.499566,.0118074,.478089,-.016102,.499587,.0154269,.478171,-.0203736,.499645,.0195341,.478254,-.025143,.499692,.0241318,.47839,-.0304071,.499779,.0292247,.478588,-.0361631,.499911,.0348196,.478812,-.0424023,.500046,.0409231,.479208,-.0490724,.500326,.047552,.479841,-.0560722,.500805,.0547377,.480392,-.0636125,.501152,.0624607,.481068,-.0716134,.501561,.0707473,.481898,-.0800062,.502054,.0796118,.483022,-.0886568,.502728,.0890974,.484332,-.0977553,.503479,.0992099,.486126,-.107173,.504546,.10999,.488066,-.11677,.50557,.121476,.490521,-.126725,.506849,.133672,.494232,-.136793,.50911,.146731,.498302,-.147116,.511345,.160577,.503565,-.157446,.514344,.175335,.510902,-.168121,.518824,.191207,.519263,-.178799,.523666,.208058,.528204,-.189407,.528296,.225875,.538854,-.200145,.533724,.244782,.551278,-.210701,.539833,.264753,.565222,-.221303,.546131,.285745,.579403,-.231688,.551496,.307592,.595469,-.241718,.556809,.330582,.610929,-.250992,.559641,.354995,.629433,-.259602,.562379,.382471,.648504,-.267038,.563676,.411126,.66756,-.273388,.562092,.440924,.689143,-.278788,.560807,.472118,.709056,-.282783,.555701,.503774,.729855,-.285836,.548698,.536364,.748954,-.287078,.538544,.56895,.768373,-.287133,.526711,.601991,.78827,-.285839,.512511,.635403,.807465,-.283238,.496323,.668797,.825194,-.27906,.477638,.702584,.842203,-.272286,.456253,.736393,.857749,-.263854,.432412,.77096,.874799,-.253943,.407806,.80489,.887497,-.24237,.38033,.83771,.89966,-.230278,.352446,.870376,.911753,-.21646,.323268,.902256,.923011,-.202071,.294314,.933306,.932375,-.185519,.264104,.965177,.940537,-.167604,.234035,.996303,.948904,-.149068,.20412,1.0261,.955263,-.129539,.175431,1.05304,.960303,-.109932,.148116,1.07617,.965512,-.0880572,.119693,1.09742,.973466,-.0660548,.0901619,1.11721,.98284,-.0439228,.0599875,1.13436,.992216,-.0219588,.0298975,1.15006,.999946,119402e-9,-208547e-10,1.16471,.447827,-100414e-10,.491543,914833e-11,.454778,-251257e-9,.499172,22891e-8,.453519,-.00100342,.497787,914184e-9,.45357,-.00225776,.497847,.00205701,.453578,-.00401371,.497855,.00365705,.45357,-.00627107,.497841,.00571453,.453598,-.00902968,.497864,.00823019,.453627,-.0122888,.497882,.0112049,.453684,-.0160475,.497923,.0146405,.453764,-.0203044,.49798,.0185394,.453866,-.0250576,.498049,.0229054,.453996,-.0303028,.49813,.0277424,.454196,-.0360379,.498267,.0330587,.454457,-.0422521,.498445,.0388613,.454926,-.0488393,.498812,.0451767,.455525,-.0558653,.499272,.0520153,.456074,-.0633772,.499625,.0593754,.456752,-.0713606,.500049,.0672751,.457648,-.07971,.500615,.0757447,.458849,-.0883032,.501399,.0848231,.46029,-.0974095,.502293,.0945135,.462,-.106729,.503301,.104848,.464121,-.116354,.504533,.115884,.466889,-.126214,.506172,.127652,.470744,-.136324,.508667,.14024,.47488,-.146595,.510995,.153673,.480845,-.157027,.514832,.168053,.488262,-.167658,.519506,.183508,.496547,-.178343,.524347,.199948,.506254,-.188916,.52983,.217503,.517961,-.199975,.536357,.236272,.531484,-.210624,.543641,.256096,.545496,-.221227,.550048,.277085,.559497,-.231568,.555076,.298615,.575752,-.241698,.560541,.321547,.591999,-.251172,.564156,.345602,.610654,-.260178,.567607,.371851,.630484,-.268094,.56923,.40076,.651807,-.274661,.569779,.430801,.67239,-.280331,.566791,.461939,.693024,-.284501,.562007,.493854,.715473,-.287852,.555791,.526992,.736323,-.28929,.546345,.560102,.755771,-.289405,.534,.593543,.775424,-.2881,.519114,.627256,.795447,-.285562,.502543,.661464,.815319,-.281416,.484773,.695206,.831769,-.275523,.463445,.729044,.849464,-.267516,.440269,.764069,.866775,-.257584,.415049,.799089,.881252,-.245817,.388049,.831948,.894209,-.233127,.35889,.865526,.906922,-.219579,.329915,.89818,.919686,-.204491,.300441,.930013,.929044,-.188962,.269445,.962061,.938393,-.171079,.238402,.994214,.94661,-.15199,.208204,1.02533,.953095,-.131953,.178653,1.0529,.958644,-.111233,.150684,1.0771,.963925,-.0903098,.122359,1.09855,.971995,-.0680505,.0923342,1.11874,.981658,-.0448512,.0614195,1.13635,.991649,-.0221931,.0303582,1.15238,.999985,393403e-9,-111086e-9,1.16772,.396806,-971563e-11,.457671,842355e-11,.429186,-249421e-9,.495017,21625e-8,.429324,-998052e-9,.495173,865322e-9,.429175,-.00224487,.494999,.00194637,.429129,-.00399041,.494952,.00346004,.429153,-.00623476,.494974,.00540684,.429168,-.0089773,.494983,.00778714,.429207,-.0122175,.495012,.0106022,.429257,-.0159542,.495047,.0138535,.429338,-.0201864,.495106,.0175443,.429431,-.0249104,.495165,.0216774,.429587,-.0301252,.495279,.0262594,.429796,-.0358249,.495432,.0312968,.430065,-.0419972,.495621,.0367985,.430588,-.0485144,.496061,.042798,.43113,-.0555028,.496472,.0492914,.431743,-.0629852,.496904,.0562907,.432448,-.0709256,.497369,.0638056,.433414,-.0791942,.498032,.071885,.434638,-.0877346,.498854,.0805517,.43611,-.0968056,.499812,.0898047,.437859,-.106002,.500891,.0997142,.440017,-.115648,.502198,.110289,.443236,-.125427,.504389,.121644,.44697,-.135492,.506809,.133769,.451689,-.145746,.509858,.146787,.45811,-.156219,.514247,.160793,.465305,-.166834,.518816,.175791,.474085,-.177546,.524331,.191906,.484808,-.188262,.53104,.209199,.49732,-.199346,.538511,.227825,.509693,-.209951,.544554,.247269,.524367,-.220533,.551616,.267978,.539228,-.231082,.557368,.289672,.55644,-.241342,.563782,.31268,.574204,-.250964,.568851,.33651,.593388,-.260306,.57312,.362219,.613358,-.268667,.574916,.390322,.634512,-.275591,.575053,.420478,.65563,-.281328,.572404,.451614,.678265,-.285948,.568893,.484112,.70011,-.289408,.561878,.517348,.723005,-.291328,.55359,.551355,.743744,-.291418,.541099,.585109,.763949,-.290252,.526489,.619487,.784186,-.287648,.509496,.65404,.804304,-.283782,.491484,.688649,.823629,-.278067,.470517,.723133,.84094,-.270588,.44705,.757163,.857852,-.261188,.421252,.792816,.874934,-.249313,.394191,.827248,.888709,-.236492,.365359,.861074,.902589,-.222185,.336016,.894417,.914201,-.207314,.30527,.926825,.925978,-.191146,.274532,.9595,.93512,-.174135,.243393,.991583,.943656,-.155231,.212414,1.02356,.951719,-.134403,.182005,1.05239,.957164,-.113023,.153043,1.07754,.962656,-.0914493,.124186,1.09984,.970695,-.0694179,.0941654,1.12,.980749,-.0466199,.0629671,1.13849,.991205,-.0227032,.0311146,1.15494,.999884,632388e-9,-254483e-9,1.1706,.379821,-957289e-11,.460637,789337e-11,.405188,-247483e-9,.491396,204064e-9,.404796,-989434e-9,.490914,815853e-9,.40483,-.00222607,.490949,.00183559,.40473,-.00395723,.49084,.00326332,.404731,-.00618287,.490836,.00509945,.404768,-.00890258,.490871,.00734463,.404791,-.0121156,.490883,.00999992,.404857,-.0158214,.490938,.0130676,.404943,-.0200178,.491004,.0165503,.405059,-.0247027,.491093,.0204521,.405213,-.0298729,.491205,.0247788,.405399,-.0355226,.491333,.0295373,.405731,-.0416352,.491604,.034741,.406303,-.0480807,.492116,.0404255,.406814,-.0550458,.492506,.0465732,.407404,-.0624652,.492926,.0532058,.408149,-.0702958,.493442,.0603442,.409128,-.0784623,.494136,.0680297,.410408,-.087007,.495054,.0762786,.411813,-.0959639,.495962,.0851046,.413735,-.105075,.497257,.0945878,.416137,-.114646,.498882,.104725,.41934,-.124394,.501132,.11563,.423326,-.134328,.503883,.127325,.428419,-.14458,.50747,.139911,.43484,-.154979,.511964,.153481,.442641,-.165628,.517328,.168114,.452511,-.176365,.524258,.183995,.463473,-.187298,.531248,.200953,.475564,-.198244,.538367,.219176,.488664,-.208938,.545175,.238514,.504073,-.219599,.553227,.259129,.520832,-.230378,.560653,.280997,.538455,-.240703,.567523,.303821,.55709,-.250548,.573287,.327948,.576646,-.259964,.577795,.353362,.596705,-.268721,.580077,.380336,.618053,-.276054,.58018,.4101,.640303,-.282176,.578747,.44161,.662365,-.286931,.574294,.474106,.684542,-.290521,.567035,.507549,.707984,-.292672,.558687,.541853,.730913,-.293189,.547606,.576581,.752948,-.292199,.533471,.61172,.773452,-.289508,.516395,.646339,.794715,-.285716,.497873,.682131,.814251,-.280051,.476845,.716396,.833057,-.272873,.453449,.751503,.84959,-.263982,.427857,.786085,.867022,-.252745,.400335,.821355,.882277,-.239655,.371304,.85646,.895375,-.225386,.340397,.890828,.909347,-.209587,.310005,.923532,.921885,-.193433,.2796,.956419,.932127,-.176135,.247276,.989445,.941869,-.157872,.216186,1.02221,.949735,-.137577,.185602,1.05195,.956617,-.115285,.155767,1.07822,.961974,-.0928418,.126103,1.10149,.96972,-.0700592,.0956758,1.12207,.98012,-.0474671,.0643269,1.1408,.990825,-.0238113,.0320863,1.1577,.999876,381574e-9,-812203e-10,1.17403,.367636,-961342e-11,.469176,753287e-11,.380377,-244772e-9,.485434,191797e-9,.380416,-978857e-9,.485475,767015e-9,.380376,-.00220165,.485435,.00172522,.380419,-.00391408,.485487,.00306734,.380438,-.00611549,.485505,.00479332,.380462,-.00880558,.485525,.00690391,.380496,-.0119837,.485551,.00940039,.38056,-.0156487,.485605,.0122848,.38064,-.0197988,.485666,.0155601,.380767,-.0244324,.48577,.0192313,.380909,-.0295444,.485871,.0233032,.381142,-.0351321,.48606,.0277861,.381472,-.0411535,.486336,.0326939,.382015,-.0475408,.486833,.0380565,.382523,-.0544395,.487231,.0438615,.383129,-.061784,.487683,.0501332,.383952,-.0695085,.488313,.0568996,.38498,-.0775819,.489077,.0641952,.386331,-.0860443,.490113,.0720324,.387788,-.0948406,.491099,.0804379,.389808,-.103899,.492566,.0894899,.39252,-.113313,.494601,.0992098,.395493,-.123007,.496619,.109641,.399826,-.132859,.499912,.120919,.405341,-.143077,.504061,.133107,.411932,-.153465,.508905,.146263,.420591,-.164108,.515482,.160544,.43101,-.174893,.523191,.176123,.441881,-.185839,.53026,.192757,.453919,-.196633,.537295,.210535,.468715,-.207611,.546156,.229886,.485182,-.218517,.555173,.250543,.501926,-.229249,.562728,.27221,.51785,-.239481,.567494,.294892,.536947,-.249395,.573889,.318987,.557115,-.259,.578831,.344348,.577966,-.268075,.582055,.371223,.599489,-.276115,.583307,.399834,.62479,-.282523,.583902,.431415,.647504,-.287663,.57953,.464301,.670601,-.291538,.573103,.498123,.693539,-.293842,.563731,.532662,.717385,-.294681,.553169,.567925,.741533,-.293717,.539908,.603502,.762142,-.291156,.521902,.639074,.783014,-.28719,.502815,.674439,.805158,-.281773,.482598,.710497,.823646,-.274682,.458949,.7456,.841879,-.266184,.433129,.781085,.859515,-.255682,.406064,.816,.875335,-.242849,.376509,.851074,.890147,-.228329,.345502,.886473,.903144,-.212491,.31428,.920751,.916618,-.195695,.282994,.954606,.927953,-.178267,.251091,.988402,.937414,-.159549,.219107,1.02141,.946823,-.140022,.18896,1.05167,.954651,-.118154,.158667,1.07819,.959955,-.0946636,.128808,1.1025,.96858,-.0711792,.0973787,1.12391,.97938,-.0475046,.0650965,1.14322,.990498,-.024059,.0326267,1.16077,.999844,-512408e-10,112444e-9,1.17727,.316912,-934977e-11,.425996,695559e-11,.356423,-241372e-9,.479108,179562e-9,.356272,-965292e-9,.478897,71811e-8,.356262,-.00217182,.478894,.00161574,.356265,-.00386092,.478895,.00287261,.356278,-.0060324,.478905,.00448907,.356293,-.00868565,.478914,.00646572,.356346,-.0118207,.478965,.00880438,.356395,-.0154355,.479001,.0115066,.356484,-.019529,.479075,.0145762,.356609,-.0240991,.47918,.018018,.356766,-.0291413,.479305,.0218379,.357009,-.0346498,.479512,.0260454,.357424,-.0405462,.479909,.0306657,.357899,-.0468825,.480337,.0357054,.358424,-.0536887,.480771,.0411728,.359041,-.0609416,.481242,.0470841,.359903,-.0685239,.481943,.0534831,.360932,-.0764883,.482741,.0603795,.362196,-.0848364,.483688,.0678028,.363847,-.0935002,.484947,.0758086,.365972,-.102471,.486588,.0844173,.368741,-.111751,.488787,.0937199,.372146,-.121334,.491405,.103732,.377114,-.131147,.495604,.114608,.38226,-.141213,.499436,.126345,.389609,-.151632,.505334,.139116,.397925,-.162073,.51168,.152995,.407824,-.172819,.518876,.168071,.420014,-.183929,.527639,.184495,.434266,-.195032,.537588,.20232,.447352,-.205792,.544379,.221189,.463726,-.216704,.553422,.241616,.481406,-.227531,.562074,.263298,.498707,-.238017,.568227,.286116,.518039,-.247936,.574473,.3101,.538277,-.257437,.579191,.335401,.561166,-.266829,.584807,.362246,.583189,-.275329,.586476,.390609,.606024,-.28234,.585578,.420998,.632419,-.287924,.584496,.454357,.656128,-.291972,.577766,.488233,.679953,-.29456,.56875,.523248,.704654,-.295816,.558388,.559168,.729016,-.295157,.544826,.595326,.752062,-.292779,.528273,.631864,.773138,-.288681,.508482,.667793,.794869,-.283358,.487341,.704035,.815101,-.27608,.46354,.739925,.834212,-.26767,.438672,.775539,.852368,-.257397,.411239,.810895,.870207,-.245689,.3829,.846472,.884063,-.231452,.351496,.881788,.898284,-.215561,.31895,.917438,.912964,-.198208,.287367,.952422,.924666,-.180426,.254487,.987551,.934429,-.161525,.222226,1.02142,.943485,-.141197,.191143,1.05218,.9521,-.120085,.161112,1.07937,.957876,-.0975881,.130982,1.10403,.966943,-.0726842,.0990553,1.12616,.978313,-.0483705,.0662818,1.14619,.990048,-.0239072,.0329243,1.16413,.999984,461885e-9,-772859e-10,1.18099,.321287,-935049e-11,.455413,659662e-11,.332595,-237513e-9,.471437,167562e-9,.332729,-949964e-9,.471618,670192e-9,.332305,-.00213618,.471028,.00150712,.332326,-.00379765,.471055,.00267959,.332344,-.00593353,.471072,.00418751,.332356,-.00854349,.471077,.00603172,.332403,-.0116268,.471121,.00821362,.332461,-.0151824,.47117,.0107357,.332552,-.0192088,.471251,.0136014,.332657,-.0237024,.47133,.0168152,.332835,-.0286615,.471487,.0203853,.333083,-.0340765,.471708,.0243212,.333547,-.0398563,.47219,.0286518,.333989,-.0460916,.472587,.0333763,.334532,-.0527897,.473054,.0385084,.335167,-.0599284,.473568,.0440638,.33608,-.0673514,.474362,.0500962,.337146,-.0752237,.475231,.0566022,.338462,-.083418,.476282,.0636272,.34014,-.0919382,.477615,.0712153,.342341,-.100741,.479404,.079417,.345088,-.109905,.481618,.0882631,.349049,-.119369,.485081,.0978851,.353939,-.129033,.489317,.108336,.359893,-.139038,.494309,.119698,.366945,-.149411,.499983,.132024,.375814,-.159843,.507185,.145558,.387112,-.170664,.516392,.160433,.40023,-.181897,.526519,.176648,.412555,-.192785,.53423,.193922,.427023,-.203663,.542741,.212662,.443685,-.214695,.552066,.232944,.461499,-.225561,.560762,.254495,.480975,-.236257,.569421,.277531,.501,-.24639,.576101,.301724,.521691,-.256101,.581493,.327112,.543478,-.265289,.585221,.353917,.566094,-.273938,.587614,.381941,.589578,-.281679,.587991,.41172,.614583,-.287655,.585928,.444148,.641813,-.292228,.582092,.478617,.666189,-.295172,.57398,.51397,.690475,-.29648,.561676,.550118,.715543,-.296203,.548758,.586933,.740405,-.293999,.532792,.62384,.762183,-.28998,.512735,.660723,.786069,-.28478,.492402,.69807,.806812,-.277568,.469058,.734422,.826987,-.268951,.443017,.770946,.844588,-.259049,.415501,.80699,.863725,-.2471,.387328,.842107,.879137,-.234157,.356108,.878078,.894634,-.218719,.324315,.914058,.909162,-.201293,.291813,.949922,.92072,-.18267,.258474,.985337,.93158,-.163212,.225593,1.0205,.941238,-.142771,.193986,1.05273,.949293,-.120956,.163392,1.08075,.956226,-.0985743,.132934,1.10559,.96546,-.075118,.101255,1.12823,.977403,-.0497921,.0675441,1.149,.989648,-.0241574,.0334681,1.16765,1.00001,5762e-7,-184807e-9,1.18519,.303474,-916603e-11,.4542,61243e-10,.308894,-232869e-9,.462306,155592e-9,.309426,-931661e-9,.463093,622499e-9,.308643,-.0020949,.461933,.00139979,.308651,-.0037242,.461941,.00248874,.308662,-.00581873,.46195,.00388933,.308687,-.00837818,.461974,.00560247,.308728,-.0114016,.462011,.00762948,.308789,-.0148884,.462067,.00997326,.308882,-.0188369,.462151,.0126375,.309007,-.0232436,.462263,.0156271,.30918,-.0281054,.462417,.0189498,.309442,-.0334065,.462667,.0226167,.309901,-.0390589,.463162,.0266614,.310331,-.0452042,.463555,.0310715,.310858,-.0517735,.464019,.0358698,.311576,-.0587359,.464669,.0410848,.312436,-.0660383,.465406,.0467453,.313526,-.0737266,.466339,.0528718,.314903,-.0817574,.467504,.0595039,.316814,-.090167,.469226,.0666888,.318965,-.0987555,.470981,.0744658,.322077,-.107792,.473814,.082912,.325947,-.117098,.477241,.0920846,.331008,-.126602,.48184,.102137,.337893,-.136619,.488334,.113135,.345106,-.146838,.494415,.12511,.355111,-.157357,.503275,.138356,.365095,-.167955,.510966,.152686,.378344,-.179157,.521508,.16856,.391599,-.190143,.530455,.18561,.407786,-.20123,.541275,.204308,.425294,-.212456,.551784,.224623,.444021,-.223568,.561493,.246172,.463418,-.234154,.569886,.268979,.484077,-.244546,.577116,.293411,.505513,-.254301,.582914,.318936,.527672,-.263564,.587208,.345856,.550565,-.272332,.589277,.374054,.573656,-.280011,.588426,.403276,.59827,-.286924,.587504,.43474,.624731,-.291994,.583401,.468767,.652396,-.295159,.576997,.504411,.67732,-.296954,.565863,.54114,.703147,-.296877,.552316,.57816,.728715,-.295147,.536773,.616124,.752448,-.291275,.51771,.653885,.775169,-.285905,.496087,.691537,.799307,-.279064,.474232,.729251,.819482,-.270294,.447676,.766267,.837659,-.260032,.419656,.802616,.856903,-.248497,.391328,.838583,.873325,-.235252,.360285,.874711,.889788,-.221126,.329215,.91077,.904486,-.204304,.296392,.94653,.917711,-.185562,.262159,.983828,.928969,-.165635,.229142,1.01955,.939707,-.14442,.19673,1.05317,.948167,-.122147,.165095,1.0823,.955222,-.099098,.13451,1.10791,.964401,-.0755332,.102476,1.1312,.976605,-.0513817,.0689667,1.15218,.989085,-.0258499,.034506,1.17129,.999908,617773e-9,-271268e-9,1.18961,.285803,-905752e-11,.452348,572272e-11,.284689,-22732e-8,.450581,143626e-9,.285263,-910214e-9,.451482,575099e-9,.285302,-.00204784,.451553,.00129395,.285318,-.00364057,.451574,.0023006,.28533,-.00568813,.451585,.00359547,.285361,-.00819001,.451618,.00517934,.285397,-.0111458,.45165,.007054,.285447,-.0145536,.451688,.00922167,.285527,-.0184127,.451758,.0116869,.285688,-.0227207,.451929,.0144555,.28584,-.0274712,.452055,.0175341,.286136,-.0326278,.452369,.0209406,.286574,-.0381792,.452853,.0246965,.287012,-.0441879,.453272,.0287996,.287542,-.0506096,.453752,.033268,.288299,-.0573634,.454488,.0381504,.289186,-.0645458,.455294,.0434447,.290302,-.0720405,.456301,.0491973,.291776,-.0799046,.457648,.0554453,.29372,-.088117,.459483,.0622311,.296052,-.0965328,.461571,.0695992,.299563,-.105409,.465085,.077658,.30335,-.114553,.468506,.0864176,.309167,-.123917,.474423,.0961078,.31529,-.13381,.47995,.106643,.324163,-.144021,.488592,.118322,.333272,-.154382,.496461,.131133,.344224,-.165015,.50562,.145208,.357733,-.176168,.516719,.16073,.373046,-.187468,.528513,.177807,.38788,-.198488,.537713,.196072,.405133,-.209545,.547999,.21605,.423845,-.220724,.55759,.237484,.443777,-.231518,.566246,.26039,.464824,-.242035,.574326,.284835,.486635,-.251898,.58037,.310518,.51012,-.261304,.58568,.337678,.535301,-.270384,.590197,.366242,.559193,-.27841,.590569,.395873,.583544,-.285325,.588161,.426857,.608834,-.291113,.584249,.459477,.635753,-.294882,.57763,.494734,.664367,-.297088,.569479,.532023,.689688,-.297364,.555064,.569629,.715732,-.295949,.539522,.608124,.741307,-.292259,.521613,.646231,.764949,-.287063,.49969,.684938,.788599,-.28012,.476747,.723548,.81048,-.27153,.45116,.761135,.831372,-.261289,.424101,.798916,.850092,-.249559,.39443,.835952,.867777,-.236348,.363849,.871606,.884632,-.221569,.332477,.907843,.90047,-.20618,.300667,.944187,.914524,-.188771,.266552,.981371,.926892,-.168362,.232349,1.01841,.937951,-.146761,.199359,1.05308,.947236,-.123813,.1675,1.0839,.954367,-.099984,.136166,1.11047,.963907,-.0759278,.103808,1.13414,.976218,-.0511367,.0697061,1.15575,.988772,-.0267415,.0352529,1.17531,.999888,-520778e-9,289926e-9,1.19389,.263546,-883274e-11,.441896,526783e-11,.262352,-221849e-9,.439889,132311e-9,.262325,-886683e-9,.439848,528824e-9,.26228,-.00199476,.439765,.00118975,.262372,-.00354671,.439922,.00211568,.26239,-.00554141,.439941,.00330652,.262412,-.00797888,.439961,.00476346,.262453,-.0108584,.440002,.00648818,.262528,-.0141788,.440085,.0084835,.262615,-.017938,.440166,.0107533,.262744,-.0221346,.440291,.0133044,.262939,-.026762,.440493,.0161445,.263277,-.0317573,.440889,.0192974,.26368,-.0371832,.441338,.0227699,.264106,-.0430371,.441753,.0265698,.264624,-.0493035,.442227,.0307178,.265378,-.0558669,.442985,.0352616,.266253,-.0628718,.443795,.0401968,.267478,-.0701569,.445008,.04559,.269062,-.077845,.446599,.0514539,.270926,-.0857941,.448349,.0578382,.273693,-.0940773,.451221,.0648363,.276746,-.102704,.454097,.0724389,.281693,-.111735,.459517,.0808744,.287335,-.121004,.46531,.0901551,.29448,-.130734,.472605,.100371,.30257,-.140777,.480251,.111644,.312465,-.15111,.489444,.124111,.324856,-.16189,.500919,.137979,.33774,-.172946,.511317,.153163,.35255,-.184152,.522684,.169817,.367786,-.19522,.53248,.187886,.385474,-.20632,.543326,.207634,.404976,-.217744,.554109,.229165,.425203,-.228691,.563395,.252068,.446704,-.239299,.571565,.276471,.468951,-.249348,.577935,.302323,.493487,-.258933,.584309,.329882,.517861,-.268009,.58773,.358525,.543309,-.276238,.589612,.388585,.569704,-.28356,.589294,.419787,.594871,-.289497,.585137,.452114,.622555,-.294452,.580356,.486466,.651167,-.296918,.57185,.523079,.677332,-.297647,.558428,.5611,.703718,-.296321,.542232,.599592,.730262,-.293339,.524541,.639138,.754304,-.288036,.502691,.677978,.778051,-.281018,.479212,.716537,.801557,-.272414,.454071,.75586,.822559,-.262419,.425952,.794477,.843051,-.250702,.397313,.832664,.86232,-.237264,.366534,.869876,.879044,-.222716,.334816,.906973,.896362,-.206827,.303143,.943558,.910342,-.189659,.269699,.979759,.924119,-.171108,.236411,1.01718,.935374,-.149579,.202224,1.05289,.944295,-.126295,.16989,1.08496,.952227,-.101511,.138089,1.11256,.962041,-.0766392,.105053,1.1375,.97528,-.0511967,.070329,1.15983,.988476,-.025463,.0351268,1.17987,.999962,286808e-10,145564e-10,1.19901,.227089,-841413e-11,.404216,472707e-11,.239725,-215083e-9,.426708,120833e-9,.239904,-860718e-9,.427028,483555e-9,.239911,-.00193661,.427039,.00108806,.239914,-.00344276,.42704,.00193457,.239933,-.00537907,.427064,.00302363,.239944,-.00774482,.427065,.00435604,.239993,-.01054,.427122,.00593398,.240052,-.0137626,.427179,.00775987,.240148,-.0174115,.427279,.00983854,.240278,-.021484,.42741,.0121763,.240472,-.0259729,.427618,.0147827,.240839,-.0308131,.428086,.0176837,.241201,-.0360893,.428482,.0208775,.241626,-.0417723,.428907,.0243821,.242207,-.0478337,.42952,.0282228,.24298,-.0542199,.430332,.0324333,.243881,-.0610015,.431222,.0370252,.245123,-.0680874,.432512,.0420535,.24667,-.0755482,.434088,.0475414,.248779,-.0832873,.436323,.0535542,.251665,-.0913546,.439509,.0601716,.255305,-.0998489,.443478,.0674282,.260049,-.108576,.448713,.0754673,.266192,-.117754,.455524,.084339,.273158,-.127294,.4627,.0941683,.282131,-.137311,.472068,.10515,.293332,-.147736,.483565,.117402,.304667,-.158357,.493702,.130824,.317785,-.169274,.504708,.145724,.333245,-.180595,.517107,.16215,.349843,-.191892,.528849,.180149,.367944,-.203168,.540301,.199746,.387579,-.214443,.551514,.221047,.408247,-.225624,.560906,.243981,.43014,-.236422,.56959,.268513,.452669,-.24654,.576098,.294409,.476196,-.256157,.580925,.322002,.501157,-.265289,.584839,.351052,.527632,-.273671,.587614,.3812,.555754,-.281254,.589119,.412994,.581682,-.287448,.585204,.445498,.608196,-.292614,.579006,.479505,.635661,-.296068,.571297,.514643,.664999,-.297395,.560855,.552213,.691039,-.296645,.544525,.591365,.7179,-.293785,.526535,.630883,.744059,-.289089,.50545,.670932,.76863,-.282239,.482514,.710904,.793273,-.273688,.457246,.750259,.814731,-.26328,.428872,.78948,.835603,-.251526,.399384,.828597,.85489,-.238339,.368811,.866892,.872828,-.223607,.336617,.90563,.889462,-.207538,.303997,.943538,.904929,-.190297,.270812,.980591,.919101,-.172034,.237453,1.01935,.930536,-.152058,.204431,1.05498,.941223,-.129515,.172495,1.08717,.94982,-.104263,.140175,1.11551,.960592,-.0781944,.106465,1.14098,.974629,-.051688,.0711592,1.16418,.98811,-.0253929,.0354432,1.18465,1.00004,804378e-9,-330876e-9,1.20462,.214668,-821282e-11,.406619,433582e-11,.218053,-208144e-9,.413025,109887e-9,.217987,-832212e-9,.412901,439362e-9,.217971,-.00187246,.412876,988623e-9,.217968,-.00332855,.41286,.00175772,.217985,-.00520055,.412882,.00274729,.218014,-.00748814,.412916,.00395842,.218054,-.0101901,.412957,.00539274,.218106,-.0133057,.413005,.00705348,.218217,-.0168342,.413139,.00894581,.218338,-.0207707,.413258,.0110754,.21855,-.0251001,.413509,.0134551,.218913,-.0297861,.413992,.0161081,.219265,-.0348956,.414383,.0190307,.219696,-.0403909,.414839,.0222458,.220329,-.0462003,.415567,.025792,.220989,-.0524208,.41621,.0296637,.222027,-.058948,.417385,.0339323,.223301,-.0658208,.418779,.0386055,.224988,-.0730347,.420665,.0437355,.227211,-.0805274,.423198,.0493844,.230131,-.088395,.426566,.0556135,.233908,-.0966208,.43091,.0624829,.239092,-.105223,.437148,.0701636,.245315,-.11424,.444302,.0786949,.253166,-.12368,.453262,.0882382,.262374,-.133569,.463211,.0988682,.273145,-.143836,.474271,.110727,.285512,-.154577,.4863,.123945,.299512,-.165501,.498817,.138581,.314287,-.176698,.510341,.154676,.331083,-.188066,.522583,.172459,.349615,-.199597,.534879,.191979,.369318,-.210843,.546083,.21309,.390377,-.222068,.5562,.235998,.412411,-.233059,.564704,.260518,.435715,-.24357,.572314,.286795,.461196,-.253356,.579395,.314559,.485587,-.262362,.581985,.343581,.511908,-.270895,.584347,.374367,.539798,-.278452,.58505,.406015,.567974,-.284877,.583344,.439168,.594303,-.290124,.577348,.473005,.622951,-.294183,.570751,.508534,.652404,-.296389,.561541,.544764,.679291,-.296605,.546426,.582927,.706437,-.294095,.528599,.622681,.734485,-.28978,.508676,.663567,.758841,-.283363,.484768,.704092,.78537,-.275015,.460434,.745101,.807315,-.264689,.432166,.784712,.8271,-.252597,.401807,.824241,.849191,-.239154,.371458,.863803,.867046,-.224451,.338873,.903063,.8852,-.208342,.306175,.942763,.901771,-.190684,.272759,.981559,.915958,-.172105,.239306,1.02048,.928046,-.152214,.206071,1.05765,.939961,-.130247,.17367,1.08999,.948711,-.10672,.142201,1.11829,.959305,-.0808688,.108454,1.14467,.973009,-.0539145,.0728109,1.16839,.987631,-.0262947,.0360625,1.19004,.999978,.00132758,-559424e-9,1.21058,.193925,-793421e-11,.391974,392537e-11,.196746,-200315e-9,.397675,991033e-10,.19667,-801099e-9,.397521,396342e-9,.196633,-.00180246,.397445,891829e-9,.196654,-.00320443,.397482,.00158582,.196659,-.00500647,.39748,.00247867,.196683,-.0072086,.397506,.00357167,.196728,-.00981001,.397562,.00486675,.196792,-.0128096,.397633,.00636707,.19689,-.0162055,.397746,.00807752,.197017,-.0199943,.397884,.0100052,.19729,-.024139,.39827,.0121691,.197583,-.0286671,.398639,.0145755,.197927,-.0335858,.399034,.0172355,.198383,-.0388806,.399554,.0201718,.199002,-.0444736,.400289,.0234194,.199739,-.0504583,.401111,.026984,.200784,-.056729,.402349,.0309217,.202075,-.0633643,.403841,.0352496,.203898,-.0703247,.406076,.0400313,.206199,-.0775565,.408841,.0453282,.209252,-.085184,.41259,.0511794,.213638,-.0931994,.418288,.0577459,.21881,-.101617,.424681,.0650508,.225642,-.11052,.433429,.0732759,.233717,-.119772,.442897,.0824683,.242823,-.129505,.452888,.0927484,.254772,-.139906,.466407,.104417,.266603,-.150402,.477413,.117211,.28073,-.161395,.490519,.131598,.295399,-.172465,.50201,.147407,.312705,-.183982,.515311,.165031,.331335,-.195532,.52786,.184336,.351037,-.206971,.5392,.205361,.372175,-.218117,.54941,.228043,.394548,-.229327,.558642,.25267,.419598,-.240052,.567861,.279071,.443922,-.249937,.573332,.306882,.471495,-.259407,.58013,.33661,.496769,-.267749,.580564,.367328,.524951,-.275524,.581696,.399753,.55318,-.282148,.579885,.433134,.581577,-.287533,.575471,.467534,.609231,-.291612,.567445,.502943,.637478,-.293911,.557657,.53871,.667795,-.295096,.546535,.576568,.694272,-.294073,.529561,.614929,.722937,-.290386,.510561,.655909,.749682,-.284481,.487846,.697663,.774754,-.276188,.462487,.738515,.799301,-.266215,.43481,.779802,.820762,-.254116,.404879,.820045,.843231,-.240393,.374559,.860294,.861857,-.225503,.341582,.900965,.880815,-.209382,.308778,.941727,.89766,-.19155,.275232,.980916,.912926,-.172346,.240938,1.02162,.926391,-.151799,.207223,1.0597,.938429,-.129968,.17484,1.09291,.947834,-.10651,.142984,1.12248,.958432,-.0824098,.109902,1.149,.972402,-.0565242,.0744454,1.1733,.987191,-.028427,.0373794,1.19538,.999975,385685e-10,-4203e-8,1.21676,.178114,-766075e-11,.385418,354027e-11,.176074,-191966e-9,.381002,887135e-10,.17601,-767549e-9,.380861,354715e-9,.17598,-.00172696,.380798,798168e-9,.175994,-.00307012,.380824,.00141928,.176017,-.00479684,.380858,.00221859,.176019,-.00690648,.380839,.00319714,.176072,-.00939888,.380913,.0043572,.176131,-.0122726,.380979,.005702,.176239,-.0155264,.38112,.00723689,.176371,-.0191551,.381272,.00896907,.176638,-.023117,.381669,.0109194,.176912,-.0274633,.382015,.0130903,.177279,-.032173,.382476,.0154949,.17774,-.0372219,.383041,.0181669,.178344,-.0426132,.38378,.0211209,.179153,-.0483309,.384773,.0243899,.180197,-.0543447,.386076,.0280062,.181581,-.0607122,.387809,.032004,.18344,-.0673855,.390205,.036453,.186139,-.0743989,.393944,.0414162,.189432,-.0817731,.39832,.0469394,.193795,-.0895464,.404188,.0531442,.199641,-.0978264,.4121,.0601374,.206679,-.106499,.421425,.0680078,.214865,-.115654,.431504,.076919,.224406,-.125268,.442526,.0868835,.235876,-.135475,.455465,.0981875,.248335,-.146023,.4681,.110759,.262868,-.157016,.482069,.124885,.278962,-.168245,.496182,.140645,.295082,-.17958,.507401,.157838,.313738,-.191227,.520252,.17695,.333573,-.202718,.531708,.197817,.356433,-.214424,.544509,.220785,.378853,-.225492,.55373,.245306,.402717,-.236236,.561348,.271593,.428375,-.246568,.568538,.299776,.454724,-.255941,.573462,.329433,.482291,-.264511,.576356,.360598,.509706,-.272129,.576446,.393204,.538805,-.278979,.575298,.427227,.568919,-.284528,.572154,.462157,.596804,-.288801,.564691,.497997,.625987,-.291334,.555134,.534467,.656414,-.292722,.545051,.571736,.683916,-.292185,.528813,.610158,.711809,-.290043,.51106,.649061,.739547,-.285246,.490103,.690081,.766914,-.277647,.465523,.732554,.791375,-.267603,.437718,.773982,.814772,-.256109,.40882,.81609,.836691,-.242281,.377823,.856849,.856984,-.227155,.34496,.898363,.876332,-.210395,.311335,.939471,.894988,-.192612,.277703,.980799,.911113,-.173236,.243019,1.02215,.924092,-.152258,.209037,1.06139,.936828,-.129575,.175909,1.09635,.946869,-.10594,.143852,1.12707,.958284,-.081318,.110289,1.15419,.972325,-.0556133,.0747232,1.17909,.986878,-.0297899,.0383149,1.20163,.999936,-.00197169,912402e-9,1.22338,.151174,-720365e-11,.351531,309789e-11,.155594,-18279e-8,.361806,78608e-9,.156099,-731569e-9,.362982,314615e-9,.156053,-.00164578,.362869,707845e-9,.156093,-.0029261,.362961,.00125884,.156099,-.00457155,.362959,.00196783,.15612,-.00658224,.362982,.00283622,.156168,-.00895774,.363048,.00386625,.156221,-.0116962,.363101,.00506109,.156324,-.0147973,.363241,.00642675,.156476,-.0182503,.363448,.00797175,.156731,-.0220266,.36384,.00971484,.156994,-.026176,.364179,.0116575,.157341,-.0306701,.36462,.0138207,.157867,-.0354591,.365364,.0162356,.15846,-.0406141,.366111,.0189092,.159308,-.0460519,.367248,.021885,.160426,-.0518096,.368767,.0252004,.161877,-.0578906,.370745,.0288825,.163995,-.0642812,.373831,.0330139,.16655,-.0710067,.377366,.0376283,.170237,-.0781522,.382799,.0428493,.175096,-.0857172,.389915,.0487324,.181069,-.0938025,.398487,.0554214,.188487,-.102363,.408799,.0630189,.197029,-.111343,.419991,.071634,.206684,-.120812,.431455,.0812797,.218698,-.131033,.445746,.0923651,.230726,-.141373,.457471,.104545,.245516,-.152387,.472388,.118449,.261551,-.163628,.486671,.133923,.277437,-.174814,.49762,.150849,.296662,-.186713,.51162,.169924,.31795,-.198513,.525435,.190848,.339422,-.210119,.536267,.213504,.362143,-.221354,.545982,.237947,.387198,-.23224,.555364,.264427,.412349,-.24257,.561489,.292519,.439274,-.252284,.566903,.322561,.466779,-.261023,.569614,.353952,.496011,-.26899,.571589,.387278,.524964,-.275498,.570325,.421356,.556518,-.281449,.568792,.457314,.584363,-.285526,.560268,.493199,.614214,-.28844,.55205,.530276,.645684,-.289777,.541906,.56855,.673446,-.289722,.526464,.606927,.701924,-.287792,.509872,.645945,.73037,-.284315,.490649,.685564,.757405,-.278804,.467964,.726511,.784025,-.269543,.441468,.768601,.808255,-.258117,.41216,.811321,.830739,-.244728,.380606,.853496,.851914,-.229428,.348111,.895374,.872586,-.212508,.314732,.937674,.891581,-.194025,.280338,.979869,.907641,-.174711,.245203,1.02253,.922233,-.153509,.21077,1.06371,.935878,-.130418,.177399,1.09972,.946338,-.105558,.144507,1.13124,.957265,-.080059,.110508,1.15973,.971668,-.0539766,.0742311,1.18515,.9866,-.0277101,.0375224,1.20858,1.00021,-515531e-9,135226e-9,1.23135,.137468,-686011e-11,.345041,273315e-11,.13703,-173378e-9,.343936,690761e-10,.136986,-693048e-9,.34383,276126e-9,.136964,-.00155931,.343761,621337e-9,.137003,-.00277211,.343863,.00110494,.137012,-.00433103,.343868,.00172744,.137043,-.00623606,.343916,.00249022,.13709,-.0084868,.343986,.00339559,.137145,-.0110814,.344045,.00444687,.137242,-.0140187,.344177,.00565007,.137431,-.0172713,.344491,.00701868,.137644,-.0208605,.344805,.00856042,.13791,-.024792,.345172,.0102863,.138295,-.0290461,.345734,.0122185,.138764,-.0335957,.346371,.0143771,.139415,-.038467,.347298,.0167894,.140272,-.0436176,.348527,.0194895,.141457,-.0491016,.350276,.0225043,.14303,-.0548764,.352646,.0258962,.145289,-.0610096,.356206,.0297168,.148502,-.0674777,.361488,.0340562,.152188,-.074345,.367103,.0389534,.157359,-.0817442,.375247,.0445541,.16379,-.0896334,.385064,.0509535,.171376,-.098005,.396082,.0582611,.179901,-.106817,.407418,.06654,.189892,-.116239,.420031,.075994,.201838,-.12627,.434321,.0867239,.214311,-.136701,.447631,.0987517,.228902,-.147616,.462046,.112353,.245107,-.158871,.476942,.127605,.262292,-.170261,.490285,.144469,.281215,-.182017,.503783,.163282,.301058,-.193729,.515505,.183873,.322752,-.205512,.52682,.206466,.347547,-.217214,.539473,.231194,.370969,-.227966,.546625,.257288,.397533,-.238555,.55472,.285789,.42398,-.248278,.559468,.315746,.452928,-.257422,.564095,.347724,.482121,-.265306,.565426,.380922,.510438,-.272043,.563205,.415639,.541188,-.277614,.561087,.451702,.571667,-.281927,.554922,.48845,.602432,-.285015,.546838,.526442,.634126,-.286512,.537415,.564896,.662816,-.286388,.522906,.604037,.692411,-.284734,.507003,.643795,.720946,-.281297,.488398,.68298,.748293,-.276262,.466353,.723466,.776931,-.269978,.443573,.764565,.801065,-.260305,.415279,.805838,.825843,-.247426,.384773,.849985,.84807,-.232437,.352555,.893174,.869122,-.215806,.318642,.936564,.888963,-.197307,.28381,.980253,.905547,-.177203,.247888,1.02463,.918554,-.155542,.212904,1.06714,.931395,-.131948,.1787,1.10451,.941749,-.106723,.145902,1.13694,.954551,-.0804939,.111193,1.1666,.970279,-.0534239,.0744697,1.19249,.986117,-.0257452,.0368788,1.21665,.999938,.00190634,-.0010291,1.23981,.118493,-647439e-11,.32272,23772e-10,.118765,-163023e-9,.323456,598573e-10,.118772,-65212e-8,.323477,239447e-9,.118843,-.00146741,.323657,538881e-9,.118804,-.00260846,.323553,95826e-8,.118826,-.00407576,.323595,.00149845,.118846,-.00586826,.323617,.00216047,.118886,-.00798578,.32367,.00294679,.118947,-.0104273,.323753,.00386124,.119055,-.0131909,.323922,.00490999,.119241,-.0162444,.324251,.00610804,.11944,-.0196339,.324544,.00745805,.119739,-.0233378,.325026,.00897805,.12011,-.0273179,.325586,.0106895,.120571,-.0316143,.326231,.0126073,.12124,-.0361939,.327264,.0147654,.122162,-.0410511,.328733,.0172001,.123378,-.0462233,.330659,.0199375,.125183,-.0517109,.333754,.0230498,.127832,-.0575652,.338507,.026597,.130909,-.0637441,.343666,.0306345,.135221,-.0704302,.351063,.035273,.14082,-.0776364,.360604,.0406137,.146781,-.0852293,.369638,.0466788,.155121,-.0935351,.3827,.0537628,.16398,-.102234,.39522,.0617985,.173926,-.111465,.40793,.07097,.185137,-.121296,.42105,.0813426,.19826,-.13169,.435735,.0931596,.212938,-.142614,.450932,.106547,.229046,-.153884,.465726,.121575,.246246,-.165382,.479461,.138286,.264637,-.176806,.492106,.15666,.284959,-.188793,.504774,.17728,.308157,-.200763,.518805,.19988,.330951,-.21239,.528231,.224293,.3549,-.223521,.536376,.250541,.381502,-.234169,.544846,.278902,.409529,-.244077,.551717,.309227,.437523,-.253363,.55517,.341426,.467624,-.261659,.557772,.37518,.497268,-.268498,.556442,.41007,.528294,-.274018,.553915,.446445,.559053,-.278169,.549153,.483779,.589329,-.281229,.539878,.522249,.622503,-.282902,.53162,.561754,.652382,-.282815,.518119,.601544,.681847,-.281247,.502187,.641574,.712285,-.277986,.484824,.682633,.740094,-.273017,.463483,.723426,.768478,-.266692,.441299,.763747,.794556,-.258358,.415238,.805565,.819408,-.248807,.386912,.847254,.843411,-.236214,.356165,.891091,.862397,-.219794,.320562,.936174,.883113,-.201768,.285322,.982562,.90023,-.181672,.249713,1.02862,.915192,-.159279,.214546,1.07163,.928458,-.134725,.180285,1.10995,.94069,-.10913,.147119,1.14354,.953409,-.0821315,.112492,1.17372,.969537,-.0542677,.0752014,1.20043,.985612,-.0259096,.0370361,1.22528,.999835,.00298198,-.00151801,1.24959,.10097,-602574e-11,.300277,202619e-11,.101577,-152164e-9,.302077,511662e-10,.101572,-608889e-9,.302066,204751e-9,.101566,-.00136997,.302047,460753e-9,.101592,-.00243557,.302114,819497e-9,.101608,-.0038053,.30214,.00128154,.101627,-.00547906,.30216,.0018483,.101669,-.00745647,.302224,.00252223,.101732,-.00973615,.302318,.00330716,.101844,-.0123097,.302513,.00421061,.102025,-.0151681,.30285,.00524481,.102224,-.0183334,.303166,.0064154,.102515,-.0217819,.303654,.00774063,.102886,-.0255067,.304243,.0092398,.103395,-.029514,.305089,.0109339,.104109,-.0337912,.306301,.0128561,.105074,-.0383565,.30798,.0150338,.10654,-.0432132,.310726,.0175228,.108478,-.0484244,.314351,.0203648,.111015,-.0539339,.319032,.0236325,.114682,-.0598885,.32605,.0274188,.11911,-.0663375,.334109,.0317905,.124736,-.0733011,.344013,.0368502,.131479,-.0807744,.355358,.0427104,.139283,-.0888204,.367614,.0494788,.148054,-.0973394,.380072,.0572367,.159037,-.10665,.395678,.0662704,.169794,-.116221,.40795,.0763192,.18314,-.126632,.423546,.087956,.197515,-.137383,.438213,.101042,.213514,-.148641,.453248,.115827,.23065,-.160117,.46688,.132283,.249148,-.171807,.479962,.150644,.270219,-.183695,.494618,.171073,.292338,-.195574,.506937,.193378,.314999,-.207205,.516463,.217585,.340991,-.218955,.528123,.24428,.367982,-.229917,.537025,.272784,.39432,-.239737,.541627,.302742,.423364,-.249048,.546466,.335112,.453751,-.257329,.549466,.369032,.48416,-.264623,.549503,.404577,.515262,-.270411,.547008,.441337,.547036,-.274581,.542249,.479162,.576614,-.277266,.533015,.517904,.611143,-.279144,.525512,.558508,.640989,-.279001,.51154,.598995,.671182,-.277324,.495641,.639935,.700848,-.273908,.477526,.681017,.729862,-.269063,.457955,.722764,.758273,-.262282,.434846,.764349,.784121,-.254281,.409203,.806206,.809798,-.24505,.382694,.848617,.834953,-.233861,.354034,.892445,.856817,-.221308,.321764,.936263,.877609,-.205996,.288118,.982401,.897489,-.186702,.253277,1.02975,.913792,-.164618,.217963,1.07488,.92785,-.140023,.183221,1.11487,.940378,-.11328,.149385,1.14947,.95273,-.0853958,.114152,1.1807,.969059,-.0568698,.0769845,1.20912,.985574,-.0276502,.0381186,1.23498,.999943,.00239052,-.00126861,1.25987,.0852715,-560067e-11,.279021,171162e-11,.0854143,-140871e-9,.279483,430516e-10,.0854191,-563385e-9,.2795,172184e-9,.0854188,-.00126753,.279493,387464e-9,.0854229,-.00225337,.279501,68918e-8,.0854443,-.00352086,.279549,.00107803,.0854697,-.00506962,.279591,.00155536,.0855093,-.00689873,.279652,.00212354,.0855724,-.00900821,.279752,.00278703,.0856991,-.0113799,.280011,.0035551,.085855,-.0140314,.280297,.00443449,.0860682,-.016963,.280682,.00543636,.086344,-.0201438,.281159,.0065788,.0867426,-.0235999,.281886,.00787977,.087239,-.0273069,.282745,.0093606,.0879815,-.031269,.284139,.011056,.0891258,-.035531,.28647,.0130065,.0906909,-.0400947,.289708,.0152495,.0927624,-.0449638,.293904,.0178454,.0958376,-.0502427,.300471,.0208915,.0995827,-.0559514,.30806,.0244247,.104526,-.0622152,.317874,.0285721,.110532,-.0690046,.329332,.0334227,.117385,-.0763068,.341217,.0390466,.12522,-.084184,.353968,.0455786,.134037,-.0925248,.366797,.0530773,.144014,-.101487,.380209,.0617424,.156013,-.111273,.395956,.071777,.168872,-.121431,.41053,.0830905,.183089,-.132105,.425073,.0959341,.198763,-.143286,.439833,.110448,.216159,-.154841,.454507,.126769,.234859,-.166588,.468368,.14495,.255879,-.178626,.482846,.165233,.27677,-.190218,.493489,.187217,.301184,-.202227,.506549,.211659,.325852,-.213764,.5158,.237922,.352824,-.22487,.525442,.26632,.380882,-.235246,.532487,.296691,.410137,-.244847,.537703,.329179,.439787,-.253122,.540361,.363135,.472291,-.260517,.542734,.399222,.501856,-.266519,.538826,.436352,.534816,-.270905,.535152,.474505,.565069,-.273826,.525979,.513988,.597154,-.275333,.516394,.554852,.630473,-.275314,.506206,.596592,.660574,-.273323,.489769,.638117,.692015,-.270008,.472578,.680457,.720647,-.265001,.452134,.723008,.750528,-.258311,.430344,.765954,.777568,-.250046,.405624,.809012,.80387,-.240114,.378339,.852425,.828439,-.228737,.349877,.895346,.851472,-.216632,.318968,.940695,.873906,-.202782,.287489,.987235,.89467,-.187059,.254394,1.03348,.912281,-.168818,.221294,1.07812,.927358,-.146494,.18675,1.11928,.940385,-.120009,.152322,1.15609,.952672,-.0917183,.117514,1.18875,.968496,-.0620321,.0797405,1.21821,.985236,-.0314945,.0402383,1.24523,.99998,-575153e-9,110644e-9,1.27133,.0702429,-512222e-11,.255273,140947e-11,.0702981,-128826e-9,.255469,354488e-10,.0703691,-515562e-9,.255727,141874e-9,.0703805,-.00116,.255754,31929e-8,.0703961,-.00206224,.255813,567999e-9,.0704102,-.00322223,.255839,88871e-8,.0704298,-.00463928,.255863,.00128272,.0704759,-.00631375,.255953,.00175283,.0705434,-.00824317,.256079,.00230342,.0706693,-.010412,.25636,.0029443,.0708189,-.0128439,.256647,.00368031,.0710364,-.0155177,.257084,.00452614,.0713223,-.0184374,.257637,.00549706,.0717182,-.0216002,.258416,.00661246,.072321,-.0249966,.259699,.00790147,.0731446,-.0286566,.261475,.0093884,.0743352,-.0325888,.264132,.0111186,.0760676,-.036843,.26815,.013145,.078454,-.0414292,.273636,.0155251,.0818618,-.0464634,.281653,.0183525,.0857382,-.0519478,.289992,.0216642,.0908131,-.0579836,.30066,.0255956,.0967512,-.0645124,.312204,.0301954,.103717,-.0716505,.325001,.0356017,.111596,-.0793232,.338129,.041896,.120933,-.087645,.352853,.0492447,.130787,-.096492,.366192,.0576749,.142311,-.105973,.380864,.0673969,.155344,-.116182,.396575,.0785899,.169535,-.126815,.411443,.0912377,.185173,-.138015,.426256,.105607,.201755,-.149325,.439607,.121551,.221334,-.161207,.455467,.139608,.241461,-.173162,.469096,.159591,.26294,-.18504,.481014,.18156,.286776,-.196881,.493291,.205781,.311596,-.208311,.503556,.231819,.338667,-.219671,.513268,.260274,.366021,-.230451,.519414,.290862,.395875,-.240131,.526766,.323196,.425564,-.248566,.52905,.357071,.457094,-.256195,.530796,.393262,.488286,-.262331,.528703,.430797,.522291,-.267141,.52727,.470231,.554172,-.270411,.519848,.510477,.586427,-.271986,.510307,.551594,.619638,-.27192,.499158,.593849,.650656,-.269817,.483852,.636314,.68284,-.266267,.467515,.679679,.714356,-.26113,.44931,.723884,.742717,-.254067,.425789,.767245,.770894,-.245652,.401144,.811819,.797358,-.235554,.374224,.856315,.823377,-.223896,.346167,.901077,.847456,-.210865,.316056,.946502,.870697,-.196574,.284503,.993711,.891068,-.180814,.251628,1.04134,.909267,-.163314,.219065,1.08609,.925653,-.143304,.186446,1.12702,.940017,-.121322,.153416,1.16371,.952398,-.0973872,.120334,1.19712,.967568,-.0698785,.08352,1.22791,.984772,-.0390031,.0439209,1.25672,1.00026,-.0070087,.00315668,1.28428,.0556653,-459654e-11,.227325,112556e-11,.0565238,-116382e-9,.230826,284985e-10,.0565717,-465666e-9,.231026,114036e-9,.0565859,-.00104773,.231079,256656e-9,.0565761,-.00186255,.231025,45663e-8,.0565913,-.00291002,.231058,714664e-9,.0566108,-.00418998,.231085,.00103224,.0566532,-.00570206,.231169,.00141202,.0567473,-.00743666,.231417,.00186018,.0568567,-.00940298,.231661,.00238264,.0569859,-.0115991,.231895,.00298699,.0572221,-.0140096,.232456,.00368957,.057519,-.0166508,.233096,.00450303,.0579534,-.01951,.234094,.00544945,.0585922,-.0225991,.235629,.00655564,.0595647,-.0259416,.238106,.00785724,.0609109,-.0295661,.241557,.00939127,.0628751,-.0335126,.246652,.0112198,.0656908,-.0378604,.254091,.0134168,.0691347,-.0426543,.262666,.0160374,.0732165,-.0478967,.272029,.0191514,.0782863,-.0536716,.283007,.0228597,.0843973,-.0600683,.295732,.0272829,.0913598,-.0670095,.308779,.032484,.0994407,-.0745516,.322886,.0385886,.108189,-.082712,.336408,.0457133,.118574,-.0914927,.351692,.0539832,.129989,-.100854,.366502,.0635162,.142722,-.110837,.381675,.0744386,.156654,-.121353,.3963,.0868483,.172151,-.132414,.411477,.100963,.188712,-.143809,.42508,.116795,.208093,-.155765,.441328,.134715,.227936,-.167608,.454328,.154396,.249495,-.179579,.467235,.176179,.27362,-.191488,.480248,.200193,.296371,-.202618,.487886,.225775,.324234,-.214133,.499632,.25441,.353049,-.225212,.509532,.285077,.381785,-.234875,.514265,.317047,.414038,-.244205,.521282,.351874,.445251,-.252145,.522931,.388279,.476819,-.258433,.520947,.425825,.509209,-.263411,.517669,.465104,.542759,-.266732,.512841,.505741,.574822,-.268263,.503317,.547611,.609324,-.268489,.493035,.590953,.641772,-.266941,.478816,.63488,.674049,-.263297,.462863,.679072,.705071,-.257618,.442931,.723487,.734709,-.250625,.421299,.768708,.763704,-.24179,.397085,.814375,.791818,-.231115,.370577,.859907,.817439,-.21922,.34232,.906715,.843202,-.205658,.312627,.953943,.866639,-.190563,.280933,1.00185,.888129,-.173978,.248393,1.05105,.907239,-.155485,.216007,1.09704,.923893,-.134782,.183233,1.13857,.938882,-.11249,.150376,1.17539,.952464,-.0890706,.117177,1.20924,.968529,-.0646523,.0813095,1.24055,.984763,-.038606,.0439378,1.27018,1.00053,-.01238,.00598668,1.29873,.0437928,-409594e-11,.204012,8.79224e-7,.0440166,-103395e-9,.205049,221946e-10,.0440529,-413633e-9,.205225,887981e-10,.0440493,-930594e-9,.2052,199858e-9,.0439884,-.00165352,.204901,355495e-9,.0440716,-.0025849,.205255,556983e-9,.0440968,-.00372222,.205311,805326e-9,.0441359,-.00506478,.205391,.00110333,.0442231,-.00660384,.205638,.00145768,.0443254,-.00835246,.205877,.00187275,.0444832,-.0102992,.20627,.00235938,.0447001,-.0124449,.206796,.0029299,.0450168,-.0147935,.207593,.0036005,.0454816,-.017336,.208819,.00439246,.0462446,-.0201156,.211036,.00533864,.0473694,-.0231568,.214388,.00646984,.0490191,-.0264941,.219357,.00783856,.0512776,-.030184,.226061,.00950182,.0541279,-.0342661,.234094,.0115156,.0578989,-.0388539,.244297,.0139687,.0620835,-.0438735,.254457,.0169015,.0673497,-.04951,.266706,.0204554,.0731759,-.0556263,.278753,.0246606,.0803937,-.0624585,.29309,.0297126,.0879287,-.0697556,.305856,.0355868,.0970669,-.0778795,.321059,.0425768,.106508,-.0863541,.333873,.05056,.11776,-.0955935,.349008,.0598972,.130081,-.105438,.363776,.0706314,.144454,-.115899,.380112,.0828822,.1596,-.126827,.394843,.0967611,.176097,-.138161,.409033,.112381,.194726,-.149904,.424257,.129952,.213944,-.161675,.436945,.149333,.235516,-.173659,.450176,.170892,.260564,-.185963,.466305,.194984,.285183,-.197582,.477328,.220805,.311095,-.208697,.486566,.248694,.338924,-.219519,.494811,.279015,.369757,-.229766,.504065,.311725,.3996,-.238879,.507909,.345844,.430484,-.246802,.509805,.381749,.46413,-.253924,.511436,.420251,.497077,-.259319,.508787,.459957,.530434,-.263297,.50394,.501356,.565725,-.265619,.49804,.544252,.599254,-.265842,.487346,.587856,.631251,-.263978,.472975,.631969,.663972,-.26043,.457135,.677471,.697724,-.255358,.439844,.723744,.727725,-.248308,.417872,.770653,.756417,-.239181,.39273,.817357,.785419,-.22814,.367839,.864221,.81266,-.215681,.339449,.912701,.839391,-.201623,.309279,.962419,.86366,-.185624,.278029,1.0122,.885028,-.16797,.245294,1.06186,.904639,-.148336,.212689,1.10934,.922048,-.12637,.179616,1.15063,.936952,-.102928,.146749,1.18885,.951895,-.0785268,.112733,1.22352,.967198,-.0530153,.0760056,1.25681,.984405,-.02649,.0383183,1.28762,1.00021,70019e-8,-20039e-8,1.31656,.0325964,-355447e-11,.176706,6.55682e-7,.0329333,-899174e-10,.178527,165869e-10,.0329181,-359637e-9,.178453,663498e-10,.0329085,-808991e-9,.178383,149332e-9,.0329181,-.00143826,.178394,265873e-9,.0329425,-.00224678,.178517,416597e-9,.0329511,-.00323575,.17849,603299e-9,.033011,-.00439875,.178695,829422e-9,.0330733,-.00574059,.178843,.00109908,.0331857,-.00725896,.179176,.00141933,.0333445,-.00895289,.179618,.0017999,.0335674,-.0108219,.180238,.00225316,.033939,-.0128687,.181417,.00279765,.0345239,-.015114,.183395,.0034564,.0354458,-.017596,.186616,.00425864,.0368313,-.0203524,.191547,.00524936,.0386115,-.0234105,.197508,.00647033,.0410303,-.0268509,.205395,.00798121,.0442245,-.0307481,.215365,.0098557,.0478659,-.0350863,.225595,.0121417,.0522416,-.0399506,.236946,.0149385,.0574513,-.045357,.249442,.0183189,.0631208,-.0512863,.261222,.0223644,.0701124,-.0579273,.275418,.0272418,.0777331,-.0650652,.288989,.0329458,.0862709,-.0728813,.302546,.0396819,.096103,-.081363,.317164,.04757,.106976,-.0904463,.331733,.0567012,.119175,-.100105,.34661,.067202,.132919,-.110375,.362249,.0792588,.147727,-.121115,.376978,.0928672,.163618,-.132299,.390681,.108228,.182234,-.143887,.406571,.125502,.201809,-.155827,.42042,.144836,.225041,-.168357,.438411,.166706,.247621,-.18004,.450368,.189909,.27097,-.191536,.460083,.215251,.296658,-.203024,.469765,.243164,.325892,-.214056,.481837,.273388,.35406,-.224104,.487474,.305344,.384372,-.233489,.492773,.339741,.41749,-.241874,.498451,.376287,.45013,-.248834,.499632,.414195,.481285,-.254658,.495233,.454077,.519183,-.259367,.496401,.496352,.551544,-.261818,.487686,.538798,.587349,-.262964,.479453,.583626,.621679,-.262128,.467709,.629451,.654991,-.258998,.452123,.67566,.686873,-.254119,.433495,.723248,.719801,-.246946,.413657,.771156,.750355,-.237709,.390366,.81989,.780033,-.226549,.364947,.868601,.809254,-.214186,.337256,.920034,.836576,-.199639,.307395,.971706,.861774,-.183169,.275431,1.02479,.885707,-.165111,.243431,1.07837,.904742,-.144363,.210921,1.12783,.915604,-.121305,.17647,1.17254,.930959,-.0962119,.143106,1.21012,.948404,-.069969,.108112,1.24474,.967012,-.0427586,.0708478,1.27718,.984183,-.0147043,.032335,1.3083,.999577,.0142165,-.00726867,1.3382,.0229227,-299799e-11,.148623,4.62391e-7,.0232194,-758796e-10,.15054,117033e-10,.0232315,-303636e-9,.15063,468397e-10,.0232354,-683189e-9,.150624,105472e-9,.0232092,-.0012136,.150445,187744e-9,.0232523,-.00189765,.150679,294847e-9,.0232828,-.00273247,.150789,428013e-9,.0233371,-.00371287,.150995,591134e-9,.0234015,-.00484794,.15118,787642e-9,.023514,-.00612877,.151562,.00102547,.023679,-.00756125,.152116,.00131351,.0239559,-.00914651,.153162,.00166594,.0244334,-.010904,.155133,.00210182,.025139,-.0128615,.158035,.00264406,.0262598,-.0150628,.162751,.00332923,.0277875,-.0175532,.168944,.00419773,.0298472,-.0203981,.176835,.00530034,.0325444,-.023655,.186686,.00669777,.0355581,-.0272982,.196248,.00842661,.0392841,-.0314457,.207352,.0105854,.0436815,-.0361157,.219279,.0132458,.0485272,-.0412932,.230728,.0164736,.0541574,-.0470337,.242994,.0203715,.0609479,-.0535002,.257042,.0250953,.0685228,-.0605409,.27102,.0306856,.0768042,-.0680553,.28406,.037193,.0864844,-.0765011,.299186,.0449795,.0969415,-.0852674,.3132,.0538316,.108478,-.0947333,.327138,.0641149,.121705,-.10481,.342345,.0759185,.136743,-.115474,.358472,.0894116,.152986,-.126536,.374067,.104562,.170397,-.138061,.388267,.121632,.191392,-.150203,.406467,.140996,.211566,-.161751,.418641,.161696,.233567,-.173407,.430418,.184557,.257769,-.185397,.44277,.210092,.28531,-.197048,.457191,.237827,.311726,-.20784,.464712,.267253,.340537,-.218345,.472539,.299332,.372921,-.228306,.482331,.333988,.402924,-.236665,.484378,.369722,.434475,-.244097,.484717,.407836,.469736,-.250547,.487093,.448465,.505045,-.25511,.485575,.490263,.540262,-.258444,.481225,.534495,.576347,-.259903,.473481,.579451,.608656,-.259572,.4603,.625604,.646679,-.257908,.450341,.674511,.679902,-.253663,.431561,.723269,.714159,-.247419,.412684,.773263,.745345,-.239122,.389388,.824182,.778248,-.228837,.365361,.876634,.807208,-.216197,.337667,.92945,.835019,-.201772,.307197,.985261,.860261,-.185291,.274205,1.04299,.877601,-.165809,.240178,1.09816,.898211,-.143897,.207571,1.14694,.915789,-.119513,.174904,1.19008,.931831,-.0932919,.141423,1.2297,.949244,-.0656528,.105603,1.26553,.967527,-.0370262,.0679551,1.29986,.984139,-.00730117,.0283133,1.33252,.999713,.0234648,-.0121785,1.36397,.0152135,-245447e-11,.122795,3.04092e-7,.0151652,-615778e-10,.122399,76292e-10,.0151181,-245948e-9,.122023,304802e-10,.0151203,-553394e-9,.12203,686634e-10,.015125,-983841e-9,.122037,122463e-9,.0151427,-.00153774,.12214,192706e-9,.0151708,-.0022103,.122237,281219e-9,.0152115,-.00300741,.12238,390804e-9,.0152877,-.00392494,.1227,526317e-9,.015412,-.00496597,.123244,69443e-8,.0156201,-.00613314,.124228,90547e-8,.0159658,-.00744113,.125945,.0011732,.0165674,-.00892546,.129098,.00151888,.017487,-.010627,.133865,.00197007,.018839,-.0126043,.140682,.0025637,.020554,-.0148814,.148534,.00333637,.0226727,-.0175123,.157381,.00433738,.0251879,-.0205266,.166685,.00561664,.0283635,-.0240319,.177796,.00725563,.0318694,-.0279432,.188251,.00928811,.0361044,-.0324313,.200038,.011835,.0406656,-.0373527,.210685,.0149146,.0463846,-.0430132,.224182,.0187254,.0525696,-.0491013,.23634,.0232283,.0598083,-.0559175,.250013,.0286521,.0679437,-.0633657,.263981,.0350634,.0771181,-.0714602,.278072,.0425882,.0881273,-.0803502,.29511,.0514487,.0996628,-.0896903,.309976,.0615766,.112702,-.099644,.325611,.0732139,.126488,-.109829,.339321,.0862324,.142625,-.120859,.35574,.101275,.15953,-.131956,.369845,.117892,.176991,-.143145,.38146,.136205,.199715,-.155292,.40052,.157252,.220787,-.167066,.412055,.179966,.243697,-.178396,.423133,.204418,.272106,-.190433,.439524,.232141,.297637,-.201265,.447041,.261109,.325273,-.211834,.454488,.292627,.357219,-.221889,.465004,.326669,.387362,-.230729,.468527,.362426,.423131,-.23924,.475836,.401533,.45543,-.246067,.475017,.441902,.493393,-.251557,.478017,.484239,.526253,-.255571,.4709,.528586,.560554,-.257752,.463167,.574346,.599306,-.258076,.456452,.621655,.634541,-.256471,.443725,.670492,.668907,-.253283,.428719,.721943,.705619,-.247562,.411348,.772477,.739034,-.240626,.388939,.8264,.771408,-.231493,.36425,.881702,.803312,-.220125,.337321,.9385,.828457,-.206645,.305364,.997437,.854819,-.190664,.273715,1.05693,.878666,-.171429,.242218,1.11251,.898404,-.149235,.209556,1.16398,.917416,-.12435,.176863,1.21014,.933133,-.0972703,.142775,1.25178,.95066,-.0683607,.106735,1.29028,.968589,-.0378724,.0681609,1.32703,.984776,-.00605712,.0273966,1.36158,.99994,.0263276,-.0138124,1.3943,.00867437,-186005e-11,.0928979,1.73682e-7,.00864003,-466389e-10,.0925237,435505e-11,.00864593,-186594e-9,.0925806,174322e-10,.00864095,-419639e-9,.0924903,392862e-10,.00863851,-746272e-9,.0924589,702598e-10,.00868531,-.00116456,.0929,111188e-9,.00869667,-.00167711,.0928529,163867e-9,.00874332,-.00228051,.0930914,23104e-8,.00882709,-.00297864,.0935679,31741e-8,.00898874,-.00377557,.0946165,430186e-9,.00929346,-.00469247,.0967406,580383e-9,.00978271,-.00575491,.100084,783529e-9,.0105746,-.00701514,.105447,.00106304,.0116949,-.00851797,.112494,.00144685,.0130419,-.0102757,.119876,.00196439,.0148375,-.012381,.129034,.00266433,.0168725,-.01482,.137812,.00358364,.0193689,-.0176563,.147696,.00478132,.0222691,-.0209211,.157795,.00631721,.0256891,-.0246655,.168431,.00826346,.0294686,-.0288597,.178587,.0106714,.0340412,-.0336441,.190251,.0136629,.0393918,-.039033,.202999,.0173272,.0453947,-.0450087,.215655,.0217448,.0521936,-.0515461,.228686,.0269941,.0600279,-.058817,.242838,.033272,.0692398,-.0667228,.258145,.0406457,.0793832,-.0752401,.273565,.0492239,.0902297,-.0841851,.287735,.0590105,.102014,-.0936479,.301161,.0702021,.116054,-.103967,.317438,.0832001,.13191,-.114622,.334166,.0977951,.148239,-.125452,.348192,.113985,.165809,-.136453,.361094,.131928,.184616,-.147648,.373534,.151811,.207491,-.159607,.39101,.174476,.230106,-.171119,.402504,.198798,.257036,-.182906,.418032,.225796,.281172,-.193605,.425468,.254027,.312034,-.204771,.440379,.285713,.340402,-.214988,.445406,.319196,.370231,-.224711,.44968,.35537,.407105,-.233516,.460747,.393838,.439037,-.240801,.460624,.433747,.47781,-.24762,.465957,.477234,.510655,-.251823,.460054,.52044,.550584,-.255552,.459172,.567853,.585872,-.257036,.450311,.615943,.620466,-.257535,.437763,.667693,.660496,-.255248,.426639,.718988,.695578,-.251141,.409185,.772503,.732176,-.244718,.39015,.827023,.760782,-.236782,.362594,.885651,.79422,-.225923,.33711,.943756,.824521,-.213855,.308272,1.00874,.854964,-.197723,.278529,1.06764,.878065,-.179209,.246208,1.12836,.899834,-.157569,.21329,1.18318,.918815,-.133206,.181038,1.23161,.934934,-.106545,.146993,1.27644,.952115,-.0780574,.111175,1.31842,.96906,-.0478279,.0728553,1.35839,.985178,-.0160014,.032579,1.39697,1.00039,.0173126,-.0095256,1.43312,.00384146,-124311e-11,.0613583,7.78271e-8,.00390023,-314043e-10,.0622919,196626e-11,.00389971,-125622e-9,.0622632,787379e-11,.00389491,-282352e-9,.0620659,1778e-8,.00391618,-502512e-9,.0624687,320918e-10,.00392662,-784458e-9,.0625113,515573e-10,.00396053,-.00112907,.0628175,778668e-10,.00401911,-.00153821,.0633286,113811e-9,.00414994,-.0020208,.0646443,16445e-8,.00441223,-.00260007,.0673886,237734e-9,.00484427,-.0033097,.0716528,345929e-9,.00549109,-.00418966,.0774998,505987e-9,.00636293,-.00527331,.0844758,739208e-9,.00746566,-.00660428,.0921325,.00107347,.00876625,-.00818826,.0997067,.00153691,.0103125,-.0100811,.107433,.00217153,.0123309,-.0123643,.117088,.00303427,.0146274,-.0150007,.126438,.00416018,.0172295,-.0180531,.135672,.00561513,.0204248,-.0215962,.146244,.007478,.0241597,-.0256234,.157481,.00981046,.0284693,-.0302209,.169125,.0127148,.033445,-.0353333,.181659,.0162453,.0391251,-.0410845,.1944,.0205417,.0454721,-.0473451,.207082,.0256333,.0530983,-.0542858,.221656,.0317036,.0615356,-.0618384,.236036,.0388319,.0703363,-.0697631,.248398,.046974,.0810391,-.0784757,.263611,.0565246,.0920144,-.0873488,.275857,.0671724,.105584,-.0973652,.292555,.0798105,.119506,-.107271,.306333,.0935945,.134434,-.117608,.318888,.109106,.153399,-.128938,.337552,.127074,.171258,-.139944,.349955,.14643,.191059,-.151288,.361545,.168,.215069,-.163018,.378421,.192082,.237838,-.174226,.38879,.217838,.266965,-.186063,.405857,.246931,.292827,-.196909,.414146,.277505,.324352,-.207473,.426955,.310711,.354427,-.217713,.433429,.346794,.389854,-.227183,.443966,.385237,.420749,-.235131,.44471,.424955,.459597,-.242786,.451729,.468446,.495316,-.248767,.45072,.513422,.534903,-.253351,.450924,.560618,.572369,-.256277,.445266,.609677,.612383,-.2576,.438798,.660995,.644037,-.256931,.421693,.713807,.686749,-.254036,.4109,.767616,.719814,-.249785,.390151,.82533,.754719,-.244283,.367847,.888311,.792022,-.235076,.345013,.948177,.822404,-.225061,.316193,1.01661,.853084,-.211113,.287013,1.08075,.879871,-.19449,.255424,1.14501,.901655,-.174023,.222879,1.20203,.919957,-.1509,.18989,1.25698,.938412,-.124923,.15606,1.30588,.953471,-.0968139,.120512,1.3529,.970451,-.066734,.0828515,1.3986,.985522,-.034734,.0424458,1.44148,1.00099,-.00102222,678929e-9,1.48398,965494e-9,-6.27338e-7,.0306409,1.97672e-8,99168e-8,-158573e-10,.0314638,4.99803e-7,991068e-9,-634012e-10,.031363,200682e-11,974567e-9,-14144e-8,.03036,457312e-11,998079e-9,-252812e-9,.031496,860131e-11,.00102243,-396506e-9,.0319955,148288e-10,.00107877,-577593e-9,.0331376,249141e-10,.00121622,-816816e-9,.0359396,423011e-10,.0014455,-.00113761,.0399652,724613e-10,.00178791,-.00156959,.0450556,123929e-9,.00225668,-.00214064,.0508025,208531e-9,.00285627,-.00287655,.0568443,341969e-9,.0035991,-.00380271,.0630892,544158e-9,.00455524,-.00496264,.0702204,842423e-9,.00569143,-.0063793,.0773426,.00126704,.00716928,-.00813531,.0860839,.00186642,.00885307,-.0101946,.0944079,.00267014,.0109316,-.0126386,.103951,.00374033,.0133704,-.0154876,.113786,.0051304,.0161525,-.0187317,.123477,.00688858,.0194267,-.0224652,.133986,.00910557,.0230967,-.0265976,.143979,.0118074,.0273627,-.0312848,.154645,.0151266,.0323898,-.0365949,.166765,.0191791,.0379225,-.0422914,.177932,.0239236,.0447501,-.0487469,.19167,.0296568,.0519391,-.0556398,.203224,.0362924,.0599464,-.0631646,.215652,.0440585,.0702427,-.0714308,.232089,.0531619,.0806902,-.0800605,.245258,.0634564,.0923194,-.0892815,.258609,.0752481,.106938,-.09931,.276654,.0888914,.121238,-.109575,.289847,.104055,.138817,-.120461,.307566,.121266,.15595,-.131209,.320117,.139944,.178418,-.143049,.339677,.161591,.197875,-.154074,.349886,.184303,.224368,-.166307,.369352,.210669,.252213,-.178051,.386242,.238895,.277321,-.189335,.395294,.269182,.310332,-.200683,.412148,.302508,.338809,-.210856,.418266,.337264,.372678,-.220655,.428723,.374881,.405632,-.230053,.433887,.415656,.442293,-.237993,.439911,.457982,.477256,-.244897,.440175,.502831,.515592,-.250657,.441079,.550277,.550969,-.255459,.435219,.601102,.592883,-.257696,.432882,.651785,.629092,-.259894,.421054,.708961,.672033,-.258592,.41177,.763806,.709147,-.256525,.395267,.824249,.745367,-.254677,.375013,.8951,.784715,-.247892,.353906,.959317,.818107,-.240162,.327801,1.03153,.847895,-.229741,.298821,1.10601,.879603,-.213084,.269115,1.164,.902605,-.195242,.236606,1.22854,.922788,-.174505,.203442,1.29017,.944831,-.150169,.169594,1.34157,.959656,-.124099,.135909,1.3956,.972399,-.0960626,.0990563,1.45128,.986549,-.0657097,.0602348,1.50312,1.00013,-.0333558,.0186694,1.55364,619747e-11,-1e-7,.00778326,796756e-16,2.37499e-8,-9.99999e-8,282592e-10,1.14596e-10,100292e-11,-166369e-11,250354e-9,6.77492e-9,350752e-11,-637769e-11,357289e-9,6.31655e-8,826445e-11,-174689e-10,516179e-9,3.1851e-7,242481e-10,-450868e-10,.0010223,130577e-11,455631e-10,-89044e-9,.00144302,374587e-11,971222e-10,-178311e-9,.00241912,102584e-10,171403e-9,-313976e-9,.00354938,236481e-10,292747e-9,-520026e-9,.00513765,496014e-10,789827e-9,-.00118187,.0238621,139056e-9,.00114093,-.00171827,.0286691,244093e-9,.00176119,-.00249667,.0368565,420623e-9,.0022233,-.00333742,.0400469,65673e-8,.00343382,-.00481976,.0535751,.00109323,.00427602,-.00600755,.057099,.00155268,.00461435,-.00737637,.0551084,.00215031,.00695698,-.00971401,.0715767,.00316529,.00867619,-.0120943,.0793314,.00436995,.0106694,-.0148202,.0869391,.0058959,.0140351,-.0183501,.101572,.00798757,.0168939,-.022006,.11018,.0104233,.020197,-.0261568,.119041,.0134167,.0254702,-.0312778,.135404,.0173009,.0298384,-.0362469,.1437,.0215428,.035159,-.042237,.15512,.0268882,.0427685,-.0488711,.17128,.033235,.0494848,-.0557997,.181813,.0404443,.0592394,-.0635578,.198745,.0490043,.0681463,-.071838,.210497,.0588239,.0804753,-.0809297,.228864,.0702835,.0942205,-.0906488,.247008,.0834012,.106777,-.100216,.258812,.0975952,.124471,-.110827,.278617,.114162,.138389,-.121193,.287049,.131983,.159543,-.13253,.307151,.152541,.176432,-.143611,.31564,.174673,.201723,-.15548,.33538,.199842,.229721,-.167166,.355256,.227097,.250206,-.178238,.360047,.256014,.282118,-.189905,.378761,.28855,.312821,-.201033,.39181,.323348,.341482,-.211584,.397716,.360564,.377368,-.221314,.410141,.400004,.418229,-.230474,.423485,.442371,.444881,-.239443,.418874,.488796,.488899,-.245987,.427545,.535012,.520317,-.253948,.422147,.589678,.568566,-.256616,.42719,.637683,.599607,-.26376,.415114,.703363,.64222,-.268687,.408715,.771363,.685698,-.2694,.399722,.83574,.732327,-.266642,.388651,.897764,.769873,-.267712,.369198,.983312,.806733,-.263479,.346802,1.06222,.843466,-.254575,.321368,1.13477,.873008,-.242749,.29211,1.20712,.908438,-.22725,.262143,1.27465,.936321,-.207621,.228876,1.33203,.950353,-.187932,.19484,1.40439,.96442,-.165154,.163178,1.4732,.979856,-.139302,.127531,1.53574,.982561,-.11134,.0903457,1.59982,.996389,-.0808124,.0489007,1.6577],r=[1,0,0,0,1,791421e-36,0,0,1,104392e-29,0,0,1,349405e-26,0,0,1,109923e-23,0,0,1,947414e-22,0,0,1,359627e-20,0,0,1,772053e-19,0,0,1,108799e-17,0,0,1,110655e-16,0,0,1,865818e-16,0,0,.999998,5.45037e-10,0,0,.999994,2.85095e-9,0,0,.999989,1.26931e-8,0,0,.999973,4.89938e-8,0,0,.999947,1.66347e-7,0,0,.999894,5.02694e-7,0,0,.999798,136532e-11,0,0,.999617,335898e-11,0,0,.999234,752126e-11,0,0,.998258,152586e-10,0,0,.99504,266207e-10,0,0,.980816,236802e-10,0,0,.967553,207684e-11,0,0,.966877,403733e-11,0,0,.965752,741174e-11,0,0,.96382,127746e-10,0,0,.960306,202792e-10,0,0,.953619,280232e-10,0,0,.941103,278816e-10,0,0,.926619,160221e-10,0,0,.920983,235164e-10,0,0,.912293,311924e-10,0,.0158731,.899277,348118e-10,0,.0476191,.880884,26041e-9,0,.0793651,.870399,338726e-10,0,.111111,.856138,392906e-10,0,.142857,.837436,372874e-10,0,.174603,.820973,392558e-10,0,.206349,.803583,434658e-10,0,.238095,.782168,40256e-9,0,.269841,.764107,448159e-10,0,.301587,.743092,457627e-10,0,.333333,.721626,455314e-10,0,.365079,.700375,477335e-10,0,.396825,.677334,461072e-10,0,.428571,.655702,484393e-10,0,.460317,.632059,464583e-10,0,.492064,.610125,483923e-10,0,.52381,.58653,464342e-10,0,.555556,.564508,477033e-10,0,.587302,.541405,459263e-10,0,.619048,.519556,46412e-9,0,.650794,.497292,448913e-10,0,.68254,.475898,445789e-10,0,.714286,.454722,433496e-10,0,.746032,.434042,423054e-10,0,.777778,.414126,413737e-10,0,.809524,.394387,397265e-10,0,.84127,.375841,390709e-10,0,.873016,.357219,369938e-10,0,.904762,.340084,365618e-10,0,.936508,.322714,342533e-10,0,.968254,.306974,339596e-10,0,1,1,101524e-23,0,0,1,10292e-22,0,0,1,130908e-23,0,0,1,473331e-23,0,0,1,625319e-22,0,0,1,107932e-20,0,0,1,163779e-19,0,0,1,203198e-18,0,0,1,204717e-17,0,0,.999999,168995e-16,0,0,.999998,1.15855e-10,0,0,.999996,6.6947e-10,0,0,.999991,3.30863e-9,0,0,.999983,1.41737e-8,0,0,.999968,5.32626e-8,0,0,.99994,1.77431e-7,0,0,.999891,5.28835e-7,0,0,.999797,142169e-11,0,0,.999617,347057e-11,0,0,.999227,77231e-10,0,0,.998239,155753e-10,0,0,.994937,268495e-10,0,0,.980225,213742e-10,0,0,.967549,21631e-10,0,0,.966865,417989e-11,0,0,.965739,763341e-11,0,0,.963794,130892e-10,0,0,.960244,206456e-10,0,0,.953495,282016e-10,0,148105e-9,.940876,271581e-10,0,.002454,.926569,164159e-10,0,.00867491,.920905,239521e-10,0,.01956,.912169,315127e-10,0,.035433,.899095,346626e-10,0,.056294,.882209,290223e-10,0,.0818191,.870272,342992e-10,0,.111259,.855977,394164e-10,0,.142857,.837431,372343e-10,0,.174603,.820826,396691e-10,0,.206349,.803408,435395e-10,0,.238095,.782838,419579e-10,0,.269841,.763941,450953e-10,0,.301587,.742904,455847e-10,0,.333333,.721463,458833e-10,0,.365079,.700197,477159e-10,0,.396825,.677501,470641e-10,0,.428571,.655527,484732e-10,0,.460317,.6324,476834e-10,0,.492064,.609964,484213e-10,0,.52381,.586839,475541e-10,0,.555556,.564353,476951e-10,0,.587302,.541589,467611e-10,0,.619048,.519413,463493e-10,0,.650794,.497337,453994e-10,0,.68254,.475797,445308e-10,0,.714286,.454659,435787e-10,0,.746032,.434065,424839e-10,0,.777778,.414018,41436e-9,0,.809524,.39455,401902e-10,0,.84127,.375742,390813e-10,0,.873016,.357501,377116e-10,0,.904762,.339996,36535e-9,0,.936508,.323069,351265e-10,0,.968254,.306897,339112e-10,0,1,1,10396e-19,0,0,1,104326e-20,0,0,1,110153e-20,0,0,1,144668e-20,0,0,1,34528e-19,0,0,1,175958e-19,0,0,1,12627e-17,0,0,1,936074e-18,0,0,1,645742e-17,0,0,.999998,401228e-16,0,0,.999997,2.22338e-10,0,0,.999995,1.0967e-9,0,0,.999991,4.82132e-9,0,0,.999981,1.89434e-8,0,0,.999967,6.67716e-8,0,0,.999938,2.12066e-7,0,0,.999886,6.0977e-7,0,0,.999792,159504e-11,0,0,.999608,381191e-11,0,0,.999209,833727e-11,0,0,.998179,165288e-10,0,0,.994605,274387e-10,0,0,.979468,167316e-10,0,0,.967529,242877e-11,0,0,.966836,461696e-11,0,0,.96569,830977e-11,0,0,.963706,140427e-10,0,244659e-11,.960063,217353e-10,0,760774e-9,.953113,286606e-10,0,.00367261,.940192,247691e-10,0,.00940263,.927731,195814e-10,0,.018333,.920669,252531e-10,0,.0306825,.911799,324277e-10,0,.0465556,.89857,340982e-10,0,.0659521,.883283,319622e-10,0,.0887677,.86989,35548e-9,0,.114784,.855483,397143e-10,0,.143618,.837987,391665e-10,0,.174606,.820546,411306e-10,0,.206349,.802878,436753e-10,0,.238095,.783402,444e-7,0,.269841,.763439,458726e-10,0,.301587,.742925,467097e-10,0,.333333,.721633,478887e-10,0,.365079,.69985,481251e-10,0,.396825,.67783,491811e-10,0,.428571,.655126,488199e-10,0,.460318,.632697,496025e-10,0,.492064,.609613,48829e-9,0,.52381,.587098,492754e-10,0,.555556,.564119,482625e-10,0,.587302,.541813,482807e-10,0,.619048,.519342,471552e-10,0,.650794,.497514,466765e-10,0,.68254,.475879,455582e-10,0,.714286,.454789,446007e-10,0,.746032,.434217,435382e-10,0,.777778,.414086,421753e-10,0,.809524,.394744,412093e-10,0,.84127,.375782,396634e-10,0,.873016,.357707,386419e-10,0,.904762,.340038,370345e-10,0,.936508,.323284,359725e-10,0,.968254,.306954,3436e-8,0,1,1,599567e-19,0,0,1,600497e-19,0,0,1,614839e-19,0,0,1,686641e-19,0,0,1,972658e-19,0,0,1,221271e-18,0,0,1,833195e-18,0,0,1,403601e-17,0,0,.999999,206001e-16,0,0,.999998,1.01739e-10,0,0,.999997,4.70132e-10,0,0,.999993,2.00436e-9,0,0,.999988,7.83682e-9,0,0,.999979,2.80338e-8,0,0,.999962,9.17033e-8,0,0,.999933,2.74514e-7,0,0,.999881,7.53201e-7,0,0,.999783,189826e-11,0,0,.999594,440279e-11,0,0,.999178,93898e-10,0,0,.998073,181265e-10,0,0,.993993,280487e-10,0,0,.979982,149422e-10,0,0,.968145,378481e-11,0,0,.966786,53771e-10,0,0,.965611,947508e-11,0,388934e-10,.963557,156616e-10,0,9693e-7,.959752,235144e-10,0,.00370329,.952461,291568e-10,0,.00868428,.940193,240102e-10,0,.0161889,.929042,231235e-10,0,.0263948,.920266,273968e-10,0,.0394088,.911178,337915e-10,0,.0552818,.897873,333629e-10,0,.0740138,.884053,351405e-10,0,.0955539,.869455,378034e-10,0,.119795,.854655,399378e-10,0,.14656,.838347,419108e-10,0,.175573,.820693,440831e-10,0,.206388,.802277,445599e-10,0,.238095,.783634,472691e-10,0,.269841,.763159,476984e-10,0,.301587,.742914,491487e-10,0,.333333,.721662,502312e-10,0,.365079,.699668,502817e-10,0,.396825,.677839,51406e-9,0,.428571,.655091,511095e-10,0,.460317,.632665,516067e-10,0,.492064,.609734,512255e-10,0,.52381,.587043,510263e-10,0,.555556,.564298,50565e-9,0,.587302,.541769,497951e-10,0,.619048,.519529,492698e-10,0,.650794,.497574,482066e-10,0,.68254,.476028,473689e-10,0,.714286,.454961,461941e-10,0,.746032,.434341,450618e-10,0,.777778,.414364,438355e-10,0,.809524,.394832,424196e-10,0,.84127,.376109,412563e-10,0,.873016,.35779,396226e-10,0,.904762,.340379,384886e-10,0,.936508,.323385,368214e-10,0,.968254,.307295,356636e-10,0,1,1,106465e-17,0,0,1,106555e-17,0,0,1,107966e-17,0,0,1,114601e-17,0,0,1,137123e-17,0,0,1,21243e-16,0,0,.999999,489653e-17,0,0,.999999,160283e-16,0,0,.999998,62269e-15,0,0,.999997,2.51859e-10,0,0,.999996,9.96192e-10,0,0,.999992,3.74531e-9,0,0,.999986,1.32022e-8,0,0,.999975,4.33315e-8,0,0,.999959,1.31956e-7,0,0,.999927,3.72249e-7,0,0,.999871,9.72461e-7,0,0,.999771,235343e-11,0,0,.999572,52768e-10,0,0,.999133,109237e-10,0,0,.997912,203675e-10,0,0,.993008,279396e-10,0,0,.980645,139604e-10,0,0,.970057,646596e-11,0,0,.966717,65089e-10,0,474145e-10,.965497,111863e-10,0,89544e-8,.96334,179857e-10,0,.0032647,.959294,259045e-10,0,.0075144,.951519,292327e-10,0,.0138734,.940517,249769e-10,0,.0224952,.93014,26803e-9,0,.0334828,.91972,303656e-10,0,.0468973,.910294,353323e-10,0,.0627703,.897701,351002e-10,0,.0811019,.884522,388104e-10,0,.10186,.869489,412932e-10,0,.124985,.853983,415781e-10,0,.150372,.838425,454066e-10,0,.177868,.820656,471624e-10,0,.207245,.801875,475243e-10,0,.238143,.783521,505621e-10,0,.269841,.763131,50721e-9,0,.301587,.74261,523293e-10,0,.333333,.72148,528699e-10,0,.365079,.699696,538677e-10,0,.396825,.677592,539255e-10,0,.428571,.65525,546367e-10,0,.460317,.632452,541348e-10,0,.492064,.609903,544976e-10,0,.52381,.586928,536201e-10,0,.555556,.564464,535185e-10,0,.587302,.541801,524949e-10,0,.619048,.519681,51812e-9,0,.650794,.497685,507687e-10,0,.68254,.47622,496243e-10,0,.714286,.455135,485714e-10,0,.746032,.4346,471847e-10,0,.777778,.414564,459294e-10,0,.809524,.395165,444705e-10,0,.84127,.376333,430772e-10,0,.873016,.358197,416229e-10,0,.904762,.34064,401019e-10,0,.936508,.323816,386623e-10,0,.968254,.307581,370933e-10,0,1,1,991541e-17,0,0,1,992077e-17,0,0,1,100041e-16,0,0,1,10385e-15,0,0,1,115777e-16,0,0,1,150215e-16,0,0,.999999,254738e-16,0,0,.999999,598822e-16,0,0,.999998,1.79597e-10,0,0,.999997,6.02367e-10,0,0,.999994,2.06835e-9,0,0,.99999,6.94952e-9,0,0,.999984,2.23363e-8,0,0,.999972,6.78578e-8,0,0,.999952,1.93571e-7,0,0,.999919,5.16594e-7,0,0,.99986,128739e-11,0,0,.999753,299298e-11,0,0,.999546,648258e-11,0,0,.999074,129985e-10,0,0,.997671,232176e-10,0,0,.991504,256701e-10,0,0,.981148,131141e-10,0,0,.971965,869048e-11,0,280182e-10,.966624,808301e-11,0,695475e-9,.965344,135235e-10,0,.00265522,.963048,210592e-10,0,.00622975,.958673,287473e-10,0,.0116234,.950262,281379e-10,0,.018976,.940836,271089e-10,0,.0283844,.930996,30926e-9,0,.0399151,.919848,348359e-10,0,.0536063,.909136,366092e-10,0,.0694793,.897554,384162e-10,0,.0875342,.884691,430971e-10,0,.107749,.869414,447803e-10,0,.130087,.853462,452858e-10,0,.154481,.838187,495769e-10,0,.180833,.820381,502709e-10,0,.209005,.801844,522713e-10,0,.238791,.783061,541505e-10,0,.269869,.763205,553712e-10,0,.301587,.742362,564909e-10,0,.333333,.721393,572646e-10,0,.365079,.699676,581012e-10,0,.396825,.677395,58096e-9,0,.428571,.655208,585766e-10,0,.460317,.632451,583602e-10,0,.492064,.609839,580234e-10,0,.52381,.587093,577161e-10,0,.555556,.564467,568447e-10,0,.587302,.542043,563166e-10,0,.619048,.519826,55156e-9,0,.650794,.497952,541682e-10,0,.68254,.476477,528971e-10,0,.714286,.455412,514952e-10,0,.746032,.434926,502222e-10,0,.777778,.4149,485779e-10,0,.809524,.395552,472242e-10,0,.84127,.376712,454891e-10,0,.873016,.358622,440924e-10,0,.904762,.341048,422984e-10,0,.936508,.324262,408582e-10,0,.968254,.308013,390839e-10,0,1,1,613913e-16,0,0,1,614145e-16,0,0,1,617708e-16,0,0,1,633717e-16,0,0,1,681648e-16,0,0,1,808291e-16,0,0,1,1.14608e-10,0,0,.999998,2.10507e-10,0,0,.999997,4.99595e-10,0,0,.999995,1.39897e-9,0,0,.999994,4.19818e-9,0,0,.999988,1.27042e-8,0,0,.999979,3.75153e-8,0,0,.999965,1.06206e-7,0,0,.999945,2.85381e-7,0,0,.999908,7.23611e-7,0,0,.999846,17255e-10,0,0,.999733,386104e-11,0,0,.999511,808493e-11,0,0,.998993,156884e-10,0,0,.997326,265538e-10,0,0,.989706,206466e-10,0,0,.981713,130756e-10,0,70005e-10,.973636,106473e-10,0,464797e-9,.966509,10194e-9,0,.00201743,.965149,165881e-10,0,.00497549,.962669,249147e-10,0,.00953262,.95786,317449e-10,0,.0158211,.949334,281045e-10,0,.0239343,.941041,303263e-10,0,.0339372,.931575,356754e-10,0,.0458738,.920102,397075e-10,0,.059772,.908002,384886e-10,0,.075645,.897269,43027e-9,0,.0934929,.884559,479925e-10,0,.113302,.869161,48246e-9,0,.135045,.853342,509505e-10,0,.158678,.837633,542846e-10,0,.184136,.820252,554139e-10,0,.211325,.801872,581412e-10,0,.240113,.782418,585535e-10,0,.270306,.7631,610923e-10,0,.301594,.742183,613678e-10,0,.333333,.721098,627275e-10,0,.365079,.699512,629413e-10,0,.396825,.677372,636351e-10,0,.428571,.655059,633555e-10,0,.460317,.632567,636513e-10,0,.492064,.609784,628965e-10,0,.52381,.587237,625546e-10,0,.555556,.564525,615825e-10,0,.587302,.542181,605048e-10,0,.619048,.520017,596329e-10,0,.650794,.498204,581516e-10,0,.68254,.476742,569186e-10,0,.714286,.455803,553833e-10,0,.746032,.435251,537807e-10,0,.777778,.415374,522025e-10,0,.809524,.395921,503421e-10,0,.84127,.377253,488211e-10,0,.873016,.359021,468234e-10,0,.904762,.341637,453269e-10,0,.936508,.3247,433014e-10,0,.968254,.308625,418007e-10,0,1,1,2.86798e-10,0,0,1,2.86877e-10,0,0,1,2.88094e-10,0,0,1,2.93506e-10,0,0,1,3.09262e-10,0,0,.999999,3.48593e-10,0,0,.999999,4.44582e-10,0,0,.999998,6.88591e-10,0,0,.999996,1.34391e-9,0,0,.999993,3.17438e-9,0,0,.999989,8.35609e-9,0,0,.999983,2.28677e-8,0,0,.999974,6.23361e-8,0,0,.999959,1.65225e-7,0,0,.999936,4.19983e-7,0,0,.999896,101546e-11,0,0,.99983,232376e-11,0,0,.999709,50156e-10,0,0,.999469,10167e-9,0,0,.998886,190775e-10,0,0,.996819,300511e-10,0,0,.988837,185092e-10,0,1.68222e-7,.982178,134622e-10,0,259622e-9,.975017,125961e-10,0,.00142595,.967101,13507e-9,0,.00382273,.964905,205003e-10,0,.00764164,.96218,29546e-9,0,.0130121,.956821,343738e-10,0,.0200253,.948829,305063e-10,0,.0287452,.941092,346487e-10,0,.039218,.931883,412061e-10,0,.0514748,.920211,444651e-10,0,.0655351,.907307,431252e-10,0,.0814082,.89684,490382e-10,0,.0990939,.884119,53334e-9,0,.118583,.869148,54114e-9,0,.139856,.853377,578536e-10,0,.162882,.836753,592285e-10,0,.187615,.820063,622787e-10,0,.213991,.801694,645492e-10,0,.241918,.782116,65353e-9,0,.271267,.762673,674344e-10,0,.301847,.742133,682788e-10,0,.333333,.720779,691959e-10,0,.365079,.699386,696817e-10,0,.396826,.67732,699583e-10,0,.428572,.654888,698447e-10,0,.460318,.632499,694063e-10,0,.492064,.609825,691612e-10,0,.52381,.587287,681576e-10,0,.555556,.564743,674138e-10,0,.587302,.542409,661617e-10,0,.619048,.520282,647785e-10,0,.650794,.498506,633836e-10,0,.68254,.477102,615905e-10,0,.714286,.456167,601013e-10,0,.746032,.435728,581457e-10,0,.777778,.415809,564215e-10,0,.809524,.396517,544997e-10,0,.84127,.377737,525061e-10,0,.873016,.359698,506831e-10,0,.904762,.342164,48568e-9,0,.936508,.325417,467826e-10,0,.968254,.309186,446736e-10,0,1,1,1.09018e-9,0,0,1,1.0904e-9,0,0,1,1.09393e-9,0,0,1,1.1095e-9,0,0,1,1.154e-9,0,0,1,1.26089e-9,0,0,.999999,1.5059e-9,0,0,.999997,2.07899e-9,0,0,.999994,3.48164e-9,0,0,.999993,7.05728e-9,0,0,.999987,1.63692e-8,0,0,.999981,4.06033e-8,0,0,.999969,1.0245e-7,0,0,.999953,2.55023e-7,0,0,.999925,6.1511e-7,0,0,.999881,142218e-11,0,0,.99981,313086e-11,0,0,.99968,653119e-11,0,0,.999418,12832e-9,0,0,.998748,232497e-10,0,0,.996066,329522e-10,0,0,.988379,179613e-10,0,108799e-9,.982567,143715e-10,0,921302e-9,.976097,148096e-10,0,.00280738,.968475,178905e-10,0,.00596622,.964606,253921e-10,0,.0105284,.961564,348623e-10,0,.0165848,.955517,357612e-10,0,.0242,.948381,343493e-10,0,.03342,.941095,405849e-10,0,.0442777,.931923,475394e-10,0,.0567958,.91996,484328e-10,0,.0709879,.907419,502146e-10,0,.086861,.89618,561654e-10,0,.104415,.88337,587612e-10,0,.123643,.869046,618057e-10,0,.144531,.853278,657392e-10,0,.167057,.836091,66303e-9,0,.191188,.819644,704445e-10,0,.216878,.801246,714071e-10,0,.244062,.782031,740093e-10,0,.272649,.762066,74685e-9,0,.302509,.741964,766647e-10,0,.333442,.720554,766328e-10,0,.365079,.699098,777857e-10,0,.396826,.677189,774633e-10,0,.428572,.65484,776235e-10,0,.460318,.632496,770316e-10,0,.492064,.609908,762669e-10,0,.52381,.587312,753972e-10,0,.555556,.564938,739994e-10,0,.587302,.542577,728382e-10,0,.619048,.52062,71112e-9,0,.650794,.498819,694004e-10,0,.68254,.477555,675575e-10,0,.714286,.456568,653449e-10,0,.746032,.436278,636068e-10,0,.777778,.41637,613466e-10,0,.809524,.397144,594177e-10,0,.84127,.378412,570987e-10,0,.873016,.360376,550419e-10,0,.904762,.342906,527422e-10,0,.936508,.326136,506544e-10,0,.968254,.30997,484307e-10,0,1,1,3.54014e-9,0,0,1,3.54073e-9,0,0,1,3.54972e-9,0,0,1,3.58929e-9,0,0,1,3.70093e-9,0,0,.999999,3.96194e-9,0,0,.999998,4.53352e-9,0,0,.999997,5.78828e-9,0,0,.999994,8.63812e-9,0,0,.999991,1.53622e-8,0,0,.999985,3.16356e-8,0,0,.999977,7.12781e-8,0,0,.999964,1.66725e-7,0,0,.999945,3.90501e-7,0,0,.999912,8.95622e-7,0,0,.999866,198428e-11,0,0,.999786,421038e-11,0,0,.999647,850239e-11,0,0,.999356,162059e-10,0,0,.998563,282652e-10,0,0,.994928,336309e-10,0,244244e-10,.987999,178458e-10,0,523891e-9,.982893,159162e-10,0,.00194729,.977044,178056e-10,0,.00451099,.969972,230624e-10,0,.00835132,.964237,313922e-10,0,.013561,.960791,406145e-10,0,.0202056,.954292,372796e-10,0,.0283321,.948052,403199e-10,0,.0379739,.940938,479537e-10,0,.0491551,.931689,545292e-10,0,.0618918,.91987,54038e-9,0,.0761941,.907665,589909e-10,0,.0920672,.895281,642651e-10,0,.109511,.882621,659707e-10,0,.12852,.86873,709973e-10,0,.149085,.853008,742221e-10,0,.171189,.835944,761754e-10,0,.194809,.818949,797052e-10,0,.21991,.800951,812434e-10,0,.246447,.781847,838075e-10,0,.274352,.761649,84501e-9,0,.303535,.74152,860258e-10,0,.333857,.720495,866233e-10,0,.365104,.698742,868326e-10,0,.396826,.677096,87133e-9,0,.428572,.654782,863497e-10,0,.460318,.632335,860206e-10,0,.492064,.610031,849337e-10,0,.52381,.587457,838279e-10,0,.555556,.56513,82309e-9,0,.587302,.542877,803542e-10,0,.619048,.5209,786928e-10,0,.650794,.499291,765171e-10,0,.68254,.477971,744753e-10,0,.714286,.457221,72209e-9,0,.746032,.436803,697448e-10,0,.777778,.417083,675333e-10,0,.809524,.397749,648058e-10,0,.84127,.379177,625759e-10,0,.873016,.361061,598584e-10,0,.904762,.343713,575797e-10,0,.936508,.326894,549999e-10,0,.968254,.310816,527482e-10,0,1,1,1.0153e-8,0,0,1,1.01544e-8,0,0,1,1.01751e-8,0,0,1,1.02662e-8,0,0,1,1.0521e-8,0,0,.999999,1.11049e-8,0,0,.999999,1.23408e-8,0,0,.999996,1.4924e-8,0,0,.999992,2.04471e-8,0,0,.999989,3.26539e-8,0,0,.99998,6.03559e-8,0,0,.999971,1.23936e-7,0,0,.999955,2.69058e-7,0,0,.999933,5.93604e-7,0,0,.999901,129633e-11,0,0,.999847,275621e-11,0,0,.999761,564494e-11,0,0,.999607,110485e-10,0,0,.999282,204388e-10,0,0,.99831,341084e-10,0,2.2038e-7,.993288,294949e-10,0,242388e-9,.987855,192736e-10,0,.0012503,.983167,182383e-10,0,.0032745,.977908,218633e-10,0,.00646321,.971194,290662e-10,0,.0109133,.963867,386401e-10,0,.0166927,.95982,462827e-10,0,.0238494,.953497,420705e-10,0,.0324178,.947621,477743e-10,0,.0424225,.940611,568258e-10,0,.0538808,.931174,618061e-10,0,.0668047,.919919,627098e-10,0,.0812014,.907856,694714e-10,0,.0970745,.894509,735008e-10,0,.114424,.881954,763369e-10,0,.133246,.868309,821896e-10,0,.153534,.852511,83769e-9,0,.175275,.835821,881615e-10,0,.198453,.817981,896368e-10,0,.223042,.800504,930906e-10,0,.249009,.78141,945056e-10,0,.276304,.761427,963605e-10,0,.304862,.74094,968088e-10,0,.334584,.720233,981481e-10,0,.365322,.698592,979122e-10,0,.396826,.676763,981057e-10,0,.428571,.654808,973956e-10,0,.460318,.632326,962619e-10,0,.492064,.610049,952996e-10,0,.52381,.58763,933334e-10,0,.555556,.565261,917573e-10,0,.587302,.543244,896636e-10,0,.619048,.521273,873304e-10,0,.650794,.499818,852648e-10,0,.68254,.478536,823961e-10,0,.714286,.457826,79939e-9,0,.746032,.437549,77126e-9,0,.777778,.41776,743043e-10,0,.809524,.39863,716426e-10,0,.84127,.379954,686456e-10,0,.873016,.362025,660514e-10,0,.904762,.344581,630755e-10,0,.936508,.327909,605439e-10,0,.968254,.311736,576345e-10,0,1,1,2.63344e-8,0,0,1,2.63373e-8,0,0,1,2.63815e-8,0,0,1,2.65753e-8,0,0,1,2.71132e-8,0,0,.999999,2.83279e-8,0,0,.999997,3.0833e-8,0,0,.999995,3.58711e-8,0,0,.999992,4.61266e-8,0,0,.999985,6.7574e-8,0,0,.999977,1.1358e-7,0,0,.999966,2.13657e-7,0,0,.999948,4.31151e-7,0,0,.999923,8.96656e-7,0,0,.999884,186603e-11,0,0,.999826,381115e-11,0,0,.999732,754184e-11,0,0,.999561,143192e-10,0,0,.999191,257061e-10,0,0,.997955,405724e-10,0,744132e-10,.992228,276537e-10,0,716477e-9,.987638,208885e-10,0,.0022524,.983395,215226e-10,0,.00484816,.978614,270795e-10,0,.00860962,.972389,365282e-10,0,.0136083,.964392,474747e-10,0,.0198941,.95861,509141e-10,0,.0275023,.952806,48963e-9,0,.0364584,.94712,571119e-10,0,.04678,.940104,671704e-10,0,.0584799,.930398,687586e-10,0,.0715665,.919866,738161e-10,0,.086045,.907853,813235e-10,0,.101918,.894078,834582e-10,0,.119186,.881177,892093e-10,0,.137845,.867575,944548e-10,0,.157891,.852107,969607e-10,0,.179316,.835502,101456e-9,0,.202106,.81756,103256e-9,0,.226243,.79984,106954e-9,0,.251704,.780998,108066e-9,0,.278451,.761132,110111e-9,0,.306436,.740429,110459e-9,0,.335586,.719836,111219e-9,0,.365796,.698467,11145e-8,0,.3969,.676446,110393e-9,0,.428571,.654635,110035e-9,0,.460318,.632411,108548e-9,0,.492064,.609986,106963e-9,0,.52381,.587872,105238e-9,0,.555556,.565528,102665e-9,0,.587302,.543563,100543e-9,0,.619048,.52176,976182e-10,0,.650794,.500188,947099e-10,0,.68254,.479204,919929e-10,0,.714286,.458413,886139e-10,0,.746032,.438314,857839e-10,0,.777778,.418573,82411e-9,0,.809524,.39947,792211e-10,0,.84127,.380892,759546e-10,0,.873016,.362953,727571e-10,0,.904762,.345601,695738e-10,0,.936508,.328895,664907e-10,0,.968254,.312808,634277e-10,0,1,1,6.28647e-8,0,0,1,6.28705e-8,0,0,1,6.29587e-8,0,0,1,6.33441e-8,0,0,.999999,6.44087e-8,0,0,.999998,6.67856e-8,0,0,.999997,7.15889e-8,0,0,.999995,8.09577e-8,0,0,.999989,9.92764e-8,0,0,.999983,1.35834e-7,0,0,.999974,2.10482e-7,0,0,.999959,3.65215e-7,0,0,.999939,6.86693e-7,0,0,.999911,13472e-10,0,0,.999868,26731e-10,0,0,.999804,524756e-11,0,0,.9997,100403e-10,0,0,.99951,185019e-10,0,0,.999078,322036e-10,0,620676e-11,.997428,470002e-10,0,341552e-9,.99162,287123e-10,0,.00143727,.987479,234706e-10,0,.00349201,.983582,260083e-10,0,.0066242,.979186,337927e-10,0,.0109113,.97325,454689e-10,0,.0164064,.965221,573759e-10,0,.0231463,.957262,544114e-10,0,.0311571,.952211,587006e-10,0,.0404572,.946631,692256e-10,0,.0510592,.939391,787819e-10,0,.0629723,.929795,792368e-10,0,.0762025,.91965,875075e-10,0,.090753,.907737,950903e-10,0,.106626,.893899,972963e-10,0,.123822,.880239,10459e-8,0,.142337,.866562,107689e-9,0,.16217,.85164,113081e-9,0,.183314,.835021,116636e-9,0,.20576,.817311,120074e-9,0,.229496,.798845,121921e-9,0,.254502,.780479,12475e-8,0,.280753,.760694,125255e-9,0,.308212,.740142,126719e-9,0,.336825,.719248,12636e-8,0,.366517,.698209,126712e-9,0,.397167,.676398,125769e-9,0,.428578,.654378,124432e-9,0,.460318,.632484,123272e-9,0,.492064,.610113,12085e-8,0,.52381,.587931,118411e-9,0,.555556,.565872,11569e-8,0,.587302,.543814,112521e-9,0,.619048,.522265,109737e-9,0,.650794,.500835,106228e-9,0,.68254,.479818,102591e-9,0,.714286,.459258,991288e-10,0,.746032,.439061,952325e-10,0,.777778,.419552,91895e-9,0,.809524,.400399,879051e-10,0,.84127,.381976,844775e-10,0,.873016,.364009,806316e-10,0,.904762,.346761,771848e-10,0,.936508,.330049,735429e-10,0,.968254,.314018,702103e-10,0,1,1,1.39968e-7,0,0,1,1.39979e-7,0,0,1,1.40145e-7,0,0,1,1.4087e-7,0,0,.999999,1.42865e-7,0,0,.999998,1.47279e-7,0,0,.999997,1.56057e-7,0,0,.999992,1.7276e-7,0,0,.999989,2.04352e-7,0,0,.99998,2.6494e-7,0,0,.999969,3.83435e-7,0,0,.999953,6.18641e-7,0,0,.999929,108755e-11,0,0,.999898,201497e-11,0,0,.999849,381346e-11,0,0,.999778,719815e-11,0,0,.999661,133215e-10,0,0,.999451,238313e-10,0,0,.998936,401343e-10,0,113724e-9,.99662,517346e-10,0,820171e-9,.991094,304323e-10,0,.00238143,.987487,281757e-10,0,.00493527,.983731,320048e-10,0,.00856859,.979647,423905e-10,0,.0133393,.973837,562935e-10,0,.0192863,.96584,677442e-10,0,.0264369,.956309,623073e-10,0,.03481,.951523,704131e-10,0,.0444184,.946003,836594e-10,0,.0552713,.938454,911736e-10,0,.0673749,.929279,938264e-10,0,.0807329,.919239,103754e-9,0,.0953479,.907293,109928e-9,0,.111221,.893936,115257e-9,0,.128352,.879674,122265e-9,0,.14674,.865668,125733e-9,0,.166382,.850998,132305e-9,0,.187276,.834498,134844e-9,0,.209413,.816903,139276e-9,0,.232786,.798235,140984e-9,0,.257382,.779724,14378e-8,0,.283181,.760251,144623e-9,0,.310156,.739808,145228e-9,0,.338269,.718762,14539e-8,0,.367461,.697815,144432e-9,0,.397646,.67631,143893e-9,0,.428685,.654278,141846e-9,0,.460318,.632347,13935e-8,0,.492064,.610296,137138e-9,0,.52381,.588039,133806e-9,0,.555556,.566218,130755e-9,0,.587302,.544346,127128e-9,0,.619048,.522701,123002e-9,0,.650794,.501542,119443e-9,0,.68254,.480508,115055e-9,0,.714286,.460092,111032e-9,0,.746032,.440021,106635e-9,0,.777778,.420446,102162e-9,0,.809524,.401512,98184e-9,0,.84127,.38299,936497e-10,0,.873016,.365232,89813e-9,0,.904762,.347865,853073e-10,0,.936508,.331342,817068e-10,0,.968254,.315202,773818e-10,0,1,1,2.9368e-7,0,0,1,2.937e-7,0,0,1,2.93998e-7,0,0,1,2.95298e-7,0,0,.999999,2.98865e-7,0,0,.999998,3.067e-7,0,0,.999995,3.22082e-7,0,0,.999992,3.50767e-7,0,0,.999986,4.03538e-7,0,0,.999976,5.01372e-7,0,0,.999964,6.8562e-7,0,0,.999945,10374e-10,0,0,.999919,171269e-11,0,0,.999882,300175e-11,0,0,.999829,542144e-11,0,0,.999749,984182e-11,0,0,.99962,176213e-10,0,0,.999382,305995e-10,0,138418e-10,.998751,496686e-10,0,389844e-9,.995344,510733e-10,0,.00150343,.990768,345829e-10,0,.00352451,.987464,342841e-10,0,.00655379,.983846,399072e-10,0,.0106554,.980007,533219e-10,0,.0158723,.974494,696992e-10,0,.0222333,.96622,776754e-10,0,.029758,.956273,747718e-10,0,.0384596,.950952,864611e-10,0,.0483473,.945215,100464e-9,0,.0594266,.937287,103729e-9,0,.0717019,.928649,111665e-9,0,.0851752,.918791,12353e-8,0,.0998479,.906685,127115e-9,0,.115721,.893706,13628e-8,0,.132794,.879248,142427e-9,0,.151067,.864685,148091e-9,0,.170538,.850032,153517e-9,0,.191204,.833853,157322e-9,0,.213063,.816353,161086e-9,0,.236107,.797834,164111e-9,0,.260329,.778831,165446e-9,0,.285714,.759756,167492e-9,0,.312243,.739419,166928e-9,0,.339887,.718491,167e-6,0,.368604,.697392,165674e-9,0,.398329,.676102,163815e-9,0,.428961,.654243,162003e-9,0,.460331,.632176,158831e-9,0,.492064,.610407,155463e-9,0,.52381,.588394,152062e-9,0,.555556,.56645,147665e-9,0,.587302,.5449,14375e-8,0,.619048,.523276,138905e-9,0,.650794,.502179,134189e-9,0,.68254,.481359,129392e-9,0,.714286,.46092,124556e-9,0,.746032,.441084,11957e-8,0,.777778,.421517,114652e-9,0,.809524,.402721,109688e-9,0,.84127,.384222,104667e-9,0,.873016,.366534,999633e-10,0,.904762,.349205,950177e-10,0,.936508,.332702,907301e-10,0,.968254,.316599,859769e-10,0,1,1,5.85473e-7,0,0,1,5.85507e-7,0,0,1,5.8602e-7,0,0,.999999,5.88259e-7,0,0,.999999,5.94381e-7,0,0,.999998,6.07754e-7,0,0,.999995,6.33729e-7,0,0,.99999,6.8137e-7,0,0,.999984,7.67003e-7,0,0,.999973,9.21212e-7,0,0,.999959,120218e-11,0,0,.999936,172024e-11,0,0,.999907,268088e-11,0,0,.999866,445512e-11,0,0,.999806,768481e-11,0,0,.999716,1342e-8,0,0,.999576,232473e-10,0,0,.9993,391694e-10,0,129917e-9,.998498,608429e-10,0,845035e-9,.994132,489743e-10,0,.00237616,.99031,384644e-10,0,.00484456,.987409,421768e-10,0,.00832472,.983981,504854e-10,0,.0128643,.980268,671028e-10,0,.0184947,.974875,852749e-10,0,.025237,.966063,85531e-9,0,.0331046,.956779,900588e-10,0,.0421067,.950259,10577e-8,0,.0522487,.944239,119458e-9,0,.0635343,.936341,122164e-9,0,.0759654,.928047,134929e-9,0,.0895434,.918065,145544e-9,0,.104269,.906267,150531e-9,0,.120142,.893419,161652e-9,0,.137163,.878758,16593e-8,0,.15533,.863699,174014e-9,0,.174645,.848876,177877e-9,0,.195106,.833032,184049e-9,0,.21671,.815557,186088e-9,0,.239454,.797323,19054e-8,0,.263332,.778124,191765e-9,0,.288336,.758929,192535e-9,0,.314451,.738979,192688e-9,0,.341658,.718213,191522e-9,0,.369924,.696947,190491e-9,0,.399202,.675807,187913e-9,0,.429416,.654147,184451e-9,0,.460447,.63229,181442e-9,0,.492064,.610499,177139e-9,0,.523809,.588747,172596e-9,0,.555555,.566783,167457e-9,0,.587301,.545359,162518e-9,0,.619048,.523984,156818e-9,0,.650794,.502917,151884e-9,0,.68254,.482294,145514e-9,0,.714286,.461945,140199e-9,0,.746032,.442133,134101e-9,0,.777778,.422705,128374e-9,0,.809524,.403916,122996e-9,0,.84127,.38554,116808e-9,0,.873016,.367909,111973e-9,0,.904762,.350651,105938e-9,0,.936508,.334208,101355e-9,0,.968254,.318123,957629e-10,0,1,1,111633e-11,0,0,1,111639e-11,0,0,1,111725e-11,0,0,1,112096e-11,0,0,.999999,11311e-10,0,0,.999997,115315e-11,0,0,.999995,11956e-10,0,0,.999989,127239e-11,0,0,.999981,140772e-11,0,0,.999969,164541e-11,0,0,.999952,206607e-11,0,0,.999928,281783e-11,0,0,.999895,416835e-11,0,0,.999848,658728e-11,0,0,.999781,108648e-10,0,0,.999682,182579e-10,0,0,.999523,306003e-10,0,159122e-10,.999205,499862e-10,0,391184e-9,.998131,73306e-9,0,.00147534,.993334,513229e-10,0,.0034227,.99016,467783e-10,0,.00632232,.987321,523413e-10,0,.0102295,.984099,64267e-9,0,.0151794,.980432,843042e-10,0,.0211947,.974976,102819e-9,0,.0282899,.966429,996234e-10,0,.0364739,.957633,111074e-9,0,.0457522,.949422,128644e-9,0,.0561278,.943045,140076e-9,0,.0676023,.935448,146349e-9,0,.0801762,.927225,161854e-9,0,.0938499,.917033,169135e-9,0,.108623,.905762,179987e-9,0,.124496,.892879,189832e-9,0,.141469,.878435,195881e-9,0,.159541,.863114,20466e-8,0,.178713,.84776,209473e-9,0,.198985,.832084,214861e-9,0,.220355,.814915,217695e-9,0,.242823,.796711,220313e-9,0,.266385,.777603,22313e-8,0,.291036,.757991,222471e-9,0,.316767,.738371,222869e-9,0,.343563,.717872,221243e-9,0,.371402,.696619,218089e-9,0,.400248,.675379,21562e-8,0,.430047,.65411,21169e-8,0,.460709,.63241,206947e-9,0,.492079,.61046,201709e-9,0,.52381,.58903,196753e-9,0,.555556,.567267,189637e-9,0,.587302,.545886,184735e-9,0,.619048,.524714,177257e-9,0,.650794,.503789,171424e-9,0,.68254,.483204,164688e-9,0,.714286,.462976,157172e-9,0,.746032,.443294,151341e-9,0,.777778,.423988,143737e-9,0,.809524,.405325,138098e-9,0,.84127,.386981,130698e-9,0,.873016,.369436,125276e-9,0,.904762,.35219,118349e-9,0,.936508,.335804,11312e-8,0,.968254,.319749,106687e-9,0,1,1,204685e-11,0,0,1,204694e-11,0,0,1,204831e-11,0,0,.999999,205428e-11,0,0,.999999,207056e-11,0,0,.999997,210581e-11,0,0,.999993,21732e-10,0,0,.999987,229365e-11,0,0,.999979,250243e-11,0,0,.999965,286127e-11,0,0,.999947,348028e-11,0,0,.999918,455588e-11,0,0,.999881,643303e-11,0,0,.999828,970064e-11,0,0,.999753,153233e-10,0,0,.999642,24793e-9,0,0,.999464,402032e-10,0,122947e-9,.999089,635852e-10,0,807414e-9,.997567,857026e-10,0,.00227206,.992903,594912e-10,0,.00462812,.990011,578515e-10,0,.00794162,.987192,65399e-9,0,.0122534,.98418,819675e-10,0,.0175888,.980491,105514e-9,0,.0239635,.974779,121532e-9,0,.031387,.96675,119144e-9,0,.0398644,.958248,136125e-9,0,.0493982,.948884,155408e-9,0,.0599896,.941673,162281e-9,0,.0716382,.934521,176754e-9,0,.0843437,.926205,192873e-9,0,.0981056,.916089,200038e-9,0,.112923,.904963,213624e-9,0,.128796,.892089,221834e-9,0,.145725,.878028,232619e-9,0,.163709,.86249,238632e-9,0,.182749,.846587,247002e-9,0,.202847,.830988,250702e-9,0,.224001,.814165,255562e-9,0,.246214,.796135,257505e-9,0,.269482,.777052,258625e-9,0,.293805,.757201,258398e-9,0,.319176,.737655,256714e-9,0,.345587,.717477,255187e-9,0,.373021,.696433,251792e-9,0,.401454,.675084,247223e-9,0,.430844,.653907,242213e-9,0,.461125,.632561,237397e-9,0,.492187,.610658,229313e-9,0,.52381,.589322,224402e-9,0,.555556,.567857,216116e-9,0,.587302,.54652,209124e-9,0,.619048,.525433,201601e-9,0,.650794,.504679,192957e-9,0,.68254,.484203,186052e-9,0,.714286,.464203,177672e-9,0,.746032,.444549,170005e-9,0,.777778,.425346,162401e-9,0,.809524,.406706,1544e-7,0,.84127,.388576,147437e-9,0,.873016,.37094,139493e-9,0,.904762,.353996,133219e-9,0,.936508,.337391,125573e-9,0,.968254,.321648,119867e-9,0,1,1,362511e-11,0,0,1,362525e-11,0,0,1,362739e-11,0,0,.999999,363673e-11,0,0,.999998,366214e-11,0,0,.999996,371698e-11,0,0,.999992,382116e-11,0,0,.999986,400554e-11,0,0,.999976,432058e-11,0,0,.999961,485194e-11,0,0,.999938,574808e-11,0,0,.999908,726643e-11,0,0,.999865,984707e-11,0,0,.999807,142217e-10,0,0,.999723,215581e-10,0,0,.999602,336114e-10,0,119113e-10,.999398,527353e-10,0,355813e-9,.998946,805809e-10,0,.00137768,.996647,942908e-10,0,.00322469,.992298,668733e-10,0,.00597897,.989802,716564e-10,0,.00968903,.987019,821355e-10,0,.0143845,.984219,104555e-9,0,.0200831,.980425,131245e-9,0,.0267948,.974241,139613e-9,0,.034525,.967006,145931e-9,0,.0432757,.95893,167153e-9,0,.0530471,.949157,188146e-9,0,.0638386,.94062,194625e-9,0,.0756487,.933509,213721e-9,0,.0884762,.925088,229616e-9,0,.10232,.915178,239638e-9,0,.117178,.904093,254814e-9,0,.133051,.891337,263685e-9,0,.149939,.877326,274789e-9,0,.167841,.861794,280534e-9,0,.18676,.845758,289534e-9,0,.206696,.829792,294446e-9,0,.22765,.813037,296877e-9,0,.249625,.795285,300217e-9,0,.27262,.776323,299826e-9,0,.296636,.756673,299787e-9,0,.321671,.736856,297867e-9,0,.347718,.716883,294052e-9,0,.374768,.696089,289462e-9,0,.402804,.67505,285212e-9,0,.431796,.653509,27653e-8,0,.461695,.63258,271759e-9,0,.49242,.61104,262811e-9,0,.523822,.589567,255151e-9,0,.555556,.568322,246434e-9,0,.587302,.547235,237061e-9,0,.619048,.52616,228343e-9,0,.650794,.505716,219236e-9,0,.68254,.485274,209595e-9,0,.714286,.465411,201011e-9,0,.746032,.445854,19109e-8,0,.777778,.426911,182897e-9,0,.809524,.408222,173569e-9,0,.84127,.390307,165496e-9,0,.873016,.372624,156799e-9,0,.904762,.355804,14917e-8,0,.936508,.33924,140907e-9,0,.968254,.323534,134062e-9,0,1,1,622487e-11,0,0,1,62251e-10,0,0,1,622837e-11,0,0,.999999,624259e-11,0,0,.999998,628127e-11,0,0,.999996,636451e-11,0,0,.999991,65218e-10,0,0,.999984,679782e-11,0,0,.999973,726361e-11,0,0,.999955,803644e-11,0,0,.999931,931397e-11,0,0,.999896,114299e-10,0,0,.999847,149402e-10,0,0,.999784,207461e-10,0,0,.999692,302493e-10,0,0,.999554,454957e-10,0,997275e-10,.999326,690762e-10,0,724813e-9,.998757,101605e-9,0,.0020972,.995367,958745e-10,0,.00432324,.99209,832808e-10,0,.00746347,.989517,887601e-10,0,.0115534,.987008,10564e-8,0,.0166134,.98421,133179e-9,0,.0226552,.98021,161746e-9,0,.0296838,.973676,161821e-9,0,.0377016,.967052,178635e-9,0,.0467079,.959385,206765e-9,0,.0567013,.949461,22476e-8,0,.0676796,.939578,23574e-8,0,.0796403,.932416,25893e-8,0,.0925812,.923759,271228e-9,0,.106501,.914223,289165e-9,0,.121397,.902942,301156e-9,0,.13727,.890419,313852e-9,0,.15412,.876639,324408e-9,0,.171946,.861316,33249e-8,0,.190751,.84496,338497e-9,0,.210537,.828427,345861e-9,0,.231305,.811871,347863e-9,0,.253057,.794397,350225e-9,0,.275797,.775726,349915e-9,0,.299525,.75617,347297e-9,0,.324242,.736091,344232e-9,0,.349947,.716213,340835e-9,0,.376633,.695736,332369e-9,0,.404289,.674961,327943e-9,0,.432895,.653518,318533e-9,0,.462415,.632574,310391e-9,0,.492788,.61134,300755e-9,0,.523909,.590017,290506e-9,0,.555556,.568752,280446e-9,0,.587302,.548061,269902e-9,0,.619048,.52711,258815e-9,0,.650794,.506682,248481e-9,0,.68254,.486524,237141e-9,0,.714286,.466812,226872e-9,0,.746032,.44732,216037e-9,0,.777778,.428473,205629e-9,0,.809524,.409921,195691e-9,0,.84127,.392028,185457e-9,0,.873016,.374606,176436e-9,0,.904762,.357601,166508e-9,0,.936508,.341348,158385e-9,0,.968254,.32542,149203e-9,0,1,1,103967e-10,0,0,1,10397e-9,0,0,1,104019e-10,0,0,.999999,104231e-10,0,0,.999998,104806e-10,0,0,.999995,106042e-10,0,0,.999991,108366e-10,0,0,.999982,112415e-10,0,0,.999968,119174e-10,0,0,.99995,130227e-10,0,0,.999922,148176e-10,0,0,.999884,177303e-10,0,0,.99983,224564e-10,0,0,.999758,300966e-10,0,0,.999654,423193e-10,0,549083e-11,.999503,614848e-10,0,296087e-9,.999237,903576e-10,0,.00123144,.998491,1271e-7,0,.00295954,.994594,107754e-9,0,.00555829,.99178,103025e-9,0,.00907209,.989265,11154e-8,0,.0135257,.986998,136296e-9,0,.0189327,.984137,169154e-9,0,.0252993,.979798,196671e-9,0,.0326272,.97337,196678e-9,0,.0409157,.967239,223121e-9,0,.0501623,.959543,253809e-9,0,.0603638,.949466,265972e-9,0,.0715171,.939074,288372e-9,0,.0836187,.931118,310983e-9,0,.0966657,.922525,325561e-9,0,.110656,.912983,345725e-9,0,.125588,.901617,3556e-7,0,.141461,.889487,374012e-9,0,.158275,.875787,383445e-9,0,.176031,.860654,393972e-9,0,.19473,.844417,400311e-9,0,.214374,.82741,405004e-9,0,.234967,.810545,407378e-9,0,.256512,.793312,407351e-9,0,.279011,.774847,406563e-9,0,.302468,.755621,404903e-9,0,.326887,.735511,397486e-9,0,.352266,.715435,39357e-8,0,.378605,.695403,384739e-9,0,.405897,.674681,376108e-9,0,.43413,.65359,365997e-9,0,.463277,.632471,354957e-9,0,.493295,.61151,343593e-9,0,.524106,.59064,331841e-9,0,.555561,.569386,318891e-9,0,.587302,.548785,3072e-7,0,.619048,.528146,29361e-8,0,.650794,.507872,281709e-9,0,.68254,.487805,268627e-9,0,.714286,.468196,255887e-9,0,.746032,.448922,243997e-9,0,.777778,.430093,231662e-9,0,.809524,.411845,220339e-9,0,.84127,.393808,208694e-9,0,.873016,.376615,198045e-9,0,.904762,.359655,187375e-9,0,.936508,.343452,177371e-9,0,.968254,.32765,167525e-9,0,1,1,169351e-10,0,0,1,169356e-10,0,0,1,169427e-10,0,0,.999999,169736e-10,0,0,.999998,170575e-10,0,0,.999995,172372e-10,0,0,.99999,175739e-10,0,0,.999979,181568e-10,0,0,.999966,191206e-10,0,0,.999944,20677e-9,0,0,.999912,231644e-10,0,0,.999869,271268e-10,0,0,.999811,334272e-10,0,0,.99973,433979e-10,0,0,.999617,590083e-10,0,680315e-10,.999445,829497e-10,0,612796e-9,.999138,118019e-9,0,.00187408,.998095,156712e-9,0,.00395791,.993919,125054e-9,0,.00692144,.991333,126091e-9,0,.0107962,.989226,144912e-9,0,.0155986,.986954,175737e-9,0,.0213364,.983982,213883e-9,0,.0280114,.979128,234526e-9,0,.0356226,.973327,243725e-9,0,.0441668,.967416,2773e-7,0,.0536399,.959729,308799e-9,0,.0640376,.949758,322447e-9,0,.0753554,.939173,350021e-9,0,.0875893,.9296,370089e-9,0,.100736,.921181,391365e-9,0,.114793,.91164,413636e-9,0,.129759,.900435,427068e-9,0,.145632,.888183,441046e-9,0,.162412,.874772,454968e-9,0,.180101,.859566,461882e-9,0,.1987,.843579,471556e-9,0,.218213,.826453,474335e-9,0,.238641,.809164,477078e-9,0,.259989,.792179,47755e-8,0,.282262,.773866,472573e-9,0,.305464,.754944,469765e-9,0,.329599,.735133,462371e-9,0,.35467,.714858,453674e-9,0,.380678,.694829,443888e-9,0,.407622,.674453,432052e-9,0,.435493,.653685,420315e-9,0,.464275,.632666,406829e-9,0,.493938,.611676,392234e-9,0,.524422,.591193,379208e-9,0,.555624,.570145,36319e-8,0,.587302,.549566,349111e-9,0,.619048,.529278,334166e-9,0,.650794,.509026,318456e-9,0,.68254,.489186,30449e-8,0,.714286,.469662,289051e-9,0,.746032,.450691,275494e-9,0,.777778,.431841,261437e-9,0,.809524,.413752,247846e-9,0,.84127,.395951,235085e-9,0,.873016,.378633,222245e-9,0,.904762,.36194,210533e-9,0,.936508,.345599,198494e-9,0,.968254,.329999,188133e-9,0,1,1,269663e-10,0,0,1,26967e-9,0,0,1,269772e-10,0,0,.999999,270214e-10,0,0,.999998,271415e-10,0,0,.999994,27398e-9,0,0,.999988,278771e-10,0,0,.999977,287019e-10,0,0,.999961,300544e-10,0,0,.999937,322138e-10,0,0,.999904,356163e-10,0,0,.999854,409465e-10,0,0,.99979,492651e-10,0,0,.999699,621722e-10,0,8.8288e-7,.999572,819715e-10,0,223369e-9,.999381,111689e-9,0,.00105414,.999016,153862e-9,0,.0026493,.997437,187667e-9,0,.00508608,.993545,155672e-9,0,.00840554,.991135,161455e-9,0,.012629,.989157,188241e-9,0,.0177661,.986874,226229e-9,0,.0238198,.983714,268668e-9,0,.0307887,.978301,277109e-9,0,.0386688,.973227,303446e-9,0,.0474554,.967317,341851e-9,0,.0571428,.959477,370885e-9,0,.0677256,.950012,392753e-9,0,.0791988,.939484,42781e-8,0,.0915576,.928135,443866e-9,0,.104798,.919819,472959e-9,0,.118918,.910049,491551e-9,0,.133915,.899181,512616e-9,0,.149788,.886881,523563e-9,0,.166537,.87359,540183e-9,0,.184164,.858613,547386e-9,0,.202669,.842809,554809e-9,0,.222056,.825727,558316e-9,0,.242329,.808086,557824e-9,0,.263492,.790728,556346e-9,0,.285551,.772987,552672e-9,0,.30851,.7541,543738e-9,0,.332376,.734669,536107e-9,0,.357153,.714411,523342e-9,0,.382845,.694196,512238e-9,0,.409454,.674252,497465e-9,0,.436977,.65357,481096e-9,0,.465404,.632999,467054e-9,0,.494713,.611994,448771e-9,0,.524864,.591604,431889e-9,0,.555779,.571134,415238e-9,0,.587302,.550528,396369e-9,0,.619048,.530292,379477e-9,0,.650794,.510364,361488e-9,0,.68254,.490749,343787e-9,0,.714286,.471266,327822e-9,0,.746032,.452462,310626e-9,0,.777778,.433907,295352e-9,0,.809524,.415659,279179e-9,0,.84127,.398138,264685e-9,0,.873016,.380833,249905e-9,0,.904762,.364247,236282e-9,0,.936508,.348041,222905e-9,0,.968254,.332389,210522e-9,0,1,1,420604e-10,0,0,1,420614e-10,0,0,1,420757e-10,0,0,.999999,42138e-9,0,0,.999997,423067e-10,0,0,.999993,426668e-10,0,0,.999986,433372e-10,0,0,.999974,444857e-10,0,0,.999956,463554e-10,0,0,.99993,493105e-10,0,0,.999892,539077e-10,0,0,.999838,610005e-10,0,0,.999767,718822e-10,0,0,.999666,884581e-10,0,365471e-10,.999525,113398e-9,0,485623e-9,.999311,150043e-9,0,.00162096,.998865,200063e-9,0,.00355319,.996278,211014e-9,0,.00633818,.992956,189672e-9,0,.0100043,.991017,210262e-9,0,.0145648,.989055,244292e-9,0,.0200237,.986741,290481e-9,0,.0263798,.983288,334303e-9,0,.033629,.977784,340307e-9,0,.0417652,.973037,377864e-9,0,.0507821,.967181,4239e-7,0,.060673,.958971,443854e-9,0,.0714314,.950093,483039e-9,0,.0830518,.939552,517934e-9,0,.0955288,.927678,539449e-9,0,.108859,.918278,568604e-9,0,.123038,.908449,588505e-9,0,.138065,.897713,612473e-9,0,.153938,.885533,625575e-9,0,.170657,.872131,63854e-8,0,.188224,.857517,647034e-9,0,.20664,.841796,65209e-8,0,.225909,.824726,6544e-7,0,.246035,.807297,655744e-9,0,.267022,.789058,646716e-9,0,.288878,.77189,643898e-9,0,.311607,.753082,629973e-9,0,.335216,.7341,621564e-9,0,.359713,.714094,605171e-9,0,.385103,.693839,588752e-9,0,.41139,.673891,573294e-9,0,.438576,.653565,552682e-9,0,.466656,.633326,533446e-9,0,.495617,.612582,514635e-9,0,.525431,.59205,49303e-8,0,.556041,.571918,471842e-9,0,.587338,.551572,451713e-9,0,.619048,.531553,430049e-9,0,.650794,.51175,410445e-9,0,.68254,.49238,390098e-9,0,.714286,.473143,370033e-9,0,.746032,.45423,351205e-9,0,.777778,.435963,332049e-9,0,.809524,.41787,315021e-9,0,.84127,.400387,297315e-9,0,.873016,.383332,281385e-9,0,.904762,.366665,265397e-9,0,.936508,.350633,250601e-9,0,.968254,.334964,23589e-8,0,1,1,643736e-10,0,0,1,64375e-9,0,0,1,643947e-10,0,0,.999999,64481e-9,0,0,.999997,647143e-10,0,0,.999994,652119e-10,0,0,.999985,661359e-10,0,0,.999972,677116e-10,0,0,.999952,702599e-10,0,0,.999922,742517e-10,0,0,.99988,803906e-10,0,0,.99982,897315e-10,0,0,.999741,103838e-9,0,0,.999629,12496e-8,0,149024e-9,.999474,156161e-9,0,861027e-9,.999229,201034e-9,0,.00231198,.998662,259069e-9,0,.00458147,.995299,245439e-9,0,.00770895,.992732,24498e-8,0,.0117126,.990847,273211e-9,0,.0165989,.988911,316492e-9,0,.0223674,.98654,37161e-8,0,.0290135,.982636,410352e-9,0,.0365309,.977346,421756e-9,0,.0449117,.972909,475578e-9,0,.0541481,.966821,522482e-9,0,.0642326,.958686,545008e-9,0,.075158,.949754,589286e-9,0,.0869181,.939184,619995e-9,0,.0995074,.927505,654266e-9,0,.112922,.916606,682362e-9,0,.127157,.906707,704286e-9,0,.142212,.895937,725909e-9,0,.158085,.883913,743939e-9,0,.174776,.870642,755157e-9,0,.192287,.856241,764387e-9,0,.210619,.84069,771032e-9,0,.229775,.823728,765906e-9,0,.249761,.806481,767604e-9,0,.270582,.787924,754385e-9,0,.292243,.770588,749668e-9,0,.314753,.751991,731613e-9,0,.338118,.733407,717655e-9,0,.362347,.713688,700604e-9,0,.387447,.693595,678765e-9,0,.413424,.673426,657042e-9,0,.440284,.65359,635892e-9,0,.468027,.633576,611569e-9,0,.496645,.613144,586011e-9,0,.526122,.592711,563111e-9,0,.556417,.572722,537699e-9,0,.587451,.552762,512556e-9,0,.619048,.532985,489757e-9,0,.650794,.513219,464139e-9,0,.68254,.493992,442193e-9,0,.714286,.47509,418629e-9,0,.746032,.456287,397045e-9,0,.777778,.438152,375504e-9,0,.809524,.420294,35492e-8,0,.84127,.402749,335327e-9,0,.873016,.385879,316422e-9,0,.904762,.369352,298333e-9,0,.936508,.353301,281417e-9,0,.968254,.337781,265203e-9,0,1,1,968267e-10,0,0,1,968284e-10,0,0,1,968556e-10,0,0,.999999,969733e-10,0,0,.999997,972913e-10,0,0,.999993,979688e-10,0,0,.999984,992239e-10,0,0,.999969,101356e-9,0,0,.999946,104784e-9,0,0,.999913,110111e-9,0,0,.999868,118217e-9,0,0,.999801,130396e-9,0,0,.999712,148523e-9,0,124907e-10,.999589,175233e-9,0,355405e-9,.999416,213999e-9,0,.0013528,.999136,268529e-9,0,.00312557,.998367,333088e-9,0,.00573045,.994701,304757e-9,0,.00919397,.992497,318031e-9,0,.0135261,.990608,353863e-9,0,.0187278,.988715,409044e-9,0,.0247947,.986241,472967e-9,0,.0317196,.981696,495104e-9,0,.039494,.977097,532873e-9,0,.0481087,.972583,594447e-9,0,.0575549,.966142,636867e-9,0,.0678242,.95823,669899e-9,0,.0789089,.949677,719499e-9,0,.0908023,.939226,750584e-9,0,.103499,.927501,793183e-9,0,.116993,.915199,81995e-8,0,.131282,.90498,847654e-9,0,.146364,.894243,868929e-9,0,.162237,.882154,884278e-9,0,.178902,.869161,898108e-9,0,.196358,.854751,901254e-9,0,.21461,.839368,90679e-8,0,.23366,.822874,901541e-9,0,.253512,.805514,897297e-9,0,.274174,.78716,881856e-9,0,.29565,.769061,870032e-9,0,.31795,.751,851719e-9,0,.341081,.732614,830671e-9,0,.365053,.713171,806569e-9,0,.389874,.693472,78338e-8,0,.415553,.673528,756404e-9,0,.442098,.653397,726872e-9,0,.469512,.633781,700494e-9,0,.497794,.613877,67105e-8,0,.526935,.593506,640361e-9,0,.556908,.573667,613502e-9,0,.587657,.553932,583177e-9,0,.61906,.534345,554375e-9,0,.650794,.515042,527811e-9,0,.68254,.495674,499367e-9,0,.714286,.477132,47429e-8,0,.746032,.458609,447726e-9,0,.777778,.440354,424205e-9,0,.809524,.422765,399549e-9,0,.84127,.405472,378315e-9,0,.873016,.388482,355327e-9,0,.904762,.372191,336122e-9,0,.936508,.356099,315247e-9,0,.968254,.340737,29794e-8,0,1,1,143327e-9,0,0,1,14333e-8,0,0,1,143366e-9,0,0,.999999,143524e-9,0,0,.999996,143952e-9,0,0,.999991,144862e-9,0,0,.999981,146544e-9,0,0,.999966,149391e-9,0,0,.999941,153946e-9,0,0,.999905,160971e-9,0,0,.999852,171562e-9,0,0,.99978,18729e-8,0,0,.999681,210386e-9,0,826239e-10,.999546,243906e-9,0,664807e-9,.999352,291739e-9,0,.00196192,.999027,357419e-9,0,.00405941,.997886,422349e-9,0,.00699664,.99419,385008e-9,0,.0107896,.99214,409775e-9,0,.0154415,.990274,456418e-9,0,.0209488,.988455,527008e-9,0,.0273037,.985804,597685e-9,0,.0344969,.98103,613124e-9,0,.0425183,.976674,668321e-9,0,.0513575,.972021,736985e-9,0,.0610046,.965274,773789e-9,0,.0714508,.958046,830852e-9,0,.0826877,.949333,875766e-9,0,.0947085,.939135,917088e-9,0,.107507,.927119,952244e-9,0,.121078,.91469,990626e-9,0,.135419,.903006,.00101304,0,.150526,.892368,.00103834,0,.166399,.880231,.00105002,0,.183038,.867432,.00106331,0,.200443,.853208,.00106783,0,.218618,.837956,.00106458,0,.237566,.821772,.00105945,0,.257291,.804328,.00104685,0,.2778,.786465,.00103178,0,.2991,.768004,.00101077,0,.321199,.74972,985504e-9,0,.344106,.731682,962893e-9,0,.36783,.712813,932146e-9,0,.392383,.693139,89871e-8,0,.417774,.673566,869678e-9,0,.444013,.653483,835525e-9,0,.471107,.633891,799853e-9,0,.49906,.614433,766838e-9,0,.527869,.594586,732227e-9,0,.557517,.574769,696442e-9,0,.587966,.555149,663935e-9,0,.61913,.535898,629826e-9,0,.650794,.516753,596486e-9,0,.68254,.497816,567078e-9,0,.714286,.479034,534399e-9,0,.746032,.460975,507013e-9,0,.777778,.442935,477421e-9,0,.809524,.425263,451101e-9,0,.84127,.408248,424964e-9,0,.873016,.391339,39993e-8,0,.904762,.37513,377619e-9,0,.936508,.359172,354418e-9,0,.968254,.343876,334823e-9,0,1,1,209042e-9,0,0,1,209045e-9,0,0,1,209093e-9,0,0,.999999,209304e-9,0,0,.999996,209871e-9,0,0,.999991,211078e-9,0,0,.999979,213304e-9,0,0,.999963,217061e-9,0,0,.999933,223042e-9,0,0,.999894,232206e-9,0,0,.999837,245901e-9,0,0,.999756,266023e-9,0,102927e-11,.999648,295204e-9,0,233468e-9,.999499,336958e-9,0,.00108237,.999283,395563e-9,0,.00268832,.998896,473785e-9,0,.00511138,.997006,520008e-9,0,.00837705,.993819,497261e-9,0,.0124928,.991632,523722e-9,0,.0174561,.989875,587258e-9,0,.0232596,.988109,676329e-9,0,.0298932,.985155,747701e-9,0,.0373453,.980479,768803e-9,0,.0456045,.976271,841054e-9,0,.0546593,.971347,911469e-9,0,.0644994,.964528,953057e-9,0,.0751152,.957632,.00102221,0,.0864981,.948681,.00106122,0,.0986407,.938716,.00111857,0,.111537,.926629,.00114762,0,.125182,.914025,.00118995,0,.139571,.901026,.00121228,0,.154703,.890358,.00123946,0,.170576,.878283,.0012527,0,.18719,.865459,.00125536,0,.204547,.851407,.00126134,0,.222648,.836276,.00124759,0,.241498,.820436,.00124443,0,.261101,.803253,.00122071,0,.281465,.785562,.00120107,0,.302595,.76718,.00117762,0,.324501,.748551,.00114289,0,.347192,.730564,.00110872,0,.370679,.712253,.00107636,0,.394973,.692867,.00103646,0,.420085,.673695,996793e-9,0,.446027,.653912,95675e-8,0,.47281,.634129,916739e-9,0,.500441,.615004,874401e-9,0,.528921,.595587,833411e-9,0,.558244,.575965,794556e-9,0,.588384,.5566,75196e-8,0,.619281,.537428,716381e-9,0,.650795,.518623,676558e-9,0,.68254,.499964,64074e-8,0,.714286,.481356,605984e-9,0,.746032,.463279,570256e-9,0,.777778,.445673,540138e-9,0,.809524,.428032,507299e-9,0,.84127,.411112,479553e-9,0,.873016,.394444,450737e-9,0,.904762,.378247,424269e-9,0,.936508,.362415,399111e-9,0,.968254,.347103,375274e-9,0,1,1,300729e-9,0,0,1,300733e-9,0,0,1,300797e-9,0,0,.999998,301072e-9,0,0,.999996,301817e-9,0,0,.999989,303398e-9,0,0,.999977,306309e-9,0,0,.999958,311209e-9,0,0,.999927,318975e-9,0,0,.999884,330804e-9,0,0,.99982,34834e-8,0,0,.999733,373854e-9,0,326995e-10,.999613,410424e-9,0,477174e-9,.999447,462047e-9,0,.00161099,.999204,533322e-9,0,.00353153,.998725,624964e-9,0,.00627965,.995871,631786e-9,0,.0098693,.993194,632017e-9,0,.0143011,.991541,68923e-8,0,.019568,.989773,766892e-9,0,.0256593,.987647,863668e-9,0,.0325625,.984193,922089e-9,0,.0402647,.980016,970749e-9,0,.0487532,.975859,.00106027,0,.058016,.970514,.00112239,0,.0680419,.963625,.00117212,0,.0788208,.956959,.00125211,0,.0903439,.947956,.00129411,0,.102604,.93809,.00135879,0,.115594,.92659,.00139309,0,.129309,.913829,.00143253,0,.143745,.90005,.00145809,0,.158901,.888129,.0014748,0,.174774,.87607,.00148756,0,.191365,.863461,.00148714,0,.208674,.849594,.00148892,0,.226705,.834531,.00146496,0,.245461,.81903,.0014579,0,.264947,.802122,.00143039,0,.28517,.78445,.00139717,0,.306137,.766434,.00136312,0,.327857,.747816,.00132597,0,.350341,.729519,.00128323,0,.373598,.711454,.00123803,0,.397642,.692699,.00119097,0,.422485,.673723,.00114565,0,.448139,.654386,.00109552,0,.474619,.634673,.00104553,0,.501933,.615554,99985e-8,0,.530089,.596462,948207e-9,0,.559087,.577385,902299e-9,0,.588913,.558257,856448e-9,0,.619525,.5392,810395e-9,0,.650826,.520543,768558e-9,0,.68254,.502206,7239e-7,0,.714286,.48402,685794e-9,0,.746032,.465779,64471e-8,0,.777778,.448455,609583e-9,0,.809524,.431091,57227e-8,0,.84127,.414147,54042e-8,0,.873016,.39765,506545e-9,0,.904762,.381576,477635e-9,0,.936508,.365881,448446e-9,0,.968254,.350582,421424e-9,0,1,1,427144e-9,0,0,1,427151e-9,0,0,1,427232e-9,0,0,.999998,42759e-8,0,0,.999995,428555e-9,0,0,.999988,430603e-9,0,0,.999976,434368e-9,0,0,.999952,440688e-9,0,0,.999919,450667e-9,0,0,.999871,46578e-8,0,0,.999801,488024e-9,0,0,.999704,520092e-9,0,129791e-9,.999572,565553e-9,0,821056e-9,.999389,628906e-9,0,.00225241,.999114,714911e-9,0,.00449109,.998488,819218e-9,0,.00756249,.995234,80415e-8,0,.0114716,.993021,830181e-9,0,.0162131,.991407,902645e-9,0,.021776,.989625,996934e-9,0,.0281471,.987064,.00109707,0,.0353118,.983265,.00114353,0,.0432562,.979535,.0012272,0,.0519665,.975224,.00132642,0,.0614298,.969574,.00138092,0,.0716348,.963021,.00145896,0,.0825709,.956046,.00152834,0,.094229,.947136,.00158217,0,.106602,.937313,.0016347,0,.119682,.926073,.00168383,0,.133465,.913121,.00171627,0,.147947,.899165,.00174229,0,.163125,.885891,.00176137,0,.178998,.873783,.00176406,0,.195566,.861331,.00176156,0,.21283,.847569,.00175346,0,.230793,.832785,.00172753,0,.249459,.817442,.00170204,0,.268832,.800613,.00166576,0,.28892,.783597,.00162909,0,.30973,.76571,.0015826,0,.331271,.747021,.00153106,0,.353554,.728593,.00148036,0,.37659,.710661,.00142808,0,.400391,.692426,.00136906,0,.424973,.673623,.00131066,0,.450347,.65494,.00125569,0,.476531,.635448,.00119517,0,.503535,.616221,.00113828,0,.531372,.597531,.0010816,0,.560047,.578795,.00102673,0,.589554,.559892,970985e-9,0,.619869,.541307,919773e-9,0,.650923,.522608,868479e-9,0,.68254,.504484,82137e-8,0,.714286,.486603,772916e-9,0,.746032,.468802,730353e-9,0,.777778,.451172,684955e-9,0,.809524,.434348,647565e-9,0,.84127,.417445,605863e-9,0,.873016,.401077,571885e-9,0,.904762,.385039,536034e-9,0,.936508,.369483,504227e-9,0,.968254,.354272,473165e-9,0,1,1,599525e-9,0,0,1,599533e-9,0,0,1,599639e-9,0,0,.999998,600097e-9,0,0,.999994,601336e-9,0,0,.999987,603958e-9,0,0,.999972,608775e-9,0,0,.999949,616842e-9,0,0,.999912,629534e-9,0,0,.999857,648658e-9,0,0,.999781,676615e-9,0,538873e-11,.999674,716574e-9,0,308602e-9,.999528,772641e-9,0,.00127003,.999326,849806e-9,0,.00300783,.999009,952682e-9,0,.00556637,.998112,.00106394,0,.00895889,.994496,.00102228,0,.0131827,.992806,.00108586,0,.0182277,.991211,.0011759,0,.0240795,.989415,.00128955,0,.030723,.986499,.00139038,0,.0381418,.982679,.00144539,0,.046321,.978839,.00153954,0,.0552459,.974295,.00164417,0,.0649034,.968784,.00171517,0,.0752814,.962324,.00180282,0,.0863693,.954956,.00186387,0,.0981578,.94624,.00193817,0,.110639,.936517,.00198156,0,.123806,.925186,.00203042,0,.137655,.91252,.0020664,0,.15218,.898441,.00207822,0,.16738,.884394,.0020992,0,.183253,.871273,.00208748,0,.199799,.859057,.00208686,0,.21702,.845243,.00205519,0,.234918,.830723,.00202868,0,.253496,.815801,.00199501,0,.272761,.79914,.00194193,0,.292719,.782372,.00188824,0,.313377,.76482,.00183695,0,.334745,.746586,.00177418,0,.356833,.7281,.00170628,0,.379654,.709842,.00164063,0,.403221,.692019,.00157355,0,.427548,.67364,.00150262,0,.452651,.655277,.00143473,0,.478545,.636438,.00136371,0,.505246,.617364,.00129911,0,.532768,.598603,.00123014,0,.561122,.580195,.00116587,0,.590309,.561786,.00110398,0,.620318,.543377,.00104148,0,.651102,.525093,983984e-9,0,.682545,.506791,92667e-8,0,.714286,.489291,874326e-9,0,.746032,.471811,821734e-9,0,.777778,.454435,774698e-9,0,.809524,.437493,727302e-9,0,.84127,.420977,684039e-9,0,.873016,.404729,64373e-8,0,.904762,.388756,60285e-8,0,.936508,.373344,56765e-8,0,.968254,.358191,531929e-9,0,1,1,832169e-9,0,0,1,832178e-9,0,0,1,83231e-8,0,0,.999998,832893e-9,0,0,.999995,834465e-9,0,0,.999985,837791e-9,0,0,.999969,843893e-9,0,0,.999944,854086e-9,0,0,.999903,870071e-9,0,0,.999843,894042e-9,0,0,.999759,928865e-9,0,531805e-10,.999643,978242e-9,0,579365e-9,.99948,.00104684,0,.00182774,.999255,.00114012,0,.00387804,.998885,.00126188,0,.00675709,.997405,.00135888,0,.010468,.99424,.00133626,0,.0150018,.992458,.00140905,0,.0203443,.990929,.00152305,0,.0264786,.989116,.00165882,0,.0333875,.985624,.00174128,0,.0410536,.982003,.00182108,0,.0494609,.978336,.00194498,0,.0585941,.973184,.00202708,0,.0684396,.9678,.00212166,0,.0789851,.961348,.00221366,0,.0902199,.953841,.00228219,0,.102134,.94534,.00235662,0,.114721,.935552,.00240572,0,.127972,.924064,.00244405,0,.141884,.911827,.00247557,0,.156451,.897731,.00248374,0,.171672,.883409,.00249863,0,.187545,.868625,.00246688,0,.20407,.856529,.00246523,0,.221249,.842999,.00242368,0,.239083,.828505,.00237354,0,.257578,.813825,.00232588,0,.276738,.797813,.00226731,0,.296569,.781097,.00219704,0,.31708,.764038,.00212394,0,.338281,.746067,.00204786,0,.360181,.727687,.00196728,0,.382794,.709571,.00188779,0,.406133,.691503,.00180532,0,.430213,.673673,.00171849,0,.45505,.655732,.00164147,0,.480662,.637399,.00155858,0,.507065,.618616,.00147641,0,.534278,.60005,.00140125,0,.562313,.581713,.00132441,0,.59118,.563546,.00125014,0,.620875,.545605,.00118249,0,.651373,.527559,.0011116,0,.682593,.509764,.00104979,0,.714286,.49193,985977e-9,0,.746032,.475011,928592e-9,0,.777778,.457878,873466e-9,0,.809524,.440979,819585e-9,0,.84127,.424613,772365e-9,0,.873016,.408549,722195e-9,0,.904762,.392771,680014e-9,0,.936508,.377317,636797e-9,0,.968254,.362352,598318e-9,0,1,1,.00114313,0,0,1,.00114314,0,0,.999999,.00114331,0,0,.999998,.00114404,0,0,.999994,.00114601,0,0,.999984,.00115019,0,0,.999967,.00115784,0,0,.999937,.0011706,0,0,.999894,.00119054,0,0,.999828,.00122031,0,0,.999735,.00126331,0,169263e-9,.999606,.00132382,0,949167e-9,.999426,.0014071,0,.00249668,.999173,.00151895,0,.00486392,.99873,.00166102,0,.00806323,.996243,.0017023,0,.0120895,.993779,.00172782,0,.0169288,.9919,.0018108,0,.0225633,.990524,.00196028,0,.028974,.98868,.00212014,0,.036142,.984663,.00217598,0,.044049,.981457,.00230563,0,.0526781,.977608,.00243966,0,.0620137,.972215,.00251336,0,.0720418,.966798,.0026285,0,.0827499,.960241,.00271409,0,.0941271,.952489,.00278381,0,.106164,.944127,.00285399,0,.118852,.934282,.00290994,0,.132185,.923271,.00294558,0,.146157,.910803,.00296269,0,.160766,.896705,.00296803,0,.176007,.88238,.00296637,0,.19188,.867116,.00293163,0,.208385,.853636,.00289418,0,.225523,.840469,.00284663,0,.243296,.82639,.00278594,0,.261709,.811759,.00271618,0,.280767,.796113,.00263187,0,.300476,.779518,.00254589,0,.320845,.763142,.00246003,0,.341883,.745464,.00236529,0,.363601,.727491,.00226536,0,.386011,.709414,.00216375,0,.409128,.691396,.00207127,0,.432967,.67368,.00197106,0,.457545,.656049,.00187022,0,.482881,.638188,.00177605,0,.508992,.620177,.00168482,0,.535899,.601506,.00158909,0,.563619,.58362,.00150583,0,.592165,.565496,.00141791,0,.621544,.54789,.00133693,0,.651743,.530323,.00126038,0,.682709,.512795,.00118556,0,.714286,.495199,.00111527,0,.746032,.478101,.0010489,0,.777778,.461511,984264e-9,0,.809524,.444879,92591e-8,0,.84127,.428424,866582e-9,0,.873016,.412495,814463e-9,0,.904762,.396975,764498e-9,0,.936508,.381614,715967e-9,0,.968254,.366732,672483e-9,0,1,1,.00155501,0,0,1,.00155503,0,0,1,.00155524,0,0,.999998,.00155615,0,0,.999994,.0015586,0,0,.999983,.00156379,0,0,.999963,.0015733,0,0,.999932,.00158911,0,0,.999882,.00161376,0,0,.99981,.00165041,0,100875e-10,.999708,.00170304,0,367658e-9,.999565,.00177658,0,.0014234,.999368,.00187688,0,.00327939,.999081,.00200989,0,.00596629,.99852,.00217177,0,.0094852,.99549,.0021745,0,.013824,.993252,.00222357,0,.0189642,.991727,.00235022,0,.0248856,.989951,.00250561,0,.0315669,.988029,.00268829,0,.0389882,.984029,.0027496,0,.0471302,.980683,.00289793,0,.0559754,.976554,.00303315,0,.0655081,.97139,.00313257,0,.0757138,.965544,.00323656,0,.08658,.95912,.00333432,0,.0980954,.951183,.0034039,0,.110251,.942974,.00347515,0,.123038,.932642,.00350381,0,.13645,.922158,.00354519,0,.150482,.909404,.00353851,0,.165129,.896071,.0035435,0,.18039,.881206,.00349936,0,.196263,.866077,.00347256,0,.212748,.85093,.003415,0,.229847,.837703,.00333367,0,.247561,.823878,.003249,0,.265895,.809449,.00316347,0,.284854,.794379,.00306351,0,.304445,.778138,.0029499,0,.324675,.761997,.00284099,0,.345555,.744938,.00272104,0,.367095,.727212,.00260715,0,.389309,.709549,.00248855,0,.41221,.691704,.00236783,0,.435814,.673689,.00225178,0,.460138,.656453,.00213765,0,.485203,.639128,.00202178,0,.511028,.621512,.00191443,0,.537634,.603598,.00180977,0,.565041,.58559,.00170456,0,.593268,.567852,.00160927,0,.622327,.5503,.00151395,0,.652217,.533033,.00142499,0,.682907,.515942,.00133955,0,.714296,.498814,.0012602,0,.746032,.481595,.00118188,0,.777778,.465117,.00111171,0,.809524,.448865,.00104091,0,.84127,.432711,976618e-9,0,.873016,.416822,91859e-8,0,.904762,.401272,857704e-9,0,.936508,.386226,807172e-9,0,.968254,.371321,75464e-8,0,1,1,.00209596,0,0,1,.00209598,0,0,1,.00209624,0,0,.999997,.00209736,0,0,.999991,.00210039,0,0,.999979,.00210678,0,0,.999959,.00211847,0,0,.999925,.0021379,0,0,.99987,.00216809,0,0,.999791,.00221281,0,681487e-10,.999677,.00227669,0,658161e-9,.999521,.00236533,0,.00200635,.999301,.00248514,0,.0041779,.998977,.00264185,0,.00718648,.998191,.00281695,0,.0110239,.994801,.00278518,0,.015672,.993091,.00288774,0,.0211091,.991571,.00303931,0,.0273123,.9897,.00321643,0,.034259,.987023,.00337332,0,.0419282,.983289,.00346146,0,.0502998,.979892,.00363704,0,.0593562,.975111,.00373601,0,.069081,.970351,.0038842,0,.0794598,.964131,.00397053,0,.0904798,.957747,.00408078,0,.10213,.949536,.00413533,0,.1144,.941372,.00420305,0,.127284,.931049,.00422815,0,.140772,.920647,.00425048,0,.154862,.908033,.0042281,0,.169548,.895028,.00422026,0,.184828,.879968,.00415042,0,.200701,.864875,.00408821,0,.217167,.84918,.00400909,0,.234227,.834934,.00391178,0,.251884,.821397,.00380066,0,.270141,.807135,.00367974,0,.289004,.792363,.00355172,0,.308479,.776661,.003411,0,.328575,.760705,.00328123,0,.349301,.744408,.00314003,0,.370668,.726994,.0029906,0,.392689,.709598,.00285034,0,.415379,.692112,.00271179,0,.438754,.674435,.00257185,0,.46283,.65676,.00243425,0,.48763,.639982,.00230351,0,.513173,.622983,.0021777,0,.539482,.605471,.00204991,0,.566579,.58796,.00193759,0,.594488,.570463,.00181976,0,.623226,.553058,.00171497,0,.6528,.535894,.00161109,0,.683198,.519089,.00151394,0,.714354,.502454,.00142122,0,.746032,.485681,.00133488,0,.777778,.468935,.00124975,0,.809524,.452951,.00117309,0,.84127,.437139,.00110155,0,.873016,.421446,.00103124,0,.904762,.405951,966387e-9,0,.936508,.391003,908119e-9,0,.968254,.376198,848057e-9,0,1,1,.00280076,0,0,1,.00280078,0,0,.999999,.00280109,0,0,.999997,.00280246,0,0,.999992,.00280616,0,0,.999979,.00281396,0,0,.999956,.00282822,0,0,.999916,.00285186,0,0,.999857,.0028885,0,0,.999768,.00294259,0,196026e-9,.999645,.00301946,0,.00104842,.99947,.00312541,0,.00270199,.999229,.00326733,0,.00519449,.998852,.00344992,0,.00852602,.997558,.00361052,0,.0126804,.994417,.0035898,0,.017635,.992824,.00372393,0,.023365,.991344,.00390695,0,.0298456,.989337,.00410392,0,.0370529,.985811,.00420987,0,.0449651,.982772,.00437488,0,.0535615,.979001,.00455069,0,.0628243,.974102,.00464462,0,.0727368,.969197,.00480577,0,.0832844,.962759,.00487818,0,.0944545,.956207,.00498176,0,.106236,.947909,.00503392,0,.118619,.939596,.00507474,0,.131595,.929642,.00509798,0,.145159,.918807,.00508476,0,.159305,.906921,.00505634,0,.174028,.893312,.00498845,0,.189327,.878933,.0049133,0,.2052,.863986,.0048259,0,.221647,.847936,.00470848,0,.23867,.832253,.00456889,0,.25627,.818619,.00442726,0,.274453,.804788,.00427677,0,.293222,.790241,.00411906,0,.312585,.775162,.00394833,0,.33255,.759463,.00377366,0,.353126,.743598,.00361026,0,.374324,.72697,.00343627,0,.396158,.709646,.00326422,0,.418641,.69277,.00309717,0,.44179,.675371,.0029356,0,.465624,.657863,.00277712,0,.490163,.640772,.00261738,0,.515429,.624441,.0024737,0,.541445,.607497,.00233125,0,.568236,.590438,.00218994,0,.595828,.573224,.0020664,0,.624242,.556168,.00193526,0,.653496,.539232,.00182463,0,.683588,.522352,.00170735,0,.714482,.506172,.00160555,0,.746032,.489842,.00150451,0,.777778,.473463,.00140938,0,.809524,.457266,.00132568,0,.84127,.441609,.0012376,0,.873016,.426348,.00116265,0,.904762,.411002,.00108935,0,.936508,.396045,.00101946,0,.968254,.381448,955665e-9,0,1,1,.0037121,0,0,1,.00371213,0,0,1,.00371251,0,0,.999997,.00371417,0,0,.99999,.00371863,0,0,.999977,.00372807,0,0,.99995,.00374529,0,0,.999908,.0037738,0,0,.999843,.00381789,0,123596e-10,.999745,.00388273,0,407442e-9,.999608,.00397443,0,.0015447,.999415,.00409998,0,.00351385,.999143,.00426662,0,.0063316,.9987,.00447625,0,.00998679,.996363,.00455323,0,.0144569,.994021,.00461052,0,.0197151,.992372,.00476359,0,.0257344,.991007,.00499101,0,.0324882,.988767,.0051972,0,.0399517,.984872,.00528407,0,.0481022,.982004,.00548926,0,.0569191,.977714,.00564385,0,.0663839,.973076,.0057693,0,.0764801,.967565,.0058924,0,.0871928,.961384,.00599629,0,.0985095,.954435,.00605998,0,.110419,.946303,.0061133,0,.122912,.937662,.00612028,0,.13598,.927867,.00612209,0,.149617,.916475,.00604813,0,.163817,.90541,.00603088,0,.178577,.891591,.00592218,0,.193894,.877573,.00578854,0,.209767,.862511,.00566648,0,.226196,.846861,.00551481,0,.243182,.83068,.00533754,0,.260728,.815725,.00515487,0,.278837,.802321,.0049655,0,.297515,.787826,.00475421,0,.316768,.773454,.00456002,0,.336605,.758224,.00434727,0,.357034,.74265,.00414444,0,.378067,.726729,.00393738,0,.399717,.710155,.00373575,0,.421998,.693312,.00353736,0,.444928,.67653,.00334368,0,.468523,.659444,.00315981,0,.492806,.642051,.00297809,0,.517798,.625758,.00280592,0,.543525,.609615,.00264254,0,.570012,.592919,.00248459,0,.597288,.576298,.00233327,0,.625379,.559489,.00219519,0,.654307,.542891,.00205441,0,.684084,.526255,.00193385,0,.714693,.509853,.00180745,0,.746044,.494131,.00169817,0,.777778,.478114,.0015913,0,.809524,.462274,.00148981,0,.84127,.446412,.00139537,0,.873016,.431274,.00130984,0,.904762,.41635,.00122403,0,.936508,.401476,.00114809,0,.968254,.386993,.00107563,0,1,1,.00488216,0,0,1,.0048822,0,0,1,.00488265,0,0,.999997,.00488463,0,0,.999988,.00488999,0,0,.999974,.00490129,0,0,.999946,.00492191,0,0,.999897,.00495598,0,0,.999825,.00500855,0,744791e-10,.999718,.00508559,0,712744e-9,.999565,.005194,0,.00215249,.999352,.00534147,0,.00444576,.999046,.00553523,0,.00759218,.998492,.00577016,0,.0115714,.995564,.00578487,0,.0163557,.993339,.00586414,0,.021915,.991834,.00606002,0,.0282201,.990496,.00633312,0,.0352433,.987826,.00651941,0,.042959,.98383,.00660842,0,.0513439,.98109,.00685523,0,.0603772,.976131,.00695778,0,.0700402,.971922,.00714236,0,.0803163,.965901,.00721437,0,.0911908,.959606,.00732017,0,.102651,.952504,.00735788,0,.114686,.944365,.00738493,0,.127286,.935652,.00737969,0,.140443,.925813,.00733612,0,.154151,.914397,.00723094,0,.168405,.903257,.00714002,0,.183201,.890015,.00700149,0,.198536,.876014,.00682813,0,.214409,.861436,.00665567,0,.23082,.845752,.00644526,0,.24777,.829169,.00621635,0,.265263,.813435,.00597789,0,.283301,.799701,.00575694,0,.301889,.785726,.00549866,0,.321035,.77152,.0052503,0,.340746,.75683,.00499619,0,.361032,.741951,.0047543,0,.381904,.726367,.0045084,0,.403374,.710537,.00426784,0,.425457,.693965,.00403487,0,.448169,.677724,.0038075,0,.47153,.66117,.00359431,0,.495561,.644274,.00338354,0,.520284,.627449,.00318163,0,.545725,.611645,.00299672,0,.571911,.595614,.00281016,0,.598873,.579426,.00264252,0,.62664,.563016,.00247509,0,.655239,.546728,.00232647,0,.684692,.530539,.00217803,0,.714999,.514164,.00204216,0,.746106,.498344,.00191403,0,.777778,.482957,.00179203,0,.809524,.467336,.00167695,0,.84127,.451994,.00157567,0,.873016,.436514,.00147113,0,.904762,.42178,.00138034,0,.936508,.407271,.00129219,0,.968254,.392822,.0012098,0,1,1,.00637427,0,0,1,.00637431,0,0,.999999,.00637485,0,0,.999996,.00637721,0,0,.999987,.00638357,0,0,.999971,.006397,0,0,.999939,.00642142,0,0,.999888,.00646177,0,0,.999807,.00652387,0,207916e-9,.999689,.00661454,0,.00112051,.99952,.00674155,0,.00287719,.999283,.00691313,0,.00550145,.998936,.00713598,0,.00897928,.998165,.00738501,0,.0132829,.994847,.00734388,0,.01838,.993182,.00749991,0,.0242381,.991665,.0077246,0,.030826,.989708,.00797579,0,.0381152,.986663,.00813011,0,.0460794,.983288,.00830365,0,.0546951,.980104,.00853496,0,.0639411,.974855,.00861045,0,.0737988,.97045,.00879133,0,.0842516,.964509,.00886377,0,.0952848,.957594,.00890346,0,.106886,.950546,.00893289,0,.119044,.942225,.00890074,0,.131749,.933365,.00886826,0,.144994,.923202,.0087316,0,.158772,.912605,.00863082,0,.173078,.901099,.00847403,0,.187908,.888177,.00825838,0,.203261,.873955,.00801834,0,.219134,.860091,.00779026,0,.235527,.84434,.00752478,0,.252443,.828517,.00724074,0,.269883,.81239,.00693769,0,.287851,.79721,.00664817,0,.306352,.783489,.00634763,0,.325393,.769514,.00604221,0,.344981,.755419,.00573568,0,.365126,.741083,.00544359,0,.385839,.726059,.00515515,0,.407132,.710809,.00487139,0,.42902,.695052,.00459846,0,.45152,.678886,.00433412,0,.474651,.663042,.00407981,0,.498433,.646634,.00384264,0,.52289,.630117,.00360897,0,.548048,.613804,.00338863,0,.573936,.598338,.00318486,0,.600584,.582687,.00298377,0,.628027,.566809,.00280082,0,.656295,.550817,.00262255,0,.685417,.534937,.00245835,0,.715406,.519151,.00230574,0,.74624,.503118,.0021549,0,.777778,.487723,.00202008,0,.809524,.472725,.00189355,0,.84127,.457599,.00177108,0,.873016,.442558,.00165843,0,.904762,.427624,.00155494,0,.936508,.413171,.00145273,0,.968254,.399122,.00136454,0,1,1,.00826496,0,0,1,.00826499,0,0,1,.00826564,0,0,.999996,.00826842,0,0,.999987,.00827589,0,0,.999967,.00829167,0,0,.999933,.00832037,0,0,.999876,.00836768,0,109338e-10,.999786,.00844031,0,427145e-9,.999655,.00854603,0,.0016384,.999468,.00869337,0,.00372392,.999203,.008891,0,.00668513,.998803,.00914387,0,.0104968,.99748,.00935838,0,.015125,.994446,.00933309,0,.0205338,.99292,.00953084,0,.0266884,.991414,.0097893,0,.0335565,.989049,.0100228,0,.0411086,.98582,.0101664,0,.0493181,.982441,.0103582,0,.0581613,.978595,.0105292,0,.0676169,.973495,.0106274,0,.0776661,.968405,.0107261,0,.0882926,.962717,.0108234,0,.0994817,.955478,.0108102,0,.111221,.948275,.0107914,0,.123499,.940006,.0107161,0,.136308,.930831,.0106309,0,.149639,.920648,.0104083,0,.163485,.910205,.0102312,0,.177843,.898445,.0100051,0,.192707,.885986,.00971928,0,.208077,.872204,.00940747,0,.22395,.858436,.0091085,0,.240326,.843454,.00876595,0,.257208,.827437,.00839794,0,.274596,.811488,.00803692,0,.292496,.796039,.00767352,0,.310911,.781083,.0073097,0,.329849,.767642,.00694032,0,.349316,.753901,.00657476,0,.369323,.740131,.00622699,0,.38988,.725845,.0058838,0,.410999,.710991,.00555586,0,.432696,.696002,.00523089,0,.454987,.680461,.00492494,0,.47789,.664875,.00463464,0,.501426,.649273,.00435422,0,.52562,.63302,.0040875,0,.550498,.61705,.00384075,0,.576089,.601154,.00359557,0,.602427,.586008,.00337636,0,.629544,.570699,.00316019,0,.657479,.555166,.00296033,0,.686264,.539645,.00277552,0,.715924,.524159,.00259499,0,.746459,.508682,.00243257,0,.777789,.493163,.00227851,0,.809524,.478004,.00213083,0,.84127,.46347,.00199502,0,.873016,.448778,.00186967,0,.904762,.434105,.00174732,0,.936508,.419576,.00163861,0,.968254,.405541,.00153341,0,1,1,.0106462,0,0,1,.0106462,0,0,.999999,.010647,0,0,.999995,.0106502,0,0,.999985,.0106589,0,0,.999964,.0106773,0,0,.999925,.0107106,0,0,.999861,.0107655,0,712986e-10,.999763,.0108497,0,743959e-9,.999616,.0109716,0,.00227361,.999408,.0111408,0,.0046983,.999112,.0113659,0,.00800158,.998637,.0116475,0,.0121493,.996223,.0117231,0,.0171023,.994006,.0118064,0,.0228218,.992444,.0120254,0,.0292711,.991028,.0123314,0,.036417,.98803,.0124954,0,.0442295,.984816,.0126538,0,.0526815,.981399,.0128537,0,.0617492,.977085,.0129694,0,.0714114,.972154,.013091,0,.0816495,.966617,.0131166,0,.0924472,.960628,.0131583,0,.10379,.953295,.0131094,0,.115665,.94575,.0129966,0,.128062,.937654,.0128796,0,.140972,.927716,.0126477,0,.154387,.917932,.0123889,0,.168301,.907719,.012131,0,.182709,.89584,.0118013,0,.197608,.883526,.0114145,0,.212994,.870301,.0110075,0,.228867,.856272,.0106019,0,.245227,.842251,.0101938,0,.262074,.826466,.00973254,0,.279412,.810859,.0092846,0,.297244,.795051,.00883304,0,.315575,.780053,.00840272,0,.334412,.76575,.00796438,0,.35376,.752298,.00752526,0,.373631,.739153,.00711486,0,.394034,.725514,.00670361,0,.414983,.711473,.00632656,0,.436491,.696936,.00595206,0,.458575,.682126,.00559191,0,.481253,.667027,.00525362,0,.504547,.651875,.00493805,0,.528481,.636463,.00462848,0,.553081,.620641,.00433936,0,.578377,.604931,.00407,0,.604404,.589549,.00380864,0,.631197,.574712,.00357049,0,.658795,.559775,.00334466,0,.687238,.544514,.00312505,0,.716559,.529555,.00293199,0,.746776,.514402,.00274204,0,.777849,.499302,.00256647,0,.809524,.484114,.00239901,0,.84127,.469308,.00225148,0,.873016,.455133,.00210178,0,.904762,.440939,.0019727,0,.936508,.426627,.00184382,0,.968254,.412509,.00172548,0,1,1,.013628,0,0,1,.0136281,0,0,.999999,.0136289,0,0,.999995,.0136327,0,0,.999983,.0136427,0,0,.99996,.0136638,0,0,.999917,.0137022,0,0,.999846,.0137652,0,204597e-9,.999736,.0138615,0,.00116837,.999573,.0140007,0,.00303325,.99934,.0141927,0,.00580613,.999004,.0144457,0,.00945626,.998407,.0147489,0,.0139421,.995464,.014731,0,.0192202,.993328,.0148283,0,.0252495,.991799,.0150797,0,.0319921,.990397,.0154316,0,.0394138,.986835,.0155005,0,.0474843,.983938,.0157308,0,.0561763,.980154,.0158753,0,.0654661,.975659,.0159581,0,.0753326,.970171,.0159832,0,.0857571,.964803,.0160084,0,.0967236,.958366,.0159484,0,.108218,.950613,.0158001,0,.120227,.942874,.0155845,0,.132741,.935005,.0154292,0,.145751,.924991,.0150742,0,.159249,.914814,.0146757,0,.17323,.904743,.0143097,0,.187687,.893216,.0138695,0,.202619,.880769,.0133706,0,.218021,.868136,.0128606,0,.233894,.85469,.0123403,0,.250238,.840593,.0118091,0,.267052,.825808,.011253,0,.284341,.81009,.0107099,0,.302106,.79504,.0101636,0,.320354,.779757,.00964041,0,.33909,.764697,.00911896,0,.358322,.750913,.00859533,0,.378059,.738175,.00811592,0,.398311,.725242,.00764504,0,.41909,.711864,.00718885,0,.440412,.698009,.00675843,0,.462292,.683841,.00634984,0,.484748,.669391,.00595502,0,.507802,.654731,.00558671,0,.531477,.639805,.00523578,0,.555802,.624789,.00490834,0,.580805,.609325,.00459448,0,.606522,.593975,.00430342,0,.63299,.578983,.00403019,0,.66025,.564442,.0037707,0,.688346,.549835,.0035316,0,.717319,.535039,.00330255,0,.7472,.520403,.00308932,0,.777982,.505687,.00289335,0,.809524,.490939,.00270818,0,.84127,.476233,.0025343,0,.873016,.461624,.00237097,0,.904762,.447833,.00222065,0,.936508,.433992,.00207561,0,.968254,.420147,.00194955,0,1,1,.0173415,0,0,1,.0173416,0,0,.999999,.0173426,0,0,.999995,.0173468,0,0,.999983,.0173582,0,0,.999954,.0173822,0,0,.999908,.0174258,0,669501e-11,.999828,.0174973,0,427399e-9,.999705,.0176063,0,.00171019,.999524,.0177631,0,.0039248,.999263,.0179781,0,.00705382,.998878,.018258,0,.0110552,.998012,.0185551,0,.0158812,.994614,.0184264,0,.0214852,.993132,.0186385,0,.0278239,.991563,.0189067,0,.0348585,.989298,.0191577,0,.0425544,.986036,.0192522,0,.050881,.982558,.0194063,0,.059811,.978531,.019486,0,.0693209,.974198,.0195847,0,.0793895,.968148,.0194749,0,.0899984,.962565,.0194277,0,.101132,.956041,.0192991,0,.112775,.947749,.0189893,0,.124917,.94018,.018704,0,.137547,.93165,.0183458,0,.150655,.921798,.0178775,0,.164236,.911573,.0173618,0,.178281,.901569,.0168482,0,.192788,.890341,.016265,0,.207752,.877835,.0156199,0,.223171,.865472,.0149516,0,.239044,.852905,.0143274,0,.255371,.838906,.0136643,0,.272153,.824888,.0129903,0,.289393,.809977,.0123218,0,.307093,.794697,.0116572,0,.325259,.780028,.0110307,0,.343896,.765124,.0104236,0,.363012,.750411,.0098219,0,.382617,.737264,.00924397,0,.402719,.724799,.00868719,0,.423332,.712253,.00816476,0,.444469,.699267,.00767262,0,.466146,.685618,.00719746,0,.488383,.671736,.00673916,0,.511199,.657777,.00631937,0,.534618,.643497,.00592411,0,.558668,.62889,.00553928,0,.58338,.614299,.0051934,0,.608787,.599197,.00485985,0,.634929,.584175,.00454357,0,.661849,.569541,.00425787,0,.689594,.555193,.00397905,0,.718211,.540947,.00372364,0,.747742,.526593,.00348599,0,.778205,.512335,.00326103,0,.80953,.498017,.00305137,0,.84127,.483609,.00285485,0,.873016,.469368,.00267472,0,.904762,.455037,.00249945,0,.936508,.441493,.00234792,0,.968254,.428147,.00219936,0,1,1,.0219422,0,0,1,.0219423,0,0,.999998,.0219434,0,0,.999993,.0219481,0,0,.999981,.021961,0,0,.999949,.0219879,0,0,.999896,.0220367,0,593194e-10,.999808,.0221167,0,75364e-8,.99967,.0222383,0,.00237884,.999466,.0224125,0,.00495612,.999174,.0226495,0,.00844887,.998725,.0229525,0,.0128058,.996979,.0231123,0,.0179742,.994317,.0230742,0,.0239047,.992781,.0232895,0,.0305526,.991191,.0235734,0,.0378786,.987787,.0236152,0,.0458475,.985092,.0237994,0,.0544287,.981121,.0238553,0,.0635952,.976924,.0238706,0,.0733233,.97218,.0238704,0,.0835922,.965956,.0236598,0,.0943839,.959998,.0234735,0,.105682,.953245,.0232277,0,.117474,.944445,.0226973,0,.129747,.937087,.0223527,0,.142491,.928341,.0218144,0,.155697,.9184,.0211516,0,.169358,.907959,.0204553,0,.183469,.89808,.0197673,0,.198024,.887047,.0189915,0,.21302,.875221,.0182082,0,.228455,.86269,.0173584,0,.244329,.850735,.0165718,0,.260639,.837545,.0157524,0,.277389,.823639,.0149482,0,.29458,.809699,.0141431,0,.312216,.794797,.0133527,0,.3303,.780578,.0126193,0,.34884,.766019,.0118914,0,.367842,.751447,.0111839,0,.387315,.737275,.010514,0,.40727,.724545,.00987277,0,.427717,.712644,.00926569,0,.448671,.700432,.00869029,0,.470149,.687664,.00814691,0,.492167,.674288,.00763012,0,.514746,.660966,.00714437,0,.537911,.647264,.00668457,0,.561688,.633431,.00626581,0,.586108,.619133,.00585593,0,.611206,.604935,.00548188,0,.637022,.590236,.00513288,0,.663599,.575473,.0047906,0,.690989,.561228,.00448895,0,.719242,.547054,.00420233,0,.748411,.533175,.00392869,0,.778531,.519163,.00367445,0,.809583,.505328,.00344097,0,.84127,.491446,.00322003,0,.873016,.477356,.00301283,0,.904762,.46356,.00282592,0,.936508,.449623,.00264956,0,.968254,.436068,.00246956,0,1,1,.0276135,0,0,1,.0276136,0,0,.999998,.0276148,0,0,.999993,.0276201,0,0,.999976,.0276342,0,0,.999945,.027664,0,0,.999884,.0277179,0,18679e-8,.999784,.027806,0,.00119607,.99963,.0279394,0,.00318407,.999401,.0281295,0,.00613601,.999066,.0283858,0,.00999963,.998524,.0287027,0,.0147164,.995702,.0286256,0,.0202295,.993593,.0286733,0,.0264876,.992067,.0288989,0,.0334452,.990548,.0292135,0,.0410621,.986775,.0291296,0,.0493032,.984054,.0293099,0,.0581381,.979481,.0291881,0,.0675397,.975297,.0291598,0,.0774848,.96981,.028954,0,.0879528,.963524,.028628,0,.0989258,.957398,.0283135,0,.110388,.950088,.0278469,0,.122327,.941538,.0271798,0,.134729,.933332,.0265388,0,.147587,.924392,.0257776,0,.160889,.914581,.024916,0,.174631,.904347,.0240242,0,.188806,.894324,.0231229,0,.203409,.883724,.022153,0,.218437,.872207,.0211355,0,.233888,.859927,.0201048,0,.249761,.848373,.0191263,0,.266056,.836023,.0181306,0,.282774,.82289,.0171718,0,.299917,.809324,.0162196,0,.317488,.795361,.0152622,0,.335493,.781253,.01439,0,.353936,.767338,.013533,0,.372825,.753156,.0127244,0,.392168,.739122,.0119454,0,.411976,.725358,.0112054,0,.432259,.712949,.010487,0,.453032,.701621,.00984032,0,.47431,.689703,.00921495,0,.496111,.677216,.00862492,0,.518456,.664217,.00806882,0,.541367,.65137,.00755922,0,.564872,.638,.00705705,0,.589001,.62453,.00661266,0,.613789,.610601,.00618432,0,.639277,.59676,.00578033,0,.66551,.582433,.00540927,0,.692539,.568026,.00506104,0,.720422,.55414,.0047353,0,.749216,.540178,.00442889,0,.778974,.526513,.00414363,0,.809711,.512954,.00388237,0,.84127,.499403,.00362875,0,.873016,.486026,.00340827,0,.904762,.472345,.00318598,0,.936508,.458828,.00297635,0,.968254,.445379,.00279447,0,1,1,.0345716,0,0,1,.0345717,0,0,.999999,.034573,0,0,.999991,.0345787,0,0,.999974,.0345941,0,0,.999937,.0346263,0,188589e-11,.999869,.0346847,0,409238e-9,.999757,.0347798,0,.0017674,.999582,.0349233,0,.00413658,.999322,.0351265,0,.00747408,.998939,.0353967,0,.0117157,.998219,.0357018,0,.0167966,.994974,.0354726,0,.0226572,.993201,.0355621,0,.0292445,.991573,.0357641,0,.0365123,.989301,.0359252,0,.0444203,.985712,.0358017,0,.0529334,.982411,.0358353,0,.0620214,.977827,.035617,0,.0716574,.973278,.0354398,0,.0818186,.967397,.0350483,0,.0924846,.960696,.0344795,0,.103638,.954349,.0339861,0,.115263,.946066,.0331323,0,.127348,.938012,.032359,0,.13988,.929413,.0314413,0,.152849,.920355,.0304103,0,.166248,.910586,.0292785,0,.18007,.900609,.0281391,0,.194308,.890093,.0269103,0,.208958,.880013,.0257269,0,.224018,.869001,.0244671,0,.239485,.85751,.0232252,0,.255359,.84582,.0220117,0,.271638,.834383,.0208274,0,.288324,.822158,.0196628,0,.305419,.809056,.0185306,0,.322927,.795832,.0174174,0,.340851,.782547,.0163758,0,.359199,.7689,.015391,0,.377975,.755526,.0144488,0,.397189,.741681,.0135372,0,.416851,.728178,.0126957,0,.436971,.714642,.0118812,0,.457564,.702756,.0111165,0,.478644,.69175,.0104145,0,.500229,.680159,.00974439,0,.522339,.668073,.00911926,0,.544997,.655405,.00851393,0,.56823,.642921,.00797637,0,.592068,.629993,.00745119,0,.616546,.616828,.00696972,0,.641705,.603305,.00652425,0,.66759,.589833,.00610188,0,.694255,.575945,.00570834,0,.72176,.561745,.00533384,0,.750168,.548277,.00500001,0,.779545,.534467,.00467582,0,.809933,.521032,.00438092,0,.841272,.507877,.00410348,0,.873016,.494654,.00383618,0,.904762,.481592,.00358699,0,.936508,.468509,.00337281,0,.968254,.455293,.00316196,0,1,1,.0430698,0,0,1,.0430699,0,0,.999998,.0430713,0,0,.999991,.0430773,0,0,.99997,.0430936,0,0,.999928,.0431277,0,406396e-10,.999852,.0431893,0,744376e-9,.999724,.0432895,0,.0024806,.999527,.0434397,0,.00524779,.99923,.0436507,0,.00898164,.998783,.0439255,0,.0136083,.997507,.0441104,0,.0190582,.994418,.0438225,0,.0252694,.992864,.0439396,0,.0321879,.991127,.0440962,0,.039767,.987331,.0438408,0,.0479667,.984819,.0438991,0,.056752,.980384,.0435906,0,.0660929,.975846,.0432543,0,.075963,.970748,.0428293,0,.0863398,.964303,.042153,0,.0972035,.95772,.0414111,0,.108537,.950747,.0405893,0,.120325,.942533,.0394887,0,.132554,.934045,.0383544,0,.145215,.924942,.037057,0,.158296,.915811,.0356993,0,.17179,.90612,.0342401,0,.185691,.896434,.0328078,0,.199993,.886021,.031288,0,.214691,.876081,.0297776,0,.229782,.865608,.0282334,0,.245265,.854924,.026749,0,.261138,.843607,.02526,0,.277401,.832456,.0238214,0,.294056,.821342,.0224682,0,.311104,.809303,.0211297,0,.328548,.796468,.0198387,0,.346394,.784046,.0186227,0,.364645,.771262,.0174561,0,.38331,.758118,.0163806,0,.402396,.745075,.0153287,0,.421912,.731926,.0143647,0,.44187,.71863,.0134363,0,.462283,.705414,.0125603,0,.483165,.693792,.0117508,0,.504535,.683108,.0110016,0,.52641,.67183,.0102757,0,.548816,.66015,.00962044,0,.571776,.647907,.00898031,0,.595323,.635734,.00840811,0,.619489,.623208,.00786211,0,.644317,.610438,.00734953,0,.669852,.597345,.00687688,0,.696148,.584138,.00643469,0,.723267,.5707,.00602236,0,.75128,.556966,.0056324,0,.780258,.543607,.00528277,0,.810268,.530213,.00493999,0,.841311,.516912,.00462265,0,.873016,.503916,.0043307,0,.904762,.491146,.00406858,0,.936508,.478439,.00381436,0,.968254,.465834,.00358003,0,1,1,.0534039,0,0,1,.053404,0,0,.999998,.0534055,0,0,.999989,.0534116,0,0,.999968,.0534283,0,0,.999918,.0534633,0,155895e-9,.99983,.0535262,0,.00120914,.999685,.0536281,0,.00334944,.999461,.0537799,0,.00653077,.999119,.0539902,0,.0106718,.998582,.0542524,0,.0156907,.995919,.0540318,0,.0215147,.993735,.0538914,0,.0280801,.992126,.0539557,0,.0353323,.990266,.0540401,0,.0432247,.986317,.0536064,0,.0517172,.983213,.0534425,0,.0607754,.978303,.0528622,0,.0703698,.973665,.0523363,0,.0804742,.968091,.0516165,0,.0910667,.961026,.0505434,0,.102128,.954333,.049523,0,.113641,.946372,.0481698,0,.125591,.938254,.0467674,0,.137965,.929516,.0452341,0,.150754,.920106,.0435083,0,.163947,.910899,.0417399,0,.177537,.901532,.0399389,0,.191516,.891919,.0380901,0,.205881,.882006,.0362341,0,.220626,.871965,.0343444,0,.235749,.862145,.0324832,0,.251248,.852058,.0306681,0,.267121,.84161,.0289097,0,.283368,.830806,.0272079,0,.299992,.820476,.0256089,0,.316992,.809514,.0240394,0,.334374,.797865,.0225379,0,.35214,.785621,.0211235,0,.370296,.773765,.0197908,0,.388849,.761629,.0185235,0,.407807,.748891,.0173358,0,.427178,.736437,.0162305,0,.446974,.723707,.0151778,0,.467207,.710606,.0141791,0,.487892,.698019,.0132592,0,.509046,.686203,.0123887,0,.530687,.675692,.0115976,0,.552839,.664826,.0108325,0,.575527,.65349,.0101348,0,.59878,.641774,.00947756,0,.622634,.629794,.00886058,0,.647128,.617647,.00828526,0,.672308,.60534,.00775312,0,.698231,.592718,.00726033,0,.724958,.579746,.00679731,0,.752563,.566763,.00636111,0,.781127,.553515,.00595228,0,.810733,.540118,.00556876,0,.841426,.527325,.00523051,0,.873016,.514265,.00490712,0,.904762,.501406,.00460297,0,.936508,.488922,.00431247,0,.968254,.476541,.0040472,0,1,1,.0659184,0,0,1,.0659185,0,0,.999998,.06592,0,0,.999988,.0659259,0,0,.999963,.0659423,0,0,.999907,.0659764,0,374198e-9,.999806,.0660376,0,.00182071,.999639,.0661361,0,.0043894,.999378,.0662814,0,.00800055,.998985,.0664779,0,.0125594,.998285,.0666914,0,.0179786,.995071,.0661989,0,.0241822,.993172,.0660454,0,.031106,.991438,.0660105,0,.0386952,.988428,.0656875,0,.0469032,.985218,.0652913,0,.0556905,.981128,.0647107,0,.065023,.976015,.0638491,0,.0748717,.97097,.062993,0,.0852112,.964582,.0617927,0,.0960199,.957383,.0603626,0,.107279,.949969,.0588128,0,.118971,.941843,.0570274,0,.131084,.933624,.0551885,0,.143604,.924543,.053122,0,.156521,.914919,.0508897,0,.169825,.905773,.0486418,0,.18351,.896434,.0463364,0,.197569,.887195,.0440623,0,.211997,.877706,.0417799,0,.226789,.867719,.03945,0,.241944,.858587,.037243,0,.257458,.849317,.0350956,0,.273331,.839585,.0329852,0,.289563,.829856,.0310028,0,.306154,.819589,.0290953,0,.323108,.809714,.0272738,0,.340426,.79934,.0255631,0,.358113,.788224,.0239175,0,.376175,.776619,.0223831,0,.394616,.76521,.0209298,0,.413445,.753716,.0195786,0,.432671,.741564,.0183001,0,.452305,.729413,.0171259,0,.472358,.717146,.0159933,0,.492845,.70436,.0149495,0,.513783,.69219,.0139681,0,.535189,.680289,.0130577,0,.557087,.669611,.0122198,0,.5795,.659113,.0114174,0,.602459,.648148,.0106729,0,.625997,.636905,.00998997,0,.650154,.625154,.00934313,0,.674976,.613481,.00874839,0,.700518,.60154,.00818265,0,.726845,.58943,.00766889,0,.754032,.576828,.00717153,0,.782167,.564194,.00672696,0,.811344,.551501,.00630863,0,.841644,.538635,.00592177,0,.873016,.525724,.00554888,0,.904762,.513209,.00520225,0,.936508,.500457,.00488231,0,.968254,.48799,.00457153,0,1,1,.0810131,0,0,1,.0810133,0,0,.999997,.0810145,0,0,.999985,.08102,0,0,.999956,.0810347,0,195026e-10,.999893,.0810656,0,719316e-9,.999777,.0811205,0,.00259774,.999583,.081208,0,.00561807,.999281,.0813343,0,.00967472,.998813,.0814969,0,.0146627,.997597,.0815217,0,.0204902,.994379,.0808502,0,.0270802,.992744,.0806792,0,.0343674,.990745,.0804589,0,.0422974,.986646,.0796107,0,.0508242,.983611,.0790913,0,.0599087,.978869,.0780746,0,.0695175,.973475,.0768218,0,.0796223,.967845,.0754926,0,.0901983,.960778,.0737063,0,.101224,.953333,.0718052,0,.112682,.945274,.0695946,0,.124555,.936955,.0672492,0,.136831,.928319,.0647732,0,.149496,.919075,.0620947,0,.162542,.909114,.0591816,0,.175958,.900137,.0563917,0,.189739,.891069,.0535392,0,.203877,.882262,.0507642,0,.218368,.873232,.0479793,0,.233208,.864042,.045226,0,.248393,.855002,.0425413,0,.263923,.846569,.0400126,0,.279796,.837714,.0375269,0,.296012,.828918,.0352027,0,.312573,.819783,.0330011,0,.329479,.810129,.0308908,0,.346734,.800866,.0289112,0,.364342,.79093,.0270255,0,.382307,.780593,.0252758,0,.400637,.769511,.0236178,0,.419337,.758558,.0220652,0,.438418,.747632,.0206289,0,.457889,.736146,.0192873,0,.477761,.724093,.0180333,0,.49805,.71234,.0168264,0,.51877,.700201,.015746,0,.53994,.687949,.0147027,0,.561581,.676163,.0137512,0,.583718,.665001,.0128655,0,.60638,.65472,.0120366,0,.629599,.644213,.0112604,0,.653415,.633382,.0105413,0,.677874,.62212,.00986498,0,.70303,.610631,.00923308,0,.728948,.599078,.00864206,0,.755706,.587519,.00811784,0,.783396,.575505,.00761237,0,.812121,.563148,.00713949,0,.841989,.550828,.00668379,0,.873035,.538458,.00627715,0,.904762,.525905,.00588336,0,.936508,.513517,.00552687,0,.968254,.501395,.00519681,0,1,1,.0991506,0,0,1,.0991504,0,0,.999996,.0991515,0,0,.999984,.0991558,0,0,.999947,.0991672,0,114389e-9,.999874,.0991912,0,.00121503,.999739,.0992331,0,.00356108,.999514,.0992983,0,.00705578,.999159,.0993877,0,.011574,.998586,.0994837,0,.017003,.995731,.0988425,0,.0232484,.993384,.098276,0,.0302318,.991615,.0979269,0,.0378884,.989029,.0973432,0,.0461641,.985373,.0963539,0,.0550136,.981278,.0952306,0,.0643988,.975777,.0936233,0,.0742868,.970526,.0920219,0,.0846501,.963755,.0898912,0,.0954644,.956676,.0876064,0,.106709,.948099,.0847751,0,.118367,.939718,.0818638,0,.130423,.931305,.078857,0,.142862,.922342,.0756127,0,.155674,.912842,.0721473,0,.168849,.903304,.0686195,0,.182378,.89411,.0650589,0,.196255,.885512,.0616022,0,.210473,.877193,.0582434,0,.225027,.86877,.0548979,0,.239915,.860267,.0516095,0,.255132,.851915,.048468,0,.270678,.843912,.0454447,0,.286551,.83604,.0425612,0,.302751,.828245,.0398752,0,.31928,.820159,.0373198,0,.336138,.81167,.034916,0,.35333,.802659,.0326402,0,.370858,.793921,.0304901,0,.388728,.784713,.0284857,0,.406944,.774946,.0266186,0,.425515,.76448,.0248593,0,.444449,.753793,.0232114,0,.463756,.743506,.0217039,0,.483447,.732555,.0202841,0,.503535,.720965,.0189648,0,.524036,.709422,.0177189,0,.544968,.697756,.0165626,0,.56635,.685565,.015483,0,.588208,.673987,.0144892,0,.610569,.66244,.0135607,0,.633466,.651675,.0126956,0,.656936,.641598,.0118788,0,.681025,.63121,.0111261,0,.705788,.620514,.010437,0,.731289,.609366,.00978747,0,.757606,.598137,.00917257,0,.784834,.586966,.00859778,0,.813085,.575549,.00806803,0,.842485,.563797,.00757294,0,.87313,.551758,.00710592,0,.904762,.539894,.0066841,0,.936508,.527901,.00627901,0,.968254,.515819,.00590506,0,1,1,.120864,0,0,1,.120864,0,0,.999996,.120864,0,0,.99998,.120867,0,0,.99994,.120872,0,323781e-9,.999852,.120884,0,.00188693,.999693,.120903,0,.00473489,.999426,.120929,0,.00872704,.999002,.120955,0,.0137237,.998235,.120918,0,.0196068,.994608,.119764,0,.0262803,.992997,.119265,0,.0336657,.990968,.11863,0,.0416987,.987002,.117261,0,.0503261,.983524,.116009,0,.0595035,.97875,.114252,0,.0691935,.972652,.11193,0,.0793645,.966613,.109555,0,.0899894,.959275,.106612,0,.101045,.951272,.103375,0,.112512,.942323,.0996594,0,.124372,.933679,.0958841,0,.136611,.924822,.0919265,0,.149216,.915742,.0878061,0,.162176,.906348,.0834894,0,.175482,.896883,.079085,0,.189125,.88774,.0746745,0,.203098,.87986,.0705773,0,.217396,.871998,.0665005,0,.232015,.864325,.0625413,0,.24695,.856685,.0586781,0,.2622,.84925,.0550063,0,.277761,.841719,.0514727,0,.293634,.834755,.0481398,0,.309819,.827853,.0450172,0,.326315,.820888,.0420969,0,.343126,.813616,.0393702,0,.360254,.805767,.0367771,0,.377701,.797338,.0343274,0,.395474,.789122,.0320529,0,.413577,.780601,.0299485,0,.432018,.771424,.0279812,0,.450804,.761502,.0261054,0,.469944,.751166,.0243942,0,.489451,.741276,.0228087,0,.509337,.730898,.0213265,0,.529617,.719878,.0199307,0,.550307,.708379,.0186574,0,.571428,.697165,.0174446,0,.593003,.685554,.0163144,0,.615059,.673631,.015276,0,.637628,.662385,.0143003,0,.660746,.651059,.0134112,0,.68446,.640451,.0125794,0,.70882,.630536,.011793,0,.733893,.620316,.0110547,0,.759756,.609722,.0103668,0,.786505,.598804,.00973009,0,.814259,.587871,.00912812,0,.843157,.577121,.00858916,0,.87334,.566019,.00807333,0,.904762,.554664,.00759687,0,.936508,.543101,.00714759,0,.968254,.531558,.00673418,0,1,1,.146767,0,0,1,.146767,0,0,.999997,.146767,0,0,.999977,.146765,0,320658e-11,.999929,.146762,0,682576e-9,.999823,.146753,0,.00276402,.999633,.146735,0,.00614771,.999314,.146699,0,.0106613,.998796,.14662,0,.0161546,.997124,.146107,0,.0225063,.994062,.144857,0,.0296198,.992154,.144011,0,.037417,.989186,.142712,0,.0458348,.985279,.140926,0,.0548211,.980826,.13885,0,.0643326,.975056,.136168,0,.074333,.969005,.133217,0,.0847917,.961554,.12959,0,.0956828,.954206,.125886,0,.106984,.945046,.121335,0,.118675,.935678,.116492,0,.130741,.926748,.111635,0,.143166,.917764,.106625,0,.155939,.908358,.101325,0,.169049,.899219,.0960249,0,.182487,.890089,.0906527,0,.196245,.881488,.0853905,0,.210317,.874031,.0804177,0,.224697,.866932,.0756005,0,.23938,.859976,.0709019,0,.254364,.853375,.0664391,0,.269646,.846971,.0622012,0,.285223,.840483,.058129,0,.301096,.833969,.0542762,0,.317265,.82806,.0507042,0,.333729,.822128,.047368,0,.350491,.815989,.044272,0,.367554,.809336,.0413444,0,.38492,.802177,.038601,0,.402594,.79441,.0360227,0,.420582,.786573,.0336383,0,.438891,.778619,.0314321,0,.457527,.77,.029362,0,.476499,.760698,.0274102,0,.49582,.750932,.0256146,0,.5155,.740993,.023974,0,.535555,.731159,.0224182,0,.556,.720836,.0209889,0,.576855,.709913,.0196411,0,.598143,.698415,.0183824,0,.619888,.68745,.0172222,0,.642123,.676154,.0161509,0,.664883,.664383,.0151397,0,.688211,.6533,.0141873,0,.71216,.642072,.0133105,0,.736792,.631412,.0124932,0,.762186,.621622,.0117408,0,.788439,.611681,.0110358,0,.815672,.60142,.0103775,0,.844034,.59083,.00975623,0,.873699,.580254,.00918084,0,.904765,.569841,.00864721,0,.936508,.559224,.00815731,0,.968254,.548315,.00767924,0,1,1,.177563,0,0,1,.177563,0,0,.999994,.177562,0,0,.999972,.177555,0,664171e-10,.999914,.177536,0,.0012276,.999787,.177496,0,.00388025,.999556,.17742,0,.00783463,.999165,.177285,0,.0128953,.9985,.177037,0,.0189053,.995388,.175634,0,.025742,.993102,.174375,0,.033309,.990992,.173121,0,.0415298,.986932,.170896,0,.0503425,.982786,.16847,0,.0596964,.977592,.165455,0,.0695498,.971075,.161676,0,.0798676,.963967,.157458,0,.0906201,.956397,.152836,0,.101783,.947489,.147467,0,.113333,.937564,.14145,0,.125254,.928182,.135383,0,.137529,.919027,.129212,0,.150144,.909618,.12276,0,.163088,.900492,.116273,0,.176351,.891671,.1098,0,.189924,.883146,.103362,0,.203799,.875151,.0970799,0,.21797,.868338,.0911732,0,.232433,.862033,.0854966,0,.247182,.856107,.0800691,0,.262216,.850644,.0749618,0,.27753,.845261,.070079,0,.293124,.839885,.0654321,0,.308997,.834609,.0610975,0,.325149,.829083,.0569741,0,.341581,.82404,.0531736,0,.358294,.818968,.049665,0,.37529,.813496,.0463856,0,.392573,.807533,.0433217,0,.410148,.80099,.0404402,0,.428019,.793891,.0377578,0,.446192,.786281,.0352616,0,.464676,.778773,.0329577,0,.483478,.770737,.030808,0,.502608,.762094,.0287964,0,.522079,.752898,.0269254,0,.541905,.743306,.0251926,0,.5621,.733416,.023595,0,.582684,.723742,.0221155,0,.603677,.713542,.0207435,0,.625106,.702755,.019434,0,.646998,.691484,.0182046,0,.66939,.680531,.0170771,0,.692324,.66953,.0160339,0,.715849,.658126,.0150677,0,.740028,.646933,.0141551,0,.764937,.636107,.0133179,0,.790673,.625271,.0125284,0,.817358,.615225,.0117937,0,.84515,.605678,.0111181,0,.874244,.59583,.0104759,0,.904828,.585704,.00986672,0,.936508,.575413,.00929712,0,.968254,.565373,.00876713,0,1,1,.214058,0,0,.999999,.214058,0,0,.999994,.214055,0,0,.999966,.214039,0,259642e-9,.999893,.213998,0,.00200075,.999737,.21391,0,.00527775,.999449,.213745,0,.00983959,.99896,.213458,0,.0154755,.9979,.212855,0,.0220249,.994278,.210779,0,.0293654,.992254,.20926,0,.0374021,.98881,.206908,0,.0460604,.984715,.204009,0,.0552802,.979738,.200471,0,.0650127,.972884,.195813,0,.0752175,.965996,.190856,0,.0858612,.957974,.185077,0,.0969155,.949155,.17868,0,.108356,.939288,.171513,0,.120163,.928996,.163838,0,.132319,.919563,.156246,0,.144808,.910004,.148359,0,.157618,.900791,.140417,0,.170737,.892135,.132569,0,.184155,.883803,.124741,0,.197866,.876034,.117091,0,.211861,.869219,.109835,0,.226134,.863062,.102859,0,.240682,.857795,.0962928,0,.255499,.853009,.0900725,0,.270583,.848603,.0842101,0,.285931,.844335,.0786527,0,.301542,.840208,.0734397,0,.317415,.836035,.0685334,0,.33355,.83172,.0639275,0,.349948,.827135,.0595909,0,.36661,.822797,.0556204,0,.383539,.818387,.0519394,0,.400738,.813565,.0485317,0,.41821,.808142,.0453138,0,.435961,.802212,.0423354,0,.453997,.79573,.0395553,0,.472324,.788741,.036988,0,.490951,.781093,.0345688,0,.509887,.773597,.0323297,0,.529144,.765622,.0302719,0,.548735,.757083,.0283477,0,.568674,.747992,.0265562,0,.588979,.738591,.0248844,0,.609671,.728719,.0233342,0,.630773,.719146,.0219081,0,.652314,.709165,.0205711,0,.674328,.69875,.0193248,0,.696854,.687884,.0181582,0,.719942,.676818,.0170746,0,.743651,.666247,.0160718,0,.768057,.655284,.0151262,0,.793253,.64401,.0142561,0,.819363,.633353,.0134327,0,.846547,.622674,.012653,0,.875017,.612265,.0119354,0,.905021,.602455,.0112533,0,.936508,.593147,.0106234,0,.968254,.583592,.0100213,0,1,1,.25717,0,0,1,.25717,0,0,.999992,.257164,0,0,.999958,.257135,0,641715e-9,.999864,.25706,0,.00305314,.999666,.256897,0,.00700975,.999302,.256596,0,.0122194,.998663,.25607,0,.0184622,.995607,.254123,0,.0255773,.993094,.252081,0,.0334439,.9907,.249867,0,.0419696,.98594,.246118,0,.0510823,.981214,.242049,0,.0607242,.974966,.236869,0,.0708486,.967589,.230724,0,.081417,.95915,.223635,0,.0923974,.950257,.21596,0,.103763,.940165,.207296,0,.115491,.929396,.197901,0,.127562,.919288,.188437,0,.13996,.909428,.178762,0,.15267,.900105,.169072,0,.165679,.891418,.159478,0,.178979,.883347,.15002,0,.192558,.875992,.140813,0,.20641,.869466,.13196,0,.220529,.863699,.123501,0,.234907,.858553,.115436,0,.249542,.854379,.107901,0,.264428,.850894,.10088,0,.279564,.847632,.0942296,0,.294947,.844571,.0879861,0,.310575,.84163,.0821534,0,.326448,.838542,.0766409,0,.342566,.835412,.0715322,0,.358929,.831899,.0666883,0,.37554,.828177,.0622175,0,.392399,.82416,.0580452,0,.409511,.820393,.054267,0,.426878,.816068,.0507172,0,.444506,.811201,.0474041,0,.4624,.805785,.0443174,0,.480566,.799878,.0414562,0,.499013,.793469,.0388147,0,.517749,.786473,.0363453,0,.536785,.778874,.0340225,0,.556134,.771277,.0318599,0,.575809,.763426,.0298859,0,.595827,.755044,.0280357,0,.616207,.746161,.0262979,0,.636973,.737124,.0247295,0,.65815,.72761,.0232514,0,.679772,.717822,.0218755,0,.701876,.708279,.0205942,0,.724509,.698333,.0193947,0,.74773,.68802,.0182717,0,.771609,.677321,.0172044,0,.79624,.666504,.0162122,0,.821743,.656184,.0152924,0,.84828,.64556,.0144326,0,.876069,.634636,.0136157,0,.905404,.624124,.0128612,0,.936508,.613914,.0121435,0,.968254,.603589,.0114887,0,1,1,.307946,0,0,.999999,.307945,0,0,.999988,.307934,0,204479e-10,.999944,.307886,0,.00127833,.999824,.307756,0,.00445047,.999565,.30748,0,.00914673,.999085,.306966,0,.0150498,.998103,.306004,0,.0219367,.994249,.303028,0,.0296485,.991807,.300435,0,.038068,.987773,.296554,0,.0471062,.982673,.2916,0,.0566942,.976623,.285641,0,.0667768,.968757,.27815,0,.0773099,.959849,.269529,0,.088257,.950663,.260248,0,.0995879,.940129,.249704,0,.111277,.92895,.238291,0,.123304,.917996,.226501,0,.13565,.907813,.214669,0,.148299,.898305,.202835,0,.161237,.889626,.191158,0,.174455,.88175,.179695,0,.187941,.874715,.168548,0,.201687,.868746,.15792,0,.215687,.863703,.147807,0,.229933,.859315,.138149,0,.24442,.855538,.128993,0,.259145,.852428,.120414,0,.274103,.850168,.112498,0,.289293,.848132,.105054,0,.304711,.846291,.0981087,0,.320357,.844431,.0915942,0,.33623,.842493,.0855056,0,.35233,.840368,.0798204,0,.368658,.83798,.0745097,0,.385214,.83523,.0695424,0,.402002,.832091,.0649092,0,.419023,.828667,.0606291,0,.436282,.824805,.0566523,0,.453782,.820988,.0530229,0,.471529,.816635,.0496364,0,.489528,.811725,.0464658,0,.507788,.806316,.0435082,0,.526317,.800469,.0407873,0,.545124,.794107,.038255,0,.564221,.787218,.0358825,0,.583621,.779872,.0336785,0,.603341,.772097,.0316379,0,.623397,.764484,.0297379,0,.643812,.756428,.0279581,0,.664611,.748022,.0263153,0,.685824,.739268,.0247799,0,.707488,.73024,.0233385,0,.729646,.720893,.0220035,0,.752354,.71119,.0207555,0,.77568,.701791,.0195843,0,.799715,.692184,.0184891,0,.824574,.682258,.0174541,0,.850417,.67206,.0164873,0,.877466,.661717,.0155959,0,.90604,.651462,.0147519,0,.936528,.641467,.0139727,0,.968254,.631229,.0132363,0,1,1,.367573,0,0,.999999,.367571,0,0,.999984,.367553,0,183382e-9,.999925,.367473,0,.00225254,.999759,.367259,0,.00628165,.99941,.366801,0,.0117858,.998739,.365946,0,.0184359,.995529,.363191,0,.0260114,.992875,.360171,0,.0343581,.989135,.355981,0,.0433637,.984166,.350401,0,.0529438,.977871,.343348,0,.0630334,.96951,.334341,0,.0735805,.959964,.323862,0,.0845437,.950162,.312521,0,.095889,.938882,.299577,0,.107588,.926992,.285573,0,.119617,.915589,.271212,0,.131957,.904791,.256611,0,.144591,.895177,.242224,0,.157503,.886403,.227952,0,.170682,.878957,.214192,0,.184117,.872418,.200795,0,.197799,.867029,.188015,0,.21172,.862835,.175975,0,.225873,.859411,.164526,0,.240253,.856655,.153693,0,.254854,.854519,.14352,0,.269673,.852828,.13397,0,.284707,.851412,.124984,0,.299953,.850609,.116748,0,.315408,.849855,.10905,0,.331073,.849017,.101839,0,.346946,.848079,.0951359,0,.363028,.846911,.0888774,0,.379318,.845445,.0830375,0,.395818,.84362,.0775844,0,.41253,.841411,.0725054,0,.429457,.838768,.0677691,0,.446602,.835801,.0634016,0,.463968,.832341,.0593095,0,.481561,.828424,.0555121,0,.499386,.824312,.052024,0,.51745,.819918,.0487865,0,.535761,.815072,.0457801,0,.554328,.809863,.0430184,0,.573162,.804164,.0404245,0,.592275,.798034,.0380146,0,.611681,.791436,.0357436,0,.631398,.784498,.0336475,0,.651445,.777125,.0316666,0,.671845,.769365,.0298122,0,.692628,.761579,.0281001,0,.713827,.753746,.0265049,0,.735484,.745573,.0250067,0,.75765,.737083,.0236026,0,.78039,.728545,.0223302,0,.803789,.719691,.0211243,0,.82796,.710569,.0199983,0,.853056,.701216,.0189569,0,.879298,.692094,.0179702,0,.907014,.682909,.0170418,0,.936691,.673509,.0161732,0,.968254,.663863,.0153406,0,1,1,.437395,0,0,.999998,.437394,0,0,.99998,.437363,0,616704e-9,.999891,.437232,0,.00367925,.999656,.436877,0,.00867446,.999148,.436121,0,.0150679,.997959,.434564,0,.022531,.993464,.430134,0,.0308507,.990606,.426077,0,.0398805,.985027,.419397,0,.0495148,.978491,.41118,0,.0596749,.969643,.40048,0,.0703001,.959189,.38769,0,.0813427,.948223,.373575,0,.0927641,.935955,.357622,0,.104533,.923237,.34043,0,.116624,.911074,.322735,0,.129015,.899724,.30479,0,.141687,.890189,.287392,0,.154626,.881796,.270248,0,.167818,.874781,.253659,0,.181252,.869166,.237786,0,.194918,.864725,.222618,0,.208807,.861565,.208356,0,.222913,.859284,.194867,0,.237229,.857677,.18212,0,.25175,.856714,.17018,0,.266473,.856155,.158969,0,.281392,.8558,.148413,0,.296505,.855672,.138578,0,.311811,.855538,.129345,0,.327306,.855689,.120861,0,.342991,.855767,.112969,0,.358864,.855618,.105593,0,.374925,.85525,.0987451,0,.391176,.854583,.0923727,0,.407616,.853534,.0864143,0,.424249,.852061,.0808338,0,.441076,.850253,.0756771,0,.4581,.848004,.0708612,0,.475324,.845333,.0663784,0,.492754,.842376,.0622631,0,.510394,.838956,.0584112,0,.528251,.835121,.0548328,0,.546331,.830842,.0514838,0,.564644,.826212,.048355,0,.583198,.821522,.0454714,0,.602005,.816551,.0428263,0,.621078,.811211,.0403612,0,.640434,.805479,.038039,0,.660089,.799409,.0358739,0,.680066,.79306,.0338727,0,.70039,.786395,.0319985,0,.721094,.779416,.030241,0,.742215,.77214,.0285951,0,.7638,.764636,.0270747,0,.785912,.756836,.0256354,0,.808628,.749315,.0243027,0,.832055,.741561,.0230497,0,.856338,.733589,.0218801,0,.88169,.725479,.020784,0,.908441,.717255,.0197702,0,.937125,.708829,.0188168,0,.968254,.700191,.0179113,0,1,1,.518937,0,0,.999998,.518933,0,0,.999967,.518883,0,.00147741,.999832,.51866,0,.00573221,.999466,.518057,0,.011826,.998644,.516752,0,.0192116,.994458,.512347,0,.027573,.991223,.507675,0,.0367099,.985515,.500188,0,.046487,.978308,.490408,0,.0568071,.968359,.477357,0,.0675984,.95682,.461752,0,.0788059,.943929,.443796,0,.090386,.930224,.423893,0,.102304,.916514,.402682,0,.114532,.903653,.380914,0,.127047,.892315,.359212,0,.139828,.882942,.338102,0,.152861,.875438,.31773,0,.16613,.869642,.298186,0,.179624,.865304,.279491,0,.193332,.862382,.261804,0,.207247,.860666,.245146,0,.22136,.859788,.229406,0,.235666,.859608,.214605,0,.250158,.859912,.200691,0,.264832,.86053,.187623,0,.279684,.861368,.17539,0,.294711,.862237,.163901,0,.309911,.863127,.153175,0,.32528,.863923,.143147,0,.340819,.864567,.133781,0,.356524,.865013,.125042,0,.372397,.86539,.116952,0,.388438,.865591,.109476,0,.404645,.865517,.102542,0,.421022,.865084,.0960688,0,.437569,.864309,.0900499,0,.454287,.863151,.0844328,0,.471181,.861649,.0792218,0,.488253,.859742,.0743482,0,.505507,.857446,.0697963,0,.522947,.854757,.0655364,0,.54058,.851783,.061608,0,.558412,.848516,.0579701,0,.576449,.844897,.0545742,0,.594701,.840956,.0514167,0,.613178,.836676,.0484598,0,.631892,.832075,.0456934,0,.650856,.827191,.0431178,0,.670088,.822295,.0407718,0,.689606,.817294,.0386032,0,.709434,.812013,.0365675,0,.7296,.806465,.0346547,0,.750138,.800691,.0328717,0,.771093,.794709,.031211,0,.792519,.788493,.0296504,0,.814488,.782049,.0281782,0,.837097,.775403,.0267965,0,.860481,.76857,.0255002,0,.884842,.761536,.0242759,0,.910494,.754303,.0231142,0,.937985,.74692,.0220305,0,.968254,.739745,.0210192,0,1,1,.613914,0,0,.999996,.613907,0,963597e-10,.999942,.613814,0,.00301247,.999704,.613407,0,.00870385,.999046,.612302,0,.0160714,.995516,.608266,0,.0245899,.991726,.602863,0,.0339681,.985157,.593956,0,.0440254,.97642,.581748,0,.0546409,.964404,.565183,0,.0657284,.950601,.545273,0,.0772246,.935158,.522129,0,.0890812,.919364,.496782,0,.10126,.904754,.470571,0,.113731,.89176,.444037,0,.126469,.881492,.418322,0,.139454,.873656,.393522,0,.15267,.868053,.369795,0,.166101,.864336,.347171,0,.179736,.862259,.325737,0,.193565,.861556,.305532,0,.207578,.861776,.286416,0,.221769,.862661,.268355,0,.23613,.864015,.251334,0,.250656,.865711,.235352,0,.265343,.867519,.220302,0,.280187,.869351,.206161,0,.295183,.871144,.192908,0,.31033,.872839,.180505,0,.325624,.874307,.168848,0,.341065,.875667,.158021,0,.35665,.876758,.147877,0,.37238,.87764,.138441,0,.388253,.878237,.129627,0,.404269,.878563,.121415,0,.42043,.878572,.113741,0,.436735,.87842,.106652,0,.453187,.878057,.100097,0,.469786,.877413,.0940128,0,.486536,.87646,.0883462,0,.503439,.875233,.0830924,0,.520498,.8737,.0781975,0,.537717,.871873,.07364,0,.555102,.86978,.0694103,0,.572657,.867405,.0654696,0,.59039,.864751,.0617914,0,.608307,.861818,.0583491,0,.626419,.858645,.0551443,0,.644733,.855307,.0521894,0,.663264,.851736,.0494334,0,.682025,.847927,.0468504,0,.701032,.843888,.0444261,0,.720308,.839629,.0421497,0,.739875,.835158,.0400082,0,.759764,.830509,.0380076,0,.780014,.825714,.0361488,0,.800673,.820729,.0343956,0,.821803,.815751,.0327781,0,.843492,.810752,.031275,0,.86586,.805587,.0298542,0,.889087,.800317,.0285397,0,.913466,.79489,.0272948,0,.93952,.789314,.0261139,0,.96835,.783593,.0249938,0,1,1,.724258,0,0,.999992,.724243,0,726889e-9,.99987,.724044,0,.00569574,.999336,.72317,0,.0131702,.996271,.719432,0,.0220738,.991159,.712576,0,.0319405,.982465,.700927,0,.0425202,.97049,.684297,0,.0536599,.953973,.661244,0,.065258,.935546,.633804,0,.0772427,.916596,.603071,0,.0895616,.899353,.57105,0,.102175,.885216,.539206,0,.11505,.875076,.508714,0,.128164,.868334,.479571,0,.141495,.864414,.451796,0,.155026,.862678,.425328,0,.168745,.862835,.400352,0,.182639,.864067,.376532,0,.196699,.866086,.35391,0,.210915,.868557,.332424,0,.225282,.871271,.312053,0,.239792,.874058,.292764,0,.25444,.8768,.27453,0,.269223,.87939,.257297,0,.284135,.8819,.24114,0,.299174,.884187,.225934,0,.314337,.886262,.211669,0,.329622,.888119,.198311,0,.345026,.889709,.185783,0,.360549,.891054,.174063,0,.376189,.892196,.163143,0,.391946,.893101,.152952,0,.407819,.893803,.143475,0,.423808,.894277,.134647,0,.439914,.894532,.126434,0,.456137,.894576,.1188,0,.472479,.894393,.111694,0,.48894,.893976,.105069,0,.505523,.893346,.0989077,0,.52223,.892502,.0931724,0,.539064,.891441,.0878276,0,.556028,.890276,.082903,0,.573125,.888972,.0783505,0,.590361,.887469,.0741083,0,.607741,.885785,.0701633,0,.62527,.883914,.0664835,0,.642957,.881872,.0630567,0,.660809,.879651,.0598527,0,.678836,.877267,.0568615,0,.69705,.874717,.05406,0,.715465,.872012,.0514378,0,.734098,.869157,.0489805,0,.752968,.866155,.0466727,0,.772101,.863014,.0445056,0,.791529,.859748,.0424733,0,.81129,.856416,.0405957,0,.831438,.852958,.0388273,0,.852044,.849382,.0371619,0,.87321,.845694,.0355959,0,.89509,.841893,.0341155,0,.917932,.837981,.0327141,0,.942204,.833963,.0313856,0,.968981,.829847,.0301275,0,1,1,.85214,0,0,.999969,.852095,0,.00279627,.999483,.851408,0,.0107635,.994545,.84579,0,.0206454,.986188,.835231,0,.0315756,.969847,.814687,0,.0432021,.945951,.783735,0,.0553396,.91917,.746074,0,.0678766,.895488,.706938,0,.0807395,.878232,.669534,0,.0938767,.868252,.635168,0,.10725,.863873,.603069,0,.120832,.863369,.572514,0,.134598,.86545,.543169,0,.148533,.868803,.514578,0,.16262,.872794,.486762,0,.176849,.87702,.459811,0,.19121,.881054,.433654,0,.205694,.884974,.408574,0,.220294,.888587,.384525,0,.235005,.891877,.36156,0,.24982,.894793,.339661,0,.264737,.89743,.318913,0,.279751,.899796,.299302,0,.294859,.901943,.280843,0,.310058,.903858,.263481,0,.325346,.905574,.247197,0,.340721,.907069,.231915,0,.356181,.908379,.217614,0,.371725,.90952,.20425,0,.387353,.910483,.191758,0,.403063,.91128,.180092,0,.418854,.911936,.169222,0,.434727,.912454,.159098,0,.450682,.912835,.149668,0,.466718,.913078,.140884,0,.482837,.913192,.132709,0,.499038,.913175,.125095,0,.515324,.91304,.118012,0,.531695,.912781,.111417,0,.548153,.91241,.105281,0,.5647,.911924,.0995691,0,.581338,.911331,.0942531,0,.59807,.910637,.0893076,0,.6149,.90984,.0846998,0,.63183,.908941,.0804044,0,.648865,.907944,.0763984,0,.666011,.906857,.0726638,0,.683273,.90568,.0691783,0,.700659,.904416,.0659222,0,.718176,.903067,.0628782,0,.735834,.901637,.0600307,0,.753646,.900128,.0573647,0,.771625,.898544,.0548668,0,.78979,.89689,.052527,0,.808162,.895165,.0503306,0,.826771,.893371,.0482668,0,.845654,.891572,.0463605,0,.864863,.889763,.0445998,0,.884472,.887894,.0429451,0,.904592,.885967,.0413884,0,.925407,.883984,.0399225,0,.947271,.881945,.0385405,0,.97105,.879854,.0372362,0,1,.999804,.995833,0,0,.938155,.933611,0,.0158731,.864755,.854311,0,.0317461,.888594,.865264,0,.0476191,.905575,.863922,0,.0634921,.915125,.850558,0,.0793651,.920665,.829254,0,.0952381,.924073,.802578,0,.111111,.926304,.772211,0,.126984,.927829,.739366,0,.142857,.928924,.705033,0,.15873,.92973,.670019,0,.174603,.930339,.634993,0,.190476,.930811,.600485,0,.206349,.931191,.566897,0,.222222,.93149,.534485,0,.238095,.931737,.503429,0,.253968,.931939,.473811,0,.269841,.932108,.445668,0,.285714,.93225,.418993,0,.301587,.932371,.393762,0,.31746,.932474,.369939,0,.333333,.932562,.347479,0,.349206,.932638,.326336,0,.365079,.932703,.306462,0,.380952,.93276,.287805,0,.396825,.932809,.270313,0,.412698,.932851,.253933,0,.428571,.932887,.23861,0,.444444,.932917,.224289,0,.460317,.932943,.210917,0,.47619,.932965,.19844,0,.492063,.932982,.186807,0,.507937,.932995,.175966,0,.52381,.933005,.165869,0,.539683,.933011,.156468,0,.555556,.933013,.147719,0,.571429,.933013,.139579,0,.587302,.93301,.132007,0,.603175,.933004,.124965,0,.619048,.932994,.118416,0,.634921,.932982,.112326,0,.650794,.932968,.106663,0,.666667,.93295,.101397,0,.68254,.932931,.0964993,0,.698413,.932908,.0919438,0,.714286,.932883,.0877057,0,.730159,.932856,.0837623,0,.746032,.932827,.0800921,0,.761905,.932796,.0766754,0,.777778,.932762,.0734936,0,.793651,.932727,.0705296,0,.809524,.932689,.0677676,0,.825397,.93265,.0651929,0,.84127,.932609,.0627917,0,.857143,.932565,.0605515,0,.873016,.932521,.0584606,0,.888889,.932474,.0565082,0,.904762,.932427,.0546841,0,.920635,.932377,.0529793,0,.936508,.932326,.0513851,0,.952381,.932274,.0498936,0,.968254,.93222,.0484975,0,.984127,.932164,.0471899,0,1];const i=new Float32Array(t),n=new Float32Array(r);e.UniformsLib.LTC_FLOAT_1=new e.DataTexture(i,64,64,e.RGBAFormat,e.FloatType,e.UVMapping,e.ClampToEdgeWrapping,e.ClampToEdgeWrapping,e.LinearFilter,e.NearestFilter,1),e.UniformsLib.LTC_FLOAT_2=new e.DataTexture(n,64,64,e.RGBAFormat,e.FloatType,e.UVMapping,e.ClampToEdgeWrapping,e.ClampToEdgeWrapping,e.LinearFilter,e.NearestFilter,1);const s=new Uint16Array(t.length);t.forEach((function(t,r){s[r]=e.DataUtils.toHalfFloat(t)}));const o=new Uint16Array(r.length);r.forEach((function(t,r){o[r]=e.DataUtils.toHalfFloat(t)})),e.UniformsLib.LTC_HALF_1=new e.DataTexture(s,64,64,e.RGBAFormat,e.HalfFloatType,e.UVMapping,e.ClampToEdgeWrapping,e.ClampToEdgeWrapping,e.LinearFilter,e.NearestFilter,1),e.UniformsLib.LTC_HALF_2=new e.DataTexture(o,64,64,e.RGBAFormat,e.HalfFloatType,e.UVMapping,e.ClampToEdgeWrapping,e.ClampToEdgeWrapping,e.LinearFilter,e.NearestFilter,1)}},Pf={fromCubeTexture:function(t){var r,i,n,s=0,o=new e.Vector3,a=new e.Vector3,l=new e.Color,c=[0,0,0,0,0,0,0,0,0],h=new e.SphericalHarmonics3,u=h.coefficients;for(let r=0;r<6;r++){var d=t.image[r],p=d.width,m=d.height,f=document.createElement("canvas");f.width=p,f.height=m;var g=f.getContext("2d");g.drawImage(d,0,0,p,m);var v=g.getImageData(0,0,p,m),x=v.data,y=v.width,b=2/y;for(let h=0,d=x.length;h<d;h+=4){l.setRGB(x[h]/255,x[h+1]/255,x[h+2]/255),"colorSpace"in t?"srgb"===t.colorSpace&&l.convertSRGBToLinear():3001===t.encoding&&l.convertSRGBToLinear();var A=h/4,w=(A%y+.5)*b-1,M=1-(Math.floor(A/y)+.5)*b;switch(r){case 0:o.set(-1,M,-w);break;case 1:o.set(1,M,w);break;case 2:o.set(-w,1,-M);break;case 3:o.set(-w,-1,M);break;case 4:o.set(-w,M,1);break;case 5:o.set(w,M,-1)}i=o.lengthSq(),s+=n=4/(Math.sqrt(i)*i),a.copy(o).normalize(),e.SphericalHarmonics3.getBasisAt(a,c);for(let e=0;e<9;e++)u[e].x+=c[e]*l.r*n,u[e].y+=c[e]*l.g*n,u[e].z+=c[e]*l.b*n}}r=4*Math.PI/s;for(let e=0;e<9;e++)u[e].x*=r,u[e].y*=r,u[e].z*=r;return new e.LightProbe(h)},fromCubeRenderTarget:function(t,r){var i,n,s,o=0,a=new e.Vector3,l=new e.Vector3,c=new e.Color,h=[0,0,0,0,0,0,0,0,0],u=new e.SphericalHarmonics3,d=u.coefficients;for(let i=0;i<6;i++){var p=r.width,m=new Uint8Array(p*p*4);t.readRenderTargetPixels(r,0,0,p,p,m,i);var f=2/p;for(let t=0,u=m.length;t<u;t+=4){c.setRGB(m[t]/255,m[t+1]/255,m[t+2]/255),"colorSpace"in r.texture?"srgb"===r.texture.colorSpace&&c.convertSRGBToLinear():3001===r.texture.encoding&&c.convertSRGBToLinear();var g=t/4,v=(g%p+.5)*f-1,x=1-(Math.floor(g/p)+.5)*f;switch(i){case 0:a.set(1,x,-v);break;case 1:a.set(-1,x,v);break;case 2:a.set(v,1,-x);break;case 3:a.set(v,-1,x);break;case 4:a.set(v,x,1);break;case 5:a.set(-v,x,-1)}n=a.lengthSq(),o+=s=4/(Math.sqrt(n)*n),l.copy(a).normalize(),e.SphericalHarmonics3.getBasisAt(l,h);for(let e=0;e<9;e++)d[e].x+=h[e]*c.r*s,d[e].y+=h[e]*c.g*s,d[e].z+=h[e]*c.b*s}}i=4*Math.PI/o;for(let e=0;e<9;e++)d[e].x*=i,d[e].y*=i,d[e].z*=i;return new e.LightProbe(u)}};class Bf extends e.Curve{constructor(){super()}getPoint(t,r){const i=r||new e.Vector3;t=2*Math.PI*t;const n=-.22*Math.cos(t)-1.28*Math.sin(t)-.44*Math.cos(3*t)-.78*Math.sin(3*t),s=-.1*Math.cos(2*t)-.27*Math.sin(2*t)+.38*Math.cos(4*t)+.46*Math.sin(4*t),o=.7*Math.cos(3*t)-.4*Math.sin(3*t);return i.set(n,s,o).multiplyScalar(20)}}class Lf extends e.Curve{constructor(e){super(),this.scale=void 0===e?5:e}getPoint(t,r){const i=r||new e.Vector3;t*=2*Math.PI;const n=16*Math.pow(Math.sin(t),3),s=13*Math.cos(t)-5*Math.cos(2*t)-2*Math.cos(3*t)-Math.cos(4*t);return i.set(n,s,0).multiplyScalar(this.scale)}}class Rf extends e.Curve{constructor(e){super(),this.scale=void 0===e?70:e}getPoint(t,r){const i=r||new e.Vector3;t=4*t*Math.PI;const n=this.scale/2,s=n*(1+Math.cos(t)),o=n*Math.sin(t),a=2*n*Math.sin(t/2);return i.set(s,o,a)}}class Nf extends e.Curve{constructor(){super()}getPoint(t,r){const i=r||new e.Vector3;t*=2*Math.PI;const n=50*Math.sin(t),s=Math.cos(t)*(10+50*Math.cos(t)),o=Math.sin(t)*(10+50*Math.cos(t));return i.set(n,s,o)}}class Df extends e.Curve{constructor(){super()}getPoint(t,r){const i=r||new e.Vector3,n=2*Math.PI*t*150/30,s=30*Math.cos(n),o=30*Math.sin(n),a=150*t;return i.set(s,o,a)}}class If extends e.Curve{constructor(e){super(),this.scale=void 0===e?10:e}getPoint(t,r){const i=r||new e.Vector3;t*=2*Math.PI;const n=(2+Math.cos(3*t))*Math.cos(2*t),s=(2+Math.cos(3*t))*Math.sin(2*t),o=Math.sin(3*t);return i.set(n,s,o).multiplyScalar(this.scale)}}class Uf extends e.Curve{constructor(e){super(),this.scale=void 0===e?10:e}getPoint(t,r){const i=r||new e.Vector3;t*=2*Math.PI;const n=(2+Math.cos(4*t))*Math.cos(3*t),s=(2+Math.cos(4*t))*Math.sin(3*t),o=Math.sin(4*t);return i.set(n,s,o).multiplyScalar(this.scale)}}class Of extends e.Curve{constructor(e){super(),this.scale=void 0===e?10:e}getPoint(t,r){const i=r||new e.Vector3;t*=2*Math.PI;const n=(2+Math.cos(5*t))*Math.cos(2*t),s=(2+Math.cos(5*t))*Math.sin(2*t),o=Math.sin(5*t);return i.set(n,s,o).multiplyScalar(this.scale)}}class kf extends e.Curve{constructor(e){super(),this.scale=void 0===e?10:e}getPoint(t,r){const i=r||new e.Vector3;t=4*t-2;const n=Math.pow(t,3)-3*t,s=Math.pow(t,4)-4*t*t,o=.2*Math.pow(t,5)-2*t;return i.set(n,s,o).multiplyScalar(this.scale)}}const Vf=(e,t,r)=>r*(t-e)+e;class Gf extends e.Curve{constructor(e){super(),this.scale=void 0===e?1:e}getPoint(t,r){const i=r||new e.Vector3,n=.4*(t=Vf(-4,4,t))*(t*t-7)*(t*t-10),s=Math.pow(t,4)-13*t*t,o=.1*t*(t*t-4)*(t*t-9)*(t*t-12);return i.set(n,s,o).multiplyScalar(this.scale)}}class zf extends e.Curve{constructor(e){super(),this.scale=void 0===e?40:e}getPoint(t,r){const i=r||new e.Vector3;t*=2*Math.PI;const n=Math.cos(2*t)*(1+.6*(Math.cos(5*t)+.75*Math.cos(10*t))),s=Math.sin(2*t)*(1+.6*(Math.cos(5*t)+.75*Math.cos(10*t))),o=.35*Math.sin(5*t);return i.set(n,s,o).multiplyScalar(this.scale)}}class Hf extends e.Curve{constructor(e){super(),this.scale=void 0===e?40:e}getPoint(t,r){const i=r||new e.Vector3,n=t*Math.PI*2,s=Math.cos(2*n)*(1+.45*Math.cos(3*n)+.4*Math.cos(9*n)),o=Math.sin(2*n)*(1+.45*Math.cos(3*n)+.4*Math.cos(9*n)),a=.2*Math.sin(9*n);return i.set(s,o,a).multiplyScalar(this.scale)}}class jf extends e.Curve{constructor(e){super(),this.scale=void 0===e?40:e}getPoint(t,r){const i=r||new e.Vector3,n=t*Math.PI*2,s=Math.cos(3*n)*(1+.3*Math.cos(5*n)+.5*Math.cos(10*n)),o=Math.sin(3*n)*(1+.3*Math.cos(5*n)+.5*Math.cos(10*n)),a=.2*Math.sin(20*n);return i.set(s,o,a).multiplyScalar(this.scale)}}class Wf extends e.Curve{constructor(e){super(),this.scale=void 0===e?40:e}getPoint(t,r){const i=r||new e.Vector3,n=t*Math.PI*2,s=Math.cos(4*n)*(1+.5*(Math.cos(5*n)+.4*Math.cos(20*n))),o=Math.sin(4*n)*(1+.5*(Math.cos(5*n)+.4*Math.cos(20*n))),a=.35*Math.sin(15*n);return i.set(s,o,a).multiplyScalar(this.scale)}}const Xf=new e.Matrix4,Qf=new e.Object3D,Yf=new e.Vector3;class Kf extends e.EventDispatcher{constructor(){super(),this.isGeometry=!0,this.uuid=e.MathUtils.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1}applyMatrix4(t){const r=(new e.Matrix3).getNormalMatrix(t);for(let e=0,r=this.vertices.length;e<r;e++){this.vertices[e].applyMatrix4(t)}for(let e=0,t=this.faces.length;e<t;e++){const t=this.faces[e];t.normal.applyMatrix3(r).normalize();for(let e=0,i=t.vertexNormals.length;e<i;e++)t.vertexNormals[e].applyMatrix3(r).normalize()}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this}rotateX(e){return Xf.makeRotationX(e),this.applyMatrix4(Xf),this}rotateY(e){return Xf.makeRotationY(e),this.applyMatrix4(Xf),this}rotateZ(e){return Xf.makeRotationZ(e),this.applyMatrix4(Xf),this}translate(e,t,r){return Xf.makeTranslation(e,t,r),this.applyMatrix4(Xf),this}scale(e,t,r){return Xf.makeScale(e,t,r),this.applyMatrix4(Xf),this}lookAt(e){return Qf.lookAt(e),Qf.updateMatrix(),this.applyMatrix4(Qf.matrix),this}fromBufferGeometry(t){const r=this,i=null!==t.index?t.index:void 0,n=t.attributes;if(void 0===n.position)return console.error("THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion."),this;const s=n.position,o=n.normal,a=n.color,l=n.uv,c=n.uv2;void 0!==c&&(this.faceVertexUvs[1]=[]);for(let t=0;t<s.count;t++)r.vertices.push((new e.Vector3).fromBufferAttribute(s,t)),void 0!==a&&r.colors.push((new e.Color).fromBufferAttribute(a,t));function h(t,i,n,s){const h=void 0===a?[]:[r.colors[t].clone(),r.colors[i].clone(),r.colors[n].clone()],u=void 0===o?[]:[(new e.Vector3).fromBufferAttribute(o,t),(new e.Vector3).fromBufferAttribute(o,i),(new e.Vector3).fromBufferAttribute(o,n)],d=new Jf(t,i,n,u,h,s);r.faces.push(d),void 0!==l&&r.faceVertexUvs[0].push([(new e.Vector2).fromBufferAttribute(l,t),(new e.Vector2).fromBufferAttribute(l,i),(new e.Vector2).fromBufferAttribute(l,n)]),void 0!==c&&r.faceVertexUvs[1].push([(new e.Vector2).fromBufferAttribute(c,t),(new e.Vector2).fromBufferAttribute(c,i),(new e.Vector2).fromBufferAttribute(c,n)])}const u=t.groups;if(u.length>0)for(let e=0;e<u.length;e++){const t=u[e],r=t.start;for(let e=r,n=r+t.count;e<n;e+=3)void 0!==i?h(i.getX(e),i.getX(e+1),i.getX(e+2),t.materialIndex):h(e,e+1,e+2,t.materialIndex)}else if(void 0!==i)for(let e=0;e<i.count;e+=3)h(i.getX(e),i.getX(e+1),i.getX(e+2));else for(let e=0;e<s.count;e+=3)h(e,e+1,e+2);return this.computeFaceNormals(),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Yf).negate(),this.translate(Yf.x,Yf.y,Yf.z),this}normalize(){this.computeBoundingSphere();const t=this.boundingSphere.center,r=this.boundingSphere.radius,i=0===r?1:1/r,n=new e.Matrix4;return n.set(i,0,0,-i*t.x,0,i,0,-i*t.y,0,0,i,-i*t.z,0,0,0,1),this.applyMatrix4(n),this}computeFaceNormals(){const t=new e.Vector3,r=new e.Vector3;for(let e=0,i=this.faces.length;e<i;e++){const i=this.faces[e],n=this.vertices[i.a],s=this.vertices[i.b],o=this.vertices[i.c];t.subVectors(o,s),r.subVectors(n,s),t.cross(r),t.normalize(),i.normal.copy(t)}}computeVertexNormals(t=!0){const r=new Array(this.vertices.length);for(let t=0,i=this.vertices.length;t<i;t++)r[t]=new e.Vector3;if(t){const t=new e.Vector3,i=new e.Vector3;for(let e=0,n=this.faces.length;e<n;e++){const n=this.faces[e],s=this.vertices[n.a],o=this.vertices[n.b],a=this.vertices[n.c];t.subVectors(a,o),i.subVectors(s,o),t.cross(i),r[n.a].add(t),r[n.b].add(t),r[n.c].add(t)}}else{this.computeFaceNormals();for(let e=0,t=this.faces.length;e<t;e++){const t=this.faces[e];r[t.a].add(t.normal),r[t.b].add(t.normal),r[t.c].add(t.normal)}}for(let e=0,t=this.vertices.length;e<t;e++)r[e].normalize();for(let e=0,t=this.faces.length;e<t;e++){const t=this.faces[e],i=t.vertexNormals;3===i.length?(i[0].copy(r[t.a]),i[1].copy(r[t.b]),i[2].copy(r[t.c])):(i[0]=r[t.a].clone(),i[1]=r[t.b].clone(),i[2]=r[t.c].clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)}computeFlatVertexNormals(){this.computeFaceNormals();for(let e=0,t=this.faces.length;e<t;e++){const t=this.faces[e],r=t.vertexNormals;3===r.length?(r[0].copy(t.normal),r[1].copy(t.normal),r[2].copy(t.normal)):(r[0]=t.normal.clone(),r[1]=t.normal.clone(),r[2]=t.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)}computeMorphNormals(){for(let e=0,t=this.faces.length;e<t;e++){const t=this.faces[e];t.__originalFaceNormal?t.__originalFaceNormal.copy(t.normal):t.__originalFaceNormal=t.normal.clone(),t.__originalVertexNormals||(t.__originalVertexNormals=[]);for(let e=0,r=t.vertexNormals.length;e<r;e++)t.__originalVertexNormals[e]?t.__originalVertexNormals[e].copy(t.vertexNormals[e]):t.__originalVertexNormals[e]=t.vertexNormals[e].clone()}const t=new Kf;t.faces=this.faces;for(let r=0,i=this.morphTargets.length;r<i;r++){if(!this.morphNormals[r]){this.morphNormals[r]={},this.morphNormals[r].faceNormals=[],this.morphNormals[r].vertexNormals=[];const t=this.morphNormals[r].faceNormals,i=this.morphNormals[r].vertexNormals;for(let r=0,n=this.faces.length;r<n;r++){const r=new e.Vector3,n={a:new e.Vector3,b:new e.Vector3,c:new e.Vector3};t.push(r),i.push(n)}}const i=this.morphNormals[r];t.vertices=this.morphTargets[r].vertices,t.computeFaceNormals(),t.computeVertexNormals();for(let e=0,t=this.faces.length;e<t;e++){const t=this.faces[e],r=i.faceNormals[e],n=i.vertexNormals[e];r.copy(t.normal),n.a.copy(t.vertexNormals[0]),n.b.copy(t.vertexNormals[1]),n.c.copy(t.vertexNormals[2])}}for(let e=0,t=this.faces.length;e<t;e++){const t=this.faces[e];t.normal=t.__originalFaceNormal,t.vertexNormals=t.__originalVertexNormals}}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new e.Box3),this.boundingBox.setFromPoints(this.vertices)}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new e.Sphere),this.boundingSphere.setFromPoints(this.vertices)}merge(t,r,i=0){if(!t||!t.isGeometry)return void console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",t);let n;const s=this.vertices.length,o=this.vertices,a=t.vertices,l=this.faces,c=t.faces,h=this.colors,u=t.colors;void 0!==r&&(n=(new e.Matrix3).getNormalMatrix(r));for(let e=0,t=a.length;e<t;e++){const t=a[e].clone();void 0!==r&&t.applyMatrix4(r),o.push(t)}for(let e=0,t=u.length;e<t;e++)h.push(u[e].clone());for(let e=0,t=c.length;e<t;e++){const t=c[e];let r,o;const a=t.vertexNormals,h=t.vertexColors,u=new Jf(t.a+s,t.b+s,t.c+s);u.normal.copy(t.normal),void 0!==n&&u.normal.applyMatrix3(n).normalize();for(let e=0,t=a.length;e<t;e++)r=a[e].clone(),void 0!==n&&r.applyMatrix3(n).normalize(),u.vertexNormals.push(r);u.color.copy(t.color);for(let e=0,t=h.length;e<t;e++)o=h[e],u.vertexColors.push(o.clone());u.materialIndex=t.materialIndex+i,l.push(u)}for(let e=0,r=t.faceVertexUvs.length;e<r;e++){const r=t.faceVertexUvs[e];void 0===this.faceVertexUvs[e]&&(this.faceVertexUvs[e]=[]);for(let t=0,i=r.length;t<i;t++){const i=r[t],n=[];for(let e=0,t=i.length;e<t;e++)n.push(i[e].clone());this.faceVertexUvs[e].push(n)}}}mergeMesh(e){e&&e.isMesh?(e.matrixAutoUpdate&&e.updateMatrix(),this.merge(e.geometry,e.matrix)):console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",e)}mergeVertices(e=4){const t={},r=[],i=[],n=Math.pow(10,e);for(let e=0,s=this.vertices.length;e<s;e++){const s=this.vertices[e],o=`${Math.round(s.x*n)}_${Math.round(s.y*n)}_${Math.round(s.z*n)}`;void 0===t[o]?(t[o]=e,r.push(this.vertices[e]),i[e]=r.length-1):i[e]=i[t[o]]}const s=[];for(let e=0,t=this.faces.length;e<t;e++){const t=this.faces[e];t.a=i[t.a],t.b=i[t.b],t.c=i[t.c];const r=[t.a,t.b,t.c];for(let t=0;t<3;t++)if(r[t]===r[(t+1)%3]){s.push(e);break}}for(let e=s.length-1;e>=0;e--){const t=s[e];this.faces.splice(t,1);for(let e=0,r=this.faceVertexUvs.length;e<r;e++)this.faceVertexUvs[e].splice(t,1)}const o=this.vertices.length-r.length;return this.vertices=r,o}setFromPoints(t){this.vertices=[];for(let r=0,i=t.length;r<i;r++){const i=t[r];this.vertices.push(new e.Vector3(i.x,i.y,i.z||0))}return this}sortFacesByMaterialIndex(){const e=this.faces,t=e.length;for(let r=0;r<t;r++)e[r]._id=r;e.sort((function(e,t){return e.materialIndex-t.materialIndex}));const r=this.faceVertexUvs[0],i=this.faceVertexUvs[1];let n,s;r&&r.length===t&&(n=[]),i&&i.length===t&&(s=[]);for(let o=0;o<t;o++){const t=e[o]._id;n&&n.push(r[t]),s&&s.push(i[t])}n&&(this.faceVertexUvs[0]=n),s&&(this.faceVertexUvs[1]=s)}toJSON(){const e={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),void 0!==this.parameters){const t=this.parameters;for(let r in t)void 0!==t[r]&&(e[r]=t[r]);return e}const t=[];for(let e=0;e<this.vertices.length;e++){const r=this.vertices[e];t.push(r.x,r.y,r.z)}const r=[],i=[],n={},s=[],o={},a=[],l={};for(let e=0;e<this.faces.length;e++){const t=this.faces[e],i=!0,n=!1,s=void 0!==this.faceVertexUvs[0][e],o=t.normal.length()>0,a=t.vertexNormals.length>0,l=1!==t.color.r||1!==t.color.g||1!==t.color.b,p=t.vertexColors.length>0;let m=0;if(m=c(m,0,0),m=c(m,1,i),m=c(m,2,n),m=c(m,3,s),m=c(m,4,o),m=c(m,5,a),m=c(m,6,l),m=c(m,7,p),r.push(m),r.push(t.a,t.b,t.c),r.push(t.materialIndex),s){const t=this.faceVertexUvs[0][e];r.push(d(t[0]),d(t[1]),d(t[2]))}if(o&&r.push(h(t.normal)),a){const e=t.vertexNormals;r.push(h(e[0]),h(e[1]),h(e[2]))}if(l&&r.push(u(t.color)),p){const e=t.vertexColors;r.push(u(e[0]),u(e[1]),u(e[2]))}}function c(e,t,r){return r?e|1<<t:e&~(1<<t)}function h(e){const t=e.x.toString()+e.y.toString()+e.z.toString();return void 0!==n[t]||(n[t]=i.length/3,i.push(e.x,e.y,e.z)),n[t]}function u(e){const t=e.r.toString()+e.g.toString()+e.b.toString();return void 0!==o[t]||(o[t]=s.length,s.push(e.getHex())),o[t]}function d(e){const t=e.x.toString()+e.y.toString();return void 0!==l[t]||(l[t]=a.length/2,a.push(e.x,e.y)),l[t]}return e.data={},e.data.vertices=t,e.data.normals=i,s.length>0&&(e.data.colors=s),a.length>0&&(e.data.uvs=[a]),e.data.faces=r,e}clone(){return(new Kf).copy(this)}copy(e){this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;const t=e.vertices;for(let e=0,r=t.length;e<r;e++)this.vertices.push(t[e].clone());const r=e.colors;for(let e=0,t=r.length;e<t;e++)this.colors.push(r[e].clone());const i=e.faces;for(let e=0,t=i.length;e<t;e++)this.faces.push(i[e].clone());for(let t=0,r=e.faceVertexUvs.length;t<r;t++){const r=e.faceVertexUvs[t];void 0===this.faceVertexUvs[t]&&(this.faceVertexUvs[t]=[]);for(let e=0,i=r.length;e<i;e++){const i=r[e],n=[];for(let e=0,t=i.length;e<t;e++){const t=i[e];n.push(t.clone())}this.faceVertexUvs[t].push(n)}}const n=e.morphTargets;for(let e=0,t=n.length;e<t;e++){const t={};if(t.name=n[e].name,void 0!==n[e].vertices){t.vertices=[];for(let r=0,i=n[e].vertices.length;r<i;r++)t.vertices.push(n[e].vertices[r].clone())}if(void 0!==n[e].normals){t.normals=[];for(let r=0,i=n[e].normals.length;r<i;r++)t.normals.push(n[e].normals[r].clone())}this.morphTargets.push(t)}const s=e.morphNormals;for(let e=0,t=s.length;e<t;e++){const t={};if(void 0!==s[e].vertexNormals){t.vertexNormals=[];for(let r=0,i=s[e].vertexNormals.length;r<i;r++){const i=s[e].vertexNormals[r],n={};n.a=i.a.clone(),n.b=i.b.clone(),n.c=i.c.clone(),t.vertexNormals.push(n)}}if(void 0!==s[e].faceNormals){t.faceNormals=[];for(let r=0,i=s[e].faceNormals.length;r<i;r++)t.faceNormals.push(s[e].faceNormals[r].clone())}this.morphNormals.push(t)}const o=e.skinWeights;for(let e=0,t=o.length;e<t;e++)this.skinWeights.push(o[e].clone());const a=e.skinIndices;for(let e=0,t=a.length;e<t;e++)this.skinIndices.push(a[e].clone());const l=e.lineDistances;for(let e=0,t=l.length;e<t;e++)this.lineDistances.push(l[e]);const c=e.boundingBox;null!==c&&(this.boundingBox=c.clone());const h=e.boundingSphere;return null!==h&&(this.boundingSphere=h.clone()),this.elementsNeedUpdate=e.elementsNeedUpdate,this.verticesNeedUpdate=e.verticesNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.lineDistancesNeedUpdate=e.lineDistancesNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,this}toBufferGeometry(){const t=(new qf).fromGeometry(this),r=new e.BufferGeometry,i=new Float32Array(3*t.vertices.length);if(r.setAttribute("position",new e.BufferAttribute(i,3).copyVector3sArray(t.vertices)),t.normals.length>0){const i=new Float32Array(3*t.normals.length);r.setAttribute("normal",new e.BufferAttribute(i,3).copyVector3sArray(t.normals))}if(t.colors.length>0){const i=new Float32Array(3*t.colors.length);r.setAttribute("color",new e.BufferAttribute(i,3).copyColorsArray(t.colors))}if(t.uvs.length>0){const i=new Float32Array(2*t.uvs.length);r.setAttribute("uv",new e.BufferAttribute(i,2).copyVector2sArray(t.uvs))}if(t.uvs2.length>0){const i=new Float32Array(2*t.uvs2.length);r.setAttribute("uv2",new e.BufferAttribute(i,2).copyVector2sArray(t.uvs2))}r.groups=t.groups;for(let i in t.morphTargets){const n=[],s=t.morphTargets[i];for(let t=0,r=s.length;t<r;t++){const r=s[t],i=new e.Float32BufferAttribute(3*r.data.length,3);i.name=r.name,n.push(i.copyVector3sArray(r.data))}r.morphAttributes[i]=n}if(t.skinIndices.length>0){const i=new e.Float32BufferAttribute(4*t.skinIndices.length,4);r.setAttribute("skinIndex",i.copyVector4sArray(t.skinIndices))}if(t.skinWeights.length>0){const i=new e.Float32BufferAttribute(4*t.skinWeights.length,4);r.setAttribute("skinWeight",i.copyVector4sArray(t.skinWeights))}return null!==t.boundingSphere&&(r.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(r.boundingBox=t.boundingBox.clone()),r}computeTangents(){console.error("THREE.Geometry: .computeTangents() has been removed.")}computeLineDistances(){console.error("THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.")}applyMatrix(e){return console.warn("THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)}dispose(){this.dispatchEvent({type:"dispose"})}}Kf.createBufferGeometryFromObject=t=>{let r=new e.BufferGeometry;const i=t.geometry;if(t.isPoints||t.isLine){const t=new e.Float32BufferAttribute(3*i.vertices.length,3),n=new e.Float32BufferAttribute(3*i.colors.length,3);if(r.setAttribute("position",t.copyVector3sArray(i.vertices)),r.setAttribute("color",n.copyColorsArray(i.colors)),i.lineDistances&&i.lineDistances.length===i.vertices.length){const t=new e.Float32BufferAttribute(i.lineDistances.length,1);r.setAttribute("lineDistance",t.copyArray(i.lineDistances))}null!==i.boundingSphere&&(r.boundingSphere=i.boundingSphere.clone()),null!==i.boundingBox&&(r.boundingBox=i.boundingBox.clone())}else t.isMesh&&(r=i.toBufferGeometry());return r};class qf{constructor(){this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}computeGroups(e){const t=[];let r,i,n;const s=e.faces;for(i=0;i<s.length;i++){const e=s[i];e.materialIndex!==n&&(n=e.materialIndex,void 0!==r&&(r.count=3*i-r.start,t.push(r)),r={start:3*i,materialIndex:n})}void 0!==r&&(r.count=3*i-r.start,t.push(r)),this.groups=t}fromGeometry(t){const r=t.faces,i=t.vertices,n=t.faceVertexUvs,s=n[0]&&n[0].length>0,o=n[1]&&n[1].length>0,a=t.morphTargets,l=a.length;let c;if(l>0){c=[];for(let e=0;e<l;e++)c[e]={name:a[e].name,data:[]};this.morphTargets.position=c}const h=t.morphNormals,u=h.length;let d;if(u>0){d=[];for(let e=0;e<u;e++)d[e]={name:h[e].name,data:[]};this.morphTargets.normal=d}const p=t.skinIndices,m=t.skinWeights,f=p.length===i.length,g=m.length===i.length;i.length>0&&0===r.length&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(let t=0;t<r.length;t++){const v=r[t];this.vertices.push(i[v.a],i[v.b],i[v.c]);const x=v.vertexNormals;if(3===x.length)this.normals.push(x[0],x[1],x[2]);else{const e=v.normal;this.normals.push(e,e,e)}const y=v.vertexColors;if(3===y.length)this.colors.push(y[0],y[1],y[2]);else{const e=v.color;this.colors.push(e,e,e)}if(!0===s){const r=n[0][t];void 0!==r?this.uvs.push(r[0],r[1],r[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",t),this.uvs.push(new e.Vector2,new e.Vector2,new e.Vector2))}if(!0===o){const r=n[1][t];void 0!==r?this.uvs2.push(r[0],r[1],r[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",t),this.uvs2.push(new e.Vector2,new e.Vector2,new e.Vector2))}for(let e=0;e<l;e++){const t=a[e].vertices;c[e].data.push(t[v.a],t[v.b],t[v.c])}for(let e=0;e<u;e++){const r=h[e].vertexNormals[t];d[e].data.push(r.a,r.b,r.c)}f&&this.skinIndices.push(p[v.a],p[v.b],p[v.c]),g&&this.skinWeights.push(m[v.a],m[v.b],m[v.c])}return this.computeGroups(t),this.verticesNeedUpdate=t.verticesNeedUpdate,this.normalsNeedUpdate=t.normalsNeedUpdate,this.colorsNeedUpdate=t.colorsNeedUpdate,this.uvsNeedUpdate=t.uvsNeedUpdate,this.groupsNeedUpdate=t.groupsNeedUpdate,null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),this}}class Jf{constructor(t,r,i,n,s,o=0){this.a=t,this.b=r,this.c=i,this.normal=n&&n.isVector3?n:new e.Vector3,this.vertexNormals=Array.isArray(n)?n:[],this.color=s&&s.isColor?s:new e.Color,this.vertexColors=Array.isArray(s)?s:[],this.materialIndex=o}clone(){return(new this.constructor).copy(this)}copy(e){this.a=e.a,this.b=e.b,this.c=e.c,this.normal.copy(e.normal),this.color.copy(e.color),this.materialIndex=e.materialIndex;for(let t=0,r=e.vertexNormals.length;t<r;t++)this.vertexNormals[t]=e.vertexNormals[t].clone();for(let t=0,r=e.vertexColors.length;t<r;t++)this.vertexColors[t]=e.vertexColors[t].clone();return this}}let Zf;exports.ACESFilmicToneMappingShader=oh,exports.AMFLoader=om,exports.ARButton=class{static createButton(e,t={}){const r=document.createElement("button");function i(){r.style.display="",r.style.cursor="auto",r.style.left="calc(50% - 75px)",r.style.width="150px",r.onmouseenter=null,r.onmouseleave=null,r.onclick=null,r.textContent="AR NOT SUPPORTED"}function n(e){e.style.position="absolute",e.style.bottom="20px",e.style.padding="12px 6px",e.style.border="1px solid #fff",e.style.borderRadius="4px",e.style.background="rgba(0,0,0,0.1)",e.style.color="#fff",e.style.font="normal 13px sans-serif",e.style.textAlign="center",e.style.opacity="0.5",e.style.outline="none",e.style.zIndex="999"}if("xr"in navigator)return r.id="ARButton",r.style.display="none",n(r),navigator.xr.isSessionSupported("immersive-ar").then((function(n){n?function(){if(void 0===t.domOverlay){const e=document.createElement("div");e.style.display="none",document.body.appendChild(e);const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("width","38px"),r.setAttribute("height","38px"),r.style.position="absolute",r.style.right="20px",r.style.top="20px",r.addEventListener("click",(function(){var e;null===(e=i)||void 0===e||e.end()})),e.appendChild(r);const n=document.createElementNS("http://www.w3.org/2000/svg","path");n.setAttribute("d","M 12,12 L 28,28 M 28,12 12,28"),n.setAttribute("stroke","#fff"),n.setAttribute("stroke-width","2px"),r.appendChild(n),void 0===t.optionalFeatures&&(t.optionalFeatures=[]),t.optionalFeatures.push("dom-overlay"),t.domOverlay={root:e}}let i=null;async function n(n){n.addEventListener("end",s),e.xr.setReferenceSpaceType("local"),await e.xr.setSession(n),r.textContent="STOP AR",t.domOverlay.root.style.display="",i=n}function s(){i.removeEventListener("end",s),r.textContent="START AR",t.domOverlay.root.style.display="none",i=null}r.style.display="",r.style.cursor="pointer",r.style.left="calc(50% - 50px)",r.style.width="100px",r.textContent="START AR",r.onmouseenter=()=>{r.style.opacity="1.0"},r.onmouseleave=()=>{r.style.opacity="0.5"},r.onclick=()=>{null===i?navigator.xr.requestSession("immersive-ar",t).then(n):i.end()}}():i()})).catch(i),r;{const e=document.createElement("a");return!1===window.isSecureContext?(e.href=document.location.href.replace(/^http:/,"https:"),e.innerHTML="WEBXR NEEDS HTTPS"):(e.href="https://immersiveweb.dev/",e.innerHTML="WEBXR NOT AVAILABLE"),e.style.left="calc(50% - 90px)",e.style.width="180px",e.style.textDecoration="none",n(e),e}}},exports.AdaptiveToneMappingPass=tl,exports.AfterimagePass=class extends Ia{constructor(t=.96,r=cl){super(),p.default(this,"shader",void 0),p.default(this,"uniforms",void 0),p.default(this,"textureComp",void 0),p.default(this,"textureOld",void 0),p.default(this,"shaderMaterial",void 0),p.default(this,"compFsQuad",void 0),p.default(this,"copyFsQuad",void 0),this.shader=r,this.uniforms=e.UniformsUtils.clone(r.uniforms),this.uniforms.damp.value=t,this.textureComp=new e.WebGLRenderTarget(window.innerWidth,window.innerHeight,{minFilter:e.LinearFilter,magFilter:e.NearestFilter,format:e.RGBAFormat}),this.textureOld=new e.WebGLRenderTarget(window.innerWidth,window.innerHeight,{minFilter:e.LinearFilter,magFilter:e.NearestFilter,format:e.RGBAFormat}),this.shaderMaterial=new e.ShaderMaterial({uniforms:this.uniforms,vertexShader:this.shader.vertexShader,fragmentShader:this.shader.fragmentShader}),this.compFsQuad=new Ua(this.shaderMaterial);let i=new e.MeshBasicMaterial;this.copyFsQuad=new Ua(i)}render(e,t,r){this.uniforms.tOld.value=this.textureOld.texture,this.uniforms.tNew.value=r.texture,e.setRenderTarget(this.textureComp),this.compFsQuad.render(e),this.copyFsQuad.material.map=this.textureComp.texture,this.renderToScreen?(e.setRenderTarget(null),this.copyFsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(),this.copyFsQuad.render(e));let i=this.textureOld;this.textureOld=this.textureComp,this.textureComp=i}setSize(e,t){this.textureComp.setSize(e,t),this.textureOld.setSize(e,t)}},exports.AfterimageShader=cl,exports.AmmoPhysics=async function(){if("Ammo"in window==!1)return void console.error("AmmoPhysics: Couldn't find Ammo.js");const e=await Ammo(),t=new e.btDefaultCollisionConfiguration,r=new e.btCollisionDispatcher(t),i=new e.btDbvtBroadphase,n=new e.btSequentialImpulseConstraintSolver,s=new e.btDiscreteDynamicsWorld(r,i,n,t);s.setGravity(new e.btVector3(0,-9.8,0));const o=new e.btTransform,a=[],l=new WeakMap;let c=0;return setInterval((function(){const e=performance.now();if(c>0){const t=(e-c)/1e3;s.stepSimulation(t,10)}c=e;for(let e=0,t=a.length;e<t;e++){const t=a[e];if(t.isInstancedMesh){const e=t.instanceMatrix.array,r=l.get(t);for(let t=0;t<r.length;t++){r[t].getMotionState().getWorldTransform(o);ou(o.getOrigin(),o.getRotation(),e,16*t)}t.instanceMatrix.needsUpdate=!0}else if(t.isMesh){l.get(t).getMotionState().getWorldTransform(o);const e=o.getOrigin(),r=o.getRotation();t.position.set(e.x(),e.y(),e.z()),t.quaternion.set(r.x(),r.y(),r.z(),r.w())}}}),1e3/60),{addMesh:function(t,r=0){const i=function(t){const r=t.parameters;if("BoxGeometry"===t.type){const t=void 0!==r.width?r.width/2:.5,i=void 0!==r.height?r.height/2:.5,n=void 0!==r.depth?r.depth/2:.5,s=new e.btBoxShape(new e.btVector3(t,i,n));return s.setMargin(.05),s}if("SphereGeometry"===t.type||"IcosahedronGeometry"===t.type){const t=void 0!==r.radius?r.radius:1,i=new e.btSphereShape(t);return i.setMargin(.05),i}return null}(t.geometry);null!==i&&(t.isInstancedMesh?function(t,r,i){const n=t.instanceMatrix.array,o=[];for(let a=0;a<t.count;a++){const t=16*a,l=new e.btTransform;l.setFromOpenGLMatrix(n.slice(t,t+16));const c=new e.btDefaultMotionState(l),h=new e.btVector3(0,0,0);i.calculateLocalInertia(r,h);const u=new e.btRigidBodyConstructionInfo(r,c,i,h),d=new e.btRigidBody(u);s.addRigidBody(d),o.push(d)}r>0&&(t.instanceMatrix.setUsage(35048),a.push(t),l.set(t,o))}(t,r,i):t.isMesh&&function(t,r,i){const n=t.position,o=t.quaternion,c=new e.btTransform;c.setIdentity(),c.setOrigin(new e.btVector3(n.x,n.y,n.z)),c.setRotation(new e.btQuaternion(o.x,o.y,o.z,o.w));const h=new e.btDefaultMotionState(c),u=new e.btVector3(0,0,0);i.calculateLocalInertia(r,u);const d=new e.btRigidBodyConstructionInfo(r,h,i,u),p=new e.btRigidBody(d);s.addRigidBody(p),r>0&&(a.push(t),l.set(t,p))}(t,r,i))},setMeshPosition:function(t,r,i=0){if(t.isInstancedMesh){const n=l.get(t)[i];n.setAngularVelocity(new e.btVector3(0,0,0)),n.setLinearVelocity(new e.btVector3(0,0,0)),o.setIdentity(),o.setOrigin(new e.btVector3(r.x,r.y,r.z)),n.setWorldTransform(o)}else if(t.isMesh){const i=l.get(t);i.setAngularVelocity(new e.btVector3(0,0,0)),i.setLinearVelocity(new e.btVector3(0,0,0)),o.setIdentity(),o.setOrigin(new e.btVector3(r.x,r.y,r.z)),i.setWorldTransform(o)}}}},exports.AnaglyphEffect=function(t,r,i){this.colorMatrixLeft=(new e.Matrix3).fromArray([.4561,-.0400822,-.0152161,.500484,-.0378246,-.0205971,.176381,-.0157589,-.00546856]),this.colorMatrixRight=(new e.Matrix3).fromArray([-.0434706,.378476,-.0721527,-.0879388,.73364,-.112961,-.00155529,-.0184503,1.2264]);const n=new e.OrthographicCamera(-1,1,1,-1,0,1),s=new e.Scene,o=new e.StereoCamera,a={minFilter:e.LinearFilter,magFilter:e.NearestFilter,format:e.RGBAFormat};void 0===r&&(r=512),void 0===i&&(i=512);const l=new e.WebGLRenderTarget(r,i,a),c=new e.WebGLRenderTarget(r,i,a),h=new e.ShaderMaterial({uniforms:{mapLeft:{value:l.texture},mapRight:{value:c.texture},colorMatrixLeft:{value:this.colorMatrixLeft},colorMatrixRight:{value:this.colorMatrixRight}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = vec2( uv.x, uv.y );","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D mapLeft;","uniform sampler2D mapRight;","varying vec2 vUv;","uniform mat3 colorMatrixLeft;","uniform mat3 colorMatrixRight;","float lin( float c ) {","\treturn c <= 0.04045 ? c * 0.0773993808 :","\t\t\tpow( c * 0.9478672986 + 0.0521327014, 2.4 );","}","vec4 lin( vec4 c ) {","\treturn vec4( lin( c.r ), lin( c.g ), lin( c.b ), c.a );","}","float dev( float c ) {","\treturn c <= 0.0031308 ? c * 12.92","\t\t\t: pow( c, 0.41666 ) * 1.055 - 0.055;","}","void main() {","\tvec2 uv = vUv;","\tvec4 colorL = lin( texture2D( mapLeft, uv ) );","\tvec4 colorR = lin( texture2D( mapRight, uv ) );","\tvec3 color = clamp(","\t\t\tcolorMatrixLeft * colorL.rgb +","\t\t\tcolorMatrixRight * colorR.rgb, 0., 1. );","\tgl_FragColor = vec4(","\t\t\tdev( color.r ), dev( color.g ), dev( color.b ),","\t\t\tmax( colorL.a, colorR.a ) );","}"].join("\n")}),u=new e.Mesh(new e.PlaneGeometry(2,2),h);s.add(u),this.setSize=(e,r)=>{t.setSize(e,r);const i=t.getPixelRatio();l.setSize(e*i,r*i),c.setSize(e*i,r*i)},this.render=(e,r)=>{const i=t.getRenderTarget();e.updateMatrixWorld(),null===r.parent&&r.updateMatrixWorld(),o.update(r),t.setRenderTarget(l),t.clear(),t.render(e,o.cameraL),t.setRenderTarget(c),t.clear(),t.render(e,o.cameraR),t.setRenderTarget(null),t.render(s,n),t.setRenderTarget(i)},this.dispose=()=>{l&&l.dispose(),c&&c.dispose(),u&&u.geometry.dispose(),h&&h.dispose()}},exports.AnimationClipCreator=Is,exports.ArcballControls=Ra,exports.ArrayElementNode=Ot,exports.ArrayUniformNode=et,exports.AsciiEffect=function(e,t,r){t=void 0===t?" .:-=+*#%@":t,r||(r={});const i=r.resolution?r.resolution:.15,n=r.scale?r.scale:1,s=!!r.color&&r.color,o=!!r.alpha&&r.alpha,a=!!r.block&&r.block,l=!!r.invert&&r.invert;let c,h;const u=document.createElement("div");u.style.cursor="default";const d=document.createElement("table");let p,m,f;u.appendChild(d),this.setSize=(t,r)=>{c=t,h=r,e.setSize(t,r),function(){p=Math.round(c*M),m=Math.round(h*M),b.width=p,b.height=m,f=e.domElement,f.style.backgroundColor&&(d.rows[0].cells[0].style.backgroundColor=f.style.backgroundColor,d.rows[0].cells[0].style.color=f.style.color);d.cellSpacing=0,d.cellPadding=0;const t=d.style;t.display="inline",t.width=`${Math.round(p/M*n)}px`,t.height=`${Math.round(m/M*n)}px`,t.whiteSpace="pre",t.margin="0px",t.padding="0px",t.letterSpacing=`${C}px`,t.fontFamily=x,t.fontSize=`${T}px`,t.lineHeight=`${S}px`,t.textAlign="left",t.textDecoration="none"}()},this.render=(t,r)=>{e.render(t,r),function(e,t){A.clearRect(0,0,p,m),A.drawImage(y,0,0,p,m);const r=A.getImageData(0,0,p,m).data;let i="";for(let e=0;e<m;e+=2){for(let t=0;t<p;t++){const n=4*(e*p+t),c=r[n],h=r[n+1],u=r[n+2],d=r[n+3];let m,f;f=(.3*c+.59*h+.11*u)/255,0==d&&(f=1),m=Math.floor((1-f)*(w.length-1)),l&&(m=w.length-m-1);let g=w[m];void 0!==g&&" "!=g||(g="&nbsp;"),i+=s?`<span style='color:rgb(${c},${h},${u});${a?`background-color:rgb(${c},${h},${u});`:""}${o?`opacity:${d/255};`:""}'>${g}</span>`:g}i+="<br/>"}t.innerHTML=`<tr><td>${i}</td></tr>`}(0,d)},this.domElement=u;const g=" .,:;i1tfLCG08@".split(""),v=" CGO08@".split("");var x="courier new, monospace";const y=e.domElement;var b=document.createElement("canvas");if(!b.getContext)return;const A=b.getContext("2d");if(!A.getImageData)return;let w=s?v:g;t&&(w=t);var M=.5;M=.25,i&&(M=i);var T=2/M*n,S=2/M*n,C=0;switch(n){case 1:C=-1;break;case 2:case 3:C=-2.1;break;case 4:C=-3.1;break;case 5:C=-4.15}},exports.AssimpLoader=Td,exports.AttributeNode=rt,exports.BRDF_GGX=Bn,exports.BRDF_Lambert=Fn,exports.BVHLoader=id,exports.BasicShader=ah,exports.BasisTextureLoader=Id,exports.BleachBypassShader=lh,exports.BlendColorFactor=211,exports.BlendShader=ch,exports.BloomPass=class extends Ia{constructor(t=1,r=25,i=4,n=256){super(),p.default(this,"renderTargetX",void 0),p.default(this,"renderTargetY",void 0),p.default(this,"materialCombine",void 0),p.default(this,"materialConvolution",void 0),p.default(this,"fsQuad",void 0),p.default(this,"combineUniforms",void 0),p.default(this,"convolutionUniforms",void 0),p.default(this,"blurX",new e.Vector2(.001953125,0)),p.default(this,"blurY",new e.Vector2(0,.001953125)),this.renderTargetX=new e.WebGLRenderTarget(n,n),this.renderTargetX.texture.name="BloomPass.x",this.renderTargetY=new e.WebGLRenderTarget(n,n),this.renderTargetY.texture.name="BloomPass.y",this.combineUniforms=e.UniformsUtils.clone(Al.uniforms),this.combineUniforms.strength.value=t,this.materialCombine=new e.ShaderMaterial({uniforms:this.combineUniforms,vertexShader:Al.vertexShader,fragmentShader:Al.fragmentShader,blending:e.AdditiveBlending,transparent:!0}),void 0===bl&&console.error("BloomPass relies on ConvolutionShader");const s=bl;this.convolutionUniforms=e.UniformsUtils.clone(s.uniforms),this.convolutionUniforms.uImageIncrement.value=this.blurX,this.convolutionUniforms.cKernel.value=bl.buildKernel(i),this.materialConvolution=new e.ShaderMaterial({uniforms:this.convolutionUniforms,vertexShader:s.vertexShader,fragmentShader:s.fragmentShader,defines:{KERNEL_SIZE_FLOAT:r.toFixed(1),KERNEL_SIZE_INT:r.toFixed(0)}}),this.needsSwap=!1,this.fsQuad=new Ua(this.materialConvolution)}render(e,t,r,i,n){n&&e.state.buffers.stencil.setTest(!1),this.fsQuad.material=this.materialConvolution,this.convolutionUniforms.tDiffuse.value=r.texture,this.convolutionUniforms.uImageIncrement.value=this.blurX,e.setRenderTarget(this.renderTargetX),e.clear(),this.fsQuad.render(e),this.convolutionUniforms.tDiffuse.value=this.renderTargetX.texture,this.convolutionUniforms.uImageIncrement.value=this.blurY,e.setRenderTarget(this.renderTargetY),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.materialCombine,this.combineUniforms.tDiffuse.value=this.renderTargetY.texture,n&&e.state.buffers.stencil.setTest(!0),e.setRenderTarget(r),this.clear&&e.clear(),this.fsQuad.render(e)}},exports.BlurShaderUtils=al,exports.BokehPass=class extends Ia{constructor(t,r,i){super(),p.default(this,"scene",void 0),p.default(this,"camera",void 0),p.default(this,"renderTargetDepth",void 0),p.default(this,"materialDepth",void 0),p.default(this,"materialBokeh",void 0),p.default(this,"fsQuad",void 0),p.default(this,"_oldClearColor",void 0),p.default(this,"uniforms",void 0),this.scene=t,this.camera=r;const n=void 0!==i.focus?i.focus:1,s=void 0!==i.aspect?i.aspect:r.aspect,o=void 0!==i.aperture?i.aperture:.025,a=void 0!==i.maxblur?i.maxblur:1,l=i.width||window.innerWidth||1,c=i.height||window.innerHeight||1;this.renderTargetDepth=new e.WebGLRenderTarget(l,c,{minFilter:e.NearestFilter,magFilter:e.NearestFilter}),this.renderTargetDepth.texture.name="BokehPass.depth",this.materialDepth=new e.MeshDepthMaterial,this.materialDepth.depthPacking=e.RGBADepthPacking,this.materialDepth.blending=e.NoBlending,void 0===Ja&&console.error("BokehPass relies on BokehShader");const h=Ja,u=e.UniformsUtils.clone(h.uniforms);u.tDepth.value=this.renderTargetDepth.texture,u.focus.value=n,u.aspect.value=s,u.aperture.value=o,u.maxblur.value=a,u.nearClip.value=r.near,u.farClip.value=r.far,this.materialBokeh=new e.ShaderMaterial({defines:Object.assign({},h.defines),uniforms:u,vertexShader:h.vertexShader,fragmentShader:h.fragmentShader}),this.uniforms=u,this.needsSwap=!1,this.fsQuad=new Ua(this.materialBokeh),this._oldClearColor=new e.Color}render(e,t,r){this.scene.overrideMaterial=this.materialDepth,e.getClearColor(this._oldClearColor);const i=e.getClearAlpha(),n=e.autoClear;e.autoClear=!1,e.setClearColor(16777215),e.setClearAlpha(1),e.setRenderTarget(this.renderTargetDepth),e.clear(),e.render(this.scene,this.camera),this.uniforms.tColor.value=r.texture,this.uniforms.nearClip.value=this.camera.near,this.uniforms.farClip.value=this.camera.far,this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(t),e.clear(),this.fsQuad.render(e)),this.scene.overrideMaterial=null,e.setClearColor(this._oldClearColor),e.setClearAlpha(i),e.autoClear=n}},exports.BokehShader=Ja,exports.BokehShader2=No,exports.BoxLineGeometry=Wc,exports.BrightnessContrastShader=hh,exports.BufferNode=St,exports.BypassNode=it,exports.CCDIKHelper=Us,exports.CCDIKSolver=Os,exports.CSM=class{constructor(t){t=t||{},this.camera=t.camera,this.parent=t.parent,this.cascades=t.cascades||3,this.maxFar=t.maxFar||1e5,this.mode=t.mode||"practical",this.shadowMapSize=t.shadowMapSize||2048,this.shadowBias=t.shadowBias||1e-6,this.lightDirection=t.lightDirection||new e.Vector3(1,-1,1).normalize(),this.lightIntensity=t.lightIntensity||1,this.lightNear=t.lightNear||1,this.lightFar=t.lightFar||2e3,this.lightMargin=t.lightMargin||200,this.customSplitsCallback=t.customSplitsCallback,this.fade=!1,this.mainFrustum=new Jc,this.frustums=[],this.breaks=[],this.lights=[],this.shaders=new Map,this.createLights(),this.updateFrustums(),this.injectInclude()}createLights(){for(let t=0;t<this.cascades;t++){const t=new e.DirectionalLight(16777215,this.lightIntensity);t.castShadow=!0,t.shadow.mapSize.width=this.shadowMapSize,t.shadow.mapSize.height=this.shadowMapSize,t.shadow.camera.near=this.lightNear,t.shadow.camera.far=this.lightFar,t.shadow.bias=this.shadowBias,this.parent.add(t),this.parent.add(t.target),this.lights.push(t)}}initCascades(){const e=this.camera;e.updateProjectionMatrix(),this.mainFrustum.setFromProjectionMatrix(e.projectionMatrix,this.maxFar),this.mainFrustum.split(this.breaks,this.frustums)}updateShadowBounds(){const e=this.frustums;for(let t=0;t<e.length;t++){const e=this.lights[t].shadow.camera,r=this.frustums[t],i=r.vertices.near,n=r.vertices.far,s=n[0];let o;o=s.distanceTo(n[2])>s.distanceTo(i[2])?n[2]:i[2];let a=s.distanceTo(o);if(this.fade){const e=this.camera,t=Math.max(e.far,this.maxFar),i=r.vertices.far[0].z/(t-e.near);a+=.25*Math.pow(i,2)*(t-e.near)}e.left=-a/2,e.right=a/2,e.top=a/2,e.bottom=-a/2,e.updateProjectionMatrix()}}getBreaks(){const t=this.camera,r=Math.min(t.far,this.maxFar);switch(this.breaks.length=0,this.mode){case"uniform":i(this.cascades,t.near,r,this.breaks);break;case"logarithmic":n(this.cascades,t.near,r,this.breaks);break;case"practical":!function(t,r,s,o,a){ih.length=0,nh.length=0,n(t,r,s,nh),i(t,r,s,ih);for(let r=1;r<t;r++)a.push(e.MathUtils.lerp(ih[r-1],nh[r-1],o));a.push(1)}(this.cascades,t.near,r,.5,this.breaks);break;case"custom":void 0===this.customSplitsCallback&&console.error("CSM: Custom split scheme callback not defined."),this.customSplitsCallback(this.cascades,t.near,r,this.breaks)}function i(e,t,r,i){for(let n=1;n<e;n++)i.push((t+(r-t)*n/e)/r);i.push(1)}function n(e,t,r,i){for(let n=1;n<e;n++)i.push(t*(r/t)**(n/e)/r);i.push(1)}}update(){const e=this.camera,t=this.frustums;for(let r=0;r<t.length;r++){const i=this.lights[r],n=i.shadow.camera,s=(n.right-n.left)/this.shadowMapSize,o=(n.top-n.bottom)/this.shadowMapSize;i.shadow.camera.updateMatrixWorld(!0),$c.multiplyMatrices(i.shadow.camera.matrixWorldInverse,e.matrixWorld),t[r].toSpace($c,eh);const a=eh.vertices.near,l=eh.vertices.far;rh.makeEmpty();for(let e=0;e<4;e++)rh.expandByPoint(a[e]),rh.expandByPoint(l[e]);rh.getCenter(th),th.z=rh.max.z+this.lightMargin,th.x=Math.floor(th.x/s)*s,th.y=Math.floor(th.y/o)*o,th.applyMatrix4(i.shadow.camera.matrixWorld),i.position.copy(th),i.target.position.copy(th),i.target.position.x+=this.lightDirection.x,i.target.position.y+=this.lightDirection.y,i.target.position.z+=this.lightDirection.z}}injectInclude(){e.ShaderChunk.lights_fragment_begin=Zc.lights_fragment_begin,e.ShaderChunk.lights_pars_begin=Zc.lights_pars_begin}setupMaterial(e){e.defines=e.defines||{},e.defines.USE_CSM=1,e.defines.CSM_CASCADES=this.cascades,this.fade&&(e.defines.CSM_FADE="");const t=[],r=this,i=this.shaders;e.onBeforeCompile=function(n){const s=Math.min(r.camera.far,r.maxFar);r.getExtendedBreaks(t),n.uniforms.CSM_cascades={value:t},n.uniforms.cameraNear={value:r.camera.near},n.uniforms.shadowFar={value:s},i.set(e,n)},i.set(e,null)}updateUniforms(){const e=Math.min(this.camera.far,this.maxFar);this.shaders.forEach((function(t,r){if(null!==t){const r=t.uniforms;this.getExtendedBreaks(r.CSM_cascades.value),r.cameraNear.value=this.camera.near,r.shadowFar.value=e}!this.fade&&"CSM_FADE"in r.defines?(delete r.defines.CSM_FADE,r.needsUpdate=!0):this.fade&&!("CSM_FADE"in r.defines)&&(r.defines.CSM_FADE="",r.needsUpdate=!0)}),this)}getExtendedBreaks(t){for(;t.length<this.breaks.length;)t.push(new e.Vector2);t.length=this.breaks.length;for(let e=0;e<this.cascades;e++){const r=this.breaks[e],i=this.breaks[e-1]||0;t[e].x=i,t[e].y=r}}updateFrustums(){this.getBreaks(),this.initCascades(),this.updateShadowBounds(),this.updateUniforms()}remove(){for(let e=0;e<this.lights.length;e++)this.parent.remove(this.lights[e])}dispose(){const e=this.shaders;e.forEach((function(e,t){delete t.onBeforeCompile,delete t.defines.USE_CSM,delete t.defines.CSM_CASCADES,delete t.defines.CSM_FADE,null!==e&&(delete e.uniforms.CSM_cascades,delete e.uniforms.cameraNear,delete e.uniforms.shadowFar),t.needsUpdate=!0})),e.clear()}},exports.CSMFrustum=Jc,exports.CSMHelper=sh,exports.CSMShader=Zc,exports.CSS2DObject=K,exports.CSS2DRenderer=class{constructor(e={}){const t=this;let r,i,n,s;const o={objects:new WeakMap},a=void 0!==e.element?e.element:document.createElement("div");function l(e,r,i){if(e.isCSS2DObject){q.setFromMatrixPosition(e.matrixWorld),q.applyMatrix4(Z);const l=!0===e.visible&&q.z>=-1&&q.z<=1&&!0===e.layers.test(i.layers);if(e.element.style.display=!0===l?"":"none",!0===l){e.onBeforeRender(t,r,i);const o=e.element;o.style.transform="translate(-50%,-50%) translate("+(q.x*n+n)+"px,"+(-q.y*s+s)+"px)",o.parentNode!==a&&a.appendChild(o),e.onAfterRender(t,r,i)}const h={distanceToCameraSquared:c(i,e)};o.objects.set(e,h)}for(let t=0,n=e.children.length;t<n;t++)l(e.children[t],r,i)}function c(e,t){return $.setFromMatrixPosition(e.matrixWorld),ee.setFromMatrixPosition(t.matrixWorld),$.distanceToSquared(ee)}a.style.overflow="hidden",this.domElement=a,this.getSize=function(){return{width:r,height:i}},this.render=function(e,t){!0!==e.matrixWorldAutoUpdate&&!0!==e.autoUpdate||e.updateMatrixWorld(),null!==t.parent||null!=t.matrixWorldAutoUpdate&&!0!==t.matrixWorldAutoUpdate||t.updateMatrixWorld(),J.copy(t.matrixWorldInverse),Z.multiplyMatrices(t.projectionMatrix,J),l(e,e,t),function(e){const t=function(e){const t=[];return e.traverse((function(e){e.isCSS2DObject&&t.push(e)})),t}(e).sort((function(e,t){if(e.renderOrder!==t.renderOrder)return t.renderOrder-e.renderOrder;return o.objects.get(e).distanceToCameraSquared-o.objects.get(t).distanceToCameraSquared})),r=t.length;for(let e=0,i=t.length;e<i;e++)t[e].element.style.zIndex=r-e}(e)},this.setSize=function(e,t){r=e,i=t,n=r/2,s=i/2,a.style.width=e+"px",a.style.height=t+"px"}}},exports.CSS3DObject=de,exports.CSS3DRenderer=function(){var t,r,i,n,s=this,o=new e.Matrix4,a={camera:{fov:0,style:""},objects:new WeakMap},l=document.createElement("div");l.style.overflow="hidden",this.domElement=l;var c=document.createElement("div");function h(e){return Math.abs(e)<1e-10?0:e}function u(e){var t=e.elements;return"matrix3d("+h(t[0])+","+h(-t[1])+","+h(t[2])+","+h(t[3])+","+h(t[4])+","+h(-t[5])+","+h(t[6])+","+h(t[7])+","+h(t[8])+","+h(-t[9])+","+h(t[10])+","+h(t[11])+","+h(t[12])+","+h(-t[13])+","+h(t[14])+","+h(t[15])+")"}function d(e){var t=e.elements;return"translate(-50%,-50%)"+("matrix3d("+h(t[0])+","+h(t[1])+","+h(t[2])+","+h(t[3])+","+h(-t[4])+","+h(-t[5])+","+h(-t[6])+","+h(-t[7])+","+h(t[8])+","+h(t[9])+","+h(t[10])+","+h(t[11])+","+h(t[12])+","+h(t[13])+","+h(t[14])+","+h(t[15])+")")}function p(e,t,r,i){if(e instanceof de){var n;e.onBeforeRender(s,t,r),e instanceof pe?(o.copy(r.matrixWorldInverse),o.transpose(),o.copyPosition(e.matrixWorld),o.scale(e.scale),o.elements[3]=0,o.elements[7]=0,o.elements[11]=0,o.elements[15]=1,n=d(o)):n=d(e.matrixWorld);var l=e.element,h=a.objects.get(e);if(void 0===h||h.style!==n){l.style.transform=n;var u={style:n};a.objects.set(e,u)}l.style.display=e.visible?"":"none",l.parentNode!==c&&c.appendChild(l),e.onAfterRender(s,t,r)}for(let i=0,n=e.children.length;i<n;i++)p(e.children[i],t,r)}c.style.transformStyle="preserve-3d",c.style.pointerEvents="none",l.appendChild(c),this.getSize=function(){return{width:t,height:r}},this.setSize=function(e,s){i=(t=e)/2,n=(r=s)/2,l.style.width=e+"px",l.style.height=s+"px",c.style.width=e+"px",c.style.height=s+"px"},this.render=function(e,t){var r=t.projectionMatrix.elements[5]*n;if(a.camera.fov!==r&&(l.style.perspective=t.isPerspectiveCamera?r+"px":"",a.camera.fov=r),!0===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),t.isOrthographicCamera)var s=-(t.right+t.left)/2,o=(t.top+t.bottom)/2;var d=(t.isOrthographicCamera?"scale("+r+")translate("+h(s)+"px,"+h(o)+"px)"+u(t.matrixWorldInverse):"translateZ("+r+"px)"+u(t.matrixWorldInverse))+"translate("+i+"px,"+n+"px)";a.camera.style!==d&&(c.style.transform=d,a.camera.style=d),p(e,e,t)}},exports.CSS3DSprite=pe,exports.CameraControls=la,exports.CameraNode=Ft,exports.Capsule=ia,exports.CheckerNode=zn,exports.CinematicCamera=Io,exports.CinquefoilKnot=Of,exports.ClearMaskPass=ul,exports.ClearPass=class extends Ia{constructor(t,r){super(),p.default(this,"clearColor",void 0),p.default(this,"clearAlpha",void 0),p.default(this,"_oldClearColor",void 0),this.needsSwap=!1,this.clearColor=void 0!==t?t:0,this.clearAlpha=void 0!==r?r:0,this._oldClearColor=new e.Color}render(e,t,r){let i;this.clearColor&&(e.getClearColor(this._oldClearColor),i=e.getClearAlpha(),e.setClearColor(this.clearColor,this.clearAlpha)),e.setRenderTarget(this.renderToScreen?null:r),e.clear(),this.clearColor&&e.setClearColor(this._oldClearColor,i)}},exports.CodeNode=nt,exports.ColladaExporter=class{constructor(){p.default(this,"options",void 0),p.default(this,"geometryInfo",void 0),p.default(this,"materialMap",void 0),p.default(this,"imageMap",void 0),p.default(this,"textures",void 0),p.default(this,"libraryImages",void 0),p.default(this,"libraryGeometries",void 0),p.default(this,"libraryEffects",void 0),p.default(this,"libraryMaterials",void 0),p.default(this,"canvas",void 0),p.default(this,"ctx",void 0),p.default(this,"transMat",void 0),p.default(this,"getFuncs",["getX","getY","getZ","getW"]),this.options={version:"1.4.1",author:null,textureDirectory:"",upAxis:"Y_UP",unitName:null,unitMeter:null},this.geometryInfo=new WeakMap,this.materialMap=new WeakMap,this.imageMap=new WeakMap,this.textures=[],this.libraryImages=[],this.libraryGeometries=[],this.libraryEffects=[],this.libraryMaterials=[],this.canvas=null,this.ctx=null,this.transMat=null}parse(e,t,r={}){if(this.options={...this.options,...r},null===this.options.upAxis.match(/^[XYZ]_UP$/))return console.error("ColladaExporter: Invalid upAxis: valid values are X_UP, Y_UP or Z_UP."),null;if(null!==this.options.unitName&&null===this.options.unitMeter)return console.error("ColladaExporter: unitMeter needs to be specified if unitName is specified."),null;if(null!==this.options.unitMeter&&null===this.options.unitName)return console.error("ColladaExporter: unitName needs to be specified if unitMeter is specified."),null;if(""!==this.options.textureDirectory&&(this.options.textureDirectory=`${this.options.textureDirectory}/`.replace(/\\/g,"/").replace(/\/+/g,"/")),"1.4.1"!==this.options.version&&"1.5.0"!==this.options.version)return console.warn(`ColladaExporter : Version ${this.options.version} not supported for export. Only 1.4.1 and 1.5.0.`),null;const i=this.processObject(e);let n=`<?xml version="1.0" encoding="UTF-8" standalone="no" ?><COLLADA xmlns="${"1.4.1"===this.options.version?"http://www.collada.org/2005/11/COLLADASchema":"https://www.khronos.org/collada/"}" version="${this.options.version}"><asset><contributor><authoring_tool>three.js Collada Exporter</authoring_tool>${null!==this.options.author?`<author>${this.options.author}</author>`:""}</contributor><created>${(new Date).toISOString()}</created><modified>${(new Date).toISOString()}</modified><up_axis>Y_UP</up_axis></asset>`;n+=`<library_images>${this.libraryImages.join("")}</library_images>`,n+=`<library_effects>${this.libraryEffects.join("")}</library_effects>`,n+=`<library_materials>${this.libraryMaterials.join("")}</library_materials>`,n+=`<library_geometries>${this.libraryGeometries.join("")}</library_geometries>`,n+=`<library_visual_scenes><visual_scene id="Scene" name="scene">${i}</visual_scene></library_visual_scenes>`,n+='<scene><instance_visual_scene url="#Scene"/></scene>',n+="</COLLADA>";const s={data:this.format(n),textures:this.textures};return"function"==typeof t&&requestAnimationFrame((()=>t(s))),s}format(e){var t,r;const i=/^<\//,n=/(\?>$)|(\/>$)/,s=/<[^>]+>[^<]*<\/[^<]+>/,o=(e,t)=>t>0?e+o(e,t-1):"";let a=0;return null!=(t=null===(r=e.match(/(<[^>]+>[^<]+<\/[^<]+>)|(<[^>]+>)/g))||void 0===r?void 0:r.map((e=>{s.test(e)||n.test(e)||!i.test(e)||a--;const t=`${o(" ",a)}${e}`;return s.test(e)||n.test(e)||i.test(e)||a++,t})).join("\n"))?t:""}base64ToBuffer(e){const t=atob(e),r=new Uint8Array(t.length);for(let e=0,i=r.length;e<i;e++)r[e]=t.charCodeAt(e);return r}imageToData(e,t){var r;this.canvas=this.canvas||document.createElement("canvas"),this.ctx=this.ctx||this.canvas.getContext("2d"),this.canvas.width=e.width instanceof SVGAnimatedLength?0:e.width,this.canvas.height=e.height instanceof SVGAnimatedLength?0:e.height,null===(r=this.ctx)||void 0===r||r.drawImage(e,0,0);const i=this.canvas.toDataURL(`image/${t}`,1).replace(/^data:image\/(png|jpg);base64,/,"");return this.base64ToBuffer(i)}attrBufferToArray(t){if(t instanceof e.InterleavedBufferAttribute&&t.isInterleavedBufferAttribute){const e=new(0,t.array.constructor)(t.count*t.itemSize),r=t.itemSize;for(let i=0,n=t.count;i<n;i++)for(let n=0;n<r;n++)e[i*r+n]=t[this.getFuncs[n]](i);return e}return t.array}subArray(e,t,r){if(Array.isArray(e))return e.slice(t,t+r);return new(0,e.constructor)(e.buffer,t*e.BYTES_PER_ELEMENT,r)}getAttribute(e,t,r,i){const n=this.attrBufferToArray(e);return Array.isArray(n)?`${`<source id="${t}"><float_array id="${t}-array" count="${n.length}">`+n.join(" ")}</float_array><technique_common><accessor source="#${t}-array" count="${Math.floor(n.length/e.itemSize)}" stride="${e.itemSize}">${r.map((e=>`<param name="${e}" type="${i}" />`)).join("")}</accessor></technique_common></source>`:""}getTransform(t){return t.updateMatrix(),this.transMat=this.transMat||new e.Matrix4,this.transMat.copy(t.matrix),this.transMat.transpose(),`<matrix>${this.transMat.toArray().join(" ")}</matrix>`}processGeometry(e){let t=this.geometryInfo.get(e);if(!t){const r=e;if(!r.isBufferGeometry)throw new Error("THREE.ColladaExporter: Geometry is not of type THREE.BufferGeometry.");const i=`Mesh${this.libraryGeometries.length+1}`,n=r.index?r.index.count*r.index.itemSize:r.attributes.position.count,s=null!=r.groups&&0!==r.groups.length?r.groups:[{start:0,count:n,materialIndex:0}];let o=`<geometry id="${i}"${e.name?` name="${e.name}"`:""}><mesh>`;const a=`${i}-position`,l=`${i}-vertices`;o+=this.getAttribute(r.attributes.position,a,["X","Y","Z"],"float"),o+=`<vertices id="${l}"><input semantic="POSITION" source="#${a}" /></vertices>`;let c=`<input semantic="VERTEX" source="#${l}" offset="0" />`;if("normal"in r.attributes){const e=`${i}-normal`;o+=this.getAttribute(r.attributes.normal,e,["X","Y","Z"],"float"),c+=`<input semantic="NORMAL" source="#${e}" offset="0" />`}if("uv"in r.attributes){const e=`${i}-texcoord`;o+=this.getAttribute(r.attributes.uv,e,["S","T"],"float"),c+=`<input semantic="TEXCOORD" source="#${e}" offset="0" set="0" />`}if("uv2"in r.attributes){const e=`${i}-texcoord2`;o+=this.getAttribute(r.attributes.uv2,e,["S","T"],"float"),c+=`<input semantic="TEXCOORD" source="#${e}" offset="0" set="1" />`}if("color"in r.attributes){const e=`${i}-color`;o+=this.getAttribute(r.attributes.color,e,["X","Y","Z"],"uint8"),c+=`<input semantic="COLOR" source="#${e}" offset="0" />`}let h=null;if(r.index)h=this.attrBufferToArray(r.index);else{h=new Array(n);for(let e=0,t=h.length;e<t&&Array.isArray(h);e++)h[e]=e}for(let e=0,t=s.length;e<t;e++){const t=s[e],r=this.subArray(h,t.start,t.count),i=r.length/3;o+=`<triangles material="MESH_MATERIAL_${t.materialIndex}" count="${i}">`,o+=c,o+=`<p>${r.join(" ")}</p>`,o+="</triangles>"}o+="</mesh></geometry>",this.libraryGeometries.push(o),t={meshid:i,bufferGeometry:r},this.geometryInfo.set(e,t)}return t}processTexture(e){let t=this.imageMap.get(e);if(null==t){t=`image-${this.libraryImages.length+1}`;const r="png",i=e.name||t;let n=`<image id="${t}" name="${i}">`;"1.5.0"===this.options.version?n+=`<init_from><ref>${this.options.textureDirectory}${i}.${r}</ref></init_from>`:n+=`<init_from>${this.options.textureDirectory}${i}.${r}</init_from>`,n+="</image>",this.libraryImages.push(n),this.imageMap.set(e,t),this.textures.push({directory:this.options.textureDirectory,name:i,ext:r,data:this.imageToData(e.image,r),original:e})}return t}processMaterial(t){let r=this.materialMap.get(t);if(null==r){r=`Mat${this.libraryEffects.length+1}`;let i="phong";if(t instanceof e.MeshLambertMaterial?i="lambert":t instanceof e.MeshBasicMaterial&&(i="constant",null!==t.map&&console.warn("ColladaExporter: Texture maps not supported with MeshBasicMaterial.")),t instanceof e.MeshPhongMaterial){const n=t.emissive?t.emissive:new e.Color(0,0,0),s=t.color?t.color:new e.Color(0,0,0),o=t.specular?t.specular:new e.Color(1,1,1),a=t.shininess||0,l=t.reflectivity||0;let c="";t.transparent&&(c+=`<transparent>${t.map?'<texture texture="diffuse-sampler"></texture>':"<float>1</float>"}</transparent>`,t.opacity<1&&(c+=`<transparency><float>${t.opacity}</float></transparency>`));const h=`<technique sid="common"><${i}><emission>${t.emissiveMap?'<texture texture="emissive-sampler" texcoord="TEXCOORD" />':`<color sid="emission">${n.r} ${n.g} ${n.b} 1</color>`}</emission>${"constant"!==i?`<diffuse>${t.map?'<texture texture="diffuse-sampler" texcoord="TEXCOORD" />':`<color sid="diffuse">${s.r} ${s.g} ${s.b} 1</color>`}</diffuse>`:""}${"constant"!==i?`<bump>${t.normalMap?'<texture texture="bump-sampler" texcoord="TEXCOORD" />':""}</bump>`:""}${"phong"===i?`<specular><color sid="specular">${o.r} ${o.g} ${o.b} 1</color></specular><shininess>${t.specularMap?'<texture texture="specular-sampler" texcoord="TEXCOORD" />':`<float sid="shininess">${a}</float>`}</shininess>`:""}<reflective><color>${s.r} ${s.g} ${s.b} 1</color></reflective><reflectivity><float>${l}</float></reflectivity>${c}</${i}></technique>`,u=`<effect id="${r}-effect"><profile_COMMON>${t.map?`<newparam sid="diffuse-surface"><surface type="2D"><init_from>${this.processTexture(t.map)}</init_from></surface></newparam><newparam sid="diffuse-sampler"><sampler2D><source>diffuse-surface</source></sampler2D></newparam>`:""}${t.specularMap?`<newparam sid="specular-surface"><surface type="2D"><init_from>${this.processTexture(t.specularMap)}</init_from></surface></newparam><newparam sid="specular-sampler"><sampler2D><source>specular-surface</source></sampler2D></newparam>`:""}${t.emissiveMap?`<newparam sid="emissive-surface"><surface type="2D"><init_from>${this.processTexture(t.emissiveMap)}</init_from></surface></newparam><newparam sid="emissive-sampler"><sampler2D><source>emissive-surface</source></sampler2D></newparam>`:""}${t.normalMap?`<newparam sid="bump-surface"><surface type="2D"><init_from>${this.processTexture(t.normalMap)}</init_from></surface></newparam><newparam sid="bump-sampler"><sampler2D><source>bump-surface</source></sampler2D></newparam>`:""}${h}${t.side===e.DoubleSide?'<extra><technique profile="THREEJS"><double_sided sid="double_sided" type="int">1</double_sided></technique></extra>':""}</profile_COMMON></effect>`,d=`<material id="${r}"${t.name?` name="${t.name}"`:""}><instance_effect url="#${r}-effect" /></material>`;this.libraryMaterials.push(d),this.libraryEffects.push(u),this.materialMap.set(t,r)}}return r}processObject(t){let r=`<node name="${t.name}">`;if(r+=this.getTransform(t),new e.Mesh,t instanceof e.Mesh&&t.isMesh&&null!==t.geometry){const i=this.processGeometry(t.geometry),n=i.meshid,s=i.bufferGeometry;let o,a=null;const l=t.material||new e.MeshBasicMaterial,c=Array.isArray(l)?l:[l];o=s.groups.length>c.length?new Array(s.groups.length):new Array(c.length),a=o.fill(null).map(((e,t)=>this.processMaterial(c[t%c.length]))),r+=`<instance_geometry url="#${n}">`+(null!=a?`<bind_material><technique_common>${a.map(((e,t)=>`<instance_material symbol="MESH_MATERIAL_${t}" target="#${e}" ><bind_vertex_input semantic="TEXCOORD" input_semantic="TEXCOORD" input_set="0" /></instance_material>`)).join("")}</technique_common></bind_material>`:"")+"</instance_geometry>"}return t.children.forEach((e=>r+=this.processObject(e))),r+="</node>",r}},exports.ColladaLoader=nd,exports.ColorConverter=na,exports.ColorCorrectionShader=uh,exports.ColorMapKeywords=aa,exports.ColorNodeUniform=class extends le{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}},exports.ColorSpaceNode=Mn,exports.ColorUniform=le,exports.ColorifyShader=dh,exports.CondNode=Ut,exports.ConstNode=st,exports.ContextNode=ot,exports.ConvertNode=kt,exports.ConvexGeometry=E,exports.ConvexHull=M,exports.ConvexObjectBreaker=_,exports.ConvolutionShader=bl,exports.CopyShader=Xa,exports.CubeTextureNode=mn,exports.CubeTexturePass=nl,exports.DDSLoader=Bd,exports.DOFMipMapShader=ph,exports.DRACOExporter=Ds,exports.DRACOLoader=wm,exports.D_GGX=Pn,exports.DecalGeometry=Xc,exports.DecalVertex=Qc,exports.DecoratedTorusKnot4a=zf,exports.DecoratedTorusKnot4b=Hf,exports.DecoratedTorusKnot5a=jf,exports.DecoratedTorusKnot5c=Wf,exports.DepthLimitedBlurShader=ol,exports.DeviceOrientationControls=wa,exports.DigitalGlitch=Va,exports.DotScreenPass=class extends Ia{constructor(t,r,i){super(),p.default(this,"material",void 0),p.default(this,"fsQuad",void 0),p.default(this,"uniforms",void 0),void 0===dl&&console.error("THREE.DotScreenPass relies on THREE.DotScreenShader");const n=dl;this.uniforms=e.UniformsUtils.clone(n.uniforms),void 0!==t&&this.uniforms.center.value.copy(t),void 0!==r&&(this.uniforms.angle.value=r),void 0!==i&&(this.uniforms.scale.value=i),this.material=new e.ShaderMaterial({uniforms:this.uniforms,vertexShader:n.vertexShader,fragmentShader:n.fragmentShader}),this.fsQuad=new Ua(this.material)}render(e,t,r){this.uniforms.tDiffuse.value=r.texture,this.uniforms.tSize.value.set(r.width,r.height),this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(),this.fsQuad.render(e))}},exports.DotScreenShader=dl,exports.DragControls=ma,exports.EPSILON=un,exports.EXRLoader=Cd,exports.EdgeSplitModifier=class{constructor(){p.default(this,"A",new e.Vector3),p.default(this,"B",new e.Vector3),p.default(this,"C",new e.Vector3),p.default(this,"positions",[]),p.default(this,"normals",new Float32Array),p.default(this,"indexes",[]),p.default(this,"pointToIndexMap",[]),p.default(this,"splitIndexes",[]),p.default(this,"oldNormals",[]),p.default(this,"computeNormals",(()=>{this.normals=new Float32Array(3*this.indexes.length);for(let e=0;e<this.indexes.length;e+=3){let t=this.indexes[e];this.A.set(this.positions[3*t],this.positions[3*t+1],this.positions[3*t+2]),t=this.indexes[e+1],this.B.set(this.positions[3*t],this.positions[3*t+1],this.positions[3*t+2]),t=this.indexes[e+2],this.C.set(this.positions[3*t],this.positions[3*t+1],this.positions[3*t+2]),this.C.sub(this.B),this.A.sub(this.B);const r=this.C.cross(this.A).normalize();for(let t=0;t<3;t++)this.normals[3*(e+t)]=r.x,this.normals[3*(e+t)+1]=r.y,this.normals[3*(e+t)+2]=r.z}})),p.default(this,"mapPositionsToIndexes",(()=>{this.pointToIndexMap=Array(this.positions.length/3);for(let e=0;e<this.indexes.length;e++){const t=this.indexes[e];null==this.pointToIndexMap[t]&&(this.pointToIndexMap[t]=[]),this.pointToIndexMap[t].push(e)}})),p.default(this,"edgeSplitToGroups",((e,t,r)=>{this.A.set(this.normals[3*r],this.normals[3*r+1],this.normals[3*r+2]).normalize();const i={splitGroup:[],currentGroup:[r]};for(let n of e)n!==r&&(this.B.set(this.normals[3*n],this.normals[3*n+1],this.normals[3*n+2]).normalize(),this.B.dot(this.A)<t?i.splitGroup.push(n):i.currentGroup.push(n));return i})),p.default(this,"edgeSplit",((e,t,r=null)=>{if(0===e.length)return;const i=[];for(let r of e)i.push(this.edgeSplitToGroups(e,t,r));let n=i[0];for(let e of i)e.currentGroup.length>n.currentGroup.length&&(n=e);null!=r&&this.splitIndexes.push({original:r,indexes:n.currentGroup}),n.splitGroup.length&&this.edgeSplit(n.splitGroup,t,r||n.currentGroup[0])})),p.default(this,"modify",((t,r,i=!0)=>{let n=!1;if(t.attributes.normal&&(n=!0,t=t.clone(),!0===i&&null!==t.index&&(this.oldNormals=t.attributes.normal.array),t.deleteAttribute("normal")),null==t.index){if(void 0===Ue)throw"THREE.EdgeSplitModifier relies on BufferGeometryUtils";t=Re(t)}this.indexes=t.index.array,this.positions=t.getAttribute("position").array,this.computeNormals(),this.mapPositionsToIndexes(),this.splitIndexes=[];for(let e of this.pointToIndexMap)this.edgeSplit(e,Math.cos(r)-.001);const s={};for(let r of Object.keys(t.attributes)){const i=t.attributes[r],n=new i.array.constructor((this.indexes.length+this.splitIndexes.length)*i.itemSize);n.set(i.array),s[r]=new e.BufferAttribute(n,i.itemSize,i.normalized)}const o=new Uint32Array(this.indexes.length);o.set(this.indexes);for(let e=0;e<this.splitIndexes.length;e++){const t=this.splitIndexes[e],r=this.indexes[t.original];for(let t of Object.values(s))for(let i=0;i<t.itemSize;i++)t.array[(this.indexes.length+e)*t.itemSize+i]=t.array[r*t.itemSize+i];for(let r of t.indexes)o[r]=this.indexes.length+e}(t=new e.BufferGeometry).setIndex(new e.BufferAttribute(o,1));for(let e of Object.keys(s))t.setAttribute(e,s[e]);if(n&&(t.computeVertexNormals(),null!==this.oldNormals)){const e=new Array(this.oldNormals.length/3).fill(!1);for(let t of this.splitIndexes)e[t.original]=!0;for(let r=0;r<e.length;r++)if(!1===e[r])for(let e=0;e<3;e++)t.attributes.normal.array[3*r+e]=this.oldNormals[3*r+e]}return t}))}},exports.EffectComposer=class{constructor(t,r){if(p.default(this,"renderer",void 0),p.default(this,"_pixelRatio",void 0),p.default(this,"_width",void 0),p.default(this,"_height",void 0),p.default(this,"renderTarget1",void 0),p.default(this,"renderTarget2",void 0),p.default(this,"writeBuffer",void 0),p.default(this,"readBuffer",void 0),p.default(this,"renderToScreen",void 0),p.default(this,"passes",[]),p.default(this,"copyPass",void 0),p.default(this,"clock",void 0),this.renderer=t,void 0===r){const i={minFilter:e.LinearFilter,magFilter:e.LinearFilter,format:e.RGBAFormat},n=t.getSize(new e.Vector2);this._pixelRatio=t.getPixelRatio(),this._width=n.width,this._height=n.height,(r=new e.WebGLRenderTarget(this._width*this._pixelRatio,this._height*this._pixelRatio,i)).texture.name="EffectComposer.rt1"}else this._pixelRatio=1,this._width=r.width,this._height=r.height;this.renderTarget1=r,this.renderTarget2=r.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,void 0===Xa&&console.error("THREE.EffectComposer relies on CopyShader"),void 0===Oa&&console.error("THREE.EffectComposer relies on ShaderPass"),this.copyPass=new Oa(Xa),this.clock=new e.Clock}swapBuffers(){const e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}addPass(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(e){const t=this.passes.indexOf(e);-1!==t&&this.passes.splice(t,1)}isLastEnabledPass(e){for(let t=e+1;t<this.passes.length;t++)if(this.passes[t].enabled)return!1;return!0}render(e){void 0===e&&(e=this.clock.getDelta());const t=this.renderer.getRenderTarget();let r=!1;const i=this.passes.length;for(let t=0;t<i;t++){const i=this.passes[t];if(!1!==i.enabled){if(i.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(t),i.render(this.renderer,this.writeBuffer,this.readBuffer,e,r),i.needsSwap){if(r){const t=this.renderer.getContext(),r=this.renderer.state.buffers.stencil;r.setFunc(t.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),r.setFunc(t.EQUAL,1,4294967295)}this.swapBuffers()}void 0!==hl&&(i instanceof hl?r=!0:i instanceof ul&&(r=!1))}}this.renderer.setRenderTarget(t)}reset(t){if(void 0===t){const r=this.renderer.getSize(new e.Vector2);this._pixelRatio=this.renderer.getPixelRatio(),this._width=r.width,this._height=r.height,(t=this.renderTarget1.clone()).setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=t,this.renderTarget2=t.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}setSize(e,t){this._width=e,this._height=t;const r=this._width*this._pixelRatio,i=this._height*this._pixelRatio;this.renderTarget1.setSize(r,i),this.renderTarget2.setSize(r,i);for(let e=0;e<this.passes.length;e++)this.passes[e].setSize(r,i)}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}},exports.ExpressionNode=lt,exports.FBXLoader=bu,exports.FXAAShader=mh,exports.F_Schlick=Cn,exports.Face3=Jf,exports.FigureEightPolynomialKnot=Gf,exports.FilmPass=class extends Ia{constructor(t,r,i,n){super(),p.default(this,"material",void 0),p.default(this,"fsQuad",void 0),p.default(this,"uniforms",void 0),void 0===Wa&&console.error("THREE.FilmPass relies on FilmShader");const s=Wa;this.uniforms=e.UniformsUtils.clone(s.uniforms),this.material=new e.ShaderMaterial({uniforms:this.uniforms,vertexShader:s.vertexShader,fragmentShader:s.fragmentShader}),void 0!==n&&(this.uniforms.grayscale.value=n),void 0!==t&&(this.uniforms.nIntensity.value=t),void 0!==r&&(this.uniforms.sIntensity.value=r),void 0!==i&&(this.uniforms.sCount.value=i),this.fsQuad=new Ua(this.material)}render(e,t,r,i){this.uniforms.tDiffuse.value=r.texture,this.uniforms.time.value+=i,this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(),this.fsQuad.render(e))}},exports.FilmShader=Wa,exports.FirstPersonControls=ha,exports.FlakesTexture=class{constructor(e=512,t=512){const r=document.createElement("canvas");r.width=e,r.height=t;const i=r.getContext("2d");i.fillStyle="rgb(127,127,255)",i.fillRect(0,0,e,t);for(let r=0;r<4e3;r++){const r=Math.random()*e,n=Math.random()*t,s=3*Math.random()+3;let o=2*Math.random()-1,a=2*Math.random()-1,l=1.5;const c=Math.sqrt(o*o+a*a+l*l);o/=c,a/=c,l/=c,i.fillStyle="rgb("+(127*o+127)+","+(127*a+127)+","+255*l+")",i.beginPath(),i.arc(r,n,s,0,2*Math.PI),i.fill()}return r}},exports.FloatNodeUniform=class extends ne{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}},exports.FloatUniform=ne,exports.Flow=Ce,exports.FlyControls=Da,exports.FocusShader=fh,exports.FogNode=Hn,exports.FogRangeNode=jn,exports.Font=Vu,exports.FontLoader=ku,exports.FreiChenShader=gh,exports.FresnelShader=vh,exports.FullScreenQuad=Ua,exports.FunctionCallNode=ct,exports.FunctionNode=ht,exports.GCodeLoader=Nd,exports.GLTFExporter=os,exports.GLTFLoader=wl,exports.GPUAddressMode={ClampToEdge:"clamp-to-edge",Repeat:"repeat",MirrorRepeat:"mirror-repeat"},exports.GPUBindingType=te,exports.GPUBlendFactor={Zero:"zero",One:"one",SrcColor:"src-color",OneMinusSrcColor:"one-minus-src-color",SrcAlpha:"src-alpha",OneMinusSrcAlpha:"one-minus-src-alpha",DstColor:"dst-color",OneMinusDstColor:"one-minus-dst-color",DstAlpha:"dst-alpha",OneMinusDstAlpha:"one-minus-dst-alpha",SrcAlphaSaturated:"src-alpha-saturated",BlendColor:"blend-color",OneMinusBlendColor:"one-minus-blend-color"},exports.GPUBlendOperation={Add:"add",Subtract:"subtract",ReverseSubtract:"reverse-subtract",Min:"min",Max:"max"},exports.GPUColorWriteFlags={None:0,Red:1,Green:2,Blue:4,Alpha:8,All:15},exports.GPUCompareFunction={Never:"never",Less:"less",Equal:"equal",LessEqual:"less-equal",Greater:"greater",NotEqual:"not-equal",GreaterEqual:"greater-equal",Always:"always"},exports.GPUComputationRenderer=function(t,r,i){this.variables=[],this.currentTextureIndex=0;var n=e.FloatType,s=new e.Scene,o=new e.Camera;o.position.z=1;var a={passThruTexture:{value:null}},l=u("uniform sampler2D passThruTexture;\n\nvoid main() {\n\n\tvec2 uv = gl_FragCoord.xy / resolution.xy;\n\n\tgl_FragColor = texture2D( passThruTexture, uv );\n\n}\n",a),c=new e.Mesh(new e.PlaneGeometry(2,2),l);function h(e){e.defines.resolution="vec2( "+t.toFixed(1)+", "+r.toFixed(1)+" )"}function u(t,r){r=r||{};var i=new e.ShaderMaterial({uniforms:r,vertexShader:"void main()\t{\n\n\tgl_Position = vec4( position, 1.0 );\n\n}\n",fragmentShader:t});return h(i),i}s.add(c),this.setDataType=function(e){return n=e,this},this.addVariable=function(t,r,i){var n={name:t,initialValueTexture:i,material:this.createShaderMaterial(r),dependencies:null,renderTargets:[],wrapS:null,wrapT:null,minFilter:e.NearestFilter,magFilter:e.NearestFilter};return this.variables.push(n),n},this.setVariableDependencies=function(e,t){e.dependencies=t},this.init=function(){if(!1===i.capabilities.isWebGL2&&!1===i.extensions.has("OES_texture_float"))return"No OES_texture_float support for float textures.";if(0===i.capabilities.maxVertexTextures)return"No support for vertex shader textures.";for(let i=0;i<this.variables.length;i++){var e=this.variables[i];e.renderTargets[0]=this.createRenderTarget(t,r,e.wrapS,e.wrapT,e.minFilter,e.magFilter),e.renderTargets[1]=this.createRenderTarget(t,r,e.wrapS,e.wrapT,e.minFilter,e.magFilter),this.renderTexture(e.initialValueTexture,e.renderTargets[0]),this.renderTexture(e.initialValueTexture,e.renderTargets[1]);var n=e.material,s=n.uniforms;if(null!==e.dependencies)for(let t=0;t<e.dependencies.length;t++){var o=e.dependencies[t];if(o.name!==e.name){var a=!1;for(let e=0;e<this.variables.length;e++)if(o.name===this.variables[e].name){a=!0;break}if(!a)return"Variable dependency not found. Variable="+e.name+", dependency="+o.name}s[o.name]={value:null},n.fragmentShader="\nuniform sampler2D "+o.name+";\n"+n.fragmentShader}}return this.currentTextureIndex=0,null},this.compute=function(){var e=this.currentTextureIndex,t=0===this.currentTextureIndex?1:0;for(let s=0,o=this.variables.length;s<o;s++){var r=this.variables[s];if(null!==r.dependencies){var i=r.material.uniforms;for(let t=0,s=r.dependencies.length;t<s;t++){var n=r.dependencies[t];i[n.name].value=n.renderTargets[e].texture}}this.doRenderTarget(r.material,r.renderTargets[t])}this.currentTextureIndex=t},this.getCurrentRenderTarget=function(e){return e.renderTargets[this.currentTextureIndex]},this.getAlternateRenderTarget=function(e){return e.renderTargets[0===this.currentTextureIndex?1:0]},this.addResolutionDefine=h,this.createShaderMaterial=u,this.createRenderTarget=function(i,s,o,a,l,c){return i=i||t,s=s||r,o=o||e.ClampToEdgeWrapping,a=a||e.ClampToEdgeWrapping,l=l||e.NearestFilter,c=c||e.NearestFilter,new e.WebGLRenderTarget(i,s,{wrapS:o,wrapT:a,minFilter:l,magFilter:c,format:e.RGBAFormat,type:n,depthBuffer:!1})},this.createTexture=function(){var i=new Float32Array(t*r*4);return new e.DataTexture(i,t,r,e.RGBAFormat,e.FloatType)},this.renderTexture=function(e,t){a.passThruTexture.value=e,this.doRenderTarget(l,t),a.passThruTexture.value=null},this.doRenderTarget=function(e,t){var r=i.getRenderTarget();c.material=e,i.setRenderTarget(t),i.render(s,o),c.material=l,i.setRenderTarget(r)}},exports.GPUCullMode={None:"none",Front:"front",Back:"back"},exports.GPUFilterMode={Linear:"linear",Nearest:"nearest"},exports.GPUFrontFace={CCW:"ccw",CW:"cw"},exports.GPUIndexFormat={Uint16:"uint16",Uint32:"uint32"},exports.GPUInputStepMode={Vertex:"vertex",Instance:"instance"},exports.GPULoadOp={Load:"load"},exports.GPUPrimitiveTopology={PointList:"point-list",LineList:"line-list",LineStrip:"line-strip",TriangleList:"triangle-list",TriangleStrip:"triangle-strip"},exports.GPUStencilOperation={Keep:"keep",Zero:"zero",Replace:"replace",Invert:"invert",IncrementClamp:"increment-clamp",DecrementClamp:"decrement-clamp",IncrementWrap:"increment-wrap",DecrementWrap:"decrement-wrap"},exports.GPUStoreOp={Store:"store",Clear:"clear"},exports.GPUTextureDimension={OneD:"1d",TwoD:"2d",ThreeD:"3d"},exports.GPUTextureFormat={R8Unorm:"r8unorm",R8Snorm:"r8snorm",R8Uint:"r8uint",R8Sint:"r8sint",R16Uint:"r16uint",R16Sint:"r16sint",R16Float:"r16float",RG8Unorm:"rg8unorm",RG8Snorm:"rg8snorm",RG8Uint:"rg8uint",RG8Sint:"rg8sint",R32Uint:"r32uint",R32Sint:"r32sint",R32Float:"r32float",RG16Uint:"rg16uint",RG16Sint:"rg16sint",RG16Float:"rg16float",RGBA8Unorm:"rgba8unorm",RGBA8UnormSRGB:"rgba8unorm-srgb",RGBA8Snorm:"rgba8snorm",RGBA8Uint:"rgba8uint",RGBA8Sint:"rgba8sint",BRGA8Unorm:"bgra8unorm",BRGA8UnormSRGB:"bgra8unorm-srgb",RGB9E5UFloat:"rgb9e5ufloat",RGB10A2Unorm:"rgb10a2unorm",RG11B10uFloat:"rgb10a2unorm",RG32Uint:"rg32uint",RG32Sint:"rg32sint",RG32Float:"rg32float",RGBA16Uint:"rgba16uint",RGBA16Sint:"rgba16sint",RGBA16Float:"rgba16float",RGBA32Uint:"rgba32uint",RGBA32Sint:"rgba32sint",RGBA32Float:"rgba32float",Stencil8:"stencil8",Depth16Unorm:"depth16unorm",Depth24Plus:"depth24plus",Depth24PlusStencil8:"depth24plus-stencil8",Depth32Float:"depth32float",BC1RGBAUnorm:"bc1-rgba-unorm",BC1RGBAUnormSRGB:"bc1-rgba-unorm-srgb",BC2RGBAUnorm:"bc2-rgba-unorm",BC2RGBAUnormSRGB:"bc2-rgba-unorm-srgb",BC3RGBAUnorm:"bc3-rgba-unorm",BC3RGBAUnormSRGB:"bc3-rgba-unorm-srgb",BC4RUnorm:"bc4-r-unorm",BC4RSNorm:"bc4-r-snorm",BC5RGUnorm:"bc5-rg-unorm",BC5RGSnorm:"bc5-rg-snorm",BC6HRGBUFloat:"bc6h-rgb-ufloat",BC6HRGBFloat:"bc6h-rgb-float",BC7RGBAUnorm:"bc7-rgba-unorm",BC7RGBAUnormSRGB:"bc7-rgba-srgb",Depth24UnormStencil8:"depth24unorm-stencil8",Depth32FloatStencil8:"depth32float-stencil8"},exports.GPUTextureViewDimension=re,exports.GPUVertexFormat={Uchar2:"uchar2",Uchar4:"uchar4",Char2:"char2",Char4:"char4",Uchar2Norm:"uchar2norm",Uchar4Norm:"uchar4norm",Char2Norm:"char2norm",Char4Norm:"char4norm",Ushort2:"ushort2",Ushort4:"ushort4",Short2:"short2",Short4:"short4",Ushort2Norm:"ushort2norm",Ushort4Norm:"ushort4norm",Short2Norm:"short2norm",Short4Norm:"short4norm",Half2:"half2",Half4:"half4",Float:"float",Float2:"float2",Float3:"float3",Float4:"float4",Uint:"uint",Uint2:"uint2",Uint3:"uint3",Uint4:"uint4",Int:"int",Int2:"int2",Int3:"int3",Int4:"int4"},exports.GammaCorrectionShader=xh,exports.Geometry=Kf,exports.GeometryCompressionUtils=Lo,exports.GeometryUtils=ao,exports.GlitchPass=class extends Ia{constructor(t=64){super(),p.default(this,"material",void 0),p.default(this,"fsQuad",void 0),p.default(this,"goWild",void 0),p.default(this,"curF",void 0),p.default(this,"randX",void 0),p.default(this,"uniforms",void 0),this.uniforms=e.UniformsUtils.clone(Va.uniforms),this.uniforms.tDisp.value=this.generateHeightmap(t),this.material=new e.ShaderMaterial({uniforms:this.uniforms,vertexShader:Va.vertexShader,fragmentShader:Va.fragmentShader}),this.fsQuad=new Ua(this.material),this.goWild=!1,this.curF=0,this.generateTrigger()}render(t,r,i){!1===t.capabilities.isWebGL2&&(this.uniforms.tDisp.value.format=e.LuminanceFormat),this.uniforms.tDiffuse.value=i.texture,this.uniforms.seed.value=Math.random(),this.uniforms.byp.value=0,this.curF%this.randX==0||1==this.goWild?(this.uniforms.amount.value=Math.random()/30,this.uniforms.angle.value=e.MathUtils.randFloat(-Math.PI,Math.PI),this.uniforms.seed_x.value=e.MathUtils.randFloat(-1,1),this.uniforms.seed_y.value=e.MathUtils.randFloat(-1,1),this.uniforms.distortion_x.value=e.MathUtils.randFloat(0,1),this.uniforms.distortion_y.value=e.MathUtils.randFloat(0,1),this.curF=0,this.generateTrigger()):this.curF%this.randX<this.randX/5?(this.uniforms.amount.value=Math.random()/90,this.uniforms.angle.value=e.MathUtils.randFloat(-Math.PI,Math.PI),this.uniforms.distortion_x.value=e.MathUtils.randFloat(0,1),this.uniforms.distortion_y.value=e.MathUtils.randFloat(0,1),this.uniforms.seed_x.value=e.MathUtils.randFloat(-.3,.3),this.uniforms.seed_y.value=e.MathUtils.randFloat(-.3,.3)):0==this.goWild&&(this.uniforms.byp.value=1),this.curF++,this.renderToScreen?(t.setRenderTarget(null),this.fsQuad.render(t)):(t.setRenderTarget(r),this.clear&&t.clear(),this.fsQuad.render(t))}generateTrigger(){this.randX=e.MathUtils.randInt(120,240)}generateHeightmap(t){const r=new Float32Array(t*t),i=t*t;for(let t=0;t<i;t++){const i=e.MathUtils.randFloat(0,1);r[t]=i}const n=new e.DataTexture(r,t,t,e.RedFormat,e.FloatType);return n.needsUpdate=!0,n}},exports.GodRaysCombineShader=Ah,exports.GodRaysDepthMaskShader=yh,exports.GodRaysFakeSunShader=wh,exports.GodRaysGenerateShader=bh,exports.GrannyKnot=Bf,exports.GroundProjectedEnv=io,exports.Gyroscope=I,exports.HDRCubeTextureLoader=Tm,exports.HTMLMesh=Jh,exports.HalftonePass=class extends Ia{constructor(t,r,i){super(),p.default(this,"material",void 0),p.default(this,"fsQuad",void 0),p.default(this,"uniforms",void 0),void 0===Ga&&console.error("THREE.HalftonePass requires HalftoneShader"),this.uniforms=e.UniformsUtils.clone(Ga.uniforms),this.material=new e.ShaderMaterial({uniforms:this.uniforms,fragmentShader:Ga.fragmentShader,vertexShader:Ga.vertexShader}),this.uniforms.width.value=t,this.uniforms.height.value=r;for(const e in i)i.hasOwnProperty(e)&&this.uniforms.hasOwnProperty(e)&&(this.uniforms[e].value=i[e]);this.fsQuad=new Ua(this.material)}render(e,t,r){this.material.uniforms.tDiffuse.value=r.texture,this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(),this.fsQuad.render(e))}setSize(e,t){this.uniforms.width.value=e,this.uniforms.height.value=t}},exports.HalftoneShader=Ga,exports.HeartCurve=Lf,exports.HelixCurve=Df,exports.HorizontalBlurShader=Mh,exports.HorizontalTiltShiftShader=Th,exports.HueSaturationShader=Sh,exports.IFFParser=Vp,exports.INFINITY=dn,exports.ImprovedNoise=function(){var e=[151,160,137,91,90,15,131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23,190,6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33,88,237,149,56,87,174,20,125,136,171,168,68,175,74,165,71,134,139,48,27,166,77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244,102,143,54,65,25,63,161,1,216,80,73,209,76,132,187,208,89,18,169,200,196,135,130,116,188,159,86,164,100,109,198,173,186,3,64,52,217,226,250,124,123,5,202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42,223,183,170,213,119,248,152,2,44,154,163,70,221,153,101,155,167,43,172,9,129,22,39,253,19,98,108,110,79,113,224,232,178,185,112,104,218,246,97,228,251,34,242,193,238,210,144,12,191,179,162,241,81,51,145,235,249,14,239,107,49,192,214,31,181,199,106,157,184,84,204,176,115,121,50,45,127,4,150,254,138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180];for(let t=0;t<256;t++)e[256+t]=e[t];function t(e){return e*e*e*(e*(6*e-15)+10)}function r(e,t,r){return t+e*(r-t)}function i(e,t,r,i){var n=15&e,s=n<8?t:r,o=n<4?r:12==n||14==n?t:i;return(0==(1&n)?s:-s)+(0==(2&n)?o:-o)}return{noise:function(n,s,o){var a=Math.floor(n),l=Math.floor(s),c=Math.floor(o),h=255&a,u=255&l,d=255&c,p=(n-=a)-1,m=(s-=l)-1,f=(o-=c)-1,g=t(n),v=t(s),x=t(o),y=e[h]+u,b=e[y]+d,A=e[y+1]+d,w=e[h+1]+u,M=e[w]+d,T=e[w+1]+d;return r(x,r(v,r(g,i(e[b],n,s,o),i(e[M],p,s,o)),r(g,i(e[A],n,m,o),i(e[T],p,m,o))),r(v,r(g,i(e[b+1],n,s,f),i(e[M+1],p,s,f)),r(g,i(e[A+1],n,m,f),i(e[T+1],p,m,f))))}}},exports.InstancedFlow=class extends Ce{constructor(t,r,i,n){const s=new e.InstancedMesh(i,n,t);s.instanceMatrix.setUsage(e.DynamicDrawUsage),s.frustumCulled=!1,super(s,r),p.default(this,"offsets",void 0),p.default(this,"whichCurve",void 0),this.offsets=new Array(t).fill(0),this.whichCurve=new Array(t).fill(0)}writeChanges(e){Fe.makeTranslation(this.curveLengthArray[this.whichCurve[e]],this.whichCurve[e],this.offsets[e]),this.object3D.setMatrixAt(e,Fe),this.object3D.instanceMatrix.needsUpdate=!0}moveIndividualAlongCurve(e,t){this.offsets[e]+=t,this.writeChanges(e)}setCurve(e,t){if(isNaN(t))throw Error("curve index being set is Not a Number (NaN)");this.whichCurve[e]=t,this.writeChanges(e)}},exports.InteractiveGroup=iu,exports.JoinNode=Bt,exports.KMZLoader=sd,exports.KTX2Loader=vd,exports.KTXLoader=mm,exports.KaleidoShader=Ch,exports.KnotCurve=Nf,exports.LDrawLoader=Up,exports.LUT3dlLoader=Pd,exports.LUTCubeLoader=ju,exports.LUTPass=class extends Oa{set lut(e){const t=this.material;if(e!==this.lut&&(t.uniforms.lut3d.value=null,t.uniforms.lut.value=null,e)){const r=e.isData3DTexture?1:0;r!==t.defines.USE_3DTEXTURE&&(t.defines.USE_3DTEXTURE=r,t.needsUpdate=!0),t.uniforms.lutSize.value=e.image.width,e.isData3DTexture?t.uniforms.lut3d.value=e:t.uniforms.lut.value=e}}get lut(){return this.material.uniforms.lut.value||this.material.uniforms.lut3d.value}set intensity(e){this.material.uniforms.intensity.value=e}get intensity(){return this.material.uniforms.intensity.value}constructor(e={}){super(ka),this.lut=e.lut||null,this.intensity="intensity"in e?e.intensity:1}},exports.LWO2Parser=kp,exports.LWO3Parser=Op,exports.LWOLoader=Gm,exports.Lensflare=Ws,exports.LensflareElement=Xs,exports.LightContextNode=Nn,exports.LightNode=Dn,exports.LightProbeGenerator=Pf,exports.LightProbeHelper=yf,exports.LightningStorm=$s,exports.LightningStrike=Zs,exports.LightsNode=In,exports.Line2=class extends xf{constructor(e=new Km,t=new qm({color:16777215*Math.random()})){super(e,t),this.isLine2=!0,this.type="Line2"}},exports.LineBasicNodeMaterial=Zn,exports.LineGeometry=Km,exports.LineMaterial=qm,exports.LineSegments2=xf,exports.LineSegmentsGeometry=Ym,exports.LottieLoader=Ad,exports.LuminosityHighPassShader=rl,exports.LuminosityShader=$a,exports.Lut=oa,exports.MD2Character=function(){var t=this;function r(t,r){var i=new e.TextureLoader,s=[];for(let o=0;o<r.length;o++)s[o]=i.load(t+r[o],n),s[o].mapping=e.UVMapping,s[o].name=r[o],"colorSpace"in s[o]?s[o].colorSpace="srgb":s[o].encoding=3001;return s}function i(t,r){var i=new e.MeshLambertMaterial({color:16755200,wireframe:!0,morphTargets:!0,morphNormals:!0}),n=new e.MeshLambertMaterial({color:16777215,wireframe:!1,map:r,morphTargets:!0,morphNormals:!0}),s=new e.Mesh(t,n);return s.rotation.y=-Math.PI/2,s.castShadow=!0,s.receiveShadow=!0,s.materialTexture=n,s.materialWireframe=i,s}function n(){t.loadCounter-=1,0===t.loadCounter&&t.onLoadComplete()}this.scale=1,this.animationFPS=6,this.root=new e.Object3D,this.meshBody=null,this.meshWeapon=null,this.skinsBody=[],this.skinsWeapon=[],this.weapons=[],this.activeAnimation=null,this.mixer=null,this.onLoadComplete=function(){},this.loadCounter=0,this.loadParts=function(s){this.loadCounter=2*s.weapons.length+s.skins.length+1;var o=[];for(let e=0;e<s.weapons.length;e++)o[e]=s.weapons[e][1];this.skinsBody=r(s.baseUrl+"skins/",s.skins),this.skinsWeapon=r(s.baseUrl+"skins/",o);var a=new g;a.load(s.baseUrl+s.body,(function(r){var s=new e.Box3;s.setFromBufferAttribute(r.attributes.position),t.root.position.y=-t.scale*s.min.y;var o=i(r,t.skinsBody[0]);o.scale.set(t.scale,t.scale,t.scale),t.root.add(o),t.meshBody=o,t.meshBody.clipOffset=0,t.activeAnimationClipName=o.geometry.animations[0].name,t.mixer=new e.AnimationMixer(o),n()}));var l=function(e,r){return function(s){var o=i(s,t.skinsWeapon[e]);o.scale.set(t.scale,t.scale,t.scale),o.visible=!1,o.name=r,t.root.add(o),t.weapons[e]=o,t.meshWeapon=o,n()}};for(let e=0;e<s.weapons.length;e++)a.load(s.baseUrl+s.weapons[e][0],l(e,s.weapons[e][0]))},this.setPlaybackRate=function(e){this.mixer.timeScale=0!==e?1/e:0},this.setWireframe=function(e){e?(this.meshBody&&(this.meshBody.material=this.meshBody.materialWireframe),this.meshWeapon&&(this.meshWeapon.material=this.meshWeapon.materialWireframe)):(this.meshBody&&(this.meshBody.material=this.meshBody.materialTexture),this.meshWeapon&&(this.meshWeapon.material=this.meshWeapon.materialTexture))},this.setSkin=function(e){this.meshBody&&!1===this.meshBody.material.wireframe&&(this.meshBody.material.map=this.skinsBody[e])},this.setWeapon=function(e){for(let e=0;e<this.weapons.length;e++)this.weapons[e].visible=!1;var r=this.weapons[e];r&&(r.visible=!0,this.meshWeapon=r,t.syncWeaponAnimation())},this.setAnimation=function(e){if(this.meshBody){this.meshBody.activeAction&&(this.meshBody.activeAction.stop(),this.meshBody.activeAction=null);var r=this.mixer.clipAction(e,this.meshBody);r&&(this.meshBody.activeAction=r.play())}t.activeClipName=e,t.syncWeaponAnimation()},this.syncWeaponAnimation=function(){var e=t.activeClipName;if(t.meshWeapon){this.meshWeapon.activeAction&&(this.meshWeapon.activeAction.stop(),this.meshWeapon.activeAction=null);var r=this.mixer.clipAction(e,this.meshWeapon);r&&(this.meshWeapon.activeAction=r.syncWith(this.meshBody.activeAction).play())}},this.update=function(e){this.mixer&&this.mixer.update(e)}},exports.MD2CharacterComplex=function(){var t=this;function r(t,r){var i=new e.TextureLoader,s=[];for(let o=0;o<r.length;o++)s[o]=i.load(t+r[o],n),s[o].mapping=e.UVMapping,s[o].name=r[o],"colorSpace"in s[o]?s[o].colorSpace="srgb":s[o].encoding=3001;return s}function i(r,i){var n=new e.MeshLambertMaterial({color:16755200,wireframe:!0,morphTargets:!0,morphNormals:!0}),s=new e.MeshLambertMaterial({color:16777215,wireframe:!1,map:i,morphTargets:!0,morphNormals:!0}),o=new v(r,s);return o.rotation.y=-Math.PI/2,o.materialTexture=s,o.materialWireframe=n,o.autoCreateAnimations(t.animationFPS),o}function n(){t.loadCounter-=1,0===t.loadCounter&&t.onLoadComplete()}function s(e){return 1===e?1:1-Math.pow(2,-10*e)}this.scale=1,this.animationFPS=6,this.transitionFrames=15,this.maxSpeed=275,this.maxReverseSpeed=-275,this.frontAcceleration=600,this.backAcceleration=600,this.frontDecceleration=600,this.angularSpeed=2.5,this.root=new e.Object3D,this.meshBody=null,this.meshWeapon=null,this.controls=null,this.skinsBody=[],this.skinsWeapon=[],this.weapons=[],this.currentSkin=void 0,this.onLoadComplete=function(){},this.meshes=[],this.animations={},this.loadCounter=0,this.speed=0,this.bodyOrientation=0,this.walkSpeed=this.maxSpeed,this.crouchSpeed=.5*this.maxSpeed,this.activeAnimation=null,this.oldAnimation=null,this.enableShadows=function(e){for(let t=0;t<this.meshes.length;t++)this.meshes[t].castShadow=e,this.meshes[t].receiveShadow=e},this.setVisible=function(e){for(let t=0;t<this.meshes.length;t++)this.meshes[t].visible=e,this.meshes[t].visible=e},this.shareParts=function(e){this.animations=e.animations,this.walkSpeed=e.walkSpeed,this.crouchSpeed=e.crouchSpeed,this.skinsBody=e.skinsBody,this.skinsWeapon=e.skinsWeapon;var t=i(e.meshBody.geometry,this.skinsBody[0]);t.scale.set(this.scale,this.scale,this.scale),this.root.position.y=e.root.position.y,this.root.add(t),this.meshBody=t,this.meshes.push(t);for(let t=0;t<e.weapons.length;t++){var r=i(e.weapons[t].geometry,this.skinsWeapon[t]);r.scale.set(this.scale,this.scale,this.scale),r.visible=!1,r.name=e.weapons[t].name,this.root.add(r),this.weapons[t]=r,this.meshWeapon=r,this.meshes.push(r)}},this.loadParts=function(s){this.animations=s.animations,this.walkSpeed=s.walkSpeed,this.crouchSpeed=s.crouchSpeed,this.loadCounter=2*s.weapons.length+s.skins.length+1;var o=[];for(let e=0;e<s.weapons.length;e++)o[e]=s.weapons[e][1];this.skinsBody=r(s.baseUrl+"skins/",s.skins),this.skinsWeapon=r(s.baseUrl+"skins/",o);var a=new g;a.load(s.baseUrl+s.body,(function(r){var s=new e.Box3;s.setFromBufferAttribute(r.attributes.position),t.root.position.y=-t.scale*s.min.y;var o=i(r,t.skinsBody[0]);o.scale.set(t.scale,t.scale,t.scale),t.root.add(o),t.meshBody=o,t.meshes.push(o),n()}));var l=function(e,r){return function(s){var o=i(s,t.skinsWeapon[e]);o.scale.set(t.scale,t.scale,t.scale),o.visible=!1,o.name=r,t.root.add(o),t.weapons[e]=o,t.meshWeapon=o,t.meshes.push(o),n()}};for(let e=0;e<s.weapons.length;e++)a.load(s.baseUrl+s.weapons[e][0],l(e,s.weapons[e][0]))},this.setPlaybackRate=function(e){this.meshBody&&(this.meshBody.duration=this.meshBody.baseDuration/e),this.meshWeapon&&(this.meshWeapon.duration=this.meshWeapon.baseDuration/e)},this.setWireframe=function(e){e?(this.meshBody&&(this.meshBody.material=this.meshBody.materialWireframe),this.meshWeapon&&(this.meshWeapon.material=this.meshWeapon.materialWireframe)):(this.meshBody&&(this.meshBody.material=this.meshBody.materialTexture),this.meshWeapon&&(this.meshWeapon.material=this.meshWeapon.materialTexture))},this.setSkin=function(e){this.meshBody&&!1===this.meshBody.material.wireframe&&(this.meshBody.material.map=this.skinsBody[e],this.currentSkin=e)},this.setWeapon=function(e){for(let e=0;e<this.weapons.length;e++)this.weapons[e].visible=!1;var t=this.weapons[e];t&&(t.visible=!0,this.meshWeapon=t,this.activeAnimation&&(t.playAnimation(this.activeAnimation),this.meshWeapon.setAnimationTime(this.activeAnimation,this.meshBody.getAnimationTime(this.activeAnimation))))},this.setAnimation=function(e){e!==this.activeAnimation&&e&&(this.meshBody&&(this.meshBody.setAnimationWeight(e,0),this.meshBody.playAnimation(e),this.oldAnimation=this.activeAnimation,this.activeAnimation=e,this.blendCounter=this.transitionFrames),this.meshWeapon&&(this.meshWeapon.setAnimationWeight(e,0),this.meshWeapon.playAnimation(e)))},this.update=function(e){this.controls&&this.updateMovementModel(e),this.animations&&(this.updateBehaviors(),this.updateAnimations(e))},this.updateAnimations=function(e){var t=1;this.blendCounter>0&&(t=(this.transitionFrames-this.blendCounter)/this.transitionFrames,this.blendCounter-=1),this.meshBody&&(this.meshBody.update(e),this.meshBody.setAnimationWeight(this.activeAnimation,t),this.meshBody.setAnimationWeight(this.oldAnimation,1-t)),this.meshWeapon&&(this.meshWeapon.update(e),this.meshWeapon.setAnimationWeight(this.activeAnimation,t),this.meshWeapon.setAnimationWeight(this.oldAnimation,1-t))},this.updateBehaviors=function(){var e,t,r=this.controls,i=this.animations;r.crouch?(e=i.crouchMove,t=i.crouchIdle):(e=i.move,t=i.idle),r.jump&&(e=i.jump,t=i.jump),r.attack&&(r.crouch?(e=i.crouchAttack,t=i.crouchAttack):(e=i.attack,t=i.attack)),(r.moveForward||r.moveBackward||r.moveLeft||r.moveRight)&&this.activeAnimation!==e&&this.setAnimation(e),Math.abs(this.speed)<.2*this.maxSpeed&&!(r.moveLeft||r.moveRight||r.moveForward||r.moveBackward)&&this.activeAnimation!==t&&this.setAnimation(t),r.moveForward&&(this.meshBody&&(this.meshBody.setAnimationDirectionForward(this.activeAnimation),this.meshBody.setAnimationDirectionForward(this.oldAnimation)),this.meshWeapon&&(this.meshWeapon.setAnimationDirectionForward(this.activeAnimation),this.meshWeapon.setAnimationDirectionForward(this.oldAnimation))),r.moveBackward&&(this.meshBody&&(this.meshBody.setAnimationDirectionBackward(this.activeAnimation),this.meshBody.setAnimationDirectionBackward(this.oldAnimation)),this.meshWeapon&&(this.meshWeapon.setAnimationDirectionBackward(this.activeAnimation),this.meshWeapon.setAnimationDirectionBackward(this.oldAnimation)))},this.updateMovementModel=function(t){var r=this.controls;r.crouch?this.maxSpeed=this.crouchSpeed:this.maxSpeed=this.walkSpeed,this.maxReverseSpeed=-this.maxSpeed,r.moveForward&&(this.speed=e.MathUtils.clamp(this.speed+t*this.frontAcceleration,this.maxReverseSpeed,this.maxSpeed)),r.moveBackward&&(this.speed=e.MathUtils.clamp(this.speed-t*this.backAcceleration,this.maxReverseSpeed,this.maxSpeed));if(r.moveLeft&&(this.bodyOrientation+=t*this.angularSpeed,this.speed=e.MathUtils.clamp(this.speed+1*t*this.frontAcceleration,this.maxReverseSpeed,this.maxSpeed)),r.moveRight&&(this.bodyOrientation-=t*this.angularSpeed,this.speed=e.MathUtils.clamp(this.speed+1*t*this.frontAcceleration,this.maxReverseSpeed,this.maxSpeed)),!r.moveForward&&!r.moveBackward)if(this.speed>0){var i=s(this.speed/this.maxSpeed);this.speed=e.MathUtils.clamp(this.speed-i*t*this.frontDecceleration,0,this.maxSpeed)}else{i=s(this.speed/this.maxReverseSpeed);this.speed=e.MathUtils.clamp(this.speed+i*t*this.backAcceleration,this.maxReverseSpeed,0)}var n=this.speed*t;this.root.position.x+=Math.sin(this.bodyOrientation)*n,this.root.position.z+=Math.cos(this.bodyOrientation)*n,this.root.rotation.y=this.bodyOrientation}},exports.MD2Loader=g,exports.MDDLoader=Sd,exports.MMDAnimationHelper=Vs,exports.MMDExporter=class{constructor(){p.default(this,"u2sTable",void 0)}parseVpd(t,r,i){if(!0!==t.isSkinnedMesh)return console.warn("THREE.MMDExporter: parseVpd() requires SkinnedMesh instance."),null;function n(e){Math.abs(e)<1e-6&&(e=0);let t=e.toString();-1===t.indexOf(".")&&(t+="."),t+="000000";const r=t.indexOf(".");return t.slice(0,r)+"."+t.slice(r+1,r+7)}function s(e){const t=[];for(let r=0,i=e.length;r<i;r++)t.push(n(e[r]));return t.join(",")}t.updateMatrixWorld(!0);const o=t.skeleton.bones,a=this.getBindBones(t),l=new e.Vector3,c=new e.Quaternion,h=new e.Quaternion,u=new e.Matrix4,d=[];d.push("Vocaloid Pose Data file"),d.push(""),d.push((""!==t.name?t.name.replace(/\s/g,"_"):"skin")+".osm;"),d.push(o.length+";"),d.push("");for(let e=0,t=o.length;e<t;e++){const t=o[e],r=a[e];!0===i&&void 0!==t.userData.ik&&void 0!==t.userData.ik.originalMatrix?u.fromArray(t.userData.ik.originalMatrix):u.copy(t.matrix),l.setFromMatrixPosition(u),c.setFromRotationMatrix(u);const n=l.sub(r.position).toArray(),p=h.copy(r.quaternion).conjugate().multiply(c).toArray();n[2]=-n[2],p[0]=-p[0],p[1]=-p[1],d.push("Bone"+e+"{"+t.name),d.push(" "+s(n)+";"),d.push(" "+s(p)+";"),d.push("}"),d.push("")}d.push("");const p=d.join("\n");return!0===r?this.unicodeToShiftjis(p):p}unicodeToShiftjis(e){if(void 0===this.u2sTable){const e=(new s.CharsetEncoder).s2uTable;this.u2sTable={};const t=Object.keys(e);for(let r=0,i=t.length;r<i;r++){let i=t[r];const n=e[i];this.u2sTable[n]=parseInt(i)}}const t=[];for(let r=0,i=e.length;r<i;r++){const i=e.charCodeAt(r),n=this.u2sTable[i];if(void 0===n)throw"cannot convert charcode 0x"+i.toString(16);n>255?(t.push(n>>8&255),t.push(255&n)):t.push(255&n)}return new Uint8Array(t)}getBindBones(e){const t=e.clone();return t.pose(),t.skeleton.bones}},exports.MMDLoader=am,exports.MMDPhysics=ks,exports.MTLLoader=Yu,exports.MapControls=class extends Sa{constructor(t,r){super(t,r),this.screenSpacePanning=!1,this.mouseButtons.LEFT=e.MOUSE.PAN,this.mouseButtons.RIGHT=e.MOUSE.ROTATE,this.touches.ONE=e.TOUCH.PAN,this.touches.TWO=e.TOUCH.DOLLY_ROTATE}},exports.MapControlsExp=class extends la{constructor(t,r){super(t,r),p.default(this,"mouseButtons",void 0),p.default(this,"touches",void 0),this.mouseButtons={LEFT:e.MOUSE.PAN,RIGHT:e.MOUSE.ROTATE},this.touches={ONE:e.TOUCH.PAN,TWO:e.TOUCH.DOLLY_ROTATE}}},exports.MarchingCubes=Ys,exports.MaskPass=hl,exports.MatcapUVNode=On,exports.MaterialNode=vn,exports.MaterialReferenceNode=gn,exports.MathNode=Nt,exports.Matrix3NodeUniform=class extends ce{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}},exports.Matrix3Uniform=ce,exports.Matrix4NodeUniform=class extends he{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}},exports.Matrix4Uniform=he,exports.MeshBasicNodeMaterial=es,exports.MeshStandardNodeMaterial=rs,exports.MeshSurfaceSampler=Uo,exports.MeshoptDecoder=()=>{if(Zf)return Zf;const e=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),t=new Uint8Array([32,0,65,253,3,1,2,34,4,106,6,5,11,8,7,20,13,33,12,16,128,9,116,64,19,113,127,15,10,21,22,14,255,66,24,54,136,107,18,23,192,26,114,118,132,17,77,101,130,144,27,87,131,44,45,74,156,154,70,167]);if("object"!=typeof WebAssembly)return{supported:!1};let r,i="B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2BBHmCKrHYAYCE6HYy86BBAKCFJAICIJAYJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCGJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCEJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCIJAYAmJHY2BBAI2BFHmCKrHPAPCE6HPy86BBAKCLJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCKJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCOJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCNJAYAmJHY2BBAI2BGHmCKrHPAPCE6HPy86BBAKCVJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCcJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCMJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCSJAYAmJHm2BBAI2BEHICKrHYAYCE6HYy86BBAKCQJAmAYJHm2BBAICIrCEZHYAYCE6HYy86BBAKCfJAmAYJHm2BBAICGrCEZHYAYCE6HYy86BBAKCbJAmAYJHK2BBAICEZHIAICE6HIy86BBAKAIJRISGMAKAI2BNAI2BBHmCIrHYAYCb6HYy86BBAKCFJAICNJAYJHY2BBAmCbZHmAmCb6Hmy86BBAKCGJAYAmJHm2BBAI2BFHYCIrHPAPCb6HPy86BBAKCEJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCIJAmAYJHm2BBAI2BGHYCIrHPAPCb6HPy86BBAKCLJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCKJAmAYJHm2BBAI2BEHYCIrHPAPCb6HPy86BBAKCOJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCNJAmAYJHm2BBAI2BIHYCIrHPAPCb6HPy86BBAKCVJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCcJAmAYJHm2BBAI2BLHYCIrHPAPCb6HPy86BBAKCMJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCSJAmAYJHm2BBAI2BKHYCIrHPAPCb6HPy86BBAKCQJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCfJAmAYJHm2BBAI2BOHICIrHYAYCb6HYy86BBAKCbJAmAYJHK2BBAICbZHIAICb6HIy86BBAKAIJRISFMAKAI8pBB83BBAKCNJAICNJ8pBB83BBAICTJRIMAtCGJRtAECTJHEAS9JQBMMGXAIQBCBRISEMGXAM9FQBANAbJ2BBRtCBRKAfREEXAEANCU/CBJAKJ2BBHTCFrCBATCFZl9zAtJHt86BBAEAGJREAKCFJHKAM9HQBMMAfCFJRfAIRTAbCFJHbAG9HQBMMABAcAG9sJANCUGJAMAG9sTkUUUBpANANCUGJAMCaJAG9sJAGTkUUUBpMAMCBAIyAcJRcAIQBMC9+RKSFMCBC99AOAIlAGCAAGCA9Ly6yRKMALCU/EBJ8kUUUUBAKM+OmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUFT+JUUUBpALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM+lLKFaF99GaG99FaG99GXGXAGCI9HQBAF9FQFEXGXGX9DBBB8/9DBBB+/ABCGJHG1BB+yAB1BBHE+yHI+L+TABCFJHL1BBHK+yHO+L+THN9DBBBB9gHVyAN9DBB/+hANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE86BBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG86BBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG86BBABCIJRBAFCaJHFQBSGMMAF9FQBEXGXGX9DBBB8/9DBBB+/ABCIJHG8uFB+yAB8uFBHE+yHI+L+TABCGJHL8uFBHK+yHO+L+THN9DBBBB9gHVyAN9DB/+g6ANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE87FBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG87FBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG87FBABCNJRBAFCaJHFQBMMM/SEIEaE99EaF99GXAF9FQBCBREABRIEXGXGX9D/zI818/AICKJ8uFBHLCEq+y+VHKAI8uFB+y+UHO9DB/+g6+U9DBBB8/9DBBB+/AO9DBBBB9gy+SHN+L9DBBB9P9d9FQBAN+oRVSFMCUUUU94RVMAICIJ8uFBRcAICGJ8uFBRMABALCFJCEZAEqCFWJAV87FBGXGXAKAM+y+UHN9DB/+g6+U9DBBB8/9DBBB+/AN9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRMSFMCUUUU94RMMABALCGJCEZAEqCFWJAM87FBGXGXAKAc+y+UHK9DB/+g6+U9DBBB8/9DBBB+/AK9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRcSFMCUUUU94RcMABALCaJCEZAEqCFWJAc87FBGXGX9DBBU8/AOAO+U+TANAN+U+TAKAK+U+THO9DBBBBAO9DBBBB9gy+R9DB/+g6+U9DBBB8/+SHO+L9DBBB9P9d9FQBAO+oRcSFMCUUUU94RcMABALCEZAEqCFWJAc87FBAICNJRIAECIJREAFCaJHFQBMMM9JBGXAGCGrAF9sHF9FQBEXABAB8oGBHGCNWCN91+yAGCi91CnWCUUU/8EJ+++U84GBABCIJRBAFCaJHFQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEM/lFFFaGXGXAFABqCEZ9FQBABRESFMGXGXAGCT9PQBABRESFMABREEXAEAF8oGBjGBAECIJAFCIJ8oGBjGBAECNJAFCNJ8oGBjGBAECSJAFCSJ8oGBjGBAECTJREAFCTJRFAGC9wJHGCb9LQBMMAGCI9JQBEXAEAF8oGBjGBAFCIJRFAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF2BB86BBAECFJREAFCFJRFAGCaJHGQBMMABMoFFGaGXGXABCEZ9FQBABRESFMAFCgFZC+BwsN9sRIGXGXAGCT9PQBABRESFMABREEXAEAIjGBAECSJAIjGBAECNJAIjGBAECIJAIjGBAECTJREAGC9wJHGCb9LQBMMAGCI9JQBEXAEAIjGBAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF86BBAECFJREAGCaJHGQBMMABMMMFBCUNMIT9kBB";WebAssembly.validate(e)&&(i="B9h9z9tFBBBFiI9gBB9gLaaaaaFa9gEaaaB9gFaFaEMcBBFBFFGGGEILF9wFFFLEFBFKNFaFCx/aFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBG8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBIy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBKi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBOn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBNI9z9iqlBVc+N9IcIBTEM9+FLa8jUUUUBCTlRBCBRFEXCBRGCBREEXABCNJAGJAECUaAFAGrCFZHIy86BBAEAIJREAGCFJHGCN9HQBMAFCx+YUUBJAE86BBAFCEWCxkUUBJAB8pEN83EBAFCFJHFCUG9HQBMMk8lLbaE97F9+FaL978jUUUUBCU/KBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAG/8cBBCUoBAG9uC/wgBZHKCUGAKCUG9JyRNAECFJRKCBRVGXEXAVAF9PQFANAFAVlAVANJAF9JyRcGXGXAG9FQBAcCbJHIC9wZHMCE9sRSAMCFWRQAICIrCEJCGrRfCBRbEXAKRTCBRtGXEXGXAOATlAf9PQBCBRKSLMALCU/CBJAtAM9sJRmATAfJRKCBREGXAMCoB9JQBAOAKlC/gB9JQBCBRIEXAmAIJREGXGXGXGXGXATAICKrJ2BBHYCEZfIBFGEBMAECBDtDMIBSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMIBAKCTJRKMGXGXGXGXGXAYCGrCEZfIBFGEBMAECBDtDMITSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMITAKCTJRKMGXGXGXGXGXAYCIrCEZfIBFGEBMAECBDtDMIASEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMIAAKCTJRKMGXGXGXGXGXAYCKrfIBFGEBMAECBDtDMI8wSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCIJAeDeBJAYCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCNJAeDeBJAYCx+YUUBJ2BBJRKSFMAEAKDBBBDMI8wAKCTJRKMAICoBJREAICUFJAM9LQFAERIAOAKlC/fB9LQBMMGXAEAM9PQBAECErRIEXGXAOAKlCi9PQBCBRKSOMAmAEJRYGXGXGXGXGXATAECKrJ2BBAICKZrCEZfIBFGEBMAYCBDtDMIBSEMAYAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAYAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAYAKDBBBDMIBAKCTJRKMAICGJRIAECTJHEAM9JQBMMGXAK9FQBAKRTAtCFJHtCI6QGSFMMCBRKSEMGXAM9FQBALCUGJAbJREALAbJDBGBReCBRYEXAEALCU/CBJAYJHIDBIBHdCFD9tAdCFDbHPD9OD9hD9RHdAIAMJDBIBH8ZCFD9tA8ZAPD9OD9hD9RH8ZDQBTFtGmEYIPLdKeOnHpAIAQJDBIBHyCFD9tAyAPD9OD9hD9RHyAIASJDBIBH8cCFD9tA8cAPD9OD9hD9RH8cDQBTFtGmEYIPLdKeOnH8dDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGEAeD9uHeDyBjGBAEAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeApA8dDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeAdA8ZDQNiV8ZcpMyS8cQ8df8eb8fHdAyA8cDQNiV8ZcpMyS8cQ8df8eb8fH8ZDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeAdA8ZDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJREAYCTJHYAM9JQBMMAbCIJHbAG9JQBMMABAVAG9sJALCUGJAcAG9s/8cBBALALCUGJAcCaJAG9sJAG/8cBBMAcCBAKyAVJRVAKQBMC9+RKSFMCBC99AOAKlAGCAAGCA9Ly6yRKMALCU/KBJ8kUUUUBAKMNBT+BUUUBM+KmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUF/8MBALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM/dLEK97FaF97GXGXAGCI9HQBAF9FQFCBRGEXABABDBBBHECiD+rFCiD+sFD/6FHIAECND+rFCiD+sFD/6FAID/gFAECTD+rFCiD+sFD/6FHLD/gFD/kFD/lFHKCBDtD+2FHOAICUUUU94DtHND9OD9RD/kFHI9DBB/+hDYAIAID/mFAKAKD/mFALAOALAND9OD9RD/kFHIAID/mFD/kFD/kFD/jFD/nFHLD/mF9DBBX9LDYHOD/kFCgFDtD9OAECUUU94DtD9OD9QAIALD/mFAOD/kFCND+rFCU/+EDtD9OD9QAKALD/mFAOD/kFCTD+rFCUU/8ODtD9OD9QDMBBABCTJRBAGCIJHGAF9JQBSGMMAF9FQBCBRGEXABCTJHVAVDBBBHECBDtHOCUU98D8cFCUU98D8cEHND9OABDBBBHKAEDQILKOSQfbPden8c8d8e8fCggFDtD9OD/6FAKAEDQBFGENVcMTtmYi8ZpyHECTD+sFD/6FHID/gFAECTD+rFCTD+sFD/6FHLD/gFD/kFD/lFHE9DB/+g6DYALAEAOD+2FHOALCUUUU94DtHcD9OD9RD/kFHLALD/mFAEAED/mFAIAOAIAcD9OD9RD/kFHEAED/mFD/kFD/kFD/jFD/nFHID/mF9DBBX9LDYHOD/kFCTD+rFALAID/mFAOD/kFCggEDtD9OD9QHLAEAID/mFAOD/kFCaDbCBDnGCBDnECBDnKCBDnOCBDncCBDnMCBDnfCBDnbD9OHEDQNVi8ZcMpySQ8c8dfb8e8fD9QDMBBABAKAND9OALAEDQBFTtGEmYILPdKOenD9QDMBBABCAJRBAGCIJHGAF9JQBMMM/hEIGaF97FaL978jUUUUBCTlREGXAF9FQBCBRIEXAEABDBBBHLABCTJHKDBBBHODQILKOSQfbPden8c8d8e8fHNCTD+sFHVCID+rFDMIBAB9DBBU8/DY9D/zI818/DYAVCEDtD9QD/6FD/nFHVALAODQBFGENVcMTtmYi8ZpyHLCTD+rFCTD+sFD/6FD/mFHOAOD/mFAVALCTD+sFD/6FD/mFHcAcD/mFAVANCTD+rFCTD+sFD/6FD/mFHNAND/mFD/kFD/kFD/lFCBDtD+4FD/jF9DB/+g6DYHVD/mF9DBBX9LDYHLD/kFCggEDtHMD9OAcAVD/mFALD/kFCTD+rFD9QHcANAVD/mFALD/kFCTD+rFAOAVD/mFALD/kFAMD9OD9QHVDQBFTtGEmYILPdKOenHLD8dBAEDBIBDyB+t+J83EBABCNJALD8dFAEDBIBDyF+t+J83EBAKAcAVDQNVi8ZcMpySQ8c8dfb8e8fHVD8dBAEDBIBDyG+t+J83EBABCiJAVD8dFAEDBIBDyE+t+J83EBABCAJRBAICIJHIAF9JQBMMM9jFF97GXAGCGrAF9sHG9FQBCBRFEXABABDBBBHECND+rFCND+sFD/6FAECiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMBBABCTJRBAFCIJHFAG9JQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB");const n=WebAssembly.instantiate(function(e){const r=new Uint8Array(e.length);for(let t=0;t<e.length;++t){const i=e.charCodeAt(t);r[t]=i>96?i-71:i>64?i-65:i>47?i+4:i>46?63:62}let i=0;for(let n=0;n<e.length;++n)r[i++]=r[n]<60?t[r[n]]:64*(r[n]-60)+r[++n];return r.buffer.slice(0,i)}(i),{}).then((e=>{r=e.instance,r.exports.__wasm_call_ctors()}));function s(e,t,i,n,s,o){const a=r.exports.sbrk,l=i+3&-4,c=a(l*n),h=a(s.length),u=new Uint8Array(r.exports.memory.buffer);u.set(s,h);const d=e(c,i,n,h,s.length);if(0===d&&o&&o(c,l,n),t.set(u.subarray(c,c+i*n)),a(c-a(0)),0!==d)throw new Error(`Malformed buffer data: ${d}`)}const o={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},a={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return Zf={ready:n,supported:!0,decodeVertexBuffer(e,t,i,n,a){s(r.exports.meshopt_decodeVertexBuffer,e,t,i,n,r.exports[o[a]])},decodeIndexBuffer(e,t,i,n){s(r.exports.meshopt_decodeIndexBuffer,e,t,i,n)},decodeIndexSequence(e,t,i,n){s(r.exports.meshopt_decodeIndexSequence,e,t,i,n)},decodeGltfBuffer(e,t,i,n,l,c){s(r.exports[a[l]],e,t,i,n,r.exports[o[c]])}},Zf},exports.MirrorShader=Fh,exports.ModelNode=Pt,exports.ModelViewProjectionNode=xn,exports.MorphAnimMesh=U,exports.MorphBlendMesh=v,exports.MotionController=Pc,exports.MotionControllerConstants=Mc,exports.NRRDLoader=Wu,exports.NURBSCurve=gu,exports.NURBSSurface=class{constructor(t,r,i,n,s){this.degree1=t,this.degree2=r,this.knots1=i,this.knots2=n,this.controlPoints=[];const o=i.length-t-1,a=n.length-r-1;for(let t=0;t<o;++t){this.controlPoints[t]=[];for(let r=0;r<a;++r){const i=s[t][r];this.controlPoints[t][r]=new e.Vector4(i.x,i.y,i.z,i.w)}}}getPoint(e,t,r){const i=this.knots1[0]+e*(this.knots1[this.knots1.length-1]-this.knots1[0]),n=this.knots2[0]+t*(this.knots2[this.knots2.length-1]-this.knots2[0]);fu(this.degree1,this.degree2,this.knots1,this.knots2,this.controlPoints,i,n,r)}},exports.Node=Je,exports.NodeAttribute=ut,exports.NodeBuilder=bt,exports.NodeCode=ft,exports.NodeFrame=At,exports.NodeFunctionInput=wt,exports.NodeKeywords=gt,exports.NodeLoader=Qn,exports.NodeMaterialLoader=Yn,exports.NodeMaterialLoaderUtils=class{static replaceUUIDObject(e,t,r,i){if(i=void 0===i||i,"object"==typeof t&&(t=t.uuid),"object"==typeof e){const n=Object.keys(e);for(let s=0;s<n.length;s++){const o=n[s];i&&(e[o]=this.replaceUUIDObject(e[o],t,r)),o===t&&(e[t]=e[o],delete e[o])}}return e===t?r:e}static replaceUUID(e,t,r){return this.replaceUUIDObject(e,t,r,!1),this.replaceUUIDObject(e.nodes,t,r),this.replaceUUIDObject(e.materials,t,r),this.replaceUUIDObject(e.passes,t,r),this.replaceUUIDObject(e.library,t,r,!1),e}},exports.NodeObjectLoader=Kn,exports.NodeShaderStage={Vertex:"vertex",Fragment:"fragment"},exports.NodeType={Float:"float",Vector2:"vec2",Vector3:"vec3",Vector4:"vec4",Matrix3:"mat3",Matrix4:"mat4"},exports.NodeUniform=dt,exports.NodeUpdateType={None:"none",Frame:"frame",Object:"object"},exports.NodeVar=mt,exports.NodeVary=pt,exports.NormalMapNode=Sn,exports.NormalMapShader=Eh,exports.NormalNode=It,exports.OBB=ea,exports.OBJExporter=class{constructor(){p.default(this,"output",void 0),p.default(this,"indexVertex",void 0),p.default(this,"indexVertexUvs",void 0),p.default(this,"indexNormals",void 0),p.default(this,"vertex",void 0),p.default(this,"color",void 0),p.default(this,"normal",void 0),p.default(this,"uv",void 0),p.default(this,"face",void 0),this.output="",this.indexVertex=0,this.indexVertexUvs=0,this.indexNormals=0,this.vertex=new e.Vector3,this.color=new e.Color,this.normal=new e.Vector3,this.uv=new e.Vector2,this.face=[]}parse(t){return t.traverse((t=>{t instanceof e.Mesh&&t.isMesh&&this.parseMesh(t),t instanceof e.Line&&t.isLine&&this.parseLine(t),t instanceof e.Points&&t.isPoints&&this.parsePoints(t)})),this.output}parseMesh(t){let r=0,i=0,n=0;const s=t.geometry,o=new e.Matrix3;if(!s.isBufferGeometry)throw new Error("THREE.OBJExporter: Geometry is not of type THREE.BufferGeometry.");const a=s.getAttribute("position"),l=s.getAttribute("normal"),c=s.getAttribute("uv"),h=s.getIndex();if(this.output+=`o ${t.name}\n`,t.material&&!Array.isArray(t.material)&&t.material.name&&(this.output+=`usemtl ${t.material.name}\n`),void 0!==a)for(let e=0,i=a.count;e<i;e++,r++)this.vertex.x=a.getX(e),this.vertex.y=a.getY(e),this.vertex.z=a.getZ(e),this.vertex.applyMatrix4(t.matrixWorld),this.output+=`v ${this.vertex.x} ${this.vertex.y} ${this.vertex.z}\n`;if(void 0!==c)for(let e=0,t=c.count;e<t;e++,n++)this.uv.x=c.getX(e),this.uv.y=c.getY(e),this.output+=`vt ${this.uv.x} ${this.uv.y}\n`;if(void 0!==l){o.getNormalMatrix(t.matrixWorld);for(let e=0,t=l.count;e<t;e++,i++)this.normal.x=l.getX(e),this.normal.y=l.getY(e),this.normal.z=l.getZ(e),this.normal.applyMatrix3(o).normalize(),this.output+=`vn ${this.normal.x} ${this.normal.y} ${this.normal.z}\n`}if(null!==h)for(let e=0,t=h.count;e<t;e+=3){for(let t=0;t<3;t++){const r=h.getX(e+t)+1;this.face[t]=this.indexVertex+r+(l||c?`/${c?this.indexVertexUvs+r:""}${l?`/${this.indexNormals+r}`:""}`:"")}this.output+=`f ${this.face.join(" ")}\n`}else for(let e=0,t=a.count;e<t;e+=3){for(let t=0;t<3;t++){const r=e+t+1;this.face[t]=this.indexVertex+r+(l||c?`/${c?this.indexVertexUvs+r:""}${l?`/${this.indexNormals+r}`:""}`:"")}this.output+=`f ${this.face.join(" ")}\n`}this.indexVertex+=r,this.indexVertexUvs+=n,this.indexNormals+=i}parseLine(e){let t=0;const r=e.geometry,i=e.type;if(r.isBufferGeometry)throw new Error("THREE.OBJExporter: Geometry is not of type THREE.BufferGeometry.");const n=r.getAttribute("position");if(this.output+=`o ${e.name}\n`,void 0!==n)for(let r=0,i=n.count;r<i;r++,t++)this.vertex.x=n.getX(r),this.vertex.y=n.getY(r),this.vertex.z=n.getZ(r),this.vertex.applyMatrix4(e.matrixWorld),this.output+=`v ${this.vertex.x} ${this.vertex.y} ${this.vertex.z}\n`;if("Line"===i){this.output+="l ";for(let e=1,t=n.count;e<=t;e++)this.output+=`${this.indexVertex+e} `;this.output+="\n"}if("LineSegments"===i)for(let e=1,t=e+1,r=n.count;e<r;e+=2,t=e+1)this.output+=`l ${this.indexVertex+e} ${this.indexVertex+t}\n`;this.indexVertex+=t}parsePoints(t){let r=0;const i=t.geometry;if(!i.isBufferGeometry)throw new Error("THREE.OBJExporter: Geometry is not of type THREE.BufferGeometry.");const n=i.getAttribute("position"),s=i.getAttribute("color");if(this.output+=`o ${t.name}\n`,void 0!==n)for(let i=0,o=n.count;i<o;i++,r++)this.vertex.fromBufferAttribute(n,i),this.vertex.applyMatrix4(t.matrixWorld),this.output+=`v ${this.vertex.x} ${this.vertex.y} ${this.vertex.z}`,void 0!==s&&s instanceof e.BufferAttribute&&(this.color.fromBufferAttribute(s,i),this.output+=` ${this.color.r} ${this.color.g} ${this.color.b}`),this.output+="\n";this.output+="p ";for(let e=1,t=n.count;e<=t;e++)this.output+=`${this.indexVertex+e} `;this.output+="\n",this.indexVertex+=r}},exports.OBJLoader=sm,exports.Object3DNode=Ct,exports.Octree=sa,exports.OculusHandModel=xc,exports.OculusHandPointerModel=Ac,exports.OneMinusBlendColorFactor=212,exports.OperatorNode=Rt,exports.OrbitControls=Sa,exports.OrbitControlsExp=class extends la{constructor(t,r){super(t,r),p.default(this,"mouseButtons",void 0),p.default(this,"touches",void 0),this.mouseButtons={LEFT:e.MOUSE.ROTATE,RIGHT:e.MOUSE.PAN},this.touches={ONE:e.TOUCH.ROTATE,TWO:e.TOUCH.DOLLY_PAN}}},exports.OscNode=Vn,exports.OutlineEffect=function(t,r){r=r||{},this.enabled=!0;const i=void 0!==r.defaultThickness?r.defaultThickness:.003,n=(new e.Color).fromArray(void 0!==r.defaultColor?r.defaultColor:[0,0,0]),s=void 0!==r.defaultAlpha?r.defaultAlpha:1,o=void 0!==r.defaultKeepAlive&&r.defaultKeepAlive,a={},l={},c={},h={outlineThickness:{value:i},outlineColor:{value:n},outlineAlpha:{value:s}},u=["#include <common>","#include <uv_pars_vertex>","#include <displacementmap_pars_vertex>","#include <fog_pars_vertex>","#include <morphtarget_pars_vertex>","#include <skinning_pars_vertex>","#include <logdepthbuf_pars_vertex>","#include <clipping_planes_pars_vertex>","uniform float outlineThickness;","vec4 calculateOutline( vec4 pos, vec3 normal, vec4 skinned ) {","\tfloat thickness = outlineThickness;","\tconst float ratio = 1.0;","\tvec4 pos2 = projectionMatrix * modelViewMatrix * vec4( skinned.xyz + normal, 1.0 );","\tvec4 norm = normalize( pos - pos2 );","\treturn pos + norm * thickness * pos.w * ratio;","}","void main() {","\t#include <uv_vertex>","\t#include <beginnormal_vertex>","\t#include <morphnormal_vertex>","\t#include <skinbase_vertex>","\t#include <skinnormal_vertex>","\t#include <begin_vertex>","\t#include <morphtarget_vertex>","\t#include <skinning_vertex>","\t#include <displacementmap_vertex>","\t#include <project_vertex>","\tvec3 outlineNormal = - objectNormal;","\tgl_Position = calculateOutline( gl_Position, outlineNormal, vec4( transformed, 1.0 ) );","\t#include <logdepthbuf_vertex>","\t#include <clipping_planes_vertex>","\t#include <fog_vertex>","}"].join("\n"),d=["#include <common>","#include <fog_pars_fragment>","#include <logdepthbuf_pars_fragment>","#include <clipping_planes_pars_fragment>","uniform vec3 outlineColor;","uniform float outlineAlpha;","void main() {","\t#include <clipping_planes_fragment>","\t#include <logdepthbuf_fragment>","\tgl_FragColor = vec4( outlineColor, outlineAlpha );","\t#include <tonemapping_fragment>","\t#include <encodings_fragment>","\t#include <fog_fragment>","\t#include <premultiplied_alpha_fragment>","}"].join("\n");function p(t){const r=function(t){let r=a[t.uuid];return void 0===r&&(r={material:new e.ShaderMaterial({type:"OutlineEffect",uniforms:e.UniformsUtils.merge([e.UniformsLib.fog,e.UniformsLib.displacementmap,h]),vertexShader:u,fragmentShader:d,side:e.BackSide}),used:!0,keepAlive:o,count:0},a[t.uuid]=r),r.used=!0,r.material}(t);return l[r.uuid]=t,function(e,t){if("invisible"===e.name)return;const r=t.userData.outlineParameters;e.skinning=t.skinning,e.morphTargets=t.morphTargets,e.morphNormals=t.morphNormals,e.fog=t.fog,e.toneMapped=t.toneMapped,e.premultipliedAlpha=t.premultipliedAlpha,e.displacementMap=t.displacementMap,void 0!==r?(!1===t.visible?e.visible=!1:e.visible=void 0===r.visible||r.visible,e.transparent=void 0!==r.alpha&&r.alpha<1||t.transparent,void 0!==r.keepAlive&&(a[t.uuid].keepAlive=r.keepAlive)):(e.transparent=t.transparent,e.visible=t.visible);!0!==t.wireframe&&!1!==t.depthTest||(e.visible=!1);t.clippingPlanes&&(e.clipping=!0,e.clippingPlanes=t.clippingPlanes,e.clipIntersection=t.clipIntersection,e.clipShadows=t.clipShadows);e.version=t.version}(r,t),r}function m(e){const t=e.geometry;let r=!1;return void 0!==e.geometry&&(r=!t.isBufferGeometry||void 0!==t.attributes.normal),!0===e.isMesh&&void 0!==e.material&&!0===r}function f(e){if(!1!==m(e)){if(Array.isArray(e.material))for(let t=0,r=e.material.length;t<r;t++)e.material[t]=p(e.material[t]);else e.material=p(e.material);c[e.uuid]=e.onBeforeRender,e.onBeforeRender=v}}function g(e){if(!1!==m(e)){if(Array.isArray(e.material))for(let t=0,r=e.material.length;t<r;t++)e.material[t]=l[e.material[t].uuid];else e.material=l[e.material.uuid];e.onBeforeRender=c[e.uuid]}}function v(e,t,r,i,n){const s=l[n.uuid];void 0!==s&&function(e,t){const r=t.userData.outlineParameters;e.uniforms.outlineAlpha.value=t.opacity,void 0!==r&&(void 0!==r.thickness&&(e.uniforms.outlineThickness.value=r.thickness),void 0!==r.color&&e.uniforms.outlineColor.value.fromArray(r.color),void 0!==r.alpha&&(e.uniforms.outlineAlpha.value=r.alpha));t.displacementMap&&(e.uniforms.displacementMap.value=t.displacementMap,e.uniforms.displacementScale.value=t.displacementScale,e.uniforms.displacementBias.value=t.displacementBias)}(n,s)}this.render=function(e,r){let i,n=!1;if(void 0!==arguments[2]&&(console.warn("THREE.OutlineEffect.render(): the renderTarget argument has been removed. Use .setRenderTarget() instead."),i=arguments[2]),void 0!==arguments[3]&&(console.warn("THREE.OutlineEffect.render(): the forceClear argument has been removed. Use .clear() instead."),n=arguments[3]),void 0!==i&&t.setRenderTarget(i),n&&t.clear(),!1===this.enabled)return void t.render(e,r);const s=t.autoClear;t.autoClear=this.autoClear,t.render(e,r),t.autoClear=s,this.renderOutline(e,r)},this.renderOutline=(e,r)=>{const i=t.autoClear,n=e.autoUpdate,s=e.background,o=t.shadowMap.enabled;e.autoUpdate=!1,e.background=null,t.autoClear=!1,t.shadowMap.enabled=!1,e.traverse(f),t.render(e,r),e.traverse(g),function(){let e;e=Object.keys(l);for(let t=0,r=e.length;t<r;t++)l[e[t]]=void 0;e=Object.keys(c);for(let t=0,r=e.length;t<r;t++)c[e[t]]=void 0;e=Object.keys(a);for(let t=0,r=e.length;t<r;t++){const r=e[t];!1===a[r].used?(a[r].count++,!1===a[r].keepAlive&&a[r].count>60&&delete a[r]):(a[r].used=!1,a[r].count=0)}}(),e.autoUpdate=n,e.background=s,t.autoClear=i,t.shadowMap.enabled=o},this.autoClear=t.autoClear,this.domElement=t.domElement,this.shadowMap=t.shadowMap,this.clear=(e,r,i)=>{t.clear(e,r,i)},this.getPixelRatio=()=>t.getPixelRatio(),this.setPixelRatio=e=>{t.setPixelRatio(e)},this.getSize=e=>t.getSize(e),this.setSize=(e,r,i)=>{t.setSize(e,r,i)},this.setViewport=(e,r,i,n)=>{t.setViewport(e,r,i,n)},this.setScissor=(e,r,i,n)=>{t.setScissor(e,r,i,n)},this.setScissorTest=e=>{t.setScissorTest(e)},this.setRenderTarget=e=>{t.setRenderTarget(e)}},exports.OutlinePass=class extends Ia{constructor(t,r,i,n){super(),p.default(this,"renderScene",void 0),p.default(this,"renderCamera",void 0),p.default(this,"selectedObjects",void 0),p.default(this,"visibleEdgeColor",void 0),p.default(this,"hiddenEdgeColor",void 0),p.default(this,"edgeGlow",void 0),p.default(this,"usePatternTexture",void 0),p.default(this,"edgeThickness",void 0),p.default(this,"edgeStrength",void 0),p.default(this,"downSampleRatio",void 0),p.default(this,"pulsePeriod",void 0),p.default(this,"resolution",void 0),p.default(this,"renderTargetMaskBuffer",void 0),p.default(this,"depthMaterial",void 0),p.default(this,"prepareMaskMaterial",void 0),p.default(this,"renderTargetDepthBuffer",void 0),p.default(this,"renderTargetMaskDownSampleBuffer",void 0),p.default(this,"renderTargetBlurBuffer1",void 0),p.default(this,"renderTargetBlurBuffer2",void 0),p.default(this,"edgeDetectionMaterial",void 0),p.default(this,"renderTargetEdgeBuffer1",void 0),p.default(this,"renderTargetEdgeBuffer2",void 0),p.default(this,"separableBlurMaterial1",void 0),p.default(this,"separableBlurMaterial2",void 0),p.default(this,"overlayMaterial",void 0),p.default(this,"materialCopy",void 0),p.default(this,"oldClearAlpha",void 0),p.default(this,"fsQuad",void 0),p.default(this,"tempPulseColor1",void 0),p.default(this,"tempPulseColor2",void 0),p.default(this,"textureMatrix",void 0),p.default(this,"patternTexture",void 0),p.default(this,"_visibilityCache",void 0),p.default(this,"_oldClearColor",void 0),p.default(this,"copyUniforms",void 0),p.default(this,"BlurDirectionX",new e.Vector2(1,0)),p.default(this,"BlurDirectionY",new e.Vector2(0,1)),this.renderScene=r,this.renderCamera=i,this.selectedObjects=void 0!==n?n:[],this.visibleEdgeColor=new e.Color(1,1,1),this.hiddenEdgeColor=new e.Color(.1,.04,.02),this.edgeGlow=0,this.usePatternTexture=!1,this.edgeThickness=1,this.edgeStrength=3,this.downSampleRatio=2,this.pulsePeriod=0,this._visibilityCache=new Map,this.resolution=void 0!==t?new e.Vector2(t.x,t.y):new e.Vector2(256,256);const s=Math.round(this.resolution.x/this.downSampleRatio),o=Math.round(this.resolution.y/this.downSampleRatio);this.renderTargetMaskBuffer=new e.WebGLRenderTarget(this.resolution.x,this.resolution.y),this.renderTargetMaskBuffer.texture.name="OutlinePass.mask",this.renderTargetMaskBuffer.texture.generateMipmaps=!1,this.depthMaterial=new e.MeshDepthMaterial,this.depthMaterial.side=e.DoubleSide,this.depthMaterial.depthPacking=e.RGBADepthPacking,this.depthMaterial.blending=e.NoBlending,this.prepareMaskMaterial=this.getPrepareMaskMaterial(),this.prepareMaskMaterial.side=e.DoubleSide,this.prepareMaskMaterial.fragmentShader=function(e,t){const r=t.isPerspectiveCamera?"perspective":"orthographic";return e.replace(/DEPTH_TO_VIEW_Z/g,r+"DepthToViewZ")}(this.prepareMaskMaterial.fragmentShader,this.renderCamera),this.renderTargetDepthBuffer=new e.WebGLRenderTarget(this.resolution.x,this.resolution.y),this.renderTargetDepthBuffer.texture.name="OutlinePass.depth",this.renderTargetDepthBuffer.texture.generateMipmaps=!1,this.renderTargetMaskDownSampleBuffer=new e.WebGLRenderTarget(s,o),this.renderTargetMaskDownSampleBuffer.texture.name="OutlinePass.depthDownSample",this.renderTargetMaskDownSampleBuffer.texture.generateMipmaps=!1,this.renderTargetBlurBuffer1=new e.WebGLRenderTarget(s,o),this.renderTargetBlurBuffer1.texture.name="OutlinePass.blur1",this.renderTargetBlurBuffer1.texture.generateMipmaps=!1,this.renderTargetBlurBuffer2=new e.WebGLRenderTarget(Math.round(s/2),Math.round(o/2)),this.renderTargetBlurBuffer2.texture.name="OutlinePass.blur2",this.renderTargetBlurBuffer2.texture.generateMipmaps=!1,this.edgeDetectionMaterial=this.getEdgeDetectionMaterial(),this.renderTargetEdgeBuffer1=new e.WebGLRenderTarget(s,o),this.renderTargetEdgeBuffer1.texture.name="OutlinePass.edge1",this.renderTargetEdgeBuffer1.texture.generateMipmaps=!1,this.renderTargetEdgeBuffer2=new e.WebGLRenderTarget(Math.round(s/2),Math.round(o/2)),this.renderTargetEdgeBuffer2.texture.name="OutlinePass.edge2",this.renderTargetEdgeBuffer2.texture.generateMipmaps=!1;this.separableBlurMaterial1=this.getSeperableBlurMaterial(4),this.separableBlurMaterial1.uniforms.texSize.value.set(s,o),this.separableBlurMaterial1.uniforms.kernelRadius.value=1,this.separableBlurMaterial2=this.getSeperableBlurMaterial(4),this.separableBlurMaterial2.uniforms.texSize.value.set(Math.round(s/2),Math.round(o/2)),this.separableBlurMaterial2.uniforms.kernelRadius.value=4,this.overlayMaterial=this.getOverlayMaterial(),void 0===Xa&&console.error("THREE.OutlinePass relies on CopyShader");const a=Xa;this.copyUniforms=e.UniformsUtils.clone(a.uniforms),this.copyUniforms.opacity.value=1,this.materialCopy=new e.ShaderMaterial({uniforms:this.copyUniforms,vertexShader:a.vertexShader,fragmentShader:a.fragmentShader,blending:e.NoBlending,depthTest:!1,depthWrite:!1,transparent:!0}),this.enabled=!0,this.needsSwap=!1,this._oldClearColor=new e.Color,this.oldClearAlpha=1,this.fsQuad=new Ua(this.materialCopy),this.tempPulseColor1=new e.Color,this.tempPulseColor2=new e.Color,this.textureMatrix=new e.Matrix4}dispose(){this.renderTargetMaskBuffer.dispose(),this.renderTargetDepthBuffer.dispose(),this.renderTargetMaskDownSampleBuffer.dispose(),this.renderTargetBlurBuffer1.dispose(),this.renderTargetBlurBuffer2.dispose(),this.renderTargetEdgeBuffer1.dispose(),this.renderTargetEdgeBuffer2.dispose()}setSize(e,t){this.renderTargetMaskBuffer.setSize(e,t),this.renderTargetDepthBuffer.setSize(e,t);let r=Math.round(e/this.downSampleRatio),i=Math.round(t/this.downSampleRatio);this.renderTargetMaskDownSampleBuffer.setSize(r,i),this.renderTargetBlurBuffer1.setSize(r,i),this.renderTargetEdgeBuffer1.setSize(r,i),this.separableBlurMaterial1.uniforms.texSize.value.set(r,i),r=Math.round(r/2),i=Math.round(i/2),this.renderTargetBlurBuffer2.setSize(r,i),this.renderTargetEdgeBuffer2.setSize(r,i),this.separableBlurMaterial2.uniforms.texSize.value.set(r,i)}changeVisibilityOfSelectedObjects(e){const t=this._visibilityCache;function r(r){r.isMesh&&(!0===e?r.visible=t.get(r):(t.set(r,r.visible),r.visible=e))}for(let e=0;e<this.selectedObjects.length;e++){this.selectedObjects[e].traverse(r)}}changeVisibilityOfNonSelectedObjects(e){const t=this._visibilityCache,r=[];function i(e){e.isMesh&&r.push(e)}for(let e=0;e<this.selectedObjects.length;e++){this.selectedObjects[e].traverse(i)}this.renderScene.traverse((function(i){if(i.isMesh||i.isSprite){let n=!1;for(let e=0;e<r.length;e++){if(r[e].id===i.id){n=!0;break}}if(!1===n){const r=i.visible;!1!==e&&!0!==t.get(i)||(i.visible=e),t.set(i,r)}}else(i.isPoints||i.isLine)&&(!0===e?i.visible=t.get(i):(t.set(i,i.visible),i.visible=e))}))}updateTextureMatrix(){this.textureMatrix.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),this.textureMatrix.multiply(this.renderCamera.projectionMatrix),this.textureMatrix.multiply(this.renderCamera.matrixWorldInverse)}render(e,t,r,i,n){if(this.selectedObjects.length>0){e.getClearColor(this._oldClearColor),this.oldClearAlpha=e.getClearAlpha();const t=e.autoClear;e.autoClear=!1,n&&e.state.buffers.stencil.setTest(!1),e.setClearColor(16777215,1),this.changeVisibilityOfSelectedObjects(!1);const i=this.renderScene.background;if(this.renderScene.background=null,this.renderScene.overrideMaterial=this.depthMaterial,e.setRenderTarget(this.renderTargetDepthBuffer),e.clear(),e.render(this.renderScene,this.renderCamera),this.changeVisibilityOfSelectedObjects(!0),this._visibilityCache.clear(),this.updateTextureMatrix(),this.changeVisibilityOfNonSelectedObjects(!1),this.renderScene.overrideMaterial=this.prepareMaskMaterial,this.prepareMaskMaterial.uniforms.cameraNearFar.value.set(this.renderCamera.near,this.renderCamera.far),this.prepareMaskMaterial.uniforms.depthTexture.value=this.renderTargetDepthBuffer.texture,this.prepareMaskMaterial.uniforms.textureMatrix.value=this.textureMatrix,e.setRenderTarget(this.renderTargetMaskBuffer),e.clear(),e.render(this.renderScene,this.renderCamera),this.renderScene.overrideMaterial=null,this.changeVisibilityOfNonSelectedObjects(!0),this._visibilityCache.clear(),this.renderScene.background=i,this.fsQuad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=this.renderTargetMaskBuffer.texture,e.setRenderTarget(this.renderTargetMaskDownSampleBuffer),e.clear(),this.fsQuad.render(e),this.tempPulseColor1.copy(this.visibleEdgeColor),this.tempPulseColor2.copy(this.hiddenEdgeColor),this.pulsePeriod>0){const e=.625+.75*Math.cos(.01*performance.now()/this.pulsePeriod)/2;this.tempPulseColor1.multiplyScalar(e),this.tempPulseColor2.multiplyScalar(e)}this.fsQuad.material=this.edgeDetectionMaterial,this.edgeDetectionMaterial.uniforms.maskTexture.value=this.renderTargetMaskDownSampleBuffer.texture,this.edgeDetectionMaterial.uniforms.texSize.value.set(this.renderTargetMaskDownSampleBuffer.width,this.renderTargetMaskDownSampleBuffer.height),this.edgeDetectionMaterial.uniforms.visibleEdgeColor.value=this.tempPulseColor1,this.edgeDetectionMaterial.uniforms.hiddenEdgeColor.value=this.tempPulseColor2,e.setRenderTarget(this.renderTargetEdgeBuffer1),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.separableBlurMaterial1,this.separableBlurMaterial1.uniforms.colorTexture.value=this.renderTargetEdgeBuffer1.texture,this.separableBlurMaterial1.uniforms.direction.value=this.BlurDirectionX,this.separableBlurMaterial1.uniforms.kernelRadius.value=this.edgeThickness,e.setRenderTarget(this.renderTargetBlurBuffer1),e.clear(),this.fsQuad.render(e),this.separableBlurMaterial1.uniforms.colorTexture.value=this.renderTargetBlurBuffer1.texture,this.separableBlurMaterial1.uniforms.direction.value=this.BlurDirectionY,e.setRenderTarget(this.renderTargetEdgeBuffer1),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.separableBlurMaterial2,this.separableBlurMaterial2.uniforms.colorTexture.value=this.renderTargetEdgeBuffer1.texture,this.separableBlurMaterial2.uniforms.direction.value=this.BlurDirectionX,e.setRenderTarget(this.renderTargetBlurBuffer2),e.clear(),this.fsQuad.render(e),this.separableBlurMaterial2.uniforms.colorTexture.value=this.renderTargetBlurBuffer2.texture,this.separableBlurMaterial2.uniforms.direction.value=this.BlurDirectionY,e.setRenderTarget(this.renderTargetEdgeBuffer2),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.overlayMaterial,this.overlayMaterial.uniforms.maskTexture.value=this.renderTargetMaskBuffer.texture,this.overlayMaterial.uniforms.edgeTexture1.value=this.renderTargetEdgeBuffer1.texture,this.overlayMaterial.uniforms.edgeTexture2.value=this.renderTargetEdgeBuffer2.texture,this.overlayMaterial.uniforms.patternTexture.value=this.patternTexture,this.overlayMaterial.uniforms.edgeStrength.value=this.edgeStrength,this.overlayMaterial.uniforms.edgeGlow.value=this.edgeGlow,this.overlayMaterial.uniforms.usePatternTexture.value=this.usePatternTexture,n&&e.state.buffers.stencil.setTest(!0),e.setRenderTarget(r),this.fsQuad.render(e),e.setClearColor(this._oldClearColor,this.oldClearAlpha),e.autoClear=t}this.renderToScreen&&(this.fsQuad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=r.texture,e.setRenderTarget(null),this.fsQuad.render(e))}getPrepareMaskMaterial(){return new e.ShaderMaterial({uniforms:{depthTexture:{value:null},cameraNearFar:{value:new e.Vector2(.5,.5)},textureMatrix:{value:null}},vertexShader:"#include <morphtarget_pars_vertex>\n\t\t\t\t#include <skinning_pars_vertex>\n\t\t\t\tvarying vec4 projTexCoord;\n\t\t\t\tvarying vec4 vPosition;\n\t\t\t\tuniform mat4 textureMatrix;\n\t\t\t\tvoid main() {\n\t\t\t\t\t#include <skinbase_vertex>\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <morphtarget_vertex>\n\t\t\t\t\t#include <skinning_vertex>\n\t\t\t\t\t#include <project_vertex>\n\t\t\t\t\tvPosition = mvPosition;\n\t\t\t\t\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n\t\t\t\t\tprojTexCoord = textureMatrix * worldPosition;\n\t\t\t\t}",fragmentShader:"#include <packing>\n\t\t\t\tvarying vec4 vPosition;\n\t\t\t\tvarying vec4 projTexCoord;\n\t\t\t\tuniform sampler2D depthTexture;\n\t\t\t\tuniform vec2 cameraNearFar;\n\t\t\t\tvoid main() {\n\t\t\t\t\tfloat depth = unpackRGBAToDepth(texture2DProj( depthTexture, projTexCoord ));\n\t\t\t\t\tfloat viewZ = - DEPTH_TO_VIEW_Z( depth, cameraNearFar.x, cameraNearFar.y );\n\t\t\t\t\tfloat depthTest = (-vPosition.z > viewZ) ? 1.0 : 0.0;\n\t\t\t\t\tgl_FragColor = vec4(0.0, depthTest, 1.0, 1.0);\n\t\t\t\t}"})}getEdgeDetectionMaterial(){return new e.ShaderMaterial({uniforms:{maskTexture:{value:null},texSize:{value:new e.Vector2(.5,.5)},visibleEdgeColor:{value:new e.Vector3(1,1,1)},hiddenEdgeColor:{value:new e.Vector3(1,1,1)}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"varying vec2 vUv;\n\t\t\t\tuniform sampler2D maskTexture;\n\t\t\t\tuniform vec2 texSize;\n\t\t\t\tuniform vec3 visibleEdgeColor;\n\t\t\t\tuniform vec3 hiddenEdgeColor;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec2 invSize = 1.0 / texSize;\n\t\t\t\t\tvec4 uvOffset = vec4(1.0, 0.0, 0.0, 1.0) * vec4(invSize, invSize);\n\t\t\t\t\tvec4 c1 = texture2D( maskTexture, vUv + uvOffset.xy);\n\t\t\t\t\tvec4 c2 = texture2D( maskTexture, vUv - uvOffset.xy);\n\t\t\t\t\tvec4 c3 = texture2D( maskTexture, vUv + uvOffset.yw);\n\t\t\t\t\tvec4 c4 = texture2D( maskTexture, vUv - uvOffset.yw);\n\t\t\t\t\tfloat diff1 = (c1.r - c2.r)*0.5;\n\t\t\t\t\tfloat diff2 = (c3.r - c4.r)*0.5;\n\t\t\t\t\tfloat d = length( vec2(diff1, diff2) );\n\t\t\t\t\tfloat a1 = min(c1.g, c2.g);\n\t\t\t\t\tfloat a2 = min(c3.g, c4.g);\n\t\t\t\t\tfloat visibilityFactor = min(a1, a2);\n\t\t\t\t\tvec3 edgeColor = 1.0 - visibilityFactor > 0.001 ? visibleEdgeColor : hiddenEdgeColor;\n\t\t\t\t\tgl_FragColor = vec4(edgeColor, 1.0) * vec4(d);\n\t\t\t\t}"})}getSeperableBlurMaterial(t){return new e.ShaderMaterial({defines:{MAX_RADIUS:t},uniforms:{colorTexture:{value:null},texSize:{value:new e.Vector2(.5,.5)},direction:{value:new e.Vector2(.5,.5)},kernelRadius:{value:1}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"#include <common>\n\t\t\t\tvarying vec2 vUv;\n\t\t\t\tuniform sampler2D colorTexture;\n\t\t\t\tuniform vec2 texSize;\n\t\t\t\tuniform vec2 direction;\n\t\t\t\tuniform float kernelRadius;\n\t\t\t\tfloat gaussianPdf(in float x, in float sigma) {\n\t\t\t\t\treturn 0.39894 * exp( -0.5 * x * x/( sigma * sigma))/sigma;\n\t\t\t\t}\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec2 invSize = 1.0 / texSize;\n\t\t\t\t\tfloat weightSum = gaussianPdf(0.0, kernelRadius);\n\t\t\t\t\tvec4 diffuseSum = texture2D( colorTexture, vUv) * weightSum;\n\t\t\t\t\tvec2 delta = direction * invSize * kernelRadius/float(MAX_RADIUS);\n\t\t\t\t\tvec2 uvOffset = delta;\n\t\t\t\t\tfor( int i = 1; i <= MAX_RADIUS; i ++ ) {\n\t\t\t\t\t\tfloat w = gaussianPdf(uvOffset.x, kernelRadius);\n\t\t\t\t\t\tvec4 sample1 = texture2D( colorTexture, vUv + uvOffset);\n\t\t\t\t\t\tvec4 sample2 = texture2D( colorTexture, vUv - uvOffset);\n\t\t\t\t\t\tdiffuseSum += ((sample1 + sample2) * w);\n\t\t\t\t\t\tweightSum += (2.0 * w);\n\t\t\t\t\t\tuvOffset += delta;\n\t\t\t\t\t}\n\t\t\t\t\tgl_FragColor = diffuseSum/weightSum;\n\t\t\t\t}"})}getOverlayMaterial(){return new e.ShaderMaterial({uniforms:{maskTexture:{value:null},edgeTexture1:{value:null},edgeTexture2:{value:null},patternTexture:{value:null},edgeStrength:{value:1},edgeGlow:{value:1},usePatternTexture:{value:0}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"varying vec2 vUv;\n\t\t\t\tuniform sampler2D maskTexture;\n\t\t\t\tuniform sampler2D edgeTexture1;\n\t\t\t\tuniform sampler2D edgeTexture2;\n\t\t\t\tuniform sampler2D patternTexture;\n\t\t\t\tuniform float edgeStrength;\n\t\t\t\tuniform float edgeGlow;\n\t\t\t\tuniform bool usePatternTexture;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec4 edgeValue1 = texture2D(edgeTexture1, vUv);\n\t\t\t\t\tvec4 edgeValue2 = texture2D(edgeTexture2, vUv);\n\t\t\t\t\tvec4 maskColor = texture2D(maskTexture, vUv);\n\t\t\t\t\tvec4 patternColor = texture2D(patternTexture, 6.0 * vUv);\n\t\t\t\t\tfloat visibilityFactor = 1.0 - maskColor.g > 0.0 ? 1.0 : 0.5;\n\t\t\t\t\tvec4 edgeValue = edgeValue1 + edgeValue2 * edgeGlow;\n\t\t\t\t\tvec4 finalColor = edgeStrength * maskColor.r * edgeValue;\n\t\t\t\t\tif(usePatternTexture)\n\t\t\t\t\t\tfinalColor += + visibilityFactor * (1.0 - maskColor.r) * (1.0 - patternColor.r);\n\t\t\t\t\tgl_FragColor = finalColor;\n\t\t\t\t}",blending:e.AdditiveBlending,depthTest:!1,depthWrite:!1,transparent:!0})}},exports.PCDLoader=km,exports.PDBLoader=Sm,exports.PLYExporter=class{parse(t,r,i){r&&"object"==typeof r&&(console.warn('THREE.PLYExporter: The options parameter is now the third argument to the "parse" function. See the documentation for the new API.'),i=r,r=void 0);const n=(i=Object.assign({binary:!1,excludeAttributes:[],littleEndian:!1},i)).excludeAttributes;let s=!1,o=!1,a=!1,l=0,c=0;t.traverse((function(t){if(t instanceof e.Mesh&&t.isMesh){const e=t.geometry;if(!e.isBufferGeometry)throw new Error("THREE.PLYExporter: Geometry is not of type THREE.BufferGeometry.");const r=e.getAttribute("position"),i=e.getAttribute("normal"),n=e.getAttribute("uv"),h=e.getAttribute("color"),u=e.getIndex();if(void 0===r)return;l+=r.count,c+=u?u.count/3:r.count/3,void 0!==i&&(s=!0),void 0!==n&&(a=!0),void 0!==h&&(o=!0)}}));const h=-1===(null==n?void 0:n.indexOf("index"));if(s=s&&-1===(null==n?void 0:n.indexOf("normal")),o=o&&-1===(null==n?void 0:n.indexOf("color")),a=a&&-1===(null==n?void 0:n.indexOf("uv")),h&&c!==Math.floor(c))return console.error("PLYExporter: Failed to generate a valid PLY file with triangle indices because the number of indices is not divisible by 3."),null;let u=`ply\nformat ${i.binary?i.littleEndian?"binary_little_endian":"binary_big_endian":"ascii"} 1.0\nelement vertex ${l}\nproperty float x\nproperty float y\nproperty float z\n`;s&&(u+="property float nx\nproperty float ny\nproperty float nz\n"),a&&(u+="property float s\nproperty float t\n"),o&&(u+="property uchar red\nproperty uchar green\nproperty uchar blue\n"),h&&(u+=`element face ${c}\nproperty list uchar int vertex_index\n`),u+="end_header\n";const d=new e.Vector3,p=new e.Matrix3;let m=null;if(i.binary){const e=(new TextEncoder).encode(u),r=l*(12+(s?12:0)+(o?3:0)+(a?8:0)),n=h?13*c:0,f=new DataView(new ArrayBuffer(e.length+r+n));new Uint8Array(f.buffer).set(e,0);let g=e.length,v=e.length+r,x=0;this.traverseMeshes(t,(function(e,t){const r=t.getAttribute("position"),n=t.getAttribute("normal"),l=t.getAttribute("uv"),c=t.getAttribute("color"),u=t.getIndex();p.getNormalMatrix(e.matrixWorld);for(let t=0,h=r.count;t<h;t++)d.x=r.getX(t),d.y=r.getY(t),d.z=r.getZ(t),d.applyMatrix4(e.matrixWorld),f.setFloat32(g,d.x,i.littleEndian),g+=4,f.setFloat32(g,d.y,i.littleEndian),g+=4,f.setFloat32(g,d.z,i.littleEndian),g+=4,s&&(null!=n?(d.x=n.getX(t),d.y=n.getY(t),d.z=n.getZ(t),d.applyMatrix3(p).normalize(),f.setFloat32(g,d.x,i.littleEndian),g+=4,f.setFloat32(g,d.y,i.littleEndian),g+=4,f.setFloat32(g,d.z,i.littleEndian),g+=4):(f.setFloat32(g,0,i.littleEndian),g+=4,f.setFloat32(g,0,i.littleEndian),g+=4,f.setFloat32(g,0,i.littleEndian),g+=4)),a&&(null!=l?(f.setFloat32(g,l.getX(t),i.littleEndian),g+=4,f.setFloat32(g,l.getY(t),i.littleEndian),g+=4):a||(f.setFloat32(g,0,i.littleEndian),g+=4,f.setFloat32(g,0,i.littleEndian),g+=4)),o&&(null!=c?(f.setUint8(g,Math.floor(255*c.getX(t))),g+=1,f.setUint8(g,Math.floor(255*c.getY(t))),g+=1,f.setUint8(g,Math.floor(255*c.getZ(t))),g+=1):(f.setUint8(g,255),g+=1,f.setUint8(g,255),g+=1,f.setUint8(g,255),g+=1));if(h)if(null!==u)for(let e=0,t=u.count;e<t;e+=3)f.setUint8(v,3),v+=1,f.setUint32(v,u.getX(e+0)+x,i.littleEndian),v+=4,f.setUint32(v,u.getX(e+1)+x,i.littleEndian),v+=4,f.setUint32(v,u.getX(e+2)+x,i.littleEndian),v+=4;else for(let e=0,t=r.count;e<t;e+=3)f.setUint8(v,3),v+=1,f.setUint32(v,x+e,i.littleEndian),v+=4,f.setUint32(v,x+e+1,i.littleEndian),v+=4,f.setUint32(v,x+e+2,i.littleEndian),v+=4;x+=r.count})),m=f.buffer}else{let e=0,r="",i="";this.traverseMeshes(t,(function(t,n){const l=n.getAttribute("position"),u=n.getAttribute("normal"),m=n.getAttribute("uv"),f=n.getAttribute("color"),g=n.getIndex();p.getNormalMatrix(t.matrixWorld);for(let e=0,i=l.count;e<i;e++){d.x=l.getX(e),d.y=l.getY(e),d.z=l.getZ(e),d.applyMatrix4(t.matrixWorld);let i=d.x+" "+d.y+" "+d.z;s&&(null!=u?(d.x=u.getX(e),d.y=u.getY(e),d.z=u.getZ(e),d.applyMatrix3(p).normalize(),i+=" "+d.x+" "+d.y+" "+d.z):i+=" 0 0 0"),a&&(null!=m?i+=" "+m.getX(e)+" "+m.getY(e):a&&(i+=" 0 0")),o&&(i+=null!=f?" "+Math.floor(255*f.getX(e))+" "+Math.floor(255*f.getY(e))+" "+Math.floor(255*f.getZ(e)):" 255 255 255"),r+=i+"\n"}if(h){if(null!==g)for(let t=0,r=g.count;t<r;t+=3)i+=`3 ${g.getX(t+0)+e}`,i+=` ${g.getX(t+1)+e}`,i+=` ${g.getX(t+2)+e}\n`;else for(let t=0,r=l.count;t<r;t+=3)i+=`3 ${e+t} ${e+t+1} ${e+t+2}\n`;c+=g?g.count/3:l.count/3}e+=l.count})),m=`${u}${r}${h?`${i}\n`:"\n"}`}return"function"==typeof r&&requestAnimationFrame((()=>r&&r("string"==typeof m?m:""))),m}traverseMeshes(t,r){t.traverse((function(t){if(t instanceof e.Mesh&&t.isMesh){const e=t,i=e.geometry;if(!i.isBufferGeometry)throw new Error("THREE.PLYExporter: Geometry is not of type THREE.BufferGeometry.");i.hasAttribute("position")&&r(e,i)}}))}},exports.PLYLoader=Wm,exports.PRWMLoader=Bm,exports.PVRLoader=Ld,exports.PackedPhongMaterial=Ro,exports.ParallaxBarrierEffect=function(t){const r=new e.OrthographicCamera(-1,1,1,-1,0,1),i=new e.Scene,n=new e.StereoCamera,s={minFilter:e.LinearFilter,magFilter:e.NearestFilter,format:e.RGBAFormat},o=new e.WebGLRenderTarget(512,512,s),a=new e.WebGLRenderTarget(512,512,s),l=new e.ShaderMaterial({uniforms:{mapLeft:{value:o.texture},mapRight:{value:a.texture}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = vec2( uv.x, uv.y );","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D mapLeft;","uniform sampler2D mapRight;","varying vec2 vUv;","void main() {","\tvec2 uv = vUv;","\tif ( ( mod( gl_FragCoord.y, 2.0 ) ) > 1.00 ) {","\t\tgl_FragColor = texture2D( mapLeft, uv );","\t} else {","\t\tgl_FragColor = texture2D( mapRight, uv );","\t}","}"].join("\n")}),c=new e.Mesh(new e.PlaneGeometry(2,2),l);i.add(c),this.setSize=(e,r)=>{t.setSize(e,r);const i=t.getPixelRatio();o.setSize(e*i,r*i),a.setSize(e*i,r*i)},this.render=(e,s)=>{e.updateMatrixWorld(),null===s.parent&&s.updateMatrixWorld(),n.update(s),t.setRenderTarget(o),t.clear(),t.render(e,n.cameraL),t.setRenderTarget(a),t.clear(),t.render(e,n.cameraR),t.setRenderTarget(null),t.render(i,r)}},exports.ParallaxShader=_h,exports.ParametricGeometries=Gc,exports.ParametricGeometry=Vc,exports.Pass=Ia,exports.PeppersGhostEffect=function(t){const r=this;let i,n,s;r.cameraDistance=15,r.reflectFromAbove=!1;const o=new e.PerspectiveCamera,a=new e.PerspectiveCamera,l=new e.PerspectiveCamera,c=new e.PerspectiveCamera,h=new e.Vector3,u=new e.Quaternion,d=new e.Vector3;t.autoClear=!1,this.setSize=(e,r)=>{i=e/2,e<r?(n=e/3,s=e/3):(n=r/3,s=r/3),t.setSize(e,r)},this.render=(e,p)=>{e.updateMatrixWorld(),null===p.parent&&p.updateMatrixWorld(),p.matrixWorld.decompose(h,u,d),o.position.copy(h),o.quaternion.copy(u),o.translateZ(r.cameraDistance),o.lookAt(e.position),a.position.copy(h),a.quaternion.copy(u),a.translateZ(-r.cameraDistance),a.lookAt(e.position),a.rotation.z+=Math.PI/180*180,l.position.copy(h),l.quaternion.copy(u),l.translateX(-r.cameraDistance),l.lookAt(e.position),l.rotation.x+=Math.PI/180*90,c.position.copy(h),c.quaternion.copy(u),c.translateX(r.cameraDistance),c.lookAt(e.position),c.rotation.x+=Math.PI/180*90,t.clear(),t.setScissorTest(!0),t.setScissor(i-n/2,2*s,n,s),t.setViewport(i-n/2,2*s,n,s),r.reflectFromAbove?t.render(e,a):t.render(e,o),t.setScissor(i-n/2,0,n,s),t.setViewport(i-n/2,0,n,s),r.reflectFromAbove?t.render(e,o):t.render(e,a),t.setScissor(i-n/2-n,s,n,s),t.setViewport(i-n/2-n,s,n,s),r.reflectFromAbove?t.render(e,c):t.render(e,l),t.setScissor(i+n/2,s,n,s),t.setViewport(i+n/2,s,n,s),r.reflectFromAbove?t.render(e,l):t.render(e,c),t.setScissorTest(!1)}},exports.PhysicalLightingModel=Rn,exports.PixelShader=Ph,exports.PointUVNode=yn,exports.PointerLockControls=Aa,exports.PointsNodeMaterial=ns,exports.PositionNode=Dt,exports.PositionalAudioHelper=Mf,exports.ProgressiveLightMap=class{constructor(t,r=1024){this.renderer=t,this.res=r,this.lightMapContainers=[],this.compiled=!1,this.scene=new e.Scene,this.scene.background=null,this.tinyTarget=new e.WebGLRenderTarget(1,1),this.buffer1Active=!1,this.firstUpdate=!0,this.warned=!1;const i=/(Android|iPad|iPhone|iPod)/g.test(navigator.userAgent)?alfFloatType:e.FloatType;this.progressiveLightMap1=new e.WebGLRenderTarget(this.res,this.res,{type:i}),this.progressiveLightMap2=new e.WebGLRenderTarget(this.res,this.res,{type:i}),this.uvMat=new e.MeshPhongMaterial,this.uvMat.uniforms={},this.uvMat.onBeforeCompile=e=>{e.vertexShader="#define USE_LIGHTMAP\n"+e.vertexShader.slice(0,-1)+"\tgl_Position = vec4((uv2 - 0.5) * 2.0, 1.0, 1.0); }";const t=e.fragmentShader.indexOf("void main() {");e.fragmentShader="varying vec2 vUv2;\n"+e.fragmentShader.slice(0,t)+"\tuniform sampler2D previousShadowMap;\n\tuniform float averagingWindow;\n"+e.fragmentShader.slice(t-1,-1)+"\nvec3 texelOld = texture2D(previousShadowMap, vUv2).rgb;\n\t\t\t\tgl_FragColor.rgb = mix(texelOld, gl_FragColor.rgb, 1.0/averagingWindow);\n\t\t\t}",e.uniforms.previousShadowMap={value:this.progressiveLightMap1.texture},e.uniforms.averagingWindow={value:100},this.uvMat.uniforms=e.uniforms,this.uvMat.userData.shader=e,this.compiled=!0}}addObjectsToLightMap(e){this.uv_boxes=[];const t=3/this.res;for(let r=0;r<e.length;r++){const i=e[r];i.isLight?this.scene.attach(i):i.geometry.hasAttribute("uv")?(null==this.blurringPlane&&this._initializeBlurPlane(this.res,this.progressiveLightMap1),i.material.lightMap=this.progressiveLightMap2.texture,i.material.dithering=!0,i.castShadow=!0,i.receiveShadow=!0,i.renderOrder=1e3+r,this.uv_boxes.push({w:1+2*t,h:1+2*t,index:r}),this.lightMapContainers.push({basicMat:i.material,object:i}),this.compiled=!1):console.warn("All lightmap objects need UVs!")}const r=m.default(this.uv_boxes);this.uv_boxes.forEach((i=>{const n=e[i.index].geometry.getAttribute("uv").clone();for(let e=0;e<n.array.length;e+=n.itemSize)n.array[e]=(n.array[e]+i.x+t)/r.w,n.array[e+1]=(n.array[e+1]+i.y+t)/r.h;e[i.index].geometry.setAttribute("uv2",n),e[i.index].geometry.getAttribute("uv2").needsUpdate=!0}))}update(e,t=100,r=!0){if(null==this.blurringPlane)return;const i=this.renderer.getRenderTarget();this.blurringPlane.visible=r;for(let e=0;e<this.lightMapContainers.length;e++)this.lightMapContainers[e].object.oldScene=this.lightMapContainers[e].object.parent,this.scene.attach(this.lightMapContainers[e].object);this.firstUpdate&&(this.renderer.setRenderTarget(this.tinyTarget),this.renderer.render(this.scene,e),this.firstUpdate=!1);for(let e=0;e<this.lightMapContainers.length;e++)this.uvMat.uniforms.averagingWindow={value:t},this.lightMapContainers[e].object.material=this.uvMat,this.lightMapContainers[e].object.oldFrustumCulled=this.lightMapContainers[e].object.frustumCulled,this.lightMapContainers[e].object.frustumCulled=!1;const n=this.buffer1Active?this.progressiveLightMap1:this.progressiveLightMap2,s=this.buffer1Active?this.progressiveLightMap2:this.progressiveLightMap1;this.renderer.setRenderTarget(n),this.uvMat.uniforms.previousShadowMap={value:s.texture},this.blurringPlane.material.uniforms.previousShadowMap={value:s.texture},this.buffer1Active=!this.buffer1Active,this.renderer.render(this.scene,e);for(let e=0;e<this.lightMapContainers.length;e++)this.lightMapContainers[e].object.frustumCulled=this.lightMapContainers[e].object.oldFrustumCulled,this.lightMapContainers[e].object.material=this.lightMapContainers[e].basicMat,this.lightMapContainers[e].object.oldScene.attach(this.lightMapContainers[e].object);this.renderer.setRenderTarget(i)}showDebugLightmap(t,r){0!=this.lightMapContainers.length?(null==this.labelMesh&&(this.labelMaterial=new e.MeshBasicMaterial({map:this.progressiveLightMap1.texture,side:e.DoubleSide}),this.labelPlane=new e.PlaneGeometry(100,100),this.labelMesh=new e.Mesh(this.labelPlane,this.labelMaterial),this.labelMesh.position.y=250,this.lightMapContainers[0].object.parent.add(this.labelMesh)),null!=r&&this.labelMesh.position.copy(r),this.labelMesh.visible=t):this.warned||(console.warn("Call this after adding the objects!"),this.warned=!0)}_initializeBlurPlane(t,r=null){const i=new e.MeshBasicMaterial;i.uniforms={previousShadowMap:{value:null},pixelOffset:{value:1/t},polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:3},i.onBeforeCompile=e=>{e.vertexShader="#define USE_UV\n"+e.vertexShader.slice(0,-1)+"\tgl_Position = vec4((uv - 0.5) * 2.0, 1.0, 1.0); }";const n=e.fragmentShader.indexOf("void main() {");e.fragmentShader="#define USE_UV\n"+e.fragmentShader.slice(0,n)+"\tuniform sampler2D previousShadowMap;\n\tuniform float pixelOffset;\n"+e.fragmentShader.slice(n-1,-1)+"\tgl_FragColor.rgb = (\n\t\t\t texture2D(previousShadowMap, vUv + vec2( pixelOffset, 0.0 )).rgb +\n\t\t\t texture2D(previousShadowMap, vUv + vec2( 0.0 , pixelOffset)).rgb +\n\t\t\t texture2D(previousShadowMap, vUv + vec2( 0.0 , -pixelOffset)).rgb +\n\t\t\t texture2D(previousShadowMap, vUv + vec2(-pixelOffset, 0.0 )).rgb +\n\t\t\t texture2D(previousShadowMap, vUv + vec2( pixelOffset, pixelOffset)).rgb +\n\t\t\t texture2D(previousShadowMap, vUv + vec2(-pixelOffset, pixelOffset)).rgb +\n\t\t\t texture2D(previousShadowMap, vUv + vec2( pixelOffset, -pixelOffset)).rgb +\n\t\t\t texture2D(previousShadowMap, vUv + vec2(-pixelOffset, -pixelOffset)).rgb)/8.0;\n\t\t}",e.uniforms.previousShadowMap={value:r.texture},e.uniforms.pixelOffset={value:.5/t},i.uniforms=e.uniforms,i.userData.shader=e,this.compiled=!0},this.blurringPlane=new e.Mesh(new e.PlaneGeometry(1,1),i),this.blurringPlane.name="Blurring Plane",this.blurringPlane.frustumCulled=!1,this.blurringPlane.renderOrder=0,this.blurringPlane.material.depthWrite=!1,this.scene.add(this.blurringPlane)}},exports.Projector=ye,exports.PropertyNode=Mt,exports.RE_Direct_Physical=Ln,exports.RGBELoader=Md,exports.RGBMLoader=Lm,exports.RGBShiftShader=Bh,exports.RectAreaLightHelper=Ef,exports.RectAreaLightUniformsLib=_f,exports.ReferenceNode=fn,exports.ReflectNode=pn,exports.Reflector=Gs,exports.ReflectorForSSRPass=eo,exports.ReflectorRTT=class extends Gs{constructor(e,t){super(e,t),this.geometry.setDrawRange(0,0)}},exports.Refractor=zs,exports.RenderPass=class extends Ia{constructor(t,r,i,n,s=0){super(),p.default(this,"scene",void 0),p.default(this,"camera",void 0),p.default(this,"overrideMaterial",void 0),p.default(this,"clearColor",void 0),p.default(this,"clearAlpha",void 0),p.default(this,"clearDepth",!1),p.default(this,"_oldClearColor",new e.Color),this.scene=t,this.camera=r,this.overrideMaterial=i,this.clearColor=n,this.clearAlpha=s,this.clear=!0,this.needsSwap=!1}render(e,t,r){let i,n=e.autoClear;e.autoClear=!1;let s=null;void 0!==this.overrideMaterial&&(s=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor&&(e.getClearColor(this._oldClearColor),i=e.getClearAlpha(),e.setClearColor(this.clearColor,this.clearAlpha)),this.clearDepth&&e.clearDepth(),e.setRenderTarget(this.renderToScreen?null:r),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),e.render(this.scene,this.camera),this.clearColor&&e.setClearColor(this._oldClearColor,i),void 0!==this.overrideMaterial&&(this.scene.overrideMaterial=s),e.autoClear=n}},exports.RenderPixelatedPass=class extends Ia{constructor(t,r,i,n,s={}){var o,a;super(),this.pixelSize=r,this.resolution=new e.Vector2,this.renderResolution=new e.Vector2,this.setSize(t.x,t.y),this.fsQuad=new Ua(this.material()),this.scene=i,this.camera=n,this.normalEdgeStrength=null!=(o=s.normalEdgeStrength)?o:.3,this.depthEdgeStrength=null!=(a=s.depthEdgeStrength)?a:.4,this.rgbRenderTarget=yl(this.renderResolution,e.RGBAFormat,!0),this.normalRenderTarget=yl(this.renderResolution,e.RGBAFormat,!1),this.normalMaterial=new e.MeshNormalMaterial}dispose(){this.rgbRenderTarget.dispose(),this.normalRenderTarget.dispose(),this.fsQuad.dispose()}setSize(e,t){var r,i,n;this.resolution.set(e,t),this.renderResolution.set(e/this.pixelSize|0,t/this.pixelSize|0);const{x:s,y:o}=this.renderResolution;null===(r=this.rgbRenderTarget)||void 0===r||r.setSize(s,o),null===(i=this.normalRenderTarget)||void 0===i||i.setSize(s,o),null===(n=this.fsQuad)||void 0===n||n.material.uniforms.resolution.value.set(s,o,1/s,1/o)}setPixelSize(e){this.pixelSize=e,this.setSize(this.resolution.x,this.resolution.y)}render(e,t){const r=this.fsQuad.material.uniforms;r.normalEdgeStrength.value=this.normalEdgeStrength,r.depthEdgeStrength.value=this.depthEdgeStrength,e.setRenderTarget(this.rgbRenderTarget),e.render(this.scene,this.camera);const i=this.scene.overrideMaterial;e.setRenderTarget(this.normalRenderTarget),this.scene.overrideMaterial=this.normalMaterial,e.render(this.scene,this.camera),this.scene.overrideMaterial=i,r.tDiffuse.value=this.rgbRenderTarget.texture,r.tDepth.value=this.rgbRenderTarget.depthTexture,r.tNormal.value=this.normalRenderTarget.texture,this.renderToScreen?e.setRenderTarget(null):(e.setRenderTarget(t),this.clear&&e.clear()),this.fsQuad.render(e)}material(){return new e.ShaderMaterial({uniforms:{tDiffuse:{value:null},tDepth:{value:null},tNormal:{value:null},resolution:{value:new e.Vector4(this.renderResolution.x,this.renderResolution.y,1/this.renderResolution.x,1/this.renderResolution.y)},normalEdgeStrength:{value:0},depthEdgeStrength:{value:0}},vertexShader:"\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t\t\t}\n\t\t\t\t",fragmentShader:"\n\t\t\t\tuniform sampler2D tDiffuse;\n\t\t\t\tuniform sampler2D tDepth;\n\t\t\t\tuniform sampler2D tNormal;\n\t\t\t\tuniform vec4 resolution;\n\t\t\t\tuniform float normalEdgeStrength;\n\t\t\t\tuniform float depthEdgeStrength;\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t\tfloat getDepth(int x, int y) {\n\n\t\t\t\t\treturn texture2D( tDepth, vUv + vec2(x, y) * resolution.zw ).r;\n\n\t\t\t\t}\n\n\t\t\t\tvec3 getNormal(int x, int y) {\n\n\t\t\t\t\treturn texture2D( tNormal, vUv + vec2(x, y) * resolution.zw ).rgb * 2.0 - 1.0;\n\n\t\t\t\t}\n\n\t\t\t\tfloat depthEdgeIndicator(float depth, vec3 normal) {\n\n\t\t\t\t\tfloat diff = 0.0;\n\t\t\t\t\tdiff += clamp(getDepth(1, 0) - depth, 0.0, 1.0);\n\t\t\t\t\tdiff += clamp(getDepth(-1, 0) - depth, 0.0, 1.0);\n\t\t\t\t\tdiff += clamp(getDepth(0, 1) - depth, 0.0, 1.0);\n\t\t\t\t\tdiff += clamp(getDepth(0, -1) - depth, 0.0, 1.0);\n\t\t\t\t\treturn floor(smoothstep(0.01, 0.02, diff) * 2.) / 2.;\n\n\t\t\t\t}\n\n\t\t\t\tfloat neighborNormalEdgeIndicator(int x, int y, float depth, vec3 normal) {\n\n\t\t\t\t\tfloat depthDiff = getDepth(x, y) - depth;\n\t\t\t\t\tvec3 neighborNormal = getNormal(x, y);\n\t\t\t\t\t\n\t\t\t\t\t// Edge pixels should yield to faces who's normals are closer to the bias normal.\n\t\t\t\t\tvec3 normalEdgeBias = vec3(1., 1., 1.); // This should probably be a parameter.\n\t\t\t\t\tfloat normalDiff = dot(normal - neighborNormal, normalEdgeBias);\n\t\t\t\t\tfloat normalIndicator = clamp(smoothstep(-.01, .01, normalDiff), 0.0, 1.0);\n\t\t\t\t\t\n\t\t\t\t\t// Only the shallower pixel should detect the normal edge.\n\t\t\t\t\tfloat depthIndicator = clamp(sign(depthDiff * .25 + .0025), 0.0, 1.0);\n\n\t\t\t\t\treturn (1.0 - dot(normal, neighborNormal)) * depthIndicator * normalIndicator;\n\n\t\t\t\t}\n\n\t\t\t\tfloat normalEdgeIndicator(float depth, vec3 normal) {\n\t\t\t\t\t\n\t\t\t\t\tfloat indicator = 0.0;\n\n\t\t\t\t\tindicator += neighborNormalEdgeIndicator(0, -1, depth, normal);\n\t\t\t\t\tindicator += neighborNormalEdgeIndicator(0, 1, depth, normal);\n\t\t\t\t\tindicator += neighborNormalEdgeIndicator(-1, 0, depth, normal);\n\t\t\t\t\tindicator += neighborNormalEdgeIndicator(1, 0, depth, normal);\n\n\t\t\t\t\treturn step(0.1, indicator);\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec4 texel = texture2D( tDiffuse, vUv );\n\n\t\t\t\t\tfloat depth = 0.0;\n\t\t\t\t\tvec3 normal = vec3(0.0);\n\n\t\t\t\t\tif (depthEdgeStrength > 0.0 || normalEdgeStrength > 0.0) {\n\n\t\t\t\t\t\tdepth = getDepth(0, 0);\n\t\t\t\t\t\tnormal = getNormal(0, 0);\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat dei = 0.0;\n\t\t\t\t\tif (depthEdgeStrength > 0.0) \n\t\t\t\t\t\tdei = depthEdgeIndicator(depth, normal);\n\n\t\t\t\t\tfloat nei = 0.0; \n\t\t\t\t\tif (normalEdgeStrength > 0.0) \n\t\t\t\t\t\tnei = normalEdgeIndicator(depth, normal);\n\n\t\t\t\t\tfloat Strength = dei > 0.0 ? (1.0 - depthEdgeStrength * dei) : (1.0 + normalEdgeStrength * nei);\n\n\t\t\t\t\tgl_FragColor = texel * Strength;\n\n\t\t\t\t}\n\t\t\t\t"})}},exports.RenderableFace=fe,exports.RenderableLine=ve,exports.RenderableObject=me,exports.RenderableSprite=xe,exports.RenderableVertex=ge,exports.Rhino3dmLoader=Qp,exports.RollerCoasterGeometry=O,exports.RollerCoasterLiftersGeometry=k,exports.RollerCoasterShadowGeometry=V,exports.RoomEnvironment=function(){const e=new d.Scene,t=new d.BoxGeometry;t.deleteAttribute("uv");const r=new d.MeshStandardMaterial({side:d.BackSide}),i=new d.MeshStandardMaterial,n=new d.PointLight(16777215,5,28,2);n.position.set(.418,16.199,.3),e.add(n);const s=new d.Mesh(t,r);s.position.set(-.757,13.219,.717),s.scale.set(31.713,28.305,28.591),e.add(s);const o=new d.Mesh(t,i);o.position.set(-10.906,2.009,1.846),o.rotation.set(0,-.195,0),o.scale.set(2.328,7.905,4.651),e.add(o);const a=new d.Mesh(t,i);a.position.set(-5.607,-.754,-.758),a.rotation.set(0,.994,0),a.scale.set(1.97,1.534,3.955),e.add(a);const l=new d.Mesh(t,i);l.position.set(6.167,.857,7.803),l.rotation.set(0,.561,0),l.scale.set(3.927,6.285,3.687),e.add(l);const c=new d.Mesh(t,i);c.position.set(-2.017,.018,6.124),c.rotation.set(0,.333,0),c.scale.set(2.002,4.566,2.064),e.add(c);const h=new d.Mesh(t,i);h.position.set(2.291,-.756,-2.621),h.rotation.set(0,-.286,0),h.scale.set(1.546,1.552,1.496),e.add(h);const u=new d.Mesh(t,i);u.position.set(-2.193,-.369,-5.547),u.rotation.set(0,.516,0),u.scale.set(3.875,3.487,2.986),e.add(u);const p=new d.Mesh(t,y(50));p.position.set(-16.116,14.37,8.208),p.scale.set(.1,2.428,2.739),e.add(p);const m=new d.Mesh(t,y(50));m.position.set(-16.109,18.021,-8.207),m.scale.set(.1,2.425,2.751),e.add(m);const f=new d.Mesh(t,y(17));f.position.set(14.904,12.198,-1.832),f.scale.set(.15,4.265,6.331),e.add(f);const g=new d.Mesh(t,y(43));g.position.set(-.462,8.89,14.52),g.scale.set(4.38,5.441,.088),e.add(g);const v=new d.Mesh(t,y(20));v.position.set(3.235,11.486,-12.541),v.scale.set(2.5,2,.1),e.add(v);const x=new d.Mesh(t,y(100));function y(e){const t=new d.MeshBasicMaterial;return t.color.setScalar(e),t}return x.position.set(0,20,0),x.scale.set(1,.1,1),e.add(x),e},exports.RoughnessMipmapper=fo,exports.RoundedBoxGeometry=jc,exports.SAOPass=ll,exports.SAOShader=sl,exports.SMAABlendShader=ja,exports.SMAAEdgesShader=za,exports.SMAAPass=class extends Ia{constructor(t,r){super(),this.edgesRT=new e.WebGLRenderTarget(t,r,{depthBuffer:!1}),this.edgesRT.texture.name="SMAAPass.edges",this.weightsRT=new e.WebGLRenderTarget(t,r,{depthBuffer:!1}),this.weightsRT.texture.name="SMAAPass.weights";const i=this,n=new Image;n.src=this.getAreaTexture(),n.onload=function(){i.areaTexture.needsUpdate=!0},this.areaTexture=new e.Texture,this.areaTexture.name="SMAAPass.area",this.areaTexture.image=n,this.areaTexture.minFilter=e.LinearFilter,this.areaTexture.generateMipmaps=!1,this.areaTexture.flipY=!1;const s=new Image;s.src=this.getSearchTexture(),s.onload=function(){i.searchTexture.needsUpdate=!0},this.searchTexture=new e.Texture,this.searchTexture.name="SMAAPass.search",this.searchTexture.image=s,this.searchTexture.magFilter=e.NearestFilter,this.searchTexture.minFilter=e.NearestFilter,this.searchTexture.generateMipmaps=!1,this.searchTexture.flipY=!1,void 0===za&&console.error("THREE.SMAAPass relies on SMAAShader"),this.uniformsEdges=e.UniformsUtils.clone(za.uniforms),this.uniformsEdges.resolution.value.set(1/t,1/r),this.materialEdges=new e.ShaderMaterial({defines:Object.assign({},za.defines),uniforms:this.uniformsEdges,vertexShader:za.vertexShader,fragmentShader:za.fragmentShader}),this.uniformsWeights=e.UniformsUtils.clone(Ha.uniforms),this.uniformsWeights.resolution.value.set(1/t,1/r),this.uniformsWeights.tDiffuse.value=this.edgesRT.texture,this.uniformsWeights.tArea.value=this.areaTexture,this.uniformsWeights.tSearch.value=this.searchTexture,this.materialWeights=new e.ShaderMaterial({defines:Object.assign({},Ha.defines),uniforms:this.uniformsWeights,vertexShader:Ha.vertexShader,fragmentShader:Ha.fragmentShader}),this.uniformsBlend=e.UniformsUtils.clone(ja.uniforms),this.uniformsBlend.resolution.value.set(1/t,1/r),this.uniformsBlend.tDiffuse.value=this.weightsRT.texture,this.materialBlend=new e.ShaderMaterial({uniforms:this.uniformsBlend,vertexShader:ja.vertexShader,fragmentShader:ja.fragmentShader}),this.needsSwap=!1,this.fsQuad=new Ua(null)}render(e,t,r){this.uniformsEdges.tDiffuse.value=r.texture,this.fsQuad.material=this.materialEdges,e.setRenderTarget(this.edgesRT),this.clear&&e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.materialWeights,e.setRenderTarget(this.weightsRT),this.clear&&e.clear(),this.fsQuad.render(e),this.uniformsBlend.tColor.value=r.texture,this.fsQuad.material=this.materialBlend,this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(),this.fsQuad.render(e))}setSize(e,t){this.edgesRT.setSize(e,t),this.weightsRT.setSize(e,t),this.materialEdges.uniforms.resolution.value.set(1/e,1/t),this.materialWeights.uniforms.resolution.value.set(1/e,1/t),this.materialBlend.uniforms.resolution.value.set(1/e,1/t)}getAreaTexture(){return"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKAAAAIwCAIAAACOVPcQAACBeklEQVR42u39W4xlWXrnh/3WWvuciIzMrKxrV8/0rWbY0+SQFKcb4owIkSIFCjY9AC1BT/LYBozRi+EX+cV+8IMsYAaCwRcBwjzMiw2jAWtgwC8WR5Q8mDFHZLNHTarZGrLJJllt1W2qKrsumZWZcTvn7L3W54e1vrXX3vuciLPPORFR1XE2EomorB0nVuz//r71re/y/1eMvb4Cb3N11xV/PP/2v4UBAwJG/7H8urx6/25/Gf8O5hypMQ0EEEQwAqLfoN/Z+97f/SW+/NvcgQk4sGBJK6H7N4PFVL+K+e0N11yNfkKvwUdwdlUAXPHHL38oa15f/i/46Ih6SuMSPmLAYAwyRKn7dfMGH97jaMFBYCJUgotIC2YAdu+LyW9vvubxAP8kAL8H/koAuOKP3+q6+xGnd5kdYCeECnGIJViwGJMAkQKfDvB3WZxjLKGh8VSCCzhwEWBpMc5/kBbjawT4HnwJfhr+pPBIu7uu+OOTo9vsmtQcniMBGkKFd4jDWMSCRUpLjJYNJkM+IRzQ+PQvIeAMTrBS2LEiaiR9b/5PuT6Ap/AcfAFO4Y3dA3DFH7/VS+M8k4baEAQfMI4QfbVDDGIRg7GKaIY52qAjTAgTvGBAPGIIghOCYAUrGFNgzA7Q3QhgCwfwAnwe5vDejgG44o/fbm1C5ZlYQvQDARPAIQGxCWBM+wWl37ZQESb4gImexGMDouhGLx1Cst0Saa4b4AqO4Hk4gxo+3DHAV/nx27p3JziPM2pVgoiia5MdEzCGULprIN7gEEeQ5IQxEBBBQnxhsDb5auGmAAYcHMA9eAAz8PBol8/xij9+C4Djlim4gJjWcwZBhCBgMIIYxGAVIkH3ZtcBuLdtRFMWsPGoY9rN+HoBji9VBYdwD2ZQg4cnO7OSq/z4rU5KKdwVbFAjNojCQzTlCLPFSxtamwh2jMUcEgg2Wm/6XgErIBhBckQtGN3CzbVacERgCnfgLswhnvqf7QyAq/z4rRZm1YglYE3affGITaZsdIe2FmMIpnOCap25I6jt2kCwCW0D1uAD9sZctNGXcQIHCkINDQgc78aCr+zjtw3BU/ijdpw3zhCwcaONwBvdeS2YZKkJNJsMPf2JKEvC28RXxxI0ASJyzQCjCEQrO4Q7sFArEzjZhaFc4cdv+/JFdKULM4px0DfUBI2hIsy06BqLhGTQEVdbfAIZXYMPesq6VoCHICzUyjwInO4Y411//LYLs6TDa9wvg2CC2rElgAnpTBziThxaL22MYhzfkghz6GAs2VHbbdM91VZu1MEEpupMMwKyVTb5ij9+u4VJG/5EgEMMmFF01cFai3isRbKbzb+YaU/MQbAm2XSMoUPAmvZzbuKYRIFApbtlrfFuUGd6vq2hXNnH78ZLh/iFhsQG3T4D1ib7k5CC6vY0DCbtrohgLEIClXiGtl10zc0CnEGIhhatLBva7NP58Tvw0qE8yWhARLQ8h4+AhQSP+I4F5xoU+VilGRJs6wnS7ruti/4KvAY/CfdgqjsMy4pf8fodQO8/gnuX3f/3xi3om1/h7THr+co3x93PP9+FBUfbNUjcjEmhcrkT+8K7ml7V10Jo05mpIEFy1NmCJWx9SIKKt+EjAL4Ez8EBVOB6havuT/rByPvHXK+9zUcfcbb254+9fydJknYnRr1oGfdaiAgpxu1Rx/Rek8KISftx3L+DfsLWAANn8Hvw0/AFeAGO9DFV3c6D+CcWbL8Dj9e7f+T1k8AZv/d7+PXWM/Z+VvdCrIvuAKO09RpEEQJM0Ci6+B4xhTWr4cZNOvhktabw0ta0rSJmqz3Yw5/AKXwenod7cAhTmBSPKf6JBdvH8IP17h95pXqw50/+BFnj88fev4NchyaK47OPhhtI8RFSvAfDSNh0Ck0p2gLxGkib5NJj/JWCr90EWQJvwBzO4AHcgztwAFN1evHPUVGwfXON+0debT1YeGON9Yy9/63X+OguiwmhIhQhD7l4sMqlG3D86Suc3qWZ4rWjI1X7u0Ytw6x3rIMeIOPDprfe2XzNgyj6PahhBjO4C3e6puDgXrdg+/5l948vF3bqwZetZ+z9Rx9zdIY5pInPK4Nk0t+l52xdK2B45Qd87nM8fsD5EfUhIcJcERw4RdqqH7Yde5V7m1vhNmtedkz6EDzUMF/2jJYWbC+4fzzA/Y+/8PPH3j9dcBAPIRP8JLXd5BpAu03aziOL3VVHZzz3CXWDPWd+SH2AnxIqQoTZpo9Ckc6HIrFbAbzNmlcg8Ag8NFDDAhbJvTBZXbC94P7t68EXfv6o+21gUtPETU7bbkLxvNKRFG2+KXzvtObonPP4rBvsgmaKj404DlshFole1Glfh02fE7bYR7dZ82oTewIBGn1Md6CG6YUF26X376oevOLzx95vhUmgblI6LBZwTCDY7vMq0op5WVXgsObOXJ+1x3qaBl9j1FeLxbhU9w1F+Wiba6s1X/TBz1LnUfuYDi4r2C69f1f14BWfP+p+W2GFKuC9phcELMYRRLur9DEZTUdEH+iEqWdaM7X4WOoPGI+ZYD2+wcQ+y+ioHUZ9dTDbArzxmi/bJI9BND0Ynd6lBdve/butBw8+f/T9D3ABa3AG8W3VPX4hBin+bj8dMMmSpp5pg7fJ6xrBFE2WQQEWnV8Qg3FbAWzYfM1rREEnmvkN2o1+acG2d/9u68GDzx91v3mAjb1zkpqT21OipPKO0b9TO5W0nTdOmAQm0TObts3aBKgwARtoPDiCT0gHgwnbArzxmtcLc08HgF1asN0C4Ms/fvD5I+7PhfqyXE/b7RbbrGyRQRT9ARZcwAUmgdoz0ehJ9Fn7QAhUjhDAQSw0bV3T3WbNa59jzmiP6GsWbGXDX2ytjy8+f9T97fiBPq9YeLdBmyuizZHaqXITnXiMUEEVcJ7K4j3BFPurtB4bixW8wTpweL8DC95szWMOqucFYGsWbGU7p3TxxxefP+r+oTVktxY0v5hbq3KiOKYnY8ddJVSBxuMMVffNbxwIOERShst73HZ78DZrHpmJmH3K6sGz0fe3UUj0eyRrSCGTTc+rjVNoGzNSv05srAxUBh8IhqChiQgVNIIBH3AVPnrsnXQZbLTm8ammv8eVXn/vWpaTem5IXRlt+U/LA21zhSb9cye6jcOfCnOwhIAYXAMVTUNV0QhVha9xjgA27ODJbLbmitt3tRN80lqG6N/khgot4ZVlOyO4WNg3OIMzhIZQpUEHieg2im6F91hB3I2tubql6BYNN9Hj5S7G0G2tahslBWKDnOiIvuAEDzakDQKDNFQT6gbn8E2y4BBubM230YIpBnDbMa+y3dx0n1S0BtuG62lCCXwcY0F72T1VRR3t2ONcsmDjbmzNt9RFs2LO2hQNyb022JisaI8rAWuw4HI3FuAIhZdOGIcdjLJvvObqlpqvWTJnnQbyi/1M9O8UxWhBs//H42I0q1Yb/XPGONzcmm+ri172mHKvZBpHkJaNJz6v9jxqiklDj3U4CA2ugpAaYMWqNXsdXbmJNd9egCnJEsphXNM+MnK3m0FCJ5S1kmJpa3DgPVbnQnPGWIDspW9ozbcO4K/9LkfaQO2KHuqlfFXSbdNzcEcwoqNEFE9zcIXu9/6n/ym/BC/C3aJLzEKPuYVlbFnfhZ8kcWxV3dbv4bKl28566wD+8C53aw49lTABp9PWbsB+knfc/Li3eVizf5vv/xmvnPKg5ihwKEwlrcHqucuVcVOxEv8aH37E3ZqpZypUulrHEtIWKUr+txHg+ojZDGlwnqmkGlzcVi1dLiNSJiHjfbRNOPwKpx9TVdTn3K05DBx4psIk4Ei8aCkJahRgffk4YnEXe07T4H2RR1u27E6wfQsBDofUgjFUFnwC2AiVtA+05J2zpiDK2Oa0c5fmAecN1iJzmpqFZxqYBCYhFTCsUNEmUnIcZ6aEA5rQVhEywG6w7HSW02XfOoBlQmjwulOFQAg66SvJblrTEX1YtJ3uG15T/BH1OfOQeuR8g/c0gdpT5fx2SKbs9EfHTKdM8A1GaJRHLVIwhcGyydZsbifAFVKl5EMKNU2Hryo+06BeTgqnxzYjThVySDikbtJPieco75lYfKAJOMEZBTjoITuWHXXZVhcUDIS2hpiXHV9Ku4u44bN5OYLDOkJo8w+xJSMbhBRHEdEs9JZUCkQrPMAvaHyLkxgkEHxiNkx/x2YB0mGsQ8EUWj/stW5YLhtS5SMu+/YBbNPDCkGTUybN8krRLBGPlZkVOA0j+a1+rkyQKWGaPHPLZOkJhioQYnVZ2hS3zVxMtgC46KuRwbJNd9nV2PHgb36F194ecf/Yeu2vAFe5nm/bRBFrnY4BauE8ERmZRFUn0k8hbftiVYSKMEme2dJCJSCGYAlNqh87bXOPdUkGy24P6d1ll21MBqqx48Fvv8ZHH8HZFY7j/uAq1xMJUFqCSUlJPmNbIiNsmwuMs/q9CMtsZsFO6SprzCS1Z7QL8xCQClEelpjTduDMsmWD8S1PT152BtvmIGvUeDA/yRn83u/x0/4qxoPHjx+PXY9pqX9bgMvh/Nz9kpP4pOe1/fYf3axUiMdHLlPpZCNjgtNFAhcHEDxTumNONhHrBduW+vOyY++70WWnPXj98eA4kOt/mj/5E05l9+O4o8ePx67HFqyC+qSSnyselqjZGaVK2TadbFLPWAQ4NBhHqDCCV7OTpo34AlSSylPtIdd2AJZlyzYQrDJ5lcWGNceD80CunPLGGzsfD+7wRb95NevJI5docQ3tgCyr5bGnyaPRlmwNsFELViOOx9loebGNq2moDOKpHLVP5al2cymWHbkfzGXL7kfRl44H9wZy33tvt+PB/Xnf93e+nh5ZlU18wCiRUa9m7kib9LYuOk+hudQNbxwm0AQqbfloimaB2lM5fChex+ylMwuTbfmXQtmWlenZljbdXTLuOxjI/fDDHY4Hjx8/Hrse0zXfPFxbUN1kKqSCCSk50m0Ajtx3ub9XHBKHXESb8iO6E+qGytF4nO0OG3SXzbJlhxBnKtKyl0NwybjvYCD30aMdjgePHz8eu56SVTBbgxJMliQ3Oauwg0QHxXE2Ez/EIReLdQj42Gzb4CLS0YJD9xUx7bsi0vJi5mUbW1QzL0h0PFk17rtiIPfJk52MB48fPx67npJJwyrBa2RCCQRTbGZSPCxTPOiND4G2pYyOQ4h4jINIJh5wFU1NFZt+IsZ59LSnDqBjZ2awbOku+yInunLcd8VA7rNnOxkPHj9+PGY9B0MWJJNozOJmlglvDMXDEozdhQWbgs/U6oBanGzLrdSNNnZFjOkmbi5bNt1lX7JLLhn3vXAg9/h4y/Hg8ePHI9dzQMEkWCgdRfYykYKnkP7D4rIujsujaKPBsB54vE2TS00ccvFY/Tth7JXeq1hz+qgVy04sAJawTsvOknHfCwdyT062HA8eP348Zj0vdoXF4pilKa2BROed+9fyw9rWRXeTFXESMOanvDZfJuJaSXouQdMdDJZtekZcLLvEeK04d8m474UDuaenW44Hjx8/Xns9YYqZpszGWB3AN/4VHw+k7WSFtJ3Qicuqb/NlVmgXWsxh570xg2UwxUw3WfO6B5nOuO8aA7lnZxuPB48fPx6znm1i4bsfcbaptF3zNT78eFPtwi1OaCNOqp1x3zUGcs/PN++AGD1+fMXrSVm2baTtPhPahbPhA71wIHd2bXzRa69nG+3CraTtPivahV/55tXWg8fyRY/9AdsY8VbSdp8V7cKrrgdfM//z6ILQFtJ2nxHtwmuoB4/kf74+gLeRtvvMaBdeSz34+vifx0YG20jbfTa0C6+tHrwe//NmOG0L8EbSdp8R7cLrrQe/996O+ai3ujQOskpTNULa7jOjXXj99eCd8lHvoFiwsbTdZ0a78PrrwTvlo966pLuRtB2fFe3Cm6oHP9kNH/W2FryxtN1nTLvwRurBO+Kj3pWXHidtx2dFu/Bm68Fb81HvykuPlrb7LGkX3mw9eGs+6h1Y8MbSdjegXcguQLjmevDpTQLMxtJ2N6NdyBZu9AbrwVvwUW+LbteULUpCdqm0HTelXbhNPe8G68Gb8lFvVfYfSNuxvrTdTWoXbozAzdaDZzfkorOj1oxVxlIMlpSIlpLrt8D4hrQL17z+c3h6hU/wv4Q/utps4+bm+6P/hIcf0JwQ5oQGPBL0eKPTYEXTW+eL/2DKn73J9BTXYANG57hz1cEMviVf/4tf5b/6C5pTQkMIWoAq7hTpOJjtAM4pxKu5vg5vXeUrtI09/Mo/5H+4z+Mp5xULh7cEm2QbRP2tFIKR7WM3fPf/jZ3SWCqLM2l4NxID5zB72HQXv3jj/8mLR5xXNA5v8EbFQEz7PpRfl1+MB/hlAN65qgDn3wTgH13hK7T59bmP+NIx1SHHU84nLOITt3iVz8mNO+lPrjGAnBFqmioNn1mTyk1ta47R6d4MrX7tjrnjYUpdUbv2rVr6YpVfsGG58AG8Ah9eyUN8CX4WfgV+G8LVWPDGb+Zd4cU584CtqSbMKxauxTg+dyn/LkVgA+IR8KHtejeFKRtTmLLpxN6mYVLjYxwXf5x2VofiZcp/lwKk4wGOpYDnoIZPdg/AAbwMfx0+ge9dgZvYjuqKe4HnGnykYo5TvJbG0Vj12JagRhwKa44H95ShkZa5RyLGGdfYvG7aw1TsF6iapPAS29mNS3NmsTQZCmgTzFwgL3upCTgtBTRwvGMAKrgLn4evwin8+afJRcff+8izUGUM63GOOuAs3tJkw7J4kyoNreqrpO6cYLQeFUd7TTpr5YOTLc9RUUogUOVJQ1GYJaFLAW0oTmKyYS46ZooP4S4EON3xQ5zC8/CX4CnM4c1PE8ApexpoYuzqlP3d4S3OJP8ZDK7cKWNaTlqmgDiiHwl1YsE41w1zT4iRTm3DBqxvOUsbMKKDa/EHxagtnta072ejc3DOIh5ojvh8l3tk1JF/AV6FU6jh3U8HwEazLgdCLYSQ+MYiAI2ltomkzttUb0gGHdSUUgsIYjTzLG3mObX4FBRaYtpDVNZrih9TgTeYOBxsEnN1gOCTM8Bsw/ieMc75w9kuAT6A+/AiHGvN/+Gn4KRkiuzpNNDYhDGFndWRpE6SVfm8U5bxnSgVV2jrg6JCKmneqey8VMFgq2+AM/i4L4RUbfSi27lNXZ7R7W9RTcq/q9fk4Xw3AMQd4I5ifAZz8FcVtm9SAom/dyN4lczJQW/kC42ZrHgcCoIf1oVMKkVItmMBi9cOeNHGLqOZk+QqQmrbc5YmYgxELUUN35z2iohstgfLIFmcMV7s4CFmI74L9+EFmGsi+tGnAOD4Yk9gIpo01Y4cA43BWGygMdr4YZekG3OBIUXXNukvJS8tqa06e+lSDCtnqqMFu6hWHXCF+WaYt64m9QBmNxi7Ioy7D+fa1yHw+FMAcPt7SysFLtoG4PXAk7JOA3aAxBRqUiAdU9Yp5lK3HLSRFtOim0sa8euEt08xvKjYjzeJ2GU7YawexrnKI9tmobInjFXCewpwriY9+RR4aaezFhMhGCppKwom0ChrgFlKzyPKkGlTW1YQrE9HJqu8hKGgMc6hVi5QRq0PZxNfrYNgE64utmRv6KKHRpxf6VDUaOvNP5jCEx5q185My/7RKz69UQu2im5k4/eownpxZxNLwiZ1AZTO2ZjWjkU9uaB2HFn6Q3u0JcsSx/qV9hTEApRzeBLDJQXxYmTnq7bdLa3+uqFrxLJ5w1TehnNHx5ECvCh2g2c3hHH5YsfdaSKddztfjQ6imKFGSyFwlLzxEGPp6r5IevVjk1AMx3wMqi1NxDVjLBiPs9tbsCkIY5we5/ML22zrCScFxnNtzsr9Wcc3CnD+pYO+4VXXiDE0oc/vQQ/fDK3oPESJMYXNmJa/DuloJZkcTpcYE8lIH8Dz8DJMiynNC86Mb2lNaaqP/+L7f2fcE/yP7/Lde8xfgSOdMxvOixZf/9p3+M4hT1+F+zApxg9XfUvYjc8qX2lfOOpK2gNRtB4flpFu9FTKCp2XJRgXnX6olp1zyYjTKJSkGmLE2NjUr1bxFM4AeAAHBUFIeSLqXR+NvH/M9fOnfHzOD2vCSyQJKzfgsCh+yi/Mmc35F2fUrw7miW33W9hBD1vpuUojFphIyvg7aTeoymDkIkeW3XLHmguMzbIAJejN6B5MDrhipE2y6SoFRO/AK/AcHHZHNIfiWrEe/C6cr3f/yOvrQKB+zMM55/GQdLDsR+ifr5Fiuu+/y+M78LzOE5dsNuXC3PYvYWd8NXvphLSkJIasrlD2/HOqQ+RjcRdjKTGWYhhVUm4yxlyiGPuMsZR7sMCHUBeTuNWA7if+ifXgc/hovftHXs/DV+Fvwe+f8shzMiMcweFgBly3//vwJfg5AN4450fn1Hd1Rm1aBLu22Dy3y3H2+OqMemkbGZ4jozcDjJf6596xOLpC0eMTHbKnxLxH27uZ/bMTGs2jOaMOY4m87CfQwF0dw53oa1k80JRuz/XgS+8fX3N9Af4qPIMfzKgCp4H5TDGe9GGeFPzSsZz80SlPTxXjgwJmC45njzgt2vbQ4b4OAdUK4/vWhO8d8v6EE8fMUsfakXbPpFJeLs2ubM/qdm/la3WP91uWhxXHjoWhyRUq2iJ/+5mA73zwIIo+LoZ/SgvIRjAd1IMvvn98PfgOvAJfhhm8scAKVWDuaRaK8aQ9f7vuPDH6Bj47ZXau7rqYJ66mTDwEDU6lLbCjCK0qTXyl5mnDoeNRxanj3FJbaksTk0faXxHxLrssgPkWB9LnA/MFleXcJozzjwsUvUG0X/QCve51qkMDXp9mtcyOy3rwBfdvVJK7D6/ACSzg3RoruIq5UDeESfEmVclDxnniU82vxMLtceD0hGZWzBNPMM/jSPne2OVatiTKUpY5vY7gc0LdUAWeWM5tH+O2I66AOWw9xT2BuyRVLGdoDHUsVRXOo/c+ZdRXvFfnxWyIV4upFLCl9eAL7h8Zv0QH8Ry8pA2cHzQpGesctVA37ZtklBTgHjyvdSeKY/RZw/kJMk0Y25cSNRWSigQtlULPTw+kzuJPeYEkXjQRpoGZobYsLF79pyd1dMRHInbgFTZqNLhDqiIsTNpoex2WLcy0/X6rHcdMMQvFSd5dWA++4P7xv89deACnmr36uGlL69bRCL6BSZsS6c0TU2TKK5gtWCzgAOOwQcurqk9j8whvziZSMLcq5hbuwBEsYjopUBkqw1yYBGpLA97SRElEmx5MCInBY5vgLk94iKqSWmhIGmkJ4Bi9m4L645J68LyY4wsFYBfUg5feP/6gWWm58IEmKQM89hq7KsZNaKtP5TxxrUZZVkNmMJtjbKrGxLNEbHPJxhqy7lAmbC32ZqeF6lTaknRWcYaFpfLUBh/rwaQycCCJmW15Kstv6jRHyJFry2C1ahkkIW0LO75s61+owxK1y3XqweX9m5YLM2DPFeOjn/iiqCKJ+yKXF8t5Yl/kNsqaSCryxPq5xWTFIaP8KSW0RYxqupaUf0RcTNSSdJZGcKYdYA6kdtrtmyBckfKXwqk0pHpUHlwWaffjNRBYFPUDWa8e3Lt/o0R0CdisKDM89cX0pvRHEfM8ca4t0s2Xx4kgo91MPQJ/0c9MQYq0co8MBh7bz1fio0UUHLR4aAIOvOmoYO6kwlEVODSSTliWtOtH6sPkrtctF9ZtJ9GIerBskvhdVS5cFNv9s1BU0AbdUgdK4FG+dRnjFmDTzniRMdZO1QhzMK355vigbdkpz9P6qjUGE5J2qAcXmwJ20cZUiAD0z+pGMx6xkzJkmEf40Hr4qZfVg2XzF9YOyoV5BjzVkUJngKf8lgNYwKECEHrCNDrWZzMlflS3yBhr/InyoUgBc/lKT4pxVrrC6g1YwcceK3BmNxZcAtz3j5EIpqguh9H6wc011YN75cKDLpFDxuwkrPQmUwW4KTbj9mZTwBwLq4aQMUZbHm1rylJ46dzR0dua2n3RYCWZsiHROeywyJGR7mXKlpryyCiouY56sFkBWEnkEB/raeh/Sw4162KeuAxMQpEkzy5alMY5wamMsWKKrtW2WpEWNnReZWONKWjrdsKZarpFjqCslq773PLmEhM448Pc3+FKr1+94vv/rfw4tEcu+lKTBe4kZSdijBrykwv9vbCMPcLQTygBjzVckSLPRVGslqdunwJ4oegtFOYb4SwxNgWLCmD7T9kVjTv5YDgpo0XBmN34Z/rEHp0sgyz7lngsrm4lvMm2Mr1zNOJYJ5cuxuQxwMGJq/TP5emlb8fsQBZviK4t8hFL+zbhtlpwaRSxQRWfeETjuauPsdGxsBVdO7nmP4xvzSoT29pRl7kGqz+k26B3Oy0YNV+SXbbQas1ctC/GarskRdFpKczVAF1ZXnLcpaMuzVe6lZ2g/1ndcvOVgRG3sdUAY1bKD6achijMPdMxV4muKVorSpiDHituH7rSTs7n/4y5DhRXo4FVBN4vO/zbAcxhENzGbHCzU/98Mcx5e7a31kWjw9FCe/zNeYyQjZsWb1uc7U33pN4Mji6hCLhivqfa9Ss6xLg031AgfesA/l99m9fgvnaF9JoE6bYKmkGNK3aPbHB96w3+DnxFm4hs0drLsk7U8kf/N/CvwQNtllna0rjq61sH8L80HAuvwH1tvBy2ChqWSCaYTaGN19sTvlfzFD6n+iKTbvtayfrfe9ueWh6GJFoxLdr7V72a5ZpvHcCPDzma0wTO4EgbLyedxstO81n57LYBOBzyfsOhUKsW1J1BB5vr/tz8RyqOFylQP9Tvst2JALsC5lsH8PyQ40DV4ANzYa4dedNiKNR1s+x2wwbR7q4/4cTxqEk4LWDebfisuo36JXLiWFjOtLrlNWh3K1rRS4xvHcDNlFnNmWBBAl5SWaL3oPOfnvbr5pdjVnEaeBJSYjuLEkyLLsWhKccadmOphZkOPgVdalj2QpSmfOsADhMWE2ZBu4+EEJI4wKTAuCoC4xwQbWXBltpxbjkXJtKxxabo9e7tyhlgb6gNlSbUpMh+l/FaqzVwewGu8BW1Zx7pTpQDJUjb8tsUTW6+GDXbMn3mLbXlXJiGdggxFAoUrtPS3wE4Nk02UZG2OOzlk7fRs7i95QCLo3E0jtrjnM7SR3uS1p4qtS2nJ5OwtQVHgOvArLBFijZUV9QtSl8dAY5d0E0hM0w3HS2DpIeB6m/A1+HfhJcGUq4sOxH+x3f5+VO+Ds9rYNI7zPXOYWPrtf8bYMx6fuOAX5jzNR0PdsuON+X1f7EERxMJJoU6GkTEWBvVolVlb5lh3tKCg6Wx1IbaMDdJ+9sUCc5KC46hKGCk3IVOS4TCqdBNfUs7Kd4iXf2RjnT/LLysJy3XDcHLh/vde3x8DoGvwgsa67vBk91G5Pe/HbOe7xwym0NXbtiuuDkGO2IJDh9oQvJ4cY4vdoqLDuoH9Zl2F/ofsekn8lkuhIlhQcffUtSjytFyp++p6NiE7Rqx/lodgKVoceEp/CP4FfjrquZaTtj2AvH5K/ywpn7M34K/SsoYDAdIN448I1/0/wveW289T1/lX5xBzc8N5IaHr0XMOQdHsIkDuJFifj20pBm5jzwUv9e2FhwRsvhAbalCIuIw3bhJihY3p6nTFFIZgiSYjfTf3aXuOjmeGn4bPoGvwl+CFzTRczBIuHBEeImHc37/lGfwZR0cXzVDOvaKfNHvwe+suZ771K/y/XcBlsoN996JpBhoE2toYxOznNEOS5TJc6Id5GEXLjrWo+LEWGNpPDU4WAwsIRROu+1vM+0oW37z/MBN9kqHnSArwPfgFJ7Cq/Ai3Ie7g7ncmI09v8sjzw9mzOAEXoIHxURueaAce5V80f/DOuuZwHM8vsMb5wBzOFWM7wymTXPAEvm4vcFpZ2ut0VZRjkiP2MlmLd6DIpbGSiHOjdnUHN90hRYmhTnmvhzp1iKDNj+b7t5hi79lWGwQ+HN9RsfFMy0FXbEwhfuczKgCbyxYwBmcFhhvo/7a44v+i3XWcwDP86PzpGQYdWh7csP5dBvZ1jNzdxC8pBGuxqSW5vw40nBpj5JhMwvOzN0RWqERHMr4Lv1kWX84xLR830G3j6yqZ1a8UstTlW+qJPOZ+sZ7xZPKTJLhiNOAFd6tk+jrTH31ncLOxid8+nzRb128HhUcru/y0Wn6iT254YPC6FtVSIMoW2sk727AhvTtrWKZTvgsmckfXYZWeNRXx/3YQ2OUxLDrbHtN11IwrgXT6c8dATDwLniYwxzO4RzuQqTKSC5gAofMZ1QBK3zQ4JWobFbcvJm87FK+6JXrKahLn54m3p+McXzzYtP8VF/QpJuh1OwieElEoI1pRxPS09FBrkq2tWCU59+HdhNtTIqKm8EBrw2RTOEDpG3IKo2Y7mFdLm3ZeVjYwVw11o/oznceMve4CgMfNym/utA/d/ILMR7gpXzRy9eDsgLcgbs8O2Va1L0zzIdwGGemTBuwROHeoMShkUc7P+ISY3KH5ZZeWqO8mFTxQYeXTNuzvvK5FGPdQfuu00DwYFY9dyhctEt+OJDdnucfpmyhzUJzfsJjr29l8S0bXBfwRS9ZT26tmMIdZucch5ZboMz3Nio3nIOsYHCGoDT4kUA9MiXEp9Xsui1S8th/kbWIrMBxDGLodWUQIWcvnXy+9M23xPiSMOiRPqM+YMXkUN3gXFrZJwXGzUaMpJfyRS9ZT0lPe8TpScuRlbMHeUmlaKDoNuy62iWNTWNFYjoxFzuJs8oR+RhRx7O4SVNSXpa0ZJQ0K1LAHDQ+D9IepkMXpcsq5EVCvClBUIzDhDoyKwDw1Lc59GbTeORivugw1IcuaEOaGWdNm+Ps5fQ7/tm0DjMegq3yM3vb5j12qUId5UZD2oxDSEWOZMSqFl/W+5oynWDa/aI04tJRQ2eTXusg86SQVu/nwSYwpW6wLjlqIzwLuxGIvoAvul0PS+ZNz0/akp/pniO/8JDnGyaCkzbhl6YcqmK/69prxPqtpx2+Km9al9sjL+rwMgHw4jE/C8/HQ3m1vBuL1fldbzd8mOueVJ92syqdEY4KJjSCde3mcRw2TA6szxedn+zwhZMps0XrqEsiUjnC1hw0TELC2Ek7uAAdzcheXv1BYLagspxpzSAoZZUsIzIq35MnFQ9DOrlNB30jq3L4pkhccKUAA8/ocvN1Rzx9QyOtERs4CVsJRK/DF71kPYrxYsGsm6RMh4cps5g1DOmM54Ly1ii0Hd3Y/BMk8VWFgBVmhqrkJCPBHAolwZaWzLR9Vb7bcWdX9NyUYE+uB2BKfuaeBUcjDljbYVY4DdtsVWvzRZdWnyUzDpjNl1Du3aloAjVJTNDpcIOVVhrHFF66lLfJL1zJr9PQ2nFJSBaKoDe+sAvLufZVHVzYh7W0h/c6AAZ+7Tvj6q9j68G/cTCS/3n1vLKHZwNi+P+pS0WkZNMBMUl+LDLuiE4omZy71r3UFMwNJV+VJ/GC5ixVUkBStsT4gGKh0Gm4Oy3qvq7Lbmq24nPdDuDR9deR11XzP4vFu3TYzfnIyiSVmgizUYGqkIXNdKTY9pgb9D2Ix5t0+NHkVzCdU03suWkkVZAoCONCn0T35gAeW38de43mf97sMOpSvj4aa1KYUm58USI7Wxxes03bAZdRzk6UtbzMaCQ6IxO0dy7X+XsjoD16hpsBeGz9dfzHj+R/Hp8nCxZRqkEDTaCKCSywjiaoMJ1TITE9eg7Jqnq8HL6gDwiZb0u0V0Rr/rmvqjxKuaLCX7ZWXTvAY+uvm3z8CP7nzVpngqrJpZKwWnCUjIviYVlirlGOzPLI3SMVyp/elvBUjjDkNhrtufFFErQ8pmdSlbK16toBHlt/HV8uHMX/vEGALkV3RJREiSlopxwdMXOZPLZ+ix+kAHpMKIk8UtE1ygtquttwxNhphrIZ1IBzjGF3IIGxGcBj6q8bHJBG8T9vdsoWrTFEuebEZuVxhhClH6P5Zo89OG9fwHNjtNQTpD0TG9PJLEYqvEY6Rlxy+ZZGfL0Aj62/bnQCXp//eeM4KzfQVJbgMQbUjlMFIm6TpcfWlZje7NBSV6IsEVmumWIbjiloUzQX9OzYdo8L1wjw2PrrpimONfmfNyzKklrgnEkSzT5QWYQW40YShyzqsRmMXbvVxKtGuYyMKaU1ugenLDm5Ily4iT14fP11Mx+xJv+zZ3MvnfdFqxU3a1W/FTB4m3Qfsyc1XUcdVhDeUDZXSFHHLQj/Y5jtC7ZqM0CXGwB4bP11i3LhOvzPGygYtiUBiwQV/4wFO0majijGsafHyRLu0yG6q35cL1rOpVxr2s5cM2jJYMCdc10Aj6q/blRpWJ//+dmm5psMl0KA2+AFRx9jMe2WbC4jQxnikd4DU8TwUjRVacgdlhmr3bpddzuJ9zXqr2xnxJfzP29RexdtjDVZqzkqa6PyvcojGrfkXiJ8SEtml/nYskicv0ivlxbqjemwUjMw5evdg8fUX9nOiC/lf94Q2i7MURk9nW1MSj5j8eAyV6y5CN2S6qbnw3vdA1Iwq+XOSCl663udN3IzLnrt+us25cI1+Z83SXQUldqQq0b5XOT17bGpLd6ssN1VMPf8c+jG8L3NeCnMdF+Ra3fRa9dft39/LuZ/3vwHoHrqGmQFafmiQw6eyzMxS05K4bL9uA+SKUQzCnSDkqOGokXyJvbgJ/BHI+qvY69//4rl20NsmK2ou2dTsyIALv/91/8n3P2Aao71WFGi8KKv1fRC5+J67Q/507/E/SOshqN5TsmYIjVt+kcjAx98iz/4SaojbIV1rexE7/C29HcYD/DX4a0rBOF5VTu7omsb11L/AWcVlcVZHSsqGuXLLp9ha8I//w3Mv+T4Ew7nTBsmgapoCrNFObIcN4pf/Ob/mrvHTGqqgAupL8qWjWPS9m/31jAe4DjA+4+uCoQoT/zOzlrNd3qd4SdphFxsUvYwGWbTWtISc3wNOWH+kHBMfc6kpmpwPgHWwqaSUG2ZWWheYOGQGaHB+eQ/kn6b3pOgLV+ODSn94wDvr8Bvb70/LLuiPPEr8OGVWfDmr45PZyccEmsVXZGe1pRNX9SU5+AVQkNTIVPCHF/jGmyDC9j4R9LfWcQvfiETmgMMUCMN1uNCakkweZsowdYobiMSlnKA93u7NzTXlSfe+SVbfnPQXmg9LpYAQxpwEtONyEyaueWM4FPjjyjG3uOaFmBTWDNgBXGEiQpsaWhnAqIijB07Dlsy3fUGeP989xbWkyf+FF2SNEtT1E0f4DYYVlxFlbaSMPIRMk/3iMU5pME2SIWJvjckciebkQuIRRyhUvkHg/iUljG5kzVog5hV7vIlCuBrmlhvgPfNHQM8lCf+FEGsYbMIBC0qC9a0uuy2wLXVbLBaP5kjHokCRxapkQyzI4QEcwgYHRZBp+XEFTqXFuNVzMtjXLJgX4gAid24Hjwc4N3dtVSe+NNiwTrzH4WVUOlDobUqr1FuAgYllc8pmzoVrELRHSIW8ViPxNy4xwjBpyR55I6J220qQTZYR4guvUICJiSpr9gFFle4RcF/OMB7BRiX8sSfhpNSO3lvEZCQfLUVTKT78Ek1LRLhWN+yLyTnp8qWUZ46b6vxdRGXfHVqx3eI75YaLa4iNNiK4NOW7wPW6lhbSOF9/M9qw8e/aoB3d156qTzxp8pXx5BKAsYSTOIIiPkp68GmTq7sZtvyzBQaRLNxIZ+paozHWoLFeExIhRBrWitHCAHrCF7/thhD8JhYz84wg93QRV88wLuLY8zF8sQ36qF1J455bOlgnELfshKVxYOXKVuKx0jaj22sczTQqPqtV/XDgpswmGTWWMSDw3ssyUunLLrVPGjYRsH5ggHeHSWiV8kT33ycFSfMgkoOK8apCye0J6VW6GOYvffgU9RWsukEi2kUV2nl4dOYUzRik9p7bcA4ggdJ53LxKcEe17B1R8eqAd7dOepV8sTXf5lhejoL85hUdhDdknPtKHFhljOT+bdq0hxbm35p2nc8+Ja1Iw+tJykgp0EWuAAZYwMVwac5KzYMslhvgHdHRrxKnvhTYcfKsxTxtTETkjHO7rr3zjoV25lAQHrqpV7bTiy2aXMmUhTBnKS91jhtR3GEoF0oLnWhWNnYgtcc4N0FxlcgT7yz3TgNIKkscx9jtV1ZKpWW+Ub1tc1eOv5ucdgpx+FJy9pgbLE7xDyXb/f+hLHVGeitHOi6A7ybo3sF8sS7w7cgdk0nJaOn3hLj3uyD0Zp5pazFIUXUpuTTU18d1EPkDoX8SkmWTnVIozEdbTcZjoqxhNHf1JrSS/AcvHjZ/SMHhL/7i5z+POsTUh/8BvNfYMTA8n+yU/MlTZxSJDRStqvEuLQKWwDctMTQogUDyQRoTQG5Kc6oQRE1yV1jCA7ri7jdZyK0sYTRjCR0Hnnd+y7nHxNgTULqw+8wj0mQKxpYvhjm9uSUxg+TTy7s2GtLUGcywhXSKZN275GsqlclX90J6bRI1aouxmgL7Q0Nen5ziM80SqMIo8cSOo+8XplT/5DHNWsSUr/6lLN/QQ3rDyzLruEW5enpf7KqZoShEduuSFOV7DLX7Ye+GmXb6/hnNNqKsVXuMDFpb9Y9eH3C6NGEzuOuI3gpMH/I6e+zDiH1fXi15t3vA1czsLws0TGEtmPEJdiiFPwlwKbgLHAFk4P6ZyPdymYYHGE0dutsChQBl2JcBFlrEkY/N5bQeXQ18gjunuMfMfsBlxJSx3niO485fwO4fGD5T/+3fPQqkneWVdwnw/3bMPkW9Wbqg+iC765Zk+xcT98ibKZc2EdgHcLoF8cSOo/Oc8fS+OyEULF4g4sJqXVcmfMfsc7A8v1/yfGXmL9I6Fn5pRwZhsPv0TxFNlAfZCvG+Oohi82UC5f/2IsJo0cTOm9YrDoKhFPEUr/LBYTUNht9zelHXDqwfPCIw4owp3mOcIQcLttWXFe3VZ/j5H3cIc0G6oPbCR+6Y2xF2EC5cGUm6wKC5tGEzhsWqw5hNidUiKX5gFWE1GXh4/Qplw4sVzOmx9QxU78g3EF6wnZlEN4FzJ1QPSLEZz1KfXC7vd8ssGdIbNUYpVx4UapyFUHzJoTOo1McSkeNn1M5MDQfs4qQuhhX5vQZFw8suwWTcyYTgioISk2YdmkhehG4PkE7w51inyAGGaU+uCXADabGzJR1fn3lwkty0asIo8cROm9Vy1g0yDxxtPvHDAmpu+PKnM8Ix1wwsGw91YJqhteaWgjYBmmQiebmSpwKKzE19hx7jkzSWOm66oPbzZ8Yj6kxVSpYjVAuvLzYMCRo3oTQecOOjjgi3NQ4l9K5/hOGhNTdcWVOTrlgYNkEXINbpCkBRyqhp+LdRB3g0OU6rMfW2HPCFFMV9nSp+uB2woepdbLBuJQyaw/ZFysXrlXwHxI0b0LovEkiOpXGA1Ijagf+KUNC6rKNa9bQnLFqYNkEnMc1uJrg2u64ELPBHpkgWbmwKpJoDhMwNbbGzAp7Yg31wS2T5rGtzit59PrKhesWG550CZpHEzpv2NGRaxlNjbMqpmEIzygJqQfjypycs2pg2cS2RY9r8HUqkqdEgKTWtWTKoRvOBPDYBltja2SO0RGjy9UHtxwRjA11ujbKF+ti5cIR9eCnxUg6owidtyoU5tK4NLji5Q3HCtiyF2IqLGYsHViOXTXOYxucDqG0HyttqYAKqYo3KTY1ekyDXRAm2AWh9JmsVh/ccg9WJ2E8YjG201sPq5ULxxX8n3XLXuMInbft2mk80rRGjCGctJ8/GFdmEQ9Ug4FlE1ll1Y7jtiraqm5Fe04VV8lvSVBL8hiPrfFVd8+7QH3Qbu2ipTVi8cvSGivc9cj8yvH11YMHdNSERtuOslM97feYFOPKzGcsI4zW0YGAbTAOaxCnxdfiYUmVWslxiIblCeAYr9VYR1gM7GmoPrilunSxxeT3DN/2eBQ9H11+nk1adn6VK71+5+Jfct4/el10/7KBZfNryUunWSCPxPECk1rdOv1WVSrQmpC+Tl46YD3ikQYcpunSQgzVB2VHFhxHVGKDgMEY5GLlQnP7FMDzw7IacAWnO6sBr12u+XanW2AO0wQ8pknnFhsL7KYIqhkEPmEXFkwaN5KQphbkUmG72wgw7WSm9RiL9QT925hkjiVIIhphFS9HKI6/8QAjlpXqg9W2C0apyaVDwKQwrwLY3j6ADR13ZyUNByQXHQu6RY09Hu6zMqXRaNZGS/KEJs0cJEe9VH1QdvBSJv9h09eiRmy0V2uJcqHcShcdvbSNg5fxkenkVprXM9rDVnX24/y9MVtncvbKY706anNl3ASll9a43UiacVquXGhvq4s2FP62NGKfQLIQYu9q1WmdMfmUrDGt8eDS0cXozH/fjmUH6Jruvm50hBDSaEU/2Ru2LEN/dl006TSc/g7tfJERxGMsgDUEr104pfWH9lQaN+M4KWQjwZbVc2rZVNHsyHal23wZtIs2JJqtIc/WLXXRFCpJkfE9jvWlfFbsNQ9pP5ZBS0zKh4R0aMFj1IjTcTnvi0Zz2rt7NdvQb2mgbju1plsH8MmbnEk7KbK0b+wC2iy3aX3szW8xeZvDwET6hWZYwqTXSSG+wMETKum0Dq/q+x62gt2ua2ppAo309TRk9TPazfV3qL9H8z7uhGqGqxNVg/FKx0HBl9OVUORn8Q8Jx9gFttGQUDr3tzcXX9xGgN0EpzN9mdZ3GATtPhL+CjxFDmkeEU6x56kqZRusLzALXVqkCN7zMEcqwjmywDQ6OhyUe0Xao1Qpyncrg6wKp9XfWDsaZplElvQ/b3sdweeghorwBDlHzgk1JmMc/wiERICVy2VJFdMjFuLQSp3S0W3+sngt2njwNgLssFGVQdJ0tu0KH4ky1LW4yrbkuaA6Iy9oz/qEMMXMMDWyIHhsAyFZc2peV9hc7kiKvfULxCl9iddfRK1f8kk9qvbdOoBtOg7ZkOZ5MsGrSHsokgLXUp9y88smniwWyuFSIRVmjplga3yD8Uij5QS1ZiM4U3Qw5QlSm2bXjFe6jzzBFtpg+/YBbLAWG7OPynNjlCw65fukGNdkJRf7yM1fOxVzbxOJVocFoYIaGwH22mIQkrvu1E2nGuebxIgW9U9TSiukPGU+Lt++c3DJPKhyhEEbXCQLUpae2exiKy6tMPe9mDRBFCEMTWrtwxN8qvuGnt6MoihKWS5NSyBhbH8StXoAz8PLOrRgLtOT/+4vcu+7vDLnqNvztOq7fmd8sMmY9Xzn1zj8Dq8+XVdu2Nv0IIySgEdQo3xVHps3Q5i3fLFsV4aiqzAiBhbgMDEd1uh8qZZ+lwhjkgokkOIv4xNJmyncdfUUzgB4oFMBtiu71Xumpz/P+cfUP+SlwFExwWW62r7b+LSPxqxn/gvMZ5z9C16t15UbNlq+jbGJtco7p8wbYlL4alSyfWdeuu0j7JA3JFNuVAwtst7F7FhWBbPFNKIUORndWtLraFLmMu7KFVDDOzqkeaiN33YAW/r76wR4XDN/yN1z7hejPau06EddkS/6XThfcz1fI/4K736fO48vlxt2PXJYFaeUkFS8U15XE3428xdtn2kc8GQlf1vkIaNRRnOMvLTWrZbElEHeLWi1o0dlKPAh1MVgbbVquPJ5+Cr8LU5/H/+I2QlHIU2ClXM9G8v7Rr7oc/hozfUUgsPnb3D+I+7WF8kNO92GY0SNvuxiE+2Bt8prVJTkzE64sfOstxuwfxUUoyk8VjcTlsqe2qITSFoSj6Epd4KsT6BZOWmtgE3hBfir8IzZDwgV4ZTZvD8VvPHERo8v+vL1DASHTz/i9OlKueHDjK5Rnx/JB1Vb1ioXdBra16dmt7dgik10yA/FwJSVY6XjA3oy4SqM2frqDPPSRMex9qs3XQtoWxMj7/Er8GWYsXgjaVz4OYumP2+9kbxvny/6kvWsEBw+fcb5bInc8APdhpOSs01tEqIkoiZjbAqKMruLbJYddHuHFRIyJcbdEdbl2sVLaySygunutBg96Y2/JjKRCdyHV+AEFtTvIpbKIXOamknYSiB6KV/0JetZITgcjjk5ZdaskBtWO86UF0ap6ozGXJk2WNiRUlCPFir66lzdm/SLSuK7EUdPz8f1z29Skq6F1fXg8+5UVR6bszncP4Tn4KUkkdJ8UFCY1zR1i8RmL/qQL3rlei4THG7OODlnKko4oI01kd3CaM08Ia18kC3GNoVaO9iDh+hWxSyTXFABXoau7Q6q9OxYg/OVEMw6jdbtSrJ9cBcewGmaZmg+bvkUnUUaGr+ZfnMH45Ivevl61hMcXsxYLFTu1hTm2zViCp7u0o5l+2PSUh9bDj6FgYypufBDhqK2+oXkiuHFHR3zfj+9PtA8oR0xnqX8qn+sx3bFODSbbF0X8EUvWQ8jBIcjo5bRmLOljDNtcqNtOe756h3l0VhKa9hDd2l1eqmsnh0MNMT/Cqnx6BInumhLT8luljzQ53RiJeA/0dxe5NK0o2fA1+GLXr6eNQWHNUOJssQaTRlGpLHKL9fD+IrQzTOMZS9fNQD4AnRNVxvTdjC+fJdcDDWQcyB00B0t9BDwTxXgaAfzDZ/DBXzRnfWMFRwuNqocOmX6OKNkY63h5n/fFcB28McVHqnXZVI27K0i4rDLNE9lDKV/rT+udVbD8dFFu2GGZ8mOt0kAXcoX3ZkIWVtw+MNf5NjR2FbivROHmhV1/pj2egv/fMGIOWTIWrV3Av8N9imV9IWml36H6cUjqEWNv9aNc+veb2sH46PRaHSuMBxvtW+twxctq0z+QsHhux8Q7rCY4Ct8lqsx7c6Sy0dl5T89rIeEuZKoVctIk1hNpfavER6yyH1Vvm3MbsUHy4ab4hWr/OZPcsRBphnaV65/ZcdYPNNwsjN/djlf9NqCw9U5ExCPcdhKxUgLSmfROpLp4WSUr8ojdwbncbvCf+a/YzRaEc6QOvXcGO256TXc5Lab9POvB+AWY7PigWYjzhifbovuunzRawsO24ZqQQAqguBtmpmPB7ysXJfyDDaV/aPGillgz1MdQg4u5MYaEtBNNHFjkRlSpd65lp4hd2AVPTfbV7FGpyIOfmNc/XVsPfg7vzaS/3nkvLL593ANLvMuRMGpQIhiF7kUEW9QDpAUbTWYBcbp4WpacHHY1aacqQyjGZS9HI3yCBT9kUZJhVOD+zUDvEH9ddR11fzPcTDQ5TlgB0KwqdXSavk9BC0pKp0WmcuowSw07VXmXC5guzSa4p0UvRw2lbDiYUx0ExJJRzWzi6Gm8cnEkfXXsdcG/M/jAJa0+bmCgdmQ9CYlNlSYZOKixmRsgiFxkrmW4l3KdFKv1DM8tk6WxPYJZhUUzcd8Kdtgrw/gkfXXDT7+avmfVak32qhtkg6NVdUS5wgkru1YzIkSduTW1FDwVWV3JQVJVuieTc0y4iDpFwc7/BvSalvKdQM8sv662cevz/+8sQVnjVAT0W2wLllw1JiMhJRxgDjCjLQsOzSFSgZqx7lAW1JW0e03yAD3asC+GD3NbQhbe+mN5GXH1F83KDOM4n/e5JIuH4NpdQARrFPBVptUNcjj4cVMcFSRTE2NpR1LEYbYMmfWpXgP9KejaPsLUhuvLCsVXznAG9dfx9SR1ud/3hZdCLHb1GMdPqRJgqDmm76mHbvOXDtiO2QPUcKo/TWkQ0i2JFXpBoo7vij1i1Lp3ADAo+qvG3V0rM//vFnnTE4hxd5Ka/Cor5YEdsLVJyKtDgVoHgtW11pWSjolPNMnrlrVj9Fv2Qn60twMwKPqr+N/wvr8z5tZcDsDrv06tkqyzESM85Ycv6XBWA2birlNCXrI6VbD2lx2L0vQO0QVTVVLH4SE67fgsfVXv8n7sz7/85Z7cMtbE6f088wSaR4kCkCm10s6pKbJhfqiUNGLq+0gLWC6eUAZFPnLjwqtKd8EwGvWX59t7iPW4X/eAN1svgRVSY990YZg06BD1ohLMtyFTI4pKTJsS9xREq9EOaPWiO2gpms7397x6nQJkbh+Fz2q/rqRROX6/M8bJrqlVW4l6JEptKeUFuMYUbtCQ7CIttpGc6MY93x1r1vgAnRXvY5cvwWPqb9uWQm+lP95QxdNMeWhOq1x0Db55C7GcUv2ZUuN6n8iKzsvOxibC//Yfs9Na8r2Rlz02vXXDT57FP/zJi66/EJSmsJKa8QxnoqW3VLQ+jZVUtJwJ8PNX1NQCwfNgdhhHD9on7PdRdrdGPF28rJr1F+3LBdeyv+8yYfLoMYet1vX4upNAjVvwOUWnlNXJXlkzk5Il6kqeoiL0C07qno+/CYBXq/+utlnsz7/Mzvy0tmI4zm4ag23PRN3t/CWryoUVJGm+5+K8RJ0V8Hc88/XHUX/HfiAq7t+BH+x6v8t438enWmdJwFA6ZINriLGKv/95f8lT9/FnyA1NMVEvQyaXuu+gz36f/DD73E4pwqpLcvm/o0Vle78n//+L/NPvoefp1pTJye6e4A/D082FERa5/opeH9zpvh13cNm19/4v/LDe5xMWTi8I0Ta0qKlK27AS/v3/r+/x/2GO9K2c7kVMonDpq7//jc5PKCxeNPpFVzaRr01wF8C4Pu76hXuX18H4LduTr79guuFD3n5BHfI+ZRFhY8w29TYhbbLi/bvBdqKE4fUgg1pBKnV3FEaCWOWyA+m3WpORZr/j+9TKJtW8yBTF2/ZEODI9/QavHkVdGFp/Pjn4Q+u5hXapsP5sOH+OXXA1LiKuqJxiMNbhTkbdJTCy4llEt6NnqRT4dhg1V3nbdrm6dYMecA1yTOL4PWTE9L5VzPFlLBCvlG58AhehnN4uHsAYinyJ+AZ/NkVvELbfOBUuOO5syBIEtiqHU1k9XeISX5bsimrkUUhnGDxourN8SgUsCZVtKyGbyGzHXdjOhsAvOAswSRyIBddRdEZWP6GZhNK/yjwew9ehBo+3jEADu7Ay2n8mDc+TS7awUHg0OMzR0LABhqLD4hJEh/BEGyBdGlSJoXYXtr+3HS4ijzVpgi0paWXtdruGTknXBz+11qT1Q2inxaTzQCO46P3lfLpyS4fou2PH/PupwZgCxNhGlj4IvUuWEsTkqMWm6i4xCSMc9N1RDQoCVcuGItJ/MRWefais+3synowi/dESgJjkilnWnBTGvRWmaw8oR15257t7CHmCf8HOn7cwI8+NQBXMBEmAa8PMRemrNCEhLGEhDQKcGZWS319BX9PFBEwGTbRBhLbDcaV3drFcDqk5kCTd2JF1Wp0HraqBx8U0wwBTnbpCadwBA/gTH/CDrcCs93LV8E0YlmmcyQRQnjBa8JESmGUfIjK/7fkaDJpmD2QptFNVJU1bbtIAjjWQizepOKptRjbzR9Kag6xZmMLLjHOtcLT3Tx9o/0EcTT1XN3E45u24AiwEypDJXihKjQxjLprEwcmRKclaDNZCVqr/V8mYWyFADbusiY5hvgFoU2vio49RgJLn5OsReRFN6tabeetiiy0V7KFHT3HyZLx491u95sn4K1QQSPKM9hNT0wMVvAWbzDSVdrKw4zRjZMyJIHkfq1VAVCDl/bUhNKlGq0zGr05+YAceXVPCttVk0oqjVwMPt+BBefx4yPtGVkUsqY3CHDPiCM5ngupUwCdbkpd8kbPrCWHhkmtIKLEetF2499eS1jZlIPGYnlcPXeM2KD9vLS0bW3ktYNqUllpKLn5ZrsxlIzxvDu5eHxzGLctkZLEY4PgSOg2IUVVcUONzUDBEpRaMoXNmUc0tFZrTZquiLyKxrSm3DvIW9Fil+AkhXu5PhEPx9mUNwqypDvZWdKlhIJQY7vn2OsnmBeOWnYZ0m1iwbbw1U60by5om47iHRV6fOgzjMf/DAZrlP40Z7syxpLK0lJ0gqaAK1c2KQKu7tabTXkLFz0sCftuwX++MyNeNn68k5Buq23YQhUh0SNTJa1ioQ0p4nUG2y0XilF1JqODqdImloPS4Bp111DEWT0jJjVv95uX9BBV7eB3bUWcu0acSVM23YZdd8R8UbQUxJ9wdu3oMuhdt929ME+mh6JXJ8di2RxbTi6TbrDquqV4aUKR2iwT6aZbyOwEXN3DUsWr8Hn4EhwNyHuXHh7/pdaUjtR7vnDh/d8c9xD/s5f501eQ1+CuDiCvGhk1AN/4Tf74RfxPwD3toLarR0zNtsnPzmS64KIRk861dMWCU8ArasG9T9H0ZBpsDGnjtAOM2+/LuIb2iIUGXNgl5ZmKD/Tw8TlaAuihaFP5yrw18v4x1898zIdP+DDAX1bM3GAMvPgRP/cJn3zCW013nrhHkrITyvYuwOUkcHuKlRSW5C6rzIdY4ppnF7J8aAJbQepgbJYBjCY9usGXDKQxq7RZfh9eg5d1UHMVATRaD/4BHK93/1iAgYZ/+jqPn8Dn4UExmWrpa3+ZOK6MvM3bjwfzxNWA2dhs8+51XHSPJiaAhGSpWevEs5xHLXcEGFXYiCONySH3fPWq93JIsBiSWvWyc3CAN+EcXoT7rCSANloPPoa31rt/5PUA/gp8Q/jDD3hyrjzlR8VkanfOvB1XPubt17vzxAfdSVbD1pzAnfgyF3ycadOTOTXhpEUoLC1HZyNGW3dtmjeXgr2r56JNmRwdNNWaQVBddd6rh4MhviEB9EFRD/7RGvePvCbwAL4Mx/D6M541hHO4D3e7g6PafdcZVw689z7NGTwo5om7A8sPhccT6qKcl9NJl9aM/9kX+e59Hh1yPqGuCCZxuITcsmNaJ5F7d0q6J3H48TO1/+M57085q2icdu2U+W36Ldllz9Agiv4YGljoEN908EzvDOrBF98/vtJwCC/BF2AG75xxEmjmMIcjxbjoaxqOK3/4hPOZzhMPBpYPG44CM0dTVm1LjLtUWWVz1Bcf8tEx0zs8O2A2YVHRxKYOiy/aOVoAaMu0i7ubu43njjmd4ibMHU1sIDHaQNKrZND/FZYdk54oCXetjq7E7IVl9eAL7t+oHnwXXtLx44czzoRFHBztYVwtH1d+NOMkupZ5MTM+gUmq90X+Bh9zjRlmaQ+m7YMqUL/veemcecAtOJ0yq1JnVlN27di2E0+Klp1tAJ4KRw1eMI7aJjsO3R8kPSI3fUFXnIOfdQe86sIIVtWDL7h//Ok6vj8vwDk08NEcI8zz7OhBy+WwalzZeZ4+0XniRfst9pAJqQHDGLzVQ2pheZnnv1OWhwO43/AgcvAEXEVVpa4db9sGvNK8wjaENHkfFQ4Ci5i7dqnQlPoLQrHXZDvO3BIXZbJOBrOaEbML6sFL798I4FhKihjHMsPjBUZYCMFr6nvaArxqXPn4lCa+cHfSa2cP27g3Z3ziYTRrcbQNGLQmGF3F3cBdzzzX7AILx0IB9rbwn9kx2G1FW3Inic+ZLIsVvKR8Zwfj0l1fkqo8LWY1M3IX14OX3r9RKTIO+d9XzAI8qRPGPn/4NC2n6o4rN8XJ82TOIvuVA8zLKUHRFgBCetlDZlqR1gLKjS39xoE7Bt8UvA6BxuEDjU3tFsEijgA+615tmZkXKqiEENrh41iLDDZNq4pKTWR3LZfnos81LOuNa15cD956vLMsJd1rqYp51gDUQqMYm2XsxnUhD2jg1DM7SeuJxxgrmpfISSXVIJIS5qJJSvJPEQ49DQTVIbYWJ9QWa/E2+c/oPK1drmC7WSfJRNKBO5Yjvcp7Gc3dmmI/Xh1kDTEuiSnWqQf37h+fTMhGnDf6dsS8SQfQWlqqwXXGlc/PEZ/SC5mtzIV0nAshlQdM/LvUtYutrEZ/Y+EAFtq1k28zQhOwLr1AIeANzhF8t9qzTdZf2qRKO6MWE9ohBYwibbOmrFtNmg3mcS+tB28xv2uKd/agYCvOP+GkSc+0lr7RXzyufL7QbkUpjLjEWFLqOIkAGu2B0tNlO9Eau2W1qcOUvVRgKzypKIQZ5KI3q0MLzqTNRYqiZOqmtqloIRlmkBHVpHmRYV6/HixbO6UC47KOFJnoMrVyr7wYz+SlW6GUaghYbY1I6kkxA2W1fSJokUdSh2LQ1GAimRGm0MT+uu57H5l7QgOWxERpO9moLRPgTtquWCfFlGlIjQaRly9odmzMOWY+IBO5tB4sW/0+VWGUh32qYk79EidWKrjWuiLpiVNGFWFRJVktyeXWmbgBBzVl8anPuXyNJlBJOlKLTgAbi/EYHVHxWiDaVR06GnHQNpJcWcK2jJtiCfG2sEHLzuI66sGrMK47nPIInPnu799935aOK2cvmvubrE38ZzZjrELCmXM2hM7UcpXD2oC3+ECVp7xtIuxptJ0jUr3sBmBS47TVxlvJ1Sqb/E0uLdvLj0lLr29ypdd/eMX3f6lrxGlKwKQxEGvw0qHbkbwrF3uHKwVENbIV2wZ13kNEF6zD+x24aLNMfDTCbDPnEikZFyTNttxWBXDaBuM8KtI2rmaMdUY7cXcUPstqTGvBGSrFWIpNMfbdea990bvAOC1YX0qbc6smDS1mPxSJoW4fwEXvjMmhlijDRq6qale6aJEuFGoppYDoBELQzLBuh/mZNx7jkinv0EtnUp50lO9hbNK57lZaMAWuWR5Yo9/kYwcYI0t4gWM47Umnl3YmpeBPqSyNp3K7s2DSAS/39KRuEN2bS4xvowV3dFRMx/VFcp2Yp8w2nTO9hCXtHG1kF1L4KlrJr2wKfyq77R7MKpFKzWlY9UkhYxyHWW6nBWPaudvEAl3CGcNpSXPZ6R9BbBtIl6cHL3gIBi+42CYXqCx1gfGWe7Ap0h3luyXdt1MKy4YUT9xSF01G16YEdWsouW9mgDHd3veyA97H+Ya47ZmEbqMY72oPztCGvK0onL44AvgC49saZKkWRz4veWljE1FHjbRJaWv6ZKKtl875h4CziFCZhG5rx7tefsl0aRT1bMHZjm8dwL/6u7wCRysaQblQoG5yAQN5zpatMNY/+yf8z+GLcH/Qn0iX2W2oEfXP4GvwQHuIL9AYGnaO3zqAX6946nkgqZNnUhx43DIdQtMFeOPrgy/y3Yd85HlJWwjLFkU3kFwq28xPnuPhMWeS+tDLV9Otllq7pQCf3uXJDN9wFDiUTgefHaiYbdfi3b3u8+iY6TnzhgehI1LTe8lcd7s1wJSzKbahCRxKKztTLXstGAiu3a6rPuQs5pk9TWAan5f0BZmGf7Ylxzzk/A7PAs4QPPPAHeFQ2hbFHszlgZuKZsJcUmbDC40sEU403cEjczstOEypa+YxevL4QBC8oRYqWdK6b7sK25tfE+oDZgtOQ2Jg8T41HGcBE6fTWHn4JtHcu9S7uYgU5KSCkl/mcnq+5/YBXOEr6lCUCwOTOM1taOI8mSxx1NsCXBEmLKbMAg5MkwbLmpBaFOPrNSlO2HnLiEqW3tHEwd8AeiQLmn+2gxjC3k6AxREqvKcJbTEzlpLiw4rNZK6oJdidbMMGX9FULKr0AkW+2qDEPBNNm5QAt2Ik2nftNWHetubosHLo2nG4vQA7GkcVCgVCgaDixHqo9UUn1A6OshapaNR/LPRYFV8siT1cCtJE0k/3WtaNSuUZYKPnsVIW0xXWnMUxq5+En4Kvw/MqQmVXnAXj9Z+9zM98zM/Agy7F/qqj2Nh67b8HjFnPP3iBn/tkpdzwEJX/whIcQUXOaikeliCRGUk7tiwF0rItwMEhjkZ309hikFoRAmLTpEXWuHS6y+am/KB/fM50aLEhGnSMwkpxzOov4H0AvgovwJ1iGzDLtJn/9BU+fAINfwUe6FHSLhu83viV/+/HrOePX+STT2B9uWGbrMHHLldRBlhS/CJQmcRxJFqZica01XixAZsYiH1uolZxLrR/SgxVIJjkpQP4PE9sE59LKLr7kltSBogS5tyszzH8Fvw8/AS8rNOg0xUS9fIaHwb+6et8Q/gyvKRjf5OusOzGx8evA/BP4IP11uN/grca5O0lcsPLJ5YjwI4QkJBOHa0WdMZYGxPbh2W2nR9v3WxEWqgp/G3+6VZbRLSAAZ3BhdhAaUL33VUSw9yjEsvbaQ9u4A/gGXwZXoEHOuU1GSj2chf+Mo+f8IcfcAxfIKVmyunRbYQVnoevwgfw3TXXcw++xNuP4fhyueEUNttEduRVaDttddoP0eSxLe2LENk6itYxlrxBNBYrNNKSQmeaLcm9c8UsaB5WyO6675yyQIAWSDpBVoA/gxmcwEvwoDv0m58UE7gHn+fJOa8/Ywan8EKRfjsopF83eCglX/Sfr7OeaRoQfvt1CGvIDccH5BCvw1sWIzRGC/66t0VTcLZQZtm6PlAasbOJ9iwWtUo7biktTSIPxnR24jxP1ZKaqq+2RcXM9OrBAm/AAs7hDJ5bNmGb+KIfwCs8a3jnjBrOFeMjHSCdbKr+2uOLfnOd9eiA8Hvvwwq54VbP2OqwkB48Ytc4YEOiH2vTXqodabfWEOzso4qxdbqD5L6tbtNPECqbhnA708DZH4QOJUXqScmUlks7Ot6FBuZw3n2mEbaUX7kDzxHOOQk8nKWMzAzu6ZZ8sOFw4RK+6PcuXo9tB4SbMz58ApfKDXf3szjNIIbGpD5TKTRxGkEMLjLl+K3wlWXBsCUxIDU+jbOiysESqAy1MGUJpXgwbTWzNOVEziIXZrJ+VIztl1PUBxTSo0dwn2bOmfDRPD3TRTGlfbCJvO9KvuhL1hMHhB9wPuPRLGHcdOWG2xc0U+5bQtAJT0nRTewXL1pgk2+rZAdeWmz3jxAqfNQQdzTlbF8uJ5ecEIWvTkevAHpwz7w78QujlD/Lr491bD8/1vhM2yrUQRrWXNQY4fGilfctMWYjL72UL/qS9eiA8EmN88nbNdour+PBbbAjOjIa4iBhfFg6rxeKdEGcL6p3EWR1Qq2Qkhs2DrnkRnmN9tG2EAqmgPw6hoL7Oza7B+3SCrR9tRftko+Lsf2F/mkTndN2LmzuMcKTuj/mX2+4Va3ki16+nnJY+S7MefpkidxwnV+4wkXH8TKnX0tsYzYp29DOOoSW1nf7nTh2akYiWmcJOuTidSaqESrTYpwjJJNVGQr+rLI7WsqerHW6Kp/oM2pKuV7T1QY9gjqlZp41/WfKpl56FV/0kvXQFRyeQ83xaTu5E8p5dNP3dUF34ihyI3GSpeCsywSh22ZJdWto9winhqifb7VRvgktxp13vyjrS0EjvrRfZ62uyqddSWaWYlwTPAtJZ2oZ3j/Sgi/mi+6vpzesfAcWNA0n8xVyw90GVFGuZjTXEQy+6GfLGLMLL523f5E0OmxVjDoOuRiH91RKU+vtoCtH7TgmvBLvtFXWLW15H9GTdVw8ow4IlRLeHECN9ym1e9K0I+Cbnhgv4Yu+aD2HaQJ80XDqOzSGAV4+4yCqBxrsJAX6ZTIoX36QnvzhhzzMfFW2dZVLOJfo0zbce5OvwXMFaZ81mOnlTVXpDZsQNuoYWveketKb5+6JOOsgX+NTm7H49fUTlx+WLuWL7qxnOFh4BxpmJx0p2gDzA/BUARuS6phR+pUsY7MMboAHx5xNsSVfVZcYSwqCKrqon7zM+8ecCkeS4nm3rINuaWvVNnMRI1IRpxTqx8PZUZ0Br/UEduo3B3hNvmgZfs9gQPj8vIOxd2kndir3awvJ6BLvoUuOfFWNYB0LR1OQJoUySKb9IlOBx74q1+ADC2G6rOdmFdJcD8BkfualA+BdjOOzP9uUhGUEX/TwhZsUduwRr8wNuXKurCixLBgpQI0mDbJr9dIqUuV+92ngkJZ7xduCk2yZKbfWrH1VBiTg9VdzsgRjW3CVXCvAwDd+c1z9dWw9+B+8MJL/eY15ZQ/HqvTwVdsZn5WQsgRRnMaWaecu3jFvMBEmgg+FJFZsnSl0zjB9OqPYaBD7qmoVyImFvzi41usesV0julaAR9dfR15Xzv9sEruRDyk1nb+QaLU67T885GTls6YgcY+UiMa25M/pwGrbCfzkvR3e0jjtuaFtnwuagHTSb5y7boBH119HXhvwP487jJLsLJ4XnUkHX5sLbS61dpiAXRoZSCrFJ+EjpeU3puVfitngYNo6PJrAigKktmwjyQdZpfq30mmtulaAx9Zfx15Xzv+cyeuiBFUs9zq8Kq+XB9a4PVvph3GV4E3y8HENJrN55H1X2p8VyqSKwVusJDKzXOZzplWdzBUFK9e+B4+uv468xvI/b5xtSAkBHQaPvtqWzllVvEOxPbuiE6+j2pvjcKsbvI7txnRErgfH7LdXqjq0IokKzga14GzQ23SSbCQvO6r+Or7SMIr/efOkkqSdMnj9mBx2DRsiY29Uj6+qK9ZrssCKaptR6HKURdwUYeUWA2kPzVKQO8ku2nU3Anhs/XWkBx3F/7wJtCTTTIKftthue1ty9xvNYLY/zo5KSbIuKbXpbEdSyeRyYdAIwKY2neyoc3+k1XUaufYga3T9daMUx/r8z1s10ITknIO0kuoMt+TB8jK0lpayqqjsJ2qtXAYwBU932zinimgmd6mTRDnQfr88q36NAI+tv24E8Pr8zxtasBqx0+xHH9HhlrwsxxNUfKOHQaZBITNf0uccj8GXiVmXAuPEAKSdN/4GLHhs/XWj92dN/uetNuBMnVR+XWDc25JLjo5Mg5IZIq226tmCsip2zZliL213YrTlL2hcFjpCduyim3M7/eB16q/blQsv5X/esDRbtJeabLIosWy3ycavwLhtxdWzbMmHiBTiVjJo6lCLjXZsi7p9PEPnsq6X6wd4bP11i0rD5fzPm/0A6brrIsllenZs0lCJlU4abakR59enZKrKe3BZihbTxlyZ2zl1+g0wvgmA166/bhwDrcn/7Ddz0eWZuJvfSESug6NzZsox3Z04FIxz0mUjMwVOOVTq1CQ0AhdbBGVdjG/CgsfUX7esJl3K/7ytWHRv683praW/8iDOCqWLLhpljDY1ZpzK75QiaZoOTpLKl60auHS/97oBXrv+umU9+FL+5+NtLFgjqVLCdbmj7pY5zPCPLOHNCwXGOcLquOhi8CmCWvbcuO73XmMUPab+ug3A6/A/78Bwe0bcS2+tgHn4J5pyS2WbOck0F51Vq3LcjhLvZ67p1ABbaL2H67bg78BfjKi/jr3+T/ABV3ilLmNXTI2SpvxWBtt6/Z//D0z/FXaGbSBgylzlsEGp+5//xrd4/ae4d8DUUjlslfIYS3t06HZpvfQtvv0N7AHWqtjP2pW08QD/FLy//da38vo8PNlKHf5y37Dxdfe/oj4kVIgFq3koLReSR76W/bx//n9k8jonZxzWTANVwEniDsg87sOSd/z7//PvMp3jQiptGVWFX2caezzAXwfgtzYUvbr0iozs32c3Uge7varH+CNE6cvEYmzbPZ9hMaYDdjK4V2iecf6EcEbdUDVUARda2KzO/JtCuDbNQB/iTeL0EG1JSO1jbXS+nLxtPMDPw1fh5+EPrgSEKE/8Gry5A73ui87AmxwdatyMEBCPNOCSKUeRZ2P6Myb5MRvgCHmA9ywsMifU+AYXcB6Xa5GibUC5TSyerxyh0j6QgLVpdyhfArRTTLqQjwe4HOD9s92D4Ap54odXAPBWLAwB02igG5Kkc+piN4lvODIFGAZgT+EO4Si1s7fjSR7vcQETUkRm9O+MXyo9OYhfe4xt9STQ2pcZRLayCV90b4D3jR0DYAfyxJ+eywg2IL7NTMXna7S/RpQ63JhWEM8U41ZyQGjwsVS0QBrEKLu8xwZsbi4wLcCT+OGidPIOCe1PiSc9Qt+go+vYqB7cG+B9d8cAD+WJPz0Am2gxXgU9IneOqDpAAXOsOltVuMzpdakJXrdPCzXiNVUpCeOos5cxnpQT39G+XVLhs1osQVvJKPZyNq8HDwd4d7pNDuWJPxVX7MSzqUDU6gfadKiNlUFTzLeFHHDlzO4kpa7aiKhBPGKwOqxsBAmYkOIpipyXcQSPlRTf+Tii0U3EJGaZsDER2qoB3h2hu0qe+NNwUooYU8y5mILbJe6OuX+2FTKy7bieTDAemaQyQ0CPthljSWO+xmFDIYiESjM5xKd6Ik5lvLq5GrQ3aCMLvmCA9wowLuWJb9xF59hVVP6O0CrBi3ZjZSNOvRy+I6klNVRJYRBaEzdN+imiUXQ8iVF8fsp+W4JXw7WISW7fDh7lptWkCwZ4d7QTXyBPfJMYK7SijjFppGnlIVJBJBYj7eUwtiP1IBXGI1XCsjNpbjENVpSAJ2hq2LTywEly3hUYazt31J8w2+aiLx3g3fohXixPfOMYm6zCGs9LVo9MoW3MCJE7R5u/WsOIjrqBoHUO0bJE9vxBpbhsd3+Nb4/vtPCZ4oZYCitNeYuC/8UDvDvy0qvkiW/cgqNqRyzqSZa/s0mqNGjtKOoTm14zZpUauiQgVfqtQiZjq7Q27JNaSK5ExRcrGCXO1FJYh6jR6CFqK7bZdQZ4t8g0rSlPfP1RdBtqaa9diqtzJkQ9duSryi2brQXbxDwbRUpFMBHjRj8+Nt7GDKgvph9okW7LX47gu0SpGnnFQ1S1lYldOsC7hYteR574ZuKs7Ei1lBsfdz7IZoxzzCVmmVqaSySzQbBVAWDek+N4jh9E/4VqZrJjPwiv9BC1XcvOWgO8275CVyBPvAtTVlDJfZkaZGU7NpqBogAj/xEHkeAuJihWYCxGN6e8+9JtSegFXF1TrhhLGP1fak3pebgPz192/8gB4d/6WT7+GdYnpH7hH/DJzzFiYPn/vjW0SgNpTNuPIZoAEZv8tlGw4+RLxy+ZjnKa5NdFoC7UaW0aduoYse6+bXg1DLg6UfRYwmhGEjqPvF75U558SANrElK/+MdpXvmqBpaXOa/MTZaa1DOcSiLaw9j0NNNst3c+63c7EKTpkvKHzu6bPbP0RkuHAVcbRY8ijP46MIbQeeT1mhA+5PV/inyDdQipf8LTvMXbwvoDy7IruDNVZKTfV4CTSRUYdybUCnGU7KUTDxLgCknqUm5aAW6/1p6eMsOYsphLzsHrE0Y/P5bQedx1F/4yPHnMB3/IOoTU9+BL8PhtjuFKBpZXnYNJxTuv+2XqolKR2UQgHhS5novuxVySJhBNRF3SoKK1XZbbXjVwWNyOjlqWJjrWJIy+P5bQedyldNScP+HZ61xKSK3jyrz+NiHG1hcOLL/+P+PDF2gOkekKGiNWKgJ+8Z/x8Iv4DdQHzcpZyF4v19I27w9/yPGDFQvmEpKtqv/TLiWMfn4sofMm9eAH8Ao0zzh7h4sJqYtxZd5/D7hkYPneDzl5idlzNHcIB0jVlQ+8ULzw/nc5/ojzl2juE0apD7LRnJxe04dMz2iOCFNtGFpTuXA5AhcTRo8mdN4kz30nVjEC4YTZQy4gpC7GlTlrePKhGsKKgeXpCYeO0MAd/GH7yKQUlXPLOasOH3FnSphjHuDvEu4gB8g66oNbtr6eMbFIA4fIBJkgayoXriw2XEDQPJrQeROAlY6aeYOcMf+IVYTU3XFlZufMHinGywaW3YLpObVBAsbjF4QJMsVUSayjk4voPsHJOQfPWDhCgDnmDl6XIRerD24HsGtw86RMHOLvVSHrKBdeVE26gKB5NKHzaIwLOmrqBWJYZDLhASG16c0Tn+CdRhWDgWXnqRZUTnPIHuMJTfLVpkoYy5CzylHVTGZMTwkGAo2HBlkQplrJX6U+uF1wZz2uwS1SQ12IqWaPuO4baZaEFBdukksJmkcTOm+YJSvoqPFzxFA/YUhIvWxcmSdPWTWwbAKVp6rxTtPFUZfKIwpzm4IoMfaYQLWgmlG5FME2gdBgm+J7J+rtS/XBbaVLsR7bpPQnpMFlo2doWaVceHk9+MkyguZNCJ1He+kuHTWyQAzNM5YSUg/GlTk9ZunAsg1qELVOhUSAK0LABIJHLKbqaEbHZLL1VA3VgqoiOKXYiS+HRyaEKgsfIqX64HYWbLRXy/qWoylIV9gudL1OWBNgBgTNmxA6b4txDT4gi3Ri7xFSLxtXpmmYnzAcWDZgY8d503LFogz5sbonDgkKcxGsWsE1OI+rcQtlgBBCSOKD1mtqYpIU8cTvBmAT0yZe+zUzeY92fYjTtGipXLhuR0ePoHk0ofNWBX+lo8Z7pAZDk8mEw5L7dVyZZoE/pTewbI6SNbiAL5xeygW4xPRuLCGbhcO4RIeTMFYHEJkYyEO9HmJfXMDEj/LaH781wHHZEtqSQ/69UnGpzH7LKIAZEDSPJnTesJTUa+rwTepI9dLJEawYV+ZkRn9g+QirD8vF8Mq0jFQ29js6kCS3E1+jZIhgPNanHdHFqFvPJLHqFwQqbIA4jhDxcNsOCCQLDomaL/dr5lyJaJU6FxPFjO3JOh3kVMcROo8u+C+jo05GjMF3P3/FuDLn5x2M04xXULPwaS6hBYki+MrMdZJSgPHlcB7nCR5bJ9Kr5ACUn9jk5kivdd8tk95SOGrtqu9lr2IhK65ZtEl7ZKrp7DrqwZfRUSN1el7+7NJxZbywOC8neNKTch5vsTEMNsoCCqHBCqIPRjIPkm0BjvFODGtto99rCl+d3wmHkW0FPdpZtC7MMcVtGFQjJLX5bdQ2+x9ypdc313uj8xlsrfuLgWXz1cRhZvJYX0iNVBRcVcmCXZs6aEf3RQF2WI/TcCbKmGU3IOoDJGDdDub0+hYckt6PlGu2BcxmhbTdj/klhccLGJMcqRjMJP1jW2ETqLSWJ/29MAoORluJ+6LPffBZbi5gqi5h6catQpmOT7/OFf5UorRpLzCqcMltBLhwd1are3kztrSzXO0LUbXRQcdLh/RdSZ+swRm819REDrtqzC4es6Gw4JCKlSnjYVpo0xeq33PrADbFLL3RuCmObVmPN+24kfa+AojDuM4umKe2QwCf6EN906HwjujaitDs5o0s1y+k3lgbT2W2i7FJdnwbLXhJUBq/9liTctSmFC/0OqUinb0QddTWamtjbHRFuWJJ6NpqZ8vO3fZJ37Db+2GkaPYLGHs7XTTdiFQJ68SkVJFVmY6McR5UycflNCsccHFaV9FNbR4NttLxw4pQ7wJd066Z0ohVbzihaxHVExd/ay04oxUKWt+AsdiQ9OUyZ2krzN19IZIwafSTFgIBnMV73ADj7V/K8u1MaY2sJp2HWm0f41tqwajEvdHWOJs510MaAqN4aoSiPCXtN2KSi46dUxHdaMquar82O1x5jqhDGvqmoE9LfxcY3zqA7/x3HA67r9ZG4O6Cuxu12/+TP+eLP+I+HErqDDCDVmBDO4larujNe7x8om2rMug0MX0rL1+IWwdwfR+p1TNTyNmVJ85ljWzbWuGv8/C7HD/izjkHNZNYlhZcUOKVzKFUxsxxN/kax+8zPWPSFKw80rJr9Tizyj3o1gEsdwgWGoxPezDdZ1TSENE1dLdNvuKL+I84nxKesZgxXVA1VA1OcL49dFlpFV5yJMhzyCmNQ+a4BqusPJ2bB+xo8V9u3x48VVIEPS/mc3DvAbXyoYr6VgDfh5do5hhHOCXMqBZUPhWYbWZECwVJljLgMUWOCB4MUuMaxGNUQDVI50TQ+S3kFgIcu2qKkNSHVoM0SHsgoZxP2d5HH8B9woOk4x5bPkKtAHucZsdykjxuIpbUrSILgrT8G7G5oCW+K0990o7E3T6AdW4TilH5kDjds+H64kS0mz24grtwlzDHBJqI8YJQExotPvoC4JBq0lEjjQkyBZ8oH2LnRsQ4Hu1QsgDTJbO8fQDnllitkxuVskoiKbRF9VwzMDvxHAdwB7mD9yCplhHFEyUWHx3WtwCbSMMTCUCcEmSGlg4gTXkHpZXWQ7kpznK3EmCHiXInqndkQjunG5kxTKEeGye7jWz9cyMR2mGiFQ15ENRBTbCp+Gh86vAyASdgmJq2MC6hoADQ3GosP0QHbnMHjyBQvQqfhy/BUbeHd5WY/G/9LK/8Ka8Jd7UFeNWEZvzPb458Dn8DGLOe3/wGL/4xP+HXlRt+M1PE2iLhR8t+lfgxsuh7AfO2AOf+owWhSZRYQbd622hbpKWKuU+XuvNzP0OseRDa+mObgDHJUSc/pKx31QdKffQ5OIJpt8GWjlgTwMc/w5MPCR/yl1XC2a2Yut54SvOtMev55Of45BOat9aWG27p2ZVORRvnEk1hqWMVUmqa7S2YtvlIpspuF1pt0syuZS2NV14mUidCSfzQzg+KqvIYCMljIx2YK2AO34fX4GWdu5xcIAb8MzTw+j/lyWM+Dw/gjs4GD6ehNgA48kX/AI7XXM/XAN4WHr+9ntywqoCakCqmKP0rmQrJJEErG2Upg1JObr01lKQy4jskWalKYfJ/EDLMpjNSHFEUAde2fltaDgmrNaWQ9+AAb8I5vKjz3L1n1LriB/BXkG/wwR9y/oRX4LlioHA4LzP2inzRx/DWmutRweFjeP3tNeSGlaE1Fde0OS11yOpmbIp2u/jF1n2RRZviJM0yBT3IZl2HWImKjQOxIyeU325b/qWyU9Moj1o07tS0G7qJDoGHg5m8yeCxMoEH8GU45tnrNM84D2l297DQ9t1YP7jki/7RmutRweEA77/HWXOh3HCxkRgldDQkAjNTMl2Iloc1qN5JfJeeTlyTRzxURTdn1Ixv2uKjs12AbdEWlBtmVdk2k7FFwj07PCZ9XAwW3dG+8xKzNFr4EnwBZpy9Qzhh3jDXebBpYcpuo4fQ44u+fD1dweEnHzI7v0xuuOALRUV8rXpFyfSTQYkhd7IHm07jpyhlkCmI0ALYqPTpUxXS+z4jgDj1Pflvmz5ecuItpIBxyTHpSTGWd9g1ApfD/bvwUhL4nT1EzqgX7cxfCcNmb3mPL/qi9SwTHJ49oj5ZLjccbTG3pRmlYi6JCG0mQrAt1+i2UXTZ2dv9IlQpN5naMYtviaXlTrFpoMsl3bOAFEa8sqPj2WCMrx3Yjx99qFwO59Aw/wgx+HlqNz8oZvA3exRDvuhL1jMQHPaOJ0+XyA3fp1OfM3qObEVdhxjvynxNMXQV4+GJyvOEFqeQBaIbbO7i63rpxCltdZShPFxkjM2FPVkn3TG+Rp9pO3l2RzFegGfxGDHIAh8SteR0C4HopXzRF61nheDw6TFN05Ebvq8M3VKKpGjjO6r7nhudTEGMtYM92HTDaR1FDMXJ1eThsbKfywyoWwrzRSXkc51flG3vIid62h29bIcFbTGhfV+faaB+ohj7dPN0C2e2lC96+XouFByen9AsunLDJZ9z7NExiUc0OuoYW6UZkIyx2YUR2z6/TiRjyKMx5GbbjLHvHuf7YmtKghf34LJfx63Yg8vrvN2zC7lY0x0tvKezo4HmGYDU+Gab6dFL+KI761lDcNifcjLrrr9LWZJctG1FfU1uwhoQE22ObjdfkSzY63CbU5hzs21WeTddH2BaL11Gi7lVdlxP1nkxqhnKhVY6knS3EPgVGg1JpN5cP/hivujOelhXcPj8HC/LyI6MkteVjlolBdMmF3a3DbsuAYhL44dxzthWSN065xxUd55Lmf0wRbOYOqH09/o9WbO2VtFdaMb4qBgtFJoT1SqoN8wPXMoXLb3p1PUEhxfnnLzGzBI0Ku7FxrKsNJj/8bn/H8fPIVOd3rfrklUB/DOeO+nkghgSPzrlPxluCMtOnDL4Yml6dK1r3vsgMxgtPOrMFUZbEUbTdIzii5beq72G4PD0DKnwjmBULUVFmy8t+k7fZ3pKc0Q4UC6jpVRqS9Umv8bxw35flZVOU1X7qkjnhZlsMbk24qQ6Hz7QcuL6sDC0iHHki96Uh2UdvmgZnjIvExy2TeJdMDZNSbdZyAHe/Yd1xsQhHiKzjh7GxQ4yqMPaywPkjMamvqrYpmO7Knad+ZQC5msCuAPWUoxrxVhrGv7a+KLXFhyONdTMrZ7ke23qiO40ZJUyzgYyX5XyL0mV7NiUzEs9mjtbMN0dERqwyAJpigad0B3/zRV7s4PIfXSu6YV/MK7+OrYe/JvfGMn/PHJe2fyUdtnFrKRNpXV0Y2559aWPt/G4BlvjTMtXlVIWCnNyA3YQBDmYIodFz41PvXPSa6rq9lWZawZ4dP115HXV/M/tnFkkrBOdzg6aP4pID+MZnTJ1SuuB6iZlyiox4HT2y3YBtkUKWooacBQUDTpjwaDt5poBHl1/HXltwP887lKKXxNUEyPqpGTyA699UqY/lt9yGdlUKra0fFWS+36iylVWrAyd7Uw0CZM0z7xKTOduznLIjG2Hx8cDPLb+OvK6Bv7n1DYci4CxUuRxrjBc0bb4vD3rN5Zz36ntLb83eVJIB8LiIzCmn6SMPjlX+yNlTjvIGjs+QzHPf60Aj62/jrzG8j9vYMFtm1VoRWCJdmw7z9N0t+c8cxZpPeK4aTRicS25QhrVtUp7U578chk4q04Wx4YoQSjFryUlpcQ1AbxZ/XVMknIU//OGl7Q6z9Zpxi0+3yFhSkjUDpnCIUhLWVX23KQ+L9vKvFKI0ZWFQgkDLvBoylrHNVmaw10zwCPrr5tlodfnf94EWnQ0lFRWy8pW9LbkLsyUVDc2NSTHGDtnD1uMtchjbCeb1mpxFP0YbcClhzdLu6lfO8Bj6q+bdT2sz/+8SZCV7VIxtt0DUn9L7r4cLYWDSXnseEpOGFuty0qbOVlS7NNzs5FOGJUqQpl2Q64/yBpZf90sxbE+//PGdZ02HSipCbmD6NItmQ4Lk5XUrGpDMkhbMm2ZVheNYV+VbUWTcv99+2NyX1VoafSuC+AN6q9bFIMv5X/eagNWXZxEa9JjlMwNWb00akGUkSoepp1/yRuuqHGbUn3UdBSTxBU6SEVklzWRUkPndVvw2PrrpjvxOvzPmwHc0hpmq82npi7GRro8dXp0KXnUQmhZbRL7NEVp1uuZmO45vuzKsHrktS3GLWXODVjw+vXXLYx4Hf7njRPd0i3aoAGX6W29GnaV5YdyDj9TFkakje7GHYzDoObfddHtOSpoi2SmzJHrB3hM/XUDDEbxP2/oosszcRlehWXUvzHv4TpBVktHqwenFo8uLVmy4DKLa5d3RtLrmrM3aMFr1183E4sewf+85VWeg1c5ag276NZrM9IJVNcmLEvDNaV62aq+14IAOGFsBt973Ra8Xv11YzXwNfmft7Jg2oS+XOyoC8/cwzi66Dhmgk38kUmP1CUiYWOX1bpD2zWXt2FCp7uq8703APAa9dfNdscR/M/bZLIyouVxqJfeWvG9Je+JVckHQ9+CI9NWxz+blX/KYYvO5n2tAP/vrlZ7+8/h9y+9qeB/Hnt967e5mevX10rALDWK//FaAT5MXdBXdP0C/BAes792c40H+AiAp1e1oH8HgH94g/Lttx1gp63op1eyoM/Bvw5/G/7xFbqJPcCXnmBiwDPb/YKO4FX4OjyCb289db2/Noqicw4i7N6TVtoz8tNwDH+8x/i6Ae7lmaQVENzJFb3Di/BFeAwz+Is9SjeQySpPqbLFlNmyz47z5a/AF+AYFvDmHqibSXTEzoT4Gc3OALaqAP4KPFUJ6n+1x+rGAM6Zd78bgJ0a8QN4GU614vxwD9e1Amy6CcskNrczLx1JIp6HE5UZD/DBHrFr2oNlgG4Odv226BodoryjGJ9q2T/AR3vQrsOCS0ctXZi3ruLlhpFDJYl4HmYtjQCP9rhdn4suySLKDt6wLcC52h8xPlcjju1fn+yhuw4LZsAGUuo2b4Fx2UwQu77uqRHXGtg92aN3tQCbFexc0uk93vhTXbct6y7MulLycoUljx8ngDMBg1tvJjAazpEmOtxlzclvj1vQf1Tx7QlPDpGpqgtdSKz/d9/hdy1vTfFHSmC9dGDZbLiezz7Ac801HirGZsWjydfZyPvHXL/Y8Mjzg8BxTZiuwKz4Eb8sBE9zznszmjvFwHKPIWUnwhqfVRcd4Ck0K6ate48m1oOfrX3/yOtvAsJ8zsPAM89sjnddmuLuDPjX9Bu/L7x7xpMzFk6nWtyQfPg278Gn4Aekz2ZgOmU9eJ37R14vwE/BL8G3aibCiWMWWDQ0ZtkPMnlcGeAu/Ag+8ZyecU5BPuy2ILD+sQqyZhAKmn7XZd+jIMTN9eBL7x95xVLSX4On8EcNlXDqmBlqS13jG4LpmGbkF/0CnOi3H8ETOIXzmnmtb0a16Tzxj1sUvQCBiXZGDtmB3KAefPH94xcUa/6vwRn80GOFyjEXFpba4A1e8KQfFF+259tx5XS4egYn8fQsLGrqGrHbztr+uByTahWuL1NUGbDpsnrwBfePPwHHIf9X4RnM4Z2ABWdxUBlqQ2PwhuDxoS0vvqB1JzS0P4h2nA/QgTrsJFn+Y3AOjs9JFC07CGWX1oNX3T/yHOzgDjwPn1PM3g9Jk9lZrMEpxnlPmBbjyo2+KFXRU52TJM/2ALcY57RUzjObbjqxVw++4P6RAOf58pcVsw9Daje3htriYrpDOonre3CudSe6bfkTEgHBHuDiyu5MCsc7BHhYDx7ePxLjqigXZsw+ijMHFhuwBmtoTPtOxOrTvYJDnC75dnUbhfwu/ZW9AgYd+peL68HD+0emKquiXHhWjJg/UrkJYzuiaL3E9aI/ytrCvAd4GcYZMCkSQxfUg3v3j8c4e90j5ZTPdvmJJGHnOCI2nHS8081X013pHuBlV1gB2MX1YNmWLHqqGN/TWmG0y6clJWthxNUl48q38Bi8vtMKyzzpFdSDhxZ5WBA5ZLt8Jv3895DduBlgbPYAj8C4B8hO68FDkoh5lydC4FiWvBOVqjYdqjiLv92t8yPDjrDaiHdUD15qkSURSGmXJwOMSxWAXYwr3zaAufJ66l+94vv3AO+vPcD7aw/w/toDvL/2AO+vPcD7aw/wHuD9tQd4f+0B3l97gPfXHuD9tQd4f+0B3l97gG8LwP8G/AL8O/A5OCq0Ys2KIdv/qOIXG/4mvFAMF16gZD+2Xvu/B8as5+8bfllWyg0zaNO5bfXj6vfhhwD86/Aq3NfRS9t9WPnhfnvCIw/CT8GLcFTMnpntdF/z9V+PWc/vWoIH+FL3Znv57PitcdGP4R/C34avw5fgRVUInCwbsn1yyA8C8zm/BH8NXoXnVE6wVPjdeCI38kX/3+Ct9dbz1pTmHFRu+Hm4O9Ch3clr99negxfwj+ER/DR8EV6B5+DuQOnTgUw5rnkY+FbNU3gNXh0o/JYTuWOvyBf9FvzX663HH/HejO8LwAl8Hl5YLTd8q7sqA3wbjuExfAFegQdwfyDoSkWY8swzEf6o4Qyewefg+cHNbqMQruSL/u/WWc+E5g7vnnEXgDmcDeSGb/F4cBcCgT+GGRzDU3hZYburAt9TEtHgbM6JoxJ+6NMzzTcf6c2bycv2+KK/f+l6LBzw5IwfqZJhA3M472pWT/ajKxnjv4AFnMEpnBTPND6s2J7qHbPAqcMK74T2mZ4VGB9uJA465It+/eL1WKhYOD7xHOkr1ajK7d0C4+ke4Hy9qXZwpgLr+Znm/uNFw8xQOSy8H9IzjUrd9+BIfenYaylf9FsXr8fBAadnPIEDna8IBcwlxnuA0/Wv6GAWPd7dDIKjMdSWueAsBj4M7TOd06qBbwDwKr7oleuxMOEcTuEZTHWvDYUO7aHqAe0Bbq+HEFRzOz7WVoTDQkVds7A4sIIxfCQdCefFRoIOF/NFL1mPab/nvOakSL/Q1aFtNpUb/nFOVX6gzyg/1nISyDfUhsokIzaBR9Kxm80s5mK+6P56il1jXic7nhQxsxSm3OwBHl4fFdLqi64nDQZvqE2at7cWAp/IVvrN6/BFL1mPhYrGMBfOi4PyjuSGf6wBBh7p/FZTghCNWGgMzlBbrNJoPJX2mW5mwZfyRffXo7OFi5pZcS4qZUrlViptrXtw+GQoyhDPS+ANjcGBNRiLCQDPZPMHuiZfdFpPSTcQwwKYdRNqpkjm7AFeeT0pJzALgo7g8YYGrMHS0iocy+YTm2vyRUvvpXCIpQ5pe666TJrcygnScUf/p0NDs/iAI/nqDHC8TmQT8x3NF91l76oDdQGwu61Z6E0ABv7uO1dbf/37Zlv+Zw/Pbh8f1s4Avur6657/+YYBvur6657/+YYBvur6657/+YYBvur6657/+aYBvuL6657/+VMA8FXWX/f8zzcN8BXXX/f8zzcNMFdbf93zP38KLPiK6697/uebtuArrr/u+Z9vGmCusP6653/+1FjwVdZf9/zPN7oHX339dc//fNMu+irrr3v+50+Bi+Zq6697/uebA/jz8Pudf9ht/fWv517J/XUzAP8C/BAeX9WCDrUpZ3/dEMBxgPcfbtTVvsYV5Yn32u03B3Ac4P3b8I+vxNBKeeL9dRMAlwO83959qGO78sT769oB7g3w/vGVYFzKE++v6wV4OMD7F7tckFkmT7y/rhHgpQO8b+4Y46XyxPvrugBeNcB7BRiX8sT767oAvmCA9woAHsoT76+rBJjLBnh3txOvkifeX1dswZcO8G6N7sXyxPvr6i340gHe3TnqVfLE++uKAb50gHcXLnrX8sR7gNdPRqwzwLu7Y/FO5Yn3AK9jXCMGeHdgxDuVJ75VAI8ljP7PAb3/RfjcZfePHBB+79dpfpH1CanN30d+mT1h9GqAxxJGM5LQeeQ1+Tb+EQJrElLb38VHQ94TRq900aMIo8cSOo+8Dp8QfsB8zpqE1NO3OI9Zrj1h9EV78PqE0WMJnUdeU6E+Jjyk/hbrEFIfeWbvId8H9oTRFwdZaxJGvziW0Hn0gqYB/wyZ0PwRlxJST+BOw9m77Amj14ii1yGM/txYQudN0qDzGe4EqfA/5GJCagsHcPaEPWH0esekSwmjRxM6b5JEcZ4ww50ilvAOFxBSx4yLW+A/YU8YvfY5+ALC6NGEzhtmyZoFZoarwBLeZxUhtY4rc3bKnjB6TKJjFUHzJoTOozF2YBpsjcyxDgzhQ1YRUse8+J4wenwmaylB82hC5w0zoRXUNXaRBmSMQUqiWSWkLsaVqc/ZE0aPTFUuJWgeTei8SfLZQeMxNaZSIzbII4aE1Nmr13P2hNHjc9E9guYNCZ032YlNwESMLcZiLQHkE4aE1BFg0yAR4z1h9AiAGRA0jyZ03tyIxWMajMPWBIsxYJCnlITU5ShiHYdZ94TR4wCmSxg9jtB5KyPGYzymAYexWEMwAPIsAdYdV6aObmNPGD0aYLoEzaMJnTc0Ygs+YDw0GAtqxBjkuP38bMRWCHn73xNGjz75P73WenCEJnhwyVe3AEe8TtKdJcYhBl97wuhNAObK66lvD/9J9NS75v17wuitAN5fe4D31x7g/bUHeH/tAd5fe4D3AO+vPcD7aw/w/toDvL/2AO+vPcD7aw/w/toDvAd4f/24ABzZ8o+KLsSLS+Pv/TqTb3P4hKlQrTGh+fbIBT0Axqznnb+L/V2mb3HkN5Mb/nEHeK7d4IcDld6lmDW/iH9E+AH1MdOw/Jlu2T1xNmY98sv4wHnD7D3uNHu54WUuOsBTbQuvBsPT/UfzNxGYzwkP8c+Yz3C+r/i6DcyRL/rZ+utRwWH5PmfvcvYEt9jLDS/bg0/B64DWKrQM8AL8FPwS9beQCe6EMKNZYJol37jBMy35otdaz0Bw2H/C2Smc7+WGB0HWDELBmOByA3r5QONo4V+DpzR/hFS4U8wMW1PXNB4TOqYz9urxRV++ntWCw/U59Ty9ebdWbrgfRS9AYKKN63ZokZVygr8GZ/gfIhZXIXPsAlNjPOLBby5c1eOLvmQ9lwkOy5x6QV1j5TYqpS05JtUgUHUp5toHGsVfn4NX4RnMCe+AxTpwmApTYxqMxwfCeJGjpXzRF61nbcHhUBPqWze9svwcHJ+S6NPscKrEjug78Dx8Lj3T8D4YxGIdxmJcwhi34fzZUr7olevZCw5vkOhoClq5zBPZAnygD/Tl9EzDh6kl3VhsHYcDEb+hCtJSvuiV69kLDm+WycrOTArHmB5/VYyP6jOVjwgGawk2zQOaTcc1L+aLXrKeveDwZqlKrw8U9Y1p66uK8dEzdYwBeUQAY7DbyYNezBfdWQ97weEtAKYQg2xJIkuveAT3dYeLGH+ShrWNwZgN0b2YL7qznr3g8JYAo5bQBziPjx7BPZ0d9RCQp4UZbnFdzBddor4XHN4KYMrB2qHFRIzzcLAHQZ5the5ovui94PCWAPefaYnxIdzRwdHCbuR4B+tbiy96Lzi8E4D7z7S0mEPd+eqO3cT53Z0Y8SV80XvB4Z0ADJi/f7X113f+7p7/+UYBvur6657/+YYBvur6657/+aYBvuL6657/+aYBvuL6657/+aYBvuL6657/+aYBvuL6657/+VMA8FXWX/f8z58OgK+y/rrnf75RgLna+uue//lTA/CV1V/3/M837aKvvv6653++UQvmauuve/7nTwfAV1N/3fM/fzr24Cuuv+75nz8FFnxl9dc9//MOr/8/glixwRuUfM4AAAAASUVORK5CYII="}getSearchTexture(){return"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEIAAAAhCAAAAABIXyLAAAAAOElEQVRIx2NgGAWjYBSMglEwEICREYRgFBZBqDCSLA2MGPUIVQETE9iNUAqLR5gIeoQKRgwXjwAAGn4AtaFeYLEAAAAASUVORK5CYII="}},exports.SMAAWeightsShader=Ha,exports.SSAARenderPass=vl,exports.SSAOBlurShader=Ka,exports.SSAODepthShader=Ya,exports.SSAOPass=qa,exports.SSAOShader=Qa,exports.SSRBlurShader=fl,exports.SSRDepthShader=ml,exports.SSRPass=gl,exports.SSRShader=pl,exports.STLExporter=class{constructor(){p.default(this,"binary",void 0),p.default(this,"output",void 0),p.default(this,"offset",void 0),p.default(this,"objects",void 0),p.default(this,"triangles",void 0),p.default(this,"vA",void 0),p.default(this,"vB",void 0),p.default(this,"vC",void 0),p.default(this,"cb",void 0),p.default(this,"ab",void 0),p.default(this,"normal",void 0),this.binary=!1,this.output="",this.offset=80,this.objects=[],this.triangles=0,this.vA=new e.Vector3,this.vB=new e.Vector3,this.vC=new e.Vector3,this.cb=new e.Vector3,this.ab=new e.Vector3,this.normal=new e.Vector3}parse(t,r){if(this.binary=void 0!==r.binary&&r.binary,t.traverse((t=>{if(t instanceof e.Mesh&&t.isMesh){const e=t.geometry;if(!e.isBufferGeometry)throw new Error("THREE.STLExporter: Geometry is not of type THREE.BufferGeometry.");const r=e.index,i=e.getAttribute("position");this.triangles+=null!==r?r.count/3:i.count/3,this.objects.push({object3d:t,geometry:e})}})),this.binary){const e=2*this.triangles+3*this.triangles*4*4+80+4,t=new ArrayBuffer(e);this.output=new DataView(t),this.output.setUint32(this.offset,this.triangles,!0),this.offset+=4}else this.output="",this.output+="solid exported\n";for(let t=0,r=this.objects.length;t<r;t++){const r=this.objects[t].object3d,i=this.objects[t].geometry,n=i.index,s=i.getAttribute("position");if(r instanceof e.SkinnedMesh)if(null!==n)for(let e=0;e<n.count;e+=3){const t=n.getX(e+0),i=n.getX(e+1),o=n.getX(e+2);this.writeFace(t,i,o,s,r)}else for(let e=0;e<s.count;e+=3){const t=e+0,i=e+1,n=e+2;this.writeFace(t,i,n,s,r)}}return this.binary||(this.output+="endsolid exported\n"),this.output}writeFace(e,t,r,i,n){this.vA.fromBufferAttribute(i,e),this.vB.fromBufferAttribute(i,t),this.vC.fromBufferAttribute(i,r),n.isSkinnedMesh&&(n.boneTransform(e,this.vA),n.boneTransform(t,this.vB),n.boneTransform(r,this.vC)),this.vA.applyMatrix4(n.matrixWorld),this.vB.applyMatrix4(n.matrixWorld),this.vC.applyMatrix4(n.matrixWorld),this.writeNormal(this.vA,this.vB,this.vC),this.writeVertex(this.vA),this.writeVertex(this.vB),this.writeVertex(this.vC),this.binary&&this.output instanceof DataView?(this.output.setUint16(this.offset,0,!0),this.offset+=2):(this.output+="\t\tendloop\n",this.output+="\tendfacet\n")}writeNormal(e,t,r){this.cb.subVectors(r,t),this.ab.subVectors(e,t),this.cb.cross(this.ab).normalize(),this.normal.copy(this.cb).normalize(),this.binary&&this.output instanceof DataView?(this.output.setFloat32(this.offset,this.normal.x,!0),this.offset+=4,this.output.setFloat32(this.offset,this.normal.y,!0),this.offset+=4,this.output.setFloat32(this.offset,this.normal.z,!0),this.offset+=4):(this.output+=`\tfacet normal ${this.normal.x} ${this.normal.y} ${this.normal.z}\n`,this.output+="\t\touter loop\n")}writeVertex(e){this.binary&&this.output instanceof DataView?(this.output.setFloat32(this.offset,e.x,!0),this.offset+=4,this.output.setFloat32(this.offset,e.y,!0),this.offset+=4,this.output.setFloat32(this.offset,e.z,!0),this.offset+=4):this.output+="\t\t\tvertex vertex.x vertex.y vertex.z\n"}},exports.STLLoader=Qu,exports.SVGLoader=Wp,exports.SVGObject=be,exports.SVGRenderer=function(){var t,r,i,n,s,o,a,l,c,h,u,d,p,m=this,f=new ye,g=document.createElementNS("http://www.w3.org/2000/svg","svg"),v=new e.Box2,x=new e.Box2,y=new e.Color,b=new e.Color,A=new e.Color,w=new e.Color,M=new e.Color,T=new e.Color,S=new e.Vector3,C=new e.Vector3,F=new e.Vector3,E=new e.Matrix3,_=new e.Matrix4,P=new e.Matrix4,B=[],L=0,R=1,N=null;function D(){for(L=0;g.childNodes.length>0;)g.removeChild(g.childNodes[0])}function I(e){return null!==N?e.toFixed(N):e}function U(e,t,r){var i=t.scale.x*o,n=t.scale.y*a;r.isPointsMaterial&&(i*=r.size,n*=r.size);var s="M"+I(e.x-.5*i)+","+I(e.y-.5*n)+"h"+I(i)+"v"+I(n)+"h"+I(-i)+"z",l="";(r.isSpriteMaterial||r.isPointsMaterial)&&(l="fill:"+r.color.getStyle()+";fill-opacity:"+r.opacity),G(l,s)}function O(e,t,r,i){var n="M"+I(e.positionScreen.x)+","+I(e.positionScreen.y)+"L"+I(t.positionScreen.x)+","+I(t.positionScreen.y);if(i.isLineBasicMaterial){var s="fill:none;stroke:"+i.color.getStyle()+";stroke-opacity:"+i.opacity+";stroke-width:"+i.linewidth+";stroke-linecap:"+i.linecap;i.isLineDashedMaterial&&(s=s+";stroke-dasharray:"+i.dashSize+","+i.gapSize),G(s,n)}}function k(e,t,r,n,s){m.info.render.vertices+=3,m.info.render.faces++;var o="M"+I(e.positionScreen.x)+","+I(e.positionScreen.y)+"L"+I(t.positionScreen.x)+","+I(t.positionScreen.y)+"L"+I(r.positionScreen.x)+","+I(r.positionScreen.y)+"z";s.isMeshBasicMaterial?(y.copy(s.color),s.vertexColors&&y.multiply(n.color)):s.isMeshLambertMaterial||s.isMeshPhongMaterial||s.isMeshStandardMaterial?(b.copy(s.color),s.vertexColors&&b.multiply(n.color),y.copy(A),C.copy(e.positionWorld).add(t.positionWorld).add(r.positionWorld).divideScalar(3),function(e,t,r,i){for(let l=0,c=e.length;l<c;l++){var n=e[l],s=n.color;if(n.isDirectionalLight){var o=S.setFromMatrixPosition(n.matrixWorld).normalize();if((a=r.dot(o))<=0)continue;a*=n.intensity,i.r+=s.r*a,i.g+=s.g*a,i.b+=s.b*a}else if(n.isPointLight){var a;if(o=S.setFromMatrixPosition(n.matrixWorld),(a=r.dot(S.subVectors(o,t).normalize()))<=0)continue;if(0==(a*=0==n.distance?1:1-Math.min(t.distanceTo(o)/n.distance,1)))continue;a*=n.intensity,i.r+=s.r*a,i.g+=s.g*a,i.b+=s.b*a}}}(i,C,n.normalModel,y),y.multiply(b).add(s.emissive)):s.isMeshNormalMaterial&&(F.copy(n.normalModel).applyMatrix3(E).normalize(),y.setRGB(F.x,F.y,F.z).multiplyScalar(.5).addScalar(.5)),G(s.wireframe?"fill:none;stroke:"+y.getStyle()+";stroke-opacity:"+s.opacity+";stroke-width:"+s.wireframeLinewidth+";stroke-linecap:"+s.wireframeLinecap+";stroke-linejoin:"+s.wireframeLinejoin:"fill:"+y.getStyle()+";fill-opacity:"+s.opacity,o)}function V(e,t,r){var i,n=t.x-e.x,s=t.y-e.y,o=n*n+s*s;0!==o&&(n*=i=r/Math.sqrt(o),s*=i,t.x+=n,t.y+=s,e.x-=n,e.y-=s)}function G(e,t){p===e?d+=t:(z(),p=e,d=t)}function z(){d&&((u=function(e){if(null==B[e])return B[e]=document.createElementNS("http://www.w3.org/2000/svg","path"),0==R&&B[e].setAttribute("shape-rendering","crispEdges"),B[e];return B[e]}(L++)).setAttribute("d",d),u.setAttribute("style",p),g.appendChild(u)),d="",p=""}this.domElement=g,this.autoClear=!0,this.sortObjects=!0,this.sortElements=!0,this.overdraw=.5,this.info={render:{vertices:0,faces:0}},this.setQuality=function(e){switch(e){case"high":R=1;break;case"low":R=0}},this.setClearColor=function(e){T.set(e)},this.setPixelRatio=function(){},this.setSize=function(e,t){o=(n=e)/2,a=(s=t)/2,g.setAttribute("viewBox",-o+" "+-a+" "+n+" "+s),g.setAttribute("width",n),g.setAttribute("height",s),v.min.set(-o,-a),v.max.set(o,a)},this.getSize=function(){return{width:n,height:s}},this.setPrecision=function(e){N=e},this.clear=function(){D(),g.style.backgroundColor=T.getStyle()},this.render=function(n,s){if(s instanceof e.Camera!=!1){var u=n.background;u&&u.isColor?(D(),g.style.backgroundColor=u.getStyle()):!0===this.autoClear&&this.clear(),m.info.render.vertices=0,m.info.render.faces=0,_.copy(s.matrixWorldInverse),P.multiplyMatrices(s.projectionMatrix,_),t=f.projectScene(n,s,this.sortObjects,this.sortElements),r=t.elements,i=t.lights,E.getNormalMatrix(s.matrixWorldInverse),function(e){A.setRGB(0,0,0),w.setRGB(0,0,0),M.setRGB(0,0,0);for(let i=0,n=e.length;i<n;i++){var t=e[i],r=t.color;t.isAmbientLight?(A.r+=r.r,A.g+=r.g,A.b+=r.b):t.isDirectionalLight?(w.r+=r.r,w.g+=r.g,w.b+=r.b):t.isPointLight&&(M.r+=r.r,M.g+=r.g,M.b+=r.b)}}(i),d="",p="";for(let e=0,t=r.length;e<t;e++){var y=r[e],b=y.material;if(void 0!==b&&0!==b.opacity)if(x.makeEmpty(),y instanceof xe)(l=y).x*=o,l.y*=-a,U(l,y,b);else if(y instanceof ve)l=y.v1,c=y.v2,l.positionScreen.x*=o,l.positionScreen.y*=-a,c.positionScreen.x*=o,c.positionScreen.y*=-a,x.setFromPoints([l.positionScreen,c.positionScreen]),!0===v.intersectsBox(x)&&O(l,c,y,b);else if(y instanceof fe){if(l=y.v1,c=y.v2,h=y.v3,l.positionScreen.z<-1||l.positionScreen.z>1)continue;if(c.positionScreen.z<-1||c.positionScreen.z>1)continue;if(h.positionScreen.z<-1||h.positionScreen.z>1)continue;l.positionScreen.x*=o,l.positionScreen.y*=-a,c.positionScreen.x*=o,c.positionScreen.y*=-a,h.positionScreen.x*=o,h.positionScreen.y*=-a,this.overdraw>0&&(V(l.positionScreen,c.positionScreen,this.overdraw),V(c.positionScreen,h.positionScreen,this.overdraw),V(h.positionScreen,l.positionScreen,this.overdraw)),x.setFromPoints([l.positionScreen,c.positionScreen,h.positionScreen]),!0===v.intersectsBox(x)&&k(l,c,h,y,b)}}z(),n.traverseVisible((function(e){if(e instanceof be){if(S.setFromMatrixPosition(e.matrixWorld),S.applyMatrix4(P),S.z<-1||S.z>1)return;var t=S.x*o,r=-S.y*a,i=e.node;i.setAttribute("transform","translate("+t+","+r+")"),g.appendChild(i)}}))}else console.error("THREE.SVGRenderer.render: camera is not an instance of Camera.")}},exports.SavePass=class extends Ia{constructor(t){super(),void 0===Xa&&console.error("THREE.SavePass relies on CopyShader");const r=Xa;this.textureID="tDiffuse",this.uniforms=e.UniformsUtils.clone(r.uniforms),this.material=new e.ShaderMaterial({uniforms:this.uniforms,vertexShader:r.vertexShader,fragmentShader:r.fragmentShader}),this.renderTarget=t,void 0===this.renderTarget&&(this.renderTarget=new e.WebGLRenderTarget(window.innerWidth,window.innerHeight),this.renderTarget.texture.name="SavePass.rt"),this.needsSwap=!1,this.fsQuad=new Ua(this.material)}render(e,t,r){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=r.texture),e.setRenderTarget(this.renderTarget),this.clear&&e.clear(),this.fsQuad.render(e)}},exports.SceneUtils=no,exports.SelectionBox=su,exports.SelectionHelper=nu,exports.SepiaShader=Lh,exports.ShaderNode=ir,exports.ShaderPass=Oa,exports.ShadowMapViewer=Bo,exports.ShadowMesh=js,exports.SimplexNoise=Js,exports.SimplifyModifier=class{constructor(){p.default(this,"computeEdgeCollapseCost",((e,t)=>{const r=t.position.distanceTo(e.position);let i=0;const n=[];let s,o,a,l=e.faces.length;for(s=0;s<l;s++)o=e.faces[s],o.hasVertex(t)&&n.push(o);for(s=0;s<l;s++){let t=1;o=e.faces[s];for(let e=0;e<n.length;e++){a=n[e];const r=o.normal.dot(a.normal);t=Math.min(t,(1.001-r)/2)}i=Math.max(i,t)}n.length<2&&(i=1);return r*i+0})),p.default(this,"computeEdgeCostAtVertex",(e=>{if(0===e.neighbors.length)return e.collapseNeighbor=null,void(e.collapseCost=-.01);e.collapseCost=1e5,e.collapseNeighbor=null;for(let t=0;t<e.neighbors.length;t++){const r=this.computeEdgeCollapseCost(e,e.neighbors[t]);e.collapseNeighbor||(e.collapseNeighbor=e.neighbors[t],e.collapseCost=r,e.minCost=r,e.totalCost=0,e.costCount=0),e.costCount++,e.totalCost+=r,r<e.minCost&&(e.collapseNeighbor=e.neighbors[t],e.minCost=r)}e.collapseCost=e.totalCost/e.costCount})),p.default(this,"removeFace",((e,t)=>{Ve(t,e),e.v1&&Ve(e.v1.faces,e),e.v2&&Ve(e.v2.faces,e),e.v3&&Ve(e.v3.faces,e);const r=[e.v1,e.v2,e.v3];let i,n;for(let e=0;e<3;e++)i=r[e],n=r[(e+1)%3],i&&n&&(i.removeIfNonNeighbor(n),n.removeIfNonNeighbor(i))})),p.default(this,"collapse",((e,t,r,i)=>{if(!i)return void this.removeVertex(r,e);let n;const s=[];for(n=0;n<r.neighbors.length;n++)s.push(r.neighbors[n]);for(n=r.faces.length-1;n>=0;n--)r.faces[n].hasVertex(i)&&this.removeFace(r.faces[n],t);for(n=r.faces.length-1;n>=0;n--)r.faces[n].replaceVertex(r,i);for(this.removeVertex(r,e),n=0;n<s.length;n++)this.computeEdgeCostAtVertex(s[n])})),p.default(this,"minimumCostEdge",(e=>{let t=e[0];for(let r=0;r<e.length;r++)e[r].collapseCost<t.collapseCost&&(t=e[r]);return t})),p.default(this,"modify",((t,r)=>{const i=(t=t.clone()).attributes;for(let e in i)"position"!==e&&t.deleteAttribute(e);const n=[],s=[],o=(t=Re(t)).getAttribute("position");for(let t=0;t<o.count;t++){const r=(new e.Vector3).fromBufferAttribute(o,t),i=new Ge(r,t);n.push(i)}const a=t.getIndex();if(null!==a)for(let e=0;e<a.count;e+=3){const t=a.getX(e),r=a.getX(e+1),i=a.getX(e+2),o=new ze(n[t],n[r],n[i],t,r,i);s.push(o)}else for(let e=0;e<o.count;e+=3){const t=e,r=e+1,i=e+2,o=new ze(n[t],n[r],n[i],t,r,i);s.push(o)}for(let e=0,t=n.length;e<t;e++)this.computeEdgeCostAtVertex(n[e]);let l,c=r;for(;c--;){if(l=this.minimumCostEdge(n),!l){console.log("THREE.SimplifyModifier: No next vertex");break}this.collapse(n,s,l,l.collapseNeighbor)}const h=new e.BufferGeometry,u=[];let d=[];for(let e=0;e<n.length;e++){const t=n[e].position;u.push(t.x,t.y,t.z)}for(let e=0;e<s.length;e++){const t=s[e],r=n.indexOf(t.v1),i=n.indexOf(t.v2),o=n.indexOf(t.v3);d.push(r,i,o)}return h.setAttribute("position",new e.Float32BufferAttribute(u,3)),h.setIndex(d),h}))}removeVertex(e,t){for(console.assert(0===e.faces.length);e.neighbors.length;){Ve(e.neighbors.pop().neighbors,e)}Ve(t,e)}},exports.SkeletonUtils=Eo,exports.SkinningNode=An,exports.Sky=to,exports.SkyGeometry=G,exports.SobelOperatorShader=Rh,exports.SplitNode=Lt,exports.SpriteSheetUVNode=Un,exports.StereoEffect=function(t){const r=new e.StereoCamera;r.aspect=.5;const i=new e.Vector2;this.setEyeSeparation=e=>{r.eyeSep=e},this.setSize=(e,r)=>{t.setSize(e,r)},this.render=(e,n)=>{e.updateMatrixWorld(),null===n.parent&&n.updateMatrixWorld(),r.update(n),t.getSize(i),t.autoClear&&t.clear(),t.setScissorTest(!0),t.setScissor(0,0,i.width/2,i.height),t.setViewport(0,0,i.width/2,i.height),t.render(e,r.cameraL),t.setScissor(i.width/2,0,i.width/2,i.height),t.setViewport(i.width/2,0,i.width/2,i.height),t.render(e,r.cameraR),t.setScissorTest(!1)}},exports.SubsurfaceScatteringShader=Ih,exports.TAARenderPass=xl,exports.TDSLoader=Ud,exports.TGALoader=zu,exports.TTFLoader=wd,exports.TeapotGeometry=Yc,exports.TechnicolorShader=Vh,exports.TempNode=at,exports.TessellateModifier=class{constructor(t=.1,r=6){p.default(this,"maxEdgeLength",void 0),p.default(this,"maxIterations",void 0),p.default(this,"modify",(t=>{null!==t.index&&(t=t.toNonIndexed());const r=this.maxIterations,i=this.maxEdgeLength*this.maxEdgeLength,n=new e.Vector3,s=new e.Vector3,o=new e.Vector3,a=new e.Vector3,l=[n,s,o,a],c=new e.Vector3,h=new e.Vector3,u=new e.Vector3,d=new e.Vector3,p=[c,h,u,d],m=new e.Color,f=new e.Color,g=new e.Color,v=new e.Color,x=[m,f,g,v],y=new e.Vector2,b=new e.Vector2,A=new e.Vector2,w=new e.Vector2,M=[y,b,A,w],T=new e.Vector2,S=new e.Vector2,C=new e.Vector2,F=new e.Vector2,E=[T,S,C,F],_=t.attributes,P=void 0!==_.normal,B=void 0!==_.color,L=void 0!==_.uv,R=void 0!==_.uv2;let N=_.position.array,D=P?_.normal.array:null,I=B?_.color.array:null,U=L?_.uv.array:null,O=R?_.uv2.array:null,k=N,V=D,G=I,z=U,H=O,j=0,W=!0;function X(e,t,r){const i=l[e],n=l[t],s=l[r];if(k.push(i.x,i.y,i.z),k.push(n.x,n.y,n.z),k.push(s.x,s.y,s.z),P){const i=p[e],n=p[t],s=p[r];V.push(i.x,i.y,i.z),V.push(n.x,n.y,n.z),V.push(s.x,s.y,s.z)}if(B){const i=x[e],n=x[t],s=x[r];G.push(i.r,i.g,i.b),G.push(n.r,n.g,n.b),G.push(s.r,s.g,s.b)}if(L){const i=M[e],n=M[t],s=M[r];z.push(i.x,i.y),z.push(n.x,n.y),z.push(s.x,s.y)}if(R){const i=E[e],n=E[t],s=E[r];H.push(i.x,i.y),H.push(n.x,n.y),H.push(s.x,s.y)}}for(;W&&j<r;){j++,W=!1,N=k,k=[],P&&(D=V,V=[]),B&&(I=G,G=[]),L&&(U=z,z=[]),R&&(O=H,H=[]);for(let e=0,t=0,r=N.length;e<r;e+=9,t+=6){n.fromArray(N,e+0),s.fromArray(N,e+3),o.fromArray(N,e+6),P&&D&&(c.fromArray(D,e+0),h.fromArray(D,e+3),u.fromArray(D,e+6)),B&&I&&(m.fromArray(I,e+0),f.fromArray(I,e+3),g.fromArray(I,e+6)),L&&U&&(y.fromArray(U,t+0),b.fromArray(U,t+2),A.fromArray(U,t+4)),R&&O&&(T.fromArray(O,t+0),S.fromArray(O,t+2),C.fromArray(O,t+4));const r=n.distanceToSquared(s),l=s.distanceToSquared(o),p=n.distanceToSquared(o);r>i||l>i||p>i?(W=!0,r>=l&&r>=p?(a.lerpVectors(n,s,.5),P&&d.lerpVectors(c,h,.5),B&&v.lerpColors(m,f,.5),L&&w.lerpVectors(y,b,.5),R&&F.lerpVectors(T,S,.5),X(0,3,2),X(3,1,2)):l>=r&&l>=p?(a.lerpVectors(s,o,.5),P&&d.lerpVectors(h,u,.5),B&&v.lerpColors(f,g,.5),L&&w.lerpVectors(b,A,.5),R&&F.lerpVectors(S,C,.5),X(0,1,3),X(3,2,0)):(a.lerpVectors(n,o,.5),P&&d.lerpVectors(c,u,.5),B&&v.lerpColors(m,g,.5),L&&w.lerpVectors(y,A,.5),R&&F.lerpVectors(T,C,.5),X(0,1,3),X(3,1,2))):X(0,1,2)}}const Q=new e.BufferGeometry;return Q.setAttribute("position",new e.Float32BufferAttribute(k,3)),P&&Q.setAttribute("normal",new e.Float32BufferAttribute(V,3)),B&&Q.setAttribute("color",new e.Float32BufferAttribute(G,3)),L&&Q.setAttribute("uv",new e.Float32BufferAttribute(z,2)),R&&Q.setAttribute("uv2",new e.Float32BufferAttribute(H,2)),Q})),this.maxEdgeLength=t,this.maxIterations=r}},exports.TextBufferGeometry=Kc,exports.TextGeometry=Kc,exports.TextureNode=_t,exports.TexturePass=Za,exports.ThreeMFLoader=Fd,exports.TiltLoader=gm,exports.Timer=class{constructor(){p.default(this,"_previousTime",void 0),p.default(this,"_currentTime",void 0),p.default(this,"_delta",void 0),p.default(this,"_elapsed",void 0),p.default(this,"_timescale",void 0),p.default(this,"_useFixedDelta",void 0),p.default(this,"_fixedDelta",void 0),p.default(this,"_usePageVisibilityAPI",void 0),p.default(this,"_pageVisibilityHandler",void 0),this._previousTime=0,this._currentTime=0,this._delta=0,this._elapsed=0,this._timescale=1,this._useFixedDelta=!1,this._fixedDelta=16.67,this._usePageVisibilityAPI="undefined"!=typeof document&&void 0!==document.hidden}connect(){return this._usePageVisibilityAPI&&(this._pageVisibilityHandler=H.bind(this),document.addEventListener("visibilitychange",this._pageVisibilityHandler,!1)),this}dispose(){return this._usePageVisibilityAPI&&this._pageVisibilityHandler&&document.removeEventListener("visibilitychange",this._pageVisibilityHandler),this}disableFixedDelta(){return this._useFixedDelta=!1,this}enableFixedDelta(){return this._useFixedDelta=!0,this}getDelta(){return this._delta/1e3}getElapsedTime(){return this._elapsed/1e3}getFixedDelta(){return this._fixedDelta/1e3}getTimescale(){return this._timescale}reset(){return this._currentTime=this._now(),this}setFixedDelta(e){return this._fixedDelta=1e3*e,this}setTimescale(e){return this._timescale=e,this}update(){return!0===this._useFixedDelta?this._delta=this._fixedDelta:(this._previousTime=this._currentTime,this._currentTime=this._now(),this._delta=this._currentTime-this._previousTime),this._delta*=this._timescale,this._elapsed+=this._delta,this}get elapsedTime(){return this.getElapsedTime()}_now(){return("undefined"==typeof performance?Date:performance).now()}},exports.TimerNode=kn,exports.ToneMapShader=el,exports.ToonShader1=Gh,exports.ToonShader2=zh,exports.ToonShaderDotted=jh,exports.ToonShaderHatching=Hh,exports.TorusKnot=Uf,exports.TrackballControls=Ma,exports.TrackballControlsExp=class extends la{constructor(t,r){super(t,r),p.default(this,"trackball",void 0),p.default(this,"screenSpacePanning",void 0),p.default(this,"autoRotate",void 0),p.default(this,"mouseButtons",void 0),p.default(this,"touches",void 0),this.trackball=!0,this.screenSpacePanning=!0,this.autoRotate=!1,this.mouseButtons={LEFT:e.MOUSE.ROTATE,RIGHT:e.MOUSE.PAN},this.touches={ONE:e.TOUCH.ROTATE,TWO:e.TOUCH.DOLLY_PAN}}},exports.TransformControls=ua,exports.TransformControlsGizmo=da,exports.TransformControlsPlane=pa,exports.TreesGeometry=z,exports.TrefoilKnot=If,exports.TrefoilPolynomialKnot=kf,exports.TriangleBlurShader=Wh,exports.TubePainter=function(){const t=3e6,r=new e.BufferAttribute(new Float32Array(t),3);r.usage=e.DynamicDrawUsage;const i=new e.BufferAttribute(new Float32Array(t),3);i.usage=e.DynamicDrawUsage;const n=new e.BufferAttribute(new Float32Array(t),3);n.usage=e.DynamicDrawUsage;const s=new e.BufferGeometry;s.setAttribute("position",r),s.setAttribute("normal",i),s.setAttribute("color",n),s.drawRange.count=0;const o=new e.MeshStandardMaterial({vertexColors:!0}),a=new e.Mesh(s,o);a.frustumCulled=!1;const l=new e.Vector3,c=new e.Vector3,h=new e.Vector3,u=new e.Vector3,d=new e.Color(16777215);let p=1;function m(t,o,a,m){if(0===t.distanceToSquared(o))return;let f=s.drawRange.count;const g=function(t){const r=2*Math.PI,i=[],n=.01*t;for(let t=0;t<10;t++){const s=t/10*r;i.push(new e.Vector3(Math.sin(s)*n,Math.cos(s)*n,0))}return i}(p);for(let e=0,s=g.length;e<s;e++){const p=g[e],v=g[(e+1)%s];l.copy(p).applyMatrix4(m).add(o),c.copy(v).applyMatrix4(m).add(o),h.copy(v).applyMatrix4(a).add(t),u.copy(p).applyMatrix4(a).add(t),l.toArray(r.array,3*(f+0)),c.toArray(r.array,3*(f+1)),u.toArray(r.array,3*(f+2)),c.toArray(r.array,3*(f+3)),h.toArray(r.array,3*(f+4)),u.toArray(r.array,3*(f+5)),l.copy(p).applyMatrix4(m).normalize(),c.copy(v).applyMatrix4(m).normalize(),h.copy(v).applyMatrix4(a).normalize(),u.copy(p).applyMatrix4(a).normalize(),l.toArray(i.array,3*(f+0)),c.toArray(i.array,3*(f+1)),u.toArray(i.array,3*(f+2)),c.toArray(i.array,3*(f+3)),h.toArray(i.array,3*(f+4)),u.toArray(i.array,3*(f+5)),d.toArray(n.array,3*(f+0)),d.toArray(n.array,3*(f+1)),d.toArray(n.array,3*(f+2)),d.toArray(n.array,3*(f+3)),d.toArray(n.array,3*(f+4)),d.toArray(n.array,3*(f+5)),f+=6}s.drawRange.count=f}const f=new e.Vector3(0,1,0),g=new e.Vector3,v=new e.Vector3,x=new e.Matrix4,y=new e.Matrix4;let b=0;return{mesh:a,moveTo:function(e){g.copy(e),x.lookAt(v,g,f),v.copy(e),y.copy(x)},lineTo:function(e){g.copy(e),x.lookAt(v,g,f),m(g,v,x,y),v.copy(g),y.copy(x)},setSize:function(e){p=e},update:function(){const e=b,t=s.drawRange.count;e!==t&&(r.updateRange.offset=3*e,r.updateRange.count=3*(t-e),r.needsUpdate=!0,i.updateRange.offset=3*e,i.updateRange.count=3*(t-e),i.needsUpdate=!0,n.updateRange.offset=3*e,n.updateRange.count=3*(t-e),n.needsUpdate=!0,b=s.drawRange.count)}}},exports.USDZExporter=class{constructor(){p.default(this,"PRECISION",7),p.default(this,"materials",void 0),p.default(this,"textures",void 0),p.default(this,"files",void 0),this.materials={},this.textures={},this.files={}}async parse(t){this.files["model.usda"]=null;let r=this.buildHeader();t.traverseVisible((t=>{if(t instanceof e.Mesh&&t.isMesh&&t.material.isMeshStandardMaterial){const e=t.geometry,i=t.material,n="geometries/Geometry_"+e.id+".usd";if(!(n in this.files)){const t=this.buildMeshObject(e);this.files[n]=this.buildUSDFileAsString(t)}i.uuid in this.materials||(this.materials[i.uuid]=i),r+=this.buildXform(t,e,i)}})),r+=this.buildMaterials(this.materials),this.files["model.usda"]=n.strToU8(r),r=null;for(const e in this.textures){const t=this.textures[e],r=e.split("_")[1],i=1023===t.format,n=this.imageToCanvas(t.image,r),s=await new Promise((e=>null==n?void 0:n.toBlob(e,i?"image/png":"image/jpeg",1)));s&&(this.files[`textures/Texture_${e}.${i?"png":"jpg"}`]=new Uint8Array(await s.arrayBuffer()))}let i=0;for(const e in this.files){const t=this.files[e];i+=34+e.length;const r=63&i;if(4!==r&&null!==t&&t instanceof Uint8Array){const i=new Uint8Array(64-r);this.files[e]=[t,{extra:{12345:i}}]}t&&"number"==typeof t.length&&(i=t.length)}return n.zipSync(this.files,{level:0})}imageToCanvas(e,t){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){const r=1024/Math.max(e.width,e.height),i=document.createElement("canvas");i.width=e.width*Math.min(1,r),i.height=e.height*Math.min(1,r);const n=i.getContext("2d");if(null==n||n.drawImage(e,0,0,i.width,i.height),void 0!==t){const e=parseInt(t,16),r=(e>>16&255)/255,s=(e>>8&255)/255,o=(255&e)/255,a=null==n?void 0:n.getImageData(0,0,i.width,i.height);if(a){const e=null==a?void 0:a.data;for(let t=0;t<e.length;t+=4)e[t+0]=e[t+0]*r,e[t+1]=e[t+1]*s,e[t+2]=e[t+2]*o;null==n||n.putImageData(a,0,0)}}return i}}buildHeader(){return'#usda 1.0\n(\n customLayerData = {\n string creator = "Three.js USDZExporter"\n }\n metersPerUnit = 1\n upAxis = "Y"\n)\n'}buildUSDFileAsString(e){let t=this.buildHeader();return t+=e,n.strToU8(t)}buildXform(e,t,r){const i="Object_"+e.id,n=this.buildMatrix(e.matrixWorld);return e.matrixWorld.determinant()<0&&console.warn("THREE.USDZExporter: USDZ does not support negative scales",e),`def Xform "${i}" (\n prepend references = @./geometries/Geometry_${t.id}.usd@</Geometry>\n)\n{\n matrix4d xformOp:transform = ${n}\n uniform token[] xformOpOrder = ["xformOp:transform"]\n rel material:binding = </Materials/Material_${r.id}>\n}\n`}buildMatrix(e){const t=e.elements;return`( ${this.buildMatrixRow(t,0)}, ${this.buildMatrixRow(t,4)}, ${this.buildMatrixRow(t,8)}, ${this.buildMatrixRow(t,12)} )`}buildMatrixRow(e,t){return`(${e[t+0]}, ${e[t+1]}, ${e[t+2]}, ${e[t+3]})`}buildMeshObject(e){return`\ndef "Geometry"\n{\n ${this.buildMesh(e)}\n}\n`}buildMesh(e){const t=e.attributes,r=t.position.count;return`\n def Mesh "Geometry"\n {\n int[] faceVertexCounts = [${this.buildMeshVertexCount(e)}]\n int[] faceVertexIndices = [${this.buildMeshVertexIndices(e)}]\n normal3f[] normals = [${this.buildVector3Array(t.normal,r)}] (\n interpolation = "vertex"\n )\n point3f[] points = [${this.buildVector3Array(t.position,r)}]\n float2[] primvars:st = [${this.buildVector2Array(t.uv,r)}] (\n interpolation = "vertex"\n )\n uniform token subdivisionScheme = "none"\n }\n`}buildMeshVertexCount(e){const t=null!==e.index?e.index.array.length:e.attributes.position.count;return Array(t/3).fill(3).join(", ")}buildMeshVertexIndices(e){if(null!==e.index)return e.index.array.join(", ");const t=[],r=e.attributes.position.count;for(let e=0;e<r;e++)t.push(e);return t.join(", ")}buildVector3Array(e,t){if(void 0===e)return console.warn("USDZExporter: Normals missing."),Array(t).fill("(0, 0, 0)").join(", ");const r=[],i=e.array;for(let e=0;e<i.length;e+=3)r.push(`(${i[e+0].toPrecision(this.PRECISION)}, ${i[e+1].toPrecision(this.PRECISION)}, ${i[e+2].toPrecision(this.PRECISION)})`);return r.join(", ")}buildVector2Array(e,t){if(void 0===e)return console.warn("USDZExporter: UVs missing."),Array(t).fill("(0, 0)").join(", ");const r=[],i=e.array;for(let e=0;e<i.length;e+=2)r.push(`(${i[e+0].toPrecision(this.PRECISION)}, ${1-i[e+1].toPrecision(this.PRECISION)})`);return r.join(", ")}buildMaterials(e){const t=[];for(const r in e){const i=e[r];t.push(this.buildMaterial(i))}return`def "Materials"\n{\n${t.join("")}\n}\n`}buildMaterial(t){const r=" ",i=[],n=[];return null!==t.map?(i.push(`${r}color3f inputs:diffuseColor.connect = </Materials/Material_${t.id}/Texture_${t.map.id}_diffuse.outputs:rgb>`),n.push(this.buildTexture(t,t.map,"diffuse",t.color))):i.push(`${r}color3f inputs:diffuseColor = ${this.buildColor(t.color)}`),null!==t.emissiveMap?(i.push(`${r}color3f inputs:emissiveColor.connect = </Materials/Material_${t.id}/Texture_${t.emissiveMap.id}_emissive.outputs:rgb>`),n.push(this.buildTexture(t,t.emissiveMap,"emissive"))):t.emissive.getHex()>0&&i.push(`${r}color3f inputs:emissiveColor = ${this.buildColor(t.emissive)}`),null!==t.normalMap&&(i.push(`${r}normal3f inputs:normal.connect = </Materials/Material_${t.id}/Texture_${t.normalMap.id}_normal.outputs:rgb>`),n.push(this.buildTexture(t,t.normalMap,"normal"))),null!==t.aoMap&&(i.push(`${r}float inputs:occlusion.connect = </Materials/Material_${t.id}/Texture_${t.aoMap.id}_occlusion.outputs:r>`),n.push(this.buildTexture(t,t.aoMap,"occlusion"))),null!==t.roughnessMap&&1===t.roughness?(i.push(`${r}float inputs:roughness.connect = </Materials/Material_${t.id}/Texture_${t.roughnessMap.id}_roughness.outputs:g>`),n.push(this.buildTexture(t,t.roughnessMap,"roughness"))):i.push(`${r}float inputs:roughness = ${t.roughness}`),null!==t.metalnessMap&&1===t.metalness?(i.push(`${r}float inputs:metallic.connect = </Materials/Material_${t.id}/Texture_${t.metalnessMap.id}_metallic.outputs:b>`),n.push(this.buildTexture(t,t.metalnessMap,"metallic"))):i.push(`${r}float inputs:metallic = ${t.metalness}`),i.push(`${r}float inputs:opacity = ${t.opacity}`),t instanceof e.MeshPhysicalMaterial&&(i.push(`${r}float inputs:clearcoat = ${t.clearcoat}`),i.push(`${r}float inputs:clearcoatRoughness = ${t.clearcoatRoughness}`),i.push(`${r}float inputs:ior = ${t.ior}`)),`\n def Material "Material_${t.id}"\n {\n def Shader "PreviewSurface"\n {\n uniform token info:id = "UsdPreviewSurface"\n${i.join("\n")}\n int inputs:useSpecularWorkflow = 0\n token outputs:surface\n }\n token outputs:surface.connect = </Materials/Material_${t.id}/PreviewSurface.outputs:surface>\n token inputs:frame:stPrimvarName = "st"\n def Shader "uvReader_st"\n {\n uniform token info:id = "UsdPrimvarReader_float2"\n token inputs:varname.connect = </Materials/Material_${t.id}.inputs:frame:stPrimvarName>\n float2 inputs:fallback = (0.0, 0.0)\n float2 outputs:result\n }\n${n.join("\n")}\n }\n`}buildTexture(e,t,r,i){const n=t.id+(i?"_"+i.getHexString():""),s=1023===t.format;return this.textures[n]=t,`\n def Shader "Transform2d_${r}" (\n sdrMetadata = {\n string role = "math"\n }\n )\n {\n uniform token info:id = "UsdTransform2d"\n float2 inputs:in.connect = </Materials/Material_${e.id}/uvReader_st.outputs:result>\n float2 inputs:scale = ${this.buildVector2(t.repeat)}\n float2 inputs:translation = ${this.buildVector2(t.offset)}\n float2 outputs:result\n }\n def Shader "Texture_${t.id}_${r}"\n {\n uniform token info:id = "UsdUVTexture"\n asset inputs:file = @textures/Texture_${n}.${s?"png":"jpg"}@\n float2 inputs:st.connect = </Materials/Material_${e.id}/Transform2d_${r}.outputs:result>\n token inputs:wrapS = "repeat"\n token inputs:wrapT = "repeat"\n float outputs:r\n float outputs:g\n float outputs:b\n float3 outputs:rgb\n }`}buildColor(e){return`(${e.r}, ${e.g}, ${e.b})`}buildVector2(e){return`(${e.x}, ${e.y})`}},exports.UVNode=Et,exports.UVsDebug=function(t,r){var i=new e.Vector2,n=new e.Vector2,s=[new e.Vector2,new e.Vector2,new e.Vector2],o=[],a=document.createElement("canvas"),l=r||1024,c=r||1024;a.width=l,a.height=c;var h=a.getContext("2d");if(h.lineWidth=1,h.strokeStyle="rgb( 63, 63, 63 )",h.textAlign="center",h.fillStyle="rgb( 255, 255, 255 )",h.fillRect(0,0,l,c),!t.isGeometry){var u=t.index,d=t.attributes.uv;if(u)for(let e=0,t=u.count;e<t;e+=3)o[0]=u.getX(e),o[1]=u.getX(e+1),o[2]=u.getX(e+2),s[0].fromBufferAttribute(d,o[0]),s[1].fromBufferAttribute(d,o[1]),s[2].fromBufferAttribute(d,o[2]),p(o,s,e/3);else for(let e=0,t=d.count;e<t;e+=3)o[0]=e,o[1]=e+1,o[2]=e+2,s[0].fromBufferAttribute(d,o[0]),s[1].fromBufferAttribute(d,o[1]),s[2].fromBufferAttribute(d,o[2]),p(o,s,e/3);return a}function p(e,t,r){h.beginPath(),i.set(0,0);for(let e=0,r=t.length;e<r;e++){var s=t[e];i.x+=s.x,i.y+=s.y,0===e?h.moveTo(s.x*(l-2)+.5,(1-s.y)*(c-2)+.5):h.lineTo(s.x*(l-2)+.5,(1-s.y)*(c-2)+.5)}for(h.closePath(),h.stroke(),i.divideScalar(t.length),h.font="18px Arial",h.fillStyle="rgb( 63, 63, 63 )",h.fillText(r,i.x*l,(1-i.y)*c),i.x>.95&&h.fillText(r,i.x%1*l,(1-i.y)*c),h.font="12px Arial",h.fillStyle="rgb( 191, 191, 191 )",j=0,jl=t.length;j<jl;j++){s=t[j];n.addVectors(i,s).divideScalar(2);var o=e[j];h.fillText("abc"[j]+o,n.x*l,(1-n.y)*c),n.x>.95&&h.fillText("abc"[j]+o,n.x%1*l,(1-n.y)*c)}}console.error("THREE.UVsDebug no longer supports Geometry. Use THREE.BufferGeometry instead.")},exports.UniformNode=$e,exports.UnpackDepthRGBAShader=Po,exports.UnrealBloomPass=il,exports.VOXData3DTexture=class extends Hu{constructor(t){const r=t.data,i=t.size,n=i.x,s=i.x*i.y,o=new Uint8Array(i.x*i.y*i.z);for(let e=0;e<r.length;e+=4){o[r[e+0]+r[e+1]*n+r[e+2]*s]=255}super(o,i.x,i.y,i.z),this.format=e.RedFormat,this.minFilter=e.NearestFilter,this.magFilter=e.LinearFilter,this.unpackAlignment=1,this.needsUpdate=!0}},exports.VOXLoader=Um,exports.VOXMesh=Om,exports.VRButton=wc,exports.VRMLLoader=ad,exports.VRMLoader=od,exports.VTKLoader=_d,exports.V_GGX_SmithCorrelated=_n,exports.VarNode=Tt,exports.VaryNode=tt,exports.Vector2NodeUniform=class extends se{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}},exports.Vector2Uniform=se,exports.Vector3NodeUniform=class extends oe{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}},exports.Vector3Uniform=oe,exports.Vector4NodeUniform=class extends ae{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}},exports.Vector4Uniform=ae,exports.VertexNormalsHelper=Ff,exports.VertexTangentsHelper=wf,exports.VerticalBlurShader=Xh,exports.VerticalTiltShiftShader=Qh,exports.VignetteShader=Yh,exports.VivianiCurve=Rf,exports.Volume=Y,exports.VolumeRenderShader1=Kh,exports.VolumeSlice=Q,exports.Water=Qs,exports.Water2=ro,exports.WaterPass=class extends Ia{constructor(){super(),p.default(this,"material",void 0),p.default(this,"fsQuad",void 0),p.default(this,"factor",void 0),p.default(this,"time",void 0),p.default(this,"uniforms",void 0),this.uniforms=e.UniformsUtils.clone({tex:{value:null},time:{value:0},factor:{value:0},resolution:{value:new e.Vector2(64,64)}}),this.material=new e.ShaderMaterial({uniforms:this.uniforms,vertexShader:"\n varying vec2 vUv;\n void main(){ \n vUv = uv; \n vec4 modelViewPosition = modelViewMatrix * vec4(position, 1.0);\n gl_Position = projectionMatrix * modelViewPosition;\n }",fragmentShader:"\n uniform float time;\n uniform float factor;\n uniform vec2 resolution;\n uniform sampler2D tex;\n varying vec2 vUv;\n void main() { \n vec2 uv1 = vUv;\n vec2 uv = gl_FragCoord.xy/resolution.xy;\n float frequency = 6.0 * factor;\n float amplitude = 0.015 * factor;\n float x = uv1.y * frequency + time * .7; \n float y = uv1.x * frequency + time * .3;\n uv1.x += cos(x+y) * amplitude * cos(y);\n uv1.y += sin(x-y) * amplitude * cos(y);\n vec4 rgba = texture2D(tex, uv1);\n gl_FragColor = rgba;\n }"}),this.fsQuad=new Ua(this.material),this.factor=0,this.time=0}render(e,t,r){this.uniforms.tex.value=r.texture,this.uniforms.time.value=this.time,this.uniforms.factor.value=this.factor,this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(),this.fsQuad.render(e))}},exports.WaterRefractionShader=qh,exports.WebGPUSampled3DTexture=class extends ue{constructor(e){super(e),this.dimension=re.ThreeD,Object.defineProperty(this,"isSampled3DTexture",{value:!0})}},exports.WebGPUSampledArrayTexture=class extends ue{constructor(e){super(e),this.dimension=re.TwoDArray,Object.defineProperty(this,"isSampledArrayTexture",{value:!0})}},exports.WebGPUSampledCubeTexture=class extends ue{constructor(e){super(e),this.dimension=re.Cube,Object.defineProperty(this,"isSampledCubeTexture",{value:!0})}},exports.WebGPUSampledTexture=ue,exports.Wireframe=$m,exports.WireframeGeometry2=class extends Ym{constructor(t){super(),this.isWireframeGeometry2=!0,this.type="WireframeGeometry2",this.fromWireframeGeometry(new e.WireframeGeometry(t))}},exports.XLoader=rd,exports.XRControllerModelFactory=class{constructor(e=null){p.default(this,"gltfLoader",void 0),p.default(this,"path",void 0),p.default(this,"_assetCache",void 0),this.gltfLoader=e,this.path="https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles",this._assetCache={},this.gltfLoader||(this.gltfLoader=new wl)}createControllerModel(e){const t=new Lc;let r=null;const i=e=>{const i=e.data;"tracked-pointer"===i.targetRayMode&&i.gamepad&&Cc(i,this.path,"generic-trigger").then((({profile:e,assetPath:n})=>{if(!n)throw new Error("no asset path");t.motionController=new Pc(i,e,n);const s=t.motionController.assetUrl,o=this._assetCache[s];if(o)r=o.scene.clone(),Rc(t,r);else{if(!this.gltfLoader)throw new Error("GLTFLoader not set.");this.gltfLoader.setPath(""),this.gltfLoader.load(t.motionController.assetUrl,(e=>{t.motionController?(this._assetCache[s]=e,r=e.scene.clone(),Rc(t,r)):console.warn("motionController gone while gltf load, bailing...")}),null,(()=>{throw new Error(`Asset ${s} missing or malformed.`)}))}})).catch((e=>{console.warn(e)}))};e.addEventListener("connected",i);const n=()=>{e.removeEventListener("connected",i),e.removeEventListener("disconnected",n),t.motionController=null,r&&t.remove(r),r=null};return e.addEventListener("disconnected",n),t}},exports.XREstimatedLight=Dc,exports.XRHandMeshModel=vc,exports.XRHandModelFactory=class{constructor(){this.path=null}setPath(e){return this.path=e,this}createHandModel(e,t){const r=new kc(e);return e.addEventListener("connected",(i=>{const n=i.data;n.hand&&!r.motionController&&(r.xrInputSource=n,void 0===t||"spheres"===t?r.motionController=new Oc(r,e,this.path,n.handedness,{primitive:"sphere"}):"boxes"===t?r.motionController=new Oc(r,e,this.path,n.handedness,{primitive:"box"}):"mesh"===t&&(r.motionController=new vc(r,e,this.path,n.handedness)))})),e.addEventListener("disconnected",(()=>{})),r}},exports.XRHandPrimitiveModel=Oc,exports.XYZLoader=Ed,exports.abs=yi,exports.acos=bi,exports.add=Ur,exports.addTo=Ir,exports.alphaTest=vi,exports.and=Yr,exports.asin=Ai,exports.assign=Hr,exports.atan=wi,exports.attribute=Rr,exports.bitAnd=Jr,exports.bitOr=Zr,exports.bitXor=$r,exports.bmat3=Cr,exports.bmat4=Pr,exports.bool=hr,exports.buffer=Nr,exports.bvec2=mr,exports.bvec3=xr,exports.bvec4=wr,exports.calcBSplineDerivatives=uu,exports.calcBSplinePoint=cu,exports.calcBasisFunctionDerivatives=hu,exports.calcBasisFunctions=lu,exports.calcKoverI=du,exports.calcNURBSDerivatives=mu,exports.calcRationalCurveDerivatives=pu,exports.calcSurfacePoint=fu,exports.cameraPosition=pi,exports.ceil=Mi,exports.clamp=Ti,exports.color=or,exports.computeMorphedAttributes=De,exports.cond=Dr,exports.cos=Si,exports.createText=function(e,t){const r=document.createElement("canvas"),i=r.getContext("2d");let n=null;const s=100;i.font="normal 100px Arial",n=i.measureText(e);const o=n.width;r.width=o,r.height=s,i.font="normal 100px Arial",i.textAlign="center",i.textBaseline="middle",i.fillStyle="#ffffff",i.fillText(e,o/2,50);const a=new d.Texture(r);a.needsUpdate=!0;const l=new d.MeshBasicMaterial({color:16777215,side:d.DoubleSide,map:a,transparent:!0}),c=new d.PlaneGeometry(t*o/s,t);return new d.Mesh(c,l)},exports.cross=Ci,exports.dFdx=Ei,exports.dFdy=_i,exports.degrees=Fi,exports.diffuseColor=mi,exports.distance=Pi,exports.div=Vr,exports.dot=Bi,exports.edgeTable=Ks,exports.element=ri,exports.equal=zr,exports.estimateBytesUsed=Le,exports.exp=Li,exports.exp2=Ri,exports.faceforward=Ni,exports.fetchProfile=Cc,exports.fetchProfilesList=Sc,exports.findSpan=au,exports.float=ar,exports.floor=Di,exports.fract=Ii,exports.fromType=e=>new ss[e],exports.getDistanceAttenuation=En,exports.getErrorMessage=function(e){const t={1:window.WebGLRenderingContext,2:window.WebGL2RenderingContext},r=document.createElement("div");r.id="webglmessage",r.style.fontFamily="monospace",r.style.fontSize="13px",r.style.fontWeight="normal",r.style.textAlign="center",r.style.background="#fff",r.style.color="#000",r.style.padding="1.5em",r.style.width="400px",r.style.margin="5em auto 0";let i='Your $0 does not seem to support <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation" style="color:#000">$1</a>';return i=t[e]?i.replace("$0","graphics card"):i.replace("$0","browser"),i=i.replace("$1",{1:"WebGL",2:"WebGL 2"}[e]),r.innerHTML=i,r},exports.getUniforms=Te,exports.getWebGL2ErrorMessage=function(){return this.getErrorMessage(2)},exports.getWebGLErrorMessage=function(){return this.getErrorMessage(1)},exports.greaterThan=Wr,exports.greaterThanEqual=Qr,exports.imat3=Tr,exports.imat4=Er,exports.initSplineTexture=Ae,exports.int=lr,exports.interleaveAttributes=Be,exports.inversesqrt=Oi,exports.invert=Ui,exports.isWebGL2Available=function(){if(void 0!==X)return X;try{var e;let t;const r=document.createElement("canvas");return X=!(!window.WebGL2RenderingContext||!(t=r.getContext("webgl2"))),t&&(null===(e=t.getExtension("WEBGL_lose_context"))||void 0===e||e.loseContext()),X}catch(e){return X=!1}},exports.isWebGLAvailable=function(){if(void 0!==W)return W;try{var e;let t;const r=document.createElement("canvas");return W=!(!window.WebGLRenderingContext||!(t=r.getContext("webgl"))),t&&(null===(e=t.getExtension("WEBGL_lose_context"))||void 0===e||e.loseContext()),W}catch(e){return W=!1}},exports.ivec2=dr,exports.ivec3=gr,exports.ivec4=br,exports.join=Br,exports.label=(e,t)=>!0===(e=nr(e)).isVarNode?(e.name=t,e):nr(new Tt(e,t)),exports.length=ki,exports.lessThan=jr,exports.lessThanEqual=Xr,exports.log=Vi,exports.log2=Gi,exports.mat3=Mr,exports.mat4=Fr,exports.max=zi,exports.mergeBufferAttributes=Pe,exports.mergeBufferGeometries=_e,exports.mergeVertices=Re,exports.metalness=gi,exports.min=Hi,exports.mix=ji,exports.mod=Wi,exports.modifyShader=Se,exports.mul=kr,exports.negate=Xi,exports.nodeObject=nr,exports.normalGeometry=ii,exports.normalLocal=ni,exports.normalView=oi,exports.normalWorld=si,exports.normalize=Qi,exports.or=Kr,exports.positionLocal=li,exports.positionView=hi,exports.positionViewDirection=ui,exports.positionWorld=ci,exports.pow=Yi,exports.pow2=Ki,exports.pow3=qi,exports.pow4=Ji,exports.radians=Zi,exports.reflect=$i,exports.refract=en,exports.remainder=Gr,exports.roughness=fi,exports.round=tn,exports.sampler=e=>nr(new kt(!0===e.isNode?e:new _t(e),"sampler")),exports.saturate=rn,exports.scaleTo=Vf,exports.shiftLeft=ei,exports.shiftRight=ti,exports.sign=nn,exports.sin=sn,exports.smoothstep=on,exports.specularColor=xi,exports.sqrt=an,exports.step=ln,exports.sub=Or,exports.tan=cn,exports.temp=e=>nr(new Tt(nr(e))),exports.texture=(...e)=>nr(new _t(...e)),exports.toCreasedNormals=Ie,exports.toTrianglesDrawMode=Ne,exports.transformDirection=hn,exports.transformedNormalView=ai,exports.triTable=qs,exports.uint=cr,exports.umat3=Sr,exports.umat4=_r,exports.uniform=sr,exports.updateSplineTexture=we,exports.uv=Lr,exports.uvec2=pr,exports.uvec3=vr,exports.uvec4=Ar,exports.vec2=ur,exports.vec3=fr,exports.vec4=yr,exports.viewMatrix=di,exports.xor=qr;